diff options
Diffstat (limited to 'editeng')
233 files changed, 11272 insertions, 12918 deletions
diff --git a/editeng/source/outliner/makefile.mk b/editeng/AllLangResTarget_editeng.mk index df1c795801..bcc2c63220 100644..100755 --- a/editeng/source/outliner/makefile.mk +++ b/editeng/AllLangResTarget_editeng.mk @@ -2,7 +2,7 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2000, 2010 Oracle and/or its affiliates. +# Copyright 2000, 2011 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # @@ -25,36 +25,26 @@ # #************************************************************************* -PRJ=..$/.. +$(eval $(call gb_AllLangResTarget_AllLangResTarget,editeng)) -PRJNAME=editeng -TARGET=outliner -AUTOSEG=true -ENABLE_EXCEPTIONS=TRUE +$(eval $(call gb_AllLangResTarget_set_reslocation,editeng,svx)) -PROJECTPCH4DLL=TRUE -PROJECTPCH=outl_pch -PROJECTPCHSOURCE=outl_pch +$(eval $(call gb_AllLangResTarget_add_srs,editeng, editeng/res)) +$(eval $(call gb_SrsTarget_SrsTarget,editeng/res)) +$(eval $(call gb_SrsTarget_set_include,editeng/res,\ + $$(INCLUDE) \ + -I$(realpath $(SRCDIR)/editeng/inc) \ +)) -# --- Settings ----------------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Allgemein ---------------------------------------------------------- - -SLOFILES= \ - $(SLO)$/outlundo.obj \ - $(SLO)$/outliner.obj \ - $(SLO)$/outlin2.obj \ - $(SLO)$/paralist.obj \ - $(SLO)$/outlvw.obj \ - $(SLO)$/outleeng.obj \ - $(SLO)$/outlobj.obj - -SRS1NAME=$(TARGET) -SRC1FILES= outliner.src - -.INCLUDE : target.mk +# add src files here (complete path relative to repository root) +$(eval $(call gb_SrsTarget_add_files,editeng/res,\ + editeng/source/accessibility/accessibility.src \ + editeng/source/editeng/editeng.src \ + editeng/source/items/page.src \ + editeng/source/items/svxitems.src \ + editeng/source/misc/lingu.src \ + editeng/source/outliner/outliner.src \ +)) +# vim: set noet sw=4 ts=4: diff --git a/editeng/source/xml/makefile.mk b/editeng/CppunitTest_editeng_borderline.mk index bfcfeb70f1..6a8e847276 100644..100755 --- a/editeng/source/xml/makefile.mk +++ b/editeng/CppunitTest_editeng_borderline.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2011 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.12 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,22 +25,40 @@ # #************************************************************************* -PRJ=..$/.. -PRJNAME=editeng -TARGET=xml - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- +$(eval $(call gb_CppunitTest_CppunitTest,editeng_borderline)) -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk +$(eval $(call gb_CppunitTest_add_exception_objects,editeng_borderline, \ + editeng/qa/items/borderline_test \ +)) -# --- Files -------------------------------------------------------- -SLOFILES = \ - $(SLO)$/xmltxtimp.obj \ - $(SLO)$/xmltxtexp.obj +$(eval $(call gb_CppunitTest_add_linked_libs,editeng_borderline, \ + xo \ + basegfx \ + editeng \ + lng \ + svt \ + tk \ + vcl \ + svl \ + sot \ + utl \ + tl \ + comphelper \ + ucbhelper \ + cppuhelper \ + cppu \ + sal \ + salhelper \ + icuuc \ + i18nisolang1 \ + i18npaper \ + $(gb_STDLIBS) \ +)) -# --- Targets -------------------------------------------------------------- +$(eval $(call gb_CppunitTest_set_include,editeng_borderline,\ + $$(INCLUDE) \ + -I$(OUTDIR)/inc/offuh \ + -I$(OUTDIR)/inc \ +)) -.INCLUDE : target.mk +# vim: set noet sw=4 ts=4: diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk new file mode 100755 index 0000000000..df11ba7fb5 --- /dev/null +++ b/editeng/Library_editeng.mk @@ -0,0 +1,168 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Library_Library,editeng)) + +$(eval $(call gb_Library_add_package_headers,editeng,editeng_inc)) + +$(eval $(call gb_Library_add_precompiled_header,editeng,$(SRCDIR)/editeng/inc/pch/precompiled_editeng)) + +$(eval $(call gb_Library_set_include,editeng,\ + $$(INCLUDE) \ + -I$(realpath $(SRCDIR)/editeng/inc/pch) \ + -I$(realpath $(SRCDIR)/editeng/inc) \ + -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_set_defs,editeng,\ + $$(DEFS) \ + -DEDITENG_DLLIMPLEMENTATION \ +)) + +ifneq ($(strip $(EDITDEBUG)),) +$(eval $(call gb_Library_set_defs,editeng,\ + $$(DEFS) \ + -DEDITDEBUG \ +)) +endif + +$(eval $(call gb_Library_add_exception_objects,editeng,\ + editeng/inc/pch/precompiled_editeng \ + editeng/source/accessibility/AccessibleComponentBase \ + editeng/source/accessibility/AccessibleContextBase \ + editeng/source/accessibility/AccessibleEditableTextPara \ + editeng/source/accessibility/AccessibleHyperlink \ + editeng/source/accessibility/AccessibleImageBullet \ + editeng/source/accessibility/AccessibleParaManager \ + editeng/source/accessibility/AccessibleSelectionBase \ + editeng/source/accessibility/AccessibleStaticTextBase \ + editeng/source/accessibility/AccessibleStringWrap \ + editeng/source/editeng/editattr \ + editeng/source/editeng/editdbg \ + editeng/source/editeng/editdoc \ + editeng/source/editeng/editdoc2 \ + editeng/source/editeng/editeng \ + editeng/source/editeng/editobj \ + editeng/source/editeng/editsel \ + editeng/source/editeng/editundo \ + editeng/source/editeng/editview \ + editeng/source/editeng/edtspell \ + editeng/source/editeng/eehtml \ + editeng/source/editeng/eeng_pch \ + editeng/source/editeng/eeobj \ + editeng/source/editeng/eerdll \ + editeng/source/editeng/eertfpar \ + editeng/source/editeng/impedit \ + editeng/source/editeng/impedit2 \ + editeng/source/editeng/impedit3 \ + editeng/source/editeng/impedit4 \ + editeng/source/editeng/impedit5 \ + editeng/source/editeng/textconv \ + editeng/source/items/borderline \ + editeng/source/items/bulitem \ + editeng/source/items/charhiddenitem \ + editeng/source/items/flditem \ + editeng/source/items/frmitems \ + editeng/source/items/itemtype \ + editeng/source/items/justifyitem \ + editeng/source/items/numitem \ + editeng/source/items/optitems \ + editeng/source/items/paperinf \ + editeng/source/items/paraitem \ + editeng/source/items/svdfield \ + editeng/source/items/svxfont \ + editeng/source/items/textitem \ + editeng/source/items/writingmodeitem \ + editeng/source/items/xmlcnitm \ + editeng/source/misc/acorrcfg \ + editeng/source/misc/edtdlg \ + editeng/source/misc/forbiddencharacterstable \ + editeng/source/misc/hangulhanja \ + editeng/source/misc/splwrap \ + editeng/source/misc/svxacorr \ + editeng/source/misc/SvXMLAutoCorrectExport \ + editeng/source/misc/SvXMLAutoCorrectImport \ + editeng/source/misc/swafopt \ + editeng/source/misc/txtrange \ + editeng/source/misc/unolingu \ + editeng/source/outliner/outleeng \ + editeng/source/outliner/outlin2 \ + editeng/source/outliner/outliner \ + editeng/source/outliner/outlobj \ + editeng/source/outliner/outlundo \ + editeng/source/outliner/outlvw \ + editeng/source/outliner/outl_pch \ + editeng/source/outliner/paralist \ + editeng/source/rtf/rtfgrf \ + editeng/source/rtf/rtfitem \ + editeng/source/rtf/svxrtf \ + editeng/source/uno/unoedhlp \ + editeng/source/uno/unoedprx \ + editeng/source/uno/unoedsrc \ + editeng/source/uno/unofdesc \ + editeng/source/uno/unofield \ + editeng/source/uno/UnoForbiddenCharsTable \ + editeng/source/uno/unofored \ + editeng/source/uno/unoforou \ + editeng/source/uno/unoipset \ + editeng/source/uno/unonrule \ + editeng/source/uno/unopracc \ + editeng/source/uno/unotext \ + editeng/source/uno/unotext2 \ + editeng/source/uno/unoviwed \ + editeng/source/uno/unoviwou \ + editeng/source/xml/xmltxtexp \ + editeng/source/xml/xmltxtimp \ +)) + +# add libraries to be linked to editeng; again these names need to be given as +# specified in Repository.mk +$(eval $(call gb_Library_add_linked_libs,editeng,\ + xo \ + basegfx \ + lng \ + svt \ + tk \ + vcl \ + svl \ + sot \ + utl \ + tl \ + comphelper \ + ucbhelper \ + cppuhelper \ + cppu \ + sal \ + salhelper \ + icuuc \ + i18nisolang1 \ + i18npaper \ + $(gb_STDLIBS) \ +)) + +# vim: set noet sw=4 ts=4: + diff --git a/editeng/source/rtf/makefile.mk b/editeng/Makefile index 1af1f0c026..a79aff8310 100644..100755 --- a/editeng/source/rtf/makefile.mk +++ b/editeng/Makefile @@ -25,23 +25,14 @@ # #************************************************************************* -PRJ=..$/.. +ifeq ($(strip $(SOLARENV)),) +$(error No environment set!) +endif -PRJNAME=editeng -TARGET=rtf -ENABLE_EXCEPTIONS=TRUE -# --- Settings ----------------------------------------------------- +gb_PARTIALBUILD := T +GBUILDDIR := $(SOLARENV)/gbuild +include $(GBUILDDIR)/gbuild.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk -# --- Files -------------------------------------------------------- - -SLOFILES= \ - $(SLO)$/svxrtf.obj \ - $(SLO)$/rtfgrf.obj \ - $(SLO)$/rtfitem.obj - -# ========================================================================== - -.INCLUDE : target.mk +$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk))) +# vim: set noet sw=4 ts=4: diff --git a/editeng/inc/makefile.mk b/editeng/Module_editeng.mk index 6ecb444e03..e84a1587e3 100644..100755 --- a/editeng/inc/makefile.mk +++ b/editeng/Module_editeng.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2011 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,24 +25,22 @@ # #************************************************************************* -PRJ=.. - -PRJNAME=editeng -TARGET=inc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk +$(eval $(call gb_Module_Module,editeng)) -# --- Files -------------------------------------------------------- +$(eval $(call gb_Module_add_targets,editeng,\ + AllLangResTarget_editeng \ + Library_editeng \ + Package_inc \ +)) -.INCLUDE : target.mk +# add any runtime tests (unit tests) here +# remove if no tests +$(eval $(call gb_Module_add_check_targets,editeng,\ + CppunitTest_editeng_borderline \ +)) -.IF "$(ENABLE_PCH)"!="" -ALLTAR : \ - $(SLO)$/precompiled.pch \ - $(SLO)$/precompiled_ex.pch - -.ENDIF # "$(ENABLE_PCH)"!="" +# add any subsequent checks (e.g. complex tests) here +$(eval $(call gb_Module_add_subsequentcheck_targets,editeng,\ +)) +# vim: set noet sw=4 ts=4: diff --git a/editeng/Package_inc.mk b/editeng/Package_inc.mk new file mode 100755 index 0000000000..52fa0e854a --- /dev/null +++ b/editeng/Package_inc.mk @@ -0,0 +1,155 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Package_Package,editeng_inc,$(SRCDIR)/editeng/inc)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleComponentBase.hxx,editeng/AccessibleComponentBase.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleContextBase.hxx,editeng/AccessibleContextBase.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleEditableTextPara.hxx,editeng/AccessibleEditableTextPara.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleImageBullet.hxx,editeng/AccessibleImageBullet.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleParaManager.hxx,editeng/AccessibleParaManager.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleSelectionBase.hxx,editeng/AccessibleSelectionBase.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleStaticTextBase.hxx,editeng/AccessibleStaticTextBase.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleStringWrap.hxx,editeng/AccessibleStringWrap.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/acorrcfg.hxx,editeng/acorrcfg.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/adjitem.hxx,editeng/adjitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/akrnitem.hxx,editeng/akrnitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/blnkitem.hxx,editeng/blnkitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/bolnitem.hxx,editeng/bolnitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/borderline.hxx,editeng/borderline.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/boxitem.hxx,editeng/boxitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/brkitem.hxx,editeng/brkitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/brshitem.hxx,editeng/brshitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/bulitem.hxx,editeng/bulitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/charhiddenitem.hxx,editeng/charhiddenitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/charreliefitem.hxx,editeng/charreliefitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/charrotateitem.hxx,editeng/charrotateitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/charscaleitem.hxx,editeng/charscaleitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/cmapitem.hxx,editeng/cmapitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/cntritem.hxx,editeng/cntritem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/colritem.hxx,editeng/colritem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/crsditem.hxx,editeng/crsditem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/cscoitem.hxx,editeng/cscoitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editdata.hxx,editeng/editdata.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editeng.hxx,editeng/editeng.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editengdllapi.h,editeng/editengdllapi.h)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editerr.hxx,editeng/editerr.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editids.hrc,editeng/editids.hrc)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editobj.hxx,editeng/editobj.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editrids.hrc,editeng/editrids.hrc)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editstat.hxx,editeng/editstat.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editund2.hxx,editeng/editund2.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editview.hxx,editeng/editview.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/edtdlg.hxx,editeng/edtdlg.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/eedata.hxx,editeng/eedata.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/eeitem.hxx,editeng/eeitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/eeitemid.hxx,editeng/eeitemid.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/eerdll.hxx,editeng/eerdll.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/emphitem.hxx,editeng/emphitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/escpitem.hxx,editeng/escpitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/fhgtitem.hxx,editeng/fhgtitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/flditem.hxx,editeng/flditem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/flstitem.hxx,editeng/flstitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/fontitem.hxx,editeng/fontitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/forbiddencharacterstable.hxx,editeng/forbiddencharacterstable.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/forbiddenruleitem.hxx,editeng/forbiddenruleitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/frmdir.hxx,editeng/frmdir.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/frmdiritem.hxx,editeng/frmdiritem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/fwdtitem.hxx,editeng/fwdtitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/hangulhanja.hxx,editeng/hangulhanja.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/hngpnctitem.hxx,editeng/hngpnctitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/hyznitem.hxx,editeng/hyznitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/itemtype.hxx,editeng/itemtype.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/justifyitem.hxx,editeng/justifyitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/keepitem.hxx,editeng/keepitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/kernitem.hxx,editeng/kernitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/langitem.hxx,editeng/langitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/lcolitem.hxx,editeng/lcolitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/lrspitem.hxx,editeng/lrspitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/lspcitem.hxx,editeng/lspcitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/measfld.hxx,editeng/measfld.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/memberids.hrc,editeng/memberids.hrc)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/mutxhelp.hxx,editeng/mutxhelp.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/nhypitem.hxx,editeng/nhypitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/nlbkitem.hxx,editeng/nlbkitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/numdef.hxx,editeng/numdef.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/numitem.hxx,editeng/numitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/opaqitem.hxx,editeng/opaqitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/optitems.hxx,editeng/optitems.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/orphitem.hxx,editeng/orphitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/outliner.hxx,editeng/outliner.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/outlobj.hxx,editeng/outlobj.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/paperinf.hxx,editeng/paperinf.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/paragraphdata.hxx,editeng/paragraphdata.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/paravertalignitem.hxx,editeng/paravertalignitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/pbinitem.hxx,editeng/pbinitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/pgrditem.hxx,editeng/pgrditem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/pmdlitem.hxx,editeng/pmdlitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/postitem.hxx,editeng/postitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/prntitem.hxx,editeng/prntitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/protitem.hxx,editeng/protitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/prszitem.hxx,editeng/prszitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/scriptspaceitem.hxx,editeng/scriptspaceitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/scripttypeitem.hxx,editeng/scripttypeitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/shaditem.hxx,editeng/shaditem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/shdditem.hxx,editeng/shdditem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/sizeitem.hxx,editeng/sizeitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/SpellPortions.hxx,editeng/SpellPortions.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/spltitem.hxx,editeng/spltitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/splwrap.hxx,editeng/splwrap.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/svxacorr.hxx,editeng/svxacorr.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/svxenum.hxx,editeng/svxenum.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/svxfont.hxx,editeng/svxfont.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/svxrtf.hxx,editeng/svxrtf.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/swafopt.hxx,editeng/swafopt.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/tstpitem.hxx,editeng/tstpitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/twolinesitem.hxx,editeng/twolinesitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/txtrange.hxx,editeng/txtrange.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/udlnitem.hxx,editeng/udlnitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/ulspitem.hxx,editeng/ulspitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoedhlp.hxx,editeng/unoedhlp.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoedprx.hxx,editeng/unoedprx.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoedsrc.hxx,editeng/unoedsrc.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unofdesc.hxx,editeng/unofdesc.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unofield.hxx,editeng/unofield.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/UnoForbiddenCharsTable.hxx,editeng/UnoForbiddenCharsTable.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unofored.hxx,editeng/unofored.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoforou.hxx,editeng/unoforou.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoipset.hxx,editeng/unoipset.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unolingu.hxx,editeng/unolingu.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unonrule.hxx,editeng/unonrule.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unopracc.hxx,editeng/unopracc.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoprnms.hxx,editeng/unoprnms.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unotext.hxx,editeng/unotext.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoviwed.hxx,editeng/unoviwed.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoviwou.hxx,editeng/unoviwou.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/wghtitem.hxx,editeng/wghtitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/widwitem.hxx,editeng/widwitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/writingmodeitem.hxx,editeng/writingmodeitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/wrlmitem.hxx,editeng/wrlmitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/xmlcnitm.hxx,editeng/xmlcnitm.hxx)) + +# vim: set noet sw=4 ts=4: diff --git a/editeng/inc/editeng.hrc b/editeng/inc/editeng.hrc index 66fcf0cb92..66fcf0cb92 100644..100755 --- a/editeng/inc/editeng.hrc +++ b/editeng/inc/editeng.hrc diff --git a/editeng/inc/editeng/AccessibleContextBase.hxx b/editeng/inc/editeng/AccessibleContextBase.hxx index a9e3c321d4..4313035ba5 100644 --- a/editeng/inc/editeng/AccessibleContextBase.hxx +++ b/editeng/inc/editeng/AccessibleContextBase.hxx @@ -61,7 +61,7 @@ struct MutexOwner {mutable ::osl::Mutex maMutex;}; */ class EDITENG_DLLPUBLIC AccessibleContextBase : public MutexOwner, - public cppu::WeakComponentImplHelper4< + public cppu::PartialWeakComponentImplHelper4< ::com::sun::star::accessibility::XAccessible, ::com::sun::star::accessibility::XAccessibleContext, ::com::sun::star::accessibility::XAccessibleEventBroadcaster, @@ -345,8 +345,8 @@ protected: /** Check whether or not the object has been disposed (or is in the state of beeing disposed). - @return sal_True, if the object is disposed or in the course - of being disposed. Otherwise, sal_False is returned. + @return TRUE, if the object is disposed or in the course + of being disposed. Otherwise, FALSE is returned. */ sal_Bool IsDisposed (void); diff --git a/editeng/inc/editeng/AccessibleEditableTextPara.hxx b/editeng/inc/editeng/AccessibleEditableTextPara.hxx index ee97b4b7fb..5253d6a606 100644 --- a/editeng/inc/editeng/AccessibleEditableTextPara.hxx +++ b/editeng/inc/editeng/AccessibleEditableTextPara.hxx @@ -55,7 +55,7 @@ namespace accessibility { - typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible, + typedef ::cppu::PartialWeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible, ::com::sun::star::accessibility::XAccessibleContext, ::com::sun::star::accessibility::XAccessibleComponent, ::com::sun::star::accessibility::XAccessibleEditableText, @@ -320,7 +320,7 @@ namespace accessibility @return sal_False, if the method was not able to determine the range */ - sal_Bool GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, sal_Int32 nIndex ); + sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nIndex ); // syntactic sugar for FireEvent void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const; @@ -353,13 +353,13 @@ namespace accessibility // Get text from forwarder String GetText( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::uno::RuntimeException)); String GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) SAL_THROW((::com::sun::star::uno::RuntimeException)); - USHORT GetTextLen() const SAL_THROW((::com::sun::star::uno::RuntimeException)); + sal_uInt16 GetTextLen() const SAL_THROW((::com::sun::star::uno::RuntimeException)); /** Get the current selection of this paragraph @return sal_False, if nothing in this paragraph is selected */ - sal_Bool GetSelection( USHORT& nStartPos, USHORT& nEndPos ) SAL_THROW((::com::sun::star::uno::RuntimeException)); + sal_Bool GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ) SAL_THROW((::com::sun::star::uno::RuntimeException)); /** create selection from Accessible selection. @@ -405,7 +405,7 @@ namespace accessibility /// Our listeners (guarded by maMutex) int mnNotifierClientId; - // --> OD 2006-01-11 #i27138# + // Text paragraphs should provide FLOWS_TO and FLOWS_FROM relations (#i27138#) // the paragraph manager, which created this instance - is NULL, if // instance isn't created by AccessibleParaManager. // Needed for method <getAccessibleRelationSet()> to retrieve predecessor diff --git a/editeng/inc/editeng/AccessibleStaticTextBase.hxx b/editeng/inc/editeng/AccessibleStaticTextBase.hxx index 9f4eae4ed3..4edc38ced9 100644 --- a/editeng/inc/editeng/AccessibleStaticTextBase.hxx +++ b/editeng/inc/editeng/AccessibleStaticTextBase.hxx @@ -7,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: AccessibleStaticTextBase.hxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/editeng/inc/editeng/acorrcfg.hxx b/editeng/inc/editeng/acorrcfg.hxx index 3261847337..f9d62672d8 100644 --- a/editeng/inc/editeng/acorrcfg.hxx +++ b/editeng/inc/editeng/acorrcfg.hxx @@ -32,9 +32,7 @@ #include "editeng/editengdllapi.h" #include <unotools/configitem.hxx> -/* -----------------------------12.10.00 11:40-------------------------------- - ---------------------------------------------------------------------------*/ class SvxAutoCorrect; class SvxAutoCorrCfg; class EDITENG_DLLPUBLIC SvxBaseAutoCorrCfg : public utl::ConfigItem @@ -51,9 +49,7 @@ public: virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); void SetModified() {ConfigItem::SetModified();} }; -/* -----------------------------12.10.00 11:40-------------------------------- - ---------------------------------------------------------------------------*/ class EDITENG_DLLPUBLIC SvxSwAutoCorrCfg : public utl::ConfigItem { SvxAutoCorrCfg& rParent; @@ -69,7 +65,7 @@ public: void SetModified() {ConfigItem::SetModified();} }; /*-------------------------------------------------------------------- - Beschreibung: Konfiguration fuer Auto Correction + Description: Configuration for Auto Correction --------------------------------------------------------------------*/ class EDITENG_DLLPUBLIC SvxAutoCorrCfg { @@ -81,10 +77,10 @@ class EDITENG_DLLPUBLIC SvxAutoCorrCfg SvxBaseAutoCorrCfg aBaseConfig; SvxSwAutoCorrCfg aSwConfig; - // Flags f"ur Autotext: + // Flags for Autotext: sal_Bool bFileRel; sal_Bool bNetRel; - // Tiphilfe f"ur Autotext w"ahrend der Eingabe + // Help tip for Autotext as you type sal_Bool bAutoTextTip; sal_Bool bAutoTextPreview; sal_Bool bAutoFmtByInput; @@ -104,7 +100,7 @@ public: SvxAutoCorrect* GetAutoCorrect() { return pAutoCorrect; } const SvxAutoCorrect* GetAutoCorrect() const { return pAutoCorrect; } - // der Pointer geht in den Besitz des ConfigItems! + // the pointer is transfered to the possession of the ConfigItems! void SetAutoCorrect( SvxAutoCorrect* ); sal_Bool IsAutoFmtByInput() const { return bAutoFmtByInput; } diff --git a/editeng/inc/editeng/adjitem.hxx b/editeng/inc/editeng/adjitem.hxx index 1e1545352f..ad4bf30393 100644 --- a/editeng/inc/editeng/adjitem.hxx +++ b/editeng/inc/editeng/adjitem.hxx @@ -44,48 +44,48 @@ namespace rtl // class SvxAdjustItem --------------------------------------------------- /* -[Beschreibung] -Dieses Item beschreibt die Zeilenausrichtung. +[Description] +This item describes the row orientation. */ -#define ADJUST_LASTBLOCK_VERSION ((USHORT)0x0001) +#define ADJUST_LASTBLOCK_VERSION ((sal_uInt16)0x0001) class EDITENG_DLLPUBLIC SvxAdjustItem : public SfxEnumItemInterface { - BOOL bLeft : 1; - BOOL bRight : 1; - BOOL bCenter : 1; - BOOL bBlock : 1; + sal_Bool bLeft : 1; + sal_Bool bRight : 1; + sal_Bool bCenter : 1; + sal_Bool bBlock : 1; - // nur aktiv, wenn bBlock - BOOL bOneBlock : 1; - BOOL bLastCenter : 1; - BOOL bLastBlock : 1; + // only activ when bBlock + sal_Bool bOneBlock : 1; + sal_Bool bLastCenter : 1; + sal_Bool bLastBlock : 1; friend SvStream& operator<<( SvStream&, SvxAdjustItem& ); //$ ostream public: TYPEINFO(); SvxAdjustItem( const SvxAdjust eAdjst /*= SVX_ADJUST_LEFT*/, - const USHORT nId ); + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - virtual USHORT GetValueCount() const; - virtual String GetValueTextByPos( USHORT nPos ) const; - virtual USHORT GetEnumValue() const; - virtual void SetEnumValue( USHORT nNewVal ); + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetEnumValue() const; + virtual void SetEnumValue( sal_uInt16 nNewVal ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; inline void SetOneWord( const SvxAdjust eType ) { diff --git a/editeng/inc/editeng/akrnitem.hxx b/editeng/inc/editeng/akrnitem.hxx index 6bcf6a3bee..47860ddd1a 100644 --- a/editeng/inc/editeng/akrnitem.hxx +++ b/editeng/inc/editeng/akrnitem.hxx @@ -42,8 +42,8 @@ namespace rtl // class SvxAutoKernItem ------------------------------------------------- /* - [Beschreibung] - Attribut fuer Pair-Kerning. + [Description] + Attribute for Pair-Kerning. */ class EDITENG_DLLPUBLIC SvxAutoKernItem : public SfxBoolItem @@ -51,13 +51,13 @@ class EDITENG_DLLPUBLIC SvxAutoKernItem : public SfxBoolItem public: TYPEINFO(); - SvxAutoKernItem( const BOOL bAutoKern /*= FALSE*/, - const USHORT nId ); + SvxAutoKernItem( const sal_Bool bAutoKern /*= sal_False*/, + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/blnkitem.hxx b/editeng/inc/editeng/blnkitem.hxx index 304f0f50f7..2384a48892 100644 --- a/editeng/inc/editeng/blnkitem.hxx +++ b/editeng/inc/editeng/blnkitem.hxx @@ -43,8 +43,8 @@ namespace rtl // class SvxBlinkItem ------------------------------------------------- /* - [Beschreibung] - Dieses Item beschreibt, ob geblinkt werden soll. + [Description] + This item describes, whether to flash. */ class EDITENG_DLLPUBLIC SvxBlinkItem : public SfxBoolItem @@ -52,12 +52,12 @@ class EDITENG_DLLPUBLIC SvxBlinkItem : public SfxBoolItem public: TYPEINFO(); - SvxBlinkItem( const BOOL bBlink /*= FALSE*/, const USHORT nId ); + SvxBlinkItem( const sal_Bool bBlink /*= sal_False*/, const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, diff --git a/editeng/inc/editeng/bolnitem.hxx b/editeng/inc/editeng/bolnitem.hxx index af1b6a0bba..ee15661587 100644 --- a/editeng/inc/editeng/bolnitem.hxx +++ b/editeng/inc/editeng/bolnitem.hxx @@ -41,24 +41,26 @@ /* -[Beschreibung] -Dieses Item transportiert eine SvxBorderLine. +[Description] +This Item transports a editeng::SvxBorderLine. */ -class SvxBorderLine; +namespace editeng { + class SvxBorderLine; +} class EDITENG_DLLPUBLIC SvxLineItem : public SfxPoolItem { public: TYPEINFO(); - SvxLineItem( const USHORT nId ); + SvxLineItem( const sal_uInt16 nId ); SvxLineItem( const SvxLineItem& rCpy ); ~SvxLineItem(); SvxLineItem &operator=( const SvxLineItem& rLine ); - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual int operator==( const SfxPoolItem& ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -66,16 +68,16 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; virtual bool ScaleMetrics( long nMult, long nDiv ); virtual bool HasMetrics() const; - const SvxBorderLine* GetLine () const { return pLine; } - void SetLine ( const SvxBorderLine *pNew ); + const editeng::SvxBorderLine* GetLine () const { return pLine; } + void SetLine ( const editeng::SvxBorderLine *pNew ); private: - SvxBorderLine* pLine; + editeng::SvxBorderLine* pLine; }; diff --git a/editeng/inc/editeng/borderline.hxx b/editeng/inc/editeng/borderline.hxx index ecaf3ce93f..17e137a53c 100644 --- a/editeng/inc/editeng/borderline.hxx +++ b/editeng/inc/editeng/borderline.hxx @@ -32,6 +32,7 @@ #include <tools/color.hxx> #include <svl/poolitem.hxx> #include <editeng/editengdllapi.h> +#include <svtools/ctrlbox.hxx> // Line defaults in twips (former Writer defaults): @@ -42,107 +43,138 @@ #define DEF_LINE_WIDTH_4 100 #define DEF_LINE_WIDTH_5 10 -#define DEF_MAX_LINE_WIDHT DEF_LINE_WIDTH_4 -#define DEF_MAX_LINE_DIST DEF_LINE_WIDTH_2 - -#define DEF_DOUBLE_LINE0_OUT DEF_LINE_WIDTH_0 -#define DEF_DOUBLE_LINE0_IN DEF_LINE_WIDTH_0 -#define DEF_DOUBLE_LINE0_DIST DEF_LINE_WIDTH_1 - -#define DEF_DOUBLE_LINE1_OUT DEF_LINE_WIDTH_1 -#define DEF_DOUBLE_LINE1_IN DEF_LINE_WIDTH_1 -#define DEF_DOUBLE_LINE1_DIST DEF_LINE_WIDTH_1 - -#define DEF_DOUBLE_LINE2_OUT DEF_LINE_WIDTH_2 -#define DEF_DOUBLE_LINE2_IN DEF_LINE_WIDTH_2 -#define DEF_DOUBLE_LINE2_DIST DEF_LINE_WIDTH_2 - -#define DEF_DOUBLE_LINE3_OUT DEF_LINE_WIDTH_2 -#define DEF_DOUBLE_LINE3_IN DEF_LINE_WIDTH_1 -#define DEF_DOUBLE_LINE3_DIST DEF_LINE_WIDTH_2 - -#define DEF_DOUBLE_LINE4_OUT DEF_LINE_WIDTH_1 -#define DEF_DOUBLE_LINE4_IN DEF_LINE_WIDTH_2 -#define DEF_DOUBLE_LINE4_DIST DEF_LINE_WIDTH_1 - -#define DEF_DOUBLE_LINE5_OUT DEF_LINE_WIDTH_3 -#define DEF_DOUBLE_LINE5_IN DEF_LINE_WIDTH_2 -#define DEF_DOUBLE_LINE5_DIST DEF_LINE_WIDTH_2 - -#define DEF_DOUBLE_LINE6_OUT DEF_LINE_WIDTH_2 -#define DEF_DOUBLE_LINE6_IN DEF_LINE_WIDTH_3 -#define DEF_DOUBLE_LINE6_DIST DEF_LINE_WIDTH_2 - -#define DEF_DOUBLE_LINE7_OUT DEF_LINE_WIDTH_0 -#define DEF_DOUBLE_LINE7_IN DEF_LINE_WIDTH_0 -#define DEF_DOUBLE_LINE7_DIST DEF_LINE_WIDTH_2 - -#define DEF_DOUBLE_LINE8_OUT DEF_LINE_WIDTH_1 -#define DEF_DOUBLE_LINE8_IN DEF_LINE_WIDTH_0 -#define DEF_DOUBLE_LINE8_DIST DEF_LINE_WIDTH_2 - -#define DEF_DOUBLE_LINE9_OUT DEF_LINE_WIDTH_2 -#define DEF_DOUBLE_LINE9_IN DEF_LINE_WIDTH_0 -#define DEF_DOUBLE_LINE9_DIST DEF_LINE_WIDTH_2 - -#define DEF_DOUBLE_LINE10_OUT DEF_LINE_WIDTH_3 -#define DEF_DOUBLE_LINE10_IN DEF_LINE_WIDTH_0 -#define DEF_DOUBLE_LINE10_DIST DEF_LINE_WIDTH_2 - // ============================================================================ -enum SvxBorderStyle -{ - SOLID, - DOTTED, - DASHED -}; - -class EDITENG_DLLPUBLIC SvxBorderLine -{ -protected: - Color aColor; - USHORT nOutWidth; - USHORT nInWidth; - USHORT nDistance; - SvxBorderStyle m_nStyle; - -public: - SvxBorderLine( const Color *pCol = 0, USHORT nOut = 0, USHORT nIn = 0, USHORT nDist = 0, - SvxBorderStyle nStyle = SOLID ); - SvxBorderLine( const SvxBorderLine& r ); - - SvxBorderLine& operator=( const SvxBorderLine& r ); - - const Color& GetColor() const { return aColor; } - USHORT GetOutWidth() const { return nOutWidth; } - USHORT GetInWidth() const { return nInWidth; } - USHORT GetDistance() const { return nDistance; } - - SvxBorderStyle GetStyle() const { return m_nStyle; } - - void SetColor( const Color &rColor ) { aColor = rColor; } - void SetOutWidth( USHORT nNew ) { nOutWidth = nNew; } - void SetInWidth( USHORT nNew ) { nInWidth = nNew; } - void SetDistance( USHORT nNew ) { nDistance = nNew; } - void SetStyle( SvxBorderStyle nNew ) { m_nStyle = nNew; } - void ScaleMetrics( long nMult, long nDiv ); - - BOOL operator==( const SvxBorderLine &rCmp ) const; - - String GetValueString( SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, - const IntlWrapper* pIntl, - BOOL bMetricStr = FALSE ) const; - - bool HasPriority( const SvxBorderLine& rOtherLine ) const; - - bool isEmpty() const { return (0 == nOutWidth && 0 == nInWidth && 0 == nDistance); } - bool isDouble() const { return (0 != nOutWidth && 0 != nInWidth); } - sal_uInt16 getWidth() const { return nOutWidth + nInWidth + nDistance; } -}; +namespace editeng { + + enum SvxBorderStyle + { + SOLID, + DOTTED, + DASHED, + DOUBLE, + THINTHICK_SMALLGAP, + THINTHICK_MEDIUMGAP, + THINTHICK_LARGEGAP, + THICKTHIN_SMALLGAP, + THICKTHIN_MEDIUMGAP, + THICKTHIN_LARGEGAP, + EMBOSSED, + ENGRAVED, + OUTSET, + INSET, + NO_STYLE = -1 + }; + + class EDITENG_DLLPUBLIC SvxBorderLine + { + protected: + Color aColor; + + long m_nWidth; + bool m_bMirrorWidths; + BorderWidthImpl m_aWidthImpl; + long m_nMult; + long m_nDiv; + + SvxBorderStyle m_nStyle; + sal_uInt16 nOutWidth; + sal_uInt16 nInWidth; + sal_uInt16 nDistance; + + bool m_bUseLeftTop; + Color (*m_pColorOutFn)( Color ); + Color (*m_pColorInFn)( Color ); + Color (*m_pColorGapFn)( Color ); + + public: + SvxBorderLine( const Color *pCol = 0, + long nWidth = 0, SvxBorderStyle nStyle = SOLID, + bool bUseLeftTop = false, + Color (*pColorOutFn)( Color ) = &darkColor, + Color (*pColorInFn)( Color ) = &darkColor, + Color (*pColorGapFn)( Color ) = NULL ); + SvxBorderLine( const SvxBorderLine& r ); + + SvxBorderLine& operator=( const SvxBorderLine& r ); + + const Color& GetColor() const { return aColor; } + Color GetColorOut( bool bLeftOrTop = true ) const; + Color GetColorIn( bool bLeftOrTop = true ) const; + bool HasGapColor() const { return m_pColorGapFn != NULL; } + Color GetColorGap() const; + + void SetWidth( long nWidth = 0 ) { m_nWidth = nWidth; } + /** Guess the style and width from the three lines widths values. + + When the value of nStyle is SvxBorderLine::DOUBLE, the style set will be guessed + using the three values to match the best possible style among the following: + - SvxBorderLine::DOUBLE + - SvxBorderLine::THINTHICK_SMALLGAP + - SvxBorderLine::THINTHICK_MEDIUMGAP + - SvxBorderLine::THINTHICK_LARGEGAP + - SvxBorderLine::THICKTHIN_SMALLGAP + - SvxBorderLine::THICKTHIN_MEDIUMGAP + - SvxBorderLine::THICKTHIN_LARGEGAP + + If no styles matches the width, then the width is set to 0. + + There is one known case that could fit several styles: \a nIn = \a nDist = 0.75 pt, + \a nOut = 1.5 pt. This case fits SvxBorderLine::THINTHICK_SMALLGAP and + SvxBorderLine::THINTHICK_MEDIUMGAP with a 1.5 pt width and + SvxBorderLine::THINTHICK_LARGEGAP with a 0.75 pt width. The same case happens + also for thick-thin styles. + + \param nStyle the border style used to guess the width. + \param nIn the width of the inner line in 1th pt + \param nOut the width of the outer line in 1th pt + \param nDist the width of the gap between the lines in 1th pt + */ + void GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sal_uInt16 nIn = 0, sal_uInt16 nDist = 0 ); + + // TODO Hacky method to mirror lines in only a few cases + void SetMirrorWidths( bool bMirror = true ) { m_bMirrorWidths = bMirror; } + long GetWidth( ) const { return m_nWidth; } + sal_uInt16 GetOutWidth() const; + sal_uInt16 GetInWidth() const; + sal_uInt16 GetDistance() const; + + SvxBorderStyle GetStyle() const { return m_nStyle; } + + void SetColor( const Color &rColor ) { aColor = rColor; } + void SetColorOutFn( Color (*pColorOutFn)( Color ) ) { m_pColorOutFn = pColorOutFn; } + void SetColorInFn( Color (*pColorInFn)( Color ) ) { m_pColorInFn = pColorInFn; } + void SetColorGapFn( Color (*pColorGapFn)( Color ) ) { m_pColorGapFn = pColorGapFn; } + void SetUseLeftTop( bool bUseLeftTop ) { m_bUseLeftTop = bUseLeftTop; } + void SetStyle( SvxBorderStyle nNew ); + void ScaleMetrics( long nMult, long nDiv ); + + sal_Bool operator==( const SvxBorderLine &rCmp ) const; + + String GetValueString( SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, + const IntlWrapper* pIntl, + sal_Bool bMetricStr = sal_False ) const; + + bool HasPriority( const SvxBorderLine& rOtherLine ) const; + + bool isEmpty() const { return m_aWidthImpl.IsEmpty( ) || m_nStyle == NO_STYLE || m_nWidth == 0; } + bool isDouble() const { return m_aWidthImpl.IsDouble(); } + sal_uInt16 GetScaledWidth() const { return GetOutWidth() + GetInWidth() + GetDistance(); } + + static Color darkColor( Color aMain ); + static Color lightColor( Color aMain ); + + static Color threeDLightColor( Color aMain ); + static Color threeDMediumColor( Color aMain ); + static Color threeDDarkColor( Color aMain ); + + static BorderWidthImpl getWidthImpl( SvxBorderStyle nStyle ); + }; // ============================================================================ +} // namespace editeng + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/boxitem.hxx b/editeng/inc/editeng/boxitem.hxx index 35fd036e30..7fa52f2839 100644 --- a/editeng/inc/editeng/boxitem.hxx +++ b/editeng/inc/editeng/boxitem.hxx @@ -37,26 +37,26 @@ namespace rtl { class OUString; } // class SvxBoxItem ------------------------------------------------------ -/* -[Beschreibung] -Dieses Item beschreibt ein Umrandungsattribut (alle vier Kanten und -Abstand nach innen. +/* [Description] + + This item describes a border attribute + (all four edges and the inward distance) */ -#define BOX_LINE_TOP ((USHORT)0) -#define BOX_LINE_BOTTOM ((USHORT)1) -#define BOX_LINE_LEFT ((USHORT)2) -#define BOX_LINE_RIGHT ((USHORT)3) +#define BOX_LINE_TOP ((sal_uInt16)0) +#define BOX_LINE_BOTTOM ((sal_uInt16)1) +#define BOX_LINE_LEFT ((sal_uInt16)2) +#define BOX_LINE_RIGHT ((sal_uInt16)3) -#define BOX_4DISTS_VERSION ((USHORT)1) +#define BOX_4DISTS_VERSION ((sal_uInt16)1) class EDITENG_DLLPUBLIC SvxBoxItem : public SfxPoolItem { - SvxBorderLine *pTop, - *pBottom, - *pLeft, - *pRight; - USHORT nTopDist, + editeng::SvxBorderLine *pTop, + *pBottom, + *pLeft, + *pRight; + sal_uInt16 nTopDist, nBottomDist, nLeftDist, nRightDist; @@ -64,15 +64,15 @@ class EDITENG_DLLPUBLIC SvxBoxItem : public SfxPoolItem public: TYPEINFO(); - SvxBoxItem( const USHORT nId ); + SvxBoxItem( const sal_uInt16 nId ); SvxBoxItem( const SvxBoxItem &rCpy ); ~SvxBoxItem(); SvxBoxItem &operator=( const SvxBoxItem& rBox ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -80,56 +80,55 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual bool ScaleMetrics( long nMult, long nDiv ); virtual bool HasMetrics() const; - const SvxBorderLine* GetTop() const { return pTop; } - const SvxBorderLine* GetBottom() const { return pBottom; } - const SvxBorderLine* GetLeft() const { return pLeft; } - const SvxBorderLine* GetRight() const { return pRight; } + const editeng::SvxBorderLine* GetTop() const { return pTop; } + const editeng::SvxBorderLine* GetBottom() const { return pBottom; } + const editeng::SvxBorderLine* GetLeft() const { return pLeft; } + const editeng::SvxBorderLine* GetRight() const { return pRight; } - const SvxBorderLine* GetLine( USHORT nLine ) const; + const editeng::SvxBorderLine* GetLine( sal_uInt16 nLine ) const; - //Die Pointer werden kopiert! - void SetLine( const SvxBorderLine* pNew, USHORT nLine ); + //The Pointers are being copied! + void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine ); - USHORT GetDistance( USHORT nLine ) const; - USHORT GetDistance() const; + sal_uInt16 GetDistance( sal_uInt16 nLine ) const; + sal_uInt16 GetDistance() const; - void SetDistance( USHORT nNew, USHORT nLine ); - inline void SetDistance( USHORT nNew ); + void SetDistance( sal_uInt16 nNew, sal_uInt16 nLine ); + inline void SetDistance( sal_uInt16 nNew ); - //Breite der Linien plus Zwischenraum plus Abstand nach innen. - //JP 09.06.99: bIgnoreLine = TRUE -> Distance auch returnen, wenn - // keine Line gesetzt ist - USHORT CalcLineSpace( USHORT nLine, BOOL bIgnoreLine = FALSE ) const; - static com::sun::star::table::BorderLine2 SvxLineToLine( const SvxBorderLine* pLine, sal_Bool bConvert ); - static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert); + // Line width plus Space plus inward distance + //bIgnoreLine = TRUE -> Also return distance, when no Line is set + sal_uInt16 CalcLineSpace( sal_uInt16 nLine, sal_Bool bIgnoreLine = sal_False ) const; + static com::sun::star::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, sal_Bool bConvert ); + static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert); + static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert); static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert); }; -inline void SvxBoxItem::SetDistance( USHORT nNew ) +inline void SvxBoxItem::SetDistance( sal_uInt16 nNew ) { nTopDist = nBottomDist = nLeftDist = nRightDist = nNew; } // class SvxBoxInfoItem -------------------------------------------------- -/* -[Beschreibung] -Noch ein Item fuer die Umrandung. Dieses Item hat lediglich SS-Funktionalitaet. -Einerseits wird dem allgemeinen Dialog mit diesem Item mitgeteilt, welche -Moeglichkeiten er anbieten soll. -Andererseits werden ueber dieses Attribut ggf. die BorderLines fuer die -horizontalen und vertikalen innerern Linien transportiert. +/* [Description] + + Another item for the border. This item has only limited functionality. + On one hand, the general Dialog is told by the item which options it + should offer. On the other hand, this attribute may be used to + transported the borderline for the inner horizontal and vertical lines. */ -#define BOXINFO_LINE_HORI ((USHORT)0) -#define BOXINFO_LINE_VERT ((USHORT)1) +#define BOXINFO_LINE_HORI ((sal_uInt16)0) +#define BOXINFO_LINE_VERT ((sal_uInt16)1) #define VALID_TOP 0x01 #define VALID_BOTTOM 0x02 @@ -142,84 +141,84 @@ horizontalen und vertikalen innerern Linien transportiert. class EDITENG_DLLPUBLIC SvxBoxInfoItem : public SfxPoolItem { - SvxBorderLine* pHori; //innere horizontale Linie - SvxBorderLine* pVert; //innere vertikale Linie + editeng::SvxBorderLine* pHori; //inner horizontal Line + editeng::SvxBorderLine* pVert; //inner vertical Line - bool mbEnableHor; /// true = Enable inner horizonal line. + bool mbEnableHor; /// true = Enable inner horizontal line. bool mbEnableVer; /// true = Enable inner vertical line. /* - z.Z. nur fuer StarWriter: Abstand nach innen von SvxBoxItem. - Wenn der Abstand gewuenscht ist, so muss das Feld fuer den Abstand vom - Dialog freigeschaltet werden. nDefDist ist als Defaultwert anzusehen. - Wenn irgendeine Linie eingeschalt ist oder wird, so muss dieser - Abstand defaultet werden. bMinDist gibt an, ob der Wert durch den - Anwender unterschritten werden darf. Mit nDist wird der aktuelle - Abstand von der App zum Dialog und zurueck transportiert. + Currently only for StarWriter: distance inward from SvxBoxItem. If the + distance is requested, then the field for the distance from the dialog be + activated. nDefDist is regarded as a default value. If any line is + turned on or will be turned on it must this distance be set to default. + bMinDist indicates whether the user can go below this value or not. + With NDIST is the current distance from the app transported back and + forth to the dialogue. */ - BOOL bDist :1; // TRUE, Abstand freischalten. - BOOL bMinDist :1; // TRUE, Abstand darf nicht unterschritten werden. + sal_Bool bDist :1; // TRUE, Unlock Distance. + sal_Bool bMinDist :1; // TRUE, Going below minimum Distance is prohibited - BYTE nValidFlags; // 0000 0000 - // ³³³³ ³³³ÀÄ VALID_TOP - // ³³³³ ³³ÀÄÄ VALID_BOTTOM - // ³³³³ ³ÀÄÄÄ VALID_LEFT - // ³³³³ ÀÄÄÄÄ VALID_RIGHT - // ³³³ÀÄÄÄÄÄÄ VALID_HORI - // ³³ÀÄÄÄÄÄÄÄ VALID_VERT - // ³ÀÄÄÄÄÄÄÄÄ VALID_DIST - // ÀÄÄÄÄÄÄÄÄÄ VALID_DISABLE + sal_uInt8 nValidFlags; // 0000 0000 + // ³³³³ ³³³ÀÄ VALID_TOP + // ³³³³ ³³ÀÄÄ VALID_BOTTOM + // ³³³³ ³ÀÄÄÄ VALID_LEFT + // ³³³³ ÀÄÄÄÄ VALID_RIGHT + // ³³³ÀÄÄÄÄÄÄ VALID_HORI + // ³³ÀÄÄÄÄÄÄÄ VALID_VERT + // ³ÀÄÄÄÄÄÄÄÄ VALID_DIST + // ÀÄÄÄÄÄÄÄÄÄ VALID_DISABLE - USHORT nDefDist; // Der Default- bzw. Minimalabstand. + sal_uInt16 nDefDist; // The default or minimum distance. public: TYPEINFO(); - SvxBoxInfoItem( const USHORT nId ); + SvxBoxInfoItem( const sal_uInt16 nId ); SvxBoxInfoItem( const SvxBoxInfoItem &rCpy ); ~SvxBoxInfoItem(); SvxBoxInfoItem &operator=( const SvxBoxInfoItem &rCpy ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; - virtual bool ScaleMetrics( long nMult, long nDiv ); - virtual bool HasMetrics() const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; - const SvxBorderLine* GetHori() const { return pHori; } - const SvxBorderLine* GetVert() const { return pVert; } + const editeng::SvxBorderLine* GetHori() const { return pHori; } + const editeng::SvxBorderLine* GetVert() const { return pVert; } - //Die Pointer werden kopiert! - void SetLine( const SvxBorderLine* pNew, USHORT nLine ); + //The Pointers are being copied! + void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine ); - BOOL IsTable() const { return mbEnableHor && mbEnableVer; } - void SetTable( BOOL bNew ) { mbEnableHor = mbEnableVer = bNew; } + sal_Bool IsTable() const { return mbEnableHor && mbEnableVer; } + void SetTable( sal_Bool bNew ) { mbEnableHor = mbEnableVer = bNew; } inline bool IsHorEnabled() const { return mbEnableHor; } inline void EnableHor( bool bEnable ) { mbEnableHor = bEnable; } inline bool IsVerEnabled() const { return mbEnableVer; } inline void EnableVer( bool bEnable ) { mbEnableVer = bEnable; } - BOOL IsDist() const { return bDist; } - void SetDist( BOOL bNew ) { bDist = bNew; } - BOOL IsMinDist() const { return bMinDist; } - void SetMinDist( BOOL bNew ) { bMinDist = bNew; } - USHORT GetDefDist() const { return nDefDist; } - void SetDefDist( USHORT nNew ) { nDefDist = nNew; } + sal_Bool IsDist() const { return bDist; } + void SetDist( sal_Bool bNew ) { bDist = bNew; } + sal_Bool IsMinDist() const { return bMinDist; } + void SetMinDist( sal_Bool bNew ) { bMinDist = bNew; } + sal_uInt16 GetDefDist() const { return nDefDist; } + void SetDefDist( sal_uInt16 nNew ) { nDefDist = nNew; } - BOOL IsValid( BYTE nValid ) const + sal_Bool IsValid( sal_uInt8 nValid ) const { return ( nValidFlags & nValid ) == nValid; } - void SetValid( BYTE nValid, BOOL bValid = TRUE ) + void SetValid( sal_uInt8 nValid, sal_Bool bValid = sal_True ) { bValid ? ( nValidFlags |= nValid ) : ( nValidFlags &= ~nValid ); } void ResetFlags(); diff --git a/editeng/inc/editeng/brkitem.hxx b/editeng/inc/editeng/brkitem.hxx index 1409f31520..bb697fa305 100644 --- a/editeng/inc/editeng/brkitem.hxx +++ b/editeng/inc/editeng/brkitem.hxx @@ -41,12 +41,12 @@ namespace rtl // class SvxFmtBreakItem ------------------------------------------------- -/* - [Beschreibung] - Dieses Item beschreibt ein Umbruch-Attribut - Automatisch?, Seiten- oder Spaltenumbruch, davor oder danach? +/* [Description] + + This item Describes a wrap-attribute + Automatic?, Page or column break, before or after? */ -#define FMTBREAK_NOAUTO ((USHORT)0x0001) +#define FMTBREAK_NOAUTO ((sal_uInt16)0x0001) class EDITENG_DLLPUBLIC SvxFmtBreakItem : public SfxEnumItem { @@ -54,39 +54,39 @@ public: TYPEINFO(); inline SvxFmtBreakItem( const SvxBreak eBrk /*= SVX_BREAK_NONE*/, - const USHORT nWhich ); + const sal_uInt16 nWhich ); inline SvxFmtBreakItem( const SvxFmtBreakItem& rBreak ); inline SvxFmtBreakItem& operator=( const SvxFmtBreakItem& rCpy ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - virtual String GetValueTextByPos( USHORT nPos ) const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SvStream& Store( SvStream& , USHORT nItemVersion ) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT ) const; - virtual USHORT GetValueCount() const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const; + virtual sal_uInt16 GetValueCount() const; - // MS VC4.0 kommt durcheinander - void SetValue( USHORT nNewVal ) + // MS VC4.0 messes things up + void SetValue( sal_uInt16 nNewVal ) {SfxEnumItem::SetValue(nNewVal); } SvxBreak GetBreak() const { return SvxBreak( GetValue() ); } void SetBreak( const SvxBreak eNew ) - { SetValue( (USHORT)eNew ); } + { SetValue( (sal_uInt16)eNew ); } }; inline SvxFmtBreakItem::SvxFmtBreakItem( const SvxBreak eBreak, - const USHORT _nWhich ) : - SfxEnumItem( _nWhich, (USHORT)eBreak ) + const sal_uInt16 _nWhich ) : + SfxEnumItem( _nWhich, (sal_uInt16)eBreak ) {} inline SvxFmtBreakItem::SvxFmtBreakItem( const SvxFmtBreakItem& rBreak ) : diff --git a/editeng/inc/editeng/brshitem.hxx b/editeng/inc/editeng/brshitem.hxx index 025c39161e..3fe014ab3d 100644 --- a/editeng/inc/editeng/brshitem.hxx +++ b/editeng/inc/editeng/brshitem.hxx @@ -45,7 +45,7 @@ namespace rtl class OUString; } -#define BRUSH_GRAPHIC_VERSION ((USHORT)0x0001) +#define BRUSH_GRAPHIC_VERSION ((sal_uInt16)0x0001) enum SvxGraphicPosition { @@ -67,28 +67,28 @@ class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem String* pStrLink; String* pStrFilter; SvxGraphicPosition eGraphicPos; - BOOL bLoadAgain; + sal_Bool bLoadAgain; void ApplyGraphicTransparency_Impl(); DECL_STATIC_LINK( SvxBrushItem, DoneHdl_Impl, void *); // wird nur von Create benutzt SvxBrushItem( SvStream& rStrm, - USHORT nVersion, USHORT nWhich ); + sal_uInt16 nVersion, sal_uInt16 nWhich ); public: TYPEINFO(); - SvxBrushItem( USHORT nWhich ); - SvxBrushItem( const Color& rColor, USHORT nWhich ); + SvxBrushItem( sal_uInt16 nWhich ); + SvxBrushItem( const Color& rColor, sal_uInt16 nWhich ); SvxBrushItem( const Graphic& rGraphic, - SvxGraphicPosition ePos, USHORT nWhich ); + SvxGraphicPosition ePos, sal_uInt16 nWhich ); SvxBrushItem( const GraphicObject& rGraphicObj, - SvxGraphicPosition ePos, USHORT nWhich ); + SvxGraphicPosition ePos, sal_uInt16 nWhich ); SvxBrushItem( const String& rLink, const String& rFilter, - SvxGraphicPosition ePos, USHORT nWhich ); + SvxGraphicPosition ePos, sal_uInt16 nWhich ); SvxBrushItem( const SvxBrushItem& ); - SvxBrushItem( const CntWallpaperItem&, USHORT nWhich ); + SvxBrushItem( const CntWallpaperItem&, sal_uInt16 nWhich ); ~SvxBrushItem(); @@ -100,13 +100,13 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nVersion ) const; - virtual SvStream& Store( SvStream& , USHORT nItemVersion ) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; const Color& GetColor() const { return aColor; } Color& GetColor() { return aColor; } diff --git a/editeng/inc/editeng/bulitem.hxx b/editeng/inc/editeng/bulitem.hxx index ea41ef5e5f..94e11dd072 100644 --- a/editeng/inc/editeng/bulitem.hxx +++ b/editeng/inc/editeng/bulitem.hxx @@ -54,7 +54,7 @@ #define BJ_VCENTER 0x20 // Valid-Bits -// Erstmal nur die Werte, die vom Dialog geaendert werden... +// First, only the values that are changed by the dialogue ... #define VALID_FONTCOLOR 0x0001 #define VALID_FONTNAME 0x0002 #define VALID_SYMBOL 0x0004 @@ -76,13 +76,14 @@ class EDITENG_DLLPUBLIC SvxBulletItem : public SfxPoolItem GraphicObject* pGraphicObject; String aPrevText; String aFollowText; - USHORT nStart; - USHORT nStyle; + sal_uInt16 nStart; + sal_uInt16 nStyle; long nWidth; - USHORT nScale; + sal_uInt16 nScale; sal_Unicode cSymbol; - BYTE nJustify; - USHORT nValidMask; // Nur temporaer fuer GetAttribs/SetAttribs, wegen des grossen Bullets + sal_uInt8 nJustify; + sal_uInt16 nValidMask; // Only temporary for GetAttribs / setAttribs, + // because of the large Bullets #ifdef _SVX_BULITEM_CXX void SetDefaultFont_Impl(); @@ -92,30 +93,30 @@ class EDITENG_DLLPUBLIC SvxBulletItem : public SfxPoolItem public: TYPEINFO(); - SvxBulletItem( USHORT nWhich = 0 ); - SvxBulletItem( BYTE nStyle, const Font& rFont, USHORT nStart = 0, USHORT nWhich = 0 ); - SvxBulletItem( const Font& rFont, sal_Unicode cSymbol, USHORT nWhich=0 ); - SvxBulletItem( const Bitmap&, USHORT nWhich = 0 ); - SvxBulletItem( const GraphicObject&, USHORT nWhich = 0 ); - SvxBulletItem( SvStream& rStrm, USHORT nWhich = 0 ); + SvxBulletItem( sal_uInt16 nWhich = 0 ); + SvxBulletItem( sal_uInt8 nStyle, const Font& rFont, sal_uInt16 nStart = 0, sal_uInt16 nWhich = 0 ); + SvxBulletItem( const Font& rFont, sal_Unicode cSymbol, sal_uInt16 nWhich=0 ); + SvxBulletItem( const Bitmap&, sal_uInt16 nWhich = 0 ); + SvxBulletItem( const GraphicObject&, sal_uInt16 nWhich = 0 ); + SvxBulletItem( SvStream& rStrm, sal_uInt16 nWhich = 0 ); SvxBulletItem( const SvxBulletItem& ); ~SvxBulletItem(); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nVersion ) const; - virtual SvStream& Store( SvStream & , USHORT nItemVersion ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const; + virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const; String GetFullText() const; sal_Unicode GetSymbol() const { return cSymbol; } String GetPrevText() const { return aPrevText; } String GetFollowText() const { return aFollowText; } - USHORT GetStart() const { return nStart; } + sal_uInt16 GetStart() const { return nStart; } long GetWidth() const { return nWidth; } - USHORT GetStyle() const { return nStyle; } - BYTE GetJustification() const { return nJustify; } + sal_uInt16 GetStyle() const { return nStyle; } + sal_uInt8 GetJustification() const { return nJustify; } Font GetFont() const { return aFont; } - USHORT GetScale() const { return nScale; } + sal_uInt16 GetScale() const { return nScale; } Bitmap GetBitmap() const; void SetBitmap( const Bitmap& rBmp ); @@ -127,14 +128,14 @@ public: void SetPrevText( const String& rStr) { aPrevText = rStr;} void SetFollowText(const String& rStr) { aFollowText=rStr;} - void SetStart( USHORT nNew ) { nStart = nNew; } + void SetStart( sal_uInt16 nNew ) { nStart = nNew; } void SetWidth( long nNew ) { nWidth = nNew; } - void SetStyle( USHORT nNew ) { nStyle = nNew; } - void SetJustification( BYTE nNew ) { nJustify = nNew; } + void SetStyle( sal_uInt16 nNew ) { nStyle = nNew; } + void SetJustification( sal_uInt8 nNew ) { nJustify = nNew; } void SetFont( const Font& rNew) { aFont = rNew; } - void SetScale( USHORT nNew ) { nScale = nNew; } + void SetScale( sal_uInt16 nNew ) { nScale = nNew; } - virtual USHORT GetVersion(USHORT nFileVersion) const; + virtual sal_uInt16 GetVersion(sal_uInt16 nFileVersion) const; virtual int operator==( const SfxPoolItem& ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -142,12 +143,12 @@ public: String &rText, const IntlWrapper * = 0 ) const; static void StoreFont( SvStream&, const Font& ); - static Font CreateFont( SvStream&, USHORT nVer ); + static Font CreateFont( SvStream&, sal_uInt16 nVer ); - USHORT& GetValidMask() { return nValidMask; } - USHORT GetValidMask() const { return nValidMask; } - USHORT IsValid( USHORT nFlag ) const { return nValidMask & nFlag; } - void SetValid( USHORT nFlag, BOOL bValid ) + sal_uInt16& GetValidMask() { return nValidMask; } + sal_uInt16 GetValidMask() const { return nValidMask; } + sal_uInt16 IsValid( sal_uInt16 nFlag ) const { return nValidMask & nFlag; } + void SetValid( sal_uInt16 nFlag, sal_Bool bValid ) { if ( bValid ) nValidMask |= nFlag; diff --git a/editeng/inc/editeng/charhiddenitem.hxx b/editeng/inc/editeng/charhiddenitem.hxx index 0e4ae84bf2..2ae454368d 100644 --- a/editeng/inc/editeng/charhiddenitem.hxx +++ b/editeng/inc/editeng/charhiddenitem.hxx @@ -35,8 +35,8 @@ #include "editeng/editengdllapi.h" // class SvxCharHiddenItem ------------------------------------------------- -/* - [Description] +/* [Description] + This item marks text as hidden */ @@ -45,7 +45,7 @@ class EDITENG_DLLPUBLIC SvxCharHiddenItem : public SfxBoolItem public: TYPEINFO(); - SvxCharHiddenItem( const BOOL bHidden /*= FALSE*/, const USHORT nId ); + SvxCharHiddenItem( const sal_Bool bHidden /*= sal_False*/, const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, diff --git a/editeng/inc/editeng/charreliefitem.hxx b/editeng/inc/editeng/charreliefitem.hxx index 376090a536..d32f3b4aeb 100644 --- a/editeng/inc/editeng/charreliefitem.hxx +++ b/editeng/inc/editeng/charreliefitem.hxx @@ -40,7 +40,6 @@ This item defines a character relief and has currently the values emboss, relief. - */ class EDITENG_DLLPUBLIC SvxCharReliefItem : public SfxEnumItem @@ -52,12 +51,12 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream & rStrm, USHORT nIVer) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; - virtual String GetValueTextByPos( USHORT nPos ) const; - virtual USHORT GetValueCount() const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -65,10 +64,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ); - virtual bool QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); inline SvxCharReliefItem& operator=( const SvxCharReliefItem& rItem ) { diff --git a/editeng/inc/editeng/charrotateitem.hxx b/editeng/inc/editeng/charrotateitem.hxx index f085beb2fe..4e9e0ab44f 100644 --- a/editeng/inc/editeng/charrotateitem.hxx +++ b/editeng/inc/editeng/charrotateitem.hxx @@ -55,9 +55,9 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream & rStrm, USHORT nIVer) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -65,10 +65,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ); - virtual bool QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); inline SvxCharRotateItem& operator=( const SvxCharRotateItem& rItem ) { diff --git a/editeng/inc/editeng/charscaleitem.hxx b/editeng/inc/editeng/charscaleitem.hxx index 6c6e0db5b5..19967f6a23 100644 --- a/editeng/inc/editeng/charscaleitem.hxx +++ b/editeng/inc/editeng/charscaleitem.hxx @@ -52,9 +52,9 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store( SvStream& , USHORT nItemVersion ) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -62,10 +62,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ); - virtual bool QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); inline SvxCharScaleWidthItem& operator=(const SvxCharScaleWidthItem& rItem ) { diff --git a/editeng/inc/editeng/cmapitem.hxx b/editeng/inc/editeng/cmapitem.hxx index b436b1e1f3..f4b747747b 100644 --- a/editeng/inc/editeng/cmapitem.hxx +++ b/editeng/inc/editeng/cmapitem.hxx @@ -42,9 +42,9 @@ namespace rtl // class SvxCaseMapItem -------------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt die Schrift-Ausrichtung (Versalien, Kapitaelchen,...). + This item describe the font type (uppercase, small caps ,...). */ class EDITENG_DLLPUBLIC SvxCaseMapItem : public SfxEnumItem @@ -53,22 +53,22 @@ public: TYPEINFO(); SvxCaseMapItem( const SvxCaseMap eMap /*= SVX_CASEMAP_NOT_MAPPED*/, - const USHORT nId ); + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + SfxEnumItem + // "pure virtual Methods" from SfxPoolItem + SfxEnumItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - virtual String GetValueTextByPos( USHORT nPos ) const; - virtual USHORT GetValueCount() const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; // MS VC4.0 kommt durcheinander - void SetValue( USHORT nNewVal ) + void SetValue( sal_uInt16 nNewVal ) {SfxEnumItem::SetValue(nNewVal); } inline SvxCaseMapItem& operator=(const SvxCaseMapItem& rMap) @@ -81,9 +81,9 @@ public: SvxCaseMap GetCaseMap() const { return (SvxCaseMap)GetValue(); } void SetCaseMap( SvxCaseMap eNew ) - { SetValue( (USHORT)eNew ); } - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + { SetValue( (sal_uInt16)eNew ); } + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); }; #endif diff --git a/editeng/inc/editeng/cntritem.hxx b/editeng/inc/editeng/cntritem.hxx index d1b4bfeb87..b3ea8892d6 100644 --- a/editeng/inc/editeng/cntritem.hxx +++ b/editeng/inc/editeng/cntritem.hxx @@ -35,9 +35,8 @@ // class SvxContourItem -------------------------------------------------- -/* - [Beschreibung] - Dieses Item beschreibt, ob Konturschrift eingestellt ist. +/* [Description] + This item describes, if contour is employed. */ class EDITENG_DLLPUBLIC SvxContourItem : public SfxBoolItem @@ -45,13 +44,13 @@ class EDITENG_DLLPUBLIC SvxContourItem : public SfxBoolItem public: TYPEINFO(); - SvxContourItem( const BOOL bContoured /*= FALSE*/, - const USHORT nId ); + SvxContourItem( const sal_Bool bContoured /*= sal_False*/, + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/colritem.hxx b/editeng/inc/editeng/colritem.hxx index c71829bcee..6d0373f122 100644 --- a/editeng/inc/editeng/colritem.hxx +++ b/editeng/inc/editeng/colritem.hxx @@ -42,9 +42,9 @@ namespace rtl // class SvxColorItem ---------------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt eine Farbe. + This item describes a color. */ #define VERSION_USEAUTOCOLOR 1 @@ -57,17 +57,17 @@ private: public: TYPEINFO(); - SvxColorItem( const USHORT nId ); - SvxColorItem( const Color& aColor, const USHORT nId ); - SvxColorItem( SvStream& rStrm, const USHORT nId ); + SvxColorItem( const sal_uInt16 nId ); + SvxColorItem( const Color& aColor, const sal_uInt16 nId ); + SvxColorItem( SvStream& rStrm, const sal_uInt16 nId ); SvxColorItem( const SvxColorItem& rCopy ); ~SvxColorItem(); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -75,8 +75,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; inline SvxColorItem& operator=(const SvxColorItem& rColor) { diff --git a/editeng/inc/editeng/crsditem.hxx b/editeng/inc/editeng/crsditem.hxx index 6c832f503c..2d67e5288a 100644 --- a/editeng/inc/editeng/crsditem.hxx +++ b/editeng/inc/editeng/crsditem.hxx @@ -42,9 +42,8 @@ namespace rtl // class SvxCrossedOutItem ----------------------------------------------- -/* - [Beschreibung] - Dieses Item beschreibt, ob und wie durchstrichen ist. +/* [Description] + This item describes, whether and how it is striked out. */ class EDITENG_DLLPUBLIC SvxCrossedOutItem : public SfxEnumItem @@ -53,29 +52,29 @@ public: TYPEINFO(); SvxCrossedOutItem( const FontStrikeout eSt /*= STRIKEOUT_NONE*/, - const USHORT nId ); + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - virtual String GetValueTextByPos( USHORT nPos ) const; - virtual USHORT GetValueCount() const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); - // MS VC4.0 kommt durcheinander - void SetValue( USHORT nNewVal ) + // MS VC4.0 messes things up + void SetValue( sal_uInt16 nNewVal ) {SfxEnumItem::SetValue(nNewVal); } virtual int HasBoolValue() const; - virtual BOOL GetBoolValue() const; - virtual void SetBoolValue( BOOL bVal ); + virtual sal_Bool GetBoolValue() const; + virtual void SetBoolValue( sal_Bool bVal ); inline SvxCrossedOutItem& operator=(const SvxCrossedOutItem& rCross) { @@ -87,7 +86,7 @@ public: FontStrikeout GetStrikeout() const { return (FontStrikeout)GetValue(); } void SetStrikeout( FontStrikeout eNew ) - { SetValue( (USHORT)eNew ); } + { SetValue( (sal_uInt16)eNew ); } }; #endif // #ifndef _SVX_CRSDITEM_HXX diff --git a/editeng/inc/editeng/cscoitem.hxx b/editeng/inc/editeng/cscoitem.hxx index 4ddbfe32df..41067ffe93 100644 --- a/editeng/inc/editeng/cscoitem.hxx +++ b/editeng/inc/editeng/cscoitem.hxx @@ -36,9 +36,9 @@ // class SvxCharSetColorItem --------------------------------------------- -/* [Beschreibung] +/* [Description] - PB: wird nur intern im Reader des Writers benoetigt + Is only needed internally in the reader of Writer. */ class EDITENG_DLLPUBLIC SvxCharSetColorItem : public SvxColorItem @@ -47,19 +47,19 @@ class EDITENG_DLLPUBLIC SvxCharSetColorItem : public SvxColorItem public: TYPEINFO(); - SvxCharSetColorItem( const USHORT nId ); + SvxCharSetColorItem( const sal_uInt16 nId ); SvxCharSetColorItem( const Color& aColor, const rtl_TextEncoding eFrom, - const USHORT nId ); + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; inline rtl_TextEncoding& GetCharSet() { return eFrom; } inline rtl_TextEncoding GetCharSet() const { return eFrom; } diff --git a/editeng/inc/editeng/editdata.hxx b/editeng/inc/editeng/editdata.hxx index 6d252b336a..f5ef746005 100644 --- a/editeng/inc/editeng/editdata.hxx +++ b/editeng/inc/editeng/editdata.hxx @@ -57,7 +57,7 @@ enum EVAnchorMode { #define EE_APPEND 0xFFFF #define EE_INDEX_NOT_FOUND 0xFFFF -// Fehlermeldungen fuer Read/Write-Methode +// Error messages for Read / Write Method #define EE_READWRITE_OK (SVSTREAM_OK) #define EE_READWRITE_WRONGFORMAT (SVSTREAM_ERRBASE_USER+1) #define EE_READWRITE_GENERALERROR (SVSTREAM_ERRBASE_USER+2) @@ -104,13 +104,13 @@ class ImpEditEngine; class EditTextObject; class SfxStyleSheet; -#define RGCHK_NONE 0 // Keine Korrektur der ViusArea beim Scrollen -#define RGCHK_NEG 1 // Keine neg. ViusArea beim Scrollen -#define RGCHK_PAPERSZ1 2 // VisArea muss in Papierbreite,Texthoehe liegen +#define RGCHK_NONE 0 // No correction of ViusArea when scrolling +#define RGCHK_NEG 1 // No negative ViusArea when scrolling +#define RGCHK_PAPERSZ1 2 // VisArea must be within paper width, Text Size struct EPosition { - USHORT nPara; + sal_uInt16 nPara; xub_StrLen nIndex; EPosition() : @@ -119,7 +119,7 @@ struct EPosition { } - EPosition( USHORT nPara_, xub_StrLen nPos_ ) : + EPosition( sal_uInt16 nPara_, xub_StrLen nPos_ ) : nPara( nPara_ ), nIndex( nPos_ ) { @@ -128,14 +128,14 @@ struct EPosition struct ESelection { - USHORT nStartPara; + sal_uInt16 nStartPara; xub_StrLen nStartPos; - USHORT nEndPara; + sal_uInt16 nEndPara; xub_StrLen nEndPos; ESelection() : nStartPara( 0 ), nStartPos( 0 ), nEndPara( 0 ), nEndPos( 0 ) {} - ESelection( USHORT nStPara, xub_StrLen nStPos, USHORT nEPara, xub_StrLen nEPos ) : + ESelection( sal_uInt16 nStPara, xub_StrLen nStPos, sal_uInt16 nEPara, xub_StrLen nEPos ) : nStartPara( nStPara ), nStartPos( nStPos ), nEndPara( nEPara ), @@ -143,7 +143,7 @@ struct ESelection { } - ESelection( USHORT nPara, xub_StrLen nPos ) : + ESelection( sal_uInt16 nPara, xub_StrLen nPos ) : nStartPara( nPara ), nStartPos( nPos ), nEndPara( nPara ), @@ -152,14 +152,14 @@ struct ESelection } void Adjust(); - BOOL IsEqual( const ESelection& rS ) const; - BOOL IsLess( const ESelection& rS ) const; - BOOL IsGreater( const ESelection& rS ) const; - BOOL IsZero() const; - BOOL HasRange() const; + sal_Bool IsEqual( const ESelection& rS ) const; + sal_Bool IsLess( const ESelection& rS ) const; + sal_Bool IsGreater( const ESelection& rS ) const; + sal_Bool IsZero() const; + sal_Bool HasRange() const; }; -inline BOOL ESelection::HasRange() const +inline sal_Bool ESelection::HasRange() const { return ( nStartPara != nEndPara ) || ( nStartPos != nEndPos ); } @@ -178,8 +178,8 @@ inline sal_Bool ESelection::IsEqual( const ESelection& rS ) const inline sal_Bool ESelection::IsLess( const ESelection& rS ) const { - // Selektion muss justiert sein. - // => Nur pueffen, ob Ende von 'this' < Start von rS + // The selection must be adjusted. + // => Only check if end of 'this' < Start of rS if ( ( nEndPara < rS.nStartPara ) || ( ( nEndPara == rS.nStartPara ) && ( nEndPos < rS.nStartPos ) && !IsEqual( rS ) ) ) @@ -191,8 +191,8 @@ inline sal_Bool ESelection::IsLess( const ESelection& rS ) const inline sal_Bool ESelection::IsGreater( const ESelection& rS ) const { - // Selektion muss justiert sein. - // => Nur pueffen, ob Ende von 'this' > Start von rS + // The selection must be adjusted. + // => Only check if end of 'this' < Start of rS if ( ( nStartPara > rS.nEndPara ) || ( ( nStartPara == rS.nEndPara ) && ( nStartPos > rS.nEndPos ) && !IsEqual( rS ) ) ) @@ -225,7 +225,7 @@ struct EDITENG_DLLPUBLIC EFieldInfo EPosition aPosition; EFieldInfo(); - EFieldInfo( const SvxFieldItem& rFieldItem, USHORT nPara, USHORT nPos ); + EFieldInfo( const SvxFieldItem& rFieldItem, sal_uInt16 nPara, sal_uInt16 nPos ); ~EFieldInfo(); EFieldInfo( const EFieldInfo& ); @@ -235,12 +235,12 @@ struct EDITENG_DLLPUBLIC EFieldInfo // ----------------------------------------------------------------------- enum ImportState { - RTFIMP_START, RTFIMP_END, // nur pParser, nPara, nIndex + RTFIMP_START, RTFIMP_END, // only pParser, nPara, nIndex RTFIMP_NEXTTOKEN, RTFIMP_UNKNOWNATTR, // nToken+nTokenValue RTFIMP_SETATTR, // pAttrs RTFIMP_INSERTTEXT, // aText RTFIMP_INSERTPARA, // - - HTMLIMP_START, HTMLIMP_END, // nur pParser, nPara, nIndex + HTMLIMP_START, HTMLIMP_END, // only pParser, nPara, nIndex HTMLIMP_NEXTTOKEN, HTMLIMP_UNKNOWNATTR, // nToken HTMLIMP_SETATTR, // pAttrs HTMLIMP_INSERTTEXT, // aText @@ -283,24 +283,24 @@ struct ParagraphInfos , nFirstLineMaxAscent( 0 ) , bValid( 0 ) {} - USHORT nParaHeight; - USHORT nLines; + sal_uInt16 nParaHeight; + sal_uInt16 nLines; - USHORT nFirstLineStartX; + sal_uInt16 nFirstLineStartX; - USHORT nFirstLineOffset; - USHORT nFirstLineHeight; - USHORT nFirstLineTextHeight; - USHORT nFirstLineMaxAscent; + sal_uInt16 nFirstLineOffset; + sal_uInt16 nFirstLineHeight; + sal_uInt16 nFirstLineTextHeight; + sal_uInt16 nFirstLineMaxAscent; - BOOL bValid; // Bei einer Abfrage waehrend der Formatierung ungueltig! + sal_Bool bValid; // A query during formatting is not valid! }; struct EECharAttrib { const SfxPoolItem* pAttr; - USHORT nPara; + sal_uInt16 nPara; xub_StrLen nStart; xub_StrLen nEnd; }; @@ -309,11 +309,11 @@ SV_DECL_VARARR_VISIBILITY( EECharAttribArray, EECharAttrib, 0, 4, EDITENG_DLLPUB struct MoveParagraphsInfo { - USHORT nStartPara; - USHORT nEndPara; - USHORT nDestPara; + sal_uInt16 nStartPara; + sal_uInt16 nEndPara; + sal_uInt16 nDestPara; - MoveParagraphsInfo( USHORT nS, USHORT nE, USHORT nD ) + MoveParagraphsInfo( sal_uInt16 nS, sal_uInt16 nE, sal_uInt16 nD ) { nStartPara = nS; nEndPara = nE; nDestPara = nD; } }; @@ -322,9 +322,9 @@ struct MoveParagraphsInfo struct PasteOrDropInfos { - USHORT nAction; - USHORT nStartPara; - USHORT nEndPara; + sal_uInt16 nAction; + sal_uInt16 nStartPara; + sal_uInt16 nEndPara; PasteOrDropInfos() : nAction(0), nStartPara(0xFFFF), nEndPara(0xFFFF) {} }; @@ -377,10 +377,10 @@ struct EENotify EditEngine* pEditEngine; EditView* pEditView; - USHORT nParagraph; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED + sal_uInt16 nParagraph; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED - USHORT nParam1; - USHORT nParam2; + sal_uInt16 nParam1; + sal_uInt16 nParam2; EENotify( EENotifyType eType ) { eNotificationType = eType; pEditEngine = NULL; pEditView = NULL; nParagraph = EE_PARA_NOT_FOUND; nParam1 = 0; nParam2 = 0; } diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx index 75750ba74f..ed62964750 100644 --- a/editeng/inc/editeng/editeng.hxx +++ b/editeng/inc/editeng/editeng.hxx @@ -25,7 +25,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -// MyEDITENG, wegen exportiertem EditEng +// MyEDITENG, due to exported EditEng #ifndef _MyEDITENG_HXX #define _MyEDITENG_HXX @@ -34,7 +34,6 @@ class EditView; class OutputDevice; class EditUndo; class SvxFont; -class SfxUndoManager; class SfxItemPool; class SfxStyleSheet; class String; @@ -85,6 +84,9 @@ namespace svx{ struct SpellPortion; typedef std::vector<SpellPortion> SpellPortions; } +namespace svl{ +class IUndoManager; +} namespace basegfx { class B2DPolyPolygon; } #include <rsc/rscsfx.hxx> @@ -92,7 +94,7 @@ namespace basegfx { class B2DPolyPolygon; } #include <i18npool/lang.h> #include "editeng/editengdllapi.h" -#include <tools/rtti.hxx> // wegen typedef TypeId +#include <tools/rtti.hxx> // due to typedef TypeId #include <editeng/eedata.hxx> class SvxFieldData; @@ -122,7 +124,7 @@ private: EDITENG_DLLPRIVATE EditEngine( const EditEngine& ); EDITENG_DLLPRIVATE EditEngine& operator=( const EditEngine& ); - EDITENG_DLLPRIVATE BOOL PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, Window* pFrameWin = NULL ); + EDITENG_DLLPRIVATE sal_uInt8 PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, Window* pFrameWin = NULL ); protected: @@ -133,8 +135,8 @@ public: const SfxItemSet& GetEmptyItemSet(); - void SetDefTab( USHORT nDefTab ); - USHORT GetDefTab() const; + void SetDefTab( sal_uInt16 nDefTab ); + sal_uInt16 GetDefTab() const; void SetRefDevice( OutputDevice* pRefDef ); OutputDevice* GetRefDevice() const; @@ -142,51 +144,51 @@ public: void SetRefMapMode( const MapMode& rMapMode ); MapMode GetRefMapMode(); - void SetUpdateMode( BOOL bUpdate ); - BOOL GetUpdateMode() const; + void SetUpdateMode( sal_Bool bUpdate ); + sal_Bool GetUpdateMode() const; void SetBackgroundColor( const Color& rColor ); Color GetBackgroundColor() const; Color GetAutoColor() const; - void EnableAutoColor( BOOL b ); - BOOL IsAutoColorEnabled() const; - void ForceAutoColor( BOOL b ); - BOOL IsForceAutoColor() const; + void EnableAutoColor( sal_Bool b ); + sal_Bool IsAutoColorEnabled() const; + void ForceAutoColor( sal_Bool b ); + sal_Bool IsForceAutoColor() const; - void InsertView( EditView* pEditView, USHORT nIndex = EE_APPEND ); + void InsertView( EditView* pEditView, sal_uInt16 nIndex = EE_APPEND ); EditView* RemoveView( EditView* pEditView ); - EditView* RemoveView( USHORT nIndex = EE_APPEND ); - EditView* GetView( USHORT nIndex = 0 ) const; - USHORT GetViewCount() const; - BOOL HasView( EditView* pView ) const; + EditView* RemoveView( sal_uInt16 nIndex = EE_APPEND ); + EditView* GetView( sal_uInt16 nIndex = 0 ) const; + sal_uInt16 GetViewCount() const; + sal_Bool HasView( EditView* pView ) const; EditView* GetActiveView() const; void SetActiveView( EditView* pView ); void SetPaperSize( const Size& rSize ); const Size& GetPaperSize() const; - void SetVertical( BOOL bVertical ); - BOOL IsVertical() const; + void SetVertical( sal_Bool bVertical ); + sal_Bool IsVertical() const; - void SetFixedCellHeight( BOOL bUseFixedCellHeight ); - BOOL IsFixedCellHeight() const; + void SetFixedCellHeight( sal_Bool bUseFixedCellHeight ); + sal_Bool IsFixedCellHeight() const; void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir ); EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const; - USHORT GetScriptType( const ESelection& rSelection ) const; - LanguageType GetLanguage( USHORT nPara, USHORT nPos ) const; + sal_uInt16 GetScriptType( const ESelection& rSelection ) const; + LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const; void TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode ); - void SetAsianCompressionMode( USHORT nCompression ); - USHORT GetAsianCompressionMode() const; + void SetAsianCompressionMode( sal_uInt16 nCompression ); + sal_uInt16 GetAsianCompressionMode() const; - void SetKernAsianPunctuation( BOOL bEnabled ); - BOOL IsKernAsianPunctuation() const; + void SetKernAsianPunctuation( sal_Bool bEnabled ); + sal_Bool IsKernAsianPunctuation() const; - void SetAddExtLeading( BOOL b ); - BOOL IsAddExtLeading() const; + void SetAddExtLeading( sal_Bool b ); + sal_Bool IsAddExtLeading() const; void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon ); void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon); @@ -203,108 +205,110 @@ public: String GetText( const ESelection& rSelection, const LineEnd eEnd = LINEEND_LF ) const; sal_uInt32 GetTextLen() const; sal_uInt32 GetTextHeight() const; + sal_uInt32 GetTextHeightNTP() const; sal_uInt32 CalcTextWidth(); - String GetText( USHORT nParagraph ) const; - xub_StrLen GetTextLen( USHORT nParagraph ) const; - sal_uInt32 GetTextHeight( USHORT nParagraph ) const; + String GetText( sal_uInt16 nParagraph ) const; + xub_StrLen GetTextLen( sal_uInt16 nParagraph ) const; + sal_uInt32 GetTextHeight( sal_uInt16 nParagraph ) const; - USHORT GetParagraphCount() const; + sal_uInt16 GetParagraphCount() const; - USHORT GetLineCount( USHORT nParagraph ) const; - xub_StrLen GetLineLen( USHORT nParagraph, USHORT nLine ) const; - void GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const; - USHORT GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const; - sal_uInt32 GetLineHeight( USHORT nParagraph, USHORT nLine = 0 ); - USHORT GetFirstLineOffset( USHORT nParagraph ); - ParagraphInfos GetParagraphInfos( USHORT nPara ); - USHORT FindParagraph( long nDocPosY ); + sal_uInt16 GetLineCount( sal_uInt16 nParagraph ) const; + xub_StrLen GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const; + void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const; + sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + sal_uInt32 GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine = 0 ); + sal_uInt16 GetFirstLineOffset( sal_uInt16 nParagraph ); + ParagraphInfos GetParagraphInfos( sal_uInt16 nPara ); + sal_uInt16 FindParagraph( long nDocPosY ); EPosition FindDocPosition( const Point& rDocPos ) const; Rectangle GetCharacterBounds( const EPosition& rPos ) const; - String GetWord( USHORT nPara, xub_StrLen nIndex ); + String GetWord( sal_uInt16 nPara, xub_StrLen nIndex ); - ESelection GetWord( const ESelection& rSelection, USHORT nWordType ) const; - ESelection WordLeft( const ESelection& rSelection, USHORT nWordType ) const; - ESelection WordRight( const ESelection& rSelection, USHORT nWordType ) const; - ESelection CursorLeft( const ESelection& rSelection, USHORT nCharacterIteratorMode ) const; - ESelection CursorRight( const ESelection& rSelection, USHORT nCharacterIteratorMode ) const; + ESelection GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const; + ESelection WordLeft( const ESelection& rSelection, sal_uInt16 nWordType ) const; + ESelection WordRight( const ESelection& rSelection, sal_uInt16 nWordType ) const; + ESelection CursorLeft( const ESelection& rSelection, sal_uInt16 nCharacterIteratorMode ) const; + ESelection CursorRight( const ESelection& rSelection, sal_uInt16 nCharacterIteratorMode ) const; ESelection SelectSentence( const ESelection& rCurSel ) const; void Clear(); void SetText( const String& rStr ); EditTextObject* CreateTextObject(); - EditTextObject* CreateTextObject( USHORT nPara, USHORT nParas = 1 ); + EditTextObject* CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas = 1 ); EditTextObject* CreateTextObject( const ESelection& rESelection ); void SetText( const EditTextObject& rTextObject ); - void RemoveParagraph( USHORT nPara ); - void InsertParagraph( USHORT nPara, const EditTextObject& rTxtObj ); - void InsertParagraph( USHORT nPara, const String& rText); + void RemoveParagraph( sal_uInt16 nPara ); + void InsertParagraph( sal_uInt16 nPara, const EditTextObject& rTxtObj ); + void InsertParagraph( sal_uInt16 nPara, const String& rText); - void SetText( USHORT nPara, const EditTextObject& rTxtObj ); - void SetText( USHORT nPara, const String& rText); + void SetText( sal_uInt16 nPara, const EditTextObject& rTxtObj ); + void SetText( sal_uInt16 nPara, const String& rText); - virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ); - virtual const SfxItemSet& GetParaAttribs( USHORT nPara ) const; + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); + virtual const SfxItemSet& GetParaAttribs( sal_uInt16 nPara ) const; - void GetCharAttribs( USHORT nPara, EECharAttribArray& rLst ) const; + void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const; - SfxItemSet GetAttribs( USHORT nPara, USHORT nStart, USHORT nEnd, sal_uInt8 nFlags = 0xFF ) const; - SfxItemSet GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib = EditEngineAttribs_All ); + SfxItemSet GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const; + SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All ); - BOOL HasParaAttrib( USHORT nPara, USHORT nWhich ) const; - const SfxPoolItem& GetParaAttrib( USHORT nPara, USHORT nWhich ); + sal_Bool HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const; + const SfxPoolItem& GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ); - Font GetStandardFont( USHORT nPara ); - SvxFont GetStandardSvxFont( USHORT nPara ); + Font GetStandardFont( sal_uInt16 nPara ); + SvxFont GetStandardSvxFont( sal_uInt16 nPara ); void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); - void ShowParagraph( USHORT nParagraph, BOOL bShow = TRUE ); - BOOL IsParagraphVisible( USHORT nParagraph ); + void ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow = sal_True ); + sal_Bool IsParagraphVisible( sal_uInt16 nParagraph ); - SfxUndoManager& GetUndoManager(); - void UndoActionStart( USHORT nId ); - void UndoActionEnd( USHORT nId ); - BOOL IsInUndo(); + ::svl::IUndoManager& + GetUndoManager(); + void UndoActionStart( sal_uInt16 nId ); + void UndoActionEnd( sal_uInt16 nId ); + sal_Bool IsInUndo(); - void EnableUndo( BOOL bEnable ); - BOOL IsUndoEnabled(); + void EnableUndo( sal_Bool bEnable ); + sal_Bool IsUndoEnabled(); /** returns the value last used for bTryMerge while calling ImpEditEngine::InsertUndo This is currently used in a bad but needed hack to get undo actions merged in the OutlineView in impress. Do not use it unless you want to sell your soul too! */ - BOOL HasTriedMergeOnLastAddUndo() const; + sal_Bool HasTriedMergeOnLastAddUndo() const; void ClearModifyFlag(); void SetModified(); - BOOL IsModified() const; + sal_Bool IsModified() const; void SetModifyHdl( const Link& rLink ); Link GetModifyHdl() const; - BOOL IsInSelectionMode() const; + sal_Bool IsInSelectionMode() const; void StopSelectionMode(); void StripPortions(); - void GetPortions( USHORT nPara, SvUShorts& rList ); + void GetPortions( sal_uInt16 nPara, SvUShorts& rList ); - long GetFirstLineStartX( USHORT nParagraph ); - Point GetDocPosTopLeft( USHORT nParagraph ); + long GetFirstLineStartX( sal_uInt16 nParagraph ); + Point GetDocPosTopLeft( sal_uInt16 nParagraph ); Point GetDocPos( const Point& rPaperPos ) const; - BOOL IsTextPos( const Point& rPaperPos, USHORT nBorder = 0 ); + sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 ); - // StartDocPos entspr. VisArea.TopLeft(). + // StartDocPos corrresponds to VisArea.TopLeft(). void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect ); void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos ); - void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos, BOOL bClip ); + void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos, sal_Bool bClip ); void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 ); -// ULONG: Fehlercode des Streams. - ULONG Read( SvStream& rInput, const String& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); - ULONG Write( SvStream& rOutput, EETextFormat ); +// sal_uInt32: Error code of the stream. + sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); + sal_uLong Write( SvStream& rOutput, EETextFormat ); void SetStatusEventHdl( const Link& rLink ); Link GetStatusEventHdl() const; @@ -315,26 +319,26 @@ public: void SetImportHdl( const Link& rLink ); Link GetImportHdl() const; - // Flat-Mode: Keine Zeichenformatierung auswerten => Fuer Outliner - BOOL IsFlatMode() const; - void SetFlatMode( BOOL bFlat ); + // Do not evaluate font formatting => For Outliner + sal_Bool IsFlatMode() const; + void SetFlatMode( sal_Bool bFlat ); void SetControlWord( sal_uInt32 nWord ); sal_uInt32 GetControlWord() const; void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ); - void QuickRemoveCharAttribs( USHORT nPara, USHORT nWhich = 0 ); + void QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 ); void QuickMarkInvalid( const ESelection& rSel ); - void QuickFormatDoc( BOOL bFull = FALSE ); + void QuickFormatDoc( sal_Bool bFull = sal_False ); void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ); void QuickInsertLineBreak( const ESelection& rSel ); void QuickInsertText( const String& rText, const ESelection& rSel ); void QuickDelete( const ESelection& rSel ); - void QuickMarkToBeRepainted( USHORT nPara ); + void QuickMarkToBeRepainted( sal_uInt16 nPara ); - void SetGlobalCharStretching( USHORT nX = 100, USHORT nY = 100 ); - void GetGlobalCharStretching( USHORT& rX, USHORT& rY ); - void DoStretchChars( USHORT nX, USHORT nY ); + void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 ); + void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ); + void DoStretchChars( sal_uInt16 nX, sal_uInt16 nY ); void SetEditTextObjectPool( SfxItemPool* pPool ); SfxItemPool* GetEditTextObjectPool() const; @@ -342,8 +346,8 @@ public: void SetStyleSheetPool( SfxStyleSheetPool* pSPool ); SfxStyleSheetPool* GetStyleSheetPool(); - void SetStyleSheet( USHORT nPara, SfxStyleSheet* pStyle ); - SfxStyleSheet* GetStyleSheet( USHORT nPara ) const; + void SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle ); + SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const; void SetWordDelimiters( const String& rDelimiters ); String GetWordDelimiters() const; @@ -351,11 +355,11 @@ public: void SetGroupChars( const String& rChars ); String GetGroupChars() const; - void EnablePasteSpecial( BOOL bEnable ); - BOOL IsPasteSpecialEnabled() const; + void EnablePasteSpecial( sal_Bool bEnable ); + sal_Bool IsPasteSpecialEnabled() const; - void EnableIdleFormatter( BOOL bEnable ); - BOOL IsIdleFormatterEnabled() const; + void EnableIdleFormatter( sal_Bool bEnable ); + sal_Bool IsIdleFormatterEnabled() const; void EraseVirtualDevice(); @@ -376,16 +380,16 @@ public: void SetDefaultLanguage( LanguageType eLang ); LanguageType GetDefaultLanguage() const; - BOOL HasOnlineSpellErrors() const; + sal_Bool HasOnlineSpellErrors() const; void CompleteOnlineSpelling(); - void SetBigTextObjectStart( USHORT nStartAtPortionCount ); - USHORT GetBigTextObjectStart() const; - BOOL ShouldCreateBigTextObject() const; + void SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount ); + sal_uInt16 GetBigTextObjectStart() const; + sal_Bool ShouldCreateBigTextObject() const; - // Zum schnellen Vorab-Pruefen ohne View: + // For fast Pre-Test without view: EESpellState HasSpellErrors(); - BOOL HasText( const SvxSearchItem& rSearchItem ); + sal_Bool HasText( const SvxSearchItem& rSearchItem ); //initialize sentence spelling void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc); @@ -400,15 +404,15 @@ public: // for text conversion (see also HasSpellErrors) sal_Bool HasConvertibleTextPortion( LanguageType nLang ); - virtual BOOL ConvertNextDocument(); + virtual sal_Bool ConvertNextDocument(); - BOOL UpdateFields(); - void RemoveFields( BOOL bKeepFieldText, TypeId aType = NULL ); + sal_Bool UpdateFields(); + void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL ); - USHORT GetFieldCount( USHORT nPara ) const; - EFieldInfo GetFieldInfo( USHORT nPara, USHORT nField ) const; + sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const; + EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const; - BOOL IsRightToLeft( USHORT nPara ) const; + sal_Bool IsRightToLeft( sal_uInt16 nPara ) const; ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CreateTransferable( const ESelection& rSelection ) const; @@ -419,18 +423,17 @@ public: void SetBeginPasteOrDropHdl( const Link& rLink ); void SetEndPasteOrDropHdl( const Link& rLink ); - virtual void PaintingFirstLine( USHORT nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ); - virtual void ParagraphInserted( USHORT nNewParagraph ); - virtual void ParagraphDeleted( USHORT nDeletedParagraph ); - virtual void ParagraphConnected( USHORT nLeftParagraph, USHORT nRightParagraph ); - virtual void ParaAttribsChanged( USHORT nParagraph ); + virtual void PaintingFirstLine( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ); + virtual void ParagraphInserted( sal_uInt16 nNewParagraph ); + virtual void ParagraphDeleted( sal_uInt16 nDeletedParagraph ); + virtual void ParagraphConnected( sal_uInt16 nLeftParagraph, sal_uInt16 nRightParagraph ); + virtual void ParaAttribsChanged( sal_uInt16 nParagraph ); virtual void StyleSheetChanged( SfxStyleSheet* pStyle ); - virtual void ParagraphHeightChanged( USHORT nPara ); + virtual void ParagraphHeightChanged( sal_uInt16 nPara ); - // #101498# virtual void DrawingText( - const Point& rStartPos, const String& rText, USHORT nTextStart, USHORT nTextLen, const sal_Int32* pDXArray, - const SvxFont& rFont, USHORT nPara, xub_StrLen nIndex, BYTE nRightToLeft, + const Point& rStartPos, const String& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, const sal_Int32* pDXArray, + const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, const EEngineData::WrongSpellVector* pWrongSpellVector, const SvxFieldData* pFieldData, bool bEndOfLine, @@ -442,39 +445,38 @@ public: virtual void DrawingTab( const Point& rStartPos, long nWidth, const String& rChar, - const SvxFont& rFont, USHORT nPara, xub_StrLen nIndex, BYTE nRightToLeft, + const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, bool bEndOfLine, bool bEndOfParagraph, const Color& rOverlineColor, const Color& rTextLineColor); - - virtual String GetUndoComment( USHORT nUndoId ) const; - virtual BOOL FormattingParagraph( USHORT nPara ); - virtual BOOL SpellNextDocument(); - virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); - virtual void FieldSelected( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); - virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor ); + virtual String GetUndoComment( sal_uInt16 nUndoId ) const; + virtual sal_Bool FormattingParagraph( sal_uInt16 nPara ); + virtual sal_Bool SpellNextDocument(); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor ); // to be overloaded if access to bullet information needs to be provided - virtual const SvxNumberFormat * GetNumberFormat( USHORT nPara ) const; + virtual const SvxNumberFormat * GetNumberFormat( sal_uInt16 nPara ) const; - virtual Rectangle GetBulletArea( USHORT nPara ); + virtual Rectangle GetBulletArea( sal_uInt16 nPara ); - static SfxItemPool* CreatePool( BOOL bLoadRefCounts = TRUE ); + static SfxItemPool* CreatePool( sal_Bool bLoadRefCounts = sal_True ); static SfxItemPool& GetGlobalItemPool(); static sal_uInt32 RegisterClipboardFormatName(); - static BOOL DoesKeyChangeText( const KeyEvent& rKeyEvent ); - static BOOL DoesKeyMoveCursor( const KeyEvent& rKeyEvent ); - static BOOL IsSimpleCharInput( const KeyEvent& rKeyEvent ); - static USHORT GetAvailableSearchOptions(); + static sal_Bool DoesKeyChangeText( const KeyEvent& rKeyEvent ); + static sal_Bool DoesKeyMoveCursor( const KeyEvent& rKeyEvent ); + static sal_Bool IsSimpleCharInput( const KeyEvent& rKeyEvent ); + static sal_uInt16 GetAvailableSearchOptions(); static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const Font& rFont ); static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const SvxFont& rFont ); static Font CreateFontFromItemSet( const SfxItemSet& rItemSet ); - static Font CreateFontFromItemSet( const SfxItemSet& rItemSet, USHORT nScriptType ); + static Font CreateFontFromItemSet( const SfxItemSet& rItemSet, sal_uInt16 nScriptType ); static SvxFont CreateSvxFontFromItemSet( const SfxItemSet& rItemSet ); - static void ImportBulletItem( SvxNumBulletItem& rNumBullet, USHORT nLevel, const SvxBulletItem* pOldBullet, const SvxLRSpaceItem* pOldLRSpace ); - static BOOL IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); } - static BOOL HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable ); + static void ImportBulletItem( SvxNumBulletItem& rNumBullet, sal_uInt16 nLevel, const SvxBulletItem* pOldBullet, const SvxLRSpaceItem* pOldLRSpace ); + static sal_Bool IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); } + static sal_Bool HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable ); /** sets a link that is called at the beginning of a drag operation at an edit view */ void SetBeginDropHdl( const Link& rLink ); @@ -485,8 +487,8 @@ public: Link GetEndDropHdl() const; /// specifies if auto-correction should capitalize the first word or not (default is on) - void SetFirstWordCapitalization( BOOL bCapitalize ); - BOOL IsFirstWordCapitalization() const; + void SetFirstWordCapitalization( sal_Bool bCapitalize ); + sal_Bool IsFirstWordCapitalization() const; }; #endif // _MyEDITENG_HXX diff --git a/editeng/inc/editeng/editengdllapi.h b/editeng/inc/editeng/editengdllapi.h index 9ec0aeaaa0..6e916385ac 100644..100755 --- a/editeng/inc/editeng/editengdllapi.h +++ b/editeng/inc/editeng/editengdllapi.h @@ -7,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: editengdllapi.h,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/editeng/inc/editeng/editerr.hxx b/editeng/inc/editeng/editerr.hxx index f5791b83e4..cb1968bb0f 100644 --- a/editeng/inc/editeng/editerr.hxx +++ b/editeng/inc/editeng/editerr.hxx @@ -7,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svxids.hrc,v $ - * $Revision: 1.10.132.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/editeng/inc/editeng/editids.hrc b/editeng/inc/editeng/editids.hrc index 386dd0b411..d48a6f3108 100644..100755 --- a/editeng/inc/editeng/editids.hrc +++ b/editeng/inc/editeng/editids.hrc @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svxids.hrc,v $ - * $Revision: 1.10.132.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/editeng/inc/editeng/editobj.hxx b/editeng/inc/editeng/editobj.hxx index c995ea2565..3ac253c630 100644 --- a/editeng/inc/editeng/editobj.hxx +++ b/editeng/inc/editeng/editobj.hxx @@ -49,11 +49,11 @@ class EECharAttribArray; class EDITENG_DLLPUBLIC EditTextObject { private: - USHORT nWhich; + sal_uInt16 nWhich; EDITENG_DLLPRIVATE EditTextObject& operator=( const EditTextObject& ); protected: - EditTextObject( USHORT nWhich ); + EditTextObject( sal_uInt16 nWhich ); EditTextObject( const EditTextObject& r ); virtual void StoreData( SvStream& rOStream ) const; @@ -62,59 +62,59 @@ protected: public: virtual ~EditTextObject(); - USHORT Which() const { return nWhich; } + sal_uInt16 Which() const { return nWhich; } - virtual USHORT GetUserType() const; // Fuer OutlinerMode, der kann das aber nicht kompatibel speichern - virtual void SetUserType( USHORT n ); + virtual sal_uInt16 GetUserType() const; // For OutlinerMode, it can however not save in compatible format + virtual void SetUserType( sal_uInt16 n ); - virtual ULONG GetObjectSettings() const; - virtual void SetObjectSettings( ULONG n ); + virtual sal_uLong GetObjectSettings() const; + virtual void SetObjectSettings( sal_uLong n ); - virtual BOOL IsVertical() const; - virtual void SetVertical( BOOL bVertical ); + virtual sal_Bool IsVertical() const; + virtual void SetVertical( sal_Bool bVertical ); - virtual USHORT GetScriptType() const; + virtual sal_uInt16 GetScriptType() const; - virtual USHORT GetVersion() const; // Solange der Outliner keine Recordlaenge speichert + virtual sal_uInt16 GetVersion() const; // As long as the outliner does not store any record length. virtual EditTextObject* Clone() const = 0; - BOOL Store( SvStream& rOStream ) const; + sal_Bool Store( SvStream& rOStream ) const; static EditTextObject* Create( SvStream& rIStream, SfxItemPool* pGlobalTextObjectPool = 0 ); void Skip( SvStream& rIStream ); - virtual USHORT GetParagraphCount() const; + virtual sal_uInt16 GetParagraphCount() const; - virtual XubString GetText( USHORT nParagraph ) const; - virtual void Insert( const EditTextObject& rObj, USHORT nPara ); - virtual void RemoveParagraph( USHORT nPara ); - virtual EditTextObject* CreateTextObject( USHORT nPara, USHORT nParas = 1 ) const; + virtual XubString GetText( sal_uInt16 nParagraph ) const; + virtual void Insert( const EditTextObject& rObj, sal_uInt16 nPara ); + virtual void RemoveParagraph( sal_uInt16 nPara ); + virtual EditTextObject* CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas = 1 ) const; - virtual BOOL HasPortionInfo() const; + virtual sal_Bool HasPortionInfo() const; virtual void ClearPortionInfo(); - virtual BOOL HasOnlineSpellErrors() const; + virtual sal_Bool HasOnlineSpellErrors() const; - virtual BOOL HasCharAttribs( USHORT nWhich = 0 ) const; - virtual void GetCharAttribs( USHORT nPara, EECharAttribArray& rLst ) const; + virtual sal_Bool HasCharAttribs( sal_uInt16 nWhich = 0 ) const; + virtual void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const; - virtual BOOL RemoveCharAttribs( USHORT nWhich = 0 ); - virtual BOOL RemoveParaAttribs( USHORT nWhich = 0 ); + virtual sal_Bool RemoveCharAttribs( sal_uInt16 nWhich = 0 ); + virtual sal_Bool RemoveParaAttribs( sal_uInt16 nWhich = 0 ); - virtual void MergeParaAttribs( const SfxItemSet& rAttribs, USHORT nStart = EE_CHAR_START, USHORT nEnd = EE_CHAR_END ); + virtual void MergeParaAttribs( const SfxItemSet& rAttribs, sal_uInt16 nStart = EE_CHAR_START, sal_uInt16 nEnd = EE_CHAR_END ); - virtual BOOL IsFieldObject() const; + virtual sal_Bool IsFieldObject() const; virtual const SvxFieldItem* GetField() const; - virtual BOOL HasField( TypeId aType = NULL ) const; + virtual sal_Bool HasField( TypeId aType = NULL ) const; - virtual SfxItemSet GetParaAttribs( USHORT nPara ) const; - virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rAttribs ); + virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rAttribs ); - virtual BOOL HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const; - virtual void GetStyleSheet( USHORT nPara, XubString& rName, SfxStyleFamily& eFamily ) const; - virtual void SetStyleSheet( USHORT nPara, const XubString& rName, const SfxStyleFamily& eFamily ); - virtual BOOL ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, + virtual sal_Bool HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const; + virtual void GetStyleSheet( sal_uInt16 nPara, XubString& rName, SfxStyleFamily& eFamily ) const; + virtual void SetStyleSheet( sal_uInt16 nPara, const XubString& rName, const SfxStyleFamily& eFamily ); + virtual sal_Bool ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily ); virtual void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName ); diff --git a/editeng/inc/editeng/editrids.hrc b/editeng/inc/editeng/editrids.hrc index 6e11e0617c..c0a61e2b40 100644..100755 --- a/editeng/inc/editeng/editrids.hrc +++ b/editeng/inc/editeng/editrids.hrc @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svxids.hrc,v $ - * $Revision: 1.10.132.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -240,45 +237,6 @@ #define RID_SVXITEMS_WEIGHT_ULTRABOLD (RID_EDIT_START + 167) #define RID_SVXITEMS_WEIGHT_BLACK (RID_EDIT_START + 168) -// paper formats -#define RID_SVXSTR_PAPER_A0 (RID_SVX_START + 169) -#define RID_SVXSTR_PAPER_A1 (RID_SVX_START + 170) -#define RID_SVXSTR_PAPER_A2 (RID_SVX_START + 171) -#define RID_SVXSTR_PAPER_A3 (RID_SVX_START + 172) -#define RID_SVXSTR_PAPER_A4 (RID_SVX_START + 173) -#define RID_SVXSTR_PAPER_A5 (RID_SVX_START + 174) -#define RID_SVXSTR_PAPER_B4_ISO (RID_SVX_START + 175) -#define RID_SVXSTR_PAPER_B5_ISO (RID_SVX_START + 176) -#define RID_SVXSTR_PAPER_LETTER (RID_SVX_START + 177) -#define RID_SVXSTR_PAPER_LEGAL (RID_SVX_START + 178) -#define RID_SVXSTR_PAPER_TABLOID (RID_SVX_START + 179) -#define RID_SVXSTR_PAPER_USER (RID_SVX_START + 180) -#define RID_SVXSTR_PAPER_B6_ISO (RID_SVX_START + 181) -#define RID_SVXSTR_PAPER_C4 (RID_SVX_START + 182) -#define RID_SVXSTR_PAPER_C5 (RID_SVX_START + 183) -#define RID_SVXSTR_PAPER_C6 (RID_SVX_START + 184) -#define RID_SVXSTR_PAPER_C65 (RID_SVX_START + 185) -#define RID_SVXSTR_PAPER_DL (RID_SVX_START + 186) -#define RID_SVXSTR_PAPER_DIA (RID_SVX_START + 187) -#define RID_SVXSTR_PAPER_SCREEN (RID_SVX_START + 188) -#define RID_SVXSTR_PAPER_C (RID_SVX_START + 189) -#define RID_SVXSTR_PAPER_D (RID_SVX_START + 190) -#define RID_SVXSTR_PAPER_E (RID_SVX_START + 191) -#define RID_SVXSTR_PAPER_EXECUTIVE (RID_SVX_START + 192) -#define RID_SVXSTR_PAPER_LEGAL2 (RID_SVX_START + 193) -#define RID_SVXSTR_PAPER_MONARCH (RID_SVX_START + 194) -#define RID_SVXSTR_PAPER_COM675 (RID_SVX_START + 195) -#define RID_SVXSTR_PAPER_COM9 (RID_SVX_START + 196) -#define RID_SVXSTR_PAPER_COM10 (RID_SVX_START + 197) -#define RID_SVXSTR_PAPER_COM11 (RID_SVX_START + 198) -#define RID_SVXSTR_PAPER_COM12 (RID_SVX_START + 199) -#define RID_SVXSTR_PAPER_KAI16 (RID_SVX_START + 200) -#define RID_SVXSTR_PAPER_KAI32 (RID_SVX_START + 201) -#define RID_SVXSTR_PAPER_KAI32BIG (RID_SVX_START + 202) -#define RID_SVXSTR_PAPER_B4_JIS (RID_SVX_START + 203) -#define RID_SVXSTR_PAPER_B5_JIS (RID_SVX_START + 204) -#define RID_SVXSTR_PAPER_B6_JIS (RID_SVX_START + 205) - // enum FontItalic ------------------------------------------------------- #define RID_SVXITEMS_ITALIC_BEGIN (RID_EDIT_START + 206) #define RID_SVXITEMS_ITALIC_NONE (RID_EDIT_START + 206) @@ -321,25 +279,23 @@ #define RID_SVXITEMS_SHADOW_BOTTOMLEFT (RID_EDIT_START + 232) #define RID_SVXITEMS_SHADOW_BOTTOMRIGHT (RID_EDIT_START + 233) -// Umrandungslinien -#define RID_SINGLE_LINE0 (RID_EDIT_START + 234) -#define RID_SINGLE_LINE1 (RID_EDIT_START + 235) -#define RID_SINGLE_LINE2 (RID_EDIT_START + 236) -#define RID_SINGLE_LINE3 (RID_EDIT_START + 237) -#define RID_SINGLE_LINE4 (RID_EDIT_START + 238) -#define RID_DOUBLE_LINE0 (RID_EDIT_START + 239) -#define RID_DOUBLE_LINE1 (RID_EDIT_START + 240) -#define RID_DOUBLE_LINE2 (RID_EDIT_START + 241) -#define RID_DOUBLE_LINE3 (RID_EDIT_START + 242) -#define RID_DOUBLE_LINE4 (RID_EDIT_START + 243) -#define RID_DOUBLE_LINE5 (RID_EDIT_START + 244) -#define RID_DOUBLE_LINE6 (RID_EDIT_START + 245) -#define RID_DOUBLE_LINE7 (RID_EDIT_START + 246) -#define RID_DOUBLE_LINE8 (RID_EDIT_START + 247) -#define RID_DOUBLE_LINE9 (RID_EDIT_START + 248) -#define RID_DOUBLE_LINE10 (RID_EDIT_START + 249) - -// Metric-Texte +// Border lines +#define RID_SOLID (RID_EDIT_START + 234) +#define RID_DOTTED (RID_EDIT_START + 235) +#define RID_DASHED (RID_EDIT_START + 236) +#define RID_DOUBLE (RID_EDIT_START + 237) +#define RID_THINTHICK_SMALLGAP (RID_EDIT_START + 238) +#define RID_THINTHICK_MEDIUMGAP (RID_EDIT_START + 239) +#define RID_THINTHICK_LARGEGAP (RID_EDIT_START + 240) +#define RID_THICKTHIN_SMALLGAP (RID_EDIT_START + 241) +#define RID_THICKTHIN_MEDIUMGAP (RID_EDIT_START + 242) +#define RID_THICKTHIN_LARGEGAP (RID_EDIT_START + 243) +#define RID_EMBOSSED (RID_EDIT_START + 244) +#define RID_ENGRAVED (RID_EDIT_START + 245) +#define RID_OUTSET (RID_EDIT_START + 246) +#define RID_INSET (RID_EDIT_START + 247) + +// Metric-Text #define RID_SVXITEMS_METRIC_MM (RID_EDIT_START + 250) #define RID_SVXITEMS_METRIC_CM (RID_EDIT_START + 251) #define RID_SVXITEMS_METRIC_INCH (RID_EDIT_START + 252) diff --git a/editeng/inc/editeng/editstat.hxx b/editeng/inc/editeng/editstat.hxx index 15de80a6a0..e554f721ff 100644 --- a/editeng/inc/editeng/editstat.hxx +++ b/editeng/inc/editeng/editstat.hxx @@ -32,43 +32,43 @@ #include <tools/string.hxx> #include <i18npool/lang.h> -#define EE_CNTRL_USECHARATTRIBS 0x00000001 // Verwendung harter ZeichenAttr. -#define EE_CNTRL_USEPARAATTRIBS 0x00000002 // Verwendung von AbsatzAttr. -#define EE_CNTRL_CRSRLEFTPARA 0x00000004 // Cursor ist in einen anderen Absatz gewandert -#define EE_CNTRL_DOIDLEFORMAT 0x00000008 // Idle-Formatierung +#define EE_CNTRL_USECHARATTRIBS 0x00000001 // Use of hard character attributes +#define EE_CNTRL_USEPARAATTRIBS 0x00000002 // Using paragraph attributes. +#define EE_CNTRL_CRSRLEFTPARA 0x00000004 // Cursor is moved to another paragraph +#define EE_CNTRL_DOIDLEFORMAT 0x00000008 // Formatting idle #define EE_CNTRL_PASTESPECIAL 0x00000010 // Allow PasteSpecial -#define EE_CNTRL_AUTOINDENTING 0x00000020 // Automatisches einruecken -#define EE_CNTRL_UNDOATTRIBS 0x00000040 // Undo fuer Attribute.... -#define EE_CNTRL_ONECHARPERLINE 0x00000080 // Ein Zeichen pro Zeile -#define EE_CNTRL_NOCOLORS 0x00000100 // Engine: Keine Farben -#define EE_CNTRL_OUTLINER 0x00000200 // Sonderbehandlung Outliner/Gliederungsmodus -#define EE_CNTRL_OUTLINER2 0x00000400 // Sonderbehandlung Outliner/Seite -#define EE_CNTRL_ALLOWBIGOBJS 0x00000800 // PortionInfo in Textobjekten -#define EE_CNTRL_ONLINESPELLING 0x00001000 // Waehrend des editieren Spelling -#define EE_CNTRL_STRETCHING 0x00002000 // Stretch-Modus -#define EE_CNTRL_MARKFIELDS 0x00004000 // Felder farblich hinterlegen +#define EE_CNTRL_AUTOINDENTING 0x00000020 // Automatic indenting +#define EE_CNTRL_UNDOATTRIBS 0x00000040 // Undo for Attributes.... +#define EE_CNTRL_ONECHARPERLINE 0x00000080 // One character per line +#define EE_CNTRL_NOCOLORS 0x00000100 // Engine: No Color +#define EE_CNTRL_OUTLINER 0x00000200 // Special treatment Outliner/Outline mode +#define EE_CNTRL_OUTLINER2 0x00000400 // Special treatment Outliner/Page +#define EE_CNTRL_ALLOWBIGOBJS 0x00000800 // Portion info in text object +#define EE_CNTRL_ONLINESPELLING 0x00001000 // During the edit Spelling +#define EE_CNTRL_STRETCHING 0x00002000 // Stretch mode +#define EE_CNTRL_MARKFIELDS 0x00004000 // Mark Fields with color #define EE_CNTRL_URLSFXEXECUTE 0x00008000 // !!!OLD!!!: SFX-URL-Execute. -#define EE_CNTRL_RESTOREFONT 0x00010000 // Font im OutDev restaurieren -#define EE_CNTRL_RTFSTYLESHEETS 0x00020000 // Stylesheets bei Import verwenden -//#define EE_CNTRL_NOREDLINES 0x00040000 // Keine RedLines bei OnlineSpellError /* removed #i91949 */ -#define EE_CNTRL_AUTOCORRECT 0x00080000 // AutoKorrektur +#define EE_CNTRL_RESTOREFONT 0x00010000 // Restore Font in OutDev +#define EE_CNTRL_RTFSTYLESHEETS 0x00020000 // Use Stylesheets when imported +//#define EE_CNTRL_NOREDLINES 0x00040000 // No RedLines when OnlineSpellError /* removed #i91949 */ +#define EE_CNTRL_AUTOCORRECT 0x00080000 // AutoCorrect #define EE_CNTRL_AUTOCOMPLETE 0x00100000 // AutoComplete -#define EE_CNTRL_AUTOPAGESIZEX 0x00200000 // Papierbreite an Text anpassen -#define EE_CNTRL_AUTOPAGESIZEY 0x00400000 // Papierhoehe an Text anpassen +#define EE_CNTRL_AUTOPAGESIZEX 0x00200000 // Adjust paper width to Text +#define EE_CNTRL_AUTOPAGESIZEY 0x00400000 // Adjust paper height to Text #define EE_CNTRL_AUTOPAGESIZE (EE_CNTRL_AUTOPAGESIZEX|EE_CNTRL_AUTOPAGESIZEY) -#define EE_CNTRL_TABINDENTING 0x00800000 // Einruecken mit Tab -#define EE_CNTRL_FORMAT100 0x01000000 // Immer nach 100% formatieren -#define EE_CNTRL_ULSPACESUMMATION 0x02000000 // MS Compat: SA und SB aufsummieren, nicht maximalwert -#define EE_CNTRL_ULSPACEFIRSTPARA 0x04000000 // MS Compat: SB auch beim ersten Absatz auswerten - -#define EV_CNTRL_AUTOSCROLL 0x00000001 // Autom. Scrollen horiz. -#define EV_CNTRL_BIGSCROLL 0x00000002 // Weiter Scrollen, als nur zum Cursor -#define EV_CNTRL_ENABLEPASTE 0x00000004 // Paste erlauben -#define EV_CNTRL_SINGLELINEPASTE 0x00000008 // View: Paste in Eingabezeile... -#define EV_CNTRL_OVERWRITE 0x00000010 // Ueberschreibmodus -#define EV_CNTRL_INVONEMORE 0x00000020 // Ein Pixel mehr invalidieren -#define EV_CNTRL_AUTOSIZEX 0x00000040 // Automatisch an Textbreite anpassen -#define EV_CNTRL_AUTOSIZEY 0x00000080 // Automatisch an Texthoehe anpassen +#define EE_CNTRL_TABINDENTING 0x00800000 // Indent with tab +#define EE_CNTRL_FORMAT100 0x01000000 // Always format to 100% +#define EE_CNTRL_ULSPACESUMMATION 0x02000000 // MS Compat: sum SA and SB, not maximum value +#define EE_CNTRL_ULSPACEFIRSTPARA 0x04000000 // MS Compat: evaluate also at the first paragraph + +#define EV_CNTRL_AUTOSCROLL 0x00000001 // Auto scrolling horizontally +#define EV_CNTRL_BIGSCROLL 0x00000002 // Scroll further to the cursor +#define EV_CNTRL_ENABLEPASTE 0x00000004 // Enable Paste +#define EV_CNTRL_SINGLELINEPASTE 0x00000008 // View: Paste in input line ... +#define EV_CNTRL_OVERWRITE 0x00000010 // Overwrite mode +#define EV_CNTRL_INVONEMORE 0x00000020 // Invalidate one pixel more +#define EV_CNTRL_AUTOSIZEX 0x00000040 // Automatically adapt to text width +#define EV_CNTRL_AUTOSIZEY 0x00000080 // Automatically adapt to Text width #define EV_CNTRL_AUTOSIZE (EV_CNTRL_AUTOSIZEX|EV_CNTRL_AUTOSIZEY) #define EE_STAT_HSCROLL 0x00000001 @@ -81,15 +81,15 @@ #define EE_STAT_WRONGWORDCHANGED 0x00000080 // #define EE_STAT_MODIFIED 0x00000100 -// Nur fuer Update: +// Only for Update: #define EE_CNTRL_AUTOCENTER EE_CNTRL_AUTOPAGESIZE #define EE_STAT_GROWY EE_STAT_TEXTHEIGHTCHANGED /* - EE_STAT_CRSRLEFTPARA zur Zeit bei Cursorbewegungen und Return. + EE_STAT_CRSRLEFTPARA at the time cursor movement and the enter. */ -inline void SetFlags( ULONG& rBits, const ULONG nMask, bool bOn ) +inline void SetFlags( sal_uLong& rBits, const sal_uInt32 nMask, bool bOn ) { if ( bOn ) rBits |= nMask; @@ -100,25 +100,25 @@ inline void SetFlags( ULONG& rBits, const ULONG nMask, bool bOn ) class EditStatus { protected: - ULONG nStatusBits; - ULONG nControlBits; - USHORT nPrevPara; // fuer EE_STAT_CRSRLEFTPARA + sal_uLong nStatusBits; + sal_uLong nControlBits; + sal_uInt16 nPrevPara; // for EE_STAT_CRSRLEFTPARA public: EditStatus() { nStatusBits = 0; nControlBits = 0; nPrevPara = 0xFFFF; } void Clear() { nStatusBits = 0; } - void SetControlBits( ULONG nMask, bool bOn ) + void SetControlBits( sal_uLong nMask, bool bOn ) { SetFlags( nControlBits, nMask, bOn ); } - ULONG GetStatusWord() const { return nStatusBits; } - ULONG& GetStatusWord() { return nStatusBits; } + sal_uLong GetStatusWord() const { return nStatusBits; } + sal_uLong& GetStatusWord() { return nStatusBits; } - ULONG GetControlWord() const { return nControlBits; } - ULONG& GetControlWord() { return nControlBits; } + sal_uLong GetControlWord() const { return nControlBits; } + sal_uLong& GetControlWord() { return nControlBits; } - USHORT GetPrevParagraph() const { return nPrevPara; } - USHORT& GetPrevParagraph() { return nPrevPara; } + sal_uInt16 GetPrevParagraph() const { return nPrevPara; } + sal_uInt16& GetPrevParagraph() { return nPrevPara; } }; #define SPELLCMD_IGNOREWORD 0x0001 @@ -129,18 +129,18 @@ public: struct SpellCallbackInfo { - USHORT nCommand; + sal_uInt16 nCommand; String aWord; LanguageType eLanguage; - SpellCallbackInfo( USHORT nCMD, const String& rWord ) + SpellCallbackInfo( sal_uInt16 nCMD, const String& rWord ) : aWord( rWord ) { nCommand = nCMD; eLanguage = LANGUAGE_DONTKNOW; } - SpellCallbackInfo( USHORT nCMD, LanguageType eLang ) + SpellCallbackInfo( sal_uInt16 nCMD, LanguageType eLang ) { nCommand = nCMD; eLanguage = eLang; diff --git a/editeng/inc/editeng/editund2.hxx b/editeng/inc/editeng/editund2.hxx index a4c7917ec8..09e95e1a3d 100644 --- a/editeng/inc/editeng/editund2.hxx +++ b/editeng/inc/editeng/editund2.hxx @@ -34,7 +34,7 @@ class ImpEditEngine; -class EDITENG_DLLPUBLIC EditUndoManager : public SfxUndoManager +class EDITENG_DLLPRIVATE EditUndoManager : public SfxUndoManager { using SfxUndoManager::Undo; using SfxUndoManager::Redo; @@ -44,8 +44,8 @@ private: public: EditUndoManager( ImpEditEngine* pImpEE ); - virtual BOOL Undo( USHORT nCount=1 ); - virtual BOOL Redo( USHORT nCount=1 ); + virtual sal_Bool Undo(); + virtual sal_Bool Redo(); }; // ----------------------------------------------------------------------- @@ -54,12 +54,12 @@ public: class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction { private: - USHORT nId; + sal_uInt16 nId; ImpEditEngine* pImpEE; public: TYPEINFO(); - EditUndo( USHORT nI, ImpEditEngine* pImpEE ); + EditUndo( sal_uInt16 nI, ImpEditEngine* pImpEE ); virtual ~EditUndo(); ImpEditEngine* GetImpEditEngine() const { return pImpEE; } @@ -67,9 +67,9 @@ public: virtual void Undo() = 0; virtual void Redo() = 0; - virtual BOOL CanRepeat(SfxRepeatTarget&) const; + virtual sal_Bool CanRepeat(SfxRepeatTarget&) const; virtual String GetComment() const; - virtual USHORT GetId() const; + virtual sal_uInt16 GetId() const; }; #endif // _EDITUND2_HXX diff --git a/editeng/inc/editeng/editview.hxx b/editeng/inc/editeng/editview.hxx index 39756b53c3..304187d595 100644 --- a/editeng/inc/editeng/editview.hxx +++ b/editeng/inc/editeng/editview.hxx @@ -25,7 +25,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -// MyEDITVIEW, wegen exportiertem EditView +// MyEDITVIEW, due to exported EditView #ifndef _MyEDITVIEW_HXX #define _MyEDITVIEW_HXX @@ -76,7 +76,7 @@ class EDITENG_DLLPUBLIC EditView friend class ImpEditEngine; friend class EditSelFunctionSet; -public: // brauche ich fuer Undo +public: // Needed for Undo ImpEditView* GetImpEditView() const { return pImpEditView; } ImpEditEngine* GetImpEditEngine() const; @@ -98,41 +98,41 @@ public: void Paint( const Rectangle& rRect ); void Invalidate(); - Pair Scroll( long nHorzScroll, long nVertScroll, BYTE nRangeCheck = RGCHK_NEG ); + Pair Scroll( long nHorzScroll, long nVertScroll, sal_uInt8 nRangeCheck = RGCHK_NEG ); - void ShowCursor( BOOL bGotoCursor = TRUE, BOOL bForceVisCursor = TRUE ); + void ShowCursor( sal_Bool bGotoCursor = sal_True, sal_Bool bForceVisCursor = sal_True ); void HideCursor(); EESelectionMode GetSelectionMode() const; void SetSelectionMode( EESelectionMode eMode ); - void SetReadOnly( BOOL bReadOnly ); - BOOL IsReadOnly() const; + void SetReadOnly( sal_Bool bReadOnly ); + sal_Bool IsReadOnly() const; - BOOL HasSelection() const; + sal_Bool HasSelection() const; ESelection GetSelection() const; void SetSelection( const ESelection& rNewSel ); - BOOL SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); + sal_Bool SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); void IndentBlock(); void UnindentBlock(); - BOOL IsInsertMode() const; - void SetInsertMode( BOOL bInsert ); + sal_Bool IsInsertMode() const; + void SetInsertMode( sal_Bool bInsert ); void ReplaceSelected( const String& rStr ); String GetSelected(); void DeleteSelected(); - USHORT GetSelectedScriptType() const; + sal_uInt16 GetSelectedScriptType() const; - // Position der VisArea im Ausgabefenster. - // Eine Groessenaenderung betrifft auch die VisArea + // VisArea position of the Output window. + // A size change also affects the VisArea void SetOutputArea( const Rectangle& rRec ); const Rectangle& GetOutputArea() const; - // Dokumentposition. - // Eine Groessenaenderung betrifft auch die VisArea + // Document position. + // A size change also affects the VisArea void SetVisArea( const Rectangle& rRec ); const Rectangle& GetVisArea() const; @@ -142,17 +142,17 @@ public: void SetCursor( const Cursor& rCursor ); Cursor* GetCursor() const; - void InsertText( const String& rNew, BOOL bSelect = FALSE ); + void InsertText( const String& rNew, sal_Bool bSelect = sal_False ); - BOOL PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL ); + sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL ); - BOOL MouseButtonUp( const MouseEvent& rMouseEvent ); - BOOL MouseButtonDown( const MouseEvent& rMouseEvent ); - BOOL MouseMove( const MouseEvent& rMouseEvent ); + sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent ); + sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent ); + sal_Bool MouseMove( const MouseEvent& rMouseEvent ); void Command( const CommandEvent& rCEvt ); - BOOL Drop( const DropEvent& rEvt ); - BOOL QueryDrop( DropEvent& rEvt ); + sal_Bool Drop( const DropEvent& rEvt ); + sal_Bool QueryDrop( DropEvent& rEvt ); ESelection GetDropPos(); void Cut(); @@ -160,28 +160,28 @@ public: void Paste(); void PasteSpecial(); - void EnablePaste( BOOL bEnable ); - BOOL IsPasteEnabled() const; + void EnablePaste( sal_Bool bEnable ); + sal_Bool IsPasteEnabled() const; void Undo(); void Redo(); - // speziell fuer Olli - USHORT GetParagraph( const Point& rMousePosPixel ); - Point GetWindowPosTopLeft( USHORT nParagraph ); - void MoveParagraphs( Range aParagraphs, USHORT nNewPos ); + // especially for Oliver Specht + sal_uInt16 GetParagraph( const Point& rMousePosPixel ); + Point GetWindowPosTopLeft( sal_uInt16 nParagraph ); + void MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos ); void MoveParagraphs( long nDiff ); const SfxItemSet& GetEmptyItemSet(); SfxItemSet GetAttribs(); void SetAttribs( const SfxItemSet& rSet ); - void SetParaAttribs( const SfxItemSet& rSet, USHORT nPara ); - void RemoveAttribs( BOOL bRemoveParaAttribs = FALSE, USHORT nWhich = 0 ); - void RemoveCharAttribs( USHORT nPara, USHORT nWhich = 0 ); - void RemoveAttribsKeepLanguages( BOOL bRemoveParaAttribs = FALSE ); + void SetParaAttribs( const SfxItemSet& rSet, sal_uInt16 nPara ); + void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0 ); + void RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 ); + void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs = sal_False ); - ULONG Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, BOOL bSelect = FALSE, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); - ULONG Write( SvStream& rOutput, EETextFormat eFormat ); + sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); + sal_uLong Write( SvStream& rOutput, EETextFormat eFormat ); void SetBackgroundColor( const Color& rColor ); Color GetBackgroundColor() const; @@ -191,12 +191,12 @@ public: EditTextObject* CreateTextObject(); void InsertText( const EditTextObject& rTextObject ); - void InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, BOOL bUseSpecial ); + void InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, sal_Bool bUseSpecial ); ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetTransferable(); - // An EditView, damit bei TRUE flackerfreies Update: - void SetEditEngineUpdateMode( BOOL bUpdate ); + // An EditView, so that when TRUE the update will be free from flickering: + void SetEditEngineUpdateMode( sal_Bool bUpdate ); void ForceUpdate(); SfxStyleSheet* GetStyleSheet() const; @@ -205,37 +205,37 @@ public: void SetAnchorMode( EVAnchorMode eMode ); EVAnchorMode GetAnchorMode() const; - BOOL MatchGroup(); + sal_Bool MatchGroup(); void CompleteAutoCorrect( Window* pFrameWin = NULL ); - EESpellState StartSpeller( BOOL bMultipleDoc = FALSE ); + EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False ); EESpellState StartThesaurus(); - USHORT StartSearchAndReplace( const SvxSearchItem& rSearchItem ); + sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem ); // for text conversion - void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, INT32 nOptions, BOOL bIsInteractive, BOOL bMultipleDoc ); + void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ); sal_Bool HasConvertibleTextPortion( LanguageType nLang ); void TransliterateText( sal_Int32 nTransliterationMode ); - BOOL IsCursorAtWrongSpelledWord( BOOL bMarkIfWrong = FALSE ); - BOOL IsWrongSpelledWordAtPos( const Point& rPosPixel, BOOL bMarkIfWrong = FALSE ); + sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False ); + sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False ); void SpellIgnoreWord(); void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 ); void InsertField( const SvxFieldItem& rFld ); const SvxFieldItem* GetFieldUnderMousePointer() const; - const SvxFieldItem* GetFieldUnderMousePointer( USHORT& nPara, xub_StrLen& nPos ) const; - const SvxFieldItem* GetField( const Point& rPos, USHORT* pnPara = NULL, xub_StrLen* pnPos = NULL ) const; + const SvxFieldItem* GetFieldUnderMousePointer( sal_uInt16& nPara, xub_StrLen& nPos ) const; + const SvxFieldItem* GetField( const Point& rPos, sal_uInt16* pnPara = NULL, xub_StrLen* pnPos = NULL ) const; const SvxFieldItem* GetFieldAtSelection() const; String GetWordUnderMousePointer() const; String GetWordUnderMousePointer( Rectangle& rWordRect ) const; - void SetInvalidateMore( USHORT nPixel ); - USHORT GetInvalidateMore() const; + void SetInvalidateMore( sal_uInt16 nPixel ); + sal_uInt16 GetInvalidateMore() const; // grows or shrinks the font height for the current selection void ChangeFontSize( bool bGrow, const FontList* pList ); diff --git a/editeng/inc/editeng/edtdlg.hxx b/editeng/inc/editeng/edtdlg.hxx index 7fe32ac5e1..8e586b5600 100644 --- a/editeng/inc/editeng/edtdlg.hxx +++ b/editeng/inc/editeng/edtdlg.hxx @@ -7,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: abstdlg.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/editeng/inc/editeng/eeitemid.hxx b/editeng/inc/editeng/eeitemid.hxx index 3e28e0e5e1..62b5a523dc 100644 --- a/editeng/inc/editeng/eeitemid.hxx +++ b/editeng/inc/editeng/eeitemid.hxx @@ -80,7 +80,7 @@ #undef ITEMID_BRUSH #endif -// Zeichenattribute.... +// Character Attributes.... #define ITEMID_FONT EE_CHAR_FONTINFO #define ITEMID_POSTURE EE_CHAR_ITALIC #define ITEMID_WEIGHT EE_CHAR_WEIGHT @@ -105,7 +105,7 @@ #define ITEMID_EMPHASISMARK EE_CHAR_EMPHASISMARK #define ITEMID_CHARRELIEF EE_CHAR_RELIEF -// Absatzattribute +// Paragraph Attributes #define ITEMID_SCRIPTSPACE EE_PARA_ASIANCJKSPACING #define ITEMID_ADJUST EE_PARA_JUST #define ITEMID_LINESPACING EE_PARA_SBL diff --git a/editeng/inc/editeng/eerdll.hxx b/editeng/inc/editeng/eerdll.hxx index f942c7d6fc..7388b09f50 100644 --- a/editeng/inc/editeng/eerdll.hxx +++ b/editeng/inc/editeng/eerdll.hxx @@ -38,7 +38,7 @@ class GlobalEditData; class EDITENG_DLLPUBLIC EditResId: public ResId { public: - EditResId( USHORT nId ); + EditResId( sal_uInt16 nId ); }; class EditDLL diff --git a/editeng/inc/editeng/emphitem.hxx b/editeng/inc/editeng/emphitem.hxx index 2715f5057e..3ba2f3e1ab 100644 --- a/editeng/inc/editeng/emphitem.hxx +++ b/editeng/inc/editeng/emphitem.hxx @@ -42,9 +42,9 @@ namespace rtl // class SvxEmphasisMarkItem ---------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt die Font-Betonung. + This item describes the Font emphasis. */ class EDITENG_DLLPUBLIC SvxEmphasisMarkItem : public SfxUInt16Item @@ -53,9 +53,9 @@ public: TYPEINFO(); SvxEmphasisMarkItem( const FontEmphasisMark eVal /*= EMPHASISMARK_NONE*/, - const USHORT nId ); + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + SfxEnumItem + // "pure virtual Methods" from SfxPoolItem + SfxEnumItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, @@ -63,14 +63,12 @@ public: const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); inline SvxEmphasisMarkItem& operator=(const SvxEmphasisMarkItem& rItem ) { @@ -82,7 +80,7 @@ public: FontEmphasisMark GetEmphasisMark() const { return (FontEmphasisMark)GetValue(); } void SetEmphasisMark( FontEmphasisMark eNew ) - { SetValue( (USHORT)eNew ); } + { SetValue( (sal_uInt16)eNew ); } }; #endif // #ifndef _SVX_EMPHITEM_HXX diff --git a/editeng/inc/editeng/escpitem.hxx b/editeng/inc/editeng/escpitem.hxx index f37f763b74..59f66e798e 100644 --- a/editeng/inc/editeng/escpitem.hxx +++ b/editeng/inc/editeng/escpitem.hxx @@ -43,42 +43,42 @@ namespace rtl // class SvxEscapementItem ----------------------------------------------- #define DFLT_ESC_SUPER 33 // 1/3 -#define DFLT_ESC_SUB -33 // auch 1/3 fr"uher 8/100 +#define DFLT_ESC_SUB -33 // also 1/3 previously 8/100 #define DFLT_ESC_PROP 58 #define DFLT_ESC_AUTO_SUPER 101 #define DFLT_ESC_AUTO_SUB -101 -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt die Schrift-Position. + This item describes the writing position. */ class EDITENG_DLLPUBLIC SvxEscapementItem : public SfxEnumItemInterface { short nEsc; - BYTE nProp; + sal_uInt8 nProp; public: TYPEINFO(); - SvxEscapementItem( const USHORT nId ); + SvxEscapementItem( const sal_uInt16 nId ); SvxEscapementItem( const SvxEscapement eEscape, - const USHORT nId ); - SvxEscapementItem( const short nEsc, const BYTE nProp, - const USHORT nId ); + const sal_uInt16 nId ); + SvxEscapementItem( const short nEsc, const sal_uInt8 nProp, + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; inline void SetEscapement( const SvxEscapement eNew ) { @@ -95,8 +95,8 @@ public: inline short &GetEsc() { return nEsc; } inline short GetEsc() const { return nEsc; } - inline BYTE &GetProp() { return nProp; } - inline BYTE GetProp() const { return nProp; } + inline sal_uInt8 &GetProp() { return nProp; } + inline sal_uInt8 GetProp() const { return nProp; } inline SvxEscapementItem& operator=(const SvxEscapementItem& rEsc) { @@ -105,10 +105,10 @@ public: return *this; } - virtual USHORT GetValueCount() const; - virtual String GetValueTextByPos( USHORT nPos ) const; - virtual USHORT GetEnumValue() const; - virtual void SetEnumValue( USHORT nNewVal ); + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetEnumValue() const; + virtual void SetEnumValue( sal_uInt16 nNewVal ); }; #endif diff --git a/editeng/inc/editeng/fhgtitem.hxx b/editeng/inc/editeng/fhgtitem.hxx index e4305a6ed1..cd847d4f4f 100644 --- a/editeng/inc/editeng/fhgtitem.hxx +++ b/editeng/inc/editeng/fhgtitem.hxx @@ -41,31 +41,31 @@ namespace rtl // class SvxFontHeightItem ----------------------------------------------- -// Achtung: Twips-Werte +// Warning: twips values -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt die Font-Hoehe. + This item describes the font height */ -#define FONTHEIGHT_16_VERSION ((USHORT)0x0001) -#define FONTHEIGHT_UNIT_VERSION ((USHORT)0x0002) +#define FONTHEIGHT_16_VERSION ((sal_uInt16)0x0001) +#define FONTHEIGHT_UNIT_VERSION ((sal_uInt16)0x0002) class EDITENG_DLLPUBLIC SvxFontHeightItem : public SfxPoolItem { - UINT32 nHeight; - USHORT nProp; // default 100% + sal_uInt32 nHeight; + sal_uInt16 nProp; // default 100% SfxMapUnit ePropUnit; // Percent, Twip, ... public: TYPEINFO(); - SvxFontHeightItem( const ULONG nSz /*= 240*/, const USHORT nPropHeight /*= 100*/, - const USHORT nId ); + SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/, + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -73,11 +73,11 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - virtual USHORT GetVersion( USHORT nItemVersion) const; - virtual bool ScaleMetrics( long nMult, long nDiv ); - virtual bool HasMetrics() const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nItemVersion) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize) { @@ -86,21 +86,21 @@ public: return *this; } - void SetHeight( UINT32 nNewHeight, const USHORT nNewProp = 100, + void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100, SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE ); - void SetHeight( UINT32 nNewHeight, USHORT nNewProp, + void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp, SfxMapUnit eUnit, SfxMapUnit eCoreUnit ); - UINT32 GetHeight() const { return nHeight; } + sal_uInt32 GetHeight() const { return nHeight; } - void SetHeightValue( UINT32 nNewHeight ) + void SetHeightValue( sal_uInt32 nNewHeight ) { DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); nHeight = nNewHeight; } - void SetProp( const USHORT nNewProp, + void SetProp( const sal_uInt16 nNewProp, SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE ) { DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); @@ -108,7 +108,7 @@ public: ePropUnit = eUnit; } - USHORT GetProp() const { return nProp; } + sal_uInt16 GetProp() const { return nProp; } SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ... }; diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx index 6a680b070b..4f5cacee09 100644 --- a/editeng/inc/editeng/flditem.hxx +++ b/editeng/inc/editeng/flditem.hxx @@ -58,7 +58,7 @@ public: }; /* -[Beschreibung] +[Description] In diesem Item wird ein Feld (SvxFieldData) gespeichert. Das Feld gehoert dem Item. Das Feld selbst wird durch eine Ableitung von SvxFieldData bestimmt. (RTTI) @@ -69,32 +69,32 @@ class EDITENG_DLLPUBLIC SvxFieldItem : public SfxPoolItem private: SvxFieldData* pField; - EDITENG_DLLPRIVATE SvxFieldItem( SvxFieldData* pField, const USHORT nId ); + EDITENG_DLLPRIVATE SvxFieldItem( SvxFieldData* pField, const sal_uInt16 nId ); public: TYPEINFO(); - SvxFieldItem( const SvxFieldData& rField, const USHORT nId ); + SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId ); SvxFieldItem( const SvxFieldItem& rItem ); ~SvxFieldItem(); virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nVer ) const; - virtual SvStream& Store( SvStream& , USHORT nItemVersion ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVer ) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; const SvxFieldData* GetField() const { return pField; } static SvClassManager& GetClassManager(); }; // ================================================================= -// Es folgen die Ableitungen von SvxFieldData... +// The following are the derivatives of SvxFieldData ... // ================================================================= #define SVX_DATEFIELD 2 #define SVX_URLFIELD 3 -#define SVX_PAGEFIELD 100 // Ex-Calc-Felder +#define SVX_PAGEFIELD 100 // Ex-Calc Fields #define SVX_PAGESFIELD 101 #define SVX_TIMEFIELD 102 #define SVX_FILEFIELD 103 @@ -106,19 +106,19 @@ public: #define SVX_FOOTERFIELD 109 #define SVX_DATEFIMEFIELD 110 -#define SVX_USERFIELD 200 // Ab hier eigene Felder, nicht im SVX +#define SVX_USERFIELD 200 // From here on own fields, not in the SVX enum SvxDateType { SVXDATETYPE_FIX, SVXDATETYPE_VAR }; -enum SvxDateFormat { SVXDATEFORMAT_APPDEFAULT, // Wie in App eingestellt - SVXDATEFORMAT_SYSTEM, // Wie im System eingestellt +enum SvxDateFormat { SVXDATEFORMAT_APPDEFAULT, // Set as in App + SVXDATEFORMAT_SYSTEM, // Set as in System SVXDATEFORMAT_STDSMALL, SVXDATEFORMAT_STDBIG, SVXDATEFORMAT_A, // 13.02.96 SVXDATEFORMAT_B, // 13.02.1996 SVXDATEFORMAT_C, // 13.Feb 1996 - SVXDATEFORMAT_D, // 13.Februar 1996 - SVXDATEFORMAT_E, // Die, 13.Februar 1996 - SVXDATEFORMAT_F // Dienstag, 13.Februar 1996 + SVXDATEFORMAT_D, // 13.February 1996 + SVXDATEFORMAT_E, // Tue, 13.February 1996 + SVXDATEFORMAT_F // Tuesday, 13.February 1996 }; class EDITENG_DLLPUBLIC SvxDateField : public SvxFieldData @@ -159,18 +159,18 @@ public: }; -enum SvxURLFormat { SVXURLFORMAT_APPDEFAULT, // Wie in App eingestellt - SVXURLFORMAT_URL, // URL darstellen - SVXURLFORMAT_REPR // Repraesentation darstellen +enum SvxURLFormat { SVXURLFORMAT_APPDEFAULT, // Set as in App + SVXURLFORMAT_URL, // Represent URL + SVXURLFORMAT_REPR // Constitute repraesentation }; class EDITENG_DLLPUBLIC SvxURLField : public SvxFieldData { private: SvxURLFormat eFormat; - XubString aURL; // URL-Adresse - XubString aRepresentation; // Was wird dargestellt - XubString aTargetFrame; // In welchem Frame + XubString aURL; // URL-Address + XubString aRepresentation; // What is shown + XubString aTargetFrame; // In what Frame public: SV_DECL_PERSIST1( SvxURLField, SvxFieldData, SVX_URLFIELD ) @@ -247,8 +247,8 @@ public: enum SvxTimeType { SVXTIMETYPE_FIX, SVXTIMETYPE_VAR }; -enum SvxTimeFormat { SVXTIMEFORMAT_APPDEFAULT, // Wie in App eingestellt - SVXTIMEFORMAT_SYSTEM, // Wie im System eingestellt +enum SvxTimeFormat { SVXTIMEFORMAT_APPDEFAULT, // Set as in App + SVXTIMEFORMAT_SYSTEM, // Set as in System SVXTIMEFORMAT_STANDARD, SVXTIMEFORMAT_24_HM, // 13:49 SVXTIMEFORMAT_24_HMS, // 13:49:38 @@ -300,10 +300,10 @@ public: enum SvxFileType { SVXFILETYPE_FIX, SVXFILETYPE_VAR }; -enum SvxFileFormat { SVXFILEFORMAT_NAME_EXT, // Dateiname mit Extension - SVXFILEFORMAT_FULLPATH, // vollst„ndiger Pfad - SVXFILEFORMAT_PATH, // nur Pfad - SVXFILEFORMAT_NAME // nur Dateiname +enum SvxFileFormat { SVXFILEFORMAT_NAME_EXT, // File name with Extension + SVXFILEFORMAT_FULLPATH, // full path + SVXFILEFORMAT_PATH, // only path + SVXFILEFORMAT_NAME // only file name }; @@ -339,10 +339,10 @@ public: enum SvxAuthorType { SVXAUTHORTYPE_FIX, SVXAUTHORTYPE_VAR }; -enum SvxAuthorFormat { SVXAUTHORFORMAT_FULLNAME, // vollst„ndiger Name - SVXAUTHORFORMAT_NAME, // nur Nachname - SVXAUTHORFORMAT_FIRSTNAME, // nur Vorname - SVXAUTHORFORMAT_SHORTNAME // Initialen +enum SvxAuthorFormat { SVXAUTHORFORMAT_FULLNAME, // full name + SVXAUTHORFORMAT_NAME, // Only Last name + SVXAUTHORFORMAT_FIRSTNAME, // Only first name + SVXAUTHORFORMAT_SHORTNAME // Initials }; class EDITENG_DLLPUBLIC SvxAuthorField : public SvxFieldData diff --git a/editeng/inc/editeng/flstitem.hxx b/editeng/inc/editeng/flstitem.hxx index b2d35dd040..82b268d537 100644 --- a/editeng/inc/editeng/flstitem.hxx +++ b/editeng/inc/editeng/flstitem.hxx @@ -40,10 +40,10 @@ class FontList; /* - [Beschreibung] + [Description] - Dieses Item dient als Transport-Medium fuer eine FontListe. - Die Fontliste wird nicht kopiert und nicht geloescht! + This item serves as a transport medium for a font list. The font list is + not copied and not deleted! */ class EDITENG_DLLPUBLIC SvxFontListItem : public SfxPoolItem @@ -56,13 +56,13 @@ public: TYPEINFO(); SvxFontListItem( const FontList* pFontLst, - const USHORT nId ); + const sal_uInt16 nId ); SvxFontListItem( const SvxFontListItem& rItem ); virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/fontitem.hxx b/editeng/inc/editeng/fontitem.hxx index c0ac85b1da..95b4b8e5ec 100644 --- a/editeng/inc/editeng/fontitem.hxx +++ b/editeng/inc/editeng/fontitem.hxx @@ -43,9 +43,9 @@ namespace rtl // class SvxFontItem ----------------------------------------------------- -/* - [Beschreibung] - Dieses Item beschreibt einen Font. +/* [Description] + + This item describes a Font. */ class EDITENG_DLLPUBLIC SvxFontItem : public SfxPoolItem @@ -56,58 +56,51 @@ class EDITENG_DLLPUBLIC SvxFontItem : public SfxPoolItem FontPitch ePitch; rtl_TextEncoding eTextEncoding; - static BOOL bEnableStoreUnicodeNames; + static sal_Bool bEnableStoreUnicodeNames; public: TYPEINFO(); - SvxFontItem( const USHORT nId ); + SvxFontItem( const sal_uInt16 nId ); SvxFontItem( const FontFamily eFam, const String& rFamilyName, const String& rStyleName, const FontPitch eFontPitch /*= PITCH_DONTKNOW*/, const rtl_TextEncoding eFontTextEncoding /*= RTL_TEXTENCODING_DONTKNOW*/, - const USHORT nId ); + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - // ZugriffsMethoden: - inline String &GetFamilyName() { return aFamilyName; } + // Access methods: + void SetFamilyName( const String& rFamilyName ) { aFamilyName = rFamilyName; } inline const String &GetFamilyName() const { return aFamilyName; } - inline String &GetStyleName() { return aStyleName; } + void SetStyleName(const String &rStyleName ) { aStyleName = rStyleName; } inline const String &GetStyleName() const { return aStyleName; } - inline FontFamily &GetFamily() { return eFamily; } + void SetFamily( FontFamily _eFamily ) { eFamily = _eFamily; } inline FontFamily GetFamily() const { return eFamily; } - inline FontPitch &GetPitch() { return ePitch; } + void SetPitch(FontPitch _ePitch ) { ePitch = _ePitch; } inline FontPitch GetPitch() const { return ePitch; } - inline rtl_TextEncoding &GetCharSet() { return eTextEncoding; } + void SetCharSet(rtl_TextEncoding _eEncoding) { eTextEncoding = _eEncoding; } + inline rtl_TextEncoding GetCharSet() const { return eTextEncoding; } - inline SvxFontItem& operator=(const SvxFontItem& rFont) - { - aFamilyName = rFont.GetFamilyName(); - aStyleName = rFont.GetStyleName(); - eFamily = rFont.GetFamily(); - ePitch = rFont.GetPitch(); - eTextEncoding = rFont.GetCharSet(); - return *this; - } - - static void EnableStoreUnicodeNames( BOOL bEnable ); + SvxFontItem& operator=(const SvxFontItem& rFont); + + static void EnableStoreUnicodeNames( sal_Bool bEnable ); }; diff --git a/editeng/inc/editeng/forbiddencharacterstable.hxx b/editeng/inc/editeng/forbiddencharacterstable.hxx index 477274f98b..e933033d99 100644 --- a/editeng/inc/editeng/forbiddencharacterstable.hxx +++ b/editeng/inc/editeng/forbiddencharacterstable.hxx @@ -46,7 +46,7 @@ namespace lang { struct ForbiddenCharactersInfo { com::sun::star::i18n::ForbiddenCharacters aForbiddenChars; - BOOL bTemporary; + sal_Bool bTemporary; }; DECLARE_TABLE( SvxForbiddenCharactersTableImpl, ForbiddenCharactersInfo* ) @@ -57,12 +57,12 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; public: - SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, USHORT nISize = 4, USHORT nGrow = 4 ); + SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, sal_uInt16 nISize = 4, sal_uInt16 nGrow = 4 ); ~SvxForbiddenCharactersTable(); - const com::sun::star::i18n::ForbiddenCharacters* GetForbiddenCharacters( USHORT nLanuage, BOOL bGetDefault ) const; - void SetForbiddenCharacters( USHORT nLanuage , const com::sun::star::i18n::ForbiddenCharacters& ); - void ClearForbiddenCharacters( USHORT nLanuage ); + const com::sun::star::i18n::ForbiddenCharacters* GetForbiddenCharacters( sal_uInt16 nLanuage, sal_Bool bGetDefault ) const; + void SetForbiddenCharacters( sal_uInt16 nLanuage , const com::sun::star::i18n::ForbiddenCharacters& ); + void ClearForbiddenCharacters( sal_uInt16 nLanuage ); }; #endif // _FORBIDDENCHARACTERSTABLE_HXX diff --git a/editeng/inc/editeng/forbiddenruleitem.hxx b/editeng/inc/editeng/forbiddenruleitem.hxx index f1fb7fd37b..53a9137cf9 100644 --- a/editeng/inc/editeng/forbiddenruleitem.hxx +++ b/editeng/inc/editeng/forbiddenruleitem.hxx @@ -49,8 +49,8 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/frmdiritem.hxx b/editeng/inc/editeng/frmdiritem.hxx index 1420ee4b6a..b9cf24747f 100644 --- a/editeng/inc/editeng/frmdiritem.hxx +++ b/editeng/inc/editeng/frmdiritem.hxx @@ -48,15 +48,15 @@ class EDITENG_DLLPUBLIC SvxFrameDirectionItem : public SfxUInt16Item public: TYPEINFO(); - SvxFrameDirectionItem( USHORT nWhich ); + SvxFrameDirectionItem( sal_uInt16 nWhich ); SvxFrameDirectionItem( SvxFrameDirection nValue /*= FRMDIR_HORI_LEFT_TOP*/, - USHORT nWhich ); + sal_uInt16 nWhich ); virtual ~SvxFrameDirectionItem(); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream & rStrm, USHORT nIVer) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual int operator==( const SfxPoolItem& ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, @@ -65,10 +65,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ); - virtual bool QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); inline SvxFrameDirectionItem& operator=( const SvxFrameDirectionItem& rItem ) { diff --git a/editeng/inc/editeng/fwdtitem.hxx b/editeng/inc/editeng/fwdtitem.hxx index cbf4a7071a..9fbdf7dee0 100644 --- a/editeng/inc/editeng/fwdtitem.hxx +++ b/editeng/inc/editeng/fwdtitem.hxx @@ -37,26 +37,26 @@ // class SvxFontWidthItem ----------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt die Font-Breite. + This item describes the font width. */ class SvxFontWidthItem : public SfxPoolItem { - UINT16 nWidth; // 0 = default - USHORT nProp; // default 100% + sal_uInt16 nWidth; // 0 = default + sal_uInt16 nProp; // default 100% public: TYPEINFO(); - SvxFontWidthItem( const USHORT nSz /*= 0*/, - const USHORT nPropWidth /*= 100*/, - const USHORT nId ); + SvxFontWidthItem( const sal_uInt16 nSz /*= 0*/, + const sal_uInt16 nPropWidth /*= 100*/, + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -64,10 +64,10 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - virtual bool ScaleMetrics( long nMult, long nDiv ); - virtual bool HasMetrics() const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; inline SvxFontWidthItem& operator=(const SvxFontWidthItem& rItem ) { @@ -76,28 +76,28 @@ public: return *this; } - void SetWidth( UINT16 nNewWidth, const USHORT nNewProp = 100 ) + void SetWidth( sal_uInt16 nNewWidth, const sal_uInt16 nNewProp = 100 ) { DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); - nWidth = UINT16(( (UINT32)nNewWidth * nNewProp ) / 100 ); + nWidth = sal_uInt16(( (sal_uInt32)nNewWidth * nNewProp ) / 100 ); nProp = nNewProp; } - UINT16 GetWidth() const { return nWidth; } + sal_uInt16 GetWidth() const { return nWidth; } - void SetWidthValue( UINT16 nNewWidth ) + void SetWidthValue( sal_uInt16 nNewWidth ) { DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); nWidth = nNewWidth; } - void SetProp( const USHORT nNewProp ) + void SetProp( const sal_uInt16 nNewProp ) { DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); nProp = nNewProp; } - USHORT GetProp() const { return nProp; } + sal_uInt16 GetProp() const { return nProp; } }; diff --git a/editeng/inc/editeng/hngpnctitem.hxx b/editeng/inc/editeng/hngpnctitem.hxx index 4dcafd2845..a6a12c9611 100644 --- a/editeng/inc/editeng/hngpnctitem.hxx +++ b/editeng/inc/editeng/hngpnctitem.hxx @@ -49,8 +49,8 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/hyznitem.hxx b/editeng/inc/editeng/hyznitem.hxx index f586b1818e..19f62c48bc 100644 --- a/editeng/inc/editeng/hyznitem.hxx +++ b/editeng/inc/editeng/hyznitem.hxx @@ -41,32 +41,32 @@ namespace rtl // class SvxHyphenZoneItem ----------------------------------------------- -/* -[Beschreibung] -Dieses Item beschreibt ein Silbentrennungsattribut (Automatisch?, Anzahl der -Zeichen am Zeilenende und -anfang). +/* [Description] + + This item describes a hyphenation attribute (automatic?, number of + characters at the end of the line and start). */ class EDITENG_DLLPUBLIC SvxHyphenZoneItem : public SfxPoolItem { - BOOL bHyphen: 1; - BOOL bPageEnd: 1; - BYTE nMinLead; - BYTE nMinTrail; - BYTE nMaxHyphens; + sal_Bool bHyphen: 1; + sal_Bool bPageEnd: 1; + sal_uInt8 nMinLead; + sal_uInt8 nMinTrail; + sal_uInt8 nMaxHyphens; friend SvStream & operator<<( SvStream & aS, SvxHyphenZoneItem & ); public: TYPEINFO(); - SvxHyphenZoneItem( const BOOL bHyph /*= FALSE*/, - const USHORT nId ); + SvxHyphenZoneItem( const sal_Bool bHyph /*= sal_False*/, + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -74,23 +74,23 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; - inline void SetHyphen( const BOOL bNew ) { bHyphen = bNew; } - inline BOOL IsHyphen() const { return bHyphen; } + inline void SetHyphen( const sal_Bool bNew ) { bHyphen = bNew; } + inline sal_Bool IsHyphen() const { return bHyphen; } - inline void SetPageEnd( const BOOL bNew ) { bPageEnd = bNew; } - inline BOOL IsPageEnd() const { return bPageEnd; } + inline void SetPageEnd( const sal_Bool bNew ) { bPageEnd = bNew; } + inline sal_Bool IsPageEnd() const { return bPageEnd; } - inline BYTE &GetMinLead() { return nMinLead; } - inline BYTE GetMinLead() const { return nMinLead; } + inline sal_uInt8 &GetMinLead() { return nMinLead; } + inline sal_uInt8 GetMinLead() const { return nMinLead; } - inline BYTE &GetMinTrail() { return nMinTrail; } - inline BYTE GetMinTrail() const { return nMinTrail; } + inline sal_uInt8 &GetMinTrail() { return nMinTrail; } + inline sal_uInt8 GetMinTrail() const { return nMinTrail; } - inline BYTE &GetMaxHyphens() { return nMaxHyphens; } - inline BYTE GetMaxHyphens() const { return nMaxHyphens; } + inline sal_uInt8 &GetMaxHyphens() { return nMaxHyphens; } + inline sal_uInt8 GetMaxHyphens() const { return nMaxHyphens; } inline SvxHyphenZoneItem &operator=( const SvxHyphenZoneItem &rNew ) { diff --git a/editeng/inc/editeng/itemtype.hxx b/editeng/inc/editeng/itemtype.hxx index 8dd7edb220..77c5f41db3 100644 --- a/editeng/inc/editeng/itemtype.hxx +++ b/editeng/inc/editeng/itemtype.hxx @@ -49,14 +49,14 @@ class IntlWrapper; static const sal_Unicode cDelim = ','; static const sal_Unicode cpDelim[] = { ',' , ' ', '\0' }; -EDITENG_DLLPUBLIC String GetSvxString( USHORT nId ); +EDITENG_DLLPUBLIC String GetSvxString( sal_uInt16 nId ); EDITENG_DLLPUBLIC String GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, const IntlWrapper * pIntl ); String GetColorString( const Color& rCol ); -EDITENG_DLLPUBLIC USHORT GetMetricId( SfxMapUnit eUnit ); +EDITENG_DLLPUBLIC sal_uInt16 GetMetricId( SfxMapUnit eUnit ); // ----------------------------------------------------------------------- -inline String GetBoolString( BOOL bVal ) +inline String GetBoolString( sal_Bool bVal ) { return String( EditResId( bVal ? RID_SVXITEMS_TRUE : RID_SVXITEMS_FALSE ) ); } diff --git a/editeng/inc/editeng/justifyitem.hxx b/editeng/inc/editeng/justifyitem.hxx index d6046073b1..67f8dc2e0e 100644 --- a/editeng/inc/editeng/justifyitem.hxx +++ b/editeng/inc/editeng/justifyitem.hxx @@ -39,24 +39,24 @@ class EDITENG_DLLPUBLIC SvxHorJustifyItem: public SfxEnumItem public: TYPEINFO(); - SvxHorJustifyItem( const USHORT nId ); + SvxHorJustifyItem( const sal_uInt16 nId ); SvxHorJustifyItem( const SvxCellHorJustify eJustify /*= SVX_HOR_JUSTIFY_STANDARD*/, - const USHORT nId ); + const sal_uInt16 nId ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); - virtual USHORT GetValueCount() const; - virtual String GetValueText( USHORT nVal ) const; + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueText( sal_uInt16 nVal ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream& rStream, USHORT nVer ) const; + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; inline SvxHorJustifyItem& operator=(const SvxHorJustifyItem& rHorJustify) { @@ -72,24 +72,24 @@ class EDITENG_DLLPUBLIC SvxVerJustifyItem: public SfxEnumItem public: TYPEINFO(); - SvxVerJustifyItem( const USHORT nId ); + SvxVerJustifyItem( const sal_uInt16 nId ); SvxVerJustifyItem( const SvxCellVerJustify eJustify /*= SVX_VER_JUSTIFY_STANDARD*/, - const USHORT nId ); + const sal_uInt16 nId ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); - virtual USHORT GetValueCount() const; - virtual String GetValueText( USHORT nVal ) const; + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueText( sal_uInt16 nVal ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream& rStream, USHORT nVer ) const; + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; inline SvxVerJustifyItem& operator=(const SvxVerJustifyItem& rVerJustify) { @@ -103,24 +103,24 @@ public: class EDITENG_DLLPUBLIC SvxJustifyMethodItem: public SfxEnumItem { public: - SvxJustifyMethodItem( const USHORT nId ); + SvxJustifyMethodItem( const sal_uInt16 nId ); SvxJustifyMethodItem( const SvxCellJustifyMethod eMethod, - const USHORT nId ); + const sal_uInt16 nId ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); - virtual USHORT GetValueCount() const; - virtual String GetValueText( USHORT nVal ) const; + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueText( sal_uInt16 nVal ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream& rStream, USHORT nVer ) const; + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; SvxJustifyMethodItem& operator=(const SvxJustifyMethodItem& r); }; diff --git a/editeng/inc/editeng/keepitem.hxx b/editeng/inc/editeng/keepitem.hxx index b98aff4dfc..8c986fb7ae 100644 --- a/editeng/inc/editeng/keepitem.hxx +++ b/editeng/inc/editeng/keepitem.hxx @@ -40,9 +40,9 @@ namespace rtl // class SvxFmtKeepItem ------------------------------------------------ -/* -[Beschreibung] -Dieses Item beschreibt eine logische Variable "Absaetze zusammenhalten?". +/* [Description] + + This item describes a logical variable "keep paragraphs together?". */ class EDITENG_DLLPUBLIC SvxFmtKeepItem : public SfxBoolItem @@ -50,14 +50,14 @@ class EDITENG_DLLPUBLIC SvxFmtKeepItem : public SfxBoolItem public: TYPEINFO(); - inline SvxFmtKeepItem( const BOOL bKeep /*= FALSE*/, - const USHORT _nWhich ); + inline SvxFmtKeepItem( const sal_Bool bKeep /*= sal_False*/, + const sal_uInt16 _nWhich ); inline SvxFmtKeepItem& operator=( const SvxFmtKeepItem& rSplit ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT ) const; - virtual SvStream& Store( SvStream& , USHORT nItemVersion ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -65,7 +65,7 @@ public: String &rText, const IntlWrapper * = 0 ) const; }; -inline SvxFmtKeepItem::SvxFmtKeepItem( const BOOL bKeep, const USHORT _nWhich ) : +inline SvxFmtKeepItem::SvxFmtKeepItem( const sal_Bool bKeep, const sal_uInt16 _nWhich ) : SfxBoolItem( _nWhich, bKeep ) {} diff --git a/editeng/inc/editeng/kernitem.hxx b/editeng/inc/editeng/kernitem.hxx index d6463784f6..0a69842998 100644 --- a/editeng/inc/editeng/kernitem.hxx +++ b/editeng/inc/editeng/kernitem.hxx @@ -41,12 +41,12 @@ namespace rtl // class SvxKerningItem -------------------------------------------------- -// Achtung: Twips-Werte -// Twips: 0 = kein Kerning +// Note: Twips value +// Twips: 0 = no kerning -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt die Schrift-Laufweite. + This item describes the kerning. */ class EDITENG_DLLPUBLIC SvxKerningItem : public SfxInt16Item @@ -54,14 +54,14 @@ class EDITENG_DLLPUBLIC SvxKerningItem : public SfxInt16Item public: TYPEINFO(); - SvxKerningItem( const short nKern /*= 0*/, const USHORT nId ); + SvxKerningItem( const short nKern /*= 0*/, const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - virtual bool ScaleMetrics( long nMult, long nDiv ); - virtual bool HasMetrics() const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -73,8 +73,8 @@ public: return *this; } - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); }; #endif diff --git a/editeng/inc/editeng/langitem.hxx b/editeng/inc/editeng/langitem.hxx index 4d4ddf272a..f01a7733fa 100644 --- a/editeng/inc/editeng/langitem.hxx +++ b/editeng/inc/editeng/langitem.hxx @@ -42,9 +42,9 @@ namespace rtl // class SvxLanguageItem ------------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt eine Sprache. + This item describes a Language. */ class EDITENG_DLLPUBLIC SvxLanguageItem : public SfxEnumItem @@ -53,18 +53,18 @@ public: TYPEINFO(); SvxLanguageItem( const LanguageType eLang /*= LANGUAGE_GERMAN*/, - const USHORT nId ); + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - virtual USHORT GetValueCount() const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual sal_uInt16 GetValueCount() const; inline SvxLanguageItem& operator=(const SvxLanguageItem& rLang) { @@ -76,9 +76,9 @@ public: LanguageType GetLanguage() const { return (LanguageType)GetValue(); } void SetLanguage( const LanguageType eLang ) - { SetValue( (USHORT)eLang ); } - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + { SetValue( (sal_uInt16)eLang ); } + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); }; #endif diff --git a/editeng/inc/editeng/lcolitem.hxx b/editeng/inc/editeng/lcolitem.hxx index 00b116f1f0..0108f35808 100644 --- a/editeng/inc/editeng/lcolitem.hxx +++ b/editeng/inc/editeng/lcolitem.hxx @@ -34,7 +34,7 @@ #include <editeng/editengdllapi.h> /* - * dummy-Item fuer ToolBox-Controller: + * Dummy item for ToolBox controller: * */ @@ -43,9 +43,9 @@ class EDITENG_DLLPUBLIC SvxLineColorItem : public SvxColorItem public: TYPEINFO(); - SvxLineColorItem( const USHORT nId ); - SvxLineColorItem( const Color& aColor, const USHORT nId ); - SvxLineColorItem( SvStream& rStrm, const USHORT nId ); + SvxLineColorItem( const sal_uInt16 nId ); + SvxLineColorItem( const Color& aColor, const sal_uInt16 nId ); + SvxLineColorItem( SvStream& rStrm, const sal_uInt16 nId ); SvxLineColorItem( const SvxLineColorItem& rCopy ); ~SvxLineColorItem(); diff --git a/editeng/inc/editeng/lrspitem.hxx b/editeng/inc/editeng/lrspitem.hxx index d0e03995a7..68a9fa5ba9 100644 --- a/editeng/inc/editeng/lrspitem.hxx +++ b/editeng/inc/editeng/lrspitem.hxx @@ -40,56 +40,55 @@ namespace rtl // class SvxLRSpaceItem -------------------------------------------------- -/* -[Beschreibung] -Linker/Rechter Rand sowie Erstzeileneinzug - -SvxLRSpaceItem bietet zwei Schnittstellen zur Befragung des linken -Randes und des Erstzeileneinzuges an. Die Get-Methoden liefern -die Member zurueck, wie sie das Layout bisher auch erwartete: -Der linke Rand verschiebt sich beim negativem Erstzeileneinzug -nach links. Die SetTxt/GetTxt-Methoden setzen voraus, dass der -linke Rand der 0-Punkt des Erstzeileneinzugs darstellt: - - UI UI LAYOUT UI/TEXT UI/TEXT (Wo?) -SetTxtLeft SetTxtFirst GetLeft GetTxtLeft GetTxtFirst (Was?) - 500 -500 0 500 -500 (Wieviel?) +/* [Description] + + Left/Right margin and first line indent + + SvxLRSpaceItem offers two interfaces for views from the left margin and + first line indent. The get methods return the member, with the layout also + as expected: the left edge shifts to the negative first line indent to the + left. The SetTxt/Gettxt methods assume that the left side represents the + 0 coordinate for the first line indent: + + UI UI LAYOUT UI/TEXT UI/TEXT (Where?) + SetTxtLeft SetTxtFirst GetLeft GetTxtLeft GetTxtFirst (What?) + 500 -500 0 500 -500 (How much?) 500 0 500 500 0 500 +500 500 500 +500 700 -500 200 700 -500 */ -#define LRSPACE_16_VERSION ((USHORT)0x0001) -#define LRSPACE_TXTLEFT_VERSION ((USHORT)0x0002) -#define LRSPACE_AUTOFIRST_VERSION ((USHORT)0x0003) -#define LRSPACE_NEGATIVE_VERSION ((USHORT)0x0004) +#define LRSPACE_16_VERSION ((sal_uInt16)0x0001) +#define LRSPACE_TXTLEFT_VERSION ((sal_uInt16)0x0002) +#define LRSPACE_AUTOFIRST_VERSION ((sal_uInt16)0x0003) +#define LRSPACE_NEGATIVE_VERSION ((sal_uInt16)0x0004) class EDITENG_DLLPUBLIC SvxLRSpaceItem : public SfxPoolItem { - short nFirstLineOfst; // Erstzeileneinzug _immer_ relativ zu nTxtLeft - long nTxtLeft; // wir spendieren einen USHORT - long nLeftMargin; // nLeft oder der neg. Erstzeileneinzug - long nRightMargin; // der unproblematische rechte Rand + short nFirstLineOfst; // First-line indent _always_ relative to nTxtLeft + long nTxtLeft; // We spend a sal_uInt16 + long nLeftMargin; // nLeft or the negative first-line indent + long nRightMargin; // The unproblematic right edge - USHORT nPropFirstLineOfst, nPropLeftMargin, nPropRightMargin; - BOOL bAutoFirst : 1; // Automatische Berechnung der Erstzeileneinzugs + sal_uInt16 nPropFirstLineOfst, nPropLeftMargin, nPropRightMargin; + sal_Bool bAutoFirst : 1; // Automatic calculation of the first line indent - void AdjustLeft(); // nLeftMargin und nTxtLeft werden angepasst. + void AdjustLeft(); // nLeftMargin and nTxtLeft are being adjusted. public: TYPEINFO(); - SvxLRSpaceItem( const USHORT nId ); + SvxLRSpaceItem( const sal_uInt16 nId ); SvxLRSpaceItem( const long nLeft, const long nRight, const long nTLeft /*= 0*/, const short nOfset /*= 0*/, - const USHORT nId ); + const sal_uInt16 nId ); inline SvxLRSpaceItem& operator=( const SvxLRSpaceItem &rCpy ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -97,41 +96,41 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; - virtual bool ScaleMetrics( long nMult, long nDiv ); - virtual bool HasMetrics() const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; // Die "Layout-Schnittstelle": - inline void SetLeft ( const long nL, const USHORT nProp = 100 ); - inline void SetRight( const long nR, const USHORT nProp = 100 ); + inline void SetLeft ( const long nL, const sal_uInt16 nProp = 100 ); + inline void SetRight( const long nR, const sal_uInt16 nProp = 100 ); - // abfragen / direktes setzen der absoluten Werte + // Query/direct setting of the absolute values inline long GetLeft() const { return nLeftMargin; } inline long GetRight() const { return nRightMargin;} inline void SetLeftValue( const long nL ) { nTxtLeft = nLeftMargin = nL; } inline void SetRightValue( const long nR ) { nRightMargin = nR; } - inline BOOL IsAutoFirst() const { return bAutoFirst; } - inline void SetAutoFirst( const BOOL bNew ) { bAutoFirst = bNew; } + inline sal_Bool IsAutoFirst() const { return bAutoFirst; } + inline void SetAutoFirst( const sal_Bool bNew ) { bAutoFirst = bNew; } - // abfragen / setzen der Prozent-Werte - inline void SetPropLeft( const USHORT nProp = 100 ) + // Query/Setting the percentage values + inline void SetPropLeft( const sal_uInt16 nProp = 100 ) { nPropLeftMargin = nProp; } - inline void SetPropRight( const USHORT nProp = 100 ) + inline void SetPropRight( const sal_uInt16 nProp = 100 ) { nPropRightMargin = nProp;} - inline USHORT GetPropLeft() const { return nPropLeftMargin; } - inline USHORT GetPropRight() const { return nPropRightMargin;} + inline sal_uInt16 GetPropLeft() const { return nPropLeftMargin; } + inline sal_uInt16 GetPropRight() const { return nPropRightMargin;} - // Die "UI/Text-Schnittstelle": - inline void SetTxtLeft( const long nL, const USHORT nProp = 100 ); + // The UI/text interface: + inline void SetTxtLeft( const long nL, const sal_uInt16 nProp = 100 ); inline long GetTxtLeft() const { return nTxtLeft; } - inline void SetTxtFirstLineOfst( const short nF, const USHORT nProp = 100 ); + inline void SetTxtFirstLineOfst( const short nF, const sal_uInt16 nProp = 100 ); inline short GetTxtFirstLineOfst() const { return nFirstLineOfst; } - inline void SetPropTxtFirstLineOfst( const USHORT nProp = 100 ) + inline void SetPropTxtFirstLineOfst( const sal_uInt16 nProp = 100 ) { nPropFirstLineOfst = nProp; } - inline USHORT GetPropTxtFirstLineOfst() const + inline sal_uInt16 GetPropTxtFirstLineOfst() const { return nPropFirstLineOfst; } inline void SetTxtFirstLineOfstValue( const short nValue ) { nFirstLineOfst = nValue; } @@ -150,26 +149,26 @@ inline SvxLRSpaceItem &SvxLRSpaceItem::operator=( const SvxLRSpaceItem &rCpy ) return *this; } -inline void SvxLRSpaceItem::SetLeft( const long nL, const USHORT nProp ) +inline void SvxLRSpaceItem::SetLeft( const long nL, const sal_uInt16 nProp ) { nLeftMargin = (nL * nProp) / 100; nTxtLeft = nLeftMargin; nPropLeftMargin = nProp; } -inline void SvxLRSpaceItem::SetRight( const long nR, const USHORT nProp ) +inline void SvxLRSpaceItem::SetRight( const long nR, const sal_uInt16 nProp ) { nRightMargin = (nR * nProp) / 100; nPropRightMargin = nProp; } inline void SvxLRSpaceItem::SetTxtFirstLineOfst( const short nF, - const USHORT nProp ) + const sal_uInt16 nProp ) { nFirstLineOfst = short((long(nF) * nProp ) / 100); nPropFirstLineOfst = nProp; AdjustLeft(); } -inline void SvxLRSpaceItem::SetTxtLeft( const long nL, const USHORT nProp ) +inline void SvxLRSpaceItem::SetTxtLeft( const long nL, const sal_uInt16 nProp ) { nTxtLeft = (nL * nProp) / 100; nPropLeftMargin = nProp; diff --git a/editeng/inc/editeng/lspcitem.hxx b/editeng/inc/editeng/lspcitem.hxx index edc631f646..bd60901d3f 100644 --- a/editeng/inc/editeng/lspcitem.hxx +++ b/editeng/inc/editeng/lspcitem.hxx @@ -42,9 +42,8 @@ namespace rtl // class SvxLineSpacingItem ---------------------------------------------- -/* -[Beschreibung] -Dieses Item beschreibt den Abstand zwischen den Zeilen. +/* [Description] + This item describes the distance between the lines. */ #define LINE_SPACE_DEFAULT_HEIGHT 200 @@ -53,26 +52,25 @@ class EDITENG_DLLPUBLIC SvxLineSpacingItem : public SfxEnumItemInterface friend SvStream& operator<<( SvStream&, SvxLineSpacingItem& ); //$ ostream short nInterLineSpace; - USHORT nLineHeight; - BYTE nPropLineSpace; + sal_uInt16 nLineHeight; + sal_uInt8 nPropLineSpace; SvxLineSpace eLineSpace; SvxInterLineSpace eInterLineSpace; public: TYPEINFO(); - // Der Writer verlaesst sich auf eine Default-Hoehe von 200! - // Eigentlich wuerde ich alle Werte mit 0 initialisieren, aber wer kann - // die Folgen beim Writer absehen ? - // => lieber einen krummen Wert als Default, aber der Programmierer - // sieht, dass dort etwas besonderes passiert. + // The writer relies on a default height of 200! Actually, I would + // initialize all values to 0, but who can ignore the consequences in + // writer? => Rather have a crooked vales as the default, but the + // programmer sees that there's something special happening. - SvxLineSpacingItem( USHORT nHeight /*= LINE_SPACE_DEFAULT_HEIGHT*/, const USHORT nId ); + SvxLineSpacingItem( sal_uInt16 nHeight /*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -80,11 +78,10 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; - // Methoden zum Abfragen und Aendern - // Interlinespace wird zur Hoehe addiert. + // Methods to query and edit. InterlineSpace is added to the height. inline short GetInterLineSpace() const { return nInterLineSpace; } inline void SetInterLineSpace( const short nSpace ) { @@ -92,17 +89,17 @@ public: eInterLineSpace = SVX_INTER_LINE_SPACE_FIX; } - // Bestimmt absolute oder minimale Zeilenhoehe. - inline USHORT GetLineHeight() const { return nLineHeight; } - inline void SetLineHeight( const USHORT nHeight ) + // Determines the absolute or minimum row height. + inline sal_uInt16 GetLineHeight() const { return nLineHeight; } + inline void SetLineHeight( const sal_uInt16 nHeight ) { nLineHeight = nHeight; eLineSpace = SVX_LINE_SPACE_MIN; } - // Vergroessert oder verkleinert die Zeilenhoehe. - BYTE GetPropLineSpace() const { return nPropLineSpace; } - inline void SetPropLineSpace( const BYTE nProp ) + // To increase or decrease the row height. + sal_uInt8 GetPropLineSpace() const { return nPropLineSpace; } + inline void SetPropLineSpace( const sal_uInt8 nProp ) { nPropLineSpace = nProp; eInterLineSpace = SVX_INTER_LINE_SPACE_PROP; @@ -114,10 +111,10 @@ public: inline SvxInterLineSpace &GetInterLineSpaceRule() { return eInterLineSpace; } inline SvxInterLineSpace GetInterLineSpaceRule() const { return eInterLineSpace; } - virtual USHORT GetValueCount() const; - virtual String GetValueTextByPos( USHORT nPos ) const; - virtual USHORT GetEnumValue() const; - virtual void SetEnumValue( USHORT nNewVal ); + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetEnumValue() const; + virtual void SetEnumValue( sal_uInt16 nNewVal ); }; #endif diff --git a/editeng/inc/editeng/measfld.hxx b/editeng/inc/editeng/measfld.hxx index 174f8388f4..904d8bdf03 100644 --- a/editeng/inc/editeng/measfld.hxx +++ b/editeng/inc/editeng/measfld.hxx @@ -33,8 +33,8 @@ #ifndef _FLDITEM_HXX #ifndef ITEMID_FIELD -#include <editeng/editdata.hxx> /* das include wird wg. EE_FEATURE_FIELD benoetigt */ -#define ITEMID_FIELD EE_FEATURE_FIELD /* wird fuer #include <editeng/flditem.hxx> benoetigt */ +#include <editeng/editdata.hxx> /* this include is needed due to EE_FEATURE_FIELD */ +#define ITEMID_FIELD EE_FEATURE_FIELD /* is needed for #include <editeng/flditem.hxx> */ #endif #include <editeng/flditem.hxx> #endif diff --git a/editeng/inc/editeng/memberids.hrc b/editeng/inc/editeng/memberids.hrc index 0a4ac48f1c..e3e57292f8 100644..100755 --- a/editeng/inc/editeng/memberids.hrc +++ b/editeng/inc/editeng/memberids.hrc @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unomid.hxx,v $ - * $Revision: 1.3.212.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/editeng/inc/editeng/nhypitem.hxx b/editeng/inc/editeng/nhypitem.hxx index 2ffcffccf1..291af342c4 100644 --- a/editeng/inc/editeng/nhypitem.hxx +++ b/editeng/inc/editeng/nhypitem.hxx @@ -34,24 +34,18 @@ #include <editeng/editengdllapi.h> // class SvxNoHyphenItem ------------------------------------------------- - -/* [Beschreibung] - - PB: ??? -*/ - class EDITENG_DLLPUBLIC SvxNoHyphenItem : public SfxBoolItem { public: TYPEINFO(); - SvxNoHyphenItem( const BOOL bHyphen /*= TRUE*/, - const USHORT nId ); + SvxNoHyphenItem( const sal_Bool bHyphen /*= sal_True*/, + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/nlbkitem.hxx b/editeng/inc/editeng/nlbkitem.hxx index f498cf500c..97508edbd3 100644 --- a/editeng/inc/editeng/nlbkitem.hxx +++ b/editeng/inc/editeng/nlbkitem.hxx @@ -35,25 +35,18 @@ #include "editeng/editengdllapi.h" // class SvxNoLinebreakItem ---------------------------------------------- - - -/* [Beschreibung] - - PB: ??? -*/ - class EDITENG_DLLPUBLIC SvxNoLinebreakItem : public SfxBoolItem { public: TYPEINFO(); - SvxNoLinebreakItem( const BOOL bBreak /*= TRUE*/, - const USHORT nId ); + SvxNoLinebreakItem( const sal_Bool bBreak /*= sal_True*/, + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/numdef.hxx b/editeng/inc/editeng/numdef.hxx index 4e5b901990..5d997c2891 100644 --- a/editeng/inc/editeng/numdef.hxx +++ b/editeng/inc/editeng/numdef.hxx @@ -26,7 +26,7 @@ * ************************************************************************/ -#define SVX_MAX_NUM 10 // max. moegliche Numerierungsebenen -#define SVX_DEF_BULLET (0xF000 + 149)// Charakter fuer Aufzaehlungen +#define SVX_MAX_NUM 10 // max. possible numbering level +#define SVX_DEF_BULLET (0xF000 + 149)// Character for lists /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/numitem.hxx b/editeng/inc/editeng/numitem.hxx index 3b694d0720..6ffa3c86ee 100644 --- a/editeng/inc/editeng/numitem.hxx +++ b/editeng/inc/editeng/numitem.hxx @@ -56,18 +56,18 @@ namespace com{namespace sun{ namespace star{ }}} // ----------------------------------------------------------------------- -//Feature-Flags (only USHORT!) -#define NUM_CONTINUOUS 0x0001 // fortlaufende Numerierung moeglich? -#define NUM_CHAR_TEXT_DISTANCE 0x0002 // Abstand Symbol<->Text? -#define NUM_CHAR_STYLE 0x0004 // Zeichenvorlagen? -#define NUM_BULLET_REL_SIZE 0x0008 // rel. Bulletgroesse? +//Feature-Flags (only sal_uInt16!) +#define NUM_CONTINUOUS 0x0001 // consecutive numbers possible? +#define NUM_CHAR_TEXT_DISTANCE 0x0002 // Distance Symbol<->Text? +#define NUM_CHAR_STYLE 0x0004 // Character styles? +#define NUM_BULLET_REL_SIZE 0x0008 // relative bullet size? #define NUM_BULLET_COLOR 0x0010 // Bullet color -#define NUM_SYMBOL_ALIGNMENT 0x0040 // alignment soll unter den Optionen angezeigt werden -#define NUM_NO_NUMBERS 0x0080 // Numberierungen sind nicht erlaubt +#define NUM_SYMBOL_ALIGNMENT 0x0040 // alignment to be shown in the options +#define NUM_NO_NUMBERS 0x0080 // Numbering are not allowed #define NUM_ENABLE_LINKED_BMP 0x0100 // linked bitmaps are available #define NUM_ENABLE_EMBEDDED_BMP 0x0200 // embedded bitmaps are available -#define SVX_NO_NUM 200 // Markierung fuer keine Numerierung +#define SVX_NO_NUM 200 // Marker for no numbering #define SVX_NO_NUMLEVEL 0x20 #define LINK_TOKEN 0x80 //indicate linked bitmaps - for use in dialog only @@ -77,15 +77,15 @@ class EDITENG_DLLPUBLIC SvxNumberType static com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter; sal_Int16 nNumType; - sal_Bool bShowSymbol; // Symbol auch anzeigen? + sal_Bool bShowSymbol; // Also show Symbol ? public: SvxNumberType(sal_Int16 nType = com::sun::star::style::NumberingType::ARABIC); SvxNumberType(const SvxNumberType& rType); ~SvxNumberType(); - String GetNumStr( ULONG nNo ) const; - String GetNumStr( ULONG nNo, const com::sun::star::lang::Locale& rLocale ) const; + String GetNumStr( sal_uLong nNo ) const; + String GetNumStr( sal_uLong nNo, const com::sun::star::lang::Locale& rLocale ) const; void SetNumberingType(sal_Int16 nSet) {nNumType = nSet;} sal_Int16 GetNumberingType() const {return nNumType;} @@ -122,12 +122,12 @@ private: SvxAdjust eNumAdjust; - BYTE nInclUpperLevels; //Nummern aus der vorigen Ebenen uebernehmen - USHORT nStart; //Start der Zaehlung + sal_uInt8 nInclUpperLevels; // Take over numbers from the previous level. + sal_uInt16 nStart; // Start of counting - sal_Unicode cBullet; //Symbol - USHORT nBulletRelSize; //proz. Groesse des Bullets - Color nBulletColor; //Bullet color + sal_Unicode cBullet; // Symbol + sal_uInt16 nBulletRelSize; // percentage size of bullets + Color nBulletColor; // Bullet color // mode indicating, if the position and spacing of the list label is // determined by the former attributes (nFirstLineOffset, nAbsLSpace, @@ -140,10 +140,10 @@ private: // LABEL_ALIGNMENT is active. SvxNumPositionAndSpaceMode mePositionAndSpaceMode; - short nFirstLineOffset; //Erstzeileneinzug - short nAbsLSpace; //Abstand Rand<->Nummer - short nLSpace; //relative Einrueckung zum Vorgaenger - short nCharTextDistance; //Abstand Nummer<->Text + short nFirstLineOffset; // First line indent + short nAbsLSpace; // Distance Border<->Number + short nLSpace; // relative to the previous indentation + short nCharTextDistance; // Distance Number<->Text // specifies what follows the list label before the text of the first line // of the list item starts @@ -155,13 +155,13 @@ private: // specifies the indent before the text, e.g. in L2R-layout the left margin long mnIndentAt; - SvxBrushItem* pGraphicBrush; // - sal_Int16 eVertOrient; // vert. Ausrichtung einer Bitmap + SvxBrushItem* pGraphicBrush; + sal_Int16 eVertOrient; // vertical alignment of a bitmap - Size aGraphicSize; // immer! in 1/100 mm - Font* pBulletFont; // Pointer auf den BulletFont + Size aGraphicSize; // Always! in 1/100 mm + Font* pBulletFont; // Pointer to the bullet font - String sCharStyleName; // Zeichenvorlage + String sCharStyleName; // Character Style BitmapEx* pScaledImageCache; // Image scaled to aGraphicSize, only cached for WINDOW/VDEV @@ -178,8 +178,8 @@ public: SvStream& Store(SvStream &rStream, FontToSubsFontConverter pConverter); SvxNumberFormat& operator=( const SvxNumberFormat& ); - BOOL operator==( const SvxNumberFormat& ) const; - BOOL operator!=( const SvxNumberFormat& rFmt) const {return !(*this == rFmt);} + sal_Bool operator==( const SvxNumberFormat& ) const; + sal_Bool operator!=( const SvxNumberFormat& rFmt) const {return !(*this == rFmt);} void SetNumAdjust(SvxAdjust eSet) {eNumAdjust = eSet;} SvxAdjust GetNumAdjust() const {return eNumAdjust;} @@ -195,15 +195,15 @@ public: const Font* GetBulletFont() const {return pBulletFont;} void SetBulletChar(sal_Unicode cSet){cBullet = cSet;} sal_Unicode GetBulletChar()const {return cBullet;} - void SetBulletRelSize(USHORT nSet) {nBulletRelSize = nSet;} - USHORT GetBulletRelSize() const { return nBulletRelSize;} + void SetBulletRelSize(sal_uInt16 nSet) {nBulletRelSize = nSet;} + sal_uInt16 GetBulletRelSize() const { return nBulletRelSize;} void SetBulletColor(Color nSet){nBulletColor = nSet;} Color GetBulletColor()const {return nBulletColor;} - void SetIncludeUpperLevels( BYTE nSet ) { nInclUpperLevels = nSet;} - BYTE GetIncludeUpperLevels()const { return nInclUpperLevels;} - void SetStart(USHORT nSet) {nStart = nSet;} - USHORT GetStart() const {return nStart;} + void SetIncludeUpperLevels( sal_uInt8 nSet ) { nInclUpperLevels = nSet;} + sal_uInt8 GetIncludeUpperLevels()const { return nInclUpperLevels;} + void SetStart(sal_uInt16 nSet) {nStart = nSet;} + sal_uInt16 GetStart() const {return nStart;} virtual void SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize = 0, const sal_Int16* pOrient = 0); const SvxBrushItem* GetBrush() const {return pGraphicBrush;} @@ -235,7 +235,7 @@ public: long GetIndentAt() const; static Size GetGraphicSizeMM100(const Graphic* pGraphic); - static String CreateRomanString( ULONG nNo, BOOL bUpper ); + static String CreateRomanString( sal_uLong nNo, sal_Bool bUpper ); }; enum SvxNumRuleType @@ -248,20 +248,20 @@ enum SvxNumRuleType class EDITENG_DLLPUBLIC SvxNumRule { - USHORT nLevelCount; // Anzahl der unterstuetzten Levels - ULONG nFeatureFlags; // was wird unterstuetzt? - SvxNumRuleType eNumberingType; // was fuer eine Numerierung - BOOL bContinuousNumbering; // fortlaufende Numerierung + sal_uInt16 nLevelCount; // Number of supported levels + sal_uInt32 nFeatureFlags; // What is supported? + SvxNumRuleType eNumberingType; // Type of numbering + sal_Bool bContinuousNumbering; // sequential numbering SvxNumberFormat* aFmts[SVX_MAX_NUM]; - BOOL aFmtsSet[SVX_MAX_NUM]; //Flags ueber Gueltigkeit der Ebenen + sal_Bool aFmtsSet[SVX_MAX_NUM]; // Flags indicating valid levels static sal_Int32 nRefCount; com::sun::star::lang::Locale aLocale; public: - SvxNumRule( ULONG nFeatures, - USHORT nLevels, - BOOL bCont, + SvxNumRule( sal_uLong nFeatures, + sal_uInt16 nLevels, + sal_Bool bCont, SvxNumRuleType eType = SVX_RULETYPE_NUMBERING, SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode @@ -277,81 +277,77 @@ public: SvStream& Store(SvStream &rStream); - const SvxNumberFormat* Get(USHORT nLevel)const; - const SvxNumberFormat& GetLevel(USHORT nLevel)const; - void SetLevel(USHORT nLevel, const SvxNumberFormat& rFmt, BOOL bIsValid = TRUE); - void SetLevel(USHORT nLevel, const SvxNumberFormat* pFmt); + const SvxNumberFormat* Get(sal_uInt16 nLevel)const; + const SvxNumberFormat& GetLevel(sal_uInt16 nLevel)const; + void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat& rFmt, sal_Bool bIsValid = sal_True); + void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt); - BOOL IsContinuousNumbering()const + sal_Bool IsContinuousNumbering()const {return bContinuousNumbering;} - void SetContinuousNumbering(BOOL bSet) + void SetContinuousNumbering(sal_Bool bSet) {bContinuousNumbering = bSet;} - USHORT GetLevelCount() const {return nLevelCount;} - BOOL IsFeatureSupported(ULONG nFeature) const + sal_uInt16 GetLevelCount() const {return nLevelCount;} + sal_Bool IsFeatureSupported(sal_uInt32 nFeature) const {return 0 != (nFeatureFlags & nFeature);} - ULONG GetFeatureFlags() const {return nFeatureFlags;} - void SetFeatureFlag( ULONG nFlag, BOOL bSet = TRUE ) { if(bSet) nFeatureFlags |= nFlag; else nFeatureFlags &= ~nFlag; } + sal_uInt32 GetFeatureFlags() const {return nFeatureFlags;} + void SetFeatureFlag( sal_uInt32 nFlag, sal_Bool bSet = sal_True ) { if(bSet) nFeatureFlags |= nFlag; else nFeatureFlags &= ~nFlag; } - String MakeNumString( const SvxNodeNum&, BOOL bInclStrings = TRUE ) const; + String MakeNumString( const SvxNodeNum&, sal_Bool bInclStrings = sal_True ) const; SvxNumRuleType GetNumRuleType() const { return eNumberingType; } void SetNumRuleType( const SvxNumRuleType& rType ) { eNumberingType = rType; } - BOOL UnLinkGraphics(); + sal_Bool UnLinkGraphics(); }; -/* -----------------27.10.98 13:04------------------- - * - * --------------------------------------------------*/ + class EDITENG_DLLPUBLIC SvxNumBulletItem : public SfxPoolItem { SvxNumRule* pNumRule; public: SvxNumBulletItem(SvxNumRule& rRule); - SvxNumBulletItem(SvxNumRule& rRule, USHORT nWhich ); + SvxNumBulletItem(SvxNumRule& rRule, sal_uInt16 nWhich ); SvxNumBulletItem(const SvxNumBulletItem& rCopy); virtual ~SvxNumBulletItem(); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - USHORT GetVersion( USHORT nFileVersion ) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; virtual int operator==( const SfxPoolItem& ) const; SvxNumRule* GetNumRule() const {return pNumRule;} - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); }; -/* -----------------28.10.98 15:21------------------- - * - * --------------------------------------------------*/ + class SvxNodeNum { - USHORT nLevelVal[ SVX_MAX_NUM ]; // Nummern aller Levels - USHORT nSetValue; // vorgegebene Nummer - BYTE nMyLevel; // akt. Level - BOOL bStartNum; // Numerierung neu starten + sal_uInt16 nLevelVal[ SVX_MAX_NUM ]; // Numbers of all levels + sal_uInt16 nSetValue; // predetermined number + sal_uInt8 nMyLevel; // Current Level + sal_Bool bStartNum; // Restart numbering public: - inline SvxNodeNum( BYTE nLevel = SVX_NO_NUM, USHORT nSetVal = USHRT_MAX ); + inline SvxNodeNum( sal_uInt8 nLevel = SVX_NO_NUM, sal_uInt16 nSetVal = USHRT_MAX ); inline SvxNodeNum& operator=( const SvxNodeNum& rCpy ); - BYTE GetLevel() const { return nMyLevel; } - void SetLevel( BYTE nVal ) { nMyLevel = nVal; } + sal_uInt8 GetLevel() const { return nMyLevel; } + void SetLevel( sal_uInt8 nVal ) { nMyLevel = nVal; } - BOOL IsStart() const { return bStartNum; } - void SetStart( BOOL bFlag = TRUE ) { bStartNum = bFlag; } + sal_Bool IsStart() const { return bStartNum; } + void SetStart( sal_Bool bFlag = sal_True ) { bStartNum = bFlag; } - USHORT GetSetValue() const { return nSetValue; } - void SetSetValue( USHORT nVal ) { nSetValue = nVal; } + sal_uInt16 GetSetValue() const { return nSetValue; } + void SetSetValue( sal_uInt16 nVal ) { nSetValue = nVal; } - const USHORT* GetLevelVal() const { return nLevelVal; } - USHORT* GetLevelVal() { return nLevelVal; } + const sal_uInt16* GetLevelVal() const { return nLevelVal; } + sal_uInt16* GetLevelVal() { return nLevelVal; } }; -SvxNodeNum::SvxNodeNum( BYTE nLevel, USHORT nSetVal ) - : nSetValue( nSetVal ), nMyLevel( nLevel ), bStartNum( FALSE ) +SvxNodeNum::SvxNodeNum( sal_uInt8 nLevel, sal_uInt16 nSetVal ) + : nSetValue( nSetVal ), nMyLevel( nLevel ), bStartNum( sal_False ) { memset( nLevelVal, 0, sizeof( nLevelVal ) ); } @@ -366,10 +362,7 @@ inline SvxNodeNum& SvxNodeNum::operator=( const SvxNodeNum& rCpy ) return *this; } -/* -------------------------------------------------- - * - * --------------------------------------------------*/ -SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, USHORT nLevel, SvxNumRuleType eType ); +SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevel, SvxNumRuleType eType ); #endif diff --git a/editeng/inc/editeng/opaqitem.hxx b/editeng/inc/editeng/opaqitem.hxx index 1ba364836a..5676b47ddd 100644 --- a/editeng/inc/editeng/opaqitem.hxx +++ b/editeng/inc/editeng/opaqitem.hxx @@ -42,9 +42,9 @@ namespace rtl // class SvxOpaqueItem --------------------------------------------------- -/* -[Beschreibung] -Dieses Item beschreibt eine logische Variable "Undurchsichtig ja oder nein". +/* [Description] + + This item describes a logical variable "Opaque yes or no." */ class EDITENG_DLLPUBLIC SvxOpaqueItem : public SfxBoolItem @@ -52,13 +52,13 @@ class EDITENG_DLLPUBLIC SvxOpaqueItem : public SfxBoolItem public: TYPEINFO(); - SvxOpaqueItem( const USHORT nId , const BOOL bOpa = TRUE ); + SvxOpaqueItem( const sal_uInt16 nId , const sal_Bool bOpa = sal_True ); inline SvxOpaqueItem &operator=( const SvxOpaqueItem &rCpy ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -66,7 +66,7 @@ public: String &rText, const IntlWrapper * = 0 ) const; }; -inline SvxOpaqueItem::SvxOpaqueItem( const USHORT nId, const BOOL bOpa ) +inline SvxOpaqueItem::SvxOpaqueItem( const sal_uInt16 nId, const sal_Bool bOpa ) : SfxBoolItem( nId, bOpa ) {} diff --git a/editeng/inc/editeng/orphitem.hxx b/editeng/inc/editeng/orphitem.hxx index d975116832..2d61bfcf7a 100644 --- a/editeng/inc/editeng/orphitem.hxx +++ b/editeng/inc/editeng/orphitem.hxx @@ -41,9 +41,9 @@ namespace rtl // class SvxOrphansItem -------------------------------------------------- -/* -[Beschreibung] -Dieses Item beschreibt die Anzahl der Zeilen fuer die Schusterjungenregelung. +/* [Description] + + This item describes the number of lines for the orphans system. */ class EDITENG_DLLPUBLIC SvxOrphansItem: public SfxByteItem @@ -52,12 +52,12 @@ class EDITENG_DLLPUBLIC SvxOrphansItem: public SfxByteItem public: TYPEINFO(); - SvxOrphansItem( const BYTE nL /*= 0*/, const USHORT nId ); + SvxOrphansItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/outliner.hxx b/editeng/inc/editeng/outliner.hxx index 004cb6a51c..e42ae9305e 100644 --- a/editeng/inc/editeng/outliner.hxx +++ b/editeng/inc/editeng/outliner.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -38,14 +38,13 @@ #include <i18npool/lang.h> #include <tools/color.hxx> #include <vcl/graph.hxx> -#include <tools/list.hxx> #include <tools/link.hxx> #include <rsc/rscsfx.hxx> #include "editeng/editengdllapi.h" #include <svtools/grfmgr.hxx> -#include <tools/rtti.hxx> // wegen typedef TypeId +#include <tools/rtti.hxx> // due to typedef TypeId #include <vector> class OutlinerEditEng; @@ -75,10 +74,15 @@ class SfxItemSet; class SvxNumBulletItem; class SvxNumberFormat; class SvxLRSpaceItem; -class SfxUndoManager; class EditEngine; class SvKeyValueIterator; class SvxForbiddenCharactersTable; + +namespace svl +{ + class IUndoManager; +} + #include <com/sun/star/uno/Reference.h> #include <rtl/ref.hxx> @@ -100,7 +104,7 @@ typedef std::vector<SpellPortion> SpellPortions; namespace basegfx { class B2DPolyPolygon; } -// nur interner Gebrauch! +// internal use only! #define PARAFLAG_DROPTARGET 0x1000 #define PARAFLAG_DROPTARGET_EMPTY 0x2000 #define PARAFLAG_HOLDDEPTH 0x4000 @@ -132,12 +136,12 @@ private: Paragraph& operator=(const Paragraph& rPara ); - USHORT nFlags; + sal_uInt16 nFlags; XubString aBulText; Size aBulSize; - BOOL bVisible; + sal_Bool bVisible; - BOOL IsVisible() const { return bVisible; } + sal_Bool IsVisible() const { return bVisible; } void SetText( const XubString& rText ) { aBulText = rText; aBulSize.Width() = -1; } void Invalidate() { aBulSize.Width() = -1; } void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.Width() = -1; } @@ -156,27 +160,27 @@ private: sal_Bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; } void SetParaIsNumberingRestart( sal_Bool bParaIsNumberingRestart ); - void SetFlag( USHORT nFlag ) { nFlags |= nFlag; } - void RemoveFlag( USHORT nFlag ) { nFlags &= ~nFlag; } - bool HasFlag( USHORT nFlag ) const { return (nFlags & nFlag) != 0; } + void SetFlag( sal_uInt16 nFlag ) { nFlags |= nFlag; } + void RemoveFlag( sal_uInt16 nFlag ) { nFlags &= ~nFlag; } + bool HasFlag( sal_uInt16 nFlag ) const { return (nFlags & nFlag) != 0; } }; struct ParaRange { - USHORT nStartPara; - USHORT nEndPara; + sal_uInt16 nStartPara; + sal_uInt16 nEndPara; - ParaRange( USHORT nS, USHORT nE ) { nStartPara = nS, nEndPara = nE; } + ParaRange( sal_uInt16 nS, sal_uInt16 nE ) { nStartPara = nS, nEndPara = nE; } void Adjust(); - USHORT Len() const { return 1 + ( ( nEndPara > nStartPara ) ? (nEndPara-nStartPara) : (nStartPara-nEndPara) ); } + sal_uInt16 Len() const { return 1 + ( ( nEndPara > nStartPara ) ? (nEndPara-nStartPara) : (nStartPara-nEndPara) ); } }; inline void ParaRange::Adjust() { if ( nStartPara > nEndPara ) { - USHORT nTmp = nStartPara; + sal_uInt16 nTmp = nStartPara; nStartPara = nEndPara; nEndPara = nTmp; } @@ -194,18 +198,18 @@ private: EditView* pEditView; // Drag & Drop - BOOL bBeginDragAtMove_OLDMEMBER; - BOOL bInDragMode; + sal_Bool bBeginDragAtMove_OLDMEMBER; + sal_Bool bInDragMode; Point aDDStartPosRef; Point aDDStartPosPix; - ULONG nDDStartPara; - ULONG nDDStartParaVisChildCount; - ULONG nDDCurPara; - USHORT nDDStartDepth; - USHORT nDDCurDepth; - USHORT nDDMaxDepth; - BOOL bDDChangingDepth; - BOOL bDDCursorVisible; + sal_uLong nDDStartPara; + sal_uLong nDDStartParaVisChildCount; + sal_uLong nDDCurPara; + sal_uInt16 nDDStartDepth; + sal_uInt16 nDDCurDepth; + sal_uInt16 nDDMaxDepth; + sal_Bool bDDChangingDepth; + sal_Bool bDDCursorVisible; long* pHorTabArrDoc; long nDDScrollLRBorderWidthWin; // Left Right long nDDScrollTBBorderWidthWin; // Top Bottom @@ -213,24 +217,24 @@ private: long nDDScrollTDOffs; void* pDummy; - ULONG nDummy; + sal_uLong nDummy; enum MouseTarget { MouseText = 0, MouseBullet = 1, - MouseHypertext = 2, // ausserhalb OutputArea - MouseOutside = 3, // ausserhalb OutputArea + MouseHypertext = 2, // Outside OutputArea + MouseOutside = 3, // Outside OutputArea MouseDontKnow = 4 }; MouseTarget OLD_ePrevMouseTarget; #ifdef _OUTLINER_CXX - EDITENG_DLLPRIVATE void ImplExpandOrCollaps( USHORT nStartPara, USHORT nEndPara, BOOL bExpand ); + EDITENG_DLLPRIVATE void ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand ); - EDITENG_DLLPRIVATE ULONG ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget); + EDITENG_DLLPRIVATE sal_uLong ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget); EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph* pParentPara ); - EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( BOOL bIncludeHiddenChilds ); + EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChilds ); EDITENG_DLLPRIVATE void ImpHideDDCursor(); EDITENG_DLLPRIVATE void ImpShowDDCursor(); EDITENG_DLLPRIVATE void ImpPaintDDCursor(); @@ -241,13 +245,13 @@ private: EDITENG_DLLPRIVATE void ImpScrollUp(); EDITENG_DLLPRIVATE void ImpScrollDown(); - EDITENG_DLLPRIVATE ULONG ImpGetInsertionPara( const Point& rPosPixel ); + EDITENG_DLLPRIVATE sal_uLong ImpGetInsertionPara( const Point& rPosPixel ); EDITENG_DLLPRIVATE Point ImpGetDocPos( const Point& rPosPixel ); EDITENG_DLLPRIVATE Pointer ImpGetMousePointer( MouseTarget eTarget ); - EDITENG_DLLPRIVATE USHORT ImpInitPaste( ULONG& rStart ); - EDITENG_DLLPRIVATE void ImpPasted( ULONG nStart, ULONG nPrevParaCount, USHORT nSize); - EDITENG_DLLPRIVATE USHORT ImpCalcSelectedPages( BOOL bIncludeFirstSelected ); - EDITENG_DLLPRIVATE BOOL ImpIsIndentingPages(); + EDITENG_DLLPRIVATE sal_uInt16 ImpInitPaste( sal_uLong& rStart ); + EDITENG_DLLPRIVATE void ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize); + EDITENG_DLLPRIVATE sal_uInt16 ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected ); + EDITENG_DLLPRIVATE sal_Bool ImpIsIndentingPages(); #endif @@ -260,12 +264,12 @@ public: void Scroll( long nHorzScroll, long nVertScroll ); void Paint( const Rectangle& rRect ); - BOOL PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin = NULL ); - BOOL MouseButtonDown( const MouseEvent& ); - BOOL MouseButtonUp( const MouseEvent& ); - BOOL MouseMove( const MouseEvent& ); + sal_Bool PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin = NULL ); + sal_Bool MouseButtonDown( const MouseEvent& ); + sal_Bool MouseButtonUp( const MouseEvent& ); + sal_Bool MouseMove( const MouseEvent& ); - void ShowCursor( BOOL bGotoCursor = TRUE ); + void ShowCursor( sal_Bool bGotoCursor = sal_True ); void HideCursor(); void SetOutliner( Outliner* pOutliner ); @@ -274,38 +278,37 @@ public: void SetWindow( Window* pWindow ); Window* GetWindow() const; - void SetReadOnly( BOOL bReadOnly ); - BOOL IsReadOnly() const; + void SetReadOnly( sal_Bool bReadOnly ); + sal_Bool IsReadOnly() const; void SetOutputArea( const Rectangle& rRect ); Rectangle GetOutputArea() const; Rectangle GetVisArea() const; - List* CreateSelectionList(); + void CreateSelectionList (std::vector<Paragraph*> &aSelList) ; - // gibt Anzahl selektierter Absaetze zurueck - // MT 07/00: Who needs this? - ULONG Select( Paragraph* pParagraph, - BOOL bSelect=TRUE, - BOOL bWChilds=TRUE); + // Retruns the number of selected paragraphs + sal_uLong Select( Paragraph* pParagraph, + sal_Bool bSelect=sal_True, + sal_Bool bWChilds=sal_True); String GetSelected() const; - void SelectRange( ULONG nFirst, USHORT nCount ); + void SelectRange( sal_uLong nFirst, sal_uInt16 nCount ); void SetAttribs( const SfxItemSet& ); void Indent( short nDiff ); - void AdjustDepth( short nDX ); // Spaeter gegeb Indent ersetzen! + void AdjustDepth( short nDX ); // Later replace with Indent! - BOOL AdjustHeight( long nDY ); + sal_Bool AdjustHeight( long nDY ); void AdjustDepth( Paragraph* pPara, short nDX, - BOOL bWithChilds = FALSE ); + sal_Bool bWithChilds = sal_False ); void AdjustHeight( Paragraph* pPara, long nDY, - BOOL bWithChilds=FALSE ); + sal_Bool bWithChilds=sal_False ); - ULONG Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, BOOL bSelect = FALSE, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); - ULONG Write( SvStream& rOutput, EETextFormat eFormat ); + sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); + sal_uLong Write( SvStream& rOutput, EETextFormat eFormat ); - void InsertText( const String& rNew, BOOL bSelect = FALSE ); + void InsertText( const String& rNew, sal_Bool bSelect = sal_False ); void InsertText( const OutlinerParaObject& rParaObj ); void Expand(); void Collapse(); @@ -323,7 +326,7 @@ public: void Copy(); void Paste(); void PasteSpecial(); - void EnablePaste( BOOL bEnable ); + void EnablePaste( sal_Bool bEnable ); void Undo(); void Redo(); @@ -331,41 +334,41 @@ public: void SetStyleSheet( SfxStyleSheet* ); SfxStyleSheet* GetStyleSheet() const; - void SetControlWord( ULONG nWord ); - ULONG GetControlWord() const; + void SetControlWord( sal_uLong nWord ); + sal_uLong GetControlWord() const; void SetAnchorMode( EVAnchorMode eMode ); EVAnchorMode GetAnchorMode() const; Pointer GetPointer( const Point& rPosPixel ); void Command( const CommandEvent& rCEvt ); - void RemoveCharAttribs( ULONG nPara, USHORT nWhich = 0 ); + void RemoveCharAttribs( sal_uLong nPara, sal_uInt16 nWhich = 0 ); void CompleteAutoCorrect(); - EESpellState StartSpeller( BOOL bMultipleDoc = FALSE ); + EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False ); EESpellState StartThesaurus(); - USHORT StartSearchAndReplace( const SvxSearchItem& rSearchItem ); + sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem ); // for text conversion - void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, INT32 nOptions, BOOL bIsInteractive, BOOL bMultipleDoc ); + void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ); void TransliterateText( sal_Int32 nTransliterationMode ); ESelection GetSelection(); - USHORT GetSelectedScriptType() const; + sal_uInt16 GetSelectedScriptType() const; void SetVisArea( const Rectangle& rRec ); void SetSelection( const ESelection& ); - void RemoveAttribs( BOOL bRemoveParaAttribs = FALSE, USHORT nWhich = 0, BOOL bKeepLanguages = FALSE ); - void RemoveAttribsKeepLanguages( BOOL bRemoveParaAttribs ); - BOOL HasSelection() const; + void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0, sal_Bool bKeepLanguages = sal_False ); + void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs ); + sal_Bool HasSelection() const; void InsertField( const SvxFieldItem& rFld ); const SvxFieldItem* GetFieldUnderMousePointer() const; - const SvxFieldItem* GetFieldUnderMousePointer( USHORT& nPara, xub_StrLen& nPos ) const; + const SvxFieldItem* GetFieldUnderMousePointer( sal_uInt16& nPara, xub_StrLen& nPos ) const; const SvxFieldItem* GetFieldAtSelection() const; /** enables numbering for the selected paragraphs if the numbering of the first paragraph is off @@ -378,13 +381,13 @@ public: */ void EnableBullets(); - BOOL IsCursorAtWrongSpelledWord( BOOL bMarkIfWrong = FALSE ); - BOOL IsWrongSpelledWordAtPos( const Point& rPosPixel, BOOL bMarkIfWrong = FALSE ); + sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False ); + sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False ); void SpellIgnoreWord(); void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 ); - void SetInvalidateMore( USHORT nPixel ); - USHORT GetInvalidateMore() const; + void SetInvalidateMore( sal_uInt16 nPixel ); + sal_uInt16 GetInvalidateMore() const; String GetSurroundingText() const; Selection GetSurroundingTextSelection() const; @@ -395,8 +398,7 @@ public: bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( String &rStatusVal, LanguageType &rLang, const EditView &rEditView ); void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText ); - -DECLARE_LIST(ViewList,OutlinerView*) +typedef ::std::vector< OutlinerView* > ViewList; class EDITENG_DLLPUBLIC DrawPortionInfo { @@ -416,8 +418,7 @@ public: const Color maOverlineColor; const Color maTextLineColor; - // #101498# BiDi level needs to be transported, too. - BYTE mnBiDiLevel; + sal_uInt8 mnBiDiLevel; bool mbFilled; long mnWidthToFill; @@ -427,7 +428,7 @@ public: unsigned mbEndOfParagraph : 1; unsigned mbEndOfBullet : 1; - BYTE GetBiDiLevel() const { return mnBiDiLevel; } + sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; } sal_Bool IsRTL() const; DrawPortionInfo( @@ -444,7 +445,7 @@ public: const ::com::sun::star::lang::Locale* pLocale, const Color& rOverlineColor, const Color& rTextLineColor, - BYTE nBiDiLevel, + sal_uInt8 nBiDiLevel, bool bFilled, long nWidthToFill, bool bEndOfLine, @@ -491,14 +492,14 @@ public: struct EDITENG_DLLPUBLIC PaintFirstLineInfo { - USHORT mnPara; + sal_uInt16 mnPara; const Point& mrStartPos; long mnBaseLineY; const Point& mrOrigin; short mnOrientation; OutputDevice* mpOutDev; - PaintFirstLineInfo( USHORT nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) + PaintFirstLineInfo( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) : mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev ) {} }; @@ -516,9 +517,9 @@ private: String aRepresentation; - USHORT nPara; + sal_uInt16 nPara; xub_StrLen nPos; - BOOL bSimpleClick; + sal_Bool bSimpleClick; EditFieldInfo(); EditFieldInfo( const EditFieldInfo& ); @@ -526,12 +527,12 @@ private: SdrPage* mpSdrPage; public: - EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, USHORT nPa, xub_StrLen nPo ) + EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, sal_uInt16 nPa, xub_StrLen nPo ) : rFldItem( rFItem ) { pOutliner = pOutl; nPara = nPa; nPos = nPo; - pTxtColor = 0; pFldColor = 0; bSimpleClick = FALSE; + pTxtColor = 0; pFldColor = 0; bSimpleClick = sal_False; mpSdrPage = 0; } ~EditFieldInfo() @@ -554,11 +555,11 @@ public: void ClearFldColor() { delete pFldColor; pFldColor = 0; } - USHORT GetPara() const { return nPara; } + sal_uInt16 GetPara() const { return nPara; } xub_StrLen GetPos() const { return nPos; } - BOOL IsSimpleClick() const { return bSimpleClick; } - void SetSimpleClick( BOOL bSimple ) { bSimpleClick = bSimple; } + sal_Bool IsSimpleClick() const { return bSimpleClick; } + void SetSimpleClick( sal_Bool bSimple ) { bSimpleClick = bSimple; } const String& GetRepresentation() const { return aRepresentation; } String& GetRepresentation() { return aRepresentation; } @@ -570,15 +571,15 @@ public: struct EBulletInfo { - BOOL bVisible; - USHORT nType; // see SvxNumberType + sal_Bool bVisible; + sal_uInt16 nType; // see SvxNumberType String aText; SvxFont aFont; Graphic aGraphic; - USHORT nParagraph; + sal_uInt16 nParagraph; Rectangle aBounds; - EBulletInfo() : bVisible( FALSE ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {} + EBulletInfo() : bVisible( sal_False ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {} }; #define OUTLINERMODE_DONTKNOW 0x0000 @@ -608,7 +609,7 @@ class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster ViewList aViewList; Paragraph* pHdlParagraph; - ULONG mnFirstSelPage; + sal_uLong mnFirstSelPage; Link aDrawPortionHdl; Link aDrawBulletHdl; Link aExpandHdl; @@ -627,20 +628,20 @@ class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster Link maEndPasteOrDropHdl; sal_Int16 nDepthChangedHdlPrevDepth; - USHORT mnDepthChangeHdlPrevFlags; + sal_uInt16 mnDepthChangeHdlPrevFlags; sal_Int16 nMaxDepth; const sal_Int16 nMinDepth; - USHORT nFirstPage; + sal_uInt16 nFirstPage; - USHORT nOutlinerMode; + sal_uInt16 nOutlinerMode; - BOOL bIsExpanding; // Nur in Expand/Collaps-Hdl gueltig, mal umstellen - BOOL bFirstParaIsEmpty; - BOOL bBlockInsCallback; - BOOL bStrippingPortions; - BOOL bPasting; + sal_Bool bIsExpanding; // Only valid in Expand/Collaps-Hdl, reset + sal_Bool bFirstParaIsEmpty; + sal_Bool bBlockInsCallback; + sal_Bool bStrippingPortions; + sal_Bool bPasting; - ULONG nDummy; + sal_uLong nDummy; #ifdef _OUTLINER_CXX @@ -650,96 +651,96 @@ class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* ); DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* ); DECL_LINK( EditEngineNotifyHdl, EENotify* ); - void ImplCheckParagraphs( USHORT nStart, USHORT nEnd ); - BOOL ImplHasBullet( USHORT nPara ) const; - Size ImplGetBulletSize( USHORT nPara ); - sal_uInt16 ImplGetNumbering( USHORT nPara, const SvxNumberFormat* pParaFmt ); - void ImplCalcBulletText( USHORT nPara, BOOL bRecalcLevel, BOOL bRecalcChilds ); - String ImplGetBulletText( USHORT nPara ); - void ImplCheckNumBulletItem( USHORT nPara ); - void ImplInitDepth( USHORT nPara, sal_Int16 nDepth, BOOL bCreateUndo, BOOL bUndoAction = FALSE ); - void ImplSetLevelDependendStyleSheet( USHORT nPara, SfxStyleSheet* pLevelStyle = NULL ); - - void ImplBlockInsertionCallbacks( BOOL b ); - - void ImplCheckStyleSheet( USHORT nPara, BOOL bReplaceExistingStyle ); - void ImpRecalcBulletIndent( ULONG nPara ); - - const SvxBulletItem& ImpGetBullet( ULONG nPara, USHORT& ); - void ImpFilterIndents( ULONG nFirstPara, ULONG nLastPara ); + void ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd ); + sal_Bool ImplHasBullet( sal_uInt16 nPara ) const; + Size ImplGetBulletSize( sal_uInt16 nPara ); + sal_uInt16 ImplGetNumbering( sal_uInt16 nPara, const SvxNumberFormat* pParaFmt ); + void ImplCalcBulletText( sal_uInt16 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChilds ); + String ImplGetBulletText( sal_uInt16 nPara ); + void ImplCheckNumBulletItem( sal_uInt16 nPara ); + void ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction = sal_False ); + void ImplSetLevelDependendStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pLevelStyle = NULL ); + + void ImplBlockInsertionCallbacks( sal_Bool b ); + + void ImplCheckStyleSheet( sal_uInt16 nPara, sal_Bool bReplaceExistingStyle ); + void ImpRecalcBulletIndent( sal_uLong nPara ); + + const SvxBulletItem& ImpGetBullet( sal_uLong nPara, sal_uInt16& ); + void ImpFilterIndents( sal_uLong nFirstPara, sal_uLong nLastPara ); bool ImpConvertEdtToOut( sal_uInt32 nPara, EditView* pView = 0 ); - void ImpTextPasted( ULONG nStartPara, USHORT nCount ); - long ImpCalcMaxBulletWidth( USHORT nPara, const SvxBulletItem& rBullet ); - Font ImpCalcBulletFont( USHORT nPara ) const; - Rectangle ImpCalcBulletArea( USHORT nPara, BOOL bAdjust, BOOL bReturnPaperPos ); - long ImpGetTextIndent( ULONG nPara ); - BOOL ImpCanIndentSelectedPages( OutlinerView* pCurView ); - BOOL ImpCanDeleteSelectedPages( OutlinerView* pCurView ); - BOOL ImpCanDeleteSelectedPages( OutlinerView* pCurView, USHORT nFirstPage, USHORT nPages ); + void ImpTextPasted( sal_uLong nStartPara, sal_uInt16 nCount ); + long ImpCalcMaxBulletWidth( sal_uInt16 nPara, const SvxBulletItem& rBullet ); + Font ImpCalcBulletFont( sal_uInt16 nPara ) const; + Rectangle ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_Bool bReturnPaperPos ); + long ImpGetTextIndent( sal_uLong nPara ); + sal_Bool ImpCanIndentSelectedPages( OutlinerView* pCurView ); + sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView ); + sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_uInt16 nFirstPage, sal_uInt16 nPages ); - USHORT ImplGetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; } + sal_uInt16 ImplGetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; } void ImplCheckDepth( sal_Int16& rnDepth ) const; #endif protected: - void ParagraphInserted( USHORT nParagraph ); - void ParagraphDeleted( USHORT nParagraph ); - void ParaAttribsChanged( USHORT nParagraph ); + void ParagraphInserted( sal_uInt16 nParagraph ); + void ParagraphDeleted( sal_uInt16 nParagraph ); + void ParaAttribsChanged( sal_uInt16 nParagraph ); virtual void StyleSheetChanged( SfxStyleSheet* pStyle ); - void InvalidateBullet( Paragraph* pPara, ULONG nPara ); - void PaintBullet( USHORT nPara, const Point& rStartPos, + void InvalidateBullet( Paragraph* pPara, sal_uLong nPara ); + void PaintBullet( sal_uInt16 nPara, const Point& rStartPos, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ); // used by OutlinerEditEng. Allows Outliner objects to provide // bullet access to the EditEngine. - virtual const SvxNumberFormat* GetNumberFormat( USHORT nPara ) const; + virtual const SvxNumberFormat* GetNumberFormat( sal_uInt16 nPara ) const; public: - Outliner( SfxItemPool* pPool, USHORT nOutlinerMode ); + Outliner( SfxItemPool* pPool, sal_uInt16 nOutlinerMode ); virtual ~Outliner(); - void Init( USHORT nOutlinerMode ); - USHORT GetMode() const { return nOutlinerMode; } + void Init( sal_uInt16 nOutlinerMode ); + sal_uInt16 GetMode() const { return nOutlinerMode; } - void SetVertical( BOOL bVertical ); - BOOL IsVertical() const; + void SetVertical( sal_Bool bVertical ); + sal_Bool IsVertical() const; - void SetFixedCellHeight( BOOL bUseFixedCellHeight ); - BOOL IsFixedCellHeight() const; + void SetFixedCellHeight( sal_Bool bUseFixedCellHeight ); + sal_Bool IsFixedCellHeight() const; void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir ); EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const; - USHORT GetScriptType( const ESelection& rSelection ) const; - LanguageType GetLanguage( USHORT nPara, USHORT nPos ) const; + sal_uInt16 GetScriptType( const ESelection& rSelection ) const; + LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const; - void SetAsianCompressionMode( USHORT nCompressionMode ); - USHORT GetAsianCompressionMode() const; + void SetAsianCompressionMode( sal_uInt16 nCompressionMode ); + sal_uInt16 GetAsianCompressionMode() const; - void SetKernAsianPunctuation( BOOL bEnabled ); - BOOL IsKernAsianPunctuation() const; + void SetKernAsianPunctuation( sal_Bool bEnabled ); + sal_Bool IsKernAsianPunctuation() const; - void SetAddExtLeading( BOOL b ); - BOOL IsAddExtLeading() const; + void SetAddExtLeading( sal_Bool b ); + sal_Bool IsAddExtLeading() const; - ULONG InsertView( OutlinerView* pView, ULONG nIndex=LIST_APPEND); + size_t InsertView( OutlinerView* pView, size_t nIndex = size_t(-1) ); OutlinerView* RemoveView( OutlinerView* pView ); - OutlinerView* RemoveView( ULONG nIndex ); - OutlinerView* GetView( ULONG nIndex ) const; - ULONG GetViewCount() const; + OutlinerView* RemoveView( size_t nIndex ); + OutlinerView* GetView( size_t nIndex ) const; + size_t GetViewCount() const; - Paragraph* Insert( const String& rText, ULONG nAbsPos = LIST_APPEND, sal_Int16 nDepth = 0 ); + Paragraph* Insert( const String& rText, sal_uLong nAbsPos = LIST_APPEND, sal_Int16 nDepth = 0 ); void SetText( const OutlinerParaObject& ); void AddText( const OutlinerParaObject& ); void SetText( const String& rText, Paragraph* pParagraph ); - String GetText( Paragraph* pPara, ULONG nParaCount=1 ) const; + String GetText( Paragraph* pPara, sal_uLong nParaCount=1 ) const; - OutlinerParaObject* CreateParaObject( USHORT nStartPara = 0, USHORT nParaCount = 0xFFFF ) const; + OutlinerParaObject* CreateParaObject( sal_uInt16 nStartPara = 0, sal_uInt16 nParaCount = 0xFFFF ) const; const SfxItemSet& GetEmptyItemSet() const; @@ -751,46 +752,44 @@ public: sal_Int16 GetMinDepth() const { return -1; } - void SetMaxDepth( sal_Int16 nDepth, BOOL bCheckParas = FALSE ); + void SetMaxDepth( sal_Int16 nDepth, sal_Bool bCheckParas = sal_False ); sal_Int16 GetMaxDepth() const { return nMaxDepth; } - void SetUpdateMode( BOOL bUpdate ); - BOOL GetUpdateMode() const; + void SetUpdateMode( sal_Bool bUpdate ); + sal_Bool GetUpdateMode() const; void Clear(); void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); - ULONG GetParagraphCount() const; - Paragraph* GetParagraph( ULONG nAbsPos ) const; + sal_uLong GetParagraphCount() const; + Paragraph* GetParagraph( sal_uLong nAbsPos ) const; - BOOL HasParent( Paragraph* pParagraph ) const; - BOOL HasChilds( Paragraph* pParagraph ) const; - ULONG GetChildCount( Paragraph* pParent ) const; - BOOL IsExpanded( Paragraph* pPara ) const; -// Paragraph* GetParagraph( Paragraph* pParent, ULONG nRelPos ) const; - Paragraph* GetParent( Paragraph* pParagraph ) const; -// ULONG GetRelPos( Paragraph* pParent, Paragraph* pPara ) const; - ULONG GetAbsPos( Paragraph* pPara ); + sal_Bool HasParent( Paragraph* pParagraph ) const; + sal_Bool HasChilds( Paragraph* pParagraph ) const; + sal_uLong GetChildCount( Paragraph* pParent ) const; + sal_Bool IsExpanded( Paragraph* pPara ) const; + Paragraph* GetParent( Paragraph* pParagraph ) const; + sal_uLong GetAbsPos( Paragraph* pPara ); - sal_Int16 GetDepth( ULONG nPara ) const; + sal_Int16 GetDepth( sal_uLong nPara ) const; void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth ); - void SetVisible( Paragraph* pPara, BOOL bVisible ); - BOOL IsVisible( Paragraph* pPara ) const { return pPara->IsVisible(); } + void SetVisible( Paragraph* pPara, sal_Bool bVisible ); + sal_Bool IsVisible( Paragraph* pPara ) const { return pPara->IsVisible(); } - void EnableUndo( BOOL bEnable ); - BOOL IsUndoEnabled() const; - void UndoActionStart( USHORT nId ); - void UndoActionEnd( USHORT nId ); + void EnableUndo( sal_Bool bEnable ); + sal_Bool IsUndoEnabled() const; + void UndoActionStart( sal_uInt16 nId ); + void UndoActionEnd( sal_uInt16 nId ); void InsertUndo( EditUndo* pUndo ); - BOOL IsInUndo(); + sal_Bool IsInUndo(); void ClearModifyFlag(); - BOOL IsModified() const; + sal_Bool IsModified() const; Paragraph* GetHdlParagraph() const { return pHdlParagraph; } - BOOL IsExpanding() const { return bIsExpanding; } + sal_Bool IsExpanding() const { return bIsExpanding; } virtual void ExpandHdl(); void SetExpandHdl( const Link& rLink ) { aExpandHdl = rLink; } @@ -808,7 +807,7 @@ public: void SetDepthChangedHdl(const Link& rLink){aDepthChangedHdl=rLink;} Link GetDepthChangedHdl() const { return aDepthChangedHdl; } sal_Int16 GetPrevDepth() const { return nDepthChangedHdlPrevDepth; } - USHORT GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; } + sal_uInt16 GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; } virtual long RemovingPagesHdl( OutlinerView* ); void SetRemovingPagesHdl(const Link& rLink){aRemovingPagesHdl=rLink;} @@ -816,10 +815,11 @@ public: virtual long IndentingPagesHdl( OutlinerView* ); void SetIndentingPagesHdl(const Link& rLink){aIndentingPagesHdl=rLink;} Link GetIndentingPagesHdl() const { return aIndentingPagesHdl; } - // nur gueltig in den beiden oberen Handlern - USHORT GetSelPageCount() const { return nDepthChangedHdlPrevDepth; } - // nur gueltig in den beiden oberen Handlern - ULONG GetFirstSelPage() const { return mnFirstSelPage; } + // valid only in the two upper handlers + sal_uInt16 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; } + + // valid only in the two upper handlers + sal_uLong GetFirstSelPage() const { return mnFirstSelPage; } void SetCalcFieldValueHdl(const Link& rLink ) { aCalcFieldValueHdl= rLink; } Link GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; } @@ -852,8 +852,8 @@ public: const Size& GetPaperSize() const; void SetPaperSize( const Size& rSize ); - void SetFirstPageNumber( USHORT n ) { nFirstPage = n; } - USHORT GetFirstPageNumber() const { return nFirstPage; } + void SetFirstPageNumber( sal_uInt16 n ) { nFirstPage = n; } + sal_uInt16 GetFirstPageNumber() const { return nFirstPage; } void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon ); void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon); @@ -866,30 +866,29 @@ public: const Size& GetMaxAutoPaperSize() const; void SetMaxAutoPaperSize( const Size& rSz ); - void SetDefTab( USHORT nTab ); - USHORT GetDefTab() const; + void SetDefTab( sal_uInt16 nTab ); + sal_uInt16 GetDefTab() const; - BOOL IsFlatMode() const; - void SetFlatMode( BOOL bFlat ); + sal_Bool IsFlatMode() const; + void SetFlatMode( sal_Bool bFlat ); - void EnableAutoColor( BOOL b ); - BOOL IsAutoColorEnabled() const; + void EnableAutoColor( sal_Bool b ); + sal_Bool IsAutoColorEnabled() const; - void ForceAutoColor( BOOL b ); - BOOL IsForceAutoColor() const; + void ForceAutoColor( sal_Bool b ); + sal_Bool IsForceAutoColor() const; - EBulletInfo GetBulletInfo( USHORT nPara ); + EBulletInfo GetBulletInfo( sal_uInt16 nPara ); void SetWordDelimiters( const String& rDelimiters ); String GetWordDelimiters() const; - String GetWord( USHORT nPara, xub_StrLen nIndex ); + String GetWord( sal_uInt16 nPara, xub_StrLen nIndex ); void StripPortions(); - // #101498# virtual void DrawingText( - const Point& rStartPos, const String& rText, USHORT nTextStart, USHORT nTextLen, - const sal_Int32* pDXArray, const SvxFont& rFont, USHORT nPara, xub_StrLen nIndex, BYTE nRightToLeft, + const Point& rStartPos, const String& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, + const sal_Int32* pDXArray, const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, const EEngineData::WrongSpellVector* pWrongSpellVector, const SvxFieldData* pFieldData, bool bEndOfLine, @@ -901,73 +900,75 @@ public: virtual void DrawingTab( const Point& rStartPos, long nWidth, const String& rChar, - const SvxFont& rFont, USHORT nPara, xub_StrLen nIndex, BYTE nRightToLeft, + const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, bool bEndOfLine, bool bEndOfParagraph, const Color& rOverlineColor, const Color& rTextLineColor); Size CalcTextSize(); + Size CalcTextSizeNTP(); Point GetDocPos( Paragraph* pPara ); void SetStyleSheetPool( SfxStyleSheetPool* pSPool ); SfxStyleSheetPool* GetStyleSheetPool(); - BOOL IsInSelectionMode() const; + sal_Bool IsInSelectionMode() const; - void SetStyleSheet( ULONG nPara, SfxStyleSheet* pStyle ); - SfxStyleSheet* GetStyleSheet( ULONG nPara ); + void SetStyleSheet( sal_uLong nPara, SfxStyleSheet* pStyle ); + SfxStyleSheet* GetStyleSheet( sal_uLong nPara ); - void SetParaAttribs( USHORT nPara, const SfxItemSet& ); - SfxItemSet GetParaAttribs( USHORT nPara ); + void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& ); + SfxItemSet GetParaAttribs( sal_uInt16 nPara ); - void Remove( Paragraph* pPara, ULONG nParaCount ); - BOOL Expand( Paragraph* ); - BOOL Collapse( Paragraph* ); + void Remove( Paragraph* pPara, sal_uLong nParaCount ); + sal_Bool Expand( Paragraph* ); + sal_Bool Collapse( Paragraph* ); void SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag ); void RemoveParaFlag( Paragraph* pPara, sal_uInt16 nFlag ); bool HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const; - // gibt ein Array mit den Bulletbreiten der n Einrueckebenen - // zurueck. Letzter Wert muss -1 sein. Wird vom Outliner geloescht. + // Returns an array containing the widths of the Bullet Indentations + // Last value must be -1. Is deleted by the outliner. Link GetWidthArrReqHdl() const{ return aWidthArrReqHdl; } void SetWidthArrReqHdl(const Link& rLink){aWidthArrReqHdl=rLink; } - void SetControlWord( ULONG nWord ); - ULONG GetControlWord() const; + void SetControlWord( sal_uLong nWord ); + sal_uLong GetControlWord() const; Link GetBeginMovingHdl() const { return aBeginMovingHdl; } void SetBeginMovingHdl(const Link& rLink) {aBeginMovingHdl=rLink;} Link GetEndMovingHdl() const {return aEndMovingHdl;} void SetEndMovingHdl( const Link& rLink){aEndMovingHdl=rLink;} - ULONG GetLineCount( ULONG nParagraph ) const; - USHORT GetLineLen( ULONG nParagraph, USHORT nLine ) const; - ULONG GetLineHeight( ULONG nParagraph, ULONG nLine = 0 ); + sal_uLong GetLineCount( sal_uLong nParagraph ) const; + sal_uInt16 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const; + sal_uLong GetLineHeight( sal_uLong nParagraph, sal_uLong nLine = 0 ); - // nFormat muss ein Wert aus dem enum EETextFormat sein (wg.CLOOKS) - ULONG Read( SvStream& rInput, const String& rBaseURL, USHORT, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); + // nFormat must be a value from the enum EETextFormat (due to CLOOKS) + sal_uLong Read( SvStream& rInput, const String& rBaseURL, sal_uInt16, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); - SfxUndoManager& GetUndoManager(); + ::svl::IUndoManager& + GetUndoManager(); void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ); void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ); void QuickInsertLineBreak( const ESelection& rSel ); - // nur fuer EditEngine-Modus + // Only for EditEngine mode void QuickInsertText( const String& rText, const ESelection& rSel ); void QuickDelete( const ESelection& rSel ); - void QuickRemoveCharAttribs( USHORT nPara, USHORT nWhich = 0 ); - void QuickFormatDoc( BOOL bFull = FALSE ); + void QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 ); + void QuickFormatDoc( sal_Bool bFull = sal_False ); - BOOL UpdateFields(); - void RemoveFields( BOOL bKeepFieldText, TypeId aType = NULL ); + sal_Bool UpdateFields(); + void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL ); - virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); - virtual void FieldSelected( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); - virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor ); void SetSpeller( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller ); @@ -987,16 +988,16 @@ public: void SetDefaultLanguage( LanguageType eLang ); LanguageType GetDefaultLanguage() const; - BOOL HasOnlineSpellErrors() const; + sal_Bool HasOnlineSpellErrors() const; void CompleteOnlineSpelling(); EESpellState HasSpellErrors(); - BOOL HasText( const SvxSearchItem& rSearchItem ); - virtual BOOL SpellNextDocument(); + sal_Bool HasText( const SvxSearchItem& rSearchItem ); + virtual sal_Bool SpellNextDocument(); // for text conversion sal_Bool HasConvertibleTextPortion( LanguageType nLang ); - virtual BOOL ConvertNextDocument(); + virtual sal_Bool ConvertNextDocument(); void SetEditTextObjectPool( SfxItemPool* pPool ); SfxItemPool* GetEditTextObjectPool() const; @@ -1004,37 +1005,37 @@ public: void SetRefDevice( OutputDevice* pRefDev ); OutputDevice* GetRefDevice() const; - USHORT GetFirstLineOffset( ULONG nParagraph ); + sal_uInt16 GetFirstLineOffset( sal_uLong nParagraph ); - ULONG GetTextHeight() const; - ULONG GetTextHeight( ULONG nParagraph ) const; - Point GetDocPosTopLeft( ULONG nParagraph ); + sal_uLong GetTextHeight() const; + sal_uLong GetTextHeight( sal_uLong nParagraph ) const; + Point GetDocPosTopLeft( sal_uLong nParagraph ); Point GetDocPos( const Point& rPaperPos ) const; - BOOL IsTextPos( const Point& rPaperPos, USHORT nBorder = 0 ); - BOOL IsTextPos( const Point& rPaperPos, USHORT nBorder, BOOL* pbBuuletPos ); + sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 ); + sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bool* pbBuuletPos ); - void SetGlobalCharStretching( USHORT nX = 100, USHORT nY = 100 ); - void GetGlobalCharStretching( USHORT& rX, USHORT& rY ); - void DoStretchChars( USHORT nX, USHORT nY ); + void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 ); + void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ); + void DoStretchChars( sal_uInt16 nX, sal_uInt16 nY ); void EraseVirtualDevice(); - void SetBigTextObjectStart( USHORT nStartAtPortionCount ); - USHORT GetBigTextObjectStart() const; - BOOL ShouldCreateBigTextObject() const; + void SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount ); + sal_uInt16 GetBigTextObjectStart() const; + sal_Bool ShouldCreateBigTextObject() const; const EditEngine& GetEditEngine() const { return *((EditEngine*)pEditEngine); } // this is needed for StarOffice Api - void SetLevelDependendStyleSheet( USHORT nPara ); + void SetLevelDependendStyleSheet( sal_uInt16 nPara ); - USHORT GetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; } + sal_uInt16 GetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; } void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc); - //spell and return a sentence + // spell and return a sentence bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking ); // put spell position to start of current sentence void PutSpellingToSentenceStart( EditView& rEditView ); - //applies a changed sentence + // applies a changed sentence void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck ); void EndSpelling(); diff --git a/editeng/inc/editeng/paperinf.hxx b/editeng/inc/editeng/paperinf.hxx index a4c32f6788..3c1a7cc493 100644 --- a/editeng/inc/editeng/paperinf.hxx +++ b/editeng/inc/editeng/paperinf.hxx @@ -49,7 +49,7 @@ public: static Size GetDefaultPaperSize( MapUnit eUnit = MAP_TWIP ); static Size GetPaperSize( Paper ePaper, MapUnit eUnit = MAP_TWIP ); static Size GetPaperSize( const Printer* pPrinter ); - static Paper GetSvxPaper( const Size &rSize, MapUnit eUnit = MAP_TWIP, bool bSloppy = FALSE ); + static Paper GetSvxPaper( const Size &rSize, MapUnit eUnit = MAP_TWIP, bool bSloppy = sal_False ); static long GetSloppyPaperDimension( long nSize, MapUnit eUnit = MAP_TWIP ); static String GetName( Paper ePaper ); }; diff --git a/editeng/inc/editeng/paragraphdata.hxx b/editeng/inc/editeng/paragraphdata.hxx index b869a801e1..778dbdea97 100644 --- a/editeng/inc/editeng/paragraphdata.hxx +++ b/editeng/inc/editeng/paragraphdata.hxx @@ -33,10 +33,10 @@ #include <vector> ////////////////////////////////////////////////////////////////////////////// -// MT 07/00: Only for internal use, oder some kind like hPara for the few +// Only for internal use, oder some kind like hPara for the few // functions where you need it outside ( eg. moving paragraphs... ) // -// AW: Unfortunately NOT only local (formally in outliner.hxx), but also +// Unfortunately NOT only local (formally in outliner.hxx), but also // used in outlobj.hxx. Moved to own header class ParagraphData diff --git a/editeng/inc/editeng/paravertalignitem.hxx b/editeng/inc/editeng/paravertalignitem.hxx index ed8f0af6d8..d1e94d6a54 100644 --- a/editeng/inc/editeng/paravertalignitem.hxx +++ b/editeng/inc/editeng/paravertalignitem.hxx @@ -52,9 +52,9 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream & rStrm, USHORT nIVer) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -62,10 +62,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ); - virtual bool QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); inline SvxParaVertAlignItem& operator=( const SvxParaVertAlignItem& rItem ) { diff --git a/editeng/inc/editeng/pbinitem.hxx b/editeng/inc/editeng/pbinitem.hxx index 6f217a1f2c..c13b14a251 100644 --- a/editeng/inc/editeng/pbinitem.hxx +++ b/editeng/inc/editeng/pbinitem.hxx @@ -35,13 +35,13 @@ // define ---------------------------------------------------------------- -#define PAPERBIN_PRINTER_SETTINGS ((BYTE)0xFF) +#define PAPERBIN_PRINTER_SETTINGS ((sal_uInt8)0xFF) // class SvxPaperBinItem ------------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt die Auswahl eines Papierschachts des Drucker. + This item describes selecting a paper tray of the printer. */ class EDITENG_DLLPUBLIC SvxPaperBinItem : public SfxByteItem @@ -49,21 +49,21 @@ class EDITENG_DLLPUBLIC SvxPaperBinItem : public SfxByteItem public: TYPEINFO(); - inline SvxPaperBinItem( const USHORT nId , - const BYTE nTray = PAPERBIN_PRINTER_SETTINGS ); + inline SvxPaperBinItem( const sal_uInt16 nId , + const sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS ); inline SvxPaperBinItem &operator=( const SvxPaperBinItem &rCpy ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream &, USHORT ) const; - virtual SvStream& Store( SvStream &, USHORT nItemVersion ) const; + virtual SfxPoolItem* Create( SvStream &, sal_uInt16 ) const; + virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; }; -inline SvxPaperBinItem::SvxPaperBinItem( const USHORT nId, const BYTE nT ) +inline SvxPaperBinItem::SvxPaperBinItem( const sal_uInt16 nId, const sal_uInt8 nT ) : SfxByteItem( nId, nT ) {} diff --git a/editeng/inc/editeng/pgrditem.hxx b/editeng/inc/editeng/pgrditem.hxx index 16877f55a4..f79f5f8b33 100644 --- a/editeng/inc/editeng/pgrditem.hxx +++ b/editeng/inc/editeng/pgrditem.hxx @@ -36,8 +36,8 @@ // class SvxParaGridItem ------------------------------------------------- -/* - [Beschreibung] +/* [Description] + Paragraph snap to grid */ @@ -46,13 +46,13 @@ class EDITENG_DLLPUBLIC SvxParaGridItem : public SfxBoolItem public: TYPEINFO(); - SvxParaGridItem( const BOOL bSnapToGrid /*= TRUE*/, - const USHORT nId ); + SvxParaGridItem( const sal_Bool bSnapToGrid /*= sal_True*/, + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/pmdlitem.hxx b/editeng/inc/editeng/pmdlitem.hxx index a474e287b2..fa5a38c3a3 100644 --- a/editeng/inc/editeng/pmdlitem.hxx +++ b/editeng/inc/editeng/pmdlitem.hxx @@ -35,22 +35,22 @@ // class SvxPageModelItem ------------------------------------------------ -/* -[Beschreibung] -Dieses Item enthaelt einen Namen einer Seitenvorlage. +/* [Description] + + This item contains a name of a page template. */ class EDITENG_DLLPUBLIC SvxPageModelItem : public SfxStringItem { private: - BOOL bAuto; + sal_Bool bAuto; public: TYPEINFO(); - inline SvxPageModelItem( USHORT nWh ); - inline SvxPageModelItem( const String& rModel, BOOL bA /*= FALSE*/, - USHORT nWh ); + inline SvxPageModelItem( sal_uInt16 nWh ); + inline SvxPageModelItem( const String& rModel, sal_Bool bA /*= sal_False*/, + sal_uInt16 nWh ); inline SvxPageModelItem& operator=( const SvxPageModelItem& rModel ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; @@ -60,19 +60,19 @@ public: SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); - BOOL IsAuto() const { return bAuto; } + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + sal_Bool IsAuto() const { return bAuto; } }; -inline SvxPageModelItem::SvxPageModelItem( USHORT nWh ) - : bAuto( FALSE ) +inline SvxPageModelItem::SvxPageModelItem( sal_uInt16 nWh ) + : bAuto( sal_False ) { SetWhich( nWh ); } -inline SvxPageModelItem::SvxPageModelItem( const String& rModel, BOOL bA, - USHORT nWh ) : +inline SvxPageModelItem::SvxPageModelItem( const String& rModel, sal_Bool bA, + sal_uInt16 nWh ) : SfxStringItem( nWh, rModel ), bAuto( bA ) {} diff --git a/editeng/inc/editeng/postitem.hxx b/editeng/inc/editeng/postitem.hxx index 2b0e8639fc..6f55626e85 100644 --- a/editeng/inc/editeng/postitem.hxx +++ b/editeng/inc/editeng/postitem.hxx @@ -42,9 +42,9 @@ namespace rtl // class SvxPostureItem -------------------------------------------------- -/* - [Beschreibung] - Dieses Item beschreibt die Font-Stellung (Italic) +/* [Description] + + This item describes the font setting (Italic) */ class EDITENG_DLLPUBLIC SvxPostureItem : public SfxEnumItem @@ -53,26 +53,26 @@ public: TYPEINFO(); SvxPostureItem( const FontItalic ePost /*= ITALIC_NONE*/, - const USHORT nId ); + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + SwEnumItem + // "pure virtual Methods" from SfxPoolItem + SwEnumItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - virtual String GetValueTextByPos( USHORT nPos ) const; - virtual USHORT GetValueCount() const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual int HasBoolValue() const; - virtual BOOL GetBoolValue() const; - virtual void SetBoolValue( BOOL bVal ); + virtual sal_Bool GetBoolValue() const; + virtual void SetBoolValue( sal_Bool bVal ); inline SvxPostureItem& operator=(const SvxPostureItem& rPost) { SetValue( rPost.GetValue() ); @@ -83,7 +83,7 @@ public: FontItalic GetPosture() const { return (FontItalic)GetValue(); } void SetPosture( FontItalic eNew ) - { SetValue( (USHORT)eNew ); } + { SetValue( (sal_uInt16)eNew ); } }; #endif // #ifndef _SVX_POSTITEM_HXX diff --git a/editeng/inc/editeng/prntitem.hxx b/editeng/inc/editeng/prntitem.hxx index d05b9355db..57735fb55a 100644 --- a/editeng/inc/editeng/prntitem.hxx +++ b/editeng/inc/editeng/prntitem.hxx @@ -38,9 +38,9 @@ // class SvxPrintItem ---------------------------------------------------- -/* -[Beschreibung] -Dieses Item beschreibt eine logische Variable "Drucken ja oder nein". +/* [Description] + + This item describes a logical variable "Print yes or no". */ @@ -49,13 +49,13 @@ class EDITENG_DLLPUBLIC SvxPrintItem : public SfxBoolItem public: TYPEINFO(); - SvxPrintItem( const USHORT nId , const BOOL bPrt = TRUE ); + SvxPrintItem( const sal_uInt16 nId , const sal_Bool bPrt = sal_True ); inline SvxPrintItem &operator=( const SvxPrintItem &rCpy ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -63,7 +63,7 @@ public: String &rText, const IntlWrapper * = 0 ) const; }; -inline SvxPrintItem::SvxPrintItem( const USHORT nId, const BOOL bPrt ) +inline SvxPrintItem::SvxPrintItem( const sal_uInt16 nId, const sal_Bool bPrt ) : SfxBoolItem( nId, bPrt ) {} diff --git a/editeng/inc/editeng/protitem.hxx b/editeng/inc/editeng/protitem.hxx index dec9414fdc..0d93de7a57 100644 --- a/editeng/inc/editeng/protitem.hxx +++ b/editeng/inc/editeng/protitem.hxx @@ -43,25 +43,24 @@ namespace rtl // class SvxProtectItem -------------------------------------------------- -/* -[Beschreibung] -Dieses Item beschreibt, ob Inhalt, Groesse oder Position geschuetzt werden -sollen. +/* [Description] + + This item describes, if content, size or position should be protected. */ class EDITENG_DLLPUBLIC SvxProtectItem : public SfxPoolItem { - BOOL bCntnt :1; //Inhalt geschuetzt - BOOL bSize :1; //Groesse geschuetzt - BOOL bPos :1; //Position geschuetzt + sal_Bool bCntnt :1; // Content protected + sal_Bool bSize :1; // Size protected + sal_Bool bPos :1; // Position protected public: TYPEINFO(); - inline SvxProtectItem( const USHORT nId ); + inline SvxProtectItem( const sal_uInt16 nId ); inline SvxProtectItem &operator=( const SvxProtectItem &rCpy ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, @@ -71,24 +70,24 @@ public: virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; - - BOOL IsCntntProtected() const { return bCntnt; } - BOOL IsSizeProtected() const { return bSize; } - BOOL IsPosProtected() const { return bPos; } - void SetCntntProtect( BOOL bNew ) { bCntnt = bNew; } - void SetSizeProtect ( BOOL bNew ) { bSize = bNew; } - void SetPosProtect ( BOOL bNew ) { bPos = bNew; } - - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + + sal_Bool IsCntntProtected() const { return bCntnt; } + sal_Bool IsSizeProtected() const { return bSize; } + sal_Bool IsPosProtected() const { return bPos; } + void SetCntntProtect( sal_Bool bNew ) { bCntnt = bNew; } + void SetSizeProtect ( sal_Bool bNew ) { bSize = bNew; } + void SetPosProtect ( sal_Bool bNew ) { bPos = bNew; } + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); }; -inline SvxProtectItem::SvxProtectItem( const USHORT nId ) +inline SvxProtectItem::SvxProtectItem( const sal_uInt16 nId ) : SfxPoolItem( nId ) { - bCntnt = bSize = bPos = FALSE; + bCntnt = bSize = bPos = sal_False; } inline SvxProtectItem &SvxProtectItem::operator=( const SvxProtectItem &rCpy ) diff --git a/editeng/inc/editeng/prszitem.hxx b/editeng/inc/editeng/prszitem.hxx index d0eec00ffb..cc0d3e532f 100644 --- a/editeng/inc/editeng/prszitem.hxx +++ b/editeng/inc/editeng/prszitem.hxx @@ -35,9 +35,9 @@ // class SvxPropSizeItem ------------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt die relative Schriftgroesse. + This item describes the relative Font Size. */ class EDITENG_DLLPUBLIC SvxPropSizeItem : public SfxUInt16Item @@ -45,13 +45,13 @@ class EDITENG_DLLPUBLIC SvxPropSizeItem : public SfxUInt16Item public: TYPEINFO(); - SvxPropSizeItem( const USHORT nPercent /*= 100*/, - const USHORT nID ); + SvxPropSizeItem( const sal_uInt16 nPercent /*= 100*/, + const sal_uInt16 nID ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/scriptspaceitem.hxx b/editeng/inc/editeng/scriptspaceitem.hxx index a2c9b419e9..0357b59904 100644 --- a/editeng/inc/editeng/scriptspaceitem.hxx +++ b/editeng/inc/editeng/scriptspaceitem.hxx @@ -37,7 +37,7 @@ /* [Description] - This item describe the scriptype of the selected text and is only + This item describe the script type of the selected text and is only used for the user interface. */ @@ -50,8 +50,8 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/scripttypeitem.hxx b/editeng/inc/editeng/scripttypeitem.hxx index 45d93ea15d..b15f171c04 100644 --- a/editeng/inc/editeng/scripttypeitem.hxx +++ b/editeng/inc/editeng/scripttypeitem.hxx @@ -38,13 +38,13 @@ /* [Description] - This item describe the scriptype of the selected text and is only + This item describes the script type of the selected text and is only used for the user interface. */ -EDITENG_DLLPUBLIC USHORT GetI18NScriptTypeOfLanguage( USHORT nLang ); -USHORT GetItemScriptType( short nI18NType ); -short GetI18NScriptType( USHORT nItemType ); +EDITENG_DLLPUBLIC sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang ); +sal_uInt16 GetItemScriptType( short nI18NType ); +short GetI18NScriptType( sal_uInt16 nItemType ); class EDITENG_DLLPUBLIC SvxScriptTypeItem : public SfxUInt16Item { @@ -61,30 +61,30 @@ class EDITENG_DLLPUBLIC SvxScriptSetItem : public SfxSetItem public: TYPEINFO(); - SvxScriptSetItem( USHORT nSlotId, SfxItemPool& rPool ); + SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream &, USHORT nVersion ) const; + virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const; static const SfxPoolItem* GetItemOfScriptSet( const SfxItemSet& rSet, - USHORT nWhich ); - inline const SfxPoolItem* GetItemOfScriptSet( USHORT _nWhich ) const + sal_uInt16 nWhich ); + inline const SfxPoolItem* GetItemOfScriptSet( sal_uInt16 _nWhich ) const { return SvxScriptSetItem::GetItemOfScriptSet( GetItemSet(), _nWhich ); } - static const SfxPoolItem* GetItemOfScript( USHORT nSlotId, const SfxItemSet& rSet, USHORT nScript ); + static const SfxPoolItem* GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript ); - const SfxPoolItem* GetItemOfScript( USHORT nScript ) const; + const SfxPoolItem* GetItemOfScript( sal_uInt16 nScript ) const; - void PutItemForScriptType( USHORT nScriptType, const SfxPoolItem& rItem ); + void PutItemForScriptType( sal_uInt16 nScriptType, const SfxPoolItem& rItem ); - static void GetWhichIds( USHORT nSlotId, const SfxItemSet& rSet, USHORT& rLatin, USHORT& rAsian, USHORT& rComplex); + static void GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex); - void GetWhichIds( USHORT& rLatin, USHORT& rAsian, USHORT& rComplex) const; + void GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex) const; - static void GetSlotIds( USHORT nSlotId, USHORT& rLatin, USHORT& rAsian, - USHORT& rComplex ); - inline void GetSlotIds( USHORT& rLatin, USHORT& rAsian, - USHORT& rComplex ) const + static void GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin, sal_uInt16& rAsian, + sal_uInt16& rComplex ); + inline void GetSlotIds( sal_uInt16& rLatin, sal_uInt16& rAsian, + sal_uInt16& rComplex ) const { GetSlotIds( Which(), rLatin, rAsian, rComplex ); } }; diff --git a/editeng/inc/editeng/shaditem.hxx b/editeng/inc/editeng/shaditem.hxx index 1ecaa39917..570c86f336 100644 --- a/editeng/inc/editeng/shaditem.hxx +++ b/editeng/inc/editeng/shaditem.hxx @@ -42,34 +42,34 @@ namespace rtl // class SvxShadowItem --------------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt ein Schattenattribut (Farbe, Breite, Lage). + This item describes the shadow attribute (color, width and position). */ -#define SHADOW_TOP ((USHORT)0) -#define SHADOW_BOTTOM ((USHORT)1) -#define SHADOW_LEFT ((USHORT)2) -#define SHADOW_RIGHT ((USHORT)3) +#define SHADOW_TOP ((sal_uInt16)0) +#define SHADOW_BOTTOM ((sal_uInt16)1) +#define SHADOW_LEFT ((sal_uInt16)2) +#define SHADOW_RIGHT ((sal_uInt16)3) class EDITENG_DLLPUBLIC SvxShadowItem : public SfxEnumItemInterface { Color aShadowColor; - USHORT nWidth; + sal_uInt16 nWidth; SvxShadowLocation eLocation; public: TYPEINFO(); - SvxShadowItem( const USHORT nId , - const Color *pColor = 0, const USHORT nWidth = 100 /*5pt*/, + SvxShadowItem( const sal_uInt16 nId , + const Color *pColor = 0, const sal_uInt16 nWidth = 100 /*5pt*/, const SvxShadowLocation eLoc = SVX_SHADOW_NONE ); inline SvxShadowItem& operator=( const SvxShadowItem& rFmtShadow ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -77,27 +77,27 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; - virtual bool ScaleMetrics( long nMult, long nDiv ); - virtual bool HasMetrics() const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; const Color& GetColor() const { return aShadowColor;} void SetColor( const Color &rNew ) { aShadowColor = rNew; } - USHORT GetWidth() const { return nWidth; } + sal_uInt16 GetWidth() const { return nWidth; } SvxShadowLocation GetLocation() const { return eLocation; } - void SetWidth( USHORT nNew ) { nWidth = nNew; } + void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; } void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; } - //Breite des Schattens auf der jeweiligen Seite berechnen. - USHORT CalcShadowSpace( USHORT nShadow ) const; + // Calculate width of the shadow on the page. + sal_uInt16 CalcShadowSpace( sal_uInt16 nShadow ) const; - virtual USHORT GetValueCount() const; - virtual String GetValueTextByPos( USHORT nPos ) const; - virtual USHORT GetEnumValue() const; - virtual void SetEnumValue( USHORT nNewVal ); + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetEnumValue() const; + virtual void SetEnumValue( sal_uInt16 nNewVal ); }; inline SvxShadowItem &SvxShadowItem::operator=( const SvxShadowItem& rFmtShadow ) diff --git a/editeng/inc/editeng/shdditem.hxx b/editeng/inc/editeng/shdditem.hxx index ec47d7e4e5..01019debc1 100644 --- a/editeng/inc/editeng/shdditem.hxx +++ b/editeng/inc/editeng/shdditem.hxx @@ -41,9 +41,9 @@ namespace rtl // class SvxShadowedItem ------------------------------------------------- -/* - [Beschreibung] - Dieses Item beschreibt, ob und wie schattiert ist. +/* [Description] + + This item describes, whether and how it is shaded. */ class EDITENG_DLLPUBLIC SvxShadowedItem : public SfxBoolItem @@ -51,13 +51,13 @@ class EDITENG_DLLPUBLIC SvxShadowedItem : public SfxBoolItem public: TYPEINFO(); - SvxShadowedItem( const BOOL bShadowed /*= FALSE*/, - const USHORT nId ); + SvxShadowedItem( const sal_Bool bShadowed /*= sal_False*/, + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/sizeitem.hxx b/editeng/inc/editeng/sizeitem.hxx index a3b71805c7..967995e68c 100644 --- a/editeng/inc/editeng/sizeitem.hxx +++ b/editeng/inc/editeng/sizeitem.hxx @@ -36,9 +36,9 @@ // class SvxSizeItem ----------------------------------------------------- -/* -[Beschreibung] -Dieses Item beschreibt eine zweidimensionale Groesse (Size). +/* [Description] + + This item describes a two-dimensional size. */ class EDITENG_DLLPUBLIC SvxSizeItem : public SfxPoolItem @@ -49,15 +49,15 @@ class EDITENG_DLLPUBLIC SvxSizeItem : public SfxPoolItem public: TYPEINFO(); - SvxSizeItem( const USHORT nId ); - SvxSizeItem( const USHORT nId, const Size& rSize); + SvxSizeItem( const sal_uInt16 nId ); + SvxSizeItem( const sal_uInt16 nId, const Size& rSize); inline SvxSizeItem& operator=( const SvxSizeItem &rCpy ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -65,10 +65,10 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; - virtual bool ScaleMetrics( long nMult, long nDiv ); - virtual bool HasMetrics() const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; const Size& GetSize() const { return aSize; } void SetSize(const Size& rSize) { aSize = rSize; } diff --git a/editeng/inc/editeng/spltitem.hxx b/editeng/inc/editeng/spltitem.hxx index 311f0e14f0..4b3c0c6d27 100644 --- a/editeng/inc/editeng/spltitem.hxx +++ b/editeng/inc/editeng/spltitem.hxx @@ -41,9 +41,9 @@ namespace rtl // class SvxFmtSplitItem ------------------------------------------------- -/* -[Beschreibung] -Dieses Item beschreibt eine logische Variable "Absatz trennen ja oder nein". +/* [Description] + + This item describes a logical variable "split paragraph yes or no". */ class EDITENG_DLLPUBLIC SvxFmtSplitItem : public SfxBoolItem @@ -52,14 +52,14 @@ public: TYPEINFO(); ~SvxFmtSplitItem(); - inline SvxFmtSplitItem( const BOOL bSplit /*= TRUE*/, - const USHORT nWh ); + inline SvxFmtSplitItem( const sal_Bool bSplit /*= sal_True*/, + const sal_uInt16 nWh ); inline SvxFmtSplitItem& operator=( const SvxFmtSplitItem& rSplit ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT ) const; - virtual SvStream& Store( SvStream& , USHORT nItemVersion ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -67,7 +67,7 @@ public: String &rText, const IntlWrapper * = 0 ) const; }; -inline SvxFmtSplitItem::SvxFmtSplitItem( const BOOL bSplit, const USHORT nWh ) : +inline SvxFmtSplitItem::SvxFmtSplitItem( const sal_Bool bSplit, const sal_uInt16 nWh ) : SfxBoolItem( nWh, bSplit ) {} diff --git a/editeng/inc/editeng/splwrap.hxx b/editeng/inc/editeng/splwrap.hxx index 67d03a7b77..bc45535d96 100644 --- a/editeng/inc/editeng/splwrap.hxx +++ b/editeng/inc/editeng/splwrap.hxx @@ -50,7 +50,7 @@ class Window; void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect( String &rOldText, String &rNewText ); /*-------------------------------------------------------------------- - Beschreibung: Der SpellWrapper + Description: The SpellWrapper --------------------------------------------------------------------*/ class EDITENG_DLLPUBLIC SvxSpellWrapper { @@ -66,21 +66,21 @@ private: ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > xHyph; - sal_uInt16 nOldLang; // Sprache merken, nur bei Aenderung SetLanguage rufen - sal_Bool bOtherCntnt : 1; // gesetzt => Sonderbereiche zunaechst pruefen - sal_Bool bDialog : 1; // Ist pWin der Svx...Dialog? - sal_Bool bHyphen : 1; // Trennen statt Spellen - sal_Bool bAuto : 1; // Autokorrektur vorhanden? - sal_Bool bReverse : 1; // Rueckwaerts Spellen - sal_Bool bStartDone : 1; // Vorderen Teil bereits korrigiert - sal_Bool bEndDone : 1; // Hinteren Teil bereits korrigiert - sal_Bool bStartChk : 1; // Vorderen Teil pruefen - sal_Bool bRevAllowed : 1; // Niemals rueckwaerts spellen - sal_Bool bAllRight : 1; // falsche Woerter in geignetes Woerterbuch - // aufnehmen und nicht den Dialog starten. - - EDITENG_DLLPRIVATE sal_Bool SpellNext(); // naechsten Bereich anwaehlen - sal_Bool FindSpellError(); // Suche nach Fehlern ( ueber Bereiche hinweg ) + sal_uInt16 nOldLang; // Set Language, only call SetLanguage on changes + sal_Bool bOtherCntnt : 1; // set => Check special sections initially + sal_Bool bDialog : 1; // Is pWin the Svx...Dialog? + sal_Bool bHyphen : 1; // Split instead of spell checking + sal_Bool bAuto : 1; // AutoCorrect available? + sal_Bool bReverse : 1; // Reverse spell check + sal_Bool bStartDone : 1; // Beginning already corrected + sal_Bool bEndDone : 1; // End part already corrected + sal_Bool bStartChk : 1; // Examine the beginning + sal_Bool bRevAllowed : 1; // Reverse spell check prohibited + sal_Bool bAllRight : 1; // Record wrong words in the dedicated + // dictionary and do not start the dialog. + + EDITENG_DLLPRIVATE sal_Bool SpellNext(); // select next area + sal_Bool FindSpellError(); // Check for errors (over areas) public: SvxSpellWrapper( Window* pWn, @@ -106,12 +106,12 @@ public: static void ShowLanguageErrors(); - void SpellDocument(); // Rechtschreibpruefung durchfuehren + void SpellDocument(); // Perform Spell Checking inline sal_Bool IsStartDone(){ return bStartDone; } inline sal_Bool IsEndDone(){ return bEndDone; } inline sal_Bool IsReverse(){ return bReverse; } inline sal_Bool IsDialog(){ return bDialog; } // SvxSpellCheckDialog OnScreen - inline sal_Bool IsHyphen(){ return bHyphen; } // Trennen statt Spellen + inline sal_Bool IsHyphen(){ return bHyphen; } // Split instead of Spell check inline void SetHyphen( const sal_Bool bNew = sal_True ){ bHyphen = bNew; } inline ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > @@ -121,10 +121,10 @@ public: GetXHyphenator() { return xHyph; } inline sal_Bool IsAllRight() { return bAllRight; } inline Window* GetWin() { return pWin; } - // kann evtl entfallen in ONE_LINGU: + // can possibly be omitted in ONE_LINGU: inline void SetOldLang( const sal_uInt16 nNew ){ nOldLang = nNew; } - // kann evtl entfallen in ONE_LINGU: - inline void ChangeLanguage( const sal_uInt16 nNew ) // rufe ggf. SetLanguage + // can possibly be omitted in ONE_LINGU: + inline void ChangeLanguage( const sal_uInt16 nNew ) // call SetLanguage if needed. { if ( nNew != nOldLang ) { SetLanguage( nNew ); nOldLang = nNew; } } inline void EnableAutoCorrect() { bAuto = sal_True; } @@ -135,26 +135,26 @@ protected: void SetLast(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > &xNewLast) { xLast = xNewLast; } - virtual sal_Bool SpellMore(); // weitere Dokumente pruefen? - virtual sal_Bool HasOtherCnt(); // gibt es ueberhaupt Sonderbereiche - virtual void SpellStart( SvxSpellArea eSpell ); // Bereich vorbereiten - virtual sal_Bool SpellContinue(); // Bereich pruefen - // Ergebnis mit GetLast verfuegbar - virtual void ReplaceAll( const String &rNewText, sal_Int16 nLanguage ); // Wort aus Replace-Liste ersetzen - virtual void StartThesaurus( const String &rWord, sal_uInt16 nLang ); // Thesaurus starten + virtual sal_Bool SpellMore(); // examine further documents? + virtual sal_Bool HasOtherCnt(); // Are there any special areas? + virtual void SpellStart( SvxSpellArea eSpell ); // Preparing the area + virtual sal_Bool SpellContinue(); // Check Areas + // Result avaliable through GetLast + virtual void ReplaceAll( const String &rNewText, sal_Int16 nLanguage ); //Replace word from the replace list + virtual void StartThesaurus( const String &rWord, sal_uInt16 nLang ); virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetAllRightDic() const; - virtual void SpellEnd(); // Bereich abschliessen - virtual void ScrollArea(); // ScrollArea einstellen - // Wort ersetzen + virtual void SpellEnd(); // Finish area + virtual void ScrollArea(); // Set ScrollArea + // Replace word virtual void ChangeWord( const String& rNewWord, const sal_uInt16 nLang ); virtual String GetThesWord(); // Wort via Thesaurus ersetzen virtual void ChangeThesWord( const String& rNewWord ); - virtual void SetLanguage( const sal_uInt16 nLang ); // Sprache aendern + virtual void SetLanguage( const sal_uInt16 nLang ); // Change Language virtual void AutoCorrect( const String& rAktStr, const String& rNewStr ); - virtual void InsertHyphen( const sal_uInt16 nPos ); // Hyphen einfuegen + virtual void InsertHyphen( const sal_uInt16 nPos ); // Insert hyphen }; diff --git a/editeng/inc/editeng/svxacorr.hxx b/editeng/inc/editeng/svxacorr.hxx index fe8b7ca4ba..3f2ae90c56 100644 --- a/editeng/inc/editeng/svxacorr.hxx +++ b/editeng/inc/editeng/svxacorr.hxx @@ -50,82 +50,81 @@ class SotStorageRef; class SotStorage; class Window; -// Flags fuer die AutoKorrekt-Flags -const long CptlSttSntnc = 0x00000001; // Gross-Buchstaben am SatzAnfang -const long CptlSttWrd = 0x00000002; // keine 2 Gr.-Buchst. am WordAnfang +// Auto correct flags +const long CptlSttSntnc = 0x00000001; // Capital letters at the beginning of a sentence +const long CptlSttWrd = 0x00000002; // not two Capital letters at the beginning of a word const long AddNonBrkSpace = 0x00000004; // Add non breaking space before :;?! const long ChgOrdinalNumber = 0x00000008; // Ordinal-Number 1st, 2nd,.. const long ChgToEnEmDash = 0x00000010; // - -> Endash/Emdash -const long ChgWeightUnderl = 0x00000020; // * -> Fett, _ -> unterstreichen -const long SetINetAttr = 0x00000040; // INetAttribut setzen -const long Autocorrect = 0x00000080; // Autokorrektur aufrufen -const long ChgQuotes = 0x00000100; // doppelte Quotes ersetzen -const long SaveWordCplSttLst= 0x00000200; // GrB. am SatzAnf. auto. aufnehmen -const long SaveWordWrdSttLst= 0x00000400; // 2 GrB. am WortAnf. auto. aufnehmen -const long IgnoreDoubleSpace= 0x00000800; // 2 Spaces ignorieren -const long ChgSglQuotes = 0x00001000; // einfache Quotes ersetzen +const long ChgWeightUnderl = 0x00000020; // * -> Bold, _ -> Underscore +const long SetINetAttr = 0x00000040; // Set INetAttribut +const long Autocorrect = 0x00000080; // Call AutoCorrect +const long ChgQuotes = 0x00000100; // replace double quotes +const long SaveWordCplSttLst= 0x00000200; // Save Auto correction of Capital letter at beginning of sentence. +const long SaveWordWrdSttLst= 0x00000400; // Save Auto correction of 2 Capital letter at beginning of word. +const long IgnoreDoubleSpace= 0x00000800; // Ignore 2 Spaces +const long ChgSglQuotes = 0x00001000; // Replace simple quotes const long CorrectCapsLock = 0x00002000; // Correct accidental use of cAPS LOCK key -const long ChgWordLstLoad = 0x20000000; // Ersetzungsliste geladen -const long CplSttLstLoad = 0x40000000; // Exceptionlist fuer CplStart geladen -const long WrdSttLstLoad = 0x80000000; // Exceptionlist fuer WordStart geladen +const long ChgWordLstLoad = 0x20000000; // Replacement list loaded +const long CplSttLstLoad = 0x40000000; // Exception list for Capital letters Start loaded +const long WrdSttLstLoad = 0x80000000; // Exception list for Word Start loaded // TODO: handle unicodes > U+FFFF and check users of this class -// nur eine Mappingklasse +// only a mapping class class EDITENG_DLLPUBLIC SvxAutoCorrDoc { public: SvxAutoCorrDoc() {} virtual ~SvxAutoCorrDoc(); - virtual BOOL Delete( xub_StrLen nStt, xub_StrLen nEnd ) = 0; - virtual BOOL Insert( xub_StrLen nPos, const String& rTxt ) = 0; - virtual BOOL Replace( xub_StrLen nPos, const String& rTxt ) = 0; + virtual sal_Bool Delete( xub_StrLen nStt, xub_StrLen nEnd ) = 0; + virtual sal_Bool Insert( xub_StrLen nPos, const String& rTxt ) = 0; + virtual sal_Bool Replace( xub_StrLen nPos, const String& rTxt ) = 0; + virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt ) = 0; - virtual BOOL SetAttr( xub_StrLen nStt, xub_StrLen nEnd, USHORT nSlotId, + virtual sal_Bool SetAttr( xub_StrLen nStt, xub_StrLen nEnd, sal_uInt16 nSlotId, SfxPoolItem& ) = 0; - virtual BOOL SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const String& rURL ) = 0; + virtual sal_Bool SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const String& rURL ) = 0; - // returne den Text eines vorherigen Absatzes. - // Dieser darf nicht leer sein! - // Gibt es diesen nicht oder gibt es davor nur Leere, dann returne 0 - // Das Flag gibt an: - // TRUE: den, vor der normalen Einfuegeposition (TRUE) - // FALSE: den, in den das korrigierte Wort eingfuegt wurde. - // (Muss nicht der gleiche Absatz sein!!!!) - virtual const String* GetPrevPara( BOOL bAtNormalPos ) = 0; + // Return the text of a previous paragraph. This must not be empty! + // If no paragraph exits or just an empty one, then return 0. + // The flag indicates: + // TRUE: before the normal insertion position (TRUE) + // FALSE: in which the corrected word was inserted. + // (Does not to have to be the same paragraph !!!!) + virtual const String* GetPrevPara( sal_Bool bAtNormalPos ) = 0; - virtual BOOL ChgAutoCorrWord( xub_StrLen& rSttPos, xub_StrLen nEndPos, + virtual sal_Bool ChgAutoCorrWord( xub_StrLen& rSttPos, xub_StrLen nEndPos, SvxAutoCorrect& rACorrect, const String** ppPara ) = 0; - // wird nach dem austauschen der Zeichen von den Funktionen + // Is called after the change of the signs by the functions // - FnCptlSttWrd // - FnCptlSttSntnc - // gerufen. Dann koennen die Worte ggfs. in die Ausnahmelisten - // aufgenommen werden. - virtual void SaveCpltSttWord( ULONG nFlag, xub_StrLen nPos, + // As an option, the words can then be inserted into the exception lists. + virtual void SaveCpltSttWord( sal_uLong nFlag, xub_StrLen nPos, const String& rExceptWord, sal_Unicode cChar ); - // welche Sprache gilt an der Position? - virtual LanguageType GetLanguage( xub_StrLen nPos, BOOL bPrevPara = FALSE ) const; + // which language at the position? + virtual LanguageType GetLanguage( xub_StrLen nPos, sal_Bool bPrevPara = sal_False ) const; }; class EDITENG_DLLPUBLIC SvxAutocorrWord { String sShort, sLong; - BOOL bIsTxtOnly; // ist reiner ASCII - Text + sal_Bool bIsTxtOnly; // Is pure ASCII - Text public: - SvxAutocorrWord( const String& rS, const String& rL, BOOL bFlag = TRUE ) + SvxAutocorrWord( const String& rS, const String& rL, sal_Bool bFlag = sal_True ) : sShort( rS ), sLong( rL ), bIsTxtOnly( bFlag ) {} const String& GetShort() const { return sShort; } const String& GetLong() const { return sLong; } - BOOL IsTextOnly() const { return bIsTxtOnly; } + sal_Bool IsTextOnly() const { return bIsTxtOnly; } }; typedef SvxAutocorrWord* SvxAutocorrWordPtr; @@ -134,11 +133,11 @@ SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvxAutocorrWordList, SvxAutocorrWordPtr, 10, class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists { String sShareAutoCorrFile, sUserAutoCorrFile; - // falls die AutoCorr Datei neuer ist + // If the AutoCorr file is newer Date aModifiedDate; Time aModifiedTime, aLastCheckTime; - LanguageType eLanguage; //LANGUAGE_DONTKNOW fuer alle Sprachen verwenden + LanguageType eLanguage; //LANGUAGE_DONTKNOW use for all languages SvStringsISortDtor* pCplStt_ExcptLst; SvStringsISortDtor* pWrdStt_ExcptLst; SvxAutocorrWordList* pAutocorr_List; @@ -146,16 +145,16 @@ class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists long nFlags; - BOOL IsFileChanged_Imp(); + sal_Bool IsFileChanged_Imp(); void LoadXMLExceptList_Imp( SvStringsISortDtor*& rpLst, const sal_Char* pStrmName, SotStorageRef& rStg); void SaveExceptList_Imp( const SvStringsISortDtor& rLst, const sal_Char* pStrmName, SotStorageRef& rStg, - BOOL bConvert = FALSE); + sal_Bool bConvert = sal_False); - BOOL MakeBlocklist_Imp( SotStorage& rStg ); + sal_Bool MakeBlocklist_Imp( SotStorage& rStg ); void RemoveStream_Imp( const String& rName ); void MakeUserStorage_Impl(); @@ -166,36 +165,36 @@ public: LanguageType eLang); ~SvxAutoCorrectLanguageLists(); - // Lade, Setze, Gebe - die Ersetzungsliste + // Load, Set, Get - the replacement list SvxAutocorrWordList* LoadAutocorrWordList(); void SetAutocorrWordList( SvxAutocorrWordList* pList ); const SvxAutocorrWordList* GetAutocorrWordList(); - // Lade, Setze, Gebe - die Ausnahmeliste fuer Grossbuchstabe am - // Satzanfang + // Load, Set, Get - the exception list for Capital letter at the + // beginning of a sentence SvStringsISortDtor* LoadCplSttExceptList(); void SaveCplSttExceptList(); void SetCplSttExceptList( SvStringsISortDtor* pList ); SvStringsISortDtor* GetCplSttExceptList(); - BOOL AddToCplSttExceptList(const String& rNew); + sal_Bool AddToCplSttExceptList(const String& rNew); - // Lade, Setze, Gebe die Ausnahmeliste fuer 2 Grossbuchstaben am - // Wortanfang + // Load, Set, Get the exception list for 2 Capital letters at the + // begining of a word. SvStringsISortDtor* LoadWrdSttExceptList(); void SaveWrdSttExceptList(); void SetWrdSttExceptList( SvStringsISortDtor* pList ); SvStringsISortDtor* GetWrdSttExceptList(); - BOOL AddToWrdSttExceptList(const String& rNew); - - // Speichern von Wortersetzungen: - // Diese speichern direkt im Storage. Die Wortliste wird - // entsprechend aktualisiert! - // - purer Text - BOOL PutText( const String& rShort, const String& rLong ); - // - Text mit Attributierung (kann nur der SWG - SWG-Format!) - BOOL PutText( const String& rShort, SfxObjectShell& ); - // - loesche einen Eintrag - BOOL DeleteText( const String& rShort ); + sal_Bool AddToWrdSttExceptList(const String& rNew); + + // Save word substitutions: + // Store these directly in the storage. The word list is updated + // accordingly! + // - pure Text + sal_Bool PutText( const String& rShort, const String& rLong ); + // - Text with attribution (only the SWG - SWG format!) + sal_Bool PutText( const String& rShort, SfxObjectShell& ); + // - Deleting an entry + sal_Bool DeleteText( const String& rShort ); }; @@ -205,9 +204,9 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect String sShareAutoCorrFile, sUserAutoCorrFile; - SvxSwAutoFmtFlags aSwFlags; // StarWriter AutoFormat-Flags + SvxSwAutoFmtFlags aSwFlags; // StarWriter AutoFormat Flags - // alle Sprachen in einer Tabelle + // all languages in a table SvxAutoCorrLanguageTable_Impl* pLangTable; SvxAutoCorrLastFileAskTable_Impl* pLastFileTable; CharClass* pCharClass; @@ -227,21 +226,21 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect void _GetCharClass( LanguageType eLang ); protected: - // - Text mit Attributierung (kann nur der SWG - SWG-Format!) - // rShort ist der Stream-Name - gecryptet! - virtual BOOL PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, SfxObjectShell& , + // - Text with attribution (only the SWG - SWG format!) + // rShort is the stream name - encrypted! + virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, SfxObjectShell& , String& ); - // geforderte Sprache in die Tabelle eintragen gfs. nur wenn das file existiert - BOOL CreateLanguageFile(LanguageType eLang, BOOL bNewFile = TRUE); - // - return den Ersetzungstext (nur fuer SWG-Format, alle anderen - // koennen aus der Wortliste herausgeholt werden!) - // rShort ist der Stream-Name - gecryptet! + // required language in the table add if possible only when the file exists + sal_Bool CreateLanguageFile(LanguageType eLang, sal_Bool bNewFile = sal_True); + // - Return the replacement text (only for SWG format, all others can be + // taken from the word list!) + // rShort is the stream name - encrypted! public: - sal_Unicode GetQuote( sal_Unicode cInsChar, BOOL bSttQuote, + sal_Unicode GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote, LanguageType eLang ) const; - virtual BOOL GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, String& rLong ); + virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, String& rLong ); TYPEINFO(); @@ -250,28 +249,28 @@ public: SvxAutoCorrect( const SvxAutoCorrect& ); virtual ~SvxAutoCorrect(); - // fuehre eine AutoKorrektur aus. - // returnt was ausgefuehrt wurde; entsprechend den obigen Flags - ULONG AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, - xub_StrLen nPos, sal_Unicode cInsChar, BOOL bInsert, Window* pFrameWin = NULL ); + // Execute an AutoCorrect. + // Returns what has been executed, according to the above flags + sal_uLong AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, + xub_StrLen nPos, sal_Unicode cInsChar, sal_Bool bInsert, Window* pFrameWin = NULL ); - // return fuer die Autotext Expandierung das vorherige Wort, was dem - // AutoCorrect - Algorythmus entspricht. - BOOL GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, const String& rTxt, + // Return for the autotext expansion the previous word, + // AutoCorrect - corresponding algorithm + sal_Bool GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nPos, String& rWord ) const; - // suche das oder die Worte in der ErsetzungsTabelle. - // rText - ueberpruefe in diesem Text die Worte der Liste - // rStt - die gefundene Startposition - // nEnd - zu ueberpruefende Position - ab dieser Pos nach vorne - // rLang - Input: in welcher Sprache wird gesucht - // Output: in welcher "Sprach-Liste" wurde es gefunden + // Search for or or the words in the replacement table. + // rText - check in this text the words of the list + // rStt - the detected starting position + // nEnd - to check position - as of this item forward + // rLang - Input: in which language is searched + // Output: in which "language list" was it found const SvxAutocorrWord* SearchWordsInList( const String& rTxt, xub_StrLen& rStt, xub_StrLen nEndPos, SvxAutoCorrDoc& rDoc, LanguageType& rLang ); - // erfrage / setze die Zeichen fuer die Quote-Ersetzung + // Query/Set the Character for the Quote substitution sal_Unicode GetStartSingleQuote() const { return cStartSQuote; } sal_Unicode GetEndSingleQuote() const { return cEndSQuote; } sal_Unicode GetStartDoubleQuote() const { return cStartDQuote; } @@ -283,26 +282,26 @@ public: void SetEndDoubleQuote( const sal_Unicode cEnd ) { cEndDQuote = cEnd; } String GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, - sal_Unicode cInsChar, BOOL bSttQuote ); + sal_Unicode cInsChar, sal_Bool bSttQuote ); void InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, - sal_Unicode cInsChar, BOOL bSttQuote, BOOL bIns ); + sal_Unicode cInsChar, sal_Bool bSttQuote, sal_Bool bIns ); - // erfrage / setze den Namen der AutoKorrektur-Datei - // defaultet auf "autocorr.dat" + // Query/Set the name of the AutoCorrect file + // the default is "autocorr.dat" String GetAutoCorrFileName( LanguageType eLang = LANGUAGE_SYSTEM, - BOOL bNewFile = FALSE, - BOOL bTstUserExist = FALSE ) const; + sal_Bool bNewFile = sal_False, + sal_Bool bTstUserExist = sal_False ) const; void SetUserAutoCorrFileName( const String& rNew ); void SetShareAutoCorrFileName( const String& rNew ); - // erfrage / setze die aktuellen Einstellungen der AutoKorrektur + // Query/Set the current settings of AutoCorrect long GetFlags() const { return nFlags; } inline SvxSwAutoFmtFlags& GetSwFlags() { return aSwFlags;} - BOOL IsAutoCorrFlag( long nFlag ) const - { return nFlags & nFlag ? TRUE : FALSE; } - void SetAutoCorrFlag( long nFlag, BOOL bOn = TRUE ); + sal_Bool IsAutoCorrFlag( long nFlag ) const + { return nFlags & nFlag ? sal_True : sal_False; } + void SetAutoCorrFlag( long nFlag, sal_Bool bOn = sal_True ); - // Lade, Setze, Gebe - die Ersetzungsliste + // Load, Set, Get - the replacement list SvxAutocorrWordList* LoadAutocorrWordList( LanguageType eLang = LANGUAGE_SYSTEM ) { return _GetLanguageList( eLang ).LoadAutocorrWordList(); } @@ -310,21 +309,21 @@ public: LanguageType eLang = LANGUAGE_SYSTEM ) { return _GetLanguageList( eLang ).GetAutocorrWordList(); } - // Speichern von Wortersetzungen: - // Diese speichern direkt im Storage. Die Wortliste wird - // entsprechend aktualisiert! - // - purer Text - BOOL PutText( const String& rShort, const String& rLong, LanguageType eLang = LANGUAGE_SYSTEM ); - // - Text mit Attributierung (kann nur der SWG - SWG-Format!) - BOOL PutText( const String& rShort, SfxObjectShell& rShell, + // Save word substitutions: + // Save these directly in the storage. The word list is updated + // accordingly! + // - pure Text + sal_Bool PutText( const String& rShort, const String& rLong, LanguageType eLang = LANGUAGE_SYSTEM ); + // - Text with attribution (only in the SWG - SWG format!) + sal_Bool PutText( const String& rShort, SfxObjectShell& rShell, LanguageType eLang = LANGUAGE_SYSTEM ) { return _GetLanguageList( eLang ).PutText(rShort, rShell ); } - // - loesche einen Eintrag - BOOL DeleteText( const String& rShort, LanguageType eLang = LANGUAGE_SYSTEM); + // - Delete a entry + sal_Bool DeleteText( const String& rShort, LanguageType eLang = LANGUAGE_SYSTEM); - // Lade, Setze, Gebe - die Ausnahmeliste fuer Grossbuchstabe am - // Satzanfang + // Load, Set, Get - the exception list for capital letters at the + // beginning of a sentence void SaveCplSttExceptList( LanguageType eLang = LANGUAGE_SYSTEM ); SvStringsISortDtor* LoadCplSttExceptList( LanguageType eLang = LANGUAGE_SYSTEM) @@ -333,13 +332,12 @@ public: LanguageType eLang = LANGUAGE_SYSTEM ) { return _GetLanguageList( eLang ).GetCplSttExceptList(); } - // fuegt ein einzelnes Wort hinzu. Die Liste wird sofort - // in die Datei geschrieben! - BOOL AddCplSttException( const String& rNew, + // Adds a single word. The list will be immediately written to the file! + sal_Bool AddCplSttException( const String& rNew, LanguageType eLang = LANGUAGE_SYSTEM ); - // Lade, Setze, Gebe die Ausnahmeliste fuer 2 Grossbuchstaben am - // Wortanfang + // Load, Set, Get the exception list for 2 Capital letters at the + // beginning of a word. void SaveWrdSttExceptList( LanguageType eLang = LANGUAGE_SYSTEM ); SvStringsISortDtor* LoadWrdSttExceptList( LanguageType eLang = LANGUAGE_SYSTEM ) @@ -347,35 +345,34 @@ public: const SvStringsISortDtor* GetWrdSttExceptList( LanguageType eLang = LANGUAGE_SYSTEM ) { return _GetLanguageList( eLang ).GetWrdSttExceptList(); } - // fuegt ein einzelnes Wort hinzu. Die Liste wird sofort - // in die Datei geschrieben! - BOOL AddWrtSttException( const String& rNew, LanguageType eLang = LANGUAGE_SYSTEM); + // Adds a single word. The list will be immediately written to the file! + sal_Bool AddWrtSttException( const String& rNew, LanguageType eLang = LANGUAGE_SYSTEM); - //ueber die Sprachen nach dem Eintrag suchen - BOOL FindInWrdSttExceptList( LanguageType eLang, const String& sWord ); - BOOL FindInCplSttExceptList( LanguageType eLang, const String& sWord, - BOOL bAbbreviation = FALSE); + // Search through the Languages for the entry + sal_Bool FindInWrdSttExceptList( LanguageType eLang, const String& sWord ); + sal_Bool FindInCplSttExceptList( LanguageType eLang, const String& sWord, + sal_Bool bAbbreviation = sal_False); - // die einzelnen Methoden fuer die Autokorrektur - BOOL FnCptlSttWrd( SvxAutoCorrDoc&, const String&, + // Methods for the auto-correction + sal_Bool FnCptlSttWrd( SvxAutoCorrDoc&, const String&, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM ); - BOOL FnChgOrdinalNumber( SvxAutoCorrDoc&, const String&, + sal_Bool FnChgOrdinalNumber( SvxAutoCorrDoc&, const String&, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM ); - BOOL FnChgToEnEmDash( SvxAutoCorrDoc&, const String&, + sal_Bool FnChgToEnEmDash( SvxAutoCorrDoc&, const String&, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM ); - BOOL FnAddNonBrkSpace( SvxAutoCorrDoc&, const String&, + sal_Bool FnAddNonBrkSpace( SvxAutoCorrDoc&, const String&, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM ); - BOOL FnSetINetAttr( SvxAutoCorrDoc&, const String&, + sal_Bool FnSetINetAttr( SvxAutoCorrDoc&, const String&, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM ); - BOOL FnChgWeightUnderl( SvxAutoCorrDoc&, const String&, + sal_Bool FnChgWeightUnderl( SvxAutoCorrDoc&, const String&, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM ); - BOOL FnCptlSttSntnc( SvxAutoCorrDoc&, const String&, BOOL bNormalPos, + sal_Bool FnCptlSttSntnc( SvxAutoCorrDoc&, const String&, sal_Bool bNormalPos, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM); bool FnCorrectCapsLock( SvxAutoCorrDoc&, const String&, @@ -386,7 +383,7 @@ public: static long GetDefaultFlags(); -// returns TRUE for charcters where the function +// returns sal_True for charcters where the function // 'SvxAutoCorrect::AutoCorrect' should be called. // (used to avoid occasional 'collisions' with (Thai) input-sequence-checking) static sal_Bool IsAutoCorrectChar( sal_Unicode cChar ); diff --git a/editeng/inc/editeng/svxenum.hxx b/editeng/inc/editeng/svxenum.hxx index 37f0276aa1..f9305e0f76 100644 --- a/editeng/inc/editeng/svxenum.hxx +++ b/editeng/inc/editeng/svxenum.hxx @@ -202,23 +202,23 @@ enum SvxSpellArea enum SvxFrameAnchor { - SVX_FLY_AT_CNTNT, //Absatzgebundener Rahmen - SVX_FLY_IN_CNTNT, //Zeichengebundener Rahmen - SVX_FLY_PAGE //Seitengebundener Rahmen + SVX_FLY_AT_CNTNT, // Paragraph-based frame + SVX_FLY_IN_CNTNT, // Character-based frame + SVX_FLY_PAGE // Page-based frame }; enum SvxExtNumType { - SVX_NUM_CHARS_UPPER_LETTER, // zaehlt von a-z, aa - az, ba - bz, ... + SVX_NUM_CHARS_UPPER_LETTER, // Counts from a-z, aa - az, ba - bz, ... SVX_NUM_CHARS_LOWER_LETTER, SVX_NUM_ROMAN_UPPER, SVX_NUM_ROMAN_LOWER, SVX_NUM_ARABIC, SVX_NUM_NUMBER_NONE, - SVX_NUM_CHAR_SPECIAL, //Bullet - SVX_NUM_PAGEDESC, // Numerierung aus der Seitenvorlage + SVX_NUM_CHAR_SPECIAL, // Bullet + SVX_NUM_PAGEDESC, // Numbering from the page template SVX_NUM_BITMAP, - SVX_NUM_CHARS_UPPER_LETTER_N, // zaehlt von a-z, aa-zz, aaa-zzz + SVX_NUM_CHARS_UPPER_LETTER_N, // Counts from a-z, aa-zz, aaa-zzz SVX_NUM_CHARS_LOWER_LETTER_N }; diff --git a/editeng/inc/editeng/svxfont.hxx b/editeng/inc/editeng/svxfont.hxx index 120dd2c03c..fbfe9de3c8 100644 --- a/editeng/inc/editeng/svxfont.hxx +++ b/editeng/inc/editeng/svxfont.hxx @@ -34,6 +34,10 @@ #include <vcl/font.hxx> #include "editeng/editengdllapi.h" +// Percentage of height of lower case small capital letters compared to upper case letters +// See i#1526# for full explanation +#define SMALL_CAPS_PERCENTAGE 80 + class SvxDoCapitals; class OutputDevice; class Printer; @@ -41,9 +45,9 @@ class Printer; class EDITENG_DLLPUBLIC SvxFont : public Font { LanguageType eLang; // Language - SvxCaseMap eCaseMap; // Textauszeichnung - short nEsc; // Grad der Hoch-/Tiefstellung - BYTE nPropr; // Grad der Verkleinerung der Fonthoehe + SvxCaseMap eCaseMap; // Text Markup + short nEsc; // Degree of Superscript/Subscript + sal_uInt8 nPropr; // Degree of reduction of the font height short nKern; // Kerning in Pt public: @@ -51,14 +55,14 @@ public: SvxFont( const Font &rFont ); SvxFont( const SvxFont &rFont ); - // Methoden fuer die Hoch-/Tiefstellung + // Methods for Superscript/Subscript inline short GetEscapement() const { return nEsc; } inline void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; } - inline BYTE GetPropr() const { return nPropr; } - inline void SetPropr( const BYTE nNewPropr ) { nPropr = nNewPropr; } - inline void SetProprRel( const BYTE nNewPropr ) - { SetPropr( (BYTE)( (long)nNewPropr * (long)nPropr / 100L ) ); } + inline sal_uInt8 GetPropr() const { return nPropr; } + inline void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; } + inline void SetProprRel( const sal_uInt8 nNewPropr ) + { SetPropr( (sal_uInt8)( (long)nNewPropr * (long)nPropr / 100L ) ); } // Kerning inline short GetFixKerning() const { return nKern; } @@ -71,54 +75,53 @@ public: inline void SetLanguage( const LanguageType eNewLan ) { eLang = eNewLan; Font::SetLanguage(eNewLan); } - // Is-Methoden: - inline BOOL IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; } - inline BOOL IsCapital() const { return SVX_CASEMAP_KAPITAELCHEN == eCaseMap; } - inline BOOL IsKern() const { return 0 != nKern; } - inline BOOL IsEsc() const { return 0 != nEsc; } + // Is-Methods: + inline sal_Bool IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; } + inline sal_Bool IsCapital() const { return SVX_CASEMAP_KAPITAELCHEN == eCaseMap; } + inline sal_Bool IsKern() const { return 0 != nKern; } + inline sal_Bool IsEsc() const { return 0 != nEsc; } - // Versalien, Gemeine etc. beruecksichtigen + // Consider Upper case, Lower case letters etc. String CalcCaseMap( const String &rTxt ) const; -// Der folgende Bereich wird nicht von jedem benoetigt, er kann deshalb -// ausgeklammert werden. +// The following section is not needed by anyone, so it can be excluded. #ifndef REDUCEDSVXFONT - // Kapitaelchenbearbeitung + // Handle upper case letters void DoOnCapitals( SvxDoCapitals &rDo, - const USHORT nPartLen = USHRT_MAX ) const; + const sal_uInt16 nPartLen = USHRT_MAX ) const; void SetPhysFont( OutputDevice *pOut ) const; Font ChgPhysFont( OutputDevice *pOut ) const; Size GetCapitalSize( const OutputDevice *pOut, const String &rTxt, - const USHORT nIdx, const USHORT nLen) const; + const sal_uInt16 nIdx, const sal_uInt16 nLen) const; void DrawCapital( OutputDevice *pOut, const Point &rPos, const String &rTxt, - const USHORT nIdx, const USHORT nLen ) const; + const sal_uInt16 nIdx, const sal_uInt16 nLen ) const; Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt, - const USHORT nIdx, const USHORT nLen ) const; + const sal_uInt16 nIdx, const sal_uInt16 nLen ) const; Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt ); Size GetTxtSize( const OutputDevice *pOut, const String &rTxt, - const USHORT nIdx = 0, const USHORT nLen = STRING_LEN ); + const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ); void DrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt, - const USHORT nIdx = 0, const USHORT nLen = STRING_LEN ) const; + const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const; void QuickDrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt, - const USHORT nIdx = 0, const USHORT nLen = STRING_LEN, const sal_Int32* pDXArray = NULL ) const; + const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN, const sal_Int32* pDXArray = NULL ) const; Size QuickGetTextSize( const OutputDevice *pOut, const String &rTxt, - const USHORT nIdx, const USHORT nLen, sal_Int32* pDXArray = NULL ) const; + const sal_uInt16 nIdx, const sal_uInt16 nLen, sal_Int32* pDXArray = NULL ) const; void DrawPrev( OutputDevice* pOut, Printer* pPrinter, const Point &rPos, const String &rTxt, - const USHORT nIdx = 0, const USHORT nLen = STRING_LEN ) const; + const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const; #endif // !REDUCEDSVXFONT static void DrawArrow( OutputDevice &rOut, const Rectangle& rRect, - const Size& rSize, const Color& rCol, BOOL bLeft ); + const Size& rSize, const Color& rCol, sal_Bool bLeft ); SvxFont& operator=( const SvxFont& rFont ); SvxFont& operator=( const Font& rFont ); }; diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx index 5c92d5a5d7..17854b3bc3 100644 --- a/editeng/inc/editeng/svxrtf.hxx +++ b/editeng/inc/editeng/svxrtf.hxx @@ -34,9 +34,11 @@ #include <svl/itemset.hxx> #include <svtools/parrtf.hxx> -#define _SVSTDARR_USHORTS +#define _SVSTDARR_sal_uInt16S #include <svl/svstdarr.hxx> #include <editeng/editengdllapi.h> + +#include <deque> #include <utility> #include <vector> class Font; @@ -57,17 +59,17 @@ namespace com { namespace sun { namespace star { } } } -// Mapper-Klassen fuer die verschiedenen Anforderungen an Doc-Positionen -// Swg - NodePosition ist ein SwIndex, der intern veraendert wird -// EditEngine - ULONG auf Liste von Absaetzen +// Mapper-Classes for the various requirements on Document positions +// Swg - NodePosition is a SwIndex, which is used internally +// EditEngine - ULONG to list of paragraphs // ..... class SvxNodeIdx { public: virtual ~SvxNodeIdx() {} - virtual ULONG GetIdx() const = 0; - virtual SvxNodeIdx* Clone() const = 0; // erzeuge von sich eine Kopie + virtual sal_uLong GetIdx() const = 0; + virtual SvxNodeIdx* Clone() const = 0; // Cloning itself }; class SvxPosition @@ -75,33 +77,36 @@ class SvxPosition public: virtual ~SvxPosition() {} - virtual ULONG GetNodeIdx() const = 0; + virtual sal_uLong GetNodeIdx() const = 0; virtual xub_StrLen GetCntIdx() const = 0; - virtual SvxPosition* Clone() const = 0; // erzeuge von sich eine Kopie - virtual SvxNodeIdx* MakeNodeIdx() const = 0; // erzeuge vom NodeIndex eine Kopie + virtual SvxPosition* Clone() const = 0; // Cloning itself + virtual SvxNodeIdx* MakeNodeIdx() const = 0; // Cloning NodeIndex }; typedef Color* ColorPtr; -SV_DECL_PTRARR( SvxRTFColorTbl, ColorPtr, 16, 4 ) +typedef std::deque< ColorPtr > SvxRTFColorTbl; DECLARE_TABLE( SvxRTFFontTbl, Font* ) DECLARE_TABLE( SvxRTFStyleTbl, SvxRTFStyleType* ) typedef SvxRTFItemStackType* SvxRTFItemStackTypePtr; SV_DECL_PTRARR_DEL( SvxRTFItemStackList, SvxRTFItemStackTypePtr, 1, 1 ) -SV_DECL_PTRARR_STACK( SvxRTFItemStack, SvxRTFItemStackTypePtr, 0, 1 ) -// einige Hilfsklassen fuer den RTF-Parser +// SvxRTFItemStack can't be "std::stack< SvxRTFItemStackTypePtr >" type, because +// the methods are using operator[] in sw/source/filter/rtf/rtftbl.cxx file +typedef std::deque< SvxRTFItemStackTypePtr > SvxRTFItemStack; + +// own helper classes for the RTF Parser struct SvxRTFStyleType { - SfxItemSet aAttrSet; // die Attribute vom Style (+Ableitung!) + SfxItemSet aAttrSet; // the attributes of Style (+ derivate!) String sName; - USHORT nBasedOn, nNext; - BOOL bBasedOnIsSet; //$flr #117411# - BYTE nOutlineNo; - BOOL bIsCharFmt; + sal_uInt16 nBasedOn, nNext; + sal_Bool bBasedOnIsSet; + sal_uInt8 nOutlineNo; + sal_Bool bIsCharFmt; - SvxRTFStyleType( SfxItemPool& rPool, const USHORT* pWhichRange ); + SvxRTFStyleType( SfxItemPool& rPool, const sal_uInt16* pWhichRange ); }; @@ -109,17 +114,17 @@ struct SvxRTFStyleType typedef ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > PictPropertyNameValuePairs; struct EDITENG_DLLPUBLIC SvxRTFPictureType { - // Format der Bitmap + // Bitmap Format enum RTF_BMPSTYLE { - RTF_BITMAP, // Bitmap, die Planes sind in den Pict.Daten - WIN_METAFILE, // in den Pict.Daten steht ein Window-Metafile - MAC_QUICKDRAW, // in den Pict.Daten steht ein Mac-QuickDraw - OS2_METAFILE, // in den Pict.Daten steht ein OS2-Metafile - RTF_DI_BMP, // Device Independent Bitmap - ENHANCED_MF, // in den Pict.Daten steht ein Enhanced-Metafile - RTF_PNG, // in den Pict.Daten steht ein PNG file - RTF_JPG // in den Pict.Daten steht ein JPG file + RTF_BITMAP, // Meta data: Bitmap + WIN_METAFILE, // Meta data: Window-Metafile + MAC_QUICKDRAW, // Meta data: Mac-QuickDraw + OS2_METAFILE, // Meta data: OS2-Metafile + RTF_DI_BMP, // Meta data: Device Independent Bitmap + ENHANCED_MF, // Meta data: Enhanced-Metafile + RTF_PNG, // Meta data: PNG file + RTF_JPG // Meta data: JPG file } eStyle; enum RTF_BMPMODE @@ -128,27 +133,27 @@ struct EDITENG_DLLPUBLIC SvxRTFPictureType HEX_MODE } nMode; - USHORT nType; + sal_uInt16 nType; sal_uInt32 uPicLen; - USHORT nWidth, nHeight; - USHORT nGoalWidth, nGoalHeight; - USHORT nBitsPerPixel; - USHORT nPlanes; - USHORT nWidthBytes; - USHORT nScalX, nScalY; + sal_uInt16 nWidth, nHeight; + sal_uInt16 nGoalWidth, nGoalHeight; + sal_uInt16 nBitsPerPixel; + sal_uInt16 nPlanes; + sal_uInt16 nWidthBytes; + sal_uInt16 nScalX, nScalY; short nCropT, nCropB, nCropL, nCropR; PictPropertyNameValuePairs aPropertyPairs; SvxRTFPictureType() { ResetValues(); } - // alle Werte auf default; wird nach einlesen der Bitmap aufgerufen ! + // Reset all values to default; is called after loading the Bitmap void ResetValues(); }; -// Hier sind die Ids fuer alle Charakter-Attribute, die vom SvxParser -// erkannt und in einem SfxItemSet gesetzt werden koennen. -// Die Ids werden ueber die SlotIds vom POOL richtig gesetzt. +// Here are the IDs for all character attributes, which can be detected by +// SvxParser and can be set in a SfxItemSet. The IDs are set correctly throught +// the SlotIds from POOL. struct RTFPlainAttrMapIds { - USHORT nCaseMap, + sal_uInt16 nCaseMap, nBgColor, nColor, nContour, @@ -186,12 +191,12 @@ struct RTFPlainAttrMapIds RTFPlainAttrMapIds( const SfxItemPool& rPool ); }; -// Hier sind die Ids fuer alle Paragraph-Attribute, die vom SvxParser -// erkannt und in einem SfxItemSet gesetzt werden koennen. -// Die Ids werden ueber die SlotIds vom POOL richtig gesetzt. +// Here are the IDs for all paragraph attributes, which can be detected by +// SvxParser and can be set in a SfxItemSet. The IDs are set correctly throught +// the SlotIds from POOL. struct RTFPardAttrMapIds { - USHORT nLinespacing, + sal_uInt16 nLinespacing, nAdjust, nTabStop, nHyphenzone, @@ -242,31 +247,31 @@ class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser long nVersionNo; int nDfltFont; - BOOL bNewDoc : 1; // FALSE - in ein bestehendes lesen - BOOL bNewGroup : 1; // TRUE - es gab eine oeffnende Klammer - BOOL bIsSetDfltTab : 1; // TRUE - DefTab wurde eingelesen - BOOL bChkStyleAttr : 1; // TRUE - StyleSheets werden ausgewertet - BOOL bCalcValue : 1; // TRUE - Twipwerte an APP anpassen - BOOL bPardTokenRead : 1; // TRUE - Token \pard wurde erkannt - BOOL bReadDocInfo : 1; // TRUE - DocInfo mit einlesen - BOOL bIsLeftToRightDef : 1; // TRUE - in LeftToRight char run def. - // FALSE - in RightToLeft char run def. - BOOL bIsInReadStyleTab : 1; // TRUE - in ReadStyleTable + sal_Bool bNewDoc : 1; // FALSE - Reading in an existing + sal_Bool bNewGroup : 1; // TRUE - there was an opening parenthesis + sal_Bool bIsSetDfltTab : 1; // TRUE - DefTab was loaded + sal_Bool bChkStyleAttr : 1; // TRUE - StyleSheets are evaluated + sal_Bool bCalcValue : 1; // TRUE - Twip values adapt to App + sal_Bool bPardTokenRead : 1; // TRUE - Token \pard was detected + sal_Bool bReadDocInfo : 1; // TRUE - DocInfo to read + sal_Bool bIsLeftToRightDef : 1; // TRUE - in LeftToRight char run def. + // FALSE - in RightToLeft char run def. + sal_Bool bIsInReadStyleTab : 1; // TRUE - in ReadStyleTable void ClearColorTbl(); void ClearFontTbl(); void ClearStyleTbl(); void ClearAttrStack(); - SvxRTFItemStackTypePtr _GetAttrSet( int bCopyAttr=FALSE ); // neue ItemStackType anlegen + SvxRTFItemStackTypePtr _GetAttrSet( int bCopyAttr=sal_False ); // Create new ItemStackType:s void _ClearStyleAttr( SvxRTFItemStackType& rStkType ); - // setzt alle Attribute, die unterschiedlich zum aktuellen sind + // Sets all the attributes that are different from the current void SetAttrSet( SfxItemSet& rAttrSet, SvxPosition& rSttPos ); void SetAttrSet( SvxRTFItemStackType &rSet ); void SetDefault( int nToken, int nValue ); - // pard / plain abarbeiten + // Excecute pard / plain void RTFPardPlain( int bPard, SfxItemSet** ppSet ); void BuildWhichTbl(); @@ -292,7 +297,7 @@ protected: String& DelCharAtEnd( String& rStr, const sal_Unicode cDel ); - // wird fuer jedes Token gerufen, das in CallParser erkannt wird + // is called for each token that is recognized in CallParser virtual void NextToken( int nToken ); virtual void ReadBitmapData(); @@ -304,34 +309,34 @@ protected: void ReadAttr( int nToken, SfxItemSet* pSet ); void ReadTabAttr( int nToken, SfxItemSet& rSet ); - // Dokument-Info lesen + // Read Document-Info ::com::sun::star::util::DateTime GetDateTimeStamp( ); String& GetTextToEndGroup( String& rStr ); virtual void ReadInfo( const sal_Char* pChkForVerNo = 0 ); inline SfxItemSet& GetAttrSet(); - // wurde noch kein Text eingefuegt ? (SttPos vom obersten StackEintrag!) + // no text yet inserted? (SttPos from the top stack entry!) int IsAttrSttPos(); - void AttrGroupEnd(); // den akt. Bearbeiten, vom Stack loeschen + void AttrGroupEnd(); // edit the current, delete from stack void SetAllAttrOfStk(); // end all Attr. and set it into doc virtual void InsertText() = 0; - virtual void MovePos( int bForward = TRUE ) = 0; + virtual void MovePos( int bForward = sal_True ) = 0; virtual void SetEndPrevPara( SvxNodeIdx*& rpNodePos, xub_StrLen& rCntPos )=0; virtual void SetAttrInDoc( SvxRTFItemStackType &rSet ); - // fuer Tokens, die im ReadAttr nicht ausgewertet werden + // for Tokens, which are not evaluated in ReadAttr virtual void UnknownAttrToken( int nToken, SfxItemSet* pSet ); - // falls jemand keine Twips haben moechte + // if no-one would like to have any twips virtual void CalcValue(); SvxRTFParser( SfxItemPool& rAttrPool, SvStream& rIn, ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties> i_xDocProps, - int bReadNewDoc = TRUE ); + int bReadNewDoc = sal_True ); virtual ~SvxRTFParser(); int IsNewDoc() const { return bNewDoc; } @@ -347,16 +352,16 @@ protected: int IsReadDocInfo() const { return bReadDocInfo; } void SetReadDocInfo( int bFlag ) { bReadDocInfo = bFlag; } - // erfrage/setze die aktuelle Einfuegeposition + // Query/Set the current insert position SvxPosition& GetInsPos() const { return *pInsPos; } void SetInsPos( const SvxPosition& rNew ); long GetVersionNo() const { return nVersionNo; } - // erfrage/setze die Mapping-Ids fuer die Pard/Plain Attribute - // (Set: es werden sich die Pointer gemerkt, also keine Kopie erzeugt!!! ) - void AddPardAttr( USHORT nWhich ) { aPardMap.Insert( nWhich, aPardMap.Count() ); } - void AddPlainAttr( USHORT nWhich ) { aPlainMap.Insert( nWhich, aPlainMap.Count() ); } + // Query/Set the mapping IDs for the Pard/Plain attributes + //(Set: It is noted in the pointers, which thus does not create a copy) + void AddPardAttr( sal_uInt16 nWhich ) { aPardMap.Insert( nWhich, aPardMap.Count() ); } + void AddPlainAttr( sal_uInt16 nWhich ) { aPlainMap.Insert( nWhich, aPlainMap.Count() ); } SvxRTFStyleTbl& GetStyleTbl() { return aStyleTbl; } SvxRTFItemStack& GetAttrStack() { return aAttrStack; } @@ -365,37 +370,37 @@ protected: const String& GetBaseURL() const { return sBaseURL; } - // lesen die GrafikDaten und fuelle damit die Grafik und die - // die PicDaten. - // Return - TRUE: die Grafik ist gueltig - BOOL ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ); - // wandel die ASCII-HexCodes in binaere Zeichen um. Werden - // ungueltige Daten gefunden (Zeichen ausser 0-9|a-f|A-F, so - // wird USHRT_MAX returnt, ansonsten die Anzahl der umgewandelten Ze. + // Read the graphics data and make up for the graphics and the picture + // meta data. + // Return - TRUE: the graphic is valid + sal_Bool ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ); + // Change the ASCII-HexCodes into binary characters. If invalid data is + // found (strings not 0-9 | a-f | A-F, then USHRT_MAX is returned, + // otherwise the number of the converted character. xub_StrLen HexToBin( String& rToken ); public: - virtual SvParserState CallParser(); // Aufruf des Parsers + virtual SvParserState CallParser(); - inline const Color& GetColor( USHORT nId ) const; - const Font& GetFont( USHORT nId ); // aendert den dflt Font + inline const Color& GetColor( size_t nId ) const; + const Font& GetFont( sal_uInt16 nId ); // Changes the dflt Font virtual int IsEndPara( SvxNodeIdx* pNd, xub_StrLen nCnt ) const = 0; - // um einen anderen Attribut-Pool setzen zukoennen. Darf nur vorm - // CallParser erfolgen!! Die Maps werden nicht neu erzeugt! + // to det a different attribute pool. May only be done prior to CallParser! + // The maps are not generated anew! void SetAttrPool( SfxItemPool* pNewPool ) { pAttrPool = pNewPool; } - // um andere WhichIds fuer einen anderen Pool zusetzen. + // to set different WhichIds for a different pool. RTFPardAttrMapIds& GetPardMap() { return (RTFPardAttrMapIds&)*aPardMap.GetData(); } RTFPlainAttrMapIds& GetPlainMap() { return (RTFPlainAttrMapIds&)*aPlainMap.GetData(); } - // um diese von aussen z.B. Tabellenzellen zuordnen zu koennen - void ReadBorderAttr( int nToken, SfxItemSet& rSet, int bTableDef=FALSE ); - void ReadBackgroundAttr( int nToken, SfxItemSet& rSet, int bTableDef=FALSE ); + // to be able to assign them from the outside as for example table cells + void ReadBorderAttr( int nToken, SfxItemSet& rSet, int bTableDef=sal_False ); + void ReadBackgroundAttr( int nToken, SfxItemSet& rSet, int bTableDef=sal_False ); - // fuers asynchrone lesen aus dem SvStream + // for asynchronous read from the SvStream virtual void Continue( int nToken ); // get RTF default ItemSets. Must be used by pard/plain tokens or in @@ -404,8 +409,8 @@ public: virtual bool UncompressableStackEntry(const SvxRTFItemStackType &rSet) const; }; -// der Stack fuer die Attribute: -// diese Klasse darf nur vom SvxRTFParser benutzt werden! +// The stack for the attributes: +// this class may only be used by SvxRTFParser! class EDITENG_DLLPUBLIC SvxRTFItemStackType { friend class SvxRTFParser; @@ -415,9 +420,9 @@ class EDITENG_DLLPUBLIC SvxRTFItemStackType SvxNodeIdx *pSttNd, *pEndNd; xub_StrLen nSttCnt, nEndCnt; SvxRTFItemStackList* pChildList; - USHORT nStyleNo; + sal_uInt16 nStyleNo; - SvxRTFItemStackType( SfxItemPool&, const USHORT* pWhichRange, + SvxRTFItemStackType( SfxItemPool&, const sal_uInt16* pWhichRange, const SvxPosition& ); ~SvxRTFItemStackType(); @@ -426,7 +431,7 @@ class EDITENG_DLLPUBLIC SvxRTFItemStackType public: SvxRTFItemStackType( const SvxRTFItemStackType&, const SvxPosition&, - int bCopyAttr = FALSE ); + int bCopyAttr = sal_False ); //cmc, I'm very suspicios about SetStartPos, it doesn't change //its children's starting position, and the implementation looks //bad, consider this deprecated. @@ -435,8 +440,8 @@ public: void MoveFullNode(const SvxNodeIdx &rOldNode, const SvxNodeIdx &rNewNode); - ULONG GetSttNodeIdx() const { return pSttNd->GetIdx(); } - ULONG GetEndNodeIdx() const { return pEndNd->GetIdx(); } + sal_uLong GetSttNodeIdx() const { return pSttNd->GetIdx(); } + sal_uLong GetEndNodeIdx() const { return pEndNd->GetIdx(); } const SvxNodeIdx& GetSttNode() const { return *pSttNd; } const SvxNodeIdx& GetEndNode() const { return *pEndNd; } @@ -447,18 +452,18 @@ public: SfxItemSet& GetAttrSet() { return aAttrSet; } const SfxItemSet& GetAttrSet() const { return aAttrSet; } - USHORT StyleNo() const { return nStyleNo; } + sal_uInt16 StyleNo() const { return nStyleNo; } void SetRTFDefaults( const SfxItemSet& rDefaults ); }; -// ----------- Inline Implementierungen -------------- +// ----------- Inline Implementations -------------- -inline const Color& SvxRTFParser::GetColor( USHORT nId ) const +inline const Color& SvxRTFParser::GetColor( size_t nId ) const { ColorPtr pColor = (ColorPtr)pDfltColor; - if( nId < aColorTbl.Count() ) + if( nId < aColorTbl.size() ) pColor = aColorTbl[ nId ]; return *pColor; } @@ -466,7 +471,7 @@ inline const Color& SvxRTFParser::GetColor( USHORT nId ) const inline SfxItemSet& SvxRTFParser::GetAttrSet() { SvxRTFItemStackTypePtr pTmp; - if( bNewGroup || 0 == ( pTmp = aAttrStack.Top()) ) + if( bNewGroup || 0 == ( pTmp = aAttrStack.empty() ? 0 : aAttrStack.back()) ) pTmp = _GetAttrSet(); return pTmp->aAttrSet; } diff --git a/editeng/inc/editeng/swafopt.hxx b/editeng/inc/editeng/swafopt.hxx index 8292df4d82..0f1583744a 100644 --- a/editeng/inc/editeng/swafopt.hxx +++ b/editeng/inc/editeng/swafopt.hxx @@ -34,7 +34,7 @@ class SvStringsISortDtor; class SmartTagMgr; -// Klasse fuer Optionen vom Autoformat +// Class of options for AutoFormat struct EDITENG_DLLPUBLIC SvxSwAutoFmtFlags { Font aBulletFont; @@ -45,54 +45,54 @@ struct EDITENG_DLLPUBLIC SvxSwAutoFmtFlags sal_Unicode cBullet; sal_Unicode cByInputBullet; - USHORT nAutoCmpltWordLen, nAutoCmpltListLen; - USHORT nAutoCmpltExpandKey; + sal_uInt16 nAutoCmpltWordLen, nAutoCmpltListLen; + sal_uInt16 nAutoCmpltExpandKey; - BYTE nRightMargin; + sal_uInt8 nRightMargin; - BOOL bAutoCorrect : 1; - BOOL bCptlSttSntnc : 1; - BOOL bCptlSttWrd : 1; - BOOL bChkFontAttr : 1; + sal_Bool bAutoCorrect : 1; + sal_Bool bCptlSttSntnc : 1; + sal_Bool bCptlSttWrd : 1; + sal_Bool bChkFontAttr : 1; - BOOL bChgUserColl : 1; - BOOL bChgEnumNum : 1; + sal_Bool bChgUserColl : 1; + sal_Bool bChgEnumNum : 1; - BOOL bAFmtByInput : 1; - BOOL bDelEmptyNode : 1; - BOOL bSetNumRule : 1; + sal_Bool bAFmtByInput : 1; + sal_Bool bDelEmptyNode : 1; + sal_Bool bSetNumRule : 1; - BOOL bChgOrdinalNumber : 1; - BOOL bChgToEnEmDash : 1; - BOOL bAddNonBrkSpace : 1; - BOOL bChgWeightUnderl : 1; - BOOL bSetINetAttr : 1; + sal_Bool bChgOrdinalNumber : 1; + sal_Bool bChgToEnEmDash : 1; + sal_Bool bAddNonBrkSpace : 1; + sal_Bool bChgWeightUnderl : 1; + sal_Bool bSetINetAttr : 1; - BOOL bSetBorder : 1; - BOOL bCreateTable : 1; - BOOL bReplaceStyles : 1; - BOOL bDummy : 1; + sal_Bool bSetBorder : 1; + sal_Bool bCreateTable : 1; + sal_Bool bReplaceStyles : 1; + sal_Bool bDummy : 1; - BOOL bWithRedlining : 1; + sal_Bool bWithRedlining : 1; - BOOL bRightMargin : 1; + sal_Bool bRightMargin : 1; - BOOL bAutoCompleteWords : 1; - BOOL bAutoCmpltCollectWords : 1; - BOOL bAutoCmpltEndless : 1; -// -- under NT hier starts a new long - BOOL bAutoCmpltAppendBlanc : 1; - BOOL bAutoCmpltShowAsTip : 1; + sal_Bool bAutoCompleteWords : 1; + sal_Bool bAutoCmpltCollectWords : 1; + sal_Bool bAutoCmpltEndless : 1; +// -- under NT here starts a new long + sal_Bool bAutoCmpltAppendBlanc : 1; + sal_Bool bAutoCmpltShowAsTip : 1; - BOOL bAFmtDelSpacesAtSttEnd : 1; - BOOL bAFmtDelSpacesBetweenLines : 1; - BOOL bAFmtByInpDelSpacesAtSttEnd : 1; - BOOL bAFmtByInpDelSpacesBetweenLines : 1; + sal_Bool bAFmtDelSpacesAtSttEnd : 1; + sal_Bool bAFmtDelSpacesBetweenLines : 1; + sal_Bool bAFmtByInpDelSpacesAtSttEnd : 1; + sal_Bool bAFmtByInpDelSpacesBetweenLines : 1; - BOOL bAutoCmpltKeepList : 1; + sal_Bool bAutoCmpltKeepList : 1; // some dummies for any new options - BOOL bDummy6 : 1, + sal_Bool bDummy6 : 1, bDummy7 : 1, bDummy8 : 1 ; diff --git a/editeng/inc/editeng/tstpitem.hxx b/editeng/inc/editeng/tstpitem.hxx index 6d80024d44..eb0411c6b4 100644 --- a/editeng/inc/editeng/tstpitem.hxx +++ b/editeng/inc/editeng/tstpitem.hxx @@ -39,7 +39,7 @@ #define SVX_TAB_DEFCOUNT 10 #define SVX_TAB_DEFDIST 1134 // 2cm in twips #define SVX_TAB_NOTFOUND USHRT_MAX -#define cDfltDecimalChar (sal_Unicode(0x00)) // aus IntlWrapper besorgen +#define cDfltDecimalChar (sal_Unicode(0x00)) // Get from IntlWrapper #define cDfltFillChar (sal_Unicode(' ')) class EDITENG_DLLPUBLIC SvxTabStop @@ -83,8 +83,8 @@ public: String GetValueString() const; - // das "alte" operator==() - BOOL IsEqual( const SvxTabStop& rTS ) const + // the "old" operator==() + sal_Bool IsEqual( const SvxTabStop& rTS ) const { return ( nTabPos == rTS.nTabPos && eAdjustment == rTS.eAdjustment && @@ -92,10 +92,10 @@ public: cFill == rTS.cFill ); } - // Fuer das SortedArray: - BOOL operator==( const SvxTabStop& rTS ) const + // For the SortedArray: + sal_Bool operator==( const SvxTabStop& rTS ) const { return nTabPos == rTS.nTabPos; } - BOOL operator <( const SvxTabStop& rTS ) const + sal_Bool operator <( const SvxTabStop& rTS ) const { return nTabPos < rTS.nTabPos; } SvxTabStop& operator=( const SvxTabStop& rTS ) @@ -112,9 +112,9 @@ public: SV_DECL_VARARR_SORT_VISIBILITY( SvxTabStopArr, SvxTabStop, SVX_TAB_DEFCOUNT, 1, EDITENG_DLLPUBLIC ) -/* -[Beschreibung] -Dieses Item beschreibt eine Liste von TabStops. +/* [Description] + + This item describes a list of TabStops. */ class EDITENG_DLLPUBLIC SvxTabStopItem : public SfxPoolItem, private SvxTabStopArr @@ -124,38 +124,38 @@ class EDITENG_DLLPUBLIC SvxTabStopItem : public SfxPoolItem, private SvxTabStopA public: TYPEINFO(); - SvxTabStopItem( USHORT nWhich ); - SvxTabStopItem( const USHORT nTabs, - const USHORT nDist, + SvxTabStopItem( sal_uInt16 nWhich ); + SvxTabStopItem( const sal_uInt16 nTabs, + const sal_uInt16 nDist, const SvxTabAdjust eAdjst /*= SVX_TAB_ADJUST_DEFAULT*/, - USHORT nWhich ); + sal_uInt16 nWhich ); SvxTabStopItem( const SvxTabStopItem& rTSI ); - // Liefert Index-Position des Tabs zurueck oder TAB_NOTFOUND - USHORT GetPos( const SvxTabStop& rTab ) const; + // Returns index of the tab or TAB_NOTFOUND + sal_uInt16 GetPos( const SvxTabStop& rTab ) const; - // Liefert Index-Position des Tabs an nPos zurueck oder TAB_NOTFOUND - USHORT GetPos( const long nPos ) const; + // Returns index of the tab at nPos, or TAB_NOTFOUND + sal_uInt16 GetPos( const long nPos ) const; - // entprivatisiert: - USHORT Count() const { return SvxTabStopArr::Count(); } - BOOL Insert( const SvxTabStop& rTab ); - void Insert( const SvxTabStopItem* pTabs, USHORT nStart = 0, - USHORT nEnd = USHRT_MAX ); + // unprivatized: + sal_uInt16 Count() const { return SvxTabStopArr::Count(); } + sal_Bool Insert( const SvxTabStop& rTab ); + void Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart = 0, + sal_uInt16 nEnd = USHRT_MAX ); void Remove( SvxTabStop& rTab ) { SvxTabStopArr::Remove( rTab ); } - void Remove( const USHORT nPos, const USHORT nLen = 1 ) + void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 ) { SvxTabStopArr::Remove( nPos, nLen ); } - // Zuweisungsoperator, Gleichheitsoperator (vorsicht: teuer!) + // Assignment operator, equality operator (caution: expensive!) SvxTabStopItem& operator=( const SvxTabStopItem& rTSI ); // this is already included in SfxPoolItem declaration //int operator!=( const SvxTabStopItem& rTSI ) const // { return !( operator==( rTSI ) ); } - // SortedArrays liefern nur Stackobjekte zurueck! - const SvxTabStop& operator[]( const USHORT nPos ) const + // SortedArrays returns only Stackobjects! + const SvxTabStop& operator[]( const sal_uInt16 nPos ) const { DBG_ASSERT( GetStart() && nPos < Count(), "op[]" ); @@ -164,10 +164,10 @@ public: const SvxTabStop* GetStart() const { return SvxTabStopArr::GetData(); } - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -175,8 +175,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT ) const; - virtual SvStream& Store( SvStream& , USHORT nItemVersion ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; using SvxTabStopArr::Insert; using SvxTabStopArr::Remove; diff --git a/editeng/inc/editeng/twolinesitem.hxx b/editeng/inc/editeng/twolinesitem.hxx index c5f48e55ea..6bcf02b0bd 100644 --- a/editeng/inc/editeng/twolinesitem.hxx +++ b/editeng/inc/editeng/twolinesitem.hxx @@ -44,30 +44,28 @@ class EDITENG_DLLPUBLIC SvxTwoLinesItem : public SfxPoolItem sal_Bool bOn; public: TYPEINFO(); - SvxTwoLinesItem( sal_Bool bOn /*= TRUE*/, + SvxTwoLinesItem( sal_Bool bOn /*= sal_True*/, sal_Unicode nStartBracket /*= 0*/, sal_Unicode nEndBracket /*= 0*/, sal_uInt16 nId ); SvxTwoLinesItem( const SvxTwoLinesItem& rAttr ); virtual ~SvxTwoLinesItem(); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nVer) const; - virtual SvStream& Store(SvStream &, USHORT nIVer) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVer) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nIVer) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper* pIntl = 0 ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); - virtual USHORT GetVersion( USHORT nFFVer ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFFVer ) const; SvxTwoLinesItem& operator=( const SvxTwoLinesItem& rCpy ) { diff --git a/editeng/inc/editeng/txtrange.hxx b/editeng/inc/editeng/txtrange.hxx index 44c33bd95d..1655b2967a 100644 --- a/editeng/inc/editeng/txtrange.hxx +++ b/editeng/inc/editeng/txtrange.hxx @@ -29,89 +29,89 @@ #ifndef _MyTXTRANGE_HXX #define _MyTXTRANGE_HXX -#ifndef _TXTRANGE_HXX -#define _SVSTDARR_BOOLS -#define _SVSTDARR_LONGS -#include <svl/svstdarr.hxx> -#endif #include "editeng/editengdllapi.h" +#include "tools/solar.h" +#include "tools/gen.hxx" + +#include <deque> class PolyPolygon; -class Range; class Rectangle; namespace basegfx { class B2DPolyPolygon; } -typedef SvLongs* SvLongsPtr; +typedef std::deque<long>* LongDqPtr; /************************************************************************* |* |* class TextRanger |* -|* Beschreibung -|* Ersterstellung 20.01.97 -|* Letzte Aenderung AMA 20.01.97 -|* *************************************************************************/ class EDITENG_DLLPUBLIC TextRanger { - Range *pRangeArr; - SvLongsPtr *pCache; - PolyPolygon *mpPolyPolygon; // Flaechenpolygon - PolyPolygon *mpLinePolyPolygon; // Linienpolygon - Rectangle *pBound; // Umfassendes Rechteck - USHORT nCacheSize; // Cache-Size - USHORT nCacheIdx; // Cache-Index - USHORT nRight; // Abstand Kontur-Text - USHORT nLeft; // Abstand Text-Kontur - USHORT nUpper; // Abstand Kontur-Text - USHORT nLower; // Abstand Text-Kontur - sal_uInt32 nPointCount; // Anzahl der Polygonpunkte - BOOL bSimple : 1; // Nur Aussenkante - BOOL bInner : 1; // TRUE: Objekt beschriften (EditEngine); - // FALSE: Objekt umfliessen (StarWriter); - BOOL bVertical :1; // for vertical writing mode - BOOL bFlag3 :1; - BOOL bFlag4 :1; - BOOL bFlag5 :1; - BOOL bFlag6 :1; - BOOL bFlag7 :1; + //! The RangeCache class is used to cache the result of a single range calculation. + struct RangeCache + { + Range range; //!< Range for which we calculated results. + std::deque<long> results; //!< Calculated results for the range. + RangeCache(const Range& rng) : range(rng) {}; + }; + std::deque<RangeCache> mRangeCache; //!< Cached range calculations. + PolyPolygon *mpPolyPolygon; // Surface polygon + PolyPolygon *mpLinePolyPolygon; // Line polygon + Rectangle *pBound; // Comprehensive rectangle + sal_uInt16 nCacheSize; // Cache-Size + sal_uInt16 nRight; // Distance Contour-Text + sal_uInt16 nLeft; // Distance Text-Contour + sal_uInt16 nUpper; // Distance Contour-Text + sal_uInt16 nLower; // Distance Text-Contour + sal_uInt32 nPointCount; // Number of polygon points + sal_Bool bSimple : 1; // Just outside edge + sal_Bool bInner : 1; // TRUE: Objekt inline (EditEngine); + // FALSE: Objekt flow (StarWriter); + sal_Bool bVertical :1; // for vertical writing mode + sal_Bool bFlag3 :1; + sal_Bool bFlag4 :1; + sal_Bool bFlag5 :1; + sal_Bool bFlag6 :1; + sal_Bool bFlag7 :1; TextRanger( const TextRanger& ); // not implemented const Rectangle& _GetBoundRect(); public: - TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon, - USHORT nCacheSize, USHORT nLeft, USHORT nRight, - BOOL bSimple, BOOL bInner, BOOL bVert = sal_False ); + TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B2DPolyPolygon* pLinePolyPolygon, + sal_uInt16 nCacheSize, sal_uInt16 nLeft, sal_uInt16 nRight, + sal_Bool bSimple, sal_Bool bInner, sal_Bool bVert = sal_False ); ~TextRanger(); - SvLongsPtr GetTextRanges( const Range& rRange ); - USHORT GetRight() const { return nRight; } - USHORT GetLeft() const { return nLeft; } - USHORT GetUpper() const { return nUpper; } - USHORT GetLower() const { return nLower; } + LongDqPtr GetTextRanges( const Range& rRange ); + sal_uInt16 GetRight() const { return nRight; } + sal_uInt16 GetLeft() const { return nLeft; } + sal_uInt16 GetUpper() const { return nUpper; } + sal_uInt16 GetLower() const { return nLower; } sal_uInt32 GetPointCount() const { return nPointCount; } - BOOL IsSimple() const { return bSimple; } - BOOL IsInner() const { return bInner; } - BOOL IsVertical() const { return bVertical; } - BOOL HasBorder() const { return nRight || nLeft; } + sal_Bool IsSimple() const { return bSimple; } + sal_Bool IsInner() const { return bInner; } + sal_Bool IsVertical() const { return bVertical; } + sal_Bool HasBorder() const { return nRight || nLeft; } const PolyPolygon& GetPolyPolygon() const { return *mpPolyPolygon; } const PolyPolygon* GetLinePolygon() const { return mpLinePolyPolygon; } const Rectangle& GetBoundRect() { return pBound ? static_cast< const Rectangle& >(*pBound) : _GetBoundRect(); } - void SetUpper( USHORT nNew ){ nUpper = nNew; } - void SetLower( USHORT nNew ){ nLower = nNew; } - void SetVertical( BOOL bNew ); - BOOL IsFlag3() const { return bFlag3; } - void SetFlag3( BOOL bNew ) { bFlag3 = bNew; } - BOOL IsFlag4() const { return bFlag4; } - void SetFlag4( BOOL bNew ) { bFlag4 = bNew; } - BOOL IsFlag5() const { return bFlag5; } - void SetFlag5( BOOL bNew ) { bFlag5 = bNew; } - BOOL IsFlag6() const { return bFlag6; } - void SetFlag6( BOOL bNew ) { bFlag6 = bNew; } - BOOL IsFlag7() const { return bFlag7; } - void SetFlag7( BOOL bNew ) { bFlag7 = bNew; } + void SetUpper( sal_uInt16 nNew ){ nUpper = nNew; } + void SetLower( sal_uInt16 nNew ){ nLower = nNew; } + void SetVertical( sal_Bool bNew ); + sal_Bool IsFlag3() const { return bFlag3; } + void SetFlag3( sal_Bool bNew ) { bFlag3 = bNew; } + sal_Bool IsFlag4() const { return bFlag4; } + void SetFlag4( sal_Bool bNew ) { bFlag4 = bNew; } + sal_Bool IsFlag5() const { return bFlag5; } + void SetFlag5( sal_Bool bNew ) { bFlag5 = bNew; } + sal_Bool IsFlag6() const { return bFlag6; } + void SetFlag6( sal_Bool bNew ) { bFlag6 = bNew; } + sal_Bool IsFlag7() const { return bFlag7; } + void SetFlag7( sal_Bool bNew ) { bFlag7 = bNew; } }; diff --git a/editeng/inc/editeng/udlnitem.hxx b/editeng/inc/editeng/udlnitem.hxx index 8f5d13c65f..c06bae4e81 100644 --- a/editeng/inc/editeng/udlnitem.hxx +++ b/editeng/inc/editeng/udlnitem.hxx @@ -52,31 +52,29 @@ public: TYPEINFO(); SvxTextLineItem( const FontUnderline eSt, - const USHORT nId ); + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - virtual String GetValueTextByPos( USHORT nPos ) const; - virtual USHORT GetValueCount() const; - - virtual bool QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - - // MS VC4.0 kommt durcheinander - void SetValue( USHORT nNewVal ) + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + // MS VC4.0 messes things up + void SetValue( sal_uInt16 nNewVal ) {SfxEnumItem::SetValue(nNewVal); } virtual int HasBoolValue() const; - virtual BOOL GetBoolValue() const; - virtual void SetBoolValue( BOOL bVal ); + virtual sal_Bool GetBoolValue() const; + virtual void SetBoolValue( sal_Bool bVal ); virtual int operator==( const SfxPoolItem& ) const; @@ -91,7 +89,7 @@ public: FontUnderline GetLineStyle() const { return (FontUnderline)GetValue(); } void SetLineStyle( FontUnderline eNew ) - { SetValue((USHORT) eNew); } + { SetValue((sal_uInt16) eNew); } const Color& GetColor() const { return mColor; } void SetColor( const Color& rCol ) { mColor = rCol; } @@ -107,11 +105,11 @@ public: TYPEINFO(); SvxUnderlineItem( const FontUnderline eSt, - const USHORT nId ); + const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual String GetValueTextByPos( USHORT nPos ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; }; // class SvxOverlineItem ------------------------------------------------ @@ -124,11 +122,11 @@ public: TYPEINFO(); SvxOverlineItem( const FontUnderline eSt, - const USHORT nId ); + const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual String GetValueTextByPos( USHORT nPos ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; }; #endif // #ifndef _SVX_UDLNITEM_HXX diff --git a/editeng/inc/editeng/ulspitem.hxx b/editeng/inc/editeng/ulspitem.hxx index 83bc118938..d0e38e8dc3 100644 --- a/editeng/inc/editeng/ulspitem.hxx +++ b/editeng/inc/editeng/ulspitem.hxx @@ -40,31 +40,31 @@ namespace rtl // class SvxULSpaceItem -------------------------------------------------- -/* -[Beschreibung] -Dieses Item beschreibt den oberen und unteren Rand einer Seite oder Absatz. +/* [Description] + + This item describes the Upper- and Lower space of a page or paragraph. */ -#define ULSPACE_16_VERSION ((USHORT)0x0001) +#define ULSPACE_16_VERSION ((sal_uInt16)0x0001) class EDITENG_DLLPUBLIC SvxULSpaceItem : public SfxPoolItem { - USHORT nUpper; //Oberer Rand - USHORT nLower; //Unterer Rand - USHORT nPropUpper, nPropLower; // relativ oder absolut (=100%) + sal_uInt16 nUpper; // Upper space + sal_uInt16 nLower; // Lower space + sal_uInt16 nPropUpper, nPropLower; // relative or absolute (=100%) public: TYPEINFO(); - SvxULSpaceItem( const USHORT nId ); - SvxULSpaceItem( const USHORT nUp, const USHORT nLow, - const USHORT nId ); + SvxULSpaceItem( const sal_uInt16 nId ); + SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow, + const sal_uInt16 nId ); inline SvxULSpaceItem& operator=( const SvxULSpaceItem &rCpy ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -72,24 +72,24 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; - virtual bool ScaleMetrics( long nMult, long nDiv ); - virtual bool HasMetrics() const; - - inline void SetUpper( const USHORT nU, const USHORT nProp = 100 ); - inline void SetLower( const USHORT nL, const USHORT nProp = 100 ); - - void SetUpperValue( const USHORT nU ) { nUpper = nU; } - void SetLowerValue( const USHORT nL ) { nLower = nL; } - void SetPropUpper( const USHORT nU ) { nPropUpper = nU; } - void SetPropLower( const USHORT nL ) { nPropLower = nL; } - - USHORT GetUpper() const { return nUpper; } - USHORT GetLower() const { return nLower; } - USHORT GetPropUpper() const { return nPropUpper; } - USHORT GetPropLower() const { return nPropLower; } + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; + + inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 ); + inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 ); + + void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; } + void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; } + void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; } + void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; } + + sal_uInt16 GetUpper() const { return nUpper; } + sal_uInt16 GetLower() const { return nLower; } + sal_uInt16 GetPropUpper() const { return nPropUpper; } + sal_uInt16 GetPropLower() const { return nPropLower; } }; inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy ) @@ -101,13 +101,13 @@ inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy ) return *this; } -inline void SvxULSpaceItem::SetUpper( const USHORT nU, const USHORT nProp ) +inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp ) { - nUpper = USHORT((ULONG(nU) * nProp ) / 100); nPropUpper = nProp; + nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp; } -inline void SvxULSpaceItem::SetLower( const USHORT nL, const USHORT nProp ) +inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp ) { - nLower = USHORT((ULONG(nL) * nProp ) / 100); nPropLower = nProp; + nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp; } #endif diff --git a/editeng/inc/editeng/unoedhlp.hxx b/editeng/inc/editeng/unoedhlp.hxx index b352548440..f065cdc0b3 100644 --- a/editeng/inc/editeng/unoedhlp.hxx +++ b/editeng/inc/editeng/unoedhlp.hxx @@ -50,20 +50,20 @@ class EditEngine; class EDITENG_DLLPUBLIC SvxEditSourceHint : public TextHint { private: - ULONG mnStart; - ULONG mnEnd; + sal_uLong mnStart; + sal_uLong mnEnd; public: TYPEINFO(); - SvxEditSourceHint( ULONG nId ); - SvxEditSourceHint( ULONG nId, ULONG nValue, ULONG nStart=0, ULONG nEnd=0 ); - - ULONG GetValue() const; - ULONG GetStartValue() const; - ULONG GetEndValue() const; - void SetValue( ULONG n ); - void SetStartValue( ULONG n ); - void SetEndValue( ULONG n ); + SvxEditSourceHint( sal_uLong nId ); + SvxEditSourceHint( sal_uLong nId, sal_uLong nValue, sal_uLong nStart=0, sal_uLong nEnd=0 ); + + sal_uLong GetValue() const; + sal_uLong GetStartValue() const; + sal_uLong GetEndValue() const; + void SetValue( sal_uLong n ); + void SetStartValue( sal_uLong n ); + void SetEndValue( sal_uLong n ); }; /** Helper class for common functionality in edit sources @@ -102,7 +102,7 @@ public: @return sal_True, if the range has been successfully determined */ - static sal_Bool GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, const EditEngine& rEE, USHORT nPara, USHORT nIndex ); + static sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex ); /** Convert point from edit engine to user coordinate space diff --git a/editeng/inc/editeng/unoedprx.hxx b/editeng/inc/editeng/unoedprx.hxx index 2dfd05ec77..a82ab075f5 100644 --- a/editeng/inc/editeng/unoedprx.hxx +++ b/editeng/inc/editeng/unoedprx.hxx @@ -42,20 +42,20 @@ public: SvxAccessibleTextAdapter(); virtual ~SvxAccessibleTextAdapter(); - virtual USHORT GetParagraphCount() const; - virtual USHORT GetTextLen( USHORT nParagraph ) const; + virtual sal_uInt16 GetParagraphCount() const; + virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const; virtual String GetText( const ESelection& rSel ) const; - virtual SfxItemSet GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib = 0 ) const; - virtual SfxItemSet GetParaAttribs( USHORT nPara ) const; - virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ); + virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const; + virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); - virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const; + virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const; - virtual sal_Int32 CalcLogicalIndex( USHORT nPara, USHORT nEEIndex ); - virtual USHORT CalcEditEngineIndex( USHORT nPara, sal_Int32 nLogicalIndex ); + virtual sal_Int32 CalcLogicalIndex( sal_uInt16 nPara, sal_uInt16 nEEIndex ); + virtual sal_uInt16 CalcEditEngineIndex( sal_uInt16 nPara, sal_Int32 nLogicalIndex ); - virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; - virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const; + virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const; + virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const; virtual void QuickInsertText( const String& rText, const ESelection& rSel ); virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ); @@ -64,46 +64,46 @@ public: virtual SfxItemPool* GetPool() const; - virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); - virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); - virtual BOOL IsValid() const; - - virtual LanguageType GetLanguage( USHORT, USHORT ) const; - virtual USHORT GetFieldCount( USHORT nPara ) const; - virtual EFieldInfo GetFieldInfo( USHORT nPara, USHORT nField ) const; - virtual EBulletInfo GetBulletInfo( USHORT nPara ) const; - virtual Rectangle GetCharBounds( USHORT nPara, USHORT nIndex ) const; - virtual Rectangle GetParaBounds( USHORT nPara ) const; + virtual sal_Bool IsValid() const; + + virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const; + virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const; + virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const; + virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const; + virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const; virtual MapMode GetMapMode() const; virtual OutputDevice* GetRefDevice() const; - virtual sal_Bool GetIndexAtPoint( const Point&, USHORT& nPara, USHORT& nIndex ) const; - virtual sal_Bool GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const; - virtual sal_Bool GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const; - virtual USHORT GetLineCount( USHORT nPara ) const; - virtual USHORT GetLineLen( USHORT nPara, USHORT nLine ) const; - virtual void GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const; - virtual USHORT GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const; + virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const; + virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const; + virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const; + virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const; + virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const; + virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const; virtual sal_Bool Delete( const ESelection& ); virtual sal_Bool InsertText( const String&, const ESelection& ); - virtual sal_Bool QuickFormatDoc( BOOL bFull=FALSE ); - virtual sal_Int16 GetDepth( USHORT nPara ) const; - virtual sal_Bool SetDepth( USHORT nPara, sal_Int16 nNewDepth ); + virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ); + virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const; + virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ); virtual const SfxItemSet* GetEmptyItemSetPtr(); // implementation functions for XParagraphAppend and XTextPortionAppend // (not needed for accessibility, only for new import API) virtual void AppendParagraph(); - virtual xub_StrLen AppendTextPortion( USHORT nPara, const String &rText, const SfxItemSet &rSet ); + virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ); //XTextCopy virtual void CopyText(const SvxTextForwarder& rSource); void SetForwarder( SvxTextForwarder& ); - sal_Bool HaveImageBullet( USHORT nPara ) const; - sal_Bool HaveTextBullet( USHORT nPara ) const; + sal_Bool HaveImageBullet( sal_uInt16 nPara ) const; + sal_Bool HaveTextBullet( sal_uInt16 nPara ) const; /** Query whether all text in given selection is editable @@ -125,7 +125,7 @@ public: virtual ~SvxAccessibleTextEditViewAdapter(); // SvxViewForwarder interface - virtual BOOL IsValid() const; + virtual sal_Bool IsValid() const; virtual Rectangle GetVisArea() const; virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const; virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const; diff --git a/editeng/inc/editeng/unoedsrc.hxx b/editeng/inc/editeng/unoedsrc.hxx index db401d59ce..24b90f8ccb 100644 --- a/editeng/inc/editeng/unoedsrc.hxx +++ b/editeng/inc/editeng/unoedsrc.hxx @@ -152,25 +152,25 @@ class EDITENG_DLLPUBLIC SvxTextForwarder public: virtual ~SvxTextForwarder(); - virtual USHORT GetParagraphCount() const = 0; - virtual USHORT GetTextLen( USHORT nParagraph ) const = 0; + virtual sal_uInt16 GetParagraphCount() const = 0; + virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const = 0; virtual String GetText( const ESelection& rSel ) const = 0; - virtual SfxItemSet GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib = 0 ) const = 0; - virtual SfxItemSet GetParaAttribs( USHORT nPara ) const = 0; - virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) = 0; + virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const = 0; + virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const = 0; + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) = 0; virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ) = 0; - virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const = 0; + virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const = 0; - virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const = 0; - virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const = 0; + virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0; + virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const = 0; virtual void QuickInsertText( const String& rText, const ESelection& rSel ) = 0; virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) = 0; virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) = 0; virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0; - virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ) = 0; - virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) = 0; + virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) = 0; + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ) = 0; virtual SfxItemPool* GetPool() const = 0; @@ -178,7 +178,7 @@ public: // implementation functions for XParagraphAppend and XTextPortionAppend virtual void AppendParagraph() = 0; - virtual xub_StrLen AppendTextPortion( USHORT nPara, const String &rText, const SfxItemSet &rSet ) = 0; + virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ) = 0; // XTextCopy virtual void CopyText(const SvxTextForwarder& rSource) = 0; @@ -187,7 +187,7 @@ public: @return sal_False, if no longer valid */ - virtual BOOL IsValid() const = 0; + virtual sal_Bool IsValid() const = 0; /** Query language of character at given position on the underlying edit engine @@ -197,14 +197,14 @@ public: @param nIndex[0 .. m-1] Index of character to query language of */ - virtual LanguageType GetLanguage( USHORT nPara, USHORT nIndex ) const = 0; + virtual LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; /** Query number of fields in the underlying edit engine @param nPara[0 .. n-1] Index of paragraph to query field number in */ - virtual USHORT GetFieldCount( USHORT nPara ) const = 0; + virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const = 0; /** Query information for given field number in the underlying edit engine @@ -214,14 +214,14 @@ public: @param nField[0 .. m-1] Index of field to query information of */ - virtual EFieldInfo GetFieldInfo( USHORT nPara, USHORT nField ) const = 0; + virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const = 0; /** Query information regarding bullets for given paragraph on the underlying edit engine @param nPara[0 .. n-1] Index of paragraph to query bullet info on */ - virtual EBulletInfo GetBulletInfo( USHORT nPara ) const = 0; + virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const = 0; /** Query the bounding rectangle of the given character @@ -244,7 +244,7 @@ public: left corner of text. The coordinates returned here are to be interpreted in the map mode given by GetMapMode(). */ - virtual Rectangle GetCharBounds( USHORT nPara, USHORT nIndex ) const = 0; + virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; /** Query the bounding rectangle of the given paragraph @@ -255,7 +255,7 @@ public: left corner of text. The coordinates returned here are to be interpreted in the map mode given by GetMapMode(). */ - virtual Rectangle GetParaBounds( USHORT nPara ) const = 0; + virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const = 0; /** Query the map mode of the underlying EditEngine/Outliner @@ -292,7 +292,7 @@ public: @return sal_True, if the point is over any text and both rPara and rIndex are valid */ - virtual sal_Bool GetIndexAtPoint( const Point& rPoint, USHORT& rPara, USHORT& rIndex ) const = 0; + virtual sal_Bool GetIndexAtPoint( const Point& rPoint, sal_uInt16& rPara, sal_uInt16& rIndex ) const = 0; /** Get the start and the end index of the word at the given index @@ -317,7 +317,7 @@ public: @return sal_True, if the result is non-empty */ - virtual sal_Bool GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& rStart, USHORT& rEnd ) const = 0; + virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& rStart, sal_uInt16& rEnd ) const = 0; /** Query range of similar attributes @@ -334,7 +334,7 @@ public: @return sal_True, if the range has been successfully determined */ - virtual sal_Bool GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const = 0; + virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; /** Query number of lines in the formatted paragraph @@ -344,7 +344,7 @@ public: @return number of lines in given paragraph */ - virtual USHORT GetLineCount( USHORT nPara ) const = 0; + virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const = 0; /** Query line length @@ -355,7 +355,7 @@ public: Index of line in paragraph to query line length of */ - virtual USHORT GetLineLen( USHORT nPara, USHORT nLine ) const = 0; + virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const = 0; /** Query bounds of line in paragraph @@ -372,7 +372,7 @@ public: Index of line in paragraph to query line length of */ - virtual void GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const = 0; + virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const = 0; /** Query the line number for a index in the paragraphs text @@ -385,7 +385,7 @@ public: @returns [0 .. k-1] The line number of the chara in the paragraph */ - virtual USHORT GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const = 0; + virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; /** Delete given text range and reformat text @@ -414,7 +414,7 @@ public: @return sal_True if text have been successfully reformatted */ - virtual sal_Bool QuickFormatDoc( BOOL bFull=FALSE ) = 0; + virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ) = 0; /** Get the outline depth of given paragraph @@ -424,7 +424,7 @@ public: @return the outline level of the given paragraph. The range is [0,n), where n is the maximal outline level. */ - virtual sal_Int16 GetDepth( USHORT nPara ) const = 0; + virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const = 0; /** Set the outline depth of given paragraph @@ -435,11 +435,11 @@ public: The depth to set on the given paragraph. The range is [0,n), where n is the maximal outline level. - @return TRUE, if depth could be successfully set. Reasons for + @return sal_True, if depth could be successfully set. Reasons for failure are e.g. the text does not support outline level (EditEngine), or the depth range is exceeded. */ - virtual sal_Bool SetDepth( USHORT nPara, sal_Int16 nNewDepth ) = 0; + virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ) = 0; virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara ); virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue ); @@ -463,7 +463,7 @@ public: @return sal_False, if no longer valid */ - virtual BOOL IsValid() const = 0; + virtual sal_Bool IsValid() const = 0; /** Query visible area of the view containing the text diff --git a/editeng/inc/editeng/unofield.hxx b/editeng/inc/editeng/unofield.hxx index 5c004494b7..33f5ae25b6 100644 --- a/editeng/inc/editeng/unofield.hxx +++ b/editeng/inc/editeng/unofield.hxx @@ -87,7 +87,7 @@ public: SvxUnoTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor, const ::rtl::OUString& rPresentation, const SvxFieldData* pFieldData ) throw(); virtual ~SvxUnoTextField() throw(); - // Intern + // Internal virtual sal_Int32 GetFieldId( const SvxFieldData* pFieldData ) const throw(); SvxFieldData* CreateFieldData() const throw(); void SetAnchor( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor ) { mxAnchor = xAnchor; } diff --git a/editeng/inc/editeng/unofored.hxx b/editeng/inc/editeng/unofored.hxx index b13118c390..3bcf45cb63 100644 --- a/editeng/inc/editeng/unofored.hxx +++ b/editeng/inc/editeng/unofored.hxx @@ -33,7 +33,7 @@ #include <editeng/unoedsrc.hxx> #include "editeng/editengdllapi.h" -// SvxEditEngineForwarder - SvxTextForwarder fuer EditEngine +// SvxEditEngineForwarder - SvxTextForwarder for EditEngine class EDITENG_DLLPUBLIC SvxEditEngineForwarder : public SvxTextForwarder { @@ -44,17 +44,17 @@ public: SvxEditEngineForwarder( EditEngine& rEngine ); virtual ~SvxEditEngineForwarder(); - virtual USHORT GetParagraphCount() const; - virtual USHORT GetTextLen( USHORT nParagraph ) const; + virtual sal_uInt16 GetParagraphCount() const; + virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const; virtual String GetText( const ESelection& rSel ) const; - virtual SfxItemSet GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib = EditEngineAttribs_All ) const; - virtual SfxItemSet GetParaAttribs( USHORT nPara ) const; - virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ); + virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All ) const; + virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); - virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const; + virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const; - virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; - virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const; + virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const; + virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const; virtual void QuickInsertText( const String& rText, const ESelection& rSel ); virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ); @@ -63,36 +63,36 @@ public: virtual SfxItemPool* GetPool() const; - virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); - virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); - virtual BOOL IsValid() const; + virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + virtual sal_Bool IsValid() const; - virtual LanguageType GetLanguage( USHORT, USHORT ) const; - virtual USHORT GetFieldCount( USHORT nPara ) const; - virtual EFieldInfo GetFieldInfo( USHORT nPara, USHORT nField ) const; - virtual EBulletInfo GetBulletInfo( USHORT nPara ) const; - virtual Rectangle GetCharBounds( USHORT nPara, USHORT nIndex ) const; - virtual Rectangle GetParaBounds( USHORT nPara ) const; + virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const; + virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const; + virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const; + virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const; + virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const; virtual MapMode GetMapMode() const; virtual OutputDevice* GetRefDevice() const; - virtual sal_Bool GetIndexAtPoint( const Point&, USHORT& nPara, USHORT& nIndex ) const; - virtual sal_Bool GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const; - virtual sal_Bool GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const; - virtual USHORT GetLineCount( USHORT nPara ) const; - virtual USHORT GetLineLen( USHORT nPara, USHORT nLine ) const; - virtual void GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const; - virtual USHORT GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const; + virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const; + virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const; + virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const; + virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const; + virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const; + virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const; virtual sal_Bool Delete( const ESelection& ); virtual sal_Bool InsertText( const String&, const ESelection& ); - virtual sal_Bool QuickFormatDoc( BOOL bFull=FALSE ); - virtual sal_Int16 GetDepth( USHORT nPara ) const; - virtual sal_Bool SetDepth( USHORT nPara, sal_Int16 nNewDepth ); + virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ); + virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const; + virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ); virtual const SfxItemSet* GetEmptyItemSetPtr(); // implementation functions for XParagraphAppend and XTextPortionAppend virtual void AppendParagraph(); - virtual xub_StrLen AppendTextPortion( USHORT nPara, const String &rText, const SfxItemSet &rSet ); + virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ); //XTextCopy virtual void CopyText(const SvxTextForwarder& rSource); }; diff --git a/editeng/inc/editeng/unoforou.hxx b/editeng/inc/editeng/unoforou.hxx index 80f053a767..7c17672646 100644 --- a/editeng/inc/editeng/unoforou.hxx +++ b/editeng/inc/editeng/unoforou.hxx @@ -36,13 +36,13 @@ class Outliner; -// SvxOutlinerForwarder - SvxTextForwarder fuer Outliner +// SvxOutlinerForwarder - SvxTextForwarder for Outliner class EDITENG_DLLPUBLIC SvxOutlinerForwarder : public SvxTextForwarder { private: Outliner& rOutliner; - BOOL bOutlinerText; + sal_Bool bOutlinerText; /** this pointer may be null or point to an item set for the attribs of the selection maAttribsSelection */ @@ -56,23 +56,23 @@ private: mutable SfxItemSet* mpParaAttribsCache; /** if we have a cached para attribute item set, this is the paragraph of it */ - mutable USHORT mnParaAttribsCache; + mutable sal_uInt16 mnParaAttribsCache; public: - SvxOutlinerForwarder( Outliner& rOutl, BOOL bOutlText = FALSE ); + SvxOutlinerForwarder( Outliner& rOutl, sal_Bool bOutlText = sal_False ); virtual ~SvxOutlinerForwarder(); - virtual USHORT GetParagraphCount() const; - virtual USHORT GetTextLen( USHORT nParagraph ) const; + virtual sal_uInt16 GetParagraphCount() const; + virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const; virtual String GetText( const ESelection& rSel ) const; - virtual SfxItemSet GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib = 0 ) const; - virtual SfxItemSet GetParaAttribs( USHORT nPara ) const; - virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ); + virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const; + virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); - virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const; + virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const; - virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; - virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const; + virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const; + virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const; virtual void QuickInsertText( const String& rText, const ESelection& rSel ); virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ); @@ -81,33 +81,33 @@ public: virtual SfxItemPool* GetPool() const; - virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); - virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); - virtual BOOL IsValid() const; + virtual sal_Bool IsValid() const; Outliner& GetOutliner() const { return rOutliner; } - virtual LanguageType GetLanguage( USHORT, USHORT ) const; - virtual USHORT GetFieldCount( USHORT nPara ) const; - virtual EFieldInfo GetFieldInfo( USHORT nPara, USHORT nField ) const; - virtual EBulletInfo GetBulletInfo( USHORT nPara ) const; - virtual Rectangle GetCharBounds( USHORT nPara, USHORT nIndex ) const; - virtual Rectangle GetParaBounds( USHORT nPara ) const; + virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const; + virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const; + virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const; + virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const; + virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const; virtual MapMode GetMapMode() const; virtual OutputDevice* GetRefDevice() const; - virtual sal_Bool GetIndexAtPoint( const Point&, USHORT& nPara, USHORT& nIndex ) const; - virtual sal_Bool GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const; - virtual sal_Bool GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const; - virtual USHORT GetLineCount( USHORT nPara ) const; - virtual USHORT GetLineLen( USHORT nPara, USHORT nLine ) const; - virtual void GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nPara, USHORT nLine ) const; - virtual USHORT GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const; + virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const; + virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const; + virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const; + virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const; + virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const; + virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const; virtual sal_Bool Delete( const ESelection& ); virtual sal_Bool InsertText( const String&, const ESelection& ); - virtual sal_Bool QuickFormatDoc( BOOL bFull=FALSE ); - virtual sal_Int16 GetDepth( USHORT nPara ) const; - virtual sal_Bool SetDepth( USHORT nPara, sal_Int16 nNewDepth ); + virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ); + virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const; + virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ); virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara ); virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue ); @@ -121,7 +121,7 @@ public: // implementation functions for XParagraphAppend and XTextPortionAppend virtual void AppendParagraph(); - virtual xub_StrLen AppendTextPortion( USHORT nPara, const String &rText, const SfxItemSet &rSet ); + virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ); //XTextCopy virtual void CopyText(const SvxTextForwarder& rSource); }; diff --git a/editeng/inc/editeng/unoipset.hxx b/editeng/inc/editeng/unoipset.hxx index b5f002d6d9..685d0aa398 100644 --- a/editeng/inc/editeng/unoipset.hxx +++ b/editeng/inc/editeng/unoipset.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -33,11 +33,12 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include "editeng/editengdllapi.h" #include <svl/itemprop.hxx> +#include <vector> -class SvxIDPropertyCombineList; class SdrItemPool; class SfxItemSet; class SvxShape; +struct SvxIDPropertyCombine; #define SFX_METRIC_ITEM (0x40) @@ -46,23 +47,23 @@ class EDITENG_DLLPUBLIC SvxItemPropertySet SfxItemPropertyMap m_aPropertyMap; mutable com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> m_xInfo; const SfxItemPropertyMapEntry* _pMap; - SvxIDPropertyCombineList* pCombiList; - sal_Bool mbConvertTwips; - SfxItemPool& mrItemPool; + ::std::vector< SvxIDPropertyCombine* > aCombineList; + sal_Bool mbConvertTwips; + SfxItemPool& mrItemPool; public: SvxItemPropertySet( const SfxItemPropertyMapEntry *pMap, SfxItemPool& rPool, sal_Bool bConvertTwips = sal_False ); ~SvxItemPropertySet(); - // Methoden, die direkt mit dem ItemSet arbeiten + // Methods, which work directly with the ItemSet ::com::sun::star::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet, bool bSearchInParent, bool bDontConvertNegativeValues ) const; void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& rVal, SfxItemSet& rSet, bool bDontConvertNegativeValues ) const; - // Methoden, die stattdessen Any benutzen + // Methods that use Any instead ::com::sun::star::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap ) const; void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& rVal ) const; - sal_Bool AreThereOwnUsrAnys() const { return (pCombiList ? sal_True : sal_False); } + sal_Bool AreThereOwnUsrAnys() const { return ( aCombineList.empty() ? sal_False : sal_True ); } ::com::sun::star::uno::Any* GetUsrAnyForID(sal_uInt16 nWID) const; void AddUsrAnyForID(const ::com::sun::star::uno::Any& rAny, sal_uInt16 nWID); void ClearAllUsrAny(); diff --git a/editeng/inc/editeng/unolingu.hxx b/editeng/inc/editeng/unolingu.hxx index e50884e4de..b521917188 100644 --- a/editeng/inc/editeng/unolingu.hxx +++ b/editeng/inc/editeng/unolingu.hxx @@ -55,17 +55,17 @@ class Window; class SvxLinguConfigUpdate { - static INT32 nCurrentDataFilesChangedCheckValue; - static INT16 nNeedUpdating; // n == -1 => needs to be checked + static sal_Int32 nCurrentDataFilesChangedCheckValue; + static sal_Int16 nNeedUpdating; // n == -1 => needs to be checked // n == 0 => already updated, nothing to be done // n == 1 => needs to be updated - static INT32 CalcDataFilesChangedCheckValue(); + static sal_Int32 CalcDataFilesChangedCheckValue(); public: EDITENG_DLLPUBLIC static void UpdateAll( sal_Bool bForceCheck = sal_False ); - static BOOL IsNeedUpdateAll( sal_Bool bForceCheck = sal_False ); + static sal_Bool IsNeedUpdateAll( sal_Bool bForceCheck = sal_False ); }; /////////////////////////////////////////////////////////////////////////// @@ -155,15 +155,15 @@ struct SvxAlternativeSpelling String aReplacement; ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > xHyphWord; - INT16 nChangedPos, + sal_Int16 nChangedPos, nChangedLength; - BOOL bIsAltSpelling; + sal_Bool bIsAltSpelling; inline SvxAlternativeSpelling(); }; inline SvxAlternativeSpelling::SvxAlternativeSpelling() : - nChangedPos(-1), nChangedLength(-1), bIsAltSpelling(FALSE) + nChangedPos(-1), nChangedLength(-1), bIsAltSpelling(sal_False) { } @@ -193,7 +193,7 @@ public: /////////////////////////////////////////////////////////////////////////// -//TL:TODO: remove those functions or make them inline +//TODO: remove those functions or make them inline EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > SvxGetSpellChecker(); EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< @@ -204,7 +204,7 @@ EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList > SvxGetDictionaryList(); EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SvxGetLinguPropertySet(); -//TL:TODO: remove argument or provide SvxGetIgnoreAllList with the same one +//TODO: remove argument or provide SvxGetIgnoreAllList with the same one EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > SvxGetOrCreatePosDic( ::com::sun::star::uno::Reference< diff --git a/editeng/inc/editeng/unonrule.hxx b/editeng/inc/editeng/unonrule.hxx index f7d0592c45..9b5e80b7ff 100644 --- a/editeng/inc/editeng/unonrule.hxx +++ b/editeng/inc/editeng/unonrule.hxx @@ -81,7 +81,7 @@ public: virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(com::sun::star::uno::RuntimeException); virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(com::sun::star::uno::RuntimeException); - // intern + // internal com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> getNumberingRuleByIndex( sal_Int32 nIndex) const throw(); void setNumberingRuleByIndex( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rProperties, sal_Int32 nIndex) throw( com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException ); diff --git a/editeng/inc/editeng/unoprnms.hxx b/editeng/inc/editeng/unoprnms.hxx index 625ccfa00d..8adbc60f36 100644 --- a/editeng/inc/editeng/unoprnms.hxx +++ b/editeng/inc/editeng/unoprnms.hxx @@ -258,7 +258,7 @@ #define UNO_NAME_3D_TEXTUREPOLYGON3D "D3DTexturePolygon3D" #define UNO_NAME_3D_LINEONLY "D3DLineOnly" -// #107245# New 3D properties which are possible for lathe and extrude 3d objects +// New 3D properties which are possible for lathe and extrude 3d objects #define UNO_NAME_3D_SMOOTH_NORMALS "D3DSmoothNormals" #define UNO_NAME_3D_SMOOTH_LIDS "D3DSmoothLids" #define UNO_NAME_3D_CHARACTER_MODE "D3DCharacterMode" @@ -357,7 +357,7 @@ #define UNO_NAME_CUSTOMSHAPE_ADJUSTMENT "CustomShapeAdjustment" -// Die folgenden Properties sind veraltet und koennen irgendwann mal raus +// The following properties are obsolete and can eventually be removed #define UNO_NAME_EDIT_FONT_COLOR "FontColor" #define UNO_NAME_EDIT_FONT_ESCAPEMENT "FontEscapement" #define UNO_NAME_EDIT_FONT_HEIGHT "FontHeight" @@ -370,7 +370,7 @@ #define UNO_NAME_EDIT_FONT_FAMILY "FontFamily" #define UNO_NAME_EDIT_FONT_NAME "FontName" #define UNO_NAME_EDIT_FONT_CHARSET "FontCharset" -// Ende der veralteten Properties +// End of the obsolete properties #endif diff --git a/editeng/inc/editeng/unotext.hxx b/editeng/inc/editeng/unotext.hxx index ebd0576934..3489944ba4 100644 --- a/editeng/inc/editeng/unotext.hxx +++ b/editeng/inc/editeng/unotext.hxx @@ -56,6 +56,7 @@ #include <cppuhelper/interfacecontainer.h> #include <cppuhelper/weak.hxx> #include <cppuhelper/weakagg.hxx> +#include <osl/diagnose.hxx> #include <osl/mutex.hxx> #include <comphelper/servicehelper.hxx> #include <tools/link.hxx> @@ -173,8 +174,8 @@ EDITENG_DLLPUBLIC void GetSelection( struct ESelection& rSel, SvxTextForwarder* EDITENG_DLLPUBLIC void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw(); // ==================================================================== -// Diese Klasse implementiert eine SvxEditSource und einen SvxTextForwarder -// und macht ansonsten rein garnichts +// This class implements a SvxEditSource and SvxTextForwarder and does +// nothing otherwise // ==================================================================== class SvxDummyTextSource : public SvxEditSource, public SvxTextForwarder @@ -191,7 +192,7 @@ public: virtual sal_uInt16 GetParagraphCount() const; virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const; virtual String GetText( const ESelection& rSel ) const; - virtual SfxItemSet GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib = 0 ) const; + virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const; virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); @@ -208,37 +209,37 @@ public: virtual void QuickInsertLineBreak( const ESelection& rSel ); virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); - virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); virtual sal_Bool IsValid() const; virtual void SetNotifyHdl( const Link& ); - virtual LanguageType GetLanguage( USHORT, USHORT ) const; - virtual USHORT GetFieldCount( USHORT nPara ) const; - virtual EFieldInfo GetFieldInfo( USHORT nPara, USHORT nField ) const; - virtual EBulletInfo GetBulletInfo( USHORT nPara ) const; - virtual Rectangle GetCharBounds( USHORT nPara, USHORT nIndex ) const; - virtual Rectangle GetParaBounds( USHORT nPara ) const; + virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const; + virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const; + virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const; + virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const; + virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const; virtual MapMode GetMapMode() const; virtual OutputDevice* GetRefDevice() const; - virtual sal_Bool GetIndexAtPoint( const Point&, USHORT& nPara, USHORT& nIndex ) const; - virtual sal_Bool GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const; - virtual sal_Bool GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const; - virtual USHORT GetLineCount( USHORT nPara ) const; - virtual USHORT GetLineLen( USHORT nPara, USHORT nLine ) const; - virtual void GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const; - virtual USHORT GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const; + virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const; + virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const; + virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const; + virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const; + virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const; + virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const; virtual sal_Bool Delete( const ESelection& ); virtual sal_Bool InsertText( const String&, const ESelection& ); - virtual sal_Bool QuickFormatDoc( BOOL bFull=FALSE ); - virtual sal_Int16 GetDepth( USHORT nPara ) const; - virtual sal_Bool SetDepth( USHORT nPara, sal_Int16 nNewDepth ); + virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ); + virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const; + virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ); virtual const SfxItemSet* GetEmptyItemSetPtr(); // implementation functions for XParagraphAppend and XTextPortionAppend virtual void AppendParagraph(); - virtual xub_StrLen AppendTextPortion( USHORT nPara, const String &rText, const SfxItemSet &rSet ); + virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ); //XTextCopy virtual void CopyText(const SvxTextForwarder& rSource); }; @@ -256,7 +257,8 @@ class EDITENG_DLLPUBLIC SvxUnoTextRangeBase : public ::com::sun::star::text::XTe public ::com::sun::star::beans::XPropertyState, public ::com::sun::star::lang::XServiceInfo, public ::com::sun::star::text::XTextRangeCompare, - public ::com::sun::star::lang::XUnoTunnel + public ::com::sun::star::lang::XUnoTunnel, + private osl::DebugBase<SvxUnoTextRangeBase> { friend class SvxUnoTextRangeEnumeration; @@ -371,9 +373,6 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText; sal_Bool mbPortion; -protected: - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; - public: SvxUnoTextRange( const SvxUnoTextBase& rParent, sal_Bool bPortion = sal_False ) throw(); virtual ~SvxUnoTextRange() throw(); @@ -404,7 +403,6 @@ class EDITENG_DLLPUBLIC SvxUnoTextBase : public SvxUnoTextRangeBase, { protected: ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText; - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; public: SvxUnoTextBase( ) throw(); @@ -539,8 +537,6 @@ private: bool mbDisposing; protected: - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; - using SvxUnoTextRangeBase::setPropertyValue; using SvxUnoTextRangeBase::getPropertyValue; @@ -628,9 +624,6 @@ class EDITENG_DLLPUBLIC SvxUnoTextCursor : public SvxUnoTextRangeBase, private: ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText; -protected: - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; - public: SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw(); SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw(); diff --git a/editeng/inc/editeng/unoviwed.hxx b/editeng/inc/editeng/unoviwed.hxx index 7e023fd377..62e6215178 100644 --- a/editeng/inc/editeng/unoviwed.hxx +++ b/editeng/inc/editeng/unoviwed.hxx @@ -45,7 +45,7 @@ public: SvxEditEngineViewForwarder( EditView& rView ); virtual ~SvxEditEngineViewForwarder(); - virtual BOOL IsValid() const; + virtual sal_Bool IsValid() const; virtual Rectangle GetVisArea() const; virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const; diff --git a/editeng/inc/editeng/unoviwou.hxx b/editeng/inc/editeng/unoviwou.hxx index b0efc092b8..da28f8d05d 100644 --- a/editeng/inc/editeng/unoviwou.hxx +++ b/editeng/inc/editeng/unoviwou.hxx @@ -48,7 +48,7 @@ public: SvxDrawOutlinerViewForwarder( OutlinerView& rOutl, const Point& rShapePosTopLeft ); virtual ~SvxDrawOutlinerViewForwarder(); - virtual BOOL IsValid() const; + virtual sal_Bool IsValid() const; virtual Rectangle GetVisArea() const; virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const; diff --git a/editeng/inc/editeng/wghtitem.hxx b/editeng/inc/editeng/wghtitem.hxx index 8a77027bfe..adbe0ab806 100644 --- a/editeng/inc/editeng/wghtitem.hxx +++ b/editeng/inc/editeng/wghtitem.hxx @@ -42,9 +42,9 @@ namespace rtl // class SvxWeightItem --------------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt die Font-Staerke. + This item describes the font weight. */ class EDITENG_DLLPUBLIC SvxWeightItem : public SfxEnumItem @@ -53,26 +53,26 @@ public: TYPEINFO(); SvxWeightItem( const FontWeight eWght /*= WEIGHT_NORMAL*/, - const USHORT nId ); + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + SfxEnumItem + // "pure virtual Methods" from SfxPoolItem + SfxEnumItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - virtual String GetValueTextByPos( USHORT nPos ) const; - virtual USHORT GetValueCount() const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual String GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual int HasBoolValue() const; - virtual BOOL GetBoolValue() const; - virtual void SetBoolValue( BOOL bVal ); + virtual sal_Bool GetBoolValue() const; + virtual void SetBoolValue( sal_Bool bVal ); inline SvxWeightItem& operator=(const SvxWeightItem& rWeight) { SetValue( rWeight.GetValue() ); @@ -83,7 +83,7 @@ public: FontWeight GetWeight() const { return (FontWeight)GetValue(); } void SetWeight( FontWeight eNew ) - { SetValue( (USHORT)eNew ); } + { SetValue( (sal_uInt16)eNew ); } }; #endif // #ifndef _SVX_WGHTITEM_HXX diff --git a/editeng/inc/editeng/widwitem.hxx b/editeng/inc/editeng/widwitem.hxx index f8aaeba29e..0e280288c2 100644 --- a/editeng/inc/editeng/widwitem.hxx +++ b/editeng/inc/editeng/widwitem.hxx @@ -41,9 +41,9 @@ namespace rtl // class SvxWidowsItem --------------------------------------------------- -/* -[Beschreibung] -Dieses Item beschreibt die Anzahl der Zeilen fuer die Hurenkinderregelung. +/* [Description] + + This item describes the number of lines for the widows control. */ class EDITENG_DLLPUBLIC SvxWidowsItem: public SfxByteItem @@ -52,12 +52,12 @@ class EDITENG_DLLPUBLIC SvxWidowsItem: public SfxByteItem public: TYPEINFO(); - SvxWidowsItem( const BYTE nL /*= 0*/, const USHORT nId ); + SvxWidowsItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream &, USHORT ) const; - virtual SvStream& Store( SvStream & , USHORT nItemVersion ) const; + virtual SfxPoolItem* Create( SvStream &, sal_uInt16 ) const; + virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/writingmodeitem.hxx b/editeng/inc/editeng/writingmodeitem.hxx index a7d569d158..89efe83bce 100644 --- a/editeng/inc/editeng/writingmodeitem.hxx +++ b/editeng/inc/editeng/writingmodeitem.hxx @@ -42,15 +42,15 @@ public: TYPEINFO(); SvxWritingModeItem( ::com::sun::star::text::WritingMode eValue /*= com::sun::star::text::WritingMode_LR_TB*/, - USHORT nWhich /*= SDRATTR_TEXTDIRECTION*/ ); + sal_uInt16 nWhich /*= SDRATTR_TEXTDIRECTION*/ ); virtual ~SvxWritingModeItem(); SvxWritingModeItem& operator=( const SvxWritingModeItem& rItem ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream & rStrm, USHORT nIVer) const; - virtual USHORT GetVersion( USHORT nFileVersion ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual int operator==( const SfxPoolItem& ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, @@ -59,10 +59,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ); - virtual bool QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); }; #endif // #ifndef _SVX_WRITINGMODEITEM_HXX diff --git a/editeng/inc/editeng/wrlmitem.hxx b/editeng/inc/editeng/wrlmitem.hxx index de29f41368..9226fca3ef 100644 --- a/editeng/inc/editeng/wrlmitem.hxx +++ b/editeng/inc/editeng/wrlmitem.hxx @@ -41,10 +41,10 @@ namespace rtl // class SvxWordLineModeItem --------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt, ob Unterstrichen und Durchgestrichen auf - Wortgrenzen beschraenkt ist. + This item describes, whether underlined and strikethrough is limited + to word boundaries. */ class EDITENG_DLLPUBLIC SvxWordLineModeItem : public SfxBoolItem @@ -52,13 +52,13 @@ class EDITENG_DLLPUBLIC SvxWordLineModeItem : public SfxBoolItem public: TYPEINFO(); - SvxWordLineModeItem( const BOOL bWordLineMode /*= FALSE*/, - const USHORT nId ); + SvxWordLineModeItem( const sal_Bool bWordLineMode /*= sal_False*/, + const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, diff --git a/editeng/inc/editeng/xmlcnitm.hxx b/editeng/inc/editeng/xmlcnitm.hxx index 0c048c7c3c..f4469fb93e 100644 --- a/editeng/inc/editeng/xmlcnitm.hxx +++ b/editeng/inc/editeng/xmlcnitm.hxx @@ -63,8 +63,8 @@ public: virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const; - virtual bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); virtual SfxPoolItem *Clone( SfxItemPool * = 0) const { return new SvXMLAttrContainerItem( *this ); } diff --git a/editeng/inc/helpid.hrc b/editeng/inc/helpid.hrc index 32c109aad2..83a7288c52 100644..100755 --- a/editeng/inc/helpid.hrc +++ b/editeng/inc/helpid.hrc @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helpid.hrc,v $ - * $Revision: 1.78 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -30,52 +27,31 @@ #ifndef _EDITENG_HELPID_HRC #define _EDITENG_HELPID_HRC -// include --------------------------------------------------------------- - -#include <svl/solar.hrc> - -// Help-Ids -------------------------------------------------------------- -#define HID_EDITENG_SPELLER_WORDLANGUAGE (HID_EDIT_START) -#define HID_EDITENG_SPELLER_PARALANGUAGE (HID_EDIT_START + 1) -#define HID_EDITENG_SPELLER_ADDWORD (HID_EDIT_START + 2) -#define HID_EDITENG_SPELLER_AUTOCORRECT (HID_EDIT_START + 3) -#define HID_EDITENG_SPELLER_IGNORE (HID_EDIT_START + 4) -#define HID_EDITENG_SPELLER_START (HID_EDIT_START + 5) -#define HID_AUTOCORR_HELP_END (HID_EDIT_START + 6) -#define HID_AUTOCORR_HELP_START (HID_EDIT_START + 7) -#define HID_AUTOCORR_HELP_WORD HID_AUTOCORR_HELP_START - -#define HID_AUTOCORR_HELP_SENT (HID_AUTOCORR_HELP_START+1) -#define HID_AUTOCORR_HELP_SENTWORD (HID_AUTOCORR_HELP_START+2) -#define HID_AUTOCORR_HELP_ACORWORD (HID_AUTOCORR_HELP_START+3) - -#define HID_AUTOCORR_HELP_ACORSENTWORD (HID_AUTOCORR_HELP_START+5) - -#define HID_AUTOCORR_HELP_CHGTOENEMDASH (HID_AUTOCORR_HELP_START+7) -#define HID_AUTOCORR_HELP_WORDENEMDASH (HID_AUTOCORR_HELP_START+8) -#define HID_AUTOCORR_HELP_SENTENEMDASH (HID_AUTOCORR_HELP_START+9) -#define HID_AUTOCORR_HELP_SENTWORDENEMDASH (HID_AUTOCORR_HELP_START+10) -#define HID_AUTOCORR_HELP_ACORWORDENEMDASH (HID_AUTOCORR_HELP_START+11) - -#define HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH (HID_AUTOCORR_HELP_START+13) -#define HID_AUTOCORR_HELP_CHGQUOTES (HID_AUTOCORR_HELP_START+15) -#define HID_AUTOCORR_HELP_CHGSGLQUOTES (HID_AUTOCORR_HELP_START+16) -#define HID_AUTOCORR_HELP_SETINETATTR (HID_AUTOCORR_HELP_START+17) -#define HID_AUTOCORR_HELP_INGNOREDOUBLESPACE (HID_AUTOCORR_HELP_START+18) -#define HID_AUTOCORR_HELP_CHGWEIGHTUNDERL (HID_AUTOCORR_HELP_START+19) -#define HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL (HID_AUTOCORR_HELP_START+20) -#define HID_AUTOCORR_HELP_CHGORDINALNUMBER (HID_AUTOCORR_HELP_START+21) // HID_EDIT_START + 28 - -// please adjust ACT_SVX_HID_END2 below if you add entries here! - -// ----------------------------------------------------------------------- -// Overrun check --------------------------------------------------------- -// ----------------------------------------------------------------------- - -#define ACT_SVX_HID_END (HID_EDIT_START+28) -#if ACT_SVX_HID_END > HID_EDIT_END -#error Resource-Ueberlauf in #line, #file -#endif +#define HID_EDITENG_SPELLER_WORDLANGUAGE "EDITENG_HID_EDITENG_SPELLER_WORDLANGUAGE" +#define HID_EDITENG_SPELLER_PARALANGUAGE "EDITENG_HID_EDITENG_SPELLER_PARALANGUAGE" +#define HID_EDITENG_SPELLER_ADDWORD "EDITENG_HID_EDITENG_SPELLER_ADDWORD" +#define HID_EDITENG_SPELLER_AUTOCORRECT "EDITENG_HID_EDITENG_SPELLER_AUTOCORRECT" +#define HID_EDITENG_SPELLER_IGNORE "EDITENG_HID_EDITENG_SPELLER_IGNORE" +#define HID_EDITENG_SPELLER_START "EDITENG_HID_EDITENG_SPELLER_START" + +#define HID_AUTOCORR_HELP_WORD "EDITENG_HID_AUTOCORR_HELP_START" +#define HID_AUTOCORR_HELP_SENT "EDITENG_HID_AUTOCORR_HELP_SENT" +#define HID_AUTOCORR_HELP_SENTWORD "EDITENG_HID_AUTOCORR_HELP_SENTWORD" +#define HID_AUTOCORR_HELP_ACORWORD "EDITENG_HID_AUTOCORR_HELP_ACORWORD" +#define HID_AUTOCORR_HELP_ACORSENTWORD "EDITENG_HID_AUTOCORR_HELP_ACORSENTWORD" +#define HID_AUTOCORR_HELP_CHGTOENEMDASH "EDITENG_HID_AUTOCORR_HELP_CHGTOENEMDASH" +#define HID_AUTOCORR_HELP_WORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_WORDENEMDASH" +#define HID_AUTOCORR_HELP_SENTENEMDASH "EDITENG_HID_AUTOCORR_HELP_SENTENEMDASH" +#define HID_AUTOCORR_HELP_SENTWORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_SENTWORDENEMDASH" +#define HID_AUTOCORR_HELP_ACORWORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_ACORWORDENEMDASH" +#define HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH" +#define HID_AUTOCORR_HELP_CHGQUOTES "EDITENG_HID_AUTOCORR_HELP_CHGQUOTES" +#define HID_AUTOCORR_HELP_CHGSGLQUOTES "EDITENG_HID_AUTOCORR_HELP_CHGSGLQUOTES" +#define HID_AUTOCORR_HELP_SETINETATTR "EDITENG_HID_AUTOCORR_HELP_SETINETATTR" +#define HID_AUTOCORR_HELP_INGNOREDOUBLESPACE "EDITENG_HID_AUTOCORR_HELP_INGNOREDOUBLESPACE" +#define HID_AUTOCORR_HELP_CHGWEIGHTUNDERL "EDITENG_HID_AUTOCORR_HELP_CHGWEIGHTUNDERL" +#define HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL "EDITENG_HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL" +#define HID_AUTOCORR_HELP_CHGORDINALNUMBER "EDITENG_HID_AUTOCORR_HELP_CHGORDINALNUMBER" #endif diff --git a/editeng/inc/pch/precompiled_editeng.cxx b/editeng/inc/pch/precompiled_editeng.cxx index 3fe7dcce13..2b5afa0f3c 100644 --- a/editeng/inc/pch/precompiled_editeng.cxx +++ b/editeng/inc/pch/precompiled_editeng.cxx @@ -7,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: precompiled_svx.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/editeng/inc/pch/precompiled_editeng.hxx b/editeng/inc/pch/precompiled_editeng.hxx index 197fb4644f..57cd0397f3 100644 --- a/editeng/inc/pch/precompiled_editeng.hxx +++ b/editeng/inc/pch/precompiled_editeng.hxx @@ -7,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: precompiled_svx.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -672,7 +669,7 @@ #include "rtl/logfile.hxx" #include "rtl/math.hxx" #include "rtl/memory.h" -#include "rlt/ref.hxx" +#include "rtl/ref.hxx" #include "rtl/tencinfo.h" #include "rtl/textenc.h" #include "rtl/ustrbuf.hxx" @@ -689,7 +686,7 @@ #include "sot/formats.hxx" #include <map> #include <set> -#include <slist> +#include <list> #include <vector> #include "svtools/FilterConfigItem.hxx" #include "svtools/accessibilityoptions.hxx" @@ -697,7 +694,6 @@ #include "svtools/apearcfg.hxx" #include "svl/brdcst.hxx" #include "unotools/cacheoptions.hxx" -#include "svl/cancel.hxx" #include "svl/cjkoptions.hxx" #include "unotools/cmdoptions.hxx" #include "svl/cntwall.hxx" @@ -742,7 +738,6 @@ #include "svtools/parhtml.hxx" #include "svtools/parrtf.hxx" #include "unotools/pathoptions.hxx" -#include "svl/pickerhelper.hxx" #include "svl/poolitem.hxx" #include "unotools/printwarningoptions.hxx" #include "svl/ptitem.hxx" @@ -800,7 +795,6 @@ #include "tools/inetdef.hxx" #include "tools/line.hxx" #include "tools/link.hxx" -#include "tools/list.hxx" #include "tools/multisel.hxx" #include "tools/poly.hxx" #include "tools/rc.h" @@ -858,7 +852,7 @@ #include "vcl/cursor.hxx" #include "vcl/decoview.hxx" #include "vcl/dndhelp.hxx" -#include "vcl/fldunit.hxx" +#include "tools/fldunit.hxx" #include "vcl/fntstyle.hxx" #include "unotools/fontcvt.hxx" #include "vcl/gdimtf.hxx" @@ -877,7 +871,7 @@ #include "vcl/unohelp.hxx" #include "vcl/unohelp2.hxx" #include "vcl/wall.hxx" -#include "vcl/wintypes.hxx" +#include "tools/wintypes.hxx" #include "xmloff/DashStyle.hxx" #include "xmloff/GradientStyle.hxx" #include "xmloff/HatchStyle.hxx" diff --git a/editeng/prj/build.lst b/editeng/prj/build.lst index 551a21bc37..7d6afc7975 100644 --- a/editeng/prj/build.lst +++ b/editeng/prj/build.lst @@ -1,13 +1,2 @@ -ed editeng : l10n svtools xmloff linguistic NULL -ed editeng usr1 - all ed_mkout NULL -ed editeng\inc nmake - all ed_inc NULL -ed editeng\source\items nmake - all ed_items ed_inc NULL -ed editeng\source\editeng nmake - all ed_eeng ed_inc NULL -ed editeng\source\misc nmake - all ed_misc ed_inc NULL -ed editeng\source\outliner nmake - all ed_outl ed_inc NULL -ed editeng\source\rtf nmake - all ed_rtf ed_inc NULL -ed editeng\source\uno nmake - all ed_uno ed_inc NULL -ed editeng\source\xml nmake - all ed_xml ed_inc NULL -ed editeng\source\accessibility nmake - all ed_accessibility ed_inc NULL -ed editeng\util nmake - all ed_util ed_rtf ed_eeng ed_items ed_outl ed_uno ed_xml ed_accessibility ed_misc NULL - +ed editeng : TRANSLATIONS:translations svtools xmloff linguistic NULL +ed editeng\prj nmake - all ed_prj NULL diff --git a/editeng/prj/d.lst b/editeng/prj/d.lst index 364c1a8fdd..e69de29bb2 100644 --- a/editeng/prj/d.lst +++ b/editeng/prj/d.lst @@ -1,14 +0,0 @@ -mkdir: %COMMON_DEST%\bin%_EXT%\hid -mkdir: %COMMON_DEST%\res%_EXT% - -..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid -..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.* -..\%__SRC%\lib\iediteng.lib %_DEST%\lib%_EXT%\iediteng.lib -..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll -..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res - -mkdir: %_DEST%\inc%_EXT%\svx -..\inc\editeng\*.h %_DEST%\inc%_EXT%\editeng\*.h -..\inc\editeng\*.hrc %_DEST%\inc%_EXT%\editeng\*.hrc -..\inc\editeng\*.hxx %_DEST%\inc%_EXT%\editeng\*.hxx - diff --git a/editeng/util/makefile.pmk b/editeng/prj/makefile.mk index fac1139d7b..e312a7ccab 100644..100755 --- a/editeng/util/makefile.pmk +++ b/editeng/prj/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.pmk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,19 +25,16 @@ # #************************************************************************* -# define EDITENG_DLLIMPLEMENTATION (see @ editengdllapi.h) -CDEFS += -DEDITENG_DLLIMPLEMENTATION +PRJ=.. +TARGET=prj -.IF "$(ENABLE_GTK)" != "" -CFLAGS+=-DENABLE_GTK -.ENDIF - -.IF "$(ENABLE_KDE)" != "" -CFLAGS+=-DENABLE_KDE -.ENDIF +.INCLUDE : settings.mk -.IF "$(ENABLE_KDE4)" != "" -CFLAGS+=-DENABLE_KDE4 +.IF "$(VERBOSE)"!="" +VERBOSEFLAG := +.ELSE +VERBOSEFLAG := -s .ENDIF -VISIBILITY_HIDDEN=TRUE +all: + cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) && $(GNUMAKE) $(VERBOSEFLAG) -r deliverlog diff --git a/editeng/qa/items/borderline_test.cxx b/editeng/qa/items/borderline_test.cxx new file mode 100644 index 0000000000..5d67b62f82 --- /dev/null +++ b/editeng/qa/items/borderline_test.cxx @@ -0,0 +1,136 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * [ insert your name / company etc. here eg. Jim Bob <jim@bob.org> ] + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Jim Bob <jim@bob.org> + * Ted <ted@bear.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + +#include <editeng/borderline.hxx> +#include <sal/cppunit.h> + +#define TEST_WIDTH long( 40 ) + +#define THINTHICKSG_IN_WIDTH long( 15 ) +#define THINTHICKSG_OUT_WIDTH long( 40 ) +#define THINTHICKSG_DIST_WIDTH long( 15 ) + +#define THINTHICKLG_IN_WIDTH long( 15 ) +#define THINTHICKLG_OUT_WIDTH long( 30 ) +#define THINTHICKLG_DIST_WIDTH long( 40 ) + +using namespace editeng; + +namespace { + +class BorderLineTest : public CppUnit::TestFixture +{ + public: + void testGuessWidthDouble(); + void testGuessWidthNoMatch(); + void testGuessWidthThinthickSmallgap(); + void testGuessWidthThinthickLargegap(); + void testGuessWidthNostyleDouble(); + void testGuessWidthNostyleSingle(); + + CPPUNIT_TEST_SUITE(BorderLineTest); + CPPUNIT_TEST(testGuessWidthDouble); + CPPUNIT_TEST(testGuessWidthNoMatch); + CPPUNIT_TEST(testGuessWidthThinthickSmallgap); + CPPUNIT_TEST(testGuessWidthThinthickLargegap); + CPPUNIT_TEST(testGuessWidthNostyleDouble); + CPPUNIT_TEST(testGuessWidthNostyleSingle); + CPPUNIT_TEST_SUITE_END(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(BorderLineTest); + +void BorderLineTest::testGuessWidthDouble() +{ + // Normal double case + SvxBorderLine line; + line.GuessLinesWidths( DOUBLE, TEST_WIDTH, TEST_WIDTH, TEST_WIDTH ); + CPPUNIT_ASSERT_EQUAL( DOUBLE, line.GetStyle() ); + CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, line.GetWidth() ); +} + +void BorderLineTest::testGuessWidthNoMatch() +{ + SvxBorderLine line; + line.GuessLinesWidths( DOUBLE, + TEST_WIDTH + 1, TEST_WIDTH + 2, TEST_WIDTH + 3 ); + CPPUNIT_ASSERT_EQUAL( DOUBLE, line.GetStyle() ); + CPPUNIT_ASSERT_EQUAL( long( 0 ), line.GetWidth() ); +} + +void BorderLineTest::testGuessWidthThinthickSmallgap() +{ + SvxBorderLine line; + line.GuessLinesWidths( DOUBLE, + THINTHICKSG_OUT_WIDTH, + THINTHICKSG_IN_WIDTH, + THINTHICKSG_DIST_WIDTH ); + CPPUNIT_ASSERT_EQUAL( THINTHICK_SMALLGAP, line.GetStyle() ); + CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, line.GetWidth() ); +} + +void BorderLineTest::testGuessWidthThinthickLargegap() +{ + SvxBorderLine line; + line.GuessLinesWidths( DOUBLE, + THINTHICKLG_OUT_WIDTH, + THINTHICKLG_IN_WIDTH, + THINTHICKLG_DIST_WIDTH ); + CPPUNIT_ASSERT_EQUAL( THINTHICK_LARGEGAP, line.GetStyle() ); + CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, line.GetWidth() ); +} + +void BorderLineTest::testGuessWidthNostyleDouble() +{ + SvxBorderLine line; + line.GuessLinesWidths( NO_STYLE, + THINTHICKLG_OUT_WIDTH, + THINTHICKLG_IN_WIDTH, + THINTHICKLG_DIST_WIDTH ); + CPPUNIT_ASSERT_EQUAL( THINTHICK_LARGEGAP, line.GetStyle() ); + CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, line.GetWidth() ); +} + +void BorderLineTest::testGuessWidthNostyleSingle() +{ + SvxBorderLine line; + line.GuessLinesWidths( NO_STYLE, TEST_WIDTH ); + CPPUNIT_ASSERT_EQUAL( SOLID, line.GetStyle() ); + CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, line.GetWidth() ); +} + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/accessibility/AccessibleComponentBase.cxx b/editeng/source/accessibility/AccessibleComponentBase.cxx index 846801961f..181e048592 100644 --- a/editeng/source/accessibility/AccessibleComponentBase.cxx +++ b/editeng/source/accessibility/AccessibleComponentBase.cxx @@ -200,7 +200,7 @@ sal_Int32 SAL_CALL AccessibleComponentBase::getBackground (void) ::rtl::OUString SAL_CALL AccessibleComponentBase::getTitledBorderText (void) throw (::com::sun::star::uno::RuntimeException) { - return ::rtl::OUString::createFromAscii (""); + return ::rtl::OUString (); } @@ -209,7 +209,7 @@ sal_Int32 SAL_CALL AccessibleComponentBase::getBackground (void) ::rtl::OUString SAL_CALL AccessibleComponentBase::getToolTipText (void) throw (::com::sun::star::uno::RuntimeException) { - return ::rtl::OUString::createFromAscii (""); + return ::rtl::OUString (); } diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx index 695ec888f3..37650fbdc5 100644 --- a/editeng/source/accessibility/AccessibleContextBase.cxx +++ b/editeng/source/accessibility/AccessibleContextBase.cxx @@ -56,7 +56,7 @@ namespace accessibility { //===== internal ============================================================ // Define a shortcut for the somewhot longish base class name. -typedef ::cppu::WeakComponentImplHelper4< +typedef ::cppu::PartialWeakComponentImplHelper4< ::com::sun::star::accessibility::XAccessible, ::com::sun::star::accessibility::XAccessibleContext, ::com::sun::star::accessibility::XAccessibleEventBroadcaster, @@ -244,7 +244,7 @@ uno::Reference<XAccessible> SAL_CALL { ThrowIfDisposed (); throw lang::IndexOutOfBoundsException ( - ::rtl::OUString::createFromAscii ("no child with index " + nIndex), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("no child with index ") + nIndex), NULL); } @@ -638,7 +638,7 @@ void AccessibleContextBase::SetAccessibleName ( ::rtl::OUString AccessibleContextBase::CreateAccessibleDescription (void) throw (::com::sun::star::uno::RuntimeException) { - return ::rtl::OUString::createFromAscii ("Empty Description"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("Empty Description")); } @@ -647,7 +647,7 @@ void AccessibleContextBase::SetAccessibleName ( ::rtl::OUString AccessibleContextBase::CreateAccessibleName (void) throw (::com::sun::star::uno::RuntimeException) { - return ::rtl::OUString::createFromAscii ("Empty Name"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("Empty Name")); } diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 727b994f2c..b2c1478bca 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -191,14 +191,14 @@ namespace accessibility "AccessibleEditableTextPara::getLocale: paragraph index value overflow"); // return locale of first character in the paragraph - return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< USHORT >( GetParagraphIndex() ), 0 )); + return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< sal_uInt16 >( GetParagraphIndex() ), 0 )); } void AccessibleEditableTextPara::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - USHORT nStart, nEnd; + sal_uInt16 nStart, nEnd; if( GetSelection( nStart, nEnd ) ) { @@ -232,13 +232,13 @@ namespace accessibility DBG_ASSERT(nParaIndex >= 0 && nParaIndex <= USHRT_MAX, "AccessibleEditableTextPara::implGetLineBoundary: paragraph index value overflow"); - const sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< USHORT >( nParaIndex ) ); + const sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< sal_uInt16 >( nParaIndex ) ); CheckPosition(nIndex); rBoundary.startPos = rBoundary.endPos = -1; - const USHORT nLineCount=rCacheTF.GetLineCount( static_cast< USHORT >( nParaIndex ) ); + const sal_uInt16 nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) ); if( nIndex == nTextLen ) { @@ -246,7 +246,7 @@ namespace accessibility if( nLineCount <= 1 ) rBoundary.startPos = 0; else - rBoundary.startPos = nTextLen - rCacheTF.GetLineLen( static_cast< USHORT >( nParaIndex ), + rBoundary.startPos = nTextLen - rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLineCount-1 ); rBoundary.endPos = nTextLen; @@ -254,15 +254,15 @@ namespace accessibility else { // normal line search - USHORT nLine; + sal_uInt16 nLine; sal_Int32 nCurIndex; for( nLine=0, nCurIndex=0; nLine<nLineCount; ++nLine ) { - nCurIndex += rCacheTF.GetLineLen( static_cast< USHORT >( nParaIndex ), nLine); + nCurIndex += rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLine); if( nCurIndex > nIndex ) { - rBoundary.startPos = nCurIndex - rCacheTF.GetLineLen(static_cast< USHORT >( nParaIndex ), nLine); + rBoundary.startPos = nCurIndex - rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine); rBoundary.endPos = nCurIndex; break; } @@ -398,9 +398,9 @@ namespace accessibility GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::MakeSelection: index value overflow"); - USHORT nParaIndex = static_cast< USHORT >( GetParagraphIndex() ); - return ESelection( nParaIndex, static_cast< USHORT >( nStartEEIndex ), - nParaIndex, static_cast< USHORT >( nEndEEIndex ) ); + sal_uInt16 nParaIndex = static_cast< sal_uInt16 >( GetParagraphIndex() ); + return ESelection( nParaIndex, static_cast< sal_uInt16 >( nStartEEIndex ), + nParaIndex, static_cast< sal_uInt16 >( nEndEEIndex ) ); } ESelection AccessibleEditableTextPara::MakeSelection( sal_Int32 nEEIndex ) @@ -445,12 +445,12 @@ namespace accessibility CheckPosition( nEnd ); } - sal_Bool AccessibleEditableTextPara::GetSelection( USHORT& nStartPos, USHORT& nEndPos ) SAL_THROW((uno::RuntimeException)) + sal_Bool AccessibleEditableTextPara::GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ) SAL_THROW((uno::RuntimeException)) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); ESelection aSelection; - USHORT nPara = static_cast< USHORT > ( GetParagraphIndex() ); + sal_uInt16 nPara = static_cast< sal_uInt16 > ( GetParagraphIndex() ); if( !GetEditViewForwarder().GetSelection( aSelection ) ) return sal_False; @@ -504,11 +504,11 @@ namespace accessibility return GetTextForwarder().GetText( MakeSelection(nStartIndex, nEndIndex) ); } - USHORT AccessibleEditableTextPara::GetTextLen() const SAL_THROW((uno::RuntimeException)) + sal_uInt16 AccessibleEditableTextPara::GetTextLen() const SAL_THROW((uno::RuntimeException)) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - return GetTextForwarder().GetTextLen( static_cast< USHORT >( GetParagraphIndex() ) ); + return GetTextForwarder().GetTextLen( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); } sal_Bool AccessibleEditableTextPara::IsVisible() const @@ -659,7 +659,7 @@ namespace accessibility DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::HaveChildren: paragraph index value overflow"); - return GetTextForwarder().HaveImageBullet( static_cast< USHORT >(GetParagraphIndex()) ); + return GetTextForwarder().HaveImageBullet( static_cast< sal_uInt16 >(GetParagraphIndex()) ); } sal_Bool AccessibleEditableTextPara::IsActive() const SAL_THROW((uno::RuntimeException)) @@ -785,7 +785,7 @@ namespace accessibility } } - sal_Bool AccessibleEditableTextPara::GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, sal_Int32 nIndex ) + sal_Bool AccessibleEditableTextPara::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nIndex ) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); @@ -797,8 +797,8 @@ namespace accessibility return GetTextForwarder().GetAttributeRun( nStartIndex, nEndIndex, - static_cast< USHORT >(GetParagraphIndex()), - static_cast< USHORT >(nIndex) ); + static_cast< sal_uInt16 >(GetParagraphIndex()), + static_cast< sal_uInt16 >(nIndex) ); } uno::Any SAL_CALL AccessibleEditableTextPara::queryInterface (const uno::Type & rType) throw (uno::RuntimeException) @@ -897,7 +897,7 @@ namespace accessibility #ifdef DBG_UTIL if( !mxParent.is() ) - DBG_TRACE( "AccessibleEditableTextPara::getAccessibleParent: no frontend set, did somebody forgot to call AccessibleTextHelper::SetEventSource()?"); + OSL_TRACE( "AccessibleEditableTextPara::getAccessibleParent: no frontend set, did somebody forgot to call AccessibleTextHelper::SetEventSource()?"); #endif return mxParent; @@ -1054,7 +1054,7 @@ namespace accessibility SvxTextForwarder& rCacheTF = GetTextForwarder(); Point aLogPoint( GetViewForwarder().PixelToLogic( aPoint, rCacheTF.GetMapMode() ) ); - EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< USHORT > (GetParagraphIndex()) ); + EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 > (GetParagraphIndex()) ); if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible && @@ -1081,7 +1081,7 @@ namespace accessibility "AccessibleEditableTextPara::getBounds: index value overflow"); SvxTextForwarder& rCacheTF = GetTextForwarder(); - Rectangle aRect = rCacheTF.GetParaBounds( static_cast< USHORT >( GetParagraphIndex() ) ); + Rectangle aRect = rCacheTF.GetParaBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); // convert to screen coordinates Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect, @@ -1179,7 +1179,7 @@ namespace accessibility // #104444# Added to XAccessibleComponent interface svtools::ColorConfig aColorConfig; - UINT32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor; + sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor; return static_cast<sal_Int32>(nColor); } @@ -1256,24 +1256,6 @@ namespace accessibility const beans::PropertyValue &rRunAttrib = pRunAttrib[k]; aPropHashMap[ rRunAttrib.Name ] = rRunAttrib.Value; //!! should not only be the value !! } -#ifdef TL_DEBUG - { - uno::Sequence< rtl::OUString > aNames(1); - aNames.getArray()[0] = rtl::OUString::createFromAscii("CharHeight"); - const rtl::OUString *pNames = aNames.getConstArray(); - const uno::Sequence< beans::PropertyValue > aAttribs( getRunAttributes( nIndex, aNames ) ); - const beans::PropertyValue *pAttribs = aAttribs.getConstArray(); - double d1 = -1.0; - float f1 = -1.0; - if (aAttribs.getLength()) - { - uno::Any aAny( pAttribs[0].Value ); - aAny >>= d1; - aAny >>= f1; - } - int i = 3; - } -#endif // get resulting sequence uno::Sequence< beans::PropertyValue > aRes; @@ -1314,7 +1296,7 @@ namespace accessibility CheckPosition( nIndex ); SvxTextForwarder& rCacheTF = GetTextForwarder(); - Rectangle aRect = rCacheTF.GetCharBounds( static_cast< USHORT >( GetParagraphIndex() ), static_cast< USHORT >( nIndex ) ); + Rectangle aRect = rCacheTF.GetCharBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ), static_cast< sal_uInt16 >( nIndex ) ); // convert to screen Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect, @@ -1353,7 +1335,7 @@ namespace accessibility SolarMutexGuard aGuard; - USHORT nPara, nIndex; + sal_uInt16 nPara, nIndex; // offset from surrounding cell/shape Point aOffset( GetEEOffset() ); @@ -1364,7 +1346,7 @@ namespace accessibility Point aLogPoint( GetViewForwarder().PixelToLogic( aPoint, rCacheTF.GetMapMode() ) ); // re-offset to parent (paragraph) - Rectangle aParaRect = rCacheTF.GetParaBounds( static_cast< USHORT >( GetParagraphIndex() ) ); + Rectangle aParaRect = rCacheTF.GetParaBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); aLogPoint.Move( aParaRect.Left(), aParaRect.Top() ); if( rCacheTF.GetIndexAtPoint( aLogPoint, nPara, nIndex ) && @@ -1504,7 +1486,7 @@ namespace accessibility // implGetAttributeRunBoundary() method there case AccessibleTextType::ATTRIBUTE_RUN: { - const sal_Int32 nTextLen = GetTextForwarder().GetTextLen( static_cast< USHORT >( GetParagraphIndex() ) ); + const sal_Int32 nTextLen = GetTextForwarder().GetTextLen( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); if( nIndex == nTextLen ) { @@ -1513,7 +1495,7 @@ namespace accessibility } else { - USHORT nStartIndex, nEndIndex; + sal_uInt16 nStartIndex, nEndIndex; if( GetAttributeRun(nStartIndex, nEndIndex, nIndex) ) { @@ -1552,8 +1534,8 @@ namespace accessibility // implGetAttributeRunBoundary() method there case AccessibleTextType::ATTRIBUTE_RUN: { - const sal_Int32 nTextLen = GetTextForwarder().GetTextLen( static_cast< USHORT >( GetParagraphIndex() ) ); - USHORT nStartIndex, nEndIndex; + const sal_Int32 nTextLen = GetTextForwarder().GetTextLen( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); + sal_uInt16 nStartIndex, nEndIndex; if( nIndex == nTextLen ) { @@ -1609,7 +1591,7 @@ namespace accessibility { case AccessibleTextType::ATTRIBUTE_RUN: { - USHORT nStartIndex, nEndIndex; + sal_uInt16 nStartIndex, nEndIndex; if( GetAttributeRun(nStartIndex, nEndIndex, nIndex) ) { @@ -1850,7 +1832,7 @@ namespace accessibility // AccessibleEmptyEditSource relies on this behaviour GetEditViewForwarder( sal_True ); SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs - USHORT nPara = static_cast< USHORT >( GetParagraphIndex() ); + sal_uInt16 nPara = static_cast< sal_uInt16 >( GetParagraphIndex() ); DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::setAttributes: index value overflow"); @@ -1881,7 +1863,7 @@ namespace accessibility } catch( const uno::Exception& ) { - DBG_ERROR("AccessibleEditableTextPara::setAttributes exception in setPropertyValue"); + OSL_FAIL("AccessibleEditableTextPara::setAttributes exception in setPropertyValue"); } ++pPropArray; @@ -1981,7 +1963,7 @@ namespace accessibility PropertyState eState = aPropSet._getPropertyState( pProperties->Name, mnParagraphIndex ); if ( eState == PropertyState_AMBIGUOUS_VALUE ) { - OSL_ENSURE( false, "ambiguous property value encountered" ); + OSL_FAIL( "ambiguous property value encountered" ); } //if (eState == PropertyState_DIRECT_VALUE) @@ -2099,9 +2081,9 @@ namespace accessibility SvxAccessibleTextAdapter& rT = GetTextForwarder(); const sal_Int32 nPara = GetParagraphIndex(); - USHORT nHyperLinks = 0; - USHORT nFields = rT.GetFieldCount( nPara ); - for ( USHORT n = 0; n < nFields; n++ ) + sal_uInt16 nHyperLinks = 0; + sal_uInt16 nFields = rT.GetFieldCount( nPara ); + for ( sal_uInt16 n = 0; n < nFields; n++ ) { EFieldInfo aField = rT.GetFieldInfo( nPara, n ); if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) @@ -2117,20 +2099,20 @@ namespace accessibility SvxAccessibleTextAdapter& rT = GetTextForwarder(); const sal_Int32 nPara = GetParagraphIndex(); - USHORT nHyperLink = 0; - USHORT nFields = rT.GetFieldCount( nPara ); - for ( USHORT n = 0; n < nFields; n++ ) + sal_uInt16 nHyperLink = 0; + sal_uInt16 nFields = rT.GetFieldCount( nPara ); + for ( sal_uInt16 n = 0; n < nFields; n++ ) { EFieldInfo aField = rT.GetFieldInfo( nPara, n ); if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) { if ( nHyperLink == nLinkIndex ) { - USHORT nEEStart = aField.aPosition.nIndex; + sal_uInt16 nEEStart = aField.aPosition.nIndex; // Translate EE Index to accessible index - USHORT nStart = rT.CalcEditEngineIndex( nPara, nEEStart ); - USHORT nEnd = nStart + aField.aCurrentText.Len(); + sal_uInt16 nStart = rT.CalcEditEngineIndex( nPara, nEEStart ); + sal_uInt16 nEnd = nStart + aField.aCurrentText.Len(); xRef = new AccessibleHyperlink( rT, new SvxFieldItem( *aField.pFieldItem ), nPara, nEEStart, nStart, nEnd, aField.aCurrentText ); break; } @@ -2148,13 +2130,13 @@ namespace accessibility // SvxAccessibleTextIndex aIndex; // aIndex.SetIndex(nPara, nCharIndex, rT); -// const USHORT nEEIndex = aIndex.GetEEIndex(); +// const sal_uInt16 nEEIndex = aIndex.GetEEIndex(); - const USHORT nEEIndex = rT.CalcEditEngineIndex( nPara, nCharIndex ); + const sal_uInt16 nEEIndex = rT.CalcEditEngineIndex( nPara, nCharIndex ); sal_Int32 nHLIndex = 0; - USHORT nHyperLink = 0; - USHORT nFields = rT.GetFieldCount( nPara ); - for ( USHORT n = 0; n < nFields; n++ ) + sal_uInt16 nHyperLink = 0; + sal_uInt16 nFields = rT.GetFieldCount( nPara ); + for ( sal_uInt16 n = 0; n < nFields; n++ ) { EFieldInfo aField = rT.GetFieldInfo( nPara, n ); if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) @@ -2185,8 +2167,8 @@ namespace accessibility if (bValidPara) { // we explicitly allow for the index to point at the character right behind the text - if (0 <= nIndex && nIndex <= rCacheTF.GetTextLen( static_cast< USHORT >(nPara) )) - nRes = rCacheTF.GetLineNumberAtIndex( static_cast< USHORT >(nPara), static_cast< USHORT >(nIndex) ); + if (0 <= nIndex && nIndex <= rCacheTF.GetTextLen( static_cast< sal_uInt16 >(nPara) )) + nRes = rCacheTF.GetLineNumberAtIndex( static_cast< sal_uInt16 >(nPara), static_cast< sal_uInt16 >(nIndex) ); else throw lang::IndexOutOfBoundsException(); } @@ -2205,10 +2187,10 @@ namespace accessibility DBG_ASSERT( bValidPara, "getTextAtLineNumber: current paragraph index out of range" ); if (bValidPara) { - if (0 <= nLineNo && nLineNo < rCacheTF.GetLineCount( static_cast< USHORT >(nPara) )) + if (0 <= nLineNo && nLineNo < rCacheTF.GetLineCount( static_cast< sal_uInt16 >(nPara) )) { - USHORT nStart = 0, nEnd = 0; - rCacheTF.GetLineBoundaries( nStart, nEnd, static_cast< USHORT >(nPara), static_cast< USHORT >(nLineNo) ); + sal_uInt16 nStart = 0, nEnd = 0; + rCacheTF.GetLineBoundaries( nStart, nEnd, static_cast< sal_uInt16 >(nPara), static_cast< sal_uInt16 >(nLineNo) ); if (nStart != 0xFFFF && nEnd != 0xFFFF) { try diff --git a/editeng/source/accessibility/AccessibleHyperlink.cxx b/editeng/source/accessibility/AccessibleHyperlink.cxx index d0b427558e..284cc8a11b 100644 --- a/editeng/source/accessibility/AccessibleHyperlink.cxx +++ b/editeng/source/accessibility/AccessibleHyperlink.cxx @@ -7,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: AccessibleEditableTextPara.cxx,v $ - * $Revision: 1.53 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -53,7 +50,7 @@ using namespace ::com::sun::star; namespace accessibility { - AccessibleHyperlink::AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, USHORT nP, USHORT nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ) + AccessibleHyperlink::AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, sal_uInt16 nP, sal_uInt16 nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ) : rTA( r ) { pFld = p; diff --git a/editeng/source/accessibility/AccessibleHyperlink.hxx b/editeng/source/accessibility/AccessibleHyperlink.hxx index b021566701..d670aff911 100644 --- a/editeng/source/accessibility/AccessibleHyperlink.hxx +++ b/editeng/source/accessibility/AccessibleHyperlink.hxx @@ -7,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: AccessibleEditableTextPara.hxx,v $ - * $Revision: 1.22 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -55,12 +52,12 @@ namespace accessibility SvxAccessibleTextAdapter& rTA; SvxFieldItem* pFld; - USHORT nPara, nRealIdx; // EE values + sal_uInt16 nPara, nRealIdx; // EE values sal_Int32 nStartIdx, nEndIdx; // translated values ::rtl::OUString aDescription; public: - AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, USHORT nP, USHORT nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ); + AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, sal_uInt16 nP, sal_uInt16 nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ); ~AccessibleHyperlink(); // XAccessibleAction diff --git a/editeng/source/accessibility/AccessibleImageBullet.cxx b/editeng/source/accessibility/AccessibleImageBullet.cxx index 3d65307c4c..e1dd35b030 100644 --- a/editeng/source/accessibility/AccessibleImageBullet.cxx +++ b/editeng/source/accessibility/AccessibleImageBullet.cxx @@ -219,7 +219,7 @@ namespace accessibility "AccessibleImageBullet::getLocale: paragraph index value overflow"); // return locale of first character in the paragraph - return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< USHORT >( GetParagraphIndex() ), 0 )); + return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< sal_uInt16 >( GetParagraphIndex() ), 0 )); } void SAL_CALL AccessibleImageBullet::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException) @@ -272,8 +272,8 @@ namespace accessibility "AccessibleEditableTextPara::getBounds: index value overflow"); SvxTextForwarder& rCacheTF = GetTextForwarder(); - EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< USHORT > (GetParagraphIndex()) ); - Rectangle aParentRect = rCacheTF.GetParaBounds( static_cast< USHORT >( GetParagraphIndex() ) ); + EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 > (GetParagraphIndex()) ); + Rectangle aParentRect = rCacheTF.GetParaBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible && @@ -365,7 +365,7 @@ namespace accessibility // #104444# Added to XAccessibleComponent interface svtools::ColorConfig aColorConfig; - UINT32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor; + sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor; return static_cast<sal_Int32>(nColor); } diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx index ad35aab519..b6a55541ec 100644 --- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx +++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx @@ -103,8 +103,8 @@ namespace accessibility nEndIndex >= 0 && nEndIndex <= USHRT_MAX , "AccessibleStaticTextBase_Impl::MakeSelection: index value overflow"); - return ESelection( static_cast< USHORT >(nStartPara), static_cast< USHORT >(nStartIndex), - static_cast< USHORT >(nEndPara), static_cast< USHORT >(nEndIndex) ); + return ESelection( static_cast< sal_uInt16 >(nStartPara), static_cast< sal_uInt16 >(nStartIndex), + static_cast< sal_uInt16 >(nEndPara), static_cast< sal_uInt16 >(nEndIndex) ); } //------------------------------------------------------------------------ @@ -345,7 +345,7 @@ namespace accessibility sal_Int32 nIndex = 0; if( mpTextParagraph ) - nIndex = mpTextParagraph->GetTextForwarder().GetLineCount( static_cast< USHORT >(nParagraph) ); + nIndex = mpTextParagraph->GetTextForwarder().GetLineCount( static_cast< sal_uInt16 >(nParagraph) ); return nIndex; } @@ -399,7 +399,7 @@ namespace accessibility nFlatIndex - nCurrIndex + nCurrCount >= 0 && nFlatIndex - nCurrIndex + nCurrCount <= USHRT_MAX , "AccessibleStaticTextBase_Impl::Index2Internal: index value overflow"); - return EPosition( static_cast< USHORT >(nCurrPara), static_cast< USHORT >(nFlatIndex - nCurrIndex + nCurrCount) ); + return EPosition( static_cast< sal_uInt16 >(nCurrPara), static_cast< sal_uInt16 >(nFlatIndex - nCurrIndex + nCurrCount) ); } } @@ -411,7 +411,7 @@ namespace accessibility nFlatIndex - nCurrIndex + nCurrCount >= 0 && nFlatIndex - nCurrIndex + nCurrCount <= USHRT_MAX , "AccessibleStaticTextBase_Impl::Index2Internal: index value overflow"); - return EPosition( static_cast< USHORT >(nCurrPara-1), static_cast< USHORT >(nFlatIndex - nCurrIndex + nCurrCount) ); + return EPosition( static_cast< sal_uInt16 >(nCurrPara-1), static_cast< sal_uInt16 >(nFlatIndex - nCurrIndex + nCurrCount) ); } // not found? Out of bounds @@ -727,8 +727,8 @@ namespace accessibility // #112814# Use correct index offset if ( ( nIndex = rPara.getIndexAtPoint( aPoint ) ) != -1 ) - return mpImpl->Internal2Index( EPosition(sal::static_int_cast<USHORT>(i), - sal::static_int_cast<USHORT>(nIndex)) ); + return mpImpl->Internal2Index( EPosition(sal::static_int_cast<sal_uInt16>(i), + sal::static_int_cast<sal_uInt16>(nIndex)) ); } return -1; diff --git a/editeng/source/accessibility/AccessibleStringWrap.cxx b/editeng/source/accessibility/AccessibleStringWrap.cxx index 30d6467227..8f10f038b9 100644 --- a/editeng/source/accessibility/AccessibleStringWrap.cxx +++ b/editeng/source/accessibility/AccessibleStringWrap.cxx @@ -68,7 +68,7 @@ sal_Bool AccessibleStringWrap::GetCharacterBounds( sal_Int32 nIndex, Rectangle& else { sal_Int32 aXArray[2]; - mrDev.GetCaretPositions( maText, aXArray, static_cast< USHORT >(nIndex), 1 ); + mrDev.GetCaretPositions( maText, aXArray, static_cast< sal_uInt16 >(nIndex), 1 ); rRect.Left() = 0; rRect.Top() = 0; rRect.SetSize( Size(mrDev.GetTextHeight(), labs(aXArray[0] - aXArray[1])) ); diff --git a/editeng/source/accessibility/accessibility.src b/editeng/source/accessibility/accessibility.src index 51d2a49e6e..d7ed9ff738 100644 --- a/editeng/source/accessibility/accessibility.src +++ b/editeng/source/accessibility/accessibility.src @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: accessibility.src,v $ - * $Revision: 1.34 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/editeng/source/accessibility/makefile.mk b/editeng/source/accessibility/makefile.mk deleted file mode 100644 index 80cb6df746..0000000000 --- a/editeng/source/accessibility/makefile.mk +++ /dev/null @@ -1,59 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.25 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=editeng -TARGET=accessibility -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/AccessibleStringWrap.obj \ - $(SLO)$/AccessibleContextBase.obj \ - $(SLO)$/AccessibleComponentBase.obj \ - $(SLO)$/AccessibleSelectionBase.obj \ - $(SLO)$/AccessibleStaticTextBase.obj \ - $(SLO)$/AccessibleParaManager.obj \ - $(SLO)$/AccessibleEditableTextPara.obj \ - $(SLO)$/AccessibleHyperlink.obj \ - $(SLO)$/AccessibleImageBullet.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx index 8f50b34373..59647d6a90 100644 --- a/editeng/source/editeng/editattr.cxx +++ b/editeng/source/editeng/editattr.cxx @@ -76,13 +76,13 @@ EditAttrib::~EditAttrib() // ------------------------------------------------------------------------- // class EditCharAttrib // ------------------------------------------------------------------------- -EditCharAttrib::EditCharAttrib( const SfxPoolItem& rAttr, USHORT nS, USHORT nE ) +EditCharAttrib::EditCharAttrib( const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE ) : EditAttrib( rAttr ) { nStart = nS; nEnd = nE; - bFeature = FALSE; - bEdge = FALSE; + bFeature = sal_False; + bEdge = sal_False; DBG_ASSERT( ( rAttr.Which() >= EE_ITEMS_START ) && ( rAttr.Which() <= EE_ITEMS_END ), "EditCharAttrib CTOR: Invalid id!" ); DBG_ASSERT( ( rAttr.Which() < EE_FEATURE_START ) || ( rAttr.Which() > EE_FEATURE_END ) || ( nE == (nS+1) ), "EditCharAttrib CTOR: Invalid feature!" ); @@ -96,10 +96,10 @@ void EditCharAttrib::SetFont( SvxFont&, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribFont // ------------------------------------------------------------------------- -EditCharAttribFont::EditCharAttribFont( const SvxFontItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribFont::EditCharAttribFont( const SvxFontItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_FONTINFO || rAttr.Which() == EE_CHAR_FONTINFO_CJK || rAttr.Which() == EE_CHAR_FONTINFO_CTL, "Kein Fontattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_FONTINFO || rAttr.Which() == EE_CHAR_FONTINFO_CJK || rAttr.Which() == EE_CHAR_FONTINFO_CTL, "Not a Font attribute!" ); } void EditCharAttribFont::SetFont( SvxFont& rFont, OutputDevice* ) @@ -115,10 +115,10 @@ void EditCharAttribFont::SetFont( SvxFont& rFont, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribItalic // ------------------------------------------------------------------------- -EditCharAttribItalic::EditCharAttribItalic( const SvxPostureItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribItalic::EditCharAttribItalic( const SvxPostureItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_ITALIC || rAttr.Which() == EE_CHAR_ITALIC_CJK || rAttr.Which() == EE_CHAR_ITALIC_CTL, "Kein Italicattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_ITALIC || rAttr.Which() == EE_CHAR_ITALIC_CJK || rAttr.Which() == EE_CHAR_ITALIC_CTL, "Not a Italic attribute!" ); } void EditCharAttribItalic::SetFont( SvxFont& rFont, OutputDevice* ) @@ -129,10 +129,10 @@ void EditCharAttribItalic::SetFont( SvxFont& rFont, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribWeight // ------------------------------------------------------------------------- -EditCharAttribWeight::EditCharAttribWeight( const SvxWeightItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribWeight::EditCharAttribWeight( const SvxWeightItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_WEIGHT || rAttr.Which() == EE_CHAR_WEIGHT_CJK || rAttr.Which() == EE_CHAR_WEIGHT_CTL, "Kein Weightttribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_WEIGHT || rAttr.Which() == EE_CHAR_WEIGHT_CJK || rAttr.Which() == EE_CHAR_WEIGHT_CTL, "Not a Weight attribute!" ); } void EditCharAttribWeight::SetFont( SvxFont& rFont, OutputDevice* ) @@ -143,10 +143,10 @@ void EditCharAttribWeight::SetFont( SvxFont& rFont, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribUnderline // ------------------------------------------------------------------------- -EditCharAttribUnderline::EditCharAttribUnderline( const SvxUnderlineItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribUnderline::EditCharAttribUnderline( const SvxUnderlineItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_UNDERLINE, "Kein Underlineattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_UNDERLINE, "Not a Underline attribute!" ); } void EditCharAttribUnderline::SetFont( SvxFont& rFont, OutputDevice* pOutDev ) @@ -159,10 +159,10 @@ void EditCharAttribUnderline::SetFont( SvxFont& rFont, OutputDevice* pOutDev ) // ------------------------------------------------------------------------- // class EditCharAttribOverline // ------------------------------------------------------------------------- -EditCharAttribOverline::EditCharAttribOverline( const SvxOverlineItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribOverline::EditCharAttribOverline( const SvxOverlineItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_OVERLINE, "Kein Overlineattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_OVERLINE, "Not a overline attribute!" ); } void EditCharAttribOverline::SetFont( SvxFont& rFont, OutputDevice* pOutDev ) @@ -175,25 +175,25 @@ void EditCharAttribOverline::SetFont( SvxFont& rFont, OutputDevice* pOutDev ) // ------------------------------------------------------------------------- // class EditCharAttribFontHeight // ------------------------------------------------------------------------- -EditCharAttribFontHeight::EditCharAttribFontHeight( const SvxFontHeightItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribFontHeight::EditCharAttribFontHeight( const SvxFontHeightItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_FONTHEIGHT || rAttr.Which() == EE_CHAR_FONTHEIGHT_CJK || rAttr.Which() == EE_CHAR_FONTHEIGHT_CTL, "Kein Heightattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_FONTHEIGHT || rAttr.Which() == EE_CHAR_FONTHEIGHT_CJK || rAttr.Which() == EE_CHAR_FONTHEIGHT_CTL, "Not a Height attribute!" ); } void EditCharAttribFontHeight::SetFont( SvxFont& rFont, OutputDevice* ) { - // Prop wird ignoriert + // Property is ignored rFont.SetSize( Size( rFont.GetSize().Width(), ((const SvxFontHeightItem*)GetItem())->GetHeight() ) ); } // ------------------------------------------------------------------------- // class EditCharAttribFontWidth // ------------------------------------------------------------------------- -EditCharAttribFontWidth::EditCharAttribFontWidth( const SvxCharScaleWidthItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribFontWidth::EditCharAttribFontWidth( const SvxCharScaleWidthItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_FONTWIDTH, "Kein Widthattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_FONTWIDTH, "Not a Width attribute!" ); } void EditCharAttribFontWidth::SetFont( SvxFont& /*rFont*/, OutputDevice* ) @@ -204,10 +204,10 @@ void EditCharAttribFontWidth::SetFont( SvxFont& /*rFont*/, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribStrikeout // ------------------------------------------------------------------------- -EditCharAttribStrikeout::EditCharAttribStrikeout( const SvxCrossedOutItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribStrikeout::EditCharAttribStrikeout( const SvxCrossedOutItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_STRIKEOUT, "Kein Sizeattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_STRIKEOUT, "Not a Size attribute!" ); } void EditCharAttribStrikeout::SetFont( SvxFont& rFont, OutputDevice* ) @@ -218,10 +218,10 @@ void EditCharAttribStrikeout::SetFont( SvxFont& rFont, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribColor // ------------------------------------------------------------------------- -EditCharAttribColor::EditCharAttribColor( const SvxColorItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribColor::EditCharAttribColor( const SvxColorItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_COLOR, "Kein Colorattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_COLOR, "Not a Color attribute!" ); } void EditCharAttribColor::SetFont( SvxFont& rFont, OutputDevice* ) @@ -232,10 +232,10 @@ void EditCharAttribColor::SetFont( SvxFont& rFont, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribLanguage // ------------------------------------------------------------------------- -EditCharAttribLanguage::EditCharAttribLanguage( const SvxLanguageItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribLanguage::EditCharAttribLanguage( const SvxLanguageItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( ( rAttr.Which() == EE_CHAR_LANGUAGE ) || ( rAttr.Which() == EE_CHAR_LANGUAGE_CJK ) || ( rAttr.Which() == EE_CHAR_LANGUAGE_CTL ), "Kein Languageattribut!" ); + DBG_ASSERT( ( rAttr.Which() == EE_CHAR_LANGUAGE ) || ( rAttr.Which() == EE_CHAR_LANGUAGE_CJK ) || ( rAttr.Which() == EE_CHAR_LANGUAGE_CTL ), "Not a Language attribute!" ); } void EditCharAttribLanguage::SetFont( SvxFont& rFont, OutputDevice* ) @@ -246,34 +246,30 @@ void EditCharAttribLanguage::SetFont( SvxFont& rFont, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribShadow // ------------------------------------------------------------------------- -EditCharAttribShadow::EditCharAttribShadow( const SvxShadowedItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribShadow::EditCharAttribShadow( const SvxShadowedItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_SHADOW, "Kein Shadowattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_SHADOW, "Not a Shadow attribute!" ); } void EditCharAttribShadow::SetFont( SvxFont& rFont, OutputDevice* ) { - rFont.SetShadow( (BOOL)((const SvxShadowedItem*)GetItem())->GetValue() ); + rFont.SetShadow( (sal_Bool)((const SvxShadowedItem*)GetItem())->GetValue() ); } // ------------------------------------------------------------------------- // class EditCharAttribEscapement // ------------------------------------------------------------------------- -EditCharAttribEscapement::EditCharAttribEscapement( const SvxEscapementItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribEscapement::EditCharAttribEscapement( const SvxEscapementItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_ESCAPEMENT, "Kein Escapementattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_ESCAPEMENT, "Not a escapement attribute!" ); } -#if defined( WIN ) && !defined( WNT ) -#pragma optimize ("", off) -#endif - void EditCharAttribEscapement::SetFont( SvxFont& rFont, OutputDevice* ) { - USHORT nProp = ((const SvxEscapementItem*)GetItem())->GetProp(); - rFont.SetPropr( (BYTE)nProp ); + sal_uInt16 nProp = ((const SvxEscapementItem*)GetItem())->GetProp(); + rFont.SetPropr( (sal_uInt8)nProp ); short nEsc = ((const SvxEscapementItem*)GetItem())->GetEsc(); if ( nEsc == DFLT_ESC_AUTO_SUPER ) @@ -283,32 +279,27 @@ void EditCharAttribEscapement::SetFont( SvxFont& rFont, OutputDevice* ) rFont.SetEscapement( nEsc ); } -#if defined( WIN ) && !defined( WNT ) -#pragma optimize ("", on) -#endif - - // ------------------------------------------------------------------------- // class EditCharAttribOutline // ------------------------------------------------------------------------- -EditCharAttribOutline::EditCharAttribOutline( const SvxContourItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribOutline::EditCharAttribOutline( const SvxContourItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_OUTLINE, "Kein Outlineattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_OUTLINE, "Not a Outline attribute!" ); } void EditCharAttribOutline::SetFont( SvxFont& rFont, OutputDevice* ) { - rFont.SetOutline( (BOOL)((const SvxContourItem*)GetItem())->GetValue() ); + rFont.SetOutline( (sal_Bool)((const SvxContourItem*)GetItem())->GetValue() ); } // ------------------------------------------------------------------------- // class EditCharAttribTab // ------------------------------------------------------------------------- -EditCharAttribTab::EditCharAttribTab( const SfxVoidItem& rAttr, USHORT nPos ) +EditCharAttribTab::EditCharAttribTab( const SfxVoidItem& rAttr, sal_uInt16 nPos ) : EditCharAttrib( rAttr, nPos, nPos+1 ) { - SetFeature( TRUE ); + SetFeature( sal_True ); } void EditCharAttribTab::SetFont( SvxFont&, OutputDevice* ) @@ -318,10 +309,10 @@ void EditCharAttribTab::SetFont( SvxFont&, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribLineBreak // ------------------------------------------------------------------------- -EditCharAttribLineBreak::EditCharAttribLineBreak( const SfxVoidItem& rAttr, USHORT nPos ) +EditCharAttribLineBreak::EditCharAttribLineBreak( const SfxVoidItem& rAttr, sal_uInt16 nPos ) : EditCharAttrib( rAttr, nPos, nPos+1 ) { - SetFeature( TRUE ); + SetFeature( sal_True ); } void EditCharAttribLineBreak::SetFont( SvxFont&, OutputDevice* ) @@ -331,10 +322,10 @@ void EditCharAttribLineBreak::SetFont( SvxFont&, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribField // ------------------------------------------------------------------------- -EditCharAttribField::EditCharAttribField( const SvxFieldItem& rAttr, USHORT nPos ) +EditCharAttribField::EditCharAttribField( const SvxFieldItem& rAttr, sal_uInt16 nPos ) : EditCharAttrib( rAttr, nPos, nPos+1 ) { - SetFeature( TRUE ); // !!! + SetFeature( sal_True ); // !!! pTxtColor = 0; pFldColor = 0; } @@ -344,7 +335,7 @@ void EditCharAttribField::SetFont( SvxFont& rFont, OutputDevice* ) if ( pFldColor ) { rFont.SetFillColor( *pFldColor ); - rFont.SetTransparent( FALSE ); + rFont.SetTransparent( sal_False ); } if ( pTxtColor ) rFont.SetColor( *pTxtColor ); @@ -354,8 +345,7 @@ EditCharAttribField::EditCharAttribField( const EditCharAttribField& rAttr ) : EditCharAttrib( *rAttr.GetItem(), rAttr.GetStart(), rAttr.GetEnd() ), aFieldValue( rAttr.aFieldValue ) { - // Diesen CCTOR nur fuer temporaeres Object verwenden, - // Item wird nicht gepoolt. + // Use this constructor only for temporary Objects, Item is not pooled. pTxtColor = rAttr.pTxtColor ? new Color( *rAttr.pTxtColor ) : 0; pFldColor = rAttr.pFldColor ? new Color( *rAttr.pFldColor ) : 0; } @@ -365,31 +355,31 @@ EditCharAttribField::~EditCharAttribField() Reset(); } -BOOL EditCharAttribField::operator == ( const EditCharAttribField& rAttr ) const +sal_Bool EditCharAttribField::operator == ( const EditCharAttribField& rAttr ) const { if ( aFieldValue != rAttr.aFieldValue ) - return FALSE; + return sal_False; if ( ( pTxtColor && !rAttr.pTxtColor ) || ( !pTxtColor && rAttr.pTxtColor ) ) - return FALSE; + return sal_False; if ( ( pTxtColor && rAttr.pTxtColor ) && ( *pTxtColor != *rAttr.pTxtColor ) ) - return FALSE; + return sal_False; if ( ( pFldColor && !rAttr.pFldColor ) || ( !pFldColor && rAttr.pFldColor ) ) - return FALSE; + return sal_False; if ( ( pFldColor && rAttr.pFldColor ) && ( *pFldColor != *rAttr.pFldColor ) ) - return FALSE; + return sal_False; - return TRUE; + return sal_True; } // ------------------------------------------------------------------------- // class EditCharAttribPairKerning // ------------------------------------------------------------------------- -EditCharAttribPairKerning::EditCharAttribPairKerning( const SvxAutoKernItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribPairKerning::EditCharAttribPairKerning( const SvxAutoKernItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_PAIRKERNING, "Kein PairKerning!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_PAIRKERNING, "Not a Pair Kerning!" ); } void EditCharAttribPairKerning::SetFont( SvxFont& rFont, OutputDevice* ) @@ -400,10 +390,10 @@ void EditCharAttribPairKerning::SetFont( SvxFont& rFont, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribKerning // ------------------------------------------------------------------------- -EditCharAttribKerning::EditCharAttribKerning( const SvxKerningItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribKerning::EditCharAttribKerning( const SvxKerningItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_KERNING, "Kein Kerning!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_KERNING, "Not a Kerning!" ); } void EditCharAttribKerning::SetFont( SvxFont& rFont, OutputDevice* ) @@ -414,10 +404,10 @@ void EditCharAttribKerning::SetFont( SvxFont& rFont, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribWordLineMode // ------------------------------------------------------------------------- -EditCharAttribWordLineMode::EditCharAttribWordLineMode( const SvxWordLineModeItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribWordLineMode::EditCharAttribWordLineMode( const SvxWordLineModeItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_WLM, "Kein Kerning!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_WLM, "Not a Kerning!" ); } void EditCharAttribWordLineMode::SetFont( SvxFont& rFont, OutputDevice* ) @@ -428,10 +418,10 @@ void EditCharAttribWordLineMode::SetFont( SvxFont& rFont, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribEmphasisMark // ------------------------------------------------------------------------- -EditCharAttribEmphasisMark::EditCharAttribEmphasisMark( const SvxEmphasisMarkItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribEmphasisMark::EditCharAttribEmphasisMark( const SvxEmphasisMarkItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { - DBG_ASSERT( rAttr.Which() == EE_CHAR_EMPHASISMARK, "Kein Emphasisattribut!" ); + DBG_ASSERT( rAttr.Which() == EE_CHAR_EMPHASISMARK, "Not a Emphasis attribute!" ); } void EditCharAttribEmphasisMark::SetFont( SvxFont& rFont, OutputDevice* ) @@ -442,7 +432,7 @@ void EditCharAttribEmphasisMark::SetFont( SvxFont& rFont, OutputDevice* ) // ------------------------------------------------------------------------- // class EditCharAttribRelief // ------------------------------------------------------------------------- -EditCharAttribRelief::EditCharAttribRelief( const SvxCharReliefItem& rAttr, USHORT _nStart, USHORT _nEnd ) +EditCharAttribRelief::EditCharAttribRelief( const SvxCharReliefItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) { DBG_ASSERT( rAttr.Which() == EE_CHAR_RELIEF, "Not a relief attribute!" ); diff --git a/editeng/source/editeng/editattr.hxx b/editeng/source/editeng/editattr.hxx index 27e20f3218..e4d73082b1 100644 --- a/editeng/source/editeng/editattr.hxx +++ b/editeng/source/editeng/editattr.hxx @@ -57,15 +57,15 @@ class SvxCharReliefItem; class SfxVoidItem; -#define CH_FEATURE_OLD (BYTE) 0xFF +#define CH_FEATURE_OLD (sal_uInt8) 0xFF #define CH_FEATURE (sal_Unicode) 0x01 -// DEF_METRIC: Bei meinem Pool sollte immer die DefMetric bei -// GetMetric( nWhich ) ankommen! -// => Zum ermitteln der DefMetrik einfach ein GetMetric( 0 ) +// DEF_METRIC: For my pool, the DefMetric should always appear when +// GetMetric (nWhich)! +// => To determine the DefMetric simply use GetMetric(0) #define DEF_METRIC 0 -// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- // class EditAttrib // ------------------------------------------------------------------------- class EditAttrib @@ -81,101 +81,101 @@ protected: virtual ~EditAttrib(); public: - // RemoveFromPool muss immer vorm DTOR Aufruf erfolgen!! + // RemoveFromPool must always be called before the destructor!! void RemoveFromPool( SfxItemPool& rPool ); - USHORT Which() const { return pItem->Which(); } + sal_uInt16 Which() const { return pItem->Which(); } const SfxPoolItem* GetItem() const { return pItem; } }; -// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- // class EditCharAttrib // ------------------------------------------------------------------------- -// bFeature: Attribut darf nicht expandieren/schrumfen, Laenge immer 1 -// bEdge: Attribut expandiert nicht, wenn genau an der Kante expandiert werden soll +// bFeature: Attribute must not expand/shrink, length is always 1 +// bEdge: Attribute will not expand, if you want to expand just on the edge class EditCharAttrib : public EditAttrib { protected: - USHORT nStart; - USHORT nEnd; - BOOL bFeature :1; - BOOL bEdge :1; + sal_uInt16 nStart; + sal_uInt16 nEnd; + sal_Bool bFeature :1; + sal_Bool bEdge :1; public: - EditCharAttrib( const SfxPoolItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttrib( const SfxPoolItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); - USHORT& GetStart() { return nStart; } - USHORT& GetEnd() { return nEnd; } + sal_uInt16& GetStart() { return nStart; } + sal_uInt16& GetEnd() { return nEnd; } - USHORT GetStart() const { return nStart; } - USHORT GetEnd() const { return nEnd; } + sal_uInt16 GetStart() const { return nStart; } + sal_uInt16 GetEnd() const { return nEnd; } - inline USHORT GetLen() const; + inline sal_uInt16 GetLen() const; - inline void MoveForward( USHORT nDiff ); - inline void MoveBackward( USHORT nDiff ); + inline void MoveForward( sal_uInt16 nDiff ); + inline void MoveBackward( sal_uInt16 nDiff ); - inline void Expand( USHORT nDiff ); - inline void Collaps( USHORT nDiff ); + inline void Expand( sal_uInt16 nDiff ); + inline void Collaps( sal_uInt16 nDiff ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); - BOOL IsIn( USHORT nIndex ) + sal_Bool IsIn( sal_uInt16 nIndex ) { return ( ( nStart <= nIndex ) && ( nEnd >= nIndex ) ); } - BOOL IsInside( USHORT nIndex ) + sal_Bool IsInside( sal_uInt16 nIndex ) { return ( ( nStart < nIndex ) && ( nEnd > nIndex ) ); } - BOOL IsEmpty() + sal_Bool IsEmpty() { return nStart == nEnd; } - BOOL IsFeature() const { return bFeature; } - void SetFeature( BOOL b) { bFeature = b; } + sal_Bool IsFeature() const { return bFeature; } + void SetFeature( sal_Bool b) { bFeature = b; } - BOOL IsEdge() const { return bEdge; } - void SetEdge( BOOL b ) { bEdge = b; } + sal_Bool IsEdge() const { return bEdge; } + void SetEdge( sal_Bool b ) { bEdge = b; } }; -inline USHORT EditCharAttrib::GetLen() const +inline sal_uInt16 EditCharAttrib::GetLen() const { DBG_ASSERT( nEnd >= nStart, "EditCharAttrib: nEnd < nStart!" ); return nEnd-nStart; } -inline void EditCharAttrib::MoveForward( USHORT nDiff ) +inline void EditCharAttrib::MoveForward( sal_uInt16 nDiff ) { DBG_ASSERT( ((long)nEnd + nDiff) <= 0xFFFF, "EditCharAttrib: MoveForward?!" ); nStart = nStart + nDiff; nEnd = nEnd + nDiff; } -inline void EditCharAttrib::MoveBackward( USHORT nDiff ) +inline void EditCharAttrib::MoveBackward( sal_uInt16 nDiff ) { DBG_ASSERT( ((long)nStart - nDiff) >= 0, "EditCharAttrib: MoveBackward?!" ); nStart = nStart - nDiff; nEnd = nEnd - nDiff; } -inline void EditCharAttrib::Expand( USHORT nDiff ) +inline void EditCharAttrib::Expand( sal_uInt16 nDiff ) { DBG_ASSERT( ( ((long)nEnd + nDiff) <= (long)0xFFFF ), "EditCharAttrib: Expand?!" ); - DBG_ASSERT( !bFeature, "Bitte keine Features expandieren!" ); + DBG_ASSERT( !bFeature, "Please do not expand any features!" ); nEnd = nEnd + nDiff; } -inline void EditCharAttrib::Collaps( USHORT nDiff ) +inline void EditCharAttrib::Collaps( sal_uInt16 nDiff ) { DBG_ASSERT( (long)nEnd - nDiff >= (long)nStart, "EditCharAttrib: Collaps?!" ); - DBG_ASSERT( !bFeature, "Bitte keine Features schrumpfen!" ); + DBG_ASSERT( !bFeature, "Please do not shrink any Features!" ); nEnd = nEnd - nDiff; } -// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- // class EditCharAttribFont // ------------------------------------------------------------------------- class EditCharAttribFont: public EditCharAttrib { public: - EditCharAttribFont( const SvxFontItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribFont( const SvxFontItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -186,7 +186,7 @@ public: class EditCharAttribWeight : public EditCharAttrib { public: - EditCharAttribWeight( const SvxWeightItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribWeight( const SvxWeightItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -196,7 +196,7 @@ public: class EditCharAttribItalic : public EditCharAttrib { public: - EditCharAttribItalic( const SvxPostureItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribItalic( const SvxPostureItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -207,7 +207,7 @@ public: class EditCharAttribShadow : public EditCharAttrib { public: - EditCharAttribShadow( const SvxShadowedItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribShadow( const SvxShadowedItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -218,7 +218,7 @@ public: class EditCharAttribEscapement : public EditCharAttrib { public: - EditCharAttribEscapement( const SvxEscapementItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribEscapement( const SvxEscapementItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -229,7 +229,7 @@ public: class EditCharAttribOutline : public EditCharAttrib { public: - EditCharAttribOutline( const SvxContourItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribOutline( const SvxContourItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -240,7 +240,7 @@ public: class EditCharAttribStrikeout : public EditCharAttrib { public: - EditCharAttribStrikeout( const SvxCrossedOutItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribStrikeout( const SvxCrossedOutItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -251,7 +251,7 @@ public: class EditCharAttribUnderline : public EditCharAttrib { public: - EditCharAttribUnderline( const SvxUnderlineItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribUnderline( const SvxUnderlineItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -262,7 +262,7 @@ public: class EditCharAttribOverline : public EditCharAttrib { public: - EditCharAttribOverline( const SvxOverlineItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribOverline( const SvxOverlineItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -273,7 +273,7 @@ public: class EditCharAttribEmphasisMark : public EditCharAttrib { public: - EditCharAttribEmphasisMark( const SvxEmphasisMarkItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribEmphasisMark( const SvxEmphasisMarkItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -284,7 +284,7 @@ public: class EditCharAttribRelief : public EditCharAttrib { public: - EditCharAttribRelief( const SvxCharReliefItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribRelief( const SvxCharReliefItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -295,7 +295,7 @@ public: class EditCharAttribFontHeight : public EditCharAttrib { public: - EditCharAttribFontHeight( const SvxFontHeightItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribFontHeight( const SvxFontHeightItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -306,7 +306,7 @@ public: class EditCharAttribFontWidth : public EditCharAttrib { public: - EditCharAttribFontWidth( const SvxCharScaleWidthItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribFontWidth( const SvxCharScaleWidthItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -317,7 +317,7 @@ public: class EditCharAttribColor : public EditCharAttrib { public: - EditCharAttribColor( const SvxColorItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribColor( const SvxColorItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -328,7 +328,7 @@ public: class EditCharAttribLanguage : public EditCharAttrib { public: - EditCharAttribLanguage( const SvxLanguageItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribLanguage( const SvxLanguageItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -339,7 +339,7 @@ public: class EditCharAttribTab : public EditCharAttrib { public: - EditCharAttribTab( const SfxVoidItem& rAttr, USHORT nPos ); + EditCharAttribTab( const SfxVoidItem& rAttr, sal_uInt16 nPos ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -350,7 +350,7 @@ public: class EditCharAttribLineBreak : public EditCharAttrib { public: - EditCharAttribLineBreak( const SfxVoidItem& rAttr, USHORT nPos ); + EditCharAttribLineBreak( const SfxVoidItem& rAttr, sal_uInt16 nPos ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -367,12 +367,12 @@ class EditCharAttribField: public EditCharAttrib EditCharAttribField& operator = ( const EditCharAttribField& rAttr ) const; public: - EditCharAttribField( const SvxFieldItem& rAttr, USHORT nPos ); + EditCharAttribField( const SvxFieldItem& rAttr, sal_uInt16 nPos ); EditCharAttribField( const EditCharAttribField& rAttr ); ~EditCharAttribField(); - BOOL operator == ( const EditCharAttribField& rAttr ) const; - BOOL operator != ( const EditCharAttribField& rAttr ) const + sal_Bool operator == ( const EditCharAttribField& rAttr ) const; + sal_Bool operator != ( const EditCharAttribField& rAttr ) const { return !(operator == ( rAttr ) ); } virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); @@ -396,7 +396,7 @@ public: class EditCharAttribPairKerning : public EditCharAttrib { public: - EditCharAttribPairKerning( const SvxAutoKernItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribPairKerning( const SvxAutoKernItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -407,7 +407,7 @@ public: class EditCharAttribKerning : public EditCharAttrib { public: - EditCharAttribKerning( const SvxKerningItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribKerning( const SvxKerningItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; @@ -418,7 +418,7 @@ public: class EditCharAttribWordLineMode: public EditCharAttrib { public: - EditCharAttribWordLineMode( const SvxWordLineModeItem& rAttr, USHORT nStart, USHORT nEnd ); + EditCharAttribWordLineMode( const SvxWordLineModeItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); }; diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 1011ba1342..2b22328738 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -88,7 +88,7 @@ ByteString DbgOutItem( const SfxItemPool& rPool, const SfxPoolItem& rItem ) case EE_PARA_NUMBULLET: { aDebStr += "NumItem "; - for ( USHORT nLevel = 0; nLevel < 3; nLevel++ ) + for ( sal_uInt16 nLevel = 0; nLevel < 3; nLevel++ ) { aDebStr += "Level"; aDebStr += ByteString::CreateFromInt32( nLevel ); @@ -148,14 +148,14 @@ ByteString DbgOutItem( const SfxItemPool& rPool, const SfxPoolItem& rItem ) else if ( ((SvxLineSpacingItem&)rItem).GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) { aDebStr += "Prop: "; - aDebStr += ByteString::CreateFromInt32( (ULONG)((SvxLineSpacingItem&)rItem).GetPropLineSpace() ); + aDebStr += ByteString::CreateFromInt32( (sal_uLong)((SvxLineSpacingItem&)rItem).GetPropLineSpace() ); } else aDebStr += "Unsupported Type!"; break; case EE_PARA_JUST: aDebStr += "SvxAdust="; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxAdjustItem&)rItem).GetAdjust() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxAdjustItem&)rItem).GetAdjust() ); break; case EE_PARA_TABS: { @@ -165,7 +165,7 @@ ByteString DbgOutItem( const SfxItemPool& rPool, const SfxPoolItem& rItem ) if ( rTabs.Count() ) { aDebStr += "( "; - for ( USHORT i = 0; i < rTabs.Count(); i++ ) + for ( sal_uInt16 i = 0; i < rTabs.Count(); i++ ) { const SvxTabStop& rTab = rTabs[i]; aDebStr += ByteString::CreateFromInt32( rTab.GetTabPos() ); @@ -179,17 +179,17 @@ ByteString DbgOutItem( const SfxItemPool& rPool, const SfxPoolItem& rItem ) case EE_CHAR_LANGUAGE_CJK: case EE_CHAR_LANGUAGE_CTL: aDebStr += "Language="; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxLanguageItem&)rItem).GetLanguage() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxLanguageItem&)rItem).GetLanguage() ); break; case EE_CHAR_COLOR: { aDebStr += "Color= "; Color aColor( ((SvxColorItem&)rItem).GetValue() ); - aDebStr += ByteString::CreateFromInt32( (USHORT)aColor.GetRed() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)aColor.GetRed() ); aDebStr += ", "; - aDebStr += ByteString::CreateFromInt32( (USHORT)aColor.GetGreen() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)aColor.GetGreen() ); aDebStr += ", "; - aDebStr += ByteString::CreateFromInt32( (USHORT)aColor.GetBlue() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)aColor.GetBlue() ); } break; case EE_CHAR_FONTINFO: @@ -199,7 +199,7 @@ ByteString DbgOutItem( const SfxItemPool& rPool, const SfxPoolItem& rItem ) aDebStr += "Font="; aDebStr += ByteString( ((SvxFontItem&)rItem).GetFamilyName(), RTL_TEXTENCODING_ASCII_US ); aDebStr += " (CharSet: "; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxFontItem&)rItem).GetCharSet() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxFontItem&)rItem).GetCharSet() ); aDebStr += ')'; } break; @@ -229,41 +229,41 @@ ByteString DbgOutItem( const SfxItemPool& rPool, const SfxPoolItem& rItem ) case EE_CHAR_WEIGHT_CJK: case EE_CHAR_WEIGHT_CTL: aDebStr += "FontWeight="; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxWeightItem&)rItem).GetWeight() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxWeightItem&)rItem).GetWeight() ); break; case EE_CHAR_UNDERLINE: aDebStr += "FontUnderline="; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxUnderlineItem&)rItem).GetLineStyle() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxUnderlineItem&)rItem).GetLineStyle() ); break; case EE_CHAR_OVERLINE: aDebStr += "FontOverline="; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxOverlineItem&)rItem).GetLineStyle() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxOverlineItem&)rItem).GetLineStyle() ); break; case EE_CHAR_EMPHASISMARK: aDebStr += "FontUnderline="; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxEmphasisMarkItem&)rItem).GetEmphasisMark() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxEmphasisMarkItem&)rItem).GetEmphasisMark() ); break; case EE_CHAR_RELIEF: aDebStr += "FontRelief="; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxCharReliefItem&)rItem).GetValue() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxCharReliefItem&)rItem).GetValue() ); break; case EE_CHAR_STRIKEOUT: aDebStr += "FontStrikeout="; - aDebStr +=ByteString::CreateFromInt32( (USHORT)((SvxCrossedOutItem&)rItem).GetStrikeout() ); + aDebStr +=ByteString::CreateFromInt32( (sal_uInt16)((SvxCrossedOutItem&)rItem).GetStrikeout() ); break; case EE_CHAR_ITALIC: case EE_CHAR_ITALIC_CJK: case EE_CHAR_ITALIC_CTL: aDebStr += "FontPosture="; - aDebStr +=ByteString::CreateFromInt32( (USHORT)((SvxPostureItem&)rItem).GetPosture() ); + aDebStr +=ByteString::CreateFromInt32( (sal_uInt16)((SvxPostureItem&)rItem).GetPosture() ); break; case EE_CHAR_OUTLINE: aDebStr += "FontOutline="; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxContourItem&)rItem).GetValue() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxContourItem&)rItem).GetValue() ); break; case EE_CHAR_SHADOW: aDebStr += "FontShadowed="; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxShadowedItem&)rItem).GetValue() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxShadowedItem&)rItem).GetValue() ); break; case EE_CHAR_ESCAPEMENT: aDebStr += "Escape="; @@ -273,7 +273,7 @@ ByteString DbgOutItem( const SfxItemPool& rPool, const SfxPoolItem& rItem ) break; case EE_CHAR_PAIRKERNING: aDebStr += "PairKerning="; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxAutoKernItem&)rItem).GetValue() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxAutoKernItem&)rItem).GetValue() ); break; case EE_CHAR_KERNING: { @@ -290,7 +290,7 @@ ByteString DbgOutItem( const SfxItemPool& rPool, const SfxPoolItem& rItem ) break; case EE_CHAR_WLM: aDebStr += "WordLineMode="; - aDebStr += ByteString::CreateFromInt32( (USHORT)((SvxWordLineModeItem&)rItem).GetValue() ); + aDebStr += ByteString::CreateFromInt32( (sal_uInt16)((SvxWordLineModeItem&)rItem).GetValue() ); break; case EE_CHAR_XMLATTRIBS: aDebStr += "XMLAttribs=..."; @@ -299,9 +299,9 @@ ByteString DbgOutItem( const SfxItemPool& rPool, const SfxPoolItem& rItem ) return aDebStr; } -void DbgOutItemSet( FILE* fp, const SfxItemSet& rSet, BOOL bSearchInParent, BOOL bShowALL ) +void DbgOutItemSet( FILE* fp, const SfxItemSet& rSet, sal_Bool bSearchInParent, sal_Bool bShowALL ) { - for ( USHORT nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ ) + for ( sal_uInt16 nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ ) { fprintf( fp, "\nWhich: %i\t", nWhich ); if ( rSet.GetItemState( nWhich, bSearchInParent ) == SFX_ITEM_OFF ) @@ -320,7 +320,7 @@ void DbgOutItemSet( FILE* fp, const SfxItemSet& rSet, BOOL bSearchInParent, BOOL } } -void EditDbg::ShowEditEngineData( EditEngine* pEE, BOOL bInfoBox ) +void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_Bool bInfoBox ) { #if defined UNX FILE* fp = fopen( "/tmp/debug.log", "w" ); @@ -329,30 +329,30 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, BOOL bInfoBox ) #endif if ( fp == 0 ) { - DBG_ERROR( "Log-File konnte nicht angelegt werden!" ); + OSL_FAIL( "Log file could not be created!" ); return; } const SfxItemPool& rPool = *pEE->GetEmptyItemSet().GetPool(); fprintf( fp, "================================================================================" ); - fprintf( fp, "\n================== Dokument ================================================" ); + fprintf( fp, "\n================== Document ================================================" ); fprintf( fp, "\n================================================================================" ); - for ( USHORT nPortion = 0; nPortion < pEE->pImpEditEngine->GetParaPortions(). Count(); nPortion++) + for ( sal_uInt16 nPortion = 0; nPortion < pEE->pImpEditEngine->GetParaPortions(). Count(); nPortion++) { ParaPortion* pPPortion = pEE->pImpEditEngine->GetParaPortions().GetObject(nPortion ); - fprintf( fp, "\nAbsatz %i: Laenge = %i, Invalid = %i\nText = '%s'", nPortion, pPPortion->GetNode()->Len(), pPPortion->IsInvalid(), ByteString( *pPPortion->GetNode(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); + fprintf( fp, "\nParagraph %i: Length = %i, Invalid = %i\nText = '%s'", nPortion, pPPortion->GetNode()->Len(), pPPortion->IsInvalid(), ByteString( *pPPortion->GetNode(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); fprintf( fp, "\nVorlage:" ); SfxStyleSheet* pStyle = pPPortion->GetNode()->GetStyleSheet(); if ( pStyle ) fprintf( fp, " %s", ByteString( pStyle->GetName(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); - fprintf( fp, "\nAbsatzattribute:" ); - DbgOutItemSet( fp, pPPortion->GetNode()->GetContentAttribs().GetItems(), FALSE, FALSE ); + fprintf( fp, "\nParagraph attribute:" ); + DbgOutItemSet( fp, pPPortion->GetNode()->GetContentAttribs().GetItems(), sal_False, sal_False ); - fprintf( fp, "\nZeichenattribute:" ); - BOOL bZeroAttr = FALSE; - USHORT z; + fprintf( fp, "\nCharacter attribute:" ); + sal_Bool bZeroAttr = sal_False; + sal_uInt16 z; for ( z = 0; z < pPPortion->GetNode()->GetCharAttribs().Count(); z++ ) { EditCharAttrib* pAttr = pPPortion->GetNode()->GetCharAttribs().GetAttribs().GetObject( z ); @@ -366,7 +366,7 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, BOOL bInfoBox ) aCharAttribs += '\t'; aCharAttribs += ByteString::CreateFromInt32( pAttr->GetEnd() ); if ( pAttr->IsEmpty() ) - bZeroAttr = TRUE; + bZeroAttr = sal_True; fprintf( fp, "%s => ", aCharAttribs.GetBuffer() ); ByteString aDebStr = DbgOutItem( rPool, *pAttr->GetItem() ); @@ -375,17 +375,17 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, BOOL bInfoBox ) if ( bZeroAttr ) fprintf( fp, "\nNULL-Attribute!" ); - USHORT nTextPortions = pPPortion->GetTextPortions().Count(); - ByteString aPortionStr("\nTextportions: #"); + sal_uInt16 nTextPortions = pPPortion->GetTextPortions().Count(); + ByteString aPortionStr("\nText portions: #"); aPortionStr += ByteString::CreateFromInt32( nTextPortions ); aPortionStr += " \nA"; aPortionStr += ByteString::CreateFromInt32( nPortion ); - aPortionStr += ": Absatzlaenge = "; + aPortionStr += ": Paragraph Length = "; aPortionStr += ByteString::CreateFromInt32( pPPortion->GetNode()->Len() ); aPortionStr += "\nA"; aPortionStr += ByteString::CreateFromInt32( nPortion ); aPortionStr += ": "; - ULONG n = 0; + sal_uLong n = 0; for ( z = 0; z < nTextPortions; z++ ) { TextPortion* pPortion = pPPortion->GetTextPortions().GetObject( z ); @@ -395,36 +395,36 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, BOOL bInfoBox ) aPortionStr += ByteString::CreateFromInt32( pPortion->GetSize().Width() ); aPortionStr += ")"; aPortionStr += "["; - aPortionStr += ByteString::CreateFromInt32( (USHORT)pPortion->GetKind() ); + aPortionStr += ByteString::CreateFromInt32( (sal_uInt16)pPortion->GetKind() ); aPortionStr += "]"; aPortionStr += ";"; n += pPortion->GetLen(); } aPortionStr += "\nA"; aPortionStr += ByteString::CreateFromInt32( nPortion ); - aPortionStr += ": Gesamtlaenge: "; + aPortionStr += ": Total length: "; aPortionStr += ByteString::CreateFromInt32( n ); if ( pPPortion->GetNode()->Len() != n ) - aPortionStr += " => Fehler !!!"; + aPortionStr += " => Error !!!"; fprintf( fp, "%s", aPortionStr.GetBuffer() ); - fprintf( fp, "\n\nZeilen:" ); - // Erstmal die Inhalte... - USHORT nLine; + fprintf( fp, "\n\nLines:" ); + // First the content ... + sal_uInt16 nLine; for ( nLine = 0; nLine < pPPortion->GetLines().Count(); nLine++ ) { EditLine* pLine = pPPortion->GetLines().GetObject( nLine ); ByteString aLine( *(pPPortion->GetNode()), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart(), RTL_TEXTENCODING_ASCII_US ); - fprintf( fp, "\nZeile %i\t>%s<", nLine, aLine.GetBuffer() ); + fprintf( fp, "\nLine %i\t>%s<", nLine, aLine.GetBuffer() ); } - // dann die internen Daten... + // then the internal data ... for ( nLine = 0; nLine < pPPortion->GetLines().Count(); nLine++ ) { EditLine* pLine = pPPortion->GetLines().GetObject( nLine ); fprintf( fp, "\nZeile %i:\tStart: %i,\tEnd: %i", nLine, pLine->GetStart(), pLine->GetEnd() ); - fprintf( fp, "\t\tPortions: %i - %i.\tHoehe: %i, Ascent=%i", pLine->GetStartPortion(), pLine->GetEndPortion(), pLine->GetHeight(), pLine->GetMaxAscent() ); + fprintf( fp, "\t\tPortions: %i - %i.\tHight: %i, Ascent=%i", pLine->GetStartPortion(), pLine->GetEndPortion(), pLine->GetHeight(), pLine->GetMaxAscent() ); } fprintf( fp, "\n-----------------------------------------------------------------------------" ); @@ -432,31 +432,31 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, BOOL bInfoBox ) if ( pEE->pImpEditEngine->GetStyleSheetPool() ) { - ULONG nStyles = pEE->pImpEditEngine->GetStyleSheetPool() ? pEE->pImpEditEngine->GetStyleSheetPool()->Count() : 0; + sal_uLong nStyles = pEE->pImpEditEngine->GetStyleSheetPool() ? pEE->pImpEditEngine->GetStyleSheetPool()->Count() : 0; fprintf( fp, "\n\n================================================================================" ); fprintf( fp, "\n================== Stylesheets =============================================" ); fprintf( fp, "\n================================================================================" ); - fprintf( fp, "\n#Vorlagen: %lu\n", nStyles ); + fprintf( fp, "\n#Template: %lu\n", nStyles ); SfxStyleSheetIterator aIter( pEE->pImpEditEngine->GetStyleSheetPool(), SFX_STYLE_FAMILY_ALL ); SfxStyleSheetBase* pStyle = aIter.First(); while ( pStyle ) { - fprintf( fp, "\nVorlage: %s", ByteString( pStyle->GetName(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); + fprintf( fp, "\nTemplate: %s", ByteString( pStyle->GetName(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); fprintf( fp, "\nParent: %s", ByteString( pStyle->GetParent(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); fprintf( fp, "\nFollow: %s", ByteString( pStyle->GetFollow(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); - DbgOutItemSet( fp, pStyle->GetItemSet(), FALSE, FALSE ); + DbgOutItemSet( fp, pStyle->GetItemSet(), sal_False, sal_False ); fprintf( fp, "\n----------------------------------" ); pStyle = aIter.Next(); } } - fprintf( fp, "\n\n================================================================================" ); + fprintf( fp, "\n\n================================================================================" ); fprintf( fp, "\n================== Defaults ================================================" ); fprintf( fp, "\n================================================================================" ); - DbgOutItemSet( fp, pEE->pImpEditEngine->GetEmptyItemSet(), TRUE, TRUE ); + DbgOutItemSet( fp, pEE->pImpEditEngine->GetEmptyItemSet(), sal_True, sal_True ); - fprintf( fp, "\n\n================================================================================" ); + fprintf( fp, "\n\n================================================================================" ); fprintf( fp, "\n================== EditEngine & Views ======================================" ); fprintf( fp, "\n================================================================================" ); fprintf( fp, "\nControl: %"SAL_PRIxUINT32, pEE->GetControlWord() ); @@ -465,25 +465,25 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, BOOL bInfoBox ) fprintf( fp, "\nMaxAutoPaperSize: %li x %li", pEE->GetMaxAutoPaperSize().Width(), pEE->GetMaxAutoPaperSize().Height() ); fprintf( fp, "\nMinAutoPaperSize: %li x %li", pEE->GetMinAutoPaperSize().Width(), pEE->GetMinAutoPaperSize().Height() ); fprintf( fp, "\nUpdate: %i", pEE->GetUpdateMode() ); - fprintf( fp, "\nAnzahl der Views: %i", pEE->GetViewCount() ); - for ( USHORT nView = 0; nView < pEE->GetViewCount(); nView++ ) + fprintf( fp, "\nNumber of Views: %i", pEE->GetViewCount() ); + for ( sal_uInt16 nView = 0; nView < pEE->GetViewCount(); nView++ ) { EditView* pV = pEE->GetView( nView ); - DBG_ASSERT( pV, "View nicht gefunden!" ); + DBG_ASSERT( pV, "View not found!" ); fprintf( fp, "\nView %i: Focus=%i", nView, pV->GetWindow()->HasFocus() ); Rectangle aR( pV->GetOutputArea() ); fprintf( fp, "\n OutputArea: nX=%li, nY=%li, dX=%li, dY=%li, MapMode = %i", aR.TopLeft().X(), aR.TopLeft().Y(), aR.GetSize().Width(), aR.GetSize().Height() , pV->GetWindow()->GetMapMode().GetMapUnit() ); aR = pV->GetVisArea(); fprintf( fp, "\n VisArea: nX=%li, nY=%li, dX=%li, dY=%li", aR.TopLeft().X(), aR.TopLeft().Y(), aR.GetSize().Width(), aR.GetSize().Height() ); ESelection aSel = pV->GetSelection(); - fprintf( fp, "\n Selektion: Start=%u,%u, End=%u,%u", aSel.nStartPara, aSel.nStartPos, aSel.nEndPara, aSel.nEndPos ); + fprintf( fp, "\n Selection: Start=%u,%u, End=%u,%u", aSel.nStartPara, aSel.nStartPos, aSel.nEndPara, aSel.nEndPos ); } if ( pEE->GetActiveView() ) { - fprintf( fp, "\n\n================================================================================" ); - fprintf( fp, "\n================== Aktuelle View ===========================================" ); + fprintf( fp, "\n\n================================================================================" ); + fprintf( fp, "\n================== Current View ===========================================" ); fprintf( fp, "\n================================================================================" ); - DbgOutItemSet( fp, pEE->GetActiveView()->GetAttribs(), TRUE, FALSE ); + DbgOutItemSet( fp, pEE->GetActiveView()->GetAttribs(), sal_True, sal_False ); } fclose( fp ); if ( bInfoBox ) @@ -492,12 +492,12 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, BOOL bInfoBox ) ByteString EditDbg::GetPortionInfo( ParaPortion* pPPortion ) { - USHORT z; + sal_uInt16 z; - ByteString aDebStr( "Absatzlaenge = " ); + ByteString aDebStr( "Paragraph Length = " ); aDebStr += ByteString::CreateFromInt32( pPPortion->GetNode()->Len() ); - aDebStr += "\nZeichenattribute:"; + aDebStr += "\nCharacter attribute:"; for ( z = 0; z < pPPortion->GetNode()->GetCharAttribs().Count(); z++ ) { EditCharAttrib* pAttr = pPPortion->GetNode()->GetCharAttribs().GetAttribs().GetObject( z ); @@ -509,8 +509,8 @@ ByteString EditDbg::GetPortionInfo( ParaPortion* pPPortion ) aDebStr += ByteString::CreateFromInt32( pAttr->GetEnd() ); } - aDebStr += "\nTextportions:"; - USHORT n = 0; + aDebStr += "\nText portions:"; + sal_uInt16 n = 0; for ( z = 0; z < pPPortion->GetTextPortions().Count(); z++ ) { TextPortion* pPortion = pPPortion->GetTextPortions().GetObject( z ); @@ -522,15 +522,15 @@ ByteString EditDbg::GetPortionInfo( ParaPortion* pPPortion ) aDebStr += ";"; n = n + pPortion->GetLen(); } - aDebStr += "\nGesamtlaenge: "; + aDebStr += "\nTotal length: "; aDebStr += ByteString::CreateFromInt32( n ); - aDebStr += "\nSortiert nach Start:"; - for ( USHORT x = 0; x < pPPortion->GetNode()->GetCharAttribs().Count(); x++ ) + aDebStr += "\nSorted after Start:"; + for ( sal_uInt16 x = 0; x < pPPortion->GetNode()->GetCharAttribs().Count(); x++ ) { EditCharAttrib* pCurAttrib = pPPortion->GetNode()->GetCharAttribs().GetAttribs().GetObject( x ); aDebStr += "\nStart: "; aDebStr += ByteString::CreateFromInt32( pCurAttrib->GetStart() ); - aDebStr += "\tEnde: "; + aDebStr += "\tEnd: "; aDebStr += ByteString::CreateFromInt32( pCurAttrib->GetEnd() ); } return aDebStr; @@ -539,7 +539,7 @@ ByteString EditDbg::GetPortionInfo( ParaPortion* pPPortion ) ByteString EditDbg::GetTextPortionInfo( TextPortionList& rPortions ) { ByteString aDebStr; - for ( USHORT z = 0; z < rPortions.Count(); z++ ) + for ( sal_uInt16 z = 0; z < rPortions.Count(); z++ ) { TextPortion* pPortion = rPortions.GetObject( z ); aDebStr += " "; @@ -559,28 +559,28 @@ void EditDbg::ShowPortionData( ParaPortion* pPortion ) } -BOOL ParaPortion::DbgCheckTextPortions() +sal_Bool ParaPortion::DbgCheckTextPortions() { - // pruefen, ob Portionlaenge ok: - USHORT nXLen = 0; - for ( USHORT nPortion = 0; nPortion < aTextPortionList.Count(); nPortion++ ) + // check, if Portion length ok: + sal_uInt16 nXLen = 0; + for ( sal_uInt16 nPortion = 0; nPortion < aTextPortionList.Count(); nPortion++ ) nXLen = nXLen + aTextPortionList[nPortion]->GetLen(); - return nXLen == pNode->Len() ? TRUE : FALSE; + return nXLen == pNode->Len() ? sal_True : sal_False; } -BOOL CheckOrderedList( CharAttribArray& rAttribs, BOOL bStart ) +sal_Bool CheckOrderedList( CharAttribArray& rAttribs, sal_Bool bStart ) { - USHORT nPrev = 0; - for ( USHORT nAttr = 0; nAttr < rAttribs.Count(); nAttr++ ) + sal_uInt16 nPrev = 0; + for ( sal_uInt16 nAttr = 0; nAttr < rAttribs.Count(); nAttr++ ) { EditCharAttrib* pAttr = rAttribs[nAttr]; - USHORT nCur = bStart ? pAttr->GetStart() : pAttr->GetEnd(); + sal_uInt16 nCur = bStart ? pAttr->GetStart() : pAttr->GetEnd(); if ( nCur < nPrev ) - return FALSE; + return sal_False; nPrev = nCur; } - return TRUE; + return sal_True; } #endif diff --git a/editeng/source/editeng/editdbg.hxx b/editeng/source/editeng/editdbg.hxx index 45cff0d210..041d3b3954 100644 --- a/editeng/source/editeng/editdbg.hxx +++ b/editeng/source/editeng/editdbg.hxx @@ -42,12 +42,12 @@ class SfxItemPool; class SfxPoolItem; ByteString DbgOutItem( const SfxItemPool& rPool, const SfxPoolItem& rItem ); -void DbgOutItemSet( FILE* fp, const SfxItemSet& rSet, BOOL bSearchInParent, BOOL bShowALL ); +void DbgOutItemSet( FILE* fp, const SfxItemSet& rSet, sal_Bool bSearchInParent, sal_Bool bShowALL ); class EditDbg { public: - static void ShowEditEngineData( EditEngine* pEditEngine, BOOL bInfoBox = TRUE ); + static void ShowEditEngineData( EditEngine* pEditEngine, sal_Bool bInfoBox = sal_True ); static void ShowPortionData( ParaPortion* pPortion ); static ByteString GetPortionInfo( ParaPortion* pPPortion ); static ByteString GetTextPortionInfo( TextPortionList& rPortions ); diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index e9e1e49f13..08758a8f64 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -72,14 +72,14 @@ using namespace ::com::sun::star; // ------------------------------------------------------------ -USHORT GetScriptItemId( USHORT nItemId, short nScriptType ) +sal_uInt16 GetScriptItemId( sal_uInt16 nItemId, short nScriptType ) { - USHORT nId = nItemId; + sal_uInt16 nId = nItemId; if ( ( nScriptType == i18n::ScriptType::ASIAN ) || ( nScriptType == i18n::ScriptType::COMPLEX ) ) { - switch ( nItemId ) + switch ( nItemId ) { case EE_CHAR_LANGUAGE: nId = ( nScriptType == i18n::ScriptType::ASIAN ) ? EE_CHAR_LANGUAGE_CJK : EE_CHAR_LANGUAGE_CTL; @@ -98,13 +98,13 @@ USHORT GetScriptItemId( USHORT nItemId, short nScriptType ) break; } } - + return nId; } -BOOL IsScriptItemValid( USHORT nItemId, short nScriptType ) +sal_Bool IsScriptItemValid( sal_uInt16 nItemId, short nScriptType ) { - BOOL bValid = TRUE; + sal_Bool bValid = sal_True; switch ( nItemId ) { @@ -161,8 +161,8 @@ BOOL IsScriptItemValid( USHORT nItemId, short nScriptType ) // ------------------------------------------------------------ -// Sollte spaeter zentral nach TOOLS/STRING (Aktuell: 303) -// fuer Grep: WS_TARGET +// Should later be moved to TOOLS/STRING (Current: 303) +// for Grep: WS_TARGET DBG_NAME( EE_TextPortion ); DBG_NAME( EE_EditLine ); @@ -224,31 +224,31 @@ SfxItemInfo aItemInfos[EDITITEMCOUNT] = { { SID_FIELD, SFX_ITEM_POOLABLE } }; -USHORT aV1Map[] = { +sal_uInt16 aV1Map[] = { 3999, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4017, 4018, 4019 // MI: 4019? }; -USHORT aV2Map[] = { +sal_uInt16 aV2Map[] = { 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4018, 4019, 4020 }; -USHORT aV3Map[] = { +sal_uInt16 aV3Map[] = { 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021 }; -USHORT aV4Map[] = { +sal_uInt16 aV4Map[] = { 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, /* CJK Items inserted here: EE_CHAR_LANGUAGE - EE_CHAR_XMLATTRIBS */ - 4034, 4035, 4036, 4037 + 4034, 4035, 4036, 4037 }; -USHORT aV5Map[] = { +sal_uInt16 aV5Map[] = { 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, @@ -258,10 +258,6 @@ USHORT aV5Map[] = { }; SV_IMPL_PTRARR( DummyContentList, ContentNode* ); -SV_IMPL_VARARR( ScriptTypePosInfos, ScriptTypePosInfo ); -SV_IMPL_VARARR( WritingDirectionInfos, WritingDirectionInfo ); -// SV_IMPL_VARARR( ExtraCharInfos, ExtraCharInfo ); - int SAL_CALL CompareStart( const void* pFirst, const void* pSecond ) { @@ -272,9 +268,9 @@ int SAL_CALL CompareStart( const void* pFirst, const void* pSecond ) return 0; } -EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, USHORT nS, USHORT nE ) +EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE ) { - // das neue Attribut im Pool anlegen + // Create a new attribute in the pool const SfxPoolItem& rNew = rPool.Put( rAttr ); EditCharAttrib* pNew = 0; @@ -382,7 +378,7 @@ EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, US break; case EE_CHAR_XMLATTRIBS: { - pNew = new EditCharAttrib( rNew, nS, nE ); // Attrib is only for holding XML information... + pNew = new EditCharAttrib( rNew, nS, nE ); // Attribute is only for holding XML information... } break; case EE_FEATURE_TAB: @@ -402,22 +398,19 @@ EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, US break; default: { - DBG_ERROR( "Ungueltiges Attribut!" ); + OSL_FAIL( "Invalid Attribute!" ); } } return pNew; } -// ------------------------------------------------------------------------- -// class EditLine -// ------------------------------------------------------------------------- - EditLine::EditLine() { DBG_CTOR( EE_EditLine, 0 ); nStart = nEnd = 0; - nStartPortion = 0; // damit in ungueltiger Zeile ohne Portions von einer gueltigen Zeile mit der Portion Nr0 unterscieden werden kann. + nStartPortion = 0; // to be able to tell the difference between a line + // without Ptorions form one with the Portion number 0 nEndPortion = 0; nHeight = 0; nStartPosX = 0; @@ -425,8 +418,8 @@ EditLine::EditLine() nTxtWidth = 0; nCrsrHeight = 0; nMaxAscent = 0; - bHangingPunctuation = FALSE; - bInvalid = TRUE; + bHangingPunctuation = sal_False; + bInvalid = sal_True; } EditLine::EditLine( const EditLine& r ) @@ -445,7 +438,7 @@ EditLine::EditLine( const EditLine& r ) nTxtWidth = 0; nCrsrHeight = 0; nMaxAscent = 0; - bInvalid = TRUE; + bInvalid = sal_True; } EditLine::~EditLine() @@ -474,21 +467,21 @@ EditLine* EditLine::Clone() const return pL; } -BOOL operator == ( const EditLine& r1, const EditLine& r2 ) +sal_Bool operator == ( const EditLine& r1, const EditLine& r2 ) { if ( r1.nStart != r2.nStart ) - return FALSE; + return sal_False; if ( r1.nEnd != r2.nEnd ) - return FALSE; + return sal_False; if ( r1.nStartPortion != r2.nStartPortion ) - return FALSE; + return sal_False; if ( r1.nEndPortion != r2.nEndPortion ) - return FALSE; + return sal_False; - return TRUE; + return sal_True; } EditLine& EditLine::operator = ( const EditLine& r ) @@ -501,7 +494,7 @@ EditLine& EditLine::operator = ( const EditLine& r ) } -BOOL operator != ( const EditLine& r1, const EditLine& r2 ) +sal_Bool operator != ( const EditLine& r1, const EditLine& r2 ) { return !( r1 == r2 ); } @@ -512,11 +505,11 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion ) Size aTmpSz; TextPortion* pPortion; - USHORT nIndex = GetStart(); + sal_uInt16 nIndex = GetStart(); - DBG_ASSERT( rParaPortion.GetTextPortions().Count(), "GetTextSize vor CreatePortions !" ); + DBG_ASSERT( rParaPortion.GetTextPortions().Count(), "GetTextSize before CreatePortions !" ); - for ( USHORT n = nStartPortion; n <= nEndPortion; n++ ) + for ( sal_uInt16 n = nStartPortion; n <= nEndPortion; n++ ) { pPortion = rParaPortion.GetTextPortions().GetObject(n); switch ( pPortion->GetKind() ) @@ -532,7 +525,6 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion ) } break; case PORTIONKIND_TAB: -// case PORTIONKIND_EXTRASPACE: { aSz.Width() += pPortion->GetSize().Width(); } @@ -541,13 +533,10 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion ) nIndex = nIndex + pPortion->GetLen(); } - SetHeight( (USHORT)aSz.Height() ); + SetHeight( (sal_uInt16)aSz.Height() ); return aSz; } -// ------------------------------------------------------------------------- -// class EditLineList -// ------------------------------------------------------------------------- EditLineList::EditLineList() { } @@ -559,22 +548,22 @@ EditLineList::~EditLineList() void EditLineList::Reset() { - for ( USHORT nLine = 0; nLine < Count(); nLine++ ) + for ( sal_uInt16 nLine = 0; nLine < Count(); nLine++ ) delete GetObject(nLine); Remove( 0, Count() ); } -void EditLineList::DeleteFromLine( USHORT nDelFrom ) +void EditLineList::DeleteFromLine( sal_uInt16 nDelFrom ) { DBG_ASSERT( nDelFrom <= (Count() - 1), "DeleteFromLine: Out of range" ); - for ( USHORT nL = nDelFrom; nL < Count(); nL++ ) + for ( sal_uInt16 nL = nDelFrom; nL < Count(); nL++ ) delete GetObject(nL); Remove( nDelFrom, Count()-nDelFrom ); } -USHORT EditLineList::FindLine( USHORT nChar, BOOL bInclEnd ) +sal_uInt16 EditLineList::FindLine( sal_uInt16 nChar, sal_Bool bInclEnd ) { - for ( USHORT nLine = 0; nLine < Count(); nLine++ ) + for ( sal_uInt16 nLine = 0; nLine < Count(); nLine++ ) { EditLine* pLine = GetObject( nLine ); if ( ( bInclEnd && ( pLine->GetEnd() >= nChar ) ) || @@ -584,33 +573,30 @@ USHORT EditLineList::FindLine( USHORT nChar, BOOL bInclEnd ) } } - DBG_ASSERT( !bInclEnd, "Zeile nicht gefunden: FindLine" ); + DBG_ASSERT( !bInclEnd, "Line not found: FindLine" ); return ( Count() - 1 ); } -// ------------------------------------------------------------------------- -// class EditSelection -// ------------------------------------------------------------------------- -BOOL EditPaM::DbgIsBuggy( EditDoc& rDoc ) +sal_Bool EditPaM::DbgIsBuggy( EditDoc& rDoc ) { if ( !pNode ) - return TRUE; + return sal_True; if ( rDoc.GetPos( pNode ) >= rDoc.Count() ) - return TRUE; + return sal_True; if ( nIndex > pNode->Len() ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } -BOOL EditSelection::DbgIsBuggy( EditDoc& rDoc ) +sal_Bool EditSelection::DbgIsBuggy( EditDoc& rDoc ) { if ( aStartPaM.DbgIsBuggy( rDoc ) ) - return TRUE; + return sal_True; if ( aEndPaM.DbgIsBuggy( rDoc ) ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } EditSelection::EditSelection() @@ -619,15 +605,15 @@ EditSelection::EditSelection() EditSelection::EditSelection( const EditPaM& rStartAndAnd ) { - // koennte noch optimiert werden! - // nicht erst Def-CTOR vom PaM rufen! + // could still be optimized! + // do no first call the Def-constructor from PaM! aStartPaM = rStartAndAnd; aEndPaM = rStartAndAnd; } EditSelection::EditSelection( const EditPaM& rStart, const EditPaM& rEnd ) { - // koennte noch optimiert werden! + // could still be optimized! aStartPaM = rStart; aEndPaM = rEnd; } @@ -639,38 +625,38 @@ EditSelection& EditSelection::operator = ( const EditPaM& rPaM ) return *this; } -BOOL EditSelection::IsInvalid() const +sal_Bool EditSelection::IsInvalid() const { EditPaM aEmptyPaM; if ( aStartPaM == aEmptyPaM ) - return TRUE; + return sal_True; if ( aEndPaM == aEmptyPaM ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } -BOOL EditSelection::Adjust( const ContentList& rNodes ) +sal_Bool EditSelection::Adjust( const ContentList& rNodes ) { - DBG_ASSERT( aStartPaM.GetIndex() <= aStartPaM.GetNode()->Len(), "Index im Wald in Adjust(1)" ); - DBG_ASSERT( aEndPaM.GetIndex() <= aEndPaM.GetNode()->Len(), "Index im Wald in Adjust(2)" ); + DBG_ASSERT( aStartPaM.GetIndex() <= aStartPaM.GetNode()->Len(), "Index out of range in Adjust(1)" ); + DBG_ASSERT( aEndPaM.GetIndex() <= aEndPaM.GetNode()->Len(), "Index out of range in Adjust(2)" ); ContentNode* pStartNode = aStartPaM.GetNode(); ContentNode* pEndNode = aEndPaM.GetNode(); - USHORT nStartNode = rNodes.GetPos( pStartNode ); - USHORT nEndNode = rNodes.GetPos( pEndNode ); + sal_uInt16 nStartNode = rNodes.GetPos( pStartNode ); + sal_uInt16 nEndNode = rNodes.GetPos( pEndNode ); - DBG_ASSERT( nStartNode != USHRT_MAX, "Node im Wald in Adjust(1)" ); - DBG_ASSERT( nEndNode != USHRT_MAX, "Node im Wald in Adjust(2)" ); + DBG_ASSERT( nStartNode != USHRT_MAX, "Node out of range in Adjust(1)" ); + DBG_ASSERT( nEndNode != USHRT_MAX, "Node out of range in Adjust(2)" ); - BOOL bSwap = FALSE; + sal_Bool bSwap = sal_False; if ( nStartNode > nEndNode ) - bSwap = TRUE; + bSwap = sal_True; else if ( ( nStartNode == nEndNode ) && ( aStartPaM.GetIndex() > aEndPaM.GetIndex() ) ) - bSwap = TRUE; + bSwap = sal_True; if ( bSwap ) { @@ -682,19 +668,15 @@ BOOL EditSelection::Adjust( const ContentList& rNodes ) return bSwap; } - -// ------------------------------------------------------------------------- -// class EditPaM -// ------------------------------------------------------------------------- -BOOL operator == ( const EditPaM& r1, const EditPaM& r2 ) +sal_Bool operator == ( const EditPaM& r1, const EditPaM& r2 ) { if ( r1.GetNode() != r2.GetNode() ) - return FALSE; + return sal_False; if ( r1.GetIndex() != r2.GetIndex() ) - return FALSE; + return sal_False; - return TRUE; + return sal_True; } EditPaM& EditPaM::operator = ( const EditPaM& rPaM ) @@ -704,15 +686,11 @@ EditPaM& EditPaM::operator = ( const EditPaM& rPaM ) return *this; } -BOOL operator != ( const EditPaM& r1, const EditPaM& r2 ) +sal_Bool operator != ( const EditPaM& r1, const EditPaM& r2 ) { return !( r1 == r2 ); } - -// ------------------------------------------------------------------------- -// class ContentNode -// ------------------------------------------------------------------------- ContentNode::ContentNode( SfxItemPool& rPool ) : aContentAttribs( rPool ) { DBG_CTOR( EE_ContentNode, 0 ); @@ -729,56 +707,53 @@ ContentNode::ContentNode( const XubString& rStr, const ContentAttribs& rContentA ContentNode::~ContentNode() { DBG_DTOR( EE_ContentNode, 0 ); -#ifndef SVX_LIGHT delete pWrongList; -#endif } -void ContentNode::ExpandAttribs( USHORT nIndex, USHORT nNew, SfxItemPool& rItemPool ) +void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool& rItemPool ) { if ( !nNew ) return; - // Da Features anders behandelt werden als normale Zeichenattribute, - // kann sich hier auch die Sortierung der Start-Liste aendern! - // In jedem if..., in dem weiter (n) Moeglichkeiten aufgrund von - // bFeature oder Spezialfall existieren, - // muessen (n-1) Moeglichkeiten mit bResort versehen werden. - // Die wahrscheinlichste Moeglichkeit erhaelt kein bResort, - // so dass nicht neu sortiert wird, wenn sich alle Attribute - // gleich verhalten. - BOOL bResort = FALSE; - BOOL bExpandedEmptyAtIndexNull = FALSE; - - USHORT nAttr = 0; + // Since features are treated differently than normal character attributes, + // can also the order of the start list be change! + // In every if ..., in the next (n) opportunities due to bFeature or + // an existing special case, must (n-1) opportunities be provided with + // bResort. The most likely possibility receives no bResort, so that is + // not sorted anew when all attributes are the same. + sal_Bool bResort = sal_False; + sal_Bool bExpandedEmptyAtIndexNull = sal_False; + + sal_uInt16 nAttr = 0; EditCharAttrib* pAttrib = GetAttrib( aCharAttribList.GetAttribs(), nAttr ); while ( pAttrib ) { if ( pAttrib->GetEnd() >= nIndex ) { - // Alle Attribute hinter der Einfuegeposition verschieben... + // Move all attributes behind the insertion point... if ( pAttrib->GetStart() > nIndex ) { pAttrib->MoveForward( nNew ); } - // 0: Leeres Attribut expandieren, wenn an Einfuegestelle + // 0: Expand empty attribute, if at insertion point else if ( pAttrib->IsEmpty() ) { - // Index nicht pruefen, leeres durfte nur dort liegen. - // Wenn spaeter doch Ueberpruefung: - // Spezialfall: Start == 0; AbsLen == 1, nNew = 1 => Expand, weil durch Absatzumbruch! + // Do not check Index, a emty one could only be there + // When later checking it anyhow: + // Special caase: Start == 0; AbsLen == 1, nNew = 1 + // => Expand, because of paragraph break! // Start <= nIndex, End >= nIndex => Start=End=nIndex! // if ( pAttrib->GetStart() == nIndex ) pAttrib->Expand( nNew ); if ( pAttrib->GetStart() == 0 ) - bExpandedEmptyAtIndexNull = TRUE; + bExpandedEmptyAtIndexNull = sal_True; } - // 1: Attribut startet davor, geht bis Index... - else if ( pAttrib->GetEnd() == nIndex ) // Start muss davor liegen + // 1: Attribute starts before, goes to index ... + else if ( pAttrib->GetEnd() == nIndex ) // Start must be before { - // Nur expandieren, wenn kein Feature, - // und wenn nicht in ExcludeListe! - // Sonst geht z.B. ein UL bis zum neuen ULDB, beide expandieren + // Only expand when there is no feature + // and if not in exclude list! + // Otherwise, a UL will go on until a new ULDB, expaning both // if ( !pAttrib->IsFeature() && !rExclList.FindAttrib( pAttrib->Which() ) ) if ( !pAttrib->IsFeature() && !aCharAttribList.FindEmptyAttrib( pAttrib->Which(), nIndex ) ) { @@ -786,38 +761,38 @@ void ContentNode::ExpandAttribs( USHORT nIndex, USHORT nNew, SfxItemPool& rItemP pAttrib->Expand( nNew ); } else - bResort = TRUE; + bResort = sal_True; } - // 2: Attribut startet davor, geht hinter Index... + // 2: Attribute starts before, goes past the Index... else if ( ( pAttrib->GetStart() < nIndex ) && ( pAttrib->GetEnd() > nIndex ) ) { - DBG_ASSERT( !pAttrib->IsFeature(), "Grosses Feature?!" ); + DBG_ASSERT( !pAttrib->IsFeature(), "Large Feature?!" ); pAttrib->Expand( nNew ); } - // 3: Attribut startet auf Index... + // 3: Attribute starts on index... else if ( pAttrib->GetStart() == nIndex ) { if ( pAttrib->IsFeature() ) { pAttrib->MoveForward( nNew ); - bResort = TRUE; + bResort = sal_True; } else { - BOOL bExpand = FALSE; + sal_Bool bExpand = sal_False; if ( nIndex == 0 ) { - bExpand = TRUE; + bExpand = sal_True; if( bExpandedEmptyAtIndexNull ) { // Check if this kind of attribut was empty and expanded here... - USHORT nW = pAttrib->GetItem()->Which(); - for ( USHORT nA = 0; nA < nAttr; nA++ ) + sal_uInt16 nW = pAttrib->GetItem()->Which(); + for ( sal_uInt16 nA = 0; nA < nAttr; nA++ ) { EditCharAttrib* pA = aCharAttribList.GetAttribs()[nA]; if ( ( pA->GetStart() == 0 ) && ( pA->GetItem()->Which() == nW ) ) { - bExpand = FALSE; + bExpand = sal_False; break; } } @@ -827,7 +802,7 @@ void ContentNode::ExpandAttribs( USHORT nIndex, USHORT nNew, SfxItemPool& rItemP if ( bExpand ) { pAttrib->Expand( nNew ); - bResort = TRUE; + bResort = sal_True; } else { @@ -838,16 +813,16 @@ void ContentNode::ExpandAttribs( USHORT nIndex, USHORT nNew, SfxItemPool& rItemP } if ( pAttrib->IsEdge() ) - pAttrib->SetEdge( FALSE ); + pAttrib->SetEdge( sal_False ); DBG_ASSERT( !pAttrib->IsFeature() || ( pAttrib->GetLen() == 1 ), "Expand: FeaturesLen != 1" ); - DBG_ASSERT( pAttrib->GetStart() <= pAttrib->GetEnd(), "Expand: Attribut verdreht!" ); - DBG_ASSERT( ( pAttrib->GetEnd() <= Len() ), "Expand: Attrib groesser als Absatz!" ); + DBG_ASSERT( pAttrib->GetStart() <= pAttrib->GetEnd(), "Expand: Attribute distorted!" ); + DBG_ASSERT( ( pAttrib->GetEnd() <= Len() ), "Expand: Attribute larger than paragraph!" ); if ( pAttrib->IsEmpty() ) { - DBG_ERROR( "Leeres Attribut nach ExpandAttribs?" ); - bResort = TRUE; + OSL_FAIL( "Empty Attribute after ExpandAttribs?" ); + bResort = sal_True; aCharAttribList.GetAttribs().Remove( nAttr ); rItemPool.Remove( *pAttrib->GetItem() ); delete pAttrib; @@ -860,69 +835,67 @@ void ContentNode::ExpandAttribs( USHORT nIndex, USHORT nNew, SfxItemPool& rItemP if ( bResort ) aCharAttribList.ResortAttribs(); -#ifndef SVX_LIGHT if ( pWrongList ) { - BOOL bSep = ( GetChar( nIndex ) == ' ' ) || IsFeature( nIndex ); + sal_Bool bSep = ( GetChar( nIndex ) == ' ' ) || IsFeature( nIndex ); pWrongList->TextInserted( nIndex, nNew, bSep ); } -#endif // !SVX_LIGHT #ifdef EDITDEBUG - DBG_ASSERT( CheckOrderedList( aCharAttribList.GetAttribs(), TRUE ), "Expand: Start-Liste verdreht" ); + DBG_ASSERT( CheckOrderedList( aCharAttribList.GetAttribs(), sal_True ), "Expand: Start List distorted" ); #endif } -void ContentNode::CollapsAttribs( USHORT nIndex, USHORT nDeleted, SfxItemPool& rItemPool ) +void ContentNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted, SfxItemPool& rItemPool ) { if ( !nDeleted ) return; - // Da Features anders behandelt werden als normale Zeichenattribute, - // kann sich hier auch die Sortierung der Start-Liste aendern! - BOOL bResort = FALSE; - BOOL bDelAttr = FALSE; - USHORT nEndChanges = nIndex+nDeleted; + // Since features are treated differently than normal character attributes, + // can also the order of the start list be change! + sal_Bool bResort = sal_False; + sal_Bool bDelAttr = sal_False; + sal_uInt16 nEndChanges = nIndex+nDeleted; - USHORT nAttr = 0; + sal_uInt16 nAttr = 0; EditCharAttrib* pAttrib = GetAttrib( aCharAttribList.GetAttribs(), nAttr ); while ( pAttrib ) { - bDelAttr = FALSE; + bDelAttr = sal_False; if ( pAttrib->GetEnd() >= nIndex ) { - // Alles Attribute hinter der Einfuegeposition verschieben... + // Move all Attribute behind the insert point... if ( pAttrib->GetStart() >= nEndChanges ) { pAttrib->MoveBackward( nDeleted ); } - // 1. Innenliegende Attribute loeschen... + // 1. Delete Internal attributes... else if ( ( pAttrib->GetStart() >= nIndex ) && ( pAttrib->GetEnd() <= nEndChanges ) ) { - // Spezialfall: Attrubt deckt genau den Bereich ab - // => als leeres Attribut behalten. + // Special case: Attribute covers the area exactly + // => keep as empty Attribute. if ( !pAttrib->IsFeature() && ( pAttrib->GetStart() == nIndex ) && ( pAttrib->GetEnd() == nEndChanges ) ) - pAttrib->GetEnd() = nIndex; // leer + pAttrib->GetEnd() = nIndex; // empty else - bDelAttr = TRUE; + bDelAttr = sal_True; } - // 2. Attribut beginnt davor, endet drinnen oder dahinter... + // 2. Attribute starts earlier, ends inside or behind it ... else if ( ( pAttrib->GetStart() <= nIndex ) && ( pAttrib->GetEnd() > nIndex ) ) { DBG_ASSERT( !pAttrib->IsFeature(), "Collapsing Feature!" ); - if ( pAttrib->GetEnd() <= nEndChanges ) // endet drinnen + if ( pAttrib->GetEnd() <= nEndChanges ) // ends inside pAttrib->GetEnd() = nIndex; else - pAttrib->Collaps( nDeleted ); // endet dahinter + pAttrib->Collaps( nDeleted ); // ends behind } - // 3. Attribut beginnt drinnen, endet dahinter... + // 3. Attribute starts inside, ending behind ... else if ( ( pAttrib->GetStart() >= nIndex ) && ( pAttrib->GetEnd() > nEndChanges ) ) { - // Features duerfen nicht expandieren! + // Features not allowed to expand! if ( pAttrib->IsFeature() ) { pAttrib->MoveBackward( nDeleted ); - bResort = TRUE; + bResort = sal_True; } else { @@ -933,18 +906,18 @@ void ContentNode::CollapsAttribs( USHORT nIndex, USHORT nDeleted, SfxItemPool& r } DBG_ASSERT( !pAttrib->IsFeature() || ( pAttrib->GetLen() == 1 ), "Expand: FeaturesLen != 1" ); - DBG_ASSERT( pAttrib->GetStart() <= pAttrib->GetEnd(), "Collaps: Attribut verdreht!" ); - DBG_ASSERT( ( pAttrib->GetEnd() <= Len()) || bDelAttr, "Collaps: Attrib groesser als Absatz!" ); - if ( bDelAttr /* || pAttrib->IsEmpty() */ ) + DBG_ASSERT( pAttrib->GetStart() <= pAttrib->GetEnd(), "Collaps: Attribut distorted!" ); + DBG_ASSERT( ( pAttrib->GetEnd() <= Len()) || bDelAttr, "Collaps: Attribute larger than paragraph!" ); + if ( bDelAttr ) { - bResort = TRUE; + bResort = sal_True; aCharAttribList.GetAttribs().Remove( nAttr ); rItemPool.Remove( *pAttrib->GetItem() ); delete pAttrib; nAttr--; } else if ( pAttrib->IsEmpty() ) - aCharAttribList.HasEmptyAttribs() = TRUE; + aCharAttribList.HasEmptyAttribs() = sal_True; nAttr++; pAttrib = GetAttrib( aCharAttribList.GetAttribs(), nAttr ); @@ -953,54 +926,51 @@ void ContentNode::CollapsAttribs( USHORT nIndex, USHORT nDeleted, SfxItemPool& r if ( bResort ) aCharAttribList.ResortAttribs(); -#ifndef SVX_LIGHT if ( pWrongList ) pWrongList->TextDeleted( nIndex, nDeleted ); -#endif // !SVX_LIGHT #ifdef EDITDEBUG - DBG_ASSERT( CheckOrderedList( aCharAttribList.GetAttribs(), TRUE ), "Collaps: Start-Liste verdreht" ); + DBG_ASSERT( CheckOrderedList( aCharAttribList.GetAttribs(), sal_True ), "Collaps: Start list distorted" ); #endif } -void ContentNode::CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, BOOL bKeepEndingAttribs ) +void ContentNode::CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, sal_Bool bKeepEndingAttribs ) { - DBG_ASSERT( pPrevNode, "kopieren von Attributen auf einen NULL-Pointer ?" ); + DBG_ASSERT( pPrevNode, "Copy of attributes to a null pointer?" ); xub_StrLen nCut = pPrevNode->Len(); - USHORT nAttr = 0; + sal_uInt16 nAttr = 0; EditCharAttrib* pAttrib = GetAttrib( pPrevNode->GetCharAttribs().GetAttribs(), nAttr ); while ( pAttrib ) { if ( pAttrib->GetEnd() < nCut ) { - // bleiben unveraendert.... + // remain unchanged .... ; } else if ( pAttrib->GetEnd() == nCut ) { - // muessen als leeres Attribut kopiert werden. + // must be copied as an empty attributes. if ( bKeepEndingAttribs && !pAttrib->IsFeature() && !aCharAttribList.FindAttrib( pAttrib->GetItem()->Which(), 0 ) ) { EditCharAttrib* pNewAttrib = MakeCharAttrib( rPool, *(pAttrib->GetItem()), 0, 0 ); - DBG_ASSERT( pNewAttrib, "MakeCharAttrib fehlgeschlagen!" ); + DBG_ASSERT( pNewAttrib, "MakeCharAttrib failed!" ); aCharAttribList.InsertAttrib( pNewAttrib ); } } else if ( pAttrib->IsInside( nCut ) || ( !nCut && !pAttrib->GetStart() && !pAttrib->IsFeature() ) ) { - // Wenn ganz vorne gecuttet wird, muss das Attribut erhalten bleiben! - // muessen kopiert und geaendert werden + // If cut is done right at the front then the attribute must be + // kept! Has to be copied and changed. EditCharAttrib* pNewAttrib = MakeCharAttrib( rPool, *(pAttrib->GetItem()), 0, pAttrib->GetEnd()-nCut ); - DBG_ASSERT( pNewAttrib, "MakeCharAttrib fehlgeschlagen!" ); + DBG_ASSERT( pNewAttrib, "MakeCharAttrib failed!" ); aCharAttribList.InsertAttrib( pNewAttrib ); - // stutzen: pAttrib->GetEnd() = nCut; } else { - // alle dahinter verschieben in den neuen Node (this) + // Move all attributes in the current node (this) // pPrevNode->GetCharAttribs().RemoveAttrib( pAttrib ); pPrevNode->GetCharAttribs().GetAttribs().Remove( nAttr ); aCharAttribList.InsertAttrib( pAttrib ); @@ -1017,24 +987,24 @@ void ContentNode::CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, void ContentNode::AppendAttribs( ContentNode* pNextNode ) { - DBG_ASSERT( pNextNode, "kopieren von Attributen von einen NULL-Pointer ?" ); + DBG_ASSERT( pNextNode, "Copy of attributes to a null pointer?" ); - USHORT nNewStart = Len(); + sal_uInt16 nNewStart = Len(); #ifdef EDITDEBUG - DBG_ASSERT( aCharAttribList.DbgCheckAttribs(), "Attribute VOR AppendAttribs kaputt" ); + DBG_ASSERT( aCharAttribList.DbgCheckAttribs(), "Attribute before AppendAttribs broken" ); #endif - USHORT nAttr = 0; + sal_uInt16 nAttr = 0; EditCharAttrib* pAttrib = GetAttrib( pNextNode->GetCharAttribs().GetAttribs(), nAttr ); while ( pAttrib ) { - // alle Attribute verschieben in den aktuellen Node (this) - BOOL bMelted = FALSE; + // Move all attributes in the current node (this) + sal_Bool bMelted = sal_False; if ( ( pAttrib->GetStart() == 0 ) && ( !pAttrib->IsFeature() ) ) { - // Evtl koennen Attribute zusammengefasst werden: - USHORT nTmpAttr = 0; + // Attributes can possibly be summarized as: + sal_uInt16 nTmpAttr = 0; EditCharAttrib* pTmpAttrib = GetAttrib( aCharAttribList.GetAttribs(), nTmpAttr ); while ( !bMelted && pTmpAttrib ) { @@ -1046,9 +1016,9 @@ void ContentNode::AppendAttribs( ContentNode* pNextNode ) pTmpAttrib->GetEnd() = pTmpAttrib->GetEnd() + pAttrib->GetLen(); pNextNode->GetCharAttribs().GetAttribs().Remove( nAttr ); - // Vom Pool abmelden ?! + // Unsubscribe from the pool?! delete pAttrib; - bMelted = TRUE; + bMelted = sal_True; } } ++nTmpAttr; @@ -1065,22 +1035,22 @@ void ContentNode::AppendAttribs( ContentNode* pNextNode ) } pAttrib = GetAttrib( pNextNode->GetCharAttribs().GetAttribs(), nAttr ); } - // Fuer die Attribute, die nur ruebergewandert sind: + // For the Attributes that just moved over: pNextNode->GetCharAttribs().Clear(); #ifdef EDITDEBUG - DBG_ASSERT( aCharAttribList.DbgCheckAttribs(), "Attribute NACH AppendAttribs kaputt" ); + DBG_ASSERT( aCharAttribList.DbgCheckAttribs(), "Attribute after AppendAttribs broken" ); #endif } void ContentNode::CreateDefFont() { - // Erst alle Informationen aus dem Style verwenden... + // First use the information from the style ... SfxStyleSheet* pS = aContentAttribs.GetStyleSheet(); if ( pS ) CreateFont( GetCharAttribs().GetDefFont(), pS->GetItemSet() ); - - // ... dann die harte Absatzformatierung rueberbuegeln... + + // ... then iron out the hard paragraph formatting... CreateFont( GetCharAttribs().GetDefFont(), GetContentAttribs().GetItems(), pS == NULL ); } @@ -1088,15 +1058,16 @@ void ContentNode::CreateDefFont() void ContentNode::SetStyleSheet( SfxStyleSheet* pS, const SvxFont& rFontFromStyle ) { aContentAttribs.SetStyleSheet( pS ); - - // Erst alle Informationen aus dem Style verwenden... + + + // First use the information from the style ... GetCharAttribs().GetDefFont() = rFontFromStyle; - // ... dann die harte Absatzformatierung rueberbuegeln... + // ... then iron out the hard paragraph formatting... CreateFont( GetCharAttribs().GetDefFont(), GetContentAttribs().GetItems(), pS == NULL ); } -void ContentNode::SetStyleSheet( SfxStyleSheet* pS, BOOL bRecalcFont ) +void ContentNode::SetStyleSheet( SfxStyleSheet* pS, sal_Bool bRecalcFont ) { aContentAttribs.SetStyleSheet( pS ); if ( bRecalcFont ) @@ -1105,29 +1076,22 @@ void ContentNode::SetStyleSheet( SfxStyleSheet* pS, BOOL bRecalcFont ) void ContentNode::DestroyWrongList() { -#ifndef SVX_LIGHT delete pWrongList; -#endif pWrongList = NULL; } void ContentNode::CreateWrongList() { - DBG_ASSERT( !pWrongList, "WrongList existiert schon!" ); -#ifndef SVX_LIGHT + DBG_ASSERT( !pWrongList, "WrongList already exist!" ); pWrongList = new WrongList; -#endif } -void ContentNode::SetWrongList( WrongList* p ) -{ - DBG_ASSERT( !pWrongList, "WrongList existiert schon!" ); - pWrongList = p; +void ContentNode::SetWrongList( WrongList* p ) +{ + DBG_ASSERT( !pWrongList, "WrongList already exist!" ); + pWrongList = p; } -// ------------------------------------------------------------------------- -// class ContentAttribs -// ------------------------------------------------------------------------- ContentAttribs::ContentAttribs( SfxItemPool& rPool ) : aAttribSet( rPool, EE_PARA_START, EE_CHAR_END ) { @@ -1144,17 +1108,17 @@ ContentAttribs::~ContentAttribs() { } -SvxTabStop ContentAttribs::FindTabStop( long nCurPos, USHORT nDefTab ) +SvxTabStop ContentAttribs::FindTabStop( long nCurPos, sal_uInt16 nDefTab ) { const SvxTabStopItem& rTabs = (const SvxTabStopItem&) GetItem( EE_PARA_TABS ); - for ( USHORT i = 0; i < rTabs.Count(); i++ ) + for ( sal_uInt16 i = 0; i < rTabs.Count(); i++ ) { const SvxTabStop& rTab = rTabs[i]; if ( rTab.GetTabPos() > nCurPos ) return rTab; } - // DefTab ermitteln... + // Determine DefTab ... SvxTabStop aTabStop; long x = nCurPos / nDefTab + 1; aTabStop.GetTabPos() = nDefTab * x; @@ -1163,100 +1127,120 @@ SvxTabStop ContentAttribs::FindTabStop( long nCurPos, USHORT nDefTab ) void ContentAttribs::SetStyleSheet( SfxStyleSheet* pS ) { - BOOL bStyleChanged = ( pStyle != pS ); + sal_Bool bStyleChanged = ( pStyle != pS ); pStyle = pS; - // #104799# Only when other style sheet, not when current style sheet modified + // Only when other style sheet, not when current style sheet modified if ( pStyle && bStyleChanged ) { - // Gezielt die Attribute aus der Absatzformatierung entfernen, die im Style - // spezifiziert sind, damit die Attribute des Styles wirken koennen. + // Selectively remove the attributes from the paragraph formatting + // which are specified in the style, so that the attributes of the + // style can have an affect. const SfxItemSet& rStyleAttribs = pStyle->GetItemSet(); - for ( USHORT nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ ) + for ( sal_uInt16 nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ ) { - // #99635# Don't change bullet on/off + // Don't change bullet on/off if ( ( nWhich != EE_PARA_BULLETSTATE ) && ( rStyleAttribs.GetItemState( nWhich ) == SFX_ITEM_ON ) ) aAttribSet.ClearItem( nWhich ); } } } -const SfxPoolItem& ContentAttribs::GetItem( USHORT nWhich ) +const SfxPoolItem& ContentAttribs::GetItem( sal_uInt16 nWhich ) { - // Harte Absatzattribute haben Vorrang! + // Hard paragraph attributes take precedence! SfxItemSet* pTakeFrom = &aAttribSet; - if ( pStyle && ( aAttribSet.GetItemState( nWhich, FALSE ) != SFX_ITEM_ON ) ) + if ( pStyle && ( aAttribSet.GetItemState( nWhich, sal_False ) != SFX_ITEM_ON ) ) pTakeFrom = &pStyle->GetItemSet(); return pTakeFrom->Get( nWhich ); } -BOOL ContentAttribs::HasItem( USHORT nWhich ) +sal_Bool ContentAttribs::HasItem( sal_uInt16 nWhich ) { - BOOL bHasItem = FALSE; - if ( aAttribSet.GetItemState( nWhich, FALSE ) == SFX_ITEM_ON ) - bHasItem = TRUE; + sal_Bool bHasItem = sal_False; + if ( aAttribSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_ON ) + bHasItem = sal_True; else if ( pStyle && pStyle->GetItemSet().GetItemState( nWhich ) == SFX_ITEM_ON ) - bHasItem = TRUE; + bHasItem = sal_True; return bHasItem; } +ItemList::ItemList() : CurrentItem( 0 ) +{ +} -// ---------------------------------------------------------------------- -// class ItemList -// ---------------------------------------------------------------------- -const SfxPoolItem* ItemList::FindAttrib( USHORT nWhich ) +const SfxPoolItem* ItemList::FindAttrib( sal_uInt16 nWhich ) { - const SfxPoolItem* pItem = First(); - while ( pItem && ( pItem->Which() != nWhich ) ) - pItem = Next(); + for ( size_t i = 0, n = aItemPool.size(); i < n; ++i ) + if ( aItemPool[ i ]->Which() == nWhich ) + return aItemPool[ i ]; + return NULL; +} - return pItem; +const SfxPoolItem* ItemList::First() +{ + CurrentItem = 0; + return aItemPool.empty() ? NULL : aItemPool[ 0 ]; } -// ------------------------------------------------------------------------- -// class EditDoc -// ------------------------------------------------------------------------- +const SfxPoolItem* ItemList::Next() +{ + if ( CurrentItem + 1 < aItemPool.size() ) + { + ++CurrentItem; + return aItemPool[ CurrentItem ]; + } + return NULL; +} + +void ItemList::Insert( const SfxPoolItem* pItem ) +{ + aItemPool.push_back( pItem ); + CurrentItem = aItemPool.size() - 1; +} + + EditDoc::EditDoc( SfxItemPool* pPool ) { - if ( pPool ) + if ( pPool ) { pItemPool = pPool; - bOwnerOfPool = FALSE; + bOwnerOfPool = sal_False; } else { - pItemPool = new EditEngineItemPool( FALSE ); - bOwnerOfPool = TRUE; + pItemPool = new EditEngineItemPool( sal_False ); + bOwnerOfPool = sal_True; } nDefTab = DEFTAB; - bIsVertical = FALSE; - bIsFixedCellHeight = FALSE; + bIsVertical = sal_False; + bIsFixedCellHeight = sal_False; // Don't create a empty node, Clear() will be called in EditEngine-CTOR - SetModified( FALSE ); + SetModified( sal_False ); }; EditDoc::~EditDoc() { ImplDestroyContents(); - if ( bOwnerOfPool ) + if ( bOwnerOfPool ) SfxItemPool::Free(pItemPool); } void EditDoc::ImplDestroyContents() { - for ( USHORT nNode = Count(); nNode; ) + for ( sal_uInt16 nNode = Count(); nNode; ) RemoveItemsFromPool( GetObject( --nNode ) ); DeleteAndDestroy( 0, Count() ); } void EditDoc::RemoveItemsFromPool( ContentNode* pNode ) { - for ( USHORT nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ ) { EditCharAttrib* pAttr = pNode->GetCharAttribs().GetAttribs()[nAttr]; GetItemPool().Remove( *pAttr->GetItem() ); @@ -1267,13 +1251,13 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, s { Font aPrevFont( rFont ); rFont.SetAlign( ALIGN_BASELINE ); - rFont.SetTransparent( TRUE ); + rFont.SetTransparent( sal_True ); - USHORT nWhich_FontInfo = GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ); - USHORT nWhich_Language = GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ); - USHORT nWhich_FontHeight = GetScriptItemId( EE_CHAR_FONTHEIGHT, nScriptType ); - USHORT nWhich_Weight = GetScriptItemId( EE_CHAR_WEIGHT, nScriptType ); - USHORT nWhich_Italic = GetScriptItemId( EE_CHAR_ITALIC, nScriptType ); + sal_uInt16 nWhich_FontInfo = GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ); + sal_uInt16 nWhich_Language = GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ); + sal_uInt16 nWhich_FontHeight = GetScriptItemId( EE_CHAR_FONTHEIGHT, nScriptType ); + sal_uInt16 nWhich_Weight = GetScriptItemId( EE_CHAR_WEIGHT, nScriptType ); + sal_uInt16 nWhich_Italic = GetScriptItemId( EE_CHAR_ITALIC, nScriptType ); if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontInfo ) == SFX_ITEM_ON ) ) { @@ -1307,8 +1291,8 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, s { const SvxEscapementItem& rEsc = (const SvxEscapementItem&) rSet.Get( EE_CHAR_ESCAPEMENT ); - USHORT nProp = rEsc.GetProp(); - rFont.SetPropr( (BYTE)nProp ); + sal_uInt16 nProp = rEsc.GetProp(); + rFont.SetPropr( (sal_uInt8)nProp ); short nEsc = rEsc.GetEsc(); if ( nEsc == DFLT_ESC_AUTO_SUPER ) @@ -1328,22 +1312,22 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, s if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_RELIEF ) == SFX_ITEM_ON ) ) rFont.SetRelief( (FontRelief)((const SvxCharReliefItem&)rSet.Get( EE_CHAR_RELIEF )).GetValue() ); - // Ob ich jetzt den ganzen Font vergleiche, oder vor jeder Aenderung - // pruefe, ob der Wert sich aendert, bleibt sich relativ gleich. - // So ggf ein MakeUniqFont im Font mehr, dafuer bei Aenderung schnellerer - // Abbruch der Abfrage, oder ich musste noch jedesmal ein bChanged pflegen. + // If comparing the entire font, or if checking before each alteration + // whether the value changes, remains relatively the same thing. + // So possible one MakeUniqFont more in the font, but as a result a quicker + // abortion of the query, or one must each time check bChanged. if ( rFont == aPrevFont ) - rFont = aPrevFont; // => Gleicher ImpPointer fuer IsSameInstance + rFont = aPrevFont; // => The same ImpPointer for IsSameInstance } -void EditDoc::CreateDefFont( BOOL bUseStyles ) +void EditDoc::CreateDefFont( sal_Bool bUseStyles ) { SfxItemSet aTmpSet( GetItemPool(), EE_PARA_START, EE_CHAR_END ); CreateFont( aDefFont, aTmpSet ); aDefFont.SetVertical( IsVertical() ); aDefFont.SetOrientation( IsVertical() ? 2700 : 0 ); - for ( USHORT nNode = 0; nNode < Count(); nNode++ ) + for ( sal_uInt16 nNode = 0; nNode < Count(); nNode++ ) { ContentNode* pNode = GetObject( nNode ); pNode->GetCharAttribs().GetDefFont() = aDefFont; @@ -1370,23 +1354,23 @@ XubString EditDoc::GetSepStr( LineEnd eEnd ) XubString EditDoc::GetText( LineEnd eEnd ) const { - ULONG nLen = GetTextLen(); - USHORT nNodes = Count(); + sal_uLong nLen = GetTextLen(); + sal_uInt16 nNodes = Count(); String aSep = EditDoc::GetSepStr( eEnd ); - USHORT nSepSize = aSep.Len(); + sal_uInt16 nSepSize = aSep.Len(); if ( nSepSize ) nLen += nNodes * nSepSize; if ( nLen > 0xFFFb / sizeof(xub_Unicode) ) { - DBG_ERROR( "Text zu gross fuer String" ); + OSL_FAIL( "Text to large for String" ); return XubString(); } xub_Unicode* pStr = new xub_Unicode[nLen+1]; xub_Unicode* pCur = pStr; - USHORT nLastNode = nNodes-1; - for ( USHORT nNode = 0; nNode < nNodes; nNode++ ) + sal_uInt16 nLastNode = nNodes-1; + for ( sal_uInt16 nNode = 0; nNode < nNodes; nNode++ ) { XubString aTmp( GetParaAsString( GetObject(nNode) ) ); memcpy( pCur, aTmp.GetBuffer(), aTmp.Len()*sizeof(sal_Unicode) ); @@ -1403,31 +1387,31 @@ XubString EditDoc::GetText( LineEnd eEnd ) const return aASCIIText; } -XubString EditDoc::GetParaAsString( USHORT nNode ) const +XubString EditDoc::GetParaAsString( sal_uInt16 nNode ) const { return GetParaAsString( SaveGetObject( nNode ) ); } -XubString EditDoc::GetParaAsString( ContentNode* pNode, USHORT nStartPos, USHORT nEndPos, BOOL bResolveFields ) const +XubString EditDoc::GetParaAsString( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, sal_Bool bResolveFields ) const { if ( nEndPos > pNode->Len() ) nEndPos = pNode->Len(); - DBG_ASSERT( nStartPos <= nEndPos, "Start und Ende vertauscht?" ); + DBG_ASSERT( nStartPos <= nEndPos, "Start and End reversed?" ); - USHORT nIndex = nStartPos; + sal_uInt16 nIndex = nStartPos; XubString aStr; EditCharAttrib* pNextFeature = pNode->GetCharAttribs().FindFeature( nIndex ); while ( nIndex < nEndPos ) { - USHORT nEnd = nEndPos; + sal_uInt16 nEnd = nEndPos; if ( pNextFeature && ( pNextFeature->GetStart() < nEnd ) ) nEnd = pNextFeature->GetStart(); else - pNextFeature = 0; // Feature interessiert unten nicht + pNextFeature = 0; // Feature does not interest the below - DBG_ASSERT( nEnd >= nIndex, "Ende vorm Index?" ); - //!! beware of sub string length of -1 which is also defined as STRING_LEN and + DBG_ASSERT( nEnd >= nIndex, "End in front of the index?" ); + //!! beware of sub string length of -1 which is also defined as STRING_LEN and //!! thus would result in adding the whole sub string up to the end of the node !! if (nEnd > nIndex) aStr += XubString( *pNode, nIndex, nEnd - nIndex ); @@ -1443,7 +1427,7 @@ XubString EditDoc::GetParaAsString( ContentNode* pNode, USHORT nStartPos, USHORT case EE_FEATURE_FIELD: if ( bResolveFields ) aStr += ((EditCharAttribField*)pNextFeature)->GetFieldValue(); break; - default: DBG_ERROR( "Was fuer ein Feature ?" ); + default: OSL_FAIL( "What feature?" ); } pNextFeature = pNode->GetCharAttribs().FindFeature( ++nEnd ); } @@ -1452,21 +1436,21 @@ XubString EditDoc::GetParaAsString( ContentNode* pNode, USHORT nStartPos, USHORT return aStr; } -ULONG EditDoc::GetTextLen() const +sal_uLong EditDoc::GetTextLen() const { - ULONG nLen = 0; - for ( USHORT nNode = 0; nNode < Count(); nNode++ ) + sal_uLong nLen = 0; + for ( sal_uInt16 nNode = 0; nNode < Count(); nNode++ ) { ContentNode* pNode = GetObject( nNode ); nLen += pNode->Len(); - // Felder k”nnen laenger sein als der Platzhalter im Node. + // Fields can be longer than the placeholder in the Node const CharAttribArray& rAttrs = pNode->GetCharAttribs().GetAttribs(); - for ( USHORT nAttr = rAttrs.Count(); nAttr; ) + for ( sal_uInt16 nAttr = rAttrs.Count(); nAttr; ) { EditCharAttrib* pAttr = rAttrs[--nAttr]; if ( pAttr->Which() == EE_FEATURE_FIELD ) { - USHORT nFieldLen = ((EditCharAttribField*)pAttr)->GetFieldValue().Len(); + sal_uInt16 nFieldLen = ((EditCharAttribField*)pAttr)->GetFieldValue().Len(); if ( !nFieldLen ) nLen--; else @@ -1484,15 +1468,15 @@ EditPaM EditDoc::Clear() ContentNode* pNode = new ContentNode( GetItemPool() ); Insert( pNode, 0 ); - CreateDefFont( FALSE ); + CreateDefFont( sal_False ); - SetModified( FALSE ); + SetModified( sal_False ); EditPaM aPaM( pNode, 0 ); return aPaM; } -void EditDoc::SetModified( BOOL b ) +void EditDoc::SetModified( sal_Bool b ) { bModified = b; if ( bModified ) @@ -1503,7 +1487,7 @@ void EditDoc::SetModified( BOOL b ) EditPaM EditDoc::RemoveText() { - // Das alte ItemSetmerken, damit z.B. im Chart Font behalten bleibt + // Keep the old ItemSet, to keep the chart Font. ContentNode* pPrevFirstNode = GetObject(0); SfxStyleSheet* pPrevStyle = pPrevFirstNode->GetStyleSheet(); SfxItemSet aPrevSet( pPrevFirstNode->GetContentAttribs().GetItems() ); @@ -1514,11 +1498,11 @@ EditPaM EditDoc::RemoveText() ContentNode* pNode = new ContentNode( GetItemPool() ); Insert( pNode, 0 ); - pNode->SetStyleSheet( pPrevStyle, FALSE ); + pNode->SetStyleSheet( pPrevStyle, sal_False ); pNode->GetContentAttribs().GetItems().Set( aPrevSet ); pNode->GetCharAttribs().GetDefFont() = aPrevFont; - SetModified( TRUE ); + SetModified( sal_True ); EditPaM aPaM( pNode, 0 ); return aPaM; @@ -1526,37 +1510,37 @@ EditPaM EditDoc::RemoveText() void EditDoc::InsertText( const EditPaM& rPaM, xub_Unicode c ) { - DBG_ASSERT( c != 0x0A, "EditDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); - DBG_ASSERT( c != 0x0D, "EditDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); - DBG_ASSERT( c != '\t', "EditDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); + DBG_ASSERT( c != 0x0A, "EditDoc::InsertText: Newlines prohibited in paragraph!" ); + DBG_ASSERT( c != 0x0D, "EditDoc::InsertText: Newlines prohibited in paragraph!" ); + DBG_ASSERT( c != '\t', "EditDoc::InsertText: Newlines prohibited in paragraph!" ); rPaM.GetNode()->Insert( c, rPaM.GetIndex() ); rPaM.GetNode()->ExpandAttribs( rPaM.GetIndex(), 1, GetItemPool() ); - SetModified( TRUE ); + SetModified( sal_True ); } EditPaM EditDoc::InsertText( EditPaM aPaM, const XubString& rStr ) { - DBG_ASSERT( rStr.Search( 0x0A ) == STRING_NOTFOUND, "EditDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); - DBG_ASSERT( rStr.Search( 0x0D ) == STRING_NOTFOUND, "EditDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); - DBG_ASSERT( rStr.Search( '\t' ) == STRING_NOTFOUND, "EditDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); + DBG_ASSERT( rStr.Search( 0x0A ) == STRING_NOTFOUND, "EditDoc::InsertText: Newlines prohibited in paragraph!" ); + DBG_ASSERT( rStr.Search( 0x0D ) == STRING_NOTFOUND, "EditDoc::InsertText: Newlines prohibited in paragraph!" ); + DBG_ASSERT( rStr.Search( '\t' ) == STRING_NOTFOUND, "EditDoc::InsertText: Newlines prohibited in paragraph!" ); DBG_ASSERT( aPaM.GetNode(), "Blinder PaM in EditDoc::InsertText1" ); aPaM.GetNode()->Insert( rStr, aPaM.GetIndex() ); aPaM.GetNode()->ExpandAttribs( aPaM.GetIndex(), rStr.Len(), GetItemPool() ); aPaM.GetIndex() = aPaM.GetIndex() + rStr.Len(); - SetModified( TRUE ); + SetModified( sal_True ); return aPaM; } -EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, BOOL bKeepEndingAttribs ) +EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs ) { DBG_ASSERT( aPaM.GetNode(), "Blinder PaM in EditDoc::InsertParaBreak" ); ContentNode* pCurNode = aPaM.GetNode(); - USHORT nPos = GetPos( pCurNode ); + sal_uInt16 nPos = GetPos( pCurNode ); XubString aStr = aPaM.GetNode()->Copy( aPaM.GetIndex() ); aPaM.GetNode()->Erase( aPaM.GetIndex() ); @@ -1564,12 +1548,12 @@ EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, BOOL bKeepEndingAttribs ) ContentAttribs aContentAttribs( aPaM.GetNode()->GetContentAttribs() ); // for a new paragraph we like to have the bullet/numbering visible by default - aContentAttribs.GetItems().Put( SfxBoolItem( EE_PARA_BULLETSTATE, TRUE), EE_PARA_BULLETSTATE ); + aContentAttribs.GetItems().Put( SfxBoolItem( EE_PARA_BULLETSTATE, sal_True), EE_PARA_BULLETSTATE ); - // ContenNode-CTOR kopiert auch die Absatzattribute + // ContenNode constructor copies also the paragraph attributes ContentNode* pNode = new ContentNode( aStr, aContentAttribs ); - // Den Default-Font kopieren + // Copy the Default Font pNode->GetCharAttribs().GetDefFont() = aPaM.GetNode()->GetCharAttribs().GetDefFont(); SfxStyleSheet* pStyle = aPaM.GetNode()->GetStyleSheet(); if ( pStyle ) @@ -1582,12 +1566,12 @@ EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, BOOL bKeepEndingAttribs ) } } - // Zeichenattribute muessen ggf. kopiert bzw gestutzt werden: + // Character attributes may need to be copied or trimmed: pNode->CopyAndCutAttribs( aPaM.GetNode(), GetItemPool(), bKeepEndingAttribs ); Insert( pNode, nPos+1 ); - SetModified( TRUE ); + SetModified( sal_True ); aPaM.SetNode( pNode ); aPaM.SetIndex( 0 ); @@ -1601,12 +1585,12 @@ EditPaM EditDoc::InsertFeature( EditPaM aPaM, const SfxPoolItem& rItem ) aPaM.GetNode()->Insert( CH_FEATURE, aPaM.GetIndex() ); aPaM.GetNode()->ExpandAttribs( aPaM.GetIndex(), 1, GetItemPool() ); - // Fuer das Feature ein Feature-Attribut anlegen... + // Create a feature-attribute for the feature... EditCharAttrib* pAttrib = MakeCharAttrib( GetItemPool(), rItem, aPaM.GetIndex(), aPaM.GetIndex()+1 ); - DBG_ASSERT( pAttrib, "Warum kann ich kein Feature anlegen ?" ); + DBG_ASSERT( pAttrib, "Why can not the feature be created?" ); aPaM.GetNode()->GetCharAttribs().InsertAttrib( pAttrib ); - SetModified( TRUE ); + SetModified( sal_True ); aPaM.GetIndex()++; return aPaM; @@ -1616,45 +1600,45 @@ EditPaM EditDoc::ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight ) { const EditPaM aPaM( pLeft, pLeft->Len() ); - // Erst die Attribute, da sonst nLen nicht stimmt! + // First the attributes, otherwise nLen will not be correct! pLeft->AppendAttribs( pRight ); - // Dann den Text... + // then the Text... *pLeft += *pRight; - // der rechte verschwindet. + // the one to the right disappears. RemoveItemsFromPool( pRight ); - USHORT nRight = GetPos( pRight ); + sal_uInt16 nRight = GetPos( pRight ); Remove( nRight ); delete pRight; - SetModified( TRUE ); + SetModified( sal_True ); return aPaM; } -EditPaM EditDoc::RemoveChars( EditPaM aPaM, USHORT nChars ) +EditPaM EditDoc::RemoveChars( EditPaM aPaM, sal_uInt16 nChars ) { - // Evtl. Features entfernen! + // Maybe remove Features! aPaM.GetNode()->Erase( aPaM.GetIndex(), nChars ); aPaM.GetNode()->CollapsAttribs( aPaM.GetIndex(), nChars, GetItemPool() ); - SetModified( TRUE ); + SetModified( sal_True ); return aPaM; } -void EditDoc::InsertAttribInSelection( ContentNode* pNode, USHORT nStart, USHORT nEnd, const SfxPoolItem& rPoolItem ) +void EditDoc::InsertAttribInSelection( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem ) { - DBG_ASSERT( pNode, "Wohin mit dem Attribut?" ); - DBG_ASSERT( nEnd <= pNode->Len(), "InsertAttrib: Attribut zu gross!" ); + DBG_ASSERT( pNode, "What to do with the attribute?" ); + DBG_ASSERT( nEnd <= pNode->Len(), "InsertAttrib: Attribute to large!" ); - // fuer Optimierung: - // dieses endet am Anfang der Selektion => kann erweitert werden + // for Optimization: + // This ends at the beginning of the selection => can be expanded EditCharAttrib* pEndingAttrib = 0; - // dieses startet am Ende der Selektion => kann erweitert werden + // This starts at the end of the selection => can be expanded EditCharAttrib* pStartingAttrib = 0; - DBG_ASSERT( nStart <= nEnd, "Kleiner Rechenfehler in InsertAttribInSelection" ); + DBG_ASSERT( nStart <= nEnd, "Small miscalculations in InsertAttribInSelection" ); RemoveAttribs( pNode, nStart, nEnd, pStartingAttrib, pEndingAttrib, rPoolItem.Which() ); @@ -1662,7 +1646,7 @@ void EditDoc::InsertAttribInSelection( ContentNode* pNode, USHORT nStart, USHORT ( *(pStartingAttrib->GetItem()) == rPoolItem ) && ( *(pEndingAttrib->GetItem()) == rPoolItem ) ) { - // wird ein groesses Attribut. + // Will become a large Attribute. pEndingAttrib->GetEnd() = pStartingAttrib->GetEnd(); GetItemPool().Remove( *(pStartingAttrib->GetItem()) ); pNode->GetCharAttribs().GetAttribs().Remove( pNode->GetCharAttribs().GetAttribs().GetPos( pStartingAttrib ) ); @@ -1678,108 +1662,105 @@ void EditDoc::InsertAttribInSelection( ContentNode* pNode, USHORT nStart, USHORT if ( pStartingAttrib ) pNode->GetCharAttribs().ResortAttribs(); - SetModified( TRUE ); + SetModified( sal_True ); } -BOOL EditDoc::RemoveAttribs( ContentNode* pNode, USHORT nStart, USHORT nEnd, USHORT nWhich ) +sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt16 nWhich ) { EditCharAttrib* pStarting; EditCharAttrib* pEnding; return RemoveAttribs( pNode, nStart, nEnd, pStarting, pEnding, nWhich ); } -BOOL EditDoc::RemoveAttribs( ContentNode* pNode, USHORT nStart, USHORT nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, USHORT nWhich ) +sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich ) { - DBG_ASSERT( pNode, "Wohin mit dem Attribut?" ); - DBG_ASSERT( nEnd <= pNode->Len(), "InsertAttrib: Attribut zu gross!" ); - // dieses endet am Anfang der Selektion => kann erweitert werden + DBG_ASSERT( pNode, "What to do with the attribute?" ); + DBG_ASSERT( nEnd <= pNode->Len(), "InsertAttrib: Attribute to large!" ); + + // This ends at the beginning of the selection => can be expanded rpEnding = 0; - // dieses startet am Ende der Selektion => kann erweitert werden + // This starts at the end of the selection => can be expanded rpStarting = 0; - BOOL bChanged = FALSE; + sal_Bool bChanged = sal_False; - DBG_ASSERT( nStart <= nEnd, "Kleiner Rechenfehler in InsertAttribInSelection" ); + DBG_ASSERT( nStart <= nEnd, "Small miscalculations in InsertAttribInSelection" ); - // ueber die Attribute iterieren... - USHORT nAttr = 0; + // iterate over the attributes ... + sal_uInt16 nAttr = 0; EditCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); while ( pAttr ) { - BOOL bRemoveAttrib = FALSE; - // MT 11.9.97: - // Ich denke dass in dieser Methode generell keine Features geloescht - // werden sollen. - // => Dann koennen die Feature-Abfragen weiter unten entfallen - USHORT nAttrWhich = pAttr->Which(); + sal_Bool bRemoveAttrib = sal_False; + sal_uInt16 nAttrWhich = pAttr->Which(); if ( ( nAttrWhich < EE_FEATURE_START ) && ( !nWhich || ( nAttrWhich == nWhich ) ) ) { - // Attribut beginnt in Selection + // Attribute starts in Selection if ( ( pAttr->GetStart() >= nStart ) && ( pAttr->GetStart() <= nEnd ) ) { - bChanged = TRUE; + bChanged = sal_True; if ( pAttr->GetEnd() > nEnd ) { - pAttr->GetStart() = nEnd; // dann faengt es dahinter an + pAttr->GetStart() = nEnd; // then it starts after this rpStarting = pAttr; if ( nWhich ) - break; // es kann kein weiteres Attrib hier liegen + break; // There can be no further attributes here } else if ( !pAttr->IsFeature() || ( pAttr->GetStart() == nStart ) ) { - // Feature nur loeschen, wenn genau an der Stelle - bRemoveAttrib = TRUE; + // Delete feature only if on the exact spot + bRemoveAttrib = sal_True; } } - // Attribut endet in Selection + // Attribute ends in Selection else if ( ( pAttr->GetEnd() >= nStart ) && ( pAttr->GetEnd() <= nEnd ) ) { - bChanged = TRUE; + bChanged = sal_True; if ( ( pAttr->GetStart() < nStart ) && !pAttr->IsFeature() ) { - pAttr->GetEnd() = nStart; // dann hoert es hier auf + pAttr->GetEnd() = nStart; // then it ends here rpEnding = pAttr; } else if ( !pAttr->IsFeature() || ( pAttr->GetStart() == nStart ) ) { - // Feature nur loeschen, wenn genau an der Stelle - bRemoveAttrib = TRUE; + // Delete feature only if on the exact spot + bRemoveAttrib = sal_True; } } - // Attribut ueberlappt die Selektion + // Attribute overlaps the selection else if ( ( pAttr->GetStart() <= nStart ) && ( pAttr->GetEnd() >= nEnd ) ) { - bChanged = TRUE; + bChanged = sal_True; if ( pAttr->GetStart() == nStart ) { pAttr->GetStart() = nEnd; rpStarting = pAttr; if ( nWhich ) - break; // es kann weitere Attribute geben! + break; // There can be further attributes! } else if ( pAttr->GetEnd() == nEnd ) { pAttr->GetEnd() = nStart; rpEnding = pAttr; if ( nWhich ) - break; // es kann weitere Attribute geben! + break; // There can be further attributes! } - else // Attribut muss gesplittet werden... + else // Attribute must be split ... { - USHORT nOldEnd = pAttr->GetEnd(); + sal_uInt16 nOldEnd = pAttr->GetEnd(); pAttr->GetEnd() = nStart; rpEnding = pAttr; InsertAttrib( *pAttr->GetItem(), pNode, nEnd, nOldEnd ); if ( nWhich ) - break; // es kann weitere Attribute geben! + break; // There can be further attributes! } } } if ( bRemoveAttrib ) { - DBG_ASSERT( ( pAttr != rpStarting ) && ( pAttr != rpEnding ), "Loeschen und behalten des gleichen Attributs ?" ); + DBG_ASSERT( ( pAttr != rpStarting ) && ( pAttr != rpEnding ), "Delete and retain the same attribute?" ); DBG_ASSERT( !pAttr->IsFeature(), "RemoveAttribs: Remove a feature?!" ); pNode->GetCharAttribs().GetAttribs().Remove(nAttr); GetItemPool().Remove( *pAttr->GetItem() ); @@ -1795,25 +1776,24 @@ BOOL EditDoc::RemoveAttribs( ContentNode* pNode, USHORT nStart, USHORT nEnd, Edi // char attributes need to be sorted by start again pNode->GetCharAttribs().ResortAttribs(); - SetModified( TRUE ); + SetModified( sal_True ); } return bChanged; } -void EditDoc::InsertAttrib( const SfxPoolItem& rPoolItem, ContentNode* pNode, USHORT nStart, USHORT nEnd ) +void EditDoc::InsertAttrib( const SfxPoolItem& rPoolItem, ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd ) { - // Diese Methode prueft nicht mehr, ob ein entspr. Attribut - // schon an der Stelle existiert! - + // This method no longer checks whether a corresponding attribute already + // exists at this place! EditCharAttrib* pAttrib = MakeCharAttrib( GetItemPool(), rPoolItem, nStart, nEnd ); - DBG_ASSERT( pAttrib, "MakeCharAttrib fehlgeschlagen!" ); + DBG_ASSERT( pAttrib, "MakeCharAttrib failed!" ); pNode->GetCharAttribs().InsertAttrib( pAttrib ); - SetModified( TRUE ); + SetModified( sal_True ); } -void EditDoc::InsertAttrib( ContentNode* pNode, USHORT nStart, USHORT nEnd, const SfxPoolItem& rPoolItem ) +void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem ) { if ( nStart != nEnd ) { @@ -1821,33 +1801,31 @@ void EditDoc::InsertAttrib( ContentNode* pNode, USHORT nStart, USHORT nEnd, cons } else { - // Pruefen, ob schon ein neues Attribut mit der WhichId an der Stelle: + // Check whether already a new attribute with WhichId exists at this place: EditCharAttrib* pAttr = pNode->GetCharAttribs().FindEmptyAttrib( rPoolItem.Which(), nStart ); if ( pAttr ) { - // Attribut entfernen.... + // Remove attribute.... pNode->GetCharAttribs().GetAttribs().Remove( pNode->GetCharAttribs().GetAttribs().GetPos( pAttr ) ); } - // pruefen, ob ein 'gleiches' Attribut an der Stelle liegt. + // check whether 'the same' attribute exist at this place. pAttr = pNode->GetCharAttribs().FindAttrib( rPoolItem.Which(), nStart ); if ( pAttr ) { - if ( pAttr->IsInside( nStart ) ) // splitten + if ( pAttr->IsInside( nStart ) ) // split { - // ??????????????????????????????? - // eigentlich noch pruefen, ob wirklich splittet, oder return ! - // ??????????????????????????????? - USHORT nOldEnd = pAttr->GetEnd(); + // check again if really splitting, or return ! + sal_uInt16 nOldEnd = pAttr->GetEnd(); pAttr->GetEnd() = nStart; pAttr = MakeCharAttrib( GetItemPool(), *(pAttr->GetItem()), nStart, nOldEnd ); pNode->GetCharAttribs().InsertAttrib( pAttr ); } else if ( pAttr->GetEnd() == nStart ) { - DBG_ASSERT( !pAttr->IsEmpty(), "Doch noch ein leeres Attribut?" ); - // pruefen, ob genau das gleiche Attribut + DBG_ASSERT( !pAttr->IsEmpty(), "Still an empty attribute?" ); + // Check if exactly the same attribute if ( *(pAttr->GetItem()) == rPoolItem ) return; } @@ -1855,46 +1833,46 @@ void EditDoc::InsertAttrib( ContentNode* pNode, USHORT nStart, USHORT nEnd, cons InsertAttrib( rPoolItem, pNode, nStart, nStart ); } - SetModified( TRUE ); + SetModified( sal_True ); } -void EditDoc::FindAttribs( ContentNode* pNode, USHORT nStartPos, USHORT nEndPos, SfxItemSet& rCurSet ) +void EditDoc::FindAttribs( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, SfxItemSet& rCurSet ) { - DBG_ASSERT( pNode, "Wo soll ich suchen ?" ); - DBG_ASSERT( nStartPos <= nEndPos, "Ungueltiger Bereich!" ); + DBG_ASSERT( pNode, "Where to search?" ); + DBG_ASSERT( nStartPos <= nEndPos, "Invalid region!" ); - USHORT nAttr = 0; + sal_uInt16 nAttr = 0; EditCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); - // keine Selection... + // No Selection... if ( nStartPos == nEndPos ) { while ( pAttr && ( pAttr->GetStart() <= nEndPos) ) { const SfxPoolItem* pItem = 0; - // Attribut liegt dadrueber... + // Attribute is about... if ( ( pAttr->GetStart() < nStartPos ) && ( pAttr->GetEnd() > nStartPos ) ) pItem = pAttr->GetItem(); - // Attribut endet hier, ist nicht leer + // Attribute ending here is not empty else if ( ( pAttr->GetStart() < nStartPos ) && ( pAttr->GetEnd() == nStartPos ) ) { if ( !pNode->GetCharAttribs().FindEmptyAttrib( pAttr->GetItem()->Which(), nStartPos ) ) pItem = pAttr->GetItem(); } - // Attribut endet hier, ist leer + // Attribute ending here is empty else if ( ( pAttr->GetStart() == nStartPos ) && ( pAttr->GetEnd() == nStartPos ) ) { pItem = pAttr->GetItem(); } - // Attribut beginnt hier + // Attribute starts here else if ( ( pAttr->GetStart() == nStartPos ) && ( pAttr->GetEnd() > nStartPos ) ) { - if ( nStartPos == 0 ) // Sonderfall + if ( nStartPos == 0 ) // special case pItem = pAttr->GetItem(); } if ( pItem ) { - USHORT nWhich = pItem->Which(); + sal_uInt16 nWhich = pItem->Which(); if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF ) { rCurSet.Put( *pItem ); @@ -1912,47 +1890,39 @@ void EditDoc::FindAttribs( ContentNode* pNode, USHORT nStartPos, USHORT nEndPos, pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); } } - else // Selektion + else // Selection { while ( pAttr && ( pAttr->GetStart() < nEndPos) ) { const SfxPoolItem* pItem = 0; - // Attribut liegt dadrueber... + // Attribut is about... if ( ( pAttr->GetStart() <= nStartPos ) && ( pAttr->GetEnd() >= nEndPos ) ) pItem = pAttr->GetItem(); - // Attribut startet mitten drin... + // Attribute starts right in the middle ... else if ( pAttr->GetStart() >= nStartPos ) { // !!! pItem = pAttr->GetItem(); - // einfach nur pItem reicht nicht, da ich z.B. bei Shadow - // niemals ein ungleiches Item finden wuerde, da ein solche - // seine Anwesenheit durch Abwesenheit repraesentiert! - // if ( ... ) - // Es muesste geprueft werden, on genau das gleiche Attribut - // an der Bruchstelle aufsetzt, was recht aufwendig ist. - // Da ich beim Einfuegen von Attributen aber etwas optimiere - // tritt der Fall nicht so schnell auf... - // Also aus Geschwindigkeitsgruenden: + // PItem is simply not enough, since one for example in case + // of Shadow, would never find an unequal item, since such a + // item represents its presence by absence! + // If (...) + // It needs to be examined on exactly the same attribute at the + // breaki point, which is quite expensive. + // Since optimazation is done when inserting the attributes + // this case does not appear so fast ... + // So based on the need for speed: rCurSet.InvalidateItem( pAttr->GetItem()->Which() ); } - // Attribut endet mitten drin... + // Attribute ends in the middle of it ... else if ( pAttr->GetEnd() > nStartPos ) { - // pItem = pAttr->GetItem(); - // s.o. - /*-----------------31.05.95 16:01------------------- - Ist falsch, wenn das gleiche Attribut sofort wieder - eingestellt wird! - => Sollte am besten nicht vorkommen, also gleich beim - Setzen von Attributen richtig machen! - --------------------------------------------------*/ rCurSet.InvalidateItem( pAttr->GetItem()->Which() ); } if ( pItem ) { - USHORT nWhich = pItem->Which(); + sal_uInt16 nWhich = pItem->Which(); if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF ) { rCurSet.Put( *pItem ); @@ -1973,21 +1943,17 @@ void EditDoc::FindAttribs( ContentNode* pNode, USHORT nStartPos, USHORT nEndPos, } -// ------------------------------------------------------------------------- -// class EditCharAttribList -// ------------------------------------------------------------------------- - CharAttribList::CharAttribList() { DBG_CTOR( EE_CharAttribList, 0 ); - bHasEmptyAttribs = FALSE; + bHasEmptyAttribs = sal_False; } CharAttribList::~CharAttribList() { DBG_DTOR( EE_CharAttribList, 0 ); - USHORT nAttr = 0; + sal_uInt16 nAttr = 0; EditCharAttrib* pAttr = GetAttrib( aAttribs, nAttr ); while ( pAttr ) { @@ -2001,30 +1967,28 @@ CharAttribList::~CharAttribList() void CharAttribList::InsertAttrib( EditCharAttrib* pAttrib ) { // !!!!!!!!!!!!!!!!!!!!!!!!!!!!! -// optimieren: binaere Suche ? ! +// optimize: binary search? ! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // MT: 26.11.98 - // Vielleicht aber auch einfach nur rueckwaerts iterieren: - // Der haeufigste und kritischste Fall: Attribute kommen bereits - // sortiert an (InsertBinTextObject!) - // Hier waere auch binaere Suche nicht optimal. - // => Wuerde einiges bringen! + // Maybe just simply iterate backwards: + // The most common and critical case: Attributes are already sorted + // (InsertBinTextObject!) binary search would not be optimal here. + // => Would bring something! - const USHORT nCount = Count(); - const USHORT nStart = pAttrib->GetStart(); // vielleicht besser fuer Comp.Opt. + const sal_uInt16 nCount = Count(); + const sal_uInt16 nStart = pAttrib->GetStart(); // may be better for Comp.Opt. if ( pAttrib->IsEmpty() ) - bHasEmptyAttribs = TRUE; + bHasEmptyAttribs = sal_True; - BOOL bInserted = FALSE; - for ( USHORT x = 0; x < nCount; x++ ) + sal_Bool bInserted = sal_False; + for ( sal_uInt16 x = 0; x < nCount; x++ ) { EditCharAttribPtr pCurAttrib = aAttribs[x]; if ( pCurAttrib->GetStart() > nStart ) { aAttribs.Insert( pAttrib, x ); - bInserted = TRUE; + bInserted = sal_True; break; } } @@ -2048,10 +2012,10 @@ void CharAttribList::ResortAttribs() void CharAttribList::OptimizeRanges( SfxItemPool& rItemPool ) { - for ( USHORT n = 0; n < aAttribs.Count(); n++ ) + for ( sal_uInt16 n = 0; n < aAttribs.Count(); n++ ) { EditCharAttrib* pAttr = aAttribs.GetObject( n ); - for ( USHORT nNext = n+1; nNext < aAttribs.Count(); nNext++ ) + for ( sal_uInt16 nNext = n+1; nNext < aAttribs.Count(); nNext++ ) { EditCharAttrib* p = aAttribs.GetObject( nNext ); if ( !pAttr->IsFeature() && ( p->GetStart() == pAttr->GetEnd() ) && ( p->Which() == pAttr->Which() ) ) @@ -2073,11 +2037,11 @@ void CharAttribList::OptimizeRanges( SfxItemPool& rItemPool ) } } -EditCharAttrib* CharAttribList::FindAttrib( USHORT nWhich, USHORT nPos ) +EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) { - // Rueckwaerts, falls eins dort endet, das naechste startet. - // => Das startende gilt... - USHORT nAttr = aAttribs.Count()-1; + // Backwards, if one ends where the next starts. + // => The starting one is the valid one ... + sal_uInt16 nAttr = aAttribs.Count()-1; EditCharAttrib* pAttr = GetAttrib( aAttribs, nAttr ); while ( pAttr ) { @@ -2088,11 +2052,11 @@ EditCharAttrib* CharAttribList::FindAttrib( USHORT nWhich, USHORT nPos ) return 0; } -EditCharAttrib* CharAttribList::FindNextAttrib( USHORT nWhich, USHORT nFromPos ) const +EditCharAttrib* CharAttribList::FindNextAttrib( sal_uInt16 nWhich, sal_uInt16 nFromPos ) const { DBG_ASSERT( nWhich, "FindNextAttrib: Which?" ); - const USHORT nAttribs = aAttribs.Count(); - for ( USHORT nAttr = 0; nAttr < nAttribs; nAttr++ ) + const sal_uInt16 nAttribs = aAttribs.Count(); + for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ ) { EditCharAttrib* pAttr = aAttribs[ nAttr ]; if ( ( pAttr->GetStart() >= nFromPos ) && ( pAttr->Which() == nWhich ) ) @@ -2101,50 +2065,50 @@ EditCharAttrib* CharAttribList::FindNextAttrib( USHORT nWhich, USHORT nFromPos ) return 0; } -BOOL CharAttribList::HasAttrib( USHORT nWhich ) const +sal_Bool CharAttribList::HasAttrib( sal_uInt16 nWhich ) const { - for ( USHORT nAttr = aAttribs.Count(); nAttr; ) + for ( sal_uInt16 nAttr = aAttribs.Count(); nAttr; ) { const EditCharAttrib* pAttr = aAttribs[--nAttr]; if ( pAttr->Which() == nWhich ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -BOOL CharAttribList::HasAttrib( USHORT nStartPos, USHORT nEndPos ) const +sal_Bool CharAttribList::HasAttrib( sal_uInt16 nStartPos, sal_uInt16 nEndPos ) const { - BOOL bAttr = FALSE; - for ( USHORT nAttr = aAttribs.Count(); nAttr && !bAttr; ) + sal_Bool bAttr = sal_False; + for ( sal_uInt16 nAttr = aAttribs.Count(); nAttr && !bAttr; ) { const EditCharAttrib* pAttr = aAttribs[--nAttr]; if ( ( pAttr->GetStart() < nEndPos ) && ( pAttr->GetEnd() > nStartPos ) ) - return bAttr = TRUE; + return bAttr = sal_True; } return bAttr; } -BOOL CharAttribList::HasBoundingAttrib( USHORT nBound ) +sal_Bool CharAttribList::HasBoundingAttrib( sal_uInt16 nBound ) { - // Rueckwaerts, falls eins dort endet, das naechste startet. - // => Das startende gilt... - USHORT nAttr = aAttribs.Count()-1; + // Backwards, if one ends where the next starts. + // => The starting one is the valid one ... + sal_uInt16 nAttr = aAttribs.Count()-1; EditCharAttrib* pAttr = GetAttrib( aAttribs, nAttr ); while ( pAttr && ( pAttr->GetEnd() >= nBound ) ) { if ( ( pAttr->GetStart() == nBound ) || ( pAttr->GetEnd() == nBound ) ) - return TRUE; + return sal_True; pAttr = GetAttrib( aAttribs, --nAttr ); } - return FALSE; + return sal_False; } -EditCharAttrib* CharAttribList::FindEmptyAttrib( USHORT nWhich, USHORT nPos ) +EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) { if ( !bHasEmptyAttribs ) return 0; - USHORT nAttr = 0; + sal_uInt16 nAttr = 0; EditCharAttrib* pAttr = GetAttrib( aAttribs, nAttr ); while ( pAttr && ( pAttr->GetStart() <= nPos ) ) { @@ -2156,20 +2120,20 @@ EditCharAttrib* CharAttribList::FindEmptyAttrib( USHORT nWhich, USHORT nPos ) return 0; } -EditCharAttrib* CharAttribList::FindFeature( USHORT nPos ) const +EditCharAttrib* CharAttribList::FindFeature( sal_uInt16 nPos ) const { - USHORT nAttr = 0; + sal_uInt16 nAttr = 0; EditCharAttrib* pNextAttrib = GetAttrib( aAttribs, nAttr ); - // erstmal zur gewuenschten Position... + // first to the desired position ... while ( pNextAttrib && ( pNextAttrib->GetStart() < nPos ) ) { nAttr++; pNextAttrib = GetAttrib( aAttribs, nAttr ); } - // jetzt das Feature suchen... + // Now search for the Feature... while ( pNextAttrib && !pNextAttrib->IsFeature() ) { nAttr++; @@ -2182,7 +2146,7 @@ EditCharAttrib* CharAttribList::FindFeature( USHORT nPos ) const void CharAttribList::DeleteEmptyAttribs( SfxItemPool& rItemPool ) { - for ( USHORT nAttr = 0; nAttr < aAttribs.Count(); nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < aAttribs.Count(); nAttr++ ) { EditCharAttrib* pAttr = aAttribs[nAttr]; if ( pAttr->IsEmpty() ) @@ -2193,30 +2157,30 @@ void CharAttribList::DeleteEmptyAttribs( SfxItemPool& rItemPool ) nAttr--; } } - bHasEmptyAttribs = FALSE; + bHasEmptyAttribs = sal_False; } -BOOL CharAttribList::DbgCheckAttribs() +sal_Bool CharAttribList::DbgCheckAttribs() { #ifdef DBG_UTIL - BOOL bOK = TRUE; - for ( USHORT nAttr = 0; nAttr < aAttribs.Count(); nAttr++ ) + sal_Bool bOK = sal_True; + for ( sal_uInt16 nAttr = 0; nAttr < aAttribs.Count(); nAttr++ ) { EditCharAttrib* pAttr = aAttribs[nAttr]; if ( pAttr->GetStart() > pAttr->GetEnd() ) { - bOK = FALSE; - DBG_ERROR( "Attr verdreht" ); + bOK = sal_False; + OSL_FAIL( "Attribute is distorted" ); } else if ( pAttr->IsFeature() && ( pAttr->GetLen() != 1 ) ) { - bOK = FALSE; - DBG_ERROR( "Feature, Len != 1" ); + bOK = sal_False; + OSL_FAIL( "Feature, Len != 1" ); } } return bOK; #else - return TRUE; + return sal_True; #endif } @@ -2236,7 +2200,7 @@ SvxFontTable::~SvxFontTable() } } -ULONG SvxFontTable::GetId( const SvxFontItem& rFontItem ) +sal_uLong SvxFontTable::GetId( const SvxFontItem& rFontItem ) { SvxFontItem* pItem = First(); while ( pItem ) @@ -2245,7 +2209,7 @@ ULONG SvxFontTable::GetId( const SvxFontItem& rFontItem ) return GetCurKey(); pItem = Next(); } - DBG_WARNING( "Font nicht gefunden: GetId()" ); + DBG_WARNING( "Font not found: GetId()" ); return 0; } @@ -2255,28 +2219,40 @@ SvxColorList::SvxColorList() SvxColorList::~SvxColorList() { - SvxColorItem* pItem = First(); - while( pItem ) - { - delete pItem; - pItem = Next(); - } + for ( size_t i = 0, n = aColorList.size(); i < n; ++i ) + delete aColorList[ i ]; + aColorList.clear(); } -ULONG SvxColorList::GetId( const SvxColorItem& rColorItem ) +size_t SvxColorList::GetId( const SvxColorItem& rColorItem ) { - SvxColorItem* pItem = First(); - while ( pItem ) + for ( size_t i = 0, n = aColorList.size(); i < n; ++i ) + if ( *aColorList[ i ] == rColorItem ) + return i; + DBG_WARNING( "Color not found: GetId()" ); + return 0; +} + +void SvxColorList::Insert( SvxColorItem* pItem, size_t nIndex ) +{ + if ( nIndex >= aColorList.size() ) { - if ( *pItem == rColorItem ) - return GetCurPos(); - pItem = Next(); + aColorList.push_back( pItem ); } - DBG_WARNING( "Color nicht gefunden: GetId()" ); - return 0; + else + { + DummyColorList::iterator it = aColorList.begin(); + ::std::advance( it, nIndex ); + aColorList.insert( it, pItem ); + } +} + +SvxColorItem* SvxColorList::GetObject( size_t nIndex ) +{ + return ( nIndex >= aColorList.size() ) ? NULL : aColorList[ nIndex ]; } -EditEngineItemPool::EditEngineItemPool( BOOL bPersistenRefCounts ) +EditEngineItemPool::EditEngineItemPool( sal_Bool bPersistenRefCounts ) : SfxItemPool( String( "EditEngineItemPool", RTL_TEXTENCODING_ASCII_US ), EE_ITEMS_START, EE_ITEMS_END, aItemInfos, 0, bPersistenRefCounts ) { @@ -2297,15 +2273,15 @@ EditEngineItemPool::~EditEngineItemPool() SvStream& EditEngineItemPool::Store( SvStream& rStream ) const { - // Bei einem 3.1-Export muess ein Hack eingebaut werden, da BUG im - // SfxItemSet::Load, aber nicht nachtraeglich in 3.1 fixbar. + // for a 3.1 export a hack has to be installed, as in there is a BUG in + // SfxItemSet::Load, but not subsequently after 3.1. - // Der eingestellte Range muss nach Store erhalten bleiben, weil dann - // erst die ItemSets gespeichert werden... + // The selected range must be kept after Store, because itemsets are not + // stored until then... long nVersion = rStream.GetVersion(); - BOOL b31Format = ( nVersion && ( nVersion <= SOFFICE_FILEFORMAT_31 ) ) - ? TRUE : FALSE; + sal_Bool b31Format = ( nVersion && ( nVersion <= SOFFICE_FILEFORMAT_31 ) ) + ? sal_True : sal_False; EditEngineItemPool* pThis = (EditEngineItemPool*)this; if ( b31Format ) diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 188992bebe..f560b0aae7 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -38,6 +38,9 @@ #include <svl/style.hxx> #include <svl/itempool.hxx> #include <tools/table.hxx> +#include <vector> + +#include <deque> class ImpEditEngine; class SvxTabStop; @@ -49,45 +52,45 @@ DBG_NAMEEX( EE_TextPortion ) #define DEFTAB 720 void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent = true, short nScriptType = 0 ); -USHORT GetScriptItemId( USHORT nItemId, short nScriptType ); -BOOL IsScriptItemValid( USHORT nItemId, short nScriptType ); +sal_uInt16 GetScriptItemId( sal_uInt16 nItemId, short nScriptType ); +sal_Bool IsScriptItemValid( sal_uInt16 nItemId, short nScriptType ); -EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, USHORT nS, USHORT nE ); +EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE ); class ContentNode; class EditDoc; struct EPaM { - USHORT nPara; - USHORT nIndex; + sal_uInt16 nPara; + sal_uInt16 nIndex; EPaM() { nPara = 0; nIndex = 0; } - EPaM( USHORT nP, USHORT nI ) { nPara = nP; nIndex = nI; } + EPaM( sal_uInt16 nP, sal_uInt16 nI ) { nPara = nP; nIndex = nI; } EPaM( const EPaM& r) { nPara = r.nPara; nIndex = r.nIndex; } EPaM& operator = ( const EPaM& r ) { nPara = r.nPara; nIndex = r.nIndex; return *this; } - inline BOOL operator == ( const EPaM& r ) const; - inline BOOL operator < ( const EPaM& r ) const; + inline sal_Bool operator == ( const EPaM& r ) const; + inline sal_Bool operator < ( const EPaM& r ) const; }; -inline BOOL EPaM::operator < ( const EPaM& r ) const +inline sal_Bool EPaM::operator < ( const EPaM& r ) const { return ( ( nPara < r.nPara ) || - ( ( nPara == r.nPara ) && nIndex < r.nIndex ) ) ? TRUE : FALSE; + ( ( nPara == r.nPara ) && nIndex < r.nIndex ) ) ? sal_True : sal_False; } -inline BOOL EPaM::operator == ( const EPaM& r ) const +inline sal_Bool EPaM::operator == ( const EPaM& r ) const { - return ( ( nPara == r.nPara ) && ( nIndex == r.nIndex ) ) ? TRUE : FALSE; + return ( ( nPara == r.nPara ) && ( nIndex == r.nIndex ) ) ? sal_True : sal_False; } struct ScriptTypePosInfo { short nScriptType; - USHORT nStartPos; - USHORT nEndPos; + sal_uInt16 nStartPos; + sal_uInt16 nEndPos; - ScriptTypePosInfo( short _Type, USHORT _Start, USHORT _End ) + ScriptTypePosInfo( short _Type, sal_uInt16 _Start, sal_uInt16 _End ) { nScriptType = _Type; nStartPos = _Start; @@ -95,15 +98,15 @@ struct ScriptTypePosInfo } }; -SV_DECL_VARARR( ScriptTypePosInfos, ScriptTypePosInfo, 0, 4 ) +typedef std::deque< ScriptTypePosInfo > ScriptTypePosInfos; struct WritingDirectionInfo { - BYTE nType; - USHORT nStartPos; - USHORT nEndPos; + sal_uInt8 nType; + sal_uInt16 nStartPos; + sal_uInt16 nEndPos; - WritingDirectionInfo( BYTE _Type, USHORT _Start, USHORT _End ) + WritingDirectionInfo( sal_uInt8 _Type, sal_uInt16 _Start, sal_uInt16 _End ) { nType = _Type; nStartPos = _Start; @@ -111,7 +114,8 @@ struct WritingDirectionInfo } }; -SV_DECL_VARARR( WritingDirectionInfos, WritingDirectionInfo, 0, 4 ) + +typedef std::deque< WritingDirectionInfo > WritingDirectionInfos; typedef EditCharAttrib* EditCharAttribPtr; SV_DECL_PTRARR( CharAttribArray, EditCharAttribPtr, 0, 4 ) @@ -138,38 +142,57 @@ SV_DECL_PTRARR( ContentInfoArray, ContentAttribsInfoPtr, 1, 1 ) // class SvxFontTable // ---------------------------------------------------------------------- DECLARE_TABLE( DummyFontTable, SvxFontItem* ) + class SvxFontTable : public DummyFontTable { public: SvxFontTable(); ~SvxFontTable(); - ULONG GetId( const SvxFontItem& rFont ); + sal_uLong GetId( const SvxFontItem& rFont ); }; // ---------------------------------------------------------------------- // class SvxColorList // ---------------------------------------------------------------------- typedef ContentNode* ContentNodePtr; -DECLARE_LIST( DummyColorList, SvxColorItem* ) -class SvxColorList : public DummyColorList +typedef ::std::vector< SvxColorItem* > DummyColorList; + +class SvxColorList { +private: + DummyColorList aColorList; + public: SvxColorList(); ~SvxColorList(); - ULONG GetId( const SvxColorItem& rColor ); + size_t GetId( const SvxColorItem& rColor ); + size_t Count() { return aColorList.size(); }; + void Insert( SvxColorItem* pItem, size_t nIndex ); + SvxColorItem* GetObject( size_t nIndex ); }; // ---------------------------------------------------------------------- // class ItemList // ---------------------------------------------------------------------- typedef const SfxPoolItem* ConstPoolItemPtr; -DECLARE_LIST( DummyItemList, ConstPoolItemPtr ) -class ItemList : public DummyItemList +typedef ::std::vector< ConstPoolItemPtr > DummyItemList; + +class ItemList { +private: + DummyItemList aItemPool; + size_t CurrentItem; + public: - const SfxPoolItem* FindAttrib( USHORT nWhich ); + ItemList(); + const SfxPoolItem* FindAttrib( sal_uInt16 nWhich ); + const SfxPoolItem* First(); + const SfxPoolItem* Next(); + size_t Count() { return aItemPool.size(); }; + void Insert( const SfxPoolItem* pItem ); + void Clear() { aItemPool.clear(); }; }; // ------------------------------------------------------------------------- @@ -184,15 +207,15 @@ private: public: ContentAttribs( SfxItemPool& rItemPool ); ContentAttribs( const ContentAttribs& ); - ~ContentAttribs(); // erst bei umfangreicheren Tabs + ~ContentAttribs(); // only for larger Tabs - SvxTabStop FindTabStop( long nCurPos, USHORT nDefTab ); + SvxTabStop FindTabStop( long nCurPos, sal_uInt16 nDefTab ); SfxItemSet& GetItems() { return aAttribSet; } SfxStyleSheet* GetStyleSheet() const { return pStyle; } void SetStyleSheet( SfxStyleSheet* pS ); - const SfxPoolItem& GetItem( USHORT nWhich ); - BOOL HasItem( USHORT nWhich ); + const SfxPoolItem& GetItem( sal_uInt16 nWhich ); + sal_Bool HasItem( sal_uInt16 nWhich ); }; // ------------------------------------------------------------------------- @@ -202,8 +225,8 @@ class CharAttribList { private: CharAttribArray aAttribs; - SvxFont aDefFont; // schneller, als jedesmal vom Pool! - BOOL bHasEmptyAttribs; + SvxFont aDefFont; // faster than ever from the pool! + sal_Bool bHasEmptyAttribs; CharAttribList( const CharAttribList& ) {;} @@ -214,32 +237,32 @@ public: void DeleteEmptyAttribs( SfxItemPool& rItemPool ); void RemoveItemsFromPool( SfxItemPool* pItemPool ); - EditCharAttrib* FindAttrib( USHORT nWhich, USHORT nPos ); - EditCharAttrib* FindNextAttrib( USHORT nWhich, USHORT nFromPos ) const; - EditCharAttrib* FindEmptyAttrib( USHORT nWhich, USHORT nPos ); - EditCharAttrib* FindFeature( USHORT nPos ) const; + EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ); + EditCharAttrib* FindNextAttrib( sal_uInt16 nWhich, sal_uInt16 nFromPos ) const; + EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ); + EditCharAttrib* FindFeature( sal_uInt16 nPos ) const; void ResortAttribs(); void OptimizeRanges( SfxItemPool& rItemPool ); - USHORT Count() { return aAttribs.Count(); } + sal_uInt16 Count() { return aAttribs.Count(); } void Clear() { aAttribs.Remove( 0, aAttribs.Count()); } void InsertAttrib( EditCharAttrib* pAttrib ); SvxFont& GetDefFont() { return aDefFont; } - BOOL HasEmptyAttribs() const { return bHasEmptyAttribs; } - BOOL& HasEmptyAttribs() { return bHasEmptyAttribs; } - BOOL HasBoundingAttrib( USHORT nBound ); - BOOL HasAttrib( USHORT nWhich ) const; - BOOL HasAttrib( USHORT nStartPos, USHORT nEndPos ) const; + sal_Bool HasEmptyAttribs() const { return bHasEmptyAttribs; } + sal_Bool& HasEmptyAttribs() { return bHasEmptyAttribs; } + sal_Bool HasBoundingAttrib( sal_uInt16 nBound ); + sal_Bool HasAttrib( sal_uInt16 nWhich ) const; + sal_Bool HasAttrib( sal_uInt16 nStartPos, sal_uInt16 nEndPos ) const; CharAttribArray& GetAttribs() { return aAttribs; } const CharAttribArray& GetAttribs() const { return aAttribs; } // Debug: - BOOL DbgCheckAttribs(); + sal_Bool DbgCheckAttribs(); }; // ------------------------------------------------------------------------- @@ -260,12 +283,12 @@ public: ContentAttribs& GetContentAttribs() { return aContentAttribs; } CharAttribList& GetCharAttribs() { return aCharAttribList; } - void ExpandAttribs( USHORT nIndex, USHORT nNewChars, SfxItemPool& rItemPool ); - void CollapsAttribs( USHORT nIndex, USHORT nDelChars, SfxItemPool& rItemPool ); + void ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNewChars, SfxItemPool& rItemPool ); + void CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDelChars, SfxItemPool& rItemPool ); void AppendAttribs( ContentNode* pNextNode ); - void CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, BOOL bKeepEndingAttribs ); + void CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, sal_Bool bKeepEndingAttribs ); - void SetStyleSheet( SfxStyleSheet* pS, BOOL bRecalcFont = TRUE ); + void SetStyleSheet( SfxStyleSheet* pS, sal_Bool bRecalcFont = sal_True ); void SetStyleSheet( SfxStyleSheet* pS, const SvxFont& rFontFromStyle ); SfxStyleSheet* GetStyleSheet() { return aContentAttribs.GetStyleSheet(); } @@ -277,7 +300,7 @@ public: void CreateWrongList(); void DestroyWrongList(); - BOOL IsFeature( USHORT nPos ) const { return ( GetChar( nPos ) == CH_FEATURE ); } + sal_Bool IsFeature( sal_uInt16 nPos ) const { return ( GetChar( nPos ) == CH_FEATURE ); } }; typedef ContentNode* ContentNodePtr; @@ -285,10 +308,10 @@ SV_DECL_PTRARR( DummyContentList, ContentNodePtr, 0, 4 ) class ContentList : public DummyContentList { - USHORT nLastCache; + sal_uInt16 nLastCache; public: ContentList() : DummyContentList( 0, 4 ), nLastCache(0) {} - USHORT GetPos( const ContentNodePtr &rPtr ) const; + sal_uInt16 GetPos( const ContentNodePtr &rPtr ) const; }; // ------------------------------------------------------------------------- @@ -298,27 +321,27 @@ class EditPaM { private: ContentNode* pNode; - USHORT nIndex; + sal_uInt16 nIndex; public: EditPaM() { pNode = NULL; nIndex = 0; } - EditPaM( ContentNode* p, USHORT n ) { pNode = p; nIndex = n; } + EditPaM( ContentNode* p, sal_uInt16 n ) { pNode = p; nIndex = n; } ContentNode* GetNode() const { return pNode; } void SetNode( ContentNode* p) { pNode = p; } - USHORT GetIndex() const { return nIndex; } - USHORT& GetIndex() { return nIndex; } - void SetIndex( USHORT n ) { nIndex = n; } + sal_uInt16 GetIndex() const { return nIndex; } + sal_uInt16& GetIndex() { return nIndex; } + void SetIndex( sal_uInt16 n ) { nIndex = n; } - BOOL IsParaStart() const { return nIndex == 0; } - BOOL IsParaEnd() const { return nIndex == pNode->Len(); } + sal_Bool IsParaStart() const { return nIndex == 0; } + sal_Bool IsParaEnd() const { return nIndex == pNode->Len(); } - BOOL DbgIsBuggy( EditDoc& rDoc ); + sal_Bool DbgIsBuggy( EditDoc& rDoc ); EditPaM& operator = ( const EditPaM& rPaM ); - friend BOOL operator == ( const EditPaM& r1, const EditPaM& r2 ); - friend BOOL operator != ( const EditPaM& r1, const EditPaM& r2 ); + friend sal_Bool operator == ( const EditPaM& r1, const EditPaM& r2 ); + friend sal_Bool operator != ( const EditPaM& r1, const EditPaM& r2 ); }; #define PORTIONKIND_TEXT 0 @@ -326,7 +349,6 @@ public: #define PORTIONKIND_LINEBREAK 2 #define PORTIONKIND_FIELD 3 #define PORTIONKIND_HYPHENATOR 4 -// #define PORTIONKIND_EXTRASPACE 5 #define DELMODE_SIMPLE 0 #define DELMODE_RESTOFWORD 1 @@ -347,11 +369,11 @@ struct ExtraPortionInfo long nPortionOffsetX; - USHORT nMaxCompression100thPercent; + sal_uInt16 nMaxCompression100thPercent; - BYTE nAsianCompressionTypes; - BOOL bFirstCharIsRightPunktuation; - BOOL bCompressed; + sal_uInt8 nAsianCompressionTypes; + sal_Bool bFirstCharIsRightPunktuation; + sal_Bool bCompressed; sal_Int32* pOrgDXArray; @@ -359,7 +381,7 @@ struct ExtraPortionInfo ExtraPortionInfo(); ~ExtraPortionInfo(); - void SaveOrgDXArray( const sal_Int32* pDXArray, USHORT nLen ); + void SaveOrgDXArray( const sal_Int32* pDXArray, sal_uInt16 nLen ); void DestroyOrgDXArray(); }; @@ -371,44 +393,44 @@ class TextPortion { private: ExtraPortionInfo* pExtraInfos; - USHORT nLen; + sal_uInt16 nLen; Size aOutSz; - BYTE nKind; - BYTE nRightToLeft; + sal_uInt8 nKind; + sal_uInt8 nRightToLeft; sal_Unicode nExtraValue; TextPortion() { DBG_CTOR( EE_TextPortion, 0 ); - pExtraInfos = NULL; nLen = 0; nKind = PORTIONKIND_TEXT; nExtraValue = 0; nRightToLeft = FALSE;} + pExtraInfos = NULL; nLen = 0; nKind = PORTIONKIND_TEXT; nExtraValue = 0; nRightToLeft = sal_False;} public: - TextPortion( USHORT nL ) : aOutSz( -1, -1 ) + TextPortion( sal_uInt16 nL ) : aOutSz( -1, -1 ) { DBG_CTOR( EE_TextPortion, 0 ); - pExtraInfos = NULL; nLen = nL; nKind = PORTIONKIND_TEXT; nExtraValue = 0; nRightToLeft = FALSE;} + pExtraInfos = NULL; nLen = nL; nKind = PORTIONKIND_TEXT; nExtraValue = 0; nRightToLeft = sal_False;} TextPortion( const TextPortion& r ) : aOutSz( r.aOutSz ) { DBG_CTOR( EE_TextPortion, 0 ); pExtraInfos = NULL; nLen = r.nLen; nKind = r.nKind; nExtraValue = r.nExtraValue; nRightToLeft = r.nRightToLeft; } ~TextPortion() { DBG_DTOR( EE_TextPortion, 0 ); delete pExtraInfos; } - USHORT GetLen() const { return nLen; } - USHORT& GetLen() { return nLen; } - void SetLen( USHORT nL ) { nLen = nL; } + sal_uInt16 GetLen() const { return nLen; } + sal_uInt16& GetLen() { return nLen; } + void SetLen( sal_uInt16 nL ) { nLen = nL; } Size& GetSize() { return aOutSz; } Size GetSize() const { return aOutSz; } - BYTE& GetKind() { return nKind; } - BYTE GetKind() const { return nKind; } + sal_uInt8& GetKind() { return nKind; } + sal_uInt8 GetKind() const { return nKind; } - void SetRightToLeft( BYTE b ) { nRightToLeft = b; } - BYTE GetRightToLeft() const { return nRightToLeft; } - BOOL IsRightToLeft() const { return (nRightToLeft&1); } + void SetRightToLeft( sal_uInt8 b ) { nRightToLeft = b; } + sal_uInt8 GetRightToLeft() const { return nRightToLeft; } + sal_Bool IsRightToLeft() const { return (nRightToLeft&1); } sal_Unicode GetExtraValue() const { return nExtraValue; } void SetExtraValue( sal_Unicode n ) { nExtraValue = n; } - BOOL HasValidSize() const { return aOutSz.Width() != (-1); } + sal_Bool HasValidSize() const { return aOutSz.Width() != (-1); } ExtraPortionInfo* GetExtraInfos() const { return pExtraInfos; } void SetExtraInfos( ExtraPortionInfo* p ) { delete pExtraInfos; pExtraInfos = p; } @@ -427,9 +449,9 @@ public: ~TextPortionList(); void Reset(); - USHORT FindPortion( USHORT nCharPos, USHORT& rPortionStart, BOOL bPreferStartingPortion = FALSE ); - USHORT GetStartPos( USHORT nPortion ); - void DeleteFromPortion( USHORT nDelFrom ); + sal_uInt16 FindPortion( sal_uInt16 nCharPos, sal_uInt16& rPortionStart, sal_Bool bPreferStartingPortion = sal_False ); + sal_uInt16 GetStartPos( sal_uInt16 nPortion ); + void DeleteFromPortion( sal_uInt16 nDelFrom ); }; class ParaPortion; @@ -444,84 +466,84 @@ class EditLine private: CharPosArray aPositions; long nTxtWidth; - USHORT nStartPosX; - USHORT nStart; // koennte durch nStartPortion ersetzt werden - USHORT nEnd; // koennte durch nEndPortion ersetzt werden - USHORT nStartPortion; - USHORT nEndPortion; - USHORT nHeight; // Gesamthoehe der Zeile - USHORT nTxtHeight; // Reine Texthoehe - USHORT nCrsrHeight; // Bei Konturfluss hohe Zeilen => Cursor zu groá. - USHORT nMaxAscent; - BOOL bHangingPunctuation; - BOOL bInvalid; // fuer geschickte Formatierung + sal_uInt16 nStartPosX; + sal_uInt16 nStart; // could be replaced by nStartPortion + sal_uInt16 nEnd; // could be replaced by nEndPortion + sal_uInt16 nStartPortion; + sal_uInt16 nEndPortion; + sal_uInt16 nHeight; // Total height of the line + sal_uInt16 nTxtHeight; // Pure Text height + sal_uInt16 nCrsrHeight; // For contour flow high lines => cursor is large. + sal_uInt16 nMaxAscent; + sal_Bool bHangingPunctuation; + sal_Bool bInvalid; // for skillful formatting public: EditLine(); EditLine( const EditLine& ); ~EditLine(); - BOOL IsIn( USHORT nIndex ) const + sal_Bool IsIn( sal_uInt16 nIndex ) const { return ( (nIndex >= nStart ) && ( nIndex < nEnd ) ); } - BOOL IsIn( USHORT nIndex, BOOL bInclEnd ) const + sal_Bool IsIn( sal_uInt16 nIndex, sal_Bool bInclEnd ) const { return ( ( nIndex >= nStart ) && ( bInclEnd ? ( nIndex <= nEnd ) : ( nIndex < nEnd ) ) ); } - void SetStart( USHORT n ) { nStart = n; } - USHORT GetStart() const { return nStart; } - USHORT& GetStart() { return nStart; } + void SetStart( sal_uInt16 n ) { nStart = n; } + sal_uInt16 GetStart() const { return nStart; } + sal_uInt16& GetStart() { return nStart; } - void SetEnd( USHORT n ) { nEnd = n; } - USHORT GetEnd() const { return nEnd; } - USHORT& GetEnd() { return nEnd; } + void SetEnd( sal_uInt16 n ) { nEnd = n; } + sal_uInt16 GetEnd() const { return nEnd; } + sal_uInt16& GetEnd() { return nEnd; } - void SetStartPortion( USHORT n ) { nStartPortion = n; } - USHORT GetStartPortion() const { return nStartPortion; } - USHORT& GetStartPortion() { return nStartPortion; } + void SetStartPortion( sal_uInt16 n ) { nStartPortion = n; } + sal_uInt16 GetStartPortion() const { return nStartPortion; } + sal_uInt16& GetStartPortion() { return nStartPortion; } - void SetEndPortion( USHORT n ) { nEndPortion = n; } - USHORT GetEndPortion() const { return nEndPortion; } - USHORT& GetEndPortion() { return nEndPortion; } + void SetEndPortion( sal_uInt16 n ) { nEndPortion = n; } + sal_uInt16 GetEndPortion() const { return nEndPortion; } + sal_uInt16& GetEndPortion() { return nEndPortion; } - void SetHeight( USHORT nH, USHORT nTxtH = 0, USHORT nCrsrH = 0 ) + void SetHeight( sal_uInt16 nH, sal_uInt16 nTxtH = 0, sal_uInt16 nCrsrH = 0 ) { nHeight = nH; nTxtHeight = ( nTxtH ? nTxtH : nH ); nCrsrHeight = ( nCrsrH ? nCrsrH : nTxtHeight ); } - USHORT GetHeight() const { return nHeight; } - USHORT GetTxtHeight() const { return nTxtHeight; } - USHORT GetCrsrHeight() const { return nCrsrHeight; } + sal_uInt16 GetHeight() const { return nHeight; } + sal_uInt16 GetTxtHeight() const { return nTxtHeight; } + sal_uInt16 GetCrsrHeight() const { return nCrsrHeight; } void SetTextWidth( long n ) { nTxtWidth = n; } long GetTextWidth() const { return nTxtWidth; } - void SetMaxAscent( USHORT n ) { nMaxAscent = n; } - USHORT GetMaxAscent() const { return nMaxAscent; } + void SetMaxAscent( sal_uInt16 n ) { nMaxAscent = n; } + sal_uInt16 GetMaxAscent() const { return nMaxAscent; } - void SetHangingPunctuation( BOOL b ) { bHangingPunctuation = b; } - BOOL IsHangingPunctuation() const { return bHangingPunctuation; } + void SetHangingPunctuation( sal_Bool b ) { bHangingPunctuation = b; } + sal_Bool IsHangingPunctuation() const { return bHangingPunctuation; } - USHORT GetLen() const { return nEnd - nStart; } + sal_uInt16 GetLen() const { return nEnd - nStart; } - USHORT GetStartPosX() const { return nStartPosX; } - void SetStartPosX( USHORT start ) { nStartPosX = start; } + sal_uInt16 GetStartPosX() const { return nStartPosX; } + void SetStartPosX( sal_uInt16 start ) { nStartPosX = start; } Size CalcTextSize( ParaPortion& rParaPortion ); - BOOL IsInvalid() const { return bInvalid; } - BOOL IsValid() const { return !bInvalid; } - void SetInvalid() { bInvalid = TRUE; } - void SetValid() { bInvalid = FALSE; } + sal_Bool IsInvalid() const { return bInvalid; } + sal_Bool IsValid() const { return !bInvalid; } + void SetInvalid() { bInvalid = sal_True; } + void SetValid() { bInvalid = sal_False; } - BOOL IsEmpty() const { return (nEnd > nStart) ? FALSE : TRUE; } + sal_Bool IsEmpty() const { return (nEnd > nStart) ? sal_False : sal_True; } CharPosArray& GetCharPosArray() { return aPositions; } EditLine* Clone() const; EditLine& operator = ( const EditLine& rLine ); - friend BOOL operator == ( const EditLine& r1, const EditLine& r2 ); - friend BOOL operator != ( const EditLine& r1, const EditLine& r2 ); + friend sal_Bool operator == ( const EditLine& r1, const EditLine& r2 ); + friend sal_Bool operator != ( const EditLine& r1, const EditLine& r2 ); }; @@ -538,8 +560,8 @@ public: ~EditLineList(); void Reset(); - void DeleteFromLine( USHORT nDelFrom ); - USHORT FindLine( USHORT nChar, BOOL bInclEnd ); + void DeleteFromLine( sal_uInt16 nDelFrom ); + sal_uInt16 FindLine( sal_uInt16 nChar, sal_Bool bInclEnd ); }; // ------------------------------------------------------------------------- @@ -547,7 +569,7 @@ public: // ------------------------------------------------------------------------- class ParaPortion { - friend class ImpEditEngine; // zum Einstellen der Hoehe + friend class ImpEditEngine; // to adjust the height private: EditLineList aLineList; TextPortionList aTextPortionList; @@ -557,15 +579,15 @@ private: ScriptTypePosInfos aScriptInfos; WritingDirectionInfos aWritingDirectionInfos; - USHORT nInvalidPosStart; - USHORT nFirstLineOffset; // Fuer Writer-LineSpacing-Interpretation - USHORT nBulletX; - short nInvalidDiff; + sal_uInt16 nInvalidPosStart; + sal_uInt16 nFirstLineOffset; // For Writer-LineSpacing-Interpretation + sal_uInt16 nBulletX; + short nInvalidDiff; - BOOL bInvalid : 1; - BOOL bSimple : 1; // nur lineares Tippen - BOOL bVisible : 1; // MT 05/00: Gehoert an den Node!!! - BOOL bForceRepaint : 1; + sal_Bool bInvalid : 1; + sal_Bool bSimple : 1; // only linear Tap + sal_Bool bVisible : 1; // Belongs to the node! + sal_Bool bForceRepaint : 1; ParaPortion( const ParaPortion& ); @@ -573,39 +595,41 @@ public: ParaPortion( ContentNode* pNode ); ~ParaPortion(); - USHORT GetLineNumber( USHORT nIndex ); + sal_uInt16 GetLineNumber( sal_uInt16 nIndex ); EditLineList& GetLines() { return aLineList; } - BOOL IsInvalid() const { return bInvalid; } - BOOL IsSimpleInvalid() const { return bSimple; } - void SetValid() { bInvalid = FALSE; bSimple = TRUE;} + sal_Bool IsInvalid() const { return bInvalid; } + sal_Bool IsSimpleInvalid() const { return bSimple; } + void SetValid() { bInvalid = sal_False; bSimple = sal_True;} + + sal_Bool MustRepaint() const { return bForceRepaint; } + void SetMustRepaint( sal_Bool bRP ) { bForceRepaint = bRP; } - BOOL MustRepaint() const { return bForceRepaint; } - void SetMustRepaint( BOOL bRP ) { bForceRepaint = bRP; } + sal_uInt16 GetBulletX() const { return nBulletX; } + void SetBulletX( sal_uInt16 n ) { nBulletX = n; } - USHORT GetBulletX() const { return nBulletX; } - void SetBulletX( USHORT n ) { nBulletX = n; } + void MarkInvalid( sal_uInt16 nStart, short nDiff); + void MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 nEnd ); - void MarkInvalid( USHORT nStart, short nDiff); - void MarkSelectionInvalid( USHORT nStart, USHORT nEnd ); + void SetVisible( sal_Bool bVisible ); + sal_Bool IsVisible() { return bVisible; } - void SetVisible( BOOL bVisible ); - BOOL IsVisible() { return bVisible; } + sal_Bool IsEmpty() { return GetTextPortions().Count() == 1 && GetTextPortions()[0]->GetLen() == 0; } long GetHeight() const { return ( bVisible ? nHeight : 0 ); } - USHORT GetFirstLineOffset() const { return ( bVisible ? nFirstLineOffset : 0 ); } + sal_uInt16 GetFirstLineOffset() const { return ( bVisible ? nFirstLineOffset : 0 ); } void ResetHeight() { nHeight = 0; nFirstLineOffset = 0; } ContentNode* GetNode() const { return pNode; } TextPortionList& GetTextPortions() { return aTextPortionList; } - USHORT GetInvalidPosStart() const { return nInvalidPosStart; } + sal_uInt16 GetInvalidPosStart() const { return nInvalidPosStart; } short GetInvalidDiff() const { return nInvalidDiff; } - void CorrectValuesBehindLastFormattedLine( USHORT nLastFormattedLine ); + void CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormattedLine ); - BOOL DbgCheckTextPortions(); + sal_Bool DbgCheckTextPortions(); }; typedef ParaPortion* ParaPortionPtr; @@ -616,21 +640,21 @@ SV_DECL_PTRARR( DummyParaPortionList, ParaPortionPtr, 0, 4 ) // ------------------------------------------------------------------------- class ParaPortionList : public DummyParaPortionList { - USHORT nLastCache; + sal_uInt16 nLastCache; public: ParaPortionList(); ~ParaPortionList(); void Reset(); long GetYOffset( ParaPortion* pPPortion ); - USHORT FindParagraph( long nYOffset ); + sal_uInt16 FindParagraph( long nYOffset ); - inline ParaPortion* SaveGetObject( USHORT nPos ) const + inline ParaPortion* SaveGetObject( sal_uInt16 nPos ) const { return ( nPos < Count() ) ? GetObject( nPos ) : 0; } - USHORT GetPos( const ParaPortionPtr &rPtr ) const; + sal_uInt16 GetPos( const ParaPortionPtr &rPtr ) const; - // temporaer: + // temporary: void DbgCheck( EditDoc& rDoc ); }; @@ -644,7 +668,8 @@ private: EditPaM aEndPaM; public: - EditSelection(); // kein CCTOR und DTOR, geht autom. richtig! + EditSelection(); // No constructor and destructor + // are automtically excecuted correctly! EditSelection( const EditPaM& rStartAndAnd ); EditSelection( const EditPaM& rStart, const EditPaM& rEnd ); @@ -654,17 +679,17 @@ public: const EditPaM& Min() const { return aStartPaM; } const EditPaM& Max() const { return aEndPaM; } - BOOL HasRange() const { return aStartPaM != aEndPaM; } - BOOL IsInvalid() const; - BOOL DbgIsBuggy( EditDoc& rDoc ); + sal_Bool HasRange() const { return aStartPaM != aEndPaM; } + sal_Bool IsInvalid() const; + sal_Bool DbgIsBuggy( EditDoc& rDoc ); - BOOL Adjust( const ContentList& rNodes ); + sal_Bool Adjust( const ContentList& rNodes ); EditSelection& operator = ( const EditPaM& r ); - BOOL operator == ( const EditSelection& r ) const + sal_Bool operator == ( const EditSelection& r ) const { return ( ( aStartPaM == r.aStartPaM ) && ( aEndPaM == r.aEndPaM ) ) - ? TRUE : FALSE; } - BOOL operator != ( const EditSelection& r ) const { return !( r == *this ); } + ? sal_True : sal_False; } + sal_Bool operator != ( const EditSelection& r ) const { return !( r == *this ); } }; // ------------------------------------------------------------------------- @@ -673,16 +698,16 @@ public: class DeletedNodeInfo { private: - ULONG nInvalidAdressPtr; - USHORT nInvalidParagraph; + sal_uIntPtr nInvalidAdressPtr; + sal_uInt16 nInvalidParagraph; public: - DeletedNodeInfo( ULONG nInvAdr, USHORT nPos ) + DeletedNodeInfo( sal_uIntPtr nInvAdr, sal_uInt16 nPos ) { nInvalidAdressPtr = nInvAdr; nInvalidParagraph = nPos; } - ULONG GetInvalidAdress() { return nInvalidAdressPtr; } - USHORT GetPosition() { return nInvalidParagraph; } + sal_uIntPtr GetInvalidAdress() { return nInvalidAdressPtr; } + sal_uInt16 GetPosition() { return nInvalidParagraph; } }; typedef DeletedNodeInfo* DeletedNodeInfoPtr; @@ -697,13 +722,13 @@ private: SfxItemPool* pItemPool; Link aModifyHdl; - SvxFont aDefFont; //schneller, als jedesmal vom Pool! - USHORT nDefTab; - BOOL bIsVertical; - BOOL bIsFixedCellHeight; + SvxFont aDefFont; //faster than ever from the pool!! + sal_uInt16 nDefTab; + sal_Bool bIsVertical; + sal_Bool bIsFixedCellHeight; - BOOL bOwnerOfPool; - BOOL bModified; + sal_Bool bOwnerOfPool; + sal_Bool bModified; protected: void ImplDestroyContents(); @@ -712,38 +737,38 @@ public: EditDoc( SfxItemPool* pItemPool ); ~EditDoc(); - BOOL IsModified() const { return bModified; } - void SetModified( BOOL b ); + sal_Bool IsModified() const { return bModified; } + void SetModified( sal_Bool b ); void SetModifyHdl( const Link& rLink ) { aModifyHdl = rLink; } Link GetModifyHdl() const { return aModifyHdl; } - void CreateDefFont( BOOL bUseStyles ); + void CreateDefFont( sal_Bool bUseStyles ); const SvxFont& GetDefFont() { return aDefFont; } - void SetDefTab( USHORT nTab ) { nDefTab = nTab ? nTab : DEFTAB; } - USHORT GetDefTab() const { return nDefTab; } + void SetDefTab( sal_uInt16 nTab ) { nDefTab = nTab ? nTab : DEFTAB; } + sal_uInt16 GetDefTab() const { return nDefTab; } - void SetVertical( BOOL bVertical ) { bIsVertical = bVertical; } - BOOL IsVertical() const { return bIsVertical; } + void SetVertical( sal_Bool bVertical ) { bIsVertical = bVertical; } + sal_Bool IsVertical() const { return bIsVertical; } - void SetFixedCellHeight( BOOL bUseFixedCellHeight ) { bIsFixedCellHeight = bUseFixedCellHeight; } - BOOL IsFixedCellHeight() const { return bIsFixedCellHeight; } + void SetFixedCellHeight( sal_Bool bUseFixedCellHeight ) { bIsFixedCellHeight = bUseFixedCellHeight; } + sal_Bool IsFixedCellHeight() const { return bIsFixedCellHeight; } EditPaM Clear(); EditPaM RemoveText(); - EditPaM RemoveChars( EditPaM aPaM, USHORT nChars ); + EditPaM RemoveChars( EditPaM aPaM, sal_uInt16 nChars ); void InsertText( const EditPaM& rPaM, xub_Unicode c ); EditPaM InsertText( EditPaM aPaM, const XubString& rStr ); - EditPaM InsertParaBreak( EditPaM aPaM, BOOL bKeepEndingAttribs ); + EditPaM InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs ); EditPaM InsertFeature( EditPaM aPaM, const SfxPoolItem& rItem ); EditPaM ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight ); String GetText( LineEnd eEnd ) const; - ULONG GetTextLen() const; + sal_uLong GetTextLen() const; - XubString GetParaAsString( USHORT nNode ) const; - XubString GetParaAsString( ContentNode* pNode, USHORT nStartPos = 0, USHORT nEndPos = 0xFFFF, BOOL bResolveFields = TRUE ) const; + XubString GetParaAsString( sal_uInt16 nNode ) const; + XubString GetParaAsString( ContentNode* pNode, sal_uInt16 nStartPos = 0, sal_uInt16 nEndPos = 0xFFFF, sal_Bool bResolveFields = sal_True ) const; inline EditPaM GetStartPaM() const; inline EditPaM GetEndPaM() const; @@ -753,15 +778,15 @@ public: void RemoveItemsFromPool( ContentNode* pNode ); - void InsertAttrib( const SfxPoolItem& rItem, ContentNode* pNode, USHORT nStart, USHORT nEnd ); - void InsertAttrib( ContentNode* pNode, USHORT nStart, USHORT nEnd, const SfxPoolItem& rPoolItem ); - void InsertAttribInSelection( ContentNode* pNode, USHORT nStart, USHORT nEnd, const SfxPoolItem& rPoolItem ); - BOOL RemoveAttribs( ContentNode* pNode, USHORT nStart, USHORT nEnd, USHORT nWhich = 0 ); - BOOL RemoveAttribs( ContentNode* pNode, USHORT nStart, USHORT nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, USHORT nWhich = 0 ); - void FindAttribs( ContentNode* pNode, USHORT nStartPos, USHORT nEndPos, SfxItemSet& rCurSet ); + void InsertAttrib( const SfxPoolItem& rItem, ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd ); + void InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem ); + void InsertAttribInSelection( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem ); + sal_Bool RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt16 nWhich = 0 ); + sal_Bool RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich = 0 ); + void FindAttribs( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, SfxItemSet& rCurSet ); - USHORT GetPos( ContentNode* pNode ) const { return ContentList::GetPos(pNode); } - ContentNode* SaveGetObject( USHORT nPos ) const { return ( nPos < Count() ) ? GetObject( nPos ) : 0; } + sal_uInt16 GetPos( ContentNode* pNode ) const { return ContentList::GetPos(pNode); } + ContentNode* SaveGetObject( sal_uInt16 nPos ) const { return ( nPos < Count() ) ? GetObject( nPos ) : 0; } static XubString GetSepStr( LineEnd eEnd ); }; @@ -777,12 +802,12 @@ inline EditPaM EditDoc::GetEndPaM() const return EditPaM( pLastNode, pLastNode->Len() ); } -inline EditCharAttrib* GetAttrib( const CharAttribArray& rAttribs, USHORT nAttr ) +inline EditCharAttrib* GetAttrib( const CharAttribArray& rAttribs, sal_uInt16 nAttr ) { return ( nAttr < rAttribs.Count() ) ? rAttribs[nAttr] : 0; } -BOOL CheckOrderedList( CharAttribArray& rAttribs, BOOL bStart ); +sal_Bool CheckOrderedList( CharAttribArray& rAttribs, sal_Bool bStart ); // ------------------------------------------------------------------------- // class EditEngineItemPool @@ -790,7 +815,7 @@ BOOL CheckOrderedList( CharAttribArray& rAttribs, BOOL bStart ); class EditEngineItemPool : public SfxItemPool { public: - EditEngineItemPool( BOOL bPersistenRefCounts ); + EditEngineItemPool( sal_Bool bPersistenRefCounts ); protected: virtual ~EditEngineItemPool(); public: diff --git a/editeng/source/editeng/editdoc2.cxx b/editeng/source/editeng/editdoc2.cxx index 71077d07ce..4bf4ef3809 100644 --- a/editeng/source/editeng/editdoc2.cxx +++ b/editeng/source/editeng/editdoc2.cxx @@ -63,33 +63,13 @@ #include <editeng/wrlmitem.hxx> #include <editeng/charscaleitem.hxx> -#include <vcl/svapp.hxx> // Fuer AppWindow... +#include <vcl/svapp.hxx> // For AppWindow... DBG_NAME( EE_ParaPortion ) SV_IMPL_VARARR( CharPosArray, sal_Int32 ); -/* -BOOL EditStyleSheet::HasStyleAsAnyParent( SfxStyleSheet& rStyle ) -{ - if ( GetParent() == rStyle.GetName() ) - return TRUE; - - if ( GetParent().Len() && ( GetParent() != GetName() ) ) - { - EditStyleSheet* pS = (EditStyleSheet*)GetPool().Find( GetParent(), rStyle.GetFamily() ); - if ( pS ) - return pS->HasStyleAsAnyParent( rStyle ); - } - return FALSE; -} - -*/ - -// ------------------------------------------------------------------------- -// class TextPortionList -// ------------------------------------------------------------------------- TextPortionList::TextPortionList() { } @@ -101,24 +81,24 @@ TextPortionList::~TextPortionList() void TextPortionList::Reset() { - for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ ) + for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ ) delete GetObject( nPortion ); Remove( 0, Count() ); } -void TextPortionList::DeleteFromPortion( USHORT nDelFrom ) +void TextPortionList::DeleteFromPortion( sal_uInt16 nDelFrom ) { DBG_ASSERT( ( nDelFrom < Count() ) || ( (nDelFrom == 0) && (Count() == 0) ), "DeleteFromPortion: Out of range" ); - for ( USHORT nP = nDelFrom; nP < Count(); nP++ ) + for ( sal_uInt16 nP = nDelFrom; nP < Count(); nP++ ) delete GetObject( nP ); Remove( nDelFrom, Count()-nDelFrom ); } -USHORT TextPortionList::FindPortion( USHORT nCharPos, USHORT& nPortionStart, BOOL bPreferStartingPortion ) +sal_uInt16 TextPortionList::FindPortion( sal_uInt16 nCharPos, sal_uInt16& nPortionStart, sal_Bool bPreferStartingPortion ) { - // Bei nCharPos an Portion-Grenze wird die linke Portion gefunden - USHORT nTmpPos = 0; - for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ ) + // When nCharPos at portion limit, the left portion is found + sal_uInt16 nTmpPos = 0; + for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ ) { TextPortion* pPortion = GetObject( nPortion ); nTmpPos = nTmpPos + pPortion->GetLen(); @@ -132,14 +112,14 @@ USHORT TextPortionList::FindPortion( USHORT nCharPos, USHORT& nPortionStart, BOO } } } - DBG_ERROR( "FindPortion: Nicht gefunden!" ); + OSL_FAIL( "FindPortion: Not found!" ); return ( Count() - 1 ); } -USHORT TextPortionList::GetStartPos( USHORT nPortion ) +sal_uInt16 TextPortionList::GetStartPos( sal_uInt16 nPortion ) { - USHORT nPos = 0; - for ( USHORT n = 0; n < nPortion; n++ ) + sal_uInt16 nPos = 0; + for ( sal_uInt16 n = 0; n < nPortion; n++ ) { TextPortion* pPortion = GetObject( n ); nPos = nPos + pPortion->GetLen(); @@ -148,10 +128,6 @@ USHORT TextPortionList::GetStartPos( USHORT nPortion ) } -// ------------------------------------------------------------------------- -// class ExtraPortionInfo -// ------------------------------------------------------------------------- - ExtraPortionInfo::ExtraPortionInfo() { nOrgWidth = 0; @@ -159,8 +135,8 @@ ExtraPortionInfo::ExtraPortionInfo() nMaxCompression100thPercent = 0; nAsianCompressionTypes = 0; nPortionOffsetX = 0; - bFirstCharIsRightPunktuation = FALSE; - bCompressed = FALSE; + bFirstCharIsRightPunktuation = sal_False; + bCompressed = sal_False; pOrgDXArray = NULL; } @@ -169,7 +145,7 @@ ExtraPortionInfo::~ExtraPortionInfo() delete[] pOrgDXArray; } -void ExtraPortionInfo::SaveOrgDXArray( const sal_Int32* pDXArray, USHORT nLen ) +void ExtraPortionInfo::SaveOrgDXArray( const sal_Int32* pDXArray, sal_uInt16 nLen ) { delete[] pOrgDXArray; pOrgDXArray = new sal_Int32[nLen]; @@ -183,18 +159,15 @@ void ExtraPortionInfo::DestroyOrgDXArray() } -// ------------------------------------------------------------------------- -// class ParaPortion -// ------------------------------------------------------------------------- ParaPortion::ParaPortion( ContentNode* pN ) { DBG_CTOR( EE_ParaPortion, 0 ); pNode = pN; - bInvalid = TRUE; - bVisible = TRUE; - bSimple = FALSE; - bForceRepaint = FALSE; + bInvalid = sal_True; + bVisible = sal_True; + bSimple = sal_False; + bForceRepaint = sal_False; nInvalidPosStart = 0; nInvalidDiff = 0; nHeight = 0; @@ -207,9 +180,9 @@ ParaPortion::~ParaPortion() DBG_DTOR( EE_ParaPortion, 0 ); } -void ParaPortion::MarkInvalid( USHORT nStart, short nDiff ) +void ParaPortion::MarkInvalid( sal_uInt16 nStart, short nDiff ) { - if ( bInvalid == FALSE ) + if ( bInvalid == sal_False ) { // nInvalidPosEnd = nStart; // ??? => CreateLines nInvalidPosStart = ( nDiff >= 0 ) ? nStart : ( nStart + nDiff ); @@ -217,13 +190,13 @@ void ParaPortion::MarkInvalid( USHORT nStart, short nDiff ) } else { - // Einfaches hintereinander tippen + // Simple tap in succession if ( ( nDiff > 0 ) && ( nInvalidDiff > 0 ) && ( ( nInvalidPosStart+nInvalidDiff ) == nStart ) ) { nInvalidDiff = nInvalidDiff + nDiff; } - // Einfaches hintereinander loeschen + // Simple delete in succession else if ( ( nDiff < 0 ) && ( nInvalidDiff < 0 ) && ( nInvalidPosStart == nStart ) ) { nInvalidPosStart = nInvalidPosStart + nDiff; @@ -233,20 +206,19 @@ void ParaPortion::MarkInvalid( USHORT nStart, short nDiff ) { // nInvalidPosEnd = pNode->Len(); DBG_ASSERT( ( nDiff >= 0 ) || ( (nStart+nDiff) >= 0 ), "MarkInvalid: Diff out of Range" ); - nInvalidPosStart = Min( nInvalidPosStart, (USHORT) ( nDiff < 0 ? nStart+nDiff : nDiff ) ); + nInvalidPosStart = Min( nInvalidPosStart, (sal_uInt16) ( nDiff < 0 ? nStart+nDiff : nDiff ) ); nInvalidDiff = 0; - bSimple = FALSE; + bSimple = sal_False; } } - bInvalid = TRUE; - aScriptInfos.Remove( 0, aScriptInfos.Count() ); - aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() ); -// aExtraCharInfos.Remove( 0, aExtraCharInfos.Count() ); + bInvalid = sal_True; + aScriptInfos.clear(); + aWritingDirectionInfos.clear(); } -void ParaPortion::MarkSelectionInvalid( USHORT nStart, USHORT /* nEnd */ ) +void ParaPortion::MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 /* nEnd */ ) { - if ( bInvalid == FALSE ) + if ( bInvalid == sal_False ) { nInvalidPosStart = nStart; // nInvalidPosEnd = nEnd; @@ -257,92 +229,91 @@ void ParaPortion::MarkSelectionInvalid( USHORT nStart, USHORT /* nEnd */ ) // nInvalidPosEnd = pNode->Len(); } nInvalidDiff = 0; - bInvalid = TRUE; - bSimple = FALSE; - aScriptInfos.Remove( 0, aScriptInfos.Count() ); - aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() ); -// aExtraCharInfos.Remove( 0, aExtraCharInfos.Count() ); + bInvalid = sal_True; + bSimple = sal_False; + aScriptInfos.clear(); + aWritingDirectionInfos.clear(); } -USHORT ParaPortion::GetLineNumber( USHORT nIndex ) +sal_uInt16 ParaPortion::GetLineNumber( sal_uInt16 nIndex ) { - DBG_ASSERTWARNING( aLineList.Count(), "Leere ParaPortion in GetLine!" ); - DBG_ASSERT( bVisible, "Wozu GetLine() bei einem unsichtbaren Absatz?" ); + DBG_ASSERTWARNING( aLineList.Count(), "Empty ParaPortion in GetLine!" ); + DBG_ASSERT( bVisible, "Why GetLine() on an invisible paragraph?" ); - for ( USHORT nLine = 0; nLine < aLineList.Count(); nLine++ ) + for ( sal_uInt16 nLine = 0; nLine < aLineList.Count(); nLine++ ) { if ( aLineList[nLine]->IsIn( nIndex ) ) return nLine; } - // Dann sollte es am Ende der letzten Zeile sein! - DBG_ASSERT( nIndex == aLineList[ aLineList.Count() - 1 ]->GetEnd(), "Index voll daneben!" ); + // Then it should be at the end of the last line! + DBG_ASSERT( nIndex == aLineList[ aLineList.Count() - 1 ]->GetEnd(), "Index dead wrong!" ); return (aLineList.Count()-1); } -void ParaPortion::SetVisible( BOOL bMakeVisible ) +void ParaPortion::SetVisible( sal_Bool bMakeVisible ) { bVisible = bMakeVisible; } -void ParaPortion::CorrectValuesBehindLastFormattedLine( USHORT nLastFormattedLine ) +void ParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormattedLine ) { - USHORT nLines = aLineList.Count(); - DBG_ASSERT( nLines, "CorrectPortionNumbersFromLine: Leere Portion?" ); + sal_uInt16 nLines = aLineList.Count(); + DBG_ASSERT( nLines, "CorrectPortionNumbersFromLine: Empty Portion?" ); if ( nLastFormattedLine < ( nLines - 1 ) ) { const EditLine* pLastFormatted = aLineList[ nLastFormattedLine ]; const EditLine* pUnformatted = aLineList[ nLastFormattedLine+1 ]; short nPortionDiff = pUnformatted->GetStartPortion() - pLastFormatted->GetEndPortion(); short nTextDiff = pUnformatted->GetStart() - pLastFormatted->GetEnd(); - nTextDiff++; // LastFormatted->GetEnd() war incl. => 1 zuviel abgezogen! + nTextDiff++; // LastFormatted->GetEnd() was included => 1 deducted too much! - // Die erste unformatierte muss genau eine Portion hinter der letzten der - // formatierten beginnen: - // Wenn in der geaenderten Zeile eine Portion gesplittet wurde, - // kann nLastEnd > nNextStart sein! + // The first unformatted must begin exactly one Portion behind the last + // of the formatted: + // If the modified line was split into one portion, can + // nLastEnd > nNextStart! int nPDiff = -( nPortionDiff-1 ); int nTDiff = -( nTextDiff-1 ); if ( nPDiff || nTDiff ) { - for ( USHORT nL = nLastFormattedLine+1; nL < nLines; nL++ ) + for ( sal_uInt16 nL = nLastFormattedLine+1; nL < nLines; nL++ ) { EditLine* pLine = aLineList[ nL ]; - pLine->GetStartPortion() = sal::static_int_cast< USHORT >( + pLine->GetStartPortion() = sal::static_int_cast< sal_uInt16 >( pLine->GetStartPortion() + nPDiff); - pLine->GetEndPortion() = sal::static_int_cast< USHORT >( + pLine->GetEndPortion() = sal::static_int_cast< sal_uInt16 >( pLine->GetEndPortion() + nPDiff); - pLine->GetStart() = sal::static_int_cast< USHORT >( + pLine->GetStart() = sal::static_int_cast< sal_uInt16 >( pLine->GetStart() + nTDiff); - pLine->GetEnd() = sal::static_int_cast< USHORT >( + pLine->GetEnd() = sal::static_int_cast< sal_uInt16 >( pLine->GetEnd() + nTDiff); pLine->SetValid(); } } } - DBG_ASSERT( aLineList[ aLineList.Count()-1 ]->GetEnd() == pNode->Len(), "CorrectLines: Ende stimmt nicht!" ); + DBG_ASSERT( aLineList[ aLineList.Count()-1 ]->GetEnd() == pNode->Len(), "CorrectLines: The end is not right!" ); } // Shared reverse lookup acceleration pieces ... -static USHORT FastGetPos( const VoidPtr *pPtrArray, USHORT nPtrArrayLen, - VoidPtr pPtr, USHORT &rLastPos ) +static sal_uInt16 FastGetPos( const VoidPtr *pPtrArray, sal_uInt16 nPtrArrayLen, + VoidPtr pPtr, sal_uInt16 &rLastPos ) { // Through certain filter code-paths we do a lot of appends, which in // turn call GetPos - creating some N^2 nightmares. If we have a // non-trivially large list, do a few checks from the end first. if( rLastPos > 16 ) { - USHORT nEnd; + sal_uInt16 nEnd; if (rLastPos > nPtrArrayLen - 2) nEnd = nPtrArrayLen; else nEnd = rLastPos + 2; - for( USHORT nIdx = rLastPos - 2; nIdx < nEnd; nIdx++ ) + for( sal_uInt16 nIdx = rLastPos - 2; nIdx < nEnd; nIdx++ ) { if( pPtrArray[ nIdx ] == pPtr ) { @@ -352,15 +323,12 @@ static USHORT FastGetPos( const VoidPtr *pPtrArray, USHORT nPtrArrayLen, } } // The world's lamest linear search from svarray ... - for( USHORT nIdx = 0; nIdx < nPtrArrayLen; nIdx++ ) + for( sal_uInt16 nIdx = 0; nIdx < nPtrArrayLen; nIdx++ ) if (pPtrArray[ nIdx ] == pPtr ) return rLastPos = nIdx; return USHRT_MAX; } -// ------------------------------------------------------------------------- -// class ParaPortionList -// ------------------------------------------------------------------------- ParaPortionList::ParaPortionList() : nLastCache( 0 ) { } @@ -370,14 +338,14 @@ ParaPortionList::~ParaPortionList() Reset(); } -USHORT ParaPortionList::GetPos( const ParaPortionPtr &rPtr ) const +sal_uInt16 ParaPortionList::GetPos( const ParaPortionPtr &rPtr ) const { return FastGetPos( reinterpret_cast<const VoidPtr *>( GetData() ), Count(), static_cast<VoidPtr>( rPtr ), ((ParaPortionList *)this)->nLastCache ); } -USHORT ContentList::GetPos( const ContentNodePtr &rPtr ) const +sal_uInt16 ContentList::GetPos( const ContentNodePtr &rPtr ) const { return FastGetPos( reinterpret_cast<const VoidPtr *>( GetData() ), Count(), static_cast<VoidPtr>( rPtr ), @@ -386,7 +354,7 @@ USHORT ContentList::GetPos( const ContentNodePtr &rPtr ) const void ParaPortionList::Reset() { - for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ ) + for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ ) delete GetObject( nPortion ); Remove( 0, Count() ); } @@ -394,27 +362,27 @@ void ParaPortionList::Reset() long ParaPortionList::GetYOffset( ParaPortion* pPPortion ) { long nHeight = 0; - for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ ) + for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ ) { ParaPortion* pTmpPortion = GetObject(nPortion); if ( pTmpPortion == pPPortion ) return nHeight; nHeight += pTmpPortion->GetHeight(); } - DBG_ERROR( "GetYOffset: Portion nicht gefunden" ); + OSL_FAIL( "GetYOffset: Portion not found" ); return nHeight; } -USHORT ParaPortionList::FindParagraph( long nYOffset ) +sal_uInt16 ParaPortionList::FindParagraph( long nYOffset ) { long nY = 0; - for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ ) + for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ ) { - nY += GetObject(nPortion)->GetHeight(); // sollte auch bei !bVisible richtig sein! + nY += GetObject(nPortion)->GetHeight(); // should also be correct even in bVisible! if ( nY > nYOffset ) return nPortion; } - return 0xFFFF; // solte mal ueber EE_PARA_NOT_FOUND erreicht werden! + return 0xFFFF; // Should be reachable through EE_PARA_NOT_FOUND! } void ParaPortionList::DbgCheck( EditDoc& @@ -424,12 +392,12 @@ void ParaPortionList::DbgCheck( EditDoc& ) { #ifdef DBG_UTIL - DBG_ASSERT( Count() == rDoc.Count(), "ParaPortionList::DbgCheck() - Count() ungleich!" ); - for ( USHORT i = 0; i < Count(); i++ ) + DBG_ASSERT( Count() == rDoc.Count(), "ParaPortionList::DbgCheck() - Count() unequal!" ); + for ( sal_uInt16 i = 0; i < Count(); i++ ) { - DBG_ASSERT( SaveGetObject(i), "ParaPortionList::DbgCheck() - Null-Pointer in Liste!" ); - DBG_ASSERT( GetObject(i)->GetNode(), "ParaPortionList::DbgCheck() - Null-Pointer in Liste(2)!" ); - DBG_ASSERT( GetObject(i)->GetNode() == rDoc.GetObject(i), "ParaPortionList::DbgCheck() - Eintraege kreuzen sich!" ); + DBG_ASSERT( SaveGetObject(i), "ParaPortionList::DbgCheck() - Null-Pointer in List!" ); + DBG_ASSERT( GetObject(i)->GetNode(), "ParaPortionList::DbgCheck() - Null-Pointer in List(2)!" ); + DBG_ASSERT( GetObject(i)->GetNode() == rDoc.GetObject(i), "ParaPortionList::DbgCheck() - Entries intersect!" ); } #endif } @@ -449,37 +417,36 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit { case EE_PARA_LRSPACE: { - DBG_ASSERT( rPoolItem.IsA( TYPE( SvxLRSpaceItem ) ), "ConvertItem: Ungueltiges Item!" ); + DBG_ASSERT( rPoolItem.IsA( TYPE( SvxLRSpaceItem ) ), "ConvertItem: invalid Item!" ); SvxLRSpaceItem& rItem = (SvxLRSpaceItem&)rPoolItem; rItem.SetTxtFirstLineOfst( sal::static_int_cast< short >( OutputDevice::LogicToLogic( rItem.GetTxtFirstLineOfst(), eSourceUnit, eDestUnit ) ) ); rItem.SetTxtLeft( OutputDevice::LogicToLogic( rItem.GetTxtLeft(), eSourceUnit, eDestUnit ) ); -// rItem.SetLeft( OutputDevice::LogicToLogic( rItem.GetLeft(), eSourceUnit, eDestUnit ) ); // #96298# SetLeft manipulates nTxtLeft! rItem.SetRight( OutputDevice::LogicToLogic( rItem.GetRight(), eSourceUnit, eDestUnit ) ); } break; case EE_PARA_ULSPACE: { - DBG_ASSERT( rPoolItem.IsA( TYPE( SvxULSpaceItem ) ), "ConvertItem: Ungueltiges Item!" ); + DBG_ASSERT( rPoolItem.IsA( TYPE( SvxULSpaceItem ) ), "ConvertItem: Invalid Item!" ); SvxULSpaceItem& rItem = (SvxULSpaceItem&)rPoolItem; - rItem.SetUpper( sal::static_int_cast< USHORT >( OutputDevice::LogicToLogic( rItem.GetUpper(), eSourceUnit, eDestUnit ) ) ); - rItem.SetLower( sal::static_int_cast< USHORT >( OutputDevice::LogicToLogic( rItem.GetLower(), eSourceUnit, eDestUnit ) ) ); + rItem.SetUpper( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetUpper(), eSourceUnit, eDestUnit ) ) ); + rItem.SetLower( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetLower(), eSourceUnit, eDestUnit ) ) ); } break; case EE_PARA_SBL: { - DBG_ASSERT( rPoolItem.IsA( TYPE( SvxLineSpacingItem ) ), "ConvertItem: Ungueltiges Item!" ); + DBG_ASSERT( rPoolItem.IsA( TYPE( SvxLineSpacingItem ) ), "ConvertItem: Invalid Item!" ); SvxLineSpacingItem& rItem = (SvxLineSpacingItem&)rPoolItem; - // #96298# SetLineHeight changes also eLineSpace! + // SetLineHeight changes also eLineSpace! if ( rItem.GetLineSpaceRule() == SVX_LINE_SPACE_MIN ) - rItem.SetLineHeight( sal::static_int_cast< USHORT >( OutputDevice::LogicToLogic( rItem.GetLineHeight(), eSourceUnit, eDestUnit ) ) ); + rItem.SetLineHeight( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetLineHeight(), eSourceUnit, eDestUnit ) ) ); } break; case EE_PARA_TABS: { - DBG_ASSERT( rPoolItem.IsA( TYPE( SvxTabStopItem ) ), "ConvertItem: Ungueltiges Item!" ); + DBG_ASSERT( rPoolItem.IsA( TYPE( SvxTabStopItem ) ), "ConvertItem: Invalid Item!" ); SvxTabStopItem& rItem = (SvxTabStopItem&)rPoolItem; SvxTabStopItem aNewItem( EE_PARA_TABS ); - for ( USHORT i = 0; i < rItem.Count(); i++ ) + for ( sal_uInt16 i = 0; i < rItem.Count(); i++ ) { const SvxTabStop& rTab = rItem[i]; SvxTabStop aNewStop( OutputDevice::LogicToLogic( rTab.GetTabPos(), eSourceUnit, eDestUnit ), rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() ); @@ -492,7 +459,7 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit case EE_CHAR_FONTHEIGHT_CJK: case EE_CHAR_FONTHEIGHT_CTL: { - DBG_ASSERT( rPoolItem.IsA( TYPE( SvxFontHeightItem ) ), "ConvertItem: Ungueltiges Item!" ); + DBG_ASSERT( rPoolItem.IsA( TYPE( SvxFontHeightItem ) ), "ConvertItem: Invalid Item!" ); SvxFontHeightItem& rItem = (SvxFontHeightItem&)rPoolItem; rItem.SetHeight( OutputDevice::LogicToLogic( rItem.GetHeight(), eSourceUnit, eDestUnit ) ); } @@ -505,20 +472,20 @@ void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const Map const SfxItemPool* pSourcePool = rSource.GetPool(); const SfxItemPool* pDestPool = rDest.GetPool(); - for ( USHORT nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ ) + for ( sal_uInt16 nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ ) { - // Wenn moeglich ueber SlotID gehen... + // If possible go through SlotID ... - USHORT nSourceWhich = nWhich; - USHORT nSlot = pDestPool->GetTrueSlotId( nWhich ); + sal_uInt16 nSourceWhich = nWhich; + sal_uInt16 nSlot = pDestPool->GetTrueSlotId( nWhich ); if ( nSlot ) { - USHORT nW = pSourcePool->GetTrueWhich( nSlot ); + sal_uInt16 nW = pSourcePool->GetTrueWhich( nSlot ); if ( nW ) nSourceWhich = nW; } - if ( rSource.GetItemState( nSourceWhich, FALSE ) == SFX_ITEM_ON ) + if ( rSource.GetItemState( nSourceWhich, sal_False ) == SFX_ITEM_ON ) { MapUnit eSourceUnit = pSourceUnit ? *pSourceUnit : (MapUnit)pSourcePool->GetMetric( nSourceWhich ); MapUnit eDestUnit = pDestUnit ? *pDestUnit : (MapUnit)pDestPool->GetMetric( nWhich ); @@ -535,11 +502,6 @@ void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const Map rDest.Put( rSource.Get( nSourceWhich ), nWhich ); } } - else - { - // MT 3.3.99: Waere so eigentlich richtig, aber schon seit Jahren nicht so... -// rDest.ClearItem( nWhich ); - } } } diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index c6a446362f..40c9242930 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -36,7 +36,7 @@ #define USE_SVXFONT -#define _SVSTDARR_USHORTS +#define _SVSTDARR_sal_uInt16S #include <svl/svstdarr.hxx> #include <svl/ctloptions.hxx> #include <svtools/ctrltool.hxx> @@ -95,7 +95,7 @@ #endif #include <basegfx/polygon/b2dpolygon.hxx> -// Spaeter -> TOOLS\STRING.H (fuer Grep: WS_TARGET) +// later -> TOOLS\STRING.H (for Grep: WS_TARGET) using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -146,7 +146,7 @@ sal_Bool EditEngine::IsInUndo() return pImpEditEngine->IsInUndo(); } -SfxUndoManager& EditEngine::GetUndoManager() +::svl::IUndoManager& EditEngine::GetUndoManager() { DBG_CHKTHIS( EditEngine, 0 ); return pImpEditEngine->GetUndoManager(); @@ -155,7 +155,7 @@ SfxUndoManager& EditEngine::GetUndoManager() void EditEngine::UndoActionStart( sal_uInt16 nId ) { DBG_CHKTHIS( EditEngine, 0 ); - DBG_ASSERT( !pImpEditEngine->IsInUndo(), "Aufruf von UndoActionStart im Undomodus!" ); + DBG_ASSERT( !pImpEditEngine->IsInUndo(), "Calling UndoActionStart in Undomode!" ); if ( !pImpEditEngine->IsInUndo() ) pImpEditEngine->UndoActionStart( nId ); } @@ -163,12 +163,12 @@ void EditEngine::UndoActionStart( sal_uInt16 nId ) void EditEngine::UndoActionEnd( sal_uInt16 nId ) { DBG_CHKTHIS( EditEngine, 0 ); - DBG_ASSERT( !pImpEditEngine->IsInUndo(), "Aufruf von UndoActionEnd im Undomodus!" ); + DBG_ASSERT( !pImpEditEngine->IsInUndo(), "Calling UndoActionStart in Undomode!" ); if ( !pImpEditEngine->IsInUndo() ) pImpEditEngine->UndoActionEnd( nId ); } -BOOL EditEngine::HasTriedMergeOnLastAddUndo() const +sal_Bool EditEngine::HasTriedMergeOnLastAddUndo() const { return pImpEditEngine->mbLastTryMerge; } @@ -215,25 +215,25 @@ Color EditEngine::GetAutoColor() const return pImpEditEngine->GetAutoColor(); } -void EditEngine::EnableAutoColor( BOOL b ) +void EditEngine::EnableAutoColor( sal_Bool b ) { DBG_CHKTHIS( EditEngine, 0 ); pImpEditEngine->EnableAutoColor( b ); } -BOOL EditEngine::IsAutoColorEnabled() const +sal_Bool EditEngine::IsAutoColorEnabled() const { DBG_CHKTHIS( EditEngine, 0 ); return pImpEditEngine->IsAutoColorEnabled(); } -void EditEngine::ForceAutoColor( BOOL b ) +void EditEngine::ForceAutoColor( sal_Bool b ) { DBG_CHKTHIS( EditEngine, 0 ); pImpEditEngine->ForceAutoColor( b ); } -BOOL EditEngine::IsForceAutoColor() const +sal_Bool EditEngine::IsForceAutoColor() const { DBG_CHKTHIS( EditEngine, 0 ); return pImpEditEngine->IsForceAutoColor(); @@ -254,8 +254,8 @@ void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect ) void EditEngine::Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation ) { DBG_CHKTHIS( EditEngine, 0 ); - // Mit 2 Punkten erzeugen, da bei Positivem Punkt, LONGMAX als Size - // Bottom und Right im Bereich > LONGMAX landen. + // Create with 2 points, as with positive points it will end up with + // LONGMAX as Size, Bottom and Right in the range > LONGMAX. Rectangle aBigRec( -0x3FFFFFFF, -0x3FFFFFFF, 0x3FFFFFFF, 0x3FFFFFFF ); if( pOutDev->GetConnectMetaFile() ) pOutDev->Push(); @@ -284,8 +284,8 @@ void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const P EditDbg::ShowEditEngineData( this, sal_False ); #endif - // Auf Pixelgrenze ausrichten, damit genau das gleiche - // wie bei Paint(). + // Align to the pixel boundary, so that it becomes exactly the same + // as Paint (). Rectangle aOutRect( pOutDev->LogicToPixel( rOutRect ) ); aOutRect = pOutDev->PixelToLogic( aOutRect ); @@ -305,28 +305,12 @@ void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const P sal_Bool bMetafile = pOutDev->GetConnectMetaFile() ? sal_True : sal_False; Region aOldRegion = pOutDev->GetClipRegion(); -#ifdef EDIT_PRINTER_LOG - if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER ) - { - SvFileStream aLog( "d:\\editprn.log", STREAM_WRITE ); - aLog.Seek( STREAM_SEEK_TO_END ); - aLog << '' << endl << "Printing: "; - aLog << GetText( "\n\r" ).GetStr(); - aLog << endl << endl; - aLog << "Ref-Device: " << String( (sal_uInt32)GetRefDevice() ).GetStr() << " Type=" << String( (sal_uInt16)GetRefDevice()->GetOutDevType() ).GetStr() << ", MapX=" << String( GetRefDevice()->GetMapMode().GetScaleX().GetNumerator() ).GetStr() << "/" << String( GetRefDevice()->GetMapMode().GetScaleX().GetDenominator() ).GetStr() <<endl; - aLog << "Paper-Width: " << String( GetPaperSize().Width() ).GetStr() << ",\tOut-Width: " << String( rOutRect.GetWidth() ).GetStr() << ",\tCalculated: " << String( CalcTextWidth() ).GetStr() << endl; - aLog << "Paper-Height: " << String( GetPaperSize().Height() ).GetStr() << ",\tOut-Height: " << String( rOutRect.GetHeight() ).GetStr() << ",\tCalculated: " << String( GetTextHeight() ).GetStr() << endl; - - aLog << endl; - } -#endif - - // Wenn es eine gab => Schnittmenge ! - // Bei der Metafileaufzeichnung Push/Pop verwenden. + // If one existed => intersection! + // Use Push/pop for creating the Meta file if ( bMetafile ) pOutDev->Push(); - // Immer die Intersect-Methode, weil beim Metafile ein Muss! + // Always use the Intersect method, it is a must for Metafile! if ( bClip ) { // Clip only if neccesary... @@ -334,12 +318,12 @@ void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const P ( rOutRect.GetHeight() >= (long)GetTextHeight() ) && ( rOutRect.GetWidth() >= (long)CalcTextWidth() ) ) { - bClip = FALSE; + bClip = sal_False; } else { - // Einige Druckertreiber bereiten Probleme, wenn Buchstaben die - // ClipRegion streifen, deshalb lieber ein Pixel mehr... + // Some printer drivers cause problems if characters graze the + // ClipRegion, therefore rather add a pixel more ... Rectangle aClipRect( aOutRect ); if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER ) { @@ -388,7 +372,7 @@ EditView* EditEngine::RemoveView( EditView* pView ) pView->HideCursor(); EditView* pRemoved = 0; sal_uInt16 nPos = pImpEditEngine->GetEditViews().GetPos( pView ); - DBG_ASSERT( nPos != USHRT_MAX, "RemoveView mit ungueltigem Index" ); + DBG_ASSERT( nPos != USHRT_MAX, "RemoveView with invalid index" ); if ( nPos != USHRT_MAX ) { pRemoved = pImpEditEngine->GetEditViews().GetObject( nPos ); @@ -489,16 +473,10 @@ void EditEngine::SetPaperSize( const Size& rNewSize ) if ( bAutoPageSize || pImpEditEngine->IsFormatted() ) { - // Aendern der Breite hat bei AutoPageSize keine Wirkung, da durch - // Textbreite bestimmt. - // Optimierung erst nach Vobis-Auslieferung aktivieren... -// if ( !bAutoPageSize ) + // Changing the width has no effect for AutoPageSize, as this is + // determined by the text width. + // Optimization first after Vobis delivery was enabled ... pImpEditEngine->FormatFullDoc(); -// else -// { -// pImpEditEngine->FormatDoc(); // PageSize, falls Aenderung -// pImpEditEngine->CheckAutoPageSize(); // Falls nichts formatiert wurde -// } pImpEditEngine->UpdateViews( pImpEditEngine->GetActiveView() ); @@ -514,25 +492,25 @@ const Size& EditEngine::GetPaperSize() const return pImpEditEngine->GetPaperSize(); } -void EditEngine::SetVertical( BOOL bVertical ) +void EditEngine::SetVertical( sal_Bool bVertical ) { DBG_CHKTHIS( EditEngine, 0 ); pImpEditEngine->SetVertical( bVertical ); } -BOOL EditEngine::IsVertical() const +sal_Bool EditEngine::IsVertical() const { DBG_CHKTHIS( EditEngine, 0 ); return pImpEditEngine->IsVertical(); } -void EditEngine::SetFixedCellHeight( BOOL bUseFixedCellHeight ) +void EditEngine::SetFixedCellHeight( sal_Bool bUseFixedCellHeight ) { DBG_CHKTHIS( EditEngine, 0 ); pImpEditEngine->SetFixedCellHeight( bUseFixedCellHeight ); } -BOOL EditEngine::IsFixedCellHeight() const +sal_Bool EditEngine::IsFixedCellHeight() const { DBG_CHKTHIS( EditEngine, 0 ); return pImpEditEngine->IsFixedCellHeight(); @@ -550,14 +528,14 @@ EEHorizontalTextDirection EditEngine::GetDefaultHorizontalTextDirection() const return pImpEditEngine->GetDefaultHorizontalTextDirection(); } -USHORT EditEngine::GetScriptType( const ESelection& rSelection ) const +sal_uInt16 EditEngine::GetScriptType( const ESelection& rSelection ) const { DBG_CHKTHIS( EditEngine, 0 ); EditSelection aSel( pImpEditEngine->CreateSel( rSelection ) ); return pImpEditEngine->GetScriptType( aSel ); } -LanguageType EditEngine::GetLanguage( USHORT nPara, USHORT nPos ) const +LanguageType EditEngine::GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const { DBG_CHKTHIS( EditEngine, 0 ); ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara ); @@ -572,37 +550,37 @@ void EditEngine::TransliterateText( const ESelection& rSelection, sal_Int32 nTra pImpEditEngine->TransliterateText( pImpEditEngine->CreateSel( rSelection ), nTransliterationMode ); } -void EditEngine::SetAsianCompressionMode( USHORT n ) +void EditEngine::SetAsianCompressionMode( sal_uInt16 n ) { DBG_CHKTHIS( EditView, 0 ); pImpEditEngine->SetAsianCompressionMode( n ); } -USHORT EditEngine::GetAsianCompressionMode() const +sal_uInt16 EditEngine::GetAsianCompressionMode() const { DBG_CHKTHIS( EditView, 0 ); return pImpEditEngine->GetAsianCompressionMode(); } -void EditEngine::SetKernAsianPunctuation( BOOL b ) +void EditEngine::SetKernAsianPunctuation( sal_Bool b ) { DBG_CHKTHIS( EditView, 0 ); pImpEditEngine->SetKernAsianPunctuation( b ); } -BOOL EditEngine::IsKernAsianPunctuation() const +sal_Bool EditEngine::IsKernAsianPunctuation() const { DBG_CHKTHIS( EditView, 0 ); return pImpEditEngine->IsKernAsianPunctuation(); } -void EditEngine::SetAddExtLeading( BOOL b ) +void EditEngine::SetAddExtLeading( sal_Bool b ) { DBG_CHKTHIS( EditEngine, 0 ); pImpEditEngine->SetAddExtLeading( b ); } -BOOL EditEngine::IsAddExtLeading() const +sal_Bool EditEngine::IsAddExtLeading() const { DBG_CHKTHIS( EditEngine, 0 ); return pImpEditEngine->IsAddExtLeading(); @@ -711,7 +689,7 @@ sal_uInt16 EditEngine::GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) con return pImpEditEngine->GetLineLen( nParagraph, nLine ); } -void EditEngine::GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const +void EditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const { DBG_CHKTHIS( EditEngine, 0 ); if ( !pImpEditEngine->IsFormatted() ) @@ -719,7 +697,7 @@ void EditEngine::GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, return pImpEditEngine->GetLineBoundaries( rStart, rEnd, nParagraph, nLine ); } -USHORT EditEngine::GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const +sal_uInt16 EditEngine::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const { DBG_CHKTHIS( EditEngine, 0 ); if ( !pImpEditEngine->IsFormatted() ) @@ -730,7 +708,7 @@ USHORT EditEngine::GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const sal_uInt32 EditEngine::GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine ) { DBG_CHKTHIS( EditEngine, 0 ); - // Falls jemand mit einer leeren Engine ein GetLineHeight() macht. + // If someone calls GetLineHeight() with an empty Engine. if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); return pImpEditEngine->GetLineHeight( nParagraph, nLine ); @@ -764,7 +742,7 @@ XubString EditEngine::GetWord( sal_uInt16 nPara, sal_uInt16 nIndex ) return pImpEditEngine->GetSelected( aSel ); } -ESelection EditEngine::GetWord( const ESelection& rSelection, USHORT nWordType ) const +ESelection EditEngine::GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const { // ImpEditEngine-Iteration-Methods should be const! EditEngine* pE = (EditEngine*)this; @@ -774,7 +752,7 @@ ESelection EditEngine::GetWord( const ESelection& rSelection, USHORT nWordType return pE->pImpEditEngine->CreateESel( aSel ); } -ESelection EditEngine::WordLeft( const ESelection& rSelection, USHORT nWordType ) const +ESelection EditEngine::WordLeft( const ESelection& rSelection, sal_uInt16 nWordType ) const { // ImpEditEngine-Iteration-Methods should be const! EditEngine* pE = (EditEngine*)this; @@ -784,7 +762,7 @@ ESelection EditEngine::WordLeft( const ESelection& rSelection, USHORT nWordType return pE->pImpEditEngine->CreateESel( aSel ); } -ESelection EditEngine::WordRight( const ESelection& rSelection, USHORT nWordType ) const +ESelection EditEngine::WordRight( const ESelection& rSelection, sal_uInt16 nWordType ) const { // ImpEditEngine-Iteration-Methods should be const! EditEngine* pE = (EditEngine*)this; @@ -794,7 +772,7 @@ ESelection EditEngine::WordRight( const ESelection& rSelection, USHORT nWordType return pE->pImpEditEngine->CreateESel( aSel ); } -ESelection EditEngine::CursorLeft( const ESelection& rSelection, USHORT nCharacterIteratorMode ) const +ESelection EditEngine::CursorLeft( const ESelection& rSelection, sal_uInt16 nCharacterIteratorMode ) const { // ImpEditEngine-Iteration-Methods should be const! EditEngine* pE = (EditEngine*)this; @@ -804,7 +782,7 @@ ESelection EditEngine::CursorLeft( const ESelection& rSelection, USHORT nCharact return pE->pImpEditEngine->CreateESel( aSel ); } -ESelection EditEngine::CursorRight( const ESelection& rSelection, USHORT nCharacterIteratorMode ) const +ESelection EditEngine::CursorRight( const ESelection& rSelection, sal_uInt16 nCharacterIteratorMode ) const { // ImpEditEngine-Iteration-Methods should be const! EditEngine* pE = (EditEngine*)this; @@ -826,7 +804,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie { DBG_CHKTHIS( EditEngine, 0 ); DBG_CHKOBJ( pEditView, EditView, 0 ); - DBG_ASSERT( pEditView, "Keine View - keine Kekse !" ); + DBG_ASSERT( pEditView, "no View - no cookie !" ); sal_Bool bDone = sal_True; @@ -835,8 +813,8 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie sal_Bool bAllowIdle = sal_True; sal_Bool bReadOnly = pEditView->IsReadOnly(); - USHORT nNewCursorFlags = 0; - BOOL bSetCursorFlags = TRUE; + sal_uInt16 nNewCursorFlags = 0; + sal_Bool bSetCursorFlags = sal_True; EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); DBG_ASSERT( !aCurSel.IsInvalid(), "Blinde Selection in EditEngine::PostKeyEvent" ); @@ -866,7 +844,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie } // break; - default: // wird dann evtl. unten bearbeitet. + default: // is then possible edited below. eFunc = KEYFUNC_DONTKNOW; } } @@ -889,11 +867,11 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie { if ( rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() ) { - USHORT nParas = GetParagraphCount(); + sal_uInt16 nParas = GetParagraphCount(); Point aPos; Point aViewStart( pEditView->GetOutputArea().TopLeft() ); long n20 = 40 * pImpEditEngine->nOnePixelInRef; - for ( USHORT n = 0; n < nParas; n++ ) + for ( sal_uInt16 n = 0; n < nParas; n++ ) { long nH = GetTextHeight( n ); Point P1( aViewStart.X() + n20 + n20*(n%2), aViewStart.Y() + aPos.Y() ); @@ -906,7 +884,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie aPos.Y() += nH; } } - bDone = FALSE; + bDone = sal_False; } break; case KEY_F11: @@ -918,7 +896,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie aInfo += bDebugPaint ? "On" : "Off"; InfoBox( NULL, String( aInfo, RTL_TEXTENCODING_ASCII_US ) ).Execute(); } - bDone = FALSE; + bDone = sal_False; } break; case KEY_F12: @@ -926,19 +904,8 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie if ( rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() ) { EditDbg::ShowEditEngineData( this ); - #ifdef EDIT_PRINTER_LOG - SvFileStream aLog( "d:\\editprn.log", STREAM_WRITE ); - aLog.Seek( STREAM_SEEK_TO_END ); - aLog << '' << endl << "Debug: "; - aLog << GetText( "\n\r" ).GetStr(); - aLog << endl << endl; - aLog << "Ref-Device: " << String( (sal_uInt32)GetRefDevice() ).GetStr() << " Type=" << String( (sal_uInt16)GetRefDevice()->GetOutDevType() ).GetStr() << ", MapX=" << String( GetRefDevice()->GetMapMode().GetScaleX().GetNumerator() ).GetStr() << "/" << String( GetRefDevice()->GetMapMode().GetScaleX().GetDenominator() ).GetStr() <<endl; - aLog << "Paper-Width: " << String( GetPaperSize().Width() ).GetStr() << ",\tCalculated: " << String( CalcTextWidth() ).GetStr() << endl; - aLog << "Paper-Height: " << String( GetPaperSize().Height() ).GetStr() << ",\tCalculated: " << String( GetTextHeight() ).GetStr() << endl; - aLog << endl; - #endif } - bDone = FALSE; + bDone = sal_False; } break; #endif @@ -970,13 +937,13 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie if ( !rKeyEvent.GetKeyCode().IsMod2() || ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) ) { if ( pImpEditEngine->DoVisualCursorTraveling( aCurSel.Max().GetNode() ) && ( ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) /* || ( nCode == KEY_HOME ) || ( nCode == KEY_END ) */ ) ) - bSetCursorFlags = FALSE; // Will be manipulated within visual cursor move + bSetCursorFlags = sal_False; // Will be manipulated within visual cursor move aCurSel = pImpEditEngine->MoveCursor( rKeyEvent, pEditView ); if ( aCurSel.HasRange() ) { Reference<com::sun::star::datatransfer::clipboard::XClipboard> aSelection(pEditView->GetWindow()->GetPrimarySelection()); - pEditView->pImpEditView->CutCopy( aSelection, FALSE ); + pEditView->pImpEditView->CutCopy( aSelection, sal_False ); } bMoved = sal_True; @@ -1010,7 +977,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie // now on and that will be all. Otherwise continue as usual. // ... - USHORT nPara = pImpEditEngine->GetEditDoc().GetPos( pNode ); + sal_uInt16 nPara = pImpEditEngine->GetEditDoc().GetPos( pNode ); SfxBoolItem aBulletState( (const SfxBoolItem&) pImpEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ) ); bool bBulletIsVisible = aBulletState.GetValue() ? true : false; @@ -1030,7 +997,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie break; } - BYTE nDel = 0, nMode = 0; + sal_uInt8 nDel = 0, nMode = 0; switch( nCode ) { case com::sun::star::awt::Key::DELETE_WORD_BACKWARD: @@ -1153,7 +1120,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie { xub_Unicode nCharCode = rKeyEvent.GetCharCode(); pEditView->pImpEditView->DrawSelection(); - // Autokorrektur ? + // Autocorrection? SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); if ( ( pImpEditEngine->GetStatus().DoAutoCorrect() ) && ( SvxAutoCorrect::IsAutoCorrectChar( nCharCode ) || @@ -1169,7 +1136,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie // AutoComplete ??? if ( pImpEditEngine->GetStatus().DoAutoComplete() && ( nCharCode != ' ' ) ) { - // Aber nur wenn Wort-Ende... + // Only at end of word... sal_uInt16 nIndex = aCurSel.Max().GetIndex(); if ( ( nIndex >= aCurSel.Max().GetNode()->Len() ) || ( pImpEditEngine->aWordDelimiters.Search( aCurSel.Max().GetNode()->GetChar( nIndex ) ) != STRING_NOTFOUND ) ) @@ -1266,7 +1233,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie if ( bModified ) { DBG_ASSERT( !bReadOnly, "ReadOnly but modified???" ); - // Idle-Formatter nur, wenn AnyInput. + // Idle-Formatter only when AnyInput. if ( bAllowIdle && pImpEditEngine->GetStatus().UseIdleFormatter() && Application::AnyInput( INPUT_KEYBOARD) ) pImpEditEngine->IdleFormatAndUpdate( pEditView ); @@ -1299,10 +1266,23 @@ sal_uInt32 EditEngine::GetTextHeight() const if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); - sal_uInt32 nHeight = !IsVertical() ? pImpEditEngine->GetTextHeight() : pImpEditEngine->CalcTextWidth( TRUE ); + sal_uInt32 nHeight = !IsVertical() ? pImpEditEngine->GetTextHeight() : pImpEditEngine->CalcTextWidth( sal_True ); return nHeight; } +sal_uInt32 EditEngine::GetTextHeightNTP() const +{ + DBG_CHKTHIS( EditEngine, 0 ); + + if ( !pImpEditEngine->IsFormatted() ) + pImpEditEngine->FormatDoc(); + + if ( IsVertical() ) + return pImpEditEngine->CalcTextWidth( sal_True ); + + return pImpEditEngine->GetTextHeightNTP(); +} + sal_uInt32 EditEngine::CalcTextWidth() { DBG_CHKTHIS( EditEngine, 0 ); @@ -1310,7 +1290,7 @@ sal_uInt32 EditEngine::CalcTextWidth() if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); - sal_uInt32 nWidth = !IsVertical() ? pImpEditEngine->CalcTextWidth( TRUE ) : pImpEditEngine->GetTextHeight(); + sal_uInt32 nWidth = !IsVertical() ? pImpEditEngine->CalcTextWidth( sal_True ) : pImpEditEngine->GetTextHeight(); return nWidth; } @@ -1342,7 +1322,7 @@ void EditEngine::SetText( const XubString& rText ) pImpEditEngine->FormatAndUpdate(); } -ULONG EditEngine::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs /* = NULL */ ) +sal_uLong EditEngine::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs /* = NULL */ ) { DBG_CHKTHIS( EditEngine, 0 ); sal_Bool bUndoEnabled = pImpEditEngine->IsUndoEnabled(); @@ -1354,7 +1334,7 @@ ULONG EditEngine::Read( SvStream& rInput, const String& rBaseURL, EETextFormat e return rInput.GetError(); } -ULONG EditEngine::Write( SvStream& rOutput, EETextFormat eFormat ) +sal_uLong EditEngine::Write( SvStream& rOutput, EETextFormat eFormat ) { DBG_CHKTHIS( EditEngine, 0 ); EditPaM aStartPaM( pImpEditEngine->GetEditDoc().GetStartPaM() ); @@ -1466,8 +1446,8 @@ EditTextObject* EditEngine::CreateTextObject( sal_uInt16 nPara, sal_uInt16 nPara ContentNode* pStartNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara ); ContentNode* pEndNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara+nParas-1 ); - DBG_ASSERT( pStartNode, "Start-Absatz existiert nicht: CreateTextObject" ); - DBG_ASSERT( pEndNode, "End-Absatz existiert nicht: CreateTextObject" ); + DBG_ASSERT( pStartNode, "Start-Paragraph does not exist: CreateTextObject" ); + DBG_ASSERT( pEndNode, "End-Paragraph does not exist: CreateTextObject" ); if ( pStartNode && pEndNode ) { @@ -1482,16 +1462,16 @@ EditTextObject* EditEngine::CreateTextObject( sal_uInt16 nPara, sal_uInt16 nPara void EditEngine::RemoveParagraph( sal_uInt16 nPara ) { DBG_CHKTHIS( EditEngine, 0 ); - DBG_ASSERT( pImpEditEngine->GetEditDoc().Count() > 1, "Der erste Absatz darf nicht geloescht werden!" ); + DBG_ASSERT( pImpEditEngine->GetEditDoc().Count() > 1, "The first paragraph should not be deleted!" ); if( pImpEditEngine->GetEditDoc().Count() <= 1 ) return; ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara ); ParaPortion* pPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara ); - DBG_ASSERT( pPortion && pNode, "Absatz nicht gefunden: RemoveParagraph" ); + DBG_ASSERT( pPortion && pNode, "Paragraph not found: RemoveParagraph" ); if ( pNode && pPortion ) { - // Keine Undokappselung noetig. + // No Undo encapsulation needed. pImpEditEngine->ImpRemoveParagraph( nPara ); pImpEditEngine->InvalidateFromParagraph( nPara ); pImpEditEngine->UpdateSelections(); @@ -1503,7 +1483,7 @@ sal_uInt16 EditEngine::GetTextLen( sal_uInt16 nPara ) const { DBG_CHKTHIS( EditEngine, 0 ); ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara ); - DBG_ASSERT( pNode, "Absatz nicht gefunden: GetTextLen" ); + DBG_ASSERT( pNode, "Paragraph not found: GetTextLen" ); if ( pNode ) return pNode->Len(); return 0; @@ -1567,16 +1547,16 @@ void EditEngine::InsertParagraph( sal_uInt16 nPara, const EditTextObject& rTxtOb DBG_CHKTHIS( EditEngine, 0 ); if ( nPara > GetParagraphCount() ) { - DBG_ASSERTWARNING( nPara == USHRT_MAX, "AbsatzNr zu Gro???, aber nicht LIST_APPEND! " ); + DBG_ASSERTWARNING( nPara == USHRT_MAX, "Paragraph number to large, but not LIST_APPEND!" ); nPara = GetParagraphCount(); } pImpEditEngine->UndoActionStart( EDITUNDO_INSERT ); - // Keine Undoklammerung noetig. + // No Undo componding needed. EditPaM aPaM( pImpEditEngine->InsertParagraph( nPara ) ); - // Bei einem InsertParagraph von aussen sollen keine Harten - // Attribute uebernommen werden ! + // When InsertParagraph from the outside, no hard attributes + // should be taken over! pImpEditEngine->RemoveCharAttribs( nPara ); pImpEditEngine->InsertText( rTxtObj, EditSelection( aPaM, aPaM ) ); @@ -1590,14 +1570,14 @@ void EditEngine::InsertParagraph( sal_uInt16 nPara, const XubString& rTxt ) DBG_CHKTHIS( EditEngine, 0 ); if ( nPara > GetParagraphCount() ) { - DBG_ASSERTWARNING( nPara == USHRT_MAX, "AbsatzNr zu Gro???, aber nicht LIST_APPEND! " ); + DBG_ASSERTWARNING( nPara == USHRT_MAX, "Paragraph number to large, but not LIST_APPEND!" ); nPara = GetParagraphCount(); } pImpEditEngine->UndoActionStart( EDITUNDO_INSERT ); EditPaM aPaM( pImpEditEngine->InsertParagraph( nPara ) ); - // Bei einem InsertParagraph von aussen sollen keine Harten - // Attribute uebernommen werden ! + // When InsertParagraph from the outside, no hard attributes + // should be taken over! pImpEditEngine->RemoveCharAttribs( nPara ); pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT ); pImpEditEngine->ImpInsertText( EditSelection( aPaM, aPaM ), rTxt ); @@ -1635,7 +1615,6 @@ void EditEngine::SetText( sal_uInt16 nPara, const XubString& rTxt ) void EditEngine::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) { DBG_CHKTHIS( EditEngine, 0 ); - // Keine Undoklammerung noetig. pImpEditEngine->SetParaAttribs( nPara, rSet ); pImpEditEngine->FormatAndUpdate(); } @@ -1664,7 +1643,7 @@ void EditEngine::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) con pImpEditEngine->GetCharAttribs( nPara, rLst ); } -SfxItemSet EditEngine::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) +SfxItemSet EditEngine::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) { DBG_CHKTHIS( EditEngine, 0 ); EditSelection aSel( pImpEditEngine-> @@ -1672,7 +1651,7 @@ SfxItemSet EditEngine::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib return pImpEditEngine->GetAttribs( aSel, bOnlyHardAttrib ); } -SfxItemSet EditEngine::GetAttribs( USHORT nPara, USHORT nStart, USHORT nEnd, sal_uInt8 nFlags ) const +SfxItemSet EditEngine::GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags ) const { DBG_CHKTHIS( EditEngine, 0 ); return pImpEditEngine->GetAttribs( nPara, nStart, nEnd, nFlags ); @@ -1689,7 +1668,6 @@ void EditEngine::RemoveAttribs( const ESelection& rSelection, sal_Bool bRemovePa pImpEditEngine->FormatAndUpdate(); } -// MT: Can be removed after 6.x? Font EditEngine::GetStandardFont( sal_uInt16 nPara ) { DBG_CHKTHIS( EditEngine, 0 ); @@ -1758,7 +1736,7 @@ void EditEngine::SetControlWord( sal_uInt32 nWord ) sal_uInt32 nChanges = nPrev ^ nWord; if ( pImpEditEngine->IsFormatted() ) { - // ggf. neu formatieren: + // possibly reformat: if ( ( nChanges & EE_CNTRL_USECHARATTRIBS ) || ( nChanges & EE_CNTRL_USEPARAATTRIBS ) || ( nChanges & EE_CNTRL_ONECHARPERLINE ) || @@ -1786,7 +1764,7 @@ void EditEngine::SetControlWord( sal_uInt32 nWord ) pImpEditEngine->StopOnlineSpellTimer(); if ( bSpellingChanged && ( nWord & EE_CNTRL_ONLINESPELLING ) ) { - // WrongListen anlegen, Timer starten... + // Create WrongList, start timer... sal_uInt16 nNodes = pImpEditEngine->GetEditDoc().Count(); for ( sal_uInt16 n = 0; n < nNodes; n++ ) { @@ -1805,8 +1783,8 @@ void EditEngine::SetControlWord( sal_uInt32 nWord ) ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n ); ParaPortion* pPortion = pImpEditEngine->GetParaPortions().GetObject( n ); sal_Bool bWrongs = ( bSpellingChanged || ( nWord & EE_CNTRL_ONLINESPELLING ) ) ? pNode->GetWrongList()->HasWrongs() : sal_False; - if ( bSpellingChanged ) // Also aus - pNode->DestroyWrongList(); // => vorm Paint weghaun. + if ( bSpellingChanged ) + pNode->DestroyWrongList(); if ( bWrongs ) { pImpEditEngine->aInvalidRec.Left() = 0; @@ -1860,17 +1838,18 @@ Point EditEngine::GetDocPosTopLeft( sal_uInt16 nParagraph ) { DBG_CHKTHIS( EditEngine, 0 ); ParaPortion* pPPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nParagraph ); - DBG_ASSERT( pPPortion, "Absatz nicht gefunden: GetWindowPosTopLeft" ); + DBG_ASSERT( pPPortion, "Paragraph not found: GetWindowPosTopLeft" ); Point aPoint; if ( pPPortion ) { - // Falls jemand mit einer leeren Engine ein GetLineHeight() macht. + + // If someone calls GetLineHeight() whith an empty Engine. DBG_ASSERT( pImpEditEngine->IsFormatted() || !pImpEditEngine->IsFormatting(), "GetDocPosTopLeft: Doc not formatted - unable to format!" ); if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatAndUpdate(); if ( pPPortion->GetLines().Count() ) { - // So richtiger, falls grosses Bullet. + // Correct it if large Bullet. EditLine* pFirstLine = pPPortion->GetLines()[0]; aPoint.X() = pFirstLine->GetStartPosX(); } @@ -1891,7 +1870,7 @@ Point EditEngine::GetDocPosTopLeft( sal_uInt16 nParagraph ) return aPoint; } -const SvxNumberFormat* EditEngine::GetNumberFormat( USHORT nPara ) const +const SvxNumberFormat* EditEngine::GetNumberFormat( sal_uInt16 nPara ) const { // derived objects may overload this function to give access to // bullet information (see Outliner) @@ -1899,7 +1878,7 @@ const SvxNumberFormat* EditEngine::GetNumberFormat( USHORT nPara ) const return 0; } -BOOL EditEngine::IsRightToLeft( USHORT nPara ) const +sal_Bool EditEngine::IsRightToLeft( sal_uInt16 nPara ) const { DBG_CHKTHIS( EditEngine, 0 ); return pImpEditEngine->IsRightToLeft( nPara ); @@ -1913,7 +1892,7 @@ sal_Bool EditEngine::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder ) pImpEditEngine->FormatDoc(); sal_Bool bTextPos = sal_False; - // #90780# take unrotated positions for calculation here + // take unrotated positions for calculation here Point aDocPos = GetDocPos( rPaperPos ); if ( ( aDocPos.Y() > 0 ) && ( aDocPos.Y() < (long)pImpEditEngine->GetTextHeight() ) ) @@ -2028,7 +2007,7 @@ void EditEngine::QuickFormatDoc( sal_Bool bFull ) else pImpEditEngine->FormatDoc(); - // #111072# Don't pass active view, maybe selection is not updated yet... + // Don't pass active view, maybe selection is not updated yet... pImpEditEngine->UpdateViews( NULL ); } @@ -2079,7 +2058,7 @@ XubString EditEngine::GetWordDelimiters() const void EditEngine::SetGroupChars( const XubString& rChars ) { DBG_CHKTHIS( EditEngine, 0 ); - DBG_ASSERT( ( rChars.Len() % 2 ) == 0, "SetGroupChars: Ungerade Anzahl!" ); + DBG_ASSERT( ( rChars.Len() % 2 ) == 0, "SetGroupChars: Odd number!" ); pImpEditEngine->aGroupChars = rChars; } @@ -2156,7 +2135,7 @@ void EditEngine::SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTa rtl::Reference<SvxForbiddenCharactersTable> EditEngine::GetForbiddenCharsTable() const { DBG_CHKTHIS( EditEngine, 0 ); - return pImpEditEngine->GetForbiddenCharsTable( FALSE ); + return pImpEditEngine->GetForbiddenCharsTable( sal_False ); } @@ -2172,7 +2151,7 @@ LanguageType EditEngine::GetDefaultLanguage() const return pImpEditEngine->GetDefaultLanguage(); } -sal_Bool __EXPORT EditEngine::SpellNextDocument() +sal_Bool EditEngine::SpellNextDocument() { DBG_CHKTHIS( EditEngine, 0 ); return sal_False; @@ -2186,42 +2165,31 @@ EESpellState EditEngine::HasSpellErrors() return pImpEditEngine->HasSpellErrors(); } -/*-- 13.10.2003 16:56:23--------------------------------------------------- - -----------------------------------------------------------------------*/ void EditEngine::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc) { DBG_CHKTHIS( EditEngine, 0 ); pImpEditEngine->StartSpelling(rEditView, bMultipleDoc); } -/*-- 13.10.2003 16:56:23--------------------------------------------------- - -----------------------------------------------------------------------*/ void EditEngine::EndSpelling() { DBG_CHKTHIS( EditEngine, 0 ); pImpEditEngine->EndSpelling(); } -/*-- 13.10.2003 16:43:27--------------------------------------------------- - - -----------------------------------------------------------------------*/ bool EditEngine::SpellSentence(EditView& rView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking ) { DBG_CHKTHIS( EditEngine, 0 ); return pImpEditEngine->SpellSentence( rView, rToFill, bIsGrammarChecking ); } -/*-- 08.09.2008 11:38:32--------------------------------------------------- - -----------------------------------------------------------------------*/ void EditEngine::PutSpellingToSentenceStart( EditView& rEditView ) { DBG_CHKTHIS( EditEngine, 0 ); pImpEditEngine->PutSpellingToSentenceStart( rEditView ); } -/*-- 13.10.2003 16:43:27--------------------------------------------------- - -----------------------------------------------------------------------*/ void EditEngine::ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck ) { DBG_CHKTHIS( EditEngine, 0 ); @@ -2234,7 +2202,7 @@ sal_Bool EditEngine::HasConvertibleTextPortion( LanguageType nLang ) return pImpEditEngine->HasConvertibleTextPortion( nLang ); } -sal_Bool __EXPORT EditEngine::ConvertNextDocument() +sal_Bool EditEngine::ConvertNextDocument() { DBG_CHKTHIS( EditEngine, 0 ); return sal_False; @@ -2289,9 +2257,9 @@ sal_Bool EditEngine::ShouldCreateBigTextObject() const return ( nTextPortions >= pImpEditEngine->GetBigTextObjectStart() ) ? sal_True : sal_False; } -USHORT EditEngine::GetFieldCount( USHORT nPara ) const +sal_uInt16 EditEngine::GetFieldCount( sal_uInt16 nPara ) const { - USHORT nFields = 0; + sal_uInt16 nFields = 0; ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara ); if ( pNode ) { @@ -2307,12 +2275,12 @@ USHORT EditEngine::GetFieldCount( USHORT nPara ) const return nFields; } -EFieldInfo EditEngine::GetFieldInfo( USHORT nPara, USHORT nField ) const +EFieldInfo EditEngine::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const { ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara ); if ( pNode ) { - USHORT nCurrentField = 0; + sal_uInt16 nCurrentField = 0; const CharAttribArray& rAttrs = pNode->GetCharAttribs().GetAttribs(); for ( sal_uInt16 nAttr = 0; nAttr < rAttrs.Count(); nAttr++ ) { @@ -2363,7 +2331,7 @@ void EditEngine::RemoveFields( sal_Bool bKeepFieldText, TypeId aType ) const SvxFieldData* pFldData = ((const SvxFieldItem*)pAttr->GetItem())->GetField(); if ( pFldData && ( !aType || ( pFldData->IsA( aType ) ) ) ) { - DBG_ASSERT( pAttr->GetItem()->ISA( SvxFieldItem ), "Kein FeldItem..." ); + DBG_ASSERT( pAttr->GetItem()->ISA( SvxFieldItem ), "no field item..." ); EditSelection aSel( EditPaM( pNode, pAttr->GetStart() ), EditPaM( pNode, pAttr->GetEnd() ) ); String aFieldText = ((EditCharAttribField*)pAttr)->GetFieldValue(); pImpEditEngine->ImpInsertText( aSel, aFieldText ); @@ -2399,7 +2367,7 @@ void EditEngine::CompleteOnlineSpelling() } } -USHORT EditEngine::FindParagraph( long nDocPosY ) +sal_uInt16 EditEngine::FindParagraph( long nDocPosY ) { return pImpEditEngine->GetParaPortions().FindParagraph( nDocPosY ); } @@ -2408,7 +2376,7 @@ EPosition EditEngine::FindDocPosition( const Point& rDocPos ) const { EPosition aPos; // From the point of the API, this is const.... - EditPaM aPaM = ((EditEngine*)this)->pImpEditEngine->GetPaM( rDocPos, FALSE ); + EditPaM aPaM = ((EditEngine*)this)->pImpEditEngine->GetPaM( rDocPos, sal_False ); if ( aPaM.GetNode() ) { aPos.nPara = pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() ); @@ -2422,7 +2390,7 @@ Rectangle EditEngine::GetCharacterBounds( const EPosition& rPos ) const Rectangle aBounds; ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( rPos.nPara ); - // #109151# Check against index, not paragraph + // Check against index, not paragraph if ( pNode && ( rPos.nIndex < pNode->Len() ) ) { aBounds = pImpEditEngine->PaMtoEditCursor( EditPaM( pNode, rPos.nIndex ), GETCRSR_TXTONLY ); @@ -2437,7 +2405,7 @@ ParagraphInfos EditEngine::GetParagraphInfos( sal_uInt16 nPara ) { DBG_CHKTHIS( EditEngine, 0 ); - // Funktioniert nur, wenn nicht bereits in der Formatierung... + // This only works if not already in the format ... if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); @@ -2451,7 +2419,7 @@ ParagraphInfos EditEngine::GetParagraphInfos( sal_uInt16 nPara ) DBG_ASSERT( pParaPortion && pLine, "GetParagraphInfos - Paragraph out of range" ); if ( pParaPortion && pLine ) { - aInfos.nParaHeight = (USHORT)pParaPortion->GetHeight(); + aInfos.nParaHeight = (sal_uInt16)pParaPortion->GetHeight(); aInfos.nLines = pParaPortion->GetLines().Count(); aInfos.nFirstLineStartX = pLine->GetStartPosX(); aInfos.nFirstLineOffset = pParaPortion->GetFirstLineOffset(); @@ -2472,10 +2440,10 @@ ParagraphInfos EditEngine::GetParagraphInfos( sal_uInt16 nPara ) } // ===================================================================== -// ====================== Virtuelle Methoden ======================= +// ====================== Virtual Methods ======================== // ===================================================================== -void __EXPORT EditEngine::DrawingText( const Point&, const XubString&, USHORT, USHORT, - const sal_Int32*, const SvxFont&, sal_uInt16, sal_uInt16, BYTE, +void EditEngine::DrawingText( const Point&, const XubString&, sal_uInt16, sal_uInt16, + const sal_Int32*, const SvxFont&, sal_uInt16, sal_uInt16, sal_uInt8, const EEngineData::WrongSpellVector*, const SvxFieldData*, bool, bool, bool, const ::com::sun::star::lang::Locale*, const Color&, const Color&) @@ -2483,22 +2451,22 @@ void __EXPORT EditEngine::DrawingText( const Point&, const XubString&, USHORT, U DBG_CHKTHIS( EditEngine, 0 ); } -void __EXPORT EditEngine::DrawingTab( const Point& /*rStartPos*/, long /*nWidth*/, +void EditEngine::DrawingTab( const Point& /*rStartPos*/, long /*nWidth*/, const String& /*rChar*/, const SvxFont& /*rFont*/, - USHORT /*nPara*/, xub_StrLen /*nIndex*/, - BYTE /*nRightToLeft*/, bool /*bEndOfLine*/, + sal_uInt16 /*nPara*/, xub_StrLen /*nIndex*/, + sal_uInt8 /*nRightToLeft*/, bool /*bEndOfLine*/, bool /*bEndOfParagraph*/, const Color& /*rOverlineColor*/, const Color& /*rTextLineColor*/) { DBG_CHKTHIS( EditEngine, 0 ); } -void __EXPORT EditEngine::PaintingFirstLine( sal_uInt16, const Point&, long, const Point&, short, OutputDevice* ) +void EditEngine::PaintingFirstLine( sal_uInt16, const Point&, long, const Point&, short, OutputDevice* ) { DBG_CHKTHIS( EditEngine, 0 ); } -void __EXPORT EditEngine::ParagraphInserted( sal_uInt16 nPara ) +void EditEngine::ParagraphInserted( sal_uInt16 nPara ) { DBG_CHKTHIS( EditEngine, 0 ); @@ -2511,7 +2479,7 @@ void __EXPORT EditEngine::ParagraphInserted( sal_uInt16 nPara ) } } -void __EXPORT EditEngine::ParagraphDeleted( sal_uInt16 nPara ) +void EditEngine::ParagraphDeleted( sal_uInt16 nPara ) { DBG_CHKTHIS( EditEngine, 0 ); @@ -2523,29 +2491,29 @@ void __EXPORT EditEngine::ParagraphDeleted( sal_uInt16 nPara ) pImpEditEngine->CallNotify( aNotify ); } } -void EditEngine::ParagraphConnected( USHORT /*nLeftParagraph*/, USHORT /*nRightParagraph*/ ) +void EditEngine::ParagraphConnected( sal_uInt16 /*nLeftParagraph*/, sal_uInt16 /*nRightParagraph*/ ) { DBG_CHKTHIS( EditEngine, 0 ); } -sal_Bool __EXPORT EditEngine::FormattingParagraph( sal_uInt16 ) +sal_Bool EditEngine::FormattingParagraph( sal_uInt16 ) { - // return sal_True, wenn die Attribute geaendert wurden... + // return sal_True, if the Attribute was changed ... DBG_CHKTHIS( EditEngine, 0 ); return sal_False; } -void __EXPORT EditEngine::ParaAttribsChanged( sal_uInt16 /* nParagraph */ ) +void EditEngine::ParaAttribsChanged( sal_uInt16 /* nParagraph */ ) { DBG_CHKTHIS( EditEngine, 0 ); } -void __EXPORT EditEngine::StyleSheetChanged( SfxStyleSheet* /* pStyle */ ) +void EditEngine::StyleSheetChanged( SfxStyleSheet* /* pStyle */ ) { DBG_CHKTHIS( EditEngine, 0 ); } -void __EXPORT EditEngine::ParagraphHeightChanged( sal_uInt16 nPara ) +void EditEngine::ParagraphHeightChanged( sal_uInt16 nPara ) { DBG_CHKTHIS( EditEngine, 0 ); @@ -2558,7 +2526,7 @@ void __EXPORT EditEngine::ParagraphHeightChanged( sal_uInt16 nPara ) } } -XubString __EXPORT EditEngine::GetUndoComment( sal_uInt16 nId ) const +XubString EditEngine::GetUndoComment( sal_uInt16 nId ) const { DBG_CHKTHIS( EditEngine, 0 ); XubString aComment; @@ -2616,24 +2584,24 @@ Rectangle EditEngine::GetBulletArea( sal_uInt16 ) return Rectangle( Point(), Point() ); } -XubString __EXPORT EditEngine::CalcFieldValue( const SvxFieldItem&, sal_uInt16, sal_uInt16, Color*&, Color*& ) +XubString EditEngine::CalcFieldValue( const SvxFieldItem&, sal_uInt16, sal_uInt16, Color*&, Color*& ) { DBG_CHKTHIS( EditEngine, 0 ); return ' '; } -void __EXPORT EditEngine::FieldClicked( const SvxFieldItem&, sal_uInt16, sal_uInt16 ) +void EditEngine::FieldClicked( const SvxFieldItem&, sal_uInt16, sal_uInt16 ) { DBG_CHKTHIS( EditEngine, 0 ); } -void __EXPORT EditEngine::FieldSelected( const SvxFieldItem&, sal_uInt16, sal_uInt16 ) +void EditEngine::FieldSelected( const SvxFieldItem&, sal_uInt16, sal_uInt16 ) { DBG_CHKTHIS( EditEngine, 0 ); } -// ===================================================================== -// ====================== Statische Methoden ======================= +// ===================================================================== +// ====================== Static Methods ======================= // ===================================================================== SfxItemPool* EditEngine::CreatePool( sal_Bool bPersistentRefCounts ) { @@ -2693,7 +2661,7 @@ void EditEngine::SetFontInfoInItemSet( SfxItemSet& rSet, const SvxFont& rFont ) rSet.Put( SvxCharReliefItem( rFont.GetRelief(), EE_CHAR_RELIEF ) ); } -Font EditEngine::CreateFontFromItemSet( const SfxItemSet& rItemSet, USHORT nScriptType ) +Font EditEngine::CreateFontFromItemSet( const SfxItemSet& rItemSet, sal_uInt16 nScriptType ) { SvxFont aFont; CreateFont( aFont, rItemSet, true, nScriptType ); @@ -2750,7 +2718,7 @@ sal_Bool EditEngine::DoesKeyChangeText( const KeyEvent& rKeyEvent ) case KEYFUNC_CUT: case KEYFUNC_PASTE: bDoesChange = sal_True; break; - default: // wird dann evtl. unten bearbeitet. + default: // is then possibly edited below. eFunc = KEYFUNC_DONTKNOW; } } @@ -2788,99 +2756,15 @@ sal_Bool EditEngine::IsSimpleCharInput( const KeyEvent& rKeyEvent ) return sal_False; } -// Mal in den Outliner schieben... +// should be moved to the Outliner... void EditEngine::ImportBulletItem( SvxNumBulletItem& /*rNumBullet*/, sal_uInt16 /*nLevel*/, const SvxBulletItem* /*pOldBullet*/, const SvxLRSpaceItem* /*pOldLRSpace*/ ) { -/* TL_NFLR - if ( pOldBullet || pOldLRSpace ) - { - // Numberformat dynamisch, weil Zuweisungsoperator nicht implementiert. - - // Altes NumBulletItem nur uebernehmen, wenn kein altes BulletItem - const SvxNumberFormat* pFmt = ( !pOldBullet && ( rNumBullet.GetNumRule()->GetLevelCount() > nLevel ) ) ? - rNumBullet.GetNumRule()->Get( nLevel ) : NULL; - SvxNumberFormat* pNumberFormat = pFmt - ? new SvxNumberFormat( *pFmt ) - : new SvxNumberFormat( SVX_NUM_NUMBER_NONE ); - if ( pOldBullet ) - { - // Style - SvxExtNumType eNumType; - switch( pOldBullet->GetStyle() ) - { - case BS_BMP: eNumType = SVX_NUM_BITMAP; break; - case BS_BULLET: eNumType = SVX_NUM_CHAR_SPECIAL; break; - case BS_ROMAN_BIG: eNumType = SVX_NUM_ROMAN_UPPER; break; - case BS_ROMAN_SMALL: eNumType = SVX_NUM_ROMAN_LOWER; break; - case BS_ABC_BIG: eNumType = SVX_NUM_CHARS_UPPER_LETTER; break; - case BS_ABC_SMALL: eNumType = SVX_NUM_CHARS_LOWER_LETTER; break; - case BS_123: eNumType = SVX_NUM_ARABIC; break; - default: eNumType = SVX_NUM_NUMBER_NONE; break; - } - pNumberFormat->SetNumberingType( - sal::static_int_cast< sal_Int16 >( eNumType ) ); - - // Justification - SvxAdjust eAdjust; - switch( pOldBullet->GetJustification() & (BJ_HRIGHT|BJ_HCENTER|BJ_HLEFT) ) - { - case BJ_HRIGHT: eAdjust = SVX_ADJUST_RIGHT; break; - case BJ_HCENTER: eAdjust = SVX_ADJUST_CENTER; break; - default: eAdjust = SVX_ADJUST_LEFT; break; - } - pNumberFormat->SetNumAdjust(eAdjust); - - // Prefix/Suffix - pNumberFormat->SetPrefix( pOldBullet->GetPrevText() ); - pNumberFormat->SetSuffix( pOldBullet->GetFollowText() ); - - //Font - if ( eNumType != SVX_NUM_BITMAP ) - { - Font aTmpFont = pOldBullet->GetFont(); - pNumberFormat->SetBulletFont( &aTmpFont ); - } - - // Color - pNumberFormat->SetBulletColor( pOldBullet->GetFont().GetColor() ); - - // Start - pNumberFormat->SetStart( pOldBullet->GetStart() ); - - // Scale - pNumberFormat->SetBulletRelSize( pOldBullet->GetScale() ); - - // Bullet/Bitmap - if( eNumType == SVX_NUM_CHAR_SPECIAL ) - { - pNumberFormat->SetBulletChar( pOldBullet->GetSymbol() ); - } - else if( eNumType == SVX_NUM_BITMAP ) - { - SvxBrushItem aBItem( Graphic( pOldBullet->GetBitmap() ), GPOS_NONE, SID_ATTR_BRUSH ); - pNumberFormat->SetGraphicBrush( &aBItem ); - } - } - - // Einzug und Erstzeileneinzug -//TL_NFLR if ( pOldLRSpace ) -//TL_NFLR { -//TL_NFLR short nLSpace = (short)pOldLRSpace->GetTxtLeft(); -//TL_NFLR pNumberFormat->SetLSpace( nLSpace ); -//TL_NFLR pNumberFormat->SetAbsLSpace( nLSpace ); -//TL_NFLR pNumberFormat->SetFirstLineOffset( pOldLRSpace->GetTxtFirstLineOfst() ); -//TL_NFLR } - - rNumBullet.GetNumRule()->SetLevel( nLevel, *pNumberFormat ); - delete pNumberFormat; - } -*/ } -BOOL EditEngine::HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable ) +sal_Bool EditEngine::HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable ) { - BOOL bValidData = FALSE; + sal_Bool bValidData = sal_False; if ( rTransferable.is() ) { @@ -2915,27 +2799,24 @@ Link EditEngine::GetEndDropHdl() const return pImpEditEngine->GetEndDropHdl(); } -void EditEngine::SetFirstWordCapitalization( BOOL bCapitalize ) +void EditEngine::SetFirstWordCapitalization( sal_Bool bCapitalize ) { pImpEditEngine->SetFirstWordCapitalization( bCapitalize ); } -BOOL EditEngine::IsFirstWordCapitalization() const +sal_Bool EditEngine::IsFirstWordCapitalization() const { return pImpEditEngine->IsFirstWordCapitalization(); } -// --------------------------------------------------- - - EFieldInfo::EFieldInfo() { pFieldItem = NULL; } -EFieldInfo::EFieldInfo( const SvxFieldItem& rFieldItem, USHORT nPara, USHORT nPos ) : aPosition( nPara, nPos ) +EFieldInfo::EFieldInfo( const SvxFieldItem& rFieldItem, sal_uInt16 nPara, sal_uInt16 nPos ) : aPosition( nPara, nPos ) { pFieldItem = new SvxFieldItem( rFieldItem ); } diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 5f5ced939e..b6aa52a043 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -59,7 +59,7 @@ DBG_NAME( XEditAttribute ) //-------------------------------------------------------------- -BOOL lcl_CreateBulletItem( const SvxNumBulletItem& rNumBullet, USHORT nLevel, SvxBulletItem& rBullet ) +sal_Bool lcl_CreateBulletItem( const SvxNumBulletItem& rNumBullet, sal_uInt16 nLevel, SvxBulletItem& rBullet ) { const SvxNumberFormat* pFmt = rNumBullet.GetNumRule()->Get( nLevel ); if ( pFmt ) @@ -111,14 +111,14 @@ BOOL lcl_CreateBulletItem( const SvxNumBulletItem& rNumBullet, USHORT nLevel, Sv rBullet.SetStyle( BS_BULLET ); break; case SVX_NUM_PAGEDESC: - DBG_ERROR( "Unknown: SVX_NUM_PAGEDESC" ); + OSL_FAIL( "Unknown: SVX_NUM_PAGEDESC" ); rBullet.SetStyle( BS_BULLET ); break; case SVX_NUM_BITMAP: rBullet.SetStyle( BS_BMP ); break; default: - DBG_ERROR( "Unknown NumType" ); + OSL_FAIL( "Unknown NumType" ); } switch ( pFmt->GetNumAdjust() ) @@ -133,16 +133,16 @@ BOOL lcl_CreateBulletItem( const SvxNumBulletItem& rNumBullet, USHORT nLevel, Sv rBullet.SetJustification( BJ_VCENTER|BJ_HCENTER ); break; default: - DBG_ERROR( "Unknown or invalid NumAdjust" ); + OSL_FAIL( "Unknown or invalid NumAdjust" ); } } - return pFmt ? TRUE : FALSE; + return pFmt ? sal_True : sal_False; } -XEditAttribute* MakeXEditAttribute( SfxItemPool& rPool, const SfxPoolItem& rItem, USHORT nStart, USHORT nEnd ) +XEditAttribute* MakeXEditAttribute( SfxItemPool& rPool, const SfxPoolItem& rItem, sal_uInt16 nStart, sal_uInt16 nEnd ) { - // das neue Attribut im Pool anlegen + // Create thw new attribute in the pool const SfxPoolItem& rNew = rPool.Put( rItem ); XEditAttribute* pNew = new XEditAttribute( rNew, nStart, nEnd ); @@ -158,7 +158,7 @@ XEditAttribute::XEditAttribute( const SfxPoolItem& rAttr ) nEnd = 0; } -XEditAttribute::XEditAttribute( const SfxPoolItem& rAttr, USHORT nS, USHORT nE ) +XEditAttribute::XEditAttribute( const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE ) { DBG_CTOR( XEditAttribute, 0 ); pItem = &rAttr; @@ -169,12 +169,12 @@ XEditAttribute::XEditAttribute( const SfxPoolItem& rAttr, USHORT nS, USHORT nE ) XEditAttribute::~XEditAttribute() { DBG_DTOR( XEditAttribute, 0 ); - pItem = 0; // Gehoert dem Pool. + pItem = 0; // belongs to the Pool. } -XEditAttribute* XEditAttributeList::FindAttrib( USHORT _nWhich, USHORT nChar ) const +XEditAttribute* XEditAttributeList::FindAttrib( sal_uInt16 _nWhich, sal_uInt16 nChar ) const { - for ( USHORT n = Count(); n; ) + for ( sal_uInt16 n = Count(); n; ) { XEditAttribute* pAttr = GetObject( --n ); if( ( pAttr->GetItem()->Which() == _nWhich ) && ( pAttr->GetStart() <= nChar ) && ( pAttr->GetEnd() > nChar ) ) @@ -187,72 +187,46 @@ ContentInfo::ContentInfo( SfxItemPool& rPool ) : aParaAttribs( rPool, EE_PARA_ST { eFamily = SFX_STYLE_FAMILY_PARA; pWrongs = NULL; -/* cl removed because not needed anymore since binfilter - pTempLoadStoreInfos = NULL; -*/ } -// Richtiger CopyCTOR unsinning, weil ich mit einem anderen Pool arbeiten muss! +// the real Copy constructor is nonsens, since I have to work with another Pool! ContentInfo::ContentInfo( const ContentInfo& rCopyFrom, SfxItemPool& rPoolToUse ) : aParaAttribs( rPoolToUse, EE_PARA_START, EE_CHAR_END ) { pWrongs = NULL; -/* cl removed because not needed anymore since binfilter - pTempLoadStoreInfos = NULL; -*/ + if ( rCopyFrom.GetWrongList() ) pWrongs = rCopyFrom.GetWrongList()->Clone(); - // So sollten die Items im richtigen Pool landen! + // this should ensure that the Items end up in the correct Pool! aParaAttribs.Set( rCopyFrom.GetParaAttribs() ); aText = rCopyFrom.GetText(); aStyle = rCopyFrom.GetStyle(); eFamily = rCopyFrom.GetFamily(); - // Attribute kopieren... - for ( USHORT n = 0; n < rCopyFrom.GetAttribs().Count(); n++ ) + for ( sal_uInt16 n = 0; n < rCopyFrom.GetAttribs().Count(); n++ ) { XEditAttribute* pAttr = rCopyFrom.GetAttribs().GetObject( n ); XEditAttribute* pMyAttr = MakeXEditAttribute( rPoolToUse, *pAttr->GetItem(), pAttr->GetStart(), pAttr->GetEnd() ); aAttribs.Insert( pMyAttr, aAttribs.Count() ); } - // Wrongs pWrongs = NULL; -#ifndef SVX_LIGHT if ( rCopyFrom.GetWrongList() ) pWrongs = rCopyFrom.GetWrongList()->Clone(); -#endif // !SVX_LIGHT } ContentInfo::~ContentInfo() { - for ( USHORT nAttr = 0; nAttr < aAttribs.Count(); nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < aAttribs.Count(); nAttr++ ) { XEditAttribute* pAttr = aAttribs.GetObject(nAttr); - // Item aus Pool entfernen! aParaAttribs.GetPool()->Remove( *pAttr->GetItem() ); delete pAttr; } aAttribs.Remove( 0, aAttribs.Count() ); -#ifndef SVX_LIGHT delete pWrongs; -#endif -} - -/* cl removed because not needed anymore since binfilter -void ContentInfo::CreateLoadStoreTempInfos() -{ - delete pTempLoadStoreInfos; - pTempLoadStoreInfos = new LoadStoreTempInfos; } -void ContentInfo::DestroyLoadStoreTempInfos() -{ - delete pTempLoadStoreInfos; - pTempLoadStoreInfos = NULL; -} -*/ - // #i102062# bool ContentInfo::isWrongListEqual(const ContentInfo& rCompare) const { @@ -273,10 +247,10 @@ bool ContentInfo::operator==( const ContentInfo& rCompare ) const (eFamily == rCompare.eFamily ) && (aParaAttribs == rCompare.aParaAttribs ) ) { - const USHORT nCount = aAttribs.Count(); + const sal_uInt16 nCount = aAttribs.Count(); if( nCount == rCompare.aAttribs.Count() ) { - USHORT n; + sal_uInt16 n; for( n = 0; n < nCount; n++ ) { if( !(*aAttribs.GetObject(n) == *rCompare.aAttribs.GetObject(n)) ) @@ -290,7 +264,7 @@ bool ContentInfo::operator==( const ContentInfo& rCompare ) const return false; } -EditTextObject::EditTextObject( USHORT n) +EditTextObject::EditTextObject( sal_uInt16 n) { DBG_CTOR( EE_EditTextObject, 0 ); nWhich = n; @@ -302,221 +276,218 @@ EditTextObject::EditTextObject( const EditTextObject& r ) nWhich = r.nWhich; } -__EXPORT EditTextObject::~EditTextObject() +EditTextObject::~EditTextObject() { DBG_DTOR( EE_EditTextObject, 0 ); } -USHORT EditTextObject::GetParagraphCount() const +sal_uInt16 EditTextObject::GetParagraphCount() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return 0; } -XubString EditTextObject::GetText( USHORT /* nParagraph */ ) const +XubString EditTextObject::GetText( sal_uInt16 /* nParagraph */ ) const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return XubString(); } -void EditTextObject::Insert( const EditTextObject& /* rObj */, USHORT /* nPara */) +void EditTextObject::Insert( const EditTextObject& /* rObj */, sal_uInt16 /* nPara */) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -EditTextObject* EditTextObject::CreateTextObject( USHORT /*nPara*/, USHORT /*nParas*/ ) const +EditTextObject* EditTextObject::CreateTextObject( sal_uInt16 /*nPara*/, sal_uInt16 /*nParas*/ ) const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return 0; } -void EditTextObject::RemoveParagraph( USHORT /*nPara*/ ) +void EditTextObject::RemoveParagraph( sal_uInt16 /*nPara*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -BOOL EditTextObject::HasPortionInfo() const +sal_Bool EditTextObject::HasPortionInfo() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); - return FALSE; + OSL_FAIL( "Virtual method direct from EditTextObject!" ); + return sal_False; } void EditTextObject::ClearPortionInfo() { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -BOOL EditTextObject::HasOnlineSpellErrors() const +sal_Bool EditTextObject::HasOnlineSpellErrors() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); - return FALSE; + OSL_FAIL( "Virtual method direct from EditTextObject!" ); + return sal_False; } -BOOL EditTextObject::HasCharAttribs( USHORT ) const +sal_Bool EditTextObject::HasCharAttribs( sal_uInt16 ) const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); - return FALSE; + OSL_FAIL( "Virtual method direct from EditTextObject!" ); + return sal_False; } -void EditTextObject::GetCharAttribs( USHORT /*nPara*/, EECharAttribArray& /*rLst*/ ) const +void EditTextObject::GetCharAttribs( sal_uInt16 /*nPara*/, EECharAttribArray& /*rLst*/ ) const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -void EditTextObject::MergeParaAttribs( const SfxItemSet& /*rAttribs*/, USHORT /*nStart*/, USHORT /*nEnd*/ ) +void EditTextObject::MergeParaAttribs( const SfxItemSet& /*rAttribs*/, sal_uInt16 /*nStart*/, sal_uInt16 /*nEnd*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -BOOL EditTextObject::IsFieldObject() const +sal_Bool EditTextObject::IsFieldObject() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); - return FALSE; + OSL_FAIL( "Virtual method direct from EditTextObject!" ); + return sal_False; } const SvxFieldItem* EditTextObject::GetField() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return 0; } -BOOL EditTextObject::HasField( TypeId /*aType*/ ) const +sal_Bool EditTextObject::HasField( TypeId /*aType*/ ) const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); - return FALSE; + OSL_FAIL( "Virtual method direct from EditTextObject!" ); + return sal_False; } -SfxItemSet EditTextObject::GetParaAttribs( USHORT /*nPara*/ ) const +SfxItemSet EditTextObject::GetParaAttribs( sal_uInt16 /*nPara*/ ) const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return SfxItemSet( *(SfxItemPool*)NULL ); } -void EditTextObject::SetParaAttribs( USHORT /*nPara*/, const SfxItemSet& /*rAttribs*/ ) +void EditTextObject::SetParaAttribs( sal_uInt16 /*nPara*/, const SfxItemSet& /*rAttribs*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -BOOL EditTextObject::RemoveCharAttribs( USHORT /*nWhich*/ ) +sal_Bool EditTextObject::RemoveCharAttribs( sal_uInt16 /*nWhich*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); - return FALSE; + OSL_FAIL( "Virtual method direct from EditTextObject!" ); + return sal_False; } -BOOL EditTextObject::RemoveParaAttribs( USHORT /*nWhich*/ ) +sal_Bool EditTextObject::RemoveParaAttribs( sal_uInt16 /*nWhich*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); - return FALSE; + OSL_FAIL( "Virtual method direct from EditTextObject!" ); + return sal_False; } -BOOL EditTextObject::HasStyleSheet( const XubString& /*rName*/, SfxStyleFamily /*eFamily*/ ) const +sal_Bool EditTextObject::HasStyleSheet( const XubString& /*rName*/, SfxStyleFamily /*eFamily*/ ) const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); - return FALSE; + OSL_FAIL( "Virtual method direct from EditTextObject!" ); + return sal_False; } -void EditTextObject::GetStyleSheet( USHORT /*nPara*/, XubString& /*rName*/, SfxStyleFamily& /*eFamily*/ ) const +void EditTextObject::GetStyleSheet( sal_uInt16 /*nPara*/, XubString& /*rName*/, SfxStyleFamily& /*eFamily*/ ) const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -void EditTextObject::SetStyleSheet( USHORT /*nPara*/, const XubString& /*rName*/, const SfxStyleFamily& /*eFamily*/ ) +void EditTextObject::SetStyleSheet( sal_uInt16 /*nPara*/, const XubString& /*rName*/, const SfxStyleFamily& /*eFamily*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -BOOL __EXPORT EditTextObject::ChangeStyleSheets( const XubString&, SfxStyleFamily, +sal_Bool EditTextObject::ChangeStyleSheets( const XubString&, SfxStyleFamily, const XubString&, SfxStyleFamily ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); - return FALSE; + OSL_FAIL( "Virtual method direct from EditTextObject!" ); + return sal_False; } -void __EXPORT EditTextObject::ChangeStyleSheetName( SfxStyleFamily /*eFamily*/, +void EditTextObject::ChangeStyleSheetName( SfxStyleFamily /*eFamily*/, const XubString& /*rOldName*/, const XubString& /*rNewName*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -USHORT EditTextObject::GetUserType() const +sal_uInt16 EditTextObject::GetUserType() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return 0; } -void EditTextObject::SetUserType( USHORT ) +void EditTextObject::SetUserType( sal_uInt16 ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -ULONG EditTextObject::GetObjectSettings() const +sal_uLong EditTextObject::GetObjectSettings() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return 0; } -void EditTextObject::SetObjectSettings( ULONG ) +void EditTextObject::SetObjectSettings( sal_uLong ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -BOOL EditTextObject::IsVertical() const +sal_Bool EditTextObject::IsVertical() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); - return FALSE; + OSL_FAIL( "Virtual method direct from EditTextObject!" ); + return sal_False; } -void EditTextObject::SetVertical( BOOL bVertical ) +void EditTextObject::SetVertical( sal_Bool bVertical ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); ((BinTextObject*)this)->SetVertical( bVertical ); } -USHORT EditTextObject::GetScriptType() const +sal_uInt16 EditTextObject::GetScriptType() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return ((const BinTextObject*)this)->GetScriptType(); } -BOOL EditTextObject::Store( SvStream& rOStream ) const +sal_Bool EditTextObject::Store( SvStream& rOStream ) const { if ( rOStream.GetError() ) - return FALSE; + return sal_False; - // Vorspann: sal_Size nStartPos = rOStream.Tell(); - rOStream << (USHORT)Which(); + rOStream << (sal_uInt16)Which(); sal_uInt32 nStructSz = 0; rOStream << nStructSz; - // Eigene Daten: StoreData( rOStream ); - // Nachspann: sal_Size nEndPos = rOStream.Tell(); nStructSz = nEndPos - nStartPos - sizeof( nWhich ) - sizeof( nStructSz ); rOStream.Seek( nStartPos + sizeof( nWhich ) ); rOStream << nStructSz; rOStream.Seek( nEndPos ); - return rOStream.GetError() ? FALSE : TRUE; + return rOStream.GetError() ? sal_False : sal_True; } EditTextObject* EditTextObject::Create( SvStream& rIStream, SfxItemPool* pGlobalTextObjectPool ) { - ULONG nStartPos = rIStream.Tell(); + sal_uLong nStartPos = rIStream.Tell(); - // Ertmal sehen, was fuer ein Object... - USHORT nWhich; + // First check what type of Object... + sal_uInt16 nWhich; rIStream >> nWhich; sal_uInt32 nStructSz; rIStream >> nStructSz; - DBG_ASSERT( ( nWhich == 0x22 /*EE_FORMAT_BIN300*/ ) || ( nWhich == EE_FORMAT_BIN ), "CreateTextObject: Unbekanntes Objekt!" ); + DBG_ASSERT( ( nWhich == 0x22 /*EE_FORMAT_BIN300*/ ) || ( nWhich == EE_FORMAT_BIN ), "CreateTextObject: Unknown Object!" ); if ( rIStream.GetError() ) return NULL; @@ -532,12 +503,12 @@ EditTextObject* EditTextObject::Create( SvStream& rIStream, SfxItemPool* pGlobal break; default: { - // Wenn ich das Format nicht kenne, ueberlese ich den Inhalt: + // If I do not know the format, I overwrite the contents: rIStream.SetError( EE_READWRITE_WRONGFORMAT ); } } - // Sicherstellen, dass der Stream an der richtigen Stelle hinterlassen wird. + // Make sure that the stream is left at the correct place. sal_Size nFullSz = sizeof( nWhich ) + sizeof( nStructSz ) + nStructSz; rIStream.Seek( nStartPos + nFullSz ); return pTxtObj; @@ -547,7 +518,7 @@ void EditTextObject::Skip( SvStream& rIStream ) { sal_Size nStartPos = rIStream.Tell(); - USHORT _nWhich; + sal_uInt16 _nWhich; rIStream >> _nWhich; sal_uInt32 nStructSz; @@ -557,19 +528,19 @@ void EditTextObject::Skip( SvStream& rIStream ) rIStream.Seek( nStartPos + nFullSz ); } -void __EXPORT EditTextObject::StoreData( SvStream& ) const +void EditTextObject::StoreData( SvStream& ) const { - DBG_ERROR( "StoreData: Basisklasse!" ); + OSL_FAIL( "StoreData: Base class!" ); } -void __EXPORT EditTextObject::CreateData( SvStream& ) +void EditTextObject::CreateData( SvStream& ) { - DBG_ERROR( "CreateData: Basisklasse!" ); + OSL_FAIL( "CreateData: Base class!" ); } -USHORT EditTextObject::GetVersion() const +sal_uInt16 EditTextObject::GetVersion() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return 0; } @@ -613,7 +584,7 @@ void BinTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool) // set local variables pPool = pNewPool; - bOwnerOfPool = TRUE; + bOwnerOfPool = sal_True; } } @@ -654,12 +625,12 @@ BinTextObject::BinTextObject( SfxItemPool* pP ) : if ( pPool ) { - bOwnerOfPool = FALSE; + bOwnerOfPool = sal_False; } else { pPool = EditEngine::CreatePool(); - bOwnerOfPool = TRUE; + bOwnerOfPool = sal_True; } if(!bOwnerOfPool && pPool) @@ -668,8 +639,8 @@ BinTextObject::BinTextObject( SfxItemPool* pP ) : pPool->AddSfxItemPoolUser(*this); } - bVertical = FALSE; - bStoreUnicodeStrings = FALSE; + bVertical = sal_False; + bStoreUnicodeStrings = sal_False; nScriptType = 0; } @@ -683,8 +654,8 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : nObjSettings = r.nObjSettings; bVertical = r.bVertical; nScriptType = r.nScriptType; - pPortionInfo = NULL; // PortionInfo nicht kopieren - bStoreUnicodeStrings = FALSE; + pPortionInfo = NULL; // Do not copy PortionInfo + bStoreUnicodeStrings = sal_False; if ( !r.bOwnerOfPool ) { @@ -692,12 +663,12 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : // since there is no other way to construct a BinTextObject // than it's regular constructor where that is ensured pPool = r.pPool; - bOwnerOfPool = FALSE; + bOwnerOfPool = sal_False; } else { pPool = EditEngine::CreatePool(); - bOwnerOfPool = TRUE; + bOwnerOfPool = sal_True; } @@ -710,7 +681,7 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : if ( bOwnerOfPool && pPool && r.pPool ) pPool->SetDefaultMetric( r.pPool->GetMetric( DEF_METRIC ) ); - for ( USHORT n = 0; n < r.aContents.Count(); n++ ) + for ( sal_uInt16 n = 0; n < r.aContents.Count(); n++ ) { ContentInfo* pOrg = r.aContents.GetObject( n ); DBG_ASSERT( pOrg, "NULL-Pointer in ContentList!" ); @@ -719,7 +690,7 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : } } -__EXPORT BinTextObject::~BinTextObject() +BinTextObject::~BinTextObject() { if(!bOwnerOfPool && pPool) { @@ -730,39 +701,36 @@ __EXPORT BinTextObject::~BinTextObject() DeleteContents(); if ( bOwnerOfPool ) { - // Nicht mehr, wegen 1xDefItems. - // siehe auch ~EditDoc(). -// pPool->ReleaseDefaults( TRUE /* bDelete */ ); SfxItemPool::Free(pPool); } } -USHORT BinTextObject::GetUserType() const +sal_uInt16 BinTextObject::GetUserType() const { return nUserType; } -void BinTextObject::SetUserType( USHORT n ) +void BinTextObject::SetUserType( sal_uInt16 n ) { nUserType = n; } -ULONG BinTextObject::GetObjectSettings() const +sal_uLong BinTextObject::GetObjectSettings() const { return nObjSettings; } -void BinTextObject::SetObjectSettings( ULONG n ) +void BinTextObject::SetObjectSettings( sal_uLong n ) { nObjSettings = n; } -BOOL BinTextObject::IsVertical() const +sal_Bool BinTextObject::IsVertical() const { return bVertical; } -void BinTextObject::SetVertical( BOOL b ) +void BinTextObject::SetVertical( sal_Bool b ) { if ( b != bVertical ) { @@ -771,12 +739,12 @@ void BinTextObject::SetVertical( BOOL b ) } } -USHORT BinTextObject::GetScriptType() const +sal_uInt16 BinTextObject::GetScriptType() const { return nScriptType; } -void BinTextObject::SetScriptType( USHORT nType ) +void BinTextObject::SetScriptType( sal_uInt16 nType ) { nScriptType = nType; } @@ -784,7 +752,7 @@ void BinTextObject::SetScriptType( USHORT nType ) void BinTextObject::DeleteContents() { - for ( USHORT n = 0; n < aContents.Count(); n++ ) + for ( sal_uInt16 n = 0; n < aContents.Count(); n++ ) { ContentInfo* p = aContents.GetObject( n ); DBG_ASSERT( p, "NULL-Pointer in ContentList!" ); @@ -793,12 +761,12 @@ void BinTextObject::DeleteContents() aContents.Remove( 0, aContents.Count() ); } -EditTextObject* __EXPORT BinTextObject::Clone() const +EditTextObject* BinTextObject::Clone() const { return new BinTextObject( *this ); } -XEditAttribute* BinTextObject::CreateAttrib( const SfxPoolItem& rItem, USHORT nStart, USHORT nEnd ) +XEditAttribute* BinTextObject::CreateAttrib( const SfxPoolItem& rItem, sal_uInt16 nStart, sal_uInt16 nEnd ) { return MakeXEditAttribute( *pPool, rItem, nStart, nEnd ); } @@ -816,14 +784,14 @@ ContentInfo* BinTextObject::CreateAndInsertContent() return pC; } -USHORT BinTextObject::GetParagraphCount() const +sal_uInt16 BinTextObject::GetParagraphCount() const { return aContents.Count(); } -XubString BinTextObject::GetText( USHORT nPara ) const +XubString BinTextObject::GetText( sal_uInt16 nPara ) const { - DBG_ASSERT( nPara < aContents.Count(), "BinTextObject::GetText: Absatz existiert nicht!" ); + DBG_ASSERT( nPara < aContents.Count(), "BinTextObject::GetText: Paragraph does not exist!" ); if ( nPara < aContents.Count() ) { ContentInfo* pC = aContents[ nPara ]; @@ -832,17 +800,17 @@ XubString BinTextObject::GetText( USHORT nPara ) const return XubString(); } -void BinTextObject::Insert( const EditTextObject& rObj, USHORT nDestPara ) +void BinTextObject::Insert( const EditTextObject& rObj, sal_uInt16 nDestPara ) { - DBG_ASSERT( rObj.Which() == EE_FORMAT_BIN, "UTO: Unbekanntes Textobjekt" ); + DBG_ASSERT( rObj.Which() == EE_FORMAT_BIN, "UTO: unknown Textobjekt" ); const BinTextObject& rBinObj = (const BinTextObject&)rObj; if ( nDestPara > aContents.Count() ) nDestPara = aContents.Count(); - const USHORT nParas = rBinObj.GetContents().Count(); - for ( USHORT nP = 0; nP < nParas; nP++ ) + const sal_uInt16 nParas = rBinObj.GetContents().Count(); + for ( sal_uInt16 nP = 0; nP < nParas; nP++ ) { ContentInfo* pC = rBinObj.GetContents()[ nP ]; ContentInfo* pNew = new ContentInfo( *pC, *GetPool() ); @@ -851,12 +819,12 @@ void BinTextObject::Insert( const EditTextObject& rObj, USHORT nDestPara ) ClearPortionInfo(); } -EditTextObject* BinTextObject::CreateTextObject( USHORT nPara, USHORT nParas ) const +EditTextObject* BinTextObject::CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas ) const { if ( ( nPara >= aContents.Count() ) || !nParas ) return NULL; - // Pool nur teilen, wenn von aussen eingestellter Pool. + // Only split the Pool, when a the Pool is set externally. BinTextObject* pObj = new BinTextObject( bOwnerOfPool ? 0 : pPool ); if ( bOwnerOfPool && pPool ) pObj->GetPool()->SetDefaultMetric( pPool->GetMetric( DEF_METRIC ) ); @@ -865,8 +833,8 @@ EditTextObject* BinTextObject::CreateTextObject( USHORT nPara, USHORT nParas ) c // If text contains different ScriptTypes, this shouldn't be a problem... pObj->nScriptType = nScriptType; - const USHORT nEndPara = nPara+nParas-1; - for ( USHORT nP = nPara; nP <= nEndPara; nP++ ) + const sal_uInt16 nEndPara = nPara+nParas-1; + for ( sal_uInt16 nP = nPara; nP <= nEndPara; nP++ ) { ContentInfo* pC = aContents[ nP ]; ContentInfo* pNew = new ContentInfo( *pC, *pObj->GetPool() ); @@ -875,9 +843,9 @@ EditTextObject* BinTextObject::CreateTextObject( USHORT nPara, USHORT nParas ) c return pObj; } -void BinTextObject::RemoveParagraph( USHORT nPara ) +void BinTextObject::RemoveParagraph( sal_uInt16 nPara ) { - DBG_ASSERT( nPara < aContents.Count(), "BinTextObject::GetText: Absatz existiert nicht!" ); + DBG_ASSERT( nPara < aContents.Count(), "BinTextObject::GetText: Paragraph does not exist!" ); if ( nPara < aContents.Count() ) { ContentInfo* pC = aContents[ nPara ]; @@ -887,63 +855,61 @@ void BinTextObject::RemoveParagraph( USHORT nPara ) } } -BOOL BinTextObject::HasPortionInfo() const +sal_Bool BinTextObject::HasPortionInfo() const { - return pPortionInfo ? TRUE : FALSE; + return pPortionInfo ? sal_True : sal_False; } void BinTextObject::ClearPortionInfo() { if ( pPortionInfo ) { - for ( USHORT n = pPortionInfo->Count(); n; ) + for ( sal_uInt16 n = pPortionInfo->Count(); n; ) delete pPortionInfo->GetObject( --n ); delete pPortionInfo; pPortionInfo = NULL; } } -BOOL BinTextObject::HasOnlineSpellErrors() const +sal_Bool BinTextObject::HasOnlineSpellErrors() const { -#ifndef SVX_LIGHT - for ( USHORT n = 0; n < aContents.Count(); n++ ) + for ( sal_uInt16 n = 0; n < aContents.Count(); n++ ) { ContentInfo* p = aContents.GetObject( n ); if ( p->GetWrongList() && p->GetWrongList()->Count() ) - return TRUE; + return sal_True; } -#endif // !SVX_LIGHT - return FALSE; + return sal_False; } -BOOL BinTextObject::HasCharAttribs( USHORT _nWhich ) const +sal_Bool BinTextObject::HasCharAttribs( sal_uInt16 _nWhich ) const { - for ( USHORT nPara = GetContents().Count(); nPara; ) + for ( sal_uInt16 nPara = GetContents().Count(); nPara; ) { ContentInfo* pC = GetContents().GetObject( --nPara ); - USHORT nAttribs = pC->GetAttribs().Count(); + sal_uInt16 nAttribs = pC->GetAttribs().Count(); if ( nAttribs && !_nWhich ) - return TRUE; + return sal_True; - for ( USHORT nAttr = nAttribs; nAttr; ) + for ( sal_uInt16 nAttr = nAttribs; nAttr; ) { XEditAttribute* pX = pC->GetAttribs().GetObject( --nAttr ); if ( pX->GetItem()->Which() == _nWhich ) - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } -void BinTextObject::GetCharAttribs( USHORT nPara, EECharAttribArray& rLst ) const +void BinTextObject::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const { rLst.Remove( 0, rLst.Count() ); ContentInfo* pC = GetContents().GetObject( nPara ); if ( pC ) { - for ( USHORT nAttr = 0; nAttr < pC->GetAttribs().Count(); nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < pC->GetAttribs().Count(); nAttr++ ) { XEditAttribute* pAttr = pC->GetAttribs().GetObject( nAttr ); EECharAttrib aEEAttr; @@ -956,21 +922,21 @@ void BinTextObject::GetCharAttribs( USHORT nPara, EECharAttribArray& rLst ) cons } } -void BinTextObject::MergeParaAttribs( const SfxItemSet& rAttribs, USHORT nStart, USHORT nEnd ) +void BinTextObject::MergeParaAttribs( const SfxItemSet& rAttribs, sal_uInt16 nStart, sal_uInt16 nEnd ) { - BOOL bChanged = FALSE; + sal_Bool bChanged = sal_False; - for ( USHORT nPara = GetContents().Count(); nPara; ) + for ( sal_uInt16 nPara = GetContents().Count(); nPara; ) { ContentInfo* pC = GetContents().GetObject( --nPara ); - for ( USHORT nW = nStart; nW <= nEnd; nW++ ) + for ( sal_uInt16 nW = nStart; nW <= nEnd; nW++ ) { - if ( ( pC->GetParaAttribs().GetItemState( nW, FALSE ) != SFX_ITEM_ON ) - && ( rAttribs.GetItemState( nW, FALSE ) == SFX_ITEM_ON ) ) + if ( ( pC->GetParaAttribs().GetItemState( nW, sal_False ) != SFX_ITEM_ON ) + && ( rAttribs.GetItemState( nW, sal_False ) == SFX_ITEM_ON ) ) { pC->GetParaAttribs().Put( rAttribs.Get( nW ) ); - bChanged = TRUE; + bChanged = sal_True; } } } @@ -979,9 +945,9 @@ void BinTextObject::MergeParaAttribs( const SfxItemSet& rAttribs, USHORT nStart, ClearPortionInfo(); } -BOOL BinTextObject::IsFieldObject() const +sal_Bool BinTextObject::IsFieldObject() const { - return BinTextObject::GetField() ? TRUE : FALSE; + return BinTextObject::GetField() ? sal_True : sal_False; } const SvxFieldItem* BinTextObject::GetField() const @@ -991,8 +957,8 @@ const SvxFieldItem* BinTextObject::GetField() const ContentInfo* pC = GetContents()[0]; if ( pC->GetText().Len() == 1 ) { - USHORT nAttribs = pC->GetAttribs().Count(); - for ( USHORT nAttr = nAttribs; nAttr; ) + sal_uInt16 nAttribs = pC->GetAttribs().Count(); + for ( sal_uInt16 nAttr = nAttribs; nAttr; ) { XEditAttribute* pX = pC->GetAttribs().GetObject( --nAttr ); if ( pX->GetItem()->Which() == EE_FEATURE_FIELD ) @@ -1003,59 +969,59 @@ const SvxFieldItem* BinTextObject::GetField() const return 0; } -BOOL BinTextObject::HasField( TypeId aType ) const +sal_Bool BinTextObject::HasField( TypeId aType ) const { - USHORT nParagraphs = GetContents().Count(); - for ( USHORT nPara = 0; nPara < nParagraphs; nPara++ ) + sal_uInt16 nParagraphs = GetContents().Count(); + for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ ) { ContentInfo* pC = GetContents().GetObject( nPara ); - USHORT nAttrs = pC->GetAttribs().Count(); - for ( USHORT nAttr = 0; nAttr < nAttrs; nAttr++ ) + sal_uInt16 nAttrs = pC->GetAttribs().Count(); + for ( sal_uInt16 nAttr = 0; nAttr < nAttrs; nAttr++ ) { XEditAttribute* pAttr = pC->GetAttribs()[nAttr]; if ( pAttr->GetItem()->Which() == EE_FEATURE_FIELD ) { if ( !aType ) - return TRUE; + return sal_True; const SvxFieldData* pFldData = ((const SvxFieldItem*)pAttr->GetItem())->GetField(); if ( pFldData && pFldData->IsA( aType ) ) - return TRUE; + return sal_True; } } } - return FALSE; + return sal_False; } -SfxItemSet BinTextObject::GetParaAttribs( USHORT nPara ) const +SfxItemSet BinTextObject::GetParaAttribs( sal_uInt16 nPara ) const { ContentInfo* pC = GetContents().GetObject( nPara ); return pC->GetParaAttribs(); } -void BinTextObject::SetParaAttribs( USHORT nPara, const SfxItemSet& rAttribs ) +void BinTextObject::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rAttribs ) { ContentInfo* pC = GetContents().GetObject( nPara ); pC->GetParaAttribs().Set( rAttribs ); ClearPortionInfo(); } -BOOL BinTextObject::RemoveCharAttribs( USHORT _nWhich ) +sal_Bool BinTextObject::RemoveCharAttribs( sal_uInt16 _nWhich ) { - BOOL bChanged = FALSE; + sal_Bool bChanged = sal_False; - for ( USHORT nPara = GetContents().Count(); nPara; ) + for ( sal_uInt16 nPara = GetContents().Count(); nPara; ) { ContentInfo* pC = GetContents().GetObject( --nPara ); - for ( USHORT nAttr = pC->GetAttribs().Count(); nAttr; ) + for ( sal_uInt16 nAttr = pC->GetAttribs().Count(); nAttr; ) { XEditAttribute* pAttr = pC->GetAttribs().GetObject( --nAttr ); if ( !_nWhich || ( pAttr->GetItem()->Which() == _nWhich ) ) { pC->GetAttribs().Remove( nAttr ); DestroyAttrib( pAttr ); - bChanged = TRUE; + bChanged = sal_True; } } } @@ -1066,18 +1032,18 @@ BOOL BinTextObject::RemoveCharAttribs( USHORT _nWhich ) return bChanged; } -BOOL BinTextObject::RemoveParaAttribs( USHORT _nWhich ) +sal_Bool BinTextObject::RemoveParaAttribs( sal_uInt16 _nWhich ) { - BOOL bChanged = FALSE; + sal_Bool bChanged = sal_False; - for ( USHORT nPara = GetContents().Count(); nPara; ) + for ( sal_uInt16 nPara = GetContents().Count(); nPara; ) { ContentInfo* pC = GetContents().GetObject( --nPara ); if ( !_nWhich ) { if( pC->GetParaAttribs().Count() ) - bChanged = TRUE; + bChanged = sal_True; pC->GetParaAttribs().ClearItem(); } else @@ -1085,7 +1051,7 @@ BOOL BinTextObject::RemoveParaAttribs( USHORT _nWhich ) if ( pC->GetParaAttribs().GetItemState( _nWhich ) == SFX_ITEM_ON ) { pC->GetParaAttribs().ClearItem( _nWhich ); - bChanged = TRUE; + bChanged = sal_True; } } } @@ -1096,19 +1062,19 @@ BOOL BinTextObject::RemoveParaAttribs( USHORT _nWhich ) return bChanged; } -BOOL BinTextObject::HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const +sal_Bool BinTextObject::HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const { - USHORT nParagraphs = GetContents().Count(); - for ( USHORT nPara = 0; nPara < nParagraphs; nPara++ ) + sal_uInt16 nParagraphs = GetContents().Count(); + for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ ) { ContentInfo* pC = GetContents().GetObject( nPara ); if ( ( pC->GetFamily() == eFamily ) && ( pC->GetStyle() == rName ) ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -void BinTextObject::GetStyleSheet( USHORT nPara, XubString& rName, SfxStyleFamily& rFamily ) const +void BinTextObject::GetStyleSheet( sal_uInt16 nPara, XubString& rName, SfxStyleFamily& rFamily ) const { if ( nPara < aContents.Count() ) { @@ -1118,7 +1084,7 @@ void BinTextObject::GetStyleSheet( USHORT nPara, XubString& rName, SfxStyleFamil } } -void BinTextObject::SetStyleSheet( USHORT nPara, const XubString& rName, const SfxStyleFamily& rFamily ) +void BinTextObject::SetStyleSheet( sal_uInt16 nPara, const XubString& rName, const SfxStyleFamily& rFamily ) { if ( nPara < aContents.Count() ) { @@ -1128,14 +1094,14 @@ void BinTextObject::SetStyleSheet( USHORT nPara, const XubString& rName, const S } } -BOOL BinTextObject::ImpChangeStyleSheets( +sal_Bool BinTextObject::ImpChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily ) { - const USHORT nParagraphs = GetContents().Count(); - BOOL bChanges = FALSE; + const sal_uInt16 nParagraphs = GetContents().Count(); + sal_Bool bChanges = sal_False; - for ( USHORT nPara = 0; nPara < nParagraphs; nPara++ ) + for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ ) { ContentInfo* pC = GetContents().GetObject( nPara ); if ( pC->GetFamily() == eOldFamily ) @@ -1144,57 +1110,56 @@ BOOL BinTextObject::ImpChangeStyleSheets( { pC->GetStyle() = rNewName; pC->GetFamily() = eNewFamily; - bChanges = TRUE; + bChanges = sal_True; } } } return bChanges; } -BOOL __EXPORT BinTextObject::ChangeStyleSheets( +sal_Bool BinTextObject::ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily ) { - BOOL bChanges = ImpChangeStyleSheets( rOldName, eOldFamily, rNewName, eNewFamily ); + sal_Bool bChanges = ImpChangeStyleSheets( rOldName, eOldFamily, rNewName, eNewFamily ); if ( bChanges ) ClearPortionInfo(); return bChanges; } -void __EXPORT BinTextObject::ChangeStyleSheetName( SfxStyleFamily eFamily, +void BinTextObject::ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName ) { ImpChangeStyleSheets( rOldName, eFamily, rNewName, eFamily ); } -void __EXPORT BinTextObject::StoreData( SvStream& rOStream ) const +void BinTextObject::StoreData( SvStream& rOStream ) const { - USHORT nVer = 602; + sal_uInt16 nVer = 602; rOStream << nVer; rOStream << bOwnerOfPool; - // Erst den Pool speichern, spaeter nur noch Surregate + // First store the pool, later only the Surregate if ( bOwnerOfPool ) { GetPool()->SetFileFormatVersion( SOFFICE_FILEFORMAT_50 ); GetPool()->Store( rOStream ); } - // Aktuelle Zeichensatz speichern... - // #90477# GetSOStoreTextEncoding: Bug in 5.2, when default char set is multi byte text encoding - rtl_TextEncoding eEncoding = GetSOStoreTextEncoding( gsl_getSystemTextEncoding(), (USHORT) rOStream.GetVersion() ); - rOStream << (USHORT) eEncoding; + // Store Current text encoding ... + rtl_TextEncoding eEncoding = GetSOStoreTextEncoding( gsl_getSystemTextEncoding(), (sal_uInt16) rOStream.GetVersion() ); + rOStream << (sal_uInt16) eEncoding; - // Die Anzahl der Absaetze... - USHORT nParagraphs = GetContents().Count(); + // The number of paragraphs ... + sal_uInt16 nParagraphs = GetContents().Count(); rOStream << nParagraphs; char cFeatureConverted = ByteString( CH_FEATURE, eEncoding ).GetChar(0); - // Die einzelnen Absaetze... - for ( USHORT nPara = 0; nPara < nParagraphs; nPara++ ) + // The individual paragraphs ... + for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ ) { ContentInfo* pC = GetContents().GetObject( nPara ); @@ -1202,17 +1167,17 @@ void __EXPORT BinTextObject::StoreData( SvStream& rOStream ) const ByteString aText( pC->GetText(), eEncoding ); // Symbols? - BOOL bSymbolPara = FALSE; + sal_Bool bSymbolPara = sal_False; if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON ) { const SvxFontItem& rFontItem = (const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO ); if ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL ) { aText = ByteString( pC->GetText(), RTL_TEXTENCODING_SYMBOL ); - bSymbolPara = TRUE; + bSymbolPara = sal_True; } } - for ( USHORT nA = 0; nA < pC->GetAttribs().Count(); nA++ ) + for ( sal_uInt16 nA = 0; nA < pC->GetAttribs().Count(); nA++ ) { XEditAttribute* pAttr = pC->GetAttribs().GetObject( nA ); @@ -1229,13 +1194,13 @@ void __EXPORT BinTextObject::StoreData( SvStream& rOStream ) const aText.Insert( aNew, pAttr->GetStart() ); } - // #88414# Convert StarSymbol back to StarBats + // Convert StarSymbol back to StarBats FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FONTTOSUBSFONT_EXPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ); if ( hConv ) { // Don't create a new Attrib with StarBats font, MBR changed the // SvxFontItem::Store() to store StarBats instead of StarSymbol! - for ( USHORT nChar = pAttr->GetStart(); nChar < pAttr->GetEnd(); nChar++ ) + for ( sal_uInt16 nChar = pAttr->GetStart(); nChar < pAttr->GetEnd(); nChar++ ) { sal_Unicode cOld = pC->GetText().GetChar( nChar ); char cConv = ByteString::ConvertFromUnicode( ConvertFontToSubsFontChar( hConv, cOld ), RTL_TEXTENCODING_SYMBOL ); @@ -1248,7 +1213,7 @@ void __EXPORT BinTextObject::StoreData( SvStream& rOStream ) const } } - // #88414# Convert StarSymbol back to StarBats + // Convert StarSymbol back to StarBats // StarSymbol as paragraph attribute or in StyleSheet? FontToSubsFontConverter hConv = NULL; @@ -1256,16 +1221,9 @@ void __EXPORT BinTextObject::StoreData( SvStream& rOStream ) const { hConv = CreateFontToSubsFontConverter( ((const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO )).GetFamilyName(), FONTTOSUBSFONT_EXPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ); } -/* cl removed because not needed anymore since binfilter - - else if ( pC->GetStyle().Len() && pC->GetLoadStoreTempInfos() ) - { - hConv = pC->GetLoadStoreTempInfos()->hOldSymbolConv_Store; - } -*/ if ( hConv ) { - for ( USHORT nChar = 0; nChar < pC->GetText().Len(); nChar++ ) + for ( sal_uInt16 nChar = 0; nChar < pC->GetText().Len(); nChar++ ) { if ( !pC->GetAttribs().FindAttrib( EE_CHAR_FONTINFO, nChar ) ) { @@ -1285,21 +1243,21 @@ void __EXPORT BinTextObject::StoreData( SvStream& rOStream ) const aText.SearchAndReplaceAll( cFeatureConverted, CH_FEATURE_OLD ); rOStream.WriteByteString( aText ); - // StyleName und Family... + // StyleName and Family... rOStream.WriteByteString( ByteString( pC->GetStyle(), eEncoding ) ); - rOStream << (USHORT)pC->GetFamily(); + rOStream << (sal_uInt16)pC->GetFamily(); - // Absatzattribute... + // Paragraph attributes ... pC->GetParaAttribs().Store( rOStream ); - // Die Anzahl der Attribute... - USHORT nAttribs = pC->GetAttribs().Count(); + // The number of attributes ... + sal_uInt16 nAttribs = pC->GetAttribs().Count(); rOStream << nAttribs; - // Und die einzelnen Attribute - // Items als Surregate => immer 8 Byte pro Attrib + // And the individual attributes + // Items as Surregate => always 8 bytes per Attribute // Which = 2; Surregat = 2; Start = 2; End = 2; - for ( USHORT nAttr = 0; nAttr < nAttribs; nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ ) { XEditAttribute* pX = pC->GetAttribs().GetObject( nAttr ); @@ -1310,32 +1268,27 @@ void __EXPORT BinTextObject::StoreData( SvStream& rOStream ) const } } - // Ab 400: rOStream << nMetric; - // Ab 600 rOStream << nUserType; rOStream << nObjSettings; - // Ab 601 rOStream << bVertical; - - // Ab 602 rOStream << nScriptType; rOStream << bStoreUnicodeStrings; if ( bStoreUnicodeStrings ) { - for ( USHORT nPara = 0; nPara < nParagraphs; nPara++ ) + for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ ) { ContentInfo* pC = GetContents().GetObject( nPara ); - USHORT nL = pC->GetText().Len(); + sal_uInt16 nL = pC->GetText().Len(); rOStream << nL; rOStream.Write( pC->GetText().GetBuffer(), nL*sizeof(sal_Unicode) ); - // #91575# StyleSheetName must be Unicode too! + // StyleSheetName must be Unicode too! // Copy/Paste from EA3 to BETA or from BETA to EA3 not possible, not needed... - // If needed, change nL back to ULONG and increase version... + // If needed, change nL back to sal_uLong and increase version... nL = pC->GetStyle().Len(); rOStream << nL; rOStream.Write( pC->GetStyle().GetBuffer(), nL*sizeof(sal_Unicode) ); @@ -1343,72 +1296,70 @@ void __EXPORT BinTextObject::StoreData( SvStream& rOStream ) const } } -void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) +void BinTextObject::CreateData( SvStream& rIStream ) { rIStream >> nVersion; - // Das Textobject wurde erstmal mit der aktuellen Einstellung - // von pTextObjectPool erzeugt. - BOOL bOwnerOfCurrent = bOwnerOfPool; + // The text object was first created with the current setting of + // pTextObjectPool. + sal_Bool bOwnerOfCurrent = bOwnerOfPool; rIStream >> bOwnerOfPool; if ( bOwnerOfCurrent && !bOwnerOfPool ) { - // Es wurde ein globaler Pool verwendet, mir jetzt nicht uebergeben, - // aber ich brauche ihn! - DBG_ERROR( "Man gebe mir den globalen TextObjectPool!" ); + // A global Pool was used, but not handed over to me, but I need it! + OSL_FAIL( "Give me the global TextObjectPool!" ); return; } else if ( !bOwnerOfCurrent && bOwnerOfPool ) { - // Es soll ein globaler Pool verwendet werden, aber dieses - // Textobject hat einen eigenen. + // A global Pool should be used, but this Textobject has its own. pPool = EditEngine::CreatePool(); } if ( bOwnerOfPool ) GetPool()->Load( rIStream ); - // CharSet, in dem gespeichert wurde: - USHORT nCharSet; + // CharSet, in which it was saved: + sal_uInt16 nCharSet; rIStream >> nCharSet; - rtl_TextEncoding eSrcEncoding = GetSOLoadTextEncoding( (rtl_TextEncoding)nCharSet, (USHORT)rIStream.GetVersion() ); + rtl_TextEncoding eSrcEncoding = GetSOLoadTextEncoding( (rtl_TextEncoding)nCharSet, (sal_uInt16)rIStream.GetVersion() ); - // Die Anzahl der Absaetze... - USHORT nParagraphs; + // The number of paragraphs ... + sal_uInt16 nParagraphs; rIStream >> nParagraphs; - // Die einzelnen Absaetze... - for ( ULONG nPara = 0; nPara < nParagraphs; nPara++ ) + // The individual paragraphs ... + for ( sal_uLong nPara = 0; nPara < nParagraphs; nPara++ ) { ContentInfo* pC = CreateAndInsertContent(); - // Der Text... + // The Text... ByteString aByteString; rIStream.ReadByteString( aByteString ); pC->GetText() = String( aByteString, eSrcEncoding ); - // StyleName und Family... + // StyleName and Family... rIStream.ReadByteString( pC->GetStyle(), eSrcEncoding ); - USHORT nStyleFamily; + sal_uInt16 nStyleFamily; rIStream >> nStyleFamily; pC->GetFamily() = (SfxStyleFamily)nStyleFamily; - // Absatzattribute... + // Paragraph attributes ... pC->GetParaAttribs().Load( rIStream ); - // Die Anzahl der Attribute... - USHORT nAttribs; + // The number of attributes ... + sal_uInt16 nAttribs; rIStream >> nAttribs; - // Und die einzelnen Attribute - // Items als Surregate => immer 8 Byte pro Attrib + // And the individual attributes + // Items as Surregate => always 8 bytes per Attributes // Which = 2; Surregat = 2; Start = 2; End = 2; - USHORT nAttr; + sal_uInt16 nAttr; for ( nAttr = 0; nAttr < nAttribs; nAttr++ ) { - USHORT _nWhich, nStart, nEnd; + sal_uInt16 _nWhich, nStart, nEnd; const SfxPoolItem* pItem; rIStream >> _nWhich; @@ -1430,8 +1381,8 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) if ( ( _nWhich >= EE_FEATURE_START ) && ( _nWhich <= EE_FEATURE_END ) ) { // Convert CH_FEATURE to CH_FEATURE_OLD - DBG_ASSERT( (BYTE) aByteString.GetChar( nStart ) == CH_FEATURE_OLD, "CreateData: CH_FEATURE expected!" ); - if ( (BYTE) aByteString.GetChar( nStart ) == CH_FEATURE_OLD ) + DBG_ASSERT( (sal_uInt8) aByteString.GetChar( nStart ) == CH_FEATURE_OLD, "CreateData: CH_FEATURE expected!" ); + if ( (sal_uInt8) aByteString.GetChar( nStart ) == CH_FEATURE_OLD ) pC->GetText().SetChar( nStart, CH_FEATURE ); } } @@ -1441,14 +1392,14 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) // But check for paragraph and character symbol attribs here, // FinishLoad will not be called in OpenOffice Calc, no StyleSheets... - BOOL bSymbolPara = FALSE; + sal_Bool bSymbolPara = sal_False; if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON ) { const SvxFontItem& rFontItem = (const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO ); if ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL ) { pC->GetText() = String( aByteString, RTL_TEXTENCODING_SYMBOL ); - bSymbolPara = TRUE; + bSymbolPara = sal_True; } } @@ -1468,19 +1419,19 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) pC->GetText().Insert( aNew, pAttr->GetStart() ); } - // #88414# Convert StarMath and StarBats to StarSymbol + // Convert StarMath and StarBats to StarSymbol FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FONTTOSUBSFONT_IMPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ); if ( hConv ) { SvxFontItem aNewFontItem( rFontItem ); - aNewFontItem.GetFamilyName() = GetFontToSubsFontName( hConv ); + aNewFontItem.SetFamilyName( GetFontToSubsFontName( hConv ) ); pC->GetAttribs().Remove( nAttr ); XEditAttribute* pNewAttr = CreateAttrib( aNewFontItem, pAttr->GetStart(), pAttr->GetEnd() ); pC->GetAttribs().Insert( pNewAttr, nAttr ); DestroyAttrib( pAttr ); - for ( USHORT nChar = pNewAttr->GetStart(); nChar < pNewAttr->GetEnd(); nChar++ ) + for ( sal_uInt16 nChar = pNewAttr->GetStart(); nChar < pNewAttr->GetEnd(); nChar++ ) { sal_Unicode cOld = pC->GetText().GetChar( nChar ); DBG_ASSERT( cOld >= 0xF000, "cOld not converted?!" ); @@ -1495,7 +1446,7 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) } - // #88414# Convert StarMath and StarBats to StarSymbol + // Convert StarMath and StarBats to StarSymbol // Maybe old symbol font as paragraph attribute? if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON ) { @@ -1504,10 +1455,10 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) if ( hConv ) { SvxFontItem aNewFontItem( rFontItem ); - aNewFontItem.GetFamilyName() = GetFontToSubsFontName( hConv ); + aNewFontItem.SetFamilyName( GetFontToSubsFontName( hConv ) ); pC->GetParaAttribs().Put( aNewFontItem ); - for ( USHORT nChar = 0; nChar < pC->GetText().Len(); nChar++ ) + for ( sal_uInt16 nChar = 0; nChar < pC->GetText().Len(); nChar++ ) { if ( !pC->GetAttribs().FindAttrib( EE_CHAR_FONTINFO, nChar ) ) { @@ -1524,15 +1475,15 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) } } - // Ab 400 auch die DefMetric: + // From 400 also the DefMetric: if ( nVersion >= 400 ) { - USHORT nTmpMetric; + sal_uInt16 nTmpMetric; rIStream >> nTmpMetric; if ( nVersion >= 401 ) { - // In der 400 gab es noch einen Bug bei Textobjekten mit eigenem - // Pool, deshalb erst ab 401 auswerten. + // In the 400 there was a bug in text objects with the own Pool, + // therefore evaluate only from 401 nMetric = nTmpMetric; if ( bOwnerOfPool && pPool && ( nMetric != 0xFFFF ) ) pPool->SetDefaultMetric( (SfxMapUnit)nMetric ); @@ -1554,14 +1505,14 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) { rIStream >> nScriptType; - BOOL bUnicodeStrings; + sal_Bool bUnicodeStrings; rIStream >> bUnicodeStrings; if ( bUnicodeStrings ) { - for ( USHORT nPara = 0; nPara < nParagraphs; nPara++ ) + for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ ) { ContentInfo* pC = GetContents().GetObject( nPara ); - USHORT nL; + sal_uInt16 nL; // Text rIStream >> nL; @@ -1569,7 +1520,7 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) { pC->GetText().AllocBuffer( nL ); rIStream.Read( pC->GetText().GetBufferAccess(), nL*sizeof(sal_Unicode) ); - pC->GetText().ReleaseBufferAccess( (USHORT)nL ); + pC->GetText().ReleaseBufferAccess( (sal_uInt16)nL ); } // StyleSheetName @@ -1578,18 +1529,18 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) { pC->GetStyle().AllocBuffer( nL ); rIStream.Read( pC->GetStyle().GetBufferAccess(), nL*sizeof(sal_Unicode) ); - pC->GetStyle().ReleaseBufferAccess( (USHORT)nL ); + pC->GetStyle().ReleaseBufferAccess( (sal_uInt16)nL ); } } } } - // Ab 500 werden die Tabs anders interpretiert: TabPos + LI, vorher nur TabPos. - // Wirkt nur wenn auch Tab-Positionen eingestellt wurden, nicht beim DefTab. + // from 500 the tabs are interpreted differently: TabPos + LI, previously only TabPos. + // Works only if tab positions are set, not when DefTab. if ( nVersion < 500 ) { - for ( USHORT n = 0; n < aContents.Count(); n++ ) + for ( sal_uInt16 n = 0; n < aContents.Count(); n++ ) { ContentInfo* pC = aContents.GetObject( n ); const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&) pC->GetParaAttribs().Get( EE_PARA_LRSPACE ); @@ -1597,7 +1548,7 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) { const SvxTabStopItem& rTabs = (const SvxTabStopItem&) pC->GetParaAttribs().Get( EE_PARA_TABS ); SvxTabStopItem aNewTabs( 0, 0, SVX_TAB_ADJUST_LEFT, EE_PARA_TABS ); - for ( USHORT t = 0; t < rTabs.Count(); t++ ) + for ( sal_uInt16 t = 0; t < rTabs.Count(); t++ ) { const SvxTabStop& rT = rTabs[ t ]; aNewTabs.Insert( SvxTabStop( rT.GetTabPos() - rLRSpace.GetTxtLeft(), @@ -1609,7 +1560,7 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) } } -USHORT BinTextObject::GetVersion() const +sal_uInt16 BinTextObject::GetVersion() const { return nVersion; } @@ -1627,7 +1578,7 @@ bool BinTextObject::operator==( const BinTextObject& rCompare ) const ( bVertical != rCompare.bVertical ) ) return false; - USHORT n; + sal_uInt16 n; for( n = 0; n < aContents.Count(); n++ ) { if( !( *aContents.GetObject( n ) == *rCompare.aContents.GetObject( n ) ) ) @@ -1645,7 +1596,7 @@ bool BinTextObject::isWrongListEqual(const BinTextObject& rCompare) const return false; } - for(USHORT a(0); a < GetContents().Count(); a++) + for(sal_uInt16 a(0); a < GetContents().Count(); a++) { const ContentInfo& rCandA(*GetContents().GetObject(a)); const ContentInfo& rCandB(*rCompare.GetContents().GetObject(a)); @@ -1661,45 +1612,45 @@ bool BinTextObject::isWrongListEqual(const BinTextObject& rCompare) const #define CHARSETMARKER 0x9999 -void __EXPORT BinTextObject::CreateData300( SvStream& rIStream ) +void BinTextObject::CreateData300( SvStream& rIStream ) { - // Fuer Aufwaertskompatibilitaet. + // For forward compatibility. - // Erst den Pool laden... - // Ist in der 300 immer gespeichert worden! + // First load the Pool... + // Is always saved in the 300! GetPool()->Load( rIStream ); - // Die Anzahl der Absaetze... + // The number of paragraphs ... sal_uInt32 nParagraphs; rIStream >> nParagraphs; - // Die einzelnen Absaetze... - for ( ULONG nPara = 0; nPara < nParagraphs; nPara++ ) + // The individual paragraphs... + for ( sal_uLong nPara = 0; nPara < nParagraphs; nPara++ ) { ContentInfo* pC = CreateAndInsertContent(); - // Der Text... + // The Text... rIStream.ReadByteString( pC->GetText() ); - // StyleName und Family... + // StyleName and Family... rIStream.ReadByteString( pC->GetStyle() ); - USHORT nStyleFamily; + sal_uInt16 nStyleFamily; rIStream >> nStyleFamily; pC->GetFamily() = (SfxStyleFamily)nStyleFamily; - // Absatzattribute... + // Paragraph attributes ... pC->GetParaAttribs().Load( rIStream ); - // Die Anzahl der Attribute... + // The number of attributes ... sal_uInt32 nAttribs; rIStream >> nAttribs; - // Und die einzelnen Attribute - // Items als Surregate => immer 8 Byte pro Attrib + // And the individual attributes + // Items as Surregate => always 8 bytes per Attribute // Which = 2; Surregat = 2; Start = 2; End = 2; - for ( ULONG nAttr = 0; nAttr < nAttribs; nAttr++ ) + for ( sal_uLong nAttr = 0; nAttr < nAttribs; nAttr++ ) { - USHORT _nWhich, nStart, nEnd; + sal_uInt16 _nWhich, nStart, nEnd; const SfxPoolItem* pItem; rIStream >> _nWhich; @@ -1715,12 +1666,12 @@ void __EXPORT BinTextObject::CreateData300( SvStream& rIStream ) } } - // Prueffen, ob ein Zeichensatz gespeichert wurde - USHORT nCharSetMarker; + // Check whether a font was saved + sal_uInt16 nCharSetMarker; rIStream >> nCharSetMarker; if ( nCharSetMarker == CHARSETMARKER ) { - USHORT nCharSet; + sal_uInt16 nCharSet; rIStream >> nCharSet; } } diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index 74fa0b4c4e..f7bb04e91b 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -39,13 +39,13 @@ class SfxStyleSheetPool; class XEditAttribute { - friend class ContentInfo; // fuer DTOR - friend class BinTextObject; // fuer DTOR + friend class ContentInfo; // for destructor + friend class BinTextObject; // for destructor private: const SfxPoolItem* pItem; - USHORT nStart; - USHORT nEnd; + sal_uInt16 nStart; + sal_uInt16 nEnd; XEditAttribute(); XEditAttribute( const XEditAttribute& rCopyFrom ); @@ -54,19 +54,19 @@ private: public: XEditAttribute( const SfxPoolItem& rAttr ); - XEditAttribute( const SfxPoolItem& rAttr, USHORT nStart, USHORT nEnd ); + XEditAttribute( const SfxPoolItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); const SfxPoolItem* GetItem() const { return pItem; } - USHORT& GetStart() { return nStart; } - USHORT& GetEnd() { return nEnd; } + sal_uInt16& GetStart() { return nStart; } + sal_uInt16& GetEnd() { return nEnd; } - USHORT GetStart() const { return nStart; } - USHORT GetEnd() const { return nEnd; } + sal_uInt16 GetStart() const { return nStart; } + sal_uInt16 GetEnd() const { return nEnd; } - USHORT GetLen() const { return nEnd-nStart; } + sal_uInt16 GetLen() const { return nEnd-nStart; } - inline BOOL IsFeature(); + inline sal_Bool IsFeature(); inline bool operator==( const XEditAttribute& rCompare ); }; @@ -80,9 +80,9 @@ inline bool XEditAttribute::operator==( const XEditAttribute& rCompare ) (*pItem == *rCompare.pItem)); } -inline BOOL XEditAttribute::IsFeature() +inline sal_Bool XEditAttribute::IsFeature() { - USHORT nWhich = pItem->Which(); + sal_uInt16 nWhich = pItem->Which(); return ( ( nWhich >= EE_FEATURE_START ) && ( nWhich <= EE_FEATURE_END ) ); } @@ -93,13 +93,13 @@ SV_DECL_PTRARR( XEditAttributeListImpl, XEditAttributePtr, 0, 4 ) class XEditAttributeList : public XEditAttributeListImpl { public: - XEditAttribute* FindAttrib( USHORT nWhich, USHORT nChar ) const; + XEditAttribute* FindAttrib( sal_uInt16 nWhich, sal_uInt16 nChar ) const; }; struct XParaPortion { long nHeight; - USHORT nFirstLineOffset; + sal_uInt16 nFirstLineOffset; EditLineList aLines; TextPortionList aTextPortions; @@ -110,26 +110,26 @@ SV_DECL_PTRARR( XBaseParaPortionList, XParaPortionPtr, 0, 4 ) class XParaPortionList : public XBaseParaPortionList { - ULONG nRefDevPtr; + sal_uIntPtr nRefDevPtr; OutDevType eRefDevType; MapMode aRefMapMode; sal_uInt16 nStretchX; sal_uInt16 nStretchY; - ULONG nPaperWidth; + sal_uLong nPaperWidth; public: - XParaPortionList( OutputDevice* pRefDev, ULONG nPW, sal_uInt16 _nStretchX, sal_uInt16 _nStretchY ) : + XParaPortionList( OutputDevice* pRefDev, sal_uLong nPW, sal_uInt16 _nStretchX, sal_uInt16 _nStretchY ) : aRefMapMode( pRefDev->GetMapMode() ), nStretchX(_nStretchX), nStretchY(_nStretchY) { - nRefDevPtr = (ULONG)pRefDev; nPaperWidth = nPW; + nRefDevPtr = (sal_uIntPtr)pRefDev; nPaperWidth = nPW; eRefDevType = pRefDev->GetOutDevType(); } - ULONG GetRefDevPtr() const { return nRefDevPtr; } - ULONG GetPaperWidth() const { return nPaperWidth; } + sal_uIntPtr GetRefDevPtr() const { return nRefDevPtr; } + sal_uLong GetPaperWidth() const { return nPaperWidth; } OutDevType GetRefDevType() const { return eRefDevType; } const MapMode& GetRefMapMode() const { return aRefMapMode; } sal_uInt16 GetStretchX() const { return nStretchX; } @@ -142,10 +142,10 @@ struct LoadStoreTempInfos ByteString aOrgString_Load; FontToSubsFontConverter hOldSymbolConv_Store; - BOOL bSymbolParagraph_Store; + sal_Bool bSymbolParagraph_Store; - LoadStoreTempInfos() { bSymbolParagraph_Store = FALSE; hOldSymbolConv_Store = NULL; } + LoadStoreTempInfos() { bSymbolParagraph_Store = sal_False; hOldSymbolConv_Store = NULL; } }; */ @@ -161,10 +161,6 @@ private: SfxItemSet aParaAttribs; WrongList* pWrongs; -/* cl removed because not needed anymore since binfilter - LoadStoreTempInfos* pTempLoadStoreInfos; -*/ - ContentInfo( SfxItemPool& rPool ); ContentInfo( const ContentInfo& rCopyFrom, SfxItemPool& rPoolToUse ); @@ -194,8 +190,6 @@ public: typedef ContentInfo* ContentInfoPtr; SV_DECL_PTRARR( ContentInfoList, ContentInfoPtr, 1, 4 ) -// MT 05/00: Sollte mal direkt EditTextObjekt werden => keine virtuellen Methoden mehr. - class BinTextObject : public EditTextObject, public SfxItemPoolUser { using EditTextObject::operator==; @@ -204,23 +198,23 @@ class BinTextObject : public EditTextObject, public SfxItemPoolUser private: ContentInfoList aContents; SfxItemPool* pPool; - BOOL bOwnerOfPool; + sal_Bool bOwnerOfPool; XParaPortionList* pPortionInfo; sal_uInt32 nObjSettings; - USHORT nMetric; - USHORT nVersion; - USHORT nUserType; - USHORT nScriptType; + sal_uInt16 nMetric; + sal_uInt16 nVersion; + sal_uInt16 nUserType; + sal_uInt16 nScriptType; - BOOL bVertical; - BOOL bStoreUnicodeStrings; + sal_Bool bVertical; + sal_Bool bStoreUnicodeStrings; protected: void DeleteContents(); virtual void StoreData( SvStream& rOStream ) const; virtual void CreateData( SvStream& rIStream ); - BOOL ImpChangeStyleSheets( const String& rOldName, SfxStyleFamily eOldFamily, + sal_Bool ImpChangeStyleSheets( const String& rOldName, SfxStyleFamily eOldFamily, const String& rNewName, SfxStyleFamily eNewFamily ); public: @@ -230,22 +224,22 @@ public: virtual EditTextObject* Clone() const; - USHORT GetUserType() const; - void SetUserType( USHORT n ); + sal_uInt16 GetUserType() const; + void SetUserType( sal_uInt16 n ); - ULONG GetObjectSettings() const; - void SetObjectSettings( ULONG n ); + sal_uLong GetObjectSettings() const; + void SetObjectSettings( sal_uLong n ); - BOOL IsVertical() const; - void SetVertical( BOOL b ); + sal_Bool IsVertical() const; + void SetVertical( sal_Bool b ); - USHORT GetScriptType() const; - void SetScriptType( USHORT nType ); + sal_uInt16 GetScriptType() const; + void SetScriptType( sal_uInt16 nType ); - USHORT GetVersion() const; // Solange der Outliner keine Recordlaenge speichert + sal_uInt16 GetVersion() const; // As long as the outliner does not store any record length ContentInfo* CreateAndInsertContent(); - XEditAttribute* CreateAttrib( const SfxPoolItem& rItem, USHORT nStart, USHORT nEnd ); + XEditAttribute* CreateAttrib( const SfxPoolItem& rItem, sal_uInt16 nStart, sal_uInt16 nEnd ); void DestroyAttrib( XEditAttribute* pAttr ); ContentInfoList& GetContents() { return aContents; } @@ -255,53 +249,47 @@ public: void SetPortionInfo( XParaPortionList* pP ) { pPortionInfo = pP; } - virtual USHORT GetParagraphCount() const; - virtual String GetText( USHORT nParagraph ) const; - virtual void Insert( const EditTextObject& rObj, USHORT nPara ); - virtual EditTextObject* CreateTextObject( USHORT nPara, USHORT nParas = 1 ) const; - virtual void RemoveParagraph( USHORT nPara ); + virtual sal_uInt16 GetParagraphCount() const; + virtual String GetText( sal_uInt16 nParagraph ) const; + virtual void Insert( const EditTextObject& rObj, sal_uInt16 nPara ); + virtual EditTextObject* CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas = 1 ) const; + virtual void RemoveParagraph( sal_uInt16 nPara ); - virtual BOOL HasPortionInfo() const; + virtual sal_Bool HasPortionInfo() const; virtual void ClearPortionInfo(); - virtual BOOL HasOnlineSpellErrors() const; + virtual sal_Bool HasOnlineSpellErrors() const; - virtual BOOL HasCharAttribs( USHORT nWhich = 0 ) const; - virtual void GetCharAttribs( USHORT nPara, EECharAttribArray& rLst ) const; + virtual sal_Bool HasCharAttribs( sal_uInt16 nWhich = 0 ) const; + virtual void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const; - virtual BOOL RemoveCharAttribs( USHORT nWhich = 0 ); - virtual BOOL RemoveParaAttribs( USHORT nWhich = 0 ); + virtual sal_Bool RemoveCharAttribs( sal_uInt16 nWhich = 0 ); + virtual sal_Bool RemoveParaAttribs( sal_uInt16 nWhich = 0 ); - virtual void MergeParaAttribs( const SfxItemSet& rAttribs, USHORT nStart, USHORT nEnd ); + virtual void MergeParaAttribs( const SfxItemSet& rAttribs, sal_uInt16 nStart, sal_uInt16 nEnd ); - virtual BOOL IsFieldObject() const; + virtual sal_Bool IsFieldObject() const; virtual const SvxFieldItem* GetField() const; - virtual BOOL HasField( TypeId Type = NULL ) const; + virtual sal_Bool HasField( TypeId Type = NULL ) const; - SfxItemSet GetParaAttribs( USHORT nPara ) const; - void SetParaAttribs( USHORT nPara, const SfxItemSet& rAttribs ); + SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; + void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rAttribs ); - virtual BOOL HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const; - virtual void GetStyleSheet( USHORT nPara, XubString& rName, SfxStyleFamily& eFamily ) const; - virtual void SetStyleSheet( USHORT nPara, const XubString& rName, const SfxStyleFamily& eFamily ); - virtual BOOL ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, + virtual sal_Bool HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const; + virtual void GetStyleSheet( sal_uInt16 nPara, XubString& rName, SfxStyleFamily& eFamily ) const; + virtual void SetStyleSheet( sal_uInt16 nPara, const XubString& rName, const SfxStyleFamily& eFamily ); + virtual sal_Bool ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, const String& rNewName, SfxStyleFamily eNewFamily ); virtual void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName ); void CreateData300( SvStream& rIStream ); - BOOL HasMetric() const { return nMetric != 0xFFFF; } - USHORT GetMetric() const { return nMetric; } - void SetMetric( USHORT n ) { nMetric = n; } + sal_Bool HasMetric() const { return nMetric != 0xFFFF; } + sal_uInt16 GetMetric() const { return nMetric; } + void SetMetric( sal_uInt16 n ) { nMetric = n; } - BOOL IsOwnerOfPool() const { return bOwnerOfPool; } - void StoreUnicodeStrings( BOOL b ) { bStoreUnicodeStrings = b; } - -/* cl removed because not needed anymore since binfilter - void PrepareStore( SfxStyleSheetPool* pStyleSheetPool ); - void FinishStore(); - void FinishLoad( SfxStyleSheetPool* pStyleSheetPool ); -*/ + sal_Bool IsOwnerOfPool() const { return bOwnerOfPool; } + void StoreUnicodeStrings( sal_Bool b ) { bStoreUnicodeStrings = b; } bool operator==( const BinTextObject& rCompare ) const; diff --git a/editeng/source/editeng/editsel.cxx b/editeng/source/editeng/editsel.cxx index 4c26189582..6da806b243 100644 --- a/editeng/source/editeng/editsel.cxx +++ b/editeng/source/editeng/editsel.cxx @@ -43,47 +43,47 @@ EditSelFunctionSet::EditSelFunctionSet() pCurView = NULL; } -void __EXPORT EditSelFunctionSet::CreateAnchor() +void EditSelFunctionSet::CreateAnchor() { if ( pCurView ) pCurView->pImpEditView->CreateAnchor(); } -void __EXPORT EditSelFunctionSet::DestroyAnchor() +void EditSelFunctionSet::DestroyAnchor() { - // Nur bei Mehrfachselektion + // Only with multiple selection } -BOOL __EXPORT EditSelFunctionSet::SetCursorAtPoint( const Point& rPointPixel, BOOL ) +sal_Bool EditSelFunctionSet::SetCursorAtPoint( const Point& rPointPixel, sal_Bool ) { if ( pCurView ) return pCurView->pImpEditView->SetCursorAtPoint( rPointPixel ); - return FALSE; + return sal_False; } -BOOL __EXPORT EditSelFunctionSet::IsSelectionAtPoint( const Point& rPointPixel ) +sal_Bool EditSelFunctionSet::IsSelectionAtPoint( const Point& rPointPixel ) { if ( pCurView ) return pCurView->pImpEditView->IsSelectionAtPoint( rPointPixel ); - return FALSE; + return sal_False; } -void __EXPORT EditSelFunctionSet::DeselectAtPoint( const Point& ) +void EditSelFunctionSet::DeselectAtPoint( const Point& ) { // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -// ! Implementieren, wenn Mehrfachselektion moeglich ! +// ! Implement when multiple selection is possible ! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! } -void __EXPORT EditSelFunctionSet::BeginDrag() +void EditSelFunctionSet::BeginDrag() { - // Nur bei Mehrfachselektion + // Only with multiple selection } -void __EXPORT EditSelFunctionSet::DeselectAll() +void EditSelFunctionSet::DeselectAll() { if ( pCurView ) pCurView->pImpEditView->DeselectAll(); @@ -94,10 +94,8 @@ void __EXPORT EditSelFunctionSet::DeselectAll() // ---------------------------------------------------------------------- EditSelectionEngine::EditSelectionEngine() : SelectionEngine( (Window*)0 ) { - // Wegen Bug OV: (1994) - // 1995: RangeSelection lassen, SingleSelection nur fuer ListBoxen geeignet! SetSelectionMode( RANGE_SELECTION ); - EnableDrag( TRUE ); + EnableDrag( sal_True ); } void EditSelectionEngine::SetCurView( EditView* pNewView ) diff --git a/editeng/source/editeng/editsel.hxx b/editeng/source/editeng/editsel.hxx index 78e7a118b4..034d61cdb1 100644 --- a/editeng/source/editeng/editsel.hxx +++ b/editeng/source/editeng/editsel.hxx @@ -33,9 +33,6 @@ class EditView; -// ---------------------------------------------------------------------- -// class EditSelFunctionSet -// ---------------------------------------------------------------------- class EditSelFunctionSet: public FunctionSet { private: @@ -49,9 +46,9 @@ public: virtual void CreateAnchor(); virtual void DestroyAnchor(); - virtual BOOL SetCursorAtPoint( const Point& rPointPixel, BOOL bDontSelectAtCursor = FALSE ); + virtual sal_Bool SetCursorAtPoint( const Point& rPointPixel, sal_Bool bDontSelectAtCursor = sal_False ); - virtual BOOL IsSelectionAtPoint( const Point& rPointPixel ); + virtual sal_Bool IsSelectionAtPoint( const Point& rPointPixel ); virtual void DeselectAtPoint( const Point& rPointPixel ); virtual void DeselectAll(); @@ -59,9 +56,6 @@ public: EditView* GetCurView() { return pCurView; } }; -// ---------------------------------------------------------------------- -// class EditSelectionEngine -// ---------------------------------------------------------------------- class EditSelectionEngine : public SelectionEngine { private: diff --git a/editeng/source/editeng/editstt2.hxx b/editeng/source/editeng/editstt2.hxx index 3bab4db1b8..a992f21534 100644 --- a/editeng/source/editeng/editstt2.hxx +++ b/editeng/source/editeng/editstt2.hxx @@ -37,93 +37,93 @@ class InternalEditStatus : public EditStatus public: InternalEditStatus() { ; } - void TurnOnFlags( ULONG nFlags ) + void TurnOnFlags( sal_uLong nFlags ) { nControlBits |= nFlags; } - void TurnOffFlags( ULONG nFlags ) + void TurnOffFlags( sal_uLong nFlags ) { nControlBits &= ~nFlags; } - void TurnOnStatusBits( ULONG nBits ) + void TurnOnStatusBits( sal_uLong nBits ) { nStatusBits |= nBits; } - void TurnOffStatusBits( ULONG nBits ) + void TurnOffStatusBits( sal_uLong nBits ) { nStatusBits &= ~nBits; } - BOOL UseCharAttribs() const + sal_Bool UseCharAttribs() const { return ( ( nControlBits & EE_CNTRL_USECHARATTRIBS ) != 0 ); } - BOOL NotifyCursorMovements() const + sal_Bool NotifyCursorMovements() const { return ( ( nControlBits & EE_CNTRL_CRSRLEFTPARA ) != 0 ); } - BOOL UseIdleFormatter() const + sal_Bool UseIdleFormatter() const { return ( ( nControlBits & EE_CNTRL_DOIDLEFORMAT) != 0 ); } - BOOL AllowPasteSpecial() const + sal_Bool AllowPasteSpecial() const { return ( ( nControlBits & EE_CNTRL_PASTESPECIAL ) != 0 ); } - BOOL DoAutoIndenting() const + sal_Bool DoAutoIndenting() const { return ( ( nControlBits & EE_CNTRL_AUTOINDENTING ) != 0 ); } - BOOL DoUndoAttribs() const + sal_Bool DoUndoAttribs() const { return ( ( nControlBits & EE_CNTRL_UNDOATTRIBS ) != 0 ); } - BOOL OneCharPerLine() const + sal_Bool OneCharPerLine() const { return ( ( nControlBits & EE_CNTRL_ONECHARPERLINE ) != 0 ); } - BOOL IsOutliner() const + sal_Bool IsOutliner() const { return ( ( nControlBits & EE_CNTRL_OUTLINER ) != 0 ); } - BOOL IsOutliner2() const + sal_Bool IsOutliner2() const { return ( ( nControlBits & EE_CNTRL_OUTLINER2 ) != 0 ); } - BOOL IsAnyOutliner() const + sal_Bool IsAnyOutliner() const { return IsOutliner() || IsOutliner2(); } - BOOL DoNotUseColors() const + sal_Bool DoNotUseColors() const { return ( ( nControlBits & EE_CNTRL_NOCOLORS ) != 0 ); } - BOOL AllowBigObjects() const + sal_Bool AllowBigObjects() const { return ( ( nControlBits & EE_CNTRL_ALLOWBIGOBJS ) != 0 ); } - BOOL DoOnlineSpelling() const + sal_Bool DoOnlineSpelling() const { return ( ( nControlBits & EE_CNTRL_ONLINESPELLING ) != 0 ); } - BOOL DoStretch() const + sal_Bool DoStretch() const { return ( ( nControlBits & EE_CNTRL_STRETCHING ) != 0 ); } - BOOL AutoPageSize() const + sal_Bool AutoPageSize() const { return ( ( nControlBits & EE_CNTRL_AUTOPAGESIZE ) != 0 ); } - BOOL AutoPageWidth() const + sal_Bool AutoPageWidth() const { return ( ( nControlBits & EE_CNTRL_AUTOPAGESIZEX ) != 0 ); } - BOOL AutoPageHeight() const + sal_Bool AutoPageHeight() const { return ( ( nControlBits & EE_CNTRL_AUTOPAGESIZEY ) != 0 ); } - BOOL MarkFields() const + sal_Bool MarkFields() const { return ( ( nControlBits & EE_CNTRL_MARKFIELDS ) != 0 ); } - BOOL DoRestoreFont() const + sal_Bool DoRestoreFont() const { return ( ( nControlBits & EE_CNTRL_RESTOREFONT ) != 0 ); } - BOOL DoImportRTFStyleSheets() const + sal_Bool DoImportRTFStyleSheets() const { return ( ( nControlBits & EE_CNTRL_RTFSTYLESHEETS ) != 0 ); } - BOOL DoAutoCorrect() const + sal_Bool DoAutoCorrect() const { return ( ( nControlBits & EE_CNTRL_AUTOCORRECT ) != 0 ); } - BOOL DoAutoComplete() const + sal_Bool DoAutoComplete() const { return ( ( nControlBits & EE_CNTRL_AUTOCOMPLETE ) != 0 ); } - BOOL DoTabIndenting() const + sal_Bool DoTabIndenting() const { return ( ( nControlBits & EE_CNTRL_TABINDENTING ) != 0 ); } - BOOL DoFormat100() const + sal_Bool DoFormat100() const { return ( ( nControlBits & EE_CNTRL_FORMAT100 ) != 0 ); } - BOOL ULSpaceSummation() const + sal_Bool ULSpaceSummation() const { return ( ( nControlBits & EE_CNTRL_ULSPACESUMMATION ) != 0 ); } - BOOL ULSpaceFirstParagraph() const + sal_Bool ULSpaceFirstParagraph() const { return ( ( nControlBits & EE_CNTRL_ULSPACEFIRSTPARA ) != 0 ); } }; diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx index 79e1a6cf4f..d59bb93503 100644 --- a/editeng/source/editeng/editundo.cxx +++ b/editeng/source/editeng/editundo.cxx @@ -38,8 +38,8 @@ DBG_NAME( EditUndo ) -#define MAX_UNDOS 100 // ab dieser Menge darf geloescht werden.... -#define MIN_UNDOS 50 // soviel muss stehen bleiben... +#define MAX_UNDOS 100 // From this quantity it may be deleted .... +#define MIN_UNDOS 50 // so much has to be left ... #define NO_UNDO 0xFFFF #define GROUP_NOTFOUND 0xFFFF @@ -58,7 +58,7 @@ TYPEINIT1( EditUndoSetAttribs, EditUndo ); TYPEINIT1( EditUndoTransliteration, EditUndo ); TYPEINIT1( EditUndoMarkSelection, EditUndo ); -void lcl_DoSetSelection( EditView* pView, USHORT nPara ) +void lcl_DoSetSelection( EditView* pView, sal_uInt16 nPara ) { EPaM aEPaM( nPara, 0 ); EditPaM aPaM( pView->GetImpEditEngine()->CreateEditPaM( aEPaM ) ); @@ -67,18 +67,15 @@ void lcl_DoSetSelection( EditView* pView, USHORT nPara ) pView->GetImpEditView()->SetEditSelection( aSel ); } -// ----------------------------------------------------------------------- -// EditUndoManager -// ------------------------------------------------------------------------ EditUndoManager::EditUndoManager( ImpEditEngine* p ) { pImpEE = p; } -BOOL __EXPORT EditUndoManager::Undo( USHORT nCount ) +sal_Bool EditUndoManager::Undo() { if ( GetUndoActionCount() == 0 ) - return FALSE; + return sal_False; DBG_ASSERT( pImpEE->GetActiveView(), "Active View?" ); @@ -88,20 +85,20 @@ BOOL __EXPORT EditUndoManager::Undo( USHORT nCount ) pImpEE->SetActiveView( pImpEE->GetEditViews().GetObject(0) ); else { - DBG_ERROR( "Undo in Engine ohne View nicht moeglich!" ); - return FALSE; + OSL_FAIL("Undo in engine is not possible without a View! "); + return sal_False; } } - pImpEE->GetActiveView()->GetImpEditView()->DrawSelection(); // alte Selektion entfernen + pImpEE->GetActiveView()->GetImpEditView()->DrawSelection(); // Remove the old selection - pImpEE->SetUndoMode( TRUE ); - BOOL bDone = SfxUndoManager::Undo( nCount ); - pImpEE->SetUndoMode( FALSE ); + pImpEE->SetUndoMode( sal_True ); + sal_Bool bDone = SfxUndoManager::Undo(); + pImpEE->SetUndoMode( sal_False ); EditSelection aNewSel( pImpEE->GetActiveView()->GetImpEditView()->GetEditSelection() ); - DBG_ASSERT( !aNewSel.IsInvalid(), "Ungueltige Selektion nach Undo()" ); - DBG_ASSERT( !aNewSel.DbgIsBuggy( pImpEE->GetEditDoc() ), "Kaputte Selektion nach Undo()" ); + DBG_ASSERT( !aNewSel.IsInvalid(), "Invalid selection after Undo () "); + DBG_ASSERT( !aNewSel.DbgIsBuggy( pImpEE->GetEditDoc() ), "Broken selection afte Undo () "); aNewSel.Min() = aNewSel.Max(); pImpEE->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); @@ -110,10 +107,10 @@ BOOL __EXPORT EditUndoManager::Undo( USHORT nCount ) return bDone; } -BOOL __EXPORT EditUndoManager::Redo( USHORT nCount ) +sal_Bool EditUndoManager::Redo() { if ( GetRedoActionCount() == 0 ) - return FALSE; + return sal_False; DBG_ASSERT( pImpEE->GetActiveView(), "Active View?" ); @@ -123,20 +120,20 @@ BOOL __EXPORT EditUndoManager::Redo( USHORT nCount ) pImpEE->SetActiveView( pImpEE->GetEditViews().GetObject(0) ); else { - DBG_ERROR( "Redo in Engine ohne View nicht moeglich!" ); - return FALSE; + OSL_FAIL( "Redo in Engine ohne View nicht moeglich!" ); + return sal_False; } } - pImpEE->GetActiveView()->GetImpEditView()->DrawSelection(); // alte Selektion entfernen + pImpEE->GetActiveView()->GetImpEditView()->DrawSelection(); // Remove the old selection - pImpEE->SetUndoMode( TRUE ); - BOOL bDone = SfxUndoManager::Redo( nCount ); - pImpEE->SetUndoMode( FALSE ); + pImpEE->SetUndoMode( sal_True ); + sal_Bool bDone = SfxUndoManager::Redo(); + pImpEE->SetUndoMode( sal_False ); EditSelection aNewSel( pImpEE->GetActiveView()->GetImpEditView()->GetEditSelection() ); - DBG_ASSERT( !aNewSel.IsInvalid(), "Ungueltige Selektion nach Undo()" ); - DBG_ASSERT( !aNewSel.DbgIsBuggy( pImpEE->GetEditDoc() ), "Kaputte Selektion nach Redo()" ); + DBG_ASSERT( !aNewSel.IsInvalid(), "Invalid selection after Undo () "); + DBG_ASSERT( !aNewSel.DbgIsBuggy( pImpEE->GetEditDoc() ), "Broken selection afte Undo () "); aNewSel.Min() = aNewSel.Max(); pImpEE->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); @@ -145,10 +142,7 @@ BOOL __EXPORT EditUndoManager::Redo( USHORT nCount ) return bDone; } -// ----------------------------------------------------------------------- -// EditUndo -// ------------------------------------------------------------------------ -EditUndo::EditUndo( USHORT nI, ImpEditEngine* p ) +EditUndo::EditUndo( sal_uInt16 nI, ImpEditEngine* p ) { DBG_CTOR( EditUndo, 0 ); nId = nI; @@ -160,18 +154,18 @@ EditUndo::~EditUndo() DBG_DTOR( EditUndo, 0 ); } -USHORT __EXPORT EditUndo::GetId() const +sal_uInt16 EditUndo::GetId() const { DBG_CHKTHIS( EditUndo, 0 ); return nId; } -BOOL __EXPORT EditUndo::CanRepeat(SfxRepeatTarget&) const +sal_Bool EditUndo::CanRepeat(SfxRepeatTarget&) const { - return FALSE; + return sal_False; } -XubString __EXPORT EditUndo::GetComment() const +XubString EditUndo::GetComment() const { XubString aComment; if ( pImpEE ) @@ -182,15 +176,12 @@ XubString __EXPORT EditUndo::GetComment() const return aComment; } -// ----------------------------------------------------------------------- -// EditUndoDelContent -// ------------------------------------------------------------------------ -EditUndoDelContent::EditUndoDelContent( ImpEditEngine* _pImpEE, ContentNode* pNode, USHORT n ) +EditUndoDelContent::EditUndoDelContent( ImpEditEngine* _pImpEE, ContentNode* pNode, sal_uInt16 n ) : EditUndo( EDITUNDO_DELCONTENT, _pImpEE ) { pContentNode = pNode; nNode = n; - bDelObject = TRUE; + bDelObject = sal_True; } EditUndoDelContent::~EditUndoDelContent() @@ -199,35 +190,35 @@ EditUndoDelContent::~EditUndoDelContent() delete pContentNode; } -void __EXPORT EditUndoDelContent::Undo() +void EditUndoDelContent::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); GetImpEditEngine()->InsertContent( pContentNode, nNode ); - bDelObject = FALSE; // gehoert wieder der Engine + bDelObject = sal_False; // belongs to the Engine again EditSelection aSel( EditPaM( pContentNode, 0 ), EditPaM( pContentNode, pContentNode->Len() ) ); GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel ); } -void __EXPORT EditUndoDelContent::Redo() +void EditUndoDelContent::Redo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); ImpEditEngine* _pImpEE = GetImpEditEngine(); - // pNode stimmt nicht mehr, falls zwischendurch Undos, in denen - // Absaetze verschmolzen sind. + // pNode is no longer correct, if the paragraphs where merged + // in between Undos pContentNode = _pImpEE->GetEditDoc().SaveGetObject( nNode ); DBG_ASSERT( pContentNode, "EditUndoDelContent::Redo(): Node?!" ); delete _pImpEE->GetParaPortions()[nNode]; _pImpEE->GetParaPortions().Remove( nNode ); - // Node nicht loeschen, haengt im Undo! + // Do not delete node, depends on the undo! _pImpEE->GetEditDoc().Remove( nNode ); if( _pImpEE->IsCallParaInsertedOrDeleted() ) _pImpEE->GetEditEnginePtr()->ParagraphDeleted( nNode ); - DeletedNodeInfo* pInf = new DeletedNodeInfo( (ULONG)pContentNode, nNode ); + DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pContentNode, nNode ); _pImpEE->aDeletedNodes.Insert( pInf, _pImpEE->aDeletedNodes.Count() ); _pImpEE->UpdateSelections(); @@ -237,17 +228,14 @@ void __EXPORT EditUndoDelContent::Redo() DBG_ASSERT( pN && ( pN != pContentNode ), "?! RemoveContent !? " ); EditPaM aPaM( pN, pN->Len() ); - bDelObject = TRUE; // gehoert wieder dem Undo + bDelObject = sal_True; // belongs to the Engine again _pImpEE->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); } -// ----------------------------------------------------------------------- -// EditUndoConnectParas -// ------------------------------------------------------------------------ -EditUndoConnectParas::EditUndoConnectParas( ImpEditEngine* _pImpEE, USHORT nN, USHORT nSP, +EditUndoConnectParas::EditUndoConnectParas( ImpEditEngine* _pImpEE, sal_uInt16 nN, sal_uInt16 nSP, const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs, - const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, BOOL bBkwrd ) + const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, sal_Bool bBkwrd ) : EditUndo( EDITUNDO_CONNECTPARAS, _pImpEE ), aLeftParaAttribs( rLeftParaAttribs ), aRightParaAttribs( rRightParaAttribs ) @@ -273,16 +261,15 @@ EditUndoConnectParas::~EditUndoConnectParas() { } -void __EXPORT EditUndoConnectParas::Undo() +void EditUndoConnectParas::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); - // Bei SplitContent darf noch kein ParagraphInserted gerufen werden, - // weil der Outliner sich auf die Attribute verlaesst um die Tiefe - // des Absatzes zu initialisieren + // For SplitContent ParagraphInserted can not be called yet because the + // Outliner relies on the attributes to initialize the depth - BOOL bCall = GetImpEditEngine()->IsCallParaInsertedOrDeleted(); - GetImpEditEngine()->SetCallParaInsertedOrDeleted( FALSE ); + sal_Bool bCall = GetImpEditEngine()->IsCallParaInsertedOrDeleted(); + GetImpEditEngine()->SetCallParaInsertedOrDeleted( sal_False ); EditPaM aPaM = GetImpEditEngine()->SplitContent( nNode, nSepPos ); GetImpEditEngine()->SetParaAttribs( nNode, aLeftParaAttribs ); @@ -295,7 +282,7 @@ void __EXPORT EditUndoConnectParas::Undo() if ( GetImpEditEngine()->GetStyleSheetPool() ) { if ( aLeftStyleName.Len() ) - GetImpEditEngine()->SetStyleSheet( (USHORT)nNode, (SfxStyleSheet*)GetImpEditEngine()->GetStyleSheetPool()->Find( aLeftStyleName, eLeftStyleFamily ) ); + GetImpEditEngine()->SetStyleSheet( (sal_uInt16)nNode, (SfxStyleSheet*)GetImpEditEngine()->GetStyleSheetPool()->Find( aLeftStyleName, eLeftStyleFamily ) ); if ( aRightStyleName.Len() ) GetImpEditEngine()->SetStyleSheet( nNode+1, (SfxStyleSheet*)GetImpEditEngine()->GetStyleSheetPool()->Find( aRightStyleName, eRightStyleFamily ) ); } @@ -303,18 +290,15 @@ void __EXPORT EditUndoConnectParas::Undo() GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); } -void __EXPORT EditUndoConnectParas::Redo() +void EditUndoConnectParas::Redo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Np Active View!" ); EditPaM aPaM = GetImpEditEngine()->ConnectContents( nNode, bBackward ); GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); } -// ----------------------------------------------------------------------- -// EditUndoSplitPara -// ------------------------------------------------------------------------ -EditUndoSplitPara::EditUndoSplitPara( ImpEditEngine* _pImpEE, USHORT nN, USHORT nSP ) +EditUndoSplitPara::EditUndoSplitPara( ImpEditEngine* _pImpEE, sal_uInt16 nN, sal_uInt16 nSP ) : EditUndo( EDITUNDO_SPLITPARA, _pImpEE ) { nNode = nN; @@ -325,32 +309,29 @@ EditUndoSplitPara::~EditUndoSplitPara() { } -void __EXPORT EditUndoSplitPara::Undo() +void EditUndoSplitPara::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); - EditPaM aPaM = GetImpEditEngine()->ConnectContents( nNode, FALSE ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); + EditPaM aPaM = GetImpEditEngine()->ConnectContents( nNode, sal_False ); GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); } -void __EXPORT EditUndoSplitPara::Redo() +void EditUndoSplitPara::Redo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); EditPaM aPaM = GetImpEditEngine()->SplitContent( nNode, nSepPos ); GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); } -// ----------------------------------------------------------------------- -// EditUndoInsertChars -// ------------------------------------------------------------------------ EditUndoInsertChars::EditUndoInsertChars( ImpEditEngine* _pImpEE, const EPaM& rEPaM, const XubString& rStr ) : EditUndo( EDITUNDO_INSERTCHARS, _pImpEE ), aEPaM( rEPaM ), aText( rStr ) { } -void __EXPORT EditUndoInsertChars::Undo() +void EditUndoInsertChars::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) ); EditSelection aSel( aPaM, aPaM ); aSel.Max().GetIndex() = aSel.Max().GetIndex() + aText.Len(); @@ -358,7 +339,7 @@ void __EXPORT EditUndoInsertChars::Undo() GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aNewPaM, aNewPaM ) ); } -void __EXPORT EditUndoInsertChars::Redo() +void EditUndoInsertChars::Redo() { DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) ); @@ -368,34 +349,31 @@ void __EXPORT EditUndoInsertChars::Redo() GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aNewPaM ) ); } -BOOL __EXPORT EditUndoInsertChars::Merge( SfxUndoAction* pNextAction ) +sal_Bool EditUndoInsertChars::Merge( SfxUndoAction* pNextAction ) { if ( !pNextAction->ISA( EditUndoInsertChars ) ) - return FALSE; + return sal_False; EditUndoInsertChars* pNext = (EditUndoInsertChars*)pNextAction; if ( aEPaM.nPara != pNext->aEPaM.nPara ) - return FALSE; + return sal_False; if ( ( aEPaM.nIndex + aText.Len() ) == pNext->aEPaM.nIndex ) { aText += pNext->aText; - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -// ----------------------------------------------------------------------- -// EditUndoRemoveChars -// ------------------------------------------------------------------------ EditUndoRemoveChars::EditUndoRemoveChars( ImpEditEngine* _pImpEE, const EPaM& rEPaM, const XubString& rStr ) : EditUndo( EDITUNDO_REMOVECHARS, _pImpEE ), aEPaM( rEPaM ), aText( rStr ) { } -void __EXPORT EditUndoRemoveChars::Undo() +void EditUndoRemoveChars::Undo() { DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) ); @@ -405,9 +383,9 @@ void __EXPORT EditUndoRemoveChars::Undo() GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel ); } -void __EXPORT EditUndoRemoveChars::Redo() +void EditUndoRemoveChars::Redo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) ); EditSelection aSel( aPaM, aPaM ); aSel.Max().GetIndex() = aSel.Max().GetIndex() + aText.Len(); @@ -415,14 +393,11 @@ void __EXPORT EditUndoRemoveChars::Redo() GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewPaM ); } -// ----------------------------------------------------------------------- -// EditUndoInsertFeature -// ------------------------------------------------------------------------ EditUndoInsertFeature::EditUndoInsertFeature( ImpEditEngine* _pImpEE, const EPaM& rEPaM, const SfxPoolItem& rFeature) : EditUndo( EDITUNDO_INSERTFEATURE, _pImpEE ), aEPaM( rEPaM ) { pFeature = rFeature.Clone(); - DBG_ASSERT( pFeature, "Feature konnte nicht dupliziert werden: EditUndoInsertFeature" ); + DBG_ASSERT( pFeature, "Feature could not be duplicated: EditUndoInsertFeature" ); } EditUndoInsertFeature::~EditUndoInsertFeature() @@ -430,21 +405,21 @@ EditUndoInsertFeature::~EditUndoInsertFeature() delete pFeature; } -void __EXPORT EditUndoInsertFeature::Undo() +void EditUndoInsertFeature::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) ); EditSelection aSel( aPaM, aPaM ); - // Attribute werden dort implizit vom Dokument korrigiert... + // Attributes are then corrected implicitly by the document ... aSel.Max().GetIndex()++; - EditPaM aNewPaM = GetImpEditEngine()->ImpDeleteSelection( aSel ); - aSel.Max().GetIndex()--; // Fuer Selektion + GetImpEditEngine()->ImpDeleteSelection( aSel ); + aSel.Max().GetIndex()--; // For Selection GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel ); } -void __EXPORT EditUndoInsertFeature::Redo() +void EditUndoInsertFeature::Redo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) ); EditSelection aSel( aPaM, aPaM ); GetImpEditEngine()->ImpInsertFeature( aSel, *pFeature ); @@ -454,11 +429,8 @@ void __EXPORT EditUndoInsertFeature::Redo() GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel ); } -// ----------------------------------------------------------------------- -// EditUndoMoveParagraphs -// ------------------------------------------------------------------------ EditUndoMoveParagraphs::EditUndoMoveParagraphs - ( ImpEditEngine* _pImpEE, const Range& rParas, USHORT n ) + ( ImpEditEngine* _pImpEE, const Range& rParas, sal_uInt16 n ) : EditUndo( EDITUNDO_MOVEPARAGRAPHS, _pImpEE ), nParagraphs( rParas ) { @@ -469,9 +441,9 @@ EditUndoMoveParagraphs::~EditUndoMoveParagraphs() { } -void __EXPORT EditUndoMoveParagraphs::Undo() +void EditUndoMoveParagraphs::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); Range aTmpRange( nParagraphs ); long nTmpDest = aTmpRange.Min(); @@ -488,21 +460,18 @@ void __EXPORT EditUndoMoveParagraphs::Undo() else nTmpDest += aTmpRange.Len(); - EditSelection aNewSel( GetImpEditEngine()->MoveParagraphs( aTmpRange, (USHORT)nTmpDest, 0 ) ); + EditSelection aNewSel( GetImpEditEngine()->MoveParagraphs( aTmpRange, (sal_uInt16)nTmpDest, 0 ) ); GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); } -void __EXPORT EditUndoMoveParagraphs::Redo() +void EditUndoMoveParagraphs::Redo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); EditSelection aNewSel( GetImpEditEngine()->MoveParagraphs( nParagraphs, nDest, 0 ) ); GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); } -// ----------------------------------------------------------------------- -// EditUndoSetStyleSheet -// ------------------------------------------------------------------------ -EditUndoSetStyleSheet::EditUndoSetStyleSheet( ImpEditEngine* _pImpEE, USHORT nP, +EditUndoSetStyleSheet::EditUndoSetStyleSheet( ImpEditEngine* _pImpEE, sal_uInt16 nP, const XubString& rPrevName, SfxStyleFamily ePrevFam, const XubString& rNewName, SfxStyleFamily eNewFam, const SfxItemSet& rPrevParaAttribs ) @@ -518,25 +487,22 @@ EditUndoSetStyleSheet::~EditUndoSetStyleSheet() { } -void __EXPORT EditUndoSetStyleSheet::Undo() +void EditUndoSetStyleSheet::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); GetImpEditEngine()->SetStyleSheet( nPara, (SfxStyleSheet*)GetImpEditEngine()->GetStyleSheetPool()->Find( aPrevName, ePrevFamily ) ); GetImpEditEngine()->SetParaAttribs( nPara, aPrevParaAttribs ); lcl_DoSetSelection( GetImpEditEngine()->GetActiveView(), nPara ); } -void __EXPORT EditUndoSetStyleSheet::Redo() +void EditUndoSetStyleSheet::Redo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); GetImpEditEngine()->SetStyleSheet( nPara, (SfxStyleSheet*)GetImpEditEngine()->GetStyleSheetPool()->Find( aNewName, eNewFamily ) ); lcl_DoSetSelection( GetImpEditEngine()->GetActiveView(), nPara ); } -// ----------------------------------------------------------------------- -// EditUndoSetParaAttribs -// ------------------------------------------------------------------------ -EditUndoSetParaAttribs::EditUndoSetParaAttribs( ImpEditEngine* _pImpEE, USHORT nP, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems ) +EditUndoSetParaAttribs::EditUndoSetParaAttribs( ImpEditEngine* _pImpEE, sal_uInt16 nP, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems ) : EditUndo( EDITUNDO_PARAATTRIBS, _pImpEE ), aPrevItems( rPrevItems ), aNewItems(rNewItems ) @@ -548,49 +514,44 @@ EditUndoSetParaAttribs::~EditUndoSetParaAttribs() { } -void __EXPORT EditUndoSetParaAttribs::Undo() +void EditUndoSetParaAttribs::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); GetImpEditEngine()->SetParaAttribs( nPara, aPrevItems ); lcl_DoSetSelection( GetImpEditEngine()->GetActiveView(), nPara ); } -void __EXPORT EditUndoSetParaAttribs::Redo() +void EditUndoSetParaAttribs::Redo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); GetImpEditEngine()->SetParaAttribs( nPara, aNewItems ); lcl_DoSetSelection( GetImpEditEngine()->GetActiveView(), nPara ); } -// ----------------------------------------------------------------------- -// EditUndoSetAttribs -// ------------------------------------------------------------------------ EditUndoSetAttribs::EditUndoSetAttribs( ImpEditEngine* _pImpEE, const ESelection& rESel, const SfxItemSet& rNewItems ) : EditUndo( EDITUNDO_ATTRIBS, _pImpEE ), aESel( rESel ), aNewAttribs( rNewItems ) { - // Wenn das EditUndoSetAttribs eigentlich ein RemoveAttribs ist, koennte - // man das eigentlich an einem leeren ItemSet erkennen, aber dann muesste - // an einigen Stellen abgefangen werden, das ggf. ein SetAttribs mit einem - // leeren ItemSet gemacht wird. - // => Ich habe lieber diesen Member spendiert... - bSetIsRemove = FALSE; - bRemoveParaAttribs = FALSE; + // When EditUndoSetAttribs actually is a RemoveAttribs this could be + // /recognize by the empty itemset, but then it would have to be caught in + // its own place, which possible a setAttribs does with an empty itemset. + bSetIsRemove = sal_False; + bRemoveParaAttribs = sal_False; nRemoveWhich = 0; nSpecial = 0; } EditUndoSetAttribs::~EditUndoSetAttribs() { - // Items aus Pool holen... + // Get Items from Pool... SfxItemPool* pPool = aNewAttribs.GetPool(); - USHORT nContents = aPrevAttribs.Count(); - for ( USHORT n = 0; n < nContents; n++ ) + sal_uInt16 nContents = aPrevAttribs.Count(); + for ( sal_uInt16 n = 0; n < nContents; n++ ) { ContentAttribsInfo* pInf = aPrevAttribs[n]; DBG_ASSERT( pInf, "Undo_DTOR (SetAttribs): pInf = NULL!" ); - for ( USHORT nAttr = 0; nAttr < pInf->GetPrevCharAttribs().Count(); nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < pInf->GetPrevCharAttribs().Count(); nAttr++ ) { EditCharAttrib* pX = pInf->GetPrevCharAttribs()[nAttr]; DBG_ASSERT( pX, "Undo_DTOR (SetAttribs): pX = NULL!" ); @@ -601,32 +562,32 @@ EditUndoSetAttribs::~EditUndoSetAttribs() } } -void __EXPORT EditUndoSetAttribs::Undo() +void EditUndoSetAttribs::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); ImpEditEngine* _pImpEE = GetImpEditEngine(); - BOOL bFields = FALSE; - for ( USHORT nPara = aESel.nStartPara; nPara <= aESel.nEndPara; nPara++ ) + sal_Bool bFields = sal_False; + for ( sal_uInt16 nPara = aESel.nStartPara; nPara <= aESel.nEndPara; nPara++ ) { - ContentAttribsInfo* pInf = aPrevAttribs[ (USHORT)(nPara-aESel.nStartPara) ]; + ContentAttribsInfo* pInf = aPrevAttribs[ (sal_uInt16)(nPara-aESel.nStartPara) ]; DBG_ASSERT( pInf, "Undo (SetAttribs): pInf = NULL!" ); - // erstmal die Absatzattribute... + // first the paragraph attributes ... _pImpEE->SetParaAttribs( nPara, pInf->GetPrevParaAttribs() ); - // Dann die Zeichenattribute... - // Alle Attribute inkl. Features entfernen, werden wieder neu eingestellt. - _pImpEE->RemoveCharAttribs( nPara, 0, TRUE ); + // Then the character attributes ... + // Remove all attributes including features, are later re-established. + _pImpEE->RemoveCharAttribs( nPara, 0, sal_True ); DBG_ASSERT( _pImpEE->GetEditDoc().SaveGetObject( nPara ), "Undo (SetAttribs): pNode = NULL!" ); ContentNode* pNode = _pImpEE->GetEditDoc().GetObject( nPara ); - for ( USHORT nAttr = 0; nAttr < pInf->GetPrevCharAttribs().Count(); nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < pInf->GetPrevCharAttribs().Count(); nAttr++ ) { EditCharAttrib* pX = pInf->GetPrevCharAttribs()[nAttr]; DBG_ASSERT( pX, "Redo (SetAttribs): pX = NULL!" ); - // wird autom. 'eingepoolt'. + // is automatically "poolsized" _pImpEE->GetEditDoc().InsertAttrib( pNode, pX->GetStart(), pX->GetEnd(), *pX->GetItem() ); if ( pX->Which() == EE_FEATURE_FIELD ) - bFields = TRUE; + bFields = sal_True; } } if ( bFields ) @@ -634,9 +595,9 @@ void __EXPORT EditUndoSetAttribs::Undo() ImpSetSelection( GetImpEditEngine()->GetActiveView() ); } -void __EXPORT EditUndoSetAttribs::Redo() +void EditUndoSetAttribs::Redo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); ImpEditEngine* _pImpEE = GetImpEditEngine(); EditSelection aSel( _pImpEE->CreateSel( aESel ) ); @@ -655,9 +616,6 @@ void EditUndoSetAttribs::ImpSetSelection( EditView* /*pView*/ ) GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel ); } -// ----------------------------------------------------------------------- -// EditUndoTransliteration -// ------------------------------------------------------------------------ EditUndoTransliteration::EditUndoTransliteration( ImpEditEngine* _pImpEE, const ESelection& rESel, sal_Int32 nM ) : EditUndo( EDITUNDO_TRANSLITERATE, _pImpEE ), aOldESel( rESel ) { @@ -670,9 +628,9 @@ EditUndoTransliteration::~EditUndoTransliteration() delete pTxtObj; } -void __EXPORT EditUndoTransliteration::Undo() +void EditUndoTransliteration::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); ImpEditEngine* _pImpEE = GetImpEditEngine(); @@ -710,9 +668,9 @@ void __EXPORT EditUndoTransliteration::Undo() GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); } -void __EXPORT EditUndoTransliteration::Redo() +void EditUndoTransliteration::Redo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); ImpEditEngine* _pImpEE = GetImpEditEngine(); EditSelection aSel( _pImpEE->CreateSel( aOldESel ) ); @@ -720,9 +678,6 @@ void __EXPORT EditUndoTransliteration::Redo() GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); } -// ----------------------------------------------------------------------- -// EditUndoMarkSelection -// ------------------------------------------------------------------------ EditUndoMarkSelection::EditUndoMarkSelection( ImpEditEngine* _pImpEE, const ESelection& rSel ) : EditUndo( EDITUNDO_MARKSELECTION, _pImpEE ), aSelection( rSel ) { @@ -732,9 +687,9 @@ EditUndoMarkSelection::~EditUndoMarkSelection() { } -void __EXPORT EditUndoMarkSelection::Undo() +void EditUndoMarkSelection::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); if ( GetImpEditEngine()->GetActiveView() ) { if ( GetImpEditEngine()->IsFormatted() ) @@ -744,9 +699,9 @@ void __EXPORT EditUndoMarkSelection::Undo() } } -void __EXPORT EditUndoMarkSelection::Redo() +void EditUndoMarkSelection::Redo() { - // Fuer Redo unwichtig, weil am Anfang der Undo-Klammerung + // For redo unimportant, because at the beginning of the undo parentheses } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editundo.hxx b/editeng/source/editeng/editundo.hxx index 7c230eb38a..b884136635 100644 --- a/editeng/source/editeng/editundo.hxx +++ b/editeng/source/editeng/editundo.hxx @@ -48,14 +48,14 @@ class EditView; class EditUndoDelContent : public EditUndo { private: - BOOL bDelObject; - USHORT nNode; - ContentNode* pContentNode; // Zeigt auf das gueltige, - // nicht zerstoerte Objekt! + sal_Bool bDelObject; + sal_uInt16 nNode; + ContentNode* pContentNode; // Points to the valid, + // undestroyed object! public: TYPEINFO(); - EditUndoDelContent( ImpEditEngine* pImpEE, ContentNode* pNode, USHORT nPortio ); + EditUndoDelContent( ImpEditEngine* pImpEE, ContentNode* pNode, sal_uInt16 nPortio ); ~EditUndoDelContent(); virtual void Undo(); @@ -68,24 +68,24 @@ public: class EditUndoConnectParas : public EditUndo { private: - USHORT nNode; - USHORT nSepPos; + sal_uInt16 nNode; + sal_uInt16 nSepPos; SfxItemSet aLeftParaAttribs; SfxItemSet aRightParaAttribs; - // 2 Pointer waeren schoener, aber dann muesste es ein SfxListener sein. + // 2 Pointers would be nicer but then it would have to be a SfxListener. String aLeftStyleName; String aRightStyleName; SfxStyleFamily eLeftStyleFamily; SfxStyleFamily eRightStyleFamily; - BOOL bBackward; + sal_Bool bBackward; public: TYPEINFO(); - EditUndoConnectParas( ImpEditEngine* pImpEE, USHORT nNode, USHORT nSepPos, + EditUndoConnectParas( ImpEditEngine* pImpEE, sal_uInt16 nNode, sal_uInt16 nSepPos, const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs, - const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, BOOL bBackward ); + const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, sal_Bool bBackward ); ~EditUndoConnectParas(); virtual void Undo(); @@ -98,12 +98,12 @@ public: class EditUndoSplitPara : public EditUndo { private: - USHORT nNode; - USHORT nSepPos; + sal_uInt16 nNode; + sal_uInt16 nSepPos; public: TYPEINFO(); - EditUndoSplitPara( ImpEditEngine* pImpEE, USHORT nNode, USHORT nSepPos ); + EditUndoSplitPara( ImpEditEngine* pImpEE, sal_uInt16 nNode, sal_uInt16 nSepPos ); ~EditUndoSplitPara(); virtual void Undo(); @@ -129,7 +129,7 @@ public: virtual void Undo(); virtual void Redo(); - virtual BOOL Merge( SfxUndoAction *pNextAction ); + virtual sal_Bool Merge( SfxUndoAction *pNextAction ); }; // ----------------------------------------------------------------------- @@ -178,11 +178,11 @@ class EditUndoMoveParagraphs: public EditUndo { private: Range nParagraphs; - USHORT nDest; + sal_uInt16 nDest; public: TYPEINFO(); - EditUndoMoveParagraphs( ImpEditEngine* pImpEE, const Range& rParas, USHORT nDest ); + EditUndoMoveParagraphs( ImpEditEngine* pImpEE, const Range& rParas, sal_uInt16 nDest ); ~EditUndoMoveParagraphs(); virtual void Undo(); @@ -195,7 +195,7 @@ public: class EditUndoSetStyleSheet: public EditUndo { private: - USHORT nPara; + sal_uInt16 nPara; XubString aPrevName; XubString aNewName; SfxStyleFamily ePrevFamily; @@ -205,7 +205,7 @@ private: public: TYPEINFO(); - EditUndoSetStyleSheet( ImpEditEngine* pImpEE, USHORT nPara, + EditUndoSetStyleSheet( ImpEditEngine* pImpEE, sal_uInt16 nPara, const XubString& rPrevName, SfxStyleFamily ePrevFamily, const XubString& rNewName, SfxStyleFamily eNewFamily, const SfxItemSet& rPrevParaAttribs ); @@ -221,13 +221,13 @@ public: class EditUndoSetParaAttribs: public EditUndo { private: - USHORT nPara; + sal_uInt16 nPara; SfxItemSet aPrevItems; SfxItemSet aNewItems; public: TYPEINFO(); - EditUndoSetParaAttribs( ImpEditEngine* pImpEE, USHORT nPara, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems ); + EditUndoSetParaAttribs( ImpEditEngine* pImpEE, sal_uInt16 nPara, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems ); ~EditUndoSetParaAttribs(); virtual void Undo(); @@ -244,10 +244,10 @@ private: SfxItemSet aNewAttribs; ContentInfoArray aPrevAttribs; - BYTE nSpecial; - BOOL bSetIsRemove; - BOOL bRemoveParaAttribs; - USHORT nRemoveWhich; + sal_uInt8 nSpecial; + sal_Bool bSetIsRemove; + sal_Bool bRemoveParaAttribs; + sal_uInt16 nRemoveWhich; void ImpSetSelection( EditView* pView ); @@ -260,10 +260,10 @@ public: ContentInfoArray& GetContentInfos() { return aPrevAttribs; } SfxItemSet& GetNewAttribs() { return aNewAttribs; } - void SetSpecial( BYTE n ) { nSpecial = n; } - void SetRemoveAttribs( BOOL b ) { bSetIsRemove = b; } - void SetRemoveParaAttribs( BOOL b ) { bRemoveParaAttribs = b; } - void SetRemoveWhich( USHORT n ) { nRemoveWhich = n; } + void SetSpecial( sal_uInt8 n ) { nSpecial = n; } + void SetRemoveAttribs( sal_Bool b ) { bSetIsRemove = b; } + void SetRemoveParaAttribs( sal_Bool b ) { bRemoveParaAttribs = b; } + void SetRemoveWhich( sal_uInt16 n ) { nRemoveWhich = n; } virtual void Undo(); virtual void Redo(); diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index f67de56ed7..eb586a4a74 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -46,7 +46,7 @@ #include <svl/srchitem.hxx> -#define _SVSTDARR_USHORTS +#define _SVSTDARR_sal_uIt16S #include <svl/svstdarr.hxx> #include <impedit.hxx> @@ -150,10 +150,10 @@ LanguageType lcl_CheckLanguage( lang::Locale a3( SvxCreateLocale( aLangList[3] ) ); #endif - INT32 nCount = SAL_N_ELEMENTS(aLangList); - for (INT32 i = 0; i < nCount; i++) + sal_Int32 nCount = SAL_N_ELEMENTS(aLangList); + for (sal_Int32 i = 0; i < nCount; i++) { - INT16 nTmpLang = aLangList[i]; + sal_Int16 nTmpLang = aLangList[i]; if (nTmpLang != LANGUAGE_NONE && nTmpLang != LANGUAGE_DONTKNOW) { if (xSpell->hasLanguage( nTmpLang ) && @@ -233,8 +233,8 @@ void EditView::SetSelection( const ESelection& rESel ) DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - // Falls jemand gerade ein leeres Attribut hinterlassen hat, - // und dann der Outliner die Selektion manipulitert: + // If someone has just left an empty attribute, and then the outliner + // manipulates the selection: if ( !pImpEditView->GetEditSelection().HasRange() ) { ContentNode* pNode = pImpEditView->GetEditSelection().Max().GetNode(); @@ -242,10 +242,10 @@ void EditView::SetSelection( const ESelection& rESel ) } EditSelection aNewSelection( PIMPEE->ConvertSelection( rESel.nStartPara, rESel.nStartPos, rESel.nEndPara, rESel.nEndPos ) ); - // Wenn nach einem KeyInput die Selection manipuliert wird: + // If the selection is manipulated after a KeyInput: PIMPEE->CheckIdleFormatter(); - // Selektion darf nicht bei einem unsichtbaren Absatz Starten/Enden: + // Selection may not start/end at an invisible paragraph: ParaPortion* pPortion = PIMPEE->FindParaPortion( aNewSelection.Min().GetNode() ); if ( !pPortion->IsVisible() ) { @@ -261,7 +261,7 @@ void EditView::SetSelection( const ESelection& rESel ) aNewSelection.Max() = EditPaM( pNode, pNode->Len() ); } - pImpEditView->DrawSelection(); // alte Selektion 'weg-zeichnen' + pImpEditView->DrawSelection(); pImpEditView->SetEditSelection( aNewSelection ); pImpEditView->DrawSelection(); sal_Bool bGotoCursor = pImpEditView->DoAutoScroll(); @@ -297,7 +297,7 @@ void EditView::DeleteSelected() pImpEditView->DeleteSelected(); } -USHORT EditView::GetSelectedScriptType() const +sal_uInt16 EditView::GetSelectedScriptType() const { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); @@ -354,7 +354,7 @@ void EditView::SetOutputArea( const Rectangle& rRec ) DBG_CHKTHIS( EditView, 0 ); pImpEditView->SetOutputArea( rRec ); - // Rest nur hier, wenn API-Aufruf: + // the rest here only if it is an API call: pImpEditView->CalcAnchorPoint(); if ( PIMPEE->GetStatus().AutoPageSize() ) pImpEditView->RecalcOutputArea(); @@ -414,7 +414,7 @@ void EditView::InsertText( const XubString& rStr, sal_Bool bSelect ) if ( bSelect ) { - DBG_ASSERT( !aPaM1.DbgIsBuggy( pImpEE->GetEditDoc() ), "Insert: PaM kaputt" ); + DBG_ASSERT( !aPaM1.DbgIsBuggy( pImpEE->GetEditDoc() ), "Insert: PaM broken" ); pImpEditView->SetEditSelection( EditSelection( aPaM1, aPaM2 ) ); } else @@ -463,13 +463,9 @@ void EditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor ) DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); -// Draw vertraegt die Assertion nicht, spaeter mal aktivieren -// DBG_ASSERT( pImpEditView->pEditEngine->HasView( this ), "ShowCursor - View nicht angemeldet!" ); -// DBG_ASSERT( !GetWindow()->IsInPaint(), "ShowCursor - Why in Paint ?!" ); - if ( pImpEditView->pEditEngine->HasView( this ) ) { - // Das ControlWord hat mehr Gewicht: + // The control word is more important: if ( !pImpEditView->DoAutoScroll() ) bGotoCursor = sal_False; pImpEditView->ShowCursor( bGotoCursor, bForceVisCursor ); @@ -482,7 +478,7 @@ void EditView::HideCursor() pImpEditView->GetCursor()->Hide(); } -Pair EditView::Scroll( long ndX, long ndY, BYTE nRangeCheck ) +Pair EditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); @@ -500,9 +496,8 @@ void EditView::SetAttribs( const SfxItemSet& rSet ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blinde Selection in ...." ); + DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in ...." ); - // Kein Undo-Kappseln noetig... pImpEditView->DrawSelection(); PIMPEE->SetAttribs( pImpEditView->GetEditSelection(), rSet, ATTRSPECIAL_WHOLEWORD ); PIMPEE->FormatAndUpdate( this ); @@ -512,9 +507,8 @@ void EditView::SetParaAttribs( const SfxItemSet& rSet, sal_uInt16 nPara ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - // Kein Undo-Kappseln noetig... PIMPEE->SetParaAttribs( nPara, rSet ); - // Beim Aendern von Absatzattributen muss immer formatiert werden... + // When you change paragraph attributes you must always format... PIMPEE->FormatAndUpdate( this ); } @@ -566,7 +560,7 @@ SfxItemSet EditView::GetAttribs() { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blinde Selection in ...." ); + DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in ...." ); return PIMPEE->GetAttribs( pImpEditView->GetEditSelection() ); } @@ -584,7 +578,7 @@ void EditView::Redo() PIMPEE->Redo( this ); } -ULONG EditView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect, SvKeyValueIterator* pHTTPHeaderAttrs ) +sal_uLong EditView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect, SvKeyValueIterator* pHTTPHeaderAttrs ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); @@ -607,8 +601,7 @@ ULONG EditView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFo return rInput.GetError(); } -#ifndef SVX_LIGHT -ULONG EditView::Write( SvStream& rOutput, EETextFormat eFormat ) +sal_uLong EditView::Write( SvStream& rOutput, EETextFormat eFormat ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); @@ -616,7 +609,6 @@ ULONG EditView::Write( SvStream& rOutput, EETextFormat eFormat ) ShowCursor(); return rOutput.GetError(); } -#endif void EditView::Cut() { @@ -741,7 +733,7 @@ void EditView::MoveParagraphs( long nDiff ) nDest++; DBG_ASSERT( ( nDest >= 0 ) && ( nDest <= pImpEditView->pEditEngine->GetParagraphCount() ), "MoveParagraphs - wrong Parameters!" ); MoveParagraphs( aRange, - sal::static_int_cast< USHORT >( nDest ) ); + sal::static_int_cast< sal_uInt16 >( nDest ) ); } void EditView::SetBackgroundColor( const Color& rColor ) @@ -787,12 +779,12 @@ void EditView::InsertText( const EditTextObject& rTextObject ) EditSelection aTextSel( PIMPEE->InsertText( rTextObject, pImpEditView->GetEditSelection() ) ); PIMPEE->UndoActionEnd( EDITUNDO_INSERT ); - aTextSel.Min() = aTextSel.Max(); // Selektion nicht behalten. + aTextSel.Min() = aTextSel.Max(); // Selection not retained. pImpEditView->SetEditSelection( aTextSel ); PIMPEE->FormatAndUpdate( this ); } -void EditView::InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, BOOL bUseSpecial ) +void EditView::InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, sal_Bool bUseSpecial ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); @@ -802,25 +794,25 @@ void EditView::InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::d EditSelection aTextSel( PIMPEE->InsertText( xDataObj, rBaseURL, pImpEditView->GetEditSelection().Max(), bUseSpecial ) ); PIMPEE->UndoActionEnd( EDITUNDO_INSERT ); - aTextSel.Min() = aTextSel.Max(); // Selektion nicht behalten. + aTextSel.Min() = aTextSel.Max(); // Selection not retained. pImpEditView->SetEditSelection( aTextSel ); PIMPEE->FormatAndUpdate( this ); } sal_Bool EditView::Drop( const DropEvent& ) { - return FALSE; + return sal_False; } ESelection EditView::GetDropPos() { - DBG_ERROR( "GetDropPos - Why?!" ); + OSL_FAIL( "GetDropPos - Why?!" ); return ESelection(); } sal_Bool EditView::QueryDrop( DropEvent& ) { - return FALSE; + return sal_False; } void EditView::SetEditEngineUpdateMode( sal_Bool bUpdate ) @@ -864,7 +856,7 @@ SfxStyleSheet* EditView::GetStyleSheet() const { SfxStyleSheet* pTmpStyle = PIMPEE->GetStyleSheet( n ); if ( ( n != nStartPara ) && ( pStyle != pTmpStyle ) ) - return NULL; // Nicht eindeutig. + return NULL; // Not unique. pStyle = pTmpStyle; } return pStyle; @@ -901,7 +893,7 @@ void EditView::TransliterateText( sal_Int32 nTransliterationMode ) EditSelection aNewSel = PIMPEE->TransliterateText( pImpEditView->GetEditSelection(), nTransliterationMode ); if ( aNewSel != aOldSel ) { - pImpEditView->DrawSelection(); // alte Selektion 'weg-zeichnen' + pImpEditView->DrawSelection(); pImpEditView->SetEditSelection( aNewSel ); pImpEditView->DrawSelection(); } @@ -933,7 +925,6 @@ void EditView::CompleteAutoCorrect( Window* pFrameWin ) pImpEditView->DrawSelection(); EditSelection aSel = pImpEditView->GetEditSelection(); aSel = PIMPEE->EndOfWord( aSel.Max() ); - // MT 06/00: Why pass EditSelection to AutoCorrect, not EditPaM?! aSel = PIMPEE->AutoCorrect( aSel, 0, !IsInsertMode(), pFrameWin ); pImpEditView->SetEditSelection( aSel ); if ( PIMPEE->IsModified() ) @@ -943,43 +934,32 @@ void EditView::CompleteAutoCorrect( Window* pFrameWin ) EESpellState EditView::StartSpeller( sal_Bool bMultipleDoc ) { -#ifdef SVX_LIGHT - return EE_SPELL_NOSPELLER; -#else DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); if ( !PIMPEE->GetSpeller().is() ) return EE_SPELL_NOSPELLER; return PIMPEE->Spell( this, bMultipleDoc ); -#endif } EESpellState EditView::StartThesaurus() { -#ifdef SVX_LIGHT - return EE_SPELL_NOSPELLER; -#else DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); if ( !PIMPEE->GetSpeller().is() ) return EE_SPELL_NOSPELLER; return PIMPEE->StartThesaurus( this ); -#endif } void EditView::StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, - INT32 nOptions, BOOL bIsInteractive, BOOL bMultipleDoc ) + sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ) { -#ifdef SVX_LIGHT -#else DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); PIMPEE->Convert( this, nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc ); -#endif } @@ -1035,7 +1015,6 @@ static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) { -#ifndef SVX_LIGHT DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); @@ -1054,7 +1033,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) EditPaM aPaM2( aPaM ); aPaM2.GetIndex()++; - // Gibt es Replace-Vorschlaege? + // Are there any replace suggestions? String aSelected( GetSelected() ); // // restrict the maximal number of suggestions displayed @@ -1069,10 +1048,10 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) // implementation here by providing an additional parameter. Sequence< PropertyValue > aPropVals(1); PropertyValue &rVal = aPropVals.getArray()[0]; - rVal.Name = OUString::createFromAscii( UPN_MAX_NUMBER_OF_SUGGESTIONS ); - rVal.Value <<= (INT16) 7; + rVal.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( UPN_MAX_NUMBER_OF_SUGGESTIONS )); + rVal.Value <<= (sal_Int16) 7; // - // Gibt es Replace-Vorschlaege? + // Are there any replace suggestions? Reference< XSpellAlternatives > xSpellAlt = xSpeller->spell( aSelected, PIMPEE->GetLanguage( aPaM2 ), aPropVals ); @@ -1091,7 +1070,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) } else { - DBG_ERROR( "content node is NULL" ); + OSL_FAIL( "content node is NULL" ); } nGuessLangWord = lcl_CheckLanguage( xSpellAlt->getWord(), xSpeller, xLangGuesser, sal_False ); @@ -1130,7 +1109,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) if (xSpellAlt.is()) aAlt = xSpellAlt->getAlternatives(); const OUString *pAlt = aAlt.getConstArray(); - sal_uInt16 nWords = (USHORT) aAlt.getLength(); + sal_uInt16 nWords = (sal_uInt16) aAlt.getLength(); if ( nWords ) { for ( sal_uInt16 nW = 0; nW < nWords; nW++ ) @@ -1142,10 +1121,9 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) aPopupMenu.InsertSeparator( nWords ); } else - aPopupMenu.RemoveItem( MN_AUTOCORR ); // Loeschen? + aPopupMenu.RemoveItem( MN_AUTOCORR ); // delete? SvtLinguConfig aCfg; - const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); Reference< XDictionaryList > xDicList( SvxGetDictionaryList() ); Sequence< Reference< XDictionary > > aDics; @@ -1162,7 +1140,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) aDics = xDicList->getDictionaries(); pDic = aDics.getConstArray(); sal_uInt16 nCheckedLanguage = PIMPEE->GetLanguage( aPaM2 ); - sal_uInt16 nDicCount = (USHORT)aDics.getLength(); + sal_uInt16 nDicCount = (sal_uInt16)aDics.getLength(); for (sal_uInt16 i = 0; i < nDicCount; i++) { uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY ); @@ -1178,14 +1156,14 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) { // the extra 1 is because of the (possible) external // linguistic entry above - USHORT nPos = MN_DICTSTART + i; + sal_uInt16 nPos = MN_DICTSTART + i; pInsertMenu->InsertItem( nPos, xDicTmp->getName() ); uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY ); if (xSvcInfo.is()) { OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage( - xSvcInfo->getImplementationName(), bHC) ); + xSvcInfo->getImplementationName()) ); if (aDictionaryImageUrl.getLength() > 0) { Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); @@ -1250,12 +1228,12 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) { if ( !pCallBack ) { - // Cursor vor das Wort setzen... + // Set Cursor before word... EditPaM aCursor = pImpEditView->GetEditSelection().Min(); - pImpEditView->DrawSelection(); // alte Selektion 'weg-zeichnen' + pImpEditView->DrawSelection(); pImpEditView->SetEditSelection( EditSelection( aCursor, aCursor ) ); pImpEditView->DrawSelection(); - // Stuerzt ab, wenn keine SfxApp + // Crashes when no SfxApp PIMPEE->Spell( this, sal_False ); } else @@ -1310,7 +1288,6 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) SetSelection( aOldSel ); } } -#endif } void EditView::SpellIgnoreWord() @@ -1375,7 +1352,8 @@ const SvxFieldItem* EditView::GetFieldAtSelection() const { EditSelection aSel( pImpEditView->GetEditSelection() ); aSel.Adjust( pImpEditView->pEditEngine->pImpEditEngine->GetEditDoc() ); - // Nur wenn Cursor vor Feld, keine Selektion, oder nur Feld selektiert + // Only when cursor is in font of field, no selection, + // or only selecting field if ( ( aSel.Min().GetNode() == aSel.Max().GetNode() ) && ( ( aSel.Max().GetIndex() == aSel.Min().GetIndex() ) || ( aSel.Max().GetIndex() == aSel.Min().GetIndex()+1 ) ) ) @@ -1389,7 +1367,7 @@ const SvxFieldItem* EditView::GetFieldAtSelection() const if ( pAttr->GetStart() == nXPos ) if ( pAttr->Which() == EE_FEATURE_FIELD ) { - DBG_ASSERT( pAttr->GetItem()->ISA( SvxFieldItem ), "Kein FeldItem..." ); + DBG_ASSERT( pAttr->GetItem()->ISA( SvxFieldItem ), "No FeldItem..." ); return (const SvxFieldItem*)pAttr->GetItem(); } } @@ -1427,7 +1405,7 @@ XubString EditView::GetWordUnderMousePointer( Rectangle& rWordRect ) const Rectangle aBottomRightRec( pImpEE->PaMtoEditCursor( aWordSel.Max() ) ); #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( aTopLeftRec.Top() == aBottomRightRec.Top(), "Top() in einer Zeile unterschiedlich?" ); + DBG_ASSERT( aTopLeftRec.Top() == aBottomRightRec.Top(), "Top () is different in one line?"); #endif Point aPnt1( pImpEditView->GetWindowPos( aTopLeftRec.TopLeft() ) ); @@ -1484,7 +1462,7 @@ void EditView::ChangeFontSize( bool bGrow, const FontList* pFontList ) if( aSel.HasRange() ) { - for( USHORT nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + for( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { SvUShorts aPortions; rEditEngine.GetPortions( nPara, aPortions ); @@ -1492,13 +1470,13 @@ void EditView::ChangeFontSize( bool bGrow, const FontList* pFontList ) if( aPortions.Count() == 0 ) aPortions.Insert( rEditEngine.GetTextLen(nPara), 0 ); - const USHORT nBeginPos = (nPara == aSel.nStartPara) ? aSel.nStartPos : 0; - const USHORT nEndPos = (nPara == aSel.nEndPara) ? aSel.nEndPos : 0xffff; + const sal_uInt16 nBeginPos = (nPara == aSel.nStartPara) ? aSel.nStartPos : 0; + const sal_uInt16 nEndPos = (nPara == aSel.nEndPara) ? aSel.nEndPos : 0xffff; - for ( USHORT nPos = 0; nPos < aPortions.Count(); ++nPos ) + for ( sal_uInt16 nPos = 0; nPos < aPortions.Count(); ++nPos ) { - USHORT nPortionEnd = aPortions.GetObject( nPos ); - USHORT nPortionStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0; + sal_uInt16 nPortionEnd = aPortions.GetObject( nPos ); + sal_uInt16 nPortionStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0; if( (nPortionEnd < nBeginPos) || (nPortionStart > nEndPos) ) continue; diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 0a04b042fd..7396bc7d93 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -57,23 +57,23 @@ EditSpellWrapper::EditSpellWrapper( Window* _pWin, sal_Bool bIsStart, sal_Bool bIsAllRight, EditView* pView ) : SvxSpellWrapper( _pWin, xChecker, bIsStart, bIsAllRight ) { - DBG_ASSERT( pView, "Es muss eine View uebergeben werden!" ); - // IgnoreList behalten, ReplaceList loeschen... + DBG_ASSERT( pView, "One view has to be abandoned!" ); + // Keep IgnoreList, delete ReplaceList... if (SvxGetChangeAllList().is()) SvxGetChangeAllList()->clear(); pEditView = pView; } -void __EXPORT EditSpellWrapper::SpellStart( SvxSpellArea eArea ) +void EditSpellWrapper::SpellStart( SvxSpellArea eArea ) { ImpEditEngine* pImpEE = pEditView->GetImpEditEngine(); SpellInfo* pSpellInfo = pImpEE->GetSpellInfo(); if ( eArea == SVX_SPELL_BODY_START ) { - // Wird gerufen, wenn - // a) Spell-Forwad ist am Ende angekomment und soll von vorne beginnen - // IsEndDone() liefert auch sal_True, wenn Rueckwaerts-Spelling am Ende gestartet wird! + // Is called when + // a) Spell-Forward has arrived at the end and should restart at the top + // IsEndDone() returns also sal_True, when backward-spelling is started at the end! if ( IsEndDone() ) { pSpellInfo->bSpellToEnd = sal_False; @@ -90,9 +90,9 @@ void __EXPORT EditSpellWrapper::SpellStart( SvxSpellArea eArea ) } else if ( eArea == SVX_SPELL_BODY_END ) { - // Wird gerufen, wenn - // a) Spell-Forwad wird gestartet - // IsStartDone() liefert auch sal_True, wenn Vorwaerts-Spelling am Anfang gestartet wird! + // Is called when + // a) Spell-Forward is launched + // IsStartDone() return also sal_True, when forward-spelling is started at the beginning! if ( !IsStartDone() ) { pSpellInfo->bSpellToEnd = sal_True; @@ -109,14 +109,11 @@ void __EXPORT EditSpellWrapper::SpellStart( SvxSpellArea eArea ) } else if ( eArea == SVX_SPELL_BODY ) { - ; // Wird ueber SpellNextDocument von App gehandelt - - // pSpellInfo->bSpellToEnd = sal_True; - // pSpellInfo->aSpellTo = pImpEE->CreateEPaM( pImpEE->GetEditDoc().GetEndPaM() ); + ; // Is handled by the App through SpellNextDocument } else { - DBG_ERROR( "SpellStart: Unknown Area!" ); + OSL_FAIL( "SpellStart: Unknown Area!" ); } } @@ -126,18 +123,18 @@ sal_Bool EditSpellWrapper::SpellContinue() return GetLast().is(); } -void __EXPORT EditSpellWrapper::SpellEnd() +void EditSpellWrapper::SpellEnd() { // Base class will show language errors... SvxSpellWrapper::SpellEnd(); } -sal_Bool __EXPORT EditSpellWrapper::HasOtherCnt() +sal_Bool EditSpellWrapper::HasOtherCnt() { return sal_False; } -sal_Bool __EXPORT EditSpellWrapper::SpellMore() +sal_Bool EditSpellWrapper::SpellMore() { ImpEditEngine* pImpEE = pEditView->GetImpEditEngine(); SpellInfo* pSpellInfo = pImpEE->GetSpellInfo(); @@ -147,8 +144,8 @@ sal_Bool __EXPORT EditSpellWrapper::SpellMore() bMore = pImpEE->GetEditEnginePtr()->SpellNextDocument(); if ( bMore ) { - // Der Text wurde in diese Engine getreten, bei Rueckwaerts - // muss die Selektion hinten sein. + // The text has been entered into the engine, when backwords then + // it must be behind the selection. Reference< XPropertySet > xProp( SvxGetLinguPropertySet() ); pEditView->GetImpEditView()->SetEditSelection( pImpEE->GetEditDoc().GetStartPaM() ); @@ -157,41 +154,41 @@ sal_Bool __EXPORT EditSpellWrapper::SpellMore() return bMore; } -void __EXPORT EditSpellWrapper::ScrollArea() +void EditSpellWrapper::ScrollArea() { - // Keine weitere Aktion noetig... - // Es sei denn, der Bereich soll in die Mitte gescrollt werden, - // und nicht irgendwo stehen. + // No further action needed ... + // Except for, that the area is to be scrolled in the center, and not stand + // still anywhere. } -void __EXPORT EditSpellWrapper::ReplaceAll( const String &rNewText, +void EditSpellWrapper::ReplaceAll( const String &rNewText, sal_Int16 ) { - // Wird gerufen, wenn Wort in ReplaceList des SpellCheckers + // Is called when the word is in ReplaceList of the spell checker pEditView->InsertText( rNewText ); CheckSpellTo(); } -void __EXPORT EditSpellWrapper::ChangeWord( const String& rNewWord, +void EditSpellWrapper::ChangeWord( const String& rNewWord, const sal_uInt16 ) { - // Wird gerufen, wenn Wort Button Change - // bzw. intern von mir bei ChangeAll + // Will be called when Word Button Change + // or internally by me ChangeAll - // Wenn Punkt hinterm Wort, wird dieser nicht mitgegeben. - // Falls '"' => PreStripped. + // If there is a dot Punkt after the word, this dot will be stripped away. + // If '"' => PreStripped. String aNewWord( rNewWord ); pEditView->InsertText( aNewWord ); CheckSpellTo(); } -void __EXPORT EditSpellWrapper::ChangeThesWord( const String& rNewWord ) +void EditSpellWrapper::ChangeThesWord( const String& rNewWord ) { pEditView->InsertText( rNewWord ); CheckSpellTo(); } -void __EXPORT EditSpellWrapper::AutoCorrect( const String&, const String& ) +void EditSpellWrapper::AutoCorrect( const String&, const String& ) { } @@ -203,8 +200,8 @@ void EditSpellWrapper::CheckSpellTo() EPaM aEPaM = pImpEE->CreateEPaM( aPaM ); if ( aEPaM.nPara == pSpellInfo->aSpellTo.nPara ) { - // prueffen, ob SpellToEnd noch gueltiger Index, falls in dem Absatz - // ersetzt wurde. + // Check if SpellToEnd still has a valid Index, if replace has been + // performed in the paragraph. if ( pSpellInfo->aSpellTo.nIndex > aPaM.GetNode()->Len() ) pSpellInfo->aSpellTo.nIndex = aPaM.GetNode()->Len(); } @@ -224,7 +221,7 @@ WrongList::~WrongList() { } -void WrongList::MarkInvalid( USHORT nS, USHORT nE ) +void WrongList::MarkInvalid( sal_uInt16 nS, sal_uInt16 nE ) { if ( ( nInvalidStart == NOT_INVALID ) || ( nInvalidStart > nS ) ) nInvalidStart = nS; @@ -255,35 +252,35 @@ void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsS sal_Bool bRefIsValid = sal_True; if ( rWrong.nEnd >= nPos ) { - // Alle Wrongs hinter der Einfuegeposition verschieben... + // Move all Wrongs after the insert position... if ( rWrong.nStart > nPos ) { rWrong.nStart = rWrong.nStart + nNew; rWrong.nEnd = rWrong.nEnd + nNew; } - // 1: Startet davor, geht bis nPos... + // 1: Starts before and goes until nPos... else if ( rWrong.nEnd == nPos ) { - // Sollte bei einem Blank unterbunden werden! + // Should be halted at a blank! if ( !bPosIsSep ) rWrong.nEnd = rWrong.nEnd + nNew; } - // 2: Startet davor, geht hinter Pos... + // 2: Starts before and goes until after nPos... else if ( ( rWrong.nStart < nPos ) && ( rWrong.nEnd > nPos ) ) { rWrong.nEnd = rWrong.nEnd + nNew; - // Bei einem Trenner das Wrong entfernen und neu pruefen + // When a separator remove and re-examine the Wrong if ( bPosIsSep ) { - // Wrong aufteilen... + // Split Wrong... WrongRange aNewWrong( rWrong.nStart, nPos ); rWrong.nStart = nPos+1; Insert( aNewWrong, n ); - bRefIsValid = sal_False; // Referenz nach Insert nicht mehr gueltig, der andere wurde davor an dessen Position eingefuegt - n++; // Diesen nicht nochmal... + bRefIsValid = sal_False; // Reference no longer valid after Insert, the other was inserted in front of this position + n++; // This not again ... } } - // 3: Attribut startet auf Pos... + // 3: Attribute starts at position .. else if ( rWrong.nStart == nPos ) { rWrong.nEnd = rWrong.nEnd + nNew; @@ -293,9 +290,10 @@ void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsS } DBG_ASSERT( !bRefIsValid || ( rWrong.nStart < rWrong.nEnd ), "TextInserted, WrongRange: Start >= End?!" ); + (void)bRefIsValid; } - DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList kaputt!" ); + DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList broken!" ); } void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nDeleted ) @@ -326,26 +324,26 @@ void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nDeleted ) sal_Bool bDelWrong = sal_False; if ( rWrong.nEnd >= nPos ) { - // Alles Wrongs hinter der Einfuegeposition verschieben... + // Move all Wrongs after the insert position... if ( rWrong.nStart >= nEndChanges ) { rWrong.nStart = rWrong.nStart - nDeleted; rWrong.nEnd = rWrong.nEnd - nDeleted; } - // 1. Innenliegende Wrongs loeschen... + // 1. Delete Internal Wrongs ... else if ( ( rWrong.nStart >= nPos ) && ( rWrong.nEnd <= nEndChanges ) ) { bDelWrong = sal_True; } - // 2. Wrong beginnt davor, endet drinnen oder dahinter... + // 2. Wrong begins before, ends inside or behind it ... else if ( ( rWrong.nStart <= nPos ) && ( rWrong.nEnd > nPos ) ) { - if ( rWrong.nEnd <= nEndChanges ) // endet drinnen + if ( rWrong.nEnd <= nEndChanges ) // ends inside rWrong.nEnd = nPos; else - rWrong.nEnd = rWrong.nEnd - nDeleted; // endet dahinter + rWrong.nEnd = rWrong.nEnd - nDeleted; // ends after } - // 3. Wrong beginnt drinnen, endet dahinter... + // 3. Wrong begins inside, ending after ... else if ( ( rWrong.nStart >= nPos ) && ( rWrong.nEnd > nEndChanges ) ) { rWrong.nStart = nEndChanges; @@ -362,14 +360,14 @@ void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nDeleted ) } } - DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList kaputt!" ); + DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList broken!" ); } sal_Bool WrongList::NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const { /* - rnStart enthaelt die Startposition, wird ggf. auf Wrong-Start korrigiert - rnEnd braucht nicht inizialisiert sein. + rnStart get the start position, is possibly adjusted wrt. Wrong start + rnEnd does not have to be initialized. */ for ( sal_uInt16 n = 0; n < Count(); n++ ) { @@ -418,7 +416,7 @@ void WrongList::ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd, WrongRange& rWrong = GetObject( n ); if ( ( rWrong.nEnd > nStart ) && ( rWrong.nStart < nEnd ) ) { - if ( rWrong.nEnd > nEnd ) // // Laeuft raus + if ( rWrong.nEnd > nEnd ) // Runs out { rWrong.nStart = nEnd; // Blanks? @@ -437,7 +435,7 @@ void WrongList::ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd, } } - DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList kaputt!" ); + DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList broken!" ); } void WrongList::InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd, @@ -452,11 +450,10 @@ void WrongList::InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd, nPos = n; if ( bClearRange ) { - // Es kann eigentlich nur Passieren, dass der Wrong genau - // hier beginnt und weiter rauslauft, aber nicht, dass hier - // mehrere im Bereich liegen... - // Genau im Bereich darf keiner liegen, sonst darf diese Methode - // garnicht erst gerufen werden! + // It can really only happen that the Wrong starts exactly here + // and runs along, but not that there are several ranges ... + // Exactly in the range is no one allowed to be, otherwise this + // Method can not be called! DBG_ASSERT( ( ( rWrong.nStart == nStart ) && ( rWrong.nEnd > nEnd ) ) || ( rWrong.nStart > nEnd ), "InsertWrong: RangeMismatch!" ); if ( ( rWrong.nStart == nStart ) && ( rWrong.nEnd > nEnd ) ) @@ -467,7 +464,7 @@ void WrongList::InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd, } Insert( WrongRange( nStart, nEnd ), nPos ); - DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList kaputt!" ); + DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList broken!" ); } void WrongList::MarkWrongsInvalid() @@ -499,7 +496,7 @@ bool WrongList::operator==(const WrongList& rCompare) const return false; } - for(USHORT a(0); a < Count(); a++) + for(sal_uInt16 a(0); a < Count(); a++) { const WrongRange& rCandA(GetObject(a)); const WrongRange& rCandB(rCompare.GetObject(a)); @@ -517,7 +514,7 @@ bool WrongList::operator==(const WrongList& rCompare) const #ifdef DBG_UTIL sal_Bool WrongList::DbgIsBuggy() const { - // Pruefen, ob sich Bereiche ueberlappen + // Check if the ranges overlap. sal_Bool bError = sal_False; for ( sal_uInt16 _nA = 0; !bError && ( _nA < Count() ); _nA++ ) { @@ -525,11 +522,11 @@ sal_Bool WrongList::DbgIsBuggy() const for ( sal_uInt16 nB = _nA+1; !bError && ( nB < Count() ); nB++ ) { WrongRange& rNextWrong = GetObject( nB ); - // 1) Start davor, End hinterm anderen Start + // 1) Start before, End after the second Start if ( ( rWrong.nStart <= rNextWrong.nStart ) && ( rWrong.nEnd >= rNextWrong.nStart ) ) bError = sal_True; - // 2) Start hinter anderen Start, aber noch vorm anderen End + // 2) Start after the second Start, but still before the second End else if ( ( rWrong.nStart >= rNextWrong.nStart) && ( rWrong.nStart <= rNextWrong.nEnd ) ) bError = sal_True; @@ -562,7 +559,7 @@ sal_Bool EdtAutoCorrDoc::Delete( sal_uInt16 nStt, sal_uInt16 nEnd ) { EditSelection aSel( EditPaM( pCurNode, nStt ), EditPaM( pCurNode, nEnd ) ); pImpEE->ImpDeleteSelection( aSel ); - DBG_ASSERT( nCursor >= nEnd, "Cursor mitten im Geschehen ?!" ); + DBG_ASSERT( nCursor >= nEnd, "Cursor in the heart of the action?!" ); nCursor -= ( nEnd-nStt ); bAllowUndoAction = sal_False; return sal_True; @@ -572,7 +569,7 @@ sal_Bool EdtAutoCorrDoc::Insert( sal_uInt16 nPos, const String& rTxt ) { EditSelection aSel = EditPaM( pCurNode, nPos ); pImpEE->ImpInsertText( aSel, rTxt ); - DBG_ASSERT( nCursor >= nPos, "Cursor mitten im Geschehen ?!" ); + DBG_ASSERT( nCursor >= nPos, "Cursor in the heart of the action?!" ); nCursor = nCursor + rTxt.Len(); if ( bAllowUndoAction && ( rTxt.Len() == 1 ) ) @@ -584,8 +581,13 @@ sal_Bool EdtAutoCorrDoc::Insert( sal_uInt16 nPos, const String& rTxt ) sal_Bool EdtAutoCorrDoc::Replace( sal_uInt16 nPos, const String& rTxt ) { - // Eigentlich ein Replace einfuehren => Entspr. UNDO - sal_uInt16 nEnd = nPos+rTxt.Len(); + return ReplaceRange( nPos, rTxt.Len(), rTxt ); +} + +sal_Bool EdtAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength, const String& rTxt ) +{ + // Actually a Replace introduce => corresponds to UNDO + sal_uInt16 nEnd = nPos+nSourceLength; if ( nEnd > pCurNode->Len() ) nEnd = pCurNode->Len(); @@ -633,11 +635,11 @@ sal_Bool EdtAutoCorrDoc::SetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, sal_Bool EdtAutoCorrDoc::SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, const String& rURL ) { - // Aus dem Text ein Feldbefehl machen... + // Turn the Text into a command field ... EditSelection aSel( EditPaM( pCurNode, nStt ), EditPaM( pCurNode, nEnd ) ); String aText = pImpEE->GetSelected( aSel ); aSel = pImpEE->ImpDeleteSelection( aSel ); - DBG_ASSERT( nCursor >= nEnd, "Cursor mitten im Geschehen ?!" ); + DBG_ASSERT( nCursor >= nEnd, "Cursor in the heart of the action ?!" ); nCursor -= ( nEnd-nStt ); SvxFieldItem aField( SvxURLField( rURL, aText, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD ); @@ -650,8 +652,8 @@ sal_Bool EdtAutoCorrDoc::SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, sal_Bool EdtAutoCorrDoc::HasSymbolChars( sal_uInt16 nStt, sal_uInt16 nEnd ) { - USHORT nScriptType = pImpEE->GetScriptType( EditPaM( pCurNode, nStt ) ); - USHORT nScriptFontInfoItemId = GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ); + sal_uInt16 nScriptType = pImpEE->GetScriptType( EditPaM( pCurNode, nStt ) ); + sal_uInt16 nScriptFontInfoItemId = GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ); CharAttribArray& rAttribs = pCurNode->GetCharAttribs().GetAttribs(); sal_uInt16 nAttrs = rAttribs.Count(); @@ -664,7 +666,7 @@ sal_Bool EdtAutoCorrDoc::HasSymbolChars( sal_uInt16 nStt, sal_uInt16 nEnd ) if ( ( pAttr->Which() == nScriptFontInfoItemId ) && ( ((SvxFontItem*)pAttr->GetItem())->GetCharSet() == RTL_TEXTENCODING_SYMBOL ) ) { - // Pruefen, ob das Attribt im Bereich liegt... + // check if the Attribtuteis within range... if ( pAttr->GetEnd() >= nStt ) return sal_True; } @@ -674,21 +676,21 @@ sal_Bool EdtAutoCorrDoc::HasSymbolChars( sal_uInt16 nStt, sal_uInt16 nEnd ) const String* EdtAutoCorrDoc::GetPrevPara( sal_Bool ) { - // Vorherigen Absatz zurueck geben, damit ermittel werden kann, - // ob es sich beim aktuellen Wort um einen Satzanfang handelt. + // Return previous paragraph, so that it can be determined, + // whether the current word is at the beginning of a sentence. - bAllowUndoAction = sal_False; // Jetzt nicht mehr... + bAllowUndoAction = sal_False; // Not anymore ... ContentList& rNodes = pImpEE->GetEditDoc(); sal_uInt16 nPos = rNodes.GetPos( pCurNode ); - // Sonderbehandlung: Bullet => Absatzanfang => einfach NULL returnen... + // Special case: Bullet => Paragraph start => simply return NULL... const SfxBoolItem& rBulletState = (const SfxBoolItem&) pImpEE->GetParaAttrib( nPos, EE_PARA_BULLETSTATE ); sal_Bool bBullet = rBulletState.GetValue() ? sal_True : sal_False; if ( !bBullet && ( pImpEE->aStatus.GetControlWord() & EE_CNTRL_OUTLINER ) ) { - // Der Outliner hat im Gliederungsmodus auf Ebene 0 immer ein Bullet. + // The Outliner has still a Bullet at Level 0. const SfxInt16Item& rLevel = (const SfxInt16Item&) pImpEE->GetParaAttrib( nPos, EE_PARA_OUTLLEVEL ); if ( rLevel.GetValue() == 0 ) @@ -712,10 +714,9 @@ sal_Bool EdtAutoCorrDoc::ChgAutoCorrWord( sal_uInt16& rSttPos, sal_uInt16 nEndPos, SvxAutoCorrect& rACorrect, const String** ppPara ) { - // Absatz-Anfang oder ein Blank gefunden, suche nach dem Wort - // Kuerzel im Auto - - bAllowUndoAction = sal_False; // Jetzt nicht mehr... + // Paragraph-start or a blank found, search for the word + // shortcut in Auto + bAllowUndoAction = sal_False; // Not anymore ... String aShort( pCurNode->Copy( rSttPos, nEndPos - rSttPos ) ); sal_Bool bRet = sal_False; @@ -727,11 +728,11 @@ sal_Bool EdtAutoCorrDoc::ChgAutoCorrWord( sal_uInt16& rSttPos, const SvxAutocorrWord* pFnd = rACorrect.SearchWordsInList( *pCurNode, rSttPos, nEndPos, *this, eLang ); if( pFnd && pFnd->IsTextOnly() ) { - // dann mal ersetzen + // then replace EditSelection aSel( EditPaM( pCurNode, rSttPos ), EditPaM( pCurNode, nEndPos ) ); aSel = pImpEE->ImpDeleteSelection( aSel ); - DBG_ASSERT( nCursor >= nEndPos, "Cursor mitten im Geschehen ?!" ); + DBG_ASSERT( nCursor >= nEndPos, "Cursor in the heart of the action?!" ); nCursor -= ( nEndPos-rSttPos ); pImpEE->ImpInsertText( aSel, pFnd->GetLong() ); nCursor = nCursor + pFnd->GetLong().Len(); diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx index 992a94f39d..e62fd29103 100644 --- a/editeng/source/editeng/edtspell.hxx +++ b/editeng/source/editeng/edtspell.hxx @@ -53,13 +53,13 @@ private: protected: virtual void SpellStart( SvxSpellArea eArea ); - virtual BOOL SpellContinue(); // Bereich pruefen - virtual void ReplaceAll( const String &rNewText, INT16 nLanguage ); + virtual sal_Bool SpellContinue(); // Check area + virtual void ReplaceAll( const String &rNewText, sal_Int16 nLanguage ); virtual void SpellEnd(); - virtual BOOL SpellMore(); - virtual BOOL HasOtherCnt(); + virtual sal_Bool SpellMore(); + virtual sal_Bool HasOtherCnt(); virtual void ScrollArea(); - virtual void ChangeWord( const String& rNewWord, const USHORT nLang ); + virtual void ChangeWord( const String& rNewWord, const sal_uInt16 nLang ); virtual void ChangeThesWord( const String& rNewWord ); virtual void AutoCorrect( const String& rOldWord, const String& rNewWord ); @@ -67,18 +67,18 @@ public: EditSpellWrapper( Window* pWin, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > &xChecker, - BOOL bIsStart, - BOOL bIsAllRight, EditView* pView ); + sal_Bool bIsStart, + sal_Bool bIsAllRight, EditView* pView ); }; struct WrongRange { - USHORT nStart; - USHORT nEnd; + sal_uInt16 nStart; + sal_uInt16 nEnd; - WrongRange( USHORT nS, USHORT nE ) { nStart = nS; nEnd = nE; } + WrongRange( sal_uInt16 nS, sal_uInt16 nE ) { nStart = nS; nEnd = nE; } }; SV_DECL_VARARR( WrongRanges, WrongRange, 4, 4 ) @@ -87,41 +87,41 @@ SV_DECL_VARARR( WrongRanges, WrongRange, 4, 4 ) class WrongList : private WrongRanges { private: - USHORT nInvalidStart; - USHORT nInvalidEnd; + sal_uInt16 nInvalidStart; + sal_uInt16 nInvalidEnd; - BOOL DbgIsBuggy() const; + sal_Bool DbgIsBuggy() const; public: WrongList(); ~WrongList(); - BOOL IsInvalid() const { return nInvalidStart != NOT_INVALID; } + sal_Bool IsInvalid() const { return nInvalidStart != NOT_INVALID; } void SetValid() { nInvalidStart = NOT_INVALID; nInvalidEnd = 0; } - void MarkInvalid( USHORT nS, USHORT nE ); + void MarkInvalid( sal_uInt16 nS, sal_uInt16 nE ); - USHORT Count() const { return WrongRanges::Count(); } + sal_uInt16 Count() const { return WrongRanges::Count(); } - // Wenn man weiss was man tut: - WrongRange& GetObject( USHORT n ) const { return WrongRanges::GetObject( n ); } - void InsertWrong( const WrongRange& rWrong, USHORT nPos ); + // When one knows what to do: + WrongRange& GetObject( sal_uInt16 n ) const { return WrongRanges::GetObject( n ); } + void InsertWrong( const WrongRange& rWrong, sal_uInt16 nPos ); - USHORT GetInvalidStart() const { return nInvalidStart; } - USHORT& GetInvalidStart() { return nInvalidStart; } + sal_uInt16 GetInvalidStart() const { return nInvalidStart; } + sal_uInt16& GetInvalidStart() { return nInvalidStart; } - USHORT GetInvalidEnd() const { return nInvalidEnd; } - USHORT& GetInvalidEnd() { return nInvalidEnd; } + sal_uInt16 GetInvalidEnd() const { return nInvalidEnd; } + sal_uInt16& GetInvalidEnd() { return nInvalidEnd; } - void TextInserted( USHORT nPos, USHORT nChars, BOOL bPosIsSep ); - void TextDeleted( USHORT nPos, USHORT nChars ); + void TextInserted( sal_uInt16 nPos, sal_uInt16 nChars, sal_Bool bPosIsSep ); + void TextDeleted( sal_uInt16 nPos, sal_uInt16 nChars ); void ResetRanges() { Remove( 0, Count() ); } - BOOL HasWrongs() const { return Count() != 0; } - void InsertWrong( USHORT nStart, USHORT nEnd, BOOL bClearRange ); - BOOL NextWrong( USHORT& rnStart, USHORT& rnEnd ) const; - BOOL HasWrong( USHORT nStart, USHORT nEnd ) const; - BOOL HasAnyWrong( USHORT nStart, USHORT nEnd ) const; - void ClearWrongs( USHORT nStart, USHORT nEnd, const ContentNode* pNode ); + sal_Bool HasWrongs() const { return Count() != 0; } + void InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd, sal_Bool bClearRange ); + sal_Bool NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const; + sal_Bool HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const; + sal_Bool HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const; + void ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd, const ContentNode* pNode ); void MarkWrongsInvalid(); WrongList* Clone() const; @@ -130,11 +130,11 @@ public: bool operator==(const WrongList& rCompare) const; }; -inline void WrongList::InsertWrong( const WrongRange& rWrong, USHORT nPos ) +inline void WrongList::InsertWrong( const WrongRange& rWrong, sal_uInt16 nPos ) { WrongRanges::Insert( rWrong, nPos ); #ifdef DBG_UTIL - DBG_ASSERT( !DbgIsBuggy(), "Insert: WrongList kaputt!" ); + DBG_ASSERT( !DbgIsBuggy(), "Insert: WrongList broken!" ); #endif } @@ -144,35 +144,36 @@ class EdtAutoCorrDoc : public SvxAutoCorrDoc { ImpEditEngine* pImpEE; ContentNode* pCurNode; - USHORT nCursor; + sal_uInt16 nCursor; - BOOL bAllowUndoAction; - BOOL bUndoAction; + sal_Bool bAllowUndoAction; + sal_Bool bUndoAction; protected: void ImplStartUndoAction(); public: - EdtAutoCorrDoc( ImpEditEngine* pImpEE, ContentNode* pCurNode, USHORT nCrsr, xub_Unicode cIns ); + EdtAutoCorrDoc( ImpEditEngine* pImpEE, ContentNode* pCurNode, sal_uInt16 nCrsr, xub_Unicode cIns ); ~EdtAutoCorrDoc(); - virtual BOOL Delete( USHORT nStt, USHORT nEnd ); - virtual BOOL Insert( USHORT nPos, const String& rTxt ); - virtual BOOL Replace( USHORT nPos, const String& rTxt ); + virtual sal_Bool Delete( sal_uInt16 nStt, sal_uInt16 nEnd ); + virtual sal_Bool Insert( sal_uInt16 nPos, const String& rTxt ); + virtual sal_Bool Replace( sal_uInt16 nPos, const String& rTxt ); + virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt ); - virtual BOOL SetAttr( USHORT nStt, USHORT nEnd, USHORT nSlotId, SfxPoolItem& ); - virtual BOOL SetINetAttr( USHORT nStt, USHORT nEnd, const String& rURL ); + virtual sal_Bool SetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, sal_uInt16 nSlotId, SfxPoolItem& ); + virtual sal_Bool SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, const String& rURL ); - virtual BOOL HasSymbolChars( USHORT nStt, USHORT nEnd ); + virtual sal_Bool HasSymbolChars( sal_uInt16 nStt, sal_uInt16 nEnd ); - virtual const String* GetPrevPara( BOOL bAtNormalPos ); + virtual const String* GetPrevPara( sal_Bool bAtNormalPos ); - virtual BOOL ChgAutoCorrWord( USHORT& rSttPos, USHORT nEndPos, + virtual sal_Bool ChgAutoCorrWord( sal_uInt16& rSttPos, sal_uInt16 nEndPos, SvxAutoCorrect& rACorrect, const String** ppPara ); - virtual LanguageType GetLanguage( USHORT nPos, BOOL bPrevPara = FALSE ) const; + virtual LanguageType GetLanguage( sal_uInt16 nPos, sal_Bool bPrevPara = sal_False ) const; - USHORT GetCursor() const { return nCursor; } + sal_uInt16 GetCursor() const { return nCursor; } }; diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index 50a776a5a9..351627674f 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -57,15 +57,15 @@ EditHTMLParser::EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValu { pImpEditEngine = 0; pCurAnchor = 0; - bInPara = FALSE; - bWasInPara = FALSE; + bInPara = sal_False; + bWasInPara = sal_False; nInTable = 0; nInCell = 0; - bInTitle = FALSE; + bInTitle = sal_False; nDefListLevel = 0; nBulletLevel = 0; nNumberingLevel = 0; - bFieldsInserted = FALSE; + bFieldsInserted = sal_False; DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW == GetSrcEncoding( ), "EditHTMLParser::EditHTMLParser: Where does the encoding come from?" ); DBG_ASSERT( !IsSwitchToUCS2(), "EditHTMLParser::::EditHTMLParser: Switch to UCS2?" ); @@ -75,7 +75,7 @@ EditHTMLParser::EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValu SetSrcEncoding( GetExtendedCompatibilityTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) ); // If the file starts with a BOM, switch to UCS2. - SetSwitchToUCS2( TRUE ); + SetSwitchToUCS2( sal_True ); if ( pHTTPHeaderAttrs ) SetEncodingByHTTPHeader( pHTTPHeaderAttrs ); @@ -93,7 +93,7 @@ SvParserState EditHTMLParser::CallParser( ImpEditEngine* pImpEE, const EditPaM& SvParserState _eState = SVPAR_NOTSTARTED; if ( pImpEditEngine ) { - // Umbrechmimik vom RTF-Import einbauen? + // Build in wrap mimic in RTF import? aCurSel = EditSelection( rPaM, rPaM ); if ( pImpEditEngine->aImportHdl.IsSet() ) @@ -129,16 +129,16 @@ void EditHTMLParser::NextToken( int nToken ) case HTML_META: { const HTMLOptions *_pOptions = GetOptions(); - USHORT nArrLen = _pOptions->Count(); - BOOL bEquiv = FALSE; - for ( USHORT i = 0; i < nArrLen; i++ ) + sal_uInt16 nArrLen = _pOptions->Count(); + sal_Bool bEquiv = sal_False; + for ( sal_uInt16 i = 0; i < nArrLen; i++ ) { const HTMLOption *pOption = (*_pOptions)[i]; switch( pOption->GetToken() ) { case HTML_O_HTTPEQUIV: { - bEquiv = TRUE; + bEquiv = sal_True; } break; case HTML_O_CONTENT: @@ -158,11 +158,11 @@ void EditHTMLParser::NextToken( int nToken ) break; case HTML_PLAINTEXT_ON: case HTML_PLAINTEXT2_ON: - bInPara = TRUE; + bInPara = sal_True; break; case HTML_PLAINTEXT_OFF: case HTML_PLAINTEXT2_OFF: - bInPara = FALSE; + bInPara = sal_False; break; case HTML_LINEBREAK: @@ -195,9 +195,7 @@ void EditHTMLParser::NextToken( int nToken ) if (!bInTitle) { if ( !bInPara ) - StartPara( FALSE ); - - // if ( bInPara || pCurAnchor ) + StartPara( sal_False ); String aText = aToken; if ( aText.Len() && ( aText.GetChar( 0 ) == ' ' ) @@ -210,10 +208,10 @@ void EditHTMLParser::NextToken( int nToken ) } else { - // Nur bis HTML mit 319 geschrieben ?! + // Only written until HTML with 319? if ( IsReadPRE() ) { - USHORT nTabPos = aText.Search( '\t', 0 ); + sal_uInt16 nTabPos = aText.Search( '\t', 0 ); while ( nTabPos != STRING_NOTFOUND ) { aText.Erase( nTabPos, 1 ); @@ -228,9 +226,9 @@ void EditHTMLParser::NextToken( int nToken ) break; case HTML_CENTER_ON: - case HTML_CENTER_OFF: // if ( bInPara ) + case HTML_CENTER_OFF: { - USHORT nNode = pImpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() ); + sal_uInt16 nNode = pImpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() ); SfxItemSet aItems( aCurSel.Max().GetNode()->GetContentAttribs().GetItems() ); aItems.ClearItem( EE_PARA_JUST ); if ( nToken == HTML_CENTER_ON ) @@ -246,13 +244,13 @@ void EditHTMLParser::NextToken( int nToken ) case HTML_PARABREAK_ON: if( bInPara && HasTextInCurrentPara() ) - EndPara( TRUE ); - StartPara( TRUE ); + EndPara( sal_True ); + StartPara( sal_True ); break; case HTML_PARABREAK_OFF: if( bInPara ) - EndPara( TRUE ); + EndPara( sal_True ); break; case HTML_HEAD1_ON: @@ -281,7 +279,7 @@ void EditHTMLParser::NextToken( int nToken ) case HTML_XMP_ON: case HTML_LISTING_ON: { - StartPara( TRUE ); + StartPara( sal_True ); ImpSetStyleSheet( STYLE_PRE ); } break; @@ -301,14 +299,14 @@ void EditHTMLParser::NextToken( int nToken ) case HTML_TABLE_ON: nInTable++; break; - case HTML_TABLE_OFF: DBG_ASSERT( nInTable, "Nicht in Table, aber TABLE_OFF?" ); + case HTML_TABLE_OFF: DBG_ASSERT( nInTable, "Not in Table, but TABLE_OFF?" ); nInTable--; break; case HTML_TABLEHEADER_ON: case HTML_TABLEDATA_ON: nInCell++; - // fallthru + // fall through case HTML_BLOCKQUOTE_ON: case HTML_BLOCKQUOTE_OFF: case HTML_BLOCKQUOTE30_ON: @@ -320,10 +318,10 @@ void EditHTMLParser::NextToken( int nToken ) case HTML_ORDERLIST_ON: case HTML_UNORDERLIST_ON: { - BOOL bHasText = HasTextInCurrentPara(); + sal_Bool bHasText = HasTextInCurrentPara(); if ( bHasText ) ImpInsertParaBreak(); - StartPara( FALSE ); + StartPara( sal_False ); } break; @@ -333,17 +331,17 @@ void EditHTMLParser::NextToken( int nToken ) if ( nInCell ) nInCell--; } - // fallthru + // fall through case HTML_LISTHEADER_OFF: case HTML_LI_OFF: case HTML_DD_OFF: case HTML_DT_OFF: case HTML_ORDERLIST_OFF: - case HTML_UNORDERLIST_OFF: EndPara( FALSE ); + case HTML_UNORDERLIST_OFF: EndPara( sal_False ); break; case HTML_TABLEROW_ON: - case HTML_TABLEROW_OFF: // Nur nach einem CELL ein RETURN, fuer Calc + case HTML_TABLEROW_OFF: // A RETURN only after a CELL, for Calc case HTML_COL_ON: case HTML_COLGROUP_ON: @@ -354,14 +352,11 @@ void EditHTMLParser::NextToken( int nToken ) case HTML_FONT_OFF: // ... break; - - // #58335# kein SkipGroup on/off auf inline markup etc. - case HTML_TITLE_ON: - bInTitle = TRUE; + bInTitle = sal_True; break; case HTML_TITLE_OFF: - bInTitle = FALSE; + bInTitle = sal_False; break; // globals @@ -391,7 +386,7 @@ void EditHTMLParser::NextToken( int nToken ) // HTML 2.0 case HTML_ADDRESS_ON: case HTML_ADDRESS_OFF: -// case HTML_BLOCKQUOTE_ON: //! extra Behandlung +// case HTML_BLOCKQUOTE_ON: //! special handling // case HTML_BLOCKQUOTE_OFF: case HTML_CITIATION_ON: case HTML_CITIATION_OFF: @@ -418,7 +413,7 @@ void EditHTMLParser::NextToken( int nToken ) case HTML_ACRONYM_OFF: case HTML_AUTHOR_ON: case HTML_AUTHOR_OFF: -// case HTML_BLOCKQUOTE30_ON: //! extra Behandlung +// case HTML_BLOCKQUOTE30_ON: //! special handling // case HTML_BLOCKQUOTE30_OFF: case HTML_DELETEDTEXT_ON: case HTML_DELETEDTEXT_OFF: @@ -461,20 +456,20 @@ void EditHTMLParser::NextToken( int nToken ) // misc case HTML_DIRLIST_ON: case HTML_DIRLIST_OFF: - case HTML_FOOTNOTE_ON: //! landen so im Text + case HTML_FOOTNOTE_ON: //! land so im Text case HTML_FOOTNOTE_OFF: case HTML_MENULIST_ON: case HTML_MENULIST_OFF: -// case HTML_PLAINTEXT_ON: //! extra Behandlung +// case HTML_PLAINTEXT_ON: //! special handling // case HTML_PLAINTEXT_OFF: -// case HTML_PREFORMTXT_ON: //! extra Behandlung +// case HTML_PREFORMTXT_ON: //! special handling // case HTML_PREFORMTXT_OFF: case HTML_SPAN_ON: case HTML_SPAN_OFF: // obsolete -// case HTML_XMP_ON: //! extra Behandlung +// case HTML_XMP_ON: //! special handling // case HTML_XMP_OFF: -// case HTML_LISTING_ON: //! extra Behandlung +// case HTML_LISTING_ON: //! special handling // case HTML_LISTING_OFF: // Netscape case HTML_BLINK_ON: @@ -488,7 +483,7 @@ void EditHTMLParser::NextToken( int nToken ) // Internet Explorer case HTML_MARQUEE_ON: case HTML_MARQUEE_OFF: -// case HTML_PLAINTEXT2_ON: //! extra Behandlung +// case HTML_PLAINTEXT2_ON: //! special handling // case HTML_PLAINTEXT2_OFF: break; @@ -502,7 +497,7 @@ void EditHTMLParser::NextToken( int nToken ) } else if ( !(nToken & 1) ) { - DBG_ASSERT( !( nToken & 1 ), "Kein Start-Token ?!" ); + DBG_ASSERT( !( nToken & 1 ), "No Start-Token ?!" ); SkipGroup( nToken + 1 ); } } @@ -534,9 +529,9 @@ void EditHTMLParser::ImpInsertParaBreak() void EditHTMLParser::ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSel ) { - // pSel, wenn Zeichenattribute, sonst Absatzattribute fuer den - // aktuellen Absatz. - DBG_ASSERT( pSel || ( aCurSel.Min().GetNode() == aCurSel.Max().GetNode() ), "ImpInsertAttribs: Selektion?" ); + // pSel, when character attributes, otherwise paragraph attributes for + // the current paragraph. + DBG_ASSERT( pSel || ( aCurSel.Min().GetNode() == aCurSel.Max().GetNode() ), "ImpInsertAttribs: Selection?" ); EditPaM aStartPaM( pSel ? pSel->Min() : aCurSel.Min() ); EditPaM aEndPaM( pSel ? pSel->Max() : aCurSel.Max() ); @@ -556,162 +551,125 @@ void EditHTMLParser::ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSe } ContentNode* pSN = aStartPaM.GetNode(); - USHORT nStartNode = pImpEditEngine->GetEditDoc().GetPos( pSN ); + sal_uInt16 nStartNode = pImpEditEngine->GetEditDoc().GetPos( pSN ); - // Wenn ein Attribut von 0 bis aktuelle Absatzlaenge geht, - // soll es ein Absatz-Attribut sein! + // If an attribute goes from 0 to current Paragraph length, + // then it should be a paragraph attribute! - // Achtung: Selektion kann ueber mehrere Absaetze gehen. - // Alle vollstaendigen Absaetze sind Absatzattribute... + // Note: Selection can reach over several Paragraphs. + // All complete paragraphs are paragraph attributes ... - // HTML eigentlich nicht: + // not really HTML: #ifdef DBG_UTIL ContentNode* pEN = aEndPaM.GetNode(); - USHORT nEndNode = pImpEditEngine->GetEditDoc().GetPos( pEN ); - DBG_ASSERT( nStartNode == nEndNode, "ImpSetAttribs: Mehrere Absaetze?" ); + sal_uInt16 nEndNode = pImpEditEngine->GetEditDoc().GetPos( pEN ); + DBG_ASSERT( nStartNode == nEndNode, "ImpSetAttribs: Several paragraphs?" ); #endif -/* - for ( USHORT z = nStartNode+1; z < nEndNode; z++ ) - { - DBG_ASSERT( pImpEditEngine->GetEditDoc().SaveGetObject( z ), "Node existiert noch nicht(RTF)" ); - pImpEditEngine->SetParaAttribs( z, rSet.GetAttrSet() ); - } - - if ( aStartPaM.GetNode() != aEndPaM.GetNode() ) + if ( ( aStartPaM.GetIndex() == 0 ) && ( aEndPaM.GetIndex() == aEndPaM.GetNode()->Len() ) ) { - // Den Rest des StartNodes... - if ( aStartPaM.GetIndex() == 0 ) - pImpEditEngine->SetParaAttribs( nStartNode, rSet.GetAttrSet() ); - else - pImpEditEngine->SetAttribs( EditSelection( aStartPaM, EditPaM( aStartPaM.GetNode(), aStartPaM.GetNode()->Len() ) ), rSet.GetAttrSet() ); - - // Den Anfang des EndNodes.... - if ( aEndPaM.GetIndex() == aEndPaM.GetNode()->Len() ) - pImpEditEngine->SetParaAttribs( nEndNode, rSet.GetAttrSet() ); - else - pImpEditEngine->SetAttribs( EditSelection( EditPaM( aEndPaM.GetNode(), 0 ), aEndPaM ), rSet.GetAttrSet() ); + // Has to be merged: + SfxItemSet aItems( pImpEditEngine->GetParaAttribs( nStartNode ) ); + aItems.Put( rItems ); + pImpEditEngine->SetParaAttribs( nStartNode, aItems ); } else -*/ - { - if ( ( aStartPaM.GetIndex() == 0 ) && ( aEndPaM.GetIndex() == aEndPaM.GetNode()->Len() ) ) - { - // Muesse gemergt werden: - SfxItemSet aItems( pImpEditEngine->GetParaAttribs( nStartNode ) ); - aItems.Put( rItems ); - pImpEditEngine->SetParaAttribs( nStartNode, aItems ); - } - else - pImpEditEngine->SetAttribs( EditSelection( aStartPaM, aEndPaM ), rItems ); - } + pImpEditEngine->SetAttribs( EditSelection( aStartPaM, aEndPaM ), rItems ); } -void EditHTMLParser::ImpSetStyleSheet( USHORT nHLevel ) +void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel ) { /* - nHLevel: 0: Ausschalten + nHLevel: 0: Turn off 1-6: Heading STYLE_PRE: Preformatted */ + // Create hard attributes ... + // Enough for Calc, would have to be clarified with StyleSheets + // that they should also be in the app so that when they are feed + // in a different engine still are here ... + sal_uInt16 nNode = pImpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() ); -// if ( pImpEditEngine->GetStatus().DoImportRTFStyleSheets() ) -// { -// SvxRTFStyleType* pS = GetStyleTbl().Get( rSet.StyleNo() ); -// DBG_ASSERT( pS, "Vorlage in RTF nicht definiert!" ); -// if ( pS ) -// pImpEditEngine->SetStyleSheet( EditSelection( aStartPaM, aEndPaM ), pS->sName, SFX_STYLE_FAMILY_ALL ); -// } -// else - { - // Harte Attribute erzeugen... - // Reicht fuer Calc, bei StyleSheets muesste noch geklaert werden, - // dass diese auch in der App liegen sollten, damit sie beim - // fuettern in eine andere Engine auch noch da sind... - - USHORT nNode = pImpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() ); -// SfxItemSet aItems( pImpEditEngine->GetEmptyItemSet() ); - SfxItemSet aItems( aCurSel.Max().GetNode()->GetContentAttribs().GetItems() ); + SfxItemSet aItems( aCurSel.Max().GetNode()->GetContentAttribs().GetItems() ); - aItems.ClearItem( EE_PARA_ULSPACE ); + aItems.ClearItem( EE_PARA_ULSPACE ); - aItems.ClearItem( EE_CHAR_FONTHEIGHT ); - aItems.ClearItem( EE_CHAR_FONTINFO ); - aItems.ClearItem( EE_CHAR_WEIGHT ); + aItems.ClearItem( EE_CHAR_FONTHEIGHT ); + aItems.ClearItem( EE_CHAR_FONTINFO ); + aItems.ClearItem( EE_CHAR_WEIGHT ); - aItems.ClearItem( EE_CHAR_FONTHEIGHT_CJK ); - aItems.ClearItem( EE_CHAR_FONTINFO_CJK ); - aItems.ClearItem( EE_CHAR_WEIGHT_CJK ); + aItems.ClearItem( EE_CHAR_FONTHEIGHT_CJK ); + aItems.ClearItem( EE_CHAR_FONTINFO_CJK ); + aItems.ClearItem( EE_CHAR_WEIGHT_CJK ); - aItems.ClearItem( EE_CHAR_FONTHEIGHT_CTL ); - aItems.ClearItem( EE_CHAR_FONTINFO_CTL ); - aItems.ClearItem( EE_CHAR_WEIGHT_CTL ); + aItems.ClearItem( EE_CHAR_FONTHEIGHT_CTL ); + aItems.ClearItem( EE_CHAR_FONTINFO_CTL ); + aItems.ClearItem( EE_CHAR_WEIGHT_CTL ); - // Fett in den ersten 3 Headings - if ( ( nHLevel >= 1 ) && ( nHLevel <= 3 ) ) - { - SvxWeightItem aWeightItem( WEIGHT_BOLD, EE_CHAR_WEIGHT ); - aItems.Put( aWeightItem ); + // Bold in the first 3 Headings + if ( ( nHLevel >= 1 ) && ( nHLevel <= 3 ) ) + { + SvxWeightItem aWeightItem( WEIGHT_BOLD, EE_CHAR_WEIGHT ); + aItems.Put( aWeightItem ); - SvxWeightItem aWeightItemCJK( WEIGHT_BOLD, EE_CHAR_WEIGHT_CJK ); - aItems.Put( aWeightItem ); + SvxWeightItem aWeightItemCJK( WEIGHT_BOLD, EE_CHAR_WEIGHT_CJK ); + aItems.Put( aWeightItem ); - SvxWeightItem aWeightItemCTL( WEIGHT_BOLD, EE_CHAR_WEIGHT_CTL ); - aItems.Put( aWeightItem ); - } + SvxWeightItem aWeightItemCTL( WEIGHT_BOLD, EE_CHAR_WEIGHT_CTL ); + aItems.Put( aWeightItem ); + } - // Fonthoehe und Abstaende, wenn LogicToLogic moeglich: - MapUnit eUnit = pImpEditEngine->GetRefMapMode().GetMapUnit(); - if ( ( eUnit != MAP_PIXEL ) && ( eUnit != MAP_SYSFONT ) && - ( eUnit != MAP_APPFONT ) && ( eUnit != MAP_RELATIVE ) ) - { - long nPoints = 10; - if ( nHLevel == 1 ) - nPoints = 22; - else if ( nHLevel == 2 ) - nPoints = 16; - else if ( nHLevel == 3 ) - nPoints = 12; - else if ( nHLevel == 4 ) - nPoints = 11; + // Font hight and margins, when LogicToLogic is possible: + MapUnit eUnit = pImpEditEngine->GetRefMapMode().GetMapUnit(); + if ( ( eUnit != MAP_PIXEL ) && ( eUnit != MAP_SYSFONT ) && + ( eUnit != MAP_APPFONT ) && ( eUnit != MAP_RELATIVE ) ) + { + long nPoints = 10; + if ( nHLevel == 1 ) + nPoints = 22; + else if ( nHLevel == 2 ) + nPoints = 16; + else if ( nHLevel == 3 ) + nPoints = 12; + else if ( nHLevel == 4 ) + nPoints = 11; - nPoints = OutputDevice::LogicToLogic( nPoints, MAP_POINT, eUnit ); + nPoints = OutputDevice::LogicToLogic( nPoints, MAP_POINT, eUnit ); - SvxFontHeightItem aHeightItem( nPoints, 100, EE_CHAR_FONTHEIGHT ); - aItems.Put( aHeightItem ); + SvxFontHeightItem aHeightItem( nPoints, 100, EE_CHAR_FONTHEIGHT ); + aItems.Put( aHeightItem ); - SvxFontHeightItem aHeightItemCJK( nPoints, 100, EE_CHAR_FONTHEIGHT_CJK ); - aItems.Put( aHeightItemCJK ); + SvxFontHeightItem aHeightItemCJK( nPoints, 100, EE_CHAR_FONTHEIGHT_CJK ); + aItems.Put( aHeightItemCJK ); - SvxFontHeightItem aHeightItemCTL( nPoints, 100, EE_CHAR_FONTHEIGHT_CTL ); - aItems.Put( aHeightItemCTL ); + SvxFontHeightItem aHeightItemCTL( nPoints, 100, EE_CHAR_FONTHEIGHT_CTL ); + aItems.Put( aHeightItemCTL ); - // Absatzabstaende, wenn Heading: - if ( !nHLevel || ((nHLevel >= 1) && (nHLevel <= 6)) ) - { - SvxULSpaceItem aULSpaceItem( EE_PARA_ULSPACE ); - aULSpaceItem.SetUpper( (USHORT)OutputDevice::LogicToLogic( 42, MAP_10TH_MM, eUnit ) ); - aULSpaceItem.SetLower( (USHORT)OutputDevice::LogicToLogic( 35, MAP_10TH_MM, eUnit ) ); - aItems.Put( aULSpaceItem ); - } - } + // Paragraph margins, when Heading: + if ( !nHLevel || ((nHLevel >= 1) && (nHLevel <= 6)) ) + { + SvxULSpaceItem aULSpaceItem( EE_PARA_ULSPACE ); + aULSpaceItem.SetUpper( (sal_uInt16)OutputDevice::LogicToLogic( 42, MAP_10TH_MM, eUnit ) ); + aULSpaceItem.SetLower( (sal_uInt16)OutputDevice::LogicToLogic( 35, MAP_10TH_MM, eUnit ) ); + aItems.Put( aULSpaceItem ); + } + } - // Bei Pre einen proportionalen Font waehlen - if ( nHLevel == STYLE_PRE ) - { - Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, LANGUAGE_SYSTEM, 0 ); - SvxFontItem aFontItem( aFont.GetFamily(), aFont.GetName(), XubString(), aFont.GetPitch(), aFont.GetCharSet(), EE_CHAR_FONTINFO ); - aItems.Put( aFontItem ); + // Choose a proportional Font for Pre + if ( nHLevel == STYLE_PRE ) + { + Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, LANGUAGE_SYSTEM, 0 ); + SvxFontItem aFontItem( aFont.GetFamily(), aFont.GetName(), XubString(), aFont.GetPitch(), aFont.GetCharSet(), EE_CHAR_FONTINFO ); + aItems.Put( aFontItem ); - SvxFontItem aFontItemCJK( aFont.GetFamily(), aFont.GetName(), XubString(), aFont.GetPitch(), aFont.GetCharSet(), EE_CHAR_FONTINFO_CJK ); - aItems.Put( aFontItemCJK ); + SvxFontItem aFontItemCJK( aFont.GetFamily(), aFont.GetName(), XubString(), aFont.GetPitch(), aFont.GetCharSet(), EE_CHAR_FONTINFO_CJK ); + aItems.Put( aFontItemCJK ); - SvxFontItem aFontItemCTL( aFont.GetFamily(), aFont.GetName(), XubString(), aFont.GetPitch(), aFont.GetCharSet(), EE_CHAR_FONTINFO_CTL ); - aItems.Put( aFontItemCTL ); - } + SvxFontItem aFontItemCTL( aFont.GetFamily(), aFont.GetName(), XubString(), aFont.GetPitch(), aFont.GetCharSet(), EE_CHAR_FONTINFO_CTL ); + aItems.Put( aFontItemCTL ); + } - pImpEditEngine->SetParaAttribs( nNode, aItems ); - } + pImpEditEngine->SetParaAttribs( nNode, aItems ); } void EditHTMLParser::ImpInsertText( const String& rText ) @@ -730,10 +688,10 @@ void EditHTMLParser::ImpInsertText( const String& rText ) void EditHTMLParser::SkipGroup( int nEndToken ) { - // #69109# groups in cells are closed upon leaving the cell, because those + // groups in cells are closed upon leaving the cell, because those // ******* web authors don't know their job // for example: <td><form></td> lacks a closing </form> - BYTE nCellLevel = nInCell; + sal_uInt8 nCellLevel = nInCell; int nToken; while( nCellLevel <= nInCell && ( (nToken = GetNextToken() ) != nEndToken ) && nToken ) { @@ -752,14 +710,14 @@ void EditHTMLParser::SkipGroup( int nEndToken ) } } -void EditHTMLParser::StartPara( BOOL bReal ) +void EditHTMLParser::StartPara( sal_Bool bReal ) { if ( bReal ) { const HTMLOptions *_pOptions = GetOptions(); - USHORT nArrLen = _pOptions->Count(); + sal_uInt16 nArrLen = _pOptions->Count(); SvxAdjust eAdjust = SVX_ADJUST_LEFT; - for ( USHORT i = 0; i < nArrLen; i++ ) + for ( sal_uInt16 i = 0; i < nArrLen; i++ ) { const HTMLOption *pOption = (*_pOptions)[i]; switch( pOption->GetToken() ) @@ -782,50 +740,46 @@ void EditHTMLParser::StartPara( BOOL bReal ) aItemSet.Put( SvxAdjustItem( eAdjust, EE_PARA_JUST ) ); ImpSetAttribs( aItemSet ); } - bInPara = TRUE; + bInPara = sal_True; } -void EditHTMLParser::EndPara( BOOL ) +void EditHTMLParser::EndPara( sal_Bool ) { if ( bInPara ) { - BOOL bHasText = HasTextInCurrentPara(); + sal_Bool bHasText = HasTextInCurrentPara(); if ( bHasText ) ImpInsertParaBreak(); - // Nur, wenn ohne Absatzabstaende gearbeitet wird... -// if ( !nInTable && bReal && (nNumberingLevel<=1) && (nBulletLevel<=1) ) -// ImpInsertParaBreak(); } - bInPara = FALSE; + bInPara = sal_False; } -BOOL EditHTMLParser::ThrowAwayBlank() +sal_Bool EditHTMLParser::ThrowAwayBlank() { - // Ein Blank muss weggeschmissen werden, wenn der neue Text mit einem - // Blank beginnt und der aktuelle Absatz leer ist oder mit einem - // Blank endet... + // A blank must be thrown away if the new text begins with a Blank and + // if the current paragraph is empty or ends with a Blank... ContentNode* pNode = aCurSel.Max().GetNode(); if ( pNode->Len() && ( pNode->GetChar( pNode->Len()-1 ) != ' ' ) ) - return FALSE; - return TRUE; + return sal_False; + return sal_True; } -BOOL EditHTMLParser::HasTextInCurrentPara() +sal_Bool EditHTMLParser::HasTextInCurrentPara() { - return aCurSel.Max().GetNode()->Len() ? TRUE : FALSE; + return aCurSel.Max().GetNode()->Len() ? sal_True : sal_False; } void EditHTMLParser::AnchorStart() { - // Anker im Anker ignoriern + // ignore anchor in anchor if ( !pCurAnchor ) { const HTMLOptions* _pOptions = GetOptions(); - USHORT nArrLen = _pOptions->Count(); + sal_uInt16 nArrLen = _pOptions->Count(); String aRef; - for ( USHORT i = 0; i < nArrLen; i++ ) + for ( sal_uInt16 i = 0; i < nArrLen; i++ ) { const HTMLOption* pOption = (*_pOptions)[i]; switch( pOption->GetToken() ) @@ -856,10 +810,10 @@ void EditHTMLParser::AnchorEnd() { if ( pCurAnchor ) { - // Als URL-Feld einfuegen... + // Insert as URL-Field... SvxFieldItem aFld( SvxURLField( pCurAnchor->aHRef, pCurAnchor->aText, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD ); aCurSel = pImpEditEngine->InsertField( aCurSel, aFld ); - bFieldsInserted = TRUE; + bFieldsInserted = sal_True; delete pCurAnchor; pCurAnchor = 0; @@ -874,26 +828,26 @@ void EditHTMLParser::AnchorEnd() void EditHTMLParser::HeadingStart( int nToken ) { bWasInPara = bInPara; - StartPara( FALSE ); + StartPara( sal_False ); if ( bWasInPara && HasTextInCurrentPara() ) ImpInsertParaBreak(); - USHORT nId = sal::static_int_cast< USHORT >( + sal_uInt16 nId = sal::static_int_cast< sal_uInt16 >( 1 + ( ( nToken - HTML_HEAD1_ON ) / 2 ) ); - DBG_ASSERT( (nId >= 1) && (nId <= 9), "HeadingStart: ID kann nicht stimmen!" ); + DBG_ASSERT( (nId >= 1) && (nId <= 9), "HeadingStart: ID can not be correct!" ); ImpSetStyleSheet( nId ); } void EditHTMLParser::HeadingEnd( int ) { - EndPara( FALSE ); + EndPara( sal_False ); ImpSetStyleSheet( 0 ); if ( bWasInPara ) { - bInPara = TRUE; - bWasInPara = FALSE; + bInPara = sal_True; + bWasInPara = sal_False; } } diff --git a/editeng/source/editeng/eehtml.hxx b/editeng/source/editeng/eehtml.hxx index 75dcfdae53..43d55cdfd8 100644 --- a/editeng/source/editeng/eehtml.hxx +++ b/editeng/source/editeng/eehtml.hxx @@ -53,34 +53,34 @@ private: ImpEditEngine* pImpEditEngine; AnchorInfo* pCurAnchor; - BOOL bInPara; - BOOL bWasInPara; // bInPara vor HeadingStart merken, weil sonst hinterher weg - BOOL bFieldsInserted; - BYTE nInTable; - BYTE nInCell; - BOOL bInTitle; + sal_Bool bInPara; + sal_Bool bWasInPara; // Remember bInPara before HeadingStart, because afterwards it will be gone. + sal_Bool bFieldsInserted; + sal_uInt8 nInTable; + sal_uInt8 nInCell; + sal_Bool bInTitle; - BYTE nDefListLevel; - BYTE nBulletLevel; - BYTE nNumberingLevel; + sal_uInt8 nDefListLevel; + sal_uInt8 nBulletLevel; + sal_uInt8 nNumberingLevel; - BYTE nLastAction; + sal_uInt8 nLastAction; - void StartPara( BOOL bReal ); - void EndPara( BOOL bReal ); + void StartPara( sal_Bool bReal ); + void EndPara( sal_Bool bReal ); void AnchorStart(); void AnchorEnd(); void HeadingStart( int nToken ); void HeadingEnd( int nToken ); void SkipGroup( int nEndToken ); - BOOL ThrowAwayBlank(); - BOOL HasTextInCurrentPara(); - void ProcessUnknownControl( BOOL bOn ); + sal_Bool ThrowAwayBlank(); + sal_Bool HasTextInCurrentPara(); + void ProcessUnknownControl( sal_Bool bOn ); void ImpInsertParaBreak(); void ImpInsertText( const String& rText ); void ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSel = 0 ); - void ImpSetStyleSheet( USHORT nHeadingLevel ); + void ImpSetStyleSheet( sal_uInt16 nHeadingLevel ); protected: virtual void NextToken( int nToken ); diff --git a/editeng/source/editeng/eeobj.cxx b/editeng/source/editeng/eeobj.cxx index 34d5959709..cbe5e85fe0 100644 --- a/editeng/source/editeng/eeobj.cxx +++ b/editeng/source/editeng/eeobj.cxx @@ -62,20 +62,20 @@ uno::Any EditDataObject::getTransferData( const datatransfer::DataFlavor& rFlavo { uno::Any aAny; - ULONG nT = SotExchange::GetFormat( rFlavor ); + sal_uLong nT = SotExchange::GetFormat( rFlavor ); if ( nT == SOT_FORMAT_STRING ) { aAny <<= (::rtl::OUString)GetString(); } else if ( ( nT == SOT_FORMATSTR_ID_EDITENGINE ) || ( nT == SOT_FORMAT_RTF ) ) { - // MT 01/2002: No RTF on demand any more: + // No RTF on demand any more: // 1) Was not working, because I had to flush() the clipboard immediately anyway // 2) Don't have the old pool defaults and the StyleSheetPool here. SvMemoryStream* pStream = ( nT == SOT_FORMATSTR_ID_EDITENGINE ) ? &GetStream() : &GetRTFStream(); pStream->Seek( STREAM_SEEK_TO_END ); - ULONG nLen = pStream->Tell(); + sal_uLong nLen = pStream->Tell(); pStream->Seek(0); uno::Sequence< sal_Int8 > aSeq( nLen ); @@ -105,8 +105,8 @@ sal_Bool EditDataObject::isDataFlavorSupported( const datatransfer::DataFlavor& { sal_Bool bSupported = sal_False; - ULONG nT = SotExchange::GetFormat( rFlavor ); - if ( ( nT == SOT_FORMAT_STRING ) || ( nT == SOT_FORMAT_RTF ) /* || ( nT == SOT_FORMAT_XML ) */ || ( nT == SOT_FORMATSTR_ID_EDITENGINE ) ) + sal_uLong nT = SotExchange::GetFormat( rFlavor ); + if ( ( nT == SOT_FORMAT_STRING ) || ( nT == SOT_FORMAT_RTF ) || ( nT == SOT_FORMATSTR_ID_EDITENGINE ) ) bSupported = sal_True; return bSupported; diff --git a/editeng/source/editeng/eeobj.hxx b/editeng/source/editeng/eeobj.hxx index f6fa28f4b1..5629721ecc 100644 --- a/editeng/source/editeng/eeobj.hxx +++ b/editeng/source/editeng/eeobj.hxx @@ -45,9 +45,6 @@ private: String maOfficeBookmark; -// String maNetscapeBookmark; -// SvMemoryStream maRTFData; - public: EditDataObject(); ~EditDataObject(); diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index c1491b7643..219e60353b 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -96,10 +96,10 @@ GlobalEditData::GlobalEditData() GlobalEditData::~GlobalEditData() { - // DefItems zerstoeren... - // Oder einfach stehen lassen, da sowieso App-Ende?! + // Destroy DefItems... + // Or simply keep them, since at end of excecution?! if ( ppDefItems ) - SfxItemPool::ReleaseDefaults( ppDefItems, EDITITEMCOUNT, TRUE ); + SfxItemPool::ReleaseDefaults( ppDefItems, EDITITEMCOUNT, sal_True ); delete pStdRefDevice; } @@ -110,16 +110,16 @@ SfxPoolItem** GlobalEditData::GetDefItems() ppDefItems = new SfxPoolItem*[EDITITEMCOUNT]; // Paragraph attributes: - SvxNumRule aTmpNumRule( 0, 0, FALSE ); + SvxNumRule aTmpNumRule( 0, 0, sal_False ); ppDefItems[0] = new SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ); ppDefItems[1] = new SvXMLAttrContainerItem( EE_PARA_XMLATTRIBS ); - ppDefItems[2] = new SfxBoolItem( EE_PARA_HANGINGPUNCTUATION, FALSE ); - ppDefItems[3] = new SfxBoolItem( EE_PARA_FORBIDDENRULES, TRUE ); - ppDefItems[4] = new SvxScriptSpaceItem( TRUE, EE_PARA_ASIANCJKSPACING ); + ppDefItems[2] = new SfxBoolItem( EE_PARA_HANGINGPUNCTUATION, sal_False ); + ppDefItems[3] = new SfxBoolItem( EE_PARA_FORBIDDENRULES, sal_True ); + ppDefItems[4] = new SvxScriptSpaceItem( sal_True, EE_PARA_ASIANCJKSPACING ); ppDefItems[5] = new SvxNumBulletItem( aTmpNumRule, EE_PARA_NUMBULLET ); - ppDefItems[6] = new SfxBoolItem( EE_PARA_HYPHENATE, FALSE ); - ppDefItems[7] = new SfxBoolItem( EE_PARA_BULLETSTATE, TRUE ); + ppDefItems[6] = new SfxBoolItem( EE_PARA_HYPHENATE, sal_False ); + ppDefItems[7] = new SfxBoolItem( EE_PARA_BULLETSTATE, sal_True ); ppDefItems[8] = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE ); ppDefItems[9] = new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 ); ppDefItems[10] = new SvxBulletItem( EE_PARA_BULLET ); @@ -140,12 +140,12 @@ SfxPoolItem** GlobalEditData::GetDefItems() ppDefItems[23] = new SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE ); ppDefItems[24] = new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ); ppDefItems[25] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ); - ppDefItems[26] = new SvxContourItem( FALSE, EE_CHAR_OUTLINE ); - ppDefItems[27] = new SvxShadowedItem( FALSE, EE_CHAR_SHADOW ); + ppDefItems[26] = new SvxContourItem( sal_False, EE_CHAR_OUTLINE ); + ppDefItems[27] = new SvxShadowedItem( sal_False, EE_CHAR_SHADOW ); ppDefItems[28] = new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT ); - ppDefItems[29] = new SvxAutoKernItem( FALSE, EE_CHAR_PAIRKERNING ); + ppDefItems[29] = new SvxAutoKernItem( sal_False, EE_CHAR_PAIRKERNING ); ppDefItems[30] = new SvxKerningItem( 0, EE_CHAR_KERNING ); - ppDefItems[31] = new SvxWordLineModeItem( FALSE, EE_CHAR_WLM ); + ppDefItems[31] = new SvxWordLineModeItem( sal_False, EE_CHAR_WLM ); ppDefItems[32] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE ); ppDefItems[33] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK ); ppDefItems[34] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL ); @@ -160,12 +160,7 @@ SfxPoolItem** GlobalEditData::GetDefItems() ppDefItems[43] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ); ppDefItems[44] = new SvxCharReliefItem( RELIEF_NONE, EE_CHAR_RELIEF ); ppDefItems[45] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY ); -#ifndef SVX_LIGHT ppDefItems[46] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS ); -#else - // no need to have alien attributes persistent - ppDefItems[46] = new SfxVoidItem( EE_CHAR_XMLATTRIBS ); -#endif // #ifndef SVX_LIGHT ppDefItems[47] = new SvxOverlineItem( UNDERLINE_NONE, EE_CHAR_OVERLINE ); // Features @@ -204,7 +199,7 @@ uno::Reference< linguistic2::XLanguageGuessing > GlobalEditData::GetLanguageGues { xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >( xMgr->createInstance( - rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.linguistic2.LanguageGuessing" )) ), uno::UNO_QUERY ); } } @@ -221,7 +216,7 @@ OutputDevice* GlobalEditData::GetStdRefDevice() return pStdRefDevice; } -EditResId::EditResId( USHORT nId ): +EditResId::EditResId( sal_uInt16 nId ): ResId( nId, *EE_DLL()->GetResMgr() ) { } diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index d92da4962c..15f30917e6 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -44,16 +44,16 @@ #include <svtools/rtftoken.h> -// alle Werte auf default; wird nach einlesen der Bitmap aufgerufen ! +// Set all values to defaultt; is called after loading the bitmap! void SvxRTFPictureType::ResetValues() -{ // setze alle Werte RTF-Defaults +{ // Set all values RTF-Defaults eStyle = RTF_BITMAP; nMode = HEX_MODE; nType = nGoalWidth = nGoalHeight = 0; nWidth = nHeight = nWidthBytes = 0; uPicLen = 0; nBitsPerPixel = nPlanes = 1; - nScalX = nScalY = 100; // Skalierung in Prozent + nScalX = nScalY = 100; // Scale in percent nCropT = nCropB = nCropL = nCropR = 0; aPropertyPairs.clear(); } @@ -87,11 +87,10 @@ EditRTFParser::EditRTFParser( SvStream& rIn, EditSelection aSel, SfxItemPool& rA SetInsPos( EditPosition( pImpEditEngine, &aCurSel ) ); - // Umwandeln der Twips-Werte... - SetCalcValue( TRUE ); + // Convert the twips values ... + SetCalcValue( sal_True ); SetChkStyleAttr( pImpEE->GetStatus().DoImportRTFStyleSheets() ); - SetNewDoc( FALSE ); // damit die Pool-Defaults nicht - // ueberschrieben werden... + SetNewDoc( sal_False ); // So that the Pool-Defaults are not overwritten... aEditMapMode = MapMode( pImpEE->GetRefDevice()->GetMapMode().GetMapUnit() ); } @@ -99,23 +98,23 @@ EditRTFParser::~EditRTFParser() { } -SvParserState __EXPORT EditRTFParser::CallParser() +SvParserState EditRTFParser::CallParser() { - DBG_ASSERT( !aCurSel.HasRange(), "Selection bei CallParser!" ); - // Den Teil, in den importiert wird, vom Rest abtrennen. - // Diese Mimik sollte fuer alle Imports verwendet werden. - // aStart1PaM: Letzte Position vor dem importierten Inhalt - // aEnd1PaM: Erste Position nach dem importierten Inhalt - // aStart2PaM: Erste Position des importierten Inhaltes - // aEnd2PaM: Letzte Position des importierten Inhaltes + DBG_ASSERT( !aCurSel.HasRange(), "Selection for CallParser!" ); + // Separate the part that is imported from the rest. + // This expression should be used for all imports. + // aStart1PaM: Last position before the imported content + // aEnd1PaM: First position after the imported content + // aStart2PaM: First position of the imported content + // aEnd2PaM: Last position of the imported content EditPaM aStart1PaM( aCurSel.Min().GetNode(), aCurSel.Min().GetIndex() ); aCurSel = pImpEditEngine->ImpInsertParaBreak( aCurSel ); EditPaM aStart2PaM = aCurSel.Min(); - // Sinnvoll oder nicht?: + // Useful or not? aStart2PaM.GetNode()->GetContentAttribs().GetItems().ClearItem(); AddRTFDefaultValues( aStart2PaM, aStart2PaM ); EditPaM aEnd1PaM( pImpEditEngine->ImpInsertParaBreak( aCurSel.Max() ) ); - // aCurCel zeigt jetzt auf den Zwischenraum + // aCurCel now points to the gap if ( pImpEditEngine->aImportHdl.IsSet() ) { @@ -134,9 +133,9 @@ SvParserState __EXPORT EditRTFParser::CallParser() if ( nLastAction == ACTION_INSERTPARABRK ) { ContentNode* pCurNode = aCurSel.Max().GetNode(); - USHORT nPara = pImpEditEngine->GetEditDoc().GetPos( pCurNode ); + sal_uInt16 nPara = pImpEditEngine->GetEditDoc().GetPos( pCurNode ); ContentNode* pPrevNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara-1 ); - DBG_ASSERT( pPrevNode, "Ungueltiges RTF-Dokument ?!" ); + DBG_ASSERT( pPrevNode, "Invalid RTF-Document?!" ); EditSelection aSel; aSel.Min() = EditPaM( pPrevNode, pPrevNode->Len() ); aSel.Max() = EditPaM( pCurNode, 0 ); @@ -144,18 +143,18 @@ SvParserState __EXPORT EditRTFParser::CallParser() } EditPaM aEnd2PaM( aCurSel.Max() ); //AddRTFDefaultValues( aStart2PaM, aEnd2PaM ); - BOOL bOnlyOnePara = ( aEnd2PaM.GetNode() == aStart2PaM.GetNode() ); - // Den Brocken wieder einfuegen... - // Problem: Absatzattribute duerfen ggf. nicht uebernommen werden - // => Zeichenattribute machen. + sal_Bool bOnlyOnePara = ( aEnd2PaM.GetNode() == aStart2PaM.GetNode() ); + // Paste the chunk again ... + // Problem: Paragraph attributes may not possibly be taken over + // => Do Character attributes. - BOOL bSpecialBackward = aStart1PaM.GetNode()->Len() ? FALSE : TRUE; + sal_Bool bSpecialBackward = aStart1PaM.GetNode()->Len() ? sal_False : sal_True; if ( bOnlyOnePara || aStart1PaM.GetNode()->Len() ) pImpEditEngine->ParaAttribsToCharAttribs( aStart2PaM.GetNode() ); aCurSel.Min() = pImpEditEngine->ImpConnectParagraphs( aStart1PaM.GetNode(), aStart2PaM.GetNode(), bSpecialBackward ); - bSpecialBackward = aEnd1PaM.GetNode()->Len() ? TRUE : FALSE; - // wenn bOnlyOnePara, dann ist der Node beim Connect verschwunden. + bSpecialBackward = aEnd1PaM.GetNode()->Len() ? sal_True : sal_False; + // when bOnlyOnePara, then the node is gone on Connect. if ( !bOnlyOnePara && aEnd1PaM.GetNode()->Len() ) pImpEditEngine->ParaAttribsToCharAttribs( aEnd2PaM.GetNode() ); aCurSel.Max() = pImpEditEngine->ImpConnectParagraphs( @@ -167,7 +166,7 @@ SvParserState __EXPORT EditRTFParser::CallParser() void EditRTFParser::AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& rEnd ) { - // Problem: DefFont und DefFontHeight + // Problem: DefFont and DefFontHeight Size aSz( 12, 0 ); MapMode aPntMode( MAP_POINT ); MapMode _aEditMapMode( pImpEditEngine->GetRefDevice()->GetMapMode().GetMapUnit() ); @@ -177,12 +176,12 @@ void EditRTFParser::AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& r SvxFontItem aFontItem( aDefFont.GetFamily(), aDefFont.GetName(), aDefFont.GetStyleName(), aDefFont.GetPitch(), aDefFont.GetCharSet(), EE_CHAR_FONTINFO ); - USHORT nStartPara = pImpEditEngine->GetEditDoc().GetPos( rStart.GetNode() ); - USHORT nEndPara = pImpEditEngine->GetEditDoc().GetPos( rEnd.GetNode() ); - for ( USHORT nPara = nStartPara; nPara <= nEndPara; nPara++ ) + sal_uInt16 nStartPara = pImpEditEngine->GetEditDoc().GetPos( rStart.GetNode() ); + sal_uInt16 nEndPara = pImpEditEngine->GetEditDoc().GetPos( rEnd.GetNode() ); + for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ ) { ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara ); - DBG_ASSERT( pNode, "AddRTFDefaultValues - Kein Absatz ?!" ); + DBG_ASSERT( pNode, "AddRTFDefaultValues - No paragraph?!" ); if ( !pNode->GetContentAttribs().HasItem( EE_CHAR_FONTINFO ) ) pNode->GetContentAttribs().GetItems().Put( aFontItem ); if ( !pNode->GetContentAttribs().HasItem( EE_CHAR_FONTHEIGHT ) ) @@ -190,18 +189,18 @@ void EditRTFParser::AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& r } } -void __EXPORT EditRTFParser::NextToken( int nToken ) +void EditRTFParser::NextToken( int nToken ) { switch( nToken ) { case RTF_DEFF: { - nDefFont = USHORT(nTokenValue); + nDefFont = sal_uInt16(nTokenValue); } break; case RTF_DEFTAB: { - nDefTab = USHORT(nTokenValue); + nDefTab = sal_uInt16(nTokenValue); } break; case RTF_CELL: @@ -242,10 +241,10 @@ void __EXPORT EditRTFParser::NextToken( int nToken ) } } -void __EXPORT EditRTFParser::UnknownAttrToken( int nToken, SfxItemSet* ) +void EditRTFParser::UnknownAttrToken( int nToken, SfxItemSet* ) { - // fuer Tokens, die im ReadAttr nicht ausgewertet werden - // Eigentlich nur fuer Calc (RTFTokenHdl), damit RTF_INTBL + // for Tokens which are not evaluated in ReadAttr + // Actually, only for Calc (RTFTokenHdl), so that RTF_INTBL if ( pImpEditEngine->aImportHdl.IsSet() ) { ImportInfo aImportInfo( RTFIMP_UNKNOWNATTR, this, pImpEditEngine->CreateESel( aCurSel ) ); @@ -255,7 +254,7 @@ void __EXPORT EditRTFParser::UnknownAttrToken( int nToken, SfxItemSet* ) } } -void __EXPORT EditRTFParser::InsertText() +void EditRTFParser::InsertText() { String aText( aToken ); if ( pImpEditEngine->aImportHdl.IsSet() ) @@ -268,7 +267,7 @@ void __EXPORT EditRTFParser::InsertText() nLastAction = ACTION_INSERTTEXT; } -void __EXPORT EditRTFParser::InsertPara() +void EditRTFParser::InsertPara() { if ( pImpEditEngine->aImportHdl.IsSet() ) { @@ -279,7 +278,7 @@ void __EXPORT EditRTFParser::InsertPara() nLastAction = ACTION_INSERTPARABRK; } -void __EXPORT EditRTFParser::MovePos( int bForward ) +void EditRTFParser::MovePos( int bForward ) { if( bForward ) aCurSel = pImpEditEngine->CursorRight( aCurSel.Max(), ::com::sun::star::i18n::CharacterIteratorMode::SKIPCHARACTER ); @@ -287,17 +286,16 @@ void __EXPORT EditRTFParser::MovePos( int bForward ) aCurSel = pImpEditEngine->CursorLeft( aCurSel.Max(), ::com::sun::star::i18n::CharacterIteratorMode::SKIPCHARACTER ); } -void __EXPORT EditRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos, - USHORT& rCntPos ) +void EditRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos, + sal_uInt16& rCntPos ) { - // Gewollt ist: von der aktuellen Einfuegeposition den vorherigen - // Absatz bestimmen und von dem das Ende setzen. - // Dadurch wird "\pard" immer auf den richtigen Absatz - // angewendet. + // The Intention is to: determine the current insert position of the + // previous paragraph and set the end from this. + // This "\pard" always apply on the right paragraph. ContentNode* pN = aCurSel.Max().GetNode(); - USHORT nCurPara = pImpEditEngine->GetEditDoc().GetPos( pN ); - DBG_ASSERT( nCurPara != 0, "Absatz gleich 0: SetEnfPrevPara" ); + sal_uInt16 nCurPara = pImpEditEngine->GetEditDoc().GetPos( pN ); + DBG_ASSERT( nCurPara != 0, "Paragraph equal to 0: SetEnfPrevPara" ); if ( nCurPara ) nCurPara--; ContentNode* pPrevNode = pImpEditEngine->GetEditDoc().SaveGetObject( nCurPara ); @@ -306,12 +304,12 @@ void __EXPORT EditRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos, rCntPos = pPrevNode->Len(); } -int __EXPORT EditRTFParser::IsEndPara( SvxNodeIdx* pNd, USHORT nCnt ) const +int EditRTFParser::IsEndPara( SvxNodeIdx* pNd, sal_uInt16 nCnt ) const { return ( nCnt == ( ((EditNodeIdx*)pNd)->GetNode()->Len()) ); } -void __EXPORT EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) +void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) { ContentNode* pSttNode = ((EditNodeIdx&)rSet.GetSttNode()).GetNode(); ContentNode* pEndNode = ((EditNodeIdx&)rSet.GetEndNode()).GetNode(); @@ -319,7 +317,7 @@ void __EXPORT EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) EditPaM aStartPaM( pSttNode, rSet.GetSttCnt() ); EditPaM aEndPaM( pEndNode, rSet.GetEndCnt() ); - // ggf. noch das Escapemant-Item umbiegen: + // If possible adjust the Escapemant-Item: const SfxPoolItem* pItem; // #i66167# adapt font heights to destination MapUnit if necessary @@ -327,12 +325,12 @@ void __EXPORT EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) const MapUnit eSrcUnit = aRTFMapMode.GetMapUnit(); if (eDestUnit != eSrcUnit) { - USHORT aFntHeightIems[3] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL }; + sal_uInt16 aFntHeightIems[3] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL }; for (int i = 0; i < 2; ++i) { - if (SFX_ITEM_SET == rSet.GetAttrSet().GetItemState( aFntHeightIems[i], FALSE, &pItem )) + if (SFX_ITEM_SET == rSet.GetAttrSet().GetItemState( aFntHeightIems[i], sal_False, &pItem )) { - UINT32 nHeight = ((SvxFontHeightItem*)pItem)->GetHeight(); + sal_uInt32 nHeight = ((SvxFontHeightItem*)pItem)->GetHeight(); long nNewHeight; nNewHeight = pImpEditEngine->GetRefDevice()->LogicToLogic( (long)nHeight, eSrcUnit, eDestUnit ); @@ -342,14 +340,14 @@ void __EXPORT EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) } } - if( SFX_ITEM_SET == rSet.GetAttrSet().GetItemState( EE_CHAR_ESCAPEMENT, FALSE, &pItem )) + if( SFX_ITEM_SET == rSet.GetAttrSet().GetItemState( EE_CHAR_ESCAPEMENT, sal_False, &pItem )) { // die richtige long nEsc = ((SvxEscapementItem*)pItem)->GetEsc(); if( ( DFLT_ESC_AUTO_SUPER != nEsc ) && ( DFLT_ESC_AUTO_SUB != nEsc ) ) { - nEsc *= 10; //HalPoints => Twips wurde in RTFITEM.CXX unterschlagen! + nEsc *= 10; //HalPoints => Twips was embezzled in RTFITEM.CXX! SvxFont aFont; pImpEditEngine->SeekCursor( aStartPaM.GetNode(), aStartPaM.GetIndex()+1, aFont ); nEsc = nEsc * 100 / aFont.GetSize().Height(); @@ -369,14 +367,14 @@ void __EXPORT EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) ContentNode* pSN = aStartPaM.GetNode(); ContentNode* pEN = aEndPaM.GetNode(); - USHORT nStartNode = pImpEditEngine->GetEditDoc().GetPos( pSN ); - USHORT nEndNode = pImpEditEngine->GetEditDoc().GetPos( pEN ); + sal_uInt16 nStartNode = pImpEditEngine->GetEditDoc().GetPos( pSN ); + sal_uInt16 nEndNode = pImpEditEngine->GetEditDoc().GetPos( pEN ); sal_Int16 nOutlLevel = 0xff; if ( rSet.StyleNo() && pImpEditEngine->GetStyleSheetPool() && pImpEditEngine->GetStatus().DoImportRTFStyleSheets() ) { SvxRTFStyleType* pS = GetStyleTbl().Get( rSet.StyleNo() ); - DBG_ASSERT( pS, "Vorlage in RTF nicht definiert!" ); + DBG_ASSERT( pS, "Template not defined in RTF!" ); if ( pS ) { pImpEditEngine->SetStyleSheet( EditSelection( aStartPaM, aEndPaM ), (SfxStyleSheet*)pImpEditEngine->GetStyleSheetPool()->Find( pS->sName, SFX_STYLE_FAMILY_ALL ) ); @@ -384,26 +382,26 @@ void __EXPORT EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) } } - // Wenn ein Attribut von 0 bis aktuelle Absatzlaenge geht, - // soll es ein Absatz-Attribut sein! + // When an Attribute goes from 0 to the current paragraph length, + // it should be a paragraph attribute! - // Achtung: Selektion kann ueber mehrere Absaetze gehen. - // Alle vollstaendigen Absaetze sind Absatzattribute... - for ( USHORT z = nStartNode+1; z < nEndNode; z++ ) + // Note: Selection can reach over several paragraphs. + // All Complete paragraphs are paragraph attributes ... + for ( sal_uInt16 z = nStartNode+1; z < nEndNode; z++ ) { - DBG_ASSERT( pImpEditEngine->GetEditDoc().SaveGetObject( z ), "Node existiert noch nicht(RTF)" ); + DBG_ASSERT( pImpEditEngine->GetEditDoc().SaveGetObject( z ), "Node does not exist yet(RTF)" ); pImpEditEngine->SetParaAttribs( z, rSet.GetAttrSet() ); } if ( aStartPaM.GetNode() != aEndPaM.GetNode() ) { - // Den Rest des StartNodes... + // The rest dof the StartNodes... if ( aStartPaM.GetIndex() == 0 ) pImpEditEngine->SetParaAttribs( nStartNode, rSet.GetAttrSet() ); else pImpEditEngine->SetAttribs( EditSelection( aStartPaM, EditPaM( aStartPaM.GetNode(), aStartPaM.GetNode()->Len() ) ), rSet.GetAttrSet() ); - // Den Anfang des EndNodes.... + // the beginning of the EndNodes.... if ( aEndPaM.GetIndex() == aEndPaM.GetNode()->Len() ) pImpEditEngine->SetParaAttribs( nEndNode, rSet.GetAttrSet() ); else @@ -413,7 +411,7 @@ void __EXPORT EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) { if ( ( aStartPaM.GetIndex() == 0 ) && ( aEndPaM.GetIndex() == aEndPaM.GetNode()->Len() ) ) { - // #96298# When settings char attribs as para attribs, we must merge with existing attribs, not overwrite the ItemSet! + // When settings char attribs as para attribs, we must merge with existing attribs, not overwrite the ItemSet! SfxItemSet aAttrs = pImpEditEngine->GetParaAttribs( nStartNode ); aAttrs.Put( rSet.GetAttrSet() ); pImpEditEngine->SetParaAttribs( nStartNode, aAttrs ); @@ -427,7 +425,7 @@ void __EXPORT EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) // OutlLevel... if ( nOutlLevel != 0xff ) { - for ( USHORT n = nStartNode; n <= nEndNode; n++ ) + for ( sal_uInt16 n = nStartNode; n <= nEndNode; n++ ) { ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( n ); pNode->GetContentAttribs().GetItems().Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nOutlLevel ) ); @@ -446,8 +444,7 @@ SvxRTFStyleType* EditRTFParser::FindStyleSheet( const XubString& rName ) SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle ) { - // Prueffen, ob so eine Vorlage existiert.... - // dann wird sie auch nicht geaendert! + // Check if a template exists, then it will not be changed! SfxStyleSheet* pStyle = (SfxStyleSheet*)pImpEditEngine->GetStyleSheetPool()->Find( pRTFStyle->sName, SFX_STYLE_FAMILY_ALL ); if ( pStyle ) return pStyle; @@ -463,21 +460,21 @@ SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle ) pStyle = (SfxStyleSheet*) &pImpEditEngine->GetStyleSheetPool()->Make( aName, SFX_STYLE_FAMILY_PARA ); - // 1) Items konvertieren und uebernehmen... + // 1) convert and take over Items ... ConvertAndPutItems( pStyle->GetItemSet(), pRTFStyle->aAttrSet ); - // 2) Solange Parent nicht im Pool, auch diesen kreieren... + // 2) As long as Parent is not in the pool, also create this ... if ( aParent.Len() && ( aParent != aName ) ) { SfxStyleSheet* pS = (SfxStyleSheet*)pImpEditEngine->GetStyleSheetPool()->Find( aParent, SFX_STYLE_FAMILY_ALL ); if ( !pS ) { - // Wenn nirgendwo gefunden, aus RTF erzeugen... + // If not found anywhere, create from RTF ... SvxRTFStyleType* _pRTFStyle = FindStyleSheet( aParent ); if ( _pRTFStyle ) pS = CreateStyleSheet( _pRTFStyle ); } - // 2b) ItemSet mit Parent verknuepfen... + // 2b) Link Itemset with Parent ... if ( pS ) pStyle->GetItemSet().SetParent( &pS->GetItemSet() ); } @@ -486,7 +483,7 @@ SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle ) void EditRTFParser::CreateStyleSheets() { - // der SvxRTFParser hat jetzt die Vorlagen erzeugt... + // the SvxRTFParser haa now created the template... if ( pImpEditEngine->GetStyleSheetPool() && pImpEditEngine->GetStatus().DoImportRTFStyleSheets() ) { SvxRTFStyleType* pRTFStyle = GetStyleTbl().First(); @@ -499,7 +496,7 @@ void EditRTFParser::CreateStyleSheets() } } -void __EXPORT EditRTFParser::CalcValue() +void EditRTFParser::CalcValue() { const MapUnit eDestUnit = static_cast< MapUnit >( aEditMapMode.GetMapUnit() ); const MapUnit eSrcUnit = aRTFMapMode.GetMapUnit(); @@ -509,10 +506,10 @@ void __EXPORT EditRTFParser::CalcValue() void EditRTFParser::ReadField() { - // Aus SwRTFParser::ReadField() - int _nOpenBrakets = 1; // die erste wurde schon vorher erkannt - BOOL bFldInst = FALSE; - BOOL bFldRslt = FALSE; + // From SwRTFParser::ReadField() + int _nOpenBrakets = 1; // the first was already detected earlier + sal_Bool bFldInst = sal_False; + sal_Bool bFldRslt = sal_False; String aFldInst; String aFldRslt; @@ -525,8 +522,8 @@ void EditRTFParser::ReadField() _nOpenBrakets--; if ( _nOpenBrakets == 1 ) { - bFldInst = FALSE; - bFldRslt = FALSE; + bFldInst = sal_False; + bFldRslt = sal_False; } } break; @@ -537,10 +534,10 @@ void EditRTFParser::ReadField() case RTF_FIELD: SkipGroup(); break; - case RTF_FLDINST: bFldInst = TRUE; + case RTF_FLDINST: bFldInst = sal_True; break; - case RTF_FLDRSLT: bFldRslt = TRUE; + case RTF_FLDRSLT: bFldRslt = sal_True; break; case RTF_TEXTTOKEN: @@ -574,12 +571,12 @@ void EditRTFParser::ReadField() } } - SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet + SkipToken( -1 ); // the closing brace is evaluated "above" } void EditRTFParser::SkipGroup() { - int _nOpenBrakets = 1; // die erste wurde schon vorher erkannt + int _nOpenBrakets = 1; // the first was already detected earlier while( _nOpenBrakets && IsParserWorking() ) { @@ -599,36 +596,36 @@ void EditRTFParser::SkipGroup() } } - SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet + SkipToken( -1 ); // the closing brace is evaluated "above" } -ULONG __EXPORT EditNodeIdx::GetIdx() const +sal_uLong EditNodeIdx::GetIdx() const { return pImpEditEngine->GetEditDoc().GetPos( pNode ); } -SvxNodeIdx* __EXPORT EditNodeIdx::Clone() const +SvxNodeIdx* EditNodeIdx::Clone() const { return new EditNodeIdx( pImpEditEngine, pNode ); } -SvxPosition* __EXPORT EditPosition::Clone() const +SvxPosition* EditPosition::Clone() const { return new EditPosition( pImpEditEngine, pCurSel ); } -SvxNodeIdx* __EXPORT EditPosition::MakeNodeIdx() const +SvxNodeIdx* EditPosition::MakeNodeIdx() const { return new EditNodeIdx( pImpEditEngine, pCurSel->Max().GetNode() ); } -ULONG __EXPORT EditPosition::GetNodeIdx() const +sal_uLong EditPosition::GetNodeIdx() const { ContentNode* pN = pCurSel->Max().GetNode(); return pImpEditEngine->GetEditDoc().GetPos( pN ); } -USHORT __EXPORT EditPosition::GetCntIdx() const +sal_uInt16 EditPosition::GetCntIdx() const { return pCurSel->Max().GetIndex(); } diff --git a/editeng/source/editeng/eertfpar.hxx b/editeng/source/editeng/eertfpar.hxx index 9656c9e870..a3a824d5cb 100644 --- a/editeng/source/editeng/eertfpar.hxx +++ b/editeng/source/editeng/eertfpar.hxx @@ -33,8 +33,6 @@ #include <editdoc.hxx> #include <impedit.hxx> -#ifndef SVX_LIGHT - class EditNodeIdx : public SvxNodeIdx { private: @@ -44,7 +42,7 @@ private: public: EditNodeIdx( ImpEditEngine* pIEE, ContentNode* pNd = 0) { pImpEditEngine = pIEE; pNode = pNd; } - virtual ULONG GetIdx() const; + virtual sal_uLong GetIdx() const; virtual SvxNodeIdx* Clone() const; ContentNode* GetNode() { return pNode; } }; @@ -59,13 +57,13 @@ public: EditPosition( ImpEditEngine* pIEE, EditSelection* pSel ) { pImpEditEngine = pIEE; pCurSel = pSel; } - virtual ULONG GetNodeIdx() const; - virtual USHORT GetCntIdx() const; + virtual sal_uLong GetNodeIdx() const; + virtual sal_uInt16 GetCntIdx() const; - // erzeuge von sich selbst eine Kopie + // clone virtual SvxPosition* Clone() const; - // erzeuge vom NodeIndex eine Kopie + // clone NodeIndex virtual SvxNodeIdx* MakeNodeIdx() const; }; @@ -81,22 +79,22 @@ private: MapMode aRTFMapMode; MapMode aEditMapMode; - USHORT nDefFont; - USHORT nDefTab; - USHORT nDefFontHeight; - BYTE nLastAction; + sal_uInt16 nDefFont; + sal_uInt16 nDefTab; + sal_uInt16 nDefFontHeight; + sal_uInt8 nLastAction; protected: virtual void InsertPara(); virtual void InsertText(); - virtual void MovePos( int bForward = TRUE ); + virtual void MovePos( int bForward = sal_True ); virtual void SetEndPrevPara( SvxNodeIdx*& rpNodePos, - USHORT& rCntPos ); + sal_uInt16& rCntPos ); virtual void UnknownAttrToken( int nToken, SfxItemSet* pSet ); virtual void NextToken( int nToken ); virtual void SetAttrInDoc( SvxRTFItemStackType &rSet ); - virtual int IsEndPara( SvxNodeIdx* pNd, USHORT nCnt ) const; + virtual int IsEndPara( SvxNodeIdx* pNd, sal_uInt16 nCnt ) const; virtual void CalcValue(); void CreateStyleSheets(); SfxStyleSheet* CreateStyleSheet( SvxRTFStyleType* pRTFStyle ); @@ -115,7 +113,7 @@ public: void SetDestCharSet( CharSet eCharSet ) { eDestCharSet = eCharSet; } CharSet GetDestCharSet() const { return eDestCharSet; } - USHORT GetDefTab() const { return nDefTab; } + sal_uInt16 GetDefTab() const { return nDefTab; } Font GetDefFont() { return GetFont( nDefFont ); } EditPaM GetCurPaM() const { return aCurSel.Max(); } @@ -125,7 +123,6 @@ SV_DECL_REF( EditRTFParser ) SV_IMPL_REF( EditRTFParser ); -#endif // !SVX_LIGH #endif //_EERTFPAR_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index bfb199d7ce..faacef226f 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -59,7 +59,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::linguistic2; -#define SCRLRANGE 20 // 1/20 der Breite/Hoehe scrollen, wenn im QueryDrop +#define SCRLRANGE 20 // Scroll 1/20 of the width/height, when in QueryDrop inline void lcl_AllignToPixel( Point& rPoint, OutputDevice* pOutDev, short nDiffX, short nDiffY ) { @@ -73,7 +73,7 @@ inline void lcl_AllignToPixel( Point& rPoint, OutputDevice* pOutDev, short nDiff rPoint = pOutDev->PixelToLogic( rPoint ); } -// ---------------------------------------------------------------------- +// ---------------------------------------------------------------------- // class ImpEditView // ---------------------------------------------------------------------- ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, Window* pWindow ) : @@ -96,7 +96,7 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, Window* pWindow ) : nInvMore = 1; nTravelXPos = TRAVEL_X_DONTKNOW; nControl = EV_CNTRL_AUTOSCROLL | EV_CNTRL_ENABLEPASTE; - bActiveDragAndDropListener = FALSE; + bActiveDragAndDropListener = sal_False; aEditSelection.Min() = pEng->pImpEditEngine->GetEditDoc().GetStartPaM(); aEditSelection.Max() = pEng->pImpEditEngine->GetEditDoc().GetEndPaM(); @@ -123,7 +123,7 @@ void ImpEditView::SetBackgroundColor( const Color& rColor ) void ImpEditView::SetEditSelection( const EditSelection& rEditSelection ) { - // #100856# set state before notification + // set state before notification aEditSelection = rEditSelection; if ( pEditEngine->pImpEditEngine->GetNotifyHdl().IsSet() ) @@ -141,14 +141,13 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion ) if ( GetSelectionMode() == EE_SELMODE_HIDDEN ) return; - // Vor dem Zeichnen der Selektion muss sichergestellt werden, - // das der Fensterinhalt komplett gueltig ist! - // Muss hier stehen, damit auf jeden Fall weg wenn lerr, nicht spaeter - // zwei Paint-Events! - // 19.10: Muss sogar vor Abfrage von bUpdate, falls nach Invalidate - // noch Paints in der Queue, aber jemand schaltet den UpdateMode um! + // It must be ensured before rendering the selection, that the contents of + // the window is completely valid! Must be here so that in any case if + // empty, then later on two-Paint Events! Must be done even before the + // query from bUpdate, if after Invalidate paints still in the queue, + // but someone switches the update mode! - // pRegion: Wenn nicht NULL, dann nur Region berechnen. + // pRegion: When not NULL, then only calculate Region. PolyPolygon* pPolyPoly = NULL; if ( pRegion ) pPolyPoly = new PolyPolygon; @@ -166,8 +165,8 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion ) if ( !aTmpSel.HasRange() ) return; - // aTmpOutArea: Falls OutputArea > Papierbreite und - // Text > Papierbreite ( uebergrosse Felder ) + // aTmpOutArea: if OutputArea > Paper width and + // Text > Paper width ( over large fields ) Rectangle aTmpOutArea( aOutArea ); if ( aTmpOutArea.GetWidth() > pEditEngine->pImpEditEngine->GetPaperSize().Width() ) aTmpOutArea.Right() = aTmpOutArea.Left() + pEditEngine->pImpEditEngine->GetPaperSize().Width(); @@ -187,8 +186,8 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion ) for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ ) { ParaPortion* pTmpPortion = pEditEngine->pImpEditEngine->GetParaPortions().SaveGetObject( nPara ); - DBG_ASSERT( pTmpPortion, "Portion in Selektion nicht gefunden!" ); - DBG_ASSERT( !pTmpPortion->IsInvalid(), "Portion in Selektion nicht formatiert!" ); + DBG_ASSERT( pTmpPortion, "Portion in Selection not found!" ); + DBG_ASSERT( !pTmpPortion->IsInvalid(), "Portion in Selection not formatted!" ); if ( !pTmpPortion->IsVisible() || pTmpPortion->IsInvalid() ) continue; @@ -209,23 +208,23 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion ) for ( sal_uInt16 nLine = nStartLine; nLine <= nEndLine; nLine++ ) { EditLine* pLine = pTmpPortion->GetLines().GetObject( nLine ); - DBG_ASSERT( pLine, "Zeile nicht gefunden: DrawSelection()" ); + DBG_ASSERT( pLine, "Line not found: DrawSelection()" ); - BOOL bPartOfLine = FALSE; + sal_Bool bPartOfLine = sal_False; sal_uInt16 nStartIndex = pLine->GetStart(); sal_uInt16 nEndIndex = pLine->GetEnd(); if ( ( nPara == nStartPara ) && ( nLine == nStartLine ) && ( nStartIndex != aTmpSel.Min().GetIndex() ) ) { nStartIndex = aTmpSel.Min().GetIndex(); - bPartOfLine = TRUE; + bPartOfLine = sal_True; } if ( ( nPara == nEndPara ) && ( nLine == nEndLine ) && ( nEndIndex != aTmpSel.Max().GetIndex() ) ) { nEndIndex = aTmpSel.Max().GetIndex(); - bPartOfLine = TRUE; + bPartOfLine = sal_True; } - // Kann passieren, wenn am Anfang einer umgebrochenen Zeile. + // Can happen if at the beginning of a wrapped line. if ( nEndIndex < nStartIndex ) nEndIndex = nStartIndex; @@ -236,7 +235,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion ) aTopLeft.Y() += nParaStart; aBottomRight.Y() += nParaStart; - // Nur Painten, wenn im sichtbaren Bereich... + // Only paint if in the visible range ... if ( aTopLeft.Y() > GetVisDocBottom() ) break; @@ -253,8 +252,8 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion ) } else { - USHORT nTmpStartIndex = nStartIndex; - USHORT nWritingDirStart, nTmpEndIndex; + sal_uInt16 nTmpStartIndex = nStartIndex; + sal_uInt16 nWritingDirStart, nTmpEndIndex; while ( nTmpStartIndex < nEndIndex ) { @@ -264,7 +263,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion ) DBG_ASSERT( nTmpEndIndex > nTmpStartIndex, "DrawSelection, Start >= End?" ); - long nX1 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpStartIndex, TRUE ); + long nX1 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpStartIndex, sal_True ); long nX2 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpEndIndex ); Point aPt1( Min( nX1, nX2 ), aTopLeft.Y() ); @@ -334,7 +333,7 @@ void ImpEditView::ImplDrawHighlightRect( Window* _pOutWin, const Point& rDocPosT } -BOOL ImpEditView::IsVertical() const +sal_Bool ImpEditView::IsVertical() const { return pEditEngine->pImpEditEngine->IsVertical(); } @@ -346,7 +345,7 @@ Rectangle ImpEditView::GetVisDocArea() const Point ImpEditView::GetDocPos( const Point& rWindowPos ) const { - // Fensterposition => Dokumentposition + // Window Position => Position Document Point aPoint; if ( !pEditEngine->pImpEditEngine->IsVertical() ) @@ -365,7 +364,7 @@ Point ImpEditView::GetDocPos( const Point& rWindowPos ) const Point ImpEditView::GetWindowPos( const Point& rDocPos ) const { - // Dokumentposition => Fensterposition + // Document position => window position Point aPoint; if ( !pEditEngine->pImpEditEngine->IsVertical() ) @@ -384,7 +383,7 @@ Point ImpEditView::GetWindowPos( const Point& rDocPos ) const Rectangle ImpEditView::GetWindowPos( const Rectangle& rDocRect ) const { - // Dokumentposition => Fensterposition + // Document position => window position Point aPos( GetWindowPos( rDocRect.TopLeft() ) ); Size aSz = rDocRect.GetSize(); Rectangle aRect; @@ -412,15 +411,15 @@ void ImpEditView::SetSelectionMode( EESelectionMode eNewMode ) { if ( eSelectionMode != eNewMode ) { - DrawSelection(); // 'Wegmalen' ... + DrawSelection(); eSelectionMode = eNewMode; - DrawSelection(); // und neu zeichnen. + DrawSelection(); // redraw } } void ImpEditView::SetOutputArea( const Rectangle& rRec ) { - // sollte besser auf Pixel allignt sein! + // should be better be aligned on pixels! Rectangle aNewRec( pOutWin->LogicToPixel( rRec ) ); aNewRec = pOutWin->PixelToLogic( aNewRec ); aOutArea = aNewRec; @@ -439,7 +438,7 @@ void ImpEditView::ResetOutputArea( const Rectangle& rRec ) { Rectangle aCurArea( aOutArea ); SetOutputArea( rRec ); - // Umliegende Bereiche invalidieren, wenn UpdateMode der Engine auf sal_True + // Invalidate surrounding areas if in update mode of the engine on sal_True if ( !aCurArea.IsEmpty() && pEditEngine->pImpEditEngine->GetUpdateMode() ) { long nMore = 0; @@ -578,7 +577,7 @@ void ImpEditView::SetAnchorMode( EVAnchorMode eMode ) void ImpEditView::CalcAnchorPoint() { - // GetHeight() und GetWidth() -1, da Rectangle-Berechnung nicht erwuenscht. + // GetHeight() and GetWidth() -1, because rectangle calculation not prefered. // X: switch ( eAnchorMode ) @@ -633,9 +632,9 @@ void ImpEditView::CalcAnchorPoint() } } -void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, USHORT nShowCursorFlags ) +void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sal_uInt16 nShowCursorFlags ) { - // Kein ShowCursor bei einer leeren View... + // No ShowCursor in an empty View ... if ( ( aOutArea.Left() >= aOutArea.Right() ) && ( aOutArea.Top() >= aOutArea.Bottom() ) ) return; @@ -643,8 +642,8 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, US if ( !pEditEngine->pImpEditEngine->IsFormatted() ) pEditEngine->pImpEditEngine->FormatDoc(); - // Aus irgendwelchen Gruenden lande ich waehrend der Formatierung hier, - // wenn sich der Outiner im Paint initialisiert, weil kein SetPool(); + // For some reasons I end up here during the formatting, if the Outliner + // is initialized in Paint, because no SetPool(); if ( pEditEngine->pImpEditEngine->IsFormatting() ) return; if ( pEditEngine->pImpEditEngine->GetUpdateMode() == sal_False ) @@ -657,8 +656,8 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, US EditPaM aPaM( aEditSelection.Max() ); - USHORT nTextPortionStart = 0; - USHORT nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() ); + sal_uInt16 nTextPortionStart = 0; + sal_uInt16 nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() ); if (nPara == USHRT_MAX) // #i94322 return; ParaPortion* pParaPortion = pEditEngine->pImpEditEngine->GetParaPortions().GetObject( nPara ); @@ -684,7 +683,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, US // If we are behind a portion, and the next portion has other direction, we must change position... aEditCursor.Left() = aEditCursor.Right() = pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GETCRSR_TXTONLY|GETCRSR_PREFERPORTIONSTART ).Left(); - USHORT nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, TRUE ); + sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, sal_True ); TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion ); if ( pTextPortion->GetKind() == PORTIONKIND_TAB ) { @@ -692,7 +691,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, US } else { - EditPaM aNext = pEditEngine->pImpEditEngine->CursorRight( aPaM, (USHORT)i18n::CharacterIteratorMode::SKIPCELL ); + EditPaM aNext = pEditEngine->pImpEditEngine->CursorRight( aPaM, (sal_uInt16)i18n::CharacterIteratorMode::SKIPCELL ); Rectangle aTmpRect = pEditEngine->pImpEditEngine->PaMtoEditCursor( aNext, GETCRSR_TXTONLY ); if ( aTmpRect.Top() != aEditCursor.Top() ) aTmpRect = pEditEngine->pImpEditEngine->PaMtoEditCursor( aNext, GETCRSR_TXTONLY|GETCRSR_ENDOFLINE ); @@ -707,56 +706,56 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, US } if ( bGotoCursor ) // && (!pEditEngine->pImpEditEngine->GetStatus().AutoPageSize() ) ) { - // pruefen, ob scrollen notwendig... - // wenn scrollen, dann Update() und Scroll() ! + // check if scrolling is necessary... + // if scrolling, then update () and Scroll ()! long nDocDiffX = 0; long nDocDiffY = 0; Rectangle aTmpVisArea( GetVisDocArea() ); - // aTmpOutArea: Falls OutputArea > Papierbreite und - // Text > Papierbreite ( uebergrosse Felder ) + // aTmpOutArea: if OutputArea > Paper width and + // Text > Paper width ( over large fields ) long nMaxTextWidth = !IsVertical() ? pEditEngine->pImpEditEngine->GetPaperSize().Width() : pEditEngine->pImpEditEngine->GetPaperSize().Height(); if ( aTmpVisArea.GetWidth() > nMaxTextWidth ) aTmpVisArea.Right() = aTmpVisArea.Left() + nMaxTextWidth; if ( aEditCursor.Bottom() > aTmpVisArea.Bottom() ) - { // hochscrollen, hier positiv + { // Scroll up, here positive nDocDiffY = aEditCursor.Bottom() - aTmpVisArea.Bottom(); } else if ( aEditCursor.Top() < aTmpVisArea.Top() ) - { // runterscrollen, negativ + { // Scroll down, here negative nDocDiffY = aEditCursor.Top() - aTmpVisArea.Top(); } if ( aEditCursor.Right() > aTmpVisArea.Right() ) { - // linksscrollen, positiv + // Scroll left, positiv nDocDiffX = aEditCursor.Right() - aTmpVisArea.Right(); - // Darfs ein bischen mehr sein? + // Can it be a little more? if ( aEditCursor.Right() < ( nMaxTextWidth - GetScrollDiffX() ) ) nDocDiffX += GetScrollDiffX(); else { long n = nMaxTextWidth - aEditCursor.Right(); - // Bei einem MapMode != RefMapMode kann der EditCursor auch mal ueber - // die Papierbreite Wandern! + // If MapMode != RefMapMode then the EditCursor can go beyond + // the paper width! nDocDiffX += ( n > 0 ? n : -n ); } } else if ( aEditCursor.Left() < aTmpVisArea.Left() ) - { // rechtsscrollen - // negativ: + { + // Scroll right, negative: nDocDiffX = aEditCursor.Left() - aTmpVisArea.Left(); - // Darfs ein bischen mehr sein? + // Can it be a little more? if ( aEditCursor.Left() > ( - (long)GetScrollDiffX() ) ) nDocDiffX -= GetScrollDiffX(); else nDocDiffX -= aEditCursor.Left(); } - if ( aPaM.GetIndex() == 0 ) // braucht Olli fuer den Outliner + if ( aPaM.GetIndex() == 0 ) // Olli needed for the Outliner { - // Aber sicherstellen, dass dadurch der Cursor nicht den - // sichtbaren bereich verlaesst! + // But make sure that the cursor is not leaving visible area + // because of this! if ( aEditCursor.Left() < aTmpVisArea.GetWidth() ) { nDocDiffX = -aTmpVisArea.Left(); @@ -768,7 +767,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, US long nDiffX = !IsVertical() ? nDocDiffX : -nDocDiffY; long nDiffY = !IsVertical() ? nDocDiffY : nDocDiffX; - // Negativ: Zum Anfang bzw. linken Rand + // Negative: Back to the top or left edge if ( ( Abs( nDiffY ) > pEditEngine->pImpEditEngine->nOnePixelInRef ) && DoBigScroll() ) { long nH = aOutArea.GetHeight() / 4; @@ -802,7 +801,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, US } } - // Cursor evtl. etwas stutzen... + // Cursor may trim a little ... if ( ( aEditCursor.Bottom() > GetVisDocTop() ) && ( aEditCursor.Top() < GetVisDocBottom() ) ) { @@ -853,9 +852,9 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, US unsigned char nCursorDir = CURSOR_DIRECTION_NONE; if ( IsInsertMode() && !aEditSelection.HasRange() && ( pEditEngine->pImpEditEngine->HasDifferentRTLLevels( aPaM.GetNode() ) ) ) { - USHORT nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, nShowCursorFlags & GETCRSR_PREFERPORTIONSTART ? TRUE : FALSE ); + sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, nShowCursorFlags & GETCRSR_PREFERPORTIONSTART ? sal_True : sal_False ); TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion ); - USHORT nRTLLevel = pTextPortion->GetRightToLeft(); + sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft(); if ( nRTLLevel%2 ) nCursorDir = CURSOR_DIRECTION_RTL; else @@ -866,13 +865,10 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, US if ( bForceVisCursor ) GetCursor()->Show(); - - // #102936# Call SetInputContext every time, otherwise we may have the wrong font - // if ( !pEditEngine->pImpEditEngine->mpIMEInfos ) { SvxFont aFont; pEditEngine->pImpEditEngine->SeekCursor( aPaM.GetNode(), aPaM.GetIndex()+1, aFont ); - ULONG nContextFlags = INPUTCONTEXT_TEXT|INPUTCONTEXT_EXTTEXTINPUT; + sal_uLong nContextFlags = INPUTCONTEXT_TEXT|INPUTCONTEXT_EXTTEXTINPUT; GetWindow()->SetInputContext( InputContext( aFont, nContextFlags ) ); } } @@ -885,9 +881,9 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, US } } -Pair ImpEditView::Scroll( long ndX, long ndY, BYTE nRangeCheck ) +Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck ) { - DBG_ASSERT( pEditEngine->pImpEditEngine->IsFormatted(), "Scroll: Nicht formatiert!" ); + DBG_ASSERT( pEditEngine->pImpEditEngine->IsFormatted(), "Scroll: Not formatted!" ); if ( !ndX && !ndY ) return Range( 0, 0 ); @@ -895,7 +891,7 @@ Pair ImpEditView::Scroll( long ndX, long ndY, BYTE nRangeCheck ) Rectangle aR( aOutArea ); aR = pOutWin->LogicToPixel( aR ); aR = pOutWin->PixelToLogic( aR ); - DBG_ASSERTWARNING( aR == aOutArea, "OutArea vor Scroll nicht aligned" ); + DBG_ASSERTWARNING( aR == aOutArea, "OutArea before Scroll not aligned" ); #endif Rectangle aNewVisArea( GetVisDocArea() ); @@ -914,9 +910,9 @@ Pair ImpEditView::Scroll( long ndX, long ndY, BYTE nRangeCheck ) } if ( ( nRangeCheck == RGCHK_PAPERSZ1 ) && ( aNewVisArea.Bottom() > (long)pEditEngine->pImpEditEngine->GetTextHeight() ) ) { - // GetTextHeight noch optimieren! - long nDiff = pEditEngine->pImpEditEngine->GetTextHeight() - aNewVisArea.Bottom(); // negativ - aNewVisArea.Move( 0, nDiff ); // koennte im neg. Bereich landen... + // GetTextHeight still optimizing! + long nDiff = pEditEngine->pImpEditEngine->GetTextHeight() - aNewVisArea.Bottom(); // negative + aNewVisArea.Move( 0, nDiff ); // could end up in the negative area... } if ( ( aNewVisArea.Top() < 0 ) && ( nRangeCheck != RGCHK_NONE ) ) aNewVisArea.Move( 0, -aNewVisArea.Top() ); @@ -932,15 +928,15 @@ Pair ImpEditView::Scroll( long ndX, long ndY, BYTE nRangeCheck ) aNewVisArea.Left() -= ndY; aNewVisArea.Right() -= ndY; } - if ( ( nRangeCheck == RGCHK_PAPERSZ1 ) && ( aNewVisArea.Right() > (long)pEditEngine->pImpEditEngine->CalcTextWidth( FALSE ) ) ) + if ( ( nRangeCheck == RGCHK_PAPERSZ1 ) && ( aNewVisArea.Right() > (long)pEditEngine->pImpEditEngine->CalcTextWidth( sal_False ) ) ) { - long nDiff = pEditEngine->pImpEditEngine->CalcTextWidth( FALSE ) - aNewVisArea.Right(); // negativ - aNewVisArea.Move( nDiff, 0 ); // koennte im neg. Bereich landen... + long nDiff = pEditEngine->pImpEditEngine->CalcTextWidth( sal_False ) - aNewVisArea.Right(); // negative + aNewVisArea.Move( nDiff, 0 ); // could end up in the negative area... } if ( ( aNewVisArea.Left() < 0 ) && ( nRangeCheck != RGCHK_NONE ) ) aNewVisArea.Move( -aNewVisArea.Left(), 0 ); - // Die Differenz muss auf Pixel alignt sein (wegen Scroll!) + // The difference must be alignt on pixel (due to scroll!) long nDiffX = !IsVertical() ? ( GetVisDocLeft() - aNewVisArea.Left() ) : -( GetVisDocTop() - aNewVisArea.Top() ); long nDiffY = !IsVertical() ? ( GetVisDocTop() - aNewVisArea.Top() ) : ( GetVisDocLeft() - aNewVisArea.Left() ); @@ -964,7 +960,8 @@ Pair ImpEditView::Scroll( long ndX, long ndY, BYTE nRangeCheck ) aVisDocStartPos.Move( -nRealDiffY, nRealDiffX ); // Das Move um den allignten Wert ergibt nicht unbedingt ein // alligntes Rechteck... - // MT 11/00: Align VisArea??? + // Aligned value of the move does not necessarily result in aligned + // rectangle ... aVisDocStartPos = pOutWin->LogicToPixel( aVisDocStartPos ); aVisDocStartPos = pOutWin->PixelToLogic( aVisDocStartPos ); Rectangle aRec( aOutArea ); @@ -992,7 +989,7 @@ Pair ImpEditView::Scroll( long ndX, long ndY, BYTE nRangeCheck ) sal_Bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin ) { - BOOL bDone = FALSE; + sal_Bool bDone = sal_False; KeyFuncType eFunc = rKeyEvent.GetKeyCode().GetFunction(); if ( eFunc != KEYFUNC_DONTKNOW ) @@ -1013,7 +1010,7 @@ sal_Bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin { Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipBoard(GetWindow()->GetClipboard()); CutCopy( aClipBoard, sal_False ); - bDone = TRUE; + bDone = sal_True; } break; case KEYFUNC_PASTE: @@ -1063,7 +1060,7 @@ sal_Bool ImpEditView::MouseButtonUp( const MouseEvent& rMouseEvent ) else if ( rMouseEvent.IsLeft() && GetEditSelection().HasRange() ) { Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipBoard(GetWindow()->GetPrimarySelection()); - CutCopy( aClipBoard, FALSE ); + CutCopy( aClipBoard, sal_False ); } return pEditEngine->pImpEditEngine->MouseButtonUp( rMouseEvent, GetEditViewPtr() ); @@ -1071,7 +1068,7 @@ sal_Bool ImpEditView::MouseButtonUp( const MouseEvent& rMouseEvent ) sal_Bool ImpEditView::MouseButtonDown( const MouseEvent& rMouseEvent ) { - pEditEngine->pImpEditEngine->CheckIdleFormatter(); // Falls schnelles Tippen und MouseButtonDown + pEditEngine->pImpEditEngine->CheckIdleFormatter(); // If fast typing and mouse button downs if ( pEditEngine->pImpEditEngine->aStatus.NotifyCursorMovements() ) pEditEngine->pImpEditEngine->aStatus.GetPrevParagraph() = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( GetEditSelection().Max().GetNode() ); nTravelXPos = TRAVEL_X_DONTKNOW; @@ -1088,7 +1085,7 @@ sal_Bool ImpEditView::MouseMove( const MouseEvent& rMouseEvent ) void ImpEditView::Command( const CommandEvent& rCEvt ) { - pEditEngine->pImpEditEngine->CheckIdleFormatter(); // Falls schnelles Tippen und MouseButtonDown + pEditEngine->pImpEditEngine->CheckIdleFormatter(); // If fast typing and mouse button down pEditEngine->pImpEditEngine->Command( rCEvt, GetEditViewPtr() ); } @@ -1105,26 +1102,23 @@ void ImpEditView::SetInsertMode( sal_Bool bInsert ) sal_Bool ImpEditView::IsWrongSpelledWord( const EditPaM& rPaM, sal_Bool bMarkIfWrong ) { sal_Bool bIsWrong = sal_False; -#ifndef SVX_LIGHT if ( rPaM.GetNode()->GetWrongList() ) { EditSelection aSel = pEditEngine->pImpEditEngine->SelectWord( rPaM, ::com::sun::star::i18n::WordType::DICTIONARY_WORD ); bIsWrong = rPaM.GetNode()->GetWrongList()->HasWrong( aSel.Min().GetIndex(), aSel.Max().GetIndex() ); if ( bIsWrong && bMarkIfWrong ) { - DrawSelection(); // alte Selektion 'weg-zeichnen' + DrawSelection(); SetEditSelection( aSel ); DrawSelection(); } } -#endif // !SVX_LIGHT return bIsWrong; } String ImpEditView::SpellIgnoreOrAddWord( sal_Bool bAdd ) { String aWord; -#ifndef SVX_LIGHT if ( pEditEngine->pImpEditEngine->GetSpeller().is() ) { EditPaM aPaM = GetEditSelection().Max(); @@ -1136,8 +1130,8 @@ String ImpEditView::SpellIgnoreOrAddWord( sal_Bool bAdd ) else { aWord = pEditEngine->pImpEditEngine->GetSelected( GetEditSelection() ); - // Und deselektieren - DrawSelection(); // alte Selektion 'weg-zeichnen' + // And deselect + DrawSelection(); SetEditSelection( EditSelection( aPaM, aPaM ) ); DrawSelection(); } @@ -1146,7 +1140,7 @@ String ImpEditView::SpellIgnoreOrAddWord( sal_Bool bAdd ) { if ( bAdd ) { - DBG_ERROR( "Sorry, AddWord not implemented" ); + OSL_FAIL( "Sorry, AddWord not implemented" ); } else // Ignore { @@ -1165,7 +1159,6 @@ String ImpEditView::SpellIgnoreOrAddWord( sal_Bool bAdd ) pEditEngine->pImpEditEngine->StartOnlineSpellTimer(); } } -#endif // !SVX_LIGHT return aWord; } @@ -1181,7 +1174,7 @@ void ImpEditView::DeleteSelected() SetEditSelection( EditSelection( aPaM, aPaM ) ); pEditEngine->pImpEditEngine->FormatAndUpdate( GetEditViewPtr() ); - ShowCursor( DoAutoScroll(), TRUE ); + ShowCursor( DoAutoScroll(), sal_True ); } const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_uInt16* pPara, sal_uInt16* pPos ) const @@ -1194,7 +1187,7 @@ const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_uInt16* pPara, if ( aPaM.GetIndex() == aPaM.GetNode()->Len() ) { - // Sonst immer, wenn Feld ganz am Schluss und Mouse unter Text + // Otherwise, whenever the Field at the very end and mouse under the text return 0; } @@ -1206,7 +1199,7 @@ const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_uInt16* pPara, if ( pAttr->GetStart() == nXPos ) if ( pAttr->Which() == EE_FEATURE_FIELD ) { - DBG_ASSERT( pAttr->GetItem()->ISA( SvxFieldItem ), "Kein FeldItem..." ); + DBG_ASSERT( pAttr->GetItem()->ISA( SvxFieldItem ), "No FieldItem..." ); if ( pPara ) *pPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aPaM.GetNode() ); if ( pPos ) @@ -1217,20 +1210,20 @@ const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_uInt16* pPara, return NULL; } -BOOL ImpEditView::IsBulletArea( const Point& rPos, sal_uInt16* pPara ) +sal_Bool ImpEditView::IsBulletArea( const Point& rPos, sal_uInt16* pPara ) { if ( pPara ) *pPara = 0xFFFF; if( !GetOutputArea().IsInside( rPos ) ) - return FALSE; + return sal_False; Point aDocPos( GetDocPos( rPos ) ); EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos, sal_False ); if ( aPaM.GetIndex() == 0 ) { - USHORT nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() ); + sal_uInt16 nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() ); Rectangle aBulletArea = pEditEngine->GetBulletArea( nPara ); long nY = pEditEngine->GetDocPosTopLeft( nPara ).Y(); ParaPortion* pParaPortion = pEditEngine->pImpEditEngine->GetParaPortions().GetObject( nPara ); @@ -1242,14 +1235,14 @@ BOOL ImpEditView::IsBulletArea( const Point& rPos, sal_uInt16* pPara ) { if ( pPara ) *pPara = nPara; - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } -void ImpEditView::CutCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard, BOOL bCut ) +void ImpEditView::CutCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard, sal_Bool bCut ) { if ( rxClipboard.is() && GetEditSelection().HasRange() ) { @@ -1282,7 +1275,7 @@ void ImpEditView::CutCopy( ::com::sun::star::uno::Reference< ::com::sun::star::d } } -void ImpEditView::Paste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard, BOOL bUseSpecial ) +void ImpEditView::Paste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard, sal_Bool bUseSpecial ) { if ( rxClipboard.is() ) { @@ -1350,99 +1343,97 @@ void ImpEditView::Paste( ::com::sun::star::uno::Reference< ::com::sun::star::dat SetEditSelection( aSel ); pEditEngine->pImpEditEngine->UpdateSelections(); pEditEngine->pImpEditEngine->FormatAndUpdate( GetEditViewPtr() ); - ShowCursor( DoAutoScroll(), TRUE ); + ShowCursor( DoAutoScroll(), sal_True ); } } } -BOOL ImpEditView::IsInSelection( const EditPaM& rPaM ) +sal_Bool ImpEditView::IsInSelection( const EditPaM& rPaM ) { EditSelection aSel = GetEditSelection(); if ( !aSel.HasRange() ) - return FALSE; + return sal_False; aSel.Adjust( pEditEngine->pImpEditEngine->GetEditDoc() ); - USHORT nStartNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() ); - USHORT nEndNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() ); - USHORT nCurNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( rPaM.GetNode() ); + sal_uInt16 nStartNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() ); + sal_uInt16 nEndNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() ); + sal_uInt16 nCurNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( rPaM.GetNode() ); if ( ( nCurNode > nStartNode ) && ( nCurNode < nEndNode ) ) - return TRUE; + return sal_True; if ( nStartNode == nEndNode ) { if ( nCurNode == nStartNode ) if ( ( rPaM.GetIndex() >= aSel.Min().GetIndex() ) && ( rPaM.GetIndex() < aSel.Max().GetIndex() ) ) - return TRUE; + return sal_True; } else if ( ( nCurNode == nStartNode ) && ( rPaM.GetIndex() >= aSel.Min().GetIndex() ) ) - return TRUE; + return sal_True; else if ( ( nCurNode == nEndNode ) && ( rPaM.GetIndex() < aSel.Max().GetIndex() ) ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } void ImpEditView::CreateAnchor() { - pEditEngine->pImpEditEngine->bInSelection = TRUE; + pEditEngine->pImpEditEngine->bInSelection = sal_True; GetEditSelection().Min() = GetEditSelection().Max(); } void ImpEditView::DeselectAll() { - pEditEngine->pImpEditEngine->bInSelection = FALSE; + pEditEngine->pImpEditEngine->bInSelection = sal_False; DrawSelection(); GetEditSelection().Min() = GetEditSelection().Max(); } -BOOL ImpEditView::IsSelectionAtPoint( const Point& rPosPixel ) +sal_Bool ImpEditView::IsSelectionAtPoint( const Point& rPosPixel ) { if ( pDragAndDropInfo && pDragAndDropInfo->pField ) - return TRUE; + return sal_True; Point aMousePos( rPosPixel ); - // Logische Einheiten... + // Logical units ... aMousePos = GetWindow()->PixelToLogic( aMousePos ); if ( ( !GetOutputArea().IsInside( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() ) { - return FALSE; + return sal_False; } Point aDocPos( GetDocPos( aMousePos ) ); - EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos, FALSE ); + EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos, sal_False ); return IsInSelection( aPaM ); } -BOOL ImpEditView::SetCursorAtPoint( const Point& rPointPixel ) +sal_Bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel ) { pEditEngine->pImpEditEngine->CheckIdleFormatter(); Point aMousePos( rPointPixel ); - // Logische Einheiten... + // Logical units ... aMousePos = GetWindow()->PixelToLogic( aMousePos ); if ( ( !GetOutputArea().IsInside( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() ) { - return FALSE; + return sal_False; } Point aDocPos( GetDocPos( aMousePos ) ); - // Kann optimiert werden: Erst innerhalb eines Absatzes die Zeilen - // fuer den PaM durchwuehlen, dann nochmal mit dem PaM fuer das Rect, - // obwohl die Zeile schon bekannt ist.... - // Das muss doch nicht sein ! - + // Can be optimized: first go through the lines within a paragraph for PAM, + // then again wiht the PaM for the Rect, even though the line is already + // known .... This must not be, though! EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos ); - BOOL bGotoCursor = DoAutoScroll(); + sal_Bool bGotoCursor = DoAutoScroll(); - // aTmpNewSel: Diff zwischen alt und neu, nicht die neue Selektion + // aTmpNewSel: Diff between old and new, not the new selection EditSelection aTmpNewSel( GetEditSelection().Max(), aPaM ); // #i27299# @@ -1467,9 +1458,9 @@ BOOL ImpEditView::SetCursorAtPoint( const Point& rPointPixel ) SetEditSelection( aNewEditSelection ); } - BOOL bForceCursor = ( pDragAndDropInfo ? FALSE : TRUE ) && !pEditEngine->pImpEditEngine->IsInSelectionMode(); + sal_Bool bForceCursor = ( pDragAndDropInfo ? sal_False : sal_True ) && !pEditEngine->pImpEditEngine->IsInSelectionMode(); ShowCursor( bGotoCursor, bForceCursor ); - return TRUE; + return sal_True; } @@ -1493,9 +1484,9 @@ void ImpEditView::ShowDDCursor( const Rectangle& rRect ) Color aOldFillColor = GetWindow()->GetFillColor(); GetWindow()->SetFillColor( Color(4210752) ); // GRAY BRUSH_50, OLDSV, change to DDCursor! - // Hintergrund sichern... + // Save background ... Rectangle aSaveRec( GetWindow()->LogicToPixel( rRect ) ); - // lieber etwas mehr sichern... + // prefer to save some more ... aSaveRec.Right() += 1; aSaveRec.Bottom() += 1; @@ -1514,7 +1505,7 @@ void ImpEditView::ShowDDCursor( const Rectangle& rRect ) if ( ( aCurSzPx.Width() < aNewSzPx.Width() ) ||( aCurSzPx.Height() < aNewSzPx.Height() ) ) { sal_Bool bDone = pDragAndDropInfo->pBackground->SetOutputSizePixel( aNewSzPx ); - DBG_ASSERT( bDone, "Virtuelles Device kaputt?" ); + DBG_ASSERT( bDone, "Virtual Device broken?" ); } #endif @@ -1524,7 +1515,7 @@ void ImpEditView::ShowDDCursor( const Rectangle& rRect ) aSaveRec.TopLeft(), aSaveRec.GetSize(), *GetWindow() ); pDragAndDropInfo->aCurSavedCursor = aSaveRec; - // Cursor malen... + // Draw Cursor... GetWindow()->DrawRect( rRect ); pDragAndDropInfo->bVisCursor = sal_True; @@ -1554,7 +1545,7 @@ void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::d else { // Field?! - USHORT nPara, nPos; + sal_uInt16 nPara, nPos; Point aMousePos = GetWindow()->PixelToLogic( aMousePosPixel ); const SvxFieldItem* pField = GetField( aMousePos, &nPara, &nPos ); if ( pField ) @@ -1565,18 +1556,18 @@ void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::d aCopySel = EditSelection( EditPaM( pNode, nPos ), EditPaM( pNode, nPos+1 ) ); GetEditSelection() = aCopySel; DrawSelection(); - BOOL bGotoCursor = DoAutoScroll(); - BOOL bForceCursor = ( pDragAndDropInfo ? FALSE : TRUE ) && !pEditEngine->pImpEditEngine->IsInSelectionMode(); + sal_Bool bGotoCursor = DoAutoScroll(); + sal_Bool bForceCursor = ( pDragAndDropInfo ? sal_False : sal_True ) && !pEditEngine->pImpEditEngine->IsInSelectionMode(); ShowCursor( bGotoCursor, bForceCursor ); } else if ( IsBulletArea( aMousePos, &nPara ) ) { pDragAndDropInfo = new DragAndDropInfo(); - pDragAndDropInfo->bOutlinerMode = TRUE; + pDragAndDropInfo->bOutlinerMode = sal_True; EditPaM aStartPaM( pEditEngine->pImpEditEngine->GetEditDoc().GetObject( nPara ), 0 ); EditPaM aEndPaM( aStartPaM ); const SfxInt16Item& rLevel = (const SfxInt16Item&) pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ); - for ( USHORT n = nPara +1; n < pEditEngine->pImpEditEngine->GetEditDoc().Count(); n++ ) + for ( sal_uInt16 n = nPara +1; n < pEditEngine->pImpEditEngine->GetEditDoc().Count(); n++ ) { const SfxInt16Item& rL = (const SfxInt16Item&) pEditEngine->GetParaAttrib( n, EE_PARA_OUTLLEVEL ); if ( rL.GetValue() > rLevel.GetValue() ) @@ -1598,7 +1589,7 @@ void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::d pDragAndDropInfo->bStarterOfDD = sal_True; - // Sensibler Bereich, wo gescrollt werden soll. + // Sensitive area to be scrolled. Size aSz( 5, 0 ); aSz = GetWindow()->PixelToLogic( aSz ); pDragAndDropInfo->nSensibleRange = (sal_uInt16) aSz.Width(); @@ -1610,7 +1601,7 @@ void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::d sal_Int8 nActions = bReadOnly ? datatransfer::dnd::DNDConstants::ACTION_COPY : datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE; rDGE.DragSource->startDrag( rDGE, nActions, 0 /*cursor*/, 0 /*image*/, xData, mxDnDListener ); - // Falls Drag&Move in einer Engine, muessen Copy&Del geklammert sein! + // If Drag&Move in an Engine, thenCopy&Del has to be optional! GetCursor()->Hide(); } @@ -1629,7 +1620,7 @@ void ImpEditView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSo { if ( pDragAndDropInfo->bStarterOfDD && pDragAndDropInfo->bDroppedInMe ) { - // DropPos: Wohin wurde gedroppt, unabhaengig von laenge. + // DropPos: Where was it dropped, irrespective of length. ESelection aDropPos( pDragAndDropInfo->aDropSel.nStartPara, pDragAndDropInfo->aDropSel.nStartPos, pDragAndDropInfo->aDropSel.nStartPara, pDragAndDropInfo->aDropSel.nStartPos ); ESelection aToBeDelSel = pDragAndDropInfo->aBeginDragSel; ESelection aNewSel( pDragAndDropInfo->aDropSel.nEndPara, pDragAndDropInfo->aDropSel.nEndPos, @@ -1638,11 +1629,11 @@ void ImpEditView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSo sal_uInt16 nParaDiff = pDragAndDropInfo->aBeginDragSel.nEndPara - pDragAndDropInfo->aBeginDragSel.nStartPara; if ( bBeforeSelection ) { - // aToBeDelSel anpassen. - DBG_ASSERT( pDragAndDropInfo->aBeginDragSel.nStartPara >= pDragAndDropInfo->aDropSel.nStartPara, "Doch nicht davor?" ); + // Adjust aToBeDelSel. + DBG_ASSERT( pDragAndDropInfo->aBeginDragSel.nStartPara >= pDragAndDropInfo->aDropSel.nStartPara, "But not before? "); aToBeDelSel.nStartPara = aToBeDelSel.nStartPara + nParaDiff; aToBeDelSel.nEndPara = aToBeDelSel.nEndPara + nParaDiff; - // Zeichen korrigieren? + // To correct the character? if ( aToBeDelSel.nStartPara == pDragAndDropInfo->aDropSel.nEndPara ) { sal_uInt16 nMoreChars; @@ -1659,12 +1650,12 @@ void ImpEditView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSo } else { - // aToBeDelSel ist ok, aber Selektion der View - // muss angepasst werden, wenn davor geloescht wird! - DBG_ASSERT( pDragAndDropInfo->aBeginDragSel.nStartPara <= pDragAndDropInfo->aDropSel.nStartPara, "Doch nicht davor?" ); + // aToBeDelSel is ok, but the selection of the View + // has to be adapted, if it was deleted before! + DBG_ASSERT( pDragAndDropInfo->aBeginDragSel.nStartPara <= pDragAndDropInfo->aDropSel.nStartPara, "But not before? "); aNewSel.nStartPara = aNewSel.nStartPara - nParaDiff; aNewSel.nEndPara = aNewSel.nEndPara - nParaDiff; - // Zeichen korrigieren? + // To correct the character? if ( pDragAndDropInfo->aBeginDragSel.nEndPara == pDragAndDropInfo->aDropSel.nStartPara ) { sal_uInt16 nLessChars; @@ -1680,7 +1671,7 @@ void ImpEditView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSo DrawSelection(); EditSelection aDelSel( pEditEngine->pImpEditEngine->CreateSel( aToBeDelSel ) ); - DBG_ASSERT( !aDelSel.DbgIsBuggy( pEditEngine->pImpEditEngine->aEditDoc ), "ToBeDel ist buggy!" ); + DBG_ASSERT( !aDelSel.DbgIsBuggy( pEditEngine->pImpEditEngine->aEditDoc ), "ToBeDel is buggy!" ); pEditEngine->pImpEditEngine->ImpDeleteSelection( aDelSel ); if ( !bBeforeSelection ) { @@ -1692,7 +1683,7 @@ void ImpEditView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSo } else { - // andere EditEngine... + // other EditEngine ... if ( pEditEngine->pImpEditEngine->ImplHasText() ) // #88630# SC ist removing the content when switching the task DeleteSelected(); } @@ -1702,7 +1693,7 @@ void ImpEditView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSo pEditEngine->pImpEditEngine->UndoActionEnd( EDITUNDO_DRAGANDDROP ); HideDDCursor(); - ShowCursor( DoAutoScroll(), TRUE ); + ShowCursor( DoAutoScroll(), sal_True ); delete pDragAndDropInfo; pDragAndDropInfo = NULL; pEditEngine->GetEndDropHdl().Call(GetEditViewPtr()); @@ -1718,19 +1709,19 @@ void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDro if ( pDragAndDropInfo && pDragAndDropInfo->bDragAccepted ) { pEditEngine->GetBeginDropHdl().Call(GetEditViewPtr()); - BOOL bChanges = FALSE; + sal_Bool bChanges = sal_False; HideDDCursor(); if ( pDragAndDropInfo->bStarterOfDD ) { pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_DRAGANDDROP ); - pDragAndDropInfo->bUndoAction = TRUE; + pDragAndDropInfo->bUndoAction = sal_True; } if ( pDragAndDropInfo->bOutlinerMode ) { - bChanges = TRUE; + bChanges = sal_True; GetEditViewPtr()->MoveParagraphs( Range( pDragAndDropInfo->aBeginDragSel.nStartPara, pDragAndDropInfo->aBeginDragSel.nEndPara ), pDragAndDropInfo->nOutlinerDropDest ); } else @@ -1738,8 +1729,8 @@ void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDro uno::Reference< datatransfer::XTransferable > xDataObj = rDTDE.Transferable; if ( xDataObj.is() ) { - bChanges = TRUE; - // Selektion wegmalen... + bChanges = sal_True; + // remove Selection ... DrawSelection(); EditPaM aPaM( pDragAndDropInfo->aDropDest ); @@ -1757,7 +1748,7 @@ void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDro pEditEngine->pImpEditEngine->FormatAndUpdate( pEditEngine->pImpEditEngine->GetActiveView() ); if ( pDragAndDropInfo->bStarterOfDD ) { - // Nur dann setzen, wenn in gleicher Engine! + // Only set if the same engine! pDragAndDropInfo->aDropSel.nStartPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() ); pDragAndDropInfo->aDropSel.nStartPos = aPaM.GetIndex(); pDragAndDropInfo->aDropSel.nEndPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aNewSel.Max().GetNode() ); @@ -1833,9 +1824,7 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge if ( GetOutputArea().IsInside( aMousePos ) && !bReadOnly ) { -// sal_Int8 nSupportedActions = bReadOnly ? datatransfer::dnd::DNDConstants::ACTION_COPY : datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE; - - if ( pDragAndDropInfo && pDragAndDropInfo->bHasValidData /* && ( nSupportedActions & rDTDE.DropAction ) MT: Default = 0x80 ?! */ ) + if ( pDragAndDropInfo && pDragAndDropInfo->bHasValidData ) { bAccept = sal_True; @@ -1844,7 +1833,7 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge { long nScrollX = 0; long nScrollY = 0; - // pruefen, ob im sensitiven Bereich + // Chech if in the sensitive area if ( ( (aMousePos.X()-pDragAndDropInfo->nSensibleRange) < GetOutputArea().Left() ) && ( ( aMousePos.X() + pDragAndDropInfo->nSensibleRange ) > GetOutputArea().Left() ) ) nScrollX = GetOutputArea().GetWidth() / SCRLRANGE; else if ( ( (aMousePos.X()+pDragAndDropInfo->nSensibleRange) > GetOutputArea().Right() ) && ( ( aMousePos.X() - pDragAndDropInfo->nSensibleRange ) < GetOutputArea().Right() ) ) @@ -1867,7 +1856,7 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge pDragAndDropInfo->aDropDest = aPaM; if ( pDragAndDropInfo->bOutlinerMode ) { - USHORT nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() ); + sal_uInt16 nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() ); ParaPortion* pPPortion = pEditEngine->pImpEditEngine->GetParaPortions().SaveGetObject( nPara ); long nDestParaStartY = pEditEngine->pImpEditEngine->GetParaPortions().GetYOffset( pPPortion ); long nRel = aDocPos.Y() - nDestParaStartY; @@ -1883,19 +1872,19 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge if( ( pDragAndDropInfo->nOutlinerDropDest >= pDragAndDropInfo->aBeginDragSel.nStartPara ) && ( pDragAndDropInfo->nOutlinerDropDest <= (pDragAndDropInfo->aBeginDragSel.nEndPara+1) ) ) { - bAccept = FALSE; + bAccept = sal_False; } } else if ( HasSelection() ) { - // es darf nicht in eine Selektion gedroppt werden + // it must not be dropped into a selection EPaM aP = pEditEngine->pImpEditEngine->CreateEPaM( aPaM ); ESelection aDestSel( aP.nPara, aP.nIndex, aP.nPara, aP.nIndex); ESelection aCurSel = pEditEngine->pImpEditEngine->CreateESel( GetEditSelection() ); aCurSel.Adjust(); if ( !aDestSel.IsLess( aCurSel ) && !aDestSel.IsGreater( aCurSel ) ) { - bAccept = FALSE; + bAccept = sal_False; } } if ( bAccept ) @@ -1946,7 +1935,7 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge HideDDCursor(); ShowDDCursor(aEditCursor ); } - pDragAndDropInfo->bDragAccepted = TRUE; + pDragAndDropInfo->bDragAccepted = sal_True; rDTDE.Context->acceptDrag( rDTDE.DropAction ); } } @@ -1956,7 +1945,7 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge { HideDDCursor(); if (pDragAndDropInfo) - pDragAndDropInfo->bDragAccepted = FALSE; + pDragAndDropInfo->bDragAccepted = sal_False; rDTDE.Context->rejectDrag(); } } @@ -1976,7 +1965,7 @@ void ImpEditView::AddDragAndDropListeners() pWindow->GetDropTarget()->setActive( sal_True ); pWindow->GetDropTarget()->setDefaultActions( datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE ); - bActiveDragAndDropListener = TRUE; + bActiveDragAndDropListener = sal_True; } } @@ -1996,7 +1985,7 @@ void ImpEditView::RemoveDragAndDropListeners() mxDnDListener.clear(); } - bActiveDragAndDropListener = FALSE; + bActiveDragAndDropListener = sal_False; } } diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index a08ebe80a9..e2f6d9186d 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -123,7 +123,7 @@ struct DragAndDropInfo sal_uInt16 nCursorWidth; ESelection aBeginDragSel; EditPaM aDropDest; - USHORT nOutlinerDropDest; + sal_uInt16 nOutlinerDropDest; ESelection aDropSel; VirtualDevice* pBackground; const SvxFieldItem* pField; @@ -239,7 +239,7 @@ private: long nInvMore; - ULONG nControl; + sal_uLong nControl; sal_uInt32 nTravelXPos; sal_uInt16 nExtraCursorFlags; sal_uInt16 nCursorBidiLevel; @@ -290,13 +290,13 @@ public: void ResetOutputArea( const Rectangle& rRec ); const Rectangle& GetOutputArea() const { return aOutArea; } - BOOL IsVertical() const; + sal_Bool IsVertical() const; - BOOL PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL ); + sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL ); - BOOL MouseButtonUp( const MouseEvent& rMouseEvent ); - BOOL MouseButtonDown( const MouseEvent& rMouseEvent ); - BOOL MouseMove( const MouseEvent& rMouseEvent ); + sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent ); + sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent ); + sal_Bool MouseMove( const MouseEvent& rMouseEvent ); void Command( const CommandEvent& rCEvt ); void CutCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard, sal_Bool bCut ); @@ -333,9 +333,9 @@ public: void AddDragAndDropListeners(); void RemoveDragAndDropListeners(); - BOOL IsBulletArea( const Point& rPos, sal_uInt16* pPara ); + sal_Bool IsBulletArea( const Point& rPos, sal_uInt16* pPara ); -// Fuer die SelectionEngine... +// For the Selection Engine... void CreateAnchor(); void DeselectAll(); sal_Bool SetCursorAtPoint( const Point& rPointPixel ); @@ -348,9 +348,9 @@ public: void CalcAnchorPoint(); void RecalcOutputArea(); - void ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, BOOL test ); - void ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, USHORT nShowCursorFlags = 0 ); - Pair Scroll( long ndX, long ndY, BYTE nRangeCheck = RGCHK_NEG ); + void ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sal_Bool test ); + void ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sal_uInt16 nShowCursorFlags = 0 ); + Pair Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck = RGCHK_NEG ); void SetInsertMode( sal_Bool bInsert ); sal_Bool IsInsertMode() const { return ( ( nControl & EV_CNTRL_OVERWRITE ) == 0 ); } @@ -376,7 +376,7 @@ public: const SvxFieldItem* GetField( const Point& rPos, sal_uInt16* pPara, sal_uInt16* pPos ) const; void DeleteSelected(); - // Ggf. mehr als OutputArea invalidieren, fuer den DrawingEngine-Textrahmen... + // If possible invalidate more than OutputArea, for the DrawingEngine text frame void SetInvalidateMore( sal_uInt16 nPixel ) { nInvMore = nPixel; } sal_uInt16 GetInvalidateMore() const { return (sal_uInt16)nInvMore; } }; @@ -390,8 +390,8 @@ SV_DECL_PTRARR( EditViews, EditViewPtr, 0, 1 ) class ImpEditEngine : public SfxListener { - // Die Undos muessen direkt manipulieren ( private-Methoden ), - // damit keine neues Undos eingefuegt werden! + // The Undos have to manipulate directly ( private-Methods ), + // do that no new Undo is inserted! friend class EditUndoInsertChars; friend class EditUndoRemoveChars; friend class EditUndoDelContent; @@ -402,26 +402,26 @@ class ImpEditEngine : public SfxListener friend class EditView; friend class ImpEditView; - friend class EditEngine; // Fuer Zugriff auf Imp-Methoden - friend class EditRTFParser; // Fuer Zugriff auf Imp-Methoden - friend class EditHTMLParser; // Fuer Zugriff auf Imp-Methoden - friend class EdtAutoCorrDoc; // Fuer Zugriff auf Imp-Methoden - friend class EditDbg; // DebugRoutinen + friend class EditEngine; // For access to Imp-Methods + friend class EditRTFParser; // For access to Imp-Methods + friend class EditHTMLParser; // For access to Imp-Methods + friend class EdtAutoCorrDoc; // For access to Imp-Methods + friend class EditDbg; // Debug Routines private: // ================================================================ - // Daten... + // Data ... // ================================================================ - // Dokument-Spezifische Daten... - ParaPortionList aParaPortionList; // Formatierung + // Document Specific data ... + ParaPortionList aParaPortionList; // Formatting Size aPaperSize; // Layout Size aMinAutoPaperSize; // Layout ? Size aMaxAutoPaperSize; // Layout ? - EditDoc aEditDoc; // Dokumenteninhalt + EditDoc aEditDoc; // Document content - // Engine-Spezifische Daten.... + // Engine Specific data ... EditEngine* pEditEngine; EditViews aEditViews; EditView* pActiveView; @@ -456,9 +456,9 @@ private: sal_uInt16 nStretchX; sal_uInt16 nStretchY; - USHORT nAsianCompressionMode; - BOOL bKernAsianPunctuation; - BOOL bAddExtLeading; + sal_uInt16 nAsianCompressionMode; + sal_Bool bKernAsianPunctuation; + sal_Bool bAddExtLeading; EEHorizontalTextDirection eDefaultHorizontalTextDirection; @@ -496,18 +496,19 @@ private: sal_Bool bImpConvertFirstCall; // specifies if ImpConvert is called the very first time after Convert was called sal_Bool bFirstWordCapitalization; // specifies if auto-correction should capitalize the first word or not - // Fuer Formatierung / Update.... + // For Formatting / Update .... DeletedNodesList aDeletedNodes; Rectangle aInvalidRec; sal_uInt32 nCurTextHeight; + sal_uInt32 nCurTextHeightNTP; // without trailing empty paragraphs sal_uInt16 nOnePixelInRef; IdleFormattter aIdleFormatter; Timer aOnlineSpellTimer; - // Wenn an einer Stelle erkannt wird, dass der StatusHdl gerufen werden - // muss, dies aber nicht sofort geschehen darf (kritischer Abschnitt): + // If it is detected at one point that the StatusHdl has to be called, but + // this should not happen immediately (critical section): Timer aStatusTimer; Link aStatusHdlLink; Link aNotifyHdl; @@ -524,7 +525,7 @@ private: // ================================================================ - // Methoden... + // Methods... // ================================================================ void CursorMoved( ContentNode* pPrevNode ); @@ -532,7 +533,7 @@ private: void TextModified(); void CalcHeight( ParaPortion* pPortion ); - // ggf. lieber inline, aber so einiges... + // may prefer in-line, but so few ... void InsertUndo( EditUndo* pUndo, sal_Bool bTryMerge = sal_False ); void ResetUndoManager(); sal_Bool HasUndoManager() const { return pUndoManager ? sal_True : sal_False; } @@ -541,14 +542,14 @@ private: EditPaM GetPaM( Point aDocPos, sal_Bool bSmart = sal_True ); EditPaM GetPaM( ParaPortion* pPortion, Point aPos, sal_Bool bSmart = sal_True ); - long GetXPos( ParaPortion* pParaPortion, EditLine* pLine, USHORT nIndex, BOOL bPreferPortionStart = FALSE ); - long GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLine, USHORT nTextPortion ); - USHORT GetChar( ParaPortion* pParaPortion, EditLine* pLine, long nX, BOOL bSmart = TRUE ); + long GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, sal_Bool bPreferPortionStart = sal_False ); + long GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion ); + sal_uInt16 GetChar( ParaPortion* pParaPortion, EditLine* pLine, long nX, sal_Bool bSmart = sal_True ); Range GetInvalidYOffsets( ParaPortion* pPortion ); Range GetLineXPosStartEnd( ParaPortion* pParaPortion, EditLine* pLine ); - void SetParaAttrib( BYTE nFunc, EditSelection aSel, sal_uInt16 nValue ); - sal_uInt16 GetParaAttrib( BYTE nFunc, EditSelection aSel ); + void SetParaAttrib( sal_uInt8 nFunc, EditSelection aSel, sal_uInt16 nValue ); + sal_uInt16 GetParaAttrib( sal_uInt8 nFunc, EditSelection aSel ); void SetCharAttrib( EditSelection aSel, const SfxPoolItem& rItem ); void ParaAttribsToCharAttribs( ContentNode* pNode ); void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const; @@ -556,12 +557,12 @@ private: EditTextObject* CreateBinTextObject( EditSelection aSelection, SfxItemPool*, sal_Bool bAllowBigObjects = sal_False, sal_uInt16 nBigObjStart = 0 ) const; void StoreBinTextObject( SvStream& rOStream, BinTextObject& rTextObject ); EditSelection InsertBinTextObject( BinTextObject&, EditPaM aPaM ); - EditSelection InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxDataObj, const String& rBaseURL, const EditPaM& rPaM, BOOL bUseSpecial ); + EditSelection InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxDataObj, const String& rBaseURL, const EditPaM& rPaM, sal_Bool bUseSpecial ); EditPaM Clear(); EditPaM RemoveText(); EditPaM RemoveText( EditSelection aEditSelection ); - sal_Bool CreateLines( USHORT nPara, sal_uInt32 nStartPosY ); + sal_Bool CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ); void CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uInt32 nStartPosY ); sal_Bool FinishCreateLines( ParaPortion* pParaPortion ); void CalcCharPositions( ParaPortion* pParaPortion ); @@ -589,9 +590,9 @@ private: sal_Bool ImpCheckRefMapMode(); - BOOL ImplHasText() const; + sal_Bool ImplHasText() const; - void ImpFindKashidas( ContentNode* pNode, USHORT nStart, USHORT nEnd, SvUShorts& rArray ); + void ImpFindKashidas( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, SvUShorts& rArray ); void InsertContent( ContentNode* pNode, sal_uInt16 nPos ); EditPaM SplitContent( sal_uInt16 nNode, sal_uInt16 nSepPos ); @@ -604,8 +605,8 @@ private: EditPaM PageDown( const EditPaM& rPaM, EditView* pView); EditPaM CursorUp( const EditPaM& rPaM, EditView* pEditView ); EditPaM CursorDown( const EditPaM& rPaM, EditView* pEditView ); - EditPaM CursorLeft( const EditPaM& rPaM, USHORT nCharacterIteratorMode = ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL ); - EditPaM CursorRight( const EditPaM& rPaM, USHORT nCharacterIteratorMode = ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL ); + EditPaM CursorLeft( const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL ); + EditPaM CursorRight( const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL ); EditPaM CursorStartOfLine( const EditPaM& rPaM ); EditPaM CursorEndOfLine( const EditPaM& rPaM ); EditPaM CursorStartOfParagraph( const EditPaM& rPaM ); @@ -616,22 +617,22 @@ private: EditPaM WordRight( const EditPaM& rPaM, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); EditPaM StartOfWord( const EditPaM& rPaM, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); EditPaM EndOfWord( const EditPaM& rPaM, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); - EditSelection SelectWord( const EditSelection& rCurSelection, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, BOOL bAcceptStartOfWord = TRUE ); + EditSelection SelectWord( const EditSelection& rCurSelection, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_Bool bAcceptStartOfWord = sal_True ); EditSelection SelectSentence( const EditSelection& rCurSel ); - EditPaM CursorVisualLeftRight( EditView* pEditView, const EditPaM& rPaM, USHORT nCharacterIteratorMode, BOOL bToLeft ); - EditPaM CursorVisualStartEnd( EditView* pEditView, const EditPaM& rPaM, BOOL bStart ); + EditPaM CursorVisualLeftRight( EditView* pEditView, const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode, sal_Bool bToLeft ); + EditPaM CursorVisualStartEnd( EditView* pEditView, const EditPaM& rPaM, sal_Bool bStart ); - void InitScriptTypes( USHORT nPara ); - USHORT GetScriptType( const EditPaM& rPaM, USHORT* pEndPos = NULL ) const; - USHORT GetScriptType( const EditSelection& rSel ) const; - BOOL IsScriptChange( const EditPaM& rPaM ) const; - BOOL HasScriptType( USHORT nPara, USHORT nType ) const; + void InitScriptTypes( sal_uInt16 nPara ); + sal_uInt16 GetScriptType( const EditPaM& rPaM, sal_uInt16* pEndPos = NULL ) const; + sal_uInt16 GetScriptType( const EditSelection& rSel ) const; + sal_Bool IsScriptChange( const EditPaM& rPaM ) const; + sal_Bool HasScriptType( sal_uInt16 nPara, sal_uInt16 nType ) const; - BOOL ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, USHORT nStartPos, sal_Int32* pDXArray, USHORT n100thPercentFromMax, BOOL bManipulateDXArray ); + sal_Bool ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_uInt16 nStartPos, sal_Int32* pDXArray, sal_uInt16 n100thPercentFromMax, sal_Bool bManipulateDXArray ); void ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* pParaPortion, long nRemainingWidth ); - void ImplInitLayoutMode( OutputDevice* pOutDev, USHORT nPara, USHORT nIndex ); + void ImplInitLayoutMode( OutputDevice* pOutDev, sal_uInt16 nPara, sal_uInt16 nIndex ); void ImplInitDigitMode( OutputDevice* pOutDev, String* pString, xub_StrLen nStt, xub_StrLen nLen, LanguageType eLang ); EditPaM ReadText( SvStream& rInput, EditSelection aSel ); @@ -643,7 +644,7 @@ private: sal_uInt32 WriteRTF( SvStream& rOutput, EditSelection aSel ); sal_uInt32 WriteXML( SvStream& rOutput, EditSelection aSel ); sal_uInt32 WriteHTML( SvStream& rOutput, EditSelection aSel ); - sal_uInt32 WriteBin( SvStream& rOutput, EditSelection aSel, BOOL bStoreUnicode = FALSE ) const; + sal_uInt32 WriteBin( SvStream& rOutput, EditSelection aSel, sal_Bool bStoreUnicode = sal_False ) const; void WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_uInt16 nPara, sal_uInt16 nPos, SvxFontTable& rFontTable, SvxColorList& rColorList ); @@ -670,12 +671,12 @@ private: long CalcVertLineSpacing(Point& rStartPos) const; Color GetAutoColor() const; - void EnableAutoColor( BOOL b ) { bUseAutoColor = b; } - BOOL IsAutoColorEnabled() const { return bUseAutoColor; } - void ForceAutoColor( BOOL b ) { bForceAutoColor = b; } - BOOL IsForceAutoColor() const { return bForceAutoColor; } + void EnableAutoColor( sal_Bool b ) { bUseAutoColor = b; } + sal_Bool IsAutoColorEnabled() const { return bUseAutoColor; } + void ForceAutoColor( sal_Bool b ) { bForceAutoColor = b; } + sal_Bool IsForceAutoColor() const { return bForceAutoColor; } - inline VirtualDevice* GetVirtualDevice( const MapMode& rMapMode, ULONG nDrawMode ); + inline VirtualDevice* GetVirtualDevice( const MapMode& rMapMode, sal_uLong nDrawMode ); inline void EraseVirtualDevice(); DECL_LINK( StatusTimerHdl, Timer * ); @@ -702,7 +703,7 @@ private: the output string at hand. This is necessary for slideshow text effects. */ - void ImplFillTextMarkingVector(const ::com::sun::star::lang::Locale& rLocale, EEngineData::TextMarkingVector& rTextMarkingVector, const String& rTxt, const USHORT nIdx, const USHORT nLen) const; + void ImplFillTextMarkingVector(const ::com::sun::star::lang::Locale& rLocale, EEngineData::TextMarkingVector& rTextMarkingVector, const String& rTxt, const sal_uInt16 nIdx, const sal_uInt16 nLen) const; SpellInfo * CreateSpellInfo( const EditSelection &rSel, bool bMultipleDocs ); @@ -713,7 +714,7 @@ public: ImpEditEngine( EditEngine* pEditEngine, SfxItemPool* pPool ); ~ImpEditEngine(); - void InitDoc( BOOL bKeepParaAttribs ); + void InitDoc( sal_Bool bKeepParaAttribs ); EditDoc& GetEditDoc() { return aEditDoc; } const EditDoc& GetEditDoc() const { return aEditDoc; } @@ -729,20 +730,20 @@ public: const Size& GetPaperSize() const { return aPaperSize; } void SetPaperSize( const Size& rSz ) { aPaperSize = rSz; } - void SetVertical( BOOL bVertical ); - BOOL IsVertical() const { return GetEditDoc().IsVertical(); } + void SetVertical( sal_Bool bVertical ); + sal_Bool IsVertical() const { return GetEditDoc().IsVertical(); } - void SetFixedCellHeight( BOOL bUseFixedCellHeight ); - BOOL IsFixedCellHeight() const { return GetEditDoc().IsFixedCellHeight(); } + void SetFixedCellHeight( sal_Bool bUseFixedCellHeight ); + sal_Bool IsFixedCellHeight() const { return GetEditDoc().IsFixedCellHeight(); } void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir ) { eDefaultHorizontalTextDirection = eHTextDir; } EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const { return eDefaultHorizontalTextDirection; } - void InitWritingDirections( USHORT nPara ); - BOOL IsRightToLeft( USHORT nPara ) const; - BYTE GetRightToLeft( USHORT nPara, USHORT nChar, USHORT* pStart = NULL, USHORT* pEnd = NULL ); - BOOL HasDifferentRTLLevels( const ContentNode* pNode ); + void InitWritingDirections( sal_uInt16 nPara ); + sal_Bool IsRightToLeft( sal_uInt16 nPara ) const; + sal_uInt8 GetRightToLeft( sal_uInt16 nPara, sal_uInt16 nChar, sal_uInt16* pStart = NULL, sal_uInt16* pEnd = NULL ); + sal_Bool HasDifferentRTLLevels( const ContentNode* pNode ); void SetTextRanger( TextRanger* pRanger ); TextRanger* GetTextRanger() const { return pTextRanger; } @@ -786,8 +787,8 @@ public: EditPaM DeleteSelected( EditSelection aEditSelection); EditPaM InsertText( const EditSelection& rCurEditSelection, sal_Unicode c, sal_Bool bOverwrite, sal_Bool bIsUserInput = sal_False ); EditPaM InsertText( EditSelection aCurEditSelection, const String& rStr ); - EditPaM AutoCorrect( const EditSelection& rCurEditSelection, sal_Unicode c, bool bOverwrite, Window* pFrameWin = NULL ); - EditPaM DeleteLeftOrRight( const EditSelection& rEditSelection, BYTE nMode, BYTE nDelMode = DELMODE_SIMPLE ); + EditPaM AutoCorrect( const EditSelection& rCurEditSelection, sal_Unicode c, sal_Bool bOverwrite, Window* pFrameWin = NULL ); + EditPaM DeleteLeftOrRight( const EditSelection& rEditSelection, sal_uInt8 nMode, sal_uInt8 nDelMode = DELMODE_SIMPLE ); EditPaM InsertParaBreak( EditSelection aEditSelection ); EditPaM InsertLineBreak( EditSelection aEditSelection ); EditPaM InsertTab( EditSelection aEditSelection ); @@ -806,20 +807,21 @@ public: EditSelection MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos, EditView* pCurView ); - sal_uInt32 CalcTextHeight(); + sal_uInt32 CalcTextHeight( sal_uInt32* pHeightNTP ); sal_uInt32 GetTextHeight() const; - sal_uInt32 CalcTextWidth( BOOL bIgnoreExtraSpace ); - sal_uInt32 CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, BOOL bIgnoreExtraSpace ); + sal_uInt32 GetTextHeightNTP() const; + sal_uInt32 CalcTextWidth( sal_Bool bIgnoreExtraSpace ); + sal_uInt32 CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, sal_Bool bIgnoreExtraSpace ); sal_uInt16 GetLineCount( sal_uInt16 nParagraph ) const; sal_uInt16 GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const; - void GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const; - USHORT GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const; + void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const; + sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const; sal_uInt16 GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine ); sal_uInt32 GetParaHeight( sal_uInt16 nParagraph ); - SfxItemSet GetAttribs( USHORT nPara, USHORT nStart, USHORT nEnd, sal_uInt8 nFlags = 0xFF ) const; - SfxItemSet GetAttribs( EditSelection aSel, BOOL bOnlyHardAttrib = FALSE ); - void SetAttribs( EditSelection aSel, const SfxItemSet& rSet, BYTE nSpecial = 0 ); + SfxItemSet GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const; + SfxItemSet GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttrib = sal_False ); + void SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0 ); void RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich = 0 ); void RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0, sal_Bool bRemoveFeatures = sal_False ); void SetFlatMode( sal_Bool bFlat ); @@ -844,7 +846,7 @@ public: void IndentBlock( EditView* pView, sal_Bool bRight ); -// Fuer Undo/Redo +// For Undo/Redo sal_Bool Undo( EditView* pView ); sal_Bool Redo( EditView* pView ); sal_Bool Repeat( EditView* pView ); @@ -864,8 +866,8 @@ public: inline void IdleFormatAndUpdate( EditView* pCurView = 0 ); svtools::ColorConfig& GetColorConfig(); - BOOL IsVisualCursorTravelingEnabled(); - BOOL DoVisualCursorTraveling( const ContentNode* pNode ); + sal_Bool IsVisualCursorTravelingEnabled(); + sal_Bool DoVisualCursorTraveling( const ContentNode* pNode ); EditSelection ConvertSelection( sal_uInt16 nStartPara, sal_uInt16 nStartPos, sal_uInt16 nEndPara, sal_uInt16 nEndPos ) const; inline EPaM CreateEPaM( const EditPaM& rPaM ); @@ -927,7 +929,7 @@ public: LanguageType GetLanguage( const EditSelection rSelection ) const; - LanguageType GetLanguage( const EditPaM& rPaM, USHORT* pEndPos = NULL ) const; + LanguageType GetLanguage( const EditPaM& rPaM, sal_uInt16* pEndPos = NULL ) const; ::com::sun::star::lang::Locale GetLocale( const EditPaM& rPaM ) const; void DoOnlineSpelling( ContentNode* pThisNodeOnly = 0, sal_Bool bSpellAtCursorPos = sal_False, sal_Bool bInteruptable = sal_True ); @@ -939,14 +941,14 @@ public: ImpSpell( EditView* pEditView ); // text conversion functions - void Convert( EditView* pEditView, LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, INT32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ); + void Convert( EditView* pEditView, LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ); void ImpConvert( rtl::OUString &rConvTxt, LanguageType &rConvTxtLang, EditView* pEditView, LanguageType nSrcLang, const ESelection &rConvRange, sal_Bool bAllowImplicitChangesForNotConvertibleText, LanguageType nTargetLang, const Font *pTargetFont ); ConvInfo * GetConvInfo() const { return pConvInfo; } sal_Bool HasConvertibleTextPortion( LanguageType nLang ); void SetLanguageAndFont( const ESelection &rESel, - LanguageType nLang, USHORT nLangWhichId, - const Font *pFont, USHORT nFontWhichId ); + LanguageType nLang, sal_uInt16 nLangWhichId, + const Font *pFont, sal_uInt16 nFontWhichId ); // returns true if input sequence checking should be applied sal_Bool IsInputSequenceCheckingRequired( sal_Unicode nChar, const EditSelection& rCurSel ) const; @@ -990,9 +992,9 @@ public: sal_Int32 GetSpaceBeforeAndMinLabelWidth( const ContentNode *pNode, sal_Int32 *pnSpaceBefore = 0, sal_Int32 *pnMinLabelWidth = 0 ) const; const SvxLRSpaceItem& GetLRSpaceItem( ContentNode* pNode ); - SvxAdjust GetJustification( USHORT nPara ) const; - SvxCellJustifyMethod GetJustifyMethod( USHORT nPara ) const; - SvxCellVerJustify GetVerJustification( USHORT nPara ) const; + SvxAdjust GetJustification( sal_uInt16 nPara ) const; + SvxCellJustifyMethod GetJustifyMethod( sal_uInt16 nPara ) const; + SvxCellVerJustify GetVerJustification( sal_uInt16 nPara ) const; void SetCharStretching( sal_uInt16 nX, sal_uInt16 nY ); inline void GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ); @@ -1010,22 +1012,22 @@ public: void SetAutoCompleteText( const String& rStr, sal_Bool bUpdateTipWindow ); EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode ); - short ReplaceTextOnly( ContentNode* pNode, USHORT nCurrentStart, xub_StrLen nLen, const String& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rOffsets ); + short ReplaceTextOnly( ContentNode* pNode, sal_uInt16 nCurrentStart, xub_StrLen nLen, const String& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rOffsets ); - void SetAsianCompressionMode( USHORT n ); - USHORT GetAsianCompressionMode() const { return nAsianCompressionMode; } + void SetAsianCompressionMode( sal_uInt16 n ); + sal_uInt16 GetAsianCompressionMode() const { return nAsianCompressionMode; } - void SetKernAsianPunctuation( BOOL b ); - BOOL IsKernAsianPunctuation() const { return bKernAsianPunctuation; } + void SetKernAsianPunctuation( sal_Bool b ); + sal_Bool IsKernAsianPunctuation() const { return bKernAsianPunctuation; } - void SetAddExtLeading( BOOL b ); - BOOL IsAddExtLeading() const { return bAddExtLeading; } + void SetAddExtLeading( sal_Bool b ); + sal_Bool IsAddExtLeading() const { return bAddExtLeading; } - rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable( BOOL bGetInternal = TRUE ) const; + rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable( sal_Bool bGetInternal = sal_True ) const; void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ); - BOOL mbLastTryMerge; + sal_Bool mbLastTryMerge; /** sets a link that is called at the beginning of a drag operation at an edit view */ void SetBeginDropHdl( const Link& rLink ) { maBeginDropHdl = rLink; } @@ -1036,8 +1038,8 @@ public: Link GetEndDropHdl() const { return maEndDropHdl; } /// specifies if auto-correction should capitalize the first word or not (default is on) - void SetFirstWordCapitalization( BOOL bCapitalize ) { bFirstWordCapitalization = bCapitalize; } - BOOL IsFirstWordCapitalization() const { return bFirstWordCapitalization; } + void SetFirstWordCapitalization( sal_Bool bCapitalize ) { bFirstWordCapitalization = bCapitalize; } + sal_Bool IsFirstWordCapitalization() const { return bFirstWordCapitalization; } }; inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM ) @@ -1048,8 +1050,8 @@ inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM ) inline EditPaM ImpEditEngine::CreateEditPaM( const EPaM& rEPaM ) { - DBG_ASSERT( rEPaM.nPara < aEditDoc.Count(), "CreateEditPaM: Ungueltiger Absatz" ); - DBG_ASSERT( aEditDoc[ rEPaM.nPara ]->Len() >= rEPaM.nIndex, "CreateEditPaM: Ungueltiger Index" ); + DBG_ASSERT( rEPaM.nPara < aEditDoc.Count(), "CreateEditPaM: invalid paragraph" ); + DBG_ASSERT( aEditDoc[ rEPaM.nPara ]->Len() >= rEPaM.nIndex, "CreateEditPaM: invalid Index" ); return EditPaM( aEditDoc[ rEPaM.nPara], rEPaM.nIndex ); } @@ -1067,18 +1069,18 @@ inline ESelection ImpEditEngine::CreateESel( const EditSelection& rSel ) inline EditSelection ImpEditEngine::CreateSel( const ESelection& rSel ) { - DBG_ASSERT( rSel.nStartPara < aEditDoc.Count(), "CreateSel: Ungueltiger Start-Absatz" ); - DBG_ASSERT( rSel.nEndPara < aEditDoc.Count(), "CreateSel: Ungueltiger End-Absatz" ); + DBG_ASSERT( rSel.nStartPara < aEditDoc.Count(), "CreateSel: invalid start paragraph" ); + DBG_ASSERT( rSel.nEndPara < aEditDoc.Count(), "CreateSel: invalid end paragraph" ); EditSelection aSel; aSel.Min().SetNode( aEditDoc[ rSel.nStartPara ] ); aSel.Min().SetIndex( rSel.nStartPos ); aSel.Max().SetNode( aEditDoc[ rSel.nEndPara ] ); aSel.Max().SetIndex( rSel.nEndPos ); - DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "CreateSel: Fehlerhafte Selektion!" ); + DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "CreateSel: incorrect selection!" ); return aSel; } -inline VirtualDevice* ImpEditEngine::GetVirtualDevice( const MapMode& rMapMode, ULONG nDrawMode ) +inline VirtualDevice* ImpEditEngine::GetVirtualDevice( const MapMode& rMapMode, sal_uLong nDrawMode ) { if ( !pVirtDev ) pVirtDev = new VirtualDevice; @@ -1108,14 +1110,12 @@ inline void ImpEditEngine::IdleFormatAndUpdate( EditView* pCurView ) aIdleFormatter.DoIdleFormat( pCurView ); } -#ifndef SVX_LIGHT inline EditUndoManager& ImpEditEngine::GetUndoManager() { if ( !pUndoManager ) pUndoManager = new EditUndoManager( this ); return *pUndoManager; } -#endif inline ParaPortion* ImpEditEngine::FindParaPortion( ContentNode* pNode ) const { @@ -1213,7 +1213,7 @@ inline Cursor* ImpEditView::GetCursor() void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit ); void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const MapUnit* pSourceUnit = NULL, const MapUnit* pDestUnit = NULL ); -BYTE GetCharTypeForCompression( xub_Unicode cChar ); +sal_uInt8 GetCharTypeForCompression( xub_Unicode cChar ); Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin ); #endif // _IMPEDIT_HXX diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index d610c68dcb..cb9497e517 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -77,21 +77,9 @@ using namespace ::com::sun::star; -USHORT lcl_CalcExtraSpace( ParaPortion*, const SvxLineSpacingItem& rLSItem ) +sal_uInt16 lcl_CalcExtraSpace( ParaPortion*, const SvxLineSpacingItem& rLSItem ) { - USHORT nExtra = 0; - /* if ( ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) - && ( rLSItem.GetPropLineSpace() != 100 ) ) - { - // ULONG nH = pPortion->GetNode()->GetCharAttribs().GetDefFont().GetSize().Height(); - ULONG nH = pPortion->GetLines().GetObject( 0 )->GetHeight(); - long n = nH * rLSItem.GetPropLineSpace(); - n /= 100; - n -= nH; // nur den Abstand - if ( n > 0 ) - nExtra = (USHORT)n; - } - else */ + sal_uInt16 nExtra = 0; if ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) { nExtra = rLSItem.GetInterLineSpace(); @@ -100,10 +88,6 @@ USHORT lcl_CalcExtraSpace( ParaPortion*, const SvxLineSpacingItem& rLSItem ) return nExtra; } -// ---------------------------------------------------------------------- -// class ImpEditEngine -// ---------------------------------------------------------------------- - ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : aPaperSize( 0x7FFFFFFF, 0x7FFFFFFF ), aMinAutoPaperSize( 0x0, 0x0 ), @@ -129,32 +113,33 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : pCTLOptions = NULL; nCurTextHeight = 0; + nCurTextHeightNTP = 0; nBlockNotifications = 0; nBigTextObjectStart = 20; nStretchX = 100; nStretchY = 100; - bInSelection = FALSE; - bOwnerOfRefDev = FALSE; - bDowning = FALSE; - bIsInUndo = FALSE; - bIsFormatting = FALSE; - bFormatted = FALSE; - bUpdate = TRUE; - bUseAutoColor = TRUE; - bForceAutoColor = FALSE; - bAddExtLeading = FALSE; - bUndoEnabled = TRUE; - bCallParaInsertedOrDeleted = FALSE; - bImpConvertFirstCall= FALSE; - bFirstWordCapitalization = TRUE; + bInSelection = sal_False; + bOwnerOfRefDev = sal_False; + bDowning = sal_False; + bIsInUndo = sal_False; + bIsFormatting = sal_False; + bFormatted = sal_False; + bUpdate = sal_True; + bUseAutoColor = sal_True; + bForceAutoColor = sal_False; + bAddExtLeading = sal_False; + bUndoEnabled = sal_True; + bCallParaInsertedOrDeleted = sal_False; + bImpConvertFirstCall= sal_False; + bFirstWordCapitalization = sal_True; eDefLanguage = LANGUAGE_DONTKNOW; maBackgroundColor = COL_AUTO; nAsianCompressionMode = text::CharacterCompressionType::NONE; - bKernAsianPunctuation = FALSE; + bKernAsianPunctuation = sal_False; eDefaultHorizontalTextDirection = EE_HTEXTDIR_DEFAULT; @@ -177,15 +162,15 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : pRefDev = EE_DLL()->GetGlobalData()->GetStdRefDevice(); - // Ab hier wird schon auf Daten zugegriffen! + // Access data already from here on! SetRefDevice( pRefDev ); - InitDoc( FALSE ); + InitDoc( sal_False ); - bCallParaInsertedOrDeleted = TRUE; + bCallParaInsertedOrDeleted = sal_True; aEditDoc.SetModifyHdl( LINK( this, ImpEditEngine, DocModified ) ); - mbLastTryMerge = FALSE; + mbLastTryMerge = sal_False; } ImpEditEngine::~ImpEditEngine() @@ -194,11 +179,11 @@ ImpEditEngine::~ImpEditEngine() aOnlineSpellTimer.Stop(); aIdleFormatter.Stop(); - // das Zerstoeren von Vorlagen kann sonst unnoetiges Formatieren ausloesen, - // wenn eine Parent-Vorlage zerstoert wird. - // Und das nach dem Zerstoeren der Daten! - bDowning = TRUE; - SetUpdateMode( FALSE ); + // Destroying templates may otherwise cause unnecessary formatting, + // when a parent template is destroyed. + // And this after the destruction of the data! + bDowning = sal_True; + SetUpdateMode( sal_False ); delete pVirtDev; delete pEmptyItemSet; @@ -218,12 +203,12 @@ void ImpEditEngine::SetRefDevice( OutputDevice* pRef ) delete pRefDev; pRefDev = pRef; - bOwnerOfRefDev = FALSE; + bOwnerOfRefDev = sal_False; if ( !pRef ) pRefDev = EE_DLL()->GetGlobalData()->GetStdRefDevice(); - nOnePixelInRef = (USHORT)pRefDev->PixelToLogic( Size( 1, 0 ) ).Width(); + nOnePixelInRef = (sal_uInt16)pRefDev->PixelToLogic( Size( 1, 0 ) ).Width(); if ( IsFormatted() ) { @@ -237,16 +222,16 @@ void ImpEditEngine::SetRefMapMode( const MapMode& rMapMode ) if ( GetRefDevice()->GetMapMode() == rMapMode ) return; - // Wenn RefDev == GlobalRefDev => eigenes anlegen! + // When RefDev == GlobalRefDev => create own! if ( !bOwnerOfRefDev && ( pRefDev == EE_DLL()->GetGlobalData()->GetStdRefDevice() ) ) { pRefDev = new VirtualDevice; pRefDev->SetMapMode( MAP_TWIP ); SetRefDevice( pRefDev ); - bOwnerOfRefDev = TRUE; + bOwnerOfRefDev = sal_True; } pRefDev->SetMapMode( rMapMode ); - nOnePixelInRef = (USHORT)pRefDev->PixelToLogic( Size( 1, 0 ) ).Width(); + nOnePixelInRef = (sal_uInt16)pRefDev->PixelToLogic( Size( 1, 0 ) ).Width(); if ( IsFormatted() ) { FormatFullDoc(); @@ -254,13 +239,13 @@ void ImpEditEngine::SetRefMapMode( const MapMode& rMapMode ) } } -void ImpEditEngine::InitDoc( BOOL bKeepParaAttribs ) +void ImpEditEngine::InitDoc( sal_Bool bKeepParaAttribs ) { - USHORT nParas = aEditDoc.Count(); - for ( USHORT n = bKeepParaAttribs ? 1 : 0; n < nParas; n++ ) + sal_uInt16 nParas = aEditDoc.Count(); + for ( sal_uInt16 n = bKeepParaAttribs ? 1 : 0; n < nParas; n++ ) { if ( aEditDoc[n]->GetStyleSheet() ) - EndListening( *aEditDoc[n]->GetStyleSheet(), FALSE ); + EndListening( *aEditDoc[n]->GetStyleSheet(), sal_False ); } if ( bKeepParaAttribs ) @@ -273,7 +258,7 @@ void ImpEditEngine::InitDoc( BOOL bKeepParaAttribs ) ParaPortion* pIniPortion = new ParaPortion( aEditDoc[0] ); GetParaPortions().Insert( pIniPortion, 0 ); - bFormatted = FALSE; + bFormatted = sal_False; if ( IsCallParaInsertedOrDeleted() ) { @@ -281,10 +266,8 @@ void ImpEditEngine::InitDoc( BOOL bKeepParaAttribs ) GetEditEnginePtr()->ParagraphInserted( 0 ); } -#ifndef SVX_LIGHT if ( GetStatus().DoOnlineSpelling() ) aEditDoc.GetObject( 0 )->CreateWrongList(); -#endif // !SVX_LIGHT } EditPaM ImpEditEngine::DeleteSelected( EditSelection aSel ) @@ -306,22 +289,22 @@ XubString ImpEditEngine::GetSelected( const EditSelection& rSel, const LineEnd e ContentNode* pStartNode = aSel.Min().GetNode(); ContentNode* pEndNode = aSel.Max().GetNode(); - USHORT nStartNode = aEditDoc.GetPos( pStartNode ); - USHORT nEndNode = aEditDoc.GetPos( pEndNode ); + sal_uInt16 nStartNode = aEditDoc.GetPos( pStartNode ); + sal_uInt16 nEndNode = aEditDoc.GetPos( pEndNode ); - DBG_ASSERT( nStartNode <= nEndNode, "Selektion nicht sortiert ?" ); + OSL_ENSURE( nStartNode <= nEndNode, "Selection not sorted ?" ); - // ueber die Absaetze iterieren... - for ( USHORT nNode = nStartNode; nNode <= nEndNode; nNode++ ) + // iterate over the paragraphs ... + for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { - DBG_ASSERT( aEditDoc.SaveGetObject( nNode ), "Node nicht gefunden: GetSelected" ); + OSL_ENSURE( aEditDoc.SaveGetObject( nNode ), "Node not found: GetSelected" ); ContentNode* pNode = aEditDoc.GetObject( nNode ); xub_StrLen nStartPos = 0; xub_StrLen nEndPos = pNode->Len(); if ( nNode == nStartNode ) nStartPos = aSel.Min().GetIndex(); - if ( nNode == nEndNode ) // kann auch == nStart sein! + if ( nNode == nEndNode ) // can also be == nStart! nEndPos = aSel.Max().GetIndex(); aText += aEditDoc.GetParaAsString( pNode, nStartPos, nEndPos ); @@ -331,34 +314,34 @@ XubString ImpEditEngine::GetSelected( const EditSelection& rSel, const LineEnd e return aText; } -BOOL ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pView ) +sal_Bool ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pView ) { GetSelEngine().SetCurView( pView ); SetActiveView( pView ); if ( GetAutoCompleteText().Len() ) - SetAutoCompleteText( String(), TRUE ); + SetAutoCompleteText( String(), sal_True ); GetSelEngine().SelMouseButtonDown( rMEvt ); - // Sonderbehandlungen + // Special treatment EditSelection aCurSel( pView->pImpEditView->GetEditSelection() ); if ( !rMEvt.IsShift() ) { if ( rMEvt.GetClicks() == 2 ) { - // damit die SelectionEngine weiss, dass Anker. - aSelEngine.CursorPosChanging( TRUE, FALSE ); + // So that the SelectionEngine knows about the anchor. + aSelEngine.CursorPosChanging( sal_True, sal_False ); EditSelection aNewSelection( SelectWord( aCurSel ) ); pView->pImpEditView->DrawSelection(); pView->pImpEditView->SetEditSelection( aNewSelection ); pView->pImpEditView->DrawSelection(); - pView->ShowCursor( TRUE, TRUE ); + pView->ShowCursor( sal_True, sal_True ); } else if ( rMEvt.GetClicks() == 3 ) { - // damit die SelectionEngine weiss, dass Anker. - aSelEngine.CursorPosChanging( TRUE, FALSE ); + // So that the SelectionEngine knows about the anchor. + aSelEngine.CursorPosChanging( sal_True, sal_False ); EditSelection aNewSelection( aCurSel ); aNewSelection.Min().SetIndex( 0 ); @@ -366,10 +349,10 @@ BOOL ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pView ) pView->pImpEditView->DrawSelection(); pView->pImpEditView->SetEditSelection( aNewSelection ); pView->pImpEditView->DrawSelection(); - pView->ShowCursor( TRUE, TRUE ); + pView->ShowCursor( sal_True, sal_True ); } } - return TRUE; + return sal_True; } void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) @@ -381,9 +364,8 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) const CommandVoiceData* pData = rCEvt.GetVoiceData(); if ( pData->GetType() == VOICECOMMANDTYPE_DICTATION ) { - // Funktionen auf KeyEvents umbiegen, wenn keine entsprechende - // Methode an EditView/EditEngine, damit Undo konsistent bleibt. - + // Turn functions into KeyEvent if no corresponding method to + // EditView/EditEngine so that Undo remains consistent. SfxPoolItem* pNewAttr = NULL; switch ( pData->GetCommand() ) @@ -486,7 +468,7 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) delete mpIMEInfos; EditPaM aPaM = pView->GetImpEditView()->GetEditSelection().Max(); String aOldTextAfterStartPos = aPaM.GetNode()->Copy( aPaM.GetIndex() ); - USHORT nMax = aOldTextAfterStartPos.Search( CH_FEATURE ); + sal_uInt16 nMax = aOldTextAfterStartPos.Search( CH_FEATURE ); if ( nMax != STRING_NOTFOUND ) // don't overwrite features! aOldTextAfterStartPos.Erase( nMax ); mpIMEInfos = new ImplIMEInfos( aPaM, aOldTextAfterStartPos ); @@ -495,7 +477,7 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) } else if ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT ) { - DBG_ASSERT( mpIMEInfos, "COMMAND_ENDEXTTEXTINPUT => Kein Start ?" ); + OSL_ENSURE( mpIMEInfos, "COMMAND_ENDEXTTEXTINPUT => Kein Start ?" ); if( mpIMEInfos ) { // #102812# convert quotes in IME text @@ -523,7 +505,7 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) ParaPortion* pPortion = FindParaPortion( mpIMEInfos->aPos.GetNode() ); pPortion->MarkSelectionInvalid( mpIMEInfos->aPos.GetIndex(), 0 ); - BOOL bWasCursorOverwrite = mpIMEInfos->bWasCursorOverwrite; + sal_Bool bWasCursorOverwrite = mpIMEInfos->bWasCursorOverwrite; delete mpIMEInfos; mpIMEInfos = NULL; @@ -536,7 +518,7 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) } else if ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT ) { - DBG_ASSERT( mpIMEInfos, "COMMAND_EXTTEXTINPUT => Kein Start ?" ); + OSL_ENSURE( mpIMEInfos, "COMMAND_EXTTEXTINPUT => No Start ?" ); if( mpIMEInfos ) { const CommandExtTextInputData* pData = rCEvt.GetExtTextInputData(); @@ -551,14 +533,14 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) if ( mpIMEInfos->bWasCursorOverwrite ) { - USHORT nOldIMETextLen = mpIMEInfos->nLen; - USHORT nNewIMETextLen = pData->GetText().Len(); + sal_uInt16 nOldIMETextLen = mpIMEInfos->nLen; + sal_uInt16 nNewIMETextLen = pData->GetText().Len(); if ( ( nOldIMETextLen > nNewIMETextLen ) && ( nNewIMETextLen < mpIMEInfos->aOldTextAfterStartPos.Len() ) ) { // restore old characters - USHORT nRestore = nOldIMETextLen - nNewIMETextLen; + sal_uInt16 nRestore = nOldIMETextLen - nNewIMETextLen; EditPaM aPaM( mpIMEInfos->aPos ); aPaM.GetIndex() = aPaM.GetIndex() + nNewIMETextLen; ImpInsertText( aPaM, mpIMEInfos->aOldTextAfterStartPos.Copy( nNewIMETextLen, nRestore ) ); @@ -567,10 +549,10 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) ( nOldIMETextLen < mpIMEInfos->aOldTextAfterStartPos.Len() ) ) { // overwrite - USHORT nOverwrite = nNewIMETextLen - nOldIMETextLen; + sal_uInt16 nOverwrite = nNewIMETextLen - nOldIMETextLen; if ( ( nOldIMETextLen + nOverwrite ) > mpIMEInfos->aOldTextAfterStartPos.Len() ) nOverwrite = mpIMEInfos->aOldTextAfterStartPos.Len() - nOldIMETextLen; - DBG_ASSERT( nOverwrite && (nOverwrite < 0xFF00), "IME Overwrite?!" ); + OSL_ENSURE( nOverwrite && (nOverwrite < 0xFF00), "IME Overwrite?!" ); EditPaM aPaM( mpIMEInfos->aPos ); aPaM.GetIndex() = aPaM.GetIndex() + nNewIMETextLen; EditSelection _aSel( aPaM ); @@ -615,13 +597,13 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) EditPaM aPaM( pView->pImpEditView->GetEditSelection().Max() ); Rectangle aR1 = PaMtoEditCursor( aPaM, 0 ); - USHORT nInputEnd = mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen; + sal_uInt16 nInputEnd = mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen; if ( !IsFormatted() ) FormatDoc(); ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( GetEditDoc().GetPos( aPaM.GetNode() ) ); - USHORT nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_True ); + sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_True ); EditLine* pLine = pParaPortion->GetLines().GetObject( nLine ); if ( pLine && ( nInputEnd > pLine->GetEnd() ) ) nInputEnd = pLine->GetEnd(); @@ -674,12 +656,12 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) GetSelEngine().Command( rCEvt ); } -BOOL ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, EditView* pView ) +sal_Bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, EditView* pView ) { GetSelEngine().SetCurView( pView ); GetSelEngine().SelMouseButtonUp( rMEvt ); - bInSelection = FALSE; - // Sonderbehandlungen + bInSelection = sal_False; + // Special treatments EditSelection aCurSel( pView->pImpEditView->GetEditSelection() ); if ( !aCurSel.HasRange() ) { @@ -689,22 +671,20 @@ BOOL ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, EditView* pView ) if ( pFld ) { EditPaM aPaM( aCurSel.Max() ); - USHORT nPara = GetEditDoc().GetPos( aPaM.GetNode() ); + sal_uInt16 nPara = GetEditDoc().GetPos( aPaM.GetNode() ); GetEditEnginePtr()->FieldClicked( *pFld, nPara, aPaM.GetIndex() ); } } } - return TRUE; + return sal_True; } -BOOL ImpEditEngine::MouseMove( const MouseEvent& rMEvt, EditView* pView ) +sal_Bool ImpEditEngine::MouseMove( const MouseEvent& rMEvt, EditView* pView ) { - // MouseMove wird sofort nach ShowQuickHelp() gerufen! -// if ( GetAutoCompleteText().Len() ) -// SetAutoCompleteText( String(), TRUE ); + // MouseMove is called directly after ShowQuickHelp()! GetSelEngine().SetCurView( pView ); GetSelEngine().SelMouseMove( rMEvt ); - return TRUE; + return sal_True; } EditPaM ImpEditEngine::InsertText( EditSelection aSel, const XubString& rStr ) @@ -715,16 +695,17 @@ EditPaM ImpEditEngine::InsertText( EditSelection aSel, const XubString& rStr ) EditPaM ImpEditEngine::Clear() { - InitDoc( FALSE ); + InitDoc( sal_False ); EditPaM aPaM = aEditDoc.GetStartPaM(); EditSelection aSel( aPaM ); nCurTextHeight = 0; + nCurTextHeightNTP = 0; ResetUndoManager(); - for ( USHORT nView = aEditViews.Count(); nView; ) + for ( sal_uInt16 nView = aEditViews.Count(); nView; ) { EditView* pView = aEditViews[--nView]; DBG_CHKOBJ( pView, EditView, 0 ); @@ -736,11 +717,11 @@ EditPaM ImpEditEngine::Clear() EditPaM ImpEditEngine::RemoveText() { - InitDoc( TRUE ); + InitDoc( sal_True ); EditPaM aStartPaM = aEditDoc.GetStartPaM(); EditSelection aEmptySel( aStartPaM, aStartPaM ); - for ( USHORT nView = 0; nView < aEditViews.Count(); nView++ ) + for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ ) { EditView* pView = aEditViews.GetObject(nView); DBG_CHKOBJ( pView, EditView, 0 ); @@ -753,24 +734,24 @@ EditPaM ImpEditEngine::RemoveText() void ImpEditEngine::SetText( const XubString& rText ) { - // RemoveText loescht die Undo-Liste! + // RemoveText deletes the undo list! EditPaM aStartPaM = RemoveText(); - BOOL bUndoCurrentlyEnabled = IsUndoEnabled(); - // Der von Hand reingesteckte Text kann nicht vom Anwender rueckgaengig gemacht werden. - EnableUndo( FALSE ); + sal_Bool bUndoCurrentlyEnabled = IsUndoEnabled(); + // The text inserted manually can not be made reversable by the user + EnableUndo( sal_False ); EditSelection aEmptySel( aStartPaM, aStartPaM ); EditPaM aPaM = aStartPaM; if ( rText.Len() ) aPaM = ImpInsertText( aEmptySel, rText ); - for ( USHORT nView = 0; nView < aEditViews.Count(); nView++ ) + for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ ) { EditView* pView = aEditViews[nView]; DBG_CHKOBJ( pView, EditView, 0 ); pView->pImpEditView->SetEditSelection( EditSelection( aPaM, aPaM ) ); - // Wenn kein Text, dann auch Kein Format&Update - // => Der Text bleibt stehen. + // If no text then also no Format&Update + // => The text remains. if ( !rText.Len() && GetUpdateMode() ) { Rectangle aTmpRec( pView->GetOutputArea().TopLeft(), @@ -779,12 +760,12 @@ void ImpEditEngine::SetText( const XubString& rText ) pView->GetWindow()->Invalidate( aTmpRec ); } } - if( !rText.Len() ) // sonst muss spaeter noch invalidiert werden, !bFormatted reicht. + if( !rText.Len() ) { // otherwise it must be invalidated later, !bFormatted is enough. nCurTextHeight = 0; + nCurTextHeightNTP = 0; + } EnableUndo( bUndoCurrentlyEnabled ); -#ifndef SVX_LIGHT - DBG_ASSERT( !HasUndoManager() || !GetUndoManager().GetUndoActionCount(), "Undo nach SetText?" ); -#endif + OSL_ENSURE( !HasUndoManager() || !GetUndoManager().GetUndoActionCount(), "Undo after SetText?" ); } @@ -793,7 +774,7 @@ const SfxItemSet& ImpEditEngine::GetEmptyItemSet() if ( !pEmptyItemSet ) { pEmptyItemSet = new SfxItemSet( aEditDoc.GetItemPool(), EE_ITEMS_START, EE_ITEMS_END ); - for ( USHORT nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++) + for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++) { pEmptyItemSet->ClearItem( nWhich ); } @@ -806,14 +787,14 @@ const SfxItemSet& ImpEditEngine::GetEmptyItemSet() // ---------------------------------------------------------------------- void ImpEditEngine::CursorMoved( ContentNode* pPrevNode ) { - // Leere Attribute loeschen, aber nur, wenn Absatz nicht leer! + // Delete empty attributes, but only if paragraph is not empty! if ( pPrevNode->GetCharAttribs().HasEmptyAttribs() && pPrevNode->Len() ) pPrevNode->GetCharAttribs().DeleteEmptyAttribs( aEditDoc.GetItemPool() ); } void ImpEditEngine::TextModified() { - bFormatted = FALSE; + bFormatted = sal_False; if ( GetNotifyHdl().IsSet() ) { @@ -826,31 +807,31 @@ void ImpEditEngine::TextModified() void ImpEditEngine::ParaAttribsChanged( ContentNode* pNode ) { - DBG_ASSERT( pNode, "ParaAttribsChanged: Welcher?" ); + OSL_ENSURE( pNode, "ParaAttribsChanged: Which one?" ); - aEditDoc.SetModified( TRUE ); - bFormatted = FALSE; + aEditDoc.SetModified( sal_True ); + bFormatted = sal_False; ParaPortion* pPortion = FindParaPortion( pNode ); - DBG_ASSERT( pPortion, "ParaAttribsChanged: Portion?" ); + OSL_ENSURE( pPortion, "ParaAttribsChanged: Portion?" ); pPortion->MarkSelectionInvalid( 0, pNode->Len() ); - USHORT nPara = aEditDoc.GetPos( pNode ); + sal_uInt16 nPara = aEditDoc.GetPos( pNode ); pEditEngine->ParaAttribsChanged( nPara ); ParaPortion* pNextPortion = GetParaPortions().SaveGetObject( nPara+1 ); - // => wird sowieso noch formatiert, wenn Invalid. + // => is formatted again anyway, if Invalid. if ( pNextPortion && !pNextPortion->IsInvalid() ) CalcHeight( pNextPortion ); } // ---------------------------------------------------------------------- -// Cursorbewegungen +// Cursor movements // ---------------------------------------------------------------------- EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pEditView ) { - // Eigentlich nur bei Up/Down noetig, aber was solls. + // Actually, only necessary for up/down, but whatever. CheckIdleFormatter(); EditPaM aPaM( pEditView->pImpEditView->GetEditSelection().Max() ); @@ -865,8 +846,8 @@ EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pE KeyEvent aTranslatedKeyEvent = rKeyEvent.LogicalTextDirectionality( eTextDirection ); - BOOL bCtrl = aTranslatedKeyEvent.GetKeyCode().IsMod1() ? TRUE : FALSE; - USHORT nCode = aTranslatedKeyEvent.GetKeyCode().GetCode(); + sal_Bool bCtrl = aTranslatedKeyEvent.GetKeyCode().IsMod1() ? sal_True : sal_False; + sal_uInt16 nCode = aTranslatedKeyEvent.GetKeyCode().GetCode(); if ( DoVisualCursorTraveling( aPaM.GetNode() ) ) { @@ -876,13 +857,6 @@ EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pE aPaM = CursorVisualLeftRight( pEditView, aPaM, rKeyEvent.GetKeyCode().IsMod2() ? i18n::CharacterIteratorMode::SKIPCHARACTER : i18n::CharacterIteratorMode::SKIPCELL, rKeyEvent.GetKeyCode().GetCode() == KEY_LEFT ); nCode = 0; // skip switch statement } - /* - else if ( !bCtrl && ( ( nCode == KEY_HOME ) || ( nCode == KEY_END ) ) ) - { - aPaM = CursorVisualStartEnd( pEditView, aPaM, nCode == KEY_HOME ); - nCode = 0; // skip switch statement - } - */ } bool bKeyModifySelection = aTranslatedKeyEvent.GetKeyCode().IsShift(); @@ -1010,14 +984,14 @@ EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pE else aStatus.GetStatusWord() = aStatus.GetStatusWord() | EE_STAT_CRSRMOVEFAIL; - // Bewirkt evtl. ein CreateAnchor oder Deselection all + // May cause, an CreateAnchor or deselection all aSelEngine.SetCurView( pEditView ); aSelEngine.CursorPosChanging( bKeyModifySelection, aTranslatedKeyEvent.GetKeyCode().IsMod1() ); EditPaM aOldEnd( pEditView->pImpEditView->GetEditSelection().Max() ); pEditView->pImpEditView->GetEditSelection().Max() = aPaM; if ( bKeyModifySelection ) { - // Dann wird die Selektion erweitert... + // Then the selection is expanded ... EditSelection aTmpNewSel( aOldEnd, aPaM ); pEditView->pImpEditView->DrawSelection( aTmpNewSel ); } @@ -1027,23 +1001,22 @@ EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pE return pEditView->pImpEditView->GetEditSelection(); } -EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& rPaM, BOOL bStart ) +EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& rPaM, sal_Bool bStart ) { EditPaM aPaM( rPaM ); - USHORT nPara = GetEditDoc().GetPos( aPaM.GetNode() ); + sal_uInt16 nPara = GetEditDoc().GetPos( aPaM.GetNode() ); ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - USHORT nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_False ); + sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_False ); EditLine* pLine = pParaPortion->GetLines().GetObject( nLine ); - BOOL bEmptyLine = pLine->GetStart() == pLine->GetEnd(); + sal_Bool bEmptyLine = pLine->GetStart() == pLine->GetEnd(); pEditView->pImpEditView->nExtraCursorFlags = 0; if ( !bEmptyLine ) { String aLine( *aPaM.GetNode(), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart() ); -// USHORT nPosInLine = aPaM.GetIndex() - pLine->GetStart(); const sal_Unicode* pLineString = aLine.GetBuffer(); @@ -1053,19 +1026,18 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& const UBiDiLevel nBidiLevel = IsRightToLeft( nPara ) ? 1 /*RTL*/ : 0 /*LTR*/; ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(pLineString), aLine.Len(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW - USHORT nVisPos = bStart ? 0 : aLine.Len()-1; - USHORT nLogPos = (USHORT)ubidi_getLogicalIndex( pBidi, nVisPos, &nError ); + sal_uInt16 nVisPos = bStart ? 0 : aLine.Len()-1; + sal_uInt16 nLogPos = (sal_uInt16)ubidi_getLogicalIndex( pBidi, nVisPos, &nError ); ubidi_close( pBidi ); aPaM.GetIndex() = nLogPos + pLine->GetStart(); - USHORT nTmp; - USHORT nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTmp, TRUE ); + sal_uInt16 nTmp; + sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTmp, sal_True ); TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion ); - USHORT nRTLLevel = pTextPortion->GetRightToLeft(); -// BOOL bParaRTL = IsRightToLeft( nPara ); - BOOL bPortionRTL = nRTLLevel%2 ? TRUE : FALSE; + sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft(); + sal_Bool bPortionRTL = nRTLLevel%2 ? sal_True : sal_False; if ( bStart ) { @@ -1085,23 +1057,22 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& return aPaM; } -EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM& rPaM, USHORT nCharacterIteratorMode, BOOL bVisualToLeft ) +EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode, sal_Bool bVisualToLeft ) { EditPaM aPaM( rPaM ); - USHORT nPara = GetEditDoc().GetPos( aPaM.GetNode() ); + sal_uInt16 nPara = GetEditDoc().GetPos( aPaM.GetNode() ); ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - USHORT nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_False ); + sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_False ); EditLine* pLine = pParaPortion->GetLines().GetObject( nLine ); - BOOL bEmptyLine = pLine->GetStart() == pLine->GetEnd(); + sal_Bool bEmptyLine = pLine->GetStart() == pLine->GetEnd(); -// USHORT nCurrentCursorFlags = pEditView->pImpEditView->nExtraCursorFlags; pEditView->pImpEditView->nExtraCursorFlags = 0; - BOOL bParaRTL = IsRightToLeft( nPara ); + sal_Bool bParaRTL = IsRightToLeft( nPara ); - BOOL bDone = FALSE; + sal_Bool bDone = sal_False; if ( bEmptyLine ) { @@ -1109,36 +1080,36 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM { aPaM = CursorUp( aPaM, pEditView ); if ( aPaM != rPaM ) - aPaM = CursorVisualStartEnd( pEditView, aPaM, FALSE ); + aPaM = CursorVisualStartEnd( pEditView, aPaM, sal_False ); } else { aPaM = CursorDown( aPaM, pEditView ); if ( aPaM != rPaM ) - aPaM = CursorVisualStartEnd( pEditView, aPaM, TRUE ); + aPaM = CursorVisualStartEnd( pEditView, aPaM, sal_True ); } - bDone = TRUE; + bDone = sal_True; } - BOOL bLogicalBackward = bParaRTL ? !bVisualToLeft : bVisualToLeft; + sal_Bool bLogicalBackward = bParaRTL ? !bVisualToLeft : bVisualToLeft; if ( !bDone && pEditView->IsInsertMode() ) { // Check if we are within a portion and don't have overwrite mode, then it's easy... - USHORT nPortionStart; - USHORT nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, FALSE ); + sal_uInt16 nPortionStart; + sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, sal_False ); TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion ); - BOOL bPortionBoundary = ( aPaM.GetIndex() == nPortionStart ) || ( aPaM.GetIndex() == (nPortionStart+pTextPortion->GetLen()) ); - USHORT nRTLLevel = pTextPortion->GetRightToLeft(); + sal_Bool bPortionBoundary = ( aPaM.GetIndex() == nPortionStart ) || ( aPaM.GetIndex() == (nPortionStart+pTextPortion->GetLen()) ); + sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft(); // Portion boundary doesn't matter if both have same RTL level - USHORT nRTLLevelNextPortion = 0xFFFF; + sal_uInt16 nRTLLevelNextPortion = 0xFFFF; if ( bPortionBoundary && aPaM.GetIndex() && ( aPaM.GetIndex() < aPaM.GetNode()->Len() ) ) { - USHORT nTmp; - USHORT nNextTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex()+1, nTmp, bLogicalBackward ? FALSE : TRUE ); + sal_uInt16 nTmp; + sal_uInt16 nNextTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex()+1, nTmp, bLogicalBackward ? sal_False : sal_True ); TextPortion* pNextTextPortion = pParaPortion->GetTextPortions().GetObject( nNextTextPortion ); nRTLLevelNextPortion = pNextTextPortion->GetRightToLeft(); } @@ -1155,17 +1126,17 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM aPaM = CursorRight( aPaM, nCharacterIteratorMode ); pEditView->pImpEditView->SetCursorBidiLevel( 0 ); } - bDone = TRUE; + bDone = sal_True; } } if ( !bDone ) { - BOOL bGotoStartOfNextLine = FALSE; - BOOL bGotoEndOfPrevLine = FALSE; + sal_Bool bGotoStartOfNextLine = sal_False; + sal_Bool bGotoEndOfPrevLine = sal_False; String aLine( *aPaM.GetNode(), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart() ); - USHORT nPosInLine = aPaM.GetIndex() - pLine->GetStart(); + sal_uInt16 nPosInLine = aPaM.GetIndex() - pLine->GetStart(); const sal_Unicode* pLineString = aLine.GetBuffer(); @@ -1177,8 +1148,8 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM if ( !pEditView->IsInsertMode() ) { - BOOL bEndOfLine = nPosInLine == aLine.Len(); - USHORT nVisPos = (USHORT)ubidi_getVisualIndex( pBidi, !bEndOfLine ? nPosInLine : nPosInLine-1, &nError ); + sal_Bool bEndOfLine = nPosInLine == aLine.Len(); + sal_uInt16 nVisPos = (sal_uInt16)ubidi_getVisualIndex( pBidi, !bEndOfLine ? nPosInLine : nPosInLine-1, &nError ); if ( bVisualToLeft ) { bGotoEndOfPrevLine = nVisPos == 0; @@ -1194,22 +1165,22 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM if ( !bGotoEndOfPrevLine && !bGotoStartOfNextLine ) { - USHORT nLogPos = (USHORT)ubidi_getLogicalIndex( pBidi, nVisPos, &nError ); + sal_uInt16 nLogPos = (sal_uInt16)ubidi_getLogicalIndex( pBidi, nVisPos, &nError ); aPaM.GetIndex() = pLine->GetStart() + nLogPos; pEditView->pImpEditView->SetCursorBidiLevel( 0 ); } } else { - BOOL bWasBehind = FALSE; - BOOL bBeforePortion = !nPosInLine || pEditView->pImpEditView->GetCursorBidiLevel() == 1; + sal_Bool bWasBehind = sal_False; + sal_Bool bBeforePortion = !nPosInLine || pEditView->pImpEditView->GetCursorBidiLevel() == 1; if ( nPosInLine && ( !bBeforePortion ) ) // before the next portion - bWasBehind = TRUE; // step one back, otherwise visual will be unusable when rtl portion follows. + bWasBehind = sal_True; // step one back, otherwise visual will be unusable when rtl portion follows. - USHORT nPortionStart; - USHORT nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, bBeforePortion ); + sal_uInt16 nPortionStart; + sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, bBeforePortion ); TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion ); - BOOL bRTLPortion = (pTextPortion->GetRightToLeft() % 2) != 0; + sal_Bool bRTLPortion = (pTextPortion->GetRightToLeft() % 2) != 0; // -1: We are 'behind' the character long nVisPos = (long)ubidi_getVisualIndex( pBidi, bWasBehind ? nPosInLine-1 : nPosInLine, &nError ); @@ -1222,8 +1193,6 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM { if ( bWasBehind || bRTLPortion || bBeforePortion ) nVisPos++; -// if ( bWasBehind && bRTLPortion ) -// nVisPos++; } bGotoEndOfPrevLine = nVisPos < 0; @@ -1231,33 +1200,21 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM if ( !bGotoEndOfPrevLine && !bGotoStartOfNextLine ) { - USHORT nLogPos = (USHORT)ubidi_getLogicalIndex( pBidi, nVisPos, &nError ); + sal_uInt16 nLogPos = (sal_uInt16)ubidi_getLogicalIndex( pBidi, nVisPos, &nError ); -/* - if ( nLogPos == aPaM.GetIndex() ) - { - if ( bVisualToLeft ) - bGotoEndOfPrevLine = TRUE; - else - bGotoStartOfNextLine = TRUE; - } - else -*/ - { - aPaM.GetIndex() = pLine->GetStart() + nLogPos; - - // RTL portion, stay visually on the left side. - USHORT _nPortionStart; - // USHORT nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, !bRTLPortion ); - USHORT _nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), _nPortionStart, TRUE ); - TextPortion* _pTextPortion = pParaPortion->GetTextPortions().GetObject( _nTextPortion ); - if ( bVisualToLeft && !bRTLPortion && ( _pTextPortion->GetRightToLeft() % 2 ) ) - aPaM.GetIndex()++; - else if ( !bVisualToLeft && bRTLPortion && ( bWasBehind || !(_pTextPortion->GetRightToLeft() % 2 )) ) - aPaM.GetIndex()++; - - pEditView->pImpEditView->SetCursorBidiLevel( _nPortionStart ); - } + aPaM.GetIndex() = pLine->GetStart() + nLogPos; + + // RTL portion, stay visually on the left side. + sal_uInt16 _nPortionStart; + // sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, !bRTLPortion ); + sal_uInt16 _nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), _nPortionStart, sal_True ); + TextPortion* _pTextPortion = pParaPortion->GetTextPortions().GetObject( _nTextPortion ); + if ( bVisualToLeft && !bRTLPortion && ( _pTextPortion->GetRightToLeft() % 2 ) ) + aPaM.GetIndex()++; + else if ( !bVisualToLeft && bRTLPortion && ( bWasBehind || !(_pTextPortion->GetRightToLeft() % 2 )) ) + aPaM.GetIndex()++; + + pEditView->pImpEditView->SetCursorBidiLevel( _nPortionStart ); } } @@ -1267,20 +1224,20 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM { aPaM = CursorUp( aPaM, pEditView ); if ( aPaM != rPaM ) - aPaM = CursorVisualStartEnd( pEditView, aPaM, FALSE ); + aPaM = CursorVisualStartEnd( pEditView, aPaM, sal_False ); } else if ( bGotoStartOfNextLine ) { aPaM = CursorDown( aPaM, pEditView ); if ( aPaM != rPaM ) - aPaM = CursorVisualStartEnd( pEditView, aPaM, TRUE ); + aPaM = CursorVisualStartEnd( pEditView, aPaM, sal_True ); } } return aPaM; } -EditPaM ImpEditEngine::CursorLeft( const EditPaM& rPaM, USHORT nCharacterIteratorMode ) +EditPaM ImpEditEngine::CursorLeft( const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode ) { EditPaM aCurPaM( rPaM ); EditPaM aNewPaM( aCurPaM ); @@ -1289,7 +1246,7 @@ EditPaM ImpEditEngine::CursorLeft( const EditPaM& rPaM, USHORT nCharacterIterato { sal_Int32 nCount = 1; uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() ); - aNewPaM.SetIndex( (USHORT)_xBI->previousCharacters( *aNewPaM.GetNode(), aNewPaM.GetIndex(), GetLocale( aNewPaM ), nCharacterIteratorMode, nCount, nCount ) ); + aNewPaM.SetIndex( (sal_uInt16)_xBI->previousCharacters( *aNewPaM.GetNode(), aNewPaM.GetIndex(), GetLocale( aNewPaM ), nCharacterIteratorMode, nCount, nCount ) ); } else { @@ -1305,7 +1262,7 @@ EditPaM ImpEditEngine::CursorLeft( const EditPaM& rPaM, USHORT nCharacterIterato return aNewPaM; } -EditPaM ImpEditEngine::CursorRight( const EditPaM& rPaM, USHORT nCharacterIteratorMode ) +EditPaM ImpEditEngine::CursorRight( const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode ) { EditPaM aCurPaM( rPaM ); EditPaM aNewPaM( aCurPaM ); @@ -1314,7 +1271,7 @@ EditPaM ImpEditEngine::CursorRight( const EditPaM& rPaM, USHORT nCharacterIterat { uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() ); sal_Int32 nCount = 1; - aNewPaM.SetIndex( (USHORT)_xBI->nextCharacters( *aNewPaM.GetNode(), aNewPaM.GetIndex(), GetLocale( aNewPaM ), nCharacterIteratorMode, nCount, nCount ) ); + aNewPaM.SetIndex( (sal_uInt16)_xBI->nextCharacters( *aNewPaM.GetNode(), aNewPaM.GetIndex(), GetLocale( aNewPaM ), nCharacterIteratorMode, nCount, nCount ) ); } else { @@ -1332,11 +1289,11 @@ EditPaM ImpEditEngine::CursorRight( const EditPaM& rPaM, USHORT nCharacterIterat EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView ) { - DBG_ASSERT( pView, "Keine View - Keine Cursorbewegung!" ); + OSL_ENSURE( pView, "No View - No Cursor Movement!" ); ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() ); - DBG_ASSERT( pPPortion, "Keine passende Portion gefunden: CursorUp" ); - USHORT nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); + OSL_ENSURE( pPPortion, "No matching portion found: CursorUp "); + sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); EditLine* pLine = pPPortion->GetLines().GetObject( nLine ); long nX; @@ -1349,23 +1306,24 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView ) nX = pView->pImpEditView->nTravelXPos; EditPaM aNewPaM( rPaM ); - if ( nLine ) // gleicher Absatz + if ( nLine ) // same paragraph { EditLine* pPrevLine = pPPortion->GetLines().GetObject(nLine-1); aNewPaM.SetIndex( GetChar( pPPortion, pPrevLine, nX ) ); - // Wenn davor eine autom.Umgebrochene Zeile, und ich muss genau an das - // Ende dieser Zeile, landet der Cursor in der aktuellen Zeile am Anfang - // Siehe Problem: Letztes Zeichen einer autom.umgebr. Zeile = Cursor + // If a previous automatically wrapped line, and one has to be exactly + // at the end of this line, the cursor lands on the current line at the + // beginning. See Problem: Last character of an automatically wrapped + // Row = cursor if ( aNewPaM.GetIndex() && ( aNewPaM.GetIndex() == pLine->GetStart() ) ) aNewPaM = CursorLeft( aNewPaM ); } - else // vorheriger Absatz + else // previous paragraph { ParaPortion* pPrevPortion = GetPrevVisPortion( pPPortion ); if ( pPrevPortion ) { pLine = pPrevPortion->GetLines().GetObject( pPrevPortion->GetLines().Count()-1 ); - DBG_ASSERT( pLine, "Zeile davor nicht gefunden: CursorUp" ); + OSL_ENSURE( pLine, "Line in front not found: CursorUp" ); aNewPaM.SetNode( pPrevPortion->GetNode() ); aNewPaM.SetIndex( GetChar( pPrevPortion, pLine, nX+nOnePixelInRef ) ); } @@ -1376,11 +1334,11 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView ) EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView ) { - DBG_ASSERT( pView, "Keine View - Keine Cursorbewegung!" ); + OSL_ENSURE( pView, "No View - No Cursor Movement!" ); ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() ); - DBG_ASSERT( pPPortion, "Keine passende Portion gefunden: CursorDown" ); - USHORT nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); + OSL_ENSURE( pPPortion, "No matching portion found: CursorDown" ); + sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); long nX; if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW ) @@ -1397,20 +1355,20 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView ) { EditLine* pNextLine = pPPortion->GetLines().GetObject(nLine+1); aNewPaM.SetIndex( GetChar( pPPortion, pNextLine, nX ) ); - // Sonderbehandlung siehe CursorUp... + // Special treatment, see CursorUp ... if ( ( aNewPaM.GetIndex() == pNextLine->GetEnd() ) && ( aNewPaM.GetIndex() > pNextLine->GetStart() ) && ( aNewPaM.GetIndex() < pPPortion->GetNode()->Len() ) ) aNewPaM = CursorLeft( aNewPaM ); } - else // naechster Absatz + else // next paragraph { ParaPortion* pNextPortion = GetNextVisPortion( pPPortion ); if ( pNextPortion ) { EditLine* pLine = pNextPortion->GetLines().GetObject(0); - DBG_ASSERT( pLine, "Zeile davor nicht gefunden: CursorUp" ); + OSL_ENSURE( pLine, "Line in front not found: CursorUp" ); aNewPaM.SetNode( pNextPortion->GetNode() ); - // Nie ganz ans Ende wenn mehrere Zeilen, da dann eine - // Zeile darunter der Cursor angezeigt wird. + // Never at the very end when several lines, because then a line + // below the cursor appears. aNewPaM.SetIndex( GetChar( pNextPortion, pLine, nX+nOnePixelInRef ) ); if ( ( aNewPaM.GetIndex() == pLine->GetEnd() ) && ( aNewPaM.GetIndex() > pLine->GetStart() ) && ( pNextPortion->GetLines().Count() > 1 ) ) aNewPaM = CursorLeft( aNewPaM ); @@ -1423,10 +1381,10 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView ) EditPaM ImpEditEngine::CursorStartOfLine( const EditPaM& rPaM ) { ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() ); - DBG_ASSERT( pCurPortion, "Keine Portion fuer den PaM ?" ); - USHORT nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); + OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" ); + sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); EditLine* pLine = pCurPortion->GetLines().GetObject(nLine); - DBG_ASSERT( pLine, "Aktuelle Zeile nicht gefunden ?!" ); + OSL_ENSURE( pLine, "Current line not found ?!" ); EditPaM aNewPaM( rPaM ); aNewPaM.SetIndex( pLine->GetStart() ); @@ -1436,28 +1394,27 @@ EditPaM ImpEditEngine::CursorStartOfLine( const EditPaM& rPaM ) EditPaM ImpEditEngine::CursorEndOfLine( const EditPaM& rPaM ) { ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() ); - DBG_ASSERT( pCurPortion, "Keine Portion fuer den PaM ?" ); - USHORT nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); + OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" ); + sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); EditLine* pLine = pCurPortion->GetLines().GetObject(nLine); - DBG_ASSERT( pLine, "Aktuelle Zeile nicht gefunden ?!" ); + OSL_ENSURE( pLine, "Current line not found ?!" ); EditPaM aNewPaM( rPaM ); aNewPaM.SetIndex( pLine->GetEnd() ); if ( pLine->GetEnd() > pLine->GetStart() ) { -// xub_Unicode cLastChar = aNewPaM.GetNode()->GetChar( aNewPaM.GetIndex()-1 ); if ( aNewPaM.GetNode()->IsFeature( aNewPaM.GetIndex() - 1 ) ) { - // Bei einem weichen Umbruch muss ich davor stehen! + // When a soft break, be in front of it! EditCharAttrib* pNextFeature = aNewPaM.GetNode()->GetCharAttribs().FindFeature( aNewPaM.GetIndex()-1 ); if ( pNextFeature && ( pNextFeature->GetItem()->Which() == EE_FEATURE_LINEBR ) ) aNewPaM = CursorLeft( aNewPaM ); } else if ( ( aNewPaM.GetNode()->GetChar( aNewPaM.GetIndex() - 1 ) == ' ' ) && ( aNewPaM.GetIndex() != aNewPaM.GetNode()->Len() ) ) { - // Bei einem Blank in einer autom. umgebrochenen Zeile macht es Sinn, - // davor zu stehen, da der Anwender hinter das Wort will. - // Wenn diese geaendert wird, Sonderbehandlung fuer Pos1 nach End! + // For a Blank in an auto wrapped line, it makes sense, to stand + // in front of it, since the user wants to be after the word. + // If this is changed, special treatment for Pos1 to End! aNewPaM = CursorLeft( aNewPaM ); } } @@ -1486,12 +1443,12 @@ EditPaM ImpEditEngine::CursorEndOfDoc() { ContentNode* pLastNode = aEditDoc.SaveGetObject( aEditDoc.Count()-1 ); ParaPortion* pLastPortion = GetParaPortions().SaveGetObject( aEditDoc.Count()-1 ); - DBG_ASSERT( pLastNode && pLastPortion, "CursorEndOfDoc: Node oder Portion nicht gefunden" ); + OSL_ENSURE( pLastNode && pLastPortion, "CursorEndOfDoc: Node or Portion not found" ); if ( !pLastPortion->IsVisible() ) { pLastNode = GetPrevVisNode( pLastPortion->GetNode() ); - DBG_ASSERT( pLastNode, "Kein sichtbarer Absatz?" ); + OSL_ENSURE( pLastNode, "Kein sichtbarer Absatz?" ); if ( !pLastNode ) pLastNode = aEditDoc.SaveGetObject( aEditDoc.Count()-1 ); } @@ -1529,12 +1486,12 @@ EditPaM ImpEditEngine::PageDown( const EditPaM& rPaM, EditView* pView ) EditPaM ImpEditEngine::WordLeft( const EditPaM& rPaM, sal_Int16 nWordType ) { - USHORT nCurrentPos = rPaM.GetIndex(); + sal_uInt16 nCurrentPos = rPaM.GetIndex(); EditPaM aNewPaM( rPaM ); if ( nCurrentPos == 0 ) { - // Vorheriger Absatz... - USHORT nCurPara = aEditDoc.GetPos( aNewPaM.GetNode() ); + // Previous paragraph... + sal_uInt16 nCurPara = aEditDoc.GetPos( aNewPaM.GetNode() ); ContentNode* pPrevNode = aEditDoc.SaveGetObject( --nCurPara ); if ( pPrevNode ) { @@ -1556,7 +1513,7 @@ EditPaM ImpEditEngine::WordLeft( const EditPaM& rPaM, sal_Int16 nWordType ) i18n::Boundary aBoundary = _xBI->getWordBoundary( *aNewPaM.GetNode(), nCurrentPos, aLocale, nWordType, sal_True ); if ( aBoundary.startPos >= nCurrentPos ) aBoundary = _xBI->previousWord( *aNewPaM.GetNode(), nCurrentPos, aLocale, nWordType ); - aNewPaM.SetIndex( ( aBoundary.startPos != (-1) ) ? (USHORT)aBoundary.startPos : 0 ); + aNewPaM.SetIndex( ( aBoundary.startPos != (-1) ) ? (sal_uInt16)aBoundary.startPos : 0 ); } return aNewPaM; @@ -1576,13 +1533,13 @@ EditPaM ImpEditEngine::WordRight( const EditPaM& rPaM, sal_Int16 nWordType ) uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() ); i18n::Boundary aBoundary = _xBI->nextWord( *aNewPaM.GetNode(), aNewPaM.GetIndex(), aLocale, nWordType ); - aNewPaM.SetIndex( (USHORT)aBoundary.startPos ); + aNewPaM.SetIndex( (sal_uInt16)aBoundary.startPos ); } // not 'else', maybe the index reached nMax now... if ( aNewPaM.GetIndex() >= nMax ) { - // Naechster Absatz... - USHORT nCurPara = aEditDoc.GetPos( aNewPaM.GetNode() ); + // Next paragraph ... + sal_uInt16 nCurPara = aEditDoc.GetPos( aNewPaM.GetNode() ); ContentNode* pNextNode = aEditDoc.SaveGetObject( ++nCurPara ); if ( pNextNode ) { @@ -1607,7 +1564,7 @@ EditPaM ImpEditEngine::StartOfWord( const EditPaM& rPaM, sal_Int16 nWordType ) uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() ); i18n::Boundary aBoundary = _xBI->getWordBoundary( *rPaM.GetNode(), rPaM.GetIndex(), aLocale, nWordType, sal_True ); - aNewPaM.SetIndex( (USHORT)aBoundary.startPos ); + aNewPaM.SetIndex( (sal_uInt16)aBoundary.startPos ); return aNewPaM; } @@ -1625,11 +1582,11 @@ EditPaM ImpEditEngine::EndOfWord( const EditPaM& rPaM, sal_Int16 nWordType ) uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() ); i18n::Boundary aBoundary = _xBI->getWordBoundary( *rPaM.GetNode(), rPaM.GetIndex(), aLocale, nWordType, sal_True ); - aNewPaM.SetIndex( (USHORT)aBoundary.endPos ); + aNewPaM.SetIndex( (sal_uInt16)aBoundary.endPos ); return aNewPaM; } -EditSelection ImpEditEngine::SelectWord( const EditSelection& rCurSel, sal_Int16 nWordType, BOOL bAcceptStartOfWord ) +EditSelection ImpEditEngine::SelectWord( const EditSelection& rCurSel, sal_Int16 nWordType, sal_Bool bAcceptStartOfWord ) { EditSelection aNewSel( rCurSel ); EditPaM aPaM( rCurSel.Max() ); @@ -1651,8 +1608,8 @@ EditSelection ImpEditEngine::SelectWord( const EditSelection& rCurSel, sal_Int16 if ( ( aBoundary.endPos > aPaM.GetIndex() ) && ( ( aBoundary.startPos < aPaM.GetIndex() ) || ( bAcceptStartOfWord && ( aBoundary.startPos == aPaM.GetIndex() ) ) ) ) { - aNewSel.Min().SetIndex( (USHORT)aBoundary.startPos ); - aNewSel.Max().SetIndex( (USHORT)aBoundary.endPos ); + aNewSel.Min().SetIndex( (sal_uInt16)aBoundary.startPos ); + aNewSel.Max().SetIndex( (sal_uInt16)aBoundary.endPos ); } } @@ -1672,9 +1629,9 @@ EditSelection ImpEditEngine::SelectSentence( const EditSelection& rCurSel ) long nEnd = _xBI->endOfSentence( *pNode, rPaM.GetIndex(), GetLocale( rPaM ) ); EditSelection aNewSel( rCurSel ); - DBG_ASSERT(nStart < pNode->Len() && nEnd <= pNode->Len(), "sentence indices out of range"); - aNewSel.Min().SetIndex( (USHORT)nStart ); - aNewSel.Max().SetIndex( (USHORT)nEnd ); + OSL_ENSURE(nStart < pNode->Len() && nEnd <= pNode->Len(), "sentence indices out of range"); + aNewSel.Min().SetIndex( (sal_uInt16)nStart ); + aNewSel.Max().SetIndex( (sal_uInt16)nEnd ); return aNewSel; } @@ -1685,8 +1642,8 @@ sal_Bool ImpEditEngine::IsInputSequenceCheckingRequired( sal_Unicode nChar, cons pCTLOptions = new SvtCTLOptions; // get the index that really is first - USHORT nFirstPos = rCurSel.Min().GetIndex(); - USHORT nMaxPos = rCurSel.Max().GetIndex(); + sal_uInt16 nFirstPos = rCurSel.Min().GetIndex(); + sal_uInt16 nMaxPos = rCurSel.Max().GetIndex(); if (nMaxPos < nFirstPos) nFirstPos = nMaxPos; @@ -1699,9 +1656,6 @@ sal_Bool ImpEditEngine::IsInputSequenceCheckingRequired( sal_Unicode nChar, cons return bIsSequenceChecking; } -/************************************************************************* - * lcl_HasStrongLTR - *************************************************************************/ bool lcl_HasStrongLTR ( const String& rTxt, xub_StrLen nStart, xub_StrLen nEnd ) { for ( xub_StrLen nCharIdx = nStart; nCharIdx < nEnd; ++nCharIdx ) @@ -1717,13 +1671,11 @@ sal_Bool ImpEditEngine::IsInputSequenceCheckingRequired( sal_Unicode nChar, cons -void ImpEditEngine::InitScriptTypes( USHORT nPara ) +void ImpEditEngine::InitScriptTypes( sal_uInt16 nPara ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - rTypes.Remove( 0, rTypes.Count() ); - -// pParaPortion->aExtraCharInfos.Remove( 0, pParaPortion->aExtraCharInfos.Count() ); + rTypes.clear(); ContentNode* pNode = pParaPortion->GetNode(); if ( pNode->Len() ) @@ -1743,7 +1695,7 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) aText.SetChar( pField->GetStart(), aFldText.getStr()[0] ); short nFldScriptType = _xBI->getScriptType( aFldText, 0 ); - for ( USHORT nCharInField = 1; nCharInField < aFldText.getLength(); nCharInField++ ) + for ( sal_uInt16 nCharInField = 1; nCharInField < aFldText.getLength(); nCharInField++ ) { short nTmpType = _xBI->getScriptType( aFldText, nCharInField ); @@ -1768,23 +1720,23 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) } ::rtl::OUString aOUText( aText ); - USHORT nTextLen = (USHORT)aOUText.getLength(); + sal_uInt16 nTextLen = (sal_uInt16)aOUText.getLength(); sal_Int32 nPos = 0; short nScriptType = _xBI->getScriptType( aOUText, nPos ); - rTypes.Insert( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ), rTypes.Count() ); + rTypes.push_back( ScriptTypePosInfo( nScriptType, (sal_uInt16)nPos, nTextLen ) ); nPos = _xBI->endOfScript( aOUText, nPos, nScriptType ); while ( ( nPos != (-1) ) && ( nPos < nTextLen ) ) { - rTypes[rTypes.Count()-1].nEndPos = (USHORT)nPos; + rTypes.back().nEndPos = (sal_uInt16)nPos; nScriptType = _xBI->getScriptType( aOUText, nPos ); long nEndPos = _xBI->endOfScript( aOUText, nPos, nScriptType ); - if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == rTypes[rTypes.Count()-1].nScriptType ) ) + if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == rTypes.back().nScriptType ) ) { // Expand last ScriptTypePosInfo, don't create weak or unecessary portions - rTypes[rTypes.Count()-1].nEndPos = (USHORT)nEndPos; + rTypes.back().nEndPos = (sal_uInt16)nEndPos; } else { @@ -1795,93 +1747,81 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) case U_ENCLOSING_MARK: case U_COMBINING_SPACING_MARK: --nPos; - rTypes[rTypes.Count()-1].nEndPos--; + rTypes.back().nEndPos--; break; } } - rTypes.Insert( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ), rTypes.Count() ); + rTypes.push_back( ScriptTypePosInfo( nScriptType, (sal_uInt16)nPos, nTextLen ) ); } nPos = nEndPos; } if ( rTypes[0].nScriptType == i18n::ScriptType::WEAK ) - rTypes[0].nScriptType = ( rTypes.Count() > 1 ) ? rTypes[1].nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() ); + rTypes[0].nScriptType = ( rTypes.size() > 1 ) ? rTypes[1].nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() ); // create writing direction information: - if ( !pParaPortion->aWritingDirectionInfos.Count() ) + if ( pParaPortion->aWritingDirectionInfos.empty() ) InitWritingDirections( nPara ); // i89825: Use CTL font for numbers embedded into an RTL run: WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos; - for ( USHORT n = 0; n < rDirInfos.Count(); ++n ) + for ( size_t n = 0; n < rDirInfos.size(); ++n ) { const xub_StrLen nStart = rDirInfos[n].nStartPos; const xub_StrLen nEnd = rDirInfos[n].nEndPos; - const BYTE nCurrDirType = rDirInfos[n].nType; + const sal_uInt8 nCurrDirType = rDirInfos[n].nType; if ( nCurrDirType % 2 == UBIDI_RTL || // text in RTL run ( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( aText, nStart, nEnd ) ) ) // non-strong text in embedded LTR run { - USHORT nIdx = 0; + size_t nIdx = 0; // Skip entries in ScriptArray which are not inside the RTL run: - while ( nIdx < rTypes.Count() && rTypes[nIdx].nStartPos < nStart ) + while ( nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart ) ++nIdx; // Remove any entries *inside* the current run: - while ( nIdx < rTypes.Count() && rTypes[nIdx].nEndPos <= nEnd ) - rTypes.Remove( nIdx ); + while ( nIdx < rTypes.size() && rTypes[nIdx].nEndPos <= nEnd ) + rTypes.erase( rTypes.begin()+nIdx ); // special case: - if(nIdx < rTypes.Count() && rTypes[nIdx].nStartPos < nStart && rTypes[nIdx].nEndPos > nEnd) + if(nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart && rTypes[nIdx].nEndPos > nEnd) { - rTypes.Insert( ScriptTypePosInfo( rTypes[nIdx].nScriptType, (USHORT)nEnd, rTypes[nIdx].nEndPos ), nIdx ); + rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( rTypes[nIdx].nScriptType, (sal_uInt16)nEnd, rTypes[nIdx].nEndPos ) ); rTypes[nIdx].nEndPos = nStart; } if( nIdx ) rTypes[nIdx - 1].nEndPos = nStart; - rTypes.Insert( ScriptTypePosInfo( i18n::ScriptType::COMPLEX, (USHORT)nStart, (USHORT)nEnd), nIdx ); + rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( i18n::ScriptType::COMPLEX, (sal_uInt16)nStart, (sal_uInt16)nEnd) ); ++nIdx; - if( nIdx < rTypes.Count() ) + if( nIdx < rTypes.size() ) rTypes[nIdx].nStartPos = nEnd; } } - -#if OSL_DEBUG_LEVEL > 1 - USHORT nDebugStt = 0; - USHORT nDebugEnd = 0; - short nDebugType = 0; - for ( USHORT n = 0; n < rTypes.Count(); ++n ) - { - nDebugStt = rTypes[n].nStartPos; - nDebugEnd = rTypes[n].nEndPos; - nDebugType = rTypes[n].nScriptType; - } -#endif } } -USHORT ImpEditEngine::GetScriptType( const EditPaM& rPaM, USHORT* pEndPos ) const +sal_uInt16 ImpEditEngine::GetScriptType( const EditPaM& rPaM, sal_uInt16* pEndPos ) const { - USHORT nScriptType = 0; + sal_uInt16 nScriptType = 0; if ( pEndPos ) *pEndPos = rPaM.GetNode()->Len(); if ( rPaM.GetNode()->Len() ) { - USHORT nPara = GetEditDoc().GetPos( rPaM.GetNode() ); + sal_uInt16 nPara = GetEditDoc().GetPos( rPaM.GetNode() ); ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - USHORT nPos = rPaM.GetIndex(); - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + sal_uInt16 nPos = rPaM.GetIndex(); + for ( size_t n = 0; n < rTypes.size(); n++ ) { if ( ( rTypes[n].nStartPos <= nPos ) && ( rTypes[n].nEndPos >= nPos ) ) { @@ -1895,20 +1835,20 @@ USHORT ImpEditEngine::GetScriptType( const EditPaM& rPaM, USHORT* pEndPos ) cons return nScriptType ? nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() ); } -USHORT ImpEditEngine::GetScriptType( const EditSelection& rSel ) const +sal_uInt16 ImpEditEngine::GetScriptType( const EditSelection& rSel ) const { EditSelection aSel( rSel ); aSel.Adjust( aEditDoc ); short nScriptType = 0; - USHORT nStartPara = GetEditDoc().GetPos( aSel.Min().GetNode() ); - USHORT nEndPara = GetEditDoc().GetPos( aSel.Max().GetNode() ); + sal_uInt16 nStartPara = GetEditDoc().GetPos( aSel.Min().GetNode() ); + sal_uInt16 nEndPara = GetEditDoc().GetPos( aSel.Max().GetNode() ); - for ( USHORT nPara = nStartPara; nPara <= nEndPara; nPara++ ) + for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; @@ -1916,9 +1856,9 @@ USHORT ImpEditEngine::GetScriptType( const EditSelection& rSel ) const // find the first(!) script type position that holds the // complete selection. Thus it will work for selections as // well as with just moving the cursor from char to char. - USHORT nS = ( nPara == nStartPara ) ? aSel.Min().GetIndex() : 0; - USHORT nE = ( nPara == nEndPara ) ? aSel.Max().GetIndex() : pParaPortion->GetNode()->Len(); - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + sal_uInt16 nS = ( nPara == nStartPara ) ? aSel.Min().GetIndex() : 0; + sal_uInt16 nE = ( nPara == nEndPara ) ? aSel.Max().GetIndex() : pParaPortion->GetNode()->Len(); + for ( size_t n = 0; n < rTypes.size(); n++ ) { if (rTypes[n].nStartPos <= nS && nE <= rTypes[n].nEndPos) { @@ -1941,24 +1881,24 @@ USHORT ImpEditEngine::GetScriptType( const EditSelection& rSel ) const return nScriptType ? nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() ); } -BOOL ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const +sal_Bool ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const { - BOOL bScriptChange = FALSE; + sal_Bool bScriptChange = sal_False; if ( rPaM.GetNode()->Len() ) { - USHORT nPara = GetEditDoc().GetPos( rPaM.GetNode() ); + sal_uInt16 nPara = GetEditDoc().GetPos( rPaM.GetNode() ); ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - USHORT nPos = rPaM.GetIndex(); - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + sal_uInt16 nPos = rPaM.GetIndex(); + for ( size_t n = 0; n < rTypes.size(); n++ ) { if ( rTypes[n].nStartPos == nPos ) { - bScriptChange = TRUE; + bScriptChange = sal_True; break; } } @@ -1966,36 +1906,36 @@ BOOL ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const return bScriptChange; } -BOOL ImpEditEngine::HasScriptType( USHORT nPara, USHORT nType ) const +sal_Bool ImpEditEngine::HasScriptType( sal_uInt16 nPara, sal_uInt16 nType ) const { - BOOL bTypeFound = FALSE; + sal_Bool bTypeFound = sal_False; ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - for ( USHORT n = rTypes.Count(); n && !bTypeFound; ) + for ( size_t n = rTypes.size(); n && !bTypeFound; ) { if ( rTypes[--n].nScriptType == nType ) - bTypeFound = TRUE; + bTypeFound = sal_True; } return bTypeFound; } -void ImpEditEngine::InitWritingDirections( USHORT nPara ) +void ImpEditEngine::InitWritingDirections( sal_uInt16 nPara ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); WritingDirectionInfos& rInfos = pParaPortion->aWritingDirectionInfos; - rInfos.Remove( 0, rInfos.Count() ); + rInfos.clear(); - BOOL bCTL = FALSE; + sal_Bool bCTL = sal_False; ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - for ( USHORT n = 0; n < rTypes.Count(); n++ ) + for ( size_t n = 0; n < rTypes.size(); n++ ) { if ( rTypes[n].nScriptType == i18n::ScriptType::COMPLEX ) { - bCTL = TRUE; + bCTL = sal_True; break; } } @@ -2016,16 +1956,16 @@ void ImpEditEngine::InitWritingDirections( USHORT nPara ) ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.GetBuffer()), aText.Len(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW nError = U_ZERO_ERROR; - long nCount = ubidi_countRuns( pBidi, &nError ); + size_t nCount = ubidi_countRuns( pBidi, &nError ); int32_t nStart = 0; int32_t nEnd; UBiDiLevel nCurrDir; - for ( USHORT nIdx = 0; nIdx < nCount; ++nIdx ) + for ( size_t nIdx = 0; nIdx < nCount; ++nIdx ) { ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir ); - rInfos.Insert( WritingDirectionInfo( nCurrDir, (USHORT)nStart, (USHORT)nEnd ), rInfos.Count() ); + rInfos.push_back( WritingDirectionInfo( nCurrDir, (sal_uInt16)nStart, (sal_uInt16)nEnd ) ); nStart = nEnd; } @@ -2033,14 +1973,14 @@ void ImpEditEngine::InitWritingDirections( USHORT nPara ) } // No infos mean no CTL and default dir is L2R... - if ( !rInfos.Count() ) - rInfos.Insert( WritingDirectionInfo( 0, 0, (USHORT)pParaPortion->GetNode()->Len() ), rInfos.Count() ); + if ( rInfos.empty() ) + rInfos.push_back( WritingDirectionInfo( 0, 0, (sal_uInt16)pParaPortion->GetNode()->Len() ) ); } -BOOL ImpEditEngine::IsRightToLeft( USHORT nPara ) const +sal_Bool ImpEditEngine::IsRightToLeft( sal_uInt16 nPara ) const { - BOOL bR2L = FALSE; + sal_Bool bR2L = sal_False; const SvxFrameDirectionItem* pFrameDirItem = NULL; if ( !IsVertical() ) @@ -2068,20 +2008,20 @@ BOOL ImpEditEngine::IsRightToLeft( USHORT nPara ) const return bR2L; } -BOOL ImpEditEngine::HasDifferentRTLLevels( const ContentNode* pNode ) +sal_Bool ImpEditEngine::HasDifferentRTLLevels( const ContentNode* pNode ) { - USHORT nPara = GetEditDoc().GetPos( (ContentNode*)pNode ); + sal_uInt16 nPara = GetEditDoc().GetPos( (ContentNode*)pNode ); ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - BOOL bHasDifferentRTLLevels = FALSE; + sal_Bool bHasDifferentRTLLevels = sal_False; - USHORT nRTLLevel = IsRightToLeft( nPara ) ? 1 : 0; - for ( USHORT n = 0; n < pParaPortion->GetTextPortions().Count(); n++ ) + sal_uInt16 nRTLLevel = IsRightToLeft( nPara ) ? 1 : 0; + for ( sal_uInt16 n = 0; n < pParaPortion->GetTextPortions().Count(); n++ ) { TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( n ); if ( pTextPortion->GetRightToLeft() != nRTLLevel ) { - bHasDifferentRTLLevels = TRUE; + bHasDifferentRTLLevels = sal_True; break; } } @@ -2089,21 +2029,19 @@ BOOL ImpEditEngine::HasDifferentRTLLevels( const ContentNode* pNode ) } -BYTE ImpEditEngine::GetRightToLeft( USHORT nPara, USHORT nPos, USHORT* pStart, USHORT* pEnd ) +sal_uInt8 ImpEditEngine::GetRightToLeft( sal_uInt16 nPara, sal_uInt16 nPos, sal_uInt16* pStart, sal_uInt16* pEnd ) { -// BYTE nRightToLeft = IsRightToLeft( nPara ) ? 1 : 0; - BYTE nRightToLeft = 0; + sal_uInt8 nRightToLeft = 0; ContentNode* pNode = aEditDoc.SaveGetObject( nPara ); if ( pNode && pNode->Len() ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pParaPortion->aWritingDirectionInfos.Count() ) + if ( pParaPortion->aWritingDirectionInfos.empty() ) InitWritingDirections( nPara ); -// BYTE nType = 0; WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos; - for ( USHORT n = 0; n < rDirInfos.Count(); n++ ) + for ( size_t n = 0; n < rDirInfos.size(); n++ ) { if ( ( rDirInfos[n].nStartPos <= nPos ) && ( rDirInfos[n].nEndPos >= nPos ) ) { @@ -2119,7 +2057,7 @@ BYTE ImpEditEngine::GetRightToLeft( USHORT nPara, USHORT nPos, USHORT* pStart, U return nRightToLeft; } -SvxAdjust ImpEditEngine::GetJustification( USHORT nPara ) const +SvxAdjust ImpEditEngine::GetJustification( sal_uInt16 nPara ) const { SvxAdjust eJustification = SVX_ADJUST_LEFT; @@ -2138,68 +2076,62 @@ SvxAdjust ImpEditEngine::GetJustification( USHORT nPara ) const return eJustification; } -SvxCellJustifyMethod ImpEditEngine::GetJustifyMethod( USHORT nPara ) const +SvxCellJustifyMethod ImpEditEngine::GetJustifyMethod( sal_uInt16 nPara ) const { const SvxJustifyMethodItem& rItem = static_cast<const SvxJustifyMethodItem&>( GetParaAttrib(nPara, EE_PARA_JUST_METHOD)); return static_cast<SvxCellJustifyMethod>(rItem.GetEnumValue()); } -SvxCellVerJustify ImpEditEngine::GetVerJustification( USHORT nPara ) const +SvxCellVerJustify ImpEditEngine::GetVerJustification( sal_uInt16 nPara ) const { const SvxVerJustifyItem& rItem = static_cast<const SvxVerJustifyItem&>( GetParaAttrib(nPara, EE_PARA_VER_JUST)); return static_cast<SvxCellVerJustify>(rItem.GetEnumValue()); } - // ---------------------------------------------------------------------- -// Textaenderung +// Text changes // ---------------------------------------------------------------------- -void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, USHORT nChars, EditUndoRemoveChars* pCurUndo ) +void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, sal_uInt16 nChars, EditUndoRemoveChars* pCurUndo ) { if ( IsUndoEnabled() && !IsInUndo() ) { XubString aStr( rPaM.GetNode()->Copy( rPaM.GetIndex(), nChars ) ); - // Pruefen, ob Attribute geloescht oder geaendert werden: - USHORT nStart = rPaM.GetIndex(); - USHORT nEnd = nStart + nChars; + // Check whether attributes are deleted or changed: + sal_uInt16 nStart = rPaM.GetIndex(); + sal_uInt16 nEnd = nStart + nChars; CharAttribArray& rAttribs = rPaM.GetNode()->GetCharAttribs().GetAttribs(); -// USHORT nAttrs = rAttribs.Count(); - for ( USHORT nAttr = 0; nAttr < rAttribs.Count(); nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < rAttribs.Count(); nAttr++ ) { EditCharAttrib* pAttr = rAttribs[nAttr]; if ( ( pAttr->GetEnd() >= nStart ) && ( pAttr->GetStart() < nEnd ) ) { -#ifndef SVX_LIGHT EditSelection aSel( rPaM ); aSel.Max().GetIndex() = aSel.Max().GetIndex() + nChars; EditUndoSetAttribs* pAttrUndo = CreateAttribUndo( aSel, GetEmptyItemSet() ); InsertUndo( pAttrUndo ); -#endif break; // for } } if ( pCurUndo && ( CreateEditPaM( pCurUndo->GetEPaM() ) == rPaM ) ) pCurUndo->GetStr() += aStr; -#ifndef SVX_LIGHT else InsertUndo( new EditUndoRemoveChars( this, CreateEPaM( rPaM ), aStr ) ); -#endif } aEditDoc.RemoveChars( rPaM, nChars ); TextModified(); } -EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, USHORT nNewPos ) +EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16 nNewPos ) { aOldPositions.Justify(); - BOOL bValidAction = ( (long)nNewPos < aOldPositions.Min() ) || ( (long)nNewPos > aOldPositions.Max() ); - DBG_ASSERT( bValidAction, "Move in sich selbst ?" ); - DBG_ASSERT( aOldPositions.Max() <= (long)GetParaPortions().Count(), "Voll drueber weg: MoveParagraphs" ); + sal_Bool bValidAction = ( (long)nNewPos < aOldPositions.Min() ) || ( (long)nNewPos > aOldPositions.Max() ); + OSL_ENSURE( bValidAction, "Move in itself?" ); + OSL_ENSURE( aOldPositions.Max() <= (long)GetParaPortions().Count(), "totally over it: MoveParagraphs" ); EditSelection aSelection; @@ -2209,7 +2141,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, USHORT nNew return aSelection; } - ULONG nParaCount = GetParaPortions().Count(); + sal_uLong nParaCount = GetParaPortions().Count(); if ( nNewPos >= nParaCount ) nNewPos = GetParaPortions().Count(); @@ -2223,51 +2155,51 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, USHORT nNew if ( nNewPos == 0 ) // Move to Start { pRecalc1 = GetParaPortions().GetObject( 0 ); - pRecalc2 = GetParaPortions().GetObject( (USHORT)aOldPositions.Min() ); + pRecalc2 = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Min() ); } else if ( nNewPos == nParaCount ) { - pRecalc1 = GetParaPortions().GetObject( (USHORT)(nParaCount-1) ); - pRecalc2 = GetParaPortions().GetObject( (USHORT)aOldPositions.Max() ); + pRecalc1 = GetParaPortions().GetObject( (sal_uInt16)(nParaCount-1) ); + pRecalc2 = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Max() ); } if ( aOldPositions.Min() == 0 ) // Move from Start { pRecalc3 = GetParaPortions().GetObject( 0 ); pRecalc4 = GetParaPortions().GetObject( - sal::static_int_cast< USHORT >( aOldPositions.Max()+1 ) ); + sal::static_int_cast< sal_uInt16 >( aOldPositions.Max()+1 ) ); } - else if ( (USHORT)aOldPositions.Max() == (nParaCount-1) ) + else if ( (sal_uInt16)aOldPositions.Max() == (nParaCount-1) ) { - pRecalc3 = GetParaPortions().GetObject( (USHORT)aOldPositions.Max() ); - pRecalc4 = GetParaPortions().GetObject( (USHORT)(aOldPositions.Min()-1) ); + pRecalc3 = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Max() ); + pRecalc4 = GetParaPortions().GetObject( (sal_uInt16)(aOldPositions.Min()-1) ); } - MoveParagraphsInfo aMoveParagraphsInfo( sal::static_int_cast< USHORT >(aOldPositions.Min()), sal::static_int_cast< USHORT >(aOldPositions.Max()), nNewPos ); + MoveParagraphsInfo aMoveParagraphsInfo( sal::static_int_cast< sal_uInt16 >(aOldPositions.Min()), sal::static_int_cast< sal_uInt16 >(aOldPositions.Max()), nNewPos ); aBeginMovingParagraphsHdl.Call( &aMoveParagraphsInfo ); if ( IsUndoEnabled() && !IsInUndo()) InsertUndo( new EditUndoMoveParagraphs( this, aOldPositions, nNewPos ) ); - // Position nicht aus dem Auge verlieren! + // do not lose sight of the Position ! ParaPortion* pDestPortion = GetParaPortions().SaveGetObject( nNewPos ); ParaPortionList aTmpPortionList; - USHORT i; - for ( i = (USHORT)aOldPositions.Min(); i <= (USHORT)aOldPositions.Max(); i++ ) + sal_uInt16 i; + for ( i = (sal_uInt16)aOldPositions.Min(); i <= (sal_uInt16)aOldPositions.Max(); i++ ) { - // Immer aOldPositions.Min(), da Remove(). - ParaPortion* pTmpPortion = GetParaPortions().GetObject( (USHORT)aOldPositions.Min() ); - GetParaPortions().Remove( (USHORT)aOldPositions.Min() ); - aEditDoc.Remove( (USHORT)aOldPositions.Min() ); + // always aOldPositions.Min(), since Remove(). + ParaPortion* pTmpPortion = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Min() ); + GetParaPortions().Remove( (sal_uInt16)aOldPositions.Min() ); + aEditDoc.Remove( (sal_uInt16)aOldPositions.Min() ); aTmpPortionList.Insert( pTmpPortion, aTmpPortionList.Count() ); } - USHORT nRealNewPos = pDestPortion ? GetParaPortions().GetPos( pDestPortion ) : GetParaPortions().Count(); - DBG_ASSERT( nRealNewPos != USHRT_MAX, "ImpMoveParagraphs: Ungueltige Position!" ); + sal_uInt16 nRealNewPos = pDestPortion ? GetParaPortions().GetPos( pDestPortion ) : GetParaPortions().Count(); + OSL_ENSURE( nRealNewPos != USHRT_MAX, "ImpMoveParagraphs: Invalid Position!" ); - for ( i = 0; i < (USHORT)aTmpPortionList.Count(); i++ ) + for ( i = 0; i < (sal_uInt16)aTmpPortionList.Count(); i++ ) { ParaPortion* pTmpPortion = aTmpPortionList.GetObject( i ); if ( i == 0 ) @@ -2289,12 +2221,12 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, USHORT nNew EENotify aNotify( EE_NOTIFY_PARAGRAPHSMOVED ); aNotify.pEditEngine = GetEditEnginePtr(); aNotify.nParagraph = nNewPos; - aNotify.nParam1 = sal::static_int_cast< USHORT >(aOldPositions.Min()); - aNotify.nParam2 = sal::static_int_cast< USHORT >(aOldPositions.Max()); + aNotify.nParam1 = sal::static_int_cast< sal_uInt16 >(aOldPositions.Min()); + aNotify.nParam2 = sal::static_int_cast< sal_uInt16 >(aOldPositions.Max()); CallNotify( aNotify ); } - aEditDoc.SetModified( TRUE ); + aEditDoc.SetModified( sal_True ); if ( pRecalc1 ) CalcHeight( pRecalc1 ); @@ -2305,7 +2237,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, USHORT nNew if ( pRecalc4 ) CalcHeight( pRecalc4 ); - aTmpPortionList.Remove( 0, aTmpPortionList.Count() ); // wichtig ! + aTmpPortionList.Remove( 0, aTmpPortionList.Count() ); // important ! #ifdef EDITDEBUG GetParaPortions().DbgCheck(aEditDoc); @@ -2314,19 +2246,18 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, USHORT nNew } -EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pRight, BOOL bBackward ) +EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pRight, sal_Bool bBackward ) { - DBG_ASSERT( pLeft != pRight, "Den gleichen Absatz zusammenfuegen ?" ); - DBG_ASSERT( aEditDoc.GetPos( pLeft ) != USHRT_MAX, "Einzufuegenden Node nicht gefunden(1)" ); - DBG_ASSERT( aEditDoc.GetPos( pRight ) != USHRT_MAX, "Einzufuegenden Node nicht gefunden(2)" ); + OSL_ENSURE( pLeft != pRight, "Join together the same paragraph ?" ); + OSL_ENSURE( aEditDoc.GetPos( pLeft ) != USHRT_MAX, "Inserted node not found (1)" ); + OSL_ENSURE( aEditDoc.GetPos( pRight ) != USHRT_MAX, "Inserted node not found (2)" ); - USHORT nParagraphTobeDeleted = aEditDoc.GetPos( pRight ); - DeletedNodeInfo* pInf = new DeletedNodeInfo( (ULONG)pRight, nParagraphTobeDeleted ); + sal_uInt16 nParagraphTobeDeleted = aEditDoc.GetPos( pRight ); + DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pRight, nParagraphTobeDeleted ); aDeletedNodes.Insert( pInf, aDeletedNodes.Count() ); GetEditEnginePtr()->ParagraphConnected( aEditDoc.GetPos( pLeft ), aEditDoc.GetPos( pRight ) ); -#ifndef SVX_LIGHT if ( IsUndoEnabled() && !IsInUndo() ) { InsertUndo( new EditUndoConnectParas( this, @@ -2334,37 +2265,35 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR pLeft->GetContentAttribs().GetItems(), pRight->GetContentAttribs().GetItems(), pLeft->GetStyleSheet(), pRight->GetStyleSheet(), bBackward ) ); } -#endif if ( bBackward ) { - pLeft->SetStyleSheet( pRight->GetStyleSheet(), TRUE ); + pLeft->SetStyleSheet( pRight->GetStyleSheet(), sal_True ); pLeft->GetContentAttribs().GetItems().Set( pRight->GetContentAttribs().GetItems() ); pLeft->GetCharAttribs().GetDefFont() = pRight->GetCharAttribs().GetDefFont(); } ParaAttribsChanged( pLeft ); - // Erstmal Portions suchen, da pRight nach ConnectParagraphs weg. + // First search for Portions since pRight is gone after ConnectParagraphs. ParaPortion* pLeftPortion = FindParaPortion( pLeft ); ParaPortion* pRightPortion = FindParaPortion( pRight ); - DBG_ASSERT( pLeftPortion, "Blinde Portion in ImpConnectParagraphs(1)" ); - DBG_ASSERT( pRightPortion, "Blinde Portion in ImpConnectParagraphs(2)" ); - DBG_ASSERT( nParagraphTobeDeleted == GetParaPortions().GetPos( pRightPortion ), "NodePos != PortionPos?" ); + OSL_ENSURE( pLeftPortion, "Blind Portion in ImpConnectParagraphs(1)" ); + OSL_ENSURE( pRightPortion, "Blind Portion in ImpConnectParagraphs(2)" ); + OSL_ENSURE( nParagraphTobeDeleted == GetParaPortions().GetPos( pRightPortion ), "NodePos != PortionPos?" ); -#ifndef SVX_LIGHT if ( GetStatus().DoOnlineSpelling() ) { xub_StrLen nEnd = pLeft->Len(); xub_StrLen nInv = nEnd ? nEnd-1 : nEnd; - pLeft->GetWrongList()->ClearWrongs( nInv, 0xFFFF, pLeft ); // Evtl. einen wegnehmen + pLeft->GetWrongList()->ClearWrongs( nInv, 0xFFFF, pLeft ); // Possibly remove one pLeft->GetWrongList()->MarkInvalid( nInv, nEnd+1 ); - // Falschgeschriebene Woerter ruebernehmen: - USHORT nRWrongs = pRight->GetWrongList()->Count(); - for ( USHORT nW = 0; nW < nRWrongs; nW++ ) + // Take over misspelled words + sal_uInt16 nRWrongs = pRight->GetWrongList()->Count(); + for ( sal_uInt16 nW = 0; nW < nRWrongs; nW++ ) { WrongRange aWrong = pRight->GetWrongList()->GetObject( nW ); - if ( aWrong.nStart != 0 ) // Nicht ein anschliessender + if ( aWrong.nStart != 0 ) // Not a subsequent { aWrong.nStart = aWrong.nStart + nEnd; aWrong.nEnd = aWrong.nEnd + nEnd; @@ -2372,7 +2301,6 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR } } } -#endif if ( IsCallParaInsertedOrDeleted() ) GetEditEnginePtr()->ParagraphDeleted( nParagraphTobeDeleted ); @@ -2383,14 +2311,13 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR pLeftPortion->MarkSelectionInvalid( aPaM.GetIndex(), pLeft->Len() ); - // der rechte Node wird von EditDoc::ConnectParagraphs() geloescht. - + // the right node is deleted by EditDoc:ConnectParagraphs(). if ( GetTextRanger() ) { - // Durch das zusammenfuegen wird der linke zwar neu formatiert, aber - // wenn sich dessen Hoehe nicht aendert bekommt die Formatierung die - // Aenderung der Gesaamthoehe des Textes zu spaet mit... - for ( USHORT n = nParagraphTobeDeleted; n < GetParaPortions().Count(); n++ ) + // By joining together the two, the left is although reformatted, + // however if its height does not change then the formatting receives + // the change of the total text hight too late... + for ( sal_uInt16 n = nParagraphTobeDeleted; n < GetParaPortions().Count(); n++ ) { ParaPortion* pPP = GetParaPortions().GetObject( n ); pPP->MarkSelectionInvalid( 0, pPP->GetNode()->Len() ); @@ -2403,11 +2330,11 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR return aPaM; } -EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, BYTE nMode, BYTE nDelMode ) +EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, sal_uInt8 nMode, sal_uInt8 nDelMode ) { - DBG_ASSERT( !EditSelection( rSel ).DbgIsBuggy( aEditDoc ), "Index im Wald in DeleteLeftOrRight" ); + OSL_ENSURE( !EditSelection( rSel ).DbgIsBuggy( aEditDoc ), "Index out of range in DeleteLeftOrRight" ); - if ( rSel.HasRange() ) // dann nur Sel. loeschen + if ( rSel.HasRange() ) // only then Delete Selection return ImpDeleteSelection( rSel ); const EditPaM aCurPos( rSel.Max() ); @@ -2430,7 +2357,7 @@ EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, BYTE nMode, aDelStart.SetIndex( 0 ); if ( aDelStart == aCurPos ) { - // kompletter Absatz davor + // Complete paragraph previous ContentNode* pPrev = GetPrevVisNode( aCurPos.GetNode() ); if ( pPrev ) aDelStart = EditPaM( pPrev, 0 ); @@ -2466,7 +2393,7 @@ EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, BYTE nMode, aDelEnd.SetIndex( aCurPos.GetNode()->Len() ); if ( aDelEnd == aCurPos ) { - // kompletter Absatz dahinter + // Complete paragraph next ContentNode* pNext = GetNextVisNode( aCurPos.GetNode() ); if ( pNext ) aDelEnd = EditPaM( pNext, pNext->Len() ); @@ -2474,16 +2401,16 @@ EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, BYTE nMode, } } - // Bei DELMODE_RESTOFCONTENT reicht bei verschiedenen Nodes - // kein ConnectParagraphs. + // ConnectParagraphs not enoguh for different Nodes when + // DELMODE_RESTOFCONTENT. if ( ( nDelMode == DELMODE_RESTOFCONTENT ) || ( aDelStart.GetNode() == aDelEnd.GetNode() ) ) return ImpDeleteSelection( EditSelection( aDelStart, aDelEnd ) ); - // Jetzt entscheiden, ob noch Selektion loeschen (RESTOFCONTENTS) - BOOL bSpecialBackward = ( ( nMode == DEL_LEFT ) && ( nDelMode == DELMODE_SIMPLE ) ) - ? TRUE : FALSE; + // Decide now if to delete selection (RESTOFCONTENTS) + sal_Bool bSpecialBackward = ( ( nMode == DEL_LEFT ) && ( nDelMode == DELMODE_SIMPLE ) ) + ? sal_True : sal_False; if ( aStatus.IsAnyOutliner() ) - bSpecialBackward = FALSE; + bSpecialBackward = sal_False; return ImpConnectParagraphs( aDelStart.GetNode(), aDelEnd.GetNode(), bSpecialBackward ); } @@ -2497,52 +2424,52 @@ EditPaM ImpEditEngine::ImpDeleteSelection( EditSelection aSel ) EditPaM aStartPaM( aSel.Min() ); EditPaM aEndPaM( aSel.Max() ); - CursorMoved( aStartPaM.GetNode() ); // nur damit neu eingestellte Attribute verschwinden... - CursorMoved( aEndPaM.GetNode() ); // nur damit neu eingestellte Attribute verschwinden... + CursorMoved( aStartPaM.GetNode() ); // only so that newly set Attributes dissapear... + CursorMoved( aEndPaM.GetNode() ); // only so that newly set Attributes dissapear... - DBG_ASSERT( aStartPaM.GetIndex() <= aStartPaM.GetNode()->Len(), "Index im Wald in ImpDeleteSelection" ); - DBG_ASSERT( aEndPaM.GetIndex() <= aEndPaM.GetNode()->Len(), "Index im Wald in ImpDeleteSelection" ); + OSL_ENSURE( aStartPaM.GetIndex() <= aStartPaM.GetNode()->Len(), "Index out of range in ImpDeleteSelection" ); + OSL_ENSURE( aEndPaM.GetIndex() <= aEndPaM.GetNode()->Len(), "Index out of range in ImpDeleteSelection" ); - USHORT nStartNode = aEditDoc.GetPos( aStartPaM.GetNode() ); - USHORT nEndNode = aEditDoc.GetPos( aEndPaM.GetNode() ); + sal_uInt16 nStartNode = aEditDoc.GetPos( aStartPaM.GetNode() ); + sal_uInt16 nEndNode = aEditDoc.GetPos( aEndPaM.GetNode() ); - DBG_ASSERT( nEndNode != USHRT_MAX, "Start > End ?!" ); - DBG_ASSERT( nStartNode <= nEndNode, "Start > End ?!" ); + OSL_ENSURE( nEndNode != USHRT_MAX, "Start > End ?!" ); + OSL_ENSURE( nStartNode <= nEndNode, "Start > End ?!" ); - // Alle Nodes dazwischen entfernen.... - for ( ULONG z = nStartNode+1; z < nEndNode; z++ ) + // Remove all nodes in between .... + for ( sal_uLong z = nStartNode+1; z < nEndNode; z++ ) { - // Immer nStartNode+1, wegen Remove()! + // Always nStartNode+1, due to Remove()! ImpRemoveParagraph( nStartNode+1 ); } if ( aStartPaM.GetNode() != aEndPaM.GetNode() ) { - // Den Rest des StartNodes... - USHORT nChars; + // The Rest of the StartNodes... + sal_uInt16 nChars; nChars = aStartPaM.GetNode()->Len() - aStartPaM.GetIndex(); ImpRemoveChars( aStartPaM, nChars ); ParaPortion* pPortion = FindParaPortion( aStartPaM.GetNode() ); - DBG_ASSERT( pPortion, "Blinde Portion in ImpDeleteSelection(3)" ); + OSL_ENSURE( pPortion, "Blind Portion in ImpDeleteSelection(3)" ); pPortion->MarkSelectionInvalid( aStartPaM.GetIndex(), aStartPaM.GetNode()->Len() ); - // Den Anfang des EndNodes.... + // The beginning of the EndNodes.... nChars = aEndPaM.GetIndex(); aEndPaM.SetIndex( 0 ); ImpRemoveChars( aEndPaM, nChars ); pPortion = FindParaPortion( aEndPaM.GetNode() ); - DBG_ASSERT( pPortion, "Blinde Portion in ImpDeleteSelection(4)" ); + OSL_ENSURE( pPortion, "Blind Portion in ImpDeleteSelection(4)" ); pPortion->MarkSelectionInvalid( 0, aEndPaM.GetNode()->Len() ); - // Zusammenfuegen.... + // Join together.... aStartPaM = ImpConnectParagraphs( aStartPaM.GetNode(), aEndPaM.GetNode() ); } else { - USHORT nChars; + sal_uInt16 nChars; nChars = aEndPaM.GetIndex() - aStartPaM.GetIndex(); ImpRemoveChars( aStartPaM, nChars ); ParaPortion* pPortion = FindParaPortion( aStartPaM.GetNode() ); - DBG_ASSERT( pPortion, "Blinde Portion in ImpDeleteSelection(5)" ); + OSL_ENSURE( pPortion, "Blind Portion in ImpDeleteSelection(5)" ); pPortion->MarkInvalid( aEndPaM.GetIndex(), aStartPaM.GetIndex() - aEndPaM.GetIndex() ); } @@ -2551,19 +2478,19 @@ EditPaM ImpEditEngine::ImpDeleteSelection( EditSelection aSel ) return aStartPaM; } -void ImpEditEngine::ImpRemoveParagraph( USHORT nPara ) +void ImpEditEngine::ImpRemoveParagraph( sal_uInt16 nPara ) { ContentNode* pNode = aEditDoc.SaveGetObject( nPara ); ContentNode* pNextNode = aEditDoc.SaveGetObject( nPara+1 ); ParaPortion* pPortion = GetParaPortions().SaveGetObject( nPara ); - DBG_ASSERT( pNode, "Blinder Node in ImpRemoveParagraph" ); - DBG_ASSERT( pPortion, "Blinde Portion in ImpRemoveParagraph(2)" ); + OSL_ENSURE( pNode, "Blind Node in ImpRemoveParagraph" ); + OSL_ENSURE( pPortion, "Blind Portion in ImpRemoveParagraph(2)" ); - DeletedNodeInfo* pInf = new DeletedNodeInfo( (ULONG)pNode, nPara ); + DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pNode, nPara ); aDeletedNodes.Insert( pInf, aDeletedNodes.Count() ); - // Der Node wird vom Undo verwaltet und ggf. zerstoert! + // The node is managed by the undo and possibly destroyed! /* delete */ aEditDoc.Remove( nPara ); GetParaPortions().Remove( nPara ); delete pPortion; @@ -2573,30 +2500,27 @@ void ImpEditEngine::ImpRemoveParagraph( USHORT nPara ) GetEditEnginePtr()->ParagraphDeleted( nPara ); } - // Im folgenden muss ggf. Extra-Space neu ermittelt werden. - // Bei ParaAttribsChanged wird leider der Absatz neu formatiert, - // aber diese Methode sollte nicht Zeitkritsch sein! + // Extra-Space may be determined again in the following. For + // ParaAttribsChanged the paragraph is unfortunately formatted again, + // however this method should not be time critical! if ( pNextNode ) ParaAttribsChanged( pNextNode ); -#ifndef SVX_LIGHT if ( IsUndoEnabled() && !IsInUndo() ) InsertUndo( new EditUndoDelContent( this, pNode, nPara ) ); else -#endif { aEditDoc.RemoveItemsFromPool( pNode ); if ( pNode->GetStyleSheet() ) - EndListening( *pNode->GetStyleSheet(), FALSE ); + EndListening( *pNode->GetStyleSheet(), sal_False ); delete pNode; } } EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, - bool bOverwrite, Window* pFrameWin ) + sal_Bool bOverwrite, Window* pFrameWin ) { EditSelection aSel( rCurSel ); -#ifndef SVX_LIGHT SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); if ( pAutoCorrect ) { @@ -2605,8 +2529,8 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, // #i78661 allow application to turn off capitalization of // start sentence explicitly. - // (This is done by setting IsFirstWordCapitalization to FALSE.) - BOOL bOldCptlSttSntnc = pAutoCorrect->IsAutoCorrFlag( CptlSttSntnc ); + // (This is done by setting IsFirstWordCapitalization to sal_False.) + sal_Bool bOldCptlSttSntnc = pAutoCorrect->IsAutoCorrFlag( CptlSttSntnc ); if (!IsFirstWordCapitalization()) { ESelection aESel( CreateESel(aSel) ); @@ -2632,7 +2556,7 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, EditPaM aRight2Word( WordRight( aFirstWordSel.Max(), 1 ) ); aSecondWordSel = SelectWord( EditSelection( aRight2Word ) ); } - BOOL bIsFirstWordInFirstPara = aESel.nEndPara == 0 && + sal_Bool bIsFirstWordInFirstPara = aESel.nEndPara == 0 && aFirstWordSel.Max().GetIndex() <= aSel.Max().GetIndex() && aSel.Max().GetIndex() <= aSecondWordSel.Min().GetIndex(); @@ -2641,7 +2565,7 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, } ContentNode* pNode = aSel.Max().GetNode(); - USHORT nIndex = aSel.Max().GetIndex(); + sal_uInt16 nIndex = aSel.Max().GetIndex(); EdtAutoCorrDoc aAuto( this, pNode, nIndex, c ); pAutoCorrect->AutoCorrect( aAuto, *pNode, nIndex, c, !bOverwrite, pFrameWin ); aSel.Max().SetIndex( aAuto.GetCursor() ); @@ -2650,23 +2574,22 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, // shared we need to reset the value to it's original state. pAutoCorrect->SetAutoCorrFlag( CptlSttSntnc, bOldCptlSttSntnc ); } -#endif // !SVX_LIGHT return aSel.Max(); } EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel, - xub_Unicode c, BOOL bOverwrite, sal_Bool bIsUserInput ) + xub_Unicode c, sal_Bool bOverwrite, sal_Bool bIsUserInput ) { - DBG_ASSERT( c != '\t', "Tab bei InsertText ?" ); - DBG_ASSERT( c != '\n', "Zeilenumbruch bei InsertText ?" ); + OSL_ENSURE( c != '\t', "Tab for InsertText ?" ); + OSL_ENSURE( c != '\n', "Word wrapping for InsertText ?"); EditPaM aPaM( rCurSel.Min() ); - BOOL bDoOverwrite = ( bOverwrite && - ( aPaM.GetIndex() < aPaM.GetNode()->Len() ) ) ? TRUE : FALSE; + sal_Bool bDoOverwrite = ( bOverwrite && + ( aPaM.GetIndex() < aPaM.GetNode()->Len() ) ) ? sal_True : sal_False; - BOOL bUndoAction = ( rCurSel.HasRange() || bDoOverwrite ); + sal_Bool bUndoAction = ( rCurSel.HasRange() || bDoOverwrite ); if ( bUndoAction ) UndoActionStart( EDITUNDO_INSERT ); @@ -2677,10 +2600,10 @@ EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel, } else if ( bDoOverwrite ) { - // Wenn Selektion, dann nicht auch noch ein Zeichen ueberschreiben! + // If selected, then do not also overwrite a character! EditSelection aTmpSel( aPaM ); aTmpSel.Max().GetIndex()++; - DBG_ASSERT( !aTmpSel.DbgIsBuggy( aEditDoc ), "Overwrite: Fehlerhafte Selektion!" ); + OSL_ENSURE( !aTmpSel.DbgIsBuggy( aEditDoc ), "Overwrite: Wrong selection! "); ImpDeleteSelection( aTmpSel ); } @@ -2720,7 +2643,7 @@ EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel, String aChgText( aNewText.copy( nChgPos ), nChgLen ); // select text from first pos to be changed to current pos - EditSelection aSel( EditPaM( aPaM.GetNode(), (USHORT) nChgPos ), aPaM ); + EditSelection aSel( EditPaM( aPaM.GetNode(), (sal_uInt16) nChgPos ), aPaM ); if (aChgText.Len()) return InsertText( aSel, aChgText ); // implicitly handles undo @@ -2741,15 +2664,15 @@ EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel, if ( IsUndoEnabled() && !IsInUndo() ) { EditUndoInsertChars* pNewUndo = new EditUndoInsertChars( this, CreateEPaM( aPaM ), c ); - BOOL bTryMerge = ( !bDoOverwrite && ( c != ' ' ) ) ? TRUE : FALSE; + sal_Bool bTryMerge = ( !bDoOverwrite && ( c != ' ' ) ) ? sal_True : sal_False; InsertUndo( pNewUndo, bTryMerge ); } aEditDoc.InsertText( (const EditPaM&)aPaM, c ); ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() ); - DBG_ASSERT( pPortion, "Blinde Portion in InsertText" ); + OSL_ENSURE( pPortion, "Blind Portion in InsertText" ); pPortion->MarkInvalid( aPaM.GetIndex(), 1 ); - aPaM.GetIndex()++; // macht EditDoc-Methode nicht mehr + aPaM.GetIndex()++; // does not do EditDoc-Method anymore } TextModified(); @@ -2770,7 +2693,7 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS else aPaM = aCurSel.Max(); - EditPaM aCurPaM( aPaM ); // fuers Invalidieren + EditPaM aCurPaM( aPaM ); // for the Invalidate // get word boundaries in order to clear possible WrongList entries // and invalidate all the necessary text (everything after and including the @@ -2781,56 +2704,53 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS aText.ConvertLineEnd( LINEEND_LF ); SfxVoidItem aTabItem( EE_FEATURE_TAB ); - // Konvertiert nach LineSep = \n - // Token mit LINE_SEP abfragen, - // da der MAC-Compiler aus \n etwas anderes macht! + // Converts to linesep = \n + // Token LINE_SEP query, + // since the MAC-Compiler makes something else from \n ! - USHORT nStart = 0; + sal_uInt16 nStart = 0; while ( nStart < aText.Len() ) { - USHORT nEnd = aText.Search( LINE_SEP, nStart ); + sal_uInt16 nEnd = aText.Search( LINE_SEP, nStart ); if ( nEnd == STRING_NOTFOUND ) - nEnd = aText.Len(); // nicht dereferenzieren! + nEnd = aText.Len(); // not dereference! - // Start == End => Leerzeile + // Start == End => empty line if ( nEnd > nStart ) { XubString aLine( aText, nStart, nEnd-nStart ); xub_StrLen nChars = aPaM.GetNode()->Len() + aLine.Len(); if ( nChars > MAXCHARSINPARA ) { - USHORT nMaxNewChars = MAXCHARSINPARA-aPaM.GetNode()->Len(); - nEnd -= ( aLine.Len() - nMaxNewChars ); // Dann landen die Zeichen im naechsten Absatz. - aLine.Erase( nMaxNewChars ); // Del Rest... + sal_uInt16 nMaxNewChars = MAXCHARSINPARA-aPaM.GetNode()->Len(); + nEnd -= ( aLine.Len() - nMaxNewChars ); // Then the characters end up in the next paragraph. + aLine.Erase( nMaxNewChars ); // Delete the Rest... } -#ifndef SVX_LIGHT if ( IsUndoEnabled() && !IsInUndo() ) InsertUndo( new EditUndoInsertChars( this, CreateEPaM( aPaM ), aLine ) ); -#endif // Tabs ? if ( aLine.Search( '\t' ) == STRING_NOTFOUND ) aPaM = aEditDoc.InsertText( aPaM, aLine ); else { - USHORT nStart2 = 0; + sal_uInt16 nStart2 = 0; while ( nStart2 < aLine.Len() ) { - USHORT nEnd2 = aLine.Search( '\t', nStart2 ); + sal_uInt16 nEnd2 = aLine.Search( '\t', nStart2 ); if ( nEnd2 == STRING_NOTFOUND ) - nEnd2 = aLine.Len(); // nicht dereferenzieren! + nEnd2 = aLine.Len(); // not dereference! if ( nEnd2 > nStart2 ) aPaM = aEditDoc.InsertText( aPaM, XubString( aLine, nStart2, nEnd2-nStart2 ) ); if ( nEnd2 < aLine.Len() ) { - // aPaM = ImpInsertFeature( EditSelection( aPaM, aPaM ), ); aPaM = aEditDoc.InsertFeature( aPaM, aTabItem ); } nStart2 = nEnd2+1; } } ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() ); - DBG_ASSERT( pPortion, "Blinde Portion in InsertText" ); + OSL_ENSURE( pPortion, "Blind Portion in InsertText" ); // now remove the Wrongs (red spell check marks) from both words... WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList(); @@ -2853,16 +2773,14 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS EditPaM ImpEditEngine::ImpFastInsertText( EditPaM aPaM, const XubString& rStr ) { - DBG_ASSERT( rStr.Search( 0x0A ) == STRING_NOTFOUND, "FastInsertText: Zeilentrenner nicht erlaubt!" ); - DBG_ASSERT( rStr.Search( 0x0D ) == STRING_NOTFOUND, "FastInsertText: Zeilentrenner nicht erlaubt!" ); - DBG_ASSERT( rStr.Search( '\t' ) == STRING_NOTFOUND, "FastInsertText: Features nicht erlaubt!" ); + OSL_ENSURE( rStr.Search( 0x0A ) == STRING_NOTFOUND, "FastInsertText: Newline not allowed! "); + OSL_ENSURE( rStr.Search( 0x0D ) == STRING_NOTFOUND, "FastInsertText: Newline not allowed! "); + OSL_ENSURE( rStr.Search( '\t' ) == STRING_NOTFOUND, "FastInsertText: Newline not allowed! "); if ( ( aPaM.GetNode()->Len() + rStr.Len() ) < MAXCHARSINPARA ) { -#ifndef SVX_LIGHT if ( IsUndoEnabled() && !IsInUndo() ) InsertUndo( new EditUndoInsertChars( this, CreateEPaM( aPaM ), rStr ) ); -#endif aPaM = aEditDoc.InsertText( aPaM, rStr ); TextModified(); @@ -2886,14 +2804,12 @@ EditPaM ImpEditEngine::ImpInsertFeature( EditSelection aCurSel, const SfxPoolIte if ( aPaM.GetIndex() >= 0xfffe ) return aPaM; -#ifndef SVX_LIGHT if ( IsUndoEnabled() && !IsInUndo() ) InsertUndo( new EditUndoInsertFeature( this, CreateEPaM( aPaM ), rItem ) ); -#endif aPaM = aEditDoc.InsertFeature( aPaM, rItem ); ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() ); - DBG_ASSERT( pPortion, "Blinde Portion in InsertFeature" ); + OSL_ENSURE( pPortion, "Blind Portion in InsertFeature" ); pPortion->MarkInvalid( aPaM.GetIndex()-1, 1 ); TextModified(); @@ -2901,7 +2817,7 @@ EditPaM ImpEditEngine::ImpInsertFeature( EditSelection aCurSel, const SfxPoolIte return aPaM; } -EditPaM ImpEditEngine::ImpInsertParaBreak( const EditSelection& rCurSel, BOOL bKeepEndingAttribs ) +EditPaM ImpEditEngine::ImpInsertParaBreak( const EditSelection& rCurSel, sal_Bool bKeepEndingAttribs ) { EditPaM aPaM; if ( rCurSel.HasRange() ) @@ -2912,34 +2828,32 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( const EditSelection& rCurSel, BOOL bK return ImpInsertParaBreak( aPaM, bKeepEndingAttribs ); } -EditPaM ImpEditEngine::ImpInsertParaBreak( const EditPaM& rPaM, BOOL bKeepEndingAttribs ) +EditPaM ImpEditEngine::ImpInsertParaBreak( const EditPaM& rPaM, sal_Bool bKeepEndingAttribs ) { if ( aEditDoc.Count() >= 0xFFFE ) { - DBG_ERROR( "Can't process more than 64K paragraphs!" ); + OSL_FAIL( "Can't process more than 64K paragraphs!" ); return rPaM; } -#ifndef SVX_LIGHT if ( IsUndoEnabled() && !IsInUndo() ) InsertUndo( new EditUndoSplitPara( this, aEditDoc.GetPos( rPaM.GetNode() ), rPaM.GetIndex() ) ); -#endif EditPaM aPaM( aEditDoc.InsertParaBreak( rPaM, bKeepEndingAttribs ) ); -#ifndef SVX_LIGHT if ( GetStatus().DoOnlineSpelling() ) { xub_StrLen nEnd = rPaM.GetNode()->Len(); aPaM.GetNode()->CreateWrongList(); WrongList* pLWrongs = rPaM.GetNode()->GetWrongList(); WrongList* pRWrongs = aPaM.GetNode()->GetWrongList(); - // Falschgeschriebene Woerter ruebernehmen: - USHORT nLWrongs = pLWrongs->Count(); - for ( USHORT nW = 0; nW < nLWrongs; nW++ ) + // take over misspelled words: + sal_uInt16 nLWrongs = pLWrongs->Count(); + for ( sal_uInt16 nW = 0; nW < nLWrongs; nW++ ) { WrongRange& rWrong = pLWrongs->GetObject( nW ); - // Nur wenn wirklich dahinter, ein ueberlappendes wird beim Spell korrigiert + // Correct only if really a word gets overlapped in the process of + // Spell checking if ( rWrong.nStart > nEnd ) { pRWrongs->InsertWrong( rWrong, pRWrongs->Count() ); @@ -2950,58 +2864,52 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( const EditPaM& rPaM, BOOL bKeepEnding else if ( ( rWrong.nStart < nEnd ) && ( rWrong.nEnd > nEnd ) ) rWrong.nEnd = nEnd; } - USHORT nInv = nEnd ? nEnd-1 : nEnd; + sal_uInt16 nInv = nEnd ? nEnd-1 : nEnd; if ( nEnd ) pLWrongs->MarkInvalid( nInv, nEnd ); else pLWrongs->SetValid(); - pRWrongs->SetValid(); // sonst 0 - 0xFFFF - pRWrongs->MarkInvalid( 0, 1 ); // Nur das erste Wort testen + pRWrongs->SetValid(); // otherwise 0 - 0xFFFF + pRWrongs->MarkInvalid( 0, 1 ); // Only test the first word } -#endif // !SVX_LIGHT - ParaPortion* pPortion = FindParaPortion( rPaM.GetNode() ); - DBG_ASSERT( pPortion, "Blinde Portion in ImpInsertParaBreak" ); + OSL_ENSURE( pPortion, "Blind Portion in ImpInsertParaBreak" ); pPortion->MarkInvalid( rPaM.GetIndex(), 0 ); - // Optimieren: Nicht unnoetig viele GetPos auf die Listen ansetzen! - // Hier z.B. bei Undo, aber auch in allen anderen Methoden. - USHORT nPos = GetParaPortions().GetPos( pPortion ); + // Optimization: Do not place unnecessarily many getPos to Listen! + // Here, as in undo, but also in all other methods. + sal_uInt16 nPos = GetParaPortions().GetPos( pPortion ); ParaPortion* pNewPortion = new ParaPortion( aPaM.GetNode() ); GetParaPortions().Insert( pNewPortion, nPos + 1 ); ParaAttribsChanged( pNewPortion->GetNode() ); if ( IsCallParaInsertedOrDeleted() ) GetEditEnginePtr()->ParagraphInserted( nPos+1 ); - CursorMoved( rPaM.GetNode() ); // falls leeres Attribut entstanden. + CursorMoved( rPaM.GetNode() ); // if empty Attributes have emerged. TextModified(); return aPaM; } -EditPaM ImpEditEngine::ImpFastInsertParagraph( USHORT nPara ) +EditPaM ImpEditEngine::ImpFastInsertParagraph( sal_uInt16 nPara ) { -#ifndef SVX_LIGHT if ( IsUndoEnabled() && !IsInUndo() ) { if ( nPara ) { - DBG_ASSERT( aEditDoc.SaveGetObject( nPara-1 ), "FastInsertParagraph: Prev existiert nicht" ); + OSL_ENSURE( aEditDoc.SaveGetObject( nPara-1 ), "FastInsertParagraph: Prev does not exist" ); InsertUndo( new EditUndoSplitPara( this, nPara-1, aEditDoc.GetObject( nPara-1 )->Len() ) ); } else InsertUndo( new EditUndoSplitPara( this, 0, 0 ) ); } -#endif ContentNode* pNode = new ContentNode( aEditDoc.GetItemPool() ); - // Falls FlatMode, wird spaeter kein Font eingestellt: + // If flat mode, then later no Font is set: pNode->GetCharAttribs().GetDefFont() = aEditDoc.GetDefFont(); -#ifndef SVX_LIGHT if ( GetStatus().DoOnlineSpelling() ) pNode->CreateWrongList(); -#endif // !SVX_LIGHT aEditDoc.Insert( pNode, nPara ); @@ -3018,10 +2926,10 @@ EditPaM ImpEditEngine::InsertParaBreak( EditSelection aCurSel ) EditPaM aPaM( ImpInsertParaBreak( aCurSel ) ); if ( aStatus.DoAutoIndenting() ) { - USHORT nPara = aEditDoc.GetPos( aPaM.GetNode() ); - DBG_ASSERT( nPara > 0, "AutoIndenting: Fehler!" ); + sal_uInt16 nPara = aEditDoc.GetPos( aPaM.GetNode() ); + OSL_ENSURE( nPara > 0, "AutoIndenting: Error!" ); XubString aPrevParaText( GetEditDoc().GetParaAsString( nPara-1 ) ); - USHORT n = 0; + sal_uInt16 n = 0; while ( ( n < aPrevParaText.Len() ) && ( ( aPrevParaText.GetChar(n) == ' ' ) || ( aPrevParaText.GetChar(n) == '\t' ) ) ) { @@ -3048,18 +2956,17 @@ EditPaM ImpEditEngine::InsertField( EditSelection aCurSel, const SvxFieldItem& r return aPaM; } -BOOL ImpEditEngine::UpdateFields() +sal_Bool ImpEditEngine::UpdateFields() { - BOOL bChanges = FALSE; - USHORT nParas = GetEditDoc().Count(); - for ( USHORT nPara = 0; nPara < nParas; nPara++ ) + sal_Bool bChanges = sal_False; + sal_uInt16 nParas = GetEditDoc().Count(); + for ( sal_uInt16 nPara = 0; nPara < nParas; nPara++ ) { - BOOL bChangesInPara = FALSE; + sal_Bool bChangesInPara = sal_False; ContentNode* pNode = GetEditDoc().GetObject( nPara ); - DBG_ASSERT( pNode, "NULL-Pointer im Doc" ); + OSL_ENSURE( pNode, "NULL-Pointer in Doc" ); CharAttribArray& rAttribs = pNode->GetCharAttribs().GetAttribs(); -// USHORT nAttrs = rAttribs.Count(); - for ( USHORT nAttr = 0; nAttr < rAttribs.Count(); nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < rAttribs.Count(); nAttr++ ) { EditCharAttrib* pAttr = rAttribs[nAttr]; if ( pAttr->Which() == EE_FEATURE_FIELD ) @@ -3078,17 +2985,17 @@ BOOL ImpEditEngine::UpdateFields() pField->GetFieldValue() = aFldValue; if ( *pField != *pCurrent ) { - bChanges = TRUE; - bChangesInPara = TRUE; + bChanges = sal_True; + bChangesInPara = sal_True; } delete pCurrent; } } if ( bChangesInPara ) { - // ggf. etwas genauer invalidieren. + // If possible be more precise when invalidate. ParaPortion* pPortion = GetParaPortions().GetObject( nPara ); - DBG_ASSERT( pPortion, "NULL-Pointer im Doc" ); + OSL_ENSURE( pPortion, "NULL-Pointer in Doc" ); pPortion->MarkSelectionInvalid( 0, pNode->Len() ); } } @@ -3102,19 +3009,19 @@ EditPaM ImpEditEngine::InsertLineBreak( EditSelection aCurSel ) } // ---------------------------------------------------------------------- -// Hilfsfunktionen +// Helper functions // ---------------------------------------------------------------------- -Rectangle ImpEditEngine::PaMtoEditCursor( EditPaM aPaM, USHORT nFlags ) +Rectangle ImpEditEngine::PaMtoEditCursor( EditPaM aPaM, sal_uInt16 nFlags ) { - DBG_ASSERT( GetUpdateMode(), "Darf bei Update=FALSE nicht erreicht werden: PaMtoEditCursor" ); + OSL_ENSURE( GetUpdateMode(), "Must not be reached when Update=FALSE: PaMtoEditCursor" ); Rectangle aEditCursor; long nY = 0; - for ( USHORT nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ ) + for ( sal_uInt16 nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ ) { ParaPortion* pPortion = GetParaPortions().GetObject(nPortion); ContentNode* pNode = pPortion->GetNode(); - DBG_ASSERT( pNode, "Ungueltiger Node in Portion!" ); + OSL_ENSURE( pNode, "Invalid Node in Portion!" ); if ( pNode != aPaM.GetNode() ) { nY += pPortion->GetHeight(); @@ -3127,45 +3034,45 @@ Rectangle ImpEditEngine::PaMtoEditCursor( EditPaM aPaM, USHORT nFlags ) return aEditCursor; } } - DBG_ERROR( "Portion nicht gefunden!" ); + OSL_FAIL( "Portion not found!" ); return aEditCursor; } -EditPaM ImpEditEngine::GetPaM( Point aDocPos, BOOL bSmart ) +EditPaM ImpEditEngine::GetPaM( Point aDocPos, sal_Bool bSmart ) { - DBG_ASSERT( GetUpdateMode(), "Darf bei Update=FALSE nicht erreicht werden: GetPaM" ); + OSL_ENSURE( GetUpdateMode(), "Must not be reached when Update=FALSE: GetPaM" ); long nY = 0; long nTmpHeight; EditPaM aPaM; - USHORT nPortion; + sal_uInt16 nPortion; for ( nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ ) { ParaPortion* pPortion = GetParaPortions().GetObject(nPortion); - nTmpHeight = pPortion->GetHeight(); // sollte auch bei !bVisible richtig sein! + nTmpHeight = pPortion->GetHeight(); // should also be correct for !bVisible! nY += nTmpHeight; if ( nY > aDocPos.Y() ) { nY -= nTmpHeight; aDocPos.Y() -= nY; - // unsichtbare Portions ueberspringen: + // Skip invisible Portions: while ( pPortion && !pPortion->IsVisible() ) { nPortion++; pPortion = GetParaPortions().SaveGetObject( nPortion ); } - DBG_ASSERT( pPortion, "Keinen sichtbaren Absatz gefunden: GetPaM" ); + OSL_ENSURE( pPortion, "No visible paragraph found: GetPaM" ); aPaM = GetPaM( pPortion, aDocPos, bSmart ); return aPaM; } } - // Dann den letzten sichtbaren Suchen: + // Then search for the last visible: nPortion = GetParaPortions().Count()-1; while ( nPortion && !GetParaPortions()[nPortion]->IsVisible() ) nPortion--; - DBG_ASSERT( GetParaPortions()[nPortion]->IsVisible(), "Keinen sichtbaren Absatz gefunden: GetPaM" ); + OSL_ENSURE( GetParaPortions()[nPortion]->IsVisible(), "No visible paragraph found: GetPaM" ); aPaM.SetNode( GetParaPortions()[nPortion]->GetNode() ); aPaM.SetIndex( GetParaPortions()[nPortion]->GetNode()->Len() ); return aPaM; @@ -3173,15 +3080,15 @@ EditPaM ImpEditEngine::GetPaM( Point aDocPos, BOOL bSmart ) sal_uInt32 ImpEditEngine::GetTextHeight() const { - DBG_ASSERT( GetUpdateMode(), "Sollte bei Update=FALSE nicht verwendet werden: GetTextHeight" ); - DBG_ASSERT( IsFormatted() || IsFormatting(), "GetTextHeight: Nicht formatiert" ); + OSL_ENSURE( GetUpdateMode(), "Should not be used for Update=FALSE: GetTextHeight" ); + OSL_ENSURE( IsFormatted() || IsFormatting(), "GetTextHeight: Not formatted" ); return nCurTextHeight; } -sal_uInt32 ImpEditEngine::CalcTextWidth( BOOL bIgnoreExtraSpace ) +sal_uInt32 ImpEditEngine::CalcTextWidth( sal_Bool bIgnoreExtraSpace ) { - // Wenn noch nicht formatiert und nicht gerade dabei. - // Wird in der Formatierung bei AutoPageSize gerufen. + // If still not formatted and not in the process. + // Will be brought in the formatting for AutoPageSize. if ( !IsFormatted() && !IsFormatting() ) FormatDoc(); @@ -3191,12 +3098,10 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( BOOL bIgnoreExtraSpace ) long nCurWidth = 0; // -------------------------------------------------- - // Ueber alle Absaetze... + // Over all the paragraphs ... // -------------------------------------------------- - USHORT nParas = GetParaPortions().Count(); -// USHORT nBiggestPara = 0; -// USHORT nBiggestLine = 0; - for ( USHORT nPara = 0; nPara < nParas; nPara++ ) + sal_uInt16 nParas = GetParaPortions().Count(); + for ( sal_uInt16 nPara = 0; nPara < nParas; nPara++ ) { ParaPortion* pPortion = GetParaPortions().GetObject( nPara ); if ( pPortion->IsVisible() ) @@ -3205,18 +3110,18 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( BOOL bIgnoreExtraSpace ) sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth( pPortion->GetNode() ); // -------------------------------------------------- - // Ueber die Zeilen des Absatzes... + // On the lines of the paragraph ... // -------------------------------------------------- - ULONG nLines = pPortion->GetLines().Count(); - for ( USHORT nLine = 0; nLine < nLines; nLine++ ) + sal_uLong nLines = pPortion->GetLines().Count(); + for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ ) { pLine = pPortion->GetLines().GetObject( nLine ); - DBG_ASSERT( pLine, "NULL-Pointer im Zeileniterator in CalcWidth" ); + OSL_ENSURE( pLine, "NULL-Pointer in the line iterator in CalcWidth" ); // nCurWidth = pLine->GetStartPosX(); - // Bei Center oder Right haengt die breite von der - // Papierbreite ab, hier nicht erwuenscht. - // Am besten generell nicht auf StartPosX verlassen, - // es muss auch die rechte Einrueckung beruecksichtigt werden! + // For Center- or Right- alignment it depends on the paper + // width, here not prefered. I general, it is best not leave it + // to StartPosX, also the right indents have to be taken into + // account! nCurWidth = GetXValue( rLRItem.GetTxtLeft() + nSpaceBeforeAndMinLabelWidth ); if ( nLine == 0 ) { @@ -3241,13 +3146,13 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( BOOL bIgnoreExtraSpace ) if ( nMaxWidth < 0 ) nMaxWidth = 0; - nMaxWidth++; // Ein breiter, da in CreateLines bei >= umgebrochen wird. + nMaxWidth++; // widen it, because in CreateLines for >= is wrapped. return (sal_uInt32)nMaxWidth; } -sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, BOOL bIgnoreExtraSpace ) +sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, sal_Bool bIgnoreExtraSpace ) { - USHORT nPara = GetEditDoc().GetPos( pPortion->GetNode() ); + sal_uInt16 nPara = GetEditDoc().GetPos( pPortion->GetNode() ); // #114278# Saving both layout mode and language (since I'm // potentially changing both) @@ -3257,10 +3162,10 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, SvxAdjust eJustification = GetJustification( nPara ); - // Berechnung der Breite ohne die Indents... + // Calculation of the width without the Indents ... sal_uInt32 nWidth = 0; - USHORT nPos = pLine->GetStart(); - for ( USHORT nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ ) + sal_uInt16 nPos = pLine->GetStart(); + for ( sal_uInt16 nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ ) { TextPortion* pTextPortion = pPortion->GetTextPortions().GetObject( nTP ); switch ( pTextPortion->GetKind() ) @@ -3297,73 +3202,95 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, return nWidth; } -sal_uInt32 ImpEditEngine::CalcTextHeight() +sal_uInt32 ImpEditEngine::GetTextHeightNTP() const +{ + DBG_ASSERT( GetUpdateMode(), "Should not be used for Update=FALSE: GetTextHeight" ); + DBG_ASSERT( IsFormatted() || IsFormatting(), "GetTextHeight: Not formatted" ); + return nCurTextHeightNTP; +} + +sal_uInt32 ImpEditEngine::CalcTextHeight( sal_uInt32* pHeightNTP ) { - DBG_ASSERT( GetUpdateMode(), "Sollte bei Update=FALSE nicht verwendet werden: CalcTextHeight" ); + OSL_ENSURE( GetUpdateMode(), "Should not be used when Update=FALSE: CalcTextHeight" ); sal_uInt32 nY = 0; - for ( USHORT nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ ) - nY += GetParaPortions()[nPortion]->GetHeight(); + sal_uInt32 nPH; + sal_uInt32 nEmptyHeight = 0; + for ( sal_uInt16 nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ ) { + ParaPortionPtr pPortion = GetParaPortions()[nPortion]; + nPH = pPortion->GetHeight(); + nY += nPH; + if( pHeightNTP ) { + if ( pPortion->IsEmpty() ) + nEmptyHeight += nPH; + else + nEmptyHeight = 0; + } + } + + if ( pHeightNTP ) + *pHeightNTP = nY - nEmptyHeight; + return nY; } -USHORT ImpEditEngine::GetLineCount( USHORT nParagraph ) const +sal_uInt16 ImpEditEngine::GetLineCount( sal_uInt16 nParagraph ) const { - DBG_ASSERT( nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" ); + OSL_ENSURE( nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" ); ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph ); - DBG_ASSERT( pPPortion, "Absatz nicht gefunden: GetLineCount" ); + OSL_ENSURE( pPPortion, "Paragraph not found: GetLineCount" ); if ( pPPortion ) return pPPortion->GetLines().Count(); return 0xFFFF; } -xub_StrLen ImpEditEngine::GetLineLen( USHORT nParagraph, USHORT nLine ) const +xub_StrLen ImpEditEngine::GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const { - DBG_ASSERT( nParagraph < GetParaPortions().Count(), "GetLineLen: Out of range" ); + OSL_ENSURE( nParagraph < GetParaPortions().Count(), "GetLineLen: Out of range" ); ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph ); - DBG_ASSERT( pPPortion, "Absatz nicht gefunden: GetLineLen" ); + OSL_ENSURE( pPPortion, "Paragraph not found: GetLineLen" ); if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) ) { EditLine* pLine = pPPortion->GetLines().GetObject( nLine ); - DBG_ASSERT( pLine, "Zeile nicht gefunden: GetLineHeight" ); + OSL_ENSURE( pLine, "Line not found: GetLineHeight" ); return pLine->GetLen(); } return 0xFFFF; } -void ImpEditEngine::GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const +void ImpEditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const { - DBG_ASSERT( nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" ); + OSL_ENSURE( nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" ); ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph ); - DBG_ASSERT( pPPortion, "Absatz nicht gefunden: GetLineBoundaries" ); + OSL_ENSURE( pPPortion, "Paragraph not found: GetLineBoundaries" ); rStart = rEnd = 0xFFFF; // default values in case of error if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) ) { EditLine* pLine = pPPortion->GetLines().GetObject( nLine ); - DBG_ASSERT( pLine, "Zeile nicht gefunden: GetLineBoundaries" ); + OSL_ENSURE( pLine, "Line not found: GetLineBoundaries" ); rStart = pLine->GetStart(); rEnd = pLine->GetEnd(); } } -USHORT ImpEditEngine::GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const +sal_uInt16 ImpEditEngine::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const { - USHORT nLineNo = 0xFFFF; + sal_uInt16 nLineNo = 0xFFFF; ContentNode* pNode = GetEditDoc().SaveGetObject( nPara ); - DBG_ASSERT( pNode, "GetLineNumberAtIndex: invalid paragraph index" ); + OSL_ENSURE( pNode, "GetLineNumberAtIndex: invalid paragraph index" ); if (pNode) { // we explicitly allow for the index to point at the character right behind the text const bool bValidIndex = /*0 <= nIndex &&*/ nIndex <= pNode->Len(); - DBG_ASSERT( bValidIndex, "GetLineNumberAtIndex: invalid index" ); - const USHORT nLineCount = GetLineCount( nPara ); + OSL_ENSURE( bValidIndex, "GetLineNumberAtIndex: invalid index" ); + const sal_uInt16 nLineCount = GetLineCount( nPara ); if (nIndex == pNode->Len()) nLineNo = nLineCount > 0 ? nLineCount - 1 : 0; else if (bValidIndex) // nIndex < pNode->Len() { - USHORT nStart = USHRT_MAX, nEnd = USHRT_MAX; - for (USHORT i = 0; i < nLineCount && nLineNo == 0xFFFF; ++i) + sal_uInt16 nStart = USHRT_MAX, nEnd = USHRT_MAX; + for (sal_uInt16 i = 0; i < nLineCount && nLineNo == 0xFFFF; ++i) { GetLineBoundaries( nStart, nEnd, nPara, i ); if (nStart <= nIndex && nIndex < nEnd) @@ -3374,27 +3301,27 @@ USHORT ImpEditEngine::GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const return nLineNo; } -USHORT ImpEditEngine::GetLineHeight( USHORT nParagraph, USHORT nLine ) +sal_uInt16 ImpEditEngine::GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine ) { - DBG_ASSERT( nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" ); + OSL_ENSURE( nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" ); ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph ); - DBG_ASSERT( pPPortion, "Absatz nicht gefunden: GetLineHeight" ); + OSL_ENSURE( pPPortion, "Paragraph not found: GetLineHeight" ); if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) ) { EditLine* pLine = pPPortion->GetLines().GetObject( nLine ); - DBG_ASSERT( pLine, "Zeile nicht gefunden: GetLineHeight" ); + OSL_ENSURE( pLine, "Paragraph not found: GetLineHeight" ); return pLine->GetHeight(); } return 0xFFFF; } -sal_uInt32 ImpEditEngine::GetParaHeight( USHORT nParagraph ) +sal_uInt32 ImpEditEngine::GetParaHeight( sal_uInt16 nParagraph ) { sal_uInt32 nHeight = 0; ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph ); - DBG_ASSERT( pPPortion, "Absatz nicht gefunden: GetParaHeight" ); + OSL_ENSURE( pPPortion, "Paragraph not found: GetParaHeight" ); if ( pPPortion ) nHeight = pPPortion->GetHeight(); @@ -3404,55 +3331,55 @@ sal_uInt32 ImpEditEngine::GetParaHeight( USHORT nParagraph ) void ImpEditEngine::UpdateSelections() { - USHORT nInvNodes = aDeletedNodes.Count(); + sal_uInt16 nInvNodes = aDeletedNodes.Count(); - // Pruefen, ob eine der Selektionen auf einem geloeschten Node steht... - // Wenn der Node gueltig ist, muss noch der Index geprueft werden! - for ( USHORT nView = 0; nView < aEditViews.Count(); nView++ ) + // Check whether one of the selections is at a deleted node... + // If the node is valid, the index has yet to be examined! + for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ ) { EditView* pView = aEditViews.GetObject(nView); DBG_CHKOBJ( pView, EditView, 0 ); EditSelection aCurSel( pView->pImpEditView->GetEditSelection() ); - BOOL bChanged = FALSE; - for ( USHORT n = 0; n < nInvNodes; n++ ) + sal_Bool bChanged = sal_False; + for ( sal_uInt16 n = 0; n < nInvNodes; n++ ) { DeletedNodeInfo* pInf = aDeletedNodes.GetObject( n ); - if ( ( ( ULONG )(aCurSel.Min().GetNode()) == pInf->GetInvalidAdress() ) || - ( ( ULONG )(aCurSel.Max().GetNode()) == pInf->GetInvalidAdress() ) ) + if ( ( ( sal_uLong )(aCurSel.Min().GetNode()) == pInf->GetInvalidAdress() ) || + ( ( sal_uLong )(aCurSel.Max().GetNode()) == pInf->GetInvalidAdress() ) ) { - // ParaPortions verwenden, da jetzt auch versteckte - // Absaetze beruecksichtigt werden muessen! - USHORT nPara = pInf->GetPosition(); + // Use ParaPortions, as now also hidden paragraphs have to be + // taken into account! + sal_uInt16 nPara = pInf->GetPosition(); ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nPara ); - if ( !pPPortion ) // letzter Absatz + if ( !pPPortion ) // Last paragraph { nPara = GetParaPortions().Count()-1; pPPortion = GetParaPortions().GetObject( nPara ); } - DBG_ASSERT( pPPortion, "Leeres Document in UpdateSelections ?" ); - // Nicht aus einem verstecktem Absatz landen: - USHORT nCurPara = nPara; - USHORT nLastPara = GetParaPortions().Count()-1; + OSL_ENSURE( pPPortion, "Empty Document in UpdateSelections ?" ); + // Do not end up from a hidden paragraph: + sal_uInt16 nCurPara = nPara; + sal_uInt16 nLastPara = GetParaPortions().Count()-1; while ( nPara <= nLastPara && !GetParaPortions()[nPara]->IsVisible() ) nPara++; - if ( nPara > nLastPara ) // dann eben rueckwaerts... + if ( nPara > nLastPara ) // then also backwards ... { nPara = nCurPara; while ( nPara && !GetParaPortions()[nPara]->IsVisible() ) nPara--; } - DBG_ASSERT( GetParaPortions()[nPara]->IsVisible(), "Keinen sichtbaren Absatz gefunden: UpdateSelections" ); + OSL_ENSURE( GetParaPortions()[nPara]->IsVisible(), "No visible paragraph found: UpdateSelections" ); ParaPortion* pParaPortion = GetParaPortions()[nPara]; EditSelection aTmpSelection( EditPaM( pParaPortion->GetNode(), 0 ) ); pView->pImpEditView->SetEditSelection( aTmpSelection ); - bChanged=TRUE; - break; // for-Schleife + bChanged=sal_True; + break; // for loop } } if ( !bChanged ) { - // Index prueffen, falls Node geschrumpft. + // Check Index if node shrunk. if ( aCurSel.Min().GetIndex() > aCurSel.Min().GetNode()->Len() ) { aCurSel.Min().GetIndex() = aCurSel.Min().GetNode()->Len(); @@ -3466,8 +3393,8 @@ void ImpEditEngine::UpdateSelections() } } - // Loeschen... - for ( USHORT n = 0; n < nInvNodes; n++ ) + // Delete ... + for ( sal_uInt16 n = 0; n < nInvNodes; n++ ) { DeletedNodeInfo* pInf = aDeletedNodes.GetObject( n ); delete pInf; @@ -3475,14 +3402,14 @@ void ImpEditEngine::UpdateSelections() aDeletedNodes.Remove( 0, aDeletedNodes.Count() ); } -EditSelection ImpEditEngine::ConvertSelection( USHORT nStartPara, USHORT nStartPos, - USHORT nEndPara, USHORT nEndPos ) const +EditSelection ImpEditEngine::ConvertSelection( sal_uInt16 nStartPara, sal_uInt16 nStartPos, + sal_uInt16 nEndPara, sal_uInt16 nEndPos ) const { EditSelection aNewSelection; // Start... ContentNode* pNode = aEditDoc.SaveGetObject( nStartPara ); - USHORT nIndex = nStartPos; + sal_uInt16 nIndex = nStartPos; if ( !pNode ) { pNode = aEditDoc[ aEditDoc.Count()-1 ]; @@ -3522,24 +3449,24 @@ EditSelection ImpEditEngine::MatchGroup( const EditSelection& rSel ) return aMatchSel; } - USHORT nPos = aTmpSel.Min().GetIndex(); + sal_uInt16 nPos = aTmpSel.Min().GetIndex(); ContentNode* pNode = aTmpSel.Min().GetNode(); if ( nPos >= pNode->Len() ) return aMatchSel; - USHORT nMatchChar = aGroupChars.Search( pNode->GetChar( nPos ) ); + sal_uInt16 nMatchChar = aGroupChars.Search( pNode->GetChar( nPos ) ); if ( nMatchChar != STRING_NOTFOUND ) { - USHORT nNode = aEditDoc.GetPos( pNode ); + sal_uInt16 nNode = aEditDoc.GetPos( pNode ); if ( ( nMatchChar % 2 ) == 0 ) { - // Vorwaerts suchen... + // Search forward... xub_Unicode nSC = aGroupChars.GetChar( nMatchChar ); - DBG_ASSERT( aGroupChars.Len() > (nMatchChar+1), "Ungueltige Gruppe von MatchChars!" ); + OSL_ENSURE( aGroupChars.Len() > (nMatchChar+1), "Invalid group of MatchChars!" ); xub_Unicode nEC = aGroupChars.GetChar( nMatchChar+1 ); - USHORT nCur = aTmpSel.Min().GetIndex()+1; - USHORT nLevel = 1; + sal_uInt16 nCur = aTmpSel.Min().GetIndex()+1; + sal_uInt16 nLevel = 1; while ( pNode && nLevel ) { XubString& rStr = *pNode; @@ -3563,7 +3490,7 @@ EditSelection ImpEditEngine::MatchGroup( const EditSelection& rSel ) nCur = 0; } } - if ( nLevel == 0 ) // gefunden + if ( nLevel == 0 ) // found { aMatchSel.Min() = aTmpSel.Min(); aMatchSel.Max() = EditPaM( pNode, nCur+1 ); @@ -3571,12 +3498,12 @@ EditSelection ImpEditEngine::MatchGroup( const EditSelection& rSel ) } else { - // Rueckwaerts suchen... + // Search backwards... xub_Unicode nEC = aGroupChars.GetChar( nMatchChar ); xub_Unicode nSC = aGroupChars.GetChar( nMatchChar-1 ); - USHORT nCur = aTmpSel.Min().GetIndex()-1; - USHORT nLevel = 1; + sal_uInt16 nCur = aTmpSel.Min().GetIndex()-1; + sal_uInt16 nLevel = 1; while ( pNode && nLevel ) { if ( pNode->Len() ) @@ -3601,14 +3528,14 @@ EditSelection ImpEditEngine::MatchGroup( const EditSelection& rSel ) { pNode = nNode ? aEditDoc.GetObject( --nNode ) : 0; if ( pNode ) - nCur = pNode->Len()-1; // egal ob negativ, weil if Len() + nCur = pNode->Len()-1; // no matter if negative, because if Len () } } - if ( nLevel == 0 ) // gefunden + if ( nLevel == 0 ) // found { aMatchSel.Min() = aTmpSel.Min(); - aMatchSel.Min().GetIndex()++; // hinter das Zeichen + aMatchSel.Min().GetIndex()++; // after the character aMatchSel.Max() = EditPaM( pNode, nCur ); } } @@ -3620,31 +3547,31 @@ void ImpEditEngine::StopSelectionMode() { if ( ( IsInSelectionMode() || aSelEngine.IsInSelection() ) && pActiveView ) { - pActiveView->pImpEditView->DrawSelection(); // Wegzeichnen... + pActiveView->pImpEditView->DrawSelection(); EditSelection aSel( pActiveView->pImpEditView->GetEditSelection() ); aSel.Min() = aSel.Max(); pActiveView->pImpEditView->SetEditSelection( aSel ); pActiveView->ShowCursor(); aSelEngine.Reset(); - bInSelection = FALSE; + bInSelection = sal_False; } } void ImpEditEngine::SetActiveView( EditView* pView ) { // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // Eigentlich waere jetzt ein bHasVisSel und HideSelection notwendig !!! + // Actually, now bHasVisSel and HideSelection would be necessary !!! if ( pView == pActiveView ) return; if ( pActiveView && pActiveView->HasSelection() ) - pActiveView->pImpEditView->DrawSelection(); // Wegzeichnen... + pActiveView->pImpEditView->DrawSelection(); pActiveView = pView; if ( pActiveView && pActiveView->HasSelection() ) - pActiveView->pImpEditView->DrawSelection(); // Wegzeichnen... + pActiveView->pImpEditView->DrawSelection(); // NN: Quick fix for #78668#: // When editing of a cell in Calc is ended, the edit engine is not deleted, @@ -3663,7 +3590,6 @@ void ImpEditEngine::SetActiveView( EditView* pView ) uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable( const EditSelection& rSelection ) const { -#ifndef SVX_LIGHT EditSelection aSelection( rSelection ); aSelection.Adjust( GetEditDoc() ); @@ -3672,13 +3598,13 @@ uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable( xDataObj = pDataObj; XubString aText( GetSelected( aSelection ) ); - aText.ConvertLineEnd(); // Systemspezifisch + aText.ConvertLineEnd(); // System specific pDataObj->GetString() = aText; - SvxFontItem::EnableStoreUnicodeNames( TRUE ); - WriteBin( pDataObj->GetStream(), aSelection, TRUE ); + SvxFontItem::EnableStoreUnicodeNames( sal_True ); + WriteBin( pDataObj->GetStream(), aSelection, sal_True ); pDataObj->GetStream().Seek( 0 ); - SvxFontItem::EnableStoreUnicodeNames( FALSE ); + SvxFontItem::EnableStoreUnicodeNames( sal_False ); ((ImpEditEngine*)this)->WriteRTF( pDataObj->GetRTFStream(), aSelection ); pDataObj->GetRTFStream().Seek( 0 ); @@ -3705,19 +3631,16 @@ uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable( } return xDataObj; -#else - return uno::Reference< datatransfer::XTransferable >(); -#endif } -EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransferable >& rxDataObj, const String& rBaseURL, const EditPaM& rPaM, BOOL bUseSpecial ) +EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransferable >& rxDataObj, const String& rBaseURL, const EditPaM& rPaM, sal_Bool bUseSpecial ) { EditSelection aNewSelection( rPaM ); if ( rxDataObj.is() ) { datatransfer::DataFlavor aFlavor; - BOOL bDone = FALSE; + sal_Bool bDone = sal_False; if ( bUseSpecial ) { @@ -3734,7 +3657,7 @@ EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransfer SvMemoryStream aBinStream( aSeq.getArray(), aSeq.getLength(), STREAM_READ ); aNewSelection = Read( aBinStream, rBaseURL, EE_FORMAT_BIN, rPaM ); } - bDone = TRUE; + bDone = sal_True; } catch( const ::com::sun::star::uno::Exception& ) { @@ -3743,24 +3666,6 @@ EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransfer if ( !bDone ) { - // Bookmark - /* - String aURL = ...; - String aTxt = ...; - // Feld nur einfuegen, wenn Factory vorhanden. - if ( ITEMDATA() && ITEMDATA()->GetClassManager().Get( SVX_URLFIELD ) ) - { - SvxFieldItem aField( SvxURLField( aURL, aTxt, SVXURLFORMAT_URL ), EE_FEATURE_FIELD ); - aNewSelection = InsertField( aPaM, aField ); - UpdateFields(); - } - else - aNewSelection = ImpInsertText( aPaM, aURL ); - } - */ - } - if ( !bDone ) - { // RTF SotExchange::GetFormatDataFlavor( SOT_FORMAT_RTF, aFlavor ); if ( rxDataObj->isDataFlavorSupported( aFlavor ) ) @@ -3774,7 +3679,7 @@ EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransfer SvMemoryStream aRTFStream( aSeq.getArray(), aSeq.getLength(), STREAM_READ ); aNewSelection = Read( aRTFStream, rBaseURL, EE_FORMAT_RTF, rPaM ); } - bDone = TRUE; + bDone = sal_True; } catch( const ::com::sun::star::uno::Exception& ) { @@ -3798,7 +3703,7 @@ EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransfer ::rtl::OUString aText; aData >>= aText; aNewSelection = ImpInsertText( rPaM, aText ); - bDone = TRUE; + bDone = sal_True; } catch( ... ) { @@ -3819,12 +3724,12 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion ) { const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE ); const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL ); - USHORT nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) + sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; - // erst von vorne... - USHORT nFirstInvalid = 0xFFFF; - USHORT nLine; + // only from the top ... + sal_uInt16 nFirstInvalid = 0xFFFF; + sal_uInt16 nLine; for ( nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) { EditLine* pL = pPortion->GetLines().GetObject( nLine ); @@ -3833,20 +3738,20 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion ) nFirstInvalid = nLine; break; } - if ( nLine && !aStatus.IsOutliner() ) // nicht die erste Zeile + if ( nLine && !aStatus.IsOutliner() ) // not the first line aRange.Min() += nSBL; aRange.Min() += pL->GetHeight(); } - DBG_ASSERT( nFirstInvalid != 0xFFFF, "Keine ungueltige Zeile gefunden in GetInvalidYOffset(1)" ); + OSL_ENSURE( nFirstInvalid != 0xFFFF, "No invalid line found in GetInvalidYOffset(1)" ); - // Abgleichen und weiter... + // Syndicate and more ... aRange.Max() = aRange.Min(); aRange.Max() += pPortion->GetFirstLineOffset(); - if ( nFirstInvalid != 0 ) // Nur wenn nicht die erste Zeile ungueltig + if ( nFirstInvalid != 0 ) // Only if the first line is invalid aRange.Min() = aRange.Max(); - USHORT nLastInvalid = pPortion->GetLines().Count()-1; + sal_uInt16 nLastInvalid = pPortion->GetLines().Count()-1; for ( nLine = nFirstInvalid; nLine < pPortion->GetLines().Count(); nLine++ ) { EditLine* pL = pPortion->GetLines().GetObject( nLine ); @@ -3861,7 +3766,6 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion ) aRange.Max() += pL->GetHeight(); } - // MT 07/00 SBL kann jetzt kleiner 100% sein => ggf. die Zeile davor neu ausgeben. if( ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) && rLSItem.GetPropLineSpace() && ( rLSItem.GetPropLineSpace() < 100 ) ) { @@ -3878,50 +3782,50 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion ) return aRange; } -EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, BOOL bSmart ) +EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bSmart ) { - DBG_ASSERT( pPortion->IsVisible(), "Wozu GetPaM() bei einem unsichtbaren Absatz?" ); - DBG_ASSERT( IsFormatted(), "GetPaM: Nicht formatiert" ); + OSL_ENSURE( pPortion->IsVisible(), "Why GetPaM() for an invisible paragraph?" ); + OSL_ENSURE( IsFormatted(), "GetPaM: Not formatted" ); - USHORT nCurIndex = 0; + sal_uInt16 nCurIndex = 0; EditPaM aPaM; aPaM.SetNode( pPortion->GetNode() ); const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL ); - USHORT nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) + sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; long nY = pPortion->GetFirstLineOffset(); - DBG_ASSERT( pPortion->GetLines().Count(), "Leere ParaPortion in GetPaM!" ); + OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetPaM!" ); EditLine* pLine = 0; - for ( USHORT nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) + for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) { EditLine* pTmpLine = pPortion->GetLines().GetObject( nLine ); nY += pTmpLine->GetHeight(); if ( !aStatus.IsOutliner() ) nY += nSBL; - if ( nY > aDocPos.Y() ) // das war 'se + if ( nY > aDocPos.Y() ) { pLine = pTmpLine; - break; // richtige Y-Position intressiert nicht + break; // correct Y-position is not of interest } nCurIndex = nCurIndex + pTmpLine->GetLen(); } - if ( !pLine ) // darf nur im Bereich von SA passieren! + if ( !pLine ) // may happen only in the range of SA! { #ifdef DBG_UTIL const SvxULSpaceItem& rULSpace =(const SvxULSpaceItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE ); - DBG_ASSERT( nY+GetYValue( rULSpace.GetLower() ) >= aDocPos.Y() , "Index in keiner Zeile, GetPaM ?" ); + OSL_ENSURE( nY+GetYValue( rULSpace.GetLower() ) >= aDocPos.Y() , "Index in no line, GetPaM ?" ); #endif aPaM.SetIndex( pPortion->GetNode()->Len() ); return aPaM; } - // Wenn Zeile gefunden, nur noch X-Position => Index + // If no line found, only just X-Position => Index nCurIndex = GetChar( pPortion, pLine, aDocPos.X(), bSmart ); aPaM.SetIndex( nCurIndex ); @@ -3934,16 +3838,16 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, BOOL bSmart return aPaM; } -USHORT ImpEditEngine::GetChar( ParaPortion* pParaPortion, EditLine* pLine, long nXPos, BOOL bSmart ) +sal_uInt16 ImpEditEngine::GetChar( ParaPortion* pParaPortion, EditLine* pLine, long nXPos, sal_Bool bSmart ) { - DBG_ASSERT( pLine, "Keine Zeile erhalten: GetChar" ); + OSL_ENSURE( pLine, "No line received: GetChar" ); - USHORT nChar = 0xFFFF; - USHORT nCurIndex = pLine->GetStart(); + sal_uInt16 nChar = 0xFFFF; + sal_uInt16 nCurIndex = pLine->GetStart(); // Search best matching portion with GetPortionXOffset() - for ( USHORT i = pLine->GetStartPortion(); i <= pLine->GetEndPortion(); i++ ) + for ( sal_uInt16 i = pLine->GetStartPortion(); i <= pLine->GetEndPortion(); i++ ) { TextPortion* pPortion = pParaPortion->GetTextPortions().GetObject( i ); long nXLeft = GetPortionXOffset( pParaPortion, pLine, i ); @@ -3968,26 +3872,26 @@ USHORT ImpEditEngine::GetChar( ParaPortion* pParaPortion, EditLine* pLine, long } else { - USHORT nMax = pPortion->GetLen(); - USHORT nOffset = 0xFFFF; - USHORT nTmpCurIndex = nChar - pLine->GetStart(); + sal_uInt16 nMax = pPortion->GetLen(); + sal_uInt16 nOffset = 0xFFFF; + sal_uInt16 nTmpCurIndex = nChar - pLine->GetStart(); long nXInPortion = nXPos - nXLeft; if ( pPortion->IsRightToLeft() ) nXInPortion = nXRight - nXPos; // Search in Array... - for ( USHORT x = 0; x < nMax; x++ ) + for ( sal_uInt16 x = 0; x < nMax; x++ ) { long nTmpPosMax = pLine->GetCharPosArray().GetObject( nTmpCurIndex+x ); if ( nTmpPosMax > nXInPortion ) { - // pruefen, ob dieser oder der davor... + // Check whether this or the previous... long nTmpPosMin = x ? pLine->GetCharPosArray().GetObject( nTmpCurIndex+x-1 ) : 0; long nDiffLeft = nXInPortion - nTmpPosMin; long nDiffRight = nTmpPosMax - nXInPortion; - DBG_ASSERT( nDiffLeft >= 0, "DiffLeft negativ" ); - DBG_ASSERT( nDiffRight >= 0, "DiffRight negativ" ); + OSL_ENSURE( nDiffLeft >= 0, "DiffLeft negative" ); + OSL_ENSURE( nDiffRight >= 0, "DiffRight negative" ); nOffset = ( bSmart && ( nDiffRight < nDiffLeft ) ) ? x+1 : x; // I18N: If there are character position with the length of 0, // they belong to the same character, we can not use this position as an index. @@ -4002,13 +3906,13 @@ USHORT ImpEditEngine::GetChar( ParaPortion* pParaPortion, EditLine* pLine, long } } - // Bei Verwendung des CharPosArray duerfte es keine Ungenauigkeiten geben! - // Vielleicht bei Kerning ? - // 0xFFF passiert z.B. bei Outline-Font, wenn ganz hinten. + // There should not be any inaccuracies when using the + // CharPosArray! Maybe for kerning? + // 0xFFF happens for example for Outline-Font when at the very end. if ( nOffset == 0xFFFF ) nOffset = nMax; - DBG_ASSERT( nOffset <= nMax, "nOffset > nMax" ); + OSL_ENSURE( nOffset <= nMax, "nOffset > nMax" ); nChar = nChar + nOffset; @@ -4016,14 +3920,14 @@ USHORT ImpEditEngine::GetChar( ParaPortion* pParaPortion, EditLine* pLine, long if ( nChar && ( nChar < pParaPortion->GetNode()->Len() ) ) { EditPaM aPaM( pParaPortion->GetNode(), nChar+1 ); - USHORT nScriptType = GetScriptType( aPaM ); + sal_uInt16 nScriptType = GetScriptType( aPaM ); if ( nScriptType == i18n::ScriptType::COMPLEX ) { uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() ); sal_Int32 nCount = 1; lang::Locale aLocale = GetLocale( aPaM ); - USHORT nRight = (USHORT)_xBI->nextCharacters( *pParaPortion->GetNode(), nChar, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount ); - USHORT nLeft = (USHORT)_xBI->previousCharacters( *pParaPortion->GetNode(), nRight, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount ); + sal_uInt16 nRight = (sal_uInt16)_xBI->nextCharacters( *pParaPortion->GetNode(), nChar, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount ); + sal_uInt16 nLeft = (sal_uInt16)_xBI->previousCharacters( *pParaPortion->GetNode(), nRight, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount ); if ( ( nLeft != nChar ) && ( nRight != nChar ) ) { nChar = ( Abs( nRight - nChar ) < Abs( nLeft - nChar ) ) ? nRight : nLeft; @@ -4048,7 +3952,7 @@ Range ImpEditEngine::GetLineXPosStartEnd( ParaPortion* pParaPortion, EditLine* p { Range aLineXPosStartEnd; - USHORT nPara = GetEditDoc().GetPos( pParaPortion->GetNode() ); + sal_uInt16 nPara = GetEditDoc().GetPos( pParaPortion->GetNode() ); if ( !IsRightToLeft( nPara ) ) { aLineXPosStartEnd.Min() = pLine->GetStartPosX(); @@ -4064,11 +3968,11 @@ Range ImpEditEngine::GetLineXPosStartEnd( ParaPortion* pParaPortion, EditLine* p return aLineXPosStartEnd; } -long ImpEditEngine::GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLine, USHORT nTextPortion ) +long ImpEditEngine::GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion ) { long nX = pLine->GetStartPosX(); - for ( USHORT i = pLine->GetStartPortion(); i < nTextPortion; i++ ) + for ( sal_uInt16 i = pLine->GetStartPortion(); i < nTextPortion; i++ ) { TextPortion* pPortion = pParaPortion->GetTextPortions().GetObject( i ); switch ( pPortion->GetKind() ) @@ -4077,7 +3981,6 @@ long ImpEditEngine::GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLin case PORTIONKIND_TEXT: case PORTIONKIND_HYPHENATOR: case PORTIONKIND_TAB: -// case PORTIONKIND_EXTRASPACE: { nX += pPortion->GetSize().Width(); } @@ -4085,8 +3988,8 @@ long ImpEditEngine::GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLin } } - USHORT nPara = GetEditDoc().GetPos( pParaPortion->GetNode() ); - BOOL bR2LPara = IsRightToLeft( nPara ); + sal_uInt16 nPara = GetEditDoc().GetPos( pParaPortion->GetNode() ); + sal_Bool bR2LPara = IsRightToLeft( nPara ); TextPortion* pDestPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion ); if ( pDestPortion->GetKind() != PORTIONKIND_TAB ) @@ -4118,7 +4021,7 @@ long ImpEditEngine::GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLin } else if ( bR2LPara && !pDestPortion->IsRightToLeft() ) { - // Portions behind must be ermoved, visual behind this portion + // Portions behind must be removed, visual behind this portion sal_uInt16 nTmpPortion = nTextPortion+1; while ( nTmpPortion <= pLine->GetEndPortion() ) { @@ -4145,8 +4048,8 @@ long ImpEditEngine::GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLin if ( bR2LPara ) { // Switch X postions... - DBG_ASSERT( GetTextRanger() || GetPaperSize().Width(), "GetPortionXOffset - paper size?!" ); - DBG_ASSERT( GetTextRanger() || (nX <= GetPaperSize().Width()), "GetPortionXOffset - position out of paper size!" ); + OSL_ENSURE( GetTextRanger() || GetPaperSize().Width(), "GetPortionXOffset - paper size?!" ); + OSL_ENSURE( GetTextRanger() || (nX <= GetPaperSize().Width()), "GetPortionXOffset - position out of paper size!" ); nX = GetPaperSize().Width() - nX; nX -= pDestPortion->GetSize().Width(); } @@ -4154,22 +4057,22 @@ long ImpEditEngine::GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLin return nX; } -long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, USHORT nIndex, BOOL bPreferPortionStart ) +long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, sal_Bool bPreferPortionStart ) { - DBG_ASSERT( pLine, "Keine Zeile erhalten: GetXPos" ); - DBG_ASSERT( ( nIndex >= pLine->GetStart() ) && ( nIndex <= pLine->GetEnd() ) , "GetXPos muss richtig gerufen werden!" ); + OSL_ENSURE( pLine, "No line received: GetXPos" ); + OSL_ENSURE( ( nIndex >= pLine->GetStart() ) && ( nIndex <= pLine->GetEnd() ) , "GetXPos has to be called properly!" ); - BOOL bDoPreferPortionStart = bPreferPortionStart; + sal_Bool bDoPreferPortionStart = bPreferPortionStart; // Assure that the portion belongs to this line: if ( nIndex == pLine->GetStart() ) - bDoPreferPortionStart = TRUE; + bDoPreferPortionStart = sal_True; else if ( nIndex == pLine->GetEnd() ) - bDoPreferPortionStart = FALSE; + bDoPreferPortionStart = sal_False; - USHORT nTextPortionStart = 0; - USHORT nTextPortion = pParaPortion->GetTextPortions().FindPortion( nIndex, nTextPortionStart, bDoPreferPortionStart ); + sal_uInt16 nTextPortionStart = 0; + sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( nIndex, nTextPortionStart, bDoPreferPortionStart ); - DBG_ASSERT( ( nTextPortion >= pLine->GetStartPortion() ) && ( nTextPortion <= pLine->GetEndPortion() ), "GetXPos: Portion not in current line! " ); + OSL_ENSURE( ( nTextPortion >= pLine->GetStartPortion() ) && ( nTextPortion <= pLine->GetEndPortion() ), "GetXPos: Portion not in current line! " ); TextPortion* pPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion ); @@ -4194,10 +4097,8 @@ long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, USHORT TextPortion* pNextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion+1 ); if ( pNextPortion->GetKind() != PORTIONKIND_TAB ) { - // DBG_ASSERT( !bPreferPortionStart, "GetXPos - How can we this tab portion here???" ); - // #109879# We loop if nIndex == pLine->GetEnd, because bPreferPortionStart will be reset if ( !bPreferPortionStart ) - nX = GetXPos( pParaPortion, pLine, nIndex, TRUE ); + nX = GetXPos( pParaPortion, pLine, nIndex, sal_True ); else if ( !IsRightToLeft( GetEditDoc().GetPos( pParaPortion->GetNode() ) ) ) nX += nPortionTextWidth; } @@ -4214,16 +4115,16 @@ long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, USHORT } else if ( pPortion->GetKind() == PORTIONKIND_TEXT ) { - DBG_ASSERT( nIndex != pLine->GetStart(), "Strange behavior in new GetXPos()" ); - DBG_ASSERT( pLine && pLine->GetCharPosArray().Count(), "svx::ImpEditEngine::GetXPos(), portion in an empty line?" ); + OSL_ENSURE( nIndex != pLine->GetStart(), "Strange behavior in new GetXPos()" ); + OSL_ENSURE( pLine && pLine->GetCharPosArray().Count(), "svx::ImpEditEngine::GetXPos(), portion in an empty line?" ); if( pLine->GetCharPosArray().Count() ) { - USHORT nPos = nIndex - 1 - pLine->GetStart(); + sal_uInt16 nPos = nIndex - 1 - pLine->GetStart(); if( nPos >= pLine->GetCharPosArray().Count() ) { nPos = pLine->GetCharPosArray().Count()-1; - DBG_ERROR("svx::ImpEditEngine::GetXPos(), index out of range!"); + OSL_FAIL("svx::ImpEditEngine::GetXPos(), index out of range!"); } // old code restored see #i112788 (which leaves #i74188 unfixed again) @@ -4243,10 +4144,10 @@ long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, USHORT nX += pPortion->GetExtraInfos()->nPortionOffsetX; if ( pPortion->GetExtraInfos()->nAsianCompressionTypes & CHAR_PUNCTUATIONRIGHT ) { - BYTE nType = GetCharTypeForCompression( pParaPortion->GetNode()->GetChar( nIndex ) ); + sal_uInt8 nType = GetCharTypeForCompression( pParaPortion->GetNode()->GetChar( nIndex ) ); if ( nType == CHAR_PUNCTUATIONRIGHT ) { - USHORT n = nIndex - nTextPortionStart; + sal_uInt16 n = nIndex - nTextPortionStart; const sal_Int32* pDXArray = pLine->GetCharPosArray().GetData()+( nTextPortionStart-pLine->GetStart() ); sal_Int32 nCharWidth = ( ( (n+1) < pPortion->GetLen() ) ? pDXArray[n] : pPortion->GetSize().Width() ) - ( n ? pDXArray[n-1] : 0 ); @@ -4293,15 +4194,15 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion ) if ( pPortion->IsVisible() ) { - DBG_ASSERT( pPortion->GetLines().Count(), "Absatz ohne Zeilen in ParaPortion::CalcHeight" ); - for ( USHORT nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) + OSL_ENSURE( pPortion->GetLines().Count(), "Paragraph with no lines in ParaPortion::CalcHeight" ); + for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) pPortion->nHeight += pPortion->GetLines().GetObject( nLine )->GetHeight(); if ( !aStatus.IsOutliner() ) { const SvxULSpaceItem& rULItem = (const SvxULSpaceItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE ); const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL ); - USHORT nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; + sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; if ( nSBL ) { @@ -4311,17 +4212,17 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion ) pPortion->nHeight += nSBL; } - USHORT nPortion = GetParaPortions().GetPos( pPortion ); + sal_uInt16 nPortion = GetParaPortions().GetPos( pPortion ); if ( nPortion || aStatus.ULSpaceFirstParagraph() ) { - USHORT nUpper = GetYValue( rULItem.GetUpper() ); + sal_uInt16 nUpper = GetYValue( rULItem.GetUpper() ); pPortion->nHeight += nUpper; pPortion->nFirstLineOffset = nUpper; } if ( ( nPortion != (GetParaPortions().Count()-1) ) ) { - pPortion->nHeight += GetYValue( rULItem.GetLower() ); // nicht in letzter + pPortion->nHeight += GetYValue( rULItem.GetLower() ); // not in the last } @@ -4331,48 +4232,47 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion ) const SvxULSpaceItem& rPrevULItem = (const SvxULSpaceItem&)pPrev->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE ); const SvxLineSpacingItem& rPrevLSItem = (const SvxLineSpacingItem&)pPrev->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL ); - // Verhalten WinWord6/Writer3: - // Bei einem proportionalen Zeilenabstand wird auch der Absatzabstand - // manipuliert. - // Nur Writer3: Nicht aufaddieren, sondern Mindestabstand. + // In realation between WinWord6/Writer3: + // With a proportional line spacing the paragraph spacing is + // also manipulated. + // Only Writer3: Do not add up, but minimum distance. - // Pruefen, ob Abstand durch LineSpacing > Upper: - USHORT nExtraSpace = GetYValue( lcl_CalcExtraSpace( pPortion, rLSItem ) ); + // check if distance by LineSpacing > Upper: + sal_uInt16 nExtraSpace = GetYValue( lcl_CalcExtraSpace( pPortion, rLSItem ) ); if ( nExtraSpace > pPortion->nFirstLineOffset ) { - // Absatz wird 'groesser': + // Paragraph becomes 'bigger': pPortion->nHeight += ( nExtraSpace - pPortion->nFirstLineOffset ); pPortion->nFirstLineOffset = nExtraSpace; } - // nFirstLineOffset jetzt f(pNode) => jetzt f(pNode, pPrev) ermitteln: - USHORT nPrevLower = GetYValue( rPrevULItem.GetLower() ); + // Determine nFirstLineOffset now f(pNode) => now f(pNode, pPrev): + sal_uInt16 nPrevLower = GetYValue( rPrevULItem.GetLower() ); - // Dieser PrevLower steckt noch in der Hoehe der PrevPortion... + // This PrevLower is still in the height of PrevPortion ... if ( nPrevLower > pPortion->nFirstLineOffset ) { - // Absatz wird 'kleiner': + // Paragraph is 'small': pPortion->nHeight -= pPortion->nFirstLineOffset; pPortion->nFirstLineOffset = 0; } else if ( nPrevLower ) { - // Absatz wird 'etwas kleiner': + // Paragraph becomes 'somewhat smaller': pPortion->nHeight -= nPrevLower; pPortion->nFirstLineOffset = pPortion->nFirstLineOffset - nPrevLower; } - - // Finde ich zwar nicht so gut, aber Writer3-Feature: - // Pruefen, ob Abstand durch LineSpacing > Lower: - // Dieser Wert steckt nicht in der Hoehe der PrevPortion. + // I find it not so good, but Writer3 feature: + // Check if distance by LineSpacing > Lower: this value is not + // stuck in the height of PrevPortion. if ( !pPrev->IsInvalid() ) { nExtraSpace = GetYValue( lcl_CalcExtraSpace( pPrev, rPrevLSItem ) ); if ( nExtraSpace > nPrevLower ) { - USHORT nMoreLower = nExtraSpace - nPrevLower; - // Absatz wird 'groesser', 'waechst' nach unten: + sal_uInt16 nMoreLower = nExtraSpace - nPrevLower; + // Paragraph becomes 'bigger', 'grows' downwards: if ( nMoreLower > pPortion->nFirstLineOffset ) { pPortion->nHeight += ( nMoreLower - pPortion->nFirstLineOffset ); @@ -4385,29 +4285,29 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion ) } } -Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, USHORT nIndex, USHORT nFlags ) +Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex, sal_uInt16 nFlags ) { - DBG_ASSERT( pPortion->IsVisible(), "Wozu GetEditCursor() bei einem unsichtbaren Absatz?" ); - DBG_ASSERT( IsFormatted() || GetTextRanger(), "GetEditCursor: Nicht formatiert" ); + OSL_ENSURE( pPortion->IsVisible(), "Why GetEditCursor() for an invisible paragraph?" ); + OSL_ENSURE( IsFormatted() || GetTextRanger(), "GetEditCursor: Not formatted" ); /* - GETCRSR_ENDOFLINE: Wenn hinter dem letzten Zeichen einer umgebrochenen Zeile, - am Ende der Zeile bleiben, nicht am Anfang der naechsten. - Zweck: - END => wirklich hinter das letzte Zeichen - - Selektion.... + GETCRSR_ENDOFLINE: If after the last character of a wrapped line, remaining + at the end of the line, not the beginning of the next one. + Purpose: - END => really after the last character + - Selection.... */ long nY = pPortion->GetFirstLineOffset(); const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL ); - USHORT nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) + sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; - USHORT nCurIndex = 0; - DBG_ASSERT( pPortion->GetLines().Count(), "Leere ParaPortion in GetEditCursor!" ); + sal_uInt16 nCurIndex = 0; + OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetEditCursor!" ); EditLine* pLine = 0; - BOOL bEOL = ( nFlags & GETCRSR_ENDOFLINE ) ? TRUE : FALSE; - for ( USHORT nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) + sal_Bool bEOL = ( nFlags & GETCRSR_ENDOFLINE ) ? sal_True : sal_False; + for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) { EditLine* pTmpLine = pPortion->GetLines().GetObject( nLine ); if ( ( pTmpLine->GetStart() == nIndex ) || ( pTmpLine->IsIn( nIndex, bEOL ) ) ) @@ -4423,8 +4323,8 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, USHORT nIndex, US } if ( !pLine ) { - // Cursor am Ende des Absatzes. - DBG_ASSERT( nIndex == nCurIndex, "Index voll daneben in GetEditCursor!" ); + // Cursor at the End of the paragraph. + OSL_ENSURE( nIndex == nCurIndex, "Index dead wrong in GetEditCursor!" ); pLine = pPortion->GetLines().GetObject( pPortion->GetLines().Count()-1 ); nY -= pLine->GetHeight(); @@ -4439,7 +4339,7 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, USHORT nIndex, US nY += pLine->GetHeight(); aEditCursor.Bottom() = nY-1; - // innerhalb der Zeile suchen... + // Search within the line... long nX; if ( ( nIndex == pLine->GetStart() ) && ( nFlags & GETCRSR_STARTOFLINE ) ) @@ -4454,7 +4354,7 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, USHORT nIndex, US } else { - nX = GetXPos( pPortion, pLine, nIndex, ( nFlags & GETCRSR_PREFERPORTIONSTART ) ? TRUE : FALSE ); + nX = GetXPos( pPortion, pLine, nIndex, ( nFlags & GETCRSR_PREFERPORTIONSTART ) ? sal_True : sal_False ); } aEditCursor.Left() = aEditCursor.Right() = nX; @@ -4476,25 +4376,25 @@ void ImpEditEngine::SetValidPaperSize( const Size& rNewSz ) long nMinHeight = aStatus.AutoPageHeight() ? aMinAutoPaperSize.Height() : 0; long nMaxHeight = aStatus.AutoPageHeight() ? aMaxAutoPaperSize.Height() : 0x7FFFFFFF; - // Minimale/Maximale Breite: + // Minimum/Maximum width: if ( aPaperSize.Width() < nMinWidth ) aPaperSize.Width() = nMinWidth; else if ( aPaperSize.Width() > nMaxWidth ) aPaperSize.Width() = nMaxWidth; - // Minimale/Maximale Hoehe: + // Minimum/Maximum height: if ( aPaperSize.Height() < nMinHeight ) aPaperSize.Height() = nMinHeight; else if ( aPaperSize.Height() > nMaxHeight ) aPaperSize.Height() = nMaxHeight; } -void ImpEditEngine::IndentBlock( EditView* pEditView, BOOL bRight ) +void ImpEditEngine::IndentBlock( EditView* pEditView, sal_Bool bRight ) { ESelection aESel( CreateESel( pEditView->pImpEditView->GetEditSelection() ) ); aESel.Adjust(); - // Nur wenn mehrere selektierte Absaetze... + // Only if more selected Paragraphs ... if ( aESel.nEndPara > aESel.nStartPara ) { ESelection aNewSel = aESel; @@ -4503,7 +4403,7 @@ void ImpEditEngine::IndentBlock( EditView* pEditView, BOOL bRight ) if ( aESel.nEndPos == 0 ) { - aESel.nEndPara--; // dann diesen Absatz nicht... + aESel.nEndPara--; // then not this paragraph ... aNewSel.nEndPos = 0; } @@ -4512,18 +4412,18 @@ void ImpEditEngine::IndentBlock( EditView* pEditView, BOOL bRight ) pEditView->pImpEditView->GetEditSelection().Max() ); UndoActionStart( bRight ? EDITUNDO_INDENTBLOCK : EDITUNDO_UNINDENTBLOCK ); - for ( USHORT nPara = aESel.nStartPara; nPara <= aESel.nEndPara; nPara++ ) + for ( sal_uInt16 nPara = aESel.nStartPara; nPara <= aESel.nEndPara; nPara++ ) { ContentNode* pNode = GetEditDoc().GetObject( nPara ); if ( bRight ) { - // Tabs hinzufuegen + // Insert Tabs EditPaM aPaM( pNode, 0 ); InsertTab( aPaM ); } else { - // Tabs entfernen + // Remove Tabs EditCharAttrib* pFeature = pNode->GetCharAttribs().FindFeature( 0 ); if ( pFeature && ( pFeature->GetStart() == 0 ) && ( pFeature->GetItem()->Which() == EE_FEATURE_TAB ) ) @@ -4544,11 +4444,11 @@ void ImpEditEngine::IndentBlock( EditView* pEditView, BOOL bRight ) aNewSel.nEndPos = pLastNode->Len(); pEditView->pImpEditView->SetEditSelection( CreateSel( aNewSel ) ); pEditView->pImpEditView->DrawSelection(); - pEditView->pImpEditView->ShowCursor( FALSE, TRUE ); + pEditView->pImpEditView->ShowCursor( sal_False, sal_True ); } } -rtl::Reference<SvxForbiddenCharactersTable> ImpEditEngine::GetForbiddenCharsTable( BOOL bGetInternal ) const +rtl::Reference<SvxForbiddenCharactersTable> ImpEditEngine::GetForbiddenCharsTable( sal_Bool bGetInternal ) const { rtl::Reference<SvxForbiddenCharactersTable> xF = xForbiddenCharsTable; if ( !xF.is() && bGetInternal ) @@ -4569,37 +4469,26 @@ svtools::ColorConfig& ImpEditEngine::GetColorConfig() return *pColorConfig; } -BOOL ImpEditEngine::IsVisualCursorTravelingEnabled() +sal_Bool ImpEditEngine::IsVisualCursorTravelingEnabled() { - BOOL bVisualCursorTravaling = FALSE; + sal_Bool bVisualCursorTravaling = sal_False; if( !pCTLOptions ) pCTLOptions = new SvtCTLOptions; if ( pCTLOptions->IsCTLFontEnabled() && ( pCTLOptions->GetCTLCursorMovement() == SvtCTLOptions::MOVEMENT_VISUAL ) ) { - bVisualCursorTravaling = TRUE; + bVisualCursorTravaling = sal_True; } return bVisualCursorTravaling; } -BOOL ImpEditEngine::DoVisualCursorTraveling( const ContentNode* ) +sal_Bool ImpEditEngine::DoVisualCursorTraveling( const ContentNode* ) { // Don't check if it's necessary, because we also need it when leaving the paragraph return IsVisualCursorTravelingEnabled(); -/* - BOOL bDoVisualCursorTraveling = FALSE; - - if ( IsVisualCursorTravelingEnabled() && pNode->Len() ) - { - // Only necessary when RTL text in LTR para or LTR text in RTL para - bDoVisualCursorTraveling = HasDifferentRTLLevels( pNode ); - } - - return bDoVisualCursorTraveling; -*/ } @@ -4633,7 +4522,7 @@ void ImpEditEngine::EnterBlockNotifications() void ImpEditEngine::LeaveBlockNotifications() { - DBG_ASSERT( nBlockNotifications, "LeaveBlockNotifications - Why?" ); + OSL_ENSURE( nBlockNotifications, "LeaveBlockNotifications - Why?" ); nBlockNotifications--; if ( !nBlockNotifications ) diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 0bfb819c4a..f6af728d0e 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -36,7 +36,7 @@ #include <vcl/metaact.hxx> #include <vcl/gdimtf.hxx> -#define _SVSTDARR_USHORTS +#define _SVSTDARR_sal_uIt16S #include <svl/svstdarr.hxx> #include <vcl/wrkwin.hxx> @@ -92,25 +92,25 @@ using namespace ::com::sun::star::linguistic2; SV_DECL_VARARR_SORT( SortedPositions, sal_uInt32, 16, 8 ) SV_IMPL_VARARR_SORT( SortedPositions, sal_uInt32 ); -#define CH_HYPH '-' +#define CH_HYPH '-' -#define RESDIFF 10 +#define RESDIFF 10 -#define WRONG_SHOW_MIN 5 -#define WRONG_SHOW_SMALL 11 -#define WRONG_SHOW_MEDIUM 15 +#define WRONG_SHOW_MIN 5 +#define WRONG_SHOW_SMALL 11 +#define WRONG_SHOW_MEDIUM 15 struct TabInfo { - BOOL bValid; + sal_Bool bValid; - SvxTabStop aTabStop; - xub_StrLen nCharPos; - USHORT nTabPortion; - long nStartPosX; - long nTabPos; + SvxTabStop aTabStop; + xub_StrLen nCharPos; + sal_uInt16 nTabPortion; + long nStartPosX; + long nTabPos; - TabInfo() { bValid = FALSE; } + TabInfo() { bValid = sal_False; } }; Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin ) @@ -135,7 +135,7 @@ Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin ) return aTranslatedPos; } -BYTE GetCharTypeForCompression( xub_Unicode cChar ) +sal_uInt8 GetCharTypeForCompression( xub_Unicode cChar ) { switch ( cChar ) { @@ -159,21 +159,20 @@ BYTE GetCharTypeForCompression( xub_Unicode cChar ) } } -void lcl_DrawRedLines( - OutputDevice* pOutDev, - long nFontHeight, - const Point& rPnt, - sal_uInt16 nIndex, - sal_uInt16 nMaxEnd, - const sal_Int32* pDXArray, - WrongList* pWrongs, - short nOrientation, - const Point& rOrigin, - BOOL bVertical, - BOOL bIsRightToLeft ) +void lcl_DrawRedLines( + OutputDevice* pOutDev, + long nFontHeight, + const Point& rPnt, + sal_uInt16 nIndex, + sal_uInt16 nMaxEnd, + const sal_Int32* pDXArray, + WrongList* pWrongs, + short nOrientation, + const Point& rOrigin, + sal_Bool bVertical, + sal_Bool bIsRightToLeft ) { -#ifndef SVX_LIGHT - // Aber nur, wenn Font nicht zu klein... + // But only if font is not too small ... long nHght = pOutDev->LogicToPixel( Size( 0, nFontHeight ) ).Height(); if( WRONG_SHOW_MIN < nHght ) { @@ -192,7 +191,7 @@ void lcl_DrawRedLines( if ( nStart >= nMaxEnd ) break; - if ( nStart < nIndex ) // Wurde korrigiert + if ( nStart < nIndex ) // Corrected nStart = nIndex; if ( nEnd > nMaxEnd ) nEnd = nMaxEnd; @@ -244,7 +243,6 @@ void lcl_DrawRedLines( bWrong = sal_False; } } -#endif // !SVX_LIGHT } Point lcl_ImplCalcRotatedPos( Point rPos, Point rOrigin, double nSin, double nCos ) @@ -286,14 +284,14 @@ sal_Bool lcl_ConnectToPrev( xub_Unicode cCh, xub_Unicode cPrevCh ) // For Kashi // ---------------------------------------------------------------------- -// class ImpEditEngine -// ---------------------------------------------------------------------- +// class ImpEditEngine +// ---------------------------------------------------------------------- void ImpEditEngine::UpdateViews( EditView* pCurView ) { if ( !GetUpdateMode() || IsFormatting() || aInvalidRec.IsEmpty() ) return; - DBG_ASSERT( IsFormatted(), "UpdateViews: Doc nicht formatiert!" ); + DBG_ASSERT( IsFormatted(), "UpdateViews: Doc not formatted!" ); for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ ) { @@ -307,7 +305,7 @@ void ImpEditEngine::UpdateViews( EditView* pCurView ) if ( !aClipRec.IsEmpty() ) { - // in Fensterkoordinaten umwandeln.... + // convert to window coordinates .... aClipRec = pView->pImpEditView->GetWindowPos( aClipRec ); if ( ( pView == pCurView ) ) @@ -344,7 +342,7 @@ IMPL_LINK_INLINE_START( ImpEditEngine, IdleFormatHdl, Timer *, EMPTYARG ) // #i97146# check if that view is still available // else probably the idle format timer fired while we're already // downing - EditView* pView = aIdleFormatter.GetView(); + EditView* pView = aIdleFormatter.GetView(); for( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ ) { if( aEditViews[nView] == pView ) @@ -360,7 +358,7 @@ IMPL_LINK_INLINE_END( ImpEditEngine, IdleFormatHdl, Timer *, EMPTYARG ) void ImpEditEngine::CheckIdleFormatter() { aIdleFormatter.ForceTimeout(); - // Falls kein Idle, aber trotzdem nicht formatiert: + // If not idle, but still not formatted: if ( !IsFormatted() ) FormatDoc(); } @@ -381,7 +379,7 @@ void ImpEditEngine::FormatDoc() bIsFormatting = sal_True; - // Dann kann ich auch den Spell-Timer starten... + // Then I can also start the spell-timer ... if ( GetStatus().DoOnlineSpelling() ) StartOnlineSpellTimer(); @@ -390,10 +388,10 @@ void ImpEditEngine::FormatDoc() Font aOldFont( GetRefDevice()->GetFont() ); - // Hier schon, damit nicht jedesmal in CreateLines... + // Here already, so that not always in CreateLines... sal_Bool bMapChanged = ImpCheckRefMapMode(); - aInvalidRec = Rectangle(); // leermachen + aInvalidRec = Rectangle(); // make empty for ( sal_uInt16 nPara = 0; nPara < GetParaPortions().Count(); nPara++ ) { ParaPortion* pParaPortion = GetParaPortions().GetObject( nPara ); @@ -408,17 +406,13 @@ void ImpEditEngine::FormatDoc() pParaPortion->MarkSelectionInvalid( 0, pParaPortion->GetNode()->Len() ); } } - // bei MustRepaint() sollte keine Formatierung noetig sein! - // 23.1.95: Evtl. ist sie durch eine andere Aktion aber doch - // ungueltig geworden! -// if ( pParaPortion->MustRepaint() || CreateLines( nPara ) ) + // No formatting should be necessary for MustRepaint()! if ( ( pParaPortion->MustRepaint() && !pParaPortion->IsInvalid() ) || CreateLines( nPara, nY ) ) { if ( !bGrow && GetTextRanger() ) { - // Bei einer Aenderung der Hoehe muss alles weiter unten - // neu formatiert werden... + // For a change in height all below must be reformatted ... for ( sal_uInt16 n = nPara+1; n < GetParaPortions().Count(); n++ ) { ParaPortion* pPP = GetParaPortions().GetObject( n ); @@ -432,10 +426,10 @@ void ImpEditEngine::FormatDoc() pParaPortion->SetMustRepaint( sal_False ); } - // InvalidRec nur einmal setzen... + // InvalidRec set only once... if ( aInvalidRec.IsEmpty() ) { - // Bei Paperwidth 0 (AutoPageSize) bleibt es sonst Empty()... + // For Paperwidth 0 (AutoPageSize) it would otherwise be Empty()... long nWidth = Max( (long)1, ( !IsVertical() ? aPaperSize.Width() : aPaperSize.Height() ) ); Range aInvRange( GetInvalidYOffsets( pParaPortion ) ); aInvalidRec = Rectangle( Point( 0, nY+aInvRange.Min() ), @@ -453,11 +447,11 @@ void ImpEditEngine::FormatDoc() nY += pParaPortion->GetHeight(); } - // Man kann auch durch UpdateMode An=>AUS=>AN in die Formatierung gelangen... - // Optimierung erst nach Vobis-Auslieferung aktivieren... -// if ( !aInvalidRec.IsEmpty() ) + // One can also get into the formatting through UpdateMode ON=>OFF=>ON... + // enable optimization first after Vobis delivery ... { - sal_uInt32 nNewHeight = CalcTextHeight(); + sal_uInt32 nNewHeightNTP; + sal_uInt32 nNewHeight = CalcTextHeight( &nNewHeightNTP ); long nDiff = nNewHeight - nCurTextHeight; if ( nDiff ) aStatus.GetStatusWord() |= !IsVertical() ? EE_STAT_TEXTHEIGHTCHANGED : EE_STAT_TEXTWIDTHCHANGED; @@ -467,13 +461,14 @@ void ImpEditEngine::FormatDoc() if ( aInvalidRec.IsEmpty() ) { aInvalidRec.Top() = 0; - // Left und Right werden nicht ausgewertet, aber wegen IsEmpty gesetzt. + // Left and Right are not evaluated, are however set due to IsEmpty. aInvalidRec.Left() = 0; aInvalidRec.Right() = !IsVertical() ? aPaperSize.Width() : aPaperSize.Height(); } } nCurTextHeight = nNewHeight; + nCurTextHeightNTP = nNewHeightNTP; if ( aStatus.AutoPageSize() ) CheckAutoPageSize(); @@ -505,7 +500,7 @@ void ImpEditEngine::FormatDoc() if ( bMapChanged ) GetRefDevice()->Pop(); - CallStatusHdl(); // Falls Modified... + CallStatusHdl(); // If Modified... LeaveBlockNotifications(); } @@ -539,31 +534,30 @@ void ImpEditEngine::CheckAutoPageSize() { Size aPrevPaperSize( GetPaperSize() ); if ( GetStatus().AutoPageWidth() ) - aPaperSize.Width() = (long) !IsVertical() ? CalcTextWidth( TRUE ) : GetTextHeight(); + aPaperSize.Width() = (long) !IsVertical() ? CalcTextWidth( sal_True ) : GetTextHeight(); if ( GetStatus().AutoPageHeight() ) - aPaperSize.Height() = (long) !IsVertical() ? GetTextHeight() : CalcTextWidth( TRUE ); + aPaperSize.Height() = (long) !IsVertical() ? GetTextHeight() : CalcTextWidth( sal_True ); - SetValidPaperSize( aPaperSize ); //Min, Max beruecksichtigen + SetValidPaperSize( aPaperSize ); // consider Min, Max if ( aPaperSize != aPrevPaperSize ) { if ( ( !IsVertical() && ( aPaperSize.Width() != aPrevPaperSize.Width() ) ) || ( IsVertical() && ( aPaperSize.Height() != aPrevPaperSize.Height() ) ) ) { - // Falls davor zentriert/rechts oder Tabs... + // If ahead is centered / right or tabs ... aStatus.GetStatusWord() |= !IsVertical() ? EE_STAT_TEXTWIDTHCHANGED : EE_STAT_TEXTHEIGHTCHANGED; for ( sal_uInt16 nPara = 0; nPara < GetParaPortions().Count(); nPara++ ) { - // Es brauchen nur Absaetze neu formatiert werden, - // die nicht linksbuendig sind. - // Die Hoehe kann sich hier nicht mehr aendern. + // Only paragraphs which are not aligned to the left need to be + // reformatted, the height can not be changed here anymore. ParaPortion* pParaPortion = GetParaPortions().GetObject( nPara ); ContentNode* pNode = pParaPortion->GetNode(); SvxAdjust eJustification = GetJustification( nPara ); if ( eJustification != SVX_ADJUST_LEFT ) { pParaPortion->MarkSelectionInvalid( 0, pNode->Len() ); - CreateLines( nPara, 0 ); // 0: Bei AutoPageSize kein TextRange! + CreateLines( nPara, 0 ); // 0: For AutoPageSize no TextRange! } } } @@ -593,27 +587,27 @@ void ImpEditEngine::CheckAutoPageSize() static sal_Int32 ImplCalculateFontIndependentLineSpacing( const sal_Int32 nFontHeight ) { - return ( nFontHeight * 12 ) / 10; // + 20% + return ( nFontHeight * 12 ) / 10; // + 20% } -sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) +sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) { ParaPortion* pParaPortion = GetParaPortions().GetObject( nPara ); - // sal_Bool: Aenderung der Hoehe des Absatzes Ja/Nein - sal_True/sal_False - DBG_ASSERT( pParaPortion->GetNode(), "Portion ohne Node in CreateLines" ); - DBG_ASSERT( pParaPortion->IsVisible(), "Unsichtbare Absaetze nicht formatieren!" ); - DBG_ASSERT( pParaPortion->IsInvalid(), "CreateLines: Portion nicht invalid!" ); + // sal_Bool: Changes in the height of paragraph Yes / No - sal_True/sal_False + DBG_ASSERT( pParaPortion->GetNode(), "Portion without Node in CreateLines" ); + DBG_ASSERT( pParaPortion->IsVisible(), "Invisible paragraphs not formatted!" ); + DBG_ASSERT( pParaPortion->IsInvalid(), "CreateLines: Portion not invalid!" ); - BOOL bProcessingEmptyLine = ( pParaPortion->GetNode()->Len() == 0 ); - BOOL bEmptyNodeWithPolygon = ( pParaPortion->GetNode()->Len() == 0 ) && GetTextRanger(); + sal_Bool bProcessingEmptyLine = ( pParaPortion->GetNode()->Len() == 0 ); + sal_Bool bEmptyNodeWithPolygon = ( pParaPortion->GetNode()->Len() == 0 ) && GetTextRanger(); // --------------------------------------------------------------- - // Schnelle Sonderbehandlung fuer leere Absaetze... + // Fast special treatment for empty paragraphs ... // --------------------------------------------------------------- if ( ( pParaPortion->GetNode()->Len() == 0 ) && !GetTextRanger() ) { - // schnelle Sonderbehandlung... + // fast special treatment ... if ( pParaPortion->GetTextPortions().Count() ) pParaPortion->GetTextPortions().Reset(); if ( pParaPortion->GetLines().Count() ) @@ -623,10 +617,10 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } // --------------------------------------------------------------- - // Initialisierung...... + // Initialization ...... // --------------------------------------------------------------- - // Immer fuer 100% formatieren: + // Always format for 100%: sal_Bool bMapChanged = ImpCheckRefMapMode(); if ( pParaPortion->GetLines().Count() == 0 ) @@ -636,11 +630,11 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } // --------------------------------------------------------------- - // Absatzattribute holen...... + // Get Paragraph attributes ...... // --------------------------------------------------------------- ContentNode* const pNode = pParaPortion->GetNode(); - BOOL bRightToLeftPara = IsRightToLeft( nPara ); + sal_Bool bRightToLeftPara = IsRightToLeft( nPara ); SvxAdjust eJustification = GetJustification( nPara ); sal_Bool bHyphenatePara = ((const SfxBoolItem&)pNode->GetContentAttribs().GetItem( EE_PARA_HYPHENATE )).GetValue(); @@ -649,11 +643,8 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth( pNode, &nSpaceBefore, &nMinLabelWidth ); const SvxLRSpaceItem& rLRItem = GetLRSpaceItem( pNode ); const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&) pNode->GetContentAttribs().GetItem( EE_PARA_SBL ); - const BOOL bScriptSpace = ((const SvxScriptSpaceItem&) pNode->GetContentAttribs().GetItem( EE_PARA_ASIANCJKSPACING )).GetValue(); + const sal_Bool bScriptSpace = ((const SvxScriptSpaceItem&) pNode->GetContentAttribs().GetItem( EE_PARA_ASIANCJKSPACING )).GetValue(); -// const sal_uInt16 nInvalidEnd = ( pParaPortion->GetInvalidDiff() > 0 ) -// ? pParaPortion->GetInvalidPosStart() + pParaPortion->GetInvalidDiff() -// : pNode->Len(); const short nInvalidDiff = pParaPortion->GetInvalidDiff(); const sal_uInt16 nInvalidStart = pParaPortion->GetInvalidPosStart(); const sal_uInt16 nInvalidEnd = nInvalidStart + Abs( nInvalidDiff ); @@ -668,15 +659,15 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } else if ( ( pParaPortion->IsSimpleInvalid() ) && ( nInvalidDiff < 0 ) ) { - // pruefen, ob loeschen ueber Portiongrenzen erfolgte... - sal_uInt16 nStart = nInvalidStart; // DOPPELT !!!!!!!!!!!!!!! - sal_uInt16 nEnd = nStart - nInvalidDiff; // neg. + // check if delete over the portion boundaries was done ... + sal_uInt16 nStart = nInvalidStart; // DOUBLE !!!!!!!!!!!!!!! + sal_uInt16 nEnd = nStart - nInvalidDiff; // negative bQuickFormat = sal_True; sal_uInt16 nPos = 0; sal_uInt16 nPortions = pParaPortion->GetTextPortions().Count(); for ( sal_uInt16 nTP = 0; nTP < nPortions; nTP++ ) { - // Es darf kein Start/Ende im geloeschten Bereich liegen. + // There must be no start / end in the deleted area. TextPortion* const pTP = pParaPortion->GetTextPortions()[ nTP ]; nPos = nPos + pTP->GetLen(); if ( ( nPos > nStart ) && ( nPos < nEnd ) ) @@ -690,9 +681,7 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) // SW disables TEXT_LAYOUT_COMPLEX_DISABLED, so maybe I have to enable it... - // #114278# Saving both layout mode and language (since I'm - // potentially changing both) - + // Saving both layout mode and language (since I'm potentially changing both) GetRefDevice()->Push( PUSH_TEXTLAYOUTMODE|PUSH_TEXTLANGUAGE ); ImplInitLayoutMode( GetRefDevice(), nPara, 0xFFFF ); @@ -707,33 +696,33 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } else if ( bQuickFormat ) { - // schnellere Methode: + // faster Method: RecalcTextPortion( pParaPortion, nInvalidStart, nInvalidDiff ); } - else // nRealInvalidStart kann vor InvalidStart liegen, weil Portions geloescht.... + else // nRealInvalidStart can be before InvalidStart, since Portions were deleted.... { CreateTextPortions( pParaPortion, nRealInvalidStart ); } // --------------------------------------------------------------- - // Zeile mit InvalidPos suchen, eine Zeile davor beginnen... - // Zeilen flaggen => nicht removen ! + // Search for line with InvalidPos, start one line before + // Flag the line => do not remove it ! // --------------------------------------------------------------- sal_uInt16 nLine = pParaPortion->GetLines().Count()-1; for ( sal_uInt16 nL = 0; nL <= nLine; nL++ ) { EditLine* pLine = pParaPortion->GetLines().GetObject( nL ); - if ( pLine->GetEnd() > nRealInvalidStart ) // nicht nInvalidStart! + if ( pLine->GetEnd() > nRealInvalidStart ) // not nInvalidStart! { nLine = nL; break; } pLine->SetValid(); } - // Eine Zeile davor beginnen... - // Wenn ganz hinten getippt wird, kann sich die Zeile davor nicht aendern. + // Begin one line before... + // If it is typed at the end, the line in front cannot change. if ( nLine && ( !pParaPortion->IsSimpleInvalid() || ( nInvalidEnd < pNode->Len() ) || ( nInvalidDiff <= 0 ) ) ) nLine--; @@ -747,11 +736,11 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) if ( aBulletArea.Right() > 0 ) pParaPortion->SetBulletX( (sal_uInt16) GetXValue( aBulletArea.Right() ) ); else - pParaPortion->SetBulletX( 0 ); // Falls Bullet falsch eingestellt. + pParaPortion->SetBulletX( 0 ); // if Bullet is set incorrectly } // --------------------------------------------------------------- - // Ab hier alle Zeilen durchformatieren... + // Reformat all lines from here ... // --------------------------------------------------------------- sal_uInt16 nDelFromLine = 0xFFFF; sal_Bool bLineBreak = sal_False; @@ -763,15 +752,15 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) sal_Bool bCalcCharPositions = sal_True; sal_Int32* pBuf = new sal_Int32[ pNode->Len() ]; - sal_Bool bSameLineAgain = sal_False; // Fuer TextRanger, wenn sich die Hoehe aendert. + sal_Bool bSameLineAgain = sal_False; // For TextRanger, if the height changes. TabInfo aCurrentTab; - BOOL bForceOneRun = bEmptyNodeWithPolygon; - BOOL bCompressedChars = FALSE; + sal_Bool bForceOneRun = bEmptyNodeWithPolygon; + sal_Bool bCompressedChars = sal_False; while ( ( nIndex < pNode->Len() ) || bForceOneRun ) { - bForceOneRun = FALSE; + bForceOneRun = sal_False; sal_Bool bEOL = sal_False; sal_Bool bEOC = sal_False; @@ -786,8 +775,6 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) if ( !nLine && ( pParaPortion->GetBulletX() > nStartX ) ) { -// TL_NFLR nStartX += nFI; // Vielleicht reicht der LI? -// TL_NFLR if ( pParaPortion->GetBulletX() > nStartX ) nStartX = pParaPortion->GetBulletX(); } } @@ -801,20 +788,20 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) nMaxLineWidth -= GetXValue( rLRItem.GetRight() ); nMaxLineWidth -= nStartX; - // Wenn PaperSize == long_max, kann ich keinen neg. Erstzeileneinzug - // abziehen (Overflow) + // If PaperSize == long_max, one cannot take away any negative + // first line indent. (Overflow) if ( ( nMaxLineWidth < 0 ) && ( nStartX < 0 ) ) nMaxLineWidth = ( !IsVertical() ? aPaperSize.Width() : aPaperSize.Height() ) - GetXValue( rLRItem.GetRight() ); - // Wenn jetzt noch kleiner 0, kann es nur der rechte Rand sein. + // If still less than 0, it may be just the right edge. if ( nMaxLineWidth <= 0 ) nMaxLineWidth = 1; - // Problem: Da eine Zeile _vor_ der ungueltigen Position mit der - // Formatierung begonnen wird, werden hier leider auch die Positionen - // neu bestimmt... - // Loesungsansatz: - // Die Zeile davor kann nur groesser werden, nicht kleiner + // Problem: + // Since formatting starts a line _before_ the invalid position, + // the positions unfortunately have to be redefined ... + // Solution: + // The line before can only become longer, not smaller // => ... if ( bCalcCharPositions ) pLine->GetCharPosArray().Remove( 0, pLine->GetCharPosArray().Count() ); @@ -823,10 +810,10 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) sal_uInt16 nTmpPortion = pLine->GetStartPortion(); long nTmpWidth = 0; long nXWidth = nMaxLineWidth; - if ( nXWidth <= nTmpWidth ) // while muss 1x durchlaufen werden + if ( nXWidth <= nTmpWidth ) // while has to be looped once nXWidth = nTmpWidth+1; - SvLongsPtr pTextRanges = 0; + LongDqPtr pTextRanges = 0; long nTextExtraYOffset = 0; long nTextXOffset = 0; long nTextLineHeight = 0; @@ -845,7 +832,7 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) nTextLineHeight = ImplCalculateFontIndependentLineSpacing( aTmpFont.GetHeight() ); else nTextLineHeight = aTmpFont.GetPhysTxtSize( GetRefDevice(), String() ).Height(); - // Metriken koennen groesser sein + // Metrics can be greater FormatterFontMetric aTempFormatterMetrics; RecalcFormatterFontMetrics( aTempFormatterMetrics, aTmpFont ); sal_uInt16 nLineHeight = aTempFormatterMetrics.GetHeight(); @@ -869,16 +856,15 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) pTextRanges = GetTextRanger()->GetTextRanges( Range( nYOff, nYOff + nYDiff ) ); DBG_ASSERT( pTextRanges, "GetTextRanges?!" ); long nMaxRangeWidth = 0; - // Den breitesten Bereich verwenden... - // Der breiteste Bereich koennte etwas verwirren, also - // generell den ersten. Am besten mal richtig mit Luecken. -// for ( sal_uInt16 n = 0; n < pTextRanges->Count(); ) - if ( pTextRanges->Count() ) + // Use the widest range ... + // The widest range could be a bit confusing, so normally it + // is the first one. Best with gaps. + if ( pTextRanges->size() ) { sal_uInt16 n = 0; - long nA = pTextRanges->GetObject( n++ ); - long nB = pTextRanges->GetObject( n++ ); - DBG_ASSERT( nA <= nB, "TextRange verdreht?" ); + long nA = pTextRanges->at(n++); + long nB = pTextRanges->at(n++); + DBG_ASSERT( nA <= nB, "TextRange distorted?" ); long nW = nB - nA; if ( nW > nMaxRangeWidth ) { @@ -891,20 +877,20 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) nMaxLineWidth = nXWidth - nStartX - GetXValue( rLRItem.GetRight() ); else { - // Weiter unten im Polygon versuchen. - // Unterhalb des Polygons die Paperbreite verwenden. + // Try further down in the polygon. + // Below the polygon use the Paper Width. nTextExtraYOffset += Max( (long)(nTextLineHeight / 10), (long)1 ); if ( ( nTextY + nTextExtraYOffset ) > GetTextRanger()->GetBoundRect().Bottom() ) { nXWidth = !IsVertical() ? GetPaperSize().Width() : GetPaperSize().Height(); - if ( !nXWidth ) // AutoPaperSize + if ( !nXWidth ) // AutoPaperSize nXWidth = 0x7FFFFFFF; } } } } - // Portion suchen, die nicht mehr in Zeile passt.... + // search for Portion that no longer fits in line .... TextPortion* pPortion = 0; sal_Bool bBrokenLine = sal_False; bLineBreak = sal_False; @@ -915,8 +901,8 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) pPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion ); if ( pPortion->GetKind() == PORTIONKIND_HYPHENATOR ) { - // Portion wegschmeissen, ggf. die davor korrigieren, wenn - // die Hyph-Portion ein Zeichen geschluckt hat... + // Throw away a Portion, if necessary correct the one before, + // if the Hyph portion has swallowed a character ... pParaPortion->GetTextPortions().Remove( nTmpPortion ); if ( nTmpPortion && pPortion->GetLen() ) { @@ -929,11 +915,12 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) pPrev->GetSize().Width() = (-1); } delete pPortion; - DBG_ASSERT( nTmpPortion < pParaPortion->GetTextPortions().Count(), "Keine Portion mehr da!" ); + DBG_ASSERT( nTmpPortion < pParaPortion->GetTextPortions().Count(), "No more Portions left!" ); pPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion ); } DBG_ASSERT( pPortion->GetKind() != PORTIONKIND_HYPHENATOR, "CreateLines: Hyphenator-Portion!" ); - DBG_ASSERT( pPortion->GetLen() || bProcessingEmptyLine, "Leere Portion in CreateLines ?!" ); + DBG_ASSERT( pPortion->GetLen() || bProcessingEmptyLine, "Empty Portion in CreateLines ?!" ); + (void)bProcessingEmptyLine; if ( pNextFeature && ( pNextFeature->GetStart() == nTmpPos ) ) { sal_uInt16 nWhich = pNextFeature->GetItem()->Which(); @@ -943,17 +930,16 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) { long nOldTmpWidth = nTmpWidth; - // Tab-Pos suchen... + // Search for Tab-Pos... long nCurPos = nTmpWidth+nStartX; -// nCurPos -= rLRItem.GetTxtLeft(); // Tabs relativ zu LI - // Skalierung rausrechnen + // consider scaling if ( aStatus.DoStretch() && ( nStretchX != 100 ) ) nCurPos = nCurPos*100/nStretchX; short nAllSpaceBeforeText = static_cast< short >(rLRItem.GetTxtLeft()/* + rLRItem.GetTxtLeft()*/ + nSpaceBeforeAndMinLabelWidth); aCurrentTab.aTabStop = pNode->GetContentAttribs().FindTabStop( nCurPos - nAllSpaceBeforeText /*rLRItem.GetTxtLeft()*/, aEditDoc.GetDefTab() ); aCurrentTab.nTabPos = GetXValue( (long) ( aCurrentTab.aTabStop.GetTabPos() + nAllSpaceBeforeText /*rLRItem.GetTxtLeft()*/ ) ); - aCurrentTab.bValid = FALSE; + aCurrentTab.bValid = sal_False; // Switch direction in R2L para... if ( bRightToLeftPara ) @@ -968,8 +954,8 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_CENTER ) || ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL ) ) { - // Bei LEFT/DEFAULT wird dieses Tab nicht mehr betrachtet. - aCurrentTab.bValid = TRUE; + // For LEFT / DEFAULT this tab is not considered. + aCurrentTab.bValid = sal_True; aCurrentTab.nStartPosX = nTmpWidth; aCurrentTab.nCharPos = nTmpPos; aCurrentTab.nTabPortion = nTmpPortion; @@ -979,28 +965,27 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) pPortion->SetExtraValue( aCurrentTab.aTabStop.GetFill() ); pPortion->GetSize().Width() = aCurrentTab.nTabPos - (nTmpWidth+nStartX); - // #90520# Height needed... + // Height needed... SeekCursor( pNode, nTmpPos+1, aTmpFont ); pPortion->GetSize().Height() = aTmpFont.QuickGetTextSize( GetRefDevice(), String(), 0, 0, NULL ).Height(); - DBG_ASSERT( pPortion->GetSize().Width() >= 0, "Tab falsch berechnet!" ); + DBG_ASSERT( pPortion->GetSize().Width() >= 0, "Tab incorrectly calculated!" ); nTmpWidth = aCurrentTab.nTabPos-nStartX; - // Wenn dies das erste Token in der Zeile ist, - // und nTmpWidth > aPaperSize.Width, habe ich eine - // Endlos-Schleife! + // If this is the first token on the line, + // and nTmpWidth > aPaperSize.Width, => infinite loop! if ( ( nTmpWidth >= nXWidth ) && ( nTmpPortion == pLine->GetStartPortion() ) ) { - // Aber was jetzt ? - // Tab passend machen + // What now? + // make the tab fitting pPortion->GetSize().Width() = nXWidth-nOldTmpWidth; nTmpWidth = nXWidth-1; bEOL = sal_True; bBrokenLine = sal_True; } pLine->GetCharPosArray().Insert( pPortion->GetSize().Width(), nTmpPos-pLine->GetStart() ); - bCompressedChars = FALSE; + bCompressedChars = sal_False; } break; case EE_FEATURE_LINEBR: @@ -1010,15 +995,14 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) bEOL = sal_True; bLineBreak = sal_True; pPortion->GetKind() = PORTIONKIND_LINEBREAK; - bCompressedChars = FALSE; + bCompressedChars = sal_False; pLine->GetCharPosArray().Insert( pPortion->GetSize().Width(), nTmpPos-pLine->GetStart() ); } break; case EE_FEATURE_FIELD: { -// long nCurWidth = nTmpWidth; SeekCursor( pNode, nTmpPos+1, aTmpFont ); - sal_Unicode cChar = 0; // later: NBS? + sal_Unicode cChar = 0; // later: NBS? aTmpFont.SetPhysFont( GetRefDevice() ); ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() ); @@ -1026,16 +1010,15 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) if ( bCalcCharPositions || !pPortion->HasValidSize() ) { pPortion->GetSize() = aTmpFont.QuickGetTextSize( GetRefDevice(), aFieldValue, 0, aFieldValue.Len(), 0 ); - // Damit kein Scrollen bei ueberlangen Feldern + // So no scrolling for oversized fields if ( pPortion->GetSize().Width() > nXWidth ) pPortion->GetSize().Width() = nXWidth; } nTmpWidth += pPortion->GetSize().Width(); pLine->GetCharPosArray().Insert( pPortion->GetSize().Width(), nTmpPos-pLine->GetStart() ); pPortion->GetKind() = cChar ? PORTIONKIND_TEXT : PORTIONKIND_FIELD; - // Wenn dies das erste Token in der Zeile ist, - // und nTmpWidth > aPaperSize.Width, habe ich eine - // Endlos-Schleife! + // If this is the first token on the line, + // and nTmpWidth > aPaperSize.Width, => infinite loop! if ( ( nTmpWidth >= nXWidth ) && ( nTmpPortion == pLine->GetStartPortion() ) ) { nTmpWidth = nXWidth-1; @@ -1044,16 +1027,17 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } // Compression in Fields???? // I think this could be a little bit difficult and is not very usefull - bCompressedChars = FALSE; + bCompressedChars = sal_False; } break; - default: DBG_ERROR( "Was fuer ein Feature ?" ); + default: OSL_FAIL( "What feature?" ); } pNextFeature = pNode->GetCharAttribs().FindFeature( pNextFeature->GetStart() + 1 ); } else { DBG_ASSERT( pPortion->GetLen() || bProcessingEmptyLine, "Empty Portion - Extra Space?!" ); + (void)bProcessingEmptyLine; SeekCursor( pNode, nTmpPos+1, aTmpFont ); aTmpFont.SetPhysFont( GetRefDevice() ); ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() ); @@ -1071,28 +1055,28 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) if ( bCalcCharPositions ) { sal_uInt16 nLen = pPortion->GetLen(); - // Es wird am Anfang generell das Array geplaettet - // => Immer einfach schnelles insert. + // The array is generally flattened at the beginning + // => Always simply quick inserts. sal_uInt16 nPos = nTmpPos - pLine->GetStart(); pLine->GetCharPosArray().Insert( pBuf, nLen, nPos ); } // And now check for Compression: if ( pPortion->GetLen() && GetAsianCompressionMode() ) - bCompressedChars |= ImplCalcAsianCompression( pNode, pPortion, nTmpPos, (sal_Int32*)pLine->GetCharPosArray().GetData() + (nTmpPos-pLine->GetStart()), 10000, FALSE ); + bCompressedChars |= ImplCalcAsianCompression( pNode, pPortion, nTmpPos, (sal_Int32*)pLine->GetCharPosArray().GetData() + (nTmpPos-pLine->GetStart()), 10000, sal_False ); nTmpWidth += pPortion->GetSize().Width(); pPortion->SetRightToLeft( GetRightToLeft( nPara, nTmpPos+1 ) ); - USHORT _nPortionEnd = nTmpPos + pPortion->GetLen(); + sal_uInt16 _nPortionEnd = nTmpPos + pPortion->GetLen(); if( bScriptSpace && ( _nPortionEnd < pNode->Len() ) && ( nTmpWidth < nXWidth ) && IsScriptChange( EditPaM( pNode, _nPortionEnd ) ) ) { - BOOL bAllow = FALSE; - USHORT nScriptTypeLeft = GetScriptType( EditPaM( pNode, _nPortionEnd ) ); - USHORT nScriptTypeRight = GetScriptType( EditPaM( pNode, _nPortionEnd+1 ) ); + sal_Bool bAllow = sal_False; + sal_uInt16 nScriptTypeLeft = GetScriptType( EditPaM( pNode, _nPortionEnd ) ); + sal_uInt16 nScriptTypeRight = GetScriptType( EditPaM( pNode, _nPortionEnd+1 ) ); if ( ( nScriptTypeLeft == i18n::ScriptType::ASIAN ) || ( nScriptTypeRight == i18n::ScriptType::ASIAN ) ) - bAllow = TRUE; + bAllow = sal_True; // No spacing within L2R/R2L nesting if ( bAllow ) @@ -1108,15 +1092,14 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) if ( aCurrentTab.bValid && ( nTmpPortion != aCurrentTab.nTabPortion ) ) { long nWidthAfterTab = 0; - for ( USHORT n = aCurrentTab.nTabPortion+1; n <= nTmpPortion; n++ ) + for ( sal_uInt16 n = aCurrentTab.nTabPortion+1; n <= nTmpPortion; n++ ) { TextPortion* pTP = pParaPortion->GetTextPortions().GetObject( n ); nWidthAfterTab += pTP->GetSize().Width(); } - long nW = nWidthAfterTab; // Length before tab position + long nW = nWidthAfterTab; // Length before tab position if ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_RIGHT ) { -// nW = nWidthAfterTab; } else if ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_CENTER ) { @@ -1124,26 +1107,25 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } else if ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL ) { -// nW = nWidthAfterTab; String aText = GetSelected( EditSelection( EditPaM( pParaPortion->GetNode(), nTmpPos ), EditPaM( pParaPortion->GetNode(), nTmpPos + pPortion->GetLen() ) ) ); - USHORT nDecPos = aText.Search( aCurrentTab.aTabStop.GetDecimal() ); + sal_uInt16 nDecPos = aText.Search( aCurrentTab.aTabStop.GetDecimal() ); if ( nDecPos != STRING_NOTFOUND ) { nW -= pParaPortion->GetTextPortions().GetObject( nTmpPortion )->GetSize().Width(); nW += aTmpFont.QuickGetTextSize( GetRefDevice(), *pParaPortion->GetNode(), nTmpPos, nDecPos, NULL ).Width(); - aCurrentTab.bValid = FALSE; + aCurrentTab.bValid = sal_False; } } else { - DBG_ERROR( "CreateLines: Tab not handled!" ); + OSL_FAIL( "CreateLines: Tab not handled!" ); } long nMaxW = aCurrentTab.nTabPos - aCurrentTab.nStartPosX - nStartX; if ( nW >= nMaxW ) { nW = nMaxW; - aCurrentTab.bValid = FALSE; + aCurrentTab.bValid = sal_False; } TextPortion* pTabPortion = pParaPortion->GetTextPortions().GetObject( aCurrentTab.nTabPortion ); pTabPortion->GetSize().Width() = aCurrentTab.nTabPos - aCurrentTab.nStartPosX - nW - nStartX; @@ -1159,13 +1141,13 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) DBG_ASSERT( pPortion, "no portion!?" ); - aCurrentTab.bValid = FALSE; + aCurrentTab.bValid = sal_False; - // das war evtl. eine Portion zu weit: + // this was possibly a portion too far: sal_Bool bFixedEnd = sal_False; if ( aStatus.OneCharPerLine() ) { - // Zustand vor Portion: ( bis auf nTmpWidth ) + // State before Portion (apart from nTmpWidth): nPortionEnd = nTmpPos; nTmpPos -= pPortion ? pPortion->GetLen() : 0; nPortionStart = nTmpPos; @@ -1174,14 +1156,14 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) bEOL = sal_True; bEOC = sal_False; - // Und jetzt genau ein Zeichen: + // And now just one character: nTmpPos++; nTmpPortion++; nPortionEnd = nTmpPortion; - // Eine Nicht-Feature-Portion muss gebrochen werden + // one Non-Feature-Portion has to be wrapped if ( pPortion->GetLen() > 1 ) { - DBG_ASSERT( pPortion && (pPortion->GetKind() == PORTIONKIND_TEXT), "Len>1, aber keine TextPortion?" ); + DBG_ASSERT( pPortion && (pPortion->GetKind() == PORTIONKIND_TEXT), "Len>1, but no TextPortion?" ); nTmpWidth -= pPortion ? pPortion->GetSize().Width() : 0; sal_uInt16 nP = SplitTextPortion( pParaPortion, nTmpPos, pLine ); TextPortion* p = pParaPortion->GetTextPortions().GetObject( nP ); @@ -1214,8 +1196,8 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) break; default: { - // Ein Feature wird nicht umgebrochen: - DBG_ASSERT( ( pPortion->GetKind() == PORTIONKIND_LINEBREAK ), "Was fuer ein Feature ?" ); + // A feature is not wrapped: + DBG_ASSERT( ( pPortion->GetKind() == PORTIONKIND_LINEBREAK ), "What Feature ?" ); bEOL = sal_True; bFixedEnd = sal_True; } @@ -1226,7 +1208,7 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) bEOL = sal_True; bEOC = sal_True; pLine->SetEnd( nPortionEnd ); - DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "Keine TextPortions?" ); + DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "No TextPortions?" ); pLine->SetEndPortion( (sal_uInt16)pParaPortion->GetTextPortions().Count() - 1 ); } @@ -1244,17 +1226,17 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) { pLine->SetEnd( nPortionStart+1 ); pLine->SetEndPortion( nTmpPortion-1 ); - bEOC = sal_False; // wurde oben gesetzt, vielleich mal die if's umstellen? + bEOC = sal_False; // was set above, maybe change the sequence of the if's? } else if ( !bEOL ) { - DBG_ASSERT( pPortion && ((nPortionEnd-nPortionStart) == pPortion->GetLen()), "Doch eine andere Portion?!" ); + DBG_ASSERT( pPortion && ((nPortionEnd-nPortionStart) == pPortion->GetLen()), "However, another portion?!" ); long nRemainingWidth = nMaxLineWidth - nTmpWidth; sal_Bool bCanHyphenate = ( aTmpFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL ); if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed ) { // I need the manipulated DXArray for determining the break postion... - ImplCalcAsianCompression( pNode, pPortion, nPortionStart, const_cast<sal_Int32*>(( pLine->GetCharPosArray().GetData() + (nPortionStart-pLine->GetStart()) )), 10000, TRUE ); + ImplCalcAsianCompression( pNode, pPortion, nPortionStart, const_cast<sal_Int32*>(( pLine->GetCharPosArray().GetData() + (nPortionStart-pLine->GetStart()) )), 10000, sal_True ); } if( pPortion ) ImpBreakLine( pParaPortion, pLine, pPortion, nPortionStart, @@ -1262,11 +1244,10 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } // ------------------------------------------------------------------ - // Zeile fertig => justieren + // Line finished => adjust // ------------------------------------------------------------------ - // CalcTextSize sollte besser durch ein kontinuierliches - // Registrieren ersetzt werden ! + // CalcTextSize should be replaced by a continuous registering! Size aTextSize = pLine->CalcTextSize( *pParaPortion ); if ( aTextSize.Height() == 0 ) @@ -1282,16 +1263,15 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) pLine->SetHeight( (sal_uInt16)aTextSize.Height() ); } - // Die Fontmetriken koennen nicht kontinuierlich berechnet werden, - // wenn der Font sowieso eingestellt ist, weil ggf. ein grosser Font - // erst nach dem Umbrechen ploetzlich in der naechsten Zeile landet - // => Font-Metriken zu gross. + // The font metrics can not be calculated continuously, if the font is + // set anyway, because a large font only after wrapping suddenly ends + // up in the next line => Font metrics too big. FormatterFontMetric aFormatterMetrics; sal_uInt16 nTPos = pLine->GetStart(); for ( sal_uInt16 nP = pLine->GetStartPortion(); nP <= pLine->GetEndPortion(); nP++ ) { TextPortion* pTP = pParaPortion->GetTextPortions().GetObject( nP ); - // #95819# problem with hard font height attribute, when everthing but the line break has this attribute + // problem with hard font height attribute, when everthing but the line break has this attribute if ( pTP->GetKind() != PORTIONKIND_LINEBREAK ) { SeekCursor( pNode, nTPos+1, aTmpFont ); @@ -1309,7 +1289,7 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) bSameLineAgain = sal_False; if ( GetTextRanger() && ( pLine->GetHeight() > nTextLineHeight ) ) { - // Nochmal mit der anderen Groesse aufsetzen! + // put down with the other size! bSameLineAgain = sal_True; } @@ -1322,7 +1302,7 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) sal_uInt16 nTxtHeight = pLine->GetHeight(); if ( nTxtHeight < nMinHeight ) { - // Der Ascent muss um die Differenz angepasst werden: + // The Ascent has to be adjusted for the difference: long nDiff = nMinHeight - nTxtHeight; pLine->SetMaxAscent( (sal_uInt16)(pLine->GetMaxAscent() + nDiff) ); pLine->SetHeight( nMinHeight, nTxtHeight ); @@ -1330,9 +1310,9 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } else if ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) { - if ( nPara || IsFixedCellHeight() || pLine->GetStartPortion() ) // Nicht die aller erste Zeile + if ( nPara || IsFixedCellHeight() || pLine->GetStartPortion() ) // Not the very first line { - // #100508# There are documents with PropLineSpace 0, why? + // There are documents with PropLineSpace 0, why? // (cmc: re above question :-) such documents can be seen by importing a .ppt if ( rLSItem.GetPropLineSpace() && ( rLSItem.GetPropLineSpace() != 100 ) ) { @@ -1340,7 +1320,7 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) sal_Int32 nH = nTxtHeight; nH *= rLSItem.GetPropLineSpace(); nH /= 100; - // Der Ascent muss um die Differenz angepasst werden: + // The Ascent has to be adjusted for the difference: long nDiff = pLine->GetHeight() - nH; if ( nDiff > pLine->GetMaxAscent() ) nDiff = pLine->GetMaxAscent(); @@ -1351,27 +1331,13 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } } - - // #80582# - Bullet should not influence line height -// if ( !nLine ) -// { -// long nBulletHeight = aBulletArea.GetHeight(); -// if ( nBulletHeight > (long)pLine->GetHeight() ) -// { -// long nDiff = nBulletHeight - (long)pLine->GetHeight(); -// // nDiff auf oben und unten verteilen. -// pLine->SetMaxAscent( (sal_uInt16)(pLine->GetMaxAscent() + nDiff/2) ); -// pLine->SetHeight( (sal_uInt16)nBulletHeight ); -// } -// } - if ( ( !IsVertical() && aStatus.AutoPageWidth() ) || ( IsVertical() && aStatus.AutoPageHeight() ) ) { - // Wenn die Zeile in die aktuelle Papierbreite passt, muss - // diese Breite fuer die Ausrichting verwendet werden. - // Wenn sie nicht passt oder sie die Papierbreite aendert, - // wird bei Justification != LEFT sowieso noch mal formatiert. + // If the row fits within the current paper width, then this width + // has to be used for the Alignment. If it does not fit or if it + // will change the paper width, it will be formatted again for + // Justification! = LEFT anyway. long nMaxLineWidthFix = ( !IsVertical() ? aPaperSize.Width() : aPaperSize.Height() ) - GetXValue( rLRItem.GetRight() ) - nStartX; if ( aTextSize.Width() < nMaxLineWidthFix ) @@ -1406,7 +1372,7 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) case SVX_ADJUST_CENTER: { long n = ( nMaxLineWidth - aTextSize.Width() ) / 2; - n += nStartX; // Einrueckung bleibt erhalten. + n += nStartX; // Indentation is kept. if ( n > 0 ) pLine->SetStartPosX( (sal_uInt16)n ); else @@ -1416,11 +1382,10 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) break; case SVX_ADJUST_RIGHT: { - // Bei automatisch umgebrochenen Zeilen, die ein Blank - // am Ende enthalten, darf das Blank nicht ausgegeben werden! - + // For automatically wrapped lines, which has a blank at the end + // the blank must not be displayed! long n = nMaxLineWidth - aTextSize.Width(); - n += nStartX; // Einrueckung bleibt erhalten. + n += nStartX; // Indentation is kept. if ( n > 0 ) pLine->SetStartPosX( (sal_uInt16)n ); else @@ -1444,12 +1409,12 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } // ----------------------------------------------------------------- - // pruefen, ob die Zeile neu ausgegeben werden muss... + // Check whether the line must be re-issued ... // ----------------------------------------------------------------- pLine->SetInvalid(); - // Wenn eine Portion umgebrochen wurde sind ggf. viel zu viele Positionen - // im CharPosArray: + // If a portion was wrapped there may be far too many positions in + // CharPosArray: if ( bCalcCharPositions ) { sal_uInt16 nLen = pLine->GetLen(); @@ -1469,14 +1434,13 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } } - // Fuer kleiner 0 noch ueberlegen! - if ( pParaPortion->IsSimpleInvalid() /* && ( nInvalidDiff > 0 ) */ ) + // for <0 think over ! + if ( pParaPortion->IsSimpleInvalid() ) { - // Aenderung durch einfache Textaenderung... - // Formatierung nicht abbrechen, da Portions evtl. wieder - // gesplittet werden muessen! - // Wenn irgendwann mal abbrechbar, dann fogende Zeilen Validieren! - // Aber ggf. als Valid markieren, damit weniger Ausgabe... + // Change through simple Text changes ... + // Do mot cancel formatting since Portions possibly have to be split + // again! If at some point cancelable, then validate the following + // line! But if applicable, mark as valid, so there is less output... if ( pLine->GetEnd() < nInvalidStart ) { if ( *pLine == aSaveLine ) @@ -1506,10 +1470,9 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } else if ( bCalcCharPositions && bQuickFormat && ( nEnd > nInvalidEnd) ) { - // Wenn die ungueltige Zeile so endet, dass die naechste an - // der 'gleichen' Textstelle wie vorher beginnt, also nicht - // anders umgebrochen wird, brauche ich dort auch nicht die - // textbreiten neu bestimmen: + // If the invalid line ends so that the next begins on the + // 'same' passage as before, i.e. not wrapped differently, + // then the text width does not have to be determined anew: if ( nEnd == ( aSaveLine.GetEnd() + nInvalidDiff ) ) { bCalcCharPositions = sal_False; @@ -1523,12 +1486,12 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) if ( !bSameLineAgain ) { - nIndex = pLine->GetEnd(); // naechste Zeile Start = letzte Zeile Ende - // weil nEnd hinter das letzte Zeichen zeigt! + nIndex = pLine->GetEnd(); // next line start = last line end + // as nEnd points to the last charecter! sal_uInt16 nEndPortion = pLine->GetEndPortion(); - // Naechste Zeile oder ggf. neue Zeile.... + // Next line or maybe a new line.... pLine = 0; if ( nLine < pParaPortion->GetLines().Count()-1 ) pLine = pParaPortion->GetLines().GetObject( ++nLine ); @@ -1552,8 +1515,8 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) pParaPortion->GetTextPortions().Insert( pDummyPortion, pParaPortion->GetTextPortions().Count() ); pLine = new EditLine; pParaPortion->GetLines().Insert( pLine, ++nLine ); - bForceOneRun = TRUE; - bProcessingEmptyLine = TRUE; + bForceOneRun = sal_True; + bProcessingEmptyLine = sal_True; } } if ( pLine ) @@ -1565,12 +1528,12 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) pLine->SetEndPortion( nEndPortion+1 ); } } - } // while ( Index < Len ) + } // while ( Index < Len ) if ( nDelFromLine != 0xFFFF ) pParaPortion->GetLines().DeleteFromLine( nDelFromLine ); - DBG_ASSERT( pParaPortion->GetLines().Count(), "Keine Zeile nach CreateLines!" ); + DBG_ASSERT( pParaPortion->GetLines().Count(), "No line after CreateLines!" ); if ( bLineBreak == sal_True ) CreateAndInsertEmptyLine( pParaPortion, nStartPosY ); @@ -1614,7 +1577,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn if ( aBulletArea.Right() > 0 ) pParaPortion->SetBulletX( (sal_uInt16) GetXValue( aBulletArea.Right() ) ); else - pParaPortion->SetBulletX( 0 ); // Falls Bullet falsch eingestellt. + pParaPortion->SetBulletX( 0 ); // If Bullet set incorrectly. if ( pParaPortion->GetBulletX() > nStartX ) { nStartX = (short)GetXValue( rLRItem.GetTxtLeft() + rLRItem.GetTxtFirstLineOfst() + nSpaceBeforeAndMinLabelWidth ); @@ -1642,7 +1605,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn if ( !aStatus.IsOutliner() ) { - USHORT nPara = GetParaPortions().GetPos( pParaPortion ); + sal_uInt16 nPara = GetParaPortions().GetPos( pParaPortion ); SvxAdjust eJustification = GetJustification( nPara ); long nMaxLineWidth = !IsVertical() ? aPaperSize.Width() : aPaperSize.Height(); nMaxLineWidth -= GetXValue( rLRItem.GetRight() ); @@ -1667,7 +1630,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn sal_uInt16 nTxtHeight = pTmpLine->GetHeight(); if ( nTxtHeight < nMinHeight ) { - // Der Ascent muss um die Differenz angepasst werden: + // The Ascent has to be adjusted for the difference: long nDiff = nMinHeight - nTxtHeight; pTmpLine->SetMaxAscent( (sal_uInt16)(pTmpLine->GetMaxAscent() + nDiff) ); pTmpLine->SetHeight( nMinHeight, nTxtHeight ); @@ -1675,10 +1638,10 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn } else if ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) { - USHORT nPara = GetParaPortions().GetPos( pParaPortion ); - if ( nPara || IsFixedCellHeight() || pTmpLine->GetStartPortion() ) // Nicht die aller erste Zeile + sal_uInt16 nPara = GetParaPortions().GetPos( pParaPortion ); + if ( nPara || IsFixedCellHeight() || pTmpLine->GetStartPortion() ) // Not the very first line { - // #100508# There are documents with PropLineSpace 0, why? + // There are documents with PropLineSpace 0, why? // (cmc: re above question :-) such documents can be seen by importing a .ppt if ( rLSItem.GetPropLineSpace() && ( rLSItem.GetPropLineSpace() != 100 ) ) { @@ -1686,7 +1649,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn sal_Int32 nH = nTxtHeight; nH *= rLSItem.GetPropLineSpace(); nH /= 100; - // Der Ascent muss um die Differenz angepasst werden: + // The Ascent has to be adjusted for the difference: long nDiff = pTmpLine->GetHeight() - nH; if ( nDiff > pTmpLine->GetMaxAscent() ) nDiff = pTmpLine->GetMaxAscent(); @@ -1703,21 +1666,19 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn if ( nMinHeight > (long)pTmpLine->GetHeight() ) { long nDiff = nMinHeight - (long)pTmpLine->GetHeight(); - // nDiff auf oben und unten verteilen. + // distribute nDiff upwards and downwards pTmpLine->SetMaxAscent( (sal_uInt16)(pTmpLine->GetMaxAscent() + nDiff/2) ); pTmpLine->SetHeight( (sal_uInt16)nMinHeight ); } } else { - // -2: Die neue ist bereits eingefuegt. + // -2: The new one is already inserted. #ifdef DBG_UTIL EditLine* pLastLine = pParaPortion->GetLines().GetObject( pParaPortion->GetLines().Count()-2 ); - DBG_ASSERT( pLastLine, "Weicher Umbruch, keine Zeile ?!" ); - DBG_ASSERT( pLastLine->GetEnd() == pParaPortion->GetNode()->Len(), "Doch anders?" ); + DBG_ASSERT( pLastLine, "soft wrap no line?!" ); + DBG_ASSERT( pLastLine->GetEnd() == pParaPortion->GetNode()->Len(), "different anyway?" ); #endif -// pTmpLine->SetStart( pLastLine->GetEnd() ); -// pTmpLine->SetEnd( pLastLine->GetEnd() ); sal_uInt16 nPos = (sal_uInt16) pParaPortion->GetTextPortions().Count() - 1 ; pTmpLine->SetStartPortion( nPos ); pTmpLine->SetEndPortion( nPos ); @@ -1726,15 +1687,12 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn sal_Bool ImpEditEngine::FinishCreateLines( ParaPortion* pParaPortion ) { -// CalcCharPositions( pParaPortion ); +// CalcCharPositions( pParaPortion ); pParaPortion->SetValid(); long nOldHeight = pParaPortion->GetHeight(); -// sal_uInt16 nPos = GetParaPortions().GetPos( pParaPortion ); -// DBG_ASSERT( nPos != USHRT_MAX, "FinishCreateLines: Portion nicht in Liste!" ); -// ParaPortion* pPrev = nPos ? GetParaPortions().GetObject( nPos-1 ) : 0; CalcHeight( pParaPortion ); - DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "FinishCreateLines: Keine Text-Portion?" ); + DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "FinishCreateLines: No Text-Portion?" ); sal_Bool bRet = ( pParaPortion->GetHeight() != nOldHeight ); return bRet; } @@ -1766,8 +1724,8 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te else { sal_uInt16 nMinBreakPos = pLine->GetStart(); - USHORT nAttrs = pNode->GetCharAttribs().GetAttribs().Count(); - for ( USHORT nAttr = nAttrs; nAttr; ) + sal_uInt16 nAttrs = pNode->GetCharAttribs().GetAttribs().Count(); + for ( sal_uInt16 nAttr = nAttrs; nAttr; ) { EditCharAttrib* pAttr = pNode->GetCharAttribs().GetAttribs()[--nAttr]; if ( pAttr->IsFeature() && ( pAttr->GetEnd() > nMinBreakPos ) && ( pAttr->GetEnd() <= nMaxBreakPos ) ) @@ -1787,15 +1745,15 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, Sequence< PropertyValue >(), 1 ); i18n::LineBreakUserOptions aUserOptions; - const i18n::ForbiddenCharacters* pForbidden = GetForbiddenCharsTable()->GetForbiddenCharacters( SvxLocaleToLanguage( aLocale ), TRUE ); + const i18n::ForbiddenCharacters* pForbidden = GetForbiddenCharsTable()->GetForbiddenCharacters( SvxLocaleToLanguage( aLocale ), sal_True ); aUserOptions.forbiddenBeginCharacters = pForbidden->beginLine; aUserOptions.forbiddenEndCharacters = pForbidden->endLine; aUserOptions.applyForbiddenRules = ((const SfxBoolItem&)pNode->GetContentAttribs().GetItem( EE_PARA_FORBIDDENRULES )).GetValue(); aUserOptions.allowPunctuationOutsideMargin = ((const SfxBoolItem&)pNode->GetContentAttribs().GetItem( EE_PARA_HANGINGPUNCTUATION )).GetValue(); - aUserOptions.allowHyphenateEnglish = FALSE; + aUserOptions.allowHyphenateEnglish = sal_False; i18n::LineBreakResults aLBR = _xBI->getLineBreak( *pNode, nMaxBreakPos, aLocale, nMinBreakPos, aHyphOptions, aUserOptions ); - nBreakPos = (USHORT)aLBR.breakIndex; + nBreakPos = (sal_uInt16)aLBR.breakIndex; // BUG in I18N - under special condition (break behind field, #87327#) breakIndex is < nMinBreakPos if ( nBreakPos < nMinBreakPos ) @@ -1804,16 +1762,16 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te } else if ( ( nBreakPos > nMaxBreakPos ) && !aUserOptions.allowPunctuationOutsideMargin ) { - DBG_ERROR( "I18N: XBreakIterator::getLineBreak returns position > Max" ); + OSL_FAIL( "I18N: XBreakIterator::getLineBreak returns position > Max" ); nBreakPos = nMaxBreakPos; } - // #101795# nBreakPos can never be outside the portion, even not with hangig punctuation + // nBreakPos can never be outside the portion, even not with hangig punctuation if ( nBreakPos > nMaxBreakPos ) nBreakPos = nMaxBreakPos; // BUG in I18N - the japanese dot is in the next line! - // !!! Testen!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // !!! Test!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if ( (nBreakPos + ( aUserOptions.allowPunctuationOutsideMargin ? 0 : 1 ) ) <= nMaxBreakPos ) { sal_Unicode cFirstInNextLine = ( (nBreakPos+1) < pNode->Len() ) ? pNode->GetChar( nBreakPos ) : 0; @@ -1824,29 +1782,24 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te bHangingPunctuation = ( nBreakPos > nMaxBreakPos ) ? sal_True : sal_False; pLine->SetHangingPunctuation( bHangingPunctuation ); - #ifndef SVX_LIGHT - // Egal ob Trenner oder nicht: Das Wort nach dem Trenner durch - // die Silbentrennung jagen... - // nMaxBreakPos ist das letzte Zeichen was in die Zeile passt, - // nBreakPos ist der Wort-Anfang - // Ein Problem gibt es, wenn das Dok so schmal ist, dass ein Wort - // auf mehr als Zwei Zeilen gebrochen wird... + // Whether a separator or not, push the word after the separator through + // hyphenation ... NMaxBreakPos is the last character that fits into + // the line, nBreakPos is the beginning of the word. + // There is a problem if the Doc is so narrow that a word is broken + // into more than two lines ... if ( !bHangingPunctuation && bCanHyphenate && GetHyphenator().is() ) { i18n::Boundary aBoundary = _xBI->getWordBoundary( *pNode, nBreakPos, GetLocale( EditPaM( pNode, nBreakPos ) ), ::com::sun::star::i18n::WordType::DICTIONARY_WORD, sal_True ); -// sal_uInt16 nWordStart = nBreakPos; -// sal_uInt16 nBreakPos_OLD = nBreakPos; sal_uInt16 nWordStart = nBreakPos; - sal_uInt16 nWordEnd = (USHORT) aBoundary.endPos; + sal_uInt16 nWordEnd = (sal_uInt16) aBoundary.endPos; DBG_ASSERT( nWordEnd > nWordStart, "ImpBreakLine: Start >= End?" ); - USHORT nWordLen = nWordEnd - nWordStart; + sal_uInt16 nWordLen = nWordEnd - nWordStart; if ( ( nWordEnd >= nMaxBreakPos ) && ( nWordLen > 3 ) ) { - // #104415# May happen, because getLineBreak may differ from getWordBoudary with DICTIONARY_WORD - // DBG_ASSERT( nWordEnd >= nMaxBreakPos, "Hyph: Break?" ); + // May happen, because getLineBreak may differ from getWordBoudary with DICTIONARY_WORD String aWord( *pNode, nWordStart, nWordLen ); - sal_uInt16 nMinTrail = nWordEnd-nMaxBreakPos+1; //+1: Vor dem angeknacksten Buchstaben + sal_uInt16 nMinTrail = nWordEnd-nMaxBreakPos+1; //+1: Before the dickey letter Reference< XHyphenatedWord > xHyphWord; if (xHyphenator.is()) xHyphWord = xHyphenator->hyphenate( aWord, aLocale, aWord.Len() - nMinTrail, Sequence< PropertyValue >() ); @@ -1866,27 +1819,25 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te { String aAlt( xHyphWord->getHyphenatedWord() ); - // Wir gehen von zwei Faellen aus, die nun - // vorliegen koennen: - // 1) packen wird zu pak-ken - // 2) Schiffahrt wird zu Schiff-fahrt - // In Fall 1 muss ein Zeichen ersetzt werden, - // in Fall 2 wird ein Zeichen hinzugefuegt. - // Die Identifikation wird erschwert durch Worte wie - // "Schiffahrtsbrennesseln", da der Hyphenator alle - // Position des Wortes auftrennt und "Schifffahrtsbrennnesseln" - // ermittelt. Wir koennen also eigentlich nicht unmittelbar vom - // Index des AlternativWord auf aWord schliessen. - - // Das ganze geraffel wird durch eine Funktion am - // Hyphenator vereinfacht werden, sobald AMA sie einbaut... + // We expect the two cases, which might exist now: + // 1) packen becomes pak-ken + // 2) Schiffahrt becomes Schiff-fahrt + // In case 1, a character has to be replaced + // in case 2 a character is added. + // The identification is complicated by long + // compound words because the Hyphenator separates + // all position of the word. + // "Schiffahrtsbrennesseln" -> "Schifffahrtsbrennnesseln" + // We can thus actually not directly connect the index of the + // AlternativeWord to aWord. The whole issue will be simplified + // by a function in the Hyphenator as soon as AMA builds this in... sal_uInt16 nAltStart = _nWordLen - 1; sal_uInt16 nTxtStart = nAltStart - (aAlt.Len() - aWord.Len()); sal_uInt16 nTxtEnd = nTxtStart; sal_uInt16 nAltEnd = nAltStart; - // Die Bereiche zwischen den nStart und nEnd ist - // die Differenz zwischen Alternativ- und OriginalString. + // The regions between the nStart and nEnd is the + // difference between alternative and original string. while( nTxtEnd < aWord.Len() && nAltEnd < aAlt.Len() && aWord.GetChar(nTxtEnd) != aAlt.GetChar(nAltEnd) ) { @@ -1894,7 +1845,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te ++nAltEnd; } - // Wenn ein Zeichen hinzugekommen ist, dann bemerken wir es jetzt: + // If a character is added, then we notice it now: if( nAltEnd > nTxtEnd && nAltStart == nAltEnd && aWord.GetChar( nTxtEnd ) == aAlt.GetChar(nAltEnd) ) { @@ -1903,7 +1854,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te ++nTxtEnd; } - DBG_ASSERT( ( nAltEnd - nAltStart ) == 1, "Alternate: Falsche Annahme!" ); + DBG_ASSERT( ( nAltEnd - nAltStart ) == 1, "Alternate: Wrong assumption!" ); if ( nTxtEnd > nTxtStart ) cAlternateReplChar = aAlt.GetChar( nAltStart ); @@ -1920,26 +1871,24 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te } } - #endif // !SVX_LIGHT - if ( nBreakPos <= pLine->GetStart() ) { - // keine Trenner in Zeile => abhacken ! + // No separator in line => Chop! nBreakPos = nMaxBreakPos; - // MT: I18N nextCharacters !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // I18N nextCharacters ! if ( nBreakPos <= pLine->GetStart() ) - nBreakPos = pLine->GetStart() + 1; // Sonst Endlosschleife! + nBreakPos = pLine->GetStart() + 1; // Otherwise infinite loop! } } - // die angeknackste Portion ist die End-Portion + // the dickey portion is the end portion pLine->SetEnd( nBreakPos ); sal_uInt16 nEndPortion = SplitTextPortion( pParaPortion, nBreakPos, pLine ); if ( !bCompressBlank && !bHangingPunctuation ) { - // #96187# When justification is not SVX_ADJUST_LEFT, it's important to compress + // When justification is not SVX_ADJUST_LEFT, it's important to compress // the trailing space even if there is enough room for the space... // Don't check for SVX_ADJUST_LEFT, doesn't matter to compress in this case too... DBG_ASSERT( nBreakPos > pLine->GetStart(), "ImpBreakLines - BreakPos not expected!" ); @@ -1950,15 +1899,15 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te if ( bCompressBlank || bHangingPunctuation ) { TextPortion* pTP = pParaPortion->GetTextPortions().GetObject( nEndPortion ); - DBG_ASSERT( pTP->GetKind() == PORTIONKIND_TEXT, "BlankRubber: Keine TextPortion!" ); - DBG_ASSERT( nBreakPos > pLine->GetStart(), "SplitTextPortion am Anfang der Zeile?" ); + DBG_ASSERT( pTP->GetKind() == PORTIONKIND_TEXT, "BlankRubber: No TextPortion!" ); + DBG_ASSERT( nBreakPos > pLine->GetStart(), "SplitTextPortion at the beginning of the line?" ); sal_uInt16 nPosInArray = nBreakPos - 1 - pLine->GetStart(); pTP->GetSize().Width() = ( nPosInArray && ( pTP->GetLen() > 1 ) ) ? pLine->GetCharPosArray()[ nPosInArray-1 ] : 0; pLine->GetCharPosArray()[ nPosInArray ] = pTP->GetSize().Width(); } else if ( bHyphenated ) { - // Eine Portion fuer den Trenner einbauen... + // A portion for inserting the separator ... TextPortion* pHyphPortion = new TextPortion( 0 ); pHyphPortion->GetKind() = PORTIONKIND_HYPHENATOR; String aHyphText( CH_HYPH ); @@ -1969,7 +1918,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te pPrev->SetLen( pPrev->GetLen() - 1 ); pHyphPortion->SetLen( 1 ); pHyphPortion->SetExtraValue( cAlternateReplChar ); - // Breite der Portion davor korrigieren: + // Correct width of the portion above: pPrev->GetSize().Width() = pLine->GetCharPosArray()[ nBreakPos-1 - pLine->GetStart() - 1 ]; } @@ -1979,7 +1928,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te aHyphText.Insert( cAlternateExtraChar, 0 ); } - // Breite der Hyph-Portion ermitteln: + // Determine the width of the Hyph-Portion: SvxFont aFont; SeekCursor( pParaPortion->GetNode(), nBreakPos, aFont ); aFont.SetPhysFont( GetRefDevice() ); @@ -1993,25 +1942,25 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, long nRemainingSpace ) { - DBG_ASSERT( nRemainingSpace > 0, "AdjustBlocks: Etwas zuwenig..." ); - DBG_ASSERT( pLine, "AdjustBlocks: Zeile ?!" ); + DBG_ASSERT( nRemainingSpace > 0, "AdjustBlocks: Somewhat too little..." ); + DBG_ASSERT( pLine, "AdjustBlocks: Line ?!" ); if ( ( nRemainingSpace < 0 ) || pLine->IsEmpty() ) return ; - const USHORT nFirstChar = pLine->GetStart(); - const USHORT nLastChar = pLine->GetEnd() -1; // Last zeigt dahinter + const sal_uInt16 nFirstChar = pLine->GetStart(); + const sal_uInt16 nLastChar = pLine->GetEnd() -1; // Last points behind ContentNode* pNode = pParaPortion->GetNode(); DBG_ASSERT( nLastChar < pNode->Len(), "AdjustBlocks: Out of range!" ); // Search blanks or Kashidas... SvUShorts aPositions; - USHORT nLastScript = i18n::ScriptType::LATIN; - for ( USHORT nChar = nFirstChar; nChar <= nLastChar; nChar++ ) + sal_uInt16 nLastScript = i18n::ScriptType::LATIN; + for ( sal_uInt16 nChar = nFirstChar; nChar <= nLastChar; nChar++ ) { EditPaM aPaM( pNode, nChar+1 ); LanguageType eLang = GetLanguage(aPaM); - USHORT nScript = GetScriptType(aPaM); + sal_uInt16 nScript = GetScriptType(aPaM); if ( MsLangId::getPrimaryLanguage( eLang) == LANGUAGE_ARABIC_PRIMARY_ONLY ) // Arabic script is handled later. continue; @@ -2045,59 +1994,58 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, if ( !aPositions.Count() ) return; - // Wenn das letzte Zeichen ein Blank ist, will ich es nicht haben! - // Die Breite muss auf die Blocker davor verteilt werden... - // Aber nicht, wenn es das einzige ist + // If the last character is a blank, it is rejected! + // The width must be distributed to the blockers in front... + // But not if it is the only one. if ( ( pNode->GetChar( nLastChar ) == ' ' ) && ( aPositions.Count() > 1 ) && ( MsLangId::getPrimaryLanguage( GetLanguage( EditPaM( pNode, nLastChar ) ) ) != LANGUAGE_ARABIC_PRIMARY_ONLY ) ) { aPositions.Remove( aPositions.Count()-1, 1 ); - USHORT nPortionStart, nPortion; + sal_uInt16 nPortionStart, nPortion; nPortion = pParaPortion->GetTextPortions().FindPortion( nLastChar+1, nPortionStart ); TextPortion* pLastPortion = pParaPortion->GetTextPortions()[ nPortion ]; long nRealWidth = pLine->GetCharPosArray()[nLastChar-nFirstChar]; long nBlankWidth = nRealWidth; if ( nLastChar > nPortionStart ) nBlankWidth -= pLine->GetCharPosArray()[nLastChar-nFirstChar-1]; - // Evtl. ist das Blank schon in ImpBreakLine abgezogen worden: + // Possibly the blank has already been deducted in ImpBreakLine: if ( nRealWidth == pLastPortion->GetSize().Width() ) { - // Beim letzten Zeichen muss die Portion hinter dem Blank aufhoeren - // => Korrektur vereinfachen: - DBG_ASSERT( ( nPortionStart + pLastPortion->GetLen() ) == ( nLastChar+1 ), "Blank doch nicht am Portion-Ende?!" ); + // For the last character the portion must stop behind the blank + // => Simplify correction: + DBG_ASSERT( ( nPortionStart + pLastPortion->GetLen() ) == ( nLastChar+1 ), "Blank actually not at the end of the portion!?"); pLastPortion->GetSize().Width() -= nBlankWidth; nRemainingSpace += nBlankWidth; } pLine->GetCharPosArray()[nLastChar-nFirstChar] -= nBlankWidth; } - USHORT nGaps = aPositions.Count(); + sal_uInt16 nGaps = aPositions.Count(); const long nMore4Everyone = nRemainingSpace / nGaps; long nSomeExtraSpace = nRemainingSpace - nMore4Everyone*nGaps; - DBG_ASSERT( nSomeExtraSpace < (long)nGaps, "AdjustBlocks: ExtraSpace zu gross" ); + DBG_ASSERT( nSomeExtraSpace < (long)nGaps, "AdjustBlocks: ExtraSpace too large" ); DBG_ASSERT( nSomeExtraSpace >= 0, "AdjustBlocks: ExtraSpace < 0 " ); - // Die Positionen im Array und die Portion-Breiten korrigieren: - // Letztes Zeichen wird schon nicht mehr beachtet... - for ( USHORT n = 0; n < aPositions.Count(); n++ ) + // Correct the positions in the Array and the portion widths: + // Last character won't be considered ... + for ( sal_uInt16 n = 0; n < aPositions.Count(); n++ ) { - USHORT nChar = aPositions[n]; + sal_uInt16 nChar = aPositions[n]; if ( nChar < nLastChar ) { - USHORT nPortionStart, nPortion; + sal_uInt16 nPortionStart, nPortion; nPortion = pParaPortion->GetTextPortions().FindPortion( nChar, nPortionStart, true ); TextPortion* pLastPortion = pParaPortion->GetTextPortions()[ nPortion ]; - USHORT nPortionEnd = nPortionStart + pLastPortion->GetLen(); - // Die Breite der Portion: + // The width of the portion: pLastPortion->GetSize().Width() += nMore4Everyone; if ( nSomeExtraSpace ) pLastPortion->GetSize().Width()++; // Correct positions in array // Even for kashidas just change positions, VCL will then draw the kashida automaticly - - for ( USHORT _n = nChar; _n < nPortionEnd; _n++ ) + sal_uInt16 nPortionEnd = nPortionStart + pLastPortion->GetLen(); + for ( sal_uInt16 _n = nChar; _n < nPortionEnd; _n++ ) { pLine->GetCharPosArray()[_n-nFirstChar] += nMore4Everyone; if ( nSomeExtraSpace ) @@ -2113,7 +2061,7 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, pLine->SetTextWidth( pLine->GetTextWidth() + nRemainingSpace ); } -void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, USHORT nStart, USHORT nEnd, SvUShorts& rArray ) +void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, SvUShorts& rArray ) { // the search has to be performed on a per word base @@ -2124,7 +2072,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, USHORT nStart, USHORT n while ( ( aWordSel.Min().GetNode() == pNode ) && ( aWordSel.Min().GetIndex() < nEnd ) ) { - USHORT nSavPos = aWordSel.Max().GetIndex(); + sal_uInt16 nSavPos = aWordSel.Max().GetIndex(); if ( aWordSel.Max().GetIndex() > nEnd ) aWordSel.Max().GetIndex() = nEnd; @@ -2232,10 +2180,9 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, USHORT nStart, USHORT n sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nPos, EditLine* pCurLine ) { - DBG_ASSERT( pPortion, "SplitTextPortion: Welche ?" ); + DBG_ASSERT( pPortion, "SplitTextPortion: Which ?" ); - // Die Portion bei nPos wird geplittet, wenn bei nPos nicht - // sowieso ein Wechsel ist + // The portion at nPos is split, if there is not a transition at nPos anyway if ( nPos == 0 ) return 0; @@ -2249,12 +2196,8 @@ sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nP nTmpPos = nTmpPos + pTP->GetLen(); if ( nTmpPos >= nPos ) { - if ( nTmpPos == nPos ) // dann braucht nichts geteilt werden + if ( nTmpPos == nPos ) // then nothing needs to be split { - // Skip Portions with ExtraSpace -// while ( ( (nSplitPortion+1) < nPortions ) && (pPortion->GetTextPortions().GetObject(nSplitPortion+1)->GetKind() == PORTIONKIND_EXTRASPACE ) ) -// nSplitPortion++; - return nSplitPortion; } pTextPortion = pTP; @@ -2262,24 +2205,24 @@ sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nP } } - DBG_ASSERT( pTextPortion, "Position ausserhalb des Bereichs!" ); - DBG_ASSERT( pTextPortion->GetKind() == PORTIONKIND_TEXT, "SplitTextPortion: Keine TextPortion!" ); + DBG_ASSERT( pTextPortion, "Position outside the area!" ); + DBG_ASSERT( pTextPortion->GetKind() == PORTIONKIND_TEXT, "SplitTextPortion: No TextPortion!" ); sal_uInt16 nOverlapp = nTmpPos - nPos; pTextPortion->GetLen() = pTextPortion->GetLen() - nOverlapp; TextPortion* pNewPortion = new TextPortion( nOverlapp ); pPortion->GetTextPortions().Insert( pNewPortion, nSplitPortion+1 ); - // Groessen setzen: + // Set sizes if ( pCurLine ) { - // Kein neues GetTextSize, sondern Werte aus Array verwenden: - DBG_ASSERT( nPos > pCurLine->GetStart(), "SplitTextPortion am Anfang der Zeile?" ); + // No new GetTextSize, instead use values from the Array: + DBG_ASSERT( nPos > pCurLine->GetStart(), "SplitTextPortion at the beginning of the line?" ); pTextPortion->GetSize().Width() = pCurLine->GetCharPosArray()[ nPos-pCurLine->GetStart()-1 ]; if ( pTextPortion->GetExtraInfos() && pTextPortion->GetExtraInfos()->bCompressed ) { // We need the original size from the portion - USHORT nTxtPortionStart = pPortion->GetTextPortions().GetStartPos( nSplitPortion ); + sal_uInt16 nTxtPortionStart = pPortion->GetTextPortions().GetStartPos( nSplitPortion ); SvxFont aTmpFont( pPortion->GetNode()->GetCharAttribs().GetDefFont() ); SeekCursor( pPortion->GetNode(), nTxtPortionStart+1, aTmpFont ); aTmpFont.SetPhysFont( GetRefDevice() ); @@ -2300,7 +2243,7 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r { sal_uInt16 nStartPos = rStart; ContentNode* pNode = pParaPortion->GetNode(); - DBG_ASSERT( pNode->Len(), "CreateTextPortions sollte nicht fuer leere Absaetze verwendet werden!" ); + DBG_ASSERT( pNode->Len(), "CreateTextPortions should not be used for empty paragraphs!" ); SortedPositions aPositions; aPositions.Insert( (sal_uInt32) 0 ); @@ -2309,8 +2252,8 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r EditCharAttrib* pAttrib = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); while ( pAttrib ) { - // Start und Ende in das Array eintragen... - // Die InsertMethode laesst keine doppelten Werte zu.... + // Insert Start and End into the Array... + // The Insert method does not allow for duplicate values.... aPositions.Insert( pAttrib->GetStart() ); aPositions.Insert( pAttrib->GetEnd() ); nAttr++; @@ -2318,15 +2261,15 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r } aPositions.Insert( pNode->Len() ); - if ( !pParaPortion->aScriptInfos.Count() ) + if ( pParaPortion->aScriptInfos.empty() ) ((ImpEditEngine*)this)->InitScriptTypes( GetParaPortions().GetPos( pParaPortion ) ); const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - for ( USHORT nT = 0; nT < rTypes.Count(); nT++ ) + for ( size_t nT = 0; nT < rTypes.size(); nT++ ) aPositions.Insert( rTypes[nT].nStartPos ); const WritingDirectionInfos& rWritingDirections = pParaPortion->aWritingDirectionInfos; - for ( USHORT nD = 0; nD < rWritingDirections.Count(); nD++ ) + for ( size_t nD = 0; nD < rWritingDirections.size(); nD++ ) aPositions.Insert( rWritingDirections[nD].nStartPos ); if ( mpIMEInfos && mpIMEInfos->nLen && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetNode() == pNode ) ) @@ -2343,9 +2286,9 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r aPositions.Insert( mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen ); } - // Ab ... loeschen: - // Leider muss die Anzahl der TextPortions mit aPositions.Count() - // nicht uebereinstimmen, da evtl. Zeilenumbrueche... + // From ... Delete: + // Unfortunately, the number of text portions does not have to match + // aPositions.Count(), since there might be line breaks... sal_uInt16 nPortionStart = 0; sal_uInt16 nInvPortion = 0; sal_uInt16 nP; @@ -2361,18 +2304,18 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r break; } } - DBG_ASSERT( nP < pParaPortion->GetTextPortions().Count() || !pParaPortion->GetTextPortions().Count(), "Nichts zum loeschen: CreateTextPortions" ); + DBG_ASSERT( nP < pParaPortion->GetTextPortions().Count() || !pParaPortion->GetTextPortions().Count(), "Nothing to delete: CreateTextPortions" ); if ( nInvPortion && ( nPortionStart+pParaPortion->GetTextPortions().GetObject(nInvPortion)->GetLen() > nStartPos ) ) { - // lieber eine davor... - // Aber nur wenn es mitten in der Portion war, sonst ist es evtl. - // die einzige in der Zeile davor ! + // prefer one in front ... + // But only if it was in the middle of the portion of, otherwise it + // might be the only one in the row in front! nInvPortion--; nPortionStart = nPortionStart - pParaPortion->GetTextPortions().GetObject(nInvPortion)->GetLen(); } pParaPortion->GetTextPortions().DeleteFromPortion( nInvPortion ); - // Eine Portion kann auch durch einen Zeilenumbruch entstanden sein: + // A portion may also have been formed by a line break: aPositions.Insert( nPortionStart ); sal_uInt16 nInvPos; @@ -2388,36 +2331,35 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r pParaPortion->GetTextPortions().Insert( pNew, pParaPortion->GetTextPortions().Count()); } - DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "Keine Portions?!" ); + DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "No Portions?!" ); #ifdef EDITDEBUG - DBG_ASSERT( pParaPortion->DbgCheckTextPortions(), "Portions kaputt?" ); + DBG_ASSERT( pParaPortion->DbgCheckTextPortions(), "Portion is broken?" ); #endif } void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nStartPos, short nNewChars ) { - DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "Keine Portions!" ); - DBG_ASSERT( nNewChars, "RecalcTextPortion mit Diff == 0" ); + DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "No Portions!" ); + DBG_ASSERT( nNewChars, "RecalcTextPortion with Diff == 0" ); ContentNode* const pNode = pParaPortion->GetNode(); if ( nNewChars > 0 ) { - // Wenn an nStartPos ein Attribut beginnt/endet, faengt eine neue Portion - // an, ansonsten wird die Portion an nStartPos erweitert. - + // If an Attribute begins/ends at nStartPos, then a new portion starts + // otherwise the portion is extended at nStartPos. if ( pNode->GetCharAttribs().HasBoundingAttrib( nStartPos ) || IsScriptChange( EditPaM( pNode, nStartPos ) ) ) { sal_uInt16 nNewPortionPos = 0; if ( nStartPos ) nNewPortionPos = SplitTextPortion( pParaPortion, nStartPos ) + 1; - // Eine leere Portion kann hier stehen, wenn der Absatz leer war, - // oder eine Zeile durch einen harten Zeilenumbruch entstanden ist. + // A blank portion may be here, if the paragraph was empty, + // or if a line was created by a hard line break. if ( ( nNewPortionPos < pParaPortion->GetTextPortions().Count() ) && !pParaPortion->GetTextPortions()[nNewPortionPos]->GetLen() ) { - DBG_ASSERT( pParaPortion->GetTextPortions()[nNewPortionPos]->GetKind() == PORTIONKIND_TEXT, "Leere Portion war keine TextPortion!" ); - USHORT & r = + DBG_ASSERT( pParaPortion->GetTextPortions()[nNewPortionPos]->GetKind() == PORTIONKIND_TEXT, "the empty portion was no TextPortion!" ); + sal_uInt16 & r = pParaPortion->GetTextPortions()[nNewPortionPos]->GetLen(); r = r + nNewChars; } @@ -2433,19 +2375,20 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt const sal_uInt16 nTP = pParaPortion->GetTextPortions(). FindPortion( nStartPos, nPortionStart ); TextPortion* const pTP = pParaPortion->GetTextPortions()[ nTP ]; - DBG_ASSERT( pTP, "RecalcTextPortion: Portion nicht gefunden" ); + DBG_ASSERT( pTP, "RecalcTextPortion: Portion not found" ); pTP->GetLen() = pTP->GetLen() + nNewChars; pTP->GetSize().Width() = (-1); } } else { - // Portion schrumpfen oder ggf. entfernen. - // Vor Aufruf dieser Methode muss sichergestellt sein, dass - // keine Portions in dem geloeschten Bereich lagen! + // Shrink or remove portion if necessary. + // Before calling this method it must be ensured that no portions were + // in the deleted area! - // Es darf keine reinragende oder im Bereich startende Portion geben, - // also muss nStartPos <= nPos <= nStartPos - nNewChars(neg.) sein + // There must be no portions extending into the area or portions starting in + // the area, so it must be: + // nStartPos <= nPos <= nStartPos - nNewChars(neg.) sal_uInt16 nPortion = 0; sal_uInt16 nPos = 0; sal_uInt16 nEnd = nStartPos-nNewChars; @@ -2456,17 +2399,17 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt pTP = pParaPortion->GetTextPortions()[ nPortion ]; if ( ( nPos+pTP->GetLen() ) > nStartPos ) { - DBG_ASSERT( nPos <= nStartPos, "Start falsch!" ); - DBG_ASSERT( nPos+pTP->GetLen() >= nEnd, "End falsch!" ); + DBG_ASSERT( nPos <= nStartPos, "Wrong Start!" ); + DBG_ASSERT( nPos+pTP->GetLen() >= nEnd, "Wrong End!" ); break; } nPos = nPos + pTP->GetLen(); } - DBG_ASSERT( pTP, "RecalcTextPortion: Portion nicht gefunden" ); + DBG_ASSERT( pTP, "RecalcTextPortion: Portion not found" ); if ( ( nPos == nStartPos ) && ( (nPos+pTP->GetLen()) == nEnd ) ) { - // Portion entfernen; - BYTE nType = pTP->GetKind(); + // Remove portion; + sal_uInt8 nType = pTP->GetKind(); pParaPortion->GetTextPortions().Remove( nPortion ); delete pTP; if ( nType == PORTIONKIND_LINEBREAK ) @@ -2474,7 +2417,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt TextPortion* pNext = pParaPortion->GetTextPortions()[ nPortion ]; if ( pNext && !pNext->GetLen() ) { - // Dummy-Portion entfernen + // Remove dummy portion pParaPortion->GetTextPortions().Remove( nPortion ); delete pNext; } @@ -2482,18 +2425,18 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt } else { - DBG_ASSERT( pTP->GetLen() > (-nNewChars), "Portion zu klein zum schrumpfen!" ); + DBG_ASSERT( pTP->GetLen() > (-nNewChars), "Portion too small to shrink! "); pTP->GetLen() = pTP->GetLen() + nNewChars; } - // ganz am Schluss darf keine HYPHENATOR-Portion stehen bleiben... - DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "RecalcTextPortions: Keine mehr da!" ); + // No HYPHENATOR portion is allowed to get stuck right at the end... + DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "RecalcTextPortions: Nothing left! "); sal_uInt16 nLastPortion = pParaPortion->GetTextPortions().Count() - 1; pTP = pParaPortion->GetTextPortions().GetObject( nLastPortion ); if ( pTP->GetKind() == PORTIONKIND_HYPHENATOR ) { - // Portion wegschmeissen, ggf. die davor korrigieren, wenn - // die Hyph-Portion ein Zeichen geschluckt hat... + // Discard portion; if possible, correct the ones before, + // if the Hyphenator portion has swallowed one character... pParaPortion->GetTextPortions().Remove( nLastPortion ); if ( nLastPortion && pTP->GetLen() ) { @@ -2506,7 +2449,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt } } #ifdef EDITDEBUG - DBG_ASSERT( pParaPortion->DbgCheckTextPortions(), "Portions kaputt?" ); + DBG_ASSERT( pParaPortion->DbgCheckTextPortions(), "Portions are broken?" ); #endif } @@ -2531,7 +2474,7 @@ void ImpEditEngine::SetTextRanger( TextRanger* pRanger ) } } -void ImpEditEngine::SetVertical( BOOL bVertical ) +void ImpEditEngine::SetVertical( sal_Bool bVertical ) { if ( IsVertical() != bVertical ) { @@ -2546,7 +2489,7 @@ void ImpEditEngine::SetVertical( BOOL bVertical ) } } -void ImpEditEngine::SetFixedCellHeight( BOOL bUseFixedCellHeight ) +void ImpEditEngine::SetFixedCellHeight( sal_Bool bUseFixedCellHeight ) { if ( IsFixedCellHeight() != bUseFixedCellHeight ) { @@ -2561,9 +2504,9 @@ void ImpEditEngine::SetFixedCellHeight( BOOL bUseFixedCellHeight ) void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut, sal_uInt16 nIgnoreWhich ) { - // Es war mal geplant, SeekCursor( nStartPos, nEndPos, ... ), damit nur - // ab der StartPosition neu gesucht wird. - // Problem: Es mussten zwei Listen beruecksichtigt/gefuehrt werden: + // It was planned, SeekCursor( nStartPos, nEndPos, ... ), so that it would + // only be searched anew at the StartPosition. + // Problem: There would be two lists to consider/handle: // OrderedByStart,OrderedByEnd. if ( nPos > pNode->Len() ) @@ -2616,17 +2559,15 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rF EditCharAttrib* pAttrib = GetAttrib( rAttribs, nAttr ); while ( pAttrib && ( pAttrib->GetStart() <= nPos ) ) { - // Beim Seeken nicht die Attr beruecksichtigen, die dort beginnen! - // Leere Attribute werden beruecksichtigt( verwendet), da diese - // gerade eingestellt wurden. - // 12.4.95: Doch keine Leeren Attribute verwenden: - // - Wenn gerade eingestellt und leer => keine Auswirkung auf Font - // In einem leeren Absatz eingestellte Zeichen werden sofort wirksam. + // when seeking, ignore attributes which start there! Empty attributes + // are considered (used) as these are just set. But do not use empty + // attributes: When just set and empty => no effect on font + // In a blank paragraph, set characters take effect immediately. if ( ( pAttrib->Which() != nIgnoreWhich ) && ( ( ( pAttrib->GetStart() < nPos ) && ( pAttrib->GetEnd() >= nPos ) ) || ( !pNode->Len() ) ) ) { - DBG_ASSERT( ( pAttrib->Which() >= EE_CHAR_START ) && ( pAttrib->Which() <= EE_FEATURE_END ), "Unglueltiges Attribut in Seek() " ); + DBG_ASSERT( ( pAttrib->Which() >= EE_CHAR_START ) && ( pAttrib->Which() <= EE_FEATURE_END ), "Invalid Attribute in Seek() " ); if ( IsScriptItemValid( pAttrib->Which(), nScriptType ) ) { pAttrib->SetFont( rFont, pOut ); @@ -2657,20 +2598,18 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rF if ( aStatus.DoNotUseColors() ) { - // Hack fuer DL,weil JOE staendig die Pooldefaults verbiegt! - // const SvxColorItem& rColorItem = (const SvxColorItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_COLOR ); rFont.SetColor( /* rColorItem.GetValue() */ COL_BLACK ); } if ( aStatus.DoStretch() || ( nRelWidth != 100 ) ) { - // Fuer das aktuelle Ausgabegeraet, weil es sonst bei einem - // Drucker als RefDev auf dem Bildschirm #?!@' aussieht! + // For the current Output device, because otherwise if RefDev=Printer its looks + // ugly on the screen! OutputDevice* pDev = pOut ? pOut : GetRefDevice(); rFont.SetPhysFont( pDev ); FontMetric aMetric( pDev->GetFontMetric() ); - // Fuer die Hoehe nicht die Metriken nehmen, da das bei - // Hoch-/Tiefgestellt schief geht. + // For the height do not consider the metrics, because it will go + // wrong at Superscript/Subscript. Size aRealSz( aMetric.GetSize().Width(), rFont.GetSize().Height() ); if ( aStatus.DoStretch() ) { @@ -2691,23 +2630,22 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rF aRealSz.Width() *= nStretchX; aRealSz.Width() /= 100; - // Auch das Kerning: (long wegen Zwischenergebnis) + // Also the Kerning: (long due to handle Interim results) long nKerning = rFont.GetFixKerning(); /* - Die Ueberlegung war: Wenn neg. Kerning, aber StretchX = 200 - => Nicht das Kerning verdoppelt, also die Buchstaben weiter - zusammenziehen + The consideration was: If negative kerning, but StretchX = 200 + => Do not double the kerning, thus pull the letters closer together --------------------------- - Kern StretchX =>Kern + Kern StretchX =>Kern --------------------------- - >0 <100 < (Proportional) - <0 <100 < (Proportional) - >0 >100 > (Proportional) - <0 >100 < (Der Betrag, also Antiprop) + >0 <100 < (Proportional) + <0 <100 < (Proportional) + >0 >100 > (Proportional) + <0 >100 < (The amount, thus disproportional) */ if ( ( nKerning < 0 ) && ( nStretchX > 100 ) ) { - // Antiproportional + // disproportional nKerning *= 100; nKerning /= nStretchX; } @@ -2727,7 +2665,7 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rF aRealSz.Width() /= 100; } rFont.SetSize( aRealSz ); - // Font wird nicht restauriert... + // Font is not restored ... } if ( ( ( rFont.GetColor() == COL_AUTO ) || ( IsForceAutoColor() ) ) && pOut ) @@ -2771,7 +2709,7 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rF const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); rFont.SetColor( rStyleSettings.GetHighlightTextColor() ); rFont.SetFillColor( rStyleSettings.GetHighlightColor() ); - rFont.SetTransparent( FALSE ); + rFont.SetTransparent( sal_False ); } else if ( nAttr & EXTTEXTINPUT_ATTR_GRAYWAVELINE ) { @@ -2784,9 +2722,9 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rF void ImpEditEngine::RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics, SvxFont& rFont ) { - // Fuer Zeilenhoehe bei Hoch/Tief erstmal ohne Propr! + // for line height at high / low first without Propr! sal_uInt16 nPropr = rFont.GetPropr(); - DBG_ASSERT( ( nPropr == 100 ) || rFont.GetEscapement(), "Propr ohne Escape?!" ); + DBG_ASSERT( ( nPropr == 100 ) || rFont.GetEscapement(), "Propr without Escape?!" ); if ( nPropr != 100 ) { rFont.SetPropr( 100 ); @@ -2803,52 +2741,35 @@ void ImpEditEngine::RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics if ( IsFixedCellHeight() ) { -/* creating correct proportional ascent and descent values lead to problems if different fonts are used - in the same portion, it results in a bigger linespacing. - sal_Int32 f = nAscent + nDescent; - if ( f ) - { - sal_Int32 nHeight = ImplCalculateFontIndependentLineSpacing( rFont.GetHeight() ); - nAscent = (sal_Int16)(( nHeight * nAscent ) / f ); - nDescent = (sal_Int16)(nHeight - nAscent); - } -*/ nAscent = sal::static_int_cast< sal_uInt16 >( rFont.GetHeight() ); nDescent= sal::static_int_cast< sal_uInt16 >( ImplCalculateFontIndependentLineSpacing( rFont.GetHeight() ) - nAscent ); } else { sal_uInt16 nIntLeading = ( aMetric.GetIntLeading() > 0 ) ? (sal_uInt16)aMetric.GetIntLeading() : 0; - // Fonts ohne Leading bereiten Probleme + // Fonts without leading cause problems if ( ( nIntLeading == 0 ) && ( pRefDev->GetOutDevType() == OUTDEV_PRINTER ) ) { - // Da schaun wir mal, was fuer eine Leading ich auf dem - // Bildschirm erhalte + // Lets see what Leading one gets on the screen VirtualDevice* pVDev = GetVirtualDevice( pRefDev->GetMapMode(), pRefDev->GetDrawMode() ); rFont.SetPhysFont( pVDev ); aMetric = pVDev->GetFontMetric(); - // Damit sich die Leading nicht wieder rausrechnet, - // wenn die ganze Zeile den Font hat, nTmpLeading. - - // 4/96: Kommt bei HP Laserjet 4V auch nicht hin - // => Werte komplett vom Bildschirm holen. - // sal_uInt16 nTmpLeading = (sal_uInt16)aMetric.GetLeading(); - // nAscent += nTmpLeading; + // This is so that the Leading does not count itself out again, + // if the whole line has the font, nTmpLeading. nAscent = (sal_uInt16)aMetric.GetAscent(); nDescent = (sal_uInt16)aMetric.GetDescent(); - // nLeading = (sal_uInt16)aMetric.GetLeading(); } } if ( nAscent > rCurMetrics.nMaxAscent ) rCurMetrics.nMaxAscent = nAscent; if ( nDescent > rCurMetrics.nMaxDescent ) rCurMetrics.nMaxDescent= nDescent; - // Sonderbehandlung Hoch/Tief: + // Special treatment of high/low: if ( rFont.GetEscapement() ) { - // Jetzt unter Beruecksichtigung von Escape/Propr - // Ascent oder Descent ggf vergroessern + // Now in consideration of Escape/Propr + // possibly enlarge Ascent or Descent short nDiff = (short)(rFont.GetSize().Height()*rFont.GetEscapement()/100L); if ( rFont.GetEscapement() > 0 ) { @@ -2856,7 +2777,7 @@ void ImpEditEngine::RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics if ( nAscent > rCurMetrics.nMaxAscent ) rCurMetrics.nMaxAscent = nAscent; } - else // muss < 0 sein + else // has to be < 0 { nDescent = (sal_uInt16) (((long)nDescent)*nPropr/100 - nDiff); if ( nDescent > rCurMetrics.nMaxDescent ) @@ -2879,15 +2800,15 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta EditLine* pLine; Point aTmpPos; Point aRedLineTmpPos; - DBG_ASSERT( GetParaPortions().Count(), "Keine ParaPortion?!" ); + DBG_ASSERT( GetParaPortions().Count(), "No ParaPortion?!" ); SvxFont aTmpFont( GetParaPortions()[0]->GetNode()->GetCharAttribs().GetDefFont() ); Font aOldFont( pOutDev->GetFont() ); vcl::PDFExtOutDevData* pPDFExtOutDevData = PTR_CAST( vcl::PDFExtOutDevData, pOutDev->GetExtOutDevData() ); - // Bei gedrehtem Text wird aStartPos als TopLeft angesehen, da andere - // Informationen fehlen, und sowieso das ganze Object ungescrollt - // dargestellt wird. - // Das Rechteck ist unendlich gross. + // In the case of rotated text is aStartPos considered TopLeft because + // other information is missing, and since the whole object is shown anyway + // un-scrolled. + // The rectangle is infinite. Point aOrigin( aStartPos ); double nCos = 0.0, nSin = 0.0; if ( nOrientation ) @@ -2902,22 +2823,17 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta GDIMetaFile* pMtf = pOutDev->GetConnectMetaFile(); const bool bMetafileValid( pMtf != NULL ); - // Fuer OnlineSpelling: -// EditPaM aCursorPos; -// if( GetStatus().DoOnlineSpelling() && pActiveView ) -// aCurPos = pActiveView->pImpEditView->GetEditSelections().Max(); - long nVertLineSpacing = CalcVertLineSpacing(aStartPos); // -------------------------------------------------- - // Ueber alle Absaetze... + // Over all the paragraphs ... // -------------------------------------------------- for ( sal_uInt16 n = 0; n < GetParaPortions().Count(); n++ ) { ParaPortion* pPortion = GetParaPortions().GetObject( n ); DBG_ASSERT( pPortion, "NULL-Pointer in TokenList in Paint" ); - // falls beim Tippen Idle-Formatierung, asynchrones Paint. - // Unsichtbare Portions koennen ungueltig sein. + // if when typing idle formatting, asynchronous Paint. + // Invisible Portions may be invalid. if ( pPortion->IsVisible() && pPortion->IsInvalid() ) return; @@ -2932,7 +2848,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta { // -------------------------------------------------- - // Ueber die Zeilen des Absatzes... + // Over the lines of the paragraph ... // -------------------------------------------------- sal_uInt16 nLines = pPortion->GetLines().Count(); sal_uInt16 nLastLine = nLines-1; @@ -2950,7 +2866,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ ) { pLine = pPortion->GetLines().GetObject(nLine); - DBG_ASSERT( pLine, "NULL-Pointer im Zeileniterator in UpdateViews" ); + DBG_ASSERT( pLine, "NULL-Pointer in the line iterator in UpdateViews" ); aTmpPos = aStartPos; if ( !IsVertical() ) { @@ -2978,46 +2894,33 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta // does, too. No change for not-layouting (painting). if(0 == nLine) // && !bStripOnly) { - // VERT??? GetEditEnginePtr()->PaintingFirstLine( n, aParaStart, aTmpPos.Y(), aOrigin, nOrientation, pOutDev ); } // -------------------------------------------------- - // Ueber die Portions der Zeile... + // Over the Portions of the line ... // -------------------------------------------------- nIndex = pLine->GetStart(); for ( sal_uInt16 y = pLine->GetStartPortion(); y <= pLine->GetEndPortion(); y++ ) { - DBG_ASSERT( pPortion->GetTextPortions().Count(), "Zeile ohne Textportion im Paint!" ); + DBG_ASSERT( pPortion->GetTextPortions().Count(), "Line without Textportion in Paint!" ); TextPortion* pTextPortion = pPortion->GetTextPortions().GetObject( y ); - DBG_ASSERT( pTextPortion, "NULL-Pointer im Portioniterator in UpdateViews" ); + DBG_ASSERT( pTextPortion, "NULL-Pointer in Portion iterator in UpdateViews" ); long nPortionXOffset = GetPortionXOffset( pPortion, pLine, y ); if ( !IsVertical() ) { aTmpPos.X() = aStartPos.X() + nPortionXOffset; if ( aTmpPos.X() > aClipRec.Right() ) - break; // Keine weitere Ausgabe in Zeile noetig + break; // No further output in line necessary } else { aTmpPos.Y() = aStartPos.Y() + nPortionXOffset; if ( aTmpPos.Y() > aClipRec.Bottom() ) - break; // Keine weitere Ausgabe in Zeile noetig + break; // No further output in line necessary } - // R2L replaces with obove... - // New position after processing R2L text... -// R2L if ( nR2LWidth && !pTextPortion->GetRightToLeft() ) -// R2L { -// R2L if ( !IsVertical() ) -// R2L aTmpPos.X() += nR2LWidth; -// R2L else -// R2L aTmpPos.Y() += nR2LWidth; -// R2L -// R2L nR2LWidth = 0; -// R2L } - switch ( pTextPortion->GetKind() ) { case PORTIONKIND_TEXT: @@ -3026,16 +2929,16 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta { SeekCursor( pPortion->GetNode(), nIndex+1, aTmpFont, pOutDev ); - BOOL bDrawFrame = FALSE; + sal_Bool bDrawFrame = sal_False; if ( ( pTextPortion->GetKind() == PORTIONKIND_FIELD ) && !aTmpFont.IsTransparent() && ( GetBackgroundColor() != COL_AUTO ) && GetBackgroundColor().IsDark() && ( IsAutoColorEnabled() && ( pOutDev->GetOutDevType() != OUTDEV_PRINTER ) ) ) { - aTmpFont.SetTransparent( TRUE ); + aTmpFont.SetTransparent( sal_True ); pOutDev->SetFillColor(); pOutDev->SetLineColor( GetAutoColor() ); - bDrawFrame = TRUE; + bDrawFrame = sal_True; } #ifdef EDITDEBUG @@ -3064,8 +2967,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta ImplInitDigitMode( pOutDev, 0, 0, 0, aTmpFont.GetLanguage() ); XubString aText; - USHORT nTextStart = 0; - USHORT nTextLen = 0; + sal_uInt16 nTextStart = 0; + sal_uInt16 nTextLen = 0; const sal_Int32* pDXArray = 0; sal_Int32* pTmpDXArray = 0; @@ -3076,7 +2979,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta nTextLen = pTextPortion->GetLen(); pDXArray = pLine->GetCharPosArray().GetData()+( nIndex-pLine->GetStart() ); - // --> FME 2005-10-18 #i55716# Paint control characters + // Paint control characters (#i55716#) if ( aStatus.MarkFields() ) { xub_StrLen nTmpIdx; @@ -3137,7 +3040,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta { const String aSlash( '/' ); const short nOldEscapement = aTmpFont.GetEscapement(); - const BYTE nOldPropr = aTmpFont.GetPropr(); + const sal_uInt8 nOldPropr = aTmpFont.GetPropr(); aTmpFont.SetEscapement( -20 ); aTmpFont.SetPropr( 25 ); @@ -3164,13 +3067,12 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta } } } - // <-- } else if ( pTextPortion->GetKind() == PORTIONKIND_FIELD ) { EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature( nIndex ); - DBG_ASSERT( pAttr, "Feld nicht gefunden" ); - DBG_ASSERT( pAttr && pAttr->GetItem()->ISA( SvxFieldItem ), "Feld vom falschen Typ!" ); + DBG_ASSERT( pAttr, "Field not found"); + DBG_ASSERT( pAttr && pAttr->GetItem()->ISA( SvxFieldItem ), "Field of the wrong type! "); aText = ((EditCharAttribField*)pAttr)->GetFieldValue(); nTextStart = 0; nTextLen = aText.Len(); @@ -3223,24 +3125,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta if (pTextPortion->IsRightToLeft()) aRedLineTmpPos.X() += pTextPortion->GetSize().Width(); -//L2R if ( pTextPortion->GetRightToLeft() ) -//L2R { -//L2R sal_uInt16 nNextPortion = y+1; -//L2R while ( nNextPortion <= pLine->GetEndPortion() ) -//L2R { -//L2R TextPortion* pNextTextPortion = pPortion->GetTextPortions().GetObject( nNextPortion ); -//L2R if ( pNextTextPortion->GetRightToLeft() ) -//L2R { -//L2R if ( !IsVertical() ) -//L2R aOutPos.X() += pNextTextPortion->GetSize().Width(); -//L2R else -//L2R aOutPos.Y() += pNextTextPortion->GetSize().Width(); -//L2R } -//L2R else -//L2R break; -//L2R nNextPortion++; -//L2R } -//L2R } if ( bStripOnly ) { EEngineData::WrongSpellVector aWrongSpellVector; @@ -3339,7 +3223,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta short nEsc = aTmpFont.GetEscapement(); if ( nOrientation ) { - // Bei Hoch/Tief selbst Hand anlegen: + // In case of high/low do it yourself: if ( aTmpFont.GetEscapement() ) { long nDiff = aTmpFont.GetSize().Height() * aTmpFont.GetEscapement() / 100L; @@ -3356,23 +3240,25 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta aTmpFont.SetPhysFont( pOutDev ); } - // nur ausgeben, was im sichtbaren Bereich beginnt: - // Wichtig, weil Bug bei einigen Grafikkarten bei transparentem Font, Ausgabe bei neg. + + // Take only what begins in the visible range: + // Important, because of a bug in some graphic cards + // when transparent font, output when negative if ( nOrientation || ( !IsVertical() && ( ( aTmpPos.X() + nTxtWidth ) >= nFirstVisXPos ) ) || ( IsVertical() && ( ( aTmpPos.Y() + nTxtWidth ) >= nFirstVisYPos ) ) ) { if ( nEsc && ( ( aTmpFont.GetUnderline() != UNDERLINE_NONE ) ) ) { - // Das Hoch/Tief ohne Underline malen, das Underline - // auf der BaseLine der Original-Fonthoehe ausgeben... - - // Aber nur, wenn davor auch Unterstrichen! + // Paint the high/low without underline, + // Display the Underline on the + // base line of the original font height ... + // But only if there was something underlined before! sal_Bool bSpecialUnderline = sal_False; EditCharAttrib* pPrev = pPortion->GetNode()->GetCharAttribs().FindAttrib( EE_CHAR_ESCAPEMENT, nIndex ); if ( pPrev ) { SvxFont aDummy; - // Unterstreichung davor? + // Underscore in front? if ( pPrev->GetStart() ) { SeekCursor( pPortion->GetNode(), pPrev->GetStart(), aDummy ); @@ -3389,7 +3275,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta if ( bSpecialUnderline ) { Size aSz = aTmpFont.GetPhysTxtSize( pOutDev, aText, nTextStart, nTextLen ); - BYTE nProp = aTmpFont.GetPropr(); + sal_uInt8 nProp = aTmpFont.GetPropr(); aTmpFont.SetEscapement( 0 ); aTmpFont.SetPropr( 100 ); aTmpFont.SetPhysFont( pOutDev ); @@ -3415,14 +3301,13 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta aRealOutPos.X() += pTextPortion->GetExtraInfos()->nPortionOffsetX; } - // --> FME 2005-06-17 #i37132# RTL portions with + // RTL portions with (#i37132#) // compressed blank should not paint this blank: if ( pTextPortion->IsRightToLeft() && nTextLen >= 2 && pDXArray[ nTextLen - 1 ] == pDXArray[ nTextLen - 2 ] && ' ' == aText.GetChar( nTextStart + nTextLen - 1 ) ) --nTextLen; - // <-- // output directly aTmpFont.QuickDrawText( pOutDev, aRealOutPos, aText, nTextStart, nTextLen, pDXArray ); @@ -3437,7 +3322,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta pOutDev->DrawRect( aRect ); } - // PDF export: if ( pPDFExtOutDevData ) { @@ -3452,8 +3336,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta { Point aTopLeft( aTmpPos ); aTopLeft.Y() -= pLine->GetMaxAscent(); -// if ( nOrientation ) -// aTopLeft = lcl_ImplCalcRotatedPos( aTopLeft, aOrigin, nSin, nCos ); +// if ( nOrientation ) +// aTopLeft = lcl_ImplCalcRotatedPos( aTopLeft, aOrigin, nSin, nCos ); Rectangle aRect( aTopLeft, pTextPortion->GetSize() ); vcl::PDFExtOutDevBookmarkEntry aBookmark; @@ -3473,7 +3357,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta } -#ifndef SVX_LIGHT if ( GetStatus().DoOnlineSpelling() && pPortion->GetNode()->GetWrongList()->HasWrongs() && pTextPortion->GetLen() ) { {//#105750# adjust LinePos for superscript or subscript text @@ -3492,7 +3375,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta lcl_DrawRedLines( pOutDev, aTmpFont.GetSize().Height(), aRedLineTmpPos, nIndex, nIndex + pTextPortion->GetLen(), pDXArray, pPortion->GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical(), pTextPortion->IsRightToLeft() ); pOutDev->SetLineColor( aOldColor ); } -#endif // !SVX_LIGHT } pOutDev->Pop(); @@ -3500,23 +3382,11 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta if ( pTmpDXArray ) delete[] pTmpDXArray; -// R2L if ( !pTextPortion->GetRightToLeft() ) -// R2L { -// R2L if ( !IsVertical() ) -// R2L aTmpPos.X() += nTxtWidth; -// R2L else -// R2L aTmpPos.Y() += nTxtWidth; -// R2L } -// R2L else -// R2L { -// R2L nR2LWidth += nTxtWidth; -// R2L } - if ( pTextPortion->GetKind() == PORTIONKIND_FIELD ) { EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature( nIndex ); - DBG_ASSERT( pAttr, "Feld nicht gefunden" ); - DBG_ASSERT( pAttr && pAttr->GetItem()->ISA( SvxFieldItem ), "Feld vom falschen Typ!" ); + DBG_ASSERT( pAttr, "Field not found" ); + DBG_ASSERT( pAttr && pAttr->GetItem()->ISA( SvxFieldItem ), "Wrong type of field!" ); // add a meta file comment if we record to a metafile if( bMetafileValid ) @@ -3535,7 +3405,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta } break; -// case PORTIONKIND_EXTRASPACE: case PORTIONKIND_TAB: { if ( pTextPortion->GetExtraValue() && ( pTextPortion->GetExtraValue() != ' ' ) ) @@ -3549,12 +3418,12 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta if( nCharWidth ) nChars = pTextPortion->GetSize().Width() / nCharWidth; if ( nChars < 2 ) - nChars = 2; // wird durch DrawStretchText gestaucht. + nChars = 2; // is compressed by DrawStretchText. else if ( nChars == 2 ) - nChars = 3; // sieht besser aus + nChars = 3; // looks better String aText; - aText.Fill( (USHORT)nChars, pTextPortion->GetExtraValue() ); + aText.Fill( (sal_uInt16)nChars, pTextPortion->GetExtraValue() ); aTmpFont.QuickDrawText( pOutDev, aTmpPos, aText, 0, aText.Len(), NULL ); pOutDev->DrawStretchText( aTmpPos, pTextPortion->GetSize().Width(), aText ); @@ -3591,7 +3460,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta aStartPos.X() -= nSBL; } - // keine sichtbaren Aktionen mehr? + // no more visible actions? if ( !IsVertical() && ( aStartPos.Y() >= aClipRec.Bottom() ) ) break; else if ( IsVertical() && ( aStartPos.X() <= aClipRec.Left() ) ) @@ -3619,7 +3488,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta if ( pPDFExtOutDevData ) pPDFExtOutDevData->EndStructureElement(); - // keine sichtbaren Aktionen mehr? + // no more visible actions? if ( !IsVertical() && ( aStartPos.Y() > aClipRec.Bottom() ) ) break; if ( IsVertical() && ( aStartPos.X() < aClipRec.Left() ) ) @@ -3631,13 +3500,13 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool bUseVirtDev ) { - DBG_ASSERT( pView, "Keine View - Kein Paint!" ); + DBG_ASSERT( pView, "No View - No Paint!" ); DBG_CHKOBJ( GetEditEnginePtr(), EditEngine, 0 ); if ( !GetUpdateMode() || IsInUndo() ) return; - // Schnittmenge aus Paintbereich und OutputArea. + // Intersection of paint area and output area. Rectangle aClipRec( pView->GetOutputArea() ); aClipRec.Intersection( rRec ); @@ -3658,7 +3527,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b aClipRecPixel.Bottom() += 1; } - // Wenn aClipRecPixel > XXXX, dann invalidieren ?! + // If aClipRecPixel > XXXX, then invalidate?! VirtualDevice* pVDev = GetVirtualDevice( pOutWin->GetMapMode(), pOutWin->GetDrawMode() ); pVDev->SetDigitLanguage( GetRefDevice()->GetDigitLanguage() ); @@ -3685,7 +3554,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b } } - UINT8 nColorDiff = aFontColor.GetColorError( aBackgroundColor ); + sal_uInt8 nColorDiff = aFontColor.GetColorError( aBackgroundColor ); if( nColorDiff < 8 ) aBackgroundColor = aFontColor.IsDark() ? COL_WHITE : COL_BLACK; pVDev->SetBackground( aBackgroundColor ); @@ -3693,15 +3562,15 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b sal_Bool bVDevValid = sal_True; Size aOutSz( pVDev->GetOutputSizePixel() ); - if ( ( aOutSz.Width() < aClipRecPixel.GetWidth() ) || - ( aOutSz.Height() < aClipRecPixel.GetHeight() ) ) + if ( ( aOutSz.Width() < aClipRecPixel.GetWidth() ) || + ( aOutSz.Height() < aClipRecPixel.GetHeight() ) ) { bVDevValid = pVDev->SetOutputSizePixel( aClipRecPixel.GetSize() ); } else { - // Das VirtDev kann bei einem Resize sehr gross werden => - // irgendwann mal kleiner machen! + // The VirtDev can become very big during a Resize => + // eventually make it smaller! if ( ( aOutSz.Height() > ( aClipRecPixel.GetHeight() + RESDIFF ) ) || ( aOutSz.Width() > ( aClipRecPixel.GetWidth() + RESDIFF ) ) ) { @@ -3712,15 +3581,15 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b pVDev->Erase(); } } - DBG_ASSERT( bVDevValid, "VDef konnte nicht vergroessert werden!" ); + DBG_ASSERT( bVDevValid, "VDef could not be enlarged!" ); if ( !bVDevValid ) { Paint( pView, rRec, sal_False /* ohne VDev */ ); return; } - // PaintRect fuer VDev nicht mit alignter Groesse, - // da sonst die Zeile darunter auch ausgegeben werden muss: + // PaintRect for VDev not with aligned size, + // Otherwise, the line below must also be printed out: Rectangle aTmpRec( Point( 0, 0 ), aClipRec.GetSize() ); aClipRec = pOutWin->PixelToLogic( aClipRecPixel ); @@ -3748,12 +3617,11 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b if ( GetTextRanger() ) { // Some problems here with push/pop, why?! -// pOutWin->Push( PUSH_CLIPREGION|PUSH_MAPMODE ); bClipRegion = pOutWin->IsClipRegion(); aOldRegion = pOutWin->GetClipRegion(); - // Wie bekomme ich das Polygon an die richtige Stelle???? - // Das Polygon bezieht sich auf die View, nicht auf das Window - // => Origin umsetzen... + // How do I get the polygon to the right place?? + // The polygon is based on the view, not the Window + // => reset origin... aOldMapMode = pOutWin->GetMapMode(); Point aOrigin = aOldMapMode.GetOrigin(); Point aViewPos = pView->GetOutputArea().TopLeft(); @@ -3770,7 +3638,6 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b if ( GetTextRanger() ) { -// pOutWin->Pop(); if ( bClipRegion ) pOutWin->SetClipRegion( aOldRegion ); else @@ -3797,9 +3664,10 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b aStartPos.Y() -= pView->GetVisDocLeft(); } - // Wenn Doc-Breite < OutputArea,Width, nicht umgebrochene Felder, - // stehen die Felder sonst �ber, wenn > Zeile. - // ( Oben nicht, da dort bereits Doc-Breite von Formatierung mit drin ) + // If Doc-width < Output Area,Width and not wrapped fields, + // the fields usually protrude if > line. + // (Not at the top, since there the Doc-width from formatting is already + // there) if ( !IsVertical() && ( pView->GetOutputArea().GetWidth() > GetPaperSize().Width() ) ) { long nMaxX = pView->GetOutputArea().Left() + GetPaperSize().Width(); @@ -3827,8 +3695,8 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b void ImpEditEngine::InsertContent( ContentNode* pNode, sal_uInt16 nPos ) { - DBG_ASSERT( pNode, "NULL-Poointer in InsertContent! " ); - DBG_ASSERT( IsInUndo(), "InsertContent nur fuer Undo()!" ); + DBG_ASSERT( pNode, "NULL-Pointer in InsertContent! " ); + DBG_ASSERT( IsInUndo(), "InsertContent only for Undo()!" ); ParaPortion* pNew = new ParaPortion( pNode ); GetParaPortions().Insert( pNew, nPos ); aEditDoc.Insert( pNode, nPos ); @@ -3839,9 +3707,9 @@ void ImpEditEngine::InsertContent( ContentNode* pNode, sal_uInt16 nPos ) EditPaM ImpEditEngine::SplitContent( sal_uInt16 nNode, sal_uInt16 nSepPos ) { ContentNode* pNode = aEditDoc.SaveGetObject( nNode ); - DBG_ASSERT( pNode, "Ungueltiger Node in SplitContent" ); - DBG_ASSERT( IsInUndo(), "SplitContent nur fuer Undo()!" ); - DBG_ASSERT( nSepPos <= pNode->Len(), "Index im Wald: SplitContent" ); + DBG_ASSERT( pNode, "Invalid Node in SplitContent" ); + DBG_ASSERT( IsInUndo(), "SplitContent only for Undo()!" ); + DBG_ASSERT( nSepPos <= pNode->Len(), "Index out of range: SplitContent" ); EditPaM aPaM( pNode, nSepPos ); return ImpInsertParaBreak( aPaM ); } @@ -3850,9 +3718,9 @@ EditPaM ImpEditEngine::ConnectContents( sal_uInt16 nLeftNode, sal_Bool bBackward { ContentNode* pLeftNode = aEditDoc.SaveGetObject( nLeftNode ); ContentNode* pRightNode = aEditDoc.SaveGetObject( nLeftNode+1 ); - DBG_ASSERT( pLeftNode, "Ungueltiger linker Node in ConnectContents" ); - DBG_ASSERT( pRightNode, "Ungueltiger rechter Node in ConnectContents" ); - DBG_ASSERT( IsInUndo(), "ConnectContent nur fuer Undo()!" ); + DBG_ASSERT( pLeftNode, "Invalid left node in ConnectContents "); + DBG_ASSERT( pRightNode, "Invalid right node in ConnectContents "); + DBG_ASSERT( IsInUndo(), "ConnectContent only for Undo()!" ); return ImpConnectParagraphs( pLeftNode, pRightNode, bBackward ); } @@ -3860,23 +3728,12 @@ void ImpEditEngine::SetUpdateMode( sal_Bool bUp, EditView* pCurView, sal_Bool bF { sal_Bool bChanged = ( GetUpdateMode() != bUp ); - // Beim Umschalten von sal_True auf sal_False waren alle Selektionen sichtbar, - // => Wegmalen - // Umgekehrt waren alle unsichtbar => malen - -// DrawAllSelections(); sieht im Outliner schlecht aus ! -// EditView* pView = aEditViewList.First(); -// while ( pView ) -// { -// DBG_CHKOBJ( pView, EditView, 0 ); -// pView->pImpEditView->DrawSelection(); -// pView = aEditViewList.Next(); -// } - - // Wenn !bFormatted, also z.B. nach SetText, braucht bei UpdateMode sal_True - // nicht sofort formatiert werden, weil warscheinlich noch Text kommt. - // Spaetestens bei einem Paint / CalcTextWidth wird formatiert. - + // When switching from sal_True to sal_False, all selections were visible, + // => paint over + // the other hand, were all invisible => paint + // If !bFormatted, e.g. after SetText, then if UpdateMode=sal_True + // formatting is not needed immediately, probably because more text is coming. + // At latest it is formatted at a Paint/CalcTextWidth. bUpdate = bUp; if ( bUpdate && ( bChanged || bForceUpdate ) ) FormatAndUpdate( pCurView ); @@ -3885,22 +3742,20 @@ void ImpEditEngine::SetUpdateMode( sal_Bool bUp, EditView* pCurView, sal_Bool bF void ImpEditEngine::ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow ) { ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph ); - DBG_ASSERT( pPPortion, "ShowParagraph: Absatz existiert nicht!" ); + DBG_ASSERT( pPPortion, "ShowParagraph: Paragraph does not exist! "); if ( pPPortion && ( pPPortion->IsVisible() != bShow ) ) { pPPortion->SetVisible( bShow ); if ( !bShow ) { - // Als deleted kenzeichnen, damit keine Selektion auf diesem - // Absatz beginnt oder endet... + // Mark as deleted, so that no selection will end or begin at + // this paragraph... DeletedNodeInfo* pDelInfo = new DeletedNodeInfo( (sal_uIntPtr)pPPortion->GetNode(), nParagraph ); aDeletedNodes.Insert( pDelInfo, aDeletedNodes.Count() ); UpdateSelections(); - // Dann kriege ich den unteren Bereich nicht invalidiert, - // wenn UpdateMode = sal_False! - // Wenn doch, dann vor SetVisible auf sal_False merken! -// nCurTextHeight -= pPPortion->GetHeight(); + // The region below will not be invalidated if UpdateMode = sal_False! + // If anyway, then save as sal_False before SetVisible ! } if ( bShow && ( pPPortion->IsInvalid() || !pPPortion->nHeight ) ) @@ -3910,7 +3765,7 @@ void ImpEditEngine::ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow ) if ( pPPortion->IsInvalid() ) { Font aOldFont( GetRefDevice()->GetFont() ); - CreateLines( nParagraph, 0 ); // 0: Kein TextRanger + CreateLines( nParagraph, 0 ); // 0: No TextRanger if ( aStatus.DoRestoreFont() ) GetRefDevice()->SetFont( aOldFont ); } @@ -3929,7 +3784,7 @@ void ImpEditEngine::ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow ) pPPortion->SetMustRepaint( sal_True ); if ( GetUpdateMode() && !IsInUndo() && !GetTextRanger() ) { - aInvalidRec = Rectangle( Point( 0, GetParaPortions().GetYOffset( pPPortion ) ), + aInvalidRec = Rectangle( Point( 0, GetParaPortions().GetYOffset( pPPortion ) ), Point( GetPaperSize().Width(), nCurTextHeight ) ); UpdateViews( GetActiveView() ); } @@ -3939,7 +3794,7 @@ void ImpEditEngine::ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow ) sal_Bool ImpEditEngine::IsParagraphVisible( sal_uInt16 nParagraph ) { ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph ); - DBG_ASSERT( pPPortion, "IsParagraphVisible: Absatz existiert nicht!" ); + DBG_ASSERT( pPPortion, "IsParagraphVisible: Paragraph does not exist! "); if ( pPPortion ) return pPPortion->IsVisible(); return sal_False; @@ -3947,7 +3802,7 @@ sal_Bool ImpEditEngine::IsParagraphVisible( sal_uInt16 nParagraph ) EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_uInt16 nNewPos, EditView* pCurView ) { - DBG_ASSERT( GetParaPortions().Count() != 0, "Keine Absaetze gefunden: MoveParagraphs" ); + DBG_ASSERT( GetParaPortions().Count() != 0, "No paragraphs found: MoveParagraphs" ); if ( GetParaPortions().Count() == 0 ) return EditSelection(); aOldPositions.Justify(); @@ -3957,20 +3812,20 @@ EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_uInt16 nNe if ( nNewPos >= GetParaPortions().Count() ) nNewPos = GetParaPortions().Count() - 1; - // Dort, wo der Absatz eingefuegt wurde, muss richtig gepainted werden: - // Dort, wo der Absatz entfernt wurde, muss richtig gepainted werden: - // ( Und dazwischen entsprechend auch...) + // Where the paragraph was inserted it has to be properly redrawn: + // Where the paragraph was removed it has to be properly redrawn: + // ( and correspondingly in between as well...) if ( pCurView && ( GetUpdateMode() == sal_True ) ) { - // in diesem Fall kann ich direkt neu malen, ohne die - // Portions zu Invalidieren. + // in this case one can redraw directly whithout invalidating the + // Portions sal_uInt16 nFirstPortion = Min( (sal_uInt16)aOldPositions.Min(), nNewPos ); sal_uInt16 nLastPortion = Max( (sal_uInt16)aOldPositions.Max(), nNewPos ); ParaPortion* pUpperPortion = GetParaPortions().SaveGetObject( nFirstPortion ); ParaPortion* pLowerPortion = GetParaPortions().SaveGetObject( nLastPortion ); - aInvalidRec = Rectangle(); // leermachen + aInvalidRec = Rectangle(); // make empty aInvalidRec.Left() = 0; aInvalidRec.Right() = aPaperSize.Width(); aInvalidRec.Top() = GetParaPortions().GetYOffset( pUpperPortion ); @@ -3980,7 +3835,7 @@ EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_uInt16 nNe } else { - // aber der oberen ungueltigen Position neu painten... + // redraw from the upper invalid position sal_uInt16 nFirstInvPara = Min( (sal_uInt16)aOldPositions.Min(), nNewPos ); InvalidateFromParagraph( nFirstInvPara ); } @@ -3989,9 +3844,8 @@ EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_uInt16 nNe void ImpEditEngine::InvalidateFromParagraph( sal_uInt16 nFirstInvPara ) { - // Es werden nicht die folgenden Absaetze invalidiert, - // da ResetHeight() => Groessenanderung => alles folgende wird - // sowieso neu ausgegeben. + // The following paragraphs are not invalidated, since ResetHeight() + // => size change => all the following are re-issued anyway. ParaPortion* pTmpPortion; if ( nFirstInvPara != 0 ) { @@ -4017,19 +3871,19 @@ void ImpEditEngine::CallStatusHdl() { if ( aStatusHdlLink.IsSet() && aStatus.GetStatusWord() ) { - // Der Status muss vor Call zurueckgesetzt werden, - // da im Hdl evtl. weitere Fags gesetzt werden... + // The Status has to be reset before the Call, + // since other Flags might be set in the handler... EditStatus aTmpStatus( aStatus ); aStatus.Clear(); aStatusHdlLink.Call( &aTmpStatus ); - aStatusTimer.Stop(); // Falls von Hand gerufen... + aStatusTimer.Stop(); // If called by hand ... } } ContentNode* ImpEditEngine::GetPrevVisNode( ContentNode* pCurNode ) { ParaPortion* pPortion = FindParaPortion( pCurNode ); - DBG_ASSERT( pPortion, "GetPrevVisibleNode: Keine passende Portion!" ); + DBG_ASSERT( pPortion, "GetPrevVisibleNode: No matching portion!" ); pPortion = GetPrevVisPortion( pPortion ); if ( pPortion ) return pPortion->GetNode(); @@ -4039,7 +3893,7 @@ ContentNode* ImpEditEngine::GetPrevVisNode( ContentNode* pCurNode ) ContentNode* ImpEditEngine::GetNextVisNode( ContentNode* pCurNode ) { ParaPortion* pPortion = FindParaPortion( pCurNode ); - DBG_ASSERT( pPortion, "GetNextVisibleNode: Keine passende Portion!" ); + DBG_ASSERT( pPortion, "GetNextVisibleNode: No matching portion!" ); pPortion = GetNextVisPortion( pPortion ); if ( pPortion ) return pPortion->GetNode(); @@ -4049,7 +3903,7 @@ ContentNode* ImpEditEngine::GetNextVisNode( ContentNode* pCurNode ) ParaPortion* ImpEditEngine::GetPrevVisPortion( ParaPortion* pCurPortion ) { sal_uInt16 nPara = GetParaPortions().GetPos( pCurPortion ); - DBG_ASSERT( nPara < GetParaPortions().Count() , "Portion nicht gefunden: GetPrevVisPortion" ); + DBG_ASSERT( nPara < GetParaPortions().Count() , "Portion not found: GetPrevVisPortion" ); ParaPortion* pPortion = nPara ? GetParaPortions()[--nPara] : 0; while ( pPortion && !pPortion->IsVisible() ) pPortion = nPara ? GetParaPortions()[--nPara] : 0; @@ -4060,7 +3914,7 @@ ParaPortion* ImpEditEngine::GetPrevVisPortion( ParaPortion* pCurPortion ) ParaPortion* ImpEditEngine::GetNextVisPortion( ParaPortion* pCurPortion ) { sal_uInt16 nPara = GetParaPortions().GetPos( pCurPortion ); - DBG_ASSERT( nPara < GetParaPortions().Count() , "Portion nicht gefunden: GetPrevVisNode" ); + DBG_ASSERT( nPara < GetParaPortions().Count() , "Portion not found: GetPrevVisNode" ); ParaPortion* pPortion = GetParaPortions().SaveGetObject( ++nPara ); while ( pPortion && !pPortion->IsVisible() ) pPortion = GetParaPortions().SaveGetObject( ++nPara ); @@ -4124,7 +3978,7 @@ EditPaM ImpEditEngine::InsertParagraph( sal_uInt16 nPara ) ContentNode* pNode = GetEditDoc().SaveGetObject( nPara-1 ); if ( !pNode ) pNode = GetEditDoc().SaveGetObject( GetEditDoc().Count() - 1 ); - DBG_ASSERT( pNode, "Kein einziger Absatz in InsertParagraph ?" ); + DBG_ASSERT( pNode, "Not a single paragraph in InsertParagraph ?" ); aPaM = EditPaM( pNode, pNode->Len() ); } else @@ -4140,7 +3994,7 @@ EditSelection* ImpEditEngine::SelectParagraph( sal_uInt16 nPara ) { EditSelection* pSel = 0; ContentNode* pNode = GetEditDoc().SaveGetObject( nPara ); - DBG_ASSERTWARNING( pNode, "Absatz existiert nicht: SelectParagraph" ); + DBG_ASSERTWARNING( pNode, "Paragraph does not exist: SelectParagraph" ); if ( pNode ) pSel = new EditSelection( EditPaM( pNode, 0 ), EditPaM( pNode, pNode->Len() ) ); @@ -4215,9 +4069,9 @@ void ImpEditEngine::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY ) if ( nX != 100 ) { - // Fontbreite + // Font width SvxCharScaleWidthItem* pNewWidth = (SvxCharScaleWidthItem*) pNode->GetContentAttribs().GetItem( EE_CHAR_FONTWIDTH ).Clone(); - sal_uInt32 nProp = pNewWidth->GetValue(); // sal_uInt32, kann temporaer gross werden + sal_uInt32 nProp = pNewWidth->GetValue(); // sal_uInt32, can get big temporary nProp *= nX; nProp /= 100; pNewWidth->SetValue( (sal_uInt16)nProp ); @@ -4236,8 +4090,8 @@ void ImpEditEngine::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY ) } else if ( nKerning < 0 ) { - // Bei Negativen Werten: - // Bei Stretching > 100 muessen die Werte kleiner werden und umgekehrt. + // For negative values: + // For stretching > 100 the values must become smaller and vice versa nKerning *= 100; nKerning /= nX; } @@ -4250,10 +4104,10 @@ void ImpEditEngine::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY ) if ( nY != 100 ) { - // Fonthoehe + // Font height for ( int nItem = 0; nItem < 3; nItem++ ) { - USHORT nItemId = EE_CHAR_FONTHEIGHT; + sal_uInt16 nItemId = EE_CHAR_FONTHEIGHT; if ( nItem == 1 ) nItemId = EE_CHAR_FONTHEIGHT_CJK; else if ( nItem == 2 ) @@ -4270,7 +4124,7 @@ void ImpEditEngine::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY ) delete pNewHeight; } - // Absatzabstaende + // Paragraph spacing const SvxULSpaceItem& rULSpaceItem = (const SvxULSpaceItem&)pNode->GetContentAttribs().GetItem( EE_PARA_ULSPACE ); SvxULSpaceItem* pNewUL = (SvxULSpaceItem*)rULSpaceItem.Clone(); @@ -4290,8 +4144,8 @@ void ImpEditEngine::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY ) SetParaAttribs( nPara, aTmpSet ); - // harte Attribute: - sal_uInt16 nLastEnd = 0; // damit nach entfernen und neu nicht nochmal + // hard attributes: + sal_uInt16 nLastEnd = 0; // so not again after removing them and new CharAttribArray& rAttribs = pNode->GetCharAttribs().GetAttribs(); sal_uInt16 nAttribs = rAttribs.Count(); for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ ) @@ -4330,8 +4184,8 @@ void ImpEditEngine::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY ) } else if ( nKerning < 0 ) { - // Bei Negativen Werten: - // Bei Stretching > 100 muessen die Werte kleiner werden und umgekehrt. + // For negative values: + // For stretching > 100 the values must become smaller and vice versa. nKerning *= 100; nKerning /= nX; } @@ -4361,7 +4215,7 @@ const SvxNumberFormat* ImpEditEngine::GetNumberFormat( const ContentNode *pNode if (pNode) { // get index of paragraph - USHORT nPara = GetEditDoc().GetPos( const_cast< ContentNode * >(pNode) ); + sal_uInt16 nPara = GetEditDoc().GetPos( const_cast< ContentNode * >(pNode) ); DBG_ASSERT( nPara < USHRT_MAX, "node not found in array" ); if (nPara < USHRT_MAX) { @@ -4446,7 +4300,7 @@ void ImpEditEngine::ImplInitDigitMode( OutputDevice* pOutDev, String* pString, x break; case LANGUAGE_URDU & LANGUAGE_MASK_PRIMARY: case LANGUAGE_PUNJABI & LANGUAGE_MASK_PRIMARY: //??? - case LANGUAGE_SINDHI & LANGUAGE_MASK_PRIMARY: + case LANGUAGE_SINDHI & LANGUAGE_MASK_PRIMARY: nOffset = 0x06F0 - '0'; // eastern arabic-indic digits break; } @@ -4465,10 +4319,10 @@ void ImpEditEngine::ImplInitDigitMode( OutputDevice* pOutDev, String* pString, x } } -void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, USHORT nPara, USHORT nIndex ) +void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, sal_uInt16 nPara, sal_uInt16 nIndex ) { - BOOL bCTL = FALSE; - BYTE bR2L = FALSE; + sal_Bool bCTL = sal_False; + sal_uInt8 bR2L = sal_False; if ( nIndex == 0xFFFF ) { bCTL = HasScriptType( nPara, i18n::ScriptType::COMPLEX ); @@ -4483,7 +4337,7 @@ void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, USHORT nPara, USH // it also works for issue 55927 } - ULONG nLayoutMode = pOutDev->GetLayoutMode(); + sal_uLong nLayoutMode = pOutDev->GetLayoutMode(); // We always use the left postion for DrawText() nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL); @@ -4527,7 +4381,7 @@ Reference < i18n::XBreakIterator > ImpEditEngine::ImplGetBreakIterator() const if ( !xBI.is() ) { Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - xBI.set( xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ), UNO_QUERY ); + xBI.set( xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.BreakIterator" )) ), UNO_QUERY ); } return xBI; } @@ -4537,7 +4391,7 @@ Reference < i18n::XExtendedInputSequenceChecker > ImpEditEngine::ImplGetInputSeq if ( !xISC.is() ) { Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.InputSequenceChecker" ) ); + Reference < XInterface > xI = xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.InputSequenceChecker" )) ); if ( xI.is() ) { Any x = xI->queryInterface( ::getCppuType((const Reference< i18n::XExtendedInputSequenceChecker >*)0) ); @@ -4563,28 +4417,27 @@ Color ImpEditEngine::GetAutoColor() const } -BOOL ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, USHORT nStartPos, sal_Int32* pDXArray, USHORT n100thPercentFromMax, BOOL bManipulateDXArray ) +sal_Bool ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_uInt16 nStartPos, sal_Int32* pDXArray, sal_uInt16 n100thPercentFromMax, sal_Bool bManipulateDXArray ) { DBG_ASSERT( GetAsianCompressionMode(), "ImplCalcAsianCompression - Why?" ); DBG_ASSERT( pTextPortion->GetLen(), "ImplCalcAsianCompression - Empty Portion?" ); // Percent is 1/100 Percent... - if ( n100thPercentFromMax == 10000 ) pTextPortion->SetExtraInfos( NULL ); - BOOL bCompressed = FALSE; + sal_Bool bCompressed = sal_False; if ( GetScriptType( EditPaM( pNode, nStartPos+1 ) ) == i18n::ScriptType::ASIAN ) { long nNewPortionWidth = pTextPortion->GetSize().Width(); - USHORT nPortionLen = pTextPortion->GetLen(); - for ( USHORT n = 0; n < nPortionLen; n++ ) + sal_uInt16 nPortionLen = pTextPortion->GetLen(); + for ( sal_uInt16 n = 0; n < nPortionLen; n++ ) { - BYTE nType = GetCharTypeForCompression( pNode->GetChar( n+nStartPos ) ); + sal_uInt8 nType = GetCharTypeForCompression( pNode->GetChar( n+nStartPos ) ); - BOOL bCompressPunctuation = ( nType == CHAR_PUNCTUATIONLEFT ) || ( nType == CHAR_PUNCTUATIONRIGHT ); - BOOL bCompressKana = ( nType == CHAR_KANA ) && ( GetAsianCompressionMode() == text::CharacterCompressionType::PUNCTUATION_AND_KANA ); + sal_Bool bCompressPunctuation = ( nType == CHAR_PUNCTUATIONLEFT ) || ( nType == CHAR_PUNCTUATIONRIGHT ); + sal_Bool bCompressKana = ( nType == CHAR_KANA ) && ( GetAsianCompressionMode() == text::CharacterCompressionType::PUNCTUATION_AND_KANA ); // create Extra infos only if needed... if ( bCompressPunctuation || bCompressKana ) @@ -4598,7 +4451,6 @@ BOOL ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortion* p } pTextPortion->GetExtraInfos()->nMaxCompression100thPercent = n100thPercentFromMax; pTextPortion->GetExtraInfos()->nAsianCompressionTypes |= nType; -// pTextPortion->GetExtraInfos()->nCompressedChars++; long nOldCharWidth; if ( (n+1) < nPortionLen ) @@ -4618,12 +4470,10 @@ BOOL ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortion* p if ( bCompressPunctuation ) { - // pTextPortion->GetExtraInfos()->nComressionWeight += 5; nCompress = nOldCharWidth / 2; } else // Kana { - // pTextPortion->GetExtraInfos()->nComressionWeight += 1; nCompress = nOldCharWidth / 10; } @@ -4635,13 +4485,13 @@ BOOL ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortion* p if ( nCompress ) { - bCompressed = TRUE; + bCompressed = sal_True; nNewPortionWidth -= nCompress; - pTextPortion->GetExtraInfos()->bCompressed = TRUE; + pTextPortion->GetExtraInfos()->bCompressed = sal_True; // Special handling for rightpunctuation: For the 'compression' we must - // start th eoutput before the normal char position.... + // start the output before the normal char position.... if ( bManipulateDXArray && ( pTextPortion->GetLen() > 1 ) ) { if ( !pTextPortion->GetExtraInfos()->pOrgDXArray ) @@ -4653,19 +4503,19 @@ BOOL ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortion* p if ( n ) { // -1: No entry for the last character - for ( USHORT i = n-1; i < (nPortionLen-1); i++ ) + for ( sal_uInt16 i = n-1; i < (nPortionLen-1); i++ ) pDXArray[i] -= nCompress; } else { - pTextPortion->GetExtraInfos()->bFirstCharIsRightPunktuation = TRUE; + pTextPortion->GetExtraInfos()->bFirstCharIsRightPunktuation = sal_True; pTextPortion->GetExtraInfos()->nPortionOffsetX = -nCompress; } } else { // -1: No entry for the last character - for ( USHORT i = n; i < (nPortionLen-1); i++ ) + for ( sal_uInt16 i = n; i < (nPortionLen-1); i++ ) pDXArray[i] -= nCompress; } } @@ -4695,18 +4545,17 @@ BOOL ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortion* p void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* pParaPortion, long nRemainingWidth ) { - BOOL bFoundCompressedPortion = FALSE; + sal_Bool bFoundCompressedPortion = sal_False; long nCompressed = 0; -// long nCompressWeight = 0; TextPortionList aCompressedPortions; - USHORT nPortion = pLine->GetEndPortion(); + sal_uInt16 nPortion = pLine->GetEndPortion(); TextPortion* pTP = pParaPortion->GetTextPortions()[ nPortion ]; while ( pTP && ( pTP->GetKind() == PORTIONKIND_TEXT ) ) { if ( pTP->GetExtraInfos() && pTP->GetExtraInfos()->bCompressed ) { - bFoundCompressedPortion = TRUE; + bFoundCompressedPortion = sal_True; nCompressed += pTP->GetExtraInfos()->nOrgWidth - pTP->GetSize().Width(); aCompressedPortions.Insert( pTP, aCompressedPortions.Count() ); } @@ -4724,20 +4573,20 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* nCompressPercent /= nCompressed; } - for ( USHORT n = 0; n < aCompressedPortions.Count(); n++ ) + for ( sal_uInt16 n = 0; n < aCompressedPortions.Count(); n++ ) { pTP = aCompressedPortions[n]; - pTP->GetExtraInfos()->bCompressed = FALSE; + pTP->GetExtraInfos()->bCompressed = sal_False; pTP->GetSize().Width() = pTP->GetExtraInfos()->nOrgWidth; if ( nCompressPercent ) { - USHORT nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP ); - USHORT nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion ); + sal_uInt16 nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP ); + sal_uInt16 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion ); DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" ); sal_Int32* pDXArray = const_cast< sal_Int32* >( pLine->GetCharPosArray().GetData()+( nTxtPortionStart-pLine->GetStart() ) ); if ( pTP->GetExtraInfos()->pOrgDXArray ) memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray, (pTP->GetLen()-1)*sizeof(sal_Int32) ); - ImplCalcAsianCompression( pParaPortion->GetNode(), pTP, nTxtPortionStart, pDXArray, (USHORT)nCompressPercent, TRUE ); + ImplCalcAsianCompression( pParaPortion->GetNode(), pTP, nTxtPortionStart, pDXArray, (sal_uInt16)nCompressPercent, sal_True ); } } } @@ -4746,7 +4595,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* } // redesigned to work with TextMarkingVector -void ImpEditEngine::ImplFillTextMarkingVector(const lang::Locale& rLocale, EEngineData::TextMarkingVector& rTextMarkingVector, const String& rTxt, const USHORT nIdx, const USHORT nLen) const +void ImpEditEngine::ImplFillTextMarkingVector(const lang::Locale& rLocale, EEngineData::TextMarkingVector& rTextMarkingVector, const String& rTxt, const sal_uInt16 nIdx, const sal_uInt16 nLen) const { // determine relevant logical text elements for the just-rendered // string of characters. diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index c56809c380..6246ae9684 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -94,7 +94,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::linguistic2; -void SwapUSHORTs( sal_uInt16& rX, sal_uInt16& rY ) +void Swapsal_uIt16s( sal_uInt16& rX, sal_uInt16& rY ) { sal_uInt16 n = rX; rX = rY; @@ -118,10 +118,10 @@ EditPaM ImpEditEngine::Read( SvStream& rInput, const String& rBaseURL, EETextFor aPaM = ReadBin( rInput, aSel ); else { - DBG_ERROR( "Read: Unbekanntes Format" ); + OSL_FAIL( "Read: Unknown Format" ); } - FormatFullDoc(); // reicht vielleicht auch ein einfaches Format? + FormatFullDoc(); // perhaps a simple format is enough? SetUpdateMode( _bUpdate ); return aPaM; @@ -147,7 +147,6 @@ EditPaM ImpEditEngine::ReadText( SvStream& rInput, EditSelection aSel ) EditPaM ImpEditEngine::ReadXML( SvStream& rInput, EditSelection aSel ) { -#ifndef SVX_LIGHT if ( aSel.HasRange() ) aSel = ImpDeleteSelection( aSel ); @@ -156,15 +155,10 @@ EditPaM ImpEditEngine::ReadXML( SvStream& rInput, EditSelection aSel ) ::SvxReadXML( *GetEditEnginePtr(), rInput, aESel ); return aSel.Max(); -#else - return EditPaM(); -#endif } EditPaM ImpEditEngine::ReadRTF( SvStream& rInput, EditSelection aSel ) { -#ifndef SVX_LIGHT - #if defined (EDITDEBUG) && !defined( UNX ) SvFileStream aRTFOut( String( RTL_CONSTASCII_USTRINGPARAM ( "d:\\rtf_in.rtf" ) ), STREAM_WRITE ); aRTFOut << rInput; @@ -174,18 +168,15 @@ EditPaM ImpEditEngine::ReadRTF( SvStream& rInput, EditSelection aSel ) if ( aSel.HasRange() ) aSel = ImpDeleteSelection( aSel ); -// sal_Bool bCharsBeforeInsertPos = ( aSel.Min().GetIndex() ) ? sal_True : sal_False; -// sal_Bool bCharsBehindInsertPos = ( aSel.Min().GetIndex() < aSel.Min().GetNode()->Len() ) ? sal_True : sal_False; - - // Der SvRTF-Parser erwartet, dass das Which-Mapping am uebergebenen Pool, - // nicht an einem Secondary haengt. + // The SvRTF parser expects the Which-mapping passed on in the pool, not + // dependant on a secondary. SfxItemPool* pPool = &aEditDoc.GetItemPool(); while ( pPool->GetSecondaryPool() && !pPool->GetName().EqualsAscii( "EditEngineItemPool" ) ) { pPool = pPool->GetSecondaryPool(); } - DBG_ASSERT( pPool && pPool->GetName().EqualsAscii( "EditEngineItemPool" ), "ReadRTF: Kein EditEnginePool!" ); + DBG_ASSERT( pPool && pPool->GetName().EqualsAscii( "EditEngineItemPool" ), "ReadRTF: no EditEnginePool!" ); EditRTFParserRef xPrsr = new EditRTFParser( rInput, aSel, *pPool, this ); SvParserState eState = xPrsr->CallParser(); @@ -195,21 +186,13 @@ EditPaM ImpEditEngine::ReadRTF( SvStream& rInput, EditSelection aSel ) return aSel.Min(); } return xPrsr->GetCurPaM(); -#else - return EditPaM(); -#endif } EditPaM ImpEditEngine::ReadHTML( SvStream& rInput, const String& rBaseURL, EditSelection aSel, SvKeyValueIterator* pHTTPHeaderAttrs ) { -#ifndef SVX_LIGHT - if ( aSel.HasRange() ) aSel = ImpDeleteSelection( aSel ); -// sal_Bool bCharsBeforeInsertPos = ( aSel.Min().GetIndex() ) ? sal_True : sal_False; -// sal_Bool bCharsBehindInsertPos = ( aSel.Min().GetIndex() < aSel.Min().GetNode()->Len() ) ? sal_True : sal_False; - EditHTMLParserRef xPrsr = new EditHTMLParser( rInput, rBaseURL, pHTTPHeaderAttrs ); SvParserState eState = xPrsr->CallParser( this, aSel.Max() ); if ( ( eState != SVPAR_ACCEPTED ) && ( !rInput.GetError() ) ) @@ -218,14 +201,11 @@ EditPaM ImpEditEngine::ReadHTML( SvStream& rInput, const String& rBaseURL, EditS return aSel.Min(); } return xPrsr->GetCurSelection().Max(); -#else - return EditPaM(); -#endif } EditPaM ImpEditEngine::ReadBin( SvStream& rInput, EditSelection aSel ) { - // Einfach ein temporaeres TextObject missbrauchen... + // Simply abuse a temporary text object ... EditTextObject* pObj = EditTextObject::Create( rInput, NULL ); EditPaM aLastPaM = aSel.Max(); @@ -236,7 +216,6 @@ EditPaM ImpEditEngine::ReadBin( SvStream& rInput, EditSelection aSel ) return aLastPaM; } -#ifndef SVX_LIGHT void ImpEditEngine::Write( SvStream& rOutput, EETextFormat eFormat, EditSelection aSel ) { if ( !rOutput.IsWritable() ) @@ -256,11 +235,10 @@ void ImpEditEngine::Write( SvStream& rOutput, EETextFormat eFormat, EditSelectio WriteBin( rOutput, aSel ); else { - DBG_ERROR( "Write: Unbekanntes Format" ); + OSL_FAIL( "Write: Unknown Format" ); } } } -#endif sal_uInt32 ImpEditEngine::WriteText( SvStream& rOutput, EditSelection aSel ) { @@ -278,11 +256,11 @@ sal_uInt32 ImpEditEngine::WriteText( SvStream& rOutput, EditSelection aSel ) nEndNode = aEditDoc.Count()-1; } - // ueber die Absaetze iterieren... + // iterate over the paragraphs ... for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { ContentNode* pNode = aEditDoc.GetObject( nNode ); - DBG_ASSERT( pNode, "Node nicht gefunden: Search&Replace" ); + DBG_ASSERT( pNode, "Node not founden: Search&Replace" ); sal_uInt16 nStartPos = 0; sal_uInt16 nEndPos = pNode->Len(); @@ -290,7 +268,7 @@ sal_uInt32 ImpEditEngine::WriteText( SvStream& rOutput, EditSelection aSel ) { if ( nNode == nStartNode ) nStartPos = aSel.Min().GetIndex(); - if ( nNode == nEndNode ) // kann auch == nStart sein! + if ( nNode == nEndNode ) // can also be == nStart! nEndPos = aSel.Max().GetIndex(); } XubString aTmpStr = aEditDoc.GetParaAsString( pNode, nStartPos, nEndPos ); @@ -312,24 +290,24 @@ sal_Bool ImpEditEngine::WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, s return ( rLst.Count() ? sal_True : sal_False ); } -void lcl_FindValidAttribs( ItemList& rLst, ContentNode* pNode, sal_uInt16 nIndex, USHORT nScriptType ) +void lcl_FindValidAttribs( ItemList& rLst, ContentNode* pNode, sal_uInt16 nIndex, sal_uInt16 nScriptType ) { sal_uInt16 nAttr = 0; EditCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); while ( pAttr && ( pAttr->GetStart() <= nIndex ) ) { - // Start wird in While ueberprueft... + // Start is checked in while ... if ( pAttr->GetEnd() > nIndex ) { if ( IsScriptItemValid( pAttr->GetItem()->Which(), nScriptType ) ) - rLst.Insert( pAttr->GetItem(), LIST_APPEND ); + rLst.Insert( pAttr->GetItem() ); } nAttr++; pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); } } -sal_uInt32 ImpEditEngine::WriteBin( SvStream& rOutput, EditSelection aSel, BOOL bStoreUnicodeStrings ) const +sal_uInt32 ImpEditEngine::WriteBin( SvStream& rOutput, EditSelection aSel, sal_Bool bStoreUnicodeStrings ) const { BinTextObject* pObj = (BinTextObject*)CreateBinTextObject( aSel, NULL ); pObj->StoreUnicodeStrings( bStoreUnicodeStrings ); @@ -338,7 +316,6 @@ sal_uInt32 ImpEditEngine::WriteBin( SvStream& rOutput, EditSelection aSel, BOOL return 0; } -#ifndef SVX_LIGHT sal_uInt32 ImpEditEngine::WriteXML( SvStream& rOutput, EditSelection aSel ) { ESelection aESel = CreateESel( aSel ); @@ -347,7 +324,6 @@ sal_uInt32 ImpEditEngine::WriteXML( SvStream& rOutput, EditSelection aSel ) return 0; } -#endif static sal_uInt16 getStylePos( const SfxStyles& rStyles, SfxStyleSheet* pSheet ) { @@ -364,8 +340,7 @@ static sal_uInt16 getStylePos( const SfxStyles& rStyles, SfxStyleSheet* pSheet ) sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) { -#ifndef SVX_LIGHT - DBG_ASSERT( GetUpdateMode(), "WriteRTF bei UpdateMode = sal_False!" ); + DBG_ASSERT( GetUpdateMode(), "WriteRTF for UpdateMode = sal_False!" ); CheckIdleFormatter(); if ( !IsFormatted() ) FormatDoc(); @@ -376,7 +351,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); - // RTF-Vorspann... + // RTF header ... rOutput << '{' ; rOutput << OOO_STRING_SVTOOLS_RTF_RTF; @@ -384,27 +359,27 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) rOutput << OOO_STRING_SVTOOLS_RTF_ANSI; rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252; - // Fonttabelle erzeugen und rausschreiben... + // Generate and write out Font table ... SvxFontTable aFontTable; - // DefaultFont muss ganz vorne stehen, damit DEF-Font im RTF + // default font must be up front, so DEF font in RTF aFontTable.Insert( 0, new SvxFontItem( (const SvxFontItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_FONTINFO ) ) ); aFontTable.Insert( 1, new SvxFontItem( (const SvxFontItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_FONTINFO_CJK ) ) ); aFontTable.Insert( 2, new SvxFontItem( (const SvxFontItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_FONTINFO_CTL ) ) ); - for ( USHORT nScriptType = 0; nScriptType < 3; nScriptType++ ) + for ( sal_uInt16 nScriptType = 0; nScriptType < 3; nScriptType++ ) { - USHORT nWhich = EE_CHAR_FONTINFO; + sal_uInt16 nWhich = EE_CHAR_FONTINFO; if ( nScriptType == 1 ) nWhich = EE_CHAR_FONTINFO_CJK; else if ( nScriptType == 2 ) nWhich = EE_CHAR_FONTINFO_CTL; - sal_uInt16 i = 0; - SvxFontItem* pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem( nWhich, i ); + sal_uInt32 i = 0; + SvxFontItem* pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem2( nWhich, i ); while ( pFontItem ) { bool bAlreadyExist = false; - ULONG nTestMax = nScriptType ? aFontTable.Count() : 1; - for ( ULONG nTest = 0; !bAlreadyExist && ( nTest < nTestMax ); nTest++ ) + sal_uLong nTestMax = nScriptType ? aFontTable.Count() : 1; + for ( sal_uLong nTest = 0; !bAlreadyExist && ( nTest < nTestMax ); nTest++ ) { bAlreadyExist = *aFontTable.Get( nTest ) == *pFontItem; } @@ -412,7 +387,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) if ( !bAlreadyExist ) aFontTable.Insert( aFontTable.Count(), new SvxFontItem( *pFontItem ) ); - pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem( nWhich, ++i ); + pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem2( nWhich, ++i ); } } @@ -466,19 +441,19 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) rOutput << '}'; rOutput << endl; - // ColorList rausschreiben... + // Write out ColorList ... SvxColorList aColorList; - sal_uInt16 i = 0; - SvxColorItem* pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem( EE_CHAR_COLOR, i ); + sal_uInt32 i = 0; + SvxColorItem* pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem2( EE_CHAR_COLOR, i ); while ( pColorItem ) { - USHORT nPos = i; + sal_uInt32 nPos = i; if ( pColorItem->GetValue() == COL_AUTO ) nPos = 0; aColorList.Insert( new SvxColorItem( *pColorItem ), nPos ); - pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem( EE_CHAR_COLOR, ++i ); + pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem2( EE_CHAR_COLOR, ++i ); } - aColorList.Insert( new SvxColorItem( (const SvxColorItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_COLOR) ), (sal_uInt32)i ); + aColorList.Insert( new SvxColorItem( (const SvxColorItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_COLOR) ), i ); rOutput << '{' << OOO_STRING_SVTOOLS_RTF_COLORTBL; for ( j = 0; j < aColorList.Count(); j++ ) @@ -515,7 +490,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) sal_uInt16 nNumber = (sal_uInt16) (nStyle + 1); rOutput.WriteNumber( nNumber ); - // Attribute, auch aus Parent! + // Attribute, alos from Parent! for ( sal_uInt16 nParAttr = EE_PARA_START; nParAttr <= EE_CHAR_END; nParAttr++ ) { if ( pStyle->GetItemSet().GetItemState( nParAttr ) == SFX_ITEM_ON ) @@ -525,27 +500,27 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) } } - // Parent...(nur wenn noetig) + // Parent ... (only if necessary) if ( pStyle->GetParent().Len() && ( pStyle->GetParent() != pStyle->GetName() ) ) { SfxStyleSheet* pParent = (SfxStyleSheet*)GetStyleSheetPool()->Find( pStyle->GetParent(), pStyle->GetFamily() ); - DBG_ASSERT( pParent, "Parent nicht gefunden!" ); + DBG_ASSERT( pParent, "Parent not found!" ); rOutput << OOO_STRING_SVTOOLS_RTF_SBASEDON; nNumber = (sal_uInt16) getStylePos( GetStyleSheetPool()->GetStyles(), pParent ) + 1; rOutput.WriteNumber( nNumber ); } - // Folgevorlage...(immer) + // Next Style ... (more) SfxStyleSheet* pNext = pStyle; if ( pStyle->GetFollow().Len() && ( pStyle->GetFollow() != pStyle->GetName() ) ) pNext = (SfxStyleSheet*)GetStyleSheetPool()->Find( pStyle->GetFollow(), pStyle->GetFamily() ); - DBG_ASSERT( pNext, "Naechsten nicht gefunden!" ); + DBG_ASSERT( pNext, "Next ot found!" ); rOutput << OOO_STRING_SVTOOLS_RTF_SNEXT; nNumber = (sal_uInt16) getStylePos( GetStyleSheetPool()->GetStyles(), pNext ) + 1; rOutput.WriteNumber( nNumber ); - // Namen der Vorlage... + // Name of the template ... rOutput << " " << ByteString( pStyle->GetName(), eDestEnc ).GetBuffer(); rOutput << ";}"; } @@ -554,7 +529,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) } } - // Die Pool-Defaults vorweg schreiben... + // Write the pool defaults in advance ... rOutput << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << "\\EditEnginePoolDefaults"; for ( sal_uInt16 nPoolDefItem = EE_PARA_START; nPoolDefItem <= EE_CHAR_END; nPoolDefItem++) { @@ -563,13 +538,6 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) } rOutput << '}' << endl; - // Def-Hoehe vorweg, da sonst 12Pt - // Doch nicht, onst in jedem Absatz hart! - // SfxItemSet aTmpSet( GetEmptyItemSet() ); - // const SvxFontHeightItem& rDefFontHeight = (const SvxFontHeightItem&)aTmpSet.Get( EE_CHAR_FONTHEIGHT ); - // WriteItemAsRTF( rDefFontHeight, rOutput, aFontTable, aColorList ); - // rOutput << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << "\\EditEnginePoolDefaultHeight}" << endl; - // DefTab: MapMode aTwpMode( MAP_TWIP ); sal_uInt16 nDefTabTwps = (sal_uInt16) GetRefDevice()->LogicToLogic( @@ -579,26 +547,26 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) rOutput.WriteNumber( nDefTabTwps ); rOutput << endl; - // ueber die Absaetze iterieren... + // iterate over the paragraphs ... rOutput << '{' << endl; for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { ContentNode* pNode = aEditDoc.SaveGetObject( nNode ); - DBG_ASSERT( pNode, "Node nicht gefunden: Search&Replace" ); + DBG_ASSERT( pNode, "Node not found: Search&Replace" ); - // Die Absatzattribute vorweg... + // The paragraph attributes in advance ... sal_Bool bAttr = sal_False; - // Vorlage ? + // Template? if ( pNode->GetStyleSheet() ) { - // Nummer der Vorlage + // Number of template rOutput << OOO_STRING_SVTOOLS_RTF_S; sal_uInt16 nNumber = (sal_uInt16) getStylePos( GetStyleSheetPool()->GetStyles(), pNode->GetStyleSheet() ) + 1; rOutput.WriteNumber( nNumber ); - // Alle Attribute - // Attribute, auch aus Parent! + // All Attribute + // Attribute, also from Parent! for ( sal_uInt16 nParAttr = EE_PARA_START; nParAttr <= EE_CHAR_END; nParAttr++ ) { if ( pNode->GetStyleSheet()->GetItemSet().GetItemState( nParAttr ) == SFX_ITEM_ON ) @@ -612,8 +580,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) for ( sal_uInt16 nParAttr = EE_PARA_START; nParAttr <= EE_CHAR_END; nParAttr++ ) { -// const SfxPoolItem& rItem = pNode->GetContentAttribs().GetItem( nParAttr ); - // Jetzt, wo StyleSheet-Verarbeitung, nur noch harte Absatzattribute! + // Now where stylesheet processing, only hard paragraph attributes! if ( pNode->GetContentAttribs().GetItems().GetItemState( nParAttr ) == SFX_ITEM_ON ) { const SfxPoolItem& rItem = pNode->GetContentAttribs().GetItems().Get( nParAttr ); @@ -626,7 +593,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) ItemList aAttribItems; ParaPortion* pParaPortion = FindParaPortion( pNode ); - DBG_ASSERT( pParaPortion, "Portion nicht gefunden: WriteRTF" ); + DBG_ASSERT( pParaPortion, "Portion not found: WriteRTF" ); sal_uInt16 nIndex = 0; sal_uInt16 nStartPos = 0; @@ -646,8 +613,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) lcl_FindValidAttribs( aAttribItems, pNode, nStartPos, GetScriptType( EditPaM( pNode, 0 ) ) ); if ( aAttribItems.Count() ) { - // Diese Attribute duerfen nicht fuer den gesamten - // Absatz gelten: + // These attributes may not apply to the entire paragraph: rOutput << '{'; WriteItemListAsRTF( aAttribItems, rOutput, nNode, nStartPos, aFontTable, aColorList ); bFinishPortion = sal_True; @@ -655,15 +621,14 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) aAttribItems.Clear(); } } - if ( nNode == nEndNode ) // kann auch == nStart sein! + if ( nNode == nEndNode ) // can also be == nStart! { nEndPos = aSel.Max().GetIndex(); nEndPortion = pParaPortion->GetTextPortions().FindPortion( nEndPos, nPortionStart ); } EditCharAttrib* pNextFeature = pNode->GetCharAttribs().FindFeature( nIndex ); - // Bei 0 anfangen, damit der Index richtig ist... - + // start at 0, so the index is right ... for ( sal_uInt16 n = 0; n <= nEndPortion; n++ ) { TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject(n); @@ -681,25 +646,25 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) else { aAttribItems.Clear(); - USHORT nScriptType = GetScriptType( EditPaM( pNode, nIndex+1 ) ); + sal_uInt16 nScriptType = GetScriptType( EditPaM( pNode, nIndex+1 ) ); if ( !n || IsScriptChange( EditPaM( pNode, nIndex ) ) ) { SfxItemSet aAttribs = GetAttribs( nNode, nIndex+1, nIndex+1 ); - aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ) ), LIST_APPEND ); - aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_FONTHEIGHT, nScriptType ) ), LIST_APPEND ); - aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_WEIGHT, nScriptType ) ), LIST_APPEND ); - aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_ITALIC, nScriptType ) ), LIST_APPEND ); - aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ) ), LIST_APPEND ); + aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ) ) ); + aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_FONTHEIGHT, nScriptType ) ) ); + aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_WEIGHT, nScriptType ) ) ); + aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_ITALIC, nScriptType ) ) ); + aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ) ) ); } - // #96298# Insert hard attribs AFTER CJK attribs... + // Insert hard attribs AFTER CJK attribs... lcl_FindValidAttribs( aAttribItems, pNode, nIndex, nScriptType ); rOutput << '{'; if ( WriteItemListAsRTF( aAttribItems, rOutput, nNode, nIndex, aFontTable, aColorList ) ) rOutput << ' '; - USHORT nS = nIndex; - USHORT nE = nIndex + pTextPortion->GetLen(); + sal_uInt16 nS = nIndex; + sal_uInt16 nE = nIndex + pTextPortion->GetLen(); if ( n == nStartPortion ) nS = nStartPos; if ( n == nEndPortion ) @@ -721,14 +686,14 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) rOutput << OOO_STRING_SVTOOLS_RTF_PAR << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN;; rOutput << endl; } - // RTF-Nachspann... - rOutput << "}}"; // 1xKlammerung Absaetze, 1x Klammerung RTF-Dokument + // RTF-trailer ... + rOutput << "}}"; // 1xparentheses paragraphs, 1xparentheses RTF document rOutput.Flush(); #if defined (EDITDEBUG) && !defined( UNX ) { SvFileStream aStream( String( RTL_CONSTASCII_USTRINGPARAM ( "d:\\rtf_out.rtf" ) ), STREAM_WRITE|STREAM_TRUNC ); - ULONG nP = rOutput.Tell(); + sal_uLong nP = rOutput.Tell(); rOutput.Seek( 0 ); aStream << rOutput; rOutput.Seek( nP ); @@ -736,9 +701,6 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) #endif return rOutput.GetError(); -#else - return 0; -#endif } @@ -770,8 +732,6 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, case EE_PARA_OUTLLRSPACE: case EE_PARA_LRSPACE: { -// const ContentNode *pNode = aEditDoc.GetObject( nPara ); - rOutput << OOO_STRING_SVTOOLS_RTF_FI; short nTxtFirst = ((const SvxLRSpaceItem&)rItem).GetTxtFirstLineOfst(); nTxtFirst = (short)LogicToTwips( nTxtFirst ); @@ -805,8 +765,8 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, char cMult = '0'; if ( ((const SvxLineSpacingItem&)rItem).GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) { - // Woher kriege ich jetzt den Wert? - // Der SwRTF-Parser geht von einem 240er Font aus! + // From where do I get the value now? + // The SwRTF parser is based on a 240 Font! nVal = ((const SvxLineSpacingItem&)rItem).GetPropLineSpace(); nVal *= 240; nVal /= 100; @@ -883,8 +843,8 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, break; case EE_CHAR_UNDERLINE: { - // muesste bei WordLineMode ggf. ulw werden, - // aber die Information fehlt hier + // Must underlined if in WordLineMode, but the information is + // missing here FontUnderline e = ((const SvxUnderlineItem&)rItem).GetLineStyle(); switch ( e ) { @@ -948,7 +908,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, break; case EE_CHAR_RELIEF: { - USHORT nRelief = ((const SvxCharReliefItem&)rItem).GetValue(); + sal_uInt16 nRelief = ((const SvxCharReliefItem&)rItem).GetValue(); if ( nRelief == RELIEF_EMBOSSED ) rOutput << OOO_STRING_SVTOOLS_RTF_EMBO; if ( nRelief == RELIEF_ENGRAVED ) @@ -957,7 +917,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, break; case EE_CHAR_EMPHASISMARK: { - USHORT nMark = ((const SvxEmphasisMarkItem&)rItem).GetValue(); + sal_uInt16 nMark = ((const SvxEmphasisMarkItem&)rItem).GetValue(); if ( nMark == EMPHASISMARK_NONE ) rOutput << OOO_STRING_SVTOOLS_RTF_ACCNONE; else if ( nMark == EMPHASISMARK_SIDE_DOTS ) @@ -1004,14 +964,14 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, MapMode aPntMode( MAP_POINT ); long nFontHeight = GetRefDevice()->LogicToLogic( aFont.GetSize(), &GetRefMapMode(), &aPntMode ).Height(); - nFontHeight *=2; // HalfPoints + nFontHeight *=2; // HalfP oints sal_uInt16 nProp = ((const SvxEscapementItem&)rItem).GetProp(); - sal_uInt16 nProp100 = nProp*100; // Fuer SWG-Token Prop in 100tel Prozent. + sal_uInt16 nProp100 = nProp*100; // For SWG-Token Prop in 100th percent. short nEsc = ((const SvxEscapementItem&)rItem).GetEsc(); if ( nEsc == DFLT_ESC_AUTO_SUPER ) { nEsc = 100 - nProp; - nProp100++; // Eine 1 hinten bedeutet 'automatisch'. + nProp100++; // A 1 afterwards means 'automatic'. } else if ( nEsc == DFLT_ESC_AUTO_SUB ) { @@ -1072,17 +1032,16 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP ( aSel.Max().GetIndex() < aSel.Max().GetNode()->Len() ) ) ? sal_False : sal_True; - // Vorlagen werden nicht gespeichert! - // ( Nur Name und Familie, Vorlage selbst muss in App stehen! ) - + // Templates are not saved! + // (Only the name and family, template itself must be in App!) pTxtObj->SetScriptType( GetScriptType( aSel ) ); - // ueber die Absaetze iterieren... + // iterate over the paragraphs ... sal_uInt16 nNode; for ( nNode = nStartNode; nNode <= nEndNode; nNode++ ) { ContentNode* pNode = aEditDoc.SaveGetObject( nNode ); - DBG_ASSERT( pNode, "Node nicht gefunden: Search&Replace" ); + DBG_ASSERT( pNode, "Node not found: Search&Replace" ); if ( bOnlyFullParagraphs ) { @@ -1103,30 +1062,30 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP ContentInfo* pC = pTxtObj->CreateAndInsertContent(); - // Die Absatzattribute... + // The paragraph attributes ... pC->GetParaAttribs().Set( pNode->GetContentAttribs().GetItems() ); - // Das StyleSheet... + // The StyleSheet... if ( pNode->GetStyleSheet() ) { pC->GetStyle() = pNode->GetStyleSheet()->GetName(); pC->GetFamily() = pNode->GetStyleSheet()->GetFamily(); } - // Der Text... + // The Text... pC->GetText() = pNode->Copy( nStartPos, nEndPos-nStartPos ); - // und die Attribute... + // and the Attribute... sal_uInt16 nAttr = 0; EditCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); while ( pAttr ) { - // In einem leeren Absatz die Attribute behalten! + // In a blank paragraph keep the attributes! if ( bEmptyPara || ( ( pAttr->GetEnd() > nStartPos ) && ( pAttr->GetStart() < nEndPos ) ) ) { XEditAttribute* pX = pTxtObj->CreateAttrib( *pAttr->GetItem(), pAttr->GetStart(), pAttr->GetEnd() ); - // Evtl. korrigieren... + // Possibly Correct ... if ( ( nNode == nStartNode ) && ( nStartPos != 0 ) ) { pX->GetStart() = ( pX->GetStart() > nStartPos ) ? pX->GetStart()-nStartPos : 0; @@ -1138,7 +1097,7 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP if ( pX->GetEnd() > (nEndPos-nStartPos) ) pX->GetEnd() = nEndPos-nStartPos; } - DBG_ASSERT( pX->GetEnd() <= (nEndPos-nStartPos), "CreateBinTextObject: Attribut zu lang!" ); + DBG_ASSERT( pX->GetEnd() <= (nEndPos-nStartPos), "CreateBinTextObject: Attribute too long!" ); if ( !pX->GetLen() && !bEmptyPara ) pTxtObj->DestroyAttrib( pX ); else @@ -1148,16 +1107,14 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); } -#ifndef SVX_LIGHT - // ggf. Online-Spelling + // If possible online spelling if ( bAllowBigObjects && bOnlyFullParagraphs && pNode->GetWrongList() ) pC->SetWrongList( pNode->GetWrongList()->Clone() ); -#endif // !SVX_LIGHT } - // Bei grossen Textobjekten die PortionInfos merken: - // Schwelle rauf setzen, wenn Olli die Absaetze nicht mehr zerhackt! + // Remember the portions info in case of large text objects: + // sleeper set up when Olli paragraphs not hacked! if ( bAllowBigObjects && bOnlyFullParagraphs && IsFormatted() && GetUpdateMode() && ( nTextPortions >= nBigObjectStart ) ) { XParaPortionList* pXList = new XParaPortionList( GetRefDevice(), aPaperSize.Width(), nStretchX, nStretchY ); @@ -1171,7 +1128,7 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP pX->nHeight = pParaPortion->GetHeight(); pX->nFirstLineOffset = pParaPortion->GetFirstLineOffset(); - // Die TextPortions + // The TextPortions sal_uInt16 nCount = pParaPortion->GetTextPortions().Count(); sal_uInt16 n; for ( n = 0; n < nCount; n++ ) @@ -1181,7 +1138,7 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP pX->aTextPortions.Insert( pNew, pX->aTextPortions.Count() ); } - // Die Zeilen + // The lines nCount = pParaPortion->GetLines().Count(); for ( n = 0; n < nCount; n++ ) { @@ -1190,7 +1147,7 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP pX->aLines.Insert( pNew, pX->aLines.Count() ); } #ifdef DBG_UTIL - USHORT nTest; + sal_uInt16 nTest; int nTPLen = 0, nTxtLen = 0; for ( nTest = pParaPortion->GetTextPortions().Count(); nTest; ) nTPLen += pParaPortion->GetTextPortions().GetObject( --nTest )->GetLen(); @@ -1205,7 +1162,7 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP void ImpEditEngine::SetText( const EditTextObject& rTextObject ) { - // Da Setzen eines TextObject ist nicht Undo-faehig! + // Since setting a text object is not undo-able! ResetUndoManager(); sal_Bool _bUpdate = GetUpdateMode(); sal_Bool _bUndo = IsUndoEnabled(); @@ -1219,9 +1176,7 @@ void ImpEditEngine::SetText( const EditTextObject& rTextObject ) InsertText( rTextObject, EditSelection( aPaM, aPaM ) ); SetVertical( rTextObject.IsVertical() ); -#ifndef SVX_LIGHT - DBG_ASSERT( !HasUndoManager() || !GetUndoManager().GetUndoActionCount(), "Woher kommt das Undo in SetText ?!" ); -#endif + DBG_ASSERT( !HasUndoManager() || !GetUndoManager().GetUndoActionCount(), "From where comes the Undo in SetText ?!" ); SetUpdateMode( _bUpdate ); EnableUndo( _bUndo ); } @@ -1235,19 +1190,15 @@ EditSelection ImpEditEngine::InsertText( const EditTextObject& rTextObject, Edit EditSelection aNewSel = InsertBinTextObject( (BinTextObject&)rTextObject, aSel.Max() ); LeaveBlockNotifications(); return aNewSel; - - // MT 05/00: InsertBinTextObject direkt hier machen... } EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, EditPaM aPaM ) { - // Optimieren: - // Kein GetPos undFindParaportion, sondern Index berechnen! + // Optimize: No getPos undFindParaportion, instead calculate index! EditSelection aSel( aPaM, aPaM ); - DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "InsertBibTextObject: Selektion kaput!(1)" ); + DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "InsertBibTextObject: Selection broken!(1)" ); sal_Bool bUsePortionInfo = sal_False; -// sal_Bool bFields = sal_False; XParaPortionList* pPortionInfo = rTextObject.GetPortionInfo(); if ( pPortionInfo && ( (long)pPortionInfo->GetPaperWidth() == aPaperSize.Width() ) @@ -1283,27 +1234,28 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed aPaM = ImpFastInsertText( aPaM, pC->GetText() ); ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() ); - DBG_ASSERT( pPortion, "Blinde Portion in FastInsertText" ); + DBG_ASSERT( pPortion, "Blind Portion in FastInsertText" ); pPortion->MarkInvalid( nStartPos, pC->GetText().Len() ); - // Zeicheattribute... + // Character attributes ... sal_Bool bAllreadyHasAttribs = aPaM.GetNode()->GetCharAttribs().Count() ? sal_True : sal_False; sal_uInt16 nNewAttribs = pC->GetAttribs().Count(); if ( nNewAttribs ) { - BOOL bUpdateFields = FALSE; + sal_Bool bUpdateFields = sal_False; for ( sal_uInt16 nAttr = 0; nAttr < nNewAttribs; nAttr++ ) { XEditAttribute* pX = pC->GetAttribs().GetObject( nAttr ); - // Kann passieren wenn Absaetze >16K entstehen, dann wird einfach umgebrochen. + // Can happen when paragraphs > 16K, it is simply wrapped. if ( pX->GetEnd() <= aPaM.GetNode()->Len() ) { if ( !bAllreadyHasAttribs || pX->IsFeature() ) { - // Normale Attribute gehen dann schneller... - // Features duerfen nicht ueber EditDoc::InsertAttrib - // eingefuegt werden, sie sind bei FastInsertText schon im TextFluss - DBG_ASSERT( pX->GetEnd() <= aPaM.GetNode()->Len(), "InsertBinTextObject: Attribut zu gross!" ); + // Normal attributes then go faster ... + // Features shall not be inserted through + // EditDoc:: InsertAttrib, using FastInsertText they are + // already in the flow + DBG_ASSERT( pX->GetEnd() <= aPaM.GetNode()->Len(), "InsertBinTextObject: Attribute too large!" ); EditCharAttrib* pAttr; if ( !bConvertItems ) pAttr = MakeCharAttrib( aEditDoc.GetItemPool(), *(pX->GetItem()), pX->GetStart()+nStartPos, pX->GetEnd()+nStartPos ); @@ -1314,15 +1266,15 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed pAttr = MakeCharAttrib( aEditDoc.GetItemPool(), *pNew, pX->GetStart()+nStartPos, pX->GetEnd()+nStartPos ); delete pNew; } - DBG_ASSERT( pAttr->GetEnd() <= aPaM.GetNode()->Len(), "InsertBinTextObject: Attribut passt nicht! (1)" ); + DBG_ASSERT( pAttr->GetEnd() <= aPaM.GetNode()->Len(), "InsertBinTextObject: Attribute does not fit! (1)" ); aPaM.GetNode()->GetCharAttribs().InsertAttrib( pAttr ); if ( pAttr->Which() == EE_FEATURE_FIELD ) - bUpdateFields = TRUE; + bUpdateFields = sal_True; } else { - DBG_ASSERT( pX->GetEnd()+nStartPos <= aPaM.GetNode()->Len(), "InsertBinTextObject: Attribut passt nicht! (2)" ); - // Tabs und andere Features koennen nicht ueber InsertAttrib eingefuegt werden: + DBG_ASSERT( pX->GetEnd()+nStartPos <= aPaM.GetNode()->Len(), "InsertBinTextObject: Attribute does not fit! (2)" ); + // Tabs and other Features can not be inserted through InsertAttrib: aEditDoc.InsertAttrib( aPaM.GetNode(), pX->GetStart()+nStartPos, pX->GetEnd()+nStartPos, *pX->GetItem() ); } } @@ -1330,22 +1282,19 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed if ( bUpdateFields ) UpdateFields(); - // Sonst QuickFormat => Keine Attribute! + // Otherwise, quick format => no attributes! pPortion->MarkSelectionInvalid( nStartPos, pC->GetText().Len() ); } - DBG_ASSERT( CheckOrderedList( aPaM.GetNode()->GetCharAttribs().GetAttribs(), sal_True ), "InsertBinTextObject: Start-Liste verdreht" ); + DBG_ASSERT( CheckOrderedList( aPaM.GetNode()->GetCharAttribs().GetAttribs(), sal_True ), "InsertBinTextObject: Start-Liste distorted" ); sal_Bool bParaAttribs = sal_False; if ( bNewContent || ( ( n > 0 ) && ( n < (nContents-1) ) ) ) { bParaAttribs = sal_False; - // #101512# Don't overwrite level/style from existing paragraph in OutlineView - // MT 10/2002: Removed because of #103874#, handled in Outliner::EndPasteOrDropHdl now. -// if ( !aStatus.IsOutliner() || n ) { - // nur dann Style und ParaAttribs, wenn neuer Absatz, oder - // komplett inneliegender... + // only style and ParaAttribs when new paragraph, or + // completely internal ... bParaAttribs = pC->GetParaAttribs().Count() ? sal_True : sal_False; if ( GetStyleSheetPool() && pC->GetStyle().Len() ) { @@ -1371,9 +1320,9 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed pParaPortion->nHeight = pXP->nHeight; pParaPortion->nFirstLineOffset = pXP->nFirstLineOffset; pParaPortion->bForceRepaint = sal_True; - pParaPortion->SetValid(); // Nicht formatieren + pParaPortion->SetValid(); // Do not format - // Die TextPortions + // The Text Portions pParaPortion->GetTextPortions().Reset(); sal_uInt16 nCount = pXP->aTextPortions.Count(); for ( sal_uInt16 _n = 0; _n < nCount; _n++ ) @@ -1383,18 +1332,18 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed pParaPortion->GetTextPortions().Insert( pNew, _n ); } - // Die Zeilen + // The lines pParaPortion->GetLines().Reset(); nCount = pXP->aLines.Count(); for ( sal_uInt16 m = 0; m < nCount; m++ ) { EditLine* pLine = pXP->aLines[m]; EditLine* pNew = pLine->Clone(); - pNew->SetInvalid(); // neu Painten! + pNew->SetInvalid(); // Paint again! pParaPortion->GetLines().Insert( pNew, m ); } #ifdef DBG_UTIL - USHORT nTest; + sal_uInt16 nTest; int nTPLen = 0, nTxtLen = 0; for ( nTest = pParaPortion->GetTextPortions().Count(); nTest; ) nTPLen += pParaPortion->GetTextPortions().GetObject( --nTest )->GetLen(); @@ -1404,22 +1353,20 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed #endif } } - if ( !bParaAttribs ) // DefFont wird bei FastInsertParagraph nicht berechnet + if ( !bParaAttribs ) // DefFont is not calculated for FastInsertParagraph { aPaM.GetNode()->GetCharAttribs().GetDefFont() = aEditDoc.GetDefFont(); if ( aStatus.UseCharAttribs() ) aPaM.GetNode()->CreateDefFont(); } -#ifndef SVX_LIGHT if ( bNewContent && GetStatus().DoOnlineSpelling() && pC->GetWrongList() ) { aPaM.GetNode()->DestroyWrongList(); // otherwise MLK, if list exists... aPaM.GetNode()->SetWrongList( pC->GetWrongList()->Clone() ); } -#endif // !SVX_LIGHT - // Zeilenumbruch, wenn weitere folgen... + // Wrap when followed by other ... if ( n < ( nContents-1) ) { if ( bNewContent ) @@ -1430,14 +1377,14 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed } aSel.Max() = aPaM; - DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "InsertBibTextObject: Selektion kaput!(1)" ); + DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "InsertBibTextObject: Selection broken!(1)" ); return aSel; } -LanguageType ImpEditEngine::GetLanguage( const EditPaM& rPaM, USHORT* pEndPos ) const +LanguageType ImpEditEngine::GetLanguage( const EditPaM& rPaM, sal_uInt16* pEndPos ) const { short nScriptType = GetScriptType( rPaM, pEndPos ); // pEndPos will be valid now, pointing to ScriptChange or NodeLen - USHORT nLangId = GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ); + sal_uInt16 nLangId = GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ); const SvxLanguageItem* pLangItem = &(const SvxLanguageItem&)rPaM.GetNode()->GetContentAttribs().GetItem( nLangId ); EditCharAttrib* pAttr = rPaM.GetNode()->GetCharAttribs().FindAttrib( nLangId, rPaM.GetIndex() ); if ( pAttr ) @@ -1456,10 +1403,8 @@ LanguageType ImpEditEngine::GetLanguage( const EditPaM& rPaM, USHORT* pEndPos ) Reference< XSpellChecker1 > ImpEditEngine::GetSpeller() { -#ifndef SVX_LIGHT if ( !xSpeller.is() ) xSpeller = SvxGetSpellChecker(); -#endif return xSpeller; } @@ -1473,10 +1418,8 @@ SpellInfo * ImpEditEngine::CreateSpellInfo( const EditSelection &rSel, bool bMul pSpellInfo->bMultipleDoc = bMultipleDocs; EditSelection aSentenceSel( SelectSentence( rSel ) ); -// pSpellInfo->aSpellStart = CreateEPaM( aSentenceSel.Min() ); -// pSpellInfo->aSpellTo = CreateEPaM( rSel.HasRange()? aSentenceSel.Max() : aSentenceSel.Min() ); // always spell draw objects completely, startting at the top. - // (spelling in only a selection or not starting with the top requires + // (spelling in only a selection or not starting with the top requires // further changes elsewehe to work properly) pSpellInfo->aSpellStart = EPaM(); pSpellInfo->aSpellTo = EPaM( EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND ); @@ -1486,18 +1429,14 @@ SpellInfo * ImpEditEngine::CreateSpellInfo( const EditSelection &rSel, bool bMul EESpellState ImpEditEngine::Spell( EditView* pEditView, sal_Bool bMultipleDoc ) { -#ifdef SVX_LIGHT - return EE_SPELL_NOSPELLER; -#else - - DBG_ASSERTWARNING( xSpeller.is(), "Kein Speller gesetzt!" ); + DBG_ASSERTWARNING( xSpeller.is(), "No Spell checker set!" ); if ( !xSpeller.is() ) return EE_SPELL_NOSPELLER; aOnlineSpellTimer.Stop(); - // Bei MultipleDoc immer von vorne/hinten... + // In MultipleDoc always from the front / rear ... if ( bMultipleDoc ) { pEditView->pImpEditView->SetEditSelection( aEditDoc.GetStartPaM() ); @@ -1508,7 +1447,7 @@ EESpellState ImpEditEngine::Spell( EditView* pEditView, sal_Bool bMultipleDoc ) sal_Bool bIsStart = sal_False; if ( bMultipleDoc ) - bIsStart = sal_True; // Immer von Vorne bzw. von hinten... + bIsStart = sal_True; // Accessible from the front or from behind ... else if ( ( CreateEPaM( aEditDoc.GetStartPaM() ) == pSpellInfo->aSpellStart ) ) bIsStart = sal_True; @@ -1531,26 +1470,22 @@ EESpellState ImpEditEngine::Spell( EditView* pEditView, sal_Bool bMultipleDoc ) delete pSpellInfo; pSpellInfo = 0; return eState; -#endif } sal_Bool ImpEditEngine::HasConvertibleTextPortion( LanguageType nSrcLang ) { -#ifdef SVX_LIGHT - return sal_False; -#else sal_Bool bHasConvTxt = sal_False; - USHORT nParas = pEditEngine->GetParagraphCount(); - for (USHORT k = 0; k < nParas; ++k) + sal_uInt16 nParas = pEditEngine->GetParagraphCount(); + for (sal_uInt16 k = 0; k < nParas; ++k) { SvUShorts aPortions; pEditEngine->GetPortions( k, aPortions ); - for ( USHORT nPos = 0; nPos < aPortions.Count(); ++nPos ) + for ( sal_uInt16 nPos = 0; nPos < aPortions.Count(); ++nPos ) { - USHORT nEnd = aPortions.GetObject( nPos ); - USHORT nStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0; + sal_uInt16 nEnd = aPortions.GetObject( nPos ); + sal_uInt16 nStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0; // if the paragraph is not empty we need to increase the index // by one since the attribute of the character left to the @@ -1569,27 +1504,22 @@ sal_Bool ImpEditEngine::HasConvertibleTextPortion( LanguageType nSrcLang ) } } -#endif return bHasConvTxt; } void ImpEditEngine::Convert( EditView* pEditView, LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, - INT32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ) + sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ) { // modified version of ImpEditEngine::Spell -#ifdef SVX_LIGHT -#else - - // Bei MultipleDoc immer von vorne/hinten... + // In MultipleDoc always from the front / rear ... if ( bMultipleDoc ) pEditView->pImpEditView->SetEditSelection( aEditDoc.GetStartPaM() ); - // + // initialize pConvInfo - // EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); aCurSel.Adjust( aEditDoc ); pConvInfo = new ConvInfo; @@ -1612,7 +1542,7 @@ void ImpEditEngine::Convert( EditView* pEditView, // not work. Thus since chinese conversion is not interactive we start // at the begin of the paragraph to solve the problem, i.e. have the // TextConversion service get those characters together in the same call. - USHORT nStartIdx = ( editeng::HangulHanjaConversion::IsChinese( nSrcLang ) ) ? + sal_uInt16 nStartIdx = ( editeng::HangulHanjaConversion::IsChinese( nSrcLang ) ) ? 0 : aWordStartPaM.GetIndex(); pConvInfo->aConvStart.nIndex = nStartIdx; } @@ -1621,7 +1551,7 @@ void ImpEditEngine::Convert( EditView* pEditView, sal_Bool bIsStart = sal_False; if ( bMultipleDoc ) - bIsStart = sal_True; // Immer von Vorne bzw. von hinten... + bIsStart = sal_True; // Accessible from the front or from behind ... else if ( CreateEPaM( aEditDoc.GetStartPaM() ) == pConvInfo->aConvStart ) bIsStart = sal_True; @@ -1644,12 +1574,12 @@ void ImpEditEngine::Convert( EditView* pEditView, // disallow formatting, updating the view, ... while // non-interactively converting the document. (saves time) //if (!bIsInteractive) - // SetUpdateMode( FALSE ); + // SetUpdateMode( sal_False ); aWrp.Convert(); //if (!bIsInteractive) - //SetUpdateMode( TRUE, 0, TRUE ); + //SetUpdateMode( sal_True, 0, sal_True ); if ( !bMultipleDoc ) { @@ -1663,14 +1593,13 @@ void ImpEditEngine::Convert( EditView* pEditView, } delete pConvInfo; pConvInfo = 0; -#endif } void ImpEditEngine::SetLanguageAndFont( const ESelection &rESel, - LanguageType nLang, USHORT nLangWhichId, - const Font *pFont, USHORT nFontWhichId ) + LanguageType nLang, sal_uInt16 nLangWhichId, + const Font *pFont, sal_uInt16 nFontWhichId ) { ESelection aOldSel = pActiveView->GetSelection(); pActiveView->SetSelection( rESel ); @@ -1685,11 +1614,11 @@ void ImpEditEngine::SetLanguageAndFont( { // set new font attribute SvxFontItem aFontItem = (SvxFontItem&) aNewSet.Get( nFontWhichId ); - aFontItem.GetFamilyName() = pFont->GetName(); - aFontItem.GetFamily() = pFont->GetFamily(); - aFontItem.GetStyleName() = pFont->GetStyleName(); - aFontItem.GetPitch() = pFont->GetPitch(); - aFontItem.GetCharSet() = pFont->GetCharSet(); + aFontItem.SetFamilyName( pFont->GetName()); + aFontItem.SetFamily( pFont->GetFamily()); + aFontItem.SetStyleName( pFont->GetStyleName()); + aFontItem.SetPitch( pFont->GetPitch()); + aFontItem.SetCharSet( pFont->GetCharSet() ); aNewSet.Put( aFontItem ); } @@ -1712,11 +1641,6 @@ void ImpEditEngine::ImpConvert( rtl::OUString &rConvTxt, LanguageType &rConvTxtL String aRes; LanguageType nResLang = LANGUAGE_NONE; -#ifdef SVX_LIGHT - rConvTxt = rtl::OUString(); - rConvTxtLang = LANGUAGE_NONE; -#else - /* ContentNode* pLastNode = */ aEditDoc.SaveGetObject( aEditDoc.Count()-1 ); EditPaM aPos( CreateEditPaM( pConvInfo->aConvContinue ) ); @@ -1730,7 +1654,7 @@ void ImpEditEngine::ImpConvert( rtl::OUString &rConvTxt, LanguageType &rConvTxtL if (bAllowImplicitChangesForNotConvertibleText && !pEditEngine->GetText( pConvInfo->aConvContinue.nPara ).Len()) { - USHORT nPara = pConvInfo->aConvContinue.nPara; + sal_uInt16 nPara = pConvInfo->aConvContinue.nPara; ESelection aESel( nPara, 0, nPara, 0 ); // see comment for below same function call SetLanguageAndFont( aESel, @@ -1743,34 +1667,22 @@ void ImpEditEngine::ImpConvert( rtl::OUString &rConvTxt, LanguageType &rConvTxtL pConvInfo->aConvContinue.nIndex >= pConvInfo->aConvTo.nIndex) break; -/* - // Bekannter (wahrscheinlicher) Bug: Wenn SpellToCurrent, muss - // Current bei jeder Ersetzung korrigiert werden, sonst passt - // das Ende evtl. nicht mehr genau... - if ( pConvInfo->bConvToEnd || pConvInfo->bMultipleDoc ) - { - if ( aCurSel.Max().GetNode() == pLastNode && - aCurSel.Max().GetIndex() >= pLastNode->Len() ) - break; - } -*/ - - USHORT nAttribStart = USHRT_MAX; - USHORT nAttribEnd = USHRT_MAX; - USHORT nCurPos = USHRT_MAX; + sal_uInt16 nAttribStart = USHRT_MAX; + sal_uInt16 nAttribEnd = USHRT_MAX; + sal_uInt16 nCurPos = USHRT_MAX; EPaM aCurStart = CreateEPaM( aCurSel.Min() ); SvUShorts aPortions; - pEditEngine->GetPortions( (USHORT)aCurStart.nPara, aPortions ); - for ( USHORT nPos = 0; nPos < aPortions.Count(); ++nPos ) + pEditEngine->GetPortions( (sal_uInt16)aCurStart.nPara, aPortions ); + for ( sal_uInt16 nPos = 0; nPos < aPortions.Count(); ++nPos ) { - USHORT nEnd = aPortions.GetObject( nPos ); - USHORT nStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0; + sal_uInt16 nEnd = aPortions.GetObject( nPos ); + sal_uInt16 nStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0; // the language attribute is obtained from the left character // (like usually all other attributes) // thus we usually have to add 1 in order to get the language // of the text right to the cursor position - USHORT nLangIdx = nEnd > nStart ? nStart + 1 : nStart; + sal_uInt16 nLangIdx = nEnd > nStart ? nStart + 1 : nStart; LanguageType nLangFound = pEditEngine->GetLanguage( aCurStart.nPara, nLangIdx ); #ifdef DEBUG lang::Locale aLocale( SvxCreateLocale( nLangFound ) ); @@ -1884,17 +1796,12 @@ void ImpEditEngine::ImpConvert( rtl::OUString &rConvTxt, LanguageType &rConvTxtL rConvTxt = aRes; if (rConvTxt.getLength()) rConvTxtLang = nResLang; -#endif } Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView ) { -#ifdef SVX_LIGHT - return Reference< XSpellAlternatives >(); -#else - - DBG_ASSERT( xSpeller.is(), "Kein Speller gesetzt!" ); + DBG_ASSERT( xSpeller.is(), "No spell checker set!" ); ContentNode* pLastNode = aEditDoc.SaveGetObject( (aEditDoc.Count()-1) ); EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); @@ -1905,10 +1812,9 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView ) Sequence< PropertyValue > aEmptySeq; while (!xSpellAlt.is()) { - - // Bekannter (wahrscheinlicher) Bug: Wenn SpellToCurrent, muss - // Current bei jeder Ersetzung korrigiert werden, sonst passt - // das Ende evtl. nicht mehr genau... + // Known (most likely) bug: If SpellToCurrent, the current has to be + // corrected at each replacement, otherwise it may not fit exactly in + // the end ... if ( pSpellInfo->bSpellToEnd || pSpellInfo->bMultipleDoc ) { if ( aCurSel.Max().GetNode() == pLastNode ) @@ -1927,8 +1833,8 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView ) aCurSel = SelectWord( aCurSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD ); aWord = GetSelected( aCurSel ); - // Wenn Punkt dahinter, muss dieser mit uebergeben werden ! - // Falls Abkuerzung... + // If afterwards a dot, this must be handed over! + // If an abbreviation ... if ( aWord.Len() && ( aCurSel.Max().GetIndex() < aCurSel.Max().GetNode()->Len() ) ) { sal_Unicode cNext = aCurSel.Max().GetNode()->GetChar( aCurSel.Max().GetIndex() ); @@ -1957,18 +1863,13 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView ) pEditView->pImpEditView->DrawSelection(); pEditView->ShowCursor( sal_True, sal_False ); return xSpellAlt; -#endif } -/*-- 13.10.2003 16:43:27--------------------------------------------------- - -----------------------------------------------------------------------*/ void ImpEditEngine::EndSpelling() { DELETEZ(pSpellInfo); } -/*-- 13.10.2003 16:43:27--------------------------------------------------- - -----------------------------------------------------------------------*/ void ImpEditEngine::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc) { DBG_ASSERT(!pSpellInfo, "pSpellInfo already set?"); @@ -1976,9 +1877,7 @@ void ImpEditEngine::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc) EditSelection aCurSel( rEditView.pImpEditView->GetEditSelection() ); pSpellInfo = CreateSpellInfo( aCurSel, bMultipleDoc ); } -/*-- 13.10.2003 16:43:27--------------------------------------------------- - Search for the next wrong word within the given selection - -----------------------------------------------------------------------*/ + Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& rSelection) { /* ContentNode* pLastNode = */ aEditDoc.SaveGetObject( (aEditDoc.Count()-1) ); @@ -1999,8 +1898,8 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& r aCurSel = SelectWord( aCurSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD ); aWord = GetSelected( aCurSel ); - // Wenn Punkt dahinter, muss dieser mit uebergeben werden ! - // Falls Abkuerzung... + // If afterwards a dot, this must be handed over! + // If an abbreviation ... if ( aWord.Len() && ( aCurSel.Max().GetIndex() < aCurSel.Max().GetNode()->Len() ) ) { sal_Unicode cNext = aCurSel.Max().GetNode()->GetChar( aCurSel.Max().GetIndex() ); @@ -2024,21 +1923,17 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& r } return xSpellAlt; } -/*-- 13.10.2003 16:43:27--------------------------------------------------- - -----------------------------------------------------------------------*/ -bool ImpEditEngine::SpellSentence(EditView& rEditView, - ::svx::SpellPortions& rToFill, +bool ImpEditEngine::SpellSentence(EditView& rEditView, + ::svx::SpellPortions& rToFill, bool /*bIsGrammarChecking*/ ) { -#ifdef SVX_LIGHT -#else bool bRet = false; EditSelection aCurSel( rEditView.pImpEditView->GetEditSelection() ); if(!pSpellInfo) pSpellInfo = CreateSpellInfo( aCurSel, true ); pSpellInfo->aCurSentenceStart = aCurSel.Min(); - DBG_ASSERT( xSpeller.is(), "Kein Speller gesetzt!" ); + DBG_ASSERT( xSpeller.is(), "No spell checker set!" ); pSpellInfo->aLastSpellPortions.clear(); pSpellInfo->aLastSpellContentSelections.clear(); rToFill.clear(); @@ -2086,21 +1981,16 @@ bool ImpEditEngine::SpellSentence(EditView& rEditView, //set the selection to the end of the current sentence rEditView.pImpEditView->SetEditSelection(aSentencePaM.Max()); } -#endif return bRet; } -/*-- 15.10.2003 16:09:12--------------------------------------------------- - adds one portion to the SpellPortions - -----------------------------------------------------------------------*/ +// Adds one portion to the SpellPortions void ImpEditEngine::AddPortion( const EditSelection rSel, uno::Reference< XSpellAlternatives > xAlt, ::svx::SpellPortions& rToFill, bool bIsField) { -#ifdef SVX_LIGHT -#else if(rSel.HasRange()) { svx::SpellPortion aPortion; @@ -2115,20 +2005,15 @@ void ImpEditEngine::AddPortion( pSpellInfo->aLastSpellContentSelections.push_back(rSel); } -#endif } -/*-- 15.10.2003 16:07:47--------------------------------------------------- - adds one or more portions of text to the SpellPortions depending on language changes - -----------------------------------------------------------------------*/ +// Adds one or more portions of text to the SpellPortions depending on language changes void ImpEditEngine::AddPortionIterated( EditView& rEditView, const EditSelection rSel, Reference< XSpellAlternatives > xAlt, ::svx::SpellPortions& rToFill) { -#ifdef SVX_LIGHT -#else if(rSel.Min() != rSel.Max()) { if(xAlt.is()) @@ -2155,7 +2040,7 @@ void ImpEditEngine::AddPortionIterated( pFieldAttr->GetStart() == aCursor.GetIndex() && pFieldAttr->GetStart() != pFieldAttr->GetEnd() && pFieldAttr->Which() == EE_FEATURE_FIELD; - USHORT nEndField = bIsField ? pFieldAttr->GetEnd() : USHRT_MAX; + sal_uInt16 nEndField = bIsField ? pFieldAttr->GetEnd() : USHRT_MAX; bool bIsEndField = false; do { @@ -2190,18 +2075,12 @@ void ImpEditEngine::AddPortionIterated( AddPortion(aSelection, xAlt, rToFill, bIsField); } } -#endif } -/*-- 13.10.2003 16:43:33--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void ImpEditEngine::ApplyChangedSentence(EditView& rEditView, - const ::svx::SpellPortions& rNewPortions, +void ImpEditEngine::ApplyChangedSentence(EditView& rEditView, + const ::svx::SpellPortions& rNewPortions, bool bRecheck ) { -#ifdef SVX_LIGHT -#else // Note: rNewPortions.size() == 0 is valid and happens when the whole // sentence got removed in the dialog @@ -2240,10 +2119,8 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView, rEditView.pImpEditView->SetEditSelection( aCurrentOldPosition->Max() ); } - USHORT nScriptType = GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage ); -// LanguageType eTextLanguage = GetLanguage( aCurrentOldPosition->Min() ); - - USHORT nLangWhichId = EE_CHAR_LANGUAGE; + sal_uInt16 nScriptType = GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage ); + sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE; switch(nScriptType) { case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break; @@ -2289,8 +2166,8 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView, LanguageType eCurLanguage = GetLanguage( aCurrentPaM ); if(eCurLanguage != aCurrentNewPortion->eLanguage) { - USHORT nScriptType = GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage ); - USHORT nLangWhichId = EE_CHAR_LANGUAGE; + sal_uInt16 nScriptType = GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage ); + sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE; switch(nScriptType) { case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break; @@ -2322,39 +2199,30 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView, rEditView.pImpEditView->SetEditSelection( aNext ); FormatAndUpdate(); - aEditDoc.SetModified(TRUE); + aEditDoc.SetModified(sal_True); } -#endif } -/*-- 08.09.2008 11:33:02--------------------------------------------------- - -----------------------------------------------------------------------*/ void ImpEditEngine::PutSpellingToSentenceStart( EditView& rEditView ) { -#ifdef SVX_LIGHT -#else if( pSpellInfo && pSpellInfo->aLastSpellContentSelections.size() ) { rEditView.pImpEditView->SetEditSelection( pSpellInfo->aLastSpellContentSelections.begin()->Min() ); } - -#endif } void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpellAtCursorPos, sal_Bool bInteruptable ) { -#ifndef SVX_LIGHT /* - Er wird ueber alle Absaetze iteriert, nur Absaetze mit invalidierter - WrongList werden geprueft... - - Es werden alle Woerter im invalidierten Bereich geprueft. - Ist ein Wort falsch, aber noch nicht in der WrongList, oder umgekehrt, - wird der Bereich des Wortes invalidiert - ( kein Invalidate, sondern wenn nur Uebergaenge von richtig=>falsch, - einfaches Paint, bei Uebergaengen von falsch=>richtig mit VDev - ueberplaetten ) + It will iterate over all the paragraphs, paragraphs with only + invalidated wrong list will be checked ... + + All the words are checked in the invalidated region. Is a word wrong, + but not in the wrong list, or vice versa, the range of the word will be + invalidated + (no Invalidate, but if only transitions wrong from right =>, simple Paint, + even out properly with VDev on transitions from wrong => right) */ if ( !xSpeller.is() ) @@ -2384,9 +2252,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel sal_uInt16 nInvStart = pWrongList->GetInvalidStart(); sal_uInt16 nInvEnd = pWrongList->GetInvalidEnd(); - sal_uInt16 nWrongs = 0; // Auch im Absatz mal die Kontrolle abgeben... -// sal_Bool bStop = sal_False; - + sal_uInt16 nWrongs = 0; // Lose control also in the paragraphs sal_uInt16 nPaintFrom = 0xFFFF, nPaintTo = 0; sal_Bool bSimpleRepaint = sal_True; @@ -2398,12 +2264,12 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel { if ( ( aSel.Min().GetIndex() > nInvEnd ) || ( ( aSel.Max().GetNode() == pLastNode ) && ( aSel.Max().GetIndex() >= pLastNode->Len() ) ) ) - break; // Dokument- oder Ungueltigkeitsbereich-Ende + break; // Document end or end of invalid region aSel = SelectWord( aSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD ); String aWord( GetSelected( aSel ) ); - // Wenn Punkt dahinter, muss dieser mit uebergeben werden ! - // Falls Abkuerzung... + // If afterwards a dot, this must be handed over! + // If an abbreviation ... sal_Bool bDottAdded = sal_False; if ( aSel.Max().GetIndex() < aSel.Max().GetNode()->Len() ) { @@ -2424,19 +2290,13 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel sal_uInt16 nWEnd= aSel.Max().GetIndex(); if ( !xSpeller->isValid( aWord, GetLanguage( EditPaM( aSel.Min().GetNode(), nWStart+1 ) ), aEmptySeq ) ) { - // Pruefen, ob schon richtig markiert... + // Check if already marked correctly... nWrongs++; - // Nur bei SimpleRepaint stoppen, sonst zu oft VDev - // if ( ( nWrongs > 8 ) && bSimpleRepaint ) - // { - // bStop = sal_True; - // pWrongList->MarkInvalid( aSel.Max().GetIndex(), nInvEnd ); - // } sal_uInt16 nXEnd = bDottAdded ? nWEnd -1 : nWEnd; if ( !pWrongList->HasWrong( nWStart, nXEnd ) ) { - // Wort als falsch markieren... - // Aber nur, wenn nicht an Cursor-Position... + // Mark Word as wrong... + // But only when not at Cursor-Position... sal_Bool bCursorPos = sal_False; if ( aCursorPos.GetNode() == pNode ) { @@ -2445,16 +2305,17 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel } if ( bCursorPos ) { - // Dann weiter als ungueltig markieren... + // Then continue to mark as invalid ... pWrongList->GetInvalidStart() = nWStart; pWrongList->GetInvalidEnd() = nWEnd; bRestartTimer = sal_True; } else { - // Es kann sein, dass die Wrongs in der Liste nicht - // genau ueber Woerter aufgespannt sind, weil die - // WordDelimiters beim Expandieren nicht ausgewrtet werden. + // It may be that the Wrongs in the list ar not + // spanning exactly over words because the + // WordDelimiters during expansion are not + // evaluated. pWrongList->InsertWrong( nWStart, nXEnd, sal_True ); bChanged = sal_True; } @@ -2462,7 +2323,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel } else { - // Pruefen, ob nicht als als falsch markiert.... + // Check if not marked as wrong if ( pWrongList->HasAnyWrong( nWStart, nWEnd ) ) { pWrongList->ClearWrongs( nWStart, nWEnd, pNode ); @@ -2483,14 +2344,14 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel if ( bChanged && ( aSel.Min().GetNode() == pNode ) && ( ( aSel.Min().GetIndex()-aLastEnd.GetIndex() > 1 ) ) ) { - // Wenn zwei Worte durch mehr Zeichen als ein Blank getrennt - // sind, kann es passieren, dass beim Aufsplitten eines Wrongs - // der Start den zweiten Wortes vor dem tatsaechlich Wort liegt + // If two words are separated by more than one blank, it + // can happen that when splitting a Wrongs the start of + // the second word is before the actually word pWrongList->ClearWrongs( aLastEnd.GetIndex(), aSel.Min().GetIndex(), pNode ); } } - // Invalidieren? + // Invalidate? if ( ( nPaintFrom != 0xFFFF ) ) { aStatus.GetStatusWord() |= EE_STAT_WRONGWORDCHANGED; @@ -2498,22 +2359,21 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel if ( aEditViews.Count() ) { - // Bei SimpleRepaint wuerde ein uebermalen ohne VDev reichen, - // aber dann muesste ich ueber alle Views, Intersecten, - // Clippen, ... - // Lohnt wahrscheinlich nicht. + // For SimpleRepaint one was painted over a range without + // reaching VDEV, but then one would have to intersect, c + // clipping, ... over all views. Probably not worthwhile. EditPaM aStartPaM( pNode, nPaintFrom ); EditPaM aEndPaM( pNode, nPaintTo ); Rectangle aStartCursor( PaMtoEditCursor( aStartPaM ) ); Rectangle aEndCursor( PaMtoEditCursor( aEndPaM ) ); - DBG_ASSERT( aInvalidRec.IsEmpty(), "InvalidRect gesetzt!" ); + DBG_ASSERT( aInvalidRec.IsEmpty(), "InvalidRect set!" ); aInvalidRec.Left() = 0; aInvalidRec.Right() = GetPaperSize().Width(); aInvalidRec.Top() = aStartCursor.Top(); aInvalidRec.Bottom() = aEndCursor.Bottom(); if ( pActiveView && pActiveView->HasSelection() ) { - // Dann darf nicht ueber VDev ausgegeben werden + // Then no output through VDev. UpdateViews( NULL ); } else if ( bSimpleRepaint ) @@ -2525,9 +2385,9 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel aClipRec.Intersection( pView->GetVisArea() ); if ( !aClipRec.IsEmpty() ) { - // in Fensterkoordinaten umwandeln.... + // convert to window coordinates .... aClipRec.SetPos( pView->pImpEditView->GetWindowPos( aClipRec.TopLeft() ) ); - // Wenn Selektion, dann VDev... + // If selected, then VDev ... Paint( pView->pImpEditView, aClipRec, pView->HasSelection() ); } } @@ -2539,7 +2399,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel aInvalidRec = Rectangle(); } } - // Nach zwei korrigierten Nodes die Kontrolle abgeben... + // After two corrected nodes give up the control ... nInvalids++; if ( bInteruptable && ( nInvalids >= 2 ) ) { @@ -2553,15 +2413,13 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel } if ( bRestartTimer ) aOnlineSpellTimer.Start(); -#endif // !SVX_LIGHT } EESpellState ImpEditEngine::HasSpellErrors() { - DBG_ASSERT( xSpeller.is(), "Kein Speller gesetzt!" ); + DBG_ASSERT( xSpeller.is(), "No spell checker set!" ); -#ifndef SVX_LIGHT ContentNode* pLastNode = aEditDoc.SaveGetObject( aEditDoc.Count() - 1 ); EditSelection aCurSel( aEditDoc.GetStartPaM() ); @@ -2586,14 +2444,12 @@ EESpellState ImpEditEngine::HasSpellErrors() } aCurSel = WordRight( aCurSel.Max(), ::com::sun::star::i18n::WordType::DICTIONARY_WORD ); } -#endif return EE_SPELL_ERRORFOUND; } EESpellState ImpEditEngine::StartThesaurus( EditView* pEditView ) { -#ifndef SVX_LIGHT EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); if ( !aCurSel.HasRange() ) aCurSel = SelectWord( aCurSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD ); @@ -2607,7 +2463,7 @@ EESpellState ImpEditEngine::StartThesaurus( EditView* pEditView ) AbstractThesaurusDialog* pDlg = pFact->CreateThesaurusDialog( pEditView->GetWindow(), xThes, aWord, GetLanguage( aCurSel.Max() ) ); if ( pDlg->Execute() == RET_OK ) { - // Wort ersetzen... + // Replace Word... pEditView->pImpEditView->DrawSelection(); pEditView->pImpEditView->SetEditSelection( aCurSel ); pEditView->pImpEditView->DrawSelection(); @@ -2617,19 +2473,15 @@ EESpellState ImpEditEngine::StartThesaurus( EditView* pEditView ) delete pDlg; return EE_SPELL_OK; -#else - return EE_SPELL_NOSPELLER; -#endif } sal_uInt16 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSearchItem& rSearchItem ) { sal_uInt16 nFound = 0; -#ifndef SVX_LIGHT EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); - // FIND_ALL ohne Mehrfachselektion nicht moeglich. + // FIND_ALL is not possible without multiple selection. if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND ) || ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL ) ) { @@ -2638,8 +2490,8 @@ sal_uInt16 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxS } else if ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE ) { - // Das Wort ist selektiert, wenn der Anwender die Selektion - // nicht zwischendurch manipuliert: + // The word is selected if the user not altered the selection + // in between: if ( aCurSel.HasRange() ) { pEditView->InsertText( rSearchItem.GetReplaceString() ); @@ -2651,7 +2503,7 @@ sal_uInt16 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxS } else if ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL ) { - // Der Writer ersetzt alle, vorn Anfang bis Ende... + // The Writer replaces all front beginning to end ... SvxSearchItem aTmpItem( rSearchItem ); aTmpItem.SetBackward( sal_False ); @@ -2684,11 +2536,10 @@ sal_uInt16 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxS pEditView->ShowCursor( sal_True, sal_False ); } } -#endif // !SVX_LIGHT return nFound; } -BOOL ImpEditEngine::Search( const SvxSearchItem& rSearchItem, EditView* pEditView ) +sal_Bool ImpEditEngine::Search( const SvxSearchItem& rSearchItem, EditView* pEditView ) { EditSelection aSel( pEditView->pImpEditView->GetEditSelection() ); aSel.Adjust( aEditDoc ); @@ -2697,8 +2548,8 @@ BOOL ImpEditEngine::Search( const SvxSearchItem& rSearchItem, EditView* pEditVie aStartPaM = aSel.Min(); EditSelection aFoundSel; - BOOL bFound = ImpSearch( rSearchItem, aSel, aStartPaM, aFoundSel ); - if ( bFound && ( aFoundSel == aSel ) ) // Bei Rueckwaetssuche + sal_Bool bFound = ImpSearch( rSearchItem, aSel, aStartPaM, aFoundSel ); + if ( bFound && ( aFoundSel == aSel ) ) // For backwards-search { aStartPaM = aSel.Min(); bFound = ImpSearch( rSearchItem, aSel, aStartPaM, aFoundSel ); @@ -2707,23 +2558,22 @@ BOOL ImpEditEngine::Search( const SvxSearchItem& rSearchItem, EditView* pEditVie pEditView->pImpEditView->DrawSelection(); if ( bFound ) { - // Erstmal das Min einstellen, damit das ganze Wort in den sichtbaren Bereich kommt. + // First, set the minimum, so the whole word is in the visible range. pEditView->pImpEditView->SetEditSelection( aFoundSel.Min() ); - pEditView->ShowCursor( TRUE, FALSE ); + pEditView->ShowCursor( sal_True, sal_False ); pEditView->pImpEditView->SetEditSelection( aFoundSel ); } else pEditView->pImpEditView->SetEditSelection( aSel.Max() ); pEditView->pImpEditView->DrawSelection(); - pEditView->ShowCursor( TRUE, FALSE ); + pEditView->ShowCursor( sal_True, sal_False ); return bFound; } sal_Bool ImpEditEngine::ImpSearch( const SvxSearchItem& rSearchItem, const EditSelection& rSearchSelection, const EditPaM& rStartPos, EditSelection& rFoundSel ) { -#ifndef SVX_LIGHT util::SearchOptions aSearchOptions( rSearchItem.GetSearchOptions() ); aSearchOptions.Locale = GetLocale( rStartPos ); @@ -2742,12 +2592,12 @@ sal_Bool ImpEditEngine::ImpSearch( const SvxSearchItem& rSearchItem, utl::TextSearch aSearcher( aSearchOptions ); - // ueber die Absaetze iterieren... + // iterate over the paragraphs ... for ( sal_uInt16 nNode = nStartNode; bBack ? ( nNode >= nEndNode ) : ( nNode <= nEndNode) ; bBack ? nNode-- : nNode++ ) { - // Bei rueckwaertsuche, wenn nEndNode = 0: + // For backwards-search if nEndNode = 0: if ( nNode >= 0xFFFF ) return sal_False; @@ -2770,12 +2620,12 @@ sal_Bool ImpEditEngine::ImpSearch( const SvxSearchItem& rSearchItem, nEndPos = rSearchSelection.Max().GetIndex(); } - // Suchen... + // Searching ... XubString aParaStr( GetEditDoc().GetParaAsString( pNode ) ); bool bFound = false; if ( bBack ) { - SwapUSHORTs( nStartPos, nEndPos ); + Swapsal_uIt16s( nStartPos, nEndPos ); bFound = aSearcher.SearchBkwrd( aParaStr, &nStartPos, &nEndPos); } else @@ -2790,13 +2640,11 @@ sal_Bool ImpEditEngine::ImpSearch( const SvxSearchItem& rSearchItem, return sal_True; } } -#endif // !SVX_LIGHT return sal_False; } sal_Bool ImpEditEngine::HasText( const SvxSearchItem& rSearchItem ) { -#ifndef SVX_LIGHT SvxSearchItem aTmpItem( rSearchItem ); aTmpItem.SetBackward( sal_False ); aTmpItem.SetSelection( sal_False ); @@ -2805,24 +2653,19 @@ sal_Bool ImpEditEngine::HasText( const SvxSearchItem& rSearchItem ) EditSelection aDummySel( aStartPaM ); EditSelection aFoundSel; return ImpSearch( aTmpItem, aDummySel, aStartPaM, aFoundSel ); -#else - return sal_False; -#endif } void ImpEditEngine::SetAutoCompleteText( const String& rStr, sal_Bool bClearTipWindow ) { -#ifndef SVX_LIGHT aAutoCompleteText = rStr; if ( bClearTipWindow && pActiveView ) Help::ShowQuickHelp( pActiveView->GetWindow(), Rectangle(), String(), 0 ); -#endif // !SVX_LIGHT } struct TransliterationChgData { - USHORT nStart; + sal_uInt16 nStart; xub_StrLen nLen; EditSelection aSelection; String aNewText; @@ -2844,42 +2687,42 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, EditSelection aNewSel( aSel ); - const USHORT nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); - const USHORT nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); + const sal_uInt16 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); + const sal_uInt16 nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); - BOOL bChanges = FALSE; - BOOL bLenChanged = FALSE; + sal_Bool bChanges = sal_False; + sal_Bool bLenChanged = sal_False; EditUndoTransliteration* pUndo = NULL; utl::TransliterationWrapper aTranslitarationWrapper( ::comphelper::getProcessServiceFactory(), nTransliterationMode ); - BOOL bConsiderLanguage = aTranslitarationWrapper.needLanguageForTheMode(); + sal_Bool bConsiderLanguage = aTranslitarationWrapper.needLanguageForTheMode(); - for ( USHORT nNode = nStartNode; nNode <= nEndNode; nNode++ ) + for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { ContentNode* pNode = aEditDoc.GetObject( nNode ); xub_StrLen nStartPos = 0; xub_StrLen nEndPos = pNode->Len(); if ( nNode == nStartNode ) nStartPos = aSel.Min().GetIndex(); - if ( nNode == nEndNode ) // kann auch == nStart sein! + if ( nNode == nEndNode ) // can also be == nStart! nEndPos = aSel.Max().GetIndex(); - USHORT nCurrentStart = nStartPos; - USHORT nCurrentEnd = nEndPos; + sal_uInt16 nCurrentStart = nStartPos; + sal_uInt16 nCurrentEnd = nEndPos; sal_uInt16 nLanguage = LANGUAGE_SYSTEM; // since we don't use Hiragana/Katakana or half-width/full-width transliterations here - // it is fine to use ANYWORD_IGNOREWHITESPACES. (ANY_WORD btw is broken and will + // it is fine to use ANYWORD_IGNOREWHITESPACES. (ANY_WORD btw is broken and will // occasionaly miss words in consecutive sentences). Also with ANYWORD_IGNOREWHITESPACES // text like 'just-in-time' will be converted to 'Just-In-Time' which seems to be the // proper thing to do. const sal_Int16 nWordType = i18n::WordType::ANYWORD_IGNOREWHITESPACES; //! In order to have less trouble with changing text size, e.g. because - //! of ligatures or � (German small sz) being resolved, we need to process - //! the text replacements from end to start. - //! This way the offsets for the yet to be changed words will be - //! left unchanged by the already replaced text. + //! of ligatures or � (German small sz) being resolved, we need to process + //! the text replacements from end to start. + //! This way the offsets for the yet to be changed words will be + //! left unchanged by the already replaced text. //! For this we temporarily save the changes to be done in this vector std::vector< TransliterationChgData > aChanges; TransliterationChgData aChgData; @@ -2893,11 +2736,11 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, aSttBndry = _xBI->getWordBoundary( *pNode, nStartPos, SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ), - nWordType, TRUE /*prefer forward direction*/); + nWordType, sal_True /*prefer forward direction*/); aEndBndry = _xBI->getWordBoundary( *pNode, nEndPos, SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ), - nWordType, FALSE /*prefer backward direction*/); + nWordType, sal_False /*prefer backward direction*/); // prevent backtracking to the previous word if selection is at word boundary if (aSttBndry.endPos <= nStartPos) @@ -2928,8 +2771,8 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, #endif Sequence< sal_Int32 > aOffsets; - String aNewText( aTranslitarationWrapper.transliterate( *pNode, - GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ), + String aNewText( aTranslitarationWrapper.transliterate( *pNode, + GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ), nCurrentStart, nLen, &aOffsets )); if (!pNode->Equals( aNewText, nCurrentStart, nLen )) @@ -2946,8 +2789,8 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, (void) aSelTxt; #endif - aCurWordBndry = _xBI->nextWord( *pNode, nCurrentEnd, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ), + aCurWordBndry = _xBI->nextWord( *pNode, nCurrentEnd, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ), nWordType); } DBG_ASSERT( nCurrentEnd >= aEndBndry.endPos, "failed to reach end of transliteration" ); @@ -2956,19 +2799,19 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, { // for 'sentence case' we need to iterate sentence by sentence - sal_Int32 nLastStart = _xBI->beginOfSentence( - *pNode, nEndPos, + sal_Int32 nLastStart = _xBI->beginOfSentence( + *pNode, nEndPos, SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ) ); - sal_Int32 nLastEnd = _xBI->endOfSentence( - *pNode, nLastStart, + sal_Int32 nLastEnd = _xBI->endOfSentence( + *pNode, nLastStart, SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ) ); - + // extend nCurrentStart, nCurrentEnd to the current sentence boundaries - nCurrentStart = _xBI->beginOfSentence( - *pNode, nStartPos, + nCurrentStart = _xBI->beginOfSentence( + *pNode, nStartPos, SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ) ); - nCurrentEnd = _xBI->endOfSentence( - *pNode, nCurrentStart, + nCurrentEnd = _xBI->endOfSentence( + *pNode, nCurrentStart, SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) ); // prevent backtracking to the previous sentence if selection starts at end of a sentence @@ -2976,18 +2819,18 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, { // now nCurrentStart is probably located on a non-letter word. (unless we // are in Asian text with no spaces...) - // Thus to get the real sentence start we should locate the next real word, + // Thus to get the real sentence start we should locate the next real word, // that is one found by DICTIONARY_WORD - i18n::Boundary aBndry = _xBI->nextWord( *pNode, nCurrentEnd, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ), + i18n::Boundary aBndry = _xBI->nextWord( *pNode, nCurrentEnd, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ), i18n::WordType::DICTIONARY_WORD); // now get new current sentence boundaries - nCurrentStart = _xBI->beginOfSentence( - *pNode, aBndry.startPos, + nCurrentStart = _xBI->beginOfSentence( + *pNode, aBndry.startPos, SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) ); - nCurrentEnd = _xBI->endOfSentence( - *pNode, nCurrentStart, + nCurrentEnd = _xBI->endOfSentence( + *pNode, nCurrentStart, SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) ); } // prevent advancing to the next sentence if selection ends at start of a sentence @@ -2995,13 +2838,13 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, { // now nCurrentStart is probably located on a non-letter word. (unless we // are in Asian text with no spaces...) - // Thus to get the real sentence start we should locate the previous real word, + // Thus to get the real sentence start we should locate the previous real word, // that is one found by DICTIONARY_WORD - i18n::Boundary aBndry = _xBI->previousWord( *pNode, nLastStart, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ), + i18n::Boundary aBndry = _xBI->previousWord( *pNode, nLastStart, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ), i18n::WordType::DICTIONARY_WORD); - nLastEnd = _xBI->endOfSentence( - *pNode, aBndry.startPos, + nLastEnd = _xBI->endOfSentence( + *pNode, aBndry.startPos, SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) ); if (nCurrentEnd > nLastEnd) nCurrentEnd = nLastEnd; @@ -3016,8 +2859,8 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, #endif Sequence< sal_Int32 > aOffsets; - String aNewText( aTranslitarationWrapper.transliterate( *pNode, - GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ), + String aNewText( aTranslitarationWrapper.transliterate( *pNode, + GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ), nCurrentStart, nLen, &aOffsets )); if (!pNode->Equals( aNewText, nCurrentStart, nLen )) @@ -3036,8 +2879,8 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ), nWordType); nCurrentStart = aFirstWordBndry.startPos; - nCurrentEnd = _xBI->endOfSentence( - *pNode, nCurrentStart, + nCurrentEnd = _xBI->endOfSentence( + *pNode, nCurrentStart, SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) ); } DBG_ASSERT( nCurrentEnd >= nLastEnd, "failed to reach end of transliteration" ); @@ -3074,7 +2917,6 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, if (aChanges.size() > 0) { -#ifndef SVX_LIGHT // Create a single UndoAction on Demand for all the changes ... if ( !pUndo && IsUndoEnabled() && !IsInUndo() ) { @@ -3101,7 +2943,6 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, else pUndo->SetText( CreateBinTextObject( aSel, NULL ) ); } -#endif // now apply the changes from end to start to leave the offsets of the // yet unchanged text parts remain the same. @@ -3109,35 +2950,33 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, { const TransliterationChgData &rData = aChanges[ aChanges.size() - 1 - i ]; - bChanges = TRUE; + bChanges = sal_True; if (rData.nLen != rData.aNewText.Len()) - bLenChanged = TRUE; + bLenChanged = sal_True; // Change text without loosing the attributes - USHORT nDiffs = ReplaceTextOnly( rData.aSelection.Min().GetNode(), + sal_uInt16 nDiffs = ReplaceTextOnly( rData.aSelection.Min().GetNode(), rData.nStart, rData.nLen, rData.aNewText, rData.aOffsets ); // adjust selection in end node to possibly changed size if (aSel.Max().GetNode() == rData.aSelection.Max().GetNode()) aNewSel.Max().GetIndex() = aNewSel.Max().GetIndex() + nDiffs; - USHORT nSelNode = aEditDoc.GetPos( rData.aSelection.Min().GetNode() ); + sal_uInt16 nSelNode = aEditDoc.GetPos( rData.aSelection.Min().GetNode() ); ParaPortion* pParaPortion = GetParaPortions()[nSelNode]; pParaPortion->MarkSelectionInvalid( rData.nStart, - std::max< USHORT >( rData.nStart + rData.nLen, + std::max< sal_uInt16 >( rData.nStart + rData.nLen, rData.nStart + rData.aNewText.Len() ) ); } - } // if (aChanges.size() > 0) + } } -#ifndef SVX_LIGHT if ( pUndo ) { ESelection aESel( CreateESel( aNewSel ) ); pUndo->SetNewSelection( aESel ); InsertUndo( pUndo ); } -#endif if ( bChanges ) { @@ -3152,22 +2991,22 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, } -short ImpEditEngine::ReplaceTextOnly( +short ImpEditEngine::ReplaceTextOnly( ContentNode* pNode, - USHORT nCurrentStart, xub_StrLen nLen, + sal_uInt16 nCurrentStart, xub_StrLen nLen, const String& rNewText, const uno::Sequence< sal_Int32 >& rOffsets ) { (void) nLen; // Change text without loosing the attributes - USHORT nCharsAfterTransliteration = - sal::static_int_cast< USHORT >(rOffsets.getLength()); + sal_uInt16 nCharsAfterTransliteration = + sal::static_int_cast< sal_uInt16 >(rOffsets.getLength()); const sal_Int32* pOffsets = rOffsets.getConstArray(); short nDiffs = 0; - for ( USHORT n = 0; n < nCharsAfterTransliteration; n++ ) + for ( sal_uInt16 n = 0; n < nCharsAfterTransliteration; n++ ) { - USHORT nCurrentPos = nCurrentStart+n; + sal_uInt16 nCurrentPos = nCurrentStart+n; sal_Int32 nDiff = (nCurrentPos-nDiffs) - pOffsets[n]; if ( !nDiff ) @@ -3182,7 +3021,7 @@ short ImpEditEngine::ReplaceTextOnly( pNode->SetChar( nCurrentPos, rNewText.GetChar(n) ); DBG_ASSERT( (nCurrentPos+1) < pNode->Len(), "TransliterateText - String smaller than expected!" ); - GetEditDoc().RemoveChars( EditPaM( pNode, nCurrentPos+1 ), sal::static_int_cast< USHORT >(-nDiff) ); + GetEditDoc().RemoveChars( EditPaM( pNode, nCurrentPos+1 ), sal::static_int_cast< sal_uInt16 >(-nDiff) ); } else { @@ -3197,7 +3036,7 @@ short ImpEditEngine::ReplaceTextOnly( } -void ImpEditEngine::SetAsianCompressionMode( USHORT n ) +void ImpEditEngine::SetAsianCompressionMode( sal_uInt16 n ) { if ( n != nAsianCompressionMode ) { @@ -3210,7 +3049,7 @@ void ImpEditEngine::SetAsianCompressionMode( USHORT n ) } } -void ImpEditEngine::SetKernAsianPunctuation( BOOL b ) +void ImpEditEngine::SetKernAsianPunctuation( sal_Bool b ) { if ( b != bKernAsianPunctuation ) { @@ -3223,7 +3062,7 @@ void ImpEditEngine::SetKernAsianPunctuation( BOOL b ) } } -void ImpEditEngine::SetAddExtLeading( BOOL bExtLeading ) +void ImpEditEngine::SetAddExtLeading( sal_Bool bExtLeading ) { if ( IsAddExtLeading() != bExtLeading ) { @@ -3238,7 +3077,7 @@ void ImpEditEngine::SetAddExtLeading( BOOL bExtLeading ) -BOOL ImpEditEngine::ImplHasText() const +sal_Bool ImpEditEngine::ImplHasText() const { return ( ( GetEditDoc().Count() > 1 ) || GetEditDoc().GetObject(0)->Len() ); } diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 8709b197c1..80b6e2dd7f 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -44,17 +44,11 @@ void ImpEditEngine::SetStyleSheetPool( SfxStyleSheetPool* pSPool ) { if ( pStylePool != pSPool ) { -// if ( pStylePool ) -// EndListening( *pStylePool, TRUE ); - pStylePool = pSPool; - -// if ( pStylePool ) -// StartListening( *pStylePool, TRUE ); } } -SfxStyleSheet* ImpEditEngine::GetStyleSheet( USHORT nPara ) const +SfxStyleSheet* ImpEditEngine::GetStyleSheet( sal_uInt16 nPara ) const { ContentNode* pNode = aEditDoc.SaveGetObject( nPara ); return pNode ? pNode->GetContentAttribs().GetStyleSheet() : NULL; @@ -64,19 +58,19 @@ void ImpEditEngine::SetStyleSheet( EditSelection aSel, SfxStyleSheet* pStyle ) { aSel.Adjust( aEditDoc ); - USHORT nStartPara = aEditDoc.GetPos( aSel.Min().GetNode() ); - USHORT nEndPara = aEditDoc.GetPos( aSel.Max().GetNode() ); + sal_uInt16 nStartPara = aEditDoc.GetPos( aSel.Min().GetNode() ); + sal_uInt16 nEndPara = aEditDoc.GetPos( aSel.Max().GetNode() ); - BOOL _bUpdate = GetUpdateMode(); - SetUpdateMode( FALSE ); + sal_Bool _bUpdate = GetUpdateMode(); + SetUpdateMode( sal_False ); - for ( USHORT n = nStartPara; n <= nEndPara; n++ ) + for ( sal_uInt16 n = nStartPara; n <= nEndPara; n++ ) SetStyleSheet( n, pStyle ); SetUpdateMode( _bUpdate, 0 ); } -void ImpEditEngine::SetStyleSheet( USHORT nPara, SfxStyleSheet* pStyle ) +void ImpEditEngine::SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle ) { DBG_ASSERT( GetStyleSheetPool() || !pStyle, "SetStyleSheet: No StyleSheetPool registered!" ); ContentNode* pNode = aEditDoc.SaveGetObject( nPara ); @@ -100,10 +94,10 @@ void ImpEditEngine::SetStyleSheet( USHORT nPara, SfxStyleSheet* pStyle ) pNode->GetContentAttribs().GetItems() ) ); } if ( pCurStyle ) - EndListening( *pCurStyle, FALSE ); + EndListening( *pCurStyle, sal_False ); pNode->SetStyleSheet( pStyle, aStatus.UseCharAttribs() ); if ( pStyle ) - StartListening( *pStyle, FALSE ); + StartListening( *pStyle, sal_False ); ParaAttribsChanged( pNode ); } FormatAndUpdate(); @@ -114,17 +108,17 @@ void ImpEditEngine::UpdateParagraphsWithStyleSheet( SfxStyleSheet* pStyle ) SvxFont aFontFromStyle; CreateFont( aFontFromStyle, pStyle->GetItemSet() ); - BOOL bUsed = FALSE; - for ( USHORT nNode = 0; nNode < aEditDoc.Count(); nNode++ ) + sal_Bool bUsed = sal_False; + for ( sal_uInt16 nNode = 0; nNode < aEditDoc.Count(); nNode++ ) { ContentNode* pNode = aEditDoc.GetObject( nNode ); if ( pNode->GetStyleSheet() == pStyle ) { - bUsed = TRUE; + bUsed = sal_True; if ( aStatus.UseCharAttribs() ) pNode->SetStyleSheet( pStyle, aFontFromStyle ); else - pNode->SetStyleSheet( pStyle, FALSE ); + pNode->SetStyleSheet( pStyle, sal_False ); ParaAttribsChanged( pNode ); } @@ -138,7 +132,7 @@ void ImpEditEngine::UpdateParagraphsWithStyleSheet( SfxStyleSheet* pStyle ) void ImpEditEngine::RemoveStyleFromParagraphs( SfxStyleSheet* pStyle ) { - for ( USHORT nNode = 0; nNode < aEditDoc.Count(); nNode++ ) + for ( sal_uInt16 nNode = 0; nNode < aEditDoc.Count(); nNode++ ) { ContentNode* pNode = aEditDoc.GetObject(nNode); if ( pNode->GetStyleSheet() == pStyle ) @@ -152,18 +146,18 @@ void ImpEditEngine::RemoveStyleFromParagraphs( SfxStyleSheet* pStyle ) void ImpEditEngine::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - // Damit nicht beim Destruieren unnoetig formatiert wird: + // So that not a lot of unnecessary formatting is done when destructing: if ( !bDowning ) { DBG_CHKOBJ( GetEditEnginePtr(), EditEngine, 0 ); SfxStyleSheet* pStyle = NULL; - ULONG nId = 0; + sal_uLong nId = 0; if ( rHint.ISA( SfxStyleSheetHint ) ) { const SfxStyleSheetHint& rH = (const SfxStyleSheetHint&) rHint; - DBG_ASSERT( rH.GetStyleSheet()->ISA( SfxStyleSheet ), "Kein SfxStyleSheet!" ); + DBG_ASSERT( rH.GetStyleSheet()->ISA( SfxStyleSheet ), "No SfxStyleSheet!" ); pStyle = (SfxStyleSheet*) rH.GetStyleSheet(); nId = rH.GetHint(); } @@ -185,17 +179,6 @@ void ImpEditEngine::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) ( nId == SFX_STYLESHEET_MODIFIED ) ) { UpdateParagraphsWithStyleSheet( pStyle ); - - // Alle Absaetze mit EditStyles, die das geaenderte Style - // irgendwie als Parent haben, muessen formatiert werden. - // ULONG nStyles = pMyStylePool->GetStyles().Count(); - // for ( ULONG nStyle = 0; nStyle < nStyles; nStyle++ ) - // { - // EditStyleSheet* pES = (EditStyleSheet*)pMyStylePool->GetStyles().GetObject( nStyle ); - // DBG_ASSERT( pES, "NULL-Pointer im StyleSheetPool!" ); - // if ( pES->IsUsed() && pES->HasStyleAsAnyParent( *pStyle ) ) - // UpdateParagraphsWithStyleSheet( pES ); - // } } } } @@ -203,13 +186,13 @@ void ImpEditEngine::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) EditUndoSetAttribs* ImpEditEngine::CreateAttribUndo( EditSelection aSel, const SfxItemSet& rSet ) { - DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "CreateAttribUndo: Fehlerhafte Selektion" ); + DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "CreateAttribUndo: Incorrect selection "); aSel.Adjust( aEditDoc ); ESelection aESel( CreateESel( aSel ) ); - USHORT nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); - USHORT nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); + sal_uInt16 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); + sal_uInt16 nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); DBG_ASSERT( nStartNode <= nEndNode, "CreateAttribUndo: Start > End ?!" ); @@ -227,14 +210,14 @@ EditUndoSetAttribs* ImpEditEngine::CreateAttribUndo( EditSelection aSel, const S SfxItemPool* pPool = pUndo->GetNewAttribs().GetPool(); - for ( USHORT nPara = nStartNode; nPara <= nEndNode; nPara++ ) + for ( sal_uInt16 nPara = nStartNode; nPara <= nEndNode; nPara++ ) { ContentNode* pNode = aEditDoc.GetObject( nPara ); - DBG_ASSERT( aEditDoc.SaveGetObject( nPara ), "Node nicht gefunden: CreateAttribUndo" ); + DBG_ASSERT( aEditDoc.SaveGetObject( nPara ), "Node not found: CreateAttribUndo" ); ContentAttribsInfo* pInf = new ContentAttribsInfo( pNode->GetContentAttribs().GetItems() ); pUndo->GetContentInfos().Insert( pInf, pUndo->GetContentInfos().Count() ); - for ( USHORT nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ ) { EditCharAttribPtr pAttr = pNode->GetCharAttribs().GetAttribs()[ nAttr ]; if ( pAttr->GetLen() ) @@ -247,7 +230,7 @@ EditUndoSetAttribs* ImpEditEngine::CreateAttribUndo( EditSelection aSel, const S return pUndo; } -void ImpEditEngine::UndoActionStart( USHORT nId, const ESelection& aSel ) +void ImpEditEngine::UndoActionStart( sal_uInt16 nId, const ESelection& aSel ) { if ( IsUndoEnabled() && !IsInUndo() ) { @@ -257,7 +240,7 @@ void ImpEditEngine::UndoActionStart( USHORT nId, const ESelection& aSel ) } } -void ImpEditEngine::UndoActionStart( USHORT nId ) +void ImpEditEngine::UndoActionStart( sal_uInt16 nId ) { if ( IsUndoEnabled() && !IsInUndo() ) { @@ -266,7 +249,7 @@ void ImpEditEngine::UndoActionStart( USHORT nId ) } } -void ImpEditEngine::UndoActionEnd( USHORT ) +void ImpEditEngine::UndoActionEnd( sal_uInt16 ) { if ( IsUndoEnabled() && !IsInUndo() ) { @@ -276,13 +259,13 @@ void ImpEditEngine::UndoActionEnd( USHORT ) } } -void ImpEditEngine::InsertUndo( EditUndo* pUndo, BOOL bTryMerge ) +void ImpEditEngine::InsertUndo( EditUndo* pUndo, sal_Bool bTryMerge ) { - DBG_ASSERT( !IsInUndo(), "InsertUndo im Undomodus!" ); + DBG_ASSERT( !IsInUndo(), "InsertUndo in Undomodus!" ); if ( pUndoMarkSelection ) { EditUndoMarkSelection* pU = new EditUndoMarkSelection( this, *pUndoMarkSelection ); - GetUndoManager().AddUndoAction( pU, FALSE ); + GetUndoManager().AddUndoAction( pU, sal_False ); delete pUndoMarkSelection; pUndoMarkSelection = NULL; } @@ -297,90 +280,83 @@ void ImpEditEngine::ResetUndoManager() GetUndoManager().Clear(); } -void ImpEditEngine::EnableUndo( BOOL bEnable ) +void ImpEditEngine::EnableUndo( sal_Bool bEnable ) { - // Beim Umschalten des Modus Liste loeschen: + // When switching the mode Delete list: if ( bEnable != IsUndoEnabled() ) ResetUndoManager(); bUndoEnabled = bEnable; } -BOOL ImpEditEngine::Undo( EditView* pView ) +sal_Bool ImpEditEngine::Undo( EditView* pView ) { if ( HasUndoManager() && GetUndoManager().GetUndoActionCount() ) { SetActiveView( pView ); - GetUndoManager().Undo( 1 ); - return TRUE; + GetUndoManager().Undo(); + return sal_True; } - return FALSE; + return sal_False; } -BOOL ImpEditEngine::Redo( EditView* pView ) +sal_Bool ImpEditEngine::Redo( EditView* pView ) { if ( HasUndoManager() && GetUndoManager().GetRedoActionCount() ) { SetActiveView( pView ); - GetUndoManager().Redo( 0 ); - return TRUE; + GetUndoManager().Redo(); + return sal_True; } - return FALSE; + return sal_False; } -BOOL ImpEditEngine::Repeat( EditView* /* pView */ ) +sal_Bool ImpEditEngine::Repeat( EditView* /* pView */ ) { if ( HasUndoManager() && GetUndoManager().GetRepeatActionCount() ) { - DBG_WARNING( "Repeat nicht implementiert!" ); - return TRUE; + DBG_WARNING( "Repeat not implemented!" ); + return sal_True; } - return FALSE; + return sal_False; } -SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, BOOL bOnlyHardAttrib ) +SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttrib ) { DBG_CHKOBJ( GetEditEnginePtr(), EditEngine, 0 ); aSel.Adjust( aEditDoc ); -#if OSL_DEBUG_LEVEL > 1 -// if ( ( aSel.Min().GetNode() == aSel.Max().GetNode() ) && ( bOnlyHardAttrib == EditEngineAttribs_All ) ) -// return GetAttribs( aEditDoc.GetPos( aSel.Min().GetNode() ), aSel.Min().GetIndex(), aSel.Max().GetIndex(), GETATTRIBS_ALL ); -#endif - - SfxItemSet aCurSet( GetEmptyItemSet() ); - USHORT nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); - USHORT nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); + sal_uInt16 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); + sal_uInt16 nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); - // ueber die Absaetze iterieren... - for ( USHORT nNode = nStartNode; nNode <= nEndNode; nNode++ ) + // iterate over the paragraphs ... + for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { ContentNode* pNode = aEditDoc.GetObject( nNode ); - DBG_ASSERT( aEditDoc.SaveGetObject( nNode ), "Node nicht gefunden: GetAttrib" ); + DBG_ASSERT( aEditDoc.SaveGetObject( nNode ), "Node not found: GetAttrib" ); xub_StrLen nStartPos = 0; xub_StrLen nEndPos = pNode->Len(); if ( nNode == nStartNode ) nStartPos = aSel.Min().GetIndex(); - if ( nNode == nEndNode ) // kann auch == nStart sein! + if ( nNode == nEndNode ) // Can also be == nStart! nEndPos = aSel.Max().GetIndex(); - // Problem: Vorlagen.... - // => Andersrum: - // 1) Harte Zeichenattribute, wie gehabt... - // 2) Nur wenn OFF, Style and Absatzattr. pruefen... + // Problem: Templates .... + // => Other way: + // 1) Hard character attributes, as usual ... + // 2) Examine Style and paragraph attributes only when OFF ... - // Erst die ganz harte Formatierung... + // First the very hard formatting ... aEditDoc.FindAttribs( pNode, nStartPos, nEndPos, aCurSet ); if( bOnlyHardAttrib != EditEngineAttribs_OnlyHard ) { - // Und dann Absatzformatierung und Vorlage... - // SfxStyleSheet* pStyle = pNode->GetStyleSheet(); - for ( USHORT nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++) + // and then paragraph formatting and template... + for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++) { if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF ) { @@ -409,13 +385,12 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, BOOL bOnlyHardAttrib ) // pItem can only be NULL when bOnlyHardAttrib... if ( !pItem || ( *pItem != aCurSet.Get( nWhich ) ) ) { - // Problem: Wenn Absatzvorlage mit z.B. Font, - // aber Font hart und anders und komplett in Selektion - // Falsch, wenn invalidiert.... - // => Lieber nicht invalidieren, UMSTELLEN! - // Besser waere, Absatzweise ein ItemSet zu fuellen - // und dieses mit dem gesmten vergleichen. - // aCurSet.InvalidateItem( nWhich ); + // Problem: When Paragraph style with for example font, + // but the Font is hard and completely different, + // wrong in selection if invalidated.... + // => better not invalidate, instead CHANGE! + // It would be better to fill each paragraph with + // a itemset and compare this in large. if ( nWhich <= EE_PARA_END ) aCurSet.InvalidateItem( nWhich ); } @@ -424,10 +399,10 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, BOOL bOnlyHardAttrib ) } } - // Leere Slots mit Defaults fuellen... + // fill empty slots with defaults ... if ( bOnlyHardAttrib == EditEngineAttribs_All ) { - for ( USHORT nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++ ) + for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++ ) { if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF ) { @@ -439,9 +414,9 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, BOOL bOnlyHardAttrib ) } -SfxItemSet ImpEditEngine::GetAttribs( USHORT nPara, USHORT nStart, USHORT nEnd, sal_uInt8 nFlags ) const +SfxItemSet ImpEditEngine::GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags ) const { - // MT: #94002# Optimized function with less Puts(), which cause unnecessary cloning from default items. + // Optimized function with less Puts(), which cause unnecessary cloning from default items. // If this works, change GetAttribs( EditSelection ) to use this for each paragraph and merge the results! DBG_CHKOBJ( GetEditEnginePtr(), EditEngine, 0 ); @@ -463,7 +438,7 @@ SfxItemSet ImpEditEngine::GetAttribs( USHORT nPara, USHORT nStart, USHORT nEnd, // StyleSheet / Parattribs... if ( pNode->GetStyleSheet() && ( nFlags & GETATTRIBS_STYLESHEET ) ) - aAttribs.Set( pNode->GetStyleSheet()->GetItemSet(), TRUE ); + aAttribs.Set( pNode->GetStyleSheet()->GetItemSet(), sal_True ); if ( nFlags & GETATTRIBS_PARAATTRIBS ) aAttribs.Put( pNode->GetContentAttribs().GetItems() ); @@ -476,13 +451,13 @@ SfxItemSet ImpEditEngine::GetAttribs( USHORT nPara, USHORT nStart, USHORT nEnd, pNode->GetCharAttribs().OptimizeRanges( ((ImpEditEngine*)this)->GetEditDoc().GetItemPool() ); const CharAttribArray& rAttrs = pNode->GetCharAttribs().GetAttribs(); - for ( USHORT nAttr = 0; nAttr < rAttrs.Count(); nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < rAttrs.Count(); nAttr++ ) { EditCharAttrib* pAttr = rAttrs.GetObject( nAttr ); if ( nStart == nEnd ) { - USHORT nCursorPos = nStart; + sal_uInt16 nCursorPos = nStart; if ( ( pAttr->GetStart() <= nCursorPos ) && ( pAttr->GetEnd() >= nCursorPos ) ) { // To be used the attribute has to start BEFORE the position, or it must be a @@ -530,17 +505,17 @@ SfxItemSet ImpEditEngine::GetAttribs( USHORT nPara, USHORT nStart, USHORT nEnd, } -void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, BYTE nSpecial ) +void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_uInt8 nSpecial ) { aSel.Adjust( aEditDoc ); - // Wenn keine Selektion => die Attribute aufs Wort anwenden. - // ( Der RTF-Perser sollte die Methode eigentlich nie ohne Range rufen ) + // When no selection => use the Attribute on the word. + // ( the RTF-parser should actually never call the Method whithout a Range ) if ( ( nSpecial == ATTRSPECIAL_WHOLEWORD ) && !aSel.HasRange() ) - aSel = SelectWord( aSel, ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, FALSE ); + aSel = SelectWord( aSel, ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_False ); - USHORT nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); - USHORT nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); + sal_uInt16 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); + sal_uInt16 nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); if ( IsUndoEnabled() && !IsInUndo() && aStatus.DoUndoAttribs() ) { @@ -549,7 +524,7 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, BYTE InsertUndo( pUndo ); } - BOOL bCheckLanguage = FALSE; + sal_Bool bCheckLanguage = sal_False; if ( GetStatus().DoOnlineSpelling() ) { bCheckLanguage = ( rSet.GetItemState( EE_CHAR_LANGUAGE ) == SFX_ITEM_ON ) || @@ -557,37 +532,37 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, BYTE ( rSet.GetItemState( EE_CHAR_LANGUAGE_CTL ) == SFX_ITEM_ON ); } - // ueber die Absaetze iterieren... - for ( USHORT nNode = nStartNode; nNode <= nEndNode; nNode++ ) + // iterate over the paragraphs ... + for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { - BOOL bParaAttribFound = FALSE; - BOOL bCharAttribFound = FALSE; + sal_Bool bParaAttribFound = sal_False; + sal_Bool bCharAttribFound = sal_False; ContentNode* pNode = aEditDoc.GetObject( nNode ); ParaPortion* pPortion = GetParaPortions().GetObject( nNode ); - DBG_ASSERT( aEditDoc.SaveGetObject( nNode ), "Node nicht gefunden: SetAttribs" ); - DBG_ASSERT( GetParaPortions().GetObject( nNode ), "Portion nicht gefunden: SetAttribs" ); + DBG_ASSERT( aEditDoc.SaveGetObject( nNode ), "Node not founden: SetAttribs" ); + DBG_ASSERT( GetParaPortions().GetObject( nNode ), "Portion not found: SetAttribs" ); xub_StrLen nStartPos = 0; xub_StrLen nEndPos = pNode->Len(); if ( nNode == nStartNode ) nStartPos = aSel.Min().GetIndex(); - if ( nNode == nEndNode ) // kann auch == nStart sein! + if ( nNode == nEndNode ) // can also be == nStart! nEndPos = aSel.Max().GetIndex(); - // ueber die Items iterieren... + // Iterate over the Items... #ifdef EDITDEBUG // FILE* fp = fopen( "d:\\debug.log", "a" ); // if ( fp ) // { -// fprintf( fp, "\n\n=> Zeichen-Attribute: Absatz %i, %i-%i\n", nNode, nStartPos, nEndPos ); -// DbgOutItemSet( fp, rSet, TRUE, FALSE ); +// fprintf( fp, "\n\n=> Character-Attribute: Paragraph %i, %i-%i\n", nNode, nStartPos, nEndPos ); +// DbgOutItemSet( fp, rSet, sal_True, sal_False ); // fclose( fp ); // } #endif - for ( USHORT nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++) + for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++) { if ( rSet.GetItemState( nWhich ) == SFX_ITEM_ON ) { @@ -595,17 +570,17 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, BYTE if ( nWhich <= EE_PARA_END ) { pNode->GetContentAttribs().GetItems().Put( rItem ); - bParaAttribFound = TRUE; + bParaAttribFound = sal_True; } else { aEditDoc.InsertAttrib( pNode, nStartPos, nEndPos, rItem ); - bCharAttribFound = TRUE; + bCharAttribFound = sal_True; if ( nSpecial == ATTRSPECIAL_EDGE ) { CharAttribArray& rAttribs = pNode->GetCharAttribs().GetAttribs(); - USHORT nAttrs = rAttribs.Count(); - for ( USHORT n = 0; n < nAttrs; n++ ) + sal_uInt16 nAttrs = rAttribs.Count(); + for ( sal_uInt16 n = 0; n < nAttrs; n++ ) { EditCharAttrib* pAttr = rAttribs.GetObject( n ); if ( pAttr->GetStart() > nEndPos ) @@ -613,7 +588,7 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, BYTE if ( ( pAttr->GetEnd() == nEndPos ) && ( pAttr->Which() == nWhich ) ) { - pAttr->SetEdge( TRUE ); + pAttr->SetEdge( sal_True ); break; } } @@ -628,7 +603,7 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, BYTE } else if ( bCharAttribFound ) { - bFormatted = FALSE; + bFormatted = sal_False; if ( !pNode->Len() || ( nStartPos != nEndPos ) ) { pPortion->MarkSelectionInvalid( nStartPos, nEndPos-nStartPos ); @@ -639,59 +614,59 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, BYTE } } -void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, BOOL bRemoveParaAttribs, USHORT nWhich ) +void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ) { aSel.Adjust( aEditDoc ); - USHORT nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); - USHORT nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); + sal_uInt16 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); + sal_uInt16 nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); const SfxItemSet* _pEmptyItemSet = bRemoveParaAttribs ? &GetEmptyItemSet() : 0; if ( IsUndoEnabled() && !IsInUndo() && aStatus.DoUndoAttribs() ) { - // Eventuel spezielles Undo, oder ItemSet* + // Possibly a special Undo, or itemset* EditUndoSetAttribs* pUndo = CreateAttribUndo( aSel, GetEmptyItemSet() ); - pUndo->SetRemoveAttribs( TRUE ); + pUndo->SetRemoveAttribs( sal_True ); pUndo->SetRemoveParaAttribs( bRemoveParaAttribs ); pUndo->SetRemoveWhich( nWhich ); InsertUndo( pUndo ); } - // ueber die Absaetze iterieren... - for ( USHORT nNode = nStartNode; nNode <= nEndNode; nNode++ ) + // iterate over the paragraphs ... + for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { ContentNode* pNode = aEditDoc.GetObject( nNode ); ParaPortion* pPortion = GetParaPortions().GetObject( nNode ); - DBG_ASSERT( aEditDoc.SaveGetObject( nNode ), "Node nicht gefunden: SetAttribs" ); - DBG_ASSERT( GetParaPortions().SaveGetObject( nNode ), "Portion nicht gefunden: SetAttribs" ); + DBG_ASSERT( aEditDoc.SaveGetObject( nNode ), "Node not found: SetAttribs" ); + DBG_ASSERT( GetParaPortions().SaveGetObject( nNode ), "Portion not found: SetAttribs" ); xub_StrLen nStartPos = 0; xub_StrLen nEndPos = pNode->Len(); if ( nNode == nStartNode ) nStartPos = aSel.Min().GetIndex(); - if ( nNode == nEndNode ) // kann auch == nStart sein! + if ( nNode == nEndNode ) // can also be == nStart! nEndPos = aSel.Max().GetIndex(); - // Optimieren: Wenn ganzer Absatz, dann RemoveCharAttribs( nPara )?! - BOOL bChanged = aEditDoc.RemoveAttribs( pNode, nStartPos, nEndPos, nWhich ); + // Optimize: If whole paragraph, then RemoveCharAttribs (nPara)? + sal_Bool bChanged = aEditDoc.RemoveAttribs( pNode, nStartPos, nEndPos, nWhich ); if ( bRemoveParaAttribs ) { - SetParaAttribs( nNode, *_pEmptyItemSet ); // Invalidiert + SetParaAttribs( nNode, *_pEmptyItemSet ); // Invalidated } else { - // Bei 'Format-Standard' sollen auch die Zeichenattribute verschwinden, - // die von der DrawingEngine als Absatzattribute eingestellt wurden. - // Diese koennen sowieso nicht vom Anwender eingestellt worden sein. + // For 'Format-Standard' also the character attributes should + // disappear, which were set as paragraph attributes by the + // DrawingEngine. These could not have been set by the user anyway. // #106871# Not when nWhich // Would have been better to offer a separate method for format/standard... if ( !nWhich ) { SfxItemSet aAttribs( GetParaAttribs( nNode ) ); - for ( USHORT nW = EE_CHAR_START; nW <= EE_CHAR_END; nW++ ) + for ( sal_uInt16 nW = EE_CHAR_START; nW <= EE_CHAR_END; nW++ ) aAttribs.ClearItem( nW ); SetParaAttribs( nNode, aAttribs ); } @@ -699,7 +674,7 @@ void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, BOOL bRemoveParaAttri if ( bChanged && !bRemoveParaAttribs ) { - bFormatted = FALSE; + bFormatted = sal_False; pPortion->MarkSelectionInvalid( nStartPos, nEndPos-nStartPos ); } } @@ -707,18 +682,18 @@ void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, BOOL bRemoveParaAttri typedef EditCharAttrib* EditCharAttribPtr; -void ImpEditEngine::RemoveCharAttribs( USHORT nPara, USHORT nWhich, BOOL bRemoveFeatures ) +void ImpEditEngine::RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich, sal_Bool bRemoveFeatures ) { ContentNode* pNode = aEditDoc.SaveGetObject( nPara ); ParaPortion* pPortion = GetParaPortions().SaveGetObject( nPara ); - DBG_ASSERT( pNode, "Node nicht gefunden: RemoveCharAttribs" ); - DBG_ASSERT( pPortion, "Portion nicht gefunden: RemoveCharAttribs" ); + DBG_ASSERT( pNode, "Node not found: RemoveCharAttribs" ); + DBG_ASSERT( pPortion, "Portion not found: RemoveCharAttribs" ); if ( !pNode ) return; - USHORT nAttr = 0; + sal_uInt16 nAttr = 0; EditCharAttribPtr pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); while ( pAttr ) { @@ -736,7 +711,7 @@ void ImpEditEngine::RemoveCharAttribs( USHORT nPara, USHORT nWhich, BOOL bRemove pPortion->MarkSelectionInvalid( 0, pNode->Len() ); } -void ImpEditEngine::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) +void ImpEditEngine::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) { ContentNode* pNode = aEditDoc.SaveGetObject( nPara ); @@ -747,8 +722,8 @@ void ImpEditEngine::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) // FILE* fp = fopen( "d:\\debug.log", "a" ); // if ( fp ) // { -// fprintf( fp, "\n\n=> Absatz-Attribute: Absatz %i\n", nPara ); -// DbgOutItemSet( fp, rSet, TRUE, FALSE ); +// fprintf( fp, "\n\n=> Paragraph-Attribute: Paragraph %i\n", nPara ); +// DbgOutItemSet( fp, rSet, sal_True, sal_False ); // fclose( fp ); // } #endif @@ -776,36 +751,36 @@ void ImpEditEngine::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) } } -const SfxItemSet& ImpEditEngine::GetParaAttribs( USHORT nPara ) const +const SfxItemSet& ImpEditEngine::GetParaAttribs( sal_uInt16 nPara ) const { ContentNode* pNode = aEditDoc.GetObject( nPara ); - DBG_ASSERT( pNode, "Node nicht gefunden: GetParaAttribs" ); + DBG_ASSERT( pNode, "Node not found: GetParaAttribs" ); return pNode->GetContentAttribs().GetItems(); } -BOOL ImpEditEngine::HasParaAttrib( USHORT nPara, USHORT nWhich ) const +sal_Bool ImpEditEngine::HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const { ContentNode* pNode = aEditDoc.GetObject( nPara ); - DBG_ASSERT( pNode, "Node nicht gefunden: HasParaAttrib" ); + DBG_ASSERT( pNode, "Node not found: HasParaAttrib" ); return pNode->GetContentAttribs().HasItem( nWhich ); } -const SfxPoolItem& ImpEditEngine::GetParaAttrib( USHORT nPara, USHORT nWhich ) const +const SfxPoolItem& ImpEditEngine::GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const { ContentNode* pNode = aEditDoc.GetObject( nPara ); - DBG_ASSERT( pNode, "Node nicht gefunden: GetParaAttrib" ); + DBG_ASSERT( pNode, "Node not found: GetParaAttrib" ); return pNode->GetContentAttribs().GetItem( nWhich ); } -void ImpEditEngine::GetCharAttribs( USHORT nPara, EECharAttribArray& rLst ) const +void ImpEditEngine::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const { rLst.Remove( 0, rLst.Count() ); ContentNode* pNode = aEditDoc.GetObject( nPara ); if ( pNode ) { - for ( USHORT nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ ) + for ( sal_uInt16 nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ ) { EditCharAttribPtr pAttr = pNode->GetCharAttribs().GetAttribs()[ nAttr ]; EECharAttrib aEEAttr; @@ -822,13 +797,13 @@ void ImpEditEngine::ParaAttribsToCharAttribs( ContentNode* pNode ) { pNode->GetCharAttribs().DeleteEmptyAttribs( GetEditDoc().GetItemPool() ); xub_StrLen nEndPos = pNode->Len(); - for ( USHORT nWhich = EE_CHAR_START; nWhich <= EE_CHAR_END; nWhich++ ) + for ( sal_uInt16 nWhich = EE_CHAR_START; nWhich <= EE_CHAR_END; nWhich++ ) { if ( pNode->GetContentAttribs().HasItem( nWhich ) ) { const SfxPoolItem& rItem = pNode->GetContentAttribs().GetItem( nWhich ); - // Die Luecken auffuellen: - USHORT nLastEnd = 0; + // Fill the gap: + sal_uInt16 nLastEnd = 0; EditCharAttrib* pAttr = pNode->GetCharAttribs().FindNextAttrib( nWhich, nLastEnd ); while ( pAttr ) { @@ -839,13 +814,13 @@ void ImpEditEngine::ParaAttribsToCharAttribs( ContentNode* pNode ) pAttr = nLastEnd ? pNode->GetCharAttribs().FindNextAttrib( nWhich, nLastEnd ) : NULL; } - // Und den Rest: + // And the Rest: if ( nLastEnd < nEndPos ) aEditDoc.InsertAttrib( pNode, nLastEnd, nEndPos, rItem ); } } - bFormatted = FALSE; - // Portion braucht hier nicht invalidiert werden, geschieht woanders. + bFormatted = sal_False; + // Portion does not need to be invalidated here, happens elsewhere. } IdleFormattter::IdleFormattter() @@ -886,9 +861,9 @@ ImplIMEInfos::ImplIMEInfos( const EditPaM& rPos, const String& rOldTextAfterStar { aPos = rPos; nLen = 0; - bCursor = TRUE; + bCursor = sal_True; pAttribs = NULL; - bWasCursorOverwrite = FALSE; + bWasCursorOverwrite = sal_False; } ImplIMEInfos::~ImplIMEInfos() @@ -896,12 +871,12 @@ ImplIMEInfos::~ImplIMEInfos() delete[] pAttribs; } -void ImplIMEInfos::CopyAttribs( const USHORT* pA, USHORT nL ) +void ImplIMEInfos::CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL ) { nLen = nL; delete[] pAttribs; - pAttribs = new USHORT[ nL ]; - memcpy( pAttribs, pA, nL*sizeof(USHORT) ); + pAttribs = new sal_uInt16[ nL ]; + memcpy( pAttribs, pA, nL*sizeof(sal_uInt16) ); } void ImplIMEInfos::DestroyAttribs() diff --git a/editeng/source/editeng/makefile.mk b/editeng/source/editeng/makefile.mk index 4a8f8f2540..6a623d02c5 100644 --- a/editeng/source/editeng/makefile.mk +++ b/editeng/source/editeng/makefile.mk @@ -30,19 +30,14 @@ PRJNAME=editeng TARGET=editeng AUTOSEG=true -#PROJECTPCH4DLL=TRUE -#PROJECTPCH=eeng_pch -#PROJECTPCHSOURCE=eeng_pch - ENABLE_EXCEPTIONS=TRUE - # --- Settings ----------------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/makefile.pmk -# --- Allgemein ---------------------------------------------------------- +# --- General ---------------------------------------------------------- .IF "$(editdebug)" != "" || "$(EDITDEBUG)" != "" CDEFS+=-DEDITDEBUG diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx index b37e767a6f..b7d6a8c421 100644 --- a/editeng/source/editeng/textconv.cxx +++ b/editeng/source/editeng/textconv.cxx @@ -63,7 +63,7 @@ TextConvWrapper::TextConvWrapper( Window* pWindow, const Font* pTargetFont, sal_Int32 nOptions, sal_Bool bIsInteractive, - BOOL bIsStart, + sal_Bool bIsStart, EditView* pView ) : HangulHanjaConversion( pWindow, rxMSF, rSourceLocale, rTargetLocale, pTargetFont, nOptions, bIsInteractive ) { @@ -101,7 +101,7 @@ sal_Bool TextConvWrapper::ConvNext_impl() if ( bStartDone && bEndDone ) { - if ( ConvMore_impl() ) // ein weiteres Dokument pruefen? + if ( ConvMore_impl() ) // examine another document? { bStartDone = sal_True; bEndDone = sal_False; @@ -112,12 +112,11 @@ sal_Bool TextConvWrapper::ConvNext_impl() } - //ResMgr* pMgr = DIALOG_MGR(); sal_Bool bGoOn = sal_False; if ( bStartDone && bEndDone ) { - if ( ConvMore_impl() ) // ein weiteres Dokument pruefen? + if ( ConvMore_impl() ) // examine another document? { bStartDone = sal_True; bEndDone = sal_False; @@ -125,34 +124,11 @@ sal_Bool TextConvWrapper::ConvNext_impl() return sal_True; } } - else + else if (!aConvSel.HasRange()) { - // Ein BODY_Bereich erledigt, Frage nach dem anderen BODY_Bereich -/* - pWin->LeaveWait(); - - sal_uInt16 nResId = bReverse ? RID_SVXQB_BW_CONTINUE : RID_SVXQB_CONTINUE; - QueryBox aBox( pWin, ResId( nResId, pMgr ) ); - if ( aBox.Execute() != RET_YES ) - { - // Verzicht auf den anderen Bereich, ggf. Frage nach Sonderbereich - pWin->EnterWait(); - bStartDone = bEndDone = sal_True; - return ConvNext_impl(); - } - else - { -*/ - if (!aConvSel.HasRange()) - { - bStartChk = !bStartDone; - ConvStart_impl( bStartChk ? SVX_SPELL_BODY_START : SVX_SPELL_BODY_END ); - bGoOn = sal_True; - } -/* - } - pWin->EnterWait(); -*/ + bStartChk = !bStartDone; + ConvStart_impl( bStartChk ? SVX_SPELL_BODY_START : SVX_SPELL_BODY_END ); + bGoOn = sal_True; } return bGoOn; } @@ -162,8 +138,6 @@ sal_Bool TextConvWrapper::FindConvText_impl() { // modified version of SvxSpellWrapper::FindSpellError - //ShowLanguageErrors(); - sal_Bool bFound = sal_False; pWin->EnterWait(); @@ -199,7 +173,7 @@ sal_Bool TextConvWrapper::ConvMore_impl() bMore = pImpEE->GetEditEnginePtr()->ConvertNextDocument(); if ( bMore ) { - // Der Text wurde in diese Engine getreten... + // The text has been entered in this engine ... pEditView->GetImpEditView()->SetEditSelection( pImpEE->GetEditDoc().GetStartPaM() ); } @@ -217,8 +191,7 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) if ( eArea == SVX_SPELL_BODY_START ) { - // Wird gerufen, wenn Spell-Forwad am Ende angekomment ist - // und soll von vorne beginnen + // Is called when Spell-forward has reached the end, and to start over if ( bEndDone ) { pConvInfo->bConvToEnd = sal_False; @@ -236,7 +209,7 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) } else if ( eArea == SVX_SPELL_BODY_END ) { - // Wird gerufen, wenn Spell-Forwad gestartet wird + // Is called when Spell-forward starts pConvInfo->bConvToEnd = sal_True; if (aConvSel.HasRange()) { @@ -258,11 +231,10 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) pConvInfo->aConvContinue = pConvInfo->aConvStart; pConvInfo->aConvTo = pImpEE->CreateEPaM( pImpEE->GetEditDoc().GetEndPaM() ); - // pSpellInfo->bSpellToEnd = sal_True; } else { - DBG_ERROR( "ConvStart_impl: Unknown Area!" ); + OSL_FAIL( "ConvStart_impl: Unknown Area!" ); } } @@ -287,8 +259,8 @@ sal_Bool TextConvWrapper::ConvContinue_impl() void TextConvWrapper::SetLanguageAndFont( const ESelection &rESel, - LanguageType nLang, USHORT nLangWhichId, - const Font *pFont, USHORT nFontWhichId ) + LanguageType nLang, sal_uInt16 nLangWhichId, + const Font *pFont, sal_uInt16 nFontWhichId ) { ESelection aOldSel = pEditView->GetSelection(); pEditView->SetSelection( rESel ); @@ -303,11 +275,11 @@ void TextConvWrapper::SetLanguageAndFont( const ESelection &rESel, { // set new font attribute SvxFontItem aFontItem = (SvxFontItem&) aNewSet.Get( nFontWhichId ); - aFontItem.GetFamilyName() = pFont->GetName(); - aFontItem.GetFamily() = pFont->GetFamily(); - aFontItem.GetStyleName() = pFont->GetStyleName(); - aFontItem.GetPitch() = pFont->GetPitch(); - aFontItem.GetCharSet() = pFont->GetCharSet(); + aFontItem.SetFamilyName( pFont->GetName()); + aFontItem.SetFamily( pFont->GetFamily()); + aFontItem.SetStyleName( pFont->GetStyleName()); + aFontItem.SetPitch( pFont->GetPitch()); + aFontItem.SetCharSet(pFont->GetCharSet()); aNewSet.Put( aFontItem ); } @@ -322,7 +294,7 @@ void TextConvWrapper::SelectNewUnit_impl( const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd ) { - BOOL bOK = 0 <= nUnitStart && 0 <= nUnitEnd && nUnitStart <= nUnitEnd; + sal_Bool bOK = 0 <= nUnitStart && 0 <= nUnitEnd && nUnitStart <= nUnitEnd; DBG_ASSERT( bOK, "invalid arguments" ); if (!bOK) return; @@ -330,8 +302,8 @@ void TextConvWrapper::SelectNewUnit_impl( ESelection aSelection = pEditView->GetSelection(); DBG_ASSERT( aSelection.nStartPara == aSelection.nEndPara, "paragraph mismatch in selection" ); - aSelection.nStartPos = (USHORT) (nLastPos + nUnitOffset + nUnitStart); - aSelection.nEndPos = (USHORT) (nLastPos + nUnitOffset + nUnitEnd); + aSelection.nStartPos = (sal_uInt16) (nLastPos + nUnitOffset + nUnitStart); + aSelection.nEndPos = (sal_uInt16) (nLastPos + nUnitOffset + nUnitEnd); pEditView->SetSelection( aSelection ); } @@ -373,7 +345,7 @@ void TextConvWrapper::ReplaceUnit( ReplacementAction eAction, LanguageType *pNewUnitLanguage ) { - BOOL bOK = 0 <= nUnitStart && 0 <= nUnitEnd && nUnitStart <= nUnitEnd; + sal_Bool bOK = 0 <= nUnitStart && 0 <= nUnitEnd && nUnitStart <= nUnitEnd; DBG_ASSERT( bOK, "invalid arguments" ); if (!bOK) return; @@ -401,12 +373,12 @@ void TextConvWrapper::ReplaceUnit( case eOriginalAbove : case eReplacementBelow : case eOriginalBelow : - DBG_ERROR( "Rubies not supported" ); + OSL_FAIL( "Rubies not supported" ); break; default: - DBG_ERROR( "unexpected case" ); + OSL_FAIL( "unexpected case" ); } - nUnitOffset = sal::static_int_cast< USHORT >( + nUnitOffset = sal::static_int_cast< sal_uInt16 >( nUnitOffset + nUnitStart + aNewTxt.getLength()); // remember current original language for kater use @@ -439,7 +411,6 @@ void TextConvWrapper::ReplaceUnit( ESelection aNewSel( aOldSel ); aNewSel.nStartPos = sal::static_int_cast< xub_StrLen >( aNewSel.nStartPos - aNewTxt.getLength()); -// DBG_ASSERT( aOldSel.nEndPos >= 0, "error while building selection" ); if (pNewUnitLanguage) { @@ -460,13 +431,13 @@ void TextConvWrapper::ReplaceUnit( { // Note: replacement is always done in the current paragraph // which is the one ConvContinue points to - pConvInfo->aConvContinue.nIndex = sal::static_int_cast< USHORT >( + pConvInfo->aConvContinue.nIndex = sal::static_int_cast< sal_uInt16 >( pConvInfo->aConvContinue.nIndex + nDelta); // if that is the same as the one where the conversions ends // the end needs to be updated also if (pConvInfo->aConvTo.nPara == pConvInfo->aConvContinue.nPara) - pConvInfo->aConvTo.nIndex = sal::static_int_cast< USHORT >( + pConvInfo->aConvTo.nIndex = sal::static_int_cast< sal_uInt16 >( pConvInfo->aConvTo.nIndex + nDelta); } } diff --git a/editeng/source/editeng/textconv.hxx b/editeng/source/editeng/textconv.hxx index e8d17075d7..3323e53035 100644 --- a/editeng/source/editeng/textconv.hxx +++ b/editeng/source/editeng/textconv.hxx @@ -42,8 +42,8 @@ class TextConvWrapper : public editeng::HangulHanjaConversion { rtl::OUString aConvText; // convertible text part found last time LanguageType nConvTextLang; // language of aConvText - USHORT nLastPos; // starting position of the last found text portion (word) - USHORT nUnitOffset; // offset of current unit in the current text portion (word) + sal_uInt16 nLastPos; // starting position of the last found text portion (word) + sal_uInt16 nUnitOffset; // offset of current unit in the current text portion (word) ESelection aConvSel; // selection to be converted if // 'HasRange' is true, other conversion @@ -100,8 +100,8 @@ protected: virtual sal_Bool HasRubySupport() const; void SetLanguageAndFont( const ESelection &rESel, - LanguageType nLang, USHORT nLangWhichId, - const Font *pFont, USHORT nFontWhichId ); + LanguageType nLang, sal_uInt16 nLangWhichId, + const Font *pFont, sal_uInt16 nFontWhichId ); public: @@ -110,9 +110,9 @@ public: const ::com::sun::star::lang::Locale& rSourceLocale, const ::com::sun::star::lang::Locale& rTargetLocale, const Font* pTargetFont, - INT32 nOptions, + sal_Int32 nOptions, sal_Bool bIsInteractive, - BOOL bIsStart, EditView* pView ); + sal_Bool bIsStart, EditView* pView ); virtual ~TextConvWrapper(); diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx new file mode 100644 index 0000000000..de24284b92 --- /dev/null +++ b/editeng/source/items/borderline.cxx @@ -0,0 +1,495 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_editeng.hxx" + + +// include --------------------------------------------------------------- +#include <basegfx/color/bcolor.hxx> +#include <basegfx/color/bcolortools.hxx> + +#include <editeng/borderline.hxx> +#include <editeng/itemtype.hxx> + +// class SvxBorderLine -------------------------------------------------- + +namespace { + + Color lcl_compute3DColor( Color aMain, int nLight, int nMedium, int nDark ) + { + basegfx::BColor color = aMain.getBColor( ); + basegfx::BColor hsl = basegfx::tools::rgb2hsl( color ); + + int nCoef = 0; + if ( hsl.getZ( ) >= 0.5 ) + nCoef = nLight; + else if ( 0.5 > hsl.getZ() && hsl.getZ() >= 0.25 ) + nCoef = nMedium; + else + nCoef = nDark; + + double L = hsl.getZ() * 255.0 + nCoef; + hsl.setZ( L / 255.0 ); + color = basegfx::tools::hsl2rgb( hsl ); + + return Color( color ); + } +} // Anonymous namespace + +namespace editeng { + +Color SvxBorderLine::darkColor( Color aMain ) +{ + return aMain; +} + +Color SvxBorderLine::lightColor( Color aMain ) +{ + + // Divide Luminance by 2 + basegfx::BColor color = aMain.getBColor( ); + basegfx::BColor hsl = basegfx::tools::rgb2hsl( color ); + hsl.setZ( hsl.getZ() * 0.5 ); + color = basegfx::tools::hsl2rgb( hsl ); + + return Color( color ); +} + + +Color SvxBorderLine::threeDLightColor( Color aMain ) +{ + // These values have been defined in an empirical way + return lcl_compute3DColor( aMain, 3, 40, 83 ); +} + +Color SvxBorderLine::threeDDarkColor( Color aMain ) +{ + // These values have been defined in an empirical way + return lcl_compute3DColor( aMain, -85, -43, -1 ); +} + +Color SvxBorderLine::threeDMediumColor( Color aMain ) +{ + // These values have been defined in an empirical way + return lcl_compute3DColor( aMain, -42, -0, 42 ); +} + +SvxBorderLine::SvxBorderLine( const Color *pCol, long nWidth, + SvxBorderStyle nStyle, bool bUseLeftTop, + Color (*pColorOutFn)( Color ), Color (*pColorInFn)( Color ), + Color (*pColorGapFn)( Color ) ) +: m_nWidth( nWidth ) +, m_bMirrorWidths( false ) +, m_aWidthImpl( SvxBorderLine::getWidthImpl( nStyle ) ) +, m_nMult( 1 ) +, m_nDiv( 1 ) +, m_nStyle( nStyle ) +, m_bUseLeftTop( bUseLeftTop ) +, m_pColorOutFn( pColorOutFn ) +, m_pColorInFn( pColorInFn ) +, m_pColorGapFn( pColorGapFn ) +{ + if ( pCol ) + aColor = *pCol; +} + +/** Get the BorderWithImpl object corresponding to the given #nStyle, all the + units handled by the resulting object are Twips and the + BorderWidthImpl::GetLine1() corresponds to the Outer Line. + */ +BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle ) +{ + BorderWidthImpl aImpl; + + switch ( nStyle ) + { + // No line: no width + case NO_STYLE: + aImpl = BorderWidthImpl( 0, 0.0 ); + break; + + // Single lines + case SOLID: + case DOTTED: + case DASHED: + aImpl = BorderWidthImpl( CHANGE_LINE1, 1.0 ); + break; + + // Double lines + + case DOUBLE: + aImpl = BorderWidthImpl( + CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, + 1.0, 1.0, 1.0 ); + break; + + case THINTHICK_SMALLGAP: + aImpl = BorderWidthImpl( CHANGE_LINE1, 1.0, 15.0, 15.0 ); + break; + + case THINTHICK_MEDIUMGAP: + aImpl = BorderWidthImpl( + CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, + 1.0, 0.5, 0.5 ); + break; + + case THINTHICK_LARGEGAP: + aImpl = BorderWidthImpl( CHANGE_DIST, 30.0, 15.0, 1.0 ); + break; + + case THICKTHIN_SMALLGAP: + aImpl = BorderWidthImpl( CHANGE_LINE2, 15.0, 1.0, 15.0 ); + break; + + case THICKTHIN_MEDIUMGAP: + aImpl = BorderWidthImpl( + CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, + 0.5, 1.0, 0.5 ); + break; + + case THICKTHIN_LARGEGAP: + aImpl = BorderWidthImpl( CHANGE_DIST, 15.0, 30.0, 1.0 ); + break; + + // Engraved / Embossed + /* + * Word compat: the lines widths are exactly following this rule, shouldbe: + * 0.75pt up to 3pt and then 3pt + */ + + case EMBOSSED: + case ENGRAVED: + aImpl = BorderWidthImpl( + CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, + 0.5, 0.5, 1.0 ); + break; + + // Inset / Outset + /* + * Word compat: the gap width should be measured relatively to the biggest width for the + * row or column. + */ + case OUTSET: + aImpl = BorderWidthImpl( + CHANGE_LINE2 | CHANGE_DIST, + 15.0, 1.0, 1.0 ); + break; + + case INSET: + aImpl = BorderWidthImpl( + CHANGE_LINE1 | CHANGE_DIST, + 1.0, 15.0, 1.0 ); + break; + } + + return aImpl; +} + +// ----------------------------------------------------------------------- + +SvxBorderLine::SvxBorderLine( const SvxBorderLine& r ) +{ + *this = r; +} + +// ----------------------------------------------------------------------- + +SvxBorderLine& SvxBorderLine::operator=( const SvxBorderLine& r ) +{ + aColor = r.aColor; + m_nWidth = r.m_nWidth; + m_aWidthImpl = r.m_aWidthImpl; + m_bMirrorWidths = r.m_bMirrorWidths; + m_nMult = r.m_nMult; + m_nDiv = r.m_nDiv; + m_nStyle = r.m_nStyle; + m_bUseLeftTop = r.m_bUseLeftTop; + m_pColorOutFn = r.m_pColorOutFn; + m_pColorInFn = r.m_pColorInFn; + m_pColorGapFn = r.m_pColorGapFn; + return *this; +} + +// ----------------------------------------------------------------------- + +void SvxBorderLine::ScaleMetrics( long nMult, long nDiv ) +{ + m_nMult = nMult; + m_nDiv = nDiv; +} + +void SvxBorderLine::GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sal_uInt16 nIn, sal_uInt16 nDist ) +{ + if ( nStyle == NO_STYLE ) { + nStyle = SOLID; + if ( nOut > 0 && nIn > 0 ) + nStyle = DOUBLE; + } + + if ( nStyle == DOUBLE ) + { + static SvxBorderStyle aDoubleStyles[] = + { + DOUBLE, + THINTHICK_SMALLGAP, + THINTHICK_MEDIUMGAP, + THINTHICK_LARGEGAP, + THICKTHIN_SMALLGAP, + THICKTHIN_MEDIUMGAP, + THICKTHIN_LARGEGAP + }; + + + int i = 0, len = sizeof( aDoubleStyles ) / sizeof( SvxBorderStyle ); + long nWidth = 0; + SvxBorderStyle nTestStyle(NO_STYLE); + while ( i < len && nWidth == 0 ) + { + nTestStyle = aDoubleStyles[i]; + BorderWidthImpl aWidthImpl = getWidthImpl( nTestStyle ); + nWidth = aWidthImpl.GuessWidth( nOut, nIn, nDist ); + i++; + } + + // If anything matched, then set it + if ( nWidth > 0 ) + nStyle = nTestStyle; + + SetStyle( nStyle ); + m_nWidth = nWidth; + } + else + { + SetStyle( nStyle ); + m_nWidth = m_aWidthImpl.GuessWidth( nOut, nIn, nDist ); + } +} + +sal_uInt16 SvxBorderLine::GetOutWidth() const +{ + sal_uInt16 nOut = (sal_uInt16)Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ); + if ( m_bMirrorWidths ) + nOut = (sal_uInt16)Scale( m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ); + return nOut; +} + +sal_uInt16 SvxBorderLine::GetInWidth() const +{ + sal_uInt16 nIn = (sal_uInt16)Scale( m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ); + if ( m_bMirrorWidths ) + nIn = (sal_uInt16)Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ); + return nIn; +} + +sal_uInt16 SvxBorderLine::GetDistance() const +{ + return (sal_uInt16)Scale( m_aWidthImpl.GetGap( m_nWidth ), m_nMult, m_nDiv ); +} + +// ----------------------------------------------------------------------- + +sal_Bool SvxBorderLine::operator==( const SvxBorderLine& rCmp ) const +{ + return ( ( aColor == rCmp.aColor ) && + ( m_nWidth == rCmp.m_nWidth ) && + ( m_bMirrorWidths == rCmp.m_bMirrorWidths ) && + ( m_aWidthImpl == rCmp.m_aWidthImpl ) && + ( m_nStyle == rCmp.GetStyle() ) && + ( m_bUseLeftTop == rCmp.m_bUseLeftTop ) && + ( m_pColorOutFn == rCmp.m_pColorOutFn ) && + ( m_pColorInFn == rCmp.m_pColorInFn ) && + ( m_pColorGapFn == rCmp.m_pColorGapFn ) ); +} + +void SvxBorderLine::SetStyle( SvxBorderStyle nNew ) +{ + m_nStyle = nNew; + m_aWidthImpl = getWidthImpl( m_nStyle ); + + switch ( nNew ) + { + case EMBOSSED: + m_pColorOutFn = threeDLightColor; + m_pColorInFn = threeDDarkColor; + m_pColorGapFn = threeDMediumColor; + m_bUseLeftTop = true; + break; + case ENGRAVED: + m_pColorOutFn = threeDDarkColor; + m_pColorInFn = threeDLightColor; + m_pColorGapFn = threeDMediumColor; + m_bUseLeftTop = true; + break; + case OUTSET: + m_pColorOutFn = lightColor; + m_pColorInFn = darkColor; + m_bUseLeftTop = true; + m_pColorGapFn = NULL; + break; + case INSET: + m_pColorOutFn = darkColor; + m_pColorInFn = lightColor; + m_bUseLeftTop = true; + m_pColorGapFn = NULL; + break; + default: + m_pColorOutFn = darkColor; + m_pColorInFn = darkColor; + m_bUseLeftTop = false; + m_pColorGapFn = NULL; + break; + } +} + +Color SvxBorderLine::GetColorOut( bool bLeftOrTop ) const +{ + Color aResult = aColor; + + if ( m_aWidthImpl.IsDouble() && m_pColorOutFn != NULL ) + { + if ( !bLeftOrTop && m_bUseLeftTop ) + aResult = (*m_pColorInFn)( aColor ); + else + aResult = (*m_pColorOutFn)( aColor ); + } + + return aResult; +} + +Color SvxBorderLine::GetColorIn( bool bLeftOrTop ) const +{ + Color aResult = aColor; + + if ( m_aWidthImpl.IsDouble() && m_pColorInFn != NULL ) + { + if ( !bLeftOrTop && m_bUseLeftTop ) + aResult = (*m_pColorOutFn)( aColor ); + else + aResult = (*m_pColorInFn)( aColor ); + } + + return aResult; +} + +Color SvxBorderLine::GetColorGap( ) const +{ + Color aResult = aColor; + + if ( m_aWidthImpl.IsDouble() && m_pColorGapFn != NULL ) + { + aResult = (*m_pColorGapFn)( aColor ); + } + + return aResult; +} + +// ----------------------------------------------------------------------- + +XubString SvxBorderLine::GetValueString( SfxMapUnit eSrcUnit, + SfxMapUnit eDestUnit, + const IntlWrapper* pIntl, + sal_Bool bMetricStr) const +{ + static const sal_uInt16 aStyleIds[] = + { + RID_SOLID, + RID_DOTTED, + RID_DASHED, + RID_DOUBLE, + RID_THINTHICK_SMALLGAP, + RID_THINTHICK_MEDIUMGAP, + RID_THINTHICK_LARGEGAP, + RID_THICKTHIN_SMALLGAP, + RID_THICKTHIN_MEDIUMGAP, + RID_THICKTHIN_LARGEGAP, + RID_EMBOSSED, + RID_ENGRAVED, + RID_OUTSET, + RID_INSET + }; + sal_uInt16 nResId = aStyleIds[m_nStyle]; + String aStr; + aStr += sal_Unicode('('); + aStr += ::GetColorString( aColor ); + aStr += cpDelim; + + if ( nResId ) + aStr += EE_RESSTR(nResId); + else + { + String sMetric = EE_RESSTR(GetMetricId( eDestUnit )); + aStr += GetMetricText( (long)GetInWidth(), eSrcUnit, eDestUnit, pIntl ); + if ( bMetricStr ) + aStr += sMetric; + aStr += cpDelim; + aStr += GetMetricText( (long)GetOutWidth(), eSrcUnit, eDestUnit, pIntl ); + if ( bMetricStr ) + aStr += sMetric; + aStr += cpDelim; + aStr += GetMetricText( (long)GetDistance(), eSrcUnit, eDestUnit, pIntl ); + if ( bMetricStr ) + aStr += sMetric; + } + aStr += sal_Unicode(')'); + return aStr; +} + +bool SvxBorderLine::HasPriority( const SvxBorderLine& rOtherLine ) const +{ + const sal_uInt16 nThisSize = GetOutWidth() + GetDistance() + GetInWidth(); + const sal_uInt16 nOtherSize = rOtherLine.GetOutWidth() + rOtherLine.GetDistance() + rOtherLine.GetInWidth(); + + if (nThisSize > nOtherSize) + { + return true; + } + else if (nThisSize < nOtherSize) + { + return false; + } + else + { + if ( rOtherLine.GetInWidth() && !GetInWidth() ) + { + return true; + } + else if ( GetInWidth() && !rOtherLine.GetInWidth() ) + { + return false; + } + else + { + return false; + } + } +} + +} // namespace editeng + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx index f14d985ec4..b950714436 100644 --- a/editeng/source/items/bulitem.cxx +++ b/editeng/source/items/bulitem.cxx @@ -38,10 +38,9 @@ #include <editeng/bulitem.hxx> #include <editeng/editrids.hrc> -// #90477# #include <tools/tenccvt.hxx> -#define BULITEM_VERSION ((USHORT)2) +#define BULITEM_VERSION ((sal_uInt16)2) // ----------------------------------------------------------------------- @@ -51,21 +50,20 @@ TYPEINIT1(SvxBulletItem,SfxPoolItem); void SvxBulletItem::StoreFont( SvStream& rStream, const Font& rFont ) { - USHORT nTemp; + sal_uInt16 nTemp; rStream << rFont.GetColor(); - nTemp = (USHORT)rFont.GetFamily(); rStream << nTemp; + nTemp = (sal_uInt16)rFont.GetFamily(); rStream << nTemp; - // #90477# nTemp = (USHORT)GetStoreCharSet( rFont.GetCharSet(), rStream.GetVersion() ); - nTemp = (USHORT)GetSOStoreTextEncoding((rtl_TextEncoding)rFont.GetCharSet(), (sal_uInt16)rStream.GetVersion()); + nTemp = (sal_uInt16)GetSOStoreTextEncoding((rtl_TextEncoding)rFont.GetCharSet(), (sal_uInt16)rStream.GetVersion()); rStream << nTemp; - nTemp = (USHORT)rFont.GetPitch(); rStream << nTemp; - nTemp = (USHORT)rFont.GetAlign(); rStream << nTemp; - nTemp = (USHORT)rFont.GetWeight(); rStream << nTemp; - nTemp = (USHORT)rFont.GetUnderline(); rStream << nTemp; - nTemp = (USHORT)rFont.GetStrikeout(); rStream << nTemp; - nTemp = (USHORT)rFont.GetItalic(); rStream << nTemp; + nTemp = (sal_uInt16)rFont.GetPitch(); rStream << nTemp; + nTemp = (sal_uInt16)rFont.GetAlign(); rStream << nTemp; + nTemp = (sal_uInt16)rFont.GetWeight(); rStream << nTemp; + nTemp = (sal_uInt16)rFont.GetUnderline(); rStream << nTemp; + nTemp = (sal_uInt16)rFont.GetStrikeout(); rStream << nTemp; + nTemp = (sal_uInt16)rFont.GetItalic(); rStream << nTemp; // UNICODE: rStream << rFont.GetName(); rStream.WriteByteString(rFont.GetName()); @@ -77,15 +75,14 @@ void SvxBulletItem::StoreFont( SvStream& rStream, const Font& rFont ) // ----------------------------------------------------------------------- -Font SvxBulletItem::CreateFont( SvStream& rStream, USHORT nVer ) +Font SvxBulletItem::CreateFont( SvStream& rStream, sal_uInt16 nVer ) { Font aFont; Color aColor; rStream >> aColor; aFont.SetColor( aColor ); - USHORT nTemp; + sal_uInt16 nTemp; rStream >> nTemp; aFont.SetFamily((FontFamily)nTemp); - // #90477# rStream >> nTemp; nTemp = (sal_uInt16)GetSOLoadTextEncoding((rtl_TextEncoding)nTemp, (sal_uInt16)rStream.GetVersion()); aFont.SetCharSet((rtl_TextEncoding)nTemp); @@ -109,7 +106,7 @@ Font SvxBulletItem::CreateFont( SvStream& rStream, USHORT nVer ) aFont.SetSize( aSize ); } - BOOL bTemp; + sal_Bool bTemp; rStream >> bTemp; aFont.SetOutline( bTemp ); rStream >> bTemp; aFont.SetShadow( bTemp ); rStream >> bTemp; aFont.SetTransparent( bTemp ); @@ -119,7 +116,7 @@ Font SvxBulletItem::CreateFont( SvStream& rStream, USHORT nVer ) // ----------------------------------------------------------------------- -SvxBulletItem::SvxBulletItem( USHORT _nWhich ) : SfxPoolItem( _nWhich ) +SvxBulletItem::SvxBulletItem( sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich ) { SetDefaultFont_Impl(); SetDefaults_Impl(); @@ -128,7 +125,7 @@ SvxBulletItem::SvxBulletItem( USHORT _nWhich ) : SfxPoolItem( _nWhich ) // ----------------------------------------------------------------------- -SvxBulletItem::SvxBulletItem( BYTE nNewStyle, const Font& rFont, USHORT /*nStart*/, USHORT _nWhich ) : SfxPoolItem( _nWhich ) +SvxBulletItem::SvxBulletItem( sal_uInt8 nNewStyle, const Font& rFont, sal_uInt16 /*nStart*/, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich ) { SetDefaults_Impl(); nStyle = nNewStyle; @@ -138,7 +135,7 @@ SvxBulletItem::SvxBulletItem( BYTE nNewStyle, const Font& rFont, USHORT /*nStart // ----------------------------------------------------------------------- -SvxBulletItem::SvxBulletItem( const Font& rFont, xub_Unicode cSymb, USHORT _nWhich ) : SfxPoolItem( _nWhich ) +SvxBulletItem::SvxBulletItem( const Font& rFont, xub_Unicode cSymb, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich ) { SetDefaults_Impl(); aFont = rFont; @@ -149,7 +146,7 @@ SvxBulletItem::SvxBulletItem( const Font& rFont, xub_Unicode cSymb, USHORT _nWhi // ----------------------------------------------------------------------- -SvxBulletItem::SvxBulletItem( const Bitmap& rBmp, USHORT _nWhich ) : SfxPoolItem( _nWhich ) +SvxBulletItem::SvxBulletItem( const Bitmap& rBmp, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich ) { SetDefaults_Impl(); @@ -164,7 +161,7 @@ SvxBulletItem::SvxBulletItem( const Bitmap& rBmp, USHORT _nWhich ) : SfxPoolItem // ----------------------------------------------------------------------- -SvxBulletItem::SvxBulletItem( const GraphicObject& rGraphicObject, USHORT _nWhich ) : SfxPoolItem( _nWhich ) +SvxBulletItem::SvxBulletItem( const GraphicObject& rGraphicObject, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich ) { SetDefaults_Impl(); @@ -179,7 +176,7 @@ SvxBulletItem::SvxBulletItem( const GraphicObject& rGraphicObject, USHORT _nWhic // ----------------------------------------------------------------------- -SvxBulletItem::SvxBulletItem( SvStream& rStrm, USHORT _nWhich ) : +SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich ), pGraphicObject( NULL ) { @@ -189,18 +186,16 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, USHORT _nWhich ) : aFont = CreateFont( rStrm, BULITEM_VERSION ); else { - // Sicheres Laden mit Test auf leere Bitmap + // Safe Load with Test on empty Bitmap Bitmap aBmp; - const UINT32 nOldPos = rStrm.Tell(); - // #69345# Errorcode beim Bitmap lesen ignorieren, - // siehe Kommentar #67581# in SvxBulletItem::Store() - BOOL bOldError = rStrm.GetError() ? TRUE : FALSE; + const sal_uInt32 nOldPos = rStrm.Tell(); + // Ignore Errorcode when reading Bitmap, + // see comment in SvxBulletItem::Store() + sal_Bool bOldError = rStrm.GetError() ? sal_True : sal_False; rStrm >> aBmp; if ( !bOldError && rStrm.GetError() ) { rStrm.ResetError(); - // #71493# Keine Warnung: Das BulletItem interessiert seit 5.0 im Dateiformat nicht mehr. - // rStrm.SetError(ERRCODE_CLASS_READ | ERRCODE_SVX_BULLETITEM_NOBULLET | ERRCODE_WARNING_MASK); } if( aBmp.IsEmpty() ) @@ -265,7 +260,7 @@ SfxPoolItem* SvxBulletItem::Clone( SfxItemPool * /*pPool*/ ) const // ----------------------------------------------------------------------- -SfxPoolItem* SvxBulletItem::Create( SvStream& rStrm, USHORT /*nVersion*/ ) const +SfxPoolItem* SvxBulletItem::Create( SvStream& rStrm, sal_uInt16 /*nVersion*/ ) const { return new SvxBulletItem( rStrm, Which() ); } @@ -276,7 +271,7 @@ void SvxBulletItem::SetDefaultFont_Impl() { aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, LANGUAGE_SYSTEM, 0 ); aFont.SetAlign( ALIGN_BOTTOM); - aFont.SetTransparent( TRUE ); + aFont.SetTransparent( sal_True ); } // ----------------------------------------------------------------------- @@ -294,7 +289,7 @@ void SvxBulletItem::SetDefaults_Impl() // ----------------------------------------------------------------------- -USHORT SvxBulletItem::GetVersion( USHORT /*nVersion*/ ) const +sal_uInt16 SvxBulletItem::GetVersion( sal_uInt16 /*nVersion*/ ) const { return BULITEM_VERSION; } @@ -338,8 +333,8 @@ int SvxBulletItem::operator==( const SfxPoolItem& rItem ) const { DBG_ASSERT(rItem.ISA(SvxBulletItem),"operator==Types not matching"); const SvxBulletItem& rBullet = (const SvxBulletItem&)rItem; - // ValidMask mitvergleichen, da sonst kein Putten in ein AttrSet moeglich, - // wenn sich das Item nur in der ValidMask von einem existierenden unterscheidet. + // Compare with ValidMask, otherwise no put possible in a AttrSet if the + // item differs only in terms of the ValidMask from an existing one. if( nValidMask != rBullet.nValidMask || nStyle != rBullet.nStyle || nScale != rBullet.nScale || @@ -372,9 +367,9 @@ int SvxBulletItem::operator==( const SfxPoolItem& rItem ) const // ----------------------------------------------------------------------- -SvStream& SvxBulletItem::Store( SvStream& rStrm, USHORT /*nItemVersion*/ ) const +SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const { - // Korrektur bei leerer Bitmap + // Correction for empty bitmap if( ( nStyle == BS_BMP ) && ( !pGraphicObject || ( GRAPHIC_NONE == pGraphicObject->GetType() ) || ( GRAPHIC_DEFAULT == pGraphicObject->GetType() ) ) ) { @@ -393,25 +388,24 @@ SvStream& SvxBulletItem::Store( SvStream& rStrm, USHORT /*nItemVersion*/ ) const StoreFont( rStrm, aFont ); else { - ULONG _nStart = rStrm.Tell(); + sal_uLong _nStart = rStrm.Tell(); - // Kleine Vorab-Schaetzung der Groesse... - USHORT nFac = ( rStrm.GetCompressMode() != COMPRESSMODE_NONE ) ? 3 : 1; + // Small preliminary estimate of the size ... + sal_uInt16 nFac = ( rStrm.GetCompressMode() != COMPRESSMODE_NONE ) ? 3 : 1; const Bitmap aBmp( pGraphicObject->GetGraphic().GetBitmap() ); - ULONG nBytes = aBmp.GetSizeBytes(); - if ( nBytes < ULONG(0xFF00*nFac) ) + sal_uLong nBytes = aBmp.GetSizeBytes(); + if ( nBytes < sal_uLong(0xFF00*nFac) ) rStrm << aBmp; - ULONG nEnd = rStrm.Tell(); - // #67581# Item darf mit Overhead nicht mehr als 64K schreiben, - // sonst platzt der SfxMultiRecord - // Dann lieber auf die Bitmap verzichten, ist nur fuer Outliner - // und auch nur fuer <= 5.0 wichtig. - // Beim Einlesen merkt der Stream-Operator der Bitmap, dass dort keine steht. - // Hiermit funktioniert jetzt der Fall das die grosse Bitmap aus einem anderen - // Fileformat entstanden ist, welches keine 64K belegt, aber wenn eine - // Bitmap > 64K verwendet wird, hat das SvxNumBulletItem beim Laden ein Problem, - // stuerzt aber nicht ab. + sal_uLong nEnd = rStrm.Tell(); + // Item can not write with an overhead more than 64K or SfxMultiRecord + // will crash. Then prefer to forego on the bitmap, it is only + // important for the outliner and only for <= 5.0. + // When reading, the stream-operator makes note of the bitmap and the + // fact that there is none. This is now the case how it works with + // large bitmap created from another file format, which do not occupy a + // 64K chunk, but if a bitmap > 64K is used, the SvxNumBulletItem will + // have problem loading it, but does not crash. if ( (nEnd-_nStart) > 0xFF00 ) rStrm.Seek( _nStart ); diff --git a/editeng/source/items/charhiddenitem.cxx b/editeng/source/items/charhiddenitem.cxx index e504eaabad..dad17e9c01 100644 --- a/editeng/source/items/charhiddenitem.cxx +++ b/editeng/source/items/charhiddenitem.cxx @@ -36,23 +36,16 @@ TYPEINIT1_FACTORY(SvxCharHiddenItem, SfxBoolItem, new SvxCharHiddenItem(sal_False, 0)); -/*-- 16.12.2003 15:24:25--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SvxCharHiddenItem::SvxCharHiddenItem( const sal_Bool bHidden, const USHORT nId ) : +SvxCharHiddenItem::SvxCharHiddenItem( const sal_Bool bHidden, const sal_uInt16 nId ) : SfxBoolItem( nId, bHidden ) { } -/*-- 16.12.2003 15:24:25--------------------------------------------------- - -----------------------------------------------------------------------*/ SfxPoolItem* SvxCharHiddenItem::Clone( SfxItemPool * ) const { return new SvxCharHiddenItem( *this ); } -/*-- 16.12.2003 15:24:25--------------------------------------------------- - -----------------------------------------------------------------------*/ SfxItemPresentation SvxCharHiddenItem::GetPresentation ( SfxItemPresentation ePres, @@ -69,7 +62,7 @@ SfxItemPresentation SvxCharHiddenItem::GetPresentation case SFX_ITEM_PRESENTATION_NAMELESS: case SFX_ITEM_PRESENTATION_COMPLETE: { - USHORT nId = RID_SVXITEMS_CHARHIDDEN_FALSE; + sal_uInt16 nId = RID_SVXITEMS_CHARHIDDEN_FALSE; if ( GetValue() ) nId = RID_SVXITEMS_CHARHIDDEN_TRUE; diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index ce4ce58f3f..d72f955ba2 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -39,7 +39,6 @@ #include <editeng/measfld.hxx> -// #90477# #include <tools/tenccvt.hxx> #define FRAME_MARKER (sal_uInt32)0x21981357 @@ -74,9 +73,9 @@ SvxFieldData* SvxFieldData::Clone() const int SvxFieldData::operator==( const SvxFieldData& rFld ) const { - DBG_ASSERT( Type() == rFld.Type(), "==: Verschiedene Typen" ); + DBG_ASSERT( Type() == rFld.Type(), "==: Different Types" ); (void)rFld; - return TRUE; // Basicklasse immer gleich. + return sal_True; // Basic class is always the same. } // ----------------------------------------------------------------------- @@ -104,15 +103,15 @@ MetaAction* SvxFieldData::createEndComment() const // ----------------------------------------------------------------------- -SvxFieldItem::SvxFieldItem( SvxFieldData* pFld, const USHORT nId ) : +SvxFieldItem::SvxFieldItem( SvxFieldData* pFld, const sal_uInt16 nId ) : SfxPoolItem( nId ) { - pField = pFld; // gehoert direkt dem Item + pField = pFld; // belongs directly to the item } // ----------------------------------------------------------------------- -SvxFieldItem::SvxFieldItem( const SvxFieldData& rField, const USHORT nId ) : +SvxFieldItem::SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId ) : SfxPoolItem( nId ) { pField = rField.Clone(); @@ -142,7 +141,7 @@ SfxPoolItem* SvxFieldItem::Clone( SfxItemPool* ) const // ----------------------------------------------------------------------- -SfxPoolItem* SvxFieldItem::Create( SvStream& rStrm, USHORT ) const +SfxPoolItem* SvxFieldItem::Create( SvStream& rStrm, sal_uInt16 ) const { SvxFieldData* pData = 0; SvPersistStream aPStrm( GetClassManager(), &rStrm ); @@ -152,23 +151,23 @@ SfxPoolItem* SvxFieldItem::Create( SvStream& rStrm, USHORT ) const aPStrm.SetError( SVSTREAM_GENERALERROR ); if ( aPStrm.GetError() == ERRCODE_IO_NOFACTORY ) - aPStrm.ResetError(); // Eigentlich einen Code, dass nicht alle Attr gelesen wurden... + aPStrm.ResetError(); // Actually a code for that not all were read Attr ... return new SvxFieldItem( pData, Which() ); } // ----------------------------------------------------------------------- -SvStream& SvxFieldItem::Store( SvStream& rStrm, USHORT /*nItemVersion*/ ) const +SvStream& SvxFieldItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const { - DBG_ASSERT( pField, "SvxFieldItem::Store: Feld?!" ); + DBG_ASSERT( pField, "SvxFieldItem::Store: Field?!" ); SvPersistStream aPStrm( GetClassManager(), &rStrm ); - // Das ResetError in der obigen Create-Methode gab es in 3.1 noch nicht, - // deshalb duerfen beim 3.x-Export neuere Items nicht gespeichert werden! + // The reset error in the above Create method did not exist in 3.1, + // therefore newer items can not be saved for 3.x-exports! if ( ( rStrm.GetVersion() <= SOFFICE_FILEFORMAT_31 ) && pField && pField->GetClassId() == 50 /* SdrMeasureField */ ) { - // SvxFieldData reicht nicht, weil auch nicht am ClassMgr angemeldet + // SvxFieldData not enough, because not registered on ClassMgr. SvxURLField aDummyData; aPStrm << &aDummyData; } @@ -186,17 +185,17 @@ int SvxFieldItem::operator==( const SfxPoolItem& rItem ) const const SvxFieldData* pOtherFld = ((const SvxFieldItem&)rItem).GetField(); if ( !pField && !pOtherFld ) - return TRUE; + return sal_True; if ( ( !pField && pOtherFld ) || ( pField && !pOtherFld ) ) - return FALSE; + return sal_False; return ( ( pField->Type() == pOtherFld->Type() ) && ( *pField == *pOtherFld ) ); } // ================================================================= -// Es folgen die Ableitungen von SvxFieldData... +// The following are the derivatives of SvxFieldData ... // ================================================================= SV_IMPL_PERSIST1( SvxDateField, SvxFieldData ); @@ -231,7 +230,7 @@ SvxFieldData* SvxDateField::Clone() const int SvxDateField::operator==( const SvxFieldData& rOther ) const { if ( rOther.Type() != Type() ) - return FALSE; + return sal_False; const SvxDateField& rOtherFld = (const SvxDateField&) rOther; return ( ( nFixDate == rOtherFld.nFixDate ) && @@ -243,7 +242,7 @@ int SvxDateField::operator==( const SvxFieldData& rOther ) const void SvxDateField::Load( SvPersistStream & rStm ) { - USHORT nType, nFormat; + sal_uInt16 nType, nFormat; rStm >> nFixDate; rStm >> nType; @@ -258,8 +257,8 @@ void SvxDateField::Load( SvPersistStream & rStm ) void SvxDateField::Save( SvPersistStream & rStm ) { rStm << nFixDate; - rStm << (USHORT)eType; - rStm << (USHORT)eFormat; + rStm << (sal_uInt16)eType; + rStm << (sal_uInt16)eFormat; } // ----------------------------------------------------------------------- @@ -277,16 +276,16 @@ String SvxDateField::GetFormatted( Date& aDate, SvxDateFormat eFormat, SvNumberF { if ( eFormat == SVXDATEFORMAT_SYSTEM ) { - DBG_ERROR( "SVXDATEFORMAT_SYSTEM nicht implementiert!" ); + OSL_FAIL( "SVXDATEFORMAT_SYSTEM not implemented!" ); eFormat = SVXDATEFORMAT_STDSMALL; } else if ( eFormat == SVXDATEFORMAT_APPDEFAULT ) { - DBG_ERROR( "SVXDATEFORMAT_APPDEFAULT: Woher nehmen?" ); + OSL_FAIL( "SVXDATEFORMAT_APPDEFAULT: take them from where? "); eFormat = SVXDATEFORMAT_STDSMALL; } - ULONG nFormatKey; + sal_uLong nFormatKey; switch( eFormat ) { @@ -311,15 +310,15 @@ String SvxDateField::GetFormatted( Date& aDate, SvxDateFormat eFormat, SvNumberF nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_DMMMYYYY, eLang ); break; case SVXDATEFORMAT_D: - // 13. Februar 1996 + // 13. February 1996 nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_DMMMMYYYY, eLang ); break; case SVXDATEFORMAT_E: - // Die, 13. Februar 1996 + // The, 13. February 1996 nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_NNDMMMMYYYY, eLang ); break; case SVXDATEFORMAT_F: - // Dienstag, 13. Februar 1996 + // Tuesday, 13. February 1996 nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_NNNNDMMMMYYYY, eLang ); break; default: @@ -367,7 +366,7 @@ SvxFieldData* SvxURLField::Clone() const int SvxURLField::operator==( const SvxFieldData& rOther ) const { if ( rOther.Type() != Type() ) - return FALSE; + return sal_False; const SvxURLField& rOtherFld = (const SvxURLField&) rOther; return ( ( eFormat == rOtherFld.eFormat ) && @@ -378,83 +377,46 @@ int SvxURLField::operator==( const SvxFieldData& rOther ) const // ----------------------------------------------------------------------- -void SvxURLField::Load( SvPersistStream & rStm ) +static void write_unicode( SvPersistStream & rStm, const String& rString ) { - USHORT nFormat; - sal_uInt32 nFrameMarker, nCharSetMarker; - long nUlongSize = (long)sizeof(sal_uInt32); - String aTmpURL; - - rStm >> nFormat; - - // UNICODE: rStm >> aTmpURL; - rStm.ReadByteString(aTmpURL); - - // UNICODE: rStm >> aRepresentation; - // read to a temp string first, read text encoding and - // convert later to stay compatible to fileformat - ByteString aTempString; - rtl_TextEncoding aTempEncoding = RTL_TEXTENCODING_MS_1252; // #101493# Init for old documents - rStm.ReadByteString(aTempString); + sal_uInt16 nL = rString.Len(); + rStm << nL; + rStm.Write( rString.GetBuffer(), nL*sizeof(sal_Unicode) ); +} - rStm >> nFrameMarker; - if ( nFrameMarker == FRAME_MARKER ) +static void read_unicode( SvPersistStream & rStm, String& rString ) +{ + sal_uInt16 nL = 0; + rStm >> nL; + if ( nL ) { - // UNICODE: rStm >> aTargetFrame; - rStm.ReadByteString(aTargetFrame); - - rStm >> nCharSetMarker; - if ( nCharSetMarker == CHARSET_MARKER ) - { - USHORT nCharSet; - rStm >> nCharSet; - - // remember encoding - aTempEncoding = (rtl_TextEncoding)nCharSet; - } - else - rStm.SeekRel( -nUlongSize ); + rString.AllocBuffer( nL ); + rStm.Read( rString.GetBufferAccess(), nL*sizeof(sal_Unicode) ); + rString.ReleaseBufferAccess( nL ); } - else - rStm.SeekRel( -nUlongSize ); +} - // now build representation string due to known encoding - aRepresentation = String(aTempString, aTempEncoding); +void SvxURLField::Load( SvPersistStream & rStm ) +{ + sal_uInt16 nFormat = 0; + rStm >> nFormat; eFormat= (SvxURLFormat)nFormat; - // Relatives Speichern => Beim laden absolut machen. - DBG_ERROR("No BaseURL!"); - // TODO/MBA: no BaseURL - aURL = INetURLObject::GetAbsURL( String(), aTmpURL ); + read_unicode( rStm, aURL ); + read_unicode( rStm, aRepresentation ); + read_unicode( rStm, aTargetFrame ); } // ----------------------------------------------------------------------- void SvxURLField::Save( SvPersistStream & rStm ) { - // Relatives Speichern der URL - DBG_ERROR("No BaseURL!"); - // TODO/MBA: no BaseURL - String aTmpURL = INetURLObject::GetRelURL( String(), aURL ); - - rStm << (USHORT)eFormat; - - // UNICODE: rStm << aTmpURL; - rStm.WriteByteString(aTmpURL); - - // UNICODE: rStm << aRepresentation; - rStm.WriteByteString(aRepresentation); - - rStm << FRAME_MARKER; + rStm << (sal_uInt16)eFormat; - // UNICODE: rStm << aTargetFrame; - rStm.WriteByteString(aTargetFrame); - - rStm << CHARSET_MARKER; - - // #90477# rStm << (USHORT)GetStoreCharSet(gsl_getSystemTextEncoding(), rStm.GetVersion()); - rStm << (USHORT)GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rStm.GetVersion()); + write_unicode( rStm, aURL ); + write_unicode( rStm, aRepresentation ); + write_unicode( rStm, aTargetFrame ); } MetaAction* SvxURLField::createBeginComment() const @@ -462,31 +424,31 @@ MetaAction* SvxURLField::createBeginComment() const // #i46618# Adding target URL to metafile comment return new MetaCommentAction( "FIELD_SEQ_BEGIN", 0, - reinterpret_cast<const BYTE*>(aURL.GetBuffer()), + reinterpret_cast<const sal_uInt8*>(aURL.GetBuffer()), 2*aURL.Len() ); } // ================================================================= -// Die Felder, die aus Calc ausgebaut wurden: +// The fields that were removed from Calc: // ================================================================= SV_IMPL_PERSIST1( SvxPageField, SvxFieldData ); -SvxFieldData* __EXPORT SvxPageField::Clone() const +SvxFieldData* SvxPageField::Clone() const { - return new SvxPageField; // leer + return new SvxPageField; // empty } -int __EXPORT SvxPageField::operator==( const SvxFieldData& rCmp ) const +int SvxPageField::operator==( const SvxFieldData& rCmp ) const { return ( rCmp.Type() == TYPE(SvxPageField) ); } -void __EXPORT SvxPageField::Load( SvPersistStream & /*rStm*/ ) +void SvxPageField::Load( SvPersistStream & /*rStm*/ ) { } -void __EXPORT SvxPageField::Save( SvPersistStream & /*rStm*/ ) +void SvxPageField::Save( SvPersistStream & /*rStm*/ ) { } @@ -498,41 +460,41 @@ MetaAction* SvxPageField::createBeginComment() const SV_IMPL_PERSIST1( SvxPagesField, SvxFieldData ); -SvxFieldData* __EXPORT SvxPagesField::Clone() const +SvxFieldData* SvxPagesField::Clone() const { - return new SvxPagesField; // leer + return new SvxPagesField; // empty } -int __EXPORT SvxPagesField::operator==( const SvxFieldData& rCmp ) const +int SvxPagesField::operator==( const SvxFieldData& rCmp ) const { return ( rCmp.Type() == TYPE(SvxPagesField) ); } -void __EXPORT SvxPagesField::Load( SvPersistStream & /*rStm*/ ) +void SvxPagesField::Load( SvPersistStream & /*rStm*/ ) { } -void __EXPORT SvxPagesField::Save( SvPersistStream & /*rStm*/ ) +void SvxPagesField::Save( SvPersistStream & /*rStm*/ ) { } SV_IMPL_PERSIST1( SvxTimeField, SvxFieldData ); -SvxFieldData* __EXPORT SvxTimeField::Clone() const +SvxFieldData* SvxTimeField::Clone() const { - return new SvxTimeField; // leer + return new SvxTimeField; // empty } -int __EXPORT SvxTimeField::operator==( const SvxFieldData& rCmp ) const +int SvxTimeField::operator==( const SvxFieldData& rCmp ) const { return ( rCmp.Type() == TYPE(SvxTimeField) ); } -void __EXPORT SvxTimeField::Load( SvPersistStream & /*rStm*/ ) +void SvxTimeField::Load( SvPersistStream & /*rStm*/ ) { } -void __EXPORT SvxTimeField::Save( SvPersistStream & /*rStm*/ ) +void SvxTimeField::Save( SvPersistStream & /*rStm*/ ) { } @@ -543,41 +505,41 @@ MetaAction* SvxTimeField::createBeginComment() const SV_IMPL_PERSIST1( SvxFileField, SvxFieldData ); -SvxFieldData* __EXPORT SvxFileField::Clone() const +SvxFieldData* SvxFileField::Clone() const { - return new SvxFileField; // leer + return new SvxFileField; // empty } -int __EXPORT SvxFileField::operator==( const SvxFieldData& rCmp ) const +int SvxFileField::operator==( const SvxFieldData& rCmp ) const { return ( rCmp.Type() == TYPE(SvxFileField) ); } -void __EXPORT SvxFileField::Load( SvPersistStream & /*rStm*/ ) +void SvxFileField::Load( SvPersistStream & /*rStm*/ ) { } -void __EXPORT SvxFileField::Save( SvPersistStream & /*rStm*/ ) +void SvxFileField::Save( SvPersistStream & /*rStm*/ ) { } SV_IMPL_PERSIST1( SvxTableField, SvxFieldData ); -SvxFieldData* __EXPORT SvxTableField::Clone() const +SvxFieldData* SvxTableField::Clone() const { - return new SvxTableField; // leer + return new SvxTableField; // empty } -int __EXPORT SvxTableField::operator==( const SvxFieldData& rCmp ) const +int SvxTableField::operator==( const SvxFieldData& rCmp ) const { return ( rCmp.Type() == TYPE(SvxTableField) ); } -void __EXPORT SvxTableField::Load( SvPersistStream & /*rStm*/ ) +void SvxTableField::Load( SvPersistStream & /*rStm*/ ) { } -void __EXPORT SvxTableField::Save( SvPersistStream & /*rStm*/ ) +void SvxTableField::Save( SvPersistStream & /*rStm*/ ) { } @@ -617,7 +579,7 @@ SvxFieldData* SvxExtTimeField::Clone() const int SvxExtTimeField::operator==( const SvxFieldData& rOther ) const { if ( rOther.Type() != Type() ) - return FALSE; + return sal_False; const SvxExtTimeField& rOtherFld = (const SvxExtTimeField&) rOther; return ( ( nFixTime == rOtherFld.nFixTime ) && @@ -629,7 +591,7 @@ int SvxExtTimeField::operator==( const SvxFieldData& rOther ) const void SvxExtTimeField::Load( SvPersistStream & rStm ) { - USHORT nType, nFormat; + sal_uInt16 nType, nFormat; rStm >> nFixTime; rStm >> nType; @@ -644,8 +606,8 @@ void SvxExtTimeField::Load( SvPersistStream & rStm ) void SvxExtTimeField::Save( SvPersistStream & rStm ) { rStm << nFixTime; - rStm << (USHORT) eType; - rStm << (USHORT) eFormat; + rStm << (sal_uInt16) eType; + rStm << (sal_uInt16) eFormat; } //---------------------------------------------------------------------------- @@ -663,11 +625,11 @@ String SvxExtTimeField::GetFormatted( Time& aTime, SvxTimeFormat eFormat, SvNumb switch( eFormat ) { case SVXTIMEFORMAT_SYSTEM : - DBG_ERROR( "SVXTIMEFORMAT_SYSTEM: not implemented" ); + OSL_FAIL( "SVXTIMEFORMAT_SYSTEM: not implemented" ); eFormat = SVXTIMEFORMAT_STANDARD; break; case SVXTIMEFORMAT_APPDEFAULT : - DBG_ERROR( "SVXTIMEFORMAT_APPDEFAULT: not implemented" ); + OSL_FAIL( "SVXTIMEFORMAT_APPDEFAULT: not implemented" ); eFormat = SVXTIMEFORMAT_STANDARD; break; default: ;//prevent warning @@ -685,7 +647,7 @@ String SvxExtTimeField::GetFormatted( Time& aTime, SvxTimeFormat eFormat, SvNumb String aFormatCode( RTL_CONSTASCII_USTRINGPARAM( "HH:MM:SS.00 AM/PM" ) ); xub_StrLen nCheckPos; short nType; - /*BOOL bInserted = */rFormatter.PutandConvertEntry( aFormatCode, + /*sal_Bool bInserted = */rFormatter.PutandConvertEntry( aFormatCode, nCheckPos, nType, nFormatKey, LANGUAGE_ENGLISH_US, eLang ); DBG_ASSERT( nCheckPos == 0, "SVXTIMEFORMAT_12_HMSH: could not insert format code" ); if ( nCheckPos ) @@ -756,7 +718,7 @@ SvxFieldData* SvxExtFileField::Clone() const int SvxExtFileField::operator==( const SvxFieldData& rOther ) const { if ( rOther.Type() != Type() ) - return FALSE; + return sal_False; const SvxExtFileField& rOtherFld = (const SvxExtFileField&) rOther; return ( ( aFile == rOtherFld.aFile ) && @@ -768,7 +730,7 @@ int SvxExtFileField::operator==( const SvxFieldData& rOther ) const void SvxExtFileField::Load( SvPersistStream & rStm ) { - USHORT nType, nFormat; + sal_uInt16 nType, nFormat; // UNICODE: rStm >> aFile; rStm.ReadByteString(aFile); @@ -787,8 +749,8 @@ void SvxExtFileField::Save( SvPersistStream & rStm ) // UNICODE: rStm << aFile; rStm.WriteByteString(aFile); - rStm << (USHORT) eType; - rStm << (USHORT) eFormat; + rStm << (sal_uInt16) eType; + rStm << (sal_uInt16) eFormat; } //---------------------------------------------------------------------------- @@ -908,7 +870,7 @@ SvxFieldData* SvxAuthorField::Clone() const int SvxAuthorField::operator==( const SvxFieldData& rOther ) const { if ( rOther.Type() != Type() ) - return FALSE; + return sal_False; const SvxAuthorField& rOtherFld = (const SvxAuthorField&) rOther; return ( ( aName == rOtherFld.aName ) && @@ -922,16 +884,11 @@ int SvxAuthorField::operator==( const SvxFieldData& rOther ) const void SvxAuthorField::Load( SvPersistStream & rStm ) { - USHORT nType, nFormat; - - // UNICODE: rStm >> aName; - rStm.ReadByteString(aName); + sal_uInt16 nType = 0, nFormat = 0; - // UNICODE: rStm >> aFirstName; - rStm.ReadByteString(aFirstName); - - // UNICODE: rStm >> aShortName; - rStm.ReadByteString(aShortName); + read_unicode( rStm, aName ); + read_unicode( rStm, aFirstName ); + read_unicode( rStm, aShortName ); rStm >> nType; rStm >> nFormat; @@ -944,17 +901,12 @@ void SvxAuthorField::Load( SvPersistStream & rStm ) void SvxAuthorField::Save( SvPersistStream & rStm ) { - // UNICODE: rStm << aName; - rStm.WriteByteString(aName); - - // UNICODE: rStm << aFirstName; - rStm.WriteByteString(aFirstName); - - // UNICODE: rStm << aShortName; - rStm.WriteByteString(aShortName); + write_unicode( rStm, aName ); + write_unicode( rStm, aFirstName ); + write_unicode( rStm, aShortName ); - rStm << (USHORT) eType; - rStm << (USHORT) eFormat; + rStm << (sal_uInt16) eType; + rStm << (sal_uInt16) eFormat; } //---------------------------------------------------------------------------- @@ -1011,21 +963,21 @@ SvClassManager& SvxFieldItem::GetClassManager() SV_IMPL_PERSIST1( SvxHeaderField, SvxFieldData ); -SvxFieldData* __EXPORT SvxHeaderField::Clone() const +SvxFieldData* SvxHeaderField::Clone() const { - return new SvxHeaderField; // leer + return new SvxHeaderField; // empty } -int __EXPORT SvxHeaderField::operator==( const SvxFieldData& rCmp ) const +int SvxHeaderField::operator==( const SvxFieldData& rCmp ) const { return ( rCmp.Type() == TYPE(SvxHeaderField) ); } -void __EXPORT SvxHeaderField::Load( SvPersistStream & /*rStm*/ ) +void SvxHeaderField::Load( SvPersistStream & /*rStm*/ ) { } -void __EXPORT SvxHeaderField::Save( SvPersistStream & /*rStm*/ ) +void SvxHeaderField::Save( SvPersistStream & /*rStm*/ ) { } @@ -1033,21 +985,21 @@ void __EXPORT SvxHeaderField::Save( SvPersistStream & /*rStm*/ ) SV_IMPL_PERSIST1( SvxFooterField, SvxFieldData ); -SvxFieldData* __EXPORT SvxFooterField::Clone() const +SvxFieldData* SvxFooterField::Clone() const { - return new SvxFooterField; // leer + return new SvxFooterField; // empty } -int __EXPORT SvxFooterField::operator==( const SvxFieldData& rCmp ) const +int SvxFooterField::operator==( const SvxFieldData& rCmp ) const { return ( rCmp.Type() == TYPE(SvxFooterField) ); } -void __EXPORT SvxFooterField::Load( SvPersistStream & /*rStm*/ ) +void SvxFooterField::Load( SvPersistStream & /*rStm*/ ) { } -void __EXPORT SvxFooterField::Save( SvPersistStream & /*rStm*/ ) +void SvxFooterField::Save( SvPersistStream & /*rStm*/ ) { } @@ -1055,21 +1007,21 @@ void __EXPORT SvxFooterField::Save( SvPersistStream & /*rStm*/ ) SV_IMPL_PERSIST1( SvxDateTimeField, SvxFieldData ); -SvxFieldData* __EXPORT SvxDateTimeField::Clone() const +SvxFieldData* SvxDateTimeField::Clone() const { - return new SvxDateTimeField; // leer + return new SvxDateTimeField; // empty } -int __EXPORT SvxDateTimeField::operator==( const SvxFieldData& rCmp ) const +int SvxDateTimeField::operator==( const SvxFieldData& rCmp ) const { return ( rCmp.Type() == TYPE(SvxDateTimeField) ); } -void __EXPORT SvxDateTimeField::Load( SvPersistStream & /*rStm*/ ) +void SvxDateTimeField::Load( SvPersistStream & /*rStm*/ ) { } -void __EXPORT SvxDateTimeField::Save( SvPersistStream & /*rStm*/ ) +void SvxDateTimeField::Save( SvPersistStream & /*rStm*/ ) { } diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index ce0f053e96..9a519fb2e1 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -63,6 +63,7 @@ #include <svl/memberid.hrc> #include <svtools/wallitem.hxx> #include <svl/cntwall.hxx> +#include <svtools/borderhelper.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> #include <svtools/filter.hxx> @@ -93,11 +94,12 @@ #include <editeng/memberids.hrc> #include <editeng/editerr.hxx> +using namespace ::editeng; using namespace ::rtl; using namespace ::com::sun::star; -// Konvertierung fuer UNO +// Conversion for UNO #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) #define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L)) @@ -105,7 +107,6 @@ using namespace ::com::sun::star; // STATIC DATA ----------------------------------------------------------- - inline void SetValueProp( XubString& rStr, const sal_uInt16 nValue, const sal_uInt16 nProp ) { @@ -142,7 +143,6 @@ TYPEINIT1_FACTORY(SvxFmtKeepItem, SfxBoolItem, new SvxFmtKeepItem(sal_False, 0)) TYPEINIT1_FACTORY(SvxLineItem, SfxPoolItem, new SvxLineItem(0)); TYPEINIT1_FACTORY(SvxFrameDirectionItem, SfxUInt16Item, new SvxFrameDirectionItem(FRMDIR_HORI_LEFT_TOP, 0)); - // class SvxPaperBinItem ------------------------------------------------ SfxPoolItem* SvxPaperBinItem::Clone( SfxItemPool* ) const @@ -189,7 +189,7 @@ SfxItemPresentation SvxPaperBinItem::GetPresentation case SFX_ITEM_PRESENTATION_COMPLETE: { - BYTE nValue = GetValue(); + sal_uInt8 nValue = GetValue(); if ( PAPERBIN_PRINTER_SETTINGS == nValue ) rText = EE_RESSTR(RID_SVXSTR_PAPERBIN_SETTINGS); @@ -219,7 +219,7 @@ SvxSizeItem::SvxSizeItem( const sal_uInt16 nId, const Size& rSize ) : } // ----------------------------------------------------------------------- -bool SvxSizeItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxSizeItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -236,13 +236,13 @@ bool SvxSizeItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const case MID_SIZE_SIZE: rVal <<= aTmp; break; case MID_SIZE_WIDTH: rVal <<= aTmp.Width; break; case MID_SIZE_HEIGHT: rVal <<= aTmp.Height; break; - default: DBG_ERROR("Wrong MemberId!"); return false; + default: OSL_FAIL("Wrong MemberId!"); return false; } return true; } // ----------------------------------------------------------------------- -bool SvxSizeItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -285,7 +285,7 @@ bool SvxSizeItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) aSize.Height() = bConvert ? MM100_TO_TWIP(nVal) : nVal; } break; - default: DBG_ERROR("Wrong MemberId!"); + default: OSL_FAIL("Wrong MemberId!"); return false; } return true; @@ -325,7 +325,6 @@ SfxItemPresentation SvxSizeItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -351,7 +350,6 @@ SfxItemPresentation SvxSizeItem::GetPresentation default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -382,7 +380,6 @@ bool SvxSizeItem::HasMetrics() const // ----------------------------------------------------------------------- - SfxPoolItem* SvxSizeItem::Create( SvStream& rStrm, sal_uInt16 ) const { long nWidth, nHeight; @@ -431,14 +428,14 @@ SvxLRSpaceItem::SvxLRSpaceItem( const long nLeft, const long nRight, } // ----------------------------------------------------------------------- -bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { bool bRet = true; sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { - // jetzt alles signed + // now all signed case MID_L_MARGIN: rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nLeftMargin) : nLeftMargin); break; @@ -470,13 +467,13 @@ bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const default: bRet = false; - DBG_ERROR("unknown MemberId"); + OSL_FAIL("unknown MemberId"); } return bRet; } // ----------------------------------------------------------------------- -bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -506,9 +503,9 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) if((rVal >>= nRel) && nRel >= 0 && nRel < USHRT_MAX) { if(MID_L_REL_MARGIN== nMemberId) - nPropLeftMargin = (USHORT)nRel; + nPropLeftMargin = (sal_uInt16)nRel; else - nPropRightMargin = (USHORT)nRel; + nPropRightMargin = (sal_uInt16)nRel; } else return false; @@ -519,7 +516,7 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) break; case MID_FIRST_LINE_REL_INDENT: - SetPropTxtFirstLineOfst ( (USHORT)nVal ); + SetPropTxtFirstLineOfst ( (sal_uInt16)nVal ); break; case MID_FIRST_AUTO: @@ -527,7 +524,7 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) break; default: - DBG_ERROR("unknown MemberId"); + OSL_FAIL("unknown MemberId"); return false; } return true; @@ -535,7 +532,7 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) // ----------------------------------------------------------------------- -// nLeftMargin und nTxtLeft anpassen. +// Adapt nLeftMargin and nTxtLeft. void SvxLRSpaceItem::AdjustLeft() { @@ -578,7 +575,6 @@ SfxItemPresentation SvxLRSpaceItem::GetPresentation XubString& rText, const IntlWrapper* pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -644,21 +640,19 @@ SfxItemPresentation SvxLRSpaceItem::GetPresentation } default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } // ----------------------------------------------------------------------- -// MT: BulletFI: Vor 501 wurde im Outliner das Bullet nicht auf der Position des -// FI positioniert, deshalb muss in aelteren Dokumenten der FI auf 0 stehen. - +// BulletFI: Before 501 in the Outliner the bullet was not on the position of +// the FI, so in older documents one must set FI to 0. #define BULLETLR_MARKER 0x599401FE SvStream& SvxLRSpaceItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const { short nSaveFI = nFirstLineOfst; - ((SvxLRSpaceItem*)this)->SetTxtFirstLineOfst( 0 ); // nLeftMargin wird mitmanipuliert, siehe Create() + ((SvxLRSpaceItem*)this)->SetTxtFirstLineOfst( 0 ); // nLeftMargin is manipulated together with this, see Create() sal_uInt16 nMargin = 0; if( nLeftMargin > 0 ) @@ -686,8 +680,8 @@ SvStream& SvxLRSpaceItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) con nAutoFirst |= 0x80; rStrm << nAutoFirst; - // Ab 6.0 keine Magicnumber schreiben... - DBG_ASSERT( rStrm.GetVersion() <= SOFFICE_FILEFORMAT_50, "MT: Fileformat SvxLRSpaceItem aendern!" ); + // From 6.0 onwards, do not write Magic numbers... + DBG_ASSERT( rStrm.GetVersion() <= SOFFICE_FILEFORMAT_50, "Change File format SvxLRSpaceItem!" ); rStrm << (sal_uInt32) BULLETLR_MARKER; rStrm << nSaveFI; @@ -723,7 +717,7 @@ SfxPoolItem* SvxLRSpaceItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) cons { rStrm >> firstline; if ( firstline < 0 ) - left = left + static_cast<sal_uInt16>(firstline); // s.u.: txtleft = ... + left = left + static_cast<sal_uInt16>(firstline); // see below: txtleft = ... } else rStrm.Seek( nPos ); @@ -825,13 +819,13 @@ SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow, } // ----------------------------------------------------------------------- -bool SvxULSpaceItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { - // jetzt alles signed + // now all signed case 0: { ::com::sun::star::frame::status::UpperLowerMarginScale aUpperLowerMarginScale; @@ -851,7 +845,7 @@ bool SvxULSpaceItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } // ----------------------------------------------------------------------- -bool SvxULSpaceItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -876,12 +870,12 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) case MID_UP_MARGIN : if(!(rVal >>= nVal) || nVal < 0) return false; - SetUpper((USHORT)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); + SetUpper((sal_uInt16)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); break; case MID_LO_MARGIN : if(!(rVal >>= nVal) || nVal < 0) return false; - SetLower((USHORT)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); + SetLower((sal_uInt16)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); break; case MID_UP_REL_MARGIN: case MID_LO_REL_MARGIN: @@ -890,18 +884,17 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) if((rVal >>= nRel) && nRel > 1 ) { if(MID_UP_REL_MARGIN == nMemberId) - nPropUpper = (USHORT)nRel; + nPropUpper = (sal_uInt16)nRel; else - nPropLower = (USHORT)nRel; + nPropLower = (sal_uInt16)nRel; } else return false; } break; - default: - DBG_ERROR("unknown MemberId"); + OSL_FAIL("unknown MemberId"); return false; } return true; @@ -936,7 +929,6 @@ SfxItemPresentation SvxULSpaceItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -978,7 +970,6 @@ SfxItemPresentation SvxULSpaceItem::GetPresentation } default: ;//prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -1040,7 +1031,6 @@ bool SvxULSpaceItem::HasMetrics() const return true; } - // class SvxPrintItem ---------------------------------------------------- SfxPoolItem* SvxPrintItem::Clone( SfxItemPool* ) const @@ -1075,7 +1065,6 @@ SfxItemPresentation SvxPrintItem::GetPresentation XubString& rText, const IntlWrapper * ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1094,7 +1083,6 @@ SfxItemPresentation SvxPrintItem::GetPresentation } default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -1132,7 +1120,6 @@ SfxItemPresentation SvxOpaqueItem::GetPresentation XubString& rText, const IntlWrapper * ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1151,7 +1138,6 @@ SfxItemPresentation SvxOpaqueItem::GetPresentation } default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -1166,11 +1152,8 @@ int SvxProtectItem::operator==( const SfxPoolItem& rAttr ) const bPos == ( (SvxProtectItem&)rAttr ).bPos ); } -/*-----------------16.03.98 12:42------------------- ---------------------------------------------------*/ -bool SvxProtectItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxProtectItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Bool bValue; switch(nMemberId) @@ -1179,19 +1162,16 @@ bool SvxProtectItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const case MID_PROTECT_SIZE : bValue = bSize; break; case MID_PROTECT_POSITION: bValue = bPos; break; default: - DBG_ERROR("falsche MemberId"); + OSL_FAIL("Wrong MemberId"); return false; } rVal = Bool2Any( bValue ); return true; } -/*-----------------16.03.98 12:42------------------- ---------------------------------------------------*/ -bool SvxProtectItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxProtectItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Bool bVal( Any2Bool(rVal) ); switch(nMemberId) @@ -1200,7 +1180,7 @@ bool SvxProtectItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) case MID_PROTECT_SIZE : bSize = bVal; break; case MID_PROTECT_POSITION: bPos = bVal; break; default: - DBG_ERROR("falsche MemberId"); + OSL_FAIL("Wrong MemberId"); return false; } return true; @@ -1223,7 +1203,6 @@ SfxItemPresentation SvxProtectItem::GetPresentation XubString& rText, const IntlWrapper * ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1254,7 +1233,6 @@ SfxItemPresentation SvxProtectItem::GetPresentation } default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -1285,8 +1263,8 @@ SfxPoolItem* SvxProtectItem::Create( SvStream& rStrm, sal_uInt16 ) const // class SvxShadowItem --------------------------------------------------- -SvxShadowItem::SvxShadowItem( const USHORT nId, - const Color *pColor, const USHORT nW, +SvxShadowItem::SvxShadowItem( const sal_uInt16 nId, + const Color *pColor, const sal_uInt16 nW, const SvxShadowLocation eLoc ) : SfxEnumItemInterface( nId ), aShadowColor(COL_GRAY), @@ -1298,7 +1276,7 @@ SvxShadowItem::SvxShadowItem( const USHORT nId, } // ----------------------------------------------------------------------- -bool SvxShadowItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1325,13 +1303,13 @@ bool SvxShadowItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const case MID_TRANSPARENT: rVal <<= aShadow.IsTransparent; break; case MID_BG_COLOR: rVal <<= aShadow.Color; break; case 0: rVal <<= aShadow; break; - default: DBG_ERROR("Wrong MemberId!"); return false; + default: OSL_FAIL("Wrong MemberId!"); return false; } return true; } // ----------------------------------------------------------------------- -bool SvxShadowItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1358,7 +1336,7 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) case MID_TRANSPARENT: rVal >>= aShadow.IsTransparent; break; case MID_BG_COLOR: rVal >>= aShadow.Color; break; case 0: rVal >>= aShadow; break; - default: DBG_ERROR("Wrong MemberId!"); return sal_False; + default: OSL_FAIL("Wrong MemberId!"); return sal_False; } if ( bRet ) @@ -1433,7 +1411,7 @@ sal_uInt16 SvxShadowItem::CalcShadowSpace( sal_uInt16 nShadow ) const break; default: - DBG_ERROR( "wrong shadow" ); + OSL_FAIL( "wrong shadow" ); } return nSpace; } @@ -1448,7 +1426,6 @@ SfxItemPresentation SvxShadowItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1489,7 +1466,6 @@ SfxItemPresentation SvxShadowItem::GetPresentation } default: ;//prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -1566,180 +1542,6 @@ void SvxShadowItem::SetEnumValue( sal_uInt16 nVal ) SetLocation( (const SvxShadowLocation)nVal ); } -// class SvxBorderLine -------------------------------------------------- - -SvxBorderLine::SvxBorderLine( const Color *pCol, sal_uInt16 nOut, sal_uInt16 nIn, sal_uInt16 nDist, - SvxBorderStyle nStyle ) -: nOutWidth( nOut ) -, nInWidth ( nIn ) -, nDistance( nDist ) -, m_nStyle( nStyle ) -{ - if ( pCol ) - aColor = *pCol; -} - -// ----------------------------------------------------------------------- - -SvxBorderLine::SvxBorderLine( const SvxBorderLine& r ) -{ - *this = r; -} - -// ----------------------------------------------------------------------- - -SvxBorderLine& SvxBorderLine::operator=( const SvxBorderLine& r ) -{ - aColor = r.aColor; - nOutWidth = r.nOutWidth; - nInWidth = r.nInWidth; - nDistance = r.nDistance; - m_nStyle = r.m_nStyle; - return *this; -} - -// ----------------------------------------------------------------------- - -void SvxBorderLine::ScaleMetrics( long nMult, long nDiv ) -{ - nOutWidth = (sal_uInt16)Scale( nOutWidth, nMult, nDiv ); - nInWidth = (sal_uInt16)Scale( nInWidth, nMult, nDiv ); - nDistance = (sal_uInt16)Scale( nDistance, nMult, nDiv ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxBorderLine::operator==( const SvxBorderLine& rCmp ) const -{ - return ( ( aColor == rCmp.GetColor() ) && - ( nInWidth == rCmp.GetInWidth() ) && - ( nOutWidth == rCmp.GetOutWidth() ) && - ( nDistance == rCmp.GetDistance() ) && - ( m_nStyle == rCmp.GetStyle() ) ); -} - -// ----------------------------------------------------------------------- - -XubString SvxBorderLine::GetValueString( SfxMapUnit eSrcUnit, - SfxMapUnit eDestUnit, - const IntlWrapper* pIntl, - sal_Bool bMetricStr) const -{ -#ifndef SVX_LIGHT - sal_uInt16 nResId = 0; - - if ( 0 == nDistance ) - { - // einfach Linie - if ( DEF_LINE_WIDTH_0 == nOutWidth ) - nResId = RID_SINGLE_LINE0; - else if ( DEF_LINE_WIDTH_1 == nOutWidth ) - nResId = RID_SINGLE_LINE1; - else if ( DEF_LINE_WIDTH_2 == nOutWidth ) - nResId = RID_SINGLE_LINE2; - else if ( DEF_LINE_WIDTH_3 == nOutWidth ) - nResId = RID_SINGLE_LINE3; - else if ( DEF_LINE_WIDTH_4 == nOutWidth ) - nResId = RID_SINGLE_LINE4; - } - else if ( DEF_LINE_WIDTH_1 == nDistance ) - { - // doppelte Linie, kleiner Abstand - if ( DEF_LINE_WIDTH_0 == nOutWidth && DEF_LINE_WIDTH_0 == nInWidth ) - nResId = RID_DOUBLE_LINE0; - else if ( DEF_LINE_WIDTH_1 == nOutWidth && - DEF_LINE_WIDTH_1 == nInWidth ) - nResId = RID_DOUBLE_LINE2; - else if ( DEF_LINE_WIDTH_1 == nOutWidth && - DEF_LINE_WIDTH_2 == nInWidth ) - nResId = RID_DOUBLE_LINE8; - } - else if ( DEF_LINE_WIDTH_2 == nDistance ) - { - // doppelte Linie, gro\ser Abstand - if ( DEF_LINE_WIDTH_0 == nOutWidth && DEF_LINE_WIDTH_0 == nInWidth ) - nResId = RID_DOUBLE_LINE1; - else if ( DEF_LINE_WIDTH_2 == nOutWidth && - DEF_LINE_WIDTH_2 == nInWidth ) - nResId = RID_DOUBLE_LINE3; - else if ( DEF_LINE_WIDTH_1 == nOutWidth && - DEF_LINE_WIDTH_0 == nInWidth ) - nResId = RID_DOUBLE_LINE4; - else if ( DEF_LINE_WIDTH_2 == nOutWidth && - DEF_LINE_WIDTH_0 == nInWidth ) - nResId = RID_DOUBLE_LINE5; - else if ( DEF_LINE_WIDTH_3 == nOutWidth && - DEF_LINE_WIDTH_0 == nInWidth ) - nResId = RID_DOUBLE_LINE6; - else if ( DEF_LINE_WIDTH_2 == nOutWidth && - DEF_LINE_WIDTH_1 == nInWidth ) - nResId = RID_DOUBLE_LINE7; - else if ( DEF_LINE_WIDTH_3 == nOutWidth && - DEF_LINE_WIDTH_2 == nInWidth ) - nResId = RID_DOUBLE_LINE9; - else if ( DEF_LINE_WIDTH_2 == nOutWidth && - DEF_LINE_WIDTH_3 == nInWidth ) - nResId = RID_DOUBLE_LINE10; - } - String aStr; - aStr += sal_Unicode('('); - aStr += ::GetColorString( aColor ); - aStr += cpDelim; - - if ( nResId ) - aStr += EE_RESSTR(nResId); - else - { - String sMetric = EE_RESSTR(GetMetricId( eDestUnit )); - aStr += GetMetricText( (long)nInWidth, eSrcUnit, eDestUnit, pIntl ); - if ( bMetricStr ) - aStr += sMetric; - aStr += cpDelim; - aStr += GetMetricText( (long)nOutWidth, eSrcUnit, eDestUnit, pIntl ); - if ( bMetricStr ) - aStr += sMetric; - aStr += cpDelim; - aStr += GetMetricText( (long)nDistance, eSrcUnit, eDestUnit, pIntl ); - if ( bMetricStr ) - aStr += sMetric; - } - aStr += sal_Unicode(')'); - return aStr; -#else - return UniString(); -#endif -} - -bool SvxBorderLine::HasPriority( const SvxBorderLine& rOtherLine ) const -{ - const USHORT nThisSize = GetOutWidth() + GetDistance() + GetInWidth(); - const USHORT nOtherSize = rOtherLine.GetOutWidth() + rOtherLine.GetDistance() + rOtherLine.GetInWidth(); - - if (nThisSize > nOtherSize) - { - return true; - } - else if (nThisSize < nOtherSize) - { - return false; - } - else - { - if ( rOtherLine.GetInWidth() && !GetInWidth() ) - { - return true; - } - else if ( GetInWidth() && !rOtherLine.GetInWidth() ) - { - return false; - } - else - { - return false; - } - } -} - // class SvxBoxItem ------------------------------------------------------ SvxBoxItem::SvxBoxItem( const SvxBoxItem& rCpy ) : @@ -1842,20 +1644,20 @@ table::BorderLine2 SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, sal_Boo aLine.OuterLineWidth = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetOutWidth()): pLine->GetOutWidth() ); aLine.LineDistance = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetDistance()): pLine->GetDistance() ); aLine.LineStyle = pLine->GetStyle( ); + aLine.LineWidth = sal_uInt32( bConvert ? TWIP_TO_MM100( pLine->GetWidth( ) ) : pLine->GetWidth( ) ); } else aLine.Color = aLine.InnerLineWidth = aLine.OuterLineWidth = aLine.LineDistance = 0; return aLine; } // ----------------------------------------------------------------------- -bool SvxBoxItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); table::BorderLine2 aRetLine; sal_uInt16 nDist = 0; sal_Bool bDistMember = sal_False; nMemberId &= ~CONVERT_TWIPS; - sal_Bool bSerialize = sal_False; switch(nMemberId) { case 0: @@ -1875,22 +1677,18 @@ bool SvxBoxItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const return sal_True; } case MID_LEFT_BORDER: - bSerialize = sal_True; // intentionally no break! case LEFT_BORDER: aRetLine = SvxBoxItem::SvxLineToLine(GetLeft(), bConvert); break; case MID_RIGHT_BORDER: - bSerialize = sal_True; // intentionally no break! case RIGHT_BORDER: aRetLine = SvxBoxItem::SvxLineToLine(GetRight(), bConvert); break; case MID_BOTTOM_BORDER: - bSerialize = sal_True; // intentionally no break! case BOTTOM_BORDER: aRetLine = SvxBoxItem::SvxLineToLine(GetBottom(), bConvert); break; case MID_TOP_BORDER: - bSerialize = sal_True; // intentionally no break! case TOP_BORDER: aRetLine = SvxBoxItem::SvxLineToLine(GetTop(), bConvert); break; @@ -1919,21 +1717,7 @@ bool SvxBoxItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const if( bDistMember ) rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nDist) : nDist); else - { -/* - if ( bSerialize ) - { - ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any > aSeq(4); - aSeq[0] <<= aRetLine.Color; - aSeq[1] <<= aRetLine.InnerLineWidth; - aSeq[2] <<= aRetLine.OuterLineWidth; - aSeq[3] <<= aRetLine.LineDistance; - rVal <<= aSeq; - } - else -*/ - rVal <<= aRetLine; - } + rVal <<= aRetLine; return true; } @@ -1942,24 +1726,41 @@ namespace { sal_Bool -lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) +lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert, sal_Bool bGuessWidth) { rSvxLine.SetColor( Color(rLine.Color)); - rSvxLine.SetInWidth( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.InnerLineWidth) : rLine.InnerLineWidth )); - rSvxLine.SetOutWidth( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.OuterLineWidth) : rLine.OuterLineWidth )); - rSvxLine.SetDistance( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.LineDistance ) : rLine.LineDistance )); + if ( bGuessWidth ) + { + rSvxLine.GuessLinesWidths( rSvxLine.GetStyle(), + sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.OuterLineWidth) : rLine.OuterLineWidth ), + sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.InnerLineWidth) : rLine.InnerLineWidth ), + sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.LineDistance ) : rLine.LineDistance )); + } - sal_Bool bRet = rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0; + sal_Bool bRet = !rSvxLine.isEmpty(); return bRet; } } +namespace +{ + +sal_Bool +lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) +{ + return lcl_lineToSvxLine(rLine, rSvxLine, bConvert, sal_True); +} + return bRet; +} + +sal_Bool +SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) // ----------------------------------------------------------------------- sal_Bool SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) { - return lcl_lineToSvxLine(rLine, rSvxLine, bConvert); -} + SvxBorderStyle nStyle = NO_STYLE; + switch ( rLine.LineStyle ) sal_Bool SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) @@ -1970,17 +1771,57 @@ SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, Svx { default: case table::BorderLineStyle::SOLID: - rSvxLine.SetStyle( SOLID ); + nStyle = SOLID; break; case table::BorderLineStyle::DOTTED: - rSvxLine.SetStyle( DOTTED ); + nStyle = DOTTED; break; case table::BorderLineStyle::DASHED: - rSvxLine.SetStyle( DASHED ); + nStyle = DASHED; + break; + case table::BorderLineStyle::DOUBLE: + nStyle = DOUBLE; + break; + case table::BorderLineStyle::THINTHICK_SMALLGAP: + nStyle = THINTHICK_SMALLGAP; + break; + case table::BorderLineStyle::THINTHICK_MEDIUMGAP: + nStyle = THINTHICK_MEDIUMGAP; + break; + case table::BorderLineStyle::THINTHICK_LARGEGAP: + nStyle = THINTHICK_LARGEGAP; + break; + case table::BorderLineStyle::THICKTHIN_SMALLGAP: + nStyle = THICKTHIN_SMALLGAP; + break; + case table::BorderLineStyle::THICKTHIN_MEDIUMGAP: + nStyle = THICKTHIN_MEDIUMGAP; + break; + case table::BorderLineStyle::THICKTHIN_LARGEGAP: + nStyle = THICKTHIN_LARGEGAP; + break; + case table::BorderLineStyle::EMBOSSED: + nStyle = EMBOSSED; + break; + case table::BorderLineStyle::ENGRAVED: + nStyle = ENGRAVED; + break; + case table::BorderLineStyle::OUTSET: + nStyle = OUTSET; + break; + case table::BorderLineStyle::INSET: + nStyle = INSET; break; } + rSvxLine.SetStyle( nStyle ); + + sal_Bool bGuessWidth = sal_True; + if ( rLine.LineWidth ) + { + rSvxLine.SetWidth( bConvert? MM100_TO_TWIP_UNSIGNED( rLine.LineWidth ) : rLine.LineWidth ); + bGuessWidth = sal_False; - return bRet; + return lcl_lineToSvxLine(rLine, rSvxLine, bConvert, bGuessWidth); } // ----------------------------------------------------------------------- @@ -2026,7 +1867,47 @@ lcl_setLine(const uno::Any& rAny, Item& rItem, USHORT nLine, const bool bConvert } -bool SvxBoxItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +{ + +bool +lcl_extractBorderLine(const uno::Any& rAny, table::BorderLine2& rLine) +{ + if (rAny >>= rLine) + return true; + + table::BorderLine aBorderLine; + if (rAny >>= aBorderLine) + { + rLine.Color = aBorderLine.Color; + rLine.InnerLineWidth = aBorderLine.InnerLineWidth; + rLine.OuterLineWidth = aBorderLine.OuterLineWidth; + rLine.LineDistance = aBorderLine.LineDistance; + rLine.LineStyle = table::BorderLineStyle::SOLID; + return true; + } + + return false; +} + +template<typename Item> +bool +lcl_setLine(const uno::Any& rAny, Item& rItem, sal_uInt16 nLine, const bool bConvert) +{ + bool bDone = false; + table::BorderLine2 aBorderLine; + if (lcl_extractBorderLine(rAny, aBorderLine)) + { + SvxBorderLine aLine; + bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert); + rItem.SetLine( bSet ? &aLine : NULL, nLine); + bDone = true; + } + return bDone; +} + +} + +bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); sal_uInt16 nLine = BOX_LINE_TOP; @@ -2127,7 +2008,7 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { // serialization for basic macro recording uno::Reference < script::XTypeConverter > xConverter - ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), + ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))), uno::UNO_QUERY ); uno::Sequence < uno::Any > aSeq; uno::Any aNew; @@ -2177,7 +2058,6 @@ SfxItemPresentation SvxBoxItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -2306,7 +2186,6 @@ SfxItemPresentation SvxBoxItem::GetPresentation } default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -2410,7 +2289,8 @@ SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const sal_uInt16 nOutline, nInline, _nDistance; Color aColor; rStrm >> aColor >> nOutline >> nInline >> _nDistance; - SvxBorderLine aBorder( &aColor, nOutline, nInline, _nDistance ); + SvxBorderLine aBorder( &aColor ); + aBorder.GuessLinesWidths( NO_STYLE, nOutline, nInline, _nDistance ); pAttr->SetLine( &aBorder, aLineMap[cLine] ); } @@ -2453,7 +2333,7 @@ const SvxBorderLine *SvxBoxItem::GetLine( sal_uInt16 nLine ) const pRet = pRight; break; default: - DBG_ERROR( "wrong line" ); + OSL_FAIL( "wrong line" ); break; } @@ -2485,7 +2365,7 @@ void SvxBoxItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine ) pRight = pTmp; break; default: - DBG_ERROR( "wrong line" ); + OSL_FAIL( "wrong line" ); } } @@ -2525,7 +2405,7 @@ sal_uInt16 SvxBoxItem::GetDistance( sal_uInt16 nLine ) const nDist = nRightDist; break; default: - DBG_ERROR( "wrong line" ); + OSL_FAIL( "wrong line" ); } return nDist; @@ -2550,7 +2430,7 @@ void SvxBoxItem::SetDistance( sal_uInt16 nNew, sal_uInt16 nLine ) nRightDist = nNew; break; default: - DBG_ERROR( "wrong line" ); + OSL_FAIL( "wrong line" ); } } @@ -2579,7 +2459,7 @@ sal_uInt16 SvxBoxItem::CalcLineSpace( sal_uInt16 nLine, sal_Bool bIgnoreLine ) c nDist = nRightDist; break; default: - DBG_ERROR( "wrong line" ); + OSL_FAIL( "wrong line" ); } if( pTmp ) @@ -2682,11 +2562,10 @@ void SvxBoxInfoItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine ) } else { - DBG_ERROR( "wrong line" ); + OSL_FAIL( "wrong line" ); } } - // ----------------------------------------------------------------------- SfxPoolItem* SvxBoxInfoItem::Clone( SfxItemPool* ) const @@ -2704,39 +2583,7 @@ SfxItemPresentation SvxBoxInfoItem::GetPresentation XubString& rText, const IntlWrapper * ) const { -#ifndef SVX_LIGHT -/*!!! - ResMgr* pMgr = DIALOG_MGR(); - if ( pHori ) - { - rText += pHori->GetValueString(); - rText += cpDelim; - } - if ( pVert ) - { - rText += pVert->GetValueString(); - rText += cpDelim; - } - if ( bTable ) - rText += String( ResId( RID_SVXITEMS_BOXINF_TABLE_TRUE, pMgr ) ); - else - rText += String( ResId( RID_SVXITEMS_BOXINF_TABLE_FALSE, pMgr ) ); - rText += cpDelim; - if ( bDist ) - rText += String( ResId( RID_SVXITEMS_BOXINF_DIST_TRUE, pMgr ) ); - else - rText += String( ResId( RID_SVXITEMS_BOXINF_DIST_FALSE, pMgr ) ); - rText += cpDelim; - if ( bMinDist ) - rText += String( ResId( RID_SVXITEMS_BOXINF_MDIST_TRUE, pMgr ) ); - else - rText += String( ResId( RID_SVXITEMS_BOXINF_MDIST_FALSE, pMgr ) ); - rText += cpDelim; - rText += nDefDist; - return SFX_ITEM_PRESENTATION_NAMELESS; -*/ rText.Erase(); -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -2816,7 +2663,8 @@ SfxPoolItem* SvxBoxInfoItem::Create( SvStream& rStrm, sal_uInt16 ) const short nOutline, nInline, nDistance; Color aColor; rStrm >> aColor >> nOutline >> nInline >> nDistance; - SvxBorderLine aBorder( &aColor, nOutline, nInline, nDistance ); + SvxBorderLine aBorder( &aColor ); + aBorder.GuessLinesWidths( NO_STYLE, nOutline, nInline, nDistance ); switch( cLine ) { @@ -2831,17 +2679,16 @@ SfxPoolItem* SvxBoxInfoItem::Create( SvStream& rStrm, sal_uInt16 ) const void SvxBoxInfoItem::ResetFlags() { - nValidFlags = 0x7F; // alles g"ultig au/ser Disable + nValidFlags = 0x7F; // all valid except Disable } -bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); table::BorderLine2 aRetLine; sal_Int16 nVal=0; sal_Bool bIntMember = sal_False; nMemberId &= ~CONVERT_TWIPS; - sal_Bool bSerialize = sal_False; switch(nMemberId) { case 0: @@ -2865,11 +2712,9 @@ bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } case MID_HORIZONTAL: - bSerialize = sal_True; aRetLine = SvxBoxItem::SvxLineToLine( pHori, bConvert); break; case MID_VERTICAL: - bSerialize = sal_True; aRetLine = SvxBoxItem::SvxLineToLine( pVert, bConvert); break; case MID_FLAGS: @@ -2891,36 +2736,20 @@ bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const bIntMember = sal_True; rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(GetDefDist()) : GetDefDist()); break; - default: DBG_ERROR("Wrong MemberId!"); return false; + default: OSL_FAIL("Wrong MemberId!"); return false; } if( !bIntMember ) - { -/* - if ( bSerialize ) - { - ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any > aSeq(4); - aSeq[0] <<= aRetLine.Color; - aSeq[1] <<= aRetLine.InnerLineWidth; - aSeq[2] <<= aRetLine.OuterLineWidth; - aSeq[3] <<= aRetLine.LineDistance; - rVal <<= aSeq; - } - else - */ - rVal <<= aRetLine; - } + rVal <<= aRetLine; return true; } // ----------------------------------------------------------------------- -bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); -// sal_uInt16 nLine = BOX_LINE_TOP; -// sal_Bool bDistMember = sal_False; nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet; switch(nMemberId) @@ -2947,14 +2776,14 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) else return sal_False; if ( aSeq[3] >>= nFlags ) - nValidFlags = (BYTE)nFlags; + nValidFlags = (sal_uInt8)nFlags; else return sal_False; if (( aSeq[4] >>= nVal ) && ( nVal >= 0 )) { if( bConvert ) nVal = MM100_TO_TWIP(nVal); - SetDefDist( (USHORT)nVal ); + SetDefDist( (sal_uInt16)nVal ); } } return sal_True; @@ -2975,7 +2804,7 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { // serialization for basic macro recording uno::Reference < script::XTypeConverter > xConverter - ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), + ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))), uno::UNO_QUERY ); uno::Any aNew; uno::Sequence < uno::Any > aSeq; @@ -3039,7 +2868,7 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) sal_Int16 nFlags = sal_Int16(); bRet = (rVal >>= nFlags); if ( bRet ) - nValidFlags = (BYTE)nFlags; + nValidFlags = (sal_uInt8)nFlags; break; } case MID_DISTANCE: @@ -3050,11 +2879,11 @@ bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) { if( bConvert ) nVal = MM100_TO_TWIP(nVal); - SetDefDist( (USHORT)nVal ); + SetDefDist( (sal_uInt16)nVal ); } break; } - default: DBG_ERROR("Wrong MemberId!"); return sal_False; + default: OSL_FAIL("Wrong MemberId!"); return sal_False; } return sal_True; @@ -3079,7 +2908,6 @@ SfxItemPresentation SvxFmtBreakItem::GetPresentation XubString& rText, const IntlWrapper * ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -3092,7 +2920,6 @@ SfxItemPresentation SvxFmtBreakItem::GetPresentation return ePres; default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -3106,7 +2933,7 @@ XubString SvxFmtBreakItem::GetValueTextByPos( sal_uInt16 nPos ) const } // ----------------------------------------------------------------------- -bool SvxFmtBreakItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const +bool SvxFmtBreakItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { style::BreakType eBreak = style::BreakType_NONE; switch ( (SvxBreak)GetValue() ) @@ -3123,7 +2950,7 @@ bool SvxFmtBreakItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const return true; } // ----------------------------------------------------------------------- -bool SvxFmtBreakItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) +bool SvxFmtBreakItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { style::BreakType nBreak; @@ -3176,7 +3003,7 @@ sal_uInt16 SvxFmtBreakItem::GetVersion( sal_uInt16 nFFVer ) const DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || SOFFICE_FILEFORMAT_40==nFFVer || SOFFICE_FILEFORMAT_50==nFFVer, - "SvxFmtBreakItem: Gibt es ein neues Fileformat?" ); + "SvxFmtBreakItem: Is there a new file format? "); return SOFFICE_FILEFORMAT_31==nFFVer || SOFFICE_FILEFORMAT_40==nFFVer ? 0 : FMTBREAK_NOAUTO; } @@ -3233,7 +3060,6 @@ SfxItemPresentation SvxFmtKeepItem::GetPresentation XubString& rText, const IntlWrapper * ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -3252,7 +3078,6 @@ SfxItemPresentation SvxFmtKeepItem::GetPresentation } default: ;//prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -3275,7 +3100,6 @@ SvxLineItem::SvxLineItem( const SvxLineItem& rCpy ) : pLine = rCpy.GetLine() ? new SvxBorderLine( *rCpy.GetLine() ) : 0; } - // ----------------------------------------------------------------------- SvxLineItem::~SvxLineItem() @@ -3308,7 +3132,7 @@ SfxPoolItem* SvxLineItem::Clone( SfxItemPool* ) const return new SvxLineItem( *this ); } -bool SvxLineItem::QueryValue( uno::Any& rVal, BYTE nMemId ) const +bool SvxLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemId ) const { sal_Bool bConvert = 0!=(nMemId&CONVERT_TWIPS); nMemId &= ~CONVERT_TWIPS; @@ -3326,7 +3150,7 @@ bool SvxLineItem::QueryValue( uno::Any& rVal, BYTE nMemId ) const case MID_INNER_WIDTH: rVal <<= sal_Int32(pLine->GetInWidth( )); break; case MID_DISTANCE: rVal <<= sal_Int32(pLine->GetDistance()); break; default: - DBG_ERROR( "Wrong MemberId" ); + OSL_FAIL( "Wrong MemberId" ); return false; } } @@ -3336,7 +3160,7 @@ bool SvxLineItem::QueryValue( uno::Any& rVal, BYTE nMemId ) const // ----------------------------------------------------------------------- -bool SvxLineItem::PutValue( const uno::Any& rVal, BYTE nMemId ) +bool SvxLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemId ) { sal_Bool bConvert = 0!=(nMemId&CONVERT_TWIPS); nMemId &= ~CONVERT_TWIPS; @@ -3362,12 +3186,9 @@ bool SvxLineItem::PutValue( const uno::Any& rVal, BYTE nMemId ) switch ( nMemId ) { case MID_FG_COLOR: pLine->SetColor( Color(nVal) ); break; - case MID_OUTER_WIDTH: pLine->SetOutWidth((USHORT)nVal); break; - case MID_INNER_WIDTH: pLine->SetInWidth((USHORT)nVal); break; - case MID_DISTANCE: pLine->SetDistance((USHORT)nVal); break; case MID_LINE_STYLE: pLine->SetStyle((SvxBorderStyle)nVal); break; default: - DBG_ERROR( "Wrong MemberId" ); + OSL_FAIL( "Wrong MemberId" ); return sal_False; } @@ -3387,7 +3208,6 @@ SfxItemPresentation SvxLineItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT rText.Erase(); switch ( ePres ) @@ -3404,7 +3224,6 @@ SfxItemPresentation SvxLineItem::GetPresentation } default: ;//prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -3450,7 +3269,8 @@ SfxPoolItem* SvxLineItem::Create( SvStream& rStrm, sal_uInt16 ) const rStrm >> aColor >> nOutline >> nInline >> nDistance; if( nOutline ) { - SvxBorderLine aLine( &aColor, nOutline, nInline, nDistance ); + SvxBorderLine aLine( &aColor ); + aLine.GuessLinesWidths( NO_STYLE, nOutline, nInline, nDistance ); _pLine->SetLine( &aLine ); } return _pLine; @@ -3681,7 +3501,7 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion, rStream.ReadByteString(aRel); // TODO/MBA: how can we get a BaseURL here?! - DBG_ERROR("No BaseURL!"); + OSL_FAIL("No BaseURL!"); String aAbs = INetURLObject::GetAbsURL( String(), aRel ); DBG_ASSERT( aAbs.Len(), "Invalid URL!" ); pStrLink = new String( aAbs ); @@ -3744,9 +3564,8 @@ inline sal_Int8 lcl_TransparencyToPercent(sal_Int32 nTrans) return (sal_Int8)((nTrans * 100 + 127) / 254); } -bool SvxBrushItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId) { @@ -3806,9 +3625,8 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const // ----------------------------------------------------------------------- -bool SvxBrushItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId) { @@ -3866,7 +3684,7 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) if( 0 == sLink.compareToAscii( UNO_NAME_GRAPHOBJ_URLPKGPREFIX, sizeof(UNO_NAME_GRAPHOBJ_URLPKGPREFIX)-1 ) ) { - DBG_ERROR( "package urls aren't implemented" ); + OSL_FAIL( "package urls aren't implemented" ); } else if( 0 == sLink.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1 ) ) @@ -4066,7 +3884,7 @@ SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ ) rStream << pImpl->pGraphicObject->GetGraphic(); if ( pStrLink ) { - DBG_ERROR("No BaseURL!"); + OSL_FAIL("No BaseURL!"); // TODO/MBA: how to get a BaseURL?! String aRel = INetURLObject::GetRelURL( String(), *pStrLink ); // UNICODE: rStream << aRel; @@ -4082,9 +3900,9 @@ SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ ) } // ----------------------------------------------------------------------- -// const wegcasten, da const als logisches const zu verstehen ist -// wenn GetGraphic() gerufen wird, soll sich das Item darum kuemmern, -// eine gelinkte Grafik zu holen. +// cast away const, since const is to be understood as a logical const +// if GetGraphic() is called, the item should take care of getting a linked +// graphic. // ----------------------------------------------------------------------- void SvxBrushItem::PurgeGraphic() const @@ -4105,26 +3923,11 @@ void SvxBrushItem::PurgeMedium() const const GraphicObject* SvxBrushItem::GetGraphicObject() const { if ( bLoadAgain && pStrLink && !pImpl->pGraphicObject ) - // wenn Grafik schon geladen, als Cache benutzen + // when graphics already loaded, use as a cache { - //JP 29.6.2001: only with "valid" names - empty names now allowed + // only with "valid" names - empty names now allowed if( pStrLink->Len() ) { - // currently we don't have asynchronous processing -/* if( pImpl->aDoneLink.IsSet() ) - { - // Auf besonderen Wunsch des Writers wird der synchrone und der - // asynchrone Fall was die Benachrichtigung angeht unterschiedlich - // behandelt. Der Callback erfolgt nur bei asynchronem Eintreffen - // der Daten - - Link aTmp = pImpl->aDoneLink; - pImpl->aDoneLink = Link(); - pImpl->xMedium->DownLoad( - STATIC_LINK( this, SvxBrushItem, DoneHdl_Impl ) ); - pImpl->aDoneLink = aTmp; - } */ - pImpl->pStream = utl::UcbStreamHelper::CreateStream( *pStrLink, STREAM_STD_READ ); if( pImpl->pStream && !pImpl->pStream->GetError() ) { @@ -4150,9 +3953,6 @@ const GraphicObject* SvxBrushItem::GetGraphicObject() const { const_cast < SvxBrushItem*> (this)->bLoadAgain = sal_False; } - - // currently we don't have asynchronous processing -// pThis->pImpl->aDoneLink.Call( pThis ); } } @@ -4183,7 +3983,7 @@ void SvxBrushItem::SetGraphicPos( SvxGraphicPosition eNew ) { if ( !pImpl->pGraphicObject && !pStrLink ) { - pImpl->pGraphicObject = new GraphicObject; // dummy anlegen + pImpl->pGraphicObject = new GraphicObject; // Creating a dummy } } } @@ -4202,11 +4002,11 @@ void SvxBrushItem::SetGraphic( const Graphic& rNew ) ApplyGraphicTransparency_Impl(); if ( GPOS_NONE == eGraphicPos ) - eGraphicPos = GPOS_MM; // None waere Brush, also Default: Mitte + eGraphicPos = GPOS_MM; // None would be brush, then Default: middle } else { - DBG_ERROR( "SetGraphic() on linked graphic! :-/" ); + OSL_FAIL( "SetGraphic() on linked graphic! :-/" ); } } @@ -4224,11 +4024,11 @@ void SvxBrushItem::SetGraphicObject( const GraphicObject& rNewObj ) ApplyGraphicTransparency_Impl(); if ( GPOS_NONE == eGraphicPos ) - eGraphicPos = GPOS_MM; // None waere Brush, also Default: Mitte + eGraphicPos = GPOS_MM; // None would be brush, then Default: middle } else { - DBG_ERROR( "SetGraphic() on linked graphic! :-/" ); + OSL_FAIL( "SetGraphic() on linked graphic! :-/" ); } } @@ -4268,7 +4068,7 @@ void SvxBrushItem::SetGraphicFilter( const String& rNew ) SvxGraphicPosition SvxBrushItem::WallpaperStyle2GraphicPos( WallpaperStyle eStyle ) { SvxGraphicPosition eResult; - // der Switch ist nicht der schnellste, dafuer aber am sichersten + // The switch is not the fastest, but the safest switch( eStyle ) { case WALLPAPER_NULL: eResult = GPOS_NONE; break; @@ -4311,7 +4111,6 @@ WallpaperStyle SvxBrushItem::GraphicPos2WallpaperStyle( SvxGraphicPosition ePos return eResult; } - SvxBrushItem::SvxBrushItem( const CntWallpaperItem& rItem, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich ), pImpl( new SvxBrushItem_Impl( 0 ) ), @@ -4332,7 +4131,7 @@ CntWallpaperItem* SvxBrushItem::CreateCntWallpaperItem() const { CntWallpaperItem* pItem = new CntWallpaperItem( 0 ); pItem->SetColor( aColor.GetColor() ); - pItem->SetStyle( (USHORT)GraphicPos2WallpaperStyle( GetGraphicPos() ) ); + pItem->SetStyle( (sal_uInt16)GraphicPos2WallpaperStyle( GetGraphicPos() ) ); sal_Bool bLink = (pStrLink != 0); if( bLink ) { @@ -4343,7 +4142,6 @@ CntWallpaperItem* SvxBrushItem::CreateCntWallpaperItem() const { DBG_ERRORFILE( "Don't know what to do with a graphic" ); } -// pItem->SetGraphic( *pImpl->pGraphic, bLink ); return pItem; } @@ -4351,9 +4149,7 @@ CntWallpaperItem* SvxBrushItem::CreateCntWallpaperItem() const #ifdef _MSC_VER #pragma optimize ( "", on ) #endif -/* -----------------------------16.08.2002 09:18------------------------------ - ---------------------------------------------------------------------------*/ void SvxBrushItem::ApplyGraphicTransparency_Impl() { DBG_ASSERT(pImpl->pGraphicObject, "no GraphicObject available" ); @@ -4367,14 +4163,14 @@ void SvxBrushItem::ApplyGraphicTransparency_Impl() } // class SvxFrameDirectionItem ---------------------------------------------- -SvxFrameDirectionItem::SvxFrameDirectionItem( USHORT _nWhich ) - : SfxUInt16Item( _nWhich, (UINT16)FRMDIR_HORI_LEFT_TOP ) +SvxFrameDirectionItem::SvxFrameDirectionItem( sal_uInt16 _nWhich ) + : SfxUInt16Item( _nWhich, (sal_uInt16)FRMDIR_HORI_LEFT_TOP ) { } SvxFrameDirectionItem::SvxFrameDirectionItem( SvxFrameDirection nValue , - USHORT _nWhich ) - : SfxUInt16Item( _nWhich, (UINT16)nValue ) + sal_uInt16 _nWhich ) + : SfxUInt16Item( _nWhich, (sal_uInt16)nValue ) { } @@ -4394,21 +4190,21 @@ SfxPoolItem* SvxFrameDirectionItem::Clone( SfxItemPool * ) const return new SvxFrameDirectionItem( *this ); } -SfxPoolItem* SvxFrameDirectionItem::Create( SvStream & rStrm, USHORT /*nVer*/ ) const +SfxPoolItem* SvxFrameDirectionItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/ ) const { sal_uInt16 nValue; rStrm >> nValue; return new SvxFrameDirectionItem( (SvxFrameDirection)nValue, Which() ); } -SvStream& SvxFrameDirectionItem::Store( SvStream & rStrm, USHORT /*nIVer*/ ) const +SvStream& SvxFrameDirectionItem::Store( SvStream & rStrm, sal_uInt16 /*nIVer*/ ) const { sal_uInt16 nValue = GetValue(); rStrm << nValue; return rStrm; } -USHORT SvxFrameDirectionItem::GetVersion( USHORT nFVer ) const +sal_uInt16 SvxFrameDirectionItem::GetVersion( sal_uInt16 nFVer ) const { return SOFFICE_FILEFORMAT_50 > nFVer ? USHRT_MAX : 0; } @@ -4438,7 +4234,7 @@ SfxItemPresentation SvxFrameDirectionItem::GetPresentation( } bool SvxFrameDirectionItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE ) + sal_uInt8 ) { sal_Int16 nVal = sal_Int16(); sal_Bool bRet = ( rVal >>= nVal ); @@ -4472,7 +4268,7 @@ bool SvxFrameDirectionItem::PutValue( const com::sun::star::uno::Any& rVal, } bool SvxFrameDirectionItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE ) const + sal_uInt8 ) const { // translate SvxFrameDirection into WritingDirection2 sal_Int16 nVal; @@ -4495,7 +4291,7 @@ bool SvxFrameDirectionItem::QueryValue( com::sun::star::uno::Any& rVal, nVal = text::WritingMode2::PAGE; break; default: - DBG_ERROR("Unknown SvxFrameDirection value!"); + OSL_FAIL("Unknown SvxFrameDirection value!"); bRet = false; break; } diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx index 6a8ee03e38..ea8808ce75 100644 --- a/editeng/source/items/itemtype.cxx +++ b/editeng/source/items/itemtype.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -30,7 +30,6 @@ #include "precompiled_editeng.hxx" // include --------------------------------------------------------------- -#include <tools/list.hxx> #include <vcl/outdev.hxx> #include <editeng/editrids.hrc> #include <unotools/intlwrapper.hxx> @@ -97,7 +96,7 @@ XubString GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, c nVal, (MapUnit)eSrcUnit, (MapUnit)eDestUnit )); default: - DBG_ERROR( "not supported mapunit" ); + OSL_FAIL( "not supported mapunit" ); return sRet; } @@ -124,7 +123,6 @@ XubString GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, c nRet %= nDiff; if( 4 == nDigits ) { -// DBG_ASSERT(pIntl, "no IntlWrapper* set") if(pIntl) sRet += pIntl->getLocaleData()->getNumDecimalSep(); else @@ -148,8 +146,6 @@ XubString GetSvxString( sal_uInt16 nId ) return EE_RESSTR( nId ); } -#ifndef SVX_LIGHT - // ----------------------------------------------------------------------- XubString GetColorString( const Color& rCol ) @@ -189,8 +185,6 @@ XubString GetColorString( const Color& rCol ) return sStr; } -#endif - // ----------------------------------------------------------------------- sal_uInt16 GetMetricId( SfxMapUnit eUnit ) @@ -229,7 +223,7 @@ sal_uInt16 GetMetricId( SfxMapUnit eUnit ) break; default: - DBG_ERROR( "not supported mapunit" ); + OSL_FAIL( "not supported mapunit" ); } return nId; } diff --git a/editeng/source/items/justifyitem.cxx b/editeng/source/items/justifyitem.cxx index 31907ecca4..c8f4c7c3e1 100644 --- a/editeng/source/items/justifyitem.cxx +++ b/editeng/source/items/justifyitem.cxx @@ -44,28 +44,25 @@ #include <com/sun/star/table/CellVertJustify2.hpp> #include <com/sun/star/style/VerticalAlignment.hpp> -// STATIC DATA ----------------------------------------------------------- TYPEINIT1_FACTORY( SvxHorJustifyItem, SfxEnumItem, new SvxHorJustifyItem(SVX_HOR_JUSTIFY_STANDARD, 0) ); TYPEINIT1_FACTORY( SvxVerJustifyItem, SfxEnumItem, new SvxVerJustifyItem(SVX_VER_JUSTIFY_STANDARD, 0) ); using namespace ::com::sun::star; -// class SvxHorJustifyItem ----------------------------------------------- -SvxHorJustifyItem::SvxHorJustifyItem( const USHORT nId ) : - SfxEnumItem( nId, (USHORT)SVX_HOR_JUSTIFY_STANDARD ) +SvxHorJustifyItem::SvxHorJustifyItem( const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)SVX_HOR_JUSTIFY_STANDARD ) { } SvxHorJustifyItem::SvxHorJustifyItem( const SvxCellHorJustify eJustify, - const USHORT nId ) : - SfxEnumItem( nId, (USHORT)eJustify ) + const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)eJustify ) { } -//------------------------------------------------------------------------ SfxItemPresentation SvxHorJustifyItem::GetPresentation ( @@ -88,9 +85,8 @@ SfxItemPresentation SvxHorJustifyItem::GetPresentation return SFX_ITEM_PRESENTATION_NONE; } -//------------------------------------------------------------------------ -bool SvxHorJustifyItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxHorJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) @@ -133,7 +129,7 @@ bool SvxHorJustifyItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const return true; } -bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) @@ -159,7 +155,7 @@ bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) case table::CellHoriJustify_REPEAT: eSvx = SVX_HOR_JUSTIFY_REPEAT; break; default: ; //prevent warning } - SetValue( (USHORT)eSvx ); + SetValue( (sal_uInt16)eSvx ); } break; case MID_HORJUST_ADJUST: @@ -179,56 +175,51 @@ bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) case style::ParagraphAdjust_BLOCK: eSvx = SVX_HOR_JUSTIFY_BLOCK; break; case style::ParagraphAdjust_CENTER: eSvx = SVX_HOR_JUSTIFY_CENTER; break; } - SetValue( (USHORT)eSvx ); + SetValue( (sal_uInt16)eSvx ); } } return true; } -//------------------------------------------------------------------------ -XubString SvxHorJustifyItem::GetValueText( USHORT nVal ) const +XubString SvxHorJustifyItem::GetValueText( sal_uInt16 nVal ) const { DBG_ASSERT( nVal <= SVX_HOR_JUSTIFY_REPEAT, "enum overflow!" ); return EE_RESSTR(RID_SVXITEMS_HORJUST_STANDARD + nVal); } -//------------------------------------------------------------------------ SfxPoolItem* SvxHorJustifyItem::Clone( SfxItemPool* ) const { return new SvxHorJustifyItem( *this ); } -//------------------------------------------------------------------------ -SfxPoolItem* SvxHorJustifyItem::Create( SvStream& rStream, USHORT ) const +SfxPoolItem* SvxHorJustifyItem::Create( SvStream& rStream, sal_uInt16 ) const { - USHORT nVal; + sal_uInt16 nVal; rStream >> nVal; return new SvxHorJustifyItem( (SvxCellHorJustify)nVal, Which() ); } -//------------------------------------------------------------------------ -USHORT SvxHorJustifyItem::GetValueCount() const + +sal_uInt16 SvxHorJustifyItem::GetValueCount() const { - return SVX_HOR_JUSTIFY_REPEAT + 1; // letzter Enum-Wert + 1 + return SVX_HOR_JUSTIFY_REPEAT + 1; // Last Enum value + 1 } -// class SvxVerJustifyItem ----------------------------------------------- -SvxVerJustifyItem::SvxVerJustifyItem( const USHORT nId ) : - SfxEnumItem( nId, (USHORT)SVX_VER_JUSTIFY_STANDARD ) +SvxVerJustifyItem::SvxVerJustifyItem( const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)SVX_VER_JUSTIFY_STANDARD ) { } SvxVerJustifyItem::SvxVerJustifyItem( const SvxCellVerJustify eJustify, - const USHORT nId ) : - SfxEnumItem( nId, (USHORT)eJustify ) + const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)eJustify ) { } -//------------------------------------------------------------------------ SfxItemPresentation SvxVerJustifyItem::GetPresentation ( @@ -252,9 +243,8 @@ SfxItemPresentation SvxVerJustifyItem::GetPresentation return SFX_ITEM_PRESENTATION_NONE; } -//------------------------------------------------------------------------ -bool SvxVerJustifyItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxVerJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) @@ -291,7 +281,7 @@ bool SvxVerJustifyItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const return true; } -bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) @@ -311,16 +301,13 @@ bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) case style::VerticalAlignment_BOTTOM: eSvx = SVX_VER_JUSTIFY_BOTTOM; break; default:; } - SetValue( (USHORT)eSvx ); + SetValue( (sal_uInt16)eSvx ); break; } default: { - sal_Int32 eUno; - if(!(rVal >>= eUno)) - { - eUno = table::CellVertJustify2::STANDARD; - } + sal_Int32 eUno = table::CellVertJustify2::STANDARD; + rVal >>= eUno; SvxCellVerJustify eSvx = SVX_VER_JUSTIFY_STANDARD; switch (eUno) @@ -332,7 +319,7 @@ bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) case table::CellVertJustify2::BLOCK: eSvx = SVX_VER_JUSTIFY_BLOCK; break; default: ; //prevent warning } - SetValue( (USHORT)eSvx ); + SetValue( (sal_uInt16)eSvx ); break; } } @@ -340,52 +327,46 @@ bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) return true; } -//------------------------------------------------------------------------ -XubString SvxVerJustifyItem::GetValueText( USHORT nVal ) const +XubString SvxVerJustifyItem::GetValueText( sal_uInt16 nVal ) const { DBG_ASSERT( nVal <= SVX_VER_JUSTIFY_BOTTOM, "enum overflow!" ); return EE_RESSTR(RID_SVXITEMS_VERJUST_STANDARD + nVal); } -//------------------------------------------------------------------------ SfxPoolItem* SvxVerJustifyItem::Clone( SfxItemPool* ) const { return new SvxVerJustifyItem( *this ); } -//------------------------------------------------------------------------ -SfxPoolItem* SvxVerJustifyItem::Create( SvStream& rStream, USHORT ) const +SfxPoolItem* SvxVerJustifyItem::Create( SvStream& rStream, sal_uInt16 ) const { - USHORT nVal; + sal_uInt16 nVal; rStream >> nVal; return new SvxVerJustifyItem( (SvxCellVerJustify)nVal, Which() ); } -//------------------------------------------------------------------------ -USHORT SvxVerJustifyItem::GetValueCount() const +sal_uInt16 SvxVerJustifyItem::GetValueCount() const { - return SVX_VER_JUSTIFY_BOTTOM + 1; // letzter Enum-Wert + 1 + return SVX_VER_JUSTIFY_BOTTOM + 1; // Last Enum value + 1 } -// class SvxJustifyMethodItem ----------------------------------------------- -SvxJustifyMethodItem::SvxJustifyMethodItem( const USHORT nId ) : - SfxEnumItem( nId, (USHORT)SVX_JUSTIFY_METHOD_AUTO ) +SvxJustifyMethodItem::SvxJustifyMethodItem( const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)SVX_JUSTIFY_METHOD_AUTO ) { } SvxJustifyMethodItem::SvxJustifyMethodItem( const SvxCellJustifyMethod eJustify, - const USHORT nId ) : - SfxEnumItem( nId, (USHORT)eJustify ) + const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)eJustify ) { } -//------------------------------------------------------------------------ SfxItemPresentation SvxJustifyMethodItem::GetPresentation ( @@ -409,9 +390,8 @@ SfxItemPresentation SvxJustifyMethodItem::GetPresentation return SFX_ITEM_PRESENTATION_NONE; } -//------------------------------------------------------------------------ -bool SvxJustifyMethodItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const +bool SvxJustifyMethodItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { sal_Int32 nUno = table::CellJustifyMethod::AUTO; switch (static_cast<SvxCellJustifyMethod>(GetValue())) @@ -424,7 +404,7 @@ bool SvxJustifyMethodItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) cons return true; } -bool SvxJustifyMethodItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) +bool SvxJustifyMethodItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { sal_Int32 nVal = table::CellJustifyMethod::AUTO; if (!(rVal >>= nVal)) @@ -441,39 +421,35 @@ bool SvxJustifyMethodItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) break; default:; } - SetValue(static_cast<USHORT>(eSvx)); + SetValue(static_cast<sal_uInt16>(eSvx)); return true; } -//------------------------------------------------------------------------ -XubString SvxJustifyMethodItem::GetValueText( USHORT nVal ) const +XubString SvxJustifyMethodItem::GetValueText( sal_uInt16 nVal ) const { DBG_ASSERT( nVal <= SVX_VER_JUSTIFY_BOTTOM, "enum overflow!" ); return EE_RESSTR(RID_SVXITEMS_JUSTMETHOD_AUTO + nVal); } -//------------------------------------------------------------------------ SfxPoolItem* SvxJustifyMethodItem::Clone( SfxItemPool* ) const { return new SvxJustifyMethodItem( *this ); } -//------------------------------------------------------------------------ -SfxPoolItem* SvxJustifyMethodItem::Create( SvStream& rStream, USHORT ) const +SfxPoolItem* SvxJustifyMethodItem::Create( SvStream& rStream, sal_uInt16 ) const { - USHORT nVal; + sal_uInt16 nVal; rStream >> nVal; return new SvxJustifyMethodItem( (SvxCellJustifyMethod)nVal, Which() ); } -//------------------------------------------------------------------------ -USHORT SvxJustifyMethodItem::GetValueCount() const +sal_uInt16 SvxJustifyMethodItem::GetValueCount() const { - return SVX_JUSTIFY_METHOD_DISTRIBUTE + 1; // letzter Enum-Wert + 1 + return SVX_JUSTIFY_METHOD_DISTRIBUTE + 1; // Last Enum value + 1 } SvxJustifyMethodItem& SvxJustifyMethodItem::operator=(const SvxJustifyMethodItem& r) diff --git a/editeng/source/items/makefile.mk b/editeng/source/items/makefile.mk index 375d3a933b..9ebb12c66f 100644 --- a/editeng/source/items/makefile.mk +++ b/editeng/source/items/makefile.mk @@ -6,10 +6,6 @@ # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.19 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,11 +27,6 @@ PRJ=..$/.. -#PROJECTPCH4DLL=TRUE -#PROJECTPCH=svxpch -#PROJECTPCHSOURCE=$(PRJ)$/util$/svxpch -#ENABLE_EXCEPTIONS=TRUE - PRJNAME=editeng TARGET=items @@ -62,6 +53,7 @@ EXCEPTIONSFILES= \ $(SLO)$/bulitem.obj \ $(SLO)$/flditem.obj \ $(SLO)$/frmitems.obj \ + $(SLO)$/borderline.obj \ $(SLO)$/itemtype.obj \ $(SLO)$/numitem.obj \ $(SLO)$/paperinf.obj \ diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 341907242d..f04b8eaa48 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -54,8 +54,8 @@ #define MM100_TO_TWIP(MM100) ((MM100*72L+63L)/127L) -#define DEF_WRITER_LSPACE 500 //Standardeinrueckung -#define DEF_DRAW_LSPACE 800 //Standardeinrueckung +#define DEF_WRITER_LSPACE 500 //Standard Indentation +#define DEF_DRAW_LSPACE 800 //Standard Indentation #define NUMITEM_VERSION_01 0x01 #define NUMITEM_VERSION_02 0x02 @@ -79,7 +79,7 @@ void lcl_getFormatter(com::sun::star::uno::Reference<com::sun::star::text::XNumb { Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); Reference < XInterface > xI = xMSF->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.DefaultNumberingProvider" )) ); Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY); DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\""); _xFormatter = Reference<XNumberingFormatter> (xRet, UNO_QUERY); @@ -110,14 +110,14 @@ SvxNumberType::~SvxNumberType() xFormatter = 0; } -String SvxNumberType::GetNumStr( ULONG nNo ) const +String SvxNumberType::GetNumStr( sal_uLong nNo ) const { LanguageType eLang = Application::GetSettings().GetLanguage(); Locale aLocale = SvxCreateLocale(eLang); return GetNumStr( nNo, aLocale ); } -String SvxNumberType::GetNumStr( ULONG nNo, const Locale& rLocale ) const +String SvxNumberType::GetNumStr( sal_uLong nNo, const Locale& rLocale ) const { lcl_getFormatter(xFormatter); String aTmpStr; @@ -133,7 +133,7 @@ String SvxNumberType::GetNumStr( ULONG nNo, const Locale& rLocale ) const break; default: { - //#95525# '0' allowed for ARABIC numberings + // '0' allowed for ARABIC numberings if(NumberingType::ARABIC == nNumType && 0 == nNo ) aTmpStr = '0'; else @@ -206,16 +206,16 @@ SvxNumberFormat::SvxNumberFormat(SvStream &rStream) mnIndentAt( 0 ) { - USHORT nVersion; + sal_uInt16 nVersion; rStream >> nVersion; - USHORT nUSHORT; + sal_uInt16 nUSHORT; rStream >> nUSHORT; SetNumberingType((sal_Int16)nUSHORT); rStream >> nUSHORT; eNumAdjust = (SvxAdjust)nUSHORT; rStream >> nUSHORT; - nInclUpperLevels = (BYTE)nUSHORT; + nInclUpperLevels = (sal_uInt8)nUSHORT; rStream >> nUSHORT; nStart = nUSHORT; rStream >> nUSHORT; @@ -263,7 +263,7 @@ SvxNumberFormat::SvxNumberFormat(SvStream &rStream) rStream >> nUSHORT; nBulletRelSize = nUSHORT; rStream >> nUSHORT; - SetShowSymbol((BOOL)nUSHORT); + SetShowSymbol((sal_Bool)nUSHORT); if( nVersion < NUMITEM_VERSION_03 ) cBullet = ByteString::ConvertToUnicode( (sal_Char)cBullet, @@ -271,7 +271,7 @@ SvxNumberFormat::SvxNumberFormat(SvStream &rStream) : RTL_TEXTENCODING_SYMBOL ); if(pBulletFont) { - BOOL bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50; + sal_Bool bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50; if(bConvertBulletFont) { @@ -313,13 +313,13 @@ SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pC pBulletFont->SetName(sFontName); } - rStream << (USHORT)NUMITEM_VERSION_04; + rStream << (sal_uInt16)NUMITEM_VERSION_04; - rStream << (USHORT)GetNumberingType(); - rStream << (USHORT)eNumAdjust; - rStream << (USHORT)nInclUpperLevels; + rStream << (sal_uInt16)GetNumberingType(); + rStream << (sal_uInt16)eNumAdjust; + rStream << (sal_uInt16)nInclUpperLevels; rStream << nStart; - rStream << (USHORT)cBullet; + rStream << (sal_uInt16)cBullet; rStream << nFirstLineOffset; rStream << nAbsLSpace; @@ -332,9 +332,9 @@ SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pC rStream.WriteByteString(sCharStyleName, eEnc); if(pGraphicBrush) { - rStream << (USHORT)1; + rStream << (sal_uInt16)1; - // #75113# in SD or SI force bullet itself to be stored, + // in SD or SI force bullet itself to be stored, // for that purpose throw away link when link and graphic // are present, so Brush save is forced if(pGraphicBrush->GetGraphicLink() && pGraphicBrush->GetGraphic()) @@ -346,16 +346,16 @@ SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pC pGraphicBrush->Store(rStream, BRUSH_GRAPHIC_VERSION); } else - rStream << (USHORT)0; + rStream << (sal_uInt16)0; - rStream << (USHORT)eVertOrient; + rStream << (sal_uInt16)eVertOrient; if(pBulletFont) { - rStream << (USHORT)1; + rStream << (sal_uInt16)1; rStream << *pBulletFont; } else - rStream << (USHORT)0; + rStream << (sal_uInt16)0; rStream << aGraphicSize; Color nTempColor = nBulletColor; @@ -363,10 +363,10 @@ SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pC nTempColor = COL_BLACK; rStream << nTempColor; rStream << nBulletRelSize; - rStream << (USHORT)IsShowSymbol(); + rStream << (sal_uInt16)IsShowSymbol(); - rStream << ( USHORT ) mePositionAndSpaceMode; - rStream << ( USHORT ) meLabelFollowedBy; + rStream << ( sal_uInt16 ) mePositionAndSpaceMode; + rStream << ( sal_uInt16 ) meLabelFollowedBy; rStream << ( long ) mnListtabPos; rStream << ( long ) mnFirstLineIndent; rStream << ( long ) mnIndentAt; @@ -376,6 +376,8 @@ SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pC SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat ) { + if (& rFormat == this) { return *this; } + SetNumberingType(rFormat.GetNumberingType()); eNumAdjust = rFormat.eNumAdjust ; nInclUpperLevels = rFormat.nInclUpperLevels ; @@ -410,7 +412,7 @@ SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat ) return *this; } -BOOL SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const +sal_Bool SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const { if( GetNumberingType() != rFormat.GetNumberingType() || eNumAdjust != rFormat.eNumAdjust || @@ -435,14 +437,14 @@ BOOL SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const IsShowSymbol() != rFormat.IsShowSymbol() || sCharStyleName != rFormat.sCharStyleName ) - return FALSE; + return sal_False; if ( (pGraphicBrush && !rFormat.pGraphicBrush) || (!pGraphicBrush && rFormat.pGraphicBrush) || (pGraphicBrush && *pGraphicBrush != *rFormat.pGraphicBrush) ) { - return FALSE; + return sal_False; } if ( (pBulletFont && !rFormat.pBulletFont) || @@ -450,9 +452,9 @@ BOOL SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const (pBulletFont && *pBulletFont != *rFormat.pBulletFont) ) { - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } void SvxNumberFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem, @@ -579,7 +581,7 @@ long SvxNumberFormat::GetIndentAt() const IMPL_STATIC_LINK( SvxNumberFormat, GraphicArrived, void *, EMPTYARG ) { - // ggfs. die GrfSize setzen: + // if necessary, set the GrfSize: if( !pThis->aGraphicSize.Width() || !pThis->aGraphicSize.Height() ) { const Graphic* pGrf = pThis->pGraphicBrush->GetGraphic(); @@ -612,21 +614,21 @@ Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* pGraphic) return aRetSize; } -String SvxNumberFormat::CreateRomanString( ULONG nNo, BOOL bUpper ) +String SvxNumberFormat::CreateRomanString( sal_uLong nNo, sal_Bool bUpper ) { - nNo %= 4000; // mehr kann nicht dargestellt werden + nNo %= 4000; // more can not be displayed // i, ii, iii, iv, v, vi, vii, vii, viii, ix // (Dummy),1000,500,100,50,10,5,1 const char *cRomanArr = bUpper - ? "MDCLXVI--" // +2 Dummy-Eintraege !! - : "mdclxvi--"; // +2 Dummy-Eintraege !! + ? "MDCLXVI--" // +2 Dummy entries! + : "mdclxvi--"; // +2 Dummy entries! String sRet; - USHORT nMask = 1000; + sal_uInt16 nMask = 1000; while( nMask ) { - BYTE nZahl = BYTE(nNo / nMask); - BYTE nDiff = 1; + sal_uInt8 nZahl = sal_uInt8(nNo / nMask); + sal_uInt8 nDiff = 1; nNo %= nMask; if( 5 < nZahl ) @@ -652,45 +654,11 @@ String SvxNumberFormat::CreateRomanString( ULONG nNo, BOOL bUpper ) break; } - nMask /= 10; // zur naechsten Dekade + nMask /= 10; // for the next decade cRomanArr += 2; } return sRet; } -#ifdef OLD_NUMBER_FORMATTING -void SvxNumberFormat::GetCharStr( ULONG nNo, String& rStr ) const -{ - DBG_ASSERT( nNo, "0 ist eine ungueltige Nummer !!" ); - - const ULONG coDiff = 'Z' - 'A' +1; - char cAdd = (SVX_NUM_CHARS_UPPER_LETTER == eNumType ? 'A' : 'a') - 1; - ULONG nCalc; - - do { - nCalc = nNo % coDiff; - if( !nCalc ) - nCalc = coDiff; - rStr.Insert( sal_Unicode(cAdd + nCalc ), 0 ); - nNo -= nCalc; - if( nNo ) - nNo /= coDiff; - } while( nNo ); -} - -void SvxNumberFormat::GetCharStrN( ULONG nNo, String& rStr ) const -{ - DBG_ASSERT( nNo, "0 ist eine ungueltige Nummer !!" ); - - const ULONG coDiff = 'Z' - 'A' +1; - char cChar = (char)(--nNo % coDiff); - if( SVX_NUM_CHARS_UPPER_LETTER_N == eNumType ) - cChar += 'A'; - else - cChar += 'a'; - - rStr.Fill( (USHORT)(nNo / coDiff) + 1, sal_Unicode(cChar) ); -} -#endif //OLD_NUMBER_FORMATTING const String& SvxNumberFormat::GetCharFmtName()const { @@ -700,9 +668,9 @@ const String& SvxNumberFormat::GetCharFmtName()const sal_Int32 SvxNumRule::nRefCount = 0; static SvxNumberFormat* pStdNumFmt = 0; static SvxNumberFormat* pStdOutlineNumFmt = 0; -SvxNumRule::SvxNumRule( ULONG nFeatures, - USHORT nLevels, - BOOL bCont, +SvxNumRule::SvxNumRule( sal_uLong nFeatures, + sal_uInt16 nLevels, + sal_Bool bCont, SvxNumRuleType eType, SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode ) @@ -714,12 +682,12 @@ SvxNumRule::SvxNumRule( ULONG nFeatures, ++nRefCount; LanguageType eLang = Application::GetSettings().GetLanguage(); aLocale = SvxCreateLocale(eLang); - for(USHORT i = 0; i < SVX_MAX_NUM; i++) + for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) { if(i < nLevels) { aFmts[i] = new SvxNumberFormat(SVX_NUM_CHARS_UPPER_LETTER); - //daran wird zwischen writer und draw unterschieden + // It is a distinction between writer and draw if(nFeatures & NUM_CONTINUOUS) { if ( eDefaultNumberFormatPositionAndSpaceMode == @@ -753,7 +721,7 @@ SvxNumRule::SvxNumRule( ULONG nFeatures, } else aFmts[i] = 0; - aFmtsSet[i] = FALSE; + aFmtsSet[i] = sal_False; } } @@ -766,7 +734,7 @@ SvxNumRule::SvxNumRule(const SvxNumRule& rCopy) bContinuousNumbering = rCopy.bContinuousNumbering; eNumberingType = rCopy.eNumberingType; memset( aFmts, 0, sizeof( aFmts )); - for(USHORT i = 0; i < SVX_MAX_NUM; i++) + for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) { if(rCopy.aFmts[i]) aFmts[i] = new SvxNumberFormat(*rCopy.aFmts[i]); @@ -781,31 +749,31 @@ SvxNumRule::SvxNumRule(SvStream &rStream) ++nRefCount; LanguageType eLang = Application::GetSettings().GetLanguage(); aLocale = SvxCreateLocale(eLang); - USHORT nVersion; - USHORT nTemp; + sal_uInt16 nVersion; + sal_uInt16 nTemp; rStream >> nVersion; rStream >> nLevelCount; rStream >> nTemp; nFeatureFlags = nTemp; rStream >> nTemp; - bContinuousNumbering = (BOOL)nTemp; + bContinuousNumbering = (sal_Bool)nTemp; rStream >> nTemp; eNumberingType = (SvxNumRuleType)nTemp; memset( aFmts, 0, sizeof( aFmts )); - for(USHORT i = 0; i < SVX_MAX_NUM; i++) + for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) { - USHORT nSet; + sal_uInt16 nSet; rStream >> nSet; if(nSet) aFmts[i] = new SvxNumberFormat(rStream); else aFmts[i] = 0; - aFmtsSet[i] = aFmts[i] ? TRUE : FALSE; + aFmtsSet[i] = aFmts[i] ? sal_True : sal_False; } if(NUMITEM_VERSION_02 <= nVersion) { - USHORT nShort; + sal_uInt16 nShort; rStream >> nShort; nFeatureFlags = nShort; } @@ -813,20 +781,20 @@ SvxNumRule::SvxNumRule(SvStream &rStream) SvStream& SvxNumRule::Store(SvStream &rStream) { - rStream<<(USHORT)NUMITEM_VERSION_03; + rStream<<(sal_uInt16)NUMITEM_VERSION_03; rStream<<nLevelCount; //first save of nFeatureFlags for old versions - rStream<<(USHORT)nFeatureFlags; - rStream<<(USHORT)bContinuousNumbering; - rStream<<(USHORT)eNumberingType; + rStream<<(sal_uInt16)nFeatureFlags; + rStream<<(sal_uInt16)bContinuousNumbering; + rStream<<(sal_uInt16)eNumberingType; FontToSubsFontConverter pConverter = 0; - BOOL bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50; - for(USHORT i = 0; i < SVX_MAX_NUM; i++) + sal_Bool bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50; + for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) { if(aFmts[i]) { - rStream << USHORT(1); + rStream << sal_uInt16(1); if(bConvertBulletFont && aFmts[i]->GetBulletFont()) { if(!pConverter) @@ -837,10 +805,10 @@ SvStream& SvxNumRule::Store(SvStream &rStream) aFmts[i]->Store(rStream, pConverter); } else - rStream << USHORT(0); + rStream << sal_uInt16(0); } //second save of nFeatureFlags for new versions - rStream<<(USHORT)nFeatureFlags; + rStream<<(sal_uInt16)nFeatureFlags; if(pConverter) DestroyFontToSubsFontConverter(pConverter); @@ -849,7 +817,7 @@ SvStream& SvxNumRule::Store(SvStream &rStream) SvxNumRule::~SvxNumRule() { - for(USHORT i = 0; i < SVX_MAX_NUM; i++) + for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) delete aFmts[i]; if(!--nRefCount) { @@ -864,7 +832,7 @@ SvxNumRule& SvxNumRule::operator=( const SvxNumRule& rCopy ) nFeatureFlags = rCopy.nFeatureFlags; bContinuousNumbering = rCopy.bContinuousNumbering; eNumberingType = rCopy.eNumberingType; - for(USHORT i = 0; i < SVX_MAX_NUM; i++) + for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) { delete aFmts[i]; if(rCopy.aFmts[i]) @@ -882,8 +850,8 @@ int SvxNumRule::operator==( const SvxNumRule& rCopy) const nFeatureFlags != rCopy.nFeatureFlags || bContinuousNumbering != rCopy.bContinuousNumbering || eNumberingType != rCopy.eNumberingType) - return FALSE; - for(USHORT i = 0; i < nLevelCount; i++) + return sal_False; + for(sal_uInt16 i = 0; i < nLevelCount; i++) { if ( (aFmtsSet[i] != rCopy.aFmtsSet[i]) || @@ -892,22 +860,22 @@ int SvxNumRule::operator==( const SvxNumRule& rCopy) const (aFmts[i] && *aFmts[i] != *rCopy.aFmts[i]) ) { - return FALSE; + return sal_False; } } - return TRUE; + return sal_True; } -const SvxNumberFormat* SvxNumRule::Get(USHORT nLevel)const +const SvxNumberFormat* SvxNumRule::Get(sal_uInt16 nLevel)const { - DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" ); + DBG_ASSERT(nLevel < SVX_MAX_NUM, "Wrong Level" ); if( nLevel < SVX_MAX_NUM ) return aFmtsSet[nLevel] ? aFmts[nLevel] : 0; else return 0; } -const SvxNumberFormat& SvxNumRule::GetLevel(USHORT nLevel)const +const SvxNumberFormat& SvxNumRule::GetLevel(sal_uInt16 nLevel)const { if(!pStdNumFmt) { @@ -915,17 +883,16 @@ const SvxNumberFormat& SvxNumRule::GetLevel(USHORT nLevel)const pStdOutlineNumFmt = new SvxNumberFormat(SVX_NUM_NUMBER_NONE); } - DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" ); + DBG_ASSERT(nLevel < SVX_MAX_NUM, "Wrong Level" ); return ( ( nLevel < SVX_MAX_NUM ) && aFmts[nLevel] ) ? *aFmts[nLevel] : eNumberingType == SVX_RULETYPE_NUMBERING ? *pStdNumFmt : *pStdOutlineNumFmt; } - -void SvxNumRule::SetLevel( USHORT i, const SvxNumberFormat& rNumFmt, BOOL bIsValid ) +void SvxNumRule::SetLevel( sal_uInt16 i, const SvxNumberFormat& rNumFmt, sal_Bool bIsValid ) { - DBG_ASSERT(i < SVX_MAX_NUM, "falsches Level" ); + DBG_ASSERT(i < SVX_MAX_NUM, "Wrong Level" ); if( (i < SVX_MAX_NUM) && (!aFmtsSet[i] || !(rNumFmt == *Get( i ))) ) { @@ -935,9 +902,9 @@ void SvxNumRule::SetLevel( USHORT i, const SvxNumberFormat& rNumFmt, BOOL bIsVal } } -void SvxNumRule::SetLevel(USHORT nLevel, const SvxNumberFormat* pFmt) +void SvxNumRule::SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt) { - DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" ); + DBG_ASSERT(nLevel < SVX_MAX_NUM, "Wrong Level" ); if( nLevel < SVX_MAX_NUM ) { @@ -952,7 +919,7 @@ void SvxNumRule::SetLevel(USHORT nLevel, const SvxNumberFormat* pFmt) } } -String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, BOOL bInclStrings ) const +String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings ) const { String aStr; if( SVX_NO_NUM > rNum.GetLevel() && !( SVX_NO_NUMLEVEL & rNum.GetLevel() ) ) @@ -960,12 +927,12 @@ String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, BOOL bInclStrings ) c const SvxNumberFormat& rMyNFmt = GetLevel( rNum.GetLevel() ); if( SVX_NUM_NUMBER_NONE != rMyNFmt.GetNumberingType() ) { - BYTE i = rNum.GetLevel(); + sal_uInt8 i = rNum.GetLevel(); if( !IsContinuousNumbering() && - 1 < rMyNFmt.GetIncludeUpperLevels() ) // nur der eigene Level ? + 1 < rMyNFmt.GetIncludeUpperLevels() ) // only on own level? { - BYTE n = rMyNFmt.GetIncludeUpperLevels(); + sal_uInt8 n = rMyNFmt.GetIncludeUpperLevels(); if( 1 < n ) { if( i+1 >= n ) @@ -980,9 +947,6 @@ String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, BOOL bInclStrings ) c const SvxNumberFormat& rNFmt = GetLevel( i ); if( SVX_NUM_NUMBER_NONE == rNFmt.GetNumberingType() ) { - // Soll aus 1.1.1 --> 2. NoNum --> 1..1 oder 1.1 ?? - // if( i != rNum.nMyLevel ) - // aStr += aDotStr; continue; } @@ -995,7 +959,7 @@ String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, BOOL bInclStrings ) c bDot = sal_False; } else - aStr += sal_Unicode('0'); // alle 0-Level sind eine 0 + aStr += sal_Unicode('0'); // all 0-levels are a 0 if( i != rNum.GetLevel() && bDot) aStr += sal_Unicode('.'); } @@ -1011,10 +975,10 @@ String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, BOOL bInclStrings ) c } // changes linked to embedded bitmaps -BOOL SvxNumRule::UnLinkGraphics() +sal_Bool SvxNumRule::UnLinkGraphics() { - BOOL bRet = FALSE; - for(USHORT i = 0; i < GetLevelCount(); i++) + sal_Bool bRet = sal_False; + for(sal_uInt16 i = 0; i < GetLevelCount(); i++) { SvxNumberFormat aFmt(GetLevel(i)); const SvxBrushItem* pBrush = aFmt.GetBrush(); @@ -1032,7 +996,7 @@ BOOL SvxNumRule::UnLinkGraphics() aTempItem.SetGraphic(*pGraphic); sal_Int16 eOrient = aFmt.GetVertOrient(); aFmt.SetGraphicBrush( &aTempItem, &aFmt.GetGraphicSize(), &eOrient ); - bRet = TRUE; + bRet = sal_True; } } else if((SVX_NUM_BITMAP|LINK_TOKEN) == aFmt.GetNumberingType()) @@ -1048,13 +1012,13 @@ SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule) : { } -SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule, USHORT _nWhich ) : +SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule, sal_uInt16 _nWhich ) : SfxPoolItem(_nWhich), pNumRule(new SvxNumRule(rRule)) { } -SfxPoolItem* SvxNumBulletItem::Create(SvStream &s, USHORT n) const +SfxPoolItem* SvxNumBulletItem::Create(SvStream &s, sal_uInt16 n) const { return SfxPoolItem::Create(s, n ); } @@ -1080,24 +1044,24 @@ SfxPoolItem* SvxNumBulletItem::Clone( SfxItemPool * ) const return new SvxNumBulletItem(*this); } -USHORT SvxNumBulletItem::GetVersion( USHORT /*nFileVersion*/ ) const +sal_uInt16 SvxNumBulletItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const { return NUMITEM_VERSION_03; } -SvStream& SvxNumBulletItem::Store(SvStream &rStream, USHORT /*nItemVersion*/ )const +SvStream& SvxNumBulletItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/ )const { pNumRule->Store(rStream); return rStream; } -bool SvxNumBulletItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const +bool SvxNumBulletItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { rVal <<= SvxCreateNumRule( pNumRule ); return true; } -bool SvxNumBulletItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) +bool SvxNumBulletItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { uno::Reference< container::XIndexReplace > xRule; if( rVal >>= xRule ) @@ -1123,12 +1087,12 @@ bool SvxNumBulletItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nM return false; } -SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, USHORT nLevels, SvxNumRuleType eType ) +SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevels, SvxNumRuleType eType ) { - const USHORT nSrcLevels = pRule->GetLevelCount(); + const sal_uInt16 nSrcLevels = pRule->GetLevelCount(); SvxNumRule* pNewRule = new SvxNumRule( pRule->GetFeatureFlags(), nLevels, pRule->IsContinuousNumbering(), eType ); - for( USHORT nLevel = 0; (nLevel < nLevels) && (nLevel < nSrcLevels); nLevel++ ) + for( sal_uInt16 nLevel = 0; (nLevel < nLevels) && (nLevel < nSrcLevels); nLevel++ ) pNewRule->SetLevel( nLevel, pRule->GetLevel( nLevel ) ); return pNewRule; diff --git a/editeng/source/items/page.src b/editeng/source/items/page.src index 9a39dc85e6..5d1448858a 100644 --- a/editeng/source/items/page.src +++ b/editeng/source/items/page.src @@ -29,154 +29,6 @@ #include <editeng/editrids.hrc> -String RID_SVXSTR_PAPER_A0 -{ - Text = "A0" ; -}; -String RID_SVXSTR_PAPER_A1 -{ - Text = "A1" ; -}; -String RID_SVXSTR_PAPER_A2 -{ - Text = "A2" ; -}; -String RID_SVXSTR_PAPER_A3 -{ - Text = "A3" ; -}; -String RID_SVXSTR_PAPER_A4 -{ - Text = "A4" ; -}; -String RID_SVXSTR_PAPER_A5 -{ - Text = "A5" ; -}; -String RID_SVXSTR_PAPER_B4_ISO -{ - Text = "B4 (ISO)" ; -}; -String RID_SVXSTR_PAPER_B5_ISO -{ - Text = "B5 (ISO)" ; -}; -String RID_SVXSTR_PAPER_LETTER -{ - Text = "Letter" ; -}; -String RID_SVXSTR_PAPER_LEGAL -{ - Text = "Legal" ; -}; -String RID_SVXSTR_PAPER_TABLOID -{ - Text = "Tabloid" ; -}; -String RID_SVXSTR_PAPER_USER -{ - Text [ en-US ] = "User Defined" ; -}; -String RID_SVXSTR_PAPER_B6_ISO -{ - Text = "B6 (ISO)" ; -}; -String RID_SVXSTR_PAPER_C4 -{ - Text = "C4 Envelope" ; -}; -String RID_SVXSTR_PAPER_C5 -{ - Text = "C5 Envelope" ; -}; -String RID_SVXSTR_PAPER_C6 -{ - Text = "C6 Envelope" ; -}; -String RID_SVXSTR_PAPER_C65 -{ - Text = "C6/5 Envelope" ; -}; -String RID_SVXSTR_PAPER_DL -{ - Text = "DL Envelope" ; -}; -String RID_SVXSTR_PAPER_DIA -{ - Text = "Dia Slide" ; -}; -String RID_SVXSTR_PAPER_SCREEN -{ - Text [ en-US ] = "Screen" ; -}; -String RID_SVXSTR_PAPER_C -{ - Text = "C" ; -}; -String RID_SVXSTR_PAPER_D -{ - Text = "D" ; -}; -String RID_SVXSTR_PAPER_E -{ - Text = "E" ; -}; -String RID_SVXSTR_PAPER_EXECUTIVE -{ - Text = "Executive" ; -}; -String RID_SVXSTR_PAPER_LEGAL2 -{ - Text = "Long Bond" ; -}; -String RID_SVXSTR_PAPER_MONARCH -{ - Text = "#8 (Monarch) Envelope" ; -}; -String RID_SVXSTR_PAPER_COM675 -{ - Text = "#6 3/4 (Personal) Envelope" ; -}; -String RID_SVXSTR_PAPER_COM9 -{ - Text = "#9 Envelope" ; -}; -String RID_SVXSTR_PAPER_COM10 -{ - Text = "#10 Envelope" ; -}; -String RID_SVXSTR_PAPER_COM11 -{ - Text = "#11 Envelope" ; -}; -String RID_SVXSTR_PAPER_COM12 -{ - Text = "#12 Envelope" ; -}; -String RID_SVXSTR_PAPER_KAI16 -{ - Text = "16 Kai" ; -}; -String RID_SVXSTR_PAPER_KAI32 -{ - Text = "32 Kai" ; -}; -String RID_SVXSTR_PAPER_KAI32BIG -{ - Text = "Big 32 Kai" ; -}; -String RID_SVXSTR_PAPER_B4_JIS -{ - Text = "B4 (JIS)" ; -}; -String RID_SVXSTR_PAPER_B5_JIS -{ - Text = "B5 (JIS)" ; -}; -String RID_SVXSTR_PAPER_B6_JIS -{ - Text = "B6 (JIS)" ; -}; String RID_SVXSTR_PAPERBIN { Text [ en-US ] = "Paper tray" ; diff --git a/editeng/source/items/paperinf.cxx b/editeng/source/items/paperinf.cxx index 280bd7650b..8796f6d7bc 100644 --- a/editeng/source/items/paperinf.cxx +++ b/editeng/source/items/paperinf.cxx @@ -40,12 +40,12 @@ #include <editeng/eerdll.hxx> /*-------------------------------------------------------------------- - Beschreibung: Ist der Printer gueltig + Description: Is the printer valid --------------------------------------------------------------------*/ -inline BOOL IsValidPrinter( const Printer* pPtr ) +inline sal_Bool IsValidPrinter( const Printer* pPtr ) { - return pPtr->GetName().Len() ? TRUE : FALSE; + return pPtr->GetName().Len() ? sal_True : sal_False; } //------------------------------------------------------------------------ @@ -58,10 +58,9 @@ Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit ) } /*------------------------------------------------------------------------ - Beschreibung: Papiergroesse der Druckers liefern, aligned auf - die eigenen Groessen. - Falls kein Printer im System eingestellt ist, - wird DIN A4 Portrait als Defaultpapiergroesse geliefert. + Description: Return the paper size of the printer, aligned to our + own sizes. If no Printer is set in the system, A4 portrait + will be delivered as the default paper size. ------------------------------------------------------------------------*/ //Is this method may be confused about the units it returns ? @@ -76,8 +75,8 @@ Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter ) if ( ePaper == PAPER_USER ) { - // Orientation nicht beruecksichtigen, da durch SV bereits - // die richtigen Masze eingestellt worden sind. + // Orientation not take into account, as the right size has + // been already set by SV Size aPaperSize = pPrinter->GetPaperSize(); const Size aInvalidSize; @@ -94,7 +93,7 @@ Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter ) const Orientation eOrient = pPrinter->GetOrientation(); Size aSize( GetPaperSize( ePaper ) ); - // bei Landscape die Seiten tauschen, ist bei SV schon geschehen + // for Landscape exchange the pages, has already been done by SV if ( eOrient == ORIENTATION_LANDSCAPE ) Swap( aSize ); return aSize; @@ -130,57 +129,12 @@ Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit ) } /*------------------------------------------------------------------------ - Beschreibung: String Repr"asentation f"ur die SV-Defines f"ur - Papiergroessen. + Description: String representation for the SV-defines of paper size ------------------------------------------------------------------------*/ String SvxPaperInfo::GetName( Paper ePaper ) { - USHORT nResId = 0; - - switch ( ePaper ) - { - case PAPER_A0: nResId = RID_SVXSTR_PAPER_A0; break; - case PAPER_A1: nResId = RID_SVXSTR_PAPER_A1; break; - case PAPER_A2: nResId = RID_SVXSTR_PAPER_A2; break; - case PAPER_A3: nResId = RID_SVXSTR_PAPER_A3; break; - case PAPER_A4: nResId = RID_SVXSTR_PAPER_A4; break; - case PAPER_A5: nResId = RID_SVXSTR_PAPER_A5; break; - case PAPER_B4_ISO: nResId = RID_SVXSTR_PAPER_B4_ISO; break; - case PAPER_B5_ISO: nResId = RID_SVXSTR_PAPER_B5_ISO; break; - case PAPER_LETTER: nResId = RID_SVXSTR_PAPER_LETTER; break; - case PAPER_LEGAL: nResId = RID_SVXSTR_PAPER_LEGAL; break; - case PAPER_TABLOID: nResId = RID_SVXSTR_PAPER_TABLOID; break; - case PAPER_USER: nResId = RID_SVXSTR_PAPER_USER; break; - case PAPER_B6_ISO: nResId = RID_SVXSTR_PAPER_B6_ISO; break; - case PAPER_ENV_C4: nResId = RID_SVXSTR_PAPER_C4; break; - case PAPER_ENV_C5: nResId = RID_SVXSTR_PAPER_C5; break; - case PAPER_ENV_C6: nResId = RID_SVXSTR_PAPER_C6; break; - case PAPER_ENV_C65: nResId = RID_SVXSTR_PAPER_C65; break; - case PAPER_ENV_DL: nResId = RID_SVXSTR_PAPER_DL; break; - case PAPER_SLIDE_DIA: nResId = RID_SVXSTR_PAPER_DIA; break; - case PAPER_SCREEN: nResId = RID_SVXSTR_PAPER_SCREEN; break; - case PAPER_C: nResId = RID_SVXSTR_PAPER_C; break; - case PAPER_D: nResId = RID_SVXSTR_PAPER_D; break; - case PAPER_E: nResId = RID_SVXSTR_PAPER_E; break; - case PAPER_EXECUTIVE: nResId = RID_SVXSTR_PAPER_EXECUTIVE;break; - case PAPER_FANFOLD_LEGAL_DE: nResId = RID_SVXSTR_PAPER_LEGAL2; break; - case PAPER_ENV_MONARCH: nResId = RID_SVXSTR_PAPER_MONARCH; break; - case PAPER_ENV_PERSONAL: nResId = RID_SVXSTR_PAPER_COM675; break; - case PAPER_ENV_9: nResId = RID_SVXSTR_PAPER_COM9; break; - case PAPER_ENV_10: nResId = RID_SVXSTR_PAPER_COM10; break; - case PAPER_ENV_11: nResId = RID_SVXSTR_PAPER_COM11; break; - case PAPER_ENV_12: nResId = RID_SVXSTR_PAPER_COM12; break; - case PAPER_KAI16: nResId = RID_SVXSTR_PAPER_KAI16; break; - case PAPER_KAI32: nResId = RID_SVXSTR_PAPER_KAI32; break; - case PAPER_KAI32BIG: nResId = RID_SVXSTR_PAPER_KAI32BIG; break; - case PAPER_B4_JIS: nResId = RID_SVXSTR_PAPER_B4_JIS; break; - case PAPER_B5_JIS: nResId = RID_SVXSTR_PAPER_B5_JIS; break; - case PAPER_B6_JIS: nResId = RID_SVXSTR_PAPER_B6_JIS; break; - default: DBG_ERRORFILE( "unknown papersize" ); - } - - return ( nResId > 0 ) ? String( EditResId( nResId ) ) : String(); + return String( Printer::GetPaperName( ePaper ) ); } diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index a89a7a62c7..3ad8db0640 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -124,15 +124,14 @@ int SvxLineSpacingItem::operator==( const SfxPoolItem& rAttr ) const const SvxLineSpacingItem& rLineSpace = (const SvxLineSpacingItem&)rAttr; return ( - // Gleiche Linespacing Rule? + // Same Linespacing Rule? (eLineSpace == rLineSpace.eLineSpace) - // Bei maximalem und minimalem Linespacing muss das Mass - // uebereinstimmen. + // For maximum and minimum Linespacing be the size must coincide. && (eLineSpace == SVX_LINE_SPACE_AUTO || nLineHeight == rLineSpace.nLineHeight) - // Gleiche Interlinespacing Rule? + // Same Linespacing Rule? && ( eInterLineSpace == rLineSpace.eInterLineSpace ) - // Entweder proportional oder draufaddieren eingestellt. + // Either set proportional or additive. && (( eInterLineSpace == SVX_INTER_LINE_SPACE_OFF) || (eInterLineSpace == SVX_INTER_LINE_SPACE_PROP && nPropLineSpace == rLineSpace.nPropLineSpace) @@ -141,15 +140,12 @@ int SvxLineSpacingItem::operator==( const SfxPoolItem& rAttr ) const 1 : 0; } -/*-----------------18.03.98 16:32------------------- - os: wer weiss noch, wieso das LineSpacingItem so - kompliziert ist? Fuer UNO koennen wir das nicht - gebrauchen. Da gibt es nur zwei Werte: - - ein sal_uInt16 fuer den Modus - - ein sal_uInt32 fuer alle Werte (Abstand, Hoehe, rel. Angaben) - ---------------------------------------------------*/ -bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +/* Who does still know why the LineSpacingItem is so complicated? + We can not use it for UNO since there are only two values: + - ein sal_uInt16 for the mode + - ein sal_uInt32 for all values (distance, height, rel. detail) +*/ +bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -188,15 +184,13 @@ bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const case 0 : rVal <<= aLSp; break; case MID_LINESPACE : rVal <<= aLSp.Mode; break; case MID_HEIGHT : rVal <<= aLSp.Height; break; - default: DBG_ERROR("Wrong MemberId!"); break; + default: OSL_FAIL("Wrong MemberId!"); break; } return true; } -/*-----------------18.03.98 16:32------------------- ---------------------------------------------------*/ -bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -212,7 +206,7 @@ bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) case 0 : bRet = (rVal >>= aLSp); break; case MID_LINESPACE : bRet = (rVal >>= aLSp.Mode); break; case MID_HEIGHT : bRet = (rVal >>= aLSp.Height); break; - default: DBG_ERROR("Wrong MemberId!"); break; + default: OSL_FAIL("Wrong MemberId!"); break; } if( bRet ) @@ -247,7 +241,7 @@ bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) eLineSpace = aLSp.Mode == style::LineSpacingMode::FIX ? SVX_LINE_SPACE_FIX : SVX_LINE_SPACE_MIN; nLineHeight = aLSp.Height; if(bConvert) - nLineHeight = (USHORT)MM100_TO_TWIP_UNSIGNED(nLineHeight); + nLineHeight = (sal_uInt16)MM100_TO_TWIP_UNSIGNED(nLineHeight); } break; } @@ -327,14 +321,14 @@ sal_uInt16 SvxLineSpacingItem::GetValueCount() const XubString SvxLineSpacingItem::GetValueTextByPos( sal_uInt16 nPos ) const { - //! Strings demnaechst aus Resource laden + //! load strings from resource XubString aText; switch ( nPos ) { - case SVX_LINESPACE_USER : aText.AppendAscii( "Benutzer" ); break; - case SVX_LINESPACE_ONE_LINE : aText.AppendAscii( "Einzeilig" ); break; - case SVX_LINESPACE_ONE_POINT_FIVE_LINES : aText.AppendAscii( "1,5zeilig" ); break; - case SVX_LINESPACE_TWO_LINES : aText.AppendAscii( "Zweizeilig" ); break; + case SVX_LINESPACE_USER : aText.AppendAscii( "User" ); break; + case SVX_LINESPACE_ONE_LINE : aText.AppendAscii( "One line" ); break; + case SVX_LINESPACE_ONE_POINT_FIVE_LINES : aText.AppendAscii( "1.5 line" ); break; + case SVX_LINESPACE_TWO_LINES : aText.AppendAscii( "Two lines" ); break; } return aText; } @@ -388,12 +382,8 @@ int SvxAdjustItem::operator==( const SfxPoolItem& rAttr ) const ? 1 : 0 ); } -/*-----------------18.03.98 16:15------------------- - ---------------------------------------------------*/ -bool SvxAdjustItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -409,13 +399,9 @@ bool SvxAdjustItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } return true; } -/*-----------------18.03.98 16:15------------------- ---------------------------------------------------*/ - -bool SvxAdjustItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -434,7 +420,7 @@ bool SvxAdjustItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) eVal != SVX_ADJUST_LEFT && eVal != SVX_ADJUST_BLOCK && eVal != SVX_ADJUST_CENTER) - return FALSE; + return sal_False; if(eVal < (sal_uInt16)SVX_ADJUST_END) nMemberId == MID_PARA_ADJUST ? SetAdjust((SvxAdjust)eVal) : @@ -556,7 +542,7 @@ SvStream& SvxAdjustItem::Store( SvStream& rStrm, sal_uInt16 nItemVersion ) const // class SvxWidowsItem --------------------------------------------------- -SvxWidowsItem::SvxWidowsItem(const BYTE nL, const USHORT nId ) : +SvxWidowsItem::SvxWidowsItem(const sal_uInt8 nL, const sal_uInt16 nId ) : SfxByteItem( nId, nL ) { } @@ -628,7 +614,7 @@ SfxItemPresentation SvxWidowsItem::GetPresentation // class SvxOrphansItem -------------------------------------------------- -SvxOrphansItem::SvxOrphansItem(const BYTE nL, const USHORT nId ) : +SvxOrphansItem::SvxOrphansItem(const sal_uInt8 nL, const sal_uInt16 nId ) : SfxByteItem( nId, nL ) { } @@ -710,9 +696,8 @@ SvxHyphenZoneItem::SvxHyphenZoneItem( const sal_Bool bHyph, const sal_uInt16 nId } // ----------------------------------------------------------------------- -bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -732,9 +717,8 @@ bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const return true; } // ----------------------------------------------------------------------- -bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Int16 nNewVal = 0; @@ -748,13 +732,13 @@ bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) bHyphen = Any2Bool(rVal); break; case MID_HYPHEN_MIN_LEAD: - nMinLead = (BYTE)nNewVal; + nMinLead = (sal_uInt8)nNewVal; break; case MID_HYPHEN_MIN_TRAIL: - nMinTrail = (BYTE)nNewVal; + nMinTrail = (sal_uInt8)nNewVal; break; case MID_HYPHEN_MAX_HYPHENS: - nMaxHyphens = (BYTE)nNewVal; + nMaxHyphens = (sal_uInt8)nNewVal; break; } return true; @@ -992,31 +976,7 @@ SvxTabStopItem& SvxTabStopItem::operator=( const SvxTabStopItem& rTSI ) return *this; } - -/* - enum ::com::sun::star::style::TabAlign -{ - TABALIGN_LEFT, - TABALIGN_CENTER, - TABALIGN_RIGHT, - TABALIGN_DECIMAL -}; - -struct ::com::sun::star::style::TabStop -{ - long Position; - ::com::sun::star::style::TabAlign ::com::sun::star::drawing::Alignment; - unsigned short DecimalChar; - unsigned short FillChar; -}; -typedef sequence ::com::sun::star::style::TabStop> TabSTopSequence; - - */ -/*-----------------19.03.98 08:50------------------- - ---------------------------------------------------*/ - -bool SvxTabStopItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1056,11 +1016,8 @@ bool SvxTabStopItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } return sal_True; } -/*-----------------19.03.98 08:50------------------- - ---------------------------------------------------*/ -bool SvxTabStopItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1192,7 +1149,6 @@ SfxItemPresentation SvxTabStopItem::GetPresentation if ( ePres > SFX_ITEM_PRESENTATION_NONE ) { -#ifndef SVX_LIGHT sal_Bool bComma = sal_False; for ( sal_uInt16 i = 0; i < Count(); ++i ) @@ -1208,7 +1164,6 @@ SfxItemPresentation SvxTabStopItem::GetPresentation bComma = sal_True; } } -#endif } return ePres; } @@ -1239,11 +1194,9 @@ SfxPoolItem* SvxTabStopItem::Create( SvStream& rStrm, sal_uInt16 ) const SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const { - //MA 05. Sep. 96: Default-Tabs werden nur noch fuer das default-Attr - //expandiert. Fuer vollstaendige Rueckwaertskompatibilitaet (<=304) - //muessten alle Tabs expandiert werden, dass blaeht aber das File u.U. - //enorm auf. - //Alles nur SWG! + // Default-Tabs are only expanded for the default Attribute. For complete + // backward compabillity (<=304) all tabs have to be expanded, this makes + // the files grow large in size. All only SWG! const SfxItemPool *pPool = SfxItemPool::GetStoringPool(); const bool bStoreDefTabs = pPool @@ -1384,24 +1337,22 @@ SfxPoolItem* SvxPageModelItem::Clone( SfxItemPool* ) const //------------------------------------------------------------------------ -bool SvxPageModelItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const +bool SvxPageModelItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) { case MID_AUTO: rVal <<= (sal_Bool) bAuto; break; case MID_NAME: rVal <<= ::rtl::OUString( GetValue() ); break; - default: DBG_ERROR("Wrong MemberId!"); return sal_False; + default: OSL_FAIL("Wrong MemberId!"); return sal_False; } return sal_True; } -bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) +bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet; ::rtl::OUString aStr; @@ -1409,7 +1360,7 @@ bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMem { case MID_AUTO: bRet = ( rVal >>= bAuto ); break; case MID_NAME: bRet = ( rVal >>= aStr ); if ( bRet ) SetValue(aStr); break; - default: DBG_ERROR("Wrong MemberId!"); return sal_False; + default: OSL_FAIL("Wrong MemberId!"); return sal_False; } return bRet; @@ -1460,19 +1411,19 @@ SfxPoolItem* SvxScriptSpaceItem::Clone( SfxItemPool * ) const return new SvxScriptSpaceItem( GetValue(), Which() ); } -SfxPoolItem* SvxScriptSpaceItem::Create(SvStream & rStrm, USHORT) const +SfxPoolItem* SvxScriptSpaceItem::Create(SvStream & rStrm, sal_uInt16) const { sal_Bool bFlag; rStrm >> bFlag; return new SvxScriptSpaceItem( bFlag, Which() ); } -USHORT SvxScriptSpaceItem::GetVersion( USHORT nFFVer ) const +sal_uInt16 SvxScriptSpaceItem::GetVersion( sal_uInt16 nFFVer ) const { DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || SOFFICE_FILEFORMAT_40==nFFVer || SOFFICE_FILEFORMAT_50==nFFVer, - "SvxTwoLinesItem: Gibt es ein neues Fileformat?" ); + "SvxTwoLinesItem: Is there a new file format? "); return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; } @@ -1513,19 +1464,19 @@ SfxPoolItem* SvxHangingPunctuationItem::Clone( SfxItemPool * ) const return new SvxHangingPunctuationItem( GetValue(), Which() ); } -SfxPoolItem* SvxHangingPunctuationItem::Create(SvStream & rStrm, USHORT) const +SfxPoolItem* SvxHangingPunctuationItem::Create(SvStream & rStrm, sal_uInt16) const { sal_Bool nValue; rStrm >> nValue; return new SvxHangingPunctuationItem( nValue, Which() ); } -USHORT SvxHangingPunctuationItem::GetVersion( USHORT nFFVer ) const +sal_uInt16 SvxHangingPunctuationItem::GetVersion( sal_uInt16 nFFVer ) const { DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || SOFFICE_FILEFORMAT_40==nFFVer || SOFFICE_FILEFORMAT_50==nFFVer, - "SvxHangingPunctuationItem: Gibt es ein neues Fileformat?" ); + "SvxHangingPunctuationItem: Is there a new file format? "); return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; } @@ -1560,37 +1511,29 @@ SvxForbiddenRuleItem::SvxForbiddenRuleItem( : SfxBoolItem( nId, bOn ) { } -/* -----------------------------29.11.00 11:23-------------------------------- - ---------------------------------------------------------------------------*/ SfxPoolItem* SvxForbiddenRuleItem::Clone( SfxItemPool * ) const { return new SvxForbiddenRuleItem( GetValue(), Which() ); } -/* -----------------------------29.11.00 11:23-------------------------------- - ---------------------------------------------------------------------------*/ -SfxPoolItem* SvxForbiddenRuleItem::Create(SvStream & rStrm, USHORT) const +SfxPoolItem* SvxForbiddenRuleItem::Create(SvStream & rStrm, sal_uInt16) const { sal_Bool nValue; rStrm >> nValue; return new SvxForbiddenRuleItem( nValue, Which() ); } -/* -----------------------------29.11.00 11:23-------------------------------- - ---------------------------------------------------------------------------*/ -USHORT SvxForbiddenRuleItem::GetVersion( USHORT nFFVer ) const +sal_uInt16 SvxForbiddenRuleItem::GetVersion( sal_uInt16 nFFVer ) const { DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || SOFFICE_FILEFORMAT_40==nFFVer || SOFFICE_FILEFORMAT_50==nFFVer, - "SvxForbiddenRuleItem: Gibt es ein neues Fileformat?" ); + "SvxForbiddenRuleItem: Is there a new file format? "); return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; } -/* -----------------------------29.11.00 11:23-------------------------------- - ---------------------------------------------------------------------------*/ SfxItemPresentation SvxForbiddenRuleItem::GetPresentation( SfxItemPresentation ePres, SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, @@ -1630,20 +1573,20 @@ SfxPoolItem* SvxParaVertAlignItem::Clone( SfxItemPool* ) const return new SvxParaVertAlignItem( GetValue(), Which() ); } -SfxPoolItem* SvxParaVertAlignItem::Create( SvStream& rStrm, USHORT ) const +SfxPoolItem* SvxParaVertAlignItem::Create( SvStream& rStrm, sal_uInt16 ) const { sal_uInt16 nVal; rStrm >> nVal; return new SvxParaVertAlignItem( nVal, Which() ); } -SvStream& SvxParaVertAlignItem::Store( SvStream & rStrm, USHORT ) const +SvStream& SvxParaVertAlignItem::Store( SvStream & rStrm, sal_uInt16 ) const { rStrm << GetValue(); return rStrm; } -USHORT SvxParaVertAlignItem::GetVersion( USHORT nFFVer ) const +sal_uInt16 SvxParaVertAlignItem::GetVersion( sal_uInt16 nFFVer ) const { return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; } @@ -1661,7 +1604,7 @@ SfxItemPresentation SvxParaVertAlignItem::GetPresentation( case SFX_ITEM_PRESENTATION_NAMELESS: case SFX_ITEM_PRESENTATION_COMPLETE: { - USHORT nTmp; + sal_uInt16 nTmp; switch( GetValue() ) { case AUTOMATIC: nTmp = RID_SVXITEMS_PARAVERTALIGN_AUTO; break; @@ -1680,19 +1623,19 @@ SfxItemPresentation SvxParaVertAlignItem::GetPresentation( } bool SvxParaVertAlignItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE /*nMemberId*/ ) const + sal_uInt8 /*nMemberId*/ ) const { rVal <<= (sal_Int16)GetValue(); return sal_True; } bool SvxParaVertAlignItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE /*nMemberId*/ ) + sal_uInt8 /*nMemberId*/ ) { sal_Int16 nVal = sal_Int16(); if((rVal >>= nVal) && nVal >=0 && nVal <= BOTTOM ) { - SetValue( (USHORT)nVal ); + SetValue( (sal_uInt16)nVal ); return sal_True; } else @@ -1716,19 +1659,19 @@ SfxPoolItem* SvxParaGridItem::Clone( SfxItemPool * ) const return new SvxParaGridItem( GetValue(), Which() ); } -SfxPoolItem* SvxParaGridItem::Create(SvStream & rStrm, USHORT) const +SfxPoolItem* SvxParaGridItem::Create(SvStream & rStrm, sal_uInt16) const { sal_Bool bFlag; rStrm >> bFlag; return new SvxParaGridItem( bFlag, Which() ); } -USHORT SvxParaGridItem::GetVersion( USHORT nFFVer ) const +sal_uInt16 SvxParaGridItem::GetVersion( sal_uInt16 nFFVer ) const { DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || SOFFICE_FILEFORMAT_40==nFFVer || SOFFICE_FILEFORMAT_50==nFFVer, - "SvxParaGridItem: Gibt es ein neues Fileformat?" ); + "SvxParaGridItem: Is there a new file format? "); return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; } diff --git a/editeng/source/items/svdfield.cxx b/editeng/source/items/svdfield.cxx index 8f262716f0..856364d3dd 100644 --- a/editeng/source/items/svdfield.cxx +++ b/editeng/source/items/svdfield.cxx @@ -7,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svdomeas.cxx,v $ - * $Revision: 1.35.18.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -36,30 +33,30 @@ SV_IMPL_PERSIST1(SdrMeasureField,SvxFieldData); -__EXPORT SdrMeasureField::~SdrMeasureField() +SdrMeasureField::~SdrMeasureField() { } -SvxFieldData* __EXPORT SdrMeasureField::Clone() const +SvxFieldData* SdrMeasureField::Clone() const { return new SdrMeasureField(*this); } -int __EXPORT SdrMeasureField::operator==(const SvxFieldData& rSrc) const +int SdrMeasureField::operator==(const SvxFieldData& rSrc) const { return eMeasureFieldKind==((SdrMeasureField&)rSrc).GetMeasureFieldKind(); } -void __EXPORT SdrMeasureField::Load(SvPersistStream& rIn) +void SdrMeasureField::Load(SvPersistStream& rIn) { - UINT16 nFieldKind; + sal_uInt16 nFieldKind; rIn>>nFieldKind; eMeasureFieldKind=(SdrMeasureFieldKind)nFieldKind; } -void __EXPORT SdrMeasureField::Save(SvPersistStream& rOut) +void SdrMeasureField::Save(SvPersistStream& rOut) { - rOut<<(UINT16)eMeasureFieldKind; + rOut<<(sal_uInt16)eMeasureFieldKind; } ////////////////////////////////////////////////////////////////////////////// diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 38795f0554..909f2c580e 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -43,20 +43,14 @@ #include <editeng/svxfont.hxx> #include <editeng/escpitem.hxx> -// Minimum: Prozentwert fuers kernen +// Minimum: Percentage of kernel #define MINKERNPERCENT 5 -// prop. Groesse der Kleinbuchstaben bei Kapitaelchen -#define KAPITAELCHENPROP 80 - #ifndef REDUCEDSVXFONT - const sal_Unicode CH_BLANK = sal_Unicode(' '); // ' ' Leerzeichen - static sal_Char __READONLY_DATA sDoubleSpace[] = " "; + const sal_Unicode CH_BLANK = sal_Unicode(' '); // ' ' Space character + static sal_Char const sDoubleSpace[] = " "; #endif -/************************************************************************* - * class SvxFont - *************************************************************************/ SvxFont::SvxFont() { @@ -75,10 +69,6 @@ SvxFont::SvxFont( const Font &rFont ) eLang = LANGUAGE_SYSTEM; } -/************************************************************************* - * class SvxFont: Copy-Ctor - *************************************************************************/ - SvxFont::SvxFont( const SvxFont &rFont ) : Font( rFont ) { @@ -89,12 +79,9 @@ SvxFont::SvxFont( const SvxFont &rFont ) eLang = rFont.GetLanguage(); } -/************************************************************************* - * static SvxFont::DrawArrow - *************************************************************************/ void SvxFont::DrawArrow( OutputDevice &rOut, const Rectangle& rRect, - const Size& rSize, const Color& rCol, BOOL bLeft ) + const Size& rSize, const Color& rCol, sal_Bool bLeft ) { long nLeft = ( rRect.Left() + rRect.Right() - rSize.Width() )/ 2; long nRight = nLeft + rSize.Width(); @@ -129,15 +116,12 @@ void SvxFont::DrawArrow( OutputDevice &rOut, const Rectangle& rRect, rOut.SetFillColor( aOldFillColor ); } -/************************************************************************* - * SvxFont::CalcCaseMap - *************************************************************************/ XubString SvxFont::CalcCaseMap( const XubString &rTxt ) const { if( !IsCaseMap() || !rTxt.Len() ) return rTxt; XubString aTxt( rTxt ); - // Ich muss mir noch die Sprache besorgen + // I still have to get the language const LanguageType eLng = LANGUAGE_DONTKNOW == eLang ? LANGUAGE_SYSTEM : eLang; @@ -159,15 +143,15 @@ XubString SvxFont::CalcCaseMap( const XubString &rTxt ) const } case SVX_CASEMAP_TITEL: { - // Jeder Wortbeginn wird gross geschrieben, - // der Rest des Wortes wird unbesehen uebernommen. - // Bug: wenn das Attribut mitten im Wort beginnt. - BOOL bBlank = TRUE; + // Every beginning of a word is capitalized, the rest of the word + // is taken over as is. + // Bug: if the attribute starts in the middle of the word. + sal_Bool bBlank = sal_True; - for( USHORT i = 0; i < aTxt.Len(); ++i ) + for( sal_uInt16 i = 0; i < aTxt.Len(); ++i ) { if( sal_Unicode(' ') == aTxt.GetChar(i) || sal_Unicode('\t') == aTxt.GetChar(i) ) - bBlank = TRUE; + bBlank = sal_True; else { if( bBlank ) @@ -176,7 +160,7 @@ XubString SvxFont::CalcCaseMap( const XubString &rTxt ) const aCharClass.toUpper( aTemp ); aTxt.Replace( i, 1, aTemp ); } - bBlank = FALSE; + bBlank = sal_False; } } break; @@ -191,16 +175,16 @@ XubString SvxFont::CalcCaseMap( const XubString &rTxt ) const } /************************************************************************* - * Hier beginnen die Methoden, die im Writer nicht benutzt werden koennen, - * deshalb kann man diesen Bereich durch setzen von REDUCEDSVXFONT ausklammern. +* Starting form here are the methods that can not be used in Writer, +* so we put this section to be excluded by REDUCEDSVXFONT. *************************************************************************/ #ifndef REDUCEDSVXFONT /************************************************************************* * class SvxDoCapitals - * die virtuelle Methode Do wird von SvxFont::DoOnCapitals abwechselnd mit - * den "Gross-" und "Kleinbuchstaben"-Teilen aufgerufen. - * Die Ableitungen von SvxDoCapitals erfuellen diese Methode mit Leben. + * The virtual Method Do si called by SvxFont::DoOnCapitals alternately + * the uppercase and lowercase parts. The derivate of SvxDoCapitals fills + * this method with life. *************************************************************************/ class SvxDoCapitals @@ -217,11 +201,11 @@ public: : pOut(_pOut), rTxt(_rTxt), nIdx(_nIdx), nLen(_nLen) { } - virtual void DoSpace( const BOOL bDraw ); + virtual void DoSpace( const sal_Bool bDraw ); virtual void SetSpace(); virtual void Do( const XubString &rTxt, const xub_StrLen nIdx, const xub_StrLen nLen, - const BOOL bUpper ) = 0; + const sal_Bool bUpper ) = 0; inline OutputDevice *GetOut() { return pOut; } inline const XubString &GetTxt() const { return rTxt; } @@ -229,17 +213,17 @@ public: xub_StrLen GetLen() const { return nLen; } }; -void SvxDoCapitals::DoSpace( const BOOL /*bDraw*/ ) { } +void SvxDoCapitals::DoSpace( const sal_Bool /*bDraw*/ ) { } void SvxDoCapitals::SetSpace() { } void SvxDoCapitals::Do( const XubString &/*_rTxt*/, const xub_StrLen /*_nIdx*/, - const xub_StrLen /*_nLen*/, const BOOL /*bUpper*/ ) { } + const xub_StrLen /*_nLen*/, const sal_Bool /*bUpper*/ ) { } /************************************************************************* * SvxFont::DoOnCapitals() const - * zerlegt den String in Gross- und Kleinbuchstaben und ruft jeweils die - * Methode SvxDoCapitals::Do( ) auf. + * Decomposes the String into uppercase and lowercase letters and then + * calls the method SvxDoCapitals::Do( ). *************************************************************************/ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const @@ -249,9 +233,9 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const const xub_StrLen nLen = STRING_LEN == nPartLen ? rDo.GetLen() : nPartLen; const XubString aTxt( CalcCaseMap( rTxt ) ); - const USHORT nTxtLen = Min( rTxt.Len(), nLen ); - USHORT nPos = 0; - USHORT nOldPos = nPos; + const sal_uInt16 nTxtLen = Min( rTxt.Len(), nLen ); + sal_uInt16 nPos = 0; + sal_uInt16 nOldPos = nPos; // #108210# // Test if string length differ between original and CaseMapped @@ -265,11 +249,11 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const while( nPos < nTxtLen ) { - // Erst kommen die Upper-Chars dran + // first in turn are teh uppercase letters - // 4251: Es gibt Zeichen, die Upper _und_ Lower sind (z.B. das Blank). - // Solche Zweideutigkeiten fuehren ins Chaos, deswegen werden diese - // Zeichen der Menge Lower zugeordnet ! + // There are characters that are both upper- and lower-case L (eg blank) + // Such ambiguities lead to chaos, this is why these characters are + // allocated to the lowercase characters! while( nPos < nTxtLen ) { @@ -291,16 +275,16 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const const XubString aSnippet(rTxt, nIdx + nOldPos, nPos-nOldPos); XubString aNewText = CalcCaseMap(aSnippet); - rDo.Do( aNewText, 0, aNewText.Len(), TRUE ); + rDo.Do( aNewText, 0, aNewText.Len(), sal_True ); } else { - rDo.Do( aTxt, nIdx + nOldPos, nPos-nOldPos, TRUE ); + rDo.Do( aTxt, nIdx + nOldPos, nPos-nOldPos, sal_True ); } nOldPos = nPos; } - // Nun werden die Lower-Chars verarbeitet (ohne Blanks) + // Now the lowercase are processed (without blanks) while( nPos < nTxtLen ) { sal_uInt32 nCharacterType = aCharClass.getCharacterType( aCharString, 0 ); @@ -321,22 +305,22 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const const XubString aSnippet(rTxt, nIdx + nOldPos, nPos - nOldPos); XubString aNewText = CalcCaseMap(aSnippet); - rDo.Do( aNewText, 0, aNewText.Len(), FALSE ); + rDo.Do( aNewText, 0, aNewText.Len(), sal_False ); } else { - rDo.Do( aTxt, nIdx + nOldPos, nPos-nOldPos, FALSE ); + rDo.Do( aTxt, nIdx + nOldPos, nPos-nOldPos, sal_False ); } nOldPos = nPos; } - // Nun werden die Blanks verarbeitet + // Now the blanks are<processed while( nPos < nTxtLen && CH_BLANK == aCharString && ++nPos < nTxtLen ) aCharString = rTxt.GetChar( nPos + nIdx ); if( nOldPos != nPos ) { - rDo.DoSpace( FALSE ); + rDo.DoSpace( sal_False ); if(bCaseMapLengthDiffers) { @@ -346,23 +330,20 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const const XubString aSnippet(rTxt, nIdx + nOldPos, nPos - nOldPos); XubString aNewText = CalcCaseMap(aSnippet); - rDo.Do( aNewText, 0, aNewText.Len(), FALSE ); + rDo.Do( aNewText, 0, aNewText.Len(), sal_False ); } else { - rDo.Do( aTxt, nIdx + nOldPos, nPos - nOldPos, FALSE ); + rDo.Do( aTxt, nIdx + nOldPos, nPos - nOldPos, sal_False ); } nOldPos = nPos; rDo.SetSpace(); } } - rDo.DoSpace( TRUE ); + rDo.DoSpace( sal_True ); } -/************************************************************************** - * SvxFont::SetPhysFont() - *************************************************************************/ void SvxFont::SetPhysFont( OutputDevice *pOut ) const { @@ -383,9 +364,6 @@ void SvxFont::SetPhysFont( OutputDevice *pOut ) const } } -/************************************************************************* - * SvxFont::ChgPhysFont() - *************************************************************************/ Font SvxFont::ChgPhysFont( OutputDevice *pOut ) const { @@ -394,9 +372,6 @@ Font SvxFont::ChgPhysFont( OutputDevice *pOut ) const return aOldFont; } -/************************************************************************* - * SvxFont::GetPhysTxtSize() - *************************************************************************/ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, const XubString &rTxt, const xub_StrLen nIdx, const xub_StrLen nLen ) const @@ -457,7 +432,7 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, const XubString &rTxt ) } Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const XubString &rTxt, - const USHORT nIdx, const USHORT nLen, sal_Int32* pDXArray ) const + const sal_uInt16 nIdx, const sal_uInt16 nLen, sal_Int32* pDXArray ) const { if ( !IsCaseMap() && !IsKern() ) return Size( pOut->GetTextArray( rTxt, pDXArray, nIdx, nLen ), @@ -479,22 +454,19 @@ Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const XubString &rTxt, { for ( xub_StrLen i = 0; i < nLen; i++ ) pDXArray[i] += ( (i+1) * long( nKern ) ); - // Der letzte ist um ein nKern zu gross: + // The last one is a nKern too big: pDXArray[nLen-1] -= nKern; } } return aTxtSize; } -/************************************************************************* - * SvxFont::GetTxtSize() - *************************************************************************/ Size SvxFont::GetTxtSize( const OutputDevice *pOut, const XubString &rTxt, const xub_StrLen nIdx, const xub_StrLen nLen ) { xub_StrLen nTmp = nLen; - if ( nTmp == STRING_LEN ) // schon initialisiert? + if ( nTmp == STRING_LEN ) // already initialized? nTmp = rTxt.Len(); Font aOldFont( ChgPhysFont((OutputDevice *)pOut) ); Size aTxtSize; @@ -507,9 +479,6 @@ Size SvxFont::GetTxtSize( const OutputDevice *pOut, const XubString &rTxt, return aTxtSize; } -/************************************************************************* - * SvxFont::DrawText() - *************************************************************************/ void SvxFont::DrawText( OutputDevice *pOut, const Point &rPos, const XubString &rTxt, @@ -517,7 +486,7 @@ void SvxFont::DrawText( OutputDevice *pOut, { if( !nLen || !rTxt.Len() ) return; xub_StrLen nTmp = nLen; - if ( nTmp == STRING_LEN ) // schon initialisiert? + if ( nTmp == STRING_LEN ) // already initialized? nTmp = rTxt.Len(); Point aPos( rPos ); if ( nEsc ) @@ -546,7 +515,7 @@ void SvxFont::QuickDrawText( OutputDevice *pOut, const Point &rPos, const XubString &rTxt, const xub_StrLen nIdx, const xub_StrLen nLen, const sal_Int32* pDXArray ) const { - // Font muss ins OutputDevice selektiert sein... + // Font has to be selected in OutputDevice... if ( !IsCaseMap() && !IsCapital() && !IsKern() && !IsEsc() ) { pOut->DrawTextArray( rPos, rTxt, pDXArray, nIdx, nLen ); @@ -569,7 +538,7 @@ void SvxFont::QuickDrawText( OutputDevice *pOut, if( IsCapital() ) { - DBG_ASSERT( !pDXArray, "DrawCapital nicht fuer TextArray!" ); + DBG_ASSERT( !pDXArray, "DrawCapital not for TextArray!" ); DrawCapital( pOut, aPos, rTxt, nIdx, nLen ); } else @@ -593,7 +562,6 @@ void SvxFont::QuickDrawText( OutputDevice *pOut, } } -// ----------------------------------------------------------------------- void SvxFont::DrawPrev( OutputDevice *pOut, Printer* pPrinter, const Point &rPos, const XubString &rTxt, @@ -603,7 +571,7 @@ void SvxFont::DrawPrev( OutputDevice *pOut, Printer* pPrinter, return; xub_StrLen nTmp = nLen; - if ( nTmp == STRING_LEN ) // schon initialisiert? + if ( nTmp == STRING_LEN ) // already initialized? nTmp = rTxt.Len(); Point aPos( rPos ); @@ -655,7 +623,6 @@ void SvxFont::DrawPrev( OutputDevice *pOut, Printer* pPrinter, pPrinter->SetFont( aOldPrnFont ); } -// ----------------------------------------------------------------------- SvxFont& SvxFont::operator=( const Font& rFont ) { @@ -674,13 +641,6 @@ SvxFont& SvxFont::operator=( const SvxFont& rFont ) return *this; } - -/************************************************************************* - * class SvxDoGetCapitalSize - * wird von SvxFont::GetCapitalSize() zur Berechnung der TxtSize bei - * eingestellten Kapitaelchen benutzt. - *************************************************************************/ - class SvxDoGetCapitalSize : public SvxDoCapitals { protected: @@ -697,19 +657,19 @@ public: { } virtual void Do( const XubString &rTxt, const xub_StrLen nIdx, - const xub_StrLen nLen, const BOOL bUpper ); + const xub_StrLen nLen, const sal_Bool bUpper ); inline const Size &GetSize() const { return aTxtSize; }; }; void SvxDoGetCapitalSize::Do( const XubString &_rTxt, const xub_StrLen _nIdx, - const xub_StrLen _nLen, const BOOL bUpper ) + const xub_StrLen _nLen, const sal_Bool bUpper ) { Size aPartSize; if ( !bUpper ) { - BYTE nProp = pFont->GetPropr(); - pFont->SetProprRel( KAPITAELCHENPROP ); + sal_uInt8 nProp = pFont->GetPropr(); + pFont->SetProprRel( SMALL_CAPS_PERCENTAGE ); pFont->SetPhysFont( pOut ); aPartSize.setWidth( pOut->GetTextWidth( _rTxt, _nIdx, _nLen ) ); aPartSize.setHeight( pOut->GetTextHeight() ); @@ -726,11 +686,6 @@ void SvxDoGetCapitalSize::Do( const XubString &_rTxt, const xub_StrLen _nIdx, aTxtSize.Width() += ( _nLen * long( nKern ) ); } -/************************************************************************* - * SvxFont::GetCapitalSize() - * berechnet TxtSize, wenn Kapitaelchen eingestellt sind. - *************************************************************************/ - Size SvxFont::GetCapitalSize( const OutputDevice *pOut, const XubString &rTxt, const xub_StrLen nIdx, const xub_StrLen nLen) const { @@ -748,11 +703,6 @@ Size SvxFont::GetCapitalSize( const OutputDevice *pOut, const XubString &rTxt, return aTxtSize; } -/************************************************************************* - * class SvxDoDrawCapital - * wird von SvxFont::DrawCapital zur Ausgabe von Kapitaelchen benutzt. - *************************************************************************/ - class SvxDoDrawCapital : public SvxDoCapitals { protected: @@ -770,23 +720,23 @@ public: aSpacePos( rPos ), nKern( nKrn ) { } - virtual void DoSpace( const BOOL bDraw ); + virtual void DoSpace( const sal_Bool bDraw ); virtual void SetSpace(); virtual void Do( const XubString &rTxt, const xub_StrLen nIdx, - const xub_StrLen nLen, const BOOL bUpper ); + const xub_StrLen nLen, const sal_Bool bUpper ); }; -void SvxDoDrawCapital::DoSpace( const BOOL bDraw ) +void SvxDoDrawCapital::DoSpace( const sal_Bool bDraw ) { if ( bDraw || pFont->IsWordLineMode() ) { - USHORT nDiff = (USHORT)(aPos.X() - aSpacePos.X()); + sal_uInt16 nDiff = (sal_uInt16)(aPos.X() - aSpacePos.X()); if ( nDiff ) { - BOOL bWordWise = pFont->IsWordLineMode(); - BOOL bTrans = pFont->IsTransparent(); - pFont->SetWordLineMode( FALSE ); - pFont->SetTransparent( TRUE ); + sal_Bool bWordWise = pFont->IsWordLineMode(); + sal_Bool bTrans = pFont->IsTransparent(); + pFont->SetWordLineMode( sal_False ); + pFont->SetTransparent( sal_True ); pFont->SetPhysFont( pOut ); pOut->DrawStretchText( aSpacePos, nDiff, XubString( sDoubleSpace, RTL_TEXTENCODING_MS_1252 ), 0, 2 ); @@ -804,12 +754,12 @@ void SvxDoDrawCapital::SetSpace() } void SvxDoDrawCapital::Do( const XubString &_rTxt, const xub_StrLen _nIdx, - const xub_StrLen _nLen, const BOOL bUpper) + const xub_StrLen _nLen, const sal_Bool bUpper) { - BYTE nProp = 0; + sal_uInt8 nProp = 0; Size aPartSize; - // Einstellen der gewuenschten Fonts + // Set the desired font FontUnderline eUnder = pFont->GetUnderline(); FontStrikeout eStrike = pFont->GetStrikeout(); pFont->SetUnderline( UNDERLINE_NONE ); @@ -817,7 +767,7 @@ void SvxDoDrawCapital::Do( const XubString &_rTxt, const xub_StrLen _nIdx, if ( !bUpper ) { nProp = pFont->GetPropr(); - pFont->SetProprRel( KAPITAELCHENPROP ); + pFont->SetProprRel( SMALL_CAPS_PERCENTAGE ); } pFont->SetPhysFont( pOut ); @@ -831,7 +781,7 @@ void SvxDoDrawCapital::Do( const XubString &_rTxt, const xub_StrLen _nIdx, } pOut->DrawStretchText(aPos,nWidth-nKern,_rTxt,_nIdx,_nLen); - // Font restaurieren + // Restore Font pFont->SetUnderline( eUnder ); pFont->SetStrikeout( eStrike ); if ( !bUpper ) @@ -842,7 +792,7 @@ void SvxDoDrawCapital::Do( const XubString &_rTxt, const xub_StrLen _nIdx, } /************************************************************************* - * SvxFont::DrawCapital() gibt Kapitaelchen aus. + * SvxFont::DrawCapital() draws the uppercase letter. *************************************************************************/ void SvxFont::DrawCapital( OutputDevice *pOut, diff --git a/editeng/source/items/svxitems.src b/editeng/source/items/svxitems.src index d99c004f29..1cc547cebe 100644 --- a/editeng/source/items/svxitems.src +++ b/editeng/source/items/svxitems.src @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svxitems.src,v $ - * $Revision: 1.83.212.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,7 +28,7 @@ #include <editeng/editrids.hrc> // pragma ------------------------------------------------------------------- - // Value-Strings ------------------------------------------------------------ + // Value strings ------------------------------------------------------------ String RID_SVXITEMS_TRUE { Text [ en-US ] = "True" ; @@ -544,69 +541,61 @@ String RID_SVXITEMS_TAB_ADJUST_DEFAULT { Text [ en-US ] = "Default" ; }; -String RID_SINGLE_LINE0 -{ - Text [ en-US ] = "Single, fine lines" ; -}; -String RID_SINGLE_LINE1 -{ - Text [ en-US ] = "Single, thin" ; -}; -String RID_SINGLE_LINE2 +String RID_SOLID { - Text [ en-US ] = "Single, thick" ; + Text [ en-US ] = "Single, solid" ; }; -String RID_SINGLE_LINE3 +String RID_DOTTED { - Text [ en-US ] = "Single, very thick" ; + Text [ en-US ] = "Single, dotted" ; }; -String RID_SINGLE_LINE4 +String RID_DASHED { - Text [ en-US ] = "Single, bold" ; + Text [ en-US ] = "Single, dashed" ; }; -String RID_DOUBLE_LINE0 +String RID_DOUBLE { - Text [ en-US ] = "Double, fine lines, spacing: small" ; + Text [ en-US ] = "Double" ; }; -String RID_DOUBLE_LINE1 +String RID_THINTHICK_SMALLGAP { - Text [ en-US ] = "Double, fine line, spacing: large" ; + Text [ en-US ] = "Double, inside: fine, outside: thick, spacing: small"; }; -String RID_DOUBLE_LINE2 +String RID_THINTHICK_MEDIUMGAP { - Text [ en-US ] = "Double, thin, spacing: small" ; + Text [ en-US ] = "Double, inside: fine, outside: thick, spacing: medium"; }; -String RID_DOUBLE_LINE3 +String RID_THINTHICK_LARGEGAP { - Text [ en-US ] = "Double, thick, spacing: large" ; + Text [ en-US ] = "Double, inside: fine, outside: thick, spacing: large"; }; -String RID_DOUBLE_LINE4 +String RID_THICKTHIN_SMALLGAP { - Text [ en-US ] = "Double, inside: fine lines, outside: thin, spacing: large" ; + Text [ en-US ] = "Double, inside: thick, outside: fine, spacing: small"; }; -String RID_DOUBLE_LINE5 +String RID_THICKTHIN_MEDIUMGAP { - Text [ en-US ] = "Double, inside: fine lines, outside: thick, spacing: large" ; + Text [ en-US ] = "Double, inside: thick, outside: fine, spacing: medium"; }; -String RID_DOUBLE_LINE6 +String RID_THICKTHIN_LARGEGAP { - Text [ en-US ] = "Double, inside: fine lines, outside: very thick, spacing: large" ; + Text [ en-US ] = "Double, inside: thick, outside: fine, spacing: large"; }; -String RID_DOUBLE_LINE7 +String RID_EMBOSSED { - Text [ en-US ] = "Double, inside: thin, outside: thick, spacing: large" ; + Text [ en-US ] = "3D embossed" ; }; -String RID_DOUBLE_LINE8 +String RID_ENGRAVED { - Text [ en-US ] = "Double, inside: thick, outside: thin, spacing: small" ; + Text [ en-US ] = "3D engraved" ; }; -String RID_DOUBLE_LINE9 +String RID_INSET { - Text [ en-US ] = "Double, inside: thick, outside: very thick, spacing: large" ; + Text [ en-US ] = "Inset" ; }; -String RID_DOUBLE_LINE10 +String RID_OUTSET { - Text [ en-US ] = "Double, inside: very thick, outside: thick, Spacing: large" ; + Text [ en-US ] = "Outset" ; }; String RID_SVXITEMS_METRIC_MM { diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index e414e1e8c8..463aa93782 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -110,7 +110,6 @@ #include <editeng/itemtype.hxx> #include <editeng/eerdll.hxx> -// #90477# #include <tools/tenccvt.hxx> #define STORE_UNICODE_MAGIC_MARKER 0xFE331188 @@ -119,13 +118,13 @@ using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::text; -// Konvertierung fuer UNO +// Conversion for UNO #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) #define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L)) #define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L)) -BOOL SvxFontItem::bEnableStoreUnicodeNames = FALSE; +sal_Bool SvxFontItem::bEnableStoreUnicodeNames = sal_False; // STATIC DATA ----------------------------------------------------------- @@ -170,7 +169,7 @@ TYPEINIT1(SvxScriptSetItem, SfxSetItem ); // class SvxFontListItem ------------------------------------------------- SvxFontListItem::SvxFontListItem( const FontList* pFontLst, - const USHORT nId ) : + const sal_uInt16 nId ) : SfxPoolItem( nId ), pFontList( pFontLst ) { @@ -179,7 +178,7 @@ SvxFontListItem::SvxFontListItem( const FontList* pFontLst, sal_Int32 nCount = pFontList->GetFontNameCount(); aFontNameSeq.realloc( nCount ); - for ( USHORT i = 0; i < nCount; i++ ) + for ( sal_uInt16 i = 0; i < nCount; i++ ) aFontNameSeq[i] = pFontList->GetFontName(i).GetName(); } } @@ -210,7 +209,7 @@ int SvxFontListItem::operator==( const SfxPoolItem& rAttr ) const return( pFontList == ((SvxFontListItem&)rAttr).pFontList ); } -bool SvxFontListItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const +bool SvxFontListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { rVal <<= aFontNameSeq; return true; @@ -232,7 +231,7 @@ SfxItemPresentation SvxFontListItem::GetPresentation // class SvxFontItem ----------------------------------------------------- -SvxFontItem::SvxFontItem( const USHORT nId ) : +SvxFontItem::SvxFontItem( const sal_uInt16 nId ) : SfxPoolItem( nId ) { eFamily = FAMILY_SWISS; @@ -244,7 +243,7 @@ SvxFontItem::SvxFontItem( const USHORT nId ) : SvxFontItem::SvxFontItem( const FontFamily eFam, const XubString& aName, const XubString& aStName, const FontPitch eFontPitch, - const rtl_TextEncoding eFontTextEncoding, const USHORT nId ) : + const rtl_TextEncoding eFontTextEncoding, const sal_uInt16 nId ) : SfxPoolItem( nId ), @@ -257,10 +256,19 @@ SvxFontItem::SvxFontItem( const FontFamily eFam, const XubString& aName, } // ----------------------------------------------------------------------- +SvxFontItem& SvxFontItem::operator=(const SvxFontItem& rFont) +{ + aFamilyName = rFont.GetFamilyName(); + aStyleName = rFont.GetStyleName(); + eFamily = rFont.GetFamily(); + ePitch = rFont.GetPitch(); + eTextEncoding = rFont.GetCharSet(); + return *this; +} +// ----------------------------------------------------------------------- -bool SvxFontItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -288,9 +296,8 @@ bool SvxFontItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const return true; } // ----------------------------------------------------------------------- -bool SvxFontItem::PutValue( const uno::Any& rVal, BYTE nMemberId) +bool SvxFontItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -368,7 +375,7 @@ int SvxFontItem::operator==( const SfxPoolItem& rAttr ) const if ( ePitch != rItem.ePitch || eTextEncoding != rItem.eTextEncoding ) { bRet = sal_False; - DBG_WARNING( "FontItem::operator==(): nur Pitch oder rtl_TextEncoding unterschiedlich" ); + DBG_WARNING( "FontItem::operator==(): only pitch or rtl_TextEncoding different "); } } return bRet; @@ -383,17 +390,14 @@ SfxPoolItem* SvxFontItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxFontItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - BOOL bToBats = + sal_Bool bToBats = GetFamilyName().EqualsAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) || GetFamilyName().EqualsAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 ); - // #90477# rStrm << (BYTE) GetFamily() - // << (BYTE) GetPitch() - // << (BYTE)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetStoreCharSet( GetCharSet(), (USHORT)rStrm.GetVersion() ) ); - rStrm << (BYTE) GetFamily() << (BYTE) GetPitch() - << (BYTE)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion())); + rStrm << (sal_uInt8) GetFamily() << (sal_uInt8) GetPitch() + << (sal_uInt8)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion())); String aStoreFamilyName( GetFamilyName() ); if( bToBats ) @@ -401,7 +405,7 @@ SvStream& SvxFontItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const rStrm.WriteByteString(aStoreFamilyName); rStrm.WriteByteString(GetStyleName()); - // #96441# Kach for EditEngine, only set while creating clipboard stream. + // cach for EditEngine, only set while creating clipboard stream. if ( bEnableStoreUnicodeNames ) { sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER; @@ -415,9 +419,9 @@ SvStream& SvxFontItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const // ----------------------------------------------------------------------- -SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE _eFamily, eFontPitch, eFontTextEncoding; + sal_uInt8 _eFamily, eFontPitch, eFontTextEncoding; String aName, aStyle; rStrm >> _eFamily; rStrm >> eFontPitch; @@ -429,10 +433,10 @@ SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, USHORT) const // UNICODE: rStrm >> aStyle; rStrm.ReadByteString(aStyle); - // Task 91008/90471: set the "correct" textencoding - eFontTextEncoding = (BYTE)GetSOLoadTextEncoding( eFontTextEncoding, (USHORT)rStrm.GetVersion() ); + // Set the "correct" textencoding + eFontTextEncoding = (sal_uInt8)GetSOLoadTextEncoding( eFontTextEncoding, (sal_uInt16)rStrm.GetVersion() ); - // irgendwann wandelte sich der StarBats vom ANSI- zum SYMBOL-Font + // at some point, the StarBats changes from ANSI font to SYMBOL font if ( RTL_TEXTENCODING_SYMBOL != eFontTextEncoding && aName.EqualsAscii("StarBats") ) eFontTextEncoding = RTL_TEXTENCODING_SYMBOL; @@ -482,15 +486,15 @@ SfxItemPresentation SvxFontItem::GetPresentation //------------------------------------------------------------------------ -void SvxFontItem::EnableStoreUnicodeNames( BOOL bEnable ) +void SvxFontItem::EnableStoreUnicodeNames( sal_Bool bEnable ) { bEnableStoreUnicodeNames = bEnable; } // class SvxPostureItem -------------------------------------------------- -SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const USHORT nId ) : - SfxEnumItem( nId, (USHORT)ePosture ) +SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)ePosture ) { } @@ -503,24 +507,24 @@ SfxPoolItem* SvxPostureItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -USHORT SvxPostureItem::GetValueCount() const +sal_uInt16 SvxPostureItem::GetValueCount() const { - return ITALIC_NORMAL + 1; // auch ITALIC_NONE geh"ort dazu + return ITALIC_NORMAL + 1; // ITALIC_NONE also belongs here } // ----------------------------------------------------------------------- -SvStream& SvxPostureItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxPostureItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - rStrm << (BYTE)GetValue(); + rStrm << (sal_uInt8)GetValue(); return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxPostureItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxPostureItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE nPosture; + sal_uInt8 nPosture; rStrm >> nPosture; return new SvxPostureItem( (const FontItalic)nPosture, Which() ); } @@ -551,13 +555,13 @@ SfxItemPresentation SvxPostureItem::GetPresentation // ----------------------------------------------------------------------- -XubString SvxPostureItem::GetValueTextByPos( USHORT nPos ) const +XubString SvxPostureItem::GetValueTextByPos( sal_uInt16 nPos ) const { - DBG_ASSERT( nPos <= (USHORT)ITALIC_NORMAL, "enum overflow!" ); + DBG_ASSERT( nPos <= (sal_uInt16)ITALIC_NORMAL, "enum overflow!" ); XubString sTxt; FontItalic eItalic = (FontItalic)nPos; - USHORT nId = 0; + sal_uInt16 nId = 0; switch ( eItalic ) { @@ -572,13 +576,8 @@ XubString SvxPostureItem::GetValueTextByPos( USHORT nPos ) const return sTxt; } - -/*-----------------13.03.98 14:28------------------- - ---------------------------------------------------*/ -bool SvxPostureItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxPostureItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -586,17 +585,14 @@ bool SvxPostureItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const rVal = Bool2Any(GetBoolValue()); break; case MID_POSTURE: - rVal <<= (awt::FontSlant)GetValue(); // Werte von awt::FontSlant und FontItalic sind gleich + rVal <<= (awt::FontSlant)GetValue(); // values from awt::FontSlant and FontItalic are equal break; } return true; } -/*-----------------13.03.98 14:28------------------- ---------------------------------------------------*/ -bool SvxPostureItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -614,7 +610,7 @@ bool SvxPostureItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) eSlant = (awt::FontSlant)nValue; } - SetValue((USHORT)eSlant); + SetValue((sal_uInt16)eSlant); } } return true; @@ -628,7 +624,7 @@ int SvxPostureItem::HasBoolValue() const // ----------------------------------------------------------------------- -BOOL SvxPostureItem::GetBoolValue() const +sal_Bool SvxPostureItem::GetBoolValue() const { return ( (FontItalic)GetValue() >= ITALIC_OBLIQUE ); } @@ -637,13 +633,13 @@ BOOL SvxPostureItem::GetBoolValue() const void SvxPostureItem::SetBoolValue( sal_Bool bVal ) { - SetValue( (USHORT)(bVal ? ITALIC_NORMAL : ITALIC_NONE) ); + SetValue( (sal_uInt16)(bVal ? ITALIC_NORMAL : ITALIC_NONE) ); } // class SvxWeightItem --------------------------------------------------- -SvxWeightItem::SvxWeightItem( const FontWeight eWght, const USHORT nId ) : - SfxEnumItem( nId, (USHORT)eWght ) +SvxWeightItem::SvxWeightItem( const FontWeight eWght, const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)eWght ) { } @@ -667,14 +663,14 @@ sal_Bool SvxWeightItem::GetBoolValue() const void SvxWeightItem::SetBoolValue( sal_Bool bVal ) { - SetValue( (USHORT)(bVal ? WEIGHT_BOLD : WEIGHT_NORMAL) ); + SetValue( (sal_uInt16)(bVal ? WEIGHT_BOLD : WEIGHT_NORMAL) ); } // ----------------------------------------------------------------------- -USHORT SvxWeightItem::GetValueCount() const +sal_uInt16 SvxWeightItem::GetValueCount() const { - return WEIGHT_BLACK; // WEIGHT_DONTKNOW geh"ort nicht dazu + return WEIGHT_BLACK; // WEIGHT_DONTKNOW does not belong } // ----------------------------------------------------------------------- @@ -686,17 +682,17 @@ SfxPoolItem* SvxWeightItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxWeightItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxWeightItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - rStrm << (BYTE)GetValue(); + rStrm << (sal_uInt8)GetValue(); return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxWeightItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxWeightItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE nWeight; + sal_uInt8 nWeight; rStrm >> nWeight; return new SvxWeightItem( (FontWeight)nWeight, Which() ); } @@ -727,18 +723,14 @@ SfxItemPresentation SvxWeightItem::GetPresentation // ----------------------------------------------------------------------- -XubString SvxWeightItem::GetValueTextByPos( USHORT nPos ) const +XubString SvxWeightItem::GetValueTextByPos( sal_uInt16 nPos ) const { - DBG_ASSERT( nPos <= (USHORT)WEIGHT_BLACK, "enum overflow!" ); + DBG_ASSERT( nPos <= (sal_uInt16)WEIGHT_BLACK, "enum overflow!" ); return EE_RESSTR( RID_SVXITEMS_WEIGHT_BEGIN + nPos ); } -/*-----------------13.03.98 14:18------------------- - ---------------------------------------------------*/ -bool SvxWeightItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxWeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -753,12 +745,9 @@ bool SvxWeightItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } return true; } -/*-----------------13.03.98 14:18------------------- ---------------------------------------------------*/ -bool SvxWeightItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -775,7 +764,7 @@ bool SvxWeightItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) return sal_False; fValue = (float)nValue; } - SetValue( (USHORT)VCLUnoHelper::ConvertFontWeight((float)fValue) ); + SetValue( (sal_uInt16)VCLUnoHelper::ConvertFontWeight((float)fValue) ); } break; } @@ -784,12 +773,12 @@ bool SvxWeightItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) // class SvxFontHeightItem ----------------------------------------------- -SvxFontHeightItem::SvxFontHeightItem( const ULONG nSz, - const USHORT nPrp, - const USHORT nId ) : +SvxFontHeightItem::SvxFontHeightItem( const sal_uLong nSz, + const sal_uInt16 nPrp, + const sal_uInt16 nId ) : SfxPoolItem( nId ) { - SetHeight( nSz,nPrp ); // mit den Prozenten rechnen + SetHeight( nSz,nPrp ); // calculate in percentage } // ----------------------------------------------------------------------- @@ -801,17 +790,17 @@ SfxPoolItem* SvxFontHeightItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxFontHeightItem::Store( SvStream& rStrm , USHORT nItemVersion ) const +SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const { - rStrm << (USHORT)GetHeight(); + rStrm << (sal_uInt16)GetHeight(); if( FONTHEIGHT_UNIT_VERSION <= nItemVersion ) - rStrm << GetProp() << (USHORT)GetPropUnit(); + rStrm << GetProp() << (sal_uInt16)GetPropUnit(); else { - // JP 30.06.98: beim Export in alte Versionen geht die relative - // Angabe verloren, wenn es keine Prozentuale ist - USHORT _nProp = GetProp(); + // When exporting to the old versions the relative information is lost + // when there is no percentage + sal_uInt16 _nProp = GetProp(); if( SFX_MAPUNIT_RELATIVE != GetPropUnit() ) _nProp = 100; rStrm << _nProp; @@ -822,9 +811,9 @@ SvStream& SvxFontHeightItem::Store( SvStream& rStrm , USHORT nItemVersion ) cons // ----------------------------------------------------------------------- SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm, - USHORT nVersion ) const + sal_uInt16 nVersion ) const { - USHORT nsize, nprop = 0, nPropUnit = SFX_MAPUNIT_RELATIVE; + sal_uInt16 nsize, nprop = 0, nPropUnit = SFX_MAPUNIT_RELATIVE; rStrm >> nsize; @@ -832,9 +821,9 @@ SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm, rStrm >> nprop; else { - BYTE nP; + sal_uInt8 nP; rStrm >> nP; - nprop = (USHORT)nP; + nprop = (sal_uInt16)nP; } if( FONTHEIGHT_UNIT_VERSION <= nVersion ) @@ -855,13 +844,10 @@ int SvxFontHeightItem::operator==( const SfxPoolItem& rItem ) const GetPropUnit() == ((SvxFontHeightItem&)rItem).GetPropUnit(); } -/*-----------------13.03.98 14:53------------------- - ---------------------------------------------------*/ -bool SvxFontHeightItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { - // In StarOne sind im uno::Any immer 1/100mm. Ueber die MemberId wird - // gesteuert, ob der Wert im Item 1/100mm oder Twips sind. + // In StarOne is the uno::Any always 1/100mm. Through the MemberId it is + // controlled if the value in the Item should be 1/100mm or Twips. sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -871,8 +857,8 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const { ::com::sun::star::frame::status::FontHeight aFontHeight; - // Point (also Twips) sind gefragt, - // also umrechnen, wenn CONVERT_TWIPS nicht gesetzt ist + // Point (i.e. Twips) is asked for, thus re-calculate if + // CONVERT_TWIPS is not set. if( bConvert ) { long nTwips = bConvert ? nHeight : MM100_TO_TWIP_UNSIGNED(nHeight); @@ -912,8 +898,8 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const break; case MID_FONTHEIGHT: { - // Point (also Twips) sind gefragt, - // also umrechnen, wenn CONVERT_TWIPS nicht gesetzt ist + // Point (i.e. Twips) is asked for, thus re-calculate if + // CONVERT_TWIPS is not set. if( bConvert ) { long nTwips = bConvert ? nHeight : MM100_TO_TWIP_UNSIGNED(nHeight); @@ -957,9 +943,8 @@ bool SvxFontHeightItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } return sal_True; } -/* -----------------01.07.98 13:43------------------- - * Relative Abweichung aus der Hoehe herausrechnen - * --------------------------------------------------*/ + +// Calculate the relative deviation from the expected height. sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, SfxMapUnit eProp, sal_Bool bCoreInTwip) { sal_uInt32 nRet = nHeight; @@ -979,11 +964,11 @@ sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, SfxMapUn } break; case SFX_MAPUNIT_100TH_MM: - //dann ist die Core doch wohl auch in 1/100 mm + //then the core is surely also in 1/100 mm nDiff = (short)nProp; break; case SFX_MAPUNIT_TWIP: - // hier doch sicher TWIP + // Here surely TWIP nDiff = ((short)nProp); break; default: ;//prevent warning @@ -993,10 +978,7 @@ sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, SfxMapUn return nRet; } -/*-----------------13.03.98 14:53------------------- - ---------------------------------------------------*/ -bool SvxFontHeightItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1016,7 +998,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips if (!bConvert) - nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // umrechnen, wenn das Item 1/100mm enthaelt + nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // Convert, if the item contains 1/100mm nProp = aFontHeight.Prop; } @@ -1041,7 +1023,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips if (!bConvert) - nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // umrechnen, wenn das Item 1/100mm enthaelt + nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // Convert, if the item contains 1/100mm } break; case MID_FONTHEIGHT_PROP: @@ -1089,7 +1071,6 @@ SfxItemPresentation SvxFontHeightItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1117,13 +1098,12 @@ SfxItemPresentation SvxFontHeightItem::GetPresentation } default: ; //prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } // ----------------------------------------------------------------------- -USHORT SvxFontHeightItem::GetVersion(USHORT nFileVersion) const +sal_uInt16 SvxFontHeightItem::GetVersion(sal_uInt16 nFileVersion) const { return (nFileVersion <= SOFFICE_FILEFORMAT_40) ? FONTHEIGHT_16_VERSION @@ -1145,17 +1125,15 @@ bool SvxFontHeightItem::HasMetrics() const return true; } -void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const USHORT nNewProp, +void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp, SfxMapUnit eUnit ) { DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); -#ifndef SVX_LIGHT if( SFX_MAPUNIT_RELATIVE != eUnit ) nHeight = nNewHeight + ::ItemToControl( (short)nNewProp, eUnit, SFX_FUNIT_TWIP ); else -#endif // !SVX_LIGHT if( 100 != nNewProp ) nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 ); else @@ -1165,19 +1143,17 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const USHORT nNewProp, ePropUnit = eUnit; } -void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, USHORT nNewProp, +void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp, SfxMapUnit eMetric, SfxMapUnit eCoreMetric ) { DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); -#ifndef SVX_LIGHT if( SFX_MAPUNIT_RELATIVE != eMetric ) nHeight = nNewHeight + ::ControlToItem( ::ItemToControl((short)nNewProp, eMetric, SFX_FUNIT_TWIP ), SFX_FUNIT_TWIP, eCoreMetric ); else -#endif // !SVX_LIGHT if( 100 != nNewProp ) nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 ); else @@ -1189,7 +1165,7 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, USHORT nNewProp, // class SvxFontWidthItem ----------------------------------------------- -SvxFontWidthItem::SvxFontWidthItem( const USHORT nSz, const USHORT nPrp, const USHORT nId ) : +SvxFontWidthItem::SvxFontWidthItem( const sal_uInt16 nSz, const sal_uInt16 nPrp, const sal_uInt16 nId ) : SfxPoolItem( nId ) { nWidth = nSz; @@ -1205,7 +1181,7 @@ SfxPoolItem* SvxFontWidthItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxFontWidthItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxFontWidthItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { rStrm << GetWidth() << GetProp(); return rStrm; @@ -1215,7 +1191,7 @@ SvStream& SvxFontWidthItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) c bool SvxFontWidthItem::ScaleMetrics( long nMult, long nDiv ) { - nWidth = (USHORT)Scale( nWidth, nMult, nDiv ); + nWidth = (sal_uInt16)Scale( nWidth, nMult, nDiv ); return true; } @@ -1229,10 +1205,10 @@ bool SvxFontWidthItem::HasMetrics() const // ----------------------------------------------------------------------- SfxPoolItem* SvxFontWidthItem::Create( SvStream& rStrm, - USHORT /*nVersion*/ ) const + sal_uInt16 /*nVersion*/ ) const { - USHORT nS; - USHORT nP; + sal_uInt16 nS; + sal_uInt16 nP; rStrm >> nS; rStrm >> nP; @@ -1250,10 +1226,7 @@ int SvxFontWidthItem::operator==( const SfxPoolItem& rItem ) const GetProp() == ((SvxFontWidthItem&)rItem).GetProp(); } -/*-----------------13.03.98 16:03------------------- - ---------------------------------------------------*/ -bool SvxFontWidthItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxFontWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1268,10 +1241,8 @@ bool SvxFontWidthItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } return true; } -/*-----------------13.03.98 16:03------------------- ---------------------------------------------------*/ -bool SvxFontWidthItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxFontWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1301,7 +1272,6 @@ SfxItemPresentation SvxFontWidthItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1322,14 +1292,13 @@ SfxItemPresentation SvxFontWidthItem::GetPresentation } default: ; //prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } // class SvxTextLineItem ------------------------------------------------ -SvxTextLineItem::SvxTextLineItem( const FontUnderline eSt, const USHORT nId ) - : SfxEnumItem( nId, (USHORT)eSt ), mColor( COL_TRANSPARENT ) +SvxTextLineItem::SvxTextLineItem( const FontUnderline eSt, const sal_uInt16 nId ) + : SfxEnumItem( nId, (sal_uInt16)eSt ), mColor( COL_TRANSPARENT ) { } @@ -1351,7 +1320,7 @@ sal_Bool SvxTextLineItem::GetBoolValue() const void SvxTextLineItem::SetBoolValue( sal_Bool bVal ) { - SetValue( (USHORT)(bVal ? UNDERLINE_SINGLE : UNDERLINE_NONE) ); + SetValue( (sal_uInt16)(bVal ? UNDERLINE_SINGLE : UNDERLINE_NONE) ); } // ----------------------------------------------------------------------- @@ -1365,24 +1334,24 @@ SfxPoolItem* SvxTextLineItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -USHORT SvxTextLineItem::GetValueCount() const +sal_uInt16 SvxTextLineItem::GetValueCount() const { - return UNDERLINE_DOTTED + 1; // auch UNDERLINE_NONE geh"ort dazu + return UNDERLINE_DOTTED + 1; // UNDERLINE_NONE also belongs here } // ----------------------------------------------------------------------- -SvStream& SvxTextLineItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxTextLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - rStrm << (BYTE)GetValue(); + rStrm << (sal_uInt8)GetValue(); return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxTextLineItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxTextLineItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE nState; + sal_uInt8 nState; rStrm >> nState; return new SvxTextLineItem( (FontUnderline)nState, Which() ); } @@ -1397,7 +1366,6 @@ SfxItemPresentation SvxTextLineItem::GetPresentation XubString& rText, const IntlWrapper * /*pIntl*/ ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1411,24 +1379,19 @@ SfxItemPresentation SvxTextLineItem::GetPresentation return ePres; default: ; //prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } // ----------------------------------------------------------------------- -XubString SvxTextLineItem::GetValueTextByPos( USHORT /*nPos*/ ) const +XubString SvxTextLineItem::GetValueTextByPos( sal_uInt16 /*nPos*/ ) const { - DBG_ERROR("SvxTextLineItem::GetValueTextByPos: Pure virtual method"); + OSL_FAIL("SvxTextLineItem::GetValueTextByPos: Pure virtual method"); return XubString(); } -/*-----------------13.03.98 16:25------------------- - ---------------------------------------------------*/ -bool SvxTextLineItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxTextLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -1448,12 +1411,9 @@ bool SvxTextLineItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const return true; } -/*-----------------13.03.98 16:28------------------- ---------------------------------------------------*/ -bool SvxTextLineItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = sal_True; switch(nMemberId) @@ -1501,7 +1461,7 @@ int SvxTextLineItem::operator==( const SfxPoolItem& rItem ) const // class SvxUnderlineItem ------------------------------------------------ -SvxUnderlineItem::SvxUnderlineItem( const FontUnderline eSt, const USHORT nId ) +SvxUnderlineItem::SvxUnderlineItem( const FontUnderline eSt, const sal_uInt16 nId ) : SvxTextLineItem( eSt, nId ) { } @@ -1517,24 +1477,24 @@ SfxPoolItem* SvxUnderlineItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SfxPoolItem* SvxUnderlineItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxUnderlineItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE nState; + sal_uInt8 nState; rStrm >> nState; return new SvxUnderlineItem( (FontUnderline)nState, Which() ); } // ----------------------------------------------------------------------- -XubString SvxUnderlineItem::GetValueTextByPos( USHORT nPos ) const +XubString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 nPos ) const { - DBG_ASSERT( nPos <= (USHORT)UNDERLINE_BOLDWAVE, "enum overflow!" ); + DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" ); return EE_RESSTR( RID_SVXITEMS_UL_BEGIN + nPos ); } // class SvxOverlineItem ------------------------------------------------ -SvxOverlineItem::SvxOverlineItem( const FontUnderline eSt, const USHORT nId ) +SvxOverlineItem::SvxOverlineItem( const FontUnderline eSt, const sal_uInt16 nId ) : SvxTextLineItem( eSt, nId ) { } @@ -1550,25 +1510,25 @@ SfxPoolItem* SvxOverlineItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SfxPoolItem* SvxOverlineItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxOverlineItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE nState; + sal_uInt8 nState; rStrm >> nState; return new SvxOverlineItem( (FontUnderline)nState, Which() ); } // ----------------------------------------------------------------------- -XubString SvxOverlineItem::GetValueTextByPos( USHORT nPos ) const +XubString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const { - DBG_ASSERT( nPos <= (USHORT)UNDERLINE_BOLDWAVE, "enum overflow!" ); + DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" ); return EE_RESSTR( RID_SVXITEMS_OL_BEGIN + nPos ); } // class SvxCrossedOutItem ----------------------------------------------- -SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const USHORT nId ) - : SfxEnumItem( nId, (USHORT)eSt ) +SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const sal_uInt16 nId ) + : SfxEnumItem( nId, (sal_uInt16)eSt ) { } @@ -1590,14 +1550,14 @@ sal_Bool SvxCrossedOutItem::GetBoolValue() const void SvxCrossedOutItem::SetBoolValue( sal_Bool bVal ) { - SetValue( (USHORT)(bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE) ); + SetValue( (sal_uInt16)(bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE) ); } // ----------------------------------------------------------------------- -USHORT SvxCrossedOutItem::GetValueCount() const +sal_uInt16 SvxCrossedOutItem::GetValueCount() const { - return STRIKEOUT_DOUBLE + 1; // auch STRIKEOUT_NONE geh"ort dazu + return STRIKEOUT_DOUBLE + 1; // STRIKEOUT_NONE belongs also here } // ----------------------------------------------------------------------- @@ -1609,17 +1569,17 @@ SfxPoolItem* SvxCrossedOutItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxCrossedOutItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxCrossedOutItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - rStrm << (BYTE)GetValue(); + rStrm << (sal_uInt8)GetValue(); return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxCrossedOutItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxCrossedOutItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE eCross; + sal_uInt8 eCross; rStrm >> eCross; return new SvxCrossedOutItem( (FontStrikeout)eCross, Which() ); } @@ -1650,18 +1610,14 @@ SfxItemPresentation SvxCrossedOutItem::GetPresentation // ----------------------------------------------------------------------- -XubString SvxCrossedOutItem::GetValueTextByPos( USHORT nPos ) const +XubString SvxCrossedOutItem::GetValueTextByPos( sal_uInt16 nPos ) const { - DBG_ASSERT( nPos <= (USHORT)STRIKEOUT_X, "enum overflow!" ); + DBG_ASSERT( nPos <= (sal_uInt16)STRIKEOUT_X, "enum overflow!" ); return EE_RESSTR( RID_SVXITEMS_STRIKEOUT_BEGIN + nPos ); } -/*-----------------13.03.98 16:28------------------- - ---------------------------------------------------*/ -bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -1674,12 +1630,9 @@ bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } return true; } -/*-----------------13.03.98 16:29------------------- ---------------------------------------------------*/ -bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -1699,7 +1652,7 @@ bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) } // class SvxShadowedItem ------------------------------------------------- -SvxShadowedItem::SvxShadowedItem( const sal_Bool bShadowed, const USHORT nId ) : +SvxShadowedItem::SvxShadowedItem( const sal_Bool bShadowed, const sal_uInt16 nId ) : SfxBoolItem( nId, bShadowed ) { } @@ -1713,17 +1666,17 @@ SfxPoolItem* SvxShadowedItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxShadowedItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxShadowedItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - rStrm << (BYTE) GetValue(); + rStrm << (sal_uInt8) GetValue(); return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxShadowedItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxShadowedItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE nState; + sal_uInt8 nState; rStrm >> nState; return new SvxShadowedItem( nState, Which() ); } @@ -1746,7 +1699,7 @@ SfxItemPresentation SvxShadowedItem::GetPresentation case SFX_ITEM_PRESENTATION_NAMELESS: case SFX_ITEM_PRESENTATION_COMPLETE: { - USHORT nId = RID_SVXITEMS_SHADOWED_FALSE; + sal_uInt16 nId = RID_SVXITEMS_SHADOWED_FALSE; if ( GetValue() ) nId = RID_SVXITEMS_SHADOWED_TRUE; @@ -1760,7 +1713,7 @@ SfxItemPresentation SvxShadowedItem::GetPresentation // class SvxAutoKernItem ------------------------------------------------- -SvxAutoKernItem::SvxAutoKernItem( const sal_Bool bAutoKern, const USHORT nId ) : +SvxAutoKernItem::SvxAutoKernItem( const sal_Bool bAutoKern, const sal_uInt16 nId ) : SfxBoolItem( nId, bAutoKern ) { } @@ -1774,17 +1727,17 @@ SfxPoolItem* SvxAutoKernItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxAutoKernItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxAutoKernItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - rStrm << (BYTE) GetValue(); + rStrm << (sal_uInt8) GetValue(); return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxAutoKernItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxAutoKernItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE nState; + sal_uInt8 nState; rStrm >> nState; return new SvxAutoKernItem( nState, Which() ); } @@ -1807,7 +1760,7 @@ SfxItemPresentation SvxAutoKernItem::GetPresentation case SFX_ITEM_PRESENTATION_NAMELESS: case SFX_ITEM_PRESENTATION_COMPLETE: { - USHORT nId = RID_SVXITEMS_AUTOKERN_FALSE; + sal_uInt16 nId = RID_SVXITEMS_AUTOKERN_FALSE; if ( GetValue() ) nId = RID_SVXITEMS_AUTOKERN_TRUE; @@ -1822,7 +1775,7 @@ SfxItemPresentation SvxAutoKernItem::GetPresentation // class SvxWordLineModeItem --------------------------------------------- SvxWordLineModeItem::SvxWordLineModeItem( const sal_Bool bWordLineMode, - const USHORT nId ) : + const sal_uInt16 nId ) : SfxBoolItem( nId, bWordLineMode ) { } @@ -1836,7 +1789,7 @@ SfxPoolItem* SvxWordLineModeItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxWordLineModeItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxWordLineModeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { rStrm << (sal_Bool) GetValue(); return rStrm; @@ -1844,7 +1797,7 @@ SvStream& SvxWordLineModeItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ // ----------------------------------------------------------------------- -SfxPoolItem* SvxWordLineModeItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxWordLineModeItem::Create(SvStream& rStrm, sal_uInt16) const { sal_Bool bValue; rStrm >> bValue; @@ -1869,7 +1822,7 @@ SfxItemPresentation SvxWordLineModeItem::GetPresentation case SFX_ITEM_PRESENTATION_NAMELESS: case SFX_ITEM_PRESENTATION_COMPLETE: { - USHORT nId = RID_SVXITEMS_WORDLINE_FALSE; + sal_uInt16 nId = RID_SVXITEMS_WORDLINE_FALSE; if ( GetValue() ) nId = RID_SVXITEMS_WORDLINE_TRUE; @@ -1883,7 +1836,7 @@ SfxItemPresentation SvxWordLineModeItem::GetPresentation // class SvxContourItem -------------------------------------------------- -SvxContourItem::SvxContourItem( const sal_Bool bContoured, const USHORT nId ) : +SvxContourItem::SvxContourItem( const sal_Bool bContoured, const sal_uInt16 nId ) : SfxBoolItem( nId, bContoured ) { } @@ -1897,7 +1850,7 @@ SfxPoolItem* SvxContourItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxContourItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxContourItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { rStrm << (sal_Bool) GetValue(); return rStrm; @@ -1905,7 +1858,7 @@ SvStream& SvxContourItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) con // ----------------------------------------------------------------------- -SfxPoolItem* SvxContourItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxContourItem::Create(SvStream& rStrm, sal_uInt16) const { sal_Bool bValue; rStrm >> bValue; @@ -1930,7 +1883,7 @@ SfxItemPresentation SvxContourItem::GetPresentation case SFX_ITEM_PRESENTATION_NAMELESS: case SFX_ITEM_PRESENTATION_COMPLETE: { - USHORT nId = RID_SVXITEMS_CONTOUR_FALSE; + sal_uInt16 nId = RID_SVXITEMS_CONTOUR_FALSE; if ( GetValue() ) nId = RID_SVXITEMS_CONTOUR_TRUE; @@ -1944,7 +1897,7 @@ SfxItemPresentation SvxContourItem::GetPresentation // class SvxPropSizeItem ------------------------------------------------- -SvxPropSizeItem::SvxPropSizeItem( const USHORT nPercent, const USHORT nId ) : +SvxPropSizeItem::SvxPropSizeItem( const sal_uInt16 nPercent, const sal_uInt16 nId ) : SfxUInt16Item( nId, nPercent ) { } @@ -1958,17 +1911,17 @@ SfxPoolItem* SvxPropSizeItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxPropSizeItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxPropSizeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - rStrm << (USHORT) GetValue(); + rStrm << (sal_uInt16) GetValue(); return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxPropSizeItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxPropSizeItem::Create(SvStream& rStrm, sal_uInt16) const { - USHORT nSize; + sal_uInt16 nSize; rStrm >> nSize; return new SvxPropSizeItem( nSize, Which() ); } @@ -1989,7 +1942,7 @@ SfxItemPresentation SvxPropSizeItem::GetPresentation // class SvxColorItem ---------------------------------------------------- -SvxColorItem::SvxColorItem( const USHORT nId ) : +SvxColorItem::SvxColorItem( const sal_uInt16 nId ) : SfxPoolItem( nId ), mColor( COL_BLACK ) { @@ -1997,7 +1950,7 @@ SvxColorItem::SvxColorItem( const USHORT nId ) : // ----------------------------------------------------------------------- -SvxColorItem::SvxColorItem( const Color& rCol, const USHORT nId ) : +SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) : SfxPoolItem( nId ), mColor( rCol ) { @@ -2005,7 +1958,7 @@ SvxColorItem::SvxColorItem( const Color& rCol, const USHORT nId ) : // ----------------------------------------------------------------------- -SvxColorItem::SvxColorItem( SvStream &rStrm, const USHORT nId ) : +SvxColorItem::SvxColorItem( SvStream &rStrm, const sal_uInt16 nId ) : SfxPoolItem( nId ) { Color aColor; @@ -2028,12 +1981,12 @@ SvxColorItem::~SvxColorItem() } // ----------------------------------------------------------------------- -USHORT SvxColorItem::GetVersion( USHORT nFFVer ) const +sal_uInt16 SvxColorItem::GetVersion( sal_uInt16 nFFVer ) const { DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || SOFFICE_FILEFORMAT_40==nFFVer || SOFFICE_FILEFORMAT_50==nFFVer, - "SvxColorItem: Gibt es ein neues Fileformat?" ); + "SvxColorItem: Is there a new file format? "); return SOFFICE_FILEFORMAT_50 >= nFFVer ? VERSION_USEAUTOCOLOR : 0; } @@ -2048,7 +2001,7 @@ int SvxColorItem::operator==( const SfxPoolItem& rAttr ) const // ----------------------------------------------------------------------- -bool SvxColorItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const +bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { rVal <<= (sal_Int32)(mColor.GetColor()); return true; @@ -2056,7 +2009,7 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const // ----------------------------------------------------------------------- -bool SvxColorItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) +bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { sal_Int32 nColor = 0; if(!(rVal >>= nColor)) @@ -2075,7 +2028,7 @@ SfxPoolItem* SvxColorItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxColorItem::Store( SvStream& rStrm , USHORT nItemVersion ) const +SvStream& SvxColorItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const { if( VERSION_USEAUTOCOLOR == nItemVersion && COL_AUTO == mColor.GetColor() ) @@ -2087,7 +2040,7 @@ SvStream& SvxColorItem::Store( SvStream& rStrm , USHORT nItemVersion ) const // ----------------------------------------------------------------------- -SfxPoolItem* SvxColorItem::Create(SvStream& rStrm, USHORT /*nVer*/ ) const +SfxPoolItem* SvxColorItem::Create(SvStream& rStrm, sal_uInt16 /*nVer*/ ) const { return new SvxColorItem( rStrm, Which() ); } @@ -2102,7 +2055,6 @@ SfxItemPresentation SvxColorItem::GetPresentation XubString& rText, const IntlWrapper * /*pIntl*/ ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -2114,7 +2066,6 @@ SfxItemPresentation SvxColorItem::GetPresentation return ePres; default: ; //prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -2127,7 +2078,7 @@ void SvxColorItem::SetValue( const Color& rNewCol ) // class SvxCharSetColorItem --------------------------------------------- -SvxCharSetColorItem::SvxCharSetColorItem( const USHORT nId ) : +SvxCharSetColorItem::SvxCharSetColorItem( const sal_uInt16 nId ) : SvxColorItem( nId ), eFrom( RTL_TEXTENCODING_DONTKNOW ) @@ -2138,7 +2089,7 @@ SvxCharSetColorItem::SvxCharSetColorItem( const USHORT nId ) : SvxCharSetColorItem::SvxCharSetColorItem( const Color& rCol, const rtl_TextEncoding _eFrom, - const USHORT nId ) : + const sal_uInt16 nId ) : SvxColorItem( rCol, nId ), eFrom( _eFrom ) @@ -2155,20 +2106,18 @@ SfxPoolItem* SvxCharSetColorItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxCharSetColorItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxCharSetColorItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - // #90477# rStrm << (BYTE) GetStoreCharSet( GetCharSet(), (USHORT)rStrm.GetVersion() ) - // << GetValue(); - rStrm << (BYTE)GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion()) + rStrm << (sal_uInt8)GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion()) << GetValue(); return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxCharSetColorItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxCharSetColorItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE cSet; + sal_uInt8 cSet; Color aColor; rStrm >> cSet >> aColor; return new SvxCharSetColorItem( aColor, (rtl_TextEncoding)cSet, Which() ); @@ -2190,7 +2139,7 @@ SfxItemPresentation SvxCharSetColorItem::GetPresentation // class SvxKerningItem -------------------------------------------------- -SvxKerningItem::SvxKerningItem( const short nKern, const USHORT nId ) : +SvxKerningItem::SvxKerningItem( const short nKern, const sal_uInt16 nId ) : SfxInt16Item( nId, nKern ) { } @@ -2204,7 +2153,7 @@ SfxPoolItem* SvxKerningItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxKerningItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxKerningItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { rStrm << (short) GetValue(); return rStrm; @@ -2227,7 +2176,7 @@ bool SvxKerningItem::HasMetrics() const // ----------------------------------------------------------------------- -SfxPoolItem* SvxKerningItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxKerningItem::Create(SvStream& rStrm, sal_uInt16) const { short nValue; rStrm >> nValue; @@ -2244,7 +2193,6 @@ SfxItemPresentation SvxKerningItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -2257,7 +2205,7 @@ SfxItemPresentation SvxKerningItem::GetPresentation case SFX_ITEM_PRESENTATION_COMPLETE: { rText = EE_RESSTR(RID_SVXITEMS_KERNING_COMPLETE); - USHORT nId = 0; + sal_uInt16 nId = 0; if ( GetValue() > 0 ) nId = RID_SVXITEMS_KERNING_EXPANDED; @@ -2272,13 +2220,10 @@ SfxItemPresentation SvxKerningItem::GetPresentation } default: ; //prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } -/* -----------------------------19.02.01 12:21-------------------------------- - ---------------------------------------------------------------------------*/ -bool SvxKerningItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxKerningItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Int16 nVal = GetValue(); if(nMemberId & CONVERT_TWIPS) @@ -2287,7 +2232,7 @@ bool SvxKerningItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const return true; } // ----------------------------------------------------------------------- -bool SvxKerningItem::PutValue( const uno::Any& rVal, BYTE nMemberId) +bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) { sal_Int16 nVal = sal_Int16(); if(!(rVal >>= nVal)) @@ -2300,14 +2245,14 @@ bool SvxKerningItem::PutValue( const uno::Any& rVal, BYTE nMemberId) // class SvxCaseMapItem -------------------------------------------------- -SvxCaseMapItem::SvxCaseMapItem( const SvxCaseMap eMap, const USHORT nId ) : - SfxEnumItem( nId, (USHORT)eMap ) +SvxCaseMapItem::SvxCaseMapItem( const SvxCaseMap eMap, const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)eMap ) { } // ----------------------------------------------------------------------- -USHORT SvxCaseMapItem::GetValueCount() const +sal_uInt16 SvxCaseMapItem::GetValueCount() const { return SVX_CASEMAP_END; // SVX_CASEMAP_KAPITAELCHEN + 1 } @@ -2321,17 +2266,17 @@ SfxPoolItem* SvxCaseMapItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxCaseMapItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxCaseMapItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - rStrm << (BYTE) GetValue(); + rStrm << (sal_uInt8) GetValue(); return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxCaseMapItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxCaseMapItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE cMap; + sal_uInt8 cMap; rStrm >> cMap; return new SvxCaseMapItem( (const SvxCaseMap)cMap, Which() ); } @@ -2362,21 +2307,17 @@ SfxItemPresentation SvxCaseMapItem::GetPresentation // ----------------------------------------------------------------------- -XubString SvxCaseMapItem::GetValueTextByPos( USHORT nPos ) const +XubString SvxCaseMapItem::GetValueTextByPos( sal_uInt16 nPos ) const { - DBG_ASSERT( nPos < (USHORT)SVX_CASEMAP_END, "enum overflow!" ); + DBG_ASSERT( nPos < (sal_uInt16)SVX_CASEMAP_END, "enum overflow!" ); return EE_RESSTR( RID_SVXITEMS_CASEMAP_BEGIN + nPos ); } -/*-----------------13.03.98 16:29------------------- - ---------------------------------------------------*/ -bool SvxCaseMapItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const +bool SvxCaseMapItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { sal_Int16 nRet = style::CaseMap::NONE; switch( GetValue() ) { -// case SVX_CASEMAP_NOT_MAPPED : nRet = style::CaseMap::NONE ; break; case SVX_CASEMAP_VERSALIEN : nRet = style::CaseMap::UPPERCASE; break; case SVX_CASEMAP_GEMEINE : nRet = style::CaseMap::LOWERCASE; break; case SVX_CASEMAP_TITEL : nRet = style::CaseMap::TITLE ; break; @@ -2385,10 +2326,8 @@ bool SvxCaseMapItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const rVal <<= (sal_Int16)(nRet); return true; } -/*-----------------13.03.98 16:29------------------- ---------------------------------------------------*/ -bool SvxCaseMapItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) +bool SvxCaseMapItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { sal_uInt16 nVal = sal_uInt16(); if(!(rVal >>= nVal)) @@ -2408,7 +2347,7 @@ bool SvxCaseMapItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) // class SvxEscapementItem ----------------------------------------------- -SvxEscapementItem::SvxEscapementItem( const USHORT nId ) : +SvxEscapementItem::SvxEscapementItem( const sal_uInt16 nId ) : SfxEnumItemInterface( nId ), nEsc ( 0 ), @@ -2419,7 +2358,7 @@ SvxEscapementItem::SvxEscapementItem( const USHORT nId ) : // ----------------------------------------------------------------------- SvxEscapementItem::SvxEscapementItem( const SvxEscapement eEscape, - const USHORT nId ) : + const sal_uInt16 nId ) : SfxEnumItemInterface( nId ), nProp( 100 ) { @@ -2431,8 +2370,8 @@ SvxEscapementItem::SvxEscapementItem( const SvxEscapement eEscape, // ----------------------------------------------------------------------- SvxEscapementItem::SvxEscapementItem( const short _nEsc, - const BYTE _nProp, - const USHORT nId ) : + const sal_uInt8 _nProp, + const sal_uInt16 nId ) : SfxEnumItemInterface( nId ), nEsc ( _nEsc ), nProp ( _nProp ) @@ -2458,7 +2397,7 @@ SfxPoolItem* SvxEscapementItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxEscapementItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxEscapementItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { short _nEsc = GetEsc(); if( SOFFICE_FILEFORMAT_31 == rStrm.GetVersion() ) @@ -2468,16 +2407,16 @@ SvStream& SvxEscapementItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) else if( DFLT_ESC_AUTO_SUB == _nEsc ) _nEsc = DFLT_ESC_SUB; } - rStrm << (BYTE) GetProp() + rStrm << (sal_uInt8) GetProp() << (short) _nEsc; return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxEscapementItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxEscapementItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE _nProp; + sal_uInt8 _nProp; short _nEsc; rStrm >> _nProp >> _nEsc; return new SvxEscapementItem( _nEsc, _nProp, Which() ); @@ -2485,7 +2424,7 @@ SfxPoolItem* SvxEscapementItem::Create(SvStream& rStrm, USHORT) const // ----------------------------------------------------------------------- -USHORT SvxEscapementItem::GetValueCount() const +sal_uInt16 SvxEscapementItem::GetValueCount() const { return SVX_ESCAPEMENT_END; // SVX_ESCAPEMENT_SUBSCRIPT + 1 } @@ -2526,15 +2465,15 @@ SfxItemPresentation SvxEscapementItem::GetPresentation // ----------------------------------------------------------------------- -XubString SvxEscapementItem::GetValueTextByPos( USHORT nPos ) const +XubString SvxEscapementItem::GetValueTextByPos( sal_uInt16 nPos ) const { - DBG_ASSERT( nPos < (USHORT)SVX_ESCAPEMENT_END, "enum overflow!" ); + DBG_ASSERT( nPos < (sal_uInt16)SVX_ESCAPEMENT_END, "enum overflow!" ); return EE_RESSTR(RID_SVXITEMS_ESCAPEMENT_BEGIN + nPos); } // ----------------------------------------------------------------------- -USHORT SvxEscapementItem::GetEnumValue() const +sal_uInt16 SvxEscapementItem::GetEnumValue() const { if ( nEsc < 0 ) return SVX_ESCAPEMENT_SUBSCRIPT; @@ -2545,17 +2484,13 @@ USHORT SvxEscapementItem::GetEnumValue() const // ----------------------------------------------------------------------- -void SvxEscapementItem::SetEnumValue( USHORT nVal ) +void SvxEscapementItem::SetEnumValue( sal_uInt16 nVal ) { SetEscapement( (const SvxEscapement)nVal ); } -/*-----------------13.03.98 17:05------------------- - ---------------------------------------------------*/ -bool SvxEscapementItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxEscapementItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -2571,12 +2506,9 @@ bool SvxEscapementItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } return true; } -/*-----------------13.03.98 17:05------------------- ---------------------------------------------------*/ -bool SvxEscapementItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -2600,7 +2532,7 @@ bool SvxEscapementItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) break; case MID_AUTO_ESC: { - BOOL bVal = Any2Bool(rVal); + sal_Bool bVal = Any2Bool(rVal); if(bVal) { if(nEsc < 0) @@ -2621,14 +2553,14 @@ bool SvxEscapementItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) // class SvxLanguageItem ------------------------------------------------- -SvxLanguageItem::SvxLanguageItem( const LanguageType eLang, const USHORT nId ) +SvxLanguageItem::SvxLanguageItem( const LanguageType eLang, const sal_uInt16 nId ) : SfxEnumItem( nId , eLang ) { } // ----------------------------------------------------------------------- -USHORT SvxLanguageItem::GetValueCount() const +sal_uInt16 SvxLanguageItem::GetValueCount() const { // #i50205# got rid of class International DBG_ERRORFILE("SvxLanguageItem::GetValueCount: supposed to return a count of what?"); @@ -2647,17 +2579,17 @@ SfxPoolItem* SvxLanguageItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxLanguageItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxLanguageItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - rStrm << (USHORT) GetValue(); + rStrm << (sal_uInt16) GetValue(); return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxLanguageItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxLanguageItem::Create(SvStream& rStrm, sal_uInt16) const { - USHORT nValue; + sal_uInt16 nValue; rStrm >> nValue; return new SvxLanguageItem( (LanguageType)nValue, Which() ); } @@ -2672,7 +2604,6 @@ SfxItemPresentation SvxLanguageItem::GetPresentation XubString& rText, const IntlWrapper * /*pIntl*/ ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -2687,16 +2618,11 @@ SfxItemPresentation SvxLanguageItem::GetPresentation } default: ; //prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } -/*-----------------14.03.98 14:13------------------- - ---------------------------------------------------*/ -bool SvxLanguageItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxLanguageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -2710,12 +2636,9 @@ bool SvxLanguageItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const } return true; } -/*-----------------14.03.98 14:13------------------- ---------------------------------------------------*/ -bool SvxLanguageItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -2745,7 +2668,7 @@ bool SvxLanguageItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) } // class SvxNoLinebreakItem ---------------------------------------------- -SvxNoLinebreakItem::SvxNoLinebreakItem( const BOOL bBreak, const USHORT nId ) : +SvxNoLinebreakItem::SvxNoLinebreakItem( const sal_Bool bBreak, const sal_uInt16 nId ) : SfxBoolItem( nId, bBreak ) { } @@ -2759,7 +2682,7 @@ SfxPoolItem* SvxNoLinebreakItem::Clone( SfxItemPool* ) const // ----------------------------------------------------------------------- -SvStream& SvxNoLinebreakItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxNoLinebreakItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { rStrm << (sal_Bool)GetValue(); return rStrm; @@ -2767,7 +2690,7 @@ SvStream& SvxNoLinebreakItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) // ----------------------------------------------------------------------- -SfxPoolItem* SvxNoLinebreakItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxNoLinebreakItem::Create(SvStream& rStrm, sal_uInt16) const { sal_Bool bValue; rStrm >> bValue; @@ -2790,7 +2713,7 @@ SfxItemPresentation SvxNoLinebreakItem::GetPresentation // class SvxNoHyphenItem ------------------------------------------------- -SvxNoHyphenItem::SvxNoHyphenItem( const sal_Bool bHyphen, const USHORT nId ) : +SvxNoHyphenItem::SvxNoHyphenItem( const sal_Bool bHyphen, const sal_uInt16 nId ) : SfxBoolItem( nId , bHyphen ) { } @@ -2804,7 +2727,7 @@ SfxPoolItem* SvxNoHyphenItem::Clone( SfxItemPool* ) const // ----------------------------------------------------------------------- -SvStream& SvxNoHyphenItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxNoHyphenItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { rStrm << (sal_Bool) GetValue(); return rStrm; @@ -2812,7 +2735,7 @@ SvStream& SvxNoHyphenItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) co // ----------------------------------------------------------------------- -SfxPoolItem* SvxNoHyphenItem::Create( SvStream& rStrm, USHORT ) const +SfxPoolItem* SvxNoHyphenItem::Create( SvStream& rStrm, sal_uInt16 ) const { sal_Bool bValue; rStrm >> bValue; @@ -2834,7 +2757,7 @@ SfxItemPresentation SvxNoHyphenItem::GetPresentation } /* - * Dummy-Item fuer ToolBox-Controls: + * Dummy item for ToolBox controls: * */ @@ -2842,21 +2765,21 @@ SfxItemPresentation SvxNoHyphenItem::GetPresentation // class SvxLineColorItem (== SvxColorItem) // ----------------------------------------------------------------------- -SvxLineColorItem::SvxLineColorItem( const USHORT nId ) : +SvxLineColorItem::SvxLineColorItem( const sal_uInt16 nId ) : SvxColorItem( nId ) { } // ----------------------------------------------------------------------- -SvxLineColorItem::SvxLineColorItem( const Color& rCol, const USHORT nId ) : +SvxLineColorItem::SvxLineColorItem( const Color& rCol, const sal_uInt16 nId ) : SvxColorItem( rCol, nId ) { } // ----------------------------------------------------------------------- -SvxLineColorItem::SvxLineColorItem( SvStream &rStrm, const USHORT nId ) : +SvxLineColorItem::SvxLineColorItem( SvStream &rStrm, const sal_uInt16 nId ) : SvxColorItem( rStrm, nId ) { } @@ -2892,7 +2815,7 @@ SfxItemPresentation SvxLineColorItem::GetPresentation // class SvxBlinkItem ------------------------------------------------- -SvxBlinkItem::SvxBlinkItem( const sal_Bool bBlink, const USHORT nId ) : +SvxBlinkItem::SvxBlinkItem( const sal_Bool bBlink, const sal_uInt16 nId ) : SfxBoolItem( nId, bBlink ) { } @@ -2906,17 +2829,17 @@ SfxPoolItem* SvxBlinkItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- -SvStream& SvxBlinkItem::Store( SvStream& rStrm , USHORT /*nItemVersion*/ ) const +SvStream& SvxBlinkItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - rStrm << (BYTE) GetValue(); + rStrm << (sal_uInt8) GetValue(); return rStrm; } // ----------------------------------------------------------------------- -SfxPoolItem* SvxBlinkItem::Create(SvStream& rStrm, USHORT) const +SfxPoolItem* SvxBlinkItem::Create(SvStream& rStrm, sal_uInt16) const { - BYTE nState; + sal_uInt8 nState; rStrm >> nState; return new SvxBlinkItem( nState, Which() ); } @@ -2939,7 +2862,7 @@ SfxItemPresentation SvxBlinkItem::GetPresentation case SFX_ITEM_PRESENTATION_NAMELESS: case SFX_ITEM_PRESENTATION_COMPLETE: { - USHORT nId = RID_SVXITEMS_BLINK_FALSE; + sal_uInt16 nId = RID_SVXITEMS_BLINK_FALSE; if ( GetValue() ) nId = RID_SVXITEMS_BLINK_TRUE; @@ -2954,7 +2877,7 @@ SfxItemPresentation SvxBlinkItem::GetPresentation // class SvxEmphaisMarkItem --------------------------------------------------- SvxEmphasisMarkItem::SvxEmphasisMarkItem( const FontEmphasisMark nValue, - const USHORT nId ) + const sal_uInt16 nId ) : SfxUInt16Item( nId, nValue ) { } @@ -2969,7 +2892,7 @@ SfxPoolItem* SvxEmphasisMarkItem::Clone( SfxItemPool * ) const // ----------------------------------------------------------------------- SvStream& SvxEmphasisMarkItem::Store( SvStream& rStrm, - USHORT /*nItemVersion*/ ) const + sal_uInt16 /*nItemVersion*/ ) const { rStrm << (sal_uInt16)GetValue(); return rStrm; @@ -2977,7 +2900,7 @@ SvStream& SvxEmphasisMarkItem::Store( SvStream& rStrm, // ----------------------------------------------------------------------- -SfxPoolItem* SvxEmphasisMarkItem::Create( SvStream& rStrm, USHORT ) const +SfxPoolItem* SvxEmphasisMarkItem::Create( SvStream& rStrm, sal_uInt16 ) const { sal_uInt16 nValue; rStrm >> nValue; @@ -3006,7 +2929,7 @@ SfxItemPresentation SvxEmphasisMarkItem::GetPresentation sal_uInt16 nVal = GetValue(); rText = EE_RESSTR( RID_SVXITEMS_EMPHASIS_BEGIN_STYLE + ( EMPHASISMARK_STYLE & nVal )); - USHORT nId = ( EMPHASISMARK_POS_ABOVE & nVal ) + sal_uInt16 nId = ( EMPHASISMARK_POS_ABOVE & nVal ) ? RID_SVXITEMS_EMPHASIS_ABOVE_POS : ( EMPHASISMARK_POS_BELOW & nVal ) ? RID_SVXITEMS_EMPHASIS_BELOW_POS @@ -3022,9 +2945,8 @@ SfxItemPresentation SvxEmphasisMarkItem::GetPresentation // ----------------------------------------------------------------------- -bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const +bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -3049,9 +2971,8 @@ bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const return true; } -bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) +bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = true; switch( nMemberId ) @@ -3080,12 +3001,12 @@ bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, BYTE nMemberId ) return bRet; } -USHORT SvxEmphasisMarkItem::GetVersion( USHORT nFFVer ) const +sal_uInt16 SvxEmphasisMarkItem::GetVersion( sal_uInt16 nFFVer ) const { DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || SOFFICE_FILEFORMAT_40==nFFVer || SOFFICE_FILEFORMAT_50==nFFVer, - "SvxEmphasisMarkItem: Gibt es ein neues Fileformat?" ); + "SvxEmphasisMarkItem: Is there a new file format? "); return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; } @@ -3128,9 +3049,8 @@ SfxPoolItem* SvxTwoLinesItem::Clone( SfxItemPool* ) const } bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const + sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = true; switch( nMemberId ) @@ -3162,9 +3082,8 @@ bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal, } bool SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ) + sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = sal_False; OUString s; @@ -3222,7 +3141,7 @@ SfxItemPresentation SvxTwoLinesItem::GetPresentation( SfxItemPresentation ePres, } -SfxPoolItem* SvxTwoLinesItem::Create( SvStream & rStrm, USHORT /*nVer*/) const +SfxPoolItem* SvxTwoLinesItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/) const { sal_Bool _bOn; sal_Unicode cStart, cEnd; @@ -3230,13 +3149,13 @@ SfxPoolItem* SvxTwoLinesItem::Create( SvStream & rStrm, USHORT /*nVer*/) const return new SvxTwoLinesItem( _bOn, cStart, cEnd, Which() ); } -SvStream& SvxTwoLinesItem::Store(SvStream & rStrm, USHORT /*nIVer*/) const +SvStream& SvxTwoLinesItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const { rStrm << GetValue() << GetStartBracket() << GetEndBracket(); return rStrm; } -USHORT SvxTwoLinesItem::GetVersion( USHORT nFFVer ) const +sal_uInt16 SvxTwoLinesItem::GetVersion( sal_uInt16 nFFVer ) const { DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || SOFFICE_FILEFORMAT_40==nFFVer || @@ -3263,7 +3182,7 @@ SfxPoolItem* SvxCharRotateItem::Clone( SfxItemPool* ) const return new SvxCharRotateItem( GetValue(), IsFitToLine(), Which() ); } -SfxPoolItem* SvxCharRotateItem::Create( SvStream& rStrm, USHORT ) const +SfxPoolItem* SvxCharRotateItem::Create( SvStream& rStrm, sal_uInt16 ) const { sal_uInt16 nVal; sal_Bool b; @@ -3271,14 +3190,14 @@ SfxPoolItem* SvxCharRotateItem::Create( SvStream& rStrm, USHORT ) const return new SvxCharRotateItem( nVal, b, Which() ); } -SvStream& SvxCharRotateItem::Store( SvStream & rStrm, USHORT ) const +SvStream& SvxCharRotateItem::Store( SvStream & rStrm, sal_uInt16 ) const { sal_Bool bFlag = IsFitToLine(); rStrm << GetValue() << bFlag; return rStrm; } -USHORT SvxCharRotateItem::GetVersion( USHORT nFFVer ) const +sal_uInt16 SvxCharRotateItem::GetVersion( sal_uInt16 nFFVer ) const { return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; } @@ -3314,9 +3233,8 @@ SfxItemPresentation SvxCharRotateItem::GetPresentation( } bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const + sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; bool bRet = true; switch( nMemberId ) @@ -3335,9 +3253,8 @@ bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal, } bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ) + sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; bool bRet = true; switch( nMemberId ) @@ -3346,7 +3263,7 @@ bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal, { sal_Int16 nVal = 0; if((rVal >>= nVal) && (0 == nVal || 900 == nVal || 2700 == nVal)) - SetValue( (USHORT)nVal ); + SetValue( (sal_uInt16)nVal ); else bRet = sal_False; break; @@ -3384,7 +3301,7 @@ SfxPoolItem* SvxCharScaleWidthItem::Clone( SfxItemPool* ) const return new SvxCharScaleWidthItem( GetValue(), Which() ); } -SfxPoolItem* SvxCharScaleWidthItem::Create( SvStream& rStrm, USHORT ) const +SfxPoolItem* SvxCharScaleWidthItem::Create( SvStream& rStrm, sal_uInt16 ) const { sal_uInt16 nVal; rStrm >> nVal; @@ -3392,11 +3309,11 @@ SfxPoolItem* SvxCharScaleWidthItem::Create( SvStream& rStrm, USHORT ) const if ( Which() == EE_CHAR_FONTWIDTH ) { - // #87271#: Was a SvxFontWidthItem in 5.2 + // Was a SvxFontWidthItem in 5.2 // USHORT nFixWidth, USHORT nPropWidth. // nFixWidth has never been used... rStrm >> nVal; - USHORT nTest; + sal_uInt16 nTest; rStrm >> nTest; if ( nTest == 0x1234 ) pItem->SetValue( nVal ); @@ -3407,23 +3324,23 @@ SfxPoolItem* SvxCharScaleWidthItem::Create( SvStream& rStrm, USHORT ) const return pItem; } -SvStream& SvxCharScaleWidthItem::Store( SvStream& rStream, USHORT nVer ) const +SvStream& SvxCharScaleWidthItem::Store( SvStream& rStream, sal_uInt16 nVer ) const { SvStream& rRet = SfxUInt16Item::Store( rStream, nVer ); if ( Which() == EE_CHAR_FONTWIDTH ) { // see comment in Create().... - rRet.SeekRel( -1*(long)sizeof(USHORT) ); - rRet << (USHORT)0; + rRet.SeekRel( -1*(long)sizeof(sal_uInt16) ); + rRet << (sal_uInt16)0; rRet << GetValue(); // Really ugly, but not a problem for reading the doc in 5.2 - rRet << (USHORT)0x1234; + rRet << (sal_uInt16)0x1234; } return rRet; } -USHORT SvxCharScaleWidthItem::GetVersion( USHORT nFFVer ) const +sal_uInt16 SvxCharScaleWidthItem::GetVersion( sal_uInt16 nFFVer ) const { return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; } @@ -3456,22 +3373,22 @@ SfxItemPresentation SvxCharScaleWidthItem::GetPresentation( return SFX_ITEM_PRESENTATION_NONE; } -bool SvxCharScaleWidthItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ ) +bool SvxCharScaleWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w) // where we still want this to be a sal_Int16 sal_Int16 nValue = sal_Int16(); if (rVal >>= nValue) { - SetValue( (UINT16) nValue ); + SetValue( (sal_uInt16) nValue ); return true; } - DBG_ERROR( "SvxCharScaleWidthItem::PutValue - Wrong type!" ); + OSL_TRACE( "SvxCharScaleWidthItem::PutValue - Wrong type!" ); return false; } -bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const +bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w) // where we still want this to be a sal_Int16 @@ -3485,7 +3402,7 @@ bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) con SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue, const sal_uInt16 nId ) - : SfxEnumItem( nId, (USHORT)eValue ) + : SfxEnumItem( nId, (sal_uInt16)eValue ) { } @@ -3494,33 +3411,33 @@ SfxPoolItem* SvxCharReliefItem::Clone( SfxItemPool * ) const return new SvxCharReliefItem( *this ); } -SfxPoolItem* SvxCharReliefItem::Create(SvStream & rStrm, USHORT) const +SfxPoolItem* SvxCharReliefItem::Create(SvStream & rStrm, sal_uInt16) const { sal_uInt16 nVal; rStrm >> nVal; return new SvxCharReliefItem( (FontRelief)nVal, Which() ); } -SvStream& SvxCharReliefItem::Store(SvStream & rStrm, USHORT /*nIVer*/) const +SvStream& SvxCharReliefItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const { sal_uInt16 nVal = GetValue(); rStrm << nVal; return rStrm; } -USHORT SvxCharReliefItem::GetVersion( USHORT nFFVer ) const +sal_uInt16 SvxCharReliefItem::GetVersion( sal_uInt16 nFFVer ) const { return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; } -String SvxCharReliefItem::GetValueTextByPos( USHORT nPos ) const +String SvxCharReliefItem::GetValueTextByPos( sal_uInt16 nPos ) const { DBG_ASSERT( RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE, "enum overflow" ); return String( EditResId( RID_SVXITEMS_RELIEF_BEGIN + nPos )); } -USHORT SvxCharReliefItem::GetValueCount() const +sal_uInt16 SvxCharReliefItem::GetValueCount() const { return RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE; } @@ -3552,9 +3469,8 @@ SfxItemPresentation SvxCharReliefItem::GetPresentation } bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ) + sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; bool bRet = true; switch( nMemberId ) @@ -3564,7 +3480,7 @@ bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal, sal_Int16 nVal = -1; rVal >>= nVal; if(nVal >= 0 && nVal <= RELIEF_ENGRAVED) - SetValue( (USHORT)nVal ); + SetValue( (sal_uInt16)nVal ); else bRet = false; } @@ -3577,9 +3493,8 @@ bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal, } bool SvxCharReliefItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const + sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; bool bRet = true; switch( nMemberId ) @@ -3611,14 +3526,14 @@ SfxPoolItem* SvxScriptTypeItem::Clone( SfxItemPool * ) const |* class SvxScriptSetItem *************************************************************************/ -SvxScriptSetItem::SvxScriptSetItem( USHORT nSlotId, SfxItemPool& rPool ) +SvxScriptSetItem::SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool ) : SfxSetItem( nSlotId, new SfxItemSet( rPool, SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_FONT )) { - USHORT nLatin, nAsian, nComplex; + sal_uInt16 nLatin, nAsian, nComplex; GetWhichIds( nLatin, nAsian, nComplex ); - USHORT aIds[ 9 ] = { 0 }; + sal_uInt16 aIds[ 9 ] = { 0 }; aIds[ 0 ] = aIds[ 1 ] = nLatin; aIds[ 2 ] = aIds[ 3 ] = nAsian; aIds[ 4 ] = aIds[ 5 ] = nComplex; @@ -3631,28 +3546,28 @@ SvxScriptSetItem::SvxScriptSetItem( USHORT nSlotId, SfxItemPool& rPool ) SfxPoolItem* SvxScriptSetItem::Clone( SfxItemPool * ) const { SvxScriptSetItem* p = new SvxScriptSetItem( Which(), *GetItemSet().GetPool() ); - p->GetItemSet().Put( GetItemSet(), FALSE ); + p->GetItemSet().Put( GetItemSet(), sal_False ); return p; } -SfxPoolItem* SvxScriptSetItem::Create( SvStream &, USHORT ) const +SfxPoolItem* SvxScriptSetItem::Create( SvStream &, sal_uInt16 ) const { return 0; } const SfxPoolItem* SvxScriptSetItem::GetItemOfScriptSet( - const SfxItemSet& rSet, USHORT nId ) + const SfxItemSet& rSet, sal_uInt16 nId ) { const SfxPoolItem* pI; - SfxItemState eSt = rSet.GetItemState( nId, FALSE, &pI ); + SfxItemState eSt = rSet.GetItemState( nId, sal_False, &pI ); if( SFX_ITEM_SET != eSt ) pI = SFX_ITEM_DEFAULT == eSt ? &rSet.Get( nId ) : 0; return pI; } -const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( USHORT nSlotId, const SfxItemSet& rSet, USHORT nScript ) +const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript ) { - USHORT nLatin, nAsian, nComplex; + sal_uInt16 nLatin, nAsian, nComplex; GetWhichIds( nSlotId, rSet, nLatin, nAsian, nComplex ); const SfxPoolItem *pRet, *pAsn, *pCmplx; @@ -3701,15 +3616,15 @@ const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( USHORT nSlotId, const SfxI return pRet; } -const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( USHORT nScript ) const +const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nScript ) const { return GetItemOfScript( Which(), GetItemSet(), nScript ); } -void SvxScriptSetItem::PutItemForScriptType( USHORT nScriptType, +void SvxScriptSetItem::PutItemForScriptType( sal_uInt16 nScriptType, const SfxPoolItem& rItem ) { - USHORT nLatin, nAsian, nComplex; + sal_uInt16 nLatin, nAsian, nComplex; GetWhichIds( nLatin, nAsian, nComplex ); SfxPoolItem* pCpy = rItem.Clone(); @@ -3731,7 +3646,7 @@ void SvxScriptSetItem::PutItemForScriptType( USHORT nScriptType, delete pCpy; } -void SvxScriptSetItem::GetWhichIds( USHORT nSlotId, const SfxItemSet& rSet, USHORT& rLatin, USHORT& rAsian, USHORT& rComplex ) +void SvxScriptSetItem::GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex ) { const SfxItemPool& rPool = *rSet.GetPool(); GetSlotIds( nSlotId, rLatin, rAsian, rComplex ); @@ -3740,19 +3655,19 @@ void SvxScriptSetItem::GetWhichIds( USHORT nSlotId, const SfxItemSet& rSet, USHO rComplex = rPool.GetWhich( rComplex ); } -void SvxScriptSetItem::GetWhichIds( USHORT& rLatin, USHORT& rAsian, - USHORT& rComplex ) const +void SvxScriptSetItem::GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian, + sal_uInt16& rComplex ) const { GetWhichIds( Which(), GetItemSet(), rLatin, rAsian, rComplex ); } -void SvxScriptSetItem::GetSlotIds( USHORT nSlotId, USHORT& rLatin, - USHORT& rAsian, USHORT& rComplex ) +void SvxScriptSetItem::GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin, + sal_uInt16& rAsian, sal_uInt16& rComplex ) { switch( nSlotId ) { default: - DBG_ASSERT( FALSE, "wrong SlotId for class SvxScriptSetItem" ); + DBG_ASSERT( sal_False, "wrong SlotId for class SvxScriptSetItem" ); // no break - default to font - Id Range !! case SID_ATTR_CHAR_FONT: @@ -3785,12 +3700,12 @@ void SvxScriptSetItem::GetSlotIds( USHORT nSlotId, USHORT& rLatin, void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rComplex ) { - const USHORT nItemCnt = 3; + const sal_uInt16 nItemCnt = 3; static struct { - USHORT nFontType; - USHORT nLanguage; + sal_uInt16 nFontType; + sal_uInt16 nLanguage; } aOutTypeArr[ nItemCnt ] = { @@ -3801,27 +3716,27 @@ void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rCo SvxFontItem* aItemArr[ nItemCnt ] = { &rLatin, &rAsian, &rComplex }; - for ( USHORT n = 0; n < nItemCnt; ++n ) + for ( sal_uInt16 n = 0; n < nItemCnt; ++n ) { Font aFont( OutputDevice::GetDefaultFont( aOutTypeArr[ n ].nFontType, aOutTypeArr[ n ].nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0 ) ); SvxFontItem* pItem = aItemArr[ n ]; - pItem->GetFamily() = aFont.GetFamily(); - pItem->GetFamilyName() = aFont.GetName(); - pItem->GetStyleName().Erase(); - pItem->GetPitch() = aFont.GetPitch(); - pItem->GetCharSet() = aFont.GetCharSet(); + pItem->SetFamily( aFont.GetFamily() ); + pItem->SetFamilyName( aFont.GetName() ); + pItem->SetStyleName( String() ); + pItem->SetPitch( aFont.GetPitch()); + pItem->SetCharSet(aFont.GetCharSet()); } } -USHORT GetI18NScriptTypeOfLanguage( USHORT nLang ) +sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang ) { return GetI18NScriptType( SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ) ); } -USHORT GetItemScriptType( short nI18NType ) +sal_uInt16 GetItemScriptType( short nI18NType ) { switch ( nI18NType ) { @@ -3832,7 +3747,7 @@ USHORT GetItemScriptType( short nI18NType ) return 0; } -short GetI18NScriptType( USHORT nItemType ) +short GetI18NScriptType( sal_uInt16 nItemType ) { switch ( nItemType ) { diff --git a/editeng/source/items/writingmodeitem.cxx b/editeng/source/items/writingmodeitem.cxx index efc9b5359b..549d1213e3 100644 --- a/editeng/source/items/writingmodeitem.cxx +++ b/editeng/source/items/writingmodeitem.cxx @@ -39,11 +39,10 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; -// class SvxWritingModeItem ------------------------------------------------- TYPEINIT1_FACTORY(SvxWritingModeItem, SfxUInt16Item, new SvxWritingModeItem(com::sun::star::text::WritingMode_LR_TB, 0)); -SvxWritingModeItem::SvxWritingModeItem( WritingMode eValue, USHORT _nWhich ) +SvxWritingModeItem::SvxWritingModeItem( WritingMode eValue, sal_uInt16 _nWhich ) : SfxUInt16Item( _nWhich, (sal_uInt16)eValue ) { } @@ -64,19 +63,19 @@ SfxPoolItem* SvxWritingModeItem::Clone( SfxItemPool * ) const return new SvxWritingModeItem( *this ); } -SfxPoolItem* SvxWritingModeItem::Create( SvStream & , USHORT ) const +SfxPoolItem* SvxWritingModeItem::Create( SvStream & , sal_uInt16 ) const { - DBG_ERROR("SvxWritingModeItem should not be streamed!"); + OSL_FAIL("SvxWritingModeItem should not be streamed!"); return NULL; } -SvStream& SvxWritingModeItem::Store( SvStream & rStrm, USHORT ) const +SvStream& SvxWritingModeItem::Store( SvStream & rStrm, sal_uInt16 ) const { - DBG_ERROR("SvxWritingModeItem should not be streamed!"); + OSL_FAIL("SvxWritingModeItem should not be streamed!"); return rStrm; } -USHORT SvxWritingModeItem::GetVersion( USHORT /*nFVer*/ ) const +sal_uInt16 SvxWritingModeItem::GetVersion( sal_uInt16 /*nFVer*/ ) const { return USHRT_MAX; } @@ -105,7 +104,7 @@ SfxItemPresentation SvxWritingModeItem::GetPresentation( SfxItemPresentation ePr return eRet; } -bool SvxWritingModeItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) +bool SvxWritingModeItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) { sal_Int32 nVal = 0; bool bRet = ( rVal >>= nVal ); @@ -141,7 +140,7 @@ bool SvxWritingModeItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) } bool SvxWritingModeItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE ) const + sal_uInt8 ) const { rVal <<= (WritingMode)GetValue(); return true; diff --git a/editeng/source/items/xmlcnitm.cxx b/editeng/source/items/xmlcnitm.cxx index 54c604d9ca..27aa04a063 100644 --- a/editeng/source/items/xmlcnitm.cxx +++ b/editeng/source/items/xmlcnitm.cxx @@ -39,11 +39,10 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::xml; -// ------------------------------------------------------------------------ TYPEINIT1(SvXMLAttrContainerItem, SfxPoolItem); -SvXMLAttrContainerItem::SvXMLAttrContainerItem( USHORT _nWhich ) : +SvXMLAttrContainerItem::SvXMLAttrContainerItem( sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich ) { pImpl = new SvXMLAttrContainerData; @@ -85,13 +84,13 @@ SfxItemPresentation SvXMLAttrContainerItem::GetPresentation( return SFX_ITEM_PRESENTATION_NONE; } -USHORT SvXMLAttrContainerItem::GetVersion( USHORT /*nFileFormatVersion*/ ) const +sal_uInt16 SvXMLAttrContainerItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const { // This item should never be stored return USHRT_MAX; } -bool SvXMLAttrContainerItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const +bool SvXMLAttrContainerItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { Reference<XNameContainer> xContainer = new SvUnoAttributeContainer( new SvXMLAttrContainerData( *pImpl ) ); @@ -100,7 +99,7 @@ bool SvXMLAttrContainerItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE / return true; } -bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) +bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { Reference<XInterface> xRef; SvUnoAttributeContainer* pContainer = NULL; @@ -110,7 +109,7 @@ bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, BYT xRef = *(Reference<XInterface>*)rVal.getValue(); Reference<XUnoTunnel> xTunnel(xRef, UNO_QUERY); if( xTunnel.is() ) - pContainer = (SvUnoAttributeContainer*)(ULONG)xTunnel->getSomething(SvUnoAttributeContainer::getUnoTunnelId()); + pContainer = (SvUnoAttributeContainer*)(sal_uLong)xTunnel->getSomething(SvUnoAttributeContainer::getUnoTunnelId()); } if( pContainer ) @@ -126,14 +125,14 @@ bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, BYT { Reference<XNameContainer> xContainer( xRef, UNO_QUERY ); if( !xContainer.is() ) - return FALSE; + return sal_False; const Sequence< ::rtl::OUString > aNameSequence( xContainer->getElementNames() ); const ::rtl::OUString* pNames = aNameSequence.getConstArray(); - const INT32 nCount = aNameSequence.getLength(); + const sal_Int32 nCount = aNameSequence.getLength(); Any aAny; AttributeData* pData; - INT32 nAttr; + sal_Int32 nAttr; for( nAttr = 0; nAttr < nCount; nAttr++ ) { @@ -141,7 +140,7 @@ bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, BYT aAny = xContainer->getByName( aName ); if( aAny.getValue() == NULL || aAny.getValueType() != ::getCppuType((AttributeData*)0) ) - return FALSE; + return sal_False; pData = (AttributeData*)aAny.getValue(); sal_Int32 pos = aName.indexOf( sal_Unicode(':') ); @@ -189,61 +188,61 @@ bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, BYT } -BOOL SvXMLAttrContainerItem::AddAttr( const ::rtl::OUString& rLName, +sal_Bool SvXMLAttrContainerItem::AddAttr( const ::rtl::OUString& rLName, const ::rtl::OUString& rValue ) { return pImpl->AddAttr( rLName, rValue ); } -BOOL SvXMLAttrContainerItem::AddAttr( const ::rtl::OUString& rPrefix, +sal_Bool SvXMLAttrContainerItem::AddAttr( const ::rtl::OUString& rPrefix, const ::rtl::OUString& rNamespace, const ::rtl::OUString& rLName, const ::rtl::OUString& rValue ) { return pImpl->AddAttr( rPrefix, rNamespace, rLName, rValue ); } -USHORT SvXMLAttrContainerItem::GetAttrCount() const +sal_uInt16 SvXMLAttrContainerItem::GetAttrCount() const { - return (USHORT)pImpl->GetAttrCount(); + return (sal_uInt16)pImpl->GetAttrCount(); } -::rtl::OUString SvXMLAttrContainerItem::GetAttrNamespace( USHORT i ) const +::rtl::OUString SvXMLAttrContainerItem::GetAttrNamespace( sal_uInt16 i ) const { return pImpl->GetAttrNamespace( i ); } -::rtl::OUString SvXMLAttrContainerItem::GetAttrPrefix( USHORT i ) const +::rtl::OUString SvXMLAttrContainerItem::GetAttrPrefix( sal_uInt16 i ) const { return pImpl->GetAttrPrefix( i ); } -const ::rtl::OUString& SvXMLAttrContainerItem::GetAttrLName( USHORT i ) const +const ::rtl::OUString& SvXMLAttrContainerItem::GetAttrLName( sal_uInt16 i ) const { return pImpl->GetAttrLName( i ); } -const ::rtl::OUString& SvXMLAttrContainerItem::GetAttrValue( USHORT i ) const +const ::rtl::OUString& SvXMLAttrContainerItem::GetAttrValue( sal_uInt16 i ) const { return pImpl->GetAttrValue( i ); } -USHORT SvXMLAttrContainerItem::GetFirstNamespaceIndex() const +sal_uInt16 SvXMLAttrContainerItem::GetFirstNamespaceIndex() const { return pImpl->GetFirstNamespaceIndex(); } -USHORT SvXMLAttrContainerItem::GetNextNamespaceIndex( USHORT nIdx ) const +sal_uInt16 SvXMLAttrContainerItem::GetNextNamespaceIndex( sal_uInt16 nIdx ) const { return pImpl->GetNextNamespaceIndex( nIdx ); } -const ::rtl::OUString& SvXMLAttrContainerItem::GetNamespace( USHORT i ) const +const ::rtl::OUString& SvXMLAttrContainerItem::GetNamespace( sal_uInt16 i ) const { return pImpl->GetNamespace( i ); } -const ::rtl::OUString& SvXMLAttrContainerItem::GetPrefix( USHORT i ) const +const ::rtl::OUString& SvXMLAttrContainerItem::GetPrefix( sal_uInt16 i ) const { return pImpl->GetPrefix( i ); } diff --git a/editeng/source/misc/SvXMLAutoCorrectExport.cxx b/editeng/source/misc/SvXMLAutoCorrectExport.cxx index de5f2af022..0c5bd94f16 100644 --- a/editeng/source/misc/SvXMLAutoCorrectExport.cxx +++ b/editeng/source/misc/SvXMLAutoCorrectExport.cxx @@ -39,7 +39,6 @@ using namespace ::com::sun::star; using namespace ::xmloff::token; using namespace ::rtl; -// #110680# SvXMLAutoCorrectExport::SvXMLAutoCorrectExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, const SvxAutocorrWordList * pNewAutocorr_List, @@ -81,7 +80,6 @@ sal_uInt32 SvXMLAutoCorrectExport::exportDoc(enum XMLTokenEnum /*eClass*/) return 0; } -// #110680# SvXMLExceptionListExport::SvXMLExceptionListExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, const SvStringsISortDtor &rNewList, diff --git a/editeng/source/misc/SvXMLAutoCorrectExport.hxx b/editeng/source/misc/SvXMLAutoCorrectExport.hxx index 9a2bb77ee7..68e7ce41f2 100644 --- a/editeng/source/misc/SvXMLAutoCorrectExport.hxx +++ b/editeng/source/misc/SvXMLAutoCorrectExport.hxx @@ -39,7 +39,6 @@ class SvXMLAutoCorrectExport : public SvXMLExport private: const SvxAutocorrWordList *pAutocorr_List; public: - // #110680# SvXMLAutoCorrectExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, const SvxAutocorrWordList * pNewAutocorr_List, @@ -60,7 +59,6 @@ class SvXMLExceptionListExport : public SvXMLExport private: const SvStringsISortDtor & rList; public: - // #110680# SvXMLExceptionListExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, const SvStringsISortDtor &rNewList, diff --git a/editeng/source/misc/SvXMLAutoCorrectImport.cxx b/editeng/source/misc/SvXMLAutoCorrectImport.cxx index e81e912ed6..c70bb3ce53 100644 --- a/editeng/source/misc/SvXMLAutoCorrectImport.cxx +++ b/editeng/source/misc/SvXMLAutoCorrectImport.cxx @@ -43,7 +43,6 @@ using namespace ::rtl; static OUString sBlockList ( RTL_CONSTASCII_USTRINGPARAM ( "_block-list" ) ); -// #110680# SvXMLAutoCorrectImport::SvXMLAutoCorrectImport( const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, SvxAutocorrWordList *pNewAutocorr_List, @@ -141,9 +140,7 @@ SvXMLWordContext::SvXMLWordContext( if (!sWrong.Len() || !sRight.Len() ) return; -// const International& rInter = Application::GetAppInternational(); -// BOOL bOnlyTxt = COMPARE_EQUAL != rInter.Compare( sRight, sWrong, INTN_COMPARE_IGNORECASE ); - BOOL bOnlyTxt = sRight != sWrong; + sal_Bool bOnlyTxt = sRight != sWrong; if( !bOnlyTxt ) { String sLongSave( sRight ); @@ -151,7 +148,7 @@ SvXMLWordContext::SvXMLWordContext( sLongSave.Len() ) { sRight = sLongSave; - bOnlyTxt = TRUE; + bOnlyTxt = sal_True; } } SvxAutocorrWordPtr pNew = new SvxAutocorrWord( sWrong, sRight, bOnlyTxt ); @@ -164,7 +161,6 @@ SvXMLWordContext::~SvXMLWordContext ( void ) { } -// #110680# SvXMLExceptionListImport::SvXMLExceptionListImport( const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, SvStringsISortDtor & rNewList ) diff --git a/editeng/source/misc/SvXMLAutoCorrectImport.hxx b/editeng/source/misc/SvXMLAutoCorrectImport.hxx index d79f4509cf..67cd30f036 100644 --- a/editeng/source/misc/SvXMLAutoCorrectImport.hxx +++ b/editeng/source/misc/SvXMLAutoCorrectImport.hxx @@ -49,9 +49,7 @@ public: SvxAutocorrWordList *pAutocorr_List; SvxAutoCorrect &rAutoCorrect; com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStorage; - //SvStorageRef &rStorage; - // #110680# SvXMLAutoCorrectImport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, SvxAutocorrWordList *pNewAutocorr_List, @@ -105,7 +103,6 @@ protected: public: SvStringsISortDtor &rList; - // #110680# SvXMLExceptionListImport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, SvStringsISortDtor & rNewList ); diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index ff5b92bf58..f16dbdba1b 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -40,32 +40,29 @@ #include <com/sun/star/uno/Sequence.hxx> using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; +using ::rtl::OUString; + #define C2U(cChar) OUString::createFromAscii(cChar) static SvxAutoCorrCfg* pAutoCorrCfg = 0; -/*-------------------------------------------------------------------- - Beschreibung: Ctor Dtor - --------------------------------------------------------------------*/ - SvxAutoCorrCfg::SvxAutoCorrCfg() : aBaseConfig(*this), aSwConfig(*this), - bFileRel(TRUE), - bNetRel(TRUE), - bAutoTextTip(TRUE), - bAutoTextPreview(FALSE), - bAutoFmtByInput(TRUE), - bSearchInAllCategories(FALSE) + bFileRel(sal_True), + bNetRel(sal_True), + bAutoTextTip(sal_True), + bAutoTextPreview(sal_False), + bAutoFmtByInput(sal_True), + bSearchInAllCategories(sal_False) { SvtPathOptions aPathOpt; String sSharePath, sUserPath, sAutoPath( aPathOpt.GetAutoCorrectPath() ); String* pS = &sSharePath; - for( USHORT n = 0; n < 2; ++n, pS = &sUserPath ) + for( sal_uInt16 n = 0; n < 2; ++n, pS = &sUserPath ) { *pS = sAutoPath.GetToken( n, ';' ); INetURLObject aPath( *pS ); @@ -96,9 +93,7 @@ void SvxAutoCorrCfg::SetAutoCorrect( SvxAutoCorrect* pNew ) pAutoCorrect = pNew; } } -/*-- 12.10.00 11:44:17--------------------------------------------------- - -----------------------------------------------------------------------*/ Sequence<OUString> SvxBaseAutoCorrCfg::GetPropertyNames() { static const char* aPropNames[] = @@ -129,9 +124,7 @@ Sequence<OUString> SvxBaseAutoCorrCfg::GetPropertyNames() pNames[i] = OUString::createFromAscii(aPropNames[i]); return aNames; } -/*-- 12.10.00 11:44:18--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvxBaseAutoCorrCfg::Load(sal_Bool bInit) { Sequence<OUString> aNames = GetPropertyNames(); @@ -142,7 +135,7 @@ void SvxBaseAutoCorrCfg::Load(sal_Bool bInit) DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); if(aValues.getLength() == aNames.getLength()) { - long nFlags = 0; // default alles aus + long nFlags = 0; // default all off sal_Int32 nTemp = 0; for(int nProp = 0; nProp < aNames.getLength(); nProp++) { @@ -230,28 +223,22 @@ void SvxBaseAutoCorrCfg::Load(sal_Bool bInit) } } if( nFlags ) - rParent.pAutoCorrect->SetAutoCorrFlag( nFlags, TRUE ); - rParent.pAutoCorrect->SetAutoCorrFlag( ( 0xffff & ~nFlags ), FALSE ); + rParent.pAutoCorrect->SetAutoCorrFlag( nFlags, sal_True ); + rParent.pAutoCorrect->SetAutoCorrFlag( ( 0xffff & ~nFlags ), sal_False ); } } -/*-- 12.10.00 11:44:19--------------------------------------------------- - -----------------------------------------------------------------------*/ SvxBaseAutoCorrCfg::SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rPar) : utl::ConfigItem(C2U("Office.Common/AutoCorrect")), rParent(rPar) { } -/*-- 12.10.00 11:44:19--------------------------------------------------- - -----------------------------------------------------------------------*/ SvxBaseAutoCorrCfg::~SvxBaseAutoCorrCfg() { } -/*-- 12.10.00 11:44:20--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvxBaseAutoCorrCfg::Commit() { Sequence<OUString> aNames( GetPropertyNames() ); @@ -260,7 +247,7 @@ void SvxBaseAutoCorrCfg::Commit() Any* pValues = aValues.getArray(); const Type& rType = ::getBooleanCppuType(); - BOOL bVal; + sal_Bool bVal; const long nFlags = rParent.pAutoCorrect->GetFlags(); for(int nProp = 0; nProp < aNames.getLength(); nProp++) { @@ -338,16 +325,12 @@ void SvxBaseAutoCorrCfg::Commit() } PutProperties(aNames, aValues); } -/*-- 12.10.00 11:44:21--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvxBaseAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */) { Load(sal_False); } -/*-- 12.10.00 11:51:48--------------------------------------------------- - -----------------------------------------------------------------------*/ Sequence<OUString> SvxSwAutoCorrCfg::GetPropertyNames() { static const char* aPropNames[] = @@ -407,9 +390,7 @@ Sequence<OUString> SvxSwAutoCorrCfg::GetPropertyNames() pNames[i] = OUString::createFromAscii(aPropNames[i]); return aNames; } -/*-- 12.10.00 11:51:48--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvxSwAutoCorrCfg::Load(sal_Bool bInit) { Sequence<OUString> aNames = GetPropertyNames(); @@ -480,7 +461,7 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit) { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.nRightMargin = - sal::static_int_cast< BYTE >(nVal); + sal::static_int_cast< sal_uInt8 >(nVal); } break; // "Format/Option/CombineValue", case 23: rSwFlags.bAFmtDelSpacesAtSttEnd = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelSpacesAtStartEnd", @@ -498,14 +479,14 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit) { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.nAutoCmpltWordLen = - sal::static_int_cast< USHORT >(nVal); + sal::static_int_cast< sal_uInt16 >(nVal); } break; // "Completion/MinWordLen", case 35: { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.nAutoCmpltListLen = - sal::static_int_cast< USHORT >(nVal); + sal::static_int_cast< sal_uInt16 >(nVal); } break; // "Completion/MaxListLen", case 36: rSwFlags.bAutoCmpltCollectWords = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/CollectWords", @@ -516,7 +497,7 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit) { sal_Int32 nVal = 0; pValues[nProp] >>= nVal; rSwFlags.nAutoCmpltExpandKey = - sal::static_int_cast< USHORT >(nVal); + sal::static_int_cast< sal_uInt16 >(nVal); } break; // "Completion/AcceptKey" case 41 :rSwFlags.bAutoCmpltKeepList = *(sal_Bool*)pValues[nProp].getValue(); break;//"Completion/KeepList" @@ -556,23 +537,17 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit) } } } -/*-- 12.10.00 11:51:48--------------------------------------------------- - -----------------------------------------------------------------------*/ SvxSwAutoCorrCfg::SvxSwAutoCorrCfg(SvxAutoCorrCfg& rPar) : utl::ConfigItem(C2U("Office.Writer/AutoFunction")), rParent(rPar) { } -/*-- 12.10.00 11:51:48--------------------------------------------------- - -----------------------------------------------------------------------*/ SvxSwAutoCorrCfg::~SvxSwAutoCorrCfg() { } -/*-- 12.10.00 11:51:48--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvxSwAutoCorrCfg::Commit() { Sequence<OUString> aNames = GetPropertyNames(); @@ -581,7 +556,7 @@ void SvxSwAutoCorrCfg::Commit() Any* pValues = aValues.getArray(); const Type& rType = ::getBooleanCppuType(); - BOOL bVal; + sal_Bool bVal; SvxSwAutoFmtFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags(); for(int nProp = 0; nProp < aNames.getLength(); nProp++) { @@ -669,9 +644,7 @@ void SvxSwAutoCorrCfg::Commit() } PutProperties(aNames, aValues); } -/*-- 12.10.00 11:51:49--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvxSwAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */ ) { Load(sal_False); diff --git a/editeng/source/misc/edtdlg.cxx b/editeng/source/misc/edtdlg.cxx index bf83e6b5de..5ac52a556a 100644 --- a/editeng/source/misc/edtdlg.cxx +++ b/editeng/source/misc/edtdlg.cxx @@ -7,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxdlg.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/editeng/source/misc/forbiddencharacterstable.cxx b/editeng/source/misc/forbiddencharacterstable.cxx index 6a57ef606a..74d3f7a7a5 100644 --- a/editeng/source/misc/forbiddencharacterstable.cxx +++ b/editeng/source/misc/forbiddencharacterstable.cxx @@ -36,7 +36,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> -SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, USHORT nISize, USHORT nGrow ) +SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, sal_uInt16 nISize, sal_uInt16 nGrow ) : SvxForbiddenCharactersTableImpl( nISize, nGrow ) { mxMSF = xMSF; @@ -45,13 +45,13 @@ SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( ::com::sun::star::uno: SvxForbiddenCharactersTable::~SvxForbiddenCharactersTable() { - for ( ULONG n = Count(); n; ) + for ( sal_uLong n = Count(); n; ) delete GetObject( --n ); } -const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenCharacters( USHORT nLanguage, BOOL bGetDefault ) const +const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenCharacters( sal_uInt16 nLanguage, sal_Bool bGetDefault ) const { ForbiddenCharactersInfo* pInf = Get( nLanguage ); if ( !pInf && bGetDefault && mxMSF.is() ) @@ -61,7 +61,7 @@ const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::Ge pInf = new ForbiddenCharactersInfo; pImpl->Insert( nLanguage, pInf ); - pInf->bTemporary = TRUE; + pInf->bTemporary = sal_True; LocaleDataWrapper aWrapper( mxMSF, SvxCreateLocale( nLanguage ) ); pInf->aForbiddenChars = aWrapper.getForbiddenCharacters(); } @@ -70,7 +70,7 @@ const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::Ge -void SvxForbiddenCharactersTable::SetForbiddenCharacters( USHORT nLanguage, const com::sun::star::i18n::ForbiddenCharacters& rForbiddenChars ) +void SvxForbiddenCharactersTable::SetForbiddenCharacters( sal_uInt16 nLanguage, const com::sun::star::i18n::ForbiddenCharacters& rForbiddenChars ) { ForbiddenCharactersInfo* pInf = Get( nLanguage ); if ( !pInf ) @@ -78,11 +78,11 @@ void SvxForbiddenCharactersTable::SetForbiddenCharacters( USHORT nLanguage, cons pInf = new ForbiddenCharactersInfo; Insert( nLanguage, pInf ); } - pInf->bTemporary = FALSE; + pInf->bTemporary = sal_False; pInf->aForbiddenChars = rForbiddenChars; } -void SvxForbiddenCharactersTable::ClearForbiddenCharacters( USHORT nLanguage ) +void SvxForbiddenCharactersTable::ClearForbiddenCharacters( sal_uInt16 nLanguage ) { ForbiddenCharactersInfo* pInf = Get( nLanguage ); if ( pInf ) diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx index 83b3ad4836..ba94e00ce6 100644 --- a/editeng/source/misc/hangulhanja.cxx +++ b/editeng/source/misc/hangulhanja.cxx @@ -64,36 +64,6 @@ namespace editeng using namespace ::com::sun::star::i18n::TextConversionOption; using namespace ::com::sun::star::i18n::TextConversionType; using namespace ::com::sun::star::lang; -/* - using HangulHanjaConversion::ReplacementAction; - using HangulHanjaConversion::eExchange; - using HangulHanjaConversion::eReplacementBracketed; - using HangulHanjaConversion::eOriginalBracketed; - using HangulHanjaConversion::eReplacementAbove; - using HangulHanjaConversion::eOriginalAbove; - using HangulHanjaConversion::eReplacementBelow; - using HangulHanjaConversion::eOriginalBelow; - - using HangulHanjaConversion::eHangulToHanja; - using HangulHanjaConversion::eHanjaToHangul; - - using HangulHanjaConversion::eSimpleConversion; - using HangulHanjaConversion::eHangulBracketed; - using HangulHanjaConversion::eHanjaBracketed; - using HangulHanjaConversion::eRubyHanjaAbove; - using HangulHanjaConversion::eRubyHanjaBelow; - using HangulHanjaConversion::eRubyHangulAbove; - using HangulHanjaConversion::eRubyHangulBelow; - - using ::com::sun::star::i18n::TextConversionType::TO_HANJA; - using ::com::sun::star::i18n::TextConversionType::TO_HANGUL; - using ::com::sun::star::i18n::TextConversionOption::CHARACTER_BY_CHARACTER; - using ::com::sun::star::i18n::TextConversionOption::NONE; -*/ - //========================================================================= - //= HangulHanjaConversion_Impl - //========================================================================= - //using HangulHanjaConversion::ConversionFormat; class HangulHanjaConversion_Impl { @@ -270,14 +240,8 @@ namespace editeng sal_Int16 implGetConversionType( bool bSwitchDirection=false ) const; }; - //========================================================================= - //= HangulHanjaConversion_Impl - //========================================================================= - //------------------------------------------------------------------------- - // static member initialization HangulHanjaConversion_Impl::StringMap HangulHanjaConversion_Impl::m_aRecentlyUsedList = HangulHanjaConversion_Impl::StringMap(); - //------------------------------------------------------------------------- HangulHanjaConversion_Impl::HangulHanjaConversion_Impl( Window* _pUIParent, const Reference< XMultiServiceFactory >& _rxORB, const Locale& _rSourceLocale, @@ -315,7 +279,7 @@ namespace editeng m_eConvType = HHC::eConvSimplifiedTraditional; else { - DBG_ERROR( "failed to determine conversion type from languages" ); + OSL_FAIL( "failed to determine conversion type from languages" ); } // set remaining conversion parameters to their default values @@ -335,7 +299,6 @@ namespace editeng } - //------------------------------------------------------------------------- void HangulHanjaConversion_Impl::createDialog() { DBG_ASSERT( m_bIsInteractive, "createDialog when the conversion should not be interactive?" ); @@ -366,7 +329,6 @@ namespace editeng } } - //------------------------------------------------------------------------- sal_Int16 HangulHanjaConversion_Impl::implGetConversionType( bool bSwitchDirection ) const { sal_Int16 nConversionType = -1; @@ -378,7 +340,6 @@ namespace editeng return nConversionType; } - //------------------------------------------------------------------------- bool HangulHanjaConversion_Impl::implUpdateSuggestions( bool _bAllowSearchNextConvertibleText, const sal_Int32 _nStartAt ) { // parameters for the converter @@ -489,7 +450,7 @@ namespace editeng } catch( const Exception& ) { - DBG_ERROR( "HangulHanjaConversion_Impl::implNextConvertibleUnit: caught an exception!" ); + OSL_FAIL( "HangulHanjaConversion_Impl::implNextConvertibleUnit: caught an exception!" ); //!!! at least we want to move on in the text in order //!!! to avoid an endless loop... @@ -498,7 +459,6 @@ namespace editeng return bFoundAny; } - //------------------------------------------------------------------------- bool HangulHanjaConversion_Impl::implNextConvertibleUnit( const sal_Int32 _nStartAt ) { m_aCurrentSuggestions.realloc( 0 ); @@ -528,7 +488,6 @@ namespace editeng (m_nCurrentStartIndex < m_sCurrentPortion.getLength()); } - //------------------------------------------------------------------------- bool HangulHanjaConversion_Impl::implRetrieveNextPortion( ) { sal_Bool bAllowImplicitChanges = m_eConvType == HHC::eConvSimplifiedTraditional; @@ -547,7 +506,6 @@ namespace editeng return bRet; } - //------------------------------------------------------------------------- sal_Bool HangulHanjaConversion_Impl::implNextConvertible( bool _bRepeatUnit ) { if ( _bRepeatUnit || ( m_nCurrentEndIndex < m_sCurrentPortion.getLength() ) ) @@ -578,7 +536,6 @@ namespace editeng return sal_False; } - //------------------------------------------------------------------------- ::rtl::OUString HangulHanjaConversion_Impl::GetCurrentUnit() const { DBG_ASSERT( m_nCurrentStartIndex < m_sCurrentPortion.getLength(), @@ -592,7 +549,6 @@ namespace editeng return sCurrentUnit; } - //------------------------------------------------------------------------- sal_Bool HangulHanjaConversion_Impl::ContinueConversion( bool _bRepeatCurrentUnit ) { sal_Bool bNeedUserInteraction = sal_False; // when we leave here, do we need user interaction? @@ -642,19 +598,9 @@ namespace editeng } } - /* - if ( bDocumentDone ) - return sal_True; // we explicitly know that the complete document is done - else if ( bNeedUserInteraction ) - return sal_False; // the doc is not done, we found a convertible, but need the user to decide - else - return sal_True; // we did not find a next convertible, so the document is implicitly done - */ - return bDocumentDone || !bNeedUserInteraction; } - //------------------------------------------------------------------------- bool HangulHanjaConversion_Impl::implGetConversionDirectionForCurrentPortion( HHC::ConversionDirection& rDirection ) { // - For eConvHangulHanja the direction is determined by @@ -687,7 +633,7 @@ namespace editeng // determine if it's Hangul CharClass aCharClassificaton( m_xORB, m_aSourceLocale ); - sal_Int16 nScript = aCharClassificaton.getScript( m_sCurrentPortion, sal::static_int_cast< USHORT >(nNextAsianScript) ); + sal_Int16 nScript = aCharClassificaton.getScript( m_sCurrentPortion, sal::static_int_cast< sal_uInt16 >(nNextAsianScript) ); if ( ( UnicodeScript_kHangulJamo == nScript ) || ( UnicodeScript_kHangulCompatibilityJamo == nScript ) || ( UnicodeScript_kHangulSyllable == nScript ) @@ -706,14 +652,13 @@ namespace editeng } catch( const Exception& ) { - DBG_ERROR( "HangulHanjaConversion_Impl::implGetConversionDirectionForCurrentPortion: caught an exception!" ); + OSL_FAIL( "HangulHanjaConversion_Impl::implGetConversionDirectionForCurrentPortion: caught an exception!" ); } } return bSuccess; } - //------------------------------------------------------------------------- void HangulHanjaConversion_Impl::DoDocumentConversion( ) { // clear the change-all list - it's to be re-initialized for every single document @@ -775,7 +720,6 @@ namespace editeng } } - //------------------------------------------------------------------------- void HangulHanjaConversion_Impl::implProceed( bool _bRepeatCurrentUnit ) { if ( ContinueConversion( _bRepeatCurrentUnit ) ) @@ -786,7 +730,6 @@ namespace editeng } } - //------------------------------------------------------------------------- void HangulHanjaConversion_Impl::implChange( const ::rtl::OUString& _rChangeInto ) { if( !_rChangeInto.getLength() ) @@ -812,7 +755,7 @@ namespace editeng case HHC::eRubyHangulAbove: eAction = bOriginalIsHangul ? HHC::eOriginalAbove : HHC::eReplacementAbove; break; case HHC::eRubyHangulBelow: eAction = bOriginalIsHangul ? HHC::eOriginalBelow : HHC::eReplacementBelow; break; default: - DBG_ERROR( "HangulHanjaConversion_Impl::implChange: invalid/unexpected conversion format!" ); + OSL_FAIL( "HangulHanjaConversion_Impl::implChange: invalid/unexpected conversion format!" ); } } @@ -865,7 +808,7 @@ namespace editeng } catch( const Exception& ) { - DBG_ERROR( "HangulHanjaConversion_Impl::implChange: caught unexpected exception!" ); + OSL_FAIL( "HangulHanjaConversion_Impl::implChange: caught unexpected exception!" ); aOffsets.realloc(0); } } @@ -879,7 +822,6 @@ namespace editeng m_nReplacementBaseIndex = m_nCurrentEndIndex; } - //------------------------------------------------------------------------- void HangulHanjaConversion_Impl::implReadOptionsFromConfiguration() { SvtLinguConfig aLngCfg; @@ -888,7 +830,6 @@ namespace editeng aLngCfg.GetProperty( UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES ) >>= m_bAutoReplaceUnique; } - //------------------------------------------------------------------------- void HangulHanjaConversion_Impl::implUpdateData() { implReadOptionsFromConfiguration(); @@ -905,7 +846,6 @@ namespace editeng m_pAntiImpl->HandleNewUnit( m_nCurrentStartIndex - m_nReplacementBaseIndex, m_nCurrentEndIndex - m_nReplacementBaseIndex ); } - //------------------------------------------------------------------------- IMPL_LINK( HangulHanjaConversion_Impl, OnOptionsChanged, void*, EMPTYARG ) { //options and dictionaries might have been changed @@ -915,7 +855,6 @@ namespace editeng return 0L; } - //------------------------------------------------------------------------- IMPL_LINK( HangulHanjaConversion_Impl, OnIgnore, void*, EMPTYARG ) { // simply ignore, and proceed @@ -923,7 +862,6 @@ namespace editeng return 0L; } - //------------------------------------------------------------------------- IMPL_LINK( HangulHanjaConversion_Impl, OnIgnoreAll, void*, EMPTYARG ) { DBG_ASSERT( m_pConversionDialog, "HangulHanjaConversion_Impl::OnIgnoreAll: no dialog! How this?" ); @@ -944,7 +882,6 @@ namespace editeng return 0L; } - //------------------------------------------------------------------------- IMPL_LINK( HangulHanjaConversion_Impl, OnChange, void*, EMPTYARG ) { // change @@ -957,7 +894,6 @@ namespace editeng return 0L; } - //------------------------------------------------------------------------- IMPL_LINK( HangulHanjaConversion_Impl, OnChangeAll, void*, EMPTYARG ) { DBG_ASSERT( m_pConversionDialog, "HangulHanjaConversion_Impl::OnChangeAll: no dialog! How this?" ); @@ -968,7 +904,7 @@ namespace editeng if( sChangeInto.getLength() ) { - // change the current occurence + // change the current occurrence implChange( sChangeInto ); // put into the "change all" list @@ -982,7 +918,6 @@ namespace editeng return 0L; } - //------------------------------------------------------------------------- IMPL_LINK( HangulHanjaConversion_Impl, OnByCharClicked, CheckBox*, _pBox ) { m_bByCharacter = _pBox->IsChecked(); @@ -992,7 +927,6 @@ namespace editeng return 0L; } - //------------------------------------------------------------------------- IMPL_LINK( HangulHanjaConversion_Impl, OnConversionTypeChanged, void*, EMPTYARG ) { DBG_ASSERT( m_pConversionDialog, "we should always have a dialog here!" ); @@ -1001,7 +935,6 @@ namespace editeng return 0L; } - //------------------------------------------------------------------------- IMPL_LINK( HangulHanjaConversion_Impl, OnFind, void*, EMPTYARG ) { DBG_ASSERT( m_pConversionDialog, "HangulHanjaConversion_Impl::OnFind: where did this come from?" ); @@ -1055,23 +988,16 @@ namespace editeng } catch( const Exception& ) { - DBG_ERROR( "HangulHanjaConversion_Impl::OnFind: caught an exception!" ); + OSL_FAIL( "HangulHanjaConversion_Impl::OnFind: caught an exception!" ); } } return 0L; } - //========================================================================= - //= HangulHanjaConversion - //========================================================================= - //------------------------------------------------------------------------- - - // static member initialization sal_Bool HangulHanjaConversion::m_bUseSavedValues = sal_False; sal_Bool HangulHanjaConversion::m_bTryBothDirectionsSave = sal_False; HHC::ConversionDirection HangulHanjaConversion::m_ePrimaryConversionDirectionSave = HHC::eHangulToHanja; - //------------------------------------------------------------------------- HangulHanjaConversion::HangulHanjaConversion( Window* _pUIParent, const Reference< XMultiServiceFactory >& _rxORB, const Locale& _rSourceLocale, const Locale& _rTargetLocale, @@ -1081,66 +1007,55 @@ namespace editeng { } - //------------------------------------------------------------------------- HangulHanjaConversion::~HangulHanjaConversion( ) { } - //------------------------------------------------------------------------- void HangulHanjaConversion::SetUseSavedConversionDirectionState( sal_Bool bVal ) { m_bUseSavedValues = bVal; } - //------------------------------------------------------------------------- sal_Bool HangulHanjaConversion::IsUseSavedConversionDirectionState() { return m_bUseSavedValues; } - //------------------------------------------------------------------------- LanguageType HangulHanjaConversion::GetSourceLanguage( ) const { return m_pImpl->GetSourceLang(); } - //------------------------------------------------------------------------- LanguageType HangulHanjaConversion::GetTargetLanguage( ) const { return m_pImpl->GetTargetLang(); } - //------------------------------------------------------------------------- const Font * HangulHanjaConversion::GetTargetFont( ) const { return m_pImpl->GetTargetFont(); } - //------------------------------------------------------------------------- sal_Int32 HangulHanjaConversion::GetConversionOptions( ) const { return m_pImpl->GetConvOptions(); } - //------------------------------------------------------------------------- sal_Bool HangulHanjaConversion::IsInteractive( ) const { return m_pImpl->IsInteractive(); } - //------------------------------------------------------------------------- void HangulHanjaConversion::HandleNewUnit( const sal_Int32, const sal_Int32 ) { // nothing to do, only derived classes need this. } - //------------------------------------------------------------------------- void HangulHanjaConversion::GetNextPortion( ::rtl::OUString&, LanguageType&, sal_Bool ) { - DBG_ERROR( "HangulHanjaConversion::GetNextPortion: to be overridden!" ); + OSL_FAIL( "HangulHanjaConversion::GetNextPortion: to be overridden!" ); } - //------------------------------------------------------------------------- void HangulHanjaConversion::ReplaceUnit( const sal_Int32, const sal_Int32, const ::rtl::OUString&, @@ -1149,25 +1064,21 @@ namespace editeng ReplacementAction, LanguageType * ) { - DBG_ERROR( "HangulHanjaConversion::ReplaceUnit: to be overridden!" ); + OSL_FAIL( "HangulHanjaConversion::ReplaceUnit: to be overridden!" ); } - //------------------------------------------------------------------------- sal_Bool HangulHanjaConversion::HasRubySupport() const { - DBG_ERROR( "HangulHanjaConversion::HasRubySupport: to be overridden!" ); + OSL_FAIL( "HangulHanjaConversion::HasRubySupport: to be overridden!" ); return sal_False; } - //------------------------------------------------------------------------- void HangulHanjaConversion::ConvertDocument() { if ( m_pImpl->IsValid() ) m_pImpl->DoDocumentConversion( ); } -//............................................................................. } // namespace svx -//............................................................................. /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/lingu.src b/editeng/source/misc/lingu.src index 146753207c..ad65e169e4 100644 --- a/editeng/source/misc/lingu.src +++ b/editeng/source/misc/lingu.src @@ -33,22 +33,22 @@ QueryBox RID_SVXQB_CONTINUE { BUTTONS = WB_YES_NO ; DEFBUTTON = WB_DEF_YES ; - /* ### ACHTUNG: Neuer Text in Resource? Überprüfung am Anfang des Dokumentes fortsetzen? : šberpr³fung am Anfang des Dokumentes fortsetzen? */ - /* ### ACHTUNG: Neuer Text in Resource? Überprüfung am Anfang des Dokumentes fortsetzen? : šberpr³fung am Anfang des Dokumentes fortsetzen? */ + /* ### WARNING: New Text in Resource? überpüfung am Anfang des Dokumentes fortsetzen? : šberpr³fung am Anfang des Dokumentes fortsetzen? */ + /* ### WARNING: New Text in Resource? Überprüfung am Anfang des Dokumentes fortsetzen? : šberpr³fung am Anfang des Dokumentes fortsetzen? */ Message [ en-US ] = "Continue checking at beginning of document?" ; }; QueryBox RID_SVXQB_BW_CONTINUE { BUTTONS = WB_YES_NO ; DEFBUTTON = WB_DEF_YES ; - /* ### ACHTUNG: Neuer Text in Resource? Überprüfung am Ende des Dokumentes fortsetzen? : šberpr³fung am Ende des Dokumentes fortsetzen? */ - /* ### ACHTUNG: Neuer Text in Resource? Überprüfung am Ende des Dokumentes fortsetzen? : šberpr³fung am Ende des Dokumentes fortsetzen? */ + /* ### WARNING: New Text in Resource? Überprüfung am Ende des Dokumentes fortsetzen? : šberpr³fung am Ende des Dokumentes fortsetzen? */ + /* ### WARNING: New Text in Resource? Überprüfung am Ende des Dokumentes fortsetzen? : šberpr³fung am Ende des Dokumentes fortsetzen? */ Message [ en-US ] = "Continue checking at end of document?" ; }; String RID_SVXSTR_HMERR_THESAURUS { - /* ### ACHTUNG: Neuer Text in Resource? Ein Thesaurus für die eingestellte Sprache ist nicht verfügbar. \nÜberprüfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewünschte Sprache : Ein Thesaurus f³r die eingestellte Sprache ist nicht verf³gbar. \nšberpr³fen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gew³nschte Sprache */ - /* ### ACHTUNG: Neuer Text in Resource? Ein Thesaurus für die eingestellte Sprache ist nicht verfügbar. \nÜberprüfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewünschte Sprache : Ein Thesaurus f³r die eingestellte Sprache ist nicht verf³gbar. \nšberpr³fen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gew³nschte Sprache */ + /* ### WARNING: New Text in Resource? Ein Thesaurus für die eingestellte Sprache ist nicht verfügbar. \nÜberprüfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewünschte Sprache : Ein Thesaurus f³r die eingestellte Sprache ist nicht verf³gbar. \nšberpr³fen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gew³nschte Sprache */ + /* ### WARNING: New Text in Resource? Ein Thesaurus für die eingestellte Sprache ist nicht verfügbar. \nÜberprüfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewünschte Sprache : Ein Thesaurus f³r die eingestellte Sprache ist nicht verf³gbar. \nšberpr³fen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gew³nschte Sprache */ Text [ en-US ] = "No thesaurus is available for the selected language. \nPlease check your installation and install the desired language\n" ; }; String RID_SVXSTR_DIC_ERR_UNKNOWN diff --git a/editeng/source/misc/makefile.mk b/editeng/source/misc/makefile.mk deleted file mode 100644 index 7eb2d80447..0000000000 --- a/editeng/source/misc/makefile.mk +++ /dev/null @@ -1,71 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.18 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=editeng -TARGET=misc - -#PROJECTPCH4DLL=TRUE -#PROJECTPCH=eeng_pch -#PROJECTPCHSOURCE=eeng_pch - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Allgemein ---------------------------------------------------------- - -.IF "$(editdebug)" != "" || "$(EDITDEBUG)" != "" -CDEFS+=-DEDITDEBUG -.ENDIF - -SLOFILES = \ - $(SLO)$/edtdlg.obj \ - $(SLO)$/unolingu.obj \ - $(SLO)$/acorrcfg.obj \ - $(SLO)$/forbiddencharacterstable.obj \ - $(SLO)$/hangulhanja.obj \ - $(SLO)$/splwrap.obj \ - $(SLO)$/svxacorr.obj \ - $(SLO)$/SvXMLAutoCorrectExport.obj \ - $(SLO)$/SvXMLAutoCorrectImport.obj \ - $(SLO)$/swafopt.obj \ - $(SLO)$/txtrange.obj - -SRS1NAME=misc -SRC1FILES = \ - lingu.src - -.INCLUDE : target.mk - diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx index 14df4228b1..3e5a4db514 100644 --- a/editeng/source/misc/splwrap.cxx +++ b/editeng/source/misc/splwrap.cxx @@ -46,7 +46,7 @@ #include <map> #include <editeng/svxenum.hxx> -#include <editeng/splwrap.hxx> // Der Wrapper +#include <editeng/splwrap.hxx> #include <editeng/edtdlg.hxx> #include <editeng/eerdll.hxx> #include <editeng/editrids.hrc> @@ -76,7 +76,7 @@ void SvxPrepareAutoCorrect( String &rOldText, String &rNewText ) // rOldText: text to be replaced // rNewText: replacement text - xub_StrLen nOldLen = rOldText.Len(), + xub_StrLen nOldLen = rOldText.Len(), nNewLen = rNewText.Len(); if (nOldLen && nNewLen) { @@ -88,8 +88,6 @@ void SvxPrepareAutoCorrect( String &rOldText, String &rNewText ) } } -// ----------------------------------------------------------------------- - #define SVX_LANG_NEED_CHECK 0 #define SVX_LANG_OK 1 #define SVX_LANG_MISSING 2 @@ -106,7 +104,7 @@ struct lt_LanguageType } }; -typedef std::map< LanguageType, USHORT, lt_LanguageType > LangCheckState_map_t; +typedef std::map< LanguageType, sal_uInt16, lt_LanguageType > LangCheckState_map_t; static LangCheckState_map_t & GetLangCheckState() { @@ -153,12 +151,12 @@ SvxSpellWrapper::~SvxSpellWrapper() } /*-------------------------------------------------------------------- - * Beschreibung: Ctor, die Pruefreihenfolge wird festgelegt + * Description: Constructor, the test sequence is determined * - * !bStart && !bOtherCntnt: BODY_END, BODY_START, OTHER - * !bStart && bOtherCntnt: OTHER, BODY - * bStart && !bOtherCntnt: BODY_END, OTHER - * bStart && bOtherCntnt: OTHER + * !bStart && !bOtherCntnt: BODY_END, BODY_START, OTHER + * !bStart && bOtherCntnt: OTHER, BODY + * bStart && !bOtherCntnt: BODY_END, OTHER + * bStart && bOtherCntnt: OTHER * --------------------------------------------------------------------*/ @@ -167,20 +165,20 @@ SvxSpellWrapper::SvxSpellWrapper( Window* pWn, const sal_Bool bStart, const sal_Bool bIsAllRight, const sal_Bool bOther, const sal_Bool bRevAllow ) : - pWin ( pWn ), - xSpell ( xSpellChecker ), - bOtherCntnt ( bOther ), - bDialog ( sal_False ), - bHyphen ( sal_False ), - bAuto ( sal_False ), - bStartChk ( bOther ), + pWin ( pWn ), + xSpell ( xSpellChecker ), + bOtherCntnt ( bOther ), + bDialog ( sal_False ), + bHyphen ( sal_False ), + bAuto ( sal_False ), + bStartChk ( bOther ), bRevAllowed ( bRevAllow ), bAllRight ( bIsAllRight ) { Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() ); sal_Bool bWrapReverse = xProp.is() ? *(sal_Bool*)xProp->getPropertyValue( - ::rtl::OUString::createFromAscii(UPN_IS_WRAP_REVERSE) ).getValue() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UPN_IS_WRAP_REVERSE)) ).getValue() : sal_False; bReverse = bRevAllow && bWrapReverse; bStartDone = bOther || ( !bReverse && bStart ); @@ -192,16 +190,16 @@ SvxSpellWrapper::SvxSpellWrapper( Window* pWn, SvxSpellWrapper::SvxSpellWrapper( Window* pWn, Reference< XHyphenator > &xHyphenator, const sal_Bool bStart, const sal_Bool bOther ) : - pWin ( pWn ), - xHyph ( xHyphenator ), - bOtherCntnt ( bOther ), - bDialog ( sal_False ), - bHyphen ( sal_False ), - bAuto ( sal_False ), - bReverse ( sal_False ), - bStartDone ( bOther || ( !bReverse && bStart ) ), - bEndDone ( bReverse && bStart && !bOther ), - bStartChk ( bOther ), + pWin ( pWn ), + xHyph ( xHyphenator ), + bOtherCntnt ( bOther ), + bDialog ( sal_False ), + bHyphen ( sal_False ), + bAuto ( sal_False ), + bReverse ( sal_False ), + bStartDone ( bOther || ( !bReverse && bStart ) ), + bEndDone ( bReverse && bStart && !bOther ), + bStartChk ( bOther ), bRevAllowed ( sal_False ), bAllRight ( sal_True ) { @@ -263,15 +261,15 @@ sal_Int16 SvxSpellWrapper::CheckHyphLang( void SvxSpellWrapper::SpellStart( SvxSpellArea /*eSpell*/ ) -{ // Hier muessen die notwendigen Vorbereitungen fuer SpellContinue -} // im uebergebenen Bereich getroffen werden. +{ // Here, the necessary preparations be made for SpellContinue in the +} // given area. // ----------------------------------------------------------------------- sal_Bool SvxSpellWrapper::HasOtherCnt() { - return sal_False; // Gibt es ueberhaupt einen Sonderbereich? + return sal_False; // Is there a special area? } // ----------------------------------------------------------------------- @@ -279,14 +277,14 @@ sal_Bool SvxSpellWrapper::HasOtherCnt() sal_Bool SvxSpellWrapper::SpellMore() { - return sal_False; // Sollen weitere Dokumente geprueft werden? + return sal_False; // Should additional documents be examined? } // ----------------------------------------------------------------------- void SvxSpellWrapper::SpellEnd() -{ // Bereich ist abgeschlossen, ggf. Aufraeumen +{ // Area is complete, tidy up if necessary // display error for last language not found ShowLanguageErrors(); @@ -310,14 +308,14 @@ void SvxSpellWrapper::AutoCorrect( const String&, const String& ) void SvxSpellWrapper::ScrollArea() -{ // Scrollarea einstellen +{ // Set Scroll area } // ----------------------------------------------------------------------- void SvxSpellWrapper::ChangeWord( const String&, const sal_uInt16 ) -{ // Wort ersetzen +{ // Insert Word } // ----------------------------------------------------------------------- @@ -325,7 +323,7 @@ void SvxSpellWrapper::ChangeWord( const String&, const sal_uInt16 ) String SvxSpellWrapper::GetThesWord() { - // Welches Wort soll nachgeschlagen werden? + // What word should be looked up? return String(); } @@ -334,7 +332,7 @@ String SvxSpellWrapper::GetThesWord() void SvxSpellWrapper::ChangeThesWord( const String& ) { - // Wort wg. Thesaurus ersetzen + // replace word due to Thesaurus. } // ----------------------------------------------------------------------- @@ -348,7 +346,7 @@ void SvxSpellWrapper::StartThesaurus( const String &rWord, sal_uInt16 nLanguage return; } - WAIT_ON(); // while looking up for initial word + WAIT_ON(); // while looking up for initial word EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create(); AbstractThesaurusDialog* pDlg = pFact->CreateThesaurusDialog( pWin, xThes, rWord, nLanguage ); WAIT_OFF(); @@ -362,25 +360,25 @@ void SvxSpellWrapper::StartThesaurus( const String &rWord, sal_uInt16 nLanguage // ----------------------------------------------------------------------- void SvxSpellWrapper::ReplaceAll( const String &, sal_Int16 ) -{ // Wort aus der Replace-Liste ersetzen +{ // Replace Word from the the Replace list } // ----------------------------------------------------------------------- void SvxSpellWrapper::SetLanguage( const sal_uInt16 ) -{ // Sprache aendern +{ // Set Language } // ----------------------------------------------------------------------- void SvxSpellWrapper::InsertHyphen( const sal_uInt16 ) -{ // Hyphen einfuegen bzw. loeschen +{ // inserting and deleting Hyphae } // ----------------------------------------------------------------------- -// Pruefung der Dokumentbereiche in der durch die Flags angegebenen Reihenfolge +// Testing of the document areas in the order specified by the flags void SvxSpellWrapper::SpellDocument( ) @@ -398,8 +396,8 @@ void SvxSpellWrapper::SpellDocument( ) if ( FindSpellError() ) { - Reference< XSpellAlternatives > xAlt( GetLast(), UNO_QUERY ); - Reference< XHyphenatedWord > xHyphWord( GetLast(), UNO_QUERY ); + Reference< XSpellAlternatives > xAlt( GetLast(), UNO_QUERY ); + Reference< XHyphenatedWord > xHyphWord( GetLast(), UNO_QUERY ); Window *pOld = pWin; bDialog = sal_True; @@ -420,7 +418,7 @@ void SvxSpellWrapper::SpellDocument( ) } // ----------------------------------------------------------------------- -// Naechsten Bereich auswaehlen +// Select the next area sal_Bool SvxSpellWrapper::SpellNext( ) @@ -428,30 +426,31 @@ sal_Bool SvxSpellWrapper::SpellNext( ) Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() ); sal_Bool bWrapReverse = xProp.is() ? *(sal_Bool*)xProp->getPropertyValue( - ::rtl::OUString::createFromAscii(UPN_IS_WRAP_REVERSE) ).getValue() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UPN_IS_WRAP_REVERSE)) ).getValue() : sal_False; sal_Bool bActRev = bRevAllowed && bWrapReverse; - // bActRev ist die Richtung nach dem Spellen, bReverse die am Anfang. + // bActRev is the direction after Spell checking, bReverse is the one + // at the beginning. if( bActRev == bReverse ) - { // Keine Richtungsaenderung, also ist - if( bStartChk ) // der gewuenschte Bereich ( bStartChk ) - bStartDone = sal_True; // vollstaendig abgearbeitet. + { // No change of direction, thus is the + if( bStartChk ) // desired area ( bStartChk ) + bStartDone = sal_True; // completely processed. else bEndDone = sal_True; } - else if( bReverse == bStartChk ) // Bei einer Richtungsaenderung kann - { // u.U. auch ein Bereich abgearbeitet sein. - if( bStartChk ) // Sollte der vordere Teil rueckwaerts gespellt - bEndDone = sal_True; // werden und wir kehren unterwegs um, so ist - else // der hintere Teil abgearbeitet (und umgekehrt). + else if( bReverse == bStartChk ) //For a change of direction, an area can + { // be processed during certain circumstances + if( bStartChk ) // If the firdt part is spell checked in backwards + bEndDone = sal_True; // and this is reversed in the process, then + else // then the end part is processed (and vice-versa). bStartDone = sal_True; } bReverse = bActRev; - if( bOtherCntnt && bStartDone && bEndDone ) // Dokument komplett geprueft? + if( bOtherCntnt && bStartDone && bEndDone ) // Document has been fully checked? { - if ( SpellMore() ) // ein weiteres Dokument pruefen? + if ( SpellMore() ) // spell check another document? { bOtherCntnt = sal_False; bStartDone = !bReverse; @@ -474,15 +473,15 @@ sal_Bool SvxSpellWrapper::SpellNext( ) { sal_Bool bIsSpellSpecial = xProp.is() ? *(sal_Bool*)xProp->getPropertyValue( - ::rtl::OUString::createFromAscii(UPN_IS_SPELL_SPECIAL) ).getValue() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UPN_IS_SPELL_SPECIAL)) ).getValue() : sal_False; - // Bodybereich erledigt, Frage nach Sonderbereich + // Body area done, ask for special area if( !IsHyphen() && bIsSpellSpecial && HasOtherCnt() ) { SpellStart( SVX_SPELL_OTHER ); bOtherCntnt = bGoOn = sal_True; } - else if ( SpellMore() ) // ein weiteres Dokument pruefen? + else if ( SpellMore() ) // check another document? { bOtherCntnt = sal_False; bStartDone = !bReverse; @@ -493,24 +492,14 @@ sal_Bool SvxSpellWrapper::SpellNext( ) } else { - // Ein BODY_Bereich erledigt, Frage nach dem anderen BODY_Bereich + // a BODY_area done, ask for the other BODY_area WAIT_OFF(); -// Sobald im Dialog das DontWrapAround gesetzt werden kann, kann der -// folgende #ifdef-Zweig aktiviert werden ... -#ifdef USED - sal_Bool bDontWrapAround = IsHyphen() ? - pSpell->GetOptions() & DONT_WRAPAROUND : - pSpell->GetHyphOptions() & HYPH_DONT_WRAPAROUND; - if( bDontWrapAround ) -#else sal_uInt16 nResId = bReverse ? RID_SVXQB_BW_CONTINUE : RID_SVXQB_CONTINUE; QueryBox aBox( pWin, EditResId( nResId ) ); if ( aBox.Execute() != RET_YES ) -#endif - { - // Verzicht auf den anderen Bereich, ggf. Frage nach Sonderbereich + // sacrifice the other area if necessary ask for special area WAIT_ON(); bStartDone = bEndDone = sal_True; return SpellNext(); @@ -576,7 +565,7 @@ sal_Bool SvxSpellWrapper::FindSpellError() { ShowLanguageErrors(); - Reference< XInterface > xRef; + Reference< XInterface > xRef; WAIT_ON(); sal_Bool bSpell = sal_True; @@ -589,8 +578,8 @@ sal_Bool SvxSpellWrapper::FindSpellError() { SpellContinue(); - Reference< XSpellAlternatives > xAlt( GetLast(), UNO_QUERY ); - Reference< XHyphenatedWord > xHyphWord( GetLast(), UNO_QUERY ); + Reference< XSpellAlternatives > xAlt( GetLast(), UNO_QUERY ); + Reference< XHyphenatedWord > xHyphWord( GetLast(), UNO_QUERY ); if (xAlt.is()) { @@ -603,7 +592,7 @@ sal_Bool SvxSpellWrapper::FindSpellError() // look up in ChangeAllList for misspelled word Reference< XDictionary > xChangeAllList( SvxGetChangeAllList(), UNO_QUERY ); - Reference< XDictionaryEntry > xEntry; + Reference< XDictionaryEntry > xEntry; if (xChangeAllList.is()) xEntry = xChangeAllList->getEntry( xAlt->getWord() ); diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 162cbac5ad..ff7a98dedd 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -37,7 +37,7 @@ #include <i18npool/mslangid.hxx> #include <vcl/svapp.hxx> #include <sot/storinfo.hxx> -// fuer die Sort-String-Arrays aus dem SVMEM.HXX +// for the Sort-String-Arrays from SVMEM.HXX #define _SVSTDARR_STRINGSISORTDTOR #define _SVSTDARR_STRINGSDTOR #include <svl/svstdarr.hxx> @@ -48,6 +48,7 @@ #include <com/sun/star/i18n/UnicodeType.hdl> #include <unotools/collatorwrapper.hxx> #include <com/sun/star/i18n/CollatorOptions.hpp> +#include <com/sun/star/i18n/UnicodeScript.hpp> #include <unotools/localedatawrapper.hxx> #include <unotools/transliterationwrapper.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -98,19 +99,19 @@ static const sal_Char pXMLImplCplStt_ExcptLstStr[] = "SentenceExceptList.xml"; static const sal_Char pXMLImplAutocorr_ListStr[] = "DocumentList.xml"; static const sal_Char - /* auch bei diesen Anfaengen - Klammern auf und alle Arten von Anf.Zei. */ + /* also at these beginnings - Brackets and all kinds of begin characters */ sImplSttSkipChars[] = "\"\'([{\x83\x84\x89\x91\x92\x93\x94", - /* auch bei diesen Ende - Klammern auf und alle Arten von Anf.Zei. */ + /* also at these ends - Brackets and all kinds of begin characters */ sImplEndSkipChars[] = "\"\')]}\x83\x84\x89\x91\x92\x93\x94"; -// diese Zeichen sind in Worten erlaubt: (fuer FnCptlSttSntnc) +// These characters are allowed in words: (for FnCptlSttSntnc) static const sal_Char sImplWordChars[] = "-'"; void EncryptBlockName_Imp( String& rName ); void DecryptBlockName_Imp( String& rName ); -// FileVersions Nummern fuer die Ersetzungs-/Ausnahmelisten getrennt +// FileVersions Number for the Substitution-/Exception list separately #define WORDLIST_VERSION_358 1 #define EXEPTLIST_VERSION_358 0 @@ -141,32 +142,55 @@ inline int IsUpperLetter( sal_Int32 nCharType ) 0 == ( ::com::sun::star::i18n::KCharacterType::LOWER & nCharType); } -BOOL lcl_IsSymbolChar( CharClass& rCC, const String& rTxt, +bool lcl_IsUnsupportedUnicodeChar( CharClass& rCC, const String& rTxt, + xub_StrLen nStt, xub_StrLen nEnd ) +{ + for( ; nStt < nEnd; ++nStt ) + { + short nScript = rCC.getScript( rTxt, nStt ); + switch( nScript ) + { + case ::com::sun::star::i18n::UnicodeScript_kCJKRadicalsSupplement: + case ::com::sun::star::i18n::UnicodeScript_kHangulJamo: + case ::com::sun::star::i18n::UnicodeScript_kCJKSymbolPunctuation: + case ::com::sun::star::i18n::UnicodeScript_kHiragana: + case ::com::sun::star::i18n::UnicodeScript_kKatakana: + case ::com::sun::star::i18n::UnicodeScript_kHangulCompatibilityJamo: + case ::com::sun::star::i18n::UnicodeScript_kEnclosedCJKLetterMonth: + case ::com::sun::star::i18n::UnicodeScript_kCJKCompatibility: + case ::com::sun::star::i18n::UnicodeScript_k_CJKUnifiedIdeographsExtensionA: + case ::com::sun::star::i18n::UnicodeScript_kCJKUnifiedIdeograph: + case ::com::sun::star::i18n::UnicodeScript_kHangulSyllable: + case ::com::sun::star::i18n::UnicodeScript_kCJKCompatibilityIdeograph: + case ::com::sun::star::i18n::UnicodeScript_kHalfwidthFullwidthForm: + return true; + default: ; //do nothing + } + + } + return false; +} + +sal_Bool lcl_IsSymbolChar( CharClass& rCC, const String& rTxt, xub_StrLen nStt, xub_StrLen nEnd ) { for( ; nStt < nEnd; ++nStt ) { -#if OSL_DEBUG_LEVEL > 1 - sal_Int32 nCharType; - sal_Int32 nChType; - nCharType = rCC.getCharacterType( rTxt, nStt ); - nChType = rCC.getType( rTxt, nStt ); -#endif if( ::com::sun::star::i18n::UnicodeType::PRIVATE_USE == rCC.getType( rTxt, nStt )) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -static BOOL lcl_IsInAsciiArr( const sal_Char* pArr, const sal_Unicode c ) +static sal_Bool lcl_IsInAsciiArr( const sal_Char* pArr, const sal_Unicode c ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; for( ; *pArr; ++pArr ) if( *pArr == c ) { - bRet = TRUE; + bRet = sal_True; break; } return bRet; @@ -175,19 +199,17 @@ static BOOL lcl_IsInAsciiArr( const sal_Char* pArr, const sal_Unicode c ) SvxAutoCorrDoc::~SvxAutoCorrDoc() { } - - - // wird nach dem austauschen der Zeichen von den Funktionen + // Is called by the functions: // - FnCptlSttWrd // - FnCptlSttSntnc - // gerufen. Dann koennen die Worte ggfs. in die Ausnahmelisten - // aufgenommen werden. -void SvxAutoCorrDoc::SaveCpltSttWord( ULONG, xub_StrLen, const String&, + // after the exchange of characters. then the words can maybe be inserted + // into the exception list. +void SvxAutoCorrDoc::SaveCpltSttWord( sal_uLong, xub_StrLen, const String&, sal_Unicode ) { } -LanguageType SvxAutoCorrDoc::GetLanguage( xub_StrLen , BOOL ) const +LanguageType SvxAutoCorrDoc::GetLanguage( xub_StrLen , sal_Bool ) const { return LANGUAGE_SYSTEM; } @@ -201,11 +223,11 @@ static ::com::sun::star::uno::Reference< return xMSF; } -static USHORT GetAppLang() +static sal_uInt16 GetAppLang() { return Application::GetSettings().GetLanguage(); } -static LocaleDataWrapper& GetLocaleDataWrapper( USHORT nLang ) +static LocaleDataWrapper& GetLocaleDataWrapper( sal_uInt16 nLang ) { static LocaleDataWrapper aLclDtWrp( GetProcessFact(), SvxCreateLocale( GetAppLang() ) ); @@ -243,21 +265,21 @@ static CollatorWrapper& GetCollatorWrapper() } -void SvxAutocorrWordList::DeleteAndDestroy( USHORT nP, USHORT nL ) +void SvxAutocorrWordList::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) { if( nL ) { - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); - for( USHORT n=nP; n < nP + nL; n++ ) + OSL_ENSURE( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); + for( sal_uInt16 n=nP; n < nP + nL; n++ ) delete *((SvxAutocorrWordPtr*)pData+n); SvPtrarr::Remove( nP, nL ); } } -BOOL SvxAutocorrWordList::Seek_Entry( const SvxAutocorrWordPtr aE, USHORT* pP ) const +sal_Bool SvxAutocorrWordList::Seek_Entry( const SvxAutocorrWordPtr aE, sal_uInt16* pP ) const { - register USHORT nO = SvxAutocorrWordList_SAR::Count(), + register sal_uInt16 nO = SvxAutocorrWordList_SAR::Count(), nM, nU = 0; if( nO > 0 ) @@ -272,26 +294,23 @@ BOOL SvxAutocorrWordList::Seek_Entry( const SvxAutocorrWordPtr aE, USHORT* pP ) if( 0 == nCmp ) { if( pP ) *pP = nM; - return TRUE; + return sal_True; } else if( 0 < nCmp ) nU = nM + 1; else if( nM == 0 ) { if( pP ) *pP = nU; - return FALSE; + return sal_False; } else nO = nM - 1; } } if( pP ) *pP = nU; - return FALSE; + return sal_False; } -/* -----------------18.11.98 15:28------------------- - * - * --------------------------------------------------*/ void lcl_ClearTable(SvxAutoCorrLanguageTable_Impl& rLangTable) { SvxAutoCorrectLanguageListsPtr pLists = rLangTable.Last(); @@ -303,10 +322,6 @@ void lcl_ClearTable(SvxAutoCorrLanguageTable_Impl& rLangTable) rLangTable.Clear(); } -/* -----------------03.11.06 10:15------------------- - * - * --------------------------------------------------*/ - sal_Bool SvxAutoCorrect::IsAutoCorrectChar( sal_Unicode cChar ) { return cChar == '\0' || cChar == '\t' || cChar == 0x0a || @@ -322,9 +337,6 @@ sal_Bool SvxAutoCorrect::NeedsHardspaceAutocorr( sal_Unicode cChar ) cChar == '/' /*case for the urls exception*/; } -/* -----------------19.11.98 10:15------------------- - * - * --------------------------------------------------*/ long SvxAutoCorrect::GetDefaultFlags() { long nRet = Autocorrect @@ -407,7 +419,7 @@ void SvxAutoCorrect::_GetCharClass( LanguageType eLang ) eCharClassLang = eLang; } -void SvxAutoCorrect::SetAutoCorrFlag( long nFlag, BOOL bOn ) +void SvxAutoCorrect::SetAutoCorrFlag( long nFlag, sal_Bool bOn ) { long nOld = nFlags; nFlags = bOn ? nFlags | nFlag @@ -425,16 +437,16 @@ void SvxAutoCorrect::SetAutoCorrFlag( long nFlag, BOOL bOn ) } - // Zwei Grossbuchstaben am Wort-Anfang ?? -BOOL SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const String& rTxt, + // Two capital letters at the beginning of word? +sal_Bool SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; CharClass& rCC = GetCharClass( eLang ); - // loesche alle nicht alpanum. Zeichen am Wortanfang/-ende und - // teste dann ( erkennt: "(min.", "/min.", usw.) + // Delete all non alphanumeric. Test the characters at the beginning/end of + // the word ( recognizes: "(min.", "/min.", and so on.) for( ; nSttPos < nEndPos; ++nSttPos ) if( rCC.isLetterNumeric( rTxt, nSttPos )) break; @@ -442,27 +454,37 @@ BOOL SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const String& rTxt, if( rCC.isLetterNumeric( rTxt, nEndPos - 1 )) break; - // Zwei Grossbuchstaben am Wort-Anfang ?? + // Two capital letters at the beginning of word? if( nSttPos+2 < nEndPos && IsUpperLetter( rCC.getCharacterType( rTxt, nSttPos )) && IsUpperLetter( rCC.getCharacterType( rTxt, ++nSttPos )) && - // ist das 3. Zeichen ein klein geschiebenes Alpha-Zeichen + // Is the third character a lower case IsLowerLetter( rCC.getCharacterType( rTxt, nSttPos +1 )) && - // keine Sonder-Attribute ersetzen + // Do not replace special attributes 0x1 != rTxt.GetChar( nSttPos ) && 0x2 != rTxt.GetChar( nSttPos )) { - // teste ob das Wort in einer Ausnahmeliste steht + // test if the word is in an exception list String sWord( rTxt.Copy( nSttPos - 1, nEndPos - nSttPos + 1 )); if( !FindInWrdSttExceptList(eLang, sWord) ) { - sal_Unicode cSave = rTxt.GetChar( nSttPos ); - String sChar( cSave ); - rCC.toLower( sChar ); - if( sChar.GetChar(0) != cSave && rDoc.Replace( nSttPos, sChar )) + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > xSpeller = + SvxGetSpellChecker(); + Sequence< ::com::sun::star::beans::PropertyValue > aEmptySeq; + // Check that word isn't correctly spelled before correcting + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt + = xSpeller->spell(sWord, eLang, aEmptySeq); + if(xSpellAlt.is()) { - if( SaveWordWrdSttLst & nFlags ) - rDoc.SaveCpltSttWord( CptlSttWrd, nSttPos, sWord, cSave ); - bRet = TRUE; + sal_Unicode cSave = rTxt.GetChar( nSttPos ); + String sChar( cSave ); + rCC.toLower( sChar ); + if( sChar.GetChar(0) != cSave && rDoc.ReplaceRange( nSttPos, 1, sChar )) + { + if( SaveWordWrdSttLst & nFlags ) + rDoc.SaveCpltSttWord( CptlSttWrd, nSttPos, sWord, cSave ); + bRet = sal_True; + } } } } @@ -470,16 +492,16 @@ BOOL SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const String& rTxt, } -BOOL SvxAutoCorrect::FnChgOrdinalNumber( +sal_Bool SvxAutoCorrect::FnChgOrdinalNumber( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang ) { // 1st, 2nd, 3rd, 4 - 0th -// 201th oder 201st -// 12th oder 12nd +// 201th or 201st +// 12th or 12nd CharClass& rCC = GetCharClass( eLang ); - BOOL bChg = FALSE; + sal_Bool bChg = sal_False; for( ; nSttPos < nEndPos; ++nSttPos ) if( !lcl_IsInAsciiArr( sImplSttSkipChars, rTxt.GetChar( nSttPos ) )) @@ -491,12 +513,12 @@ BOOL SvxAutoCorrect::FnChgOrdinalNumber( if( 2 < nEndPos - nSttPos && rCC.isDigit( rTxt, nEndPos - 3 ) ) { - static sal_Char __READONLY_DATA + static sal_Char const sAll[] = "th", /* rest */ sFirst[] = "st", /* 1 */ sSecond[] = "nd", /* 2 */ sThird[] = "rd"; /* 3 */ - static const sal_Char* __READONLY_DATA aNumberTab[ 4 ] = + static const sal_Char* const aNumberTab[ 4 ] = { sAll, sFirst, sSecond, sThird }; @@ -515,7 +537,7 @@ BOOL SvxAutoCorrect::FnChgOrdinalNumber( if( bChg ) { - // dann pruefe mal, ob alle bis zum Start alle Zahlen sind + // then check to the start, if all are numbers for( xub_StrLen n = nEndPos - 3; nSttPos < n; ) if( !rCC.isDigit( rTxt, --n ) ) { @@ -523,7 +545,7 @@ BOOL SvxAutoCorrect::FnChgOrdinalNumber( break; } - if( bChg ) // dann setze mal das Escapement Attribut + if( bChg ) // then set the escapement attribute { SvxEscapementItem aSvxEscapementItem( DFLT_ESC_AUTO_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT ); @@ -538,18 +560,18 @@ BOOL SvxAutoCorrect::FnChgOrdinalNumber( } -BOOL SvxAutoCorrect::FnChgToEnEmDash( +sal_Bool SvxAutoCorrect::FnChgToEnEmDash( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; CharClass& rCC = GetCharClass( eLang ); if (eLang == LANGUAGE_SYSTEM) eLang = GetAppLang(); bool bAlwaysUseEmDash = (cEmDash && (eLang == LANGUAGE_RUSSIAN || eLang == LANGUAGE_UKRAINIAN)); - // ersetze " - " oder " --" durch "enDash" + // replace " - " or " --" with "enDash" if( cEnDash && 1 < nSttPos && 1 <= nEndPos - nSttPos ) { sal_Unicode cCh = rTxt.GetChar( nSttPos ); @@ -576,7 +598,7 @@ BOOL SvxAutoCorrect::FnChgToEnEmDash( { rDoc.Delete( nSttPos, nSttPos + 2 ); rDoc.Insert( nSttPos, bAlwaysUseEmDash ? cEmDash : cEnDash ); - bRet = TRUE; + bRet = sal_True; } } } @@ -611,7 +633,7 @@ BOOL SvxAutoCorrect::FnChgToEnEmDash( { rDoc.Delete( nTmpPos, nTmpPos + nLen ); rDoc.Insert( nTmpPos, bAlwaysUseEmDash ? cEmDash : cEnDash ); - bRet = TRUE; + bRet = sal_True; } } } @@ -635,13 +657,13 @@ BOOL SvxAutoCorrect::FnChgToEnEmDash( nSttPos = nSttPos + nFndPos; rDoc.Delete( nSttPos, nSttPos + 2 ); rDoc.Insert( nSttPos, (bEnDash ? cEnDash : cEmDash) ); - bRet = TRUE; + bRet = sal_True; } } return bRet; } -BOOL SvxAutoCorrect::FnAddNonBrkSpace( +sal_Bool SvxAutoCorrect::FnAddNonBrkSpace( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen, xub_StrLen nEndPos, LanguageType eLang ) @@ -651,13 +673,13 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( CharClass& rCC = GetCharClass( eLang ); const lang::Locale rLocale = rCC.getLocale( ); - if ( rLocale.Language == OUString::createFromAscii( "fr" ) ) + if ( rLocale.Language == OUString(RTL_CONSTASCII_USTRINGPARAM( "fr" )) ) { - bool bFrCA = rLocale.Country == OUString::createFromAscii( "CA" ); - OUString allChars = OUString::createFromAscii( ":;!?" ); + bool bFrCA = rLocale.Country == OUString(RTL_CONSTASCII_USTRINGPARAM( "CA" )); + OUString allChars = OUString(RTL_CONSTASCII_USTRINGPARAM( ":;!?" )); OUString chars( allChars ); if ( bFrCA ) - chars = OUString::createFromAscii( ":" ); + chars = OUString(RTL_CONSTASCII_USTRINGPARAM( ":" )); sal_Unicode cChar = rTxt.GetChar( nEndPos ); bool bHasSpace = chars.indexOf( cChar ) != -1; @@ -666,8 +688,14 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( { // Get the last word delimiter position xub_StrLen nSttWdPos = nEndPos; - while( nSttWdPos && !IsWordDelim( rTxt.GetChar( --nSttWdPos ))) + bool bWasWordDelim = false; + while( nSttWdPos && !(bWasWordDelim = IsWordDelim( rTxt.GetChar( --nSttWdPos )))) ; + + if(INetURLObject::CompareProtocolScheme(rTxt.Copy(nSttWdPos + (bWasWordDelim ? 1 : 0), nEndPos - nSttWdPos + 1)) != INET_PROT_NOT_VALID) { + return sal_False; + } + // Check the presence of "://" in the word xub_StrLen nStrPos = rTxt.Search( String::CreateFromAscii( "://" ), nSttWdPos + 1 ); @@ -716,35 +744,35 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( return bRet; } -BOOL SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const String& rTxt, +sal_Bool SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang ) { String sURL( URIHelper::FindFirstURLInText( rTxt, nSttPos, nEndPos, GetCharClass( eLang ) )); - BOOL bRet = 0 != sURL.Len(); + sal_Bool bRet = 0 != sURL.Len(); if( bRet ) // also Attribut setzen: rDoc.SetINetAttr( nSttPos, nEndPos, sURL ); return bRet; } -BOOL SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const String& rTxt, +sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen, xub_StrLen nEndPos, LanguageType eLang ) { - // Bedingung: - // Am Anfang: _ oder * hinter Space mit nachfolgenden !Space - // Am Ende: _ oder * vor Space (Worttrenner?) + // Condition: + // at the beginning: _ or * after Space with the folloeing !Space + // at the end: _ or * before Space (word delimiter?) - sal_Unicode c, cInsChar = rTxt.GetChar( nEndPos ); // unterstreichen oder fett + sal_Unicode c, cInsChar = rTxt.GetChar( nEndPos ); // underline or bold if( ++nEndPos != rTxt.Len() && !IsWordDelim( rTxt.GetChar( nEndPos ) ) ) - return FALSE; + return sal_False; --nEndPos; - BOOL bAlphaNum = FALSE; + sal_Bool bAlphaNum = sal_False; xub_StrLen nPos = nEndPos, nFndPos = STRING_NOTFOUND; CharClass& rCC = GetCharClass( eLang ); @@ -761,7 +789,7 @@ BOOL SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const String& rTxt !IsWordDelim( rTxt.GetChar( nPos+1 ))) nFndPos = nPos; else - // Bedingung ist nicht erfuellt, also abbrechen + // Condition is not satisfied, so cancel nFndPos = STRING_NOTFOUND; nPos = 0; } @@ -774,16 +802,16 @@ BOOL SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const String& rTxt if( STRING_NOTFOUND != nFndPos ) { - // ueber den gefundenen Bereich das Attribut aufspannen und - // das gefunde und am Ende stehende Zeichen loeschen - if( '*' == cInsChar ) // Fett + // Span the Attribute over the area and delete the Character found at + // the end. + if( '*' == cInsChar ) // Bold { SvxWeightItem aSvxWeightItem( WEIGHT_BOLD, SID_ATTR_CHAR_WEIGHT ); rDoc.SetAttr( nFndPos + 1, nEndPos, SID_ATTR_CHAR_WEIGHT, aSvxWeightItem); } - else // unterstrichen + else // underline { SvxUnderlineItem aSvxUnderlineItem( UNDERLINE_SINGLE, SID_ATTR_CHAR_UNDERLINE ); rDoc.SetAttr( nFndPos + 1, nEndPos, @@ -798,23 +826,23 @@ BOOL SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const String& rTxt } -BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, - const String& rTxt, BOOL bNormalPos, +sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, + const String& rTxt, sal_Bool bNormalPos, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang ) { - // Grossbuchstabe am Satz-Anfang ?? + if( !rTxt.Len() || nEndPos <= nSttPos ) - return FALSE; + return sal_False; - CharClass& rCC = GetCharClass( eLang ); + CharClass& rCC = GetCharClass( eLang ); String aText( rTxt ); const sal_Unicode *pStart = aText.GetBuffer(), *pStr = pStart + nEndPos, *pWordStt = 0, *pDelim = 0; - BOOL bAtStart = FALSE, bPrevPara = FALSE; + sal_Bool bAtStart = sal_False; do { --pStr; if( rCC.isLetter( @@ -831,10 +859,8 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, { if( lcl_IsInAsciiArr( sImplWordChars, *pStr ) && pWordStt - 1 == pStr && - // --> FME 2005-02-14 #i38971# - // l'intallazione at beginning of paragraph. Replaced < by <= + // Installation at beginning of paragraph. Replaced < by <= (#i38971#) (long)(pStart + 1) <= (long)pStr && - // <-- rCC.isLetter( aText, sal::static_int_cast< xub_StrLen >( pStr-1 - pStart ) ) ) @@ -844,7 +870,6 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, } } while( 0 == ( bAtStart = (pStart == pStr)) ); - if( !pWordStt || rCC.isDigit( aText, sal::static_int_cast< xub_StrLen >( pStr - pStart ) ) || @@ -852,17 +877,15 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, rCC.getCharacterType( aText, sal::static_int_cast< xub_StrLen >( pWordStt - pStart ) ) ) || + INetURLObject::CompareProtocolScheme(rTxt.Copy(pWordStt - pStart, pDelim - pWordStt + 1)) != INET_PROT_NOT_VALID || 0x1 == *pWordStt || 0x2 == *pWordStt ) - return FALSE; // kein zu ersetzendes Zeichen, oder schon ok + return sal_False; // no character to be replaced, or already ok - // JP 27.10.97: wenn das Wort weniger als 3 Zeichen hat und der Trenner - // ein "Num"-Trenner ist, dann nicht ersetzen! - // Damit wird ein "a.", "a)", "a-a" nicht ersetzt! if( *pDelim && 2 >= pDelim - pWordStt && lcl_IsInAsciiArr( ".-)>", *pDelim ) ) - return FALSE; + return sal_False; - if( !bAtStart ) // noch kein Absatz Anfang ? + if( !bAtStart ) // Still no beginning of a paragraph? { if ( IsWordDelim( *pStr ) ) { @@ -873,45 +896,44 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, // and full width question marks are treated as word delimiters else if ( 0x3002 != *pStr && 0xFF0E != *pStr && 0xFF01 != *pStr && 0xFF1F != *pStr ) - return FALSE; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement } - if( bAtStart ) // am Absatz Anfang ? + if( bAtStart ) // at the beginning of a paragraph? { - // Ueberpruefe den vorherigen Absatz, wenn es diesen gibt. - // Wenn ja, dann pruefe auf SatzTrenner am Ende. + // Check out the previous paragraph, if it exists. + // If so, then check to paragraph separator at the end. const String* pPrevPara = rDoc.GetPrevPara( bNormalPos ); if( !pPrevPara ) { - // gueltiger Trenner -> Ersetze + // valid separator -> replace String sChar( *pWordStt ); rCC.toUpper( sChar ); return sChar != *pWordStt && - rDoc.Replace( xub_StrLen( pWordStt - pStart ), sChar ); + rDoc.ReplaceRange( xub_StrLen( pWordStt - pStart ), 1, sChar ); } aText = *pPrevPara; - bPrevPara = TRUE; - bAtStart = FALSE; + bAtStart = sal_False; pStart = aText.GetBuffer(); pStr = pStart + aText.Len(); - do { // alle Blanks ueberlesen + do { // overwrite all blanks --pStr; if( !IsWordDelim( *pStr )) break; } while( 0 == ( bAtStart = (pStart == pStr)) ); if( bAtStart ) - return FALSE; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement } - // bis hierhier wurde [ \t]+[A-Z0-9]+ gefunden. Test jetzt auf den - // Satztrenner. Es koennen alle 3 vorkommen, aber nicht mehrfach !! + // Found [ \t]+[A-Z0-9]+ until here. Test now on the paragraph separator. + // all three can happen, but not more than once! const sal_Unicode* pExceptStt = 0; if( !bAtStart ) { - BOOL bWeiter = TRUE; + sal_Bool bWeiter = sal_True; int nFlag = C_NONE; do { switch( *pStr ) @@ -922,7 +944,7 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, case 0xFF0E : { if( nFlag & C_FULL_STOP ) - return FALSE; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement nFlag |= C_FULL_STOP; pExceptStt = pStr; } @@ -931,7 +953,7 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, case 0xFF01 : { if( nFlag & C_EXCLAMATION_MARK ) - return FALSE; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement nFlag |= C_EXCLAMATION_MARK; } break; @@ -939,25 +961,21 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, case 0xFF1F : { if( nFlag & C_QUESTION_MARK) - return FALSE; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement nFlag |= C_QUESTION_MARK; } break; default: if( !nFlag ) - return FALSE; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement else - bWeiter = FALSE; + bWeiter = sal_False; break; } if( bWeiter && pStr-- == pStart ) { -// !!! wenn am Anfang, dann nie ersetzen. -// if( !nFlag ) - return FALSE; // kein gueltiger Trenner -> keine Ersetzung -// ++pStr; -// break; // Schleife beenden + return sal_False; // no valid separator -> no replacement } } while( bWeiter ); if( C_FULL_STOP != nFlag ) @@ -965,12 +983,12 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, } if( 2 > ( pStr - pStart ) ) - return FALSE; + return sal_False; if( !rCC.isLetterNumeric( aText, sal::static_int_cast< xub_StrLen >( pStr-- - pStart ) ) ) { - BOOL bValid = FALSE, bAlphaFnd = FALSE; + sal_Bool bValid = sal_False, bAlphaFnd = sal_False; const sal_Unicode* pTmpStr = pStr; while( !bValid ) { @@ -978,7 +996,7 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, aText, sal::static_int_cast< xub_StrLen >( pTmpStr - pStart ) ) ) { - bValid = TRUE; + bValid = sal_True; pStr = pTmpStr - 1; } else if( rCC.isLetter( @@ -988,11 +1006,11 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, { if( bAlphaFnd ) { - bValid = TRUE; + bValid = sal_True; pStr = pTmpStr; } else - bAlphaFnd = TRUE; + bAlphaFnd = sal_True; } else if( bAlphaFnd || IsWordDelim( *pTmpStr ) ) break; @@ -1004,18 +1022,18 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, } if( !bValid ) - return FALSE; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement } - BOOL bNumericOnly = '0' <= *(pStr+1) && *(pStr+1) <= '9'; + sal_Bool bNumericOnly = '0' <= *(pStr+1) && *(pStr+1) <= '9'; - // suche den Anfang vom Wort + // Search for the beginning of the word while( !IsWordDelim( *pStr )) { if( bNumericOnly && rCC.isLetter( aText, sal::static_int_cast< xub_StrLen >( pStr - pStart ) ) ) - bNumericOnly = FALSE; + bNumericOnly = sal_False; if( pStart == pStr ) break; @@ -1023,31 +1041,31 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, --pStr; } - if( bNumericOnly ) // besteht nur aus Zahlen, dann nicht - return FALSE; + if( bNumericOnly ) // consists of only numbers, then not + return sal_False; if( IsWordDelim( *pStr )) ++pStr; String sWord; - // ueberpruefe anhand der Exceptionliste + // check on the basis of the exception list if( pExceptStt ) { sWord = String( pStr, sal::static_int_cast< xub_StrLen >( pExceptStt - pStr + 1 ) ); if( FindInCplSttExceptList(eLang, sWord) ) - return FALSE; + return sal_False; - // loesche alle nicht alpanum. Zeichen am Wortanfang/-ende und - // teste dann noch mal ( erkennt: "(min.", "/min.", usw.) + // Delete all non alphanumeric. Test the characters at the + // beginning/end of the word ( recognizes: "(min.", "/min.", and so on.) String sTmp( sWord ); while( sTmp.Len() && !rCC.isLetterNumeric( sTmp, 0 ) ) sTmp.Erase( 0, 1 ); - // alle hinteren nicht alphanumerische Zeichen bis auf das - // Letzte entfernen + // Remove all non alphanumeric characters towards the end up until + // the last one. xub_StrLen nLen = sTmp.Len(); while( nLen && !rCC.isLetterNumeric( sTmp, nLen-1 ) ) --nLen; @@ -1056,20 +1074,20 @@ BOOL SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, if( sTmp.Len() && sTmp.Len() != sWord.Len() && FindInCplSttExceptList(eLang, sTmp)) - return FALSE; + return sal_False; - if(FindInCplSttExceptList(eLang, sWord, TRUE)) - return FALSE; + if(FindInCplSttExceptList(eLang, sWord, sal_True)) + return sal_False; } - // Ok, dann ersetze mal + // Ok, then replace sal_Unicode cSave = *pWordStt; nSttPos = sal::static_int_cast< xub_StrLen >( pWordStt - rTxt.GetBuffer() ); String sChar( cSave ); rCC.toUpper( sChar ); - BOOL bRet = sChar.GetChar(0) != cSave && rDoc.Replace( nSttPos, sChar ); + sal_Bool bRet = sChar.GetChar(0) != cSave && rDoc.ReplaceRange( nSttPos, 1, sChar ); - // das Wort will vielleicht jemand haben + // Parahaps someone wants to have the word if( bRet && SaveWordCplSttLst & nFlags ) rDoc.SaveCpltSttWord( CptlSttSntnc, nSttPos, sWord, cSave ); @@ -1119,7 +1137,7 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const String& rTxt } -sal_Unicode SvxAutoCorrect::GetQuote( sal_Unicode cInsChar, BOOL bSttQuote, +sal_Unicode SvxAutoCorrect::GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote, LanguageType eLang ) const { sal_Unicode cRet = bSttQuote ? ( '\"' == cInsChar @@ -1130,7 +1148,7 @@ sal_Unicode SvxAutoCorrect::GetQuote( sal_Unicode cInsChar, BOOL bSttQuote, : GetEndSingleQuote() ); if( !cRet ) { - // dann ueber die Language das richtige Zeichen heraussuchen + // then through the Language find the right character if( LANGUAGE_NONE == eLang ) cRet = cInsChar; else @@ -1150,23 +1168,18 @@ sal_Unicode SvxAutoCorrect::GetQuote( sal_Unicode cInsChar, BOOL bSttQuote, } void SvxAutoCorrect::InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, - sal_Unicode cInsChar, BOOL bSttQuote, - BOOL bIns ) + sal_Unicode cInsChar, sal_Bool bSttQuote, + sal_Bool bIns ) { - LanguageType eLang = rDoc.GetLanguage( nInsPos, FALSE ); + LanguageType eLang = rDoc.GetLanguage( nInsPos, sal_False ); sal_Unicode cRet = GetQuote( cInsChar, bSttQuote, eLang ); - //JP 13.02.99: damit beim Undo das "einfuegte" Zeichen wieder erscheint, - // wird es erstmal eingefuegt und dann ueberschrieben String sChg( cInsChar ); if( bIns ) rDoc.Insert( nInsPos, sChg ); else rDoc.Replace( nInsPos, sChg ); - //JP 13.08.97: Bug 42477 - bei doppelten Anfuehrungszeichen muss bei - // franzoesischer Sprache an Anfang ein Leerzeichen dahinter - // und am Ende ein Leerzeichen dahinter eingefuegt werden. sChg = cRet; if( '\"' == cInsChar ) @@ -1180,8 +1193,6 @@ void SvxAutoCorrect::InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, case LANGUAGE_FRENCH_CANADIAN: case LANGUAGE_FRENCH_SWISS: case LANGUAGE_FRENCH_LUXEMBOURG: - // JP 09.02.99: das zusaetzliche Zeichen immer per Insert einfuegen. - // Es ueberschreibt nichts! { String s( static_cast< sal_Unicode >(0xA0) ); // UNICODE code for no break space @@ -1199,15 +1210,13 @@ void SvxAutoCorrect::InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, } String SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, - sal_Unicode cInsChar, BOOL bSttQuote ) + sal_Unicode cInsChar, sal_Bool bSttQuote ) { - LanguageType eLang = rDoc.GetLanguage( nInsPos, FALSE ); + LanguageType eLang = rDoc.GetLanguage( nInsPos, sal_False ); sal_Unicode cRet = GetQuote( cInsChar, bSttQuote, eLang ); String sRet( cRet ); - //JP 13.08.97: Bug 42477 - bei doppelten Anfuehrungszeichen muss bei - // franzoesischer Sprache an Anfang ein Leerzeichen dahinter - // und am Ende ein Leerzeichen dahinter eingefuegt werden. + if( '\"' == cInsChar ) { if( LANGUAGE_SYSTEM == eLang ) @@ -1229,18 +1238,18 @@ String SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, return sRet; } -ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, +sal_uLong SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nInsPos, sal_Unicode cChar, - BOOL bInsert, Window* pFrameWin ) + sal_Bool bInsert, Window* pFrameWin ) { - ULONG nRet = 0; + sal_uLong nRet = 0; bool bIsNextRun = bRunNext; bRunNext = false; // if it was set, then it has to be turned off do{ // only for middle check loop !! if( cChar ) { - //JP 10.02.97: doppelte Spaces verhindern + // Prevent double space if( nInsPos && ' ' == cChar && IsAutoCorrFlag( IgnoreDoubleSpace ) && ' ' == rTxt.GetChar( nInsPos - 1 ) ) @@ -1249,17 +1258,15 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, break; } - BOOL bSingle = '\'' == cChar; - BOOL bIsReplaceQuote = + sal_Bool bSingle = '\'' == cChar; + sal_Bool bIsReplaceQuote = (IsAutoCorrFlag( ChgQuotes ) && ('\"' == cChar )) || (IsAutoCorrFlag( ChgSglQuotes ) && bSingle ); if( bIsReplaceQuote ) { sal_Unicode cPrev; - BOOL bSttQuote = !nInsPos || + sal_Bool bSttQuote = !nInsPos || IsWordDelim( ( cPrev = rTxt.GetChar( nInsPos-1 ))) || -// os: #56034# - Warum kein schliessendes Anfuehrungszeichen nach dem Bindestrich? -// strchr( "-([{", cPrev ) || lcl_IsInAsciiArr( "([{", cPrev ) || ( cEmDash && cEmDash == cPrev ) || ( cEnDash && cEnDash == cPrev ); @@ -1278,7 +1285,7 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, if ( IsAutoCorrFlag( AddNonBrkSpace ) ) { if ( NeedsHardspaceAutocorr( cChar ) && - FnAddNonBrkSpace( rDoc, rTxt, 0, nInsPos, rDoc.GetLanguage( nInsPos, FALSE ) ) ) + FnAddNonBrkSpace( rDoc, rTxt, 0, nInsPos, rDoc.GetLanguage( nInsPos, sal_False ) ) ) { nRet = AddNonBrkSpace; } @@ -1314,11 +1321,10 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nPos = nInsPos - 1; - // Bug 19286: nur direkt hinter dem "Wort" aufsetzen if( IsWordDelim( rTxt.GetChar( nPos ))) break; - // automatisches Fett oder Unterstreichen setzen? + // Set bold or underline automatically? if( '*' == cChar || '_' == cChar ) { if( IsAutoCorrFlag( ChgWeightUnderl ) && @@ -1330,18 +1336,18 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, while( nPos && !IsWordDelim( rTxt.GetChar( --nPos ))) ; - // Absatz-Anfang oder ein Blank gefunden, suche nach dem Wort - // Kuerzel im Auto - xub_StrLen nCapLttrPos = nPos+1; // auf das 1. Zeichen + // Found a Paragraph-start or a Blank, search for the word shortcut in + // auto. + xub_StrLen nCapLttrPos = nPos+1; // on the 1st Character if( !nPos && !IsWordDelim( rTxt.GetChar( 0 ))) --nCapLttrPos; // Absatz Anfang und kein Blank ! - LanguageType eLang = rDoc.GetLanguage( nCapLttrPos, FALSE ); + LanguageType eLang = rDoc.GetLanguage( nCapLttrPos, sal_False ); if( LANGUAGE_SYSTEM == eLang ) eLang = MsLangId::getSystemLanguage(); CharClass& rCC = GetCharClass( eLang ); - // Bug 19285: Symbolzeichen nicht anfassen + // no symbol characters if( lcl_IsSymbolChar( rCC, rTxt, nCapLttrPos, nInsPos )) break; @@ -1350,14 +1356,10 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, const String* pPara = 0; const String** ppPara = IsAutoCorrFlag(CptlSttSntnc) ? &pPara : 0; - BOOL bChgWord = rDoc.ChgAutoCorrWord( nCapLttrPos, nInsPos, + sal_Bool bChgWord = rDoc.ChgAutoCorrWord( nCapLttrPos, nInsPos, *this, ppPara ); if( !bChgWord ) { - // JP 16.06.98: dann versuche mal alle !AlphaNum. Zeichen los zu - // werden und teste dann nochmals - //JP 22.04.99: Bug 63883 - entferne nur die "Klammern Start/-Anfaenge", - // alle anderen Zeichen muessen drin bleiben. xub_StrLen nCapLttrPos1 = nCapLttrPos, nInsPos1 = nInsPos; while( nCapLttrPos1 < nInsPos && lcl_IsInAsciiArr( sImplSttSkipChars, rTxt.GetChar( nCapLttrPos1 ) ) @@ -1372,7 +1374,7 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, nCapLttrPos1 < nInsPos1 && rDoc.ChgAutoCorrWord( nCapLttrPos1, nInsPos1, *this, ppPara )) { - bChgWord = TRUE; + bChgWord = sal_True; nCapLttrPos = nCapLttrPos1; } } @@ -1387,9 +1389,9 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, !IsWordDelim( pPara->GetChar( nEnd ))) ++nEnd; - // Grossbuchstabe am Satz-Anfang ?? + // Capital letter at beginning of paragraph? if( IsAutoCorrFlag( CptlSttSntnc ) && - FnCptlSttSntnc( rDoc, *pPara, FALSE, + FnCptlSttSntnc( rDoc, *pPara, sal_False, nCapLttrPos, nEnd, eLang ) ) nRet |= CptlSttSntnc; @@ -1422,12 +1424,12 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, pFrameWin->SimulateKeyPress( KEY_CAPSLOCK ); } - // Grossbuchstabe am Satz-Anfang ?? + // Capital letter at beginning of paragraph ? if( IsAutoCorrFlag( CptlSttSntnc ) && - FnCptlSttSntnc( rDoc, rTxt, TRUE, nCapLttrPos, nInsPos, eLang ) ) + FnCptlSttSntnc( rDoc, rTxt, sal_True, nCapLttrPos, nInsPos, eLang ) ) nRet |= CptlSttSntnc; - // Zwei Grossbuchstaben am Wort-Anfang ?? + // Two capital letters at beginning of word ?? if( IsAutoCorrFlag( CptlSttWrd ) && FnCptlSttWrd( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) ) nRet |= CptlSttWrd; @@ -1437,14 +1439,40 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, nRet |= ChgToEnEmDash; } - } while( FALSE ); + } while( sal_False ); if( nRet ) { - ULONG nHelpId = 0; + const char* aHelpIds[] = + { + HID_AUTOCORR_HELP_WORD, + HID_AUTOCORR_HELP_SENT, + HID_AUTOCORR_HELP_SENTWORD, + HID_AUTOCORR_HELP_ACORWORD, + "", + HID_AUTOCORR_HELP_ACORSENTWORD, + "", + HID_AUTOCORR_HELP_CHGTOENEMDASH, + HID_AUTOCORR_HELP_WORDENEMDASH, + HID_AUTOCORR_HELP_SENTENEMDASH, + HID_AUTOCORR_HELP_SENTWORDENEMDASH, + HID_AUTOCORR_HELP_ACORWORDENEMDASH, + "", + HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH, + "", + HID_AUTOCORR_HELP_CHGQUOTES, + HID_AUTOCORR_HELP_CHGSGLQUOTES, + HID_AUTOCORR_HELP_SETINETATTR, + HID_AUTOCORR_HELP_INGNOREDOUBLESPACE, + HID_AUTOCORR_HELP_CHGWEIGHTUNDERL, + HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL, + HID_AUTOCORR_HELP_CHGORDINALNUMBER + }; + + sal_uLong nHelpId = 0; if( nRet & ( Autocorrect|CptlSttSntnc|CptlSttWrd|ChgToEnEmDash ) ) { - // von 0 - 15 + // from 0 - 15 if( nRet & ChgToEnEmDash ) nHelpId += 8; if( nRet & Autocorrect ) @@ -1467,8 +1495,8 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, if( nHelpId ) { - nHelpId += HID_AUTOCORR_HELP_START - 1; - Application::GetHelp()->OpenHelpAgent( nHelpId ); + nHelpId -= 1; + Application::GetHelp()->OpenHelpAgent( aHelpIds[nHelpId] ); } } @@ -1479,76 +1507,73 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, SvxAutoCorrectLanguageLists& SvxAutoCorrect::_GetLanguageList( LanguageType eLang ) { - if( !pLangTable->IsKeyValid( ULONG( eLang ))) - CreateLanguageFile( eLang, TRUE); - return *pLangTable->Seek( ULONG( eLang ) ); + if( !pLangTable->IsKeyValid( sal_uLong( eLang ))) + CreateLanguageFile( eLang, sal_True); + return *pLangTable->Seek( sal_uLong( eLang ) ); } void SvxAutoCorrect::SaveCplSttExceptList( LanguageType eLang ) { - if( pLangTable->IsKeyValid( ULONG( eLang ))) + if( pLangTable->IsKeyValid( sal_uLong( eLang ))) { - SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(ULONG(eLang)); + SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(sal_uLong(eLang)); if( pLists ) pLists->SaveCplSttExceptList(); } #ifdef DBG_UTIL else { - DBG_ERROR("speichern einer leeren Liste?"); + OSL_FAIL("Save an empty list? "); } #endif } void SvxAutoCorrect::SaveWrdSttExceptList(LanguageType eLang) { - if(pLangTable->IsKeyValid(ULONG(eLang))) + if(pLangTable->IsKeyValid(sal_uLong(eLang))) { - SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(ULONG(eLang)); + SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(sal_uLong(eLang)); if(pLists) pLists->SaveWrdSttExceptList(); } #ifdef DBG_UTIL else { - DBG_ERROR("speichern einer leeren Liste?"); + OSL_FAIL("Save an empty list? "); } #endif } - - // fuegt ein einzelnes Wort hinzu. Die Liste wird sofort - // in die Datei geschrieben! -BOOL SvxAutoCorrect::AddCplSttException( const String& rNew, + // Adds a single word. The list will immediately be written to the file! +sal_Bool SvxAutoCorrect::AddCplSttException( const String& rNew, LanguageType eLang ) { SvxAutoCorrectLanguageListsPtr pLists = 0; - //entweder die richtige Sprache ist vorhanden oder es kommt in die allg. Liste - if( pLangTable->IsKeyValid(ULONG(eLang))) - pLists = pLangTable->Seek(ULONG(eLang)); - else if(pLangTable->IsKeyValid(ULONG(LANGUAGE_DONTKNOW))|| - CreateLanguageFile(LANGUAGE_DONTKNOW, TRUE)) + // either the right language is present or it will be this in the general list + if( pLangTable->IsKeyValid(sal_uLong(eLang))) + pLists = pLangTable->Seek(sal_uLong(eLang)); + else if(pLangTable->IsKeyValid(sal_uLong(LANGUAGE_DONTKNOW))|| + CreateLanguageFile(LANGUAGE_DONTKNOW, sal_True)) { - pLists = pLangTable->Seek(ULONG(LANGUAGE_DONTKNOW)); + pLists = pLangTable->Seek(sal_uLong(LANGUAGE_DONTKNOW)); } - DBG_ASSERT(pLists, "keine Autokorrekturdatei"); + OSL_ENSURE(pLists, "No auto correction data"); return pLists->AddToCplSttExceptList(rNew); } - // fuegt ein einzelnes Wort hinzu. Die Liste wird sofort - // in die Datei geschrieben! -BOOL SvxAutoCorrect::AddWrtSttException( const String& rNew, + // Adds a single word. The list will immediately be written to the file! +sal_Bool SvxAutoCorrect::AddWrtSttException( const String& rNew, LanguageType eLang ) { SvxAutoCorrectLanguageListsPtr pLists = 0; - //entweder die richtige Sprache ist vorhanden oder es kommt in die allg. Liste - if(pLangTable->IsKeyValid(ULONG(eLang))) - pLists = pLangTable->Seek(ULONG(eLang)); - else if(pLangTable->IsKeyValid(ULONG(LANGUAGE_DONTKNOW))|| - CreateLanguageFile(LANGUAGE_DONTKNOW, TRUE)) - pLists = pLangTable->Seek(ULONG(LANGUAGE_DONTKNOW)); - DBG_ASSERT(pLists, "keine Autokorrekturdatei"); + //either the right language is present or it is set in the general list + if(pLangTable->IsKeyValid(sal_uLong(eLang))) + pLists = pLangTable->Seek(sal_uLong(eLang)); + else if(pLangTable->IsKeyValid(sal_uLong(LANGUAGE_DONTKNOW))|| + CreateLanguageFile(LANGUAGE_DONTKNOW, sal_True)) + pLists = pLangTable->Seek(sal_uLong(LANGUAGE_DONTKNOW)); + OSL_ENSURE(pLists, "keine Autokorrekturdatei"); return pLists->AddToWrdSttExceptList(rNew); } @@ -1561,8 +1586,7 @@ void SvxAutoCorrect::SetUserAutoCorrFileName( const String& rNew ) { sUserAutoCorrFile = rNew; - // sind die Listen gesetzt sind, so muessen sie jetzt geloescht - // werden + // if the lists are set, they must now be deleted lcl_ClearTable(*pLangTable); nFlags &= ~(CplSttLstLoad | WrdSttLstLoad | ChgWordLstLoad ); } @@ -1574,48 +1598,45 @@ void SvxAutoCorrect::SetShareAutoCorrFileName( const String& rNew ) { sShareAutoCorrFile = rNew; - // sind die Listen gesetzt sind, so muessen sie jetzt geloescht - // werden + // if the lists are set, they must now be deleted lcl_ClearTable(*pLangTable); nFlags &= ~(CplSttLstLoad | WrdSttLstLoad | ChgWordLstLoad ); } } -BOOL SvxAutoCorrect::GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, +sal_Bool SvxAutoCorrect::GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nPos, String& rWord ) const { if( !nPos ) - return FALSE; + return sal_False; xub_StrLen nEnde = nPos; - // dahinter muss ein Blank oder Tab folgen! + // it must be followed by a blank or tab! if( ( nPos < rTxt.Len() && !IsWordDelim( rTxt.GetChar( nPos ))) || IsWordDelim( rTxt.GetChar( --nPos ))) - return FALSE; + return sal_False; while( nPos && !IsWordDelim( rTxt.GetChar( --nPos ))) ; - // Absatz-Anfang oder ein Blank gefunden, suche nach dem Wort - // Kuerzel im Auto - xub_StrLen nCapLttrPos = nPos+1; // auf das 1. Zeichen + // Found a Paragraph-start or a Blank, search for the word shortcut in + // auto. + xub_StrLen nCapLttrPos = nPos+1; // on the 1st Character if( !nPos && !IsWordDelim( rTxt.GetChar( 0 ))) - --nCapLttrPos; // Absatz Anfang und kein Blank ! + --nCapLttrPos; // Beginning of pargraph and no Blank! while( lcl_IsInAsciiArr( sImplSttSkipChars, rTxt.GetChar( nCapLttrPos )) ) if( ++nCapLttrPos >= nEnde ) - return FALSE; + return sal_False; - // Bug 19285: Symbolzeichen nicht anfassen - // Interresant erst ab 3 Zeichen if( 3 > nEnde - nCapLttrPos ) - return FALSE; + return sal_False; - LanguageType eLang = rDoc.GetLanguage( nCapLttrPos, FALSE ); + LanguageType eLang = rDoc.GetLanguage( nCapLttrPos, sal_False ); if( LANGUAGE_SYSTEM == eLang ) eLang = MsLangId::getSystemLanguage(); @@ -1623,24 +1644,24 @@ BOOL SvxAutoCorrect::GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, CharClass& rCC = pThis->GetCharClass( eLang ); if( lcl_IsSymbolChar( rCC, rTxt, nCapLttrPos, nEnde )) - return FALSE; + return sal_False; rWord = rTxt.Copy( nCapLttrPos, nEnde - nCapLttrPos ); - return TRUE; + return sal_True; } -BOOL SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, BOOL bNewFile ) +sal_Bool SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, sal_Bool bNewFile ) { - DBG_ASSERT(!pLangTable->IsKeyValid(ULONG(eLang)), "Sprache ist bereits vorhanden"); + OSL_ENSURE(!pLangTable->IsKeyValid(sal_uLong(eLang)), "Language already exists "); - String sUserDirFile( GetAutoCorrFileName( eLang, TRUE, FALSE )), + String sUserDirFile( GetAutoCorrFileName( eLang, sal_True, sal_False )), sShareDirFile( sUserDirFile ); SvxAutoCorrectLanguageListsPtr pLists = 0; Time nMinTime( 0, 2 ), nAktTime, nLastCheckTime; - ULONG nFndPos; + sal_uLong nFndPos; if( TABLE_ENTRY_NOTFOUND != - pLastFileTable->SearchKey( ULONG( eLang ), &nFndPos ) && + pLastFileTable->SearchKey( sal_uLong( eLang ), &nFndPos ) && ( nLastCheckTime.SetTime( pLastFileTable->GetObject( nFndPos )), nLastCheckTime < nAktTime ) && ( nAktTime - nLastCheckTime ) < nMinTime ) @@ -1652,60 +1673,60 @@ BOOL SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, BOOL bNewFile ) sShareDirFile = sUserDirFile; pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sUserDirFile, eLang ); - pLangTable->Insert( ULONG(eLang), pLists ); - pLastFileTable->Remove( ULONG( eLang ) ); + pLangTable->Insert( sal_uLong(eLang), pLists ); + pLastFileTable->Remove( sal_uLong( eLang ) ); } } else if( ( FStatHelper::IsDocument( sUserDirFile ) || FStatHelper::IsDocument( sShareDirFile = - GetAutoCorrFileName( eLang, FALSE, FALSE ) ) ) || + GetAutoCorrFileName( eLang, sal_False, sal_False ) ) ) || ( sShareDirFile = sUserDirFile, bNewFile )) { pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sUserDirFile, eLang ); - pLangTable->Insert( ULONG(eLang), pLists ); - pLastFileTable->Remove( ULONG( eLang ) ); + pLangTable->Insert( sal_uLong(eLang), pLists ); + pLastFileTable->Remove( sal_uLong( eLang ) ); } else if( !bNewFile ) { - if( !pLastFileTable->Insert( ULONG( eLang ), nAktTime.GetTime() )) - pLastFileTable->Replace( ULONG( eLang ), nAktTime.GetTime() ); + if( !pLastFileTable->Insert( sal_uLong( eLang ), nAktTime.GetTime() )) + pLastFileTable->Replace( sal_uLong( eLang ), nAktTime.GetTime() ); } return pLists != 0; } -BOOL SvxAutoCorrect::PutText( const String& rShort, const String& rLong, +sal_Bool SvxAutoCorrect::PutText( const String& rShort, const String& rLong, LanguageType eLang ) { - BOOL bRet = FALSE; - if( pLangTable->IsKeyValid( ULONG(eLang)) || CreateLanguageFile(eLang) ) - bRet = pLangTable->Seek( ULONG(eLang) )->PutText(rShort, rLong); + sal_Bool bRet = sal_False; + if( pLangTable->IsKeyValid( sal_uLong(eLang)) || CreateLanguageFile(eLang) ) + bRet = pLangTable->Seek( sal_uLong(eLang) )->PutText(rShort, rLong); return bRet; } - // - loesche einen Eintrag -BOOL SvxAutoCorrect::DeleteText( const String& rShort, LanguageType eLang ) + // - Delete an entry +sal_Bool SvxAutoCorrect::DeleteText( const String& rShort, LanguageType eLang ) { - BOOL bRet = FALSE; - if( pLangTable->IsKeyValid( ULONG( eLang )) ) - bRet = pLangTable->Seek( ULONG( eLang ))->DeleteText( rShort ); + sal_Bool bRet = sal_False; + if( pLangTable->IsKeyValid( sal_uLong( eLang )) ) + bRet = pLangTable->Seek( sal_uLong( eLang ))->DeleteText( rShort ); return bRet; } - // - return den Ersetzungstext (nur fuer SWG-Format, alle anderen - // koennen aus der Wortliste herausgeholt werden!) -BOOL SvxAutoCorrect::GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String&, const String& , String& ) + // - return the replacement text (only for SWG-Format, all other + // can be taken from the word list!) +sal_Bool SvxAutoCorrect::GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String&, const String& , String& ) { - return FALSE; + return sal_False; } - // - Text mit Attributierung (kann nur der SWG - SWG-Format!) -BOOL SvxAutoCorrect::PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String&, const String&, SfxObjectShell&, + // Text with attribution (only the SWG - SWG format!) +sal_Bool SvxAutoCorrect::PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String&, const String&, SfxObjectShell&, String& ) { - return FALSE; + return sal_False; } void EncryptBlockName_Imp( String& rName ) @@ -1754,10 +1775,6 @@ void DecryptBlockName_Imp( String& rName ) } } - -/* -----------------18.11.98 16:00------------------- - * - * --------------------------------------------------*/ const SvxAutocorrWord* lcl_SearchWordsInList( SvxAutoCorrectLanguageListsPtr pList, const String& rTxt, xub_StrLen& rStt, xub_StrLen nEndPos, SvxAutoCorrDoc& ) @@ -1788,7 +1805,7 @@ const SvxAutocorrWord* lcl_SearchWordsInList( } -// suche das oder die Worte in der ErsetzungsTabelle +// the search or the words in the substitution table const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList( const String& rTxt, xub_StrLen& rStt, xub_StrLen nEndPos, SvxAutoCorrDoc& rDoc, LanguageType& rLang ) @@ -1798,14 +1815,13 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList( if( LANGUAGE_SYSTEM == eLang ) eLang = MsLangId::getSystemLanguage(); - // zuerst nach eLang suchen, dann nach der Obersprache - // US-Englisch -> Englisch und zuletzt in LANGUAGE_DONTKNOW - - if( pLangTable->IsKeyValid( ULONG( eLang ) ) || - CreateLanguageFile( eLang, FALSE )) + // First search for eLang, then US-English -> English + // and last in LANGUAGE_DONTKNOW + if( pLangTable->IsKeyValid( sal_uLong( eLang ) ) || + CreateLanguageFile( eLang, sal_False )) { - //die Sprache ist vorhanden - also her damit - SvxAutoCorrectLanguageListsPtr pList = pLangTable->Seek(ULONG(eLang)); + //the language is available - so bring it on + SvxAutoCorrectLanguageListsPtr pList = pLangTable->Seek(sal_uLong(eLang)); pRet = lcl_SearchWordsInList( pList, rTxt, rStt, nEndPos, rDoc ); if( pRet ) { @@ -1814,19 +1830,20 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList( } } - // wenn es hier noch nicht gefunden werden konnte, dann weitersuchen - ULONG nTmpKey1 = eLang & 0x7ff, // die Hauptsprache in vielen Faellen u.B. DE - nTmpKey2 = eLang & 0x3ff, // sonst z.B. EN + // If it still could not be found here, then keep on searching + + sal_uLong nTmpKey1 = eLang & 0x7ff, // the main language in many cases DE + nTmpKey2 = eLang & 0x3ff, // otherwise for example EN nTmp; - if( ((nTmp = nTmpKey1) != (ULONG)eLang && + if( ((nTmp = nTmpKey1) != (sal_uLong)eLang && ( pLangTable->IsKeyValid( nTmpKey1 ) || - CreateLanguageFile( LanguageType( nTmpKey1 ), FALSE ) )) || - (( nTmp = nTmpKey2) != (ULONG)eLang && + CreateLanguageFile( LanguageType( nTmpKey1 ), sal_False ) )) || + (( nTmp = nTmpKey2) != (sal_uLong)eLang && ( pLangTable->IsKeyValid( nTmpKey2 ) || - CreateLanguageFile( LanguageType( nTmpKey2 ), FALSE ) )) ) + CreateLanguageFile( LanguageType( nTmpKey2 ), sal_False ) )) ) { - //die Sprache ist vorhanden - also her damit + //the language is available - so bring it on SvxAutoCorrectLanguageListsPtr pList = pLangTable->Seek( nTmp ); pRet = lcl_SearchWordsInList( pList, rTxt, rStt, nEndPos, rDoc); if( pRet ) @@ -1835,11 +1852,11 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList( return pRet; } } - if( pLangTable->IsKeyValid( ULONG( LANGUAGE_DONTKNOW ) ) || - CreateLanguageFile( LANGUAGE_DONTKNOW, FALSE ) ) + if( pLangTable->IsKeyValid( sal_uLong( LANGUAGE_DONTKNOW ) ) || + CreateLanguageFile( LANGUAGE_DONTKNOW, sal_False ) ) { - //die Sprache ist vorhanden - also her damit - SvxAutoCorrectLanguageListsPtr pList = pLangTable->Seek(ULONG(LANGUAGE_DONTKNOW)); + //the language is available - so bring it on + SvxAutoCorrectLanguageListsPtr pList = pLangTable->Seek(sal_uLong(LANGUAGE_DONTKNOW)); pRet = lcl_SearchWordsInList( pList, rTxt, rStt, nEndPos, rDoc); if( pRet ) { @@ -1849,75 +1866,71 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList( } return 0; } -/* -----------------18.11.98 13:46------------------- - * - * --------------------------------------------------*/ -BOOL SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang, + +sal_Bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang, const String& sWord ) { - //zuerst nach eLang suchen, dann nach der Obersprace US-Englisch -> Englisch - //und zuletzt in LANGUAGE_DONTKNOW - ULONG nTmpKey1 = eLang & 0x7ff; // die Hauptsprache in vielen Faellen u.B. DE - ULONG nTmpKey2 = eLang & 0x3ff; // sonst z.B. EN + // First search for eLang, then US-English -> English + // and last in LANGUAGE_DONTKNOW + sal_uLong nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE + sal_uLong nTmpKey2 = eLang & 0x3ff; // otherwise for example EN String sTemp(sWord); - if( pLangTable->IsKeyValid( ULONG( eLang )) || - CreateLanguageFile( eLang, FALSE ) ) + if( pLangTable->IsKeyValid( sal_uLong( eLang )) || + CreateLanguageFile( eLang, sal_False ) ) { - //die Sprache ist vorhanden - also her damit - SvxAutoCorrectLanguageListsPtr pList = pLangTable->Seek(ULONG(eLang)); + //the language is available - so bring it on + SvxAutoCorrectLanguageListsPtr pList = pLangTable->Seek(sal_uLong(eLang)); String _sTemp(sWord); if(pList->GetWrdSttExceptList()->Seek_Entry(&_sTemp)) - return TRUE; + return sal_True; } - // wenn es hier noch nicht gefunden werden konnte, dann weitersuchen - ULONG nTmp; - if( ((nTmp = nTmpKey1) != (ULONG)eLang && + // If it still could not be found here, then keep on searching + sal_uLong nTmp; + if( ((nTmp = nTmpKey1) != (sal_uLong)eLang && ( pLangTable->IsKeyValid( nTmpKey1 ) || - CreateLanguageFile( LanguageType( nTmpKey1 ), FALSE ) )) || - (( nTmp = nTmpKey2) != (ULONG)eLang && + CreateLanguageFile( LanguageType( nTmpKey1 ), sal_False ) )) || + (( nTmp = nTmpKey2) != (sal_uLong)eLang && ( pLangTable->IsKeyValid( nTmpKey2 ) || - CreateLanguageFile( LanguageType( nTmpKey2 ), FALSE ) )) ) + CreateLanguageFile( LanguageType( nTmpKey2 ), sal_False ) )) ) { - //die Sprache ist vorhanden - also her damit + //the language is available - so bring it on SvxAutoCorrectLanguageListsPtr pList = pLangTable->Seek(nTmp); if(pList->GetWrdSttExceptList()->Seek_Entry(&sTemp)) - return TRUE; + return sal_True; } - if(pLangTable->IsKeyValid(ULONG(LANGUAGE_DONTKNOW))|| CreateLanguageFile(LANGUAGE_DONTKNOW, FALSE)) + if(pLangTable->IsKeyValid(sal_uLong(LANGUAGE_DONTKNOW))|| CreateLanguageFile(LANGUAGE_DONTKNOW, sal_False)) { - //die Sprache ist vorhanden - also her damit - SvxAutoCorrectLanguageListsPtr pList = pLangTable->Seek(ULONG(LANGUAGE_DONTKNOW)); + //the language is available - so bring it on + SvxAutoCorrectLanguageListsPtr pList = pLangTable->Seek(sal_uLong(LANGUAGE_DONTKNOW)); if(pList->GetWrdSttExceptList()->Seek_Entry(&sTemp)) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -/* -----------------18.11.98 14:28------------------- - * - * --------------------------------------------------*/ -BOOL lcl_FindAbbreviation( const SvStringsISortDtor* pList, const String& sWord) + +sal_Bool lcl_FindAbbreviation( const SvStringsISortDtor* pList, const String& sWord) { String sAbk( '~' ); - USHORT nPos; + sal_uInt16 nPos; pList->Seek_Entry( &sAbk, &nPos ); if( nPos < pList->Count() ) { String sLowerWord( sWord ); sLowerWord.ToLowerAscii(); const String* pAbk; - for( USHORT n = nPos; + for( sal_uInt16 n = nPos; n < pList->Count() && '~' == ( pAbk = (*pList)[ n ])->GetChar( 0 ); ++n ) { - // ~ und ~. sind nicht erlaubt! + // ~ and ~. are not allowed! if( 2 < pAbk->Len() && pAbk->Len() - 1 <= sWord.Len() ) { String sLowerAbk( *pAbk ); sLowerAbk.ToLowerAscii(); for( xub_StrLen i = sLowerAbk.Len(), ii = sLowerWord.Len(); i; ) { - if( !--i ) // stimmt ueberein - return TRUE; + if( !--i ) // agrees + return sal_True; if( sLowerAbk.GetChar( i ) != sLowerWord.GetChar( --ii )) break; @@ -1925,66 +1938,61 @@ BOOL lcl_FindAbbreviation( const SvStringsISortDtor* pList, const String& sWord) } } } - DBG_ASSERT( !(nPos && '~' == (*pList)[ --nPos ]->GetChar( 0 ) ), - "falsch sortierte ExeptionListe?" ); - return FALSE; + OSL_ENSURE( !(nPos && '~' == (*pList)[ --nPos ]->GetChar( 0 ) ), + "Wrongly sorted exception list?" ); + return sal_False; } -/* -----------------18.11.98 14:49------------------- - * - * --------------------------------------------------*/ -BOOL SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang, - const String& sWord, BOOL bAbbreviation) -{ - //zuerst nach eLang suchen, dann nach der Obersprace US-Englisch -> Englisch - //und zuletzt in LANGUAGE_DONTKNOW - ULONG nTmpKey1 = eLang & 0x7ff; // die Hauptsprache in vielen Faellen u.B. DE - ULONG nTmpKey2 = eLang & 0x3ff; // sonst z.B. EN + +sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang, + const String& sWord, sal_Bool bAbbreviation) +{ + // First search for eLang, then US-English -> English + // and last in LANGUAGE_DONTKNOW + sal_uLong nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE + sal_uLong nTmpKey2 = eLang & 0x3ff; // otherwise for example EN String sTemp( sWord ); - if( pLangTable->IsKeyValid( ULONG( eLang )) || - CreateLanguageFile( eLang, FALSE )) + if( pLangTable->IsKeyValid( sal_uLong( eLang )) || + CreateLanguageFile( eLang, sal_False )) { - //die Sprache ist vorhanden - also her damit - SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(ULONG(eLang)); + //the language is available - so bring it on + SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(sal_uLong(eLang)); const SvStringsISortDtor* pList = pLists->GetCplSttExceptList(); if(bAbbreviation ? lcl_FindAbbreviation( pList, sWord) : pList->Seek_Entry( &sTemp ) ) - return TRUE; + return sal_True; } - // wenn es hier noch nicht gefunden werden konnte, dann weitersuchen - ULONG nTmp; + // If it still could not be found here, then keep on searching + sal_uLong nTmp; - if( ((nTmp = nTmpKey1) != (ULONG)eLang && + if( ((nTmp = nTmpKey1) != (sal_uLong)eLang && ( pLangTable->IsKeyValid( nTmpKey1 ) || - CreateLanguageFile( LanguageType( nTmpKey1 ), FALSE ) )) || - (( nTmp = nTmpKey2) != (ULONG)eLang && + CreateLanguageFile( LanguageType( nTmpKey1 ), sal_False ) )) || + (( nTmp = nTmpKey2) != (sal_uLong)eLang && ( pLangTable->IsKeyValid( nTmpKey2 ) || - CreateLanguageFile( LanguageType( nTmpKey2 ), FALSE ) )) ) + CreateLanguageFile( LanguageType( nTmpKey2 ), sal_False ) )) ) { - //die Sprache ist vorhanden - also her damit + //the language is available - so bring it on SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(nTmp); const SvStringsISortDtor* pList = pLists->GetCplSttExceptList(); if(bAbbreviation ? lcl_FindAbbreviation( pList, sWord) : pList->Seek_Entry( &sTemp ) ) - return TRUE; + return sal_True; } - if(pLangTable->IsKeyValid(ULONG(LANGUAGE_DONTKNOW))|| CreateLanguageFile(LANGUAGE_DONTKNOW, FALSE)) + if(pLangTable->IsKeyValid(sal_uLong(LANGUAGE_DONTKNOW))|| CreateLanguageFile(LANGUAGE_DONTKNOW, sal_False)) { - //die Sprache ist vorhanden - also her damit + //the language is available - so bring it on SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(LANGUAGE_DONTKNOW); const SvStringsISortDtor* pList = pLists->GetCplSttExceptList(); if(bAbbreviation ? lcl_FindAbbreviation( pList, sWord) : pList->Seek_Entry( &sTemp ) ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -/* -----------------20.11.98 11:53------------------- - * - * --------------------------------------------------*/ String SvxAutoCorrect::GetAutoCorrFileName( LanguageType eLang, - BOOL bNewFile, BOOL bTst ) const + sal_Bool bNewFile, sal_Bool bTst ) const { String sRet, sExt( MsLangId::convertLanguageToIsoString( eLang ) ); sExt.Insert('_', 0); @@ -2003,9 +2011,6 @@ String SvxAutoCorrect::GetAutoCorrFileName( LanguageType eLang, return sRet; } -/* -----------------18.11.98 11:16------------------- - * - * --------------------------------------------------*/ SvxAutoCorrectLanguageLists::SvxAutoCorrectLanguageLists( SvxAutoCorrect& rParent, const String& rShareAutoCorrectFile, @@ -2022,9 +2027,6 @@ SvxAutoCorrectLanguageLists::SvxAutoCorrectLanguageLists( { } -/* -----------------18.11.98 11:16------------------- - * - * --------------------------------------------------*/ SvxAutoCorrectLanguageLists::~SvxAutoCorrectLanguageLists() { delete pCplStt_ExcptLst; @@ -2032,27 +2034,23 @@ SvxAutoCorrectLanguageLists::~SvxAutoCorrectLanguageLists() delete pAutocorr_List; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ -BOOL SvxAutoCorrectLanguageLists::IsFileChanged_Imp() +sal_Bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp() { - // nur alle 2 Minuten aufs FileSystem zugreifen um den - // Dateistempel zu ueberpruefen - BOOL bRet = FALSE; + // Access the file system only every 2 minutes to check the date stamp + sal_Bool bRet = sal_False; Time nMinTime( 0, 2 ); Time nAktTime; - if( aLastCheckTime > nAktTime || // ueberlauf ? - ( nAktTime -= aLastCheckTime ) > nMinTime ) // min Zeit vergangen + if( aLastCheckTime > nAktTime || // overflow? + ( nAktTime -= aLastCheckTime ) > nMinTime ) // min time past { Date aTstDate; Time aTstTime; if( FStatHelper::GetModifiedDateTimeOfFile( sShareAutoCorrFile, &aTstDate, &aTstTime ) && ( aModifiedDate != aTstDate || aModifiedTime != aTstTime )) { - bRet = TRUE; - // dann mal schnell alle Listen entfernen! + bRet = sal_True; + // then remove all the lists fast! if( CplSttLstLoad & nFlags && pCplStt_ExcptLst ) delete pCplStt_ExcptLst, pCplStt_ExcptLst = 0; if( WrdSttLstLoad & nFlags && pWrdStt_ExcptLst ) @@ -2094,7 +2092,7 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp( { uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - DBG_ASSERT( xServiceFactory.is(), + OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); if( !xServiceFactory.is() ) { @@ -2110,8 +2108,8 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp( // get parser uno::Reference< XInterface > xXMLParser = xServiceFactory->createInstance( - OUString::createFromAscii("com.sun.star.xml.sax.Parser") ); - DBG_ASSERT( xXMLParser.is(), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) ); + OSL_ENSURE( xXMLParser.is(), "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" ); if( !xXMLParser.is() ) { @@ -2119,8 +2117,6 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp( } // get filter - // #110680# - // uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLExceptionListImport ( *rpLst ); uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLExceptionListImport ( xServiceFactory, *rpLst ); // connect parser and filter @@ -2147,21 +2143,19 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp( } } - // Zeitstempel noch setzen + // Set time stamp FStatHelper::GetModifiedDateTimeOfFile( sShareAutoCorrFile, &aModifiedDate, &aModifiedTime ); aLastCheckTime = Time(); } } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ + void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( const SvStringsISortDtor& rLst, const sal_Char* pStrmName, SotStorageRef &rStg, - BOOL bConvert ) + sal_Bool bConvert ) { if( rStg.Is() ) { @@ -2188,7 +2182,7 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - DBG_ASSERT( xServiceFactory.is(), + OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); if( !xServiceFactory.is() ) { @@ -2197,15 +2191,13 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( uno::Reference < XInterface > xWriter (xServiceFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer")))); - DBG_ASSERT(xWriter.is(),"com.sun.star.xml.sax.Writer service missing"); + OSL_ENSURE(xWriter.is(),"com.sun.star.xml.sax.Writer service missing"); uno::Reference < io::XOutputStream> xOut = new utl::OOutputStreamWrapper( *xStrm ); uno::Reference<io::XActiveDataSource> xSrc(xWriter, uno::UNO_QUERY); xSrc->setOutputStream(xOut); uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY); - // #110680# - // SvXMLExceptionListExport aExp(rLst, sStrmName, xHandler); SvXMLExceptionListExport aExp( xServiceFactory, rLst, sStrmName, xHandler ); aExp.exportDoc( XML_BLOCK_LIST ); @@ -2228,9 +2220,7 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( } } } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ + SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() { if( pAutocorr_List ) @@ -2251,8 +2241,8 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() aParserInput.aInputStream = xStrm->getInputStream(); // get parser - uno::Reference< XInterface > xXMLParser = xServiceFactory->createInstance( OUString::createFromAscii("com.sun.star.xml.sax.Parser") ); - DBG_ASSERT( xXMLParser.is(), "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" ); + uno::Reference< XInterface > xXMLParser = xServiceFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) ); + OSL_ENSURE( xXMLParser.is(), "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" ); if( xXMLParser.is() ) { uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLAutoCorrectImport( xServiceFactory, pAutocorr_List, rAutoCorrect, xStg ); @@ -2269,7 +2259,7 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() { } - // Zeitstempel noch setzen + // Set time stamp FStatHelper::GetModifiedDateTimeOfFile( sShareAutoCorrFile, &aModifiedDate, &aModifiedTime ); aLastCheckTime = Time(); @@ -2277,10 +2267,6 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() return pAutocorr_List; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ - void SvxAutoCorrectLanguageLists::SetAutocorrWordList( SvxAutocorrWordList* pList ) { if( pAutocorr_List && pList != pAutocorr_List ) @@ -2288,45 +2274,38 @@ void SvxAutoCorrectLanguageLists::SetAutocorrWordList( SvxAutocorrWordList* pLis pAutocorr_List = pList; if( !pAutocorr_List ) { - DBG_ASSERT( !this, "keine gueltige Liste" ); + OSL_ENSURE( !this, "No valid list" ); pAutocorr_List = new SvxAutocorrWordList( 16, 16 ); } nFlags |= ChgWordLstLoad; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ const SvxAutocorrWordList* SvxAutoCorrectLanguageLists::GetAutocorrWordList() { if( !( ChgWordLstLoad & nFlags ) || IsFileChanged_Imp() ) SetAutocorrWordList( LoadAutocorrWordList() ); return pAutocorr_List; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ + SvStringsISortDtor* SvxAutoCorrectLanguageLists::GetCplSttExceptList() { if( !( CplSttLstLoad & nFlags ) || IsFileChanged_Imp() ) SetCplSttExceptList( LoadCplSttExceptList() ); return pCplStt_ExcptLst; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ -BOOL SvxAutoCorrectLanguageLists::AddToCplSttExceptList(const String& rNew) + +sal_Bool SvxAutoCorrectLanguageLists::AddToCplSttExceptList(const String& rNew) { String* pNew = new String( rNew ); if( rNew.Len() && GetCplSttExceptList()->Insert( pNew ) ) { MakeUserStorage_Impl(); - SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, TRUE ); + SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True ); SaveExceptList_Imp( *pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg ); xStg = 0; - // Zeitstempel noch setzen + // Set time stamp FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile, &aModifiedDate, &aModifiedTime ); aLastCheckTime = Time(); @@ -2335,22 +2314,20 @@ BOOL SvxAutoCorrectLanguageLists::AddToCplSttExceptList(const String& rNew) delete pNew, pNew = 0; return 0 != pNew; } -/* -----------------18.11.98 15:20------------------- - * - * --------------------------------------------------*/ -BOOL SvxAutoCorrectLanguageLists::AddToWrdSttExceptList(const String& rNew) + +sal_Bool SvxAutoCorrectLanguageLists::AddToWrdSttExceptList(const String& rNew) { String* pNew = new String( rNew ); SvStringsISortDtor* pExceptList = LoadWrdSttExceptList(); if( rNew.Len() && pExceptList && pExceptList->Insert( pNew ) ) { MakeUserStorage_Impl(); - SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, TRUE ); + SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True ); SaveExceptList_Imp( *pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg ); xStg = 0; - // Zeitstempel noch setzen + // Set time stamp FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile, &aModifiedDate, &aModifiedTime ); aLastCheckTime = Time(); @@ -2360,12 +2337,9 @@ BOOL SvxAutoCorrectLanguageLists::AddToWrdSttExceptList(const String& rNew) return 0 != pNew; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadCplSttExceptList() { - SotStorageRef xStg = new SotStorage( sShareAutoCorrFile, STREAM_READ | STREAM_SHARE_DENYNONE, TRUE ); + SotStorageRef xStg = new SotStorage( sShareAutoCorrFile, STREAM_READ | STREAM_SHARE_DENYNONE, sal_True ); String sTemp ( RTL_CONSTASCII_USTRINGPARAM ( pXMLImplCplStt_ExcptLstStr ) ); if( xStg.Is() && xStg->IsContained( sTemp ) ) LoadXMLExceptList_Imp( pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg ); @@ -2373,27 +2347,21 @@ SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadCplSttExceptList() return pCplStt_ExcptLst; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ void SvxAutoCorrectLanguageLists::SaveCplSttExceptList() { MakeUserStorage_Impl(); - SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, TRUE ); + SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True ); SaveExceptList_Imp( *pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg ); xStg = 0; - // Zeitstempel noch setzen + // Set time stamp FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile, &aModifiedDate, &aModifiedTime ); aLastCheckTime = Time(); } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ void SvxAutoCorrectLanguageLists::SetCplSttExceptList( SvStringsISortDtor* pList ) { if( pCplStt_ExcptLst && pList != pCplStt_ExcptLst ) @@ -2402,41 +2370,35 @@ void SvxAutoCorrectLanguageLists::SetCplSttExceptList( SvStringsISortDtor* pList pCplStt_ExcptLst = pList; if( !pCplStt_ExcptLst ) { - DBG_ASSERT( !this, "keine gueltige Liste" ); + OSL_ENSURE( !this, "No valid list" ); pCplStt_ExcptLst = new SvStringsISortDtor( 16, 16 ); } nFlags |= CplSttLstLoad; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ + SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadWrdSttExceptList() { - SotStorageRef xStg = new SotStorage( sShareAutoCorrFile, STREAM_READ | STREAM_SHARE_DENYNONE, TRUE ); + SotStorageRef xStg = new SotStorage( sShareAutoCorrFile, STREAM_READ | STREAM_SHARE_DENYNONE, sal_True ); String sTemp ( RTL_CONSTASCII_USTRINGPARAM ( pXMLImplWrdStt_ExcptLstStr ) ); if( xStg.Is() && xStg->IsContained( sTemp ) ) LoadXMLExceptList_Imp( pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg ); return pWrdStt_ExcptLst; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ + void SvxAutoCorrectLanguageLists::SaveWrdSttExceptList() { MakeUserStorage_Impl(); - SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, TRUE ); + SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True ); SaveExceptList_Imp( *pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg ); xStg = 0; - // Zeitstempel noch setzen + // Set time stamp FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile, &aModifiedDate, &aModifiedTime ); aLastCheckTime = Time(); } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ + void SvxAutoCorrectLanguageLists::SetWrdSttExceptList( SvStringsISortDtor* pList ) { if( pWrdStt_ExcptLst && pList != pWrdStt_ExcptLst ) @@ -2444,28 +2406,24 @@ void SvxAutoCorrectLanguageLists::SetWrdSttExceptList( SvStringsISortDtor* pList pWrdStt_ExcptLst = pList; if( !pWrdStt_ExcptLst ) { - DBG_ASSERT( !this, "keine gueltige Liste" ); + OSL_ENSURE( !this, "No valid list" ); pWrdStt_ExcptLst = new SvStringsISortDtor( 16, 16 ); } nFlags |= WrdSttLstLoad; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ + SvStringsISortDtor* SvxAutoCorrectLanguageLists::GetWrdSttExceptList() { if( !( WrdSttLstLoad & nFlags ) || IsFileChanged_Imp() ) SetWrdSttExceptList( LoadWrdSttExceptList() ); return pWrdStt_ExcptLst; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ + void SvxAutoCorrectLanguageLists::RemoveStream_Imp( const String& rName ) { if( sShareAutoCorrFile != sUserAutoCorrFile ) { - SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, TRUE ); + SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True ); if( xStg.Is() && SVSTREAM_OK == xStg->GetError() && xStg->IsStream( rName ) ) { @@ -2487,13 +2445,9 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() INetURLObject aDest; INetURLObject aSource; -// String sDestPath = sUserAutoCorrFile.Copy ( 0, sUserAutoCorrFile.Len()-3); -// sDestPath.AppendAscii ("bak"); - - if (sUserAutoCorrFile != sShareAutoCorrFile ) { - aSource = INetURLObject ( sShareAutoCorrFile ); //aSource.setFSysPath ( sShareAutoCorrFile, INetURLObject::FSYS_DETECT ); + aSource = INetURLObject ( sShareAutoCorrFile ); aDest = INetURLObject ( sUserAutoCorrFile ); if ( SotStorage::IsOLEStorage ( sShareAutoCorrFile ) ) { @@ -2523,7 +2477,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() aInfo.NameClash = NameClash::OVERWRITE; aInfo.NewTitle = aDest.GetName(); aInfo.SourceURL = aSource.GetMainURL( INetURLObject::DECODE_TO_IURI ); - aInfo.MoveData = FALSE; + aInfo.MoveData = sal_False; aAny <<= aInfo; aNewContent.executeCommand( OUString ( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), aAny); } @@ -2534,8 +2488,8 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() } if (bConvert && !bError) { - SotStorageRef xSrcStg = new SotStorage( aDest.GetMainURL( INetURLObject::DECODE_TO_IURI ), STREAM_READ, TRUE ); - SotStorageRef xDstStg = new SotStorage( sUserAutoCorrFile, STREAM_WRITE, TRUE ); + SotStorageRef xSrcStg = new SotStorage( aDest.GetMainURL( INetURLObject::DECODE_TO_IURI ), STREAM_READ, sal_True ); + SotStorageRef xDstStg = new SotStorage( sUserAutoCorrFile, STREAM_WRITE, sal_True ); if( xSrcStg.Is() && xDstStg.Is() ) { @@ -2550,7 +2504,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() if (pTmpWordList) { - SaveExceptList_Imp( *pTmpWordList, pXMLImplWrdStt_ExcptLstStr, xDstStg, TRUE ); + SaveExceptList_Imp( *pTmpWordList, pXMLImplWrdStt_ExcptLstStr, xDstStg, sal_True ); pTmpWordList->DeleteAndDestroy( 0, pTmpWordList->Count() ); pTmpWordList = NULL; } @@ -2561,14 +2515,12 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() if (pTmpWordList) { - SaveExceptList_Imp( *pTmpWordList, pXMLImplCplStt_ExcptLstStr, xDstStg, TRUE ); + SaveExceptList_Imp( *pTmpWordList, pXMLImplCplStt_ExcptLstStr, xDstStg, sal_True ); pTmpWordList->DeleteAndDestroy( 0, pTmpWordList->Count() ); } GetAutocorrWordList(); MakeBlocklist_Imp( *xDstStg ); - // xDstStg is committed in MakeBlocklist_Imp - /*xSrcStg->CopyTo( &xDstStg );*/ sShareAutoCorrFile = sUserAutoCorrFile; xDstStg = 0; try @@ -2585,22 +2537,12 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() sShareAutoCorrFile = sUserAutoCorrFile; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ -BOOL SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) +sal_Bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) { String sStrmName( pXMLImplAutocorr_ListStr, RTL_TEXTENCODING_MS_1252 ); - BOOL bRet = TRUE, bRemove = !pAutocorr_List || !pAutocorr_List->Count(); + sal_Bool bRet = sal_True, bRemove = !pAutocorr_List || !pAutocorr_List->Count(); if( !bRemove ) { - /* - if ( rStg.IsContained( sStrmName) ) - { - rStg.Remove ( sStrmName ); - rStg.Commit(); - } - */ SvStorageStreamRef refList = rStg.OpenSotStream( sStrmName, ( STREAM_READ | STREAM_WRITE | STREAM_SHARE_DENYWRITE ) ); if( refList.Is() ) @@ -2615,7 +2557,7 @@ BOOL SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - DBG_ASSERT( xServiceFactory.is(), + OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); if( !xServiceFactory.is() ) { @@ -2624,15 +2566,13 @@ BOOL SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) uno::Reference < XInterface > xWriter (xServiceFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer")))); - DBG_ASSERT(xWriter.is(),"com.sun.star.xml.sax.Writer service missing"); + OSL_ENSURE(xWriter.is(),"com.sun.star.xml.sax.Writer service missing"); uno::Reference < io::XOutputStream> xOut = new utl::OOutputStreamWrapper( *refList ); uno::Reference<io::XActiveDataSource> xSrc(xWriter, uno::UNO_QUERY); xSrc->setOutputStream(xOut); uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY); - // #110680# - // SvXMLAutoCorrectExport aExp(pAutocorr_List, sStrmName, xHandler); SvXMLAutoCorrectExport aExp( xServiceFactory, pAutocorr_List, sStrmName, xHandler ); aExp.exportDoc( XML_BLOCK_LIST ); @@ -2645,47 +2585,13 @@ BOOL SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) rStg.Commit(); if( SVSTREAM_OK != rStg.GetError() ) { - bRemove = TRUE; - bRet = FALSE; - } - } - - /* - refList->SetSize( 0 ); - refList->SetBufferSize( 8192 ); - rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding(); - - String aDummy; // Erkennungszeichen fuer neue Streams - refList->WriteByteString( aDummy, RTL_TEXTENCODING_MS_1252 ) - << (BYTE) 4 // Laenge des Headers (ohne den Leerstring) - << (USHORT)WORDLIST_VERSION_358 // Version des Streams - << (BYTE)eEncoding; // der Zeichensatz - - for( USHORT i = 0; i < pAutocorr_List->Count() && - SVSTREAM_OK == refList->GetError(); ++i ) - { - SvxAutocorrWord* p = pAutocorr_List->GetObject( i ); - refList->WriteByteString( p->GetShort(), eEncoding ). - WriteByteString( p->IsTextOnly() - ? p->GetLong() - : p->GetShort(), eEncoding ); - } - refList->Commit(); - bRet = SVSTREAM_OK == refList->GetError(); - if( bRet ) - { - refList.Clear(); - rStg.Commit(); - if( SVSTREAM_OK != rStg.GetError() ) - { - bRemove = TRUE; - bRet = FALSE; + bRemove = sal_True; + bRet = sal_False; } } - */ } else - bRet = FALSE; + bRet = sal_False; } if( bRemove ) @@ -2697,35 +2603,27 @@ BOOL SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) return bRet; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ -BOOL SvxAutoCorrectLanguageLists::PutText( const String& rShort, +sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort, const String& rLong ) { - // erstmal akt. Liste besorgen! + // First get the current list! GetAutocorrWordList(); MakeUserStorage_Impl(); - SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, TRUE ); + SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True ); - BOOL bRet = xStg.Is() && SVSTREAM_OK == xStg->GetError(); + sal_Bool bRet = xStg.Is() && SVSTREAM_OK == xStg->GetError(); -/* if( bRet ) - { - // PutText( *xStg, rShort ); - } -*/ - // die Wortliste aktualisieren + // Update the word list if( bRet ) { - USHORT nPos; - SvxAutocorrWord* pNew = new SvxAutocorrWord( rShort, rLong, TRUE ); + sal_uInt16 nPos; + SvxAutocorrWord* pNew = new SvxAutocorrWord( rShort, rLong, sal_True ); if( pAutocorr_List->Seek_Entry( pNew, &nPos ) ) { if( !(*pAutocorr_List)[ nPos ]->IsTextOnly() ) { - // dann ist der Storage noch zu entfernen + // Still have to remove the Storage String sStgNm( rShort ); if (xStg->IsOLEStorage()) EncryptBlockName_Imp( sStgNm ); @@ -2746,41 +2644,35 @@ BOOL SvxAutoCorrectLanguageLists::PutText( const String& rShort, else { delete pNew; - bRet = FALSE; + bRet = sal_False; } } return bRet; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ - // - Text mit Attributierung (kann nur der SWG - SWG-Format!) -BOOL SvxAutoCorrectLanguageLists::PutText( const String& rShort, + +sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort, SfxObjectShell& rShell ) { - // erstmal akt. Liste besorgen! + // First get the current list! GetAutocorrWordList(); MakeUserStorage_Impl(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; String sLong; try { uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sUserAutoCorrFile, embed::ElementModes::READWRITE ); -// String aName( rShort ); -// EncryptBlockName_Imp( aName ); -// bRet = PutText( *xStg, aName, rShell, sLong ); bRet = rAutoCorrect.PutText( xStg, sUserAutoCorrFile, rShort, rShell, sLong ); xStg = 0; - // die Wortliste aktualisieren + // Update the word list if( bRet ) { - SvxAutocorrWord* pNew = new SvxAutocorrWord( rShort, sLong, FALSE ); + SvxAutocorrWord* pNew = new SvxAutocorrWord( rShort, sLong, sal_False ); if( pAutocorr_List->Insert( pNew ) ) { - SotStorageRef xStor = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, TRUE ); + SotStorageRef xStor = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True ); MakeBlocklist_Imp( *xStor ); } else @@ -2794,22 +2686,19 @@ BOOL SvxAutoCorrectLanguageLists::PutText( const String& rShort, return bRet; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ - // - loesche einen Eintrag -BOOL SvxAutoCorrectLanguageLists::DeleteText( const String& rShort ) +// Delete an entry +sal_Bool SvxAutoCorrectLanguageLists::DeleteText( const String& rShort ) { - // erstmal akt. Liste besorgen! + // First get the current list! GetAutocorrWordList(); MakeUserStorage_Impl(); - SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, TRUE ); - BOOL bRet = xStg.Is() && SVSTREAM_OK == xStg->GetError(); + SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True ); + sal_Bool bRet = xStg.Is() && SVSTREAM_OK == xStg->GetError(); if( bRet ) { - USHORT nPos; + sal_uInt16 nPos; SvxAutocorrWord aTmp( rShort, rShort ); if( pAutocorr_List->Seek_Entry( &aTmp, &nPos ) ) { @@ -2828,13 +2717,13 @@ BOOL SvxAutoCorrectLanguageLists::DeleteText( const String& rShort ) } } - // die Wortliste aktualisieren + // Update the word list pAutocorr_List->DeleteAndDestroy( nPos ); MakeBlocklist_Imp( *xStg ); xStg = 0; } else - bRet = FALSE; + bRet = sal_False; } return bRet; } diff --git a/editeng/source/misc/swafopt.cxx b/editeng/source/misc/swafopt.cxx index 6c1a60a245..0aca4533ab 100644 --- a/editeng/source/misc/swafopt.cxx +++ b/editeng/source/misc/swafopt.cxx @@ -33,10 +33,6 @@ #include <editeng/swafopt.hxx> -/*------------------------------------------------------------------------ - Beschreibung: -------------------------------------------------------------------------*/ - SvxSwAutoFmtFlags::SvxSwAutoFmtFlags() : aBulletFont( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarSymbol" )), @@ -57,14 +53,14 @@ SvxSwAutoFmtFlags::SvxSwAutoFmtFlags() bAFmtDelSpacesBetweenLines = bAFmtByInpDelSpacesAtSttEnd = bAFmtByInpDelSpacesBetweenLines = - bDummy = TRUE; + bDummy = sal_True; bReplaceStyles = bDelEmptyNode = bWithRedlining = bAutoCmpltEndless = bAutoCmpltAppendBlanc = - bAutoCmpltShowAsTip = FALSE; + bAutoCmpltShowAsTip = sal_False; bSetBorder = bCreateTable = @@ -73,10 +69,10 @@ SvxSwAutoFmtFlags::SvxSwAutoFmtFlags() bRightMargin = bAutoCompleteWords = bAutoCmpltCollectWords = - bAutoCmpltKeepList = TRUE; + bAutoCmpltKeepList = sal_True; bDummy6 = bDummy7 = bDummy8 = - FALSE; + sal_False; nRightMargin = 50; // dflt. 50 % nAutoCmpltExpandKey = KEY_RETURN; @@ -85,7 +81,7 @@ SvxSwAutoFmtFlags::SvxSwAutoFmtFlags() aBulletFont.SetFamily( FAMILY_DONTKNOW ); aBulletFont.SetPitch( PITCH_DONTKNOW ); aBulletFont.SetWeight( WEIGHT_DONTKNOW ); - aBulletFont.SetTransparent( TRUE ); + aBulletFont.SetTransparent( sal_True ); cBullet = 0x2022; cByInputBullet = cBullet; diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index 00fe357cc6..44257ff5b6 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -36,26 +36,14 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> -/************************************************************************* -|* -|* TextRanger::TextRanger() -|* -|* Beschreibung -|* Ersterstellung 20.01.97 -|* Letzte Aenderung 20.01.97 AMA -|* -*************************************************************************/ - -#ifdef WIN -#pragma optimize ( "", off ) -#endif +#include <vector> -TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon, - USHORT nCacheSz, USHORT nLft, USHORT nRght, BOOL bSimpl, BOOL bInnr, - BOOL bVert ) : +TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B2DPolyPolygon* pLinePolyPolygon, + sal_uInt16 nCacheSz, sal_uInt16 nLft, sal_uInt16 nRght, + sal_Bool bSimpl, sal_Bool bInnr, sal_Bool bVert ) : pBound( NULL ), nCacheSize( nCacheSz ), - nCacheIdx( 0 ), nRight( nRght ), nLeft( nLft ), nUpper( 0 ), @@ -66,12 +54,8 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const baseg bVertical( bVert ) { #ifdef DBG_UTIL - bFlag3 = bFlag4 = bFlag5 = bFlag6 = bFlag7 = FALSE; + bFlag3 = bFlag4 = bFlag5 = bFlag6 = bFlag7 = sal_False; #endif - pRangeArr = new Range[ nCacheSize ]; - pCache = new SvLongsPtr[ nCacheSize ]; - memset( pRangeArr, 0, nCacheSize * sizeof( Range ) ); - memset( pCache, 0, nCacheSize * sizeof( SvLongsPtr ) ); sal_uInt32 nCount(rPolyPolygon.count()); mpPolyPolygon = new PolyPolygon( (sal_uInt16)nCount ); @@ -98,62 +82,33 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const baseg mpLinePolyPolygon = NULL; } -#ifdef WIN -#pragma optimize ( "", on ) -#endif - -/************************************************************************* -|* -|* TextRanger::~TextRanger() -|* -|* Beschreibung -|* Ersterstellung 20.01.97 -|* Letzte Aenderung 20.01.97 AMA -|* -*************************************************************************/ TextRanger::~TextRanger() { - for( USHORT i = 0; i < nCacheSize; ++i ) - delete pCache[i]; - delete[] pCache; - delete[] pRangeArr; + mRangeCache.clear(); delete mpPolyPolygon; delete mpLinePolyPolygon; } -/*-----------------17.11.00 09:49------------------- - * TextRanger::SetVertical(..) - * If there's is a change in the writing direction, - * the cache has to be cleared. - * --------------------------------------------------*/ - -void TextRanger::SetVertical( BOOL bNew ) +/* TextRanger::SetVertical(..) + If there's is a change in the writing direction, + the cache has to be cleared. +*/ +void TextRanger::SetVertical( sal_Bool bNew ) { if( IsVertical() != bNew ) { bVertical = bNew; - for( USHORT i = 0; i < nCacheSize; ++i ) - delete pCache[i]; - memset( pRangeArr, 0, nCacheSize * sizeof( Range ) ); - memset( pCache, 0, nCacheSize * sizeof( SvLongsPtr ) ); + mRangeCache.clear(); } } -/************************************************************************* -|* -|* SvxBoundArgs -|* -|* Beschreibung -|* Ersterstellung 20.01.97 -|* Letzte Aenderung 20.01.97 AMA -|* -*************************************************************************/ - +//! SvxBoundArgs is used to perform temporary calculations on a range array. +//! Temporary instances are created in TextRanger::GetTextRanges() class SvxBoundArgs { - SvBools aBoolArr; - SvLongs *pLongArr; + std::vector<bool> aBoolArr; + LongDqPtr pLongArr; TextRanger *pTextRanger; long nMin; long nMax; @@ -165,17 +120,17 @@ class SvxBoundArgs long nLower; long nStart; long nEnd; - USHORT nCut; - USHORT nLast; - USHORT nNext; - BYTE nAct; - BYTE nFirst; - BOOL bClosed : 1; - BOOL bInner : 1; - BOOL bMultiple : 1; - BOOL bConcat : 1; - BOOL bRotate : 1; - void NoteRange( BOOL bToggle ); + sal_uInt16 nCut; + sal_uInt16 nLast; + sal_uInt16 nNext; + sal_uInt8 nAct; + sal_uInt8 nFirst; + sal_Bool bClosed : 1; + sal_Bool bInner : 1; + sal_Bool bMultiple : 1; + sal_Bool bConcat : 1; + sal_Bool bRotate : 1; + void NoteRange( sal_Bool bToggle ); long Cut( long nY, const Point& rPt1, const Point& rPt2 ); void Add(); void _NoteFarPoint( long nPx, long nPyDiff, long nDiff ); @@ -186,29 +141,29 @@ class SvxBoundArgs inline long A( const Point& rP ) const { return bRotate ? rP.Y() : rP.X(); } inline long B( const Point& rP ) const { return bRotate ? rP.X() : rP.Y(); } public: - SvxBoundArgs( TextRanger* pRanger, SvLongs *pLong, const Range& rRange ); + SvxBoundArgs( TextRanger* pRanger, LongDqPtr pLong, const Range& rRange ); void NotePoint( const long nA ) { NoteMargin( nA - nStart, nA + nEnd ); } void NoteMargin( const long nL, const long nR ) { if( nMin > nL ) nMin = nL; if( nMax < nR ) nMax = nR; } - USHORT Area( const Point& rPt ); - void NoteUpLow( long nA, const BYTE nArea ); + sal_uInt16 Area( const Point& rPt ); + void NoteUpLow( long nA, const sal_uInt8 nArea ); void Calc( const PolyPolygon& rPoly ); void Concat( const PolyPolygon* pPoly ); // inlines void NoteLast() { if( bMultiple ) NoteRange( nAct == nFirst ); } - void SetClosed( const BOOL bNew ){ bClosed = bNew; } - BOOL IsClosed() const { return bClosed; } - void SetConcat( const BOOL bNew ){ bConcat = bNew; } - BOOL IsConcat() const { return bConcat; } - BYTE GetAct() const { return nAct; } + void SetClosed( const sal_Bool bNew ){ bClosed = bNew; } + sal_Bool IsClosed() const { return bClosed; } + void SetConcat( const sal_Bool bNew ){ bConcat = bNew; } + sal_Bool IsConcat() const { return bConcat; } + sal_uInt8 GetAct() const { return nAct; } }; -SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, SvLongs *pLong, +SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, LongDqPtr pLong, const Range& rRange ) - : aBoolArr( 4, 4 ), pLongArr( pLong ), pTextRanger( pRanger ), + : pLongArr( pLong ), pTextRanger( pRanger ), nTop( rRange.Min() ), nBottom( rRange.Max() ), bInner( pRanger->IsInner() ), bMultiple( bInner || !pRanger->IsSimple() ), - bConcat( FALSE ), bRotate( pRanger->IsVertical() ) + bConcat( sal_False ), bRotate( pRanger->IsVertical() ) { if( bRotate ) { @@ -226,7 +181,7 @@ SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, SvLongs *pLong, } nUpper = nTop - nUpDiff; nLower = nBottom + nLowDiff; - pLongArr->Remove( 0, pLongArr->Count() ); + pLongArr->clear(); } long SvxBoundArgs::CalcMax( const Point& rPt1, const Point& rPt2, @@ -245,7 +200,7 @@ long SvxBoundArgs::CalcMax( const Point& rPt1, const Point& rPt2, nB += nDa * nDa; nB = nRange + nDa * ( nFarRange - nRange ) / sqrt( nB ); - BOOL bNote; + sal_Bool bNote; if( nB < B(rPt2) ) bNote = nB > B(rPt1); else @@ -291,31 +246,30 @@ void SvxBoundArgs::_NoteFarPoint( long nPa, long nPbDiff, long nDiff ) NoteMargin( nTmpA, nPbDiff ); } -void SvxBoundArgs::NoteRange( BOOL bToggle ) +void SvxBoundArgs::NoteRange( sal_Bool bToggle ) { DBG_ASSERT( nMax >= nMin || bInner, "NoteRange: Min > Max?"); if( nMax < nMin ) return; if( !bClosed ) - bToggle = FALSE; - USHORT nIdx = 0; - USHORT nCount = pLongArr->Count(); - DBG_ASSERT( nCount == 2 * aBoolArr.Count(), "NoteRange: Incompatible Sizes" ); + bToggle = sal_False; + sal_uInt16 nIdx = 0; + sal_uInt16 nCount = pLongArr->size(); + DBG_ASSERT( nCount == 2 * aBoolArr.size(), "NoteRange: Incompatible Sizes" ); while( nIdx < nCount && (*pLongArr)[ nIdx ] < nMin ) ++nIdx; - BOOL bOdd = nIdx % 2 ? TRUE : FALSE; - // Kein Ueberlappung mit vorhandenen Intervallen? + sal_Bool bOdd = nIdx % 2 ? sal_True : sal_False; + // No overlap with existing intervals? if( nIdx == nCount || ( !bOdd && nMax < (*pLongArr)[ nIdx ] ) ) - { // Dann wird ein neues eingefuegt ... - pLongArr->Insert( nMin, nIdx ); - pLongArr->Insert( nMax, nIdx + 1 ); - aBoolArr.Insert( bToggle, nIdx / 2 ); + { // Then a new one is inserted ... + pLongArr->insert( pLongArr->begin() + nIdx, nMin ); + pLongArr->insert( pLongArr->begin() + nIdx + 1, nMax ); + aBoolArr.insert( aBoolArr.begin() + (nIdx/2), bToggle ); } else - { // ein vorhandes Intervall erweitern ... - USHORT nMaxIdx = nIdx; - // Wenn wir auf einer linken Intervallgrenze gelandet sind, muss diese - // auf nMin gesenkt werden. + { // expand an existing interval ... + sal_uInt16 nMaxIdx = nIdx; + // If we end up on a left interval boundary, it must be reduced to nMin. if( bOdd ) --nIdx; else @@ -327,32 +281,31 @@ void SvxBoundArgs::NoteRange( BOOL bToggle ) --nMaxIdx; if( nMaxIdx < nIdx ) nMaxIdx = nIdx; - // Wenn wir auf einer rechten Intervallgrenze landen, muss diese - // auf nMax angehoben werden. + // If we end up on a right interval boundary, it must be raised to nMax. if( nMaxIdx % 2 ) (*pLongArr)[ nMaxIdx-- ] = nMax; - // Jetzt werden eventuell noch Intervalle verschmolzen - USHORT nDiff = nMaxIdx - nIdx; - nMaxIdx = nIdx / 2; // Ab hier ist nMaxIdx der Index im BoolArray. + // Possible merge of intervals. + sal_uInt16 nDiff = nMaxIdx - nIdx; + nMaxIdx = nIdx / 2; // From here on is nMaxIdx the Index in BoolArray. if( nDiff ) { - (*pLongArr).Remove( nIdx + 1, nDiff ); + pLongArr->erase( pLongArr->begin() + nIdx + 1, pLongArr->begin() + nIdx + 1 + nDiff ); nDiff /= 2; - USHORT nStop = nMaxIdx + nDiff; - for( USHORT i = nMaxIdx; i < nStop; ++i ) + sal_uInt16 nStop = nMaxIdx + nDiff; + for( sal_uInt16 i = nMaxIdx; i < nStop; ++i ) bToggle ^= aBoolArr[ i ]; - aBoolArr.Remove( nMaxIdx, nDiff ); + aBoolArr.erase( aBoolArr.begin() + nMaxIdx, aBoolArr.begin() + (nMaxIdx + nDiff) ); } - DBG_ASSERT( nMaxIdx < aBoolArr.Count(), "NoteRange: Too much deleted" ); - aBoolArr[ nMaxIdx ] ^= bToggle; + DBG_ASSERT( nMaxIdx < aBoolArr.size(), "NoteRange: Too much deleted" ); + aBoolArr[ nMaxIdx ] = aBoolArr[ nMaxIdx ] ^ bToggle; } } void SvxBoundArgs::Calc( const PolyPolygon& rPoly ) { - USHORT nCount; + sal_uInt16 nCount; nAct = 0; - for( USHORT i = 0; i < rPoly.Count(); ++i ) + for( sal_uInt16 i = 0; i < rPoly.Count(); ++i ) { const Polygon& rPol = rPoly[ i ]; nCount = rPol.GetSize(); @@ -369,7 +322,7 @@ void SvxBoundArgs::Calc( const PolyPolygon& rPoly ) } else { - // Der erste Punkt des Polygons liegt innerhalb der Zeile. + // The first point of the polygon is within the line. if( nLast ) { if( bMultiple || !nAct ) @@ -393,13 +346,13 @@ void SvxBoundArgs::Calc( const PolyPolygon& rPoly ) else NotePoint( A(rNull) ); } - nFirst = 0; // In welcher Richtung wird die Zeile verlassen? - nAct = 3; // Wir sind z.Z. innerhalb der Zeile. + nFirst = 0; // leaving the line in which direction? + nAct = 3; // we are within the line at the moment. } if( nCount > 1 ) { - USHORT nIdx = 1; - while( TRUE ) + sal_uInt16 nIdx = 1; + while( sal_True ) { const Point& rLast = rPol[ nIdx - 1 ]; if( nIdx == nCount ) @@ -407,7 +360,7 @@ void SvxBoundArgs::Calc( const PolyPolygon& rPoly ) const Point& rNext = rPol[ nIdx ]; nNext = Area( rNext ); nCut = nNext ^ nLast; - USHORT nOldAct = nAct; + sal_uInt16 nOldAct = nAct; if( nAct ) CheckCut( rLast, rNext ); if( nCut & 4 ) @@ -458,7 +411,7 @@ void SvxBoundArgs::Calc( const PolyPolygon& rPoly ) } if( !bMultiple ) { - DBG_ASSERT( pLongArr->Count() == 0, "I said: Simple!" ); + DBG_ASSERT( pLongArr->size() == 0, "I said: Simple!" ); if( nAct ) { if( bInner ) @@ -469,15 +422,15 @@ void SvxBoundArgs::Calc( const PolyPolygon& rPoly ) nTmpMax = nMax - 2 * nEnd; if( nTmpMin <= nTmpMax ) { - pLongArr->Insert( nTmpMin, 0 ); - pLongArr->Insert( nTmpMax, 1 ); + pLongArr->push_front(nTmpMax); + pLongArr->push_front(nTmpMin); } } } else { - pLongArr->Insert( nMin, 0 ); - pLongArr->Insert( nMax, 1 ); + pLongArr->push_front(nMax); + pLongArr->push_front(nMin); } } } @@ -487,28 +440,28 @@ void SvxBoundArgs::Calc( const PolyPolygon& rPoly ) void SvxBoundArgs::Add() { - USHORT nLongIdx = 1; - USHORT nCount = aBoolArr.Count(); + sal_uInt16 nLongIdx = 1; + size_t nCount = aBoolArr.size(); if( nCount && ( !bInner || !pTextRanger->IsSimple() ) ) { - BOOL bDelete = aBoolArr[ 0 ]; + sal_Bool bDelete = aBoolArr.front(); if( bInner ) bDelete = !bDelete; - for( USHORT nBoolIdx = 1; nBoolIdx < nCount; ++nBoolIdx ) + for( size_t nBoolIdx = 1; nBoolIdx < nCount; ++nBoolIdx ) { if( bDelete ) { - USHORT next = 2; + sal_uInt16 next = 2; while( nBoolIdx < nCount && !aBoolArr[ nBoolIdx++ ] && (!bInner || nBoolIdx < nCount ) ) next += 2; - pLongArr->Remove( nLongIdx, next ); + pLongArr->erase( pLongArr->begin() + nLongIdx, pLongArr->begin() + nLongIdx + next ); next /= 2; nBoolIdx = nBoolIdx - next; nCount = nCount - next; - aBoolArr.Remove( nBoolIdx, next ); + aBoolArr.erase( aBoolArr.begin() + nBoolIdx, aBoolArr.begin() + (nBoolIdx + next) ); if( nBoolIdx ) - aBoolArr[ nBoolIdx - 1 ] = FALSE; + aBoolArr[ nBoolIdx - 1 ] = sal_False; #if OSL_DEBUG_LEVEL > 1 else ++next; @@ -517,25 +470,23 @@ void SvxBoundArgs::Add() bDelete = nBoolIdx < nCount && aBoolArr[ nBoolIdx ]; nLongIdx += 2; DBG_ASSERT( nLongIdx == 2*nBoolIdx+1, "BoundArgs: Array-Idx Confusion" ); - DBG_ASSERT( aBoolArr.Count()*2 == pLongArr->Count(), + DBG_ASSERT( aBoolArr.size()*2 == pLongArr->size(), "BoundArgs: Array-Count: Confusion" ); } } - if( 0 != ( nCount = pLongArr->Count() ) ) + if( 0 != ( nCount = pLongArr->size() ) ) { if( bInner ) { - pLongArr->Remove( 0, 1 ); - pLongArr->Remove( pLongArr->Count() - 1, 1 ); + pLongArr->pop_front(); + pLongArr->pop_back(); - // Hier wird die Zeile beim "einfachen" Konturumfluss im Innern - // in ein grosses Rechteck zusammengefasst. - // Zur Zeit (April 1999) wertet die EditEngine nur das erste Rechteck - // aus, falls sie eines Tages in der Lage ist, eine Zeile in mehreren - // Teilen auszugeben, kann es sinnvoll sein, die folgenden Zeilen - // zu loeschen. - if( pTextRanger->IsSimple() && pLongArr->Count() > 2 ) - pLongArr->Remove( 1, pLongArr->Count() - 2 ); + // Here the line is held inside a large rectangle for "simple" + // contour wrap. Currently (April 1999) the EditEngine evaluates + // only the first rectangle. If it one day is able to output a line + // in several parts, it may be advisable to delete the following lines. + if( pTextRanger->IsSimple() && pLongArr->size() > 2 ) + pLongArr->erase( pLongArr->begin() + 1, pLongArr->end() - 1 ); } } @@ -543,74 +494,74 @@ void SvxBoundArgs::Add() void SvxBoundArgs::Concat( const PolyPolygon* pPoly ) { - SetConcat( TRUE ); + SetConcat( sal_True ); DBG_ASSERT( pPoly, "Nothing to do?" ); - SvLongs *pOld = pLongArr; - pLongArr = new SvLongs( 2, 8 ); - aBoolArr.Remove( 0, aBoolArr.Count() ); - bInner = FALSE; - Calc( *pPoly ); - USHORT nCount = pLongArr->Count(); - USHORT nIdx = 0; - USHORT i = 0; - BOOL bSubtract = pTextRanger->IsInner(); + LongDqPtr pOld = pLongArr; + pLongArr = new std::deque<long>(); + aBoolArr.clear(); + bInner = sal_False; + Calc( *pPoly ); // Note that this updates pLongArr, which is why we swapped it out earlier. + sal_uInt16 nCount = pLongArr->size(); + sal_uInt16 nIdx = 0; + sal_uInt16 i = 0; + sal_Bool bSubtract = pTextRanger->IsInner(); while( i < nCount ) { - USHORT nOldCount = pOld->Count(); + sal_uLong nOldCount = pOld->size(); if( nIdx == nOldCount ) - { // Am Ende des alten Arrays angelangt... + { // Reached the end of the old Array... if( !bSubtract ) - pOld->Insert( pLongArr, nIdx, i, USHRT_MAX ); + pOld->insert( pOld->begin() + nIdx, pLongArr->begin() + i, pLongArr->end() ); break; } long nLeft = (*pLongArr)[ i++ ]; long nRight = (*pLongArr)[ i++ ]; - USHORT nLeftPos = nIdx + 1; + sal_uInt16 nLeftPos = nIdx + 1; while( nLeftPos < nOldCount && nLeft > (*pOld)[ nLeftPos ] ) nLeftPos += 2; if( nLeftPos >= nOldCount ) - { // Das aktuelle Intervall gehoert ans Ende des alten Arrays... + { // The current interval belongs to the end of the old array ... if( !bSubtract ) - pOld->Insert( pLongArr, nOldCount, i - 2, USHRT_MAX ); + pOld->insert( pOld->begin() + nOldCount, pLongArr->begin() + i - 2, pLongArr->end() ); break; } - USHORT nRightPos = nLeftPos - 1; + sal_uInt16 nRightPos = nLeftPos - 1; while( nRightPos < nOldCount && nRight >= (*pOld)[ nRightPos ] ) nRightPos += 2; if( nRightPos < nLeftPos ) - { // Das aktuelle Intervall gehoert zwischen zwei alte Intervalle + { // The current interval belongs between two old intervals if( !bSubtract ) - pOld->Insert( pLongArr, nRightPos, i - 2, i ); + pOld->insert( pOld->begin() + nRightPos, pLongArr->begin() + i - 2, pLongArr->begin() + i ); nIdx = nRightPos + 2; } - else if( bSubtract ) // Subtrahieren ggf. Trennen + else if( bSubtract ) // Subtract, if necessary separate { long nOld; if( nLeft > ( nOld = (*pOld)[ nLeftPos - 1 ] ) ) - { // Jetzt spalten wir den linken Teil ab... + { // Now we split the left part... if( nLeft - 1 > nOld ) { - pOld->Insert( nOld, nLeftPos - 1 ); - pOld->Insert( nLeft - 1, nLeftPos ); + pOld->insert( pOld->begin() + nLeftPos - 1, nOld ); + pOld->insert( pOld->begin() + nLeftPos, nLeft - 1 ); nLeftPos += 2; nRightPos += 2; } } if( nRightPos - nLeftPos > 1 ) - pOld->Remove( nLeftPos, nRightPos - nLeftPos - 1 ); + pOld->erase( pOld->begin() + nLeftPos, pOld->begin() + nRightPos - 1 ); if( ++nRight >= ( nOld = (*pOld)[ nLeftPos ] ) ) - pOld->Remove( nLeftPos - 1, 2 ); + pOld->erase( pOld->begin() + nLeftPos - 1, pOld->begin() + nLeftPos + 1 ); else (*pOld)[ nLeftPos - 1 ] = nRight; } - else // Verschmelzen + else // Merge { if( nLeft < (*pOld)[ nLeftPos - 1 ] ) (*pOld)[ nLeftPos - 1 ] = nLeft; if( nRight > (*pOld)[ nRightPos - 1 ] ) (*pOld)[ nRightPos - 1 ] = nRight; if( nRightPos - nLeftPos > 1 ) - pOld->Remove( nLeftPos, nRightPos - nLeftPos - 1 ); + pOld->erase( pOld->begin() + nLeftPos, pOld->begin() + nRightPos - 1 ); } nIdx = nLeftPos - 1; @@ -619,15 +570,15 @@ void SvxBoundArgs::Concat( const PolyPolygon* pPoly ) } /************************************************************************* - * SvxBoundArgs::Area ermittelt den Bereich, in dem sich der Punkt befindet - * 0 = innerhalb der Zeile - * 1 = unterhalb, aber innerhalb der oberen Randes - * 2 = oberhalb, aber innerhalb der unteren Randes - * 5 = unterhalb des oberen Randes - *10 = oberhalb des unteren Randes + * SvxBoundArgs::Area returns the area in which the point is located. + * 0 = within the line + * 1 = below, but within the upper edge + * 2 = above, but within the lower edge + * 5 = below the upper edge + *10 = above the lower edge *************************************************************************/ -USHORT SvxBoundArgs::Area( const Point& rPt ) +sal_uInt16 SvxBoundArgs::Area( const Point& rPt ) { long nB = B( rPt ); if( nB >= nBottom ) @@ -646,10 +597,10 @@ USHORT SvxBoundArgs::Area( const Point& rPt ) } /************************************************************************* - * lcl_Cut berechnet die X-Koordinate der Strecke (Pt1-Pt2) auf der - * Y-Koordinate nY. - * Vorausgesetzt wird, dass einer der Punkte oberhalb und der andere - * unterhalb der Y-Koordinate liegt. + * lcl_Cut calculates the X-Coordinate of the distance (Pt1-Pt2) at the + * Y-Coordinate nY. + * It is assumed that the one of the points are located above and the other + * one below the Y-Coordinate. *************************************************************************/ long SvxBoundArgs::Cut( long nB, const Point& rPt1, const Point& rPt2 ) @@ -667,7 +618,7 @@ long SvxBoundArgs::Cut( long nB, const Point& rPt1, const Point& rPt2 ) return long( rPt1.X() + nQuot ); } -void SvxBoundArgs::NoteUpLow( long nA, const BYTE nArea ) +void SvxBoundArgs::NoteUpLow( long nA, const sal_uInt8 nArea ) { if( nAct ) { @@ -688,26 +639,26 @@ void SvxBoundArgs::NoteUpLow( long nA, const BYTE nArea ) } } -SvLongsPtr TextRanger::GetTextRanges( const Range& rRange ) +LongDqPtr TextRanger::GetTextRanges( const Range& rRange ) { DBG_ASSERT( rRange.Min() || rRange.Max(), "Zero-Range not allowed, Bye Bye" ); - USHORT nIndex = 0; - while( nIndex < nCacheSize && rRange != pRangeArr[ nIndex ] ) - ++nIndex; - if( nIndex >= nCacheSize ) + //Can we find the result we need in the cache? + for (std::deque<RangeCache>::iterator it = mRangeCache.begin(); it < mRangeCache.end(); ++it) { - ++nCacheIdx; - nCacheIdx %= nCacheSize; - pRangeArr[ nCacheIdx ] = rRange; - if( !pCache[ nCacheIdx ] ) - pCache[ nCacheIdx ] = new SvLongs( 2, 8 ); - nIndex = nCacheIdx; - SvxBoundArgs aArg( this, pCache[ nCacheIdx ], rRange ); - aArg.Calc( *mpPolyPolygon ); - if( mpLinePolyPolygon ) - aArg.Concat( mpLinePolyPolygon ); + if (it->range == rRange) + return &(it->results); } - return pCache[ nIndex ]; + //Calculate a new result + RangeCache rngCache(rRange); + SvxBoundArgs aArg( this, &(rngCache.results), rRange ); + aArg.Calc( *mpPolyPolygon ); + if( mpLinePolyPolygon ) + aArg.Concat( mpLinePolyPolygon ); + //Add new result to the cache + mRangeCache.push_back(rngCache); + if (mRangeCache.size() > nCacheSize) + mRangeCache.pop_front(); + return &(mRangeCache.back().results); } const Rectangle& TextRanger::_GetBoundRect() diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 84ddce202d..7db6c78de3 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -32,10 +32,9 @@ #include <map> #include <set> #include <vector> -#include <slist> +#include <list> #include <memory> #include <editeng/unolingu.hxx> -#include <tools/debug.hxx> #include <tools/urlobj.hxx> #include <rtl/logfile.hxx> #include <unotools/pathoptions.hxx> @@ -80,9 +79,6 @@ using namespace ::com::sun::star::linguistic2; #define CSS com::sun::star -/////////////////////////////////////////////////////////////////////////// - - static uno::Reference< XLinguServiceManager > GetLngSvcMgr_Impl() { uno::Reference< XLinguServiceManager > xRes; @@ -96,14 +92,12 @@ static uno::Reference< XLinguServiceManager > GetLngSvcMgr_Impl() return xRes; } -/////////////////////////////////////////////////////////////////////////// - -BOOL lcl_FindEntry( const OUString &rEntry, const Sequence< OUString > &rCfgSvcs ) +sal_Bool lcl_FindEntry( const OUString &rEntry, const Sequence< OUString > &rCfgSvcs ) { - INT32 nRes = -1; - INT32 nEntries = rCfgSvcs.getLength(); + sal_Int32 nRes = -1; + sal_Int32 nEntries = rCfgSvcs.getLength(); const OUString *pEntry = rCfgSvcs.getConstArray(); - for (INT32 i = 0; i < nEntries && nRes == -1; ++i) + for (sal_Int32 i = 0; i < nEntries && nRes == -1; ++i) { if (rEntry == pEntry[i]) nRes = i; @@ -118,11 +112,11 @@ Sequence< OUString > lcl_RemoveMissingEntries( { Sequence< OUString > aRes( rCfgSvcs.getLength() ); OUString *pRes = aRes.getArray(); - INT32 nCnt = 0; + sal_Int32 nCnt = 0; - INT32 nEntries = rCfgSvcs.getLength(); + sal_Int32 nEntries = rCfgSvcs.getLength(); const OUString *pEntry = rCfgSvcs.getConstArray(); - for (INT32 i = 0; i < nEntries; ++i) + for (sal_Int32 i = 0; i < nEntries; ++i) { if (pEntry[i].getLength() && lcl_FindEntry( pEntry[i], rAvailSvcs )) pRes[ nCnt++ ] = pEntry[i]; @@ -144,7 +138,7 @@ Sequence< OUString > lcl_GetLastFoundSvcs( SvxLocaleToLanguage( rAvailLocale ) ) ); Sequence< OUString > aNodeNames( rCfg.GetNodeNames(rLastFoundList) ); - BOOL bFound = lcl_FindEntry( aCfgLocaleStr, aNodeNames); + sal_Bool bFound = lcl_FindEntry( aCfgLocaleStr, aNodeNames); if (bFound) { @@ -154,19 +148,15 @@ Sequence< OUString > lcl_GetLastFoundSvcs( rNodeName += OUString::valueOf( (sal_Unicode)'/' ); rNodeName += aCfgLocaleStr; Sequence< Any > aValues( rCfg.GetProperties( aNames ) ); -#if OSL_DEBUG_LEVEL > 1 - const Any *pValue; - pValue = aValues.getConstArray(); -#endif if (aValues.getLength()) { - DBG_ASSERT( aValues.getLength() == 1, "unexpected length of sequence" ); + OSL_ENSURE( aValues.getLength() == 1, "unexpected length of sequence" ); Sequence< OUString > aSvcImplNames; if (aValues.getConstArray()[0] >>= aSvcImplNames) aRes = aSvcImplNames; else { - DBG_ERROR( "type mismatch" ); + OSL_FAIL( "type mismatch" ); } } } @@ -179,13 +169,13 @@ Sequence< OUString > lcl_GetNewEntries( const Sequence< OUString > &rLastFoundSvcs, const Sequence< OUString > &rAvailSvcs ) { - INT32 nLen = rAvailSvcs.getLength(); + sal_Int32 nLen = rAvailSvcs.getLength(); Sequence< OUString > aRes( nLen ); OUString *pRes = aRes.getArray(); - INT32 nCnt = 0; + sal_Int32 nCnt = 0; const OUString *pEntry = rAvailSvcs.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { if (pEntry[i].getLength() && !lcl_FindEntry( pEntry[i], rLastFoundSvcs )) pRes[ nCnt++ ] = pEntry[i]; @@ -202,17 +192,17 @@ Sequence< OUString > lcl_MergeSeq( { Sequence< OUString > aRes( rCfgSvcs.getLength() + rNewSvcs.getLength() ); OUString *pRes = aRes.getArray(); - INT32 nCnt = 0; + sal_Int32 nCnt = 0; - for (INT32 k = 0; k < 2; ++k) + for (sal_Int32 k = 0; k < 2; ++k) { // add previously configuerd service first and append // new found services at the end const Sequence< OUString > &rSeq = k == 0 ? rCfgSvcs : rNewSvcs; - INT32 nLen = rSeq.getLength(); + sal_Int32 nLen = rSeq.getLength(); const OUString *pEntry = rSeq.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { if (pEntry[i].getLength() && !lcl_FindEntry( pEntry[i], aRes )) pRes[ nCnt++ ] = pEntry[i]; @@ -223,11 +213,8 @@ Sequence< OUString > lcl_MergeSeq( return aRes; } -/////////////////////////////////////////////////////////////////////////// - -// static member initialization -INT16 SvxLinguConfigUpdate::nNeedUpdating = -1; -INT32 SvxLinguConfigUpdate::nCurrentDataFilesChangedCheckValue = -1; +sal_Int16 SvxLinguConfigUpdate::nNeedUpdating = -1; +sal_Int32 SvxLinguConfigUpdate::nCurrentDataFilesChangedCheckValue = -1; void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck ) { @@ -244,10 +231,10 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck ) RTL_LOGFILE_CONTEXT( aLog, "svx: SvxLinguConfigUpdate::UpdateAll - updating..." ); - DBG_ASSERT( nNeedUpdating == 1, "SvxLinguConfigUpdate::UpdateAll already updated!" ); + OSL_ENSURE( nNeedUpdating == 1, "SvxLinguConfigUpdate::UpdateAll already updated!" ); uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() ); - DBG_ASSERT( xLngSvcMgr.is(), "service manager missing"); + OSL_ENSURE( xLngSvcMgr.is(), "service manager missing"); if (!xLngSvcMgr.is()) return; @@ -264,16 +251,16 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck ) for (int k = 0; k < nNumServices; ++k) { - OUString aService( A2OU( apServices[k] ) ); - OUString aActiveList( A2OU( apCurLists[k] ) ); - OUString aLastFoundList( A2OU( apLastFoundLists[k] ) ); - INT32 i; + OUString aService( ::rtl::OUString::createFromAscii( apServices[k] ) ); + OUString aActiveList( ::rtl::OUString::createFromAscii( apCurLists[k] ) ); + OUString aLastFoundList( ::rtl::OUString::createFromAscii( apLastFoundLists[k] ) ); + sal_Int32 i; // // remove configured but not available language/services entries // Sequence< OUString > aNodeNames( aCfg.GetNodeNames( aActiveList ) ); // list of configured locales - INT32 nNodeNames = aNodeNames.getLength(); + sal_Int32 nNodeNames = aNodeNames.getLength(); const OUString *pNodeName = aNodeNames.getConstArray(); for (i = 0; i < nNodeNames; ++i) { @@ -298,7 +285,7 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck ) // uno::Reference< XAvailableLocales > xAvail( xLngSvcMgr, UNO_QUERY ); Sequence< Locale > aAvailLocales( xAvail->getAvailableLocales(aService) ); - INT32 nAvailLocales = aAvailLocales.getLength(); + sal_Int32 nAvailLocales = aAvailLocales.getLength(); const Locale *pAvailLocale = aAvailLocales.getConstArray(); for (i = 0; i < nAvailLocales; ++i) { @@ -342,9 +329,9 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck ) xLngSvcMgr->getAvailableServices( aService, pAvailLocale[i] ) ); #if OSL_DEBUG_LEVEL > 1 - INT32 nSvcs = aSvcImplNames.getLength(); + sal_Int32 nSvcs = aSvcImplNames.getLength(); const OUString *pSvcImplName = aSvcImplNames.getConstArray(); - for (INT32 j = 0; j < nSvcs; ++j) + for (sal_Int32 j = 0; j < nSvcs; ++j) { OUString aImplName( pSvcImplName[j] ); } @@ -364,7 +351,7 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck ) for (int i = 0; i < 2; ++i) { const sal_Char *pSubNodeName = (i == 0) ? apCurLists[k] : apLastFoundLists[k]; - OUString aSubNodeName( A2OU(pSubNodeName) ); + OUString aSubNodeName( ::rtl::OUString::createFromAscii(pSubNodeName) ); list_entry_map_t &rCurMap = (i == 0) ? aCurSvcs[k] : aLastFoundSvcs[k]; list_entry_map_t::const_iterator aIt( rCurMap.begin() ); @@ -379,9 +366,9 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck ) #if OSL_DEBUG_LEVEL > 1 Sequence< OUString > aSvcImplNames( (*aIt).second ); - INT32 nSvcs = aSvcImplNames.getLength(); + sal_Int32 nSvcs = aSvcImplNames.getLength(); const OUString *pSvcImplName = aSvcImplNames.getConstArray(); - for (INT32 j = 0; j < nSvcs; ++j) + for (sal_Int32 j = 0; j < nSvcs; ++j) { OUString aImplName( pSvcImplName[j] ); } @@ -391,23 +378,23 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck ) ++pNewValue; ++aIt; } - DBG_ASSERT( pNewValue - aNewValues.getArray() == nVals, + OSL_ENSURE( pNewValue - aNewValues.getArray() == nVals, "possible mismatch of sequence size and property number" ); { RTL_LOGFILE_CONTEXT( aLog, "svx: SvxLinguConfigUpdate::UpdateAll - ReplaceSetProperties" ); // add new or replace existing entries. - BOOL bRes = aCfg.ReplaceSetProperties( aSubNodeName, aNewValues ); + sal_Bool bRes = aCfg.ReplaceSetProperties( aSubNodeName, aNewValues ); if (!bRes) { #if OSL_DEBUG_LEVEL > 1 - DBG_ERROR( "failed to set new configuration values" ); + OSL_FAIL( "failed to set new configuration values" ); #endif } } } } - DBG_ASSERT( nCurrentDataFilesChangedCheckValue != -1, "SvxLinguConfigUpdate::UpdateAll DataFilesChangedCheckValue not yet calculated!" ); + OSL_ENSURE( nCurrentDataFilesChangedCheckValue != -1, "SvxLinguConfigUpdate::UpdateAll DataFilesChangedCheckValue not yet calculated!" ); Any aAny; // for the time being (developer builds until OOo 3.0) @@ -419,7 +406,7 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck ) // not be too troublesome. // In OOo 3.0 we will not need the respective code anymore at all. // aAny <<= nCurrentDataFilesChangedCheckValue; - aAny <<= (INT32) -1; // keep the value set to 'need to check' + aAny <<= (sal_Int32) -1; // keep the value set to 'need to check' aCfg.SetProperty( A2OU( "DataFilesChangedCheckValue" ), aAny ); @@ -436,17 +423,17 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck ) } -INT32 SvxLinguConfigUpdate::CalcDataFilesChangedCheckValue() +sal_Int32 SvxLinguConfigUpdate::CalcDataFilesChangedCheckValue() { RTL_LOGFILE_CONTEXT( aLog, "svx: SvxLinguConfigUpdate::CalcDataFilesChangedCheckValue" ); - INT32 nHashVal = 0; + sal_Int32 nHashVal = 0; // nothing to be checked anymore since those old directory paths are gone by now return nHashVal; } -BOOL SvxLinguConfigUpdate::IsNeedUpdateAll( sal_Bool bForceCheck ) +sal_Bool SvxLinguConfigUpdate::IsNeedUpdateAll( sal_Bool bForceCheck ) { RTL_LOGFILE_CONTEXT( aLog, "svx: SvxLinguConfigUpdate::IsNeedUpdateAll" ); if (nNeedUpdating == -1 || bForceCheck ) // need to check if updating is necessary @@ -461,14 +448,12 @@ BOOL SvxLinguConfigUpdate::IsNeedUpdateAll( sal_Bool bForceCheck ) aCfg.GetOptions( aLinguOpt ); nNeedUpdating = (nCurrentDataFilesChangedCheckValue == aLinguOpt.nDataFilesChangedCheckValue) ? 0 : 1; } - DBG_ASSERT( nNeedUpdating != -1, + OSL_ENSURE( nNeedUpdating != -1, "need for linguistic configuration update should have been already checked." ); return nNeedUpdating == 1; } -/////////////////////////////////////////////////////////////////////////// - //! Dummy implementation in order to avoid loading of lingu DLL //! when only the XSupportedLocales interface is used. @@ -523,10 +508,10 @@ void ThesDummy_Impl::GetCfgLocales() String aNode( A2OU( "ServiceManager/ThesaurusList" ) ); Sequence < OUString > aNodeNames( aCfg.GetNodeNames( aNode ) ); const OUString *pNodeNames = aNodeNames.getConstArray(); - INT32 nLen = aNodeNames.getLength(); + sal_Int32 nLen = aNodeNames.getLength(); pLocaleSeq = new Sequence< Locale >( nLen ); Locale *pLocale = pLocaleSeq->getArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { pLocale[i] = SvxCreateLocale( MsLangId::convertIsoStringToLanguage( pNodeNames[i] ) ); @@ -581,8 +566,8 @@ sal_Bool SAL_CALL else if (!pLocaleSeq) // if not already loaded save startup time by avoiding loading them now GetCfgLocales(); GetCfgLocales(); - BOOL bFound = FALSE; - INT32 nLen = pLocaleSeq->getLength(); + sal_Bool bFound = sal_False; + sal_Int32 nLen = pLocaleSeq->getLength(); const Locale *pLocale = pLocaleSeq->getConstArray(); const Locale *pEnd = pLocale + nLen; for ( ; pLocale < pEnd && !bFound; ++pLocale) @@ -605,16 +590,13 @@ uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL { GetThes_Impl(); uno::Sequence< uno::Reference< linguistic2::XMeaning > > aRes; - DBG_ASSERT( xThes.is(), "Thesaurus missing" ); + OSL_ENSURE( xThes.is(), "Thesaurus missing" ); if (xThes.is()) aRes = xThes->queryMeanings( rTerm, rLocale, rProperties ); return aRes; } -/////////////////////////////////////////////////////////////////////////// - - //! Dummy implementation in order to avoid loading of lingu DLL. //! The dummy accesses the real implementation (and thus loading the DLL) //! when it needs to be done only. @@ -682,7 +664,7 @@ sal_Bool SAL_CALL throw(uno::RuntimeException) { GetSpell_Impl(); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (xSpell.is()) bRes = xSpell->hasLanguage( nLanguage ); return bRes; @@ -696,7 +678,7 @@ sal_Bool SAL_CALL uno::RuntimeException) { GetSpell_Impl(); - BOOL bRes = TRUE; + sal_Bool bRes = sal_True; if (xSpell.is()) bRes = xSpell->isValid( rWord, nLanguage, rProperties ); return bRes; @@ -717,9 +699,6 @@ uno::Reference< linguistic2::XSpellAlternatives > SAL_CALL } -/////////////////////////////////////////////////////////////////////////// - - //! Dummy implementation in order to avoid loading of lingu DLL. //! The dummy accesses the real implementation (and thus loading the DLL) //! when it needs to be done only. @@ -801,7 +780,7 @@ sal_Bool SAL_CALL throw(uno::RuntimeException) { GetHyph_Impl(); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (xHyph.is()) bRes = xHyph->hasLocale( rLocale ); return bRes; @@ -858,11 +837,9 @@ uno::Reference< linguistic2::XPossibleHyphens > SAL_CALL } -/////////////////////////////////////////////////////////////////////////// - - typedef cppu::WeakImplHelper1 < XEventListener > LinguMgrAppExitLstnrBaseClass; + class LinguMgrAppExitLstnr : public LinguMgrAppExitLstnrBaseClass { uno::Reference< XComponent > xDesktop; @@ -901,7 +878,7 @@ LinguMgrAppExitLstnr::~LinguMgrAppExitLstnr() xDesktop->removeEventListener( this ); xDesktop = NULL; //! release reference to desktop } - DBG_ASSERT(!xDesktop.is(), "reference to desktop should be realeased"); + OSL_ENSURE(!xDesktop.is(), "reference to desktop should be realeased"); } void LinguMgrAppExitLstnr::disposing(const EventObject& rSource) @@ -916,8 +893,6 @@ void LinguMgrAppExitLstnr::disposing(const EventObject& rSource) } } -/////////////////////////////////////////////////////////////////////////// - class LinguMgrExitLstnr : public LinguMgrAppExitLstnr { public: @@ -938,16 +913,10 @@ void LinguMgrExitLstnr::AtExit() LinguMgr::bExiting = sal_True; - //TL:TODO: MBA fragen wie ich ohne Absturz hier meinen Speicher - // wieder freibekomme... - //delete LinguMgr::pExitLstnr; LinguMgr::pExitLstnr = 0; } -/////////////////////////////////////////////////////////////////////////// - -// static member initialization LinguMgrExitLstnr * LinguMgr::pExitLstnr = 0; sal_Bool LinguMgr::bExiting = sal_False; uno::Reference< XLinguServiceManager > LinguMgr::xLngSvcMgr = 0; @@ -1028,16 +997,6 @@ uno::Reference< XSpellChecker1 > LinguMgr::GetSpell() //! use dummy implementation in order to avoid loading of lingu DLL xSpell = new SpellDummy_Impl; - -/* if (!xLngSvcMgr.is()) - xLngSvcMgr = GetLngSvcMgr_Impl(); - - if (xLngSvcMgr.is()) - { - xSpell = uno::Reference< XSpellChecker1 > ( - xLngSvcMgr->getSpellChecker(), UNO_QUERY ); - } -*/ return xSpell; } @@ -1051,16 +1010,6 @@ uno::Reference< XHyphenator > LinguMgr::GetHyph() //! use dummy implementation in order to avoid loading of lingu DLL xHyph = new HyphDummy_Impl; - -/* - if (!xLngSvcMgr.is()) - xLngSvcMgr = GetLngSvcMgr_Impl(); - - if (xLngSvcMgr.is()) - { - xHyph = xLngSvcMgr->getHyphenator(); - } -*/ return xHyph; } @@ -1077,15 +1026,6 @@ uno::Reference< XThesaurus > LinguMgr::GetThes() //! The dummy accesses the real implementation (and thus loading the DLL) //! when "real" work needs to be done only. xThes = new ThesDummy_Impl; -/* - if (!xLngSvcMgr.is()) - xLngSvcMgr = GetLngSvcMgr_Impl(); - - if (xLngSvcMgr.is()) - { - xThes = xLngSvcMgr->getThesaurus(); - } -*/ return xThes; } @@ -1206,19 +1146,17 @@ uno::Reference< XDictionary > LinguMgr::GetStandard() } #if OSL_DEBUG_LEVEL > 1 uno::Reference< XStorable > xStor( xDic, UNO_QUERY ); - DBG_ASSERT( xDic.is() && xDic->getDictionaryType() == DictionaryType_POSITIVE, + OSL_ENSURE( xDic.is() && xDic->getDictionaryType() == DictionaryType_POSITIVE, "wrong dictionary type"); - DBG_ASSERT( xDic.is() && SvxLocaleToLanguage( xDic->getLocale() ) == LANGUAGE_NONE, + OSL_ENSURE( xDic.is() && SvxLocaleToLanguage( xDic->getLocale() ) == LANGUAGE_NONE, "wrong dictionary language"); - DBG_ASSERT( !xStor.is() || (xStor->hasLocation() && !xStor->isReadonly()), + OSL_ENSURE( !xStor.is() || (xStor->hasLocation() && !xStor->isReadonly()), "dictionary not editable" ); #endif return xDic; } -/////////////////////////////////////////////////////////////////////////// - uno::Reference< XSpellChecker1 > SvxGetSpellChecker() { return LinguMgr::GetSpellChecker(); @@ -1244,7 +1182,7 @@ uno::Reference< XPropertySet > SvxGetLinguPropertySet() return LinguMgr::GetLinguPropertySet(); } -//TL:TODO: remove argument or provide SvxGetIgnoreAllList with the same one +//TODO: remove argument or provide SvxGetIgnoreAllList with the same one uno::Reference< XDictionary > SvxGetOrCreatePosDic( uno::Reference< XDictionaryList > /* xDicList */ ) { @@ -1261,9 +1199,6 @@ uno::Reference< XDictionary > SvxGetChangeAllList() return LinguMgr::GetChangeAllList(); } -/////////////////////////////////////////////////////////////////////////// - - #include <com/sun/star/linguistic2/XHyphenatedWord.hpp> SvxAlternativeSpelling SvxGetAltSpelling( @@ -1275,40 +1210,38 @@ SvxAlternativeSpelling SvxGetAltSpelling( { OUString aWord( rHyphWord->getWord() ), aAltWord( rHyphWord->getHyphenatedWord() ); - INT16 nHyphenationPos = rHyphWord->getHyphenationPos(), + sal_Int16 nHyphenationPos = rHyphWord->getHyphenationPos(), nHyphenPos = rHyphWord->getHyphenPos(); - INT16 nLen = (INT16)aWord.getLength(); - INT16 nAltLen = (INT16)aAltWord.getLength(); + sal_Int16 nLen = (sal_Int16)aWord.getLength(); + sal_Int16 nAltLen = (sal_Int16)aAltWord.getLength(); const sal_Unicode *pWord = aWord.getStr(), *pAltWord = aAltWord.getStr(); // count number of chars from the left to the // hyphenation pos / hyphen pos that are equal - INT16 nL = 0; + sal_Int16 nL = 0; while (nL <= nHyphenationPos && nL <= nHyphenPos && pWord[ nL ] == pAltWord[ nL ]) ++nL; // count number of chars from the right to the // hyphenation pos / hyphen pos that are equal - INT16 nR = 0; - INT32 nIdx = nLen - 1; - INT32 nAltIdx = nAltLen - 1; + sal_Int16 nR = 0; + sal_Int32 nIdx = nLen - 1; + sal_Int32 nAltIdx = nAltLen - 1; while (nIdx > nHyphenationPos && nAltIdx > nHyphenPos && pWord[ nIdx-- ] == pAltWord[ nAltIdx-- ]) ++nR; aRes.aReplacement = OUString( aAltWord.copy( nL, nAltLen - nL - nR ) ); - aRes.nChangedPos = (INT16) nL; + aRes.nChangedPos = (sal_Int16) nL; aRes.nChangedLength = nLen - nL - nR; - aRes.bIsAltSpelling = TRUE; + aRes.bIsAltSpelling = sal_True; aRes.xHyphWord = rHyphWord; } return aRes; } -/////////////////////////////////////////////////////////////////////////// - SvxDicListChgClamp::SvxDicListChgClamp( uno::Reference< XDictionaryList > &rxDicList ) : xDicList ( rxDicList ) { @@ -1326,8 +1259,6 @@ SvxDicListChgClamp::~SvxDicListChgClamp() } } -/////////////////////////////////////////////////////////////////////////// - short SvxDicError( Window *pParent, sal_Int16 nError ) { short nRes = 0; @@ -1340,7 +1271,7 @@ short SvxDicError( Window *pParent, sal_Int16 nError ) case DIC_ERR_READONLY : nRid = RID_SVXSTR_DIC_ERR_READONLY; break; default: nRid = RID_SVXSTR_DIC_ERR_UNKNOWN; - DBG_ASSERT(0, "unexpected case"); + OSL_FAIL("unexpected case"); } nRes = InfoBox( pParent, EE_RESSTR( nRid ) ).Execute(); } @@ -1349,7 +1280,6 @@ short SvxDicError( Window *pParent, sal_Int16 nError ) LanguageType SvxLocaleToLanguage( const Locale& rLocale ) { - // empty Locale -> LANGUAGE_NONE if ( rLocale.Language.getLength() == 0 ) return LANGUAGE_NONE; @@ -1358,7 +1288,7 @@ LanguageType SvxLocaleToLanguage( const Locale& rLocale ) Locale& SvxLanguageToLocale( Locale& rLocale, LanguageType eLang ) { - if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */) + if ( eLang != LANGUAGE_NONE ) MsLangId::convertLanguageToLocale( eLang, rLocale ); else rLocale = Locale(); @@ -1369,7 +1299,7 @@ Locale& SvxLanguageToLocale( Locale& rLocale, LanguageType eLang ) Locale SvxCreateLocale( LanguageType eLang ) { Locale aLocale; - if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */) + if ( eLang != LANGUAGE_NONE ) MsLangId::convertLanguageToLocale( eLang, aLocale ); return aLocale; diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx index 6db152dbfd..75164f9ebd 100644 --- a/editeng/source/outliner/outleeng.cxx +++ b/editeng/source/outliner/outleeng.cxx @@ -56,7 +56,7 @@ OutlinerEditEng::~OutlinerEditEng() { } -void OutlinerEditEng::PaintingFirstLine( USHORT nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) +void OutlinerEditEng::PaintingFirstLine( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) { if( GetControlWord() && EE_CNTRL_OUTLINER ) { @@ -67,7 +67,7 @@ void OutlinerEditEng::PaintingFirstLine( USHORT nPara, const Point& rStartPos, l pOwner->PaintBullet( nPara, rStartPos, rOrigin, nOrientation, pOutDev ); } -const SvxNumberFormat* OutlinerEditEng::GetNumberFormat( USHORT nPara ) const +const SvxNumberFormat* OutlinerEditEng::GetNumberFormat( sal_uInt16 nPara ) const { const SvxNumberFormat* pFmt = NULL; if (pOwner) @@ -76,32 +76,32 @@ const SvxNumberFormat* OutlinerEditEng::GetNumberFormat( USHORT nPara ) const } -Rectangle OutlinerEditEng::GetBulletArea( USHORT nPara ) +Rectangle OutlinerEditEng::GetBulletArea( sal_uInt16 nPara ) { Rectangle aBulletArea = Rectangle( Point(), Point() ); if ( nPara < pOwner->pParaList->GetParagraphCount() ) { if ( pOwner->ImplHasBullet( nPara ) ) - aBulletArea = pOwner->ImpCalcBulletArea( nPara, FALSE, FALSE ); + aBulletArea = pOwner->ImpCalcBulletArea( nPara, sal_False, sal_False ); } return aBulletArea; } -void OutlinerEditEng::ParagraphInserted( USHORT nNewParagraph ) +void OutlinerEditEng::ParagraphInserted( sal_uInt16 nNewParagraph ) { pOwner->ParagraphInserted( nNewParagraph ); EditEngine::ParagraphInserted( nNewParagraph ); } -void OutlinerEditEng::ParagraphDeleted( USHORT nDeletedParagraph ) +void OutlinerEditEng::ParagraphDeleted( sal_uInt16 nDeletedParagraph ) { pOwner->ParagraphDeleted( nDeletedParagraph ); EditEngine::ParagraphDeleted( nDeletedParagraph ); } -void OutlinerEditEng::ParagraphConnected( USHORT /*nLeftParagraph*/, USHORT nRightParagraph ) +void OutlinerEditEng::ParagraphConnected( sal_uInt16 /*nLeftParagraph*/, sal_uInt16 nRightParagraph ) { if( pOwner && pOwner->IsUndoEnabled() && !const_cast<EditEngine&>(pOwner->GetEditEngine()).IsInUndo() ) { @@ -119,22 +119,22 @@ void OutlinerEditEng::StyleSheetChanged( SfxStyleSheet* pStyle ) pOwner->StyleSheetChanged( pStyle ); } -void OutlinerEditEng::ParaAttribsChanged( USHORT nPara ) +void OutlinerEditEng::ParaAttribsChanged( sal_uInt16 nPara ) { pOwner->ParaAttribsChanged( nPara ); } -BOOL OutlinerEditEng::SpellNextDocument() +sal_Bool OutlinerEditEng::SpellNextDocument() { return pOwner->SpellNextDocument(); } -BOOL OutlinerEditEng::ConvertNextDocument() +sal_Bool OutlinerEditEng::ConvertNextDocument() { return pOwner->ConvertNextDocument(); } -XubString OutlinerEditEng::GetUndoComment( USHORT nUndoId ) const +XubString OutlinerEditEng::GetUndoComment( sal_uInt16 nUndoId ) const { switch( nUndoId ) { @@ -158,8 +158,8 @@ XubString OutlinerEditEng::GetUndoComment( USHORT nUndoId ) const } } -void OutlinerEditEng::DrawingText( const Point& rStartPos, const XubString& rText, USHORT nTextStart, USHORT nTextLen, - const sal_Int32* pDXArray, const SvxFont& rFont, USHORT nPara, USHORT nIndex, BYTE nRightToLeft, +void OutlinerEditEng::DrawingText( const Point& rStartPos, const XubString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, + const sal_Int32* pDXArray, const SvxFont& rFont, sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt8 nRightToLeft, const EEngineData::WrongSpellVector* pWrongSpellVector, const SvxFieldData* pFieldData, bool bEndOfLine, @@ -174,7 +174,7 @@ void OutlinerEditEng::DrawingText( const Point& rStartPos, const XubString& rTex } void OutlinerEditEng::DrawingTab( const Point& rStartPos, long nWidth, const String& rChar, - const SvxFont& rFont, USHORT nPara, xub_StrLen nIndex, BYTE nRightToLeft, + const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, bool bEndOfLine, bool bEndOfParagraph, const Color& rOverlineColor, const Color& rTextLineColor) { @@ -182,23 +182,23 @@ void OutlinerEditEng::DrawingTab( const Point& rStartPos, long nWidth, const Str bEndOfLine, bEndOfParagraph, rOverlineColor, rTextLineColor ); } -void OutlinerEditEng::FieldClicked( const SvxFieldItem& rField, USHORT nPara, USHORT nPos ) +void OutlinerEditEng::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos ) { - EditEngine::FieldClicked( rField, nPara, nPos ); // Falls URL + EditEngine::FieldClicked( rField, nPara, nPos ); // If URL pOwner->FieldClicked( rField, nPara, nPos ); } -void OutlinerEditEng::FieldSelected( const SvxFieldItem& rField, USHORT nPara, USHORT nPos ) +void OutlinerEditEng::FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos ) { pOwner->FieldSelected( rField, nPara, nPos ); } -XubString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ) +XubString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) { return pOwner->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } -void OutlinerEditEng::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) +void OutlinerEditEng::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); if( pPara ) @@ -206,13 +206,13 @@ void OutlinerEditEng::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) if ( !IsInUndo() && IsUndoEnabled() ) pOwner->UndoActionStart( OLUNDO_ATTR ); - EditEngine::SetParaAttribs( (USHORT)nPara, rSet ); + EditEngine::SetParaAttribs( (sal_uInt16)nPara, rSet ); - pOwner->ImplCheckNumBulletItem( (USHORT)nPara ); + pOwner->ImplCheckNumBulletItem( (sal_uInt16)nPara ); // #i100014# // It is not a good idea to substract 1 from a count and cast the result // to USHORT without check, if the count is 0. - pOwner->ImplCheckParagraphs( (USHORT)nPara, (USHORT) (pOwner->pParaList->GetParagraphCount()) ); + pOwner->ImplCheckParagraphs( (sal_uInt16)nPara, (sal_uInt16) (pOwner->pParaList->GetParagraphCount()) ); if ( !IsInUndo() && IsUndoEnabled() ) pOwner->UndoActionEnd( OLUNDO_ATTR ); diff --git a/editeng/source/outliner/outleeng.hxx b/editeng/source/outliner/outleeng.hxx index a18bd95884..cbe254c845 100644 --- a/editeng/source/outliner/outleeng.hxx +++ b/editeng/source/outliner/outleeng.hxx @@ -42,22 +42,21 @@ protected: // derived from EditEngine. Allows Outliner objetcs to provide // bullet access to the EditEngine. - virtual const SvxNumberFormat* GetNumberFormat( USHORT nPara ) const; + virtual const SvxNumberFormat* GetNumberFormat( sal_uInt16 nPara ) const; public: OutlinerEditEng( Outliner* pOwner, SfxItemPool* pPool ); ~OutlinerEditEng(); - virtual void PaintingFirstLine( USHORT nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ); + virtual void PaintingFirstLine( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ); - virtual void ParagraphInserted( USHORT nNewParagraph ); - virtual void ParagraphDeleted( USHORT nDeletedParagraph ); - virtual void ParagraphConnected( USHORT nLeftParagraph, USHORT nRightParagraph ); + virtual void ParagraphInserted( sal_uInt16 nNewParagraph ); + virtual void ParagraphDeleted( sal_uInt16 nDeletedParagraph ); + virtual void ParagraphConnected( sal_uInt16 nLeftParagraph, sal_uInt16 nRightParagraph ); - // #101498# virtual void DrawingText( - const Point& rStartPos, const XubString& rText, USHORT nTextStart, USHORT nTextLen, const sal_Int32* pDXArray, const SvxFont& rFont, - USHORT nPara, USHORT nIndex, BYTE nRightToLeft, + const Point& rStartPos, const XubString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, const sal_Int32* pDXArray, const SvxFont& rFont, + sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt8 nRightToLeft, const EEngineData::WrongSpellVector* pWrongSpellVector, const SvxFieldData* pFieldData, bool bEndOfLine, @@ -69,27 +68,27 @@ public: virtual void DrawingTab( const Point& rStartPos, long nWidth, const String& rChar, - const SvxFont& rFont, USHORT nPara, xub_StrLen nIndex, BYTE nRightToLeft, + const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, bool bEndOfLine, bool bEndOfParagraph, const Color& rOverlineColor, const Color& rTextLineColor); virtual void StyleSheetChanged( SfxStyleSheet* pStyle ); - virtual void ParaAttribsChanged( USHORT nPara ); - virtual BOOL SpellNextDocument(); - virtual XubString GetUndoComment( USHORT nUndoId ) const; + virtual void ParaAttribsChanged( sal_uInt16 nPara ); + virtual sal_Bool SpellNextDocument(); + virtual XubString GetUndoComment( sal_uInt16 nUndoId ) const; // for text conversion - virtual BOOL ConvertNextDocument(); + virtual sal_Bool ConvertNextDocument(); - virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, USHORT nPos ); - virtual void FieldSelected( const SvxFieldItem& rField, USHORT nPara, USHORT nPos ); - virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rTxtColor, Color*& rFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos ); + virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos ); + virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rTxtColor, Color*& rFldColor ); - virtual Rectangle GetBulletArea( USHORT nPara ); + virtual Rectangle GetBulletArea( sal_uInt16 nPara ); - virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ); + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); // belongs into class Outliner, move there before incompatible update! Link aOutlinerNotifyHdl; diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index cf2428eaba..cb4f6f598b 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -36,7 +36,6 @@ #include <editeng/eerdll.hxx> #include <editeng/lrspitem.hxx> #include <editeng/fhgtitem.hxx> -#include <tools/list.hxx> #include <svl/style.hxx> #include <vcl/mapmod.hxx> @@ -57,18 +56,18 @@ DBG_NAMEEX(Outliner) using namespace ::com::sun::star::uno; using namespace ::com::sun::star::linguistic2; -// ===================================================================== -// ====================== Einfache Durchreicher ======================= +// ====================================================================== +// ====================== Simple pass-through ======================= // ====================================================================== -void Outliner::SetUpdateMode( BOOL bUpdate ) +void Outliner::SetUpdateMode( sal_Bool bUpdate ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetUpdateMode( bUpdate ); } -BOOL Outliner::GetUpdateMode() const +sal_Bool Outliner::GetUpdateMode() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetUpdateMode(); @@ -80,13 +79,13 @@ const SfxItemSet& Outliner::GetEmptyItemSet() const return pEditEngine->GetEmptyItemSet(); } -void Outliner::EnableUndo( BOOL bEnable ) +void Outliner::EnableUndo( sal_Bool bEnable ) { DBG_CHKTHIS(Outliner,0); pEditEngine->EnableUndo( bEnable ); } -BOOL Outliner::IsUndoEnabled() const +sal_Bool Outliner::IsUndoEnabled() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->IsUndoEnabled(); @@ -123,13 +122,13 @@ void Outliner::ClearModifyFlag() pEditEngine->ClearModifyFlag(); } -BOOL Outliner::IsModified() const +sal_Bool Outliner::IsModified() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->IsModified(); } -ULONG Outliner::GetTextHeight() const +sal_uLong Outliner::GetTextHeight() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetTextHeight(); @@ -177,31 +176,31 @@ Link Outliner::GetStatusEventHdl() const return pEditEngine->GetStatusEventHdl(); } -void Outliner::SetDefTab( USHORT nTab ) +void Outliner::SetDefTab( sal_uInt16 nTab ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetDefTab( nTab ); } -USHORT Outliner::GetDefTab() const +sal_uInt16 Outliner::GetDefTab() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetDefTab(); } -BOOL Outliner::IsFlatMode() const +sal_Bool Outliner::IsFlatMode() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->IsFlatMode(); } -BOOL Outliner::UpdateFields() +sal_Bool Outliner::UpdateFields() { DBG_CHKTHIS(Outliner,0); return pEditEngine->UpdateFields(); } -void Outliner::RemoveFields( BOOL bKeepFieldText, TypeId aType ) +void Outliner::RemoveFields( sal_Bool bKeepFieldText, TypeId aType ) { DBG_CHKTHIS(Outliner,0); pEditEngine->RemoveFields( bKeepFieldText, aType ); @@ -219,7 +218,7 @@ String Outliner::GetWordDelimiters() const return pEditEngine->GetWordDelimiters(); } -String Outliner::GetWord( USHORT nPara, USHORT nIndex ) +String Outliner::GetWord( sal_uInt16 nPara, sal_uInt16 nIndex ) { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetWord( nPara, nIndex ); @@ -304,7 +303,7 @@ void Outliner::SetMaxAutoPaperSize( const Size& rSz ) pEditEngine->SetMaxAutoPaperSize( rSz ); } -BOOL Outliner::IsExpanded( Paragraph* pPara ) const +sal_Bool Outliner::IsExpanded( Paragraph* pPara ) const { DBG_CHKTHIS(Outliner,0); return pParaList->HasVisibleChilds( pPara ); @@ -316,7 +315,7 @@ Paragraph* Outliner::GetParent( Paragraph* pParagraph ) const return pParaList->GetParent( pParagraph ); } -ULONG Outliner::GetChildCount( Paragraph* pParent ) const +sal_uLong Outliner::GetChildCount( Paragraph* pParent ) const { DBG_CHKTHIS(Outliner,0); return pParaList->GetChildCount( pParent ); @@ -328,10 +327,16 @@ Size Outliner::CalcTextSize() return Size(pEditEngine->CalcTextWidth(),pEditEngine->GetTextHeight()); } +Size Outliner::CalcTextSizeNTP() +{ + DBG_CHKTHIS(Outliner,0); + return Size(pEditEngine->CalcTextWidth(),pEditEngine->GetTextHeightNTP()); +} + Point Outliner::GetDocPos( Paragraph* pPara ) { DBG_CHKTHIS(Outliner,0); - return pEditEngine->GetDocPosTopLeft( (USHORT)pParaList->GetAbsPos( pPara ) ); + return pEditEngine->GetDocPosTopLeft( (sal_uInt16)pParaList->GetAbsPos( pPara ) ); } void Outliner::SetStyleSheetPool( SfxStyleSheetPool* pSPool ) @@ -346,73 +351,73 @@ SfxStyleSheetPool* Outliner::GetStyleSheetPool() return pEditEngine->GetStyleSheetPool(); } -SfxStyleSheet* Outliner::GetStyleSheet( ULONG nPara ) +SfxStyleSheet* Outliner::GetStyleSheet( sal_uLong nPara ) { DBG_CHKTHIS(Outliner,0); - return pEditEngine->GetStyleSheet( (USHORT)nPara ); + return pEditEngine->GetStyleSheet( (sal_uInt16)nPara ); } -BOOL Outliner::IsInSelectionMode() const +sal_Bool Outliner::IsInSelectionMode() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->IsInSelectionMode(); } -void Outliner::SetControlWord( ULONG nWord ) +void Outliner::SetControlWord( sal_uLong nWord ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetControlWord( nWord ); } -ULONG Outliner::GetControlWord() const +sal_uLong Outliner::GetControlWord() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetControlWord(); } -void Outliner::SetAsianCompressionMode( USHORT n ) +void Outliner::SetAsianCompressionMode( sal_uInt16 n ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetAsianCompressionMode( n ); } -USHORT Outliner::GetAsianCompressionMode() const +sal_uInt16 Outliner::GetAsianCompressionMode() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetAsianCompressionMode(); } -void Outliner::SetKernAsianPunctuation( BOOL b ) +void Outliner::SetKernAsianPunctuation( sal_Bool b ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetKernAsianPunctuation( b ); } -BOOL Outliner::IsKernAsianPunctuation() const +sal_Bool Outliner::IsKernAsianPunctuation() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->IsKernAsianPunctuation(); } -void Outliner::SetAddExtLeading( BOOL bExtLeading ) +void Outliner::SetAddExtLeading( sal_Bool bExtLeading ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetAddExtLeading( bExtLeading ); } -BOOL Outliner::IsAddExtLeading() const +sal_Bool Outliner::IsAddExtLeading() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->IsAddExtLeading(); } -void Outliner::UndoActionStart( USHORT nId ) +void Outliner::UndoActionStart( sal_uInt16 nId ) { DBG_CHKTHIS(Outliner,0); pEditEngine->UndoActionStart( nId ); } -void Outliner::UndoActionEnd( USHORT nId ) +void Outliner::UndoActionEnd( sal_uInt16 nId ) { DBG_CHKTHIS(Outliner,0); pEditEngine->UndoActionEnd( nId ); @@ -420,37 +425,35 @@ void Outliner::UndoActionEnd( USHORT nId ) void Outliner::InsertUndo( EditUndo* pUndo ) { -#ifndef SVX_LIGHT DBG_CHKTHIS(Outliner,0); - pEditEngine->GetUndoManager().AddUndoAction( pUndo, FALSE ); -#endif + pEditEngine->GetUndoManager().AddUndoAction( pUndo, sal_False ); } -BOOL Outliner::IsInUndo() +sal_Bool Outliner::IsInUndo() { DBG_CHKTHIS(Outliner,0); return pEditEngine->IsInUndo(); } -ULONG Outliner::GetLineCount( ULONG nParagraph ) const +sal_uLong Outliner::GetLineCount( sal_uLong nParagraph ) const { DBG_CHKTHIS(Outliner,0); - return pEditEngine->GetLineCount( (USHORT)nParagraph ); + return pEditEngine->GetLineCount( (sal_uInt16)nParagraph ); } -USHORT Outliner::GetLineLen( ULONG nParagraph, USHORT nLine ) const +sal_uInt16 Outliner::GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const { DBG_CHKTHIS(Outliner,0); - return pEditEngine->GetLineLen( (USHORT)nParagraph, nLine ); + return pEditEngine->GetLineLen( (sal_uInt16)nParagraph, nLine ); } -ULONG Outliner::GetLineHeight( ULONG nParagraph, ULONG nLine ) +sal_uLong Outliner::GetLineHeight( sal_uLong nParagraph, sal_uLong nLine ) { DBG_CHKTHIS(Outliner,0); - return pEditEngine->GetLineHeight( (USHORT)nParagraph, (USHORT)nLine ); + return pEditEngine->GetLineHeight( (sal_uInt16)nParagraph, (sal_uInt16)nLine ); } -void Outliner::QuickRemoveCharAttribs( USHORT nPara, USHORT nWhich ) +void Outliner::QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich ) { DBG_CHKTHIS(Outliner,0); pEditEngine->QuickRemoveCharAttribs( nPara, nWhich ); @@ -468,10 +471,10 @@ sal_Bool Outliner::HasConvertibleTextPortion( LanguageType nLang ) return pEditEngine->HasConvertibleTextPortion( nLang ); } -BOOL Outliner::ConvertNextDocument() +sal_Bool Outliner::ConvertNextDocument() { DBG_CHKTHIS(Outliner,0); - return FALSE; + return sal_False; } void Outliner::SetDefaultLanguage( LanguageType eLang ) @@ -486,7 +489,7 @@ LanguageType Outliner::GetDefaultLanguage() const return pEditEngine->GetDefaultLanguage(); } -BOOL Outliner::HasOnlineSpellErrors() const +sal_Bool Outliner::HasOnlineSpellErrors() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->HasOnlineSpellErrors(); @@ -498,7 +501,7 @@ void Outliner::CompleteOnlineSpelling() pEditEngine->CompleteOnlineSpelling(); } -BOOL Outliner::HasText( const SvxSearchItem& rSearchItem ) +sal_Bool Outliner::HasText( const SvxSearchItem& rSearchItem ) { DBG_CHKTHIS(Outliner,0); return pEditEngine->HasText( rSearchItem ); @@ -516,10 +519,10 @@ SfxItemPool* Outliner::GetEditTextObjectPool() const return pEditEngine->GetEditTextObjectPool(); } -BOOL Outliner::SpellNextDocument() +sal_Bool Outliner::SpellNextDocument() { DBG_CHKTHIS(Outliner,0); - return FALSE; + return sal_False; } @@ -565,16 +568,16 @@ OutputDevice* Outliner::GetRefDevice() const return pEditEngine->GetRefDevice(); } -USHORT Outliner::GetFirstLineOffset( ULONG nParagraph ) +sal_uInt16 Outliner::GetFirstLineOffset( sal_uLong nParagraph ) { DBG_CHKTHIS(Outliner,0); - return pEditEngine->GetFirstLineOffset( (USHORT)nParagraph ); + return pEditEngine->GetFirstLineOffset( (sal_uInt16)nParagraph ); } -ULONG Outliner::GetTextHeight( ULONG nParagraph ) const +sal_uLong Outliner::GetTextHeight( sal_uLong nParagraph ) const { DBG_CHKTHIS(Outliner,0); - return pEditEngine->GetTextHeight((USHORT)nParagraph ); + return pEditEngine->GetTextHeight((sal_uInt16)nParagraph ); } Point Outliner::GetDocPos( const Point& rPaperPos ) const @@ -583,35 +586,35 @@ Point Outliner::GetDocPos( const Point& rPaperPos ) const return pEditEngine->GetDocPos( rPaperPos ); } -Point Outliner::GetDocPosTopLeft( ULONG nParagraph ) +Point Outliner::GetDocPosTopLeft( sal_uLong nParagraph ) { DBG_CHKTHIS(Outliner,0); - return pEditEngine->GetDocPosTopLeft( (USHORT)nParagraph ); + return pEditEngine->GetDocPosTopLeft( (sal_uInt16)nParagraph ); } -BOOL Outliner::IsTextPos( const Point& rPaperPos, USHORT nBorder ) +sal_Bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder ) { return IsTextPos( rPaperPos, nBorder, NULL ); } -BOOL Outliner::IsTextPos( const Point& rPaperPos, USHORT nBorder, BOOL* pbBullet ) +sal_Bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bool* pbBullet ) { DBG_CHKTHIS(Outliner,0); if ( pbBullet) - *pbBullet = FALSE; - BOOL bTextPos = pEditEngine->IsTextPos( rPaperPos, nBorder ); + *pbBullet = sal_False; + sal_Bool bTextPos = pEditEngine->IsTextPos( rPaperPos, nBorder ); if ( !bTextPos ) { Point aDocPos = GetDocPos( rPaperPos ); - USHORT nPara = pEditEngine->FindParagraph( aDocPos.Y() ); + sal_uInt16 nPara = pEditEngine->FindParagraph( aDocPos.Y() ); if ( ( nPara != EE_PARA_NOT_FOUND ) && ImplHasBullet( nPara ) ) { - Rectangle aBulArea = ImpCalcBulletArea( nPara, TRUE, TRUE ); + Rectangle aBulArea = ImpCalcBulletArea( nPara, sal_True, sal_True ); if ( aBulArea.IsInside( rPaperPos ) ) { - bTextPos = TRUE; + bTextPos = sal_True; if ( pbBullet) - *pbBullet = TRUE; + *pbBullet = sal_True; } } } @@ -627,50 +630,50 @@ void Outliner::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) void Outliner::QuickInsertText( const XubString& rText, const ESelection& rSel ) { - bFirstParaIsEmpty = FALSE; + bFirstParaIsEmpty = sal_False; pEditEngine->QuickInsertText( rText, rSel ); } void Outliner::QuickDelete( const ESelection& rSel ) { - bFirstParaIsEmpty = FALSE; + bFirstParaIsEmpty = sal_False; pEditEngine->QuickDelete( rSel ); } void Outliner::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) { DBG_CHKTHIS(Outliner,0); - bFirstParaIsEmpty = FALSE; + bFirstParaIsEmpty = sal_False; pEditEngine->QuickInsertField( rFld, rSel ); } void Outliner::QuickInsertLineBreak( const ESelection& rSel ) { DBG_CHKTHIS(Outliner,0); - bFirstParaIsEmpty = FALSE; + bFirstParaIsEmpty = sal_False; pEditEngine->QuickInsertLineBreak( rSel ); } -void Outliner::QuickFormatDoc( BOOL bFull ) +void Outliner::QuickFormatDoc( sal_Bool bFull ) { DBG_CHKTHIS(Outliner,0); pEditEngine->QuickFormatDoc( bFull ); } -void Outliner::SetGlobalCharStretching( USHORT nX, USHORT nY ) +void Outliner::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetGlobalCharStretching( nX, nY ); } -void Outliner::GetGlobalCharStretching( USHORT& rX, USHORT& rY ) +void Outliner::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) { DBG_CHKTHIS(Outliner,0); pEditEngine->GetGlobalCharStretching( rX, rY ); } -void Outliner::DoStretchChars( USHORT nX, USHORT nY ) +void Outliner::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY ) { DBG_CHKTHIS(Outliner,0); pEditEngine->DoStretchChars( nX, nY ); @@ -682,43 +685,43 @@ void Outliner::EraseVirtualDevice() pEditEngine->EraseVirtualDevice(); } -void Outliner::SetBigTextObjectStart( USHORT nStartAtPortionCount ) +void Outliner::SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetBigTextObjectStart( nStartAtPortionCount ); } -USHORT Outliner::GetBigTextObjectStart() const +sal_uInt16 Outliner::GetBigTextObjectStart() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetBigTextObjectStart(); } -BOOL Outliner::ShouldCreateBigTextObject() const +sal_Bool Outliner::ShouldCreateBigTextObject() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->ShouldCreateBigTextObject(); } -void Outliner::SetVertical( BOOL b ) +void Outliner::SetVertical( sal_Bool b ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetVertical( b ); } -BOOL Outliner::IsVertical() const +sal_Bool Outliner::IsVertical() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->IsVertical(); } -void Outliner::SetFixedCellHeight( BOOL bUseFixedCellHeight ) +void Outliner::SetFixedCellHeight( sal_Bool bUseFixedCellHeight ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetFixedCellHeight( bUseFixedCellHeight ); } -BOOL Outliner::IsFixedCellHeight() const +sal_Bool Outliner::IsFixedCellHeight() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->IsFixedCellHeight(); @@ -736,13 +739,13 @@ EEHorizontalTextDirection Outliner::GetDefaultHorizontalTextDirection() const return pEditEngine->GetDefaultHorizontalTextDirection(); } -USHORT Outliner::GetScriptType( const ESelection& rSelection ) const +sal_uInt16 Outliner::GetScriptType( const ESelection& rSelection ) const { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetScriptType( rSelection ); } -LanguageType Outliner::GetLanguage( USHORT nPara, USHORT nPos ) const +LanguageType Outliner::GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetLanguage( nPara, nPos ); @@ -754,60 +757,50 @@ void Outliner::RemoveAttribs( const ESelection& rSelection, sal_Bool bRemovePara pEditEngine->RemoveAttribs( rSelection, bRemoveParaAttribs, nWhich ); } -void Outliner::EnableAutoColor( BOOL b ) +void Outliner::EnableAutoColor( sal_Bool b ) { DBG_CHKTHIS(Outliner,0); pEditEngine->EnableAutoColor( b ); } -BOOL Outliner::IsAutoColorEnabled() const +sal_Bool Outliner::IsAutoColorEnabled() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->IsAutoColorEnabled(); } -void Outliner::ForceAutoColor( BOOL b ) +void Outliner::ForceAutoColor( sal_Bool b ) { DBG_CHKTHIS(Outliner,0); pEditEngine->ForceAutoColor( b ); } -BOOL Outliner::IsForceAutoColor() const +sal_Bool Outliner::IsForceAutoColor() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->IsForceAutoColor(); } -/*-- 13.10.2003 16:56:23--------------------------------------------------- - -----------------------------------------------------------------------*/ void Outliner::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc) { pEditEngine->StartSpelling(rEditView, bMultipleDoc); } -/*-- 13.10.2003 16:56:23--------------------------------------------------- - -----------------------------------------------------------------------*/ void Outliner::EndSpelling() { pEditEngine->EndSpelling(); } -/*-- 13.10.2003 16:56:23--------------------------------------------------- - -----------------------------------------------------------------------*/ bool Outliner::SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking ) { return pEditEngine->SpellSentence(rEditView, rToFill, bIsGrammarChecking ); } -/*-- 08.09.2008 11:39:05--------------------------------------------------- - -----------------------------------------------------------------------*/ void Outliner::PutSpellingToSentenceStart( EditView& rEditView ) { pEditEngine->PutSpellingToSentenceStart( rEditView ); } -/*-- 13.10.2003 16:56:25--------------------------------------------------- - -----------------------------------------------------------------------*/ void Outliner::ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck ) { pEditEngine->ApplyChangedSentence( rEditView, rNewPortions, bRecheck ); diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index d9a42270d5..3e0cc204fc 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -63,25 +63,27 @@ #include <editeng/brshitem.hxx> #include <svl/itempool.hxx> -// #101498# calculate if it's RTL or not +// calculate if it's RTL or not #include <unicode/ubidi.h> +#include <cassert> +using ::std::advance; #define DEFAULT_SCALE 75 -static const USHORT nDefStyles = 3; // Sonderbehandlung fuer die ersten 3 Ebenen -static const USHORT nDefBulletIndent = 800; -static const USHORT nDefBulletWidth = 700; -static const USHORT pDefBulletIndents[nDefStyles]= { 1400, 800, 800 }; -static const USHORT pDefBulletWidths[nDefStyles] = { 1000, 850, 700 }; +static const sal_uInt16 nDefStyles = 3; // Special treatment for the first 3 levels +static const sal_uInt16 nDefBulletIndent = 800; +static const sal_uInt16 nDefBulletWidth = 700; +static const sal_uInt16 pDefBulletIndents[nDefStyles]= { 1400, 800, 800 }; +static const sal_uInt16 pDefBulletWidths[nDefStyles] = { 1000, 850, 700 }; -USHORT lcl_ImplGetDefBulletWidth( sal_Int16 nDepth ) +sal_uInt16 lcl_ImplGetDefBulletWidth( sal_Int16 nDepth ) { return ( nDepth < nDefStyles ) ? pDefBulletWidths[nDepth] : nDefBulletWidth; } -USHORT lcl_ImplGetDefBulletIndent( sal_Int16 nDepth ) +sal_uInt16 lcl_ImplGetDefBulletIndent( sal_Int16 nDepth ) { - USHORT nI = 0; + sal_uInt16 nI = 0; if( nDepth >= 0 ) { @@ -106,7 +108,7 @@ void Outliner::ImplCheckDepth( sal_Int16& rnDepth ) const rnDepth = nMaxDepth; } -Paragraph* Outliner::Insert(const XubString& rText, ULONG nAbsPos, sal_Int16 nDepth) +Paragraph* Outliner::Insert(const XubString& rText, sal_uLong nAbsPos, sal_Int16 nDepth) { DBG_CHKTHIS(Outliner,0); DBG_ASSERT(pParaList->GetParagraphCount(),"Insert:No Paras"); @@ -115,7 +117,7 @@ Paragraph* Outliner::Insert(const XubString& rText, ULONG nAbsPos, sal_Int16 nDe ImplCheckDepth( nDepth ); - ULONG nParagraphCount = pParaList->GetParagraphCount(); + sal_uLong nParagraphCount = pParaList->GetParagraphCount(); if( nAbsPos > nParagraphCount ) nAbsPos = nParagraphCount; @@ -135,28 +137,28 @@ Paragraph* Outliner::Insert(const XubString& rText, ULONG nAbsPos, sal_Int16 nDe } else { - BOOL bUpdate = pEditEngine->GetUpdateMode(); - pEditEngine->SetUpdateMode( FALSE ); - ImplBlockInsertionCallbacks( TRUE ); + sal_Bool bUpdate = pEditEngine->GetUpdateMode(); + pEditEngine->SetUpdateMode( sal_False ); + ImplBlockInsertionCallbacks( sal_True ); pPara = new Paragraph( nDepth ); pParaList->Insert( pPara, nAbsPos ); - pEditEngine->InsertParagraph( (USHORT)nAbsPos, String() ); + pEditEngine->InsertParagraph( (sal_uInt16)nAbsPos, String() ); DBG_ASSERT(pPara==pParaList->GetParagraph(nAbsPos),"Insert:Failed"); - ImplInitDepth( (USHORT)nAbsPos, nDepth, FALSE ); + ImplInitDepth( (sal_uInt16)nAbsPos, nDepth, sal_False ); pHdlParagraph = pPara; ParagraphInsertedHdl(); pPara->nFlags |= PARAFLAG_HOLDDEPTH; SetText( rText, pPara ); - ImplBlockInsertionCallbacks( FALSE ); + ImplBlockInsertionCallbacks( sal_False ); pEditEngine->SetUpdateMode( bUpdate ); } - bFirstParaIsEmpty = FALSE; + bFirstParaIsEmpty = sal_False; DBG_ASSERT(pEditEngine->GetParagraphCount()==pParaList->GetParagraphCount(),"SetText failed"); return pPara; } -void Outliner::ParagraphInserted( USHORT nPara ) +void Outliner::ParagraphInserted( sal_uInt16 nPara ) { DBG_CHKTHIS(Outliner,0); @@ -170,7 +172,7 @@ void Outliner::ParagraphInserted( USHORT nPara ) if( pEditEngine->IsInUndo() ) { pPara->nFlags = PARAFLAG_SETBULLETTEXT; - pPara->bVisible = TRUE; + pPara->bVisible = sal_True; const SfxInt16Item& rLevel = (const SfxInt16Item&) pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ); pPara->SetDepth( rLevel.GetValue() ); } @@ -187,14 +189,14 @@ void Outliner::ParagraphInserted( USHORT nPara ) if( !pEditEngine->IsInUndo() ) { - ImplCalcBulletText( nPara, TRUE, FALSE ); + ImplCalcBulletText( nPara, sal_True, sal_False ); pHdlParagraph = pPara; ParagraphInsertedHdl(); } } } -void Outliner::ParagraphDeleted( USHORT nPara ) +void Outliner::ParagraphDeleted( sal_uInt16 nPara ) { DBG_CHKTHIS(Outliner,0); @@ -221,24 +223,24 @@ void Outliner::ParagraphDeleted( USHORT nPara ) pPara = pParaList->GetParagraph( nPara ); if ( pPara && ( pPara->GetDepth() > nDepth ) ) { - ImplCalcBulletText( nPara, TRUE, FALSE ); - // naechsten auf gleicher Ebene suchen... + ImplCalcBulletText( nPara, sal_True, sal_False ); + // Search for next on the this level ... while ( pPara && pPara->GetDepth() > nDepth ) pPara = pParaList->GetParagraph( ++nPara ); } if ( pPara && ( pPara->GetDepth() == nDepth ) ) - ImplCalcBulletText( nPara, TRUE, FALSE ); + ImplCalcBulletText( nPara, sal_True, sal_False ); } } -void Outliner::Init( USHORT nMode ) +void Outliner::Init( sal_uInt16 nMode ) { nOutlinerMode = nMode; Clear(); - ULONG nCtrl = pEditEngine->GetControlWord(); + sal_uLong nCtrl = pEditEngine->GetControlWord(); nCtrl &= ~(EE_CNTRL_OUTLINER|EE_CNTRL_OUTLINER2); SetMaxDepth( 9 ); @@ -256,17 +258,17 @@ void Outliner::Init( USHORT nMode ) nCtrl |= EE_CNTRL_OUTLINER; break; - default: DBG_ERROR( "Outliner::Init - Invalid Mode!" ); + default: OSL_FAIL( "Outliner::Init - Invalid Mode!" ); } pEditEngine->SetControlWord( nCtrl ); - ImplInitDepth( 0, GetMinDepth(), FALSE ); + ImplInitDepth( 0, GetMinDepth(), sal_False ); GetUndoManager().Clear(); } -void Outliner::SetMaxDepth( sal_Int16 nDepth, BOOL bCheckParagraphs ) +void Outliner::SetMaxDepth( sal_Int16 nDepth, sal_Bool bCheckParagraphs ) { if( nMaxDepth != nDepth ) { @@ -274,8 +276,8 @@ void Outliner::SetMaxDepth( sal_Int16 nDepth, BOOL bCheckParagraphs ) if( bCheckParagraphs ) { - USHORT nParagraphs = (USHORT)pParaList->GetParagraphCount(); - for ( USHORT nPara = 0; nPara < nParagraphs; nPara++ ) + sal_uInt16 nParagraphs = (sal_uInt16)pParaList->GetParagraphCount(); + for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ ) { Paragraph* pPara = pParaList->GetParagraph( nPara ); if( pPara && pPara->GetDepth() > nMaxDepth ) @@ -287,7 +289,7 @@ void Outliner::SetMaxDepth( sal_Int16 nDepth, BOOL bCheckParagraphs ) } } -sal_Int16 Outliner::GetDepth( ULONG nPara ) const +sal_Int16 Outliner::GetDepth( sal_uLong nPara ) const { Paragraph* pPara = pParaList->GetParagraph( nPara ); DBG_ASSERT( pPara, "Outliner::GetDepth - Paragraph not found!" ); @@ -306,9 +308,9 @@ void Outliner::SetDepth( Paragraph* pPara, sal_Int16 nNewDepth ) mnDepthChangeHdlPrevFlags = pPara->nFlags; pHdlParagraph = pPara; - USHORT nPara = (USHORT)GetAbsPos( pPara ); - ImplInitDepth( nPara, nNewDepth, TRUE ); - ImplCalcBulletText( nPara, FALSE, FALSE ); + sal_uInt16 nPara = (sal_uInt16)GetAbsPos( pPara ); + ImplInitDepth( nPara, nNewDepth, sal_True ); + ImplCalcBulletText( nPara, sal_False, sal_False ); if ( ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT ) ImplSetLevelDependendStyleSheet( nPara ); @@ -339,7 +341,7 @@ void Outliner::SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingSta // #i100014# // It is not a good idea to substract 1 from a count and cast the result // to USHORT without check, if the count is 0. - ImplCheckParagraphs( nPara, (USHORT) (pParaList->GetParagraphCount()) ); + ImplCheckParagraphs( nPara, (sal_uInt16) (pParaList->GetParagraphCount()) ); pEditEngine->SetModified(); } } @@ -366,18 +368,18 @@ void Outliner::SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumb // #i100014# // It is not a good idea to substract 1 from a count and cast the result // to USHORT without check, if the count is 0. - ImplCheckParagraphs( nPara, (USHORT) (pParaList->GetParagraphCount()) ); + ImplCheckParagraphs( nPara, (sal_uInt16) (pParaList->GetParagraphCount()) ); pEditEngine->SetModified(); } } -OutlinerParaObject* Outliner::CreateParaObject( USHORT nStartPara, USHORT nCount ) const +OutlinerParaObject* Outliner::CreateParaObject( sal_uInt16 nStartPara, sal_uInt16 nCount ) const { DBG_CHKTHIS(Outliner,0); - if ( sal::static_int_cast< ULONG >( nStartPara + nCount ) > + if ( sal::static_int_cast< sal_uLong >( nStartPara + nCount ) > pParaList->GetParagraphCount() ) - nCount = sal::static_int_cast< USHORT >( + nCount = sal::static_int_cast< sal_uInt16 >( pParaList->GetParagraphCount() - nStartPara ); // When a new OutlinerParaObject is created because a paragraph is just beeing deleted, @@ -410,16 +412,16 @@ void Outliner::SetText( const XubString& rText, Paragraph* pPara ) DBG_CHKTHIS(Outliner,0); DBG_ASSERT(pPara,"SetText:No Para"); - BOOL bUpdate = pEditEngine->GetUpdateMode(); - pEditEngine->SetUpdateMode( FALSE ); - ImplBlockInsertionCallbacks( TRUE ); + sal_Bool bUpdate = pEditEngine->GetUpdateMode(); + pEditEngine->SetUpdateMode( sal_False ); + ImplBlockInsertionCallbacks( sal_True ); - USHORT nPara = (USHORT)pParaList->GetAbsPos( pPara ); + sal_uInt16 nPara = (sal_uInt16)pParaList->GetAbsPos( pPara ); if( !rText.Len() ) { pEditEngine->SetText( nPara, rText ); - ImplInitDepth( nPara, pPara->GetDepth(), FALSE ); + ImplInitDepth( nPara, pPara->GetDepth(), sal_False ); } else { @@ -427,11 +429,11 @@ void Outliner::SetText( const XubString& rText, Paragraph* pPara ) aText.ConvertLineEnd( LINEEND_LF ); if( aText.GetChar( aText.Len()-1 ) == '\x0A' ) - aText.Erase( aText.Len()-1, 1 ); // letzten Umbruch loeschen + aText.Erase( aText.Len()-1, 1 ); // Delete the last break - USHORT nCount = aText.GetTokenCount( '\x0A' ); - USHORT nPos = 0; - USHORT nInsPos = nPara+1; + sal_uInt16 nCount = aText.GetTokenCount( '\x0A' ); + sal_uInt16 nPos = 0; + sal_uInt16 nInsPos = nPara+1; while( nCount > nPos ) { XubString aStr = aText.GetToken( nPos, '\x0A' ); @@ -445,20 +447,19 @@ void Outliner::SetText( const XubString& rText, Paragraph* pPara ) else nCurDepth = pPara->GetDepth(); - // Im Outliner-Modus die Tabulatoren filtern und die - // Einrueckung ueber ein LRSpaceItem einstellen - // Im EditEngine-Modus ueber Maltes Tabulatoren einruecken + // In the outliner mode, filter the tabs and set the indentation + // about a LRSpaceItem. In EditEngine mode intend over old tabs if( ( ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT ) || ( ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEVIEW ) ) { - // Tabs raus - USHORT nTabs = 0; + // Extract Tabs + sal_uInt16 nTabs = 0; while ( ( nTabs < aStr.Len() ) && ( aStr.GetChar( nTabs ) == '\t' ) ) nTabs++; if ( nTabs ) aStr.Erase( 0, nTabs ); - // Tiefe beibehalten ? (siehe Outliner::Insert) + // Keep depth? (see Outliner::Insert) if( !(pPara->nFlags & PARAFLAG_HOLDDEPTH) ) { nCurDepth = nTabs-1; @@ -467,7 +468,7 @@ void Outliner::SetText( const XubString& rText, Paragraph* pPara ) pPara->nFlags &= (~PARAFLAG_HOLDDEPTH); } } - if( nPos ) // nicht mit dem ersten Absatz + if( nPos ) // not with the first paragraph { pParaList->Insert( pPara, nInsPos ); pEditEngine->InsertParagraph( nInsPos, aStr ); @@ -479,26 +480,26 @@ void Outliner::SetText( const XubString& rText, Paragraph* pPara ) nInsPos--; pEditEngine->SetText( nInsPos, aStr ); } - ImplInitDepth( nInsPos, nCurDepth, FALSE ); + ImplInitDepth( nInsPos, nCurDepth, sal_False ); nInsPos++; nPos++; } } DBG_ASSERT(pParaList->GetParagraphCount()==pEditEngine->GetParagraphCount(),"SetText failed!"); - bFirstParaIsEmpty = FALSE; - ImplBlockInsertionCallbacks( FALSE ); + bFirstParaIsEmpty = sal_False; + ImplBlockInsertionCallbacks( sal_False ); pEditEngine->SetUpdateMode( bUpdate ); } -// pView == 0 -> Tabulatoren nicht beachten +// pView == 0 -> Ignore tabs bool Outliner::ImpConvertEdtToOut( sal_uInt32 nPara,EditView* pView) { DBG_CHKTHIS(Outliner,0); bool bConverted = false; - USHORT nTabs = 0; + sal_uInt16 nTabs = 0; ESelection aDelSel; // const SfxItemSet& rAttrs = pEditEngine->GetParaAttribs( (sal_uInt16)nPara ); @@ -508,16 +509,16 @@ bool Outliner::ImpConvertEdtToOut( sal_uInt32 nPara,EditView* pView) XubString aHeading_US( RTL_CONSTASCII_USTRINGPARAM( "heading" ) ); XubString aNumber_US( RTL_CONSTASCII_USTRINGPARAM( "Numbering" ) ); - XubString aStr( pEditEngine->GetText( (USHORT)nPara ) ); + XubString aStr( pEditEngine->GetText( (sal_uInt16)nPara ) ); xub_Unicode* pPtr = (xub_Unicode*)aStr.GetBuffer(); - USHORT nHeadingNumberStart = 0; - USHORT nNumberingNumberStart = 0; - SfxStyleSheet* pStyle= pEditEngine->GetStyleSheet( (USHORT)nPara ); + sal_uInt16 nHeadingNumberStart = 0; + sal_uInt16 nNumberingNumberStart = 0; + SfxStyleSheet* pStyle= pEditEngine->GetStyleSheet( (sal_uInt16)nPara ); if( pStyle ) { aName = pStyle->GetName(); - USHORT nSearch; + sal_uInt16 nSearch; if ( ( nSearch = aName.Search( aHeading_US ) ) != STRING_NOTFOUND ) nHeadingNumberStart = nSearch + aHeading_US.Len(); else if ( ( nSearch = aName.Search( aNumber_US ) ) != STRING_NOTFOUND ) @@ -526,33 +527,33 @@ bool Outliner::ImpConvertEdtToOut( sal_uInt32 nPara,EditView* pView) if ( nHeadingNumberStart || nNumberingNumberStart ) { - // PowerPoint-Import ? + // PowerPoint import ? if( nHeadingNumberStart && ( aStr.Len() >= 2 ) && ( pPtr[0] != '\t' ) && ( pPtr[1] == '\t' ) ) { - // Bullet & Tab raus - aDelSel = ESelection( (USHORT)nPara, 0, (USHORT)nPara, 2 ); + // Extract Bullet and Tab + aDelSel = ESelection( (sal_uInt16)nPara, 0, (sal_uInt16)nPara, 2 ); } - USHORT nPos = nHeadingNumberStart ? nHeadingNumberStart : nNumberingNumberStart; + sal_uInt16 nPos = nHeadingNumberStart ? nHeadingNumberStart : nNumberingNumberStart; String aLevel = aName.Copy( nPos ); aLevel.EraseLeadingChars( ' ' ); - nTabs = sal::static_int_cast< USHORT >(aLevel.ToInt32()); + nTabs = sal::static_int_cast< sal_uInt16 >(aLevel.ToInt32()); if( nTabs ) - nTabs--; // ebene 0 = "heading 1" - bConverted = TRUE; + nTabs--; // Level 0 = "heading 1" + bConverted = sal_True; } else { - // Fuehrende Tabulatoren filtern + // filter leading tabs while( *pPtr == '\t' ) { pPtr++; nTabs++; } - // Tabulatoren aus dem Text entfernen + // Remove tabs from the text if( nTabs ) - aDelSel = ESelection( (USHORT)nPara, 0, (USHORT)nPara, nTabs ); + aDelSel = ESelection( (sal_uInt16)nPara, 0, (sal_uInt16)nPara, nTabs ); } if ( aDelSel.HasRange() ) @@ -570,7 +571,7 @@ bool Outliner::ImpConvertEdtToOut( sal_uInt32 nPara,EditView* pView) sal_Int16 nOutlLevel = rLevel.GetValue(); ImplCheckDepth( nOutlLevel ); - ImplInitDepth( sal::static_int_cast< sal_uInt16 >(nPara), nOutlLevel, FALSE ); + ImplInitDepth( sal::static_int_cast< sal_uInt16 >(nPara), nOutlLevel, sal_False ); return bConverted; } @@ -579,40 +580,40 @@ void Outliner::SetText( const OutlinerParaObject& rPObj ) { DBG_CHKTHIS(Outliner,0); - BOOL bUpdate = pEditEngine->GetUpdateMode(); - pEditEngine->SetUpdateMode( FALSE ); + sal_Bool bUpdate = pEditEngine->GetUpdateMode(); + pEditEngine->SetUpdateMode( sal_False ); - BOOL bUndo = pEditEngine->IsUndoEnabled(); - EnableUndo( FALSE ); + sal_Bool bUndo = pEditEngine->IsUndoEnabled(); + EnableUndo( sal_False ); Init( rPObj.GetOutlinerMode() ); - ImplBlockInsertionCallbacks( TRUE ); + ImplBlockInsertionCallbacks( sal_True ); pEditEngine->SetText(rPObj.GetTextObject()); if( rPObj.Count() != pEditEngine->GetParagraphCount() ) { int nop=0;nop++; } - bFirstParaIsEmpty = FALSE; + bFirstParaIsEmpty = sal_False; - pParaList->Clear( TRUE ); - for( USHORT nCurPara = 0; nCurPara < rPObj.Count(); nCurPara++ ) + pParaList->Clear( sal_True ); + for( sal_uInt16 nCurPara = 0; nCurPara < rPObj.Count(); nCurPara++ ) { Paragraph* pPara = new Paragraph( rPObj.GetParagraphData(nCurPara)); ImplCheckDepth( pPara->nDepth ); - pParaList->Insert( pPara, LIST_APPEND ); + pParaList->Append(pPara); ImplCheckNumBulletItem( nCurPara ); } // #i100014# // It is not a good idea to substract 1 from a count and cast the result // to USHORT without check, if the count is 0. - ImplCheckParagraphs( 0, (USHORT) (pParaList->GetParagraphCount()) ); + ImplCheckParagraphs( 0, (sal_uInt16) (pParaList->GetParagraphCount()) ); EnableUndo( bUndo ); - ImplBlockInsertionCallbacks( FALSE ); + ImplBlockInsertionCallbacks( sal_False ); pEditEngine->SetUpdateMode( bUpdate ); DBG_ASSERT( pParaList->GetParagraphCount()==rPObj.Count(),"SetText failed"); @@ -624,14 +625,14 @@ void Outliner::AddText( const OutlinerParaObject& rPObj ) DBG_CHKTHIS(Outliner,0); Paragraph* pPara; - BOOL bUpdate = pEditEngine->GetUpdateMode(); - pEditEngine->SetUpdateMode( FALSE ); + sal_Bool bUpdate = pEditEngine->GetUpdateMode(); + pEditEngine->SetUpdateMode( sal_False ); - ImplBlockInsertionCallbacks( TRUE ); - ULONG nPara; + ImplBlockInsertionCallbacks( sal_True ); + sal_uLong nPara; if( bFirstParaIsEmpty ) { - pParaList->Clear( TRUE ); + pParaList->Clear( sal_True ); pEditEngine->SetText(rPObj.GetTextObject()); nPara = 0; } @@ -640,60 +641,60 @@ void Outliner::AddText( const OutlinerParaObject& rPObj ) nPara = pParaList->GetParagraphCount(); pEditEngine->InsertParagraph( EE_PARA_APPEND, rPObj.GetTextObject() ); } - bFirstParaIsEmpty = FALSE; + bFirstParaIsEmpty = sal_False; - for( USHORT n = 0; n < rPObj.Count(); n++ ) + for( sal_uInt16 n = 0; n < rPObj.Count(); n++ ) { pPara = new Paragraph( rPObj.GetParagraphData(n) ); - pParaList->Insert( pPara, LIST_APPEND ); - USHORT nP = sal::static_int_cast< USHORT >(nPara+n); + pParaList->Append(pPara); + sal_uInt16 nP = sal::static_int_cast< sal_uInt16 >(nPara+n); DBG_ASSERT(pParaList->GetAbsPos(pPara)==nP,"AddText:Out of sync"); - ImplInitDepth( nP, pPara->GetDepth(), FALSE ); + ImplInitDepth( nP, pPara->GetDepth(), sal_False ); } DBG_ASSERT( pEditEngine->GetParagraphCount()==pParaList->GetParagraphCount(), "SetText: OutOfSync" ); // #i100014# // It is not a good idea to substract 1 from a count and cast the result // to USHORT without check, if the count is 0. - ImplCheckParagraphs( (USHORT)nPara, (USHORT) (pParaList->GetParagraphCount()) ); + ImplCheckParagraphs( (sal_uInt16)nPara, (sal_uInt16) (pParaList->GetParagraphCount()) ); - ImplBlockInsertionCallbacks( FALSE ); + ImplBlockInsertionCallbacks( sal_False ); pEditEngine->SetUpdateMode( bUpdate ); } -void __EXPORT Outliner::FieldClicked( const SvxFieldItem& rField, USHORT nPara, USHORT nPos ) +void Outliner::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos ) { DBG_CHKTHIS(Outliner,0); if ( aFieldClickedHdl.IsSet() ) { EditFieldInfo aFldInfo( this, rField, nPara, nPos ); - aFldInfo.SetSimpleClick( TRUE ); + aFldInfo.SetSimpleClick( sal_True ); aFieldClickedHdl.Call( &aFldInfo ); } } -void __EXPORT Outliner::FieldSelected( const SvxFieldItem& rField, USHORT nPara, USHORT nPos ) +void Outliner::FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos ) { DBG_CHKTHIS(Outliner,0); if ( !aFieldClickedHdl.IsSet() ) return; EditFieldInfo aFldInfo( this, rField, nPara, nPos ); - aFldInfo.SetSimpleClick( FALSE ); + aFldInfo.SetSimpleClick( sal_False ); aFieldClickedHdl.Call( &aFldInfo ); } -XubString __EXPORT Outliner::CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ) +XubString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) { DBG_CHKTHIS(Outliner,0); if ( !aCalcFieldValueHdl.IsSet() ) return String( ' ' ); EditFieldInfo aFldInfo( this, rField, nPara, nPos ); - // Die FldColor ist mit COL_LIGHTGRAY voreingestellt. + // The FldColor is preset with COL_LIGHTGRAY. if ( rpFldColor ) aFldInfo.SetFldColor( *rpFldColor ); @@ -710,19 +711,19 @@ XubString __EXPORT Outliner::CalcFieldValue( const SvxFieldItem& rField, USHORT return aFldInfo.GetRepresentation(); } -void Outliner::SetStyleSheet( ULONG nPara, SfxStyleSheet* pStyle ) +void Outliner::SetStyleSheet( sal_uLong nPara, SfxStyleSheet* pStyle ) { DBG_CHKTHIS(Outliner,0); Paragraph* pPara = pParaList->GetParagraph( nPara ); if (pPara) { - pEditEngine->SetStyleSheet( (USHORT)nPara, pStyle ); + pEditEngine->SetStyleSheet( (sal_uInt16)nPara, pStyle ); pPara->nFlags |= PARAFLAG_SETBULLETTEXT; - ImplCheckNumBulletItem( (USHORT) nPara ); + ImplCheckNumBulletItem( (sal_uInt16) nPara ); } } -void Outliner::SetVisible( Paragraph* pPara, BOOL bVisible ) +void Outliner::SetVisible( Paragraph* pPara, sal_Bool bVisible ) { DBG_CHKTHIS(Outliner,0); DBG_ASSERT( pPara, "SetVisible: pPara = NULL" ); @@ -730,19 +731,19 @@ void Outliner::SetVisible( Paragraph* pPara, BOOL bVisible ) if (pPara) { pPara->bVisible = bVisible; - ULONG nPara = pParaList->GetAbsPos( pPara ); - pEditEngine->ShowParagraph( (USHORT)nPara, bVisible ); + sal_uLong nPara = pParaList->GetAbsPos( pPara ); + pEditEngine->ShowParagraph( (sal_uInt16)nPara, bVisible ); } } -void Outliner::ImplCheckNumBulletItem( USHORT nPara ) +void Outliner::ImplCheckNumBulletItem( sal_uInt16 nPara ) { Paragraph* pPara = pParaList->GetParagraph( nPara ); if (pPara) pPara->aBulSize.Width() = -1; } -void Outliner::ImplSetLevelDependendStyleSheet( USHORT nPara, SfxStyleSheet* pLevelStyle ) +void Outliner::ImplSetLevelDependendStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pLevelStyle ) { DBG_CHKTHIS(Outliner,0); @@ -777,7 +778,7 @@ void Outliner::ImplSetLevelDependendStyleSheet( USHORT nPara, SfxStyleSheet* pLe } } -void Outliner::ImplInitDepth( USHORT nPara, sal_Int16 nDepth, BOOL bCreateUndo, BOOL bUndoAction ) +void Outliner::ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction ) { DBG_CHKTHIS(Outliner,0); @@ -789,15 +790,14 @@ void Outliner::ImplInitDepth( USHORT nPara, sal_Int16 nDepth, BOOL bCreateUndo, sal_Int16 nOldDepth = pPara->GetDepth(); pPara->SetDepth( nDepth ); - // Bei IsInUndo brauchen Attribute und Style nicht eingestellt werden, - // dort werden die alten Werte durch die EditEngine restauriert. - + // For IsInUndo attributes and style do not have to be set, there + // the old values are restored by the EditEngine. if( !IsInUndo() ) { - BOOL bUpdate = pEditEngine->GetUpdateMode(); - pEditEngine->SetUpdateMode( FALSE ); + sal_Bool bUpdate = pEditEngine->GetUpdateMode(); + pEditEngine->SetUpdateMode( sal_False ); - BOOL bUndo = bCreateUndo && IsUndoEnabled(); + sal_Bool bUndo = bCreateUndo && IsUndoEnabled(); if ( bUndo && bUndoAction ) UndoActionStart( OLUNDO_DEPTH ); @@ -805,7 +805,7 @@ void Outliner::ImplInitDepth( USHORT nPara, sal_Int16 nDepth, BOOL bCreateUndo, aAttrs.Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nDepth ) ); pEditEngine->SetParaAttribs( nPara, aAttrs ); ImplCheckNumBulletItem( nPara ); - ImplCalcBulletText( nPara, FALSE, FALSE ); + ImplCalcBulletText( nPara, sal_False, sal_False ); if ( bUndo ) { @@ -818,30 +818,30 @@ void Outliner::ImplInitDepth( USHORT nPara, sal_Int16 nDepth, BOOL bCreateUndo, } } -void Outliner::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) +void Outliner::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetParaAttribs( nPara, rSet ); } -BOOL Outliner::Expand( Paragraph* pPara ) +sal_Bool Outliner::Expand( Paragraph* pPara ) { DBG_CHKTHIS(Outliner,0); if ( pParaList->HasHiddenChilds( pPara ) ) { OLUndoExpand* pUndo = 0; - BOOL bUndo = IsUndoEnabled() && !IsInUndo(); + sal_Bool bUndo = IsUndoEnabled() && !IsInUndo(); if( bUndo ) { UndoActionStart( OLUNDO_EXPAND ); pUndo = new OLUndoExpand( this, OLUNDO_EXPAND ); pUndo->pParas = 0; - pUndo->nCount = (USHORT)pParaList->GetAbsPos( pPara ); + pUndo->nCount = (sal_uInt16)pParaList->GetAbsPos( pPara ); } pHdlParagraph = pPara; - bIsExpanding = TRUE; + bIsExpanding = sal_True; pParaList->Expand( pPara ); ExpandHdl(); InvalidateBullet( pPara, pParaList->GetAbsPos(pPara) ); @@ -850,32 +850,32 @@ BOOL Outliner::Expand( Paragraph* pPara ) InsertUndo( pUndo ); UndoActionEnd( OLUNDO_EXPAND ); } - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -BOOL Outliner::Collapse( Paragraph* pPara ) +sal_Bool Outliner::Collapse( Paragraph* pPara ) { DBG_CHKTHIS(Outliner,0); - if ( pParaList->HasVisibleChilds( pPara ) ) // expandiert + if ( pParaList->HasVisibleChilds( pPara ) ) // expanded { OLUndoExpand* pUndo = 0; - BOOL bUndo = FALSE; + sal_Bool bUndo = sal_False; if( !IsInUndo() && IsUndoEnabled() ) - bUndo = TRUE; + bUndo = sal_True; if( bUndo ) { UndoActionStart( OLUNDO_COLLAPSE ); pUndo = new OLUndoExpand( this, OLUNDO_COLLAPSE ); pUndo->pParas = 0; - pUndo->nCount = (USHORT)pParaList->GetAbsPos( pPara ); + pUndo->nCount = (sal_uInt16)pParaList->GetAbsPos( pPara ); } pHdlParagraph = pPara; - bIsExpanding = FALSE; + bIsExpanding = sal_False; pParaList->Collapse( pPara ); ExpandHdl(); InvalidateBullet( pPara, pParaList->GetAbsPos(pPara) ); @@ -884,18 +884,18 @@ BOOL Outliner::Collapse( Paragraph* pPara ) InsertUndo( pUndo ); UndoActionEnd( OLUNDO_COLLAPSE ); } - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -Font Outliner::ImpCalcBulletFont( USHORT nPara ) const +Font Outliner::ImpCalcBulletFont( sal_uInt16 nPara ) const { const SvxNumberFormat* pFmt = GetNumberFormat( nPara ); DBG_ASSERT( pFmt && ( pFmt->GetNumberingType() != SVX_NUM_BITMAP ) && ( pFmt->GetNumberingType() != SVX_NUM_NUMBER_NONE ), "ImpCalcBulletFont: Missing or BitmapBullet!" ); - Font aStdFont; //#107508# + Font aStdFont; if ( !pEditEngine->IsFlatMode() ) { ESelection aSel( nPara, 0, nPara, 0 ); @@ -921,18 +921,18 @@ Font Outliner::ImpCalcBulletFont( USHORT nPara ) const aBulletFont.SetRelief( RELIEF_NONE ); } - // #107508# Use original scale... - USHORT nStretchX, nStretchY; + // Use original scale... + sal_uInt16 nStretchX, nStretchY; const_cast<Outliner*>(this)->GetGlobalCharStretching(nStretchX, nStretchY); - USHORT nScale = pFmt->GetBulletRelSize() * nStretchY / 100; - ULONG nScaledLineHeight = aStdFont.GetSize().Height(); + sal_uInt16 nScale = pFmt->GetBulletRelSize() * nStretchY / 100; + sal_uLong nScaledLineHeight = aStdFont.GetSize().Height(); nScaledLineHeight *= nScale*10; nScaledLineHeight /= 1000; aBulletFont.SetAlign( ALIGN_BOTTOM ); aBulletFont.SetSize( Size( 0, nScaledLineHeight ) ); - BOOL bVertical = IsVertical(); + sal_Bool bVertical = IsVertical(); aBulletFont.SetVertical( bVertical ); aBulletFont.SetOrientation( bVertical ? 2700 : 0 ); @@ -949,7 +949,7 @@ Font Outliner::ImpCalcBulletFont( USHORT nPara ) const return aBulletFont; } -void Outliner::PaintBullet( USHORT nPara, const Point& rStartPos, +void Outliner::PaintBullet( sal_uInt16 nPara, const Point& rStartPos, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) { DBG_CHKTHIS(Outliner,0); @@ -963,12 +963,12 @@ void Outliner::PaintBullet( USHORT nPara, const Point& rStartPos, if ( ImplHasBullet( nPara ) && bDrawBullet) { - BOOL bVertical = IsVertical(); + sal_Bool bVertical = IsVertical(); - BOOL bRightToLeftPara = pEditEngine->IsRightToLeft( nPara ); + sal_Bool bRightToLeftPara = pEditEngine->IsRightToLeft( nPara ); - Rectangle aBulletArea( ImpCalcBulletArea( nPara, TRUE, FALSE ) ); - USHORT nStretchX, nStretchY; + Rectangle aBulletArea( ImpCalcBulletArea( nPara, sal_True, sal_False ) ); + sal_uInt16 nStretchX, nStretchY; GetGlobalCharStretching(nStretchX, nStretchY); aBulletArea = Rectangle( Point(aBulletArea.Left()*nStretchX/100, aBulletArea.Top()), @@ -982,8 +982,8 @@ void Outliner::PaintBullet( USHORT nPara, const Point& rStartPos, if( pFmt->GetNumberingType() != SVX_NUM_BITMAP ) { Font aBulletFont( ImpCalcBulletFont( nPara ) ); - // #2338# Use base line - BOOL bSymbol = pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL; + // Use baseline + sal_Bool bSymbol = pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL; aBulletFont.SetAlign( bSymbol ? ALIGN_BOTTOM : ALIGN_BASELINE ); Font aOldFont = pOutDev->GetFont(); pOutDev->SetFont( aBulletFont ); @@ -1008,8 +1008,8 @@ void Outliner::PaintBullet( USHORT nPara, const Point& rStartPos, if ( nOrientation ) { - // Sowohl TopLeft als auch BottomLeft nicht ganz richtig, da - // in EditEngine BaseLine... + // Both TopLeft and bottom left is not quite correct, + // since in EditEngine baseline ... double nRealOrientation = nOrientation*F_PI1800; double nCos = cos( nRealOrientation ); double nSin = sin( nRealOrientation ); @@ -1027,8 +1027,8 @@ void Outliner::PaintBullet( USHORT nPara, const Point& rStartPos, pOutDev->SetFont( aRotatedFont ); } - // #105803# VCL will care for brackets and so on... - ULONG nLayoutMode = pOutDev->GetLayoutMode(); + // VCL will take care of brackets and so on... + sal_uLong nLayoutMode = pOutDev->GetLayoutMode(); nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG); if ( bRightToLeftPara ) nLayoutMode |= TEXT_LAYOUT_BIDI_RTL; @@ -1096,14 +1096,14 @@ void Outliner::PaintBullet( USHORT nPara, const Point& rStartPos, } else { - // MT: Remove CAST when KA made the Draw-Method const + // Remove CAST when KA made the Draw-Method const ((GraphicObject*)pFmt->GetBrush()->GetGraphicObject())->Draw( pOutDev, aBulletPos, pPara->aBulSize ); } } } } - // Bei zusammengeklappten Absaetzen einen Strich vor den Text malen. + // In case of collapsed subparagraphs paint a line before the text. if( pParaList->HasChilds(pPara) && !pParaList->HasVisibleChilds(pPara) && !bStrippingPortions && !nOrientation ) { @@ -1136,15 +1136,15 @@ void Outliner::PaintBullet( USHORT nPara, const Point& rStartPos, } } -void Outliner::InvalidateBullet( Paragraph* /*pPara*/, ULONG nPara ) +void Outliner::InvalidateBullet( Paragraph* /*pPara*/, sal_uLong nPara ) { DBG_CHKTHIS(Outliner,0); - long nLineHeight = (long)pEditEngine->GetLineHeight((USHORT)nPara ); - OutlinerView* pView = aViewList.First(); - while( pView ) + long nLineHeight = (long)pEditEngine->GetLineHeight((sal_uInt16)nPara ); + for ( size_t i = 0, n = aViewList.size(); i < n; ++i ) { - Point aPos( pView->pEditView->GetWindowPosTopLeft((USHORT)nPara ) ); + OutlinerView* pView = aViewList[ i ]; + Point aPos( pView->pEditView->GetWindowPosTopLeft((sal_uInt16)nPara ) ); Rectangle aRect( pView->GetOutputArea() ); aRect.Right() = aPos.X(); aRect.Top() = aPos.Y(); @@ -1152,41 +1152,40 @@ void Outliner::InvalidateBullet( Paragraph* /*pPara*/, ULONG nPara ) aRect.Bottom() += nLineHeight; pView->GetWindow()->Invalidate( aRect ); - pView = aViewList.Next(); } } -ULONG Outliner::Read( SvStream& rInput, const String& rBaseURL, USHORT eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ) +sal_uLong Outliner::Read( SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ) { DBG_CHKTHIS(Outliner,0); - BOOL bOldUndo = pEditEngine->IsUndoEnabled(); - EnableUndo( FALSE ); + sal_Bool bOldUndo = pEditEngine->IsUndoEnabled(); + EnableUndo( sal_False ); - BOOL bUpdate = pEditEngine->GetUpdateMode(); - pEditEngine->SetUpdateMode( FALSE ); + sal_Bool bUpdate = pEditEngine->GetUpdateMode(); + pEditEngine->SetUpdateMode( sal_False ); Clear(); - ImplBlockInsertionCallbacks( TRUE ); - ULONG nRet = pEditEngine->Read( rInput, rBaseURL, (EETextFormat)eFormat, pHTTPHeaderAttrs ); + ImplBlockInsertionCallbacks( sal_True ); + sal_uLong nRet = pEditEngine->Read( rInput, rBaseURL, (EETextFormat)eFormat, pHTTPHeaderAttrs ); - bFirstParaIsEmpty = FALSE; + bFirstParaIsEmpty = sal_False; - USHORT nParas = pEditEngine->GetParagraphCount(); - pParaList->Clear( TRUE ); - USHORT n; + sal_uInt16 nParas = pEditEngine->GetParagraphCount(); + pParaList->Clear( sal_True ); + sal_uInt16 n; for ( n = 0; n < nParas; n++ ) { Paragraph* pPara = new Paragraph( 0 ); - pParaList->Insert( pPara, LIST_APPEND ); + pParaList->Append(pPara); if ( eFormat == EE_FORMAT_BIN ) { const SfxItemSet& rAttrs = pEditEngine->GetParaAttribs( n ); const SfxInt16Item& rLevel = (const SfxInt16Item&) rAttrs.Get( EE_PARA_OUTLLEVEL ); sal_Int16 nDepth = rLevel.GetValue(); - ImplInitDepth( n, nDepth, FALSE ); + ImplInitDepth( n, nDepth, sal_False ); } } @@ -1195,7 +1194,7 @@ ULONG Outliner::Read( SvStream& rInput, const String& rBaseURL, USHORT eFormat, ImpFilterIndents( 0, nParas-1 ); } - ImplBlockInsertionCallbacks( FALSE ); + ImplBlockInsertionCallbacks( sal_False ); pEditEngine->SetUpdateMode( bUpdate ); EnableUndo( bOldUndo ); @@ -1203,15 +1202,15 @@ ULONG Outliner::Read( SvStream& rInput, const String& rBaseURL, USHORT eFormat, } -void Outliner::ImpFilterIndents( ULONG nFirstPara, ULONG nLastPara ) +void Outliner::ImpFilterIndents( sal_uLong nFirstPara, sal_uLong nLastPara ) { DBG_CHKTHIS(Outliner,0); - BOOL bUpdate = pEditEngine->GetUpdateMode(); - pEditEngine->SetUpdateMode( FALSE ); + sal_Bool bUpdate = pEditEngine->GetUpdateMode(); + pEditEngine->SetUpdateMode( sal_False ); Paragraph* pLastConverted = NULL; - for( ULONG nPara = nFirstPara; nPara <= nLastPara; nPara++ ) + for( sal_uLong nPara = nFirstPara; nPara <= nLastPara; nPara++ ) { Paragraph* pPara = pParaList->GetParagraph( nPara ); if (pPara) @@ -1222,35 +1221,33 @@ void Outliner::ImpFilterIndents( ULONG nFirstPara, ULONG nLastPara ) } else if ( pLastConverted ) { - // Normale Absaetze unter der Ueberschrift anordnen... + // Arrange normal paragraphs below the heading ... pPara->SetDepth( pLastConverted->GetDepth() ); } - ImplInitDepth( (USHORT)nPara, pPara->GetDepth(), FALSE ); + ImplInitDepth( (sal_uInt16)nPara, pPara->GetDepth(), sal_False ); } } pEditEngine->SetUpdateMode( bUpdate ); } -SfxUndoManager& Outliner::GetUndoManager() +::svl::IUndoManager& Outliner::GetUndoManager() { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetUndoManager(); } -void Outliner::ImpTextPasted( ULONG nStartPara, USHORT nCount ) +void Outliner::ImpTextPasted( sal_uLong nStartPara, sal_uInt16 nCount ) { DBG_CHKTHIS(Outliner,0); - BOOL bUpdate = pEditEngine->GetUpdateMode(); - pEditEngine->SetUpdateMode( FALSE ); + sal_Bool bUpdate = pEditEngine->GetUpdateMode(); + pEditEngine->SetUpdateMode( sal_False ); - const ULONG nStart = nStartPara; + const sal_uLong nStart = nStartPara; Paragraph* pPara = pParaList->GetParagraph( nStartPara ); -// Paragraph* pLastConverted = NULL; -// bool bFirst = true; while( nCount && pPara ) { @@ -1270,17 +1267,17 @@ void Outliner::ImpTextPasted( ULONG nStartPara, USHORT nCount ) DepthChangedHdl(); } } - else // EditEngine-Modus + else // EditEngine mode { sal_Int16 nDepth = -1; - const SfxItemSet& rAttrs = pEditEngine->GetParaAttribs( (USHORT)nStartPara ); + const SfxItemSet& rAttrs = pEditEngine->GetParaAttribs( (sal_uInt16)nStartPara ); if ( rAttrs.GetItemState( EE_PARA_OUTLLEVEL ) == SFX_ITEM_ON ) { const SfxInt16Item& rLevel = (const SfxInt16Item&) rAttrs.Get( EE_PARA_OUTLLEVEL ); nDepth = rLevel.GetValue(); } if ( nDepth != GetDepth( nStartPara ) ) - ImplInitDepth( (USHORT)nStartPara, nDepth, FALSE ); + ImplInitDepth( (sal_uInt16)nStartPara, nDepth, sal_False ); } nCount--; @@ -1301,51 +1298,51 @@ long Outliner::IndentingPagesHdl( OutlinerView* pView ) return aIndentingPagesHdl.Call( pView ); } -BOOL Outliner::ImpCanIndentSelectedPages( OutlinerView* pCurView ) +sal_Bool Outliner::ImpCanIndentSelectedPages( OutlinerView* pCurView ) { DBG_CHKTHIS(Outliner,0); - // Die selektierten Seiten muessen vorher durch ImpCalcSelectedPages - // schon eingestellt sein + // The selected pages must already be set in advance through + // ImpCalcSelectedPages - // Wenn der erste Absatz auf Ebene 0 liegt darf er auf keinen Fall - // eingerueckt werden, evtl folgen aber weitere auf Ebene 0. + // If the first paragraph is on level 0 it can not indented in any case, + // possible there might be indentations in the following on the 0 level. if ( ( mnFirstSelPage == 0 ) && ( ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ) ) { - if ( nDepthChangedHdlPrevDepth == 1 ) // ist die einzige Seite - return FALSE; + if ( nDepthChangedHdlPrevDepth == 1 ) // is the only page + return sal_False; else - pCurView->ImpCalcSelectedPages( FALSE ); // ohne die erste + pCurView->ImpCalcSelectedPages( sal_False ); // without the first } - return (BOOL)IndentingPagesHdl( pCurView ); + return (sal_Bool)IndentingPagesHdl( pCurView ); } -BOOL Outliner::ImpCanDeleteSelectedPages( OutlinerView* pCurView ) +sal_Bool Outliner::ImpCanDeleteSelectedPages( OutlinerView* pCurView ) { DBG_CHKTHIS(Outliner,0); - // Die selektierten Seiten muessen vorher durch ImpCalcSelectedPages - // schon eingestellt sein - return (BOOL)RemovingPagesHdl( pCurView ); + // The selected pages must already be set in advance through + // ImpCalcSelectedPages + return (sal_Bool)RemovingPagesHdl( pCurView ); } -Outliner::Outliner( SfxItemPool* pPool, USHORT nMode ) +Outliner::Outliner( SfxItemPool* pPool, sal_uInt16 nMode ) : nMinDepth( -1 ) { DBG_CTOR( Outliner, 0 ); - bStrippingPortions = FALSE; - bPasting = FALSE; + bStrippingPortions = sal_False; + bPasting = sal_False; nFirstPage = 1; - bBlockInsCallback = FALSE; + bBlockInsCallback = sal_False; nMaxDepth = 9; pParaList = new ParagraphList; pParaList->SetVisibleStateChangedHdl( LINK( this, Outliner, ParaVisibleStateChangedHdl ) ); Paragraph* pPara = new Paragraph( 0 ); - pParaList->Insert( pPara, LIST_APPEND ); - bFirstParaIsEmpty = TRUE; + pParaList->Append(pPara); + bFirstParaIsEmpty = sal_True; pEditEngine = new OutlinerEditEng( this, pPool ); pEditEngine->SetBeginMovingParagraphsHdl( LINK( this, Outliner, BeginMovingParagraphsHdl ) ); @@ -1360,57 +1357,77 @@ Outliner::~Outliner() { DBG_DTOR(Outliner,0); - pParaList->Clear( TRUE ); + pParaList->Clear( sal_True ); delete pParaList; delete pEditEngine; } -ULONG Outliner::InsertView( OutlinerView* pView, ULONG nIndex ) +size_t Outliner::InsertView( OutlinerView* pView, size_t nIndex ) { DBG_CHKTHIS(Outliner,0); + size_t ActualIndex; - aViewList.Insert( pView, nIndex ); - pEditEngine->InsertView( pView->pEditView, (USHORT)nIndex ); - return aViewList.GetPos( pView ); + if ( nIndex >= aViewList.size() ) + { + aViewList.push_back( pView ); + ActualIndex = aViewList.size() - 1; + } + else + { + ViewList::iterator it = aViewList.begin(); + advance( it, nIndex ); + ActualIndex = nIndex; + } + pEditEngine->InsertView( pView->pEditView, (sal_uInt16)nIndex ); + return ActualIndex; } OutlinerView* Outliner::RemoveView( OutlinerView* pView ) { DBG_CHKTHIS(Outliner,0); - ULONG nPos = aViewList.GetPos( pView ); - if ( nPos != LIST_ENTRY_NOTFOUND ) + for ( ViewList::iterator it = aViewList.begin(); it < aViewList.end(); ++it ) { - pView->pEditView->HideCursor(); // HACK wg. BugId 10006 - pEditEngine->RemoveView( pView->pEditView ); - aViewList.Remove( nPos ); + if ( *it == pView ) + { + pView->pEditView->HideCursor(); // HACK + pEditEngine->RemoveView( pView->pEditView ); + aViewList.erase( it ); + break; + } } - return NULL; // MT: return ueberfluessig + return NULL; // return superfluous } -OutlinerView* Outliner::RemoveView( ULONG nIndex ) +OutlinerView* Outliner::RemoveView( size_t nIndex ) { DBG_CHKTHIS(Outliner,0); - EditView* pEditView = pEditEngine->GetView( (USHORT)nIndex ); - pEditView->HideCursor(); // HACK wg. BugId 10006 + EditView* pEditView = pEditEngine->GetView( (sal_uInt16)nIndex ); + pEditView->HideCursor(); // HACK + + pEditEngine->RemoveView( (sal_uInt16)nIndex ); + + { + ViewList::iterator it = aViewList.begin(); + advance( it, nIndex ); + aViewList.erase( it ); + } - pEditEngine->RemoveView( (USHORT)nIndex ); - aViewList.Remove( nIndex ); - return NULL; // MT: return ueberfluessig + return NULL; // return superfluous } -OutlinerView* Outliner::GetView( ULONG nIndex ) const +OutlinerView* Outliner::GetView( size_t nIndex ) const { DBG_CHKTHIS(Outliner,0); - return aViewList.GetObject( nIndex ); + return ( nIndex >= aViewList.size() ) ? NULL : aViewList[ nIndex ]; } -ULONG Outliner::GetViewCount() const +size_t Outliner::GetViewCount() const { DBG_CHKTHIS(Outliner,0); - return aViewList.Count(); + return aViewList.size(); } void Outliner::ParagraphInsertedHdl() @@ -1437,37 +1454,37 @@ void Outliner::DepthChangedHdl() } -ULONG Outliner::GetAbsPos( Paragraph* pPara ) +sal_uLong Outliner::GetAbsPos( Paragraph* pPara ) { DBG_CHKTHIS(Outliner,0); DBG_ASSERT(pPara,"GetAbsPos:No Para"); return pParaList->GetAbsPos( pPara ); } -ULONG Outliner::GetParagraphCount() const +sal_uLong Outliner::GetParagraphCount() const { DBG_CHKTHIS(Outliner,0); return pParaList->GetParagraphCount(); } -Paragraph* Outliner::GetParagraph( ULONG nAbsPos ) const +Paragraph* Outliner::GetParagraph( sal_uLong nAbsPos ) const { DBG_CHKTHIS(Outliner,0); return pParaList->GetParagraph( nAbsPos ); } -BOOL Outliner::HasChilds( Paragraph* pParagraph ) const +sal_Bool Outliner::HasChilds( Paragraph* pParagraph ) const { DBG_CHKTHIS(Outliner,0); return pParaList->HasChilds( pParagraph ); } -BOOL Outliner::ImplHasBullet( USHORT nPara ) const +sal_Bool Outliner::ImplHasBullet( sal_uInt16 nPara ) const { return GetNumberFormat(nPara) != 0; } -const SvxNumberFormat* Outliner::GetNumberFormat( USHORT nPara ) const +const SvxNumberFormat* Outliner::GetNumberFormat( sal_uInt16 nPara ) const { const SvxNumberFormat* pFmt = NULL; @@ -1487,7 +1504,7 @@ const SvxNumberFormat* Outliner::GetNumberFormat( USHORT nPara ) const return pFmt; } -Size Outliner::ImplGetBulletSize( USHORT nPara ) +Size Outliner::ImplGetBulletSize( sal_uInt16 nPara ) { Paragraph* pPara = pParaList->GetParagraph( nPara ); if (!pPara) @@ -1522,19 +1539,19 @@ Size Outliner::ImplGetBulletSize( USHORT nPara ) return pPara->aBulSize; } -void Outliner::ImplCheckParagraphs( USHORT nStart, USHORT nEnd ) +void Outliner::ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd ) { DBG_CHKTHIS( Outliner, 0 ); // i100014# // assure that the following for-loop does not loop forever - for ( USHORT n = nStart; n < nEnd; n++ ) + for ( sal_uInt16 n = nStart; n < nEnd; n++ ) { Paragraph* pPara = pParaList->GetParagraph( n ); if (pPara) { pPara->Invalidate(); - ImplCalcBulletText( n, FALSE, FALSE ); + ImplCalcBulletText( n, sal_False, sal_False ); } } } @@ -1543,22 +1560,21 @@ void Outliner::SetRefDevice( OutputDevice* pRefDev ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetRefDevice( pRefDev ); - for ( USHORT n = (USHORT) pParaList->GetParagraphCount(); n; ) + for ( sal_uInt16 n = (sal_uInt16) pParaList->GetParagraphCount(); n; ) { Paragraph* pPara = pParaList->GetParagraph( --n ); pPara->Invalidate(); } } -void Outliner::ParaAttribsChanged( USHORT nPara ) +void Outliner::ParaAttribsChanged( sal_uInt16 nPara ) { DBG_CHKTHIS(Outliner,0); - // Der Outliner hat kein eigenes Undo, wenn Absaetz getrennt/verschmolzen werden. - // Beim ParagraphInserted ist das Attribut EE_PARA_OUTLLEVEL - // ggf. noch nicht eingestellt, dies wird aber benoetigt um die Tiefe - // des Absatzes zu bestimmen. - + // The Outliner does not have an undo of its own, when paragraphs are + // separated/merged. When ParagraphInserted the attribute EE_PARA_OUTLLEVEL + // may not be set, this is however needed when the depth of the paragraph + // is to be determined. if( pEditEngine->IsInUndo() ) { if ( pParaList->GetParagraphCount() == pEditEngine->GetParagraphCount() ) @@ -1568,7 +1584,7 @@ void Outliner::ParaAttribsChanged( USHORT nPara ) if ( pPara && pPara->GetDepth() != rLevel.GetValue() ) { pPara->SetDepth( rLevel.GetValue() ); - ImplCalcBulletText( nPara, TRUE, TRUE ); + ImplCalcBulletText( nPara, sal_True, sal_True ); } } } @@ -1578,28 +1594,27 @@ void Outliner::StyleSheetChanged( SfxStyleSheet* pStyle ) { DBG_CHKTHIS(Outliner,0); - // Die EditEngine ruft StyleSheetChanged auch fuer abgeleitete Styles. - // MT: Hier wurde frueher alle Absaetze durch ein ImpRecalcParaAttribs - // gejagt, die die besagte Vorlage haben, warum? - // => Eigentlich kann sich nur die Bullet-Repraesentation aendern... - - USHORT nParas = (USHORT)pParaList->GetParagraphCount(); - for( USHORT nPara = 0; nPara < nParas; nPara++ ) + // The EditEngine calls StyleSheetChanged also for derived styles. + // Here all the paragraphs, which had the said template, used to be + // hunted by a ImpRecalcParaAttribs, why? + // => only the Bullet-representation can really change... + sal_uInt16 nParas = (sal_uInt16)pParaList->GetParagraphCount(); + for( sal_uInt16 nPara = 0; nPara < nParas; nPara++ ) { if ( pEditEngine->GetStyleSheet( nPara ) == pStyle ) { ImplCheckNumBulletItem( nPara ); - ImplCalcBulletText( nPara, FALSE, FALSE ); - // #97333# EditEngine formats changed paragraphs before calling this method, + ImplCalcBulletText( nPara, sal_False, sal_False ); + // EditEngine formats changed paragraphs before calling this method, // so they are not reformatted now and use wrong bullet indent pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) ); } } } -Rectangle Outliner::ImpCalcBulletArea( USHORT nPara, BOOL bAdjust, BOOL bReturnPaperPos ) +Rectangle Outliner::ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_Bool bReturnPaperPos ) { - // Bullet-Bereich innerhalb des Absatzes... + // Bullet area within the paragraph ... Rectangle aBulletArea; const SvxNumberFormat* pFmt = GetNumberFormat( nPara ); @@ -1608,7 +1623,7 @@ Rectangle Outliner::ImpCalcBulletArea( USHORT nPara, BOOL bAdjust, BOOL bReturnP Point aTopLeft; Size aBulletSize( ImplGetBulletSize( nPara ) ); - BOOL bOutlineMode = ( pEditEngine->GetControlWord() & EE_CNTRL_OUTLINER ) != 0; + sal_Bool bOutlineMode = ( pEditEngine->GetControlWord() & EE_CNTRL_OUTLINER ) != 0; // the ODF attribut text:space-before which holds the spacing to add to the left of the label const short nSpaceBefore = pFmt->GetAbsLSpace() + pFmt->GetFirstLineOffset(); @@ -1617,12 +1632,12 @@ Rectangle Outliner::ImpCalcBulletArea( USHORT nPara, BOOL bAdjust, BOOL bReturnP aTopLeft.X() = rLR.GetTxtLeft() + rLR.GetTxtFirstLineOfst() + nSpaceBefore; long nBulletWidth = Max( (long) -rLR.GetTxtFirstLineOfst(), (long) ((-pFmt->GetFirstLineOffset()) + pFmt->GetCharTextDistance()) ); - if ( nBulletWidth < aBulletSize.Width() ) // Bullet macht sich Platz + if ( nBulletWidth < aBulletSize.Width() ) // The Bullet creates its space nBulletWidth = aBulletSize.Width(); if ( bAdjust && !bOutlineMode ) { - // Bei zentriert/rechtsbuendig anpassen + // Adjust when centered or align right const SvxAdjustItem& rItem = (const SvxAdjustItem&)pEditEngine->GetParaAttrib( nPara, EE_PARA_JUST ); if ( ( !pEditEngine->IsRightToLeft( nPara ) && ( rItem.GetAdjust() != SVX_ADJUST_LEFT ) ) || ( pEditEngine->IsRightToLeft( nPara ) && ( rItem.GetAdjust() != SVX_ADJUST_RIGHT ) ) ) @@ -1631,15 +1646,15 @@ Rectangle Outliner::ImpCalcBulletArea( USHORT nPara, BOOL bAdjust, BOOL bReturnP } } - // Vertikal: + // Vertical: ParagraphInfos aInfos = pEditEngine->GetParagraphInfos( nPara ); if ( aInfos.bValid ) { - aTopLeft.Y() = /* aInfos.nFirstLineOffset + */ // #91076# nFirstLineOffset is already added to the StartPos (PaintBullet) from the EditEngine + aTopLeft.Y() = /* aInfos.nFirstLineOffset + */ // nFirstLineOffset is already added to the StartPos (PaintBullet) from the EditEngine aInfos.nFirstLineHeight - aInfos.nFirstLineTextHeight + aInfos.nFirstLineTextHeight / 2 - aBulletSize.Height() / 2; - // ggf. lieber auf der Baseline ausgeben... + // may prefer to print out on the baseline ... if( ( pFmt->GetNumberingType() != SVX_NUM_NUMBER_NONE ) && ( pFmt->GetNumberingType() != SVX_NUM_BITMAP ) && ( pFmt->GetNumberingType() != SVX_NUM_CHAR_SPECIAL ) ) { Font aBulletFont( ImpCalcBulletFont( nPara ) ); @@ -1649,7 +1664,7 @@ Rectangle Outliner::ImpCalcBulletArea( USHORT nPara, BOOL bAdjust, BOOL bReturnP Font aOldFont = pRefDev->GetFont(); pRefDev->SetFont( aBulletFont ); FontMetric aMetric( pRefDev->GetFontMetric() ); - // Leading der ersten Zeile... + // Leading on the first line ... aTopLeft.Y() = /* aInfos.nFirstLineOffset + */ aInfos.nFirstLineMaxAscent; aTopLeft.Y() -= aMetric.GetAscent(); pRefDev->SetFont( aOldFont ); @@ -1667,7 +1682,7 @@ Rectangle Outliner::ImpCalcBulletArea( USHORT nPara, BOOL bAdjust, BOOL bReturnP aTopLeft.X() += ( nBulletWidth - aBulletSize.Width() ) / 2; } - if ( aTopLeft.X() < 0 ) // dann draengeln + if ( aTopLeft.X() < 0 ) // then push aTopLeft.X() = 0; aBulletArea = Rectangle( aTopLeft, aBulletSize ); @@ -1705,7 +1720,7 @@ void Outliner::ExpandHdl() aExpandHdl.Call( this ); } -EBulletInfo Outliner::GetBulletInfo( USHORT nPara ) +EBulletInfo Outliner::GetBulletInfo( sal_uInt16 nPara ) { EBulletInfo aInfo; @@ -1732,54 +1747,53 @@ EBulletInfo Outliner::GetBulletInfo( USHORT nPara ) if ( aInfo.bVisible ) { - aInfo.aBounds = ImpCalcBulletArea( nPara, TRUE, TRUE ); + aInfo.aBounds = ImpCalcBulletArea( nPara, sal_True, sal_True ); } return aInfo; } -XubString Outliner::GetText( Paragraph* pParagraph, ULONG nCount ) const +XubString Outliner::GetText( Paragraph* pParagraph, sal_uLong nCount ) const { DBG_CHKTHIS(Outliner,0); XubString aText; - USHORT nStartPara = (USHORT) pParaList->GetAbsPos( pParagraph ); - for ( USHORT n = 0; n < nCount; n++ ) + sal_uInt16 nStartPara = (sal_uInt16) pParaList->GetAbsPos( pParagraph ); + for ( sal_uInt16 n = 0; n < nCount; n++ ) { aText += pEditEngine->GetText( nStartPara + n ); - if ( (n+1) < (USHORT)nCount ) + if ( (n+1) < (sal_uInt16)nCount ) aText += '\n'; } return aText; } -void Outliner::Remove( Paragraph* pPara, ULONG nParaCount ) +void Outliner::Remove( Paragraph* pPara, sal_uLong nParaCount ) { DBG_CHKTHIS(Outliner,0); - ULONG nPos = pParaList->GetAbsPos( pPara ); + sal_uLong nPos = pParaList->GetAbsPos( pPara ); if( !nPos && ( nParaCount >= pParaList->GetParagraphCount() ) ) { Clear(); } else { - for( USHORT n = 0; n < (USHORT)nParaCount; n++ ) - pEditEngine->RemoveParagraph( (USHORT) nPos ); + for( sal_uInt16 n = 0; n < (sal_uInt16)nParaCount; n++ ) + pEditEngine->RemoveParagraph( (sal_uInt16) nPos ); } } void Outliner::StripPortions() { DBG_CHKTHIS(Outliner,0); - bStrippingPortions = TRUE; + bStrippingPortions = sal_True; pEditEngine->StripPortions(); - bStrippingPortions = FALSE; + bStrippingPortions = sal_False; } -// #101498# -void Outliner::DrawingText( const Point& rStartPos, const XubString& rText, USHORT nTextStart, USHORT nTextLen, const sal_Int32* pDXArray,const SvxFont& rFont, - USHORT nPara, USHORT nIndex, BYTE nRightToLeft, +void Outliner::DrawingText( const Point& rStartPos, const XubString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, const sal_Int32* pDXArray,const SvxFont& rFont, + sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt8 nRightToLeft, const EEngineData::WrongSpellVector* pWrongSpellVector, const SvxFieldData* pFieldData, bool bEndOfLine, @@ -1793,7 +1807,6 @@ void Outliner::DrawingText( const Point& rStartPos, const XubString& rText, USHO if(aDrawPortionHdl.IsSet()) { - // #101498# DrawPortionInfo aInfo( rStartPos, rText, nTextStart, nTextLen, rFont, nPara, nIndex, pDXArray, pWrongSpellVector, pFieldData, pLocale, rOverlineColor, rTextLineColor, nRightToLeft, false, 0, bEndOfLine, bEndOfParagraph, bEndOfBullet); @@ -1802,7 +1815,7 @@ void Outliner::DrawingText( const Point& rStartPos, const XubString& rText, USHO } void Outliner::DrawingTab( const Point& rStartPos, long nWidth, const String& rChar, const SvxFont& rFont, - USHORT nPara, xub_StrLen nIndex, BYTE nRightToLeft, bool bEndOfLine, bool bEndOfParagraph, + sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, bool bEndOfLine, bool bEndOfParagraph, const Color& rOverlineColor, const Color& rTextLineColor) { if(aDrawPortionHdl.IsSet()) @@ -1817,20 +1830,20 @@ void Outliner::DrawingTab( const Point& rStartPos, long nWidth, const String& rC long Outliner::RemovingPagesHdl( OutlinerView* pView ) { DBG_CHKTHIS(Outliner,0); - return aRemovingPagesHdl.IsSet() ? aRemovingPagesHdl.Call( pView ) : TRUE; + return aRemovingPagesHdl.IsSet() ? aRemovingPagesHdl.Call( pView ) : sal_True; } -BOOL Outliner::ImpCanDeleteSelectedPages( OutlinerView* pCurView, USHORT _nFirstPage, USHORT nPages ) +sal_Bool Outliner::ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_uInt16 _nFirstPage, sal_uInt16 nPages ) { DBG_CHKTHIS(Outliner,0); nDepthChangedHdlPrevDepth = nPages; mnFirstSelPage = _nFirstPage; pHdlParagraph = 0; - return (BOOL)RemovingPagesHdl( pCurView ); + return (sal_Bool)RemovingPagesHdl( pCurView ); } -SfxItemSet Outliner::GetParaAttribs( USHORT nPara ) +SfxItemSet Outliner::GetParaAttribs( sal_uInt16 nPara ) { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetParaAttribs( nPara ); @@ -1840,8 +1853,8 @@ IMPL_LINK( Outliner, ParaVisibleStateChangedHdl, Paragraph*, pPara ) { DBG_CHKTHIS(Outliner,0); - ULONG nPara = pParaList->GetAbsPos( pPara ); - pEditEngine->ShowParagraph( (USHORT)nPara, pPara->IsVisible() ); + sal_uLong nPara = pParaList->GetAbsPos( pPara ); + pEditEngine->ShowParagraph( (sal_uInt16)nPara, pPara->IsVisible() ); return 0; } @@ -1865,7 +1878,7 @@ IMPL_LINK( Outliner, BeginPasteOrDropHdl, PasteOrDropInfos*, pInfos ) IMPL_LINK( Outliner, EndPasteOrDropHdl, PasteOrDropInfos*, pInfos ) { - bPasting = FALSE; + bPasting = sal_False; ImpTextPasted( pInfos->nStartPara, pInfos->nEndPara - pInfos->nStartPara + 1 ); maEndPasteOrDropHdl.Call( pInfos ); UndoActionEnd( EDITUNDO_DRAGANDDROP ); @@ -1877,10 +1890,10 @@ IMPL_LINK( Outliner, EndMovingParagraphsHdl, MoveParagraphsInfo*, pInfos ) DBG_CHKTHIS(Outliner,0); pParaList->MoveParagraphs( pInfos->nStartPara, pInfos->nDestPara, pInfos->nEndPara - pInfos->nStartPara + 1 ); - USHORT nChangesStart = Min( pInfos->nStartPara, pInfos->nDestPara ); - USHORT nParas = (USHORT)pParaList->GetParagraphCount(); - for ( USHORT n = nChangesStart; n < nParas; n++ ) - ImplCalcBulletText( n, FALSE, FALSE ); + sal_uInt16 nChangesStart = Min( pInfos->nStartPara, pInfos->nDestPara ); + sal_uInt16 nParas = (sal_uInt16)pParaList->GetParagraphCount(); + for ( sal_uInt16 n = nChangesStart; n < nParas; n++ ) + ImplCalcBulletText( n, sal_False, sal_False ); if( !IsInUndo() ) aEndMovingHdl.Call( this ); @@ -1902,7 +1915,7 @@ static bool isSameNumbering( const SvxNumberFormat& rN1, const SvxNumberFormat& return true; } -sal_uInt16 Outliner::ImplGetNumbering( USHORT nPara, const SvxNumberFormat* pParaFmt ) +sal_uInt16 Outliner::ImplGetNumbering( sal_uInt16 nPara, const SvxNumberFormat* pParaFmt ) { sal_uInt16 nNumber = pParaFmt->GetStart() - 1; @@ -1950,12 +1963,12 @@ sal_uInt16 Outliner::ImplGetNumbering( USHORT nPara, const SvxNumberFormat* pPar return nNumber; } -void Outliner::ImplCalcBulletText( USHORT nPara, BOOL bRecalcLevel, BOOL bRecalcChilds ) +void Outliner::ImplCalcBulletText( sal_uInt16 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChilds ) { DBG_CHKTHIS(Outliner,0); Paragraph* pPara = pParaList->GetParagraph( nPara ); - USHORT nRelPos = 0xFFFF; + sal_uInt16 nRelPos = 0xFFFF; while ( pPara ) { @@ -2009,12 +2022,12 @@ void Outliner::Clear() if( !bFirstParaIsEmpty ) { - ImplBlockInsertionCallbacks( TRUE ); + ImplBlockInsertionCallbacks( sal_True ); pEditEngine->Clear(); - pParaList->Clear( TRUE ); - pParaList->Insert( new Paragraph( nMinDepth ), LIST_APPEND ); - bFirstParaIsEmpty = TRUE; - ImplBlockInsertionCallbacks( FALSE ); + pParaList->Clear( sal_True ); + pParaList->Append( new Paragraph( nMinDepth )); + bFirstParaIsEmpty = sal_True; + ImplBlockInsertionCallbacks( sal_False ); } else { @@ -2024,35 +2037,35 @@ void Outliner::Clear() } } -void Outliner::SetFlatMode( BOOL bFlat ) +void Outliner::SetFlatMode( sal_Bool bFlat ) { DBG_CHKTHIS(Outliner,0); if( bFlat != pEditEngine->IsFlatMode() ) { - for ( USHORT nPara = (USHORT)pParaList->GetParagraphCount(); nPara; ) + for ( sal_uInt16 nPara = (sal_uInt16)pParaList->GetParagraphCount(); nPara; ) pParaList->GetParagraph( --nPara )->aBulSize.Width() = -1; pEditEngine->SetFlatMode( bFlat ); } } -String Outliner::ImplGetBulletText( USHORT nPara ) +String Outliner::ImplGetBulletText( sal_uInt16 nPara ) { String aRes; Paragraph* pPara = pParaList->GetParagraph( nPara ); if (pPara) { - // MT: Optimierung mal wieder aktivieren... + // Enable optimization again ... // if( pPara->nFlags & PARAFLAG_SETBULLETTEXT ) - ImplCalcBulletText( nPara, FALSE, FALSE ); + ImplCalcBulletText( nPara, sal_False, sal_False ); aRes = pPara->GetText(); } return aRes; } // this is needed for StarOffice Api -void Outliner::SetLevelDependendStyleSheet( USHORT nPara ) +void Outliner::SetLevelDependendStyleSheet( sal_uInt16 nPara ) { SfxItemSet aOldAttrs( pEditEngine->GetParaAttribs( nPara ) ); ImplSetLevelDependendStyleSheet( nPara ); @@ -2061,7 +2074,7 @@ void Outliner::SetLevelDependendStyleSheet( USHORT nPara ) SV_IMPL_PTRARR( NotifyList, EENotifyPtr ); -void Outliner::ImplBlockInsertionCallbacks( BOOL b ) +void Outliner::ImplBlockInsertionCallbacks( sal_Bool b ) { if ( b ) { @@ -2174,13 +2187,11 @@ sal_Bool DrawPortionInfo::IsRTL() const nError = U_ZERO_ERROR; // I do not have this info here. Is it necessary? I'll have to ask MT. - const BYTE nDefaultDir = UBIDI_LTR; //IsRightToLeft( nPara ) ? UBIDI_RTL : UBIDI_LTR; + const sal_uInt8 nDefaultDir = UBIDI_LTR; //IsRightToLeft( nPara ) ? UBIDI_RTL : UBIDI_LTR; ubidi_setPara(pBidi, reinterpret_cast<const UChar *>(mrText.GetBuffer()), mrText.Len(), nDefaultDir, NULL, &nError); // UChar != sal_Unicode in MinGW nError = U_ZERO_ERROR; -// sal_Int32 nCount(ubidi_countRuns(pBidi, &nError)); - int32_t nStart(0); int32_t nEnd; UBiDiLevel nCurrDir; diff --git a/editeng/source/outliner/outlobj.cxx b/editeng/source/outliner/outlobj.cxx index 2412dd2af9..633fd33737 100644 --- a/editeng/source/outliner/outlobj.cxx +++ b/editeng/source/outliner/outlobj.cxx @@ -225,7 +225,7 @@ const ParagraphData& OutlinerParaObject::GetParagraphData(sal_uInt32 nIndex) con } else { - OSL_ENSURE(false, "OutlinerParaObject::GetParagraphData: Access out of range (!)"); + OSL_FAIL("OutlinerParaObject::GetParagraphData: Access out of range (!)"); static ParagraphData aEmptyParagraphData; return aEmptyParagraphData; } diff --git a/editeng/source/outliner/outlundo.cxx b/editeng/source/outliner/outlundo.cxx index 051460d36d..933b6a9c7e 100644 --- a/editeng/source/outliner/outlundo.cxx +++ b/editeng/source/outliner/outlundo.cxx @@ -42,7 +42,7 @@ #include <outlundo.hxx> -OutlinerUndoBase::OutlinerUndoBase( USHORT _nId, Outliner* pOutliner ) +OutlinerUndoBase::OutlinerUndoBase( sal_uInt16 _nId, Outliner* pOutliner ) : EditUndo( _nId, NULL ) { DBG_ASSERT( pOutliner, "Undo: Outliner?!" ); @@ -112,7 +112,7 @@ void OutlinerUndoChangeParaNumberingRestart::ImplApplyData( const ParaRestartDat pOutliner->SetParaIsNumberingRestart( mnPara, rData.mbParaIsNumberingRestart ); } -OutlinerUndoChangeDepth::OutlinerUndoChangeDepth( Outliner* pOutliner, USHORT nPara, sal_Int16 nOldDepth, sal_Int16 nNewDepth ) +OutlinerUndoChangeDepth::OutlinerUndoChangeDepth( Outliner* pOutliner, sal_uInt16 nPara, sal_Int16 nOldDepth, sal_Int16 nNewDepth ) : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner ) { mnPara = nPara; @@ -122,21 +122,21 @@ OutlinerUndoChangeDepth::OutlinerUndoChangeDepth( Outliner* pOutliner, USHORT nP void OutlinerUndoChangeDepth::Undo() { - GetOutliner()->ImplInitDepth( mnPara, mnOldDepth, FALSE ); + GetOutliner()->ImplInitDepth( mnPara, mnOldDepth, sal_False ); } void OutlinerUndoChangeDepth::Redo() { - GetOutliner()->ImplInitDepth( mnPara, mnNewDepth, FALSE ); + GetOutliner()->ImplInitDepth( mnPara, mnNewDepth, sal_False ); } void OutlinerUndoChangeDepth::Repeat() { - DBG_ERROR( "Repeat not implemented!" ); + OSL_FAIL( "Repeat not implemented!" ); } -OutlinerUndoCheckPara::OutlinerUndoCheckPara( Outliner* pOutliner, USHORT nPara ) +OutlinerUndoCheckPara::OutlinerUndoCheckPara( Outliner* pOutliner, sal_uInt16 nPara ) : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner ) { mnPara = nPara; @@ -146,24 +146,24 @@ void OutlinerUndoCheckPara::Undo() { Paragraph* pPara = GetOutliner()->GetParagraph( mnPara ); pPara->Invalidate(); - GetOutliner()->ImplCalcBulletText( mnPara, FALSE, FALSE ); + GetOutliner()->ImplCalcBulletText( mnPara, sal_False, sal_False ); } void OutlinerUndoCheckPara::Redo() { Paragraph* pPara = GetOutliner()->GetParagraph( mnPara ); pPara->Invalidate(); - GetOutliner()->ImplCalcBulletText( mnPara, FALSE, FALSE ); + GetOutliner()->ImplCalcBulletText( mnPara, sal_False, sal_False ); } void OutlinerUndoCheckPara::Repeat() { - DBG_ERROR( "Repeat not implemented!" ); + OSL_FAIL( "Repeat not implemented!" ); } DBG_NAME(OLUndoExpand); -OLUndoExpand::OLUndoExpand(Outliner* pOut, USHORT _nId ) +OLUndoExpand::OLUndoExpand(Outliner* pOut, sal_uInt16 _nId ) : EditUndo( _nId, 0 ) { DBG_CTOR(OLUndoExpand,0); @@ -181,20 +181,20 @@ OLUndoExpand::~OLUndoExpand() } -void OLUndoExpand::Restore( BOOL bUndo ) +void OLUndoExpand::Restore( sal_Bool bUndo ) { DBG_CHKTHIS(OLUndoExpand,0); DBG_ASSERT(pOutliner,"Undo:No Outliner"); DBG_ASSERT(pOutliner->pEditEngine,"Outliner already deleted"); Paragraph* pPara; - BOOL bExpand = FALSE; - USHORT _nId = GetId(); + sal_Bool bExpand = sal_False; + sal_uInt16 _nId = GetId(); if((_nId == OLUNDO_EXPAND && !bUndo) || (_nId == OLUNDO_COLLAPSE && bUndo)) - bExpand = TRUE; + bExpand = sal_True; if( !pParas ) { - pPara = pOutliner->GetParagraph( (ULONG)nCount ); + pPara = pOutliner->GetParagraph( (sal_uLong)nCount ); if( bExpand ) pOutliner->Expand( pPara ); else @@ -202,9 +202,9 @@ void OLUndoExpand::Restore( BOOL bUndo ) } else { - for( USHORT nIdx = 0; nIdx < nCount; nIdx++ ) + for( sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++ ) { - pPara = pOutliner->GetParagraph( (ULONG)(pParas[nIdx]) ); + pPara = pOutliner->GetParagraph( (sal_uLong)(pParas[nIdx]) ); if( bExpand ) pOutliner->Expand( pPara ); else @@ -217,21 +217,21 @@ void OLUndoExpand::Restore( BOOL bUndo ) void OLUndoExpand::Undo() { DBG_CHKTHIS(OLUndoExpand,0); - Restore( TRUE ); + Restore( sal_True ); } void OLUndoExpand::Redo() { DBG_CHKTHIS(OLUndoExpand,0); - Restore( FALSE ); + Restore( sal_False ); } void OLUndoExpand::Repeat() { DBG_CHKTHIS(OLUndoExpand,0); - DBG_ERROR("Not implemented"); + OSL_FAIL("Not implemented"); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outlundo.hxx b/editeng/source/outliner/outlundo.hxx index 9e12bb3df7..fcdce80be4 100644 --- a/editeng/source/outliner/outlundo.hxx +++ b/editeng/source/outliner/outlundo.hxx @@ -39,7 +39,7 @@ private: Outliner* mpOutliner; public: - OutlinerUndoBase( USHORT nId, Outliner* pOutliner ); + OutlinerUndoBase( sal_uInt16 nId, Outliner* pOutliner ); Outliner* GetOutliner() const { return mpOutliner; } }; @@ -88,29 +88,29 @@ class OutlinerUndoChangeDepth : public OutlinerUndoBase { using SfxUndoAction::Repeat; private: - USHORT mnPara; + sal_uInt16 mnPara; sal_Int16 mnOldDepth; sal_Int16 mnNewDepth; public: - OutlinerUndoChangeDepth( Outliner* pOutliner, USHORT nPara, sal_Int16 nOldDepth, sal_Int16 nNewDepth ); + OutlinerUndoChangeDepth( Outliner* pOutliner, sal_uInt16 nPara, sal_Int16 nOldDepth, sal_Int16 nNewDepth ); virtual void Undo(); virtual void Redo(); virtual void Repeat(); }; -// Hilfs-Undo: Wenn es fuer eine Aktion keine OutlinerUndoAction gibst, weil -// die EditEngine das handelt, aber z.B. noch das Bullet neu berechnet werden muss. - +// Help-Undo: If it does not exist an OutlinerUndoAction for a certain action +// because this is handled by the EditEngine, but for example the bullet has +// to be recalculated. class OutlinerUndoCheckPara : public OutlinerUndoBase { using SfxUndoAction::Repeat; private: - USHORT mnPara; + sal_uInt16 mnPara; public: - OutlinerUndoCheckPara( Outliner* pOutliner, USHORT nPara ); + OutlinerUndoCheckPara( Outliner* pOutliner, sal_uInt16 nPara ); virtual void Undo(); virtual void Redo(); @@ -125,17 +125,17 @@ public: class OLUndoExpand : public EditUndo { using SfxUndoAction::Repeat; - void Restore( BOOL bUndo ); + void Restore( sal_Bool bUndo ); public: - OLUndoExpand( Outliner* pOut, USHORT nId ); + OLUndoExpand( Outliner* pOut, sal_uInt16 nId ); ~OLUndoExpand(); virtual void Undo(); virtual void Redo(); virtual void Repeat(); - USHORT* pParas; // 0 == nCount enthaelt Absatznummer + sal_uInt16* pParas; // 0 == nCount contains paragraph number Outliner* pOutliner; - USHORT nCount; + sal_uInt16 nCount; }; #endif diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 57a13a0051..98de3f705b 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -58,13 +58,13 @@ #include <editeng/editstat.hxx> -// Breite der Randzonen innerhalb derer beim D&D gescrollt wird +// Width of the border zones within which is scrolled during Drag and Drop #define OL_SCROLL_LRBORDERWIDTHPIX 10 #define OL_SCROLL_TBBORDERWIDTHPIX 10 -// Wert, um den Fensterinhalt beim D&D gescrollt wird -#define OL_SCROLL_HOROFFSET 20 /* in % von VisibleSize.Width */ -#define OL_SCROLL_VEROFFSET 20 /* in % von VisibleSize.Height */ +// Value to the window content when scrolling during Drag and Drop +#define OL_SCROLL_HOROFFSET 20 /* in % of VisibleSize.Width */ +#define OL_SCROLL_VEROFFSET 20 /* in % of VisibleSize.Height */ using namespace ::com::sun::star; @@ -76,8 +76,8 @@ OutlinerView::OutlinerView( Outliner* pOut, Window* pWin ) DBG_CTOR( OutlinerView, 0 ); pOwner = pOut; - bDDCursorVisible = FALSE; - bInDragMode = FALSE; + bDDCursorVisible = sal_False; + bInDragMode = sal_False; nDDScrollLRBorderWidthWin = 0; nDDScrollTBBorderWidthWin = 0; pHorTabArrDoc = 0; @@ -96,36 +96,36 @@ void OutlinerView::Paint( const Rectangle& rRect ) { DBG_CHKTHIS(OutlinerView,0); - // beim ersten Paint/KeyInput/Drop wird aus einem leeren Outliner ein - // Outliner mit genau einem Absatz + // For the first Paint/KeyInput/Drop an emty Outliner is turned into + // an Outliner with exactly one paragraph. if( pOwner->bFirstParaIsEmpty ) pOwner->Insert( String() ); pEditView->Paint( rRect ); } -BOOL OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin ) +sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin ) { DBG_CHKTHIS( OutlinerView, 0 ); - // beim ersten Paint/KeyInput/Drop wird aus einem leeren Outliner ein - // Outliner mit genau einem Absatz + // For the first Paint/KeyInput/Drop an emty Outliner is turned into + // an Outliner with exactly one paragraph. if( pOwner->bFirstParaIsEmpty ) pOwner->Insert( String() ); - BOOL bKeyProcessed = FALSE; + sal_Bool bKeyProcessed = sal_False; ESelection aSel( pEditView->GetSelection() ); - BOOL bSelection = aSel.HasRange(); + sal_Bool bSelection = aSel.HasRange(); KeyCode aKeyCode = rKEvt.GetKeyCode(); KeyFuncType eFunc = aKeyCode.GetFunction(); - USHORT nCode = aKeyCode.GetCode(); - BOOL bReadOnly = IsReadOnly(); + sal_uInt16 nCode = aKeyCode.GetCode(); + sal_Bool bReadOnly = IsReadOnly(); if( bSelection && ( nCode != KEY_TAB ) && EditEngine::DoesKeyChangeText( rKEvt ) ) { - if ( ImpCalcSelectedPages( FALSE ) && !pOwner->ImpCanDeleteSelectedPages( this ) ) - return TRUE; + if ( ImpCalcSelectedPages( sal_False ) && !pOwner->ImpCanDeleteSelectedPages( this ) ) + return sal_True; } if ( eFunc != KEYFUNC_DONTKNOW ) @@ -137,14 +137,14 @@ BOOL OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin ) if ( !bReadOnly ) { Cut(); - bKeyProcessed = TRUE; + bKeyProcessed = sal_True; } } break; case KEYFUNC_COPY: { Copy(); - bKeyProcessed = TRUE; + bKeyProcessed = sal_True; } break; case KEYFUNC_PASTE: @@ -152,7 +152,7 @@ BOOL OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin ) if ( !bReadOnly ) { PasteSpecial(); - bKeyProcessed = TRUE; + bKeyProcessed = sal_True; } } break; @@ -166,13 +166,13 @@ BOOL OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin ) if( pNext && pNext->HasFlag(PARAFLAG_ISPAGE) ) { if( !pOwner->ImpCanDeleteSelectedPages( this, aSel.nEndPara, 1 ) ) - return FALSE; + return sal_False; } } } } break; - default: // wird dann evtl. unten bearbeitet. + default: // is then possibly edited below. eFunc = KEYFUNC_DONTKNOW; } } @@ -189,13 +189,13 @@ BOOL OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin ) ( bSelection || !aSel.nStartPos ) ) { Indent( aKeyCode.IsShift() ? (-1) : (+1) ); - bKeyProcessed = TRUE; + bKeyProcessed = sal_True; } else if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) && !bSelection && !aSel.nEndPos && pOwner->ImplHasBullet( aSel.nEndPara ) ) { Indent( aKeyCode.IsShift() ? (-1) : (+1) ); - bKeyProcessed = TRUE; + bKeyProcessed = sal_True; } } } @@ -207,11 +207,11 @@ BOOL OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin ) Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara ); Paragraph* pPrev = pOwner->pParaList->GetParagraph( aSel.nEndPara-1 ); if( !pPrev->IsVisible() ) - return TRUE; + return sal_True; if( !pPara->GetDepth() ) { if(!pOwner->ImpCanDeleteSelectedPages(this, aSel.nEndPara , 1 ) ) - return TRUE; + return sal_True; } } } @@ -220,30 +220,30 @@ BOOL OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin ) { if ( !bReadOnly ) { - // Sonderbehandlung: Hartes Return am Ende eines Absatzes, - // der eingeklappte Unterabsaetze besitzt + // Special treatment: hard return at the end of a paragraph, + // which has collapsed subparagraphs. Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara ); if( !aKeyCode.IsShift() ) { - // Nochmal ImpGetCursor ??? + // ImpGetCursor again??? if( !bSelection && aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) ) { - ULONG nChilds = pOwner->pParaList->GetChildCount(pPara); + sal_uLong nChilds = pOwner->pParaList->GetChildCount(pPara); if( nChilds && !pOwner->pParaList->HasVisibleChilds(pPara)) { pOwner->UndoActionStart( OLUNDO_INSERT ); - ULONG nTemp = aSel.nEndPara; + sal_uLong nTemp = aSel.nEndPara; nTemp += nChilds; - nTemp++; // einfuegen ueber naechstem Non-Child + nTemp++; // insert above next Non-Child pOwner->Insert( String(),nTemp,pPara->GetDepth()); - // Cursor positionieren - ESelection aTmpSel((USHORT)nTemp,0,(USHORT)nTemp,0); + // Position the cursor + ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0); pEditView->SetSelection( aTmpSel ); - pEditView->ShowCursor( TRUE, TRUE ); + pEditView->ShowCursor( sal_True, sal_True ); pOwner->UndoActionEnd( OLUNDO_INSERT ); - bKeyProcessed = TRUE; + bKeyProcessed = sal_True; } } } @@ -252,16 +252,16 @@ BOOL OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin ) ( aSel.nEndPos == pOwner->pEditEngine->GetTextLen(aSel.nEndPara) ) ) { pOwner->UndoActionStart( OLUNDO_INSERT ); - ULONG nTemp = aSel.nEndPara; + sal_uLong nTemp = aSel.nEndPara; nTemp++; pOwner->Insert( String(), nTemp, pPara->GetDepth()+1 ); - // Cursor positionieren - ESelection aTmpSel((USHORT)nTemp,0,(USHORT)nTemp,0); + // Position the cursor + ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0); pEditView->SetSelection( aTmpSel ); - pEditView->ShowCursor( TRUE, TRUE ); + pEditView->ShowCursor( sal_True, sal_True ); pOwner->UndoActionEnd( OLUNDO_INSERT ); - bKeyProcessed = TRUE; + bKeyProcessed = sal_True; } } } @@ -269,14 +269,15 @@ BOOL OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin ) } } - return bKeyProcessed ? TRUE : pEditView->PostKeyEvent( rKEvt, pFrameWin ); + return bKeyProcessed ? sal_True : pEditView->PostKeyEvent( rKEvt, pFrameWin ); + } -ULONG OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTarget) +sal_uLong OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTarget) { DBG_CHKTHIS(OutlinerView,0); - ULONG nPara = EE_PARA_NOT_FOUND; + sal_uLong nPara = EE_PARA_NOT_FOUND; Point aMousePosWin = pEditView->GetWindow()->PixelToLogic( rPosPix ); if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) @@ -295,7 +296,7 @@ ULONG OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTarget aPaperPos.Y() -= aOutArea.Top(); aPaperPos.Y() += aVisArea.Top(); - BOOL bBullet; + sal_Bool bBullet; if ( pOwner->IsTextPos( aPaperPos, 0, &bBullet ) ) { Point aDocPos = pOwner->GetDocPos( aPaperPos ); @@ -317,7 +318,7 @@ ULONG OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTarget return nPara; } -BOOL __EXPORT OutlinerView::MouseMove( const MouseEvent& rMEvt ) +sal_Bool OutlinerView::MouseMove( const MouseEvent& rMEvt ) { DBG_CHKTHIS(OutlinerView,0); @@ -326,7 +327,7 @@ BOOL __EXPORT OutlinerView::MouseMove( const MouseEvent& rMEvt ) Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) ); if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) - return FALSE; + return sal_False; Pointer aPointer = GetPointer( rMEvt.GetPosPixel() ); pEditView->GetWindow()->SetPointer( aPointer ); @@ -334,7 +335,7 @@ BOOL __EXPORT OutlinerView::MouseMove( const MouseEvent& rMEvt ) } -BOOL __EXPORT OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) +sal_Bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) { DBG_CHKTHIS(OutlinerView,0); if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() ) @@ -342,24 +343,24 @@ BOOL __EXPORT OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) ); if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) - return FALSE; + return sal_False; Pointer aPointer = GetPointer( rMEvt.GetPosPixel() ); pEditView->GetWindow()->SetPointer( aPointer ); MouseTarget eTarget; - ULONG nPara = ImpCheckMousePos( rMEvt.GetPosPixel(), eTarget ); + sal_uLong nPara = ImpCheckMousePos( rMEvt.GetPosPixel(), eTarget ); if ( eTarget == MouseBullet ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - BOOL bHasChilds = (pPara && pOwner->pParaList->HasChilds(pPara)); + sal_Bool bHasChilds = (pPara && pOwner->pParaList->HasChilds(pPara)); if( rMEvt.GetClicks() == 1 ) { - ULONG nEndPara = nPara; + sal_uLong nEndPara = nPara; if ( bHasChilds && pOwner->pParaList->HasVisibleChilds(pPara) ) nEndPara += pOwner->pParaList->GetChildCount( pPara ); - // umgekehrt rum selektieren, damit EditEngine nicht scrollt - ESelection aSel((USHORT)nEndPara, 0xffff,(USHORT)nPara, 0 ); + // The selection is inverted, so that EditEngine does not scroll + ESelection aSel((sal_uInt16)nEndPara, 0xffff,(sal_uInt16)nPara, 0 ); pEditView->SetSelection( aSel ); } else if( rMEvt.GetClicks() == 2 && bHasChilds ) @@ -367,7 +368,7 @@ BOOL __EXPORT OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) aDDStartPosPix = rMEvt.GetPosPixel(); aDDStartPosRef=pEditView->GetWindow()->PixelToLogic( aDDStartPosPix,pOwner->GetRefMapMode()); - return TRUE; + return sal_True; } // special case for outliner view in impress, check if double click hits the page icon for toggle @@ -385,7 +386,7 @@ BOOL __EXPORT OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) } -BOOL __EXPORT OutlinerView::MouseButtonUp( const MouseEvent& rMEvt ) +sal_Bool OutlinerView::MouseButtonUp( const MouseEvent& rMEvt ) { DBG_CHKTHIS(OutlinerView,0); if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() ) @@ -393,7 +394,7 @@ BOOL __EXPORT OutlinerView::MouseButtonUp( const MouseEvent& rMEvt ) Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) ); if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) ) - return FALSE; + return sal_False; Pointer aPointer = GetPointer( rMEvt.GetPosPixel() ); pEditView->GetWindow()->SetPointer( aPointer ); @@ -406,7 +407,7 @@ void OutlinerView::ImpHideDDCursor() DBG_CHKTHIS(OutlinerView,0); if ( bDDCursorVisible ) { - bDDCursorVisible = FALSE; + bDDCursorVisible = sal_False; ImpPaintDDCursor(); } } @@ -416,7 +417,7 @@ void OutlinerView::ImpShowDDCursor() DBG_CHKTHIS(OutlinerView,0); if ( !bDDCursorVisible ) { - bDDCursorVisible = TRUE; + bDDCursorVisible = sal_True; ImpPaintDDCursor(); } } @@ -434,7 +435,6 @@ void OutlinerView::ImpPaintDDCursor() Point aStartPointWin, aEndPointWin; Rectangle aOutputArWin = pEditView->GetOutputArea(); - Rectangle aVisAreaRef = pEditView->GetVisArea(); if( bDDChangingDepth ) { @@ -446,16 +446,16 @@ void OutlinerView::ImpPaintDDCursor() } else { - ULONG nPara = nDDCurPara; + sal_uLong nPara = nDDCurPara; if ( nDDCurPara == LIST_APPEND ) { Paragraph* pTemp = pOwner->pParaList->LastVisible(); nPara = pOwner->pParaList->GetAbsPos( pTemp ); } - aStartPointWin = pEditView->GetWindowPosTopLeft((USHORT) nPara ); + aStartPointWin = pEditView->GetWindowPosTopLeft((sal_uInt16) nPara ); if ( nDDCurPara == LIST_APPEND ) { - long nHeight = pOwner->pEditEngine->GetTextHeight((USHORT)nPara ); + long nHeight = pOwner->pEditEngine->GetTextHeight((sal_uInt16)nPara ); aStartPointWin.Y() += nHeight; } aStartPointWin.X() = aOutputArWin.Left(); @@ -468,12 +468,12 @@ void OutlinerView::ImpPaintDDCursor() pWindow->SetRasterOp( eOldOp ); } -// Berechnet, ueber welchem Absatz eingefuegt werden muss +// Calculates above which paragraph must it must be inserted -ULONG OutlinerView::ImpGetInsertionPara( const Point& rPosPixel ) +sal_uLong OutlinerView::ImpGetInsertionPara( const Point& rPosPixel ) { DBG_CHKTHIS(OutlinerView,0); - ULONG nCurPara = pEditView->GetParagraph( rPosPixel ); + sal_uLong nCurPara = pEditView->GetParagraph( rPosPixel ); ParagraphList* pParaList = pOwner->pParaList; if ( nCurPara == EE_PARA_NOT_FOUND ) @@ -481,8 +481,8 @@ ULONG OutlinerView::ImpGetInsertionPara( const Point& rPosPixel ) else { Point aPosWin = pEditView->GetWindow()->PixelToLogic( rPosPixel ); - Point aParaPosWin = pEditView->GetWindowPosTopLeft((USHORT)nCurPara); - long nHeightRef = pOwner->pEditEngine->GetTextHeight((USHORT)nCurPara); + Point aParaPosWin = pEditView->GetWindowPosTopLeft((sal_uInt16)nCurPara); + long nHeightRef = pOwner->pEditEngine->GetTextHeight((sal_uInt16)nCurPara); long nParaYOffs = aPosWin.Y() - aParaPosWin.Y(); if ( nParaYOffs > nHeightRef / 2 ) @@ -500,7 +500,7 @@ void OutlinerView::ImpToggleExpand( Paragraph* pPara ) { DBG_CHKTHIS(OutlinerView,0); - USHORT nPara = (USHORT) pOwner->pParaList->GetAbsPos( pPara ); + sal_uInt16 nPara = (sal_uInt16) pOwner->pParaList->GetAbsPos( pPara ); pEditView->SetSelection( ESelection( nPara, 0, nPara, 0 ) ); ImplExpandOrCollaps( nPara, nPara, !pOwner->pParaList->HasVisibleChilds( pPara ) ); pEditView->ShowCursor(); @@ -516,21 +516,21 @@ void OutlinerView::SetOutliner( Outliner* pOutliner ) -ULONG OutlinerView::Select( Paragraph* pParagraph, BOOL bSelect, - BOOL bWithChilds ) +sal_uLong OutlinerView::Select( Paragraph* pParagraph, sal_Bool bSelect, + sal_Bool bWithChilds ) { DBG_CHKTHIS(OutlinerView,0); - ULONG nPara = pOwner->pParaList->GetAbsPos( pParagraph ); - USHORT nEnd = 0; + sal_uLong nPara = pOwner->pParaList->GetAbsPos( pParagraph ); + sal_uInt16 nEnd = 0; if ( bSelect ) nEnd = 0xffff; - ULONG nChildCount = 0; + sal_uLong nChildCount = 0; if ( bWithChilds ) nChildCount = pOwner->pParaList->GetChildCount( pParagraph ); - ESelection aSel( (USHORT)nPara, 0,(USHORT)(nPara+nChildCount), nEnd ); + ESelection aSel( (sal_uInt16)nPara, 0,(sal_uInt16)(nPara+nChildCount), nEnd ); pEditView->SetSelection( aSel ); return nChildCount+1; } @@ -540,23 +540,21 @@ void OutlinerView::SetAttribs( const SfxItemSet& rAttrs ) { DBG_CHKTHIS(OutlinerView,0); - BOOL bUpdate = pOwner->pEditEngine->GetUpdateMode(); - pOwner->pEditEngine->SetUpdateMode( FALSE ); + sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); + pOwner->pEditEngine->SetUpdateMode( sal_False ); if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() ) pOwner->UndoActionStart( OLUNDO_ATTR ); - ParaRange aSel = ImpGetSelectedParagraphs( FALSE ); + ParaRange aSel = ImpGetSelectedParagraphs( sal_False ); pEditView->SetAttribs( rAttrs ); - // Bullet-Texte aktualisieren - for( USHORT nPara= aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + // Update Bullet text + for( sal_uInt16 nPara= aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { pOwner->ImplCheckNumBulletItem( nPara ); - // update following paras as well, numbering depends on - // previous paras - pOwner->ImplCalcBulletText( nPara, TRUE, FALSE ); + pOwner->ImplCalcBulletText( nPara, sal_False, sal_False ); if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() ) pOwner->InsertUndo( new OutlinerUndoCheckPara( pOwner, nPara ) ); @@ -568,7 +566,7 @@ void OutlinerView::SetAttribs( const SfxItemSet& rAttrs ) pEditView->SetEditEngineUpdateMode( bUpdate ); } -ParaRange OutlinerView::ImpGetSelectedParagraphs( BOOL bIncludeHiddenChilds ) +ParaRange OutlinerView::ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChilds ) { DBG_CHKTHIS( OutlinerView, 0 ); @@ -576,20 +574,20 @@ ParaRange OutlinerView::ImpGetSelectedParagraphs( BOOL bIncludeHiddenChilds ) ParaRange aParas( aSel.nStartPara, aSel.nEndPara ); aParas.Adjust(); - // unsichtbare Childs des letzten Parents in Selektion mit aufnehmen + // Record the invisible Children of the last Parents in the selection if ( bIncludeHiddenChilds ) { Paragraph* pLast = pOwner->pParaList->GetParagraph( aParas.nEndPara ); if ( pOwner->pParaList->HasHiddenChilds( pLast ) ) aParas.nEndPara = - sal::static_int_cast< USHORT >( + sal::static_int_cast< sal_uInt16 >( aParas.nEndPara + pOwner->pParaList->GetChildCount( pLast ) ); } return aParas; } -// MT: Name sollte mal geaendert werden! +// TODO: Name should be changed! void OutlinerView::AdjustDepth( short nDX ) { Indent( nDX ); @@ -599,22 +597,22 @@ void OutlinerView::Indent( short nDiff ) { DBG_CHKTHIS( OutlinerView, 0 ); - if( !nDiff || ( ( nDiff > 0 ) && ImpCalcSelectedPages( TRUE ) && !pOwner->ImpCanIndentSelectedPages( this ) ) ) + if( !nDiff || ( ( nDiff > 0 ) && ImpCalcSelectedPages( sal_True ) && !pOwner->ImpCanIndentSelectedPages( this ) ) ) return; const bool bOutlinerView = pOwner->pEditEngine->GetControlWord() & EE_CNTRL_OUTLINER; - BOOL bUpdate = pOwner->pEditEngine->GetUpdateMode(); - pOwner->pEditEngine->SetUpdateMode( FALSE ); + sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); + pOwner->pEditEngine->SetUpdateMode( sal_False ); - BOOL bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); + sal_Bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); if( bUndo ) pOwner->UndoActionStart( OLUNDO_DEPTH ); - sal_Int16 nMinDepth = -1; // Optimierung: Nicht unnoetig viele Absatze neu berechnen + sal_Int16 nMinDepth = -1; // Optimization: Not to recalculate to manny parargaphs when not really needed. - ParaRange aSel = ImpGetSelectedParagraphs( TRUE ); - for ( USHORT nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + ParaRange aSel = ImpGetSelectedParagraphs( sal_True ); + for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); @@ -626,7 +624,7 @@ void OutlinerView::Indent( short nDiff ) const bool bPage = pPara->HasFlag(PARAFLAG_ISPAGE); if( (bPage && (nDiff == +1)) || (!bPage && (nDiff == -1) && (nOldDepth <= 0)) ) { - // App benachrichtigen + // Notify App pOwner->nDepthChangedHdlPrevDepth = (sal_Int16)nOldDepth; pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags; pOwner->pHdlParagraph = pPara; @@ -668,10 +666,10 @@ void OutlinerView::Indent( short nDiff ) { if ( ( nPara == aSel.nStartPara ) && aSel.nStartPara && ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT )) { - // Sonderfall: Der Vorgaenger eines eingerueckten Absatzes ist - // unsichtbar und steht jetzt auf der gleichen Ebene wie der - // sichtbare Absatz. In diesem Fall wird der naechste sichtbare - // Absatz gesucht und aufgeplustert. + // Special case: the predecessor of an indented paragraph is + // invisible and is now on the same level as the visible + // paragraph. In this case, the next visible paragraph is + // searched for and fluffed. #ifdef DBG_UTIL Paragraph* _pPara = pOwner->pParaList->GetParagraph( aSel.nStartPara ); DBG_ASSERT(_pPara->IsVisible(),"Selected Paragraph invisible ?!"); @@ -680,8 +678,8 @@ void OutlinerView::Indent( short nDiff ) if( !pPrev->IsVisible() && ( pPrev->GetDepth() == nNewDepth ) ) { - // Vorgaenger ist eingeklappt und steht auf gleicher Ebene - // => naechsten sichtbaren Absatz suchen und expandieren + // Predecessor is collapsed and is on the same level + // => find next visible paragraph and expand it pPrev = pOwner->pParaList->GetParent( pPrev ); while( !pPrev->IsVisible() ) pPrev = pOwner->pParaList->GetParent( pPrev ); @@ -695,13 +693,13 @@ void OutlinerView::Indent( short nDiff ) pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags; pOwner->pHdlParagraph = pPara; - pOwner->ImplInitDepth( nPara, nNewDepth, TRUE, FALSE ); - pOwner->ImplCalcBulletText( nPara, FALSE, FALSE ); + pOwner->ImplInitDepth( nPara, nNewDepth, sal_True, sal_False ); + pOwner->ImplCalcBulletText( nPara, sal_False, sal_False ); if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT ) pOwner->ImplSetLevelDependendStyleSheet( nPara ); - // App benachrichtigen + // Notify App pOwner->DepthChangedHdl(); } else @@ -711,24 +709,18 @@ void OutlinerView::Indent( short nDiff ) } } - // MT 19.08.99: War mal fuer Optimierung (outliner.cxx#1.193), - // hat aber zu zuviel Wartungsaufwand / doppelten Funktionen gefuehrt - // und zu wenig gebracht: - // pOwner->ImpSetBulletTextsFrom( aSel.nStartPara+1, nMinDepth ); - // Wird jetzt direkt in Schleife mit ImplCalcBulletText() erledigt. - // Jetzt fehlen nur noch die folgenden Ansaetze, die davon betroffen sind. - USHORT nParas = (USHORT)pOwner->pParaList->GetParagraphCount(); - for ( USHORT n = aSel.nEndPara+1; n < nParas; n++ ) + sal_uInt16 nParas = (sal_uInt16)pOwner->pParaList->GetParagraphCount(); + for ( sal_uInt16 n = aSel.nEndPara+1; n < nParas; n++ ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( n ); if ( pPara->GetDepth() < nMinDepth ) break; - pOwner->ImplCalcBulletText( n, FALSE, FALSE ); + pOwner->ImplCalcBulletText( n, sal_False, sal_False ); } if ( bUpdate ) { - pEditView->SetEditEngineUpdateMode( TRUE ); + pEditView->SetEditEngineUpdateMode( sal_True ); pEditView->ShowCursor(); } @@ -736,33 +728,33 @@ void OutlinerView::Indent( short nDiff ) pOwner->UndoActionEnd( OLUNDO_DEPTH ); } -BOOL OutlinerView::AdjustHeight( long nDY ) +sal_Bool OutlinerView::AdjustHeight( long nDY ) { DBG_CHKTHIS(OutlinerView,0); pEditView->MoveParagraphs( nDY ); - return TRUE; // remove return value... + return sal_True; // remove return value... } -void OutlinerView::AdjustDepth( Paragraph* pPara, short nDX, BOOL bWithChilds) +void OutlinerView::AdjustDepth( Paragraph* pPara, short nDX, sal_Bool bWithChilds) { DBG_CHKTHIS(OutlinerView,0); - ULONG nStartPara = pOwner->pParaList->GetAbsPos( pPara ); - ULONG nEndPara = nStartPara; + sal_uLong nStartPara = pOwner->pParaList->GetAbsPos( pPara ); + sal_uLong nEndPara = nStartPara; if ( bWithChilds ) nEndPara += pOwner->pParaList->GetChildCount( pPara ); - ESelection aSel((USHORT)nStartPara, 0,(USHORT)nEndPara, 0xffff ); + ESelection aSel((sal_uInt16)nStartPara, 0,(sal_uInt16)nEndPara, 0xffff ); pEditView->SetSelection( aSel ); AdjustDepth( nDX ); } -void OutlinerView::AdjustHeight( Paragraph* pPara, long nDY, BOOL bWithChilds ) +void OutlinerView::AdjustHeight( Paragraph* pPara, long nDY, sal_Bool bWithChilds ) { DBG_CHKTHIS(OutlinerView,0); - ULONG nStartPara = pOwner->pParaList->GetAbsPos( pPara ); - ULONG nEndPara = nStartPara; + sal_uLong nStartPara = pOwner->pParaList->GetAbsPos( pPara ); + sal_uLong nEndPara = nStartPara; if ( bWithChilds ) nEndPara += pOwner->pParaList->GetChildCount( pPara ); - ESelection aSel( (USHORT)nStartPara, 0, (USHORT)nEndPara, 0xffff ); + ESelection aSel( (sal_uInt16)nStartPara, 0, (sal_uInt16)nEndPara, 0xffff ); pEditView->SetSelection( aSel ); AdjustHeight( nDY ); } @@ -779,7 +771,7 @@ Point OutlinerView::ImpGetDocPos( const Point& rPosPixel ) { DBG_CHKTHIS(OutlinerView,0); Rectangle aOutArWin = GetOutputArea(); - // Position in der OutputArea berechnen + // Calculate position in the OutputArea Point aCurPosDoc( rPosPixel ); aCurPosDoc = pEditView->GetWindow()->PixelToLogic( aCurPosDoc ); aCurPosDoc -= aOutArWin.TopLeft(); @@ -787,8 +779,6 @@ Point OutlinerView::ImpGetDocPos( const Point& rPosPixel ) return aCurPosDoc; } -// MT 05/00: Wofuer dies ImpXXXScroll, sollte das nicht die EditEngine machen??? - void OutlinerView::ImpDragScroll( const Point& rPosPix ) { DBG_CHKTHIS(OutlinerView,0); @@ -905,50 +895,50 @@ void OutlinerView::ImpScrollUp() void OutlinerView::Expand() { DBG_CHKTHIS( OutlinerView, 0 ); - ParaRange aParas = ImpGetSelectedParagraphs( FALSE ); - ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, TRUE ); + ParaRange aParas = ImpGetSelectedParagraphs( sal_False ); + ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, sal_True ); } void OutlinerView::Collapse() { DBG_CHKTHIS( OutlinerView, 0 ); - ParaRange aParas = ImpGetSelectedParagraphs( FALSE ); - ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, FALSE ); + ParaRange aParas = ImpGetSelectedParagraphs( sal_False ); + ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, sal_False ); } void OutlinerView::ExpandAll() { DBG_CHKTHIS( OutlinerView, 0 ); - ImplExpandOrCollaps( 0, (USHORT)(pOwner->pParaList->GetParagraphCount()-1), TRUE ); + ImplExpandOrCollaps( 0, (sal_uInt16)(pOwner->pParaList->GetParagraphCount()-1), sal_True ); } void OutlinerView::CollapseAll() { DBG_CHKTHIS(OutlinerView,0); - ImplExpandOrCollaps( 0, (USHORT)(pOwner->pParaList->GetParagraphCount()-1), FALSE ); + ImplExpandOrCollaps( 0, (sal_uInt16)(pOwner->pParaList->GetParagraphCount()-1), sal_False ); } -void OutlinerView::ImplExpandOrCollaps( USHORT nStartPara, USHORT nEndPara, BOOL bExpand ) +void OutlinerView::ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand ) { DBG_CHKTHIS( OutlinerView, 0 ); - BOOL bUpdate = pOwner->GetUpdateMode(); - pOwner->SetUpdateMode( FALSE ); + sal_Bool bUpdate = pOwner->GetUpdateMode(); + pOwner->SetUpdateMode( sal_False ); - BOOL bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); + sal_Bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); if( bUndo ) pOwner->UndoActionStart( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE ); - for ( USHORT nPara = nStartPara; nPara <= nEndPara; nPara++ ) + for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - BOOL bDone = bExpand ? pOwner->Expand( pPara ) : pOwner->Collapse( pPara ); + sal_Bool bDone = bExpand ? pOwner->Expand( pPara ) : pOwner->Collapse( pPara ); if( bDone ) { - // Der Strich unter dem Absatz muss verschwinden... + // The line under the paragraph should disappear ... pOwner->pEditEngine->QuickMarkToBeRepainted( nPara ); } } @@ -958,7 +948,7 @@ void OutlinerView::ImplExpandOrCollaps( USHORT nStartPara, USHORT nEndPara, BOOL if ( bUpdate ) { - pOwner->SetUpdateMode( TRUE ); + pOwner->SetUpdateMode( sal_True ); pEditView->ShowCursor(); } } @@ -979,35 +969,33 @@ void OutlinerView::Collapse( Paragraph* pPara) void OutlinerView::InsertText( const OutlinerParaObject& rParaObj ) { - // MT: Wie Paste, nur EditView::Insert, statt EditView::Paste. - // Eigentlich nicht ganz richtig, das evtl. Einrueckungen - // korrigiert werden muessen, aber das kommt spaeter durch ein - // allgemeingueltiges Import. - // Dann wird im Inserted gleich ermittelt, was f�r eine Einrueckebene - // Moegliche Struktur: - // pImportInfo mit DestPara, DestPos, nFormat, pParaObj... - // Evtl. Problematisch: - // EditEngine, RTF => Absplittung des Bereichs, spaeter - // zusammenfuehrung + // Like Paste, only EditView::Insert, instead of EditView::Paste. + // Actually not quite true that possible indentations must be corrected, + // but that comes later by a universal import. The indentation level is + // then determined right in the Inserted method. + // Possible structure: + // pImportInfo with DestPara, DestPos, nFormat, pParaObj... + // Possibly problematic: + // EditEngine, RTF => Splitting the area, later join together. DBG_CHKTHIS(OutlinerView,0); - if ( ImpCalcSelectedPages( FALSE ) && !pOwner->ImpCanDeleteSelectedPages( this ) ) + if ( ImpCalcSelectedPages( sal_False ) && !pOwner->ImpCanDeleteSelectedPages( this ) ) return; pOwner->UndoActionStart( OLUNDO_INSERT ); - pOwner->pEditEngine->SetUpdateMode( FALSE ); - ULONG nStart, nParaCount; + pOwner->pEditEngine->SetUpdateMode( sal_False ); + sal_uLong nStart, nParaCount; nParaCount = pOwner->pEditEngine->GetParagraphCount(); - USHORT nSize = ImpInitPaste( nStart ); + sal_uInt16 nSize = ImpInitPaste( nStart ); pEditView->InsertText( rParaObj.GetTextObject() ); ImpPasted( nStart, nParaCount, nSize); - pEditView->SetEditEngineUpdateMode( TRUE ); + pEditView->SetEditEngineUpdateMode( sal_True ); pOwner->UndoActionEnd( OLUNDO_INSERT ); - pEditView->ShowCursor( TRUE, TRUE ); + pEditView->ShowCursor( sal_True, sal_True ); } @@ -1015,53 +1003,52 @@ void OutlinerView::InsertText( const OutlinerParaObject& rParaObj ) void OutlinerView::Cut() { DBG_CHKTHIS(OutlinerView,0); - if ( !ImpCalcSelectedPages( FALSE ) || pOwner->ImpCanDeleteSelectedPages( this ) ) + if ( !ImpCalcSelectedPages( sal_False ) || pOwner->ImpCanDeleteSelectedPages( this ) ) pEditView->Cut(); } void OutlinerView::Paste() { DBG_CHKTHIS(OutlinerView,0); - PasteSpecial(); // HACK(SD ruft nicht PasteSpecial auf) + PasteSpecial(); // HACK(SD does not call PasteSpecial) } void OutlinerView::PasteSpecial() { DBG_CHKTHIS(OutlinerView,0); - if ( !ImpCalcSelectedPages( FALSE ) || pOwner->ImpCanDeleteSelectedPages( this ) ) + if ( !ImpCalcSelectedPages( sal_False ) || pOwner->ImpCanDeleteSelectedPages( this ) ) { pOwner->UndoActionStart( OLUNDO_INSERT ); - pOwner->pEditEngine->SetUpdateMode( FALSE ); - pOwner->bPasting = TRUE; + pOwner->pEditEngine->SetUpdateMode( sal_False ); + pOwner->bPasting = sal_True; pEditView->PasteSpecial(); if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT ) { - const USHORT nParaCount = pOwner->pEditEngine->GetParagraphCount(); + const sal_uInt16 nParaCount = pOwner->pEditEngine->GetParagraphCount(); - for( USHORT nPara = 0; nPara < nParaCount; nPara++ ) + for( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ ) pOwner->ImplSetLevelDependendStyleSheet( nPara ); } - pEditView->SetEditEngineUpdateMode( TRUE ); + pEditView->SetEditEngineUpdateMode( sal_True ); pOwner->UndoActionEnd( OLUNDO_INSERT ); - pEditView->ShowCursor( TRUE, TRUE ); + pEditView->ShowCursor( sal_True, sal_True ); } } -List* OutlinerView::CreateSelectionList() +void OutlinerView::CreateSelectionList (std::vector<Paragraph*> &aSelList) { DBG_CHKTHIS( OutlinerView, 0 ); - ParaRange aParas = ImpGetSelectedParagraphs( TRUE ); - List* pSelList = new List; - for ( USHORT nPara = aParas.nStartPara; nPara <= aParas.nEndPara; nPara++ ) + ParaRange aParas = ImpGetSelectedParagraphs( sal_True ); + + for ( sal_uInt16 nPara = aParas.nStartPara; nPara <= aParas.nEndPara; nPara++ ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - pSelList->Insert( pPara, LIST_APPEND ); + aSelList.push_back(pPara); } - return pSelList; } SfxStyleSheet* OutlinerView::GetStyleSheet() const @@ -1075,11 +1062,11 @@ void OutlinerView::SetStyleSheet( SfxStyleSheet* pStyle ) DBG_CHKTHIS(OutlinerView,0); pEditView->SetStyleSheet( pStyle ); - ParaRange aSel = ImpGetSelectedParagraphs( TRUE ); - for( USHORT nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + ParaRange aSel = ImpGetSelectedParagraphs( sal_True ); + for( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { pOwner->ImplCheckNumBulletItem( nPara ); - pOwner->ImplCalcBulletText( nPara, FALSE, FALSE ); + pOwner->ImplCalcBulletText( nPara, sal_False, sal_False ); } } @@ -1108,28 +1095,28 @@ Pointer OutlinerView::GetPointer( const Point& rPosPixel ) } -USHORT OutlinerView::ImpInitPaste( ULONG& rStart ) +sal_uInt16 OutlinerView::ImpInitPaste( sal_uLong& rStart ) { DBG_CHKTHIS(OutlinerView,0); - pOwner->bPasting = TRUE; + pOwner->bPasting = sal_True; ESelection aSelection( pEditView->GetSelection() ); aSelection.Adjust(); rStart = aSelection.nStartPara; - USHORT nSize = aSelection.nEndPara - aSelection.nStartPara + 1; + sal_uInt16 nSize = aSelection.nEndPara - aSelection.nStartPara + 1; return nSize; } -void OutlinerView::ImpPasted( ULONG nStart, ULONG nPrevParaCount, USHORT nSize) +void OutlinerView::ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize) { DBG_CHKTHIS(OutlinerView,0); - pOwner->bPasting = FALSE; - ULONG nCurParaCount = (ULONG)pOwner->pEditEngine->GetParagraphCount(); + pOwner->bPasting = sal_False; + sal_uLong nCurParaCount = (sal_uLong)pOwner->pEditEngine->GetParagraphCount(); if( nCurParaCount < nPrevParaCount ) - nSize = sal::static_int_cast< USHORT >( + nSize = sal::static_int_cast< sal_uInt16 >( nSize - ( nPrevParaCount - nCurParaCount ) ); else - nSize = sal::static_int_cast< USHORT >( + nSize = sal::static_int_cast< sal_uInt16 >( nSize + ( nCurParaCount - nPrevParaCount ) ); pOwner->ImpTextPasted( nStart, nSize ); } @@ -1142,34 +1129,34 @@ void OutlinerView::Command( const CommandEvent& rCEvt ) } -void OutlinerView::SelectRange( ULONG nFirst, USHORT nCount ) +void OutlinerView::SelectRange( sal_uLong nFirst, sal_uInt16 nCount ) { DBG_CHKTHIS(OutlinerView,0); - ULONG nLast = nFirst+nCount; - nCount = (USHORT)pOwner->pParaList->GetParagraphCount(); + sal_uLong nLast = nFirst+nCount; + nCount = (sal_uInt16)pOwner->pParaList->GetParagraphCount(); if( nLast <= nCount ) nLast = nCount - 1; - ESelection aSel( (USHORT)nFirst, 0, (USHORT)nLast, 0xffff ); + ESelection aSel( (sal_uInt16)nFirst, 0, (sal_uInt16)nLast, 0xffff ); pEditView->SetSelection( aSel ); } -USHORT OutlinerView::ImpCalcSelectedPages( BOOL bIncludeFirstSelected ) +sal_uInt16 OutlinerView::ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected ) { DBG_CHKTHIS(OutlinerView,0); ESelection aSel( pEditView->GetSelection() ); aSel.Adjust(); - USHORT nPages = 0; - USHORT nFirstPage = 0xFFFF; - USHORT nStartPara = aSel.nStartPara; + sal_uInt16 nPages = 0; + sal_uInt16 nFirstPage = 0xFFFF; + sal_uInt16 nStartPara = aSel.nStartPara; if ( !bIncludeFirstSelected ) - nStartPara++; // alle nach StartPara kommenden Absaetze werden geloescht - for ( USHORT nPara = nStartPara; nPara <= aSel.nEndPara; nPara++ ) + nStartPara++; // All paragraphs after StartPara will be deleted + for ( sal_uInt16 nPara = nStartPara; nPara <= aSel.nEndPara; nPara++ ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - DBG_ASSERT(pPara, "ImpCalcSelectedPages: ungueltige Selection? "); + DBG_ASSERT(pPara, "ImpCalcSelectedPages: invalid Selection? "); if( pPara->HasFlag(PARAFLAG_ISPAGE) ) { nPages++; @@ -1197,11 +1184,11 @@ void OutlinerView::ToggleBullets() aSel.Adjust(); const bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); - pOwner->pEditEngine->SetUpdateMode( FALSE ); + pOwner->pEditEngine->SetUpdateMode( sal_False ); sal_Int16 nDepth = -2; - for ( USHORT nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); @@ -1228,8 +1215,8 @@ void OutlinerView::ToggleBullets() // #i100014# // It is not a good idea to substract 1 from a count and cast the result - // to USHORT without check, if the count is 0. - USHORT nParaCount = (USHORT) (pOwner->pParaList->GetParagraphCount()); + // to sal_uInt16 without check, if the count is 0. + sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount()); pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount ); pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) ); @@ -1246,9 +1233,9 @@ void OutlinerView::EnableBullets() aSel.Adjust(); const bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); - pOwner->pEditEngine->SetUpdateMode( FALSE ); + pOwner->pEditEngine->SetUpdateMode( sal_False ); - for ( USHORT nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); @@ -1261,8 +1248,9 @@ void OutlinerView::EnableBullets() // #i100014# // It is not a good idea to substract 1 from a count and cast the result - // to USHORT without check, if the count is 0. - USHORT nParaCount = (USHORT) (pOwner->pParaList->GetParagraphCount()); + // to sal_uInt16 without check, if the count is 0. + sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount()); + pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount ); pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) ); @@ -1272,16 +1260,16 @@ void OutlinerView::EnableBullets() } -void OutlinerView::RemoveAttribsKeepLanguages( BOOL bRemoveParaAttribs ) +void OutlinerView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs ) { - RemoveAttribs( bRemoveParaAttribs, 0, TRUE /*keep language attribs*/ ); + RemoveAttribs( bRemoveParaAttribs, 0, sal_True /*keep language attribs*/ ); } -void OutlinerView::RemoveAttribs( BOOL bRemoveParaAttribs, USHORT nWhich, BOOL bKeepLanguages ) +void OutlinerView::RemoveAttribs( sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich, sal_Bool bKeepLanguages ) { DBG_CHKTHIS(OutlinerView,0); - BOOL bUpdate = pOwner->GetUpdateMode(); - pOwner->SetUpdateMode( FALSE ); + sal_Bool bUpdate = pOwner->GetUpdateMode(); + pOwner->SetUpdateMode( sal_False ); pOwner->UndoActionStart( OLUNDO_ATTR ); if (bKeepLanguages) pEditView->RemoveAttribsKeepLanguages( bRemoveParaAttribs ); @@ -1289,13 +1277,13 @@ void OutlinerView::RemoveAttribs( BOOL bRemoveParaAttribs, USHORT nWhich, BOOL b pEditView->RemoveAttribs( bRemoveParaAttribs, nWhich ); if ( bRemoveParaAttribs ) { - // Ueber alle Absaetze, und Einrueckung und Level einstellen + // Loop through all paragraphs and set indentation and level ESelection aSel = pEditView->GetSelection(); aSel.Adjust(); - for ( USHORT nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - pOwner->ImplInitDepth( nPara, pPara->GetDepth(), FALSE, FALSE ); + pOwner->ImplInitDepth( nPara, pPara->GetDepth(), sal_False, sal_False ); } } pOwner->UndoActionEnd( OLUNDO_ATTR ); @@ -1304,12 +1292,12 @@ void OutlinerView::RemoveAttribs( BOOL bRemoveParaAttribs, USHORT nWhich, BOOL b -// ===================================================================== -// ====================== Einfache Durchreicher ======================= +// ====================================================================== +// ====================== Simple pass-through ======================= // ====================================================================== -void OutlinerView::InsertText( const XubString& rNew, BOOL bSelect ) +void OutlinerView::InsertText( const XubString& rNew, sal_Bool bSelect ) { DBG_CHKTHIS(OutlinerView,0); if( pOwner->bFirstParaIsEmpty ) @@ -1330,26 +1318,26 @@ void OutlinerView::SetSelection( const ESelection& rSel ) pEditView->SetSelection( rSel ); } -void OutlinerView::SetReadOnly( BOOL bReadOnly ) +void OutlinerView::SetReadOnly( sal_Bool bReadOnly ) { DBG_CHKTHIS(OutlinerView,0); pEditView->SetReadOnly( bReadOnly ); } -BOOL OutlinerView::IsReadOnly() const +sal_Bool OutlinerView::IsReadOnly() const { DBG_CHKTHIS(OutlinerView,0); return pEditView->IsReadOnly(); } -BOOL OutlinerView::HasSelection() const +sal_Bool OutlinerView::HasSelection() const { DBG_CHKTHIS(OutlinerView,0); return pEditView->HasSelection(); } -void OutlinerView::ShowCursor( BOOL bGotoCursor ) +void OutlinerView::ShowCursor( sal_Bool bGotoCursor ) { DBG_CHKTHIS(OutlinerView,0); pEditView->ShowCursor( bGotoCursor ); @@ -1398,10 +1386,10 @@ XubString OutlinerView::GetSelected() const } -void OutlinerView::RemoveCharAttribs( ULONG nPara, USHORT nWhich) +void OutlinerView::RemoveCharAttribs( sal_uLong nPara, sal_uInt16 nWhich) { DBG_CHKTHIS(OutlinerView,0); - pEditView->RemoveCharAttribs( (USHORT)nPara, nWhich); + pEditView->RemoveCharAttribs( (sal_uInt16)nPara, nWhich); } @@ -1412,7 +1400,7 @@ void OutlinerView::CompleteAutoCorrect() } -EESpellState OutlinerView::StartSpeller( BOOL bMultiDoc ) +EESpellState OutlinerView::StartSpeller( sal_Bool bMultiDoc ) { DBG_CHKTHIS(OutlinerView,0); return pEditView->StartSpeller( bMultiDoc ); @@ -1428,7 +1416,7 @@ EESpellState OutlinerView::StartThesaurus() void OutlinerView::StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, - INT32 nOptions, BOOL bIsInteractive, BOOL bMultipleDoc ) + sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ) { DBG_CHKTHIS(OutlinerView,0); if ( @@ -1441,12 +1429,12 @@ void OutlinerView::StartTextConversion( } else { - DBG_ERROR( "unexpected language" ); + OSL_FAIL( "unexpected language" ); } } -USHORT OutlinerView::StartSearchAndReplace( const SvxSearchItem& rSearchItem ) +sal_uInt16 OutlinerView::StartSearchAndReplace( const SvxSearchItem& rSearchItem ) { DBG_CHKTHIS(OutlinerView,0); return pEditView->StartSearchAndReplace( rSearchItem ); @@ -1474,14 +1462,14 @@ void OutlinerView::Scroll( long nHorzScroll, long nVertScroll ) } -void OutlinerView::SetControlWord( ULONG nWord ) +void OutlinerView::SetControlWord( sal_uLong nWord ) { DBG_CHKTHIS(OutlinerView,0); pEditView->SetControlWord( nWord ); } -ULONG OutlinerView::GetControlWord() const +sal_uLong OutlinerView::GetControlWord() const { DBG_CHKTHIS(OutlinerView,0); return pEditView->GetControlWord(); @@ -1516,7 +1504,7 @@ void OutlinerView::Redo() } -void OutlinerView::EnablePaste( BOOL bEnable ) +void OutlinerView::EnablePaste( sal_Bool bEnable ) { DBG_CHKTHIS(OutlinerView,0); pEditView->EnablePaste( bEnable ); @@ -1544,7 +1532,7 @@ const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer() const } -const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer( USHORT& nPara, USHORT& nPos ) const +const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer( sal_uInt16& nPara, sal_uInt16& nPos ) const { DBG_CHKTHIS(OutlinerView,0); return pEditView->GetFieldUnderMousePointer( nPara, nPos ); @@ -1557,28 +1545,28 @@ const SvxFieldItem* OutlinerView::GetFieldAtSelection() const return pEditView->GetFieldAtSelection(); } -void OutlinerView::SetInvalidateMore( USHORT nPixel ) +void OutlinerView::SetInvalidateMore( sal_uInt16 nPixel ) { DBG_CHKTHIS(OutlinerView,0); pEditView->SetInvalidateMore( nPixel ); } -USHORT OutlinerView::GetInvalidateMore() const +sal_uInt16 OutlinerView::GetInvalidateMore() const { DBG_CHKTHIS(OutlinerView,0); return pEditView->GetInvalidateMore(); } -BOOL OutlinerView::IsCursorAtWrongSpelledWord( BOOL bMarkIfWrong ) +sal_Bool OutlinerView::IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong ) { DBG_CHKTHIS(OutlinerView,0); return pEditView->IsCursorAtWrongSpelledWord( bMarkIfWrong ); } -BOOL OutlinerView::IsWrongSpelledWordAtPos( const Point& rPosPixel, BOOL bMarkIfWrong ) +sal_Bool OutlinerView::IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong ) { DBG_CHKTHIS(OutlinerView,0); return pEditView->IsWrongSpelledWordAtPos( rPosPixel, bMarkIfWrong ); @@ -1598,31 +1586,28 @@ void OutlinerView::ExecuteSpellPopup( const Point& rPosPixel, Link* pStartDlg ) pEditView->ExecuteSpellPopup( rPosPixel, pStartDlg ); } -ULONG OutlinerView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, BOOL bSelect, SvKeyValueIterator* pHTTPHeaderAttrs ) +sal_uLong OutlinerView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect, SvKeyValueIterator* pHTTPHeaderAttrs ) { DBG_CHKTHIS(OutlinerView,0); - USHORT nOldParaCount = pEditView->GetEditEngine()->GetParagraphCount(); + sal_uInt16 nOldParaCount = pEditView->GetEditEngine()->GetParagraphCount(); ESelection aOldSel = pEditView->GetSelection(); aOldSel.Adjust(); - ULONG nRet = pEditView->Read( rInput, rBaseURL, eFormat, bSelect, pHTTPHeaderAttrs ); - - // MT 08/00: Hier sollte eigentlich das gleiche wie in PasteSpecial passieren! - // Mal anpassen, wenn dieses ImplInitPaste und ImpPasted-Geraffel ueberarbeitet ist. + sal_uLong nRet = pEditView->Read( rInput, rBaseURL, eFormat, bSelect, pHTTPHeaderAttrs ); long nParaDiff = pEditView->GetEditEngine()->GetParagraphCount() - nOldParaCount; - USHORT nChangesStart = aOldSel.nStartPara; - USHORT nChangesEnd = sal::static_int_cast< USHORT >(nChangesStart + nParaDiff + (aOldSel.nEndPara-aOldSel.nStartPara)); + sal_uInt16 nChangesStart = aOldSel.nStartPara; + sal_uInt16 nChangesEnd = sal::static_int_cast< sal_uInt16 >(nChangesStart + nParaDiff + (aOldSel.nEndPara-aOldSel.nStartPara)); - for ( USHORT n = nChangesStart; n <= nChangesEnd; n++ ) + for ( sal_uInt16 n = nChangesStart; n <= nChangesEnd; n++ ) { if ( eFormat == EE_FORMAT_BIN ) { - USHORT nDepth = 0; + sal_uInt16 nDepth = 0; const SfxItemSet& rAttrs = pOwner->GetParaAttribs( n ); const SfxInt16Item& rLevel = (const SfxInt16Item&) rAttrs.Get( EE_PARA_OUTLLEVEL ); nDepth = rLevel.GetValue(); - pOwner->ImplInitDepth( n, nDepth, FALSE ); + pOwner->ImplInitDepth( n, nDepth, sal_False ); } if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT ) @@ -1637,7 +1622,7 @@ ULONG OutlinerView::Read( SvStream& rInput, const String& rBaseURL, EETextForma return nRet; } -ULONG OutlinerView::Write( SvStream& rOutput, EETextFormat eFormat ) +sal_uLong OutlinerView::Write( SvStream& rOutput, EETextFormat eFormat ) { DBG_CHKTHIS(OutlinerView,0); return pEditView->Write( rOutput, eFormat ); @@ -1662,7 +1647,7 @@ SfxItemSet OutlinerView::GetAttribs() return pEditView->GetAttribs(); } -USHORT OutlinerView::GetSelectedScriptType() const +sal_uInt16 OutlinerView::GetSelectedScriptType() const { DBG_CHKTHIS(OutlinerView,0); return pEditView->GetSelectedScriptType(); diff --git a/editeng/source/outliner/paralist.cxx b/editeng/source/outliner/paralist.cxx index 938db521c2..c646710c4d 100644 --- a/editeng/source/outliner/paralist.cxx +++ b/editeng/source/outliner/paralist.cxx @@ -30,9 +30,12 @@ #include "precompiled_editeng.hxx" #include <paralist.hxx> -#include <editeng/outliner.hxx> // nur wegen Paragraph, muss geaendert werden! + +#include <editeng/outliner.hxx> // only because of Paragraph, this must be changed! #include <editeng/numdef.hxx> +#include <osl/diagnose.h> + DBG_NAME(Paragraph) ParagraphData::ParagraphData() @@ -73,7 +76,7 @@ Paragraph::Paragraph( sal_Int16 nDDepth ) nDepth = nDDepth; nFlags = 0; - bVisible = TRUE; + bVisible = sal_True; } Paragraph::Paragraph( const Paragraph& rPara ) @@ -91,7 +94,7 @@ Paragraph::Paragraph( const Paragraph& rPara ) Paragraph::Paragraph( const ParagraphData& rData ) : nFlags( 0 ) , aBulSize( -1, -1) -, bVisible( TRUE ) +, bVisible( sal_True ) { DBG_CTOR( Paragraph, 0 ); @@ -119,105 +122,129 @@ void Paragraph::SetParaIsNumberingRestart( sal_Bool bParaIsNumberingRestart ) mnNumberingStartValue = -1; } -void ParagraphList::Clear( BOOL bDestroyParagraphs ) +void ParagraphList::Clear( sal_Bool bDestroyParagraphs ) { if ( bDestroyParagraphs ) { - for ( ULONG n = GetParagraphCount(); n; ) - { - Paragraph* pPara = GetParagraph( --n ); - delete pPara; - } + std::vector<Paragraph*>::iterator iter; + for (iter = maEntries.begin(); iter != maEntries.end(); ++iter) + delete *iter; } - List::Clear(); + + maEntries.clear(); } -void ParagraphList::MoveParagraphs( ULONG nStart, ULONG nDest, ULONG _nCount ) +void ParagraphList::Append( Paragraph* pPara) { + maEntries.push_back(pPara); +} + +void ParagraphList::Insert( Paragraph* pPara, sal_uLong nAbsPos) +{ + OSL_ASSERT(nAbsPos != ULONG_MAX && nAbsPos <= maEntries.size()); + + maEntries.insert(maEntries.begin()+nAbsPos,pPara); +} + +void ParagraphList::Remove( sal_uLong nPara ) +{ + OSL_ASSERT(nPara < maEntries.size()); + + maEntries.erase(maEntries.begin() + nPara ); +} + +void ParagraphList::MoveParagraphs( sal_uLong nStart, sal_uLong nDest, sal_uLong _nCount ) +{ + OSL_ASSERT(nStart < maEntries.size() && nDest < maEntries.size()); + if ( ( nDest < nStart ) || ( nDest >= ( nStart + _nCount ) ) ) { - ULONG n; - ParagraphList aParas; - for ( n = 0; n < _nCount; n++ ) - { - Paragraph* pPara = GetParagraph( nStart ); - aParas.Insert( pPara, LIST_APPEND ); - Remove( nStart ); - } + std::vector<Paragraph*> aParas; + std::vector<Paragraph*>::iterator iterBeg = maEntries.begin() + nStart; + std::vector<Paragraph*>::iterator iterEnd = iterBeg + _nCount; + + std::copy(iterBeg,iterEnd,std::back_inserter(aParas)); + + maEntries.erase(iterBeg,iterEnd); if ( nDest > nStart ) nDest -= _nCount; - for ( n = 0; n < _nCount; n++ ) - { - Paragraph* pPara = aParas.GetParagraph( n ); - Insert( pPara, nDest++ ); - } + std::vector<Paragraph*>::iterator iterIns = maEntries.begin() + nDest; + + std::copy(aParas.begin(),aParas.end(),std::inserter(maEntries,iterIns)); } else { - DBG_ERROR( "MoveParagraphs: Invalid Parameters" ); + OSL_FAIL( "MoveParagraphs: Invalid Parameters" ); } } Paragraph* ParagraphList::NextVisible( Paragraph* pPara ) const { - ULONG n = GetAbsPos( pPara ); - - Paragraph* p = GetParagraph( ++n ); - while ( p && !p->IsVisible() ) - p = GetParagraph( ++n ); + std::vector<Paragraph*>::const_iterator iter = std::find(maEntries.begin(), + maEntries.end(), + pPara); + for (; iter != maEntries.end(); ++iter) + { + if ((*iter)->IsVisible()) + break; + } - return p; + return iter != maEntries.end() ? *iter : NULL; } Paragraph* ParagraphList::PrevVisible( Paragraph* pPara ) const { - ULONG n = GetAbsPos( pPara ); - - Paragraph* p = n ? GetParagraph( --n ) : NULL; - while ( p && !p->IsVisible() ) - p = n ? GetParagraph( --n ) : NULL; + std::vector<Paragraph*>::const_reverse_iterator iter = std::find(maEntries.rbegin(), + maEntries.rend(), + pPara); + for (; iter != maEntries.rend(); ++iter) + { + if ((*iter)->IsVisible()) + break; + } - return p; + return iter != maEntries.rend() ? *iter : NULL; } Paragraph* ParagraphList::LastVisible() const { - ULONG n = GetParagraphCount(); - - Paragraph* p = n ? GetParagraph( --n ) : NULL; - while ( p && !p->IsVisible() ) - p = n ? GetParagraph( --n ) : NULL; + std::vector<Paragraph*>::const_reverse_iterator iter; + for (iter = maEntries.rbegin(); iter != maEntries.rend(); ++iter) + { + if ((*iter)->IsVisible()) + break; + } - return p; + return iter != maEntries.rend() ? *iter : NULL; } -BOOL ParagraphList::HasChilds( Paragraph* pParagraph ) const +sal_Bool ParagraphList::HasChilds( Paragraph* pParagraph ) const { - ULONG n = GetAbsPos( pParagraph ); + sal_uLong n = GetAbsPos( pParagraph ); Paragraph* pNext = GetParagraph( ++n ); - return ( pNext && ( pNext->GetDepth() > pParagraph->GetDepth() ) ) ? TRUE : FALSE; + return ( pNext && ( pNext->GetDepth() > pParagraph->GetDepth() ) ) ? sal_True : sal_False; } -BOOL ParagraphList::HasHiddenChilds( Paragraph* pParagraph ) const +sal_Bool ParagraphList::HasHiddenChilds( Paragraph* pParagraph ) const { - ULONG n = GetAbsPos( pParagraph ); + sal_uLong n = GetAbsPos( pParagraph ); Paragraph* pNext = GetParagraph( ++n ); - return ( pNext && ( pNext->GetDepth() > pParagraph->GetDepth() ) && !pNext->IsVisible() ) ? TRUE : FALSE; + return ( pNext && ( pNext->GetDepth() > pParagraph->GetDepth() ) && !pNext->IsVisible() ) ? sal_True : sal_False; } -BOOL ParagraphList::HasVisibleChilds( Paragraph* pParagraph ) const +sal_Bool ParagraphList::HasVisibleChilds( Paragraph* pParagraph ) const { - ULONG n = GetAbsPos( pParagraph ); + sal_uLong n = GetAbsPos( pParagraph ); Paragraph* pNext = GetParagraph( ++n ); - return ( pNext && ( pNext->GetDepth() > pParagraph->GetDepth() ) && pNext->IsVisible() ) ? TRUE : FALSE; + return ( pNext && ( pNext->GetDepth() > pParagraph->GetDepth() ) && pNext->IsVisible() ) ? sal_True : sal_False; } -ULONG ParagraphList::GetChildCount( Paragraph* pParent ) const +sal_uLong ParagraphList::GetChildCount( Paragraph* pParent ) const { - ULONG nChildCount = 0; - ULONG n = GetAbsPos( pParent ); + sal_uLong nChildCount = 0; + sal_uLong n = GetAbsPos( pParent ); Paragraph* pPara = GetParagraph( ++n ); while ( pPara && ( pPara->GetDepth() > pParent->GetDepth() ) ) { @@ -227,10 +254,10 @@ ULONG ParagraphList::GetChildCount( Paragraph* pParent ) const return nChildCount; } -Paragraph* ParagraphList::GetParent( Paragraph* pParagraph /*, USHORT& rRelPos */ ) const +Paragraph* ParagraphList::GetParent( Paragraph* pParagraph /*, sal_uInt16& rRelPos */ ) const { /* rRelPos = 0 */; - ULONG n = GetAbsPos( pParagraph ); + sal_uLong n = GetAbsPos( pParagraph ); Paragraph* pPrev = GetParagraph( --n ); while ( pPrev && ( pPrev->GetDepth() >= pParagraph->GetDepth() ) ) { @@ -244,15 +271,15 @@ Paragraph* ParagraphList::GetParent( Paragraph* pParagraph /*, USHORT& rRelPos * void ParagraphList::Expand( Paragraph* pParent ) { - ULONG nChildCount = GetChildCount( pParent ); - ULONG nPos = GetAbsPos( pParent ); + sal_uLong nChildCount = GetChildCount( pParent ); + sal_uLong nPos = GetAbsPos( pParent ); - for ( ULONG n = 1; n <= nChildCount; n++ ) + for ( sal_uLong n = 1; n <= nChildCount; n++ ) { Paragraph* pPara = GetParagraph( nPos+n ); if ( !( pPara->IsVisible() ) ) { - pPara->bVisible = TRUE; + pPara->bVisible = sal_True; aVisibleStateChangedHdl.Call( pPara ); } } @@ -260,30 +287,46 @@ void ParagraphList::Expand( Paragraph* pParent ) void ParagraphList::Collapse( Paragraph* pParent ) { - ULONG nChildCount = GetChildCount( pParent ); - ULONG nPos = GetAbsPos( pParent ); + sal_uLong nChildCount = GetChildCount( pParent ); + sal_uLong nPos = GetAbsPos( pParent ); - for ( ULONG n = 1; n <= nChildCount; n++ ) + for ( sal_uLong n = 1; n <= nChildCount; n++ ) { Paragraph* pPara = GetParagraph( nPos+n ); if ( pPara->IsVisible() ) { - pPara->bVisible = FALSE; + pPara->bVisible = sal_False; aVisibleStateChangedHdl.Call( pPara ); } } } -ULONG ParagraphList::GetVisPos( Paragraph* pPara ) +sal_uLong ParagraphList::GetAbsPos( Paragraph* pParent ) const +{ + sal_uLong pos = 0; + std::vector<Paragraph*>::const_iterator iter; + for (iter = maEntries.begin(); iter != maEntries.end(); ++iter, ++pos) + { + if (*iter == pParent) + return pos; + } + + return ~0; +} + +sal_uLong ParagraphList::GetVisPos( Paragraph* pPara ) const { - ULONG nVisPos = 0; - ULONG nPos = GetAbsPos( pPara ); - for ( ULONG n = 0; n < nPos; n++ ) + sal_uLong nVisPos = 0; + std::vector<Paragraph*>::const_iterator iter; + for (iter = maEntries.begin(); iter != maEntries.end(); ++iter, ++nVisPos) { - Paragraph* _pPara = GetParagraph( n ); - if ( _pPara->IsVisible() ) - nVisPos++; + if (*iter == pPara) + break; + + if ((*iter)->IsVisible()) + ++nVisPos; } + return nVisPos; } diff --git a/editeng/source/outliner/paralist.hxx b/editeng/source/outliner/paralist.hxx index 355979e86a..f95ee37fd4 100644 --- a/editeng/source/outliner/paralist.hxx +++ b/editeng/source/outliner/paralist.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -29,44 +29,55 @@ #ifndef _PARALIST_HXX #define _PARALIST_HXX -class Paragraph; +#include <vector> -#include <tools/list.hxx> #include <tools/link.hxx> -class ParagraphList : private List -{ -private: - Link aVisibleStateChangedHdl; +class Paragraph; +class ParagraphList +{ public: - void Clear( BOOL bDestroyParagraphs ); + void Clear( sal_Bool bDestroyParagraphs ); + + sal_uInt32 GetParagraphCount() const + { + return maEntries.size(); + } - ULONG GetParagraphCount() const { return List::Count(); } - Paragraph* GetParagraph( ULONG nPos ) const { return (Paragraph*)List::GetObject( nPos ); } + Paragraph* GetParagraph( sal_uLong nPos ) const + { + return nPos < maEntries.size() ? maEntries[nPos] : NULL; + } - ULONG GetAbsPos( Paragraph* pParent ) const { return List::GetPos( pParent ); } - ULONG GetVisPos( Paragraph* pParagraph ); + sal_uLong GetAbsPos( Paragraph* pParent ) const; + sal_uLong GetVisPos( Paragraph* pParagraph ) const; - void Insert( Paragraph* pPara, ULONG nAbsPos = LIST_APPEND ) { List::Insert( pPara, nAbsPos ); } - void Remove( ULONG nPara ) { List::Remove( nPara ); } - void MoveParagraphs( ULONG nStart, ULONG nDest, ULONG nCount ); + void Append( Paragraph *pPara); + void Insert( Paragraph* pPara, sal_uLong nAbsPos); + void Remove( sal_uLong nPara ); + void MoveParagraphs( sal_uLong nStart, sal_uLong nDest, sal_uLong nCount ); Paragraph* NextVisible( Paragraph* ) const; Paragraph* PrevVisible( Paragraph* ) const; Paragraph* LastVisible() const; - Paragraph* GetParent( Paragraph* pParagraph /*, USHORT& rRelPos */ ) const; - BOOL HasChilds( Paragraph* pParagraph ) const; - BOOL HasHiddenChilds( Paragraph* pParagraph ) const; - BOOL HasVisibleChilds( Paragraph* pParagraph ) const; - ULONG GetChildCount( Paragraph* pParagraph ) const; + Paragraph* GetParent( Paragraph* pParagraph /*, sal_uInt16& rRelPos */ ) const; + sal_Bool HasChilds( Paragraph* pParagraph ) const; + sal_Bool HasHiddenChilds( Paragraph* pParagraph ) const; + sal_Bool HasVisibleChilds( Paragraph* pParagraph ) const; + sal_uLong GetChildCount( Paragraph* pParagraph ) const; void Expand( Paragraph* pParent ); void Collapse( Paragraph* pParent ); void SetVisibleStateChangedHdl( const Link& rLink ) { aVisibleStateChangedHdl = rLink; } Link GetVisibleStateChangedHdl() const { return aVisibleStateChangedHdl; } + +private: + + Link aVisibleStateChangedHdl; + std::vector<Paragraph*> maEntries; }; #endif diff --git a/editeng/source/rtf/rtfgrf.cxx b/editeng/source/rtf/rtfgrf.cxx index b7f1162aba..6c9d9b18bb 100644 --- a/editeng/source/rtf/rtfgrf.cxx +++ b/editeng/source/rtf/rtfgrf.cxx @@ -41,44 +41,12 @@ using namespace ::rtl; -#ifndef DBG_UTIL -#undef DEBUG_JP -#endif - -#ifdef DEBUG_JP - -#include <tools/fsys.hxx> - -class GrfWindow : public WorkWindow -{ - Graphic aGrf; -public: - GrfWindow( const Graphic& rGrf ); - virtual void Paint( const Rectangle& rRect ); -}; - -GrfWindow::GrfWindow( const Graphic& rGrf ) - : WorkWindow( NULL ), - aGrf( rGrf ) -{ - SetPosSizePixel( Point( 100, 0 ), Size( 300, 300 )); - Show(); - Invalidate(); - Update(); -} - -void GrfWindow::Paint( const Rectangle& ) -{ - aGrf.Draw( this, Point(0,0), GetSizePixel() ); -} -#endif - -static BYTE __FAR_DATA aPal1[ 2 * 4 ] = { - 0x00, 0x00, 0x00, 0x00, // Schwarz - 0xFF, 0xFF, 0xFF, 0x00 // Weiss +static sal_uInt8 aPal1[ 2 * 4 ] = { + 0x00, 0x00, 0x00, 0x00, // Black + 0xFF, 0xFF, 0xFF, 0x00 // White }; -static BYTE __FAR_DATA aPal4[ 16 * 4 ] = { +static sal_uInt8 aPal4[ 16 * 4 ] = { 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, @@ -97,7 +65,7 @@ static BYTE __FAR_DATA aPal4[ 16 * 4 ] = { 0xFF, 0xFF, 0xFF, 0x00 }; -static BYTE __FAR_DATA aPal8[ 256 * 4 ] = +static sal_uInt8 aPal8[ 256 * 4 ] = { 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x80, 0x92, 0x00, 0x00, 0x00, 0x00, 0xAA, 0x00, 0x80, 0x00, 0xAA, 0x00, @@ -213,14 +181,14 @@ inline short SwapShort( short n ) static void WriteBMPHeader( SvStream& rStream, const SvxRTFPictureType& rPicType ) { - ULONG n4Width = rPicType.nWidth; - ULONG n4Height = rPicType.nHeight; - USHORT n4ColBits = rPicType.nBitsPerPixel; + sal_uInt32 n4Width = rPicType.nWidth; + sal_uInt32 n4Height = rPicType.nHeight; + sal_uInt16 n4ColBits = rPicType.nBitsPerPixel; - USHORT nColors = (1 << n4ColBits); // Anzahl der Farben ( 1, 16, 256 ) - USHORT nWdtOut = rPicType.nWidthBytes; + sal_uInt16 nColors = (1 << n4ColBits); // Number of colors (1, 16, 256) + sal_uInt16 nWdtOut = rPicType.nWidthBytes; if( !nWdtOut ) - nWdtOut = (USHORT)((( n4Width * n4ColBits + 31 ) / 32 ) * 4 ); + nWdtOut = (sal_uInt16)((( n4Width * n4ColBits + 31 ) / 32 ) * 4 ); long nOffset = 14 + 40; // BMP_FILE_HD_SIZ + sizeof(*pBmpInfo); if( 256 >= nColors ) @@ -228,14 +196,14 @@ static void WriteBMPHeader( SvStream& rStream, long nSize = nOffset + nWdtOut * n4Height; rStream << "BM" // = "BM" << SwapLong(nSize) // Filesize in Bytes - << SwapShort(0) // Reserviert - << SwapShort(0) // Reserviert + << SwapShort(0) // Reserved + << SwapShort(0) // Reserved << SwapLong(nOffset); // Offset? rStream << SwapLong(40) // sizeof( BmpInfo ) << SwapLong(n4Width) << SwapLong(n4Height) - << (USHORT)1 + << (sal_uInt16)1 << n4ColBits << SwapLong(0) << SwapLong(0) @@ -257,21 +225,19 @@ static void WriteBMPHeader( SvStream& rStream, } } -/* */ - - // wandel die ASCII-HexCodes in binaere Zeichen um. Werden - // ungueltige Daten gefunden (Zeichen ausser 0-9|a-f|A-F, so - // wird USHRT_MAX returnt, ansonsten die Anzahl der umgewandelten Ze. + // Converts the ASCII characters to hexadecimal codes in binary. + // If invalid data is found (eg. characters outside 0-9|a-f|A-F), then + // USHRT_MAX is returned, else the number of converted charachters. xub_StrLen SvxRTFParser::HexToBin( String& rToken ) { - // dann mache aus den Hex-Werten mal "Binare Daten" - // (missbrauche den String als temp Buffer) - if( rToken.Len() & 1 ) // ungerade Anzahl, mit 0 auffuellen + // then create "Binary data" from the hex values. + // (missuse the String as temp Buffer) + if( rToken.Len() & 1 ) // odd number, fill out with 0 rToken += '0'; xub_StrLen n, nLen; sal_Unicode nVal; - BOOL bValidData = TRUE; + sal_Bool bValidData = sal_True; const sal_Unicode* pStr = rToken.GetBufferAccess(); sal_Char* pData = (sal_Char*)pStr; for( n = 0, nLen = rToken.Len(); n < nLen; ++n, ++pStr ) @@ -284,8 +250,8 @@ xub_StrLen SvxRTFParser::HexToBin( String& rToken ) nVal -= 'a' - 10; else { - DBG_ASSERT( !this, "ungueltiger Hex-Wert" ); - bValidData = FALSE; + DBG_ASSERT( !this, "invalid Hex value" ); + bValidData = sal_False; break; } @@ -298,11 +264,10 @@ xub_StrLen SvxRTFParser::HexToBin( String& rToken ) return bValidData ? nLen / 2 : STRING_NOTFOUND; } -BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) +sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) { - // die alten Daten loeschen + // Delete the old data rGrf.Clear(); -// ULONG nBmpSize = 0; rtl_TextEncoding eOldEnc = GetSrcEncoding(); SetSrcEncoding( RTL_TEXTENCODING_MS_1252 ); @@ -312,7 +277,7 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) int nToken = 0; bool bValidBmp = true, bFirstTextToken = true; - int _nOpenBrakets = 1, // die erste wurde schon vorher erkannt !! + int _nOpenBrakets = 1, // the first was already recognized before! nValidDataBraket = 1; if( RTF_SHPPICT == GetStackPtr(0)->nTokenId ) @@ -322,7 +287,7 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) while( _nOpenBrakets && IsParserWorking() && bValidBmp ) { nToken = GetNextToken(); - USHORT nVal = USHORT( nTokenValue ); + sal_uInt16 nVal = sal_uInt16( nTokenValue ); switch( nToken ) { case '}': @@ -359,7 +324,7 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) case RTF_MACPICT: { rPicType.eStyle = SvxRTFPictureType::MAC_QUICKDRAW; - // Mac-Pict bekommt einen leeren Header voran + // Mac-Pict gets a empty header above pTmpFile = new SvCacheStream; ByteString aStr; aStr.Fill( 512, '\0' ); @@ -423,11 +388,9 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) rPicType.uPicLen = nTokenValue; if (rPicType.uPicLen) { - ULONG nPos = rStrm.Tell(); - nPos = nPos; rStrm.SeekRel(-1); sal_uInt8 aData[4096]; - ULONG nSize = sizeof(aData); + sal_uInt32 nSize = sizeof(aData); while (rPicType.uPicLen > 0) { @@ -440,8 +403,6 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) } nNextCh = GetNextChar(); bValidBmp = !pTmpFile->GetError(); - nPos = rStrm.Tell(); - nPos = nPos; } break; case RTF_PICSCALEX: rPicType.nScalX = nVal; break; @@ -471,9 +432,6 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) nToken = SkipToken( -1 ); break; case RTF_TEXTTOKEN: - // JP 26.06.98: Bug #51719# - nur TextToken auf 1. Ebene - // auswerten. Alle anderen sind irgendwelche - // nicht auszuwertende Daten if( nValidDataBraket != _nOpenBrakets ) break; @@ -482,21 +440,21 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) switch( rPicType.eStyle ) { case SvxRTFPictureType::RTF_BITMAP: - // erstmal die Header und Info-Struktur schreiben + // first write the header and the info structure if( pTmpFile ) ::WriteBMPHeader( *pTmpFile, rPicType ); break; default: break; } - bFirstTextToken = FALSE; + bFirstTextToken = sal_False; } if( pTmpFile && SvxRTFPictureType::HEX_MODE == rPicType.nMode ) { xub_StrLen nTokenLen = HexToBin( aToken ); if( STRING_NOTFOUND == nTokenLen ) - bValidBmp = FALSE; + bValidBmp = sal_False; else { pTmpFile->Write( (sal_Char*)aToken.GetBuffer(), @@ -517,12 +475,12 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) if( bValidBmp ) { GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); - USHORT nImportFilter = GRFILTER_FORMAT_DONTKNOW; + sal_uInt16 nImportFilter = GRFILTER_FORMAT_DONTKNOW; if( pFilterNm ) { String sTmp; - for( USHORT n = pGF->GetImportFormatCount(); n; ) + for( sal_uInt16 n = pGF->GetImportFormatCount(); n; ) { sTmp = pGF->GetImportFormatShortName( --n ); if( sTmp.EqualsAscii( pFilterNm )) @@ -544,7 +502,7 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) if( !bValidBmp ) { rGrf.Clear(); - //TODO If nToken were not initialized to 0 above, it would potentially + // TODO: If nToken were not initialized to 0 above, it would potentially // be used uninitialized here (if IsParserWorking() is false at the // start of the while loop above): if( '}' != nToken ) @@ -554,7 +512,6 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) { switch( rPicType.eStyle ) { -//?? ENHANCED_MF, // in den Pict.Daten steht ein Enhanced-Metafile case SvxRTFPictureType::RTF_PNG: case SvxRTFPictureType::RTF_JPG: { @@ -566,22 +523,18 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) else aSize = OutputDevice::LogicToLogic( aSize, rGrf.GetPrefMapMode(), aMap ); - rPicType.nWidth = sal::static_int_cast< USHORT >(aSize.Width()); - rPicType.nHeight = sal::static_int_cast< USHORT >( + rPicType.nWidth = sal::static_int_cast< sal_uInt16 >(aSize.Width()); + rPicType.nHeight = sal::static_int_cast< sal_uInt16 >( aSize.Height()); } break; default: break; } - -#ifdef DEBUG_JP - new GrfWindow( rGrf ); -#endif } SetSrcEncoding( eOldEnc ); - SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet + SkipToken( -1 ); // the closing brace is evaluated "above" return bValidBmp; } diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index a1fa4aa9e6..f482e560f8 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -95,17 +95,18 @@ #define BRACELEFT '{' #define BRACERIGHT '}' +using namespace editeng; -// einige Hilfs-Funktionen +// Some helper functions // char -inline const SvxEscapementItem& GetEscapement(const SfxItemSet& rSet,USHORT nId,BOOL bInP=TRUE) +inline const SvxEscapementItem& GetEscapement(const SfxItemSet& rSet,sal_uInt16 nId,sal_Bool bInP=sal_True) { return (const SvxEscapementItem&)rSet.Get( nId,bInP); } -inline const SvxLineSpacingItem& GetLineSpacing(const SfxItemSet& rSet,USHORT nId,BOOL bInP=TRUE) +inline const SvxLineSpacingItem& GetLineSpacing(const SfxItemSet& rSet,sal_uInt16 nId,sal_Bool bInP=sal_True) { return (const SvxLineSpacingItem&)rSet.Get( nId,bInP); } // frm -inline const SvxLRSpaceItem& GetLRSpace(const SfxItemSet& rSet,USHORT nId,BOOL bInP=TRUE) +inline const SvxLRSpaceItem& GetLRSpace(const SfxItemSet& rSet,sal_uInt16 nId,sal_Bool bInP=sal_True) { return (const SvxLRSpaceItem&)rSet.Get( nId,bInP); } -inline const SvxULSpaceItem& GetULSpace(const SfxItemSet& rSet,USHORT nId,BOOL bInP=TRUE) +inline const SvxULSpaceItem& GetULSpace(const SfxItemSet& rSet,sal_uInt16 nId,sal_Bool bInP=sal_True) { return (const SvxULSpaceItem&)rSet.Get( nId,bInP); } #define PARDID ((RTFPardAttrMapIds*)aPardMap.GetData()) @@ -114,7 +115,7 @@ inline const SvxULSpaceItem& GetULSpace(const SfxItemSet& rSet,USHORT nId,BOOL b void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet, SfxPoolItem& rItem ) { - const USHORT *pNormal = 0, *pCJK = 0, *pCTL = 0; + const sal_uInt16 *pNormal = 0, *pCJK = 0, *pCTL = 0; const RTFPlainAttrMapIds* pIds = (RTFPlainAttrMapIds*)aPlainMap.GetData(); switch( rItem.Which() ) { @@ -217,31 +218,31 @@ void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet, void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) { - DBG_ASSERT( pSet, "Es muss ein SfxItemSet uebergeben werden!" ); - int bFirstToken = TRUE, bWeiter = TRUE; - USHORT nStyleNo = 0; // default + DBG_ASSERT( pSet, "A SfxItemSet has to be provided as argument!" ); + int bFirstToken = sal_True, bWeiter = sal_True; + sal_uInt16 nStyleNo = 0; // default FontUnderline eUnderline; FontUnderline eOverline; FontEmphasisMark eEmphasis; - bPardTokenRead = FALSE; + bPardTokenRead = sal_False; RTF_CharTypeDef eCharType = NOTDEF_CHARTYPE; - USHORT nFontAlign; + sal_uInt16 nFontAlign; - int bChkStkPos = !bNewGroup && aAttrStack.Top(); + int bChkStkPos = !bNewGroup && !aAttrStack.empty(); - while( bWeiter && IsParserWorking() ) // solange bekannte Attribute erkannt werden + while( bWeiter && IsParserWorking() ) // as long as known Attribute are recognized { switch( nToken ) { case RTF_PARD: - RTFPardPlain( TRUE, &pSet ); + RTFPardPlain( sal_True, &pSet ); ResetPard(); nStyleNo = 0; - bPardTokenRead = TRUE; + bPardTokenRead = sal_True; break; case RTF_PLAIN: - RTFPardPlain( FALSE, &pSet ); + RTFPardPlain( sal_False, &pSet ); break; default: @@ -249,7 +250,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( !bChkStkPos ) break; - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); if( !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pAkt->nSttCnt == pInsPos->GetCntIdx() )) break; @@ -261,25 +262,25 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( pAkt->aAttrSet.Count() || pAkt->pChildList || pAkt->nStyleNo ) { - // eine neue Gruppe aufmachen + // Open a new Group SvxRTFItemStackType* pNew = new SvxRTFItemStackType( - *pAkt, *pInsPos, TRUE ); + *pAkt, *pInsPos, sal_True ); pNew->SetRTFDefaults( GetRTFDefaults() ); - // alle bis hierher gueltigen Attribute "setzen" + // "Set" all valid attributes up until this point AttrGroupEnd(); - pAkt = aAttrStack.Top(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); - aAttrStack.Push( pNew ); + aAttrStack.push_back( pNew ); pAkt = pNew; } else - // diesen Eintrag als neuen weiterbenutzen + // continue to use this entry as a new one pAkt->SetStartPos( *pInsPos ); pSet = &pAkt->aAttrSet; - } while( FALSE ); + } while( sal_False ); switch( nToken ) { @@ -297,18 +298,18 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) { if( !bFirstToken ) SkipToken( -1 ); - bWeiter = FALSE; + bWeiter = sal_False; } else { - nStyleNo = -1 == nTokenValue ? 0 : USHORT(nTokenValue); + nStyleNo = -1 == nTokenValue ? 0 : sal_uInt16(nTokenValue); // setze am akt. auf dem AttrStack stehenden Style die // StyleNummer - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); if( !pAkt ) break; - pAkt->nStyleNo = USHORT( nStyleNo ); + pAkt->nStyleNo = sal_uInt16( nStyleNo ); } break; @@ -316,14 +317,14 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) case RTF_KEEP: if( PARDID->nSplit ) { - pSet->Put( SvxFmtSplitItem( FALSE, PARDID->nSplit )); + pSet->Put( SvxFmtSplitItem( sal_False, PARDID->nSplit )); } break; case RTF_KEEPN: if( PARDID->nKeep ) { - pSet->Put( SvxFmtKeepItem( TRUE, PARDID->nKeep )); + pSet->Put( SvxFmtKeepItem( sal_True, PARDID->nKeep )); } break; @@ -331,7 +332,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( PARDID->nOutlineLvl ) { pSet->Put( SfxUInt16Item( PARDID->nOutlineLvl, - (UINT16)nTokenValue )); + (sal_uInt16)nTokenValue )); } break; @@ -364,12 +365,12 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( PARDID->nLRSpace ) { SvxLRSpaceItem aLR( GetLRSpace(*pSet, PARDID->nLRSpace )); - USHORT nSz = 0; + sal_uInt16 nSz = 0; if( -1 != nTokenValue ) { if( IsCalcValue() ) CalcValue(); - nSz = USHORT(nTokenValue); + nSz = sal_uInt16(nTokenValue); } aLR.SetTxtFirstLineOfst( nSz ); pSet->Put( aLR ); @@ -381,12 +382,12 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( PARDID->nLRSpace ) { SvxLRSpaceItem aLR( GetLRSpace(*pSet, PARDID->nLRSpace )); - USHORT nSz = 0; + sal_uInt16 nSz = 0; if( 0 < nTokenValue ) { if( IsCalcValue() ) CalcValue(); - nSz = USHORT(nTokenValue); + nSz = sal_uInt16(nTokenValue); } aLR.SetTxtLeft( nSz ); pSet->Put( aLR ); @@ -398,12 +399,12 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( PARDID->nLRSpace ) { SvxLRSpaceItem aLR( GetLRSpace(*pSet, PARDID->nLRSpace )); - USHORT nSz = 0; + sal_uInt16 nSz = 0; if( 0 < nTokenValue ) { if( IsCalcValue() ) CalcValue(); - nSz = USHORT(nTokenValue); + nSz = sal_uInt16(nTokenValue); } aLR.SetRight( nSz ); pSet->Put( aLR ); @@ -414,12 +415,12 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( PARDID->nULSpace ) { SvxULSpaceItem aUL( GetULSpace(*pSet, PARDID->nULSpace )); - USHORT nSz = 0; + sal_uInt16 nSz = 0; if( 0 < nTokenValue ) { if( IsCalcValue() ) CalcValue(); - nSz = USHORT(nTokenValue); + nSz = sal_uInt16(nTokenValue); } aUL.SetUpper( nSz ); pSet->Put( aUL ); @@ -430,12 +431,12 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( PARDID->nULSpace ) { SvxULSpaceItem aUL( GetULSpace(*pSet, PARDID->nULSpace )); - USHORT nSz = 0; + sal_uInt16 nSz = 0; if( 0 < nTokenValue ) { if( IsCalcValue() ) CalcValue(); - nSz = USHORT(nTokenValue); + nSz = sal_uInt16(nTokenValue); } aUL.SetLower( nSz ); pSet->Put( aUL ); @@ -445,14 +446,14 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) case RTF_SLMULT: if( PARDID->nLinespacing && 1 == nTokenValue ) { - // dann wird auf mehrzeilig umgeschaltet! + // then switches to multi-line! SvxLineSpacingItem aLSpace( GetLineSpacing( *pSet, - PARDID->nLinespacing, FALSE )); + PARDID->nLinespacing, sal_False )); - // wieviel bekommt man aus dem LineHeight Wert heraus + // how much do you get from the line height value? - // Proportionale-Groesse: - // D.H. das Verhaeltnis ergibt sich aus ( n / 240 ) Twips + // Proportional-Size: + // Ie, the ratio is (n / 240) twips nTokenValue = 240; if( IsCalcValue() ) @@ -461,10 +462,10 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) nTokenValue = short( 100L * aLSpace.GetLineHeight() / long( nTokenValue ) ); - if( nTokenValue > 200 ) // Datenwert fuer PropLnSp - nTokenValue = 200; // ist ein BYTE !!! + if( nTokenValue > 200 ) // Data value for PropLnSp + nTokenValue = 200; // is one BYTE !!! - aLSpace.SetPropLineSpace( (const BYTE)nTokenValue ); + aLSpace.SetPropLineSpace( (const sal_uInt8)nTokenValue ); aLSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; pSet->Put( aLSpace ); @@ -474,9 +475,9 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) case RTF_SL: if( PARDID->nLinespacing ) { - // errechne das Verhaeltnis aus dem default Font zu der - // Size Angabe. Der Abstand besteht aus der Zeilenhoehe - // (100%) und dem Leerraum ueber der Zeile (20%). + // Calculate the ratio between the default font and the + // specified size. The distance consists of the line height + // (100%) and the space above the line (20%). SvxLineSpacingItem aLSpace(0, PARDID->nLinespacing); nTokenValue = !bTokenHasValue ? 0 : nTokenValue; @@ -502,7 +503,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) CalcValue(); if (eLnSpc != SVX_LINE_SPACE_AUTO) - aLSpace.SetLineHeight( (const USHORT)nTokenValue ); + aLSpace.SetLineHeight( (const sal_uInt16)nTokenValue ); aLSpace.GetLineSpaceRule() = eLnSpc; pSet->Put(aLSpace); @@ -512,14 +513,14 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) case RTF_NOCWRAP: if( PARDID->nForbRule ) { - pSet->Put( SvxForbiddenRuleItem( FALSE, + pSet->Put( SvxForbiddenRuleItem( sal_False, PARDID->nForbRule )); } break; case RTF_NOOVERFLOW: if( PARDID->nHangPunct ) { - pSet->Put( SvxHangingPunctuationItem( FALSE, + pSet->Put( SvxHangingPunctuationItem( sal_False, PARDID->nHangPunct )); } break; @@ -527,7 +528,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) case RTF_ASPALPHA: if( PARDID->nScriptSpace ) { - pSet->Put( SvxScriptSpaceItem( TRUE, + pSet->Put( SvxScriptSpaceItem( sal_True, PARDID->nScriptSpace )); } break; @@ -551,10 +552,9 @@ SET_FONTALIGNMENT: } break; -/* */ case RTF_B: case RTF_AB: - if( IsAttrSttPos() ) // nicht im Textfluss ? + if( IsAttrSttPos() ) // not in the text flow? { SvxWeightItem aTmpItem( @@ -567,7 +567,7 @@ SET_FONTALIGNMENT: case RTF_CAPS: case RTF_SCAPS: if( PLAINID->nCaseMap && - IsAttrSttPos() ) // nicht im Textfluss ? + IsAttrSttPos() ) // not in the text flow? { SvxCaseMap eCaseMap; if( !nTokenValue ) @@ -585,14 +585,14 @@ SET_FONTALIGNMENT: case RTF_SUB: if( PLAINID->nEscapement ) { - const USHORT nEsc = PLAINID->nEscapement; + const sal_uInt16 nEsc = PLAINID->nEscapement; if( -1 == nTokenValue || RTF_SUB == nToken ) nTokenValue = 6; if( IsCalcValue() ) CalcValue(); - const SvxEscapementItem& rOld = GetEscapement( *pSet, nEsc, FALSE ); + const SvxEscapementItem& rOld = GetEscapement( *pSet, nEsc, sal_False ); short nEs; - BYTE nProp; + sal_uInt8 nProp; if( DFLT_ESC_AUTO_SUPER == rOld.GetEsc() ) { nEs = DFLT_ESC_AUTO_SUB; @@ -610,7 +610,7 @@ SET_FONTALIGNMENT: case RTF_NOSUPERSUB: if( PLAINID->nEscapement ) { - const USHORT nEsc = PLAINID->nEscapement; + const sal_uInt16 nEsc = PLAINID->nEscapement; pSet->Put( SvxEscapementItem( nEsc )); } break; @@ -656,7 +656,7 @@ SET_FONTALIGNMENT: case RTF_F: case RTF_AF: { - const Font& rSVFont = GetFont( USHORT(nTokenValue) ); + const Font& rSVFont = GetFont( sal_uInt16(nTokenValue) ); SvxFontItem aTmpItem( rSVFont.GetFamily(), rSVFont.GetName(), rSVFont.GetStyleName(), rSVFont.GetPitch(), rSVFont.GetCharSet(), @@ -684,7 +684,7 @@ SET_FONTALIGNMENT: // if( IsCalcValue() ) // CalcValue(); SvxFontHeightItem aTmpItem( - (const USHORT)nTokenValue, 100, + (const sal_uInt16)nTokenValue, 100, SID_ATTR_CHAR_FONTHEIGHT ); SetScriptAttr( eCharType, *pSet, aTmpItem ); } @@ -692,7 +692,7 @@ SET_FONTALIGNMENT: case RTF_I: case RTF_AI: - if( IsAttrSttPos() ) // nicht im Textfluss ? + if( IsAttrSttPos() ) // not in the text flow? { SvxPostureItem aTmpItem( nTokenValue ? ITALIC_NORMAL : ITALIC_NONE, @@ -703,25 +703,25 @@ SET_FONTALIGNMENT: case RTF_OUTL: if( PLAINID->nContour && - IsAttrSttPos() ) // nicht im Textfluss ? + IsAttrSttPos() ) // not in the text flow? { - pSet->Put( SvxContourItem( nTokenValue ? TRUE : FALSE, + pSet->Put( SvxContourItem( nTokenValue ? sal_True : sal_False, PLAINID->nContour )); } break; case RTF_SHAD: if( PLAINID->nShadowed && - IsAttrSttPos() ) // nicht im Textfluss ? + IsAttrSttPos() ) // not in the text flow? { - pSet->Put( SvxShadowedItem( nTokenValue ? TRUE : FALSE, + pSet->Put( SvxShadowedItem( nTokenValue ? sal_True : sal_False, PLAINID->nShadowed )); } break; case RTF_STRIKE: if( PLAINID->nCrossedOut && - IsAttrSttPos() ) // nicht im Textfluss ? + IsAttrSttPos() ) // not in the text flow? { pSet->Put( SvxCrossedOutItem( nTokenValue ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, @@ -730,7 +730,7 @@ SET_FONTALIGNMENT: break; case RTF_STRIKED: - if( PLAINID->nCrossedOut ) // nicht im Textfluss ? + if( PLAINID->nCrossedOut ) // not in the text flow? { pSet->Put( SvxCrossedOutItem( nTokenValue ? STRIKEOUT_DOUBLE : STRIKEOUT_NONE, @@ -798,7 +798,7 @@ SET_FONTALIGNMENT: if( PLAINID->nWordlineMode ) { - pSet->Put( SvxWordLineModeItem( TRUE, PLAINID->nWordlineMode )); + pSet->Put( SvxWordLineModeItem( sal_True, PLAINID->nWordlineMode )); } goto ATTR_SETUNDERLINE; @@ -815,7 +815,7 @@ ATTR_SETUNDERLINE: SvxUnderlineItem aUL( UNDERLINE_SINGLE, PLAINID->nUnderline ); const SfxPoolItem* pItem; if( SFX_ITEM_SET == pSet->GetItemState( - PLAINID->nUnderline, FALSE, &pItem ) ) + PLAINID->nUnderline, sal_False, &pItem ) ) { // is switched off ? if( UNDERLINE_NONE == @@ -824,11 +824,11 @@ ATTR_SETUNDERLINE: aUL = *(SvxUnderlineItem*)pItem; } else - aUL = (const SvxUnderlineItem&)pSet->Get( PLAINID->nUnderline, FALSE ); + aUL = (const SvxUnderlineItem&)pSet->Get( PLAINID->nUnderline, sal_False ); if( UNDERLINE_NONE == aUL.GetLineStyle() ) aUL.SetLineStyle( UNDERLINE_SINGLE ); - aUL.SetColor( GetColor( USHORT(nTokenValue) )); + aUL.SetColor( GetColor( sal_uInt16(nTokenValue) )); pSet->Put( aUL ); } break; @@ -893,7 +893,7 @@ ATTR_SETUNDERLINE: if( PLAINID->nWordlineMode ) { - pSet->Put( SvxWordLineModeItem( TRUE, PLAINID->nWordlineMode )); + pSet->Put( SvxWordLineModeItem( sal_True, PLAINID->nWordlineMode )); } goto ATTR_SETOVERLINE; @@ -910,7 +910,7 @@ ATTR_SETOVERLINE: SvxOverlineItem aOL( UNDERLINE_SINGLE, PLAINID->nOverline ); const SfxPoolItem* pItem; if( SFX_ITEM_SET == pSet->GetItemState( - PLAINID->nOverline, FALSE, &pItem ) ) + PLAINID->nOverline, sal_False, &pItem ) ) { // is switched off ? if( UNDERLINE_NONE == @@ -919,11 +919,11 @@ ATTR_SETOVERLINE: aOL = *(SvxOverlineItem*)pItem; } else - aOL = (const SvxOverlineItem&)pSet->Get( PLAINID->nUnderline, FALSE ); + aOL = (const SvxOverlineItem&)pSet->Get( PLAINID->nUnderline, sal_False ); if( UNDERLINE_NONE == aOL.GetLineStyle() ) aOL.SetLineStyle( UNDERLINE_SINGLE ); - aOL.SetColor( GetColor( USHORT(nTokenValue) )); + aOL.SetColor( GetColor( sal_uInt16(nTokenValue) )); pSet->Put( aOL ); } break; @@ -932,14 +932,14 @@ ATTR_SETOVERLINE: case RTF_SUPER: if( PLAINID->nEscapement ) { - const USHORT nEsc = PLAINID->nEscapement; + const sal_uInt16 nEsc = PLAINID->nEscapement; if( -1 == nTokenValue || RTF_SUPER == nToken ) nTokenValue = 6; if( IsCalcValue() ) CalcValue(); - const SvxEscapementItem& rOld = GetEscapement( *pSet, nEsc, FALSE ); + const SvxEscapementItem& rOld = GetEscapement( *pSet, nEsc, sal_False ); short nEs; - BYTE nProp; + sal_uInt8 nProp; if( DFLT_ESC_AUTO_SUB == rOld.GetEsc() ) { nEs = DFLT_ESC_AUTO_SUPER; @@ -957,12 +957,21 @@ ATTR_SETOVERLINE: case RTF_CF: if( PLAINID->nColor ) { - pSet->Put( SvxColorItem( GetColor( USHORT(nTokenValue) ), + pSet->Put( SvxColorItem( GetColor( sal_uInt16(nTokenValue) ), PLAINID->nColor )); } break; //#i12501# While cb is clearly documented in the rtf spec, word //doesn't accept it at all +#if 0 + case RTF_CB: + if( PLAINID->nBgColor ) + { + pSet->Put( SvxBrushItem( GetColor( sal_uInt16(nTokenValue) ), + PLAINID->nBgColor )); + } + break; +#endif case RTF_LANG: if( PLAINID->nLanguage ) @@ -988,10 +997,10 @@ ATTR_SETOVERLINE: break; case RTF_RTLCH: - bIsLeftToRightDef = FALSE; + bIsLeftToRightDef = sal_False; break; case RTF_LTRCH: - bIsLeftToRightDef = TRUE; + bIsLeftToRightDef = sal_True; break; case RTF_RTLPAR: if (PARDID->nDirection) @@ -1042,7 +1051,7 @@ ATTR_SETEMPHASIS: default: cStt = 0, cEnd = 0; break; } - pSet->Put( SvxTwoLinesItem( TRUE, cStt, cEnd, + pSet->Put( SvxTwoLinesItem( sal_True, cStt, cEnd, PLAINID->nTwoLines )); } break; @@ -1053,7 +1062,7 @@ ATTR_SETEMPHASIS: //i21372 if (nTokenValue < 1 || nTokenValue > 600) nTokenValue = 100; - pSet->Put( SvxCharScaleWidthItem( USHORT(nTokenValue), + pSet->Put( SvxCharScaleWidthItem( sal_uInt16(nTokenValue), PLAINID->nCharScaleX )); } break; @@ -1107,12 +1116,9 @@ ATTR_SETEMPHASIS: ReadBackgroundAttr( nToken, *pSet ); break; - -/* */ - case BRACELEFT: { - // teste auf Swg-Interne Tokens + // tests on Swg internal tokens bool bHandled = false; short nSkip = 0; if( RTF_IGNOREFLAG != GetNextToken()) @@ -1126,16 +1132,16 @@ ATTR_SETEMPHASIS: case RTF_PGBRK: case RTF_SOUTLVL: UnknownAttrToken( nToken, pSet ); - // ueberlese die schliessende Klammer + // overwrite the closing parenthesis break; case RTF_SWG_ESCPROP: { - // prozentuale Veraenderung speichern ! - BYTE nProp = BYTE( nTokenValue / 100 ); + // Store percentage change! + sal_uInt8 nProp = sal_uInt8( nTokenValue / 100 ); short nEsc = 0; if( 1 == ( nTokenValue % 100 )) - // Erkennung unseres AutoFlags! + // Recognize own auto-flags! nEsc = DFLT_ESC_AUTO_SUPER; if( PLAINID->nEscapement ) @@ -1147,10 +1153,10 @@ ATTR_SETEMPHASIS: case RTF_HYPHEN: { SvxHyphenZoneItem aHypenZone( - (nTokenValue & 1) ? TRUE : FALSE, + (nTokenValue & 1) ? sal_True : sal_False, PARDID->nHyphenzone ); aHypenZone.SetPageEnd( - (nTokenValue & 2) ? TRUE : FALSE ); + (nTokenValue & 2) ? sal_True : sal_False ); if( PARDID->nHyphenzone && RTF_HYPHLEAD == GetNextToken() && @@ -1158,40 +1164,37 @@ ATTR_SETEMPHASIS: RTF_HYPHMAX == GetNextToken() ) { aHypenZone.GetMinLead() = - BYTE(GetStackPtr( -2 )->nTokenValue); + sal_uInt8(GetStackPtr( -2 )->nTokenValue); aHypenZone.GetMinTrail() = - BYTE(GetStackPtr( -1 )->nTokenValue); + sal_uInt8(GetStackPtr( -1 )->nTokenValue); aHypenZone.GetMaxHyphens() = - BYTE(nTokenValue); + sal_uInt8(nTokenValue); pSet->Put( aHypenZone ); } else - SkipGroup(); // ans Ende der Gruppe + SkipGroup(); // at the end of the group } break; case RTF_SHADOW: { - int bSkip = TRUE; + int bSkip = sal_True; do { // middle check loop SvxShadowLocation eSL = SvxShadowLocation( nTokenValue ); if( RTF_SHDW_DIST != GetNextToken() ) break; - USHORT nDist = USHORT( nTokenValue ); + sal_uInt16 nDist = sal_uInt16( nTokenValue ); if( RTF_SHDW_STYLE != GetNextToken() ) break; - //! (pb) class Brush removed -> obsolete - //! BrushStyle eStyle = BrushStyle( nTokenValue ); if( RTF_SHDW_COL != GetNextToken() ) break; - USHORT nCol = USHORT( nTokenValue ); + sal_uInt16 nCol = sal_uInt16( nTokenValue ); if( RTF_SHDW_FCOL != GetNextToken() ) break; -// USHORT nFillCol = USHORT( nTokenValue ); Color aColor = GetColor( nCol ); @@ -1199,11 +1202,11 @@ ATTR_SETEMPHASIS: pSet->Put( SvxShadowItem( PARDID->nShadow, &aColor, nDist, eSL ) ); - bSkip = FALSE; - } while( FALSE ); + bSkip = sal_False; + } while( sal_False ); if( bSkip ) - SkipGroup(); // ans Ende der Gruppe + SkipGroup(); // at the end of the group } break; @@ -1236,7 +1239,7 @@ ATTR_SETEMPHASIS: nToken = SkipToken( -2 ); ReadBorderAttr( nToken, *pSet ); } - else // also kein Attribut mehr + else // so no more attribute nSkip = -2; break; } @@ -1258,12 +1261,12 @@ ATTR_SETEMPHASIS: else nSkip = -2; - if( nSkip ) // alles voellig unbekannt + if( nSkip ) // all completely unknown { if (!bFirstToken) - --nSkip; // BRACELEFT: ist das naechste Token + --nSkip; // BRACELEFT: is the next token SkipToken( nSkip ); - bWeiter = FALSE; + bWeiter = sal_False; } } break; @@ -1276,10 +1279,10 @@ ATTR_SETEMPHASIS: ReadBackgroundAttr( nToken, *pSet ); else { - // kenne das Token nicht also das Token "in den Parser zurueck" + // unknown token, so token "returned in Parser" if( !bFirstToken ) SkipToken( -1 ); - bWeiter = FALSE; + bWeiter = sal_False; } } } @@ -1287,43 +1290,17 @@ ATTR_SETEMPHASIS: { nToken = GetNextToken(); } - bFirstToken = FALSE; - } - -/* - // teste Attribute gegen ihre Styles - if( IsChkStyleAttr() && pSet->Count() && !pInsPos->GetCntIdx() ) - { - SvxRTFStyleType* pStyle = aStyleTbl.Get( nStyleNo ); - if( pStyle && pStyle->aAttrSet.Count() ) - { - // alle Attribute, die schon vom Style definiert sind, aus dem - // akt. Set entfernen - const SfxPoolItem* pItem; - SfxItemIter aIter( *pSet ); - USHORT nWhich = aIter.GetCurItem()->Which(); - while( TRUE ) - { - if( SFX_ITEM_SET == pStyle->aAttrSet.GetItemState( - nWhich, FALSE, &pItem ) && *pItem == *aIter.GetCurItem()) - pSet->ClearItem( nWhich ); // loeschen - - if( aIter.IsAtEnd() ) - break; - nWhich = aIter.NextItem()->Which(); - } - } + bFirstToken = sal_False; } -*/ } void SvxRTFParser::ReadTabAttr( int nToken, SfxItemSet& rSet ) { bool bMethodOwnsToken = false; // #i52542# patch from cmc. -// dann lese doch mal alle TabStops ein +// then read all the TabStops SvxTabStop aTabStop; SvxTabStopItem aAttr( 0, 0, SVX_TAB_ADJUST_DEFAULT, PARDID->nTabStop ); - int bWeiter = TRUE; + int bWeiter = sal_True; do { switch( nToken ) { @@ -1334,7 +1311,7 @@ void SvxRTFParser::ReadTabAttr( int nToken, SfxItemSet& rSet ) CalcValue(); aTabStop.GetTabPos() = nTokenValue; aAttr.Insert( aTabStop ); - aTabStop = SvxTabStop(); // alle Werte default + aTabStop = SvxTabStop(); // all values default } break; @@ -1359,7 +1336,7 @@ void SvxRTFParser::ReadTabAttr( int nToken, SfxItemSet& rSet ) case BRACELEFT: { - // Swg - Kontrol BRACELEFT RTF_IGNOREFLAG RTF_TLSWG BRACERIGHT + // Swg - control BRACELEFT RTF_IGNOREFLAG RTF_TLSWG BRACERIGHT short nSkip = 0; if( RTF_IGNOREFLAG != GetNextToken() ) nSkip = -1; @@ -1367,22 +1344,22 @@ void SvxRTFParser::ReadTabAttr( int nToken, SfxItemSet& rSet ) nSkip = -2; else { - aTabStop.GetDecimal() = BYTE(nTokenValue & 0xff); - aTabStop.GetFill() = BYTE((nTokenValue >> 8) & 0xff); - // ueberlese noch die schliessende Klammer + aTabStop.GetDecimal() = sal_uInt8(nTokenValue & 0xff); + aTabStop.GetFill() = sal_uInt8((nTokenValue >> 8) & 0xff); + // overwrite the closing parenthesis if (bMethodOwnsToken) GetNextToken(); } if( nSkip ) { - SkipToken( nSkip ); // Ignore wieder zurueck - bWeiter = FALSE; + SkipToken( nSkip ); // Ignore back again + bWeiter = sal_False; } } break; default: - bWeiter = FALSE; + bWeiter = sal_False; } if( bWeiter ) { @@ -1391,7 +1368,7 @@ void SvxRTFParser::ReadTabAttr( int nToken, SfxItemSet& rSet ) } } while( bWeiter ); - // mit Defaults aufuellen fehlt noch !!! + // Fill with defaults is still missing! rSet.Put( aAttr ); SkipToken( -1 ); } @@ -1401,7 +1378,7 @@ static void SetBorderLine( int nBorderTyp, SvxBoxItem& rItem, { switch( nBorderTyp ) { - case RTF_BOX: // alle Stufen durchlaufen + case RTF_BOX: // run through all levels case RTF_BRDRT: rItem.SetLine( &rBorder, BOX_LINE_TOP ); @@ -1428,14 +1405,17 @@ static void SetBorderLine( int nBorderTyp, SvxBoxItem& rItem, void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet, int bTableDef ) { - // dann lese doch mal das BoderAttribut ein + // then read the border attribute SvxBoxItem aAttr( PARDID->nBox ); const SfxPoolItem* pItem; - if( SFX_ITEM_SET == rSet.GetItemState( PARDID->nBox, FALSE, &pItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState( PARDID->nBox, sal_False, &pItem ) ) aAttr = *(SvxBoxItem*)pItem; - SvxBorderLine aBrd( 0, DEF_LINE_WIDTH_0, 0, 0 ); // einfache Linien - int bWeiter = TRUE, nBorderTyp = 0; + SvxBorderLine aBrd( 0, DEF_LINE_WIDTH_0 ); // Simple plain line + int bWeiter = sal_True, nBorderTyp = 0; + + long nWidth = 1; + bool bDoubleWidth = false; do { switch( nToken ) @@ -1446,249 +1426,128 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet, case RTF_BRDRL: case RTF_BRDRR: nBorderTyp = nToken; - goto SETBORDER; + break; - case RTF_CLBRDRT: - if( !bTableDef ) + case RTF_CLBRDRT: // Cell top border + { + if( bTableDef ) + nBorderTyp = RTF_BRDRT; break; - nBorderTyp = RTF_BRDRT; - goto SETBORDER; - case RTF_CLBRDRB: - if( !bTableDef ) + } + case RTF_CLBRDRB: // Cell bottom border + { + if( bTableDef ) + nBorderTyp = RTF_BRDRB; break; - nBorderTyp = RTF_BRDRB; - goto SETBORDER; - case RTF_CLBRDRL: - if( !bTableDef ) + } + case RTF_CLBRDRL: // Cell left border + { + if( bTableDef ) + nBorderTyp = RTF_BRDRL; break; - nBorderTyp = RTF_BRDRL; - goto SETBORDER; - case RTF_CLBRDRR: - if( !bTableDef ) + } + case RTF_CLBRDRR: // Cell right border + { + if( bTableDef ) + nBorderTyp = RTF_BRDRR; break; - nBorderTyp = RTF_BRDRR; - goto SETBORDER; + } -SETBORDER: + case RTF_BRDRDOT: // dotted border + aBrd.SetStyle( DOTTED ); + break; + case RTF_BRDRDASH: // dashed border + aBrd.SetStyle( DASHED ); + break; + case RTF_BRDRHAIR: // hairline border { - // auf defaults setzen - aBrd.SetOutWidth( DEF_LINE_WIDTH_0 ); - aBrd.SetInWidth( 0 ); - aBrd.SetDistance( 0 ); - aBrd.SetColor( Color( COL_BLACK ) ); + aBrd.SetStyle( SOLID ); + aBrd.SetWidth( DEF_LINE_WIDTH_0 ); } break; + case RTF_BRDRDB: // Double border + aBrd.SetStyle( DOUBLE ); + break; + case RTF_BRDRINSET: // inset border + aBrd.SetStyle( INSET ); + break; + case RTF_BRDROUTSET: // outset border + aBrd.SetStyle( OUTSET ); + break; + case RTF_BRDRTNTHSG: // ThinThick Small gap + aBrd.SetStyle( THINTHICK_SMALLGAP ); + break; + case RTF_BRDRTNTHMG: // ThinThick Medium gap + aBrd.SetStyle( THINTHICK_MEDIUMGAP ); + break; + case RTF_BRDRTNTHLG: // ThinThick Large gap + aBrd.SetStyle( THINTHICK_LARGEGAP ); + break; + case RTF_BRDRTHTNSG: // ThickThin Small gap + aBrd.SetStyle( THICKTHIN_SMALLGAP ); + break; + case RTF_BRDRTHTNMG: // ThickThin Medium gap + aBrd.SetStyle( THICKTHIN_MEDIUMGAP ); + break; + case RTF_BRDRTHTNLG: // ThickThin Large gap + aBrd.SetStyle( THICKTHIN_LARGEGAP ); + break; + case RTF_BRDREMBOSS: // Embossed border + aBrd.SetStyle( EMBOSSED ); + break; + case RTF_BRDRENGRAVE: // Engraved border + aBrd.SetStyle( ENGRAVED ); + break; + case RTF_BRDRS: // single thickness border + bDoubleWidth = false; + break; + case RTF_BRDRTH: // double thickness border width*2 + bDoubleWidth = true; + break; + case RTF_BRDRW: // border width <255 + nWidth = nTokenValue; + break; -// werden noch nicht ausgewertet - case RTF_BRSP: + case RTF_BRDRCF: // Border color + aBrd.SetColor( GetColor( sal_uInt16(nTokenValue) ) ); + break; + + case RTF_BRDRSH: // Shadowed border + rSet.Put( SvxShadowItem( PARDID->nShadow, (Color*) 0, 60 /*3pt*/, + SVX_SHADOW_BOTTOMRIGHT ) ); + break; + + case RTF_BRSP: // Spacing to content in twip { switch( nBorderTyp ) { case RTF_BRDRB: - aAttr.SetDistance( (USHORT)nTokenValue, BOX_LINE_BOTTOM ); + aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_BOTTOM ); break; case RTF_BRDRT: - aAttr.SetDistance( (USHORT)nTokenValue, BOX_LINE_TOP ); + aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_TOP ); break; case RTF_BRDRL: - aAttr.SetDistance( (USHORT)nTokenValue, BOX_LINE_LEFT ); + aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_LEFT ); break; case RTF_BRDRR: - aAttr.SetDistance( (USHORT)nTokenValue, BOX_LINE_RIGHT ); + aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_RIGHT ); break; case RTF_BOX: - aAttr.SetDistance( (USHORT)nTokenValue ); + aAttr.SetDistance( (sal_uInt16)nTokenValue ); break; } } break; -case RTF_BRDRBTW: -case RTF_BRDRBAR: break; - - - case RTF_BRDRCF: - { - aBrd.SetColor( GetColor( USHORT(nTokenValue) ) ); - SetBorderLine( nBorderTyp, aAttr, aBrd ); - } - break; - - case RTF_BRDRTH: - aBrd.SetOutWidth( DEF_LINE_WIDTH_1 ); - aBrd.SetInWidth( 0 ); - aBrd.SetDistance( 0 ); - goto SETBORDERLINE; - - case RTF_BRDRDB: - aBrd.SetOutWidth( DEF_DOUBLE_LINE0_OUT ); - aBrd.SetInWidth( DEF_DOUBLE_LINE0_IN ); - aBrd.SetDistance( DEF_DOUBLE_LINE0_DIST ); - goto SETBORDERLINE; - - case RTF_BRDRSH: - // schattierte Box - { - rSet.Put( SvxShadowItem( PARDID->nShadow, (Color*) 0, 60 /*3pt*/, - SVX_SHADOW_BOTTOMRIGHT ) ); - } - break; - - case RTF_BRDRW: - if( -1 != nTokenValue ) - { - // sollte es eine "dicke" Linie sein ? - if( DEF_LINE_WIDTH_0 != aBrd.GetOutWidth() ) - nTokenValue *= 2; - - // eine Doppelline? - if( aBrd.GetInWidth() ) - { - // WinWord - Werte an StarOffice anpassen - if( nTokenValue < DEF_LINE_WIDTH_1 - (DEF_LINE_WIDTH_1/10)) - { - aBrd.SetOutWidth( DEF_DOUBLE_LINE0_OUT ); - aBrd.SetInWidth( DEF_DOUBLE_LINE0_IN ); - aBrd.SetDistance( DEF_DOUBLE_LINE0_DIST ); - } - else - if( nTokenValue < DEF_LINE_WIDTH_2 - (DEF_LINE_WIDTH_2/10)) - { - aBrd.SetOutWidth( DEF_DOUBLE_LINE1_OUT ); - aBrd.SetInWidth( DEF_DOUBLE_LINE1_IN ); - aBrd.SetDistance( DEF_DOUBLE_LINE1_DIST ); - } - else - { - aBrd.SetOutWidth( DEF_DOUBLE_LINE2_OUT ); - aBrd.SetInWidth( DEF_DOUBLE_LINE2_IN ); - aBrd.SetDistance( DEF_DOUBLE_LINE2_DIST ); - } - } - else - { - // WinWord - Werte an StarOffice anpassen - if( nTokenValue < DEF_LINE_WIDTH_1 - (DEF_LINE_WIDTH_1/10)) - aBrd.SetOutWidth( DEF_LINE_WIDTH_0 ); - else - if( nTokenValue < DEF_LINE_WIDTH_2 - (DEF_LINE_WIDTH_2/10)) - aBrd.SetOutWidth( DEF_LINE_WIDTH_1 ); - else - if( nTokenValue < DEF_LINE_WIDTH_3 - (DEF_LINE_WIDTH_3/10)) - aBrd.SetOutWidth( DEF_LINE_WIDTH_2 ); - else - if( nTokenValue < DEF_LINE_WIDTH_4 ) - aBrd.SetOutWidth( DEF_LINE_WIDTH_3 ); - else - aBrd.SetOutWidth( DEF_LINE_WIDTH_4 ); - } - } - goto SETBORDERLINE; - - case RTF_BRDRDOT: - aBrd.SetStyle( DOTTED ); - break; - case RTF_BRDRDASH: - aBrd.SetStyle( DASHED ); - break; - case RTF_BRDRS: - case RTF_BRDRHAIR: - aBrd.SetStyle( SOLID ); -SETBORDERLINE: - SetBorderLine( nBorderTyp, aAttr, aBrd ); - break; - - case BRACELEFT: - { - short nSkip = 0; - if( RTF_IGNOREFLAG != GetNextToken() ) - nSkip = -1; - else - { - int bSwgControl = TRUE, bFirstToken = TRUE; - nToken = GetNextToken(); - do { - switch( nToken ) - { - case RTF_BRDBOX: - aAttr.SetDistance( USHORT(nTokenValue) ); - break; - - case RTF_BRDRT: - case RTF_BRDRB: - case RTF_BRDRR: - case RTF_BRDRL: - nBorderTyp = nToken; - bFirstToken = FALSE; - if( RTF_BRDLINE_COL != GetNextToken() ) - { - bSwgControl = FALSE; - break; - } - aBrd.SetColor( GetColor( USHORT(nTokenValue) )); - - if( RTF_BRDLINE_IN != GetNextToken() ) - { - bSwgControl = FALSE; - break; - } - aBrd.SetInWidth( USHORT(nTokenValue)); - - if( RTF_BRDLINE_OUT != GetNextToken() ) - { - bSwgControl = FALSE; - break; - } - aBrd.SetOutWidth( USHORT(nTokenValue)); - - if( RTF_BRDLINE_DIST != GetNextToken() ) - { - bSwgControl = FALSE; - break; - } - aBrd.SetDistance( USHORT(nTokenValue)); - SetBorderLine( nBorderTyp, aAttr, aBrd ); - break; - - default: - bSwgControl = FALSE; - break; - } - - if( bSwgControl ) - { - nToken = GetNextToken(); - bFirstToken = FALSE; - } - } while( bSwgControl ); - - // Ende der Swg-Gruppe - // -> lese noch die schliessende Klammer - if( BRACERIGHT == nToken ) - ; - else if( !bFirstToken ) - { - // es ist ein Parser-Fehler, springe zum - // Ende der Gruppe - SkipGroup(); - // schliessende BRACERIGHT ueberspringen - GetNextToken(); - } - else - nSkip = -2; - } - - if( nSkip ) - { - SkipToken( nSkip ); // Ignore wieder zurueck - bWeiter = FALSE; - } - } + case RTF_BRDRBTW: // Border formatting group + case RTF_BRDRBAR: // Border outside + // TODO unhandled ATM break; default: @@ -1697,11 +1556,18 @@ SETBORDERLINE: if( bWeiter ) nToken = GetNextToken(); } while( bWeiter ); + + // Finally compute the border width + if ( bDoubleWidth ) nWidth *= 2; + aBrd.SetWidth( nWidth ); + + SetBorderLine( nBorderTyp, aAttr, aBrd ); + rSet.Put( aAttr ); SkipToken( -1 ); } -inline ULONG CalcShading( ULONG nColor, ULONG nFillColor, BYTE nShading ) +inline sal_uInt32 CalcShading( sal_uInt32 nColor, sal_uInt32 nFillColor, sal_uInt8 nShading ) { nColor = (nColor * nShading) / 100; nFillColor = (nFillColor * ( 100 - nShading )) / 100; @@ -1711,12 +1577,12 @@ inline ULONG CalcShading( ULONG nColor, ULONG nFillColor, BYTE nShading ) void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet, int bTableDef ) { - // dann lese doch mal das BoderAttribut ein - int bWeiter = TRUE; - USHORT nColor = USHRT_MAX, nFillColor = USHRT_MAX; - BYTE nFillValue = 0; + // then read the border attribute + int bWeiter = sal_True; + sal_uInt16 nColor = USHRT_MAX, nFillColor = USHRT_MAX; + sal_uInt8 nFillValue = 0; - USHORT nWh = ( nToken & ~0xff ) == RTF_CHRFMT + sal_uInt16 nWh = ( nToken & ~0xff ) == RTF_CHRFMT ? PLAINID->nBgColor : PARDID->nBrush; @@ -1726,19 +1592,19 @@ void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet, case RTF_CLCBPAT: case RTF_CHCBPAT: case RTF_CBPAT: - nFillColor = USHORT( nTokenValue ); + nFillColor = sal_uInt16( nTokenValue ); break; case RTF_CLCFPAT: case RTF_CHCFPAT: case RTF_CFPAT: - nColor = USHORT( nTokenValue ); + nColor = sal_uInt16( nTokenValue ); break; case RTF_CLSHDNG: case RTF_CHSHDNG: case RTF_SHADING: - nFillValue = (BYTE)( nTokenValue / 100 ); + nFillValue = (sal_uInt8)( nTokenValue / 100 ); break; case RTF_CLBGDKHOR: @@ -1798,7 +1664,7 @@ void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet, Color aCol( COL_WHITE ), aFCol; if( !nFillValue ) { - // es wurde nur eine von beiden Farben angegeben oder kein BrushTyp + // there was only one of two colors specified or no BrushTyp if( USHRT_MAX != nFillColor ) { nFillValue = 100; @@ -1825,9 +1691,9 @@ void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet, aColor = aCol; else aColor = Color( - (BYTE)CalcShading( aCol.GetRed(), aFCol.GetRed(), nFillValue ), - (BYTE)CalcShading( aCol.GetGreen(), aFCol.GetGreen(), nFillValue ), - (BYTE)CalcShading( aCol.GetBlue(), aFCol.GetBlue(), nFillValue ) ); + (sal_uInt8)CalcShading( aCol.GetRed(), aFCol.GetRed(), nFillValue ), + (sal_uInt8)CalcShading( aCol.GetGreen(), aFCol.GetGreen(), nFillValue ), + (sal_uInt8)CalcShading( aCol.GetBlue(), aFCol.GetBlue(), nFillValue ) ); rSet.Put( SvxBrushItem( aColor, nWh ) ); SkipToken( -1 ); @@ -1837,44 +1703,44 @@ void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet, // pard / plain abarbeiten void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) { - if( !bNewGroup && aAttrStack.Top() ) // nicht am Anfang einer neuen Gruppe + if( !bNewGroup && !aAttrStack.empty() ) // not at the beginning of a new group { - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.back(); int nLastToken = GetStackPtr(-1)->nTokenId; - int bNewStkEntry = TRUE; + int bNewStkEntry = sal_True; if( RTF_PARD != nLastToken && RTF_PLAIN != nLastToken && BRACELEFT != nLastToken ) { if( pAkt->aAttrSet.Count() || pAkt->pChildList || pAkt->nStyleNo ) { - // eine neue Gruppe aufmachen - SvxRTFItemStackType* pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, TRUE ); + // open a new group + SvxRTFItemStackType* pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, sal_True ); pNew->SetRTFDefaults( GetRTFDefaults() ); - // alle bis hierher gueltigen Attribute "setzen" + // Set all until here valid attributes AttrGroupEnd(); - pAkt = aAttrStack.Top(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); - aAttrStack.Push( pNew ); + aAttrStack.push_back( pNew ); pAkt = pNew; } else { - // diesen Eintrag als neuen weiterbenutzen + // continue to use this entry as new pAkt->SetStartPos( *pInsPos ); - bNewStkEntry = FALSE; + bNewStkEntry = sal_False; } } - // jetzt noch alle auf default zuruecksetzen + // now reset all to default if( bNewStkEntry && ( pAkt->aAttrSet.GetParent() || pAkt->aAttrSet.Count() )) { const SfxPoolItem *pItem, *pDef; - const USHORT* pPtr; - USHORT nCnt; + const sal_uInt16* pPtr; + sal_uInt16 nCnt; const SfxItemSet* pDfltSet = &GetRTFDefaults(); if( bPard ) { @@ -1888,12 +1754,9 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) nCnt = aPlainMap.Count(); } - for( USHORT n = 0; n < nCnt; ++n, ++pPtr ) + for( sal_uInt16 n = 0; n < nCnt; ++n, ++pPtr ) { - // Item gesetzt und unterschiedlich -> das Pooldefault setzen - //JP 06.04.98: bei Items die nur SlotItems sind, darf nicht - // auf das Default zugefriffen werden. Diese - // werden gecleart + // Item set and different -> Set the Default Pool if( !*pPtr ) ; else if( SFX_WHICH_MAX < *pPtr ) @@ -1903,19 +1766,19 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) else if( !pAkt->aAttrSet.GetParent() ) { if( SFX_ITEM_SET == - pDfltSet->GetItemState( *pPtr, FALSE, &pDef )) + pDfltSet->GetItemState( *pPtr, sal_False, &pDef )) pAkt->aAttrSet.Put( *pDef ); else pAkt->aAttrSet.ClearItem( *pPtr ); } else if( SFX_ITEM_SET == pAkt->aAttrSet.GetParent()-> - GetItemState( *pPtr, TRUE, &pItem ) && + GetItemState( *pPtr, sal_True, &pItem ) && *( pDef = &pDfltSet->Get( *pPtr )) != *pItem ) pAkt->aAttrSet.Put( *pDef ); else { if( SFX_ITEM_SET == - pDfltSet->GetItemState( *pPtr, FALSE, &pDef )) + pDfltSet->GetItemState( *pPtr, sal_False, &pDef )) pAkt->aAttrSet.Put( *pDef ); else pAkt->aAttrSet.ClearItem( *pPtr ); @@ -1923,7 +1786,7 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) } } else if( bPard ) - pAkt->nStyleNo = 0; // Style-Nummer zuruecksetzen + pAkt->nStyleNo = 0; // reset Style number *ppSet = &pAkt->aAttrSet; @@ -1934,7 +1797,7 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) //we can fall back to the ansicpg set codeset if (nDfltFont != -1) { - const Font& rSVFont = GetFont(USHORT(nDfltFont)); + const Font& rSVFont = GetFont(sal_uInt16(nDfltFont)); SetEncoding(rSVFont.GetCharSet()); } else @@ -1949,16 +1812,16 @@ void SvxRTFParser::SetDefault( int nToken, int nValue ) return; SfxItemSet aTmp( *pAttrPool, aWhichMap.GetData() ); - BOOL bOldFlag = bIsLeftToRightDef; - bIsLeftToRightDef = TRUE; + sal_Bool bOldFlag = bIsLeftToRightDef; + bIsLeftToRightDef = sal_True; switch( nToken ) { - case RTF_ADEFF: bIsLeftToRightDef = FALSE; // no break! + case RTF_ADEFF: bIsLeftToRightDef = sal_False; // no break! case RTF_DEFF: { if( -1 == nValue ) nValue = 0; - const Font& rSVFont = GetFont( USHORT(nValue) ); + const Font& rSVFont = GetFont( sal_uInt16(nValue) ); SvxFontItem aTmpItem( rSVFont.GetFamily(), rSVFont.GetName(), rSVFont.GetStyleName(), rSVFont.GetPitch(), @@ -1967,9 +1830,9 @@ void SvxRTFParser::SetDefault( int nToken, int nValue ) } break; - case RTF_ADEFLANG: bIsLeftToRightDef = FALSE; // no break! + case RTF_ADEFLANG: bIsLeftToRightDef = sal_False; // no break! case RTF_DEFLANG: - // default Language merken + // store default Language if( -1 != nValue ) { SvxLanguageItem aTmpItem( (const LanguageType)nValue, @@ -1981,48 +1844,23 @@ void SvxRTFParser::SetDefault( int nToken, int nValue ) case RTF_DEFTAB: if( PARDID->nTabStop ) { - // RTF definiert 720 twips als default - bIsSetDfltTab = TRUE; + // RTF defines 720 twips as default + bIsSetDfltTab = sal_True; if( -1 == nValue || !nValue ) nValue = 720; - // wer keine Twips haben moechte ... + // who would like to have no twips ... if( IsCalcValue() ) { nTokenValue = nValue; CalcValue(); nValue = nTokenValue; } -#if 1 - /* - cmc: - This stuff looks a little hairy indeed, this should be totally - unnecessary where default tabstops are understood. Just make one - tabstop and stick the value in there, the first one is all that - matters. - - e.g. - - SvxTabStopItem aNewTab(1, USHORT(nValue), SVX_TAB_ADJUST_DEFAULT, - PARDID->nTabStop); - ((SvxTabStop&)aNewTab[0]).GetAdjustment() = SVX_TAB_ADJUST_DEFAULT; - - - It must exist as a foul hack to support somebody that does not - have a true concept of default tabstops by making a tabsetting - result from the default tabstop, creating a lot of them all at - the default locations to give the effect of the first real - default tabstop being in use just in case the receiving - application doesn't do that for itself. - */ -#endif - // Verhaeltnis der def. TabWidth / Tabs errechnen und - // enstsprechend die neue Anzahl errechnen. -/*-----------------14.12.94 19:32------------------- - ?? wie kommt man auf die 13 ?? ---------------------------------------------------*/ - USHORT nAnzTabs = (SVX_TAB_DEFDIST * 13 ) / USHORT(nValue); + // Calculate the ratio of default TabWidth / Tabs and + // calculate the corresponding new number. + // ?? how did one come up with 13 ?? + sal_uInt16 nAnzTabs = (SVX_TAB_DEFDIST * 13 ) / sal_uInt16(nValue); /* cmc, make sure we have at least one, or all hell breaks loose in everybodies exporters, #i8247# @@ -2030,8 +1868,8 @@ void SvxRTFParser::SetDefault( int nToken, int nValue ) if (nAnzTabs < 1) nAnzTabs = 1; - // wir wollen Defaulttabs - SvxTabStopItem aNewTab( nAnzTabs, USHORT(nValue), + // we want Defaulttabs + SvxTabStopItem aNewTab( nAnzTabs, sal_uInt16(nValue), SVX_TAB_ADJUST_DEFAULT, PARDID->nTabStop ); while( nAnzTabs ) ((SvxTabStop&)aNewTab[ --nAnzTabs ]).GetAdjustment() = SVX_TAB_ADJUST_DEFAULT; @@ -2046,7 +1884,7 @@ void SvxRTFParser::SetDefault( int nToken, int nValue ) { SfxItemIter aIter( aTmp ); const SfxPoolItem* pItem = aIter.GetCurItem(); - while( TRUE ) + while( sal_True ) { pAttrPool->SetPoolDefaultItem( *pItem ); if( aIter.IsAtEnd() ) @@ -2056,12 +1894,12 @@ void SvxRTFParser::SetDefault( int nToken, int nValue ) } } -// default: keine Umrechnung, alles bei Twips lassen. +// default: no conversion, leaving everything in twips. void SvxRTFParser::CalcValue() { } - // fuer Tokens, die im ReadAttr nicht ausgewertet werden +// for tokens that are not evaluated in ReadAttr void SvxRTFParser::UnknownAttrToken( int, SfxItemSet* ) { } diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index e9bc5e7371..0041f87fcf 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -53,7 +53,6 @@ using namespace ::com::sun::star; -SV_IMPL_PTRARR( SvxRTFColorTbl, ColorPtr ) SV_IMPL_PTRARR( SvxRTFItemStackList, SvxRTFItemStackType* ) CharSet lcl_GetDefaultTextEncodingForRTF() @@ -65,23 +64,22 @@ CharSet lcl_GetDefaultTextEncodingForRTF() aLocale = Application::GetSettings().GetLocale(); aLangString = aLocale.Language; - if ( aLangString.equals( ::rtl::OUString::createFromAscii( "ru" ) ) - || aLangString.equals( ::rtl::OUString::createFromAscii( "uk" ) ) ) + if ( aLangString.equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ru" )) ) + || aLangString.equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "uk" )) ) ) return RTL_TEXTENCODING_MS_1251; - if ( aLangString.equals( ::rtl::OUString::createFromAscii( "tr" ) ) ) + if ( aLangString.equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "tr" )) ) ) return RTL_TEXTENCODING_MS_1254; else return RTL_TEXTENCODING_MS_1252; } -// -------------- Methoden -------------------- +// -------------- Methods -------------------- SvxRTFParser::SvxRTFParser( SfxItemPool& rPool, SvStream& rIn, uno::Reference<document::XDocumentProperties> i_xDocProps, int bReadNewDoc ) : SvRTFParser( rIn, 5 ), rStrm(rIn), - aColorTbl( 16, 4 ), aFontTbl( 16, 4 ), pInsPos( 0 ), pAttrPool( &rPool ), @@ -91,18 +89,18 @@ SvxRTFParser::SvxRTFParser( SfxItemPool& rPool, SvStream& rIn, { bNewDoc = bReadNewDoc; - bChkStyleAttr = bCalcValue = bReadDocInfo = bIsInReadStyleTab = FALSE; - bIsLeftToRightDef = TRUE; + bChkStyleAttr = bCalcValue = bReadDocInfo = bIsInReadStyleTab = sal_False; + bIsLeftToRightDef = sal_True; { RTFPlainAttrMapIds aTmp( rPool ); - aPlainMap.Insert( (USHORT*)&aTmp, - sizeof( RTFPlainAttrMapIds ) / sizeof(USHORT), 0 ); + aPlainMap.Insert( (sal_uInt16*)&aTmp, + sizeof( RTFPlainAttrMapIds ) / sizeof(sal_uInt16), 0 ); } { RTFPardAttrMapIds aTmp( rPool ); - aPardMap.Insert( (USHORT*)&aTmp, - sizeof( RTFPardAttrMapIds ) / sizeof(USHORT), 0 ); + aPardMap.Insert( (sal_uInt16*)&aTmp, + sizeof( RTFPardAttrMapIds ) / sizeof(sal_uInt16), 0 ); } pDfltFont = new Font; pDfltColor = new Color; @@ -122,13 +120,13 @@ void SvxRTFParser::ResetPard() SvxRTFParser::~SvxRTFParser() { - if( aColorTbl.Count() ) + if( !aColorTbl.empty() ) ClearColorTbl(); if( aFontTbl.Count() ) ClearFontTbl(); if( aStyleTbl.Count() ) ClearStyleTbl(); - if( aAttrStack.Count() ) + if( !aAttrStack.empty() ) ClearAttrStack(); delete pRTFDefaults; @@ -147,27 +145,27 @@ void SvxRTFParser::SetInsPos( const SvxPosition& rNew ) SvParserState SvxRTFParser::CallParser() { - DBG_ASSERT( pInsPos, "keine Einfuegeposition" ); + DBG_ASSERT( pInsPos, "no insertion position"); if( !pInsPos ) return SVPAR_ERROR; - if( aColorTbl.Count() ) + if( !aColorTbl.empty() ) ClearColorTbl(); if( aFontTbl.Count() ) ClearFontTbl(); if( aStyleTbl.Count() ) ClearStyleTbl(); - if( aAttrStack.Count() ) + if( !aAttrStack.empty() ) ClearAttrStack(); - bIsSetDfltTab = FALSE; - bNewGroup = FALSE; + bIsSetDfltTab = sal_False; + bNewGroup = sal_False; nDfltFont = 0; sBaseURL.Erase(); - // erzeuge aus den gesetzten WhichIds die richtige WhichId-Tabelle. + // generate the correct WhichId table from the set WhichIds. BuildWhichTbl(); return SvRTFParser::CallParser(); @@ -186,7 +184,7 @@ void SvxRTFParser::Continue( int nToken ) } -// wird fuer jedes Token gerufen, das in CallParser erkannt wird +// is called for each token that is recognized in CallParser void SvxRTFParser::NextToken( int nToken ) { sal_Unicode cCh; @@ -200,10 +198,10 @@ void SvxRTFParser::NextToken( int nToken ) if( bNewDoc ) { if( aFontTbl.Count() ) - // koennen wir sofort setzen + // Can immediately be set SetDefault( nToken, nTokenValue ); else - // wird nach einlesen der Fonttabelle gesetzt + // is set after reading the font table nDfltFont = int(nTokenValue); } break; @@ -232,12 +230,12 @@ INSINGLECHAR: aToken = ByteString::ConvertToUnicode( (sal_Char)cCh, RTL_TEXTENCODING_MS_1252 ); - // kein Break, aToken wird als Text gesetzt + // no Break, aToken is set as Text case RTF_TEXTTOKEN: { InsertText(); - // alle angesammelten Attribute setzen - for( USHORT n = aAttrSetList.Count(); n; ) + // all collected Attributes are set + for( sal_uInt16 n = aAttrSetList.Count(); n; ) { SvxRTFItemStackType* pStkSet = aAttrSetList[--n]; SetAttrSet( *pStkSet ); @@ -251,30 +249,28 @@ INSINGLECHAR: InsertPara(); break; case '{': - if (bNewGroup) // Verschachtelung !! + if (bNewGroup) // Nesting! _GetAttrSet(); EnterEnvironment(); bNewGroup = true; break; case '}': - if( !bNewGroup ) // leere Gruppe ?? + if( !bNewGroup ) // Empty Group ?? AttrGroupEnd(); LeaveEnvironment(); bNewGroup = false; break; case RTF_INFO: -#ifndef SVX_LIGHT if (bReadDocInfo && bNewDoc && m_xDocProps.is()) ReadInfo(); else -#endif SkipGroup(); break; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // erstmal gesamt ueberlesen (muessen alle in einer Gruppe stehen !!) - // Koennen auch ohne dem IGNORE-Flag im RTF-File auftreten; alle Gruppen - // mit IGNORE-Flag werden im default-Zweig ueberlesen. + // First overwrite all (all have to be in one group!!) + // Could also appear in the RTF-filewithout the IGNORE-Flag; all Groups + // with the IGNORE-Flag are overwritten in the default branch. case RTF_SWG_PRTDATA: case RTF_FIELD: @@ -345,20 +341,20 @@ void SvxRTFParser::ReadStyleTable() { int nToken, bSaveChkStyleAttr = bChkStyleAttr; short nStyleNo = 0; - int _nOpenBrakets = 1; // die erste wurde schon vorher erkannt !! + int _nOpenBrakets = 1; // the first was already detected earlier!! SvxRTFStyleType* pStyle = new SvxRTFStyleType( *pAttrPool, aWhichMap.GetData() ); pStyle->aAttrSet.Put( GetRTFDefaults() ); - bIsInReadStyleTab = TRUE; - bChkStyleAttr = FALSE; // Attribute nicht gegen die Styles checken + bIsInReadStyleTab = sal_True; + bChkStyleAttr = sal_False; // Do not check Attribute against the Styles while( _nOpenBrakets && IsParserWorking() ) { switch( nToken = GetNextToken() ) { case '}': if( --_nOpenBrakets && IsParserWorking() ) - // Style konnte vollstaendig gelesen werden, - // also ist das noch ein stabiler Status + // Style has been completely read, + // so this is still a stable status SaveState( RTF_STYLESHEET ); break; case '{': @@ -370,7 +366,7 @@ void SvxRTFParser::ReadStyleTable() nToken = SkipToken( -2 ); else { - // gleich herausfiltern + // filter out at once ReadUnknownData(); nToken = GetNextToken(); if( '}' != nToken ) @@ -381,32 +377,26 @@ void SvxRTFParser::ReadStyleTable() } break; - case RTF_SBASEDON: pStyle->nBasedOn = USHORT(nTokenValue); pStyle->bBasedOnIsSet=TRUE; break; - case RTF_SNEXT: pStyle->nNext = USHORT(nTokenValue); break; + case RTF_SBASEDON: pStyle->nBasedOn = sal_uInt16(nTokenValue); pStyle->bBasedOnIsSet=sal_True; break; + case RTF_SNEXT: pStyle->nNext = sal_uInt16(nTokenValue); break; case RTF_OUTLINELEVEL: - case RTF_SOUTLVL: pStyle->nOutlineNo = BYTE(nTokenValue); break; + case RTF_SOUTLVL: pStyle->nOutlineNo = sal_uInt8(nTokenValue); break; case RTF_S: nStyleNo = (short)nTokenValue; break; case RTF_CS: nStyleNo = (short)nTokenValue; - pStyle->bIsCharFmt = TRUE; + pStyle->bIsCharFmt = sal_True; break; case RTF_TEXTTOKEN: { pStyle->sName = DelCharAtEnd( aToken, ';' ); -/* -??? soll man das umsetzen ??? - if( !pStyle->sName.Len() ) - pStyle->sName = "Standard"; -*/ - // sollte die Nummer doppelt vergeben werden ? if( aStyleTbl.Count() ) { SvxRTFStyleType* pOldSt = aStyleTbl.Remove( nStyleNo ); if( pOldSt ) delete pOldSt; } - // alle Daten vom Style vorhanden, also ab in die Tabelle + // All data from the font is available, so off to the table aStyleTbl.Insert( nStyleNo, pStyle ); pStyle = new SvxRTFStyleType( *pAttrPool, aWhichMap.GetData() ); pStyle->aAttrSet.Put( GetRTFDefaults() ); @@ -440,65 +430,65 @@ void SvxRTFParser::ReadStyleTable() break; } } - delete pStyle; // loesche das letze Style - SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet + delete pStyle; // Delete the Last Style + SkipToken( -1 ); // the closing brace is evaluated "above" - // Flag wieder auf alten Zustand + // Flag back to old state bChkStyleAttr = bSaveChkStyleAttr; - bIsInReadStyleTab = FALSE; + bIsInReadStyleTab = sal_False; } void SvxRTFParser::ReadColorTable() { int nToken; - BYTE nRed = 0xff, nGreen = 0xff, nBlue = 0xff; + sal_uInt8 nRed = 0xff, nGreen = 0xff, nBlue = 0xff; while( '}' != ( nToken = GetNextToken() ) && IsParserWorking() ) { switch( nToken ) { - case RTF_RED: nRed = BYTE(nTokenValue); break; - case RTF_GREEN: nGreen = BYTE(nTokenValue); break; - case RTF_BLUE: nBlue = BYTE(nTokenValue); break; + case RTF_RED: nRed = sal_uInt8(nTokenValue); break; + case RTF_GREEN: nGreen = sal_uInt8(nTokenValue); break; + case RTF_BLUE: nBlue = sal_uInt8(nTokenValue); break; - case RTF_TEXTTOKEN: // oder sollte irgendein Unsin darumstehen? + case RTF_TEXTTOKEN: if( 1 == aToken.Len() ? aToken.GetChar( 0 ) != ';' : STRING_NOTFOUND == aToken.Search( ';' ) ) - break; // es muss zumindestens das ';' gefunden werden + break; // At least the ';' must be found - // else kein break !! + // else no break !! case ';': if( IsParserWorking() ) { - // eine Farbe ist Fertig, in die Tabelle eintragen - // versuche die Werte auf SV interne Namen zu mappen + // one color is finished, fill in the table + // try to map the values to SV internal names ColorPtr pColor = new Color( nRed, nGreen, nBlue ); - if( !aColorTbl.Count() && - BYTE(-1) == nRed && BYTE(-1) == nGreen && BYTE(-1) == nBlue ) + if( aColorTbl.empty() && + sal_uInt8(-1) == nRed && sal_uInt8(-1) == nGreen && sal_uInt8(-1) == nBlue ) pColor->SetColor( COL_AUTO ); - aColorTbl.Insert( pColor, aColorTbl.Count() ); + aColorTbl.push_back( pColor ); nRed = 0, nGreen = 0, nBlue = 0; - // Color konnte vollstaendig gelesen werden, - // also ist das noch ein stabiler Status + // Color has been completely read, + // so this is still a stable status SaveState( RTF_COLORTBL ); } break; } } - SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet + SkipToken( -1 ); // the closing brace is evaluated "above" } void SvxRTFParser::ReadFontTable() { int nToken; - int _nOpenBrakets = 1; // die erste wurde schon vorher erkannt !! + int _nOpenBrakets = 1; // the first was already detected earlier!! Font* pFont = new Font(); short nFontNo(0), nInsFontNo (0); String sAltNm, sFntNm; - BOOL bIsAltFntNm = FALSE, bCheckNewFont; + sal_Bool bIsAltFntNm = sal_False, bCheckNewFont; CharSet nSystemChar = lcl_GetDefaultTextEncodingForRTF(); pFont->SetCharSet( nSystemChar ); @@ -506,30 +496,30 @@ void SvxRTFParser::ReadFontTable() while( _nOpenBrakets && IsParserWorking() ) { - bCheckNewFont = FALSE; + bCheckNewFont = sal_False; switch( ( nToken = GetNextToken() )) { case '}': - bIsAltFntNm = FALSE; - // Style konnte vollstaendig gelesen werden, - // also ist das noch ein stabiler Status + bIsAltFntNm = sal_False; + // Style has been completely read, + // so this is still a stable status if( --_nOpenBrakets <= 1 && IsParserWorking() ) SaveState( RTF_FONTTBL ); - bCheckNewFont = TRUE; + bCheckNewFont = sal_True; nInsFontNo = nFontNo; break; case '{': if( RTF_IGNOREFLAG != GetNextToken() ) nToken = SkipToken( -1 ); - // Unknown und alle bekannten nicht ausgewerteten Gruppen - // sofort ueberspringen + // immediately skip unknown and all known but non-evaluated + // groups else if( RTF_UNKNOWNCONTROL != ( nToken = GetNextToken() ) && RTF_PANOSE != nToken && RTF_FNAME != nToken && RTF_FONTEMB != nToken && RTF_FONTFILE != nToken ) nToken = SkipToken( -2 ); else { - // gleich herausfiltern + // filter out at once ReadUnknownData(); nToken = GetNextToken(); if( '}' != nToken ) @@ -553,7 +543,7 @@ void SvxRTFParser::ReadFontTable() case RTF_FDECOR: pFont->SetFamily( FAMILY_DECORATIVE ); break; - // bei technischen/symbolischen Font wird der CharSet ungeschaltet!! + // for technical/symbolic font of the CharSet is changed! case RTF_FTECH: pFont->SetCharSet( RTL_TEXTENCODING_SYMBOL ); // deliberate fall through @@ -564,7 +554,7 @@ void SvxRTFParser::ReadFontTable() if (-1 != nTokenValue) { CharSet nCharSet = rtl_getTextEncodingFromWindowsCharset( - (BYTE)nTokenValue); + (sal_uInt8)nTokenValue); pFont->SetCharSet(nCharSet); //When we're in a font, the fontname is in the font //charset, except for symbol fonts I believe @@ -585,12 +575,12 @@ void SvxRTFParser::ReadFontTable() } break; case RTF_F: - bCheckNewFont = TRUE; + bCheckNewFont = sal_True; nInsFontNo = nFontNo; nFontNo = (short)nTokenValue; break; case RTF_FALT: - bIsAltFntNm = TRUE; + bIsAltFntNm = sal_True; break; case RTF_TEXTTOKEN: DelCharAtEnd( aToken, ';' ); @@ -606,7 +596,7 @@ void SvxRTFParser::ReadFontTable() if( bCheckNewFont && 1 >= _nOpenBrakets && sFntNm.Len() ) // one font is ready { - // alle Daten vom Font vorhanden, also ab in die Tabelle + // All data from the font is available, so off to the table if (sAltNm.Len()) (sFntNm += ';' ) += sAltNm; @@ -618,11 +608,11 @@ void SvxRTFParser::ReadFontTable() sFntNm.Erase(); } } - // den letzen muessen wir selbst loeschen + // the last one we have to delete manually delete pFont; - SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet + SkipToken( -1 ); // the closing brace is evaluated "above" - // setze den default Font am Doc + // set the default font in the Document if( bNewDoc && IsParserWorking() ) SetDefault( RTF_DEFF, nDfltFont ); } @@ -640,7 +630,7 @@ void SvxRTFParser::ReadOLEData() String& SvxRTFParser::GetTextToEndGroup( String& rStr ) { rStr.Erase( 0 ); - int _nOpenBrakets = 1, nToken; // die erste wurde schon vorher erkannt !! + int _nOpenBrakets = 1, nToken; // the first was already detected earlier!! while( _nOpenBrakets && IsParserWorking() ) { @@ -655,7 +645,7 @@ String& SvxRTFParser::GetTextToEndGroup( String& rStr ) nToken = SkipToken( -2 ); else { - // gleich herausfiltern + // filter out at once ReadUnknownData(); nToken = GetNextToken(); if( '}' != nToken ) @@ -671,36 +661,35 @@ String& SvxRTFParser::GetTextToEndGroup( String& rStr ) break; } } - SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet + SkipToken( -1 ); // the closing brace is evaluated "above" return rStr; } util::DateTime SvxRTFParser::GetDateTimeStamp( ) { util::DateTime aDT; - BOOL bWeiter = TRUE; + sal_Bool bWeiter = sal_True; int nToken; while( bWeiter && IsParserWorking() ) { switch( nToken = GetNextToken() ) { - case RTF_YR: aDT.Year = (USHORT)nTokenValue; break; - case RTF_MO: aDT.Month = (USHORT)nTokenValue; break; - case RTF_DY: aDT.Day = (USHORT)nTokenValue; break; - case RTF_HR: aDT.Hours = (USHORT)nTokenValue; break; - case RTF_MIN: aDT.Minutes = (USHORT)nTokenValue; break; + case RTF_YR: aDT.Year = (sal_uInt16)nTokenValue; break; + case RTF_MO: aDT.Month = (sal_uInt16)nTokenValue; break; + case RTF_DY: aDT.Day = (sal_uInt16)nTokenValue; break; + case RTF_HR: aDT.Hours = (sal_uInt16)nTokenValue; break; + case RTF_MIN: aDT.Minutes = (sal_uInt16)nTokenValue; break; default: - bWeiter = FALSE; + bWeiter = sal_False; } } - SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet + SkipToken( -1 ); // the closing brace is evaluated "above" return aDT; } void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo ) { -#ifndef SVX_LIGHT - int _nOpenBrakets = 1, nToken; // die erste wurde schon vorher erkannt !! + int _nOpenBrakets = 1, nToken; // the first was already detected earlier!! DBG_ASSERT(m_xDocProps.is(), "SvxRTFParser::ReadInfo: no DocumentProperties"); String sStr, sComment; @@ -719,7 +708,7 @@ void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo ) nToken = SkipToken( -2 ); else { - // gleich herausfiltern + // filter out at once ReadUnknownData(); nToken = GetNextToken(); if( '}' != nToken ) @@ -798,34 +787,38 @@ void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo ) COMPARE_EQUAL == sComment.CompareToAscii( pChkForVerNo )) nVersionNo = nVersNo; - SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet -#endif + SkipToken( -1 ); // the closing brace is evaluated "above" } void SvxRTFParser::ClearColorTbl() { - aColorTbl.DeleteAndDestroy( 0, aColorTbl.Count() ); + while ( !aColorTbl.empty() ) + { + delete aColorTbl.back(); + aColorTbl.pop_back(); + } } void SvxRTFParser::ClearFontTbl() { - for( ULONG nCnt = aFontTbl.Count(); nCnt; ) + for( sal_uInt32 nCnt = aFontTbl.Count(); nCnt; ) delete aFontTbl.GetObject( --nCnt ); } void SvxRTFParser::ClearStyleTbl() { - for( ULONG nCnt = aStyleTbl.Count(); nCnt; ) + for( sal_uInt32 nCnt = aStyleTbl.Count(); nCnt; ) delete aStyleTbl.GetObject( --nCnt ); } void SvxRTFParser::ClearAttrStack() { SvxRTFItemStackType* pTmp; - for( ULONG nCnt = aAttrStack.Count(); nCnt; --nCnt ) + for( size_t nCnt = aAttrStack.size(); nCnt; --nCnt ) { - pTmp = aAttrStack.Pop(); + pTmp = aAttrStack.back(); + aAttrStack.pop_back(); delete pTmp; } } @@ -842,7 +835,7 @@ String& SvxRTFParser::DelCharAtEnd( String& rStr, const sal_Unicode cDel ) } -const Font& SvxRTFParser::GetFont( USHORT nId ) +const Font& SvxRTFParser::GetFont( sal_uInt16 nId ) { const Font* pFont = aFontTbl.Get( nId ); if( !pFont ) @@ -859,7 +852,7 @@ const Font& SvxRTFParser::GetFont( USHORT nId ) SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr ) { - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); SvxRTFItemStackType* pNew; if( pAkt ) pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, bCopyAttr ); @@ -868,8 +861,8 @@ SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr ) *pInsPos ); pNew->SetRTFDefaults( GetRTFDefaults() ); - aAttrStack.Push( pNew ); - bNewGroup = FALSE; + aAttrStack.push_back( pNew ); + bNewGroup = sal_False; return pNew; } @@ -888,63 +881,61 @@ void SvxRTFParser::_ClearStyleAttr( SvxRTFItemStackType& rStkType ) !rStkType.GetAttrSet().Count() || 0 == ( pStyle = aStyleTbl.Get( rStkType.nStyleNo ) )) { - for( USHORT nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() ) + for( sal_uInt16 nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() ) { if( SFX_WHICH_MAX > nWhich && - SFX_ITEM_SET == rSet.GetItemState( nWhich, FALSE, &pItem ) && + SFX_ITEM_SET == rSet.GetItemState( nWhich, sal_False, &pItem ) && rPool.GetDefaultItem( nWhich ) == *pItem ) - rSet.ClearItem( nWhich ); // loeschen + rSet.ClearItem( nWhich ); // delete } } else { - // alle Attribute, die schon vom Style definiert sind, aus dem - // akt. AttrSet entfernen + // Delete all Attributes, which are already defined in the Style, + // from the current AttrSet. SfxItemSet &rStyleSet = pStyle->aAttrSet; const SfxPoolItem* pSItem; - for( USHORT nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() ) + for( sal_uInt16 nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() ) { - if( SFX_ITEM_SET == rStyleSet.GetItemState( nWhich, TRUE, &pSItem )) + if( SFX_ITEM_SET == rStyleSet.GetItemState( nWhich, sal_True, &pSItem )) { - // JP 22.06.99: im Style und im Set gleich gesetzt -> loeschen - if( SFX_ITEM_SET == rSet.GetItemState( nWhich, FALSE, &pItem ) + if( SFX_ITEM_SET == rSet.GetItemState( nWhich, sal_False, &pItem ) && *pItem == *pSItem ) - rSet.ClearItem( nWhich ); // loeschen + rSet.ClearItem( nWhich ); // delete } - // Bug 59571 - falls nicht im Style gesetzt und gleich mit - // dem PoolDefault -> auch dann loeschen else if( SFX_WHICH_MAX > nWhich && - SFX_ITEM_SET == rSet.GetItemState( nWhich, FALSE, &pItem ) && + SFX_ITEM_SET == rSet.GetItemState( nWhich, sal_False, &pItem ) && rPool.GetDefaultItem( nWhich ) == *pItem ) - rSet.ClearItem( nWhich ); // loeschen + rSet.ClearItem( nWhich ); // delete } } } -void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen +void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack { - if( aAttrStack.Count() ) + if( !aAttrStack.empty() ) { - SvxRTFItemStackType *pOld = aAttrStack.Pop(); - SvxRTFItemStackType *pAkt = aAttrStack.Top(); + SvxRTFItemStackType *pOld = aAttrStack.empty() ? 0 : aAttrStack.back(); + aAttrStack.pop_back(); + SvxRTFItemStackType *pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); do { // middle check loop - ULONG nOldSttNdIdx = pOld->pSttNd->GetIdx(); + sal_uLong nOldSttNdIdx = pOld->pSttNd->GetIdx(); if( !pOld->pChildList && ((!pOld->aAttrSet.Count() && !pOld->nStyleNo ) || (nOldSttNdIdx == pInsPos->GetNodeIdx() && pOld->nSttCnt == pInsPos->GetCntIdx() ))) - break; // keine Attribute oder Bereich + break; // no attributes or Area - // setze nur die Attribute, die unterschiedlich zum Parent sind + // set only the attributes that are different from the parent if( pAkt && pOld->aAttrSet.Count() ) { SfxItemIter aIter( pOld->aAttrSet ); const SfxPoolItem* pItem = aIter.GetCurItem(), *pGet; - while( TRUE ) + while( sal_True ) { if( SFX_ITEM_SET == pAkt->aAttrSet.GetItemState( - pItem->Which(), FALSE, &pGet ) && + pItem->Which(), sal_False, &pGet ) && *pItem == *pGet ) pOld->aAttrSet.ClearItem( pItem->Which() ); @@ -958,19 +949,17 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen break; } - // setze alle Attribute, die von Start bis hier - // definiert sind. + // Set all attributes which have been defined from start until here int bCrsrBack = !pInsPos->GetCntIdx(); if( bCrsrBack ) { - // am Absatzanfang ? eine Position zurueck - ULONG nNd = pInsPos->GetNodeIdx(); - MovePos( FALSE ); + // at the beginning of a paragraph? Move back one position + sal_uLong nNd = pInsPos->GetNodeIdx(); + MovePos( sal_False ); // if can not move backward then later dont move forward ! bCrsrBack = nNd != pInsPos->GetNodeIdx(); } - //Bug #46608#: ungueltige Bereiche ignorieren! if( ( pOld->pSttNd->GetIdx() < pInsPos->GetNodeIdx() || ( pOld->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pOld->nSttCnt <= pInsPos->GetCntIdx() )) @@ -978,37 +967,36 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen { if( !bCrsrBack ) { - // alle pard-Attribute gelten nur bis zum vorherigen - // Absatz !! + // all pard attributes are only valid until the previous + // paragraph !! if( nOldSttNdIdx == pInsPos->GetNodeIdx() ) { } else { - // jetzt wirds kompliziert: - // - alle Zeichen-Attribute behalten den Bereich, - // - alle Absatz-Attribute bekommen den Bereich - // bis zum vorherigen Absatz + // Now it gets complicated: + // - all character attributes sre keep the area + // - all paragraph attributes to get the area + // up to the previous paragraph SvxRTFItemStackType* pNew = new SvxRTFItemStackType( - *pOld, *pInsPos, TRUE ); + *pOld, *pInsPos, sal_True ); pNew->aAttrSet.SetParent( pOld->aAttrSet.GetParent() ); - // loesche aus pNew alle Absatz Attribute - for( USHORT n = 0; n < aPardMap.Count() && + // Delete all paragraph attributes from pNew + for( sal_uInt16 n = 0; n < aPardMap.Count() && pNew->aAttrSet.Count(); ++n ) if( aPardMap[n] ) pNew->aAttrSet.ClearItem( aPardMap[n] ); pNew->SetRTFDefaults( GetRTFDefaults() ); - // gab es ueberhaupt welche ? + // Were there any? if( pNew->aAttrSet.Count() == pOld->aAttrSet.Count() ) - delete pNew; // das wars dann + delete pNew; else { pNew->nStyleNo = 0; - // spanne jetzt den richtigen Bereich auf - // pNew von alter + // Now span the real area of pNew from old SetEndPrevPara( pOld->pEndNd, pOld->nEndCnt ); pNew->nSttCnt = 0; @@ -1025,14 +1013,14 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen } else { - // letzter vom Stack, also zwischenspeichern, bis der - // naechste Text eingelesen wurde. (keine Attribute - // aufspannen!!) + // Last off the stack, thus cache it until the next text was + // read. (Span no attributes!) + aAttrSetList.Insert( pOld, aAttrSetList.Count() ); aAttrSetList.Insert( pNew, aAttrSetList.Count() ); } - pOld = 0; // pOld nicht loeschen - break; // das wars !! + pOld = 0; // Do not delete pOld + break; } } } @@ -1060,52 +1048,51 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen // to create a "so long" depend list. Bug 95010 if( bCrsrBack && 50 < pAkt->pChildList->Count() ) { - // am Absatzanfang ? eine Position zurueck - MovePos( TRUE ); - bCrsrBack = FALSE; + // at the beginning of a paragraph? Move back one position + MovePos( sal_True ); + bCrsrBack = sal_False; - // eine neue Gruppe aufmachen + // Open a new Group. SvxRTFItemStackType* pNew = new SvxRTFItemStackType( - *pAkt, *pInsPos, TRUE ); + *pAkt, *pInsPos, sal_True ); pNew->SetRTFDefaults( GetRTFDefaults() ); - // alle bis hierher gueltigen Attribute "setzen" + // Set all until here valid Attributes AttrGroupEnd(); - pAkt = aAttrStack.Top(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); - aAttrStack.Push( pNew ); + aAttrStack.push_back( pNew ); pAkt = pNew; } } else - // letzter vom Stack, also zwischenspeichern, bis der - // naechste Text eingelesen wurde. (keine Attribute - // aufspannen!!) + // Last off the stack, thus cache it until the next text was + // read. (Span no attributes!) aAttrSetList.Insert( pOld, aAttrSetList.Count() ); pOld = 0; } if( bCrsrBack ) - // am Absatzanfang ? eine Position zurueck - MovePos( TRUE ); + // at the beginning of a paragraph? Move back one position + MovePos( sal_True ); - } while( FALSE ); + } while( sal_False ); if( pOld ) delete pOld; - bNewGroup = FALSE; + bNewGroup = sal_False; } } void SvxRTFParser::SetAllAttrOfStk() // end all Attr. and set it into doc { - // noch alle Attrbute vom Stack holen !! - while( aAttrStack.Count() ) + // repeat until all attributes will be taken from stack + while( !aAttrStack.empty() ) AttrGroupEnd(); - for( USHORT n = aAttrSetList.Count(); n; ) + for( sal_uInt16 n = aAttrSetList.Count(); n; ) { SvxRTFItemStackType* pStkSet = aAttrSetList[--n]; SetAttrSet( *pStkSet ); @@ -1113,10 +1100,10 @@ void SvxRTFParser::SetAllAttrOfStk() // end all Attr. and set it into doc } } -// setzt alle Attribute, die unterschiedlich zum aktuellen sind +// sets all the attributes that are different from the current void SvxRTFParser::SetAttrSet( SvxRTFItemStackType &rSet ) { - // wurde DefTab nie eingelesen? dann setze auf default + // Was DefTab never read? then set to default if( !bIsSetDfltTab ) SetDefault( RTF_DEFTAB, 720 ); @@ -1125,16 +1112,16 @@ void SvxRTFParser::SetAttrSet( SvxRTFItemStackType &rSet ) if( rSet.aAttrSet.Count() || rSet.nStyleNo ) SetAttrInDoc( rSet ); - // dann mal alle Childs abarbeiten + // then process all the children if( rSet.pChildList ) - for( USHORT n = 0; n < rSet.pChildList->Count(); ++n ) + for( sal_uInt16 n = 0; n < rSet.pChildList->Count(); ++n ) SetAttrSet( *(*rSet.pChildList)[ n ] ); } - // wurde noch kein Text eingefuegt ? (SttPos vom obersten StackEintrag!) + // Has no Text been inserted yet? (SttPos from the top Stack entry!) int SvxRTFParser::IsAttrSttPos() { - SvxRTFItemStackType* pAkt = aAttrStack.Top(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); return !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pAkt->nSttCnt == pInsPos->GetCntIdx()); } @@ -1144,29 +1131,17 @@ void SvxRTFParser::SetAttrInDoc( SvxRTFItemStackType & ) { } -#ifdef USED -void SvxRTFParser::SaveState( int nToken ) -{ - SvRTFParser::SaveState( nToken ); -} - -void SvxRTFParser::RestoreState() -{ - SvRTFParser::RestoreState(); -} -#endif - void SvxRTFParser::BuildWhichTbl() { if( aWhichMap.Count() ) aWhichMap.Remove( 0, aWhichMap.Count() ); - aWhichMap.Insert( (USHORT)0, (USHORT)0 ); + aWhichMap.Insert( (sal_uInt16)0, (sal_uInt16)0 ); - // Aufbau einer Which-Map 'rWhichMap' aus einem Array von - // 'pWhichIds' von Which-Ids. Es hat die Lange 'nWhichIds'. - // Die Which-Map wird nicht geloescht. - SvParser::BuildWhichTbl( aWhichMap, (USHORT*)aPardMap.GetData(), aPardMap.Count() ); - SvParser::BuildWhichTbl( aWhichMap, (USHORT*)aPlainMap.GetData(), aPlainMap.Count() ); + // Building a Which-Map 'rWhichMap' from an Array of + // 'pWhichIds' frm Which-Ids. It has the long 'nWhichIds'. + // The Which-Map is not going to be deleted. + SvParser::BuildWhichTbl( aWhichMap, (sal_uInt16*)aPardMap.GetData(), aPardMap.Count() ); + SvParser::BuildWhichTbl( aWhichMap, (sal_uInt16*)aPlainMap.GetData(), aPlainMap.Count() ); } const SfxItemSet& SvxRTFParser::GetRTFDefaults() @@ -1174,10 +1149,10 @@ const SfxItemSet& SvxRTFParser::GetRTFDefaults() if( !pRTFDefaults ) { pRTFDefaults = new SfxItemSet( *pAttrPool, aWhichMap.GetData() ); - USHORT nId; + sal_uInt16 nId; if( 0 != ( nId = ((RTFPardAttrMapIds*)aPardMap.GetData())->nScriptSpace )) { - SvxScriptSpaceItem aItem( FALSE, nId ); + SvxScriptSpaceItem aItem( sal_False, nId ); if( bNewDoc ) pAttrPool->SetPoolDefaultItem( aItem ); else @@ -1189,19 +1164,19 @@ const SfxItemSet& SvxRTFParser::GetRTFDefaults() /**/ -SvxRTFStyleType::SvxRTFStyleType( SfxItemPool& rPool, const USHORT* pWhichRange ) +SvxRTFStyleType::SvxRTFStyleType( SfxItemPool& rPool, const sal_uInt16* pWhichRange ) : aAttrSet( rPool, pWhichRange ) { - nOutlineNo = BYTE(-1); // nicht gesetzt + nOutlineNo = sal_uInt8(-1); // not set nBasedOn = 0; - bBasedOnIsSet = FALSE; //$flr #117411# + bBasedOnIsSet = sal_False; //$flr #117411# nNext = 0; - bIsCharFmt = FALSE; + bIsCharFmt = sal_False; } SvxRTFItemStackType::SvxRTFItemStackType( - SfxItemPool& rPool, const USHORT* pWhichRange, + SfxItemPool& rPool, const sal_uInt16* pWhichRange, const SvxPosition& rPos ) : aAttrSet( rPool, pWhichRange ), pChildList( 0 ), @@ -1277,8 +1252,8 @@ void SvxRTFItemStackType::MoveFullNode(const SvxNodeIdx &rOldNode, } //And the same for all the children - USHORT nCount = pChildList ? pChildList->Count() : 0; - for (USHORT i = 0; i < nCount; ++i) + sal_uInt16 nCount = pChildList ? pChildList->Count() : 0; + for (sal_uInt16 i = 0; i < nCount; ++i) { SvxRTFItemStackType* pStk = (*pChildList)[i]; pStk->MoveFullNode(rOldNode, rNewNode); @@ -1292,9 +1267,9 @@ bool SvxRTFParser::UncompressableStackEntry(const SvxRTFItemStackType &) const void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser ) { - DBG_ASSERT( pChildList, "es gibt keine ChildListe" ); + DBG_ASSERT( pChildList, "There is no child list" ); - USHORT n; + sal_uInt16 n; SvxRTFItemStackType* pTmp = (*pChildList)[0]; if( !pTmp->aAttrSet.Count() || @@ -1329,19 +1304,19 @@ void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser ) if( n ) { - // suche alle, die ueber den gesamten Bereich gesetzt sind + // Search for all which are set over the whole area SfxItemIter aIter( aMrgSet ); const SfxPoolItem* pItem; do { - USHORT nWhich = aIter.GetCurItem()->Which(); + sal_uInt16 nWhich = aIter.GetCurItem()->Which(); if( SFX_ITEM_SET != pTmp->aAttrSet.GetItemState( nWhich, - FALSE, &pItem ) || *pItem != *aIter.GetCurItem() ) + sal_False, &pItem ) || *pItem != *aIter.GetCurItem() ) aMrgSet.ClearItem( nWhich ); if( aIter.IsAtEnd() ) break; aIter.NextItem(); - } while( TRUE ); + } while( sal_True ); if( !aMrgSet.Count() ) return; @@ -1354,7 +1329,7 @@ void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser ) if( pEndNd->GetIdx() != pLastNd->GetIdx() || nEndCnt != nLastCnt ) return; - // es kann zusammengefasst werden + // It can be merged aAttrSet.Put( aMrgSet ); for( n = 0; n < pChildList->Count(); ++n ) @@ -1382,14 +1357,14 @@ void SvxRTFItemStackType::SetRTFDefaults( const SfxItemSet& rDefaults ) { SfxItemIter aIter( rDefaults ); do { - USHORT nWhich = aIter.GetCurItem()->Which(); - if( SFX_ITEM_SET != aAttrSet.GetItemState( nWhich, FALSE )) + sal_uInt16 nWhich = aIter.GetCurItem()->Which(); + if( SFX_ITEM_SET != aAttrSet.GetItemState( nWhich, sal_False )) aAttrSet.Put( *aIter.GetCurItem() ); if( aIter.IsAtEnd() ) break; aIter.NextItem(); - } while( TRUE ); + } while( sal_True ); } } @@ -1397,62 +1372,62 @@ void SvxRTFItemStackType::SetRTFDefaults( const SfxItemSet& rDefaults ) RTFPlainAttrMapIds::RTFPlainAttrMapIds( const SfxItemPool& rPool ) { - nCaseMap = rPool.GetTrueWhich( SID_ATTR_CHAR_CASEMAP, FALSE ); - nBgColor = rPool.GetTrueWhich( SID_ATTR_BRUSH_CHAR, FALSE ); - nColor = rPool.GetTrueWhich( SID_ATTR_CHAR_COLOR, FALSE ); - nContour = rPool.GetTrueWhich( SID_ATTR_CHAR_CONTOUR, FALSE ); - nCrossedOut = rPool.GetTrueWhich( SID_ATTR_CHAR_STRIKEOUT, FALSE ); - nEscapement = rPool.GetTrueWhich( SID_ATTR_CHAR_ESCAPEMENT, FALSE ); - nFont = rPool.GetTrueWhich( SID_ATTR_CHAR_FONT, FALSE ); - nFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_FONTHEIGHT, FALSE ); - nKering = rPool.GetTrueWhich( SID_ATTR_CHAR_KERNING, FALSE ); - nLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_LANGUAGE, FALSE ); - nPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_POSTURE, FALSE ); - nShadowed = rPool.GetTrueWhich( SID_ATTR_CHAR_SHADOWED, FALSE ); - nUnderline = rPool.GetTrueWhich( SID_ATTR_CHAR_UNDERLINE, FALSE ); - nOverline = rPool.GetTrueWhich( SID_ATTR_CHAR_OVERLINE, FALSE ); - nWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_WEIGHT, FALSE ); - nWordlineMode = rPool.GetTrueWhich( SID_ATTR_CHAR_WORDLINEMODE, FALSE ); - nAutoKerning = rPool.GetTrueWhich( SID_ATTR_CHAR_AUTOKERN, FALSE ); - - nCJKFont = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_FONT, FALSE ); - nCJKFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT, FALSE ); - nCJKLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_LANGUAGE, FALSE ); - nCJKPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_POSTURE, FALSE ); - nCJKWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_WEIGHT, FALSE ); - nCTLFont = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_FONT, FALSE ); - nCTLFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT, FALSE ); - nCTLLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_LANGUAGE, FALSE ); - nCTLPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_POSTURE, FALSE ); - nCTLWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_WEIGHT, FALSE ); - nEmphasis = rPool.GetTrueWhich( SID_ATTR_CHAR_EMPHASISMARK, FALSE ); - nTwoLines = rPool.GetTrueWhich( SID_ATTR_CHAR_TWO_LINES, FALSE ); - nRuby = 0; //rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_RUBY, FALSE ); - nCharScaleX = rPool.GetTrueWhich( SID_ATTR_CHAR_SCALEWIDTH, FALSE ); - nHorzVert = rPool.GetTrueWhich( SID_ATTR_CHAR_ROTATED, FALSE ); - nRelief = rPool.GetTrueWhich( SID_ATTR_CHAR_RELIEF, FALSE ); - nHidden = rPool.GetTrueWhich( SID_ATTR_CHAR_HIDDEN, FALSE ); + nCaseMap = rPool.GetTrueWhich( SID_ATTR_CHAR_CASEMAP, sal_False ); + nBgColor = rPool.GetTrueWhich( SID_ATTR_BRUSH_CHAR, sal_False ); + nColor = rPool.GetTrueWhich( SID_ATTR_CHAR_COLOR, sal_False ); + nContour = rPool.GetTrueWhich( SID_ATTR_CHAR_CONTOUR, sal_False ); + nCrossedOut = rPool.GetTrueWhich( SID_ATTR_CHAR_STRIKEOUT, sal_False ); + nEscapement = rPool.GetTrueWhich( SID_ATTR_CHAR_ESCAPEMENT, sal_False ); + nFont = rPool.GetTrueWhich( SID_ATTR_CHAR_FONT, sal_False ); + nFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_FONTHEIGHT, sal_False ); + nKering = rPool.GetTrueWhich( SID_ATTR_CHAR_KERNING, sal_False ); + nLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_LANGUAGE, sal_False ); + nPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_POSTURE, sal_False ); + nShadowed = rPool.GetTrueWhich( SID_ATTR_CHAR_SHADOWED, sal_False ); + nUnderline = rPool.GetTrueWhich( SID_ATTR_CHAR_UNDERLINE, sal_False ); + nOverline = rPool.GetTrueWhich( SID_ATTR_CHAR_OVERLINE, sal_False ); + nWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_WEIGHT, sal_False ); + nWordlineMode = rPool.GetTrueWhich( SID_ATTR_CHAR_WORDLINEMODE, sal_False ); + nAutoKerning = rPool.GetTrueWhich( SID_ATTR_CHAR_AUTOKERN, sal_False ); + + nCJKFont = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_FONT, sal_False ); + nCJKFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT, sal_False ); + nCJKLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_LANGUAGE, sal_False ); + nCJKPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_POSTURE, sal_False ); + nCJKWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_WEIGHT, sal_False ); + nCTLFont = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_FONT, sal_False ); + nCTLFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT, sal_False ); + nCTLLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_LANGUAGE, sal_False ); + nCTLPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_POSTURE, sal_False ); + nCTLWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_WEIGHT, sal_False ); + nEmphasis = rPool.GetTrueWhich( SID_ATTR_CHAR_EMPHASISMARK, sal_False ); + nTwoLines = rPool.GetTrueWhich( SID_ATTR_CHAR_TWO_LINES, sal_False ); + nRuby = 0; //rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_RUBY, sal_False ); + nCharScaleX = rPool.GetTrueWhich( SID_ATTR_CHAR_SCALEWIDTH, sal_False ); + nHorzVert = rPool.GetTrueWhich( SID_ATTR_CHAR_ROTATED, sal_False ); + nRelief = rPool.GetTrueWhich( SID_ATTR_CHAR_RELIEF, sal_False ); + nHidden = rPool.GetTrueWhich( SID_ATTR_CHAR_HIDDEN, sal_False ); } RTFPardAttrMapIds ::RTFPardAttrMapIds ( const SfxItemPool& rPool ) { - nLinespacing = rPool.GetTrueWhich( SID_ATTR_PARA_LINESPACE, FALSE ); - nAdjust = rPool.GetTrueWhich( SID_ATTR_PARA_ADJUST, FALSE ); - nTabStop = rPool.GetTrueWhich( SID_ATTR_TABSTOP, FALSE ); - nHyphenzone = rPool.GetTrueWhich( SID_ATTR_PARA_HYPHENZONE, FALSE ); - nLRSpace = rPool.GetTrueWhich( SID_ATTR_LRSPACE, FALSE ); - nULSpace = rPool.GetTrueWhich( SID_ATTR_ULSPACE, FALSE ); - nBrush = rPool.GetTrueWhich( SID_ATTR_BRUSH, FALSE ); - nBox = rPool.GetTrueWhich( SID_ATTR_BORDER_OUTER, FALSE ); - nShadow = rPool.GetTrueWhich( SID_ATTR_BORDER_SHADOW, FALSE ); - nOutlineLvl = rPool.GetTrueWhich( SID_ATTR_PARA_OUTLLEVEL, FALSE ); - nSplit = rPool.GetTrueWhich( SID_ATTR_PARA_SPLIT, FALSE ); - nKeep = rPool.GetTrueWhich( SID_ATTR_PARA_KEEP, FALSE ); - nFontAlign = rPool.GetTrueWhich( SID_PARA_VERTALIGN, FALSE ); - nScriptSpace = rPool.GetTrueWhich( SID_ATTR_PARA_SCRIPTSPACE, FALSE ); - nHangPunct = rPool.GetTrueWhich( SID_ATTR_PARA_HANGPUNCTUATION, FALSE ); - nForbRule = rPool.GetTrueWhich( SID_ATTR_PARA_FORBIDDEN_RULES, FALSE ); - nDirection = rPool.GetTrueWhich( SID_ATTR_FRAMEDIRECTION, FALSE ); + nLinespacing = rPool.GetTrueWhich( SID_ATTR_PARA_LINESPACE, sal_False ); + nAdjust = rPool.GetTrueWhich( SID_ATTR_PARA_ADJUST, sal_False ); + nTabStop = rPool.GetTrueWhich( SID_ATTR_TABSTOP, sal_False ); + nHyphenzone = rPool.GetTrueWhich( SID_ATTR_PARA_HYPHENZONE, sal_False ); + nLRSpace = rPool.GetTrueWhich( SID_ATTR_LRSPACE, sal_False ); + nULSpace = rPool.GetTrueWhich( SID_ATTR_ULSPACE, sal_False ); + nBrush = rPool.GetTrueWhich( SID_ATTR_BRUSH, sal_False ); + nBox = rPool.GetTrueWhich( SID_ATTR_BORDER_OUTER, sal_False ); + nShadow = rPool.GetTrueWhich( SID_ATTR_BORDER_SHADOW, sal_False ); + nOutlineLvl = rPool.GetTrueWhich( SID_ATTR_PARA_OUTLLEVEL, sal_False ); + nSplit = rPool.GetTrueWhich( SID_ATTR_PARA_SPLIT, sal_False ); + nKeep = rPool.GetTrueWhich( SID_ATTR_PARA_KEEP, sal_False ); + nFontAlign = rPool.GetTrueWhich( SID_PARA_VERTALIGN, sal_False ); + nScriptSpace = rPool.GetTrueWhich( SID_ATTR_PARA_SCRIPTSPACE, sal_False ); + nHangPunct = rPool.GetTrueWhich( SID_ATTR_PARA_HANGPUNCTUATION, sal_False ); + nForbRule = rPool.GetTrueWhich( SID_ATTR_PARA_FORBIDDEN_RULES, sal_False ); + nDirection = rPool.GetTrueWhich( SID_ATTR_FRAMEDIRECTION, sal_False ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/UnoForbiddenCharsTable.cxx b/editeng/source/uno/UnoForbiddenCharsTable.cxx index 5d3c3b468f..985c27be9e 100644 --- a/editeng/source/uno/UnoForbiddenCharsTable.cxx +++ b/editeng/source/uno/UnoForbiddenCharsTable.cxx @@ -64,7 +64,7 @@ ForbiddenCharacters SvxUnoForbiddenCharsTable::getForbiddenCharacters( const Loc throw RuntimeException(); const LanguageType eLang = SvxLocaleToLanguage( rLocale ); - const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, FALSE ); + const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, sal_False ); if(!pForbidden) throw NoSuchElementException(); @@ -80,7 +80,7 @@ sal_Bool SvxUnoForbiddenCharsTable::hasForbiddenCharacters( const Locale& rLocal return sal_False; const LanguageType eLang = SvxLocaleToLanguage( rLocale ); - const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, FALSE ); + const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, sal_False ); return NULL != pForbidden; } @@ -128,7 +128,7 @@ Sequence< Locale > SAL_CALL SvxUnoForbiddenCharsTable::getLocales() for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) { - const ULONG nLanguage = mxForbiddenChars->GetObjectKey( nIndex ); + const sal_uLong nLanguage = mxForbiddenChars->GetObjectKey( nIndex ); SvxLanguageToLocale ( *pLocales++, static_cast < LanguageType > (nLanguage) ); } } diff --git a/editeng/source/uno/makefile.mk b/editeng/source/uno/makefile.mk deleted file mode 100644 index 573dd21508..0000000000 --- a/editeng/source/uno/makefile.mk +++ /dev/null @@ -1,61 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=editeng -TARGET=uno -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES= \ - $(SLO)$/unonrule.obj \ - $(SLO)$/unoedsrc.obj \ - $(SLO)$/unoedhlp.obj \ - $(SLO)$/unofdesc.obj \ - $(SLO)$/unoviwou.obj \ - $(SLO)$/unofored.obj \ - $(SLO)$/unoforou.obj \ - $(SLO)$/unoipset.obj \ - $(SLO)$/unotext.obj \ - $(SLO)$/unotext2.obj \ - $(SLO)$/unofield.obj \ - $(SLO)$/UnoForbiddenCharsTable.obj \ - $(SLO)$/unopracc.obj \ - $(SLO)$/unoedprx.obj \ - $(SLO)$/unoviwed.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx index d186a3c2c2..1280f3b83a 100644 --- a/editeng/source/uno/unoedhlp.cxx +++ b/editeng/source/uno/unoedhlp.cxx @@ -38,46 +38,46 @@ TYPEINIT1( SvxEditSourceHint, TextHint ); -SvxEditSourceHint::SvxEditSourceHint( ULONG _nId ) : +SvxEditSourceHint::SvxEditSourceHint( sal_uLong _nId ) : TextHint( _nId ), mnStart( 0 ), mnEnd( 0 ) { } -SvxEditSourceHint::SvxEditSourceHint( ULONG _nId, ULONG nValue, ULONG nStart, ULONG nEnd ) : +SvxEditSourceHint::SvxEditSourceHint( sal_uLong _nId, sal_uLong nValue, sal_uLong nStart, sal_uLong nEnd ) : TextHint( _nId, nValue ), mnStart( nStart), mnEnd( nEnd ) { } -ULONG SvxEditSourceHint::GetValue() const +sal_uLong SvxEditSourceHint::GetValue() const { return TextHint::GetValue(); } -ULONG SvxEditSourceHint::GetStartValue() const +sal_uLong SvxEditSourceHint::GetStartValue() const { return mnStart; } -ULONG SvxEditSourceHint::GetEndValue() const +sal_uLong SvxEditSourceHint::GetEndValue() const { return mnEnd; } -void SvxEditSourceHint::SetValue( ULONG n ) +void SvxEditSourceHint::SetValue( sal_uLong n ) { TextHint::SetValue( n ); } -void SvxEditSourceHint::SetStartValue( ULONG n ) +void SvxEditSourceHint::SetStartValue( sal_uLong n ) { mnStart = n; } -void SvxEditSourceHint::SetEndValue( ULONG n ) +void SvxEditSourceHint::SetEndValue( sal_uLong n ) { mnEnd = n; } @@ -124,7 +124,7 @@ void SvxEditSourceHint::SetEndValue( ULONG n ) return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_INPUT_END, 0 ) ); default: - DBG_ERROR( "SvxEditSourceHelper::EENotification2Hint unknown notification" ); + OSL_FAIL( "SvxEditSourceHelper::EENotification2Hint unknown notification" ); break; } } @@ -132,14 +132,14 @@ void SvxEditSourceHint::SetEndValue( ULONG n ) return ::std::auto_ptr<SfxHint>( new SfxHint() ); } -sal_Bool SvxEditSourceHelper::GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, const EditEngine& rEE, USHORT nPara, USHORT nIndex ) +sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex ) { EECharAttribArray aCharAttribs; rEE.GetCharAttribs( nPara, aCharAttribs ); // find closest index in front of nIndex - USHORT nAttr, nCurrIndex; + sal_uInt16 nAttr, nCurrIndex; sal_Int32 nClosestStartIndex; for( nAttr=0, nClosestStartIndex=0; nAttr<aCharAttribs.Count(); ++nAttr ) { @@ -167,8 +167,8 @@ sal_Bool SvxEditSourceHelper::GetAttributeRun( USHORT& nStartIndex, USHORT& nEnd } } - nStartIndex = static_cast<USHORT>( nClosestStartIndex ); - nEndIndex = static_cast<USHORT>( nClosestEndIndex ); + nStartIndex = static_cast<sal_uInt16>( nClosestStartIndex ); + nEndIndex = static_cast<sal_uInt16>( nClosestEndIndex ); return sal_True; } @@ -185,14 +185,12 @@ Point SvxEditSourceHelper::UserSpaceToEE( const Point& rPoint, const Size& rEESi Rectangle SvxEditSourceHelper::EEToUserSpace( const Rectangle& rRect, const Size& rEESize, bool bIsVertical ) { - // #106775# Don't touch rect if not vertical return bIsVertical ? Rectangle( EEToUserSpace(rRect.BottomLeft(), rEESize, bIsVertical), EEToUserSpace(rRect.TopRight(), rEESize, bIsVertical) ) : rRect; } Rectangle SvxEditSourceHelper::UserSpaceToEE( const Rectangle& rRect, const Size& rEESize, bool bIsVertical ) { - // #106775# Don't touch rect if not vertical return bIsVertical ? Rectangle( UserSpaceToEE(rRect.TopRight(), rEESize, bIsVertical), UserSpaceToEE(rRect.BottomLeft(), rEESize, bIsVertical) ) : rRect; } diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 23f9878ecc..8cc4e1f157 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -77,11 +77,11 @@ public: ~SvxAccessibleTextIndex() {}; // Get/Set current paragraph - void SetParagraph( USHORT nPara ) + void SetParagraph( sal_uInt16 nPara ) { mnPara = nPara; } - USHORT GetParagraph() const { return mnPara; } + sal_uInt16 GetParagraph() const { return mnPara; } /** Set the index in the UAA semantic @@ -92,7 +92,7 @@ public: The text forwarder to use in the calculations */ void SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF ); - void SetIndex( USHORT nPara, sal_Int32 nIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetIndex(nIndex, rTF); } + void SetIndex( sal_uInt16 nPara, sal_Int32 nIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetIndex(nIndex, rTF); } sal_Int32 GetIndex() const { return mnIndex; } /** Set the index in the edit engine semantic @@ -106,9 +106,9 @@ public: @param rTF The text forwarder to use in the calculations */ - void SetEEIndex( USHORT nEEIndex, const SvxTextForwarder& rTF ); - void SetEEIndex( USHORT nPara, USHORT nEEIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetEEIndex(nEEIndex, rTF); } - USHORT GetEEIndex() const; + void SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF ); + void SetEEIndex( sal_uInt16 nPara, sal_uInt16 nEEIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetEEIndex(nEEIndex, rTF); } + sal_uInt16 GetEEIndex() const; void SetFieldOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnFieldOffset = nOffset; mnFieldLen = nLen; } sal_Int32 GetFieldOffset() const { return mnFieldOffset; } @@ -129,7 +129,7 @@ public: sal_Bool IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const; private: - USHORT mnPara; + sal_uInt16 mnPara; sal_Int32 mnIndex; sal_Int32 mnEEIndex; sal_Int32 mnFieldOffset; @@ -179,15 +179,15 @@ ESelection MakeEESelection( const SvxAccessibleTextIndex& rIndex ) rIndex.GetParagraph(), rIndex.GetEEIndex() + 1 ); } -USHORT SvxAccessibleTextIndex::GetEEIndex() const +sal_uInt16 SvxAccessibleTextIndex::GetEEIndex() const { DBG_ASSERT(mnEEIndex >= 0 && mnEEIndex <= USHRT_MAX, "SvxAccessibleTextIndex::GetEEIndex: index value overflow"); - return static_cast< USHORT > (mnEEIndex); + return static_cast< sal_uInt16 > (mnEEIndex); } -void SvxAccessibleTextIndex::SetEEIndex( USHORT nEEIndex, const SvxTextForwarder& rTF ) +void SvxAccessibleTextIndex::SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF ) { // reset mnFieldOffset = 0; @@ -201,7 +201,7 @@ void SvxAccessibleTextIndex::SetEEIndex( USHORT nEEIndex, const SvxTextForwarder mnEEIndex = nEEIndex; // calculate unknowns - USHORT nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() ); + sal_uInt16 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() ); mnIndex = nEEIndex; @@ -247,7 +247,7 @@ void SvxAccessibleTextIndex::SetIndex( sal_Int32 nIndex, const SvxTextForwarder& mnIndex = nIndex; // calculate unknowns - USHORT nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() ); + sal_uInt16 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() ); DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); @@ -456,21 +456,21 @@ SvxAccessibleTextAdapter::~SvxAccessibleTextAdapter() { } -USHORT SvxAccessibleTextAdapter::GetParagraphCount() const +sal_uInt16 SvxAccessibleTextAdapter::GetParagraphCount() const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); return mrTextForwarder->GetParagraphCount(); } -USHORT SvxAccessibleTextAdapter::GetTextLen( USHORT nParagraph ) const +sal_uInt16 SvxAccessibleTextAdapter::GetTextLen( sal_uInt16 nParagraph ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); SvxAccessibleTextIndex aIndex; aIndex.SetEEIndex( nParagraph, mrTextForwarder->GetTextLen( nParagraph ), *this ); - return static_cast< USHORT >(aIndex.GetIndex()); + return static_cast< sal_uInt16 >(aIndex.GetIndex()); } String SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const @@ -499,7 +499,7 @@ String SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const aStartIndex.GetFieldOffset() <= USHRT_MAX, "SvxAccessibleTextIndex::GetText: index value overflow"); - sStr.Erase(0, static_cast< USHORT > (aStartIndex.GetFieldOffset()) ); + sStr.Erase(0, static_cast< sal_uInt16 > (aStartIndex.GetFieldOffset()) ); } if( aEndIndex.InField() && aEndIndex.GetFieldOffset() ) { @@ -507,11 +507,11 @@ String SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) <= USHRT_MAX, "SvxAccessibleTextIndex::GetText: index value overflow"); - sStr = sStr.Copy(0, static_cast< USHORT > (sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset())) ); + sStr = sStr.Copy(0, static_cast< sal_uInt16 > (sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset())) ); } - EBulletInfo aBulletInfo1 = GetBulletInfo( static_cast< USHORT >(aStartIndex.GetParagraph()) ); - EBulletInfo aBulletInfo2 = GetBulletInfo( static_cast< USHORT >(aEndIndex.GetParagraph()) ); + EBulletInfo aBulletInfo1 = GetBulletInfo( static_cast< sal_uInt16 >(aStartIndex.GetParagraph()) ); + EBulletInfo aBulletInfo2 = GetBulletInfo( static_cast< sal_uInt16 >(aEndIndex.GetParagraph()) ); if( aStartIndex.InBullet() ) { @@ -522,7 +522,7 @@ String SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const aStartIndex.GetBulletOffset() <= USHRT_MAX, "SvxAccessibleTextIndex::GetText: index value overflow"); - sBullet.Erase(0, static_cast< USHORT > (aStartIndex.GetBulletOffset()) ); + sBullet.Erase(0, static_cast< sal_uInt16 > (aStartIndex.GetBulletOffset()) ); sBullet += sStr; sStr = sBullet; @@ -537,7 +537,7 @@ String SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX, "SvxAccessibleTextIndex::GetText: index value overflow"); - sStr = sStr.Copy(0, static_cast< USHORT > (sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) ); + sStr = sStr.Copy(0, static_cast< sal_uInt16 > (sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) ); } else if( aStartIndex.GetParagraph() != aEndIndex.GetParagraph() && HaveTextBullet( aEndIndex.GetParagraph() ) ) @@ -548,17 +548,17 @@ String SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX, "SvxAccessibleTextIndex::GetText: index value overflow"); - sBullet = sBullet.Copy(0, static_cast< USHORT > (sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) ); + sBullet = sBullet.Copy(0, static_cast< sal_uInt16 > (sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) ); // insert bullet sStr.Insert( sBullet, - static_cast< USHORT > (GetTextLen(aStartIndex.GetParagraph()) - aStartIndex.GetIndex()) ); + static_cast< sal_uInt16 > (GetTextLen(aStartIndex.GetParagraph()) - aStartIndex.GetIndex()) ); } return sStr; } -SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) const +SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -572,14 +572,14 @@ SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, BOOL bO bOnlyHardAttrib ); } -SfxItemSet SvxAccessibleTextAdapter::GetParaAttribs( USHORT nPara ) const +SfxItemSet SvxAccessibleTextAdapter::GetParaAttribs( sal_uInt16 nPara ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); return mrTextForwarder->GetParaAttribs( nPara ); } -void SvxAccessibleTextAdapter::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) +void SvxAccessibleTextAdapter::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -591,14 +591,14 @@ void SvxAccessibleTextAdapter::RemoveAttribs( const ESelection& , sal_Bool , sal DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); } -void SvxAccessibleTextAdapter::GetPortions( USHORT nPara, SvUShorts& rList ) const +void SvxAccessibleTextAdapter::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); mrTextForwarder->GetPortions( nPara, rList ); } -USHORT SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, USHORT nWhich ) const +sal_uInt16 SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -612,7 +612,7 @@ USHORT SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, USHORT nW nWhich ); } -USHORT SvxAccessibleTextAdapter::GetItemState( USHORT nPara, USHORT nWhich ) const +sal_uInt16 SvxAccessibleTextAdapter::GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -681,21 +681,21 @@ SfxItemPool* SvxAccessibleTextAdapter::GetPool() const return mrTextForwarder->GetPool(); } -XubString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ) +XubString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); return mrTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } -void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ) { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); mrTextForwarder->FieldClicked( rField, nPara, nPos ); } -sal_Int32 SvxAccessibleTextAdapter::CalcLogicalIndex( USHORT nPara, USHORT nEEIndex ) +sal_Int32 SvxAccessibleTextAdapter::CalcLogicalIndex( sal_uInt16 nPara, sal_uInt16 nEEIndex ) { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -704,7 +704,7 @@ sal_Int32 SvxAccessibleTextAdapter::CalcLogicalIndex( USHORT nPara, USHORT nEEIn return aIndex.GetIndex(); } -USHORT SvxAccessibleTextAdapter::CalcEditEngineIndex( USHORT nPara, sal_Int32 nLogicalIndex ) +sal_uInt16 SvxAccessibleTextAdapter::CalcEditEngineIndex( sal_uInt16 nPara, sal_Int32 nLogicalIndex ) { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -715,7 +715,7 @@ USHORT SvxAccessibleTextAdapter::CalcEditEngineIndex( USHORT nPara, sal_Int32 nL -BOOL SvxAccessibleTextAdapter::IsValid() const +sal_Bool SvxAccessibleTextAdapter::IsValid() const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -725,7 +725,7 @@ BOOL SvxAccessibleTextAdapter::IsValid() const return sal_False; } -LanguageType SvxAccessibleTextAdapter::GetLanguage( USHORT nPara, USHORT nPos ) const +LanguageType SvxAccessibleTextAdapter::GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -736,28 +736,28 @@ LanguageType SvxAccessibleTextAdapter::GetLanguage( USHORT nPara, USHORT nPos ) return mrTextForwarder->GetLanguage( nPara, aIndex.GetEEIndex() ); } -USHORT SvxAccessibleTextAdapter::GetFieldCount( USHORT nPara ) const +sal_uInt16 SvxAccessibleTextAdapter::GetFieldCount( sal_uInt16 nPara ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); return mrTextForwarder->GetFieldCount( nPara ); } -EFieldInfo SvxAccessibleTextAdapter::GetFieldInfo( USHORT nPara, USHORT nField ) const +EFieldInfo SvxAccessibleTextAdapter::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); return mrTextForwarder->GetFieldInfo( nPara, nField ); } -EBulletInfo SvxAccessibleTextAdapter::GetBulletInfo( USHORT nPara ) const +EBulletInfo SvxAccessibleTextAdapter::GetBulletInfo( sal_uInt16 nPara ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); return mrTextForwarder->GetBulletInfo( nPara ); } -Rectangle SvxAccessibleTextAdapter::GetCharBounds( USHORT nPara, USHORT nIndex ) const +Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -766,7 +766,7 @@ Rectangle SvxAccessibleTextAdapter::GetCharBounds( USHORT nPara, USHORT nIndex ) // preset if anything goes wrong below // n-th char in GetParagraphIndex's paragraph - Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, static_cast< USHORT >( aIndex.GetEEIndex() ) ); + Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, static_cast< sal_uInt16 >( aIndex.GetEEIndex() ) ); if( aIndex.InBullet() ) { @@ -804,7 +804,7 @@ Rectangle SvxAccessibleTextAdapter::GetCharBounds( USHORT nPara, USHORT nIndex ) aFont, mrTextForwarder->GetText( aSel ) ); - Rectangle aStartRect = mrTextForwarder->GetCharBounds( nPara, static_cast< USHORT >( aIndex.GetEEIndex() ) ); + Rectangle aStartRect = mrTextForwarder->GetCharBounds( nPara, static_cast< sal_uInt16 >( aIndex.GetEEIndex() ) ); if( !aStringWrap.GetCharacterBounds( aIndex.GetFieldOffset(), aRect ) ) aRect = aStartRect; @@ -817,7 +817,7 @@ Rectangle SvxAccessibleTextAdapter::GetCharBounds( USHORT nPara, USHORT nIndex ) return aRect; } -Rectangle SvxAccessibleTextAdapter::GetParaBounds( USHORT nPara ) const +Rectangle SvxAccessibleTextAdapter::GetParaBounds( sal_uInt16 nPara ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -852,7 +852,7 @@ OutputDevice* SvxAccessibleTextAdapter::GetRefDevice() const return mrTextForwarder->GetRefDevice(); } -sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, USHORT& nPara, USHORT& nIndex ) const +sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_uInt16& nPara, sal_uInt16& nIndex ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -865,7 +865,7 @@ sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, USHORT& DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nIndex = static_cast< USHORT > (aIndex.GetIndex()); + nIndex = static_cast< sal_uInt16 > (aIndex.GetIndex()); EBulletInfo aBulletInfo = GetBulletInfo( nPara ); @@ -892,7 +892,7 @@ sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, USHORT& aStringWrap.GetIndexAtPoint( aPoint ) <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nIndex = static_cast< USHORT > (aStringWrap.GetIndexAtPoint( aPoint )); + nIndex = static_cast< sal_uInt16 > (aStringWrap.GetIndexAtPoint( aPoint )); return sal_True; } } @@ -920,14 +920,14 @@ sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, USHORT& aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nIndex = static_cast< USHORT >(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint )); + nIndex = static_cast< sal_uInt16 >(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint )); return sal_True; } return sal_True; } -sal_Bool SvxAccessibleTextAdapter::GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const +sal_Bool SvxAccessibleTextAdapter::GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -943,7 +943,7 @@ sal_Bool SvxAccessibleTextAdapter::GetWordIndices( USHORT nPara, USHORT nIndex, // always treat bullet as separate word nStart = 0; - nEnd = static_cast< USHORT > (aIndex.GetBulletLen()); + nEnd = static_cast< sal_uInt16 > (aIndex.GetBulletLen()); return sal_True; } @@ -958,8 +958,8 @@ sal_Bool SvxAccessibleTextAdapter::GetWordIndices( USHORT nPara, USHORT nIndex, // always treat field as separate word // TODO: to circumvent this, _we_ would have to do the break iterator stuff! - nStart = static_cast< USHORT > (aIndex.GetIndex() - aIndex.GetFieldOffset()); - nEnd = static_cast< USHORT > (nStart + aIndex.GetFieldLen()); + nStart = static_cast< sal_uInt16 > (aIndex.GetIndex() - aIndex.GetFieldOffset()); + nEnd = static_cast< sal_uInt16 > (nStart + aIndex.GetFieldLen()); return sal_True; } @@ -971,18 +971,18 @@ sal_Bool SvxAccessibleTextAdapter::GetWordIndices( USHORT nPara, USHORT nIndex, DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nStart = static_cast< USHORT > (aIndex.GetIndex()); + nStart = static_cast< sal_uInt16 > (aIndex.GetIndex()); aIndex.SetEEIndex( nPara, nEnd, *this ); DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nEnd = static_cast< USHORT > (aIndex.GetIndex()); + nEnd = static_cast< sal_uInt16 > (aIndex.GetIndex()); return sal_True; } -sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const +sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -998,7 +998,7 @@ sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( USHORT& nStartIndex, USHORT& // always treat bullet as distinct attribute nStartIndex = 0; - nEndIndex = static_cast< USHORT > (aIndex.GetBulletLen()); + nEndIndex = static_cast< sal_uInt16 > (aIndex.GetBulletLen()); return sal_True; } @@ -1010,8 +1010,8 @@ sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( USHORT& nStartIndex, USHORT& "SvxAccessibleTextIndex::SetIndex: index value overflow"); // always treat field as distinct attribute - nStartIndex = static_cast< USHORT > (aIndex.GetIndex() - aIndex.GetFieldOffset()); - nEndIndex = static_cast< USHORT > (nStartIndex + aIndex.GetFieldLen()); + nStartIndex = static_cast< sal_uInt16 > (aIndex.GetIndex() - aIndex.GetFieldOffset()); + nEndIndex = static_cast< sal_uInt16 > (nStartIndex + aIndex.GetFieldLen()); return sal_True; } @@ -1023,32 +1023,32 @@ sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( USHORT& nStartIndex, USHORT& DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nStartIndex = static_cast< USHORT > (aIndex.GetIndex()); + nStartIndex = static_cast< sal_uInt16 > (aIndex.GetIndex()); aIndex.SetEEIndex( nPara, nEndIndex, *this ); DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nEndIndex = static_cast< USHORT > (aIndex.GetIndex()); + nEndIndex = static_cast< sal_uInt16 > (aIndex.GetIndex()); return sal_True; } -USHORT SvxAccessibleTextAdapter::GetLineCount( USHORT nPara ) const +sal_uInt16 SvxAccessibleTextAdapter::GetLineCount( sal_uInt16 nPara ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); return mrTextForwarder->GetLineCount( nPara ); } -USHORT SvxAccessibleTextAdapter::GetLineLen( USHORT nPara, USHORT nLine ) const +sal_uInt16 SvxAccessibleTextAdapter::GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - USHORT nCurrLine; - USHORT nCurrIndex, nLastIndex; + sal_uInt16 nCurrLine; + sal_uInt16 nCurrIndex, nLastIndex; for( nCurrLine=0, nCurrIndex=0, nLastIndex=0; nCurrLine<=nLine; ++nCurrLine ) { nLastIndex = nCurrIndex; @@ -1061,18 +1061,18 @@ USHORT SvxAccessibleTextAdapter::GetLineLen( USHORT nPara, USHORT nLine ) const { aStartIndex.SetEEIndex( nPara, nLastIndex, *this ); - return static_cast< USHORT >(aEndIndex.GetIndex() - aStartIndex.GetIndex()); + return static_cast< sal_uInt16 >(aEndIndex.GetIndex() - aStartIndex.GetIndex()); } else - return static_cast< USHORT >(aEndIndex.GetIndex()); + return static_cast< sal_uInt16 >(aEndIndex.GetIndex()); } -void SvxAccessibleTextAdapter::GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const +void SvxAccessibleTextAdapter::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const { mrTextForwarder->GetLineBoundaries( rStart, rEnd, nParagraph, nLine ); } -USHORT SvxAccessibleTextAdapter::GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const +sal_uInt16 SvxAccessibleTextAdapter::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const { return mrTextForwarder->GetLineNumberAtIndex( nPara, nIndex ); } @@ -1103,21 +1103,21 @@ sal_Bool SvxAccessibleTextAdapter::InsertText( const String& rStr, const ESelect return mrTextForwarder->InsertText( rStr, MakeEESelection(aStartIndex, aEndIndex) ); } -sal_Bool SvxAccessibleTextAdapter::QuickFormatDoc( BOOL bFull ) +sal_Bool SvxAccessibleTextAdapter::QuickFormatDoc( sal_Bool bFull ) { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); return mrTextForwarder->QuickFormatDoc( bFull ); } -sal_Int16 SvxAccessibleTextAdapter::GetDepth( USHORT nPara ) const +sal_Int16 SvxAccessibleTextAdapter::GetDepth( sal_uInt16 nPara ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); return mrTextForwarder->GetDepth( nPara ); } -sal_Bool SvxAccessibleTextAdapter::SetDepth( USHORT nPara, sal_Int16 nNewDepth ) +sal_Bool SvxAccessibleTextAdapter::SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ) { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -1129,7 +1129,7 @@ void SvxAccessibleTextAdapter::SetForwarder( SvxTextForwarder& rForwarder ) mrTextForwarder = &rForwarder; } -sal_Bool SvxAccessibleTextAdapter::HaveImageBullet( USHORT nPara ) const +sal_Bool SvxAccessibleTextAdapter::HaveImageBullet( sal_uInt16 nPara ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -1147,7 +1147,7 @@ sal_Bool SvxAccessibleTextAdapter::HaveImageBullet( USHORT nPara ) const } } -sal_Bool SvxAccessibleTextAdapter::HaveTextBullet( USHORT nPara ) const +sal_Bool SvxAccessibleTextAdapter::HaveTextBullet( sal_uInt16 nPara ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -1187,23 +1187,23 @@ sal_Bool SvxAccessibleTextAdapter::IsEditable( const ESelection& rSel ) const SfxItemSet * SvxAccessibleTextAdapter::GetEmptyItemSetPtr() { - DBG_ERROR( "not implemented" ); + OSL_FAIL( "not implemented" ); return 0; } void SvxAccessibleTextAdapter::AppendParagraph() { - DBG_ERROR( "not implemented" ); + OSL_FAIL( "not implemented" ); } -xub_StrLen SvxAccessibleTextAdapter::AppendTextPortion( USHORT, const String &, const SfxItemSet & ) +xub_StrLen SvxAccessibleTextAdapter::AppendTextPortion( sal_uInt16, const String &, const SfxItemSet & ) { - DBG_ERROR( "not implemented" ); + OSL_FAIL( "not implemented" ); return 0; } void SvxAccessibleTextAdapter::CopyText(const SvxTextForwarder&) { - DBG_ERROR( "not implemented" ); + OSL_FAIL( "not implemented" ); } @@ -1218,7 +1218,7 @@ SvxAccessibleTextEditViewAdapter::~SvxAccessibleTextEditViewAdapter() { } -BOOL SvxAccessibleTextEditViewAdapter::IsValid() const +sal_Bool SvxAccessibleTextEditViewAdapter::IsValid() const { DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder"); @@ -1268,8 +1268,8 @@ sal_Bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) cons aEndIndex.GetIndex() >= 0 && aEndIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextEditViewAdapter::GetSelection: index value overflow"); - rSel = ESelection( aStartIndex.GetParagraph(), static_cast< USHORT > (aStartIndex.GetIndex()), - aEndIndex.GetParagraph(), static_cast< USHORT > (aEndIndex.GetIndex()) ); + rSel = ESelection( aStartIndex.GetParagraph(), static_cast< sal_uInt16 > (aStartIndex.GetIndex()), + aEndIndex.GetParagraph(), static_cast< sal_uInt16 > (aEndIndex.GetIndex()) ); return sal_True; } diff --git a/editeng/source/uno/unoedsrc.cxx b/editeng/source/uno/unoedsrc.cxx index 91bca0a9e3..06337654b5 100644 --- a/editeng/source/uno/unoedsrc.cxx +++ b/editeng/source/uno/unoedsrc.cxx @@ -83,7 +83,7 @@ SvxEditViewForwarder* SvxEditSource::GetEditViewForwarder( sal_Bool ) SfxBroadcaster& SvxEditSource::GetBroadcaster() const { - DBG_ERROR("SvxEditSource::GetBroadcaster called for implementation missing this feature!"); + OSL_FAIL("SvxEditSource::GetBroadcaster called for implementation missing this feature!"); static SfxBroadcaster aBroadcaster; diff --git a/editeng/source/uno/unofdesc.cxx b/editeng/source/uno/unofdesc.cxx index 419892316b..7c24f97893 100644 --- a/editeng/source/uno/unofdesc.cxx +++ b/editeng/source/uno/unofdesc.cxx @@ -90,11 +90,11 @@ void SvxUnoFontDescriptor::FillItemSet( const awt::FontDescriptor& rDesc, SfxIte { SvxFontItem aFontItem( EE_CHAR_FONTINFO ); - aFontItem.GetFamilyName()= rDesc.Name; - aFontItem.GetStyleName() = rDesc.StyleName; - aFontItem.GetFamily() = (FontFamily)rDesc.Family; - aFontItem.GetCharSet() = rDesc.CharSet; - aFontItem.GetPitch() = (FontPitch)rDesc.Pitch; + aFontItem.SetFamilyName( rDesc.Name); + aFontItem.SetStyleName( rDesc.StyleName); + aFontItem.SetFamily( (FontFamily)rDesc.Family); + aFontItem.SetCharSet( rDesc.CharSet ); + aFontItem.SetPitch( (FontPitch)rDesc.Pitch); rSet.Put(aFontItem); } @@ -143,7 +143,7 @@ void SvxUnoFontDescriptor::FillFromItemSet( const SfxItemSet& rSet, awt::FontDes { const SfxPoolItem* pItem = NULL; { - SvxFontItem* pFontItem = (SvxFontItem*)&rSet.Get( EE_CHAR_FONTINFO, TRUE ); + SvxFontItem* pFontItem = (SvxFontItem*)&rSet.Get( EE_CHAR_FONTINFO, sal_True ); rDesc.Name = pFontItem->GetFamilyName(); rDesc.StyleName = pFontItem->GetStyleName(); rDesc.Family = sal::static_int_cast< sal_Int16 >( @@ -153,37 +153,37 @@ void SvxUnoFontDescriptor::FillFromItemSet( const SfxItemSet& rSet, awt::FontDes pFontItem->GetPitch()); } { - pItem = &rSet.Get( EE_CHAR_FONTHEIGHT, TRUE ); + pItem = &rSet.Get( EE_CHAR_FONTHEIGHT, sal_True ); uno::Any aHeight; if( pItem->QueryValue( aHeight, MID_FONTHEIGHT ) ) aHeight >>= rDesc.Height; } { - pItem = &rSet.Get( EE_CHAR_ITALIC, TRUE ); + pItem = &rSet.Get( EE_CHAR_ITALIC, sal_True ); uno::Any aFontSlant; if(pItem->QueryValue( aFontSlant, MID_POSTURE )) aFontSlant >>= rDesc.Slant; } { - pItem = &rSet.Get( EE_CHAR_UNDERLINE, TRUE ); + pItem = &rSet.Get( EE_CHAR_UNDERLINE, sal_True ); uno::Any aUnderline; if(pItem->QueryValue( aUnderline, MID_TL_STYLE )) aUnderline >>= rDesc.Underline; } { - pItem = &rSet.Get( EE_CHAR_WEIGHT, TRUE ); + pItem = &rSet.Get( EE_CHAR_WEIGHT, sal_True ); uno::Any aWeight; if(pItem->QueryValue( aWeight, MID_WEIGHT )) aWeight >>= rDesc.Weight; } { - pItem = &rSet.Get( EE_CHAR_STRIKEOUT, TRUE ); + pItem = &rSet.Get( EE_CHAR_STRIKEOUT, sal_True ); uno::Any aStrikeOut; if(pItem->QueryValue( aStrikeOut, MID_CROSS_OUT )) aStrikeOut >>= rDesc.Strikeout; } { - SvxWordLineModeItem* pWLMItem = (SvxWordLineModeItem*)&rSet.Get( EE_CHAR_WLM, TRUE ); + SvxWordLineModeItem* pWLMItem = (SvxWordLineModeItem*)&rSet.Get( EE_CHAR_WLM, sal_True ); rDesc.WordLineMode = pWLMItem->GetValue(); } } @@ -201,13 +201,13 @@ void SvxUnoFontDescriptor::FillFromItemSet( const SfxItemSet& rSet, awt::FontDes beans::PropertyState SvxUnoFontDescriptor::getPropertyState( const SfxItemSet& rSet ) { - CheckState(rSet.GetItemState( EE_CHAR_FONTINFO, FALSE )); - CheckState(rSet.GetItemState( EE_CHAR_FONTHEIGHT, FALSE )); - CheckState(rSet.GetItemState( EE_CHAR_ITALIC, FALSE )); - CheckState(rSet.GetItemState( EE_CHAR_UNDERLINE, FALSE )); - CheckState(rSet.GetItemState( EE_CHAR_WEIGHT, FALSE )); - CheckState(rSet.GetItemState( EE_CHAR_STRIKEOUT, FALSE )); - CheckState(rSet.GetItemState( EE_CHAR_WLM, FALSE )); + CheckState(rSet.GetItemState( EE_CHAR_FONTINFO, sal_False )); + CheckState(rSet.GetItemState( EE_CHAR_FONTHEIGHT, sal_False )); + CheckState(rSet.GetItemState( EE_CHAR_ITALIC, sal_False )); + CheckState(rSet.GetItemState( EE_CHAR_UNDERLINE, sal_False )); + CheckState(rSet.GetItemState( EE_CHAR_WEIGHT, sal_False )); + CheckState(rSet.GetItemState( EE_CHAR_STRIKEOUT, sal_False )); + CheckState(rSet.GetItemState( EE_CHAR_WLM, sal_False )); return beans::PropertyState_DEFAULT_VALUE; } diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index 6a00140341..85e4ff9af5 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -216,7 +216,7 @@ static SvxFileFormat setFileNameDisplayFormat( sal_Int16 nFormat ) } } -static util::DateTime getDate( ULONG nDate ) +static util::DateTime getDate( sal_uLong nDate ) { util::DateTime aDate; memset( &aDate, 0, sizeof( util::DateTime ) ); @@ -1104,8 +1104,8 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames() OUString* pServices = aSeq.getArray(); pServices[0] = OUString::createFromAscii( pNewServiceNames[mnServiceId] ); pServices[1] = OUString::createFromAscii( pOldServiceNames[mnServiceId] ); - pServices[2] = OUString::createFromAscii( "com.sun.star.text.TextContent" ), - pServices[3] = OUString::createFromAscii( "com.sun.star.text.TextField" ); + pServices[2] = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextContent" )), + pServices[3] = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextField" )); return aSeq; } diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index 51ba135f07..27991ab88a 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -39,7 +39,7 @@ #include <editeng/unoedhlp.hxx> #include <editeng/editdata.hxx> #include <editeng/outliner.hxx> -#include <editeng/editobj.hxx> // nur fuer die GetText-Kruecke +#include <editeng/editobj.hxx> // only for the GetText crutch #include <editeng/unofored.hxx> @@ -54,15 +54,15 @@ SvxEditEngineForwarder::SvxEditEngineForwarder( EditEngine& rEngine ) : SvxEditEngineForwarder::~SvxEditEngineForwarder() { - // die EditEngine muss ggf. von aussen geloescht werden + // the EditEngine may need to be deleted from the outside } -USHORT SvxEditEngineForwarder::GetParagraphCount() const +sal_uInt16 SvxEditEngineForwarder::GetParagraphCount() const { return rEditEngine.GetParagraphCount(); } -USHORT SvxEditEngineForwarder::GetTextLen( USHORT nParagraph ) const +sal_uInt16 SvxEditEngineForwarder::GetTextLen( sal_uInt16 nParagraph ) const { return rEditEngine.GetTextLen( nParagraph ); } @@ -74,7 +74,7 @@ String SvxEditEngineForwarder::GetText( const ESelection& rSel ) const return aRet; } -SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) const +SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const { if( rSel.nStartPara == rSel.nEndPara ) { @@ -91,7 +91,7 @@ SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, BOOL bOnl nFlags = GETATTRIBS_CHARATTRIBS; break; default: - DBG_ERROR("unknown flags for SvxOutlinerForwarder::GetAttribs"); + OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs"); } return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags ); @@ -102,14 +102,14 @@ SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, BOOL bOnl } } -SfxItemSet SvxEditEngineForwarder::GetParaAttribs( USHORT nPara ) const +SfxItemSet SvxEditEngineForwarder::GetParaAttribs( sal_uInt16 nPara ) const { SfxItemSet aSet( rEditEngine.GetParaAttribs( nPara ) ); - USHORT nWhich = EE_PARA_START; + sal_uInt16 nWhich = EE_PARA_START; while( nWhich <= EE_PARA_END ) { - if( aSet.GetItemState( nWhich, TRUE ) != SFX_ITEM_ON ) + if( aSet.GetItemState( nWhich, sal_True ) != SFX_ITEM_ON ) { if( rEditEngine.HasParaAttrib( nPara, nWhich ) ) aSet.Put( rEditEngine.GetParaAttrib( nPara, nWhich ) ); @@ -120,7 +120,7 @@ SfxItemSet SvxEditEngineForwarder::GetParaAttribs( USHORT nPara ) const return aSet; } -void SvxEditEngineForwarder::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) +void SvxEditEngineForwarder::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) { rEditEngine.SetParaAttribs( nPara, rSet ); } @@ -135,7 +135,7 @@ SfxItemPool* SvxEditEngineForwarder::GetPool() const return rEditEngine.GetEmptyItemSet().GetPool(); } -void SvxEditEngineForwarder::GetPortions( USHORT nPara, SvUShorts& rList ) const +void SvxEditEngineForwarder::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const { rEditEngine.GetPortions( nPara, rList ); } @@ -160,24 +160,24 @@ void SvxEditEngineForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESel rEditEngine.QuickSetAttribs( rSet, rSel ); } -BOOL SvxEditEngineForwarder::IsValid() const +sal_Bool SvxEditEngineForwarder::IsValid() const { // cannot reliably query EditEngine state // while in the middle of an update return rEditEngine.GetUpdateMode(); } -XubString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ) +XubString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) { return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } -void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ) { rEditEngine.FieldClicked( rField, nPara, nPos ); } -USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, USHORT nWhich ) +sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich ) { EECharAttribArray aAttribs; @@ -186,16 +186,16 @@ USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSe SfxItemState eState = SFX_ITEM_DEFAULT; // check all paragraphs inside the selection - for( USHORT nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++ ) + for( sal_uInt16 nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++ ) { SfxItemState eParaState = SFX_ITEM_DEFAULT; // calculate start and endpos for this paragraph - USHORT nPos = 0; + sal_uInt16 nPos = 0; if( rSel.nStartPara == nPara ) nPos = rSel.nStartPos; - USHORT nEndPos = rSel.nEndPos; + sal_uInt16 nEndPos = rSel.nEndPos; if( rSel.nEndPara != nPara ) nEndPos = rEditEngine.GetTextLen( nPara ); @@ -203,13 +203,13 @@ USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSe // get list of char attribs rEditEngine.GetCharAttribs( nPara, aAttribs ); - BOOL bEmpty = TRUE; // we found no item inside the selektion of this paragraph - BOOL bGaps = FALSE; // we found items but theire gaps between them - USHORT nLastEnd = nPos; + sal_Bool bEmpty = sal_True; // we found no item inside the selektion of this paragraph + sal_Bool bGaps = sal_False; // we found items but theire gaps between them + sal_uInt16 nLastEnd = nPos; const SfxPoolItem* pParaItem = NULL; - for( USHORT nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++ ) + for( sal_uInt16 nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++ ) { struct EECharAttrib aAttrib = aAttribs.GetObject( nAttrib ); DBG_ASSERT( aAttrib.pAttr, "GetCharAttribs gives corrupt data" ); @@ -237,16 +237,16 @@ USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSe } if( bEmpty ) - bEmpty = FALSE; + bEmpty = sal_False; if( !bGaps && aAttrib.nStart > nLastEnd ) - bGaps = TRUE; + bGaps = sal_True; nLastEnd = aAttrib.nEnd; } if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) ) - bGaps = TRUE; + bGaps = sal_True; /* // since we have no portion with our item or if there were gaps if( bEmpty || bGaps ) @@ -309,45 +309,45 @@ USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSe return eState; } -USHORT SvxEditEngineForwarder::GetItemState( const ESelection& rSel, USHORT nWhich ) const +sal_uInt16 SvxEditEngineForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const { return GetSvxEditEngineItemState( rEditEngine, rSel, nWhich ); } -USHORT SvxEditEngineForwarder::GetItemState( USHORT nPara, USHORT nWhich ) const +sal_uInt16 SvxEditEngineForwarder::GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const { const SfxItemSet& rSet = rEditEngine.GetParaAttribs( nPara ); return rSet.GetItemState( nWhich ); } -LanguageType SvxEditEngineForwarder::GetLanguage( USHORT nPara, USHORT nIndex ) const +LanguageType SvxEditEngineForwarder::GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const { return rEditEngine.GetLanguage(nPara, nIndex); } -USHORT SvxEditEngineForwarder::GetFieldCount( USHORT nPara ) const +sal_uInt16 SvxEditEngineForwarder::GetFieldCount( sal_uInt16 nPara ) const { return rEditEngine.GetFieldCount(nPara); } -EFieldInfo SvxEditEngineForwarder::GetFieldInfo( USHORT nPara, USHORT nField ) const +EFieldInfo SvxEditEngineForwarder::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const { return rEditEngine.GetFieldInfo( nPara, nField ); } -EBulletInfo SvxEditEngineForwarder::GetBulletInfo( USHORT ) const +EBulletInfo SvxEditEngineForwarder::GetBulletInfo( sal_uInt16 ) const { return EBulletInfo(); } -Rectangle SvxEditEngineForwarder::GetCharBounds( USHORT nPara, USHORT nIndex ) const +Rectangle SvxEditEngineForwarder::GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const { // #101701# // EditEngine's 'internal' methods like GetCharacterBounds() // don't rotate for vertical text. Size aSize( rEditEngine.CalcTextWidth(), rEditEngine.GetTextHeight() ); ::std::swap( aSize.Width(), aSize.Height() ); - bool bIsVertical( rEditEngine.IsVertical() == TRUE ); + bool bIsVertical( rEditEngine.IsVertical() == sal_True ); // #108900# Handle virtual position one-past-the end of the string if( nIndex >= rEditEngine.GetTextLen(nPara) ) @@ -388,12 +388,12 @@ Rectangle SvxEditEngineForwarder::GetCharBounds( USHORT nPara, USHORT nIndex ) c } } -Rectangle SvxEditEngineForwarder::GetParaBounds( USHORT nPara ) const +Rectangle SvxEditEngineForwarder::GetParaBounds( sal_uInt16 nPara ) const { const Point aPnt = rEditEngine.GetDocPosTopLeft( nPara ); - ULONG nWidth; - ULONG nHeight; - ULONG nTextWidth; + sal_uLong nWidth; + sal_uLong nHeight; + sal_uLong nTextWidth; if( rEditEngine.IsVertical() ) { @@ -426,14 +426,13 @@ OutputDevice* SvxEditEngineForwarder::GetRefDevice() const return rEditEngine.GetRefDevice(); } -sal_Bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, USHORT& nPara, USHORT& nIndex ) const +sal_Bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, sal_uInt16& nPara, sal_uInt16& nIndex ) const { - // #101701# Size aSize( rEditEngine.CalcTextWidth(), rEditEngine.GetTextHeight() ); ::std::swap( aSize.Width(), aSize.Height() ); Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos, aSize, - rEditEngine.IsVertical() == TRUE )); + rEditEngine.IsVertical() == sal_True )); EPosition aDocPos = rEditEngine.FindDocPosition( aEEPos ); @@ -443,7 +442,7 @@ sal_Bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, USHORT& nPa return sal_True; } -sal_Bool SvxEditEngineForwarder::GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const +sal_Bool SvxEditEngineForwarder::GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const { ESelection aRes = rEditEngine.GetWord( ESelection(nPara, nIndex, nPara, nIndex), com::sun::star::i18n::WordType::DICTIONARY_WORD ); @@ -459,33 +458,33 @@ sal_Bool SvxEditEngineForwarder::GetWordIndices( USHORT nPara, USHORT nIndex, US return sal_False; } -sal_Bool SvxEditEngineForwarder::GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const +sal_Bool SvxEditEngineForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const { return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rEditEngine, nPara, nIndex ); } -USHORT SvxEditEngineForwarder::GetLineCount( USHORT nPara ) const +sal_uInt16 SvxEditEngineForwarder::GetLineCount( sal_uInt16 nPara ) const { return rEditEngine.GetLineCount(nPara); } -USHORT SvxEditEngineForwarder::GetLineLen( USHORT nPara, USHORT nLine ) const +sal_uInt16 SvxEditEngineForwarder::GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const { return rEditEngine.GetLineLen(nPara, nLine); } -void SvxEditEngineForwarder::GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nPara, USHORT nLine ) const +void SvxEditEngineForwarder::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const { rEditEngine.GetLineBoundaries(rStart, rEnd, nPara, nLine); } -USHORT SvxEditEngineForwarder::GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const +sal_uInt16 SvxEditEngineForwarder::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const { return rEditEngine.GetLineNumberAtIndex(nPara, nIndex); } -sal_Bool SvxEditEngineForwarder::QuickFormatDoc( BOOL ) +sal_Bool SvxEditEngineForwarder::QuickFormatDoc( sal_Bool ) { rEditEngine.QuickFormatDoc(); @@ -508,13 +507,13 @@ sal_Bool SvxEditEngineForwarder::InsertText( const String& rStr, const ESelectio return sal_True; } -sal_Int16 SvxEditEngineForwarder::GetDepth( USHORT ) const +sal_Int16 SvxEditEngineForwarder::GetDepth( sal_uInt16 ) const { // EditEngine does not support outline depth return -1; } -sal_Bool SvxEditEngineForwarder::SetDepth( USHORT, sal_Int16 nNewDepth ) +sal_Bool SvxEditEngineForwarder::SetDepth( sal_uInt16, sal_Int16 nNewDepth ) { // EditEngine does not support outline depth return nNewDepth == -1 ? sal_True : sal_False; @@ -530,11 +529,11 @@ void SvxEditEngineForwarder::AppendParagraph() rEditEngine.InsertParagraph( rEditEngine.GetParagraphCount(), String::EmptyString() ); } -xub_StrLen SvxEditEngineForwarder::AppendTextPortion( USHORT nPara, const String &rText, const SfxItemSet & /*rSet*/ ) +xub_StrLen SvxEditEngineForwarder::AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet & /*rSet*/ ) { xub_StrLen nLen = 0; - USHORT nParaCount = rEditEngine.GetParagraphCount(); + sal_uInt16 nParaCount = rEditEngine.GetParagraphCount(); DBG_ASSERT( nPara < nParaCount, "paragraph index out of bounds" ); if (/*0 <= nPara && */nPara < nParaCount) { diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index a7b67a3426..f95c1bf90b 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -50,7 +50,7 @@ using namespace ::com::sun::star; //------------------------------------------------------------------------ -SvxOutlinerForwarder::SvxOutlinerForwarder( Outliner& rOutl, BOOL bOutlText /* = FALSE */ ) : +SvxOutlinerForwarder::SvxOutlinerForwarder( Outliner& rOutl, sal_Bool bOutlText /* = sal_False */ ) : rOutliner( rOutl ), bOutlinerText( bOutlText ), mpAttribsCache( NULL ), @@ -64,25 +64,25 @@ SvxOutlinerForwarder::~SvxOutlinerForwarder() flushCache(); } -USHORT SvxOutlinerForwarder::GetParagraphCount() const +sal_uInt16 SvxOutlinerForwarder::GetParagraphCount() const { - return (USHORT)rOutliner.GetParagraphCount(); + return (sal_uInt16)rOutliner.GetParagraphCount(); } -USHORT SvxOutlinerForwarder::GetTextLen( USHORT nParagraph ) const +sal_uInt16 SvxOutlinerForwarder::GetTextLen( sal_uInt16 nParagraph ) const { return rOutliner.GetEditEngine().GetTextLen( nParagraph ); } String SvxOutlinerForwarder::GetText( const ESelection& rSel ) const { - //! GetText(ESelection) sollte es wohl auch mal am Outliner geben - // solange den Hack fuer die EditEngine uebernehmen: + //! GetText (ESelection) should probably also be in the Outliner + // in the time beeing use as the hack for the EditEngine: EditEngine* pEditEngine = (EditEngine*)&rOutliner.GetEditEngine(); return pEditEngine->GetText( rSel, LINEEND_LF ); } -static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib, EditEngine& rEditEngine ) +static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib, EditEngine& rEditEngine ) { if( rSel.nStartPara == rSel.nEndPara ) { @@ -100,7 +100,7 @@ static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, BOOL nFlags = GETATTRIBS_CHARATTRIBS; break; default: - DBG_ERROR("unknown flags for SvxOutlinerForwarder::GetAttribs"); + OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs"); } return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags ); } @@ -110,7 +110,7 @@ static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, BOOL } } -SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) const +SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const { if( mpAttribsCache && ( 0 == bOnlyHardAttrib ) ) { @@ -128,8 +128,8 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, BOOL bOnlyH } } - //! gibt's das nicht am Outliner ??? - //! und warum ist GetAttribs an der EditEngine nicht const? + //! Does it not exist on the Outliner? + //! and why is the GetAttribs on the EditEngine not a const? EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine(); SfxItemSet aSet( ImplOutlinerForwarderGetAttribs( rSel, bOnlyHardAttrib, rEditEngine ) ); @@ -147,7 +147,7 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, BOOL bOnlyH return aSet; } -SfxItemSet SvxOutlinerForwarder::GetParaAttribs( USHORT nPara ) const +SfxItemSet SvxOutlinerForwarder::GetParaAttribs( sal_uInt16 nPara ) const { if( mpParaAttribsCache ) { @@ -177,7 +177,7 @@ SfxItemSet SvxOutlinerForwarder::GetParaAttribs( USHORT nPara ) const return *mpParaAttribsCache; } -void SvxOutlinerForwarder::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) +void SvxOutlinerForwarder::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) { flushCache(); @@ -201,7 +201,7 @@ SfxItemPool* SvxOutlinerForwarder::GetPool() const return rOutliner.GetEmptyItemSet().GetPool(); } -void SvxOutlinerForwarder::GetPortions( USHORT nPara, SvUShorts& rList ) const +void SvxOutlinerForwarder::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const { ((EditEngine&)rOutliner.GetEditEngine()).GetPortions( nPara, rList ); } @@ -237,31 +237,31 @@ void SvxOutlinerForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelec rOutliner.QuickSetAttribs( rSet, rSel ); } -XubString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ) +XubString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) { return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } -void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ) { rOutliner.FieldClicked( rField, nPara, nPos ); } -BOOL SvxOutlinerForwarder::IsValid() const +sal_Bool SvxOutlinerForwarder::IsValid() const { // cannot reliably query outliner state // while in the middle of an update return rOutliner.GetUpdateMode(); } -extern USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, USHORT nWhich ); +extern sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich ); -USHORT SvxOutlinerForwarder::GetItemState( const ESelection& rSel, USHORT nWhich ) const +sal_uInt16 SvxOutlinerForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const { return GetSvxEditEngineItemState( (EditEngine&)rOutliner.GetEditEngine(), rSel, nWhich ); } -USHORT SvxOutlinerForwarder::GetItemState( USHORT nPara, USHORT nWhich ) const +sal_uInt16 SvxOutlinerForwarder::GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const { const SfxItemSet& rSet = rOutliner.GetParaAttribs( nPara ); return rSet.GetItemState( nWhich ); @@ -283,34 +283,33 @@ void SvxOutlinerForwarder::flushCache() } } -LanguageType SvxOutlinerForwarder::GetLanguage( USHORT nPara, USHORT nIndex ) const +LanguageType SvxOutlinerForwarder::GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const { return rOutliner.GetLanguage(nPara, nIndex); } -USHORT SvxOutlinerForwarder::GetFieldCount( USHORT nPara ) const +sal_uInt16 SvxOutlinerForwarder::GetFieldCount( sal_uInt16 nPara ) const { return rOutliner.GetEditEngine().GetFieldCount(nPara); } -EFieldInfo SvxOutlinerForwarder::GetFieldInfo( USHORT nPara, USHORT nField ) const +EFieldInfo SvxOutlinerForwarder::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const { return rOutliner.GetEditEngine().GetFieldInfo( nPara, nField ); } -EBulletInfo SvxOutlinerForwarder::GetBulletInfo( USHORT nPara ) const +EBulletInfo SvxOutlinerForwarder::GetBulletInfo( sal_uInt16 nPara ) const { return rOutliner.GetBulletInfo( nPara ); } -Rectangle SvxOutlinerForwarder::GetCharBounds( USHORT nPara, USHORT nIndex ) const +Rectangle SvxOutlinerForwarder::GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const { - // #101701# // EditEngine's 'internal' methods like GetCharacterBounds() // don't rotate for vertical text. Size aSize( rOutliner.CalcTextSize() ); ::std::swap( aSize.Width(), aSize.Height() ); - bool bIsVertical( rOutliner.IsVertical() == TRUE ); + bool bIsVertical( rOutliner.IsVertical() == sal_True ); // #108900# Handle virtual position one-past-the end of the string if( nIndex >= GetTextLen(nPara) ) @@ -351,24 +350,23 @@ Rectangle SvxOutlinerForwarder::GetCharBounds( USHORT nPara, USHORT nIndex ) con } } -Rectangle SvxOutlinerForwarder::GetParaBounds( USHORT nPara ) const +Rectangle SvxOutlinerForwarder::GetParaBounds( sal_uInt16 nPara ) const { Point aPnt = rOutliner.GetDocPosTopLeft( nPara ); Size aSize = rOutliner.CalcTextSize(); if( rOutliner.IsVertical() ) { - // #101701# // Hargl. Outliner's 'external' methods return the rotated // dimensions, 'internal' methods like GetTextHeight( n ) // don't rotate. - ULONG nWidth = rOutliner.GetTextHeight( nPara ); + sal_uLong nWidth = rOutliner.GetTextHeight( nPara ); return Rectangle( aSize.Width() - aPnt.Y() - nWidth, 0, aSize.Width() - aPnt.Y(), aSize.Height() ); } else { - ULONG nHeight = rOutliner.GetTextHeight( nPara ); + sal_uLong nHeight = rOutliner.GetTextHeight( nPara ); return Rectangle( 0, aPnt.Y(), aSize.Width(), aPnt.Y() + nHeight ); } @@ -384,14 +382,13 @@ OutputDevice* SvxOutlinerForwarder::GetRefDevice() const return rOutliner.GetRefDevice(); } -sal_Bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, USHORT& nPara, USHORT& nIndex ) const +sal_Bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, sal_uInt16& nPara, sal_uInt16& nIndex ) const { - // #101701# Size aSize( rOutliner.CalcTextSize() ); ::std::swap( aSize.Width(), aSize.Height() ); Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos, aSize, - rOutliner.IsVertical() == TRUE )); + rOutliner.IsVertical() == sal_True )); EPosition aDocPos = rOutliner.GetEditEngine().FindDocPosition( aEEPos ); @@ -401,7 +398,7 @@ sal_Bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, USHORT& nPara return sal_True; } -sal_Bool SvxOutlinerForwarder::GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const +sal_Bool SvxOutlinerForwarder::GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const { ESelection aRes = rOutliner.GetEditEngine().GetWord( ESelection(nPara, nIndex, nPara, nIndex), com::sun::star::i18n::WordType::DICTIONARY_WORD ); @@ -417,32 +414,32 @@ sal_Bool SvxOutlinerForwarder::GetWordIndices( USHORT nPara, USHORT nIndex, USHO return sal_False; } -sal_Bool SvxOutlinerForwarder::GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const +sal_Bool SvxOutlinerForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const { return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rOutliner.GetEditEngine(), nPara, nIndex ); } -USHORT SvxOutlinerForwarder::GetLineCount( USHORT nPara ) const +sal_uInt16 SvxOutlinerForwarder::GetLineCount( sal_uInt16 nPara ) const { - return static_cast < USHORT >( rOutliner.GetLineCount(nPara) ); + return static_cast < sal_uInt16 >( rOutliner.GetLineCount(nPara) ); } -USHORT SvxOutlinerForwarder::GetLineLen( USHORT nPara, USHORT nLine ) const +sal_uInt16 SvxOutlinerForwarder::GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const { return rOutliner.GetLineLen(nPara, nLine); } -void SvxOutlinerForwarder::GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nPara, USHORT nLine ) const +void SvxOutlinerForwarder::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const { return rOutliner.GetEditEngine().GetLineBoundaries( rStart, rEnd, nPara, nLine ); } -USHORT SvxOutlinerForwarder::GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const +sal_uInt16 SvxOutlinerForwarder::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const { return rOutliner.GetEditEngine().GetLineNumberAtIndex( nPara, nIndex ); } -sal_Bool SvxOutlinerForwarder::QuickFormatDoc( BOOL ) +sal_Bool SvxOutlinerForwarder::QuickFormatDoc( sal_Bool ) { rOutliner.QuickFormatDoc(); @@ -467,7 +464,7 @@ sal_Bool SvxOutlinerForwarder::InsertText( const String& rStr, const ESelection& return sal_True; } -sal_Int16 SvxOutlinerForwarder::GetDepth( USHORT nPara ) const +sal_Int16 SvxOutlinerForwarder::GetDepth( sal_uInt16 nPara ) const { DBG_ASSERT( nPara < GetParagraphCount(), "SvxOutlinerForwarder::GetDepth: Invalid paragraph index"); @@ -481,7 +478,7 @@ sal_Int16 SvxOutlinerForwarder::GetDepth( USHORT nPara ) const return nLevel; } -sal_Bool SvxOutlinerForwarder::SetDepth( USHORT nPara, sal_Int16 nNewDepth ) +sal_Bool SvxOutlinerForwarder::SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ) { DBG_ASSERT( nPara < GetParagraphCount(), "SvxOutlinerForwarder::SetDepth: Invalid paragraph index"); @@ -511,7 +508,7 @@ sal_Int16 SvxOutlinerForwarder::GetNumberingStartValue( sal_uInt16 nPara ) } else { - DBG_ERROR( "SvxOutlinerForwarder::GetNumberingStartValue)(), Invalid paragraph index"); + OSL_FAIL( "SvxOutlinerForwarder::GetNumberingStartValue)(), Invalid paragraph index"); return -1; } } @@ -524,7 +521,7 @@ void SvxOutlinerForwarder::SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 } else { - DBG_ERROR( "SvxOutlinerForwarder::SetNumberingStartValue)(), Invalid paragraph index"); + OSL_FAIL( "SvxOutlinerForwarder::SetNumberingStartValue)(), Invalid paragraph index"); } } @@ -536,7 +533,7 @@ sal_Bool SvxOutlinerForwarder::IsParaIsNumberingRestart( sal_uInt16 nPara ) } else { - DBG_ERROR( "SvxOutlinerForwarder::IsParaIsNumberingRestart)(), Invalid paragraph index"); + OSL_FAIL( "SvxOutlinerForwarder::IsParaIsNumberingRestart)(), Invalid paragraph index"); return sal_False; } } @@ -549,7 +546,7 @@ void SvxOutlinerForwarder::SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Boo } else { - DBG_ERROR( "SvxOutlinerForwarder::SetParaIsNumberingRestart)(), Invalid paragraph index"); + OSL_FAIL( "SvxOutlinerForwarder::SetParaIsNumberingRestart)(), Invalid paragraph index"); } } @@ -565,12 +562,12 @@ void SvxOutlinerForwarder::AppendParagraph() rEditEngine.InsertParagraph( rEditEngine.GetParagraphCount(), String::EmptyString() ); } -xub_StrLen SvxOutlinerForwarder::AppendTextPortion( USHORT nPara, const String &rText, const SfxItemSet & /*rSet*/ ) +xub_StrLen SvxOutlinerForwarder::AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet & /*rSet*/ ) { xub_StrLen nLen = 0; EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() ); - USHORT nParaCount = rEditEngine.GetParagraphCount(); + sal_uInt16 nParaCount = rEditEngine.GetParagraphCount(); DBG_ASSERT( nPara < nParaCount, "paragraph index out of bounds" ); if (/*0 <= nPara && */nPara < nParaCount) { diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 3616dda34c..1aa2737458 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * 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 @@ -30,10 +30,8 @@ #include "precompiled_editeng.hxx" #include <com/sun/star/beans/XPropertySet.hpp> #include <svl/eitem.hxx> -#include <tools/list.hxx> -#include <hash_map> -#include <vector> +#include <boost/unordered_map.hpp> #include <svl/itemprop.hxx> #include <editeng/unoipset.hxx> @@ -45,6 +43,8 @@ using namespace ::com::sun::star; using namespace ::rtl; +using ::std::vector; + //---------------------------------------------------------------------- struct SfxItemPropertyMapEntryHash @@ -60,13 +60,11 @@ struct SvxIDPropertyCombine uno::Any aAny; }; -DECLARE_LIST( SvxIDPropertyCombineList, SvxIDPropertyCombine * ) SvxItemPropertySet::SvxItemPropertySet( const SfxItemPropertyMapEntry* pMap, SfxItemPool& rItemPool, sal_Bool bConvertTwips ) : m_aPropertyMap( pMap ), _pMap(pMap), mbConvertTwips(bConvertTwips), mrItemPool( rItemPool ) { - pCombiList = NULL; } //---------------------------------------------------------------------- @@ -78,16 +76,11 @@ SvxItemPropertySet::~SvxItemPropertySet() //---------------------------------------------------------------------- uno::Any* SvxItemPropertySet::GetUsrAnyForID(sal_uInt16 nWID) const { - if(pCombiList && pCombiList->Count()) + for ( size_t i = 0, n = aCombineList.size(); i < n; ++i ) { - SvxIDPropertyCombine* pActual = pCombiList->First(); - while(pActual) - { - if(pActual->nWID == nWID) - return &pActual->aAny; - pActual = pCombiList->Next(); - - } + SvxIDPropertyCombine* pActual = aCombineList[ i ]; + if( pActual->nWID == nWID ) + return &pActual->aAny; } return NULL; } @@ -95,22 +88,19 @@ uno::Any* SvxItemPropertySet::GetUsrAnyForID(sal_uInt16 nWID) const //---------------------------------------------------------------------- void SvxItemPropertySet::AddUsrAnyForID(const uno::Any& rAny, sal_uInt16 nWID) { - if(!pCombiList) - pCombiList = new SvxIDPropertyCombineList(); - SvxIDPropertyCombine* pNew = new SvxIDPropertyCombine; pNew->nWID = nWID; pNew->aAny = rAny; - pCombiList->Insert(pNew); + aCombineList.push_back( pNew ); } //---------------------------------------------------------------------- void SvxItemPropertySet::ClearAllUsrAny() { - if(pCombiList) - delete pCombiList; - pCombiList = NULL; + for ( size_t i = 0, n = aCombineList.size(); i < n; ++i ) + delete aCombineList[ i ]; + aCombineList.clear(); } //---------------------------------------------------------------------- @@ -138,8 +128,8 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* if( NULL == pItem && pPool ) pItem = &(pPool->GetDefaultItem( pMap->nWID )); - const SfxMapUnit eMapUnit = pPool ? pPool->GetMetric((USHORT)pMap->nWID) : SFX_MAPUNIT_100TH_MM; - BYTE nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); + const SfxMapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : SFX_MAPUNIT_100TH_MM; + sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); if( eMapUnit == SFX_MAPUNIT_100TH_MM ) nMemberId &= (~CONVERT_TWIPS); @@ -152,7 +142,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* { if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aVal ) ) SvxUnoConvertToMM( eMapUnit, aVal ); - } + } } else if ( pMap->pType->getTypeClass() == uno::TypeClass_ENUM && aVal.getValueType() == ::getCppuType((const sal_Int32*)0) ) @@ -165,7 +155,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* } else { - DBG_ERROR( "No SfxPoolItem found for property!" ); + OSL_FAIL( "No SfxPoolItem found for property!" ); } return aVal; @@ -177,18 +167,18 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa if(!pMap || !pMap->nWID) return; - // item holen + // Get item const SfxPoolItem* pItem = 0; SfxPoolItem *pNewItem = 0; SfxItemState eState = rSet.GetItemState( pMap->nWID, sal_True, &pItem ); SfxItemPool* pPool = rSet.GetPool(); - // UnoAny in item-Wert stecken + // Put UnoAny in the item value if(eState < SFX_ITEM_DEFAULT || pItem == NULL) { if( pPool == NULL ) { - DBG_ERROR( "No default item and no pool?" ); + OSL_FAIL( "No default item and no pool?" ); return; } @@ -200,7 +190,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa { uno::Any aValue( rVal ); - const SfxMapUnit eMapUnit = pPool ? pPool->GetMetric((USHORT)pMap->nWID) : SFX_MAPUNIT_100TH_MM; + const SfxMapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : SFX_MAPUNIT_100TH_MM; // check for needed metric translation if( (pMap->nMemberId & SFX_METRIC_ITEM) && eMapUnit != SFX_MAPUNIT_100TH_MM ) @@ -211,13 +201,13 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa pNewItem = pItem->Clone(); - BYTE nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); + sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); if( eMapUnit == SFX_MAPUNIT_100TH_MM ) nMemberId &= (~CONVERT_TWIPS); if( pNewItem->PutValue( aValue, nMemberId ) ) { - // neues item in itemset setzen + // Set new item in item set rSet.Put( *pNewItem, pMap->nWID ); } delete pNewItem; @@ -227,25 +217,22 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa //---------------------------------------------------------------------- uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* pMap ) const { - // Schon ein Wert eingetragen? Dann schnell fertig + // Already entered a value? Then finish quickly uno::Any* pUsrAny = GetUsrAnyForID(pMap->nWID); if(pUsrAny) return *pUsrAny; - // Noch kein UsrAny gemerkt, generiere Default-Eintrag und gib - // diesen zurueck - - const SfxMapUnit eMapUnit = mrItemPool.GetMetric((USHORT)pMap->nWID); - BYTE nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); + // No UsrAny detected yet, generate Default entry and return this + const SfxMapUnit eMapUnit = mrItemPool.GetMetric((sal_uInt16)pMap->nWID); + sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); if( eMapUnit == SFX_MAPUNIT_100TH_MM ) nMemberId &= (~CONVERT_TWIPS); - uno::Any aVal; SfxItemSet aSet( mrItemPool, pMap->nWID, pMap->nWID); if( (pMap->nWID < OWN_ATTR_VALUE_START) && (pMap->nWID > OWN_ATTR_VALUE_END ) ) { - // Default aus ItemPool holen + // Get Default from ItemPool if(mrItemPool.IsWhich(pMap->nWID)) aSet.Put(mrItemPool.GetDefaultItem(pMap->nWID)); } @@ -267,7 +254,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* if(pMap->nMemberId & SFX_METRIC_ITEM && eMapUnit != SFX_MAPUNIT_100TH_MM) { SvxUnoConvertToMM( eMapUnit, aVal ); - } + } } if ( pMap->pType->getTypeClass() == uno::TypeClass_ENUM && @@ -344,13 +331,13 @@ void SvxUnoConvertToMM( const SfxMapUnit eSourceMapUnit, uno::Any & rMetric ) th rMetric <<= (sal_uInt32)(TWIPS_TO_MM(*(sal_uInt32*)rMetric.getValue())); break; default: - DBG_ERROR("AW: Missing unit translation to 100th mm!"); + OSL_FAIL("AW: Missing unit translation to 100th mm!"); } break; } default: { - DBG_ERROR("AW: Missing unit translation to 100th mm!"); + OSL_FAIL("AW: Missing unit translation to 100th mm!"); } } } @@ -382,13 +369,13 @@ void SvxUnoConvertFromMM( const SfxMapUnit eDestinationMapUnit, uno::Any & rMetr rMetric <<= (sal_uInt32)(MM_TO_TWIPS(*(sal_uInt32*)rMetric.getValue())); break; default: - DBG_ERROR("AW: Missing unit translation to 100th mm!"); + OSL_FAIL("AW: Missing unit translation to 100th mm!"); } break; } default: { - DBG_ERROR("AW: Missing unit translation to PoolMetrics!"); + OSL_FAIL("AW: Missing unit translation to PoolMetrics!"); } } } diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx index a9c5dd6f6d..6513fabb25 100644 --- a/editeng/source/uno/unonrule.cxx +++ b/editeng/source/uno/unonrule.cxx @@ -279,7 +279,7 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex( sa aVal <<= (sal_Int16)rFmt.GetBulletRelSize(); pArray[nIdx++] = beans::PropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_NRULE_BULLET_RELSIZE)), -1, aVal, beans::PropertyState_DIRECT_VALUE); - DBG_ASSERT( nIdx <= nProps, "FixMe: Array uebergelaufen!!!! [CL]" ); + DBG_ASSERT( nIdx <= nProps, "FixMe: overflow in Array!!! [CL]" ); Sequence< beans::PropertyValue> aSeq(pArray, nIdx); delete [] pArray; @@ -548,7 +548,7 @@ com::sun::star::uno::Reference< com::sun::star::container::XIndexReplace > SvxCr } else { - SvxNumRule aDefaultRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10 , FALSE); + SvxNumRule aDefaultRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10 , sal_False); return new SvxUnoNumberingRules( aDefaultRule ); } } @@ -584,13 +584,13 @@ sal_Int16 SvxUnoNumberingRules::Compare( const Any& Any1, const Any& Any2 ) const SvxNumRule& rRule1 = pRule1->getNumRule(); const SvxNumRule& rRule2 = pRule2->getNumRule(); - const USHORT nLevelCount1 = rRule1.GetLevelCount(); - const USHORT nLevelCount2 = rRule2.GetLevelCount(); + const sal_uInt16 nLevelCount1 = rRule1.GetLevelCount(); + const sal_uInt16 nLevelCount2 = rRule2.GetLevelCount(); if( nLevelCount1 == 0 || nLevelCount2 == 0 ) return -1; - for( USHORT i = 0; (i < nLevelCount1) && (i < nLevelCount2); i++ ) + for( sal_uInt16 i = 0; (i < nLevelCount1) && (i < nLevelCount2); i++ ) { if( rRule1.GetLevel(i) != rRule2.GetLevel(i) ) return -1; diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index d0bf0b206b..029168192f 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -40,6 +40,7 @@ #include <svl/eitem.hxx> #include <rtl/uuid.h> #include <rtl/memory.h> +#include <rtl/instance.hxx> #include <editeng/fontitem.hxx> #include <editeng/tstpitem.hxx> @@ -72,7 +73,7 @@ const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap() { - // Propertymap fuer einen Outliner Text + // Propertymap for an Outliner Text static const SfxItemPropertyMapEntry aSvxTextPortionPropertyMap[] = { SVX_UNOEDIT_CHAR_PROPERTIES, @@ -101,7 +102,7 @@ const SfxItemPropertySet* ImplGetSvxTextPortionSfxPropertySet() const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap() { - // Propertymap fuer einen Outliner Text + // Propertymap for an Outliner Text static const SfxItemPropertyMapEntry aSvxUnoOutlinerTextCursorPropertyMap[] = { SVX_UNOEDIT_CHAR_PROPERTIES, @@ -122,7 +123,7 @@ const SfxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSfxPropertySet() } // ==================================================================== -// helper fuer Item/Property Konvertierung +// helper for Item/Property conversion // ==================================================================== void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw() @@ -191,65 +192,11 @@ void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) thr // class SvxUnoTextRangeBase // ==================================================================== -#ifdef DEBUG -class check_me -{ -public: - check_me() : mnAllocNum(0) {}; - ~check_me(); - - void add( SvxUnoTextRangeBase* pRange ); - void remove( SvxUnoTextRangeBase* pRange ); - - std::list< std::pair< sal_uInt32, SvxUnoTextRangeBase* > > maRanges; - sal_uInt32 mnAllocNum; -}; - -void check_me::add( SvxUnoTextRangeBase* pRange ) -{ - maRanges.push_back( std::pair< sal_uInt32, SvxUnoTextRangeBase* >( mnAllocNum++, pRange ) ); -} - -void check_me::remove( SvxUnoTextRangeBase* pRange ) -{ - std::list< std::pair< sal_uInt32, SvxUnoTextRangeBase* > >::iterator aIter; - for( aIter = maRanges.begin(); aIter != maRanges.end(); aIter++ ) - { - if( pRange == (*aIter).second ) - { - maRanges.erase( aIter ); - break; - } - } -} - -check_me::~check_me() -{ - if( !maRanges.empty() ) - { - DBG_ERROR("living text range detected!"); - std::list< std::pair< sal_uInt32, SvxUnoTextRangeBase* > >::iterator aIter; - for( aIter = maRanges.begin(); aIter != maRanges.end(); aIter++ ) - { - sal_Int32 nAllocNum; - SvxUnoTextRangeBase* pRange; - nAllocNum = (*aIter).first; - pRange = (*aIter).second; - } - } -} - -static check_me gNumRanges; -#endif - UNO3_GETIMPLEMENTATION_IMPL( SvxUnoTextRangeBase ); SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxItemPropertySet* _pSet ) throw() : mpEditSource(NULL) , mpPropSet(_pSet) { -#ifdef DEBUG - gNumRanges.add(this); -#endif } SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw() @@ -268,9 +215,6 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const Sv mpEditSource->addRange( this ); } -#ifdef DEBUG - gNumRanges.add(this); -#endif } SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw() @@ -297,18 +241,10 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) th if( mpEditSource ) mpEditSource->addRange( this ); - -#ifdef DEBUG - gNumRanges.add(this); -#endif } SvxUnoTextRangeBase::~SvxUnoTextRangeBase() throw() { -#ifdef DEBUG - gNumRanges.remove(this); -#endif - if( mpEditSource ) mpEditSource->removeRange( this ); @@ -444,14 +380,14 @@ void SAL_CALL SvxUnoTextRangeBase::setString(const OUString& aString) CheckSelection( maSelection, pForwarder ); String aConverted( aString ); - aConverted.ConvertLineEnd( LINEEND_LF ); // Zeilenenden nur einfach zaehlen + aConverted.ConvertLineEnd( LINEEND_LF ); // Simply count the number of line endings pForwarder->QuickInsertText( aConverted, maSelection ); mpEditSource->UpdateData(); - // Selektion anpassen - //! Wenn die EditEngine bei QuickInsertText die Selektion zurueckgeben wuerde, - //! waer's einfacher... + // Adapt selection + //! It would be easier if the EditEngine would return the selection + //! on QuickInsertText... CollapseToStart(); sal_uInt16 nLen = aConverted.Len(); @@ -519,9 +455,9 @@ void SAL_CALL SvxUnoTextRangeBase::_setPropertyValue( const OUString& PropertyNa while( nPara <= nEndPara ) { // we have a paragraph - SfxItemSet aSet( pForwarder->GetParaAttribs( (USHORT)nPara ) ); + SfxItemSet aSet( pForwarder->GetParaAttribs( (sal_uInt16)nPara ) ); setPropertyValue( pMap, aValue, maSelection, aSet, aSet ); - pForwarder->SetParaAttribs( (USHORT)nPara, aSet ); + pForwarder->SetParaAttribs( (sal_uInt16)nPara, aSet ); nPara++; } } @@ -538,9 +474,9 @@ void SvxUnoTextRangeBase::setPropertyValue( const SfxItemPropertySimpleEntry* pM { if(!SetPropertyValueHelper( rOldSet, pMap, rValue, rNewSet, &rSelection, GetEditSource() )) { - // Fuer Teile von zusammengesetzten Items mit mehreren Properties (z.B. Hintergrund) - // muss vorher das alte Item aus dem Dokument geholt werden - rNewSet.Put(rOldSet.Get(pMap->nWID)); // altes Item in neuen Set + // For parts of composite items with multiple properties (eg background) + // must be taken from the document before the old item. + rNewSet.Put(rOldSet.Get(pMap->nWID)); // Old Item in new Set mpPropSet->setPropertyValue(pMap, rValue, rNewSet, false ); } } @@ -654,11 +590,11 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::_getPropertyValue(const OUString& Propert { SfxItemSet* pAttribs = NULL; if( nPara != -1 ) - pAttribs = pForwarder->GetParaAttribs( (USHORT)nPara ).Clone(); + pAttribs = pForwarder->GetParaAttribs( (sal_uInt16)nPara ).Clone(); else pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone(); - // Dontcare durch Default ersetzen, damit man immer eine Reflection hat + // Replace Dontcare with Default, so that one always has a mirror pAttribs->ClearInvalidItems(); getPropertyValue( pMap, aAny, *pAttribs ); @@ -789,7 +725,7 @@ sal_Bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet& rSet, const S return sal_True; } -// wird (noch) nicht unterstuetzt +// is not (yet) supported void SAL_CALL SvxUnoTextRangeBase::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} void SAL_CALL SvxUnoTextRangeBase::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} void SAL_CALL SvxUnoTextRangeBase::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} @@ -863,7 +799,7 @@ void SAL_CALL SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< ::rt { if( NULL == pNewParaSet ) { - const SfxItemSet aSet( pForwarder->GetParaAttribs( (USHORT)nTempPara ) ); + const SfxItemSet aSet( pForwarder->GetParaAttribs( (sal_uInt16)nTempPara ) ); pOldParaSet = new SfxItemSet( aSet ); pNewParaSet = new SfxItemSet( *pOldParaSet->GetPool(), pOldParaSet->GetRanges() ); } @@ -891,9 +827,9 @@ void SAL_CALL SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< ::rt { while( nTempPara <= nEndPara ) { - SfxItemSet aSet( pForwarder->GetParaAttribs( (USHORT)nTempPara ) ); + SfxItemSet aSet( pForwarder->GetParaAttribs( (sal_uInt16)nTempPara ) ); aSet.Put( *pNewParaSet ); - pForwarder->SetParaAttribs( (USHORT)nTempPara, aSet ); + pForwarder->SetParaAttribs( (sal_uInt16)nTempPara, aSet ); nTempPara++; } bNeedsUpdate = sal_True; @@ -939,7 +875,7 @@ uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::_getPropertyValues( cons { SfxItemSet* pAttribs = NULL; if( nPara != -1 ) - pAttribs = pForwarder->GetParaAttribs( (USHORT)nPara ).Clone(); + pAttribs = pForwarder->GetParaAttribs( (sal_uInt16)nPara ).Clone(); else pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone(); @@ -1007,7 +943,7 @@ beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const SfxIt while( *pWhichId ) { if(nPara != -1) - eTempItemState = pForwarder->GetItemState( (USHORT)nPara, *pWhichId ); + eTempItemState = pForwarder->GetItemState( (sal_uInt16)nPara, *pWhichId ); else eTempItemState = pForwarder->GetItemState( GetSelection(), *pWhichId ); @@ -1056,7 +992,7 @@ beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const SfxIt if( nWID != 0 ) { if( nPara != -1 ) - eItemState = pForwarder->GetItemState( (USHORT)nPara, nWID ); + eItemState = pForwarder->GetItemState( (sal_uInt16)nPara, nWID ); else eItemState = pForwarder->GetItemState( GetSelection(), nWID ); } @@ -1107,7 +1043,7 @@ uno::Sequence< beans::PropertyState > SvxUnoTextRangeBase::_getPropertyStates(co SfxItemSet* pSet = NULL; if( nPara != -1 ) { - pSet = new SfxItemSet( pForwarder->GetParaAttribs( (USHORT)nPara ) ); + pSet = new SfxItemSet( pForwarder->GetParaAttribs( (sal_uInt16)nPara ) ); } else { @@ -1255,7 +1191,7 @@ void SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, co { do { - SfxItemSet aSet( *pForwarder->GetPool(), TRUE ); + SfxItemSet aSet( *pForwarder->GetPool(), sal_True ); if( pMap->nWID == WID_FONTDESC ) { @@ -1281,7 +1217,7 @@ void SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, co } if(nPara != -1) - pForwarder->SetParaAttribs( (USHORT)nPara, aSet ); + pForwarder->SetParaAttribs( (sal_uInt16)nPara, aSet ); else pForwarder->QuickSetAttribs( aSet, GetSelection() ); @@ -1324,7 +1260,7 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aProp default: { - // Default aus ItemPool holen + // Get Default from ItemPool if(pPool->IsWhich(pMap->nWID)) { SfxItemSet aSet( *pPool, pMap->nWID, pMap->nWID); @@ -1422,7 +1358,7 @@ sal_Bool SvxUnoTextRangeBase::GoLeft(sal_Int16 nCount, sal_Bool Expand) throw() else { if ( !pForwarder ) - pForwarder = mpEditSource->GetTextForwarder(); // erst hier, wenn's noetig ist... + pForwarder = mpEditSource->GetTextForwarder(); // first here, it it is necessary... --nNewPar; nCount -= nNewPos + 1; @@ -1451,7 +1387,7 @@ sal_Bool SvxUnoTextRangeBase::GoRight(sal_Int16 nCount, sal_Bool Expand) throw( CheckSelection( maSelection, pForwarder ); - sal_uInt16 nNewPos = maSelection.nEndPos + nCount; //! Ueberlauf ??? + sal_uInt16 nNewPos = maSelection.nEndPos + nCount; //! Overflow??? sal_uInt16 nNewPar = maSelection.nEndPara; sal_Bool bOk = sal_True; @@ -1588,8 +1524,6 @@ sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionEnds( const uno::Reference< // class SvxUnoTextRange // ==================================================================== -uno::Sequence< uno::Type > SvxUnoTextRange::maTypeSequence; - uno::Reference< uno::XInterface > SvxUnoTextRange_NewInstance() { SvxUnoText aText; @@ -1651,25 +1585,37 @@ void SAL_CALL SvxUnoTextRange::release() // XTypeProvider +namespace +{ + struct theSvxUnoTextRangeTypes : + public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextRangeTypes> + { + uno::Sequence<uno::Type> operator () () + { + uno::Sequence< uno::Type > aTypeSequence; + + aTypeSequence.realloc( 9 ); // !DANGER! keep this updated + uno::Type* pTypes = aTypeSequence.getArray(); + + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); + + return aTypeSequence; + } + }; +} + uno::Sequence< uno::Type > SAL_CALL SvxUnoTextRange::getTypes() throw (uno::RuntimeException) { - if( maTypeSequence.getLength() == 0 ) - { - maTypeSequence.realloc( 9 ); // !DANGER! keep this updated - uno::Type* pTypes = maTypeSequence.getArray(); - - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); - } - return maTypeSequence; + return theSvxUnoTextRangeTypes::get(); } uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextRange::getImplementationId() @@ -1702,10 +1648,6 @@ OUString SAL_CALL SvxUnoTextRange::getImplementationName() // class SvxUnoText // ==================================================================== -// UNO3_GETIMPLEMENTATION2_IMPL( SvxUnoText, SvxUnoTextRangeBase ); - -uno::Sequence< uno::Type > SvxUnoTextBase::maTypeSequence; - SvxUnoTextBase::SvxUnoTextBase() throw() : SvxUnoTextRangeBase( NULL ) { @@ -1758,15 +1700,14 @@ ESelection SvxUnoTextBase::InsertField( const SvxFieldItem& rField ) throw() pForwarder->QuickInsertField( rField, GetSelection() ); GetEditSource()->UpdateData(); - // Selektion anpassen - //! Wenn die EditEngine bei QuickInsertText die Selektion zurueckgeben wuerde, - //! waer's einfacher... - + // Adapt selection + //! It would be easier if the EditEngine would return the selection + //! on QuickInsertText... CollapseToStart(); - GoRight( 1, sal_True ); // Feld ist immer 1 Zeichen + GoRight( 1, sal_True ); // Field is always 1 character } - return GetSelection(); // Selektion mit dem Feld + return GetSelection(); // Selection with the field } // XInterface @@ -1798,30 +1739,41 @@ uno::Any SAL_CALL SvxUnoTextBase::queryAggregation( const uno::Type & rType ) // XTypeProvider -uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getStaticTypes() throw() +namespace { - if( maTypeSequence.getLength() == 0 ) + struct theSvxUnoTextBaseTypes : + public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextBaseTypes> { - maTypeSequence.realloc( 15 ); // !DANGER! keep this updated - uno::Type* pTypes = maTypeSequence.getArray(); - - *pTypes++ = ::getCppuType(( const uno::Reference< text::XText >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeMover >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextAppend >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCopy >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XParagraphAppend >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextPortionAppend >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); - } - return maTypeSequence; + uno::Sequence<uno::Type> operator () () + { + uno::Sequence< uno::Type > aTypeSequence; + + aTypeSequence.realloc( 15 ); // !DANGER! keep this updated + uno::Type* pTypes = aTypeSequence.getArray(); + + *pTypes++ = ::getCppuType(( const uno::Reference< text::XText >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeMover >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextAppend >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCopy >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XParagraphAppend >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextPortionAppend >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); + + return aTypeSequence; + } + }; +} +uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getStaticTypes() throw() +{ + return theSvxUnoTextBaseTypes::get(); } uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getTypes() @@ -1891,11 +1843,12 @@ void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRan SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange ); if(pRange) { - // setString am SvxUnoTextRangeBase statt selber QuickInsertText und UpdateData, - // damit die Selektion am SvxUnoTextRangeBase angepasst wird. - //! Eigentlich muessten alle Cursor-Objekte dieses Textes angepasst werden! + // setString on SvxUnoTextRangeBase instead of itself QuickInsertText + // and UpdateData, so that the selection will be adjusted to + // SvxUnoTextRangeBase. Actually all cursor objects of this Text must + // to be statement to be adapted! - if (!bAbsorb) // nicht ersetzen -> hinten anhaengen + if (!bAbsorb) // do not replace -> append on tail pRange->CollapseToEnd(); pRange->setString( aString ); @@ -1921,7 +1874,7 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text { case text::ControlCharacter::PARAGRAPH_BREAK: { - const String aText( (sal_Unicode)13 ); // '\r' geht auf'm Mac nicht + const String aText( (sal_Unicode)13 ); // '\r' does not work on Mac insertString( xRange, aText, bAbsorb ); return; @@ -2122,7 +2075,7 @@ void SvxPropertyValuesToItemSet( const uno::Sequence< beans::PropertyValue > rPropertyVaules, const SfxItemPropertySet *pPropSet, SvxTextForwarder *pForwarder /*needed for WID_NUMLEVEL*/, - USHORT nPara /*needed for WID_NUMLEVEL*/) + sal_uInt16 nPara /*needed for WID_NUMLEVEL*/) throw(lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) { sal_Int32 nProps = rPropertyVaules.getLength(); @@ -2201,7 +2154,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendParagraph( SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0; if (pTextForwarder) { - USHORT nParaCount = pTextForwarder->GetParagraphCount(); + sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount(); DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" ); pTextForwarder->AppendParagraph(); @@ -2232,12 +2185,12 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph( SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0; if (pTextForwarder) { - USHORT nParaCount = pTextForwarder->GetParagraphCount(); + sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount(); DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" ); pTextForwarder->AppendParagraph(); // set properties for the previously last paragraph - USHORT nPara = nParaCount - 1; + sal_uInt16 nPara = nParaCount - 1; ESelection aSel( nPara, 0, nPara, 0 ); SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() ); SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps, @@ -2264,9 +2217,9 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion( uno::Reference< text::XTextRange > xRet; if (pTextForwarder) { - USHORT nParaCount = pTextForwarder->GetParagraphCount(); + sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount(); DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" ); - USHORT nPara = nParaCount - 1; + sal_uInt16 nPara = nParaCount - 1; SfxItemSet aSet( pTextForwarder->GetParaAttribs( nPara ) ); xub_StrLen nStart = pTextForwarder->AppendTextPortion( nPara, rText, aSet ); pEditSource->UpdateData(); @@ -2290,9 +2243,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion( } return xRet; } -/*-- 25.03.2008 08:16:09--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvxUnoTextBase::copyText( const uno::Reference< text::XTextCopy >& xSource ) throw ( uno::RuntimeException ) { @@ -2530,9 +2481,9 @@ String SvxDummyTextSource::GetText( const ESelection& ) const return String(); } -SfxItemSet SvxDummyTextSource::GetAttribs( const ESelection&, BOOL ) const +SfxItemSet SvxDummyTextSource::GetAttribs( const ESelection&, sal_Bool ) const { - // AW: Very dangerous: The former implementation used a SfxItemPool created on the + // Very dangerous: The former implementation used a SfxItemPool created on the // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using // a deleted Pool by design. return SfxItemSet(EditEngine::GetGlobalItemPool()); @@ -2591,7 +2542,7 @@ XubString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_uInt16, s return XubString(); } -void SvxDummyTextSource::FieldClicked( const SvxFieldItem&, USHORT, xub_StrLen ) +void SvxDummyTextSource::FieldClicked( const SvxFieldItem&, sal_uInt16, xub_StrLen ) { } @@ -2604,32 +2555,32 @@ void SvxDummyTextSource::SetNotifyHdl( const Link& ) { } -LanguageType SvxDummyTextSource::GetLanguage( USHORT, USHORT ) const +LanguageType SvxDummyTextSource::GetLanguage( sal_uInt16, sal_uInt16 ) const { return LANGUAGE_DONTKNOW; } -USHORT SvxDummyTextSource::GetFieldCount( USHORT ) const +sal_uInt16 SvxDummyTextSource::GetFieldCount( sal_uInt16 ) const { return 0; } -EFieldInfo SvxDummyTextSource::GetFieldInfo( USHORT, USHORT ) const +EFieldInfo SvxDummyTextSource::GetFieldInfo( sal_uInt16, sal_uInt16 ) const { return EFieldInfo(); } -EBulletInfo SvxDummyTextSource::GetBulletInfo( USHORT ) const +EBulletInfo SvxDummyTextSource::GetBulletInfo( sal_uInt16 ) const { return EBulletInfo(); } -Rectangle SvxDummyTextSource::GetCharBounds( USHORT, USHORT ) const +Rectangle SvxDummyTextSource::GetCharBounds( sal_uInt16, sal_uInt16 ) const { return Rectangle(); } -Rectangle SvxDummyTextSource::GetParaBounds( USHORT ) const +Rectangle SvxDummyTextSource::GetParaBounds( sal_uInt16 ) const { return Rectangle(); } @@ -2644,52 +2595,52 @@ OutputDevice* SvxDummyTextSource::GetRefDevice() const return NULL; } -sal_Bool SvxDummyTextSource::GetIndexAtPoint( const Point&, USHORT&, USHORT& ) const +sal_Bool SvxDummyTextSource::GetIndexAtPoint( const Point&, sal_uInt16&, sal_uInt16& ) const { return sal_False; } -sal_Bool SvxDummyTextSource::GetWordIndices( USHORT, USHORT, USHORT&, USHORT& ) const +sal_Bool SvxDummyTextSource::GetWordIndices( sal_uInt16, sal_uInt16, sal_uInt16&, sal_uInt16& ) const { return sal_False; } -sal_Bool SvxDummyTextSource::GetAttributeRun( USHORT&, USHORT&, USHORT, USHORT ) const +sal_Bool SvxDummyTextSource::GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16 ) const { return sal_False; } -USHORT SvxDummyTextSource::GetLineCount( USHORT ) const +sal_uInt16 SvxDummyTextSource::GetLineCount( sal_uInt16 ) const { return 0; } -USHORT SvxDummyTextSource::GetLineLen( USHORT, USHORT ) const +sal_uInt16 SvxDummyTextSource::GetLineLen( sal_uInt16, sal_uInt16 ) const { return 0; } -void SvxDummyTextSource::GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT /*nParagraph*/, USHORT /*nLine*/ ) const +void SvxDummyTextSource::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 /*nParagraph*/, sal_uInt16 /*nLine*/ ) const { rStart = rEnd = 0; } -USHORT SvxDummyTextSource::GetLineNumberAtIndex( USHORT /*nPara*/, USHORT /*nIndex*/ ) const +sal_uInt16 SvxDummyTextSource::GetLineNumberAtIndex( sal_uInt16 /*nPara*/, sal_uInt16 /*nIndex*/ ) const { return 0; } -sal_Bool SvxDummyTextSource::QuickFormatDoc( BOOL ) +sal_Bool SvxDummyTextSource::QuickFormatDoc( sal_Bool ) { return sal_False; } -sal_Int16 SvxDummyTextSource::GetDepth( USHORT ) const +sal_Int16 SvxDummyTextSource::GetDepth( sal_uInt16 ) const { return -1; } -sal_Bool SvxDummyTextSource::SetDepth( USHORT, sal_Int16 nNewDepth ) +sal_Bool SvxDummyTextSource::SetDepth( sal_uInt16, sal_Int16 nNewDepth ) { return nNewDepth == 0 ? sal_True : sal_False; } @@ -2713,7 +2664,7 @@ void SvxDummyTextSource::AppendParagraph() { } -xub_StrLen SvxDummyTextSource::AppendTextPortion( USHORT, const String &, const SfxItemSet & ) +xub_StrLen SvxDummyTextSource::AppendTextPortion( sal_uInt16, const String &, const SfxItemSet & ) { return 0; } diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index ced114204b..f715c8eac1 100644 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -31,11 +31,12 @@ #include <vcl/svapp.hxx> #include <osl/mutex.hxx> -#define _SVSTDARR_USHORTS +#define _SVSTDARR_sal_uIt16S #include <svl/svstdarr.hxx> #include <rtl/uuid.h> #include <rtl/memory.h> +#include <rtl/instance.hxx> #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> @@ -93,7 +94,7 @@ uno::Any SvxUnoTextContentEnumeration::nextElement(void) throw( container::NoSuc const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() ); SvxUnoTextRangeBaseList::const_iterator aIter; - for( aIter = rRanges.begin(); (aIter != rRanges.end()) && (pContent == 0); aIter++ ) + for( aIter = rRanges.begin(); (aIter != rRanges.end()) && (pContent == 0); ++aIter ) { SvxUnoTextContent* pIterContent = dynamic_cast< SvxUnoTextContent* >( (*aIter ) ); if( pIterContent && (pIterContent->mnParagraph == mnNextParagraph) ) @@ -113,7 +114,6 @@ uno::Any SvxUnoTextContentEnumeration::nextElement(void) throw( container::NoSuc // class SvxUnoTextContent // ==================================================================== uno::Reference< text::XText > xDummyText; -uno::Sequence< uno::Type > SvxUnoTextContent::maTypeSequence; static SvxUnoText* getDummyText() throw() { @@ -200,27 +200,39 @@ void SAL_CALL SvxUnoTextContent::release() throw( ) // XTypeProvider +namespace +{ + struct theSvxUnoTextContentTypes : + public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextContentTypes> + { + uno::Sequence<uno::Type> operator () () + { + uno::Sequence< uno::Type > aTypeSequence; + + aTypeSequence.realloc( 11 ); // !DANGER! keep this updated + uno::Type* pTypes = aTypeSequence.getArray(); + + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextContent >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); + + return aTypeSequence; + } + }; +} + uno::Sequence< uno::Type > SAL_CALL SvxUnoTextContent::getTypes() throw (uno::RuntimeException) { - if( maTypeSequence.getLength() == 0 ) - { - maTypeSequence.realloc( 11 ); // !DANGER! keep this updated - uno::Type* pTypes = maTypeSequence.getArray(); - - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextContent >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); - } - return maTypeSequence; + return theSvxUnoTextContentTypes::get(); } uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextContent::getImplementationId() @@ -463,7 +475,7 @@ uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement() SvxUnoTextRange* pRange = 0; SvxUnoTextRangeBaseList::const_iterator aIter; - for( aIter = rRanges.begin(); (aIter != rRanges.end()) && (pRange == 0); aIter++ ) + for( aIter = rRanges.begin(); (aIter != rRanges.end()) && (pRange == 0); ++aIter ) { SvxUnoTextRange* pIterRange = dynamic_cast< SvxUnoTextRange* >( (*aIter ) ); if( pIterRange && pIterRange->mbPortion && (aSel.IsEqual( pIterRange->maSelection ) ) ) @@ -487,8 +499,6 @@ uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement() // class SvxUnoTextCursor // ==================================================================== -uno::Sequence< uno::Type > SvxUnoTextCursor::maTypeSequence; - uno::Reference< uno::XInterface > SvxUnoTextCursor_NewInstance() { SvxUnoText aText; @@ -516,7 +526,8 @@ SvxUnoTextCursor::~SvxUnoTextCursor() throw() { } -// automatisch auskommentiert - [getIdlClass(es) or queryInterface] - Bitte XTypeProvider benutzen! +// Comment out automatically - [getIdlClass(es) or queryInterface] +// Please use the XTypeProvider! //sal_Bool SvxUnoTextCursor::queryInterface( uno::Uik aUIK, Reference< uno::XInterface > & xRef) uno::Any SAL_CALL SvxUnoTextCursor::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException) @@ -552,27 +563,39 @@ void SAL_CALL SvxUnoTextCursor::release() throw ( ) OWeakAggObject::release(); } +namespace +{ + struct theSvxUnoTextCursorTypes : + public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextCursorTypes> + { + uno::Sequence<uno::Type> operator () () + { + uno::Sequence< uno::Type > aTypeSequence; + + aTypeSequence.realloc( 10 ); // !DANGER! keep this updated + uno::Type* pTypes = aTypeSequence.getArray(); + + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCursor >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); + *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); + + return aTypeSequence; + } + }; +} + // XTypeProvider uno::Sequence< uno::Type > SAL_CALL SvxUnoTextCursor::getTypes() throw(uno::RuntimeException) { - if( maTypeSequence.getLength() == 0 ) - { - maTypeSequence.realloc( 10 ); // !DANGER! keep this updated - uno::Type* pTypes = maTypeSequence.getArray(); - - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCursor >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0); - *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0); - } - return maTypeSequence; + return theSvxUnoTextCursorTypes::get(); } uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextCursor::getImplementationId() diff --git a/editeng/source/uno/unoviwed.cxx b/editeng/source/uno/unoviwed.cxx index 2ea5fddd09..161f9bc070 100644 --- a/editeng/source/uno/unoviwed.cxx +++ b/editeng/source/uno/unoviwed.cxx @@ -44,7 +44,7 @@ SvxEditEngineViewForwarder::~SvxEditEngineViewForwarder() { } -BOOL SvxEditEngineViewForwarder::IsValid() const +sal_Bool SvxEditEngineViewForwarder::IsValid() const { return sal_True; } diff --git a/editeng/source/uno/unoviwou.cxx b/editeng/source/uno/unoviwou.cxx index 6c4c024de3..0f5e2305a6 100644 --- a/editeng/source/uno/unoviwou.cxx +++ b/editeng/source/uno/unoviwou.cxx @@ -51,13 +51,13 @@ SvxDrawOutlinerViewForwarder::~SvxDrawOutlinerViewForwarder() Point SvxDrawOutlinerViewForwarder::GetTextOffset() const { - // #101029# calc text offset from shape anchor + // calc text offset from shape anchor Rectangle aOutputRect( mrOutlinerView.GetOutputArea() ); return aOutputRect.TopLeft() - maTextShapeTopLeft; } -BOOL SvxDrawOutlinerViewForwarder::IsValid() const +sal_Bool SvxDrawOutlinerViewForwarder::IsValid() const { return sal_True; } @@ -70,7 +70,6 @@ Rectangle SvxDrawOutlinerViewForwarder::GetVisArea() const { Rectangle aVisArea = mrOutlinerView.GetVisArea(); - // #101029# Point aTextOffset( GetTextOffset() ); aVisArea.Move( aTextOffset.X(), aTextOffset.Y() ); @@ -100,7 +99,6 @@ Point SvxDrawOutlinerViewForwarder::LogicToPixel( const Point& rPoint, const Map Point aPoint1( rPoint ); Point aTextOffset( GetTextOffset() ); - // #101029# aPoint1.X() += aTextOffset.X(); aPoint1.Y() += aTextOffset.Y(); @@ -126,7 +124,6 @@ Point SvxDrawOutlinerViewForwarder::PixelToLogic( const Point& rPoint, const Map Point aPoint2( OutputDevice::LogicToLogic( aPoint1, aMapMode.GetMapUnit(), rMapMode ) ); - // #101029# Point aTextOffset( GetTextOffset() ); aPoint2.X() -= aTextOffset.X(); diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx index 5062aa730f..4a428c98a6 100644 --- a/editeng/source/xml/xmltxtexp.cxx +++ b/editeng/source/xml/xmltxtexp.cxx @@ -358,7 +358,6 @@ void SAL_CALL SvxSimpleUnoModel::removeEventListener( const ::com::sun::star::un class SvxXMLTextExportComponent : public SvXMLExport { public: - // #110680# SvxXMLTextExportComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, EditEngine* pEditEngine, @@ -381,7 +380,6 @@ private: /////////////////////////////////////////////////////////////////////// -// #110680# SvxXMLTextExportComponent::SvxXMLTextExportComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, EditEngine* pEditEngine, @@ -430,7 +428,7 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& if( !xServiceFactory.is() ) { - DBG_ERROR( "got no service manager" ); + OSL_FAIL( "got no service manager" ); break; } @@ -440,7 +438,7 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& if( !xWriter.is() ) { - DBG_ERROR( "com.sun.star.xml.sax.Writer service missing" ); + OSL_FAIL( "com.sun.star.xml.sax.Writer service missing" ); break; } @@ -451,7 +449,7 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& /* testcode const OUString aURL( RTL_CONSTASCII_USTRINGPARAM( "file:///e:/test.xml" ) ); - SfxMedium aMedium( aURL, STREAM_WRITE | STREAM_TRUNC, TRUE ); + SfxMedium aMedium( aURL, STREAM_WRITE | STREAM_TRUNC, sal_True ); aMedium.IsRemote(); uno::Reference<io::XOutputStream> xOut( new utl::OOutputStreamWrapper( *aMedium.GetOutStream() ) ); */ @@ -463,7 +461,6 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& // export text const OUString aName; - // #110680# // SvxXMLTextExportComponent aExporter( &rEditEngine, rSel, aName, xHandler ); SvxXMLTextExportComponent aExporter( xServiceFactory, &rEditEngine, rSel, aName, xHandler ); @@ -478,7 +475,7 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& } catch( uno::Exception& ) { - DBG_ERROR("exception during xml export"); + OSL_FAIL("exception during xml export"); } } diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx index 78f26b7907..dbc293c64f 100644 --- a/editeng/source/xml/xmltxtimp.cxx +++ b/editeng/source/xml/xmltxtimp.cxx @@ -68,10 +68,10 @@ using namespace xmloff::token; class SvxXMLTextImportContext : public SvXMLImportContext { public: - SvxXMLTextImportContext( SvXMLImport& rImport, USHORT nPrfx, const OUString& rLName, const uno::Reference< XAttributeList >& xAttrList, const uno::Reference< XText >& xText ); + SvxXMLTextImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< XAttributeList >& xAttrList, const uno::Reference< XText >& xText ); virtual ~SvxXMLTextImportContext(); - virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList ); + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList ); // SvxXMLXTableImport& getImport() const { return *(SvxXMLXTableImport*)&GetImport(); } @@ -81,7 +81,7 @@ private: /////////////////////////////////////////////////////////////////////// -SvxXMLTextImportContext::SvxXMLTextImportContext( SvXMLImport& rImport, USHORT nPrfx, const OUString& rLName, const uno::Reference< XAttributeList >&, const uno::Reference< XText >& xText ) +SvxXMLTextImportContext::SvxXMLTextImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< XAttributeList >&, const uno::Reference< XText >& xText ) : SvXMLImportContext( rImport, nPrfx, rLName ), mxText( xText ) { } @@ -90,7 +90,7 @@ SvxXMLTextImportContext::~SvxXMLTextImportContext() { } -SvXMLImportContext *SvxXMLTextImportContext::CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList ) +SvXMLImportContext *SvxXMLTextImportContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList ) { SvXMLImportContext* pContext = NULL; if(XML_NAMESPACE_OFFICE == nPrefix && IsXMLToken( rLocalName, XML_BODY ) ) @@ -119,7 +119,6 @@ SvXMLImportContext *SvxXMLTextImportContext::CreateChildContext( USHORT nPrefix, class SvxXMLXTextImportComponent : public SvXMLImport { public: - // #110680# SvxXMLXTextImportComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, const uno::Reference< XText > & xText ); @@ -128,7 +127,7 @@ public: static sal_Bool load( const rtl::OUString& rUrl, const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xTable ) throw(); protected: - virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList ); + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList ); private: const uno::Reference< XText > mxText; @@ -136,7 +135,6 @@ private: // -------------------------------------------------------------------- -// #110680# SvxXMLXTextImportComponent::SvxXMLXTextImportComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, const uno::Reference< XText > & xText ) @@ -176,14 +174,14 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r uno::Reference<lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); if( !xServiceFactory.is() ) { - DBG_ERROR( "SvxXMLXTableImport::load: got no service manager" ); + OSL_FAIL( "SvxXMLXTableImport::load: got no service manager" ); break; } uno::Reference< xml::sax::XParser > xParser( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ) ) ), uno::UNO_QUERY ); if( !xParser.is() ) { - DBG_ERROR( "com.sun.star.xml.sax.Parser service missing" ); + OSL_FAIL( "com.sun.star.xml.sax.Parser service missing" ); break; } @@ -191,7 +189,7 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r /* testcode const OUString aURL( RTL_CONSTASCII_USTRINGPARAM( "file:///e:/test.xml" ) ); - SfxMedium aMedium( aURL, STREAM_READ | STREAM_NOCREATE, TRUE ); + SfxMedium aMedium( aURL, STREAM_READ | STREAM_NOCREATE, sal_True ); aMedium.IsRemote(); uno::Reference<io::XOutputStream> xOut( new utl::OOutputStreamWrapper( *aMedium.GetOutStream() ) ); @@ -200,14 +198,14 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r if( !xSource.is() ) { - DBG_ERROR( "got no data source from medium" ); + OSL_FAIL( "got no data source from medium" ); break; } uno::Reference< XInterface > xPipe( xServiceFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.Pipe") ) ) ); if( !xPipe.is() ) { - DBG_ERROR( "XMLReader::Read: com.sun.star.io.Pipe service missing" ); + OSL_FAIL( "XMLReader::Read: com.sun.star.io.Pipe service missing" ); break; } @@ -227,7 +225,6 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r */ - // #110680# // uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTextImportComponent( xText ) ); uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTextImportComponent( xServiceFactory, xText ) ); @@ -245,7 +242,7 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r } } -SvXMLImportContext *SvxXMLXTextImportComponent::CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList ) +SvXMLImportContext *SvxXMLXTextImportComponent::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList ) { SvXMLImportContext* pContext; if(XML_NAMESPACE_OFFICE == nPrefix && ( IsXMLToken( rLocalName, XML_DOCUMENT ) || IsXMLToken( rLocalName, XML_DOCUMENT_CONTENT ) ) ) diff --git a/editeng/util/editeng.dxp b/editeng/util/editeng.dxp index 9630d7e067..f0e1c69934 100644..100755 --- a/editeng/util/editeng.dxp +++ b/editeng/util/editeng.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/editeng/util/hidother.src b/editeng/util/hidother.src index 6f3b2285f8..0203afa929 100644 --- a/editeng/util/hidother.src +++ b/editeng/util/hidother.src @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hidother.src,v $ - * $Revision: 1.45 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/editeng/util/makefile.mk b/editeng/util/makefile.mk index e27dac147c..80c8939b1b 100644 --- a/editeng/util/makefile.mk +++ b/editeng/util/makefile.mk @@ -6,10 +6,6 @@ # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.61 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify |