diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:24:29 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:24:29 +0200 |
commit | 92667c8edbaee9a252b1d5d221eb62849f76697c (patch) | |
tree | 8f1d329f2259b7d5bff054bc14d0965637df6961 /editeng | |
parent | baecdfb578cb7bc992944857ad4d8882ef7e842c (diff) | |
parent | 48b4a99ce2451f1ddf2e8e128bbfcd6683072999 (diff) |
Merge branch 'master' into feature/gnumake4
Conflicts:
connectivity/source/cpool/Zregistration.cxx
connectivity/source/drivers/evoab/LCatalog.cxx
connectivity/source/drivers/evoab/LColumnAlias.cxx
connectivity/source/drivers/evoab/LColumnAlias.hxx
connectivity/source/drivers/evoab/LColumns.cxx
connectivity/source/drivers/evoab/LColumns.hxx
connectivity/source/drivers/evoab/LConfigAccess.cxx
connectivity/source/drivers/evoab/LConfigAccess.hxx
connectivity/source/drivers/evoab/LConnection.cxx
connectivity/source/drivers/evoab/LConnection.hxx
connectivity/source/drivers/evoab/LDatabaseMetaData.cxx
connectivity/source/drivers/evoab/LDatabaseMetaData.hxx
connectivity/source/drivers/evoab/LDriver.cxx
connectivity/source/drivers/evoab/LDriver.hxx
connectivity/source/drivers/evoab/LFolderList.cxx
connectivity/source/drivers/evoab/LFolderList.hxx
connectivity/source/drivers/evoab/LNoException.cxx
connectivity/source/drivers/evoab/LPreparedStatement.cxx
connectivity/source/drivers/evoab/LPreparedStatement.hxx
connectivity/source/drivers/evoab/LResultSet.cxx
connectivity/source/drivers/evoab/LResultSet.hxx
connectivity/source/drivers/evoab/LServices.cxx
connectivity/source/drivers/evoab/LStatement.cxx
connectivity/source/drivers/evoab/LStatement.hxx
connectivity/source/drivers/evoab/LTable.cxx
connectivity/source/drivers/evoab/LTable.hxx
connectivity/source/drivers/evoab/LTables.cxx
connectivity/source/drivers/evoab/LTables.hxx
connectivity/source/drivers/evoab/evoab.xml
connectivity/source/drivers/evoab/makefile.mk
editeng/Library_editeng.mk
framework/Library_fwe.mk
framework/test/test.cxx
idl/prj/d.lst
idl/util/idlpch.cxx
linguistic/Makefile
linguistic/Module_linguistic.mk
linguistic/inc/linguistic/lngdllapi.h
linguistic/inc/linguistic/lngprophelp.hxx
linguistic/inc/linguistic/misc.hxx
linguistic/prj/build.lst
linguistic/prj/d.lst
linguistic/qa/unoapi/Test.java
linguistic/source/grammarchecker.cxx
linguistic/source/grammarchecker.hxx
linguistic/source/hyphdta.cxx
linguistic/source/lngprophelp.cxx
linguistic/source/makefile.mk
linguistic/source/spelldta.cxx
sfx2/Library_qstart.mk
sfx2/Library_sfx.mk
sfx2/inc/sfx2/qswin32.h
sfx2/prj/build.lst
sfx2/qa/cppunit/makefile.mk
xmlscript/inc/xmlscript/xcrdllapi.h
xmlscript/prj/d.lst
xmlscript/util/makefile.mk
Diffstat (limited to 'editeng')
255 files changed, 7814 insertions, 7766 deletions
diff --git a/editeng/AllLangResTarget_editeng.mk b/editeng/AllLangResTarget_editeng.mk index e2bd16e4885c..bcc2c63220d7 100755 --- a/editeng/AllLangResTarget_editeng.mk +++ b/editeng/AllLangResTarget_editeng.mk @@ -34,7 +34,7 @@ $(eval $(call gb_SrsTarget_SrsTarget,editeng/res)) $(eval $(call gb_SrsTarget_set_include,editeng/res,\ $$(INCLUDE) \ - -I$(SRCDIR)/editeng/inc \ + -I$(realpath $(SRCDIR)/editeng/inc) \ )) # add src files here (complete path relative to repository root) diff --git a/editeng/CppunitTest_editeng_borderline.mk b/editeng/CppunitTest_editeng_borderline.mk new file mode 100755 index 000000000000..6a8e8472766b --- /dev/null +++ b/editeng/CppunitTest_editeng_borderline.mk @@ -0,0 +1,64 @@ +#************************************************************************* +# +# 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_CppunitTest_CppunitTest,editeng_borderline)) + +$(eval $(call gb_CppunitTest_add_exception_objects,editeng_borderline, \ + editeng/qa/items/borderline_test \ +)) + +$(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) \ +)) + +$(eval $(call gb_CppunitTest_set_include,editeng_borderline,\ + $$(INCLUDE) \ + -I$(OUTDIR)/inc/offuh \ + -I$(OUTDIR)/inc \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk index 45683df80d78..f5444d378ec6 100755 --- a/editeng/Library_editeng.mk +++ b/editeng/Library_editeng.mk @@ -33,8 +33,8 @@ $(eval $(call gb_Library_add_precompiled_header,editeng,$(SRCDIR)/editeng/inc/pc $(eval $(call gb_Library_set_include,editeng,\ $$(INCLUDE) \ - -I$(SRCDIR)/editeng/inc/pch \ - -I$(SRCDIR)/editeng/inc \ + -I$(realpath $(SRCDIR)/editeng/inc/pch) \ + -I$(realpath $(SRCDIR)/editeng/inc) \ -I$(OUTDIR)/inc/offuh \ )) @@ -80,11 +80,13 @@ $(eval $(call gb_Library_add_exception_objects,editeng,\ 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 \ @@ -145,7 +147,6 @@ $(eval $(call gb_Library_add_linked_libs,editeng,\ tk \ vcl \ svl \ - stl \ sot \ utl \ tl \ @@ -153,8 +154,8 @@ $(eval $(call gb_Library_add_linked_libs,editeng,\ ucbhelper \ cppuhelper \ cppu \ - vos3 \ sal \ + salhelper \ i18nisolang1 \ i18npaper \ $(gb_STDLIBS) \ diff --git a/editeng/Module_editeng.mk b/editeng/Module_editeng.mk index 4a5dbcf30695..e84a1587e3f4 100755 --- a/editeng/Module_editeng.mk +++ b/editeng/Module_editeng.mk @@ -36,6 +36,7 @@ $(eval $(call gb_Module_add_targets,editeng,\ # add any runtime tests (unit tests) here # remove if no tests $(eval $(call gb_Module_add_check_targets,editeng,\ + CppunitTest_editeng_borderline \ )) # add any subsequent checks (e.g. complex tests) here diff --git a/editeng/Package_inc.mk b/editeng/Package_inc.mk index d0c984a78a90..52fa0e854a10 100755 --- a/editeng/Package_inc.mk +++ b/editeng/Package_inc.mk @@ -83,6 +83,7 @@ $(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/hangulhanja.hxx,editen $(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)) diff --git a/editeng/inc/editeng.hrc b/editeng/inc/editeng.hrc index cc1f45c06da3..cc1f45c06da3 100644..100755 --- a/editeng/inc/editeng.hrc +++ b/editeng/inc/editeng.hrc diff --git a/editeng/inc/editeng/AccessibleComponentBase.hxx b/editeng/inc/editeng/AccessibleComponentBase.hxx index c3d299c9a17e..7189595a0065 100644 --- a/editeng/inc/editeng/AccessibleComponentBase.hxx +++ b/editeng/inc/editeng/AccessibleComponentBase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -145,3 +146,5 @@ public: } // end of namespace accessibility #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/AccessibleContextBase.hxx b/editeng/inc/editeng/AccessibleContextBase.hxx index 2897eff65c3e..b289463d0e75 100644 --- a/editeng/inc/editeng/AccessibleContextBase.hxx +++ b/editeng/inc/editeng/AccessibleContextBase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ #ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_CONTEXT_BASE_HXX #define _SVX_ACCESSIBILITY_ACCESSIBLE_CONTEXT_BASE_HXX -//#include <editeng/ChildrenManager.hxx> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> @@ -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, @@ -398,3 +398,5 @@ private: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/AccessibleEditableTextPara.hxx b/editeng/inc/editeng/AccessibleEditableTextPara.hxx index 4847bb60d281..1e2497f20306 100644 --- a/editeng/inc/editeng/AccessibleEditableTextPara.hxx +++ b/editeng/inc/editeng/AccessibleEditableTextPara.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,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, @@ -79,13 +80,12 @@ namespace accessibility public: /// Create accessible object for given parent - // --> OD 2006-01-11 #i27138# + // #i27138# // - add parameter <_pParaManager> (default value NULL) // This has to be the the instance of <AccessibleParaManager>, which // created and manages this accessible paragraph. AccessibleEditableTextPara ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent, const AccessibleParaManager* _pParaManager = NULL ); - // <-- virtual ~AccessibleEditableTextPara (); @@ -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 @@ -417,3 +417,4 @@ namespace accessibility #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/AccessibleImageBullet.hxx b/editeng/inc/editeng/AccessibleImageBullet.hxx index c21f7b67f6d5..aa470ea65ab3 100644 --- a/editeng/inc/editeng/AccessibleImageBullet.hxx +++ b/editeng/inc/editeng/AccessibleImageBullet.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,7 @@ #include <cppuhelper/weakref.hxx> #include <cppuhelper/implbase5.hxx> -#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ #include <cppuhelper/interfacecontainer.hxx> -#endif #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> @@ -235,3 +234,4 @@ namespace accessibility #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/AccessibleParaManager.hxx b/editeng/inc/editeng/AccessibleParaManager.hxx index d973bd8d1267..b2116034bb1b 100644 --- a/editeng/inc/editeng/AccessibleParaManager.hxx +++ b/editeng/inc/editeng/AccessibleParaManager.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -345,3 +346,4 @@ namespace accessibility #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/AccessibleSelectionBase.hxx b/editeng/inc/editeng/AccessibleSelectionBase.hxx index abe92355911b..d2ef88ef4533 100644 --- a/editeng/inc/editeng/AccessibleSelectionBase.hxx +++ b/editeng/inc/editeng/AccessibleSelectionBase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,3 +72,5 @@ namespace accessibility } #endif // _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/AccessibleStaticTextBase.hxx b/editeng/inc/editeng/AccessibleStaticTextBase.hxx index 6e4fc1cdccd5..5dbd8a729580 100644 --- a/editeng/inc/editeng/AccessibleStaticTextBase.hxx +++ b/editeng/inc/editeng/AccessibleStaticTextBase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,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 @@ -281,3 +279,5 @@ namespace accessibility } // end of namespace accessibility #endif /* _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_ */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/AccessibleStringWrap.hxx b/editeng/inc/editeng/AccessibleStringWrap.hxx index 1d858f1bdf10..5bafee122ea0 100644 --- a/editeng/inc/editeng/AccessibleStringWrap.hxx +++ b/editeng/inc/editeng/AccessibleStringWrap.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,3 +62,5 @@ private: }; #endif /* _ACCESSIBLESTRINGWRAP_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/SpellPortions.hxx b/editeng/inc/editeng/SpellPortions.hxx index e59d6ddd6af2..55a161c773c8 100644 --- a/editeng/inc/editeng/SpellPortions.hxx +++ b/editeng/inc/editeng/SpellPortions.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -93,3 +94,5 @@ struct SpellPortion typedef std::vector<SpellPortion> SpellPortions; }//namespace svx #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/UnoForbiddenCharsTable.hxx b/editeng/inc/editeng/UnoForbiddenCharsTable.hxx index 7f7c0cdd6253..fd63297ac953 100644 --- a/editeng/inc/editeng/UnoForbiddenCharsTable.hxx +++ b/editeng/inc/editeng/UnoForbiddenCharsTable.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,7 @@ #include <com/sun/star/i18n/XForbiddenCharacters.hpp> #include <com/sun/star/linguistic2/XSupportedLocales.hpp> -#include <vos/ref.hxx> +#include <rtl/ref.hxx> #include <cppuhelper/implbase2.hxx> #include "editeng/editengdllapi.h" @@ -45,10 +46,10 @@ protected: /** this virtual function is called if the forbidden characters are changed */ virtual void onChange(); - vos::ORef<SvxForbiddenCharactersTable> mxForbiddenChars; + rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenChars; public: - SvxUnoForbiddenCharsTable(vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars); + SvxUnoForbiddenCharsTable(rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars); ~SvxUnoForbiddenCharsTable(); // XForbiddenCharacters @@ -63,3 +64,5 @@ public: }; #endif // _SVX_UNOFORBIDDENCHARSTABLE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/acorrcfg.hxx b/editeng/inc/editeng/acorrcfg.hxx index 9427a0c8fcaf..e34e66f8c4c9 100644 --- a/editeng/inc/editeng/acorrcfg.hxx +++ b/editeng/inc/editeng/acorrcfg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,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 @@ -50,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; @@ -68,7 +65,7 @@ public: void SetModified() {ConfigItem::SetModified();} }; /*-------------------------------------------------------------------- - Beschreibung: Konfiguration fuer Auto Correction + Description: Configuration for Auto Correction --------------------------------------------------------------------*/ class EDITENG_DLLPUBLIC SvxAutoCorrCfg { @@ -80,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; @@ -103,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; } @@ -126,8 +123,10 @@ public: SvxAutoCorrCfg(); virtual ~SvxAutoCorrCfg(); - static SvxAutoCorrCfg* Get(); + static SvxAutoCorrCfg& Get(); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/adjitem.hxx b/editeng/inc/editeng/adjitem.hxx index 560772be0fa1..b643387aaf48 100644 --- a/editeng/inc/editeng/adjitem.hxx +++ b/editeng/inc/editeng/adjitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,8 +44,8 @@ namespace rtl // class SvxAdjustItem --------------------------------------------------- /* -[Beschreibung] -Dieses Item beschreibt die Zeilenausrichtung. +[Description] +This item describes the row orientation. */ #define ADJUST_LASTBLOCK_VERSION ((sal_uInt16)0x0001) @@ -55,7 +56,7 @@ class EDITENG_DLLPUBLIC SvxAdjustItem : public SfxEnumItemInterface sal_Bool bCenter : 1; sal_Bool bBlock : 1; - // nur aktiv, wenn bBlock + // only activ when bBlock sal_Bool bOneBlock : 1; sal_Bool bLastCenter : 1; sal_Bool bLastBlock : 1; @@ -67,11 +68,11 @@ public: SvxAdjustItem( const SvxAdjust eAdjst /*= SVX_ADJUST_LEFT*/, const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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, @@ -141,3 +142,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/akrnitem.hxx b/editeng/inc/editeng/akrnitem.hxx index 4c12759c6c8f..dd8856a18164 100644 --- a/editeng/inc/editeng/akrnitem.hxx +++ b/editeng/inc/editeng/akrnitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,8 +42,8 @@ namespace rtl // class SvxAutoKernItem ------------------------------------------------- /* - [Beschreibung] - Attribut fuer Pair-Kerning. + [Description] + Attribute for Pair-Kerning. */ class EDITENG_DLLPUBLIC SvxAutoKernItem : public SfxBoolItem @@ -53,7 +54,7 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; @@ -72,3 +73,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/blnkitem.hxx b/editeng/inc/editeng/blnkitem.hxx index c3df2d2ab9db..fa24b287cba4 100644 --- a/editeng/inc/editeng/blnkitem.hxx +++ b/editeng/inc/editeng/blnkitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,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 @@ -53,7 +54,7 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; @@ -70,3 +71,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/bolnitem.hxx b/editeng/inc/editeng/bolnitem.hxx index 14d05b105ccb..df843ea10f83 100644 --- a/editeng/inc/editeng/bolnitem.hxx +++ b/editeng/inc/editeng/bolnitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,11 +41,13 @@ /* -[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 { @@ -56,8 +59,8 @@ public: ~SvxLineItem(); SvxLineItem &operator=( const SvxLineItem& rLine ); - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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, @@ -67,17 +70,19 @@ public: virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; - virtual int ScaleMetrics( long nMult, long nDiv ); - virtual int HasMetrics() 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; }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/borderline.hxx b/editeng/inc/editeng/borderline.hxx index fdf08b693ee7..92f9960ef79b 100644 --- a/editeng/inc/editeng/borderline.hxx +++ b/editeng/inc/editeng/borderline.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,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): @@ -41,94 +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 - // ============================================================================ -class EDITENG_DLLPUBLIC SvxBorderLine -{ -protected: - Color aColor; - sal_uInt16 nOutWidth; - sal_uInt16 nInWidth; - sal_uInt16 nDistance; - -public: - SvxBorderLine( const Color *pCol = 0, sal_uInt16 nOut = 0, sal_uInt16 nIn = 0, sal_uInt16 nDist = 0 ); - SvxBorderLine( const SvxBorderLine& r ); - - SvxBorderLine& operator=( const SvxBorderLine& r ); - - const Color& GetColor() const { return aColor; } - sal_uInt16 GetOutWidth() const { return nOutWidth; } - sal_uInt16 GetInWidth() const { return nInWidth; } - sal_uInt16 GetDistance() const { return nDistance; } - - void SetColor( const Color &rColor ) { aColor = rColor; } - void SetOutWidth( sal_uInt16 nNew ) { nOutWidth = nNew; } - void SetInWidth( sal_uInt16 nNew ) { nInWidth = nNew; } - void SetDistance( sal_uInt16 nNew ) { nDistance = 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 (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 283ef326c9ba..46597705fc92 100644 --- a/editeng/inc/editeng/boxitem.hxx +++ b/editeng/inc/editeng/boxitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,16 +31,16 @@ #include <svl/poolitem.hxx> #include <editeng/borderline.hxx> #include <editeng/editengdllapi.h> -#include <com/sun/star/table/BorderLine.hpp> +#include <com/sun/star/table/BorderLine2.hpp> 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 ((sal_uInt16)0) @@ -51,10 +52,10 @@ Abstand nach innen. class EDITENG_DLLPUBLIC SvxBoxItem : public SfxPoolItem { - SvxBorderLine *pTop, - *pBottom, - *pLeft, - *pRight; + editeng::SvxBorderLine *pTop, + *pBottom, + *pLeft, + *pRight; sal_uInt16 nTopDist, nBottomDist, nLeftDist, @@ -68,10 +69,10 @@ public: ~SvxBoxItem(); SvxBoxItem &operator=( const SvxBoxItem& rBox ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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, @@ -83,18 +84,18 @@ public: virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; - virtual int ScaleMetrics( long nMult, long nDiv ); - virtual int HasMetrics() 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( sal_uInt16 nLine ) const; + const editeng::SvxBorderLine* GetLine( sal_uInt16 nLine ) const; - //Die Pointer werden kopiert! - void SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine ); + //The Pointers are being copied! + void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine ); sal_uInt16 GetDistance( sal_uInt16 nLine ) const; sal_uInt16 GetDistance() const; @@ -102,12 +103,12 @@ public: 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 = sal_True -> Distance auch returnen, wenn - // keine Line gesetzt ist + // 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::BorderLine SvxLineToLine( const SvxBorderLine* pLine, sal_Bool bConvert ); - static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert); + 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); }; inline void SvxBoxItem::SetDistance( sal_uInt16 nNew ) @@ -117,13 +118,12 @@ inline void SvxBoxItem::SetDistance( sal_uInt16 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 ((sal_uInt16)0) @@ -140,36 +140,36 @@ 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. */ - sal_Bool bDist :1; // sal_True, Abstand freischalten. - sal_Bool bMinDist :1; // sal_True, Abstand darf nicht unterschritten werden. + sal_Bool bDist :1; // TRUE, Unlock Distance. + sal_Bool bMinDist :1; // TRUE, Going below minimum Distance is prohibited sal_uInt8 nValidFlags; // 0000 0000 - // VALID_TOP - // VALID_BOTTOM - // VALID_LEFT - // VALID_RIGHT - // VALID_HORI - // VALID_VERT - // VALID_DIST - // VALID_DISABLE + // ³³³³ ³³³ÀÄ VALID_TOP + // ³³³³ ³³ÀÄÄ VALID_BOTTOM + // ³³³³ ³ÀÄÄÄ VALID_LEFT + // ³³³³ ÀÄÄÄÄ VALID_RIGHT + // ³³³ÀÄÄÄÄÄÄ VALID_HORI + // ³³ÀÄÄÄÄÄÄÄ VALID_VERT + // ³ÀÄÄÄÄÄÄÄÄ VALID_DIST + // ÀÄÄÄÄÄÄÄÄÄ VALID_DISABLE - sal_uInt16 nDefDist; // Der Default- bzw. Minimalabstand. + sal_uInt16 nDefDist; // The default or minimum distance. public: TYPEINFO(); @@ -179,26 +179,26 @@ public: ~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 sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; - virtual int ScaleMetrics( long nMult, long nDiv ); - virtual int HasMetrics() 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, sal_uInt16 nLine ); + //The Pointers are being copied! + void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine ); sal_Bool IsTable() const { return mbEnableHor && mbEnableVer; } void SetTable( sal_Bool bNew ) { mbEnableHor = mbEnableVer = bNew; } @@ -224,3 +224,4 @@ public: }; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/brkitem.hxx b/editeng/inc/editeng/brkitem.hxx index 8e039697617b..0111185ad671 100644 --- a/editeng/inc/editeng/brkitem.hxx +++ b/editeng/inc/editeng/brkitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,10 +41,10 @@ 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 ((sal_uInt16)0x0001) @@ -57,10 +58,10 @@ public: 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 sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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,7 +75,7 @@ public: virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const; virtual sal_uInt16 GetValueCount() const; - // MS VC4.0 kommt durcheinander + // MS VC4.0 messes things up void SetValue( sal_uInt16 nNewVal ) {SfxEnumItem::SetValue(nNewVal); } SvxBreak GetBreak() const { return SvxBreak( GetValue() ); } @@ -101,3 +102,4 @@ inline SvxFmtBreakItem& SvxFmtBreakItem::operator=( #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/brshitem.hxx b/editeng/inc/editeng/brshitem.hxx index 7802ba3e41a7..32726d8de515 100644 --- a/editeng/inc/editeng/brshitem.hxx +++ b/editeng/inc/editeng/brshitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -99,8 +100,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; virtual int operator==( const SfxPoolItem& ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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&, sal_uInt16 nVersion ) const; @@ -138,3 +139,4 @@ public: #endif // #ifndef _SVX_BRSHITEM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/bulitem.hxx b/editeng/inc/editeng/bulitem.hxx index 494cb074872f..2a7eefb09a43 100644 --- a/editeng/inc/editeng/bulitem.hxx +++ b/editeng/inc/editeng/bulitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,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 @@ -80,8 +81,9 @@ class EDITENG_DLLPUBLIC SvxBulletItem : public SfxPoolItem long nWidth; sal_uInt16 nScale; sal_Unicode cSymbol; - sal_uInt8 nJustify; - sal_uInt16 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(); @@ -158,3 +160,5 @@ public: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/charhiddenitem.hxx b/editeng/inc/editeng/charhiddenitem.hxx index 352b14b4e953..bf4fbc1bd288 100644 --- a/editeng/inc/editeng/charhiddenitem.hxx +++ b/editeng/inc/editeng/charhiddenitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,8 +35,8 @@ #include "editeng/editengdllapi.h" // class SvxCharHiddenItem ------------------------------------------------- -/* - [Description] +/* [Description] + This item marks text as hidden */ @@ -59,3 +60,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/charreliefitem.hxx b/editeng/inc/editeng/charreliefitem.hxx index edacdf5d2e61..93813e89f3cc 100644 --- a/editeng/inc/editeng/charreliefitem.hxx +++ b/editeng/inc/editeng/charreliefitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,7 +40,6 @@ This item defines a character relief and has currently the values emboss, relief. - */ class EDITENG_DLLPUBLIC SvxCharReliefItem : public SfxEnumItem @@ -64,10 +64,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, - sal_uInt8 nMemberId ); - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, - sal_uInt8 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 ) { @@ -78,3 +76,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/charrotateitem.hxx b/editeng/inc/editeng/charrotateitem.hxx index 87d19d65b9e8..90fcb3cffb1c 100644 --- a/editeng/inc/editeng/charrotateitem.hxx +++ b/editeng/inc/editeng/charrotateitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -64,10 +65,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, - sal_uInt8 nMemberId ); - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, - sal_uInt8 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 ) { @@ -90,3 +89,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/charscaleitem.hxx b/editeng/inc/editeng/charscaleitem.hxx index d2b6d856ce47..0fe861583790 100644 --- a/editeng/inc/editeng/charscaleitem.hxx +++ b/editeng/inc/editeng/charscaleitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,10 +62,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, - sal_uInt8 nMemberId ); - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, - sal_uInt8 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 ) { @@ -76,3 +75,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/cmapitem.hxx b/editeng/inc/editeng/cmapitem.hxx index 154f0222247e..da4803e4433a 100644 --- a/editeng/inc/editeng/cmapitem.hxx +++ b/editeng/inc/editeng/cmapitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,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 @@ -54,7 +55,7 @@ public: SvxCaseMapItem( const SvxCaseMap eMap /*= SVX_CASEMAP_NOT_MAPPED*/, 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, @@ -81,9 +82,10 @@ public: { return (SvxCaseMap)GetValue(); } void SetCaseMap( SvxCaseMap eNew ) { SetValue( (sal_uInt16)eNew ); } - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/cntritem.hxx b/editeng/inc/editeng/cntritem.hxx index b367bd401316..1e701902ea96 100644 --- a/editeng/inc/editeng/cntritem.hxx +++ b/editeng/inc/editeng/cntritem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,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 @@ -47,7 +47,7 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; @@ -66,3 +66,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/colritem.hxx b/editeng/inc/editeng/colritem.hxx index e9e3f47ae9b4..b0d369ea1c31 100644 --- a/editeng/inc/editeng/colritem.hxx +++ b/editeng/inc/editeng/colritem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,9 +42,9 @@ namespace rtl // class SvxColorItem ---------------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt eine Farbe. + This item describes a color. */ #define VERSION_USEAUTOCOLOR 1 @@ -62,10 +63,10 @@ public: SvxColorItem( const SvxColorItem& rCopy ); ~SvxColorItem(); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, @@ -93,3 +94,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/crsditem.hxx b/editeng/inc/editeng/crsditem.hxx index 077de1582069..af13f41711d0 100644 --- a/editeng/inc/editeng/crsditem.hxx +++ b/editeng/inc/editeng/crsditem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,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 @@ -54,7 +54,7 @@ public: SvxCrossedOutItem( const FontStrikeout eSt /*= STRIKEOUT_NONE*/, const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, @@ -64,11 +64,11 @@ public: 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 sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + 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 + // MS VC4.0 messes things up void SetValue( sal_uInt16 nNewVal ) {SfxEnumItem::SetValue(nNewVal); } @@ -91,3 +91,4 @@ public: #endif // #ifndef _SVX_CRSDITEM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/cscoitem.hxx b/editeng/inc/editeng/cscoitem.hxx index f1897ef0986c..8c629d3365fd 100644 --- a/editeng/inc/editeng/cscoitem.hxx +++ b/editeng/inc/editeng/cscoitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,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 @@ -50,7 +51,7 @@ public: SvxCharSetColorItem( const Color& aColor, const rtl_TextEncoding eFrom, const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, @@ -73,3 +74,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/editdata.hxx b/editeng/inc/editeng/editdata.hxx index 993ee7b73c4a..4e0467f85de8 100644 --- a/editeng/inc/editeng/editdata.hxx +++ b/editeng/inc/editeng/editdata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,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) @@ -103,9 +104,9 @@ 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 { @@ -177,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 ) ) ) @@ -190,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 ) ) ) @@ -234,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 @@ -292,7 +293,7 @@ struct ParagraphInfos sal_uInt16 nFirstLineTextHeight; sal_uInt16 nFirstLineMaxAscent; - sal_Bool bValid; // Bei einer Abfrage waehrend der Formatierung ungueltig! + sal_Bool bValid; // A query during formatting is not valid! }; struct EECharAttrib @@ -386,3 +387,5 @@ struct EENotify }; #endif // _MyEDITDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx index d046b77d98b3..eccc1c4f0b6f 100755..100644 --- a/editeng/inc/editeng/editeng.hxx +++ b/editeng/inc/editeng/editeng.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,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 @@ -52,6 +53,7 @@ class Rectangle; class SvStream; class Link; class OutputDevice; +class Window; class SvUShorts; class SfxPoolItem; class SvxNumBulletItem; @@ -62,7 +64,7 @@ class SvxForbiddenCharactersTable; class SvxNumberFormat; class FontList; -#include <vos/ref.hxx> +#include <rtl/ref.hxx> #include <vector> #include <com/sun/star/uno/Reference.h> @@ -88,13 +90,11 @@ class IUndoManager; namespace basegfx { class B2DPolyPolygon; } #include <rsc/rscsfx.hxx> -#ifndef _EDITDATA_HXX #include <editeng/editdata.hxx> -#endif #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; @@ -124,10 +124,7 @@ private: EDITENG_DLLPRIVATE EditEngine( const EditEngine& ); EDITENG_DLLPRIVATE EditEngine& operator=( const EditEngine& ); - -//#if 0 // _SOLAR__PRIVATE - EDITENG_DLLPRIVATE sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView ); -//#endif + EDITENG_DLLPRIVATE sal_uInt8 PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, Window* pFrameWin = NULL ); protected: @@ -208,6 +205,7 @@ 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( sal_uInt16 nParagraph ) const; @@ -302,13 +300,13 @@ public: Point GetDocPos( const Point& rPaperPos ) const; 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, sal_Bool bClip ); void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 ); -// sal_uInt32: Fehlercode des Streams. +// 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 ); @@ -321,7 +319,7 @@ public: void SetImportHdl( const Link& rLink ); Link GetImportHdl() const; - // Flat-Mode: Keine Zeichenformatierung auswerten => Fuer Outliner + // Do not evaluate font formatting => For Outliner sal_Bool IsFlatMode() const; void SetFlatMode( sal_Bool bFlat ); @@ -376,8 +374,8 @@ public: void SetHyphenator( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator >& xHyph ); - void SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars ); - vos::ORef<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const; + void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ); + rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const; void SetDefaultLanguage( LanguageType eLang ); LanguageType GetDefaultLanguage() const; @@ -389,7 +387,7 @@ public: sal_uInt16 GetBigTextObjectStart() const; sal_Bool ShouldCreateBigTextObject() const; - // Zum schnellen Vorab-Pruefen ohne View: + // For fast Pre-Test without view: EESpellState HasSpellErrors(); sal_Bool HasText( const SvxSearchItem& rSearchItem ); @@ -433,7 +431,6 @@ public: virtual void StyleSheetChanged( SfxStyleSheet* pStyle ); virtual void ParagraphHeightChanged( sal_uInt16 nPara ); - // #101498# virtual void DrawingText( 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, @@ -446,6 +443,13 @@ public: const Color& rOverlineColor, const Color& rTextLineColor); + virtual void DrawingTab( + const Point& rStartPos, long nWidth, const String& rChar, + 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( sal_uInt16 nUndoId ) const; virtual sal_Bool FormattingParagraph( sal_uInt16 nPara ); virtual sal_Bool SpellNextDocument(); @@ -488,3 +492,5 @@ public: }; #endif // _MyEDITENG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/editengdllapi.h b/editeng/inc/editeng/editengdllapi.h index ec4b02f07e6a..42bb09d4a233 100644..100755 --- a/editeng/inc/editeng/editengdllapi.h +++ b/editeng/inc/editeng/editengdllapi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,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 @@ -41,3 +39,5 @@ #define EDITENG_DLLPRIVATE SAL_DLLPRIVATE #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/editerr.hxx b/editeng/inc/editeng/editerr.hxx index ab17123800f7..68fd8488ea3e 100644 --- a/editeng/inc/editeng/editerr.hxx +++ b/editeng/inc/editeng/editerr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,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 @@ -37,3 +35,5 @@ #define ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT (8UL | ERRCODE_AREA_SVX | \ ERRCODE_CLASS_READ ) #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/editids.hrc b/editeng/inc/editeng/editids.hrc index 49629a46c2f9..2fd88fc28395 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 @@ -129,6 +126,10 @@ // this ID didn't exist prior to the svx split #define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 ) +#define SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD ( SID_EDIT_START + 69 ) +#define SID_ATTR_ALIGN_VER_JUSTIFY_METHOD ( SID_EDIT_START + 70 ) +#define SID_ATTR_ALIGN_HOR_JUSTIFY ( SID_EDIT_START + 71 ) +#define SID_ATTR_ALIGN_VER_JUSTIFY ( SID_EDIT_START + 72 ) /* // planned, but not doable: changing value of SIDs will break code that uses them for WhichRanges diff --git a/editeng/inc/editeng/editobj.hxx b/editeng/inc/editeng/editobj.hxx index 3ede397562a5..66d17d3b6f3e 100644 --- a/editeng/inc/editeng/editobj.hxx +++ b/editeng/inc/editeng/editobj.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,7 +64,7 @@ public: sal_uInt16 Which() const { return nWhich; } - virtual sal_uInt16 GetUserType() const; // Fuer OutlinerMode, der kann das aber nicht kompatibel speichern + virtual sal_uInt16 GetUserType() const; // For OutlinerMode, it can however not save in compatible format virtual void SetUserType( sal_uInt16 n ); virtual sal_uLong GetObjectSettings() const; @@ -74,7 +75,7 @@ public: virtual sal_uInt16 GetScriptType() const; - virtual sal_uInt16 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; @@ -124,3 +125,5 @@ public: }; #endif // _EDITOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/editrids.hrc b/editeng/inc/editeng/editrids.hrc index 209d284a7fde..a77b87bfac91 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 @@ -282,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) @@ -381,7 +376,25 @@ #define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION (RID_EDIT_START + 314) #define RID_SVXSTR_A11Y_IMAGEBULLET_NAME (RID_EDIT_START + 315) -#if 315 > (RID_EDIT_END-RID_EDIT_START) +// enum SvxCellHorJustify +#define RID_SVXITEMS_HORJUST_STANDARD (RID_EDIT_START + 316) +#define RID_SVXITEMS_HORJUST_LEFT (RID_EDIT_START + 317) +#define RID_SVXITEMS_HORJUST_CENTER (RID_EDIT_START + 318) +#define RID_SVXITEMS_HORJUST_RIGHT (RID_EDIT_START + 319) +#define RID_SVXITEMS_HORJUST_BLOCK (RID_EDIT_START + 320) +#define RID_SVXITEMS_HORJUST_REPEAT (RID_EDIT_START + 321) + +// enum SvxCellVerJustify +#define RID_SVXITEMS_VERJUST_STANDARD (RID_EDIT_START + 322) +#define RID_SVXITEMS_VERJUST_TOP (RID_EDIT_START + 323) +#define RID_SVXITEMS_VERJUST_CENTER (RID_EDIT_START + 324) +#define RID_SVXITEMS_VERJUST_BOTTOM (RID_EDIT_START + 325) + +// enum SvxCellJustifyMethod +#define RID_SVXITEMS_JUSTMETHOD_AUTO (RID_EDIT_START + 326) +#define RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE (RID_EDIT_START + 327) + +#if 327 > (RID_EDIT_END-RID_EDIT_START) #error Resource-Ueberlauf in #line, #file #endif diff --git a/editeng/inc/editeng/editstat.hxx b/editeng/inc/editeng/editstat.hxx index 6c9373c1638d..7b4a80502e23 100644 --- a/editeng/inc/editeng/editstat.hxx +++ b/editeng/inc/editeng/editstat.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,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 @@ -80,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( sal_uLong& rBits, const sal_uInt32 nMask, sal_Bool bOn ) +inline void SetFlags( sal_uLong& rBits, const sal_uInt32 nMask, bool bOn ) { if ( bOn ) rBits |= nMask; @@ -101,13 +102,13 @@ class EditStatus protected: sal_uLong nStatusBits; sal_uLong nControlBits; - sal_uInt16 nPrevPara; // fuer EE_STAT_CRSRLEFTPARA + sal_uInt16 nPrevPara; // for EE_STAT_CRSRLEFTPARA public: EditStatus() { nStatusBits = 0; nControlBits = 0; nPrevPara = 0xFFFF; } void Clear() { nStatusBits = 0; } - void SetControlBits( sal_uLong nMask, sal_Bool bOn ) + void SetControlBits( sal_uLong nMask, bool bOn ) { SetFlags( nControlBits, nMask, bOn ); } sal_uLong GetStatusWord() const { return nStatusBits; } @@ -148,3 +149,4 @@ struct SpellCallbackInfo #endif // _EDITSTAT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/editund2.hxx b/editeng/inc/editeng/editund2.hxx index 52986e6ee1e4..554fb32f2c22 100644 --- a/editeng/inc/editeng/editund2.hxx +++ b/editeng/inc/editeng/editund2.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -74,3 +75,4 @@ public: #endif // _EDITUND2_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/editview.hxx b/editeng/inc/editeng/editview.hxx index c187ea60743b..745b14859ec9 100644 --- a/editeng/inc/editeng/editview.hxx +++ b/editeng/inc/editeng/editview.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,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 @@ -58,9 +59,7 @@ class SfxStyleSheet; class Font; class FontList; -#ifndef _EDITDATA_HXX #include <editeng/editdata.hxx> -#endif #include <com/sun/star/uno/Reference.h> #include "editeng/editengdllapi.h" @@ -77,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; @@ -127,13 +126,13 @@ public: 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; @@ -145,7 +144,7 @@ public: void InsertText( const String& rNew, sal_Bool bSelect = sal_False ); - sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent ); + sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL ); sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent ); sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent ); @@ -167,7 +166,7 @@ public: void Undo(); void Redo(); - // speziell fuer Olli + // especially for Oliver Specht sal_uInt16 GetParagraph( const Point& rMousePosPixel ); Point GetWindowPosTopLeft( sal_uInt16 nParagraph ); void MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos ); @@ -196,7 +195,7 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetTransferable(); - // An EditView, damit bei sal_True flackerfreies Update: + // An EditView, so that when TRUE the update will be free from flickering: void SetEditEngineUpdateMode( sal_Bool bUpdate ); void ForceUpdate(); @@ -208,7 +207,7 @@ public: sal_Bool MatchGroup(); - void CompleteAutoCorrect(); + void CompleteAutoCorrect( Window* pFrameWin = NULL ); EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False ); EESpellState StartThesaurus(); @@ -248,3 +247,5 @@ public: }; #endif // _MyEDITVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/edtdlg.hxx b/editeng/inc/editeng/edtdlg.hxx index 82f1f07269c4..a3ed723a2037 100644 --- a/editeng/inc/editeng/edtdlg.hxx +++ b/editeng/inc/editeng/edtdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,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 @@ -112,3 +110,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/eedata.hxx b/editeng/inc/editeng/eedata.hxx index cf8bf69431f2..7f1f131df054 100644 --- a/editeng/inc/editeng/eedata.hxx +++ b/editeng/inc/editeng/eedata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -72,3 +73,5 @@ namespace EEngineData ////////////////////////////////////////////////////////////////////////////// // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/eeitem.hxx b/editeng/inc/editeng/eeitem.hxx index 3b4897fd86ed..085ffb226b35 100644 --- a/editeng/inc/editeng/eeitem.hxx +++ b/editeng/inc/editeng/eeitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,7 @@ #define EE_ITEMS_START 3989 -// Absatzattribute: +// Paragraph attributes: #define EE_PARA_START (EE_ITEMS_START+0) #define EE_PARA_WRITINGDIR (EE_ITEMS_START+0) #define EE_PARA_XMLATTRIBS (EE_ITEMS_START+1) @@ -48,52 +49,56 @@ #define EE_PARA_SBL (EE_ITEMS_START+13) #define EE_PARA_JUST (EE_ITEMS_START+14) #define EE_PARA_TABS (EE_ITEMS_START+15) -#define EE_PARA_END (EE_ITEMS_START+15) +#define EE_PARA_JUST_METHOD (EE_ITEMS_START+16) +#define EE_PARA_VER_JUST (EE_ITEMS_START+17) +#define EE_PARA_END (EE_ITEMS_START+17) -// Zeichenattribute: -#define EE_CHAR_START (EE_ITEMS_START+16) -#define EE_CHAR_COLOR (EE_ITEMS_START+16) -#define EE_CHAR_FONTINFO (EE_ITEMS_START+17) -#define EE_CHAR_FONTHEIGHT (EE_ITEMS_START+18) -#define EE_CHAR_FONTWIDTH (EE_ITEMS_START+19) -#define EE_CHAR_WEIGHT (EE_ITEMS_START+20) -#define EE_CHAR_UNDERLINE (EE_ITEMS_START+21) -#define EE_CHAR_STRIKEOUT (EE_ITEMS_START+22) -#define EE_CHAR_ITALIC (EE_ITEMS_START+23) -#define EE_CHAR_OUTLINE (EE_ITEMS_START+24) -#define EE_CHAR_SHADOW (EE_ITEMS_START+25) -#define EE_CHAR_ESCAPEMENT (EE_ITEMS_START+26) -#define EE_CHAR_PAIRKERNING (EE_ITEMS_START+27) -#define EE_CHAR_KERNING (EE_ITEMS_START+28) -#define EE_CHAR_WLM (EE_ITEMS_START+29) -#define EE_CHAR_LANGUAGE (EE_ITEMS_START+30) -#define EE_CHAR_LANGUAGE_CJK (EE_ITEMS_START+31) -#define EE_CHAR_LANGUAGE_CTL (EE_ITEMS_START+32) -#define EE_CHAR_FONTINFO_CJK (EE_ITEMS_START+33) -#define EE_CHAR_FONTINFO_CTL (EE_ITEMS_START+34) -#define EE_CHAR_FONTHEIGHT_CJK (EE_ITEMS_START+35) -#define EE_CHAR_FONTHEIGHT_CTL (EE_ITEMS_START+36) -#define EE_CHAR_WEIGHT_CJK (EE_ITEMS_START+37) -#define EE_CHAR_WEIGHT_CTL (EE_ITEMS_START+38) -#define EE_CHAR_ITALIC_CJK (EE_ITEMS_START+39) -#define EE_CHAR_ITALIC_CTL (EE_ITEMS_START+40) -#define EE_CHAR_EMPHASISMARK (EE_ITEMS_START+41) -#define EE_CHAR_RELIEF (EE_ITEMS_START+42) -#define EE_CHAR_RUBI_DUMMY (EE_ITEMS_START+43) -#define EE_CHAR_XMLATTRIBS (EE_ITEMS_START+44) -#define EE_CHAR_OVERLINE (EE_ITEMS_START+45) -#define EE_CHAR_END (EE_ITEMS_START+45) +// Character attributes: +#define EE_CHAR_START (EE_ITEMS_START+18) +#define EE_CHAR_COLOR (EE_ITEMS_START+18) +#define EE_CHAR_FONTINFO (EE_ITEMS_START+19) +#define EE_CHAR_FONTHEIGHT (EE_ITEMS_START+20) +#define EE_CHAR_FONTWIDTH (EE_ITEMS_START+21) +#define EE_CHAR_WEIGHT (EE_ITEMS_START+22) +#define EE_CHAR_UNDERLINE (EE_ITEMS_START+23) +#define EE_CHAR_STRIKEOUT (EE_ITEMS_START+24) +#define EE_CHAR_ITALIC (EE_ITEMS_START+25) +#define EE_CHAR_OUTLINE (EE_ITEMS_START+26) +#define EE_CHAR_SHADOW (EE_ITEMS_START+27) +#define EE_CHAR_ESCAPEMENT (EE_ITEMS_START+28) +#define EE_CHAR_PAIRKERNING (EE_ITEMS_START+29) +#define EE_CHAR_KERNING (EE_ITEMS_START+30) +#define EE_CHAR_WLM (EE_ITEMS_START+31) +#define EE_CHAR_LANGUAGE (EE_ITEMS_START+32) +#define EE_CHAR_LANGUAGE_CJK (EE_ITEMS_START+33) +#define EE_CHAR_LANGUAGE_CTL (EE_ITEMS_START+34) +#define EE_CHAR_FONTINFO_CJK (EE_ITEMS_START+35) +#define EE_CHAR_FONTINFO_CTL (EE_ITEMS_START+36) +#define EE_CHAR_FONTHEIGHT_CJK (EE_ITEMS_START+37) +#define EE_CHAR_FONTHEIGHT_CTL (EE_ITEMS_START+38) +#define EE_CHAR_WEIGHT_CJK (EE_ITEMS_START+39) +#define EE_CHAR_WEIGHT_CTL (EE_ITEMS_START+40) +#define EE_CHAR_ITALIC_CJK (EE_ITEMS_START+41) +#define EE_CHAR_ITALIC_CTL (EE_ITEMS_START+42) +#define EE_CHAR_EMPHASISMARK (EE_ITEMS_START+43) +#define EE_CHAR_RELIEF (EE_ITEMS_START+44) +#define EE_CHAR_RUBI_DUMMY (EE_ITEMS_START+45) +#define EE_CHAR_XMLATTRIBS (EE_ITEMS_START+46) +#define EE_CHAR_OVERLINE (EE_ITEMS_START+47) +#define EE_CHAR_END (EE_ITEMS_START+47) -#define EE_FEATURE_START (EE_ITEMS_START+46) -#define EE_FEATURE_TAB (EE_ITEMS_START+46) -#define EE_FEATURE_LINEBR (EE_ITEMS_START+47) -#define EE_FEATURE_NOTCONV (EE_ITEMS_START+48) -#define EE_FEATURE_FIELD (EE_ITEMS_START+49) -#define EE_FEATURE_END (EE_ITEMS_START+49) +#define EE_FEATURE_START (EE_ITEMS_START+48) +#define EE_FEATURE_TAB (EE_ITEMS_START+48) +#define EE_FEATURE_LINEBR (EE_ITEMS_START+49) +#define EE_FEATURE_NOTCONV (EE_ITEMS_START+50) +#define EE_FEATURE_FIELD (EE_ITEMS_START+51) +#define EE_FEATURE_END (EE_ITEMS_START+51) -#define EE_ITEMS_END (EE_ITEMS_START+49) +#define EE_ITEMS_END (EE_ITEMS_START+51) #define EDITITEMCOUNT ( EE_ITEMS_END - EE_ITEMS_START + 1 ) #endif // _EEITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/eeitemid.hxx b/editeng/inc/editeng/eeitemid.hxx index 26f86e5a83b8..fa7c9471f033 100644 --- a/editeng/inc/editeng/eeitemid.hxx +++ b/editeng/inc/editeng/eeitemid.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,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 @@ -104,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 @@ -134,3 +135,4 @@ #endif //_EEITEMID_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/eerdll.hxx b/editeng/inc/editeng/eerdll.hxx index 0889d6e0d5b1..00094cfbc436 100644 --- a/editeng/inc/editeng/eerdll.hxx +++ b/editeng/inc/editeng/eerdll.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,12 +47,12 @@ class EditDLL GlobalEditData* pGlobalData; public: - EditDLL(); - ~EditDLL(); + EditDLL(); + ~EditDLL(); ResMgr* GetResMgr() const { return pResMgr; } GlobalEditData* GetGlobalData() const { return pGlobalData; } - static EditDLL* Get(); + static EditDLL& Get(); }; #define EE_DLL() EditDLL::Get() @@ -59,3 +60,5 @@ public: #define EE_RESSTR(x) String( EditResId(x) ) #endif //_EERDLL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/emphitem.hxx b/editeng/inc/editeng/emphitem.hxx index 18845e64a3db..eca87ed889db 100644 --- a/editeng/inc/editeng/emphitem.hxx +++ b/editeng/inc/editeng/emphitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,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 @@ -54,7 +55,7 @@ public: SvxEmphasisMarkItem( const FontEmphasisMark eVal /*= EMPHASISMARK_NONE*/, 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, @@ -66,10 +67,8 @@ public: virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, - sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, - sal_uInt8 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 ) { @@ -86,3 +85,4 @@ public: #endif // #ifndef _SVX_EMPHITEM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/escpitem.hxx b/editeng/inc/editeng/escpitem.hxx index 2f29c8f2e79b..070eb8342452 100644 --- a/editeng/inc/editeng/escpitem.hxx +++ b/editeng/inc/editeng/escpitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,14 +43,14 @@ 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 @@ -65,15 +66,15 @@ public: 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 sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 &, sal_uInt16) const; @@ -112,3 +113,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/fhgtitem.hxx b/editeng/inc/editeng/fhgtitem.hxx index 5b087e952d57..a8cc34e0d290 100644 --- a/editeng/inc/editeng/fhgtitem.hxx +++ b/editeng/inc/editeng/fhgtitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,11 +41,11 @@ 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 ((sal_uInt16)0x0001) @@ -61,10 +62,10 @@ public: 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 sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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, @@ -75,8 +76,8 @@ public: virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; virtual sal_uInt16 GetVersion( sal_uInt16 nItemVersion) const; - virtual int ScaleMetrics( long nMult, long nDiv ); - virtual int HasMetrics() const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize) { @@ -114,3 +115,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx index 30f08ee38257..e911d41ea3c8 100644 --- a/editeng/inc/editeng/flditem.hxx +++ b/editeng/inc/editeng/flditem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,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) @@ -87,13 +88,13 @@ public: }; // ================================================================= -// 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 @@ -105,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 @@ -158,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 ) @@ -246,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 @@ -299,10 +300,10 @@ public: enum SvxFileType { SVXFILETYPE_FIX, SVXFILETYPE_VAR }; -enum SvxFileFormat { SVXFILEFORMAT_NAME_EXT, // Dateiname mit Extension - SVXFILEFORMAT_FULLPATH, // vollstndiger 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 }; @@ -338,10 +339,10 @@ public: enum SvxAuthorType { SVXAUTHORTYPE_FIX, SVXAUTHORTYPE_VAR }; -enum SvxAuthorFormat { SVXAUTHORFORMAT_FULLNAME, // vollstndiger 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 @@ -425,3 +426,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/flstitem.hxx b/editeng/inc/editeng/flstitem.hxx index 7a607f475828..bcf757cea592 100644 --- a/editeng/inc/editeng/flstitem.hxx +++ b/editeng/inc/editeng/flstitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,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 @@ -61,7 +62,7 @@ public: virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -77,3 +78,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/fontitem.hxx b/editeng/inc/editeng/fontitem.hxx index c64c8d99d9e4..3aac10a7bd90 100755..100644 --- a/editeng/inc/editeng/fontitem.hxx +++ b/editeng/inc/editeng/fontitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,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 @@ -67,20 +68,20 @@ public: const rtl_TextEncoding eFontTextEncoding /*= RTL_TEXTENCODING_DONTKNOW*/, 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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; - // ZugriffsMethoden: + // Access methods: void SetFamilyName( const String& rFamilyName ) { aFamilyName = rFamilyName; } inline const String &GetFamilyName() const { return aFamilyName; } @@ -109,3 +110,4 @@ EDITENG_DLLPUBLIC void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian #endif // #ifndef _SVX_FONTITEM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/forbiddencharacterstable.hxx b/editeng/inc/editeng/forbiddencharacterstable.hxx index 877121b69005..5d499e8f6489 100644 --- a/editeng/inc/editeng/forbiddencharacterstable.hxx +++ b/editeng/inc/editeng/forbiddencharacterstable.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,11 +29,9 @@ #ifndef _FORBIDDENCHARACTERSTABLE_HXX #define _FORBIDDENCHARACTERSTABLE_HXX -#ifndef _TABLE_HXX //autogen #include <tools/table.hxx> -#endif -#include <vos/refernce.hxx> +#include <salhelper/simplereferenceobject.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/i18n/ForbiddenCharacters.hpp> #include "editeng/editengdllapi.h" @@ -52,7 +51,7 @@ struct ForbiddenCharactersInfo DECLARE_TABLE( SvxForbiddenCharactersTableImpl, ForbiddenCharactersInfo* ) -class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable : public SvxForbiddenCharactersTableImpl, public vos::OReference +class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable : public SvxForbiddenCharactersTableImpl, public salhelper::SimpleReferenceObject { private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; @@ -68,3 +67,4 @@ public: #endif // _FORBIDDENCHARACTERSTABLE_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/forbiddenruleitem.hxx b/editeng/inc/editeng/forbiddenruleitem.hxx index e0e5aac309a2..be91d4d8f99f 100644 --- a/editeng/inc/editeng/forbiddenruleitem.hxx +++ b/editeng/inc/editeng/forbiddenruleitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -67,3 +68,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/frmdir.hxx b/editeng/inc/editeng/frmdir.hxx index bc869a361991..ec5d5b7e0b10 100644 --- a/editeng/inc/editeng/frmdir.hxx +++ b/editeng/inc/editeng/frmdir.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,3 +59,4 @@ enum SvxFrameDirection #endif // #ifndef _SVX_FRMDIR_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/frmdiritem.hxx b/editeng/inc/editeng/frmdiritem.hxx index 6e479d27530b..b8ff60f5fe7a 100644 --- a/editeng/inc/editeng/frmdiritem.hxx +++ b/editeng/inc/editeng/frmdiritem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -64,10 +65,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, - sal_uInt8 nMemberId ); - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, - sal_uInt8 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 ) { @@ -78,3 +77,4 @@ public: #endif // #ifndef _SVX_FRMDIRITEM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/fwdtitem.hxx b/editeng/inc/editeng/fwdtitem.hxx index 05f957835912..86e47a753320 100644 --- a/editeng/inc/editeng/fwdtitem.hxx +++ b/editeng/inc/editeng/fwdtitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,9 +37,9 @@ // class SvxFontWidthItem ----------------------------------------------- -/* [Beschreibung] +/* [Description] - Dieses Item beschreibt die Font-Breite. + This item describes the font width. */ class SvxFontWidthItem : public SfxPoolItem @@ -52,10 +53,10 @@ public: 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 sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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,8 +66,8 @@ public: virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; - virtual int ScaleMetrics( long nMult, long nDiv ); - virtual int HasMetrics() const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; inline SvxFontWidthItem& operator=(const SvxFontWidthItem& rItem ) { @@ -106,3 +107,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/hangulhanja.hxx b/editeng/inc/editeng/hangulhanja.hxx index a7b52c9a6494..69c3ae8c6496 100644 --- a/editeng/inc/editeng/hangulhanja.hxx +++ b/editeng/inc/editeng/hangulhanja.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -300,3 +301,5 @@ namespace editeng //............................................................................. #endif // SVX_HANGUL_HANJA_CONVERSION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/hngpnctitem.hxx b/editeng/inc/editeng/hngpnctitem.hxx index dfe060c45f92..475b3dbe20cf 100644 --- a/editeng/inc/editeng/hngpnctitem.hxx +++ b/editeng/inc/editeng/hngpnctitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -67,3 +68,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/hyznitem.hxx b/editeng/inc/editeng/hyznitem.hxx index 15c6665c620f..adef7385b70d 100644 --- a/editeng/inc/editeng/hyznitem.hxx +++ b/editeng/inc/editeng/hyznitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,10 +41,10 @@ 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 @@ -62,10 +63,10 @@ public: 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 sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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, @@ -104,3 +105,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/itemtype.hxx b/editeng/inc/editeng/itemtype.hxx index 19bf08ed0d5d..abf1dae39b59 100644 --- a/editeng/inc/editeng/itemtype.hxx +++ b/editeng/inc/editeng/itemtype.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,3 +74,4 @@ inline long Scale( long nVal, long nMult, long nDiv ) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/justifyitem.hxx b/editeng/inc/editeng/justifyitem.hxx new file mode 100644 index 000000000000..67f8dc2e0e0d --- /dev/null +++ b/editeng/inc/editeng/justifyitem.hxx @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __EDITENG_JUSTIFYITEM_HXX__ +#define __EDITENG_JUSTIFYITEM_HXX__ + +#include "editeng/editengdllapi.h" +#include "editeng/svxenum.hxx" +#include <svl/eitem.hxx> +#include <sal/types.h> + +class EDITENG_DLLPUBLIC SvxHorJustifyItem: public SfxEnumItem +{ +public: + TYPEINFO(); + + SvxHorJustifyItem( const sal_uInt16 nId ); + + SvxHorJustifyItem( + const SvxCellHorJustify eJustify /*= SVX_HOR_JUSTIFY_STANDARD*/, + 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, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueText( sal_uInt16 nVal ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; + + inline SvxHorJustifyItem& operator=(const SvxHorJustifyItem& rHorJustify) + { + SetValue( rHorJustify.GetValue() ); + return *this; + } +}; + +//------------------------------------------------------------------------ + +class EDITENG_DLLPUBLIC SvxVerJustifyItem: public SfxEnumItem +{ +public: + TYPEINFO(); + + SvxVerJustifyItem( const sal_uInt16 nId ); + + SvxVerJustifyItem( + const SvxCellVerJustify eJustify /*= SVX_VER_JUSTIFY_STANDARD*/, + 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, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueText( sal_uInt16 nVal ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; + + inline SvxVerJustifyItem& operator=(const SvxVerJustifyItem& rVerJustify) + { + SetValue( rVerJustify.GetValue() ); + return *this; + } +}; + +//------------------------------------------------------------------------ + +class EDITENG_DLLPUBLIC SvxJustifyMethodItem: public SfxEnumItem +{ +public: + SvxJustifyMethodItem( const sal_uInt16 nId ); + + SvxJustifyMethodItem( + const SvxCellJustifyMethod eMethod, + 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, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueText( sal_uInt16 nVal ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; + + SvxJustifyMethodItem& operator=(const SvxJustifyMethodItem& r); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/keepitem.hxx b/editeng/inc/editeng/keepitem.hxx index a7751eb1efda..4465e566de4e 100644 --- a/editeng/inc/editeng/keepitem.hxx +++ b/editeng/inc/editeng/keepitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,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 @@ -53,7 +54,7 @@ public: 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&, sal_uInt16 ) const; virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; @@ -76,3 +77,4 @@ inline SvxFmtKeepItem& SvxFmtKeepItem::operator=( const SvxFmtKeepItem& rKeep ) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/kernitem.hxx b/editeng/inc/editeng/kernitem.hxx index f18cf9ff316e..818148a346a0 100644 --- a/editeng/inc/editeng/kernitem.hxx +++ b/editeng/inc/editeng/kernitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,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 @@ -55,12 +56,12 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; - virtual int ScaleMetrics( long nMult, long nDiv ); - virtual int HasMetrics() const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, @@ -72,9 +73,10 @@ public: return *this; } - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/langitem.hxx b/editeng/inc/editeng/langitem.hxx index a90982f16799..5e847c0f0159 100644 --- a/editeng/inc/editeng/langitem.hxx +++ b/editeng/inc/editeng/langitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,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 @@ -54,7 +55,7 @@ public: SvxLanguageItem( const LanguageType eLang /*= LANGUAGE_GERMAN*/, const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, @@ -76,9 +77,10 @@ public: { return (LanguageType)GetValue(); } void SetLanguage( const LanguageType eLang ) { SetValue( (sal_uInt16)eLang ); } - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/lcolitem.hxx b/editeng/inc/editeng/lcolitem.hxx index 969d0316b198..996c282050a0 100644 --- a/editeng/inc/editeng/lcolitem.hxx +++ b/editeng/inc/editeng/lcolitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,7 @@ #include <editeng/editengdllapi.h> /* - * dummy-Item fuer ToolBox-Controller: + * Dummy item for ToolBox controller: * */ @@ -63,3 +64,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/lrspitem.hxx b/editeng/inc/editeng/lrspitem.hxx index cf903fbd7a07..e00ff6d79272 100644 --- a/editeng/inc/editeng/lrspitem.hxx +++ b/editeng/inc/editeng/lrspitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,20 +40,19 @@ namespace rtl // class SvxLRSpaceItem -------------------------------------------------- -/* -[Beschreibung] -Linker/Rechter Rand sowie Erstzeileneinzug +/* [Description] -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: + Left/Right margin and first line indent - UI UI LAYOUT UI/TEXT UI/TEXT (Wo?) -SetTxtLeft SetTxtFirst GetLeft GetTxtLeft GetTxtFirst (Was?) - 500 -500 0 500 -500 (Wieviel?) + 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 @@ -65,15 +65,15 @@ SetTxtLeft SetTxtFirst GetLeft GetTxtLeft GetTxtFirst (Was?) class EDITENG_DLLPUBLIC SvxLRSpaceItem : public SfxPoolItem { - short nFirstLineOfst; // Erstzeileneinzug _immer_ relativ zu nTxtLeft - long nTxtLeft; // wir spendieren einen sal_uInt16 - 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 sal_uInt16 nPropFirstLineOfst, nPropLeftMargin, nPropRightMargin; - sal_Bool bAutoFirst : 1; // Automatische Berechnung der Erstzeileneinzugs + 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(); @@ -84,11 +84,11 @@ public: 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 sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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, @@ -99,14 +99,14 @@ public: virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; - virtual int ScaleMetrics( long nMult, long nDiv ); - virtual int HasMetrics() const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; // Die "Layout-Schnittstelle": 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; } @@ -114,7 +114,7 @@ public: inline sal_Bool IsAutoFirst() const { return bAutoFirst; } inline void SetAutoFirst( const sal_Bool bNew ) { bAutoFirst = bNew; } - // abfragen / setzen der Prozent-Werte + // Query/Setting the percentage values inline void SetPropLeft( const sal_uInt16 nProp = 100 ) { nPropLeftMargin = nProp; } inline void SetPropRight( const sal_uInt16 nProp = 100 ) @@ -122,7 +122,7 @@ public: inline sal_uInt16 GetPropLeft() const { return nPropLeftMargin; } inline sal_uInt16 GetPropRight() const { return nPropRightMargin;} - // Die "UI/Text-Schnittstelle": + // The UI/text interface: inline void SetTxtLeft( const long nL, const sal_uInt16 nProp = 100 ); inline long GetTxtLeft() const { return nTxtLeft; } @@ -177,3 +177,4 @@ inline void SvxLRSpaceItem::SetTxtLeft( const long nL, const sal_uInt16 nProp ) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/lspcitem.hxx b/editeng/inc/editeng/lspcitem.hxx index 8e444ff8aed1..ff57b83c468e 100644 --- a/editeng/inc/editeng/lspcitem.hxx +++ b/editeng/inc/editeng/lspcitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,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 @@ -60,18 +60,17 @@ class EDITENG_DLLPUBLIC SvxLineSpacingItem : public SfxEnumItemInterface 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( 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 sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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, @@ -82,8 +81,7 @@ public: 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 ) { @@ -91,7 +89,7 @@ public: eInterLineSpace = SVX_INTER_LINE_SPACE_FIX; } - // Bestimmt absolute oder minimale Zeilenhoehe. + // Determines the absolute or minimum row height. inline sal_uInt16 GetLineHeight() const { return nLineHeight; } inline void SetLineHeight( const sal_uInt16 nHeight ) { @@ -99,7 +97,7 @@ public: eLineSpace = SVX_LINE_SPACE_MIN; } - // Vergroessert oder verkleinert die Zeilenhoehe. + // To increase or decrease the row height. sal_uInt8 GetPropLineSpace() const { return nPropLineSpace; } inline void SetPropLineSpace( const sal_uInt8 nProp ) { @@ -121,3 +119,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/measfld.hxx b/editeng/inc/editeng/measfld.hxx index e54e7beb0be4..d3d23cd27d63 100644 --- a/editeng/inc/editeng/measfld.hxx +++ b/editeng/inc/editeng/measfld.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,10 +33,8 @@ #ifndef _FLDITEM_HXX #ifndef ITEMID_FIELD -#ifndef _EDITDATA_HXX -#include <editeng/editdata.hxx> /* das include wird wg. EE_FEATURE_FIELD benoetigt */ -#endif -#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 @@ -64,3 +63,4 @@ public: #endif //_SVDFIELD_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/memberids.hrc b/editeng/inc/editeng/memberids.hrc index 6bd88ebf164d..fa57ab11793a 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 @@ -41,6 +38,8 @@ #define MID_OUTER_WIDTH 0x41 #define MID_INNER_WIDTH 0x35 #define MID_LINESPACE 0x3b +#define MID_LINE_STYLE 0x90 + //NameOrIndex #define MID_NAME 16 @@ -191,6 +190,8 @@ #define MID_CASEMAP_VARIANT 0 #define MID_CASEMAP_TRANS 1 - +// SvxHorJustifyItem +#define MID_HORJUST_HORJUST 0 +#define MID_HORJUST_ADJUST 1 #endif diff --git a/editeng/inc/editeng/mutxhelp.hxx b/editeng/inc/editeng/mutxhelp.hxx index 00d7aaa14ec1..327595fdc5e2 100644 --- a/editeng/inc/editeng/mutxhelp.hxx +++ b/editeng/inc/editeng/mutxhelp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,3 +43,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/nhypitem.hxx b/editeng/inc/editeng/nhypitem.hxx index 3443ffc0cdec..e96d00c40483 100644 --- a/editeng/inc/editeng/nhypitem.hxx +++ b/editeng/inc/editeng/nhypitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,12 +34,6 @@ #include <editeng/editengdllapi.h> // class SvxNoHyphenItem ------------------------------------------------- - -/* [Beschreibung] - - PB: ??? -*/ - class EDITENG_DLLPUBLIC SvxNoHyphenItem : public SfxBoolItem { public: @@ -47,7 +42,7 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; @@ -66,3 +61,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/nlbkitem.hxx b/editeng/inc/editeng/nlbkitem.hxx index 9287168c4c59..d8a41d2629e8 100644 --- a/editeng/inc/editeng/nlbkitem.hxx +++ b/editeng/inc/editeng/nlbkitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,13 +35,6 @@ #include "editeng/editengdllapi.h" // class SvxNoLinebreakItem ---------------------------------------------- - - -/* [Beschreibung] - - PB: ??? -*/ - class EDITENG_DLLPUBLIC SvxNoLinebreakItem : public SfxBoolItem { public: @@ -49,7 +43,7 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; @@ -71,3 +65,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/numdef.hxx b/editeng/inc/editeng/numdef.hxx index ae14e93c6ab4..e741654c0811 100644 --- a/editeng/inc/editeng/numdef.hxx +++ b/editeng/inc/editeng/numdef.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,6 +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 cb0f8a1f6765..32d771cf00ac 100644 --- a/editeng/inc/editeng/numitem.hxx +++ b/editeng/inc/editeng/numitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,17 +57,17 @@ namespace com{namespace sun{ namespace star{ // ----------------------------------------------------------------------- //Feature-Flags (only sal_uInt16!) -#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? +#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 @@ -76,7 +77,7 @@ 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); @@ -103,7 +104,6 @@ public: class EDITENG_DLLPUBLIC SvxNumberFormat : public SvxNumberType { public: - // --> OD 2008-01-08 #newlistlevelattrs# enum SvxNumPositionAndSpaceMode { LABEL_WIDTH_AND_POSITION, @@ -115,7 +115,6 @@ public: SPACE, NOTHING }; - // <-- private: String sPrefix; @@ -123,14 +122,13 @@ private: SvxAdjust eNumAdjust; - sal_uInt8 nInclUpperLevels; //Nummern aus der vorigen Ebenen uebernehmen - sal_uInt16 nStart; //Start der Zaehlung + sal_uInt8 nInclUpperLevels; // Take over numbers from the previous level. + sal_uInt16 nStart; // Start of counting - sal_Unicode cBullet; //Symbol - sal_uInt16 nBulletRelSize; //proz. Groesse des Bullets - Color nBulletColor; //Bullet color + sal_Unicode cBullet; // Symbol + sal_uInt16 nBulletRelSize; // percentage size of bullets + Color nBulletColor; // Bullet color - // --> OD 2008-01-08 #newlistlevelattrs# // mode indicating, if the position and spacing of the list label is // determined by the former attributes (nFirstLineOffset, nAbsLSpace, // nLSpace and nCharTextDistance) called position and spacing via label @@ -141,14 +139,12 @@ private: // Note 2: The values of the former attributes are treated as 0, if mode // 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 - // --> OD 2008-01-08 #newlistlevelattrs# // specifies what follows the list label before the text of the first line // of the list item starts SvxNumLabelFollowedBy meLabelFollowedBy; @@ -158,25 +154,22 @@ private: long mnFirstLineIndent; // 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 DECL_STATIC_LINK( SvxNumberFormat, GraphicArrived, void * ); virtual void NotifyGraphicArrived(); public: - // --> OD 2008-01-09 #newlistlevelattrs# SvxNumberFormat( sal_Int16 nNumberingType, SvxNumPositionAndSpaceMode ePositionAndSpaceMode = LABEL_WIDTH_AND_POSITION ); - // <-- SvxNumberFormat(const SvxNumberFormat& rFormat); SvxNumberFormat(SvStream &rStream); @@ -220,29 +213,18 @@ public: void SetGraphicSize(const Size& rSet) {aGraphicSize = rSet;} const Size& GetGraphicSize() const {return aGraphicSize;} - // --> OD 2008-01-09 #newlistlevelattrs# SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const; void SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode ); - // <-- void SetLSpace(short nSet) {nLSpace = nSet;} - // --> OD 2008-01-09 #newlistlevelattrs# short GetLSpace() const; - // <-- void SetAbsLSpace(short nSet) {nAbsLSpace = nSet;} - // --> OD 2008-01-09 #newlistlevelattrs# short GetAbsLSpace() const; - // <-- void SetFirstLineOffset(short nSet) { nFirstLineOffset = nSet;} - // --> OD 2008-01-09 #newlistlevelattrs# short GetFirstLineOffset() const; - // <-- void SetCharTextDistance(short nSet) { nCharTextDistance = nSet; } - // --> OD 2008-01-09 #newlistlevelattrs# short GetCharTextDistance() const; - // <-- - // --> OD 2008-01-09 #newlistlevelattrs# void SetLabelFollowedBy( const SvxNumLabelFollowedBy eLabelFollowedBy ); SvxNumLabelFollowedBy GetLabelFollowedBy() const; void SetListtabPos( const long nListtabPos ); @@ -251,7 +233,6 @@ public: long GetFirstLineIndent() const; void SetIndentAt( const long nIndentAt ); long GetIndentAt() const; - // <-- static Size GetGraphicSizeMM100(const Graphic* pGraphic); static String CreateRomanString( sal_uLong nNo, sal_Bool bUpper ); @@ -267,18 +248,17 @@ enum SvxNumRuleType class EDITENG_DLLPUBLIC SvxNumRule { - sal_uInt16 nLevelCount; // Anzahl der unterstuetzten Levels - sal_uInt32 nFeatureFlags; // was wird unterstuetzt? - SvxNumRuleType eNumberingType; // was fuer eine Numerierung - sal_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]; - sal_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: - // --> OD 2008-02-11 #newlistlevelattrs# SvxNumRule( sal_uLong nFeatures, sal_uInt16 nLevels, sal_Bool bCont, @@ -286,7 +266,6 @@ public: SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode = SvxNumberFormat::LABEL_WIDTH_AND_POSITION ); - // <-- SvxNumRule(const SvxNumRule& rCopy); SvxNumRule(SvStream &rStream); virtual ~SvxNumRule(); @@ -321,9 +300,7 @@ public: sal_Bool UnLinkGraphics(); }; -/* -----------------27.10.98 13:04------------------- - * - * --------------------------------------------------*/ + class EDITENG_DLLPUBLIC SvxNumBulletItem : public SfxPoolItem { SvxNumRule* pNumRule; @@ -341,18 +318,16 @@ public: SvxNumRule* GetNumRule() const {return pNumRule;} - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 { - sal_uInt16 nLevelVal[ SVX_MAX_NUM ]; // Nummern aller Levels - sal_uInt16 nSetValue; // vorgegebene Nummer - sal_uInt8 nMyLevel; // akt. Level - sal_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( sal_uInt8 nLevel = SVX_NO_NUM, sal_uInt16 nSetVal = USHRT_MAX ); @@ -387,10 +362,8 @@ inline SvxNodeNum& SvxNodeNum::operator=( const SvxNodeNum& rCpy ) return *this; } -/* -------------------------------------------------- - * - * --------------------------------------------------*/ SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevel, SvxNumRuleType eType ); #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/opaqitem.hxx b/editeng/inc/editeng/opaqitem.hxx index 3dcd828184e0..c73ae6f28ee4 100644 --- a/editeng/inc/editeng/opaqitem.hxx +++ b/editeng/inc/editeng/opaqitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,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 @@ -54,7 +55,7 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; @@ -79,3 +80,4 @@ inline SvxOpaqueItem &SvxOpaqueItem::operator=( const SvxOpaqueItem &rCpy ) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/optitems.hxx b/editeng/inc/editeng/optitems.hxx index 2c6030ebeaf0..c2d97dc5a2fb 100644 --- a/editeng/inc/editeng/optitems.hxx +++ b/editeng/inc/editeng/optitems.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -109,3 +110,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/orphitem.hxx b/editeng/inc/editeng/orphitem.hxx index 8271275a81f7..6405e46e6589 100644 --- a/editeng/inc/editeng/orphitem.hxx +++ b/editeng/inc/editeng/orphitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,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 @@ -53,7 +54,7 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; @@ -72,3 +73,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/outliner.hxx b/editeng/inc/editeng/outliner.hxx index a14d688864eb..ced4ae72628a 100644 --- a/editeng/inc/editeng/outliner.hxx +++ b/editeng/inc/editeng/outliner.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,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; @@ -85,7 +85,7 @@ namespace svl #include <com/sun/star/uno/Reference.h> -#include <vos/ref.hxx> +#include <rtl/ref.hxx> #include <editeng/svxfont.hxx> #include <editeng/eedata.hxx> #include <editeng/paragraphdata.hxx> @@ -104,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 @@ -222,8 +222,8 @@ private: 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; @@ -264,7 +264,7 @@ public: void Scroll( long nHorzScroll, long nVertScroll ); void Paint( const Rectangle& rRect ); - sal_Bool PostKeyEvent( const KeyEvent& rKEvt ); + sal_Bool PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin = NULL ); sal_Bool MouseButtonDown( const MouseEvent& ); sal_Bool MouseButtonUp( const MouseEvent& ); sal_Bool MouseMove( const MouseEvent& ); @@ -286,10 +286,9 @@ public: Rectangle GetVisArea() const; - List* CreateSelectionList(); + void CreateSelectionList (std::vector<Paragraph*> &aSelList) ; - // gibt Anzahl selektierter Absaetze zurueck - // MT 07/00: Who needs this? + // Retruns the number of selected paragraphs sal_uLong Select( Paragraph* pParagraph, sal_Bool bSelect=sal_True, sal_Bool bWChilds=sal_True); @@ -298,7 +297,7 @@ public: 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! sal_Bool AdjustHeight( long nDY ); void AdjustDepth( Paragraph* pPara, short nDX, @@ -399,12 +398,7 @@ public: bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( String &rStatusVal, LanguageType &rLang, const EditView &rEditView ); void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText ); - -//#if 0 // _SOLAR__PRIVATE -DECLARE_LIST(ViewList,OutlinerView*) -//#else -//typedef List ViewList; -//#endif +typedef ::std::vector< OutlinerView* > ViewList; class EDITENG_DLLPUBLIC DrawPortionInfo { @@ -424,9 +418,11 @@ public: const Color maOverlineColor; const Color maTextLineColor; - // #101498# BiDi level needs to be transported, too. sal_uInt8 mnBiDiLevel; + bool mbFilled; + long mnWidthToFill; + // bitfield unsigned mbEndOfLine : 1; unsigned mbEndOfParagraph : 1; @@ -450,6 +446,8 @@ public: const Color& rOverlineColor, const Color& rTextLineColor, sal_uInt8 nBiDiLevel, + bool bFilled, + long nWidthToFill, bool bEndOfLine, bool bEndOfParagraph, bool bEndOfBullet) @@ -467,6 +465,8 @@ public: maOverlineColor(rOverlineColor), maTextLineColor(rTextLineColor), mnBiDiLevel(nBiDiLevel), + mbFilled( bFilled ), + mnWidthToFill( nWidthToFill ), mbEndOfLine(bEndOfLine), mbEndOfParagraph(bEndOfParagraph), mbEndOfBullet(bEndOfBullet) @@ -635,7 +635,7 @@ class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster sal_uInt16 nOutlinerMode; - sal_Bool bIsExpanding; // Nur in Expand/Collaps-Hdl gueltig, mal umstellen + sal_Bool bIsExpanding; // Only valid in Expand/Collaps-Hdl, reset sal_Bool bFirstParaIsEmpty; sal_Bool bBlockInsCallback; sal_Bool bStrippingPortions; @@ -728,11 +728,11 @@ public: void SetAddExtLeading( sal_Bool b ); sal_Bool IsAddExtLeading() const; - sal_uLong InsertView( OutlinerView* pView, sal_uLong nIndex=LIST_APPEND); + size_t InsertView( OutlinerView* pView, size_t nIndex = size_t(-1) ); OutlinerView* RemoveView( OutlinerView* pView ); - OutlinerView* RemoveView( sal_uLong nIndex ); - OutlinerView* GetView( sal_uLong nIndex ) const; - sal_uLong GetViewCount() const; + OutlinerView* RemoveView( size_t nIndex ); + OutlinerView* GetView( size_t nIndex ) const; + size_t GetViewCount() const; Paragraph* Insert( const String& rText, sal_uLong nAbsPos = LIST_APPEND, sal_Int16 nDepth = 0 ); void SetText( const OutlinerParaObject& ); @@ -769,9 +769,7 @@ public: sal_Bool HasChilds( Paragraph* pParagraph ) const; sal_uLong GetChildCount( Paragraph* pParent ) const; sal_Bool IsExpanded( Paragraph* pPara ) const; -// Paragraph* GetParagraph( Paragraph* pParent, sal_uLong nRelPos ) const; - Paragraph* GetParent( Paragraph* pParagraph ) const; -// sal_uLong GetRelPos( Paragraph* pParent, Paragraph* pPara ) const; + Paragraph* GetParent( Paragraph* pParagraph ) const; sal_uLong GetAbsPos( Paragraph* pPara ); sal_Int16 GetDepth( sal_uLong nPara ) const; @@ -817,9 +815,10 @@ public: virtual long IndentingPagesHdl( OutlinerView* ); void SetIndentingPagesHdl(const Link& rLink){aIndentingPagesHdl=rLink;} Link GetIndentingPagesHdl() const { return aIndentingPagesHdl; } - // nur gueltig in den beiden oberen Handlern + // valid only in the two upper handlers sal_uInt16 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; } - // nur gueltig in den beiden oberen Handlern + + // valid only in the two upper handlers sal_uLong GetFirstSelPage() const { return mnFirstSelPage; } void SetCalcFieldValueHdl(const Link& rLink ) { aCalcFieldValueHdl= rLink; } @@ -887,7 +886,6 @@ public: void StripPortions(); - // #101498# virtual void DrawingText( 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, @@ -900,7 +898,16 @@ public: const Color& rOverlineColor, const Color& rTextLineColor); + virtual void DrawingTab( + const Point& rStartPos, long nWidth, const String& rChar, + 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 ); @@ -923,8 +930,8 @@ public: 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; } @@ -940,7 +947,7 @@ public: 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) + // 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 ); ::svl::IUndoManager& @@ -950,7 +957,7 @@ public: 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( sal_uInt16 nPara, sal_uInt16 nWhich = 0 ); @@ -974,8 +981,8 @@ public: void SetHyphenator( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator >& xHyph ); - void SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars ); - vos::ORef<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const; + void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ); + rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const; // Depricated void SetDefaultLanguage( LanguageType eLang ); @@ -1024,11 +1031,11 @@ public: 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(); @@ -1057,3 +1064,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/outlobj.hxx b/editeng/inc/editeng/outlobj.hxx index 0ce5af3e4c08..25ecec238d23 100644 --- a/editeng/inc/editeng/outlobj.hxx +++ b/editeng/inc/editeng/outlobj.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,3 +95,5 @@ public: ////////////////////////////////////////////////////////////////////////////// #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/paperinf.hxx b/editeng/inc/editeng/paperinf.hxx index 3f2584edc452..818008e20c3c 100644 --- a/editeng/inc/editeng/paperinf.hxx +++ b/editeng/inc/editeng/paperinf.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,3 +72,5 @@ inline Size &LandscapeSwap(Size &rSize) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/paragraphdata.hxx b/editeng/inc/editeng/paragraphdata.hxx index 738faa4cb387..a951a01cbc1f 100644 --- a/editeng/inc/editeng/paragraphdata.hxx +++ b/editeng/inc/editeng/paragraphdata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,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 @@ -70,3 +71,5 @@ typedef ::std::vector< ParagraphData > ParagraphDataVector; #endif // _PARAGRAPH_DATA_HXX // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/paravertalignitem.hxx b/editeng/inc/editeng/paravertalignitem.hxx index 74264c0b8aba..b13731b13555 100644 --- a/editeng/inc/editeng/paravertalignitem.hxx +++ b/editeng/inc/editeng/paravertalignitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,10 +62,8 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, - sal_uInt8 nMemberId ); - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, - sal_uInt8 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 ) { @@ -78,3 +77,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/pbinitem.hxx b/editeng/inc/editeng/pbinitem.hxx index 9b4941ee0744..ce5853b2e82c 100644 --- a/editeng/inc/editeng/pbinitem.hxx +++ b/editeng/inc/editeng/pbinitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,9 +39,9 @@ // 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 @@ -52,7 +53,7 @@ public: 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 &, sal_uInt16 ) const; virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const; @@ -75,3 +76,4 @@ inline SvxPaperBinItem &SvxPaperBinItem::operator=( #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/pgrditem.hxx b/editeng/inc/editeng/pgrditem.hxx index eb464290e736..4431dfccd7cc 100644 --- a/editeng/inc/editeng/pgrditem.hxx +++ b/editeng/inc/editeng/pgrditem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,8 +36,8 @@ // class SvxParaGridItem ------------------------------------------------- -/* - [Beschreibung] +/* [Description] + Paragraph snap to grid */ @@ -48,7 +49,7 @@ public: 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 &, sal_uInt16) const; virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; @@ -62,3 +63,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/pmdlitem.hxx b/editeng/inc/editeng/pmdlitem.hxx index 631cbb4ff9f7..4a732d2a91f9 100644 --- a/editeng/inc/editeng/pmdlitem.hxx +++ b/editeng/inc/editeng/pmdlitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,9 +35,9 @@ // 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 @@ -59,8 +60,8 @@ public: SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 ); sal_Bool IsAuto() const { return bAuto; } }; @@ -84,3 +85,4 @@ inline SvxPageModelItem& SvxPageModelItem::operator=( const SvxPageModelItem& rM #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/postitem.hxx b/editeng/inc/editeng/postitem.hxx index 873f2c0d068f..bdf68461d704 100644 --- a/editeng/inc/editeng/postitem.hxx +++ b/editeng/inc/editeng/postitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,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 @@ -54,7 +55,7 @@ public: SvxPostureItem( const FontItalic ePost /*= ITALIC_NONE*/, 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, @@ -66,8 +67,8 @@ public: virtual String GetValueTextByPos( sal_uInt16 nPos ) const; virtual sal_uInt16 GetValueCount() const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 sal_Bool GetBoolValue() const; @@ -87,3 +88,4 @@ public: #endif // #ifndef _SVX_POSTITEM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/prntitem.hxx b/editeng/inc/editeng/prntitem.hxx index 9571b831720b..9c0086b38daf 100644 --- a/editeng/inc/editeng/prntitem.hxx +++ b/editeng/inc/editeng/prntitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,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". */ @@ -51,7 +52,7 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; @@ -77,3 +78,4 @@ inline SvxPrintItem &SvxPrintItem::operator=( const SvxPrintItem &rCpy ) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/protitem.hxx b/editeng/inc/editeng/protitem.hxx index b4a4e26b6f5b..b2975c37963a 100644 --- a/editeng/inc/editeng/protitem.hxx +++ b/editeng/inc/editeng/protitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,17 +43,16 @@ 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 { - sal_Bool bCntnt :1; //Inhalt geschuetzt - sal_Bool bSize :1; //Groesse geschuetzt - sal_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(); @@ -60,7 +60,7 @@ public: 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, @@ -80,8 +80,8 @@ public: void SetSizeProtect ( sal_Bool bNew ) { bSize = bNew; } void SetPosProtect ( sal_Bool bNew ) { bPos = bNew; } - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 SvxProtectItem::SvxProtectItem( const sal_uInt16 nId ) @@ -103,3 +103,4 @@ inline SvxProtectItem &SvxProtectItem::operator=( const SvxProtectItem &rCpy ) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/prszitem.hxx b/editeng/inc/editeng/prszitem.hxx index 0d74f26d0651..a2b9d59866ea 100644 --- a/editeng/inc/editeng/prszitem.hxx +++ b/editeng/inc/editeng/prszitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,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 @@ -47,7 +48,7 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; @@ -66,3 +67,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/scriptspaceitem.hxx b/editeng/inc/editeng/scriptspaceitem.hxx index 4087bd229b25..87e147623cd1 100644 --- a/editeng/inc/editeng/scriptspaceitem.hxx +++ b/editeng/inc/editeng/scriptspaceitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,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. */ @@ -68,3 +69,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/scripttypeitem.hxx b/editeng/inc/editeng/scripttypeitem.hxx index 10b7abcb39b8..320c06326768 100644 --- a/editeng/inc/editeng/scripttypeitem.hxx +++ b/editeng/inc/editeng/scripttypeitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,7 @@ /* [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. */ @@ -89,3 +90,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/shaditem.hxx b/editeng/inc/editeng/shaditem.hxx index 7d6d76e7f075..99c9abaf67d2 100644 --- a/editeng/inc/editeng/shaditem.hxx +++ b/editeng/inc/editeng/shaditem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,9 +42,9 @@ 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 ((sal_uInt16)0) @@ -65,10 +66,10 @@ public: inline SvxShadowItem& operator=( const SvxShadowItem& rFmtShadow ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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, @@ -78,8 +79,8 @@ public: virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; - virtual int ScaleMetrics( long nMult, long nDiv ); - virtual int HasMetrics() 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; } @@ -90,7 +91,7 @@ public: void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; } void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; } - //Breite des Schattens auf der jeweiligen Seite berechnen. + // Calculate width of the shadow on the page. sal_uInt16 CalcShadowSpace( sal_uInt16 nShadow ) const; virtual sal_uInt16 GetValueCount() const; @@ -109,3 +110,4 @@ inline SvxShadowItem &SvxShadowItem::operator=( const SvxShadowItem& rFmtShadow #endif // #ifndef _SVX_SHADITEM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/shdditem.hxx b/editeng/inc/editeng/shdditem.hxx index 54c26a3120da..adeb059d3a1e 100644 --- a/editeng/inc/editeng/shdditem.hxx +++ b/editeng/inc/editeng/shdditem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,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 @@ -53,7 +54,7 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; @@ -72,3 +73,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/sizeitem.hxx b/editeng/inc/editeng/sizeitem.hxx index 6159c68855b7..c2b5a397ebf8 100644 --- a/editeng/inc/editeng/sizeitem.hxx +++ b/editeng/inc/editeng/sizeitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,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 @@ -53,10 +54,10 @@ public: inline SvxSizeItem& operator=( const SvxSizeItem &rCpy ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual int operator==( const SfxPoolItem& ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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, @@ -66,8 +67,8 @@ public: virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; - virtual int ScaleMetrics( long nMult, long nDiv ); - virtual int HasMetrics() 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; } @@ -81,3 +82,4 @@ inline SvxSizeItem& SvxSizeItem::operator=( const SvxSizeItem &rCpy ) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/spltitem.hxx b/editeng/inc/editeng/spltitem.hxx index 0ab4d42c5ab7..bf50d7e492bb 100644 --- a/editeng/inc/editeng/spltitem.hxx +++ b/editeng/inc/editeng/spltitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,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 @@ -55,7 +56,7 @@ public: 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&, sal_uInt16 ) const; virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; @@ -79,3 +80,4 @@ inline SvxFmtSplitItem& SvxFmtSplitItem::operator=( #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/splwrap.hxx b/editeng/inc/editeng/splwrap.hxx index 5e46a96adb9f..af61e3b81fbe 100644 --- a/editeng/inc/editeng/splwrap.hxx +++ b/editeng/inc/editeng/splwrap.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,14 +50,14 @@ class Window; void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect( String &rOldText, String &rNewText ); /*-------------------------------------------------------------------- - Beschreibung: Der SpellWrapper + Description: The SpellWrapper --------------------------------------------------------------------*/ class EDITENG_DLLPUBLIC SvxSpellWrapper { private: friend class SvxSpellCheckDialog; friend class SvxHyphenWordDialog; - friend class SvxHyphenWordDialog_Impl; + friend struct SvxHyphenWordDialog_Impl; Window* pWin; ::com::sun::star::uno::Reference< @@ -65,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, @@ -105,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 > @@ -120,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; } @@ -134,27 +135,29 @@ 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 }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/svxacorr.hxx b/editeng/inc/editeng/svxacorr.hxx index 73dc7664562e..0659b737949a 100755..100644 --- a/editeng/inc/editeng/svxacorr.hxx +++ b/editeng/inc/editeng/svxacorr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,29 +48,31 @@ class SvxAutoCorrLanguageTable_Impl; class SvxAutoCorrLastFileAskTable_Impl; 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 ChgWordLstLoad = 0x20000000; // Ersetzungsliste geladen -const long CplSttLstLoad = 0x40000000; // Exceptionlist fuer CplStart geladen -const long WrdSttLstLoad = 0x80000000; // Exceptionlist fuer WordStart geladen +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; // 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: @@ -86,28 +89,26 @@ public: 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: - // sal_True: den, vor der normalen Einfuegeposition (sal_True) - // sal_False: den, in den das korrigierte Wort eingfuegt wurde. - // (Muss nicht der gleiche Absatz sein!!!!) + // 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 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. + // 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? + // which language at the position? virtual LanguageType GetLanguage( xub_StrLen nPos, sal_Bool bPrevPara = sal_False ) const; }; @@ -115,7 +116,7 @@ public: class EDITENG_DLLPUBLIC SvxAutocorrWord { String sShort, sLong; - sal_Bool bIsTxtOnly; // ist reiner ASCII - Text + sal_Bool bIsTxtOnly; // Is pure ASCII - Text public: SvxAutocorrWord( const String& rS, const String& rL, sal_Bool bFlag = sal_True ) : sShort( rS ), sLong( rL ), bIsTxtOnly( bFlag ) @@ -132,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; @@ -164,35 +165,35 @@ 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(); 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(); sal_Bool AddToWrdSttExceptList(const String& rNew); - // Speichern von Wortersetzungen: - // Diese speichern direkt im Storage. Die Wortliste wird - // entsprechend aktualisiert! - // - purer Text + // 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 mit Attributierung (kann nur der SWG - SWG-Format!) + // - Text with attribution (only the SWG - SWG format!) sal_Bool PutText( const String& rShort, SfxObjectShell& ); - // - loesche einen Eintrag + // - Deleting an entry sal_Bool DeleteText( const String& rShort ); }; @@ -203,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; @@ -225,18 +226,18 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect void _GetCharClass( LanguageType eLang ); protected: - // - Text mit Attributierung (kann nur der SWG - SWG-Format!) - // rShort ist der Stream-Name - gecryptet! + // - 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 + // required language in the table add if possible only when the file exists sal_Bool CreateLanguageFile(LanguageType eLang, sal_Bool bNewFile = sal_True); - // - return den Ersetzungstext (nur fuer SWG-Format, alle anderen - // koennen aus der Wortliste herausgeholt werden!) - // rShort ist der Stream-Name - gecryptet! + // - Return the replacement text (only for SWG format, all others can be + // taken from the word list!) + // rShort is the stream name - encrypted! public: - //The method below is changed from private to public by BerryJia for Bug95846 Time:2002-8-13 15:50 + sal_Unicode GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote, LanguageType eLang ) const; virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, String& rLong ); @@ -248,28 +249,28 @@ public: SvxAutoCorrect( const SvxAutoCorrect& ); virtual ~SvxAutoCorrect(); - // fuehre eine AutoKorrektur aus. - // returnt was ausgefuehrt wurde; entsprechend den obigen Flags + // 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 ); + 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. + // 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; } @@ -285,22 +286,22 @@ public: void InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, 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, 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;} 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(); } @@ -308,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 + // 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 mit Attributierung (kann nur der SWG - SWG-Format!) + // - 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 + // - 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) @@ -331,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! + // 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 ) @@ -345,16 +345,15 @@ 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! + // 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 + // 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 + // Methods for the auto-correction sal_Bool FnCptlSttWrd( SvxAutoCorrDoc&, const String&, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM ); @@ -376,6 +375,9 @@ public: sal_Bool FnCptlSttSntnc( SvxAutoCorrDoc&, const String&, sal_Bool bNormalPos, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang = LANGUAGE_SYSTEM); + bool FnCorrectCapsLock( SvxAutoCorrDoc&, const String&, + xub_StrLen nSttPos, xub_StrLen nEndPos, + LanguageType eLang = LANGUAGE_SYSTEM ); bool HasRunNext() { return bRunNext; } @@ -398,3 +400,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/svxenum.hxx b/editeng/inc/editeng/svxenum.hxx index 6222f6ac85a1..68849722059b 100644 --- a/editeng/inc/editeng/svxenum.hxx +++ b/editeng/inc/editeng/svxenum.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -124,12 +125,19 @@ enum SvxCellHorJustify SVX_HOR_JUSTIFY_REPEAT }; +enum SvxCellJustifyMethod +{ + SVX_JUSTIFY_METHOD_AUTO, + SVX_JUSTIFY_METHOD_DISTRIBUTE +}; + enum SvxCellVerJustify { SVX_VER_JUSTIFY_STANDARD, SVX_VER_JUSTIFY_TOP, SVX_VER_JUSTIFY_CENTER, - SVX_VER_JUSTIFY_BOTTOM + SVX_VER_JUSTIFY_BOTTOM, + SVX_VER_JUSTIFY_BLOCK }; enum SvxCellOrientation @@ -194,25 +202,27 @@ 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 }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/svxfont.hxx b/editeng/inc/editeng/svxfont.hxx index 498ad5f296d4..d544afdae054 100644 --- a/editeng/inc/editeng/svxfont.hxx +++ b/editeng/inc/editeng/svxfont.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,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; @@ -40,9 +45,9 @@ class Printer; class EDITENG_DLLPUBLIC SvxFont : public Font { LanguageType eLang; // Language - SvxCaseMap eCaseMap; // Textauszeichnung - short nEsc; // Grad der Hoch-/Tiefstellung - sal_uInt8 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: @@ -50,7 +55,7 @@ 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; } @@ -70,19 +75,18 @@ public: inline void SetLanguage( const LanguageType eNewLan ) { eLang = eNewLan; Font::SetLanguage(eNewLan); } - // Is-Methoden: + // 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 sal_uInt16 nPartLen = USHRT_MAX ) const; @@ -124,3 +128,4 @@ public: #endif // #ifndef _SVX_SVXFONT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx index a56c28e42a81..f1e932134eac 100644 --- a/editeng/inc/editeng/svxrtf.hxx +++ b/editeng/inc/editeng/svxrtf.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,9 +59,9 @@ 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 - sal_uInt32 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 @@ -68,7 +69,7 @@ class SvxNodeIdx public: virtual ~SvxNodeIdx() {} virtual sal_uLong GetIdx() const = 0; - virtual SvxNodeIdx* Clone() const = 0; // erzeuge von sich eine Kopie + virtual SvxNodeIdx* Clone() const = 0; // Cloning itself }; class SvxPosition @@ -79,8 +80,8 @@ public: 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 }; @@ -95,13 +96,13 @@ SV_DECL_PTRARR_DEL( SvxRTFItemStackList, SvxRTFItemStackTypePtr, 1, 1 ) // the methods are using operator[] in sw/source/filter/rtf/rtftbl.cxx file typedef std::deque< SvxRTFItemStackTypePtr > SvxRTFItemStack; -// einige Hilfsklassen fuer den RTF-Parser +// 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; sal_uInt16 nBasedOn, nNext; - sal_Bool bBasedOnIsSet; //$flr #117411# + sal_Bool bBasedOnIsSet; sal_uInt8 nOutlineNo; sal_Bool bIsCharFmt; @@ -113,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 @@ -143,13 +144,13 @@ struct EDITENG_DLLPUBLIC SvxRTFPictureType 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 { sal_uInt16 nCaseMap, @@ -190,9 +191,9 @@ 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 { sal_uInt16 nLinespacing, @@ -246,31 +247,31 @@ class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser long nVersionNo; int nDfltFont; - sal_Bool bNewDoc : 1; // sal_False - in ein bestehendes lesen - sal_Bool bNewGroup : 1; // sal_True - es gab eine oeffnende Klammer - sal_Bool bIsSetDfltTab : 1; // sal_True - DefTab wurde eingelesen - sal_Bool bChkStyleAttr : 1; // sal_True - StyleSheets werden ausgewertet - sal_Bool bCalcValue : 1; // sal_True - Twipwerte an APP anpassen - sal_Bool bPardTokenRead : 1; // sal_True - Token \pard wurde erkannt - sal_Bool bReadDocInfo : 1; // sal_True - DocInfo mit einlesen - sal_Bool bIsLeftToRightDef : 1; // sal_True - in LeftToRight char run def. - // sal_False - in RightToLeft char run def. - sal_Bool bIsInReadStyleTab : 1; // sal_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=sal_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(); @@ -296,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(); @@ -308,15 +309,15 @@ 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 @@ -325,10 +326,10 @@ protected: 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, @@ -351,14 +352,14 @@ 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!!! ) + // 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() ); } @@ -369,37 +370,37 @@ protected: const String& GetBaseURL() const { return sBaseURL; } - // lesen die GrafikDaten und fuelle damit die Grafik und die - // die PicDaten. - // Return - sal_True: die Grafik ist gueltig + // 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 ); - // 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. + // 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( size_t nId ) const; - const Font& GetFont( sal_uInt16 nId ); // aendert den dflt Font + 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 + // 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 @@ -408,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; @@ -479,3 +480,4 @@ inline SfxItemSet& SvxRTFParser::GetAttrSet() #endif //_SVXRTF_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/swafopt.hxx b/editeng/inc/editeng/swafopt.hxx index f777730355f9..0c2f28e6695b 100644 --- a/editeng/inc/editeng/swafopt.hxx +++ b/editeng/inc/editeng/swafopt.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,7 @@ class SvStringsISortDtor; class SmartTagMgr; -// Klasse fuer Optionen vom Autoformat +// Class of options for AutoFormat struct EDITENG_DLLPUBLIC SvxSwAutoFmtFlags { Font aBulletFont; @@ -79,7 +80,7 @@ struct EDITENG_DLLPUBLIC SvxSwAutoFmtFlags sal_Bool bAutoCompleteWords : 1; sal_Bool bAutoCmpltCollectWords : 1; sal_Bool bAutoCmpltEndless : 1; -// -- under NT hier starts a new long +// -- under NT here starts a new long sal_Bool bAutoCmpltAppendBlanc : 1; sal_Bool bAutoCmpltShowAsTip : 1; @@ -103,3 +104,4 @@ struct EDITENG_DLLPUBLIC SvxSwAutoFmtFlags #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/tstpitem.hxx b/editeng/inc/editeng/tstpitem.hxx index d3554607b79c..f15a5d194347 100644 --- a/editeng/inc/editeng/tstpitem.hxx +++ b/editeng/inc/editeng/tstpitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,13 +39,13 @@ #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 { private: - long nTabPos; + sal_Int32 nTabPos; SvxTabAdjust eAdjustment; mutable sal_Unicode m_cDecimal; @@ -56,20 +57,13 @@ private: public: SvxTabStop(); -#if (_MSC_VER < 1300) - SvxTabStop( const long nPos, + SvxTabStop( const sal_Int32 nPos, const SvxTabAdjust eAdjst = SVX_TAB_ADJUST_LEFT, const sal_Unicode cDec = cDfltDecimalChar, const sal_Unicode cFil = cDfltFillChar ); -#else - SvxTabStop::SvxTabStop( const long nPos, - const SvxTabAdjust eAdjst = SVX_TAB_ADJUST_LEFT, - const sal_Unicode cDec = cDfltDecimalChar, - const sal_Unicode cFil = cDfltFillChar ); -#endif - long& GetTabPos() { return nTabPos; } - long GetTabPos() const { return nTabPos; } + sal_Int32& GetTabPos() { return nTabPos; } + sal_Int32 GetTabPos() const { return nTabPos; } SvxTabAdjust& GetAdjustment() { return eAdjustment; } SvxTabAdjust GetAdjustment() const { return eAdjustment; } @@ -82,7 +76,7 @@ public: String GetValueString() const; - // das "alte" operator==() + // the "old" operator==() sal_Bool IsEqual( const SvxTabStop& rTS ) const { return ( nTabPos == rTS.nTabPos && @@ -91,7 +85,7 @@ public: cFill == rTS.cFill ); } - // Fuer das SortedArray: + // For the SortedArray: sal_Bool operator==( const SvxTabStop& rTS ) const { return nTabPos == rTS.nTabPos; } sal_Bool operator <( const SvxTabStop& rTS ) const @@ -111,9 +105,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 @@ -130,13 +124,13 @@ public: sal_uInt16 nWhich ); SvxTabStopItem( const SvxTabStopItem& rTSI ); - // Liefert Index-Position des Tabs zurueck oder TAB_NOTFOUND + // 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 - sal_uInt16 GetPos( const long nPos ) const; + // Returns index of the tab at nPos, or TAB_NOTFOUND + sal_uInt16 GetPos( const sal_Int32 nPos ) const; - // entprivatisiert: + // unprivatized: sal_uInt16 Count() const { return SvxTabStopArr::Count(); } sal_Bool Insert( const SvxTabStop& rTab ); void Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart = 0, @@ -146,14 +140,14 @@ public: 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! + // SortedArrays returns only Stackobjects! const SvxTabStop& operator[]( const sal_uInt16 nPos ) const { DBG_ASSERT( GetStart() && @@ -163,10 +157,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 sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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, @@ -183,3 +177,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/twolinesitem.hxx b/editeng/inc/editeng/twolinesitem.hxx index 7f167386d5fa..100ac6fe4a42 100644 --- a/editeng/inc/editeng/twolinesitem.hxx +++ b/editeng/inc/editeng/twolinesitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,7 @@ public: 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 &, sal_uInt16 nVer) const; @@ -61,10 +62,8 @@ public: String &rText, const IntlWrapper* pIntl = 0 ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, - sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, - sal_uInt8 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 sal_uInt16 GetVersion( sal_uInt16 nFFVer ) const; @@ -88,3 +87,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/txtrange.hxx b/editeng/inc/editeng/txtrange.hxx index f6bbbfd77477..54e80ff3997f 100644 --- a/editeng/inc/editeng/txtrange.hxx +++ b/editeng/inc/editeng/txtrange.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,49 +29,48 @@ #ifndef _MyTXTRANGE_HXX #define _MyTXTRANGE_HXX -#ifndef _TXTRANGE_HXX -#define _SVSTDARR_sal_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 + //! 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 nCacheIdx; // Cache-Index - sal_uInt16 nRight; // Abstand Kontur-Text - sal_uInt16 nLeft; // Abstand Text-Kontur - sal_uInt16 nUpper; // Abstand Kontur-Text - sal_uInt16 nLower; // Abstand Text-Kontur - sal_uInt32 nPointCount; // Anzahl der Polygonpunkte - sal_Bool bSimple : 1; // Nur Aussenkante - sal_Bool bInner : 1; // sal_True: Objekt beschriften (EditEngine); - // sal_False: Objekt umfliessen (StarWriter); + 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; @@ -80,11 +80,12 @@ class EDITENG_DLLPUBLIC TextRanger TextRanger( const TextRanger& ); // not implemented const Rectangle& _GetBoundRect(); public: - TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon, + 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 ); + LongDqPtr GetTextRanges( const Range& rRange ); sal_uInt16 GetRight() const { return nRight; } sal_uInt16 GetLeft() const { return nLeft; } sal_uInt16 GetUpper() const { return nUpper; } @@ -116,3 +117,5 @@ public: #endif // _TXTRANGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/udlnitem.hxx b/editeng/inc/editeng/udlnitem.hxx index d0c76be4a5b7..29a7370f9802 100644 --- a/editeng/inc/editeng/udlnitem.hxx +++ b/editeng/inc/editeng/udlnitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,7 +54,7 @@ public: SvxTextLineItem( const FontUnderline eSt, const sal_uInt16 nId ); - // "pure virtual Methoden" vom SfxPoolItem + // "pure virtual Methods" from SfxPoolItem virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, @@ -65,12 +66,10 @@ public: virtual String GetValueTextByPos( sal_uInt16 nPos ) const; virtual sal_uInt16 GetValueCount() const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, - sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, - sal_uInt8 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 ); - // MS VC4.0 kommt durcheinander + // MS VC4.0 messes things up void SetValue( sal_uInt16 nNewVal ) {SfxEnumItem::SetValue(nNewVal); } virtual int HasBoolValue() const; @@ -131,3 +130,5 @@ public: }; #endif // #ifndef _SVX_UDLNITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/ulspitem.hxx b/editeng/inc/editeng/ulspitem.hxx index adccf0c45d34..7a91db0d4b32 100644 --- a/editeng/inc/editeng/ulspitem.hxx +++ b/editeng/inc/editeng/ulspitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,18 +40,18 @@ 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 ((sal_uInt16)0x0001) class EDITENG_DLLPUBLIC SvxULSpaceItem : public SfxPoolItem { - sal_uInt16 nUpper; //Oberer Rand - sal_uInt16 nLower; //Unterer Rand - sal_uInt16 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(); @@ -59,11 +60,11 @@ public: 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 sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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,8 +75,8 @@ public: virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; - virtual int ScaleMetrics( long nMult, long nDiv ); - virtual int HasMetrics() 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 ); @@ -111,3 +112,4 @@ inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nPro #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unoedhlp.hxx b/editeng/inc/editeng/unoedhlp.hxx index 5d140f90492c..681043f48a86 100644 --- a/editeng/inc/editeng/unoedhlp.hxx +++ b/editeng/inc/editeng/unoedhlp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -187,3 +188,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unoedprx.hxx b/editeng/inc/editeng/unoedprx.hxx index c4de3037eb30..4dde5a9688b5 100644 --- a/editeng/inc/editeng/unoedprx.hxx +++ b/editeng/inc/editeng/unoedprx.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -177,3 +178,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unoedsrc.hxx b/editeng/inc/editeng/unoedsrc.hxx index 8ce3016fa7c4..b522155264cc 100644 --- a/editeng/inc/editeng/unoedsrc.hxx +++ b/editeng/inc/editeng/unoedsrc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,9 +37,7 @@ #include <tools/gen.hxx> #include <vcl/mapmod.hxx> #include <tools/string.hxx> -#ifndef _SV_COLOR_HXX //autogen #include <tools/color.hxx> -#endif #include <svl/poolitem.hxx> #include <svl/itempool.hxx> #include "editeng/editengdllapi.h" @@ -550,3 +549,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unofdesc.hxx b/editeng/inc/editeng/unofdesc.hxx index 3bf7cf2ae04a..8a4af581a4f8 100644 --- a/editeng/inc/editeng/unofdesc.hxx +++ b/editeng/inc/editeng/unofdesc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,3 +53,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unofield.hxx b/editeng/inc/editeng/unofield.hxx index 789c5fcecd56..2c53fb7db499 100644 --- a/editeng/inc/editeng/unofield.hxx +++ b/editeng/inc/editeng/unofield.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -86,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; } @@ -135,3 +136,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unofored.hxx b/editeng/inc/editeng/unofored.hxx index f13f9c4f8a2c..2daa4d8a2bd8 100644 --- a/editeng/inc/editeng/unofored.hxx +++ b/editeng/inc/editeng/unofored.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,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 { @@ -98,3 +99,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unoforou.hxx b/editeng/inc/editeng/unoforou.hxx index 63e48e7ac189..f5987d23edbc 100644 --- a/editeng/inc/editeng/unoforou.hxx +++ b/editeng/inc/editeng/unoforou.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,7 +36,7 @@ class Outliner; -// SvxOutlinerForwarder - SvxTextForwarder fuer Outliner +// SvxOutlinerForwarder - SvxTextForwarder for Outliner class EDITENG_DLLPUBLIC SvxOutlinerForwarder : public SvxTextForwarder { @@ -127,3 +128,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unoipset.hxx b/editeng/inc/editeng/unoipset.hxx index 8a28df5cbe28..685d0aa39810 100644 --- a/editeng/inc/editeng/unoipset.hxx +++ b/editeng/inc/editeng/unoipset.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,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) @@ -45,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(); @@ -82,3 +84,4 @@ EDITENG_DLLPUBLIC void SvxUnoConvertFromMM( const SfxMapUnit eDestinationMapUnit #endif // _SVX_UNOIPSET_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unolingu.hxx b/editeng/inc/editeng/unolingu.hxx index c787bf368b8f..11ed370d9763 100644 --- a/editeng/inc/editeng/unolingu.hxx +++ b/editeng/inc/editeng/unolingu.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #include <i18npool/lang.h> #include <tools/string.hxx> -#include <vos/refernce.hxx> #include <com/sun/star/util/Language.hpp> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/linguistic2/XLinguServiceManager.hpp> @@ -74,8 +74,6 @@ class EDITENG_DLLPUBLIC LinguMgr { friend class LinguMgrExitLstnr; - //static ::VOS::ORefCount aRefCount; - static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr; static ::com::sun::star::uno::Reference< @@ -195,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< @@ -206,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< @@ -234,3 +232,4 @@ EDITENG_DLLPUBLIC short SvxDicError( Window *pParent, sal_Int16 nError ); +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unonrule.hxx b/editeng/inc/editeng/unonrule.hxx index c308dc2e52ba..34d3c99f719f 100644 --- a/editeng/inc/editeng/unonrule.hxx +++ b/editeng/inc/editeng/unonrule.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,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 ); @@ -93,3 +94,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unopracc.hxx b/editeng/inc/editeng/unopracc.hxx index 60cab861c95d..c1e57ed3944a 100644 --- a/editeng/inc/editeng/unopracc.hxx +++ b/editeng/inc/editeng/unopracc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,3 +72,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unoprnms.hxx b/editeng/inc/editeng/unoprnms.hxx index 8d8619479dbc..0cb2c09cb9c2 100644 --- a/editeng/inc/editeng/unoprnms.hxx +++ b/editeng/inc/editeng/unoprnms.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -257,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" @@ -356,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" @@ -369,8 +370,9 @@ #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 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unotext.hxx b/editeng/inc/editeng/unotext.hxx index 3ba7e12b492d..4fd80927518d 100644 --- a/editeng/inc/editeng/unotext.hxx +++ b/editeng/inc/editeng/unotext.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -55,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> @@ -172,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 @@ -255,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; @@ -370,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(); @@ -403,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(); @@ -538,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; @@ -627,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(); @@ -675,3 +669,5 @@ EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxTextPortionSvxPropertySet( EDITENG_DLLPUBLIC const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap(); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unoviwed.hxx b/editeng/inc/editeng/unoviwed.hxx index 0acdc6e769f4..3fdab4ad3750 100644 --- a/editeng/inc/editeng/unoviwed.hxx +++ b/editeng/inc/editeng/unoviwed.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -60,3 +61,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/unoviwou.hxx b/editeng/inc/editeng/unoviwou.hxx index 8821e812ebdc..6c54f9009460 100644 --- a/editeng/inc/editeng/unoviwou.hxx +++ b/editeng/inc/editeng/unoviwou.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -66,3 +67,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/wghtitem.hxx b/editeng/inc/editeng/wghtitem.hxx index 063c98d77059..8b9fddad5dd4 100644 --- a/editeng/inc/editeng/wghtitem.hxx +++ b/editeng/inc/editeng/wghtitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,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 @@ -54,7 +55,7 @@ public: SvxWeightItem( const FontWeight eWght /*= WEIGHT_NORMAL*/, 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, @@ -66,8 +67,8 @@ public: virtual String GetValueTextByPos( sal_uInt16 nPos ) const; virtual sal_uInt16 GetValueCount() const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 sal_Bool GetBoolValue() const; @@ -87,3 +88,4 @@ public: #endif // #ifndef _SVX_WGHTITEM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/widwitem.hxx b/editeng/inc/editeng/widwitem.hxx index 10cfbb9e6932..415035fd86a8 100644 --- a/editeng/inc/editeng/widwitem.hxx +++ b/editeng/inc/editeng/widwitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,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 @@ -53,7 +54,7 @@ public: 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 &, sal_uInt16 ) const; virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const; @@ -72,3 +73,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/writingmodeitem.hxx b/editeng/inc/editeng/writingmodeitem.hxx index 5caf33302f13..c9db4e153d33 100644 --- a/editeng/inc/editeng/writingmodeitem.hxx +++ b/editeng/inc/editeng/writingmodeitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,11 +59,10 @@ public: String &rText, const IntlWrapper * = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, - sal_uInt8 nMemberId ); - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, - sal_uInt8 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 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/wrlmitem.hxx b/editeng/inc/editeng/wrlmitem.hxx index e4eeeb59127e..4e31bbd0d507 100644 --- a/editeng/inc/editeng/wrlmitem.hxx +++ b/editeng/inc/editeng/wrlmitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,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 @@ -54,7 +55,7 @@ public: 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 &, sal_uInt16) const; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; @@ -73,3 +74,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editeng/xmlcnitm.hxx b/editeng/inc/editeng/xmlcnitm.hxx index 7c15d6aa24b6..805f6de1ac47 100644 --- a/editeng/inc/editeng/xmlcnitm.hxx +++ b/editeng/inc/editeng/xmlcnitm.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,8 +63,8 @@ public: virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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 ); } @@ -89,3 +90,4 @@ public: #endif // _SVX_XMLCNITM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/editxml.hxx b/editeng/inc/editxml.hxx index 4a69d5e856b5..54ece4b1ecf4 100644 --- a/editeng/inc/editxml.hxx +++ b/editeng/inc/editxml.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,3 +42,4 @@ extern void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelec #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/helpid.hrc b/editeng/inc/helpid.hrc index 6d6c4822b037..67fadef39bcf 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 diff --git a/editeng/inc/pch/precompiled_editeng.cxx b/editeng/inc/pch/precompiled_editeng.cxx index 1b18cce1697c..be7f2d61d5cc 100644 --- a/editeng/inc/pch/precompiled_editeng.cxx +++ b/editeng/inc/pch/precompiled_editeng.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,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 @@ -30,3 +28,4 @@ #include "precompiled_editeng.hxx" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/inc/pch/precompiled_editeng.hxx b/editeng/inc/pch/precompiled_editeng.hxx index 83f0ab6c54e8..57cd0397f306 100755..100644 --- a/editeng/inc/pch/precompiled_editeng.hxx +++ b/editeng/inc/pch/precompiled_editeng.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,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 @@ -671,6 +669,7 @@ #include "rtl/logfile.hxx" #include "rtl/math.hxx" #include "rtl/memory.h" +#include "rtl/ref.hxx" #include "rtl/tencinfo.h" #include "rtl/textenc.h" #include "rtl/ustrbuf.hxx" @@ -679,6 +678,7 @@ #include "sal/config.h" #include "sal/main.h" #include "sal/types.h" +#include <salhelper/simplereferenceobject.hxx> #include "svl/srchdefs.hxx" #include "sot/clsids.hxx" #include "sot/exchange.hxx" @@ -686,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" @@ -795,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" @@ -873,11 +872,6 @@ #include "vcl/unohelp2.hxx" #include "vcl/wall.hxx" #include "tools/wintypes.hxx" -#include "vos/mutex.hxx" -#include "vos/ref.hxx" -#include "vos/refernce.hxx" -#include "vos/thread.hxx" -#include "vos/xception.hxx" #include "xmloff/DashStyle.hxx" #include "xmloff/GradientStyle.hxx" #include "xmloff/HatchStyle.hxx" @@ -893,3 +887,4 @@ //---MARKER--- #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/prj/build.lst b/editeng/prj/build.lst index bba7f2666744..7d6afc7975c2 100644 --- a/editeng/prj/build.lst +++ b/editeng/prj/build.lst @@ -1,3 +1,2 @@ -ed editeng : L10N:l10n svtools xmloff linguistic NULL +ed editeng : TRANSLATIONS:translations svtools xmloff linguistic NULL ed editeng\prj nmake - all ed_prj NULL - diff --git a/editeng/prj/makefile.mk b/editeng/prj/makefile.mk index e312a7ccab65..e312a7ccab65 100644..100755 --- a/editeng/prj/makefile.mk +++ b/editeng/prj/makefile.mk diff --git a/editeng/qa/items/borderline_test.cxx b/editeng/qa/items/borderline_test.cxx new file mode 100644 index 000000000000..5d67b62f82f1 --- /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 3a5cd0c0885f..472ca07424c0 100644 --- a/editeng/source/accessibility/AccessibleComponentBase.cxx +++ b/editeng/source/accessibility/AccessibleComponentBase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -199,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 (); } @@ -208,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 (); } @@ -235,3 +236,5 @@ uno::Sequence<uno::Type> SAL_CALL } // end of namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx index e35626491cf9..2ca74c6cb2cd 100644 --- a/editeng/source/accessibility/AccessibleContextBase.cxx +++ b/editeng/source/accessibility/AccessibleContextBase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,9 +41,8 @@ #include <unotools/accessiblestatesethelper.hxx> #include <unotools/accessiblerelationsethelper.hxx> #include <comphelper/accessibleeventnotifier.hxx> -#include <rtl/uuid.h> -#include <vos/mutex.hxx> -//#include <vcl/svapp.hxx> +#include <comphelper/servicehelper.hxx> +#include <osl/mutex.hxx> #include <utility> @@ -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); } @@ -545,27 +545,18 @@ uno::Sequence< ::com::sun::star::uno::Type> return BaseClass::getTypes(); } - - +namespace +{ + class theAccessibleContextBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleContextBaseImplementationId > {}; +} uno::Sequence<sal_Int8> SAL_CALL AccessibleContextBase::getImplementationId (void) throw (::com::sun::star::uno::RuntimeException) { - ThrowIfDisposed (); - static uno::Sequence<sal_Int8> aId; - if (aId.getLength() == 0) - { - ::osl::MutexGuard aGuard (maMutex); - aId.realloc (16); - rtl_createUuid ((sal_uInt8 *)aId.getArray(), 0, sal_True); - } - return aId; + return theAccessibleContextBaseImplementationId::get().getSeq(); } - - - //===== internal ============================================================ void SAL_CALL AccessibleContextBase::disposing (void) @@ -638,7 +629,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 +638,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")); } @@ -713,3 +704,5 @@ void AccessibleContextBase::SetAccessibleRole( sal_Int16 _nRole ) } // end of namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index ee98fe0fa356..9a785af062ca 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,7 @@ #include <limits.h> #include <vector> #include <algorithm> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/window.hxx> #include <vcl/svapp.hxx> #include <editeng/flditem.hxx> @@ -114,7 +115,7 @@ namespace accessibility DBG_NAME( AccessibleEditableTextPara ) - // --> OD 2006-01-11 #i27138# - add parameter <_pParaManager> + // #i27138# - add parameter <_pParaManager> AccessibleEditableTextPara::AccessibleEditableTextPara( const uno::Reference< XAccessible >& rParent, const AccessibleParaManager* _pParaManager ) @@ -130,9 +131,8 @@ namespace accessibility // exceptions, thus no chance for exceptions once the Id is // fetched. Nevertheless, normally should employ RAII here... mnNotifierClientId(::comphelper::AccessibleEventNotifier::registerClient()), - // --> OD 2006-01-11 #i27138# + // #i27138# mpParaManager( _pParaManager ) - // <-- { #ifdef DBG_UTIL DBG_CTOR( AccessibleEditableTextPara, NULL ); @@ -845,7 +845,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return HaveChildren() ? 1 : 0; } @@ -854,7 +854,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( !HaveChildren() ) throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No childs available")), @@ -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; @@ -921,7 +921,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); -// ::vos::OGuard aGuard( Application::GetSolarMutex() ); +// SolarMutexGuard aGuard; return ::rtl::OUString(); } @@ -930,7 +930,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); -// ::vos::OGuard aGuard( Application::GetSolarMutex() ); +// SolarMutexGuard aGuard; return ::rtl::OUString(); } @@ -939,7 +939,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - // --> OD 2006-01-11 #i27138# - provide relations CONTENT_FLOWS_FROM + // #i27138# - provide relations CONTENT_FLOWS_FROM // and CONTENT_FLOWS_TO if ( mpParaManager ) { @@ -977,14 +977,13 @@ namespace accessibility // no relations, therefore empty return uno::Reference< XAccessibleRelationSet >(); } - // <-- } uno::Reference< XAccessibleStateSet > SAL_CALL AccessibleEditableTextPara::getAccessibleStateSet() throw (uno::RuntimeException) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // Create a copy of the state set and return it. ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); @@ -999,7 +998,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return implGetLocale(); } @@ -1025,7 +1024,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::contains: index value overflow"); @@ -1041,7 +1040,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( HaveChildren() ) { @@ -1076,7 +1075,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getBounds: index value overflow"); @@ -1102,7 +1101,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; awt::Rectangle aRect = getBounds(); @@ -1113,7 +1112,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // relate us to parent uno::Reference< XAccessible > xParent = getAccessibleParent(); @@ -1129,7 +1128,7 @@ namespace accessibility return aPoint; } - // --> OD 2009-12-16 #i88070# + // #i88070# // fallback to parent's <XAccessibleContext> instance else { @@ -1148,7 +1147,6 @@ namespace accessibility } } } - // <-- } throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot access parent")), @@ -1160,7 +1158,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; awt::Rectangle aRect = getBounds(); @@ -1203,7 +1201,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( !HaveEditView() ) return -1; @@ -1231,7 +1229,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getCharacter: index value overflow"); @@ -1242,7 +1240,7 @@ namespace accessibility uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rRequestedAttributes ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; CheckIndex(nIndex); // may throw IndexOutOfBoundsException @@ -1258,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; @@ -1306,7 +1286,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getCharacterBounds: index value overflow"); @@ -1341,7 +1321,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getCharacterCount: index value overflow"); @@ -1353,7 +1333,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_uInt16 nPara, nIndex; @@ -1400,7 +1380,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getSelectedText: index value overflow"); @@ -1415,7 +1395,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getSelectionStart: index value overflow"); @@ -1430,7 +1410,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getSelectionEnd: index value overflow"); @@ -1445,7 +1425,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::setSelection: paragraph index value overflow"); @@ -1467,7 +1447,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getText: paragraph index value overflow"); @@ -1479,7 +1459,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getTextRange: paragraph index value overflow"); @@ -1491,7 +1471,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getTextAtIndex: paragraph index value overflow"); @@ -1539,7 +1519,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getTextBeforeIndex: paragraph index value overflow"); @@ -1598,7 +1578,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getTextBehindIndex: paragraph index value overflow"); @@ -1641,7 +1621,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; try { @@ -1681,7 +1661,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; try { @@ -1711,7 +1691,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; try { @@ -1741,7 +1721,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; try { @@ -1774,7 +1754,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; try { @@ -1809,7 +1789,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; try { @@ -1844,7 +1824,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; try { @@ -1883,7 +1863,7 @@ namespace accessibility } catch( const uno::Exception& ) { - DBG_ERROR("AccessibleEditableTextPara::setAttributes exception in setPropertyValue"); + OSL_FAIL("AccessibleEditableTextPara::setAttributes exception in setPropertyValue"); } ++pPropArray; @@ -1904,7 +1884,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return replaceText(0, getCharacterCount(), sText); } @@ -1915,7 +1895,7 @@ namespace accessibility throw (uno::RuntimeException) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; #if OSL_DEBUG_LEVEL > 0 SvxAccessibleTextAdapter& rCacheTF = @@ -1983,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) @@ -2014,7 +1994,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; #if OSL_DEBUG_LEVEL > 0 SvxAccessibleTextAdapter& rCacheTF = @@ -2309,3 +2289,5 @@ namespace accessibility } // end of namespace accessibility //------------------------------------------------------------------------ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/accessibility/AccessibleHyperlink.cxx b/editeng/source/accessibility/AccessibleHyperlink.cxx index 853faf690c48..5e83fe7bfedb 100644 --- a/editeng/source/accessibility/AccessibleHyperlink.cxx +++ b/editeng/source/accessibility/AccessibleHyperlink.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,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 @@ -144,3 +142,5 @@ namespace accessibility } // end of namespace accessibility //------------------------------------------------------------------------ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/accessibility/AccessibleHyperlink.hxx b/editeng/source/accessibility/AccessibleHyperlink.hxx index c7067654c67f..e974358052d5 100644 --- a/editeng/source/accessibility/AccessibleHyperlink.hxx +++ b/editeng/source/accessibility/AccessibleHyperlink.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,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 @@ -80,3 +78,4 @@ namespace accessibility #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/accessibility/AccessibleImageBullet.cxx b/editeng/source/accessibility/AccessibleImageBullet.cxx index d9c727cc32fc..1a4bd5603307 100644 --- a/editeng/source/accessibility/AccessibleImageBullet.cxx +++ b/editeng/source/accessibility/AccessibleImageBullet.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_editeng.hxx" #include <tools/gen.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <rtl/ustring.hxx> #include <com/sun/star/awt/Point.hpp> @@ -167,7 +168,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleImageBullet, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // Get the string from the resource for the specified id. return ::rtl::OUString( String( EditResId (RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION) ) ); @@ -177,7 +178,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleImageBullet, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // Get the string from the resource for the specified id. return ::rtl::OUString( String ( EditResId (RID_SVXSTR_A11Y_IMAGEBULLET_NAME) ) ); @@ -195,7 +196,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleImageBullet, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // Create a copy of the state set and return it. ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); @@ -210,7 +211,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleImageBullet, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; lang::Locale aLocale; @@ -241,7 +242,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleImageBullet, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::contains: index value overflow"); @@ -265,7 +266,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleImageBullet, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getBounds: index value overflow"); @@ -304,7 +305,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleImageBullet, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; awt::Rectangle aRect = getBounds(); @@ -315,7 +316,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleImageBullet, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // relate us to parent uno::Reference< XAccessible > xParent = getAccessibleParent(); @@ -342,7 +343,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleImageBullet, NULL ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; awt::Rectangle aRect = getBounds(); @@ -649,3 +650,4 @@ namespace accessibility } // end of namespace accessibility +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/accessibility/AccessibleParaManager.cxx b/editeng/source/accessibility/AccessibleParaManager.cxx index d31721104aff..c0b95ef6b5a6 100644 --- a/editeng/source/accessibility/AccessibleParaManager.cxx +++ b/editeng/source/accessibility/AccessibleParaManager.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -195,9 +196,8 @@ namespace accessibility if( !IsReferencable( nParagraphIndex ) ) { // there is no hard reference available, create object then - // --> OD 2006-01-11 #i27138# + // #i27138# AccessibleEditableTextPara* pChild = new AccessibleEditableTextPara( xFrontEnd, this ); - // <-- uno::Reference< XAccessible > xChild( static_cast< ::cppu::OWeakObject* > (pChild), uno::UNO_QUERY ); if( !xChild.is() ) @@ -418,3 +418,5 @@ namespace accessibility } //------------------------------------------------------------------------ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/accessibility/AccessibleSelectionBase.cxx b/editeng/source/accessibility/AccessibleSelectionBase.cxx index 73fbb178d28c..c86d4fc23a74 100644 --- a/editeng/source/accessibility/AccessibleSelectionBase.cxx +++ b/editeng/source/accessibility/AccessibleSelectionBase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -106,3 +107,5 @@ namespace accessibility OCommonAccessibleSelection::deselectAccessibleChild( nSelectedChildIndex ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx index 555448ca4aeb..fe5bab90f099 100644 --- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx +++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,7 +39,7 @@ #include <vector> #include <algorithm> #include <boost/bind.hpp> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/window.hxx> #include <vcl/svapp.hxx> #include <comphelper/sequenceasvector.hxx> @@ -491,7 +492,7 @@ namespace accessibility AccessibleStaticTextBase::AccessibleStaticTextBase( ::std::auto_ptr< SvxEditSource > pEditSource ) : mpImpl( new AccessibleStaticTextBase_Impl() ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SetEditSource( pEditSource ); } @@ -641,7 +642,7 @@ namespace accessibility // XAccessibleText sal_Int32 SAL_CALL AccessibleStaticTextBase::getCaretPosition() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int32 i, nPos, nParas; for( i=0, nPos=-1, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i ) @@ -660,7 +661,7 @@ namespace accessibility sal_Unicode SAL_CALL AccessibleStaticTextBase::getCharacter( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; EPosition aPos( mpImpl->Index2Internal(nIndex) ); @@ -669,7 +670,7 @@ namespace accessibility uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleStaticTextBase::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; EPosition aPos( mpImpl->Index2Internal(nIndex) ); @@ -678,7 +679,7 @@ namespace accessibility awt::Rectangle SAL_CALL AccessibleStaticTextBase::getCharacterBounds( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // #108900# Allow ranges for nIndex, as one-past-the-end // values are now legal, too. @@ -696,7 +697,7 @@ namespace accessibility sal_Int32 SAL_CALL AccessibleStaticTextBase::getCharacterCount() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int32 i, nCount, nParas; for( i=0, nCount=0, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i ) @@ -707,7 +708,7 @@ namespace accessibility sal_Int32 SAL_CALL AccessibleStaticTextBase::getIndexAtPoint( const awt::Point& rPoint ) throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const sal_Int32 nParas( mpImpl->GetParagraphCount() ); sal_Int32 nIndex; @@ -735,7 +736,7 @@ namespace accessibility ::rtl::OUString SAL_CALL AccessibleStaticTextBase::getSelectedText() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int32 nStart( getSelectionStart() ); sal_Int32 nEnd( getSelectionEnd() ); @@ -749,7 +750,7 @@ namespace accessibility sal_Int32 SAL_CALL AccessibleStaticTextBase::getSelectionStart() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int32 i, nPos, nParas; for( i=0, nPos=-1, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i ) @@ -763,7 +764,7 @@ namespace accessibility sal_Int32 SAL_CALL AccessibleStaticTextBase::getSelectionEnd() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int32 i, nPos, nParas; for( i=0, nPos=-1, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i ) @@ -777,7 +778,7 @@ namespace accessibility sal_Bool SAL_CALL AccessibleStaticTextBase::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) ); EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) ); @@ -788,7 +789,7 @@ namespace accessibility ::rtl::OUString SAL_CALL AccessibleStaticTextBase::getText() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int32 i, nParas; ::rtl::OUString aRes; @@ -800,7 +801,7 @@ namespace accessibility ::rtl::OUString SAL_CALL AccessibleStaticTextBase::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( nStartIndex > nEndIndex ) ::std::swap(nStartIndex, nEndIndex); @@ -833,7 +834,7 @@ namespace accessibility ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleStaticTextBase::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; EPosition aPos( mpImpl->Range2Internal(nIndex) ); @@ -868,7 +869,7 @@ namespace accessibility ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleStaticTextBase::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; EPosition aPos( mpImpl->Range2Internal(nIndex) ); @@ -908,7 +909,7 @@ namespace accessibility ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleStaticTextBase::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; EPosition aPos( mpImpl->Range2Internal(nIndex) ); @@ -942,7 +943,7 @@ namespace accessibility sal_Bool SAL_CALL AccessibleStaticTextBase::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( nStartIndex > nEndIndex ) ::std::swap(nStartIndex, nEndIndex); @@ -959,7 +960,7 @@ namespace accessibility { // get the intersection of the default attributes of all paragraphs - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; PropertyValueVector aDefAttrVec( mpImpl->GetParagraph( 0 ).getDefaultAttributes( RequestedAttributes ) ); @@ -997,7 +998,7 @@ namespace accessibility // get those default attributes of the paragraph, which are not part // of the intersection of all paragraphs and add them to the run attributes - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; EPosition aPos( mpImpl->Index2Internal( nIndex ) ); AccessibleEditableTextPara& rPara = mpImpl->GetParagraph( aPos.nPara ); @@ -1045,3 +1046,5 @@ namespace accessibility } // end of namespace accessibility //------------------------------------------------------------------------ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/accessibility/AccessibleStringWrap.cxx b/editeng/source/accessibility/AccessibleStringWrap.cxx index c2fe557c5be8..b6eeb4ab1245 100644 --- a/editeng/source/accessibility/AccessibleStringWrap.cxx +++ b/editeng/source/accessibility/AccessibleStringWrap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -98,3 +99,5 @@ sal_Int32 AccessibleStringWrap::GetIndexAtPoint( const Point& rPoint ) return -1; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/accessibility/accessibility.src b/editeng/source/accessibility/accessibility.src index 430af128e58e..a02b29212290 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/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx index 584d3d6904d1..39051f2af181 100644 --- a/editeng/source/editeng/editattr.cxx +++ b/editeng/source/editeng/editattr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_editeng.hxx" -//#include <eeng_pch.hxx> #include <vcl/wrkwin.hxx> #include <vcl/dialog.hxx> #include <vcl/msgbox.hxx> @@ -99,7 +99,7 @@ void EditCharAttrib::SetFont( SvxFont&, OutputDevice* ) 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* ) @@ -118,7 +118,7 @@ void EditCharAttribFont::SetFont( SvxFont& rFont, OutputDevice* ) 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* ) @@ -132,7 +132,7 @@ void EditCharAttribItalic::SetFont( SvxFont& rFont, OutputDevice* ) 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* ) @@ -146,7 +146,7 @@ void EditCharAttribWeight::SetFont( SvxFont& rFont, OutputDevice* ) 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 ) @@ -162,7 +162,7 @@ void EditCharAttribUnderline::SetFont( SvxFont& rFont, OutputDevice* pOutDev ) 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 ) @@ -178,12 +178,12 @@ void EditCharAttribOverline::SetFont( SvxFont& rFont, OutputDevice* pOutDev ) 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() ) ); } @@ -193,7 +193,7 @@ void EditCharAttribFontHeight::SetFont( SvxFont& rFont, OutputDevice* ) 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* ) @@ -207,7 +207,7 @@ void EditCharAttribFontWidth::SetFont( SvxFont& /*rFont*/, OutputDevice* ) 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* ) @@ -221,7 +221,7 @@ void EditCharAttribStrikeout::SetFont( SvxFont& rFont, OutputDevice* ) 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* ) @@ -235,7 +235,7 @@ void EditCharAttribColor::SetFont( SvxFont& rFont, OutputDevice* ) 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* ) @@ -249,7 +249,7 @@ void EditCharAttribLanguage::SetFont( SvxFont& rFont, OutputDevice* ) 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* ) @@ -263,7 +263,7 @@ void EditCharAttribShadow::SetFont( SvxFont& rFont, OutputDevice* ) 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!" ); } void EditCharAttribEscapement::SetFont( SvxFont& rFont, OutputDevice* ) @@ -285,7 +285,7 @@ void EditCharAttribEscapement::SetFont( SvxFont& rFont, OutputDevice* ) 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* ) @@ -345,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; } @@ -380,7 +379,7 @@ sal_Bool EditCharAttribField::operator == ( const EditCharAttribField& rAttr ) c 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* ) @@ -394,7 +393,7 @@ void EditCharAttribPairKerning::SetFont( SvxFont& rFont, OutputDevice* ) 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* ) @@ -408,7 +407,7 @@ void EditCharAttribKerning::SetFont( SvxFont& rFont, OutputDevice* ) 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* ) @@ -422,7 +421,7 @@ void EditCharAttribWordLineMode::SetFont( SvxFont& rFont, OutputDevice* ) 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* ) @@ -443,3 +442,5 @@ void EditCharAttribRelief::SetFont( SvxFont& rFont, OutputDevice* ) { rFont.SetRelief( (FontRelief)((const SvxCharReliefItem*)GetItem())->GetValue() ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editattr.hxx b/editeng/source/editeng/editattr.hxx index 3a4cd427d8eb..2d4cc9602ad5 100644 --- a/editeng/source/editeng/editattr.hxx +++ b/editeng/source/editeng/editattr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,12 +60,12 @@ class SfxVoidItem; #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 @@ -80,18 +81,18 @@ protected: virtual ~EditAttrib(); public: - // RemoveFromPool muss immer vorm DTOR Aufruf erfolgen!! + // RemoveFromPool must always be called before the destructor!! void RemoveFromPool( SfxItemPool& rPool ); 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: @@ -157,18 +158,18 @@ inline void EditCharAttrib::MoveBackward( sal_uInt16 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( 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 @@ -424,3 +425,5 @@ public: #endif // _EDITATTR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index c98472b2b279..5286318f53eb 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -328,28 +329,28 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_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 ( 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:" ); + fprintf( fp, "\nParagraph attribute:" ); DbgOutItemSet( fp, pPPortion->GetNode()->GetContentAttribs().GetItems(), sal_False, sal_False ); - fprintf( fp, "\nZeichenattribute:" ); + fprintf( fp, "\nCharacter attribute:" ); sal_Bool bZeroAttr = sal_False; sal_uInt16 z; for ( z = 0; z < pPPortion->GetNode()->GetCharAttribs().Count(); z++ ) @@ -375,11 +376,11 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_Bool bInfoBox ) fprintf( fp, "\nNULL-Attribute!" ); sal_uInt16 nTextPortions = pPPortion->GetTextPortions().Count(); - ByteString aPortionStr("\nTextportions: #"); + 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 ); @@ -401,29 +402,29 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_Bool bInfoBox ) } 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... + 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-----------------------------------------------------------------------------" ); @@ -435,12 +436,12 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_Bool bInfoBox ) 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(), sal_False, sal_False ); @@ -450,12 +451,12 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_Bool bInfoBox ) } } - fprintf( fp, "\n\n================================================================================" ); + fprintf( fp, "\n\n================================================================================" ); fprintf( fp, "\n================== Defaults ================================================" ); fprintf( fp, "\n================================================================================" ); 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() ); @@ -464,23 +465,23 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_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() ); + 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(), sal_True, sal_False ); } @@ -493,10 +494,10 @@ ByteString EditDbg::GetPortionInfo( ParaPortion* pPPortion ) { 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 ); @@ -508,7 +509,7 @@ ByteString EditDbg::GetPortionInfo( ParaPortion* pPPortion ) aDebStr += ByteString::CreateFromInt32( pAttr->GetEnd() ); } - aDebStr += "\nTextportions:"; + aDebStr += "\nText portions:"; sal_uInt16 n = 0; for ( z = 0; z < pPPortion->GetTextPortions().Count(); z++ ) { @@ -521,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:"; + 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; @@ -560,7 +561,7 @@ void EditDbg::ShowPortionData( ParaPortion* pPortion ) sal_Bool ParaPortion::DbgCheckTextPortions() { - // pruefen, ob Portionlaenge ok: + // check, if Portion length ok: sal_uInt16 nXLen = 0; for ( sal_uInt16 nPortion = 0; nPortion < aTextPortionList.Count(); nPortion++ ) nXLen = nXLen + aTextPortionList[nPortion]->GetLen(); @@ -584,3 +585,4 @@ sal_Bool CheckOrderedList( CharAttribArray& rAttribs, sal_Bool bStart ) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editdbg.hxx b/editeng/source/editeng/editdbg.hxx index ebaa60bd1306..e8e2e1f6385c 100644 --- a/editeng/source/editeng/editdbg.hxx +++ b/editeng/source/editeng/editdbg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -55,3 +56,5 @@ public: #endif // _EDITDBG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index c19bf969abbe..82f49c24d733 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -160,8 +161,8 @@ sal_Bool IsScriptItemValid( sal_uInt16 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 ); @@ -178,13 +179,15 @@ SfxItemInfo aItemInfos[EDITITEMCOUNT] = { { 0, SFX_ITEM_POOLABLE }, // EE_PARA_HYPHENATE { 0, SFX_ITEM_POOLABLE }, // EE_PARA_BULLETSTATE { 0, SFX_ITEM_POOLABLE }, // EE_PARA_OUTLLRSPACE - { SID_ATTR_PARA_OUTLLEVEL, SFX_ITEM_POOLABLE }, - { SID_ATTR_PARA_BULLET, SFX_ITEM_POOLABLE }, - { SID_ATTR_LRSPACE, SFX_ITEM_POOLABLE }, - { SID_ATTR_ULSPACE, SFX_ITEM_POOLABLE }, - { SID_ATTR_PARA_LINESPACE, SFX_ITEM_POOLABLE }, - { SID_ATTR_PARA_ADJUST, SFX_ITEM_POOLABLE }, - { SID_ATTR_TABSTOP, SFX_ITEM_POOLABLE }, + { SID_ATTR_PARA_OUTLLEVEL, SFX_ITEM_POOLABLE }, // EE_PARA_OUTLLEVEL + { SID_ATTR_PARA_BULLET, SFX_ITEM_POOLABLE }, // EE_PARA_BULLET + { SID_ATTR_LRSPACE, SFX_ITEM_POOLABLE }, // EE_PARA_LRSPACE + { SID_ATTR_ULSPACE, SFX_ITEM_POOLABLE }, // EE_PARA_ULSPACE + { SID_ATTR_PARA_LINESPACE, SFX_ITEM_POOLABLE }, // EE_PARA_SBL + { SID_ATTR_PARA_ADJUST, SFX_ITEM_POOLABLE }, // EE_PARA_JUST + { SID_ATTR_TABSTOP, SFX_ITEM_POOLABLE }, // EE_PARA_TABS + { SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD, SFX_ITEM_POOLABLE }, // EE_PARA_JUST_METHOD + { SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEM_POOLABLE }, // EE_PARA_VER_JUST { SID_ATTR_CHAR_COLOR, SFX_ITEM_POOLABLE }, { SID_ATTR_CHAR_FONT, SFX_ITEM_POOLABLE }, { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEM_POOLABLE }, @@ -267,7 +270,7 @@ int SAL_CALL CompareStart( const void* pFirst, const void* pSecond ) 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; @@ -375,7 +378,7 @@ EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sa 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: @@ -395,22 +398,19 @@ EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sa 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; @@ -507,7 +507,7 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion ) sal_uInt16 nIndex = GetStart(); - DBG_ASSERT( rParaPortion.GetTextPortions().Count(), "GetTextSize vor CreatePortions !" ); + DBG_ASSERT( rParaPortion.GetTextPortions().Count(), "GetTextSize before CreatePortions !" ); for ( sal_uInt16 n = nStartPortion; n <= nEndPortion; n++ ) { @@ -525,7 +525,6 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion ) } break; case PORTIONKIND_TAB: -// case PORTIONKIND_EXTRASPACE: { aSz.Width() += pPortion->GetSize().Width(); } @@ -538,9 +537,6 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion ) return aSz; } -// ------------------------------------------------------------------------- -// class EditLineList -// ------------------------------------------------------------------------- EditLineList::EditLineList() { } @@ -577,13 +573,10 @@ sal_uInt16 EditLineList::FindLine( sal_uInt16 nChar, sal_Bool bInclEnd ) } } - DBG_ASSERT( !bInclEnd, "Zeile nicht gefunden: FindLine" ); + DBG_ASSERT( !bInclEnd, "Line not found: FindLine" ); return ( Count() - 1 ); } -// ------------------------------------------------------------------------- -// class EditSelection -// ------------------------------------------------------------------------- sal_Bool EditPaM::DbgIsBuggy( EditDoc& rDoc ) { if ( !pNode ) @@ -612,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; } @@ -647,8 +640,8 @@ sal_Bool EditSelection::IsInvalid() const 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(); @@ -656,8 +649,8 @@ sal_Bool EditSelection::Adjust( const ContentList& rNodes ) 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)" ); sal_Bool bSwap = sal_False; if ( nStartNode > nEndNode ) @@ -675,10 +668,6 @@ sal_Bool EditSelection::Adjust( const ContentList& rNodes ) return bSwap; } - -// ------------------------------------------------------------------------- -// class EditPaM -// ------------------------------------------------------------------------- sal_Bool operator == ( const EditPaM& r1, const EditPaM& r2 ) { if ( r1.GetNode() != r2.GetNode() ) @@ -702,10 +691,6 @@ 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 ); @@ -722,9 +707,7 @@ ContentNode::ContentNode( const XubString& rStr, const ContentAttribs& rContentA ContentNode::~ContentNode() { DBG_DTOR( EE_ContentNode, 0 ); -#ifndef SVX_LIGHT delete pWrongList; -#endif } void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool& rItemPool ) @@ -732,14 +715,12 @@ void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool 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. + // 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; @@ -749,29 +730,30 @@ void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool { 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 = 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 ) ) { @@ -781,13 +763,13 @@ void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool else 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() ) @@ -835,11 +817,11 @@ void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool 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?" ); + OSL_FAIL( "Empty Attribute after ExpandAttribs?" ); bResort = sal_True; aCharAttribList.GetAttribs().Remove( nAttr ); rItemPool.Remove( *pAttrib->GetItem() ); @@ -853,16 +835,14 @@ void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool if ( bResort ) aCharAttribList.ResortAttribs(); -#ifndef SVX_LIGHT if ( pWrongList ) { sal_Bool bSep = ( GetChar( nIndex ) == ' ' ) || IsFeature( nIndex ); pWrongList->TextInserted( nIndex, nNew, bSep ); } -#endif // !SVX_LIGHT #ifdef EDITDEBUG - DBG_ASSERT( CheckOrderedList( aCharAttribList.GetAttribs(), sal_True ), "Expand: Start-Liste verdreht" ); + DBG_ASSERT( CheckOrderedList( aCharAttribList.GetAttribs(), sal_True ), "Expand: Start List distorted" ); #endif } @@ -871,8 +851,8 @@ void ContentNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted, SfxIte if ( !nDeleted ) return; - // Da Features anders behandelt werden als normale Zeichenattribute, - // kann sich hier auch die Sortierung der Start-Liste aendern! + // 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; @@ -884,34 +864,34 @@ void ContentNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted, SfxIte 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 = 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 ); @@ -926,9 +906,9 @@ void ContentNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted, SfxIte } 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 = sal_True; aCharAttribList.GetAttribs().Remove( nAttr ); @@ -946,19 +926,17 @@ void ContentNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted, SfxIte if ( bResort ) aCharAttribList.ResortAttribs(); -#ifndef SVX_LIGHT if ( pWrongList ) pWrongList->TextDeleted( nIndex, nDeleted ); -#endif // !SVX_LIGHT #ifdef EDITDEBUG - DBG_ASSERT( CheckOrderedList( aCharAttribList.GetAttribs(), sal_True ), "Collaps: Start-Liste verdreht" ); + DBG_ASSERT( CheckOrderedList( aCharAttribList.GetAttribs(), sal_True ), "Collaps: Start list distorted" ); #endif } 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(); @@ -968,32 +946,31 @@ void ContentNode::CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, { 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 ); @@ -1010,23 +987,23 @@ 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?" ); sal_uInt16 nNewStart = Len(); #ifdef EDITDEBUG - DBG_ASSERT( aCharAttribList.DbgCheckAttribs(), "Attribute VOR AppendAttribs kaputt" ); + DBG_ASSERT( aCharAttribList.DbgCheckAttribs(), "Attribute before AppendAttribs broken" ); #endif sal_uInt16 nAttr = 0; EditCharAttrib* pAttrib = GetAttrib( pNextNode->GetCharAttribs().GetAttribs(), nAttr ); while ( pAttrib ) { - // alle Attribute verschieben in den aktuellen Node (this) + // Move all attributes in the current node (this) sal_Bool bMelted = sal_False; if ( ( pAttrib->GetStart() == 0 ) && ( !pAttrib->IsFeature() ) ) { - // Evtl koennen Attribute zusammengefasst werden: + // Attributes can possibly be summarized as: sal_uInt16 nTmpAttr = 0; EditCharAttrib* pTmpAttrib = GetAttrib( aCharAttribList.GetAttribs(), nTmpAttr ); while ( !bMelted && pTmpAttrib ) @@ -1039,7 +1016,7 @@ 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 = sal_True; } @@ -1058,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 ); } @@ -1082,9 +1059,10 @@ void ContentNode::SetStyleSheet( SfxStyleSheet* pS, const SvxFont& rFontFromStyl { 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 ); } @@ -1098,29 +1076,22 @@ void ContentNode::SetStyleSheet( SfxStyleSheet* pS, sal_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!" ); + DBG_ASSERT( !pWrongList, "WrongList already exist!" ); pWrongList = p; } -// ------------------------------------------------------------------------- -// class ContentAttribs -// ------------------------------------------------------------------------- ContentAttribs::ContentAttribs( SfxItemPool& rPool ) : aAttribSet( rPool, EE_PARA_START, EE_CHAR_END ) { @@ -1147,7 +1118,7 @@ SvxTabStop ContentAttribs::FindTabStop( long nCurPos, sal_uInt16 nDefTab ) return rTab; } - // DefTab ermitteln... + // Determine DefTab ... SvxTabStop aTabStop; long x = nCurPos / nDefTab + 1; aTabStop.GetTabPos() = nDefTab * x; @@ -1158,15 +1129,16 @@ void ContentAttribs::SetStyleSheet( SfxStyleSheet* 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 ( 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 ); } @@ -1175,7 +1147,7 @@ void ContentAttribs::SetStyleSheet( SfxStyleSheet* pS ) const SfxPoolItem& ContentAttribs::GetItem( sal_uInt16 nWhich ) { - // Harte Absatzattribute haben Vorrang! + // Hard paragraph attributes take precedence! SfxItemSet* pTakeFrom = &aAttribSet; if ( pStyle && ( aAttribSet.GetItemState( nWhich, sal_False ) != SFX_ITEM_ON ) ) pTakeFrom = &pStyle->GetItemSet(); @@ -1195,22 +1167,41 @@ sal_Bool ContentAttribs::HasItem( sal_uInt16 nWhich ) } +ItemList::ItemList() : CurrentItem( 0 ) +{ +} -// ---------------------------------------------------------------------- -// class ItemList -// ---------------------------------------------------------------------- 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 ]; +} + +const SfxPoolItem* ItemList::Next() +{ + if ( CurrentItem + 1 < aItemPool.size() ) + { + ++CurrentItem; + return aItemPool[ CurrentItem ]; + } + return NULL; } -// ------------------------------------------------------------------------- -// class EditDoc -// ------------------------------------------------------------------------- +void ItemList::Insert( const SfxPoolItem* pItem ) +{ + aItemPool.push_back( pItem ); + CurrentItem = aItemPool.size() - 1; +} + + EditDoc::EditDoc( SfxItemPool* pPool ) { if ( pPool ) @@ -1321,12 +1312,12 @@ 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( sal_Bool bUseStyles ) @@ -1373,7 +1364,7 @@ XubString EditDoc::GetText( LineEnd eEnd ) const 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]; @@ -1406,7 +1397,7 @@ XubString EditDoc::GetParaAsString( ContentNode* pNode, sal_uInt16 nStartPos, sa if ( nEndPos > pNode->Len() ) nEndPos = pNode->Len(); - DBG_ASSERT( nStartPos <= nEndPos, "Start und Ende vertauscht?" ); + DBG_ASSERT( nStartPos <= nEndPos, "Start and End reversed?" ); sal_uInt16 nIndex = nStartPos; XubString aStr; @@ -1417,9 +1408,9 @@ XubString EditDoc::GetParaAsString( ContentNode* pNode, sal_uInt16 nStartPos, sa 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?" ); + 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) @@ -1436,7 +1427,7 @@ XubString EditDoc::GetParaAsString( ContentNode* pNode, sal_uInt16 nStartPos, sa 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,7 +1443,7 @@ sal_uLong EditDoc::GetTextLen() const { 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 ( sal_uInt16 nAttr = rAttrs.Count(); nAttr; ) { @@ -1496,7 +1487,7 @@ void EditDoc::SetModified( sal_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() ); @@ -1519,9 +1510,9 @@ 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() ); @@ -1531,9 +1522,9 @@ void EditDoc::InsertText( const EditPaM& rPaM, xub_Unicode c ) 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() ); @@ -1559,10 +1550,10 @@ EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs ) // for a new paragraph we like to have the bullet/numbering visible by default 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 ) @@ -1575,7 +1566,7 @@ EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, sal_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 ); @@ -1594,9 +1585,9 @@ 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( sal_True ); @@ -1609,12 +1600,12 @@ 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 ); sal_uInt16 nRight = GetPos( pRight ); Remove( nRight ); @@ -1627,7 +1618,7 @@ EditPaM EditDoc::ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight ) 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() ); @@ -1638,16 +1629,16 @@ EditPaM EditDoc::RemoveChars( EditPaM aPaM, sal_uInt16 nChars ) 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() ); @@ -1655,7 +1646,7 @@ void EditDoc::InsertAttribInSelection( ContentNode* pNode, sal_uInt16 nStart, sa ( *(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 ) ); @@ -1683,65 +1674,62 @@ sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt 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; 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... + // iterate over the attributes ... sal_uInt16 nAttr = 0; EditCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); while ( pAttr ) { sal_Bool bRemoveAttrib = sal_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 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 = 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 + // 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 = 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 + // 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 = sal_True; @@ -1750,29 +1738,29 @@ sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt 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 ... { 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() ); @@ -1796,11 +1784,10 @@ sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt 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( sal_True ); @@ -1814,24 +1801,22 @@ void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nE } 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 ! - // ??????????????????????????????? + // check again if really splitting, or return ! sal_uInt16 nOldEnd = pAttr->GetEnd(); pAttr->GetEnd() = nStart; pAttr = MakeCharAttrib( GetItemPool(), *(pAttr->GetItem()), nStart, nOldEnd ); @@ -1839,8 +1824,8 @@ void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nE } 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; } @@ -1853,35 +1838,35 @@ void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nE 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!" ); 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(); } @@ -1905,41 +1890,33 @@ void EditDoc::FindAttribs( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 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() ); } @@ -1966,10 +1943,6 @@ void EditDoc::FindAttribs( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 } -// ------------------------------------------------------------------------- -// class EditCharAttribList -// ------------------------------------------------------------------------- - CharAttribList::CharAttribList() { DBG_CTOR( EE_CharAttribList, 0 ); @@ -1994,18 +1967,16 @@ 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 sal_uInt16 nCount = Count(); - const sal_uInt16 nStart = pAttrib->GetStart(); // vielleicht besser fuer Comp.Opt. + const sal_uInt16 nStart = pAttrib->GetStart(); // may be better for Comp.Opt. if ( pAttrib->IsEmpty() ) bHasEmptyAttribs = sal_True; @@ -2068,8 +2039,8 @@ void CharAttribList::OptimizeRanges( SfxItemPool& rItemPool ) EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) { - // Rueckwaerts, falls eins dort endet, das naechste startet. - // => Das startende gilt... + // 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 ) @@ -2120,8 +2091,8 @@ sal_Bool CharAttribList::HasAttrib( sal_uInt16 nStartPos, sal_uInt16 nEndPos ) c sal_Bool CharAttribList::HasBoundingAttrib( sal_uInt16 nBound ) { - // Rueckwaerts, falls eins dort endet, das naechste startet. - // => Das startende gilt... + // 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 ) ) @@ -2155,14 +2126,14 @@ EditCharAttrib* CharAttribList::FindFeature( sal_uInt16 nPos ) const 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++; @@ -2199,12 +2170,12 @@ sal_Bool CharAttribList::DbgCheckAttribs() if ( pAttr->GetStart() > pAttr->GetEnd() ) { bOK = sal_False; - DBG_ERROR( "Attr verdreht" ); + OSL_FAIL( "Attribute is distorted" ); } else if ( pAttr->IsFeature() && ( pAttr->GetLen() != 1 ) ) { bOK = sal_False; - DBG_ERROR( "Feature, Len != 1" ); + OSL_FAIL( "Feature, Len != 1" ); } } return bOK; @@ -2238,7 +2209,7 @@ sal_uLong SvxFontTable::GetId( const SvxFontItem& rFontItem ) return GetCurKey(); pItem = Next(); } - DBG_WARNING( "Font nicht gefunden: GetId()" ); + DBG_WARNING( "Font not found: GetId()" ); return 0; } @@ -2248,25 +2219,37 @@ 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(); } -sal_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 ); + } + else + { + DummyColorList::iterator it = aColorList.begin(); + ::std::advance( it, nIndex ); + aColorList.insert( it, pItem ); } - DBG_WARNING( "Color nicht gefunden: GetId()" ); - return 0; +} + +SvxColorItem* SvxColorList::GetObject( size_t nIndex ) +{ + return ( nIndex >= aColorList.size() ) ? NULL : aColorList[ nIndex ]; } EditEngineItemPool::EditEngineItemPool( sal_Bool bPersistenRefCounts ) @@ -2279,8 +2262,7 @@ EditEngineItemPool::EditEngineItemPool( sal_Bool bPersistenRefCounts ) SetVersionMap( 4, 3994, 4022, aV4Map ); SetVersionMap( 5, 3994, 4037, aV5Map ); - DBG_ASSERT( EE_DLL(), "EditDLL?!" ); - SfxPoolItem** ppDefItems = EE_DLL()->GetGlobalData()->GetDefItems(); + SfxPoolItem** ppDefItems = EE_DLL().GetGlobalData()->GetDefItems(); SetDefaults( ppDefItems ); } @@ -2290,11 +2272,11 @@ 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(); sal_Bool b31Format = ( nVersion && ( nVersion <= SOFFICE_FILEFORMAT_31 ) ) @@ -2308,3 +2290,5 @@ SvStream& EditEngineItemPool::Store( SvStream& rStream ) const return SfxItemPool::Store( rStream ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 784ac4c864ef..ee2be03d7a6c 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #ifndef _EDITDOC_HXX #define _EDITDOC_HXX -#ifndef _COM_SUN_STAR_I18N_XEXTENDEDINPUTSEQUENCECHECKER_HDL_ #include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp> -#endif #include <editattr.hxx> #include <edtspell.hxx> @@ -39,6 +38,7 @@ #include <svl/style.hxx> #include <svl/itempool.hxx> #include <tools/table.hxx> +#include <vector> #include <deque> @@ -142,6 +142,7 @@ SV_DECL_PTRARR( ContentInfoArray, ContentAttribsInfoPtr, 1, 1 ) // class SvxFontTable // ---------------------------------------------------------------------- DECLARE_TABLE( DummyFontTable, SvxFontItem* ) + class SvxFontTable : public DummyFontTable { public: @@ -155,25 +156,43 @@ public: // 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(); - sal_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: + 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(); }; }; // ------------------------------------------------------------------------- @@ -188,7 +207,7 @@ private: public: ContentAttribs( SfxItemPool& rItemPool ); ContentAttribs( const ContentAttribs& ); - ~ContentAttribs(); // erst bei umfangreicheren Tabs + ~ContentAttribs(); // only for larger Tabs SvxTabStop FindTabStop( long nCurPos, sal_uInt16 nDefTab ); SfxItemSet& GetItems() { return aAttribSet; } @@ -206,8 +225,8 @@ class CharAttribList { private: CharAttribArray aAttribs; - SvxFont aDefFont; // schneller, als jedesmal vom Pool! - sal_Bool bHasEmptyAttribs; + SvxFont aDefFont; // faster than ever from the pool! + sal_Bool bHasEmptyAttribs; CharAttribList( const CharAttribList& ) {;} @@ -330,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 @@ -449,16 +467,16 @@ private: CharPosArray aPositions; long nTxtWidth; sal_uInt16 nStartPosX; - sal_uInt16 nStart; // koennte durch nStartPortion ersetzt werden - sal_uInt16 nEnd; // koennte durch nEndPortion ersetzt werden + 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; // Gesamthoehe der Zeile - sal_uInt16 nTxtHeight; // Reine Texthoehe - sal_uInt16 nCrsrHeight; // Bei Konturfluss hohe Zeilen => Cursor zu gro�. + 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; // fuer geschickte Formatierung + sal_Bool bInvalid; // for skillful formatting public: EditLine(); @@ -551,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; @@ -562,13 +580,13 @@ private: WritingDirectionInfos aWritingDirectionInfos; sal_uInt16 nInvalidPosStart; - sal_uInt16 nFirstLineOffset; // Fuer Writer-LineSpacing-Interpretation + sal_uInt16 nFirstLineOffset; // For Writer-LineSpacing-Interpretation sal_uInt16 nBulletX; - short nInvalidDiff; + short nInvalidDiff; sal_Bool bInvalid : 1; - sal_Bool bSimple : 1; // nur lineares Tippen - sal_Bool bVisible : 1; // MT 05/00: Gehoert an den Node!!! + sal_Bool bSimple : 1; // only linear Tap + sal_Bool bVisible : 1; // Belongs to the node! sal_Bool bForceRepaint : 1; ParaPortion( const ParaPortion& ); @@ -597,6 +615,8 @@ public: void SetVisible( sal_Bool bVisible ); sal_Bool IsVisible() { return bVisible; } + sal_Bool IsEmpty() { return GetTextPortions().Count() == 1 && GetTextPortions()[0]->GetLen() == 0; } + long GetHeight() const { return ( bVisible ? nHeight : 0 ); } sal_uInt16 GetFirstLineOffset() const { return ( bVisible ? nFirstLineOffset : 0 ); } void ResetHeight() { nHeight = 0; nFirstLineOffset = 0; } @@ -634,7 +654,7 @@ public: sal_uInt16 GetPos( const ParaPortionPtr &rPtr ) const; - // temporaer: + // temporary: void DbgCheck( EditDoc& rDoc ); }; @@ -648,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 ); @@ -701,7 +722,7 @@ private: SfxItemPool* pItemPool; Link aModifyHdl; - SvxFont aDefFont; //schneller, als jedesmal vom Pool! + SvxFont aDefFont; //faster than ever from the pool!! sal_uInt16 nDefTab; sal_Bool bIsVertical; sal_Bool bIsFixedCellHeight; @@ -803,3 +824,5 @@ public: }; #endif // _EDITDOC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editdoc2.cxx b/editeng/source/editeng/editdoc2.cxx index 20b13778a025..8eee45722ef5 100644 --- a/editeng/source/editeng/editdoc2.cxx +++ b/editeng/source/editeng/editdoc2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,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 ); -/* -sal_Bool EditStyleSheet::HasStyleAsAnyParent( SfxStyleSheet& rStyle ) -{ - if ( GetParent() == rStyle.GetName() ) - return sal_True; - - if ( GetParent().Len() && ( GetParent() != GetName() ) ) - { - EditStyleSheet* pS = (EditStyleSheet*)GetPool().Find( GetParent(), rStyle.GetFamily() ); - if ( pS ) - return pS->HasStyleAsAnyParent( rStyle ); - } - return sal_False; -} - -*/ - -// ------------------------------------------------------------------------- -// class TextPortionList -// ------------------------------------------------------------------------- TextPortionList::TextPortionList() { } @@ -115,7 +96,7 @@ void TextPortionList::DeleteFromPortion( sal_uInt16 nDelFrom ) sal_uInt16 TextPortionList::FindPortion( sal_uInt16 nCharPos, sal_uInt16& nPortionStart, sal_Bool bPreferStartingPortion ) { - // Bei nCharPos an Portion-Grenze wird die linke Portion gefunden + // When nCharPos at portion limit, the left portion is found sal_uInt16 nTmpPos = 0; for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ ) { @@ -131,7 +112,7 @@ sal_uInt16 TextPortionList::FindPortion( sal_uInt16 nCharPos, sal_uInt16& nPorti } } } - DBG_ERROR( "FindPortion: Nicht gefunden!" ); + OSL_FAIL( "FindPortion: Not found!" ); return ( Count() - 1 ); } @@ -147,10 +128,6 @@ sal_uInt16 TextPortionList::GetStartPos( sal_uInt16 nPortion ) } -// ------------------------------------------------------------------------- -// class ExtraPortionInfo -// ------------------------------------------------------------------------- - ExtraPortionInfo::ExtraPortionInfo() { nOrgWidth = 0; @@ -182,9 +159,6 @@ void ExtraPortionInfo::DestroyOrgDXArray() } -// ------------------------------------------------------------------------- -// class ParaPortion -// ------------------------------------------------------------------------- ParaPortion::ParaPortion( ContentNode* pN ) { DBG_CTOR( EE_ParaPortion, 0 ); @@ -216,13 +190,13 @@ void ParaPortion::MarkInvalid( sal_uInt16 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; @@ -263,8 +237,8 @@ void ParaPortion::MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 /* nEnd */ 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 ( sal_uInt16 nLine = 0; nLine < aLineList.Count(); nLine++ ) { @@ -272,8 +246,8 @@ sal_uInt16 ParaPortion::GetLineNumber( sal_uInt16 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); } @@ -285,19 +259,19 @@ void ParaPortion::SetVisible( sal_Bool bMakeVisible ) void ParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormattedLine ) { sal_uInt16 nLines = aLineList.Count(); - DBG_ASSERT( nLines, "CorrectPortionNumbersFromLine: Leere Portion?" ); + 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 ) @@ -320,7 +294,7 @@ void ParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormatte } } } - 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 ... @@ -355,9 +329,6 @@ static sal_uInt16 FastGetPos( const VoidPtr *pPtrArray, sal_uInt16 nPtrArrayLen, return USHRT_MAX; } -// ------------------------------------------------------------------------- -// class ParaPortionList -// ------------------------------------------------------------------------- ParaPortionList::ParaPortionList() : nLastCache( 0 ) { } @@ -398,7 +369,7 @@ long ParaPortionList::GetYOffset( ParaPortion* pPPortion ) return nHeight; nHeight += pTmpPortion->GetHeight(); } - DBG_ERROR( "GetYOffset: Portion nicht gefunden" ); + OSL_FAIL( "GetYOffset: Portion not found" ); return nHeight; } @@ -407,11 +378,11 @@ sal_uInt16 ParaPortionList::FindParagraph( long nYOffset ) long nY = 0; 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& @@ -421,12 +392,12 @@ void ParaPortionList::DbgCheck( EditDoc& ) { #ifdef DBG_UTIL - DBG_ASSERT( Count() == rDoc.Count(), "ParaPortionList::DbgCheck() - Count() ungleich!" ); + 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 } @@ -446,17 +417,16 @@ 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< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetUpper(), eSourceUnit, eDestUnit ) ) ); rItem.SetLower( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetLower(), eSourceUnit, eDestUnit ) ) ); @@ -464,16 +434,16 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit 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< 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 ( sal_uInt16 i = 0; i < rItem.Count(); i++ ) @@ -489,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 ) ); } @@ -504,7 +474,7 @@ void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const Map for ( sal_uInt16 nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ ) { - // Wenn moeglich ueber SlotID gehen... + // If possible go through SlotID ... sal_uInt16 nSourceWhich = nWhich; sal_uInt16 nSlot = pDestPool->GetTrueSlotId( nWhich ); @@ -532,11 +502,7 @@ 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 ); - } } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 812625b69771..64591310d7dd 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,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; @@ -112,7 +113,7 @@ SV_IMPL_VARARR( EECharAttribArray, EECharAttrib ); static SfxItemPool* pGlobalPool=0; -// ---------------------------------------------------------------------- +// ---------------------------------------------------------------------- // EditEngine // ---------------------------------------------------------------------- EditEngine::EditEngine( SfxItemPool* pItemPool ) @@ -154,7 +155,7 @@ sal_Bool EditEngine::IsInUndo() 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 ); } @@ -162,7 +163,7 @@ 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 ); } @@ -253,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(); @@ -283,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 ); @@ -304,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... @@ -337,8 +322,8 @@ void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const P } 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 ) { @@ -387,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 ); @@ -488,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() ); @@ -729,7 +708,7 @@ sal_uInt16 EditEngine::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex 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 ); @@ -821,11 +800,11 @@ ESelection EditEngine::SelectSentence( const ESelection& rCurSel ) const return pE->pImpEditEngine->CreateESel( aSentenceSel ); } -sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView ) +sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, Window* pFrameWin ) { 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; @@ -865,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; } } @@ -925,17 +904,6 @@ 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 = sal_False; } @@ -1081,7 +1049,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie if ( bSel ) pImpEditEngine->UndoActionStart( EDITUNDO_INSERT ); if ( pImpEditEngine->GetStatus().DoAutoCorrect() ) - aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode() ); + aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode(), pFrameWin ); aCurSel = pImpEditEngine->InsertTab( aCurSel ); if ( bSel ) pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT ); @@ -1102,7 +1070,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie pImpEditEngine->UndoActionStart( EDITUNDO_INSERT ); if ( rKeyEvent.GetKeyCode().IsShift() ) { - aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode() ); + aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode(), pFrameWin ); aCurSel = pImpEditEngine->InsertLineBreak( aCurSel ); } else @@ -1110,7 +1078,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie if ( !aAutoText.Len() ) { if ( pImpEditEngine->GetStatus().DoAutoCorrect() ) - aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode() ); + aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode(), pFrameWin ); aCurSel = pImpEditEngine->InsertParaBreak( aCurSel ); } else @@ -1152,13 +1120,14 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie { xub_Unicode nCharCode = rKeyEvent.GetCharCode(); pEditView->pImpEditView->DrawSelection(); - // Autokorrektur ? - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + // Autocorrection? + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); if ( ( pImpEditEngine->GetStatus().DoAutoCorrect() ) && ( SvxAutoCorrect::IsAutoCorrectChar( nCharCode ) || pAutoCorrect->HasRunNext() ) ) { - aCurSel = pImpEditEngine->AutoCorrect( aCurSel, nCharCode, !pEditView->IsInsertMode() ); + aCurSel = pImpEditEngine->AutoCorrect( + aCurSel, nCharCode, !pEditView->IsInsertMode(), pFrameWin ); } else { @@ -1167,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 ) ) @@ -1264,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 ); @@ -1301,6 +1270,19 @@ sal_uInt32 EditEngine::GetTextHeight() const 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 ); @@ -1464,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 ) { @@ -1480,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(); @@ -1501,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; @@ -1565,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 ) ); @@ -1588,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 ); @@ -1633,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(); } @@ -1687,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 ); @@ -1756,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 ) || @@ -1784,14 +1764,15 @@ 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++ ) { ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n ); pNode->CreateWrongList(); } - pImpEditEngine->StartOnlineSpellTimer(); + if (pImpEditEngine->IsFormatted()) + pImpEditEngine->StartOnlineSpellTimer(); } else { @@ -1802,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; @@ -1857,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(); } @@ -1910,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() ) ) @@ -2025,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 ); } @@ -2076,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; } @@ -2144,13 +2126,13 @@ void EditEngine::SetHyphenator( Reference< XHyphenator > & xHyph ) pImpEditEngine->SetHyphenator( xHyph ); } -void EditEngine::SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars ) +void EditEngine::SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ) { DBG_CHKTHIS( EditEngine, 0 ); pImpEditEngine->SetForbiddenCharsTable( xForbiddenChars ); } -vos::ORef<SvxForbiddenCharactersTable> EditEngine::GetForbiddenCharsTable() const +rtl::Reference<SvxForbiddenCharactersTable> EditEngine::GetForbiddenCharsTable() const { DBG_CHKTHIS( EditEngine, 0 ); return pImpEditEngine->GetForbiddenCharsTable( sal_False ); @@ -2169,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; @@ -2183,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 ); @@ -2231,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; @@ -2360,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 ); @@ -2419,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 ); @@ -2434,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(); @@ -2469,9 +2440,9 @@ ParagraphInfos EditEngine::GetParagraphInfos( sal_uInt16 nPara ) } // ===================================================================== -// ====================== Virtuelle Methoden ======================= +// ====================== Virtual Methods ======================== // ===================================================================== -void __EXPORT EditEngine::DrawingText( const Point&, const XubString&, sal_uInt16, sal_uInt16, +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&) @@ -2480,12 +2451,22 @@ void __EXPORT EditEngine::DrawingText( const Point&, const XubString&, sal_uInt1 DBG_CHKTHIS( EditEngine, 0 ); } -void __EXPORT EditEngine::PaintingFirstLine( sal_uInt16, const Point&, long, const Point&, short, OutputDevice* ) +void EditEngine::DrawingTab( const Point& /*rStartPos*/, long /*nWidth*/, + const String& /*rChar*/, const SvxFont& /*rFont*/, + sal_uInt16 /*nPara*/, xub_StrLen /*nIndex*/, + sal_uInt8 /*nRightToLeft*/, bool /*bEndOfLine*/, + bool /*bEndOfParagraph*/, const Color& /*rOverlineColor*/, + const Color& /*rTextLineColor*/) +{ + DBG_CHKTHIS( EditEngine, 0 ); +} + +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 ); @@ -2498,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 ); @@ -2515,24 +2496,24 @@ void EditEngine::ParagraphConnected( sal_uInt16 /*nLeftParagraph*/, sal_uInt16 / 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 ); @@ -2545,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; @@ -2603,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 ) { @@ -2737,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; } } @@ -2775,94 +2756,10 @@ 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; - } -*/ } sal_Bool EditEngine::HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable ) @@ -2913,9 +2810,6 @@ sal_Bool EditEngine::IsFirstWordCapitalization() const } -// --------------------------------------------------- - - EFieldInfo::EFieldInfo() { pFieldItem = NULL; @@ -2948,3 +2842,5 @@ EFieldInfo& EFieldInfo::operator= ( const EFieldInfo& rFldInfo ) return *this; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editeng.src b/editeng/source/editeng/editeng.src index b65f20c36583..add1054fbb10 100644 --- a/editeng/source/editeng/editeng.src +++ b/editeng/source/editeng/editeng.src @@ -70,7 +70,7 @@ String RID_EDITUNDO_SETSTYLE String RID_EDITUNDO_TRANSLITERATE { - Text [ en-US ] = "Case/Characters"; + Text [ en-US ] = "~Change Case"; }; diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index cb042b721c4d..ccb61a837c49 100755..100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -110,14 +111,14 @@ sal_Bool lcl_CreateBulletItem( const SvxNumBulletItem& rNumBullet, sal_uInt16 nL 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() ) @@ -132,7 +133,7 @@ sal_Bool lcl_CreateBulletItem( const SvxNumBulletItem& rNumBullet, sal_uInt16 nL rBullet.SetJustification( BJ_VCENTER|BJ_HCENTER ); break; default: - DBG_ERROR( "Unknown or invalid NumAdjust" ); + OSL_FAIL( "Unknown or invalid NumAdjust" ); } } return pFmt ? sal_True : sal_False; @@ -141,7 +142,7 @@ sal_Bool lcl_CreateBulletItem( const SvxNumBulletItem& rNumBullet, sal_uInt16 nL 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 ); @@ -168,7 +169,7 @@ XEditAttribute::XEditAttribute( const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uIn XEditAttribute::~XEditAttribute() { DBG_DTOR( XEditAttribute, 0 ); - pItem = 0; // Gehoert dem Pool. + pItem = 0; // belongs to the Pool. } XEditAttribute* XEditAttributeList::FindAttrib( sal_uInt16 _nWhich, sal_uInt16 nChar ) const @@ -186,28 +187,19 @@ 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(0) { - 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 ( sal_uInt16 n = 0; n < rCopyFrom.GetAttribs().Count(); n++ ) { XEditAttribute* pAttr = rCopyFrom.GetAttribs().GetObject( n ); @@ -215,12 +207,8 @@ ContentInfo::ContentInfo( const ContentInfo& rCopyFrom, SfxItemPool& rPoolToUse aAttribs.Insert( pMyAttr, aAttribs.Count() ); } - // Wrongs - pWrongs = NULL; -#ifndef SVX_LIGHT if ( rCopyFrom.GetWrongList() ) pWrongs = rCopyFrom.GetWrongList()->Clone(); -#endif // !SVX_LIGHT } ContentInfo::~ContentInfo() @@ -228,30 +216,13 @@ ContentInfo::~ContentInfo() 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 { @@ -301,179 +272,179 @@ EditTextObject::EditTextObject( const EditTextObject& r ) nWhich = r.nWhich; } -__EXPORT EditTextObject::~EditTextObject() +EditTextObject::~EditTextObject() { DBG_DTOR( EE_EditTextObject, 0 ); } sal_uInt16 EditTextObject::GetParagraphCount() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return 0; } 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 */, sal_uInt16 /* nPara */) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } 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( sal_uInt16 /*nPara*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } sal_Bool EditTextObject::HasPortionInfo() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + 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!" ); } sal_Bool EditTextObject::HasOnlineSpellErrors() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return sal_False; } sal_Bool EditTextObject::HasCharAttribs( sal_uInt16 ) const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return sal_False; } 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*/, sal_uInt16 /*nStart*/, sal_uInt16 /*nEnd*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } sal_Bool EditTextObject::IsFieldObject() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + 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; } sal_Bool EditTextObject::HasField( TypeId /*aType*/ ) const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return sal_False; } 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( sal_uInt16 /*nPara*/, const SfxItemSet& /*rAttribs*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } sal_Bool EditTextObject::RemoveCharAttribs( sal_uInt16 /*nWhich*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return sal_False; } sal_Bool EditTextObject::RemoveParaAttribs( sal_uInt16 /*nWhich*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return sal_False; } sal_Bool EditTextObject::HasStyleSheet( const XubString& /*rName*/, SfxStyleFamily /*eFamily*/ ) const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return sal_False; } 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( sal_uInt16 /*nPara*/, const XubString& /*rName*/, const SfxStyleFamily& /*eFamily*/ ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } -sal_Bool __EXPORT EditTextObject::ChangeStyleSheets( const XubString&, SfxStyleFamily, +sal_Bool EditTextObject::ChangeStyleSheets( const XubString&, SfxStyleFamily, const XubString&, SfxStyleFamily ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + 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!" ); } sal_uInt16 EditTextObject::GetUserType() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return 0; } void EditTextObject::SetUserType( sal_uInt16 ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } sal_uLong EditTextObject::GetObjectSettings() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return 0; } void EditTextObject::SetObjectSettings( sal_uLong ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); } sal_Bool EditTextObject::IsVertical() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return sal_False; } void EditTextObject::SetVertical( sal_Bool bVertical ) { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); ((BinTextObject*)this)->SetVertical( bVertical ); } sal_uInt16 EditTextObject::GetScriptType() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return ((const BinTextObject*)this)->GetScriptType(); } @@ -483,7 +454,6 @@ sal_Bool EditTextObject::Store( SvStream& rOStream ) const if ( rOStream.GetError() ) return sal_False; - // Vorspann: sal_Size nStartPos = rOStream.Tell(); rOStream << (sal_uInt16)Which(); @@ -491,10 +461,8 @@ sal_Bool EditTextObject::Store( SvStream& rOStream ) const 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 ) ); @@ -508,14 +476,14 @@ EditTextObject* EditTextObject::Create( SvStream& rIStream, SfxItemPool* pGlobal { sal_uLong nStartPos = rIStream.Tell(); - // Ertmal sehen, was fuer ein Object... + // 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; @@ -531,12 +499,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; @@ -556,19 +524,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!" ); } sal_uInt16 EditTextObject::GetVersion() const { - DBG_ERROR( "V-Methode direkt vom EditTextObject!" ); + OSL_FAIL( "Virtual method direct from EditTextObject!" ); return 0; } @@ -682,7 +650,7 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : nObjSettings = r.nObjSettings; bVertical = r.bVertical; nScriptType = r.nScriptType; - pPortionInfo = NULL; // PortionInfo nicht kopieren + pPortionInfo = NULL; // Do not copy PortionInfo bStoreUnicodeStrings = sal_False; if ( !r.bOwnerOfPool ) @@ -718,7 +686,7 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : } } -__EXPORT BinTextObject::~BinTextObject() +BinTextObject::~BinTextObject() { if(!bOwnerOfPool && pPool) { @@ -729,9 +697,6 @@ __EXPORT BinTextObject::~BinTextObject() DeleteContents(); if ( bOwnerOfPool ) { - // Nicht mehr, wegen 1xDefItems. - // siehe auch ~EditDoc(). -// pPool->ReleaseDefaults( sal_True /* bDelete */ ); SfxItemPool::Free(pPool); } } @@ -792,7 +757,7 @@ void BinTextObject::DeleteContents() aContents.Remove( 0, aContents.Count() ); } -EditTextObject* __EXPORT BinTextObject::Clone() const +EditTextObject* BinTextObject::Clone() const { return new BinTextObject( *this ); } @@ -822,7 +787,7 @@ sal_uInt16 BinTextObject::GetParagraphCount() 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 ]; @@ -833,7 +798,7 @@ XubString BinTextObject::GetText( sal_uInt16 nPara ) const 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; @@ -855,7 +820,7 @@ EditTextObject* BinTextObject::CreateTextObject( sal_uInt16 nPara, sal_uInt16 nP 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 ) ); @@ -876,7 +841,7 @@ EditTextObject* BinTextObject::CreateTextObject( sal_uInt16 nPara, sal_uInt16 nP 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 ]; @@ -904,14 +869,12 @@ void BinTextObject::ClearPortionInfo() sal_Bool BinTextObject::HasOnlineSpellErrors() const { -#ifndef SVX_LIGHT for ( sal_uInt16 n = 0; n < aContents.Count(); n++ ) { ContentInfo* p = aContents.GetObject( n ); if ( p->GetWrongList() && p->GetWrongList()->Count() ) return sal_True; } -#endif // !SVX_LIGHT return sal_False; } @@ -1150,7 +1113,7 @@ sal_Bool BinTextObject::ImpChangeStyleSheets( return bChanges; } -sal_Bool __EXPORT BinTextObject::ChangeStyleSheets( +sal_Bool BinTextObject::ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily ) { @@ -1161,38 +1124,37 @@ sal_Bool __EXPORT BinTextObject::ChangeStyleSheets( 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 { 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 + // Store Current text encoding ... rtl_TextEncoding eEncoding = GetSOStoreTextEncoding( gsl_getSystemTextEncoding(), (sal_uInt16) rOStream.GetVersion() ); rOStream << (sal_uInt16) eEncoding; - // Die Anzahl der Absaetze... + // The number of paragraphs ... sal_uInt16 nParagraphs = GetContents().Count(); rOStream << nParagraphs; char cFeatureConverted = ByteString( CH_FEATURE, eEncoding ).GetChar(0); - // Die einzelnen Absaetze... + // The individual paragraphs ... for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ ) { ContentInfo* pC = GetContents().GetObject( nPara ); @@ -1228,7 +1190,7 @@ 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 ) { @@ -1247,7 +1209,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; @@ -1255,13 +1217,6 @@ 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 ( sal_uInt16 nChar = 0; nChar < pC->GetText().Len(); nChar++ ) @@ -1284,19 +1239,19 @@ 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 << (sal_uInt16)pC->GetFamily(); - // Absatzattribute... + // Paragraph attributes ... pC->GetParaAttribs().Store( rOStream ); - // Die Anzahl der Attribute... + // 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 ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ ) { @@ -1309,17 +1264,12 @@ 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; @@ -1332,7 +1282,7 @@ void __EXPORT BinTextObject::StoreData( SvStream& rOStream ) const 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 sal_uLong and increase version... nL = pC->GetStyle().Len(); @@ -1342,67 +1292,65 @@ 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. + // 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: + // CharSet, in which it was saved: sal_uInt16 nCharSet; rIStream >> nCharSet; rtl_TextEncoding eSrcEncoding = GetSOLoadTextEncoding( (rtl_TextEncoding)nCharSet, (sal_uInt16)rIStream.GetVersion() ); - // Die Anzahl der Absaetze... + // The number of paragraphs ... sal_uInt16 nParagraphs; rIStream >> nParagraphs; - // Die einzelnen Absaetze... + // 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 ); 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_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; sal_uInt16 nAttr; for ( nAttr = 0; nAttr < nAttribs; nAttr++ ) @@ -1467,7 +1415,7 @@ 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 ) { @@ -1494,7 +1442,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 ) { @@ -1523,15 +1471,15 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) } } - // Ab 400 auch die DefMetric: + // From 400 also the DefMetric: if ( nVersion >= 400 ) { 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 ); @@ -1584,8 +1532,8 @@ void __EXPORT BinTextObject::CreateData( SvStream& rIStream ) } - // 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 ( sal_uInt16 n = 0; n < aContents.Count(); n++ ) @@ -1660,41 +1608,41 @@ 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... + // 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() ); 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 ( sal_uLong nAttr = 0; nAttr < nAttribs; nAttr++ ) { @@ -1714,7 +1662,7 @@ void __EXPORT BinTextObject::CreateData300( SvStream& rIStream ) } } - // Prueffen, ob ein Zeichensatz gespeichert wurde + // Check whether a font was saved sal_uInt16 nCharSetMarker; rIStream >> nCharSetMarker; if ( nCharSetMarker == CHARSETMARKER ) @@ -1723,3 +1671,5 @@ void __EXPORT BinTextObject::CreateData300( SvStream& rIStream ) rIStream >> nCharSet; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index 5bf719c44d76..38b530005302 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,8 +39,8 @@ 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; @@ -112,12 +113,16 @@ class XParaPortionList : public XBaseParaPortionList sal_uIntPtr nRefDevPtr; OutDevType eRefDevType; MapMode aRefMapMode; - sal_uLong nPaperWidth; + sal_uInt16 nStretchX; + sal_uInt16 nStretchY; + sal_uLong nPaperWidth; public: - XParaPortionList( OutputDevice* pRefDev, sal_uLong nPW ) : - aRefMapMode( pRefDev->GetMapMode() ) + XParaPortionList( OutputDevice* pRefDev, sal_uLong nPW, sal_uInt16 _nStretchX, sal_uInt16 _nStretchY ) : + aRefMapMode( pRefDev->GetMapMode() ), + nStretchX(_nStretchX), + nStretchY(_nStretchY) { nRefDevPtr = (sal_uIntPtr)pRefDev; nPaperWidth = nPW; eRefDevType = pRefDev->GetOutDevType(); @@ -127,6 +132,8 @@ public: sal_uLong GetPaperWidth() const { return nPaperWidth; } OutDevType GetRefDevType() const { return eRefDevType; } const MapMode& GetRefMapMode() const { return aRefMapMode; } + sal_uInt16 GetStretchX() const { return nStretchX; } + sal_uInt16 GetStretchY() const { return nStretchY; } }; /* cl removed because not needed anymore since binfilter @@ -154,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 ); @@ -187,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==; @@ -235,7 +236,7 @@ public: sal_uInt16 GetScriptType() const; void SetScriptType( sal_uInt16 nType ); - sal_uInt16 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, sal_uInt16 nStart, sal_uInt16 nEnd ); @@ -290,12 +291,6 @@ public: sal_Bool IsOwnerOfPool() const { return bOwnerOfPool; } void StoreUnicodeStrings( sal_Bool b ) { bStoreUnicodeStrings = b; } -/* cl removed because not needed anymore since binfilter - void PrepareStore( SfxStyleSheetPool* pStyleSheetPool ); - void FinishStore(); - void FinishLoad( SfxStyleSheetPool* pStyleSheetPool ); -*/ - bool operator==( const BinTextObject& rCompare ) const; // #i102062# @@ -307,3 +302,4 @@ public: #endif // _EDITOBJ2_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editsel.cxx b/editeng/source/editeng/editsel.cxx index 089e82a4e48f..e7f0fc82f05b 100644 --- a/editeng/source/editeng/editsel.cxx +++ b/editeng/source/editeng/editsel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,18 +43,18 @@ 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 } -sal_Bool __EXPORT EditSelFunctionSet::SetCursorAtPoint( const Point& rPointPixel, sal_Bool ) +sal_Bool EditSelFunctionSet::SetCursorAtPoint( const Point& rPointPixel, sal_Bool ) { if ( pCurView ) return pCurView->pImpEditView->SetCursorAtPoint( rPointPixel ); @@ -61,7 +62,7 @@ sal_Bool __EXPORT EditSelFunctionSet::SetCursorAtPoint( const Point& rPointPixel return sal_False; } -sal_Bool __EXPORT EditSelFunctionSet::IsSelectionAtPoint( const Point& rPointPixel ) +sal_Bool EditSelFunctionSet::IsSelectionAtPoint( const Point& rPointPixel ) { if ( pCurView ) return pCurView->pImpEditView->IsSelectionAtPoint( rPointPixel ); @@ -69,20 +70,20 @@ sal_Bool __EXPORT EditSelFunctionSet::IsSelectionAtPoint( const Point& rPointPix 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(); @@ -93,8 +94,6 @@ 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( sal_True ); } @@ -119,3 +118,4 @@ EditView* EditSelectionEngine::GetCurView() return pView; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editsel.hxx b/editeng/source/editeng/editsel.hxx index 05f28be24006..12e9131d2ffa 100644 --- a/editeng/source/editeng/editsel.hxx +++ b/editeng/source/editeng/editsel.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,6 @@ class EditView; -// ---------------------------------------------------------------------- -// class EditSelFunctionSet -// ---------------------------------------------------------------------- class EditSelFunctionSet: public FunctionSet { private: @@ -58,9 +56,6 @@ public: EditView* GetCurView() { return pCurView; } }; -// ---------------------------------------------------------------------- -// class EditSelectionEngine -// ---------------------------------------------------------------------- class EditSelectionEngine : public SelectionEngine { private: @@ -73,3 +68,5 @@ public: }; #endif // _EDITSEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editstt2.hxx b/editeng/source/editeng/editstt2.hxx index c2a4deac97f4..201442a8e781 100644 --- a/editeng/source/editeng/editstt2.hxx +++ b/editeng/source/editeng/editstt2.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -128,3 +129,4 @@ public: #endif // _EDITSTT2_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx index 4b173f39082d..46f547d1aa15 100644 --- a/editeng/source/editeng/editundo.cxx +++ b/editeng/source/editeng/editundo.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,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 @@ -66,15 +67,12 @@ void lcl_DoSetSelection( EditView* pView, sal_uInt16 nPara ) pView->GetImpEditView()->SetEditSelection( aSel ); } -// ----------------------------------------------------------------------- -// EditUndoManager -// ------------------------------------------------------------------------ EditUndoManager::EditUndoManager( ImpEditEngine* p ) { pImpEE = p; } -sal_Bool __EXPORT EditUndoManager::Undo() +sal_Bool EditUndoManager::Undo() { if ( GetUndoActionCount() == 0 ) return sal_False; @@ -87,20 +85,20 @@ sal_Bool __EXPORT EditUndoManager::Undo() pImpEE->SetActiveView( pImpEE->GetEditViews().GetObject(0) ); else { - DBG_ERROR( "Undo in Engine ohne View nicht moeglich!" ); + 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( 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 ); @@ -109,7 +107,7 @@ sal_Bool __EXPORT EditUndoManager::Undo() return bDone; } -sal_Bool __EXPORT EditUndoManager::Redo() +sal_Bool EditUndoManager::Redo() { if ( GetRedoActionCount() == 0 ) return sal_False; @@ -122,20 +120,20 @@ sal_Bool __EXPORT EditUndoManager::Redo() pImpEE->SetActiveView( pImpEE->GetEditViews().GetObject(0) ); else { - DBG_ERROR( "Redo in Engine ohne View nicht moeglich!" ); + 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( 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 ); @@ -144,9 +142,6 @@ sal_Bool __EXPORT EditUndoManager::Redo() return bDone; } -// ----------------------------------------------------------------------- -// EditUndo -// ------------------------------------------------------------------------ EditUndo::EditUndo( sal_uInt16 nI, ImpEditEngine* p ) { DBG_CTOR( EditUndo, 0 ); @@ -159,18 +154,18 @@ EditUndo::~EditUndo() DBG_DTOR( EditUndo, 0 ); } -sal_uInt16 __EXPORT EditUndo::GetId() const +sal_uInt16 EditUndo::GetId() const { DBG_CHKTHIS( EditUndo, 0 ); return nId; } -sal_Bool __EXPORT EditUndo::CanRepeat(SfxRepeatTarget&) const +sal_Bool EditUndo::CanRepeat(SfxRepeatTarget&) const { return sal_False; } -XubString __EXPORT EditUndo::GetComment() const +XubString EditUndo::GetComment() const { XubString aComment; if ( pImpEE ) @@ -181,9 +176,6 @@ XubString __EXPORT EditUndo::GetComment() const return aComment; } -// ----------------------------------------------------------------------- -// EditUndoDelContent -// ------------------------------------------------------------------------ EditUndoDelContent::EditUndoDelContent( ImpEditEngine* _pImpEE, ContentNode* pNode, sal_uInt16 n ) : EditUndo( EDITUNDO_DELCONTENT, _pImpEE ) { @@ -198,30 +190,30 @@ 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 = sal_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 ); @@ -236,14 +228,11 @@ void __EXPORT EditUndoDelContent::Redo() DBG_ASSERT( pN && ( pN != pContentNode ), "?! RemoveContent !? " ); EditPaM aPaM( pN, pN->Len() ); - bDelObject = sal_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, sal_uInt16 nN, sal_uInt16 nSP, const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs, const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, sal_Bool bBkwrd ) @@ -272,13 +261,12 @@ 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 sal_Bool bCall = GetImpEditEngine()->IsCallParaInsertedOrDeleted(); GetImpEditEngine()->SetCallParaInsertedOrDeleted( sal_False ); @@ -302,17 +290,14 @@ 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, sal_uInt16 nN, sal_uInt16 nSP ) : EditUndo( EDITUNDO_SPLITPARA, _pImpEE ) { @@ -324,32 +309,29 @@ EditUndoSplitPara::~EditUndoSplitPara() { } -void __EXPORT EditUndoSplitPara::Undo() +void EditUndoSplitPara::Undo() { - DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" ); + 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(); @@ -357,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 ) ); @@ -367,7 +349,7 @@ void __EXPORT EditUndoInsertChars::Redo() GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aNewPaM ) ); } -sal_Bool __EXPORT EditUndoInsertChars::Merge( SfxUndoAction* pNextAction ) +sal_Bool EditUndoInsertChars::Merge( SfxUndoAction* pNextAction ) { if ( !pNextAction->ISA( EditUndoInsertChars ) ) return sal_False; @@ -385,16 +367,13 @@ sal_Bool __EXPORT EditUndoInsertChars::Merge( SfxUndoAction* pNextAction ) 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 ) ); @@ -404,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(); @@ -414,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() @@ -429,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 ); @@ -453,9 +429,6 @@ void __EXPORT EditUndoInsertFeature::Redo() GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel ); } -// ----------------------------------------------------------------------- -// EditUndoMoveParagraphs -// ------------------------------------------------------------------------ EditUndoMoveParagraphs::EditUndoMoveParagraphs ( ImpEditEngine* _pImpEE, const Range& rParas, sal_uInt16 n ) : EditUndo( EDITUNDO_MOVEPARAGRAPHS, _pImpEE ), @@ -468,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(); @@ -491,16 +464,13 @@ void __EXPORT EditUndoMoveParagraphs::Undo() 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, sal_uInt16 nP, const XubString& rPrevName, SfxStyleFamily ePrevFam, const XubString& rNewName, SfxStyleFamily eNewFam, @@ -517,24 +487,21 @@ 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, sal_uInt16 nP, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems ) : EditUndo( EDITUNDO_PARAATTRIBS, _pImpEE ), aPrevItems( rPrevItems ), @@ -547,33 +514,28 @@ 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... + // 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; @@ -582,7 +544,7 @@ EditUndoSetAttribs::EditUndoSetAttribs( ImpEditEngine* _pImpEE, const ESelection EditUndoSetAttribs::~EditUndoSetAttribs() { - // Items aus Pool holen... + // Get Items from Pool... SfxItemPool* pPool = aNewAttribs.GetPool(); sal_uInt16 nContents = aPrevAttribs.Count(); for ( sal_uInt16 n = 0; n < nContents; n++ ) @@ -600,9 +562,9 @@ 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(); sal_Bool bFields = sal_False; for ( sal_uInt16 nPara = aESel.nStartPara; nPara <= aESel.nEndPara; nPara++ ) @@ -610,11 +572,11 @@ void __EXPORT EditUndoSetAttribs::Undo() 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. + // 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 ); @@ -622,7 +584,7 @@ void __EXPORT EditUndoSetAttribs::Undo() { 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 = sal_True; @@ -633,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 ) ); @@ -654,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 ) { @@ -669,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(); @@ -709,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 ) ); @@ -719,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 ) { @@ -731,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() ) @@ -743,8 +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 210a18ca0ae4..0479d1fe74b8 100644 --- a/editeng/source/editeng/editundo.hxx +++ b/editeng/source/editeng/editundo.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,8 +50,8 @@ class EditUndoDelContent : public EditUndo private: sal_Bool bDelObject; sal_uInt16 nNode; - ContentNode* pContentNode; // Zeigt auf das gueltige, - // nicht zerstoerte Objekt! + ContentNode* pContentNode; // Points to the valid, + // undestroyed object! public: TYPEINFO(); @@ -72,7 +73,7 @@ private: 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; @@ -313,3 +314,5 @@ public: #endif // _EDITUNDO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index f36f22365361..ff12f775ceb1 100755..100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_editeng.hxx" +#include <sal/macros.h> #include <vcl/wrkwin.hxx> #include <vcl/dialog.hxx> #include <vcl/msgbox.hxx> @@ -60,6 +62,7 @@ #include <helpid.hrc> #include <i18npool/lang.h> #include <vcl/menu.hxx> +#include <vcl/window.hxx> #include <editeng/acorrcfg.hxx> #include <editeng/unolingu.hxx> #include <editeng/fontitem.hxx> @@ -73,6 +76,7 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <unotools/lingucfg.hxx> +#include <sal/macros.h> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -146,7 +150,7 @@ LanguageType lcl_CheckLanguage( lang::Locale a3( SvxCreateLocale( aLangList[3] ) ); #endif - sal_Int32 nCount = sizeof(aLangList) / sizeof(aLangList[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(aLangList); for (sal_Int32 i = 0; i < nCount; i++) { sal_Int16 nTmpLang = aLangList[i]; @@ -229,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(); @@ -238,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() ) { @@ -257,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(); @@ -350,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(); @@ -410,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 @@ -419,11 +423,11 @@ void EditView::InsertText( const XubString& rStr, sal_Bool bSelect ) pImpEE->FormatAndUpdate( this ); } -sal_Bool EditView::PostKeyEvent( const KeyEvent& rKeyEvent ) +sal_Bool EditView::PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - return pImpEditView->PostKeyEvent( rKeyEvent ); + return pImpEditView->PostKeyEvent( rKeyEvent, pFrameWin ); } sal_Bool EditView::MouseButtonUp( const MouseEvent& rMouseEvent ) @@ -459,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 ); @@ -496,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 ); @@ -508,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 ); } @@ -562,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() ); } @@ -603,7 +601,6 @@ sal_uLong EditView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat return rInput.GetError(); } -#ifndef SVX_LIGHT sal_uLong EditView::Write( SvStream& rOutput, EETextFormat eFormat ) { DBG_CHKTHIS( EditView, 0 ); @@ -612,7 +609,6 @@ sal_uLong EditView::Write( SvStream& rOutput, EETextFormat eFormat ) ShowCursor(); return rOutput.GetError(); } -#endif void EditView::Cut() { @@ -783,7 +779,7 @@ 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 ); } @@ -798,7 +794,7 @@ 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 ); } @@ -810,7 +806,7 @@ sal_Bool EditView::Drop( const DropEvent& ) ESelection EditView::GetDropPos() { - DBG_ERROR( "GetDropPos - Why?!" ); + OSL_FAIL( "GetDropPos - Why?!" ); return ESelection(); } @@ -860,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; @@ -897,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(); } @@ -920,7 +916,7 @@ sal_Bool EditView::MatchGroup() return sal_False; } -void EditView::CompleteAutoCorrect() +void EditView::CompleteAutoCorrect( Window* pFrameWin ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); @@ -929,8 +925,7 @@ void EditView::CompleteAutoCorrect() 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() ); + aSel = PIMPEE->AutoCorrect( aSel, 0, !IsInsertMode(), pFrameWin ); pImpEditView->SetEditSelection( aSel ); if ( PIMPEE->IsModified() ) PIMPEE->FormatAndUpdate( this ); @@ -939,30 +934,22 @@ void EditView::CompleteAutoCorrect() 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 } @@ -970,12 +957,9 @@ void EditView::StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, 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 } @@ -1031,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 ); @@ -1050,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 @@ -1065,14 +1048,14 @@ 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.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 ); - Reference< XLanguageGuessing > xLangGuesser( EE_DLL()->GetGlobalData()->GetLanguageGuesser() ); + Reference< XLanguageGuessing > xLangGuesser( EE_DLL().GetGlobalData()->GetLanguageGuesser() ); // check if text might belong to a different language... LanguageType nGuessLangWord = LANGUAGE_NONE; @@ -1087,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 ); @@ -1138,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; @@ -1181,7 +1163,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) if (xSvcInfo.is()) { OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage( - xSvcInfo->getImplementationName(), bHC) ); + xSvcInfo->getImplementationName()) ); if (aDictionaryImageUrl.getLength() > 0) { Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); @@ -1246,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 @@ -1290,7 +1272,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) { DBG_ASSERT(nId - MN_AUTOSTART < aAlt.getLength(), "index out of range"); String aWord = pAlt[nId - MN_AUTOSTART]; - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); if ( pAutoCorrect ) pAutoCorrect->PutText( aSelected, aWord, PIMPEE->GetLanguage( aPaM2 ) ); InsertText( aWord ); @@ -1306,7 +1288,6 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) SetSelection( aOldSel ); } } -#endif } void EditView::SpellIgnoreWord() @@ -1371,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 ) ) ) @@ -1385,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(); } } @@ -1423,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() ) ); @@ -1653,3 +1635,5 @@ Selection EditView::GetSurroundingTextSelection() const return Selection( aSelection.nStartPos, aSelection.nEndPos ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 5fc43f461cac..e7d8538f7765 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,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; @@ -89,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; @@ -108,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!" ); } } @@ -125,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(); @@ -146,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() ); @@ -156,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& ) { } @@ -202,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(); } @@ -254,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; @@ -292,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 ) @@ -325,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; @@ -361,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++ ) { @@ -417,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? @@ -436,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, @@ -451,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 ) ) @@ -466,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() @@ -516,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++ ) { @@ -524,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; @@ -561,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; @@ -571,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 ) ) @@ -588,7 +586,7 @@ sal_Bool EdtAutoCorrDoc::Replace( sal_uInt16 nPos, const String& rTxt ) sal_Bool EdtAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength, const String& rTxt ) { - // Eigentlich ein Replace einfuehren => Entspr. UNDO + // Actually a Replace introduce => corresponds to UNDO sal_uInt16 nEnd = nPos+nSourceLength; if ( nEnd > pCurNode->Len() ) nEnd = pCurNode->Len(); @@ -637,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 ); @@ -668,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; } @@ -678,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 ) @@ -716,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; @@ -731,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(); @@ -761,3 +758,4 @@ void EdtAutoCorrDoc::ImplStartUndoAction() bAllowUndoAction = sal_False; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx index 49978cdd310d..112276627367 100755..100644 --- a/editeng/source/editeng/edtspell.hxx +++ b/editeng/source/editeng/edtspell.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,7 +53,7 @@ private: protected: virtual void SpellStart( SvxSpellArea eArea ); - virtual sal_Bool SpellContinue(); // Bereich pruefen + virtual sal_Bool SpellContinue(); // Check area virtual void ReplaceAll( const String &rNewText, sal_Int16 nLanguage ); virtual void SpellEnd(); virtual sal_Bool SpellMore(); @@ -101,7 +102,7 @@ public: sal_uInt16 Count() const { return WrongRanges::Count(); } - // Wenn man weiss was man tut: + // When one knows what to do: WrongRange& GetObject( sal_uInt16 n ) const { return WrongRanges::GetObject( n ); } void InsertWrong( const WrongRange& rWrong, sal_uInt16 nPos ); @@ -133,7 +134,7 @@ 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 } @@ -178,3 +179,4 @@ public: #endif // EDTSPELL +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index 6a7a5eb1bb5e..30bc31feb6da 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -92,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() ) @@ -196,8 +197,6 @@ void EditHTMLParser::NextToken( int nToken ) if ( !bInPara ) StartPara( sal_False ); - // if ( bInPara || pCurAnchor ) - String aText = aToken; if ( aText.Len() && ( aText.GetChar( 0 ) == ' ' ) && ThrowAwayBlank() && !IsReadPRE() ) @@ -209,7 +208,7 @@ void EditHTMLParser::NextToken( int nToken ) } else { - // Nur bis HTML mit 319 geschrieben ?! + // Only written until HTML with 319? if ( IsReadPRE() ) { sal_uInt16 nTabPos = aText.Search( '\t', 0 ); @@ -227,7 +226,7 @@ void EditHTMLParser::NextToken( int nToken ) break; case HTML_CENTER_ON: - case HTML_CENTER_OFF: // if ( bInPara ) + case HTML_CENTER_OFF: { sal_uInt16 nNode = pImpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() ); SfxItemSet aItems( aCurSel.Max().GetNode()->GetContentAttribs().GetItems() ); @@ -300,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: @@ -332,7 +331,7 @@ void EditHTMLParser::NextToken( int nToken ) if ( nInCell ) nInCell--; } - // fallthru + // fall through case HTML_LISTHEADER_OFF: case HTML_LI_OFF: case HTML_DD_OFF: @@ -342,7 +341,7 @@ void EditHTMLParser::NextToken( int nToken ) 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: @@ -353,9 +352,6 @@ void EditHTMLParser::NextToken( int nToken ) case HTML_FONT_OFF: // ... break; - - // #58335# kein SkipGroup on/off auf inline markup etc. - case HTML_TITLE_ON: bInTitle = sal_True; break; @@ -390,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: @@ -417,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: @@ -460,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: @@ -487,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; @@ -501,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 ); } } @@ -533,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() ); @@ -557,132 +553,123 @@ void EditHTMLParser::ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSe ContentNode* pSN = aStartPaM.GetNode(); 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(); sal_uInt16 nEndNode = pImpEditEngine->GetEditDoc().GetPos( pEN ); - DBG_ASSERT( nStartNode == nEndNode, "ImpSetAttribs: Mehrere Absaetze?" ); + DBG_ASSERT( nStartNode == nEndNode, "ImpSetAttribs: Several paragraphs?" ); #endif -/* - for ( sal_uInt16 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( 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... - - sal_uInt16 nNode = pImpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() ); -// SfxItemSet aItems( pImpEditEngine->GetEmptyItemSet() ); - SfxItemSet aItems( aCurSel.Max().GetNode()->GetContentAttribs().GetItems() ); - - aItems.ClearItem( EE_PARA_ULSPACE ); - aItems.ClearItem( EE_CHAR_FONTHEIGHT ); - aItems.ClearItem( EE_CHAR_FONTINFO ); - aItems.ClearItem( EE_CHAR_WEIGHT ); - - // Fett in den ersten 3 Headings - if ( ( nHLevel >= 1 ) && ( nHLevel <= 3 ) ) - { - SvxWeightItem aWeightItem( WEIGHT_BOLD, EE_CHAR_WEIGHT ); - aItems.Put( aWeightItem ); - } + SfxItemSet aItems( aCurSel.Max().GetNode()->GetContentAttribs().GetItems() ); - // 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; - - nPoints = OutputDevice::LogicToLogic( nPoints, MAP_POINT, eUnit ); - SvxFontHeightItem aHeightItem( nPoints, 100, EE_CHAR_FONTHEIGHT ); - aItems.Put( aHeightItem ); - - // Absatzabstaende, wenn 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 ); - } - } + aItems.ClearItem( EE_PARA_ULSPACE ); - // 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 ); - } + 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_CTL ); + aItems.ClearItem( EE_CHAR_FONTINFO_CTL ); + aItems.ClearItem( EE_CHAR_WEIGHT_CTL ); - pImpEditEngine->SetParaAttribs( nNode, aItems ); + // 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 aWeightItemCTL( WEIGHT_BOLD, EE_CHAR_WEIGHT_CTL ); + aItems.Put( aWeightItem ); + } + + // 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 ); + + SvxFontHeightItem aHeightItem( nPoints, 100, EE_CHAR_FONTHEIGHT ); + aItems.Put( aHeightItem ); + + SvxFontHeightItem aHeightItemCJK( nPoints, 100, EE_CHAR_FONTHEIGHT_CJK ); + aItems.Put( aHeightItemCJK ); + + SvxFontHeightItem aHeightItemCTL( nPoints, 100, EE_CHAR_FONTHEIGHT_CTL ); + aItems.Put( aHeightItemCTL ); + + // 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 ); } + } + + // 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 aFontItemCTL( aFont.GetFamily(), aFont.GetName(), XubString(), aFont.GetPitch(), aFont.GetCharSet(), EE_CHAR_FONTINFO_CTL ); + aItems.Put( aFontItemCTL ); + } + + pImpEditEngine->SetParaAttribs( nNode, aItems ); } void EditHTMLParser::ImpInsertText( const String& rText ) @@ -701,7 +688,7 @@ 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> sal_uInt8 nCellLevel = nInCell; @@ -763,18 +750,14 @@ void EditHTMLParser::EndPara( sal_Bool ) sal_Bool bHasText = HasTextInCurrentPara(); if ( bHasText ) ImpInsertParaBreak(); - // Nur, wenn ohne Absatzabstaende gearbeitet wird... -// if ( !nInTable && bReal && (nNumberingLevel<=1) && (nBulletLevel<=1) ) -// ImpInsertParaBreak(); } bInPara = sal_False; } 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 sal_False; @@ -788,7 +771,7 @@ sal_Bool EditHTMLParser::HasTextInCurrentPara() void EditHTMLParser::AnchorStart() { - // Anker im Anker ignoriern + // ignore anchor in anchor if ( !pCurAnchor ) { const HTMLOptions* _pOptions = GetOptions(); @@ -827,7 +810,7 @@ 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 = sal_True; @@ -852,7 +835,7 @@ void EditHTMLParser::HeadingStart( int nToken ) 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 ); } @@ -867,3 +850,5 @@ void EditHTMLParser::HeadingEnd( int ) bWasInPara = sal_False; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/eehtml.hxx b/editeng/source/editeng/eehtml.hxx index fbdb6570d8da..94d386ff71cb 100644 --- a/editeng/source/editeng/eehtml.hxx +++ b/editeng/source/editeng/eehtml.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,7 +54,7 @@ private: AnchorInfo* pCurAnchor; sal_Bool bInPara; - sal_Bool bWasInPara; // bInPara vor HeadingStart merken, weil sonst hinterher weg + sal_Bool bWasInPara; // Remember bInPara before HeadingStart, because afterwards it will be gone. sal_Bool bFieldsInserted; sal_uInt8 nInTable; sal_uInt8 nInCell; @@ -97,3 +98,5 @@ SV_DECL_REF( EditHTMLParser ) SV_IMPL_REF( EditHTMLParser ); #endif // _EEHTML_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/eeng_pch.cxx b/editeng/source/editeng/eeng_pch.cxx index 249f4cb0ab12..45216b37b7b9 100644 --- a/editeng/source/editeng/eeng_pch.cxx +++ b/editeng/source/editeng/eeng_pch.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,3 +29,5 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_editeng.hxx" #include <eeng_pch.hxx> + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/eeng_pch.hxx b/editeng/source/editeng/eeng_pch.hxx index 14c8b9f5dc4b..7f80ed57005f 100644 --- a/editeng/source/editeng/eeng_pch.hxx +++ b/editeng/source/editeng/eeng_pch.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,3 +33,4 @@ #include <vcl/svapp.hxx> +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/eeobj.cxx b/editeng/source/editeng/eeobj.cxx index 10e30e6a9908..5c2981d86b7c 100644 --- a/editeng/source/editeng/eeobj.cxx +++ b/editeng/source/editeng/eeobj.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,7 +37,7 @@ #include <sot/formats.hxx> #include <editeng/editeng.hxx> #include <svl/itempool.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> using namespace ::com::sun::star; @@ -68,7 +69,7 @@ uno::Any EditDataObject::getTransferData( const datatransfer::DataFlavor& rFlavo } 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. @@ -105,8 +106,10 @@ sal_Bool EditDataObject::isDataFlavorSupported( const datatransfer::DataFlavor& sal_Bool bSupported = sal_False; sal_uLong nT = SotExchange::GetFormat( rFlavor ); - if ( ( nT == SOT_FORMAT_STRING ) || ( nT == SOT_FORMAT_RTF ) /* || ( nT == SOT_FORMAT_XML ) */ || ( nT == SOT_FORMATSTR_ID_EDITENGINE ) ) + if ( ( nT == SOT_FORMAT_STRING ) || ( nT == SOT_FORMAT_RTF ) || ( nT == SOT_FORMATSTR_ID_EDITENGINE ) ) bSupported = sal_True; return bSupported; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/eeobj.hxx b/editeng/source/editeng/eeobj.hxx index 6a4956b2481a..5eed40f9f936 100644 --- a/editeng/source/editeng/eeobj.hxx +++ b/editeng/source/editeng/eeobj.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,9 +45,6 @@ private: String maOfficeBookmark; -// String maNetscapeBookmark; -// SvMemoryStream maRTFData; - public: EditDataObject(); ~EditDataObject(); @@ -70,3 +68,4 @@ public: #endif // _DATAOBJ_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 0146e9af30f2..677202c62e31 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,32 +74,34 @@ #include <editeng/frmdiritem.hxx> #include <editeng/xmlcnitm.hxx> #include <editeng/forbiddencharacterstable.hxx> +#include <editeng/justifyitem.hxx> #include <comphelper/processfactory.hxx> - -static EditDLL* pDLL=0; +#include <rtl/instance.hxx> using namespace ::com::sun::star; -EditDLL* EditDLL::Get() +namespace { - if ( !pDLL ) - pDLL = new EditDLL; - return pDLL; + class theEditDLL : public rtl::Static<EditDLL, theEditDLL> {}; +} + +EditDLL& EditDLL::Get() +{ + return theEditDLL::get(); } GlobalEditData::GlobalEditData() + : m_aStdRefDevice(::com::sun::star::uno::Reference<com::sun::star::lang::XComponent>(::comphelper::getProcessComponentContext(), ::com::sun::star::uno::UNO_QUERY_THROW)) { ppDefItems = NULL; - pStdRefDevice = NULL; } 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, sal_True ); - delete pStdRefDevice; } SfxPoolItem** GlobalEditData::GetDefItems() @@ -107,7 +110,7 @@ SfxPoolItem** GlobalEditData::GetDefItems() { ppDefItems = new SfxPoolItem*[EDITITEMCOUNT]; - // Absatzattribute: + // Paragraph attributes: SvxNumRule aTmpNumRule( 0, 0, sal_False ); ppDefItems[0] = new SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ); @@ -120,57 +123,54 @@ SfxPoolItem** GlobalEditData::GetDefItems() 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 ); - ppDefItems[11] = new SvxLRSpaceItem( EE_PARA_LRSPACE ); - ppDefItems[12] = new SvxULSpaceItem( EE_PARA_ULSPACE ); - ppDefItems[13] = new SvxLineSpacingItem( 0, EE_PARA_SBL ); - ppDefItems[14] = new SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ); - ppDefItems[15] = new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_LEFT, EE_PARA_TABS ); - - // Zeichenattribute: - ppDefItems[16] = new SvxColorItem( Color( COL_AUTO ), EE_CHAR_COLOR ); - ppDefItems[17] = new SvxFontItem( EE_CHAR_FONTINFO ); - ppDefItems[18] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ); - ppDefItems[19] = new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH ); - ppDefItems[20] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ); - ppDefItems[21] = new SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE ); - ppDefItems[22] = new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ); - ppDefItems[23] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ); - ppDefItems[24] = new SvxContourItem( sal_False, EE_CHAR_OUTLINE ); - ppDefItems[25] = new SvxShadowedItem( sal_False, EE_CHAR_SHADOW ); - ppDefItems[26] = new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT ); - ppDefItems[27] = new SvxAutoKernItem( sal_False, EE_CHAR_PAIRKERNING ); - ppDefItems[28] = new SvxKerningItem( 0, EE_CHAR_KERNING ); - ppDefItems[29] = new SvxWordLineModeItem( sal_False, EE_CHAR_WLM ); - ppDefItems[30] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE ); - ppDefItems[31] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK ); - ppDefItems[32] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL ); - ppDefItems[33] = new SvxFontItem( EE_CHAR_FONTINFO_CJK ); - ppDefItems[34] = new SvxFontItem( EE_CHAR_FONTINFO_CTL ); - ppDefItems[35] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK ); - ppDefItems[36] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL ); - ppDefItems[37] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ); - ppDefItems[38] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ); - ppDefItems[39] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ); - ppDefItems[40] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ); - ppDefItems[41] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ); - ppDefItems[42] = new SvxCharReliefItem( RELIEF_NONE, EE_CHAR_RELIEF ); - ppDefItems[43] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY ); -#ifndef SVX_LIGHT - ppDefItems[44] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS ); -#else - // no need to have alien attributes persistent - ppDefItems[44] = new SfxVoidItem( EE_CHAR_XMLATTRIBS ); -#endif // #ifndef SVX_LIGHT - ppDefItems[45] = new SvxOverlineItem( UNDERLINE_NONE, EE_CHAR_OVERLINE ); + ppDefItems[10] = new SvxBulletItem( EE_PARA_BULLET ); + ppDefItems[11] = new SvxLRSpaceItem( EE_PARA_LRSPACE ); + ppDefItems[12] = new SvxULSpaceItem( EE_PARA_ULSPACE ); + ppDefItems[13] = new SvxLineSpacingItem( 0, EE_PARA_SBL ); + ppDefItems[14] = new SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ); + ppDefItems[15] = new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_LEFT, EE_PARA_TABS ); + ppDefItems[16] = new SvxJustifyMethodItem( SVX_JUSTIFY_METHOD_AUTO, EE_PARA_JUST_METHOD ); + ppDefItems[17] = new SvxVerJustifyItem( SVX_VER_JUSTIFY_STANDARD, EE_PARA_VER_JUST ); + + // Character attributes: + ppDefItems[18] = new SvxColorItem( Color( COL_AUTO ), EE_CHAR_COLOR ); + ppDefItems[19] = new SvxFontItem( EE_CHAR_FONTINFO ); + ppDefItems[20] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ); + ppDefItems[21] = new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH ); + ppDefItems[22] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ); + 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( 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( sal_False, EE_CHAR_PAIRKERNING ); + ppDefItems[30] = new SvxKerningItem( 0, EE_CHAR_KERNING ); + 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 ); + ppDefItems[35] = new SvxFontItem( EE_CHAR_FONTINFO_CJK ); + ppDefItems[36] = new SvxFontItem( EE_CHAR_FONTINFO_CTL ); + ppDefItems[37] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK ); + ppDefItems[38] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL ); + ppDefItems[39] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ); + ppDefItems[40] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ); + ppDefItems[41] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ); + ppDefItems[42] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ); + 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 ); + ppDefItems[46] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS ); + ppDefItems[47] = new SvxOverlineItem( UNDERLINE_NONE, EE_CHAR_OVERLINE ); // Features - ppDefItems[46] = new SfxVoidItem( EE_FEATURE_TAB ); - ppDefItems[47] = new SfxVoidItem( EE_FEATURE_LINEBR ); - ppDefItems[48] = new SvxCharSetColorItem( Color( COL_RED ), RTL_TEXTENCODING_DONTKNOW, EE_FEATURE_NOTCONV ); - ppDefItems[49] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD ); + ppDefItems[48] = new SfxVoidItem( EE_FEATURE_TAB ); + ppDefItems[49] = new SfxVoidItem( EE_FEATURE_LINEBR ); + ppDefItems[50] = new SvxCharSetColorItem( Color( COL_RED ), RTL_TEXTENCODING_DONTKNOW, EE_FEATURE_NOTCONV ); + ppDefItems[51] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD ); - DBG_ASSERT( EDITITEMCOUNT == 50, "ITEMCOUNT geaendert, DefItems nicht angepasst!" ); + DBG_ASSERT( EDITITEMCOUNT == 52, "ITEMCOUNT geaendert, DefItems nicht angepasst!" ); // Init DefFonts: GetDefaultFonts( *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO - EE_ITEMS_START], @@ -181,9 +181,9 @@ SfxPoolItem** GlobalEditData::GetDefItems() return ppDefItems; } -vos::ORef<SvxForbiddenCharactersTable> GlobalEditData::GetForbiddenCharsTable() +rtl::Reference<SvxForbiddenCharactersTable> GlobalEditData::GetForbiddenCharsTable() { - if ( !xForbiddenCharsTable.isValid() ) + if ( !xForbiddenCharsTable.is() ) { ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); xForbiddenCharsTable = new SvxForbiddenCharactersTable( xMSF ); @@ -200,7 +200,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 ); } } @@ -209,29 +209,28 @@ uno::Reference< linguistic2::XLanguageGuessing > GlobalEditData::GetLanguageGues OutputDevice* GlobalEditData::GetStdRefDevice() { - if ( !pStdRefDevice ) + if ( !m_aStdRefDevice ) { - pStdRefDevice = new VirtualDevice; - pStdRefDevice->SetMapMode( MAP_TWIP ); + m_aStdRefDevice.reset(new VirtualDevice); + m_aStdRefDevice->SetMapMode( MAP_TWIP ); } - return pStdRefDevice; + return m_aStdRefDevice.get(); } EditResId::EditResId( sal_uInt16 nId ): - ResId( nId, *EE_DLL()->GetResMgr() ) + ResId( nId, *EE_DLL().GetResMgr() ) { } EditDLL::EditDLL() { pGlobalData = new GlobalEditData; - ByteString aResMgrName( "editeng" ); - pResMgr = ResMgr::CreateResMgr( - aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + pResMgr = ResMgr::CreateResMgr( "editeng", Application::GetSettings().GetUILocale() ); } EditDLL::~EditDLL() { - delete pResMgr; delete pGlobalData; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/eerdll2.hxx b/editeng/source/editeng/eerdll2.hxx index 49bfa058038e..33a2a1584c27 100644 --- a/editeng/source/editeng/eerdll2.hxx +++ b/editeng/source/editeng/eerdll2.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,8 @@ #include <com/sun/star/linguistic2/XLanguageGuessing.hpp> #include <editeng/forbiddencharacterstable.hxx> -#include <vos/ref.hxx> +#include <rtl/ref.hxx> +#include <comphelper/scoped_disposing_ptr.hxx> class SfxPoolItem; @@ -39,10 +41,10 @@ class GlobalEditData private: ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > xLanguageGuesser; + comphelper::scoped_disposing_solar_mutex_reset_ptr<OutputDevice> m_aStdRefDevice; SfxPoolItem** ppDefItems; - OutputDevice* pStdRefDevice; - vos::ORef<SvxForbiddenCharactersTable> xForbiddenCharsTable; + rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharsTable; public: GlobalEditData(); @@ -51,11 +53,12 @@ public: SfxPoolItem** GetDefItems(); OutputDevice* GetStdRefDevice(); - vos::ORef<SvxForbiddenCharactersTable> GetForbiddenCharsTable(); - void SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars ) { xForbiddenCharsTable = xForbiddenChars; } + rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable(); + void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ) { xForbiddenCharsTable = xForbiddenChars; } ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > GetLanguageGuesser(); }; #endif //_EERDLL2_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index a2e82b6a8844..b65ffe52c547 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,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(); } @@ -86,11 +87,10 @@ EditRTFParser::EditRTFParser( SvStream& rIn, EditSelection aSel, SfxItemPool& rA SetInsPos( EditPosition( pImpEditEngine, &aCurSel ) ); - // Umwandeln der Twips-Werte... + // Convert the twips values ... SetCalcValue( sal_True ); SetChkStyleAttr( pImpEE->GetStatus().DoImportRTFStyleSheets() ); - SetNewDoc( sal_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() ); } @@ -98,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() ) { @@ -135,7 +135,7 @@ SvParserState __EXPORT EditRTFParser::CallParser() ContentNode* pCurNode = aCurSel.Max().GetNode(); 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,9 +144,9 @@ SvParserState __EXPORT EditRTFParser::CallParser() EditPaM aEnd2PaM( aCurSel.Max() ); //AddRTFDefaultValues( aStart2PaM, aEnd2PaM ); sal_Bool bOnlyOnePara = ( aEnd2PaM.GetNode() == aStart2PaM.GetNode() ); - // Den Brocken wieder einfuegen... - // Problem: Absatzattribute duerfen ggf. nicht uebernommen werden - // => Zeichenattribute machen. + // Paste the chunk again ... + // Problem: Paragraph attributes may not possibly be taken over + // => Do Character attributes. sal_Bool bSpecialBackward = aStart1PaM.GetNode()->Len() ? sal_False : sal_True; if ( bOnlyOnePara || aStart1PaM.GetNode()->Len() ) @@ -154,7 +154,7 @@ SvParserState __EXPORT EditRTFParser::CallParser() aCurSel.Min() = pImpEditEngine->ImpConnectParagraphs( aStart1PaM.GetNode(), aStart2PaM.GetNode(), bSpecialBackward ); bSpecialBackward = aEnd1PaM.GetNode()->Len() ? sal_True : sal_False; - // wenn bOnlyOnePara, dann ist der Node beim Connect verschwunden. + // when bOnlyOnePara, then the node is gone on Connect. if ( !bOnlyOnePara && aEnd1PaM.GetNode()->Len() ) pImpEditEngine->ParaAttribsToCharAttribs( aEnd2PaM.GetNode() ); aCurSel.Max() = pImpEditEngine->ImpConnectParagraphs( @@ -166,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() ); @@ -181,7 +181,7 @@ void EditRTFParser::AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& r 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 ) ) @@ -189,7 +189,7 @@ void EditRTFParser::AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& r } } -void __EXPORT EditRTFParser::NextToken( int nToken ) +void EditRTFParser::NextToken( int nToken ) { switch( nToken ) { @@ -241,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 ) ); @@ -254,7 +254,7 @@ void __EXPORT EditRTFParser::UnknownAttrToken( int nToken, SfxItemSet* ) } } -void __EXPORT EditRTFParser::InsertText() +void EditRTFParser::InsertText() { String aText( aToken ); if ( pImpEditEngine->aImportHdl.IsSet() ) @@ -267,7 +267,7 @@ void __EXPORT EditRTFParser::InsertText() nLastAction = ACTION_INSERTTEXT; } -void __EXPORT EditRTFParser::InsertPara() +void EditRTFParser::InsertPara() { if ( pImpEditEngine->aImportHdl.IsSet() ) { @@ -278,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 ); @@ -286,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, +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(); sal_uInt16 nCurPara = pImpEditEngine->GetEditDoc().GetPos( pN ); - DBG_ASSERT( nCurPara != 0, "Absatz gleich 0: SetEnfPrevPara" ); + DBG_ASSERT( nCurPara != 0, "Paragraph equal to 0: SetEnfPrevPara" ); if ( nCurPara ) nCurPara--; ContentNode* pPrevNode = pImpEditEngine->GetEditDoc().SaveGetObject( nCurPara ); @@ -305,12 +304,12 @@ void __EXPORT EditRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos, rCntPos = pPrevNode->Len(); } -int __EXPORT EditRTFParser::IsEndPara( SvxNodeIdx* pNd, sal_uInt16 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(); @@ -318,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 @@ -348,7 +347,7 @@ void __EXPORT EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) 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(); @@ -375,7 +374,7 @@ void __EXPORT EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) 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 ) ); @@ -383,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... + // 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 @@ -412,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 ); @@ -445,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; @@ -462,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() ); } @@ -485,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(); @@ -498,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(); @@ -508,8 +506,8 @@ void __EXPORT EditRTFParser::CalcValue() void EditRTFParser::ReadField() { - // Aus SwRTFParser::ReadField() - int _nOpenBrakets = 1; // die erste wurde schon vorher erkannt + // From SwRTFParser::ReadField() + int _nOpenBrakets = 1; // the first was already detected earlier sal_Bool bFldInst = sal_False; sal_Bool bFldRslt = sal_False; String aFldInst; @@ -573,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() ) { @@ -598,36 +596,38 @@ void EditRTFParser::SkipGroup() } } - SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet + SkipToken( -1 ); // the closing brace is evaluated "above" } -sal_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() ); } -sal_uLong __EXPORT EditPosition::GetNodeIdx() const +sal_uLong EditPosition::GetNodeIdx() const { ContentNode* pN = pCurSel->Max().GetNode(); return pImpEditEngine->GetEditDoc().GetPos( pN ); } -sal_uInt16 __EXPORT EditPosition::GetCntIdx() const +sal_uInt16 EditPosition::GetCntIdx() const { return pCurSel->Max().GetIndex(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/eertfpar.hxx b/editeng/source/editeng/eertfpar.hxx index 189f97b332ee..30cb2bef94ec 100644 --- a/editeng/source/editeng/eertfpar.hxx +++ b/editeng/source/editeng/eertfpar.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,8 +33,6 @@ #include <editdoc.hxx> #include <impedit.hxx> -#ifndef SVX_LIGHT - class EditNodeIdx : public SvxNodeIdx { private: @@ -61,10 +60,10 @@ public: 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; }; @@ -124,5 +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 d2a25f327fd9..6f38cd995840 100755..100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,7 +47,7 @@ #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <editeng/flditem.hxx> #include <svl/intitem.hxx> #include <svtools/transfer.hxx> @@ -58,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 ) { @@ -122,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() ) @@ -140,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; @@ -165,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(); @@ -183,12 +183,11 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion ) ContentNode* pEndNode = aTmpSel.Max().GetNode(); sal_uInt16 nStartPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( pStartNode ); sal_uInt16 nEndPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( pEndNode ); - // ueber die Absaetze iterieren.... 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; @@ -206,11 +205,10 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion ) if ( nPara == nEndPara ) nEndLine = pTmpPortion->GetLines().FindLine( aTmpSel.Max().GetIndex(), sal_True ); - // ueber die Zeilen iterieren.... 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()" ); sal_Bool bPartOfLine = sal_False; sal_uInt16 nStartIndex = pLine->GetStart(); @@ -226,7 +224,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion ) 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; @@ -237,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; @@ -347,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() ) @@ -366,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() ) @@ -385,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; @@ -413,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; @@ -440,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; @@ -579,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 ) @@ -636,7 +634,7 @@ void ImpEditView::CalcAnchorPoint() 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; @@ -644,8 +642,8 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa 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 ) @@ -708,56 +706,56 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa } 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(); @@ -769,7 +767,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa 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; @@ -803,7 +801,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa } } - // Cursor evtl. etwas stutzen... + // Cursor may trim a little ... if ( ( aEditCursor.Bottom() > GetVisDocTop() ) && ( aEditCursor.Top() < GetVisDocBottom() ) ) { @@ -846,10 +844,8 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa GetCursor()->SetOrientation( 2700 ); } else - // --> FME 2004-10-18 #i32593# - // Reset correct orientation in horizontal layout + // #i32593# Reset correct orientation in horizontal layout GetCursor()->SetOrientation( 0 ); - // <-- GetCursor()->SetSize( aCursorSz ); @@ -869,9 +865,6 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa 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 ); @@ -890,7 +883,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa 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 ); @@ -898,7 +891,7 @@ Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 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() ); @@ -917,9 +910,9 @@ Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 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() ); @@ -937,13 +930,13 @@ Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck ) } if ( ( nRangeCheck == RGCHK_PAPERSZ1 ) && ( aNewVisArea.Right() > (long)pEditEngine->pImpEditEngine->CalcTextWidth( sal_False ) ) ) { - long nDiff = pEditEngine->pImpEditEngine->CalcTextWidth( sal_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() ); @@ -967,7 +960,8 @@ Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 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 ); @@ -993,7 +987,7 @@ Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck ) return Pair( nRealDiffX, nRealDiffY ); } -sal_Bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent ) +sal_Bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin ) { sal_Bool bDone = sal_False; @@ -1037,7 +1031,7 @@ sal_Bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent ) } if( !bDone ) - bDone = pEditEngine->PostKeyEvent( rKeyEvent, GetEditViewPtr() ); + bDone = pEditEngine->PostKeyEvent( rKeyEvent, GetEditViewPtr(), pFrameWin ); return bDone; } @@ -1074,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; @@ -1091,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() ); } @@ -1108,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(); @@ -1139,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(); } @@ -1149,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 { @@ -1168,7 +1159,6 @@ String ImpEditView::SpellIgnoreOrAddWord( sal_Bool bAdd ) pEditEngine->pImpEditEngine->StartOnlineSpellTimer(); } } -#endif // !SVX_LIGHT return aWord; } @@ -1197,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; } @@ -1209,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 ) @@ -1408,7 +1398,7 @@ sal_Bool ImpEditView::IsSelectionAtPoint( const Point& rPosPixel ) Point aMousePos( rPosPixel ); - // Logische Einheiten... + // Logical units ... aMousePos = GetWindow()->PixelToLogic( aMousePos ); if ( ( !GetOutputArea().IsInside( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() ) @@ -1427,7 +1417,7 @@ sal_Bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel ) Point aMousePos( rPointPixel ); - // Logische Einheiten... + // Logical units ... aMousePos = GetWindow()->PixelToLogic( aMousePos ); if ( ( !GetOutputArea().IsInside( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() ) @@ -1437,18 +1427,16 @@ sal_Bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel ) 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 ); 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 ); - // --> OD 2005-12-16 #i27299# + // #i27299# // work on copy of current selection and set new selection, if it has changed. EditSelection aNewEditSelection( GetEditSelection() ); @@ -1469,7 +1457,6 @@ sal_Bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel ) { SetEditSelection( aNewEditSelection ); } - // <-- sal_Bool bForceCursor = ( pDragAndDropInfo ? sal_False : sal_True ) && !pEditEngine->pImpEditEngine->IsInSelectionMode(); ShowCursor( bGotoCursor, bForceCursor ); @@ -1497,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; @@ -1518,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 @@ -1528,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; @@ -1542,7 +1529,7 @@ void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::d { DBG_ASSERT( !pDragAndDropInfo, "dragGestureRecognized - DragAndDropInfo exist!" ); - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; pDragAndDropInfo = NULL; @@ -1602,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(); @@ -1614,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(); } @@ -1622,7 +1609,7 @@ void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::d void ImpEditView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& rDSDE ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; DBG_ASSERT( pDragAndDropInfo, "ImpEditView::dragDropEnd: pDragAndDropInfo is NULL!" ); @@ -1633,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, @@ -1642,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; @@ -1663,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; @@ -1684,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 ) { @@ -1696,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(); } @@ -1715,7 +1702,7 @@ void ImpEditView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSo void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; DBG_ASSERT( pDragAndDropInfo, "Drop - No Drag&Drop info?!" ); @@ -1743,7 +1730,7 @@ void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDro if ( xDataObj.is() ) { bChanges = sal_True; - // Selektion wegmalen... + // remove Selection ... DrawSelection(); EditPaM aPaM( pDragAndDropInfo->aDropDest ); @@ -1761,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() ); @@ -1788,7 +1775,7 @@ void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDro void ImpEditView::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& rDTDEE ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; if ( !pDragAndDropInfo ) pDragAndDropInfo = new DragAndDropInfo( ); @@ -1815,7 +1802,7 @@ void ImpEditView::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTarg void ImpEditView::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; HideDDCursor(); @@ -1828,7 +1815,7 @@ void ImpEditView::dragExit( const ::com::sun::star::datatransfer::dnd::DropTarge void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; Point aMousePos( rDTDE.LocationX, rDTDE.LocationY ); aMousePos = GetWindow()->PixelToLogic( aMousePos ); @@ -1837,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; @@ -1848,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() ) ) @@ -1892,7 +1877,7 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge } 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() ); @@ -2003,3 +1988,5 @@ void ImpEditView::RemoveDragAndDropListeners() bActiveDragAndDropListener = sal_False; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 1ac4c32f4af8..108c2f4d2add 100755..100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,7 +55,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <i18npool/lang.h> -#include <vos/ref.hxx> +#include <rtl/ref.hxx> DBG_NAMEEX( EditView ) DBG_NAMEEX( EditEngine ) @@ -92,6 +93,8 @@ class TextRanger; class SvKeyValueIterator; class SvxForbiddenCharactersTable; class SvtCTLOptions; +class Window; + #include <editeng/SpellPortions.hxx> #include <editeng/eedata.hxx> @@ -289,7 +292,7 @@ public: sal_Bool IsVertical() const; - sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent ); + sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL ); sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent ); sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent ); @@ -332,7 +335,7 @@ public: 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 ); @@ -373,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; } }; @@ -387,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; @@ -399,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; @@ -493,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; @@ -517,11 +521,11 @@ private: Link maBeginDropHdl; Link maEndDropHdl; - vos::ORef<SvxForbiddenCharactersTable> xForbiddenCharsTable; + rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharsTable; // ================================================================ - // Methoden... + // Methods... // ================================================================ void CursorMoved( ContentNode* pPrevNode ); @@ -529,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; } @@ -646,7 +650,7 @@ private: SvxFontTable& rFontTable, SvxColorList& rColorList ); sal_Bool WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, sal_uInt16 nPara, sal_uInt16 nPos, SvxFontTable& rFontTable, SvxColorList& rColorList ); - long LogicToTwips( long n ); + sal_Int32 LogicToTwips( sal_Int32 n ); inline short GetXValue( short nXValue ) const; inline sal_uInt16 GetXValue( sal_uInt16 nXValue ) const; @@ -664,6 +668,8 @@ private: void SetBackgroundColor( const Color& rColor ) { maBackgroundColor = rColor; } Color GetBackgroundColor() const { return maBackgroundColor; } + long CalcVertLineSpacing(Point& rStartPos) const; + Color GetAutoColor() const; void EnableAutoColor( sal_Bool b ) { bUseAutoColor = b; } sal_Bool IsAutoColorEnabled() const { return bUseAutoColor; } @@ -781,7 +787,7 @@ 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, sal_Bool bOverwrite ); + 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 ); @@ -801,8 +807,9 @@ 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 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; @@ -839,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 ); @@ -986,6 +993,8 @@ public: const SvxLRSpaceItem& GetLRSpaceItem( ContentNode* pNode ); 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 ); @@ -1015,8 +1024,8 @@ public: void SetAddExtLeading( sal_Bool b ); sal_Bool IsAddExtLeading() const { return bAddExtLeading; } - vos::ORef<SvxForbiddenCharactersTable> GetForbiddenCharsTable( sal_Bool bGetInternal = sal_True ) const; - void SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars ); + rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable( sal_Bool bGetInternal = sal_True ) const; + void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ); sal_Bool mbLastTryMerge; @@ -1041,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 ); } @@ -1060,14 +1069,14 @@ 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; } @@ -1101,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 { @@ -1212,3 +1219,4 @@ Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin ); #endif // _IMPEDIT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 352ff91d2e9e..df8d6d5e810d 100755..100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,6 +59,7 @@ #include <editeng/scripttypeitem.hxx> #include <editeng/frmdiritem.hxx> #include <editeng/fontitem.hxx> +#include <editeng/justifyitem.hxx> #include <vcl/cmdevt.h> #include <com/sun/star/i18n/CharacterIteratorMode.hpp> @@ -78,18 +80,6 @@ using namespace ::com::sun::star; sal_uInt16 lcl_CalcExtraSpace( ParaPortion*, const SvxLineSpacingItem& rLSItem ) { sal_uInt16 nExtra = 0; - /* if ( ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) - && ( rLSItem.GetPropLineSpace() != 100 ) ) - { - // sal_uLong nH = pPortion->GetNode()->GetCharAttribs().GetDefFont().GetSize().Height(); - sal_uLong nH = pPortion->GetLines().GetObject( 0 )->GetHeight(); - long n = nH * rLSItem.GetPropLineSpace(); - n /= 100; - n -= nH; // nur den Abstand - if ( n > 0 ) - nExtra = (sal_uInt16)n; - } - else */ if ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) { nExtra = rLSItem.GetInterLineSpace(); @@ -98,10 +88,6 @@ sal_uInt16 lcl_CalcExtraSpace( ParaPortion*, const SvxLineSpacingItem& rLSItem ) return nExtra; } -// ---------------------------------------------------------------------- -// class ImpEditEngine -// ---------------------------------------------------------------------- - ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : aPaperSize( 0x7FFFFFFF, 0x7FFFFFFF ), aMinAutoPaperSize( 0x0, 0x0 ), @@ -127,6 +113,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : pCTLOptions = NULL; nCurTextHeight = 0; + nCurTextHeightNTP = 0; nBlockNotifications = 0; nBigTextObjectStart = 20; @@ -173,9 +160,9 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : aOnlineSpellTimer.SetTimeout( 100 ); aOnlineSpellTimer.SetTimeoutHdl( LINK( this, ImpEditEngine, OnlineSpellHdl ) ); - pRefDev = EE_DLL()->GetGlobalData()->GetStdRefDevice(); + pRefDev = EE_DLL().GetGlobalData()->GetStdRefDevice(); - // Ab hier wird schon auf Daten zugegriffen! + // Access data already from here on! SetRefDevice( pRefDev ); InitDoc( sal_False ); @@ -192,9 +179,9 @@ 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! + // 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 ); @@ -219,7 +206,7 @@ void ImpEditEngine::SetRefDevice( OutputDevice* pRef ) bOwnerOfRefDev = sal_False; if ( !pRef ) - pRefDev = EE_DLL()->GetGlobalData()->GetStdRefDevice(); + pRefDev = EE_DLL().GetGlobalData()->GetStdRefDevice(); nOnePixelInRef = (sal_uInt16)pRefDev->PixelToLogic( Size( 1, 0 ) ).Width(); @@ -235,8 +222,8 @@ void ImpEditEngine::SetRefMapMode( const MapMode& rMapMode ) if ( GetRefDevice()->GetMapMode() == rMapMode ) return; - // Wenn RefDev == GlobalRefDev => eigenes anlegen! - if ( !bOwnerOfRefDev && ( pRefDev == EE_DLL()->GetGlobalData()->GetStdRefDevice() ) ) + // When RefDev == GlobalRefDev => create own! + if ( !bOwnerOfRefDev && ( pRefDev == EE_DLL().GetGlobalData()->GetStdRefDevice() ) ) { pRefDev = new VirtualDevice; pRefDev->SetMapMode( MAP_TWIP ); @@ -279,10 +266,8 @@ void ImpEditEngine::InitDoc( sal_Bool bKeepParaAttribs ) GetEditEnginePtr()->ParagraphInserted( 0 ); } -#ifndef SVX_LIGHT if ( GetStatus().DoOnlineSpelling() ) aEditDoc.GetObject( 0 )->CreateWrongList(); -#endif // !SVX_LIGHT } EditPaM ImpEditEngine::DeleteSelected( EditSelection aSel ) @@ -307,19 +292,19 @@ XubString ImpEditEngine::GetSelected( const EditSelection& rSel, const LineEnd e 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... + // 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 ); @@ -338,13 +323,13 @@ sal_Bool ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pVie 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. + // So that the SelectionEngine knows about the anchor. aSelEngine.CursorPosChanging( sal_True, sal_False ); EditSelection aNewSelection( SelectWord( aCurSel ) ); @@ -355,7 +340,7 @@ sal_Bool ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pVie } else if ( rMEvt.GetClicks() == 3 ) { - // damit die SelectionEngine weiss, dass Anker. + // So that the SelectionEngine knows about the anchor. aSelEngine.CursorPosChanging( sal_True, sal_False ); EditSelection aNewSelection( aCurSel ); @@ -379,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() ) @@ -493,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 @@ -534,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(); @@ -568,7 +552,7 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) 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 ); @@ -677,7 +661,7 @@ sal_Bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, EditView* pView GetSelEngine().SetCurView( pView ); GetSelEngine().SelMouseButtonUp( rMEvt ); bInSelection = sal_False; - // Sonderbehandlungen + // Special treatments EditSelection aCurSel( pView->pImpEditView->GetEditSelection() ); if ( !aCurSel.HasRange() ) { @@ -697,9 +681,7 @@ sal_Bool ImpEditEngine::MouseButtonUp( 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(), sal_True ); + // MouseMove is called directly after ShowQuickHelp()! GetSelEngine().SetCurView( pView ); GetSelEngine().SelMouseMove( rMEvt ); return sal_True; @@ -719,6 +701,7 @@ EditPaM ImpEditEngine::Clear() EditSelection aSel( aPaM ); nCurTextHeight = 0; + nCurTextHeightNTP = 0; ResetUndoManager(); @@ -751,10 +734,10 @@ EditPaM ImpEditEngine::RemoveText() void ImpEditEngine::SetText( const XubString& rText ) { - // RemoveText loescht die Undo-Liste! + // RemoveText deletes the undo list! EditPaM aStartPaM = RemoveText(); sal_Bool bUndoCurrentlyEnabled = IsUndoEnabled(); - // Der von Hand reingesteckte Text kann nicht vom Anwender rueckgaengig gemacht werden. + // The text inserted manually can not be made reversable by the user EnableUndo( sal_False ); EditSelection aEmptySel( aStartPaM, aStartPaM ); @@ -767,8 +750,8 @@ void ImpEditEngine::SetText( const XubString& rText ) 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(), @@ -777,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?" ); } @@ -804,7 +787,7 @@ 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() ); } @@ -824,31 +807,31 @@ void ImpEditEngine::TextModified() void ImpEditEngine::ParaAttribsChanged( ContentNode* pNode ) { - DBG_ASSERT( pNode, "ParaAttribsChanged: Welcher?" ); + OSL_ENSURE( pNode, "ParaAttribsChanged: Which one?" ); 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() ); 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() ); @@ -874,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(); @@ -1008,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 ); } @@ -1041,7 +1017,6 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& if ( !bEmptyLine ) { String aLine( *aPaM.GetNode(), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart() ); -// sal_uInt16 nPosInLine = aPaM.GetIndex() - pLine->GetStart(); const sal_Unicode* pLineString = aLine.GetBuffer(); @@ -1062,7 +1037,6 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTmp, sal_True ); TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion ); sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft(); -// sal_Bool bParaRTL = IsRightToLeft( nPara ); sal_Bool bPortionRTL = nRTLLevel%2 ? sal_True : sal_False; if ( bStart ) @@ -1094,7 +1068,6 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM EditLine* pLine = pParaPortion->GetLines().GetObject( nLine ); sal_Bool bEmptyLine = pLine->GetStart() == pLine->GetEnd(); -// sal_uInt16 nCurrentCursorFlags = pEditView->pImpEditView->nExtraCursorFlags; pEditView->pImpEditView->nExtraCursorFlags = 0; sal_Bool bParaRTL = IsRightToLeft( nPara ); @@ -1220,8 +1193,6 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM { if ( bWasBehind || bRTLPortion || bBeforePortion ) nVisPos++; -// if ( bWasBehind && bRTLPortion ) -// nVisPos++; } bGotoEndOfPrevLine = nVisPos < 0; @@ -1231,31 +1202,19 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM { sal_uInt16 nLogPos = (sal_uInt16)ubidi_getLogicalIndex( pBidi, nVisPos, &nError ); -/* - if ( nLogPos == aPaM.GetIndex() ) - { - if ( bVisualToLeft ) - bGotoEndOfPrevLine = sal_True; - else - bGotoStartOfNextLine = sal_True; - } - else -*/ - { - 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 ); - } + 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 ); } } @@ -1330,10 +1289,10 @@ EditPaM ImpEditEngine::CursorRight( const EditPaM& rPaM, sal_uInt16 nCharacterIt 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" ); + OSL_ENSURE( pPPortion, "No matching portion found: CursorUp "); sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); EditLine* pLine = pPPortion->GetLines().GetObject( nLine ); @@ -1347,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 ) ); } @@ -1374,10 +1334,10 @@ 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" ); + OSL_ENSURE( pPPortion, "No matching portion found: CursorDown" ); sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); long nX; @@ -1395,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 ); @@ -1421,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 ?" ); + 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() ); @@ -1434,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 ?" ); + 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 ); } } @@ -1484,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 ); } @@ -1531,7 +1490,7 @@ EditPaM ImpEditEngine::WordLeft( const EditPaM& rPaM, sal_Int16 nWordType ) EditPaM aNewPaM( rPaM ); if ( nCurrentPos == 0 ) { - // Vorheriger Absatz... + // Previous paragraph... sal_uInt16 nCurPara = aEditDoc.GetPos( aNewPaM.GetNode() ); ContentNode* pPrevNode = aEditDoc.SaveGetObject( --nCurPara ); if ( pPrevNode ) @@ -1579,7 +1538,7 @@ EditPaM ImpEditEngine::WordRight( const EditPaM& rPaM, sal_Int16 nWordType ) // not 'else', maybe the index reached nMax now... if ( aNewPaM.GetIndex() >= nMax ) { - // Naechster Absatz... + // Next paragraph ... sal_uInt16 nCurPara = aEditDoc.GetPos( aNewPaM.GetNode() ); ContentNode* pNextNode = aEditDoc.SaveGetObject( ++nCurPara ); if ( pNextNode ) @@ -1670,7 +1629,7 @@ 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"); + 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; @@ -1697,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 ) @@ -1846,18 +1802,6 @@ void ImpEditEngine::InitScriptTypes( sal_uInt16 nPara ) rTypes[nIdx].nStartPos = nEnd; } } - -#if OSL_DEBUG_LEVEL > 1 - sal_uInt16 nDebugStt = 0; - sal_uInt16 nDebugEnd = 0; - short nDebugType = 0; - for ( size_t n = 0; n < rTypes.size(); ++n ) - { - nDebugStt = rTypes[n].nStartPos; - nDebugEnd = rTypes[n].nEndPos; - nDebugType = rTypes[n].nScriptType; - } -#endif } } @@ -2087,7 +2031,6 @@ sal_Bool ImpEditEngine::HasDifferentRTLLevels( const ContentNode* pNode ) sal_uInt8 ImpEditEngine::GetRightToLeft( sal_uInt16 nPara, sal_uInt16 nPos, sal_uInt16* pStart, sal_uInt16* pEnd ) { -// sal_uInt8 nRightToLeft = IsRightToLeft( nPara ) ? 1 : 0; sal_uInt8 nRightToLeft = 0; ContentNode* pNode = aEditDoc.SaveGetObject( nPara ); @@ -2097,7 +2040,6 @@ sal_uInt8 ImpEditEngine::GetRightToLeft( sal_uInt16 nPara, sal_uInt16 nPos, sal_ if ( pParaPortion->aWritingDirectionInfos.empty() ) InitWritingDirections( nPara ); -// sal_uInt8 nType = 0; WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos; for ( size_t n = 0; n < rDirInfos.size(); n++ ) { @@ -2134,9 +2076,22 @@ SvxAdjust ImpEditEngine::GetJustification( sal_uInt16 nPara ) const return eJustification; } +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( 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, sal_uInt16 nChars, EditUndoRemoveChars* pCurUndo ) @@ -2145,31 +2100,26 @@ void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, sal_uInt16 nChars, Edit { XubString aStr( rPaM.GetNode()->Copy( rPaM.GetIndex(), nChars ) ); - // Pruefen, ob Attribute geloescht oder geaendert werden: + // Check whether attributes are deleted or changed: sal_uInt16 nStart = rPaM.GetIndex(); sal_uInt16 nEnd = nStart + nChars; CharAttribArray& rAttribs = rPaM.GetNode()->GetCharAttribs().GetAttribs(); -// sal_uInt16 nAttrs = rAttribs.Count(); 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 ); @@ -2180,8 +2130,8 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16 { aOldPositions.Justify(); sal_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" ); + OSL_ENSURE( bValidAction, "Move in itself?" ); + OSL_ENSURE( aOldPositions.Max() <= (long)GetParaPortions().Count(), "totally over it: MoveParagraphs" ); EditSelection aSelection; @@ -2232,14 +2182,14 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16 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; sal_uInt16 i; for ( i = (sal_uInt16)aOldPositions.Min(); i <= (sal_uInt16)aOldPositions.Max(); i++ ) { - // Immer aOldPositions.Min(), da Remove(). + // 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() ); @@ -2247,7 +2197,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16 } sal_uInt16 nRealNewPos = pDestPortion ? GetParaPortions().GetPos( pDestPortion ) : GetParaPortions().Count(); - DBG_ASSERT( nRealNewPos != USHRT_MAX, "ImpMoveParagraphs: Ungueltige Position!" ); + OSL_ENSURE( nRealNewPos != USHRT_MAX, "ImpMoveParagraphs: Invalid Position!" ); for ( i = 0; i < (sal_uInt16)aTmpPortionList.Count(); i++ ) { @@ -2287,7 +2237,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16 if ( pRecalc4 ) CalcHeight( pRecalc4 ); - aTmpPortionList.Remove( 0, aTmpPortionList.Count() ); // wichtig ! + aTmpPortionList.Remove( 0, aTmpPortionList.Count() ); // important ! #ifdef EDITDEBUG GetParaPortions().DbgCheck(aEditDoc); @@ -2298,9 +2248,9 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16 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)" ); sal_uInt16 nParagraphTobeDeleted = aEditDoc.GetPos( pRight ); DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pRight, nParagraphTobeDeleted ); @@ -2308,7 +2258,6 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR GetEditEnginePtr()->ParagraphConnected( aEditDoc.GetPos( pLeft ), aEditDoc.GetPos( pRight ) ); -#ifndef SVX_LIGHT if ( IsUndoEnabled() && !IsInUndo() ) { InsertUndo( new EditUndoConnectParas( this, @@ -2316,7 +2265,6 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR pLeft->GetContentAttribs().GetItems(), pRight->GetContentAttribs().GetItems(), pLeft->GetStyleSheet(), pRight->GetStyleSheet(), bBackward ) ); } -#endif if ( bBackward ) { @@ -2327,26 +2275,25 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR 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: + // 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; @@ -2354,7 +2301,6 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR } } } -#endif if ( IsCallParaInsertedOrDeleted() ) GetEditEnginePtr()->ParagraphDeleted( nParagraphTobeDeleted ); @@ -2365,13 +2311,12 @@ 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... + // 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 ); @@ -2387,9 +2332,9 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR 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() ); @@ -2412,7 +2357,7 @@ EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, sal_uInt8 n aDelStart.SetIndex( 0 ); if ( aDelStart == aCurPos ) { - // kompletter Absatz davor + // Complete paragraph previous ContentNode* pPrev = GetPrevVisNode( aCurPos.GetNode() ); if ( pPrev ) aDelStart = EditPaM( pPrev, 0 ); @@ -2448,7 +2393,7 @@ EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, sal_uInt8 n 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() ); @@ -2456,12 +2401,12 @@ EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, sal_uInt8 n } } - // 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) + // Decide now if to delete selection (RESTOFCONTENTS) sal_Bool bSpecialBackward = ( ( nMode == DEL_LEFT ) && ( nDelMode == DELMODE_SIMPLE ) ) ? sal_True : sal_False; if ( aStatus.IsAnyOutliner() ) @@ -2479,43 +2424,43 @@ 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" ); 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.... + // 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... + // 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 @@ -2524,7 +2469,7 @@ EditPaM ImpEditEngine::ImpDeleteSelection( EditSelection aSel ) 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() ); } @@ -2539,13 +2484,13 @@ void ImpEditEngine::ImpRemoveParagraph( sal_uInt16 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( (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; @@ -2555,17 +2500,15 @@ void ImpEditEngine::ImpRemoveParagraph( sal_uInt16 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() ) @@ -2574,11 +2517,11 @@ void ImpEditEngine::ImpRemoveParagraph( sal_uInt16 nPara ) } } -EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, sal_Bool bOverwrite ) +EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, + sal_Bool bOverwrite, Window* pFrameWin ) { EditSelection aSel( rCurSel ); -#ifndef SVX_LIGHT - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); if ( pAutoCorrect ) { if ( aSel.HasRange() ) @@ -2624,14 +2567,13 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, ContentNode* pNode = aSel.Max().GetNode(); sal_uInt16 nIndex = aSel.Max().GetIndex(); EdtAutoCorrDoc aAuto( this, pNode, nIndex, c ); - pAutoCorrect->AutoCorrect( aAuto, *pNode, nIndex, c, !bOverwrite ); + pAutoCorrect->AutoCorrect( aAuto, *pNode, nIndex, c, !bOverwrite, pFrameWin ); aSel.Max().SetIndex( aAuto.GetCursor() ); // #i78661 since the SvxAutoCorrect object used here is // shared we need to reset the value to it's original state. pAutoCorrect->SetAutoCorrFlag( CptlSttSntnc, bOldCptlSttSntnc ); } -#endif // !SVX_LIGHT return aSel.Max(); } @@ -2639,8 +2581,8 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel, 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() ); @@ -2658,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 ); } @@ -2728,9 +2670,9 @@ EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel, 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(); @@ -2751,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 @@ -2765,18 +2707,18 @@ 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 ! sal_uInt16 nStart = 0; while ( nStart < aText.Len() ) { 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 ); @@ -2784,13 +2726,11 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS if ( nChars > MAXCHARSINPARA ) { sal_uInt16 nMaxNewChars = MAXCHARSINPARA-aPaM.GetNode()->Len(); - nEnd -= ( aLine.Len() - nMaxNewChars ); // Dann landen die Zeichen im naechsten Absatz. - aLine.Erase( nMaxNewChars ); // Del Rest... + 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 ); @@ -2801,20 +2741,19 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS { 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" ); if ( GetStatus().DoOnlineSpelling() ) { @@ -2842,16 +2781,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(); @@ -2875,14 +2812,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(); @@ -2905,30 +2840,28 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( const EditPaM& rPaM, sal_Bool bKeepEn { 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: + // 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() ); @@ -2944,18 +2877,16 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( const EditPaM& rPaM, sal_Bool bKeepEn 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. + // 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 ); @@ -2963,34 +2894,30 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( const EditPaM& rPaM, sal_Bool bKeepEn 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( 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 ); @@ -3008,7 +2935,7 @@ EditPaM ImpEditEngine::InsertParaBreak( EditSelection aCurSel ) if ( aStatus.DoAutoIndenting() ) { sal_uInt16 nPara = aEditDoc.GetPos( aPaM.GetNode() ); - DBG_ASSERT( nPara > 0, "AutoIndenting: Fehler!" ); + OSL_ENSURE( nPara > 0, "AutoIndenting: Error!" ); XubString aPrevParaText( GetEditDoc().GetParaAsString( nPara-1 ) ); sal_uInt16 n = 0; while ( ( n < aPrevParaText.Len() ) && @@ -3045,9 +2972,8 @@ sal_Bool ImpEditEngine::UpdateFields() { 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(); -// sal_uInt16 nAttrs = rAttribs.Count(); for ( sal_uInt16 nAttr = 0; nAttr < rAttribs.Count(); nAttr++ ) { EditCharAttrib* pAttr = rAttribs[nAttr]; @@ -3075,9 +3001,9 @@ sal_Bool ImpEditEngine::UpdateFields() } 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() ); } } @@ -3091,11 +3017,11 @@ EditPaM ImpEditEngine::InsertLineBreak( EditSelection aCurSel ) } // ---------------------------------------------------------------------- -// Hilfsfunktionen +// Helper functions // ---------------------------------------------------------------------- Rectangle ImpEditEngine::PaMtoEditCursor( EditPaM aPaM, sal_uInt16 nFlags ) { - DBG_ASSERT( GetUpdateMode(), "Darf bei Update=sal_False nicht erreicht werden: PaMtoEditCursor" ); + OSL_ENSURE( GetUpdateMode(), "Must not be reached when Update=FALSE: PaMtoEditCursor" ); Rectangle aEditCursor; long nY = 0; @@ -3103,7 +3029,7 @@ Rectangle ImpEditEngine::PaMtoEditCursor( EditPaM aPaM, sal_uInt16 nFlags ) { 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(); @@ -3116,13 +3042,13 @@ Rectangle ImpEditEngine::PaMtoEditCursor( EditPaM aPaM, sal_uInt16 nFlags ) return aEditCursor; } } - DBG_ERROR( "Portion nicht gefunden!" ); + OSL_FAIL( "Portion not found!" ); return aEditCursor; } EditPaM ImpEditEngine::GetPaM( Point aDocPos, sal_Bool bSmart ) { - DBG_ASSERT( GetUpdateMode(), "Darf bei Update=sal_False nicht erreicht werden: GetPaM" ); + OSL_ENSURE( GetUpdateMode(), "Must not be reached when Update=FALSE: GetPaM" ); long nY = 0; long nTmpHeight; @@ -3131,30 +3057,30 @@ EditPaM ImpEditEngine::GetPaM( Point aDocPos, sal_Bool bSmart ) 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; @@ -3162,15 +3088,15 @@ EditPaM ImpEditEngine::GetPaM( Point aDocPos, sal_Bool bSmart ) sal_uInt32 ImpEditEngine::GetTextHeight() const { - DBG_ASSERT( GetUpdateMode(), "Sollte bei Update=sal_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( 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(); @@ -3180,11 +3106,9 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( sal_Bool bIgnoreExtraSpace ) long nCurWidth = 0; // -------------------------------------------------- - // Ueber alle Absaetze... + // Over all the paragraphs ... // -------------------------------------------------- sal_uInt16 nParas = GetParaPortions().Count(); -// sal_uInt16 nBiggestPara = 0; -// sal_uInt16 nBiggestLine = 0; for ( sal_uInt16 nPara = 0; nPara < nParas; nPara++ ) { ParaPortion* pPortion = GetParaPortions().GetObject( nPara ); @@ -3194,18 +3118,18 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( sal_Bool bIgnoreExtraSpace ) sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth( pPortion->GetNode() ); // -------------------------------------------------- - // Ueber die Zeilen des Absatzes... + // On the lines of the paragraph ... // -------------------------------------------------- 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 ) { @@ -3230,7 +3154,7 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( sal_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; } @@ -3246,7 +3170,7 @@ 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; sal_uInt16 nPos = pLine->GetStart(); for ( sal_uInt16 nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ ) @@ -3286,20 +3210,42 @@ 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=sal_False nicht verwendet werden: CalcTextHeight" ); + OSL_ENSURE( GetUpdateMode(), "Should not be used when Update=FALSE: CalcTextHeight" ); sal_uInt32 nY = 0; - for ( sal_uInt16 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; } 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(); @@ -3308,13 +3254,13 @@ sal_uInt16 ImpEditEngine::GetLineCount( sal_uInt16 nParagraph ) 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(); } @@ -3323,14 +3269,14 @@ xub_StrLen ImpEditEngine::GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) 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(); } @@ -3340,12 +3286,12 @@ sal_uInt16 ImpEditEngine::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIn { 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" ); + OSL_ENSURE( bValidIndex, "GetLineNumberAtIndex: invalid index" ); const sal_uInt16 nLineCount = GetLineCount( nPara ); if (nIndex == pNode->Len()) nLineNo = nLineCount > 0 ? nLineCount - 1 : 0; @@ -3365,13 +3311,13 @@ sal_uInt16 ImpEditEngine::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIn 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(); } @@ -3383,7 +3329,7 @@ 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(); @@ -3395,8 +3341,8 @@ void ImpEditEngine::UpdateSelections() { 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! + // 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); @@ -3409,39 +3355,39 @@ void ImpEditEngine::UpdateSelections() 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! + // 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: + 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=sal_True; - break; // for-Schleife + 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(); @@ -3455,7 +3401,7 @@ void ImpEditEngine::UpdateSelections() } } - // Loeschen... + // Delete ... for ( sal_uInt16 n = 0; n < nInvNodes; n++ ) { DeletedNodeInfo* pInf = aDeletedNodes.GetObject( n ); @@ -3522,9 +3468,9 @@ EditSelection ImpEditEngine::MatchGroup( const EditSelection& rSel ) 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 ); sal_uInt16 nCur = aTmpSel.Min().GetIndex()+1; @@ -3552,7 +3498,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 ); @@ -3560,7 +3506,7 @@ EditSelection ImpEditEngine::MatchGroup( const EditSelection& rSel ) } else { - // Rueckwaerts suchen... + // Search backwards... xub_Unicode nEC = aGroupChars.GetChar( nMatchChar ); xub_Unicode nSC = aGroupChars.GetChar( nMatchChar-1 ); @@ -3590,14 +3536,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 ); } } @@ -3609,7 +3555,7 @@ 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 ); @@ -3622,18 +3568,18 @@ void ImpEditEngine::StopSelectionMode() 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, @@ -3652,7 +3598,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() ); @@ -3661,7 +3606,7 @@ uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable( xDataObj = pDataObj; XubString aText( GetSelected( aSelection ) ); - aText.ConvertLineEnd(); // Systemspezifisch + aText.ConvertLineEnd(); // System specific pDataObj->GetString() = aText; SvxFontItem::EnableStoreUnicodeNames( sal_True ); @@ -3694,9 +3639,6 @@ 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, sal_Bool bUseSpecial ) @@ -3732,24 +3674,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 ) ) @@ -3811,7 +3735,7 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion ) sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; - // erst von vorne... + // only from the top ... sal_uInt16 nFirstInvalid = 0xFFFF; sal_uInt16 nLine; for ( nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) @@ -3822,17 +3746,17 @@ 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(); sal_uInt16 nLastInvalid = pPortion->GetLines().Count()-1; @@ -3850,7 +3774,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 ) ) { @@ -3869,8 +3792,8 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion ) 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" ); sal_uInt16 nCurIndex = 0; EditPaM aPaM; @@ -3882,7 +3805,7 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS 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 ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) @@ -3891,26 +3814,26 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS 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 ?" ); - #endif +#if OSL_DEBUG_LEVEL > 0 + const SvxULSpaceItem& rULSpace =(const SvxULSpaceItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE ); + 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 ); @@ -3925,7 +3848,7 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS 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" ); sal_uInt16 nChar = 0xFFFF; sal_uInt16 nCurIndex = pLine->GetStart(); @@ -3971,12 +3894,12 @@ sal_uInt16 ImpEditEngine::GetChar( ParaPortion* pParaPortion, EditLine* pLine, l 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. @@ -3991,13 +3914,13 @@ sal_uInt16 ImpEditEngine::GetChar( ParaPortion* pParaPortion, EditLine* pLine, l } } - // 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; @@ -4066,7 +3989,6 @@ long ImpEditEngine::GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLin case PORTIONKIND_TEXT: case PORTIONKIND_HYPHENATOR: case PORTIONKIND_TAB: -// case PORTIONKIND_EXTRASPACE: { nX += pPortion->GetSize().Width(); } @@ -4107,7 +4029,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() ) { @@ -4134,8 +4056,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(); } @@ -4145,8 +4067,8 @@ long ImpEditEngine::GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLin 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!" ); sal_Bool bDoPreferPortionStart = bPreferPortionStart; // Assure that the portion belongs to this line: @@ -4158,7 +4080,7 @@ long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uIn 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 ); @@ -4183,8 +4105,6 @@ long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uIn 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, sal_True ); else if ( !IsRightToLeft( GetEditDoc().GetPos( pParaPortion->GetNode() ) ) ) @@ -4203,8 +4123,8 @@ long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uIn } 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() ) { @@ -4212,7 +4132,7 @@ long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uIn 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) @@ -4282,7 +4202,7 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion ) if ( pPortion->IsVisible() ) { - DBG_ASSERT( pPortion->GetLines().Count(), "Absatz ohne Zeilen in ParaPortion::CalcHeight" ); + 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(); @@ -4310,7 +4230,7 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion ) if ( ( nPortion != (GetParaPortions().Count()-1) ) ) { - pPortion->nHeight += GetYValue( rULItem.GetLower() ); // nicht in letzter + pPortion->nHeight += GetYValue( rULItem.GetLower() ); // not in the last } @@ -4320,48 +4240,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: + // 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: + // 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 ) { sal_uInt16 nMoreLower = nExtraSpace - nPrevLower; - // Absatz wird 'groesser', 'waechst' nach unten: + // Paragraph becomes 'bigger', 'grows' downwards: if ( nMoreLower > pPortion->nFirstLineOffset ) { pPortion->nHeight += ( nMoreLower - pPortion->nFirstLineOffset ); @@ -4376,14 +4295,14 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion ) 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(); @@ -4393,7 +4312,7 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; sal_uInt16 nCurIndex = 0; - DBG_ASSERT( pPortion->GetLines().Count(), "Leere ParaPortion in GetEditCursor!" ); + OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetEditCursor!" ); EditLine* pLine = 0; sal_Bool bEOL = ( nFlags & GETCRSR_ENDOFLINE ) ? sal_True : sal_False; for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) @@ -4412,8 +4331,8 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex } 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(); @@ -4428,7 +4347,7 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex nY += pLine->GetHeight(); aEditCursor.Bottom() = nY-1; - // innerhalb der Zeile suchen... + // Search within the line... long nX; if ( ( nIndex == pLine->GetStart() ) && ( nFlags & GETCRSR_STARTOFLINE ) ) @@ -4465,13 +4384,13 @@ 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 ) @@ -4483,7 +4402,7 @@ 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; @@ -4492,7 +4411,7 @@ void ImpEditEngine::IndentBlock( EditView* pEditView, sal_Bool bRight ) if ( aESel.nEndPos == 0 ) { - aESel.nEndPara--; // dann diesen Absatz nicht... + aESel.nEndPara--; // then not this paragraph ... aNewSel.nEndPos = 0; } @@ -4506,13 +4425,13 @@ void ImpEditEngine::IndentBlock( EditView* pEditView, sal_Bool bRight ) 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 ) ) @@ -4537,17 +4456,17 @@ void ImpEditEngine::IndentBlock( EditView* pEditView, sal_Bool bRight ) } } -vos::ORef<SvxForbiddenCharactersTable> ImpEditEngine::GetForbiddenCharsTable( sal_Bool bGetInternal ) const +rtl::Reference<SvxForbiddenCharactersTable> ImpEditEngine::GetForbiddenCharsTable( sal_Bool bGetInternal ) const { - vos::ORef<SvxForbiddenCharactersTable> xF = xForbiddenCharsTable; - if ( !xF.isValid() && bGetInternal ) - xF = EE_DLL()->GetGlobalData()->GetForbiddenCharsTable(); + rtl::Reference<SvxForbiddenCharactersTable> xF = xForbiddenCharsTable; + if ( !xF.is() && bGetInternal ) + xF = EE_DLL().GetGlobalData()->GetForbiddenCharsTable(); return xF; } -void ImpEditEngine::SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars ) +void ImpEditEngine::SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ) { - EE_DLL()->GetGlobalData()->SetForbiddenCharsTable( xForbiddenChars ); + EE_DLL().GetGlobalData()->SetForbiddenCharsTable( xForbiddenChars ); } svtools::ColorConfig& ImpEditEngine::GetColorConfig() @@ -4578,17 +4497,6 @@ sal_Bool ImpEditEngine::DoVisualCursorTraveling( const ContentNode* ) { // Don't check if it's necessary, because we also need it when leaving the paragraph return IsVisualCursorTravelingEnabled(); -/* - sal_Bool bDoVisualCursorTraveling = sal_False; - - if ( IsVisualCursorTravelingEnabled() && pNode->Len() ) - { - // Only necessary when RTL text in LTR para or LTR text in RTL para - bDoVisualCursorTraveling = HasDifferentRTLLevels( pNode ); - } - - return bDoVisualCursorTraveling; -*/ } @@ -4622,7 +4530,7 @@ void ImpEditEngine::EnterBlockNotifications() void ImpEditEngine::LeaveBlockNotifications() { - DBG_ASSERT( nBlockNotifications, "LeaveBlockNotifications - Why?" ); + OSL_ENSURE( nBlockNotifications, "LeaveBlockNotifications - Why?" ); nBlockNotifications--; if ( !nBlockNotifications ) @@ -4648,3 +4556,5 @@ IMPL_LINK( ImpEditEngine, DocModified, void*, EMPTYARG ) aModifyHdl.Call( NULL /*GetEditEnginePtr()*/ ); // NULL, because also used for Outliner return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 352fb8ace115..b43444d4efda 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,6 +62,7 @@ #include <editeng/scriptspaceitem.hxx> #include <editeng/charscaleitem.hxx> #include <editeng/numitem.hxx> +#include <editeng/justifyitem.hxx> #include <svtools/colorcfg.hxx> #include <svl/ctloptions.hxx> @@ -170,8 +172,7 @@ void lcl_DrawRedLines( 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 ) { @@ -190,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; @@ -242,7 +243,6 @@ void lcl_DrawRedLines( bWrong = sal_False; } } -#endif // !SVX_LIGHT } Point lcl_ImplCalcRotatedPos( Point rPos, Point rOrigin, double nSin, double nCos ) @@ -291,7 +291,7 @@ 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++ ) { @@ -305,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 ) ) @@ -358,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(); } @@ -379,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(); @@ -388,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 ); @@ -406,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 ); @@ -430,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() ), @@ -451,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; @@ -465,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(); @@ -503,7 +500,7 @@ void ImpEditEngine::FormatDoc() if ( bMapChanged ) GetRefDevice()->Pop(); - CallStatusHdl(); // Falls Modified... + CallStatusHdl(); // If Modified... LeaveBlockNotifications(); } @@ -541,27 +538,26 @@ void ImpEditEngine::CheckAutoPageSize() if ( GetStatus().AutoPageHeight() ) 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! } } } @@ -598,20 +594,20 @@ 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!" ); 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() ) @@ -621,10 +617,10 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) } // --------------------------------------------------------------- - // Initialisierung...... + // Initialization ...... // --------------------------------------------------------------- - // Immer fuer 100% formatieren: + // Always format for 100%: sal_Bool bMapChanged = ImpCheckRefMapMode(); if ( pParaPortion->GetLines().Count() == 0 ) @@ -634,7 +630,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) } // --------------------------------------------------------------- - // Absatzattribute holen...... + // Get Paragraph attributes ...... // --------------------------------------------------------------- ContentNode* const pNode = pParaPortion->GetNode(); @@ -649,9 +645,6 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&) pNode->GetContentAttribs().GetItem( EE_PARA_SBL ); 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 ); @@ -666,15 +659,15 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ) ) @@ -688,9 +681,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ); @@ -705,33 +696,33 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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--; @@ -745,11 +736,11 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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; @@ -761,7 +752,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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; sal_Bool bForceOneRun = bEmptyNodeWithPolygon; @@ -784,8 +775,6 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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(); } } @@ -799,20 +788,20 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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() ); @@ -821,10 +810,10 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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; @@ -843,7 +832,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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(); @@ -867,16 +856,15 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ) { @@ -889,8 +877,8 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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() ) { @@ -902,7 +890,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) } } - // 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; @@ -913,8 +901,8 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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() ) { @@ -927,11 +915,12 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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(); @@ -941,12 +930,11 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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; + nCurPos = nCurPos*100/std::max(static_cast<sal_Int32>(nStretchX), static_cast<sal_Int32>(1)); short nAllSpaceBeforeText = static_cast< short >(rLRItem.GetTxtLeft()/* + rLRItem.GetTxtLeft()*/ + nSpaceBeforeAndMinLabelWidth); aCurrentTab.aTabStop = pNode->GetContentAttribs().FindTabStop( nCurPos - nAllSpaceBeforeText /*rLRItem.GetTxtLeft()*/, aEditDoc.GetDefTab() ); @@ -966,7 +954,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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. + // For LEFT / DEFAULT this tab is not considered. aCurrentTab.bValid = sal_True; aCurrentTab.nStartPosX = nTmpWidth; aCurrentTab.nCharPos = nTmpPos; @@ -977,21 +965,20 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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; @@ -1014,7 +1001,6 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) break; case EE_FEATURE_FIELD: { -// long nCurWidth = nTmpWidth; SeekCursor( pNode, nTmpPos+1, aTmpFont ); sal_Unicode cChar = 0; // later: NBS? aTmpFont.SetPhysFont( GetRefDevice() ); @@ -1024,16 +1010,15 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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; @@ -1045,13 +1030,14 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) 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() ); @@ -1069,8 +1055,8 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ); } @@ -1114,7 +1100,6 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) 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 ) { @@ -1122,7 +1107,6 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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() ) ) ); sal_uInt16 nDecPos = aText.Search( aCurrentTab.aTabStop.GetDecimal() ); @@ -1135,7 +1119,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) } else { - DBG_ERROR( "CreateLines: Tab not handled!" ); + OSL_FAIL( "CreateLines: Tab not handled!" ); } long nMaxW = aCurrentTab.nTabPos - aCurrentTab.nStartPosX - nStartX; if ( nW >= nMaxW ) @@ -1159,11 +1143,11 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) 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; @@ -1172,14 +1156,14 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ); @@ -1212,8 +1196,8 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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; } @@ -1224,7 +1208,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ); } @@ -1242,11 +1226,11 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ) @@ -1260,11 +1244,10 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ) @@ -1280,16 +1263,15 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ); @@ -1307,7 +1289,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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; } @@ -1320,17 +1302,24 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ); } } + else if ( rLSItem.GetLineSpaceRule() == SVX_LINE_SPACE_FIX ) + { + sal_uInt16 nFixHeight = GetYValue( rLSItem.GetLineHeight() ); + sal_uInt16 nTxtHeight = pLine->GetHeight(); + pLine->SetMaxAscent( (sal_uInt16)(pLine->GetMaxAscent() + ( nFixHeight - nTxtHeight ) ) ); + pLine->SetHeight( nFixHeight, nTxtHeight ); + } 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 ) ) { @@ -1338,7 +1327,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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(); @@ -1349,27 +1338,13 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ) @@ -1404,7 +1379,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 @@ -1414,11 +1389,10 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 @@ -1427,9 +1401,10 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) break; case SVX_ADJUST_BLOCK: { + bool bDistLastLine = (GetJustifyMethod(nPara) == SVX_JUSTIFY_METHOD_DISTRIBUTE); long nRemainingSpace = nMaxLineWidth - aTextSize.Width(); pLine->SetStartPosX( (sal_uInt16)nStartX ); - if ( !bEOC && ( nRemainingSpace > 0 ) ) // nicht die letzte Zeile... + if ( nRemainingSpace > 0 && (!bEOC || bDistLastLine) ) ImpAdjustBlocks( pParaPortion, pLine, nRemainingSpace ); } break; @@ -1441,12 +1416,12 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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(); @@ -1466,14 +1441,13 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ) @@ -1503,10 +1477,9 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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; @@ -1520,12 +1493,12 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 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 ); @@ -1567,7 +1540,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) 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 ); @@ -1611,7 +1584,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 ); @@ -1664,18 +1637,26 @@ 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 ); } } + else if ( rLSItem.GetLineSpaceRule() == SVX_LINE_SPACE_FIX ) + { + sal_uInt16 nFixHeight = rLSItem.GetLineHeight(); + sal_uInt16 nTxtHeight = pTmpLine->GetHeight(); + + pTmpLine->SetMaxAscent( (sal_uInt16)(pTmpLine->GetMaxAscent() + ( nFixHeight - nTxtHeight ) ) ); + pTmpLine->SetHeight( nFixHeight, nTxtHeight ); + } else if ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) { sal_uInt16 nPara = GetParaPortions().GetPos( pParaPortion ); - if ( nPara || IsFixedCellHeight() || pTmpLine->GetStartPortion() ) // Nicht die aller erste Zeile + 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 ) ) { @@ -1683,7 +1664,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(); @@ -1700,21 +1681,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,12 +1705,9 @@ sal_Bool ImpEditEngine::FinishCreateLines( ParaPortion* 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; } @@ -1801,16 +1777,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; @@ -1821,18 +1797,14 @@ 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 = (sal_uInt16) aBoundary.endPos; DBG_ASSERT( nWordEnd > nWordStart, "ImpBreakLine: Start >= End?" ); @@ -1840,10 +1812,9 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te 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 >() ); @@ -1863,27 +1834,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) ) { @@ -1891,7 +1860,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) ) { @@ -1900,7 +1869,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 ); @@ -1917,26 +1886,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!" ); @@ -1947,15 +1914,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 ); @@ -1966,7 +1933,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 ]; } @@ -1976,7 +1943,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() ); @@ -1990,41 +1957,61 @@ 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 sal_uInt16 nFirstChar = pLine->GetStart(); - const sal_uInt16 nLastChar = pLine->GetEnd() -1; // Last zeigt dahinter + 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; - sal_uInt16 nChar; - for ( 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); + sal_uInt16 nScript = GetScriptType(aPaM); + if ( MsLangId::getPrimaryLanguage( eLang) == LANGUAGE_ARABIC_PRIMARY_ONLY ) + // Arabic script is handled later. + continue; + if ( pNode->GetChar(nChar) == ' ' ) { - // Don't use blank if language is arabic - LanguageType eLang = GetLanguage( EditPaM( pNode, nChar ) ); - if ( MsLangId::getPrimaryLanguage( eLang) != LANGUAGE_ARABIC_PRIMARY_ONLY ) - aPositions.Insert( nChar, aPositions.Count() ); + // Normal latin script. + aPositions.Insert( nChar, aPositions.Count() ); } + else if (nChar > nFirstChar) + { + if (nLastScript == i18n::ScriptType::ASIAN) + { + // Set break position between this and the last character if + // the last character is asian script. + aPositions.Insert( nChar-1, aPositions.Count() ); + } + else if (nScript == i18n::ScriptType::ASIAN) + { + // Set break position between a latin script and asian script. + aPositions.Insert( nChar-1, aPositions.Count() ); + } + } + + nLastScript = nScript; } // Kashidas ? ImpFindKashidas( pNode, nFirstChar, nLastChar, aPositions ); - 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 ); @@ -2035,12 +2022,12 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, 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; } @@ -2051,21 +2038,21 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, 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... + // 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++ ) { - nChar = aPositions[n]; + sal_uInt16 nChar = aPositions[n]; if ( nChar < nLastChar ) { sal_uInt16 nPortionStart, nPortion; - nPortion = pParaPortion->GetTextPortions().FindPortion( nChar, nPortionStart ); + nPortion = pParaPortion->GetTextPortions().FindPortion( nChar, nPortionStart, true ); TextPortion* pLastPortion = pParaPortion->GetTextPortions()[ nPortion ]; - // Die Breite der Portion: + // The width of the portion: pLastPortion->GetSize().Width() += nMore4Everyone; if ( nSomeExtraSpace ) pLastPortion->GetSize().Width()++; @@ -2208,10 +2195,9 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_uInt16 nStart, sal_ 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; @@ -2225,12 +2211,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; @@ -2238,18 +2220,18 @@ 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 ) @@ -2276,7 +2258,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 ); @@ -2285,8 +2267,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++; @@ -2319,9 +2301,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; @@ -2337,18 +2319,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; @@ -2364,35 +2346,34 @@ 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!" ); + DBG_ASSERT( pParaPortion->GetTextPortions()[nNewPortionPos]->GetKind() == PORTIONKIND_TEXT, "the empty portion was no TextPortion!" ); sal_uInt16 & r = pParaPortion->GetTextPortions()[nNewPortionPos]->GetLen(); r = r + nNewChars; @@ -2409,19 +2390,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; @@ -2432,16 +2414,16 @@ 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; + // Remove portion; sal_uInt8 nType = pTP->GetKind(); pParaPortion->GetTextPortions().Remove( nPortion ); delete pTP; @@ -2450,7 +2432,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; } @@ -2458,18 +2440,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() ) { @@ -2482,7 +2464,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 } @@ -2537,9 +2519,9 @@ void ImpEditEngine::SetFixedCellHeight( sal_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() ) @@ -2592,17 +2574,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 ); @@ -2633,20 +2613,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() ) { @@ -2657,36 +2635,43 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rF } if ( nStretchX != 100 ) { - aRealSz.Width() *= nStretchX; - aRealSz.Width() /= 100; - - // Auch das Kerning: (long wegen Zwischenergebnis) - long nKerning = rFont.GetFixKerning(); -/* - Die Ueberlegung war: Wenn neg. Kerning, aber StretchX = 200 - => Nicht das Kerning verdoppelt, also die Buchstaben weiter - zusammenziehen - --------------------------- - Kern StretchX =>Kern - --------------------------- - >0 <100 < (Proportional) - <0 <100 < (Proportional) - >0 >100 > (Proportional) - <0 >100 < (Der Betrag, also Antiprop) -*/ - if ( ( nKerning < 0 ) && ( nStretchX > 100 ) ) + if ( nStretchX == nStretchY && + nRelWidth == 100 ) { - // Antiproportional - nKerning *= 100; - nKerning /= nStretchX; + aRealSz.Width() = 0; } - else if ( nKerning ) + else { - // Proportional - nKerning *= nStretchX; - nKerning /= 100; + aRealSz.Width() *= nStretchX; + aRealSz.Width() /= 100; + + // Also the Kerning: (long due to handle Interim results) + long nKerning = rFont.GetFixKerning(); +/* + The consideration was: If negative kerning, but StretchX = 200 + => Do not double the kerning, thus pull the letters closer together + --------------------------- + Kern StretchX =>Kern + --------------------------- + >0 <100 < (Proportional) + <0 <100 < (Proportional) + >0 >100 > (Proportional) + <0 >100 < (The amount, thus disproportional) +*/ + if ( ( nKerning < 0 ) && ( nStretchX > 100 ) ) + { + // disproportional + nKerning *= 100; + nKerning /= nStretchX; + } + else if ( nKerning ) + { + // Proportional + nKerning *= nStretchX; + nKerning /= 100; + } + rFont.SetFixKerning( (short)nKerning ); } - rFont.SetFixKerning( (short)nKerning ); } } if ( nRelWidth != 100 ) @@ -2695,7 +2680,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 ) @@ -2752,9 +2737,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 ); @@ -2771,52 +2756,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 ) { @@ -2824,7 +2792,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 ) @@ -2847,15 +2815,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 ) @@ -2870,20 +2838,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; @@ -2898,7 +2863,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; @@ -2916,19 +2881,23 @@ 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() ) { aTmpPos.X() += pLine->GetStartPosX(); aTmpPos.Y() += pLine->GetMaxAscent(); aStartPos.Y() += pLine->GetHeight(); + if (nLine != nLastLine) + aStartPos.Y() += nVertLineSpacing; } else { aTmpPos.Y() += pLine->GetStartPosX(); aTmpPos.X() -= pLine->GetMaxAscent(); aStartPos.X() -= pLine->GetHeight(); + if (nLine != nLastLine) + aStartPos.X() -= nVertLineSpacing; } if ( ( !IsVertical() && ( aStartPos.Y() > aClipRec.Top() ) ) @@ -2940,46 +2909,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: @@ -3038,7 +2994,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; @@ -3126,13 +3082,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(); @@ -3166,7 +3121,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta nTextStart = 0; nTextLen = aText.Len(); - // #b6668980# crash when accessing 0 pointer in pDXArray + // crash when accessing 0 pointer in pDXArray pTmpDXArray = new sal_Int32[ aText.Len() ]; pDXArray = pTmpDXArray; Font _aOldFont( GetRefDevice()->GetFont() ); @@ -3185,24 +3140,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; @@ -3301,7 +3238,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; @@ -3318,23 +3255,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 ); @@ -3377,14 +3316,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 ); @@ -3399,7 +3337,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta pOutDev->DrawRect( aRect ); } - // PDF export: if ( pPDFExtOutDevData ) { @@ -3435,7 +3372,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 @@ -3454,7 +3390,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(); @@ -3462,23 +3397,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 ) @@ -3497,7 +3420,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta } break; -// case PORTIONKIND_EXTRASPACE: case PORTIONKIND_TAB: { if ( pTextPortion->GetExtraValue() && ( pTextPortion->GetExtraValue() != ' ' ) ) @@ -3511,13 +3433,32 @@ 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( (sal_uInt16)nChars, pTextPortion->GetExtraValue() ); + aTmpFont.QuickDrawText( pOutDev, aTmpPos, aText, 0, aText.Len(), NULL ); pOutDev->DrawStretchText( aTmpPos, pTextPortion->GetSize().Width(), aText ); + + if ( bStripOnly ) + { + // create EOL and EOP bools + const bool bEndOfLine(y == pLine->GetEndPortion()); + const bool bEndOfParagraph(bEndOfLine && nLine + 1 == nLines); + + const Color aOverlineColor(pOutDev->GetOverlineColor()); + const Color aTextLineColor(pOutDev->GetTextLineColor()); + + // StripPortions() data callback + GetEditEnginePtr()->DrawingTab( aTmpPos, + pTextPortion->GetSize().Width(), + pTextPortion->GetExtraValue(), + aTmpFont, n, nIndex, pTextPortion->GetRightToLeft(), + bEndOfLine, bEndOfParagraph, + aOverlineColor, aTextLineColor); + } } } break; @@ -3534,7 +3475,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() ) ) @@ -3562,7 +3503,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() ) ) @@ -3574,13 +3515,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 ); @@ -3601,7 +3542,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() ); @@ -3643,8 +3584,8 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b } 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 ) ) ) { @@ -3655,15 +3596,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 ); @@ -3691,12 +3632,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(); @@ -3713,7 +3653,6 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b if ( GetTextRanger() ) { -// pOutWin->Pop(); if ( bClipRegion ) pOutWin->SetClipRegion( aOldRegion ); else @@ -3740,9 +3679,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(); @@ -3770,8 +3710,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 ); @@ -3782,9 +3722,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 ); } @@ -3793,9 +3733,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 ); } @@ -3803,23 +3743,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 ); @@ -3828,22 +3757,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 ) ) @@ -3853,7 +3780,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 ); } @@ -3882,7 +3809,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; @@ -3890,7 +3817,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(); @@ -3900,20 +3827,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 ); @@ -3923,7 +3850,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 ); } @@ -3932,9 +3859,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 ) { @@ -3960,19 +3886,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(); @@ -3982,7 +3908,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(); @@ -3992,7 +3918,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; @@ -4003,7 +3929,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 ); @@ -4011,6 +3937,54 @@ ParaPortion* ImpEditEngine::GetNextVisPortion( ParaPortion* pCurPortion ) return pPortion; } +long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const +{ + long nTotalOccupiedHeight = 0; + sal_uInt16 nTotalLineCount = 0; + const ParaPortionList& rParaPortions = GetParaPortions(); + sal_uInt16 nParaCount = rParaPortions.Count(); + + for (sal_uInt16 i = 0; i < nParaCount; ++i) + { + if (GetVerJustification(i) != SVX_VER_JUSTIFY_BLOCK) + // All paragraphs must have the block justification set. + return 0; + + ParaPortion* pPortion = rParaPortions.GetObject(i); + nTotalOccupiedHeight += pPortion->GetFirstLineOffset(); + + const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&)pPortion->GetNode()->GetContentAttribs().GetItem(EE_PARA_SBL); + sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) + ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; + + const SvxULSpaceItem& rULItem = (const SvxULSpaceItem&)pPortion->GetNode()->GetContentAttribs().GetItem(EE_PARA_ULSPACE); + long nUL = GetYValue( rULItem.GetLower() ); + + EditLineList& rLines = pPortion->GetLines(); + sal_uInt16 nLineCount = rLines.Count(); + nTotalLineCount += nLineCount; + for (sal_uInt16 j = 0; j < nLineCount; ++j) + { + EditLine* pLine = rLines.GetObject(j); + nTotalOccupiedHeight += pLine->GetHeight(); + if (j < nLineCount-1) + nTotalOccupiedHeight += nSBL; + nTotalOccupiedHeight += nUL; + } + } + + long nTotalSpace = IsVertical() ? aPaperSize.Width() : aPaperSize.Height(); + nTotalSpace -= nTotalOccupiedHeight; + if (nTotalSpace <= 0 || nTotalLineCount <= 1) + return 0; + + if (IsVertical()) + // Shift the text to the right for the asian layout mode. + rStartPos.X() += nTotalSpace; + + return nTotalSpace / (nTotalLineCount-1); +} + EditPaM ImpEditEngine::InsertParagraph( sal_uInt16 nPara ) { EditPaM aPaM; @@ -4019,7 +3993,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 @@ -4035,7 +4009,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() ) ); @@ -4076,20 +4050,25 @@ void ImpEditEngine::SetFlatMode( sal_Bool bFlat ) void ImpEditEngine::SetCharStretching( sal_uInt16 nX, sal_uInt16 nY ) { + bool bChanged(false); if ( !IsVertical() ) { + bChanged = nStretchX!=nX || nStretchY!=nY; nStretchX = nX; nStretchY = nY; } else { + bChanged = nStretchX!=nY || nStretchY!=nX; nStretchX = nY; nStretchY = nX; } - if ( aStatus.DoStretch() ) + if (bChanged && aStatus.DoStretch()) { FormatFullDoc(); + // (potentially) need everything redrawn + aInvalidRec=Rectangle(0,0,1000000,1000000); UpdateViews( GetActiveView() ); } } @@ -4105,9 +4084,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 ); @@ -4126,8 +4105,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; } @@ -4140,7 +4119,7 @@ void ImpEditEngine::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY ) if ( nY != 100 ) { - // Fonthoehe + // Font height for ( int nItem = 0; nItem < 3; nItem++ ) { sal_uInt16 nItemId = EE_CHAR_FONTHEIGHT; @@ -4160,7 +4139,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(); @@ -4180,8 +4159,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++ ) @@ -4220,8 +4199,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; } @@ -4417,7 +4396,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; } @@ -4427,7 +4406,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) ); @@ -4459,7 +4438,6 @@ sal_Bool ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortio DBG_ASSERT( pTextPortion->GetLen(), "ImplCalcAsianCompression - Empty Portion?" ); // Percent is 1/100 Percent... - if ( n100thPercentFromMax == 10000 ) pTextPortion->SetExtraInfos( NULL ); @@ -4488,7 +4466,6 @@ sal_Bool ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortio } pTextPortion->GetExtraInfos()->nMaxCompression100thPercent = n100thPercentFromMax; pTextPortion->GetExtraInfos()->nAsianCompressionTypes |= nType; -// pTextPortion->GetExtraInfos()->nCompressedChars++; long nOldCharWidth; if ( (n+1) < nPortionLen ) @@ -4508,12 +4485,10 @@ sal_Bool ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortio if ( bCompressPunctuation ) { - // pTextPortion->GetExtraInfos()->nComressionWeight += 5; nCompress = nOldCharWidth / 2; } else // Kana { - // pTextPortion->GetExtraInfos()->nComressionWeight += 1; nCompress = nOldCharWidth / 10; } @@ -4531,7 +4506,7 @@ sal_Bool ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortio // 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 ) @@ -4587,7 +4562,6 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* { sal_Bool bFoundCompressedPortion = sal_False; long nCompressed = 0; -// long nCompressWeight = 0; TextPortionList aCompressedPortions; sal_uInt16 nPortion = pLine->GetEndPortion(); @@ -4675,3 +4649,5 @@ void ImpEditEngine::ImplFillTextMarkingVector(const lang::Locale& rLocale, EEngi } // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 71caa4f176fa..9f00bea57bca 100755..100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -117,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; @@ -146,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 ); @@ -155,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; @@ -173,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(); @@ -194,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() ) ) @@ -217,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(); @@ -235,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() ) @@ -255,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 ) { @@ -277,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(); @@ -289,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 ); @@ -317,11 +296,11 @@ void lcl_FindValidAttribs( ItemList& rLst, ContentNode* pNode, sal_uInt16 nIndex 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 ); @@ -337,7 +316,6 @@ sal_uInt32 ImpEditEngine::WriteBin( SvStream& rOutput, EditSelection aSel, sal_B return 0; } -#ifndef SVX_LIGHT sal_uInt32 ImpEditEngine::WriteXML( SvStream& rOutput, EditSelection aSel ) { ESelection aESel = CreateESel( aSel ); @@ -346,7 +324,6 @@ sal_uInt32 ImpEditEngine::WriteXML( SvStream& rOutput, EditSelection aSel ) return 0; } -#endif static sal_uInt16 getStylePos( const SfxStyles& rStyles, SfxStyleSheet* pSheet ) { @@ -363,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(); @@ -375,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; @@ -383,9 +359,9 @@ 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 ) ) ); @@ -422,7 +398,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) SvxFontItem* pFontItem = aFontTable.Get( j ); rOutput << '{'; rOutput << OOO_STRING_SVTOOLS_RTF_F; - rOutput.WriteNumber( j ); + rOutput.WriteNumber( static_cast<sal_uInt32>( j ) ); switch ( pFontItem->GetFamily() ) { case FAMILY_DONTKNOW: rOutput << OOO_STRING_SVTOOLS_RTF_FNIL; @@ -449,14 +425,14 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) default: break; } - rOutput.WriteNumber( nVal ); + rOutput.WriteNumber( static_cast<sal_uInt32>( nVal ) ); CharSet eChrSet = pFontItem->GetCharSet(); DBG_ASSERT( eChrSet != 9, "SystemCharSet?!" ); if( RTL_TEXTENCODING_DONTKNOW == eChrSet ) eChrSet = gsl_getSystemTextEncoding(); rOutput << OOO_STRING_SVTOOLS_RTF_FCHARSET; - rOutput.WriteNumber( rtl_getBestWindowsCharsetFromTextEncoding( eChrSet ) ); + rOutput.WriteNumber( static_cast<sal_uInt32>( rtl_getBestWindowsCharsetFromTextEncoding( eChrSet ) ) ); rOutput << ' '; RTFOutFuncs::Out_String( rOutput, pFontItem->GetFamilyName(), eDestEnc ); @@ -465,7 +441,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) rOutput << '}'; rOutput << endl; - // ColorList rausschreiben... + // Write out ColorList ... SvxColorList aColorList; sal_uInt32 i = 0; SvxColorItem* pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem2( EE_CHAR_COLOR, i ); @@ -486,11 +462,11 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) if ( !j || ( pColorItem->GetValue() != COL_AUTO ) ) { rOutput << OOO_STRING_SVTOOLS_RTF_RED; - rOutput.WriteNumber( pColorItem->GetValue().GetRed() ); + rOutput.WriteNumber( static_cast<sal_uInt32>(pColorItem->GetValue().GetRed()) ); rOutput << OOO_STRING_SVTOOLS_RTF_GREEN; - rOutput.WriteNumber( pColorItem->GetValue().GetGreen() ); + rOutput.WriteNumber( static_cast<sal_uInt32>(pColorItem->GetValue().GetGreen()) ); rOutput << OOO_STRING_SVTOOLS_RTF_BLUE; - rOutput.WriteNumber( pColorItem->GetValue().GetBlue() ); + rOutput.WriteNumber( static_cast<sal_uInt32>(pColorItem->GetValue().GetBlue()) ); } rOutput << ';'; } @@ -511,10 +487,10 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) SfxStyleSheet* pStyle = (SfxStyleSheet*)GetStyleSheetPool()->GetStyles()[ nStyle ].get(); rOutput << endl << '{' << OOO_STRING_SVTOOLS_RTF_S; - sal_uInt16 nNumber = (sal_uInt16) (nStyle + 1); + sal_uInt32 nNumber = 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 ) @@ -524,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; + nNumber = 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; + nNumber = getStylePos( GetStyleSheetPool()->GetStyles(), pNext ) + 1; rOutput.WriteNumber( nNumber ); - // Namen der Vorlage... + // Name of the template ... rOutput << " " << ByteString( pStyle->GetName(), eDestEnc ).GetBuffer(); rOutput << ";}"; } @@ -553,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++) { @@ -562,42 +538,35 @@ 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( Point( aEditDoc.GetDefTab(), 0 ), &GetRefMapMode(), &aTwpMode ).X(); rOutput << OOO_STRING_SVTOOLS_RTF_DEFTAB; - rOutput.WriteNumber( nDefTabTwps ); + rOutput.WriteNumber( static_cast<sal_uInt32>( 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; + sal_uInt32 nNumber = 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 ) @@ -611,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 ); @@ -625,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; @@ -645,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; @@ -654,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); @@ -684,13 +650,13 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) 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 << '{'; @@ -720,8 +686,8 @@ 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 ) @@ -735,9 +701,6 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) #endif return rOutput.GetError(); -#else - return 0; -#endif } @@ -758,7 +721,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, break; case EE_PARA_OUTLLEVEL: { - sal_Int16 nLevel = ((const SfxInt16Item&)rItem).GetValue(); + sal_Int32 nLevel = ((const SfxInt16Item&)rItem).GetValue(); if( nLevel >= 0 ) { rOutput << "\\level"; @@ -769,15 +732,13 @@ 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 ); + sal_Int32 nTxtFirst = ((const SvxLRSpaceItem&)rItem).GetTxtFirstLineOfst(); + nTxtFirst = LogicToTwips( nTxtFirst ); rOutput.WriteNumber( nTxtFirst ); rOutput << OOO_STRING_SVTOOLS_RTF_LI; - sal_uInt16 nTxtLeft = static_cast< sal_uInt16 >(((const SvxLRSpaceItem&)rItem).GetTxtLeft()); - nTxtLeft = (sal_uInt16)LogicToTwips( nTxtLeft ); + sal_uInt32 nTxtLeft = static_cast< sal_uInt32 >(((const SvxLRSpaceItem&)rItem).GetTxtLeft()); + nTxtLeft = (sal_uInt32)LogicToTwips( nTxtLeft ); rOutput.WriteNumber( nTxtLeft ); rOutput << OOO_STRING_SVTOOLS_RTF_RI; sal_uInt32 nTxtRight = ((const SvxLRSpaceItem&)rItem).GetRight(); @@ -788,24 +749,24 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, case EE_PARA_ULSPACE: { rOutput << OOO_STRING_SVTOOLS_RTF_SB; - sal_uInt16 nUpper = ((const SvxULSpaceItem&)rItem).GetUpper(); - nUpper = (sal_uInt16)LogicToTwips( nUpper ); + sal_uInt32 nUpper = ((const SvxULSpaceItem&)rItem).GetUpper(); + nUpper = (sal_uInt32)LogicToTwips( nUpper ); rOutput.WriteNumber( nUpper ); rOutput << OOO_STRING_SVTOOLS_RTF_SA; - sal_uInt16 nLower = ((const SvxULSpaceItem&)rItem).GetLower(); - nLower = (sal_uInt16)LogicToTwips( nLower ); + sal_uInt32 nLower = ((const SvxULSpaceItem&)rItem).GetLower(); + nLower = LogicToTwips( nLower ); rOutput.WriteNumber( nLower ); } break; case EE_PARA_SBL: { rOutput << OOO_STRING_SVTOOLS_RTF_SL; - long nVal = ((const SvxLineSpacingItem&)rItem).GetLineHeight(); + sal_Int32 nVal = ((const SvxLineSpacingItem&)rItem).GetLineHeight(); 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; @@ -861,7 +822,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, case EE_CHAR_FONTHEIGHT_CTL: { rOutput << OOO_STRING_SVTOOLS_RTF_FS; - long nHeight = ((const SvxFontHeightItem&)rItem).GetHeight(); + sal_Int32 nHeight = ((const SvxFontHeightItem&)rItem).GetHeight(); nHeight = LogicToTwips( nHeight ); // Twips => HalfPoints nHeight /= 10; @@ -882,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 ) { @@ -992,7 +953,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, case EE_CHAR_PAIRKERNING: { rOutput << OOO_STRING_SVTOOLS_RTF_KERNING; - rOutput.WriteNumber( ((const SvxAutoKernItem&)rItem).GetValue() ? 1 : 0 ); + rOutput.WriteNumber( static_cast<sal_uInt32>(((const SvxAutoKernItem&)rItem).GetValue() ? 1 : 0 )); } break; case EE_CHAR_ESCAPEMENT: @@ -1003,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 ) { @@ -1071,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 ) { @@ -1102,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; @@ -1137,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 @@ -1147,19 +1107,17 @@ 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() ); + XParaPortionList* pXList = new XParaPortionList( GetRefDevice(), aPaperSize.Width(), nStretchX, nStretchY ); pTxtObj->SetPortionInfo( pXList ); for ( nNode = nStartNode; nNode <= nEndNode; nNode++ ) { @@ -1170,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++ ) @@ -1180,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++ ) { @@ -1204,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(); @@ -1218,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 ); } @@ -1234,23 +1190,21 @@ 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() ) - && ( pPortionInfo->GetRefMapMode() == GetRefDevice()->GetMapMode() ) ) + && ( pPortionInfo->GetRefMapMode() == GetRefDevice()->GetMapMode() ) + && ( pPortionInfo->GetStretchX() == nStretchX ) + && ( pPortionInfo->GetStretchY() == nStretchY ) ) { if ( ( pPortionInfo->GetRefDevPtr() == (sal_uIntPtr)GetRefDevice() ) || ( ( pPortionInfo->GetRefDevType() == OUTDEV_VIRDEV ) && @@ -1280,10 +1234,10 @@ 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 ) @@ -1292,15 +1246,16 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed 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 ); @@ -1311,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 = 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() ); } } @@ -1327,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() ) { @@ -1368,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++ ) @@ -1380,14 +1332,14 @@ 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 @@ -1401,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 ) @@ -1427,7 +1377,7 @@ 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; } @@ -1453,10 +1403,8 @@ LanguageType ImpEditEngine::GetLanguage( const EditPaM& rPaM, sal_uInt16* pEndPo Reference< XSpellChecker1 > ImpEditEngine::GetSpeller() { -#ifndef SVX_LIGHT if ( !xSpeller.is() ) xSpeller = SvxGetSpellChecker(); -#endif return xSpeller; } @@ -1470,8 +1418,6 @@ 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 // further changes elsewehe to work properly) @@ -1483,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() ); @@ -1505,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; @@ -1528,15 +1470,11 @@ 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; sal_uInt16 nParas = pEditEngine->GetParagraphCount(); @@ -1566,7 +1504,6 @@ sal_Bool ImpEditEngine::HasConvertibleTextPortion( LanguageType nSrcLang ) } } -#endif return bHasConvTxt; } @@ -1577,16 +1514,12 @@ void ImpEditEngine::Convert( EditView* pEditView, { // 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; @@ -1618,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; @@ -1660,7 +1593,6 @@ void ImpEditEngine::Convert( EditView* pEditView, } delete pConvInfo; pConvInfo = 0; -#endif } @@ -1709,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 ) ); @@ -1740,18 +1667,6 @@ 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; - } -*/ - sal_uInt16 nAttribStart = USHRT_MAX; sal_uInt16 nAttribEnd = USHRT_MAX; sal_uInt16 nCurPos = USHRT_MAX; @@ -1881,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() ); @@ -1902,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 ) @@ -1924,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() ); @@ -1954,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?"); @@ -1973,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) ); @@ -1996,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() ); @@ -2021,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 /*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(); @@ -2083,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; @@ -2112,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()) @@ -2187,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, bool bRecheck ) { -#ifdef SVX_LIGHT -#else // Note: rNewPortions.size() == 0 is valid and happens when the whole // sentence got removed in the dialog @@ -2238,8 +2120,6 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView, } sal_uInt16 nScriptType = GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage ); -// LanguageType eTextLanguage = GetLanguage( aCurrentOldPosition->Min() ); - sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE; switch(nScriptType) { @@ -2321,37 +2201,28 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView, FormatAndUpdate(); 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() ) @@ -2381,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; @@ -2395,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() ) { @@ -2421,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 ) { @@ -2442,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; } @@ -2459,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 ); @@ -2480,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; @@ -2495,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 ) @@ -2522,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() ); } } @@ -2536,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 ) ) { @@ -2550,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() ); @@ -2583,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 ); @@ -2604,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(); @@ -2614,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 ) ) { @@ -2635,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() ); @@ -2648,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 ); @@ -2681,7 +2536,6 @@ sal_uInt16 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxS pEditView->ShowCursor( sal_True, sal_False ); } } -#endif // !SVX_LIGHT return nFound; } @@ -2695,7 +2549,7 @@ sal_Bool ImpEditEngine::Search( const SvxSearchItem& rSearchItem, EditView* pEdi EditSelection aFoundSel; sal_Bool bFound = ImpSearch( rSearchItem, aSel, aStartPaM, aFoundSel ); - if ( bFound && ( aFoundSel == aSel ) ) // Bei Rueckwaetssuche + if ( bFound && ( aFoundSel == aSel ) ) // For backwards-search { aStartPaM = aSel.Min(); bFound = ImpSearch( rSearchItem, aSel, aStartPaM, aFoundSel ); @@ -2704,7 +2558,7 @@ sal_Bool ImpEditEngine::Search( const SvxSearchItem& rSearchItem, EditView* pEdi 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( sal_True, sal_False ); pEditView->pImpEditView->SetEditSelection( aFoundSel ); @@ -2720,7 +2574,6 @@ sal_Bool ImpEditEngine::Search( const SvxSearchItem& rSearchItem, EditView* pEdi 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 ); @@ -2739,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; @@ -2767,7 +2620,7 @@ sal_Bool ImpEditEngine::ImpSearch( const SvxSearchItem& rSearchItem, nEndPos = rSearchSelection.Max().GetIndex(); } - // Suchen... + // Searching ... XubString aParaStr( GetEditDoc().GetParaAsString( pNode ) ); bool bFound = false; if ( bBack ) @@ -2787,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 ); @@ -2802,18 +2653,13 @@ 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 } @@ -2858,7 +2704,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, 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(); sal_uInt16 nCurrentStart = nStartPos; @@ -3071,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() ) { @@ -3098,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. @@ -3124,17 +2968,15 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, 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 ) { @@ -3240,12 +3082,12 @@ sal_Bool ImpEditEngine::ImplHasText() const return ( ( GetEditDoc().Count() > 1 ) || GetEditDoc().GetObject(0)->Len() ); } -long ImpEditEngine::LogicToTwips( long n ) +sal_Int32 ImpEditEngine::LogicToTwips(sal_Int32 n) { - Size aSz( n, 0 ); + Size aSz(n, 0); MapMode aTwipsMode( MAP_TWIP ); aSz = pRefDev->LogicToLogic( aSz, NULL, &aTwipsMode ); return aSz.Width(); } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 9ee95bc019a1..01484b7cfd5e 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,13 +44,7 @@ void ImpEditEngine::SetStyleSheetPool( SfxStyleSheetPool* pSPool ) { if ( pStylePool != pSPool ) { -// if ( pStylePool ) -// EndListening( *pStylePool, sal_True ); - pStylePool = pSPool; - -// if ( pStylePool ) -// StartListening( *pStylePool, sal_True ); } } @@ -151,7 +146,7 @@ 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 ); @@ -162,7 +157,7 @@ void ImpEditEngine::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) 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(); } @@ -184,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. - // sal_uLong nStyles = pMyStylePool->GetStyles().Count(); - // for ( sal_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 ); - // } } } } @@ -202,7 +186,7 @@ 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 ) ); @@ -229,7 +213,7 @@ EditUndoSetAttribs* ImpEditEngine::CreateAttribUndo( EditSelection aSel, const S 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() ); @@ -277,7 +261,7 @@ void ImpEditEngine::UndoActionEnd( sal_uInt16 ) 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 ); @@ -298,7 +282,7 @@ void ImpEditEngine::ResetUndoManager() void ImpEditEngine::EnableUndo( sal_Bool bEnable ) { - // Beim Umschalten des Modus Liste loeschen: + // When switching the mode Delete list: if ( bEnable != IsUndoEnabled() ) ResetUndoManager(); @@ -331,7 +315,7 @@ sal_Bool ImpEditEngine::Repeat( EditView* /* pView */ ) { if ( HasUndoManager() && GetUndoManager().GetRepeatActionCount() ) { - DBG_WARNING( "Repeat nicht implementiert!" ); + DBG_WARNING( "Repeat not implemented!" ); return sal_True; } return sal_False; @@ -343,42 +327,35 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttr 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() ); sal_uInt16 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); sal_uInt16 nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); - // ueber die Absaetze iterieren... + // 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(); + // 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 ) @@ -408,13 +385,12 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttr // 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 ); } @@ -423,7 +399,7 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttr } } - // Leere Slots mit Defaults fuellen... + // fill empty slots with defaults ... if ( bOnlyHardAttrib == EditEngineAttribs_All ) { for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++ ) @@ -440,7 +416,7 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttr 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 ); @@ -533,8 +509,8 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_ { 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, sal_False ); @@ -556,7 +532,7 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_ ( rSet.GetItemState( EE_CHAR_LANGUAGE_CTL ) == SFX_ITEM_ON ); } - // ueber die Absaetze iterieren... + // iterate over the paragraphs ... for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { sal_Bool bParaAttribFound = sal_False; @@ -565,22 +541,22 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_ 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 ); +// fprintf( fp, "\n\n=> Character-Attribute: Paragraph %i, %i-%i\n", nNode, nStartPos, nEndPos ); // DbgOutItemSet( fp, rSet, sal_True, sal_False ); // fclose( fp ); // } @@ -649,7 +625,7 @@ void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaA if ( IsUndoEnabled() && !IsInUndo() && aStatus.DoUndoAttribs() ) { - // Eventuel spezielles Undo, oder ItemSet* + // Possibly a special Undo, or itemset* EditUndoSetAttribs* pUndo = CreateAttribUndo( aSel, GetEmptyItemSet() ); pUndo->SetRemoveAttribs( sal_True ); pUndo->SetRemoveParaAttribs( bRemoveParaAttribs ); @@ -657,33 +633,33 @@ void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaA InsertUndo( pUndo ); } - // ueber die Absaetze iterieren... + // 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 )?! + // 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... @@ -711,8 +687,8 @@ void ImpEditEngine::RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich, sal_ 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; @@ -746,7 +722,7 @@ void ImpEditEngine::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) // FILE* fp = fopen( "d:\\debug.log", "a" ); // if ( fp ) // { -// fprintf( fp, "\n\n=> Absatz-Attribute: Absatz %i\n", nPara ); +// fprintf( fp, "\n\n=> Paragraph-Attribute: Paragraph %i\n", nPara ); // DbgOutItemSet( fp, rSet, sal_True, sal_False ); // fclose( fp ); // } @@ -778,14 +754,14 @@ void ImpEditEngine::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) 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(); } 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 ); } @@ -793,7 +769,7 @@ sal_Bool ImpEditEngine::HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) con 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 ); } @@ -826,7 +802,7 @@ void ImpEditEngine::ParaAttribsToCharAttribs( ContentNode* pNode ) if ( pNode->GetContentAttribs().HasItem( nWhich ) ) { const SfxPoolItem& rItem = pNode->GetContentAttribs().GetItem( nWhich ); - // Die Luecken auffuellen: + // Fill the gap: sal_uInt16 nLastEnd = 0; EditCharAttrib* pAttr = pNode->GetCharAttribs().FindNextAttrib( nWhich, nLastEnd ); while ( pAttr ) @@ -838,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 = sal_False; - // Portion braucht hier nicht invalidiert werden, geschieht woanders. + // Portion does not need to be invalidated here, happens elsewhere. } IdleFormattter::IdleFormattter() @@ -898,7 +874,7 @@ ImplIMEInfos::~ImplIMEInfos() void ImplIMEInfos::CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL ) { nLen = nL; - delete pAttribs; + delete[] pAttribs; pAttribs = new sal_uInt16[ nL ]; memcpy( pAttribs, pA, nL*sizeof(sal_uInt16) ); } @@ -909,3 +885,5 @@ void ImplIMEInfos::DestroyAttribs() pAttribs = NULL; nLen = 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/makefile.mk b/editeng/source/editeng/makefile.mk new file mode 100644 index 000000000000..6a623d02c58d --- /dev/null +++ b/editeng/source/editeng/makefile.mk @@ -0,0 +1,75 @@ +#************************************************************************* +# +# 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=editeng +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- General ---------------------------------------------------------- + +.IF "$(editdebug)" != "" || "$(EDITDEBUG)" != "" +CDEFS+=-DEDITDEBUG +.ENDIF + +SLOFILES = \ + $(SLO)$/textconv.obj \ + $(SLO)$/editattr.obj \ + $(SLO)$/editdbg.obj \ + $(SLO)$/editdoc.obj \ + $(SLO)$/editdoc2.obj \ + $(SLO)$/editeng.obj \ + $(SLO)$/editobj.obj \ + $(SLO)$/editsel.obj \ + $(SLO)$/editundo.obj \ + $(SLO)$/editview.obj \ + $(SLO)$/edtspell.obj \ + $(SLO)$/eehtml.obj \ + $(SLO)$/eerdll.obj \ + $(SLO)$/eeobj.obj \ + $(SLO)$/eertfpar.obj \ + $(SLO)$/impedit.obj \ + $(SLO)$/impedit2.obj \ + $(SLO)$/impedit3.obj \ + $(SLO)$/impedit4.obj \ + $(SLO)$/impedit5.obj + +SRS1NAME=$(TARGET) +SRC1FILES= editeng.src + +EXCEPTIONSFILES= \ + $(SLO)$/unolingu.obj + +.INCLUDE : target.mk + diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx index d2dc1c8a846d..623e978b3065 100755..100644 --- a/editeng/source/editeng/textconv.cxx +++ b/editeng/source/editeng/textconv.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -100,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; @@ -111,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; @@ -124,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; } @@ -161,8 +138,6 @@ sal_Bool TextConvWrapper::FindConvText_impl() { // modified version of SvxSpellWrapper::FindSpellError - //ShowLanguageErrors(); - sal_Bool bFound = sal_False; pWin->EnterWait(); @@ -198,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() ); } @@ -216,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; @@ -235,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()) { @@ -257,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!" ); } } @@ -400,10 +373,10 @@ 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< sal_uInt16 >( nUnitOffset + nUnitStart + aNewTxt.getLength()); @@ -438,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) { @@ -627,3 +599,4 @@ sal_Bool TextConvWrapper::HasRubySupport() const ////////////////////////////////////////////////////////////////////// +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/textconv.hxx b/editeng/source/editeng/textconv.hxx index 89cc0484b73f..440ffd8038e5 100644 --- a/editeng/source/editeng/textconv.hxx +++ b/editeng/source/editeng/textconv.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -120,3 +121,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx new file mode 100644 index 000000000000..de24284b92ce --- /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 a7e502297959..abfc77c2792d 100644 --- a/editeng/source/items/bulitem.cxx +++ b/editeng/source/items/bulitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,6 @@ #include <editeng/bulitem.hxx> #include <editeng/editrids.hrc> -// #90477# #include <tools/tenccvt.hxx> #define BULITEM_VERSION ((sal_uInt16)2) @@ -55,7 +55,6 @@ void SvxBulletItem::StoreFont( SvStream& rStream, const Font& rFont ) rStream << rFont.GetColor(); nTemp = (sal_uInt16)rFont.GetFamily(); rStream << nTemp; - // #90477# nTemp = (sal_uInt16)GetStoreCharSet( rFont.GetCharSet(), rStream.GetVersion() ); nTemp = (sal_uInt16)GetSOStoreTextEncoding((rtl_TextEncoding)rFont.GetCharSet(), (sal_uInt16)rStream.GetVersion()); rStream << nTemp; @@ -84,7 +83,6 @@ Font SvxBulletItem::CreateFont( SvStream& rStream, sal_uInt16 nVer ) 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); @@ -188,18 +186,16 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) : aFont = CreateFont( rStrm, BULITEM_VERSION ); else { - // Sicheres Laden mit Test auf leere Bitmap + // Safe Load with Test on empty Bitmap Bitmap aBmp; const sal_uInt32 nOldPos = rStrm.Tell(); - // #69345# Errorcode beim Bitmap lesen ignorieren, - // siehe Kommentar #67581# in SvxBulletItem::Store() + // 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() ) @@ -337,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 || @@ -373,7 +369,7 @@ int SvxBulletItem::operator==( const SfxPoolItem& rItem ) 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() ) ) ) { @@ -394,7 +390,7 @@ SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) c { sal_uLong _nStart = rStrm.Tell(); - // Kleine Vorab-Schaetzung der Groesse... + // Small preliminary estimate of the size ... sal_uInt16 nFac = ( rStrm.GetCompressMode() != COMPRESSMODE_NONE ) ? 3 : 1; const Bitmap aBmp( pGraphicObject->GetGraphic().GetBitmap() ); sal_uLong nBytes = aBmp.GetSizeBytes(); @@ -402,15 +398,14 @@ SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) c rStrm << aBmp; sal_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. + // 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 ); @@ -532,3 +527,5 @@ void SvxBulletItem::SetGraphicObject( const GraphicObject& rGraphicObject ) pGraphicObject = new GraphicObject( rGraphicObject ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/charhiddenitem.cxx b/editeng/source/items/charhiddenitem.cxx index 0eb77694f546..3f21e4562f3b 100644 --- a/editeng/source/items/charhiddenitem.cxx +++ b/editeng/source/items/charhiddenitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,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 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, @@ -80,3 +74,4 @@ SfxItemPresentation SvxCharHiddenItem::GetPresentation return SFX_ITEM_PRESENTATION_NONE; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index 68730911c8a2..4a3621f7f584 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,7 +39,6 @@ #include <editeng/measfld.hxx> -// #90477# #include <tools/tenccvt.hxx> #define FRAME_MARKER (sal_uInt32)0x21981357 @@ -73,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 sal_True; // Basicklasse immer gleich. + return sal_True; // Basic class is always the same. } // ----------------------------------------------------------------------- @@ -106,7 +106,7 @@ MetaAction* SvxFieldData::createEndComment() const SvxFieldItem::SvxFieldItem( SvxFieldData* pFld, const sal_uInt16 nId ) : SfxPoolItem( nId ) { - pField = pFld; // gehoert direkt dem Item + pField = pFld; // belongs directly to the item } // ----------------------------------------------------------------------- @@ -151,7 +151,7 @@ SfxPoolItem* SvxFieldItem::Create( SvStream& rStrm, sal_uInt16 ) 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() ); } @@ -160,14 +160,14 @@ SfxPoolItem* SvxFieldItem::Create( SvStream& rStrm, sal_uInt16 ) 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; } @@ -195,7 +195,7 @@ int SvxFieldItem::operator==( const SfxPoolItem& rItem ) const } // ================================================================= -// Es folgen die Ableitungen von SvxFieldData... +// The following are the derivatives of SvxFieldData ... // ================================================================= SV_IMPL_PERSIST1( SvxDateField, SvxFieldData ); @@ -276,12 +276,12 @@ 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; } @@ -310,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: @@ -429,26 +429,26 @@ MetaAction* SvxURLField::createBeginComment() const } // ================================================================= -// 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*/ ) { } @@ -460,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*/ ) { } @@ -505,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*/ ) { } @@ -625,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 @@ -963,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*/ ) { } @@ -985,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*/ ) { } @@ -1007,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*/ ) { } @@ -1049,3 +1049,4 @@ String SvxDateTimeField::GetFormatted( Date& rDate, Time& rTime, int eFormat, Sv return aRet; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 3ada61c04488..2e2b439878a7 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,16 +33,16 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/table/CellVertJustify.hpp> #include <com/sun/star/table/ShadowLocation.hpp> #include <com/sun/star/table/TableBorder.hpp> #include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/table/CellRangeAddress.hpp> #include <com/sun/star/table/CellContentType.hpp> #include <com/sun/star/table/TableOrientation.hpp> -#include <com/sun/star/table/CellHoriJustify.hpp> #include <com/sun/star/util/SortField.hpp> #include <com/sun/star/util/SortFieldType.hpp> +#include <com/sun/star/table/BorderLine2.hpp> +#include <com/sun/star/table/BorderLineStyle.hpp> #include <com/sun/star/table/CellOrientation.hpp> #include <com/sun/star/table/CellAddress.hpp> #include <com/sun/star/style/PageStyleLayout.hpp> @@ -62,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> @@ -92,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)) @@ -104,7 +107,6 @@ using namespace ::com::sun::star; // STATIC DATA ----------------------------------------------------------- - inline void SetValueProp( XubString& rStr, const sal_uInt16 nValue, const sal_uInt16 nProp ) { @@ -141,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 @@ -218,7 +219,7 @@ SvxSizeItem::SvxSizeItem( const sal_uInt16 nId, const Size& rSize ) : } // ----------------------------------------------------------------------- -sal_Bool SvxSizeItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxSizeItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -235,13 +236,13 @@ sal_Bool SvxSizeItem::QueryValue( uno::Any& rVal, sal_uInt8 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 sal_False; + default: OSL_FAIL("Wrong MemberId!"); return false; } - return sal_True; + return true; } // ----------------------------------------------------------------------- -sal_Bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -262,7 +263,7 @@ sal_Bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } else { - return sal_False; + return false; } } break; @@ -270,7 +271,7 @@ sal_Bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Int32 nVal = 0; if(!(rVal >>= nVal )) - return sal_False; + return false; aSize.Width() = bConvert ? MM100_TO_TWIP(nVal) : nVal; } @@ -279,15 +280,15 @@ sal_Bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Int32 nVal = 0; if(!(rVal >>= nVal)) - return sal_True; + return true; aSize.Height() = bConvert ? MM100_TO_TWIP(nVal) : nVal; } break; - default: DBG_ERROR("Wrong MemberId!"); - return sal_False; + default: OSL_FAIL("Wrong MemberId!"); + return false; } - return sal_True; + return true; } // ----------------------------------------------------------------------- @@ -324,7 +325,6 @@ SfxItemPresentation SvxSizeItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -350,7 +350,6 @@ SfxItemPresentation SvxSizeItem::GetPresentation default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -365,23 +364,22 @@ SvStream& SvxSizeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) co // ----------------------------------------------------------------------- -int SvxSizeItem::ScaleMetrics( long nMult, long nDiv ) +bool SvxSizeItem::ScaleMetrics( long nMult, long nDiv ) { aSize.Width() = Scale( aSize.Width(), nMult, nDiv ); aSize.Height() = Scale( aSize.Height(), nMult, nDiv ); - return 1; + return true; } // ----------------------------------------------------------------------- -int SvxSizeItem::HasMetrics() const +bool SvxSizeItem::HasMetrics() const { - return 1; + return true; } // ----------------------------------------------------------------------- - SfxPoolItem* SvxSizeItem::Create( SvStream& rStrm, sal_uInt16 ) const { long nWidth, nHeight; @@ -430,14 +428,14 @@ SvxLRSpaceItem::SvxLRSpaceItem( const long nLeft, const long nRight, } // ----------------------------------------------------------------------- -sal_Bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { - sal_Bool bRet = sal_True; + 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; @@ -468,14 +466,14 @@ sal_Bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const break; default: - bRet = sal_False; - DBG_ERROR("unknown MemberId"); + bRet = false; + OSL_FAIL("unknown MemberId"); } return bRet; } // ----------------------------------------------------------------------- -sal_Bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -510,7 +508,7 @@ sal_Bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) nPropRightMargin = (sal_uInt16)nRel; } else - return sal_False; + return false; } break; case MID_FIRST_LINE_INDENT : @@ -526,15 +524,15 @@ sal_Bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) break; default: - DBG_ERROR("unknown MemberId"); - return sal_False; + OSL_FAIL("unknown MemberId"); + return false; } - return sal_True; + return true; } // ----------------------------------------------------------------------- -// nLeftMargin und nTxtLeft anpassen. +// Adapt nLeftMargin and nTxtLeft. void SvxLRSpaceItem::AdjustLeft() { @@ -577,7 +575,6 @@ SfxItemPresentation SvxLRSpaceItem::GetPresentation XubString& rText, const IntlWrapper* pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -643,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 ) @@ -685,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; @@ -722,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 ); @@ -780,20 +775,20 @@ sal_uInt16 SvxLRSpaceItem::GetVersion( sal_uInt16 nFileVersion ) const // ----------------------------------------------------------------------- -int SvxLRSpaceItem::ScaleMetrics( long nMult, long nDiv ) +bool SvxLRSpaceItem::ScaleMetrics( long nMult, long nDiv ) { nFirstLineOfst = (short)Scale( nFirstLineOfst, nMult, nDiv ); nTxtLeft = Scale( nTxtLeft, nMult, nDiv ); nLeftMargin = Scale( nLeftMargin, nMult, nDiv ); nRightMargin = Scale( nRightMargin, nMult, nDiv ); - return 1; + return true; } // ----------------------------------------------------------------------- -int SvxLRSpaceItem::HasMetrics() const +bool SvxLRSpaceItem::HasMetrics() const { - return 1; + return true; } // class SvxULSpaceItem -------------------------------------------------- @@ -824,13 +819,13 @@ SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow, } // ----------------------------------------------------------------------- -sal_Bool SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + 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; @@ -846,11 +841,11 @@ sal_Bool SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) co case MID_UP_REL_MARGIN: rVal <<= (sal_Int16) nPropUpper; break; case MID_LO_REL_MARGIN: rVal <<= (sal_Int16) nPropLower; break; } - return sal_True; + return true; } // ----------------------------------------------------------------------- -sal_Bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -861,7 +856,7 @@ sal_Bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { ::com::sun::star::frame::status::UpperLowerMarginScale aUpperLowerMarginScale; if ( !(rVal >>= aUpperLowerMarginScale )) - return sal_False; + return false; { SetUpper((sal_uInt16)(bConvert ? MM100_TO_TWIP( aUpperLowerMarginScale.Upper ) : aUpperLowerMarginScale.Upper)); SetLower((sal_uInt16)(bConvert ? MM100_TO_TWIP( aUpperLowerMarginScale.Lower ) : aUpperLowerMarginScale.Lower)); @@ -874,12 +869,12 @@ sal_Bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case MID_UP_MARGIN : if(!(rVal >>= nVal) || nVal < 0) - return sal_False; + return false; SetUpper((sal_uInt16)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); break; case MID_LO_MARGIN : if(!(rVal >>= nVal) || nVal < 0) - return sal_False; + return false; SetLower((sal_uInt16)(bConvert ? MM100_TO_TWIP(nVal) : nVal)); break; case MID_UP_REL_MARGIN: @@ -894,16 +889,15 @@ sal_Bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) nPropLower = (sal_uInt16)nRel; } else - return sal_False; + return false; } break; - default: - DBG_ERROR("unknown MemberId"); - return sal_False; + OSL_FAIL("unknown MemberId"); + return false; } - return sal_True; + return true; } // ----------------------------------------------------------------------- @@ -935,7 +929,6 @@ SfxItemPresentation SvxULSpaceItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -977,7 +970,6 @@ SfxItemPresentation SvxULSpaceItem::GetPresentation } default: ;//prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -1025,21 +1017,20 @@ sal_uInt16 SvxULSpaceItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const // ----------------------------------------------------------------------- -int SvxULSpaceItem::ScaleMetrics( long nMult, long nDiv ) +bool SvxULSpaceItem::ScaleMetrics( long nMult, long nDiv ) { nUpper = (sal_uInt16)Scale( nUpper, nMult, nDiv ); nLower = (sal_uInt16)Scale( nLower, nMult, nDiv ); - return 1; + return true; } // ----------------------------------------------------------------------- -int SvxULSpaceItem::HasMetrics() const +bool SvxULSpaceItem::HasMetrics() const { - return 1; + return true; } - // class SvxPrintItem ---------------------------------------------------- SfxPoolItem* SvxPrintItem::Clone( SfxItemPool* ) const @@ -1074,7 +1065,6 @@ SfxItemPresentation SvxPrintItem::GetPresentation XubString& rText, const IntlWrapper * ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1093,7 +1083,6 @@ SfxItemPresentation SvxPrintItem::GetPresentation } default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -1131,7 +1120,6 @@ SfxItemPresentation SvxOpaqueItem::GetPresentation XubString& rText, const IntlWrapper * ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1150,7 +1138,6 @@ SfxItemPresentation SvxOpaqueItem::GetPresentation } default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -1165,11 +1152,8 @@ int SvxProtectItem::operator==( const SfxPoolItem& rAttr ) const bPos == ( (SvxProtectItem&)rAttr ).bPos ); } -/*-----------------16.03.98 12:42------------------- ---------------------------------------------------*/ -sal_Bool SvxProtectItem::QueryValue( uno::Any& rVal, sal_uInt8 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) @@ -1178,19 +1162,16 @@ sal_Bool SvxProtectItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const case MID_PROTECT_SIZE : bValue = bSize; break; case MID_PROTECT_POSITION: bValue = bPos; break; default: - DBG_ERROR("falsche MemberId"); - return sal_False; + OSL_FAIL("Wrong MemberId"); + return false; } rVal = Bool2Any( bValue ); - return sal_True; + return true; } -/*-----------------16.03.98 12:42------------------- ---------------------------------------------------*/ -sal_Bool SvxProtectItem::PutValue( const uno::Any& rVal, sal_uInt8 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) @@ -1199,10 +1180,10 @@ sal_Bool SvxProtectItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId case MID_PROTECT_SIZE : bSize = bVal; break; case MID_PROTECT_POSITION: bPos = bVal; break; default: - DBG_ERROR("falsche MemberId"); - return sal_False; + OSL_FAIL("Wrong MemberId"); + return false; } - return sal_True; + return true; } // ----------------------------------------------------------------------- @@ -1222,7 +1203,6 @@ SfxItemPresentation SvxProtectItem::GetPresentation XubString& rText, const IntlWrapper * ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1253,7 +1233,6 @@ SfxItemPresentation SvxProtectItem::GetPresentation } default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -1297,7 +1276,7 @@ SvxShadowItem::SvxShadowItem( const sal_uInt16 nId, } // ----------------------------------------------------------------------- -sal_Bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1324,20 +1303,20 @@ sal_Bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 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 sal_False; + default: OSL_FAIL("Wrong MemberId!"); return false; } - return sal_True; + return true; } // ----------------------------------------------------------------------- -sal_Bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; table::ShadowFormat aShadow; uno::Any aAny; - sal_Bool bRet = QueryValue( aAny, bConvert ? CONVERT_TWIPS : 0 ) && ( aAny >>= aShadow ); + bool bRet = QueryValue( aAny, bConvert ? CONVERT_TWIPS : 0 ) && ( aAny >>= aShadow ); switch ( nMemberId ) { case MID_LOCATION: @@ -1357,7 +1336,7 @@ sal_Bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 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 ) @@ -1432,7 +1411,7 @@ sal_uInt16 SvxShadowItem::CalcShadowSpace( sal_uInt16 nShadow ) const break; default: - DBG_ERROR( "wrong shadow" ); + OSL_FAIL( "wrong shadow" ); } return nSpace; } @@ -1447,7 +1426,6 @@ SfxItemPresentation SvxShadowItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1488,7 +1466,6 @@ SfxItemPresentation SvxShadowItem::GetPresentation } default: ;//prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -1507,17 +1484,17 @@ SvStream& SvxShadowItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) // ----------------------------------------------------------------------- -int SvxShadowItem::ScaleMetrics( long nMult, long nDiv ) +bool SvxShadowItem::ScaleMetrics( long nMult, long nDiv ) { nWidth = (sal_uInt16)Scale( nWidth, nMult, nDiv ); - return 1; + return true; } // ----------------------------------------------------------------------- -int SvxShadowItem::HasMetrics() const +bool SvxShadowItem::HasMetrics() const { - return 1; + return true; } // ----------------------------------------------------------------------- @@ -1565,176 +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 ) -: nOutWidth( nOut ) -, nInWidth ( nIn ) -, nDistance( nDist ) -{ - 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; - 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() ) ); -} - -// ----------------------------------------------------------------------- - -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 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; - } - } -} - // class SvxBoxItem ------------------------------------------------------ SvxBoxItem::SvxBoxItem( const SvxBoxItem& rCpy ) : @@ -1827,29 +1634,30 @@ int SvxBoxItem::operator==( const SfxPoolItem& rAttr ) const } // ----------------------------------------------------------------------- -table::BorderLine SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, sal_Bool bConvert) +table::BorderLine2 SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, sal_Bool bConvert) { - table::BorderLine aLine; + table::BorderLine2 aLine; if(pLine) { aLine.Color = pLine->GetColor().GetColor() ; aLine.InnerLineWidth = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetInWidth() ): pLine->GetInWidth() ); 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; } // ----------------------------------------------------------------------- -sal_Bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - table::BorderLine aRetLine; + table::BorderLine2 aRetLine; sal_uInt16 nDist = 0; sal_Bool bDistMember = sal_False; nMemberId &= ~CONVERT_TWIPS; - sal_Bool bSerialize = sal_False; switch(nMemberId) { case 0: @@ -1869,22 +1677,18 @@ sal_Bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 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; @@ -1913,41 +1717,146 @@ sal_Bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const if( bDistMember ) rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nDist) : nDist); else + rVal <<= aRetLine; + + return true; +} + +namespace +{ + +sal_Bool +lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert, sal_Bool bGuessWidth) +{ + rSvxLine.SetColor( Color(rLine.Color)); + if ( bGuessWidth ) { -/* - 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; + 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 )); } - return sal_True; + sal_Bool bRet = !rSvxLine.isEmpty(); + return bRet; +} + } // ----------------------------------------------------------------------- sal_Bool SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) { - 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 )); - sal_Bool bRet = rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0; - return bRet; + return lcl_lineToSvxLine(rLine, rSvxLine, bConvert, sal_True); +} + +sal_Bool +SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) +{ + SvxBorderStyle nStyle = NO_STYLE; + switch ( rLine.LineStyle ) + { + default: + case table::BorderLineStyle::SOLID: + nStyle = SOLID; + break; + case table::BorderLineStyle::DOTTED: + nStyle = DOTTED; + break; + case table::BorderLineStyle::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 lcl_lineToSvxLine(rLine, rSvxLine, bConvert, bGuessWidth); } // ----------------------------------------------------------------------- -sal_Bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +namespace { - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + +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; sal_Bool bDistMember = sal_False; nMemberId &= ~CONVERT_TWIPS; @@ -1959,44 +1868,18 @@ sal_Bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if (( rVal >>= aSeq ) && ( aSeq.getLength() == 9 )) { // 4 Borders and 5 distances - sal_Int32 nDist = 0; - SvxBorderLine aLine; - table::BorderLine aBorderLine; - if ( aSeq[0] >>= aBorderLine ) + const sal_uInt16 aBorders[] = { BOX_LINE_LEFT, BOX_LINE_RIGHT, BOX_LINE_BOTTOM, BOX_LINE_TOP }; + for (int n(0); n != SAL_N_ELEMENTS(aBorders); ++n) { - sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert); - SetLine(bSet ? &aLine : 0, BOX_LINE_LEFT ); - } - else - return sal_False; - - if ( aSeq[1] >>= aBorderLine ) - { - sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert); - SetLine(bSet ? &aLine : 0, BOX_LINE_RIGHT ); - } - else - return sal_False; - - if ( aSeq[2] >>= aBorderLine ) - { - sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert); - SetLine(bSet ? &aLine : 0, BOX_LINE_BOTTOM ); - } - else - return sal_False; - - if ( aSeq[3] >>= aBorderLine ) - { - sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert); - SetLine(bSet ? &aLine : 0, BOX_LINE_TOP ); + if (!lcl_setLine(aSeq[n], *this, aBorders[n], bConvert)) + return sal_False; } - else - return sal_False; + // WTH are the borders and the distances saved in different order? sal_uInt16 nLines[4] = { BOX_LINE_TOP, BOX_LINE_BOTTOM, BOX_LINE_LEFT, BOX_LINE_RIGHT }; for ( sal_Int32 n = 4; n < 9; n++ ) { + sal_Int32 nDist = 0; if ( aSeq[n] >>= nDist ) { if( bConvert ) @@ -2063,8 +1946,8 @@ sal_Bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if( !rVal.hasValue() ) return sal_False; - table::BorderLine aBorderLine; - if( rVal >>= aBorderLine ) + table::BorderLine2 aBorderLine; + if( lcl_extractBorderLine(rVal, aBorderLine) ) { // usual struct } @@ -2072,7 +1955,7 @@ sal_Bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 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; @@ -2122,7 +2005,6 @@ SfxItemPresentation SvxBoxItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -2251,7 +2133,6 @@ SfxItemPresentation SvxBoxItem::GetPresentation } default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -2314,7 +2195,7 @@ sal_uInt16 SvxBoxItem::GetVersion( sal_uInt16 nFFVer ) const // ----------------------------------------------------------------------- -int SvxBoxItem::ScaleMetrics( long nMult, long nDiv ) +bool SvxBoxItem::ScaleMetrics( long nMult, long nDiv ) { if ( pTop ) pTop->ScaleMetrics( nMult, nDiv ); if ( pBottom ) pBottom->ScaleMetrics( nMult, nDiv ); @@ -2324,14 +2205,14 @@ int SvxBoxItem::ScaleMetrics( long nMult, long nDiv ) nBottomDist = (sal_uInt16)Scale( nBottomDist, nMult, nDiv ); nLeftDist = (sal_uInt16)Scale( nLeftDist, nMult, nDiv ); nRightDist = (sal_uInt16)Scale( nRightDist, nMult, nDiv ); - return 1; + return true; } // ----------------------------------------------------------------------- -int SvxBoxItem::HasMetrics() const +bool SvxBoxItem::HasMetrics() const { - return 1; + return true; } // ----------------------------------------------------------------------- @@ -2355,7 +2236,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] ); } @@ -2398,7 +2280,7 @@ const SvxBorderLine *SvxBoxItem::GetLine( sal_uInt16 nLine ) const pRet = pRight; break; default: - DBG_ERROR( "wrong line" ); + OSL_FAIL( "wrong line" ); break; } @@ -2430,7 +2312,8 @@ void SvxBoxItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine ) pRight = pTmp; break; default: - DBG_ERROR( "wrong line" ); + delete pTmp; + OSL_FAIL( "wrong line" ); } } @@ -2470,7 +2353,7 @@ sal_uInt16 SvxBoxItem::GetDistance( sal_uInt16 nLine ) const nDist = nRightDist; break; default: - DBG_ERROR( "wrong line" ); + OSL_FAIL( "wrong line" ); } return nDist; @@ -2495,7 +2378,7 @@ void SvxBoxItem::SetDistance( sal_uInt16 nNew, sal_uInt16 nLine ) nRightDist = nNew; break; default: - DBG_ERROR( "wrong line" ); + OSL_FAIL( "wrong line" ); } } @@ -2524,7 +2407,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 ) @@ -2627,11 +2510,11 @@ void SvxBoxInfoItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine ) } else { - DBG_ERROR( "wrong line" ); + delete pTmp; + OSL_FAIL( "wrong line" ); } } - // ----------------------------------------------------------------------- SfxPoolItem* SvxBoxInfoItem::Clone( SfxItemPool* ) const @@ -2649,39 +2532,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; } @@ -2721,19 +2572,19 @@ SvStream& SvxBoxInfoItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) // ----------------------------------------------------------------------- -int SvxBoxInfoItem::ScaleMetrics( long nMult, long nDiv ) +bool SvxBoxInfoItem::ScaleMetrics( long nMult, long nDiv ) { if ( pHori ) pHori->ScaleMetrics( nMult, nDiv ); if ( pVert ) pVert->ScaleMetrics( nMult, nDiv ); nDefDist = (sal_uInt16)Scale( nDefDist, nMult, nDiv ); - return 1; + return true; } // ----------------------------------------------------------------------- -int SvxBoxInfoItem::HasMetrics() const +bool SvxBoxInfoItem::HasMetrics() const { - return 1; + return true; } // ----------------------------------------------------------------------- @@ -2761,7 +2612,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 ) { @@ -2776,17 +2628,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 } -sal_Bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - table::BorderLine aRetLine; + table::BorderLine2 aRetLine; sal_Int16 nVal=0; sal_Bool bIntMember = sal_False; nMemberId &= ~CONVERT_TWIPS; - sal_Bool bSerialize = sal_False; switch(nMemberId) { case 0: @@ -2810,11 +2661,9 @@ sal_Bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) cons } 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: @@ -2836,36 +2685,20 @@ sal_Bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) cons bIntMember = sal_True; rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(GetDefDist()) : GetDefDist()); break; - default: DBG_ERROR("Wrong MemberId!"); return sal_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 sal_True; + return true; } // ----------------------------------------------------------------------- -sal_Bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 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) @@ -2876,26 +2709,13 @@ sal_Bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if (( rVal >>= aSeq ) && ( aSeq.getLength() == 5 )) { // 2 BorderLines, flags, valid flags and distance - table::BorderLine aBorderLine; - SvxBorderLine aLine; - sal_Int16 nFlags( 0 ); - sal_Int32 nVal( 0 ); - if ( aSeq[0] >>= aBorderLine ) - { - sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert); - if ( bSet ) - SetLine( &aLine, BOXINFO_LINE_HORI ); - } - else + if (!lcl_setLine(aSeq[0], *this, BOXINFO_LINE_HORI, bConvert)) return sal_False; - if ( aSeq[1] >>= aBorderLine ) - { - sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert); - if ( bSet ) - SetLine( &aLine, BOXINFO_LINE_VERT ); - } - else + if (!lcl_setLine(aSeq[1], *this, BOXINFO_LINE_VERT, bConvert)) return sal_False; + + sal_Int16 nFlags( 0 ); + sal_Int32 nVal( 0 ); if ( aSeq[2] >>= nFlags ) { SetTable ( ( nFlags & 0x01 ) != 0 ); @@ -2924,8 +2744,8 @@ sal_Bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if( !rVal.hasValue() ) return sal_False; - table::BorderLine aBorderLine; - if( rVal >>= aBorderLine ) + table::BorderLine2 aBorderLine; + if( lcl_extractBorderLine(rVal, aBorderLine) ) { // usual struct } @@ -2933,7 +2753,7 @@ sal_Bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 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; @@ -3012,7 +2832,7 @@ sal_Bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } break; } - default: DBG_ERROR("Wrong MemberId!"); return sal_False; + default: OSL_FAIL("Wrong MemberId!"); return sal_False; } return sal_True; @@ -3037,7 +2857,6 @@ SfxItemPresentation SvxFmtBreakItem::GetPresentation XubString& rText, const IntlWrapper * ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -3050,7 +2869,6 @@ SfxItemPresentation SvxFmtBreakItem::GetPresentation return ePres; default: ;//prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } @@ -3064,7 +2882,7 @@ XubString SvxFmtBreakItem::GetValueTextByPos( sal_uInt16 nPos ) const } // ----------------------------------------------------------------------- -sal_Bool SvxFmtBreakItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +bool SvxFmtBreakItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { style::BreakType eBreak = style::BreakType_NONE; switch ( (SvxBreak)GetValue() ) @@ -3078,10 +2896,10 @@ sal_Bool SvxFmtBreakItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) default: ;//prevent warning } rVal <<= eBreak; - return sal_True; + return true; } // ----------------------------------------------------------------------- -sal_Bool SvxFmtBreakItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) +bool SvxFmtBreakItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { style::BreakType nBreak; @@ -3107,7 +2925,7 @@ sal_Bool SvxFmtBreakItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId* } SetValue((sal_uInt16) eBreak); - return sal_True; + return true; } // ----------------------------------------------------------------------- @@ -3134,7 +2952,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; } @@ -3191,7 +3009,6 @@ SfxItemPresentation SvxFmtKeepItem::GetPresentation XubString& rText, const IntlWrapper * ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -3210,7 +3027,6 @@ SfxItemPresentation SvxFmtKeepItem::GetPresentation } default: ;//prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -3233,7 +3049,6 @@ SvxLineItem::SvxLineItem( const SvxLineItem& rCpy ) : pLine = rCpy.GetLine() ? new SvxBorderLine( *rCpy.GetLine() ) : 0; } - // ----------------------------------------------------------------------- SvxLineItem::~SvxLineItem() @@ -3266,14 +3081,14 @@ SfxPoolItem* SvxLineItem::Clone( SfxItemPool* ) const return new SvxLineItem( *this ); } -sal_Bool SvxLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemId ) const +bool SvxLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemId ) const { sal_Bool bConvert = 0!=(nMemId&CONVERT_TWIPS); nMemId &= ~CONVERT_TWIPS; if ( nMemId == 0 ) { rVal <<= uno::makeAny( SvxBoxItem::SvxLineToLine(pLine, bConvert) ); - return sal_True; + return true; } else if ( pLine ) { @@ -3284,33 +3099,33 @@ sal_Bool SvxLineItem::QueryValue( uno::Any& rVal, sal_uInt8 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" ); - return sal_False; + OSL_FAIL( "Wrong MemberId" ); + return false; } } - return sal_True; + return true; } // ----------------------------------------------------------------------- -sal_Bool SvxLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemId ) +bool SvxLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemId ) { sal_Bool bConvert = 0!=(nMemId&CONVERT_TWIPS); nMemId &= ~CONVERT_TWIPS; sal_Int32 nVal = 0; if ( nMemId == 0 ) { - table::BorderLine aLine; - if ( rVal >>= aLine ) + table::BorderLine2 aLine; + if ( lcl_extractBorderLine(rVal, aLine) ) { if ( !pLine ) pLine = new SvxBorderLine; if( !SvxBoxItem::LineToSvxLine(aLine, *pLine, bConvert) ) DELETEZ( pLine ); - return sal_True; + return true; } - return sal_False; + return false; } else if ( rVal >>= nVal ) { @@ -3320,18 +3135,16 @@ sal_Bool SvxLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemId ) switch ( nMemId ) { case MID_FG_COLOR: pLine->SetColor( Color(nVal) ); break; - case MID_OUTER_WIDTH: pLine->SetOutWidth((sal_uInt16)nVal); break; - case MID_INNER_WIDTH: pLine->SetInWidth((sal_uInt16)nVal); break; - case MID_DISTANCE: pLine->SetDistance((sal_uInt16)nVal); break; + case MID_LINE_STYLE: pLine->SetStyle((SvxBorderStyle)nVal); break; default: - DBG_ERROR( "Wrong MemberId" ); + OSL_FAIL( "Wrong MemberId" ); return sal_False; } - return sal_True; + return true; } - return sal_False; + return false; } //------------------------------------------------------------------------ @@ -3344,7 +3157,6 @@ SfxItemPresentation SvxLineItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT rText.Erase(); switch ( ePres ) @@ -3361,7 +3173,6 @@ SfxItemPresentation SvxLineItem::GetPresentation } default: ;//prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -3383,17 +3194,17 @@ SvStream& SvxLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) co // ----------------------------------------------------------------------- -int SvxLineItem::ScaleMetrics( long nMult, long nDiv ) +bool SvxLineItem::ScaleMetrics( long nMult, long nDiv ) { if ( pLine ) pLine->ScaleMetrics( nMult, nDiv ); - return 1; + return true; } // ----------------------------------------------------------------------- -int SvxLineItem::HasMetrics() const +bool SvxLineItem::HasMetrics() const { - return 1; + return true; } // ----------------------------------------------------------------------- @@ -3407,7 +3218,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; @@ -3638,7 +3450,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 ); @@ -3701,9 +3513,8 @@ inline sal_Int8 lcl_TransparencyToPercent(sal_Int32 nTrans) return (sal_Int8)((nTrans * 100 + 127) / 254); } -sal_Bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId) { @@ -3758,14 +3569,13 @@ sal_Bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const break; } - return sal_True; + return true; } // ----------------------------------------------------------------------- -sal_Bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId) { @@ -3823,7 +3633,7 @@ sal_Bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 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 ) ) @@ -3874,7 +3684,7 @@ sal_Bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) break; } - return sal_True; + return true; } // ----------------------------------------------------------------------- @@ -4023,7 +3833,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; @@ -4039,9 +3849,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 @@ -4062,33 +3872,18 @@ 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() ) { Graphic aGraphic; int nRes; pImpl->pStream->Seek( STREAM_SEEK_TO_BEGIN ); - nRes = GraphicFilter::GetGraphicFilter()-> + nRes = GraphicFilter::GetGraphicFilter(). ImportGraphic( aGraphic, *pStrLink, *pImpl->pStream, GRFILTER_FORMAT_DONTKNOW, NULL, GRFILTER_I_FLAGS_DONT_SET_LOGSIZE_FOR_JPEG ); @@ -4107,9 +3902,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 ); } } @@ -4140,7 +3932,7 @@ void SvxBrushItem::SetGraphicPos( SvxGraphicPosition eNew ) { if ( !pImpl->pGraphicObject && !pStrLink ) { - pImpl->pGraphicObject = new GraphicObject; // dummy anlegen + pImpl->pGraphicObject = new GraphicObject; // Creating a dummy } } } @@ -4159,11 +3951,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! :-/" ); } } @@ -4181,11 +3973,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! :-/" ); } } @@ -4225,7 +4017,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; @@ -4268,7 +4060,6 @@ WallpaperStyle SvxBrushItem::GraphicPos2WallpaperStyle( SvxGraphicPosition ePos return eResult; } - SvxBrushItem::SvxBrushItem( const CntWallpaperItem& rItem, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich ), pImpl( new SvxBrushItem_Impl( 0 ) ), @@ -4300,7 +4091,6 @@ CntWallpaperItem* SvxBrushItem::CreateCntWallpaperItem() const { DBG_ERRORFILE( "Don't know what to do with a graphic" ); } -// pItem->SetGraphic( *pImpl->pGraphic, bLink ); return pItem; } @@ -4308,9 +4098,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" ); @@ -4394,7 +4182,7 @@ SfxItemPresentation SvxFrameDirectionItem::GetPresentation( return eRet; } -sal_Bool SvxFrameDirectionItem::PutValue( const com::sun::star::uno::Any& rVal, +bool SvxFrameDirectionItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) { sal_Int16 nVal = sal_Int16(); @@ -4420,7 +4208,7 @@ sal_Bool SvxFrameDirectionItem::PutValue( const com::sun::star::uno::Any& rVal, SetValue( FRMDIR_ENVIRONMENT ); break; default: - bRet = sal_False; + bRet = false; break; } } @@ -4428,12 +4216,12 @@ sal_Bool SvxFrameDirectionItem::PutValue( const com::sun::star::uno::Any& rVal, return bRet; } -sal_Bool SvxFrameDirectionItem::QueryValue( com::sun::star::uno::Any& rVal, +bool SvxFrameDirectionItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const { // translate SvxFrameDirection into WritingDirection2 sal_Int16 nVal; - sal_Bool bRet = sal_True; + bool bRet = true; switch( GetValue() ) { case FRMDIR_HORI_LEFT_TOP: @@ -4452,8 +4240,8 @@ sal_Bool SvxFrameDirectionItem::QueryValue( com::sun::star::uno::Any& rVal, nVal = text::WritingMode2::PAGE; break; default: - DBG_ERROR("Unknown SvxFrameDirection value!"); - bRet = sal_False; + OSL_FAIL("Unknown SvxFrameDirection value!"); + bRet = false; break; } @@ -4465,3 +4253,4 @@ sal_Bool SvxFrameDirectionItem::QueryValue( com::sun::star::uno::Any& rVal, return bRet; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx index 4b0e89424774..ea8808ce7517 100644 --- a/editeng/source/items/itemtype.cxx +++ b/editeng/source/items/itemtype.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,6 @@ #include "precompiled_editeng.hxx" // include --------------------------------------------------------------- -#include <tools/list.hxx> #include <vcl/outdev.hxx> #include <editeng/editrids.hrc> #include <unotools/intlwrapper.hxx> @@ -96,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; } @@ -123,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 @@ -147,18 +146,15 @@ XubString GetSvxString( sal_uInt16 nId ) return EE_RESSTR( nId ); } -#ifndef SVX_LIGHT - // ----------------------------------------------------------------------- XubString GetColorString( const Color& rCol ) { XubString sStr; - FASTBOOL bFound = sal_False; ColorData nColData = RGB_COLORDATA( rCol.GetRed(), rCol.GetGreen(), rCol.GetBlue() ); - sal_uInt16 nColor = 0, nColCount = 16; + sal_uInt16 nColor = 0; static ColorData aColAry[] = { COL_BLACK, COL_BLUE, COL_GREEN, COL_CYAN, @@ -166,15 +162,13 @@ XubString GetColorString( const Color& rCol ) COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTGREEN, COL_LIGHTCYAN, COL_LIGHTRED, COL_LIGHTMAGENTA, COL_YELLOW, COL_WHITE }; - while ( !bFound && nColor < nColCount ) + while ( nColor < sizeof(aColAry)/sizeof(ColorData) && + aColAry[nColor] != nColData ) { - if ( aColAry[nColor] == nColData ) - bFound = sal_True; - else - nColor++; + nColor += 1; } - if ( nColor < nColCount ) + if ( nColor < sizeof(aColAry)/sizeof(ColorData) ) sStr = EE_RESSTR( RID_SVXITEMS_COLOR_BEGIN + nColor + 1 ); if ( !sStr.Len() ) @@ -191,8 +185,6 @@ XubString GetColorString( const Color& rCol ) return sStr; } -#endif - // ----------------------------------------------------------------------- sal_uInt16 GetMetricId( SfxMapUnit eUnit ) @@ -231,9 +223,10 @@ sal_uInt16 GetMetricId( SfxMapUnit eUnit ) break; default: - DBG_ERROR( "not supported mapunit" ); + OSL_FAIL( "not supported mapunit" ); } return nId; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/justifyitem.cxx b/editeng/source/items/justifyitem.cxx new file mode 100644 index 000000000000..ebe4e333e6aa --- /dev/null +++ b/editeng/source/items/justifyitem.cxx @@ -0,0 +1,461 @@ +/* -*- 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 "editeng/justifyitem.hxx" +#include "editeng/memberids.hrc" +#include "editeng/editrids.hrc" +#include "editeng/eerdll.hxx" + +#include <tools/stream.hxx> + +#include <com/sun/star/table/CellHoriJustify.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> +#include <com/sun/star/table/CellJustifyMethod.hpp> +#include <com/sun/star/table/CellVertJustify2.hpp> +#include <com/sun/star/style/VerticalAlignment.hpp> + + +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; + + + +SvxHorJustifyItem::SvxHorJustifyItem( const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)SVX_HOR_JUSTIFY_STANDARD ) +{ +} + +SvxHorJustifyItem::SvxHorJustifyItem( const SvxCellHorJustify eJustify, + const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)eJustify ) +{ +} + + +SfxItemPresentation SvxHorJustifyItem::GetPresentation +( + SfxItemPresentation ePres, + SfxMapUnit /*eCoreUnit*/, + SfxMapUnit /*ePresUnit*/, + XubString& rText, const IntlWrapper *) const +{ + switch ( ePres ) + { + case SFX_ITEM_PRESENTATION_NONE: + rText.Erase(); + return SFX_ITEM_PRESENTATION_NONE; + case SFX_ITEM_PRESENTATION_NAMELESS: + case SFX_ITEM_PRESENTATION_COMPLETE: + rText = GetValueText( GetValue() ); + return SFX_ITEM_PRESENTATION_COMPLETE; + default: ; //prevent warning + } + return SFX_ITEM_PRESENTATION_NONE; +} + + +bool SvxHorJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +{ + nMemberId &= ~CONVERT_TWIPS; + switch ( nMemberId ) + { + case MID_HORJUST_HORJUST: + { + table::CellHoriJustify eUno = table::CellHoriJustify_STANDARD; + switch ( (SvxCellHorJustify)GetValue() ) + { + case SVX_HOR_JUSTIFY_STANDARD: eUno = table::CellHoriJustify_STANDARD; break; + case SVX_HOR_JUSTIFY_LEFT: eUno = table::CellHoriJustify_LEFT; break; + case SVX_HOR_JUSTIFY_CENTER: eUno = table::CellHoriJustify_CENTER; break; + case SVX_HOR_JUSTIFY_RIGHT: eUno = table::CellHoriJustify_RIGHT; break; + case SVX_HOR_JUSTIFY_BLOCK: eUno = table::CellHoriJustify_BLOCK; break; + case SVX_HOR_JUSTIFY_REPEAT: eUno = table::CellHoriJustify_REPEAT; break; + } + rVal <<= eUno; + } + break; + case MID_HORJUST_ADJUST: + { + // ParagraphAdjust values, as in SvxAdjustItem + // (same value for ParaAdjust and ParaLastLineAdjust) + + sal_Int16 nAdjust = style::ParagraphAdjust_LEFT; + switch ( (SvxCellHorJustify)GetValue() ) + { + // ParagraphAdjust_LEFT is used for STANDARD and REPEAT + case SVX_HOR_JUSTIFY_STANDARD: + case SVX_HOR_JUSTIFY_REPEAT: + case SVX_HOR_JUSTIFY_LEFT: nAdjust = style::ParagraphAdjust_LEFT; break; + case SVX_HOR_JUSTIFY_CENTER: nAdjust = style::ParagraphAdjust_CENTER; break; + case SVX_HOR_JUSTIFY_RIGHT: nAdjust = style::ParagraphAdjust_RIGHT; break; + case SVX_HOR_JUSTIFY_BLOCK: nAdjust = style::ParagraphAdjust_BLOCK; break; + } + rVal <<= nAdjust; // as sal_Int16 + } + break; + } + return true; +} + +bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +{ + nMemberId &= ~CONVERT_TWIPS; + switch ( nMemberId ) + { + case MID_HORJUST_HORJUST: + { + table::CellHoriJustify eUno; + if(!(rVal >>= eUno)) + { + sal_Int32 nValue = 0; + if(!(rVal >>= nValue)) + return false; + eUno = (table::CellHoriJustify)nValue; + } + SvxCellHorJustify eSvx = SVX_HOR_JUSTIFY_STANDARD; + switch (eUno) + { + case table::CellHoriJustify_STANDARD: eSvx = SVX_HOR_JUSTIFY_STANDARD; break; + case table::CellHoriJustify_LEFT: eSvx = SVX_HOR_JUSTIFY_LEFT; break; + case table::CellHoriJustify_CENTER: eSvx = SVX_HOR_JUSTIFY_CENTER; break; + case table::CellHoriJustify_RIGHT: eSvx = SVX_HOR_JUSTIFY_RIGHT; break; + case table::CellHoriJustify_BLOCK: eSvx = SVX_HOR_JUSTIFY_BLOCK; break; + case table::CellHoriJustify_REPEAT: eSvx = SVX_HOR_JUSTIFY_REPEAT; break; + default: ; //prevent warning + } + SetValue( (sal_uInt16)eSvx ); + } + break; + case MID_HORJUST_ADJUST: + { + // property contains ParagraphAdjust values as sal_Int16 + sal_Int16 nVal = sal_Int16(); + if(!(rVal >>= nVal)) + return false; + + SvxCellHorJustify eSvx = SVX_HOR_JUSTIFY_STANDARD; + switch (nVal) + { + // STRETCH is treated as BLOCK + case style::ParagraphAdjust_LEFT: eSvx = SVX_HOR_JUSTIFY_LEFT; break; + case style::ParagraphAdjust_RIGHT: eSvx = SVX_HOR_JUSTIFY_RIGHT; break; + case style::ParagraphAdjust_STRETCH: + case style::ParagraphAdjust_BLOCK: eSvx = SVX_HOR_JUSTIFY_BLOCK; break; + case style::ParagraphAdjust_CENTER: eSvx = SVX_HOR_JUSTIFY_CENTER; break; + } + SetValue( (sal_uInt16)eSvx ); + } + } + return true; +} + + +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, sal_uInt16 ) const +{ + sal_uInt16 nVal; + rStream >> nVal; + return new SvxHorJustifyItem( (SvxCellHorJustify)nVal, Which() ); +} + + +sal_uInt16 SvxHorJustifyItem::GetValueCount() const +{ + return SVX_HOR_JUSTIFY_REPEAT + 1; // Last Enum value + 1 +} + + +SvxVerJustifyItem::SvxVerJustifyItem( const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)SVX_VER_JUSTIFY_STANDARD ) +{ +} + +SvxVerJustifyItem::SvxVerJustifyItem( const SvxCellVerJustify eJustify, + const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)eJustify ) +{ +} + + +SfxItemPresentation SvxVerJustifyItem::GetPresentation +( + SfxItemPresentation ePres, + SfxMapUnit /*eCoreUnit*/, + SfxMapUnit /*ePresUnit*/, + XubString& rText, + const IntlWrapper * ) const +{ + switch ( ePres ) + { + case SFX_ITEM_PRESENTATION_NONE: + rText.Erase(); + return SFX_ITEM_PRESENTATION_NONE; + case SFX_ITEM_PRESENTATION_NAMELESS: + case SFX_ITEM_PRESENTATION_COMPLETE: + rText = GetValueText( GetValue() ); + return SFX_ITEM_PRESENTATION_COMPLETE; + default: ; //prevent warning + } + return SFX_ITEM_PRESENTATION_NONE; +} + + +bool SvxVerJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +{ + nMemberId &= ~CONVERT_TWIPS; + switch ( nMemberId ) + { + case MID_HORJUST_ADJUST: + { + style::VerticalAlignment eUno = style::VerticalAlignment_TOP; + switch ( (SvxCellVerJustify)GetValue() ) + { + case SVX_VER_JUSTIFY_TOP: eUno = style::VerticalAlignment_TOP; break; + case SVX_VER_JUSTIFY_CENTER: eUno = style::VerticalAlignment_MIDDLE; break; + case SVX_VER_JUSTIFY_BOTTOM: eUno = style::VerticalAlignment_BOTTOM; break; + default: ; //prevent warning + } + rVal <<= eUno; + break; + } + default: + { + sal_Int32 nUno = table::CellVertJustify2::STANDARD; + switch ( (SvxCellVerJustify)GetValue() ) + { + case SVX_VER_JUSTIFY_STANDARD: nUno = table::CellVertJustify2::STANDARD; break; + case SVX_VER_JUSTIFY_TOP: nUno = table::CellVertJustify2::TOP; break; + case SVX_VER_JUSTIFY_CENTER: nUno = table::CellVertJustify2::CENTER; break; + case SVX_VER_JUSTIFY_BOTTOM: nUno = table::CellVertJustify2::BOTTOM; break; + case SVX_VER_JUSTIFY_BLOCK: nUno = table::CellVertJustify2::BLOCK; break; + default: ; //prevent warning + } + rVal <<= nUno; + break; + } + } + return true; +} + +bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +{ + nMemberId &= ~CONVERT_TWIPS; + switch ( nMemberId ) + { + case MID_HORJUST_ADJUST: + { + // property contains ParagraphAdjust values as sal_Int16 + style::VerticalAlignment nVal = style::VerticalAlignment_TOP; + if(!(rVal >>= nVal)) + return false; + + SvxCellVerJustify eSvx = SVX_VER_JUSTIFY_STANDARD; + switch (nVal) + { + case style::VerticalAlignment_TOP: eSvx = SVX_VER_JUSTIFY_TOP; break; + case style::VerticalAlignment_MIDDLE: eSvx = SVX_VER_JUSTIFY_CENTER; break; + case style::VerticalAlignment_BOTTOM: eSvx = SVX_VER_JUSTIFY_BOTTOM; break; + default:; + } + SetValue( (sal_uInt16)eSvx ); + break; + } + default: + { + sal_Int32 eUno = table::CellVertJustify2::STANDARD; + rVal >>= eUno; + + SvxCellVerJustify eSvx = SVX_VER_JUSTIFY_STANDARD; + switch (eUno) + { + case table::CellVertJustify2::STANDARD: eSvx = SVX_VER_JUSTIFY_STANDARD; break; + case table::CellVertJustify2::TOP: eSvx = SVX_VER_JUSTIFY_TOP; break; + case table::CellVertJustify2::CENTER: eSvx = SVX_VER_JUSTIFY_CENTER; break; + case table::CellVertJustify2::BOTTOM: eSvx = SVX_VER_JUSTIFY_BOTTOM; break; + case table::CellVertJustify2::BLOCK: eSvx = SVX_VER_JUSTIFY_BLOCK; break; + default: ; //prevent warning + } + SetValue( (sal_uInt16)eSvx ); + break; + } + } + + return true; +} + + +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, sal_uInt16 ) const +{ + sal_uInt16 nVal; + rStream >> nVal; + return new SvxVerJustifyItem( (SvxCellVerJustify)nVal, Which() ); +} + + +sal_uInt16 SvxVerJustifyItem::GetValueCount() const +{ + return SVX_VER_JUSTIFY_BOTTOM + 1; // Last Enum value + 1 +} + + + +SvxJustifyMethodItem::SvxJustifyMethodItem( const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)SVX_JUSTIFY_METHOD_AUTO ) +{ +} + +SvxJustifyMethodItem::SvxJustifyMethodItem( const SvxCellJustifyMethod eJustify, + const sal_uInt16 nId ) : + SfxEnumItem( nId, (sal_uInt16)eJustify ) +{ +} + + +SfxItemPresentation SvxJustifyMethodItem::GetPresentation +( + SfxItemPresentation ePres, + SfxMapUnit /*eCoreUnit*/, + SfxMapUnit /*ePresUnit*/, + XubString& rText, + const IntlWrapper * ) const +{ + switch ( ePres ) + { + case SFX_ITEM_PRESENTATION_NONE: + rText.Erase(); + return SFX_ITEM_PRESENTATION_NONE; + case SFX_ITEM_PRESENTATION_NAMELESS: + case SFX_ITEM_PRESENTATION_COMPLETE: + rText = GetValueText( GetValue() ); + return SFX_ITEM_PRESENTATION_COMPLETE; + default: ; //prevent warning + } + return SFX_ITEM_PRESENTATION_NONE; +} + + +bool SvxJustifyMethodItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +{ + sal_Int32 nUno = table::CellJustifyMethod::AUTO; + switch (static_cast<SvxCellJustifyMethod>(GetValue())) + { + case SVX_JUSTIFY_METHOD_AUTO: nUno = table::CellJustifyMethod::AUTO; break; + case SVX_JUSTIFY_METHOD_DISTRIBUTE: nUno = table::CellJustifyMethod::DISTRIBUTE; break; + default:; + } + rVal <<= nUno; + return true; +} + +bool SvxJustifyMethodItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) +{ + sal_Int32 nVal = table::CellJustifyMethod::AUTO; + if (!(rVal >>= nVal)) + return false; + + SvxCellJustifyMethod eSvx = SVX_JUSTIFY_METHOD_AUTO; + switch (nVal) + { + case table::CellJustifyMethod::AUTO: + eSvx = SVX_JUSTIFY_METHOD_AUTO; + break; + case table::CellJustifyMethod::DISTRIBUTE: + eSvx = SVX_JUSTIFY_METHOD_DISTRIBUTE; + break; + default:; + } + SetValue(static_cast<sal_uInt16>(eSvx)); + return true; +} + + +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, sal_uInt16 ) const +{ + sal_uInt16 nVal; + rStream >> nVal; + return new SvxJustifyMethodItem( (SvxCellJustifyMethod)nVal, Which() ); +} + + +sal_uInt16 SvxJustifyMethodItem::GetValueCount() const +{ + return SVX_JUSTIFY_METHOD_DISTRIBUTE + 1; // Last Enum value + 1 +} + +SvxJustifyMethodItem& SvxJustifyMethodItem::operator=(const SvxJustifyMethodItem& r) +{ + SetValue( r.GetValue() ); + return *this; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/makefile.mk b/editeng/source/items/makefile.mk new file mode 100644 index 000000000000..9ebb12c66f08 --- /dev/null +++ b/editeng/source/items/makefile.mk @@ -0,0 +1,67 @@ +#************************************************************************* +# +# 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 +# +# 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=items + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SRS1NAME=items +SRC1FILES = \ + page.src \ + svxitems.src + +SLOFILES= \ + $(EXCEPTIONSFILES) \ + $(SLO)$/charhiddenitem.obj \ + $(SLO)$/justifyitem.obj \ + $(SLO)$/optitems.obj \ + $(SLO)$/writingmodeitem.obj + +EXCEPTIONSFILES= \ + $(SLO)$/bulitem.obj \ + $(SLO)$/flditem.obj \ + $(SLO)$/frmitems.obj \ + $(SLO)$/borderline.obj \ + $(SLO)$/itemtype.obj \ + $(SLO)$/numitem.obj \ + $(SLO)$/paperinf.obj \ + $(SLO)$/paraitem.obj \ + $(SLO)$/svdfield.obj \ + $(SLO)$/svxfont.obj \ + $(SLO)$/textitem.obj \ + $(SLO)$/xmlcnitm.obj + +.INCLUDE : target.mk + diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 5f2dc3a2d803..dc272096cbd1 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,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 @@ -78,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); @@ -88,44 +89,34 @@ void lcl_getFormatter(com::sun::star::uno::Reference<com::sun::star::text::XNumb } } } -/* -----------------------------22.02.01 14:24-------------------------------- - ---------------------------------------------------------------------------*/ SvxNumberType::SvxNumberType(sal_Int16 nType) : nNumType(nType), bShowSymbol(sal_True) { nRefCount++; } -/* -----------------------------22.02.01 14:31-------------------------------- - ---------------------------------------------------------------------------*/ SvxNumberType::SvxNumberType(const SvxNumberType& rType) : nNumType(rType.nNumType), bShowSymbol(rType.bShowSymbol) { nRefCount++; } -/* -----------------------------22.02.01 14:24-------------------------------- - ---------------------------------------------------------------------------*/ SvxNumberType::~SvxNumberType() { if(!--nRefCount) xFormatter = 0; } -/* -----------------------------22.02.01 11:09-------------------------------- - ---------------------------------------------------------------------------*/ String SvxNumberType::GetNumStr( sal_uLong nNo ) const { LanguageType eLang = Application::GetSettings().GetLanguage(); Locale aLocale = SvxCreateLocale(eLang); return GetNumStr( nNo, aLocale ); } -/* -----------------28.10.98 15:56------------------- - * - * --------------------------------------------------*/ + String SvxNumberType::GetNumStr( sal_uLong nNo, const Locale& rLocale ) const { lcl_getFormatter(xFormatter); @@ -142,7 +133,7 @@ String SvxNumberType::GetNumStr( sal_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 @@ -167,13 +158,9 @@ String SvxNumberType::GetNumStr( sal_uLong nNo, const Locale& rLocale ) const } return aTmpStr; } -/* -----------------27.10.98 10:33------------------- - * - * --------------------------------------------------*/ -// --> OD 2008-01-09 #newlistlevelattrs# + SvxNumberFormat::SvxNumberFormat( sal_Int16 eType, SvxNumPositionAndSpaceMode ePositionAndSpaceMode ) -// <-- : SvxNumberType(eType), eNumAdjust(SVX_ADJUST_LEFT), nInclUpperLevels(0), @@ -181,48 +168,36 @@ SvxNumberFormat::SvxNumberFormat( sal_Int16 eType, cBullet(SVX_DEF_BULLET), nBulletRelSize(100), nBulletColor(COL_BLACK), - // --> OD 2008-01-09 #newlistlevelattrs# mePositionAndSpaceMode( ePositionAndSpaceMode ), - // <-- nFirstLineOffset(0), nAbsLSpace(0), nLSpace(0), nCharTextDistance(0), - // --> OD 2008-01-09 #newlistlevelattrs# meLabelFollowedBy( LISTTAB ), mnListtabPos( 0 ), mnFirstLineIndent( 0 ), mnIndentAt( 0 ), - // <-- pGraphicBrush(0), eVertOrient(text::VertOrientation::NONE), pBulletFont(0) { } -/* -----------------27.10.98 10:56------------------- - * - * --------------------------------------------------*/ + SvxNumberFormat::SvxNumberFormat(const SvxNumberFormat& rFormat) : SvxNumberType(rFormat), - // --> OD 2008-01-09 #newlistlevelattrs# mePositionAndSpaceMode( rFormat.mePositionAndSpaceMode ), - // <-- pGraphicBrush(0), pBulletFont(0) { *this = rFormat; } -/* -----------------27.10.98 10:56------------------- - * - * --------------------------------------------------*/ + SvxNumberFormat::~SvxNumberFormat() { delete pGraphicBrush; delete pBulletFont; } -/* -----------------08.12.98 11:14------------------- - * - * --------------------------------------------------*/ + SvxNumberFormat::SvxNumberFormat(SvStream &rStream) : mePositionAndSpaceMode( LABEL_WIDTH_AND_POSITION ), meLabelFollowedBy( LISTTAB ), @@ -328,9 +303,7 @@ SvxNumberFormat::SvxNumberFormat(SvStream &rStream) mnIndentAt = nLong; } } -/* -----------------08.12.98 11:14------------------- - * - * --------------------------------------------------*/ + SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter) { if(pConverter && pBulletFont) @@ -361,7 +334,7 @@ SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pC { 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()) @@ -401,9 +374,6 @@ SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pC return rStream; } -/* -----------------------------23.02.01 11:10-------------------------------- - - ---------------------------------------------------------------------------*/ SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat ) { if (& rFormat == this) { return *this; } @@ -413,19 +383,15 @@ SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat ) nInclUpperLevels = rFormat.nInclUpperLevels ; nStart = rFormat.nStart ; cBullet = rFormat.cBullet ; - // --> OD 2008-01-09 #newlistlevelattrs# mePositionAndSpaceMode = rFormat.mePositionAndSpaceMode; - // <-- nFirstLineOffset = rFormat.nFirstLineOffset; nAbsLSpace = rFormat.nAbsLSpace ; nLSpace = rFormat.nLSpace ; nCharTextDistance = rFormat.nCharTextDistance ; - // --> OD 2008-01-09 #newlistlevelattrs# meLabelFollowedBy = rFormat.meLabelFollowedBy; mnListtabPos = rFormat.mnListtabPos; mnFirstLineIndent = rFormat.mnFirstLineIndent; mnIndentAt = rFormat.mnIndentAt; - // <-- eVertOrient = rFormat.eVertOrient ; sPrefix = rFormat.sPrefix ; sSuffix = rFormat.sSuffix ; @@ -445,9 +411,7 @@ SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat ) pBulletFont = new Font(*rFormat.pBulletFont); return *this; } -/* -----------------27.10.98 10:56------------------- - * - * --------------------------------------------------*/ + sal_Bool SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const { if( GetNumberingType() != rFormat.GetNumberingType() || @@ -455,19 +419,15 @@ sal_Bool SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const nInclUpperLevels != rFormat.nInclUpperLevels || nStart != rFormat.nStart || cBullet != rFormat.cBullet || - // --> OD 2008-01-09 #newlistlevelattrs# mePositionAndSpaceMode != rFormat.mePositionAndSpaceMode || - // <-- nFirstLineOffset != rFormat.nFirstLineOffset || nAbsLSpace != rFormat.nAbsLSpace || nLSpace != rFormat.nLSpace || nCharTextDistance != rFormat.nCharTextDistance || - // --> OD 2008-01-09 #newlistlevelattrs# meLabelFollowedBy != rFormat.meLabelFollowedBy || mnListtabPos != rFormat.mnListtabPos || mnFirstLineIndent != rFormat.mnFirstLineIndent || mnIndentAt != rFormat.mnIndentAt || - // <-- eVertOrient != rFormat.eVertOrient || sPrefix != rFormat.sPrefix || sSuffix != rFormat.sSuffix || @@ -496,9 +456,7 @@ sal_Bool SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const } return sal_True; } -/* -----------------28.10.98 09:53------------------- - * - * --------------------------------------------------*/ + void SvxNumberFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize, const sal_Int16* pOrient) { @@ -523,9 +481,7 @@ void SvxNumberFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem, else aGraphicSize.Width() = aGraphicSize.Height() = 0; } -/* -----------------28.10.98 09:59------------------- - * - * --------------------------------------------------*/ + void SvxNumberFormat::SetGraphic( const String& rName ) { const String* pName; @@ -543,30 +499,23 @@ void SvxNumberFormat::SetGraphic( const String& rName ) aGraphicSize.Width() = aGraphicSize.Height() = 0; } -/* -----------------------------22.02.01 15:55-------------------------------- - ---------------------------------------------------------------------------*/ void SvxNumberFormat::SetVertOrient(sal_Int16 eSet) { eVertOrient = eSet; } -/* -----------------------------22.02.01 15:55-------------------------------- - ---------------------------------------------------------------------------*/ sal_Int16 SvxNumberFormat::GetVertOrient() const { return eVertOrient; } -/* -----------------28.10.98 09:59------------------- - * - * --------------------------------------------------*/ + void SvxNumberFormat::SetBulletFont(const Font* pFont) { delete pBulletFont; pBulletFont = pFont ? new Font(*pFont): 0; } -// --> OD 2008-01-09 #newlistlevelattrs# SvxNumberFormat::SvxNumPositionAndSpaceMode SvxNumberFormat::GetPositionAndSpaceMode() const { return mePositionAndSpaceMode; @@ -578,38 +527,22 @@ void SvxNumberFormat::SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePosit short SvxNumberFormat::GetLSpace() const { -//#if OSL_DEBUG_LEVEL > 1 -// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, -// "<SvxNumberFormat::GetLSpace()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); -//#endif return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nLSpace : 0; } short SvxNumberFormat::GetAbsLSpace() const { -//#if OSL_DEBUG_LEVEL > 1 -// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, -// "<SvxNumberFormat::GetAbsLSpace()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); -//#endif return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nAbsLSpace : static_cast<short>( GetFirstLineIndent() + GetIndentAt() ); } short SvxNumberFormat::GetFirstLineOffset() const { -//#if OSL_DEBUG_LEVEL > 1 -// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, -// "<SvxNumberFormat::GetFirstLineOffset()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); -//#endif return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nFirstLineOffset : static_cast<short>( GetFirstLineIndent() ); } short SvxNumberFormat::GetCharTextDistance() const { -//#if OSL_DEBUG_LEVEL > 1 -// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, -// "<SvxNumberFormat::GetCharTextDistance()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); -//#endif return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nCharTextDistance : 0; } @@ -645,14 +578,10 @@ long SvxNumberFormat::GetIndentAt() const { return mnIndentAt; } -// <-- -/* -----------------28.10.98 10:03------------------- - * - * --------------------------------------------------*/ 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(); @@ -662,16 +591,11 @@ IMPL_STATIC_LINK( SvxNumberFormat, GraphicArrived, void *, EMPTYARG ) pThis->NotifyGraphicArrived(); return 0; } -/* -----------------------------02.07.01 15:36-------------------------------- - ---------------------------------------------------------------------------*/ void SvxNumberFormat::NotifyGraphicArrived() { } -/* -----------------28.10.98 10:38------------------- - * - * --------------------------------------------------*/ Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* pGraphic) { const MapMode aMapMM100( MAP_100TH_MM ); @@ -689,17 +613,15 @@ Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* pGraphic) aRetSize = OutputDevice::LogicToLogic( rSize, pGraphic->GetPrefMapMode(), aMapMM100 ); return aRetSize; } -/* -----------------28.10.98 15:57------------------- - * - * --------------------------------------------------*/ + 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; sal_uInt16 nMask = 1000; @@ -732,59 +654,20 @@ String SvxNumberFormat::CreateRomanString( sal_uLong nNo, sal_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( sal_uLong nNo, String& rStr ) const -{ - DBG_ASSERT( nNo, "0 ist eine ungueltige Nummer !!" ); - - const sal_uLong coDiff = 'Z' - 'A' +1; - char cAdd = (SVX_NUM_CHARS_UPPER_LETTER == eNumType ? 'A' : 'a') - 1; - sal_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( sal_uLong nNo, String& rStr ) const -{ - DBG_ASSERT( nNo, "0 ist eine ungueltige Nummer !!" ); - - const sal_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( (sal_uInt16)(nNo / coDiff) + 1, sal_Unicode(cChar) ); -} -#endif //OLD_NUMBER_FORMATTING -/* -----------------------------22.02.01 13:31-------------------------------- - - ---------------------------------------------------------------------------*/ const String& SvxNumberFormat::GetCharFmtName()const { return sCharStyleName; } -/* -----------------27.10.98 10:38------------------- - * - * --------------------------------------------------*/ + sal_Int32 SvxNumRule::nRefCount = 0; static SvxNumberFormat* pStdNumFmt = 0; static SvxNumberFormat* pStdOutlineNumFmt = 0; -// --> OD 2008-02-11 #newlistlevelattrs# SvxNumRule::SvxNumRule( sal_uLong nFeatures, sal_uInt16 nLevels, sal_Bool bCont, @@ -804,10 +687,9 @@ SvxNumRule::SvxNumRule( sal_uLong nFeatures, 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) { - // --> OD 2008-02-11 #newlistlevelattrs# if ( eDefaultNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { @@ -830,7 +712,6 @@ SvxNumRule::SvxNumRule( sal_uLong nFeatures, aFmts[i]->SetFirstLineIndent( cFirstLineIndent ); aFmts[i]->SetIndentAt( cIndentAt * (i+2) ); } - // <-- } else { @@ -843,9 +724,7 @@ SvxNumRule::SvxNumRule( sal_uLong nFeatures, aFmtsSet[i] = sal_False; } } -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ + SvxNumRule::SvxNumRule(const SvxNumRule& rCopy) { ++nRefCount; @@ -864,9 +743,7 @@ SvxNumRule::SvxNumRule(const SvxNumRule& rCopy) aFmtsSet[i] = rCopy.aFmtsSet[i]; } } -/* -----------------08.12.98 11:07------------------- - * - * --------------------------------------------------*/ + SvxNumRule::SvxNumRule(SvStream &rStream) { ++nRefCount; @@ -902,9 +779,6 @@ SvxNumRule::SvxNumRule(SvStream &rStream) } } -/* -----------------08.12.98 11:07------------------- - * - * --------------------------------------------------*/ SvStream& SvxNumRule::Store(SvStream &rStream) { rStream<<(sal_uInt16)NUMITEM_VERSION_03; @@ -941,9 +815,6 @@ SvStream& SvxNumRule::Store(SvStream &rStream) return rStream; } -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ SvxNumRule::~SvxNumRule() { for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) @@ -954,9 +825,7 @@ SvxNumRule::~SvxNumRule() DELETEZ(pStdOutlineNumFmt); } } -/* -----------------29.10.98 16:07------------------- - * - * --------------------------------------------------*/ + SvxNumRule& SvxNumRule::operator=( const SvxNumRule& rCopy ) { nLevelCount = rCopy.nLevelCount; @@ -974,9 +843,7 @@ SvxNumRule& SvxNumRule::operator=( const SvxNumRule& rCopy ) } return *this; } -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ + int SvxNumRule::operator==( const SvxNumRule& rCopy) const { if(nLevelCount != rCopy.nLevelCount || @@ -998,20 +865,16 @@ int SvxNumRule::operator==( const SvxNumRule& rCopy) const } return sal_True; } -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ + 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; } -/* -----------------02.11.98 09:10------------------- - * - * --------------------------------------------------*/ + const SvxNumberFormat& SvxNumRule::GetLevel(sal_uInt16 nLevel)const { if(!pStdNumFmt) @@ -1020,34 +883,28 @@ const SvxNumberFormat& SvxNumRule::GetLevel(sal_uInt16 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; } -/* -----------------29.10.98 09:08------------------- - * - * --------------------------------------------------*/ 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 ))) ) { delete aFmts[ i ]; aFmts[ i ] = new SvxNumberFormat( rNumFmt ); aFmtsSet[i] = bIsValid; -// bInvalidRuleFlag = sal_True; } } -/* -----------------30.10.98 12:44------------------- - * - * --------------------------------------------------*/ + 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 ) { @@ -1061,9 +918,7 @@ void SvxNumRule::SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt) } } } -/* -----------------28.10.98 15:38------------------- - * - * --------------------------------------------------*/ + String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings ) const { String aStr; @@ -1075,7 +930,7 @@ String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings sal_uInt8 i = rNum.GetLevel(); if( !IsContinuousNumbering() && - 1 < rMyNFmt.GetIncludeUpperLevels() ) // nur der eigene Level ? + 1 < rMyNFmt.GetIncludeUpperLevels() ) // only on own level? { sal_uInt8 n = rMyNFmt.GetIncludeUpperLevels(); if( 1 < n ) @@ -1092,9 +947,6 @@ String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings 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; } @@ -1107,7 +959,7 @@ String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings 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('.'); } @@ -1121,9 +973,8 @@ String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings } return aStr; } -/* -----------------18.08.99 10:18------------------- - Description: changes linked to embedded bitmaps - --------------------------------------------------*/ + +// changes linked to embedded bitmaps sal_Bool SvxNumRule::UnLinkGraphics() { sal_Bool bRet = sal_False; @@ -1155,18 +1006,12 @@ sal_Bool SvxNumRule::UnLinkGraphics() return bRet; } -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule) : SfxPoolItem(SID_ATTR_NUMBERING_RULE), pNumRule(new SvxNumRule(rRule)) { } -/*-----------------23.11.98 10:36------------------- - MT: Das sind ja sehr sinnige Kommentare... ---------------------------------------------------*/ SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule, sal_uInt16 _nWhich ) : SfxPoolItem(_nWhich), pNumRule(new SvxNumRule(rRule)) @@ -1178,63 +1023,45 @@ SfxPoolItem* SvxNumBulletItem::Create(SvStream &s, sal_uInt16 n) const return SfxPoolItem::Create(s, n ); } -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) : SfxPoolItem(rCopy.Which()) { pNumRule = new SvxNumRule(*rCopy.pNumRule); } -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ + SvxNumBulletItem::~SvxNumBulletItem() { delete pNumRule; } -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ int SvxNumBulletItem::operator==( const SfxPoolItem& rCopy) const { return *pNumRule == *((SvxNumBulletItem&)rCopy).pNumRule; } -/* -----------------27.10.98 10:41------------------- - * - * --------------------------------------------------*/ + SfxPoolItem* SvxNumBulletItem::Clone( SfxItemPool * ) const { return new SvxNumBulletItem(*this); } -/* -----------------08.12.98 10:43------------------- - * - * --------------------------------------------------*/ + sal_uInt16 SvxNumBulletItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const { return NUMITEM_VERSION_03; } -/* -----------------08.12.98 10:43------------------- - * - * --------------------------------------------------*/ + SvStream& SvxNumBulletItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/ )const { pNumRule->Store(rStream); return rStream; } -/* -----------------08.12.98 10:43------------------- - * - * --------------------------------------------------*/ - -sal_Bool SvxNumBulletItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +bool SvxNumBulletItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { rVal <<= SvxCreateNumRule( pNumRule ); - return sal_True; + return true; } -sal_Bool SvxNumBulletItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) +bool SvxNumBulletItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { uno::Reference< container::XIndexReplace > xRule; if( rVal >>= xRule ) @@ -1251,18 +1078,15 @@ sal_Bool SvxNumBulletItem::PutValue( const com::sun::star::uno::Any& rVal, sal_u } delete pNumRule; pNumRule = pNewRule; - return sal_True; + return true; } catch(lang::IllegalArgumentException&) { } } - return sal_False; + return false; } -/* -----------------08.12.98 10:43------------------- - * - * --------------------------------------------------*/ SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevels, SvxNumRuleType eType ) { const sal_uInt16 nSrcLevels = pRule->GetLevelCount(); @@ -1273,3 +1097,5 @@ SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevels, SvxN return pNewRule; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/optitems.cxx b/editeng/source/items/optitems.cxx index 0147e9c54299..260191080088 100644 --- a/editeng/source/items/optitems.cxx +++ b/editeng/source/items/optitems.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -201,3 +202,4 @@ SvStream& SfxHyphenRegionItem::Store( SvStream& rStrm, sal_uInt16 ) const } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/paperinf.cxx b/editeng/source/items/paperinf.cxx index 8ba97193c3bc..9d48831776b0 100644 --- a/editeng/source/items/paperinf.cxx +++ b/editeng/source/items/paperinf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,7 +40,7 @@ #include <editeng/eerdll.hxx> /*-------------------------------------------------------------------- - Beschreibung: Ist der Printer gueltig + Description: Is the printer valid --------------------------------------------------------------------*/ inline sal_Bool IsValidPrinter( const Printer* pPtr ) @@ -57,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 ? @@ -75,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; @@ -93,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; @@ -129,8 +129,7 @@ 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 ) @@ -139,3 +138,4 @@ String SvxPaperInfo::GetName( Paper ePaper ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 21149ec1e610..066d2da7667d 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -123,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) @@ -140,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) - ---------------------------------------------------*/ -sal_Bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, sal_uInt8 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; @@ -187,15 +184,13 @@ sal_Bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) c 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 sal_True; + return true; } -/*-----------------18.03.98 16:32------------------- ---------------------------------------------------*/ -sal_Bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -211,7 +206,7 @@ sal_Bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 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 ) @@ -326,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; } @@ -387,12 +382,8 @@ int SvxAdjustItem::operator==( const SfxPoolItem& rAttr ) const ? 1 : 0 ); } -/*-----------------18.03.98 16:15------------------- - ---------------------------------------------------*/ -sal_Bool SvxAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -406,15 +397,11 @@ sal_Bool SvxAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const } default: ;//prevent warning } - return sal_True; + return true; } -/*-----------------18.03.98 16:15------------------- - ---------------------------------------------------*/ -sal_Bool SvxAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -445,7 +432,7 @@ sal_Bool SvxAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) bOneBlock = Any2Bool(rVal); break; } - return sal_True; + return true; } // ----------------------------------------------------------------------- @@ -709,9 +696,8 @@ SvxHyphenZoneItem::SvxHyphenZoneItem( const sal_Bool bHyph, const sal_uInt16 nId } // ----------------------------------------------------------------------- -sal_Bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -728,18 +714,17 @@ sal_Bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) rVal <<= (sal_Int16)nMaxHyphens; break; } - return sal_True; + return true; } // ----------------------------------------------------------------------- -sal_Bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 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; if( nMemberId != MID_IS_HYPHEN ) if(!(rVal >>= nNewVal)) - return sal_False; + return false; switch(nMemberId) { @@ -756,7 +741,7 @@ sal_Bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId nMaxHyphens = (sal_uInt8)nNewVal; break; } - return sal_True; + return true; } // ----------------------------------------------------------------------- @@ -884,7 +869,7 @@ SvxTabStop::SvxTabStop() // ----------------------------------------------------------------------- -SvxTabStop::SvxTabStop( const long nPos, const SvxTabAdjust eAdjst, +SvxTabStop::SvxTabStop( const sal_Int32 nPos, const SvxTabAdjust eAdjst, const sal_Unicode cDec, const sal_Unicode cFil ) { nTabPos = nPos; @@ -976,7 +961,7 @@ sal_uInt16 SvxTabStopItem::GetPos( const SvxTabStop& rTab ) const // ----------------------------------------------------------------------- -sal_uInt16 SvxTabStopItem::GetPos( const long nPos ) const +sal_uInt16 SvxTabStopItem::GetPos( const sal_Int32 nPos ) const { sal_uInt16 nFound; return Seek_Entry( SvxTabStop( nPos ), &nFound ) ? nFound : SVX_TAB_NOTFOUND; @@ -991,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------------------- - ---------------------------------------------------*/ - -sal_Bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1055,11 +1016,8 @@ sal_Bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const } return sal_True; } -/*-----------------19.03.98 08:50------------------- - ---------------------------------------------------*/ -sal_Bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1140,9 +1098,12 @@ sal_Bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int32 nNewPos = 0; if (!(rVal >>= nNewPos) ) return sal_False; + if (bConvert) + nNewPos = MM100_TO_TWIP ( nNewPos ); + if (nNewPos <= 0) + return sal_False; const SvxTabStop& rTab = *(GetStart()); - SvxTabStop aNewTab ( bConvert ? MM100_TO_TWIP ( nNewPos ) : nNewPos, - rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() ); + SvxTabStop aNewTab ( nNewPos, rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() ); Remove ( 0 ); Insert( aNewTab ); break; @@ -1188,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 ) @@ -1198,13 +1158,12 @@ SfxItemPresentation SvxTabStopItem::GetPresentation if ( bComma ) rText += sal_Unicode(','); rText += GetMetricText( - (long)((*this)[i]).GetTabPos(), eCoreUnit, ePresUnit, pIntl ); + ((*this)[i]).GetTabPos(), eCoreUnit, ePresUnit, pIntl ); if ( SFX_ITEM_PRESENTATION_COMPLETE == ePres ) rText += EE_RESSTR(GetMetricId(ePresUnit)); bComma = sal_True; } } -#endif } return ePres; } @@ -1220,7 +1179,7 @@ SfxPoolItem* SvxTabStopItem::Create( SvStream& rStrm, sal_uInt16 ) const for ( sal_Int8 i = 0; i < nTabs; i++ ) { - long nPos; + sal_Int32 nPos(0); sal_Int8 eAdjust; unsigned char cDecimal, cFill; rStrm >> nPos >> eAdjust >> cDecimal >> cFill; @@ -1235,34 +1194,32 @@ 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 FASTBOOL bStoreDefTabs = pPool + const bool bStoreDefTabs = pPool && pPool->GetName().EqualsAscii("SWG") && ::IsDefaultItem( this ); const short nTabs = Count(); sal_uInt16 nCount = 0, nDefDist = 0; - long nNew = 0; + sal_Int32 nNew = 0; if( bStoreDefTabs ) { const SvxTabStopItem& rDefTab = (const SvxTabStopItem &) pPool->GetDefaultItem( pPool->GetWhich( SID_ATTR_TABSTOP, sal_False ) ); nDefDist = sal_uInt16( rDefTab.GetStart()->GetTabPos() ); - const long nPos = nTabs > 0 ? (*this)[nTabs-1].GetTabPos() : 0; + const sal_Int32 nPos = nTabs > 0 ? (*this)[nTabs-1].GetTabPos() : 0; nCount = (sal_uInt16)(nPos / nDefDist); nNew = (nCount + 1) * nDefDist; if( nNew <= nPos + 50 ) nNew += nDefDist; - long lA3Width = SvxPaperInfo::GetPaperSize(PAPER_A3).Width(); + sal_Int32 lA3Width = SvxPaperInfo::GetPaperSize(PAPER_A3).Width(); nCount = (sal_uInt16)(nNew < lA3Width ? ( lA3Width - nNew ) / nDefDist + 1 : 0); } @@ -1270,7 +1227,7 @@ SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) for ( short i = 0; i < nTabs; i++ ) { const SvxTabStop& rTab = (*this)[ i ]; - rStrm << (long) rTab.GetTabPos() + rStrm << rTab.GetTabPos() << (sal_Int8) rTab.GetAdjustment() << (unsigned char) rTab.GetDecimal() << (unsigned char) rTab.GetFill(); @@ -1280,7 +1237,7 @@ SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) for( ; nCount; --nCount ) { SvxTabStop aSwTabStop(nNew, SVX_TAB_ADJUST_DEFAULT); - rStrm << (long) aSwTabStop.GetTabPos() + rStrm << aSwTabStop.GetTabPos() << (sal_Int8) aSwTabStop.GetAdjustment() << (unsigned char) aSwTabStop.GetDecimal() << (unsigned char) aSwTabStop.GetFill(); @@ -1380,24 +1337,22 @@ SfxPoolItem* SvxPageModelItem::Clone( SfxItemPool* ) const //------------------------------------------------------------------------ -sal_Bool SvxPageModelItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 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; } -sal_Bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 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; @@ -1405,7 +1360,7 @@ sal_Bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any& rVal, sal_u { 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; @@ -1420,7 +1375,7 @@ SfxItemPresentation SvxPageModelItem::GetPresentation ) const { rText.Erase(); - FASTBOOL bSet = ( GetValue().Len() > 0 ); + bool bSet = ( GetValue().Len() > 0 ); switch ( ePres ) { @@ -1468,7 +1423,7 @@ 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; } @@ -1521,7 +1476,7 @@ 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; } @@ -1556,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, sal_uInt16) const { sal_Bool nValue; rStrm >> nValue; return new SvxForbiddenRuleItem( nValue, Which() ); } -/* -----------------------------29.11.00 11:23-------------------------------- - ---------------------------------------------------------------------------*/ 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*/, @@ -1675,14 +1622,14 @@ SfxItemPresentation SvxParaVertAlignItem::GetPresentation( return SFX_ITEM_PRESENTATION_NONE; } -sal_Bool SvxParaVertAlignItem::QueryValue( com::sun::star::uno::Any& rVal, +bool SvxParaVertAlignItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { rVal <<= (sal_Int16)GetValue(); return sal_True; } -sal_Bool SvxParaVertAlignItem::PutValue( const com::sun::star::uno::Any& rVal, +bool SvxParaVertAlignItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { sal_Int16 nVal = sal_Int16(); @@ -1724,7 +1671,7 @@ 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; } @@ -1755,3 +1702,4 @@ SfxItemPresentation SvxParaGridItem::GetPresentation( } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/svdfield.cxx b/editeng/source/items/svdfield.cxx index 30763ec4f925..41f0bc8faae1 100644 --- a/editeng/source/items/svdfield.cxx +++ b/editeng/source/items/svdfield.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,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 @@ -35,31 +33,33 @@ 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) { sal_uInt16 nFieldKind; rIn>>nFieldKind; eMeasureFieldKind=(SdrMeasureFieldKind)nFieldKind; } -void __EXPORT SdrMeasureField::Save(SvPersistStream& rOut) +void SdrMeasureField::Save(SvPersistStream& rOut) { rOut<<(sal_uInt16)eMeasureFieldKind; } ////////////////////////////////////////////////////////////////////////////// // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index bfbb994924cd..e7062bfbf5dc 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,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 66 - #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() { @@ -74,10 +69,6 @@ SvxFont::SvxFont( const Font &rFont ) eLang = LANGUAGE_SYSTEM; } -/************************************************************************* - * class SvxFont: Copy-Ctor - *************************************************************************/ - SvxFont::SvxFont( const SvxFont &rFont ) : Font( rFont ) { @@ -88,9 +79,6 @@ 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, sal_Bool bLeft ) @@ -128,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; @@ -158,9 +143,9 @@ 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. + // 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( sal_uInt16 i = 0; i < aTxt.Len(); ++i ) @@ -190,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 @@ -237,8 +222,8 @@ void SvxDoCapitals::Do( const XubString &/*_rTxt*/, const xub_StrLen /*_nIdx*/, /************************************************************************* * 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 @@ -264,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 ) { @@ -299,7 +284,7 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const 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 ); @@ -329,7 +314,7 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const 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 ); @@ -359,9 +344,6 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const rDo.DoSpace( sal_True ); } -/************************************************************************** - * SvxFont::SetPhysFont() - *************************************************************************/ void SvxFont::SetPhysFont( OutputDevice *pOut ) const { @@ -382,9 +364,6 @@ void SvxFont::SetPhysFont( OutputDevice *pOut ) const } } -/************************************************************************* - * SvxFont::ChgPhysFont() - *************************************************************************/ Font SvxFont::ChgPhysFont( OutputDevice *pOut ) const { @@ -393,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 @@ -478,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; @@ -506,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, @@ -516,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 ) @@ -545,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 ); @@ -568,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 @@ -592,7 +562,6 @@ void SvxFont::QuickDrawText( OutputDevice *pOut, } } -// ----------------------------------------------------------------------- void SvxFont::DrawPrev( OutputDevice *pOut, Printer* pPrinter, const Point &rPos, const XubString &rTxt, @@ -602,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 ); @@ -654,7 +623,6 @@ void SvxFont::DrawPrev( OutputDevice *pOut, Printer* pPrinter, pPrinter->SetFont( aOldPrnFont ); } -// ----------------------------------------------------------------------- SvxFont& SvxFont::operator=( const Font& rFont ) { @@ -673,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: @@ -708,7 +669,7 @@ void SvxDoGetCapitalSize::Do( const XubString &_rTxt, const xub_StrLen _nIdx, if ( !bUpper ) { sal_uInt8 nProp = pFont->GetPropr(); - pFont->SetProprRel( KAPITAELCHENPROP ); + pFont->SetProprRel( SMALL_CAPS_PERCENTAGE ); pFont->SetPhysFont( pOut ); aPartSize.setWidth( pOut->GetTextWidth( _rTxt, _nIdx, _nLen ) ); aPartSize.setHeight( pOut->GetTextHeight() ); @@ -725,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 { @@ -747,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: @@ -808,7 +759,7 @@ void SvxDoDrawCapital::Do( const XubString &_rTxt, const xub_StrLen _nIdx, 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 ); @@ -816,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 ); @@ -830,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 ) @@ -841,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, @@ -855,3 +806,4 @@ void SvxFont::DrawCapital( OutputDevice *pOut, #endif // !REDUCEDSVXFONT +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/svxitems.src b/editeng/source/items/svxitems.src index d738a10a1ede..a661aab97ac0 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 { @@ -1023,5 +1012,56 @@ String RID_SVXITEMS_CHARHIDDEN_TRUE { Text [ en-US ] = "Hidden"; }; + // enum SvxCellHorJustify ---------------------------------------------------- +String RID_SVXITEMS_HORJUST_STANDARD +{ + Text [ en-US ] = "Horizontal alignment default" ; +}; +String RID_SVXITEMS_HORJUST_LEFT +{ + Text [ en-US ] = "Align left" ; +}; +String RID_SVXITEMS_HORJUST_CENTER +{ + Text [ en-US ] = "Centered horizontally" ; +}; +String RID_SVXITEMS_HORJUST_RIGHT +{ + Text [ en-US ] = "Align right" ; +}; +String RID_SVXITEMS_HORJUST_BLOCK +{ + Text [ en-US ] = "Justify" ; +}; +String RID_SVXITEMS_HORJUST_REPEAT +{ + Text [ en-US ] = "Repeat alignment" ; +}; + // enum SvxCellVerJustify ---------------------------------------------------- +String RID_SVXITEMS_VERJUST_STANDARD +{ + Text [ en-US ] = "Vertical alignment default" ; +}; +String RID_SVXITEMS_VERJUST_TOP +{ + Text [ en-US ] = "Align to top" ; +}; +String RID_SVXITEMS_VERJUST_CENTER +{ + Text [ en-US ] = "Centered vertically" ; +}; +String RID_SVXITEMS_VERJUST_BOTTOM +{ + Text [ en-US ] = "Align to bottom" ; +}; + // enum SvxCellJustifyMethod ---------------------------------------------------- +String RID_SVXITEMS_JUSTMETHOD_AUTO +{ + Text [ en-US ] = "Automatic" ; +}; +String RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE +{ + Text [ en-US ] = "Distributed" ; +}; // ********************************************************************** EOF diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index f0fa8cd02d8f..f4f03f739130 100755..100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -109,7 +110,6 @@ #include <editeng/itemtype.hxx> #include <editeng/eerdll.hxx> -// #90477# #include <tools/tenccvt.hxx> #define STORE_UNICODE_MAGIC_MARKER 0xFE331188 @@ -118,7 +118,7 @@ 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)) @@ -209,10 +209,10 @@ int SvxFontListItem::operator==( const SfxPoolItem& rAttr ) const return( pFontList == ((SvxFontListItem&)rAttr).pFontList ); } -sal_Bool SvxFontListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +bool SvxFontListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { rVal <<= aFontNameSeq; - return sal_True; + return true; } //------------------------------------------------------------------------ @@ -267,9 +267,8 @@ SvxFontItem& SvxFontItem::operator=(const SvxFontItem& rFont) } // ----------------------------------------------------------------------- -sal_Bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -294,12 +293,11 @@ sal_Bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const case MID_FONT_CHAR_SET : rVal <<= (sal_Int16)(eTextEncoding); break; case MID_FONT_PITCH : rVal <<= (sal_Int16)(ePitch); break; } - return sal_True; + return true; } // ----------------------------------------------------------------------- -sal_Bool SvxFontItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) +bool SvxFontItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -357,7 +355,7 @@ sal_Bool SvxFontItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) } break; } - return sal_True; + return true; } // ----------------------------------------------------------------------- @@ -377,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; @@ -398,9 +396,6 @@ SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) co GetFamilyName().EqualsAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) || GetFamilyName().EqualsAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 ); - // #90477# rStrm << (sal_uInt8) GetFamily() - // << (sal_uInt8) GetPitch() - // << (sal_uInt8)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetStoreCharSet( GetCharSet(), (sal_uInt16)rStrm.GetVersion() ) ); rStrm << (sal_uInt8) GetFamily() << (sal_uInt8) GetPitch() << (sal_uInt8)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion())); @@ -410,7 +405,7 @@ SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) co 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; @@ -438,10 +433,10 @@ SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const // UNICODE: rStrm >> aStyle; rStrm.ReadByteString(aStyle); - // Task 91008/90471: set the "correct" textencoding + // 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; @@ -514,7 +509,7 @@ SfxPoolItem* SvxPostureItem::Clone( SfxItemPool * ) 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 } // ----------------------------------------------------------------------- @@ -581,13 +576,8 @@ XubString SvxPostureItem::GetValueTextByPos( sal_uInt16 nPos ) const return sTxt; } - -/*-----------------13.03.98 14:28------------------- - ---------------------------------------------------*/ -sal_Bool SvxPostureItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxPostureItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -595,17 +585,14 @@ sal_Bool SvxPostureItem::QueryValue( uno::Any& rVal, sal_uInt8 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 sal_True; + return true; } -/*-----------------13.03.98 14:28------------------- ---------------------------------------------------*/ -sal_Bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -626,7 +613,7 @@ sal_Bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) SetValue((sal_uInt16)eSlant); } } - return sal_True; + return true; } // ----------------------------------------------------------------------- @@ -683,7 +670,7 @@ void SvxWeightItem::SetBoolValue( sal_Bool bVal ) sal_uInt16 SvxWeightItem::GetValueCount() const { - return WEIGHT_BLACK; // WEIGHT_DONTKNOW geh"ort nicht dazu + return WEIGHT_BLACK; // WEIGHT_DONTKNOW does not belong } // ----------------------------------------------------------------------- @@ -742,12 +729,8 @@ XubString SvxWeightItem::GetValueTextByPos( sal_uInt16 nPos ) const return EE_RESSTR( RID_SVXITEMS_WEIGHT_BEGIN + nPos ); } -/*-----------------13.03.98 14:18------------------- - ---------------------------------------------------*/ -sal_Bool SvxWeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxWeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -760,14 +743,11 @@ sal_Bool SvxWeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const } break; } - return sal_True; + return true; } -/*-----------------13.03.98 14:18------------------- ---------------------------------------------------*/ -sal_Bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -788,7 +768,7 @@ sal_Bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } break; } - return sal_True; + return true; } // class SvxFontHeightItem ----------------------------------------------- @@ -798,7 +778,7 @@ SvxFontHeightItem::SvxFontHeightItem( const sal_uLong nSz, const sal_uInt16 nId ) : SfxPoolItem( nId ) { - SetHeight( nSz,nPrp ); // mit den Prozenten rechnen + SetHeight( nSz,nPrp ); // calculate in percentage } // ----------------------------------------------------------------------- @@ -818,8 +798,8 @@ SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) 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 + // 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; @@ -864,13 +844,10 @@ int SvxFontHeightItem::operator==( const SfxPoolItem& rItem ) const GetPropUnit() == ((SvxFontHeightItem&)rItem).GetPropUnit(); } -/*-----------------13.03.98 14:53------------------- - ---------------------------------------------------*/ -sal_Bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 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; @@ -880,8 +857,8 @@ sal_Bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) co { ::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); @@ -921,8 +898,8 @@ sal_Bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) co 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); @@ -966,9 +943,8 @@ sal_Bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) co } 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; @@ -988,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 @@ -1002,10 +978,7 @@ sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, SfxMapUn return nRet; } -/*-----------------13.03.98 14:53------------------- - ---------------------------------------------------*/ -sal_Bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1025,7 +998,7 @@ sal_Bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 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; } @@ -1050,7 +1023,7 @@ sal_Bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 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: @@ -1098,7 +1071,6 @@ SfxItemPresentation SvxFontHeightItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1126,7 +1098,6 @@ SfxItemPresentation SvxFontHeightItem::GetPresentation } default: ; //prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -1141,17 +1112,17 @@ sal_uInt16 SvxFontHeightItem::GetVersion(sal_uInt16 nFileVersion) const // ----------------------------------------------------------------------- -int SvxFontHeightItem::ScaleMetrics( long nMult, long nDiv ) +bool SvxFontHeightItem::ScaleMetrics( long nMult, long nDiv ) { nHeight = (sal_uInt32)Scale( nHeight, nMult, nDiv ); - return 1; + return true; } // ----------------------------------------------------------------------- -int SvxFontHeightItem::HasMetrics() const +bool SvxFontHeightItem::HasMetrics() const { - return 1; + return true; } void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp, @@ -1159,12 +1130,10 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewP { 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 @@ -1179,14 +1148,12 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp, { 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 @@ -1222,17 +1189,17 @@ SvStream& SvxFontWidthItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ // ----------------------------------------------------------------------- -int SvxFontWidthItem::ScaleMetrics( long nMult, long nDiv ) +bool SvxFontWidthItem::ScaleMetrics( long nMult, long nDiv ) { nWidth = (sal_uInt16)Scale( nWidth, nMult, nDiv ); - return 1; + return true; } // ----------------------------------------------------------------------- -int SvxFontWidthItem::HasMetrics() const +bool SvxFontWidthItem::HasMetrics() const { - return 1; + return true; } // ----------------------------------------------------------------------- @@ -1259,10 +1226,7 @@ int SvxFontWidthItem::operator==( const SfxPoolItem& rItem ) const GetProp() == ((SvxFontWidthItem&)rItem).GetProp(); } -/*-----------------13.03.98 16:03------------------- - ---------------------------------------------------*/ -sal_Bool SvxFontWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxFontWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1275,12 +1239,10 @@ sal_Bool SvxFontWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) con rVal <<= (sal_Int16)(nProp); break; } - return sal_True; + return true; } -/*-----------------13.03.98 16:03------------------- ---------------------------------------------------*/ -sal_Bool SvxFontWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxFontWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1297,7 +1259,7 @@ sal_Bool SvxFontWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) nWidth = nVal; break; } - return sal_True; + return true; } //------------------------------------------------------------------------ @@ -1310,7 +1272,6 @@ SfxItemPresentation SvxFontWidthItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1331,7 +1292,6 @@ SfxItemPresentation SvxFontWidthItem::GetPresentation } default: ; //prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -1376,7 +1336,7 @@ SfxPoolItem* SvxTextLineItem::Clone( SfxItemPool * ) 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 } // ----------------------------------------------------------------------- @@ -1406,7 +1366,6 @@ SfxItemPresentation SvxTextLineItem::GetPresentation XubString& rText, const IntlWrapper * /*pIntl*/ ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -1420,7 +1379,6 @@ SfxItemPresentation SvxTextLineItem::GetPresentation return ePres; default: ; //prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -1428,16 +1386,12 @@ SfxItemPresentation SvxTextLineItem::GetPresentation 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------------------- - ---------------------------------------------------*/ -sal_Bool SvxTextLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxTextLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -1454,15 +1408,12 @@ sal_Bool SvxTextLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) cons rVal = Bool2Any( !mColor.GetTransparency() ); break; } - return sal_True; + return true; } -/*-----------------13.03.98 16:28------------------- ---------------------------------------------------*/ -sal_Bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 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) @@ -1606,7 +1557,7 @@ void SvxCrossedOutItem::SetBoolValue( sal_Bool bVal ) sal_uInt16 SvxCrossedOutItem::GetValueCount() const { - return STRIKEOUT_DOUBLE + 1; // auch STRIKEOUT_NONE geh"ort dazu + return STRIKEOUT_DOUBLE + 1; // STRIKEOUT_NONE belongs also here } // ----------------------------------------------------------------------- @@ -1665,12 +1616,8 @@ XubString SvxCrossedOutItem::GetValueTextByPos( sal_uInt16 nPos ) const return EE_RESSTR( RID_SVXITEMS_STRIKEOUT_BEGIN + nPos ); } -/*-----------------13.03.98 16:28------------------- - ---------------------------------------------------*/ -sal_Bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -1681,14 +1628,11 @@ sal_Bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) co rVal <<= (sal_Int16)(GetValue()); break; } - return sal_True; + return true; } -/*-----------------13.03.98 16:29------------------- ---------------------------------------------------*/ -sal_Bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -2042,7 +1986,7 @@ 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; } @@ -2057,22 +2001,22 @@ int SvxColorItem::operator==( const SfxPoolItem& rAttr ) const // ----------------------------------------------------------------------- -sal_Bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { rVal <<= (sal_Int32)(mColor.GetColor()); - return sal_True; + return true; } // ----------------------------------------------------------------------- -sal_Bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) +bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { sal_Int32 nColor = 0; if(!(rVal >>= nColor)) return sal_False; mColor.SetColor( nColor ); - return sal_True; + return true; } // ----------------------------------------------------------------------- @@ -2111,7 +2055,6 @@ SfxItemPresentation SvxColorItem::GetPresentation XubString& rText, const IntlWrapper * /*pIntl*/ ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -2123,7 +2066,6 @@ SfxItemPresentation SvxColorItem::GetPresentation return ePres; default: ; //prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } @@ -2166,8 +2108,6 @@ SfxPoolItem* SvxCharSetColorItem::Clone( SfxItemPool * ) const SvStream& SvxCharSetColorItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - // #90477# rStrm << (sal_uInt8) GetStoreCharSet( GetCharSet(), (sal_uInt16)rStrm.GetVersion() ) - // << GetValue(); rStrm << (sal_uInt8)GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion()) << GetValue(); return rStrm; @@ -2221,17 +2161,17 @@ SvStream& SvxKerningItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) // ----------------------------------------------------------------------- -int SvxKerningItem::ScaleMetrics( long nMult, long nDiv ) +bool SvxKerningItem::ScaleMetrics( long nMult, long nDiv ) { SetValue( (sal_Int16)Scale( GetValue(), nMult, nDiv ) ); - return 1; + return true; } // ----------------------------------------------------------------------- -int SvxKerningItem::HasMetrics() const +bool SvxKerningItem::HasMetrics() const { - return 1; + return true; } // ----------------------------------------------------------------------- @@ -2253,7 +2193,6 @@ SfxItemPresentation SvxKerningItem::GetPresentation XubString& rText, const IntlWrapper *pIntl ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -2281,30 +2220,27 @@ SfxItemPresentation SvxKerningItem::GetPresentation } default: ; //prevent warning } -#endif return SFX_ITEM_PRESENTATION_NONE; } -/* -----------------------------19.02.01 12:21-------------------------------- - ---------------------------------------------------------------------------*/ -sal_Bool SvxKerningItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxKerningItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { sal_Int16 nVal = GetValue(); if(nMemberId & CONVERT_TWIPS) nVal = (sal_Int16)TWIP_TO_MM100(nVal); rVal <<= nVal; - return sal_True; + return true; } // ----------------------------------------------------------------------- -sal_Bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) +bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) { sal_Int16 nVal = sal_Int16(); if(!(rVal >>= nVal)) - return sal_False; + return false; if(nMemberId & CONVERT_TWIPS) nVal = (sal_Int16)MM100_TO_TWIP(nVal); SetValue(nVal); - return sal_True; + return true; } // class SvxCaseMapItem -------------------------------------------------- @@ -2377,27 +2313,21 @@ XubString SvxCaseMapItem::GetValueTextByPos( sal_uInt16 nPos ) const return EE_RESSTR( RID_SVXITEMS_CASEMAP_BEGIN + nPos ); } -/*-----------------13.03.98 16:29------------------- - ---------------------------------------------------*/ -sal_Bool SvxCaseMapItem::QueryValue( uno::Any& rVal, sal_uInt8 /*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; case SVX_CASEMAP_KAPITAELCHEN: nRet = style::CaseMap::SMALLCAPS; break; } rVal <<= (sal_Int16)(nRet); - return sal_True; + return true; } -/*-----------------13.03.98 16:29------------------- ---------------------------------------------------*/ -sal_Bool SvxCaseMapItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) +bool SvxCaseMapItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { sal_uInt16 nVal = sal_uInt16(); if(!(rVal >>= nVal)) @@ -2412,7 +2342,7 @@ sal_Bool SvxCaseMapItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ case style::CaseMap::SMALLCAPS: nVal = SVX_CASEMAP_KAPITAELCHEN; break; } SetValue(nVal); - return sal_True; + return true; } // class SvxEscapementItem ----------------------------------------------- @@ -2559,12 +2489,8 @@ void SvxEscapementItem::SetEnumValue( sal_uInt16 nVal ) SetEscapement( (const SvxEscapement)nVal ); } -/*-----------------13.03.98 17:05------------------- - ---------------------------------------------------*/ -sal_Bool SvxEscapementItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxEscapementItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -2578,14 +2504,11 @@ sal_Bool SvxEscapementItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) co rVal = Bool2Any(DFLT_ESC_AUTO_SUB == nEsc || DFLT_ESC_AUTO_SUPER == nEsc); break; } - return sal_True; + return true; } -/*-----------------13.03.98 17:05------------------- ---------------------------------------------------*/ -sal_Bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -2625,7 +2548,7 @@ sal_Bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId } break; } - return sal_True; + return true; } // class SvxLanguageItem ------------------------------------------------- @@ -2681,7 +2604,6 @@ SfxItemPresentation SvxLanguageItem::GetPresentation XubString& rText, const IntlWrapper * /*pIntl*/ ) const { -#ifndef SVX_LIGHT switch ( ePres ) { case SFX_ITEM_PRESENTATION_NONE: @@ -2696,16 +2618,11 @@ SfxItemPresentation SvxLanguageItem::GetPresentation } default: ; //prevent warning } -#endif // !SVX_LIGHT return SFX_ITEM_PRESENTATION_NONE; } -/*-----------------14.03.98 14:13------------------- - ---------------------------------------------------*/ -sal_Bool SvxLanguageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxLanguageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -2717,14 +2634,11 @@ sal_Bool SvxLanguageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) cons rVal <<= aRet; break; } - return sal_True; + return true; } -/*-----------------14.03.98 14:13------------------- ---------------------------------------------------*/ -sal_Bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -2732,7 +2646,7 @@ sal_Bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Int32 nValue = 0; if(!(rVal >>= nValue)) - return sal_False; + return false; SetValue((sal_Int16)nValue); } @@ -2750,7 +2664,7 @@ sal_Bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } break; } - return sal_True; + return true; } // class SvxNoLinebreakItem ---------------------------------------------- @@ -2843,7 +2757,7 @@ SfxItemPresentation SvxNoHyphenItem::GetPresentation } /* - * Dummy-Item fuer ToolBox-Controls: + * Dummy item for ToolBox controls: * */ @@ -3031,9 +2945,8 @@ SfxItemPresentation SvxEmphasisMarkItem::GetPresentation // ----------------------------------------------------------------------- -sal_Bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -3055,14 +2968,13 @@ sal_Bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) } break; } - return sal_True; + return true; } -sal_Bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) +bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; + sal_Bool bRet = true; switch( nMemberId ) { case MID_EMPHASIS: @@ -3080,7 +2992,7 @@ sal_Bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberI case FontEmphasis::CIRCLE_BELOW: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_BELOW; break; case FontEmphasis::DISK_BELOW : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_BELOW; break; case FontEmphasis::ACCENT_BELOW: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_BELOW; break; - default: return sal_False; + default: return false; } SetValue( (sal_Int16)nValue ); } @@ -3094,7 +3006,7 @@ 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; } @@ -3136,12 +3048,11 @@ SfxPoolItem* SvxTwoLinesItem::Clone( SfxItemPool* ) const return new SvxTwoLinesItem( *this ); } -sal_Bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal, +bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; + sal_Bool bRet = true; switch( nMemberId ) { case MID_TWOLINES: @@ -3164,16 +3075,15 @@ sal_Bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal, } break; default: - bRet = sal_False; + bRet = false; break; } return bRet; } -sal_Bool SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any& rVal, +bool SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Bool bRet = sal_False; OUString s; @@ -3322,12 +3232,11 @@ SfxItemPresentation SvxCharRotateItem::GetPresentation( return SFX_ITEM_PRESENTATION_NONE; } -sal_Bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal, +bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; + bool bRet = true; switch( nMemberId ) { case MID_ROTATE: @@ -3337,18 +3246,17 @@ sal_Bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal, rVal = Bool2Any( IsFitToLine() ); break; default: - bRet = sal_False; + bRet = false; break; } return bRet; } -sal_Bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal, +bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; + bool bRet = true; switch( nMemberId ) { case MID_ROTATE: @@ -3365,7 +3273,7 @@ sal_Bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal, SetFitToLine( Any2Bool( rVal ) ); break; default: - bRet = sal_False; + bRet = false; } return bRet; } @@ -3401,8 +3309,8 @@ SfxPoolItem* SvxCharScaleWidthItem::Create( SvStream& rStrm, sal_uInt16 ) const if ( Which() == EE_CHAR_FONTWIDTH ) { - // #87271#: Was a SvxFontWidthItem in 5.2 - // sal_uInt16 nFixWidth, sal_uInt16 nPropWidth. + // Was a SvxFontWidthItem in 5.2 + // USHORT nFixWidth, USHORT nPropWidth. // nFixWidth has never been used... rStrm >> nVal; sal_uInt16 nTest; @@ -3465,7 +3373,7 @@ SfxItemPresentation SvxCharScaleWidthItem::GetPresentation( return SFX_ITEM_PRESENTATION_NONE; } -sal_Bool SvxCharScaleWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 /*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 @@ -3473,19 +3381,19 @@ sal_Bool SvxCharScaleWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMem if (rVal >>= nValue) { SetValue( (sal_uInt16) nValue ); - return sal_True; + return true; } - DBG_ERROR( "SvxCharScaleWidthItem::PutValue - Wrong type!" ); - return sal_False; + OSL_TRACE( "SvxCharScaleWidthItem::PutValue - Wrong type!" ); + return false; } -sal_Bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 /*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 rVal <<= (sal_Int16)GetValue(); - return sal_True; + return true; } /************************************************************************* @@ -3560,12 +3468,11 @@ SfxItemPresentation SvxCharReliefItem::GetPresentation return eRet; } -sal_Bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal, +bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; + bool bRet = true; switch( nMemberId ) { case MID_RELIEF: @@ -3575,29 +3482,28 @@ sal_Bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal, if(nVal >= 0 && nVal <= RELIEF_ENGRAVED) SetValue( (sal_uInt16)nVal ); else - bRet = sal_False; + bRet = false; } break; default: - bRet = sal_False; + bRet = false; break; } return bRet; } -sal_Bool SvxCharReliefItem::QueryValue( com::sun::star::uno::Any& rVal, +bool SvxCharReliefItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const { -// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_True; + bool bRet = true; switch( nMemberId ) { case MID_RELIEF: rVal <<= (sal_Int16)GetValue(); break; default: - bRet = sal_False; + bRet = false; break; } return bRet; @@ -3851,3 +3757,5 @@ short GetI18NScriptType( sal_uInt16 nItemType ) } return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/writingmodeitem.cxx b/editeng/source/items/writingmodeitem.cxx index e65ba8df5d05..2d546e1c9ebc 100644 --- a/editeng/source/items/writingmodeitem.cxx +++ b/editeng/source/items/writingmodeitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,7 +39,6 @@ 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)); @@ -65,13 +65,13 @@ SfxPoolItem* SvxWritingModeItem::Clone( SfxItemPool * ) 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, sal_uInt16 ) const { - DBG_ERROR("SvxWritingModeItem should not be streamed!"); + OSL_FAIL("SvxWritingModeItem should not be streamed!"); return rStrm; } @@ -104,10 +104,10 @@ SfxItemPresentation SvxWritingModeItem::GetPresentation( SfxItemPresentation ePr return eRet; } -sal_Bool SvxWritingModeItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) +bool SvxWritingModeItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) { sal_Int32 nVal = 0; - sal_Bool bRet = ( rVal >>= nVal ); + bool bRet = ( rVal >>= nVal ); if( !bRet ) { @@ -139,7 +139,7 @@ sal_Bool SvxWritingModeItem::PutValue( const com::sun::star::uno::Any& rVal, sal return bRet; } -sal_Bool SvxWritingModeItem::QueryValue( com::sun::star::uno::Any& rVal, +bool SvxWritingModeItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const { rVal <<= (WritingMode)GetValue(); @@ -151,3 +151,5 @@ SvxWritingModeItem& SvxWritingModeItem::operator=( const SvxWritingModeItem& rIt SetValue( rItem.GetValue() ); return *this; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/xmlcnitm.cxx b/editeng/source/items/xmlcnitm.cxx index 3b6866bdbb21..470362c95207 100644 --- a/editeng/source/items/xmlcnitm.cxx +++ b/editeng/source/items/xmlcnitm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,7 +39,6 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::xml; -// ------------------------------------------------------------------------ TYPEINIT1(SvXMLAttrContainerItem, SfxPoolItem); @@ -90,15 +90,16 @@ sal_uInt16 SvXMLAttrContainerItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ return USHRT_MAX; } -sal_Bool SvXMLAttrContainerItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +bool SvXMLAttrContainerItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { Reference<XNameContainer> xContainer = new SvUnoAttributeContainer( new SvXMLAttrContainerData( *pImpl ) ); rVal.setValue( &xContainer, ::getCppuType((Reference<XNameContainer>*)0) ); - return sal_True; + return true; } -sal_Bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) + +bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { Reference<XInterface> xRef; SvUnoAttributeContainer* pContainer = NULL; @@ -118,7 +119,7 @@ sal_Bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, } else { - SvXMLAttrContainerData* pNewImpl = new SvXMLAttrContainerData; + std::auto_ptr<SvXMLAttrContainerData> pNewImpl(new SvXMLAttrContainerData); try { @@ -167,23 +168,16 @@ sal_Bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, } if( nAttr == nCount ) - { - delete pImpl; - pImpl = pNewImpl; - } + pImpl = pNewImpl.release(); else - { - delete pNewImpl; - return sal_False; - } + return false; } catch(...) { - delete pNewImpl; - return sal_False; + return false; } } - return sal_True; + return true; } @@ -246,3 +240,4 @@ const ::rtl::OUString& SvXMLAttrContainerItem::GetPrefix( sal_uInt16 i ) const return pImpl->GetPrefix( i ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/SvXMLAutoCorrectExport.cxx b/editeng/source/misc/SvXMLAutoCorrectExport.cxx index 5557f850df1e..ceada8ae745b 100644 --- a/editeng/source/misc/SvXMLAutoCorrectExport.cxx +++ b/editeng/source/misc/SvXMLAutoCorrectExport.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,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, @@ -80,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, @@ -115,3 +114,5 @@ sal_uInt32 SvXMLExceptionListExport::exportDoc(enum XMLTokenEnum /*eClass*/) GetDocHandler()->endDocument(); return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/SvXMLAutoCorrectExport.hxx b/editeng/source/misc/SvXMLAutoCorrectExport.hxx index 28058a39c8da..937ef9543f29 100644 --- a/editeng/source/misc/SvXMLAutoCorrectExport.hxx +++ b/editeng/source/misc/SvXMLAutoCorrectExport.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,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, @@ -59,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, @@ -73,3 +72,5 @@ public: void _ExportContent() {} }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/SvXMLAutoCorrectImport.cxx b/editeng/source/misc/SvXMLAutoCorrectImport.cxx index aeb9d2be23b1..2d7d9227a60e 100644 --- a/editeng/source/misc/SvXMLAutoCorrectImport.cxx +++ b/editeng/source/misc/SvXMLAutoCorrectImport.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_editeng.hxx" #include <SvXMLAutoCorrectImport.hxx> -#ifndef _APP_HXX //autogen #include <vcl/svapp.hxx> -#endif #define _SVSTDARR_STRINGSISORTDTOR #define _SVSTDARR_STRINGSDTOR @@ -44,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, @@ -142,8 +140,6 @@ SvXMLWordContext::SvXMLWordContext( if (!sWrong.Len() || !sRight.Len() ) return; -// const International& rInter = Application::GetAppInternational(); -// sal_Bool bOnlyTxt = COMPARE_EQUAL != rInter.Compare( sRight, sWrong, INTN_COMPARE_IGNORECASE ); sal_Bool bOnlyTxt = sRight != sWrong; if( !bOnlyTxt ) { @@ -165,7 +161,6 @@ SvXMLWordContext::~SvXMLWordContext ( void ) { } -// #110680# SvXMLExceptionListImport::SvXMLExceptionListImport( const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, SvStringsISortDtor & rNewList ) @@ -264,3 +259,5 @@ SvXMLExceptionContext::SvXMLExceptionContext( SvXMLExceptionContext::~SvXMLExceptionContext ( void ) { } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/SvXMLAutoCorrectImport.hxx b/editeng/source/misc/SvXMLAutoCorrectImport.hxx index 951507ee4f19..fa7a28d0d9dc 100644 --- a/editeng/source/misc/SvXMLAutoCorrectImport.hxx +++ b/editeng/source/misc/SvXMLAutoCorrectImport.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,9 +28,7 @@ #ifndef _SV_XMLAUTOCORRECTIMPORT_HXX #define _SV_XMLAUTOCORRECTIMPORT_HXX -#ifndef _SVSTOR_HXX #include <sot/storage.hxx> -#endif #include <xmloff/xmlictxt.hxx> #include <xmloff/xmlimp.hxx> #include <xmloff/nmspmap.hxx> @@ -50,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, @@ -106,7 +103,6 @@ protected: public: SvStringsISortDtor &rList; - // #110680# SvXMLExceptionListImport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, SvStringsISortDtor & rNewList ); @@ -146,3 +142,5 @@ public: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index f804c4b39329..084c09431965 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,17 +39,12 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <rtl/instance.hxx> + using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; -#define C2U(cChar) OUString::createFromAscii(cChar) - -static SvxAutoCorrCfg* pAutoCorrCfg = 0; - -/*-------------------------------------------------------------------- - Beschreibung: Ctor Dtor - --------------------------------------------------------------------*/ +using ::rtl::OUString; SvxAutoCorrCfg::SvxAutoCorrCfg() : aBaseConfig(*this), @@ -95,9 +91,7 @@ void SvxAutoCorrCfg::SetAutoCorrect( SvxAutoCorrect* pNew ) pAutoCorrect = pNew; } } -/*-- 12.10.00 11:44:17--------------------------------------------------- - -----------------------------------------------------------------------*/ Sequence<OUString> SvxBaseAutoCorrCfg::GetPropertyNames() { static const char* aPropNames[] = @@ -118,18 +112,17 @@ Sequence<OUString> SvxBaseAutoCorrCfg::GetPropertyNames() "SingleQuoteAtEnd", // 13 "ReplaceDoubleQuote", // 14 "DoubleQuoteAtStart", // 15 - "DoubleQuoteAtEnd" // 16 + "DoubleQuoteAtEnd", // 16 + "CorrectAccidentalCapsLock" // 17 }; - const int nCount = 17; + const int nCount = 18; Sequence<OUString> aNames(nCount); OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++) pNames[i] = OUString::createFromAscii(aPropNames[i]); return aNames; } -/*-- 12.10.00 11:44:18--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvxBaseAutoCorrCfg::Load(sal_Bool bInit) { Sequence<OUString> aNames = GetPropertyNames(); @@ -140,7 +133,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++) { @@ -220,6 +213,10 @@ void SvxBaseAutoCorrCfg::Load(sal_Bool bInit) rParent.pAutoCorrect->SetEndDoubleQuote( sal::static_int_cast< sal_Unicode >( nTemp ) ); break;//"DoubleQuoteAtEnd" + case 17: + if(*(sal_Bool*)pValues[nProp].getValue()) + nFlags |= CorrectCapsLock; + break;//"CorrectAccidentalCapsLock" } } } @@ -229,23 +226,17 @@ void SvxBaseAutoCorrCfg::Load(sal_Bool bInit) } } -/*-- 12.10.00 11:44:19--------------------------------------------------- - -----------------------------------------------------------------------*/ SvxBaseAutoCorrCfg::SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rPar) : - utl::ConfigItem(C2U("Office.Common/AutoCorrect")), + utl::ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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() ); @@ -324,20 +315,20 @@ void SvxBaseAutoCorrCfg::Commit() case 16: pValues[nProp] <<= (sal_Int32) rParent.pAutoCorrect->GetEndDoubleQuote(); break;//"DoubleQuoteAtEnd" + case 17: + bVal = 0 != (nFlags & CorrectCapsLock); + pValues[nProp].setValue(&bVal, rType); + break;//"CorrectAccidentalCapsLock" } } 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[] = @@ -397,9 +388,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(); @@ -546,23 +535,17 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit) } } } -/*-- 12.10.00 11:51:48--------------------------------------------------- - -----------------------------------------------------------------------*/ SvxSwAutoCorrCfg::SvxSwAutoCorrCfg(SvxAutoCorrCfg& rPar) : - utl::ConfigItem(C2U("Office.Writer/AutoFunction")), + utl::ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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(); @@ -659,17 +642,20 @@ void SvxSwAutoCorrCfg::Commit() } PutProperties(aNames, aValues); } -/*-- 12.10.00 11:51:49--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvxSwAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */ ) { Load(sal_False); } -SvxAutoCorrCfg* SvxAutoCorrCfg::Get() +namespace { - if( !pAutoCorrCfg ) - pAutoCorrCfg = new SvxAutoCorrCfg; - return pAutoCorrCfg; + class theSvxAutoCorrCfg : public rtl::Static<SvxAutoCorrCfg, theSvxAutoCorrCfg>{}; } + +SvxAutoCorrCfg& SvxAutoCorrCfg::Get() +{ + return theSvxAutoCorrCfg::get(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/edtdlg.cxx b/editeng/source/misc/edtdlg.cxx index 3a4e209f3d4f..feecbb5919fb 100755..100644 --- a/editeng/source/misc/edtdlg.cxx +++ b/editeng/source/misc/edtdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,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 @@ -41,3 +39,5 @@ EditAbstractDialogFactory* EditAbstractDialogFactory::Create() EditAbstractDialogFactory::~EditAbstractDialogFactory() { } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/forbiddencharacterstable.cxx b/editeng/source/misc/forbiddencharacterstable.cxx index b7bd2959719d..a1376f86560c 100644 --- a/editeng/source/misc/forbiddencharacterstable.cxx +++ b/editeng/source/misc/forbiddencharacterstable.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -90,3 +91,5 @@ void SvxForbiddenCharactersTable::ClearForbiddenCharacters( sal_uInt16 nLanguage delete pInf; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx index 87f115474bf7..0cd36782a47d 100644 --- a/editeng/source/misc/hangulhanja.cxx +++ b/editeng/source/misc/hangulhanja.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,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 { @@ -106,7 +77,7 @@ namespace editeng static StringMap m_aRecentlyUsedList; // general - AbstractHangulHanjaConversionDialog* //CHINA001 HangulHanjaConversionDialog* + AbstractHangulHanjaConversionDialog* m_pConversionDialog; // the dialog to display for user interaction Window* m_pUIParent; // the parent window for any UI we raise Reference< XMultiServiceFactory > @@ -269,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, @@ -314,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 @@ -334,7 +299,6 @@ namespace editeng } - //------------------------------------------------------------------------- void HangulHanjaConversion_Impl::createDialog() { DBG_ASSERT( m_bIsInteractive, "createDialog when the conversion should not be interactive?" ); @@ -344,7 +308,7 @@ namespace editeng if(pFact) { m_pConversionDialog = pFact->CreateHangulHanjaConversionDialog(m_pUIParent, m_ePrimaryConversionDirection ); - DBG_ASSERT(m_pConversionDialog, "Dialogdiet fail!");//CHINA001 + DBG_ASSERT(m_pConversionDialog, "Dialogdiet fail!"); m_pConversionDialog->EnableRubySupport( m_pAntiImpl->HasRubySupport() ); @@ -365,7 +329,6 @@ namespace editeng } } - //------------------------------------------------------------------------- sal_Int16 HangulHanjaConversion_Impl::implGetConversionType( bool bSwitchDirection ) const { sal_Int16 nConversionType = -1; @@ -377,7 +340,6 @@ namespace editeng return nConversionType; } - //------------------------------------------------------------------------- bool HangulHanjaConversion_Impl::implUpdateSuggestions( bool _bAllowSearchNextConvertibleText, const sal_Int32 _nStartAt ) { // parameters for the converter @@ -488,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... @@ -497,7 +459,6 @@ namespace editeng return bFoundAny; } - //------------------------------------------------------------------------- bool HangulHanjaConversion_Impl::implNextConvertibleUnit( const sal_Int32 _nStartAt ) { m_aCurrentSuggestions.realloc( 0 ); @@ -527,7 +488,6 @@ namespace editeng (m_nCurrentStartIndex < m_sCurrentPortion.getLength()); } - //------------------------------------------------------------------------- bool HangulHanjaConversion_Impl::implRetrieveNextPortion( ) { sal_Bool bAllowImplicitChanges = m_eConvType == HHC::eConvSimplifiedTraditional; @@ -546,7 +506,6 @@ namespace editeng return bRet; } - //------------------------------------------------------------------------- sal_Bool HangulHanjaConversion_Impl::implNextConvertible( bool _bRepeatUnit ) { if ( _bRepeatUnit || ( m_nCurrentEndIndex < m_sCurrentPortion.getLength() ) ) @@ -577,7 +536,6 @@ namespace editeng return sal_False; } - //------------------------------------------------------------------------- ::rtl::OUString HangulHanjaConversion_Impl::GetCurrentUnit() const { DBG_ASSERT( m_nCurrentStartIndex < m_sCurrentPortion.getLength(), @@ -591,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? @@ -641,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 @@ -705,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 @@ -774,7 +720,6 @@ namespace editeng } } - //------------------------------------------------------------------------- void HangulHanjaConversion_Impl::implProceed( bool _bRepeatCurrentUnit ) { if ( ContinueConversion( _bRepeatCurrentUnit ) ) @@ -785,7 +730,6 @@ namespace editeng } } - //------------------------------------------------------------------------- void HangulHanjaConversion_Impl::implChange( const ::rtl::OUString& _rChangeInto ) { if( !_rChangeInto.getLength() ) @@ -811,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!" ); } } @@ -864,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); } } @@ -878,7 +822,6 @@ namespace editeng m_nReplacementBaseIndex = m_nCurrentEndIndex; } - //------------------------------------------------------------------------- void HangulHanjaConversion_Impl::implReadOptionsFromConfiguration() { SvtLinguConfig aLngCfg; @@ -887,7 +830,6 @@ namespace editeng aLngCfg.GetProperty( UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES ) >>= m_bAutoReplaceUnique; } - //------------------------------------------------------------------------- void HangulHanjaConversion_Impl::implUpdateData() { implReadOptionsFromConfiguration(); @@ -904,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 @@ -914,7 +855,6 @@ namespace editeng return 0L; } - //------------------------------------------------------------------------- IMPL_LINK( HangulHanjaConversion_Impl, OnIgnore, void*, EMPTYARG ) { // simply ignore, and proceed @@ -922,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?" ); @@ -943,7 +882,6 @@ namespace editeng return 0L; } - //------------------------------------------------------------------------- IMPL_LINK( HangulHanjaConversion_Impl, OnChange, void*, EMPTYARG ) { // change @@ -956,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?" ); @@ -967,7 +904,7 @@ namespace editeng if( sChangeInto.getLength() ) { - // change the current occurence + // change the current occurrence implChange( sChangeInto ); // put into the "change all" list @@ -981,7 +918,6 @@ namespace editeng return 0L; } - //------------------------------------------------------------------------- IMPL_LINK( HangulHanjaConversion_Impl, OnByCharClicked, CheckBox*, _pBox ) { m_bByCharacter = _pBox->IsChecked(); @@ -991,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!" ); @@ -1000,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?" ); @@ -1054,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, @@ -1080,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&, @@ -1148,24 +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 0d86b757f850..fa3ef76f99fa 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? berprfung am Anfang des Dokumentes fortsetzen? : berprfung am Anfang des Dokumentes fortsetzen? */ - /* ### ACHTUNG: Neuer Text in Resource? berprfung am Anfang des Dokumentes fortsetzen? : berprfung am Anfang des Dokumentes fortsetzen? */ + /* ### WARNING: New Text in Resource? überpüfung am Anfang des Dokumentes fortsetzen? : berprfung am Anfang des Dokumentes fortsetzen? */ + /* ### WARNING: New Text in Resource? berprfung am Anfang des Dokumentes fortsetzen? : berprfung 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? berprfung am Ende des Dokumentes fortsetzen? : berprfung am Ende des Dokumentes fortsetzen? */ - /* ### ACHTUNG: Neuer Text in Resource? berprfung am Ende des Dokumentes fortsetzen? : berprfung am Ende des Dokumentes fortsetzen? */ + /* ### WARNING: New Text in Resource? berprfung am Ende des Dokumentes fortsetzen? : berprfung am Ende des Dokumentes fortsetzen? */ + /* ### WARNING: New Text in Resource? berprfung am Ende des Dokumentes fortsetzen? : berprfung 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 fr die eingestellte Sprache ist nicht verfgbar. \nberprfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewnschte Sprache : Ein Thesaurus fr die eingestellte Sprache ist nicht verfgbar. \nberprfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewnschte Sprache */ - /* ### ACHTUNG: Neuer Text in Resource? Ein Thesaurus fr die eingestellte Sprache ist nicht verfgbar. \nberprfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewnschte Sprache : Ein Thesaurus fr die eingestellte Sprache ist nicht verfgbar. \nberprfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewnschte Sprache */ + /* ### WARNING: New Text in Resource? Ein Thesaurus fr die eingestellte Sprache ist nicht verfgbar. \nberprfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewnschte Sprache : Ein Thesaurus fr die eingestellte Sprache ist nicht verfgbar. \nberprfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewnschte Sprache */ + /* ### WARNING: New Text in Resource? Ein Thesaurus fr die eingestellte Sprache ist nicht verfgbar. \nberprfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewnschte Sprache : Ein Thesaurus fr die eingestellte Sprache ist nicht verfgbar. \nberprfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewnschte 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/splwrap.cxx b/editeng/source/misc/splwrap.cxx index af6b029b3001..c7dec39046d7 100644 --- a/editeng/source/misc/splwrap.cxx +++ b/editeng/source/misc/splwrap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,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> @@ -87,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 @@ -152,7 +151,7 @@ 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 @@ -179,7 +178,7 @@ SvxSpellWrapper::SvxSpellWrapper( Window* pWn, 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 ); @@ -262,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? } // ----------------------------------------------------------------------- @@ -278,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(); @@ -309,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 } // ----------------------------------------------------------------------- @@ -324,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(); } @@ -333,7 +332,7 @@ String SvxSpellWrapper::GetThesWord() void SvxSpellWrapper::ChangeThesWord( const String& ) { - // Wort wg. Thesaurus ersetzen + // replace word due to Thesaurus. } // ----------------------------------------------------------------------- @@ -361,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( ) @@ -419,7 +418,7 @@ void SvxSpellWrapper::SpellDocument( ) } // ----------------------------------------------------------------------- -// Naechsten Bereich auswaehlen +// Select the next area sal_Bool SvxSpellWrapper::SpellNext( ) @@ -427,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; @@ -473,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; @@ -492,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(); @@ -630,3 +620,4 @@ sal_Bool SvxSpellWrapper::FindSpellError() +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 1eebd5349fe4..fc582280c364 100755..100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,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 +49,7 @@ #include <unotools/collatorwrapper.hxx> #include <com/sun/star/i18n/CollatorOptions.hpp> #include <com/sun/star/i18n/UnicodeScript.hpp> +#include <com/sun/star/i18n/XOrdinalSuffix.hpp> #include <unotools/localedatawrapper.hxx> #include <unotools/transliterationwrapper.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -61,6 +63,7 @@ #include <editeng/escpitem.hxx> #include <editeng/svxacorr.hxx> #include <editeng/unolingu.hxx> +#include "vcl/window.hxx" #include <helpid.hrc> #include <comphelper/processfactory.hxx> #include <com/sun/star/xml/sax/InputSource.hpp> @@ -97,19 +100,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 @@ -145,12 +148,6 @@ bool lcl_IsUnsupportedUnicodeChar( CharClass& rCC, const String& rTxt, { 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 short nScript = rCC.getScript( rTxt, nStt ); switch( nScript ) { @@ -180,12 +177,6 @@ sal_Bool lcl_IsSymbolChar( CharClass& rCC, const String& rTxt, { 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 sal_True; @@ -209,13 +200,11 @@ static sal_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. + // 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 ) { @@ -255,7 +244,6 @@ static TransliterationWrapper& GetIgnoreTranslWrapper() { static int bIsInit = 0; static TransliterationWrapper aWrp( GetProcessFact(), - ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE | ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH ); if( !bIsInit ) @@ -282,7 +270,7 @@ void SvxAutocorrWordList::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) { if( nL ) { - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); + 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 ); @@ -324,9 +312,6 @@ sal_Bool SvxAutocorrWordList::Seek_Entry( const SvxAutocorrWordPtr aE, sal_uInt1 return sal_False; } -/* -----------------18.11.98 15:28------------------- - * - * --------------------------------------------------*/ void lcl_ClearTable(SvxAutoCorrLanguageTable_Impl& rLangTable) { SvxAutoCorrectLanguageListsPtr pLists = rLangTable.Last(); @@ -338,10 +323,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 || @@ -357,9 +338,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 @@ -372,7 +350,8 @@ long SvxAutoCorrect::GetDefaultFlags() | SetINetAttr | ChgQuotes | SaveWordCplSttLst - | SaveWordWrdSttLst; + | SaveWordWrdSttLst + | CorrectCapsLock; LanguageType eLang = GetAppLang(); switch( eLang ) { @@ -459,7 +438,7 @@ void SvxAutoCorrect::SetAutoCorrFlag( long nFlag, sal_Bool bOn ) } - // Zwei Grossbuchstaben am Wort-Anfang ?? + // 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 ) @@ -467,8 +446,8 @@ sal_Bool SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const String& rTxt, 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; @@ -476,27 +455,37 @@ sal_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.ReplaceRange( nSttPos, 1, 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 = sal_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; + } } } } @@ -510,8 +499,8 @@ sal_Bool SvxAutoCorrect::FnChgOrdinalNumber( LanguageType eLang ) { // 1st, 2nd, 3rd, 4 - 0th -// 201th oder 201st -// 12th oder 12nd +// 201th or 201st +// 12th or 12nd CharClass& rCC = GetCharClass( eLang ); sal_Bool bChg = sal_False; @@ -522,48 +511,57 @@ sal_Bool SvxAutoCorrect::FnChgOrdinalNumber( if( !lcl_IsInAsciiArr( sImplEndSkipChars, rTxt.GetChar( nEndPos - 1 ) )) break; - if( 2 < nEndPos - nSttPos && - rCC.isDigit( rTxt, nEndPos - 3 ) ) + + // Get the last number in the string to check + xub_StrLen nNumEnd = nEndPos; + bool foundEnd = false; + bool validNumber = true; + xub_StrLen i = nEndPos; + + while ( i > nSttPos ) { - static sal_Char __READONLY_DATA - sAll[] = "th", /* rest */ - sFirst[] = "st", /* 1 */ - sSecond[] = "nd", /* 2 */ - sThird[] = "rd"; /* 3 */ - static const sal_Char* __READONLY_DATA aNumberTab[ 4 ] = + i--; + bool isDigit = rCC.isDigit( rTxt, i ); + if ( foundEnd ) + validNumber |= isDigit; + + if ( isDigit && !foundEnd ) { - sAll, sFirst, sSecond, sThird - }; + foundEnd = true; + nNumEnd = i; + } + } - sal_Unicode c = rTxt.GetChar( nEndPos - 3 ); - if( ( c -= '0' ) > 3 ) - c = 0; + if ( foundEnd && validNumber ) { + sal_Int32 nNum = rTxt.Copy( nSttPos, nNumEnd - nSttPos + 1 ).ToInt32( ); - bChg = ( ((sal_Unicode)*((aNumberTab[ c ])+0)) == - rTxt.GetChar( nEndPos - 2 ) && - ((sal_Unicode)*((aNumberTab[ c ])+1)) == - rTxt.GetChar( nEndPos - 1 )) || - ( 3 < nEndPos - nSttPos && - ( ((sal_Unicode)*(sAll+0)) == rTxt.GetChar( nEndPos - 2 ) && - ((sal_Unicode)*(sAll+1)) == rTxt.GetChar( nEndPos - 1 ))); + // Check if the characters after that number correspond to the ordinal suffix + rtl::OUString sServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.OrdinalSuffix")); + uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix( + comphelper::createProcessComponent( sServiceName ), + uno::UNO_QUERY ); - if( bChg ) + if ( xOrdSuffix.is( ) ) { - // dann pruefe mal, ob alle bis zum Start alle Zahlen sind - for( xub_StrLen n = nEndPos - 3; nSttPos < n; ) - if( !rCC.isDigit( rTxt, --n ) ) + uno::Sequence< rtl::OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix( nNum, rCC.getLocale( ) ); + for ( sal_Int32 nSuff = 0; nSuff < aSuffixes.getLength(); nSuff++ ) + { + String sSuffix( aSuffixes[ nSuff ] ); + String sEnd = rTxt.Copy( nNumEnd + 1, nEndPos - nNumEnd - 1 ); + + if ( sSuffix == sEnd ) { - bChg = !rCC.isLetter( rTxt, n ); - break; + // Check if the ordinal suffix has to be set as super script + if ( rCC.isLetter( sSuffix ) ) + { + // Do the change + SvxEscapementItem aSvxEscapementItem( DFLT_ESC_AUTO_SUPER, + DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT ); + rDoc.SetAttr( nNumEnd + 1 , nEndPos, + SID_ATTR_CHAR_ESCAPEMENT, + aSvxEscapementItem); + } } - - if( bChg ) // dann setze mal das Escapement Attribut - { - SvxEscapementItem aSvxEscapementItem( DFLT_ESC_AUTO_SUPER, - DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT ); - rDoc.SetAttr( nEndPos - 2, nEndPos, - SID_ATTR_CHAR_ESCAPEMENT, - aSvxEscapementItem); } } @@ -583,7 +581,7 @@ sal_Bool SvxAutoCorrect::FnChgToEnEmDash( 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 ); @@ -685,31 +683,37 @@ sal_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( sal_Unicode( cChar ) ) != -1; - bool bIsSpecial = allChars.indexOf( sal_Unicode( cChar ) ) != -1; + bool bHasSpace = chars.indexOf( cChar ) != -1; + bool bIsSpecial = allChars.indexOf( cChar ) != -1; if ( bIsSpecial ) { // 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 ); if ( STRING_NOTFOUND == nStrPos && nEndPos > 0 ) { // Check the previous char sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 ); - if ( ( chars.indexOf( sal_Unicode( cPrevChar ) ) == -1 ) && cPrevChar != '\t' ) + if ( ( chars.indexOf( cPrevChar ) == -1 ) && cPrevChar != '\t' ) { // Remove any previous normal space xub_StrLen nPos = nEndPos - 1; @@ -720,20 +724,17 @@ sal_Bool SvxAutoCorrect::FnAddNonBrkSpace( cPrevChar = rTxt.GetChar( nPos ); } - if ( nPos != 0 ) - { - nPos++; - if ( nEndPos - nPos > 0 ) - rDoc.Delete( nPos, nEndPos ); - - // Add the non-breaking space at the end pos - if ( bHasSpace ) - rDoc.Insert( nPos, CHAR_HARDBLANK ); - bRunNext = true; - bRet = true; - } + nPos++; + if ( nEndPos - nPos > 0 ) + rDoc.Delete( nPos, nEndPos ); + + // Add the non-breaking space at the end pos + if ( bHasSpace ) + rDoc.Insert( nPos, CHAR_HARDBLANK ); + bRunNext = true; + bRet = true; } - else if ( chars.indexOf( sal_Unicode( cPrevChar ) ) != -1 ) + else if ( chars.indexOf( cPrevChar ) != -1 ) bRunNext = true; } } @@ -770,11 +771,11 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const String& 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 sal_False; @@ -798,7 +799,7 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const String& !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; } @@ -811,16 +812,16 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const String& 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, @@ -840,18 +841,18 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, xub_StrLen nSttPos, xub_StrLen nEndPos, LanguageType eLang ) { - // Grossbuchstabe am Satz-Anfang ?? + if( !rTxt.Len() || nEndPos <= nSttPos ) 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; - sal_Bool bAtStart = sal_False, bPrevPara = sal_False; + sal_Bool bAtStart = sal_False; do { --pStr; if( rCC.isLetter( @@ -868,10 +869,8 @@ sal_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 ) ) ) @@ -881,7 +880,6 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, } } while( 0 == ( bAtStart = (pStart == pStr)) ); - if( !pWordStt || rCC.isDigit( aText, sal::static_int_cast< xub_StrLen >( pStr - pStart ) ) || @@ -889,17 +887,15 @@ sal_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 sal_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 sal_False; - if( !bAtStart ) // noch kein Absatz Anfang ? + if( !bAtStart ) // Still no beginning of a paragraph? { if ( IsWordDelim( *pStr ) ) { @@ -910,17 +906,17 @@ sal_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 sal_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 && @@ -928,23 +924,22 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, } aText = *pPrevPara; - bPrevPara = sal_True; 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 sal_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 ) { @@ -959,7 +954,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, case 0xFF0E : { if( nFlag & C_FULL_STOP ) - return sal_False; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement nFlag |= C_FULL_STOP; pExceptStt = pStr; } @@ -968,7 +963,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, case 0xFF01 : { if( nFlag & C_EXCLAMATION_MARK ) - return sal_False; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement nFlag |= C_EXCLAMATION_MARK; } break; @@ -976,13 +971,13 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, case 0xFF1F : { if( nFlag & C_QUESTION_MARK) - return sal_False; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement nFlag |= C_QUESTION_MARK; } break; default: if( !nFlag ) - return sal_False; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement else bWeiter = sal_False; break; @@ -990,11 +985,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, if( bWeiter && pStr-- == pStart ) { -// !!! wenn am Anfang, dann nie ersetzen. -// if( !nFlag ) - return sal_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 ) @@ -1041,12 +1032,12 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, } if( !bValid ) - return sal_False; // kein gueltiger Trenner -> keine Ersetzung + return sal_False; // no valid separator -> no replacement } 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 && @@ -1060,7 +1051,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, --pStr; } - if( bNumericOnly ) // besteht nur aus Zahlen, dann nicht + if( bNumericOnly ) // consists of only numbers, then not return sal_False; if( IsWordDelim( *pStr )) @@ -1068,7 +1059,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, String sWord; - // ueberpruefe anhand der Exceptionliste + // check on the basis of the exception list if( pExceptStt ) { sWord = String( @@ -1076,15 +1067,15 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, if( FindInCplSttExceptList(eLang, sWord) ) 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; @@ -1099,20 +1090,63 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, 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 ); 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 ); return bRet; } -//The method below is renamed from _GetQuote to GetQuote by BerryJia for Bug95846 Time:2002-8-13 15:50 + +bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const String& rTxt, + xub_StrLen nSttPos, xub_StrLen nEndPos, + LanguageType eLang ) +{ + if (nEndPos - nSttPos < 2) + // string must be at least 2-character long. + return false; + + CharClass& rCC = GetCharClass( eLang ); + + // Check the first 2 letters. + if ( !IsLowerLetter(rCC.getCharacterType(rTxt, nSttPos)) ) + return false; + + if ( !IsUpperLetter(rCC.getCharacterType(rTxt, nSttPos+1)) ) + return false; + + String aConverted; + aConverted.Append( rCC.upper(rTxt.GetChar(nSttPos)) ); + aConverted.Append( rCC.lower(rTxt.GetChar(nSttPos+1)) ); + + for (xub_StrLen i = nSttPos+2; i < nEndPos; ++i) + { + if ( IsLowerLetter(rCC.getCharacterType(rTxt, i)) ) + // A lowercase letter disqualifies the whole text. + return false; + + if ( IsUpperLetter(rCC.getCharacterType(rTxt, i)) ) + // Another uppercase letter. Convert it. + aConverted.Append( rCC.lower(rTxt.GetChar(i)) ); + else + // This is not an alphabetic letter. Leave it as-is. + aConverted.Append(rTxt.GetChar(i)); + } + + // Replace the word. + rDoc.Delete(nSttPos, nEndPos); + rDoc.Insert(nSttPos, aConverted); + + return true; +} + + sal_Unicode SvxAutoCorrect::GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote, LanguageType eLang ) const { @@ -1124,7 +1158,7 @@ sal_Unicode SvxAutoCorrect::GetQuote( sal_Unicode cInsChar, sal_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,17 +1184,12 @@ void SvxAutoCorrect::InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, 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 ) @@ -1174,8 +1203,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,9 +1226,7 @@ String SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, 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 ) @@ -1225,7 +1250,7 @@ String SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, sal_uLong SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nInsPos, sal_Unicode cChar, - sal_Bool bInsert ) + sal_Bool bInsert, Window* pFrameWin ) { sal_uLong nRet = 0; bool bIsNextRun = bRunNext; @@ -1234,7 +1259,7 @@ sal_uLong SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, 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 ) ) @@ -1252,8 +1277,6 @@ sal_uLong SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, sal_Unicode cPrev; 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 ); @@ -1308,11 +1331,10 @@ sal_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 ) && @@ -1324,9 +1346,9 @@ sal_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 ! @@ -1348,10 +1370,6 @@ sal_uLong SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, *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 ) ) @@ -1381,7 +1399,7 @@ sal_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, sal_False, nCapLttrPos, nEnd, eLang ) ) @@ -1403,17 +1421,26 @@ sal_uLong SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, ; else { + bool bLockKeyOn = pFrameWin && (pFrameWin->GetIndicatorState() & INDICATOR_CAPSLOCK); + nRet = 0; - bool bUnsupported = lcl_IsUnsupportedUnicodeChar( rCC, rTxt, nCapLttrPos, nInsPos ); - // Grossbuchstabe am Satz-Anfang ?? - if( !bUnsupported && - IsAutoCorrFlag( CptlSttSntnc ) && + if ( bLockKeyOn && IsAutoCorrFlag( CorrectCapsLock ) && + FnCorrectCapsLock( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) ) + { + // Correct accidental use of cAPS LOCK key (do this only when + // the caps or shift lock key is pressed). Turn off the caps + // lock afterwords. + nRet |= CorrectCapsLock; + pFrameWin->SimulateKeyPress( KEY_CAPSLOCK ); + } + + // Capital letter at beginning of paragraph ? + if( IsAutoCorrFlag( CptlSttSntnc ) && FnCptlSttSntnc( rDoc, rTxt, sal_True, nCapLttrPos, nInsPos, eLang ) ) nRet |= CptlSttSntnc; - // Zwei Grossbuchstaben am Wort-Anfang ?? - if( !bUnsupported && - IsAutoCorrFlag( CptlSttWrd ) && + // Two capital letters at beginning of word ?? + if( IsAutoCorrFlag( CptlSttWrd ) && FnCptlSttWrd( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) ) nRet |= CptlSttWrd; @@ -1455,7 +1482,7 @@ sal_uLong SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, sal_uLong nHelpId = 0; if( nRet & ( Autocorrect|CptlSttSntnc|CptlSttWrd|ChgToEnEmDash ) ) { - // von 0 - 15 + // from 0 - 15 if( nRet & ChgToEnEmDash ) nHelpId += 8; if( nRet & Autocorrect ) @@ -1506,7 +1533,7 @@ void SvxAutoCorrect::SaveCplSttExceptList( LanguageType eLang ) #ifdef DBG_UTIL else { - DBG_ERROR("speichern einer leeren Liste?"); + OSL_FAIL("Save an empty list? "); } #endif } @@ -1522,19 +1549,17 @@ void SvxAutoCorrect::SaveWrdSttExceptList(LanguageType eLang) #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! + // 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 + // 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))|| @@ -1542,24 +1567,23 @@ sal_Bool SvxAutoCorrect::AddCplSttException( const String& rNew, { 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! + // 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 + //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)); - DBG_ASSERT(pLists, "keine Autokorrekturdatei"); + OSL_ENSURE(pLists, "keine Autokorrekturdatei"); return pLists->AddToWrdSttExceptList(rNew); } @@ -1572,8 +1596,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 ); } @@ -1585,8 +1608,7 @@ 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 ); } @@ -1602,7 +1624,7 @@ sal_Bool SvxAutoCorrect::GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, 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 ))) @@ -1611,18 +1633,16 @@ sal_Bool SvxAutoCorrect::GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, 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 sal_False; - // Bug 19285: Symbolzeichen nicht anfassen - // Interresant erst ab 3 Zeichen if( 3 > nEnde - nCapLttrPos ) return sal_False; @@ -1642,7 +1662,7 @@ sal_Bool SvxAutoCorrect::GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, sal_Bool SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, sal_Bool bNewFile ) { - DBG_ASSERT(!pLangTable->IsKeyValid(sal_uLong(eLang)), "Sprache ist bereits vorhanden"); + OSL_ENSURE(!pLangTable->IsKeyValid(sal_uLong(eLang)), "Language already exists "); String sUserDirFile( GetAutoCorrFileName( eLang, sal_True, sal_False )), sShareDirFile( sUserDirFile ); @@ -1695,7 +1715,7 @@ sal_Bool SvxAutoCorrect::PutText( const String& rShort, const String& rLong, } - // - loesche einen Eintrag + // - Delete an entry sal_Bool SvxAutoCorrect::DeleteText( const String& rShort, LanguageType eLang ) { sal_Bool bRet = sal_False; @@ -1705,14 +1725,14 @@ sal_Bool SvxAutoCorrect::DeleteText( const String& rShort, LanguageType eLang ) } - // - return den Ersetzungstext (nur fuer SWG-Format, alle anderen - // koennen aus der Wortliste herausgeholt werden!) + // - 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 sal_False; } - // - Text mit Attributierung (kann nur der SWG - SWG-Format!) + // 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& ) { @@ -1765,10 +1785,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& ) @@ -1799,7 +1815,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 ) @@ -1809,13 +1825,12 @@ 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 - + // 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 + //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 ) @@ -1825,9 +1840,10 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList( } } - // wenn es hier noch nicht gefunden werden konnte, dann weitersuchen - sal_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) != (sal_uLong)eLang && @@ -1837,7 +1853,7 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList( ( pLangTable->IsKeyValid( nTmpKey2 ) || 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 ) @@ -1849,7 +1865,7 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList( 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 pList = pLangTable->Seek(sal_uLong(LANGUAGE_DONTKNOW)); pRet = lcl_SearchWordsInList( pList, rTxt, rStt, nEndPos, rDoc); if( pRet ) @@ -1860,28 +1876,26 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList( } return 0; } -/* -----------------18.11.98 13:46------------------- - * - * --------------------------------------------------*/ + 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 - sal_uLong nTmpKey1 = eLang & 0x7ff; // die Hauptsprache in vielen Faellen u.B. DE - sal_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( sal_uLong( eLang )) || CreateLanguageFile( eLang, sal_False ) ) { - //die Sprache ist vorhanden - also her damit + //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 sal_True; } - // wenn es hier noch nicht gefunden werden konnte, dann weitersuchen + // If it still could not be found here, then keep on searching sal_uLong nTmp; if( ((nTmp = nTmpKey1) != (sal_uLong)eLang && ( pLangTable->IsKeyValid( nTmpKey1 ) || @@ -1890,23 +1904,21 @@ sal_Bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang, ( pLangTable->IsKeyValid( nTmpKey2 ) || 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 sal_True; } 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 pList = pLangTable->Seek(sal_uLong(LANGUAGE_DONTKNOW)); if(pList->GetWrdSttExceptList()->Seek_Entry(&sTemp)) return sal_True; } return sal_False; } -/* -----------------18.11.98 14:28------------------- - * - * --------------------------------------------------*/ + sal_Bool lcl_FindAbbreviation( const SvStringsISortDtor* pList, const String& sWord) { String sAbk( '~' ); @@ -1921,13 +1933,13 @@ sal_Bool lcl_FindAbbreviation( const SvStringsISortDtor* pList, const String& sW '~' == ( 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 + if( !--i ) // agrees return sal_True; if( sLowerAbk.GetChar( i ) != sLowerWord.GetChar( --ii )) @@ -1936,32 +1948,30 @@ sal_Bool lcl_FindAbbreviation( const SvStringsISortDtor* pList, const String& sW } } } - DBG_ASSERT( !(nPos && '~' == (*pList)[ --nPos ]->GetChar( 0 ) ), - "falsch sortierte ExeptionListe?" ); + OSL_ENSURE( !(nPos && '~' == (*pList)[ --nPos ]->GetChar( 0 ) ), + "Wrongly sorted exception list?" ); return sal_False; } -/* -----------------18.11.98 14:49------------------- - * - * --------------------------------------------------*/ + sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang, const String& sWord, sal_Bool bAbbreviation) { - //zuerst nach eLang suchen, dann nach der Obersprace US-Englisch -> Englisch - //und zuletzt in LANGUAGE_DONTKNOW - sal_uLong nTmpKey1 = eLang & 0x7ff; // die Hauptsprache in vielen Faellen u.B. DE - sal_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( sal_uLong( eLang )) || CreateLanguageFile( eLang, sal_False )) { - //die Sprache ist vorhanden - also her damit + //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 sal_True; } - // wenn es hier noch nicht gefunden werden konnte, dann weitersuchen + // If it still could not be found here, then keep on searching sal_uLong nTmp; if( ((nTmp = nTmpKey1) != (sal_uLong)eLang && @@ -1971,7 +1981,7 @@ sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang, ( pLangTable->IsKeyValid( nTmpKey2 ) || 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) @@ -1980,7 +1990,7 @@ sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang, } 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) @@ -1991,9 +2001,6 @@ sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang, } -/* -----------------20.11.98 11:53------------------- - * - * --------------------------------------------------*/ String SvxAutoCorrect::GetAutoCorrFileName( LanguageType eLang, sal_Bool bNewFile, sal_Bool bTst ) const { @@ -2014,9 +2021,6 @@ String SvxAutoCorrect::GetAutoCorrFileName( LanguageType eLang, return sRet; } -/* -----------------18.11.98 11:16------------------- - * - * --------------------------------------------------*/ SvxAutoCorrectLanguageLists::SvxAutoCorrectLanguageLists( SvxAutoCorrect& rParent, const String& rShareAutoCorrectFile, @@ -2033,9 +2037,6 @@ SvxAutoCorrectLanguageLists::SvxAutoCorrectLanguageLists( { } -/* -----------------18.11.98 11:16------------------- - * - * --------------------------------------------------*/ SvxAutoCorrectLanguageLists::~SvxAutoCorrectLanguageLists() { delete pCplStt_ExcptLst; @@ -2043,19 +2044,15 @@ SvxAutoCorrectLanguageLists::~SvxAutoCorrectLanguageLists() delete pAutocorr_List; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ sal_Bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp() { - // nur alle 2 Minuten aufs FileSystem zugreifen um den - // Dateistempel zu ueberpruefen + // 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, @@ -2063,7 +2060,7 @@ sal_Bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp() ( aModifiedDate != aTstDate || aModifiedTime != aTstTime )) { bRet = sal_True; - // dann mal schnell alle Listen entfernen! + // then remove all the lists fast! if( CplSttLstLoad & nFlags && pCplStt_ExcptLst ) delete pCplStt_ExcptLst, pCplStt_ExcptLst = 0; if( WrdSttLstLoad & nFlags && pWrdStt_ExcptLst ) @@ -2105,7 +2102,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() ) { @@ -2121,8 +2118,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() ) { @@ -2130,8 +2127,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 @@ -2158,16 +2153,14 @@ 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, @@ -2199,7 +2192,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() ) { @@ -2208,15 +2201,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 ); @@ -2239,9 +2230,7 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( } } } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ + SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() { if( pAutocorr_List ) @@ -2262,8 +2251,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 ); @@ -2280,7 +2269,7 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() { } - // Zeitstempel noch setzen + // Set time stamp FStatHelper::GetModifiedDateTimeOfFile( sShareAutoCorrFile, &aModifiedDate, &aModifiedTime ); aLastCheckTime = Time(); @@ -2288,10 +2277,6 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() return pAutocorr_List; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ - void SvxAutoCorrectLanguageLists::SetAutocorrWordList( SvxAutocorrWordList* pList ) { if( pAutocorr_List && pList != pAutocorr_List ) @@ -2299,33 +2284,26 @@ 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------------------- - * - * --------------------------------------------------*/ + sal_Bool SvxAutoCorrectLanguageLists::AddToCplSttExceptList(const String& rNew) { String* pNew = new String( rNew ); @@ -2337,7 +2315,7 @@ sal_Bool SvxAutoCorrectLanguageLists::AddToCplSttExceptList(const String& rNew) SaveExceptList_Imp( *pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg ); xStg = 0; - // Zeitstempel noch setzen + // Set time stamp FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile, &aModifiedDate, &aModifiedTime ); aLastCheckTime = Time(); @@ -2346,9 +2324,7 @@ sal_Bool SvxAutoCorrectLanguageLists::AddToCplSttExceptList(const String& rNew) delete pNew, pNew = 0; return 0 != pNew; } -/* -----------------18.11.98 15:20------------------- - * - * --------------------------------------------------*/ + sal_Bool SvxAutoCorrectLanguageLists::AddToWrdSttExceptList(const String& rNew) { String* pNew = new String( rNew ); @@ -2361,7 +2337,7 @@ sal_Bool SvxAutoCorrectLanguageLists::AddToWrdSttExceptList(const String& rNew) SaveExceptList_Imp( *pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg ); xStg = 0; - // Zeitstempel noch setzen + // Set time stamp FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile, &aModifiedDate, &aModifiedTime ); aLastCheckTime = Time(); @@ -2371,9 +2347,6 @@ sal_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, sal_True ); @@ -2384,9 +2357,6 @@ SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadCplSttExceptList() return pCplStt_ExcptLst; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ void SvxAutoCorrectLanguageLists::SaveCplSttExceptList() { MakeUserStorage_Impl(); @@ -2396,15 +2366,12 @@ void SvxAutoCorrectLanguageLists::SaveCplSttExceptList() 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 ) @@ -2413,14 +2380,12 @@ 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, sal_True ); @@ -2429,9 +2394,7 @@ SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadWrdSttExceptList() LoadXMLExceptList_Imp( pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg ); return pWrdStt_ExcptLst; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ + void SvxAutoCorrectLanguageLists::SaveWrdSttExceptList() { MakeUserStorage_Impl(); @@ -2440,14 +2403,12 @@ void SvxAutoCorrectLanguageLists::SaveWrdSttExceptList() 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 ) @@ -2455,23 +2416,19 @@ 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 ) @@ -2498,13 +2455,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 ) ) { @@ -2578,8 +2531,6 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() GetAutocorrWordList(); MakeBlocklist_Imp( *xDstStg ); - // xDstStg is committed in MakeBlocklist_Imp - /*xSrcStg->CopyTo( &xDstStg );*/ sShareAutoCorrFile = sUserAutoCorrFile; xDstStg = 0; try @@ -2596,22 +2547,12 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() sShareAutoCorrFile = sUserAutoCorrFile; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ sal_Bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) { String sStrmName( pXMLImplAutocorr_ListStr, RTL_TEXTENCODING_MS_1252 ); 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() ) @@ -2626,7 +2567,7 @@ sal_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() ) { @@ -2635,15 +2576,13 @@ sal_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 ); @@ -2660,40 +2599,6 @@ sal_Bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) bRet = sal_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 ) - << (sal_uInt8) 4 // Laenge des Headers (ohne den Leerstring) - << (sal_uInt16)WORDLIST_VERSION_358 // Version des Streams - << (sal_uInt8)eEncoding; // der Zeichensatz - - for( sal_uInt16 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 = sal_True; - bRet = sal_False; - } - } - */ } else bRet = sal_False; @@ -2708,13 +2613,10 @@ sal_Bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) return bRet; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort, const String& rLong ) { - // erstmal akt. Liste besorgen! + // First get the current list! GetAutocorrWordList(); MakeUserStorage_Impl(); @@ -2722,12 +2624,7 @@ sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort, sal_Bool bRet = xStg.Is() && SVSTREAM_OK == xStg->GetError(); -/* if( bRet ) - { - // PutText( *xStg, rShort ); - } -*/ - // die Wortliste aktualisieren + // Update the word list if( bRet ) { sal_uInt16 nPos; @@ -2736,7 +2633,7 @@ sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort, { 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 ); @@ -2762,14 +2659,11 @@ sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort, } return bRet; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ - // - Text mit Attributierung (kann nur der SWG - SWG-Format!) + sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort, SfxObjectShell& rShell ) { - // erstmal akt. Liste besorgen! + // First get the current list! GetAutocorrWordList(); MakeUserStorage_Impl(); @@ -2779,13 +2673,10 @@ sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort, 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, sal_False ); @@ -2805,13 +2696,10 @@ sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort, return bRet; } -/* -----------------18.11.98 11:26------------------- - * - * --------------------------------------------------*/ - // - loesche einen Eintrag +// Delete an entry sal_Bool SvxAutoCorrectLanguageLists::DeleteText( const String& rShort ) { - // erstmal akt. Liste besorgen! + // First get the current list! GetAutocorrWordList(); MakeUserStorage_Impl(); @@ -2839,7 +2727,7 @@ sal_Bool SvxAutoCorrectLanguageLists::DeleteText( const String& rShort ) } } - // die Wortliste aktualisieren + // Update the word list pAutocorr_List->DeleteAndDestroy( nPos ); MakeBlocklist_Imp( *xStg ); xStg = 0; @@ -2849,3 +2737,5 @@ sal_Bool SvxAutoCorrectLanguageLists::DeleteText( const String& rShort ) } return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/swafopt.cxx b/editeng/source/misc/swafopt.cxx index 79222cad5fdc..f92d06535b19 100644 --- a/editeng/source/misc/swafopt.cxx +++ b/editeng/source/misc/swafopt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,10 +33,6 @@ #include <editeng/swafopt.hxx> -/*------------------------------------------------------------------------ - Beschreibung: -------------------------------------------------------------------------*/ - SvxSwAutoFmtFlags::SvxSwAutoFmtFlags() : aBulletFont( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarSymbol" )), @@ -156,3 +153,4 @@ SvxSwAutoFmtFlags& SvxSwAutoFmtFlags::operator=( const SvxSwAutoFmtFlags& rAFFla return *this; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index 5f55fcd02acf..fae50995f2f4 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,22 +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 -|* -*************************************************************************/ - -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 ) : +#include <vector> + +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 ), @@ -63,10 +56,6 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const baseg #ifdef DBG_UTIL 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 ); @@ -93,58 +82,33 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const baseg mpLinePolyPolygon = NULL; } -/************************************************************************* -|* -|* TextRanger::~TextRanger() -|* -|* Beschreibung -|* Ersterstellung 20.01.97 -|* Letzte Aenderung 20.01.97 AMA -|* -*************************************************************************/ TextRanger::~TextRanger() { - for( sal_uInt16 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. - * --------------------------------------------------*/ - +/* 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( sal_uInt16 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; @@ -177,7 +141,7 @@ 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; } @@ -194,7 +158,7 @@ public: sal_uInt8 GetAct() const { return nAct; } }; -SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, SvLongs *pLong, +SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, LongDqPtr pLong, const Range& rRange ) : pLongArr( pLong ), pTextRanger( pRanger ), nTop( rRange.Min() ), nBottom( rRange.Max() ), @@ -217,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, @@ -290,23 +254,22 @@ void SvxBoundArgs::NoteRange( sal_Bool bToggle ) if( !bClosed ) bToggle = sal_False; sal_uInt16 nIdx = 0; - sal_uInt16 nCount = pLongArr->Count(); + sal_uInt16 nCount = pLongArr->size(); DBG_ASSERT( nCount == 2 * aBoolArr.size(), "NoteRange: Incompatible Sizes" ); while( nIdx < nCount && (*pLongArr)[ nIdx ] < nMin ) ++nIdx; sal_Bool bOdd = nIdx % 2 ? sal_True : sal_False; - // Kein Ueberlappung mit vorhandenen Intervallen? + // 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( aBoolArr.begin() + nIdx / 2, bToggle ); + { // 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 ... + { // expand an existing interval ... sal_uInt16 nMaxIdx = nIdx; - // Wenn wir auf einer linken Intervallgrenze gelandet sind, muss diese - // auf nMin gesenkt werden. + // If we end up on a left interval boundary, it must be reduced to nMin. if( bOdd ) --nIdx; else @@ -318,16 +281,15 @@ void SvxBoundArgs::NoteRange( sal_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 + // Possible merge of intervals. sal_uInt16 nDiff = nMaxIdx - nIdx; - nMaxIdx = nIdx / 2; // Ab hier ist nMaxIdx der Index im BoolArray. + 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; sal_uInt16 nStop = nMaxIdx + nDiff; for( sal_uInt16 i = nMaxIdx; i < nStop; ++i ) @@ -335,7 +297,7 @@ void SvxBoundArgs::NoteRange( sal_Bool bToggle ) aBoolArr.erase( aBoolArr.begin() + nMaxIdx, aBoolArr.begin() + (nMaxIdx + nDiff) ); } DBG_ASSERT( nMaxIdx < aBoolArr.size(), "NoteRange: Too much deleted" ); - aBoolArr[ nMaxIdx ] ^= bToggle; + aBoolArr[ nMaxIdx ] = aBoolArr[ nMaxIdx ] ^ bToggle; } } @@ -360,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 ) @@ -384,8 +346,8 @@ 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 ) { @@ -449,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 ) @@ -460,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); } } } @@ -493,7 +455,7 @@ void SvxBoundArgs::Add() 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; @@ -508,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.size()*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 ); - - // 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 ); + pLongArr->pop_front(); + pLongArr->pop_back(); + + // 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 ); } } @@ -536,22 +496,22 @@ void SvxBoundArgs::Concat( const PolyPolygon* pPoly ) { SetConcat( sal_True ); DBG_ASSERT( pPoly, "Nothing to do?" ); - SvLongs *pOld = pLongArr; - pLongArr = new SvLongs( 2, 8 ); + LongDqPtr pOld = pLongArr; + pLongArr = new std::deque<long>(); aBoolArr.clear(); bInner = sal_False; - Calc( *pPoly ); - sal_uInt16 nCount = pLongArr->Count(); + 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 ) { - sal_uInt16 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++ ]; @@ -560,48 +520,48 @@ void SvxBoundArgs::Concat( const PolyPolygon* pPoly ) 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; } 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; @@ -610,12 +570,12 @@ 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 *************************************************************************/ sal_uInt16 SvxBoundArgs::Area( const Point& rPt ) @@ -637,10 +597,10 @@ sal_uInt16 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 ) @@ -679,26 +639,26 @@ void SvxBoundArgs::NoteUpLow( long nA, const sal_uInt8 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" ); - sal_uInt16 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() @@ -709,3 +669,4 @@ const Rectangle& TextRanger::_GetBoundRect() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index f619f2fbf86b..605623dc1a8b 100755..100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,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> @@ -79,9 +79,6 @@ using namespace ::com::sun::star::linguistic2; #define CSS com::sun::star -/////////////////////////////////////////////////////////////////////////// - - static uno::Reference< XLinguServiceManager > GetLngSvcMgr_Impl() { uno::Reference< XLinguServiceManager > xRes; @@ -95,8 +92,6 @@ static uno::Reference< XLinguServiceManager > GetLngSvcMgr_Impl() return xRes; } -/////////////////////////////////////////////////////////////////////////// - sal_Bool lcl_FindEntry( const OUString &rEntry, const Sequence< OUString > &rCfgSvcs ) { sal_Int32 nRes = -1; @@ -153,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" ); } } } @@ -222,9 +213,6 @@ Sequence< OUString > lcl_MergeSeq( return aRes; } -/////////////////////////////////////////////////////////////////////////// - -// static member initialization sal_Int16 SvxLinguConfigUpdate::nNeedUpdating = -1; sal_Int32 SvxLinguConfigUpdate::nCurrentDataFilesChangedCheckValue = -1; @@ -243,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; @@ -263,9 +251,9 @@ 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] ) ); + OUString aService( ::rtl::OUString::createFromAscii( apServices[k] ) ); + OUString aActiveList( ::rtl::OUString::createFromAscii( apCurLists[k] ) ); + OUString aLastFoundList( ::rtl::OUString::createFromAscii( apLastFoundLists[k] ) ); sal_Int32 i; // @@ -363,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() ); @@ -390,7 +378,7 @@ 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" ); { @@ -400,13 +388,13 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck ) 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) @@ -460,14 +448,12 @@ sal_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. @@ -604,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. @@ -716,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. @@ -857,11 +837,9 @@ uno::Reference< linguistic2::XPossibleHyphens > SAL_CALL } -/////////////////////////////////////////////////////////////////////////// - - typedef cppu::WeakImplHelper1 < XEventListener > LinguMgrAppExitLstnrBaseClass; + class LinguMgrAppExitLstnr : public LinguMgrAppExitLstnrBaseClass { uno::Reference< XComponent > xDesktop; @@ -900,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) @@ -915,8 +893,6 @@ void LinguMgrAppExitLstnr::disposing(const EventObject& rSource) } } -/////////////////////////////////////////////////////////////////////////// - class LinguMgrExitLstnr : public LinguMgrAppExitLstnr { public: @@ -937,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; @@ -1027,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; } @@ -1050,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; } @@ -1076,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; } @@ -1205,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(); @@ -1243,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 */ ) { @@ -1260,9 +1199,6 @@ uno::Reference< XDictionary > SvxGetChangeAllList() return LinguMgr::GetChangeAllList(); } -/////////////////////////////////////////////////////////////////////////// - - #include <com/sun/star/linguistic2/XHyphenatedWord.hpp> SvxAlternativeSpelling SvxGetAltSpelling( @@ -1306,8 +1242,6 @@ SvxAlternativeSpelling SvxGetAltSpelling( } -/////////////////////////////////////////////////////////////////////////// - SvxDicListChgClamp::SvxDicListChgClamp( uno::Reference< XDictionaryList > &rxDicList ) : xDicList ( rxDicList ) { @@ -1325,8 +1259,6 @@ SvxDicListChgClamp::~SvxDicListChgClamp() } } -/////////////////////////////////////////////////////////////////////////// - short SvxDicError( Window *pParent, sal_Int16 nError ) { short nRes = 0; @@ -1339,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(); } @@ -1348,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; @@ -1357,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(); @@ -1368,10 +1299,11 @@ 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; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outl_pch.cxx b/editeng/source/outliner/outl_pch.cxx index 802af3aa3df4..22522eb0369d 100644 --- a/editeng/source/outliner/outl_pch.cxx +++ b/editeng/source/outliner/outl_pch.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,3 +30,4 @@ #include "precompiled_editeng.hxx" #include <outl_pch.hxx> +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outl_pch.hxx b/editeng/source/outliner/outl_pch.hxx index 9da7cc120110..06f1f29760a7 100644 --- a/editeng/source/outliner/outl_pch.hxx +++ b/editeng/source/outliner/outl_pch.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,3 +32,5 @@ #include <editeng/eerdll.hxx> #include <editeng/lrspitem.hxx> #include <editeng/fhgtitem.hxx> + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx index bebffbe5f586..1e49a67a027e 100644 --- a/editeng/source/outliner/outleeng.cxx +++ b/editeng/source/outliner/outleeng.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -157,7 +158,6 @@ XubString OutlinerEditEng::GetUndoComment( sal_uInt16 nUndoId ) const } } -// #101498# 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, @@ -169,44 +169,22 @@ void OutlinerEditEng::DrawingText( const Point& rStartPos, const XubString& rTex const Color& rOverlineColor, const Color& rTextLineColor) { - // why do bullet here at all? Just use GetEditEnginePtr()->PaintingFirstLine - // inside of ImpEditEngine::Paint which calls pOwner->PaintBullet with the correct - // values for hor and ver. No change for not-layouting (painting). - // changed, bullet rendering now using PaintBullet via -/* if ( nIndex == 0 ) - { - // Dann das Bullet 'malen', dort wird bStrippingPortions ausgewertet - // und Outliner::DrawingText gerufen - - // DrawingText liefert die BaseLine, DrawBullet braucht Top(). - - if(true) - { - // ## - // another error: This call happens when only stripping, but the position - // is already aligned to text output. For bullet rendering, it needs to be reset - // to the correct value in x and y. PaintBullet takes care of X-start offset itself - const Point aDocPosTopLeft(GetDocPosTopLeft( nPara )); - const Point aCorrectedPos(rStartPos.X() - aDocPosTopLeft.X(), aDocPosTopLeft.Y() + GetFirstLineOffset( nPara )); - pOwner->PaintBullet( nPara, aCorrectedPos, Point(), 0, GetRefDevice() ); - } - else - { - Point aCorrectedPos( rStartPos ); - aCorrectedPos.Y() = GetDocPosTopLeft( nPara ).Y(); - aCorrectedPos.Y() += GetFirstLineOffset( nPara ); - pOwner->PaintBullet( nPara, aCorrectedPos, Point(), 0, GetRefDevice() ); - } - } */ - - // #101498# pOwner->DrawingText(rStartPos,rText,nTextStart,nTextLen,pDXArray,rFont,nPara,nIndex,nRightToLeft, pWrongSpellVector, pFieldData, bEndOfLine, bEndOfParagraph, bEndOfBullet, pLocale, rOverlineColor, rTextLineColor); } +void OutlinerEditEng::DrawingTab( const Point& rStartPos, long nWidth, const String& rChar, + const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, + bool bEndOfLine, bool bEndOfParagraph, + const Color& rOverlineColor, const Color& rTextLineColor) +{ + pOwner->DrawingTab(rStartPos, nWidth, rChar, rFont, nPara, nIndex, nRightToLeft, + bEndOfLine, bEndOfParagraph, rOverlineColor, rTextLineColor ); +} + 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 ); } @@ -231,14 +209,14 @@ void OutlinerEditEng::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) EditEngine::SetParaAttribs( (sal_uInt16)nPara, rSet ); pOwner->ImplCheckNumBulletItem( (sal_uInt16)nPara ); - // --> OD 2009-03-10 #i100014# + // #i100014# // It is not a good idea to substract 1 from a count and cast the result - // to sal_uInt16 without check, if the count is 0. + // to USHORT without check, if the count is 0. pOwner->ImplCheckParagraphs( (sal_uInt16)nPara, (sal_uInt16) (pOwner->pParaList->GetParagraphCount()) ); - // <-- if ( !IsInUndo() && IsUndoEnabled() ) pOwner->UndoActionEnd( OLUNDO_ATTR ); } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outleeng.hxx b/editeng/source/outliner/outleeng.hxx index b66600041247..59124b83042d 100644 --- a/editeng/source/outliner/outleeng.hxx +++ b/editeng/source/outliner/outleeng.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #define _OUTLEENG_HXX #include <editeng/outliner.hxx> -#ifndef _EDITENG_HXX #include <editeng/editeng.hxx> -#endif typedef EENotify* EENotifyPtr; SV_DECL_PTRARR_DEL( NotifyList, EENotifyPtr, 1, 1 ) @@ -55,7 +54,6 @@ public: 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, sal_uInt16 nTextStart, sal_uInt16 nTextLen, const sal_Int32* pDXArray, const SvxFont& rFont, sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt8 nRightToLeft, @@ -68,6 +66,14 @@ public: const Color& rOverlineColor, const Color& rTextLineColor); + virtual void DrawingTab( + const Point& rStartPos, long nWidth, const String& rChar, + 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( sal_uInt16 nPara ); virtual sal_Bool SpellNextDocument(); @@ -91,3 +97,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index 26994e7b832e..a3ba981e7e57 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,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> @@ -56,8 +56,8 @@ DBG_NAMEEX(Outliner) using namespace ::com::sun::star::uno; using namespace ::com::sun::star::linguistic2; -// ===================================================================== -// ====================== Einfache Durchreicher ======================= +// ====================================================================== +// ====================== Simple pass-through ======================= // ====================================================================== void Outliner::SetUpdateMode( sal_Bool bUpdate ) @@ -327,6 +327,12 @@ 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); @@ -419,10 +425,8 @@ void Outliner::UndoActionEnd( sal_uInt16 nId ) void Outliner::InsertUndo( EditUndo* pUndo ) { -#ifndef SVX_LIGHT DBG_CHKTHIS(Outliner,0); pEditEngine->GetUndoManager().AddUndoAction( pUndo, sal_False ); -#endif } sal_Bool Outliner::IsInUndo() @@ -533,13 +537,13 @@ Reference< XSpellChecker1 > Outliner::GetSpeller() return pEditEngine->GetSpeller(); } -void Outliner::SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars ) +void Outliner::SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ) { DBG_CHKTHIS(Outliner,0); pEditEngine->SetForbiddenCharsTable( xForbiddenChars ); } -vos::ORef<SvxForbiddenCharactersTable> Outliner::GetForbiddenCharsTable() const +rtl::Reference<SvxForbiddenCharactersTable> Outliner::GetForbiddenCharsTable() const { DBG_CHKTHIS(Outliner,0); return pEditEngine->GetForbiddenCharsTable(); @@ -659,6 +663,16 @@ void Outliner::QuickFormatDoc( sal_Bool bFull ) void Outliner::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY ) { DBG_CHKTHIS(Outliner,0); + + // reset bullet size + sal_uInt16 nParagraphs = (sal_uInt16)pParaList->GetParagraphCount(); + for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ ) + { + Paragraph* pPara = pParaList->GetParagraph( nPara ); + if ( pPara ) + pPara->aBulSize.Width() = -1; + } + pEditEngine->SetGlobalCharStretching( nX, nY ); } @@ -776,38 +790,30 @@ 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 ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 9d749b20e6f1..86b93a2eef19 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,12 +63,14 @@ #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 sal_uInt16 nDefStyles = 3; // Sonderbehandlung fuer die ersten 3 Ebenen +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 }; @@ -221,7 +224,7 @@ void Outliner::ParagraphDeleted( sal_uInt16 nPara ) if ( pPara && ( pPara->GetDepth() > nDepth ) ) { ImplCalcBulletText( nPara, sal_True, sal_False ); - // naechsten auf gleicher Ebene suchen... + // Search for next on the this level ... while ( pPara && pPara->GetDepth() > nDepth ) pPara = pParaList->GetParagraph( ++nPara ); } @@ -255,7 +258,7 @@ void Outliner::Init( sal_uInt16 nMode ) nCtrl |= EE_CNTRL_OUTLINER; break; - default: DBG_ERROR( "Outliner::Init - Invalid Mode!" ); + default: OSL_FAIL( "Outliner::Init - Invalid Mode!" ); } pEditEngine->SetControlWord( nCtrl ); @@ -335,11 +338,10 @@ void Outliner::SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingSta pPara->IsParaIsNumberingRestart(), pPara->IsParaIsNumberingRestart() ) ); pPara->SetNumberingStartValue( nNumberingStartValue ); - // --> OD 2009-03-10 #i100014# + // #i100014# // It is not a good idea to substract 1 from a count and cast the result - // to sal_uInt16 without check, if the count is 0. + // to USHORT without check, if the count is 0. ImplCheckParagraphs( nPara, (sal_uInt16) (pParaList->GetParagraphCount()) ); - // <-- pEditEngine->SetModified(); } } @@ -363,11 +365,10 @@ void Outliner::SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumb pPara->IsParaIsNumberingRestart(), bParaIsNumberingRestart ) ); pPara->SetParaIsNumberingRestart( bParaIsNumberingRestart ); - // --> OD 2009-03-10 #i100014# + // #i100014# // It is not a good idea to substract 1 from a count and cast the result - // to sal_uInt16 without check, if the count is 0. + // to USHORT without check, if the count is 0. ImplCheckParagraphs( nPara, (sal_uInt16) (pParaList->GetParagraphCount()) ); - // <-- pEditEngine->SetModified(); } } @@ -428,7 +429,7 @@ 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 sal_uInt16 nCount = aText.GetTokenCount( '\x0A' ); sal_uInt16 nPos = 0; @@ -446,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 + // 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; @@ -468,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 ); @@ -492,7 +492,7 @@ void Outliner::SetText( const XubString& rText, Paragraph* pPara ) pEditEngine->SetUpdateMode( bUpdate ); } -// pView == 0 -> Tabulatoren nicht beachten +// pView == 0 -> Ignore tabs bool Outliner::ImpConvertEdtToOut( sal_uInt32 nPara,EditView* pView) { @@ -527,11 +527,11 @@ 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 + // Extract Bullet and Tab aDelSel = ESelection( (sal_uInt16)nPara, 0, (sal_uInt16)nPara, 2 ); } @@ -540,18 +540,18 @@ bool Outliner::ImpConvertEdtToOut( sal_uInt32 nPara,EditView* pView) aLevel.EraseLeadingChars( ' ' ); nTabs = sal::static_int_cast< sal_uInt16 >(aLevel.ToInt32()); if( nTabs ) - nTabs--; // ebene 0 = "heading 1" + 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( (sal_uInt16)nPara, 0, (sal_uInt16)nPara, nTabs ); } @@ -603,15 +603,14 @@ void Outliner::SetText( const OutlinerParaObject& rPObj ) Paragraph* pPara = new Paragraph( rPObj.GetParagraphData(nCurPara)); ImplCheckDepth( pPara->nDepth ); - pParaList->Insert( pPara, LIST_APPEND ); + pParaList->Append(pPara); ImplCheckNumBulletItem( nCurPara ); } - // --> OD 2009-03-10 #i100014# + // #i100014# // It is not a good idea to substract 1 from a count and cast the result - // to sal_uInt16 without check, if the count is 0. + // to USHORT without check, if the count is 0. ImplCheckParagraphs( 0, (sal_uInt16) (pParaList->GetParagraphCount()) ); - // <-- EnableUndo( bUndo ); ImplBlockInsertionCallbacks( sal_False ); @@ -647,24 +646,23 @@ void Outliner::AddText( const OutlinerParaObject& rPObj ) for( sal_uInt16 n = 0; n < rPObj.Count(); n++ ) { pPara = new Paragraph( rPObj.GetParagraphData(n) ); - pParaList->Insert( pPara, LIST_APPEND ); + 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(), sal_False ); } DBG_ASSERT( pEditEngine->GetParagraphCount()==pParaList->GetParagraphCount(), "SetText: OutOfSync" ); - // --> OD 2009-03-10 #i100014# + // #i100014# // It is not a good idea to substract 1 from a count and cast the result - // to sal_uInt16 without check, if the count is 0. + // to USHORT without check, if the count is 0. ImplCheckParagraphs( (sal_uInt16)nPara, (sal_uInt16) (pParaList->GetParagraphCount()) ); - // <-- ImplBlockInsertionCallbacks( sal_False ); pEditEngine->SetUpdateMode( bUpdate ); } -void __EXPORT Outliner::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos ) +void Outliner::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos ) { DBG_CHKTHIS(Outliner,0); @@ -677,7 +675,7 @@ void __EXPORT Outliner::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPa } -void __EXPORT Outliner::FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos ) +void Outliner::FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos ) { DBG_CHKTHIS(Outliner,0); if ( !aFieldClickedHdl.IsSet() ) @@ -689,14 +687,14 @@ void __EXPORT Outliner::FieldSelected( const SvxFieldItem& rField, sal_uInt16 nP } -XubString __EXPORT Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 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 ); @@ -792,9 +790,8 @@ void Outliner::ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCrea 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() ) { sal_Bool bUpdate = pEditEngine->GetUpdateMode(); @@ -862,7 +859,7 @@ sal_Bool Outliner::Expand( 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; sal_Bool bUndo = sal_False; @@ -898,7 +895,7 @@ 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 ); @@ -924,8 +921,11 @@ Font Outliner::ImpCalcBulletFont( sal_uInt16 nPara ) const aBulletFont.SetRelief( RELIEF_NONE ); } - // #107508# Use original scale... - sal_uInt16 nScale = /* pEditEngine->IsFlatMode() ? DEFAULT_SCALE : */ pFmt->GetBulletRelSize(); + // Use original scale... + sal_uInt16 nStretchX, nStretchY; + const_cast<Outliner*>(this)->GetGlobalCharStretching(nStretchX, nStretchY); + + sal_uInt16 nScale = pFmt->GetBulletRelSize() * nStretchY / 100; sal_uLong nScaledLineHeight = aStdFont.GetSize().Height(); nScaledLineHeight *= nScale*10; nScaledLineHeight /= 1000; @@ -968,6 +968,12 @@ void Outliner::PaintBullet( sal_uInt16 nPara, const Point& rStartPos, sal_Bool bRightToLeftPara = pEditEngine->IsRightToLeft( nPara ); Rectangle aBulletArea( ImpCalcBulletArea( nPara, sal_True, sal_False ) ); + sal_uInt16 nStretchX, nStretchY; + GetGlobalCharStretching(nStretchX, nStretchY); + aBulletArea = Rectangle( Point(aBulletArea.Left()*nStretchX/100, + aBulletArea.Top()), + Size(aBulletArea.GetWidth()*nStretchX/100, + aBulletArea.GetHeight()) ); Paragraph* pPara = pParaList->GetParagraph( nPara ); const SvxNumberFormat* pFmt = GetNumberFormat( nPara ); @@ -976,7 +982,7 @@ void Outliner::PaintBullet( sal_uInt16 nPara, const Point& rStartPos, if( pFmt->GetNumberingType() != SVX_NUM_BITMAP ) { Font aBulletFont( ImpCalcBulletFont( nPara ) ); - // #2338# Use base line + // Use baseline sal_Bool bSymbol = pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL; aBulletFont.SetAlign( bSymbol ? ALIGN_BOTTOM : ALIGN_BASELINE ); Font aOldFont = pOutDev->GetFont(); @@ -1002,8 +1008,8 @@ void Outliner::PaintBullet( sal_uInt16 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 ); @@ -1021,7 +1027,7 @@ void Outliner::PaintBullet( sal_uInt16 nPara, const Point& rStartPos, pOutDev->SetFont( aRotatedFont ); } - // #105803# VCL will care for brackets and so on... + // 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 ) @@ -1090,14 +1096,14 @@ void Outliner::PaintBullet( sal_uInt16 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 ) { @@ -1135,9 +1141,9 @@ void Outliner::InvalidateBullet( Paragraph* /*pPara*/, sal_uLong nPara ) DBG_CHKTHIS(Outliner,0); long nLineHeight = (long)pEditEngine->GetLineHeight((sal_uInt16)nPara ); - OutlinerView* pView = aViewList.First(); - while( pView ) + for ( size_t i = 0, n = aViewList.size(); i < n; ++i ) { + OutlinerView* pView = aViewList[ i ]; Point aPos( pView->pEditView->GetWindowPosTopLeft((sal_uInt16)nPara ) ); Rectangle aRect( pView->GetOutputArea() ); aRect.Right() = aPos.X(); @@ -1146,7 +1152,6 @@ void Outliner::InvalidateBullet( Paragraph* /*pPara*/, sal_uLong nPara ) aRect.Bottom() += nLineHeight; pView->GetWindow()->Invalidate( aRect ); - pView = aViewList.Next(); } } @@ -1173,7 +1178,7 @@ sal_uLong Outliner::Read( SvStream& rInput, const String& rBaseURL, sal_uInt16 e for ( n = 0; n < nParas; n++ ) { Paragraph* pPara = new Paragraph( 0 ); - pParaList->Insert( pPara, LIST_APPEND ); + pParaList->Append(pPara); if ( eFormat == EE_FORMAT_BIN ) { @@ -1216,7 +1221,7 @@ void Outliner::ImpFilterIndents( sal_uLong nFirstPara, sal_uLong nLastPara ) } else if ( pLastConverted ) { - // Normale Absaetze unter der Ueberschrift anordnen... + // Arrange normal paragraphs below the heading ... pPara->SetDepth( pLastConverted->GetDepth() ); } @@ -1243,8 +1248,6 @@ void Outliner::ImpTextPasted( sal_uLong nStartPara, sal_uInt16 nCount ) const sal_uLong nStart = nStartPara; Paragraph* pPara = pParaList->GetParagraph( nStartPara ); -// Paragraph* pLastConverted = NULL; -// bool bFirst = true; while( nCount && pPara ) { @@ -1264,7 +1267,7 @@ void Outliner::ImpTextPasted( sal_uLong nStartPara, sal_uInt16 nCount ) DepthChangedHdl(); } } - else // EditEngine-Modus + else // EditEngine mode { sal_Int16 nDepth = -1; const SfxItemSet& rAttrs = pEditEngine->GetParaAttribs( (sal_uInt16)nStartPara ); @@ -1298,17 +1301,17 @@ long Outliner::IndentingPagesHdl( OutlinerView* pView ) 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 + if ( nDepthChangedHdlPrevDepth == 1 ) // is the only page return sal_False; else - pCurView->ImpCalcSelectedPages( sal_False ); // ohne die erste + pCurView->ImpCalcSelectedPages( sal_False ); // without the first } return (sal_Bool)IndentingPagesHdl( pCurView ); } @@ -1317,8 +1320,8 @@ sal_Bool Outliner::ImpCanIndentSelectedPages( OutlinerView* pCurView ) sal_Bool Outliner::ImpCanDeleteSelectedPages( 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 return (sal_Bool)RemovingPagesHdl( pCurView ); } @@ -1338,7 +1341,7 @@ Outliner::Outliner( SfxItemPool* pPool, sal_uInt16 nMode ) pParaList = new ParagraphList; pParaList->SetVisibleStateChangedHdl( LINK( this, Outliner, ParaVisibleStateChangedHdl ) ); Paragraph* pPara = new Paragraph( 0 ); - pParaList->Insert( pPara, LIST_APPEND ); + pParaList->Append(pPara); bFirstParaIsEmpty = sal_True; pEditEngine = new OutlinerEditEng( this, pPool ); @@ -1359,52 +1362,72 @@ Outliner::~Outliner() delete pEditEngine; } -sal_uLong Outliner::InsertView( OutlinerView* pView, sal_uLong nIndex ) +size_t Outliner::InsertView( OutlinerView* pView, size_t nIndex ) { DBG_CHKTHIS(Outliner,0); + size_t ActualIndex; - aViewList.Insert( pView, nIndex ); + 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 aViewList.GetPos( pView ); + return ActualIndex; } OutlinerView* Outliner::RemoveView( OutlinerView* pView ) { DBG_CHKTHIS(Outliner,0); - sal_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( sal_uLong nIndex ) +OutlinerView* Outliner::RemoveView( size_t nIndex ) { DBG_CHKTHIS(Outliner,0); EditView* pEditView = pEditEngine->GetView( (sal_uInt16)nIndex ); - pEditView->HideCursor(); // HACK wg. BugId 10006 + pEditView->HideCursor(); // HACK pEditEngine->RemoveView( (sal_uInt16)nIndex ); - aViewList.Remove( nIndex ); - return NULL; // MT: return ueberfluessig + + { + ViewList::iterator it = aViewList.begin(); + advance( it, nIndex ); + aViewList.erase( it ); + } + + return NULL; // return superfluous } -OutlinerView* Outliner::GetView( sal_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 ]; } -sal_uLong Outliner::GetViewCount() const +size_t Outliner::GetViewCount() const { DBG_CHKTHIS(Outliner,0); - return aViewList.Count(); + return aViewList.size(); } void Outliner::ParagraphInsertedHdl() @@ -1520,10 +1543,9 @@ void Outliner::ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd ) { DBG_CHKTHIS( Outliner, 0 ); - // --> OD 2009-03-10 #i100014# + // i100014# // assure that the following for-loop does not loop forever for ( sal_uInt16 n = nStart; n < nEnd; n++ ) - // <-- { Paragraph* pPara = pParaList->GetParagraph( n ); if (pPara) @@ -1549,11 +1571,10 @@ 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() ) @@ -1573,11 +1594,10 @@ 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... - + // 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++ ) { @@ -1585,7 +1605,7 @@ void Outliner::StyleSheetChanged( SfxStyleSheet* pStyle ) { ImplCheckNumBulletItem( nPara ); ImplCalcBulletText( nPara, sal_False, sal_False ); - // #97333# EditEngine formats changed paragraphs before calling this method, + // 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 ) ); } @@ -1594,7 +1614,7 @@ void Outliner::StyleSheetChanged( SfxStyleSheet* pStyle ) 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 ); @@ -1612,12 +1632,12 @@ Rectangle Outliner::ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_B 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 ) ) ) @@ -1626,15 +1646,15 @@ Rectangle Outliner::ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_B } } - // 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 ) ); @@ -1644,7 +1664,7 @@ Rectangle Outliner::ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_B 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 ); @@ -1662,7 +1682,7 @@ Rectangle Outliner::ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_B 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 ); @@ -1772,7 +1792,6 @@ void Outliner::StripPortions() bStrippingPortions = sal_False; } -// #101498# 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, @@ -1788,9 +1807,21 @@ void Outliner::DrawingText( const Point& rStartPos, const XubString& rText, sal_ if(aDrawPortionHdl.IsSet()) { - // #101498# DrawPortionInfo aInfo( rStartPos, rText, nTextStart, nTextLen, rFont, nPara, nIndex, pDXArray, pWrongSpellVector, - pFieldData, pLocale, rOverlineColor, rTextLineColor, nRightToLeft, bEndOfLine, bEndOfParagraph, bEndOfBullet); + pFieldData, pLocale, rOverlineColor, rTextLineColor, nRightToLeft, false, 0, bEndOfLine, bEndOfParagraph, bEndOfBullet); + + aDrawPortionHdl.Call( &aInfo ); + } +} + +void Outliner::DrawingTab( const Point& rStartPos, long nWidth, const String& rChar, const SvxFont& rFont, + sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, bool bEndOfLine, bool bEndOfParagraph, + const Color& rOverlineColor, const Color& rTextLineColor) +{ + if(aDrawPortionHdl.IsSet()) + { + DrawPortionInfo aInfo( rStartPos, rChar, 0, rChar.Len(), rFont, nPara, nIndex, NULL, NULL, + NULL, NULL, rOverlineColor, rTextLineColor, nRightToLeft, true, nWidth, bEndOfLine, bEndOfParagraph, false); aDrawPortionHdl.Call( &aInfo ); } @@ -1994,7 +2025,7 @@ void Outliner::Clear() ImplBlockInsertionCallbacks( sal_True ); pEditEngine->Clear(); pParaList->Clear( sal_True ); - pParaList->Insert( new Paragraph( nMinDepth ), LIST_APPEND ); + pParaList->Append( new Paragraph( nMinDepth )); bFirstParaIsEmpty = sal_True; ImplBlockInsertionCallbacks( sal_False ); } @@ -2025,7 +2056,7 @@ String Outliner::ImplGetBulletText( sal_uInt16 nPara ) Paragraph* pPara = pParaList->GetParagraph( nPara ); if (pPara) { - // MT: Optimierung mal wieder aktivieren... + // Enable optimization again ... // if( pPara->nFlags & PARAFLAG_SETBULLETTEXT ) ImplCalcBulletText( nPara, sal_False, sal_False ); aRes = pPara->GetText(); @@ -2161,8 +2192,6 @@ sal_Bool DrawPortionInfo::IsRTL() const 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; @@ -2179,3 +2208,5 @@ sal_Bool DrawPortionInfo::IsRTL() const } // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outlobj.cxx b/editeng/source/outliner/outlobj.cxx index 79bcf7e6361a..989c6d0b4f17 100644 --- a/editeng/source/outliner/outlobj.cxx +++ b/editeng/source/outliner/outlobj.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -224,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; } @@ -269,3 +270,5 @@ void OutlinerParaObject::SetStyleSheets(sal_uInt16 nLevel, const XubString rNewN ////////////////////////////////////////////////////////////////////////////// // eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outlundo.cxx b/editeng/source/outliner/outlundo.cxx index 17e1f2ed8e1e..3767d9ac68d6 100644 --- a/editeng/source/outliner/outlundo.cxx +++ b/editeng/source/outliner/outlundo.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -131,7 +132,7 @@ void OutlinerUndoChangeDepth::Redo() void OutlinerUndoChangeDepth::Repeat() { - DBG_ERROR( "Repeat not implemented!" ); + OSL_FAIL( "Repeat not implemented!" ); } @@ -157,7 +158,7 @@ void OutlinerUndoCheckPara::Redo() void OutlinerUndoCheckPara::Repeat() { - DBG_ERROR( "Repeat not implemented!" ); + OSL_FAIL( "Repeat not implemented!" ); } DBG_NAME(OLUndoExpand); @@ -230,5 +231,7 @@ void OLUndoExpand::Redo() 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 68a6d7c930a1..5b49b0f64bde 100644 --- a/editeng/source/outliner/outlundo.hxx +++ b/editeng/source/outliner/outlundo.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -99,9 +100,9 @@ public: 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; @@ -132,9 +133,11 @@ public: virtual void Redo(); virtual void Repeat(); - sal_uInt16* pParas; // 0 == nCount enthaelt Absatznummer + sal_uInt16* pParas; // 0 == nCount contains paragraph number Outliner* pOutliner; sal_uInt16 nCount; }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 469c932061f6..9e685870037f 100755..100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,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; @@ -95,20 +96,20 @@ 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 ); } -sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt ) +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() ); @@ -171,7 +172,7 @@ sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt ) } } break; - default: // wird dann evtl. unten bearbeitet. + default: // is then possibly edited below. eFunc = KEYFUNC_DONTKNOW; } } @@ -219,13 +220,13 @@ sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt ) { 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 ) ) { @@ -235,9 +236,9 @@ sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt ) pOwner->UndoActionStart( OLUNDO_INSERT ); 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 + // Position the cursor ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0); pEditView->SetSelection( aTmpSel ); pEditView->ShowCursor( sal_True, sal_True ); @@ -255,7 +256,7 @@ sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt ) nTemp++; pOwner->Insert( String(), nTemp, pPara->GetDepth()+1 ); - // Cursor positionieren + // Position the cursor ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0); pEditView->SetSelection( aTmpSel ); pEditView->ShowCursor( sal_True, sal_True ); @@ -268,7 +269,8 @@ sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt ) } } - return bKeyProcessed ? sal_True : pEditView->PostKeyEvent( rKEvt ); + return bKeyProcessed ? sal_True : pEditView->PostKeyEvent( rKEvt, pFrameWin ); + } @@ -316,7 +318,7 @@ sal_uLong OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTa return nPara; } -sal_Bool __EXPORT OutlinerView::MouseMove( const MouseEvent& rMEvt ) +sal_Bool OutlinerView::MouseMove( const MouseEvent& rMEvt ) { DBG_CHKTHIS(OutlinerView,0); @@ -333,7 +335,7 @@ sal_Bool __EXPORT OutlinerView::MouseMove( const MouseEvent& rMEvt ) } -sal_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() ) @@ -357,7 +359,7 @@ sal_Bool __EXPORT OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) sal_uLong nEndPara = nPara; if ( bHasChilds && pOwner->pParaList->HasVisibleChilds(pPara) ) nEndPara += pOwner->pParaList->GetChildCount( pPara ); - // umgekehrt rum selektieren, damit EditEngine nicht scrollt + // The selection is inverted, so that EditEngine does not scroll ESelection aSel((sal_uInt16)nEndPara, 0xffff,(sal_uInt16)nPara, 0 ); pEditView->SetSelection( aSel ); } @@ -384,7 +386,7 @@ sal_Bool __EXPORT OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) } -sal_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() ) @@ -433,7 +435,6 @@ void OutlinerView::ImpPaintDDCursor() Point aStartPointWin, aEndPointWin; Rectangle aOutputArWin = pEditView->GetOutputArea(); - Rectangle aVisAreaRef = pEditView->GetVisArea(); if( bDDChangingDepth ) { @@ -467,7 +468,7 @@ void OutlinerView::ImpPaintDDCursor() pWindow->SetRasterOp( eOldOp ); } -// Berechnet, ueber welchem Absatz eingefuegt werden muss +// Calculates above which paragraph must it must be inserted sal_uLong OutlinerView::ImpGetInsertionPara( const Point& rPosPixel ) { @@ -549,7 +550,7 @@ void OutlinerView::SetAttribs( const SfxItemSet& rAttrs ) pEditView->SetAttribs( rAttrs ); - // Bullet-Texte aktualisieren + // Update Bullet text for( sal_uInt16 nPara= aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { pOwner->ImplCheckNumBulletItem( nPara ); @@ -573,7 +574,7 @@ ParaRange OutlinerView::ImpGetSelectedParagraphs( sal_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 ); @@ -586,7 +587,7 @@ ParaRange OutlinerView::ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChilds return aParas; } -// MT: Name sollte mal geaendert werden! +// TODO: Name should be changed! void OutlinerView::AdjustDepth( short nDX ) { Indent( nDX ); @@ -608,7 +609,7 @@ void OutlinerView::Indent( short nDiff ) 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( sal_True ); for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) @@ -623,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; @@ -665,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 ?!"); @@ -677,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 ); @@ -698,7 +699,7 @@ void OutlinerView::Indent( short nDiff ) if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT ) pOwner->ImplSetLevelDependendStyleSheet( nPara ); - // App benachrichtigen + // Notify App pOwner->DepthChangedHdl(); } else @@ -708,12 +709,6 @@ 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. sal_uInt16 nParas = (sal_uInt16)pOwner->pParaList->GetParagraphCount(); for ( sal_uInt16 n = aSel.nEndPara+1; n < nParas; n++ ) { @@ -776,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(); @@ -784,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); @@ -945,7 +938,7 @@ void OutlinerView::ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPa 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 ); } } @@ -976,16 +969,14 @@ 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); @@ -1019,7 +1010,7 @@ void OutlinerView::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() @@ -1047,18 +1038,17 @@ void OutlinerView::PasteSpecial() } } -List* OutlinerView::CreateSelectionList() +void OutlinerView::CreateSelectionList (std::vector<Paragraph*> &aSelList) { DBG_CHKTHIS( OutlinerView, 0 ); ParaRange aParas = ImpGetSelectedParagraphs( sal_True ); - List* pSelList = new List; + 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 @@ -1162,11 +1152,11 @@ sal_uInt16 OutlinerView::ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected ) sal_uInt16 nFirstPage = 0xFFFF; sal_uInt16 nStartPara = aSel.nStartPara; if ( !bIncludeFirstSelected ) - nStartPara++; // alle nach StartPara kommenden Absaetze werden geloescht + 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++; @@ -1223,11 +1213,10 @@ void OutlinerView::ToggleBullets() } } - // --> OD 2009-03-10 #i100014# + // #i100014# // It is not a good idea to substract 1 from a count and cast the result // 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 ) ); @@ -1257,11 +1246,11 @@ void OutlinerView::EnableBullets() } } - // --> OD 2009-03-10 #i100014# + // #i100014# // It is not a good idea to substract 1 from a count and cast the result // 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 ) ); @@ -1288,7 +1277,7 @@ void OutlinerView::RemoveAttribs( sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich 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 ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) @@ -1303,8 +1292,8 @@ void OutlinerView::RemoveAttribs( sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich -// ===================================================================== -// ====================== Einfache Durchreicher ======================= +// ====================================================================== +// ====================== Simple pass-through ======================= // ====================================================================== @@ -1440,7 +1429,7 @@ void OutlinerView::StartTextConversion( } else { - DBG_ERROR( "unexpected language" ); + OSL_FAIL( "unexpected language" ); } } @@ -1606,9 +1595,6 @@ sal_uLong OutlinerView::Read( SvStream& rInput, const String& rBaseURL, EETextF sal_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. - long nParaDiff = pEditView->GetEditEngine()->GetParagraphCount() - nOldParaCount; sal_uInt16 nChangesStart = aOldSel.nStartPara; sal_uInt16 nChangesEnd = sal::static_int_cast< sal_uInt16 >(nChangesStart + nParaDiff + (aOldSel.nEndPara-aOldSel.nStartPara)); @@ -1732,3 +1718,4 @@ void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/paralist.cxx b/editeng/source/outliner/paralist.cxx index cde4a9f36c4c..c09e0f22d90f 100644 --- a/editeng/source/outliner/paralist.cxx +++ b/editeng/source/outliner/paralist.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,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() @@ -122,74 +126,98 @@ void ParagraphList::Clear( sal_Bool bDestroyParagraphs ) { if ( bDestroyParagraphs ) { - for ( sal_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::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 ) ) ) { - sal_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 { - sal_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 { - sal_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 { - sal_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; } sal_Bool ParagraphList::HasChilds( Paragraph* pParagraph ) const @@ -273,15 +301,33 @@ void ParagraphList::Collapse( Paragraph* pParent ) } } -sal_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 { sal_uLong nVisPos = 0; - sal_uLong nPos = GetAbsPos( pPara ); - for ( sal_uLong n = 0; n < nPos; n++ ) + 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; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/paralist.hxx b/editeng/source/outliner/paralist.hxx index 9ae4ef7a39bc..29398c24239e 100644 --- a/editeng/source/outliner/paralist.hxx +++ b/editeng/source/outliner/paralist.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,27 +29,33 @@ #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( sal_Bool bDestroyParagraphs ); - sal_uLong GetParagraphCount() const { return List::Count(); } - Paragraph* GetParagraph( sal_uLong nPos ) const { return (Paragraph*)List::GetObject( nPos ); } + sal_uInt32 GetParagraphCount() const + { + return maEntries.size(); + } - sal_uLong GetAbsPos( Paragraph* pParent ) const { return List::GetPos( pParent ); } - sal_uLong GetVisPos( Paragraph* pParagraph ); + Paragraph* GetParagraph( sal_uLong nPos ) const + { + return nPos < maEntries.size() ? maEntries[nPos] : NULL; + } - void Insert( Paragraph* pPara, sal_uLong nAbsPos = LIST_APPEND ) { List::Insert( pPara, nAbsPos ); } - void Remove( sal_uLong nPara ) { List::Remove( nPara ); } + sal_uLong GetAbsPos( Paragraph* pParent ) const; + sal_uLong GetVisPos( Paragraph* pParagraph ) const; + + 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; @@ -66,6 +73,13 @@ public: void SetVisibleStateChangedHdl( const Link& rLink ) { aVisibleStateChangedHdl = rLink; } Link GetVisibleStateChangedHdl() const { return aVisibleStateChangedHdl; } + +private: + + Link aVisibleStateChangedHdl; + std::vector<Paragraph*> maEntries; }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/rtf/rtfgrf.cxx b/editeng/source/rtf/rtfgrf.cxx index 12e9c992070a..87a603946d92 100644 --- a/editeng/source/rtf/rtfgrf.cxx +++ b/editeng/source/rtf/rtfgrf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_editeng.hxx" -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ +#include <boost/scoped_ptr.hpp> + #include <osl/endian.h> #include <tools/cachestr.hxx> #include <vcl/graph.hxx> @@ -36,49 +38,18 @@ #include <svtools/rtfkeywd.hxx> #include <svtools/rtftoken.h> #include <svtools/filter.hxx> +#include <svtools/wmf.hxx> #include <editeng/svxrtf.hxx> 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 sal_uInt8 __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 sal_uInt8 __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 +68,7 @@ static sal_uInt8 __FAR_DATA aPal4[ 16 * 4 ] = { 0xFF, 0xFF, 0xFF, 0x00 }; -static sal_uInt8 __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, @@ -217,7 +188,7 @@ static void WriteBMPHeader( SvStream& rStream, sal_uInt32 n4Height = rPicType.nHeight; sal_uInt16 n4ColBits = rPicType.nBitsPerPixel; - sal_uInt16 nColors = (1 << n4ColBits); // Anzahl der Farben ( 1, 16, 256 ) + sal_uInt16 nColors = (1 << n4ColBits); // Number of colors (1, 16, 256) sal_uInt16 nWdtOut = rPicType.nWidthBytes; if( !nWdtOut ) nWdtOut = (sal_uInt16)((( n4Width * n4ColBits + 31 ) / 32 ) * 4 ); @@ -228,8 +199,8 @@ 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 ) @@ -257,16 +228,14 @@ 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; @@ -284,7 +253,7 @@ xub_StrLen SvxRTFParser::HexToBin( String& rToken ) nVal -= 'a' - 10; else { - DBG_ASSERT( !this, "ungueltiger Hex-Wert" ); + DBG_ASSERT( !this, "invalid Hex value" ); bValidData = sal_False; break; } @@ -300,19 +269,18 @@ xub_StrLen SvxRTFParser::HexToBin( String& rToken ) sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) { - // die alten Daten loeschen + // Delete the old data rGrf.Clear(); -// sal_uInt32 nBmpSize = 0; rtl_TextEncoding eOldEnc = GetSrcEncoding(); SetSrcEncoding( RTL_TEXTENCODING_MS_1252 ); const sal_Char* pFilterNm = 0; - SvCacheStream* pTmpFile = 0; + boost::scoped_ptr<SvCacheStream> pTmpFile; 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 ) @@ -359,8 +327,8 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) case RTF_MACPICT: { rPicType.eStyle = SvxRTFPictureType::MAC_QUICKDRAW; - // Mac-Pict bekommt einen leeren Header voran - pTmpFile = new SvCacheStream; + // Mac-Pict gets a empty header above + pTmpFile.reset(new SvCacheStream); ByteString aStr; aStr.Fill( 512, '\0' ); pTmpFile->Write( aStr.GetBuffer(), aStr.Len() ); @@ -407,7 +375,7 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) } rPicType.nType = nVal; - pTmpFile = new SvCacheStream; + pTmpFile.reset(new SvCacheStream); } break; @@ -423,8 +391,6 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) rPicType.uPicLen = nTokenValue; if (rPicType.uPicLen) { - sal_uInt32 nPos = rStrm.Tell(); - nPos = nPos; rStrm.SeekRel(-1); sal_uInt8 aData[4096]; sal_uInt32 nSize = sizeof(aData); @@ -440,8 +406,6 @@ sal_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 +435,6 @@ sal_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,7 +443,7 @@ sal_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; @@ -516,15 +477,15 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) if( bValidBmp ) { - GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + GraphicFilter& rGF = GraphicFilter::GetGraphicFilter(); sal_uInt16 nImportFilter = GRFILTER_FORMAT_DONTKNOW; if( pFilterNm ) { String sTmp; - for( sal_uInt16 n = pGF->GetImportFormatCount(); n; ) + for( sal_uInt16 n = rGF.GetImportFormatCount(); n; ) { - sTmp = pGF->GetImportFormatShortName( --n ); + sTmp = rGF.GetImportFormatShortName( --n ); if( sTmp.EqualsAscii( pFilterNm )) { nImportFilter = n; @@ -534,17 +495,22 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) } String sTmpStr; + WMF_APMFILEHEADER aAPMHeader; + aAPMHeader.left=0; + aAPMHeader.top=0; + aAPMHeader.right=rPicType.nWidth; + aAPMHeader.bottom=rPicType.nHeight; + + WMF_APMFILEHEADER *pAPMHeader=(aAPMHeader.right>0 && aAPMHeader.bottom>0?&aAPMHeader:NULL); pTmpFile->Seek( STREAM_SEEK_TO_BEGIN ); - bValidBmp = 0 == pGF->ImportGraphic( rGrf, sTmpStr, *pTmpFile, - nImportFilter ); + bValidBmp = 0 == rGF.ImportGraphic( rGrf, sTmpStr, *pTmpFile, nImportFilter, NULL, 0, pAPMHeader ); } - delete pTmpFile; } 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 +520,6 @@ sal_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: { @@ -574,15 +539,11 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) 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; } -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 63a8dd3aa6f6..d97c05b3d67f 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_editeng.hxx" -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ - #include <editeng/flstitem.hxx> #include <editeng/fontitem.hxx> #include <editeng/postitem.hxx> @@ -96,8 +95,9 @@ #define BRACELEFT '{' #define BRACERIGHT '}' +using namespace editeng; -// einige Hilfs-Funktionen +// Some helper functions // char inline const SvxEscapementItem& GetEscapement(const SfxItemSet& rSet,sal_uInt16 nId,sal_Bool bInP=sal_True) { return (const SvxEscapementItem&)rSet.Get( nId,bInP); } @@ -218,7 +218,7 @@ void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet, void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) { - DBG_ASSERT( pSet, "Es muss ein SfxItemSet uebergeben werden!" ); + 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; @@ -230,7 +230,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) 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 ) { @@ -262,12 +262,12 @@ 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, sal_True ); pNew->SetRTFDefaults( GetRTFDefaults() ); - // alle bis hierher gueltigen Attribute "setzen" + // "Set" all valid attributes up until this point AttrGroupEnd(); pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); @@ -276,7 +276,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) pAkt = pNew; } else - // diesen Eintrag als neuen weiterbenutzen + // continue to use this entry as a new one pAkt->SetStartPos( *pInsPos ); pSet = &pAkt->aAttrSet; @@ -311,34 +311,6 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) pAkt->nStyleNo = sal_uInt16( nStyleNo ); -#if 0 -// JP 05.09.95: zuruecksetzen der Style-Attribute fuehrt nur zu Problemen. -// Es muss reichen, wenn das ueber pard/plain erfolgt -// ansonsten Bugdoc 15304.rtf - nach nur "\pard" falscher Font !! - - SvxRTFStyleType* pStyle = aStyleTbl.Get( pAkt->nStyleNo ); - if( pStyle && pStyle->aAttrSet.Count() ) - { - //JP 07.07.95: - // alle Attribute, die in der Vorlage gesetzt werden - // auf defaults setzen. In RTF werden die Attribute - // der Vorlage danach ja wiederholt. - // WICHTIG: Attribute die in der Vorlage definiert - // sind, werden zurueckgesetzt !!!! - // pAkt->aAttrSet.Put( pStyle->aAttrSet ); - - SfxItemIter aIter( pStyle->aAttrSet ); - SfxItemPool* pPool = pStyle->aAttrSet.GetPool(); - sal_uInt16 nWh = aIter.GetCurItem()->Which(); - while( sal_True ) - { - pAkt->aAttrSet.Put( pPool->GetDefaultItem( nWh )); - if( aIter.IsAtEnd() ) - break; - nWh = aIter.NextItem()->Which(); - } - } -#endif } break; @@ -474,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, 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() ) @@ -490,8 +462,8 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) nTokenValue = short( 100L * aLSpace.GetLineHeight() / long( nTokenValue ) ); - if( nTokenValue > 200 ) // Datenwert fuer PropLnSp - nTokenValue = 200; // ist ein sal_uInt8 !!! + if( nTokenValue > 200 ) // Data value for PropLnSp + nTokenValue = 200; // is one BYTE !!! aLSpace.SetPropLineSpace( (const sal_uInt8)nTokenValue ); aLSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; @@ -503,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; @@ -580,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( @@ -596,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 ) @@ -721,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, @@ -732,7 +703,7 @@ SET_FONTALIGNMENT: case RTF_OUTL: if( PLAINID->nContour && - IsAttrSttPos() ) // nicht im Textfluss ? + IsAttrSttPos() ) // not in the text flow? { pSet->Put( SvxContourItem( nTokenValue ? sal_True : sal_False, PLAINID->nContour )); @@ -741,7 +712,7 @@ SET_FONTALIGNMENT: case RTF_SHAD: if( PLAINID->nShadowed && - IsAttrSttPos() ) // nicht im Textfluss ? + IsAttrSttPos() ) // not in the text flow? { pSet->Put( SvxShadowedItem( nTokenValue ? sal_True : sal_False, PLAINID->nShadowed )); @@ -750,7 +721,7 @@ SET_FONTALIGNMENT: case RTF_STRIKE: if( PLAINID->nCrossedOut && - IsAttrSttPos() ) // nicht im Textfluss ? + IsAttrSttPos() ) // not in the text flow? { pSet->Put( SvxCrossedOutItem( nTokenValue ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, @@ -759,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, @@ -990,9 +961,9 @@ ATTR_SETOVERLINE: PLAINID->nColor )); } break; -#if 0 //#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 ) { @@ -1001,6 +972,7 @@ ATTR_SETOVERLINE: } break; #endif + case RTF_LANG: if( PLAINID->nLanguage ) { @@ -1144,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()) @@ -1163,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 ! + // 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 ) @@ -1204,7 +1173,7 @@ ATTR_SETEMPHASIS: pSet->Put( aHypenZone ); } else - SkipGroup(); // ans Ende der Gruppe + SkipGroup(); // at the end of the group } break; @@ -1219,8 +1188,6 @@ ATTR_SETEMPHASIS: if( RTF_SHDW_STYLE != GetNextToken() ) break; - //! (pb) class Brush removed -> obsolete - //! BrushStyle eStyle = BrushStyle( nTokenValue ); if( RTF_SHDW_COL != GetNextToken() ) break; @@ -1228,7 +1195,6 @@ ATTR_SETEMPHASIS: if( RTF_SHDW_FCOL != GetNextToken() ) break; -// sal_uInt16 nFillCol = sal_uInt16( nTokenValue ); Color aColor = GetColor( nCol ); @@ -1240,7 +1206,7 @@ ATTR_SETEMPHASIS: } while( sal_False ); if( bSkip ) - SkipGroup(); // ans Ende der Gruppe + SkipGroup(); // at the end of the group } break; @@ -1273,7 +1239,7 @@ ATTR_SETEMPHASIS: nToken = SkipToken( -2 ); ReadBorderAttr( nToken, *pSet ); } - else // also kein Attribut mehr + else // so no more attribute nSkip = -2; break; } @@ -1295,10 +1261,10 @@ 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 = sal_False; } @@ -1313,7 +1279,7 @@ 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 = sal_False; @@ -1326,38 +1292,12 @@ ATTR_SETEMPHASIS: } bFirstToken = sal_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 ); - sal_uInt16 nWhich = aIter.GetCurItem()->Which(); - while( sal_True ) - { - if( SFX_ITEM_SET == pStyle->aAttrSet.GetItemState( - nWhich, sal_False, &pItem ) && *pItem == *aIter.GetCurItem()) - pSet->ClearItem( nWhich ); // loeschen - - if( aIter.IsAtEnd() ) - break; - nWhich = aIter.NextItem()->Which(); - } - } - } -*/ } 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 = sal_True; @@ -1371,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; @@ -1396,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; @@ -1406,13 +1346,13 @@ void SvxRTFParser::ReadTabAttr( int nToken, SfxItemSet& rSet ) { aTabStop.GetDecimal() = sal_uInt8(nTokenValue & 0xff); aTabStop.GetFill() = sal_uInt8((nTokenValue >> 8) & 0xff); - // ueberlese noch die schliessende Klammer + // overwrite the closing parenthesis if (bMethodOwnsToken) GetNextToken(); } if( nSkip ) { - SkipToken( nSkip ); // Ignore wieder zurueck + SkipToken( nSkip ); // Ignore back again bWeiter = sal_False; } } @@ -1428,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 ); } @@ -1438,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 ); @@ -1465,15 +1405,18 @@ 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, sal_False, &pItem ) ) aAttr = *(SvxBoxItem*)pItem; - SvxBorderLine aBrd( 0, DEF_LINE_WIDTH_0, 0, 0 ); // einfache Linien + 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 ) { @@ -1483,42 +1426,115 @@ 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 ) + { + if (nBorderTyp != 0) + SetBorderLine( nBorderTyp, aAttr, aBrd ); + nBorderTyp = RTF_BRDRT; + } break; - nBorderTyp = RTF_BRDRT; - goto SETBORDER; - case RTF_CLBRDRB: - if( !bTableDef ) + } + case RTF_CLBRDRB: // Cell bottom border + { + if( bTableDef ) + { + if (nBorderTyp != 0) + SetBorderLine( nBorderTyp, aAttr, aBrd ); + nBorderTyp = RTF_BRDRB; + } break; - nBorderTyp = RTF_BRDRB; - goto SETBORDER; - case RTF_CLBRDRL: - if( !bTableDef ) + } + case RTF_CLBRDRL: // Cell left border + { + if( bTableDef ) + { + if (nBorderTyp != 0) + SetBorderLine( nBorderTyp, aAttr, aBrd ); + nBorderTyp = RTF_BRDRL; + } break; - nBorderTyp = RTF_BRDRL; - goto SETBORDER; - case RTF_CLBRDRR: - if( !bTableDef ) + } + case RTF_CLBRDRR: // Cell right border + { + if( bTableDef ) + { + if (nBorderTyp != 0) + SetBorderLine( nBorderTyp, aAttr, aBrd ); + 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 ) { @@ -1545,182 +1561,9 @@ SETBORDER: } break; -case RTF_BRDRBTW: -case RTF_BRDRBAR: break; - - - case RTF_BRDRCF: - { - aBrd.SetColor( GetColor( sal_uInt16(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_BRDRS: - case RTF_BRDRDOT: - case RTF_BRDRHAIR: - case RTF_BRDRDASH: -SETBORDERLINE: - SetBorderLine( nBorderTyp, aAttr, aBrd ); - break; - - case BRACELEFT: - { - short nSkip = 0; - if( RTF_IGNOREFLAG != GetNextToken() ) - nSkip = -1; - else - { - int bSwgControl = sal_True, bFirstToken = sal_True; - nToken = GetNextToken(); - do { - switch( nToken ) - { - case RTF_BRDBOX: - aAttr.SetDistance( sal_uInt16(nTokenValue) ); - break; - - case RTF_BRDRT: - case RTF_BRDRB: - case RTF_BRDRR: - case RTF_BRDRL: - nBorderTyp = nToken; - bFirstToken = sal_False; - if( RTF_BRDLINE_COL != GetNextToken() ) - { - bSwgControl = sal_False; - break; - } - aBrd.SetColor( GetColor( sal_uInt16(nTokenValue) )); - - if( RTF_BRDLINE_IN != GetNextToken() ) - { - bSwgControl = sal_False; - break; - } - aBrd.SetInWidth( sal_uInt16(nTokenValue)); - - if( RTF_BRDLINE_OUT != GetNextToken() ) - { - bSwgControl = sal_False; - break; - } - aBrd.SetOutWidth( sal_uInt16(nTokenValue)); - - if( RTF_BRDLINE_DIST != GetNextToken() ) - { - bSwgControl = sal_False; - break; - } - aBrd.SetDistance( sal_uInt16(nTokenValue)); - SetBorderLine( nBorderTyp, aAttr, aBrd ); - break; - - default: - bSwgControl = sal_False; - break; - } - - if( bSwgControl ) - { - nToken = GetNextToken(); - bFirstToken = sal_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 = sal_False; - } - } + case RTF_BRDRBTW: // Border formatting group + case RTF_BRDRBAR: // Border outside + // TODO unhandled ATM break; default: @@ -1729,6 +1572,13 @@ 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 ); } @@ -1743,7 +1593,7 @@ inline sal_uInt32 CalcShading( sal_uInt32 nColor, sal_uInt32 nFillColor, sal_uIn void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet, int bTableDef ) { - // dann lese doch mal das BoderAttribut ein + // then read the border attribute int bWeiter = sal_True; sal_uInt16 nColor = USHRT_MAX, nFillColor = USHRT_MAX; sal_uInt8 nFillValue = 0; @@ -1830,7 +1680,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; @@ -1881,11 +1731,11 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) { if( pAkt->aAttrSet.Count() || pAkt->pChildList || pAkt->nStyleNo ) { - // eine neue Gruppe aufmachen + // 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.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); @@ -1894,13 +1744,13 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) } else { - // diesen Eintrag als neuen weiterbenutzen + // continue to use this entry as new pAkt->SetStartPos( *pInsPos ); bNewStkEntry = sal_False; } } - // jetzt noch alle auf default zuruecksetzen + // now reset all to default if( bNewStkEntry && ( pAkt->aAttrSet.GetParent() || pAkt->aAttrSet.Count() )) { @@ -1922,10 +1772,7 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) 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 ) @@ -1955,7 +1802,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; @@ -2001,7 +1848,7 @@ void SvxRTFParser::SetDefault( int nToken, int nValue ) 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, @@ -2013,47 +1860,22 @@ void SvxRTFParser::SetDefault( int nToken, int nValue ) case RTF_DEFTAB: if( PARDID->nTabStop ) { - // RTF definiert 720 twips als default + // 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, sal_uInt16(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 ?? ---------------------------------------------------*/ + // 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 @@ -2062,7 +1884,7 @@ void SvxRTFParser::SetDefault( int nToken, int nValue ) if (nAnzTabs < 1) nAnzTabs = 1; - // wir wollen Defaulttabs + // we want Defaulttabs SvxTabStopItem aNewTab( nAnzTabs, sal_uInt16(nValue), SVX_TAB_ADJUST_DEFAULT, PARDID->nTabStop ); while( nAnzTabs ) @@ -2088,14 +1910,14 @@ 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* ) { } -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index 106ee9b61bbc..0b934cd22e8c 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_editeng.hxx" -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ - - #include <ctype.h> #include <tools/datetime.hxx> #include <rtl/tencinfo.h> @@ -66,16 +64,16 @@ 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, @@ -147,7 +145,7 @@ void SvxRTFParser::SetInsPos( const SvxPosition& rNew ) SvParserState SvxRTFParser::CallParser() { - DBG_ASSERT( pInsPos, "no insertion" ); + DBG_ASSERT( pInsPos, "no insertion position"); if( !pInsPos ) return SVPAR_ERROR; @@ -167,7 +165,7 @@ SvParserState SvxRTFParser::CallParser() sBaseURL.Erase(); - // erzeuge aus den gesetzten WhichIds die richtige WhichId-Tabelle. + // generate the correct WhichId table from the set WhichIds. BuildWhichTbl(); return SvRTFParser::CallParser(); @@ -180,18 +178,13 @@ void SvxRTFParser::Continue( int nToken ) if( SVPAR_PENDING != GetStatus() ) { SetAllAttrOfStk(); -#if 0 //Regardless of what "color 0" is, word defaults to auto as the default colour. //e.g. see #i7713# - if( bNewDoc && ((RTFPlainAttrMapIds*)aPlainMap.GetData())->nColor ) - pAttrPool->SetPoolDefaultItem( SvxColorItem( GetColor( 0 ), - ((RTFPlainAttrMapIds*)aPlainMap.GetData())->nColor )); -#endif } } -// 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; @@ -205,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; @@ -237,11 +230,11 @@ 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 + // all collected Attributes are set for( sal_uInt16 n = aAttrSetList.Count(); n; ) { SvxRTFItemStackType* pStkSet = aAttrSetList[--n]; @@ -256,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: @@ -293,10 +284,7 @@ INSINGLECHAR: case RTF_TC: case RTF_NEXTFILE: case RTF_TEMPLATE: -#if 0 - //disabled for #i19718# - case RTF_SHPRSLT: // RTF_SHP fehlt noch !! -#endif + // RTF_SHPRSLT disabled for #i19718# SkipGroup(); break; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -353,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 = sal_True; - bChkStyleAttr = sal_False; // Attribute nicht gegen die Styles checken + 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 '{': @@ -378,7 +366,7 @@ void SvxRTFParser::ReadStyleTable() nToken = SkipToken( -2 ); else { - // gleich herausfiltern + // filter out at once ReadUnknownData(); nToken = GetNextToken(); if( '}' != nToken ) @@ -402,19 +390,13 @@ void SvxRTFParser::ReadStyleTable() { 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,9 +422,6 @@ void SvxRTFParser::ReadStyleTable() if( '{' == GetStackPtr( -1 )->nTokenId ) { nToken = SkipToken( -1 ); -#if 0 - --_nOpenBrakets; // korrigieren!! -#endif } } ReadAttr( nToken, &pStyle->aAttrSet ); @@ -451,10 +430,10 @@ 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 = sal_False; } @@ -472,19 +451,19 @@ void SvxRTFParser::ReadColorTable() 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.empty() && sal_uInt8(-1) == nRed && sal_uInt8(-1) == nGreen && sal_uInt8(-1) == nBlue ) @@ -492,20 +471,20 @@ void SvxRTFParser::ReadColorTable() 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; @@ -522,8 +501,8 @@ void SvxRTFParser::ReadFontTable() { case '}': bIsAltFntNm = sal_False; - // Style konnte vollstaendig gelesen werden, - // also ist das noch ein stabiler Status + // Style has been completely read, + // so this is still a stable status if( --_nOpenBrakets <= 1 && IsParserWorking() ) SaveState( RTF_FONTTBL ); bCheckNewFont = sal_True; @@ -532,15 +511,15 @@ void SvxRTFParser::ReadFontTable() 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 ) @@ -564,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 @@ -617,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; @@ -629,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 ); } @@ -651,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() ) { @@ -666,7 +645,7 @@ String& SvxRTFParser::GetTextToEndGroup( String& rStr ) nToken = SkipToken( -2 ); else { - // gleich herausfiltern + // filter out at once ReadUnknownData(); nToken = GetNextToken(); if( '}' != nToken ) @@ -682,7 +661,7 @@ String& SvxRTFParser::GetTextToEndGroup( String& rStr ) break; } } - SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet + SkipToken( -1 ); // the closing brace is evaluated "above" return rStr; } @@ -704,14 +683,13 @@ util::DateTime SvxRTFParser::GetDateTimeStamp( ) 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; @@ -730,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 ) @@ -809,8 +787,7 @@ 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" } @@ -909,35 +886,32 @@ void SvxRTFParser::_ClearStyleAttr( SvxRTFItemStackType& rStkType ) if( SFX_WHICH_MAX > nWhich && 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( sal_uInt16 nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() ) { 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, 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, 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.empty() ) { @@ -951,9 +925,9 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen ((!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 ); @@ -975,82 +949,54 @@ 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 + // 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() )) -#if 0 -//BUG 68555 - dont test for empty paragraph or any range - && ( nOldSttNdIdx != pInsPos->GetNodeIdx() || - pOld->nSttCnt != pInsPos->GetCntIdx() || - !pOld->nSttCnt ) -#endif ) { 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() ) { -#if 0 -//BUG 68555 - dont reset pard attrs, if the group not begins not at start of -// paragraph - // Bereich innerhalb eines Absatzes: - // alle Absatz-Attribute und StyleNo loeschen - // aber nur wenn mitten drin angefangen wurde - if( pOld->nSttCnt ) - { - pOld->nStyleNo = 0; - for( sal_uInt16 n = 0; n < aPardMap.Count() && - pOld->aAttrSet.Count(); ++n ) - if( aPardMap[n] ) - pOld->aAttrSet.ClearItem( aPardMap[n] ); - - if( !pOld->aAttrSet.Count() && !pOld->pChildList && - !pOld->nStyleNo ) - break; // auch dieser verlaesst uns jetzt - } -#endif } 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, sal_True ); pNew->aAttrSet.SetParent( pOld->aAttrSet.GetParent() ); - // loesche aus pNew alle Absatz Attribute + // 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; @@ -1067,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; } } } @@ -1082,10 +1028,6 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen pOld->pEndNd = pInsPos->MakeNodeIdx(); pOld->nEndCnt = pInsPos->GetCntIdx(); -#if 0 - if( IsChkStyleAttr() ) - _ClearStyleAttr( *pOld ); -#else /* #i21422# If the parent (pAkt) sets something e.g. , and the child (pOld) @@ -1098,7 +1040,6 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen */ if (IsChkStyleAttr() && !pAkt) _ClearStyleAttr( *pOld ); -#endif if( pAkt ) { @@ -1107,16 +1048,16 @@ 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 + // 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, sal_True ); pNew->SetRTFDefaults( GetRTFDefaults() ); - // alle bis hierher gueltigen Attribute "setzen" + // Set all until here valid Attributes AttrGroupEnd(); pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); @@ -1125,16 +1066,15 @@ 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() ); pOld = 0; } if( bCrsrBack ) - // am Absatzanfang ? eine Position zurueck + // at the beginning of a paragraph? Move back one position MovePos( sal_True ); } while( sal_False ); @@ -1160,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 ); @@ -1172,13 +1112,13 @@ 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( sal_uInt16 n = 0; n < rSet.pChildList->Count(); ++n ) SetAttrSet( *(*rSet.pChildList)[ n ] ); } - // Is text wasn't inserted? (Get SttPos from the top of stack!) + // Has no Text been inserted yet? (SttPos from the top Stack entry!) int SvxRTFParser::IsAttrSttPos() { SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); @@ -1191,27 +1131,15 @@ 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( (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. + // 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() ); } @@ -1239,7 +1167,7 @@ const SfxItemSet& SvxRTFParser::GetRTFDefaults() SvxRTFStyleType::SvxRTFStyleType( SfxItemPool& rPool, const sal_uInt16* pWhichRange ) : aAttrSet( rPool, pWhichRange ) { - nOutlineNo = sal_uInt8(-1); // nicht gesetzt + nOutlineNo = sal_uInt8(-1); // not set nBasedOn = 0; bBasedOnIsSet = sal_False; //$flr #117411# nNext = 0; @@ -1294,18 +1222,6 @@ void SvxRTFItemStackType::Add( SvxRTFItemStackType* pIns ) pChildList->Insert( pIns, pChildList->Count() ); } -#if 0 -//cmc: This is the original. nEndCnt is redundantly assigned to itself, and -//pEndNd can leak if not equal to pSttNd. -void SvxRTFItemStackType::SetStartPos( const SvxPosition& rPos ) -{ - delete pSttNd; - pSttNd = rPos.MakeNodeIdx(); - nSttCnt = rPos.GetCntIdx(); - pEndNd = pSttNd; - nEndCnt = nEndCnt; -} -#else void SvxRTFItemStackType::SetStartPos( const SvxPosition& rPos ) { if (pSttNd != pEndNd) @@ -1315,7 +1231,6 @@ void SvxRTFItemStackType::SetStartPos( const SvxPosition& rPos ) pEndNd = pSttNd; nSttCnt = rPos.GetCntIdx(); } -#endif void SvxRTFItemStackType::MoveFullNode(const SvxNodeIdx &rOldNode, const SvxNodeIdx &rNewNode) @@ -1352,7 +1267,7 @@ 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" ); sal_uInt16 n; SvxRTFItemStackType* pTmp = (*pChildList)[0]; @@ -1389,7 +1304,7 @@ 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 { @@ -1414,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 ) @@ -1515,4 +1430,4 @@ RTFPardAttrMapIds ::RTFPardAttrMapIds ( const SfxItemPool& rPool ) nDirection = rPool.GetTrueWhich( SID_ATTR_FRAMEDIRECTION, sal_False ); } -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/UnoForbiddenCharsTable.cxx b/editeng/source/uno/UnoForbiddenCharsTable.cxx index cf3cce7b9adb..c17a8ca556da 100644 --- a/editeng/source/uno/UnoForbiddenCharsTable.cxx +++ b/editeng/source/uno/UnoForbiddenCharsTable.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,7 @@ #include "precompiled_editeng.hxx" #include <editeng/UnoForbiddenCharsTable.hxx> #include <editeng/forbiddencharacterstable.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <editeng/unolingu.hxx> // LocalToLanguage, LanguageToLocale @@ -39,10 +40,9 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::i18n; using namespace ::rtl; -using namespace ::vos; using namespace ::cppu; -SvxUnoForbiddenCharsTable::SvxUnoForbiddenCharsTable(ORef<SvxForbiddenCharactersTable> xForbiddenChars) : +SvxUnoForbiddenCharsTable::SvxUnoForbiddenCharsTable(::rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars) : mxForbiddenChars( xForbiddenChars ) { } @@ -58,9 +58,9 @@ void SvxUnoForbiddenCharsTable::onChange() ForbiddenCharacters SvxUnoForbiddenCharsTable::getForbiddenCharacters( const Locale& rLocale ) throw(NoSuchElementException, RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; - if(!mxForbiddenChars.isValid()) + if(!mxForbiddenChars.is()) throw RuntimeException(); const LanguageType eLang = SvxLocaleToLanguage( rLocale ); @@ -74,9 +74,9 @@ ForbiddenCharacters SvxUnoForbiddenCharsTable::getForbiddenCharacters( const Loc sal_Bool SvxUnoForbiddenCharsTable::hasForbiddenCharacters( const Locale& rLocale ) throw(RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; - if(!mxForbiddenChars.isValid()) + if(!mxForbiddenChars.is()) return sal_False; const LanguageType eLang = SvxLocaleToLanguage( rLocale ); @@ -88,9 +88,9 @@ sal_Bool SvxUnoForbiddenCharsTable::hasForbiddenCharacters( const Locale& rLocal void SvxUnoForbiddenCharsTable::setForbiddenCharacters(const Locale& rLocale, const ForbiddenCharacters& rForbiddenCharacters ) throw(RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; - if(!mxForbiddenChars.isValid()) + if(!mxForbiddenChars.is()) throw RuntimeException(); const LanguageType eLang = SvxLocaleToLanguage( rLocale ); @@ -102,9 +102,9 @@ void SvxUnoForbiddenCharsTable::setForbiddenCharacters(const Locale& rLocale, co void SvxUnoForbiddenCharsTable::removeForbiddenCharacters( const Locale& rLocale ) throw(RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; - if(!mxForbiddenChars.isValid()) + if(!mxForbiddenChars.is()) throw RuntimeException(); const LanguageType eLang = SvxLocaleToLanguage( rLocale ); @@ -117,9 +117,9 @@ void SvxUnoForbiddenCharsTable::removeForbiddenCharacters( const Locale& rLocale Sequence< Locale > SAL_CALL SvxUnoForbiddenCharsTable::getLocales() throw(RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; - const sal_Int32 nCount = mxForbiddenChars.isValid() ? mxForbiddenChars->Count() : 0; + const sal_Int32 nCount = mxForbiddenChars.is() ? mxForbiddenChars->Count() : 0; Sequence< Locale > aLocales( nCount ); if( nCount ) @@ -139,7 +139,9 @@ Sequence< Locale > SAL_CALL SvxUnoForbiddenCharsTable::getLocales() sal_Bool SAL_CALL SvxUnoForbiddenCharsTable::hasLocale( const Locale& aLocale ) throw(RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return hasForbiddenCharacters( aLocale ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx index e8cd841e3157..01dd6dfee54e 100644 --- a/editeng/source/uno/unoedhlp.cxx +++ b/editeng/source/uno/unoedhlp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -123,7 +124,7 @@ void SvxEditSourceHint::SetEndValue( sal_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; } } @@ -184,14 +185,14 @@ 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; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 01c62014de7c..45abc3f4a459 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,7 @@ #include <limits.h> #include <vector> #include <algorithm> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/window.hxx> #include <vcl/svapp.hxx> #include <com/sun/star/uno/Any.hxx> @@ -1186,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( 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" ); } @@ -1314,3 +1315,4 @@ void SvxAccessibleTextEditViewAdapter::SetForwarder( SvxEditViewForwarder& mrTextForwarder = &rTextForwarder; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unoedsrc.cxx b/editeng/source/uno/unoedsrc.cxx index 06e0d7ac21c9..b245cc4d6c32 100644 --- a/editeng/source/uno/unoedsrc.cxx +++ b/editeng/source/uno/unoedsrc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -82,9 +83,11 @@ 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; return aBroadcaster; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unofdesc.cxx b/editeng/source/uno/unofdesc.cxx index bc2245e7e6a9..fc41fdaf2d85 100755..100644 --- a/editeng/source/uno/unofdesc.cxx +++ b/editeng/source/uno/unofdesc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,7 @@ #include <editeng/eeitem.hxx> #include <com/sun/star/uno/Any.hxx> -#ifndef _TOOLKIT_HELPRE_VCLUNOHELPER_HXX_ #include <toolkit/helper/vclunohelper.hxx> -#endif #include <editeng/fontitem.hxx> #include <editeng/fhgtitem.hxx> #include <editeng/postitem.hxx> @@ -264,3 +263,4 @@ uno::Any SvxUnoFontDescriptor::getPropertyDefault( SfxItemPool* pPool ) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index dbf52dddc757..d18c2992003e 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,10 +33,7 @@ #include <com/sun/star/lang/NoSupportException.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> - -#include <rtl/uuid.h> -#include <rtl/memory.h> +#include <osl/mutex.hxx> #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> @@ -43,9 +41,9 @@ #include <editeng/unofield.hxx> #include <editeng/unotext.hxx> #include <comphelper/serviceinfohelper.hxx> +#include <comphelper/servicehelper.hxx> using namespace ::rtl; -using namespace ::vos; using namespace ::cppu; using namespace ::com::sun::star; @@ -572,16 +570,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoTextField::getTypes() return maTypeSequence; } +namespace +{ + class theSvxUnoTextFieldImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextFieldImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextField::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextFieldImplementationId::get().getSeq(); } uno::Any SAL_CALL SvxUnoTextField::queryInterface( const uno::Type & rType ) @@ -604,7 +601,7 @@ void SAL_CALL SvxUnoTextField::release() throw( ) OUString SAL_CALL SvxUnoTextField::getPresentation( sal_Bool bShowCommand ) throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if(bShowCommand) { @@ -662,14 +659,14 @@ void SAL_CALL SvxUnoTextField::removeEventListener( const uno::Reference< lang:: uno::Reference< beans::XPropertySetInfo > SAL_CALL SvxUnoTextField::getPropertySetInfo( ) throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return mpPropSet->getPropertySetInfo(); } void SAL_CALL SvxUnoTextField::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( mpImpl == NULL ) throw uno::RuntimeException(); @@ -839,7 +836,7 @@ void SAL_CALL SvxUnoTextField::setPropertyValue( const OUString& aPropertyName, uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyName ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Any aValue; @@ -1104,8 +1101,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; } @@ -1178,3 +1175,5 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt return xRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index f7d7401d6a3f..b994e46c404d 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,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> @@ -53,7 +54,7 @@ SvxEditEngineForwarder::SvxEditEngineForwarder( EditEngine& rEngine ) : SvxEditEngineForwarder::~SvxEditEngineForwarder() { - // die EditEngine muss ggf. von aussen geloescht werden + // the EditEngine may need to be deleted from the outside } sal_uInt16 SvxEditEngineForwarder::GetParagraphCount() const @@ -90,7 +91,7 @@ SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, sal_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 ); @@ -427,7 +428,6 @@ OutputDevice* SvxEditEngineForwarder::GetRefDevice() 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, @@ -555,3 +555,5 @@ void SvxEditEngineForwarder::CopyText(const SvxTextForwarder& rSource) } //------------------------------------------------------------------------ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index 550e9d9482a1..8f3d7593efca 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -75,8 +76,8 @@ sal_uInt16 SvxOutlinerForwarder::GetTextLen( sal_uInt16 nParagraph ) const 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 ); } @@ -99,7 +100,7 @@ static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, sal_B 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 ); } @@ -127,8 +128,8 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, sal_Bool bO } } - //! 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 ) ); @@ -304,7 +305,6 @@ EBulletInfo SvxOutlinerForwarder::GetBulletInfo( sal_uInt16 nPara ) 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() ); @@ -357,7 +357,6 @@ Rectangle SvxOutlinerForwarder::GetParaBounds( sal_uInt16 nPara ) const if( rOutliner.IsVertical() ) { - // #101701# // Hargl. Outliner's 'external' methods return the rotated // dimensions, 'internal' methods like GetTextHeight( n ) // don't rotate. @@ -385,7 +384,6 @@ OutputDevice* SvxOutlinerForwarder::GetRefDevice() 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, @@ -510,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; } } @@ -523,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"); } } @@ -535,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; } } @@ -548,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"); } } @@ -613,3 +611,4 @@ void SvxTextForwarder::SetParaIsNumberingRestart( sal_uInt16, sal_Bool ) //------------------------------------------------------------------------ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index a1b276153d64..ff3fec8fcbf5 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,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> @@ -44,6 +43,8 @@ using namespace ::com::sun::star; using namespace ::rtl; +using ::std::vector; + //---------------------------------------------------------------------- struct SfxItemPropertyMapEntryHash @@ -59,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; } //---------------------------------------------------------------------- @@ -77,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; } @@ -94,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(); } //---------------------------------------------------------------------- @@ -164,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; @@ -176,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; } @@ -216,7 +207,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa if( pNewItem->PutValue( aValue, nMemberId ) ) { - // neues item in itemset setzen + // Set new item in item set rSet.Put( *pNewItem, pMap->nWID ); } delete pNewItem; @@ -226,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 - + // 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)); } @@ -343,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!"); } } } @@ -381,14 +369,15 @@ 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!"); } } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx index 28a0eb64c570..8861b6ca125a 100644 --- a/editeng/source/uno/unonrule.cxx +++ b/editeng/source/uno/unonrule.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,12 +35,10 @@ #include <com/sun/star/awt/XBitmap.hpp> #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/graph.hxx> #include <svtools/grfmgr.hxx> #include <toolkit/unohlp.hxx> -#include <rtl/uuid.h> -#include <rtl/memory.h> #include <editeng/brshitem.hxx> #include <editeng/unoprnms.hxx> @@ -56,7 +55,6 @@ using ::com::sun::star::util::XCloneable; using ::com::sun::star::ucb::XAnyCompare; -using namespace ::vos; using namespace ::std; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -115,7 +113,7 @@ SvxUnoNumberingRules::~SvxUnoNumberingRules() throw() void SAL_CALL SvxUnoNumberingRules::replaceByIndex( sal_Int32 Index, const uno::Any& Element ) throw( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( Index < 0 || Index >= maRule.GetLevelCount() ) throw IndexOutOfBoundsException(); @@ -130,7 +128,7 @@ void SAL_CALL SvxUnoNumberingRules::replaceByIndex( sal_Int32 Index, const uno:: // XIndexAccess sal_Int32 SAL_CALL SvxUnoNumberingRules::getCount() throw( RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return maRule.GetLevelCount(); } @@ -138,7 +136,7 @@ sal_Int32 SAL_CALL SvxUnoNumberingRules::getCount() throw( RuntimeException ) Any SAL_CALL SvxUnoNumberingRules::getByIndex( sal_Int32 Index ) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( Index < 0 || Index >= maRule.GetLevelCount() ) throw IndexOutOfBoundsException(); @@ -279,7 +277,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; @@ -613,3 +611,5 @@ Reference< XAnyCompare > SvxCreateNumRuleCompare() throw() SvxNumRule aTempRule( 0, 10, false ); return SvxCreateNumRule( &aTempRule ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unopracc.cxx b/editeng/source/uno/unopracc.cxx index 93acde6de73b..088cdbbc3ff7 100644 --- a/editeng/source/uno/unopracc.cxx +++ b/editeng/source/uno/unopracc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,12 +34,13 @@ // Global header // //------------------------------------------------------------------------ -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Reference.hxx> #include <cppuhelper/weakref.hxx> #include <com/sun/star/lang/XComponent.hpp> #include <cppuhelper/typeprovider.hxx> +#include <comphelper/servicehelper.hxx> //------------------------------------------------------------------------ @@ -126,16 +128,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxAccessibleTextPropertySet::getTypes() thr return pTypeCollection->getTypes() ; } +namespace +{ + class theSvxAccessibleTextPropertySetImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxAccessibleTextPropertySetImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvxAccessibleTextPropertySet::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* > (aId.getArray()), 0, sal_True ); - } - return aId; + return theSvxAccessibleTextPropertySetImplementationId::get().getSeq(); } // XServiceInfo @@ -169,3 +170,4 @@ uno::Sequence< ::rtl::OUString> SAL_CALL SvxAccessibleTextPropertySet::getSuppor } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index f62000e0d0f8..0d097884b588 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,13 +33,12 @@ #include <com/sun/star/text/ControlCharacter.hpp> #include <com/sun/star/text/ControlCharacter.hpp> #include <com/sun/star/text/XTextField.hdl> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <svl/itemset.hxx> #include <svl/itempool.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> -#include <rtl/uuid.h> -#include <rtl/memory.h> +#include <rtl/instance.hxx> #include <editeng/fontitem.hxx> #include <editeng/tstpitem.hxx> @@ -54,9 +54,9 @@ #include <editeng/outliner.hxx> #include <editeng/unoipset.hxx> #include <comphelper/serviceinfohelper.hxx> +#include <comphelper/servicehelper.hxx> using namespace ::rtl; -using namespace ::vos; using namespace ::cppu; using namespace ::com::sun::star; @@ -72,7 +72,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 +101,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 +122,7 @@ const SfxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSfxPropertySet() } // ==================================================================== -// helper fuer Item/Property Konvertierung +// helper for Item/Property conversion // ==================================================================== void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw() @@ -191,71 +191,17 @@ 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() : mpPropSet(_pSet) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!"); @@ -268,9 +214,6 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const Sv mpEditSource->addRange( this ); } -#ifdef DEBUG - gNumRanges.add(this); -#endif } SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw() @@ -284,7 +227,7 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) th , lang::XUnoTunnel() , mpPropSet(rRange.getPropertySet()) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; mpEditSource = rRange.mpEditSource ? rRange.mpEditSource->Clone() : NULL; @@ -297,18 +240,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 ); @@ -332,7 +267,7 @@ void SvxUnoTextRangeBase::SetEditSource( SvxEditSource* pSource ) throw() corresponding with this range */ void SvxUnoTextRangeBase::attachField( const SvxFieldData* pData ) throw() { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( pData ) { @@ -347,7 +282,7 @@ void SvxUnoTextRangeBase::attachField( const SvxFieldData* pData ) throw() void SvxUnoTextRangeBase::SetSelection( const ESelection& rSelection ) throw() { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; maSelection = rSelection; if (mpEditSource != NULL) @@ -359,7 +294,7 @@ void SvxUnoTextRangeBase::SetSelection( const ESelection& rSelection ) throw() uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart(void) throw( uno::RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Reference< text::XTextRange > xRange; @@ -389,7 +324,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart(void) uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd(void) throw( uno::RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Reference< text::XTextRange > xRet; @@ -417,7 +352,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd(void) OUString SAL_CALL SvxUnoTextRangeBase::getString(void) throw( uno::RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL; if( pForwarder ) @@ -436,7 +371,7 @@ OUString SAL_CALL SvxUnoTextRangeBase::getString(void) void SAL_CALL SvxUnoTextRangeBase::setString(const OUString& aString) throw( uno::RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL; if( pForwarder ) @@ -444,14 +379,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(); @@ -476,7 +411,7 @@ void SAL_CALL SvxUnoTextRangeBase::setPropertyValue(const OUString& PropertyName void SAL_CALL SvxUnoTextRangeBase::_setPropertyValue( const OUString& PropertyName, const uno::Any& aValue, sal_Int32 nPara ) throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL; if( pForwarder ) @@ -538,9 +473,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 ); } } @@ -642,7 +577,7 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyValue(const OUString& Property uno::Any SAL_CALL SvxUnoTextRangeBase::_getPropertyValue(const OUString& PropertyName, sal_Int32 nPara ) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Any aAny; @@ -658,7 +593,7 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::_getPropertyValue(const OUString& Propert 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 +724,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) {} @@ -803,7 +738,7 @@ void SAL_CALL SvxUnoTextRangeBase::setPropertyValues( const uno::Sequence< ::rtl void SAL_CALL SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues, sal_Int32 nPara ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL; if( pForwarder ) @@ -927,7 +862,7 @@ uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::getPropertyValues( const uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::_getPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, sal_Int32 nPara ) throw (uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int32 nCount = aPropertyNames.getLength(); @@ -1081,7 +1016,7 @@ beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const SfxIt beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const OUString& PropertyName, sal_Int32 nPara /* = -1 */) throw( beans::UnknownPropertyException, uno::RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return _getPropertyState( mpPropSet->getPropertyMapEntry( PropertyName ), nPara); } @@ -1232,7 +1167,7 @@ void SAL_CALL SvxUnoTextRangeBase::setPropertyToDefault( const OUString& Propert void SvxUnoTextRangeBase::_setPropertyToDefault(const OUString& PropertyName, sal_Int32 nPara /* = -1 */) throw( beans::UnknownPropertyException, uno::RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL; @@ -1295,7 +1230,7 @@ void SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, co uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aPropertyName ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL; if( pForwarder ) @@ -1324,7 +1259,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); @@ -1341,7 +1276,7 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aProp // beans::XMultiPropertyStates void SAL_CALL SvxUnoTextRangeBase::setAllPropertiesToDefault( ) throw (uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL; @@ -1422,7 +1357,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 +1386,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 +1523,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,37 +1584,48 @@ 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(); +} + +namespace +{ + class theSvxUnoTextRangeImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextRangeImplementationId > {}; } uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextRange::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextRangeImplementationId::get().getSeq(); } // XTextRange @@ -1702,10 +1646,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 +1698,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 +1737,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() @@ -1830,16 +1780,15 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getTypes() return getStaticTypes(); } +namespace +{ + class theSvxUnoTextBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextBaseImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextBase::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextBaseImplementationId::get().getSeq(); } uno::Reference< text::XTextCursor > SvxUnoTextBase::createTextCursorBySelection( const ESelection& rSel ) @@ -1855,14 +1804,14 @@ uno::Reference< text::XTextCursor > SvxUnoTextBase::createTextCursorBySelection( uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursor() throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return new SvxUnoTextCursor( *this ); } uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursorByRange( const uno::Reference< text::XTextRange >& aTextPosition ) throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Reference< text::XTextCursor > xCursor; @@ -1879,7 +1828,7 @@ uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursorByR void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb ) throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( !xRange.is() ) return; @@ -1891,11 +1840,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 ); @@ -1907,7 +1857,7 @@ void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRan void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb ) throw(lang::IllegalArgumentException, uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL; @@ -1921,7 +1871,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; @@ -1995,7 +1945,7 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTextRange >& xRange, const uno::Reference< text::XTextContent >& xContent, sal_Bool bAbsorb ) throw(lang::IllegalArgumentException, uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL; if( pForwarder ) @@ -2042,7 +1992,7 @@ void SAL_CALL SvxUnoTextBase::removeTextContent( const uno::Reference< text::XTe uno::Reference< text::XText > SAL_CALL SvxUnoTextBase::getText() throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (GetEditSource()) { @@ -2081,7 +2031,7 @@ void SAL_CALL SvxUnoTextBase::setString( const OUString& aString ) throw(uno::Ru uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextBase::createEnumeration() throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ESelection aSelection; ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() ); @@ -2099,7 +2049,7 @@ uno::Type SAL_CALL SvxUnoTextBase::getElementType( ) throw(uno::RuntimeExceptio sal_Bool SAL_CALL SvxUnoTextBase::hasElements( ) throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if(GetEditSource()) { @@ -2195,7 +2145,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendParagraph( const uno::Sequence< beans::PropertyValue >& rCharAndParaProps ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Reference< text::XTextRange > xRet; SvxEditSource *pEditSource = GetEditSource(); SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0; @@ -2225,7 +2175,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph( const uno::Sequence< beans::PropertyValue >& rCharAndParaProps ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Reference< text::XTextRange > xRet; SvxEditSource *pEditSource = GetEditSource(); @@ -2257,7 +2207,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion( const uno::Sequence< beans::PropertyValue >& rCharAndParaProps ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvxEditSource *pEditSource = GetEditSource(); SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0; @@ -2290,13 +2240,11 @@ 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 ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Reference< lang::XUnoTunnel > xUT( xSource, uno::UNO_QUERY ); SvxEditSource *pEditSource = GetEditSource(); SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0; @@ -2345,20 +2293,14 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames_Stat return aSeq; } +namespace +{ + class theSvxUnoTextBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextBaseUnoTunnelId > {}; +} + const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() throw() { - static uno::Sequence< sal_Int8 > * pSeq = 0; - if( !pSeq ) - { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; + return theSvxUnoTextBaseUnoTunnelId::get().getSeq(); } SvxUnoTextBase* SvxUnoTextBase::getImplementation( const uno::Reference< uno::XInterface >& xInt ) @@ -2445,15 +2387,14 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoText::getTypes( ) throw( uno::Runtime return SvxUnoTextBase::getTypes(); } +namespace +{ + class theSvxUnoTextImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvxUnoText::getImplementationId( ) throw( uno::RuntimeException ) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextImplementationId::get().getSeq(); } SvxUnoText* SvxUnoText::getImplementation( const uno::Reference< uno::XInterface >& xInt ) @@ -2465,20 +2406,14 @@ SvxUnoText* SvxUnoText::getImplementation( const uno::Reference< uno::XInterface return NULL; } +namespace +{ + class theSvxUnoTextUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextUnoTunnelId > {}; +} + const uno::Sequence< sal_Int8 > & SvxUnoText::getUnoTunnelId() throw() { - static uno::Sequence< sal_Int8 > * pSeq = 0; - if( !pSeq ) - { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; + return theSvxUnoTextUnoTunnelId::get().getSeq(); } sal_Int64 SAL_CALL SvxUnoText::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) \ @@ -2532,7 +2467,7 @@ String SvxDummyTextSource::GetText( const ESelection& ) 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()); @@ -2722,3 +2657,4 @@ void SvxDummyTextSource::CopyText(const SvxTextForwarder& ) { } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index 97895848b798..af227be6b673 100644 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,22 +29,20 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_editeng.hxx" #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> +#include <rtl/instance.hxx> #define _SVSTDARR_sal_uIt16S #include <svl/svstdarr.hxx> -#include <rtl/uuid.h> -#include <rtl/memory.h> - #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> #include <editeng/unofield.hxx> #include <editeng/unotext.hxx> #include <comphelper/serviceinfohelper.hxx> +#include <comphelper/servicehelper.hxx> using namespace ::rtl; -using namespace ::vos; using namespace ::cppu; using namespace ::com::sun::star; @@ -75,7 +74,7 @@ SvxUnoTextContentEnumeration::~SvxUnoTextContentEnumeration() throw() sal_Bool SAL_CALL SvxUnoTextContentEnumeration::hasMoreElements(void) throw( uno::RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( mpEditSource && mpEditSource->GetTextForwarder() ) return mnNextParagraph < mpEditSource->GetTextForwarder()->GetParagraphCount(); else @@ -84,7 +83,7 @@ sal_Bool SAL_CALL SvxUnoTextContentEnumeration::hasMoreElements(void) uno::Any SvxUnoTextContentEnumeration::nextElement(void) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if(!hasMoreElements()) throw container::NoSuchElementException(); @@ -93,7 +92,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 +112,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,39 +198,50 @@ 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(); +} + +namespace +{ + class theSvxUnoTextContentImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextContentImplementationId > {}; } uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextContent::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextContentImplementationId::get().getSeq(); } // text::XTextRange @@ -259,7 +268,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextContent::getAnchor() throw void SAL_CALL SvxUnoTextContent::dispose() throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( mbDisposing ) return; // catched a recursion @@ -291,7 +300,7 @@ void SAL_CALL SvxUnoTextContent::removeEventListener( const uno::Reference< lang uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextContent::createEnumeration( ) throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return new SvxUnoTextRangeEnumeration( mrParentText, mnParagraph ); } @@ -307,7 +316,7 @@ uno::Type SAL_CALL SvxUnoTextContent::getElementType() sal_Bool SAL_CALL SvxUnoTextContent::hasElements() throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL; if( pForwarder ) @@ -437,7 +446,7 @@ SvxUnoTextRangeEnumeration::~SvxUnoTextRangeEnumeration() throw() sal_Bool SAL_CALL SvxUnoTextRangeEnumeration::hasMoreElements() throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return mpPortions && mnNextPortion < mpPortions->Count(); } @@ -445,7 +454,7 @@ sal_Bool SAL_CALL SvxUnoTextRangeEnumeration::hasMoreElements() uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement() throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( mpPortions == NULL || mnNextPortion >= mpPortions->Count() ) throw container::NoSuchElementException(); @@ -463,7 +472,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 +496,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 +523,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,88 +560,99 @@ 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(); +} + +namespace +{ + class theSvxUnoTextCursorImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextCursorImplementationId > {}; } uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextCursor::getImplementationId() throw (uno::RuntimeException) { - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvxUnoTextCursorImplementationId::get().getSeq(); } // text::XTextCursor void SAL_CALL SvxUnoTextCursor::collapseToStart() throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; CollapseToStart(); } void SAL_CALL SvxUnoTextCursor::collapseToEnd() throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; CollapseToEnd(); } sal_Bool SAL_CALL SvxUnoTextCursor::isCollapsed() throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return IsCollapsed(); } sal_Bool SAL_CALL SvxUnoTextCursor::goLeft( sal_Int16 nCount, sal_Bool bExpand ) throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return GoLeft( nCount, bExpand ); } sal_Bool SAL_CALL SvxUnoTextCursor::goRight( sal_Int16 nCount, sal_Bool bExpand ) throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return GoRight( nCount, bExpand ); } void SAL_CALL SvxUnoTextCursor::gotoStart( sal_Bool bExpand ) throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; GotoStart( bExpand ); } void SAL_CALL SvxUnoTextCursor::gotoEnd( sal_Bool bExpand ) throw(uno::RuntimeException) { - OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; GotoEnd( bExpand ); } @@ -709,3 +728,4 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextCursor::getSupportedServiceNames() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unoviwed.cxx b/editeng/source/uno/unoviwed.cxx index 5a31863ff9cd..5a7d8591389a 100644 --- a/editeng/source/uno/unoviwed.cxx +++ b/editeng/source/uno/unoviwed.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -135,3 +136,5 @@ sal_Bool SvxEditEngineViewForwarder::Paste() mrView.Paste(); return sal_True; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unoviwou.cxx b/editeng/source/uno/unoviwou.cxx index e70273d32290..7184095ae575 100644 --- a/editeng/source/uno/unoviwou.cxx +++ b/editeng/source/uno/unoviwou.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,7 @@ 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; @@ -69,7 +70,6 @@ Rectangle SvxDrawOutlinerViewForwarder::GetVisArea() const { Rectangle aVisArea = mrOutlinerView.GetVisArea(); - // #101029# Point aTextOffset( GetTextOffset() ); aVisArea.Move( aTextOffset.X(), aTextOffset.Y() ); @@ -99,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(); @@ -125,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(); @@ -171,3 +169,5 @@ void SvxDrawOutlinerViewForwarder::SetShapePos( const Point& rShapePosTopLeft ) { maTextShapeTopLeft = rShapePosTopLeft; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/xml/editsource.hxx b/editeng/source/xml/editsource.hxx index 5ea1f9296b11..4141bca34935 100644 --- a/editeng/source/xml/editsource.hxx +++ b/editeng/source/xml/editsource.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,3 +51,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx index e7d0327c059e..255a69c3df7b 100644 --- a/editeng/source/xml/xmltxtexp.cxx +++ b/editeng/source/xml/xmltxtexp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -357,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, @@ -380,7 +380,6 @@ private: /////////////////////////////////////////////////////////////////////// -// #110680# SvxXMLTextExportComponent::SvxXMLTextExportComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, EditEngine* pEditEngine, @@ -429,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; } @@ -439,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; } @@ -462,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 ); @@ -477,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"); } } @@ -498,3 +496,5 @@ void SvxXMLTextExportComponent::_ExportContent() } void SvxXMLTextExportComponent::_ExportMasterStyles() {} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx index 6fa3e10a6436..9596c2503979 100644 --- a/editeng/source/xml/xmltxtimp.cxx +++ b/editeng/source/xml/xmltxtimp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -118,7 +119,6 @@ SvXMLImportContext *SvxXMLTextImportContext::CreateChildContext( sal_uInt16 nPre class SvxXMLXTextImportComponent : public SvXMLImport { public: - // #110680# SvxXMLXTextImportComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, const uno::Reference< XText > & xText ); @@ -135,7 +135,6 @@ private: // -------------------------------------------------------------------- -// #110680# SvxXMLXTextImportComponent::SvxXMLXTextImportComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, const uno::Reference< XText > & xText ) @@ -175,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; } @@ -199,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; } @@ -226,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 ) ); @@ -258,3 +256,4 @@ SvXMLImportContext *SvxXMLXTextImportComponent::CreateChildContext( sal_uInt16 n return pContext; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/util/editeng.dxp b/editeng/util/editeng.dxp index f0e1c69934bc..f0e1c69934bc 100644..100755 --- a/editeng/util/editeng.dxp +++ b/editeng/util/editeng.dxp diff --git a/editeng/util/hidother.src b/editeng/util/hidother.src index 6f3b2285f845..0203afa929c3 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 new file mode 100644 index 000000000000..80c8939b1bbe --- /dev/null +++ b/editeng/util/makefile.mk @@ -0,0 +1,98 @@ +#************************************************************************* +# +# 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 +# +# 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=editeng +GEN_HID=TRUE +GEN_HID_OTHER=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# ------------- + +HELPIDFILES= ..$/inc$/helpid.hrc + +# editeng +SHL1TARGET= editeng$(DLLPOSTFIX) +SHL1IMPLIB= iediteng +SHL1USE_EXPORTS=name +SHL1LIBS= \ + $(SLB)$/items.lib \ + $(SLB)$/misc.lib \ + $(SLB)$/rtf.lib \ + $(SLB)$/uno.lib \ + $(SLB)$/accessibility.lib \ + $(SLB)$/editeng.lib \ + $(SLB)$/outliner.lib \ + $(SLB)$/xml.lib + +SHL1STDLIBS= \ + $(XMLOFFLIB) \ + $(BASEGFXLIB) \ + $(LNGLIB) \ + $(SVTOOLLIB) \ + $(TKLIB) \ + $(VCLLIB) \ + $(SVLLIB) \ + $(SOTLIB) \ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(I18NISOLANGLIB) \ + $(I18NPAPERLIB) \ + $(COMPHELPERLIB) \ + $(UCBHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) \ + $(SALHELPERLIB) \ + $(ICUUCLIB) + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME= $(SHL1TARGET) +DEFLIB1NAME=$(TARGET) + +# ------------------------------------------------------------------------------ + +# Resource files +SRSFILELIST=\ + $(SRS)$/editeng.srs \ + $(SRS)$/outliner.srs \ + $(SRS)$/misc.srs \ + $(SRS)$/items.srs + +RESLIB1NAME=editeng +RESLIB1IMAGES=$(PRJ)$/res $(PRJ)$/source/svdraw +RESLIB1SRSFILES= $(SRSFILELIST) + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + |