summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
Diffstat (limited to 'editeng')
-rw-r--r--editeng/AllLangResTarget_editeng.mk51
-rw-r--r--editeng/CppunitTest_editeng_borderline.mk72
-rw-r--r--editeng/Library_editeng.mk165
-rwxr-xr-xediteng/Makefile39
-rw-r--r--editeng/Module_editeng.mk47
-rw-r--r--editeng/Package_inc.mk156
-rwxr-xr-xediteng/inc/editeng.hrc43
-rw-r--r--editeng/inc/editeng/AccessibleComponentBase.hxx150
-rw-r--r--editeng/inc/editeng/AccessibleContextBase.hxx402
-rw-r--r--editeng/inc/editeng/AccessibleEditableTextPara.hxx420
-rw-r--r--editeng/inc/editeng/AccessibleImageBullet.hxx237
-rw-r--r--editeng/inc/editeng/AccessibleParaManager.hxx349
-rw-r--r--editeng/inc/editeng/AccessibleSelectionBase.hxx76
-rw-r--r--editeng/inc/editeng/AccessibleStaticTextBase.hxx283
-rw-r--r--editeng/inc/editeng/AccessibleStringWrap.hxx66
-rw-r--r--editeng/inc/editeng/SpellPortions.hxx98
-rw-r--r--editeng/inc/editeng/UnoForbiddenCharsTable.hxx68
-rw-r--r--editeng/inc/editeng/acorrcfg.hxx132
-rw-r--r--editeng/inc/editeng/adjitem.hxx145
-rw-r--r--editeng/inc/editeng/akrnitem.hxx76
-rw-r--r--editeng/inc/editeng/blnkitem.hxx74
-rw-r--r--editeng/inc/editeng/bolnitem.hxx88
-rw-r--r--editeng/inc/editeng/borderline.hxx180
-rw-r--r--editeng/inc/editeng/boxitem.hxx227
-rw-r--r--editeng/inc/editeng/brkitem.hxx105
-rw-r--r--editeng/inc/editeng/brshitem.hxx140
-rw-r--r--editeng/inc/editeng/bulitem.hxx164
-rw-r--r--editeng/inc/editeng/charhiddenitem.hxx64
-rw-r--r--editeng/inc/editeng/charreliefitem.hxx79
-rw-r--r--editeng/inc/editeng/charrotateitem.hxx92
-rw-r--r--editeng/inc/editeng/charscaleitem.hxx78
-rw-r--r--editeng/inc/editeng/cmapitem.hxx91
-rw-r--r--editeng/inc/editeng/cntritem.hxx69
-rw-r--r--editeng/inc/editeng/colritem.hxx97
-rw-r--r--editeng/inc/editeng/crsditem.hxx94
-rw-r--r--editeng/inc/editeng/cscoitem.hxx77
-rw-r--r--editeng/inc/editeng/editdata.hxx391
-rw-r--r--editeng/inc/editeng/editeng.hxx496
-rwxr-xr-xediteng/inc/editeng/editengdllapi.h43
-rw-r--r--editeng/inc/editeng/editerr.hxx39
-rwxr-xr-xediteng/inc/editeng/editids.hrc246
-rw-r--r--editeng/inc/editeng/editobj.hxx129
-rwxr-xr-xediteng/inc/editeng/editrids.hrc406
-rw-r--r--editeng/inc/editeng/editstat.hxx152
-rw-r--r--editeng/inc/editeng/editund2.hxx78
-rw-r--r--editeng/inc/editeng/editview.hxx250
-rw-r--r--editeng/inc/editeng/edtdlg.hxx113
-rw-r--r--editeng/inc/editeng/eedata.hxx77
-rw-r--r--editeng/inc/editeng/eeitem.hxx104
-rw-r--r--editeng/inc/editeng/eeitemid.hxx138
-rw-r--r--editeng/inc/editeng/eerdll.hxx64
-rw-r--r--editeng/inc/editeng/emphitem.hxx88
-rw-r--r--editeng/inc/editeng/escpitem.hxx116
-rw-r--r--editeng/inc/editeng/fhgtitem.hxx118
-rw-r--r--editeng/inc/editeng/flditem.hxx429
-rw-r--r--editeng/inc/editeng/flstitem.hxx81
-rw-r--r--editeng/inc/editeng/fontitem.hxx113
-rw-r--r--editeng/inc/editeng/forbiddencharacterstable.hxx70
-rw-r--r--editeng/inc/editeng/forbiddenruleitem.hxx71
-rw-r--r--editeng/inc/editeng/frmdir.hxx62
-rw-r--r--editeng/inc/editeng/frmdiritem.hxx80
-rw-r--r--editeng/inc/editeng/fwdtitem.hxx110
-rw-r--r--editeng/inc/editeng/hangulhanja.hxx305
-rw-r--r--editeng/inc/editeng/hngpnctitem.hxx71
-rw-r--r--editeng/inc/editeng/hyznitem.hxx108
-rw-r--r--editeng/inc/editeng/itemtype.hxx77
-rw-r--r--editeng/inc/editeng/justifyitem.hxx130
-rw-r--r--editeng/inc/editeng/keepitem.hxx80
-rw-r--r--editeng/inc/editeng/kernitem.hxx82
-rw-r--r--editeng/inc/editeng/langitem.hxx86
-rw-r--r--editeng/inc/editeng/lcolitem.hxx66
-rw-r--r--editeng/inc/editeng/lrspitem.hxx180
-rw-r--r--editeng/inc/editeng/lspcitem.hxx122
-rw-r--r--editeng/inc/editeng/measfld.hxx66
-rwxr-xr-xediteng/inc/editeng/memberids.hrc197
-rw-r--r--editeng/inc/editeng/mutxhelp.hxx46
-rw-r--r--editeng/inc/editeng/nhypitem.hxx64
-rw-r--r--editeng/inc/editeng/nlbkitem.hxx68
-rw-r--r--editeng/inc/editeng/numdef.hxx32
-rw-r--r--editeng/inc/editeng/numitem.hxx367
-rw-r--r--editeng/inc/editeng/opaqitem.hxx83
-rw-r--r--editeng/inc/editeng/optitems.hxx113
-rw-r--r--editeng/inc/editeng/orphitem.hxx76
-rw-r--r--editeng/inc/editeng/outliner.hxx1066
-rw-r--r--editeng/inc/editeng/outlobj.hxx99
-rw-r--r--editeng/inc/editeng/paperinf.hxx76
-rw-r--r--editeng/inc/editeng/paragraphdata.hxx75
-rw-r--r--editeng/inc/editeng/paravertalignitem.hxx80
-rw-r--r--editeng/inc/editeng/pbinitem.hxx79
-rw-r--r--editeng/inc/editeng/pgrditem.hxx66
-rw-r--r--editeng/inc/editeng/pmdlitem.hxx88
-rw-r--r--editeng/inc/editeng/postitem.hxx91
-rw-r--r--editeng/inc/editeng/prntitem.hxx81
-rw-r--r--editeng/inc/editeng/protitem.hxx106
-rw-r--r--editeng/inc/editeng/prszitem.hxx70
-rw-r--r--editeng/inc/editeng/scriptspaceitem.hxx72
-rw-r--r--editeng/inc/editeng/scripttypeitem.hxx93
-rw-r--r--editeng/inc/editeng/shaditem.hxx113
-rw-r--r--editeng/inc/editeng/shdditem.hxx76
-rw-r--r--editeng/inc/editeng/sizeitem.hxx85
-rw-r--r--editeng/inc/editeng/spltitem.hxx83
-rw-r--r--editeng/inc/editeng/splwrap.hxx163
-rw-r--r--editeng/inc/editeng/svxacorr.hxx403
-rw-r--r--editeng/inc/editeng/svxenum.hxx228
-rw-r--r--editeng/inc/editeng/svxfont.hxx131
-rw-r--r--editeng/inc/editeng/svxrtf.hxx483
-rw-r--r--editeng/inc/editeng/swafopt.hxx107
-rw-r--r--editeng/inc/editeng/tstpitem.hxx180
-rw-r--r--editeng/inc/editeng/twolinesitem.hxx90
-rw-r--r--editeng/inc/editeng/txtrange.hxx121
-rw-r--r--editeng/inc/editeng/udlnitem.hxx134
-rw-r--r--editeng/inc/editeng/ulspitem.hxx115
-rw-r--r--editeng/inc/editeng/unoedhlp.hxx191
-rw-r--r--editeng/inc/editeng/unoedprx.hxx182
-rw-r--r--editeng/inc/editeng/unoedsrc.hxx552
-rw-r--r--editeng/inc/editeng/unofdesc.hxx56
-rw-r--r--editeng/inc/editeng/unofield.hxx139
-rw-r--r--editeng/inc/editeng/unofored.hxx102
-rw-r--r--editeng/inc/editeng/unoforou.hxx131
-rw-r--r--editeng/inc/editeng/unoipset.hxx87
-rw-r--r--editeng/inc/editeng/unolingu.hxx235
-rw-r--r--editeng/inc/editeng/unonrule.hxx96
-rw-r--r--editeng/inc/editeng/unopracc.hxx75
-rw-r--r--editeng/inc/editeng/unoprnms.hxx378
-rw-r--r--editeng/inc/editeng/unotext.hxx673
-rw-r--r--editeng/inc/editeng/unoviwed.hxx64
-rw-r--r--editeng/inc/editeng/unoviwou.hxx70
-rw-r--r--editeng/inc/editeng/wghtitem.hxx91
-rw-r--r--editeng/inc/editeng/widwitem.hxx76
-rw-r--r--editeng/inc/editeng/writingmodeitem.hxx68
-rw-r--r--editeng/inc/editeng/wrlmitem.hxx77
-rw-r--r--editeng/inc/editeng/xmlcnitm.hxx93
-rw-r--r--editeng/inc/editxml.hxx45
-rwxr-xr-xediteng/inc/helpid.hrc57
-rw-r--r--editeng/inc/pch/precompiled_editeng.cxx31
-rw-r--r--editeng/inc/pch/precompiled_editeng.hxx889
-rw-r--r--editeng/prj/build.lst2
-rw-r--r--editeng/prj/d.lst0
-rwxr-xr-xediteng/prj/makefile.mk40
-rw-r--r--editeng/qa/items/borderline_test.cxx136
-rw-r--r--editeng/source/accessibility/AccessibleComponentBase.cxx240
-rw-r--r--editeng/source/accessibility/AccessibleContextBase.cxx708
-rw-r--r--editeng/source/accessibility/AccessibleEditableTextPara.cxx2305
-rw-r--r--editeng/source/accessibility/AccessibleHyperlink.cxx146
-rw-r--r--editeng/source/accessibility/AccessibleHyperlink.hxx81
-rw-r--r--editeng/source/accessibility/AccessibleImageBullet.cxx653
-rw-r--r--editeng/source/accessibility/AccessibleParaManager.cxx422
-rw-r--r--editeng/source/accessibility/AccessibleSelectionBase.cxx111
-rw-r--r--editeng/source/accessibility/AccessibleStaticTextBase.cxx1050
-rw-r--r--editeng/source/accessibility/AccessibleStringWrap.cxx103
-rw-r--r--editeng/source/accessibility/accessibility.src40
-rw-r--r--editeng/source/editeng/editattr.cxx446
-rw-r--r--editeng/source/editeng/editattr.hxx429
-rw-r--r--editeng/source/editeng/editdbg.cxx585
-rw-r--r--editeng/source/editeng/editdbg.hxx60
-rw-r--r--editeng/source/editeng/editdoc.cxx2294
-rw-r--r--editeng/source/editeng/editdoc.hxx827
-rw-r--r--editeng/source/editeng/editdoc2.cxx502
-rw-r--r--editeng/source/editeng/editeng.cxx2846
-rw-r--r--editeng/source/editeng/editeng.src124
-rw-r--r--editeng/source/editeng/editobj.cxx1594
-rw-r--r--editeng/source/editeng/editobj2.hxx305
-rw-r--r--editeng/source/editeng/editsel.cxx121
-rw-r--r--editeng/source/editeng/editsel.hxx72
-rw-r--r--editeng/source/editeng/editstt2.hxx132
-rw-r--r--editeng/source/editeng/editundo.cxx707
-rw-r--r--editeng/source/editeng/editundo.hxx318
-rw-r--r--editeng/source/editeng/editview.cxx1630
-rw-r--r--editeng/source/editeng/edtspell.cxx761
-rw-r--r--editeng/source/editeng/edtspell.hxx182
-rw-r--r--editeng/source/editeng/eehtml.cxx860
-rw-r--r--editeng/source/editeng/eehtml.hxx100
-rw-r--r--editeng/source/editeng/eeng_pch.cxx33
-rw-r--r--editeng/source/editeng/eeng_pch.hxx36
-rw-r--r--editeng/source/editeng/eeobj.cxx115
-rw-r--r--editeng/source/editeng/eeobj.hxx71
-rw-r--r--editeng/source/editeng/eerdll.cxx236
-rw-r--r--editeng/source/editeng/eerdll2.hxx64
-rw-r--r--editeng/source/editeng/eertfpar.cxx633
-rw-r--r--editeng/source/editeng/eertfpar.hxx128
-rw-r--r--editeng/source/editeng/impedit.cxx1992
-rw-r--r--editeng/source/editeng/impedit.hxx1222
-rw-r--r--editeng/source/editeng/impedit2.cxx4565
-rw-r--r--editeng/source/editeng/impedit3.cxx4653
-rw-r--r--editeng/source/editeng/impedit4.cxx3097
-rw-r--r--editeng/source/editeng/impedit5.cxx869
-rw-r--r--editeng/source/editeng/makefile.mk71
-rw-r--r--editeng/source/editeng/textconv.cxx602
-rw-r--r--editeng/source/editeng/textconv.hxx124
-rw-r--r--editeng/source/items/borderline.cxx495
-rw-r--r--editeng/source/items/bulitem.cxx532
-rw-r--r--editeng/source/items/charhiddenitem.cxx77
-rw-r--r--editeng/source/items/flditem.cxx1052
-rw-r--r--editeng/source/items/frmitems.cxx4224
-rw-r--r--editeng/source/items/itemtype.cxx232
-rw-r--r--editeng/source/items/justifyitem.cxx461
-rw-r--r--editeng/source/items/makefile.mk67
-rw-r--r--editeng/source/items/numitem.cxx960
-rw-r--r--editeng/source/items/optitems.cxx205
-rw-r--r--editeng/source/items/page.src107
-rw-r--r--editeng/source/items/paperinf.cxx141
-rw-r--r--editeng/source/items/paraitem.cxx1705
-rw-r--r--editeng/source/items/svdfield.cxx65
-rw-r--r--editeng/source/items/svxfont.cxx809
-rw-r--r--editeng/source/items/svxitems.src1067
-rw-r--r--editeng/source/items/textitem.cxx3754
-rw-r--r--editeng/source/items/writingmodeitem.cxx155
-rw-r--r--editeng/source/items/xmlcnitm.cxx243
-rw-r--r--editeng/source/misc/SvXMLAutoCorrectExport.cxx118
-rw-r--r--editeng/source/misc/SvXMLAutoCorrectExport.hxx76
-rw-r--r--editeng/source/misc/SvXMLAutoCorrectImport.cxx263
-rw-r--r--editeng/source/misc/SvXMLAutoCorrectImport.hxx146
-rw-r--r--editeng/source/misc/acorrcfg.cxx661
-rw-r--r--editeng/source/misc/edtdlg.cxx43
-rw-r--r--editeng/source/misc/forbiddencharacterstable.cxx95
-rw-r--r--editeng/source/misc/hangulhanja.cxx1084
-rw-r--r--editeng/source/misc/lingu.src104
-rw-r--r--editeng/source/misc/splwrap.cxx623
-rw-r--r--editeng/source/misc/svxacorr.cxx2692
-rw-r--r--editeng/source/misc/swafopt.cxx156
-rw-r--r--editeng/source/misc/txtrange.cxx672
-rw-r--r--editeng/source/misc/unolingu.cxx1309
-rw-r--r--editeng/source/outliner/outl_pch.cxx33
-rw-r--r--editeng/source/outliner/outl_pch.hxx36
-rw-r--r--editeng/source/outliner/outleeng.cxx222
-rw-r--r--editeng/source/outliner/outleeng.hxx100
-rw-r--r--editeng/source/outliner/outlin2.cxx819
-rw-r--r--editeng/source/outliner/outliner.cxx2193
-rw-r--r--editeng/source/outliner/outliner.src84
-rw-r--r--editeng/source/outliner/outlobj.cxx274
-rw-r--r--editeng/source/outliner/outlundo.cxx237
-rw-r--r--editeng/source/outliner/outlundo.hxx143
-rw-r--r--editeng/source/outliner/outlvw.cxx1715
-rw-r--r--editeng/source/outliner/paralist.cxx333
-rw-r--r--editeng/source/outliner/paralist.hxx85
-rw-r--r--editeng/source/rtf/rtfgrf.cxx548
-rw-r--r--editeng/source/rtf/rtfitem.cxx1923
-rw-r--r--editeng/source/rtf/svxrtf.cxx1433
-rw-r--r--editeng/source/uno/UnoForbiddenCharsTable.cxx147
-rw-r--r--editeng/source/uno/unoedhlp.cxx198
-rw-r--r--editeng/source/uno/unoedprx.cxx1318
-rw-r--r--editeng/source/uno/unoedsrc.cxx93
-rw-r--r--editeng/source/uno/unofdesc.cxx266
-rw-r--r--editeng/source/uno/unofield.cxx1179
-rw-r--r--editeng/source/uno/unofored.cxx559
-rw-r--r--editeng/source/uno/unoforou.cxx614
-rw-r--r--editeng/source/uno/unoipset.cxx383
-rw-r--r--editeng/source/uno/unonrule.cxx577
-rw-r--r--editeng/source/uno/unopracc.cxx173
-rw-r--r--editeng/source/uno/unotext.cxx2660
-rw-r--r--editeng/source/uno/unotext2.cxx731
-rw-r--r--editeng/source/uno/unoviwed.cxx140
-rw-r--r--editeng/source/uno/unoviwou.cxx173
-rw-r--r--editeng/source/xml/editsource.hxx55
-rw-r--r--editeng/source/xml/xmltxtexp.cxx500
-rw-r--r--editeng/source/xml/xmltxtimp.cxx259
-rwxr-xr-xediteng/util/editeng.dxp1
-rw-r--r--editeng/util/hidother.src49
-rw-r--r--editeng/util/makefile.mk98
259 files changed, 0 insertions, 104576 deletions
diff --git a/editeng/AllLangResTarget_editeng.mk b/editeng/AllLangResTarget_editeng.mk
deleted file mode 100644
index 9d29ee31f7..0000000000
--- a/editeng/AllLangResTarget_editeng.mk
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# 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_AllLangResTarget_AllLangResTarget,editeng))
-
-$(eval $(call gb_AllLangResTarget_set_reslocation,editeng,svx))
-
-$(eval $(call gb_AllLangResTarget_add_srs,editeng, editeng/res))
-$(eval $(call gb_SrsTarget_SrsTarget,editeng/res))
-
-$(eval $(call gb_SrsTarget_set_include,editeng/res,\
- $$(INCLUDE) \
- -I$(realpath $(SRCDIR)/editeng/inc) \
-))
-
-# add src files here (complete path relative to repository root)
-$(eval $(call gb_SrsTarget_add_files,editeng/res,\
- editeng/source/accessibility/accessibility.src \
- editeng/source/editeng/editeng.src \
- editeng/source/items/page.src \
- editeng/source/items/svxitems.src \
- editeng/source/misc/lingu.src \
- editeng/source/outliner/outliner.src \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/editeng/CppunitTest_editeng_borderline.mk b/editeng/CppunitTest_editeng_borderline.mk
deleted file mode 100644
index ab409d9dbc..0000000000
--- a/editeng/CppunitTest_editeng_borderline.mk
+++ /dev/null
@@ -1,72 +0,0 @@
-# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# 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 \
- i18nisolang1 \
- i18npaper \
- $(gb_STDLIBS) \
-))
-
-$(eval $(call gb_CppunitTest_use_externals,editeng_borderline,\
- icuuc \
-))
-
-$(eval $(call gb_CppunitTest_set_include,editeng_borderline,\
- $$(INCLUDE) \
- -I$(OUTDIR)/inc \
-))
-
-$(eval $(call gb_CppunitTest_add_api,editeng_borderline,\
- offapi \
- udkapi \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk
deleted file mode 100644
index c04e0d2460..0000000000
--- a/editeng/Library_editeng.mk
+++ /dev/null
@@ -1,165 +0,0 @@
-# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2011 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-$(eval $(call gb_Library_Library,editeng))
-
-$(eval $(call gb_Library_add_package_headers,editeng,editeng_inc))
-
-$(eval $(call gb_Library_add_precompiled_header,editeng,$(SRCDIR)/editeng/inc/pch/precompiled_editeng))
-
-$(eval $(call gb_Library_set_include,editeng,\
- $$(INCLUDE) \
- -I$(realpath $(SRCDIR)/editeng/inc/pch) \
- -I$(realpath $(SRCDIR)/editeng/inc) \
-))
-
-$(eval $(call gb_Library_add_defs,editeng,\
- -DEDITENG_DLLIMPLEMENTATION \
-))
-
-$(eval $(call gb_Library_add_api,editeng,\
- udkapi \
- offapi \
-))
-
-$(eval $(call gb_Library_add_exception_objects,editeng,\
- editeng/inc/pch/precompiled_editeng \
- editeng/source/accessibility/AccessibleComponentBase \
- editeng/source/accessibility/AccessibleContextBase \
- editeng/source/accessibility/AccessibleEditableTextPara \
- editeng/source/accessibility/AccessibleHyperlink \
- editeng/source/accessibility/AccessibleImageBullet \
- editeng/source/accessibility/AccessibleParaManager \
- editeng/source/accessibility/AccessibleSelectionBase \
- editeng/source/accessibility/AccessibleStaticTextBase \
- editeng/source/accessibility/AccessibleStringWrap \
- editeng/source/editeng/editattr \
- editeng/source/editeng/editdbg \
- editeng/source/editeng/editdoc \
- editeng/source/editeng/editdoc2 \
- editeng/source/editeng/editeng \
- editeng/source/editeng/editobj \
- editeng/source/editeng/editsel \
- editeng/source/editeng/editundo \
- editeng/source/editeng/editview \
- editeng/source/editeng/edtspell \
- editeng/source/editeng/eehtml \
- editeng/source/editeng/eeng_pch \
- editeng/source/editeng/eeobj \
- editeng/source/editeng/eerdll \
- editeng/source/editeng/eertfpar \
- editeng/source/editeng/impedit \
- editeng/source/editeng/impedit2 \
- editeng/source/editeng/impedit3 \
- editeng/source/editeng/impedit4 \
- editeng/source/editeng/impedit5 \
- editeng/source/editeng/textconv \
- editeng/source/items/borderline \
- editeng/source/items/bulitem \
- editeng/source/items/charhiddenitem \
- editeng/source/items/flditem \
- editeng/source/items/frmitems \
- editeng/source/items/itemtype \
- editeng/source/items/justifyitem \
- editeng/source/items/numitem \
- editeng/source/items/optitems \
- editeng/source/items/paperinf \
- editeng/source/items/paraitem \
- editeng/source/items/svdfield \
- editeng/source/items/svxfont \
- editeng/source/items/textitem \
- editeng/source/items/writingmodeitem \
- editeng/source/items/xmlcnitm \
- editeng/source/misc/acorrcfg \
- editeng/source/misc/edtdlg \
- editeng/source/misc/forbiddencharacterstable \
- editeng/source/misc/hangulhanja \
- editeng/source/misc/splwrap \
- editeng/source/misc/svxacorr \
- editeng/source/misc/SvXMLAutoCorrectExport \
- editeng/source/misc/SvXMLAutoCorrectImport \
- editeng/source/misc/swafopt \
- editeng/source/misc/txtrange \
- editeng/source/misc/unolingu \
- editeng/source/outliner/outleeng \
- editeng/source/outliner/outlin2 \
- editeng/source/outliner/outliner \
- editeng/source/outliner/outlobj \
- editeng/source/outliner/outlundo \
- editeng/source/outliner/outlvw \
- editeng/source/outliner/outl_pch \
- editeng/source/outliner/paralist \
- editeng/source/rtf/rtfgrf \
- editeng/source/rtf/rtfitem \
- editeng/source/rtf/svxrtf \
- editeng/source/uno/unoedhlp \
- editeng/source/uno/unoedprx \
- editeng/source/uno/unoedsrc \
- editeng/source/uno/unofdesc \
- editeng/source/uno/unofield \
- editeng/source/uno/UnoForbiddenCharsTable \
- editeng/source/uno/unofored \
- editeng/source/uno/unoforou \
- editeng/source/uno/unoipset \
- editeng/source/uno/unonrule \
- editeng/source/uno/unopracc \
- editeng/source/uno/unotext \
- editeng/source/uno/unotext2 \
- editeng/source/uno/unoviwed \
- editeng/source/uno/unoviwou \
- editeng/source/xml/xmltxtexp \
- editeng/source/xml/xmltxtimp \
-))
-
-# add libraries to be linked to editeng; again these names need to be given as
-# specified in Repository.mk
-$(eval $(call gb_Library_add_linked_libs,editeng,\
- xo \
- basegfx \
- lng \
- svt \
- tk \
- vcl \
- svl \
- sot \
- utl \
- tl \
- comphelper \
- ucbhelper \
- cppuhelper \
- cppu \
- sal \
- salhelper \
- i18nisolang1 \
- i18npaper \
- $(gb_STDLIBS) \
-))
-
-$(eval $(call gb_Library_use_external,editeng,icuuc))
-
-# vim: set noet sw=4 ts=4:
diff --git a/editeng/Makefile b/editeng/Makefile
deleted file mode 100755
index 8d71119918..0000000000
--- a/editeng/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# 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.
-#
-#*************************************************************************
-
-ifeq ($(strip $(SOLARENV)),)
-$(error No environment set!)
-endif
-
-gb_PARTIALBUILD := T
-GBUILDDIR := $(SOLARENV)/gbuild
-include $(GBUILDDIR)/gbuild.mk
-
-$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk)))
-
-# vim: set noet sw=4 ts=4:
diff --git a/editeng/Module_editeng.mk b/editeng/Module_editeng.mk
deleted file mode 100644
index 4666d9119f..0000000000
--- a/editeng/Module_editeng.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# 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_Module_Module,editeng))
-
-$(eval $(call gb_Module_add_targets,editeng,\
- AllLangResTarget_editeng \
- Library_editeng \
- Package_inc \
-))
-
-# 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
-$(eval $(call gb_Module_add_subsequentcheck_targets,editeng,\
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/editeng/Package_inc.mk b/editeng/Package_inc.mk
deleted file mode 100644
index 485f1bb00c..0000000000
--- a/editeng/Package_inc.mk
+++ /dev/null
@@ -1,156 +0,0 @@
-# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2011 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-$(eval $(call gb_Package_Package,editeng_inc,$(SRCDIR)/editeng/inc))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleComponentBase.hxx,editeng/AccessibleComponentBase.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleContextBase.hxx,editeng/AccessibleContextBase.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleEditableTextPara.hxx,editeng/AccessibleEditableTextPara.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleImageBullet.hxx,editeng/AccessibleImageBullet.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleParaManager.hxx,editeng/AccessibleParaManager.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleSelectionBase.hxx,editeng/AccessibleSelectionBase.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleStaticTextBase.hxx,editeng/AccessibleStaticTextBase.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/AccessibleStringWrap.hxx,editeng/AccessibleStringWrap.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/acorrcfg.hxx,editeng/acorrcfg.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/adjitem.hxx,editeng/adjitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/akrnitem.hxx,editeng/akrnitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/blnkitem.hxx,editeng/blnkitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/bolnitem.hxx,editeng/bolnitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/borderline.hxx,editeng/borderline.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/boxitem.hxx,editeng/boxitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/brkitem.hxx,editeng/brkitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/brshitem.hxx,editeng/brshitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/bulitem.hxx,editeng/bulitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/charhiddenitem.hxx,editeng/charhiddenitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/charreliefitem.hxx,editeng/charreliefitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/charrotateitem.hxx,editeng/charrotateitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/charscaleitem.hxx,editeng/charscaleitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/cmapitem.hxx,editeng/cmapitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/cntritem.hxx,editeng/cntritem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/colritem.hxx,editeng/colritem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/crsditem.hxx,editeng/crsditem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/cscoitem.hxx,editeng/cscoitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editdata.hxx,editeng/editdata.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editeng.hxx,editeng/editeng.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editengdllapi.h,editeng/editengdllapi.h))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editerr.hxx,editeng/editerr.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editids.hrc,editeng/editids.hrc))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editobj.hxx,editeng/editobj.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editrids.hrc,editeng/editrids.hrc))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editstat.hxx,editeng/editstat.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editund2.hxx,editeng/editund2.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/editview.hxx,editeng/editview.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/edtdlg.hxx,editeng/edtdlg.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/eedata.hxx,editeng/eedata.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/eeitem.hxx,editeng/eeitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/eeitemid.hxx,editeng/eeitemid.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/eerdll.hxx,editeng/eerdll.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/emphitem.hxx,editeng/emphitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/escpitem.hxx,editeng/escpitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/fhgtitem.hxx,editeng/fhgtitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/flditem.hxx,editeng/flditem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/flstitem.hxx,editeng/flstitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/fontitem.hxx,editeng/fontitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/forbiddencharacterstable.hxx,editeng/forbiddencharacterstable.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/forbiddenruleitem.hxx,editeng/forbiddenruleitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/frmdir.hxx,editeng/frmdir.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/frmdiritem.hxx,editeng/frmdiritem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/fwdtitem.hxx,editeng/fwdtitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/hangulhanja.hxx,editeng/hangulhanja.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/hngpnctitem.hxx,editeng/hngpnctitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/hyznitem.hxx,editeng/hyznitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/itemtype.hxx,editeng/itemtype.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/justifyitem.hxx,editeng/justifyitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/keepitem.hxx,editeng/keepitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/kernitem.hxx,editeng/kernitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/langitem.hxx,editeng/langitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/lcolitem.hxx,editeng/lcolitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/lrspitem.hxx,editeng/lrspitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/lspcitem.hxx,editeng/lspcitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/measfld.hxx,editeng/measfld.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/memberids.hrc,editeng/memberids.hrc))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/mutxhelp.hxx,editeng/mutxhelp.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/nhypitem.hxx,editeng/nhypitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/nlbkitem.hxx,editeng/nlbkitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/numdef.hxx,editeng/numdef.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/numitem.hxx,editeng/numitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/opaqitem.hxx,editeng/opaqitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/optitems.hxx,editeng/optitems.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/orphitem.hxx,editeng/orphitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/outliner.hxx,editeng/outliner.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/outlobj.hxx,editeng/outlobj.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/paperinf.hxx,editeng/paperinf.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/paragraphdata.hxx,editeng/paragraphdata.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/paravertalignitem.hxx,editeng/paravertalignitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/pbinitem.hxx,editeng/pbinitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/pgrditem.hxx,editeng/pgrditem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/pmdlitem.hxx,editeng/pmdlitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/postitem.hxx,editeng/postitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/prntitem.hxx,editeng/prntitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/protitem.hxx,editeng/protitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/prszitem.hxx,editeng/prszitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/scriptspaceitem.hxx,editeng/scriptspaceitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/scripttypeitem.hxx,editeng/scripttypeitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/shaditem.hxx,editeng/shaditem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/shdditem.hxx,editeng/shdditem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/sizeitem.hxx,editeng/sizeitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/SpellPortions.hxx,editeng/SpellPortions.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/spltitem.hxx,editeng/spltitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/splwrap.hxx,editeng/splwrap.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/svxacorr.hxx,editeng/svxacorr.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/svxenum.hxx,editeng/svxenum.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/svxfont.hxx,editeng/svxfont.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/svxrtf.hxx,editeng/svxrtf.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/swafopt.hxx,editeng/swafopt.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/tstpitem.hxx,editeng/tstpitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/twolinesitem.hxx,editeng/twolinesitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/txtrange.hxx,editeng/txtrange.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/udlnitem.hxx,editeng/udlnitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/ulspitem.hxx,editeng/ulspitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoedhlp.hxx,editeng/unoedhlp.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoedprx.hxx,editeng/unoedprx.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoedsrc.hxx,editeng/unoedsrc.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unofdesc.hxx,editeng/unofdesc.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unofield.hxx,editeng/unofield.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/UnoForbiddenCharsTable.hxx,editeng/UnoForbiddenCharsTable.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unofored.hxx,editeng/unofored.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoforou.hxx,editeng/unoforou.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoipset.hxx,editeng/unoipset.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unolingu.hxx,editeng/unolingu.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unonrule.hxx,editeng/unonrule.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unopracc.hxx,editeng/unopracc.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoprnms.hxx,editeng/unoprnms.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unotext.hxx,editeng/unotext.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoviwed.hxx,editeng/unoviwed.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/unoviwou.hxx,editeng/unoviwou.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/wghtitem.hxx,editeng/wghtitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/widwitem.hxx,editeng/widwitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/writingmodeitem.hxx,editeng/writingmodeitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/wrlmitem.hxx,editeng/wrlmitem.hxx))
-$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/xmlcnitm.hxx,editeng/xmlcnitm.hxx))
-
-# vim: set noet sw=4 ts=4:
diff --git a/editeng/inc/editeng.hrc b/editeng/inc/editeng.hrc
deleted file mode 100755
index 66fcf0cb92..0000000000
--- a/editeng/inc/editeng.hrc
+++ /dev/null
@@ -1,43 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _EDITENG_HRC
-#define _EDITENG_HRC
-
-#include <editeng/editrids.hrc>
-
-#define MN_SPELLING 1
-#define MN_INSERT 2
-#define MN_IGNORE 3
-#define MN_AUTOCORR 4
-#define MN_WORDLANGUAGE 5
-#define MN_PARALANGUAGE 6
-
-#define MN_ALTSTART 1000
-#define MN_AUTOSTART 2000
-#define MN_DICTSTART 3000
-
-#endif // _EDITENG_HRC
diff --git a/editeng/inc/editeng/AccessibleComponentBase.hxx b/editeng/inc/editeng/AccessibleComponentBase.hxx
deleted file mode 100644
index d2b41b9f63..0000000000
--- a/editeng/inc/editeng/AccessibleComponentBase.hxx
+++ /dev/null
@@ -1,150 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_EXTENDED_COMPONENT_BASE_HXX
-#define _SVX_ACCESSIBILITY_ACCESSIBLE_EXTENDED_COMPONENT_BASE_HXX
-
-
-#include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
-#include <com/sun/star/awt/XFocusListener.hpp>
-#include "editeng/editengdllapi.h"
-
-namespace accessibility {
-
-/** @descr
- This base class provides (will provice) a base implementation of the
- <type>XAccessibleComponent</type> and the
- <type>XAccessibleExtendedComponent</type> for all shapes. For
- more detailed documentation about the methods refer to the interface
- descriptions of <type>XAccessible</type>,
- <type>XAccessibleContext</type>, <type>XInterface</type>,
- <type>XServiceInfo</type>, and <type>XTypeProvider</type>.
-*/
-class EDITENG_DLLPUBLIC AccessibleComponentBase
- : public ::com::sun::star::accessibility::XAccessibleExtendedComponent
-{
-public:
- //===== internal ========================================================
- AccessibleComponentBase (void);
- virtual ~AccessibleComponentBase (void);
-
-
- //===== XAccessibleComponent ================================================
-
- /** The default implementation uses the result of
- <member>getBounds</member> to determine whether the given point lies
- inside this object.
- */
- virtual sal_Bool SAL_CALL containsPoint (
- const ::com::sun::star::awt::Point& aPoint)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** The default implementation returns an empty reference.
- */
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible > SAL_CALL
- getAccessibleAtPoint (
- const ::com::sun::star::awt::Point& aPoint)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** The default implementation returns an empty rectangle.
- */
- virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** The default implementation uses the result of
- <member>getBounds</member> to determine the location.
- */
- virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** The default implementation returns an empty position, i.e. the
- * result of the default constructor of <type>com::sun::star::awt::Point</type>.
- */
- virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** The default implementation uses the result of
- <member>getBounds</member> to determine the size.
- */
- virtual ::com::sun::star::awt::Size SAL_CALL getSize (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** The default implementation ignores this call.
- */
- virtual void SAL_CALL addFocusListener (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::awt::XFocusListener >& xListener)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** The default implementation ignores this call.
- */
- virtual void SAL_CALL removeFocusListener (const ::com::sun::star::uno::Reference<
- ::com::sun::star::awt::XFocusListener >& xListener )
- throw (::com::sun::star::uno::RuntimeException);
-
- /** The default implementation does nothing.
- */
- virtual void SAL_CALL grabFocus (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Returns black as the default foreground color.
- */
- virtual sal_Int32 SAL_CALL getForeground (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Returns white as the default background color.
- */
- virtual sal_Int32 SAL_CALL getBackground (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- //===== XAccessibleExtendedComponent ====================================
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL
- getFont (void)
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTitledBorderText (void)
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getToolTipText (void)
- throw (::com::sun::star::uno::RuntimeException);
-
-
- //===== XTypeProvider ===================================================
-
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
- getTypes (void)
- throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-} // 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
deleted file mode 100644
index 4313035ba5..0000000000
--- a/editeng/inc/editeng/AccessibleContextBase.hxx
+++ /dev/null
@@ -1,402 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_CONTEXT_BASE_HXX
-#define _SVX_ACCESSIBILITY_ACCESSIBLE_CONTEXT_BASE_HXX
-
-#include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/accessibility/XAccessibleContext.hpp>
-#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
-#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
-#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
-#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
-#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <cppuhelper/weak.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <osl/mutex.hxx>
-#include <cppuhelper/compbase4.hxx>
-#include <editeng/editengdllapi.h>
-
-
-namespace accessibility {
-
-struct MutexOwner {mutable ::osl::Mutex maMutex;};
-
-/** @descr
- This base class provides an implementation of the
- <type>AccessibleContext</type> service. Appart from the
- <type>XXAccessible<type> and <type>XAccessibleContextContext</type>
- interfaces it supports the <type>XServiceInfo</type> interface.
-*/
-class EDITENG_DLLPUBLIC AccessibleContextBase
- : public MutexOwner,
- public cppu::PartialWeakComponentImplHelper4<
- ::com::sun::star::accessibility::XAccessible,
- ::com::sun::star::accessibility::XAccessibleContext,
- ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
- ::com::sun::star::lang::XServiceInfo
- >
-{
-public:
-
- //===== internal ========================================================
-
- /** The origin of the accessible name or description.
- */
- enum StringOrigin {
- ManuallySet,
- FromShape,
- AutomaticallyCreated,
- NotSet
- };
-
- AccessibleContextBase (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& rxParent,
- const sal_Int16 aRole);
- virtual ~AccessibleContextBase (void);
-
-
- /** Call all accessiblity event listeners to inform them about the
- specified event.
- @param aEventId
- Id of the event type.
- @param rNewValue
- New value of the modified attribute. Pass empty structure if
- not applicable.
- @param rOldValue
- Old value of the modified attribute. Pass empty structure if
- not applicable.
- */
- void CommitChange (sal_Int16 aEventId,
- const ::com::sun::star::uno::Any& rNewValue,
- const ::com::sun::star::uno::Any& rOldValue);
-
- /** Set a new description and, provided that the new name differs from
- the old one, broadcast an accessibility event.
- @param rsDescription
- The new description.
- @param eDescriptionOrigin
- The origin of the description. This is used to determine
- whether the given description overrules the existing one. An
- origin with a lower numerical value overrides one with a higher
- value.
- */
- void SetAccessibleDescription (
- const ::rtl::OUString& rsDescription,
- StringOrigin eDescriptionOrigin)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Set a new description and, provided that the new name differs from
- the old one, broadcast an accessibility event.
- @param rsName
- The new name.
- @param eNameOrigin
- The origin of the name. This is used to determine whether the
- given name overrules the existing one. An origin with a lower
- numerical value overrides one with a higher value.
- */
- void SetAccessibleName (
- const ::rtl::OUString& rsName,
- StringOrigin eNameOrigin)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Set the specified state (turn it on) and send events to all
- listeners to inform them of the change.
-
- @param aState
- The state to turn on.
-
- @return
- If the specified state changed its value due to this call
- <TRUE/> is returned, otherwise <FALSE/>.
- */
- virtual sal_Bool SetState (sal_Int16 aState);
-
- /** Reset the specified state (turn it off) and send events to all
- listeners to inform them of the change.
-
- @param aState
- The state to turn off.
-
- @return
- If the specified state changed its value due to this call
- <TRUE/> is returned, otherwise <FALSE/>.
- */
- virtual sal_Bool ResetState (sal_Int16 aState);
-
- /** Return the state of the specified state.
-
- @param aState
- The state for which to return its value.
-
- @return
- A value of <TRUE/> indicates that the state is set. A <FALSE/>
- value indicates an unset state.
- */
- sal_Bool GetState (sal_Int16 aState);
-
- /** Replace the current relation set with the specified one. Send
- events for relations that are not in both sets.
-
- @param rRelationSet
- The new relation set that replaces the old one.
- */
- virtual void SetRelationSet (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleRelationSet>& rxRelationSet)
- throw (::com::sun::star::uno::RuntimeException);
-
-
- //===== XAccessible =====================================================
-
- /// Return the XAccessibleContext.
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
- getAccessibleContext (void) throw (::com::sun::star::uno::RuntimeException);
-
-
- //===== XAccessibleContext ==============================================
-
- /// Return the number of currently visible children.
- virtual sal_Int32 SAL_CALL
- getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
-
- /// Return the specified child or throw exception.
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
- getAccessibleChild (sal_Int32 nIndex)
- throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- /// Return a reference to the parent.
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
- getAccessibleParent (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return this objects index among the parents children.
- virtual sal_Int32 SAL_CALL
- getAccessibleIndexInParent (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return this object's role.
- virtual sal_Int16 SAL_CALL
- getAccessibleRole (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return this object's description.
- virtual ::rtl::OUString SAL_CALL
- getAccessibleDescription (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return the object's current name.
- virtual ::rtl::OUString SAL_CALL
- getAccessibleName (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return NULL to indicate that an empty relation set.
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
- getAccessibleRelationSet (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return the set of current states.
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
- getAccessibleStateSet (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Return the parents locale or throw exception if this object has no
- parent yet/anymore.
- */
- virtual ::com::sun::star::lang::Locale SAL_CALL
- getLocale (void)
- throw (::com::sun::star::uno::RuntimeException,
- ::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
-
- //===== XComponent ========================================================
-
- using WeakComponentImplHelperBase::addEventListener;
- using WeakComponentImplHelperBase::removeEventListener;
-
- //===== XAccessibleEventBroadcaster ========================================
-
- virtual void SAL_CALL
- addEventListener (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL
- removeEventListener (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
- throw (::com::sun::star::uno::RuntimeException);
-
-
- //===== XServiceInfo ====================================================
-
- /** Returns an identifier for the implementation of this object.
- */
- virtual ::rtl::OUString SAL_CALL
- getImplementationName (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Return whether the specified service is supported by this class.
- */
- virtual sal_Bool SAL_CALL
- supportsService (const ::rtl::OUString& sServiceName)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Returns a list of all supported services. In this case that is just
- the AccessibleContext service.
- */
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
- getSupportedServiceNames (void)
- throw (::com::sun::star::uno::RuntimeException);
-
-
- //===== XTypeProvider ===================================================
-
- /** Returns a sequence of all supported interfaces.
- */
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
- getTypes (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Returns a implementation id.
- */
- virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
- getImplementationId (void)
- throw (::com::sun::star::uno::RuntimeException);
-
-protected:
- /** The state set.
- */
- ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleStateSet> mxStateSet;
-
- /** The relation set. Relations can be set or removed by calling the
- <member>AddRelation</member> and <member>RemoveRelation</member> methods.
- */
- ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleRelationSet> mxRelationSet;
-
- // This method is called from the component helper base class while disposing.
- virtual void SAL_CALL disposing (void);
-
- /** Create the accessible object's name. This method may be called more
- than once for a single object.
- @return
- The returned string is a unique (among the accessible object's
- siblings) name.
- */
- virtual ::rtl::OUString CreateAccessibleName (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Create the accessible object's descriptive string. May be called
- more than once.
- @return
- Descriptive string. Not necessarily unique.
- */
- virtual ::rtl::OUString
- CreateAccessibleDescription (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- void FireEvent (const ::com::sun::star::accessibility::AccessibleEventObject& aEvent);
-
- /** Check whether or not the object has been disposed (or is in the
- state of beeing disposed). If that is the case then
- DisposedException is thrown to inform the (indirect) caller of the
- foul deed.
- */
- void ThrowIfDisposed (void)
- throw (::com::sun::star::lang::DisposedException);
-
- /** Check whether or not the object has been disposed (or is in the
- state of beeing disposed).
-
- @return TRUE, if the object is disposed or in the course
- of being disposed. Otherwise, FALSE is returned.
- */
- sal_Bool IsDisposed (void);
-
- /** sets the role as returned by XaccessibleContext::getAccessibleRole
-
- <p>Caution: This is only to be used in the construction phase (means within
- the ctor or late ctor), <em>never</em> when the object is still alive and part
- of an Accessibility hierarchy.</p>
- */
- void SetAccessibleRole( sal_Int16 _nRole );
-
-private:
- /// Reference to the parent object.
- ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> mxParent;
-
- /** Description of this object. This is not a constant because it can
- be set from the outside. Furthermore, it changes according the the
- draw page's display mode.
- */
- ::rtl::OUString msDescription;
-
- /** The origin of the description is used to determine whether new
- descriptions given to the SetAccessibleDescription is ignored or
- whether that replaces the old value in msDescription.
- */
- StringOrigin meDescriptionOrigin;
-
- /** Name of this object. It changes according the the draw page's
- display mode.
- */
- ::rtl::OUString msName;
-
- /** The origin of the name is used to determine whether new
- name given to the SetAccessibleName is ignored or
- whether that replaces the old value in msName.
- */
- StringOrigin meNameOrigin;
-
- /** client id in the AccessibleEventNotifier queue
- */
- sal_uInt32 mnClientId;
-
- /** This is the role of this object.
- */
- sal_Int16 maRole;
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/AccessibleEditableTextPara.hxx b/editeng/inc/editeng/AccessibleEditableTextPara.hxx
deleted file mode 100644
index 5253d6a606..0000000000
--- a/editeng/inc/editeng/AccessibleEditableTextPara.hxx
+++ /dev/null
@@ -1,420 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX
-#define _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX
-
-#include <tools/gen.hxx>
-#include <tools/string.hxx>
-#include <cppuhelper/weakref.hxx>
-#include <cppuhelper/compbase9.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/accessibility/XAccessibleContext.hpp>
-#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
-#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
-#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
-#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
-#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
-
-#include <comphelper/accessibletexthelper.hxx>
-#include <comphelper/broadcasthelper.hxx>
-#include "editeng/AccessibleParaManager.hxx"
-#include "editeng/AccessibleImageBullet.hxx"
-#include "editeng/unoedprx.hxx"
-#include "editeng/editengdllapi.h"
-
-namespace accessibility
-{
- typedef ::cppu::PartialWeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible,
- ::com::sun::star::accessibility::XAccessibleContext,
- ::com::sun::star::accessibility::XAccessibleComponent,
- ::com::sun::star::accessibility::XAccessibleEditableText,
- ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
- ::com::sun::star::accessibility::XAccessibleTextAttributes,
- ::com::sun::star::accessibility::XAccessibleHypertext,
- ::com::sun::star::accessibility::XAccessibleMultiLineText,
- ::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase;
-
- /** This class implements the actual text paragraphs for the EditEngine/Outliner UAA
- */
- class EDITENG_DLLPUBLIC AccessibleEditableTextPara : public ::comphelper::OBaseMutex, public AccessibleTextParaInterfaceBase, public ::comphelper::OCommonAccessibleText
- {
-
- protected:
- // override OCommonAccessibleText methods
- virtual ::rtl::OUString implGetText();
- virtual ::com::sun::star::lang::Locale implGetLocale();
- virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
- virtual void implGetParagraphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
- virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
-
- public:
- /// Create accessible object for given parent
- // #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 ();
-
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException);
-
- // XComponent
-
- using WeakComponentImplHelperBase::addEventListener;
- using WeakComponentImplHelperBase::removeEventListener;
-
- // XAccessible
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XAccessibleContext
- virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException);
- /// Maximal length of text returned by getAccessibleDescription()
- enum { MaxDescriptionLen = 40 };
- virtual ::rtl::OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
-
- // XAccessibleEventBroadcaster
- virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
-
- // XAccessibleComponent
- virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XAccessibleText (this comes implicitely inherited by XAccessibleEditableText AND by XAccessibleMultiLineText)
- virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
- virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
- virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
- virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- // XAccessibleEditableText
- virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL setText( const ::rtl::OUString& sText ) throw (::com::sun::star::uno::RuntimeException);
-
- // XAccessibleTextAttributes
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- // XAccessibleHypertext
- virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- // XAccessibleMultiLineText
- virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceName
- virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
-
- /** Set the current index in the accessibility parent
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- void SetIndexInParent( sal_Int32 nIndex );
-
- /** Get the current index in the accessibility parent
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- sal_Int32 GetIndexInParent() const;
-
- /** Set the current paragraph number
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- void SetParagraphIndex( sal_Int32 nIndex );
-
- /** Query the current paragraph number (0 - nParas-1)
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /** Set the edit engine offset
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- void SetEEOffset( const Point& rOffset );
-
- /** Set the EditEngine offset
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- void SetEditSource( SvxEditSourceAdapter* pEditSource );
-
- /** Dispose this object
-
- Notifies and deregisters the listeners, drops all references.
- */
- void Dispose();
-
- /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
- virtual void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
-
- /// Queries the given state on the internal state set
- bool HasState( const sal_Int16 nStateId );
- /// Sets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
- void SetState( const sal_Int16 nStateId );
- /// Unsets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
- void UnSetState( const sal_Int16 nStateId );
-
- static Rectangle LogicToPixel( const Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder& rForwarder );
-
- SvxEditSourceAdapter& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /** Query the SvxTextForwarder for EditEngine access.
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- SvxAccessibleTextAdapter& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /** Query the SvxViewForwarder for EditEngine access.
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- SvxViewForwarder& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /** Query whether a GetEditViewForwarder( sal_False ) will return a forwarder
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- sal_Bool HaveEditView() const;
-
- /** Query the SvxEditViewForwarder for EditEngine access.
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- SvxAccessibleTextEditViewAdapter& GetEditViewForwarder( sal_Bool bCreate = sal_False ) const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /** Send a TEXT_CHANGED event for this paragraph
-
- This method internally caters for calculating text
- differences, and sends the appropriate Anys in the
- Accessibility::TEXT_CHANGED event
- */
- void TextChanged();
-
- private:
-
- // declared, but not defined
- AccessibleEditableTextPara( const AccessibleEditableTextPara& );
- AccessibleEditableTextPara& operator= ( const AccessibleEditableTextPara& );
-
- /** Calculate character range of similar attributes
-
- @param nStartIndex
- Therein, the start of the character range with the same attributes is returned
-
- @param nEndIndex
- Therein, the end (exclusively) of the character range with the same attributes is returned
-
- @param nIndex
- The character index at where to look for similar character attributes
-
- @return sal_False, if the method was not able to determine the range
- */
- sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nIndex );
-
- // syntactic sugar for FireEvent
- void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
- void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
-
- /** Query the visibility state
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
-
- @return the visibility state. Per definition, a defunc object is no longer visible
- */
- sal_Bool IsVisible() const;
-
- int getNotifierClientId() const;
-
- // retrieve text interface for given paragraph index
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleText > GetParaInterface( sal_Int32 nIndex );
-
- /// Do we have children? This is the case for image bullets
- sal_Bool HaveChildren();
-
- /// Is the underlying object in edit mode
- sal_Bool IsActive() const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- const Point& GetEEOffset() const;
-
- // Get text from forwarder
- String GetText( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::uno::RuntimeException));
- String GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) SAL_THROW((::com::sun::star::uno::RuntimeException));
- sal_uInt16 GetTextLen() const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /** Get the current selection of this paragraph
-
- @return sal_False, if nothing in this paragraph is selected
- */
- sal_Bool GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ) SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /** create selection from Accessible selection.
-
- */
- ESelection MakeSelection( sal_Int32 nStartEEIndex, sal_Int32 nEndEEIndex );
- ESelection MakeSelection( sal_Int32 nEEIndex );
- ESelection MakeCursor( sal_Int32 nEEIndex );
-
- // check whether index value is within permitted range
-
- /// Check whether 0<=nIndex<=n-1
- void CheckIndex( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
- /// Check whether 0<=nIndex<=n
- void CheckPosition( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
- /// Check whether 0<=nStart<=n and 0<=nEnd<=n
- void CheckRange( sal_Int32 nStart, sal_Int32 nEnd ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
-
- // the paragraph index in the edit engine (guarded by solar mutex)
- sal_Int32 mnParagraphIndex;
-
- // our current index in the parent (guarded by solar mutex)
- sal_Int32 mnIndexInParent;
-
- // the current edit source (guarded by solar mutex)
- SvxEditSourceAdapter* mpEditSource;
-
- // the possible child (for image bullets, guarded by solar mutex)
- typedef WeakCppRef < ::com::sun::star::accessibility::XAccessible, AccessibleImageBullet > WeakBullet;
- WeakBullet maImageBullet;
-
- // the last string used for an Accessibility::TEXT_CHANGED event (guarded by solar mutex)
- ::rtl::OUString maLastTextString;
-
- // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
- Point maEEOffset;
-
- // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
-
- /// The shape we're the accessible for (unguarded)
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
-
- /// Our listeners (guarded by maMutex)
- int mnNotifierClientId;
-
- // 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
- // paragraph and the successor paragraph.
- const AccessibleParaManager* mpParaManager;
- };
-
-} // end of namespace accessibility
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/AccessibleImageBullet.hxx b/editeng/inc/editeng/AccessibleImageBullet.hxx
deleted file mode 100644
index 444917fede..0000000000
--- a/editeng/inc/editeng/AccessibleImageBullet.hxx
+++ /dev/null
@@ -1,237 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
-#define _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
-
-#include <tools/gen.hxx>
-#include <cppuhelper/weakref.hxx>
-#include <cppuhelper/implbase5.hxx>
-
-#include <cppuhelper/interfacecontainer.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/accessibility/XAccessibleContext.hpp>
-#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
-#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
-#include "editeng/AccessibleParaManager.hxx"
-#include <editeng/unoedsrc.hxx>
-
-namespace accessibility
-{
- typedef ::cppu::WeakImplHelper5< ::com::sun::star::accessibility::XAccessible,
- ::com::sun::star::accessibility::XAccessibleContext,
- ::com::sun::star::accessibility::XAccessibleComponent,
- ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
- ::com::sun::star::lang::XServiceInfo > AccessibleImageBulletInterfaceBase;
-
- /** This class implements the image bullets for the EditEngine/Outliner UAA
- */
- class AccessibleImageBullet : public AccessibleImageBulletInterfaceBase
- {
-
- public:
- /// Create accessible object for given parent
- AccessibleImageBullet ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent );
-
- virtual ~AccessibleImageBullet ();
-
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException);
-
- // XAccessible
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XAccessibleContext
- virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException);
- /// Maximal length of text returned by getAccessibleDescription()
- enum { MaxDescriptionLen = 40 };
- virtual ::rtl::OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
-
- // XAccessibleEventBroadcaster
- virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
-
- // XAccessibleComponent
- virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceName
- virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
-
- /** Set the current index in the accessibility parent
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- void SetIndexInParent( sal_Int32 nIndex );
-
- /** Get the current index in the accessibility parent
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- sal_Int32 GetIndexInParent() const;
-
- /** Set the edit engine offset
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- void SetEEOffset( const Point& rOffset );
-
- /** Set the EditEngine offset
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- void SetEditSource( SvxEditSource* pEditSource );
-
- /** Dispose this object
-
- Notifies and deregisters the listeners, drops all references.
- */
- void Dispose();
-
- /** Set the current paragraph number
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- void SetParagraphIndex( sal_Int32 nIndex );
-
- /** Query the current paragraph number (0 - nParas-1)
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
- virtual void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
-
- private:
-
- // declared, but not defined
- AccessibleImageBullet( const AccessibleImageBullet& );
- AccessibleImageBullet& operator= ( const AccessibleImageBullet& );
-
- // syntactic sugar for FireEvent
- void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
- void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
-
- // maintain state set and send STATE_CHANGE events
- void SetState( const sal_Int16 nStateId );
- void UnSetState( const sal_Int16 nStateId );
-
- SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- int getNotifierClientId() const;
-
- /** Query the SvxTextForwarder for EditEngine access.
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- SvxTextForwarder& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /** Query the SvxViewForwarder for EditEngine access.
-
- @attention This method does not lock the SolarMutex,
- leaving that to the calling code. This is because only
- there potential deadlock situations can be resolved. Thus,
- make sure SolarMutex is locked when calling this.
- */
- SvxViewForwarder& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- const Point& GetEEOffset() const;
-
- // the paragraph index in the edit engine (guarded by solar mutex)
- sal_Int32 mnParagraphIndex;
-
- // our current index in the parent (guarded by solar mutex)
- sal_Int32 mnIndexInParent;
-
- // the current edit source (guarded by solar mutex)
- SvxEditSource* mpEditSource;
-
- // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
- Point maEEOffset;
-
- // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
-
- mutable osl::Mutex maMutex;
-
- /// The shape we're the accessible for (unguarded)
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
-
- /// Our listeners (guarded by maMutex)
- int mnNotifierClientId;
- };
-
-} // end of namespace accessibility
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/AccessibleParaManager.hxx b/editeng/inc/editeng/AccessibleParaManager.hxx
deleted file mode 100644
index e3c538ba6a..0000000000
--- a/editeng/inc/editeng/AccessibleParaManager.hxx
+++ /dev/null
@@ -1,349 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_ACCESSIBLE_PARA_MANAGER_HXX
-#define _SVX_ACCESSIBLE_PARA_MANAGER_HXX
-
-#include <vector>
-#include <algorithm>
-#include <functional>
-#include <utility>
-#include <tools/gen.hxx>
-#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/uno/Reference.hxx>
-#include <cppuhelper/weakref.hxx>
-#include <com/sun/star/accessibility/XAccessibleContext.hpp>
-#include "editeng/editengdllapi.h"
-
-class SvxEditSourceAdapter;
-
-namespace accessibility
-{
- class AccessibleEditableTextPara;
-
- /** Helper class for WeakCppRef
-
- This class is returned by WeakChild::get() and contains a hard
- reference and a reference to the c++ object. This combination
- prevents the c++ object from destruction during usage. Hold
- this object only as long as absolutely necessary, prevents
- referenced object from vanishing otherwise
- */
- template < class UnoType, class CppType > class HardCppRef
- {
- public:
-
- typedef UnoType UnoInterfaceType;
- typedef CppType InterfaceType;
-
- HardCppRef( const ::com::sun::star::uno::WeakReference< UnoInterfaceType >& xRef, InterfaceType* rImpl ) :
- mxRef( xRef ),
- mpImpl( rImpl )
- {
- }
-
- /** Query whether the reference is still valid.
-
- Hands off also from the implementation pointer if this
- returns sal_False!
- */
- sal_Bool is() const { return mxRef.is(); }
- InterfaceType* operator->() const { return mpImpl; }
- InterfaceType& operator*() const { return *mpImpl; }
- ::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() { return mxRef; }
- const ::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() const { return mxRef; }
-
- // default copy constructor and assignment will do
- // HardCppRef( const HardCppRef& );
- // HardCppRef& operator= ( const HardCppRef& );
-
- private:
-
- // the interface, hard reference to prevent object from vanishing
- ::com::sun::star::uno::Reference< UnoInterfaceType > mxRef;
-
- // the c++ object, for our internal stuff
- InterfaceType* mpImpl;
-
- };
-
- /** Helper class for weak object references plus implementation
-
- This class combines a weak reference (to facilitate automatic
- object disposal if user drops last reference) and hard
- reference to the c++ class (for fast access and bypassing of
- the UNO interface)
- */
- template < class UnoType, class CppType > class WeakCppRef
- {
- public:
-
- typedef UnoType UnoInterfaceType;
- typedef CppType InterfaceType;
- typedef HardCppRef< UnoInterfaceType, InterfaceType > HardRefType;
-
- WeakCppRef() : maWeakRef(), maUnsafeRef( NULL ) {}
- WeakCppRef( InterfaceType& rImpl ) :
- maWeakRef( ::com::sun::star::uno::Reference< UnoInterfaceType >( rImpl, ::com::sun::star::uno::UNO_QUERY ) ),
- maUnsafeRef( &rImpl )
- {
- }
-
- WeakCppRef( HardRefType& rImpl ) :
- maWeakRef( rImpl.getRef() ),
- maUnsafeRef( rImpl.operator->() )
- {
- }
-
- // get object with c++ object and hard reference (which
- // prevents the c++ object from destruction during use)
- HardRefType get() const { return HardRefType( maWeakRef, maUnsafeRef ); }
-
- // default copy constructor and assignment will do
- // WeakCppRef( const WeakCppRef& );
- // WeakCppRef& operator= ( const WeakCppRef& );
-
- private:
-
- // the interface, hold weakly
- ::com::sun::star::uno::WeakReference< UnoInterfaceType > maWeakRef;
-
- // hard ref to c++ class, _only_ valid if maWeakRef.is() is true
- InterfaceType* maUnsafeRef;
- };
-
-
- /** This class manages the paragraphs of an AccessibleTextHelper
-
- To facilitate automatic deletion of paragraphs no longer used,
- this class uses the WeakCppRef helper to hold the objects weakly.
- */
- class EDITENG_DLLPUBLIC AccessibleParaManager
- {
- public:
- typedef WeakCppRef < ::com::sun::star::accessibility::XAccessible, AccessibleEditableTextPara > WeakPara;
- typedef ::std::pair< WeakPara, ::com::sun::star::awt::Rectangle > WeakChild;
- typedef ::std::pair< ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible > , ::com::sun::star::awt::Rectangle > Child;
- typedef ::std::vector< WeakChild > VectorOfChildren;
- typedef ::std::vector< sal_Int16 > VectorOfStates;
-
- AccessibleParaManager();
- ~AccessibleParaManager();
-
- /** Sets a vector of additional accessible states.
-
- The states are passed to every created child object
- (text paragraph). The state values are defined in
- com::sun::star::accessibility::AccessibleStateType.
- */
- void SetAdditionalChildStates( const VectorOfStates& rChildStates );
-
- /** Returns the additional accessible states for children.
- */
- const VectorOfStates& GetAdditionalChildStates() const;
-
- /** Set the number of paragraphs
-
- @param nNumPara
- The total number of paragraphs the EditEngine currently
- has (_not_ the number of currently visible children)
- */
- void SetNum( sal_Int32 nNumParas );
-
- /** Get the number of paragraphs currently possible */
- sal_uInt32 GetNum() const;
-
- // iterators
- VectorOfChildren::iterator begin();
- VectorOfChildren::iterator end();
- VectorOfChildren::const_iterator begin() const;
- VectorOfChildren::const_iterator end() const;
-
- // dealing with single paragraphs (release reference, return reference etc)
- void Release( sal_uInt32 nPara );
- /// Set focus to given child
- void SetFocus( sal_Int32 nChild );
-
- void FireEvent( sal_uInt32 nPara,
- const sal_Int16 nEventId,
- const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(),
- const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
-
- static sal_Bool IsReferencable( WeakPara::HardRefType aChild );
- sal_Bool IsReferencable( sal_uInt32 nChild ) const;
- static void ShutdownPara( const WeakChild& rChild );
-
- Child CreateChild( sal_Int32 nChild,
- const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xFrontEnd,
- SvxEditSourceAdapter& rEditSource,
- sal_uInt32 nParagraphIndex );
-
- WeakChild GetChild( sal_uInt32 nParagraphIndex ) const;
-
- // forwarder to all paragraphs
- /// Make all children active and editable (or off)
- void SetActive( sal_Bool bActive = sal_True );
- /// Set state of all children
- void SetState( const sal_Int16 nStateId );
- /// Unset state of all children
- void UnSetState( const sal_Int16 nStateId );
- /// Set offset to edit engine for all children
- void SetEEOffset ( const Point& rOffset );
- /// Change edit source on all living children
- void SetEditSource ( SvxEditSourceAdapter* pEditSource );
- /// Dispose all living children
- void Dispose ();
-
- // forwarder to given paragraphs
- //------------------------------------------------------------------------
- /** Release the given range of paragraphs
-
- All ranges have the meaning [start,end), similar to STL
-
- @param nStartPara
- Index of paragraph to start with releasing
-
- @param nEndPara
- Index of first paragraph to stop with releasing
- */
- void Release( sal_uInt32 nStartPara, sal_uInt32 nEndPara );
-
- /** Fire event for the given range of paragraphs
-
- All ranges have the meaning [start,end), similar to STL
-
- @param nStartPara
- Index of paragraph to start with event firing
-
- @param nEndPara
- Index of first paragraph to stop with event firing
- */
- void FireEvent( sal_uInt32 nStartPara,
- sal_uInt32 nEndPara,
- const sal_Int16 nEventId,
- const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(),
- const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
-
- /** Functor adapter for ForEach template
-
- Adapts giving functor such that only the paragraph objects
- are accessed and the fact that our children are held
- weakly is hidden
-
- The functor must provide the following method:
- void operator() ( AccessibleEditablePara& )
-
- */
- template < typename Functor > class WeakChildAdapter : public ::std::unary_function< const WeakChild&, void >
- {
- public:
- WeakChildAdapter( Functor& rFunctor ) : mrFunctor(rFunctor) {}
- void operator()( const WeakChild& rPara )
- {
- // retrieve hard reference from weak one
- WeakPara::HardRefType aHardRef( rPara.first.get() );
-
- if( aHardRef.is() )
- mrFunctor( *aHardRef );
- }
-
- private:
- Functor& mrFunctor;
- };
-
- /** Adapter for unary member functions
-
- Since STL's binder don't work with const& arguments (and
- BOOST's neither, at least on MSVC), have to provide our
- own adapter for unary member functions.
-
- Create with pointer to member function of
- AccessibleEditableTextPara and the corresponding argument.
- */
- template < typename Argument > class MemFunAdapter : public ::std::unary_function< const WeakChild&, void >
- {
- public:
- typedef void (::accessibility::AccessibleEditableTextPara::*FunctionPointer)( Argument );
-
- MemFunAdapter( FunctionPointer aFunPtr, Argument aArg ) : maFunPtr(aFunPtr), maArg(aArg) {}
- void operator()( const WeakChild& rPara )
- {
- // retrieve hard reference from weak one
- WeakPara::HardRefType aHardRef( rPara.first.get() );
-
- if( aHardRef.is() )
- (*aHardRef.*maFunPtr)( maArg );
- }
-
- private:
- FunctionPointer maFunPtr;
- Argument maArg;
- };
-
- /** Generic algorithm on given paragraphs
-
- Convenience method, that already adapts the given functor with WeakChildAdapter
- */
- template < typename Functor > void ForEach( Functor& rFunctor )
- {
- ::std::for_each( begin(), end(), WeakChildAdapter< Functor >(rFunctor) );
- }
-
- private:
- /// Set state on given child
- void SetState( sal_Int32 nChild, const sal_Int16 nStateId );
- /// Unset state on given child
- void UnSetState( sal_Int32 nChild, const sal_Int16 nStateId );
- /// Init child with default state (as stored in previous SetFocus and SetActive calls)
- void InitChild( AccessibleEditableTextPara& rChild,
- SvxEditSourceAdapter& rEditSource,
- sal_Int32 nChild,
- sal_uInt32 nParagraphIndex ) const;
-
- // vector the size of the paragraph number of the underlying EditEngine
- VectorOfChildren maChildren;
-
- /// Additional states that will be set at every created child object.
- VectorOfStates maChildStates;
-
- // cache EE offset for child creation
- Point maEEOffset;
-
- // which child currently has the focus (-1 for none)
- sal_Int32 mnFocusedChild;
-
- // whether children are active and editable
- sal_Bool mbActive;
- };
-
-} // end of namespace accessibility
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/AccessibleSelectionBase.hxx b/editeng/inc/editeng/AccessibleSelectionBase.hxx
deleted file mode 100644
index fd39bd960a..0000000000
--- a/editeng/inc/editeng/AccessibleSelectionBase.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX
-#define _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX
-
-#include <comphelper/accessibleselectionhelper.hxx>
-#include "editeng/editengdllapi.h"
-
-namespace accessibility
-{
-/** @descr
- This base class provides a base implementation of the
- <type>XAccessibleSelection</type> interface.
- The following methods have to be implemented if this
- class is used:
-
- <method>implGetMutex</method>,
- <method>implGetAccessibleContext</method>,
- <method>implIsSelected</method>,
- <method>implSelect</method>,
-*/
- class EDITENG_DLLPUBLIC AccessibleSelectionBase : public ::comphelper::OCommonAccessibleSelection,
- public ::com::sun::star::accessibility::XAccessibleSelection
- {
- protected:
-
- virtual ::osl::Mutex& implGetMutex() = 0;
-
- public:
-
- // XAccessibleSelection - default implementations
- virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- public:
-
- AccessibleSelectionBase();
- virtual ~AccessibleSelectionBase();
- };
-
-}
-
-#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
deleted file mode 100644
index 4edc38ced9..0000000000
--- a/editeng/inc/editeng/AccessibleStaticTextBase.hxx
+++ /dev/null
@@ -1,283 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 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.
- *
- ************************************************************************/
-
-#ifndef _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_
-#define _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_
-
-#include <memory>
-#include <tools/gen.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/accessibility/XAccessibleText.hpp>
-#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
-#include <com/sun/star/accessibility/TextSegment.hpp>
-#include "editeng/editengdllapi.h"
-
-
-class SvxEditSource;
-class SvxEditViewForwarder;
-
-namespace accessibility
-{
-
- class AccessibleStaticTextBase_Impl;
-
- typedef ::cppu::ImplHelper2<
- ::com::sun::star::accessibility::XAccessibleText,
- ::com::sun::star::accessibility::XAccessibleTextAttributes > AccessibleStaticTextBase_BASE;
-
- /** Helper class for objects containing EditEngine/Outliner text
-
- This class implements the XAccessibleText interface for static
- text, somewhat similar to the children of the
- AccessibleTextHelper class. Currently, there are no children,
- i.e. the whole text is presented in one big chunk. This might
- change in the future, if a need for image bullets should
- arise. These, by convention, would be represented as children
- of the text.
-
- You have to implement the SvxEditSource, SvxTextForwarder,
- SvxViewForwarder and SvxEditViewForwarder interfaces in order
- to enable your object to cooperate with this
- class. SvxTextForwarder encapsulates the fact that text
- objects do not necessarily have an EditEngine at their
- disposal, SvxViewForwarder and SvxEditViewForwarder do the
- same for the document and the edit view. The three mentioned
- forwarder objects are not stored by the AccessibleTextHelper,
- but fetched every time from the SvxEditSource. So you are best
- off making your SvxEditSource::Get*Forwarder methods cache the
- current forwarder.
-
- As this class is intended for static (i.e. non-changing) text
- only, no event broadcasting is necessary. You must handle
- visibility by yourself, the bounding boxes returned by
- getCharacterBounds() are relative to your accessibility
- object.
-
- @attention All public non-UNO methods (those are the uppercase
- ones) must not be called with any mutex hold, except when
- calling from the main thread (with holds the solar mutex),
- unless stated otherwise. This is because they themselves might
- need the solar mutex in addition to the object mutex, and the
- ordering of the locking must be: first solar mutex, then
- object mutex. Furthermore, state change events might be fired
- internally.
-
- @derive Use this class as a base for objects containing static
- edit engine text. To avoid overwriting every interface method
- to intercept derived object defunc state, just set NULL as the
- edit source. Every interface method will then properly throw
- an exception.
- */
- class EDITENG_DLLPUBLIC AccessibleStaticTextBase : public AccessibleStaticTextBase_BASE
- {
-
- public:
- /** Create accessible text object for given edit source
-
- @param pEditSource
- The edit source to use. Object ownership is transferred
- from the caller to the callee. The object listens on the
- SvxEditSource for object disposal, so no provisions have
- to be taken if the caller destroys the data (e.g. the
- model) contained in the given SvxEditSource.
-
- */
- explicit AccessibleStaticTextBase( ::std::auto_ptr< SvxEditSource > pEditSource );
- virtual ~AccessibleStaticTextBase();
-
- private:
-
- // declared, but not defined
- EDITENG_DLLPRIVATE AccessibleStaticTextBase( const AccessibleStaticTextBase& );
- // declared, but not defined
- EDITENG_DLLPRIVATE AccessibleStaticTextBase& operator= ( const AccessibleStaticTextBase& );
-
- public:
- /** Query the current edit source
-
- @attention This method returns by reference, so you are
- responsible for serialization (typically, you aquired the
- solar mutex when calling this method). Thus, the method
- should only be called from the main office thread.
-
- */
- virtual const SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /** Set the current edit source
-
- @attention You are required to have the solar mutex
- locked, when calling this method. Thus, the method should
- only be called from the main office thread.
-
- The EditSource set here is required to broadcast out the
- following hints: EDITSOURCE_HINT_PARASMOVED,
- EDITSOURCE_HINT_SELECTIONCHANGED, TEXT_HINT_MODIFIED,
- TEXT_HINT_PARAINSERTED, TEXT_HINT_PARAREMOVED,
- TEXT_HINT_TEXTHEIGHTCHANGED,
- TEXT_HINT_VIEWSCROLLED. Otherwise, not all state changes
- will get noticed by the accessibility object. Further
- more, when the corresponding core object or the model is
- dying, either the edit source must be set to NULL or it
- has to broadcast a SFX_HINT_DYING hint.
-
- This class does not have a dispose method, since it is not
- a UNO component. Nevertheless, it holds C++ references to
- several core objects, so you should issue a
- SetEditSource(::std::auto_ptr<SvxEditSource>(NULL)) in
- your dispose() method.
-
- @param pEditSource
- The new edit source to set. Object ownership is transferred
- from the caller to the callee.
- */
- virtual void SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /** Set the event source
-
- @attention When setting a reference here, you should call
- Dispose() when you as the owner are disposing, since until
- then this object will hold that reference
-
- @param rInterface
- The interface that should be set as the source for
- accessibility events sent by this object.
- */
- virtual void SetEventSource( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rInterface );
-
- /** Get the event source
-
- @return the interface that is set as the source for
- accessibility events sent by this object.
- */
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetEventSource() const;
-
- /** Set offset of EditEngine from parent
-
- @attention You are required to have the solar mutex
- locked, when calling this method. Thus, the method should
- only be called from the main office thread.
-
- If the origin of the underlying EditEngine does
- not correspond to the upper left corner of the object
- using this class, you have to specify the offset.
-
- @param rPoint
- The offset in screen coordinates (i.e. pixel)
- */
- virtual void SetOffset( const Point& rPoint );
-
- /** Query offset of EditEngine from parent
-
- @return the offset in screen coordinates (i.e. pixel)
- */
- virtual Point GetOffset() const;
-
- /** Update the visible children
-
- As this class currently does not represent any content
- using children, this does nothing at the moment.
-
- @attention You are required to have the solar mutex
- locked, when calling this method. Thus, the method should
- only be called from the main office thread.
-
- This method reevaluates the visibility of all
- childrens. Call this method if your visibility state has
- changed somehow, e.g. if the visible area has changed and
- the AccessibleStaticTextHelper isn't notified
- internally. Normally, there should not be a need to call
- this method.
- */
- virtual void UpdateChildren() SAL_THROW((::com::sun::star::uno::RuntimeException));
-
- /** Drop all references and enter disposed state
-
- This method drops all references to external objects (also
- the event source reference set via SetEventSource()) and
- sets the object into the disposed state (i.e. the methods
- return default values or throw a uno::DisposedException
- exception).
- */
- virtual void Dispose();
-
- // XAccessibleText interface implementation
- virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
- /// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode
- virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
- virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
- virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
- virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- /// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode
- virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- // XAccessibleTextAttributes
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( sal_Int32 Index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- // child-related methods from XAccessibleContext
- virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- // child-related methods from XAccessibleComponent
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
-
- protected:
- Rectangle GetParagraphBoundingBox() const;
- sal_Int32 GetParagraphCount() const;
- sal_Int32 GetParagraphIndex() const;
- sal_Int32 GetLineCount( sal_Int32 nParagraph ) const;
-
- private:
-
- /// @dyn
- const std::auto_ptr< AccessibleStaticTextBase_Impl > mpImpl;
-
- };
-
-} // 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
deleted file mode 100644
index b833e091ba..0000000000
--- a/editeng/inc/editeng/AccessibleStringWrap.hxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _ACCESSIBLESTRINGWRAP_HXX
-#define _ACCESSIBLESTRINGWRAP_HXX
-
-#include <sal/types.h>
-#include <tools/string.hxx>
-
-#include <editeng/editengdllapi.h>
-
-class OutputDevice;
-class SvxFont;
-class Rectangle;
-class Point;
-
-//------------------------------------------------------------------------
-//
-// AccessibleStringWrap declaration
-//
-//------------------------------------------------------------------------
-
-class AccessibleStringWrap
-{
-public:
-
- EDITENG_DLLPUBLIC AccessibleStringWrap( OutputDevice& rDev, SvxFont& rFont, const String& rText );
-
- EDITENG_DLLPUBLIC sal_Bool GetCharacterBounds( sal_Int32 nIndex, Rectangle& rRect );
- EDITENG_DLLPUBLIC sal_Int32 GetIndexAtPoint( const Point& rPoint );
-
-private:
-
- OutputDevice& mrDev;
- SvxFont& mrFont;
- String maText;
-};
-
-#endif /* _ACCESSIBLESTRINGWRAP_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/SpellPortions.hxx b/editeng/inc/editeng/SpellPortions.hxx
deleted file mode 100644
index e13aed8a26..0000000000
--- a/editeng/inc/editeng/SpellPortions.hxx
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SVX_SPELL_PORTIONS_HXX
-#define SVX_SPELL_PORTIONS_HXX
-
-#include <i18npool/lang.h>
-#include <rtl/ustring.hxx>
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/linguistic2/SingleProofreadingError.hpp>
-#include <com/sun/star/linguistic2/XProofreader.hpp>
-#include <vector>
-
-namespace com{ namespace sun{ namespace star{ namespace linguistic2{
- class XSpellAlternatives;
-}}}}
-
-namespace svx{
-/** contains a portion of text that has the same language attributes applied
- and belongs to the same script type.
- */
-struct SpellPortion
-{
- /** contains the text of the portion.
- */
- rtl::OUString sText;
- /** Marks the portion as field, footnote symbol or any other special content that
- should be protected against unintentional deletion.
- */
- bool bIsField;
- /** Marks the portion hidden content that should not be touched by spell checking
- and not be removed like redlines. The creator of the portions has to take care
- for them.
- */
- bool bIsHidden;
- /** contains the language applied to the text. It has to match the script type.
- */
- LanguageType eLanguage;
- /** for wrong words this reference is filled with the error informations otherwise
- it's an empty reference
- */
- ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives> xAlternatives;
- /** determines whether the error type is a grammar error
- */
- bool bIsGrammarError;
- /** contains the grammar error information
- */
- com::sun::star::linguistic2::SingleProofreadingError aGrammarError;
- /** provides access to the grammar checker interface
- */
- ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
- /** marks portion as to-be-ignored. This is a return parameter.
- */
- /** contains the proposed dialog title if the proof reading component provides one.
- */
- rtl::OUString sDialogTitle;
-
- bool bIgnoreThisError;
- SpellPortion() :
- bIsField(false),
- bIsHidden(false),
- eLanguage(LANGUAGE_DONTKNOW),
- bIsGrammarError(false),
- bIgnoreThisError(false)
- {
- aGrammarError.nErrorStart = aGrammarError.nErrorLength = aGrammarError.nErrorType = 0;
- }
-};
-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
deleted file mode 100644
index f34e2d260e..0000000000
--- a/editeng/inc/editeng/UnoForbiddenCharsTable.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOFORBIDDENCHARSTABLE_HXX_
-#define _SVX_UNOFORBIDDENCHARSTABLE_HXX_
-
-#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
-#include <com/sun/star/linguistic2/XSupportedLocales.hpp>
-#include <rtl/ref.hxx>
-
-#include <cppuhelper/implbase2.hxx>
-#include "editeng/editengdllapi.h"
-
-class SvxForbiddenCharactersTable;
-
-class EDITENG_DLLPUBLIC SvxUnoForbiddenCharsTable : public cppu::WeakImplHelper2<
- com::sun::star::i18n::XForbiddenCharacters,
- com::sun::star::linguistic2::XSupportedLocales>
-{
-protected:
- /** this virtual function is called if the forbidden characters are changed */
- virtual void onChange();
-
- rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenChars;
-
-public:
- SvxUnoForbiddenCharsTable(rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars);
- ~SvxUnoForbiddenCharsTable();
-
- // XForbiddenCharacters
- virtual com::sun::star::i18n::ForbiddenCharacters SAL_CALL getForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::container::NoSuchElementException, com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setForbiddenCharacters( const com::sun::star::lang::Locale& rLocale, const com::sun::star::i18n::ForbiddenCharacters& rForbiddenCharacters ) throw(com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
-
- // XSupportedLocales
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( ) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasLocale( const ::com::sun::star::lang::Locale& aLocale ) throw (::com::sun::star::uno::RuntimeException);
-};
-
-#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
deleted file mode 100644
index c80a045771..0000000000
--- a/editeng/inc/editeng/acorrcfg.hxx
+++ /dev/null
@@ -1,132 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVXACCFG_HXX
-#define _SVXACCFG_HXX
-
-// include ---------------------------------------------------------------
-
-#include "editeng/editengdllapi.h"
-#include <unotools/configitem.hxx>
-
-class SvxAutoCorrect;
-class SvxAutoCorrCfg;
-class EDITENG_DLLPUBLIC SvxBaseAutoCorrCfg : public utl::ConfigItem
-{
- SvxAutoCorrCfg& rParent;
- com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
-
-public:
- SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rParent);
- ~SvxBaseAutoCorrCfg();
-
- void Load(sal_Bool bInit);
- virtual void Commit();
- virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
- void SetModified() {ConfigItem::SetModified();}
-};
-
-class EDITENG_DLLPUBLIC SvxSwAutoCorrCfg : public utl::ConfigItem
-{
- SvxAutoCorrCfg& rParent;
- com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
-
-public:
- SvxSwAutoCorrCfg(SvxAutoCorrCfg& rParent);
- ~SvxSwAutoCorrCfg();
-
- void Load(sal_Bool bInit);
- virtual void Commit();
- virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
- void SetModified() {ConfigItem::SetModified();}
-};
-/*--------------------------------------------------------------------
- Description: Configuration for Auto Correction
- --------------------------------------------------------------------*/
-class EDITENG_DLLPUBLIC SvxAutoCorrCfg
-{
- friend class SvxBaseAutoCorrCfg;
- friend class SvxSwAutoCorrCfg;
-
- SvxAutoCorrect* pAutoCorrect;
-
- SvxBaseAutoCorrCfg aBaseConfig;
- SvxSwAutoCorrCfg aSwConfig;
-
- // Flags for Autotext:
- sal_Bool bFileRel;
- sal_Bool bNetRel;
- // Help tip for Autotext as you type
- sal_Bool bAutoTextTip;
- sal_Bool bAutoTextPreview;
- sal_Bool bAutoFmtByInput;
- sal_Bool bSearchInAllCategories;
-
-public:
- void SetModified()
- {
- aBaseConfig.SetModified();
- aSwConfig.SetModified();
- }
- void Commit()
- {
- aBaseConfig.Commit();
- aSwConfig.Commit();
- }
-
- SvxAutoCorrect* GetAutoCorrect() { return pAutoCorrect; }
- const SvxAutoCorrect* GetAutoCorrect() const { return pAutoCorrect; }
- // the pointer is transfered to the possession of the ConfigItems!
- void SetAutoCorrect( SvxAutoCorrect* );
-
- sal_Bool IsAutoFmtByInput() const { return bAutoFmtByInput; }
- void SetAutoFmtByInput( sal_Bool bSet ) { bAutoFmtByInput = bSet;aSwConfig.SetModified();}
-
- sal_Bool IsSaveRelFile() const { return bFileRel; }
- void SetSaveRelFile( sal_Bool bSet ) { bFileRel = bSet; aSwConfig.SetModified(); }
-
- sal_Bool IsSaveRelNet() const { return bNetRel; }
- void SetSaveRelNet( sal_Bool bSet ) { bNetRel = bSet; aSwConfig.SetModified();}
-
- sal_Bool IsAutoTextPreview() const {return bAutoTextPreview;}
- void SetAutoTextPreview(sal_Bool bSet) {bAutoTextPreview = bSet; aSwConfig.SetModified();}
-
- sal_Bool IsAutoTextTip() const { return bAutoTextTip; }
- void SetAutoTextTip(sal_Bool bSet ) { bAutoTextTip = bSet;aSwConfig.SetModified();}
-
- sal_Bool IsSearchInAllCategories() const { return bSearchInAllCategories;}
- void SetSearchInAllCategories(sal_Bool bSet ) { bSearchInAllCategories = bSet; aSwConfig.SetModified(); }
-
- SvxAutoCorrCfg();
- virtual ~SvxAutoCorrCfg();
- 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
deleted file mode 100644
index ad4bf30393..0000000000
--- a/editeng/inc/editeng/adjitem.hxx
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_ADJITEM_HXX
-#define _SVX_ADJITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/svxenum.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxAdjustItem ---------------------------------------------------
-
-/*
-[Description]
-This item describes the row orientation.
-*/
-#define ADJUST_LASTBLOCK_VERSION ((sal_uInt16)0x0001)
-
-class EDITENG_DLLPUBLIC SvxAdjustItem : public SfxEnumItemInterface
-{
- sal_Bool bLeft : 1;
- sal_Bool bRight : 1;
- sal_Bool bCenter : 1;
- sal_Bool bBlock : 1;
-
- // only activ when bBlock
- sal_Bool bOneBlock : 1;
- sal_Bool bLastCenter : 1;
- sal_Bool bLastBlock : 1;
-
- friend SvStream& operator<<( SvStream&, SvxAdjustItem& ); //$ ostream
-public:
- TYPEINFO();
-
- SvxAdjustItem( const SvxAdjust eAdjst /*= SVX_ADJUST_LEFT*/,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
- virtual sal_uInt16 GetValueCount() const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
- virtual sal_uInt16 GetEnumValue() const;
- virtual void SetEnumValue( sal_uInt16 nNewVal );
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- inline void SetOneWord( const SvxAdjust eType )
- {
- bOneBlock = eType == SVX_ADJUST_BLOCK;
- }
-
- inline void SetLastBlock( const SvxAdjust eType )
- {
- bLastBlock = eType == SVX_ADJUST_BLOCK;
- bLastCenter = eType == SVX_ADJUST_CENTER;
- }
-
- inline void SetAdjust( const SvxAdjust eType )
- {
- bLeft = eType == SVX_ADJUST_LEFT;
- bRight = eType == SVX_ADJUST_RIGHT;
- bCenter = eType == SVX_ADJUST_CENTER;
- bBlock = eType == SVX_ADJUST_BLOCK;
- }
-
- inline SvxAdjust GetLastBlock() const
- {
- SvxAdjust eRet = SVX_ADJUST_LEFT;
-
- if ( bLastBlock )
- eRet = SVX_ADJUST_BLOCK;
- else if( bLastCenter )
- eRet = SVX_ADJUST_CENTER;
- return eRet;
- }
-
- inline SvxAdjust GetOneWord() const
- {
- SvxAdjust eRet = SVX_ADJUST_LEFT;
-
- if ( bBlock && bOneBlock )
- eRet = SVX_ADJUST_BLOCK;
- return eRet;
- }
-
- inline SvxAdjust GetAdjust() const
- {
- SvxAdjust eRet = SVX_ADJUST_LEFT;
-
- if ( bRight )
- eRet = SVX_ADJUST_RIGHT;
- else if ( bCenter )
- eRet = SVX_ADJUST_CENTER;
- else if ( bBlock )
- eRet = SVX_ADJUST_BLOCK;
- return eRet;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/akrnitem.hxx b/editeng/inc/editeng/akrnitem.hxx
deleted file mode 100644
index 47860ddd1a..0000000000
--- a/editeng/inc/editeng/akrnitem.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_AKRNITEM_HXX
-#define _SVX_AKRNITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxAutoKernItem -------------------------------------------------
-
-/*
- [Description]
- Attribute for Pair-Kerning.
-*/
-
-class EDITENG_DLLPUBLIC SvxAutoKernItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxAutoKernItem( const sal_Bool bAutoKern /*= sal_False*/,
- const sal_uInt16 nId );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxAutoKernItem& operator=(const SvxAutoKernItem& rAutoKern)
- {
- SetValue( rAutoKern.GetValue() );
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/blnkitem.hxx b/editeng/inc/editeng/blnkitem.hxx
deleted file mode 100644
index 2384a48892..0000000000
--- a/editeng/inc/editeng/blnkitem.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_BLNKITEM_HXX
-#define _SVX_BLNKITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxBlinkItem -------------------------------------------------
-
-/*
- [Description]
- This item describes, whether to flash.
-*/
-
-class EDITENG_DLLPUBLIC SvxBlinkItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxBlinkItem( const sal_Bool bBlink /*= sal_False*/, const sal_uInt16 nId );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxBlinkItem& operator=(const SvxBlinkItem& rBlink) {
- SetValue(rBlink.GetValue());
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/bolnitem.hxx b/editeng/inc/editeng/bolnitem.hxx
deleted file mode 100644
index ee15661587..0000000000
--- a/editeng/inc/editeng/bolnitem.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_BOLNITEM_HXX
-#define _SVX_BOLNITEM_HXX
-
-// include ---------------------------------------------------------------
-
-
-
-#include <svl/poolitem.hxx>
-#include "editeng/editengdllapi.h"
-
-
-
-// class SvxLineItem -----------------------------------------------------
-
-
-/*
-[Description]
-This Item transports a editeng::SvxBorderLine.
-*/
-
-namespace editeng {
- class SvxBorderLine;
-}
-
-class EDITENG_DLLPUBLIC SvxLineItem : public SfxPoolItem
-{
-public:
- TYPEINFO();
-
- SvxLineItem( const sal_uInt16 nId );
- SvxLineItem( const SvxLineItem& rCpy );
- ~SvxLineItem();
- SvxLineItem &operator=( const SvxLineItem& rLine );
-
- 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,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
- virtual bool ScaleMetrics( long nMult, long nDiv );
- virtual bool HasMetrics() const;
-
- const editeng::SvxBorderLine* GetLine () const { return pLine; }
- void SetLine ( const editeng::SvxBorderLine *pNew );
-
-private:
- 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
deleted file mode 100644
index 17e137a53c..0000000000
--- a/editeng/inc/editeng/borderline.hxx
+++ /dev/null
@@ -1,180 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SVX_BORDERLINE_HXX
-#define SVX_BORDERLINE_HXX
-
-#include <tools/color.hxx>
-#include <svl/poolitem.hxx>
-#include <editeng/editengdllapi.h>
-#include <svtools/ctrlbox.hxx>
-
-// Line defaults in twips (former Writer defaults):
-
-#define DEF_LINE_WIDTH_0 1
-#define DEF_LINE_WIDTH_1 20
-#define DEF_LINE_WIDTH_2 50
-#define DEF_LINE_WIDTH_3 80
-#define DEF_LINE_WIDTH_4 100
-#define DEF_LINE_WIDTH_5 10
-
-// ============================================================================
-
-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
deleted file mode 100644
index 4fc84213d5..0000000000
--- a/editeng/inc/editeng/boxitem.hxx
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_BOXITEM_HXX
-#define _SVX_BOXITEM_HXX
-
-#include <svl/poolitem.hxx>
-#include <editeng/borderline.hxx>
-#include <editeng/editengdllapi.h>
-#include <com/sun/star/table/BorderLine2.hpp>
-
-namespace rtl { class OUString; }
-
-// class SvxBoxItem ------------------------------------------------------
-
-/* [Description]
-
- This item describes a border attribute
- (all four edges and the inward distance)
-*/
-
-#define BOX_LINE_TOP ((sal_uInt16)0)
-#define BOX_LINE_BOTTOM ((sal_uInt16)1)
-#define BOX_LINE_LEFT ((sal_uInt16)2)
-#define BOX_LINE_RIGHT ((sal_uInt16)3)
-
-#define BOX_4DISTS_VERSION ((sal_uInt16)1)
-
-class EDITENG_DLLPUBLIC SvxBoxItem : public SfxPoolItem
-{
- editeng::SvxBorderLine *pTop,
- *pBottom,
- *pLeft,
- *pRight;
- sal_uInt16 nTopDist,
- nBottomDist,
- nLeftDist,
- nRightDist;
-
-public:
- TYPEINFO();
-
- SvxBoxItem( const sal_uInt16 nId );
- SvxBoxItem( const SvxBoxItem &rCpy );
- ~SvxBoxItem();
- SvxBoxItem &operator=( const SvxBoxItem& rBox );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- virtual bool ScaleMetrics( long nMult, long nDiv );
- virtual bool HasMetrics() const;
-
- const 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 editeng::SvxBorderLine* GetLine( sal_uInt16 nLine ) const;
-
- //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;
-
- void SetDistance( sal_uInt16 nNew, sal_uInt16 nLine );
- inline void SetDistance( sal_uInt16 nNew );
-
- // Line width plus Space plus inward distance
- //bIgnoreLine = TRUE -> Also return distance, when no Line is set
- sal_uInt16 CalcLineSpace( sal_uInt16 nLine, sal_Bool bIgnoreLine = sal_False ) const;
- static com::sun::star::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, sal_Bool bConvert );
- static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert);
- static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert);
-};
-
-inline void SvxBoxItem::SetDistance( sal_uInt16 nNew )
-{
- nTopDist = nBottomDist = nLeftDist = nRightDist = nNew;
-}
-
-// class SvxBoxInfoItem --------------------------------------------------
-
-/* [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)
-#define BOXINFO_LINE_VERT ((sal_uInt16)1)
-
-#define VALID_TOP 0x01
-#define VALID_BOTTOM 0x02
-#define VALID_LEFT 0x04
-#define VALID_RIGHT 0x08
-#define VALID_HORI 0x10
-#define VALID_VERT 0x20
-#define VALID_DISTANCE 0x40
-#define VALID_DISABLE 0x80
-
-class EDITENG_DLLPUBLIC SvxBoxInfoItem : public SfxPoolItem
-{
- editeng::SvxBorderLine* pHori; //inner horizontal Line
- editeng::SvxBorderLine* pVert; //inner vertical Line
-
- bool mbEnableHor; /// true = Enable inner horizontal line.
- bool mbEnableVer; /// true = Enable inner vertical line.
-
- /*
- 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; // 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
-
- sal_uInt16 nDefDist; // The default or minimum distance.
-
-public:
- TYPEINFO();
-
- SvxBoxInfoItem( const sal_uInt16 nId );
- SvxBoxInfoItem( const SvxBoxInfoItem &rCpy );
- ~SvxBoxInfoItem();
- SvxBoxInfoItem &operator=( const SvxBoxInfoItem &rCpy );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, 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 bool ScaleMetrics( long nMult, long nDiv );
- virtual bool HasMetrics() const;
-
- const editeng::SvxBorderLine* GetHori() const { return pHori; }
- const editeng::SvxBorderLine* GetVert() const { return pVert; }
-
- //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; }
-
- inline bool IsHorEnabled() const { return mbEnableHor; }
- inline void EnableHor( bool bEnable ) { mbEnableHor = bEnable; }
- inline bool IsVerEnabled() const { return mbEnableVer; }
- inline void EnableVer( bool bEnable ) { mbEnableVer = bEnable; }
-
- sal_Bool IsDist() const { return bDist; }
- void SetDist( sal_Bool bNew ) { bDist = bNew; }
- sal_Bool IsMinDist() const { return bMinDist; }
- void SetMinDist( sal_Bool bNew ) { bMinDist = bNew; }
- sal_uInt16 GetDefDist() const { return nDefDist; }
- void SetDefDist( sal_uInt16 nNew ) { nDefDist = nNew; }
-
- sal_Bool IsValid( sal_uInt8 nValid ) const
- { return ( nValidFlags & nValid ) == nValid; }
- void SetValid( sal_uInt8 nValid, sal_Bool bValid = sal_True )
- { bValid ? ( nValidFlags |= nValid )
- : ( nValidFlags &= ~nValid ); }
- void ResetFlags();
-};
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/brkitem.hxx b/editeng/inc/editeng/brkitem.hxx
deleted file mode 100644
index bb697fa305..0000000000
--- a/editeng/inc/editeng/brkitem.hxx
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_BRKITEM_HXX
-#define _SVX_BRKITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/svxenum.hxx>
-#include <editeng/editengdllapi.h>
-
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxFmtBreakItem -------------------------------------------------
-
-/* [Description]
-
- This item Describes a wrap-attribute
- Automatic?, Page or column break, before or after?
-*/
-#define FMTBREAK_NOAUTO ((sal_uInt16)0x0001)
-
-class EDITENG_DLLPUBLIC SvxFmtBreakItem : public SfxEnumItem
-{
-public:
- TYPEINFO();
-
- inline SvxFmtBreakItem( const SvxBreak eBrk /*= SVX_BREAK_NONE*/,
- const sal_uInt16 nWhich );
- inline SvxFmtBreakItem( const SvxFmtBreakItem& rBreak );
- inline SvxFmtBreakItem& operator=( const SvxFmtBreakItem& rCpy );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
- virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
- virtual sal_uInt16 GetValueCount() const;
-
- // MS VC4.0 messes things up
- void SetValue( sal_uInt16 nNewVal )
- {SfxEnumItem::SetValue(nNewVal); }
- SvxBreak GetBreak() const { return SvxBreak( GetValue() ); }
- void SetBreak( const SvxBreak eNew )
- { SetValue( (sal_uInt16)eNew ); }
-};
-
-
-inline SvxFmtBreakItem::SvxFmtBreakItem( const SvxBreak eBreak,
- const sal_uInt16 _nWhich ) :
- SfxEnumItem( _nWhich, (sal_uInt16)eBreak )
-{}
-
-inline SvxFmtBreakItem::SvxFmtBreakItem( const SvxFmtBreakItem& rBreak ) :
- SfxEnumItem( rBreak )
-{}
-
-inline SvxFmtBreakItem& SvxFmtBreakItem::operator=(
- const SvxFmtBreakItem& rBreak )
-{
- SetValue( rBreak.GetValue() );
- return *this;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/brshitem.hxx b/editeng/inc/editeng/brshitem.hxx
deleted file mode 100644
index 417160f030..0000000000
--- a/editeng/inc/editeng/brshitem.hxx
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_BRSHITEM_HXX
-#define _SVX_BRSHITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <vcl/wall.hxx>
-#include <tools/link.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxBrushItem ----------------------------------------------------
-
-class Graphic;
-class GraphicObject;
-class CntWallpaperItem;
-namespace rtl
-{
- class OUString;
-}
-
-#define BRUSH_GRAPHIC_VERSION ((sal_uInt16)0x0001)
-
-enum SvxGraphicPosition
-{
- GPOS_NONE,
- GPOS_LT, GPOS_MT, GPOS_RT,
- GPOS_LM, GPOS_MM, GPOS_RM,
- GPOS_LB, GPOS_MB, GPOS_RB,
- GPOS_AREA, GPOS_TILED
-};
-
-#define PARA_DEST_PARA 0
-#define PARA_DEST_CHAR 1
-
-class SvxBrushItem_Impl;
-class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem
-{
- Color aColor;
- SvxBrushItem_Impl* pImpl;
- String* pStrLink;
- String* pStrFilter;
- SvxGraphicPosition eGraphicPos;
- sal_Bool bLoadAgain;
-
- void ApplyGraphicTransparency_Impl();
- DECL_STATIC_LINK( SvxBrushItem, DoneHdl_Impl, void *);
- // wird nur von Create benutzt
- SvxBrushItem( SvStream& rStrm,
- sal_uInt16 nVersion, sal_uInt16 nWhich );
-
-public:
- TYPEINFO();
-
- SvxBrushItem( sal_uInt16 nWhich );
- SvxBrushItem( const Color& rColor, sal_uInt16 nWhich );
-
- SvxBrushItem( const Graphic& rGraphic,
- SvxGraphicPosition ePos, sal_uInt16 nWhich );
- SvxBrushItem( const GraphicObject& rGraphicObj,
- SvxGraphicPosition ePos, sal_uInt16 nWhich );
- SvxBrushItem( const String& rLink, const String& rFilter,
- SvxGraphicPosition ePos, sal_uInt16 nWhich );
- SvxBrushItem( const SvxBrushItem& );
- SvxBrushItem( const CntWallpaperItem&, sal_uInt16 nWhich );
-
- ~SvxBrushItem();
-
-public:
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual int operator==( const SfxPoolItem& ) 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 SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const;
- virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- const Color& GetColor() const { return aColor; }
- Color& GetColor() { return aColor; }
- void SetColor( const Color& rCol) { aColor = rCol; }
-
- void SetDoneLink( const Link& rLink );
-
- SvxGraphicPosition GetGraphicPos() const { return eGraphicPos; }
-
- void PurgeMedium() const;
-
- const Graphic* GetGraphic() const;
- const GraphicObject* GetGraphicObject() const;
- const String* GetGraphicLink() const { return pStrLink; }
- const String* GetGraphicFilter() const { return pStrFilter; }
-
- void SetGraphicPos( SvxGraphicPosition eNew );
- void SetGraphic( const Graphic& rNew );
- void SetGraphicObject( const GraphicObject& rNewObj );
- void SetGraphicLink( const String& rNew );
- void SetGraphicFilter( const String& rNew );
-
- SvxBrushItem& operator=( const SvxBrushItem& rItem);
-
- static SvxGraphicPosition WallpaperStyle2GraphicPos( WallpaperStyle eStyle );
- static WallpaperStyle GraphicPos2WallpaperStyle( SvxGraphicPosition ePos );
-};
-
-#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
deleted file mode 100644
index 94e11dd072..0000000000
--- a/editeng/inc/editeng/bulitem.hxx
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_BULITEM_HXX
-#define _SVX_BULITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include "editeng/editengdllapi.h"
-
-
-// define ----------------------------------------------------------------
-
-// Styles
-#define BS_ABC_BIG 0
-#define BS_ABC_SMALL 1
-#define BS_ROMAN_BIG 2
-#define BS_ROMAN_SMALL 3
-#define BS_123 4
-#define BS_NONE 5
-#define BS_BULLET 6
-#define BS_BMP 128
-
-// Justification
-#define BJ_HLEFT 0x01
-#define BJ_HRIGHT 0x02
-#define BJ_HCENTER 0x04
-#define BJ_VTOP 0x08
-#define BJ_VBOTTOM 0x10
-#define BJ_VCENTER 0x20
-
-// Valid-Bits
-// First, only the values that are changed by the dialogue ...
-#define VALID_FONTCOLOR 0x0001
-#define VALID_FONTNAME 0x0002
-#define VALID_SYMBOL 0x0004
-#define VALID_BITMAP 0x0008
-#define VALID_SCALE 0x0010
-#define VALID_START 0x0020
-#define VALID_STYLE 0x0040
-#define VALID_PREVTEXT 0x0080
-#define VALID_FOLLOWTEXT 0x0100
-#include <svl/poolitem.hxx>
-#include <vcl/font.hxx>
-#include <svtools/grfmgr.hxx>
-
-// class SvxBulletItem ---------------------------------------------------
-
-class EDITENG_DLLPUBLIC SvxBulletItem : public SfxPoolItem
-{
- Font aFont;
- GraphicObject* pGraphicObject;
- String aPrevText;
- String aFollowText;
- sal_uInt16 nStart;
- sal_uInt16 nStyle;
- long nWidth;
- sal_uInt16 nScale;
- sal_Unicode cSymbol;
- sal_uInt8 nJustify;
- sal_uInt16 nValidMask; // Only temporary for GetAttribs / setAttribs,
- // because of the large Bullets
-
-#ifdef _SVX_BULITEM_CXX
- void SetDefaultFont_Impl();
- void SetDefaults_Impl();
-#endif
-
-public:
- TYPEINFO();
-
- SvxBulletItem( sal_uInt16 nWhich = 0 );
- SvxBulletItem( sal_uInt8 nStyle, const Font& rFont, sal_uInt16 nStart = 0, sal_uInt16 nWhich = 0 );
- SvxBulletItem( const Font& rFont, sal_Unicode cSymbol, sal_uInt16 nWhich=0 );
- SvxBulletItem( const Bitmap&, sal_uInt16 nWhich = 0 );
- SvxBulletItem( const GraphicObject&, sal_uInt16 nWhich = 0 );
- SvxBulletItem( SvStream& rStrm, sal_uInt16 nWhich = 0 );
- SvxBulletItem( const SvxBulletItem& );
- ~SvxBulletItem();
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const;
- virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const;
-
- String GetFullText() const;
- sal_Unicode GetSymbol() const { return cSymbol; }
- String GetPrevText() const { return aPrevText; }
- String GetFollowText() const { return aFollowText; }
-
- sal_uInt16 GetStart() const { return nStart; }
- long GetWidth() const { return nWidth; }
- sal_uInt16 GetStyle() const { return nStyle; }
- sal_uInt8 GetJustification() const { return nJustify; }
- Font GetFont() const { return aFont; }
- sal_uInt16 GetScale() const { return nScale; }
-
- Bitmap GetBitmap() const;
- void SetBitmap( const Bitmap& rBmp );
-
- const GraphicObject& GetGraphicObject() const;
- void SetGraphicObject( const GraphicObject& rGraphicObject );
-
- void SetSymbol( sal_Unicode c) { cSymbol = c; }
- void SetPrevText( const String& rStr) { aPrevText = rStr;}
- void SetFollowText(const String& rStr) { aFollowText=rStr;}
-
- void SetStart( sal_uInt16 nNew ) { nStart = nNew; }
- void SetWidth( long nNew ) { nWidth = nNew; }
- void SetStyle( sal_uInt16 nNew ) { nStyle = nNew; }
- void SetJustification( sal_uInt8 nNew ) { nJustify = nNew; }
- void SetFont( const Font& rNew) { aFont = rNew; }
- void SetScale( sal_uInt16 nNew ) { nScale = nNew; }
-
- virtual sal_uInt16 GetVersion(sal_uInt16 nFileVersion) const;
- virtual int operator==( const SfxPoolItem& ) const;
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- static void StoreFont( SvStream&, const Font& );
- static Font CreateFont( SvStream&, sal_uInt16 nVer );
-
- sal_uInt16& GetValidMask() { return nValidMask; }
- sal_uInt16 GetValidMask() const { return nValidMask; }
- sal_uInt16 IsValid( sal_uInt16 nFlag ) const { return nValidMask & nFlag; }
- void SetValid( sal_uInt16 nFlag, sal_Bool bValid )
- {
- if ( bValid )
- nValidMask |= nFlag;
- else
- nValidMask &= ~nFlag;
- }
- void CopyValidProperties( const SvxBulletItem& rCopyFrom );
-};
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/charhiddenitem.hxx b/editeng/inc/editeng/charhiddenitem.hxx
deleted file mode 100644
index 2ae454368d..0000000000
--- a/editeng/inc/editeng/charhiddenitem.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_CHARHIDDENITEM_HXX
-#define _SVX_CHARHIDDENITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <svl/eitem.hxx>
-#include "editeng/editengdllapi.h"
-
-// class SvxCharHiddenItem -------------------------------------------------
-/* [Description]
-
- This item marks text as hidden
-*/
-
-class EDITENG_DLLPUBLIC SvxCharHiddenItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxCharHiddenItem( const sal_Bool bHidden /*= sal_False*/, const sal_uInt16 nId );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxCharHiddenItem& operator=(const SvxCharHiddenItem& rHidden) {
- SetValue(rHidden.GetValue());
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/charreliefitem.hxx b/editeng/inc/editeng/charreliefitem.hxx
deleted file mode 100644
index d32f3b4aeb..0000000000
--- a/editeng/inc/editeng/charreliefitem.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_CHARRELIEFITEM_HXX
-#define _SVX_CHARRELIEFITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <vcl/fntstyle.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxCharRotateItem ----------------------------------------------
-
-/* [Description]
-
- This item defines a character relief and has currently the values
- emboss, relief.
-*/
-
-class EDITENG_DLLPUBLIC SvxCharReliefItem : public SfxEnumItem
-{
-public:
- TYPEINFO();
-
- SvxCharReliefItem( FontRelief eValue /*= RELIEF_NONE*/,
- const sal_uInt16 nId );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
- virtual sal_uInt16 GetValueCount() const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText,
- const IntlWrapper * = 0 ) const;
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, 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 )
- {
- SetValue( rItem.GetValue() );
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/charrotateitem.hxx b/editeng/inc/editeng/charrotateitem.hxx
deleted file mode 100644
index 4e9e0ab44f..0000000000
--- a/editeng/inc/editeng/charrotateitem.hxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_CHARROTATEITEM_HXX
-#define _SVX_CHARROTATEITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/intitem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxCharRotateItem ----------------------------------------------
-
-/* [Description]
-
- This item defines a character rotation value (0,1 degree). Currently
- character can only be rotated 90,0 and 270,0 degrees.
- The flag FitToLine defines only a UI-Information -
- if true it must also create a SvxCharScaleItem.
-
-*/
-
-class EDITENG_DLLPUBLIC SvxCharRotateItem : public SfxUInt16Item
-{
- sal_Bool bFitToLine;
-public:
- TYPEINFO();
-
- SvxCharRotateItem( sal_uInt16 nValue /*= 0*/,
- sal_Bool bFitIntoLine /*= sal_False*/,
- const sal_uInt16 nId );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- 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 );
-
- inline SvxCharRotateItem& operator=( const SvxCharRotateItem& rItem )
- {
- SetValue( rItem.GetValue() );
- SetFitToLine( rItem.IsFitToLine() );
- return *this;
- }
-
- virtual int operator==( const SfxPoolItem& ) const;
-
- // our currently only degree values
- void SetTopToBotton() { SetValue( 2700 ); }
- void SetBottomToTop() { SetValue( 900 ); }
- sal_Bool IsTopToBotton() const { return 2700 == GetValue(); }
- sal_Bool IsBottomToTop() const { return 900 == GetValue(); }
-
- sal_Bool IsFitToLine() const { return bFitToLine; }
- void SetFitToLine( sal_Bool b ) { bFitToLine = b; }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/charscaleitem.hxx b/editeng/inc/editeng/charscaleitem.hxx
deleted file mode 100644
index 19967f6a23..0000000000
--- a/editeng/inc/editeng/charscaleitem.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_CHARSCALEITEM_HXX
-#define _SVX_CHARSCALEITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/intitem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxCharScaleItem ----------------------------------------------
-
-/* [Description]
-
- This item defines a character scaling factor as percent value.
- A value of 100 is identical to 100% and means normal width
- A value of 50 is identical to 50% and means 1/2 width.
-
-*/
-
-class EDITENG_DLLPUBLIC SvxCharScaleWidthItem : public SfxUInt16Item
-{
-public:
- TYPEINFO();
-
- SvxCharScaleWidthItem( sal_uInt16 nValue /*= 100*/,
- const sal_uInt16 nId );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- 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 );
-
- inline SvxCharScaleWidthItem& operator=(const SvxCharScaleWidthItem& rItem )
- {
- SetValue( rItem.GetValue() );
- return *this;
- }
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/cmapitem.hxx b/editeng/inc/editeng/cmapitem.hxx
deleted file mode 100644
index f4b747747b..0000000000
--- a/editeng/inc/editeng/cmapitem.hxx
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_CMAPITEM_HXX
-#define _SVX_CMAPITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/svxenum.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxCaseMapItem --------------------------------------------------
-
-/* [Description]
-
- This item describe the font type (uppercase, small caps ,...).
-*/
-
-class EDITENG_DLLPUBLIC SvxCaseMapItem : public SfxEnumItem
-{
-public:
- TYPEINFO();
-
- SvxCaseMapItem( const SvxCaseMap eMap /*= SVX_CASEMAP_NOT_MAPPED*/,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
- virtual sal_uInt16 GetValueCount() const;
-
- // MS VC4.0 kommt durcheinander
- void SetValue( sal_uInt16 nNewVal )
- {SfxEnumItem::SetValue(nNewVal); }
-
- inline SvxCaseMapItem& operator=(const SvxCaseMapItem& rMap)
- {
- SetValue( rMap.GetValue() );
- return *this;
- }
-
- // enum cast
- SvxCaseMap GetCaseMap() const
- { return (SvxCaseMap)GetValue(); }
- void SetCaseMap( SvxCaseMap eNew )
- { SetValue( (sal_uInt16)eNew ); }
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/cntritem.hxx b/editeng/inc/editeng/cntritem.hxx
deleted file mode 100644
index b3ea8892d6..0000000000
--- a/editeng/inc/editeng/cntritem.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_ITEM_HXX
-#define _SVX_ITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxContourItem --------------------------------------------------
-
-/* [Description]
- This item describes, if contour is employed.
-*/
-
-class EDITENG_DLLPUBLIC SvxContourItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxContourItem( const sal_Bool bContoured /*= sal_False*/,
- const sal_uInt16 nId );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxContourItem& operator=(const SvxContourItem& rCont)
- {
- SetValue(rCont.GetValue());
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/colritem.hxx b/editeng/inc/editeng/colritem.hxx
deleted file mode 100644
index 6d0373f122..0000000000
--- a/editeng/inc/editeng/colritem.hxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_COLRITEM_HXX
-#define _SVX_COLRITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <tools/color.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxColorItem ----------------------------------------------------
-
-/* [Description]
-
- This item describes a color.
-*/
-
-#define VERSION_USEAUTOCOLOR 1
-
-class EDITENG_DLLPUBLIC SvxColorItem : public SfxPoolItem
-{
-private:
- Color mColor;
-
-public:
- TYPEINFO();
-
- SvxColorItem( const sal_uInt16 nId );
- SvxColorItem( const Color& aColor, const sal_uInt16 nId );
- SvxColorItem( SvStream& rStrm, const sal_uInt16 nId );
- SvxColorItem( const SvxColorItem& rCopy );
- ~SvxColorItem();
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
-
- inline SvxColorItem& operator=(const SvxColorItem& rColor)
- {
- SetValue( rColor.GetValue() );
- return *this;
- }
-
- const Color& GetValue() const
- {
- return mColor;
- }
- void SetValue( const Color& rNewCol );
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/crsditem.hxx b/editeng/inc/editeng/crsditem.hxx
deleted file mode 100644
index 2d67e5288a..0000000000
--- a/editeng/inc/editeng/crsditem.hxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_CRSDITEM_HXX
-#define _SVX_CRSDITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <vcl/vclenum.hxx>
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxCrossedOutItem -----------------------------------------------
-
-/* [Description]
- This item describes, whether and how it is striked out.
-*/
-
-class EDITENG_DLLPUBLIC SvxCrossedOutItem : public SfxEnumItem
-{
-public:
- TYPEINFO();
-
- SvxCrossedOutItem( const FontStrikeout eSt /*= STRIKEOUT_NONE*/,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
- virtual sal_uInt16 GetValueCount() const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- // MS VC4.0 messes things up
- void SetValue( sal_uInt16 nNewVal )
- {SfxEnumItem::SetValue(nNewVal); }
-
- virtual int HasBoolValue() const;
- virtual sal_Bool GetBoolValue() const;
- virtual void SetBoolValue( sal_Bool bVal );
-
- inline SvxCrossedOutItem& operator=(const SvxCrossedOutItem& rCross)
- {
- SetValue( rCross.GetValue() );
- return *this;
- }
-
- // enum cast
- FontStrikeout GetStrikeout() const
- { return (FontStrikeout)GetValue(); }
- void SetStrikeout( FontStrikeout eNew )
- { SetValue( (sal_uInt16)eNew ); }
-};
-
-#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
deleted file mode 100644
index 41067ffe93..0000000000
--- a/editeng/inc/editeng/cscoitem.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_CSCOITEM_HXX
-#define _SVX_CSCOITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <tools/string.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxCharSetColorItem ---------------------------------------------
-
-/* [Description]
-
- Is only needed internally in the reader of Writer.
-*/
-
-class EDITENG_DLLPUBLIC SvxCharSetColorItem : public SvxColorItem
-{
- rtl_TextEncoding eFrom;
-public:
- TYPEINFO();
-
- SvxCharSetColorItem( const sal_uInt16 nId );
- SvxCharSetColorItem( const Color& aColor, const rtl_TextEncoding eFrom,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
-
- inline rtl_TextEncoding& GetCharSet() { return eFrom; }
- inline rtl_TextEncoding GetCharSet() const { return eFrom; }
-
- inline SvxCharSetColorItem& operator=(const SvxCharSetColorItem& rColor)
- {
- SetValue( rColor.GetValue() );
- eFrom = rColor.GetCharSet();
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/editdata.hxx b/editeng/inc/editeng/editdata.hxx
deleted file mode 100644
index f5ef746005..0000000000
--- a/editeng/inc/editeng/editdata.hxx
+++ /dev/null
@@ -1,391 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MyEDITDATA, wegen exportiertem EditData
-#ifndef _MyEDITDATA_HXX
-#define _MyEDITDATA_HXX
-
-#include <tools/string.hxx>
-#include "editeng/editengdllapi.h"
-
-#include <svl/svarray.hxx>
-
-class SfxItemSet;
-class SfxPoolItem;
-class SvParser;
-class SvxFieldItem;
-
-enum EETextFormat { EE_FORMAT_TEXT = 0x20, EE_FORMAT_RTF, EE_FORMAT_BIN = 0x31, EE_FORMAT_HTML, EE_FORMAT_XML };
-enum EEHorizontalTextDirection { EE_HTEXTDIR_DEFAULT, EE_HTEXTDIR_L2R, EE_HTEXTDIR_R2L };
-enum EESelectionMode { EE_SELMODE_STD, EE_SELMODE_TXTONLY, EE_SELMODE_HIDDEN };
- // EE_SELMODE_HIDDEN can be used to completely hide the selection. This is usefull e.g. when you want show the selection
- // only as long as your window (which the edit view works on) has the focus
-enum EESpellState { EE_SPELL_OK, EE_SPELL_NOLANGUAGE, EE_SPELL_LANGUAGENOTINSTALLED, EE_SPELL_NOSPELLER, EE_SPELL_ERRORFOUND };
-enum EVAnchorMode {
- ANCHOR_TOP_LEFT, ANCHOR_VCENTER_LEFT, ANCHOR_BOTTOM_LEFT,
- ANCHOR_TOP_HCENTER, ANCHOR_VCENTER_HCENTER, ANCHOR_BOTTOM_HCENTER,
- ANCHOR_TOP_RIGHT, ANCHOR_VCENTER_RIGHT, ANCHOR_BOTTOM_RIGHT };
-
-#define EE_PARA_NOT_FOUND 0xFFFF
-#define EE_PARA_APPEND 0xFFFF
-#define EE_PARA_ALL 0xFFFF
-#define EE_APPEND 0xFFFF
-#define EE_INDEX_NOT_FOUND 0xFFFF
-
-// 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)
-
-#define EDITUNDO_START 100
-#define EDITUNDO_REMOVECHARS 100
-#define EDITUNDO_CONNECTPARAS 101
-#define EDITUNDO_REMOVEFEATURE 102
-#define EDITUNDO_MOVEPARAGRAPHS 103
-#define EDITUNDO_INSERTFEATURE 104
-#define EDITUNDO_SPLITPARA 105
-#define EDITUNDO_INSERTCHARS 106
-#define EDITUNDO_DELCONTENT 107
-#define EDITUNDO_DELETE 108
-#define EDITUNDO_CUT 109
-#define EDITUNDO_PASTE 110
-#define EDITUNDO_INSERT 111
-#define EDITUNDO_SRCHANDREPL 112
-#define EDITUNDO_MOVEPARAS 113
-#define EDITUNDO_PARAATTRIBS 114
-#define EDITUNDO_ATTRIBS 115
-#define EDITUNDO_DRAGANDDROP 116
-#define EDITUNDO_READ 117
-#define EDITUNDO_STYLESHEET 118
-#define EDITUNDO_REPLACEALL 119
-#define EDITUNDO_STRETCH 120
-#define EDITUNDO_RESETATTRIBS 121
-#define EDITUNDO_INDENTBLOCK 122
-#define EDITUNDO_UNINDENTBLOCK 123
-#define EDITUNDO_MARKSELECTION 124
-#define EDITUNDO_TRANSLITERATE 125
-#define EDITUNDO_END 125
-
-#define EDITUNDO_USER 200
-
-
-#define EE_COMPATIBLEMODE_PARAGRAPHSPACING_SUMMATION 0x0001
-#define EE_COMPATIBLEMODE_PARAGRAPHSPACING_BEFOREFIRSTPARAGRAPH 0x0002
-
-class EditView;
-class EditEngine;
-class ImpEditView;
-class ImpEditEngine;
-class EditTextObject;
-class SfxStyleSheet;
-
-#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
-{
- sal_uInt16 nPara;
- xub_StrLen nIndex;
-
- EPosition() :
- nPara( EE_PARA_NOT_FOUND ),
- nIndex( EE_INDEX_NOT_FOUND )
- {
- }
-
- EPosition( sal_uInt16 nPara_, xub_StrLen nPos_ ) :
- nPara( nPara_ ),
- nIndex( nPos_ )
- {
- }
-};
-
-struct ESelection
-{
- sal_uInt16 nStartPara;
- xub_StrLen nStartPos;
- sal_uInt16 nEndPara;
- xub_StrLen nEndPos;
-
- ESelection() : nStartPara( 0 ), nStartPos( 0 ), nEndPara( 0 ), nEndPos( 0 ) {}
-
- ESelection( sal_uInt16 nStPara, xub_StrLen nStPos, sal_uInt16 nEPara, xub_StrLen nEPos ) :
- nStartPara( nStPara ),
- nStartPos( nStPos ),
- nEndPara( nEPara ),
- nEndPos( nEPos )
- {
- }
-
- ESelection( sal_uInt16 nPara, xub_StrLen nPos ) :
- nStartPara( nPara ),
- nStartPos( nPos ),
- nEndPara( nPara ),
- nEndPos( nPos )
- {
- }
-
- void Adjust();
- sal_Bool IsEqual( const ESelection& rS ) const;
- sal_Bool IsLess( const ESelection& rS ) const;
- sal_Bool IsGreater( const ESelection& rS ) const;
- sal_Bool IsZero() const;
- sal_Bool HasRange() const;
-};
-
-inline sal_Bool ESelection::HasRange() const
-{
- return ( nStartPara != nEndPara ) || ( nStartPos != nEndPos );
-}
-
-inline sal_Bool ESelection::IsZero() const
-{
- return ( ( nStartPara == 0 ) && ( nStartPos == 0 ) &&
- ( nEndPara == 0 ) && ( nEndPos == 0 ) );
-}
-
-inline sal_Bool ESelection::IsEqual( const ESelection& rS ) const
-{
- return ( ( nStartPara == rS.nStartPara ) && ( nStartPos == rS.nStartPos ) &&
- ( nEndPara == rS.nEndPara ) && ( nEndPos == rS.nEndPos ) );
-}
-
-inline sal_Bool ESelection::IsLess( const ESelection& rS ) const
-{
- // 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 ) ) )
- {
- return sal_True;
- }
- return sal_False;
-}
-
-inline sal_Bool ESelection::IsGreater( const ESelection& rS ) const
-{
- // 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 ) ) )
- {
- return sal_True;
- }
- return sal_False;
-}
-
-inline void ESelection::Adjust()
-{
- sal_Bool bSwap = sal_False;
- if ( nStartPara > nEndPara )
- bSwap = sal_True;
- else if ( ( nStartPara == nEndPara ) && ( nStartPos > nEndPos ) )
- bSwap = sal_True;
-
- if ( bSwap )
- {
- sal_uInt16 nSPar = nStartPara; sal_uInt16 nSPos = nStartPos;
- nStartPara = nEndPara; nStartPos = nEndPos;
- nEndPara = nSPar; nEndPos = nSPos;
- }
-}
-
-struct EDITENG_DLLPUBLIC EFieldInfo
-{
- SvxFieldItem* pFieldItem;
- String aCurrentText;
- EPosition aPosition;
-
- EFieldInfo();
- EFieldInfo( const SvxFieldItem& rFieldItem, sal_uInt16 nPara, sal_uInt16 nPos );
- ~EFieldInfo();
-
- EFieldInfo( const EFieldInfo& );
- EFieldInfo& operator= ( const EFieldInfo& );
-};
-
-// -----------------------------------------------------------------------
-
-enum ImportState {
- 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, // only pParser, nPara, nIndex
- HTMLIMP_NEXTTOKEN, HTMLIMP_UNKNOWNATTR, // nToken
- HTMLIMP_SETATTR, // pAttrs
- HTMLIMP_INSERTTEXT, // aText
- HTMLIMP_INSERTPARA, HTMLIMP_INSERTFIELD // -
- };
-
-struct ImportInfo
-{
- SvParser* pParser;
- ESelection aSelection;
- ImportState eState;
-
- int nToken;
- short nTokenValue;
-
- String aText;
-
- void* pAttrs; // RTF: SvxRTFItemStackType*, HTML: SfxItemSet*
-
- ImportInfo( ImportState eState, SvParser* pPrsrs, const ESelection& rSel );
- ~ImportInfo();
-};
-
-#define EE_SEARCH_WORDONLY 0x0001
-#define EE_SEARCH_EXACT 0x0002
-#define EE_SEARCH_BACKWARD 0x0004
-#define EE_SEARCH_INSELECTION 0x0008
-#define EE_SEARCH_REGEXPR 0x0010
-#define EE_SEARCH_PATTERN 0x0020
-
-struct ParagraphInfos
-{
- ParagraphInfos()
- : nParaHeight( 0 )
- , nLines( 0 )
- , nFirstLineStartX( 0 )
- , nFirstLineOffset( 0 )
- , nFirstLineHeight( 0 )
- , nFirstLineTextHeight ( 0 )
- , nFirstLineMaxAscent( 0 )
- , bValid( 0 )
- {}
- sal_uInt16 nParaHeight;
- sal_uInt16 nLines;
-
- sal_uInt16 nFirstLineStartX;
-
- sal_uInt16 nFirstLineOffset;
- sal_uInt16 nFirstLineHeight;
- sal_uInt16 nFirstLineTextHeight;
- sal_uInt16 nFirstLineMaxAscent;
-
- sal_Bool bValid; // A query during formatting is not valid!
-};
-
-struct EECharAttrib
-{
- const SfxPoolItem* pAttr;
-
- sal_uInt16 nPara;
- xub_StrLen nStart;
- xub_StrLen nEnd;
-};
-
-SV_DECL_VARARR_VISIBILITY( EECharAttribArray, EECharAttrib, 0, 4, EDITENG_DLLPUBLIC )
-
-struct MoveParagraphsInfo
-{
- sal_uInt16 nStartPara;
- sal_uInt16 nEndPara;
- sal_uInt16 nDestPara;
-
- MoveParagraphsInfo( sal_uInt16 nS, sal_uInt16 nE, sal_uInt16 nD )
- { nStartPara = nS; nEndPara = nE; nDestPara = nD; }
-};
-
-#define EE_ACTION_PASTE 1
-#define EE_ACTION_DROP 2
-
-struct PasteOrDropInfos
-{
- sal_uInt16 nAction;
- sal_uInt16 nStartPara;
- sal_uInt16 nEndPara;
-
- PasteOrDropInfos() : nAction(0), nStartPara(0xFFFF), nEndPara(0xFFFF) {}
-};
-
-enum EENotifyType
-{
- /// EditEngine text was modified
- EE_NOTIFY_TEXTMODIFIED,
-
- /// A paragraph was inserted into the EditEngine
- EE_NOTIFY_PARAGRAPHINSERTED,
-
- /// A paragraph was removed from the EditEngine
- EE_NOTIFY_PARAGRAPHREMOVED,
-
- /// Multiple paragraphs have been removed from the EditEngine
- EE_NOTIFY_PARAGRAPHSMOVED,
-
- /// The height of at least one paragraph has changed
- EE_NOTIFY_TEXTHEIGHTCHANGED,
-
- /// The view area of the EditEngine scrolled
- EE_NOTIFY_TEXTVIEWSCROLLED,
-
- /// The selection and/or the cursor position has changed
- EE_NOTIFY_TEXTVIEWSELECTIONCHANGED,
-
- /** Denotes the beginning of a collected amount of EditEngine
- notification events. This event itself is not queued, but sent
- immediately
- */
- EE_NOTIFY_BLOCKNOTIFICATION_START,
-
- /** Denotes the end of a collected amount of EditEngine
- notification events. After this event, the queue is empty, and
- a high-level operation such as "insert paragraph" is finished
- */
- EE_NOTIFY_BLOCKNOTIFICATION_END,
-
- /// Denotes the beginning of a high-level action triggered by a key press
- EE_NOTIFY_INPUT_START,
-
- /// Denotes the end of a high-level action triggered by a key press
- EE_NOTIFY_INPUT_END
-};
-
-struct EENotify
-{
- EENotifyType eNotificationType;
- EditEngine* pEditEngine;
- EditView* pEditView;
-
- sal_uInt16 nParagraph; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED
-
- sal_uInt16 nParam1;
- sal_uInt16 nParam2;
-
- EENotify( EENotifyType eType )
- { eNotificationType = eType; pEditEngine = NULL; pEditView = NULL; nParagraph = EE_PARA_NOT_FOUND; nParam1 = 0; nParam2 = 0; }
-};
-
-#endif // _MyEDITDATA_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
deleted file mode 100644
index ed62964750..0000000000
--- a/editeng/inc/editeng/editeng.hxx
+++ /dev/null
@@ -1,496 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-// MyEDITENG, due to exported EditEng
-#ifndef _MyEDITENG_HXX
-#define _MyEDITENG_HXX
-
-class ImpEditEngine;
-class EditView;
-class OutputDevice;
-class EditUndo;
-class SvxFont;
-class SfxItemPool;
-class SfxStyleSheet;
-class String;
-class SfxStyleSheetPool;
-class SvxSearchItem;
-class SvxFieldItem;
-class SvxCharSetColorItem;
-class SfxUndoAction;
-class MapMode;
-class Color;
-class Font;
-class KeyEvent;
-class PolyPolygon;
-class Size;
-class Point;
-class Rectangle;
-class SvStream;
-class Link;
-class OutputDevice;
-class Window;
-class SvUShorts;
-class SfxPoolItem;
-class SvxNumBulletItem;
-class SvxBulletItem;
-class SvxLRSpaceItem;
-class SvKeyValueIterator;
-class SvxForbiddenCharactersTable;
-class SvxNumberFormat;
-class FontList;
-
-#include <rtl/ref.hxx>
-#include <vector>
-#include <com/sun/star/uno/Reference.h>
-
-namespace com { namespace sun { namespace star {
- namespace linguistic2 {
- class XSpellChecker1;
- class XHyphenator;
- }
- namespace datatransfer {
- class XTransferable;
- }
- namespace lang {
- struct Locale;
- }
-}}}
-namespace svx{
-struct SpellPortion;
-typedef std::vector<SpellPortion> SpellPortions;
-}
-namespace svl{
-class IUndoManager;
-}
-
-namespace basegfx { class B2DPolyPolygon; }
-#include <rsc/rscsfx.hxx>
-#include <editeng/editdata.hxx>
-#include <i18npool/lang.h>
-#include "editeng/editengdllapi.h"
-
-#include <tools/rtti.hxx> // due to typedef TypeId
-
-#include <editeng/eedata.hxx>
-class SvxFieldData;
-
-//////////////////////////////////////////////////////////////////////////////
-
-/** values for GetAttribs
-*/
-const sal_uInt8 EditEngineAttribs_All = 0; /// returns all attributes even when theire not set
-const sal_uInt8 EditEngineAttribs_HardAndPara = 1; /// returns all attributes set on paragraph and on portions
-const sal_uInt8 EditEngineAttribs_OnlyHard = 2; /// returns only attributes hard set on portions
-
-#define GETATTRIBS_STYLESHEET (sal_uInt8)0x01
-#define GETATTRIBS_PARAATTRIBS (sal_uInt8)0x02
-#define GETATTRIBS_CHARATTRIBS (sal_uInt8)0x04
-#define GETATTRIBS_ALL (sal_uInt8)0xFF
-
-class EDITENG_DLLPUBLIC EditEngine
-{
- friend class EditView;
- friend class ImpEditView;
- friend class EditDbg;
- friend class Outliner;
-
-private:
- ImpEditEngine* pImpEditEngine;
-
- EDITENG_DLLPRIVATE EditEngine( const EditEngine& );
- EDITENG_DLLPRIVATE EditEngine& operator=( const EditEngine& );
- EDITENG_DLLPRIVATE sal_uInt8 PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, Window* pFrameWin = NULL );
-
-protected:
-
-
-public:
- EditEngine( SfxItemPool* pItemPool );
- virtual ~EditEngine();
-
- const SfxItemSet& GetEmptyItemSet();
-
- void SetDefTab( sal_uInt16 nDefTab );
- sal_uInt16 GetDefTab() const;
-
- void SetRefDevice( OutputDevice* pRefDef );
- OutputDevice* GetRefDevice() const;
-
- void SetRefMapMode( const MapMode& rMapMode );
- MapMode GetRefMapMode();
-
- void SetUpdateMode( sal_Bool bUpdate );
- sal_Bool GetUpdateMode() const;
-
- void SetBackgroundColor( const Color& rColor );
- Color GetBackgroundColor() const;
- Color GetAutoColor() const;
- void EnableAutoColor( sal_Bool b );
- sal_Bool IsAutoColorEnabled() const;
- void ForceAutoColor( sal_Bool b );
- sal_Bool IsForceAutoColor() const;
-
- void InsertView( EditView* pEditView, sal_uInt16 nIndex = EE_APPEND );
- EditView* RemoveView( EditView* pEditView );
- EditView* RemoveView( sal_uInt16 nIndex = EE_APPEND );
- EditView* GetView( sal_uInt16 nIndex = 0 ) const;
- sal_uInt16 GetViewCount() const;
- sal_Bool HasView( EditView* pView ) const;
- EditView* GetActiveView() const;
- void SetActiveView( EditView* pView );
-
- void SetPaperSize( const Size& rSize );
- const Size& GetPaperSize() const;
-
- void SetVertical( sal_Bool bVertical );
- sal_Bool IsVertical() const;
-
- void SetFixedCellHeight( sal_Bool bUseFixedCellHeight );
- sal_Bool IsFixedCellHeight() const;
-
- void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
- EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
-
- sal_uInt16 GetScriptType( const ESelection& rSelection ) const;
- LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const;
-
- void TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode );
-
- void SetAsianCompressionMode( sal_uInt16 nCompression );
- sal_uInt16 GetAsianCompressionMode() const;
-
- void SetKernAsianPunctuation( sal_Bool bEnabled );
- sal_Bool IsKernAsianPunctuation() const;
-
- void SetAddExtLeading( sal_Bool b );
- sal_Bool IsAddExtLeading() const;
-
- void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
- void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
- void ClearPolygon();
- const PolyPolygon* GetPolygon();
-
- const Size& GetMinAutoPaperSize() const;
- void SetMinAutoPaperSize( const Size& rSz );
-
- const Size& GetMaxAutoPaperSize() const;
- void SetMaxAutoPaperSize( const Size& rSz );
-
- String GetText( LineEnd eEnd = LINEEND_LF ) const;
- 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;
- xub_StrLen GetTextLen( sal_uInt16 nParagraph ) const;
- sal_uInt32 GetTextHeight( sal_uInt16 nParagraph ) const;
-
- sal_uInt16 GetParagraphCount() const;
-
- sal_uInt16 GetLineCount( sal_uInt16 nParagraph ) const;
- xub_StrLen GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
- void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
- sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- sal_uInt32 GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine = 0 );
- sal_uInt16 GetFirstLineOffset( sal_uInt16 nParagraph );
- ParagraphInfos GetParagraphInfos( sal_uInt16 nPara );
- sal_uInt16 FindParagraph( long nDocPosY );
- EPosition FindDocPosition( const Point& rDocPos ) const;
- Rectangle GetCharacterBounds( const EPosition& rPos ) const;
-
- String GetWord( sal_uInt16 nPara, xub_StrLen nIndex );
-
- ESelection GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const;
- ESelection WordLeft( const ESelection& rSelection, sal_uInt16 nWordType ) const;
- ESelection WordRight( const ESelection& rSelection, sal_uInt16 nWordType ) const;
- ESelection CursorLeft( const ESelection& rSelection, sal_uInt16 nCharacterIteratorMode ) const;
- ESelection CursorRight( const ESelection& rSelection, sal_uInt16 nCharacterIteratorMode ) const;
- ESelection SelectSentence( const ESelection& rCurSel ) const;
-
- void Clear();
- void SetText( const String& rStr );
-
- EditTextObject* CreateTextObject();
- EditTextObject* CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas = 1 );
- EditTextObject* CreateTextObject( const ESelection& rESelection );
- void SetText( const EditTextObject& rTextObject );
-
- void RemoveParagraph( sal_uInt16 nPara );
- void InsertParagraph( sal_uInt16 nPara, const EditTextObject& rTxtObj );
- void InsertParagraph( sal_uInt16 nPara, const String& rText);
-
- void SetText( sal_uInt16 nPara, const EditTextObject& rTxtObj );
- void SetText( sal_uInt16 nPara, const String& rText);
-
- virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
- virtual const SfxItemSet& GetParaAttribs( sal_uInt16 nPara ) const;
-
- void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const;
-
- SfxItemSet GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const;
- SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All );
-
- sal_Bool HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
- const SfxPoolItem& GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich );
-
- Font GetStandardFont( sal_uInt16 nPara );
- SvxFont GetStandardSvxFont( sal_uInt16 nPara );
-
- void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
-
- void ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow = sal_True );
- sal_Bool IsParagraphVisible( sal_uInt16 nParagraph );
-
- ::svl::IUndoManager&
- GetUndoManager();
- void UndoActionStart( sal_uInt16 nId );
- void UndoActionEnd( sal_uInt16 nId );
- sal_Bool IsInUndo();
-
- void EnableUndo( sal_Bool bEnable );
- sal_Bool IsUndoEnabled();
-
- /** returns the value last used for bTryMerge while calling ImpEditEngine::InsertUndo
- This is currently used in a bad but needed hack to get undo actions merged in the
- OutlineView in impress. Do not use it unless you want to sell your soul too! */
- sal_Bool HasTriedMergeOnLastAddUndo() const;
-
- void ClearModifyFlag();
- void SetModified();
- sal_Bool IsModified() const;
-
- void SetModifyHdl( const Link& rLink );
- Link GetModifyHdl() const;
-
- sal_Bool IsInSelectionMode() const;
- void StopSelectionMode();
-
- void StripPortions();
- void GetPortions( sal_uInt16 nPara, SvUShorts& rList );
-
- long GetFirstLineStartX( sal_uInt16 nParagraph );
- Point GetDocPosTopLeft( sal_uInt16 nParagraph );
- Point GetDocPos( const Point& rPaperPos ) const;
- sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 );
-
- // 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: Error code of the stream.
- sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
- sal_uLong Write( SvStream& rOutput, EETextFormat );
-
- void SetStatusEventHdl( const Link& rLink );
- Link GetStatusEventHdl() const;
-
- void SetNotifyHdl( const Link& rLink );
- Link GetNotifyHdl() const;
-
- void SetImportHdl( const Link& rLink );
- Link GetImportHdl() const;
-
- // Do not evaluate font formatting => For Outliner
- sal_Bool IsFlatMode() const;
- void SetFlatMode( sal_Bool bFlat );
-
- void SetControlWord( sal_uInt32 nWord );
- sal_uInt32 GetControlWord() const;
-
- void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
- void QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 );
- void QuickMarkInvalid( const ESelection& rSel );
- void QuickFormatDoc( sal_Bool bFull = sal_False );
- void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
- void QuickInsertLineBreak( const ESelection& rSel );
- void QuickInsertText( const String& rText, const ESelection& rSel );
- void QuickDelete( const ESelection& rSel );
- void QuickMarkToBeRepainted( sal_uInt16 nPara );
-
- void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 );
- void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY );
- void DoStretchChars( sal_uInt16 nX, sal_uInt16 nY );
-
- void SetEditTextObjectPool( SfxItemPool* pPool );
- SfxItemPool* GetEditTextObjectPool() const;
-
- void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
- SfxStyleSheetPool* GetStyleSheetPool();
-
- void SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle );
- SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const;
-
- void SetWordDelimiters( const String& rDelimiters );
- String GetWordDelimiters() const;
-
- void SetGroupChars( const String& rChars );
- String GetGroupChars() const;
-
- void EnablePasteSpecial( sal_Bool bEnable );
- sal_Bool IsPasteSpecialEnabled() const;
-
- void EnableIdleFormatter( sal_Bool bEnable );
- sal_Bool IsIdleFormatterEnabled() const;
-
- void EraseVirtualDevice();
-
- void SetSpeller( ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 >
- GetSpeller();
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator >
- GetHyphenator() const;
- void SetHyphenator( ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator >& xHyph );
-
- void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
- rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const;
-
- void SetDefaultLanguage( LanguageType eLang );
- LanguageType GetDefaultLanguage() const;
-
- sal_Bool HasOnlineSpellErrors() const;
- void CompleteOnlineSpelling();
-
- void SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount );
- sal_uInt16 GetBigTextObjectStart() const;
- sal_Bool ShouldCreateBigTextObject() const;
-
- // For fast Pre-Test without view:
- EESpellState HasSpellErrors();
- sal_Bool HasText( const SvxSearchItem& rSearchItem );
-
- //initialize sentence spelling
- void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
- //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
- void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck );
- //deinitialize sentence spelling
- void EndSpelling();
-
- // for text conversion (see also HasSpellErrors)
- sal_Bool HasConvertibleTextPortion( LanguageType nLang );
- virtual sal_Bool ConvertNextDocument();
-
- sal_Bool UpdateFields();
- void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL );
-
- sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
- EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
-
- sal_Bool IsRightToLeft( sal_uInt16 nPara ) const;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >
- CreateTransferable( const ESelection& rSelection ) const;
-
- // MT: Can't create new virtual functions like for ParagraphInserted/Deleted, musst be compatible in SRC638, change later...
- void SetBeginMovingParagraphsHdl( const Link& rLink );
- void SetEndMovingParagraphsHdl( const Link& rLink );
- void SetBeginPasteOrDropHdl( const Link& rLink );
- void SetEndPasteOrDropHdl( const Link& rLink );
-
- virtual void PaintingFirstLine( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev );
- virtual void ParagraphInserted( sal_uInt16 nNewParagraph );
- virtual void ParagraphDeleted( sal_uInt16 nDeletedParagraph );
- virtual void ParagraphConnected( sal_uInt16 nLeftParagraph, sal_uInt16 nRightParagraph );
- virtual void ParaAttribsChanged( sal_uInt16 nParagraph );
- virtual void StyleSheetChanged( SfxStyleSheet* pStyle );
- virtual void ParagraphHeightChanged( sal_uInt16 nPara );
-
- 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,
- const EEngineData::WrongSpellVector* pWrongSpellVector,
- const SvxFieldData* pFieldData,
- bool bEndOfLine,
- bool bEndOfParagraph,
- bool bEndOfBullet,
- const ::com::sun::star::lang::Locale* pLocale,
- 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();
- virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
- virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
- virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor );
-
- // to be overloaded if access to bullet information needs to be provided
- virtual const SvxNumberFormat * GetNumberFormat( sal_uInt16 nPara ) const;
-
- virtual Rectangle GetBulletArea( sal_uInt16 nPara );
-
- static SfxItemPool* CreatePool( sal_Bool bLoadRefCounts = sal_True );
- static SfxItemPool& GetGlobalItemPool();
- static sal_uInt32 RegisterClipboardFormatName();
- static sal_Bool DoesKeyChangeText( const KeyEvent& rKeyEvent );
- static sal_Bool DoesKeyMoveCursor( const KeyEvent& rKeyEvent );
- static sal_Bool IsSimpleCharInput( const KeyEvent& rKeyEvent );
- static sal_uInt16 GetAvailableSearchOptions();
- static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const Font& rFont );
- static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const SvxFont& rFont );
- static Font CreateFontFromItemSet( const SfxItemSet& rItemSet );
- static Font CreateFontFromItemSet( const SfxItemSet& rItemSet, sal_uInt16 nScriptType );
- static SvxFont CreateSvxFontFromItemSet( const SfxItemSet& rItemSet );
- static void ImportBulletItem( SvxNumBulletItem& rNumBullet, sal_uInt16 nLevel, const SvxBulletItem* pOldBullet, const SvxLRSpaceItem* pOldLRSpace );
- static sal_Bool IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); }
- static sal_Bool HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable );
-
- /** sets a link that is called at the beginning of a drag operation at an edit view */
- void SetBeginDropHdl( const Link& rLink );
- Link GetBeginDropHdl() const;
-
- /** sets a link that is called at the end of a drag operation at an edit view */
- void SetEndDropHdl( const Link& rLink );
- Link GetEndDropHdl() const;
-
- /// specifies if auto-correction should capitalize the first word or not (default is on)
- void SetFirstWordCapitalization( sal_Bool bCapitalize );
- sal_Bool IsFirstWordCapitalization() const;
-};
-
-#endif // _MyEDITENG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/editengdllapi.h b/editeng/inc/editeng/editengdllapi.h
deleted file mode 100755
index 6e916385ac..0000000000
--- a/editeng/inc/editeng/editengdllapi.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 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.
- *
- ************************************************************************/
-
-#ifndef INCLUDED_EDITENGDLLAPI_H
-#define INCLUDED_EDITENGDLLAPI_H
-
-#include "sal/types.h"
-
-#if defined(EDITENG_DLLIMPLEMENTATION)
-#define EDITENG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
-#else
-#define EDITENG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
-#endif
-#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
deleted file mode 100644
index cb1968bb0f..0000000000
--- a/editeng/inc/editeng/editerr.hxx
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 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.
- *
- ************************************************************************/
-#ifndef _EDIT_ERR_HRC
-#define _EDIT_ERR_HRC
-
-#include <tools/errcode.hxx>
-
-#define ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS (2UL | ERRCODE_AREA_SVX)
-
-#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
deleted file mode 100755
index d48a6f3108..0000000000
--- a/editeng/inc/editeng/editids.hrc
+++ /dev/null
@@ -1,246 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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 _EDIT_SVXIDS_HRC
-#define _EDIT_SVXIDS_HRC
-
-// include ------------------------------------------------------------------
-
-#include <svl/solar.hrc>
-
-#define SID_ATTR_BRUSH ( SID_SVX_START + 1 )
-#define SID_ATTR_TABSTOP ( SID_SVX_START + 2 )
-#define SID_ATTR_TABSTOP_DEFAULTS ( SID_SVX_START + 3 )
-#define SID_ATTR_TABSTOP_POS ( SID_SVX_START + 4 )
-#define SID_ATTR_TABSTOP_OFFSET ( SID_SVX_START + 5 )
-#define SID_ATTR_CHAR ( SID_SVX_START + 6 )
-#define SID_ATTR_CHAR_FONT ( SID_SVX_START + 7 )
-#define SID_ATTR_CHAR_POSTURE ( SID_SVX_START + 8 )
-#define SID_ATTR_CHAR_WEIGHT ( SID_SVX_START + 9 )
-#define SID_ATTR_CHAR_SHADOWED ( SID_SVX_START + 10 )
-#define SID_ATTR_CHAR_WORDLINEMODE ( SID_SVX_START + 11 )
-#define SID_ATTR_CHAR_CONTOUR ( SID_SVX_START + 12 )
-#define SID_ATTR_CHAR_STRIKEOUT ( SID_SVX_START + 13 )
-#define SID_ATTR_CHAR_UNDERLINE ( SID_SVX_START + 14 )
-#define SID_ATTR_CHAR_FONTHEIGHT ( SID_SVX_START + 15 )
-#define SID_ATTR_CHAR_PROPSIZE ( SID_SVX_START + 16 )
-#define SID_ATTR_CHAR_COLOR ( SID_SVX_START + 17 )
-#define SID_ATTR_CHAR_KERNING ( SID_SVX_START + 18 )
-#define SID_ATTR_CHAR_CASEMAP ( SID_SVX_START + 19 )
-#define SID_ATTR_CHAR_LANGUAGE ( SID_SVX_START + 20 )
-#define SID_ATTR_CHAR_ESCAPEMENT ( SID_SVX_START + 21 )
-#define SID_ATTR_CHAR_FONTLIST ( SID_SVX_START + 22 )
-#define SID_ATTR_BORDER_OUTER ( SID_SVX_START + 24 )
-#define SID_ATTR_BORDER_SHADOW ( SID_SVX_START + 25 )
-#define SID_ATTR_PARA ( SID_SVX_START + 26 )
-#define SID_ATTR_PARA_ADJUST ( SID_SVX_START + 27 )
-#define SID_ATTR_PARA_ADJUST_LEFT ( SID_SVX_START + 28 )
-#define SID_ATTR_PARA_ADJUST_RIGHT ( SID_SVX_START + 29 )
-#define SID_ATTR_PARA_ADJUST_CENTER ( SID_SVX_START + 30 )
-#define SID_ATTR_PARA_ADJUST_BLOCK ( SID_SVX_START + 31 )
-#define SID_ATTR_PARA_ADJUST_BLOCKLINE ( SID_SVX_START + 32 )
-#define SID_ATTR_PARA_LINESPACE ( SID_SVX_START + 33 )
-#define SID_ATTR_PARA_LINESPACE_10 ( SID_SVX_START + 34 )
-#define SID_ATTR_PARA_LINESPACE_15 ( SID_SVX_START + 35 )
-#define SID_ATTR_PARA_LINESPACE_20 ( SID_SVX_START + 36 )
-#define SID_ATTR_PARA_PAGEBREAK ( SID_SVX_START + 37 )
-#define SID_ATTR_PARA_HYPHENZONE ( SID_SVX_START + 38 )
-#define SID_ATTR_PARA_SPLIT ( SID_SVX_START + 39 )
-#define SID_ATTR_PARA_ORPHANS ( SID_SVX_START + 40 )
-#define SID_ATTR_PARA_WIDOWS ( SID_SVX_START + 41 )
-#define SID_ATTR_PARA_ULSPACE ( SID_SVX_START + 42 )
-#define SID_ATTR_PARA_LRSPACE ( SID_SVX_START + 43 )
-#define SID_ATTR_LRSPACE ( SID_SVX_START + 48 )
-#define SID_ATTR_ULSPACE ( SID_SVX_START + 49 )
-#define SID_ATTR_CHAR_MAPTYPE ( SID_SVX_START + 64 )
-#define SID_ATTR_PARA_MODEL ( SID_SVX_START + 65 )
-#define SID_ATTR_PARA_KEEP ( SID_SVX_START + 66 )
-#define SID_ATTR_CHAR_AUTOKERN ( SID_SVX_START + 67 )
-#define SID_ATTR_PARA_BULLET ( SID_SVX_START + 250 )
-#define SID_ATTR_PARA_OUTLLEVEL ( SID_SVX_START + 300 )
-#define SID_FIELD ( SID_SVX_START + 363 )
-#define SID_ATTR_PARA_REGISTER ( SID_SVX_START + 413 )
-#define SID_ATTR_PARA_PAGENUM ( SID_SVX_START + 457 )
-#define SID_ATTR_PARA_NUMRULE ( SID_SVX_START + 587 )
-#define SID_ATTR_BRUSH_CHAR ( SID_SVX_START + 591 )
-#define SID_ATTR_NUMBERING_RULE ( SID_SVX_START + 855 )
-#define SID_ATTR_CHAR_CHARSETCOLOR ( SID_SVX_START + 877 )
-#define SID_ATTR_CHAR_CJK_FONT ( SID_SVX_START + 887 )
-#define SID_ATTR_CHAR_CJK_FONTHEIGHT ( SID_SVX_START + 888 )
-#define SID_ATTR_CHAR_CJK_LANGUAGE ( SID_SVX_START + 889 )
-#define SID_ATTR_CHAR_CJK_POSTURE ( SID_SVX_START + 890 )
-#define SID_ATTR_CHAR_CJK_WEIGHT ( SID_SVX_START + 891 )
-#define SID_ATTR_CHAR_CTL_FONT ( SID_SVX_START + 892 )
-#define SID_ATTR_CHAR_CTL_FONTHEIGHT ( SID_SVX_START + 893 )
-#define SID_ATTR_CHAR_CTL_LANGUAGE ( SID_SVX_START + 894 )
-#define SID_ATTR_CHAR_CTL_POSTURE ( SID_SVX_START + 895 )
-#define SID_ATTR_CHAR_CTL_WEIGHT ( SID_SVX_START + 896 )
-#define SID_ATTR_CHAR_TWO_LINES ( SID_SVX_START + 897 )
-#define SID_ATTR_CHAR_CJK_RUBY ( SID_SVX_START + 898 )
-#define SID_ATTR_CHAR_EMPHASISMARK ( SID_SVX_START + 899 )
-#define SID_ATTR_CHAR_SCRIPTTYPE ( SID_SVX_START + 900 )
-#define SID_ATTR_PARA_SCRIPTSPACE ( SID_SVX_START + 901 )
-#define SID_ATTR_PARA_HANGPUNCTUATION ( SID_SVX_START + 902 )
-#define SID_ATTR_PARA_FORBIDDEN_RULES ( SID_SVX_START + 903 )
-#define SID_ATTR_CHAR_VERTICAL ( SID_SVX_START + 905 )
-#define SID_ATTR_CHAR_ROTATED ( SID_SVX_START + 910 )
-#define SID_ATTR_CHAR_SCALEWIDTH ( SID_SVX_START + 911 )
-#define SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ( SID_SVX_START + 919 )
-#define SID_ATTR_CHAR_RELIEF ( SID_SVX_START + 920 )
-#define SID_PARA_VERTALIGN ( SID_SVX_START + 925 )
-#define SID_ATTR_FRAMEDIRECTION ( SID_SVX_START + 944 )
-#define SID_ATTR_PARA_SNAPTOGRID ( SID_SVX_START + 945 )
-#define SID_ATTR_PARA_LRSPACE_VERTICAL ( SID_SVX_START + 947 )
-#define SID_ATTR_PARA_LEFT_TO_RIGHT ( SID_SVX_START + 950 )
-#define SID_ATTR_PARA_RIGHT_TO_LEFT ( SID_SVX_START + 951 )
-#define SID_ATTR_CHAR_HIDDEN ( SID_SVX_START + 989 )
-#define SID_ATTR_CHAR_LATIN_FONT ( SID_SVX_START + 994 )
-#define SID_ATTR_CHAR_LATIN_FONTHEIGHT ( SID_SVX_START + 995 )
-#define SID_ATTR_CHAR_LATIN_LANGUAGE ( SID_SVX_START + 996 )
-#define SID_ATTR_CHAR_LATIN_POSTURE ( SID_SVX_START + 997 )
-#define SID_ATTR_CHAR_LATIN_WEIGHT ( SID_SVX_START + 998 )
-#define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_SVX_START +1092 )
-
-// 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
-#define SID_PARA_VERTALIGN ( SID_EDIT_START )
-#define SID_ATTR_BORDER_OUTER ( SID_EDIT_START + 1 )
-#define SID_ATTR_BORDER_SHADOW ( SID_EDIT_START + 2 )
-#define SID_ATTR_BRUSH ( SID_EDIT_START + 3 )
-#define SID_ATTR_BRUSH_CHAR ( SID_EDIT_START + 4 )
-
-
-#define SID_FIELD ( SID_EDIT_START + 7 )
-#define SID_ATTR_FRAMEDIRECTION ( SID_EDIT_START + 8 )
-#define SID_ATTR_PARA ( SID_EDIT_START + 9 )
-#define SID_ATTR_PARA_ADJUST ( SID_EDIT_START + 10 )
-#define SID_ATTR_PARA_ADJUST_LEFT ( SID_EDIT_START + 11 )
-#define SID_ATTR_PARA_BULLET ( SID_EDIT_START + 12 )
-#define SID_ATTR_PARA_OUTLLEVEL ( SID_EDIT_START + 13 )
-#define SID_ATTR_PARA_REGISTER ( SID_EDIT_START + 14 )
-#define SID_ATTR_PARA_PAGENUM ( SID_EDIT_START + 15 )
-#define SID_ATTR_PARA_NUMRULE ( SID_EDIT_START + 16 )
-#define SID_ATTR_PARA_SCRIPTSPACE ( SID_EDIT_START + 17 )
-#define SID_ATTR_PARA_HANGPUNCTUATION ( SID_EDIT_START + 18 )
-#define SID_ATTR_PARA_FORBIDDEN_RULES ( SID_EDIT_START + 19 )
-#define SID_ATTR_PARA_SNAPTOGRID ( SID_EDIT_START + 20 )
-#define SID_ATTR_PARA_LRSPACE_VERTICAL ( SID_EDIT_START + 21 )
-#define SID_ATTR_PARA_LEFT_TO_RIGHT ( SID_EDIT_START + 22 )
-#define SID_ATTR_PARA_RIGHT_TO_LEFT ( SID_EDIT_START + 23 )
-#define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_EDIT_START + 24 )
-#define SID_ATTR_PARA_ADJUST_RIGHT ( SID_EDIT_START + 25 )
-#define SID_ATTR_PARA_ADJUST_CENTER ( SID_EDIT_START + 26 )
-#define SID_ATTR_PARA_ADJUST_BLOCK ( SID_EDIT_START + 27 )
-#define SID_ATTR_PARA_ADJUST_BLOCKLINE ( SID_EDIT_START + 28 )
-#define SID_ATTR_PARA_LINESPACE ( SID_EDIT_START + 29 )
-#define SID_ATTR_PARA_LINESPACE_10 ( SID_EDIT_START + 30 )
-#define SID_ATTR_PARA_LINESPACE_15 ( SID_EDIT_START + 31 )
-#define SID_ATTR_PARA_LINESPACE_20 ( SID_EDIT_START + 32 )
-#define SID_ATTR_PARA_PAGEBREAK ( SID_EDIT_START + 33 )
-#define SID_ATTR_PARA_HYPHENZONE ( SID_EDIT_START + 34 )
-#define SID_ATTR_PARA_SPLIT ( SID_EDIT_START + 35 )
-#define SID_ATTR_PARA_ORPHANS ( SID_EDIT_START + 36 )
-#define SID_ATTR_PARA_WIDOWS ( SID_EDIT_START + 37 )
-#define SID_ATTR_PARA_ULSPACE ( SID_EDIT_START + 38 )
-#define SID_ATTR_PARA_LRSPACE ( SID_EDIT_START + 39 )
-#define SID_ATTR_PARA_MODEL ( SID_EDIT_START + 40 )
-#define SID_ATTR_PARA_KEEP ( SID_EDIT_START + 41 )
-#define SID_ATTR_NUMBERING_RULE ( SID_EDIT_START + 42 )
-#define SID_ATTR_LRSPACE ( SID_EDIT_START + 43 )
-#define SID_ATTR_ULSPACE ( SID_EDIT_START + 44 )
-#define SID_ATTR_TABSTOP ( SID_EDIT_START + 45 )
-#define SID_ATTR_TABSTOP_DEFAULTS ( SID_EDIT_START + 46 )
-#define SID_ATTR_TABSTOP_POS ( SID_EDIT_START + 47 )
-#define SID_ATTR_TABSTOP_OFFSET ( SID_EDIT_START + 48 )
-#define SID_ATTR_CHAR ( SID_EDIT_START + 49 )
-#define SID_ATTR_CHAR_FONT ( SID_EDIT_START + 50 )
-#define SID_ATTR_CHAR_POSTURE ( SID_EDIT_START + 51 )
-#define SID_ATTR_CHAR_WEIGHT ( SID_EDIT_START + 52 )
-#define SID_ATTR_CHAR_SHADOWED ( SID_EDIT_START + 53 )
-#define SID_ATTR_CHAR_WORDLINEMODE ( SID_EDIT_START + 54 )
-#define SID_ATTR_CHAR_CONTOUR ( SID_EDIT_START + 55 )
-#define SID_ATTR_CHAR_STRIKEOUT ( SID_EDIT_START + 56 )
-#define SID_ATTR_CHAR_UNDERLINE ( SID_EDIT_START + 57 )
-#define SID_ATTR_CHAR_FONTHEIGHT ( SID_EDIT_START + 58 )
-#define SID_ATTR_CHAR_PROPSIZE ( SID_EDIT_START + 59 )
-#define SID_ATTR_CHAR_COLOR ( SID_EDIT_START + 60 )
-#define SID_ATTR_CHAR_KERNING ( SID_EDIT_START + 61 )
-#define SID_ATTR_CHAR_CASEMAP ( SID_EDIT_START + 62 )
-#define SID_ATTR_CHAR_LANGUAGE ( SID_EDIT_START + 63 )
-#define SID_ATTR_CHAR_ESCAPEMENT ( SID_EDIT_START + 64 )
-#define SID_ATTR_CHAR_FONTLIST ( SID_EDIT_START + 65 )
-#define SID_ATTR_CHAR_MAPTYPE ( SID_EDIT_START + 66 )
-#define SID_ATTR_CHAR_AUTOKERN ( SID_EDIT_START + 67 )
-#define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 )
-#define SID_ATTR_CHAR_CHARSETCOLOR ( SID_EDIT_START + 69 )
-#define SID_ATTR_CHAR_CJK_FONT ( SID_EDIT_START + 70 )
-#define SID_ATTR_CHAR_CJK_FONTHEIGHT ( SID_EDIT_START + 71 )
-#define SID_ATTR_CHAR_CJK_LANGUAGE ( SID_EDIT_START + 72 )
-#define SID_ATTR_CHAR_CJK_POSTURE ( SID_EDIT_START + 73 )
-#define SID_ATTR_CHAR_CJK_WEIGHT ( SID_EDIT_START + 74 )
-#define SID_ATTR_CHAR_CTL_FONT ( SID_EDIT_START + 75 )
-#define SID_ATTR_CHAR_CTL_FONTHEIGHT ( SID_EDIT_START + 76 )
-#define SID_ATTR_CHAR_CTL_LANGUAGE ( SID_EDIT_START + 77 )
-#define SID_ATTR_CHAR_CTL_POSTURE ( SID_EDIT_START + 78 )
-#define SID_ATTR_CHAR_CTL_WEIGHT ( SID_EDIT_START + 79 )
-#define SID_ATTR_CHAR_TWO_LINES ( SID_EDIT_START + 80 )
-#define SID_ATTR_CHAR_CJK_RUBY ( SID_EDIT_START + 81 )
-#define SID_ATTR_CHAR_EMPHASISMARK ( SID_EDIT_START + 82 )
-#define SID_ATTR_CHAR_SCRIPTTYPE ( SID_EDIT_START + 83 )
-#define SID_ATTR_CHAR_VERTICAL ( SID_EDIT_START + 84 )
-#define SID_ATTR_CHAR_ROTATED ( SID_EDIT_START + 85 )
-#define SID_ATTR_CHAR_SCALEWIDTH ( SID_EDIT_START + 86 )
-#define SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ( SID_EDIT_START + 87 )
-#define SID_ATTR_CHAR_RELIEF ( SID_EDIT_START + 88 )
-#define SID_ATTR_CHAR_HIDDEN ( SID_EDIT_START + 89 )
-#define SID_ATTR_CHAR_LATIN_FONT ( SID_EDIT_START + 90 )
-#define SID_ATTR_CHAR_LATIN_FONTHEIGHT ( SID_EDIT_START + 91 )
-#define SID_ATTR_CHAR_LATIN_LANGUAGE ( SID_EDIT_START + 92 )
-#define SID_ATTR_CHAR_LATIN_POSTURE ( SID_EDIT_START + 93 )
-#define SID_ATTR_CHAR_LATIN_WEIGHT ( SID_EDIT_START + 94 )
-*/
-
-#if 94 > (SID_EDIT_END-SID_EDIT_START)
-#error Resource-Ueberlauf in #line, #file
-#endif
-
-#define SID_TEXT_ALIGNLEFT SID_ATTR_PARA_ADJUST_LEFT
-#define SID_TEXT_ALIGNRIGHT SID_ATTR_PARA_ADJUST_RIGHT
-#define SID_TEXT_ALIGNCENTER SID_ATTR_PARA_ADJUST_CENTER
-#define SID_TEXT_ALIGNBLOCK SID_ATTR_PARA_ADJUST_BLOCK
-#define SID_DRAW_TEXT_VERTICAL SID_ATTR_CHAR_VERTICAL
-
-#endif
-
-// ******************************************************************* EOF
-
diff --git a/editeng/inc/editeng/editobj.hxx b/editeng/inc/editeng/editobj.hxx
deleted file mode 100644
index 3ac253c630..0000000000
--- a/editeng/inc/editeng/editobj.hxx
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDITOBJ_HXX
-#define _EDITOBJ_HXX
-
-#include <tools/stream.hxx>
-#include <tools/debug.hxx>
-#include <rsc/rscsfx.hxx>
-#include <svl/itemset.hxx>
-#include <editeng/eeitem.hxx>
-#include "editeng/editengdllapi.h"
-
-DBG_NAMEEX( EE_EditTextObject )
-
-class SfxItemPool;
-class SfxStyleSheetPool;
-class SvxFieldItem;
-class EECharAttribArray;
-
-#define EDTOBJ_SETTINGS_ULITEMSUMMATION 0x00000001
-#define EDTOBJ_SETTINGS_ULITEMFIRSTPARA 0x00000002
-
-class EDITENG_DLLPUBLIC EditTextObject
-{
-private:
- sal_uInt16 nWhich;
- EDITENG_DLLPRIVATE EditTextObject& operator=( const EditTextObject& );
-
-protected:
- EditTextObject( sal_uInt16 nWhich );
- EditTextObject( const EditTextObject& r );
-
- virtual void StoreData( SvStream& rOStream ) const;
- virtual void CreateData( SvStream& rIStream );
-
-public:
- virtual ~EditTextObject();
-
- sal_uInt16 Which() const { return nWhich; }
-
- 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;
- virtual void SetObjectSettings( sal_uLong n );
-
- virtual sal_Bool IsVertical() const;
- virtual void SetVertical( sal_Bool bVertical );
-
- virtual sal_uInt16 GetScriptType() const;
-
- virtual sal_uInt16 GetVersion() const; // As long as the outliner does not store any record length.
-
- virtual EditTextObject* Clone() const = 0;
-
- sal_Bool Store( SvStream& rOStream ) const;
- static EditTextObject* Create( SvStream& rIStream,
- SfxItemPool* pGlobalTextObjectPool = 0 );
- void Skip( SvStream& rIStream );
-
- virtual sal_uInt16 GetParagraphCount() const;
-
- virtual XubString GetText( sal_uInt16 nParagraph ) const;
- virtual void Insert( const EditTextObject& rObj, sal_uInt16 nPara );
- virtual void RemoveParagraph( sal_uInt16 nPara );
- virtual EditTextObject* CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas = 1 ) const;
-
- virtual sal_Bool HasPortionInfo() const;
- virtual void ClearPortionInfo();
-
- virtual sal_Bool HasOnlineSpellErrors() const;
-
- virtual sal_Bool HasCharAttribs( sal_uInt16 nWhich = 0 ) const;
- virtual void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const;
-
- virtual sal_Bool RemoveCharAttribs( sal_uInt16 nWhich = 0 );
- virtual sal_Bool RemoveParaAttribs( sal_uInt16 nWhich = 0 );
-
- virtual void MergeParaAttribs( const SfxItemSet& rAttribs, sal_uInt16 nStart = EE_CHAR_START, sal_uInt16 nEnd = EE_CHAR_END );
-
- virtual sal_Bool IsFieldObject() const;
- virtual const SvxFieldItem* GetField() const;
- virtual sal_Bool HasField( TypeId aType = NULL ) const;
-
- virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
- virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rAttribs );
-
- virtual sal_Bool HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const;
- virtual void GetStyleSheet( sal_uInt16 nPara, XubString& rName, SfxStyleFamily& eFamily ) const;
- virtual void SetStyleSheet( sal_uInt16 nPara, const XubString& rName, const SfxStyleFamily& eFamily );
- virtual sal_Bool ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily,
- const XubString& rNewName, SfxStyleFamily eNewFamily );
- virtual void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName );
-
- bool operator==( const EditTextObject& rCompare ) const;
-
- // #i102062#
- bool isWrongListEqual(const EditTextObject& rCompare) const;
-};
-
-#endif // _EDITOBJ_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/editrids.hrc b/editeng/inc/editeng/editrids.hrc
deleted file mode 100755
index c0a61e2b40..0000000000
--- a/editeng/inc/editeng/editrids.hrc
+++ /dev/null
@@ -1,406 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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 _EDIT_RIDS_HRC
-#define _EDIT_RIDS_HRC
-
-// include ------------------------------------------------------------------
-
-#include <svl/solar.hrc>
-
-// strings also used in cui
-#define RID_SVXSTR_PAPERBIN_SETTINGS (RID_EDIT_START)
-#define RID_SVXSTR_PAPERBIN (RID_EDIT_START + 1)
-
-#define RID_OUTLUNDO_EXPAND (RID_EDIT_START + 2)
-#define RID_OUTLUNDO_COLLAPSE (RID_EDIT_START + 3)
-#define RID_OUTLUNDO_ATTR (RID_EDIT_START + 4)
-#define RID_OUTLUNDO_INSERT (RID_EDIT_START + 5)
-#define RID_OUTLUNDO_DEPTH (RID_EDIT_START + 6)
-#define RID_OUTLUNDO_HEIGHT (RID_EDIT_START + 7)
-
-// strings for items
-
-#define RID_SVXITEMS_FRMDIR_BEGIN (RID_EDIT_START + 9)
-#define RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP (RID_EDIT_START + 9)
-#define RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP (RID_EDIT_START + 10)
-#define RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT (RID_EDIT_START + 11)
-#define RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT (RID_EDIT_START + 12)
-#define RID_SVXITEMS_FRMDIR_ENVIRONMENT (RID_EDIT_START + 13)
-#define RID_SVXITEMS_FRMDIR_END (RID_EDIT_START + 14)
-
-#define RID_SVXITEMS_TRUE (RID_EDIT_START + 15)
-#define RID_SVXITEMS_FALSE (RID_EDIT_START + 16)
-#define RID_SVXITEMS_BORDER_COMPLETE (RID_EDIT_START + 17)
-#define RID_SVXITEMS_BORDER_TOP (RID_EDIT_START + 18)
-#define RID_SVXITEMS_BORDER_BOTTOM (RID_EDIT_START + 19)
-#define RID_SVXITEMS_BORDER_LEFT (RID_EDIT_START + 20)
-#define RID_SVXITEMS_BORDER_RIGHT (RID_EDIT_START + 21)
-#define RID_SVXITEMS_BORDER_DISTANCE (RID_EDIT_START + 22)
-#define RID_SVXITEMS_BORDER_NONE (RID_EDIT_START + 23)
-
-#define RID_SVXITEMS_TRANSPARENT_TRUE (RID_EDIT_START + 24)
-#define RID_SVXITEMS_TRANSPARENT_FALSE (RID_EDIT_START + 25)
-#define RID_SVXITEMS_OPAQUE_TRUE (RID_EDIT_START + 26)
-#define RID_SVXITEMS_OPAQUE_FALSE (RID_EDIT_START + 27)
-
-#define RID_SVXITEMS_SHADOW_COMPLETE (RID_EDIT_START + 28)
-#define RID_SVXITEMS_GRAPHIC (RID_EDIT_START + 29)
-#define RID_SVXITEMS_LINES (RID_EDIT_START + 30)
-#define RID_SVXITEMS_ORPHANS_COMPLETE (RID_EDIT_START + 31)
-#define RID_SVXITEMS_WIDOWS_COMPLETE (RID_EDIT_START + 32)
-#define RID_SVXITEMS_PAGEMODEL_COMPLETE (RID_EDIT_START + 33)
-
-#define RID_SVXITEMS_SHADOWED_TRUE (RID_EDIT_START + 34)
-#define RID_SVXITEMS_SHADOWED_FALSE (RID_EDIT_START + 35)
-#define RID_SVXITEMS_AUTOKERN_TRUE (RID_EDIT_START + 36)
-#define RID_SVXITEMS_AUTOKERN_FALSE (RID_EDIT_START + 37)
-#define RID_SVXITEMS_WORDLINE_TRUE (RID_EDIT_START + 38)
-#define RID_SVXITEMS_WORDLINE_FALSE (RID_EDIT_START + 39)
-#define RID_SVXITEMS_CONTOUR_TRUE (RID_EDIT_START + 40)
-#define RID_SVXITEMS_CONTOUR_FALSE (RID_EDIT_START + 41)
-#define RID_SVXITEMS_NOLINEBREAK_TRUE (RID_EDIT_START + 42)
-#define RID_SVXITEMS_NOLINEBREAK_FALSE (RID_EDIT_START + 43)
-#define RID_SVXITEMS_NOHYPHEN_TRUE (RID_EDIT_START + 44)
-#define RID_SVXITEMS_NOHYPHEN_FALSE (RID_EDIT_START + 45)
-#define RID_SVXITEMS_FMTKEEP_TRUE (RID_EDIT_START + 46)
-#define RID_SVXITEMS_FMTKEEP_FALSE (RID_EDIT_START + 47)
-#define RID_SVXITEMS_FMTSPLIT_TRUE (RID_EDIT_START + 48)
-#define RID_SVXITEMS_FMTSPLIT_FALSE (RID_EDIT_START + 49)
-#define RID_SVXITEMS_PRINT_TRUE (RID_EDIT_START + 50)
-#define RID_SVXITEMS_PRINT_FALSE (RID_EDIT_START + 51)
-#define RID_SVXITEMS_PROT_POS_TRUE (RID_EDIT_START + 52)
-#define RID_SVXITEMS_PROT_POS_FALSE (RID_EDIT_START + 53)
-#define RID_SVXITEMS_PROT_SIZE_TRUE (RID_EDIT_START + 54)
-#define RID_SVXITEMS_PROT_SIZE_FALSE (RID_EDIT_START + 55)
-#define RID_SVXITEMS_PROT_CONTENT_TRUE (RID_EDIT_START + 56)
-#define RID_SVXITEMS_PROT_CONTENT_FALSE (RID_EDIT_START + 57)
-#define RID_SVXITEMS_ULSPACE_UPPER (RID_EDIT_START + 58)
-#define RID_SVXITEMS_ULSPACE_LOWER (RID_EDIT_START + 59)
-#define RID_SVXITEMS_LRSPACE_LEFT (RID_EDIT_START + 60)
-#define RID_SVXITEMS_LRSPACE_FLINE (RID_EDIT_START + 62)
-#define RID_SVXITEMS_LRSPACE_RIGHT (RID_EDIT_START + 63)
-#define RID_SVXITEMS_SIZE_WIDTH (RID_EDIT_START + 64)
-#define RID_SVXITEMS_SIZE_HEIGHT (RID_EDIT_START + 65)
-#define RID_SVXITEMS_PAGE_END_TRUE (RID_EDIT_START + 66)
-#define RID_SVXITEMS_PAGE_END_FALSE (RID_EDIT_START + 67)
-#define RID_SVXITEMS_HYPHEN_TRUE (RID_EDIT_START + 68)
-#define RID_SVXITEMS_HYPHEN_FALSE (RID_EDIT_START + 69)
-#define RID_SVXITEMS_HYPHEN_MINLEAD (RID_EDIT_START + 70)
-#define RID_SVXITEMS_HYPHEN_MINTRAIL (RID_EDIT_START + 71)
-#define RID_SVXITEMS_HYPHEN_MAX (RID_EDIT_START + 72)
-#define RID_SVXITEMS_HNGPNCT_OFF (RID_EDIT_START + 73)
-#define RID_SVXITEMS_HNGPNCT_ON (RID_EDIT_START + 74)
-#define RID_SVXITEMS_FORBIDDEN_RULE_OFF (RID_EDIT_START + 75)
-#define RID_SVXITEMS_FORBIDDEN_RULE_ON (RID_EDIT_START + 76)
-#define RID_SVXITEMS_SCRPTSPC_OFF (RID_EDIT_START + 77)
-#define RID_SVXITEMS_SCRPTSPC_ON (RID_EDIT_START + 78)
-#define RID_SVXITEMS_CHARSCALE_OFF (RID_EDIT_START + 79)
-#define RID_SVXITEMS_CHARSCALE (RID_EDIT_START + 80)
-#define RID_SVXITEMS_CHARROTATE_OFF (RID_EDIT_START + 81)
-#define RID_SVXITEMS_CHARROTATE (RID_EDIT_START + 82)
-#define RID_SVXITEMS_CHARROTATE_FITLINE (RID_EDIT_START + 83)
-
-#define RID_SVXITEMS_RELIEF_BEGIN (RID_EDIT_START + 85)
-#define RID_SVXITEMS_RELIEF_NONE (RID_EDIT_START + 85)
-#define RID_SVXITEMS_RELIEF_EMBOSSED (RID_EDIT_START + 86)
-#define RID_SVXITEMS_RELIEF_ENGRAVED (RID_EDIT_START + 87)
-#define RID_SVXITEMS_RELIEF_END (RID_EDIT_START + 88)
-
-// HM_ERR
-#define RID_SVXSTR_HMERR_THESAURUS (RID_EDIT_START + 89)
-
-// enum FontEmphasisMark ---------------------------------------------------
-#define RID_SVXITEMS_EMPHASIS_BEGIN_STYLE (RID_EDIT_START + 90)
-#define RID_SVXITEMS_EMPHASIS_NONE_STYLE (RID_EDIT_START + 90)
-#define RID_SVXITEMS_EMPHASIS_DOT_STYLE (RID_EDIT_START + 91)
-#define RID_SVXITEMS_EMPHASIS_CIRCLE_STYLE (RID_EDIT_START + 92)
-#define RID_SVXITEMS_EMPHASIS_DISC_STYLE (RID_EDIT_START + 93)
-#define RID_SVXITEMS_EMPHASIS_ACCENT_STYLE (RID_EDIT_START + 94)
-
-#define RID_SVXITEMS_EMPHASIS_ABOVE_POS (RID_EDIT_START + 95)
-#define RID_SVXITEMS_EMPHASIS_BELOW_POS (RID_EDIT_START + 96)
-
-// enum ESCAPEMENT -------------------------------------------------------
-#define RID_SVXITEMS_ESCAPEMENT_BEGIN (RID_EDIT_START + 97)
-#define RID_SVXITEMS_ESCAPEMENT_OFF (RID_EDIT_START + 97)
-#define RID_SVXITEMS_ESCAPEMENT_SUPER (RID_EDIT_START + 98)
-#define RID_SVXITEMS_ESCAPEMENT_SUB (RID_EDIT_START + 99)
-#define RID_SVXITEMS_ESCAPEMENT_AUTO (RID_EDIT_START + 100)
-
-// enum CASEMAP ----------------------------------------------------------
-#define RID_SVXITEMS_CASEMAP_BEGIN (RID_EDIT_START + 101)
-#define RID_SVXITEMS_CASEMAP_NONE (RID_EDIT_START + 101)
-#define RID_SVXITEMS_CASEMAP_VERSALIEN (RID_EDIT_START + 102)
-#define RID_SVXITEMS_CASEMAP_GEMEINE (RID_EDIT_START + 103)
-#define RID_SVXITEMS_CASEMAP_TITEL (RID_EDIT_START + 104)
-#define RID_SVXITEMS_CASEMAP_KAPITAELCHEN (RID_EDIT_START + 105)
-
-#define RID_SVXITEMS_KERNING_COMPLETE (RID_EDIT_START + 106)
-#define RID_SVXITEMS_KERNING_EXPANDED (RID_EDIT_START + 107)
-#define RID_SVXITEMS_KERNING_CONDENSED (RID_EDIT_START + 108)
-
-#define RID_SVXITEMS_BLINK_TRUE (RID_EDIT_START + 109)
-#define RID_SVXITEMS_BLINK_FALSE (RID_EDIT_START + 110)
-
-#define RID_SVXITEMS_TWOLINES_OFF (RID_EDIT_START + 111)
-#define RID_SVXITEMS_TWOLINES (RID_EDIT_START + 112)
-
-// enum FontStrikeout ----------------------------------------------------
-#define RID_SVXITEMS_STRIKEOUT_BEGIN (RID_EDIT_START + 113)
-#define RID_SVXITEMS_STRIKEOUT_NONE (RID_EDIT_START + 113)
-#define RID_SVXITEMS_STRIKEOUT_SINGLE (RID_EDIT_START + 114)
-#define RID_SVXITEMS_STRIKEOUT_DOUBLE (RID_EDIT_START + 115)
-#define RID_SVXITEMS_STRIKEOUT_DONTKNOW (RID_EDIT_START + 116)
-#define RID_SVXITEMS_STRIKEOUT_BOLD (RID_EDIT_START + 117)
-#define RID_SVXITEMS_STRIKEOUT_SLASH (RID_EDIT_START + 118)
-#define RID_SVXITEMS_STRIKEOUT_X (RID_EDIT_START + 119)
-
-// enum FontUnderline - used for overline --------------------------------
-#define RID_SVXITEMS_OL_BEGIN (RID_EDIT_START + 120)
-#define RID_SVXITEMS_OL_NONE (RID_EDIT_START + 120)
-#define RID_SVXITEMS_OL_SINGLE (RID_EDIT_START + 121)
-#define RID_SVXITEMS_OL_DOUBLE (RID_EDIT_START + 122)
-#define RID_SVXITEMS_OL_DOTTED (RID_EDIT_START + 123)
-#define RID_SVXITEMS_OL_DONTKNOW (RID_EDIT_START + 124)
-#define RID_SVXITEMS_OL_DASH (RID_EDIT_START + 125)
-#define RID_SVXITEMS_OL_LONGDASH (RID_EDIT_START + 126)
-#define RID_SVXITEMS_OL_DASHDOT (RID_EDIT_START + 127)
-#define RID_SVXITEMS_OL_DASHDOTDOT (RID_EDIT_START + 128)
-#define RID_SVXITEMS_OL_SMALLWAVE (RID_EDIT_START + 129)
-#define RID_SVXITEMS_OL_WAVE (RID_EDIT_START + 130)
-#define RID_SVXITEMS_OL_DOUBLEWAVE (RID_EDIT_START + 131)
-#define RID_SVXITEMS_OL_BOLD (RID_EDIT_START + 132)
-#define RID_SVXITEMS_OL_BOLDDOTTED (RID_EDIT_START + 133)
-#define RID_SVXITEMS_OL_BOLDDASH (RID_EDIT_START + 134)
-#define RID_SVXITEMS_OL_BOLDLONGDASH (RID_EDIT_START + 135)
-#define RID_SVXITEMS_OL_BOLDDASHDOT (RID_EDIT_START + 136)
-#define RID_SVXITEMS_OL_BOLDDASHDOTDOT (RID_EDIT_START + 137)
-#define RID_SVXITEMS_OL_BOLDWAVE (RID_EDIT_START + 138)
-
-// enum FontUnderline - used for underline -------------------------------
-#define RID_SVXITEMS_UL_BEGIN (RID_EDIT_START + 139)
-#define RID_SVXITEMS_UL_NONE (RID_EDIT_START + 139)
-#define RID_SVXITEMS_UL_SINGLE (RID_EDIT_START + 140)
-#define RID_SVXITEMS_UL_DOUBLE (RID_EDIT_START + 141)
-#define RID_SVXITEMS_UL_DOTTED (RID_EDIT_START + 142)
-#define RID_SVXITEMS_UL_DONTKNOW (RID_EDIT_START + 143)
-#define RID_SVXITEMS_UL_DASH (RID_EDIT_START + 144)
-#define RID_SVXITEMS_UL_LONGDASH (RID_EDIT_START + 145)
-#define RID_SVXITEMS_UL_DASHDOT (RID_EDIT_START + 146)
-#define RID_SVXITEMS_UL_DASHDOTDOT (RID_EDIT_START + 147)
-#define RID_SVXITEMS_UL_SMALLWAVE (RID_EDIT_START + 148)
-#define RID_SVXITEMS_UL_WAVE (RID_EDIT_START + 149)
-#define RID_SVXITEMS_UL_DOUBLEWAVE (RID_EDIT_START + 150)
-#define RID_SVXITEMS_UL_BOLD (RID_EDIT_START + 151)
-#define RID_SVXITEMS_UL_BOLDDOTTED (RID_EDIT_START + 152)
-#define RID_SVXITEMS_UL_BOLDDASH (RID_EDIT_START + 153)
-#define RID_SVXITEMS_UL_BOLDLONGDASH (RID_EDIT_START + 154)
-#define RID_SVXITEMS_UL_BOLDDASHDOT (RID_EDIT_START + 155)
-#define RID_SVXITEMS_UL_BOLDDASHDOTDOT (RID_EDIT_START + 156)
-#define RID_SVXITEMS_UL_BOLDWAVE (RID_EDIT_START + 157)
-
-// enum FontWeight -------------------------------------------------------
-#define RID_SVXITEMS_WEIGHT_BEGIN (RID_EDIT_START + 158)
-#define RID_SVXITEMS_WEIGHT_DONTKNOW (RID_EDIT_START + 158)
-#define RID_SVXITEMS_WEIGHT_THIN (RID_EDIT_START + 159)
-#define RID_SVXITEMS_WEIGHT_ULTRALIGHT (RID_EDIT_START + 160)
-#define RID_SVXITEMS_WEIGHT_LIGHT (RID_EDIT_START + 161)
-#define RID_SVXITEMS_WEIGHT_SEMILIGHT (RID_EDIT_START + 162)
-#define RID_SVXITEMS_WEIGHT_NORMAL (RID_EDIT_START + 163)
-#define RID_SVXITEMS_WEIGHT_MEDIUM (RID_EDIT_START + 164)
-#define RID_SVXITEMS_WEIGHT_SEMIBOLD (RID_EDIT_START + 165)
-#define RID_SVXITEMS_WEIGHT_BOLD (RID_EDIT_START + 166)
-#define RID_SVXITEMS_WEIGHT_ULTRABOLD (RID_EDIT_START + 167)
-#define RID_SVXITEMS_WEIGHT_BLACK (RID_EDIT_START + 168)
-
-// enum FontItalic -------------------------------------------------------
-#define RID_SVXITEMS_ITALIC_BEGIN (RID_EDIT_START + 206)
-#define RID_SVXITEMS_ITALIC_NONE (RID_EDIT_START + 206)
-#define RID_SVXITEMS_ITALIC_OBLIQUE (RID_EDIT_START + 207)
-#define RID_SVXITEMS_ITALIC_NORMAL (RID_EDIT_START + 208)
-
-// enum SvxAdjust -----------------------------------------------------------
-#define RID_SVXITEMS_ADJUST_BEGIN (RID_EDIT_START + 209)
-#define RID_SVXITEMS_ADJUST_LEFT (RID_EDIT_START + 209)
-#define RID_SVXITEMS_ADJUST_RIGHT (RID_EDIT_START + 210)
-#define RID_SVXITEMS_ADJUST_BLOCK (RID_EDIT_START + 211)
-#define RID_SVXITEMS_ADJUST_CENTER (RID_EDIT_START + 212)
-#define RID_SVXITEMS_ADJUST_BLOCKLINE (RID_EDIT_START + 213)
-
-#define RID_SVXITEMS_TAB_DECIMAL_CHAR (RID_EDIT_START + 214)
-#define RID_SVXITEMS_TAB_FILL_CHAR (RID_EDIT_START + 215)
-
-#define RID_SVXITEMS_TAB_ADJUST_BEGIN (RID_EDIT_START + 217)
-#define RID_SVXITEMS_TAB_ADJUST_LEFT (RID_EDIT_START + 217)
-#define RID_SVXITEMS_TAB_ADJUST_RIGHT (RID_EDIT_START + 218)
-#define RID_SVXITEMS_TAB_ADJUST_DECIMAL (RID_EDIT_START + 219)
-#define RID_SVXITEMS_TAB_ADJUST_CENTER (RID_EDIT_START + 220)
-#define RID_SVXITEMS_TAB_ADJUST_DEFAULT (RID_EDIT_START + 221)
-
-// enum SvxBreak ------------------------------------------------------------
-#define RID_SVXITEMS_BREAK_BEGIN (RID_EDIT_START + 222)
-#define RID_SVXITEMS_BREAK_NONE (RID_EDIT_START + 222)
-#define RID_SVXITEMS_BREAK_COLUMN_BEFORE (RID_EDIT_START + 223)
-#define RID_SVXITEMS_BREAK_COLUMN_AFTER (RID_EDIT_START + 224)
-#define RID_SVXITEMS_BREAK_COLUMN_BOTH (RID_EDIT_START + 225)
-#define RID_SVXITEMS_BREAK_PAGE_BEFORE (RID_EDIT_START + 226)
-#define RID_SVXITEMS_BREAK_PAGE_AFTER (RID_EDIT_START + 227)
-#define RID_SVXITEMS_BREAK_PAGE_BOTH (RID_EDIT_START + 228)
-
-// enum SvxShadowLocation ---------------------------------------------------
-#define RID_SVXITEMS_SHADOW_BEGIN (RID_EDIT_START + 229)
-#define RID_SVXITEMS_SHADOW_NONE (RID_EDIT_START + 229)
-#define RID_SVXITEMS_SHADOW_TOPLEFT (RID_EDIT_START + 230)
-#define RID_SVXITEMS_SHADOW_TOPRIGHT (RID_EDIT_START + 231)
-#define RID_SVXITEMS_SHADOW_BOTTOMLEFT (RID_EDIT_START + 232)
-#define RID_SVXITEMS_SHADOW_BOTTOMRIGHT (RID_EDIT_START + 233)
-
-// 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)
-#define RID_SVXITEMS_METRIC_POINT (RID_EDIT_START + 253)
-#define RID_SVXITEMS_METRIC_TWIP (RID_EDIT_START + 254)
-#define RID_SVXITEMS_METRIC_PIXEL (RID_EDIT_START + 255)
-
-// enum ColorName -----------------------------------------------------------
-#define RID_SVXITEMS_COLOR_BEGIN (RID_EDIT_START + 256)
-#define RID_SVXITEMS_COLOR (RID_EDIT_START + 256)
-#define RID_SVXITEMS_COLOR_BLACK (RID_EDIT_START + 257)
-#define RID_SVXITEMS_COLOR_BLUE (RID_EDIT_START + 258)
-#define RID_SVXITEMS_COLOR_GREEN (RID_EDIT_START + 259)
-#define RID_SVXITEMS_COLOR_CYAN (RID_EDIT_START + 260)
-#define RID_SVXITEMS_COLOR_RED (RID_EDIT_START + 261)
-#define RID_SVXITEMS_COLOR_MAGENTA (RID_EDIT_START + 262)
-#define RID_SVXITEMS_COLOR_BROWN (RID_EDIT_START + 263)
-#define RID_SVXITEMS_COLOR_GRAY (RID_EDIT_START + 264)
-#define RID_SVXITEMS_COLOR_LIGHTGRAY (RID_EDIT_START + 265)
-#define RID_SVXITEMS_COLOR_LIGHTBLUE (RID_EDIT_START + 266)
-#define RID_SVXITEMS_COLOR_LIGHTGREEN (RID_EDIT_START + 267)
-#define RID_SVXITEMS_COLOR_LIGHTCYAN (RID_EDIT_START + 268)
-#define RID_SVXITEMS_COLOR_LIGHTRED (RID_EDIT_START + 269)
-#define RID_SVXITEMS_COLOR_LIGHTMAGENTA (RID_EDIT_START + 270)
-#define RID_SVXITEMS_COLOR_YELLOW (RID_EDIT_START + 271)
-#define RID_SVXITEMS_COLOR_WHITE (RID_EDIT_START + 272)
-#define RID_SVXITEMS_COLOR_MENUBAR (RID_EDIT_START + 273)
-#define RID_SVXITEMS_COLOR_MENUBARTEXT (RID_EDIT_START + 274)
-#define RID_SVXITEMS_COLOR_POPUPMENU (RID_EDIT_START + 275)
-#define RID_SVXITEMS_COLOR_POPUPMENUTEXT (RID_EDIT_START + 276)
-#define RID_SVXITEMS_COLOR_WINDOWTEXT (RID_EDIT_START + 277)
-#define RID_SVXITEMS_COLOR_WINDOWWORKSPACE (RID_EDIT_START + 278)
-#define RID_SVXITEMS_COLOR_HIGHLIGHT (RID_EDIT_START + 279)
-#define RID_SVXITEMS_COLOR_HIGHLIGHTTEXT (RID_EDIT_START + 280)
-#define RID_SVXITEMS_COLOR_3DTEXT (RID_EDIT_START + 281)
-#define RID_SVXITEMS_COLOR_3DFACE (RID_EDIT_START + 282)
-#define RID_SVXITEMS_COLOR_3DLIGHT (RID_EDIT_START + 283)
-#define RID_SVXITEMS_COLOR_3DSHADOW (RID_EDIT_START + 284)
-#define RID_SVXITEMS_COLOR_SCROLLBAR (RID_EDIT_START + 285)
-#define RID_SVXITEMS_COLOR_FIELD (RID_EDIT_START + 286)
-#define RID_SVXITEMS_COLOR_FIELDTEXT (RID_EDIT_START + 287)
-
-
-#define RID_SVXITEMS_PARASNAPTOGRID_ON (RID_EDIT_START + 288)
-#define RID_SVXITEMS_PARASNAPTOGRID_OFF (RID_EDIT_START + 289)
-
-#define RID_SVXITEMS_PARAVERTALIGN_AUTO (RID_EDIT_START + 290)
-#define RID_SVXITEMS_PARAVERTALIGN_BASELINE (RID_EDIT_START + 291)
-#define RID_SVXITEMS_PARAVERTALIGN_TOP (RID_EDIT_START + 292)
-#define RID_SVXITEMS_PARAVERTALIGN_CENTER (RID_EDIT_START + 293)
-#define RID_SVXITEMS_PARAVERTALIGN_BOTTOM (RID_EDIT_START + 294)
-
-#define RID_SVXITEMS_CHARHIDDEN_FALSE (RID_EDIT_START + 295)
-#define RID_SVXITEMS_CHARHIDDEN_TRUE (RID_EDIT_START + 296)
-
-// strings for error messsages in dictionary updates
-#define RID_SVXSTR_DIC_ERR_UNKNOWN (RID_EDIT_START + 297)
-#define RID_SVXSTR_DIC_ERR_FULL (RID_EDIT_START + 298)
-#define RID_SVXSTR_DIC_ERR_READONLY (RID_EDIT_START + 299)
-
-// ResIds fuer HM-QueryBoxen und Error-Strings
-#define RID_SVXQB_BW_CONTINUE (RID_EDIT_START + 300)
-#define RID_SVXQB_CONTINUE (RID_EDIT_START + 301)
-
-// EditEngine
-#define RID_EDITUNDO_DEL (RID_EDIT_START + 302)
-#define RID_EDITUNDO_MOVE (RID_EDIT_START + 303)
-#define RID_EDITUNDO_INSERT (RID_EDIT_START + 304)
-#define RID_EDITUNDO_REPLACE (RID_EDIT_START + 305)
-#define RID_EDITUNDO_SETATTRIBS (RID_EDIT_START + 306)
-#define RID_EDITUNDO_SETSTYLE (RID_EDIT_START + 307)
-#define RID_EDITUNDO_RESETATTRIBS (RID_EDIT_START + 308)
-#define RID_EDITUNDO_INDENT (RID_EDIT_START + 309)
-#define RID_EDITUNDO_TRANSLITERATE (RID_EDIT_START + 310)
-#define RID_MENU_SPELL (RID_EDIT_START + 311)
-#define RID_STR_PARAGRAPH (RID_EDIT_START + 312)
-#define RID_STR_WORD (RID_EDIT_START + 313)
-#define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION (RID_EDIT_START + 314)
-#define RID_SVXSTR_A11Y_IMAGEBULLET_NAME (RID_EDIT_START + 315)
-
-// 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
-
-
-
-#endif
-
-// ******************************************************************* EOF
-
diff --git a/editeng/inc/editeng/editstat.hxx b/editeng/inc/editeng/editstat.hxx
deleted file mode 100644
index e554f721ff..0000000000
--- a/editeng/inc/editeng/editstat.hxx
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDITSTAT_HXX
-#define _EDITSTAT_HXX
-
-#include <tools/string.hxx>
-#include <i18npool/lang.h>
-
-#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 // 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 // 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 // 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 // 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
-#define EE_STAT_VSCROLL 0x00000002
-#define EE_STAT_CURSOROUT 0x00000004
-#define EE_STAT_CRSRMOVEFAIL 0x00000008
-#define EE_STAT_CRSRLEFTPARA 0x00000010
-#define EE_STAT_TEXTWIDTHCHANGED 0x00000020
-#define EE_STAT_TEXTHEIGHTCHANGED 0x00000040
-#define EE_STAT_WRONGWORDCHANGED 0x00000080
-// #define EE_STAT_MODIFIED 0x00000100
-
-// Only for Update:
-#define EE_CNTRL_AUTOCENTER EE_CNTRL_AUTOPAGESIZE
-#define EE_STAT_GROWY EE_STAT_TEXTHEIGHTCHANGED
-
-/*
- EE_STAT_CRSRLEFTPARA at the time cursor movement and the enter.
-*/
-
-inline void SetFlags( sal_uLong& rBits, const sal_uInt32 nMask, bool bOn )
-{
- if ( bOn )
- rBits |= nMask;
- else
- rBits &= ~nMask;
-}
-
-class EditStatus
-{
-protected:
- sal_uLong nStatusBits;
- sal_uLong nControlBits;
- sal_uInt16 nPrevPara; // for EE_STAT_CRSRLEFTPARA
-
-public:
- EditStatus() { nStatusBits = 0; nControlBits = 0; nPrevPara = 0xFFFF; }
-
- void Clear() { nStatusBits = 0; }
- void SetControlBits( sal_uLong nMask, bool bOn )
- { SetFlags( nControlBits, nMask, bOn ); }
-
- sal_uLong GetStatusWord() const { return nStatusBits; }
- sal_uLong& GetStatusWord() { return nStatusBits; }
-
- sal_uLong GetControlWord() const { return nControlBits; }
- sal_uLong& GetControlWord() { return nControlBits; }
-
- sal_uInt16 GetPrevParagraph() const { return nPrevPara; }
- sal_uInt16& GetPrevParagraph() { return nPrevPara; }
-};
-
-#define SPELLCMD_IGNOREWORD 0x0001
-#define SPELLCMD_STARTSPELLDLG 0x0002
-#define SPELLCMD_ADDTODICTIONARY 0x0003
-#define SPELLCMD_WORDLANGUAGE 0x0004
-#define SPELLCMD_PARALANGUAGE 0x0005
-
-struct SpellCallbackInfo
-{
- sal_uInt16 nCommand;
- String aWord;
- LanguageType eLanguage;
-
- SpellCallbackInfo( sal_uInt16 nCMD, const String& rWord )
- : aWord( rWord )
- {
- nCommand = nCMD;
- eLanguage = LANGUAGE_DONTKNOW;
- }
-
- SpellCallbackInfo( sal_uInt16 nCMD, LanguageType eLang )
- {
- nCommand = nCMD;
- eLanguage = eLang;
- }
-};
-
-#endif // _EDITSTAT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/editund2.hxx b/editeng/inc/editeng/editund2.hxx
deleted file mode 100644
index 09e95e1a3d..0000000000
--- a/editeng/inc/editeng/editund2.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDITUND2_HXX
-#define _EDITUND2_HXX
-
-#include "editeng/editengdllapi.h"
-#include <svl/undo.hxx>
-
-class ImpEditEngine;
-
-class EDITENG_DLLPRIVATE EditUndoManager : public SfxUndoManager
-{
- using SfxUndoManager::Undo;
- using SfxUndoManager::Redo;
-
-private:
- ImpEditEngine* pImpEE;
-public:
- EditUndoManager( ImpEditEngine* pImpEE );
-
- virtual sal_Bool Undo();
- virtual sal_Bool Redo();
-};
-
-// -----------------------------------------------------------------------
-// EditUndo
-// ------------------------------------------------------------------------
-class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction
-{
-private:
- sal_uInt16 nId;
- ImpEditEngine* pImpEE;
-
-public:
- TYPEINFO();
- EditUndo( sal_uInt16 nI, ImpEditEngine* pImpEE );
- virtual ~EditUndo();
-
- ImpEditEngine* GetImpEditEngine() const { return pImpEE; }
-
- virtual void Undo() = 0;
- virtual void Redo() = 0;
-
- virtual sal_Bool CanRepeat(SfxRepeatTarget&) const;
- virtual String GetComment() const;
- virtual sal_uInt16 GetId() const;
-};
-
-#endif // _EDITUND2_HXX
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/editview.hxx b/editeng/inc/editeng/editview.hxx
deleted file mode 100644
index 4db4834e39..0000000000
--- a/editeng/inc/editeng/editview.hxx
+++ /dev/null
@@ -1,250 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-// MyEDITVIEW, due to exported EditView
-#ifndef _MyEDITVIEW_HXX
-#define _MyEDITVIEW_HXX
-
-#include <com/sun/star/i18n/WordType.hpp>
-
-#include <rsc/rscsfx.hxx>
-#include <i18npool/lang.h>
-#include <tools/color.hxx>
-#include <tools/gen.hxx>
-
-class EditEngine;
-class ImpEditEngine;
-class ImpEditView;
-class SvxSearchItem;
-class SvxFieldItem;
-class Window;
-class Pointer;
-class Cursor;
-class KeyEvent;
-class MouseEvent;
-class DropEvent;
-class CommandEvent;
-class Rectangle;
-class Link;
-class Pair;
-class Point;
-class Range;
-class SvStream;
-class SvKeyValueIterator;
-class SfxStyleSheet;
-class Font;
-class FontList;
-
-#include <editeng/editdata.hxx>
-#include <com/sun/star/uno/Reference.h>
-#include "editeng/editengdllapi.h"
-
-namespace com {
-namespace sun {
-namespace star {
-namespace datatransfer {
- class XTransferable;
-}}}}
-
-class EDITENG_DLLPUBLIC EditView
-{
- friend class EditEngine;
- friend class ImpEditEngine;
- friend class EditSelFunctionSet;
-
-public: // Needed for Undo
- ImpEditView* GetImpEditView() const { return pImpEditView; }
- ImpEditEngine* GetImpEditEngine() const;
-
-private:
- ImpEditView* pImpEditView;
-
- EDITENG_DLLPRIVATE EditView( const EditView& );
- EDITENG_DLLPRIVATE EditView& operator=( const EditView& );
-
-public:
- EditView( EditEngine* pEng, Window* pWindow );
- virtual ~EditView();
-
- void SetEditEngine( EditEngine* pEditEngine );
- EditEngine* GetEditEngine() const;
-
- void SetWindow( Window* pWin );
- Window* GetWindow() const;
-
- void Paint( const Rectangle& rRect );
- void Invalidate();
- Pair Scroll( long nHorzScroll, long nVertScroll, sal_uInt8 nRangeCheck = RGCHK_NEG );
-
- void ShowCursor( sal_Bool bGotoCursor = sal_True, sal_Bool bForceVisCursor = sal_True );
- void HideCursor();
-
- EESelectionMode GetSelectionMode() const;
- void SetSelectionMode( EESelectionMode eMode );
-
- void SetReadOnly( sal_Bool bReadOnly );
- sal_Bool IsReadOnly() const;
-
- sal_Bool HasSelection() const;
- ESelection GetSelection() const;
- void SetSelection( const ESelection& rNewSel );
- sal_Bool SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
-
- void IndentBlock();
- void UnindentBlock();
-
- sal_Bool IsInsertMode() const;
- void SetInsertMode( sal_Bool bInsert );
-
- void ReplaceSelected( const String& rStr );
- String GetSelected();
- void DeleteSelected();
-
- sal_uInt16 GetSelectedScriptType() const;
-
- // VisArea position of the Output window.
- // A size change also affects the VisArea
- void SetOutputArea( const Rectangle& rRec );
- const Rectangle& GetOutputArea() const;
-
- // Document position.
- // A size change also affects the VisArea
- void SetVisArea( const Rectangle& rRec );
- const Rectangle& GetVisArea() const;
-
- void SetPointer( const Pointer& rPointer );
- const Pointer& GetPointer() const;
-
- void SetCursor( const Cursor& rCursor );
- Cursor* GetCursor() const;
-
- void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
-
- sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL );
-
- sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent );
- sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent );
- sal_Bool MouseMove( const MouseEvent& rMouseEvent );
- void Command( const CommandEvent& rCEvt );
-
- sal_Bool Drop( const DropEvent& rEvt );
- sal_Bool QueryDrop( DropEvent& rEvt );
- ESelection GetDropPos();
-
- void Cut();
- void Copy();
- void Paste();
- void PasteSpecial();
-
- void EnablePaste( sal_Bool bEnable );
- sal_Bool IsPasteEnabled() const;
-
- void Undo();
- void Redo();
-
- // especially for Oliver Specht
- sal_uInt16 GetParagraph( const Point& rMousePosPixel );
- Point GetWindowPosTopLeft( sal_uInt16 nParagraph );
- void MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos );
- void MoveParagraphs( long nDiff );
-
- const SfxItemSet& GetEmptyItemSet();
- SfxItemSet GetAttribs();
- void SetAttribs( const SfxItemSet& rSet );
- void SetParaAttribs( const SfxItemSet& rSet, sal_uInt16 nPara );
- void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0 );
- void RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 );
- void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs = sal_False );
-
- sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
-
- void SetBackgroundColor( const Color& rColor );
- Color GetBackgroundColor() const;
-
- void SetControlWord( sal_uInt32 nWord );
- sal_uInt32 GetControlWord() const;
-
- EditTextObject* CreateTextObject();
- void InsertText( const EditTextObject& rTextObject );
- void InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, sal_Bool bUseSpecial );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetTransferable();
-
- // An EditView, so that when TRUE the update will be free from flickering:
- void SetEditEngineUpdateMode( sal_Bool bUpdate );
- void ForceUpdate();
-
- SfxStyleSheet* GetStyleSheet() const;
- void SetStyleSheet( SfxStyleSheet* pStyle );
-
- void SetAnchorMode( EVAnchorMode eMode );
- EVAnchorMode GetAnchorMode() const;
-
- sal_Bool MatchGroup();
-
- void CompleteAutoCorrect( Window* pFrameWin = NULL );
-
- EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False );
- EESpellState StartThesaurus();
- sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
-
- // for text conversion
- void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
- sal_Bool HasConvertibleTextPortion( LanguageType nLang );
-
- void TransliterateText( sal_Int32 nTransliterationMode );
-
- sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
- sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False );
- void SpellIgnoreWord();
- void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
-
- void InsertField( const SvxFieldItem& rFld );
- const SvxFieldItem* GetFieldUnderMousePointer() const;
- const SvxFieldItem* GetFieldUnderMousePointer( sal_uInt16& nPara, xub_StrLen& nPos ) const;
- const SvxFieldItem* GetField( const Point& rPos, sal_uInt16* pnPara = NULL, xub_StrLen* pnPos = NULL ) const;
-
- const SvxFieldItem* GetFieldAtSelection() const;
-
- String GetWordUnderMousePointer() const;
- String GetWordUnderMousePointer( Rectangle& rWordRect ) const;
-
- void SetInvalidateMore( sal_uInt16 nPixel );
- sal_uInt16 GetInvalidateMore() const;
-
- // grows or shrinks the font height for the current selection
- void ChangeFontSize( bool bGrow, const FontList* pList );
-
- static bool ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList );
-
- String GetSurroundingText() const;
- Selection GetSurroundingTextSelection() const;
-};
-
-#endif // _MyEDITVIEW_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/edtdlg.hxx b/editeng/inc/editeng/edtdlg.hxx
deleted file mode 100644
index 8e586b5600..0000000000
--- a/editeng/inc/editeng/edtdlg.hxx
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 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.
- *
- ************************************************************************/
-#ifndef _EDT_ABSTDLG_HXX
-#define _EDT_ABSTDLG_HXX
-
-// include ---------------------------------------------------------------
-
-#include <tools/solar.h>
-#include <tools/string.hxx>
-#include <editeng/editengdllapi.h>
-#include <i18npool/lang.h>
-#include <com/sun/star/uno/Reference.hxx>
-#include <vcl/abstdlg.hxx>
-#include <editeng/hangulhanja.hxx>
-
-namespace com { namespace sun { namespace star { namespace linguistic2
-{
- class XThesaurus;
- class XHyphenator;
-} } } }
-
-class Window;
-class ResId;
-class Link;
-class SvxSpellWrapper;
-
-class AbstractThesaurusDialog : public VclAbstractDialog
-{
-public:
- virtual String GetWord() = 0;
- virtual sal_uInt16 GetLanguage() const = 0;
- virtual Window* GetWindow() = 0;
-};
-
-class AbstractHyphenWordDialog : public VclAbstractDialog
-{
-public:
- virtual void SelLeft() = 0;
- virtual void SelRight() = 0;
- virtual Window* GetWindow() = 0;
-};
-
-class AbstractHangulHanjaConversionDialog : public VclAbstractTerminatedDialog
-{
- public:
- virtual void EnableRubySupport( sal_Bool _bVal ) = 0;
- virtual void SetByCharacter( sal_Bool _bByCharacter ) = 0;
- virtual void SetConversionDirectionState( sal_Bool _bTryBothDirections, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection ) = 0;
- virtual void SetConversionFormat( editeng::HangulHanjaConversion::ConversionFormat _eType ) = 0;
- virtual void SetOptionsChangedHdl( const Link& _rHdl ) = 0;
- virtual void SetIgnoreHdl( const Link& _rHdl ) = 0;
- virtual void SetIgnoreAllHdl( const Link& _rHdl ) = 0;
- virtual void SetChangeHdl( const Link& _rHdl ) = 0;
- virtual void SetChangeAllHdl( const Link& _rHdl ) = 0;
- virtual void SetClickByCharacterHdl( const Link& _rHdl ) = 0;
- virtual void SetConversionFormatChangedHdl( const Link& _rHdl ) = 0;
- virtual void SetFindHdl( const Link& _rHdl ) = 0;
- virtual sal_Bool GetUseBothDirections( ) const= 0;
- virtual editeng::HangulHanjaConversion::ConversionDirection GetDirection( editeng::HangulHanjaConversion::ConversionDirection _eDefaultDirection ) const = 0;
- virtual void SetCurrentString(
- const String& _rNewString,
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions,
- bool _bOriginatesFromDocument = true )=0;
- virtual String GetCurrentString( ) const =0;
- virtual editeng::HangulHanjaConversion::ConversionFormat GetConversionFormat( ) const =0;
- virtual void FocusSuggestion( )= 0;
- virtual String GetCurrentSuggestion( ) const =0;
-};
-
-class EDITENG_DLLPUBLIC EditAbstractDialogFactory : virtual public VclAbstractDialogFactory
-{
-public:
- virtual ~EditAbstractDialogFactory(); // needed for export of vtable
- static EditAbstractDialogFactory* Create();
- virtual AbstractThesaurusDialog* CreateThesaurusDialog( Window*, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus,
- const String &rWord, sal_Int16 nLanguage ) = 0;
-
- virtual AbstractHyphenWordDialog* CreateHyphenWordDialog( Window*,
- const String &rWord, LanguageType nLang,
- ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen,
- SvxSpellWrapper* pWrapper ) = 0;
- virtual AbstractHangulHanjaConversionDialog * CreateHangulHanjaConversionDialog( Window* _pParent,
- editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection ) = 0;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/eedata.hxx b/editeng/inc/editeng/eedata.hxx
deleted file mode 100644
index 43657d6e81..0000000000
--- a/editeng/inc/editeng/eedata.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _EEDATA_HXX
-#define _EEDATA_HXX
-
-//////////////////////////////////////////////////////////////////////////////
-// extended data definitions for EditEngine portion stripping (StripPortions()
-// support). These may be mapped to some primitive definitions from Drawinglayer
-// later.
-#include <vector>
-
-namespace EEngineData
-{
- // spell checking wrong vector containing the redlining data
- class WrongSpellClass
- {
- public:
- sal_uInt32 nStart;
- sal_uInt32 nEnd;
-
- WrongSpellClass(sal_uInt32 nS, sal_uInt32 nE) : nStart(nS), nEnd(nE) {}
- };
-
- typedef std::vector< WrongSpellClass > WrongSpellVector;
-
- // text marking vector containing the EOC, EOW and EOS TEXT definitions
- enum TextMarkingType
- {
- EndOfCaracter = 0,
- EndOfWord = 1,
- EndOfSentence = 2
- };
-
- class TextMarkingClass
- {
- public:
- TextMarkingType eType;
- sal_uInt32 nIndex;
-
- TextMarkingClass(TextMarkingType eT, sal_uInt32 nI) : eType(eT), nIndex(nI) {}
- };
-
- typedef std::vector< TextMarkingClass > TextMarkingVector;
-
-} // end of namespace EditEngine
-
-#endif // _EEDATA_HXX
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/eeitem.hxx b/editeng/inc/editeng/eeitem.hxx
deleted file mode 100644
index 936109b283..0000000000
--- a/editeng/inc/editeng/eeitem.hxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EEITEM_HXX
-#define _EEITEM_HXX
-
-#define EE_ITEMS_START 3989
-
-// 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)
-#define EE_PARA_HANGINGPUNCTUATION (EE_ITEMS_START+2)
-#define EE_PARA_FORBIDDENRULES (EE_ITEMS_START+3)
-#define EE_PARA_ASIANCJKSPACING (EE_ITEMS_START+4)
-#define EE_PARA_NUMBULLET (EE_ITEMS_START+5)
-#define EE_PARA_HYPHENATE (EE_ITEMS_START+6)
-#define EE_PARA_BULLETSTATE (EE_ITEMS_START+7)
-#define EE_PARA_OUTLLRSPACE (EE_ITEMS_START+8)
-#define EE_PARA_OUTLLEVEL (EE_ITEMS_START+9)
-#define EE_PARA_BULLET (EE_ITEMS_START+10)
-#define EE_PARA_LRSPACE (EE_ITEMS_START+11)
-#define EE_PARA_ULSPACE (EE_ITEMS_START+12)
-#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_JUST_METHOD (EE_ITEMS_START+16)
-#define EE_PARA_VER_JUST (EE_ITEMS_START+17)
-#define EE_PARA_END (EE_ITEMS_START+17)
-
-// 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+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+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
deleted file mode 100644
index 62b5a523dc..0000000000
--- a/editeng/inc/editeng/eeitemid.hxx
+++ /dev/null
@@ -1,138 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EEITEMID_HXX
-#define _EEITEMID_HXX
-
-#include <editeng/eeitem.hxx>
-
-#ifdef ITEMID_FONT
-#undef ITEMID_FONT
-#endif
-#ifdef ITEMID_FONTHEIGHT
-#undef ITEMID_FONTHEIGHT
-#endif
-#ifdef ITEMID_COLOR
-#undef ITEMID_COLOR
-#endif
-#ifdef ITEMID_WEIGHT
-#undef ITEMID_WEIGHT
-#endif
-#ifdef ITEMID_POSTURE
-#undef ITEMID_POSTURE
-#endif
-#ifdef ITEMID_SHADOWED
-#undef ITEMID_SHADOWED
-#endif
-#ifdef ITEMID_CONTOUR
-#undef ITEMID_CONTOUR
-#endif
-#ifdef ITEMID_CROSSEDOUT
-#undef ITEMID_CROSSEDOUT
-#endif
-#ifdef ITEMID_UNDERLINE
-#undef ITEMID_UNDERLINE
-#endif
-#ifdef ITEMID_OVERLINE
-#undef ITEMID_OVERLINE
-#endif
-#ifdef ITEMID_LANGUAGE
-#undef ITEMID_LANGUAGE
-#endif
-#ifdef ITEMID_ADJUST
-#undef ITEMID_ADJUST
-#endif
-#ifdef ITEMID_WORDLINEMODE
-#undef ITEMID_WORDLINEMODE
-#endif
-#ifdef ITEMID_CHARSETCOLOR
-#undef ITEMID_CHARSETCOLOR
-#endif
-#ifdef ITEMID_SEARCH
-#undef ITEMID_SEARCH
-#endif
-#ifdef ITEMID_BRUSH
-#undef ITEMID_BRUSH
-#endif
-
-// Character Attributes....
-#define ITEMID_FONT EE_CHAR_FONTINFO
-#define ITEMID_POSTURE EE_CHAR_ITALIC
-#define ITEMID_WEIGHT EE_CHAR_WEIGHT
-#define ITEMID_SHADOWED EE_CHAR_SHADOW
-#define ITEMID_CONTOUR EE_CHAR_OUTLINE
-#define ITEMID_CROSSEDOUT EE_CHAR_STRIKEOUT
-#define ITEMID_UNDERLINE EE_CHAR_UNDERLINE
-#define ITEMID_OVERLINE EE_CHAR_OVERLINE
-#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT
-#define ITEMID_CHARSCALE_W EE_CHAR_FONTWIDTH
-#define ITEMID_COLOR EE_CHAR_COLOR
-#define ITEMID_WORDLINEMODE EE_CHAR_WLM
-#define ITEMID_PROPSIZE 0
-#define ITEMID_CHARSETCOLOR 0 // EE_FEATURE_NOTCONV
-#define ITEMID_CASEMAP 0
-#define ITEMID_LANGUAGE 0
-#define ITEMID_ESCAPEMENT EE_CHAR_ESCAPEMENT
-#define ITEMID_NOLINEBREAK 0
-#define ITEMID_NOHYPHENHERE 0
-#define ITEMID_AUTOKERN EE_CHAR_PAIRKERNING
-#define ITEMID_KERNING EE_CHAR_KERNING
-#define ITEMID_EMPHASISMARK EE_CHAR_EMPHASISMARK
-#define ITEMID_CHARRELIEF EE_CHAR_RELIEF
-
-// Paragraph Attributes
-#define ITEMID_SCRIPTSPACE EE_PARA_ASIANCJKSPACING
-#define ITEMID_ADJUST EE_PARA_JUST
-#define ITEMID_LINESPACING EE_PARA_SBL
-#define ITEMID_WIDOWS 0
-#define ITEMID_ORPHANS 0
-#define ITEMID_HYPHENZONE 0
-
-#define ITEMID_TABSTOP EE_PARA_TABS
-
-#define ITEMID_PAPERBIN 0
-#define ITEMID_LRSPACE EE_PARA_LRSPACE
-#define ITEMID_ULSPACE EE_PARA_ULSPACE
-#define ITEMID_FRAMEDIR EE_PARA_WRITINGDIR
-#define ITEMID_PRINT 0
-#define ITEMID_OPAQUE 0
-#define ITEMID_PROTECT 0
-#define ITEMID_BACKGROUND 0
-#define ITEMID_SHADOW 0
-#define ITEMID_MACRO 0
-#define ITEMID_BOX 0
-#define ITEMID_BOXINFO 0
-#define ITEMID_BRUSH 0
-
-#define ITEMID_FIELD EE_FEATURE_FIELD
-
-#define ITEMID_SEARCH 0
-
-#endif //_EEITEMID_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/eerdll.hxx b/editeng/inc/editeng/eerdll.hxx
deleted file mode 100644
index 14b4a2d557..0000000000
--- a/editeng/inc/editeng/eerdll.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EERDLL_HXX
-#define _EERDLL_HXX
-
-class GlobalEditData;
-
-#include <tools/resid.hxx>
-#include <tools/shl.hxx>
-#include <editeng/editengdllapi.h>
-
-class EDITENG_DLLPUBLIC EditResId: public ResId
-{
-public:
- EditResId( sal_uInt16 nId );
-};
-
-class EditDLL
-{
- ResMgr* pResMgr;
- GlobalEditData* pGlobalData;
-
-public:
- EditDLL();
- ~EditDLL();
-
- ResMgr* GetResMgr() const { return pResMgr; }
- GlobalEditData* GetGlobalData() const { return pGlobalData; }
- static EditDLL& Get();
-};
-
-#define EE_DLL() EditDLL::Get()
-
-#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
deleted file mode 100644
index 3ba2f3e1ab..0000000000
--- a/editeng/inc/editeng/emphitem.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_EMPHITEM_HXX
-#define _SVX_EMPHITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <vcl/vclenum.hxx>
-#include <svl/intitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxEmphasisMarkItem ----------------------------------------------
-
-/* [Description]
-
- This item describes the Font emphasis.
-*/
-
-class EDITENG_DLLPUBLIC SvxEmphasisMarkItem : public SfxUInt16Item
-{
-public:
- TYPEINFO();
-
- SvxEmphasisMarkItem( const FontEmphasisMark eVal /*= EMPHASISMARK_NONE*/,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText,
- const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, 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 )
- {
- SetValue( rItem.GetValue() );
- return *this;
- }
-
- // enum cast
- FontEmphasisMark GetEmphasisMark() const
- { return (FontEmphasisMark)GetValue(); }
- void SetEmphasisMark( FontEmphasisMark eNew )
- { SetValue( (sal_uInt16)eNew ); }
-};
-
-#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
deleted file mode 100644
index 59f66e798e..0000000000
--- a/editeng/inc/editeng/escpitem.hxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_ESCPITEM_HXX
-#define _SVX_ESCPITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/svxenum.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxEscapementItem -----------------------------------------------
-
-#define DFLT_ESC_SUPER 33 // 1/3
-#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
-
-/* [Description]
-
- This item describes the writing position.
-*/
-
-class EDITENG_DLLPUBLIC SvxEscapementItem : public SfxEnumItemInterface
-{
- short nEsc;
- sal_uInt8 nProp;
-public:
- TYPEINFO();
-
- SvxEscapementItem( const sal_uInt16 nId );
- SvxEscapementItem( const SvxEscapement eEscape,
- const sal_uInt16 nId );
- SvxEscapementItem( const short nEsc, const sal_uInt8 nProp,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, 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;
-
- inline void SetEscapement( const SvxEscapement eNew )
- {
- if( SVX_ESCAPEMENT_OFF == eNew )
- nEsc = 0, nProp = 100;
- else
- if( SVX_ESCAPEMENT_SUPERSCRIPT == eNew )
- nEsc = DFLT_ESC_SUPER, nProp = DFLT_ESC_PROP;
- else
- nEsc = DFLT_ESC_SUB, nProp = DFLT_ESC_PROP;
- }
- inline SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
-
- inline short &GetEsc() { return nEsc; }
- inline short GetEsc() const { return nEsc; }
-
- inline sal_uInt8 &GetProp() { return nProp; }
- inline sal_uInt8 GetProp() const { return nProp; }
-
- inline SvxEscapementItem& operator=(const SvxEscapementItem& rEsc)
- {
- nEsc = rEsc.GetEsc();
- nProp = rEsc.GetProp();
- return *this;
- }
-
- virtual sal_uInt16 GetValueCount() const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
- virtual sal_uInt16 GetEnumValue() const;
- virtual void SetEnumValue( sal_uInt16 nNewVal );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/fhgtitem.hxx b/editeng/inc/editeng/fhgtitem.hxx
deleted file mode 100644
index cd847d4f4f..0000000000
--- a/editeng/inc/editeng/fhgtitem.hxx
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_FHGTITEM_HXX
-#define _SVX_FHGTITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxFontHeightItem -----------------------------------------------
-
-// Warning: twips values
-
-/* [Description]
-
- This item describes the font height
-*/
-
-#define FONTHEIGHT_16_VERSION ((sal_uInt16)0x0001)
-#define FONTHEIGHT_UNIT_VERSION ((sal_uInt16)0x0002)
-
-class EDITENG_DLLPUBLIC SvxFontHeightItem : public SfxPoolItem
-{
- sal_uInt32 nHeight;
- sal_uInt16 nProp; // default 100%
- SfxMapUnit ePropUnit; // Percent, Twip, ...
-public:
- TYPEINFO();
-
- SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nItemVersion) const;
- virtual bool ScaleMetrics( long nMult, long nDiv );
- virtual bool HasMetrics() const;
-
- inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize)
- {
- SetHeightValue( rSize.GetHeight() );
- SetProp( rSize.GetProp(), ePropUnit );
- return *this;
- }
-
- void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100,
- SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE );
-
- void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
- SfxMapUnit eUnit, SfxMapUnit eCoreUnit );
-
- sal_uInt32 GetHeight() const { return nHeight; }
-
- void SetHeightValue( sal_uInt32 nNewHeight )
- {
- DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
- nHeight = nNewHeight;
- }
-
- void SetProp( const sal_uInt16 nNewProp,
- SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE )
- {
- DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
- nProp = nNewProp;
- ePropUnit = eUnit;
- }
-
- sal_uInt16 GetProp() const { return nProp; }
-
- SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ...
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx
deleted file mode 100644
index 18b1ad5128..0000000000
--- a/editeng/inc/editeng/flditem.hxx
+++ /dev/null
@@ -1,429 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_FLDITEM_HXX
-#define _SVX_FLDITEM_HXX
-
-#include <i18npool/lang.h>
-#include <tools/time.hxx>
-#include <tools/date.hxx>
-#include <svl/poolitem.hxx>
-#include <tools/pstm.hxx>
-#include "editeng/editengdllapi.h"
-
-class SvNumberFormatter;
-class MetaAction;
-
-// class SvxFieldItem ---------------------------------------------------
-
-
-
-class EDITENG_DLLPUBLIC SvxFieldData : public SvPersistBase
-{
-public:
- SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, 1 )
-
- SvxFieldData();
- virtual ~SvxFieldData();
-
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-
- virtual MetaAction* createBeginComment() const;
- virtual MetaAction* createEndComment() const;
-};
-
-/*
-[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)
-*/
-
-class EDITENG_DLLPUBLIC SvxFieldItem : public SfxPoolItem
-{
-private:
- SvxFieldData* pField;
-
- EDITENG_DLLPRIVATE SvxFieldItem( SvxFieldData* pField, const sal_uInt16 nId );
-
-public:
- TYPEINFO();
-
- SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId );
- SvxFieldItem( const SvxFieldItem& rItem );
- ~SvxFieldItem();
-
- virtual int operator==( const SfxPoolItem& ) const;
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVer ) const;
- virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
-
- const SvxFieldData* GetField() const { return pField; }
- static SvClassManager& GetClassManager();
-};
-
-// =================================================================
-// The following are the derivatives of SvxFieldData ...
-// =================================================================
-
-#define SVX_DATEFIELD 2
-#define SVX_URLFIELD 3
-
-#define SVX_PAGEFIELD 100 // Ex-Calc Fields
-#define SVX_PAGESFIELD 101
-#define SVX_TIMEFIELD 102
-#define SVX_FILEFIELD 103
-#define SVX_TABLEFIELD 104
-#define SVX_EXT_TIMEFIELD 105
-#define SVX_EXT_FILEFIELD 106
-#define SVX_AUTHORFIELD 107
-#define SVX_HEADERFIELD 108
-#define SVX_FOOTERFIELD 109
-#define SVX_DATEFIMEFIELD 110
-
-#define SVX_USERFIELD 200 // From here on own fields, not in the SVX
-
-enum SvxDateType { SVXDATETYPE_FIX, SVXDATETYPE_VAR };
-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.February 1996
- SVXDATEFORMAT_E, // Tue, 13.February 1996
- SVXDATEFORMAT_F // Tuesday, 13.February 1996
- };
-
-class EDITENG_DLLPUBLIC SvxDateField : public SvxFieldData
-{
- sal_uInt32 nFixDate;
- SvxDateType eType;
- SvxDateFormat eFormat;
-
-public:
- SV_DECL_PERSIST1( SvxDateField, SvxFieldData, SVX_DATEFIELD )
-
- SvxDateField();
- SvxDateField( const Date& rDate,
- SvxDateType eType = SVXDATETYPE_VAR,
- SvxDateFormat eFormat = SVXDATEFORMAT_STDSMALL );
-
- sal_uInt32 GetFixDate() const { return nFixDate; }
- void SetFixDate( const Date& rDate ) { nFixDate = rDate.GetDate(); }
-
- SvxDateType GetType() const { return eType; }
- void SetType( SvxDateType eTp ) { eType = eTp; }
-
- SvxDateFormat GetFormat() const { return eFormat; }
- void SetFormat( SvxDateFormat eFmt ) { eFormat = eFmt; }
-
- // deprecated, to be removed
- String GetFormatted( LanguageType eLanguage, LanguageType eFormat ) const;
- // use this instead
- // If eLanguage==LANGUAGE_DONTKNOW the language/country
- // used in number formatter initialization is taken.
- String GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
- static String GetFormatted( Date& rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
-
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-
- virtual MetaAction* createBeginComment() const;
-};
-
-
-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-Address
- XubString aRepresentation; // What is shown
- XubString aTargetFrame; // In what Frame
-
-public:
- SV_DECL_PERSIST1( SvxURLField, SvxFieldData, SVX_URLFIELD )
-
- SvxURLField();
- SvxURLField( const XubString& rURL, const XubString& rRepres, SvxURLFormat eFmt = SVXURLFORMAT_URL );
-
- const XubString& GetURL() const { return aURL; }
- void SetURL( const XubString& rURL ) { aURL = rURL; }
-
- const XubString& GetRepresentation() const { return aRepresentation; }
- void SetRepresentation( const XubString& rRep ) { aRepresentation= rRep; }
-
- const XubString& GetTargetFrame() const { return aTargetFrame; }
- void SetTargetFrame( const XubString& rFrm ) { aTargetFrame = rFrm; }
-
- SvxURLFormat GetFormat() const { return eFormat; }
- void SetFormat( SvxURLFormat eFmt ) { eFormat = eFmt; }
-
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-
- virtual MetaAction* createBeginComment() const;
-};
-
-class EDITENG_DLLPUBLIC SvxPageField : public SvxFieldData
-{
-public:
- SV_DECL_PERSIST1( SvxPageField, SvxFieldData, SVX_PAGEFIELD )
- SvxPageField() {}
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-
- virtual MetaAction* createBeginComment() const;
-};
-
-class EDITENG_DLLPUBLIC SvxPagesField : public SvxFieldData
-{
-public:
- SV_DECL_PERSIST1( SvxPagesField, SvxFieldData, SVX_PAGESFIELD )
- SvxPagesField() {}
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-};
-
-class EDITENG_DLLPUBLIC SvxTimeField : public SvxFieldData
-{
-public:
- SV_DECL_PERSIST1( SvxTimeField, SvxFieldData, SVX_TIMEFIELD )
- SvxTimeField() {}
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-
- virtual MetaAction* createBeginComment() const;
-};
-
-class EDITENG_DLLPUBLIC SvxFileField : public SvxFieldData
-{
-public:
- SV_DECL_PERSIST1( SvxFileField, SvxFieldData, SVX_FILEFIELD )
- SvxFileField() {}
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-};
-
-class EDITENG_DLLPUBLIC SvxTableField : public SvxFieldData
-{
-public:
- SV_DECL_PERSIST1( SvxTableField, SvxFieldData, SVX_TABLEFIELD )
- SvxTableField() {}
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-};
-
-
-enum SvxTimeType { SVXTIMETYPE_FIX, SVXTIMETYPE_VAR };
-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
- SVXTIMEFORMAT_24_HMSH, // 13:49:38.78
- SVXTIMEFORMAT_12_HM, // 01:49
- SVXTIMEFORMAT_12_HMS, // 01:49:38
- SVXTIMEFORMAT_12_HMSH, // 01:49:38.78
- SVXTIMEFORMAT_AM_HM, // 01:49 PM
- SVXTIMEFORMAT_AM_HMS, // 01:49:38 PM
- SVXTIMEFORMAT_AM_HMSH // 01:49:38.78 PM
- };
-
-class EDITENG_DLLPUBLIC SvxExtTimeField : public SvxFieldData
-{
-private:
- sal_uInt32 nFixTime;
- SvxTimeType eType;
- SvxTimeFormat eFormat;
-
-public:
- SV_DECL_PERSIST1( SvxExtTimeField, SvxFieldData, SVX_EXT_TIMEFIELD )
- SvxExtTimeField();
- SvxExtTimeField( const Time& rTime,
- SvxTimeType eType = SVXTIMETYPE_VAR,
- SvxTimeFormat eFormat = SVXTIMEFORMAT_STANDARD );
-
- sal_uInt32 GetFixTime() const { return nFixTime; }
- void SetFixTime( const Time& rTime ) { nFixTime = rTime.GetTime(); }
-
- SvxTimeType GetType() const { return eType; }
- void SetType( SvxTimeType eTp ) { eType = eTp; }
-
- SvxTimeFormat GetFormat() const { return eFormat; }
- void SetFormat( SvxTimeFormat eFmt ) { eFormat = eFmt; }
-
- // deprecated, to be removed
- XubString GetFormatted( LanguageType eLanguage, LanguageType eFormat ) const;
- // use this instead
- // If eLanguage==LANGUAGE_DONTKNOW the language/country
- // used in number formatter initialization is taken.
- String GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
- static String GetFormatted( Time& rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
-
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-
- virtual MetaAction* createBeginComment() const;
-};
-
-
-enum SvxFileType { SVXFILETYPE_FIX, SVXFILETYPE_VAR };
-enum SvxFileFormat { SVXFILEFORMAT_NAME_EXT, // File name with Extension
- SVXFILEFORMAT_FULLPATH, // full path
- SVXFILEFORMAT_PATH, // only path
- SVXFILEFORMAT_NAME // only file name
- };
-
-
-
-class EDITENG_DLLPUBLIC SvxExtFileField : public SvxFieldData
-{
-private:
- XubString aFile;
- SvxFileType eType;
- SvxFileFormat eFormat;
-
-public:
- SV_DECL_PERSIST1( SvxExtFileField, SvxFieldData, SVX_EXT_FILEFIELD )
- SvxExtFileField();
- SvxExtFileField( const XubString& rString,
- SvxFileType eType = SVXFILETYPE_VAR,
- SvxFileFormat eFormat = SVXFILEFORMAT_FULLPATH );
-
- String GetFile() const { return aFile; }
- void SetFile( const XubString& rString ) { aFile = rString; }
-
- SvxFileType GetType() const { return eType; }
- void SetType( SvxFileType eTp ) { eType = eTp; }
-
- SvxFileFormat GetFormat() const { return eFormat; }
- void SetFormat( SvxFileFormat eFmt ) { eFormat = eFmt; }
-
- XubString GetFormatted() const;
-
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-};
-
-
-enum SvxAuthorType { SVXAUTHORTYPE_FIX, SVXAUTHORTYPE_VAR };
-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
-{
-private:
- XubString aName;
- XubString aFirstName;
- XubString aShortName;
- SvxAuthorType eType;
- SvxAuthorFormat eFormat;
-
-public:
- SV_DECL_PERSIST1( SvxAuthorField, SvxFieldData, SVX_AUTHORFIELD )
- SvxAuthorField();
- SvxAuthorField(
- const XubString& rFirstName,
- const XubString& rLastName,
- const XubString& rShortName,
- SvxAuthorType eType = SVXAUTHORTYPE_VAR,
- SvxAuthorFormat eFormat = SVXAUTHORFORMAT_FULLNAME );
-
- XubString GetName() const { return aName; }
- void SetName( const XubString& rString ) { aName = rString; }
-
- XubString GetFirstName() const { return aFirstName; }
- void SetFirstName( const XubString& rString ) { aFirstName = rString; }
-
- XubString GetShortName() const { return aShortName; }
- void SetShortName( const XubString& rString ) { aShortName = rString; }
-
- SvxAuthorType GetType() const { return eType; }
- void SetType( SvxAuthorType eTp ) { eType = eTp; }
-
- SvxAuthorFormat GetFormat() const { return eFormat; }
- void SetFormat( SvxAuthorFormat eFmt ) { eFormat = eFmt; }
-
- XubString GetFormatted() const;
-
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-};
-
-/** this field is used as a placeholder for a header&footer in impress. The actual
- value is stored at the page */
-class EDITENG_DLLPUBLIC SvxHeaderField : public SvxFieldData
-{
-public:
- SV_DECL_PERSIST1( SvxHeaderField, SvxFieldData, SVX_HEADERFIELD )
- SvxHeaderField() {}
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-};
-
-/** this field is used as a placeholder for a header&footer in impress. The actual
- value is stored at the page */
-class EDITENG_DLLPUBLIC SvxFooterField : public SvxFieldData
-{
-public:
- SV_DECL_PERSIST1( SvxFooterField, SvxFieldData, SVX_FOOTERFIELD )
- SvxFooterField() {}
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-};
-
-/** this field is used as a placeholder for a header&footer in impress. The actual
- value is stored at the page */
-class EDITENG_DLLPUBLIC SvxDateTimeField : public SvxFieldData
-{
-public:
- SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, SVX_DATEFIMEFIELD )
- SvxDateTimeField() {}
-
- static String GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
-
- virtual SvxFieldData* Clone() const;
- virtual int operator==( const SvxFieldData& ) const;
-};
-
-
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/flstitem.hxx b/editeng/inc/editeng/flstitem.hxx
deleted file mode 100644
index 82b268d537..0000000000
--- a/editeng/inc/editeng/flstitem.hxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_FLSTITEM_HXX
-#define _SVX_FLSTITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <rtl/ustring.hxx>
-#include <com/sun/star/uno/Sequence.h>
-#include "editeng/editengdllapi.h"
-
-// class SvxFontListItem -------------------------------------------------
-
-class FontList;
-
-/*
- [Description]
-
- 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
-{
-private:
- const FontList* pFontList;
- com::sun::star::uno::Sequence< rtl::OUString > aFontNameSeq;
-
-public:
- TYPEINFO();
-
- SvxFontListItem( const FontList* pFontLst,
- const sal_uInt16 nId );
- SvxFontListItem( const SvxFontListItem& rItem );
-
- virtual int operator==( const SfxPoolItem& ) const;
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- const FontList* GetFontList() const { return pFontList; }
-};
-
-
-
-
-#endif
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/fontitem.hxx b/editeng/inc/editeng/fontitem.hxx
deleted file mode 100644
index 95b4b8e5ec..0000000000
--- a/editeng/inc/editeng/fontitem.hxx
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_FONTITEM_HXX
-#define _SVX_FONTITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <tools/string.hxx>
-#include <vcl/font.hxx>
-#include "editeng/editengdllapi.h"
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxFontItem -----------------------------------------------------
-
-/* [Description]
-
- This item describes a Font.
-*/
-
-class EDITENG_DLLPUBLIC SvxFontItem : public SfxPoolItem
-{
- String aFamilyName;
- String aStyleName;
- FontFamily eFamily;
- FontPitch ePitch;
- rtl_TextEncoding eTextEncoding;
-
- static sal_Bool bEnableStoreUnicodeNames;
-
-public:
- TYPEINFO();
-
- SvxFontItem( const sal_uInt16 nId );
- SvxFontItem( const FontFamily eFam, const String& rFamilyName,
- const String& rStyleName,
- const FontPitch eFontPitch /*= PITCH_DONTKNOW*/,
- const rtl_TextEncoding eFontTextEncoding /*= RTL_TEXTENCODING_DONTKNOW*/,
- const sal_uInt16 nId );
-
- // "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 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;
-
- // Access methods:
- void SetFamilyName( const String& rFamilyName ) { aFamilyName = rFamilyName; }
- inline const String &GetFamilyName() const { return aFamilyName; }
-
- void SetStyleName(const String &rStyleName ) { aStyleName = rStyleName; }
- inline const String &GetStyleName() const { return aStyleName; }
-
- void SetFamily( FontFamily _eFamily ) { eFamily = _eFamily; }
- inline FontFamily GetFamily() const { return eFamily; }
-
- void SetPitch(FontPitch _ePitch ) { ePitch = _ePitch; }
- inline FontPitch GetPitch() const { return ePitch; }
-
- void SetCharSet(rtl_TextEncoding _eEncoding) { eTextEncoding = _eEncoding; }
-
- inline rtl_TextEncoding GetCharSet() const { return eTextEncoding; }
-
- SvxFontItem& operator=(const SvxFontItem& rFont);
-
- static void EnableStoreUnicodeNames( sal_Bool bEnable );
-
-};
-
-EDITENG_DLLPUBLIC void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian,
- SvxFontItem& rComplex );
-
-#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
deleted file mode 100644
index e933033d99..0000000000
--- a/editeng/inc/editeng/forbiddencharacterstable.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _FORBIDDENCHARACTERSTABLE_HXX
-#define _FORBIDDENCHARACTERSTABLE_HXX
-
-#include <tools/table.hxx>
-
-#include <salhelper/simplereferenceobject.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/i18n/ForbiddenCharacters.hpp>
-#include "editeng/editengdllapi.h"
-
-namespace com {
-namespace sun {
-namespace star {
-namespace lang {
- class XMultiServiceFactory;
-}}}}
-
-struct ForbiddenCharactersInfo
-{
- com::sun::star::i18n::ForbiddenCharacters aForbiddenChars;
- sal_Bool bTemporary;
-};
-
-DECLARE_TABLE( SvxForbiddenCharactersTableImpl, ForbiddenCharactersInfo* )
-
-class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable : public SvxForbiddenCharactersTableImpl, public salhelper::SimpleReferenceObject
-{
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
-
-public:
- SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, sal_uInt16 nISize = 4, sal_uInt16 nGrow = 4 );
- ~SvxForbiddenCharactersTable();
-
- const com::sun::star::i18n::ForbiddenCharacters* GetForbiddenCharacters( sal_uInt16 nLanuage, sal_Bool bGetDefault ) const;
- void SetForbiddenCharacters( sal_uInt16 nLanuage , const com::sun::star::i18n::ForbiddenCharacters& );
- void ClearForbiddenCharacters( sal_uInt16 nLanuage );
-};
-
-#endif // _FORBIDDENCHARACTERSTABLE_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/forbiddenruleitem.hxx b/editeng/inc/editeng/forbiddenruleitem.hxx
deleted file mode 100644
index 53a9137cf9..0000000000
--- a/editeng/inc/editeng/forbiddenruleitem.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_FORBIDDENRULEITEM_HXX
-#define _SVX_FORBIDDENRULEITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxForbiddenRuleItem -----------------------------------------
-
-/* [Description]
-
- This item describe how to handle the last character of a line.
-*/
-
-class EDITENG_DLLPUBLIC SvxForbiddenRuleItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxForbiddenRuleItem( sal_Bool bOn /*= sal_False*/,
- const sal_uInt16 nId );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText,
- const IntlWrapper * = 0 ) const;
-
- inline SvxForbiddenRuleItem& operator=(
- const SvxForbiddenRuleItem& rItem )
- {
- SetValue( rItem.GetValue() );
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/frmdir.hxx b/editeng/inc/editeng/frmdir.hxx
deleted file mode 100644
index a2006b6be9..0000000000
--- a/editeng/inc/editeng/frmdir.hxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_FRMDIR_HXX
-#define _SVX_FRMDIR_HXX
-
-// ----------------------------------------------------------------------------
-
-/** Defines possible text directions in frames. */
-enum SvxFrameDirection
-{
- /** Horizontal, from left to right, from top to bottom
- (typical for western languages). */
- FRMDIR_HORI_LEFT_TOP,
-
- /** Horizontal, from right to left, from top to bottom
- (typical for ararbic/hebrew languages). */
- FRMDIR_HORI_RIGHT_TOP,
-
- /** Vertical, from top to bottom, from right to left
- (typical for asian languages). */
- FRMDIR_VERT_TOP_RIGHT,
-
- /** Vertical, from top to bottom, from left to right
- (typical for mongol language). */
- FRMDIR_VERT_TOP_LEFT,
-
- /** Use the value from the environment, can only be used in frames. */
- FRMDIR_ENVIRONMENT
-};
-
-// ----------------------------------------------------------------------------
-
-#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
deleted file mode 100644
index b9cf24747f..0000000000
--- a/editeng/inc/editeng/frmdiritem.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_FRMDIRITEM_HXX
-#define _SVX_FRMDIRITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/intitem.hxx>
-#include <editeng/frmdir.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxFrameDirectionItem ----------------------------------------------
-
-/* [Description]
-
- This item defines a frame direction, which place the content inside
- a frame. It exist different kind of directions which are used to the
- layout text for Western, CJK and CTL languages.
-*/
-
-class EDITENG_DLLPUBLIC SvxFrameDirectionItem : public SfxUInt16Item
-{
-public:
- TYPEINFO();
-
- SvxFrameDirectionItem( sal_uInt16 nWhich );
- SvxFrameDirectionItem( SvxFrameDirection nValue /*= FRMDIR_HORI_LEFT_TOP*/,
- sal_uInt16 nWhich );
- virtual ~SvxFrameDirectionItem();
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
- virtual int operator==( const SfxPoolItem& ) const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- 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 );
-
- inline SvxFrameDirectionItem& operator=( const SvxFrameDirectionItem& rItem )
- {
- SetValue( rItem.GetValue() );
- return *this;
- }
-};
-
-#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
deleted file mode 100644
index 9fbdf7dee0..0000000000
--- a/editeng/inc/editeng/fwdtitem.hxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_FWDTITEM_HXX
-#define _SVX_FWDTITEM_HXX
-
-// include ---------------------------------------------------------------
-
-
-#include <svl/poolitem.hxx>
-
-
-// class SvxFontWidthItem -----------------------------------------------
-
-
-/* [Description]
-
- This item describes the font width.
-*/
-
-class SvxFontWidthItem : public SfxPoolItem
-{
- sal_uInt16 nWidth; // 0 = default
- sal_uInt16 nProp; // default 100%
-public:
- TYPEINFO();
-
- SvxFontWidthItem( const sal_uInt16 nSz /*= 0*/,
- const sal_uInt16 nPropWidth /*= 100*/,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
- virtual bool ScaleMetrics( long nMult, long nDiv );
- virtual bool HasMetrics() const;
-
- inline SvxFontWidthItem& operator=(const SvxFontWidthItem& rItem )
- {
- SetWidthValue( rItem.GetWidth() );
- SetProp( rItem.GetProp() );
- return *this;
- }
-
- void SetWidth( sal_uInt16 nNewWidth, const sal_uInt16 nNewProp = 100 )
- {
- DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
- nWidth = sal_uInt16(( (sal_uInt32)nNewWidth * nNewProp ) / 100 );
- nProp = nNewProp;
- }
-
- sal_uInt16 GetWidth() const { return nWidth; }
-
- void SetWidthValue( sal_uInt16 nNewWidth )
- {
- DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
- nWidth = nNewWidth;
- }
-
- void SetProp( const sal_uInt16 nNewProp )
- {
- DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
- nProp = nNewProp;
- }
-
- sal_uInt16 GetProp() const { return nProp; }
-};
-
-
-
-
-
-#endif
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/hangulhanja.hxx b/editeng/inc/editeng/hangulhanja.hxx
deleted file mode 100644
index 15a80b5e8c..0000000000
--- a/editeng/inc/editeng/hangulhanja.hxx
+++ /dev/null
@@ -1,305 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef SVX_HANGUL_HANJA_CONVERSION_HXX
-#define SVX_HANGUL_HANJA_CONVERSION_HXX
-
-#include <vcl/window.hxx>
-#include <memory>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include "editeng/editengdllapi.h"
-
-//.............................................................................
-namespace editeng
-{
-//.............................................................................
-
- class HangulHanjaConversion_Impl;
-
- //=========================================================================
- //= HangulHanjaConversion
- //=========================================================================
- /** encapsulates Hangul-Hanja conversion functionality
-
- <p>terminology:
- <ul><li>A <b>text <em>portion</em></b> is some (potentially large) piece of text
- which is to be analyzed for convertible sub-strings.</li>
- <li>A <b>text <em>unit</em></b> is a sub string in a text portion, which is
- to be converted as a whole.</li>
- </ul>
- For instance, you could have two independent selections within your document, which are then
- two text portions. A text unit would be single Hangul/Hanja words within a portion, or even
- single Hangul syllabills when "replace by character" is enabled.
- </p>
- */
- class EDITENG_DLLPUBLIC HangulHanjaConversion
- {
- friend class HangulHanjaConversion_Impl;
-
- public:
- enum ReplacementAction
- {
- eExchange, // simply exchange one text with another
- eReplacementBracketed, // keep the original, and put the replacement in brackets after it
- eOriginalBracketed, // replace the original text, but put it in brackeds after the replacement
- eReplacementAbove, // keep the original, and put the replacement text as ruby text above it
- eOriginalAbove, // replace the original text, but put it as ruby text above it
- eReplacementBelow, // keep the original, and put the replacement text as ruby text below it
- eOriginalBelow // replace the original text, but put it as ruby text below it
- };
-
- enum ConversionType // does not specify direction...
- {
- eConvHangulHanja, // Korean Hangul/Hanja conversion
- eConvSimplifiedTraditional // Chinese simplified / Chinese traditional conversion
- };
-
- // Note: conversion direction for eConvSimplifiedTraditional is
- // specified by source language.
- // This one is for Hangul/Hanja where source and target language
- // are the same.
- enum ConversionDirection
- {
- eHangulToHanja,
- eHanjaToHangul
- };
-
- enum ConversionFormat
- {
- eSimpleConversion, // used for simplified / traditional Chinese as well
- eHangulBracketed,
- eHanjaBracketed,
- eRubyHanjaAbove,
- eRubyHanjaBelow,
- eRubyHangulAbove,
- eRubyHangulBelow
- };
-
- private:
- ::std::auto_ptr< HangulHanjaConversion_Impl > m_pImpl;
-
- // used to set initial values of m_pImpl object from saved ones
- static sal_Bool m_bUseSavedValues; // defines if the followng two values should be used for initialization
- static sal_Bool m_bTryBothDirectionsSave;
- static ConversionDirection m_ePrimaryConversionDirectionSave;
-
- // Forbidden and not implemented.
- HangulHanjaConversion (const HangulHanjaConversion &);
- HangulHanjaConversion & operator= (const HangulHanjaConversion &);
-
- public:
- HangulHanjaConversion(
- Window* _pUIParent,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
- const ::com::sun::star::lang::Locale& _rSourceLocale,
- const ::com::sun::star::lang::Locale& _rTargetLocale,
- const Font* _pTargetFont,
- sal_Int32 nOptions,
- sal_Bool _bIsInteractive
- );
-
- virtual ~HangulHanjaConversion( );
-
- // converts the whole document
- void ConvertDocument();
-
- LanguageType GetSourceLanguage() const;
- LanguageType GetTargetLanguage() const;
- const Font * GetTargetFont() const;
- sal_Int32 GetConversionOptions() const;
- sal_Bool IsInteractive() const;
-
- // chinese text conversion
- static inline sal_Bool IsSimplified( LanguageType nLang );
- static inline sal_Bool IsTraditional( LanguageType nLang );
- static inline sal_Bool IsChinese( LanguageType nLang );
- static inline sal_Bool IsSimilarChinese( LanguageType nLang1, LanguageType nLang2 );
-
- // used to specify that the conversion direction states from the
- // last incarnation should be used as
- // initial conversion direction for the next incarnation.
- // (A hack used to transport a state information from
- // one incarnation to the next. Used in Writers text conversion...)
- static void SetUseSavedConversionDirectionState( sal_Bool bVal );
- static sal_Bool IsUseSavedConversionDirectionState();
-
- protected:
- /** retrieves the next text portion which is to be analyzed
-
- <p>pseudo-abstract, needs to be overridden</p>
-
- @param _rNextPortion
- upon return, this must contain the next text portion
- @param _rLangOfPortion
- upon return, this must contain the language for the found text portion.
- (necessary for Chinese translation since there are 5 language variants
- too look for even if the 'source' language usually is only 'simplified'
- or 'traditional'.)
- */
- virtual void GetNextPortion(
- ::rtl::OUString& /* [out] */ _rNextPortion,
- LanguageType& /* [out] */ _rLangOfPortion,
- sal_Bool /* [in] */ _bAllowImplicitChangesForNotConvertibleText );
-
- /** announces a new "current unit"
-
- <p>This will be called whenever it is necessary to interactively ask the user for
- a conversion. In such a case, a range within the current portion (see <member>GetNextPortion</member>)
- is presented to the user for chosing a substitution. Additionally, this method is called,
- so that derived classes can e.g. highlight this text range in a document view.</p>
-
- <p>Note that the indexes are relative to the most recent replace action. See
- <member>ReplaceUnit</member> for details.</p>
-
- @param _nUnitStart
- the start index of the unit
-
- @param _nUnitEnd
- the start index (exclusively!) of the unit.
-
- @param _bAllowImplicitChangesForNotConvertibleText
- allows implicit changes other than the text itself for the
- text parts not being convertible.
- Used for chinese translation to attribute all not convertible
- text (e.g. western text, empty paragraphs, spaces, ...) to
- the target language and target font of the conversion.
- This is to ensure that after the conversion any new text entered
- anywhere in the document will have the target language (of course
- CJK Language only) and target font (CJK font only) set.
-
- @see GetNextPortion
- */
- virtual void HandleNewUnit( const sal_Int32 _nUnitStart, const sal_Int32 _nUnitEnd );
-
- /** replaces a text unit within a text portion with a new text
-
- <p>pseudo-abstract, needs to be overridden</p>
-
- <p>Note an important thing about the indicies: They are always relative to the <em>previous
- call</em> of ReplaceUnit. This means whe you get a call to ReplaceUnit, and replace some text
- in your document, than you have to remember the document position immediately <em>behind</em>
- the changed text. In a next call to ReplaceUnit, an index of <em>0</em> will denote exactly
- this position behind the previous replacement<br/>
- The reaons for this is that this class here does not know anything about your document structure,
- so after a replacement took place, it's impossible to address anything in the range from the
- beginning of the portion up to the replaced text.<br/>
- In the very first call to ReplaceUnit, an index of <em>0</em> denotes the very first position of
- the current portion.</p>
-
- <p>If the language of the text to be replaced is different from
- the target language (as given by 'GetTargetLanguage') for example
- when converting simplified Chinese from/to traditional Chinese
- the language attribute of the new text has to be changed as well,
- **and** the font is to be set to the default (document) font for
- that language.</p>
-
- @param _nUnitStart
- the start index of the range to replace
-
- @param _nUnitEnd
- the end index (exclusively!) of the range to replace. E.g., an index
- pair (4,5) indicates a range of length 1.
-
- @param _rOrigText
- the original text to be replaced (as returned by GetNextPortion).
- Since in Chinese conversion the original text is needed as well
- in order to only do the minimal necassry text changes and to keep
- as much attributes as possible this is supplied here as well.
-
- @param _rReplaceWith
- The replacement text
-
- @param _rOffsets
- An sequence matching the indices (characters) of _rReplaceWith
- to the indices of the characters in the original text they are
- replacing.
- This is necessary since some portions of the text may get
- converted in portions of different length than the original.
- The sequence will be empty if all conversions in the text are
- of equal length. That is if always the character at index i in
- _rOffsets is replacing the character at index i in the original
- text for all valid index values of i.
-
- @param _eAction
- replacement action to take
-
- @param pNewUnitLanguage
- if the replacement unit is required to have a new language that
- is specified here. If the language is to be left unchanged this
- is the 0 pointer.
- */
- virtual void ReplaceUnit(
- const sal_Int32 _nUnitStart, const sal_Int32 _nUnitEnd,
- const ::rtl::OUString& _rOrigText,
- const ::rtl::OUString& _rReplaceWith,
- const ::com::sun::star::uno::Sequence< sal_Int32 > &_rOffsets,
- ReplacementAction _eAction,
- LanguageType *pNewUnitLanguage
- );
-
- /** specifies if rubies are supported by the document implementing
- this class.
-
- @return
- <TRUE/> if rubies are supported.
- */
- virtual sal_Bool HasRubySupport() const;
- };
-
- sal_Bool HangulHanjaConversion::IsSimplified( LanguageType nLang )
- {
- return nLang == LANGUAGE_CHINESE_SIMPLIFIED ||
- nLang == LANGUAGE_CHINESE_SINGAPORE;
- }
-
- sal_Bool HangulHanjaConversion::IsTraditional( LanguageType nLang )
- {
- return nLang == LANGUAGE_CHINESE_TRADITIONAL ||
- nLang == LANGUAGE_CHINESE_HONGKONG ||
- nLang == LANGUAGE_CHINESE_MACAU;
- }
-
- sal_Bool HangulHanjaConversion::IsChinese( LanguageType nLang )
- {
- return IsTraditional( nLang ) || IsSimplified( nLang );
- }
-
- sal_Bool HangulHanjaConversion::IsSimilarChinese( LanguageType nLang1, LanguageType nLang2 )
- {
- return (IsTraditional(nLang1) && IsTraditional(nLang2)) ||
- (IsSimplified(nLang1) && IsSimplified(nLang2));
- }
-
-//.............................................................................
-} // namespace svx
-//.............................................................................
-
-#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
deleted file mode 100644
index a6a12c9611..0000000000
--- a/editeng/inc/editeng/hngpnctitem.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_HNGPNCTITEM_HXX
-#define _SVX_HNGPNCTITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxHangingPunctuationItem -----------------------------------------
-
-/* [Description]
-
- This item describe how to handle the last character of a line.
-*/
-
-class EDITENG_DLLPUBLIC SvxHangingPunctuationItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxHangingPunctuationItem( sal_Bool bOn /*= sal_False*/,
- const sal_uInt16 nId );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText,
- const IntlWrapper * = 0 ) const;
-
- inline SvxHangingPunctuationItem& operator=(
- const SvxHangingPunctuationItem& rItem )
- {
- SetValue( rItem.GetValue() );
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/hyznitem.hxx b/editeng/inc/editeng/hyznitem.hxx
deleted file mode 100644
index 19f62c48bc..0000000000
--- a/editeng/inc/editeng/hyznitem.hxx
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_HYZNITEM_HXX
-#define _SVX_HYZNITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxHyphenZoneItem -----------------------------------------------
-
-/* [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
-{
- sal_Bool bHyphen: 1;
- sal_Bool bPageEnd: 1;
- sal_uInt8 nMinLead;
- sal_uInt8 nMinTrail;
- sal_uInt8 nMaxHyphens;
-
- friend SvStream & operator<<( SvStream & aS, SvxHyphenZoneItem & );
-
-public:
- TYPEINFO();
-
- SvxHyphenZoneItem( const sal_Bool bHyph /*= sal_False*/,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
-
- inline void SetHyphen( const sal_Bool bNew ) { bHyphen = bNew; }
- inline sal_Bool IsHyphen() const { return bHyphen; }
-
- inline void SetPageEnd( const sal_Bool bNew ) { bPageEnd = bNew; }
- inline sal_Bool IsPageEnd() const { return bPageEnd; }
-
- inline sal_uInt8 &GetMinLead() { return nMinLead; }
- inline sal_uInt8 GetMinLead() const { return nMinLead; }
-
- inline sal_uInt8 &GetMinTrail() { return nMinTrail; }
- inline sal_uInt8 GetMinTrail() const { return nMinTrail; }
-
- inline sal_uInt8 &GetMaxHyphens() { return nMaxHyphens; }
- inline sal_uInt8 GetMaxHyphens() const { return nMaxHyphens; }
-
- inline SvxHyphenZoneItem &operator=( const SvxHyphenZoneItem &rNew )
- {
- bHyphen = rNew.IsHyphen();
- bPageEnd = rNew.IsPageEnd();
- nMinLead = rNew.GetMinLead();
- nMinTrail = rNew.GetMinTrail();
- nMaxHyphens = rNew.GetMaxHyphens();
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/itemtype.hxx b/editeng/inc/editeng/itemtype.hxx
deleted file mode 100644
index 77c5f41db3..0000000000
--- a/editeng/inc/editeng/itemtype.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_ITEMTYPE_HXX
-#define _SVX_ITEMTYPE_HXX
-
-// include ---------------------------------------------------------------
-
-#include <editeng/editrids.hrc>
-#include <editeng/eerdll.hxx>
-
-// forward ---------------------------------------------------------------
-#include <tools/string.hxx>
-#include <tools/resid.hxx>
-#include <tools/bigint.hxx>
-#include <svl/poolitem.hxx>
-#include <tools/shl.hxx>
-#include "editeng/editengdllapi.h"
-
-class Color;
-class XColorTable;
-class IntlWrapper;
-// static and prototypes -------------------------------------------------
-
-static const sal_Unicode cDelim = ',';
-static const sal_Unicode cpDelim[] = { ',' , ' ', '\0' };
-
-EDITENG_DLLPUBLIC String GetSvxString( sal_uInt16 nId );
-EDITENG_DLLPUBLIC String GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, const IntlWrapper * pIntl );
-String GetColorString( const Color& rCol );
-EDITENG_DLLPUBLIC sal_uInt16 GetMetricId( SfxMapUnit eUnit );
-
-// -----------------------------------------------------------------------
-
-inline String GetBoolString( sal_Bool bVal )
-{
- return String( EditResId( bVal ? RID_SVXITEMS_TRUE : RID_SVXITEMS_FALSE ) );
-}
-
-// -----------------------------------------------------------------------
-
-inline long Scale( long nVal, long nMult, long nDiv )
-{
- BigInt aVal( nVal );
- aVal *= nMult;
- aVal += nDiv/2;
- aVal /= nDiv;
- return aVal;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/justifyitem.hxx b/editeng/inc/editeng/justifyitem.hxx
deleted file mode 100644
index 67f8dc2e0e..0000000000
--- a/editeng/inc/editeng/justifyitem.hxx
+++ /dev/null
@@ -1,130 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __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
deleted file mode 100644
index 8c986fb7ae..0000000000
--- a/editeng/inc/editeng/keepitem.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_KEEPITEM_HXX
-#define _SVX_KEEPITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxFmtKeepItem ------------------------------------------------
-
-/* [Description]
-
- This item describes a logical variable "keep paragraphs together?".
-*/
-
-class EDITENG_DLLPUBLIC SvxFmtKeepItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- inline SvxFmtKeepItem( const sal_Bool bKeep /*= sal_False*/,
- const sal_uInt16 _nWhich );
- inline SvxFmtKeepItem& operator=( const SvxFmtKeepItem& rSplit );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-};
-
-inline SvxFmtKeepItem::SvxFmtKeepItem( const sal_Bool bKeep, const sal_uInt16 _nWhich ) :
- SfxBoolItem( _nWhich, bKeep )
-{}
-
-inline SvxFmtKeepItem& SvxFmtKeepItem::operator=( const SvxFmtKeepItem& rKeep )
-{
- SetValue( rKeep.GetValue() );
- return *this;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/kernitem.hxx b/editeng/inc/editeng/kernitem.hxx
deleted file mode 100644
index 0a69842998..0000000000
--- a/editeng/inc/editeng/kernitem.hxx
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_KERNITEM_HXX
-#define _SVX_KERNITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/intitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxKerningItem --------------------------------------------------
-
-// Note: Twips value
-// Twips: 0 = no kerning
-
-/* [Description]
-
- This item describes the kerning.
-*/
-
-class EDITENG_DLLPUBLIC SvxKerningItem : public SfxInt16Item
-{
-public:
- TYPEINFO();
-
- SvxKerningItem( const short nKern /*= 0*/, const sal_uInt16 nId );
-
- // "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 bool ScaleMetrics( long nMult, long nDiv );
- virtual bool HasMetrics() const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxKerningItem& operator=(const SvxKerningItem& rKern) {
- SetValue( rKern.GetValue() );
- return *this;
- }
-
- 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
deleted file mode 100644
index f01a7733fa..0000000000
--- a/editeng/inc/editeng/langitem.hxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_LANGITEM_HXX
-#define _SVX_LANGITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <i18npool/lang.h>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxLanguageItem -------------------------------------------------
-
-/* [Description]
-
- This item describes a Language.
-*/
-
-class EDITENG_DLLPUBLIC SvxLanguageItem : public SfxEnumItem
-{
-public:
- TYPEINFO();
-
- SvxLanguageItem( const LanguageType eLang /*= LANGUAGE_GERMAN*/,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
- virtual sal_uInt16 GetValueCount() const;
-
- inline SvxLanguageItem& operator=(const SvxLanguageItem& rLang)
- {
- SetValue( rLang.GetValue() );
- return *this;
- }
-
- // enum cast
- LanguageType GetLanguage() const
- { return (LanguageType)GetValue(); }
- void SetLanguage( const LanguageType eLang )
- { SetValue( (sal_uInt16)eLang ); }
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/lcolitem.hxx b/editeng/inc/editeng/lcolitem.hxx
deleted file mode 100644
index d5508cf385..0000000000
--- a/editeng/inc/editeng/lcolitem.hxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_LCOLITEM_HXX
-#define _SVX_LCOLITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <editeng/colritem.hxx>
-#include <editeng/editengdllapi.h>
-
-/*
- * Dummy item for ToolBox controller:
- *
- */
-
-class EDITENG_DLLPUBLIC SvxLineColorItem : public SvxColorItem
-{
-public:
- TYPEINFO();
-
- SvxLineColorItem( const sal_uInt16 nId );
- SvxLineColorItem( const Color& aColor, const sal_uInt16 nId );
- SvxLineColorItem( const SvxLineColorItem& rCopy );
- ~SvxLineColorItem();
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText,
- const IntlWrapper * pIntlWrapper = 0 )
- const;
-
- inline SvxLineColorItem& operator=(const SvxLineColorItem& rColor)
- { return (SvxLineColorItem&)SvxColorItem::
- operator=((const SvxColorItem&)rColor); }
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/lrspitem.hxx b/editeng/inc/editeng/lrspitem.hxx
deleted file mode 100644
index 68a9fa5ba9..0000000000
--- a/editeng/inc/editeng/lrspitem.hxx
+++ /dev/null
@@ -1,180 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_LRSPITEM_HXX
-#define _SVX_LRSPITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <editeng/editengdllapi.h>
-
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxLRSpaceItem --------------------------------------------------
-
-/* [Description]
-
- Left/Right margin and first line indent
-
- SvxLRSpaceItem offers two interfaces for views from the left margin and
- first line indent. The get methods return the member, with the layout also
- as expected: the left edge shifts to the negative first line indent to the
- left. The SetTxt/Gettxt methods assume that the left side represents the
- 0 coordinate for the first line indent:
-
- UI UI LAYOUT UI/TEXT UI/TEXT (Where?)
- SetTxtLeft SetTxtFirst GetLeft GetTxtLeft GetTxtFirst (What?)
- 500 -500 0 500 -500 (How much?)
- 500 0 500 500 0
- 500 +500 500 500 +500
- 700 -500 200 700 -500
-*/
-
-#define LRSPACE_16_VERSION ((sal_uInt16)0x0001)
-#define LRSPACE_TXTLEFT_VERSION ((sal_uInt16)0x0002)
-#define LRSPACE_AUTOFIRST_VERSION ((sal_uInt16)0x0003)
-#define LRSPACE_NEGATIVE_VERSION ((sal_uInt16)0x0004)
-
-class EDITENG_DLLPUBLIC SvxLRSpaceItem : public SfxPoolItem
-{
- short nFirstLineOfst; // 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; // Automatic calculation of the first line indent
-
- void AdjustLeft(); // nLeftMargin and nTxtLeft are being adjusted.
-
-public:
- TYPEINFO();
-
- SvxLRSpaceItem( const sal_uInt16 nId );
- SvxLRSpaceItem( const long nLeft, const long nRight,
- const long nTLeft /*= 0*/, const short nOfset /*= 0*/,
- const sal_uInt16 nId );
- inline SvxLRSpaceItem& operator=( const SvxLRSpaceItem &rCpy );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
- virtual bool ScaleMetrics( long nMult, long nDiv );
- virtual bool HasMetrics() const;
-
- // Die "Layout-Schnittstelle":
- inline void SetLeft ( const long nL, const sal_uInt16 nProp = 100 );
- inline void SetRight( const long nR, const sal_uInt16 nProp = 100 );
-
- // Query/direct setting of the absolute values
- inline long GetLeft() const { return nLeftMargin; }
- inline long GetRight() const { return nRightMargin;}
- inline void SetLeftValue( const long nL ) { nTxtLeft = nLeftMargin = nL; }
- inline void SetRightValue( const long nR ) { nRightMargin = nR; }
- inline sal_Bool IsAutoFirst() const { return bAutoFirst; }
- inline void SetAutoFirst( const sal_Bool bNew ) { bAutoFirst = bNew; }
-
- // Query/Setting the percentage values
- inline void SetPropLeft( const sal_uInt16 nProp = 100 )
- { nPropLeftMargin = nProp; }
- inline void SetPropRight( const sal_uInt16 nProp = 100 )
- { nPropRightMargin = nProp;}
- inline sal_uInt16 GetPropLeft() const { return nPropLeftMargin; }
- inline sal_uInt16 GetPropRight() const { return nPropRightMargin;}
-
- // The UI/text interface:
- inline void SetTxtLeft( const long nL, const sal_uInt16 nProp = 100 );
- inline long GetTxtLeft() const { return nTxtLeft; }
-
- inline void SetTxtFirstLineOfst( const short nF, const sal_uInt16 nProp = 100 );
- inline short GetTxtFirstLineOfst() const { return nFirstLineOfst; }
- inline void SetPropTxtFirstLineOfst( const sal_uInt16 nProp = 100 )
- { nPropFirstLineOfst = nProp; }
- inline sal_uInt16 GetPropTxtFirstLineOfst() const
- { return nPropFirstLineOfst; }
- inline void SetTxtFirstLineOfstValue( const short nValue )
- { nFirstLineOfst = nValue; }
-};
-
-inline SvxLRSpaceItem &SvxLRSpaceItem::operator=( const SvxLRSpaceItem &rCpy )
-{
- nFirstLineOfst = rCpy.nFirstLineOfst;
- nTxtLeft = rCpy.nTxtLeft;
- nLeftMargin = rCpy.nLeftMargin;
- nRightMargin = rCpy.nRightMargin;
- nPropFirstLineOfst = rCpy.nPropFirstLineOfst;
- nPropLeftMargin = rCpy.nPropLeftMargin;
- nPropRightMargin = rCpy.nPropRightMargin;
- bAutoFirst = rCpy.bAutoFirst;
- return *this;
-}
-
-inline void SvxLRSpaceItem::SetLeft( const long nL, const sal_uInt16 nProp )
-{
- nLeftMargin = (nL * nProp) / 100;
- nTxtLeft = nLeftMargin;
- nPropLeftMargin = nProp;
-}
-inline void SvxLRSpaceItem::SetRight( const long nR, const sal_uInt16 nProp )
-{
- nRightMargin = (nR * nProp) / 100;
- nPropRightMargin = nProp;
-}
-inline void SvxLRSpaceItem::SetTxtFirstLineOfst( const short nF,
- const sal_uInt16 nProp )
-{
- nFirstLineOfst = short((long(nF) * nProp ) / 100);
- nPropFirstLineOfst = nProp;
- AdjustLeft();
-}
-
-inline void SvxLRSpaceItem::SetTxtLeft( const long nL, const sal_uInt16 nProp )
-{
- nTxtLeft = (nL * nProp) / 100;
- nPropLeftMargin = nProp;
- AdjustLeft();
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/lspcitem.hxx b/editeng/inc/editeng/lspcitem.hxx
deleted file mode 100644
index bd60901d3f..0000000000
--- a/editeng/inc/editeng/lspcitem.hxx
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_LSPCITEM_HXX
-#define _SVX_LSPCITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/svxenum.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxLineSpacingItem ----------------------------------------------
-
-/* [Description]
- This item describes the distance between the lines.
-*/
-
-#define LINE_SPACE_DEFAULT_HEIGHT 200
-class EDITENG_DLLPUBLIC SvxLineSpacingItem : public SfxEnumItemInterface
-{
- friend SvStream& operator<<( SvStream&, SvxLineSpacingItem& ); //$ ostream
-
- short nInterLineSpace;
- sal_uInt16 nLineHeight;
- sal_uInt8 nPropLineSpace;
- SvxLineSpace eLineSpace;
- SvxInterLineSpace eInterLineSpace;
-
-public:
- TYPEINFO();
-
- // 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 Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
-
- // Methods to query and edit. InterlineSpace is added to the height.
- inline short GetInterLineSpace() const { return nInterLineSpace; }
- inline void SetInterLineSpace( const short nSpace )
- {
- nInterLineSpace = nSpace;
- eInterLineSpace = SVX_INTER_LINE_SPACE_FIX;
- }
-
- // Determines the absolute or minimum row height.
- inline sal_uInt16 GetLineHeight() const { return nLineHeight; }
- inline void SetLineHeight( const sal_uInt16 nHeight )
- {
- nLineHeight = nHeight;
- eLineSpace = SVX_LINE_SPACE_MIN;
- }
-
- // To increase or decrease the row height.
- sal_uInt8 GetPropLineSpace() const { return nPropLineSpace; }
- inline void SetPropLineSpace( const sal_uInt8 nProp )
- {
- nPropLineSpace = nProp;
- eInterLineSpace = SVX_INTER_LINE_SPACE_PROP;
- }
-
- inline SvxLineSpace &GetLineSpaceRule() { return eLineSpace; }
- inline SvxLineSpace GetLineSpaceRule() const { return eLineSpace; }
-
- inline SvxInterLineSpace &GetInterLineSpaceRule() { return eInterLineSpace; }
- inline SvxInterLineSpace GetInterLineSpaceRule() const { return eInterLineSpace; }
-
- virtual sal_uInt16 GetValueCount() const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
- virtual sal_uInt16 GetEnumValue() const;
- virtual void SetEnumValue( sal_uInt16 nNewVal );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/measfld.hxx b/editeng/inc/editeng/measfld.hxx
deleted file mode 100644
index 904d8bdf03..0000000000
--- a/editeng/inc/editeng/measfld.hxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDIT_MEASFIELD_HXX
-#define _EDIT_MEASFIELD_HXX
-
-#include <editeng/eeitem.hxx>
-
-#ifndef _FLDITEM_HXX
-#ifndef ITEMID_FIELD
-#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
-#include "editeng/editengdllapi.h"
-
-#define SDR_MEASUREFIELD 50
-
-class SdrMeasureObj;
-
-enum SdrMeasureFieldKind {SDRMEASUREFIELD_VALUE,SDRMEASUREFIELD_UNIT,SDRMEASUREFIELD_ROTA90BLANCS};
-
-class EDITENG_DLLPUBLIC SdrMeasureField: public SvxFieldData {
- SdrMeasureFieldKind eMeasureFieldKind;
-public:
- SV_DECL_PERSIST1(SdrMeasureField,SvxFieldData,SDR_MEASUREFIELD)
- SdrMeasureField(): eMeasureFieldKind(SDRMEASUREFIELD_VALUE) {}
- SdrMeasureField(SdrMeasureFieldKind eNewKind): eMeasureFieldKind(eNewKind) {}
- virtual ~SdrMeasureField();
- virtual SvxFieldData* Clone() const;
- virtual int operator==(const SvxFieldData&) const;
- SdrMeasureFieldKind GetMeasureFieldKind() const { return eMeasureFieldKind; }
- void SetMeasureFieldKind(SdrMeasureFieldKind eNewKind) { eMeasureFieldKind=eNewKind; }
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#endif //_SVDFIELD_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/memberids.hrc b/editeng/inc/editeng/memberids.hrc
deleted file mode 100755
index e3e57292f8..0000000000
--- a/editeng/inc/editeng/memberids.hrc
+++ /dev/null
@@ -1,197 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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 _EDT_UNOMID_HXX
-#define _EDT_UNOMID_HXX
-
-#include <svl/memberid.hrc>
-
-#define MID_LOCATION 0x3c
-#define MID_TRANSPARENT 0x4b
-#define MID_BG_COLOR 0x22
-#define MID_FLAGS 0x2e
-#define MID_DISTANCE 0x29
-#define MID_FG_COLOR 0x2c
-#define MID_OUTER_WIDTH 0x41
-#define MID_INNER_WIDTH 0x35
-#define MID_LINESPACE 0x3b
-#define MID_LINE_STYLE 0x90
-
-
-//NameOrIndex
-#define MID_NAME 16
-#define MID_GRAFURL 32
-
-// SvxPageModelItem
-#define MID_AUTO 1
-
-// SvxTabStop
-#define MID_TABSTOPS 0
-#define MID_STD_TAB 1
-
-//SvxHyphenZoneItem
-#define MID_IS_HYPHEN 0
-#define MID_HYPHEN_MIN_LEAD 1
-#define MID_HYPHEN_MIN_TRAIL 2
-#define MID_HYPHEN_MAX_HYPHENS 3
-
-// SvxBoxInfoItem
-#define MID_HORIZONTAL 1
-#define MID_VERTICAL 2
-#define MID_VALIDFLAGS 4
-
-//AdjustItem
-#define MID_PARA_ADJUST 0
-#define MID_LAST_LINE_ADJUST 1
-#define MID_EXPAND_SINGLE 2
-
-//SvxFontItem
-// Don't use 0 as it used for the whole struct
-#define MID_FONT_FAMILY_NAME 1
-#define MID_FONT_STYLE_NAME 2
-#define MID_FONT_FAMILY 3
-#define MID_FONT_CHAR_SET 4
-#define MID_FONT_PITCH 5
-
-// SvxCharReliefItem
-#define MID_RELIEF 0
-
-//SvxCharRotateItem
-#define MID_ROTATE 0
-#define MID_FITTOLINE 1
-
-//SvxExcapementItem
-#define MID_ESC 0
-#define MID_ESC_HEIGHT 1
-#define MID_AUTO_ESC 2
-
-//SvxFontWidthItem
-#define MID_FONTWIDTH 0
-#define MID_FONTWIDTH_PROP 1
-
-//SvxFontHeightItem
-#define MID_FONTHEIGHT 1
-#define MID_FONTHEIGHT_PROP 2
-#define MID_FONTHEIGHT_DIFF 3
-
-//SvxTextLineItem
-#define MID_TEXTLINED 0
-#define MID_TL_STYLE 1
-#define MID_TL_COLOR 2
-#define MID_TL_HASCOLOR 3
-
-//SvxCrossedOutItem
-#define MID_CROSSED_OUT 0
-#define MID_CROSS_OUT 1
-
-//SvxPostureItem
-#define MID_ITALIC 0
-#define MID_POSTURE 1
-
-//SvxBoolItem
-#define MID_BOLD 0
-#define MID_WEIGHT 1
-
-//SvxLanguageItem
-#define MID_LANG_INT 0
-#define MID_LANG_LOCALE 1
-
-//SvxEmphasisMarkItem
-#define MID_EMPHASIS 0
-
-//SvxTwoLinesItem
-#define MID_TWOLINES 0
-#define MID_START_BRACKET 1
-#define MID_END_BRACKET 2
-
-//ULSpaceItem
-#define MID_UL_MARGIN 1
-#define MID_UL_REL_MARGIN 2
-#define MID_UP_MARGIN 3
-#define MID_LO_MARGIN 4
-#define MID_UP_REL_MARGIN 5
-#define MID_LO_REL_MARGIN 6
-
-//LRSpaceItem
-#define MID_LR_MARGIN 0
-#define MID_LRP_MARGIN 1
-#define MID_LR_REL_MARGIN 2
-#define MID_LRP_REL_MARGIN 3
-#define MID_L_MARGIN 4
-#define MID_R_MARGIN 5
-#define MID_L_REL_MARGIN 6
-#define MID_R_REL_MARGIN 7
-#define MID_FIRST_LINE_INDENT 8
-#define MID_FIRST_LINE_REL_INDENT 9
-#define MID_FIRST_AUTO 10
-#define MID_TXT_LMARGIN 11
-
-//ProtectItem
-#define MID_PROTECT_CONTENT 0
-#define MID_PROTECT_SIZE 1
-#define MID_PROTECT_POSITION 2
-
-//SvxBoxItem
-#define LEFT_BORDER 1
-#define RIGHT_BORDER 2
-#define TOP_BORDER 3
-#define BOTTOM_BORDER 4
-#define BORDER_DISTANCE 5
-#define LEFT_BORDER_DISTANCE 6
-#define RIGHT_BORDER_DISTANCE 7
-#define TOP_BORDER_DISTANCE 8
-#define BOTTOM_BORDER_DISTANCE 9
-#define MID_LEFT_BORDER 10
-#define MID_RIGHT_BORDER 11
-#define MID_TOP_BORDER 12
-#define MID_BOTTOM_BORDER 13
-
-//BrushItem
-#define MID_BACK_COLOR 0
-#define MID_GRAPHIC_POSITION 1
-#define MID_GRAPHIC_LINK 2
-#define MID_GRAPHIC 3
-#define MID_GRAPHIC_TRANSPARENT 4
-#define MID_GRAPHIC_URL 5
-#define MID_GRAPHIC_FILTER 6
-#define MID_GRAPHIC_REPEAT 7
-#define MID_GRAPHIC_TRANSPARENCY 8
-#define MID_BACK_COLOR_R_G_B 9
-#define MID_BACK_COLOR_TRANSPARENCY 10
-
-//SvxFmtBreakItem
-#define MID_BREAK_BEFORE 0
-#define MID_BREAK_AFTER 1
-
-//SvxCaseMapItem
-#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
deleted file mode 100644
index 72cff69e3c..0000000000
--- a/editeng/inc/editeng/mutxhelp.hxx
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_MUTXHELP_HXX
-#define _SVX_MUTXHELP_HXX
-
-#include <osl/mutex.hxx>
-
-class SvxMutexHelper
-{
-private:
- ::osl::Mutex maMutex;
-
-public:
- ::osl::Mutex& getMutex() { return maMutex; }
-};
-
-#endif
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/nhypitem.hxx b/editeng/inc/editeng/nhypitem.hxx
deleted file mode 100644
index 291af342c4..0000000000
--- a/editeng/inc/editeng/nhypitem.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_NHYPITEM_HXX
-#define _SVX_NHYPITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxNoHyphenItem -------------------------------------------------
-class EDITENG_DLLPUBLIC SvxNoHyphenItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxNoHyphenItem( const sal_Bool bHyphen /*= sal_True*/,
- const sal_uInt16 nId );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxNoHyphenItem& operator=(const SvxNoHyphenItem& rNHH)
- {
- SetValue( rNHH.GetValue() );
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/nlbkitem.hxx b/editeng/inc/editeng/nlbkitem.hxx
deleted file mode 100644
index 97508edbd3..0000000000
--- a/editeng/inc/editeng/nlbkitem.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_NLBKITEM_HXX
-#define _SVX_NLBKITEM_HXX
-
-// include ---------------------------------------------------------------
-
-
-#include <svl/eitem.hxx>
-#include "editeng/editengdllapi.h"
-
-// class SvxNoLinebreakItem ----------------------------------------------
-class EDITENG_DLLPUBLIC SvxNoLinebreakItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxNoLinebreakItem( const sal_Bool bBreak /*= sal_True*/,
- const sal_uInt16 nId );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxNoLinebreakItem& operator=(const SvxNoLinebreakItem& rLB)
- {
- SetValue( rLB.GetValue() );
- return *this;
- }
-};
-
-
-
-#endif
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/numdef.hxx b/editeng/inc/editeng/numdef.hxx
deleted file mode 100644
index 5d997c2891..0000000000
--- a/editeng/inc/editeng/numdef.hxx
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#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
deleted file mode 100644
index 51d36ec27a..0000000000
--- a/editeng/inc/editeng/numitem.hxx
+++ /dev/null
@@ -1,367 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_NUMITEM_HXX
-#define _SVX_NUMITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <tools/link.hxx>
-#include <tools/string.hxx>
-#include <svl/poolitem.hxx>
-#include <editeng/svxenum.hxx>
-#include <tools/gen.hxx>
-#include <editeng/numdef.hxx>
-#include <tools/color.hxx>
-#include <cppuhelper/weakref.hxx>
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/style/NumberingType.hpp>
-#include <unotools/fontcvt.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvxBrushItem;
-class Font;
-class Graphic;
-class SvxNodeNum;
-class BitmapEx;
-namespace com{namespace sun{ namespace star{
- namespace text{
- class XNumberingFormatter;
- }
-}}}
-
-// -----------------------------------------------------------------------
-//Feature-Flags (only sal_uInt16!)
-#define NUM_CONTINUOUS 0x0001 // consecutive numbers possible?
-#define NUM_CHAR_TEXT_DISTANCE 0x0002 // Distance Symbol<->Text?
-#define NUM_CHAR_STYLE 0x0004 // Character styles?
-#define NUM_BULLET_REL_SIZE 0x0008 // relative bullet size?
-#define NUM_BULLET_COLOR 0x0010 // Bullet color
-#define NUM_SYMBOL_ALIGNMENT 0x0040 // alignment 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 // Marker for no numbering
-#define SVX_NO_NUMLEVEL 0x20
-
-#define LINK_TOKEN 0x80 //indicate linked bitmaps - for use in dialog only
-class EDITENG_DLLPUBLIC SvxNumberType
-{
- static sal_Int32 nRefCount;
- static com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter;
-
- sal_Int16 nNumType;
- sal_Bool bShowSymbol; // Also show Symbol ?
-
-public:
- SvxNumberType(sal_Int16 nType = com::sun::star::style::NumberingType::ARABIC);
- SvxNumberType(const SvxNumberType& rType);
- ~SvxNumberType();
-
- String GetNumStr( sal_uLong nNo ) const;
- String GetNumStr( sal_uLong nNo, const com::sun::star::lang::Locale& rLocale ) const;
-
- void SetNumberingType(sal_Int16 nSet) {nNumType = nSet;}
- sal_Int16 GetNumberingType() const {return nNumType;}
-
- void SetShowSymbol(sal_Bool bSet) {bShowSymbol = bSet;}
- sal_Bool IsShowSymbol()const{return bShowSymbol;}
-
- sal_Bool IsTxtFmt() const
- {
- return com::sun::star::style::NumberingType::NUMBER_NONE != nNumType &&
- com::sun::star::style::NumberingType::CHAR_SPECIAL != nNumType &&
- com::sun::star::style::NumberingType::BITMAP != nNumType;
- }
-};
-
-class EDITENG_DLLPUBLIC SvxNumberFormat : public SvxNumberType
-{
-public:
- enum SvxNumPositionAndSpaceMode
- {
- LABEL_WIDTH_AND_POSITION,
- LABEL_ALIGNMENT
- };
- enum SvxNumLabelFollowedBy
- {
- LISTTAB,
- SPACE,
- NOTHING
- };
-
-private:
- String sPrefix;
- String sSuffix;
-
- SvxAdjust eNumAdjust;
-
- sal_uInt8 nInclUpperLevels; // Take over numbers from the previous level.
- sal_uInt16 nStart; // Start of counting
-
- sal_Unicode cBullet; // Symbol
- sal_uInt16 nBulletRelSize; // percentage size of bullets
- Color nBulletColor; // Bullet color
-
- // mode indicating, if the position and spacing of the list label is
- // determined by the former attributes (nFirstLineOffset, nAbsLSpace,
- // nLSpace and nCharTextDistance) called position and spacing via label
- // width and position (LABEL_WIDTH_AND_POSITION) or by the new attributes
- // (meLabelFollowedBy, mnListtabPos, mnFirstLineIndent and mnIndentAt)
- // called position and spacing via label alignment.
- // Note 1: Attribute <eNumAdjust> is relevant for both modes.
- // Note 2: The values of the former attributes are treated as 0, if mode
- // LABEL_ALIGNMENT is active.
- SvxNumPositionAndSpaceMode mePositionAndSpaceMode;
-
- short nFirstLineOffset; // First line indent
- short nAbsLSpace; // Distance Border<->Number
- short nLSpace; // relative to the previous indentation
- short nCharTextDistance; // Distance Number<->Text
-
- // specifies what follows the list label before the text of the first line
- // of the list item starts
- SvxNumLabelFollowedBy meLabelFollowedBy;
- // specifies an additional list tab stop position for meLabelFollowedBy = LISTTAB
- long mnListtabPos;
- // specifies the first line indent
- long mnFirstLineIndent;
- // specifies the indent before the text, e.g. in L2R-layout the left margin
- long mnIndentAt;
-
- SvxBrushItem* pGraphicBrush;
- sal_Int16 eVertOrient; // vertical alignment of a bitmap
-
- Size aGraphicSize; // Always! in 1/100 mm
- Font* pBulletFont; // Pointer to the bullet font
-
- 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:
- SvxNumberFormat( sal_Int16 nNumberingType,
- SvxNumPositionAndSpaceMode ePositionAndSpaceMode = LABEL_WIDTH_AND_POSITION );
- SvxNumberFormat(const SvxNumberFormat& rFormat);
-
- virtual ~SvxNumberFormat();
-
- SvStream& Store(SvStream &rStream, FontToSubsFontConverter pConverter);
-
- SvxNumberFormat& operator=( const SvxNumberFormat& );
- sal_Bool operator==( const SvxNumberFormat& ) const;
- sal_Bool operator!=( const SvxNumberFormat& rFmt) const {return !(*this == rFmt);}
-
- void SetNumAdjust(SvxAdjust eSet) {eNumAdjust = eSet;}
- SvxAdjust GetNumAdjust() const {return eNumAdjust;}
- void SetPrefix(const String& rSet) { sPrefix = rSet;}
- const String& GetPrefix() const { return sPrefix;}
- void SetSuffix(const String& rSet) { sSuffix = rSet;}
- const String& GetSuffix() const { return sSuffix;}
-
- void SetCharFmtName(const String& rSet){ sCharStyleName = rSet; }
- virtual const String& GetCharFmtName()const;
-
- void SetBulletFont(const Font* pFont);
- const Font* GetBulletFont() const {return pBulletFont;}
- void SetBulletChar(sal_Unicode cSet){cBullet = cSet;}
- sal_Unicode GetBulletChar()const {return cBullet;}
- void SetBulletRelSize(sal_uInt16 nSet) {nBulletRelSize = nSet;}
- sal_uInt16 GetBulletRelSize() const { return nBulletRelSize;}
- void SetBulletColor(Color nSet){nBulletColor = nSet;}
- Color GetBulletColor()const {return nBulletColor;}
-
- void SetIncludeUpperLevels( sal_uInt8 nSet ) { nInclUpperLevels = nSet;}
- sal_uInt8 GetIncludeUpperLevels()const { return nInclUpperLevels;}
- void SetStart(sal_uInt16 nSet) {nStart = nSet;}
- sal_uInt16 GetStart() const {return nStart;}
-
- virtual void SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize = 0, const sal_Int16* pOrient = 0);
- const SvxBrushItem* GetBrush() const {return pGraphicBrush;}
- void SetGraphic( const String& rName );
- virtual void SetVertOrient(sal_Int16 eSet);
- virtual sal_Int16 GetVertOrient() const;
- void SetGraphicSize(const Size& rSet) {aGraphicSize = rSet;}
- const Size& GetGraphicSize() const {return aGraphicSize;}
-
- SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const;
- void SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode );
-
- void SetLSpace(short nSet) {nLSpace = nSet;}
- short GetLSpace() const;
- void SetAbsLSpace(short nSet) {nAbsLSpace = nSet;}
- short GetAbsLSpace() const;
- void SetFirstLineOffset(short nSet) { nFirstLineOffset = nSet;}
- short GetFirstLineOffset() const;
- void SetCharTextDistance(short nSet) { nCharTextDistance = nSet; }
- short GetCharTextDistance() const;
-
- void SetLabelFollowedBy( const SvxNumLabelFollowedBy eLabelFollowedBy );
- SvxNumLabelFollowedBy GetLabelFollowedBy() const;
- void SetListtabPos( const long nListtabPos );
- long GetListtabPos() const;
- void SetFirstLineIndent( const long nFirstLineIndent );
- 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 );
-};
-
-enum SvxNumRuleType
-{
- SVX_RULETYPE_NUMBERING,
- SVX_RULETYPE_OUTLINE_NUMBERING,
- SVX_RULETYPE_PRESENTATION_NUMBERING,
- SVX_RULETYPE_END
-};
-
-class EDITENG_DLLPUBLIC SvxNumRule
-{
- 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 indicating valid levels
-
- static sal_Int32 nRefCount;
- com::sun::star::lang::Locale aLocale;
-public:
- SvxNumRule( sal_uLong nFeatures,
- sal_uInt16 nLevels,
- sal_Bool bCont,
- SvxNumRuleType eType = SVX_RULETYPE_NUMBERING,
- SvxNumberFormat::SvxNumPositionAndSpaceMode
- eDefaultNumberFormatPositionAndSpaceMode
- = SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
- SvxNumRule(const SvxNumRule& rCopy);
- virtual ~SvxNumRule();
-
- int operator==( const SvxNumRule& ) const;
- int operator!=( const SvxNumRule& rRule ) const {return !(*this == rRule);}
-
- SvxNumRule& operator=( const SvxNumRule& );
-
- SvStream& Store(SvStream &rStream);
-
- const SvxNumberFormat* Get(sal_uInt16 nLevel)const;
- const SvxNumberFormat& GetLevel(sal_uInt16 nLevel)const;
- void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat& rFmt, sal_Bool bIsValid = sal_True);
- void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt);
-
- sal_Bool IsContinuousNumbering()const
- {return bContinuousNumbering;}
- void SetContinuousNumbering(sal_Bool bSet)
- {bContinuousNumbering = bSet;}
-
- sal_uInt16 GetLevelCount() const {return nLevelCount;}
- sal_Bool IsFeatureSupported(sal_uInt32 nFeature) const
- {return 0 != (nFeatureFlags & nFeature);}
- sal_uInt32 GetFeatureFlags() const {return nFeatureFlags;}
- void SetFeatureFlag( sal_uInt32 nFlag, sal_Bool bSet = sal_True ) { if(bSet) nFeatureFlags |= nFlag; else nFeatureFlags &= ~nFlag; }
-
- String MakeNumString( const SvxNodeNum&, sal_Bool bInclStrings = sal_True ) const;
-
- SvxNumRuleType GetNumRuleType() const { return eNumberingType; }
- void SetNumRuleType( const SvxNumRuleType& rType ) { eNumberingType = rType; }
-
- sal_Bool UnLinkGraphics();
-};
-
-class EDITENG_DLLPUBLIC SvxNumBulletItem : public SfxPoolItem
-{
- SvxNumRule* pNumRule;
-public:
- SvxNumBulletItem(SvxNumRule& rRule);
- SvxNumBulletItem(SvxNumRule& rRule, sal_uInt16 nWhich );
- SvxNumBulletItem(const SvxNumBulletItem& rCopy);
- virtual ~SvxNumBulletItem();
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
- virtual int operator==( const SfxPoolItem& ) const;
-
- SvxNumRule* GetNumRule() const {return pNumRule;}
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-};
-
-class SvxNodeNum
-{
- 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 );
- inline SvxNodeNum& operator=( const SvxNodeNum& rCpy );
-
- sal_uInt8 GetLevel() const { return nMyLevel; }
- void SetLevel( sal_uInt8 nVal ) { nMyLevel = nVal; }
-
- sal_Bool IsStart() const { return bStartNum; }
- void SetStart( sal_Bool bFlag = sal_True ) { bStartNum = bFlag; }
-
- sal_uInt16 GetSetValue() const { return nSetValue; }
- void SetSetValue( sal_uInt16 nVal ) { nSetValue = nVal; }
-
- const sal_uInt16* GetLevelVal() const { return nLevelVal; }
- sal_uInt16* GetLevelVal() { return nLevelVal; }
-};
-
-SvxNodeNum::SvxNodeNum( sal_uInt8 nLevel, sal_uInt16 nSetVal )
- : nSetValue( nSetVal ), nMyLevel( nLevel ), bStartNum( sal_False )
-{
- memset( nLevelVal, 0, sizeof( nLevelVal ) );
-}
-
-inline SvxNodeNum& SvxNodeNum::operator=( const SvxNodeNum& rCpy )
-{
- nSetValue = rCpy.nSetValue;
- nMyLevel = rCpy.nMyLevel;
- bStartNum = rCpy.bStartNum;
-
- memcpy( nLevelVal, rCpy.nLevelVal, sizeof( nLevelVal ) );
- 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
deleted file mode 100644
index 5676b47ddd..0000000000
--- a/editeng/inc/editeng/opaqitem.hxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_OPAQITEM_HXX
-#define _SVX_OPAQITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include "editeng/editengdllapi.h"
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxOpaqueItem ---------------------------------------------------
-
-
-/* [Description]
-
- This item describes a logical variable "Opaque yes or no."
-*/
-
-class EDITENG_DLLPUBLIC SvxOpaqueItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxOpaqueItem( const sal_uInt16 nId , const sal_Bool bOpa = sal_True );
- inline SvxOpaqueItem &operator=( const SvxOpaqueItem &rCpy );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-};
-
-inline SvxOpaqueItem::SvxOpaqueItem( const sal_uInt16 nId, const sal_Bool bOpa )
- : SfxBoolItem( nId, bOpa )
-{}
-
-inline SvxOpaqueItem &SvxOpaqueItem::operator=( const SvxOpaqueItem &rCpy )
-{
- SetValue( rCpy.GetValue() );
- return *this;
-}
-
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/optitems.hxx b/editeng/inc/editeng/optitems.hxx
deleted file mode 100644
index fc4e23d040..0000000000
--- a/editeng/inc/editeng/optitems.hxx
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _EDITENG_OPTITEMS_HXX
-#define _EDITENG_OPTITEMS_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <editeng/editengdllapi.h>
-
-// forward ---------------------------------------------------------------
-namespace com { namespace sun { namespace star {
-namespace linguistic2{
- class XSpellChecker1;
-}}}}
-
-
-// class SfxSpellCheckItem -----------------------------------------------
-
-class EDITENG_DLLPUBLIC SfxSpellCheckItem: public SfxPoolItem
-{
-public:
- TYPEINFO();
-
- SfxSpellCheckItem( ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > &xChecker,
- sal_uInt16 nWhich );
- SfxSpellCheckItem( const SfxSpellCheckItem& rItem );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual int operator==( const SfxPoolItem& ) const;
-
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 >
- GetXSpellChecker() const { return xSpellCheck; }
-
-private:
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > xSpellCheck;
-};
-
-
-// class SfxHyphenRegionItem ---------------------------------------------
-
-class EDITENG_DLLPUBLIC SfxHyphenRegionItem: public SfxPoolItem
-{
- sal_uInt8 nMinLead;
- sal_uInt8 nMinTrail;
-
-public:
- TYPEINFO();
-
- SfxHyphenRegionItem( const sal_uInt16 nId );
- SfxHyphenRegionItem( const SfxHyphenRegionItem& rItem );
-
- virtual int operator==( const SfxPoolItem& ) const;
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVer ) const;
- virtual SvStream& Store( SvStream& rStrm, sal_uInt16 ) const;
-
- inline sal_uInt8 &GetMinLead() { return nMinLead; }
- inline sal_uInt8 GetMinLead() const { return nMinLead; }
-
- inline sal_uInt8 &GetMinTrail() { return nMinTrail; }
- inline sal_uInt8 GetMinTrail() const { return nMinTrail; }
-
- inline SfxHyphenRegionItem& operator=( const SfxHyphenRegionItem& rNew )
- {
- nMinLead = rNew.GetMinLead();
- nMinTrail = rNew.GetMinTrail();
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/orphitem.hxx b/editeng/inc/editeng/orphitem.hxx
deleted file mode 100644
index 2d61bfcf7a..0000000000
--- a/editeng/inc/editeng/orphitem.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_ORPHITEM_HXX
-#define _SVX_ORPHITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/intitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxOrphansItem --------------------------------------------------
-
-/* [Description]
-
- This item describes the number of lines for the orphans system.
-*/
-
-class EDITENG_DLLPUBLIC SvxOrphansItem: public SfxByteItem
-{
- friend SvStream & operator<<( SvStream & aS, SvxOrphansItem & );
-public:
- TYPEINFO();
-
- SvxOrphansItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxOrphansItem& operator=( const SvxOrphansItem& rOrphans )
- {
- SetValue( rOrphans.GetValue() );
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/outliner.hxx b/editeng/inc/editeng/outliner.hxx
deleted file mode 100644
index 7661ff02f4..0000000000
--- a/editeng/inc/editeng/outliner.hxx
+++ /dev/null
@@ -1,1066 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _OUTLINER_HXX
-#define _OUTLINER_HXX
-
-#include <tools/gen.hxx>
-#include <tools/string.hxx>
-#include <tools/debug.hxx>
-
-#include <svl/brdcst.hxx>
-
-#include <editeng/editdata.hxx>
-#include <i18npool/lang.h>
-#include <tools/color.hxx>
-#include <vcl/graph.hxx>
-#include <tools/link.hxx>
-#include <rsc/rscsfx.hxx>
-#include "editeng/editengdllapi.h"
-
-#include <svtools/grfmgr.hxx>
-
-#include <tools/rtti.hxx> // due to typedef TypeId
-#include <vector>
-
-class OutlinerEditEng;
-class Outliner;
-class EditView;
-class EditUndo;
-class ParagraphList;
-class OutlinerParaObject;
-class SvStream;
-class SvxBulletItem;
-class SvxFont;
-class SvxSearchItem;
-class SvxFieldItem;
-class OLUndoRemove;
-class Window;
-class KeyEvent;
-class MouseEvent;
-class Pointer;
-class CommandEvent;
-class MapMode;
-class OutputDevice;
-class PolyPolygon;
-class SfxStyleSheetPool;
-class SfxStyleSheet;
-class SfxItemPool;
-class SfxItemSet;
-class SvxNumBulletItem;
-class SvxNumberFormat;
-class SvxLRSpaceItem;
-class EditEngine;
-class SvKeyValueIterator;
-class SvxForbiddenCharactersTable;
-
-namespace svl
-{
- class IUndoManager;
-}
-
-#include <com/sun/star/uno/Reference.h>
-
-#include <rtl/ref.hxx>
-#include <editeng/svxfont.hxx>
-#include <editeng/eedata.hxx>
-#include <editeng/paragraphdata.hxx>
-
-class SvxFieldData;
-//////////////////////////////////////////////////////////////////////////////
-
-namespace com { namespace sun { namespace star { namespace linguistic2 {
- class XSpellChecker1;
- class XHyphenator;
-}}}}
-namespace svx{
-struct SpellPortion;
-typedef std::vector<SpellPortion> SpellPortions;
-}
-
-namespace basegfx { class B2DPolyPolygon; }
-
-// internal use only!
-#define PARAFLAG_DROPTARGET 0x1000
-#define PARAFLAG_DROPTARGET_EMPTY 0x2000
-#define PARAFLAG_HOLDDEPTH 0x4000
-#define PARAFLAG_SETBULLETTEXT 0x8000
-#define PARAFLAG_ISPAGE 0x0100
-
-// Undo-Action-Ids
-#define OLUNDO_DEPTH EDITUNDO_USER
-// #define OLUNDO_HEIGHT EDITUNDO_USER+1
-#define OLUNDO_EXPAND EDITUNDO_USER+2
-#define OLUNDO_COLLAPSE EDITUNDO_USER+3
-// #define OLUNDO_REMOVE EDITUNDO_USER+4
-#define OLUNDO_ATTR EDITUNDO_USER+5
-#define OLUNDO_INSERT EDITUNDO_USER+6
-// #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7
-#define OLUNDO_CHECKPARA EDITUNDO_USER+8
-
-class Paragraph : protected ParagraphData
-{
-private:
- friend class Outliner;
- friend class ParagraphList;
- friend class OutlinerView;
- friend class OutlinerParaObject;
- friend class OutlinerEditEng;
- friend class OLUndoDepth;
- friend class OutlinerUndoCheckPara;
- friend class OutlinerUndoChangeParaFlags;
-
- Paragraph& operator=(const Paragraph& rPara );
-
- sal_uInt16 nFlags;
- XubString aBulText;
- Size aBulSize;
- sal_Bool bVisible;
-
- sal_Bool IsVisible() const { return bVisible; }
- void SetText( const XubString& rText ) { aBulText = rText; aBulSize.Width() = -1; }
- void Invalidate() { aBulSize.Width() = -1; }
- void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.Width() = -1; }
- const XubString& GetText() const { return aBulText; }
-
- Paragraph( sal_Int16 nDepth );
- Paragraph( const Paragraph& );
- Paragraph( const ParagraphData& );
- ~Paragraph();
-
- sal_Int16 GetDepth() const { return nDepth; }
-
- sal_Int16 GetNumberingStartValue() const { return mnNumberingStartValue; }
- void SetNumberingStartValue( sal_Int16 nNumberingStartValue );
-
- sal_Bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; }
- void SetParaIsNumberingRestart( sal_Bool bParaIsNumberingRestart );
-
- void SetFlag( sal_uInt16 nFlag ) { nFlags |= nFlag; }
- void RemoveFlag( sal_uInt16 nFlag ) { nFlags &= ~nFlag; }
- bool HasFlag( sal_uInt16 nFlag ) const { return (nFlags & nFlag) != 0; }
-};
-
-struct ParaRange
-{
- sal_uInt16 nStartPara;
- sal_uInt16 nEndPara;
-
- ParaRange( sal_uInt16 nS, sal_uInt16 nE ) { nStartPara = nS, nEndPara = nE; }
-
- void Adjust();
- sal_uInt16 Len() const { return 1 + ( ( nEndPara > nStartPara ) ? (nEndPara-nStartPara) : (nStartPara-nEndPara) ); }
-};
-
-inline void ParaRange::Adjust()
-{
- if ( nStartPara > nEndPara )
- {
- sal_uInt16 nTmp = nStartPara;
- nStartPara = nEndPara;
- nEndPara = nTmp;
- }
-}
-
-#define OL_ROOTPARENT (Paragraph*)NULL
-
-class EDITENG_DLLPUBLIC OutlinerView
-{
- friend class Outliner;
-
-private:
-
- Outliner* pOwner;
- EditView* pEditView;
-
- // Drag & Drop
- sal_Bool bBeginDragAtMove_OLDMEMBER;
- sal_Bool bInDragMode;
- Point aDDStartPosRef;
- Point aDDStartPosPix;
- sal_uLong nDDStartPara;
- sal_uLong nDDStartParaVisChildCount;
- sal_uLong nDDCurPara;
- sal_uInt16 nDDStartDepth;
- sal_uInt16 nDDCurDepth;
- sal_uInt16 nDDMaxDepth;
- sal_Bool bDDChangingDepth;
- sal_Bool bDDCursorVisible;
- long* pHorTabArrDoc;
- long nDDScrollLRBorderWidthWin; // Left Right
- long nDDScrollTBBorderWidthWin; // Top Bottom
- long nDDScrollLROffs;
- long nDDScrollTDOffs;
-
- void* pDummy;
- sal_uLong nDummy;
-
- enum MouseTarget {
- MouseText = 0,
- MouseBullet = 1,
- MouseHypertext = 2, // Outside OutputArea
- MouseOutside = 3, // Outside OutputArea
- MouseDontKnow = 4
- };
- MouseTarget OLD_ePrevMouseTarget;
-
-#ifdef _OUTLINER_CXX
-
- EDITENG_DLLPRIVATE void ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand );
-
- EDITENG_DLLPRIVATE sal_uLong ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget);
- EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph* pParentPara );
- EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChilds );
- EDITENG_DLLPRIVATE void ImpHideDDCursor();
- EDITENG_DLLPRIVATE void ImpShowDDCursor();
- EDITENG_DLLPRIVATE void ImpPaintDDCursor();
-
- EDITENG_DLLPRIVATE void ImpDragScroll( const Point& rPosPix );
- EDITENG_DLLPRIVATE void ImpScrollLeft();
- EDITENG_DLLPRIVATE void ImpScrollRight();
- EDITENG_DLLPRIVATE void ImpScrollUp();
- EDITENG_DLLPRIVATE void ImpScrollDown();
-
- EDITENG_DLLPRIVATE sal_uLong ImpGetInsertionPara( const Point& rPosPixel );
- EDITENG_DLLPRIVATE Point ImpGetDocPos( const Point& rPosPixel );
- EDITENG_DLLPRIVATE Pointer ImpGetMousePointer( MouseTarget eTarget );
- EDITENG_DLLPRIVATE sal_uInt16 ImpInitPaste( sal_uLong& rStart );
- EDITENG_DLLPRIVATE void ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize);
- EDITENG_DLLPRIVATE sal_uInt16 ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected );
- EDITENG_DLLPRIVATE sal_Bool ImpIsIndentingPages();
-
-#endif
-
-public:
- OutlinerView( Outliner* pOut, Window* pWindow );
- virtual ~OutlinerView();
-
- EditView& GetEditView() const { return *pEditView; }
-
- void Scroll( long nHorzScroll, long nVertScroll );
-
- void Paint( const Rectangle& rRect );
- sal_Bool PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin = NULL );
- sal_Bool MouseButtonDown( const MouseEvent& );
- sal_Bool MouseButtonUp( const MouseEvent& );
- sal_Bool MouseMove( const MouseEvent& );
-
- void ShowCursor( sal_Bool bGotoCursor = sal_True );
- void HideCursor();
-
- void SetOutliner( Outliner* pOutliner );
- Outliner* GetOutliner() const { return pOwner; }
-
- void SetWindow( Window* pWindow );
- Window* GetWindow() const;
-
- void SetReadOnly( sal_Bool bReadOnly );
- sal_Bool IsReadOnly() const;
-
- void SetOutputArea( const Rectangle& rRect );
- Rectangle GetOutputArea() const;
-
- Rectangle GetVisArea() const;
-
- void CreateSelectionList (std::vector<Paragraph*> &aSelList) ;
-
- // Retruns the number of selected paragraphs
- sal_uLong Select( Paragraph* pParagraph,
- sal_Bool bSelect=sal_True,
- sal_Bool bWChilds=sal_True);
-
- String GetSelected() const;
- void SelectRange( sal_uLong nFirst, sal_uInt16 nCount );
- void SetAttribs( const SfxItemSet& );
- void Indent( short nDiff );
- void AdjustDepth( short nDX ); // Later replace with Indent!
-
- sal_Bool AdjustHeight( long nDY );
- void AdjustDepth( Paragraph* pPara, short nDX,
- sal_Bool bWithChilds = sal_False );
- void AdjustHeight( Paragraph* pPara, long nDY,
- sal_Bool bWithChilds=sal_False );
-
- sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
-
- void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
- void InsertText( const OutlinerParaObject& rParaObj );
- void Expand();
- void Collapse();
- void Expand( Paragraph* );
- void Collapse( Paragraph* );
- void ExpandAll();
- void CollapseAll();
-
- void SetBackgroundColor( const Color& rColor );
- Color GetBackgroundColor();
-
- SfxItemSet GetAttribs();
-
- void Cut();
- void Copy();
- void Paste();
- void PasteSpecial();
- void EnablePaste( sal_Bool bEnable );
-
- void Undo();
- void Redo();
-
- void SetStyleSheet( SfxStyleSheet* );
- SfxStyleSheet* GetStyleSheet() const;
-
- void SetControlWord( sal_uLong nWord );
- sal_uLong GetControlWord() const;
-
- void SetAnchorMode( EVAnchorMode eMode );
- EVAnchorMode GetAnchorMode() const;
-
- Pointer GetPointer( const Point& rPosPixel );
- void Command( const CommandEvent& rCEvt );
- void RemoveCharAttribs( sal_uLong nPara, sal_uInt16 nWhich = 0 );
-
- void CompleteAutoCorrect();
-
- EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False );
- EESpellState StartThesaurus();
- sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
-
- // for text conversion
- void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
-
- void TransliterateText( sal_Int32 nTransliterationMode );
-
- ESelection GetSelection();
-
- sal_uInt16 GetSelectedScriptType() const;
-
- void SetVisArea( const Rectangle& rRec );
- void SetSelection( const ESelection& );
-
- void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0, sal_Bool bKeepLanguages = sal_False );
- void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs );
- sal_Bool HasSelection() const;
-
- void InsertField( const SvxFieldItem& rFld );
- const SvxFieldItem* GetFieldUnderMousePointer() const;
- const SvxFieldItem* GetFieldUnderMousePointer( sal_uInt16& nPara, xub_StrLen& nPos ) const;
- const SvxFieldItem* GetFieldAtSelection() const;
-
- /** enables numbering for the selected paragraphs if the numbering of the first paragraph is off
- or disables numbering for the selected paragraphs if the numbering of the first paragraph is on
- */
- void ToggleBullets();
-
- /** enables numbering for the selected paragraphs that are not enabled and ignore all selected
- paragraphs that already have numbering enabled.
- */
- void EnableBullets();
-
- sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
- sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False );
- void SpellIgnoreWord();
- void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
-
- void SetInvalidateMore( sal_uInt16 nPixel );
- sal_uInt16 GetInvalidateMore() const;
-
- String GetSurroundingText() const;
- Selection GetSurroundingTextSelection() const;
-};
-
-
-// some thesaurus functionality to avoid code duplication in different projects...
-bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( String &rStatusVal, LanguageType &rLang, const EditView &rEditView );
-void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText );
-
-typedef ::std::vector< OutlinerView* > ViewList;
-
-class EDITENG_DLLPUBLIC DrawPortionInfo
-{
-public:
- const Point& mrStartPos;
- const String& mrText;
- sal_uInt16 mnTextStart;
- sal_uInt16 mnTextLen;
- sal_uInt16 mnPara;
- xub_StrLen mnIndex;
- const SvxFont& mrFont;
- const sal_Int32* mpDXArray;
-
- const EEngineData::WrongSpellVector* mpWrongSpellVector;
- const SvxFieldData* mpFieldData;
- const ::com::sun::star::lang::Locale* mpLocale;
- const Color maOverlineColor;
- const Color maTextLineColor;
-
- sal_uInt8 mnBiDiLevel;
-
- bool mbFilled;
- long mnWidthToFill;
-
- // bitfield
- unsigned mbEndOfLine : 1;
- unsigned mbEndOfParagraph : 1;
- unsigned mbEndOfBullet : 1;
-
- sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; }
- sal_Bool IsRTL() const;
-
- DrawPortionInfo(
- const Point& rPos,
- const String& rTxt,
- sal_uInt16 nTxtStart,
- sal_uInt16 nTxtLen,
- const SvxFont& rFnt,
- sal_uInt16 nPar,
- xub_StrLen nIdx,
- const sal_Int32* pDXArr,
- const EEngineData::WrongSpellVector* pWrongSpellVector,
- const SvxFieldData* pFieldData,
- const ::com::sun::star::lang::Locale* pLocale,
- const Color& rOverlineColor,
- const Color& rTextLineColor,
- sal_uInt8 nBiDiLevel,
- bool bFilled,
- long nWidthToFill,
- bool bEndOfLine,
- bool bEndOfParagraph,
- bool bEndOfBullet)
- : mrStartPos(rPos),
- mrText(rTxt),
- mnTextStart(nTxtStart),
- mnTextLen(nTxtLen),
- mnPara(nPar),
- mnIndex(nIdx),
- mrFont(rFnt),
- mpDXArray(pDXArr),
- mpWrongSpellVector(pWrongSpellVector),
- mpFieldData(pFieldData),
- mpLocale(pLocale),
- maOverlineColor(rOverlineColor),
- maTextLineColor(rTextLineColor),
- mnBiDiLevel(nBiDiLevel),
- mbFilled( bFilled ),
- mnWidthToFill( nWidthToFill ),
- mbEndOfLine(bEndOfLine),
- mbEndOfParagraph(bEndOfParagraph),
- mbEndOfBullet(bEndOfBullet)
- {}
-};
-
-class EDITENG_DLLPUBLIC DrawBulletInfo
-{
-public:
- const GraphicObject maBulletGraphicObject;
- Point maBulletPosition;
- Size maBulletSize;
-
- DrawBulletInfo(
- const GraphicObject& rBulletGraphicObject,
- const Point& rBulletPosition,
- const Size& rBulletSize)
- : maBulletGraphicObject(rBulletGraphicObject),
- maBulletPosition(rBulletPosition),
- maBulletSize(rBulletSize)
- {}
-};
-
-struct EDITENG_DLLPUBLIC PaintFirstLineInfo
-{
- sal_uInt16 mnPara;
- const Point& mrStartPos;
- long mnBaseLineY;
- const Point& mrOrigin;
- short mnOrientation;
- OutputDevice* mpOutDev;
-
- PaintFirstLineInfo( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
- : mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev )
- {}
-};
-
-class SdrPage;
-
-class EditFieldInfo
-{
-private:
- Outliner* pOutliner;
- const SvxFieldItem& rFldItem;
-
- Color* pTxtColor;
- Color* pFldColor;
-
- String aRepresentation;
-
- sal_uInt16 nPara;
- xub_StrLen nPos;
- sal_Bool bSimpleClick;
-
- EditFieldInfo();
- EditFieldInfo( const EditFieldInfo& );
-
- SdrPage* mpSdrPage;
-
-public:
- EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, sal_uInt16 nPa, xub_StrLen nPo )
- : rFldItem( rFItem )
- {
- pOutliner = pOutl;
- nPara = nPa; nPos = nPo;
- pTxtColor = 0; pFldColor = 0; bSimpleClick = sal_False;
- mpSdrPage = 0;
- }
- ~EditFieldInfo()
- {
- delete pTxtColor;
- delete pFldColor;
- }
-
- Outliner* GetOutliner() const { return pOutliner; }
-
- const SvxFieldItem& GetField() const { return rFldItem; }
-
- Color* GetTxtColor() const { return pTxtColor; }
- void SetTxtColor( const Color& rColor )
- { delete pTxtColor; pTxtColor = new Color( rColor ); }
-
- Color* GetFldColor() const { return pFldColor; }
- void SetFldColor( const Color& rColor )
- { delete pFldColor; pFldColor = new Color( rColor ); }
- void ClearFldColor()
- { delete pFldColor; pFldColor = 0; }
-
- sal_uInt16 GetPara() const { return nPara; }
- xub_StrLen GetPos() const { return nPos; }
-
- sal_Bool IsSimpleClick() const { return bSimpleClick; }
- void SetSimpleClick( sal_Bool bSimple ) { bSimpleClick = bSimple; }
-
- const String& GetRepresentation() const { return aRepresentation; }
- String& GetRepresentation() { return aRepresentation; }
- void SetRepresentation( const String& rStr ) { aRepresentation = rStr; }
-
- void SetSdrPage( SdrPage* pPage ) { mpSdrPage = pPage; }
- SdrPage* GetSdrPage() const { return mpSdrPage; }
-};
-
-struct EBulletInfo
-{
- sal_Bool bVisible;
- sal_uInt16 nType; // see SvxNumberType
- String aText;
- SvxFont aFont;
- Graphic aGraphic;
- sal_uInt16 nParagraph;
- Rectangle aBounds;
-
- EBulletInfo() : bVisible( sal_False ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {}
-};
-
-#define OUTLINERMODE_DONTKNOW 0x0000
-#define OUTLINERMODE_TEXTOBJECT 0x0001
-#define OUTLINERMODE_TITLEOBJECT 0x0002
-#define OUTLINERMODE_OUTLINEOBJECT 0x0003
-#define OUTLINERMODE_OUTLINEVIEW 0x0004
-
-#define OUTLINERMODE_USERMASK 0x00FF
-
-#define OUTLINERMODE_SUBTITLE (0x0100|OUTLINERMODE_TEXTOBJECT)
-#define OUTLINERMODE_NOTE (0x0200|OUTLINERMODE_TEXTOBJECT)
-
-class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster
-{
- friend class OutlinerView;
- friend class OutlinerEditEng;
- friend class OutlinerParaObject;
- friend class OLUndoExpand;
- friend class OutlinerUndoChangeDepth;
- friend class OutlinerUndoCheckPara;
- friend class OutlinerUndoChangeParaFlags;
-
- OutlinerEditEng* pEditEngine;
-
- ParagraphList* pParaList;
- ViewList aViewList;
-
- Paragraph* pHdlParagraph;
- sal_uLong mnFirstSelPage;
- Link aDrawPortionHdl;
- Link aDrawBulletHdl;
- Link aExpandHdl;
- Link aParaInsertedHdl;
- Link aParaRemovingHdl;
- Link aDepthChangedHdl;
- Link aWidthArrReqHdl;
- Link aBeginMovingHdl;
- Link aEndMovingHdl;
- Link aIndentingPagesHdl;
- Link aRemovingPagesHdl;
- Link aFieldClickedHdl;
- Link aCalcFieldValueHdl;
- Link maPaintFirstLineHdl;
- Link maBeginPasteOrDropHdl;
- Link maEndPasteOrDropHdl;
-
- sal_Int16 nDepthChangedHdlPrevDepth;
- sal_uInt16 mnDepthChangeHdlPrevFlags;
- sal_Int16 nMaxDepth;
- const sal_Int16 nMinDepth;
- sal_uInt16 nFirstPage;
-
- sal_uInt16 nOutlinerMode;
-
- sal_Bool bIsExpanding; // Only valid in Expand/Collaps-Hdl, reset
- sal_Bool bFirstParaIsEmpty;
- sal_Bool bBlockInsCallback;
- sal_Bool bStrippingPortions;
- sal_Bool bPasting;
-
- sal_uLong nDummy;
-
-#ifdef _OUTLINER_CXX
-
- DECL_LINK( ParaVisibleStateChangedHdl, Paragraph* );
- DECL_LINK( BeginMovingParagraphsHdl, MoveParagraphsInfo* );
- DECL_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo* );
- DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* );
- DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* );
- DECL_LINK( EditEngineNotifyHdl, EENotify* );
- void ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd );
- sal_Bool ImplHasBullet( sal_uInt16 nPara ) const;
- Size ImplGetBulletSize( sal_uInt16 nPara );
- sal_uInt16 ImplGetNumbering( sal_uInt16 nPara, const SvxNumberFormat* pParaFmt );
- void ImplCalcBulletText( sal_uInt16 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChilds );
- String ImplGetBulletText( sal_uInt16 nPara );
- void ImplCheckNumBulletItem( sal_uInt16 nPara );
- void ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction = sal_False );
- void ImplSetLevelDependendStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pLevelStyle = NULL );
-
- void ImplBlockInsertionCallbacks( sal_Bool b );
-
- void ImplCheckStyleSheet( sal_uInt16 nPara, sal_Bool bReplaceExistingStyle );
- void ImpRecalcBulletIndent( sal_uLong nPara );
-
- const SvxBulletItem& ImpGetBullet( sal_uLong nPara, sal_uInt16& );
- void ImpFilterIndents( sal_uLong nFirstPara, sal_uLong nLastPara );
- bool ImpConvertEdtToOut( sal_uInt32 nPara, EditView* pView = 0 );
-
- void ImpTextPasted( sal_uLong nStartPara, sal_uInt16 nCount );
- long ImpCalcMaxBulletWidth( sal_uInt16 nPara, const SvxBulletItem& rBullet );
- Font ImpCalcBulletFont( sal_uInt16 nPara ) const;
- Rectangle ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_Bool bReturnPaperPos );
- long ImpGetTextIndent( sal_uLong nPara );
- sal_Bool ImpCanIndentSelectedPages( OutlinerView* pCurView );
- sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView );
- sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_uInt16 nFirstPage, sal_uInt16 nPages );
-
- sal_uInt16 ImplGetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
- void ImplCheckDepth( sal_Int16& rnDepth ) const;
-#endif
-
-protected:
- void ParagraphInserted( sal_uInt16 nParagraph );
- void ParagraphDeleted( sal_uInt16 nParagraph );
- void ParaAttribsChanged( sal_uInt16 nParagraph );
-
- virtual void StyleSheetChanged( SfxStyleSheet* pStyle );
-
- void InvalidateBullet( Paragraph* pPara, sal_uLong nPara );
- void PaintBullet( sal_uInt16 nPara, const Point& rStartPos,
- const Point& rOrigin, short nOrientation,
- OutputDevice* pOutDev );
-
- // used by OutlinerEditEng. Allows Outliner objects to provide
- // bullet access to the EditEngine.
- virtual const SvxNumberFormat* GetNumberFormat( sal_uInt16 nPara ) const;
-
-public:
-
- Outliner( SfxItemPool* pPool, sal_uInt16 nOutlinerMode );
- virtual ~Outliner();
-
- void Init( sal_uInt16 nOutlinerMode );
- sal_uInt16 GetMode() const { return nOutlinerMode; }
-
- void SetVertical( sal_Bool bVertical );
- sal_Bool IsVertical() const;
-
- void SetFixedCellHeight( sal_Bool bUseFixedCellHeight );
- sal_Bool IsFixedCellHeight() const;
-
- void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
- EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
-
- sal_uInt16 GetScriptType( const ESelection& rSelection ) const;
- LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const;
-
- void SetAsianCompressionMode( sal_uInt16 nCompressionMode );
- sal_uInt16 GetAsianCompressionMode() const;
-
- void SetKernAsianPunctuation( sal_Bool bEnabled );
- sal_Bool IsKernAsianPunctuation() const;
-
- void SetAddExtLeading( sal_Bool b );
- sal_Bool IsAddExtLeading() const;
-
- size_t InsertView( OutlinerView* pView, size_t nIndex = size_t(-1) );
- OutlinerView* RemoveView( OutlinerView* pView );
- 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& );
- void AddText( const OutlinerParaObject& );
- void SetText( const String& rText, Paragraph* pParagraph );
- String GetText( Paragraph* pPara, sal_uLong nParaCount=1 ) const;
-
- OutlinerParaObject* CreateParaObject( sal_uInt16 nStartPara = 0, sal_uInt16 nParaCount = 0xFFFF ) const;
-
- const SfxItemSet& GetEmptyItemSet() const;
-
- void SetRefMapMode( const MapMode& );
- MapMode GetRefMapMode() const;
-
- void SetBackgroundColor( const Color& rColor );
- Color GetBackgroundColor() const;
-
- sal_Int16 GetMinDepth() const { return -1; }
-
- void SetMaxDepth( sal_Int16 nDepth, sal_Bool bCheckParas = sal_False );
- sal_Int16 GetMaxDepth() const { return nMaxDepth; }
-
- void SetUpdateMode( sal_Bool bUpdate );
- sal_Bool GetUpdateMode() const;
-
- void Clear();
-
- void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
-
- sal_uLong GetParagraphCount() const;
- Paragraph* GetParagraph( sal_uLong nAbsPos ) const;
-
- sal_Bool HasParent( Paragraph* pParagraph ) const;
- sal_Bool HasChilds( Paragraph* pParagraph ) const;
- sal_uLong GetChildCount( Paragraph* pParent ) const;
- sal_Bool IsExpanded( Paragraph* pPara ) const;
- Paragraph* GetParent( Paragraph* pParagraph ) const;
- sal_uLong GetAbsPos( Paragraph* pPara );
-
- sal_Int16 GetDepth( sal_uLong nPara ) const;
- void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth );
-
- void SetVisible( Paragraph* pPara, sal_Bool bVisible );
- sal_Bool IsVisible( Paragraph* pPara ) const { return pPara->IsVisible(); }
-
- void EnableUndo( sal_Bool bEnable );
- sal_Bool IsUndoEnabled() const;
- void UndoActionStart( sal_uInt16 nId );
- void UndoActionEnd( sal_uInt16 nId );
- void InsertUndo( EditUndo* pUndo );
- sal_Bool IsInUndo();
-
- void ClearModifyFlag();
- sal_Bool IsModified() const;
-
- Paragraph* GetHdlParagraph() const { return pHdlParagraph; }
- sal_Bool IsExpanding() const { return bIsExpanding; }
-
- virtual void ExpandHdl();
- void SetExpandHdl( const Link& rLink ) { aExpandHdl = rLink; }
- Link GetExpandHdl() const { return aExpandHdl; }
-
- virtual void ParagraphInsertedHdl();
- void SetParaInsertedHdl(const Link& rLink){aParaInsertedHdl=rLink;}
- Link GetParaInsertedHdl() const { return aParaInsertedHdl; }
-
- virtual void ParagraphRemovingHdl();
- void SetParaRemovingHdl(const Link& rLink){aParaRemovingHdl=rLink;}
- Link GetParaRemovingHdl() const { return aParaRemovingHdl; }
-
- virtual void DepthChangedHdl();
- void SetDepthChangedHdl(const Link& rLink){aDepthChangedHdl=rLink;}
- Link GetDepthChangedHdl() const { return aDepthChangedHdl; }
- sal_Int16 GetPrevDepth() const { return nDepthChangedHdlPrevDepth; }
- sal_uInt16 GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; }
-
- virtual long RemovingPagesHdl( OutlinerView* );
- void SetRemovingPagesHdl(const Link& rLink){aRemovingPagesHdl=rLink;}
- Link GetRemovingPagesHdl() const { return aRemovingPagesHdl; }
- virtual long IndentingPagesHdl( OutlinerView* );
- void SetIndentingPagesHdl(const Link& rLink){aIndentingPagesHdl=rLink;}
- Link GetIndentingPagesHdl() const { return aIndentingPagesHdl; }
- // valid only in the two upper handlers
- sal_uInt16 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; }
-
- // valid only in the two upper handlers
- sal_uLong GetFirstSelPage() const { return mnFirstSelPage; }
-
- void SetCalcFieldValueHdl(const Link& rLink ) { aCalcFieldValueHdl= rLink; }
- Link GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; }
-
- void SetFieldClickedHdl(const Link& rLink ) { aFieldClickedHdl= rLink; }
- Link GetFieldClickedHdl() const { return aFieldClickedHdl; }
-
- void SetDrawPortionHdl(const Link& rLink){aDrawPortionHdl=rLink;}
- Link GetDrawPortionHdl() const { return aDrawPortionHdl; }
-
- void SetDrawBulletHdl(const Link& rLink){aDrawBulletHdl=rLink;}
- Link GetDrawBulletHdl() const { return aDrawBulletHdl; }
-
- void SetPaintFirstLineHdl(const Link& rLink) { maPaintFirstLineHdl = rLink; }
- Link GetPaintFirstLineHdl() const { return maPaintFirstLineHdl; }
-
- void SetModifyHdl( const Link& rLink );
- Link GetModifyHdl() const;
-
- void SetNotifyHdl( const Link& rLink );
- Link GetNotifyHdl() const;
-
- void SetStatusEventHdl( const Link& rLink );
- Link GetStatusEventHdl() const;
-
- void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect );
- void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos );
- void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 );
-
- const Size& GetPaperSize() const;
- void SetPaperSize( const Size& rSize );
-
- void SetFirstPageNumber( sal_uInt16 n ) { nFirstPage = n; }
- sal_uInt16 GetFirstPageNumber() const { return nFirstPage; }
-
- void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
- void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
- void ClearPolygon();
- const PolyPolygon* GetPolygon();
-
- const Size& GetMinAutoPaperSize() const;
- void SetMinAutoPaperSize( const Size& rSz );
-
- const Size& GetMaxAutoPaperSize() const;
- void SetMaxAutoPaperSize( const Size& rSz );
-
- void SetDefTab( sal_uInt16 nTab );
- sal_uInt16 GetDefTab() const;
-
- sal_Bool IsFlatMode() const;
- void SetFlatMode( sal_Bool bFlat );
-
- void EnableAutoColor( sal_Bool b );
- sal_Bool IsAutoColorEnabled() const;
-
- void ForceAutoColor( sal_Bool b );
- sal_Bool IsForceAutoColor() const;
-
- EBulletInfo GetBulletInfo( sal_uInt16 nPara );
-
- void SetWordDelimiters( const String& rDelimiters );
- String GetWordDelimiters() const;
- String GetWord( sal_uInt16 nPara, xub_StrLen nIndex );
-
- void StripPortions();
-
- 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,
- const EEngineData::WrongSpellVector* pWrongSpellVector,
- const SvxFieldData* pFieldData,
- bool bEndOfLine,
- bool bEndOfParagraph,
- bool bEndOfBullet,
- const ::com::sun::star::lang::Locale* pLocale,
- 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 );
-
- void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
- SfxStyleSheetPool* GetStyleSheetPool();
-
- sal_Bool IsInSelectionMode() const;
-
- void SetStyleSheet( sal_uLong nPara, SfxStyleSheet* pStyle );
- SfxStyleSheet* GetStyleSheet( sal_uLong nPara );
-
- void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& );
- SfxItemSet GetParaAttribs( sal_uInt16 nPara );
-
- void Remove( Paragraph* pPara, sal_uLong nParaCount );
- sal_Bool Expand( Paragraph* );
- sal_Bool Collapse( Paragraph* );
-
- void SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag );
- void RemoveParaFlag( Paragraph* pPara, sal_uInt16 nFlag );
- bool HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const;
-
- // Returns an array containing the widths of the Bullet Indentations
- // Last value must be -1. Is deleted by the outliner.
- Link GetWidthArrReqHdl() const{ return aWidthArrReqHdl; }
- void SetWidthArrReqHdl(const Link& rLink){aWidthArrReqHdl=rLink; }
-
- void SetControlWord( sal_uLong nWord );
- sal_uLong GetControlWord() const;
-
- Link GetBeginMovingHdl() const { return aBeginMovingHdl; }
- void SetBeginMovingHdl(const Link& rLink) {aBeginMovingHdl=rLink;}
- Link GetEndMovingHdl() const {return aEndMovingHdl;}
- void SetEndMovingHdl( const Link& rLink){aEndMovingHdl=rLink;}
-
- sal_uLong GetLineCount( sal_uLong nParagraph ) const;
- sal_uInt16 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const;
- sal_uLong GetLineHeight( sal_uLong nParagraph, sal_uLong nLine = 0 );
-
- // nFormat 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&
- GetUndoManager();
-
- void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
- void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
- void QuickInsertLineBreak( const ESelection& rSel );
-
- // 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 );
- void QuickFormatDoc( sal_Bool bFull = sal_False );
-
- sal_Bool UpdateFields();
- void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL );
-
- virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
- virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
- virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor );
-
- void SetSpeller( ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 >
- GetSpeller();
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator >
- GetHyphenator() const;
- void SetHyphenator( ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator >& xHyph );
-
- void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
- rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const;
-
- // Depricated
- void SetDefaultLanguage( LanguageType eLang );
- LanguageType GetDefaultLanguage() const;
-
- sal_Bool HasOnlineSpellErrors() const;
- void CompleteOnlineSpelling();
-
- EESpellState HasSpellErrors();
- sal_Bool HasText( const SvxSearchItem& rSearchItem );
- virtual sal_Bool SpellNextDocument();
-
- // for text conversion
- sal_Bool HasConvertibleTextPortion( LanguageType nLang );
- virtual sal_Bool ConvertNextDocument();
-
- void SetEditTextObjectPool( SfxItemPool* pPool );
- SfxItemPool* GetEditTextObjectPool() const;
-
- void SetRefDevice( OutputDevice* pRefDev );
- OutputDevice* GetRefDevice() const;
-
- sal_uInt16 GetFirstLineOffset( sal_uLong nParagraph );
-
- sal_uLong GetTextHeight() const;
- sal_uLong GetTextHeight( sal_uLong nParagraph ) const;
- Point GetDocPosTopLeft( sal_uLong nParagraph );
- Point GetDocPos( const Point& rPaperPos ) const;
- sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 );
- sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bool* pbBuuletPos );
-
- void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 );
- void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY );
- void DoStretchChars( sal_uInt16 nX, sal_uInt16 nY );
- void EraseVirtualDevice();
-
- void SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount );
- sal_uInt16 GetBigTextObjectStart() const;
- sal_Bool ShouldCreateBigTextObject() const;
-
- const EditEngine& GetEditEngine() const { return *((EditEngine*)pEditEngine); }
-
- // this is needed for StarOffice Api
- void SetLevelDependendStyleSheet( sal_uInt16 nPara );
-
- sal_uInt16 GetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
-
- void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
- // 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
- void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck );
- void EndSpelling();
-
- /** sets a link that is called at the beginning of a drag operation at an edit view */
- void SetBeginDropHdl( const Link& rLink );
- Link GetBeginDropHdl() const;
-
- /** sets a link that is called at the end of a drag operation at an edit view */
- void SetEndDropHdl( const Link& rLink );
- Link GetEndDropHdl() const;
-
- /** sets a link that is called before a drop or paste operation. */
- void SetBeginPasteOrDropHdl( const Link& rLink );
- Link GetBeginPasteOrDropHdl() const { return maBeginPasteOrDropHdl; }
-
- /** sets a link that is called after a drop or paste operation. */
- void SetEndPasteOrDropHdl( const Link& rLink );
- Link GetEndPasteOrDropHdl() const { return maEndPasteOrDropHdl; }
-
- virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara );
- virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
-
- virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
- virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/outlobj.hxx b/editeng/inc/editeng/outlobj.hxx
deleted file mode 100644
index c402675bcd..0000000000
--- a/editeng/inc/editeng/outlobj.hxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _OUTLOBJ_HXX
-#define _OUTLOBJ_HXX
-
-//////////////////////////////////////////////////////////////////////////////
-
-#include <tools/solar.h>
-#include <tools/string.hxx>
-#include <rsc/rscsfx.hxx>
-#include <editeng/paragraphdata.hxx>
-#include "editeng/editengdllapi.h"
-
-class EditTextObject;
-class ImplOutlinerParaObject;
-
-//////////////////////////////////////////////////////////////////////////////
-
-class EDITENG_DLLPUBLIC OutlinerParaObject
-{
-private:
- ImplOutlinerParaObject* mpImplOutlinerParaObject;
-
- void ImplMakeUnique();
-
-public:
- // constructors/destructor
- OutlinerParaObject(
- const EditTextObject& rEditTextObject,
- const ParagraphDataVector& rParagraphDataVector = ParagraphDataVector(),
- bool bIsEditDoc = true);
- OutlinerParaObject(const OutlinerParaObject& rCandidate);
- ~OutlinerParaObject();
-
- // assignment operator
- OutlinerParaObject& operator=(const OutlinerParaObject& rCandidate);
-
- // compare operator
- bool operator==(const OutlinerParaObject& rCandidate) const;
- bool operator!=(const OutlinerParaObject& rCandidate) const { return !operator==(rCandidate); }
-
- // #i102062#
- bool isWrongListEqual(const OutlinerParaObject& rCompare) const;
-
- // outliner mode access
- sal_uInt16 GetOutlinerMode() const;
- void SetOutlinerMode(sal_uInt16 nNew);
-
- // vertical access
- bool IsVertical() const;
- void SetVertical(bool bNew);
-
- // data read access
- sal_uInt32 Count() const;
- sal_Int16 GetDepth(sal_uInt16 nPara) const;
- const EditTextObject& GetTextObject() const;
- bool IsEditDoc() const;
- const ParagraphData& GetParagraphData(sal_uInt32 nIndex) const;
-
- // portion info support
- void ClearPortionInfo();
-
- // StyleSheet support
- bool ChangeStyleSheets(const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily);
- void ChangeStyleSheetName(SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName);
- void SetStyleSheets(sal_uInt16 nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily);
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/paperinf.hxx b/editeng/inc/editeng/paperinf.hxx
deleted file mode 100644
index 3c1a7cc493..0000000000
--- a/editeng/inc/editeng/paperinf.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_PAPERINF_HXX
-#define _SVX_PAPERINF_HXX
-
-// INCLUDE ---------------------------------------------------------------
-
-#include <vcl/print.hxx>
-#include <vcl/mapmod.hxx>
-#include <editeng/svxenum.hxx>
-#include "editeng/editengdllapi.h"
-
-// forward ---------------------------------------------------------------
-
-class Printer;
-class Size;
-class String;
-
-// class SvxPaperInfo -----------------------------------------------------
-
-class EDITENG_DLLPUBLIC SvxPaperInfo
-{
-public:
- static Size GetDefaultPaperSize( MapUnit eUnit = MAP_TWIP );
- static Size GetPaperSize( Paper ePaper, MapUnit eUnit = MAP_TWIP );
- static Size GetPaperSize( const Printer* pPrinter );
- static Paper GetSvxPaper( const Size &rSize, MapUnit eUnit = MAP_TWIP, bool bSloppy = sal_False );
- static long GetSloppyPaperDimension( long nSize, MapUnit eUnit = MAP_TWIP );
- static String GetName( Paper ePaper );
-};
-
-// INLINE -----------------------------------------------------------------
-
-inline Size &Swap(Size &rSize)
-{
- const long lVal = rSize.Width();
- rSize.Width() = rSize.Height();
- rSize.Height() = lVal;
- return rSize;
-}
-
-inline Size &LandscapeSwap(Size &rSize)
-{
- if ( rSize.Height() > rSize.Width() )
- Swap( rSize );
- return rSize;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/paragraphdata.hxx b/editeng/inc/editeng/paragraphdata.hxx
deleted file mode 100644
index 778dbdea97..0000000000
--- a/editeng/inc/editeng/paragraphdata.hxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _PARAGRAPH_DATA_HXX
-#define _PARAGRAPH_DATA_HXX
-
-#include <tools/solar.h>
-#include <vector>
-
-//////////////////////////////////////////////////////////////////////////////
-// Only for internal use, oder some kind like hPara for the few
-// functions where you need it outside ( eg. moving paragraphs... )
-//
-// Unfortunately NOT only local (formally in outliner.hxx), but also
-// used in outlobj.hxx. Moved to own header
-
-class ParagraphData
-{
- friend class Paragraph;
- friend class OutlinerParaObject;
-
-protected:
- sal_Int16 nDepth;
- sal_Int16 mnNumberingStartValue;
- sal_Bool mbParaIsNumberingRestart;
-
-public:
- ParagraphData( const ParagraphData& );
- ParagraphData();
-
- ParagraphData& operator=( const ParagraphData& );
-
- // compare operator
- bool operator==(const ParagraphData& rCandidate) const;
-
- // data read access
- sal_Int16 getDepth() const { return nDepth; }
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-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
deleted file mode 100644
index d1e94d6a54..0000000000
--- a/editeng/inc/editeng/paravertalignitem.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_PARAVERTALIGNITEM_HXX
-#define _SVX_PARAVERTALIGNITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/intitem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxParaVertAlignItem ----------------------------------------------
-
-/* [Description]
-
- This item defines the character alignment in the lines of a paragraph.
- Currently the alignment can be none (i.e. baseline), top, center or bottom.
-
-*/
-
-class EDITENG_DLLPUBLIC SvxParaVertAlignItem : public SfxUInt16Item
-{
-public:
- enum { AUTOMATIC, BASELINE, TOP, CENTER, BOTTOM };
- TYPEINFO();
-
- SvxParaVertAlignItem( sal_uInt16 nValue /*= 0*/,
- const sal_uInt16 nId );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- 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 );
-
- inline SvxParaVertAlignItem& operator=( const SvxParaVertAlignItem& rItem )
- {
- SetValue( rItem.GetValue() );
- return *this;
- }
-
- virtual int operator==( const SfxPoolItem& ) const;
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/pbinitem.hxx b/editeng/inc/editeng/pbinitem.hxx
deleted file mode 100644
index c13b14a251..0000000000
--- a/editeng/inc/editeng/pbinitem.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_PBINITEM_HXX
-#define _SVX_PBINITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/intitem.hxx>
-#include <editeng/editengdllapi.h>
-
-// define ----------------------------------------------------------------
-
-#define PAPERBIN_PRINTER_SETTINGS ((sal_uInt8)0xFF)
-
-// class SvxPaperBinItem -------------------------------------------------
-
-/* [Description]
-
- This item describes selecting a paper tray of the printer.
-*/
-
-class EDITENG_DLLPUBLIC SvxPaperBinItem : public SfxByteItem
-{
-public:
- TYPEINFO();
-
- inline SvxPaperBinItem( const sal_uInt16 nId ,
- const sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS );
- inline SvxPaperBinItem &operator=( const SvxPaperBinItem &rCpy );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-};
-
-inline SvxPaperBinItem::SvxPaperBinItem( const sal_uInt16 nId, const sal_uInt8 nT )
- : SfxByteItem( nId, nT )
-{}
-
-inline SvxPaperBinItem &SvxPaperBinItem::operator=(
- const SvxPaperBinItem &rCpy )
-{
- SetValue( rCpy.GetValue() );
- return *this;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/pgrditem.hxx b/editeng/inc/editeng/pgrditem.hxx
deleted file mode 100644
index f79f5f8b33..0000000000
--- a/editeng/inc/editeng/pgrditem.hxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_PGRDITEM_HXX
-#define _SVX_PGRDITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include "editeng/editengdllapi.h"
-
-// class SvxParaGridItem -------------------------------------------------
-
-
-/* [Description]
-
- Paragraph snap to grid
-*/
-
-class EDITENG_DLLPUBLIC SvxParaGridItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxParaGridItem( const sal_Bool bSnapToGrid /*= sal_True*/,
- const sal_uInt16 nId );
-
- // "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;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-};
-
-#endif
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/pmdlitem.hxx b/editeng/inc/editeng/pmdlitem.hxx
deleted file mode 100644
index fa5a38c3a3..0000000000
--- a/editeng/inc/editeng/pmdlitem.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_PMDLITEM_HXX
-#define _SVX_PMDLITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/stritem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxPageModelItem ------------------------------------------------
-
-/* [Description]
-
- This item contains a name of a page template.
-*/
-
-class EDITENG_DLLPUBLIC SvxPageModelItem : public SfxStringItem
-{
-private:
- sal_Bool bAuto;
-
-public:
- TYPEINFO();
-
- inline SvxPageModelItem( sal_uInt16 nWh );
- inline SvxPageModelItem( const String& rModel, sal_Bool bA /*= sal_False*/,
- sal_uInt16 nWh );
- inline SvxPageModelItem& operator=( const SvxPageModelItem& rModel );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
-
- 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 );
- sal_Bool IsAuto() const { return bAuto; }
-};
-
-inline SvxPageModelItem::SvxPageModelItem( sal_uInt16 nWh )
- : bAuto( sal_False )
-{
- SetWhich( nWh );
-}
-
-inline SvxPageModelItem::SvxPageModelItem( const String& rModel, sal_Bool bA,
- sal_uInt16 nWh ) :
- SfxStringItem( nWh, rModel ),
- bAuto( bA )
-{}
-
-inline SvxPageModelItem& SvxPageModelItem::operator=( const SvxPageModelItem& rModel )
-{
- SetValue( rModel.GetValue() );
- return *this;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/postitem.hxx b/editeng/inc/editeng/postitem.hxx
deleted file mode 100644
index 6f55626e85..0000000000
--- a/editeng/inc/editeng/postitem.hxx
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_POSTITEM_HXX
-#define _SVX_POSTITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <vcl/vclenum.hxx>
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxPostureItem --------------------------------------------------
-
-/* [Description]
-
- This item describes the font setting (Italic)
-*/
-
-class EDITENG_DLLPUBLIC SvxPostureItem : public SfxEnumItem
-{
-public:
- TYPEINFO();
-
- SvxPostureItem( const FontItalic ePost /*= ITALIC_NONE*/,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem + SwEnumItem
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
- virtual sal_uInt16 GetValueCount() const;
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual int HasBoolValue() const;
- virtual sal_Bool GetBoolValue() const;
- virtual void SetBoolValue( sal_Bool bVal );
-
- inline SvxPostureItem& operator=(const SvxPostureItem& rPost) {
- SetValue( rPost.GetValue() );
- return *this;
- }
-
- // enum cast
- FontItalic GetPosture() const
- { return (FontItalic)GetValue(); }
- void SetPosture( FontItalic eNew )
- { SetValue( (sal_uInt16)eNew ); }
-};
-
-#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
deleted file mode 100644
index 57735fb55a..0000000000
--- a/editeng/inc/editeng/prntitem.hxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_PRNTITEM_HXX
-#define _SVX_PRNTITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include "editeng/editengdllapi.h"
-
-
-
-// class SvxPrintItem ----------------------------------------------------
-
-
-/* [Description]
-
- This item describes a logical variable "Print yes or no".
-*/
-
-
-class EDITENG_DLLPUBLIC SvxPrintItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxPrintItem( const sal_uInt16 nId , const sal_Bool bPrt = sal_True );
- inline SvxPrintItem &operator=( const SvxPrintItem &rCpy );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-};
-
-inline SvxPrintItem::SvxPrintItem( const sal_uInt16 nId, const sal_Bool bPrt )
- : SfxBoolItem( nId, bPrt )
-{}
-
-inline SvxPrintItem &SvxPrintItem::operator=( const SvxPrintItem &rCpy )
-{
- SetValue( rCpy.GetValue() );
- return *this;
-}
-
-
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/protitem.hxx b/editeng/inc/editeng/protitem.hxx
deleted file mode 100644
index 0d93de7a57..0000000000
--- a/editeng/inc/editeng/protitem.hxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_PROTITEM_HXX
-#define _SVX_PROTITEM_HXX
-
-// include ---------------------------------------------------------------
-
-
-#include <svl/poolitem.hxx>
-#include "editeng/editengdllapi.h"
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxProtectItem --------------------------------------------------
-
-
-/* [Description]
-
- This item describes, if content, size or position should be protected.
-*/
-
-class EDITENG_DLLPUBLIC SvxProtectItem : public SfxPoolItem
-{
- sal_Bool bCntnt :1; // Content protected
- sal_Bool bSize :1; // Size protected
- sal_Bool bPos :1; // Position protected
-
-public:
- TYPEINFO();
-
- inline SvxProtectItem( const sal_uInt16 nId );
- inline SvxProtectItem &operator=( const SvxProtectItem &rCpy );
-
- // "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 SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
-
- sal_Bool IsCntntProtected() const { return bCntnt; }
- sal_Bool IsSizeProtected() const { return bSize; }
- sal_Bool IsPosProtected() const { return bPos; }
- void SetCntntProtect( sal_Bool bNew ) { bCntnt = bNew; }
- void SetSizeProtect ( sal_Bool bNew ) { bSize = bNew; }
- void SetPosProtect ( sal_Bool bNew ) { bPos = bNew; }
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-};
-
-inline SvxProtectItem::SvxProtectItem( const sal_uInt16 nId )
- : SfxPoolItem( nId )
-{
- bCntnt = bSize = bPos = sal_False;
-}
-
-inline SvxProtectItem &SvxProtectItem::operator=( const SvxProtectItem &rCpy )
-{
- bCntnt = rCpy.IsCntntProtected();
- bSize = rCpy.IsSizeProtected();
- bPos = rCpy.IsPosProtected();
- return *this;
-}
-
-
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/prszitem.hxx b/editeng/inc/editeng/prszitem.hxx
deleted file mode 100644
index cc0d3e532f..0000000000
--- a/editeng/inc/editeng/prszitem.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_PRSZITEM_HXX
-#define _SVX_PRSZITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/intitem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxPropSizeItem -------------------------------------------------
-
-/* [Description]
-
- This item describes the relative Font Size.
-*/
-
-class EDITENG_DLLPUBLIC SvxPropSizeItem : public SfxUInt16Item
-{
-public:
- TYPEINFO();
-
- SvxPropSizeItem( const sal_uInt16 nPercent /*= 100*/,
- const sal_uInt16 nID );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxPropSizeItem& operator=(const SvxPropSizeItem& rPropSize)
- {
- SetValue( rPropSize.GetValue() );
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/scriptspaceitem.hxx b/editeng/inc/editeng/scriptspaceitem.hxx
deleted file mode 100644
index 0357b59904..0000000000
--- a/editeng/inc/editeng/scriptspaceitem.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_SRIPTSPACEITEM_HXX
-#define _SVX_SRIPTSPACEITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxScriptSpaceItem ----------------------------------------------
-
-/* [Description]
-
- This item describe the script type of the selected text and is only
- used for the user interface.
-*/
-
-class EDITENG_DLLPUBLIC SvxScriptSpaceItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxScriptSpaceItem( sal_Bool bOn /*= sal_False*/,
- const sal_uInt16 nId );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText,
- const IntlWrapper * = 0 ) const;
-
- inline SvxScriptSpaceItem& operator=(const SvxScriptSpaceItem& rItem )
- {
- SetValue( rItem.GetValue() );
- return *this;
- }
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/scripttypeitem.hxx b/editeng/inc/editeng/scripttypeitem.hxx
deleted file mode 100644
index b15f171c04..0000000000
--- a/editeng/inc/editeng/scripttypeitem.hxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_SCRIPTTYPEITEM_HXX
-#define _SVX_SCRIPTTYPEITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/intitem.hxx>
-#include <svl/languageoptions.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxScriptTypeItem ----------------------------------------------
-
-/* [Description]
-
- This item describes the script type of the selected text and is only
- used for the user interface.
-*/
-
-EDITENG_DLLPUBLIC sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang );
-sal_uInt16 GetItemScriptType( short nI18NType );
-short GetI18NScriptType( sal_uInt16 nItemType );
-
-class EDITENG_DLLPUBLIC SvxScriptTypeItem : public SfxUInt16Item
-{
-public:
- TYPEINFO();
-
- SvxScriptTypeItem( sal_uInt16 nType = SCRIPTTYPE_LATIN );
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
-
-};
-
-class EDITENG_DLLPUBLIC SvxScriptSetItem : public SfxSetItem
-{
-public:
- TYPEINFO();
-
- SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const;
-
- static const SfxPoolItem* GetItemOfScriptSet( const SfxItemSet& rSet,
- sal_uInt16 nWhich );
- inline const SfxPoolItem* GetItemOfScriptSet( sal_uInt16 _nWhich ) const
- { return SvxScriptSetItem::GetItemOfScriptSet( GetItemSet(), _nWhich ); }
-
- static const SfxPoolItem* GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript );
-
- const SfxPoolItem* GetItemOfScript( sal_uInt16 nScript ) const;
-
- void PutItemForScriptType( sal_uInt16 nScriptType, const SfxPoolItem& rItem );
-
- static void GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex);
-
- void GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex) const;
-
- static void GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin, sal_uInt16& rAsian,
- sal_uInt16& rComplex );
- inline void GetSlotIds( sal_uInt16& rLatin, sal_uInt16& rAsian,
- sal_uInt16& rComplex ) const
- { GetSlotIds( Which(), rLatin, rAsian, rComplex ); }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/shaditem.hxx b/editeng/inc/editeng/shaditem.hxx
deleted file mode 100644
index 570c86f336..0000000000
--- a/editeng/inc/editeng/shaditem.hxx
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_SHADITEM_HXX
-#define _SVX_SHADITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <tools/color.hxx>
-#include <svl/eitem.hxx>
-#include <editeng/svxenum.hxx>
-#include <editeng/editengdllapi.h>
-
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxShadowItem ---------------------------------------------------
-
-/* [Description]
-
- This item describes the shadow attribute (color, width and position).
-*/
-
-#define SHADOW_TOP ((sal_uInt16)0)
-#define SHADOW_BOTTOM ((sal_uInt16)1)
-#define SHADOW_LEFT ((sal_uInt16)2)
-#define SHADOW_RIGHT ((sal_uInt16)3)
-
-class EDITENG_DLLPUBLIC SvxShadowItem : public SfxEnumItemInterface
-{
- Color aShadowColor;
- sal_uInt16 nWidth;
- SvxShadowLocation eLocation;
-public:
- TYPEINFO();
-
- SvxShadowItem( const sal_uInt16 nId ,
- const Color *pColor = 0, const sal_uInt16 nWidth = 100 /*5pt*/,
- const SvxShadowLocation eLoc = SVX_SHADOW_NONE );
-
- inline SvxShadowItem& operator=( const SvxShadowItem& rFmtShadow );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
- virtual bool ScaleMetrics( long nMult, long nDiv );
- virtual bool HasMetrics() const;
-
- const Color& GetColor() const { return aShadowColor;}
- void SetColor( const Color &rNew ) { aShadowColor = rNew; }
-
- sal_uInt16 GetWidth() const { return nWidth; }
- SvxShadowLocation GetLocation() const { return eLocation; }
-
- void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; }
- void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; }
-
- // Calculate width of the shadow on the page.
- sal_uInt16 CalcShadowSpace( sal_uInt16 nShadow ) const;
-
- virtual sal_uInt16 GetValueCount() const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
- virtual sal_uInt16 GetEnumValue() const;
- virtual void SetEnumValue( sal_uInt16 nNewVal );
-};
-
-inline SvxShadowItem &SvxShadowItem::operator=( const SvxShadowItem& rFmtShadow )
-{
- aShadowColor = rFmtShadow.aShadowColor;
- nWidth = rFmtShadow.GetWidth();
- eLocation = rFmtShadow.GetLocation();
- return *this;
-}
-
-#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
deleted file mode 100644
index 01019debc1..0000000000
--- a/editeng/inc/editeng/shdditem.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_SHDDITEM_HXX
-#define _SVX_SHDDITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxShadowedItem -------------------------------------------------
-
-/* [Description]
-
- This item describes, whether and how it is shaded.
-*/
-
-class EDITENG_DLLPUBLIC SvxShadowedItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxShadowedItem( const sal_Bool bShadowed /*= sal_False*/,
- const sal_uInt16 nId );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxShadowedItem& operator=(const SvxShadowedItem& rShadow) {
- SetValue(rShadow.GetValue());
- return *this;
- }
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/sizeitem.hxx b/editeng/inc/editeng/sizeitem.hxx
deleted file mode 100644
index 967995e68c..0000000000
--- a/editeng/inc/editeng/sizeitem.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_SIZEITEM_HXX
-#define _SVX_SIZEITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <tools/gen.hxx>
-#include <svl/poolitem.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxSizeItem -----------------------------------------------------
-
-/* [Description]
-
- This item describes a two-dimensional size.
-*/
-
-class EDITENG_DLLPUBLIC SvxSizeItem : public SfxPoolItem
-{
-
- Size aSize;
-
-public:
- TYPEINFO();
-
- SvxSizeItem( const sal_uInt16 nId );
- SvxSizeItem( const sal_uInt16 nId, const Size& rSize);
-
- inline SvxSizeItem& operator=( const SvxSizeItem &rCpy );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
- virtual bool ScaleMetrics( long nMult, long nDiv );
- virtual bool HasMetrics() const;
-
- const Size& GetSize() const { return aSize; }
- void SetSize(const Size& rSize) { aSize = rSize; }
-};
-
-inline SvxSizeItem& SvxSizeItem::operator=( const SvxSizeItem &rCpy )
-{
- aSize = rCpy.aSize;
- return *this;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/spltitem.hxx b/editeng/inc/editeng/spltitem.hxx
deleted file mode 100644
index 4b3c0c6d27..0000000000
--- a/editeng/inc/editeng/spltitem.hxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_SPLTITEM_HXX
-#define _SVX_SPLTITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxFmtSplitItem -------------------------------------------------
-
-/* [Description]
-
- This item describes a logical variable "split paragraph yes or no".
-*/
-
-class EDITENG_DLLPUBLIC SvxFmtSplitItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
- ~SvxFmtSplitItem();
-
- inline SvxFmtSplitItem( const sal_Bool bSplit /*= sal_True*/,
- const sal_uInt16 nWh );
- inline SvxFmtSplitItem& operator=( const SvxFmtSplitItem& rSplit );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-};
-
-inline SvxFmtSplitItem::SvxFmtSplitItem( const sal_Bool bSplit, const sal_uInt16 nWh ) :
- SfxBoolItem( nWh, bSplit )
-{}
-
-inline SvxFmtSplitItem& SvxFmtSplitItem::operator=(
- const SvxFmtSplitItem& rSplit )
-{
- SetValue( rSplit.GetValue() );
- return *this;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/splwrap.hxx b/editeng/inc/editeng/splwrap.hxx
deleted file mode 100644
index 26464976bb..0000000000
--- a/editeng/inc/editeng/splwrap.hxx
+++ /dev/null
@@ -1,163 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_SPLWRAP_HXX
-#define _SVX_SPLWRAP_HXX
-
-// include ---------------------------------------------------------------
-
-#include <editeng/svxenum.hxx>
-#include <tools/string.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include "editeng/editengdllapi.h"
-
-// forward ---------------------------------------------------------------
-
-namespace com { namespace sun { namespace star { namespace linguistic2 {
- class XDictionary;
- class XSpellChecker1;
- class XHyphenator;
-}}}}
-
-class Window;
-
-// misc functions ---------------------------------------------------------------
-
-void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect( String &rOldText, String &rNewText );
-
-/*--------------------------------------------------------------------
- Description: The SpellWrapper
- --------------------------------------------------------------------*/
-
-class EDITENG_DLLPUBLIC SvxSpellWrapper {
-private:
- friend class SvxSpellCheckDialog;
- friend class SvxHyphenWordDialog;
- friend struct SvxHyphenWordDialog_Impl;
-
- Window* pWin;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XInterface > xLast; // result of last spelling/hyphenation attempt
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator > xHyph;
- 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,
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > &xSpellChecker,
- const sal_Bool bStart = sal_False, const sal_Bool bIsAllRight = sal_False,
- const sal_Bool bOther = sal_False, const sal_Bool bRevAllow = sal_True );
- SvxSpellWrapper( Window* pWn,
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator > &xHyphenator,
- const sal_Bool bStart = sal_False, const sal_Bool bOther = sal_False );
-
- virtual ~SvxSpellWrapper();
-
- static sal_Int16 CheckSpellLang(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > xSpell,
- sal_Int16 nLang );
- static sal_Int16 CheckHyphLang(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator > xHyph,
- sal_Int16 nLang );
-
- static void ShowLanguageErrors();
-
- 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; } // 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 >
- GetXSpellChecker() { return xSpell; }
- inline ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator >
- GetXHyphenator() { return xHyph; }
- inline sal_Bool IsAllRight() { return bAllRight; }
- inline Window* GetWin() { return pWin; }
- // can possibly be omitted in ONE_LINGU:
- inline void SetOldLang( const sal_uInt16 nNew ){ nOldLang = nNew; }
- // 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; }
-
-protected:
- ::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XInterface >
- GetLast() { return xLast; }
- void SetLast(const ::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XInterface > &xNewLast)
- { xLast = xNewLast; }
- 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(); // 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 ); // Change Language
- virtual void AutoCorrect( const String& rAktStr, const String& rNewStr );
- 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
deleted file mode 100644
index 3f2ae90c56..0000000000
--- a/editeng/inc/editeng/svxacorr.hxx
+++ /dev/null
@@ -1,403 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _MySVXACORR_HXX
-#define _MySVXACORR_HXX
-
-#include <com/sun/star/embed/XStorage.hpp>
-#include <tools/rtti.hxx>
-#include <svl/svarray.hxx>
-#include <i18npool/lang.h>
-#include <tools/time.hxx>
-#include <tools/date.hxx>
-#include <tools/string.hxx>
-#include <editeng/swafopt.hxx>
-#include "editeng/editengdllapi.h"
-
-class CharClass;
-class SfxPoolItem;
-class SvxAutoCorrect;
-class SvStringsISortDtor;
-class SfxObjectShell;
-class SvxAutoCorrLanguageTable_Impl;
-class SvxAutoCorrLastFileAskTable_Impl;
-class SotStorageRef;
-class SotStorage;
-class Window;
-
-// 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; // * -> 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
-
-// only a mapping class
-class EDITENG_DLLPUBLIC SvxAutoCorrDoc
-{
-public:
- SvxAutoCorrDoc() {}
- virtual ~SvxAutoCorrDoc();
-
- virtual sal_Bool Delete( xub_StrLen nStt, xub_StrLen nEnd ) = 0;
- virtual sal_Bool Insert( xub_StrLen nPos, const String& rTxt ) = 0;
- virtual sal_Bool Replace( xub_StrLen nPos, const String& rTxt ) = 0;
- virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt ) = 0;
-
- virtual sal_Bool SetAttr( xub_StrLen nStt, xub_StrLen nEnd, sal_uInt16 nSlotId,
- SfxPoolItem& ) = 0;
-
- virtual sal_Bool SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const String& rURL ) = 0;
-
- // Return the text of a previous paragraph. This must not be empty!
- // If no paragraph exits or just an empty one, then return 0.
- // The flag indicates:
- // TRUE: before the normal insertion position (TRUE)
- // FALSE: in which the corrected word was inserted.
- // (Does not to have to be the same paragraph !!!!)
- virtual const String* GetPrevPara( sal_Bool bAtNormalPos ) = 0;
-
- virtual sal_Bool ChgAutoCorrWord( xub_StrLen& rSttPos, xub_StrLen nEndPos,
- SvxAutoCorrect& rACorrect,
- const String** ppPara ) = 0;
- // Is called after the change of the signs by the functions
- // - FnCptlSttWrd
- // - FnCptlSttSntnc
- // 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 );
-
- // which language at the position?
- virtual LanguageType GetLanguage( xub_StrLen nPos, sal_Bool bPrevPara = sal_False ) const;
-};
-
-
-class EDITENG_DLLPUBLIC SvxAutocorrWord
-{
- String sShort, sLong;
- 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 )
- {}
-
- const String& GetShort() const { return sShort; }
- const String& GetLong() const { return sLong; }
- sal_Bool IsTextOnly() const { return bIsTxtOnly; }
-};
-
-typedef SvxAutocorrWord* SvxAutocorrWordPtr;
-SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvxAutocorrWordList, SvxAutocorrWordPtr, 10, 10 , EDITENG_DLLPUBLIC)
-
-class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists
-{
- String sShareAutoCorrFile, sUserAutoCorrFile;
- // If the AutoCorr file is newer
- Date aModifiedDate;
- Time aModifiedTime, aLastCheckTime;
-
- LanguageType eLanguage; //LANGUAGE_DONTKNOW use for all languages
- SvStringsISortDtor* pCplStt_ExcptLst;
- SvStringsISortDtor* pWrdStt_ExcptLst;
- SvxAutocorrWordList* pAutocorr_List;
- SvxAutoCorrect& rAutoCorrect;
-
- long nFlags;
-
- sal_Bool IsFileChanged_Imp();
- void LoadXMLExceptList_Imp( SvStringsISortDtor*& rpLst,
- const sal_Char* pStrmName,
- SotStorageRef& rStg);
- void SaveExceptList_Imp( const SvStringsISortDtor& rLst,
- const sal_Char* pStrmName,
- SotStorageRef& rStg,
- sal_Bool bConvert = sal_False);
-
- sal_Bool MakeBlocklist_Imp( SotStorage& rStg );
- void RemoveStream_Imp( const String& rName );
- void MakeUserStorage_Impl();
-
-public:
- SvxAutoCorrectLanguageLists( SvxAutoCorrect& rParent,
- const String& rShareAutoCorrectFile,
- const String& rUserAutoCorrectFile,
- LanguageType eLang);
- ~SvxAutoCorrectLanguageLists();
-
- // Load, Set, Get - the replacement list
- SvxAutocorrWordList* LoadAutocorrWordList();
- void SetAutocorrWordList( SvxAutocorrWordList* pList );
- const SvxAutocorrWordList* GetAutocorrWordList();
-
- // 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);
-
- // 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);
-
- // Save word substitutions:
- // Store these directly in the storage. The word list is updated
- // accordingly!
- // - pure Text
- sal_Bool PutText( const String& rShort, const String& rLong );
- // - Text with attribution (only the SWG - SWG format!)
- sal_Bool PutText( const String& rShort, SfxObjectShell& );
- // - Deleting an entry
- sal_Bool DeleteText( const String& rShort );
-};
-
-
-class EDITENG_DLLPUBLIC SvxAutoCorrect
-{
- friend class SvxAutoCorrectLanguageLists;
-
- String sShareAutoCorrFile, sUserAutoCorrFile;
-
- SvxSwAutoFmtFlags aSwFlags; // StarWriter AutoFormat Flags
-
- // all languages in a table
- SvxAutoCorrLanguageTable_Impl* pLangTable;
- SvxAutoCorrLastFileAskTable_Impl* pLastFileTable;
- CharClass* pCharClass;
-
- bool bRunNext;
-
- LanguageType eCharClassLang;
-
- long nFlags;
- sal_Unicode cStartDQuote, cEndDQuote, cStartSQuote, cEndSQuote,
- cEmDash, cEnDash;
-
-
- // private methods
- SvxAutoCorrectLanguageLists& _GetLanguageList( LanguageType eLang );
-
- void _GetCharClass( LanguageType eLang );
-
-protected:
- // - 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& );
-
- // required language in the table add if possible only when the file exists
- sal_Bool CreateLanguageFile(LanguageType eLang, sal_Bool bNewFile = sal_True);
- // - Return the replacement text (only for SWG format, all others can be
- // taken from the word list!)
- // rShort is the stream name - encrypted!
-public:
-
- sal_Unicode GetQuote( sal_Unicode cInsChar, 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 );
-
- TYPEINFO();
-
- SvxAutoCorrect( const String& rShareAutocorrFile,
- const String& rUserAutocorrFile );
- SvxAutoCorrect( const SvxAutoCorrect& );
- virtual ~SvxAutoCorrect();
-
- // Execute an AutoCorrect.
- // Returns what has been executed, according to the above flags
- sal_uLong AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt,
- xub_StrLen nPos, sal_Unicode cInsChar, sal_Bool bInsert, Window* pFrameWin = NULL );
-
- // Return for the autotext expansion the previous word,
- // AutoCorrect - corresponding algorithm
- sal_Bool GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, const String& rTxt,
- xub_StrLen nPos, String& rWord ) const;
-
- // 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 );
-
- // 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; }
- sal_Unicode GetEndDoubleQuote() const { return cEndDQuote; }
-
- void SetStartSingleQuote( const sal_Unicode cStart ) { cStartSQuote = cStart; }
- void SetEndSingleQuote( const sal_Unicode cEnd ) { cEndSQuote = cEnd; }
- void SetStartDoubleQuote( const sal_Unicode cStart ) { cStartDQuote = cStart; }
- void SetEndDoubleQuote( const sal_Unicode cEnd ) { cEndDQuote = cEnd; }
-
- String GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos,
- sal_Unicode cInsChar, sal_Bool bSttQuote );
- void InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos,
- sal_Unicode cInsChar, sal_Bool bSttQuote, sal_Bool bIns );
-
- // 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 );
-
- // 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 );
-
- // Load, Set, Get - the replacement list
- SvxAutocorrWordList* LoadAutocorrWordList(
- LanguageType eLang = LANGUAGE_SYSTEM )
- { return _GetLanguageList( eLang ).LoadAutocorrWordList(); }
- const SvxAutocorrWordList* GetAutocorrWordList(
- LanguageType eLang = LANGUAGE_SYSTEM )
- { return _GetLanguageList( eLang ).GetAutocorrWordList(); }
-
- // Save word substitutions:
- // Save these directly in the storage. The word list is updated
- // accordingly!
- // - pure Text
- sal_Bool PutText( const String& rShort, const String& rLong, LanguageType eLang = LANGUAGE_SYSTEM );
- // - Text with attribution (only in the SWG - SWG format!)
- sal_Bool PutText( const String& rShort, SfxObjectShell& rShell,
- LanguageType eLang = LANGUAGE_SYSTEM )
- { return _GetLanguageList( eLang ).PutText(rShort, rShell ); }
-
- // - Delete a entry
- sal_Bool DeleteText( const String& rShort, LanguageType eLang = LANGUAGE_SYSTEM);
-
- // 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)
- { return _GetLanguageList( eLang ).LoadCplSttExceptList(); }
- const SvStringsISortDtor* GetCplSttExceptList(
- LanguageType eLang = LANGUAGE_SYSTEM )
- { return _GetLanguageList( eLang ).GetCplSttExceptList(); }
-
- // Adds a single word. The list will be immediately written to the file!
- sal_Bool AddCplSttException( const String& rNew,
- LanguageType eLang = LANGUAGE_SYSTEM );
-
- // 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 )
- { return _GetLanguageList( eLang ).LoadWrdSttExceptList(); }
- const SvStringsISortDtor* GetWrdSttExceptList(
- LanguageType eLang = LANGUAGE_SYSTEM )
- { return _GetLanguageList( eLang ).GetWrdSttExceptList(); }
- // Adds a single word. The list will be immediately written to the file!
- sal_Bool AddWrtSttException( const String& rNew, LanguageType eLang = LANGUAGE_SYSTEM);
-
- // 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);
-
- // Methods for the auto-correction
- sal_Bool FnCptlSttWrd( SvxAutoCorrDoc&, const String&,
- xub_StrLen nSttPos, xub_StrLen nEndPos,
- LanguageType eLang = LANGUAGE_SYSTEM );
- sal_Bool FnChgOrdinalNumber( SvxAutoCorrDoc&, const String&,
- xub_StrLen nSttPos, xub_StrLen nEndPos,
- LanguageType eLang = LANGUAGE_SYSTEM );
- sal_Bool FnChgToEnEmDash( SvxAutoCorrDoc&, const String&,
- xub_StrLen nSttPos, xub_StrLen nEndPos,
- LanguageType eLang = LANGUAGE_SYSTEM );
- sal_Bool FnAddNonBrkSpace( SvxAutoCorrDoc&, const String&,
- xub_StrLen nSttPos, xub_StrLen nEndPos,
- LanguageType eLang = LANGUAGE_SYSTEM );
- sal_Bool FnSetINetAttr( SvxAutoCorrDoc&, const String&,
- xub_StrLen nSttPos, xub_StrLen nEndPos,
- LanguageType eLang = LANGUAGE_SYSTEM );
- sal_Bool FnChgWeightUnderl( SvxAutoCorrDoc&, const String&,
- xub_StrLen nSttPos, xub_StrLen nEndPos,
- LanguageType eLang = LANGUAGE_SYSTEM );
- 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; }
-
- static long GetDefaultFlags();
-
-// returns sal_True for charcters where the function
-// 'SvxAutoCorrect::AutoCorrect' should be called.
-// (used to avoid occasional 'collisions' with (Thai) input-sequence-checking)
- static sal_Bool IsAutoCorrectChar( sal_Unicode cChar );
-
- sal_Bool NeedsHardspaceAutocorr( sal_Unicode cChar );
-
- CharClass& GetCharClass( LanguageType eLang )
- {
- if( !pCharClass || eLang != eCharClassLang )
- _GetCharClass( eLang );
- return *pCharClass;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/svxenum.hxx b/editeng/inc/editeng/svxenum.hxx
deleted file mode 100644
index f9305e0f76..0000000000
--- a/editeng/inc/editeng/svxenum.hxx
+++ /dev/null
@@ -1,228 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_SVXENUM_HXX
-#define _SVX_SVXENUM_HXX
-
-// -----------------------------------------------------------------------
-
-enum SvxCaseMap
-{
- SVX_CASEMAP_NOT_MAPPED,
- SVX_CASEMAP_VERSALIEN,
- SVX_CASEMAP_GEMEINE,
- SVX_CASEMAP_TITEL,
- SVX_CASEMAP_KAPITAELCHEN,
- SVX_CASEMAP_END
-};
-
-enum SvxEscapement
-{
- SVX_ESCAPEMENT_OFF,
- SVX_ESCAPEMENT_SUPERSCRIPT,
- SVX_ESCAPEMENT_SUBSCRIPT,
- SVX_ESCAPEMENT_END
-};
-
-enum SvxShadowLocation
-{
- SVX_SHADOW_NONE,
- SVX_SHADOW_TOPLEFT,
- SVX_SHADOW_TOPRIGHT,
- SVX_SHADOW_BOTTOMLEFT,
- SVX_SHADOW_BOTTOMRIGHT,
- SVX_SHADOW_END
-};
-
-enum SvxTabAdjust
-{
- SVX_TAB_ADJUST_LEFT = 0,
- SVX_TAB_ADJUST_RIGHT,
- SVX_TAB_ADJUST_DECIMAL,
- SVX_TAB_ADJUST_CENTER,
- SVX_TAB_ADJUST_DEFAULT,
- SVX_TAB_ADJUST_END
-};
-
-enum SvxLineSpace
-{
- SVX_LINE_SPACE_AUTO,
- SVX_LINE_SPACE_FIX,
- SVX_LINE_SPACE_MIN,
- SVX_LINE_SPACE_END
-};
-
-enum SvxInterLineSpace
-{
- SVX_INTER_LINE_SPACE_OFF,
- SVX_INTER_LINE_SPACE_PROP,
- SVX_INTER_LINE_SPACE_FIX,
- SVX_INTER_LINE_SPACE_END
-};
-
-enum SvxAdjust
-{
- SVX_ADJUST_LEFT,
- SVX_ADJUST_RIGHT,
- SVX_ADJUST_BLOCK,
- SVX_ADJUST_CENTER,
- SVX_ADJUST_BLOCKLINE,
- SVX_ADJUST_END
-};
-
-enum SvxSpecialLineSpace
-{
- SVX_LINESPACE_USER,
- SVX_LINESPACE_ONE_LINE,
- SVX_LINESPACE_ONE_POINT_FIVE_LINES,
- SVX_LINESPACE_TWO_LINES,
- SVX_LINESPACE_END
-};
-
-enum SvxBreak
-{
- SVX_BREAK_NONE,
- SVX_BREAK_COLUMN_BEFORE,
- SVX_BREAK_COLUMN_AFTER,
- SVX_BREAK_COLUMN_BOTH,
- SVX_BREAK_PAGE_BEFORE,
- SVX_BREAK_PAGE_AFTER,
- SVX_BREAK_PAGE_BOTH,
- SVX_BREAK_END
-};
-
-enum SvxCellHorJustify
-{
- SVX_HOR_JUSTIFY_STANDARD,
- SVX_HOR_JUSTIFY_LEFT,
- SVX_HOR_JUSTIFY_CENTER,
- SVX_HOR_JUSTIFY_RIGHT,
- SVX_HOR_JUSTIFY_BLOCK,
- 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_BLOCK
-};
-
-enum SvxCellOrientation
-{
- SVX_ORIENTATION_STANDARD,
- SVX_ORIENTATION_TOPBOTTOM,
- SVX_ORIENTATION_BOTTOMTOP,
- SVX_ORIENTATION_STACKED
-};
-
-enum SvxDrawToolEnum
-{
- SVX_SNAP_DRAW_SELECT,
- //
- SVX_SNAP_DRAW_LINE,
- SVX_SNAP_DRAW_RECT,
- SVX_SNAP_DRAW_ELLIPSE,
- SVX_SNAP_DRAW_POLYGON_NOFILL,
- SVX_SNAP_DRAW_BEZIER_NOFILL,
- SVX_SNAP_DRAW_FREELINE_NOFILL,
- SVX_SNAP_DRAW_ARC,
- SVX_SNAP_DRAW_PIE,
- SVX_SNAP_DRAW_CIRCLECUT,
- SVX_SNAP_DRAW_TEXT,
- SVX_SNAP_DRAW_TEXT_VERTICAL,
- SVX_SNAP_DRAW_TEXT_MARQUEE,
- SVX_SNAP_DRAW_CAPTION,
- SVX_SNAP_DRAW_CAPTION_VERTICAL
-};
-
-enum SvxDrawAlignEnum
-{
- SVX_OBJECT_ALIGN_LEFT,
- SVX_OBJECT_ALIGN_CENTER,
- SVX_OBJECT_ALIGN_RIGHT,
- SVX_OBJECT_ALIGN_UP,
- SVX_OBJECT_ALIGN_MIDDLE,
- SVX_OBJECT_ALIGN_DOWN
-};
-
-enum SvxDrawBezierEnum
-{
- SVX_BEZIER_MOVE,
- SVX_BEZIER_INSERT,
- SVX_BEZIER_DELETE,
- SVX_BEZIER_CUTLINE,
- SVX_BEZIER_CONVERT,
- SVX_BEZIER_EDGE,
- SVX_BEZIER_SMOOTH,
- SVX_BEZIER_SYMMTR,
- SVX_BEZIER_CLOSE,
- SVX_BEZIER_ELIMINATE_POINTS
-};
-
-enum SvxSpellArea
-{
- SVX_SPELL_BODY = 0,
- SVX_SPELL_BODY_END,
- SVX_SPELL_BODY_START,
- SVX_SPELL_OTHER
-};
-
-enum SvxFrameAnchor
-{
- 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, // 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, // Numbering from the page template
- SVX_NUM_BITMAP,
- 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
deleted file mode 100644
index fbfe9de3c8..0000000000
--- a/editeng/inc/editeng/svxfont.hxx
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_SVXFONT_HXX
-#define _SVX_SVXFONT_HXX
-
-#include <limits.h> // USHRT_MAX
-#include <editeng/svxenum.hxx>
-#include <i18npool/lang.h>
-#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;
-
-class EDITENG_DLLPUBLIC SvxFont : public Font
-{
- LanguageType eLang; // Language
- 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:
- SvxFont();
- SvxFont( const Font &rFont );
- SvxFont( const SvxFont &rFont );
-
- // Methods for Superscript/Subscript
- inline short GetEscapement() const { return nEsc; }
- inline void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
-
- inline sal_uInt8 GetPropr() const { return nPropr; }
- inline void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
- inline void SetProprRel( const sal_uInt8 nNewPropr )
- { SetPropr( (sal_uInt8)( (long)nNewPropr * (long)nPropr / 100L ) ); }
-
- // Kerning
- inline short GetFixKerning() const { return nKern; }
- inline void SetFixKerning( const short nNewKern ) { nKern = nNewKern; }
-
- inline SvxCaseMap GetCaseMap() const { return eCaseMap; }
- inline void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
-
- inline LanguageType GetLanguage() const { return eLang; }
- inline void SetLanguage( const LanguageType eNewLan )
- { eLang = eNewLan; Font::SetLanguage(eNewLan); }
-
- // 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; }
-
- // Consider Upper case, Lower case letters etc.
- String CalcCaseMap( const String &rTxt ) const;
-
-// The following section is not needed by anyone, so it can be excluded.
-#ifndef REDUCEDSVXFONT
- // Handle upper case letters
- void DoOnCapitals( SvxDoCapitals &rDo,
- const sal_uInt16 nPartLen = USHRT_MAX ) const;
-
- void SetPhysFont( OutputDevice *pOut ) const;
- Font ChgPhysFont( OutputDevice *pOut ) const;
-
- Size GetCapitalSize( const OutputDevice *pOut, const String &rTxt,
- const sal_uInt16 nIdx, const sal_uInt16 nLen) const;
- void DrawCapital( OutputDevice *pOut, const Point &rPos, const String &rTxt,
- const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
-
- Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt,
- const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
-
- Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt );
-
- Size GetTxtSize( const OutputDevice *pOut, const String &rTxt,
- const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN );
-
- void DrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt,
- const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
-
- void QuickDrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt,
- const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN, const sal_Int32* pDXArray = NULL ) const;
-
- Size QuickGetTextSize( const OutputDevice *pOut, const String &rTxt,
- const sal_uInt16 nIdx, const sal_uInt16 nLen, sal_Int32* pDXArray = NULL ) const;
-
- void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
- const Point &rPos, const String &rTxt,
- const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
-
-#endif // !REDUCEDSVXFONT
- static void DrawArrow( OutputDevice &rOut, const Rectangle& rRect,
- const Size& rSize, const Color& rCol, sal_Bool bLeft );
- SvxFont& operator=( const SvxFont& rFont );
- SvxFont& operator=( const Font& rFont );
-};
-
-#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
deleted file mode 100644
index 17854b3bc3..0000000000
--- a/editeng/inc/editeng/svxrtf.hxx
+++ /dev/null
@@ -1,483 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVXRTF_HXX
-#define _SVXRTF_HXX
-
-#include <tools/table.hxx>
-#include <tools/string.hxx>
-#include <svl/itemset.hxx>
-#include <svtools/parrtf.hxx>
-
-#define _SVSTDARR_sal_uInt16S
-#include <svl/svstdarr.hxx>
-#include <editeng/editengdllapi.h>
-
-#include <deque>
-#include <utility>
-#include <vector>
-class Font;
-class Color;
-class Graphic;
-class DateTime;
-struct SvxRTFStyleType;
-class SvxRTFItemStackType;
-class SvxRTFItemStackList;
-
-namespace com { namespace sun { namespace star {
- namespace document {
- class XDocumentProperties;
- }
- namespace util {
- struct DateTime;
- }
-} } }
-
-
-// Mapper-Classes for the various requirements on Document positions
-// Swg - NodePosition is a SwIndex, which is used internally
-// EditEngine - ULONG to list of paragraphs
-// .....
-
-class SvxNodeIdx
-{
-public:
- virtual ~SvxNodeIdx() {}
- virtual sal_uLong GetIdx() const = 0;
- virtual SvxNodeIdx* Clone() const = 0; // Cloning itself
-};
-
-class SvxPosition
-{
-public:
- virtual ~SvxPosition() {}
-
- virtual sal_uLong GetNodeIdx() const = 0;
- virtual xub_StrLen GetCntIdx() const = 0;
-
- virtual SvxPosition* Clone() const = 0; // Cloning itself
- virtual SvxNodeIdx* MakeNodeIdx() const = 0; // Cloning NodeIndex
-};
-
-
-typedef Color* ColorPtr;
-typedef std::deque< ColorPtr > SvxRTFColorTbl;
-DECLARE_TABLE( SvxRTFFontTbl, Font* )
-DECLARE_TABLE( SvxRTFStyleTbl, SvxRTFStyleType* )
-typedef SvxRTFItemStackType* SvxRTFItemStackTypePtr;
-SV_DECL_PTRARR_DEL( SvxRTFItemStackList, SvxRTFItemStackTypePtr, 1, 1 )
-
-// SvxRTFItemStack can't be "std::stack< SvxRTFItemStackTypePtr >" type, because
-// the methods are using operator[] in sw/source/filter/rtf/rtftbl.cxx file
-typedef std::deque< SvxRTFItemStackTypePtr > SvxRTFItemStack;
-
-// own helper classes for the RTF Parser
-struct SvxRTFStyleType
-{
- SfxItemSet aAttrSet; // the attributes of Style (+ derivate!)
- String sName;
- sal_uInt16 nBasedOn, nNext;
- sal_Bool bBasedOnIsSet;
- sal_uInt8 nOutlineNo;
- sal_Bool bIsCharFmt;
-
- SvxRTFStyleType( SfxItemPool& rPool, const sal_uInt16* pWhichRange );
-};
-
-
-// Bitmap - Mode
-typedef ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > PictPropertyNameValuePairs;
-struct EDITENG_DLLPUBLIC SvxRTFPictureType
-{
- // Bitmap Format
- enum RTF_BMPSTYLE
- {
- 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
- {
- BINARY_MODE,
- HEX_MODE
- } nMode;
-
- sal_uInt16 nType;
- sal_uInt32 uPicLen;
- sal_uInt16 nWidth, nHeight;
- sal_uInt16 nGoalWidth, nGoalHeight;
- sal_uInt16 nBitsPerPixel;
- sal_uInt16 nPlanes;
- sal_uInt16 nWidthBytes;
- sal_uInt16 nScalX, nScalY;
- short nCropT, nCropB, nCropL, nCropR;
- PictPropertyNameValuePairs aPropertyPairs;
- SvxRTFPictureType() { ResetValues(); }
- // Reset all values to default; is called after loading the Bitmap
- void ResetValues();
-};
-
-// 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,
- nBgColor,
- nColor,
- nContour,
- nCrossedOut,
- nEscapement,
- nFont,
- nFontHeight,
- nKering,
- nLanguage,
- nPosture,
- nShadowed,
- nUnderline,
- nOverline,
- nWeight,
- nWordlineMode,
- nAutoKerning,
- nCJKFont,
- nCJKFontHeight,
- nCJKLanguage,
- nCJKPosture,
- nCJKWeight,
- nCTLFont,
- nCTLFontHeight,
- nCTLLanguage,
- nCTLPosture,
- nCTLWeight,
- nEmphasis,
- nTwoLines,
- nCharScaleX,
- nHorzVert,
- nRuby,
- nRelief,
- nHidden
- ;
- RTFPlainAttrMapIds( const SfxItemPool& rPool );
-};
-
-// 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,
- nAdjust,
- nTabStop,
- nHyphenzone,
- nLRSpace,
- nULSpace,
- nBrush,
- nBox,
- nShadow,
- nOutlineLvl,
- nSplit,
- nKeep,
- nFontAlign,
- nScriptSpace,
- nHangPunct,
- nForbRule,
- nDirection
- ;
- RTFPardAttrMapIds( const SfxItemPool& rPool );
-};
-
-
-
-// -----------------------------------------------------------------------
-
-
-class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
-{
- SvStream &rStrm;
- SvxRTFColorTbl aColorTbl;
- SvxRTFFontTbl aFontTbl;
- SvxRTFStyleTbl aStyleTbl;
- SvxRTFItemStack aAttrStack;
- SvxRTFItemStackList aAttrSetList;
-
- SvUShorts aPlainMap;
- SvUShorts aPardMap;
- SvUShorts aWhichMap;
- String sBaseURL;
-
- SvxPosition* pInsPos;
- SfxItemPool* pAttrPool;
- Color* pDfltColor;
- Font* pDfltFont;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::document::XDocumentProperties> m_xDocProps;
- SfxItemSet *pRTFDefaults;
-
- long nVersionNo;
- int nDfltFont;
-
- 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 ); // Create new ItemStackType:s
- void _ClearStyleAttr( SvxRTFItemStackType& rStkType );
-
- // 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 );
-
- // Excecute pard / plain
- void RTFPardPlain( int bPard, SfxItemSet** ppSet );
-
- void BuildWhichTbl();
-
- enum RTF_CharTypeDef
- {
- NOTDEF_CHARTYPE,
- LOW_CHARTYPE,
- HIGH_CHARTYPE,
- DOUBLEBYTE_CHARTYPE
- };
-
- // set latin/asian/complex character attributes
- void SetScriptAttr(
- RTF_CharTypeDef eType, SfxItemSet& rSet, SfxPoolItem& rItem );
-
-protected:
- virtual void EnterEnvironment();
- virtual void LeaveEnvironment();
- virtual void ResetPard();
- virtual void InsertPara() = 0;
-
-
- String& DelCharAtEnd( String& rStr, const sal_Unicode cDel );
-
- // is called for each token that is recognized in CallParser
- virtual void NextToken( int nToken );
-
- virtual void ReadBitmapData();
- virtual void ReadOLEData();
-
- void ReadStyleTable();
- void ReadColorTable();
- void ReadFontTable();
- void ReadAttr( int nToken, SfxItemSet* pSet );
- void ReadTabAttr( int nToken, SfxItemSet& rSet );
-
- // Read Document-Info
- ::com::sun::star::util::DateTime GetDateTimeStamp( );
- String& GetTextToEndGroup( String& rStr );
- virtual void ReadInfo( const sal_Char* pChkForVerNo = 0 );
-
- inline SfxItemSet& GetAttrSet();
- // no text yet inserted? (SttPos from the top stack entry!)
- int IsAttrSttPos();
- void AttrGroupEnd(); // edit the current, delete from stack
- void SetAllAttrOfStk(); // end all Attr. and set it into doc
-
-
- virtual void InsertText() = 0;
- virtual void MovePos( int bForward = sal_True ) = 0;
- virtual void SetEndPrevPara( SvxNodeIdx*& rpNodePos,
- xub_StrLen& rCntPos )=0;
- virtual void SetAttrInDoc( SvxRTFItemStackType &rSet );
- // for Tokens, which are not evaluated in ReadAttr
- virtual void UnknownAttrToken( int nToken, SfxItemSet* pSet );
-
- // if no-one would like to have any twips
- virtual void CalcValue();
-
- SvxRTFParser( SfxItemPool& rAttrPool,
- SvStream& rIn,
- ::com::sun::star::uno::Reference<
- ::com::sun::star::document::XDocumentProperties> i_xDocProps,
- int bReadNewDoc = sal_True );
- virtual ~SvxRTFParser();
-
- int IsNewDoc() const { return bNewDoc; }
- void SetNewDoc( int bFlag ) { bNewDoc = bFlag; }
- int IsNewGroup() const { return bNewGroup; }
- void SetNewGroup( int bFlag ) { bNewGroup = bFlag; }
- int IsChkStyleAttr() const { return bChkStyleAttr; }
- void SetChkStyleAttr( int bFlag ) { bChkStyleAttr = bFlag; }
- int IsCalcValue() const { return bCalcValue; }
- void SetCalcValue( int bFlag ) { bCalcValue = bFlag; }
- int IsPardTokenRead() const { return bPardTokenRead; }
- void SetPardTokenRead( int bFlag ) { bPardTokenRead = bFlag; }
- int IsReadDocInfo() const { return bReadDocInfo; }
- void SetReadDocInfo( int bFlag ) { bReadDocInfo = bFlag; }
-
- // Query/Set the current insert position
- SvxPosition& GetInsPos() const { return *pInsPos; }
- void SetInsPos( const SvxPosition& rNew );
-
- long GetVersionNo() const { return nVersionNo; }
-
- // Query/Set the mapping IDs for the Pard/Plain attributes
- //(Set: It is noted in the pointers, which thus does not create a copy)
- void AddPardAttr( sal_uInt16 nWhich ) { aPardMap.Insert( nWhich, aPardMap.Count() ); }
- void AddPlainAttr( sal_uInt16 nWhich ) { aPlainMap.Insert( nWhich, aPlainMap.Count() ); }
-
- SvxRTFStyleTbl& GetStyleTbl() { return aStyleTbl; }
- SvxRTFItemStack& GetAttrStack() { return aAttrStack; }
- SvxRTFColorTbl& GetColorTbl() { return aColorTbl; }
- SvxRTFFontTbl& GetFontTbl() { return aFontTbl; }
-
- const String& GetBaseURL() const { return sBaseURL; }
-
- // Read the graphics data and make up for the graphics and the picture
- // meta data.
- // Return - TRUE: the graphic is valid
- sal_Bool ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType );
- // Change the ASCII-HexCodes into binary characters. If invalid data is
- // found (strings not 0-9 | a-f | A-F, then USHRT_MAX is returned,
- // otherwise the number of the converted character.
- xub_StrLen HexToBin( String& rToken );
-
-public:
-
- virtual SvParserState CallParser();
-
- inline const Color& GetColor( size_t nId ) const;
- const Font& GetFont( sal_uInt16 nId ); // Changes the dflt Font
-
- virtual int IsEndPara( SvxNodeIdx* pNd, xub_StrLen nCnt ) const = 0;
-
- // 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; }
- // to set different WhichIds for a different pool.
- RTFPardAttrMapIds& GetPardMap()
- { return (RTFPardAttrMapIds&)*aPardMap.GetData(); }
- RTFPlainAttrMapIds& GetPlainMap()
- { return (RTFPlainAttrMapIds&)*aPlainMap.GetData(); }
- // 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 );
-
- // for asynchronous read from the SvStream
- virtual void Continue( int nToken );
-
- // get RTF default ItemSets. Must be used by pard/plain tokens or in
- // reset of Style-Items
- const SfxItemSet& GetRTFDefaults();
- virtual bool UncompressableStackEntry(const SvxRTFItemStackType &rSet) const;
-};
-
-// The stack for the attributes:
-// this class may only be used by SvxRTFParser!
-class EDITENG_DLLPUBLIC SvxRTFItemStackType
-{
- friend class SvxRTFParser;
- friend class SvxRTFItemStackList;
-
- SfxItemSet aAttrSet;
- SvxNodeIdx *pSttNd, *pEndNd;
- xub_StrLen nSttCnt, nEndCnt;
- SvxRTFItemStackList* pChildList;
- sal_uInt16 nStyleNo;
-
- SvxRTFItemStackType( SfxItemPool&, const sal_uInt16* pWhichRange,
- const SvxPosition& );
- ~SvxRTFItemStackType();
-
- void Add( SvxRTFItemStackTypePtr );
- void Compress( const SvxRTFParser& );
-
-public:
- SvxRTFItemStackType( const SvxRTFItemStackType&, const SvxPosition&,
- int bCopyAttr = sal_False );
- //cmc, I'm very suspicios about SetStartPos, it doesn't change
- //its children's starting position, and the implementation looks
- //bad, consider this deprecated.
- void SetStartPos( const SvxPosition& rPos );
-
- void MoveFullNode(const SvxNodeIdx &rOldNode,
- const SvxNodeIdx &rNewNode);
-
- sal_uLong GetSttNodeIdx() const { return pSttNd->GetIdx(); }
- sal_uLong GetEndNodeIdx() const { return pEndNd->GetIdx(); }
-
- const SvxNodeIdx& GetSttNode() const { return *pSttNd; }
- const SvxNodeIdx& GetEndNode() const { return *pEndNd; }
-
- xub_StrLen GetSttCnt() const { return nSttCnt; }
- xub_StrLen GetEndCnt() const { return nEndCnt; }
-
- SfxItemSet& GetAttrSet() { return aAttrSet; }
- const SfxItemSet& GetAttrSet() const { return aAttrSet; }
-
- sal_uInt16 StyleNo() const { return nStyleNo; }
-
- void SetRTFDefaults( const SfxItemSet& rDefaults );
-};
-
-
-// ----------- Inline Implementations --------------
-
-inline const Color& SvxRTFParser::GetColor( size_t nId ) const
-{
- ColorPtr pColor = (ColorPtr)pDfltColor;
- if( nId < aColorTbl.size() )
- pColor = aColorTbl[ nId ];
- return *pColor;
-}
-
-inline SfxItemSet& SvxRTFParser::GetAttrSet()
-{
- SvxRTFItemStackTypePtr pTmp;
- if( bNewGroup || 0 == ( pTmp = aAttrStack.empty() ? 0 : aAttrStack.back()) )
- pTmp = _GetAttrSet();
- return pTmp->aAttrSet;
-}
-
-
-#endif
- //_SVXRTF_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/swafopt.hxx b/editeng/inc/editeng/swafopt.hxx
deleted file mode 100644
index 0f1583744a..0000000000
--- a/editeng/inc/editeng/swafopt.hxx
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVXSWAFOPT_HXX
-#define _SVXSWAFOPT_HXX
-
-#include <vcl/font.hxx>
-#include "editeng/editengdllapi.h"
-
-class SvStringsISortDtor;
-class SmartTagMgr;
-
-// Class of options for AutoFormat
-struct EDITENG_DLLPUBLIC SvxSwAutoFmtFlags
-{
- Font aBulletFont;
- Font aByInputBulletFont;
- const SvStringsISortDtor* pAutoCmpltList; // only valid inside the Dialog!!!
- SmartTagMgr* pSmartTagMgr;
-
- sal_Unicode cBullet;
- sal_Unicode cByInputBullet;
-
- sal_uInt16 nAutoCmpltWordLen, nAutoCmpltListLen;
- sal_uInt16 nAutoCmpltExpandKey;
-
- sal_uInt8 nRightMargin;
-
- sal_Bool bAutoCorrect : 1;
- sal_Bool bCptlSttSntnc : 1;
- sal_Bool bCptlSttWrd : 1;
- sal_Bool bChkFontAttr : 1;
-
- sal_Bool bChgUserColl : 1;
- sal_Bool bChgEnumNum : 1;
-
- sal_Bool bAFmtByInput : 1;
- sal_Bool bDelEmptyNode : 1;
- sal_Bool bSetNumRule : 1;
-
- sal_Bool bChgOrdinalNumber : 1;
- sal_Bool bChgToEnEmDash : 1;
- sal_Bool bAddNonBrkSpace : 1;
- sal_Bool bChgWeightUnderl : 1;
- sal_Bool bSetINetAttr : 1;
-
- sal_Bool bSetBorder : 1;
- sal_Bool bCreateTable : 1;
- sal_Bool bReplaceStyles : 1;
- sal_Bool bDummy : 1;
-
- sal_Bool bWithRedlining : 1;
-
- sal_Bool bRightMargin : 1;
-
- sal_Bool bAutoCompleteWords : 1;
- sal_Bool bAutoCmpltCollectWords : 1;
- sal_Bool bAutoCmpltEndless : 1;
-// -- under NT here starts a new long
- sal_Bool bAutoCmpltAppendBlanc : 1;
- sal_Bool bAutoCmpltShowAsTip : 1;
-
- sal_Bool bAFmtDelSpacesAtSttEnd : 1;
- sal_Bool bAFmtDelSpacesBetweenLines : 1;
- sal_Bool bAFmtByInpDelSpacesAtSttEnd : 1;
- sal_Bool bAFmtByInpDelSpacesBetweenLines : 1;
-
- sal_Bool bAutoCmpltKeepList : 1;
-
- // some dummies for any new options
- sal_Bool bDummy6 : 1,
- bDummy7 : 1,
- bDummy8 : 1
- ;
-
- SvxSwAutoFmtFlags();
- SvxSwAutoFmtFlags( const SvxSwAutoFmtFlags& rAFFlags ) { *this = rAFFlags; }
- SvxSwAutoFmtFlags& operator=( const SvxSwAutoFmtFlags& );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/tstpitem.hxx b/editeng/inc/editeng/tstpitem.hxx
deleted file mode 100644
index 367e41ace4..0000000000
--- a/editeng/inc/editeng/tstpitem.hxx
+++ /dev/null
@@ -1,180 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_TSPTITEM_HXX
-#define _SVX_TSPTITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <editeng/svxenum.hxx>
-#include <editeng/editengdllapi.h>
-
-// class SvxTabStop ------------------------------------------------------
-
-#define SVX_TAB_DEFCOUNT 10
-#define SVX_TAB_DEFDIST 1134 // 2cm in twips
-#define SVX_TAB_NOTFOUND USHRT_MAX
-#define cDfltDecimalChar (sal_Unicode(0x00)) // Get from IntlWrapper
-#define cDfltFillChar (sal_Unicode(' '))
-
-class EDITENG_DLLPUBLIC SvxTabStop
-{
-private:
- sal_Int32 nTabPos;
-
- SvxTabAdjust eAdjustment;
- mutable sal_Unicode m_cDecimal;
- sal_Unicode cFill;
-
- EDITENG_DLLPRIVATE friend SvStream& operator<<( SvStream&, SvxTabStop& );
-
- void fillDecimal() const;
-
-public:
- SvxTabStop();
- SvxTabStop( const sal_Int32 nPos,
- const SvxTabAdjust eAdjst = SVX_TAB_ADJUST_LEFT,
- const sal_Unicode cDec = cDfltDecimalChar,
- const sal_Unicode cFil = cDfltFillChar );
-
- sal_Int32& GetTabPos() { return nTabPos; }
- sal_Int32 GetTabPos() const { return nTabPos; }
-
- SvxTabAdjust& GetAdjustment() { return eAdjustment; }
- SvxTabAdjust GetAdjustment() const { return eAdjustment; }
-
- sal_Unicode& GetDecimal() { fillDecimal(); return m_cDecimal; }
- sal_Unicode GetDecimal() const { fillDecimal(); return m_cDecimal; }
-
- sal_Unicode& GetFill() { return cFill; }
- sal_Unicode GetFill() const { return cFill; }
-
- String GetValueString() const;
-
- // the "old" operator==()
- sal_Bool IsEqual( const SvxTabStop& rTS ) const
- {
- return ( nTabPos == rTS.nTabPos &&
- eAdjustment == rTS.eAdjustment &&
- m_cDecimal == rTS.m_cDecimal &&
- cFill == rTS.cFill );
- }
-
- // For the SortedArray:
- sal_Bool operator==( const SvxTabStop& rTS ) const
- { return nTabPos == rTS.nTabPos; }
- sal_Bool operator <( const SvxTabStop& rTS ) const
- { return nTabPos < rTS.nTabPos; }
-
- SvxTabStop& operator=( const SvxTabStop& rTS )
- {
- nTabPos = rTS.nTabPos;
- eAdjustment = rTS.eAdjustment;
- m_cDecimal = rTS.m_cDecimal;
- cFill = rTS.cFill;
- return *this;
- }
-};
-
-// class SvxTabStopItem --------------------------------------------------
-
-SV_DECL_VARARR_SORT_VISIBILITY( SvxTabStopArr, SvxTabStop, SVX_TAB_DEFCOUNT, 1, EDITENG_DLLPUBLIC )
-
-/* [Description]
-
- This item describes a list of TabStops.
-*/
-
-class EDITENG_DLLPUBLIC SvxTabStopItem : public SfxPoolItem, private SvxTabStopArr
-{
-//friend class SvxTabStopObject_Impl;
-
-public:
- TYPEINFO();
-
- SvxTabStopItem( sal_uInt16 nWhich );
- SvxTabStopItem( const sal_uInt16 nTabs,
- const sal_uInt16 nDist,
- const SvxTabAdjust eAdjst /*= SVX_TAB_ADJUST_DEFAULT*/,
- sal_uInt16 nWhich );
- SvxTabStopItem( const SvxTabStopItem& rTSI );
-
- // Returns index of the tab or TAB_NOTFOUND
- sal_uInt16 GetPos( const SvxTabStop& rTab ) const;
-
- // Returns index of the tab at nPos, or TAB_NOTFOUND
- sal_uInt16 GetPos( const sal_Int32 nPos ) const;
-
- // unprivatized:
- sal_uInt16 Count() const { return SvxTabStopArr::Count(); }
- sal_Bool Insert( const SvxTabStop& rTab );
- void Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart = 0,
- sal_uInt16 nEnd = USHRT_MAX );
- void Remove( SvxTabStop& rTab )
- { SvxTabStopArr::Remove( rTab ); }
- void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 )
- { SvxTabStopArr::Remove( nPos, nLen ); }
-
- // 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 returns only Stackobjects!
- const SvxTabStop& operator[]( const sal_uInt16 nPos ) const
- {
- DBG_ASSERT( GetStart() &&
- nPos < Count(), "op[]" );
- return *( GetStart() + nPos );
- }
- const SvxTabStop* GetStart() const
- { return SvxTabStopArr::GetData(); }
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
- virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
-
- using SvxTabStopArr::Insert;
- using SvxTabStopArr::Remove;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/twolinesitem.hxx b/editeng/inc/editeng/twolinesitem.hxx
deleted file mode 100644
index 6bcf02b0bd..0000000000
--- a/editeng/inc/editeng/twolinesitem.hxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_TWOLINESITEM_HXX
-#define _SVX_TWOLINESITEM_HXX
-
-#include <sal/types.h>
-#include <svl/poolitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-class EDITENG_DLLPUBLIC SvxTwoLinesItem : public SfxPoolItem
-{
- sal_Unicode cStartBracket, cEndBracket;
- sal_Bool bOn;
-public:
- TYPEINFO();
- SvxTwoLinesItem( sal_Bool bOn /*= sal_True*/,
- sal_Unicode nStartBracket /*= 0*/,
- sal_Unicode nEndBracket /*= 0*/,
- sal_uInt16 nId );
- SvxTwoLinesItem( const SvxTwoLinesItem& rAttr );
- virtual ~SvxTwoLinesItem();
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
- virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVer) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nIVer) const;
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText,
- const IntlWrapper* pIntl = 0 ) const;
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, 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;
-
- SvxTwoLinesItem& operator=( const SvxTwoLinesItem& rCpy )
- {
- SetValue( rCpy.GetValue() );
- SetStartBracket( rCpy.GetStartBracket() );
- SetEndBracket( rCpy.GetEndBracket() );
- return *this;
- }
-
- sal_Bool GetValue() const { return bOn; }
- void SetValue( sal_Bool bFlag ) { bOn = bFlag; }
-
- sal_Unicode GetStartBracket() const { return cStartBracket; }
- void SetStartBracket( sal_Unicode c ) { cStartBracket = c; }
-
- sal_Unicode GetEndBracket() const { return cEndBracket; }
- void SetEndBracket( sal_Unicode c ) { cEndBracket = c; }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/txtrange.hxx b/editeng/inc/editeng/txtrange.hxx
deleted file mode 100644
index 1655b2967a..0000000000
--- a/editeng/inc/editeng/txtrange.hxx
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _MyTXTRANGE_HXX
-#define _MyTXTRANGE_HXX
-
-#include "editeng/editengdllapi.h"
-#include "tools/solar.h"
-#include "tools/gen.hxx"
-
-#include <deque>
-
-class PolyPolygon;
-class Rectangle;
-
-namespace basegfx {
- class B2DPolyPolygon;
-}
-
-typedef std::deque<long>* LongDqPtr;
-
-/*************************************************************************
-|*
-|* class TextRanger
-|*
-*************************************************************************/
-class EDITENG_DLLPUBLIC TextRanger
-{
- //! The RangeCache class is used to cache the result of a single range calculation.
- struct RangeCache
- {
- Range range; //!< Range for which we calculated results.
- std::deque<long> results; //!< Calculated results for the range.
- RangeCache(const Range& rng) : range(rng) {};
- };
- std::deque<RangeCache> mRangeCache; //!< Cached range calculations.
- PolyPolygon *mpPolyPolygon; // Surface polygon
- PolyPolygon *mpLinePolyPolygon; // Line polygon
- Rectangle *pBound; // Comprehensive rectangle
- sal_uInt16 nCacheSize; // Cache-Size
- sal_uInt16 nRight; // Distance Contour-Text
- sal_uInt16 nLeft; // Distance Text-Contour
- sal_uInt16 nUpper; // Distance Contour-Text
- sal_uInt16 nLower; // Distance Text-Contour
- sal_uInt32 nPointCount; // Number of polygon points
- sal_Bool bSimple : 1; // Just outside edge
- sal_Bool bInner : 1; // TRUE: Objekt inline (EditEngine);
- // FALSE: Objekt flow (StarWriter);
- sal_Bool bVertical :1; // for vertical writing mode
- sal_Bool bFlag3 :1;
- sal_Bool bFlag4 :1;
- sal_Bool bFlag5 :1;
- sal_Bool bFlag6 :1;
- sal_Bool bFlag7 :1;
- TextRanger( const TextRanger& ); // not implemented
- const Rectangle& _GetBoundRect();
-public:
- TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon,
- const basegfx::B2DPolyPolygon* pLinePolyPolygon,
- sal_uInt16 nCacheSize, sal_uInt16 nLeft, sal_uInt16 nRight,
- sal_Bool bSimple, sal_Bool bInner, sal_Bool bVert = sal_False );
- ~TextRanger();
- LongDqPtr GetTextRanges( const Range& rRange );
- sal_uInt16 GetRight() const { return nRight; }
- sal_uInt16 GetLeft() const { return nLeft; }
- sal_uInt16 GetUpper() const { return nUpper; }
- sal_uInt16 GetLower() const { return nLower; }
- sal_uInt32 GetPointCount() const { return nPointCount; }
- sal_Bool IsSimple() const { return bSimple; }
- sal_Bool IsInner() const { return bInner; }
- sal_Bool IsVertical() const { return bVertical; }
- sal_Bool HasBorder() const { return nRight || nLeft; }
- const PolyPolygon& GetPolyPolygon() const { return *mpPolyPolygon; }
- const PolyPolygon* GetLinePolygon() const { return mpLinePolyPolygon; }
- const Rectangle& GetBoundRect()
- { return pBound ? static_cast< const Rectangle& >(*pBound) : _GetBoundRect(); }
- void SetUpper( sal_uInt16 nNew ){ nUpper = nNew; }
- void SetLower( sal_uInt16 nNew ){ nLower = nNew; }
- void SetVertical( sal_Bool bNew );
- sal_Bool IsFlag3() const { return bFlag3; }
- void SetFlag3( sal_Bool bNew ) { bFlag3 = bNew; }
- sal_Bool IsFlag4() const { return bFlag4; }
- void SetFlag4( sal_Bool bNew ) { bFlag4 = bNew; }
- sal_Bool IsFlag5() const { return bFlag5; }
- void SetFlag5( sal_Bool bNew ) { bFlag5 = bNew; }
- sal_Bool IsFlag6() const { return bFlag6; }
- void SetFlag6( sal_Bool bNew ) { bFlag6 = bNew; }
- sal_Bool IsFlag7() const { return bFlag7; }
- void SetFlag7( sal_Bool bNew ) { bFlag7 = bNew; }
-};
-
-
-
-#endif // _TXTRANGE_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/udlnitem.hxx b/editeng/inc/editeng/udlnitem.hxx
deleted file mode 100644
index c06bae4e81..0000000000
--- a/editeng/inc/editeng/udlnitem.hxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_UDLNITEM_HXX
-#define _SVX_UDLNITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <vcl/vclenum.hxx>
-#include <tools/color.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxTextLineItem ------------------------------------------------
-
-/* Value container for underline and overline font effects */
-
-class EDITENG_DLLPUBLIC SvxTextLineItem : public SfxEnumItem
-{
- Color mColor;
-public:
- TYPEINFO();
-
- SvxTextLineItem( const FontUnderline eSt,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
- virtual sal_uInt16 GetValueCount() const;
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- // MS VC4.0 messes things up
- void SetValue( sal_uInt16 nNewVal )
- {SfxEnumItem::SetValue(nNewVal); }
- virtual int HasBoolValue() const;
- virtual sal_Bool GetBoolValue() const;
- virtual void SetBoolValue( sal_Bool bVal );
-
- virtual int operator==( const SfxPoolItem& ) const;
-
- inline SvxTextLineItem& operator=(const SvxTextLineItem& rTextLine)
- {
- SetValue( rTextLine.GetValue() );
- SetColor( rTextLine.GetColor() );
- return *this;
- }
-
- // enum cast
- FontUnderline GetLineStyle() const
- { return (FontUnderline)GetValue(); }
- void SetLineStyle( FontUnderline eNew )
- { SetValue((sal_uInt16) eNew); }
-
- const Color& GetColor() const { return mColor; }
- void SetColor( const Color& rCol ) { mColor = rCol; }
-};
-
-// class SvxUnderlineItem ------------------------------------------------
-
-/* Value container for underline font effects */
-
-class EDITENG_DLLPUBLIC SvxUnderlineItem : public SvxTextLineItem
-{
-public:
- TYPEINFO();
-
- SvxUnderlineItem( const FontUnderline eSt,
- const sal_uInt16 nId );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
-};
-
-// class SvxOverlineItem ------------------------------------------------
-
-/* Value container for overline font effects */
-
-class EDITENG_DLLPUBLIC SvxOverlineItem : public SvxTextLineItem
-{
-public:
- TYPEINFO();
-
- SvxOverlineItem( const FontUnderline eSt,
- const sal_uInt16 nId );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
-};
-
-#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
deleted file mode 100644
index d0e38e8dc3..0000000000
--- a/editeng/inc/editeng/ulspitem.hxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_ULSPITEM_HXX
-#define _SVX_ULSPITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/poolitem.hxx>
-#include <editeng/editengdllapi.h>
-
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxULSpaceItem --------------------------------------------------
-
-/* [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; // Upper space
- sal_uInt16 nLower; // Lower space
- sal_uInt16 nPropUpper, nPropLower; // relative or absolute (=100%)
-public:
- TYPEINFO();
-
- SvxULSpaceItem( const sal_uInt16 nId );
- SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
- const sal_uInt16 nId );
- inline SvxULSpaceItem& operator=( const SvxULSpaceItem &rCpy );
-
- // "pure virtual Methods" from SfxPoolItem
- virtual int operator==( const SfxPoolItem& ) const;
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
- virtual bool ScaleMetrics( long nMult, long nDiv );
- virtual bool HasMetrics() const;
-
- inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 );
- inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 );
-
- void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; }
- void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; }
- void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; }
- void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; }
-
- sal_uInt16 GetUpper() const { return nUpper; }
- sal_uInt16 GetLower() const { return nLower; }
- sal_uInt16 GetPropUpper() const { return nPropUpper; }
- sal_uInt16 GetPropLower() const { return nPropLower; }
-};
-
-inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy )
-{
- nUpper = rCpy.GetUpper();
- nLower = rCpy.GetLower();
- nPropUpper = rCpy.GetPropUpper();
- nPropLower = rCpy.GetPropLower();
- return *this;
-}
-
-inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp )
-{
- nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp;
-}
-inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp )
-{
- nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unoedhlp.hxx b/editeng/inc/editeng/unoedhlp.hxx
deleted file mode 100644
index f065cdc0b3..0000000000
--- a/editeng/inc/editeng/unoedhlp.hxx
+++ /dev/null
@@ -1,191 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOEDHLP_HXX
-#define _SVX_UNOEDHLP_HXX
-
-#include <memory>
-#include <tools/solar.h>
-#include <svtools/textdata.hxx>
-#include <svl/hint.hxx>
-#include <tools/gen.hxx>
-#include "editeng/editengdllapi.h"
-
-struct EENotify;
-class EditEngine;
-
-#define EDITSOURCE_HINT_PARASMOVED 20
-#define EDITSOURCE_HINT_SELECTIONCHANGED 21
-
-/** Extends TextHint by two additional parameters which are necessary
- for the EDITSOURCE_HINT_PARASMOVED hint. TextHint's value in this
- case denotes the destination position, the two parameters the
- start and the end of the moved paragraph range.
- */
-class EDITENG_DLLPUBLIC SvxEditSourceHint : public TextHint
-{
-private:
- sal_uLong mnStart;
- sal_uLong mnEnd;
-
-public:
- TYPEINFO();
- SvxEditSourceHint( sal_uLong nId );
- SvxEditSourceHint( sal_uLong nId, sal_uLong nValue, sal_uLong nStart=0, sal_uLong nEnd=0 );
-
- sal_uLong GetValue() const;
- sal_uLong GetStartValue() const;
- sal_uLong GetEndValue() const;
- void SetValue( sal_uLong n );
- void SetStartValue( sal_uLong n );
- void SetEndValue( sal_uLong n );
-};
-
-/** Helper class for common functionality in edit sources
- */
-class EDITENG_DLLPUBLIC SvxEditSourceHelper
-{
-public:
-
- /** Translates EditEngine notifications into broadcastable hints
-
- @param aNotify
- Notification object send by the EditEngine.
-
- @return the translated hint
- */
- static ::std::auto_ptr<SfxHint> EENotification2Hint( EENotify* aNotify );
-
- /** Calculate attribute run for EditEngines
-
- Please note that the range returned is half-open: [nStartIndex,nEndIndex)
-
- @param nStartIndex
- Herein, the start index of the range of similar attributes is returned
-
- @param nEndIndex
- Herein, the end index (exclusive) of the range of similar attributes is returned
-
- @param rEE
- The EditEngine to query for attributes
-
- @param nPara
- The paragraph the following index value is to be interpreted in
-
- @param nIndex
- The character index from which the range of similar attributed characters is requested
-
- @return sal_True, if the range has been successfully determined
- */
- static sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex );
-
- /** Convert point from edit engine to user coordinate space
-
- As the edit engine internally keeps vertical text unrotated,
- all internal edit engine methods return their stuff unrotated,
- too. This method rotates and shifts given point appropriately,
- if vertical writing is on.
-
- @param rPoint
- Point to transform
-
- @param rEESize
- Paper size of the edit engine
-
- @param bIsVertical
- Whether output text is vertical or not
-
- @return the possibly transformed point
- */
- static Point EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical );
-
- /** Convert point from user to edit engine coordinate space
-
- As the edit engine internally keeps vertical text unrotated,
- all internal edit engine methods return their stuff unrotated,
- too. This method rotates and shifts given point appropriately,
- if vertical writing is on.
-
- @param rPoint
- Point to transform
-
- @param rEESize
- Paper size of the edit engine
-
- @param bIsVertical
- Whether output text is vertical or not
-
- @return the possibly transformed point
- */
- static Point UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical );
-
- /** Convert rect from edit engine to user coordinate space
-
- As the edit engine internally keeps vertical text unrotated,
- all internal edit engine methods return their stuff unrotated,
- too. This method rotates and shifts given rect appropriately,
- if vertical writing is on.
-
- @param rRect
- Rectangle to transform
-
- @param rEESize
- Paper size of the edit engine
-
- @param bIsVertical
- Whether output text is vertical or not
-
- @return the possibly transformed rect
- */
- static Rectangle EEToUserSpace( const Rectangle& rRect, const Size& rEESize, bool bIsVertical );
-
- /** Convert rect from user to edit engine coordinate space
-
- As the edit engine internally keeps vertical text unrotated,
- all internal edit engine methods return their stuff unrotated,
- too. This method rotates and shifts given rect appropriately,
- if vertical writing is on.
-
- @param rRect
- Rectangle to transform
-
- @param rEESize
- Paper size of the edit engine
-
- @param bIsVertical
- Whether output text is vertical or not
-
- @return the possibly transformed rect
- */
- static Rectangle UserSpaceToEE( const Rectangle& rRect, const Size& rEESize, bool bIsVertical );
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unoedprx.hxx b/editeng/inc/editeng/unoedprx.hxx
deleted file mode 100644
index a82ab075f5..0000000000
--- a/editeng/inc/editeng/unoedprx.hxx
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOEDPRX_HXX
-#define _SVX_UNOEDPRX_HXX
-
-#include <memory>
-#include <svl/brdcst.hxx>
-#include <editeng/unoedsrc.hxx>
-
-#include <editeng/editdata.hxx>
-#include "editeng/editengdllapi.h"
-
-class SvxAccessibleTextAdapter : public SvxTextForwarder
-{
-public:
- SvxAccessibleTextAdapter();
- virtual ~SvxAccessibleTextAdapter();
-
- virtual sal_uInt16 GetParagraphCount() const;
- virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
- virtual String GetText( const ESelection& rSel ) const;
- virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const;
- virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
- virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
- virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
- virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const;
-
- virtual sal_Int32 CalcLogicalIndex( sal_uInt16 nPara, sal_uInt16 nEEIndex );
- virtual sal_uInt16 CalcEditEngineIndex( sal_uInt16 nPara, sal_Int32 nLogicalIndex );
-
- virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
- virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
-
- virtual void QuickInsertText( const String& rText, const ESelection& rSel );
- virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
- virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
- virtual void QuickInsertLineBreak( const ESelection& rSel );
-
- virtual SfxItemPool* GetPool() const;
-
- virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
- virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
-
- virtual sal_Bool IsValid() const;
-
- virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
- virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
- virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
- virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
- virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
- virtual MapMode GetMapMode() const;
- virtual OutputDevice* GetRefDevice() const;
- virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
- virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
- virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
- virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
- virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
- virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
-
- virtual sal_Bool Delete( const ESelection& );
- virtual sal_Bool InsertText( const String&, const ESelection& );
- virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
- virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
- virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
-
- virtual const SfxItemSet* GetEmptyItemSetPtr();
-
- // implementation functions for XParagraphAppend and XTextPortionAppend
- // (not needed for accessibility, only for new import API)
- virtual void AppendParagraph();
- virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
-
- //XTextCopy
- virtual void CopyText(const SvxTextForwarder& rSource);
-
- void SetForwarder( SvxTextForwarder& );
- sal_Bool HaveImageBullet( sal_uInt16 nPara ) const;
- sal_Bool HaveTextBullet( sal_uInt16 nPara ) const;
-
- /** Query whether all text in given selection is editable
-
- @return sal_True if every character in the given selection can
- be changed, and sal_False if e.g. a field or a bullet is
- contained therein.
- */
- sal_Bool IsEditable( const ESelection& rSelection );
-
-private:
- SvxTextForwarder* mrTextForwarder;
-};
-
-class SvxAccessibleTextEditViewAdapter : public SvxEditViewForwarder
-{
-public:
-
- SvxAccessibleTextEditViewAdapter();
- virtual ~SvxAccessibleTextEditViewAdapter();
-
- // SvxViewForwarder interface
- virtual sal_Bool IsValid() const;
- virtual Rectangle GetVisArea() const;
- virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
- virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
-
- // SvxEditViewForwarder interface
- virtual sal_Bool GetSelection( ESelection& rSelection ) const;
- virtual sal_Bool SetSelection( const ESelection& rSelection );
- virtual sal_Bool Copy();
- virtual sal_Bool Cut();
- virtual sal_Bool Paste();
-
- void SetForwarder( SvxEditViewForwarder&, SvxAccessibleTextAdapter& );
-
-private:
- SvxEditViewForwarder* mrViewForwarder;
- SvxAccessibleTextAdapter* mrTextForwarder;
-};
-
-class EDITENG_DLLPUBLIC SvxEditSourceAdapter : public SvxEditSource
-{
-public:
- SvxEditSourceAdapter();
- ~SvxEditSourceAdapter();
-
- virtual SvxEditSource* Clone() const;
- virtual SvxTextForwarder* GetTextForwarder();
- SvxAccessibleTextAdapter* GetTextForwarderAdapter(); // covariant return types don't work on MSVC
- virtual SvxViewForwarder* GetViewForwarder();
- virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
- SvxAccessibleTextEditViewAdapter* GetEditViewForwarderAdapter( sal_Bool bCreate = sal_False ); // covariant return types don't work on MSVC
- virtual void UpdateData();
- virtual SfxBroadcaster& GetBroadcaster() const;
-
- void SetEditSource( ::std::auto_ptr< SvxEditSource > pAdaptee );
- sal_Bool IsValid() const;
-
-private:
- // declared, but not defined
- SvxEditSourceAdapter( const SvxEditSourceAdapter& );
- SvxEditSourceAdapter& operator= ( const SvxEditSourceAdapter& );
-
- ::std::auto_ptr< SvxEditSource > mpAdaptee;
-
- SvxAccessibleTextAdapter maTextAdapter;
- SvxAccessibleTextEditViewAdapter maEditViewAdapter;
-
- mutable SfxBroadcaster maDummyBroadcaster;
-
- sal_Bool mbEditSourceValid;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unoedsrc.hxx b/editeng/inc/editeng/unoedsrc.hxx
deleted file mode 100644
index 24b90f8ccb..0000000000
--- a/editeng/inc/editeng/unoedsrc.hxx
+++ /dev/null
@@ -1,552 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOEDSRC_HXX
-#define _SVX_UNOEDSRC_HXX
-
-#include <com/sun/star/accessibility/TextSegment.hpp>
-
-#include <tools/solar.h>
-#include <i18npool/lang.h>
-#include <tools/link.hxx>
-#include <tools/gen.hxx>
-#include <vcl/mapmod.hxx>
-#include <tools/string.hxx>
-#include <tools/color.hxx>
-#include <svl/poolitem.hxx>
-#include <svl/itempool.hxx>
-#include "editeng/editengdllapi.h"
-
-#include <list>
-
-struct ESelection;
-struct EFieldInfo;
-struct EBulletInfo;
-class OutputDevice;
-class String;
-class SfxItemSet;
-class SvUShorts;
-class SvxTextForwarder;
-class SvxViewForwarder;
-class SvxEditViewForwarder;
-class SvxFieldItem;
-class SfxBroadcaster;
-class EECharAttribArray;
-class SvxUnoTextRangeBase;
-
-typedef std::list< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseList;
-
-/** Wrapper class for unified EditEngine/Outliner access
-
- This class wraps a textual object, which might or might not
- contain an EditEngine/Outliner. Is used e.g. for filling an
- EditEngine with the content of a cell, note page or page template.
-*/
-class EDITENG_DLLPUBLIC SvxEditSource
-{
-public:
- virtual ~SvxEditSource();
-
- /// Returns a new reference to the same object. This is a shallow copy
- virtual SvxEditSource* Clone() const = 0;
-
- /** Query the text forwarder
-
- @return the text forwarder, or NULL if the underlying object is dead
- */
- virtual SvxTextForwarder* GetTextForwarder() = 0;
-
- /** Query the view forwarder
-
- @return the view forwarder, or NULL if the underlying object
- is dead, or if no view is available
-
- @derive default implementation provided, overriding is optional
- */
- virtual SvxViewForwarder* GetViewForwarder();
-
- /** Query the edit view forwarder
-
- @param bCreate
- Determines whether an EditView should be created, if there is
- none active. If set to sal_True, and the underlying object is
- not in EditMode, the text forwarder changes and the object is
- set to EditMode.
-
- @return the edit view forwarder, or NULL if the underlying
- object is dead, or if no view is available (if bCreate is
- sal_False, NULL is also returned if the object is not in
- EditMode)
-
- @derive default implementation provided, overriding is optional
-
- @attention If this method is called with bCreate equal to
- sal_True, all previously returned text forwarder can become
- invalid
- */
- virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
-
- /// Write back data to model
- virtual void UpdateData() = 0;
-
- /** Returns broadcaster the underlying edit engine's events are sent from
-
- @derive default implementation provided, overriding is optional
- */
- virtual SfxBroadcaster& GetBroadcaster() const;
-
- /** adds the given SvxUnoTextRangeBase to the text object
- capsulated by this SvxEditSource. This allows the text
- object to inform all created text ranges about changes
- and also allows to re use already created instances.
- All SvxUnoTextRangeBase must remove itself with
- removeRange() before theire deleted. */
- virtual void addRange( SvxUnoTextRangeBase* pNewRange );
-
- /** removes the given SvxUnoTextRangeBase from the text
- object capsulated by this SvxEditSource. This text range
- will not be informed any longer of changes on the underlying
- text and will also not re used anymore. */
- virtual void removeRange( SvxUnoTextRangeBase* pOldRange );
-
- /** returns a const list of all text ranges that are registered
- for the underlying text object. */
- virtual const SvxUnoTextRangeBaseList& getRanges() const;
-};
-
-
-/** Contains an EditEngine or an Outliner and unifies access to them.
-
- The EditEngine-UNO objects use this class only. To reflect changes
- not only in the EditEngine, but also in the model data, call
- SvxEditSource::UpdateData(). This copies back the data to the model's
- EditTextObject/OutlinerParaObject.
- */
-class EDITENG_DLLPUBLIC SvxTextForwarder
-{
-public:
- virtual ~SvxTextForwarder();
-
- virtual sal_uInt16 GetParagraphCount() const = 0;
- virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const = 0;
- virtual String GetText( const ESelection& rSel ) const = 0;
- virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const = 0;
- virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const = 0;
- virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) = 0;
- virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ) = 0;
- virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const = 0;
-
- virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0;
- virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const = 0;
-
- virtual void QuickInsertText( const String& rText, const ESelection& rSel ) = 0;
- virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) = 0;
- virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) = 0;
- virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0;
-
- virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) = 0;
- virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ) = 0;
-
- virtual SfxItemPool* GetPool() const = 0;
-
- virtual const SfxItemSet* GetEmptyItemSetPtr() = 0;
-
- // implementation functions for XParagraphAppend and XTextPortionAppend
- virtual void AppendParagraph() = 0;
- virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ) = 0;
-
- // XTextCopy
- virtual void CopyText(const SvxTextForwarder& rSource) = 0;
-
- /** Query state of forwarder
-
- @return sal_False, if no longer valid
- */
- virtual sal_Bool IsValid() const = 0;
-
- /** Query language of character at given position on the underlying edit engine
-
- @param nPara[0 .. n-1]
- Index of paragraph to query language in
-
- @param nIndex[0 .. m-1]
- Index of character to query language of
- */
- virtual LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
-
- /** Query number of fields in the underlying edit engine
-
- @param nPara[0 .. n-1]
- Index of paragraph to query field number in
- */
- virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const = 0;
-
- /** Query information for given field number in the underlying edit engine
-
- @param nPara[0 .. n-1]
- Index of paragraph to query field info in
-
- @param nField[0 .. m-1]
- Index of field to query information of
- */
- virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const = 0;
-
- /** Query information regarding bullets for given paragraph on the underlying edit engine
-
- @param nPara[0 .. n-1]
- Index of paragraph to query bullet info on
- */
- virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const = 0;
-
- /** Query the bounding rectangle of the given character
-
- @param nPara[0 .. n]
- Index of paragraph to query the bounds in. <p>The virtual
- character after the last character of the represented text,
- i.e. the one at position n is a special case. Because it does
- not represent an existing character its bounding box is
- defined in relation to preceding characters. It should be
- rougly equivalent to the bounding box of some character when
- inserted at the end of the text. Its height typically being
- the maximal height of all the characters in the text or the
- height of the preceding character, its width being at least
- one pixel so that the bounding box is not degenerate.<br>
-
- @param nIndex[0 .. m-1]
- Index of character to query the bounds of
-
- @return rectangle in logical coordinates, relative to upper
- left corner of text. The coordinates returned here are to be
- interpreted in the map mode given by GetMapMode().
- */
- virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
-
- /** Query the bounding rectangle of the given paragraph
-
- @param nPara[0 .. n-1]
- Index of paragraph to query the bounds of
-
- @return rectangle in logical coordinates, relative to upper
- left corner of text. The coordinates returned here are to be
- interpreted in the map mode given by GetMapMode().
- */
- virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const = 0;
-
- /** Query the map mode of the underlying EditEngine/Outliner
-
- @return the map mode used on the EditEngine/Outliner. The
- values returned by GetParaBounds() and GetCharBounds() are to
- be interpreted in this map mode, the point given to
- GetIndexAtPoint() is interpreted in this map mode.
- */
- virtual MapMode GetMapMode() const = 0;
-
- /** Query the reference output device of the underlying EditEngine/Outliner
-
- @return the OutputDevice used from the EditEngine/Outliner to
- format the text. It should be used when performing e.g. font
- calculations, since this is usually a printer with fonts and
- resolution different from the screen.
- */
- virtual OutputDevice* GetRefDevice() const = 0;
-
- /** Query paragraph and character index of the character at the
- given point. Returns sal_True on success, sal_False otherwise
-
- @param rPoint
- Point to query text position of. Is interpreted in logical
- coordinates, relativ to the upper left corner of the text, and
- in the map mode given by GetMapMode()
-
- @param rPara[0 .. n-1]
- Index of paragraph the point is within
-
- @param rIndex[0 .. m-1]
- Index of character the point is over
-
- @return sal_True, if the point is over any text and both rPara and rIndex are valid
-
- */
- virtual sal_Bool GetIndexAtPoint( const Point& rPoint, sal_uInt16& rPara, sal_uInt16& rIndex ) const = 0;
-
- /** Get the start and the end index of the word at the given index
-
- An index value on a word leads from the first character of
- that word up to and including the last space before the next
- word. The index values returned do not contain any leading or
- trailing white-space. If the input indices are invalid,
- sal_False is returned.
-
- @param nPara[0 .. n-1]
- Index of paragraph to start the search in
-
- @param nIndex[0 .. m-1]
- Index of character to query the search on
-
- @param rStart
- Start index (in the same paragraph)
-
- @param rEnd
- End index (in the same paragraph), this point to the last
- character still contained in the query
-
- @return sal_True, if the result is non-empty
- */
- virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& rStart, sal_uInt16& rEnd ) const = 0;
-
- /** Query range of similar attributes
-
- Please note that the range returned is half-open: [nStartIndex,nEndIndex)
-
- @param nStartIndex
- Herein, the start index of the range of similar attributes is returned
-
- @param nEndIndex
- Herein, the end index (exclusive) of the range of similar attributes is returned
-
- @param nIndex
- The character index from which the range of similar attributed characters is requested
-
- @return sal_True, if the range has been successfully determined
- */
- virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
-
- /** Query number of lines in the formatted paragraph
-
- @param nPara[0 .. n-1]
- Index of paragraph to query number of lines in
-
- @return number of lines in given paragraph
-
- */
- virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const = 0;
-
- /** Query line length
-
- @param nPara[0 .. n-1]
- Index of paragraph to query line length in
-
- @param nLine[0 .. m-1]
- Index of line in paragraph to query line length of
-
- */
- virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const = 0;
-
- /** Query bounds of line in paragraph
-
- @param rStart [output param; 0 .. text_len]
- The index in the paragraph text that belongs to the chara at the start of the line
-
- @param rEnd [output param; 0 .. text_len]
- The index in the paragraph text that follows the last chara in the line
-
- @param nParagraph[0 .. n-1]
- Index of paragraph to query line length in
-
- @param nLine[0 .. m-1]
- Index of line in paragraph to query line length of
-
- */
- virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const = 0;
-
- /** Query the line number for a index in the paragraphs text
-
- @param nPara[0 .. n-1]
- Index of paragraph to query line length in
-
- @param nIndex[0 .. m-1]
- Index of of the chara in the paragraph text
-
- @returns [0 .. k-1]
- The line number of the chara in the paragraph
- */
- virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
-
- /** Delete given text range and reformat text
-
- @param rSelection
- The text range to be deleted
-
- @return sal_True if text has been successfully deleted
- */
- virtual sal_Bool Delete( const ESelection& rSelection ) = 0;
-
- /** Insert/Replace given text in given range and reformat text
-
- @param rText
- Text to insert/replace
-
- @param rSel
- Selection where text should be replaced. The empty selection inserts
-
- @return sal_True if text has been successfully inserted
- */
- virtual sal_Bool InsertText( const String& rText, const ESelection& rSel ) = 0;
-
- /** Updates the formatting
-
- @see EditEngine::QuickFormatDoc() for details
-
- @return sal_True if text have been successfully reformatted
- */
- virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ) = 0;
-
- /** Get the outline depth of given paragraph
-
- @param nPara
- Index of the paragraph to query the depth of
-
- @return the outline level of the given paragraph. The range is
- [0,n), where n is the maximal outline level.
- */
- virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const = 0;
-
- /** Set the outline depth of given paragraph
-
- @param nPara
- Index of the paragraph to set the depth of
-
- @param nNewDepth
- The depth to set on the given paragraph. The range is
- [0,n), where n is the maximal outline level.
-
- @return sal_True, if depth could be successfully set. Reasons for
- failure are e.g. the text does not support outline level
- (EditEngine), or the depth range is exceeded.
- */
- virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ) = 0;
-
- virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara );
- virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
-
- virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
- virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
-};
-
-/** Encapsulates the document view for the purpose of unified
- EditEngine/Outliner access.
-
- This one has to be different from the SvxEditViewForwarder, since
- the latter is only valid in edit mode.
- */
-class EDITENG_DLLPUBLIC SvxViewForwarder
-{
-public:
- virtual ~SvxViewForwarder();
-
- /** Query state of forwarder
-
- @return sal_False, if no longer valid
- */
- virtual sal_Bool IsValid() const = 0;
-
- /** Query visible area of the view containing the text
-
- @return the visible rectangle of the text, i.e. the part of
- the EditEngine or Outliner that is currently on screen. The
- values are already in screen coordinates (pixel), and have to
- be relative to the EditEngine/Outliner's upper left corner.
- */
- virtual Rectangle GetVisArea() const = 0;
-
- /** Convert from logical, EditEngine-relative coordinates to screen coordinates
-
- @param rPoint
- Point in logical, EditEngine-relative coordinates.
-
- @param rMapMode
- The map mode to interpret the coordinates in.
-
- @return the point in screen coordinates
- */
- virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const = 0;
-
- /** Convert from screen to logical, EditEngine-relative coordinates
-
- @param rPoint
- Point in screen coordinates
-
- @param rMapMode
- The map mode to interpret the coordinates in.
-
- @return the point in logical coordinates.
- */
- virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const = 0;
-
-};
-
-
-/** Encapsulates EditView and OutlinerView for the purpose of unified
- EditEngine/Outliner access
- */
-class SvxEditViewForwarder : public SvxViewForwarder
-{
-public:
-
- /** Query current selection.
-
- @param rSelection
- Contains the current selection after method call
-
- @return sal_False, if there is no view or no selection (the empty selection _is_ a selection)
-
- */
- virtual sal_Bool GetSelection( ESelection& rSelection ) const = 0;
-
- /** Set selection in view.
-
- @param rSelection
- The selection to set
-
- @return sal_False, if there is no view or selection is invalid
- */
- virtual sal_Bool SetSelection( const ESelection& rSelection ) = 0;
-
- /** Copy current selection to clipboard.
-
- @return sal_False if no selection or no view (the empty selection _is_ a selection)
- */
- virtual sal_Bool Copy() = 0;
-
- /** Cut current selection to clipboard.
-
- @eturn sal_False if no selection or no view (the empty selection _is_ a selection)
- */
- virtual sal_Bool Cut() = 0;
-
- /** Paste clipboard into current selection.
-
- @return sal_False if no view or no selection (the empty selection _is_ a selection)
- */
- virtual sal_Bool Paste() = 0;
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unofdesc.hxx b/editeng/inc/editeng/unofdesc.hxx
deleted file mode 100644
index f46aeb32b8..0000000000
--- a/editeng/inc/editeng/unofdesc.hxx
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SVX_UNOFDESC_HXX
-#define SVX_UNOFDESC_HXX
-
-#include <com/sun/star/awt/FontDescriptor.hpp>
-#include <com/sun/star/beans/PropertyState.hpp>
-#include <svl/itemset.hxx>
-#include <vcl/font.hxx>
-#include "editeng/editengdllapi.h"
-
-class EDITENG_DLLPUBLIC SvxUnoFontDescriptor
-{
-public:
- static void ConvertToFont( const ::com::sun::star::awt::FontDescriptor& rDesc, Font& rFont );
- static void ConvertFromFont( const Font& rFont, ::com::sun::star::awt::FontDescriptor& rDesc );
-
- static void FillItemSet( const ::com::sun::star::awt::FontDescriptor& rDesc, SfxItemSet& rSet );
- static void FillFromItemSet( const SfxItemSet& rSet, ::com::sun::star::awt::FontDescriptor& rDesc );
-
- static com::sun::star::beans::PropertyState getPropertyState( const SfxItemSet& rSet );
- static void setPropertyToDefault( SfxItemSet& rSet );
- static ::com::sun::star::uno::Any getPropertyDefault( SfxItemPool* pPool );
-
-};
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unofield.hxx b/editeng/inc/editeng/unofield.hxx
deleted file mode 100644
index 33f5ae25b6..0000000000
--- a/editeng/inc/editeng/unofield.hxx
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOFIELD_HXX
-#define _SVX_UNOFIELD_HXX
-
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#include <com/sun/star/text/XTextField.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/component.hxx>
-#include "editeng/editengdllapi.h"
-
-#include <comphelper/servicehelper.hxx>
-
-#include <editeng/mutxhelp.hxx>
-
-// ids usable for the constructor
-#define ID_DATEFIELD 0
-#define ID_URLFIELD 1
-#define ID_PAGEFIELD 2
-#define ID_PAGESFIELD 3
-#define ID_TIMEFIELD 4
-#define ID_FILEFIELD 5
-#define ID_TABLEFIELD 6
-#define ID_EXT_TIMEFIELD 7
-#define ID_EXT_FILEFIELD 8
-#define ID_AUTHORFIELD 9
-#define ID_MEASUREFIELD 10
-#define ID_EXT_DATEFIELD 11
-#define ID_HEADERFIELD 12
-#define ID_FOOTERFIELD 13
-#define ID_DATETIMEFIELD 14
-#define ID_UNKNOWN 15 // this must be the last entry
-
-class SvxUnoFieldData_Impl;
-class SfxItemPropertySet;
-class SvxFieldData;
-
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface > EDITENG_DLLPUBLIC SAL_CALL SvxUnoTextCreateTextField(
- const ::rtl::OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
-class EDITENG_DLLPUBLIC SvxUnoTextField : public SvxMutexHelper,
- public ::cppu::OComponentHelper,
- public ::com::sun::star::text::XTextField,
- public ::com::sun::star::beans::XPropertySet,
- public ::com::sun::star::lang::XServiceInfo,
- public ::com::sun::star::lang::XUnoTunnel
-{
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > mxAnchor;
- const SfxItemPropertySet* mpPropSet;
- sal_Int32 mnServiceId;
- SvxUnoFieldData_Impl* mpImpl;
-
-protected:
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
-
-public:
- SvxUnoTextField( sal_Int32 nServiceId ) throw();
- SvxUnoTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor, const ::rtl::OUString& rPresentation, const SvxFieldData* pFieldData ) throw();
- virtual ~SvxUnoTextField() throw();
-
- // 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; }
-
- UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextField )
-
- // ::com::sun::star::uno::XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // ::com::sun::star::lang::XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XTextField
- virtual ::rtl::OUString SAL_CALL getPresentation( sal_Bool bShowCommand ) throw(::com::sun::star::uno::RuntimeException);
-
- // XTextContent
- virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XComponent
- virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
-
- // XServiceInfo
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unofored.hxx b/editeng/inc/editeng/unofored.hxx
deleted file mode 100644
index 3bcf45cb63..0000000000
--- a/editeng/inc/editeng/unofored.hxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOFORED_HXX
-#define _SVX_UNOFORED_HXX
-
-#include <editeng/editeng.hxx>
-#include <editeng/unoedsrc.hxx>
-#include "editeng/editengdllapi.h"
-
-// SvxEditEngineForwarder - SvxTextForwarder for EditEngine
-
-class EDITENG_DLLPUBLIC SvxEditEngineForwarder : public SvxTextForwarder
-{
-private:
- EditEngine& rEditEngine;
-
-public:
- SvxEditEngineForwarder( EditEngine& rEngine );
- virtual ~SvxEditEngineForwarder();
-
- virtual sal_uInt16 GetParagraphCount() const;
- virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
- virtual String GetText( const ESelection& rSel ) const;
- virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All ) const;
- virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
- virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
- virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
- virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const;
-
- virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
- virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
-
- virtual void QuickInsertText( const String& rText, const ESelection& rSel );
- virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
- virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
- virtual void QuickInsertLineBreak( const ESelection& rSel );
-
- virtual SfxItemPool* GetPool() const;
-
- virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
- virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
- virtual sal_Bool IsValid() const;
-
- virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
- virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
- virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
- virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
- virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
- virtual MapMode GetMapMode() const;
- virtual OutputDevice* GetRefDevice() const;
- virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
- virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
- virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
- virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
- virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
- virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- virtual sal_Bool Delete( const ESelection& );
- virtual sal_Bool InsertText( const String&, const ESelection& );
- virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
- virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
- virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
-
- virtual const SfxItemSet* GetEmptyItemSetPtr();
-
- // implementation functions for XParagraphAppend and XTextPortionAppend
- virtual void AppendParagraph();
- virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
- //XTextCopy
- virtual void CopyText(const SvxTextForwarder& rSource);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unoforou.hxx b/editeng/inc/editeng/unoforou.hxx
deleted file mode 100644
index 7c17672646..0000000000
--- a/editeng/inc/editeng/unoforou.hxx
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOFOROU_HXX
-#define _SVX_UNOFOROU_HXX
-
-#include <editeng/unoedsrc.hxx>
-#include "editeng/editengdllapi.h"
-
-#include <editeng/editdata.hxx>
-
-class Outliner;
-
-// SvxOutlinerForwarder - SvxTextForwarder for Outliner
-
-class EDITENG_DLLPUBLIC SvxOutlinerForwarder : public SvxTextForwarder
-{
-private:
- Outliner& rOutliner;
- sal_Bool bOutlinerText;
-
- /** this pointer may be null or point to an item set for the attribs of
- the selection maAttribsSelection */
- mutable SfxItemSet* mpAttribsCache;
-
- /** if we have a chached attribute item set, this is the selection of it */
- mutable ESelection maAttribCacheSelection;
-
- /** this pointer may be null or point to an item set for the paragraph
- mnParaAttribsCache */
- mutable SfxItemSet* mpParaAttribsCache;
-
- /** if we have a cached para attribute item set, this is the paragraph of it */
- mutable sal_uInt16 mnParaAttribsCache;
-
-public:
- SvxOutlinerForwarder( Outliner& rOutl, sal_Bool bOutlText = sal_False );
- virtual ~SvxOutlinerForwarder();
-
- virtual sal_uInt16 GetParagraphCount() const;
- virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
- virtual String GetText( const ESelection& rSel ) const;
- virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const;
- virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
- virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
- virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
- virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const;
-
- virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
- virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
-
- virtual void QuickInsertText( const String& rText, const ESelection& rSel );
- virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
- virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
- virtual void QuickInsertLineBreak( const ESelection& rSel );
-
- virtual SfxItemPool* GetPool() const;
-
- virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
- virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
-
- virtual sal_Bool IsValid() const;
-
- Outliner& GetOutliner() const { return rOutliner; }
-
- virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
- virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
- virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
- virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
- virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
- virtual MapMode GetMapMode() const;
- virtual OutputDevice* GetRefDevice() const;
- virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
- virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
- virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
- virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
- virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const;
- virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- virtual sal_Bool Delete( const ESelection& );
- virtual sal_Bool InsertText( const String&, const ESelection& );
- virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
- virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
- virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
- virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara );
- virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
-
- virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
- virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
-
- /* this method flushes internal caches for this forwarder */
- void flushCache();
-
- virtual const SfxItemSet* GetEmptyItemSetPtr();
-
- // implementation functions for XParagraphAppend and XTextPortionAppend
- virtual void AppendParagraph();
- virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
- //XTextCopy
- virtual void CopyText(const SvxTextForwarder& rSource);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unoipset.hxx b/editeng/inc/editeng/unoipset.hxx
deleted file mode 100644
index 685d0aa398..0000000000
--- a/editeng/inc/editeng/unoipset.hxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOIPSET_HXX_
-#define _SVX_UNOIPSET_HXX_
-
-#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include "editeng/editengdllapi.h"
-#include <svl/itemprop.hxx>
-#include <vector>
-
-class SdrItemPool;
-class SfxItemSet;
-class SvxShape;
-struct SvxIDPropertyCombine;
-
-#define SFX_METRIC_ITEM (0x40)
-
-class EDITENG_DLLPUBLIC SvxItemPropertySet
-{
- SfxItemPropertyMap m_aPropertyMap;
- mutable com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> m_xInfo;
- const SfxItemPropertyMapEntry* _pMap;
- ::std::vector< SvxIDPropertyCombine* > aCombineList;
- sal_Bool mbConvertTwips;
- SfxItemPool& mrItemPool;
-
-public:
- SvxItemPropertySet( const SfxItemPropertyMapEntry *pMap, SfxItemPool& rPool, sal_Bool bConvertTwips = sal_False );
- ~SvxItemPropertySet();
-
- // 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;
-
- // 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 ( 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();
-
- com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const;
- const SfxItemPropertyMapEntry* getPropertyMapEntries() const {return _pMap;}
- const SfxItemPropertyMap* getPropertyMap()const { return &m_aPropertyMap;}
- const SfxItemPropertySimpleEntry* getPropertyMapEntry(const ::rtl::OUString &rName) const;
-
- static com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > getPropertySetInfo( const SfxItemPropertyMapEntry* pMap );
-};
-
-/** converts the given any with a metric to 100th/mm if needed */
-EDITENG_DLLPUBLIC void SvxUnoConvertToMM( const SfxMapUnit eSourceMapUnit, com::sun::star::uno::Any & rMetric ) throw();
-
-/** converts the given any with a metric from 100th/mm to the given metric if needed */
-EDITENG_DLLPUBLIC void SvxUnoConvertFromMM( const SfxMapUnit eDestinationMapUnit, com::sun::star::uno::Any & rMetric ) throw();
-
-#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
deleted file mode 100644
index b521917188..0000000000
--- a/editeng/inc/editeng/unolingu.hxx
+++ /dev/null
@@ -1,235 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _UNO_LINGU_HXX
-#define _UNO_LINGU_HXX
-
-#include <i18npool/lang.h>
-#include <tools/string.hxx>
-#include <com/sun/star/util/Language.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
-#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
-#include <com/sun/star/linguistic2/XHyphenator.hpp>
-#include <com/sun/star/linguistic2/XThesaurus.hpp>
-#include <com/sun/star/linguistic2/XDictionaryList.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include "editeng/editengdllapi.h"
-
-class LinguMgrExitLstnr;
-
-class Window;
-
-///////////////////////////////////////////////////////////////////////////
-// SvxLinguConfigUpdate
-// class to update configuration items when (before!) the linguistic is used.
-//
-// This class is called by all the dummy implementations to update all of the
-// configuration (list of used/available services) when the linguistic is
-// accessed for the first time.
-
-class SvxLinguConfigUpdate
-{
- static sal_Int32 nCurrentDataFilesChangedCheckValue;
- static sal_Int16 nNeedUpdating; // n == -1 => needs to be checked
- // n == 0 => already updated, nothing to be done
- // n == 1 => needs to be updated
-
- static sal_Int32 CalcDataFilesChangedCheckValue();
-
-public:
-
- EDITENG_DLLPUBLIC static void UpdateAll( sal_Bool bForceCheck = sal_False );
- static sal_Bool IsNeedUpdateAll( sal_Bool bForceCheck = sal_False );
-};
-
-///////////////////////////////////////////////////////////////////////////
-
-class EDITENG_DLLPUBLIC LinguMgr
-{
- friend class LinguMgrExitLstnr;
-
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr;
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator > xHyph;
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XThesaurus > xThes;
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryList > xDicList;
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet > xProp;
-
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > xIgnoreAll;
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > xChangeAll;
-
- static LinguMgrExitLstnr *pExitLstnr;
- static sal_Bool bExiting;
-
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > GetSpell();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator > GetHyph();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XThesaurus > GetThes();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryList > GetDicList();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet > GetProp();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > GetStandard();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > GetIgnoreAll();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > GetChangeAll();
-
- // disallow access to copy-constructor and assignment-operator
- LinguMgr(const LinguMgr &);
- LinguMgr & operator = (const LinguMgr &);
-
-public:
-
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > GetSpellChecker();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator > GetHyphenator();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XThesaurus > GetThesaurus();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryList > GetDictionaryList();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet > GetLinguPropertySet();
-
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
-
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > GetStandardDic();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > GetChangeAllList();
-
- // update all configuration entries
- static void UpdateAll();
-};
-
-///////////////////////////////////////////////////////////////////////////
-
-namespace com { namespace sun { namespace star { namespace linguistic2 {
- class XHyphenatedWord;
-}}}}
-
-
-struct SvxAlternativeSpelling
-{
- String aReplacement;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenatedWord > xHyphWord;
- sal_Int16 nChangedPos,
- nChangedLength;
- sal_Bool bIsAltSpelling;
-
- inline SvxAlternativeSpelling();
-};
-
-inline SvxAlternativeSpelling::SvxAlternativeSpelling() :
- nChangedPos(-1), nChangedLength(-1), bIsAltSpelling(sal_False)
-{
-}
-
-
-EDITENG_DLLPUBLIC SvxAlternativeSpelling SvxGetAltSpelling(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenatedWord > & rHyphWord );
-
-
-///////////////////////////////////////////////////////////////////////////
-
-class EDITENG_DLLPUBLIC SvxDicListChgClamp
-{
-private:
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryList > xDicList;
-
- // disallow access to copy-constructor and assignment-operator
- EDITENG_DLLPRIVATE SvxDicListChgClamp(const SvxDicListChgClamp &);
- EDITENG_DLLPRIVATE SvxDicListChgClamp & operator = (const SvxDicListChgClamp &);
-
-public:
- SvxDicListChgClamp( ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryList > &rxDicList );
- ~SvxDicListChgClamp();
-};
-
-///////////////////////////////////////////////////////////////////////////
-
-//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<
- ::com::sun::star::linguistic2::XHyphenator > SvxGetHyphenator();
-EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XThesaurus > SvxGetThesaurus();
-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();
-//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<
- ::com::sun::star::linguistic2::XDictionaryList > xDicList );
-EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > SvxGetIgnoreAllList();
-EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > SvxGetChangeAllList();
-
-///////////////////////////////////////////////////////////////////////////
-// misc functions
-//
-
-EDITENG_DLLPUBLIC LanguageType SvxLocaleToLanguage(
- const ::com::sun::star::lang::Locale& rLocale );
-EDITENG_DLLPUBLIC ::com::sun::star::lang::Locale& SvxLanguageToLocale(
- ::com::sun::star::lang::Locale& rLocale, LanguageType eLang );
-EDITENG_DLLPUBLIC ::com::sun::star::lang::Locale SvxCreateLocale( LanguageType eLang );
-
-
-EDITENG_DLLPUBLIC short SvxDicError( Window *pParent, sal_Int16 nError );
-
-
-#endif
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unonrule.hxx b/editeng/inc/editeng/unonrule.hxx
deleted file mode 100644
index 665ca2abda..0000000000
--- a/editeng/inc/editeng/unonrule.hxx
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNONRULE_HXX
-#define _SVX_UNONRULE_HXX
-
-#include <com/sun/star/container/XIndexReplace.hpp>
-#include <com/sun/star/ucb/XAnyCompare.hpp>
-#include "editeng/editengdllapi.h"
-#include <cppuhelper/implbase5.hxx>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/util/XCloneable.hpp>
-#include <editeng/numitem.hxx>
-#include <comphelper/servicehelper.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-
-EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > SvxCreateNumRule( const SvxNumRule* pRule ) throw();
-EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > SvxCreateNumRule() throw();
-const SvxNumRule& SvxGetNumRule( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > xRule ) throw( ::com::sun::star::lang::IllegalArgumentException );
-EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SvxCreateNumRuleCompare() throw();
-
-class SvxUnoNumberingRules : public ::cppu::WeakAggImplHelper5< com::sun::star::container::XIndexReplace, com::sun::star::ucb::XAnyCompare,
- com::sun::star::lang::XUnoTunnel, com::sun::star::util::XCloneable, com::sun::star::lang::XServiceInfo >
-{
-private:
- SvxNumRule maRule;
-public:
- SvxUnoNumberingRules( const SvxNumRule& rRule ) throw();
- virtual ~SvxUnoNumberingRules() throw();
-
- UNO3_GETIMPLEMENTATION_DECL( SvxUnoNumberingRules )
-
- //XIndexReplace
- virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const com::sun::star::uno::Any& Element ) throw(
- com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::IndexOutOfBoundsException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
-
- //XIndexAccess
- virtual sal_Int32 SAL_CALL getCount() throw(com::sun::star::uno::RuntimeException) ;
- virtual com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(com::sun::star::lang::IndexOutOfBoundsException,
- com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
-
- //XElementAccess
- virtual com::sun::star::uno::Type SAL_CALL getElementType() throw(com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasElements() throw(com::sun::star::uno::RuntimeException);
-
- // XAnyCompare
- virtual sal_Int16 SAL_CALL compare( const com::sun::star::uno::Any& Any1, const com::sun::star::uno::Any& Any2 ) throw(com::sun::star::uno::RuntimeException);
-
- // XCloneable
- virtual com::sun::star::uno::Reference< com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual rtl::OUString SAL_CALL getImplementationName( ) throw(com::sun::star::uno::RuntimeException);
- 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);
-
- // 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 );
-
- static sal_Int16 Compare( const com::sun::star::uno::Any& rAny1, const com::sun::star::uno::Any& rAny2 );
-
- const SvxNumRule& getNumRule() const { return maRule; }
-};
-
-
-#endif
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unopracc.hxx b/editeng/inc/editeng/unopracc.hxx
deleted file mode 100644
index da4d92d2b7..0000000000
--- a/editeng/inc/editeng/unopracc.hxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOPRACC_HXX
-#define _SVX_UNOPRACC_HXX
-
-#include <editeng/unotext.hxx>
-
-
-class SvxEditSource;
-
-/** Wraps SvxUnoTextRangeBase and provides us with the text properties
-
- Inherits from SvxUnoTextRangeBase and provides XPropertySet and
- XMultiPropertySet interfaces. Just set the selection to the
- required text range and return a reference to a XPropertySet.
- */
-class SvxAccessibleTextPropertySet : public SvxUnoTextRangeBase,
- public ::com::sun::star::lang::XTypeProvider,
- public ::cppu::OWeakObject
-{
-public:
- SvxAccessibleTextPropertySet( const SvxEditSource*, const SvxItemPropertySet* );
- virtual ~SvxAccessibleTextPropertySet() throw();
-
- // XTextRange
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
-
- // uno::XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // lang::XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
-
- // lang::XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-
- // XServiceName
- ::rtl::OUString SAL_CALL getServiceName() throw (::com::sun::star::uno::RuntimeException);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unoprnms.hxx b/editeng/inc/editeng/unoprnms.hxx
deleted file mode 100644
index 8adbc60f36..0000000000
--- a/editeng/inc/editeng/unoprnms.hxx
+++ /dev/null
@@ -1,378 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_UNOPRNMS_HXX
-#define _SVX_UNOPRNMS_HXX
-
-#define UNO_NAME_SHAPE_SIZE "Size"
-#define UNO_NAME_SHAPE_POSITION "Position"
-
-#define UNO_NAME_CHAR_COLOR "CharColor"
-#define UNO_NAME_CHAR_FONT "CharFont"
-#define UNO_NAME_CHAR_HEIGHT "CharHeight"
-#define UNO_NAME_CHAR_POSTURE "CharPosture"
-#define UNO_NAME_CHAR_SHADOWED "CharShadowed"
-#define UNO_NAME_CHAR_UNDERLINE "CharUnderline"
-#define UNO_NAME_CHAR_WEIGHT "CharWeight"
-
-#define UNO_NAME_FILLSTYLE "FillStyle"
-#define UNO_NAME_FILLCOLOR "FillColor"
-#define UNO_NAME_FILLGRADIENT "FillGradient"
-#define UNO_NAME_FILLHATCH "FillHatch"
-#define UNO_NAME_FILLBITMAP "FillBitmap"
-#define UNO_NAME_FILLBACKGROUND "FillBackground"
-#define UNO_NAME_FILLCOLOR_2 "FillColor2"
-
-#define UNO_NAME_EDGEKIND "EdgeKind"
-#define UNO_NAME_EDGELINE1DELTA "EdgeLine1Delta"
-#define UNO_NAME_EDGELINE2DELTA "EdgeLine2Delta"
-#define UNO_NAME_EDGELINE3DELTA "EdgeLine3Delta"
-#define UNO_NAME_EDGENODE1HORZDIST "EdgeNode1HorzDist"
-#define UNO_NAME_EDGENODE1VERTDIST "EdgeNode1VertDist"
-#define UNO_NAME_EDGENODE2HORZDIST "EdgeNode2HorzDist"
-#define UNO_NAME_EDGENODE2VERTDIST "EdgeNode2VertDist"
-
-#define UNO_NAME_FILLBMP_OFFSET_X "FillBitmapOffsetX"
-#define UNO_NAME_FILLBMP_OFFSET_Y "FillBitmapOffsetY"
-#define UNO_NAME_FILLBMP_POSITION_OFFSET_X "FillBitmapPositionOffsetX"
-#define UNO_NAME_FILLBMP_POSITION_OFFSET_Y "FillBitmapPositionOffsetY"
-#define UNO_NAME_FILLBMP_RECTANGLE_POINT "FillBitmapRectanglePoint"
-#define UNO_NAME_FILLBMP_TILE "FillBitmapTile"
-#define UNO_NAME_FILLBMP_STRETCH "FillBitmapStretch"
-#define UNO_NAME_FILLBMP_LOGICAL_SIZE "FillBitmapLogicalSize"
-#define UNO_NAME_FILLBMP_SIZE_X "FillBitmapSizeX"
-#define UNO_NAME_FILLBMP_SIZE_Y "FillBitmapSizeY"
-#define UNO_NAME_FILL_TRANSPARENCE "FillTransparence"
-#define UNO_NAME_FILLBMP_MODE "FillBitmapMode"
-
-#define UNO_NAME_FILL_GRADIENT_STYLE "FillGradientStyle"
-#define UNO_NAME_FILL_GRADIENT_START_COLOR "FillGradientStartColor"
-#define UNO_NAME_FILL_GRADIENT_END_COLOR "FillGradientEndColor"
-#define UNO_NAME_FILL_GRADIENT_ANGLE "FillGradientAngle"
-#define UNO_NAME_FILL_GRADIENT_BORDER "FillGradientBorder"
-#define UNO_NAME_FILL_GRADIENT_OFFSET_X "FillGradientOffsetX"
-#define UNO_NAME_FILL_GRADIENT_OFFSET_Y "FillGradientOffsetY"
-#define UNO_NAME_FILL_GRADIENT_START_INTENSITY "FillGradientStartIntensity"
-#define UNO_NAME_FILL_GRADIENT_END_INTENSITY "FillGradientEndIntensity"
-#define UNO_NAME_FILL_GRADIENT_STEPS "FillGradientSteps"
-
-#define UNO_NAME_FILL_HATCH_STYLE "FillHatchStyle"
-#define UNO_NAME_FILL_HATCH_COLOR "FillHatchColor"
-#define UNO_NAME_FILL_HATCH_DISTANCE "FillHatchDistance"
-#define UNO_NAME_FILL_HATCH_ANGLE "FillHatchAngle"
-
-#define UNO_NAME_LINESTYLE "LineStyle"
-#define UNO_NAME_LINEDASH "LineDash"
-#define UNO_NAME_LINEWIDTH "LineWidth"
-#define UNO_NAME_LINECOLOR "LineColor"
-#define UNO_NAME_LINEJOINT "LineJoint"
-#define UNO_NAME_LINESTART "LineStart"
-#define UNO_NAME_LINEEND "LineEnd"
-#define UNO_NAME_LINESTARTWIDTH "LineStartWidth"
-#define UNO_NAME_LINEENDWIDTH "LineEndWidth"
-#define UNO_NAME_LINESTARTCENTER "LineStartCenter"
-#define UNO_NAME_LINEENDCENTER "LineEndCenter"
-#define UNO_NAME_LINETRANSPARENCE "LineTransparence"
-
-#define UNO_NAME_SHADOW "Shadow"
-#define UNO_NAME_SHADOWCOLOR "ShadowColor"
-#define UNO_NAME_SHADOWXDIST "ShadowXDistance"
-#define UNO_NAME_SHADOWYDIST "ShadowYDistance"
-#define UNO_NAME_SHADOWTRANSPARENCE "ShadowTransparence"
-
-#define UNO_NAME_EDGERADIUS "CornerRadius"
-
-#define UNO_NAME_TEXT_MINFRAMEHEIGHT "TextMinimumFrameHeight"
-#define UNO_NAME_TEXT_AUTOGROWHEIGHT "TextAutoGrowHeight"
-#define UNO_NAME_TEXT_FITTOSIZE "TextFitToSize"
-#define UNO_NAME_TEXT_LEFTDIST "TextLeftDistance"
-#define UNO_NAME_TEXT_RIGHTDIST "TextRightDistance"
-#define UNO_NAME_TEXT_UPPERDIST "TextUpperDistance"
-#define UNO_NAME_TEXT_LOWERDIST "TextLowerDistance"
-#define UNO_NAME_TEXT_VERTADJUST "TextVerticalAdjust"
-#define UNO_NAME_TEXT_MAXFRAMEHEIGHT "TextMaximumFrameHeight"
-#define UNO_NAME_TEXT_MINFRAMEWIDTH "TextMinimumFrameWidth"
-#define UNO_NAME_TEXT_MAXFRAMEWIDTH "TextMaximumFrameWidth"
-#define UNO_NAME_TEXT_AUTOGROWWIDTH "TextAutoGrowWidth"
-#define UNO_NAME_TEXT_HORZADJUST "TextHorizontalAdjust"
-#define UNO_NAME_TEXT_ANIKIND "TextAnimationKind"
-#define UNO_NAME_TEXT_ANIDIRECTION "TextAnimationDirection"
-#define UNO_NAME_TEXT_ANISTARTINSIDE "TextAnimationStartInside"
-#define UNO_NAME_TEXT_ANISTOPINSIDE "TextAnimationStopInside"
-#define UNO_NAME_TEXT_ANICOUNT "TextAnimationCount"
-#define UNO_NAME_TEXT_ANIDELAY "TextAnimationDelay"
-#define UNO_NAME_TEXT_ANIAMOUNT "TextAnimationAmount"
-#define UNO_NAME_TEXT_CONTOURFRAME "TextContourFrame"
-#define UNO_NAME_TEXT_WRITINGMODE "TextWritingMode"
-#define UNO_NAME_TEXT_FONTINDEPENDENTLINESPACING "FontIndependentLineSpacing"
-#define UNO_NAME_TEXT_WORDWRAP "TextWordWrap"
-
-#define UNO_NAME_MEASUREKIND "MeasureKind"
-#define UNO_NAME_MEASURETEXTHPOS "MeasureTextHorizontalPosition"
-#define UNO_NAME_MEASURETEXTVPOS "MeasureTextVerticalPosition"
-#define UNO_NAME_MEASURELINEDIST "MeasureLineDistance"
-#define UNO_NAME_MEASUREHELPLINEOVERHANG "MeasureHelpLineOverhang"
-#define UNO_NAME_MEASUREHELPLINEDIST "MeasureHelpLineDistance"
-#define UNO_NAME_MEASUREHELPLINE1LEN "MeasureHelpLine1Length"
-#define UNO_NAME_MEASUREHELPLINE2LEN "MeasureHelpLine2Length"
-#define UNO_NAME_MEASUREBELOWREFEDGE "MeasureBelowReferenceEdge"
-#define UNO_NAME_MEASURETEXTROTA90 "MeasureTextRotate90"
-#define UNO_NAME_MEASURETEXTUPSIDEDOWN "MeasureTextUpsideDown"
-#define UNO_NAME_MEASUREOVERHANG "MeasureOverhang"
-#define UNO_NAME_MEASUREUNIT "MeasureUnit"
-#define UNO_NAME_MEASURESCALE "MeasureScale"
-#define UNO_NAME_MEASURESHOWUNIT "MeasureShowUnit"
-#define UNO_NAME_MEASUREFORMATSTRING "MeasureFormatString"
-#define UNO_NAME_MEASURETEXTAUTOANGLE "MeasureTextAutoAngle"
-#define UNO_NAME_MEASURETEXTAUTOANGLEVIEW "MeasureTextAutoAngleView"
-#define UNO_NAME_MEASURETEXTISFIXEDANGLE "MeasureTextIsFixedAngle"
-#define UNO_NAME_MEASURETEXTFIXEDANGLE "MeasureTextFixedAngle"
-
-#define UNO_NAME_CIRCKIND "CircleKind"
-#define UNO_NAME_CIRCSTARTANGLE "CircleStartAngle"
-#define UNO_NAME_CIRCENDANGLE "CircleEndAngle"
-
-#define UNO_NAME_POLYGONKIND "PolygonKind"
-#define UNO_NAME_POLYPOLYGON "PolyPolygon"
-#define UNO_NAME_POLYPOLYGONBEZIER "PolyPolygonBezier"
-#define UNO_NAME_POLYGON "Polygon"
-
-#define UNO_NAME_MISC_OBJ_ZORDER "ZOrder"
-#define UNO_NAME_MISC_OBJ_MOVEPROTECT "MoveProtect"
-#define UNO_NAME_MISC_OBJ_SIZEPROTECT "SizeProtect"
-#define UNO_NAME_MISC_OBJ_PRINTABLE "Printable"
-#define UNO_NAME_MISC_OBJ_LAYERID "LayerID"
-#define UNO_NAME_MISC_OBJ_LAYERNAME "LayerName"
-#define UNO_NAME_MISC_OBJ_NAME "Name"
-#define UNO_NAME_MISC_OBJ_ROTATEANGLE "RotateAngle"
-#define UNO_NAME_MISC_OBJ_SHEARANGLE "ShearAngle"
-#define UNO_NAME_MISC_OBJ_ROTATION_POINT_X "RotationPointX"
-#define UNO_NAME_MISC_OBJ_ROTATION_POINT_Y "RotationPointY"
-#define UNO_NAME_MISC_OBJ_FRAMERECT "FrameRect"
-#define UNO_NAME_MISC_OBJ_BOUNDRECT "BoundRect"
-
-// #i68101#
-#define UNO_NAME_MISC_OBJ_TITLE "Title"
-#define UNO_NAME_MISC_OBJ_DESCRIPTION "Description"
-
-#define UNO_NAME_GRAPHOBJ_FILLBITMAP "GraphicObjectFillBitmap"
-#define UNO_NAME_GRAPHOBJ_GRAFURL "GraphicURL"
-#define UNO_NAME_GRAPHOBJ_GRAFSTREAMURL "GraphicStreamURL"
-#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
-#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:"
-#define UNO_NAME_GRAPHOBJ_GRAPHIC "Graphic"
-
-#define UNO_NAME_OLE2_METAFILE "MetaFile"
-#define UNO_NAME_OLE2_PERSISTNAME "PersistName"
-
-#define UNO_NAME_3D_SCENE_PERSPECTIVE "D3DScenePerspective"
-#define UNO_NAME_3D_SCENE_DISTANCE "D3DSceneDistance"
-#define UNO_NAME_3D_SCENE_FOCAL_LENGTH "D3DSceneFocalLength"
-#define UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING "D3DSceneTwoSidedLighting"
-#define UNO_NAME_3D_SCENE_LIGHTCOLOR_1 "D3DSceneLightColor1"
-#define UNO_NAME_3D_SCENE_LIGHTCOLOR_2 "D3DSceneLightColor2"
-#define UNO_NAME_3D_SCENE_LIGHTCOLOR_3 "D3DSceneLightColor3"
-#define UNO_NAME_3D_SCENE_LIGHTCOLOR_4 "D3DSceneLightColor4"
-#define UNO_NAME_3D_SCENE_LIGHTCOLOR_5 "D3DSceneLightColor5"
-#define UNO_NAME_3D_SCENE_LIGHTCOLOR_6 "D3DSceneLightColor6"
-#define UNO_NAME_3D_SCENE_LIGHTCOLOR_7 "D3DSceneLightColor7"
-#define UNO_NAME_3D_SCENE_LIGHTCOLOR_8 "D3DSceneLightColor8"
-#define UNO_NAME_3D_SCENE_LIGHTON_1 "D3DSceneLightOn1"
-#define UNO_NAME_3D_SCENE_LIGHTON_2 "D3DSceneLightOn2"
-#define UNO_NAME_3D_SCENE_LIGHTON_3 "D3DSceneLightOn3"
-#define UNO_NAME_3D_SCENE_LIGHTON_4 "D3DSceneLightOn4"
-#define UNO_NAME_3D_SCENE_LIGHTON_5 "D3DSceneLightOn5"
-#define UNO_NAME_3D_SCENE_LIGHTON_6 "D3DSceneLightOn6"
-#define UNO_NAME_3D_SCENE_LIGHTON_7 "D3DSceneLightOn7"
-#define UNO_NAME_3D_SCENE_LIGHTON_8 "D3DSceneLightOn8"
-#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_1 "D3DSceneLightDirection1"
-#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 "D3DSceneLightDirection2"
-#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_3 "D3DSceneLightDirection3"
-#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_4 "D3DSceneLightDirection4"
-#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_5 "D3DSceneLightDirection5"
-#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_6 "D3DSceneLightDirection6"
-#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_7 "D3DSceneLightDirection7"
-#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_8 "D3DSceneLightDirection8"
-#define UNO_NAME_3D_SCENE_AMBIENTCOLOR "D3DSceneAmbientColor"
-#define UNO_NAME_3D_SCENE_SHADOW_SLANT "D3DSceneShadowSlant"
-#define UNO_NAME_3D_SCENE_SHADE_MODE "D3DSceneShadeMode"
-
-#define UNO_NAME_3D_DOUBLE_SIDED "D3DDoubleSided"
-#define UNO_NAME_3D_NORMALS_KIND "D3DNormalsKind"
-#define UNO_NAME_3D_NORMALS_INVERT "D3DNormalsInvert"
-#define UNO_NAME_3D_TEXTURE_PROJ_X "D3DTextureProjectionX"
-#define UNO_NAME_3D_TEXTURE_PROJ_Y "D3DTextureProjectionY"
-#define UNO_NAME_3D_SHADOW_3D "D3DShadow3D"
-#define UNO_NAME_3D_MAT_COLOR "D3DMaterialColor"
-#define UNO_NAME_3D_MAT_EMISSION "D3DMaterialEmission"
-#define UNO_NAME_3D_MAT_SPECULAR "D3DMaterialSpecular"
-#define UNO_NAME_3D_MAT_SPECULAR_INTENSITY "D3DMaterialSpecularIntensity"
-#define UNO_NAME_3D_TEXTURE_KIND "D3DTextureKind"
-#define UNO_NAME_3D_TEXTURE_MODE "D3DTextureMode"
-#define UNO_NAME_3D_TEXTURE_FILTER "D3DTextureFilter"
-
-// #i28528#
-// Added extra Item (Bool) for chart2 to be able to show reduced line geometry
-#define UNO_NAME_3D_REDUCED_LINE_GEOMETRY "D3DReducedLineGeometry"
-
-#define UNO_NAME_3D_HORZ_SEGS "D3DHorizontalSegments"
-#define UNO_NAME_3D_VERT_SEGS "D3DVerticalSegments"
-
-#define UNO_NAME_3D_PERCENT_DIAGONAL "D3DPercentDiagonal"
-#define UNO_NAME_3D_BACKSCALE "D3DBackscale"
-#define UNO_NAME_3D_LATHE_END_ANGLE "D3DEndAngle"
-
-#define UNO_NAME_3D_EXTRUDE_DEPTH "D3DDepth"
-
-#define UNO_NAME_3D_TRANSFORM_MATRIX "D3DTransformMatrix"
-#define UNO_NAME_3D_CAMERA_GEOMETRY "D3DCameraGeometry"
-#define UNO_NAME_3D_POS "D3DPosition"
-#define UNO_NAME_3D_SIZE "D3DSize"
-#define UNO_NAME_3D_POS_IS_CENTER "D3DPositionIsCenter"
-#define UNO_NAME_3D_POLYPOLYGON3D "D3DPolyPolygon3D"
-#define UNO_NAME_3D_NORMALSPOLYGON3D "D3DNormalsPolygon3D"
-#define UNO_NAME_3D_TEXTUREPOLYGON3D "D3DTexturePolygon3D"
-#define UNO_NAME_3D_LINEONLY "D3DLineOnly"
-
-// 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"
-#define UNO_NAME_3D_CLOSE_FRONT "D3DCloseFront"
-#define UNO_NAME_3D_CLOSE_BACK "D3DCloseBack"
-
-#define UNO_NAME_NUMBERING "NumberingIsNumber"
-#define UNO_NAME_NUMBERING_RULES "NumberingRules"
-#define UNO_NAME_NUMBERING_LEVEL "NumberingLevel"
-
-#define UNO_NAME_NRULE_NUMBERINGTYPE "NumberingType"
-#define UNO_NAME_NRULE_PREFIX "Prefix"
-#define UNO_NAME_NRULE_SUFFIX "Suffix"
-#define UNO_NAME_NRULE_BULLETID "BulletId"
-#define UNO_NAME_NRULE_BULLET_COLOR "BulletColor"
-#define UNO_NAME_NRULE_BULLET_RELSIZE "BulletRelSize"
-#define UNO_NAME_NRULE_BULLET_FONT "BulletFont"
-#define UNO_NAME_NRULE_GRAPHICURL "GraphicURL"
-#define UNO_NAME_NRULE_START_WITH "StartWith"
-#define UNO_NAME_NRULE_LEFT_MARGIN "LeftMargin"
-#define UNO_NAME_NRULE_FIRST_LINE_OFFSET "FirstLineOffset"
-#define UNO_NAME_NRULE_ADJUST "Adjust"
-
-#define UNO_NAME_EDIT_FONT_DESCRIPTOR "FontDescriptor"
-#define UNO_NAME_EDIT_FONT_STYLENAME "FontStyleName"
-
-#define UNO_NAME_EDIT_PARA_ADJUST "ParaAdjust"
-#define UNO_NAME_EDIT_PARA_BMARGIN "ParaBottomMargin"
-#define UNO_NAME_EDIT_PARA_LASTLINEADJ "ParaLastLineAdjust"
-#define UNO_NAME_EDIT_PARA_LMARGIN "ParaLeftMargin"
-#define UNO_NAME_EDIT_PARA_LRPARAMARGIN "ParaLeftRightParaMargin"
-#define UNO_NAME_EDIT_PARA_LINESPACING "ParaLineSpacing"
-#define UNO_NAME_EDIT_PARA_RMARGIN "ParaRightMargin"
-#define UNO_NAME_EDIT_PARA_TAPSTOPS "ParaTabStops"
-#define UNO_NAME_EDIT_PARA_TBMARGIN "ParaTopBottomMargin"
-#define UNO_NAME_EDIT_PARA_TMARGIN "ParaTopMargin"
-#define UNO_NAME_EDIT_PARA_IS_HYPHEN "ParaIsHyphenation"
-#define UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION "ParaIsHangingPunctuation"
-#define UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE "ParaIsCharacterDistance"
-#define UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES "ParaIsForbiddenRules"
-#define UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT "ParaFirstLineIndent"
-
-#define UNO_NAME_EDIT_CHAR_HEIGHT "CharHeight"
-#define UNO_NAME_EDIT_CHAR_FONTNAME "CharFontName"
-#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME "CharFontStyleName"
-#define UNO_NAME_EDIT_CHAR_FONTFAMILY "CharFontFamily"
-#define UNO_NAME_EDIT_CHAR_FONTCHARSET "CharFontCharSet"
-#define UNO_NAME_EDIT_CHAR_FONTPITCH "CharFontPitch"
-#define UNO_NAME_EDIT_CHAR_POSTURE "CharPosture"
-#define UNO_NAME_EDIT_CHAR_WEIGHT "CharWeight"
-#define UNO_NAME_EDIT_CHAR_LOCALE "CharLocale"
-
-#define UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN "CharHeightAsian"
-#define UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN "CharFontNameAsian"
-#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN "CharFontStyleNameAsian"
-#define UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN "CharFontFamilyAsian"
-#define UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN "CharFontCharSetAsian"
-#define UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN "CharFontPitchAsian"
-#define UNO_NAME_EDIT_CHAR_POSTURE_ASIAN "CharPostureAsian"
-#define UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN "CharWeightAsian"
-#define UNO_NAME_EDIT_CHAR_LOCALE_ASIAN "CharLocaleAsian"
-
-#define UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX "CharHeightComplex"
-#define UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX "CharFontNameComplex"
-#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX "CharFontStyleNameComplex"
-#define UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX "CharFontFamilyComplex"
-#define UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX "CharFontCharSetComplex"
-#define UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX "CharFontPitchComplex"
-#define UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX "CharPostureComplex"
-#define UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX "CharWeightComplex"
-#define UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX "CharLocaleComplex"
-
-#define UNO_NAME_EDIT_CHAR_COLOR "CharColor"
-#define UNO_NAME_EDIT_CHAR_CROSSEDOUT "CharCrossedOut"
-#define UNO_NAME_EDIT_CHAR_STRIKEOUT "CharStrikeout"
-#define UNO_NAME_EDIT_CHAR_ESCAPEMENT "CharEscapement"
-#define UNO_NAME_EDIT_CHAR_FONTNAME "CharFontName"
-#define UNO_NAME_EDIT_CHAR_SHADOWED "CharShadowed"
-#define UNO_NAME_EDIT_CHAR_UNDERLINE "CharUnderline"
-#define UNO_NAME_EDIT_CHAR_OVERLINE "CharOverline"
-
-#define UNO_NAME_BITMAP "Bitmap"
-
-#define UNO_NAME_LINKDISPLAYNAME "LinkDisplayName"
-#define UNO_NAME_LINKDISPLAYBITMAP "LinkDisplayBitmap"
-
-#define UNO_NAME_GRAPHIC_LUMINANCE "AdjustLuminance"
-#define UNO_NAME_GRAPHIC_CONTRAST "AdjustContrast"
-#define UNO_NAME_GRAPHIC_RED "AdjustRed"
-#define UNO_NAME_GRAPHIC_GREEN "AdjustGreen"
-#define UNO_NAME_GRAPHIC_BLUE "AdjustBlue"
-#define UNO_NAME_GRAPHIC_GAMMA "Gamma"
-#define UNO_NAME_GRAPHIC_TRANSPARENCY "Transparency"
-#define UNO_NAME_GRAPHIC_COLOR_MODE "GraphicColorMode"
-#define UNO_NAME_GRAPHIC_GRAPHICCROP "GraphicCrop"
-
-#define UNO_NAME_CUSTOMSHAPE_ADJUSTMENT "CustomShapeAdjustment"
-
-// 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"
-#define UNO_NAME_EDIT_FONT_SHADOWED "FontShadowed"
-#define UNO_NAME_EDIT_FONT_SLANT "FontSlant"
-#define UNO_NAME_EDIT_FONT_STRIKEOUT "FontStrikeout"
-#define UNO_NAME_EDIT_FONT_UNDERLINE "FontUnderline"
-#define UNO_NAME_EDIT_FONT_WEIGHT "FontWeight"
-#define UNO_NAME_EDIT_CHAR_STYLE "CharStyle"
-#define UNO_NAME_EDIT_FONT_FAMILY "FontFamily"
-#define UNO_NAME_EDIT_FONT_NAME "FontName"
-#define UNO_NAME_EDIT_FONT_CHARSET "FontCharset"
-// 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
deleted file mode 100644
index 3489944ba4..0000000000
--- a/editeng/inc/editeng/unotext.hxx
+++ /dev/null
@@ -1,673 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOTEXT_HXX
-#define _SVX_UNOTEXT_HXX
-
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/text/XTextRange.hpp>
-#include <com/sun/star/text/XText.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/text/XTextRangeMover.hpp>
-#include <com/sun/star/text/XTextCursor.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/XPropertyState.hpp>
-#include <com/sun/star/beans/XMultiPropertySet.hpp>
-#include <com/sun/star/text/XTextRangeCompare.hpp>
-#include <com/sun/star/beans/XMultiPropertyStates.hpp>
-#include <com/sun/star/text/XTextAppend.hpp>
-#include <com/sun/star/text/XTextCopy.hpp>
-#include <com/sun/star/text/XTextField.hpp>
-#include <com/sun/star/container/XIndexReplace.hpp>
-#include <com/sun/star/awt/FontSlant.hpp>
-#include <com/sun/star/awt/FontDescriptor.hpp>
-#include <com/sun/star/style/LineSpacing.hpp>
-#include <com/sun/star/style/TabStop.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/text/XTextRange.hpp>
-#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>
-#include <svl/itemprop.hxx>
-#include <svl/itemset.hxx>
-#include <svl/itempool.hxx>
-#include <svl/solar.hrc>
-#include <editeng/editdata.hxx>
-#include <editeng/unoedsrc.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/editengdllapi.h>
-#include <editeng/memberids.hrc>
-
-class SvxItemPropertySet;
-
-#ifndef SEQTYPE
- #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
- #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
- #else
- #define SEQTYPE(x) &(x)
- #endif
-#endif
-
-#define WID_FONTDESC OWN_ATTR_VALUE_START
-#define WID_NUMLEVEL OWN_ATTR_VALUE_START+1
-#define WID_PORTIONTYPE OWN_ATTR_VALUE_START+2
-#define WID_NUMBERINGSTARTVALUE OWN_ATTR_VALUE_START+3
-#define WID_PARAISNUMBERINGRESTART OWN_ATTR_VALUE_START+4
-
-#define SVX_UNOEDIT_NUMBERING_PROPERTIE \
- {MAP_CHAR_LEN(UNO_NAME_NUMBERING_RULES), EE_PARA_NUMBULLET, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace>*)0), 0, 0 }, \
- {MAP_CHAR_LEN(UNO_NAME_NUMBERING), EE_PARA_BULLETSTATE,&::getBooleanCppuType(), 0, 0 }
-
-#define SVX_UNOEDIT_OUTLINER_PROPERTIES \
- SVX_UNOEDIT_NUMBERING_PROPERTIE, \
- {MAP_CHAR_LEN(UNO_NAME_NUMBERING_LEVEL), WID_NUMLEVEL, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
- {MAP_CHAR_LEN("NumberingStartValue"), WID_NUMBERINGSTARTVALUE, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
- {MAP_CHAR_LEN("ParaIsNumberingRestart"), WID_PARAISNUMBERINGRESTART, &::getBooleanCppuType(), 0, 0 }
-
-#define SVX_UNOEDIT_CHAR_PROPERTIES \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT), EE_CHAR_FONTHEIGHT, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
- { MAP_CHAR_LEN("CharScaleWidth"), EE_CHAR_FONTWIDTH, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME), EE_CHAR_FONTINFO, &::getCppuType((const ::rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },\
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME),EE_CHAR_FONTINFO, &::getCppuType((const ::rtl::OUString*)0), 0, MID_FONT_STYLE_NAME }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE), EE_CHAR_ITALIC, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT), EE_CHAR_WEIGHT, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE), EE_CHAR_LANGUAGE, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_COLOR), EE_CHAR_COLOR, &::getCppuType((const sal_Int32*)0), 0, 0 }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_ESCAPEMENT), EE_CHAR_ESCAPEMENT, &::getCppuType((const sal_Int16*)0), 0, MID_ESC }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_UNDERLINE), EE_CHAR_UNDERLINE, &::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE }, \
- { MAP_CHAR_LEN("CharUnderlineColor"), EE_CHAR_UNDERLINE, &::getCppuType((const sal_Int32*)0), 0, MID_TL_COLOR }, \
- { MAP_CHAR_LEN("CharUnderlineHasColor"), EE_CHAR_UNDERLINE, &::getBooleanCppuType(), 0, MID_TL_HASCOLOR } , \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_OVERLINE), EE_CHAR_OVERLINE, &::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE }, \
- { MAP_CHAR_LEN("CharOverlineColor"), EE_CHAR_OVERLINE, &::getCppuType((const sal_Int32*)0), 0, MID_TL_COLOR }, \
- { MAP_CHAR_LEN("CharOverlineHasColor"), EE_CHAR_OVERLINE, &::getBooleanCppuType(), 0, MID_TL_HASCOLOR } , \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_CROSSEDOUT), EE_CHAR_STRIKEOUT, &::getBooleanCppuType(), 0, MID_CROSSED_OUT }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_STRIKEOUT), EE_CHAR_STRIKEOUT, &::getCppuType((const sal_Int16*)0), 0, MID_CROSS_OUT}, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_SHADOWED), EE_CHAR_SHADOW, &::getBooleanCppuType(), 0, 0 }, \
- { MAP_CHAR_LEN("CharContoured"), EE_CHAR_OUTLINE, &::getBooleanCppuType(), 0, 0 }, \
- { MAP_CHAR_LEN("CharEscapementHeight"), EE_CHAR_ESCAPEMENT, &::getCppuType((const sal_Int8*)0), 0, MID_ESC_HEIGHT },\
- { MAP_CHAR_LEN("CharAutoKerning"), EE_CHAR_PAIRKERNING,&::getBooleanCppuType(), 0, 0 } , \
- { MAP_CHAR_LEN("CharKerning"), EE_CHAR_KERNING, &::getCppuType((const sal_Int16*)0) , 0, 0 }, \
- { MAP_CHAR_LEN("CharWordMode"), EE_CHAR_WLM, &::getBooleanCppuType(), 0, 0 }, \
- { MAP_CHAR_LEN("CharEmphasis"), EE_CHAR_EMPHASISMARK,&::getCppuType((const sal_Int16*)0), 0, MID_EMPHASIS},\
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN), EE_CHAR_FONTHEIGHT_CJK, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const ::rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },\
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const ::rtl::OUString*)0), 0, MID_FONT_STYLE_NAME }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE_ASIAN), EE_CHAR_ITALIC_CJK, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN), EE_CHAR_WEIGHT_CJK, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE_ASIAN), EE_CHAR_LANGUAGE_CJK, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX), EE_CHAR_FONTHEIGHT_CTL, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const ::rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },\
- {MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX),EE_CHAR_FONTINFO_CTL, &::getCppuType((const ::rtl::OUString*)0), 0, MID_FONT_STYLE_NAME }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX), EE_CHAR_ITALIC_CTL, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX), EE_CHAR_WEIGHT_CTL, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
- { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX), EE_CHAR_LANGUAGE_CTL, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
- { MAP_CHAR_LEN("CharRelief" ), EE_CHAR_RELIEF, &::getCppuType((const sal_Int16*)0), 0, MID_RELIEF }
-
-#define SVX_UNOEDIT_FONT_PROPERTIES \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_FONT_DESCRIPTOR), WID_FONTDESC, &::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0), 0, MID_FONT_FAMILY_NAME }
-
-#define SVX_UNOEDIT_PARA_PROPERTIES \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_ADJUST), EE_PARA_JUST, &::getCppuType((const sal_Int16*)0), 0, MID_PARA_ADJUST }, \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_BMARGIN), EE_PARA_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_LO_MARGIN|SFX_METRIC_ITEM }, \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_HYPHEN), EE_PARA_HYPHENATE, &::getBooleanCppuType(), 0, 0 }, \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LASTLINEADJ), EE_PARA_JUST, &::getCppuType((const sal_Int16*)0), 0, MID_LAST_LINE_ADJUST }, \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LMARGIN), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_TXT_LMARGIN|SFX_METRIC_ITEM }, \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LINESPACING), EE_PARA_SBL, &::getCppuType((const ::com::sun::star::style::LineSpacing*)0), 0, 0 }, \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_RMARGIN), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_R_MARGIN|SFX_METRIC_ITEM }, \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_TAPSTOPS), EE_PARA_TABS, SEQTYPE(::getCppuType((const ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop >*)0)), 0, 0 }, \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_TMARGIN), EE_PARA_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_UP_MARGIN|SFX_METRIC_ITEM },\
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_FIRST_LINE_INDENT|SFX_METRIC_ITEM}, \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION),EE_PARA_HANGINGPUNCTUATION, &::getBooleanCppuType(), 0 ,0 }, \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE), EE_PARA_ASIANCJKSPACING, &::getBooleanCppuType(), 0 ,0 }, \
- {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES), EE_PARA_FORBIDDENRULES, &::getBooleanCppuType(), 0 ,0 },\
- {MAP_CHAR_LEN("WritingMode"), EE_PARA_WRITINGDIR, &::getCppuType((const sal_Int16*)0), 0, 0 }
-
-class SvxEditSource;
-class SvxTextForwarder;
-class SvxFieldItem;
-class SvxTextEditSource;
-class SvxFieldData;
-struct ESelection;
-
-EDITENG_DLLPUBLIC void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw();
-EDITENG_DLLPUBLIC void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw();
-
-// ====================================================================
-// This class implements a SvxEditSource and SvxTextForwarder and does
-// nothing otherwise
-// ====================================================================
-
-class SvxDummyTextSource : public SvxEditSource, public SvxTextForwarder
-{
-public:
-
- // SvxEditSource
- virtual ~SvxDummyTextSource();
- virtual SvxEditSource* Clone() const;
- virtual SvxTextForwarder* GetTextForwarder();
- virtual void UpdateData();
-
- // SvxTextForwarder
- virtual sal_uInt16 GetParagraphCount() const;
- virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
- virtual String GetText( const ESelection& rSel ) const;
- virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const;
- virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
- virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
- virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
- virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const;
-
- sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
- sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
-
- virtual SfxItemPool* GetPool() const;
-
- virtual void QuickInsertText( const String& rText, const ESelection& rSel );
- virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
- virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
- virtual void QuickInsertLineBreak( const ESelection& rSel );
-
- virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
- virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
-
- virtual sal_Bool IsValid() const;
-
- virtual void SetNotifyHdl( const Link& );
- virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
- virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
- virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
- virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
- virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
- virtual MapMode GetMapMode() const;
- virtual OutputDevice* GetRefDevice() const;
- virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
- virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
- virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
- virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
- virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
- virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- virtual sal_Bool Delete( const ESelection& );
- virtual sal_Bool InsertText( const String&, const ESelection& );
- virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
- virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
- virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
-
- virtual const SfxItemSet* GetEmptyItemSetPtr();
-
- // implementation functions for XParagraphAppend and XTextPortionAppend
- virtual void AppendParagraph();
- virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
- //XTextCopy
- virtual void CopyText(const SvxTextForwarder& rSource);
-};
-
-namespace accessibility
-{
- class AccessibleEditableTextPara;
-}
-
-// ====================================================================
-class EDITENG_DLLPUBLIC SvxUnoTextRangeBase : public ::com::sun::star::text::XTextRange,
- public ::com::sun::star::beans::XPropertySet,
- public ::com::sun::star::beans::XMultiPropertySet,
- public ::com::sun::star::beans::XMultiPropertyStates,
- public ::com::sun::star::beans::XPropertyState,
- public ::com::sun::star::lang::XServiceInfo,
- public ::com::sun::star::text::XTextRangeCompare,
- public ::com::sun::star::lang::XUnoTunnel,
- private osl::DebugBase<SvxUnoTextRangeBase>
-
-{
- friend class SvxUnoTextRangeEnumeration;
- friend class accessibility::AccessibleEditableTextPara;
-
-protected:
- SvxEditSource* mpEditSource;
- ESelection maSelection;
- const SvxItemPropertySet* mpPropSet;
-
- virtual void SAL_CALL _setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL _getPropertyValue( const ::rtl::OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL _setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues, sal_Int32 nPara = -1 ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL _getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, sal_Int32 nPara = -1 ) throw (::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const ::rtl::OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL _getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- // returns true if property found or false if unknown property
- virtual sal_Bool _getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertySimpleEntry* pMap, ::com::sun::star::beans::PropertyState& rState);
-
- virtual void SAL_CALL _setPropertyToDefault( const ::rtl::OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual void _setPropertyToDefault( SvxTextForwarder* pForwarder, const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara ) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
- void SetEditSource( SvxEditSource* _pEditSource ) throw();
-
- virtual void getPropertyValue( const SfxItemPropertySimpleEntry* pMap, com::sun::star::uno::Any& rAny, const SfxItemSet& rSet ) throw(::com::sun::star::beans::UnknownPropertyException );
- virtual void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const com::sun::star::uno::Any& rValue, const ESelection& rSelection, const SfxItemSet& rOldSet, SfxItemSet& rNewSet ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::IllegalArgumentException );
-
-public:
- SvxUnoTextRangeBase( const SvxItemPropertySet* _pSet ) throw();
- SvxUnoTextRangeBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw();
- SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw();
- virtual ~SvxUnoTextRangeBase() throw();
-
- // Internal
- const ESelection& GetSelection() const throw() { CheckSelection( ((SvxUnoTextRangeBase*)this)->maSelection, mpEditSource->GetTextForwarder() ); return maSelection; };
- void SetSelection( const ESelection& rSelection ) throw();
-
- virtual void CollapseToStart(void) throw();
- virtual void CollapseToEnd(void) throw();
- virtual sal_Bool IsCollapsed(void) throw();
- virtual sal_Bool GoLeft(sal_Int16 nCount, sal_Bool Expand) throw();
- virtual sal_Bool GoRight(sal_Int16 nCount, sal_Bool Expand) throw();
- virtual void GotoStart(sal_Bool Expand) throw();
- virtual void GotoEnd(sal_Bool Expand) throw();
-
- //const SfxItemPropertyMapEntry* getPropertyMapEntries() const throw() { return maPropSet.getPropertyMapEntries(); }
- const SvxItemPropertySet* getPropertySet() const throw() { return mpPropSet; }
- SvxEditSource* GetEditSource() const throw() { return mpEditSource; }
-
- static sal_Bool SetPropertyValueHelper( const SfxItemSet& rOldSet, const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection = NULL, SvxEditSource* pEditSource = NULL ) throw( ::com::sun::star::uno::RuntimeException );
- static sal_Bool GetPropertyValueHelper( SfxItemSet& rSet, const SfxItemPropertySimpleEntry* pMap, ::com::sun::star::uno::Any& aAny, const ESelection* pSelection = NULL, SvxEditSource* pEditSource = NULL ) throw( ::com::sun::star::uno::RuntimeException );
-
- void attachField( const SvxFieldData* pData ) throw();
-
- UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextRangeBase )
-
- // ::com::sun::star::text::XTextRange
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setString( const ::rtl::OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::beans::XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- // XMultiPropertySet
- virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::beans::XPropertyState
- virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::beans::XMultiPropertyStates
- //virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- // XTextRangeCompare
- virtual ::sal_Int16 SAL_CALL compareRegionStarts( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR2 ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int16 SAL_CALL compareRegionEnds( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR2 ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XServiceInfo
- 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);
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static( ) SAL_THROW(());
-};
-
-// ====================================================================
-
-class SvxUnoTextBase;
-class EDITENG_DLLPUBLIC SvxUnoTextRange : public SvxUnoTextRangeBase,
- public ::com::sun::star::lang::XTypeProvider,
- public ::cppu::OWeakAggObject
-{
- friend class SvxUnoTextRangeEnumeration;
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText;
- sal_Bool mbPortion;
-
-public:
- SvxUnoTextRange( const SvxUnoTextBase& rParent, sal_Bool bPortion = sal_False ) throw();
- virtual ~SvxUnoTextRange() throw();
-
- // ::com::sun::star::uno::XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // ::com::sun::star::text::XTextRange
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
-};
-
-class EDITENG_DLLPUBLIC SvxUnoTextBase : public SvxUnoTextRangeBase,
- public ::com::sun::star::text::XTextAppend,
- public ::com::sun::star::text::XTextCopy,
- public ::com::sun::star::container::XEnumerationAccess,
- public ::com::sun::star::text::XTextRangeMover,
- public ::com::sun::star::lang::XTypeProvider
-{
-protected:
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText;
-
-public:
- SvxUnoTextBase( ) throw();
- SvxUnoTextBase( const SvxItemPropertySet* _pSet ) throw();
- SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw();
- SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > xParent ) throw();
- SvxUnoTextBase( const SvxUnoTextBase& rText ) throw();
- virtual ~SvxUnoTextBase() throw();
-
- UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextBase )
-
- ESelection InsertField( const SvxFieldItem& rField ) throw();
- static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getStaticTypes() throw();
-
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > createTextCursorBySelection( const ESelection& rSel );
-
- // ::com::sun::star::uno::XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::text::XSimpleText
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& aTextPosition ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const ::rtl::OUString& aString, sal_Bool bAbsorb ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::text::XText
- virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent, sal_Bool bAbsorb ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setString( const ::rtl::OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::text::XTextRange
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::container::XEnumerationAccess
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::container::XElementAccess
- virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::text::XTextRangeMover
- virtual void SAL_CALL moveTextRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Int16 nParagraphs ) throw(::com::sun::star::uno::RuntimeException);
-
- // com::sun::star::text::XParagraphAppend (new import API)
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL appendParagraph( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishParagraph( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
-
- // com::sun::star::text::XTextPortionAppend (new import API)
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL appendTextPortion( const ::rtl::OUString& Text, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
-
- // com::sun::star::text::XTextCopy
- virtual void SAL_CALL copyText( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCopy >& xSource ) throw (::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static( ) SAL_THROW(());
-
- // ::com::sun::star::lang::XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
-};
-
-// ====================================================================
-class EDITENG_DLLPUBLIC SvxUnoText : public SvxUnoTextBase,
- public ::cppu::OWeakAggObject
-{
-public:
- SvxUnoText( ) throw();
- SvxUnoText( const SvxItemPropertySet* _pSet ) throw();
- SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > xParent ) throw();
- SvxUnoText( const SvxUnoText& rText ) throw();
- virtual ~SvxUnoText() throw();
-
- // Internal
- UNO3_GETIMPLEMENTATION_DECL( SvxUnoText )
-
- // ::com::sun::star::uno::XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // ::com::sun::star::lang::XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
-};
-
-// ====================================================================
-
-#include <cppuhelper/implbase1.hxx>
-
-class SvxUnoTextContentEnumeration : public ::cppu::WeakAggImplHelper1< ::com::sun::star::container::XEnumeration >
-{
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
- SvxEditSource* mpEditSource;
- sal_uInt16 mnNextParagraph;
- const SvxUnoTextBase& mrText;
-
-public:
- SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText ) throw();
- virtual ~SvxUnoTextContentEnumeration() throw();
-
- // ::com::sun::star::container::XEnumeration
- virtual sal_Bool SAL_CALL hasMoreElements( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-};
-
-// ====================================================================
-#include <com/sun/star/text/XTextContent.hpp>
-
-class SvUShorts;
-class SvxUnoTextContent : public SvxUnoTextRangeBase,
- public ::com::sun::star::text::XTextContent,
- public ::com::sun::star::container::XEnumerationAccess,
- public ::com::sun::star::lang::XTypeProvider,
- public ::cppu::OWeakAggObject
-{
- friend class SvxUnoTextContentEnumeration;
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
- sal_uInt16 mnParagraph;
- const SvxUnoTextBase& mrParentText;
-
- // for xComponent
- ::osl::Mutex maDisposeContainerMutex;
- ::cppu::OInterfaceContainerHelper maDisposeListeners;
- bool mbDisposing;
-
-protected:
- using SvxUnoTextRangeBase::setPropertyValue;
- using SvxUnoTextRangeBase::getPropertyValue;
-
-public:
- SvxUnoTextContent() throw();
- SvxUnoTextContent( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw();
- SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw();
- virtual ~SvxUnoTextContent() throw();
-
- // ::com::sun::star::uno::XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // ::com::sun::star::text::XTextRange
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::text::XTextContent -> ::com::sun::star::lang::XComponent
- virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XComponent
- virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::container::XEnumerationAccess
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::container::XElementAccess
- virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::beans::XPropertySet
- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- // XMultiPropertySet
- virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::beans::XPropertyState
- virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
-};
-
-// ====================================================================
-
-class SvxUnoTextRangeEnumeration : public ::cppu::WeakAggImplHelper1< ::com::sun::star::container::XEnumeration >
-{
-private:
- SvxEditSource* mpEditSource;
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
- const SvxUnoTextBase& mrParentText;
- sal_uInt16 mnParagraph;
- SvUShorts* mpPortions;
- sal_uInt16 mnNextPortion;
-
-public:
- SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw();
- virtual ~SvxUnoTextRangeEnumeration() throw();
-
- // ::com::sun::star::container::XEnumeration
- virtual sal_Bool SAL_CALL hasMoreElements( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-};
-
-// ====================================================================
-
-class EDITENG_DLLPUBLIC SvxUnoTextCursor : public SvxUnoTextRangeBase,
- public ::com::sun::star::text::XTextCursor,
- public ::com::sun::star::lang::XTypeProvider,
- public ::cppu::OWeakAggObject
-{
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
-
-public:
- SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw();
- SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw();
- virtual ~SvxUnoTextCursor() throw();
-
- // ::com::sun::star::uno::XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // ::com::sun::star::text::XTextRange
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setString( const ::rtl::OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::text::XTextCursor -> ::com::sun::star::text::XTextRange
- virtual void SAL_CALL collapseToStart( ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL collapseToEnd( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCollapsed( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL gotoStart( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL gotoRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
- 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);
-
- // ::com::sun::star::lang::XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
-
-};
-
-EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet();
-EDITENG_DLLPUBLIC const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap();
-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
deleted file mode 100644
index 62e6215178..0000000000
--- a/editeng/inc/editeng/unoviwed.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOVIWED_HXX
-#define _SVX_UNOVIWED_HXX
-
-#include <editeng/unoedsrc.hxx>
-
-#include <editeng/editdata.hxx>
-
-class EditView;
-
-/// Specialization for Calc
-class SvxEditEngineViewForwarder : public SvxEditViewForwarder
-{
-private:
- EditView& mrView;
-
-public:
- SvxEditEngineViewForwarder( EditView& rView );
- virtual ~SvxEditEngineViewForwarder();
-
- virtual sal_Bool IsValid() const;
-
- virtual Rectangle GetVisArea() const;
- virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
- virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
-
- virtual sal_Bool GetSelection( ESelection& rSelection ) const;
- virtual sal_Bool SetSelection( const ESelection& rSelection );
- virtual sal_Bool Copy();
- virtual sal_Bool Cut();
- virtual sal_Bool Paste();
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/unoviwou.hxx b/editeng/inc/editeng/unoviwou.hxx
deleted file mode 100644
index da28f8d05d..0000000000
--- a/editeng/inc/editeng/unoviwou.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_UNOVIWOU_HXX
-#define _SVX_UNOVIWOU_HXX
-
-#include <editeng/unoedsrc.hxx>
-#include <editeng/editengdllapi.h>
-
-class OutlinerView;
-
-/// Specialization for Draw/Impress
-class EDITENG_DLLPUBLIC SvxDrawOutlinerViewForwarder : public SvxEditViewForwarder
-{
-private:
- OutlinerView& mrOutlinerView;
- Point maTextShapeTopLeft;
-
- EDITENG_DLLPRIVATE Point GetTextOffset() const;
-
-public:
- explicit SvxDrawOutlinerViewForwarder( OutlinerView& rOutl );
- SvxDrawOutlinerViewForwarder( OutlinerView& rOutl, const Point& rShapePosTopLeft );
- virtual ~SvxDrawOutlinerViewForwarder();
-
- virtual sal_Bool IsValid() const;
-
- virtual Rectangle GetVisArea() const;
- virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
- virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
-
- virtual sal_Bool GetSelection( ESelection& rSelection ) const;
- virtual sal_Bool SetSelection( const ESelection& rSelection );
- virtual sal_Bool Copy();
- virtual sal_Bool Cut();
- virtual sal_Bool Paste();
-
- /// Set the top, left position of the underlying draw shape, to
- /// allow EditEngine offset calculations
- void SetShapePos( const Point& rShapePosTopLeft );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/wghtitem.hxx b/editeng/inc/editeng/wghtitem.hxx
deleted file mode 100644
index adbe0ab806..0000000000
--- a/editeng/inc/editeng/wghtitem.hxx
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_WGHTITEM_HXX
-#define _SVX_WGHTITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <vcl/vclenum.hxx>
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxWeightItem ---------------------------------------------------
-
-/* [Description]
-
- This item describes the font weight.
-*/
-
-class EDITENG_DLLPUBLIC SvxWeightItem : public SfxEnumItem
-{
-public:
- TYPEINFO();
-
- SvxWeightItem( const FontWeight eWght /*= WEIGHT_NORMAL*/,
- const sal_uInt16 nId );
-
- // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
- virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
- virtual sal_uInt16 GetValueCount() const;
-
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
-
- virtual int HasBoolValue() const;
- virtual sal_Bool GetBoolValue() const;
- virtual void SetBoolValue( sal_Bool bVal );
-
- inline SvxWeightItem& operator=(const SvxWeightItem& rWeight) {
- SetValue( rWeight.GetValue() );
- return *this;
- }
-
- // enum cast
- FontWeight GetWeight() const
- { return (FontWeight)GetValue(); }
- void SetWeight( FontWeight eNew )
- { SetValue( (sal_uInt16)eNew ); }
-};
-
-#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
deleted file mode 100644
index 0e280288c2..0000000000
--- a/editeng/inc/editeng/widwitem.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_WIDWITEM_HXX
-#define _SVX_WIDWITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/intitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxWidowsItem ---------------------------------------------------
-
-/* [Description]
-
- This item describes the number of lines for the widows control.
-*/
-
-class EDITENG_DLLPUBLIC SvxWidowsItem: public SfxByteItem
-{
- friend SvStream & operator<<( SvStream & aS, SvxWidowsItem & );
-public:
- TYPEINFO();
-
- SvxWidowsItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxWidowsItem& operator=( const SvxWidowsItem& rWidows )
- {
- SetValue( rWidows.GetValue() );
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/writingmodeitem.hxx b/editeng/inc/editeng/writingmodeitem.hxx
deleted file mode 100644
index 89efe83bce..0000000000
--- a/editeng/inc/editeng/writingmodeitem.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_WRITINGMODEITEM_HXX
-#define _SVX_WRITINGMODEITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <com/sun/star/text/WritingMode.hpp>
-#include <svl/intitem.hxx>
-#include "editeng/editengdllapi.h"
-
-// class SvxWritingModeItem ----------------------------------------------
-
-class EDITENG_DLLPUBLIC SvxWritingModeItem : public SfxUInt16Item
-{
-public:
- TYPEINFO();
-
- SvxWritingModeItem( ::com::sun::star::text::WritingMode eValue /*= com::sun::star::text::WritingMode_LR_TB*/,
- sal_uInt16 nWhich /*= SDRATTR_TEXTDIRECTION*/ );
- virtual ~SvxWritingModeItem();
-
- SvxWritingModeItem& operator=( const SvxWritingModeItem& rItem );
-
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
- virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
- virtual int operator==( const SfxPoolItem& ) const;
-
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- 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 );
-};
-
-#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
deleted file mode 100644
index 9226fca3ef..0000000000
--- a/editeng/inc/editeng/wrlmitem.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SVX_WRLMITEM_HXX
-#define _SVX_WRLMITEM_HXX
-
-// include ---------------------------------------------------------------
-
-#include <svl/eitem.hxx>
-#include <editeng/editengdllapi.h>
-
-class SvXMLUnitConverter;
-namespace rtl
-{
- class OUString;
-}
-
-// class SvxWordLineModeItem ---------------------------------------------
-
-/* [Description]
-
- This item describes, whether underlined and strikethrough is limited
- to word boundaries.
-*/
-
-class EDITENG_DLLPUBLIC SvxWordLineModeItem : public SfxBoolItem
-{
-public:
- TYPEINFO();
-
- SvxWordLineModeItem( const sal_Bool bWordLineMode /*= sal_False*/,
- const sal_uInt16 nId );
-
- // "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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- String &rText, const IntlWrapper * = 0 ) const;
-
- inline SvxWordLineModeItem& operator=( const SvxWordLineModeItem& rWLM )
- {
- SetValue( rWLM.GetValue() );
- return *this;
- }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/xmlcnitm.hxx b/editeng/inc/editeng/xmlcnitm.hxx
deleted file mode 100644
index f4469fb93e..0000000000
--- a/editeng/inc/editeng/xmlcnitm.hxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_XMLCNITM_HXX
-#define _SVX_XMLCNITM_HXX
-
-#include <svl/poolitem.hxx>
-#include "editeng/editengdllapi.h"
-
-class SvXMLNamespaceMap;
-namespace rtl { class OUString; }
-
-//============================================================================
-
-class SvXMLAttrContainerData;
-
-class EDITENG_DLLPUBLIC SvXMLAttrContainerItem: public SfxPoolItem
-{
- SvXMLAttrContainerData *pImpl;
-
-public:
- TYPEINFO();
-
- SvXMLAttrContainerItem( sal_uInt16 nWhich = 0 );
- SvXMLAttrContainerItem( const SvXMLAttrContainerItem& );
- virtual ~SvXMLAttrContainerItem();
-
- virtual int operator==( const SfxPoolItem& ) const;
- using SfxPoolItem::Compare;
- virtual int Compare( const SfxPoolItem &rWith ) const;
-
- virtual SfxItemPresentation GetPresentation(
- SfxItemPresentation ePresentation,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresentationMetric,
- XubString &rText,
- const IntlWrapper *pIntlWrapper = 0 ) const;
-
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) 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 SfxPoolItem *Clone( SfxItemPool * = 0) const
- { return new SvXMLAttrContainerItem( *this ); }
-
- sal_Bool AddAttr( const ::rtl::OUString& rLName,
- const ::rtl::OUString& rValue );
- sal_Bool AddAttr( const ::rtl::OUString& rPrefix,
- const ::rtl::OUString& rNamespace,
- const ::rtl::OUString& rLName,
- const ::rtl::OUString& rValue );
-
- sal_uInt16 GetAttrCount() const;
- ::rtl::OUString GetAttrNamespace( sal_uInt16 i ) const;
- ::rtl::OUString GetAttrPrefix( sal_uInt16 i ) const;
- const ::rtl::OUString& GetAttrLName( sal_uInt16 i ) const;
- const ::rtl::OUString& GetAttrValue( sal_uInt16 i ) const;
-
- sal_uInt16 GetFirstNamespaceIndex() const;
- sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const;
- const ::rtl::OUString& GetNamespace( sal_uInt16 i ) const;
- const ::rtl::OUString& GetPrefix( sal_uInt16 i ) const;
-};
-
-#endif // _SVX_XMLCNITM_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editxml.hxx b/editeng/inc/editxml.hxx
deleted file mode 100644
index 8d103edde3..0000000000
--- a/editeng/inc/editxml.hxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_EDITXML_HXX
-#define _SVX_EDITXML_HXX
-
-class EditEngine;
-class SvStream;
-struct ESelection;
-
-/** this function exports the selected content of an edit engine into a xml stream*/
-extern void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel );
-
-/** this function imports xml from the stream into the selected of an edit engine */
-extern void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel );
-
-#endif
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/helpid.hrc b/editeng/inc/helpid.hrc
deleted file mode 100755
index 83a7288c52..0000000000
--- a/editeng/inc/helpid.hrc
+++ /dev/null
@@ -1,57 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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_HELPID_HRC
-#define _EDITENG_HELPID_HRC
-
-#define HID_EDITENG_SPELLER_WORDLANGUAGE "EDITENG_HID_EDITENG_SPELLER_WORDLANGUAGE"
-#define HID_EDITENG_SPELLER_PARALANGUAGE "EDITENG_HID_EDITENG_SPELLER_PARALANGUAGE"
-#define HID_EDITENG_SPELLER_ADDWORD "EDITENG_HID_EDITENG_SPELLER_ADDWORD"
-#define HID_EDITENG_SPELLER_AUTOCORRECT "EDITENG_HID_EDITENG_SPELLER_AUTOCORRECT"
-#define HID_EDITENG_SPELLER_IGNORE "EDITENG_HID_EDITENG_SPELLER_IGNORE"
-#define HID_EDITENG_SPELLER_START "EDITENG_HID_EDITENG_SPELLER_START"
-
-#define HID_AUTOCORR_HELP_WORD "EDITENG_HID_AUTOCORR_HELP_START"
-#define HID_AUTOCORR_HELP_SENT "EDITENG_HID_AUTOCORR_HELP_SENT"
-#define HID_AUTOCORR_HELP_SENTWORD "EDITENG_HID_AUTOCORR_HELP_SENTWORD"
-#define HID_AUTOCORR_HELP_ACORWORD "EDITENG_HID_AUTOCORR_HELP_ACORWORD"
-#define HID_AUTOCORR_HELP_ACORSENTWORD "EDITENG_HID_AUTOCORR_HELP_ACORSENTWORD"
-#define HID_AUTOCORR_HELP_CHGTOENEMDASH "EDITENG_HID_AUTOCORR_HELP_CHGTOENEMDASH"
-#define HID_AUTOCORR_HELP_WORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_WORDENEMDASH"
-#define HID_AUTOCORR_HELP_SENTENEMDASH "EDITENG_HID_AUTOCORR_HELP_SENTENEMDASH"
-#define HID_AUTOCORR_HELP_SENTWORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_SENTWORDENEMDASH"
-#define HID_AUTOCORR_HELP_ACORWORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_ACORWORDENEMDASH"
-#define HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH "EDITENG_HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH"
-#define HID_AUTOCORR_HELP_CHGQUOTES "EDITENG_HID_AUTOCORR_HELP_CHGQUOTES"
-#define HID_AUTOCORR_HELP_CHGSGLQUOTES "EDITENG_HID_AUTOCORR_HELP_CHGSGLQUOTES"
-#define HID_AUTOCORR_HELP_SETINETATTR "EDITENG_HID_AUTOCORR_HELP_SETINETATTR"
-#define HID_AUTOCORR_HELP_INGNOREDOUBLESPACE "EDITENG_HID_AUTOCORR_HELP_INGNOREDOUBLESPACE"
-#define HID_AUTOCORR_HELP_CHGWEIGHTUNDERL "EDITENG_HID_AUTOCORR_HELP_CHGWEIGHTUNDERL"
-#define HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL "EDITENG_HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL"
-#define HID_AUTOCORR_HELP_CHGORDINALNUMBER "EDITENG_HID_AUTOCORR_HELP_CHGORDINALNUMBER"
-
-#endif
-
diff --git a/editeng/inc/pch/precompiled_editeng.cxx b/editeng/inc/pch/precompiled_editeng.cxx
deleted file mode 100644
index 2b5afa0f3c..0000000000
--- a/editeng/inc/pch/precompiled_editeng.cxx
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 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.
- *
- ************************************************************************/
-
-#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
deleted file mode 100644
index afa7a3e9a8..0000000000
--- a/editeng/inc/pch/precompiled_editeng.hxx
+++ /dev/null
@@ -1,889 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): Generated on 2006-09-01 17:50:08.279739
-
-#ifdef PRECOMPILED_HEADERS
-//---MARKER---
-#include "sal/config.h"
-#include "com/sun/star/accessibility/AccessibleEventId.hpp"
-#include "com/sun/star/accessibility/AccessibleEventObject.hpp"
-#include "com/sun/star/accessibility/AccessibleRelationType.hpp"
-#include "com/sun/star/accessibility/AccessibleRole.hpp"
-#include "com/sun/star/accessibility/AccessibleStateType.hpp"
-#include "com/sun/star/accessibility/AccessibleTextType.hpp"
-#include "com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp"
-#include "com/sun/star/accessibility/TextSegment.hpp"
-#include "com/sun/star/accessibility/XAccessible.hpp"
-#include "com/sun/star/accessibility/XAccessibleAction.hpp"
-#include "com/sun/star/accessibility/XAccessibleContext.hpp"
-#include "com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp"
-#include "com/sun/star/accessibility/XAccessibleEventListener.hpp"
-#include "com/sun/star/accessibility/XAccessibleImage.hpp"
-#include "com/sun/star/accessibility/XAccessibleRelationSet.hpp"
-#include "com/sun/star/accessibility/XAccessibleSelection.hpp"
-#include "com/sun/star/accessibility/XAccessibleStateSet.hpp"
-#include "com/sun/star/accessibility/XAccessibleTable.hpp"
-#include "com/sun/star/accessibility/XAccessibleTextAttributes.hpp"
-#include "com/sun/star/accessibility/XAccessibleValue.hpp"
-#include "com/sun/star/awt/CharSet.hpp"
-#include "com/sun/star/awt/FocusChangeReason.hpp"
-#include "com/sun/star/awt/FontDescriptor.hpp"
-#include "com/sun/star/awt/FontFamily.hpp"
-#include "com/sun/star/awt/FontPitch.hpp"
-#include "com/sun/star/awt/FontSlant.hpp"
-#include "com/sun/star/awt/FontType.hpp"
-#include "com/sun/star/awt/FontWeight.hpp"
-#include "com/sun/star/awt/FontWidth.hpp"
-#include "com/sun/star/awt/Gradient.hpp"
-#include "com/sun/star/awt/GradientStyle.hpp"
-#include "com/sun/star/awt/Key.hpp"
-#include "com/sun/star/awt/KeyEvent.hpp"
-#include "com/sun/star/awt/KeyModifier.hpp"
-#include "com/sun/star/awt/LineEndFormat.hpp"
-#include "com/sun/star/awt/PosSize.hpp"
-#include "com/sun/star/awt/RasterOperation.hpp"
-#include "com/sun/star/awt/Rectangle.hpp"
-#include "com/sun/star/awt/ScrollBarOrientation.hpp"
-#include "com/sun/star/awt/SimpleFontMetric.hpp"
-#include "com/sun/star/awt/Size.hpp"
-#include "com/sun/star/awt/TextAlign.hpp"
-#include "com/sun/star/awt/VisualEffect.hpp"
-#include "com/sun/star/awt/WindowAttribute.hpp"
-#include "com/sun/star/awt/WindowDescriptor.hpp"
-#include "com/sun/star/awt/XBitmap.hpp"
-#include "com/sun/star/awt/XCheckBox.hpp"
-#include "com/sun/star/awt/XComboBox.hpp"
-#include "com/sun/star/awt/XControl.hpp"
-#include "com/sun/star/awt/XControlContainer.hpp"
-#include "com/sun/star/awt/XControlModel.hpp"
-#include "com/sun/star/awt/XDevice.hpp"
-#include "com/sun/star/awt/XFocusListener.hpp"
-#include "com/sun/star/awt/XFont.hpp"
-#include "com/sun/star/awt/XGraphics.hpp"
-#include "com/sun/star/awt/XImageConsumer.hpp"
-#include "com/sun/star/awt/XItemListener.hpp"
-#include "com/sun/star/awt/XLayoutConstrains.hpp"
-#include "com/sun/star/awt/XListBox.hpp"
-#include "com/sun/star/awt/XMouseListener.hpp"
-#include "com/sun/star/awt/XProgressMonitor.hpp"
-#include "com/sun/star/awt/XTabController.hpp"
-#include "com/sun/star/awt/XTabControllerModel.hpp"
-#include "com/sun/star/awt/XTextListener.hpp"
-#include "com/sun/star/awt/XToolkit.hpp"
-#include "com/sun/star/awt/XVclWindowPeer.hpp"
-#include "com/sun/star/awt/XWindow.hpp"
-#include "com/sun/star/awt/XWindowListener.hpp"
-#include "com/sun/star/awt/XWindowPeer.hpp"
-#include "com/sun/star/beans/NamedValue.hpp"
-#include "com/sun/star/beans/PropertyAttribute.hpp"
-#include "com/sun/star/beans/PropertyChangeEvent.hpp"
-#include "com/sun/star/beans/PropertyState.hpp"
-#include "com/sun/star/beans/PropertyValue.hpp"
-#include "com/sun/star/beans/PropertyValues.hdl"
-#include "com/sun/star/beans/PropertyValues.hpp"
-#include "com/sun/star/beans/XFastPropertySet.hpp"
-#include "com/sun/star/beans/XIntrospection.hpp"
-#include "com/sun/star/beans/XMultiPropertySet.hpp"
-#include "com/sun/star/beans/XMultiPropertyStates.hpp"
-#include "com/sun/star/beans/XPropertyChangeListener.hpp"
-#include "com/sun/star/beans/XPropertySet.hpp"
-#include "com/sun/star/beans/XPropertySetInfo.hpp"
-#include "com/sun/star/beans/XPropertyState.hpp"
-#include "com/sun/star/chart/ChartAxisArrangeOrderType.hpp"
-#include "com/sun/star/container/ContainerEvent.hpp"
-#include "com/sun/star/container/NoSuchElementException.hpp"
-#include "com/sun/star/container/XChild.hpp"
-#include "com/sun/star/container/XContainer.hpp"
-#include "com/sun/star/container/XContainerListener.hpp"
-#include "com/sun/star/container/XContainerQuery.hpp"
-#include "com/sun/star/container/XContentEnumerationAccess.hpp"
-#include "com/sun/star/container/XEnumeration.hpp"
-#include "com/sun/star/container/XEnumerationAccess.hpp"
-#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
-#include "com/sun/star/container/XIdentifierContainer.hpp"
-#include "com/sun/star/container/XIndexAccess.hpp"
-#include "com/sun/star/container/XIndexContainer.hpp"
-#include "com/sun/star/container/XIndexReplace.hpp"
-#include "com/sun/star/container/XNameAccess.hpp"
-#include "com/sun/star/container/XNameContainer.hpp"
-#include "com/sun/star/container/XNameReplace.hpp"
-#include "com/sun/star/container/XNamed.hpp"
-#include "com/sun/star/container/XSet.hpp"
-#include "com/sun/star/datatransfer/DataFlavor.hpp"
-#include "com/sun/star/datatransfer/XTransferable.hpp"
-#include "com/sun/star/datatransfer/clipboard/XClipboard.hpp"
-#include "com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp"
-#include "com/sun/star/datatransfer/dnd/DNDConstants.hpp"
-#include "com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp"
-#include "com/sun/star/datatransfer/dnd/XDropTarget.hpp"
-#include "com/sun/star/document/EventObject.hpp"
-#include "com/sun/star/document/UpdateDocMode.hpp"
-#include "com/sun/star/document/XActionLockable.hpp"
-#include "com/sun/star/document/XBinaryStreamResolver.hpp"
-#include "com/sun/star/document/XDocumentInfoSupplier.hpp"
-#include "com/sun/star/document/XEmbeddedObjectResolver.hpp"
-#include "com/sun/star/document/XEventBroadcaster.hpp"
-#include "com/sun/star/document/XEventListener.hpp"
-#include "com/sun/star/document/XEventsSupplier.hpp"
-#include "com/sun/star/document/XExporter.hpp"
-#include "com/sun/star/document/XFilter.hpp"
-#include "com/sun/star/document/XGraphicObjectResolver.hpp"
-#include "com/sun/star/document/XImporter.hpp"
-#include "com/sun/star/document/XLinkTargetSupplier.hpp"
-#include "com/sun/star/document/XMimeTypeInfo.hpp"
-#include "com/sun/star/drawing/BitmapMode.hpp"
-#include "com/sun/star/drawing/CameraGeometry.hpp"
-#include "com/sun/star/drawing/CircleKind.hpp"
-#include "com/sun/star/drawing/ColorMode.hpp"
-#include "com/sun/star/drawing/ConnectionType.hpp"
-#include "com/sun/star/drawing/ConnectorType.hpp"
-#include "com/sun/star/drawing/DashStyle.hpp"
-#include "com/sun/star/drawing/Direction3D.hpp"
-#include "com/sun/star/drawing/DoubleSequence.hpp"
-#include "com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp"
-#include "com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp"
-#include "com/sun/star/drawing/EnhancedCustomShapeParameter.hpp"
-#include "com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp"
-#include "com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp"
-#include "com/sun/star/drawing/EnhancedCustomShapeSegment.hpp"
-#include "com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp"
-#include "com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp"
-#include "com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp"
-#include "com/sun/star/drawing/FillStyle.hpp"
-#include "com/sun/star/drawing/FlagSequence.hpp"
-#include "com/sun/star/drawing/Hatch.hpp"
-#include "com/sun/star/drawing/HomogenMatrix.hpp"
-#include "com/sun/star/drawing/HomogenMatrix3.hpp"
-#include "com/sun/star/drawing/LineDash.hpp"
-#include "com/sun/star/drawing/LineJoint.hpp"
-#include "com/sun/star/drawing/LineStyle.hpp"
-#include "com/sun/star/drawing/MeasureKind.hpp"
-#include "com/sun/star/drawing/MeasureTextHorzPos.hpp"
-#include "com/sun/star/drawing/MeasureTextVertPos.hpp"
-#include "com/sun/star/drawing/NormalsKind.hpp"
-#include "com/sun/star/drawing/PolyPolygonShape3D.hpp"
-#include "com/sun/star/drawing/PolygonFlags.hpp"
-#include "com/sun/star/drawing/PolygonKind.hpp"
-#include "com/sun/star/drawing/Position3D.hpp"
-#include "com/sun/star/drawing/ProjectionMode.hpp"
-#include "com/sun/star/drawing/RectanglePoint.hpp"
-#include "com/sun/star/drawing/ShadeMode.hpp"
-#include "com/sun/star/drawing/TextAdjust.hpp"
-#include "com/sun/star/drawing/TextAnimationDirection.hpp"
-#include "com/sun/star/drawing/TextAnimationKind.hpp"
-#include "com/sun/star/drawing/TextFitToSizeType.hpp"
-#include "com/sun/star/drawing/TextHorizontalAdjust.hpp"
-#include "com/sun/star/drawing/TextVerticalAdjust.hpp"
-#include "com/sun/star/drawing/TextureKind.hpp"
-#include "com/sun/star/drawing/TextureMode.hpp"
-#include "com/sun/star/drawing/TextureProjectionMode.hpp"
-#include "com/sun/star/drawing/XGluePointsSupplier.hpp"
-#include "com/sun/star/drawing/XShapeDescriptor.hpp"
-#include "com/sun/star/embed/Aspects.hpp"
-#include "com/sun/star/embed/ElementModes.hpp"
-#include "com/sun/star/embed/EmbedMisc.hpp"
-#include "com/sun/star/embed/EmbedStates.hpp"
-#include "com/sun/star/embed/EntryInitModes.hpp"
-#include "com/sun/star/embed/NoVisualAreaSizeException.hpp"
-#include "com/sun/star/embed/XEmbedObjectCreator.hpp"
-#include "com/sun/star/embed/XEmbedObjectFactory.hpp"
-#include "com/sun/star/embed/XEmbedPersist.hpp"
-#include "com/sun/star/embed/XEmbeddedObject.hpp"
-#include "com/sun/star/embed/XInsertObjectDialog.hpp"
-#include "com/sun/star/embed/XLinkageSupport.hpp"
-#include "com/sun/star/embed/XStorage.hpp"
-#include "com/sun/star/embed/XTransactedObject.hpp"
-#include "com/sun/star/form/DatabaseDeleteEvent.hpp"
-#include "com/sun/star/form/DatabaseParameterEvent.hpp"
-#include "com/sun/star/form/ErrorEvent.hpp"
-#include "com/sun/star/form/FormButtonType.hpp"
-#include "com/sun/star/form/FormComponentType.hpp"
-#include "com/sun/star/form/ListSourceType.hpp"
-#include "com/sun/star/form/NavigationBarMode.hpp"
-#include "com/sun/star/form/TabulatorCycle.hpp"
-#include "com/sun/star/form/XBoundComponent.hpp"
-#include "com/sun/star/form/XBoundControl.hpp"
-#include "com/sun/star/form/XConfirmDeleteBroadcaster.hpp"
-#include "com/sun/star/form/XConfirmDeleteListener.hpp"
-#include "com/sun/star/form/XDatabaseParameterBroadcaster2.hpp"
-#include "com/sun/star/form/XDatabaseParameterListener.hpp"
-#include "com/sun/star/form/XForm.hpp"
-#include "com/sun/star/form/XFormComponent.hpp"
-#include "com/sun/star/form/XFormController.hpp"
-#include "com/sun/star/form/XFormControllerListener.hpp"
-#include "com/sun/star/form/XFormsSupplier.hpp"
-#include "com/sun/star/form/XFormsSupplier2.hpp"
-#include "com/sun/star/form/XGrid.hpp"
-#include "com/sun/star/form/XGridColumnFactory.hpp"
-#include "com/sun/star/form/XGridFieldDataSupplier.hpp"
-#include "com/sun/star/form/XGridPeer.hpp"
-#include "com/sun/star/form/XImageProducerSupplier.hpp"
-#include "com/sun/star/form/XLoadListener.hpp"
-#include "com/sun/star/form/XLoadable.hpp"
-#include "com/sun/star/form/XReset.hpp"
-#include "com/sun/star/form/XResetListener.hpp"
-#include "com/sun/star/form/binding/XBindableValue.hpp"
-#include "com/sun/star/form/binding/XListEntrySink.hpp"
-#include "com/sun/star/form/binding/XValueBinding.hpp"
-#include "com/sun/star/form/submission/XSubmissionSupplier.hpp"
-#include "com/sun/star/form/validation/XFormComponentValidityListener.hpp"
-#include "com/sun/star/form/validation/XValidatableFormComponent.hpp"
-#include "com/sun/star/frame/DispatchDescriptor.hpp"
-#include "com/sun/star/frame/DispatchInformation.hpp"
-#include "com/sun/star/frame/FeatureStateEvent.hpp"
-#include "com/sun/star/frame/FrameSearchFlag.hpp"
-#include "com/sun/star/frame/XComponentLoader.hpp"
-#include "com/sun/star/frame/XController.hpp"
-#include "com/sun/star/frame/XDesktop.hpp"
-#include "com/sun/star/frame/XDispatch.hpp"
-#include "com/sun/star/frame/XDispatchInformationProvider.hpp"
-#include "com/sun/star/frame/XDispatchProvider.hpp"
-#include "com/sun/star/frame/XDispatchProviderInterception.hpp"
-#include "com/sun/star/frame/XDispatchProviderInterceptor.hpp"
-#include "com/sun/star/frame/XFrame.hpp"
-#include "com/sun/star/frame/XFrameActionListener.hpp"
-#include "com/sun/star/frame/XFrames.hpp"
-#include "com/sun/star/frame/XFramesSupplier.hpp"
-#include "com/sun/star/frame/XInterceptorInfo.hpp"
-#include "com/sun/star/frame/XModel.hpp"
-#include "com/sun/star/frame/XModuleManager.hpp"
-#include "com/sun/star/frame/XStatusListener.hpp"
-#include "com/sun/star/frame/XStorable.hpp"
-#include "com/sun/star/frame/XSynchronousDispatch.hpp"
-#include "com/sun/star/frame/status/ClipboardFormats.hpp"
-#include "com/sun/star/frame/status/FontHeight.hpp"
-#include "com/sun/star/frame/status/ItemStatus.hpp"
-#include "com/sun/star/frame/status/LeftRightMargin.hpp"
-#include "com/sun/star/frame/status/UpperLowerMargin.hpp"
-#include "com/sun/star/frame/status/UpperLowerMarginScale.hpp"
-#include "com/sun/star/gallery/GalleryItemType.hpp"
-#include "com/sun/star/gallery/XGalleryItem.hpp"
-#include "com/sun/star/gallery/XGalleryTheme.hpp"
-#include "com/sun/star/gallery/XGalleryThemeProvider.hpp"
-#include "com/sun/star/graphic/XGraphic.hpp"
-#include "com/sun/star/graphic/XGraphicProvider.hpp"
-#include "com/sun/star/graphic/XGraphicRenderer.hpp"
-#include "com/sun/star/i18n/CharacterIteratorMode.hdl"
-#include "com/sun/star/i18n/CharacterIteratorMode.hpp"
-#include "com/sun/star/i18n/CollatorOptions.hpp"
-#include "com/sun/star/i18n/ForbiddenCharacters.hpp"
-#include "com/sun/star/i18n/InputSequenceCheckMode.hpp"
-#include "com/sun/star/i18n/KCharacterType.hpp"
-#include "com/sun/star/i18n/ScriptType.hdl"
-#include "com/sun/star/i18n/ScriptType.hpp"
-#include "com/sun/star/i18n/TextConversionOption.hdl"
-#include "com/sun/star/i18n/TextConversionOption.hpp"
-#include "com/sun/star/i18n/TextConversionType.hpp"
-#include "com/sun/star/i18n/TransliterationModules.hpp"
-#include "com/sun/star/i18n/UnicodeScript.hpp"
-#include "com/sun/star/i18n/UnicodeType.hdl"
-#include "com/sun/star/i18n/WordType.hpp"
-#include "com/sun/star/i18n/XBreakIterator.hpp"
-#include "com/sun/star/i18n/XExtendedInputSequenceChecker.hpp"
-#include "com/sun/star/i18n/XExtendedTextConversion.hpp"
-#include "com/sun/star/i18n/XForbiddenCharacters.hpp"
-#include "com/sun/star/i18n/XTextConversion.hpp"
-#include "com/sun/star/inspection/XObjectInspector.hpp"
-#include "com/sun/star/inspection/XObjectInspectorModel.hpp"
-#include "com/sun/star/io/IOException.hpp"
-#include "com/sun/star/io/XActiveDataControl.hpp"
-#include "com/sun/star/io/XActiveDataSink.hpp"
-#include "com/sun/star/io/XActiveDataSource.hpp"
-#include "com/sun/star/io/XInputStream.hpp"
-#include "com/sun/star/io/XInputStreamProvider.hpp"
-#include "com/sun/star/io/XMarkableStream.hpp"
-#include "com/sun/star/io/XObjectInputStream.hpp"
-#include "com/sun/star/io/XObjectOutputStream.hpp"
-#include "com/sun/star/io/XOutputStream.hpp"
-#include "com/sun/star/io/XPersistObject.hpp"
-#include "com/sun/star/io/XSeekable.hdl"
-#include "com/sun/star/io/XStream.hpp"
-#include "com/sun/star/lang/DisposedException.hpp"
-#include "com/sun/star/lang/EventObject.hpp"
-#include "com/sun/star/lang/IllegalArgumentException.hpp"
-#include "com/sun/star/lang/IndexOutOfBoundsException.hpp"
-#include "com/sun/star/lang/Locale.hpp"
-#include "com/sun/star/lang/NoSupportException.hpp"
-#include "com/sun/star/lang/ServiceNotRegisteredException.hpp"
-#include "com/sun/star/lang/XComponent.hpp"
-#include "com/sun/star/lang/XEventListener.hpp"
-#include "com/sun/star/lang/XInitialization.hpp"
-#include "com/sun/star/lang/XMultiComponentFactory.hpp"
-#include "com/sun/star/lang/XMultiServiceFactory.hpp"
-#include "com/sun/star/lang/XServiceDisplayName.hpp"
-#include "com/sun/star/lang/XServiceInfo.hpp"
-#include "com/sun/star/lang/XServiceName.hpp"
-#include "com/sun/star/lang/XSingleComponentFactory.hpp"
-#include "com/sun/star/lang/XTypeProvider.hpp"
-#include "com/sun/star/lang/XUnoTunnel.hpp"
-#include "com/sun/star/linguistic2/ConversionDictionaryType.hpp"
-#include "com/sun/star/linguistic2/ConversionDirection.hdl"
-#include "com/sun/star/linguistic2/ConversionPropertyType.hpp"
-#include "com/sun/star/linguistic2/DictionaryEvent.hpp"
-#include "com/sun/star/linguistic2/DictionaryEventFlags.hpp"
-#include "com/sun/star/linguistic2/DictionaryListEvent.hpp"
-#include "com/sun/star/linguistic2/DictionaryListEventFlags.hpp"
-#include "com/sun/star/linguistic2/DictionaryType.hpp"
-#include "com/sun/star/linguistic2/SpellFailure.hpp"
-#include "com/sun/star/linguistic2/XAvailableLocales.hpp"
-#include "com/sun/star/linguistic2/XConversionDictionary.hpp"
-#include "com/sun/star/linguistic2/XConversionDictionaryList.hpp"
-#include "com/sun/star/linguistic2/XConversionPropertyType.hpp"
-#include "com/sun/star/linguistic2/XDictionary.hpp"
-#include "com/sun/star/linguistic2/XDictionary1.hpp"
-#include "com/sun/star/linguistic2/XDictionaryEntry.hpp"
-#include "com/sun/star/linguistic2/XDictionaryEventListener.hpp"
-#include "com/sun/star/linguistic2/XDictionaryList.hpp"
-#include "com/sun/star/linguistic2/XDictionaryListEventListener.hpp"
-#include "com/sun/star/linguistic2/XHyphenatedWord.hpp"
-#include "com/sun/star/linguistic2/XHyphenator.hpp"
-#include "com/sun/star/linguistic2/XLinguServiceManager.hdl"
-#include "com/sun/star/linguistic2/XLinguServiceManager.hpp"
-#include "com/sun/star/linguistic2/XMeaning.hpp"
-#include "com/sun/star/linguistic2/XPossibleHyphens.hpp"
-#include "com/sun/star/linguistic2/XSpellAlternatives.hpp"
-#include "com/sun/star/linguistic2/XSpellChecker.hpp"
-#include "com/sun/star/linguistic2/XSpellChecker1.hpp"
-#include "com/sun/star/linguistic2/XSupportedLocales.hpp"
-#include "com/sun/star/linguistic2/XThesaurus.hpp"
-#include "com/sun/star/media/XPlayer.hpp"
-#include "com/sun/star/media/ZoomLevel.hpp"
-#include "com/sun/star/plugin/PluginDescription.hpp"
-#include "com/sun/star/plugin/XPluginManager.hpp"
-#include "com/sun/star/reflection/XIdlClass.hpp"
-#include "com/sun/star/reflection/XIdlMethod.hpp"
-#include "com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp"
-#include "com/sun/star/reflection/XProxyFactory.hpp"
-#include "com/sun/star/registry/XRegistryKey.hpp"
-#include "com/sun/star/registry/XSimpleRegistry.hpp"
-#include "com/sun/star/script/ScriptEvent.hpp"
-#include "com/sun/star/script/ScriptEventDescriptor.hpp"
-#include "com/sun/star/script/XEventAttacherManager.hpp"
-#include "com/sun/star/script/XInvocation.hpp"
-#include "com/sun/star/script/XLibraryContainer.hpp"
-#include "com/sun/star/script/XScriptListener.hpp"
-#include "com/sun/star/script/XTypeConverter.hpp"
-#include "com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp"
-#include "com/sun/star/script/browse/BrowseNodeTypes.hpp"
-#include "com/sun/star/script/browse/XBrowseNode.hpp"
-#include "com/sun/star/script/browse/XBrowseNodeFactory.hpp"
-#include "com/sun/star/script/provider/ScriptErrorRaisedException.hpp"
-#include "com/sun/star/script/provider/ScriptExceptionRaisedException.hpp"
-#include "com/sun/star/script/provider/ScriptFrameworkErrorType.hpp"
-#include "com/sun/star/script/provider/XScriptProvider.hpp"
-#include "com/sun/star/script/provider/XScriptProviderSupplier.hpp"
-#include "com/sun/star/sdb/CommandType.hpp"
-#include "com/sun/star/sdb/ParametersRequest.hpp"
-#include "com/sun/star/sdb/RowChangeAction.hpp"
-#include "com/sun/star/sdb/RowChangeEvent.hpp"
-#include "com/sun/star/sdb/SQLContext.hpp"
-#include "com/sun/star/sdb/SQLErrorEvent.hpp"
-#include "com/sun/star/sdb/XColumn.hpp"
-#include "com/sun/star/sdb/XColumnUpdate.hpp"
-#include "com/sun/star/sdb/XCompletedConnection.hpp"
-#include "com/sun/star/sdb/XInteractionSupplyParameters.hpp"
-#include "com/sun/star/sdb/XQueriesSupplier.hpp"
-#include "com/sun/star/sdb/XResultSetAccess.hpp"
-#include "com/sun/star/sdb/XRowSetApproveBroadcaster.hpp"
-#include "com/sun/star/sdb/XRowSetApproveListener.hpp"
-#include "com/sun/star/sdb/XRowSetSupplier.hpp"
-#include "com/sun/star/sdb/XSQLErrorBroadcaster.hpp"
-#include "com/sun/star/sdb/XSQLErrorListener.hpp"
-#include "com/sun/star/sdb/XSQLQueryComposer.hpp"
-#include "com/sun/star/sdb/XSQLQueryComposerFactory.hpp"
-#include "com/sun/star/sdb/XSingleSelectQueryComposer.hpp"
-#include "com/sun/star/sdbc/ColumnValue.hpp"
-#include "com/sun/star/sdbc/DataType.hpp"
-#include "com/sun/star/sdbc/ResultSetConcurrency.hpp"
-#include "com/sun/star/sdbc/ResultSetType.hpp"
-#include "com/sun/star/sdbc/XConnection.hpp"
-#include "com/sun/star/sdbc/XDataSource.hpp"
-#include "com/sun/star/sdbc/XDatabaseMetaData.hpp"
-#include "com/sun/star/sdbc/XPreparedStatement.hpp"
-#include "com/sun/star/sdbc/XResultSet.hpp"
-#include "com/sun/star/sdbc/XResultSetUpdate.hpp"
-#include "com/sun/star/sdbc/XRow.hpp"
-#include "com/sun/star/sdbc/XRowSet.hpp"
-#include "com/sun/star/sdbc/XRowSetListener.hpp"
-#include "com/sun/star/sdbc/XStatement.hpp"
-#include "com/sun/star/sdbcx/Privilege.hpp"
-#include "com/sun/star/sdbcx/XColumnsSupplier.hpp"
-#include "com/sun/star/sdbcx/XDataDescriptorFactory.hpp"
-#include "com/sun/star/sdbcx/XDeleteRows.hpp"
-#include "com/sun/star/sdbcx/XRowLocate.hpp"
-#include "com/sun/star/sdbcx/XTablesSupplier.hpp"
-#include "com/sun/star/security/XDocumentDigitalSignatures.hpp"
-#include "com/sun/star/style/BreakType.hpp"
-#include "com/sun/star/style/CaseMap.hpp"
-#include "com/sun/star/style/GraphicLocation.hpp"
-#include "com/sun/star/style/LineSpacing.hpp"
-#include "com/sun/star/style/LineSpacingMode.hpp"
-#include "com/sun/star/style/NumberingType.hpp"
-#include "com/sun/star/style/PageStyleLayout.hpp"
-#include "com/sun/star/style/ParagraphAdjust.hpp"
-#include "com/sun/star/style/TabStop.hpp"
-#include "com/sun/star/style/VerticalAlignment.hpp"
-#include "com/sun/star/style/XStyle.hpp"
-#include "com/sun/star/style/XStyleFamiliesSupplier.hpp"
-#include "com/sun/star/table/BorderLine.hpp"
-#include "com/sun/star/table/CellAddress.hpp"
-#include "com/sun/star/table/CellContentType.hpp"
-#include "com/sun/star/table/CellHoriJustify.hpp"
-#include "com/sun/star/table/CellOrientation.hpp"
-#include "com/sun/star/table/CellRangeAddress.hpp"
-#include "com/sun/star/table/CellVertJustify.hpp"
-#include "com/sun/star/table/ShadowFormat.hpp"
-#include "com/sun/star/table/ShadowLocation.hpp"
-#include "com/sun/star/table/TableBorder.hpp"
-#include "com/sun/star/table/TableOrientation.hpp"
-#include "com/sun/star/task/XInteractionHandler.hpp"
-#include "com/sun/star/task/XStatusIndicator.hpp"
-#include "com/sun/star/task/XStatusIndicatorFactory.hpp"
-#include "com/sun/star/text/CharacterCompressionType.hpp"
-#include "com/sun/star/text/ControlCharacter.hpp"
-#include "com/sun/star/text/FilenameDisplayFormat.hpp"
-#include "com/sun/star/text/FontEmphasis.hpp"
-#include "com/sun/star/text/GraphicCrop.hpp"
-#include "com/sun/star/text/HoriOrientation.hpp"
-#include "com/sun/star/text/RelOrientation.hpp"
-#include "com/sun/star/text/RubyAdjust.hpp"
-#include "com/sun/star/text/TextContentAnchorType.hpp"
-#include "com/sun/star/text/VertOrientation.hpp"
-#include "com/sun/star/text/WrapTextMode.hpp"
-#include "com/sun/star/text/WritingMode.hpp"
-#include "com/sun/star/text/WritingMode2.hpp"
-#include "com/sun/star/text/XDefaultNumberingProvider.hpp"
-#include "com/sun/star/text/XNumberingFormatter.hpp"
-#include "com/sun/star/text/XNumberingTypeInfo.hpp"
-#include "com/sun/star/text/XRubySelection.hpp"
-#include "com/sun/star/text/XSimpleText.hpp"
-#include "com/sun/star/text/XText.hpp"
-#include "com/sun/star/text/XTextContent.hpp"
-#include "com/sun/star/text/XTextCursor.hpp"
-#include "com/sun/star/text/XTextField.hdl"
-#include "com/sun/star/text/XTextField.hpp"
-#include "com/sun/star/text/XTextRange.hpp"
-#include "com/sun/star/text/XTextRangeCompare.hpp"
-#include "com/sun/star/text/XTextRangeMover.hpp"
-#include "com/sun/star/ucb/CommandAbortedException.hpp"
-#include "com/sun/star/ucb/NameClash.hpp"
-#include "com/sun/star/ucb/NumberedSortingInfo.hpp"
-#include "com/sun/star/ucb/TransferInfo.hpp"
-#include "com/sun/star/ucb/XAnyCompare.hpp"
-#include "com/sun/star/ucb/XAnyCompareFactory.hpp"
-#include "com/sun/star/ucb/XCommandEnvironment.hpp"
-#include "com/sun/star/ucb/XContent.hpp"
-#include "com/sun/star/ucb/XContentAccess.hpp"
-#include "com/sun/star/ucb/XContentProvider.hpp"
-#include "com/sun/star/ucb/XSimpleFileAccess.hpp"
-#include "com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp"
-#include "com/sun/star/ui/ImageType.hpp"
-#include "com/sun/star/ui/ItemStyle.hpp"
-#include "com/sun/star/ui/ItemType.hpp"
-#include "com/sun/star/ui/UIElementType.hpp"
-#include "com/sun/star/ui/XImageManager.hpp"
-#include "com/sun/star/ui/XModuleUIConfigurationManager.hpp"
-#include "com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp"
-#include "com/sun/star/ui/XUIConfiguration.hpp"
-#include "com/sun/star/ui/XUIConfigurationListener.hpp"
-#include "com/sun/star/ui/XUIConfigurationManager.hpp"
-#include "com/sun/star/ui/XUIConfigurationManagerSupplier.hpp"
-#include "com/sun/star/ui/XUIConfigurationPersistence.hpp"
-#include "com/sun/star/ui/XUIConfigurationStorage.hpp"
-#include "com/sun/star/ui/XUIElement.hpp"
-#include "com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp"
-#include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp"
-#include "com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp"
-#include "com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp"
-#include "com/sun/star/ui/dialogs/ListboxControlActions.hpp"
-#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
-#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp"
-#include "com/sun/star/ui/dialogs/XFilePicker.hpp"
-#include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp"
-#include "com/sun/star/ui/dialogs/XFilePickerListener.hpp"
-#include "com/sun/star/ui/dialogs/XFilePickerNotifier.hpp"
-#include "com/sun/star/ui/dialogs/XFilePreview.hpp"
-#include "com/sun/star/ui/dialogs/XFilterManager.hpp"
-#include "com/sun/star/ui/dialogs/XFolderPicker.hpp"
-#include "com/sun/star/uno/Any.h"
-#include "com/sun/star/uno/Any.hxx"
-#include "com/sun/star/uno/Exception.hpp"
-#include "com/sun/star/uno/Reference.h"
-#include "com/sun/star/uno/Reference.hxx"
-#include "com/sun/star/uno/RuntimeException.hpp"
-#include "com/sun/star/uno/Sequence.h"
-#include "com/sun/star/uno/Sequence.hxx"
-#include "com/sun/star/uno/Type.h"
-#include "com/sun/star/uno/XAggregation.hpp"
-#include "com/sun/star/uno/XComponentContext.hpp"
-#include "com/sun/star/uno/XInterface.hpp"
-#include "com/sun/star/uno/XNamingService.hpp"
-#include "com/sun/star/util/Date.hpp"
-#include "com/sun/star/util/DateTime.hpp"
-#include "com/sun/star/util/Language.hpp"
-#include "com/sun/star/util/MeasureUnit.hpp"
-#include "com/sun/star/util/NumberFormat.hpp"
-#include "com/sun/star/util/SearchAlgorithms.hpp"
-#include "com/sun/star/util/SearchFlags.hpp"
-#include "com/sun/star/util/SearchOptions.hpp"
-#include "com/sun/star/util/SearchResult.hpp"
-#include "com/sun/star/util/SortField.hpp"
-#include "com/sun/star/util/SortFieldType.hpp"
-#include "com/sun/star/util/URL.hpp"
-#include "com/sun/star/util/XCancellable.hpp"
-#include "com/sun/star/util/XChangesBatch.hpp"
-#include "com/sun/star/util/XCloneable.hpp"
-#include "com/sun/star/util/XCloseable.hpp"
-#include "com/sun/star/util/XFlushable.hpp"
-#include "com/sun/star/util/XLocalizedAliases.hpp"
-#include "com/sun/star/util/XModeChangeBroadcaster.hpp"
-#include "com/sun/star/util/XModeChangeListener.hpp"
-#include "com/sun/star/util/XModeSelector.hpp"
-#include "com/sun/star/util/XModifiable.hpp"
-#include "com/sun/star/util/XModifyBroadcaster.hpp"
-#include "com/sun/star/util/XModifyListener.hpp"
-#include "com/sun/star/util/XNumberFormatTypes.hpp"
-#include "com/sun/star/util/XNumberFormats.hpp"
-#include "com/sun/star/util/XNumberFormatsSupplier.hpp"
-#include "com/sun/star/util/XNumberFormatter.hpp"
-#include "com/sun/star/util/XTextSearch.hpp"
-#include "com/sun/star/util/XURLTransformer.hpp"
-#include "com/sun/star/util/logging/LogLevel.hpp"
-#include "com/sun/star/util/logging/XLogger.hpp"
-#include "com/sun/star/view/XSelectionChangeListener.hpp"
-#include "com/sun/star/view/XSelectionSupplier.hpp"
-#include "com/sun/star/xforms/XFormsSupplier.hpp"
-#include "com/sun/star/xforms/XFormsUIHelper1.hpp"
-#include "com/sun/star/xforms/XModel.hpp"
-#include "com/sun/star/xforms/XSubmission.hpp"
-#include "com/sun/star/xml/AttributeData.hpp"
-#include "com/sun/star/xml/dom/DOMException.hpp"
-#include "com/sun/star/xml/dom/XDocument.hpp"
-#include "com/sun/star/xml/dom/XNode.hpp"
-#include "com/sun/star/xml/dom/events/XEventListener.hpp"
-#include "com/sun/star/xml/dom/events/XEventTarget.hpp"
-#include "com/sun/star/xml/sax/InputSource.hpp"
-#include "com/sun/star/xml/sax/SAXParseException.hpp"
-#include "com/sun/star/xml/sax/XAttributeList.hpp"
-#include "com/sun/star/xml/sax/XDocumentHandler.hpp"
-#include "com/sun/star/xml/sax/XParser.hpp"
-#include "comphelper/accessibleeventnotifier.hxx"
-#include "comphelper/anytostring.hxx"
-#include "comphelper/broadcasthelper.hxx"
-#include "comphelper/componentcontext.hxx"
-#include "comphelper/configurationhelper.hxx"
-#include "comphelper/container.hxx"
-#include "comphelper/embeddedobjectcontainer.hxx"
-#include "comphelper/enumhelper.hxx"
-#include "comphelper/implementationreference.hxx"
-#include "comphelper/interaction.hxx"
-#include "comphelper/numbers.hxx"
-#include "comphelper/processfactory.hxx"
-#include "comphelper/propertycontainer.hxx"
-#include "comphelper/propertysethelper.hxx"
-#include "comphelper/regpathhelper.hxx"
-#include "comphelper/scopeguard.hxx"
-#include "comphelper/seqstream.hxx"
-#include "comphelper/sequence.hxx"
-#include "comphelper/sequenceashashmap.hxx"
-#include "comphelper/sequenceasvector.hxx"
-#include "comphelper/servicehelper.hxx"
-#include "comphelper/storagehelper.hxx"
-#include "comphelper/types.hxx"
-#include "comphelper/uno3.hxx"
-#include "cppuhelper/bootstrap.hxx"
-#include "cppuhelper/compbase12.hxx"
-#include "cppuhelper/compbase2.hxx"
-#include "cppuhelper/compbase3.hxx"
-#include "cppuhelper/compbase4.hxx"
-#include "cppuhelper/compbase6.hxx"
-#include "cppuhelper/compbase7.hxx"
-#include "cppuhelper/component.hxx"
-#include "cppuhelper/component_context.hxx"
-#include "cppuhelper/exc_hlp.hxx"
-#include "cppuhelper/factory.hxx"
-#include "cppuhelper/implbase1.hxx"
-#include "cppuhelper/implbase11.hxx"
-#include "cppuhelper/implbase12.hxx"
-#include "cppuhelper/implbase2.hxx"
-#include "cppuhelper/implbase3.hxx"
-#include "cppuhelper/implbase4.hxx"
-#include "cppuhelper/implbase5.hxx"
-#include "cppuhelper/implbase6.hxx"
-#include "cppuhelper/implbase8.hxx"
-#include "cppuhelper/implementationentry.hxx"
-#include "cppuhelper/interfacecontainer.h"
-#include "cppuhelper/interfacecontainer.hxx"
-#include "cppuhelper/propshlp.hxx"
-#include "cppuhelper/queryinterface.hxx"
-#include "cppuhelper/servicefactory.hxx"
-#include "cppuhelper/typeprovider.hxx"
-#include "cppuhelper/weak.hxx"
-#include "cppuhelper/weakagg.hxx"
-#include "cppuhelper/weakref.hxx"
-#include "i18npool/lang.h"
-#include "i18npool/mslangid.hxx"
-#include "linguistic/lngprops.hxx"
-#include "osl/diagnose.h"
-#include "osl/endian.h"
-#include "osl/file.hxx"
-#include "osl/interlck.h"
-#include "osl/module.h"
-#include "osl/module.hxx"
-#include "osl/mutex.hxx"
-#include "osl/nlsupport.h"
-#include "osl/process.h"
-#include "osl/security.hxx"
-#include "rsc/rscsfx.hxx"
-#include "rtl/bootstrap.hxx"
-#include "rtl/cipher.h"
-#include "rtl/crc.h"
-#include "rtl/digest.h"
-#include "rtl/locale.h"
-#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"
-#include "rtl/ustring.hxx"
-#include "rtl/uuid.h"
-#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"
-#include "sot/factory.hxx"
-#include "sot/formats.hxx"
-#include <map>
-#include <set>
-#include <list>
-#include <vector>
-#include "svtools/FilterConfigItem.hxx"
-#include "svtools/accessibilityoptions.hxx"
-#include "svl/adrparse.hxx"
-#include "svtools/apearcfg.hxx"
-#include "svl/brdcst.hxx"
-#include "unotools/cacheoptions.hxx"
-#include "svl/cjkoptions.hxx"
-#include "unotools/cmdoptions.hxx"
-#include "svl/cntwall.hxx"
-#include "svtools/colorcfg.hxx"
-#include "svl/ctloptions.hxx"
-#include "unotools/defaultoptions.hxx"
-#include "unotools/dynamicmenuoptions.hxx"
-#include "svtools/ehdl.hxx"
-#include "svl/eitem.hxx"
-#include "unotools/eventcfg.hxx"
-#include "unotools/extendedsecurityoptions.hxx"
-#include "svl/filenotation.hxx"
-#include "svl/flagitem.hxx"
-#include "unotools/fltrcfg.hxx"
-#include "unotools/fontoptions.hxx"
-#include "svtools/fontsubstconfig.hxx"
-#include "svtools/helpopt.hxx"
-#include "svl/hint.hxx"
-#include "svtools/htmlkywd.hxx"
-#include "svtools/htmltokn.h"
-#include "svl/intitem.hxx"
-#include "svl/isethint.hxx"
-#include "svl/itemiter.hxx"
-#include "svl/itempool.hxx"
-#include "svl/itemprop.hxx"
-#include "svl/itemset.hxx"
-#include "svl/languageoptions.hxx"
-#include "unotools/lingucfg.hxx"
-#include "unotools/linguprops.hxx"
-#include "svl/lngmisc.hxx"
-#include "svtools/localresaccess.hxx"
-#include "svl/lstner.hxx"
-#include "svl/macitem.hxx"
-#include "svtools/menuoptions.hxx"
-#include "svl/metitem.hxx"
-#include "unotools/misccfg.hxx"
-#include "svtools/miscopt.hxx"
-#include "unotools/moduleoptions.hxx"
-#include "svl/numuno.hxx"
-#include "unotools/optionsdlg.hxx"
-#include "svtools/parhtml.hxx"
-#include "svtools/parrtf.hxx"
-#include "unotools/pathoptions.hxx"
-#include "svl/poolitem.hxx"
-#include "unotools/printwarningoptions.hxx"
-#include "svl/ptitem.hxx"
-#include "svl/rectitem.hxx"
-#include "svl/rngitem.hxx"
-#include "svtools/rtfkeywd.hxx"
-#include "svtools/rtfout.hxx"
-#include "svtools/rtftoken.h"
-#include "unotools/saveopt.hxx"
-#include "unotools/searchopt.hxx"
-#include "unotools/securityoptions.hxx"
-#include "svl/sfontitm.hxx"
-#include "svl/slstitm.hxx"
-#include "svl/smplhint.hxx"
-#include "svtools/soerr.hxx"
-#include "unotools/sourceviewconfig.hxx"
-#include "unotools/startoptions.hxx"
-#include "svtools/stdmenu.hxx"
-#include "svtools/stringtransfer.hxx"
-#include "svl/stritem.hxx"
-#include "svl/style.hxx"
-#include "svl/svarray.hxx"
-#include "svl/svstdarr.hxx"
-#include "unotools/syslocaleoptions.hxx"
-#include "svl/szitem.hxx"
-#include "svtools/textdata.hxx"
-#include "svtools/transfer.hxx"
-#include "svtools/txtcmp.hxx"
-#include "svl/undo.hxx"
-#include "unotools/undoopt.hxx"
-#include "svtools/unoevent.hxx"
-#include "svtools/unoimap.hxx"
-#include "svl/urihelper.hxx"
-#include "svl/urlbmk.hxx"
-#include "unotools/useroptions.hxx"
-#include "unotools/viewoptions.hxx"
-#include "svl/visitem.hxx"
-#include "svl/whiter.hxx"
-#include "sys/stat.h"
-#include "sys/types.h"
-#include "toolkit/awt/vclxdevice.hxx"
-#include "toolkit/controls/unocontrol.hxx"
-#include "tools/bigint.hxx"
-#include "tools/color.hxx"
-#include "tools/config.hxx"
-#include "tools/contnr.hxx"
-#include "tools/debug.hxx"
-#include "tools/diagnose_ex.h"
-#include "tools/dynary.hxx"
-#include "tools/errcode.hxx"
-#include "tools/errinf.hxx"
-#include "tools/fract.hxx"
-#include "tools/gen.hxx"
-#include "tools/globname.hxx"
-#include "tools/inetdef.hxx"
-#include "tools/line.hxx"
-#include "tools/link.hxx"
-#include "tools/multisel.hxx"
-#include "tools/poly.hxx"
-#include "tools/rc.h"
-#include "tools/rc.hxx"
-#include "tools/rcid.h"
-#include "tools/ref.hxx"
-#include "tools/resary.hxx"
-#include "tools/resid.hxx"
-#include "tools/resmgr.hxx"
-#include "tools/rtti.hxx"
-#include "tools/shl.hxx"
-#include "tools/solar.h"
-#include "tools/stack.hxx"
-#include "tools/string.hxx"
-#include "tools/table.hxx"
-#include "tools/tenccvt.hxx"
-#include "tools/urlobj.hxx"
-#include "tools/vcompat.hxx"
-#include "tools/vector2d.hxx"
-#include "tools/weakbase.hxx"
-#include "tools/wldcrd.hxx"
-#include "tools/zcodec.hxx"
-#include "ucbhelper/commandenvironment.hxx"
-#include "ucbhelper/configurationkeys.hxx"
-#include "ucbhelper/content.hxx"
-#include "ucbhelper/contentbroker.hxx"
-#include "unicode/ubidi.h"
-#include "uno/lbnames.h"
-#include "uno/mapping.hxx"
-#include "unotools/accessiblerelationsethelper.hxx"
-#include "unotools/accessiblestatesethelper.hxx"
-#include "unotools/bootstrap.hxx"
-#include "unotools/charclass.hxx"
-#include "unotools/collatorwrapper.hxx"
-#include "unotools/configitem.hxx"
-#include "unotools/configmgr.hxx"
-#include "unotools/confignode.hxx"
-#include "unotools/configpathes.hxx"
-#include "unotools/configvaluecontainer.hxx"
-#include "unotools/localfilehelper.hxx"
-#include "unotools/processfactory.hxx"
-#include "comphelper/servicehelper.hxx"
-#include "unotools/streamwrap.hxx"
-#include "unotools/textsearch.hxx"
-#include "unotools/transliterationwrapper.hxx"
-#include "unotools/ucbhelper.hxx"
-#include "vcl/abstdlg.hxx"
-#include "vcl/animate.hxx"
-#include "vcl/bitmap.hxx"
-#include "vcl/bitmapex.hxx"
-#include "vcl/bmpacc.hxx"
-#include "vcl/cmdevt.h"
-#include "vcl/configsettings.hxx"
-#include "vcl/controllayout.hxx"
-#include "vcl/cursor.hxx"
-#include "vcl/decoview.hxx"
-#include "vcl/dndhelp.hxx"
-#include "tools/fldunit.hxx"
-#include "vcl/fntstyle.hxx"
-#include "unotools/fontcvt.hxx"
-#include "vcl/gdimtf.hxx"
-#include "vcl/help.hxx"
-#include "vcl/image.hxx"
-#include "vcl/jobset.hxx"
-#include "vcl/keycodes.hxx"
-#include "vcl/mapmod.hxx"
-#include "vcl/menu.hxx"
-#include "vcl/mnemonic.hxx"
-#include "vcl/pointr.hxx"
-#include "vcl/region.hxx"
-#include "vcl/salbtype.hxx"
-#include "vcl/stdtext.hxx"
-#include "vcl/timer.hxx"
-#include "vcl/unohelp.hxx"
-#include "vcl/unohelp2.hxx"
-#include "vcl/wall.hxx"
-#include "tools/wintypes.hxx"
-#include "xmloff/DashStyle.hxx"
-#include "xmloff/GradientStyle.hxx"
-#include "xmloff/HatchStyle.hxx"
-#include "xmloff/ImageStyle.hxx"
-#include "xmloff/MarkerStyle.hxx"
-#include "xmloff/attrlist.hxx"
-#include "xmloff/nmspmap.hxx"
-#include "xmloff/xmlcnimp.hxx"
-#include "xmloff/xmlictxt.hxx"
-#include "xmloff/xmlnmspe.hxx"
-#include "xmloff/xmlstyle.hxx"
-#include "xmloff/xmltoken.hxx"
-//---MARKER---
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/prj/build.lst b/editeng/prj/build.lst
deleted file mode 100644
index 7d6afc7975..0000000000
--- a/editeng/prj/build.lst
+++ /dev/null
@@ -1,2 +0,0 @@
-ed editeng : TRANSLATIONS:translations svtools xmloff linguistic NULL
-ed editeng\prj nmake - all ed_prj NULL
diff --git a/editeng/prj/d.lst b/editeng/prj/d.lst
deleted file mode 100644
index e69de29bb2..0000000000
--- a/editeng/prj/d.lst
+++ /dev/null
diff --git a/editeng/prj/makefile.mk b/editeng/prj/makefile.mk
deleted file mode 100755
index e312a7ccab..0000000000
--- a/editeng/prj/makefile.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..
-TARGET=prj
-
-.INCLUDE : settings.mk
-
-.IF "$(VERBOSE)"!=""
-VERBOSEFLAG :=
-.ELSE
-VERBOSEFLAG := -s
-.ENDIF
-
-all:
- cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) && $(GNUMAKE) $(VERBOSEFLAG) -r deliverlog
diff --git a/editeng/qa/items/borderline_test.cxx b/editeng/qa/items/borderline_test.cxx
deleted file mode 100644
index 5d67b62f82..0000000000
--- a/editeng/qa/items/borderline_test.cxx
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- 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
deleted file mode 100644
index 181e048592..0000000000
--- a/editeng/source/accessibility/AccessibleComponentBase.cxx
+++ /dev/null
@@ -1,240 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-
-#include <editeng/AccessibleComponentBase.hxx>
-
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/drawing/XShapeDescriptor.hpp>
-#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-
-#include <tools/color.hxx>
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::accessibility;
-
-namespace accessibility {
-
-//===== internal ============================================================
-
-AccessibleComponentBase::AccessibleComponentBase (void)
-{
-}
-
-
-
-
-AccessibleComponentBase::~AccessibleComponentBase (void)
-{
-}
-
-
-
-
-//===== XAccessibleComponent ================================================
-
-sal_Bool SAL_CALL AccessibleComponentBase::containsPoint (
- const ::com::sun::star::awt::Point& aPoint)
- throw (::com::sun::star::uno::RuntimeException)
-{
- awt::Size aSize (getSize());
- return (aPoint.X >= 0)
- && (aPoint.X < aSize.Width)
- && (aPoint.Y >= 0)
- && (aPoint.Y < aSize.Height);
-}
-
-
-
-
-uno::Reference<XAccessible > SAL_CALL
- AccessibleComponentBase::getAccessibleAtPoint (
- const awt::Point& /*aPoint*/)
- throw (uno::RuntimeException)
-{
- return uno::Reference<XAccessible>();
-}
-
-
-
-
-awt::Rectangle SAL_CALL AccessibleComponentBase::getBounds (void)
- throw (uno::RuntimeException)
-{
- return awt::Rectangle();
-}
-
-
-
-
-awt::Point SAL_CALL AccessibleComponentBase::getLocation (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- awt::Rectangle aBBox (getBounds());
- return awt::Point (aBBox.X, aBBox.Y);
-}
-
-
-
-
-awt::Point SAL_CALL AccessibleComponentBase::getLocationOnScreen (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- return awt::Point();
-}
-
-
-
-
-::com::sun::star::awt::Size SAL_CALL AccessibleComponentBase::getSize (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- awt::Rectangle aBBox (getBounds());
- return awt::Size (aBBox.Width, aBBox.Height);
-}
-
-
-
-
-void SAL_CALL AccessibleComponentBase::addFocusListener (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::awt::XFocusListener >& /*xListener*/)
- throw (::com::sun::star::uno::RuntimeException)
-{
- // Ignored
-}
-
-
-
-
-void SAL_CALL AccessibleComponentBase::removeFocusListener (const ::com::sun::star::uno::Reference<
- ::com::sun::star::awt::XFocusListener >& /*xListener*/ )
- throw (::com::sun::star::uno::RuntimeException)
-{
- // Ignored
-}
-
-
-
-
-void SAL_CALL AccessibleComponentBase::grabFocus (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- uno::Reference<XAccessibleContext> xContext (this, uno::UNO_QUERY);
- uno::Reference<XAccessibleSelection> xSelection (
- xContext->getAccessibleParent(), uno::UNO_QUERY);
- if (xSelection.is())
- {
- // Do a single selection on this object.
- xSelection->clearAccessibleSelection();
- xSelection->selectAccessibleChild (xContext->getAccessibleIndexInParent());
- }
-}
-
-
-
-
-sal_Int32 SAL_CALL AccessibleComponentBase::getForeground (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- return Color(COL_BLACK).GetColor();
-}
-
-
-
-
-sal_Int32 SAL_CALL AccessibleComponentBase::getBackground (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- return Color(COL_WHITE).GetColor();
-}
-
-
-
-
-//===== XAccessibleExtendedComponent ========================================
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL
- AccessibleComponentBase::getFont (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- return uno::Reference<awt::XFont>();
-}
-
-
-
-
-::rtl::OUString SAL_CALL AccessibleComponentBase::getTitledBorderText (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString ();
-}
-
-
-
-
-::rtl::OUString SAL_CALL AccessibleComponentBase::getToolTipText (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString ();
-}
-
-
-
-
-//===== XTypeProvider ===================================================
-
-uno::Sequence<uno::Type> SAL_CALL
- AccessibleComponentBase::getTypes (void)
- throw (uno::RuntimeException)
-{
- // Get list of types from the context base implementation...
- uno::Sequence<uno::Type> aTypeList (2);
- // ...and add the additional type for the component.
- const uno::Type aComponentType =
- ::getCppuType((const uno::Reference<XAccessibleComponent>*)0);
- const uno::Type aExtendedComponentType =
- ::getCppuType((const uno::Reference<XAccessibleExtendedComponent>*)0);
- aTypeList[0] = aComponentType;
- aTypeList[1] = aExtendedComponentType;
-
- return aTypeList;
-}
-
-
-} // 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
deleted file mode 100644
index 0c6e470d70..0000000000
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ /dev/null
@@ -1,708 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-
-#include <editeng/AccessibleContextBase.hxx>
-
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/beans/PropertyChangeEvent.hpp>
-#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
-
-#include <unotools/accessiblestatesethelper.hxx>
-#include <unotools/accessiblerelationsethelper.hxx>
-#include <comphelper/accessibleeventnotifier.hxx>
-#include <comphelper/servicehelper.hxx>
-#include <osl/mutex.hxx>
-
-#include <utility>
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::accessibility;
-using ::com::sun::star::uno::Reference;
-
-namespace accessibility {
-
-//===== internal ============================================================
-
-// Define a shortcut for the somewhot longish base class name.
-typedef ::cppu::PartialWeakComponentImplHelper4<
- ::com::sun::star::accessibility::XAccessible,
- ::com::sun::star::accessibility::XAccessibleContext,
- ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
- ::com::sun::star::lang::XServiceInfo> BaseClass;
-
-AccessibleContextBase::AccessibleContextBase (
- const uno::Reference<XAccessible>& rxParent,
- const sal_Int16 aRole)
- : BaseClass (MutexOwner::maMutex),
- mxStateSet (NULL),
- mxRelationSet (NULL),
- mxParent(rxParent),
- msDescription(),
- meDescriptionOrigin(NotSet),
- msName(),
- meNameOrigin(NotSet),
- mnClientId(0),
- maRole(aRole)
-{
- // Create the state set.
- ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper ();
- mxStateSet = pStateSet;
-
- // Set some states. Don't use the SetState method because no events
- // shall be broadcastet (that is not yet initialized anyway).
- if (pStateSet != NULL)
- {
- pStateSet->AddState (AccessibleStateType::ENABLED);
- pStateSet->AddState (AccessibleStateType::SENSITIVE);
- pStateSet->AddState (AccessibleStateType::SHOWING);
- pStateSet->AddState (AccessibleStateType::VISIBLE);
- pStateSet->AddState (AccessibleStateType::FOCUSABLE);
- pStateSet->AddState (AccessibleStateType::SELECTABLE);
- }
-
- // Create the relation set.
- ::utl::AccessibleRelationSetHelper* pRelationSet = new ::utl::AccessibleRelationSetHelper ();
- mxRelationSet = pRelationSet;
-}
-
-
-
-
-AccessibleContextBase::~AccessibleContextBase(void)
-{
-}
-
-
-
-
-sal_Bool AccessibleContextBase::SetState (sal_Int16 aState)
-{
- ::osl::ClearableMutexGuard aGuard (maMutex);
- ::utl::AccessibleStateSetHelper* pStateSet =
- static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
- if ((pStateSet != NULL) && !pStateSet->contains(aState))
- {
- pStateSet->AddState (aState);
- // Clear the mutex guard so that it is not locked during calls to
- // listeners.
- aGuard.clear();
-
- // Send event for all states except the DEFUNC state.
- if (aState != AccessibleStateType::DEFUNC)
- {
- uno::Any aNewValue;
- aNewValue <<= aState;
- CommitChange(
- AccessibleEventId::STATE_CHANGED,
- aNewValue,
- uno::Any());
- }
- return sal_True;
- }
- else
- return sal_False;
-}
-
-
-
-
-sal_Bool AccessibleContextBase::ResetState (sal_Int16 aState)
-{
- ::osl::ClearableMutexGuard aGuard (maMutex);
- ::utl::AccessibleStateSetHelper* pStateSet =
- static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
- if ((pStateSet != NULL) && pStateSet->contains(aState))
- {
- pStateSet->RemoveState (aState);
- // Clear the mutex guard so that it is not locked during calls to listeners.
- aGuard.clear();
-
- uno::Any aOldValue;
- aOldValue <<= aState;
- CommitChange(
- AccessibleEventId::STATE_CHANGED,
- uno::Any(),
- aOldValue);
- return sal_True;
- }
- else
- return sal_False;
-}
-
-
-
-
-sal_Bool AccessibleContextBase::GetState (sal_Int16 aState)
-{
- ::osl::MutexGuard aGuard (maMutex);
- ::utl::AccessibleStateSetHelper* pStateSet =
- static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
- if (pStateSet != NULL)
- return pStateSet->contains(aState);
- else
- // If there is no state set then return false as a default value.
- return sal_False;
-}
-
-
-
-
-void AccessibleContextBase::SetRelationSet (
- const uno::Reference<XAccessibleRelationSet>& rxNewRelationSet)
- throw (::com::sun::star::uno::RuntimeException)
-{
- OSL_TRACE ("setting relation set");
-
- // Try to emit some meaningfull events indicating differing relations in
- // both sets.
- typedef std::pair<short int,short int> RD;
- const RD aRelationDescriptors[] = {
- RD(AccessibleRelationType::CONTROLLED_BY, AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED),
- RD(AccessibleRelationType::CONTROLLER_FOR, AccessibleEventId::CONTROLLER_FOR_RELATION_CHANGED),
- RD(AccessibleRelationType::LABELED_BY, AccessibleEventId::LABELED_BY_RELATION_CHANGED),
- RD(AccessibleRelationType::LABEL_FOR, AccessibleEventId::LABEL_FOR_RELATION_CHANGED),
- RD(AccessibleRelationType::MEMBER_OF, AccessibleEventId::MEMBER_OF_RELATION_CHANGED),
- RD(AccessibleRelationType::INVALID, -1),
- };
- for (int i=0; aRelationDescriptors[i].first!=AccessibleRelationType::INVALID; i++)
- if (mxRelationSet->containsRelation(aRelationDescriptors[i].first)
- != rxNewRelationSet->containsRelation(aRelationDescriptors[i].first))
- CommitChange (aRelationDescriptors[i].second, uno::Any(), uno::Any());
-
- mxRelationSet = rxNewRelationSet;
-}
-
-
-
-
-//===== XAccessible =========================================================
-
-uno::Reference< XAccessibleContext> SAL_CALL
- AccessibleContextBase::getAccessibleContext (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed ();
- return this;
-}
-
-
-
-
-//===== XAccessibleContext ==================================================
-
-/** No children.
-*/
-sal_Int32 SAL_CALL
- AccessibleContextBase::getAccessibleChildCount (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed ();
- return 0;
-}
-
-
-
-
-/** Forward the request to the shape. Return the requested shape or throw
- an exception for a wrong index.
-*/
-uno::Reference<XAccessible> SAL_CALL
- AccessibleContextBase::getAccessibleChild (sal_Int32 nIndex)
- throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
- throw lang::IndexOutOfBoundsException (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("no child with index ") + nIndex),
- NULL);
-}
-
-
-
-
-uno::Reference<XAccessible> SAL_CALL
- AccessibleContextBase::getAccessibleParent (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
- return mxParent;
-}
-
-
-
-
-sal_Int32 SAL_CALL
- AccessibleContextBase::getAccessibleIndexInParent (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
- // Use a simple but slow solution for now. Optimize later.
-
- // Iterate over all the parent's children and search for this object.
- if (mxParent.is())
- {
- uno::Reference<XAccessibleContext> xParentContext (
- mxParent->getAccessibleContext());
- if (xParentContext.is())
- {
- sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
- for (sal_Int32 i=0; i<nChildCount; i++)
- {
- uno::Reference<XAccessible> xChild (xParentContext->getAccessibleChild (i));
- if (xChild.is())
- {
- uno::Reference<XAccessibleContext> xChildContext = xChild->getAccessibleContext();
- if (xChildContext == (XAccessibleContext*)this)
- return i;
- }
- }
- }
- }
-
- // Return -1 to indicate that this object's parent does not know about the
- // object.
- return -1;
-}
-
-
-
-
-sal_Int16 SAL_CALL
- AccessibleContextBase::getAccessibleRole (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
- return maRole;
-}
-
-
-
-
-::rtl::OUString SAL_CALL
- AccessibleContextBase::getAccessibleDescription (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
-
- return msDescription;
-}
-
-
-
-
-OUString SAL_CALL
- AccessibleContextBase::getAccessibleName (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
-
- if (meNameOrigin == NotSet)
- {
- // Do not send an event because this is the first time it has been
- // requested.
- msName = CreateAccessibleName();
- meNameOrigin = AutomaticallyCreated;
- }
-
- return msName;
-}
-
-
-
-
-/** Return a copy of the relation set.
-*/
-uno::Reference<XAccessibleRelationSet> SAL_CALL
- AccessibleContextBase::getAccessibleRelationSet (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
-
- // Create a copy of the relation set and return it.
- ::utl::AccessibleRelationSetHelper* pRelationSet =
- static_cast< ::utl::AccessibleRelationSetHelper*>(mxRelationSet.get());
- if (pRelationSet != NULL)
- {
- return uno::Reference<XAccessibleRelationSet> (
- new ::utl::AccessibleRelationSetHelper (*pRelationSet));
- }
- else
- return uno::Reference<XAccessibleRelationSet>(NULL);
-}
-
-
-
-
-/** Return a copy of the state set.
- Possible states are:
- ENABLED
- SHOWING
- VISIBLE
-*/
-uno::Reference<XAccessibleStateSet> SAL_CALL
- AccessibleContextBase::getAccessibleStateSet (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ::utl::AccessibleStateSetHelper* pStateSet = NULL;
-
- if (rBHelper.bDisposed)
- {
- // We are already disposed!
- // Create a new state set that has only set the DEFUNC state.
- pStateSet = new ::utl::AccessibleStateSetHelper ();
- if (pStateSet != NULL)
- pStateSet->AddState (AccessibleStateType::DEFUNC);
- }
- else
- {
- // Create a copy of the state set and return it.
- pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
-
- // Merge current focused state from edit engine.
-#if 0
- if (aState == AccessibleStateType::FOCUSED
- && pStateSet != NULL
- && mpText != NULL)
- {
- if (mpText->GetFocusedState ())
- pStateSet->AddState (aState);
- else
- pStateSet->RemoveState (aState);
- }
-#endif
- if (pStateSet != NULL)
- pStateSet = new ::utl::AccessibleStateSetHelper (*pStateSet);
- }
-
- return uno::Reference<XAccessibleStateSet>(pStateSet);
-}
-
-
-
-
-lang::Locale SAL_CALL
- AccessibleContextBase::getLocale (void)
- throw (IllegalAccessibleComponentStateException,
- ::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
- // Delegate request to parent.
- if (mxParent.is())
- {
- uno::Reference<XAccessibleContext> xParentContext (
- mxParent->getAccessibleContext());
- if (xParentContext.is())
- return xParentContext->getLocale ();
- }
-
- // No locale and no parent. Therefore throw exception to indicate this
- // cluelessness.
- throw IllegalAccessibleComponentStateException ();
-}
-
-
-
-
-//===== XAccessibleEventListener ============================================
-
-void SAL_CALL
- AccessibleContextBase::addEventListener (
- const uno::Reference<XAccessibleEventListener >& rxListener)
- throw (uno::RuntimeException)
-{
- if (rxListener.is())
- {
- if (rBHelper.bDisposed || rBHelper.bInDispose)
- {
- uno::Reference<uno::XInterface> x ((lang::XComponent *)this, uno::UNO_QUERY);
- rxListener->disposing (lang::EventObject (x));
- }
- else
- {
- if (!mnClientId)
- mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
- comphelper::AccessibleEventNotifier::addEventListener( mnClientId, rxListener );
- }
- }
-}
-
-
-
-
-void SAL_CALL
- AccessibleContextBase::removeEventListener (
- const uno::Reference<XAccessibleEventListener >& rxListener )
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed ();
- if (rxListener.is())
- {
- sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
- if ( !nListenerCount )
- {
- // no listeners anymore
- // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
- // and at least to us not firing any events anymore, in case somebody calls
- // NotifyAccessibleEvent, again
- comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
- mnClientId = 0;
- }
- }
-}
-
-
-
-
-//===== XServiceInfo ========================================================
-
-::rtl::OUString SAL_CALL
- AccessibleContextBase::getImplementationName (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
- return OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleContextBase"));
-}
-
-
-
-
-sal_Bool SAL_CALL
- AccessibleContextBase::supportsService (const OUString& sServiceName)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
- // Iterate over all supported service names and return true if on of them
- // matches the given name.
- uno::Sequence< ::rtl::OUString> aSupportedServices (
- getSupportedServiceNames ());
- for (int i=0; i<aSupportedServices.getLength(); i++)
- if (sServiceName == aSupportedServices[i])
- return sal_True;
- return sal_False;
-}
-
-
-
-
-uno::Sequence< ::rtl::OUString> SAL_CALL
- AccessibleContextBase::getSupportedServiceNames (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
- static const OUString sServiceNames[2] = {
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.accessibility.Accessible")),
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.accessibility.AccessibleContext"))
- };
- return uno::Sequence<OUString> (sServiceNames, 2);
-}
-
-
-
-
-//===== XTypeProvider =======================================================
-
-uno::Sequence< ::com::sun::star::uno::Type>
- AccessibleContextBase::getTypes (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
-
- // This class supports no interfaces on its own. Just return those
- // supported by the base class.
- 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)
-{
- return theAccessibleContextBaseImplementationId::get().getSeq();
-}
-
-//===== internal ============================================================
-
-void SAL_CALL AccessibleContextBase::disposing (void)
-{
- SetState (AccessibleStateType::DEFUNC);
-
- ::osl::MutexGuard aGuard (maMutex);
-
- // Send a disposing to all listeners.
- if ( mnClientId )
- {
- comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
- mnClientId = 0;
- }
-}
-
-
-
-
-void AccessibleContextBase::SetAccessibleDescription (
- const ::rtl::OUString& rDescription,
- StringOrigin eDescriptionOrigin)
- throw (uno::RuntimeException)
-{
- if (eDescriptionOrigin < meDescriptionOrigin
- || (eDescriptionOrigin == meDescriptionOrigin && msDescription != rDescription))
- {
- uno::Any aOldValue, aNewValue;
- aOldValue <<= msDescription;
- aNewValue <<= rDescription;
-
- msDescription = rDescription;
- meDescriptionOrigin = eDescriptionOrigin;
-
- CommitChange(
- AccessibleEventId::DESCRIPTION_CHANGED,
- aNewValue,
- aOldValue);
- }
-}
-
-
-
-
-void AccessibleContextBase::SetAccessibleName (
- const ::rtl::OUString& rName,
- StringOrigin eNameOrigin)
- throw (uno::RuntimeException)
-{
- if (eNameOrigin < meNameOrigin
- || (eNameOrigin == meNameOrigin && msName != rName))
- {
- uno::Any aOldValue, aNewValue;
- aOldValue <<= msName;
- aNewValue <<= rName;
-
- msName = rName;
- meNameOrigin = eNameOrigin;
-
- CommitChange(
- AccessibleEventId::NAME_CHANGED,
- aNewValue,
- aOldValue);
- }
-}
-
-
-
-
-::rtl::OUString AccessibleContextBase::CreateAccessibleDescription (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("Empty Description"));
-}
-
-
-
-
-::rtl::OUString AccessibleContextBase::CreateAccessibleName (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("Empty Name"));
-}
-
-
-
-
-void AccessibleContextBase::CommitChange (
- sal_Int16 nEventId,
- const uno::Any& rNewValue,
- const uno::Any& rOldValue)
-{
- // Do not call FireEvent and do not even create the event object when no
- // listener has been registered yet. Creating the event object can
- // otherwise lead to a crash. See issue 93419 for details.
- if (mnClientId != 0)
- {
- AccessibleEventObject aEvent (
- static_cast<XAccessibleContext*>(this),
- nEventId,
- rNewValue,
- rOldValue);
-
- FireEvent (aEvent);
- }
-}
-
-
-
-
-void AccessibleContextBase::FireEvent (const AccessibleEventObject& aEvent)
-{
- if (mnClientId)
- comphelper::AccessibleEventNotifier::addEvent( mnClientId, aEvent );
-}
-
-
-
-
-void AccessibleContextBase::ThrowIfDisposed (void)
- throw (::com::sun::star::lang::DisposedException)
-{
- if (rBHelper.bDisposed || rBHelper.bInDispose)
- {
- OSL_TRACE ("Calling disposed object. Throwing exception:");
- throw lang::DisposedException (
- OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")),
- static_cast<uno::XWeak*>(this));
- }
-}
-
-
-
-sal_Bool AccessibleContextBase::IsDisposed (void)
-{
- return (rBHelper.bDisposed || rBHelper.bInDispose);
-}
-
-
-
-void AccessibleContextBase::SetAccessibleRole( sal_Int16 _nRole )
-{
- maRole = _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
deleted file mode 100644
index 131e1b8af9..0000000000
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ /dev/null
@@ -1,2305 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-//------------------------------------------------------------------------
-//
-// Global header
-//
-//------------------------------------------------------------------------
-
-#include <limits.h>
-#include <vector>
-#include <algorithm>
-#include <osl/mutex.hxx>
-#include <vcl/window.hxx>
-#include <vcl/svapp.hxx>
-#include <editeng/flditem.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/awt/Point.hpp>
-#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/accessibility/AccessibleTextType.hpp>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-#include <comphelper/accessibleeventnotifier.hxx>
-#include <comphelper/sequenceashashmap.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
-#include <unotools/accessiblerelationsethelper.hxx>
-#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
-#include <vcl/unohelp.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/unoprnms.hxx>
-#include <editeng/unoipset.hxx>
-#include <editeng/outliner.hxx>
-
-//------------------------------------------------------------------------
-//
-// Project-local header
-//
-//------------------------------------------------------------------------
-
-#include <com/sun/star/beans/PropertyState.hpp>
-
-//!!!#include <svx/unoshape.hxx>
-//!!!#include <svx/dialmgr.hxx>
-//!!!#include "accessibility.hrc"
-
-#include <editeng/unolingu.hxx>
-#include <editeng/unopracc.hxx>
-#include "editeng/AccessibleEditableTextPara.hxx"
-#include "AccessibleHyperlink.hxx"
-
-#include <svtools/colorcfg.hxx>
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::accessibility;
-
-
-//------------------------------------------------------------------------
-//
-// AccessibleEditableTextPara implementation
-//
-//------------------------------------------------------------------------
-
-namespace accessibility
-{
-
- const SvxItemPropertySet* ImplGetSvxCharAndParaPropertiesSet()
- {
- // PropertyMap for character and paragraph properties
- static const SfxItemPropertyMapEntry aPropMap[] =
- {
- SVX_UNOEDIT_CHAR_PROPERTIES,
- SVX_UNOEDIT_PARA_PROPERTIES,
- SVX_UNOEDIT_NUMBERING_PROPERTIE,
- {MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
- {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
- {0,0,0,0,0,0}
- };
- static SvxItemPropertySet aPropSet( aPropMap, EditEngine::GetGlobalItemPool() );
- return &aPropSet;
- }
-
-
- DBG_NAME( AccessibleEditableTextPara )
-
- // #i27138# - add parameter <_pParaManager>
- AccessibleEditableTextPara::AccessibleEditableTextPara(
- const uno::Reference< XAccessible >& rParent,
- const AccessibleParaManager* _pParaManager )
- : AccessibleTextParaInterfaceBase( m_aMutex ),
- mnParagraphIndex( 0 ),
- mnIndexInParent( 0 ),
- mpEditSource( NULL ),
- maEEOffset( 0, 0 ),
- mxParent( rParent ),
- // well, that's strictly (UNO) exception safe, though not
- // really robust. We rely on the fact that this member is
- // constructed last, and that the constructor body catches
- // exceptions, thus no chance for exceptions once the Id is
- // fetched. Nevertheless, normally should employ RAII here...
- mnNotifierClientId(::comphelper::AccessibleEventNotifier::registerClient()),
- // #i27138#
- mpParaManager( _pParaManager )
- {
-#ifdef DBG_UTIL
- DBG_CTOR( AccessibleEditableTextPara, NULL );
- OSL_TRACE( "AccessibleEditableTextPara received ID: %d\n", mnNotifierClientId );
-#endif
-
- try
- {
- // Create the state set.
- ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper ();
- mxStateSet = pStateSet;
-
- // these are always on
- pStateSet->AddState( AccessibleStateType::MULTI_LINE );
- pStateSet->AddState( AccessibleStateType::FOCUSABLE );
- pStateSet->AddState( AccessibleStateType::VISIBLE );
- pStateSet->AddState( AccessibleStateType::SHOWING );
- pStateSet->AddState( AccessibleStateType::ENABLED );
- pStateSet->AddState( AccessibleStateType::SENSITIVE );
- }
- catch (const uno::Exception&)
- {
- }
- }
-
- AccessibleEditableTextPara::~AccessibleEditableTextPara()
- {
- DBG_DTOR( AccessibleEditableTextPara, NULL );
-
- // sign off from event notifier
- if( getNotifierClientId() != -1 )
- {
- try
- {
- ::comphelper::AccessibleEventNotifier::revokeClient( getNotifierClientId() );
-#ifdef DBG_UTIL
- OSL_TRACE( "AccessibleEditableTextPara revoked ID: %d\n", mnNotifierClientId );
-#endif
- }
- catch (const uno::Exception&)
- {
- }
- }
- }
-
- ::rtl::OUString AccessibleEditableTextPara::implGetText()
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return GetTextRange( 0, GetTextLen() );
- }
-
- ::com::sun::star::lang::Locale AccessibleEditableTextPara::implGetLocale()
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- lang::Locale aLocale;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getLocale: paragraph index value overflow");
-
- // return locale of first character in the paragraph
- return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< sal_uInt16 >( GetParagraphIndex() ), 0 ));
- }
-
- void AccessibleEditableTextPara::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- sal_uInt16 nStart, nEnd;
-
- if( GetSelection( nStart, nEnd ) )
- {
- nStartIndex = nStart;
- nEndIndex = nEnd;
- }
- else
- {
- // #102234# No exception, just set to 'invalid'
- nStartIndex = -1;
- nEndIndex = -1;
- }
- }
-
- void AccessibleEditableTextPara::implGetParagraphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 /*nIndex*/ )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
- DBG_WARNING( "AccessibleEditableTextPara::implGetParagraphBoundary: only a base implementation, ignoring the index" );
-
- rBoundary.startPos = 0;
- rBoundary.endPos = GetTextLen();
- }
-
- void AccessibleEditableTextPara::implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SvxTextForwarder& rCacheTF = GetTextForwarder();
- const sal_Int32 nParaIndex = GetParagraphIndex();
-
- DBG_ASSERT(nParaIndex >= 0 && nParaIndex <= USHRT_MAX,
- "AccessibleEditableTextPara::implGetLineBoundary: paragraph index value overflow");
-
- const sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< sal_uInt16 >( nParaIndex ) );
-
- CheckPosition(nIndex);
-
- rBoundary.startPos = rBoundary.endPos = -1;
-
- const sal_uInt16 nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) );
-
- if( nIndex == nTextLen )
- {
- // #i17014# Special-casing one-behind-the-end character
- if( nLineCount <= 1 )
- rBoundary.startPos = 0;
- else
- rBoundary.startPos = nTextLen - rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ),
- nLineCount-1 );
-
- rBoundary.endPos = nTextLen;
- }
- else
- {
- // normal line search
- sal_uInt16 nLine;
- sal_Int32 nCurIndex;
- for( nLine=0, nCurIndex=0; nLine<nLineCount; ++nLine )
- {
- nCurIndex += rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLine);
-
- if( nCurIndex > nIndex )
- {
- rBoundary.startPos = nCurIndex - rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine);
- rBoundary.endPos = nCurIndex;
- break;
- }
- }
- }
- }
-
- int AccessibleEditableTextPara::getNotifierClientId() const
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return mnNotifierClientId;
- }
-
- void AccessibleEditableTextPara::SetIndexInParent( sal_Int32 nIndex )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- mnIndexInParent = nIndex;
- }
-
- sal_Int32 AccessibleEditableTextPara::GetIndexInParent() const
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return mnIndexInParent;
- }
-
- void AccessibleEditableTextPara::SetParagraphIndex( sal_Int32 nIndex )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- sal_Int32 nOldIndex = mnParagraphIndex;
-
- mnParagraphIndex = nIndex;
-
- WeakBullet::HardRefType aChild( maImageBullet.get() );
- if( aChild.is() )
- aChild->SetParagraphIndex(mnParagraphIndex);
-
- try
- {
- if( nOldIndex != nIndex )
- {
- uno::Any aOldDesc;
- uno::Any aOldName;
-
- try
- {
- aOldDesc <<= getAccessibleDescription();
- aOldName <<= getAccessibleName();
- }
- catch (const uno::Exception&) // optional behaviour
- {
- }
- // index and therefore description changed
- FireEvent( AccessibleEventId::DESCRIPTION_CHANGED, uno::makeAny( getAccessibleDescription() ), aOldDesc );
- FireEvent( AccessibleEventId::NAME_CHANGED, uno::makeAny( getAccessibleName() ), aOldName );
- }
- }
- catch (const uno::Exception&) // optional behaviour
- {
- }
- }
-
- sal_Int32 AccessibleEditableTextPara::GetParagraphIndex() const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return mnParagraphIndex;
- }
-
- void AccessibleEditableTextPara::Dispose()
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- int nClientId( getNotifierClientId() );
-
- // #108212# drop all references before notifying dispose
- mxParent = NULL;
- mnNotifierClientId = -1;
- mpEditSource = NULL;
-
- // notify listeners
- if( nClientId != -1 )
- {
- try
- {
- uno::Reference < XAccessibleContext > xThis = getAccessibleContext();
-
- // #106234# Delegate to EventNotifier
- ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, xThis );
-#ifdef DBG_UTIL
- OSL_TRACE( "Disposed ID: %d\n", nClientId );
-#endif
- }
- catch (const uno::Exception&)
- {
- }
- }
- }
-
- void AccessibleEditableTextPara::SetEditSource( SvxEditSourceAdapter* pEditSource )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- mpEditSource = pEditSource;
-
- WeakBullet::HardRefType aChild( maImageBullet.get() );
- if( aChild.is() )
- aChild->SetEditSource(pEditSource);
-
- if( !mpEditSource )
- {
- // going defunc
- UnSetState( AccessibleStateType::SHOWING );
- UnSetState( AccessibleStateType::VISIBLE );
- SetState( AccessibleStateType::INVALID );
- SetState( AccessibleStateType::DEFUNC );
-
- Dispose();
- }
-
- // #108900# Init last text content
- try
- {
- TextChanged();
- }
- catch (const uno::RuntimeException&)
- {
- }
- }
-
- ESelection AccessibleEditableTextPara::MakeSelection( sal_Int32 nStartEEIndex, sal_Int32 nEndEEIndex )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- // check overflow
- DBG_ASSERT(nStartEEIndex >= 0 && nStartEEIndex <= USHRT_MAX &&
- nEndEEIndex >= 0 && nEndEEIndex <= USHRT_MAX &&
- GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::MakeSelection: index value overflow");
-
- sal_uInt16 nParaIndex = static_cast< sal_uInt16 >( GetParagraphIndex() );
- return ESelection( nParaIndex, static_cast< sal_uInt16 >( nStartEEIndex ),
- nParaIndex, static_cast< sal_uInt16 >( nEndEEIndex ) );
- }
-
- ESelection AccessibleEditableTextPara::MakeSelection( sal_Int32 nEEIndex )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return MakeSelection( nEEIndex, nEEIndex+1 );
- }
-
- ESelection AccessibleEditableTextPara::MakeCursor( sal_Int32 nEEIndex )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return MakeSelection( nEEIndex, nEEIndex );
- }
-
- void AccessibleEditableTextPara::CheckIndex( sal_Int32 nIndex ) SAL_THROW((lang::IndexOutOfBoundsException, uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- if( nIndex < 0 || nIndex >= getCharacterCount() )
- throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleEditableTextPara: character index out of bounds")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* > (this) ) ); // disambiguate hierarchy
- }
-
- void AccessibleEditableTextPara::CheckPosition( sal_Int32 nIndex ) SAL_THROW((lang::IndexOutOfBoundsException, uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- if( nIndex < 0 || nIndex > getCharacterCount() )
- throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleEditableTextPara: character position out of bounds")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* > (this) ) ); // disambiguate hierarchy
- }
-
- void AccessibleEditableTextPara::CheckRange( sal_Int32 nStart, sal_Int32 nEnd ) SAL_THROW((lang::IndexOutOfBoundsException, uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- CheckPosition( nStart );
- CheckPosition( nEnd );
- }
-
- sal_Bool AccessibleEditableTextPara::GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ) SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- ESelection aSelection;
- sal_uInt16 nPara = static_cast< sal_uInt16 > ( GetParagraphIndex() );
- if( !GetEditViewForwarder().GetSelection( aSelection ) )
- return sal_False;
-
- if( aSelection.nStartPara < aSelection.nEndPara )
- {
- if( aSelection.nStartPara > nPara ||
- aSelection.nEndPara < nPara )
- return sal_False;
-
- if( nPara == aSelection.nStartPara )
- nStartPos = aSelection.nStartPos;
- else
- nStartPos = 0;
-
- if( nPara == aSelection.nEndPara )
- nEndPos = aSelection.nEndPos;
- else
- nEndPos = GetTextLen();
- }
- else
- {
- if( aSelection.nStartPara < nPara ||
- aSelection.nEndPara > nPara )
- return sal_False;
-
- if( nPara == aSelection.nStartPara )
- nStartPos = aSelection.nStartPos;
- else
- nStartPos = GetTextLen();
-
- if( nPara == aSelection.nEndPara )
- nEndPos = aSelection.nEndPos;
- else
- nEndPos = 0;
- }
-
- return sal_True;
- }
-
- String AccessibleEditableTextPara::GetText( sal_Int32 nIndex ) SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return GetTextForwarder().GetText( MakeSelection(nIndex) );
- }
-
- String AccessibleEditableTextPara::GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return GetTextForwarder().GetText( MakeSelection(nStartIndex, nEndIndex) );
- }
-
- sal_uInt16 AccessibleEditableTextPara::GetTextLen() const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return GetTextForwarder().GetTextLen( static_cast< sal_uInt16 >( GetParagraphIndex() ) );
- }
-
- sal_Bool AccessibleEditableTextPara::IsVisible() const
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return mpEditSource ? sal_True : sal_False ;
- }
-
- uno::Reference< XAccessibleText > AccessibleEditableTextPara::GetParaInterface( sal_Int32 nIndex )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- uno::Reference< XAccessible > xParent = getAccessibleParent();
- if( xParent.is() )
- {
- uno::Reference< XAccessibleContext > xParentContext = xParent->getAccessibleContext();
- if( xParentContext.is() )
- {
- uno::Reference< XAccessible > xPara = xParentContext->getAccessibleChild( nIndex );
- if( xPara.is() )
- {
- return uno::Reference< XAccessibleText > ( xPara, uno::UNO_QUERY );
- }
- }
- }
-
- return uno::Reference< XAccessibleText >();
- }
-
- SvxEditSourceAdapter& AccessibleEditableTextPara::GetEditSource() const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- if( mpEditSource )
- return *mpEditSource;
- else
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No edit source, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
- }
-
- SvxAccessibleTextAdapter& AccessibleEditableTextPara::GetTextForwarder() const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SvxEditSourceAdapter& rEditSource = GetEditSource();
- SvxAccessibleTextAdapter* pTextForwarder = rEditSource.GetTextForwarderAdapter();
-
- if( !pTextForwarder )
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch text forwarder, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
-
- if( pTextForwarder->IsValid() )
- return *pTextForwarder;
- else
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text forwarder is invalid, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
- }
-
- SvxViewForwarder& AccessibleEditableTextPara::GetViewForwarder() const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SvxEditSource& rEditSource = GetEditSource();
- SvxViewForwarder* pViewForwarder = rEditSource.GetViewForwarder();
-
- if( !pViewForwarder )
- {
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch view forwarder, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
- }
-
- if( pViewForwarder->IsValid() )
- return *pViewForwarder;
- else
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
- }
-
- SvxAccessibleTextEditViewAdapter& AccessibleEditableTextPara::GetEditViewForwarder( sal_Bool bCreate ) const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SvxEditSourceAdapter& rEditSource = GetEditSource();
- SvxAccessibleTextEditViewAdapter* pTextEditViewForwarder = rEditSource.GetEditViewForwarderAdapter( bCreate );
-
- if( !pTextEditViewForwarder )
- {
- if( bCreate )
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch view forwarder, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
- else
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No view forwarder, object not in edit mode")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
- }
-
- if( pTextEditViewForwarder->IsValid() )
- return *pTextEditViewForwarder;
- else
- {
- if( bCreate )
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
- else
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, object not in edit mode")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
- }
- }
-
- sal_Bool AccessibleEditableTextPara::HaveEditView() const
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SvxEditSource& rEditSource = GetEditSource();
- SvxEditViewForwarder* pViewForwarder = rEditSource.GetEditViewForwarder();
-
- if( !pViewForwarder )
- return sal_False;
-
- if( !pViewForwarder->IsValid() )
- return sal_False;
-
- return sal_True;
- }
-
- sal_Bool AccessibleEditableTextPara::HaveChildren()
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::HaveChildren: paragraph index value overflow");
-
- return GetTextForwarder().HaveImageBullet( static_cast< sal_uInt16 >(GetParagraphIndex()) );
- }
-
- sal_Bool AccessibleEditableTextPara::IsActive() const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SvxEditSource& rEditSource = GetEditSource();
- SvxEditViewForwarder* pViewForwarder = rEditSource.GetEditViewForwarder();
-
- if( !pViewForwarder )
- return sal_False;
-
- if( pViewForwarder->IsValid() )
- return sal_False;
- else
- return sal_True;
- }
-
- Rectangle AccessibleEditableTextPara::LogicToPixel( const Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder& rForwarder )
- {
- // convert to screen coordinates
- return Rectangle( rForwarder.LogicToPixel( rRect.TopLeft(), rMapMode ),
- rForwarder.LogicToPixel( rRect.BottomRight(), rMapMode ) );
- }
-
- const Point& AccessibleEditableTextPara::GetEEOffset() const
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return maEEOffset;
- }
-
- void AccessibleEditableTextPara::SetEEOffset( const Point& rOffset )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- WeakBullet::HardRefType aChild( maImageBullet.get() );
- if( aChild.is() )
- aChild->SetEEOffset(rOffset);
-
- maEEOffset = rOffset;
- }
-
- void AccessibleEditableTextPara::FireEvent(const sal_Int16 nEventId, const uno::Any& rNewValue, const uno::Any& rOldValue) const
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- uno::Reference < XAccessibleContext > xThis( const_cast< AccessibleEditableTextPara* > (this)->getAccessibleContext() );
-
- AccessibleEventObject aEvent(xThis, nEventId, rNewValue, rOldValue);
-
- // #102261# Call global queue for focus events
- if( nEventId == AccessibleEventId::STATE_CHANGED )
- vcl::unohelper::NotifyAccessibleStateEventGlobally( aEvent );
-
- // #106234# Delegate to EventNotifier
- if( getNotifierClientId() != -1 )
- ::comphelper::AccessibleEventNotifier::addEvent( getNotifierClientId(),
- aEvent );
- }
-
- void AccessibleEditableTextPara::GotPropertyEvent( const uno::Any& rNewValue, const sal_Int16 nEventId ) const
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- FireEvent( nEventId, rNewValue );
- }
-
- void AccessibleEditableTextPara::LostPropertyEvent( const uno::Any& rOldValue, const sal_Int16 nEventId ) const
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- FireEvent( nEventId, uno::Any(), rOldValue );
- }
-
- bool AccessibleEditableTextPara::HasState( const sal_Int16 nStateId )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
- if( pStateSet != NULL )
- return pStateSet->contains(nStateId) ? true : false;
-
- return false;
- }
-
- void AccessibleEditableTextPara::SetState( const sal_Int16 nStateId )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
- if( pStateSet != NULL &&
- !pStateSet->contains(nStateId) )
- {
- pStateSet->AddState( nStateId );
- GotPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED );
- }
- }
-
- void AccessibleEditableTextPara::UnSetState( const sal_Int16 nStateId )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
- if( pStateSet != NULL &&
- pStateSet->contains(nStateId) )
- {
- pStateSet->RemoveState( nStateId );
- LostPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED );
- }
- }
-
- void AccessibleEditableTextPara::TextChanged()
- {
- ::rtl::OUString aCurrentString( OCommonAccessibleText::getText() );
- uno::Any aDeleted;
- uno::Any aInserted;
- if( OCommonAccessibleText::implInitTextChangedEvent( maLastTextString, aCurrentString,
- aDeleted, aInserted) )
- {
- FireEvent( AccessibleEventId::TEXT_CHANGED, aInserted, aDeleted );
- maLastTextString = aCurrentString;
- }
- }
-
- sal_Bool AccessibleEditableTextPara::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nIndex )
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX,
- "AccessibleEditableTextPara::GetAttributeRun: index value overflow");
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getLocale: paragraph index value overflow");
-
- return GetTextForwarder().GetAttributeRun( nStartIndex,
- nEndIndex,
- static_cast< sal_uInt16 >(GetParagraphIndex()),
- static_cast< sal_uInt16 >(nIndex) );
- }
-
- uno::Any SAL_CALL AccessibleEditableTextPara::queryInterface (const uno::Type & rType) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- uno::Any aRet;
-
- // must provide XAccesibleText by hand, since it comes publicly inherited by XAccessibleEditableText
- if ( rType == ::getCppuType((uno::Reference< XAccessibleText > *)0) )
- {
- uno::Reference< XAccessibleText > aAccText = static_cast< XAccessibleEditableText * >(this);
- aRet <<= aAccText;
- }
- else if ( rType == ::getCppuType((uno::Reference< XAccessibleEditableText > *)0) )
- {
- uno::Reference< XAccessibleEditableText > aAccEditText = this;
- aRet <<= aAccEditText;
- }
- else if ( rType == ::getCppuType((uno::Reference< XAccessibleHypertext > *)0) )
- {
- uno::Reference< XAccessibleHypertext > aAccHyperText = this;
- aRet <<= aAccHyperText;
- }
- else
- {
- aRet = AccessibleTextParaInterfaceBase::queryInterface(rType);
- }
-
- return aRet;
- }
-
- // XAccessible
- uno::Reference< XAccessibleContext > SAL_CALL AccessibleEditableTextPara::getAccessibleContext() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- // We implement the XAccessibleContext interface in the same object
- return uno::Reference< XAccessibleContext > ( this );
- }
-
- // XAccessibleContext
- sal_Int32 SAL_CALL AccessibleEditableTextPara::getAccessibleChildCount() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- return HaveChildren() ? 1 : 0;
- }
-
- uno::Reference< XAccessible > SAL_CALL AccessibleEditableTextPara::getAccessibleChild( sal_Int32 i ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- if( !HaveChildren() )
- throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No childs available")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* > (this) ) ); // static_cast: disambiguate hierarchy
-
- if( i != 0 )
- throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid child index")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* > (this) ) ); // static_cast: disambiguate hierarchy
-
- WeakBullet::HardRefType aChild( maImageBullet.get() );
-
- if( !aChild.is() )
- {
- // there is no hard reference available, create object then
- AccessibleImageBullet* pChild = new AccessibleImageBullet( uno::Reference< XAccessible >( this ) );
- uno::Reference< XAccessible > xChild( static_cast< ::cppu::OWeakObject* > (pChild), uno::UNO_QUERY );
-
- if( !xChild.is() )
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Child creation failed")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* > (this) ) );
-
- aChild = WeakBullet::HardRefType( xChild, pChild );
-
- aChild->SetEditSource( &GetEditSource() );
- aChild->SetParagraphIndex( GetParagraphIndex() );
- aChild->SetIndexInParent( i );
-
- maImageBullet = aChild;
- }
-
- return aChild.getRef();
- }
-
- uno::Reference< XAccessible > SAL_CALL AccessibleEditableTextPara::getAccessibleParent() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
-#ifdef DBG_UTIL
- if( !mxParent.is() )
- OSL_TRACE( "AccessibleEditableTextPara::getAccessibleParent: no frontend set, did somebody forgot to call AccessibleTextHelper::SetEventSource()?");
-#endif
-
- return mxParent;
- }
-
- sal_Int32 SAL_CALL AccessibleEditableTextPara::getAccessibleIndexInParent() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return mnIndexInParent;
- }
-
- sal_Int16 SAL_CALL AccessibleEditableTextPara::getAccessibleRole() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return AccessibleRole::PARAGRAPH;
- }
-
- ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getAccessibleDescription() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
-// SolarMutexGuard aGuard;
-
- return ::rtl::OUString();
- }
-
- ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getAccessibleName() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
-// SolarMutexGuard aGuard;
-
- return ::rtl::OUString();
- }
-
- uno::Reference< XAccessibleRelationSet > SAL_CALL AccessibleEditableTextPara::getAccessibleRelationSet() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- // #i27138# - provide relations CONTENT_FLOWS_FROM
- // and CONTENT_FLOWS_TO
- if ( mpParaManager )
- {
- utl::AccessibleRelationSetHelper* pAccRelSetHelper =
- new utl::AccessibleRelationSetHelper();
- sal_Int32 nMyParaIndex( GetParagraphIndex() );
- // relation CONTENT_FLOWS_FROM
- if ( nMyParaIndex > 0 &&
- mpParaManager->IsReferencable( nMyParaIndex - 1 ) )
- {
- uno::Sequence<uno::Reference<XInterface> > aSequence(1);
- aSequence[0] =
- mpParaManager->GetChild( nMyParaIndex - 1 ).first.get().getRef();
- AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_FROM,
- aSequence );
- pAccRelSetHelper->AddRelation( aAccRel );
- }
-
- // relation CONTENT_FLOWS_TO
- if ( (nMyParaIndex + 1) < (sal_Int32)mpParaManager->GetNum() &&
- mpParaManager->IsReferencable( nMyParaIndex + 1 ) )
- {
- uno::Sequence<uno::Reference<XInterface> > aSequence(1);
- aSequence[0] =
- mpParaManager->GetChild( nMyParaIndex + 1 ).first.get().getRef();
- AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_TO,
- aSequence );
- pAccRelSetHelper->AddRelation( aAccRel );
- }
-
- return pAccRelSetHelper;
- }
- else
- {
- // no relations, therefore empty
- return uno::Reference< XAccessibleRelationSet >();
- }
- }
-
- uno::Reference< XAccessibleStateSet > SAL_CALL AccessibleEditableTextPara::getAccessibleStateSet() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- // Create a copy of the state set and return it.
- ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
-
- if( !pStateSet )
- return uno::Reference<XAccessibleStateSet>();
-
- return uno::Reference<XAccessibleStateSet>( new ::utl::AccessibleStateSetHelper (*pStateSet) );
- }
-
- lang::Locale SAL_CALL AccessibleEditableTextPara::getLocale() throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- return implGetLocale();
- }
-
- void SAL_CALL AccessibleEditableTextPara::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- if( getNotifierClientId() != -1 )
- ::comphelper::AccessibleEventNotifier::addEventListener( getNotifierClientId(), xListener );
- }
-
- void SAL_CALL AccessibleEditableTextPara::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- if( getNotifierClientId() != -1 )
- ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener );
- }
-
- // XAccessibleComponent
- sal_Bool SAL_CALL AccessibleEditableTextPara::containsPoint( const awt::Point& aTmpPoint ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::contains: index value overflow");
-
- awt::Rectangle aTmpRect = getBounds();
- Rectangle aRect( Point(aTmpRect.X, aTmpRect.Y), Size(aTmpRect.Width, aTmpRect.Height) );
- Point aPoint( aTmpPoint.X, aTmpPoint.Y );
-
- return aRect.IsInside( aPoint );
- }
-
- uno::Reference< XAccessible > SAL_CALL AccessibleEditableTextPara::getAccessibleAtPoint( const awt::Point& _aPoint ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- if( HaveChildren() )
- {
- // #103862# No longer need to make given position relative
- Point aPoint( _aPoint.X, _aPoint.Y );
-
- // respect EditEngine offset to surrounding shape/cell
- aPoint -= GetEEOffset();
-
- // convert to EditEngine coordinate system
- SvxTextForwarder& rCacheTF = GetTextForwarder();
- Point aLogPoint( GetViewForwarder().PixelToLogic( aPoint, rCacheTF.GetMapMode() ) );
-
- EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 > (GetParagraphIndex()) );
-
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType == SVX_NUM_BITMAP )
- {
- Rectangle aRect = aBulletInfo.aBounds;
-
- if( aRect.IsInside( aLogPoint ) )
- return getAccessibleChild(0);
- }
- }
-
- // no children at all, or none at given position
- return uno::Reference< XAccessible >();
- }
-
- awt::Rectangle SAL_CALL AccessibleEditableTextPara::getBounds() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getBounds: index value overflow");
-
- SvxTextForwarder& rCacheTF = GetTextForwarder();
- Rectangle aRect = rCacheTF.GetParaBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ) );
-
- // convert to screen coordinates
- Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect,
- rCacheTF.GetMapMode(),
- GetViewForwarder() );
-
- // offset from shape/cell
- Point aOffset = GetEEOffset();
-
- return awt::Rectangle( aScreenRect.Left() + aOffset.X(),
- aScreenRect.Top() + aOffset.Y(),
- aScreenRect.GetSize().Width(),
- aScreenRect.GetSize().Height() );
- }
-
- awt::Point SAL_CALL AccessibleEditableTextPara::getLocation( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- awt::Rectangle aRect = getBounds();
-
- return awt::Point( aRect.X, aRect.Y );
- }
-
- awt::Point SAL_CALL AccessibleEditableTextPara::getLocationOnScreen( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- // relate us to parent
- uno::Reference< XAccessible > xParent = getAccessibleParent();
- if( xParent.is() )
- {
- uno::Reference< XAccessibleComponent > xParentComponent( xParent, uno::UNO_QUERY );
- if( xParentComponent.is() )
- {
- awt::Point aRefPoint = xParentComponent->getLocationOnScreen();
- awt::Point aPoint = getLocation();
- aPoint.X += aRefPoint.X;
- aPoint.Y += aRefPoint.Y;
-
- return aPoint;
- }
- // #i88070#
- // fallback to parent's <XAccessibleContext> instance
- else
- {
- uno::Reference< XAccessibleContext > xParentContext = xParent->getAccessibleContext();
- if ( xParentContext.is() )
- {
- uno::Reference< XAccessibleComponent > xParentContextComponent( xParentContext, uno::UNO_QUERY );
- if( xParentContextComponent.is() )
- {
- awt::Point aRefPoint = xParentContextComponent->getLocationOnScreen();
- awt::Point aPoint = getLocation();
- aPoint.X += aRefPoint.X;
- aPoint.Y += aRefPoint.Y;
-
- return aPoint;
- }
- }
- }
- }
-
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot access parent")),
- uno::Reference< uno::XInterface >
- ( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy
- }
-
- awt::Size SAL_CALL AccessibleEditableTextPara::getSize( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- awt::Rectangle aRect = getBounds();
-
- return awt::Size( aRect.Width, aRect.Height );
- }
-
- void SAL_CALL AccessibleEditableTextPara::grabFocus( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- // set cursor to this paragraph
- setSelection(0,0);
- }
-
- sal_Int32 SAL_CALL AccessibleEditableTextPara::getForeground( ) throw (::com::sun::star::uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- // #104444# Added to XAccessibleComponent interface
- svtools::ColorConfig aColorConfig;
- sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
- return static_cast<sal_Int32>(nColor);
- }
-
- sal_Int32 SAL_CALL AccessibleEditableTextPara::getBackground( ) throw (::com::sun::star::uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- // #104444# Added to XAccessibleComponent interface
- Color aColor( Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor() );
-
- // the background is transparent
- aColor.SetTransparency( 0xFF);
-
- return static_cast<sal_Int32>( aColor.GetColor() );
- }
-
- // XAccessibleText
- sal_Int32 SAL_CALL AccessibleEditableTextPara::getCaretPosition() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- if( !HaveEditView() )
- return -1;
-
- ESelection aSelection;
- if( GetEditViewForwarder().GetSelection( aSelection ) &&
- GetParagraphIndex() == aSelection.nEndPara )
- {
- // caret is always nEndPara,nEndPos
- return aSelection.nEndPos;
- }
-
- // not within this paragraph
- return -1;
- }
-
- sal_Bool SAL_CALL AccessibleEditableTextPara::setCaretPosition( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return setSelection(nIndex, nIndex);
- }
-
- sal_Unicode SAL_CALL AccessibleEditableTextPara::getCharacter( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getCharacter: index value overflow");
-
- return OCommonAccessibleText::getCharacter( nIndex );
- }
-
- 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 );
- SolarMutexGuard aGuard;
-
- CheckIndex(nIndex); // may throw IndexOutOfBoundsException
-
- // get default attribues...
- ::comphelper::SequenceAsHashMap aPropHashMap( getDefaultAttributes( rRequestedAttributes ) );
-
- // ... and override them with the direct attributes from the specific position
- uno::Sequence< beans::PropertyValue > aRunAttribs( getRunAttributes( nIndex, rRequestedAttributes ) );
- sal_Int32 nRunAttribs = aRunAttribs.getLength();
- const beans::PropertyValue *pRunAttrib = aRunAttribs.getConstArray();
- for (sal_Int32 k = 0; k < nRunAttribs; ++k)
- {
- const beans::PropertyValue &rRunAttrib = pRunAttrib[k];
- aPropHashMap[ rRunAttrib.Name ] = rRunAttrib.Value; //!! should not only be the value !!
- }
-
- // get resulting sequence
- uno::Sequence< beans::PropertyValue > aRes;
- aPropHashMap >> aRes;
-
- // since SequenceAsHashMap ignores property handles and property state
- // we have to restore the property state here (property handles are
- // of no use to the accessibility API).
- sal_Int32 nRes = aRes.getLength();
- beans::PropertyValue *pRes = aRes.getArray();
- for (sal_Int32 i = 0; i < nRes; ++i)
- {
- beans::PropertyValue &rRes = pRes[i];
- sal_Bool bIsDirectVal = sal_False;
- for (sal_Int32 k = 0; k < nRunAttribs && !bIsDirectVal; ++k)
- {
- if (rRes.Name == pRunAttrib[k].Name)
- bIsDirectVal = sal_True;
- }
- rRes.Handle = -1;
- rRes.State = bIsDirectVal ? PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
- }
-
- return aRes;
- }
-
- awt::Rectangle SAL_CALL AccessibleEditableTextPara::getCharacterBounds( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getCharacterBounds: index value overflow");
-
- // #108900# Have position semantics now for nIndex, as
- // one-past-the-end values are legal, too.
- CheckPosition( nIndex );
-
- SvxTextForwarder& rCacheTF = GetTextForwarder();
- Rectangle aRect = rCacheTF.GetCharBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ), static_cast< sal_uInt16 >( nIndex ) );
-
- // convert to screen
- Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect,
- rCacheTF.GetMapMode(),
- GetViewForwarder() );
- // #109864# offset from parent (paragraph), but in screen
- // coordinates. This makes sure the internal text offset in
- // the outline view forwarder gets cancelled out here
- awt::Rectangle aParaRect( getBounds() );
- aScreenRect.Move( -aParaRect.X, -aParaRect.Y );
-
- // offset from shape/cell
- Point aOffset = GetEEOffset();
-
- return awt::Rectangle( aScreenRect.Left() + aOffset.X(),
- aScreenRect.Top() + aOffset.Y(),
- aScreenRect.GetSize().Width(),
- aScreenRect.GetSize().Height() );
- }
-
- sal_Int32 SAL_CALL AccessibleEditableTextPara::getCharacterCount() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getCharacterCount: index value overflow");
-
- return OCommonAccessibleText::getCharacterCount();
- }
-
- sal_Int32 SAL_CALL AccessibleEditableTextPara::getIndexAtPoint( const awt::Point& rPoint ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- sal_uInt16 nPara, nIndex;
-
- // offset from surrounding cell/shape
- Point aOffset( GetEEOffset() );
- Point aPoint( rPoint.X - aOffset.X(), rPoint.Y - aOffset.Y() );
-
- // convert to logical coordinates
- SvxTextForwarder& rCacheTF = GetTextForwarder();
- Point aLogPoint( GetViewForwarder().PixelToLogic( aPoint, rCacheTF.GetMapMode() ) );
-
- // re-offset to parent (paragraph)
- Rectangle aParaRect = rCacheTF.GetParaBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ) );
- aLogPoint.Move( aParaRect.Left(), aParaRect.Top() );
-
- if( rCacheTF.GetIndexAtPoint( aLogPoint, nPara, nIndex ) &&
- GetParagraphIndex() == nPara )
- {
- // #102259# Double-check if we're _really_ on the given character
- try
- {
- awt::Rectangle aRect1( getCharacterBounds(nIndex) );
- Rectangle aRect2( aRect1.X, aRect1.Y,
- aRect1.Width + aRect1.X, aRect1.Height + aRect1.Y );
- if( aRect2.IsInside( Point( rPoint.X, rPoint.Y ) ) )
- return nIndex;
- else
- return -1;
- }
- catch (const lang::IndexOutOfBoundsException&)
- {
- // #103927# Don't throw for invalid nIndex values
- return -1;
- }
- }
- else
- {
- // not within our paragraph
- return -1;
- }
- }
-
- ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getSelectedText() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getSelectedText: index value overflow");
-
- if( !HaveEditView() )
- return ::rtl::OUString();
-
- return OCommonAccessibleText::getSelectedText();
- }
-
- sal_Int32 SAL_CALL AccessibleEditableTextPara::getSelectionStart() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getSelectionStart: index value overflow");
-
- if( !HaveEditView() )
- return -1;
-
- return OCommonAccessibleText::getSelectionStart();
- }
-
- sal_Int32 SAL_CALL AccessibleEditableTextPara::getSelectionEnd() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getSelectionEnd: index value overflow");
-
- if( !HaveEditView() )
- return -1;
-
- return OCommonAccessibleText::getSelectionEnd();
- }
-
- sal_Bool SAL_CALL AccessibleEditableTextPara::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::setSelection: paragraph index value overflow");
-
- CheckRange(nStartIndex, nEndIndex);
-
- try
- {
- SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_True );
- return rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
- }
- catch (const uno::RuntimeException&)
- {
- return sal_False;
- }
- }
-
- ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getText() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getText: paragraph index value overflow");
-
- return OCommonAccessibleText::getText();
- }
-
- ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getTextRange: paragraph index value overflow");
-
- return OCommonAccessibleText::getTextRange(nStartIndex, nEndIndex);
- }
-
- ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getTextAtIndex: paragraph index value overflow");
-
- ::com::sun::star::accessibility::TextSegment aResult;
- aResult.SegmentStart = -1;
- aResult.SegmentEnd = -1;
-
- switch( aTextType )
- {
- // Not yet handled by OCommonAccessibleText. Missing
- // implGetAttributeRunBoundary() method there
- case AccessibleTextType::ATTRIBUTE_RUN:
- {
- const sal_Int32 nTextLen = GetTextForwarder().GetTextLen( static_cast< sal_uInt16 >( GetParagraphIndex() ) );
-
- if( nIndex == nTextLen )
- {
- // #i17014# Special-casing one-behind-the-end character
- aResult.SegmentStart = aResult.SegmentEnd = nTextLen;
- }
- else
- {
- sal_uInt16 nStartIndex, nEndIndex;
-
- if( GetAttributeRun(nStartIndex, nEndIndex, nIndex) )
- {
- aResult.SegmentText = GetTextRange(nStartIndex, nEndIndex);
- aResult.SegmentStart = nStartIndex;
- aResult.SegmentEnd = nEndIndex;
- }
- }
- break;
- }
-
- default:
- aResult = OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
- break;
- } /* end of switch( aTextType ) */
-
- return aResult;
- }
-
- ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getTextBeforeIndex: paragraph index value overflow");
-
- ::com::sun::star::accessibility::TextSegment aResult;
- aResult.SegmentStart = -1;
- aResult.SegmentEnd = -1;
-
- switch( aTextType )
- {
- // Not yet handled by OCommonAccessibleText. Missing
- // implGetAttributeRunBoundary() method there
- case AccessibleTextType::ATTRIBUTE_RUN:
- {
- const sal_Int32 nTextLen = GetTextForwarder().GetTextLen( static_cast< sal_uInt16 >( GetParagraphIndex() ) );
- sal_uInt16 nStartIndex, nEndIndex;
-
- if( nIndex == nTextLen )
- {
- // #i17014# Special-casing one-behind-the-end character
- if( nIndex > 0 &&
- GetAttributeRun(nStartIndex, nEndIndex, nIndex-1) )
- {
- aResult.SegmentText = GetTextRange(nStartIndex, nEndIndex);
- aResult.SegmentStart = nStartIndex;
- aResult.SegmentEnd = nEndIndex;
- }
- }
- else
- {
- if( GetAttributeRun(nStartIndex, nEndIndex, nIndex) )
- {
- // already at the left border? If not, query
- // one index further left
- if( nStartIndex > 0 &&
- GetAttributeRun(nStartIndex, nEndIndex, nStartIndex-1) )
- {
- aResult.SegmentText = GetTextRange(nStartIndex, nEndIndex);
- aResult.SegmentStart = nStartIndex;
- aResult.SegmentEnd = nEndIndex;
- }
- }
- }
- break;
- }
-
- default:
- aResult = OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
- break;
- } /* end of switch( aTextType ) */
-
- return aResult;
- }
-
- ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getTextBehindIndex: paragraph index value overflow");
-
- ::com::sun::star::accessibility::TextSegment aResult;
- aResult.SegmentStart = -1;
- aResult.SegmentEnd = -1;
-
- switch( aTextType )
- {
- case AccessibleTextType::ATTRIBUTE_RUN:
- {
- sal_uInt16 nStartIndex, nEndIndex;
-
- if( GetAttributeRun(nStartIndex, nEndIndex, nIndex) )
- {
- // already at the right border?
- if( nEndIndex < GetTextLen() )
- {
- if( GetAttributeRun(nStartIndex, nEndIndex, nEndIndex) )
- {
- aResult.SegmentText = GetTextRange(nStartIndex, nEndIndex);
- aResult.SegmentStart = nStartIndex;
- aResult.SegmentEnd = nEndIndex;
- }
- }
- }
- break;
- }
-
- default:
- aResult = OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
- break;
- } /* end of switch( aTextType ) */
-
- return aResult;
- }
-
- sal_Bool SAL_CALL AccessibleEditableTextPara::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- try
- {
- SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_True );
- #if OSL_DEBUG_LEVEL > 0
- SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs
- (void)rCacheTF;
- #else
- GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs
- #endif
-
- sal_Bool aRetVal;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::copyText: index value overflow");
-
- CheckRange(nStartIndex, nEndIndex);
-
- // save current selection
- ESelection aOldSelection;
-
- rCacheVF.GetSelection( aOldSelection );
- rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
- aRetVal = rCacheVF.Copy();
- rCacheVF.SetSelection( aOldSelection ); // restore
-
- return aRetVal;
- }
- catch (const uno::RuntimeException&)
- {
- return sal_False;
- }
- }
-
- // XAccessibleEditableText
- sal_Bool SAL_CALL AccessibleEditableTextPara::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- try
- {
- SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_True );
- SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::cutText: index value overflow");
-
- CheckRange(nStartIndex, nEndIndex);
-
- if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
- return sal_False; // non-editable area selected
-
- // don't save selection, might become invalid after cut!
- rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
-
- return rCacheVF.Cut();
- }
- catch (const uno::RuntimeException&)
- {
- return sal_False;
- }
- }
-
- sal_Bool SAL_CALL AccessibleEditableTextPara::pasteText( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- try
- {
- SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_True );
- SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::pasteText: index value overflow");
-
- CheckPosition(nIndex);
-
- if( !rCacheTF.IsEditable( MakeSelection(nIndex) ) )
- return sal_False; // non-editable area selected
-
- // #104400# set empty selection (=> cursor) to given index
- rCacheVF.SetSelection( MakeCursor(nIndex) );
-
- return rCacheVF.Paste();
- }
- catch (const uno::RuntimeException&)
- {
- return sal_False;
- }
- }
-
- sal_Bool SAL_CALL AccessibleEditableTextPara::deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- try
- {
- // #102710# Request edit view when doing changes
- // AccessibleEmptyEditSource relies on this behaviour
- GetEditViewForwarder( sal_True );
- SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::deleteText: index value overflow");
-
- CheckRange(nStartIndex, nEndIndex);
-
- if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
- return sal_False; // non-editable area selected
-
- sal_Bool bRet = rCacheTF.Delete( MakeSelection(nStartIndex, nEndIndex) );
-
- GetEditSource().UpdateData();
-
- return bRet;
- }
- catch (const uno::RuntimeException&)
- {
- return sal_False;
- }
- }
-
- sal_Bool SAL_CALL AccessibleEditableTextPara::insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- try
- {
- // #102710# Request edit view when doing changes
- // AccessibleEmptyEditSource relies on this behaviour
- GetEditViewForwarder( sal_True );
- SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::insertText: index value overflow");
-
- CheckPosition(nIndex);
-
- if( !rCacheTF.IsEditable( MakeSelection(nIndex) ) )
- return sal_False; // non-editable area selected
-
- // #104400# insert given text at empty selection (=> cursor)
- sal_Bool bRet = rCacheTF.InsertText( sText, MakeCursor(nIndex) );
-
- rCacheTF.QuickFormatDoc();
- GetEditSource().UpdateData();
-
- return bRet;
- }
- catch (const uno::RuntimeException&)
- {
- return sal_False;
- }
- }
-
- sal_Bool SAL_CALL AccessibleEditableTextPara::replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- try
- {
- // #102710# Request edit view when doing changes
- // AccessibleEmptyEditSource relies on this behaviour
- GetEditViewForwarder( sal_True );
- SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::replaceText: index value overflow");
-
- CheckRange(nStartIndex, nEndIndex);
-
- if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
- return sal_False; // non-editable area selected
-
- // insert given text into given range => replace
- sal_Bool bRet = rCacheTF.InsertText( sReplacement, MakeSelection(nStartIndex, nEndIndex) );
-
- rCacheTF.QuickFormatDoc();
- GetEditSource().UpdateData();
-
- return bRet;
- }
- catch (const uno::RuntimeException&)
- {
- return sal_False;
- }
- }
-
- sal_Bool SAL_CALL AccessibleEditableTextPara::setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const uno::Sequence< beans::PropertyValue >& aAttributeSet ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- try
- {
- // #102710# Request edit view when doing changes
- // AccessibleEmptyEditSource relies on this behaviour
- GetEditViewForwarder( sal_True );
- SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs
- sal_uInt16 nPara = static_cast< sal_uInt16 >( GetParagraphIndex() );
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::setAttributes: index value overflow");
-
- CheckRange(nStartIndex, nEndIndex);
-
- if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
- return sal_False; // non-editable area selected
-
- // do the indices span the whole paragraph? Then use the outliner map
- // TODO: hold it as a member?
- SvxAccessibleTextPropertySet aPropSet( &GetEditSource(),
- 0 == nStartIndex &&
- rCacheTF.GetTextLen(nPara) == nEndIndex ?
- ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() :
- ImplGetSvxTextPortionSvxPropertySet() );
-
- aPropSet.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
-
- // convert from PropertyValue to Any
- sal_Int32 i, nLength( aAttributeSet.getLength() );
- const beans::PropertyValue* pPropArray = aAttributeSet.getConstArray();
- for(i=0; i<nLength; ++i)
- {
- try
- {
- aPropSet.setPropertyValue(pPropArray->Name, pPropArray->Value);
- }
- catch (const uno::Exception&)
- {
- OSL_FAIL("AccessibleEditableTextPara::setAttributes exception in setPropertyValue");
- }
-
- ++pPropArray;
- }
-
- rCacheTF.QuickFormatDoc();
- GetEditSource().UpdateData();
-
- return sal_True;
- }
- catch (const uno::RuntimeException&)
- {
- return sal_False;
- }
- }
-
- sal_Bool SAL_CALL AccessibleEditableTextPara::setText( const ::rtl::OUString& sText ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- return replaceText(0, getCharacterCount(), sText);
- }
-
- // XAccessibleTextAttributes
- uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getDefaultAttributes(
- const uno::Sequence< ::rtl::OUString >& rRequestedAttributes )
- throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
- SolarMutexGuard aGuard;
-
- #if OSL_DEBUG_LEVEL > 0
- SvxAccessibleTextAdapter& rCacheTF =
- #endif
- GetTextForwarder();
-
- #if OSL_DEBUG_LEVEL > 0
- (void)rCacheTF;
- #endif
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getCharacterAttributes: index value overflow");
-
- // get XPropertySetInfo for paragraph attributes and
- // character attributes that span all the paragraphs text.
- SvxAccessibleTextPropertySet aPropSet( &GetEditSource(),
- ImplGetSvxCharAndParaPropertiesSet() );
- aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) );
- uno::Reference< beans::XPropertySetInfo > xPropSetInfo = aPropSet.getPropertySetInfo();
- if (!xPropSetInfo.is())
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot query XPropertySetInfo")),
- uno::Reference< uno::XInterface >
- ( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy
-
- // build sequence of available properties to check
- sal_Int32 nLenReqAttr = rRequestedAttributes.getLength();
- uno::Sequence< beans::Property > aProperties;
- if (nLenReqAttr)
- {
- const rtl::OUString *pRequestedAttributes = rRequestedAttributes.getConstArray();
-
- aProperties.realloc( nLenReqAttr );
- beans::Property *pProperties = aProperties.getArray();
- sal_Int32 nCurLen = 0;
- for (sal_Int32 i = 0; i < nLenReqAttr; ++i)
- {
- beans::Property aProp;
- try
- {
- aProp = xPropSetInfo->getPropertyByName( pRequestedAttributes[i] );
- }
- catch (const beans::UnknownPropertyException&)
- {
- continue;
- }
- pProperties[ nCurLen++ ] = aProp;
- }
- aProperties.realloc( nCurLen );
- }
- else
- aProperties = xPropSetInfo->getProperties();
-
- sal_Int32 nLength = aProperties.getLength();
- const beans::Property *pProperties = aProperties.getConstArray();
-
- // build resulting sequence
- uno::Sequence< beans::PropertyValue > aOutSequence( nLength );
- beans::PropertyValue* pOutSequence = aOutSequence.getArray();
- sal_Int32 nOutLen = 0;
- for (sal_Int32 i = 0; i < nLength; ++i)
- {
- // calling implementation functions:
- // _getPropertyState and _getPropertyValue (see below) to provide
- // the proper paragraph number when retrieving paragraph attributes
- PropertyState eState = aPropSet._getPropertyState( pProperties->Name, mnParagraphIndex );
- if ( eState == PropertyState_AMBIGUOUS_VALUE )
- {
- OSL_FAIL( "ambiguous property value encountered" );
- }
-
- //if (eState == PropertyState_DIRECT_VALUE)
- // per definition all paragraph properties and all character
- // properties spanning the whole paragraph should be returned
- // and declared as default value
- {
- pOutSequence->Name = pProperties->Name;
- pOutSequence->Handle = pProperties->Handle;
- pOutSequence->Value = aPropSet._getPropertyValue( pProperties->Name, mnParagraphIndex );
- pOutSequence->State = PropertyState_DEFAULT_VALUE;
-
- ++pOutSequence;
- ++nOutLen;
- }
- ++pProperties;
- }
- aOutSequence.realloc( nOutLen );
-
- return aOutSequence;
- }
-
-
- uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getRunAttributes(
- sal_Int32 nIndex,
- const uno::Sequence< ::rtl::OUString >& rRequestedAttributes )
- throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- SolarMutexGuard aGuard;
-
- #if OSL_DEBUG_LEVEL > 0
- SvxAccessibleTextAdapter& rCacheTF =
- #endif
- GetTextForwarder();
-
- #if OSL_DEBUG_LEVEL > 0
- (void)rCacheTF;
- #endif
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getCharacterAttributes: index value overflow");
-
- CheckIndex(nIndex);
-
- SvxAccessibleTextPropertySet aPropSet( &GetEditSource(),
- ImplGetSvxCharAndParaPropertiesSet() );
- aPropSet.SetSelection( MakeSelection( nIndex ) );
- uno::Reference< beans::XPropertySetInfo > xPropSetInfo = aPropSet.getPropertySetInfo();
- if (!xPropSetInfo.is())
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot query XPropertySetInfo")),
- uno::Reference< uno::XInterface >
- ( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy
-
- // build sequence of available properties to check
- sal_Int32 nLenReqAttr = rRequestedAttributes.getLength();
- uno::Sequence< beans::Property > aProperties;
- if (nLenReqAttr)
- {
- const rtl::OUString *pRequestedAttributes = rRequestedAttributes.getConstArray();
-
- aProperties.realloc( nLenReqAttr );
- beans::Property *pProperties = aProperties.getArray();
- sal_Int32 nCurLen = 0;
- for (sal_Int32 i = 0; i < nLenReqAttr; ++i)
- {
- beans::Property aProp;
- try
- {
- aProp = xPropSetInfo->getPropertyByName( pRequestedAttributes[i] );
- }
- catch (const beans::UnknownPropertyException&)
- {
- continue;
- }
- pProperties[ nCurLen++ ] = aProp;
- }
- aProperties.realloc( nCurLen );
- }
- else
- aProperties = xPropSetInfo->getProperties();
-
- sal_Int32 nLength = aProperties.getLength();
- const beans::Property *pProperties = aProperties.getConstArray();
-
- // build resulting sequence
- uno::Sequence< beans::PropertyValue > aOutSequence( nLength );
- beans::PropertyValue* pOutSequence = aOutSequence.getArray();
- sal_Int32 nOutLen = 0;
- for (sal_Int32 i = 0; i < nLength; ++i)
- {
- // calling 'regular' functions that will operate on the selection
- PropertyState eState = aPropSet.getPropertyState( pProperties->Name );
- if (eState == PropertyState_DIRECT_VALUE)
- {
- pOutSequence->Name = pProperties->Name;
- pOutSequence->Handle = pProperties->Handle;
- pOutSequence->Value = aPropSet.getPropertyValue( pProperties->Name );
- pOutSequence->State = eState;
-
- ++pOutSequence;
- ++nOutLen;
- }
- ++pProperties;
- }
- aOutSequence.realloc( nOutLen );
-
- return aOutSequence;
- }
-
- // XAccessibleHypertext
- ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException)
- {
- SvxAccessibleTextAdapter& rT = GetTextForwarder();
- const sal_Int32 nPara = GetParagraphIndex();
-
- sal_uInt16 nHyperLinks = 0;
- sal_uInt16 nFields = rT.GetFieldCount( nPara );
- for ( sal_uInt16 n = 0; n < nFields; n++ )
- {
- EFieldInfo aField = rT.GetFieldInfo( nPara, n );
- if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) )
- nHyperLinks++;
- }
- return nHyperLinks;
- }
-
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL AccessibleEditableTextPara::getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > xRef;
-
- SvxAccessibleTextAdapter& rT = GetTextForwarder();
- const sal_Int32 nPara = GetParagraphIndex();
-
- sal_uInt16 nHyperLink = 0;
- sal_uInt16 nFields = rT.GetFieldCount( nPara );
- for ( sal_uInt16 n = 0; n < nFields; n++ )
- {
- EFieldInfo aField = rT.GetFieldInfo( nPara, n );
- if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) )
- {
- if ( nHyperLink == nLinkIndex )
- {
- sal_uInt16 nEEStart = aField.aPosition.nIndex;
-
- // Translate EE Index to accessible index
- sal_uInt16 nStart = rT.CalcEditEngineIndex( nPara, nEEStart );
- sal_uInt16 nEnd = nStart + aField.aCurrentText.Len();
- xRef = new AccessibleHyperlink( rT, new SvxFieldItem( *aField.pFieldItem ), nPara, nEEStart, nStart, nEnd, aField.aCurrentText );
- break;
- }
- nHyperLink++;
- }
- }
-
- return xRef;
- }
-
- ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
- {
- const sal_Int32 nPara = GetParagraphIndex();
- SvxAccessibleTextAdapter& rT = GetTextForwarder();
-
-// SvxAccessibleTextIndex aIndex;
-// aIndex.SetIndex(nPara, nCharIndex, rT);
-// const sal_uInt16 nEEIndex = aIndex.GetEEIndex();
-
- const sal_uInt16 nEEIndex = rT.CalcEditEngineIndex( nPara, nCharIndex );
- sal_Int32 nHLIndex = 0;
- sal_uInt16 nHyperLink = 0;
- sal_uInt16 nFields = rT.GetFieldCount( nPara );
- for ( sal_uInt16 n = 0; n < nFields; n++ )
- {
- EFieldInfo aField = rT.GetFieldInfo( nPara, n );
- if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) )
- {
- if ( aField.aPosition.nIndex == nEEIndex )
- {
- nHLIndex = nHyperLink;
- break;
- }
- nHyperLink++;
- }
- }
-
- return nHLIndex;
- }
-
- // XAccessibleMultiLineText
- sal_Int32 SAL_CALL AccessibleEditableTextPara::getLineNumberAtIndex( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- sal_Int32 nRes = -1;
- sal_Int32 nPara = GetParagraphIndex();
-
- SvxTextForwarder &rCacheTF = GetTextForwarder();
- const bool bValidPara = 0 <= nPara && nPara < rCacheTF.GetParagraphCount();
- DBG_ASSERT( bValidPara, "getLineNumberAtIndex: current paragraph index out of range" );
- if (bValidPara)
- {
- // we explicitly allow for the index to point at the character right behind the text
- if (0 <= nIndex && nIndex <= rCacheTF.GetTextLen( static_cast< sal_uInt16 >(nPara) ))
- nRes = rCacheTF.GetLineNumberAtIndex( static_cast< sal_uInt16 >(nPara), static_cast< sal_uInt16 >(nIndex) );
- else
- throw lang::IndexOutOfBoundsException();
- }
- return nRes;
- }
-
- // XAccessibleMultiLineText
- ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextAtLineNumber( sal_Int32 nLineNo ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- ::com::sun::star::accessibility::TextSegment aResult;
- sal_Int32 nPara = GetParagraphIndex();
- SvxTextForwarder &rCacheTF = GetTextForwarder();
- const bool bValidPara = 0 <= nPara && nPara < rCacheTF.GetParagraphCount();
- DBG_ASSERT( bValidPara, "getTextAtLineNumber: current paragraph index out of range" );
- if (bValidPara)
- {
- if (0 <= nLineNo && nLineNo < rCacheTF.GetLineCount( static_cast< sal_uInt16 >(nPara) ))
- {
- sal_uInt16 nStart = 0, nEnd = 0;
- rCacheTF.GetLineBoundaries( nStart, nEnd, static_cast< sal_uInt16 >(nPara), static_cast< sal_uInt16 >(nLineNo) );
- if (nStart != 0xFFFF && nEnd != 0xFFFF)
- {
- try
- {
- aResult.SegmentText = getTextRange( nStart, nEnd );
- aResult.SegmentStart = nStart;
- aResult.SegmentEnd = nEnd;
- }
- catch (const lang::IndexOutOfBoundsException&)
- {
- // this is not the exception that should be raised in this function ...
- DBG_ASSERT( 0, "unexpected exception" );
- }
- }
- }
- else
- throw lang::IndexOutOfBoundsException();
- }
- return aResult;
- }
-
- // XAccessibleMultiLineText
- ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextAtLineWithCaret( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- ::com::sun::star::accessibility::TextSegment aResult;
- try
- {
- aResult = getTextAtLineNumber( getNumberOfLineWithCaret() );
- }
- catch (const lang::IndexOutOfBoundsException&)
- {
- // this one needs to be catched since this interface does not allow for it.
- }
- return aResult;
- }
-
- // XAccessibleMultiLineText
- sal_Int32 SAL_CALL AccessibleEditableTextPara::getNumberOfLineWithCaret( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- sal_Int32 nRes = -1;
- try
- {
- nRes = getLineNumberAtIndex( getCaretPosition() );
- }
- catch (const lang::IndexOutOfBoundsException&)
- {
- // this one needs to be catched since this interface does not allow for it.
- }
- return nRes;
- }
-
-
- // XServiceInfo
- ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getImplementationName (void) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("AccessibleEditableTextPara"));
- }
-
- sal_Bool SAL_CALL AccessibleEditableTextPara::supportsService (const ::rtl::OUString& sServiceName) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- // Iterate over all supported service names and return true if on of them
- // matches the given name.
- uno::Sequence< ::rtl::OUString> aSupportedServices (
- getSupportedServiceNames ());
- for (int i=0; i<aSupportedServices.getLength(); i++)
- if (sServiceName == aSupportedServices[i])
- return sal_True;
- return sal_False;
- }
-
- uno::Sequence< ::rtl::OUString> SAL_CALL AccessibleEditableTextPara::getSupportedServiceNames (void) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- const ::rtl::OUString sServiceName( getServiceName() );
- return uno::Sequence< ::rtl::OUString > (&sServiceName, 1);
- }
-
- // XServiceName
- ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getServiceName (void) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-
- // #105185# Using correct service now
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.AccessibleParagraphView"));
- }
-
-} // 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
deleted file mode 100644
index 284cc8a11b..0000000000
--- a/editeng/source/accessibility/AccessibleHyperlink.cxx
+++ /dev/null
@@ -1,146 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <comphelper/accessiblekeybindinghelper.hxx>
-
-#include "AccessibleHyperlink.hxx"
-#include "editeng/unoedprx.hxx"
-#include <editeng/flditem.hxx>
-#include <vcl/keycodes.hxx>
-
-using namespace ::com::sun::star;
-
-
-//------------------------------------------------------------------------
-//
-// AccessibleHyperlink implementation
-//
-//------------------------------------------------------------------------
-
-namespace accessibility
-{
-
- AccessibleHyperlink::AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, sal_uInt16 nP, sal_uInt16 nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD )
- : rTA( r )
- {
- pFld = p;
- nPara = nP;
- nRealIdx = nR;
- nStartIdx = nStt;
- nEndIdx = nEnd;
- aDescription = rD;
- }
-
- AccessibleHyperlink::~AccessibleHyperlink()
- {
- delete pFld;
- }
-
- // XAccessibleAction
- sal_Int32 SAL_CALL AccessibleHyperlink::getAccessibleActionCount() throw (uno::RuntimeException)
- {
- return isValid() ? 1 : 0;
- }
-
- sal_Bool SAL_CALL AccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- sal_Bool bRet = sal_False;
- if ( isValid() && ( nIndex == 0 ) )
- {
- rTA.FieldClicked( *pFld, nPara, nRealIdx );
- bRet = sal_True;
- }
- return bRet;
- }
-
- ::rtl::OUString SAL_CALL AccessibleHyperlink::getAccessibleActionDescription( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- ::rtl::OUString aDesc;
-
- if ( isValid() && ( nIndex == 0 ) )
- aDesc = aDescription;
-
- return aDesc;
- }
-
- uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL AccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > xKeyBinding;
-
- if( isValid() && ( nIndex == 0 ) )
- {
- ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper();
- xKeyBinding = pKeyBindingHelper;
-
- awt::KeyStroke aKeyStroke;
- aKeyStroke.Modifiers = 0;
- aKeyStroke.KeyCode = KEY_RETURN;
- aKeyStroke.KeyChar = 0;
- aKeyStroke.KeyFunc = 0;
- pKeyBindingHelper->AddKeyBinding( aKeyStroke );
- }
-
- return xKeyBinding;
- }
-
- // XAccessibleHyperlink
- uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionAnchor( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- return uno::Any();
- }
-
- uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionObject( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- return uno::Any();
- }
-
- sal_Int32 SAL_CALL AccessibleHyperlink::getStartIndex() throw (uno::RuntimeException)
- {
- return nStartIdx;
- }
-
- sal_Int32 SAL_CALL AccessibleHyperlink::getEndIndex() throw (uno::RuntimeException)
- {
- return nEndIdx;
- }
-
- sal_Bool SAL_CALL AccessibleHyperlink::isValid( ) throw (uno::RuntimeException)
- {
- return rTA.IsValid();
- }
-
-} // 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
deleted file mode 100644
index d670aff911..0000000000
--- a/editeng/source/accessibility/AccessibleHyperlink.hxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 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.
- *
- ************************************************************************/
-
-#ifndef _SVX_ACCESSIBLE_HYPERLINK_HXX
-#define _SVX_ACCESSIBLE_HYPERLINK_HXX
-
-#include <cppuhelper/weakref.hxx>
-#include <cppuhelper/compbase1.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
-
-#include <tools/solar.h>
-
-class SvxFieldItem;
-class SvxAccessibleTextAdapter;
-
-namespace accessibility
-{
-
- class AccessibleHyperlink : public ::cppu::WeakImplHelper1< ::com::sun::star::accessibility::XAccessibleHyperlink >
- {
- private:
-
- SvxAccessibleTextAdapter& rTA;
- SvxFieldItem* pFld;
- sal_uInt16 nPara, nRealIdx; // EE values
- sal_Int32 nStartIdx, nEndIdx; // translated values
- ::rtl::OUString aDescription;
-
- public:
- AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, sal_uInt16 nP, sal_uInt16 nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD );
- ~AccessibleHyperlink();
-
- // XAccessibleAction
- virtual sal_Int32 SAL_CALL getAccessibleActionCount() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- // XAccessibleHyperlink
- virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getStartIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getEndIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isValid() throw (::com::sun::star::uno::RuntimeException);
- };
-
-} // end of namespace accessibility
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/accessibility/AccessibleImageBullet.cxx b/editeng/source/accessibility/AccessibleImageBullet.cxx
deleted file mode 100644
index e1dd35b030..0000000000
--- a/editeng/source/accessibility/AccessibleImageBullet.cxx
+++ /dev/null
@@ -1,653 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <tools/gen.hxx>
-#include <osl/mutex.hxx>
-#include <vcl/svapp.hxx>
-#include <rtl/ustring.hxx>
-#include <com/sun/star/awt/Point.hpp>
-#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/accessibility/AccessibleTextType.hpp>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-#include <comphelper/accessibleeventnotifier.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
-#include <editeng/unolingu.hxx>
-#include "editeng/AccessibleEditableTextPara.hxx"
-#include "editeng/AccessibleImageBullet.hxx"
-#include <editeng/eerdll.hxx>
-
-#include <editeng/editdata.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/outliner.hxx>
-#include "editeng.hrc"
-#include <svtools/colorcfg.hxx>
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::accessibility;
-
-namespace accessibility
-{
- DBG_NAME( AccessibleImageBullet )
-
- AccessibleImageBullet::AccessibleImageBullet ( const uno::Reference< XAccessible >& rParent ) :
- mnParagraphIndex( 0 ),
- mnIndexInParent( 0 ),
- mpEditSource( NULL ),
- maEEOffset( 0, 0 ),
- mxParent( rParent ),
- // well, that's strictly (UNO) exception safe, though not
- // really robust. We rely on the fact that this member is
- // constructed last, and that the constructor body catches
- // exceptions, thus no chance for exceptions once the Id is
- // fetched. Nevertheless, normally should employ RAII here...
- mnNotifierClientId(::comphelper::AccessibleEventNotifier::registerClient())
- {
-#ifdef DBG_UTIL
- DBG_CTOR( AccessibleImageBullet, NULL );
- OSL_TRACE( "Received ID: %d", mnNotifierClientId );
-#endif
-
- try
- {
- // Create the state set.
- ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper ();
- mxStateSet = pStateSet;
-
- // these are always on
- pStateSet->AddState( AccessibleStateType::VISIBLE );
- pStateSet->AddState( AccessibleStateType::SHOWING );
- pStateSet->AddState( AccessibleStateType::ENABLED );
- pStateSet->AddState( AccessibleStateType::SENSITIVE );
- }
- catch( const uno::Exception& ) {}
- }
-
- AccessibleImageBullet::~AccessibleImageBullet()
- {
- DBG_DTOR( AccessibleImageBullet, NULL );
-
- // sign off from event notifier
- if( getNotifierClientId() != -1 )
- {
- try
- {
- ::comphelper::AccessibleEventNotifier::revokeClient( getNotifierClientId() );
-#ifdef DBG_UTIL
- OSL_TRACE( "AccessibleImageBullet revoked ID: %d\n", mnNotifierClientId );
-#endif
- }
- catch( const uno::Exception& ) {}
- }
- }
-
- uno::Any SAL_CALL AccessibleImageBullet::queryInterface (const uno::Type & rType) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- return AccessibleImageBulletInterfaceBase::queryInterface(rType);
- }
-
- uno::Reference< XAccessibleContext > SAL_CALL AccessibleImageBullet::getAccessibleContext( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- // We implement the XAccessibleContext interface in the same object
- return uno::Reference< XAccessibleContext > ( this );
- }
-
- sal_Int32 SAL_CALL AccessibleImageBullet::getAccessibleChildCount() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- return 0;
- }
-
- uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleChild( sal_Int32 i ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
- (void)i;
-
- throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No childs available")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* > (this) ) ); // static_cast: disambiguate hierarchy
- }
-
- uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleParent() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- return mxParent;
- }
-
- sal_Int32 SAL_CALL AccessibleImageBullet::getAccessibleIndexInParent() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- return mnIndexInParent;
- }
-
- sal_Int16 SAL_CALL AccessibleImageBullet::getAccessibleRole() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- return AccessibleRole::GRAPHIC;
- }
-
- ::rtl::OUString SAL_CALL AccessibleImageBullet::getAccessibleDescription() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- SolarMutexGuard aGuard;
-
- // Get the string from the resource for the specified id.
- return ::rtl::OUString( String( EditResId (RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION) ) );
- }
-
- ::rtl::OUString SAL_CALL AccessibleImageBullet::getAccessibleName() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- SolarMutexGuard aGuard;
-
- // Get the string from the resource for the specified id.
- return ::rtl::OUString( String ( EditResId (RID_SVXSTR_A11Y_IMAGEBULLET_NAME) ) );
- }
-
- uno::Reference< XAccessibleRelationSet > SAL_CALL AccessibleImageBullet::getAccessibleRelationSet() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- // no relations, therefore empty
- return uno::Reference< XAccessibleRelationSet >();
- }
-
- uno::Reference< XAccessibleStateSet > SAL_CALL AccessibleImageBullet::getAccessibleStateSet() throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- SolarMutexGuard aGuard;
-
- // Create a copy of the state set and return it.
- ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
-
- if( !pStateSet )
- return uno::Reference<XAccessibleStateSet>();
-
- return uno::Reference<XAccessibleStateSet>( new ::utl::AccessibleStateSetHelper (*pStateSet) );
- }
-
- lang::Locale SAL_CALL AccessibleImageBullet::getLocale() throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- SolarMutexGuard aGuard;
-
- lang::Locale aLocale;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleImageBullet::getLocale: paragraph index value overflow");
-
- // return locale of first character in the paragraph
- return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< sal_uInt16 >( GetParagraphIndex() ), 0 ));
- }
-
- void SAL_CALL AccessibleImageBullet::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- if( getNotifierClientId() != -1 )
- ::comphelper::AccessibleEventNotifier::addEventListener( getNotifierClientId(), xListener );
- }
-
- void SAL_CALL AccessibleImageBullet::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- if( getNotifierClientId() != -1 )
- ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener );
- }
-
- sal_Bool SAL_CALL AccessibleImageBullet::containsPoint( const awt::Point& rPoint ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::contains: index value overflow");
-
- awt::Rectangle aTmpRect = getBounds();
- Rectangle aRect( Point(aTmpRect.X, aTmpRect.Y), Size(aTmpRect.Width, aTmpRect.Height) );
- Point aPoint( rPoint.X, rPoint.Y );
-
- return aRect.IsInside( aPoint );
- }
-
- uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleAtPoint( const awt::Point& /*aPoint*/ ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- // as we have no children, empty reference
- return uno::Reference< XAccessible >();
- }
-
- awt::Rectangle SAL_CALL AccessibleImageBullet::getBounds( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
- "AccessibleEditableTextPara::getBounds: index value overflow");
-
- SvxTextForwarder& rCacheTF = GetTextForwarder();
- EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 > (GetParagraphIndex()) );
- Rectangle aParentRect = rCacheTF.GetParaBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ) );
-
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType == SVX_NUM_BITMAP )
- {
- Rectangle aRect = aBulletInfo.aBounds;
-
- // subtract paragraph position (bullet pos is absolute in EditEngine/Outliner)
- aRect.Move( -aParentRect.Left(), -aParentRect.Top() );
-
- // convert to screen coordinates
- Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect,
- rCacheTF.GetMapMode(),
- GetViewForwarder() );
-
- // offset from shape/cell
- Point aOffset = GetEEOffset();
-
- return awt::Rectangle( aScreenRect.Left() + aOffset.X(),
- aScreenRect.Top() + aOffset.Y(),
- aScreenRect.GetSize().Width(),
- aScreenRect.GetSize().Height() );
- }
-
- return awt::Rectangle();
- }
-
- awt::Point SAL_CALL AccessibleImageBullet::getLocation( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- SolarMutexGuard aGuard;
-
- awt::Rectangle aRect = getBounds();
-
- return awt::Point( aRect.X, aRect.Y );
- }
-
- awt::Point SAL_CALL AccessibleImageBullet::getLocationOnScreen( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- SolarMutexGuard aGuard;
-
- // relate us to parent
- uno::Reference< XAccessible > xParent = getAccessibleParent();
- if( xParent.is() )
- {
- uno::Reference< XAccessibleComponent > xParentComponent( xParent, uno::UNO_QUERY );
- if( xParentComponent.is() )
- {
- awt::Point aRefPoint = xParentComponent->getLocationOnScreen();
- awt::Point aPoint = getLocation();
- aPoint.X += aRefPoint.X;
- aPoint.Y += aRefPoint.Y;
-
- return aPoint;
- }
- }
-
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot access parent")),
- uno::Reference< uno::XInterface >
- ( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy
- }
-
- awt::Size SAL_CALL AccessibleImageBullet::getSize( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- SolarMutexGuard aGuard;
-
- awt::Rectangle aRect = getBounds();
-
- return awt::Size( aRect.Width, aRect.Height );
- }
-
- void SAL_CALL AccessibleImageBullet::grabFocus( ) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Not focusable")),
- uno::Reference< uno::XInterface >
- ( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy
- }
-
- sal_Int32 SAL_CALL AccessibleImageBullet::getForeground( ) throw (::com::sun::star::uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- // #104444# Added to XAccessibleComponent interface
- svtools::ColorConfig aColorConfig;
- sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
- return static_cast<sal_Int32>(nColor);
- }
-
- sal_Int32 SAL_CALL AccessibleImageBullet::getBackground( ) throw (::com::sun::star::uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- // #104444# Added to XAccessibleComponent interface
- Color aColor( Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor() );
-
- // the background is transparent
- aColor.SetTransparency( 0xFF);
-
- return static_cast<sal_Int32>( aColor.GetColor() );
- }
-
- ::rtl::OUString SAL_CALL AccessibleImageBullet::getImplementationName (void) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("AccessibleImageBullet"));
- }
-
- sal_Bool SAL_CALL AccessibleImageBullet::supportsService (const ::rtl::OUString& sServiceName) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- // Iterate over all supported service names and return true if on of them
- // matches the given name.
- uno::Sequence< ::rtl::OUString> aSupportedServices (
- getSupportedServiceNames ());
- for (int i=0; i<aSupportedServices.getLength(); i++)
- if (sServiceName == aSupportedServices[i])
- return sal_True;
- return sal_False;
- }
-
- uno::Sequence< ::rtl::OUString> SAL_CALL AccessibleImageBullet::getSupportedServiceNames (void) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- const ::rtl::OUString sServiceName (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.accessibility.AccessibleContext"));
- return uno::Sequence< ::rtl::OUString > (&sServiceName, 1);
- }
-
- ::rtl::OUString SAL_CALL AccessibleImageBullet::getServiceName (void) throw (uno::RuntimeException)
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext"));
- }
-
- void AccessibleImageBullet::SetIndexInParent( sal_Int32 nIndex )
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- mnIndexInParent = nIndex;
- }
-
- sal_Int32 AccessibleImageBullet::GetIndexInParent() const
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- return mnIndexInParent;
- }
-
- void AccessibleImageBullet::SetEEOffset( const Point& rOffset )
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- maEEOffset = rOffset;
- }
-
- void AccessibleImageBullet::Dispose()
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- int nClientId( getNotifierClientId() );
-
- // #108212# drop all references before notifying dispose
- mxParent = NULL;
- mnNotifierClientId = -1;
- mpEditSource = NULL;
-
- // notify listeners
- if( nClientId != -1 )
- {
- try
- {
- uno::Reference < XAccessibleContext > xThis = getAccessibleContext();
-
- // #106234# Delegate to EventNotifier
- ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, xThis );
-#ifdef DBG_UTIL
- OSL_TRACE( "AccessibleImageBullet disposed ID: %d", nClientId );
-#endif
- }
- catch( const uno::Exception& ) {}
- }
- }
-
- void AccessibleImageBullet::SetEditSource( SvxEditSource* pEditSource )
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- mpEditSource = pEditSource;
-
- if( !mpEditSource )
- {
- // going defunc
- UnSetState( AccessibleStateType::SHOWING );
- UnSetState( AccessibleStateType::VISIBLE );
- SetState( AccessibleStateType::INVALID );
- SetState( AccessibleStateType::DEFUNC );
-
- Dispose();
- }
- }
-
- void AccessibleImageBullet::FireEvent(const sal_Int16 nEventId, const uno::Any& rNewValue, const uno::Any& rOldValue ) const
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- uno::Reference < XAccessibleContext > xThis( const_cast< AccessibleImageBullet* > (this)->getAccessibleContext() );
-
- AccessibleEventObject aEvent(xThis, nEventId, rNewValue, rOldValue);
-
- // #106234# Delegate to EventNotifier
- ::comphelper::AccessibleEventNotifier::addEvent( getNotifierClientId(),
- aEvent );
- }
-
- void AccessibleImageBullet::GotPropertyEvent( const uno::Any& rNewValue, const sal_Int16 nEventId ) const
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- FireEvent( nEventId, rNewValue );
- }
-
- void AccessibleImageBullet::LostPropertyEvent( const uno::Any& rOldValue, const sal_Int16 nEventId ) const
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- FireEvent( nEventId, uno::Any(), rOldValue );
- }
-
- void AccessibleImageBullet::SetState( const sal_Int16 nStateId )
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
- if( pStateSet != NULL &&
- !pStateSet->contains(nStateId) )
- {
- pStateSet->AddState( nStateId );
- GotPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED );
- }
- }
-
- void AccessibleImageBullet::UnSetState( const sal_Int16 nStateId )
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
- if( pStateSet != NULL &&
- pStateSet->contains(nStateId) )
- {
- pStateSet->RemoveState( nStateId );
- LostPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED );
- }
- }
-
- int AccessibleImageBullet::getNotifierClientId() const
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- return mnNotifierClientId;
- }
-
- void AccessibleImageBullet::SetParagraphIndex( sal_Int32 nIndex )
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- uno::Any aOldDesc;
- uno::Any aOldName;
-
- try
- {
- aOldDesc <<= getAccessibleDescription();
- aOldName <<= getAccessibleName();
- }
- catch( const uno::Exception& ) {} // optional behaviour
-
- sal_Int32 nOldIndex = mnParagraphIndex;
-
- mnParagraphIndex = nIndex;
-
- try
- {
- if( nOldIndex != nIndex )
- {
- // index and therefore description changed
- FireEvent( AccessibleEventId::DESCRIPTION_CHANGED, uno::makeAny( getAccessibleDescription() ), aOldDesc );
- FireEvent( AccessibleEventId::NAME_CHANGED, uno::makeAny( getAccessibleName() ), aOldName );
- }
- }
- catch( const uno::Exception& ) {} // optional behaviour
- }
-
- sal_Int32 AccessibleImageBullet::GetParagraphIndex() const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- return mnParagraphIndex;
- }
-
- SvxEditSource& AccessibleImageBullet::GetEditSource() const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- if( mpEditSource )
- return *mpEditSource;
- else
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No edit source, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy
- }
-
- SvxTextForwarder& AccessibleImageBullet::GetTextForwarder() const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- SvxEditSource& rEditSource = GetEditSource();
- SvxTextForwarder* pTextForwarder = rEditSource.GetTextForwarder();
-
- if( !pTextForwarder )
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch text forwarder, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy
-
- if( pTextForwarder->IsValid() )
- return *pTextForwarder;
- else
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text forwarder is invalid, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy
- }
-
- SvxViewForwarder& AccessibleImageBullet::GetViewForwarder() const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- SvxEditSource& rEditSource = GetEditSource();
- SvxViewForwarder* pViewForwarder = rEditSource.GetViewForwarder();
-
- if( !pViewForwarder )
- {
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch view forwarder, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy
- }
-
- if( pViewForwarder->IsValid() )
- return *pViewForwarder;
- else
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, object is defunct")),
- uno::Reference< uno::XInterface >
- ( static_cast< ::cppu::OWeakObject* >
- ( const_cast< AccessibleImageBullet* > (this) ) ) ); // disambiguate hierarchy
- }
-
- const Point& AccessibleImageBullet::GetEEOffset() const
- {
- DBG_CHKTHIS( AccessibleImageBullet, NULL );
-
- return maEEOffset;
- }
-
-} // 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
deleted file mode 100644
index 99932e13fe..0000000000
--- a/editeng/source/accessibility/AccessibleParaManager.cxx
+++ /dev/null
@@ -1,422 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-//------------------------------------------------------------------------
-//
-// Global header
-//
-//------------------------------------------------------------------------
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <cppuhelper/weakref.hxx>
-#include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-
-//------------------------------------------------------------------------
-//
-// Project-local header
-//
-//------------------------------------------------------------------------
-
-#include <editeng/unoedhlp.hxx>
-#include <editeng/unopracc.hxx>
-#include <editeng/unoedsrc.hxx>
-#include "editeng/AccessibleParaManager.hxx"
-#include "editeng/AccessibleEditableTextPara.hxx"
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::accessibility;
-
-
-
-namespace accessibility
-{
- AccessibleParaManager::AccessibleParaManager() :
- maChildren(1),
- maEEOffset( 0, 0 ),
- mnFocusedChild( -1 ),
- mbActive( sal_False )
- {
- }
-
- AccessibleParaManager::~AccessibleParaManager()
- {
- // owner is responsible for possible child defuncs
- }
-
- void AccessibleParaManager::SetAdditionalChildStates( const VectorOfStates& rChildStates )
- {
- maChildStates = rChildStates;
- }
-
- const AccessibleParaManager::VectorOfStates& AccessibleParaManager::GetAdditionalChildStates() const
- {
- return maChildStates;
- }
-
- void AccessibleParaManager::SetNum( sal_Int32 nNumParas )
- {
- if( (size_t)nNumParas < maChildren.size() )
- Release( nNumParas, maChildren.size() );
-
- maChildren.resize( nNumParas );
-
- if( mnFocusedChild >= nNumParas )
- mnFocusedChild = -1;
- }
-
- sal_uInt32 AccessibleParaManager::GetNum() const
- {
- return maChildren.size();
- }
-
- AccessibleParaManager::VectorOfChildren::iterator AccessibleParaManager::begin()
- {
- return maChildren.begin();
- }
-
- AccessibleParaManager::VectorOfChildren::iterator AccessibleParaManager::end()
- {
- return maChildren.end();
- }
-
- AccessibleParaManager::VectorOfChildren::const_iterator AccessibleParaManager::begin() const
- {
- return maChildren.begin();
- }
-
- AccessibleParaManager::VectorOfChildren::const_iterator AccessibleParaManager::end() const
- {
- return maChildren.end();
- }
-
- void AccessibleParaManager::Release( sal_uInt32 nPara )
- {
- DBG_ASSERT( maChildren.size() > nPara, "AccessibleParaManager::Release: invalid index" );
-
- if( maChildren.size() > nPara )
- {
- ShutdownPara( GetChild( nPara ) );
-
- // clear reference and rect
- maChildren[ nPara ] = WeakChild();
- }
- }
-
- void AccessibleParaManager::FireEvent( sal_uInt32 nPara,
- const sal_Int16 nEventId,
- const uno::Any& rNewValue,
- const uno::Any& rOldValue ) const
- {
- DBG_ASSERT( maChildren.size() > nPara, "AccessibleParaManager::FireEvent: invalid index" );
-
- if( maChildren.size() > nPara )
- {
- WeakPara::HardRefType maChild( GetChild( nPara ).first.get() );
- if( maChild.is() )
- maChild->FireEvent( nEventId, rNewValue, rOldValue );
- }
- }
-
- sal_Bool AccessibleParaManager::IsReferencable( WeakPara::HardRefType aChild )
- {
- return aChild.is();
- }
-
- sal_Bool AccessibleParaManager::IsReferencable( sal_uInt32 nChild ) const
- {
- DBG_ASSERT( maChildren.size() > nChild, "AccessibleParaManager::IsReferencable: invalid index" );
-
- if( maChildren.size() > nChild )
- {
- // retrieve hard reference from weak one
- return IsReferencable( GetChild( nChild ).first.get() );
- }
- else
- {
- return sal_False;
- }
- }
-
- AccessibleParaManager::WeakChild AccessibleParaManager::GetChild( sal_uInt32 nParagraphIndex ) const
- {
- DBG_ASSERT( maChildren.size() > nParagraphIndex, "AccessibleParaManager::GetChild: invalid index" );
-
- if( maChildren.size() > nParagraphIndex )
- {
- return maChildren[ nParagraphIndex ];
- }
- else
- {
- return WeakChild();
- }
- }
-
- AccessibleParaManager::Child AccessibleParaManager::CreateChild( sal_Int32 nChild,
- const uno::Reference< XAccessible >& xFrontEnd,
- SvxEditSourceAdapter& rEditSource,
- sal_uInt32 nParagraphIndex )
- {
- DBG_ASSERT( maChildren.size() > nParagraphIndex, "AccessibleParaManager::CreateChild: invalid index" );
-
- if( maChildren.size() > nParagraphIndex )
- {
- // retrieve hard reference from weak one
- WeakPara::HardRefType aChild( GetChild( nParagraphIndex ).first.get() );
-
- if( !IsReferencable( nParagraphIndex ) )
- {
- // there is no hard reference available, create object then
- // #i27138#
- AccessibleEditableTextPara* pChild = new AccessibleEditableTextPara( xFrontEnd, this );
- uno::Reference< XAccessible > xChild( static_cast< ::cppu::OWeakObject* > (pChild), uno::UNO_QUERY );
-
- if( !xChild.is() )
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Child creation failed")), xFrontEnd);
-
- aChild = WeakPara::HardRefType( xChild, pChild );
-
- InitChild( *aChild, rEditSource, nChild, nParagraphIndex );
-
- maChildren[ nParagraphIndex ] = WeakChild( aChild, pChild->getBounds() );
- }
-
- return Child( aChild.getRef(), GetChild( nParagraphIndex ).second );
- }
- else
- {
- return Child();
- }
- }
-
- void AccessibleParaManager::SetEEOffset( const Point& rOffset )
- {
- maEEOffset = rOffset;
-
- MemFunAdapter< const Point& > aAdapter( &::accessibility::AccessibleEditableTextPara::SetEEOffset, rOffset );
- ::std::for_each( begin(), end(), aAdapter );
- }
-
- void AccessibleParaManager::SetActive( sal_Bool bActive )
- {
- mbActive = bActive;
-
- if( bActive )
- {
- SetState( AccessibleStateType::ACTIVE );
- SetState( AccessibleStateType::EDITABLE );
- }
- else
- {
- UnSetState( AccessibleStateType::ACTIVE );
- UnSetState( AccessibleStateType::EDITABLE );
- }
- }
-
- void AccessibleParaManager::SetFocus( sal_Int32 nChild )
- {
- if( mnFocusedChild != -1 )
- UnSetState( mnFocusedChild, AccessibleStateType::FOCUSED );
-
- mnFocusedChild = nChild;
-
- if( mnFocusedChild != -1 )
- SetState( mnFocusedChild, AccessibleStateType::FOCUSED );
- }
-
- void AccessibleParaManager::InitChild( AccessibleEditableTextPara& rChild,
- SvxEditSourceAdapter& rEditSource,
- sal_Int32 nChild,
- sal_uInt32 nParagraphIndex ) const
- {
- rChild.SetEditSource( &rEditSource );
- rChild.SetIndexInParent( nChild );
- rChild.SetParagraphIndex( nParagraphIndex );
-
- rChild.SetEEOffset( maEEOffset );
-
- if( mbActive )
- {
- rChild.SetState( AccessibleStateType::ACTIVE );
- rChild.SetState( AccessibleStateType::EDITABLE );
- }
-
- if( mnFocusedChild == static_cast<sal_Int32>(nParagraphIndex) )
- rChild.SetState( AccessibleStateType::FOCUSED );
-
- // add states passed from outside
- for( VectorOfStates::const_iterator aIt = maChildStates.begin(), aEnd = maChildStates.end(); aIt != aEnd; ++aIt )
- rChild.SetState( *aIt );
- }
-
- void AccessibleParaManager::SetState( sal_Int32 nChild, const sal_Int16 nStateId )
- {
- MemFunAdapter< const sal_Int16 > aFunc( &AccessibleEditableTextPara::SetState,
- nStateId );
- aFunc( GetChild(nChild) );
- }
-
- void AccessibleParaManager::SetState( const sal_Int16 nStateId )
- {
- ::std::for_each( begin(), end(),
- MemFunAdapter< const sal_Int16 >( &AccessibleEditableTextPara::SetState,
- nStateId ) );
- }
-
- void AccessibleParaManager::UnSetState( sal_Int32 nChild, const sal_Int16 nStateId )
- {
- MemFunAdapter< const sal_Int16 > aFunc( &AccessibleEditableTextPara::UnSetState,
- nStateId );
- aFunc( GetChild(nChild) );
- }
-
- void AccessibleParaManager::UnSetState( const sal_Int16 nStateId )
- {
- ::std::for_each( begin(), end(),
- MemFunAdapter< const sal_Int16 >( &AccessibleEditableTextPara::UnSetState,
- nStateId ) );
- }
-
- void AccessibleParaManager::SetEditSource( SvxEditSourceAdapter* pEditSource )
- {
- MemFunAdapter< SvxEditSourceAdapter* > aAdapter( &::accessibility::AccessibleEditableTextPara::SetEditSource, pEditSource );
- ::std::for_each( begin(), end(), aAdapter );
- }
-
- // not generic yet, no arguments...
- class AccessibleParaManager_DisposeChildren : public ::std::unary_function< ::accessibility::AccessibleEditableTextPara&, void >
- {
- public:
- AccessibleParaManager_DisposeChildren() {}
- void operator()( ::accessibility::AccessibleEditableTextPara& rPara )
- {
- rPara.Dispose();
- }
- };
-
- void AccessibleParaManager::Dispose()
- {
- AccessibleParaManager_DisposeChildren aFunctor;
-
- ::std::for_each( begin(), end(),
- WeakChildAdapter< AccessibleParaManager_DisposeChildren > (aFunctor) );
- }
-
- // not generic yet, too many method arguments...
- class StateChangeEvent : public ::std::unary_function< ::accessibility::AccessibleEditableTextPara&, void >
- {
- public:
- typedef void return_type;
- StateChangeEvent( const sal_Int16 nEventId,
- const uno::Any& rNewValue,
- const uno::Any& rOldValue ) :
- mnEventId( nEventId ),
- mrNewValue( rNewValue ),
- mrOldValue( rOldValue ) {}
- void operator()( ::accessibility::AccessibleEditableTextPara& rPara )
- {
- rPara.FireEvent( mnEventId, mrNewValue, mrOldValue );
- }
-
- private:
- const sal_Int16 mnEventId;
- const uno::Any& mrNewValue;
- const uno::Any& mrOldValue;
- };
-
- void AccessibleParaManager::FireEvent( sal_uInt32 nStartPara,
- sal_uInt32 nEndPara,
- const sal_Int16 nEventId,
- const uno::Any& rNewValue,
- const uno::Any& rOldValue ) const
- {
- DBG_ASSERT( maChildren.size() > nStartPara &&
- maChildren.size() >= nEndPara , "AccessibleParaManager::FireEvent: invalid index" );
-
- if( maChildren.size() > nStartPara &&
- maChildren.size() >= nEndPara )
- {
- VectorOfChildren::const_iterator front = maChildren.begin();
- VectorOfChildren::const_iterator back = front;
-
- ::std::advance( front, nStartPara );
- ::std::advance( back, nEndPara );
-
- StateChangeEvent aFunctor( nEventId, rNewValue, rOldValue );
-
- ::std::for_each( front, back, AccessibleParaManager::WeakChildAdapter< StateChangeEvent >( aFunctor ) );
- }
- }
-
- class ReleaseChild : public ::std::unary_function< const AccessibleParaManager::WeakChild&, AccessibleParaManager::WeakChild >
- {
- public:
- AccessibleParaManager::WeakChild operator()( const AccessibleParaManager::WeakChild& rPara )
- {
- AccessibleParaManager::ShutdownPara( rPara );
-
- // clear reference
- return AccessibleParaManager::WeakChild();
- }
- };
-
- void AccessibleParaManager::Release( sal_uInt32 nStartPara, sal_uInt32 nEndPara )
- {
- DBG_ASSERT( maChildren.size() > nStartPara &&
- maChildren.size() >= nEndPara, "AccessibleParaManager::Release: invalid index" );
-
- if( maChildren.size() > nStartPara &&
- maChildren.size() >= nEndPara )
- {
- VectorOfChildren::iterator front = maChildren.begin();
- VectorOfChildren::iterator back = front;
-
- ::std::advance( front, nStartPara );
- ::std::advance( back, nEndPara );
-
- ::std::transform( front, back, front, ReleaseChild() );
- }
- }
-
- void AccessibleParaManager::ShutdownPara( const WeakChild& rChild )
- {
- WeakPara::HardRefType aChild( rChild.first.get() );
-
- if( IsReferencable( aChild ) )
- aChild->SetEditSource( NULL );
- }
-
-}
-
-//------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/accessibility/AccessibleSelectionBase.cxx b/editeng/source/accessibility/AccessibleSelectionBase.cxx
deleted file mode 100644
index 7235169368..0000000000
--- a/editeng/source/accessibility/AccessibleSelectionBase.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <editeng/AccessibleSelectionBase.hxx>
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::accessibility;
-
-namespace accessibility
-{
- // ---------------------------
- // - AccessibleSelectionBase -
- // ---------------------------
-
- AccessibleSelectionBase::AccessibleSelectionBase()
- {
- }
-
- //--------------------------------------------------------------------
-
- AccessibleSelectionBase::~AccessibleSelectionBase()
- {
- }
-
- //--------------------------------------------------------------------
-
- void SAL_CALL AccessibleSelectionBase::selectAccessibleChild( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- ::osl::MutexGuard aGuard( implGetMutex() );
- OCommonAccessibleSelection::selectAccessibleChild( nChildIndex );
- }
-
- //--------------------------------------------------------------------
-
- sal_Bool SAL_CALL AccessibleSelectionBase::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- ::osl::MutexGuard aGuard( implGetMutex() );
- return( OCommonAccessibleSelection::isAccessibleChildSelected( nChildIndex ) );
- }
-
- //--------------------------------------------------------------------
-
- void SAL_CALL AccessibleSelectionBase::clearAccessibleSelection( ) throw (uno::RuntimeException)
- {
- ::osl::MutexGuard aGuard( implGetMutex() );
- OCommonAccessibleSelection::clearAccessibleSelection();
- }
-
- //--------------------------------------------------------------------
-
- void SAL_CALL AccessibleSelectionBase::selectAllAccessibleChildren( ) throw (uno::RuntimeException)
- {
- ::osl::MutexGuard aGuard( implGetMutex() );
- OCommonAccessibleSelection::selectAllAccessibleChildren();
- }
-
- //--------------------------------------------------------------------
-
- sal_Int32 SAL_CALL AccessibleSelectionBase::getSelectedAccessibleChildCount( ) throw (uno::RuntimeException)
- {
- ::osl::MutexGuard aGuard( implGetMutex() );
- return( OCommonAccessibleSelection::getSelectedAccessibleChildCount() );
- }
-
- //--------------------------------------------------------------------
-
- uno::Reference< XAccessible > SAL_CALL AccessibleSelectionBase::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- ::osl::MutexGuard aGuard( implGetMutex() );
- return( OCommonAccessibleSelection::getSelectedAccessibleChild( nSelectedChildIndex ) );
- }
-
- //--------------------------------------------------------------------
-
- void SAL_CALL AccessibleSelectionBase::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- ::osl::MutexGuard aGuard( implGetMutex() );
- OCommonAccessibleSelection::deselectAccessibleChild( nSelectedChildIndex );
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
deleted file mode 100644
index b6a55541ec..0000000000
--- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx
+++ /dev/null
@@ -1,1050 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-//------------------------------------------------------------------------
-//
-// Global header
-//
-//------------------------------------------------------------------------
-
-#include <limits.h>
-#include <vector>
-#include <algorithm>
-#include <boost/bind.hpp>
-#include <osl/mutex.hxx>
-#include <vcl/window.hxx>
-#include <vcl/svapp.hxx>
-#include <comphelper/sequenceasvector.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/awt/Point.hpp>
-#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/accessibility/AccessibleTextType.hpp>
-
-//------------------------------------------------------------------------
-//
-// Project-local header
-//
-//------------------------------------------------------------------------
-
-#include <editeng/editdata.hxx>
-#include <editeng/unopracc.hxx>
-#include "editeng/unoedprx.hxx"
-#include <editeng/AccessibleStaticTextBase.hxx>
-#include "editeng/AccessibleEditableTextPara.hxx"
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::accessibility;
-
-/* TODO:
- =====
-
- - separate adapter functionality from AccessibleStaticText class
-
- - refactor common loops into templates, using mem_fun
-
- */
-
-namespace accessibility
-{
- typedef ::comphelper::SequenceAsVector< beans::PropertyValue > PropertyValueVector;
-
- class PropertyValueEqualFunctor : public ::std::binary_function< beans::PropertyValue, beans::PropertyValue, bool >
- {
- public:
- PropertyValueEqualFunctor()
- {}
- bool operator() ( const beans::PropertyValue& lhs, const beans::PropertyValue& rhs ) const
- {
- return ( lhs.Name == rhs.Name && lhs.Value == rhs.Value );
- }
- };
-
- //------------------------------------------------------------------------
- //
- // Static Helper
- //
- //------------------------------------------------------------------------
- ESelection MakeSelection( sal_Int32 nStartPara, sal_Int32 nStartIndex,
- sal_Int32 nEndPara, sal_Int32 nEndIndex )
- {
- DBG_ASSERT(nStartPara >= 0 && nStartPara <= USHRT_MAX &&
- nStartIndex >= 0 && nStartIndex <= USHRT_MAX &&
- nEndPara >= 0 && nEndPara <= USHRT_MAX &&
- nEndIndex >= 0 && nEndIndex <= USHRT_MAX ,
- "AccessibleStaticTextBase_Impl::MakeSelection: index value overflow");
-
- return ESelection( static_cast< sal_uInt16 >(nStartPara), static_cast< sal_uInt16 >(nStartIndex),
- static_cast< sal_uInt16 >(nEndPara), static_cast< sal_uInt16 >(nEndIndex) );
- }
-
- //------------------------------------------------------------------------
- //
- // AccessibleStaticTextBase_Impl declaration
- //
- //------------------------------------------------------------------------
-
- DBG_NAME( AccessibleStaticTextBase_Impl );
-
- /** AccessibleStaticTextBase_Impl
-
- This class implements the AccessibleStaticTextBase
- functionality, mainly by forwarding the calls to an aggregated
- AccessibleEditableTextPara. As this is a therefore non-trivial
- adapter, factoring out the common functionality from
- AccessibleEditableTextPara might be a profitable future task.
- */
- class AccessibleStaticTextBase_Impl
- {
-
- public:
-
- // receive pointer to our frontend class and view window
- AccessibleStaticTextBase_Impl();
- ~AccessibleStaticTextBase_Impl();
-
- SvxEditSourceAdapter& GetEditSource() const SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- return maEditSource;
- }
- void SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((uno::RuntimeException));
-
- void SetEventSource( const uno::Reference< XAccessible >& rInterface )
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- mxThis = rInterface;
- }
- uno::Reference< XAccessible > GetEventSource() const
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- return mxThis;
- }
-
- void SetOffset( const Point& );
- Point GetOffset() const
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- ::osl::MutexGuard aGuard( maMutex ); Point aPoint( maOffset );
- return aPoint;
- }
-
- void UpdateChildren();
- void Dispose();
-
-#ifdef DBG_UTIL
- void CheckInvariants() const;
-#endif
-
- AccessibleEditableTextPara& GetParagraph( sal_Int32 nPara ) const;
- sal_Int32 GetParagraphCount() const;
- sal_Int32 GetParagraphIndex() const;
- sal_Int32 GetLineCount( sal_Int32 nParagraph ) const;
-
- EPosition Index2Internal( sal_Int32 nFlatIndex ) const
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- return ImpCalcInternal( nFlatIndex, false );
- }
-
- EPosition Range2Internal( sal_Int32 nFlatIndex ) const
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- return ImpCalcInternal( nFlatIndex, true );
- }
-
- sal_Int32 Internal2Index( EPosition nEEIndex ) const;
-
- void CorrectTextSegment( TextSegment& aTextSegment,
- int nPara ) const;
-
- sal_Bool SetSelection( sal_Int32 nStartPara, sal_Int32 nStartIndex,
- sal_Int32 nEndPara, sal_Int32 nEndIndex );
- sal_Bool CopyText( sal_Int32 nStartPara, sal_Int32 nStartIndex,
- sal_Int32 nEndPara, sal_Int32 nEndIndex );
-
- Rectangle GetParagraphBoundingBox() const;
-
- private:
-
- EPosition ImpCalcInternal( sal_Int32 nFlatIndex, bool bExclusive ) const;
-
- // our frontend class (the one implementing the actual
- // interface). That's not necessarily the one containing the impl
- // pointer
- uno::Reference< XAccessible > mxThis;
-
- // implements our functionality, we're just an adapter (guarded by solar mutex)
- mutable AccessibleEditableTextPara* mpTextParagraph;
-
- uno::Reference< XAccessible > mxParagraph;
-
- // a wrapper for the text forwarders (guarded by solar mutex)
- mutable SvxEditSourceAdapter maEditSource;
-
- // guard for maOffset
- mutable ::osl::Mutex maMutex;
-
- /// our current offset to the containing shape/cell (guarded by maMutex)
- Point maOffset;
-
- };
-
- //------------------------------------------------------------------------
- //
- // AccessibleStaticTextBase_Impl implementation
- //
- //------------------------------------------------------------------------
-
- AccessibleStaticTextBase_Impl::AccessibleStaticTextBase_Impl() :
- mxThis( NULL ),
- mpTextParagraph( new AccessibleEditableTextPara(NULL) ),
- mxParagraph( mpTextParagraph ),
- maEditSource(),
- maMutex(),
- maOffset(0,0)
- {
- DBG_CTOR( AccessibleStaticTextBase_Impl, NULL );
-
- // TODO: this is still somewhat of a hack, all the more since
- // now the maTextParagraph has an empty parent reference set
- }
-
- AccessibleStaticTextBase_Impl::~AccessibleStaticTextBase_Impl()
- {
- DBG_DTOR( AccessibleStaticTextBase_Impl, NULL );
- }
-
- void AccessibleStaticTextBase_Impl::SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((uno::RuntimeException))
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- maEditSource.SetEditSource( pEditSource );
- if( mpTextParagraph )
- mpTextParagraph->SetEditSource( &maEditSource );
- }
-
- void AccessibleStaticTextBase_Impl::SetOffset( const Point& rPoint )
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- // guard against non-atomic access to maOffset data structure
- {
- ::osl::MutexGuard aGuard( maMutex );
- maOffset = rPoint;
- }
-
- if( mpTextParagraph )
- mpTextParagraph->SetEEOffset( rPoint );
-
- // in all cases, check visibility afterwards.
- UpdateChildren();
- }
-
- void AccessibleStaticTextBase_Impl::UpdateChildren()
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- // currently no children
- }
-
- void AccessibleStaticTextBase_Impl::Dispose()
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- // we're the owner of the paragraph, so destroy it, too
- if( mpTextParagraph )
- mpTextParagraph->Dispose();
-
- // drop references
- mxParagraph = NULL;
- mxThis = NULL;
- mpTextParagraph = NULL;
- }
-
-#ifdef DBG_UTIL
- void AccessibleStaticTextBase_Impl::CheckInvariants() const
- {
- // TODO
- }
-#endif
-
- AccessibleEditableTextPara& AccessibleStaticTextBase_Impl::GetParagraph( sal_Int32 nPara ) const
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- if( !mpTextParagraph )
- throw lang::DisposedException (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")), mxThis );
-
- // TODO: Have a differnt method on AccessibleEditableTextPara
- // that does not care about state changes
- mpTextParagraph->SetParagraphIndex( nPara );
-
- return *mpTextParagraph;
- }
-
- sal_Int32 AccessibleStaticTextBase_Impl::GetParagraphCount() const
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- if( !mpTextParagraph )
- return 0;
- else
- return mpTextParagraph->GetTextForwarder().GetParagraphCount();
- }
-
- sal_Int32 AccessibleStaticTextBase_Impl::GetParagraphIndex() const
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- sal_Int32 nIndex = -1;
- if( mpTextParagraph )
- nIndex = mpTextParagraph->GetParagraphIndex();
- return nIndex;
- }
-
- sal_Int32 AccessibleStaticTextBase_Impl::GetLineCount( sal_Int32 nParagraph ) const
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- sal_Int32 nIndex = 0;
- if( mpTextParagraph )
- nIndex = mpTextParagraph->GetTextForwarder().GetLineCount( static_cast< sal_uInt16 >(nParagraph) );
- return nIndex;
- }
-
- sal_Int32 AccessibleStaticTextBase_Impl::Internal2Index( EPosition nEEIndex ) const
- {
- sal_Int32 aRes(0);
- int i;
- for(i=0; i<nEEIndex.nPara; ++i)
- aRes += GetParagraph(i).getCharacterCount();
-
- return aRes + nEEIndex.nIndex;
- }
-
- void AccessibleStaticTextBase_Impl::CorrectTextSegment( TextSegment& aTextSegment,
- int nPara ) const
- {
- // Keep 'invalid' values at the TextSegment
- if( aTextSegment.SegmentStart != -1 &&
- aTextSegment.SegmentStart != -1 )
- {
- // #112814# Correct TextSegment by paragraph offset
- sal_Int32 nOffset(0);
- int i;
- for(i=0; i<nPara; ++i)
- nOffset += GetParagraph(i).getCharacterCount();
-
- aTextSegment.SegmentStart += nOffset;
- aTextSegment.SegmentEnd += nOffset;
- }
- }
-
- EPosition AccessibleStaticTextBase_Impl::ImpCalcInternal( sal_Int32 nFlatIndex, bool bExclusive ) const
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- if( nFlatIndex < 0 )
- throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleStaticTextBase_Impl::Index2Internal: character index out of bounds")),
- mxThis);
- // gratuitously accepting larger indices here, AccessibleEditableTextPara will throw eventually
-
- sal_Int32 nCurrPara, nCurrIndex, nParas, nCurrCount;
- for( nCurrPara=0, nParas=GetParagraphCount(), nCurrCount=0, nCurrIndex=0; nCurrPara<nParas; ++nCurrPara )
- {
- nCurrCount = GetParagraph( nCurrPara ).getCharacterCount();
- nCurrIndex += nCurrCount;
-
- if( nCurrIndex > nFlatIndex )
- {
- // check overflow
- DBG_ASSERT(nCurrPara >= 0 && nCurrPara <= USHRT_MAX &&
- nFlatIndex - nCurrIndex + nCurrCount >= 0 && nFlatIndex - nCurrIndex + nCurrCount <= USHRT_MAX ,
- "AccessibleStaticTextBase_Impl::Index2Internal: index value overflow");
-
- return EPosition( static_cast< sal_uInt16 >(nCurrPara), static_cast< sal_uInt16 >(nFlatIndex - nCurrIndex + nCurrCount) );
- }
- }
-
- // #102170# Allow one-past the end for ranges
- if( bExclusive && nCurrIndex == nFlatIndex )
- {
- // check overflow
- DBG_ASSERT(nCurrPara >= 0 && nCurrPara <= USHRT_MAX &&
- nFlatIndex - nCurrIndex + nCurrCount >= 0 && nFlatIndex - nCurrIndex + nCurrCount <= USHRT_MAX ,
- "AccessibleStaticTextBase_Impl::Index2Internal: index value overflow");
-
- return EPosition( static_cast< sal_uInt16 >(nCurrPara-1), static_cast< sal_uInt16 >(nFlatIndex - nCurrIndex + nCurrCount) );
- }
-
- // not found? Out of bounds
- throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleStaticTextBase_Impl::Index2Internal: character index out of bounds")),
- mxThis);
- }
-
- sal_Bool AccessibleStaticTextBase_Impl::SetSelection( sal_Int32 nStartPara, sal_Int32 nStartIndex,
- sal_Int32 nEndPara, sal_Int32 nEndIndex )
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- if( !mpTextParagraph )
- return sal_False;
-
- try
- {
- SvxEditViewForwarder& rCacheVF = mpTextParagraph->GetEditViewForwarder( sal_True );
- return rCacheVF.SetSelection( MakeSelection(nStartPara, nStartIndex, nEndPara, nEndIndex) );
- }
- catch( const uno::RuntimeException& )
- {
- return sal_False;
- }
- }
-
- sal_Bool AccessibleStaticTextBase_Impl::CopyText( sal_Int32 nStartPara, sal_Int32 nStartIndex,
- sal_Int32 nEndPara, sal_Int32 nEndIndex )
- {
- DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL );
-
- if( !mpTextParagraph )
- return sal_False;
-
- try
- {
- SvxEditViewForwarder& rCacheVF = mpTextParagraph->GetEditViewForwarder( sal_True );
- mpTextParagraph->GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs
- sal_Bool aRetVal;
-
- // save current selection
- ESelection aOldSelection;
-
- rCacheVF.GetSelection( aOldSelection );
- rCacheVF.SetSelection( MakeSelection(nStartPara, nStartIndex, nEndPara, nEndIndex) );
- aRetVal = rCacheVF.Copy();
- rCacheVF.SetSelection( aOldSelection ); // restore
-
- return aRetVal;
- }
- catch( const uno::RuntimeException& )
- {
- return sal_False;
- }
- }
-
- Rectangle AccessibleStaticTextBase_Impl::GetParagraphBoundingBox() const
- {
- Rectangle aRect;
- if( mpTextParagraph )
- {
- awt::Rectangle aAwtRect = mpTextParagraph->getBounds();
- aRect = Rectangle( Point( aAwtRect.X, aAwtRect.Y ), Size( aAwtRect.Width, aAwtRect.Height ) );
- }
- else
- {
- aRect.SetEmpty();
- }
- return aRect;
- }
-
- //------------------------------------------------------------------------
- //
- // AccessibleStaticTextBase implementation
- //
- //------------------------------------------------------------------------
-
- AccessibleStaticTextBase::AccessibleStaticTextBase( ::std::auto_ptr< SvxEditSource > pEditSource ) :
- mpImpl( new AccessibleStaticTextBase_Impl() )
- {
- SolarMutexGuard aGuard;
-
- SetEditSource( pEditSource );
- }
-
- AccessibleStaticTextBase::~AccessibleStaticTextBase()
- {
- }
-
- const SvxEditSource& AccessibleStaticTextBase::GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException))
- {
-#ifdef DBG_UTIL
- mpImpl->CheckInvariants();
-
- const SvxEditSource& aEditSource = mpImpl->GetEditSource();
-
- mpImpl->CheckInvariants();
-
- return aEditSource;
-#else
- return mpImpl->GetEditSource();
-#endif
- }
-
- void AccessibleStaticTextBase::SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((::com::sun::star::uno::RuntimeException))
- {
-#ifdef DBG_UTIL
- // precondition: solar mutex locked
- DBG_TESTSOLARMUTEX();
-
- mpImpl->CheckInvariants();
-
- mpImpl->SetEditSource( pEditSource );
-
- mpImpl->CheckInvariants();
-#else
- mpImpl->SetEditSource( pEditSource );
-#endif
- }
-
- void AccessibleStaticTextBase::SetEventSource( const uno::Reference< XAccessible >& rInterface )
- {
-#ifdef DBG_UTIL
- mpImpl->CheckInvariants();
-#endif
-
- mpImpl->SetEventSource( rInterface );
-
-#ifdef DBG_UTIL
- mpImpl->CheckInvariants();
-#endif
- }
-
- uno::Reference< XAccessible > AccessibleStaticTextBase::GetEventSource() const
- {
-#ifdef DBG_UTIL
- mpImpl->CheckInvariants();
-
- uno::Reference< XAccessible > xRet( mpImpl->GetEventSource() );
-
- mpImpl->CheckInvariants();
-
- return xRet;
-#else
- return mpImpl->GetEventSource();
-#endif
- }
-
- void AccessibleStaticTextBase::SetOffset( const Point& rPoint )
- {
-#ifdef DBG_UTIL
- // precondition: solar mutex locked
- DBG_TESTSOLARMUTEX();
-
- mpImpl->CheckInvariants();
-
- mpImpl->SetOffset( rPoint );
-
- mpImpl->CheckInvariants();
-#else
- mpImpl->SetOffset( rPoint );
-#endif
- }
-
- Point AccessibleStaticTextBase::GetOffset() const
- {
-#ifdef DBG_UTIL
- mpImpl->CheckInvariants();
-
- Point aPoint( mpImpl->GetOffset() );
-
- mpImpl->CheckInvariants();
-
- return aPoint;
-#else
- return mpImpl->GetOffset();
-#endif
- }
-
- void AccessibleStaticTextBase::UpdateChildren() SAL_THROW((::com::sun::star::uno::RuntimeException))
- {
-#ifdef DBG_UTIL
- // precondition: solar mutex locked
- DBG_TESTSOLARMUTEX();
-
- mpImpl->CheckInvariants();
-
- mpImpl->UpdateChildren();
-
- mpImpl->CheckInvariants();
-#else
- mpImpl->UpdateChildren();
-#endif
- }
-
- void AccessibleStaticTextBase::Dispose()
- {
-#ifdef DBG_UTIL
- mpImpl->CheckInvariants();
-#endif
-
- mpImpl->Dispose();
-
-#ifdef DBG_UTIL
- mpImpl->CheckInvariants();
-#endif
- }
-
- // XAccessibleContext
- sal_Int32 SAL_CALL AccessibleStaticTextBase::getAccessibleChildCount() throw (uno::RuntimeException)
- {
- // no children at all
- return 0;
- }
-
- uno::Reference< XAccessible > SAL_CALL AccessibleStaticTextBase::getAccessibleChild( sal_Int32 /*i*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- // no children at all
- return uno::Reference< XAccessible >();
- }
-
- uno::Reference< XAccessible > SAL_CALL AccessibleStaticTextBase::getAccessibleAtPoint( const awt::Point& /*_aPoint*/ ) throw (uno::RuntimeException)
- {
- // no children at all
- return uno::Reference< XAccessible >();
- }
-
- // XAccessibleText
- sal_Int32 SAL_CALL AccessibleStaticTextBase::getCaretPosition() throw (uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- sal_Int32 i, nPos, nParas;
- for( i=0, nPos=-1, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i )
- {
- if( (nPos=mpImpl->GetParagraph(i).getCaretPosition()) != -1 )
- return nPos;
- }
-
- return nPos;
- }
-
- sal_Bool SAL_CALL AccessibleStaticTextBase::setCaretPosition( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- return setSelection(nIndex, nIndex);
- }
-
- sal_Unicode SAL_CALL AccessibleStaticTextBase::getCharacter( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- EPosition aPos( mpImpl->Index2Internal(nIndex) );
-
- return mpImpl->GetParagraph( aPos.nPara ).getCharacter( aPos.nIndex );
- }
-
- 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)
- {
- SolarMutexGuard aGuard;
-
- EPosition aPos( mpImpl->Index2Internal(nIndex) );
-
- return mpImpl->GetParagraph( aPos.nPara ).getCharacterAttributes( aPos.nIndex, aRequestedAttributes );
- }
-
- awt::Rectangle SAL_CALL AccessibleStaticTextBase::getCharacterBounds( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- // #108900# Allow ranges for nIndex, as one-past-the-end
- // values are now legal, too.
- EPosition aPos( mpImpl->Range2Internal(nIndex) );
-
- // #i70916# Text in spread sheet cells return the wrong extents
- AccessibleEditableTextPara& rPara = mpImpl->GetParagraph( aPos.nPara );
- awt::Rectangle aParaBounds( rPara.getBounds() );
- awt::Rectangle aBounds( rPara.getCharacterBounds( aPos.nIndex ) );
- aBounds.X += aParaBounds.X;
- aBounds.Y += aParaBounds.Y;
-
- return aBounds;
- }
-
- sal_Int32 SAL_CALL AccessibleStaticTextBase::getCharacterCount() throw (uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- sal_Int32 i, nCount, nParas;
- for( i=0, nCount=0, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i )
- nCount += mpImpl->GetParagraph(i).getCharacterCount();
-
- return nCount;
- }
-
- sal_Int32 SAL_CALL AccessibleStaticTextBase::getIndexAtPoint( const awt::Point& rPoint ) throw (uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- const sal_Int32 nParas( mpImpl->GetParagraphCount() );
- sal_Int32 nIndex;
- int i;
- for( i=0; i<nParas; ++i )
- {
- // TODO: maybe exploit the fact that paragraphs are
- // ordered vertically for early exit
-
- // #i70916# Text in spread sheet cells return the wrong extents
- AccessibleEditableTextPara& rPara = mpImpl->GetParagraph( i );
- awt::Rectangle aParaBounds( rPara.getBounds() );
- awt::Point aPoint( rPoint );
- aPoint.X -= aParaBounds.X;
- aPoint.Y -= aParaBounds.Y;
-
- // #112814# Use correct index offset
- if ( ( nIndex = rPara.getIndexAtPoint( aPoint ) ) != -1 )
- return mpImpl->Internal2Index( EPosition(sal::static_int_cast<sal_uInt16>(i),
- sal::static_int_cast<sal_uInt16>(nIndex)) );
- }
-
- return -1;
- }
-
- ::rtl::OUString SAL_CALL AccessibleStaticTextBase::getSelectedText() throw (uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- sal_Int32 nStart( getSelectionStart() );
- sal_Int32 nEnd( getSelectionEnd() );
-
- // #104481# Return the empty string for 'no selection'
- if( nStart < 0 || nEnd < 0 )
- return ::rtl::OUString();
-
- return getTextRange( nStart, nEnd );
- }
-
- sal_Int32 SAL_CALL AccessibleStaticTextBase::getSelectionStart() throw (uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- sal_Int32 i, nPos, nParas;
- for( i=0, nPos=-1, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i )
- {
- if( (nPos=mpImpl->GetParagraph(i).getSelectionStart()) != -1 )
- return nPos;
- }
-
- return nPos;
- }
-
- sal_Int32 SAL_CALL AccessibleStaticTextBase::getSelectionEnd() throw (uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- sal_Int32 i, nPos, nParas;
- for( i=0, nPos=-1, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i )
- {
- if( (nPos=mpImpl->GetParagraph(i).getSelectionEnd()) != -1 )
- return nPos;
- }
-
- return nPos;
- }
-
- sal_Bool SAL_CALL AccessibleStaticTextBase::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) );
- EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) );
-
- return mpImpl->SetSelection( aStartIndex.nPara, aStartIndex.nIndex,
- aEndIndex.nPara, aEndIndex.nIndex );
- }
-
- ::rtl::OUString SAL_CALL AccessibleStaticTextBase::getText() throw (uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- sal_Int32 i, nParas;
- ::rtl::OUString aRes;
- for( i=0, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i )
- aRes += mpImpl->GetParagraph(i).getText();
-
- return aRes;
- }
-
- ::rtl::OUString SAL_CALL AccessibleStaticTextBase::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- if( nStartIndex > nEndIndex )
- ::std::swap(nStartIndex, nEndIndex);
-
- EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) );
- EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) );
-
- // #102170# Special case: start and end paragraph are identical
- if( aStartIndex.nPara == aEndIndex.nPara )
- {
- return mpImpl->GetParagraph( aStartIndex.nPara ).getTextRange( aStartIndex.nIndex, aEndIndex.nIndex );
- }
- else
- {
- sal_Int32 i( aStartIndex.nPara );
- ::rtl::OUString aRes( mpImpl->GetParagraph(i).getTextRange( aStartIndex.nIndex,
- mpImpl->GetParagraph(i).getCharacterCount()-1) );
- ++i;
-
- // paragraphs inbetween are fully included
- for( ; i<aEndIndex.nPara; ++i )
- aRes += mpImpl->GetParagraph(i).getText();
-
- if( i<=aEndIndex.nPara )
- aRes += mpImpl->GetParagraph(i).getTextRange( 0, aEndIndex.nIndex );
-
- return aRes;
- }
- }
-
- ::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)
- {
- SolarMutexGuard aGuard;
-
- EPosition aPos( mpImpl->Range2Internal(nIndex) );
-
- ::com::sun::star::accessibility::TextSegment aResult;
-
- if( AccessibleTextType::PARAGRAPH == aTextType )
- {
- // #106393# Special casing one behind last paragraph is
- // not necessary, since then, we return the content and
- // boundary of that last paragraph. Range2Internal is
- // tolerant against that, and returns the last paragraph
- // in aPos.nPara.
-
- // retrieve full text of the paragraph
- aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara ).getText();
-
- // #112814# Adapt the start index with the paragraph offset
- aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara, 0 ) );
- aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength();
- }
- else
- {
- // No special handling required, forward to wrapped class
- aResult = mpImpl->GetParagraph( aPos.nPara ).getTextAtIndex( aPos.nIndex, aTextType );
-
- // #112814# Adapt the start index with the paragraph offset
- mpImpl->CorrectTextSegment( aResult, aPos.nPara );
- }
-
- return aResult;
- }
-
- ::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)
- {
- SolarMutexGuard aGuard;
-
- EPosition aPos( mpImpl->Range2Internal(nIndex) );
-
- ::com::sun::star::accessibility::TextSegment aResult;
-
- if( AccessibleTextType::PARAGRAPH == aTextType )
- {
- if( aPos.nIndex == mpImpl->GetParagraph( aPos.nPara ).getCharacterCount() )
- {
- // #103589# Special casing one behind the last paragraph
- aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara ).getText();
-
- // #112814# Adapt the start index with the paragraph offset
- aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara, 0 ) );
- }
- else if( aPos.nPara > 0 )
- {
- aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara - 1 ).getText();
-
- // #112814# Adapt the start index with the paragraph offset
- aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara - 1, 0 ) );
- }
-
- aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength();
- }
- else
- {
- // No special handling required, forward to wrapped class
- aResult = mpImpl->GetParagraph( aPos.nPara ).getTextBeforeIndex( aPos.nIndex, aTextType );
-
- // #112814# Adapt the start index with the paragraph offset
- mpImpl->CorrectTextSegment( aResult, aPos.nPara );
- }
-
- return aResult;
- }
-
- ::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)
- {
- SolarMutexGuard aGuard;
-
- EPosition aPos( mpImpl->Range2Internal(nIndex) );
-
- ::com::sun::star::accessibility::TextSegment aResult;
-
- if( AccessibleTextType::PARAGRAPH == aTextType )
- {
- // Special casing one behind the last paragraph is not
- // necessary, this case is invalid here for
- // getTextBehindIndex
- if( aPos.nPara + 1 < mpImpl->GetParagraphCount() )
- {
- aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara + 1 ).getText();
-
- // #112814# Adapt the start index with the paragraph offset
- aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara + 1, 0 ) );
- aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength();
- }
- }
- else
- {
- // No special handling required, forward to wrapped class
- aResult = mpImpl->GetParagraph( aPos.nPara ).getTextBehindIndex( aPos.nIndex, aTextType );
-
- // #112814# Adapt the start index with the paragraph offset
- mpImpl->CorrectTextSegment( aResult, aPos.nPara );
- }
-
- return aResult;
- }
-
- sal_Bool SAL_CALL AccessibleStaticTextBase::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- SolarMutexGuard aGuard;
-
- if( nStartIndex > nEndIndex )
- ::std::swap(nStartIndex, nEndIndex);
-
- EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) );
- EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) );
-
- return mpImpl->CopyText( aStartIndex.nPara, aStartIndex.nIndex,
- aEndIndex.nPara, aEndIndex.nIndex );
- }
-
- // XAccessibleTextAttributes
- uno::Sequence< beans::PropertyValue > AccessibleStaticTextBase::getDefaultAttributes( const uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (uno::RuntimeException)
- {
- // get the intersection of the default attributes of all paragraphs
-
- SolarMutexGuard aGuard;
-
- PropertyValueVector aDefAttrVec( mpImpl->GetParagraph( 0 ).getDefaultAttributes( RequestedAttributes ) );
-
- const sal_Int32 nParaCount = mpImpl->GetParagraphCount();
- for ( sal_Int32 nPara = 1; nPara < nParaCount; ++nPara )
- {
- uno::Sequence< beans::PropertyValue > aSeq = mpImpl->GetParagraph( nPara ).getDefaultAttributes( RequestedAttributes );
- PropertyValueVector aIntersectionVec;
-
- PropertyValueVector::const_iterator aEnd = aDefAttrVec.end();
- for ( PropertyValueVector::const_iterator aItr = aDefAttrVec.begin(); aItr != aEnd; ++aItr )
- {
- const beans::PropertyValue* pItr = aSeq.getConstArray();
- const beans::PropertyValue* pEnd = pItr + aSeq.getLength();
- const beans::PropertyValue* pFind = ::std::find_if( pItr, pEnd, ::std::bind2nd( PropertyValueEqualFunctor(), boost::cref( *aItr ) ) );
- if ( pFind != pEnd )
- {
- aIntersectionVec.push_back( *pFind );
- }
- }
-
- aDefAttrVec.swap( aIntersectionVec );
-
- if ( aDefAttrVec.empty() )
- {
- break;
- }
- }
-
- return aDefAttrVec.getAsConstList();
- }
-
- uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleStaticTextBase::getRunAttributes( sal_Int32 nIndex, const uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
- {
- // get those default attributes of the paragraph, which are not part
- // of the intersection of all paragraphs and add them to the run attributes
-
- SolarMutexGuard aGuard;
-
- EPosition aPos( mpImpl->Index2Internal( nIndex ) );
- AccessibleEditableTextPara& rPara = mpImpl->GetParagraph( aPos.nPara );
- uno::Sequence< beans::PropertyValue > aDefAttrSeq = rPara.getDefaultAttributes( RequestedAttributes );
- uno::Sequence< beans::PropertyValue > aRunAttrSeq = rPara.getRunAttributes( aPos.nIndex, RequestedAttributes );
- uno::Sequence< beans::PropertyValue > aIntersectionSeq = getDefaultAttributes( RequestedAttributes );
- PropertyValueVector aDiffVec;
-
- const beans::PropertyValue* pDefAttr = aDefAttrSeq.getConstArray();
- const sal_Int32 nLength = aDefAttrSeq.getLength();
- for ( sal_Int32 i = 0; i < nLength; ++i )
- {
- const beans::PropertyValue* pItr = aIntersectionSeq.getConstArray();
- const beans::PropertyValue* pEnd = pItr + aIntersectionSeq.getLength();
- const beans::PropertyValue* pFind = ::std::find_if( pItr, pEnd, ::std::bind2nd( PropertyValueEqualFunctor(), boost::cref( pDefAttr[i] ) ) );
- if ( pFind == pEnd && pDefAttr[i].Handle != 0)
- {
- aDiffVec.push_back( pDefAttr[i] );
- }
- }
-
- return ::comphelper::concatSequences( aRunAttrSeq, aDiffVec.getAsConstList() );
- }
-
- Rectangle AccessibleStaticTextBase::GetParagraphBoundingBox() const
- {
- return mpImpl->GetParagraphBoundingBox();
- }
-
- sal_Int32 AccessibleStaticTextBase::GetParagraphIndex() const
- {
- return mpImpl->GetParagraphIndex();
- }
-
- sal_Int32 AccessibleStaticTextBase::GetParagraphCount() const
- {
- return mpImpl->GetParagraphCount();
- }
-
- sal_Int32 AccessibleStaticTextBase::GetLineCount( sal_Int32 nParagraph ) const
- {
- return mpImpl->GetLineCount( nParagraph );
- }
-
-} // 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
deleted file mode 100644
index 8f10f038b9..0000000000
--- a/editeng/source/accessibility/AccessibleStringWrap.cxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <algorithm>
-#include <tools/debug.hxx>
-#include <vcl/outdev.hxx>
-
-#include <editeng/svxfont.hxx>
-#include <editeng/AccessibleStringWrap.hxx>
-
-//------------------------------------------------------------------------
-//
-// AccessibleStringWrap implementation
-//
-//------------------------------------------------------------------------
-
-AccessibleStringWrap::AccessibleStringWrap( OutputDevice& rDev, SvxFont& rFont, const String& rText ) :
- mrDev( rDev ),
- mrFont( rFont ),
- maText( rText )
-{
-}
-
-sal_Bool AccessibleStringWrap::GetCharacterBounds( sal_Int32 nIndex, Rectangle& rRect )
-{
- DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX,
- "SvxAccessibleStringWrap::GetCharacterBounds: index value overflow");
-
- mrFont.SetPhysFont( &mrDev );
-
- // #108900# Handle virtual position one-past-the end of the string
- if( nIndex >= maText.Len() )
- {
- // create a caret bounding rect that has the height of the
- // current font and is one pixel wide.
- rRect.Left() = mrDev.GetTextWidth(maText);
- rRect.Top() = 0;
- rRect.SetSize( Size(mrDev.GetTextHeight(), 1) );
- }
- else
- {
- sal_Int32 aXArray[2];
- mrDev.GetCaretPositions( maText, aXArray, static_cast< sal_uInt16 >(nIndex), 1 );
- rRect.Left() = 0;
- rRect.Top() = 0;
- rRect.SetSize( Size(mrDev.GetTextHeight(), labs(aXArray[0] - aXArray[1])) );
- rRect.Move( ::std::min(aXArray[0], aXArray[1]), 0 );
- }
-
- if( mrFont.IsVertical() )
- {
- // #101701# Rotate to vertical
- rRect = Rectangle( Point(-rRect.Top(), rRect.Left()),
- Point(-rRect.Bottom(), rRect.Right()));
- }
-
- return sal_True;
-}
-
-sal_Int32 AccessibleStringWrap::GetIndexAtPoint( const Point& rPoint )
-{
- // search for character bounding box containing given point
- Rectangle aRect;
- sal_Int32 i, nLen = maText.Len();
- for( i=0; i<nLen; ++i )
- {
- GetCharacterBounds(i, aRect);
- if( aRect.IsInside(rPoint) )
- return i;
- }
-
- return -1;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/accessibility/accessibility.src b/editeng/source/accessibility/accessibility.src
deleted file mode 100644
index d7ed9ff738..0000000000
--- a/editeng/source/accessibility/accessibility.src
+++ /dev/null
@@ -1,40 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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.
- *
- ************************************************************************/
-
-#include "editeng.hrc"
-
-String RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION
-{
- Text [ en-US ] = "Image bullet in paragraph" ;
-};
-
-String RID_SVXSTR_A11Y_IMAGEBULLET_NAME
-{
- Text [ en-US ] = "Image bullet" ;
-};
-
-
diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx
deleted file mode 100644
index 59647d6a90..0000000000
--- a/editeng/source/editeng/editattr.cxx
+++ /dev/null
@@ -1,446 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-
-#include <editeng/svxfont.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/cntritem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/escpitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/wrlmitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/crsditem.hxx>
-#include <editeng/cscoitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/akrnitem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/emphitem.hxx>
-#include <editeng/charscaleitem.hxx>
-#include <editeng/charreliefitem.hxx>
-
-#include "editattr.hxx"
-
-DBG_NAME( EE_EditAttrib )
-
-// -------------------------------------------------------------------------
-// class EditAttrib
-// -------------------------------------------------------------------------
-EditAttrib::EditAttrib( const SfxPoolItem& rAttr )
-{
- DBG_CTOR( EE_EditAttrib, 0 );
- pItem = &rAttr;
-}
-
-EditAttrib::~EditAttrib()
-{
- DBG_DTOR( EE_EditAttrib, 0 );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttrib
-// -------------------------------------------------------------------------
-EditCharAttrib::EditCharAttrib( const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE )
- : EditAttrib( rAttr )
-{
- nStart = nS;
- nEnd = nE;
- bFeature = sal_False;
- bEdge = sal_False;
-
- DBG_ASSERT( ( rAttr.Which() >= EE_ITEMS_START ) && ( rAttr.Which() <= EE_ITEMS_END ), "EditCharAttrib CTOR: Invalid id!" );
- DBG_ASSERT( ( rAttr.Which() < EE_FEATURE_START ) || ( rAttr.Which() > EE_FEATURE_END ) || ( nE == (nS+1) ), "EditCharAttrib CTOR: Invalid feature!" );
-}
-
-void EditCharAttrib::SetFont( SvxFont&, OutputDevice* )
-{
-}
-
-
-// -------------------------------------------------------------------------
-// class EditCharAttribFont
-// -------------------------------------------------------------------------
-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, "Not a Font attribute!" );
-}
-
-void EditCharAttribFont::SetFont( SvxFont& rFont, OutputDevice* )
-{
- const SvxFontItem& rAttr = (const SvxFontItem&)(*GetItem());
-
- rFont.SetName( rAttr.GetFamilyName() );
- rFont.SetFamily( rAttr.GetFamily() );
- rFont.SetPitch( rAttr.GetPitch() );
- rFont.SetCharSet( rAttr.GetCharSet() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribItalic
-// -------------------------------------------------------------------------
-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, "Not a Italic attribute!" );
-}
-
-void EditCharAttribItalic::SetFont( SvxFont& rFont, OutputDevice* )
-{
- rFont.SetItalic( ((const SvxPostureItem*)GetItem())->GetPosture() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribWeight
-// -------------------------------------------------------------------------
-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, "Not a Weight attribute!" );
-}
-
-void EditCharAttribWeight::SetFont( SvxFont& rFont, OutputDevice* )
-{
- rFont.SetWeight( (FontWeight)((const SvxWeightItem*)GetItem())->GetValue() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribUnderline
-// -------------------------------------------------------------------------
-EditCharAttribUnderline::EditCharAttribUnderline( const SvxUnderlineItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
- : EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_UNDERLINE, "Not a Underline attribute!" );
-}
-
-void EditCharAttribUnderline::SetFont( SvxFont& rFont, OutputDevice* pOutDev )
-{
- rFont.SetUnderline( (FontUnderline)((const SvxUnderlineItem*)GetItem())->GetValue() );
- if ( pOutDev )
- pOutDev->SetTextLineColor( ((const SvxUnderlineItem*)GetItem())->GetColor() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribOverline
-// -------------------------------------------------------------------------
-EditCharAttribOverline::EditCharAttribOverline( const SvxOverlineItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
- : EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_OVERLINE, "Not a overline attribute!" );
-}
-
-void EditCharAttribOverline::SetFont( SvxFont& rFont, OutputDevice* pOutDev )
-{
- rFont.SetOverline( (FontUnderline)((const SvxOverlineItem*)GetItem())->GetValue() );
- if ( pOutDev )
- pOutDev->SetOverlineColor( ((const SvxOverlineItem*)GetItem())->GetColor() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribFontHeight
-// -------------------------------------------------------------------------
-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, "Not a Height attribute!" );
-}
-
-void EditCharAttribFontHeight::SetFont( SvxFont& rFont, OutputDevice* )
-{
- // Property is ignored
- rFont.SetSize( Size( rFont.GetSize().Width(), ((const SvxFontHeightItem*)GetItem())->GetHeight() ) );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribFontWidth
-// -------------------------------------------------------------------------
-EditCharAttribFontWidth::EditCharAttribFontWidth( const SvxCharScaleWidthItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
- : EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_FONTWIDTH, "Not a Width attribute!" );
-}
-
-void EditCharAttribFontWidth::SetFont( SvxFont& /*rFont*/, OutputDevice* )
-{
- // must be calculated outside, because f(device)...
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribStrikeout
-// -------------------------------------------------------------------------
-EditCharAttribStrikeout::EditCharAttribStrikeout( const SvxCrossedOutItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
- : EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_STRIKEOUT, "Not a Size attribute!" );
-}
-
-void EditCharAttribStrikeout::SetFont( SvxFont& rFont, OutputDevice* )
-{
- rFont.SetStrikeout( (FontStrikeout)((const SvxCrossedOutItem*)GetItem())->GetValue() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribColor
-// -------------------------------------------------------------------------
-EditCharAttribColor::EditCharAttribColor( const SvxColorItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
- : EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_COLOR, "Not a Color attribute!" );
-}
-
-void EditCharAttribColor::SetFont( SvxFont& rFont, OutputDevice* )
-{
- rFont.SetColor( ((const SvxColorItem*)GetItem())->GetValue() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribLanguage
-// -------------------------------------------------------------------------
-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 ), "Not a Language attribute!" );
-}
-
-void EditCharAttribLanguage::SetFont( SvxFont& rFont, OutputDevice* )
-{
- rFont.SetLanguage( ((const SvxLanguageItem*)GetItem())->GetLanguage() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribShadow
-// -------------------------------------------------------------------------
-EditCharAttribShadow::EditCharAttribShadow( const SvxShadowedItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
- : EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_SHADOW, "Not a Shadow attribute!" );
-}
-
-void EditCharAttribShadow::SetFont( SvxFont& rFont, OutputDevice* )
-{
- rFont.SetShadow( (sal_Bool)((const SvxShadowedItem*)GetItem())->GetValue() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribEscapement
-// -------------------------------------------------------------------------
-EditCharAttribEscapement::EditCharAttribEscapement( const SvxEscapementItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
- : EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_ESCAPEMENT, "Not a escapement attribute!" );
-}
-
-void EditCharAttribEscapement::SetFont( SvxFont& rFont, OutputDevice* )
-{
- sal_uInt16 nProp = ((const SvxEscapementItem*)GetItem())->GetProp();
- rFont.SetPropr( (sal_uInt8)nProp );
-
- short nEsc = ((const SvxEscapementItem*)GetItem())->GetEsc();
- if ( nEsc == DFLT_ESC_AUTO_SUPER )
- nEsc = 100 - nProp;
- else if ( nEsc == DFLT_ESC_AUTO_SUB )
- nEsc = sal::static_int_cast< short >( -( 100 - nProp ) );
- rFont.SetEscapement( nEsc );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribOutline
-// -------------------------------------------------------------------------
-EditCharAttribOutline::EditCharAttribOutline( const SvxContourItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
- : EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_OUTLINE, "Not a Outline attribute!" );
-}
-
-void EditCharAttribOutline::SetFont( SvxFont& rFont, OutputDevice* )
-{
- rFont.SetOutline( (sal_Bool)((const SvxContourItem*)GetItem())->GetValue() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribTab
-// -------------------------------------------------------------------------
-EditCharAttribTab::EditCharAttribTab( const SfxVoidItem& rAttr, sal_uInt16 nPos )
- : EditCharAttrib( rAttr, nPos, nPos+1 )
-{
- SetFeature( sal_True );
-}
-
-void EditCharAttribTab::SetFont( SvxFont&, OutputDevice* )
-{
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribLineBreak
-// -------------------------------------------------------------------------
-EditCharAttribLineBreak::EditCharAttribLineBreak( const SfxVoidItem& rAttr, sal_uInt16 nPos )
- : EditCharAttrib( rAttr, nPos, nPos+1 )
-{
- SetFeature( sal_True );
-}
-
-void EditCharAttribLineBreak::SetFont( SvxFont&, OutputDevice* )
-{
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribField
-// -------------------------------------------------------------------------
-EditCharAttribField::EditCharAttribField( const SvxFieldItem& rAttr, sal_uInt16 nPos )
- : EditCharAttrib( rAttr, nPos, nPos+1 )
-{
- SetFeature( sal_True ); // !!!
- pTxtColor = 0;
- pFldColor = 0;
-}
-
-void EditCharAttribField::SetFont( SvxFont& rFont, OutputDevice* )
-{
- if ( pFldColor )
- {
- rFont.SetFillColor( *pFldColor );
- rFont.SetTransparent( sal_False );
- }
- if ( pTxtColor )
- rFont.SetColor( *pTxtColor );
-}
-
-EditCharAttribField::EditCharAttribField( const EditCharAttribField& rAttr )
- : EditCharAttrib( *rAttr.GetItem(), rAttr.GetStart(), rAttr.GetEnd() ),
- aFieldValue( rAttr.aFieldValue )
-{
- // 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;
-}
-
-EditCharAttribField::~EditCharAttribField()
-{
- Reset();
-}
-
-sal_Bool EditCharAttribField::operator == ( const EditCharAttribField& rAttr ) const
-{
- if ( aFieldValue != rAttr.aFieldValue )
- return sal_False;
-
- if ( ( pTxtColor && !rAttr.pTxtColor ) || ( !pTxtColor && rAttr.pTxtColor ) )
- return sal_False;
- if ( ( pTxtColor && rAttr.pTxtColor ) && ( *pTxtColor != *rAttr.pTxtColor ) )
- return sal_False;
-
- if ( ( pFldColor && !rAttr.pFldColor ) || ( !pFldColor && rAttr.pFldColor ) )
- return sal_False;
- if ( ( pFldColor && rAttr.pFldColor ) && ( *pFldColor != *rAttr.pFldColor ) )
- return sal_False;
-
- return sal_True;
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribPairKerning
-// -------------------------------------------------------------------------
-EditCharAttribPairKerning::EditCharAttribPairKerning( const SvxAutoKernItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
-: EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_PAIRKERNING, "Not a Pair Kerning!" );
-}
-
-void EditCharAttribPairKerning::SetFont( SvxFont& rFont, OutputDevice* )
-{
- rFont.SetKerning( ((const SvxAutoKernItem*)GetItem())->GetValue() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribKerning
-// -------------------------------------------------------------------------
-EditCharAttribKerning::EditCharAttribKerning( const SvxKerningItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
-: EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_KERNING, "Not a Kerning!" );
-}
-
-void EditCharAttribKerning::SetFont( SvxFont& rFont, OutputDevice* )
-{
- rFont.SetFixKerning( ((const SvxKerningItem*)GetItem())->GetValue() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribWordLineMode
-// -------------------------------------------------------------------------
-EditCharAttribWordLineMode::EditCharAttribWordLineMode( const SvxWordLineModeItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
-: EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_WLM, "Not a Kerning!" );
-}
-
-void EditCharAttribWordLineMode::SetFont( SvxFont& rFont, OutputDevice* )
-{
- rFont.SetWordLineMode( ((const SvxWordLineModeItem*)GetItem())->GetValue() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribEmphasisMark
-// -------------------------------------------------------------------------
-EditCharAttribEmphasisMark::EditCharAttribEmphasisMark( const SvxEmphasisMarkItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
- : EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_EMPHASISMARK, "Not a Emphasis attribute!" );
-}
-
-void EditCharAttribEmphasisMark::SetFont( SvxFont& rFont, OutputDevice* )
-{
- rFont.SetEmphasisMark( ((const SvxEmphasisMarkItem*)GetItem())->GetEmphasisMark() );
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribRelief
-// -------------------------------------------------------------------------
-EditCharAttribRelief::EditCharAttribRelief( const SvxCharReliefItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd )
- : EditCharAttrib( rAttr, _nStart, _nEnd )
-{
- DBG_ASSERT( rAttr.Which() == EE_CHAR_RELIEF, "Not a relief attribute!" );
-}
-
-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
deleted file mode 100644
index edf2c30da5..0000000000
--- a/editeng/source/editeng/editattr.hxx
+++ /dev/null
@@ -1,429 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDITATTR_HXX
-#define _EDITATTR_HXX
-
-#include <editeng/eeitem.hxx>
-
-class SvxFont;
-class SvxFontItem;
-class SvxWeightItem;
-class SvxPostureItem;
-class SvxShadowedItem;
-class SvxEscapementItem;
-class SvxContourItem;
-class SvxCrossedOutItem;
-class SvxUnderlineItem;
-class SvxOverlineItem;
-class SvxFontHeightItem;
-class SvxCharScaleWidthItem;
-class SvxColorItem;
-class SvxAutoKernItem;
-class SvxKerningItem;
-class SvxCharSetColorItem;
-class SvxWordLineModeItem;
-class SvxFieldItem;
-class SvxLanguageItem;
-class SvxEmphasisMarkItem;
-class SvxCharReliefItem;
-#include <svl/poolitem.hxx>
-
-
-class SfxVoidItem;
-
-#define CH_FEATURE_OLD (sal_uInt8) 0xFF
-#define CH_FEATURE (sal_Unicode) 0x01
-
-// 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
-{
-private:
- EditAttrib() {;}
- EditAttrib( const EditAttrib & ) {;}
-
-protected:
- const SfxPoolItem* pItem;
-
- EditAttrib( const SfxPoolItem& rAttr );
- virtual ~EditAttrib();
-
-public:
- // 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: 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:
-
- sal_uInt16 nStart;
- sal_uInt16 nEnd;
- sal_Bool bFeature :1;
- sal_Bool bEdge :1;
-
-public:
- EditCharAttrib( const SfxPoolItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- sal_uInt16& GetStart() { return nStart; }
- sal_uInt16& GetEnd() { return nEnd; }
-
- sal_uInt16 GetStart() const { return nStart; }
- sal_uInt16 GetEnd() const { return nEnd; }
-
- inline sal_uInt16 GetLen() const;
-
- inline void MoveForward( sal_uInt16 nDiff );
- inline void MoveBackward( sal_uInt16 nDiff );
-
- inline void Expand( sal_uInt16 nDiff );
- inline void Collaps( sal_uInt16 nDiff );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-
- sal_Bool IsIn( sal_uInt16 nIndex ) const
- { return ( ( nStart <= nIndex ) && ( nEnd >= nIndex ) ); }
- sal_Bool IsInside( sal_uInt16 nIndex ) const
- { return ( ( nStart < nIndex ) && ( nEnd > nIndex ) ); }
- sal_Bool IsEmpty() const
- { return nStart == nEnd; }
-
- sal_Bool IsFeature() const { return bFeature; }
- void SetFeature( sal_Bool b) { bFeature = b; }
-
- sal_Bool IsEdge() const { return bEdge; }
- void SetEdge( sal_Bool b ) { bEdge = b; }
-};
-
-inline sal_uInt16 EditCharAttrib::GetLen() const
-{
- DBG_ASSERT( nEnd >= nStart, "EditCharAttrib: nEnd < nStart!" );
- return nEnd-nStart;
-}
-
-inline void EditCharAttrib::MoveForward( sal_uInt16 nDiff )
-{
- DBG_ASSERT( ((long)nEnd + nDiff) <= 0xFFFF, "EditCharAttrib: MoveForward?!" );
- nStart = nStart + nDiff;
- nEnd = nEnd + nDiff;
-}
-
-inline void EditCharAttrib::MoveBackward( sal_uInt16 nDiff )
-{
- DBG_ASSERT( ((long)nStart - nDiff) >= 0, "EditCharAttrib: MoveBackward?!" );
- nStart = nStart - nDiff;
- nEnd = nEnd - nDiff;
-}
-
-inline void EditCharAttrib::Expand( sal_uInt16 nDiff )
-{
- DBG_ASSERT( ( ((long)nEnd + nDiff) <= (long)0xFFFF ), "EditCharAttrib: Expand?!" );
- 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, "Please do not shrink any Features!" );
- nEnd = nEnd - nDiff;
-}
-
-// -------------------------------------------------------------------------
-// class EditCharAttribFont
-// -------------------------------------------------------------------------
-class EditCharAttribFont: public EditCharAttrib
-{
-public:
- EditCharAttribFont( const SvxFontItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribWeight
-// -------------------------------------------------------------------------
-class EditCharAttribWeight : public EditCharAttrib
-{
-public:
- EditCharAttribWeight( const SvxWeightItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
- // -------------------------------------------------------------------------
-// class EditCharAttribItalic
-// -------------------------------------------------------------------------
-class EditCharAttribItalic : public EditCharAttrib
-{
-public:
- EditCharAttribItalic( const SvxPostureItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribShadow
-// -------------------------------------------------------------------------
-class EditCharAttribShadow : public EditCharAttrib
-{
-public:
- EditCharAttribShadow( const SvxShadowedItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribEscapement
-// -------------------------------------------------------------------------
-class EditCharAttribEscapement : public EditCharAttrib
-{
-public:
- EditCharAttribEscapement( const SvxEscapementItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribOutline
-// -------------------------------------------------------------------------
-class EditCharAttribOutline : public EditCharAttrib
-{
-public:
- EditCharAttribOutline( const SvxContourItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribStrikeout
-// -------------------------------------------------------------------------
-class EditCharAttribStrikeout : public EditCharAttrib
-{
-public:
- EditCharAttribStrikeout( const SvxCrossedOutItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribUnderline
-// -------------------------------------------------------------------------
-class EditCharAttribUnderline : public EditCharAttrib
-{
-public:
- EditCharAttribUnderline( const SvxUnderlineItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
-// -------------------------------------------------------------------------
-// class EditCharAttribOverline
-// -------------------------------------------------------------------------
-class EditCharAttribOverline : public EditCharAttrib
-{
-public:
- EditCharAttribOverline( const SvxOverlineItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
-// -------------------------------------------------------------------------
-// class EditCharAttribEmphasisMark
-// -------------------------------------------------------------------------
-class EditCharAttribEmphasisMark : public EditCharAttrib
-{
-public:
- EditCharAttribEmphasisMark( const SvxEmphasisMarkItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
-// -------------------------------------------------------------------------
-// class EditCharAttribRelief
-// -------------------------------------------------------------------------
-class EditCharAttribRelief : public EditCharAttrib
-{
-public:
- EditCharAttribRelief( const SvxCharReliefItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribFontHeight
-// -------------------------------------------------------------------------
-class EditCharAttribFontHeight : public EditCharAttrib
-{
-public:
- EditCharAttribFontHeight( const SvxFontHeightItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribFontWidth
-// -------------------------------------------------------------------------
-class EditCharAttribFontWidth : public EditCharAttrib
-{
-public:
- EditCharAttribFontWidth( const SvxCharScaleWidthItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribColor
-// -------------------------------------------------------------------------
-class EditCharAttribColor : public EditCharAttrib
-{
-public:
- EditCharAttribColor( const SvxColorItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribLanguage
-// -------------------------------------------------------------------------
-class EditCharAttribLanguage : public EditCharAttrib
-{
-public:
- EditCharAttribLanguage( const SvxLanguageItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribTab
-// -------------------------------------------------------------------------
-class EditCharAttribTab : public EditCharAttrib
-{
-public:
- EditCharAttribTab( const SfxVoidItem& rAttr, sal_uInt16 nPos );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribLineBreak
-// -------------------------------------------------------------------------
-class EditCharAttribLineBreak : public EditCharAttrib
-{
-public:
- EditCharAttribLineBreak( const SfxVoidItem& rAttr, sal_uInt16 nPos );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribField
-// -------------------------------------------------------------------------
-class EditCharAttribField: public EditCharAttrib
-{
- XubString aFieldValue;
- Color* pTxtColor;
- Color* pFldColor;
-
- EditCharAttribField& operator = ( const EditCharAttribField& rAttr ) const;
-
-public:
- EditCharAttribField( const SvxFieldItem& rAttr, sal_uInt16 nPos );
- EditCharAttribField( const EditCharAttribField& rAttr );
- ~EditCharAttribField();
-
- sal_Bool operator == ( const EditCharAttribField& rAttr ) const;
- sal_Bool operator != ( const EditCharAttribField& rAttr ) const
- { return !(operator == ( rAttr ) ); }
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
- Color*& GetTxtColor() { return pTxtColor; }
- Color*& GetFldColor() { return pFldColor; }
-
- const XubString& GetFieldValue() const { return aFieldValue; }
- XubString& GetFieldValue() { return aFieldValue; }
-
- void Reset()
- {
- aFieldValue.Erase();
- delete pTxtColor; pTxtColor = 0;
- delete pFldColor; pFldColor = 0;
- }
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribPairKerning
-// -------------------------------------------------------------------------
-class EditCharAttribPairKerning : public EditCharAttrib
-{
-public:
- EditCharAttribPairKerning( const SvxAutoKernItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribKerning
-// -------------------------------------------------------------------------
-class EditCharAttribKerning : public EditCharAttrib
-{
-public:
- EditCharAttribKerning( const SvxKerningItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
- // -------------------------------------------------------------------------
-// class EditCharAttribWordLineMode
-// -------------------------------------------------------------------------
-class EditCharAttribWordLineMode: public EditCharAttrib
-{
-public:
- EditCharAttribWordLineMode( const SvxWordLineModeItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
-};
-
-
-#endif // _EDITATTR_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
deleted file mode 100644
index 85b49fa20f..0000000000
--- a/editeng/source/editeng/editdbg.cxx
+++ /dev/null
@@ -1,585 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-
-#include <editeng/lspcitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/cntritem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/adjitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/crsditem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/escpitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/wrlmitem.hxx>
-#include <editeng/akrnitem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/emphitem.hxx>
-#include <editeng/numitem.hxx>
-#include <editeng/tstpitem.hxx>
-#include <editeng/charscaleitem.hxx>
-#include <editeng/charreliefitem.hxx>
-#include <editeng/frmdiritem.hxx>
-
-#include <impedit.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editdoc.hxx>
-#include <editdbg.hxx>
-
-#include <rtl/strbuf.hxx>
-
-#if defined( DBG_UTIL ) || ( OSL_DEBUG_LEVEL > 1 )
-
-rtl::OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem)
-{
- rtl::OStringBuffer aDebStr;
- switch ( rItem.Which() )
- {
- case EE_PARA_WRITINGDIR:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("WritingDir="));
- aDebStr.append(static_cast<sal_Int32>(((SvxFrameDirectionItem&)rItem).GetValue()));
- break;
- case EE_PARA_OUTLLRSPACE:
- case EE_PARA_LRSPACE:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("FI="));
- aDebStr.append(static_cast<sal_Int32>(((SvxLRSpaceItem&)rItem).GetTxtFirstLineOfst()));
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM(", LI="));
- aDebStr.append(static_cast<sal_Int32>(((SvxLRSpaceItem&)rItem).GetTxtLeft()));
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM(", RI="));
- aDebStr.append(static_cast<sal_Int32>(((SvxLRSpaceItem&)rItem).GetRight()));
- break;
- case EE_PARA_NUMBULLET:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("NumItem "));
- for ( sal_uInt16 nLevel = 0; nLevel < 3; nLevel++ )
- {
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Level"));
- aDebStr.append(static_cast<sal_Int32>(nLevel));
- aDebStr.append('=');
- const SvxNumberFormat* pFmt = ((const SvxNumBulletItem&)rItem).GetNumRule()->Get( nLevel );
- if ( pFmt )
- {
- aDebStr.append('(');
- aDebStr.append(static_cast<sal_Int32>(pFmt->GetFirstLineOffset()));
- aDebStr.append(',');
- aDebStr.append(static_cast<sal_Int32>(pFmt->GetAbsLSpace()));
- aDebStr.append(',');
- if ( pFmt->GetNumberingType() == SVX_NUM_BITMAP )
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Bitmap"));
- else if( pFmt->GetNumberingType() != SVX_NUM_CHAR_SPECIAL )
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Number"));
- else
- {
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Char=["));
- aDebStr.append(static_cast<sal_Int32>(pFmt->GetBulletChar()));
- aDebStr.append(']');
- }
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM(") "));
- }
- }
- break;
- case EE_PARA_BULLETSTATE:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("ShowBullet="));
- aDebStr.append(static_cast<sal_Int32>(((SfxBoolItem&)rItem).GetValue()));
- break;
- case EE_PARA_HYPHENATE:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Hyphenate="));
- aDebStr.append(static_cast<sal_Int32>(((SfxBoolItem&)rItem).GetValue()));
- break;
- case EE_PARA_OUTLLEVEL:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Level="));
- aDebStr.append(static_cast<sal_Int32>(((SfxInt16Item&)rItem).GetValue()));
- break;
- case EE_PARA_ULSPACE:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("SB="));
- aDebStr.append(static_cast<sal_Int32>(((SvxULSpaceItem&)rItem).GetUpper()));
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM(", SA="));
- aDebStr.append(static_cast<sal_Int32>(((SvxULSpaceItem&)rItem).GetLower()));
- break;
- case EE_PARA_SBL:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("SBL="));
- if ( ((SvxLineSpacingItem&)rItem).GetLineSpaceRule() == SVX_LINE_SPACE_MIN )
- {
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Min: "));
- aDebStr.append(static_cast<sal_Int32>(((SvxLineSpacingItem&)rItem).GetInterLineSpace()));
- }
- else if ( ((SvxLineSpacingItem&)rItem).GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP )
- {
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Prop: "));
- aDebStr.append(static_cast<sal_Int32>(((SvxLineSpacingItem&)rItem).GetPropLineSpace()));
- }
- else
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Unsupported Type!"));
- break;
- case EE_PARA_JUST:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("SvxAdust="));
- aDebStr.append(static_cast<sal_Int32>(((SvxAdjustItem&)rItem).GetAdjust()));
- break;
- case EE_PARA_TABS:
- {
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Tabs: "));
- const SvxTabStopItem& rTabs = (const SvxTabStopItem&) rItem;
- aDebStr.append(static_cast<sal_Int32>(rTabs.Count()));
- if ( rTabs.Count() )
- {
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("( "));
- for (sal_uInt16 i = 0; i < rTabs.Count(); ++i)
- {
- const SvxTabStop& rTab = rTabs[i];
- aDebStr.append(static_cast<sal_Int32>(rTab.GetTabPos()));
- aDebStr.append(' ');
- }
- aDebStr.append(')');
- }
- }
- break;
- case EE_CHAR_LANGUAGE:
- case EE_CHAR_LANGUAGE_CJK:
- case EE_CHAR_LANGUAGE_CTL:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Language="));
- aDebStr.append(static_cast<sal_Int32>(((SvxLanguageItem&)rItem).GetLanguage()));
- break;
- case EE_CHAR_COLOR:
- {
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Color= "));
- Color aColor( ((SvxColorItem&)rItem).GetValue() );
- aDebStr.append(static_cast<sal_Int32>(aColor.GetRed()));
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aDebStr.append(static_cast<sal_Int32>(aColor.GetGreen()));
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aDebStr.append(static_cast<sal_Int32>(aColor.GetBlue()));
- }
- break;
- case EE_CHAR_FONTINFO:
- case EE_CHAR_FONTINFO_CJK:
- case EE_CHAR_FONTINFO_CTL:
- {
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Font="));
- aDebStr.append(rtl::OUStringToOString(((SvxFontItem&)rItem).GetFamilyName(), RTL_TEXTENCODING_ASCII_US));
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM(" (CharSet: "));
- aDebStr.append(static_cast<sal_Int32>(((SvxFontItem&)rItem).GetCharSet()));
- aDebStr.append(')');
- }
- break;
- case EE_CHAR_FONTHEIGHT:
- case EE_CHAR_FONTHEIGHT_CJK:
- case EE_CHAR_FONTHEIGHT_CTL:
- {
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Groesse="));
- aDebStr.append(static_cast<sal_Int32>(((SvxFontHeightItem&)rItem).GetHeight()));
- Size aSz( 0, ((SvxFontHeightItem&)rItem).GetHeight() );
- SfxMapUnit eUnit = rPool.GetMetric( rItem.Which() );
- MapMode aItemMapMode( (MapUnit) eUnit );
- MapMode aPntMap( MAP_POINT );
- aSz = OutputDevice::LogicToLogic( aSz, aItemMapMode, aPntMap );
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM(" Points="));
- aDebStr.append(static_cast<sal_Int32>(aSz.Height()));
- }
- break;
- case EE_CHAR_FONTWIDTH:
- {
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Breite="));
- aDebStr.append(static_cast<sal_Int32>(((SvxCharScaleWidthItem&)rItem).GetValue()));
- aDebStr.append('%');
- }
- break;
- case EE_CHAR_WEIGHT:
- case EE_CHAR_WEIGHT_CJK:
- case EE_CHAR_WEIGHT_CTL:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("FontWeight="));
- aDebStr.append(static_cast<sal_Int32>(((SvxWeightItem&)rItem).GetWeight()));
- break;
- case EE_CHAR_UNDERLINE:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("FontUnderline="));
- aDebStr.append(static_cast<sal_Int32>(((SvxUnderlineItem&)rItem).GetLineStyle()));
- break;
- case EE_CHAR_OVERLINE:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("FontOverline="));
- aDebStr.append(static_cast<sal_Int32>(((SvxOverlineItem&)rItem).GetLineStyle()));
- break;
- case EE_CHAR_EMPHASISMARK:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("FontUnderline="));
- aDebStr.append(static_cast<sal_Int32>(((SvxEmphasisMarkItem&)rItem).GetEmphasisMark()));
- break;
- case EE_CHAR_RELIEF:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("FontRelief="));
- aDebStr.append(static_cast<sal_Int32>(((SvxCharReliefItem&)rItem).GetValue()));
- break;
- case EE_CHAR_STRIKEOUT:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("FontStrikeout="));
- aDebStr.append(static_cast<sal_Int32>(((SvxCrossedOutItem&)rItem).GetStrikeout()));
- break;
- case EE_CHAR_ITALIC:
- case EE_CHAR_ITALIC_CJK:
- case EE_CHAR_ITALIC_CTL:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("FontPosture="));
- aDebStr.append(static_cast<sal_Int32>(((SvxPostureItem&)rItem).GetPosture()));
- break;
- case EE_CHAR_OUTLINE:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("FontOutline="));
- aDebStr.append(static_cast<sal_Int32>(((SvxContourItem&)rItem).GetValue()));
- break;
- case EE_CHAR_SHADOW:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("FontShadowed="));
- aDebStr.append(static_cast<sal_Int32>(((SvxShadowedItem&)rItem).GetValue()));
- break;
- case EE_CHAR_ESCAPEMENT:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Escape="));
- aDebStr.append(static_cast<sal_Int32>(((SvxEscapementItem&)rItem).GetEsc()));
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aDebStr.append(static_cast<sal_Int32>(((SvxEscapementItem&)rItem).GetProp()));
- break;
- case EE_CHAR_PAIRKERNING:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("PairKerning="));
- aDebStr.append(static_cast<sal_Int32>(((SvxAutoKernItem&)rItem).GetValue()));
- break;
- case EE_CHAR_KERNING:
- {
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("Kerning="));
- aDebStr.append(static_cast<sal_Int32>(((SvxKerningItem&)rItem).GetValue()));
- Size aSz( 0, (short)((SvxKerningItem&)rItem).GetValue() );
- SfxMapUnit eUnit = rPool.GetMetric( rItem.Which() );
- MapMode aItemMapMode( (MapUnit) eUnit );
- MapMode aPntMap( MAP_POINT );
- aSz = OutputDevice::LogicToLogic( aSz, aItemMapMode, aPntMap );
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM(" Points="));
- aDebStr.append(static_cast<sal_Int32>(aSz.Height()));
- }
- break;
- case EE_CHAR_WLM:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("WordLineMode="));
- aDebStr.append(static_cast<sal_Int32>(((SvxWordLineModeItem&)rItem).GetValue()));
- break;
- case EE_CHAR_XMLATTRIBS:
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("XMLAttribs=..."));
- break;
- }
- return aDebStr.makeStringAndClear();
-}
-
-void DbgOutItemSet( FILE* fp, const SfxItemSet& rSet, sal_Bool bSearchInParent, sal_Bool bShowALL )
-{
- for ( sal_uInt16 nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ )
- {
- fprintf( fp, "\nWhich: %i\t", nWhich );
- if ( rSet.GetItemState( nWhich, bSearchInParent ) == SFX_ITEM_OFF )
- fprintf( fp, "ITEM_OFF " );
- else if ( rSet.GetItemState( nWhich, bSearchInParent ) == SFX_ITEM_DONTCARE )
- fprintf( fp, "ITEM_DC " );
- else if ( rSet.GetItemState( nWhich, bSearchInParent ) == SFX_ITEM_ON )
- fprintf( fp, "ITEM_ON *" );
-
- if ( !bShowALL && ( rSet.GetItemState( nWhich, bSearchInParent ) != SFX_ITEM_ON ) )
- continue;
-
- const SfxPoolItem& rItem = rSet.Get( nWhich, bSearchInParent );
- ByteString aDebStr = DbgOutItem( *rSet.GetPool(), rItem );
- fprintf( fp, "%s", aDebStr.GetBuffer() );
- }
-}
-
-void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_Bool bInfoBox )
-{
-#if defined UNX
- FILE* fp = fopen( "/tmp/debug.log", "w" );
-#else
- FILE* fp = fopen( "d:\\debug.log", "w" );
-#endif
- if ( fp == 0 )
- {
- OSL_FAIL( "Log file could not be created!" );
- return;
- }
-
- const SfxItemPool& rPool = *pEE->GetEmptyItemSet().GetPool();
-
- fprintf( fp, "================================================================================" );
- 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, "\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, "\nParagraph attribute:" );
- DbgOutItemSet( fp, pPPortion->GetNode()->GetContentAttribs().GetItems(), sal_False, sal_False );
-
- fprintf( fp, "\nCharacter attribute:" );
- sal_Bool bZeroAttr = sal_False;
- sal_uInt16 z;
- for ( z = 0; z < pPPortion->GetNode()->GetCharAttribs().Count(); z++ )
- {
- EditCharAttrib* pAttr = pPPortion->GetNode()->GetCharAttribs().GetAttribs().GetObject( z );
- rtl::OStringBuffer aCharAttribs;
- aCharAttribs.append(RTL_CONSTASCII_STRINGPARAM("\nA"));
- aCharAttribs.append(static_cast<sal_Int32>(nPortion));
- aCharAttribs.append(RTL_CONSTASCII_STRINGPARAM(": "));
- aCharAttribs.append(static_cast<sal_Int32>(pAttr->GetItem()->Which()));
- aCharAttribs.append('\t');
- aCharAttribs.append(static_cast<sal_Int32>(pAttr->GetStart()));
- aCharAttribs.append('\t');
- aCharAttribs.append(static_cast<sal_Int32>(pAttr->GetEnd()));
- if ( pAttr->IsEmpty() )
- bZeroAttr = sal_True;
- fprintf(fp, "%s => ", aCharAttribs.getStr());
-
- ByteString aDebStr = DbgOutItem( rPool, *pAttr->GetItem() );
- fprintf( fp, "%s", aDebStr.GetBuffer() );
- }
- if ( bZeroAttr )
- fprintf( fp, "\nNULL-Attribute!" );
-
- sal_uInt16 nTextPortions = pPPortion->GetTextPortions().Count();
- rtl::OStringBuffer aPortionStr(
- RTL_CONSTASCII_STRINGPARAM("\nText portions: #"));
- aPortionStr.append(static_cast<sal_Int32>(nTextPortions));
- aPortionStr.append(RTL_CONSTASCII_STRINGPARAM(" \nA"));
- aPortionStr.append(static_cast<sal_Int32>(nPortion));
- aPortionStr.append(
- RTL_CONSTASCII_STRINGPARAM(": Paragraph Length = "));
- aPortionStr.append(static_cast<sal_Int32>(pPPortion->GetNode()->Len()));
- aPortionStr.append(RTL_CONSTASCII_STRINGPARAM("\nA"));
- aPortionStr.append(static_cast<sal_Int32>(nPortion));
- aPortionStr.append(RTL_CONSTASCII_STRINGPARAM(": "));
- sal_uLong n = 0;
- for ( z = 0; z < nTextPortions; z++ )
- {
- TextPortion* pPortion = pPPortion->GetTextPortions().GetObject( z );
- aPortionStr.append(' ');
- aPortionStr.append(static_cast<sal_Int32>(pPortion->GetLen()));
- aPortionStr.append('(');
- aPortionStr.append(static_cast<sal_Int32>(pPortion->GetSize().Width()));
- aPortionStr.append(')');
- aPortionStr.append('[');
- aPortionStr.append(static_cast<sal_Int32>(pPortion->GetKind()));
- aPortionStr.append(']');
- aPortionStr.append(';');
- n += pPortion->GetLen();
- }
- aPortionStr.append(RTL_CONSTASCII_STRINGPARAM("\nA"));
- aPortionStr.append(static_cast<sal_Int32>(nPortion));
- aPortionStr.append(RTL_CONSTASCII_STRINGPARAM(": Total length: "));
- aPortionStr.append(static_cast<sal_Int32>(n));
- if ( pPPortion->GetNode()->Len() != n )
- aPortionStr.append(RTL_CONSTASCII_STRINGPARAM(" => Error !!!"));
- fprintf(fp, "%s", aPortionStr.getStr());
-
- 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, "\nLine %i\t>%s<", nLine, aLine.GetBuffer() );
- }
- // 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.\tHight: %i, Ascent=%i", pLine->GetStartPortion(), pLine->GetEndPortion(), pLine->GetHeight(), pLine->GetMaxAscent() );
- }
-
- fprintf( fp, "\n-----------------------------------------------------------------------------" );
- }
-
- if ( pEE->pImpEditEngine->GetStyleSheetPool() )
- {
- sal_uLong nStyles = pEE->pImpEditEngine->GetStyleSheetPool() ? pEE->pImpEditEngine->GetStyleSheetPool()->Count() : 0;
- fprintf( fp, "\n\n ================================================================================" );
- fprintf( fp, "\n================== Stylesheets =============================================" );
- fprintf( fp, "\n================================================================================" );
- fprintf( fp, "\n#Template: %lu\n", nStyles );
- SfxStyleSheetIterator aIter( pEE->pImpEditEngine->GetStyleSheetPool(), SFX_STYLE_FAMILY_ALL );
- SfxStyleSheetBase* pStyle = aIter.First();
- while ( pStyle )
- {
- 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 );
- fprintf( fp, "\n----------------------------------" );
-
- pStyle = aIter.Next();
- }
- }
-
- 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================== EditEngine & Views ======================================" );
- fprintf( fp, "\n================================================================================" );
- fprintf( fp, "\nControl: %"SAL_PRIxUINT32, pEE->GetControlWord() );
- fprintf( fp, "\nRefMapMode: %i", pEE->pImpEditEngine->pRefDev->GetMapMode().GetMapUnit() );
- fprintf( fp, "\nPaperSize: %li x %li", pEE->GetPaperSize().Width(), pEE->GetPaperSize().Height() );
- 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, "\nNumber of Views: %i", pEE->GetViewCount() );
- for ( sal_uInt16 nView = 0; nView < pEE->GetViewCount(); nView++ )
- {
- EditView* pV = pEE->GetView( nView );
- 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 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================== Current View ===========================================" );
- fprintf( fp, "\n================================================================================" );
- DbgOutItemSet( fp, pEE->GetActiveView()->GetAttribs(), sal_True, sal_False );
- }
- fclose( fp );
- if ( bInfoBox )
- InfoBox(0, String( RTL_CONSTASCII_USTRINGPARAM( "D:\\DEBUG.LOG !" ) ) ).Execute();
-}
-
-rtl::OString EditDbg::GetPortionInfo( ParaPortion* pPPortion )
-{
- sal_uInt16 z;
-
- rtl::OStringBuffer aDebStr(RTL_CONSTASCII_STRINGPARAM("Paragraph Length = "));
- aDebStr.append(static_cast<sal_Int32>(pPPortion->GetNode()->Len()));
-
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("\nCharacter attribute:"));
- for ( z = 0; z < pPPortion->GetNode()->GetCharAttribs().Count(); z++ )
- {
- EditCharAttrib* pAttr = pPPortion->GetNode()->GetCharAttribs().GetAttribs().GetObject( z );
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("\n "));
- aDebStr.append(static_cast<sal_Int32>(pAttr->GetItem()->Which()));
- aDebStr.append('\t');
- aDebStr.append(static_cast<sal_Int32>(pAttr->GetStart()));
- aDebStr.append('\t');
- aDebStr.append(static_cast<sal_Int32>(pAttr->GetEnd()));
- }
-
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("\nText portions:"));
- sal_uInt16 n = 0;
- for ( z = 0; z < pPPortion->GetTextPortions().Count(); z++ )
- {
- TextPortion* pPortion = pPPortion->GetTextPortions().GetObject( z );
- aDebStr.append(' ');
- aDebStr.append(static_cast<sal_Int32>(pPortion->GetLen()));
- aDebStr.append('(');
- aDebStr.append(static_cast<sal_Int32>(pPortion->GetSize().Width()));
- aDebStr.append(')');
- aDebStr.append(';');
- n = n + pPortion->GetLen();
- }
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("\nTotal length: "));
- aDebStr.append(static_cast<sal_Int32>(n));
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("\nSorted after Start:"));
- for ( sal_uInt16 x = 0; x < pPPortion->GetNode()->GetCharAttribs().Count(); x++ )
- {
- EditCharAttrib* pCurAttrib = pPPortion->GetNode()->GetCharAttribs().GetAttribs().GetObject( x );
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("\nStart: "));
- aDebStr.append(static_cast<sal_Int32>(pCurAttrib->GetStart()));
- aDebStr.append(RTL_CONSTASCII_STRINGPARAM("\tEnd: "));
- aDebStr.append(static_cast<sal_Int32>(pCurAttrib->GetEnd()));
- }
- return aDebStr.makeStringAndClear();
-}
-
-rtl::OString EditDbg::GetTextPortionInfo(TextPortionList& rPortions)
-{
- rtl::OStringBuffer aDebStr;
- for (sal_uInt16 z = 0; z < rPortions.Count(); ++z)
- {
- TextPortion* pPortion = rPortions.GetObject( z );
- aDebStr.append(' ');
- aDebStr.append(static_cast<sal_Int32>(pPortion->GetLen()));
- aDebStr.append('(');
- aDebStr.append(static_cast<sal_Int32>(pPortion->GetSize().Width()));
- aDebStr.append(')');
- aDebStr.append(';');
- }
- return aDebStr.makeStringAndClear();
-}
-
-void EditDbg::ShowPortionData( ParaPortion* pPortion )
-{
- ByteString aDebStr( GetPortionInfo( pPortion ) );
- InfoBox( 0, String( aDebStr, RTL_TEXTENCODING_ASCII_US ) ).Execute();
-}
-
-
-sal_Bool ParaPortion::DbgCheckTextPortions()
-{
- // check, if Portion length ok:
- sal_uInt16 nXLen = 0;
- for ( sal_uInt16 nPortion = 0; nPortion < aTextPortionList.Count(); nPortion++ )
- nXLen = nXLen + aTextPortionList[nPortion]->GetLen();
- return nXLen == pNode->Len() ? sal_True : sal_False;
-}
-
-sal_Bool CheckOrderedList( CharAttribArray& rAttribs, sal_Bool bStart )
-{
- sal_uInt16 nPrev = 0;
- for ( sal_uInt16 nAttr = 0; nAttr < rAttribs.Count(); nAttr++ )
- {
- EditCharAttrib* pAttr = rAttribs[nAttr];
- sal_uInt16 nCur = bStart ? pAttr->GetStart() : pAttr->GetEnd();
- if ( nCur < nPrev )
- return sal_False;
-
- nPrev = nCur;
- }
- return sal_True;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editdbg.hxx b/editeng/source/editeng/editdbg.hxx
deleted file mode 100644
index 16fda80d92..0000000000
--- a/editeng/source/editeng/editdbg.hxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDITDBG_HXX
-#define _EDITDBG_HXX
-
-#include <svl/solar.hrc>
-#include <tools/string.hxx>
-#include <stdio.h>
-
-class EditEngine;
-class ParaPortion;
-class EditUndoList;
-class TextPortionList;
-class SfxItemSet;
-class SfxItemPool;
-class SfxPoolItem;
-
-rtl::OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem);
-void DbgOutItemSet( FILE* fp, const SfxItemSet& rSet, sal_Bool bSearchInParent, sal_Bool bShowALL );
-
-class EditDbg
-{
-public:
- static void ShowEditEngineData( EditEngine* pEditEngine, sal_Bool bInfoBox = sal_True );
- static void ShowPortionData( ParaPortion* pPortion );
- static rtl::OString GetPortionInfo( ParaPortion* pPPortion );
- static rtl::OString GetTextPortionInfo(TextPortionList& rPortions);
- static ByteString GetUndoDebStr( EditUndoList* pUndoList );
-};
-
-
-#endif // _EDITDBG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
deleted file mode 100644
index 30b0aa0fdc..0000000000
--- a/editeng/source/editeng/editdoc.cxx
+++ /dev/null
@@ -1,2294 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-
-#include <editeng/tstpitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/crsditem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/wrlmitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/cntritem.hxx>
-#include <editeng/escpitem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/akrnitem.hxx>
-#include <editeng/cscoitem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/emphitem.hxx>
-#include <editeng/charscaleitem.hxx>
-#include <editeng/charreliefitem.hxx>
-#include <editeng/xmlcnitm.hxx>
-#include <editeng/editids.hrc>
-
-#include <editdoc.hxx>
-#include <editdbg.hxx>
-#include <editeng/eerdll.hxx>
-#include <eerdll2.hxx>
-#include <tools/stream.hxx>
-#include <tools/debug.hxx>
-#include <tools/shl.hxx>
-#include <vcl/svapp.hxx>
-#include <com/sun/star/i18n/ScriptType.hpp>
-#include <stdlib.h> // qsort
-
-using namespace ::com::sun::star;
-
-
-// ------------------------------------------------------------
-
-sal_uInt16 GetScriptItemId( sal_uInt16 nItemId, short nScriptType )
-{
- sal_uInt16 nId = nItemId;
-
- if ( ( nScriptType == i18n::ScriptType::ASIAN ) ||
- ( nScriptType == i18n::ScriptType::COMPLEX ) )
- {
- switch ( nItemId )
- {
- case EE_CHAR_LANGUAGE:
- nId = ( nScriptType == i18n::ScriptType::ASIAN ) ? EE_CHAR_LANGUAGE_CJK : EE_CHAR_LANGUAGE_CTL;
- break;
- case EE_CHAR_FONTINFO:
- nId = ( nScriptType == i18n::ScriptType::ASIAN ) ? EE_CHAR_FONTINFO_CJK : EE_CHAR_FONTINFO_CTL;
- break;
- case EE_CHAR_FONTHEIGHT:
- nId = ( nScriptType == i18n::ScriptType::ASIAN ) ? EE_CHAR_FONTHEIGHT_CJK : EE_CHAR_FONTHEIGHT_CTL;
- break;
- case EE_CHAR_WEIGHT:
- nId = ( nScriptType == i18n::ScriptType::ASIAN ) ? EE_CHAR_WEIGHT_CJK : EE_CHAR_WEIGHT_CTL;
- break;
- case EE_CHAR_ITALIC:
- nId = ( nScriptType == i18n::ScriptType::ASIAN ) ? EE_CHAR_ITALIC_CJK : EE_CHAR_ITALIC_CTL;
- break;
- }
- }
-
- return nId;
-}
-
-sal_Bool IsScriptItemValid( sal_uInt16 nItemId, short nScriptType )
-{
- sal_Bool bValid = sal_True;
-
- switch ( nItemId )
- {
- case EE_CHAR_LANGUAGE:
- bValid = nScriptType == i18n::ScriptType::LATIN;
- break;
- case EE_CHAR_LANGUAGE_CJK:
- bValid = nScriptType == i18n::ScriptType::ASIAN;
- break;
- case EE_CHAR_LANGUAGE_CTL:
- bValid = nScriptType == i18n::ScriptType::COMPLEX;
- break;
- case EE_CHAR_FONTINFO:
- bValid = nScriptType == i18n::ScriptType::LATIN;
- break;
- case EE_CHAR_FONTINFO_CJK:
- bValid = nScriptType == i18n::ScriptType::ASIAN;
- break;
- case EE_CHAR_FONTINFO_CTL:
- bValid = nScriptType == i18n::ScriptType::COMPLEX;
- break;
- case EE_CHAR_FONTHEIGHT:
- bValid = nScriptType == i18n::ScriptType::LATIN;
- break;
- case EE_CHAR_FONTHEIGHT_CJK:
- bValid = nScriptType == i18n::ScriptType::ASIAN;
- break;
- case EE_CHAR_FONTHEIGHT_CTL:
- bValid = nScriptType == i18n::ScriptType::COMPLEX;
- break;
- case EE_CHAR_WEIGHT:
- bValid = nScriptType == i18n::ScriptType::LATIN;
- break;
- case EE_CHAR_WEIGHT_CJK:
- bValid = nScriptType == i18n::ScriptType::ASIAN;
- break;
- case EE_CHAR_WEIGHT_CTL:
- bValid = nScriptType == i18n::ScriptType::COMPLEX;
- break;
- case EE_CHAR_ITALIC:
- bValid = nScriptType == i18n::ScriptType::LATIN;
- break;
- case EE_CHAR_ITALIC_CJK:
- bValid = nScriptType == i18n::ScriptType::ASIAN;
- break;
- case EE_CHAR_ITALIC_CTL:
- bValid = nScriptType == i18n::ScriptType::COMPLEX;
- break;
- }
-
- return bValid;
-}
-
-
-// ------------------------------------------------------------
-
-// Should later be moved to TOOLS/STRING (Current: 303)
-// for Grep: WS_TARGET
-
-DBG_NAME( EE_TextPortion );
-DBG_NAME( EE_EditLine );
-DBG_NAME( EE_ContentNode );
-DBG_NAME( EE_CharAttribList );
-
-SfxItemInfo aItemInfos[EDITITEMCOUNT] = {
- { SID_ATTR_FRAMEDIRECTION, SFX_ITEM_POOLABLE }, // EE_PARA_WRITINGDIR
- { 0, SFX_ITEM_POOLABLE }, // EE_PARA_XMLATTRIBS
- { SID_ATTR_PARA_HANGPUNCTUATION, SFX_ITEM_POOLABLE }, // EE_PARA_HANGINGPUNCTUATION
- { SID_ATTR_PARA_FORBIDDEN_RULES, SFX_ITEM_POOLABLE },
- { SID_ATTR_PARA_SCRIPTSPACE, SFX_ITEM_POOLABLE }, // EE_PARA_ASIANCJKSPACING
- { SID_ATTR_NUMBERING_RULE, SFX_ITEM_POOLABLE }, // EE_PARA_NUMBULL
- { 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 }, // 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 },
- { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_WEIGHT, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_UNDERLINE, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_POSTURE, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_CONTOUR, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_SHADOWED, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_AUTOKERN, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_KERNING, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_LANGUAGE, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_CJK_FONT, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_CTL_FONT, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEM_POOLABLE },
- { SID_ATTR_CHAR_RELIEF, SFX_ITEM_POOLABLE },
- { 0, SFX_ITEM_POOLABLE }, // EE_CHAR_RUBI_DUMMY
- { 0, SFX_ITEM_POOLABLE }, // EE_CHAR_XMLATTRIBS
- { SID_ATTR_CHAR_OVERLINE, SFX_ITEM_POOLABLE },
- { 0, SFX_ITEM_POOLABLE }, // EE_FEATURE_TAB
- { 0, SFX_ITEM_POOLABLE }, // EE_FEATURE_LINEBR
- { SID_ATTR_CHAR_CHARSETCOLOR, SFX_ITEM_POOLABLE }, // EE_FEATURE_NOTCONV
- { SID_FIELD, SFX_ITEM_POOLABLE }
-};
-
-sal_uInt16 aV1Map[] = {
- 3999, 4001, 4002, 4003, 4004, 4005, 4006,
- 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4017, 4018, 4019 // MI: 4019?
-};
-
-sal_uInt16 aV2Map[] = {
- 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009,
- 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4018, 4019, 4020
-};
-
-sal_uInt16 aV3Map[] = {
- 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007,
- 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019,
- 4020, 4021
-};
-
-sal_uInt16 aV4Map[] = {
- 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003,
- 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013,
- 4014, 4015, 4016, 4017, 4018,
- /* CJK Items inserted here: EE_CHAR_LANGUAGE - EE_CHAR_XMLATTRIBS */
- 4034, 4035, 4036, 4037
-};
-
-sal_uInt16 aV5Map[] = {
- 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003,
- 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013,
- 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023,
- 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033,
- /* EE_CHAR_OVERLINE inserted here */
- 4035, 4036, 4037, 4038
-};
-
-SV_IMPL_PTRARR( DummyContentList, ContentNode* );
-
-int SAL_CALL CompareStart( const void* pFirst, const void* pSecond )
-{
- if ( (*((EditCharAttrib**)pFirst))->GetStart() < (*((EditCharAttrib**)pSecond))->GetStart() )
- return (-1);
- else if ( (*((EditCharAttrib**)pFirst))->GetStart() > (*((EditCharAttrib**)pSecond))->GetStart() )
- return (1);
- return 0;
-}
-
-EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE )
-{
- // Create a new attribute in the pool
- const SfxPoolItem& rNew = rPool.Put( rAttr );
-
- EditCharAttrib* pNew = 0;
- switch( rNew.Which() )
- {
- case EE_CHAR_LANGUAGE:
- case EE_CHAR_LANGUAGE_CJK:
- case EE_CHAR_LANGUAGE_CTL:
- {
- pNew = new EditCharAttribLanguage( (const SvxLanguageItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_COLOR:
- {
- pNew = new EditCharAttribColor( (const SvxColorItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_FONTINFO:
- case EE_CHAR_FONTINFO_CJK:
- case EE_CHAR_FONTINFO_CTL:
- {
- pNew = new EditCharAttribFont( (const SvxFontItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_FONTHEIGHT:
- case EE_CHAR_FONTHEIGHT_CJK:
- case EE_CHAR_FONTHEIGHT_CTL:
- {
- pNew = new EditCharAttribFontHeight( (const SvxFontHeightItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_FONTWIDTH:
- {
- pNew = new EditCharAttribFontWidth( (const SvxCharScaleWidthItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_WEIGHT:
- case EE_CHAR_WEIGHT_CJK:
- case EE_CHAR_WEIGHT_CTL:
- {
- pNew = new EditCharAttribWeight( (const SvxWeightItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_UNDERLINE:
- {
- pNew = new EditCharAttribUnderline( (const SvxUnderlineItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_OVERLINE:
- {
- pNew = new EditCharAttribOverline( (const SvxOverlineItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_EMPHASISMARK:
- {
- pNew = new EditCharAttribEmphasisMark( (const SvxEmphasisMarkItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_RELIEF:
- {
- pNew = new EditCharAttribRelief( (const SvxCharReliefItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_STRIKEOUT:
- {
- pNew = new EditCharAttribStrikeout( (const SvxCrossedOutItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_ITALIC:
- case EE_CHAR_ITALIC_CJK:
- case EE_CHAR_ITALIC_CTL:
- {
- pNew = new EditCharAttribItalic( (const SvxPostureItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_OUTLINE:
- {
- pNew = new EditCharAttribOutline( (const SvxContourItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_SHADOW:
- {
- pNew = new EditCharAttribShadow( (const SvxShadowedItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_ESCAPEMENT:
- {
- pNew = new EditCharAttribEscapement( (const SvxEscapementItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_PAIRKERNING:
- {
- pNew = new EditCharAttribPairKerning( (const SvxAutoKernItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_KERNING:
- {
- pNew = new EditCharAttribKerning( (const SvxKerningItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_WLM:
- {
- pNew = new EditCharAttribWordLineMode( (const SvxWordLineModeItem&)rNew, nS, nE );
- }
- break;
- case EE_CHAR_XMLATTRIBS:
- {
- pNew = new EditCharAttrib( rNew, nS, nE ); // Attribute is only for holding XML information...
- }
- break;
- case EE_FEATURE_TAB:
- {
- pNew = new EditCharAttribTab( (const SfxVoidItem&)rNew, nS );
- }
- break;
- case EE_FEATURE_LINEBR:
- {
- pNew = new EditCharAttribLineBreak( (const SfxVoidItem&)rNew, nS );
- }
- break;
- case EE_FEATURE_FIELD:
- {
- pNew = new EditCharAttribField( (const SvxFieldItem&)rNew, nS );
- }
- break;
- default:
- {
- OSL_FAIL( "Invalid Attribute!" );
- }
- }
- return pNew;
-}
-
-EditLine::EditLine()
-{
- DBG_CTOR( EE_EditLine, 0 );
-
- nStart = nEnd = 0;
- 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;
- nTxtHeight = 0;
- nTxtWidth = 0;
- nCrsrHeight = 0;
- nMaxAscent = 0;
- bHangingPunctuation = sal_False;
- bInvalid = sal_True;
-}
-
-EditLine::EditLine( const EditLine& r )
-{
- DBG_CTOR( EE_EditLine, 0 );
-
- nEnd = r.nEnd;
- nStart = r.nStart;
- nStartPortion = r.nStartPortion;
- nEndPortion = r.nEndPortion;
- bHangingPunctuation = r.bHangingPunctuation;
-
- nHeight = 0;
- nStartPosX = 0;
- nTxtHeight = 0;
- nTxtWidth = 0;
- nCrsrHeight = 0;
- nMaxAscent = 0;
- bInvalid = sal_True;
-}
-
-EditLine::~EditLine()
-{
- DBG_DTOR( EE_EditLine, 0 );
-}
-
-EditLine* EditLine::Clone() const
-{
- EditLine* pL = new EditLine;
- if ( aPositions.Count() )
- {
- pL->aPositions.Insert (aPositions.GetData(), aPositions.Count(), 0);
- }
- pL->nStartPosX = nStartPosX;
- pL->nStart = nStart;
- pL->nEnd = nEnd;
- pL->nStartPortion = nStartPortion;
- pL->nEndPortion = nEndPortion;
- pL->nHeight = nHeight;
- pL->nTxtWidth = nTxtWidth;
- pL->nTxtHeight = nTxtHeight;
- pL->nCrsrHeight = nCrsrHeight;
- pL->nMaxAscent = nMaxAscent;
-
- return pL;
-}
-
-sal_Bool operator == ( const EditLine& r1, const EditLine& r2 )
-{
- if ( r1.nStart != r2.nStart )
- return sal_False;
-
- if ( r1.nEnd != r2.nEnd )
- return sal_False;
-
- if ( r1.nStartPortion != r2.nStartPortion )
- return sal_False;
-
- if ( r1.nEndPortion != r2.nEndPortion )
- return sal_False;
-
- return sal_True;
-}
-
-EditLine& EditLine::operator = ( const EditLine& r )
-{
- nEnd = r.nEnd;
- nStart = r.nStart;
- nEndPortion = r.nEndPortion;
- nStartPortion = r.nStartPortion;
- return *this;
-}
-
-
-sal_Bool operator != ( const EditLine& r1, const EditLine& r2 )
-{
- return !( r1 == r2 );
-}
-
-Size EditLine::CalcTextSize( ParaPortion& rParaPortion )
-{
- Size aSz;
- Size aTmpSz;
- TextPortion* pPortion;
-
- sal_uInt16 nIndex = GetStart();
-
- DBG_ASSERT( rParaPortion.GetTextPortions().Count(), "GetTextSize before CreatePortions !" );
-
- for ( sal_uInt16 n = nStartPortion; n <= nEndPortion; n++ )
- {
- pPortion = rParaPortion.GetTextPortions().GetObject(n);
- switch ( pPortion->GetKind() )
- {
- case PORTIONKIND_TEXT:
- case PORTIONKIND_FIELD:
- case PORTIONKIND_HYPHENATOR:
- {
- aTmpSz = pPortion->GetSize();
- aSz.Width() += aTmpSz.Width();
- if ( aSz.Height() < aTmpSz.Height() )
- aSz.Height() = aTmpSz.Height();
- }
- break;
- case PORTIONKIND_TAB:
- {
- aSz.Width() += pPortion->GetSize().Width();
- }
- break;
- }
- nIndex = nIndex + pPortion->GetLen();
- }
-
- SetHeight( (sal_uInt16)aSz.Height() );
- return aSz;
-}
-
-EditLineList::EditLineList()
-{
-}
-
-EditLineList::~EditLineList()
-{
- Reset();
-}
-
-void EditLineList::Reset()
-{
- for ( sal_uInt16 nLine = 0; nLine < Count(); nLine++ )
- delete GetObject(nLine);
- Remove( 0, Count() );
-}
-
-void EditLineList::DeleteFromLine( sal_uInt16 nDelFrom )
-{
- DBG_ASSERT( nDelFrom <= (Count() - 1), "DeleteFromLine: Out of range" );
- for ( sal_uInt16 nL = nDelFrom; nL < Count(); nL++ )
- delete GetObject(nL);
- Remove( nDelFrom, Count()-nDelFrom );
-}
-
-sal_uInt16 EditLineList::FindLine( sal_uInt16 nChar, sal_Bool bInclEnd )
-{
- for ( sal_uInt16 nLine = 0; nLine < Count(); nLine++ )
- {
- EditLine* pLine = GetObject( nLine );
- if ( ( bInclEnd && ( pLine->GetEnd() >= nChar ) ) ||
- ( pLine->GetEnd() > nChar ) )
- {
- return nLine;
- }
- }
-
- DBG_ASSERT( !bInclEnd, "Line not found: FindLine" );
- return ( Count() - 1 );
-}
-
-sal_Bool EditPaM::DbgIsBuggy( EditDoc& rDoc )
-{
- if ( !pNode )
- return sal_True;
- if ( rDoc.GetPos( pNode ) >= rDoc.Count() )
- return sal_True;
- if ( nIndex > pNode->Len() )
- return sal_True;
-
- return sal_False;
-}
-
-sal_Bool EditSelection::DbgIsBuggy( EditDoc& rDoc )
-{
- if ( aStartPaM.DbgIsBuggy( rDoc ) )
- return sal_True;
- if ( aEndPaM.DbgIsBuggy( rDoc ) )
- return sal_True;
-
- return sal_False;
-}
-
-EditSelection::EditSelection()
-{
-}
-
-EditSelection::EditSelection( const EditPaM& rStartAndAnd )
-{
- // 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 )
-{
- // could still be optimized!
- aStartPaM = rStart;
- aEndPaM = rEnd;
-}
-
-EditSelection& EditSelection::operator = ( const EditPaM& rPaM )
-{
- aStartPaM = rPaM;
- aEndPaM = rPaM;
- return *this;
-}
-
-sal_Bool EditSelection::IsInvalid() const
-{
- EditPaM aEmptyPaM;
-
- if ( aStartPaM == aEmptyPaM )
- return sal_True;
-
- if ( aEndPaM == aEmptyPaM )
- return sal_True;
-
- return sal_False;
-}
-
-sal_Bool EditSelection::Adjust( const ContentList& rNodes )
-{
- 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();
-
- sal_uInt16 nStartNode = rNodes.GetPos( pStartNode );
- sal_uInt16 nEndNode = rNodes.GetPos( pEndNode );
-
- 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 )
- bSwap = sal_True;
- else if ( ( nStartNode == nEndNode ) && ( aStartPaM.GetIndex() > aEndPaM.GetIndex() ) )
- bSwap = sal_True;
-
- if ( bSwap )
- {
- EditPaM aTmpPaM( aStartPaM );
- aStartPaM = aEndPaM;
- aEndPaM = aTmpPaM;
- }
-
- return bSwap;
-}
-
-sal_Bool operator == ( const EditPaM& r1, const EditPaM& r2 )
-{
- if ( r1.GetNode() != r2.GetNode() )
- return sal_False;
-
- if ( r1.GetIndex() != r2.GetIndex() )
- return sal_False;
-
- return sal_True;
-}
-
-EditPaM& EditPaM::operator = ( const EditPaM& rPaM )
-{
- nIndex = rPaM.nIndex;
- pNode = rPaM.pNode;
- return *this;
-}
-
-sal_Bool operator != ( const EditPaM& r1, const EditPaM& r2 )
-{
- return !( r1 == r2 );
-}
-
-ContentNode::ContentNode( SfxItemPool& rPool ) : aContentAttribs( rPool )
-{
- DBG_CTOR( EE_ContentNode, 0 );
- pWrongList = NULL;
-}
-
-ContentNode::ContentNode( const XubString& rStr, const ContentAttribs& rContentAttribs ) :
- XubString( rStr ), aContentAttribs( rContentAttribs )
-{
- DBG_CTOR( EE_ContentNode, 0 );
- pWrongList = NULL;
-}
-
-ContentNode::~ContentNode()
-{
- DBG_DTOR( EE_ContentNode, 0 );
- delete pWrongList;
-}
-
-void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool& rItemPool )
-{
- if ( !nNew )
- return;
-
- // Since features are treated differently than normal character attributes,
- // can also the order of the start list be change!
- // In every if ..., in the next (n) opportunities due to bFeature or
- // an existing special case, must (n-1) opportunities be provided with
- // bResort. The most likely possibility receives no bResort, so that is
- // not sorted anew when all attributes are the same.
- sal_Bool bResort = sal_False;
- sal_Bool bExpandedEmptyAtIndexNull = sal_False;
-
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttrib = GetAttrib( aCharAttribList.GetAttribs(), nAttr );
- while ( pAttrib )
- {
- if ( pAttrib->GetEnd() >= nIndex )
- {
- // Move all attributes behind the insertion point...
- if ( pAttrib->GetStart() > nIndex )
- {
- pAttrib->MoveForward( nNew );
- }
- // 0: Expand empty attribute, if at insertion point
- else if ( pAttrib->IsEmpty() )
- {
- // 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: Attribute starts before, goes to index ...
- else if ( pAttrib->GetEnd() == nIndex ) // Start must be before
- {
- // 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 ) )
- {
- if ( !pAttrib->IsEdge() )
- pAttrib->Expand( nNew );
- }
- else
- bResort = sal_True;
- }
- // 2: Attribute starts before, goes past the Index...
- else if ( ( pAttrib->GetStart() < nIndex ) && ( pAttrib->GetEnd() > nIndex ) )
- {
- DBG_ASSERT( !pAttrib->IsFeature(), "Large Feature?!" );
- pAttrib->Expand( nNew );
- }
- // 3: Attribute starts on index...
- else if ( pAttrib->GetStart() == nIndex )
- {
- if ( pAttrib->IsFeature() )
- {
- pAttrib->MoveForward( nNew );
- bResort = sal_True;
- }
- else
- {
- sal_Bool bExpand = sal_False;
- if ( nIndex == 0 )
- {
- bExpand = sal_True;
- if( bExpandedEmptyAtIndexNull )
- {
- // Check if this kind of attribut was empty and expanded here...
- sal_uInt16 nW = pAttrib->GetItem()->Which();
- for ( sal_uInt16 nA = 0; nA < nAttr; nA++ )
- {
- EditCharAttrib* pA = aCharAttribList.GetAttribs()[nA];
- if ( ( pA->GetStart() == 0 ) && ( pA->GetItem()->Which() == nW ) )
- {
- bExpand = sal_False;
- break;
- }
- }
-
- }
- }
- if ( bExpand )
- {
- pAttrib->Expand( nNew );
- bResort = sal_True;
- }
- else
- {
- pAttrib->MoveForward( nNew );
- }
- }
- }
- }
-
- if ( pAttrib->IsEdge() )
- pAttrib->SetEdge( sal_False );
-
- DBG_ASSERT( !pAttrib->IsFeature() || ( pAttrib->GetLen() == 1 ), "Expand: FeaturesLen != 1" );
-
- DBG_ASSERT( pAttrib->GetStart() <= pAttrib->GetEnd(), "Expand: Attribute distorted!" );
- DBG_ASSERT( ( pAttrib->GetEnd() <= Len() ), "Expand: Attribute larger than paragraph!" );
- if ( pAttrib->IsEmpty() )
- {
- OSL_FAIL( "Empty Attribute after ExpandAttribs?" );
- bResort = sal_True;
- aCharAttribList.GetAttribs().Remove( nAttr );
- rItemPool.Remove( *pAttrib->GetItem() );
- delete pAttrib;
- nAttr--;
- }
- nAttr++;
- pAttrib = GetAttrib( aCharAttribList.GetAttribs(), nAttr );
- }
-
- if ( bResort )
- aCharAttribList.ResortAttribs();
-
- if ( pWrongList )
- {
- sal_Bool bSep = ( GetChar( nIndex ) == ' ' ) || IsFeature( nIndex );
- pWrongList->TextInserted( nIndex, nNew, bSep );
- }
-
-#if OSL_DEBUG_LEVEL > 2
- OSL_ENSURE( CheckOrderedList( aCharAttribList.GetAttribs(), sal_True ), "Expand: Start List distorted" );
-#endif
-}
-
-void ContentNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted, SfxItemPool& rItemPool )
-{
- if ( !nDeleted )
- return;
-
- // 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;
-
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttrib = GetAttrib( aCharAttribList.GetAttribs(), nAttr );
- while ( pAttrib )
- {
- bDelAttr = sal_False;
- if ( pAttrib->GetEnd() >= nIndex )
- {
- // Move all Attribute behind the insert point...
- if ( pAttrib->GetStart() >= nEndChanges )
- {
- pAttrib->MoveBackward( nDeleted );
- }
- // 1. Delete Internal attributes...
- else if ( ( pAttrib->GetStart() >= nIndex ) && ( pAttrib->GetEnd() <= nEndChanges ) )
- {
- // Special case: Attribute covers the area exactly
- // => keep as empty Attribute.
- if ( !pAttrib->IsFeature() && ( pAttrib->GetStart() == nIndex ) && ( pAttrib->GetEnd() == nEndChanges ) )
- pAttrib->GetEnd() = nIndex; // empty
- else
- bDelAttr = sal_True;
- }
- // 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 ) // ends inside
- pAttrib->GetEnd() = nIndex;
- else
- pAttrib->Collaps( nDeleted ); // ends behind
- }
- // 3. Attribute starts inside, ending behind ...
- else if ( ( pAttrib->GetStart() >= nIndex ) && ( pAttrib->GetEnd() > nEndChanges ) )
- {
- // Features not allowed to expand!
- if ( pAttrib->IsFeature() )
- {
- pAttrib->MoveBackward( nDeleted );
- bResort = sal_True;
- }
- else
- {
- pAttrib->GetStart() = nEndChanges;
- pAttrib->MoveBackward( nDeleted );
- }
- }
- }
- DBG_ASSERT( !pAttrib->IsFeature() || ( pAttrib->GetLen() == 1 ), "Expand: FeaturesLen != 1" );
-
- 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 );
- rItemPool.Remove( *pAttrib->GetItem() );
- delete pAttrib;
- nAttr--;
- }
- else if ( pAttrib->IsEmpty() )
- aCharAttribList.HasEmptyAttribs() = sal_True;
-
- nAttr++;
- pAttrib = GetAttrib( aCharAttribList.GetAttribs(), nAttr );
- }
-
- if ( bResort )
- aCharAttribList.ResortAttribs();
-
- if ( pWrongList )
- pWrongList->TextDeleted( nIndex, nDeleted );
-
-#if OSL_DEBUG_LEVEL > 2
- OSL_ENSURE( CheckOrderedList( aCharAttribList.GetAttribs(), sal_True ), "Collaps: Start list distorted" );
-#endif
-}
-
-void ContentNode::CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, sal_Bool bKeepEndingAttribs )
-{
- DBG_ASSERT( pPrevNode, "Copy of attributes to a null pointer?" );
-
- xub_StrLen nCut = pPrevNode->Len();
-
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttrib = GetAttrib( pPrevNode->GetCharAttribs().GetAttribs(), nAttr );
- while ( pAttrib )
- {
- if ( pAttrib->GetEnd() < nCut )
- {
- // remain unchanged ....
- ;
- }
- else if ( pAttrib->GetEnd() == nCut )
- {
- // 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 failed!" );
- aCharAttribList.InsertAttrib( pNewAttrib );
- }
- }
- else if ( pAttrib->IsInside( nCut ) || ( !nCut && !pAttrib->GetStart() && !pAttrib->IsFeature() ) )
- {
- // 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 failed!" );
- aCharAttribList.InsertAttrib( pNewAttrib );
- pAttrib->GetEnd() = nCut;
- }
- else
- {
- // Move all attributes in the current node (this)
-// pPrevNode->GetCharAttribs().RemoveAttrib( pAttrib );
- pPrevNode->GetCharAttribs().GetAttribs().Remove( nAttr );
- aCharAttribList.InsertAttrib( pAttrib );
- DBG_ASSERT( pAttrib->GetStart() >= nCut, "Start < nCut!" );
- DBG_ASSERT( pAttrib->GetEnd() >= nCut, "End < nCut!" );
- pAttrib->GetStart() = pAttrib->GetStart() - nCut;
- pAttrib->GetEnd() = pAttrib->GetEnd() - nCut;
- nAttr--;
- }
- nAttr++;
- pAttrib = GetAttrib( pPrevNode->GetCharAttribs().GetAttribs(), nAttr );
- }
-}
-
-void ContentNode::AppendAttribs( ContentNode* pNextNode )
-{
- DBG_ASSERT( pNextNode, "Copy of attributes to a null pointer?" );
-
- sal_uInt16 nNewStart = Len();
-
-#if OSL_DEBUG_LEVEL > 2
- OSL_ENSURE( aCharAttribList.DbgCheckAttribs(), "Attribute before AppendAttribs broken" );
-#endif
-
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttrib = GetAttrib( pNextNode->GetCharAttribs().GetAttribs(), nAttr );
- while ( pAttrib )
- {
- // Move all attributes in the current node (this)
- sal_Bool bMelted = sal_False;
- if ( ( pAttrib->GetStart() == 0 ) && ( !pAttrib->IsFeature() ) )
- {
- // Attributes can possibly be summarized as:
- sal_uInt16 nTmpAttr = 0;
- EditCharAttrib* pTmpAttrib = GetAttrib( aCharAttribList.GetAttribs(), nTmpAttr );
- while ( !bMelted && pTmpAttrib )
- {
- if ( pTmpAttrib->GetEnd() == nNewStart )
- {
- if ( ( pTmpAttrib->Which() == pAttrib->Which() ) &&
- ( *(pTmpAttrib->GetItem()) == *(pAttrib->GetItem() ) ) )
- {
- pTmpAttrib->GetEnd() =
- pTmpAttrib->GetEnd() + pAttrib->GetLen();
- pNextNode->GetCharAttribs().GetAttribs().Remove( nAttr );
- // Unsubscribe from the pool?!
- delete pAttrib;
- bMelted = sal_True;
- }
- }
- ++nTmpAttr;
- pTmpAttrib = GetAttrib( aCharAttribList.GetAttribs(), nTmpAttr );
- }
- }
-
- if ( !bMelted )
- {
- pAttrib->GetStart() = pAttrib->GetStart() + nNewStart;
- pAttrib->GetEnd() = pAttrib->GetEnd() + nNewStart;
- aCharAttribList.InsertAttrib( pAttrib );
- ++nAttr;
- }
- pAttrib = GetAttrib( pNextNode->GetCharAttribs().GetAttribs(), nAttr );
- }
- // For the Attributes that just moved over:
- pNextNode->GetCharAttribs().Clear();
-
-#if OSL_DEBUG_LEVEL > 2
- OSL_ENSURE( aCharAttribList.DbgCheckAttribs(), "Attribute after AppendAttribs broken" );
-#endif
-}
-
-void ContentNode::CreateDefFont()
-{
- // First use the information from the style ...
- SfxStyleSheet* pS = aContentAttribs.GetStyleSheet();
- if ( pS )
- CreateFont( GetCharAttribs().GetDefFont(), pS->GetItemSet() );
-
- // ... then iron out the hard paragraph formatting...
- CreateFont( GetCharAttribs().GetDefFont(),
- GetContentAttribs().GetItems(), pS == NULL );
-}
-
-void ContentNode::SetStyleSheet( SfxStyleSheet* pS, const SvxFont& rFontFromStyle )
-{
- aContentAttribs.SetStyleSheet( pS );
-
-
- // First use the information from the style ...
- GetCharAttribs().GetDefFont() = rFontFromStyle;
- // ... then iron out the hard paragraph formatting...
- CreateFont( GetCharAttribs().GetDefFont(),
- GetContentAttribs().GetItems(), pS == NULL );
-}
-
-void ContentNode::SetStyleSheet( SfxStyleSheet* pS, sal_Bool bRecalcFont )
-{
- aContentAttribs.SetStyleSheet( pS );
- if ( bRecalcFont )
- CreateDefFont();
-}
-
-void ContentNode::DestroyWrongList()
-{
- delete pWrongList;
- pWrongList = NULL;
-}
-
-void ContentNode::CreateWrongList()
-{
- DBG_ASSERT( !pWrongList, "WrongList already exist!" );
- pWrongList = new WrongList;
-}
-
-void ContentNode::SetWrongList( WrongList* p )
-{
- DBG_ASSERT( !pWrongList, "WrongList already exist!" );
- pWrongList = p;
-}
-
-ContentAttribs::ContentAttribs( SfxItemPool& rPool ) :
- aAttribSet( rPool, EE_PARA_START, EE_CHAR_END )
-{
- pStyle = 0;
-}
-
-ContentAttribs::ContentAttribs( const ContentAttribs& rRef ) :
- aAttribSet( rRef.aAttribSet )
-{
- pStyle = rRef.pStyle;
-}
-
-ContentAttribs::~ContentAttribs()
-{
-}
-
-SvxTabStop ContentAttribs::FindTabStop( long nCurPos, sal_uInt16 nDefTab )
-{
- const SvxTabStopItem& rTabs = (const SvxTabStopItem&) GetItem( EE_PARA_TABS );
- for ( sal_uInt16 i = 0; i < rTabs.Count(); i++ )
- {
- const SvxTabStop& rTab = rTabs[i];
- if ( rTab.GetTabPos() > nCurPos )
- return rTab;
- }
-
- // Determine DefTab ...
- SvxTabStop aTabStop;
- long x = nCurPos / nDefTab + 1;
- aTabStop.GetTabPos() = nDefTab * x;
- return aTabStop;
-}
-
-void ContentAttribs::SetStyleSheet( SfxStyleSheet* pS )
-{
- sal_Bool bStyleChanged = ( pStyle != pS );
- pStyle = pS;
- // Only when other style sheet, not when current style sheet modified
- if ( pStyle && bStyleChanged )
- {
- // 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++ )
- {
- // Don't change bullet on/off
- if ( ( nWhich != EE_PARA_BULLETSTATE ) && ( rStyleAttribs.GetItemState( nWhich ) == SFX_ITEM_ON ) )
- aAttribSet.ClearItem( nWhich );
- }
- }
-}
-
-const SfxPoolItem& ContentAttribs::GetItem( sal_uInt16 nWhich )
-{
- // Hard paragraph attributes take precedence!
- SfxItemSet* pTakeFrom = &aAttribSet;
- if ( pStyle && ( aAttribSet.GetItemState( nWhich, sal_False ) != SFX_ITEM_ON ) )
- pTakeFrom = &pStyle->GetItemSet();
-
- return pTakeFrom->Get( nWhich );
-}
-
-sal_Bool ContentAttribs::HasItem( sal_uInt16 nWhich )
-{
- sal_Bool bHasItem = sal_False;
- if ( aAttribSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_ON )
- bHasItem = sal_True;
- else if ( pStyle && pStyle->GetItemSet().GetItemState( nWhich ) == SFX_ITEM_ON )
- bHasItem = sal_True;
-
- return bHasItem;
-}
-
-
-ItemList::ItemList() : CurrentItem( 0 )
-{
-}
-
-const SfxPoolItem* ItemList::FindAttrib( sal_uInt16 nWhich )
-{
- for ( size_t i = 0, n = aItemPool.size(); i < n; ++i )
- if ( aItemPool[ i ]->Which() == nWhich )
- return aItemPool[ i ];
- return NULL;
-}
-
-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;
-}
-
-void ItemList::Insert( const SfxPoolItem* pItem )
-{
- aItemPool.push_back( pItem );
- CurrentItem = aItemPool.size() - 1;
-}
-
-
-EditDoc::EditDoc( SfxItemPool* pPool )
-{
- if ( pPool )
- {
- pItemPool = pPool;
- bOwnerOfPool = sal_False;
- }
- else
- {
- pItemPool = new EditEngineItemPool( sal_False );
- bOwnerOfPool = sal_True;
- }
-
- nDefTab = DEFTAB;
- bIsVertical = sal_False;
- bIsFixedCellHeight = sal_False;
-
- // Don't create a empty node, Clear() will be called in EditEngine-CTOR
-
- SetModified( sal_False );
-};
-
-EditDoc::~EditDoc()
-{
- ImplDestroyContents();
- if ( bOwnerOfPool )
- SfxItemPool::Free(pItemPool);
-}
-
-void EditDoc::ImplDestroyContents()
-{
- for ( sal_uInt16 nNode = Count(); nNode; )
- RemoveItemsFromPool( GetObject( --nNode ) );
- DeleteAndDestroy( 0, Count() );
-}
-
-void EditDoc::RemoveItemsFromPool( ContentNode* pNode )
-{
- for ( sal_uInt16 nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ )
- {
- EditCharAttrib* pAttr = pNode->GetCharAttribs().GetAttribs()[nAttr];
- GetItemPool().Remove( *pAttr->GetItem() );
- }
-}
-
-void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, short nScriptType )
-{
- Font aPrevFont( rFont );
- rFont.SetAlign( ALIGN_BASELINE );
- rFont.SetTransparent( sal_True );
-
- sal_uInt16 nWhich_FontInfo = GetScriptItemId( EE_CHAR_FONTINFO, nScriptType );
- sal_uInt16 nWhich_Language = GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType );
- sal_uInt16 nWhich_FontHeight = GetScriptItemId( EE_CHAR_FONTHEIGHT, nScriptType );
- sal_uInt16 nWhich_Weight = GetScriptItemId( EE_CHAR_WEIGHT, nScriptType );
- sal_uInt16 nWhich_Italic = GetScriptItemId( EE_CHAR_ITALIC, nScriptType );
-
- if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontInfo ) == SFX_ITEM_ON ) )
- {
- const SvxFontItem& rFontItem = (const SvxFontItem&)rSet.Get( nWhich_FontInfo );
- rFont.SetName( rFontItem.GetFamilyName() );
- rFont.SetFamily( rFontItem.GetFamily() );
- rFont.SetPitch( rFontItem.GetPitch() );
- rFont.SetCharSet( rFontItem.GetCharSet() );
- }
- if ( bSearchInParent || ( rSet.GetItemState( nWhich_Language ) == SFX_ITEM_ON ) )
- rFont.SetLanguage( ((const SvxLanguageItem&)rSet.Get( nWhich_Language )).GetLanguage() );
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_COLOR ) == SFX_ITEM_ON ) )
- rFont.SetColor( ((const SvxColorItem&)rSet.Get( EE_CHAR_COLOR )).GetValue() );
- if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontHeight ) == SFX_ITEM_ON ) )
- rFont.SetSize( Size( rFont.GetSize().Width(), ((const SvxFontHeightItem&)rSet.Get( nWhich_FontHeight ) ).GetHeight() ) );
- if ( bSearchInParent || ( rSet.GetItemState( nWhich_Weight ) == SFX_ITEM_ON ) )
- rFont.SetWeight( ((const SvxWeightItem&)rSet.Get( nWhich_Weight )).GetWeight() );
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_UNDERLINE ) == SFX_ITEM_ON ) )
- rFont.SetUnderline( ((const SvxUnderlineItem&)rSet.Get( EE_CHAR_UNDERLINE )).GetLineStyle() );
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_OVERLINE ) == SFX_ITEM_ON ) )
- rFont.SetOverline( ((const SvxOverlineItem&)rSet.Get( EE_CHAR_OVERLINE )).GetLineStyle() );
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_STRIKEOUT ) == SFX_ITEM_ON ) )
- rFont.SetStrikeout( ((const SvxCrossedOutItem&)rSet.Get( EE_CHAR_STRIKEOUT )).GetStrikeout() );
- if ( bSearchInParent || ( rSet.GetItemState( nWhich_Italic ) == SFX_ITEM_ON ) )
- rFont.SetItalic( ((const SvxPostureItem&)rSet.Get( nWhich_Italic )).GetPosture() );
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_OUTLINE ) == SFX_ITEM_ON ) )
- rFont.SetOutline( ((const SvxContourItem&)rSet.Get( EE_CHAR_OUTLINE )).GetValue() );
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_SHADOW ) == SFX_ITEM_ON ) )
- rFont.SetShadow( ((const SvxShadowedItem&)rSet.Get( EE_CHAR_SHADOW )).GetValue() );
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_ESCAPEMENT ) == SFX_ITEM_ON ) )
- {
- const SvxEscapementItem& rEsc = (const SvxEscapementItem&) rSet.Get( EE_CHAR_ESCAPEMENT );
-
- sal_uInt16 nProp = rEsc.GetProp();
- rFont.SetPropr( (sal_uInt8)nProp );
-
- short nEsc = rEsc.GetEsc();
- if ( nEsc == DFLT_ESC_AUTO_SUPER )
- nEsc = 100 - nProp;
- else if ( nEsc == DFLT_ESC_AUTO_SUB )
- nEsc = sal::static_int_cast< short >( -( 100 - nProp ) );
- rFont.SetEscapement( nEsc );
- }
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_PAIRKERNING ) == SFX_ITEM_ON ) )
- rFont.SetKerning( ((const SvxAutoKernItem&)rSet.Get( EE_CHAR_PAIRKERNING )).GetValue() );
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_KERNING ) == SFX_ITEM_ON ) )
- rFont.SetFixKerning( ((const SvxKerningItem&)rSet.Get( EE_CHAR_KERNING )).GetValue() );
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_WLM ) == SFX_ITEM_ON ) )
- rFont.SetWordLineMode( ((const SvxWordLineModeItem&)rSet.Get( EE_CHAR_WLM )).GetValue() );
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_EMPHASISMARK ) == SFX_ITEM_ON ) )
- rFont.SetEmphasisMark( ((const SvxEmphasisMarkItem&)rSet.Get( EE_CHAR_EMPHASISMARK )).GetValue() );
- if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_RELIEF ) == SFX_ITEM_ON ) )
- rFont.SetRelief( (FontRelief)((const SvxCharReliefItem&)rSet.Get( EE_CHAR_RELIEF )).GetValue() );
-
- // 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; // => The same ImpPointer for IsSameInstance
-}
-
-void EditDoc::CreateDefFont( sal_Bool bUseStyles )
-{
- SfxItemSet aTmpSet( GetItemPool(), EE_PARA_START, EE_CHAR_END );
- CreateFont( aDefFont, aTmpSet );
- aDefFont.SetVertical( IsVertical() );
- aDefFont.SetOrientation( IsVertical() ? 2700 : 0 );
-
- for ( sal_uInt16 nNode = 0; nNode < Count(); nNode++ )
- {
- ContentNode* pNode = GetObject( nNode );
- pNode->GetCharAttribs().GetDefFont() = aDefFont;
- if ( bUseStyles )
- pNode->CreateDefFont();
- }
-}
-
-static const sal_Unicode aCR[] = { 0x0d, 0x00 };
-static const sal_Unicode aLF[] = { 0x0a, 0x00 };
-static const sal_Unicode aCRLF[] = { 0x0d, 0x0a, 0x00 };
-
-XubString EditDoc::GetSepStr( LineEnd eEnd )
-{
- XubString aSep;
- if ( eEnd == LINEEND_CR )
- aSep = aCR;
- else if ( eEnd == LINEEND_LF )
- aSep = aLF;
- else
- aSep = aCRLF;
- return aSep;
-}
-
-XubString EditDoc::GetText( LineEnd eEnd ) const
-{
- sal_uLong nLen = GetTextLen();
- sal_uInt16 nNodes = Count();
-
- String aSep = EditDoc::GetSepStr( eEnd );
- sal_uInt16 nSepSize = aSep.Len();
-
- if ( nSepSize )
- nLen += nNodes * nSepSize;
- if ( nLen > 0xFFFb / sizeof(xub_Unicode) )
- {
- OSL_FAIL( "Text to large for String" );
- return XubString();
- }
- xub_Unicode* pStr = new xub_Unicode[nLen+1];
- xub_Unicode* pCur = pStr;
- sal_uInt16 nLastNode = nNodes-1;
- for ( sal_uInt16 nNode = 0; nNode < nNodes; nNode++ )
- {
- XubString aTmp( GetParaAsString( GetObject(nNode) ) );
- memcpy( pCur, aTmp.GetBuffer(), aTmp.Len()*sizeof(sal_Unicode) );
- pCur += aTmp.Len();
- if ( nSepSize && ( nNode != nLastNode ) )
- {
- memcpy( pCur, aSep.GetBuffer(), nSepSize*sizeof(sal_Unicode ) );
- pCur += nSepSize;
- }
- }
- *pCur = '\0';
- XubString aASCIIText( pStr );
- delete[] pStr;
- return aASCIIText;
-}
-
-XubString EditDoc::GetParaAsString( sal_uInt16 nNode ) const
-{
- return GetParaAsString( SaveGetObject( nNode ) );
-}
-
-XubString EditDoc::GetParaAsString( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, sal_Bool bResolveFields ) const
-{
- if ( nEndPos > pNode->Len() )
- nEndPos = pNode->Len();
-
- DBG_ASSERT( nStartPos <= nEndPos, "Start and End reversed?" );
-
- sal_uInt16 nIndex = nStartPos;
- XubString aStr;
- EditCharAttrib* pNextFeature = pNode->GetCharAttribs().FindFeature( nIndex );
- while ( nIndex < nEndPos )
- {
- sal_uInt16 nEnd = nEndPos;
- if ( pNextFeature && ( pNextFeature->GetStart() < nEnd ) )
- nEnd = pNextFeature->GetStart();
- else
- pNextFeature = 0; // Feature does not interest the below
-
- DBG_ASSERT( nEnd >= nIndex, "End in front of the index?" );
- //!! beware of sub string length of -1 which is also defined as STRING_LEN and
- //!! thus would result in adding the whole sub string up to the end of the node !!
- if (nEnd > nIndex)
- aStr += XubString( *pNode, nIndex, nEnd - nIndex );
-
- if ( pNextFeature )
- {
- switch ( pNextFeature->GetItem()->Which() )
- {
- case EE_FEATURE_TAB: aStr += '\t';
- break;
- case EE_FEATURE_LINEBR: aStr += '\x0A';
- break;
- case EE_FEATURE_FIELD: if ( bResolveFields )
- aStr += ((EditCharAttribField*)pNextFeature)->GetFieldValue();
- break;
- default: OSL_FAIL( "What feature?" );
- }
- pNextFeature = pNode->GetCharAttribs().FindFeature( ++nEnd );
- }
- nIndex = nEnd;
- }
- return aStr;
-}
-
-sal_uLong EditDoc::GetTextLen() const
-{
- sal_uLong nLen = 0;
- for ( sal_uInt16 nNode = 0; nNode < Count(); nNode++ )
- {
- ContentNode* pNode = GetObject( nNode );
- nLen += pNode->Len();
- // Fields can be longer than the placeholder in the Node
- const CharAttribArray& rAttrs = pNode->GetCharAttribs().GetAttribs();
- for ( sal_uInt16 nAttr = rAttrs.Count(); nAttr; )
- {
- EditCharAttrib* pAttr = rAttrs[--nAttr];
- if ( pAttr->Which() == EE_FEATURE_FIELD )
- {
- sal_uInt16 nFieldLen = ((EditCharAttribField*)pAttr)->GetFieldValue().Len();
- if ( !nFieldLen )
- nLen--;
- else
- nLen += nFieldLen-1;
- }
- }
- }
- return nLen;
-}
-
-EditPaM EditDoc::Clear()
-{
- ImplDestroyContents();
-
- ContentNode* pNode = new ContentNode( GetItemPool() );
- Insert( pNode, 0 );
-
- CreateDefFont( sal_False );
-
- SetModified( sal_False );
-
- EditPaM aPaM( pNode, 0 );
- return aPaM;
-}
-
-void EditDoc::SetModified( sal_Bool b )
-{
- bModified = b;
- if ( bModified )
- {
- aModifyHdl.Call( NULL );
- }
-}
-
-EditPaM EditDoc::RemoveText()
-{
- // Keep the old ItemSet, to keep the chart Font.
- ContentNode* pPrevFirstNode = GetObject(0);
- SfxStyleSheet* pPrevStyle = pPrevFirstNode->GetStyleSheet();
- SfxItemSet aPrevSet( pPrevFirstNode->GetContentAttribs().GetItems() );
- Font aPrevFont( pPrevFirstNode->GetCharAttribs().GetDefFont() );
-
- ImplDestroyContents();
-
- ContentNode* pNode = new ContentNode( GetItemPool() );
- Insert( pNode, 0 );
-
- pNode->SetStyleSheet( pPrevStyle, sal_False );
- pNode->GetContentAttribs().GetItems().Set( aPrevSet );
- pNode->GetCharAttribs().GetDefFont() = aPrevFont;
-
- SetModified( sal_True );
-
- EditPaM aPaM( pNode, 0 );
- return aPaM;
-}
-
-void EditDoc::InsertText( const EditPaM& rPaM, xub_Unicode c )
-{
- DBG_ASSERT( c != 0x0A, "EditDoc::InsertText: Newlines prohibited in paragraph!" );
- DBG_ASSERT( c != 0x0D, "EditDoc::InsertText: Newlines prohibited in paragraph!" );
- DBG_ASSERT( c != '\t', "EditDoc::InsertText: Newlines prohibited in paragraph!" );
-
- rPaM.GetNode()->Insert( c, rPaM.GetIndex() );
- rPaM.GetNode()->ExpandAttribs( rPaM.GetIndex(), 1, GetItemPool() );
-
- SetModified( sal_True );
-}
-
-EditPaM EditDoc::InsertText( EditPaM aPaM, const XubString& rStr )
-{
- DBG_ASSERT( rStr.Search( 0x0A ) == STRING_NOTFOUND, "EditDoc::InsertText: Newlines prohibited in paragraph!" );
- DBG_ASSERT( rStr.Search( 0x0D ) == STRING_NOTFOUND, "EditDoc::InsertText: Newlines prohibited in paragraph!" );
- DBG_ASSERT( rStr.Search( '\t' ) == STRING_NOTFOUND, "EditDoc::InsertText: Newlines prohibited in paragraph!" );
- DBG_ASSERT( aPaM.GetNode(), "Blinder PaM in EditDoc::InsertText1" );
-
- aPaM.GetNode()->Insert( rStr, aPaM.GetIndex() );
- aPaM.GetNode()->ExpandAttribs( aPaM.GetIndex(), rStr.Len(), GetItemPool() );
- aPaM.GetIndex() = aPaM.GetIndex() + rStr.Len();
-
- SetModified( sal_True );
-
- return aPaM;
-}
-
-EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs )
-{
- DBG_ASSERT( aPaM.GetNode(), "Blinder PaM in EditDoc::InsertParaBreak" );
- ContentNode* pCurNode = aPaM.GetNode();
- sal_uInt16 nPos = GetPos( pCurNode );
- XubString aStr = aPaM.GetNode()->Copy( aPaM.GetIndex() );
- aPaM.GetNode()->Erase( aPaM.GetIndex() );
-
- // the paragraph attributes...
- ContentAttribs aContentAttribs( aPaM.GetNode()->GetContentAttribs() );
-
- // for a new paragraph we like to have the bullet/numbering visible by default
- aContentAttribs.GetItems().Put( SfxBoolItem( EE_PARA_BULLETSTATE, sal_True), EE_PARA_BULLETSTATE );
-
- // ContenNode constructor copies also the paragraph attributes
- ContentNode* pNode = new ContentNode( aStr, aContentAttribs );
-
- // Copy the Default Font
- pNode->GetCharAttribs().GetDefFont() = aPaM.GetNode()->GetCharAttribs().GetDefFont();
- SfxStyleSheet* pStyle = aPaM.GetNode()->GetStyleSheet();
- if ( pStyle )
- {
- XubString aFollow( pStyle->GetFollow() );
- if ( aFollow.Len() && ( aFollow != pStyle->GetName() ) )
- {
- SfxStyleSheetBase* pNext = pStyle->GetPool().Find( aFollow, pStyle->GetFamily() );
- pNode->SetStyleSheet( (SfxStyleSheet*)pNext );
- }
- }
-
- // Character attributes may need to be copied or trimmed:
- pNode->CopyAndCutAttribs( aPaM.GetNode(), GetItemPool(), bKeepEndingAttribs );
-
- Insert( pNode, nPos+1 );
-
- SetModified( sal_True );
-
- aPaM.SetNode( pNode );
- aPaM.SetIndex( 0 );
- return aPaM;
-}
-
-EditPaM EditDoc::InsertFeature( EditPaM aPaM, const SfxPoolItem& rItem )
-{
- DBG_ASSERT( aPaM.GetNode(), "Blinder PaM in EditDoc::InsertFeature" );
-
- aPaM.GetNode()->Insert( CH_FEATURE, aPaM.GetIndex() );
- aPaM.GetNode()->ExpandAttribs( aPaM.GetIndex(), 1, GetItemPool() );
-
- // Create a feature-attribute for the feature...
- EditCharAttrib* pAttrib = MakeCharAttrib( GetItemPool(), rItem, aPaM.GetIndex(), aPaM.GetIndex()+1 );
- DBG_ASSERT( pAttrib, "Why can not the feature be created?" );
- aPaM.GetNode()->GetCharAttribs().InsertAttrib( pAttrib );
-
- SetModified( sal_True );
-
- aPaM.GetIndex()++;
- return aPaM;
-}
-
-EditPaM EditDoc::ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight )
-{
- const EditPaM aPaM( pLeft, pLeft->Len() );
-
- // First the attributes, otherwise nLen will not be correct!
- pLeft->AppendAttribs( pRight );
- // then the Text...
- *pLeft += *pRight;
-
- // the one to the right disappears.
- RemoveItemsFromPool( pRight );
- sal_uInt16 nRight = GetPos( pRight );
- Remove( nRight );
- delete pRight;
-
- SetModified( sal_True );
-
- return aPaM;
-}
-
-EditPaM EditDoc::RemoveChars( EditPaM aPaM, sal_uInt16 nChars )
-{
- // Maybe remove Features!
- aPaM.GetNode()->Erase( aPaM.GetIndex(), nChars );
- aPaM.GetNode()->CollapsAttribs( aPaM.GetIndex(), nChars, GetItemPool() );
-
- SetModified( sal_True );
-
- return aPaM;
-}
-
-void EditDoc::InsertAttribInSelection( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem )
-{
- DBG_ASSERT( pNode, "What to do with the attribute?" );
- DBG_ASSERT( nEnd <= pNode->Len(), "InsertAttrib: Attribute to large!" );
-
- // for Optimization:
- // This ends at the beginning of the selection => can be expanded
- EditCharAttrib* pEndingAttrib = 0;
- // This starts at the end of the selection => can be expanded
- EditCharAttrib* pStartingAttrib = 0;
-
- DBG_ASSERT( nStart <= nEnd, "Small miscalculations in InsertAttribInSelection" );
-
- RemoveAttribs( pNode, nStart, nEnd, pStartingAttrib, pEndingAttrib, rPoolItem.Which() );
-
- if ( pStartingAttrib && pEndingAttrib &&
- ( *(pStartingAttrib->GetItem()) == rPoolItem ) &&
- ( *(pEndingAttrib->GetItem()) == rPoolItem ) )
- {
- // Will become a large Attribute.
- pEndingAttrib->GetEnd() = pStartingAttrib->GetEnd();
- GetItemPool().Remove( *(pStartingAttrib->GetItem()) );
- pNode->GetCharAttribs().GetAttribs().Remove( pNode->GetCharAttribs().GetAttribs().GetPos( pStartingAttrib ) );
- delete pStartingAttrib;
- }
- else if ( pStartingAttrib && ( *(pStartingAttrib->GetItem()) == rPoolItem ) )
- pStartingAttrib->GetStart() = nStart;
- else if ( pEndingAttrib && ( *(pEndingAttrib->GetItem()) == rPoolItem ) )
- pEndingAttrib->GetEnd() = nEnd;
- else
- InsertAttrib( rPoolItem, pNode, nStart, nEnd );
-
- if ( pStartingAttrib )
- pNode->GetCharAttribs().ResortAttribs();
-
- SetModified( sal_True );
-}
-
-sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt16 nWhich )
-{
- EditCharAttrib* pStarting;
- EditCharAttrib* pEnding;
- return RemoveAttribs( pNode, nStart, nEnd, pStarting, pEnding, nWhich );
-}
-
-sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich )
-{
-
- 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;
- // This starts at the end of the selection => can be expanded
- rpStarting = 0;
-
- sal_Bool bChanged = sal_False;
-
- DBG_ASSERT( nStart <= nEnd, "Small miscalculations in InsertAttribInSelection" );
-
- // iterate over the attributes ...
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- while ( pAttr )
- {
- sal_Bool bRemoveAttrib = sal_False;
- sal_uInt16 nAttrWhich = pAttr->Which();
- if ( ( nAttrWhich < EE_FEATURE_START ) && ( !nWhich || ( nAttrWhich == nWhich ) ) )
- {
- // Attribute starts in Selection
- if ( ( pAttr->GetStart() >= nStart ) && ( pAttr->GetStart() <= nEnd ) )
- {
- bChanged = sal_True;
- if ( pAttr->GetEnd() > nEnd )
- {
- pAttr->GetStart() = nEnd; // then it starts after this
- rpStarting = pAttr;
- if ( nWhich )
- break; // There can be no further attributes here
- }
- else if ( !pAttr->IsFeature() || ( pAttr->GetStart() == nStart ) )
- {
- // Delete feature only if on the exact spot
- bRemoveAttrib = sal_True;
- }
- }
-
- // Attribute ends in Selection
- else if ( ( pAttr->GetEnd() >= nStart ) && ( pAttr->GetEnd() <= nEnd ) )
- {
- bChanged = sal_True;
- if ( ( pAttr->GetStart() < nStart ) && !pAttr->IsFeature() )
- {
- pAttr->GetEnd() = nStart; // then it ends here
- rpEnding = pAttr;
- }
- else if ( !pAttr->IsFeature() || ( pAttr->GetStart() == nStart ) )
- {
- // Delete feature only if on the exact spot
- bRemoveAttrib = sal_True;
- }
- }
- // Attribute overlaps the selection
- else if ( ( pAttr->GetStart() <= nStart ) && ( pAttr->GetEnd() >= nEnd ) )
- {
- bChanged = sal_True;
- if ( pAttr->GetStart() == nStart )
- {
- pAttr->GetStart() = nEnd;
- rpStarting = pAttr;
- if ( nWhich )
- break; // There can be further attributes!
- }
- else if ( pAttr->GetEnd() == nEnd )
- {
- pAttr->GetEnd() = nStart;
- rpEnding = pAttr;
- if ( nWhich )
- break; // There can be further attributes!
- }
- else // Attribute must be split ...
- {
- sal_uInt16 nOldEnd = pAttr->GetEnd();
- pAttr->GetEnd() = nStart;
- rpEnding = pAttr;
- InsertAttrib( *pAttr->GetItem(), pNode, nEnd, nOldEnd );
- if ( nWhich )
- break; // There can be further attributes!
- }
- }
- }
- if ( bRemoveAttrib )
- {
- 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() );
- delete pAttr;
- nAttr--;
- }
- nAttr++;
- pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- }
-
- if ( bChanged )
- {
- // char attributes need to be sorted by start again
- pNode->GetCharAttribs().ResortAttribs();
-
- SetModified( sal_True );
- }
-
- return bChanged;
-}
-
-void EditDoc::InsertAttrib( const SfxPoolItem& rPoolItem, ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd )
-{
- // 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 failed!" );
- pNode->GetCharAttribs().InsertAttrib( pAttrib );
-
- SetModified( sal_True );
-}
-
-void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem )
-{
- if ( nStart != nEnd )
- {
- InsertAttribInSelection( pNode, nStart, nEnd, rPoolItem );
- }
- else
- {
- // Check whether already a new attribute with WhichId exists at this place:
- EditCharAttrib* pAttr = pNode->GetCharAttribs().FindEmptyAttrib( rPoolItem.Which(), nStart );
- if ( pAttr )
- {
- // Remove attribute....
- pNode->GetCharAttribs().GetAttribs().Remove(
- pNode->GetCharAttribs().GetAttribs().GetPos( pAttr ) );
- }
-
- // check whether 'the same' attribute exist at this place.
- pAttr = pNode->GetCharAttribs().FindAttrib( rPoolItem.Which(), nStart );
- if ( pAttr )
- {
- if ( pAttr->IsInside( nStart ) ) // split
- {
- // check again if really splitting, or return !
- sal_uInt16 nOldEnd = pAttr->GetEnd();
- pAttr->GetEnd() = nStart;
- pAttr = MakeCharAttrib( GetItemPool(), *(pAttr->GetItem()), nStart, nOldEnd );
- pNode->GetCharAttribs().InsertAttrib( pAttr );
- }
- else if ( pAttr->GetEnd() == nStart )
- {
- DBG_ASSERT( !pAttr->IsEmpty(), "Still an empty attribute?" );
- // Check if exactly the same attribute
- if ( *(pAttr->GetItem()) == rPoolItem )
- return;
- }
- }
- InsertAttrib( rPoolItem, pNode, nStart, nStart );
- }
-
- SetModified( sal_True );
-}
-
-void EditDoc::FindAttribs( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, SfxItemSet& rCurSet )
-{
- DBG_ASSERT( pNode, "Where to search?" );
- DBG_ASSERT( nStartPos <= nEndPos, "Invalid region!" );
-
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- // No Selection...
- if ( nStartPos == nEndPos )
- {
- while ( pAttr && ( pAttr->GetStart() <= nEndPos) )
- {
- const SfxPoolItem* pItem = 0;
- // Attribute is about...
- if ( ( pAttr->GetStart() < nStartPos ) && ( pAttr->GetEnd() > nStartPos ) )
- pItem = pAttr->GetItem();
- // 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();
- }
- // Attribute ending here is empty
- else if ( ( pAttr->GetStart() == nStartPos ) && ( pAttr->GetEnd() == nStartPos ) )
- {
- pItem = pAttr->GetItem();
- }
- // Attribute starts here
- else if ( ( pAttr->GetStart() == nStartPos ) && ( pAttr->GetEnd() > nStartPos ) )
- {
- if ( nStartPos == 0 ) // special case
- pItem = pAttr->GetItem();
- }
-
- if ( pItem )
- {
- sal_uInt16 nWhich = pItem->Which();
- if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF )
- {
- rCurSet.Put( *pItem );
- }
- else if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_ON )
- {
- const SfxPoolItem& rItem = rCurSet.Get( nWhich );
- if ( rItem != *pItem )
- {
- rCurSet.InvalidateItem( nWhich );
- }
- }
- }
- nAttr++;
- pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- }
- }
- else // Selection
- {
- while ( pAttr && ( pAttr->GetStart() < nEndPos) )
- {
- const SfxPoolItem* pItem = 0;
- // Attribut is about...
- if ( ( pAttr->GetStart() <= nStartPos ) && ( pAttr->GetEnd() >= nEndPos ) )
- pItem = pAttr->GetItem();
- // Attribute starts right in the middle ...
- else if ( pAttr->GetStart() >= nStartPos )
- {
- // !!! pItem = pAttr->GetItem();
- // 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() );
-
- }
- // Attribute ends in the middle of it ...
- else if ( pAttr->GetEnd() > nStartPos )
- {
- rCurSet.InvalidateItem( pAttr->GetItem()->Which() );
- }
-
- if ( pItem )
- {
- sal_uInt16 nWhich = pItem->Which();
- if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF )
- {
- rCurSet.Put( *pItem );
- }
- else if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_ON )
- {
- const SfxPoolItem& rItem = rCurSet.Get( nWhich );
- if ( rItem != *pItem )
- {
- rCurSet.InvalidateItem( nWhich );
- }
- }
- }
- nAttr++;
- pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- }
- }
-}
-
-
-CharAttribList::CharAttribList()
-{
- DBG_CTOR( EE_CharAttribList, 0 );
- bHasEmptyAttribs = sal_False;
-}
-
-CharAttribList::~CharAttribList()
-{
- DBG_DTOR( EE_CharAttribList, 0 );
-
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttr = GetAttrib( aAttribs, nAttr );
- while ( pAttr )
- {
- delete pAttr;
- ++nAttr;
- pAttr = GetAttrib( aAttribs, nAttr );
- }
- Clear();
-}
-
-void CharAttribList::InsertAttrib( EditCharAttrib* pAttrib )
-{
-// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-// optimize: binary search? !
-// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
- // 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(); // may be better for Comp.Opt.
-
- if ( pAttrib->IsEmpty() )
- bHasEmptyAttribs = sal_True;
-
- sal_Bool bInserted = sal_False;
- for ( sal_uInt16 x = 0; x < nCount; x++ )
- {
- EditCharAttribPtr pCurAttrib = aAttribs[x];
- if ( pCurAttrib->GetStart() > nStart )
- {
- aAttribs.Insert( pAttrib, x );
- bInserted = sal_True;
- break;
- }
- }
- if ( !bInserted )
- aAttribs.Insert( pAttrib, nCount );
-}
-
-void CharAttribList::ResortAttribs()
-{
- if ( Count() )
- {
-#if defined __SUNPRO_CC
-#pragma disable_warn
-#endif
- qsort( (void*)aAttribs.GetData(), aAttribs.Count(), sizeof( EditCharAttrib* ), CompareStart );
-#if defined __SUNPRO_CC
-#pragma enable_warn
-#endif
- }
-}
-
-void CharAttribList::OptimizeRanges( SfxItemPool& rItemPool )
-{
- for ( sal_uInt16 n = 0; n < aAttribs.Count(); n++ )
- {
- EditCharAttrib* pAttr = aAttribs.GetObject( n );
- for ( sal_uInt16 nNext = n+1; nNext < aAttribs.Count(); nNext++ )
- {
- EditCharAttrib* p = aAttribs.GetObject( nNext );
- if ( !pAttr->IsFeature() && ( p->GetStart() == pAttr->GetEnd() ) && ( p->Which() == pAttr->Which() ) )
- {
- if ( *p->GetItem() == *pAttr->GetItem() )
- {
- pAttr->GetEnd() = p->GetEnd();
- aAttribs.Remove( nNext );
- rItemPool.Remove( *p->GetItem() );
- delete p;
- }
- break; // only 1 attr with same which can start here.
- }
- else if ( p->GetStart() > pAttr->GetEnd() )
- {
- break;
- }
- }
- }
-}
-
-EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos )
-{
- // 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 )
- {
- if ( ( pAttr->Which() == nWhich ) && pAttr->IsIn(nPos) )
- return pAttr;
- pAttr = GetAttrib( aAttribs, --nAttr );
- }
- return 0;
-}
-
-EditCharAttrib* CharAttribList::FindNextAttrib( sal_uInt16 nWhich, sal_uInt16 nFromPos ) const
-{
- DBG_ASSERT( nWhich, "FindNextAttrib: Which?" );
- const sal_uInt16 nAttribs = aAttribs.Count();
- for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ )
- {
- EditCharAttrib* pAttr = aAttribs[ nAttr ];
- if ( ( pAttr->GetStart() >= nFromPos ) && ( pAttr->Which() == nWhich ) )
- return pAttr;
- }
- return 0;
-}
-
-sal_Bool CharAttribList::HasAttrib( sal_uInt16 nWhich ) const
-{
- for ( sal_uInt16 nAttr = aAttribs.Count(); nAttr; )
- {
- const EditCharAttrib* pAttr = aAttribs[--nAttr];
- if ( pAttr->Which() == nWhich )
- return sal_True;
- }
- return sal_False;
-}
-
-sal_Bool CharAttribList::HasAttrib( sal_uInt16 nStartPos, sal_uInt16 nEndPos ) const
-{
- sal_Bool bAttr = sal_False;
- for ( sal_uInt16 nAttr = aAttribs.Count(); nAttr && !bAttr; )
- {
- const EditCharAttrib* pAttr = aAttribs[--nAttr];
- if ( ( pAttr->GetStart() < nEndPos ) && ( pAttr->GetEnd() > nStartPos ) )
- return bAttr = sal_True;
- }
- return bAttr;
-}
-
-
-sal_Bool CharAttribList::HasBoundingAttrib( sal_uInt16 nBound )
-{
- // Backwards, if one ends where the next starts.
- // => The starting one is the valid one ...
- sal_uInt16 nAttr = aAttribs.Count()-1;
- EditCharAttrib* pAttr = GetAttrib( aAttribs, nAttr );
- while ( pAttr && ( pAttr->GetEnd() >= nBound ) )
- {
- if ( ( pAttr->GetStart() == nBound ) || ( pAttr->GetEnd() == nBound ) )
- return sal_True;
- pAttr = GetAttrib( aAttribs, --nAttr );
- }
- return sal_False;
-}
-
-EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos )
-{
- if ( !bHasEmptyAttribs )
- return 0;
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttr = GetAttrib( aAttribs, nAttr );
- while ( pAttr && ( pAttr->GetStart() <= nPos ) )
- {
- if ( ( pAttr->GetStart() == nPos ) && ( pAttr->GetEnd() == nPos ) && ( pAttr->Which() == nWhich ) )
- return pAttr;
- nAttr++;
- pAttr = GetAttrib( aAttribs, nAttr );
- }
- return 0;
-}
-
-EditCharAttrib* CharAttribList::FindFeature( sal_uInt16 nPos ) const
-{
-
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pNextAttrib = GetAttrib( aAttribs, nAttr );
-
- // first to the desired position ...
- while ( pNextAttrib && ( pNextAttrib->GetStart() < nPos ) )
- {
- nAttr++;
- pNextAttrib = GetAttrib( aAttribs, nAttr );
- }
-
- // Now search for the Feature...
- while ( pNextAttrib && !pNextAttrib->IsFeature() )
- {
- nAttr++;
- pNextAttrib = GetAttrib( aAttribs, nAttr );
- }
-
- return pNextAttrib;
-}
-
-
-void CharAttribList::DeleteEmptyAttribs( SfxItemPool& rItemPool )
-{
- for ( sal_uInt16 nAttr = 0; nAttr < aAttribs.Count(); nAttr++ )
- {
- EditCharAttrib* pAttr = aAttribs[nAttr];
- if ( pAttr->IsEmpty() )
- {
- rItemPool.Remove( *pAttr->GetItem() );
- aAttribs.Remove( nAttr );
- delete pAttr;
- nAttr--;
- }
- }
- bHasEmptyAttribs = sal_False;
-}
-
-sal_Bool CharAttribList::DbgCheckAttribs()
-{
-#ifdef DBG_UTIL
- sal_Bool bOK = sal_True;
- for ( sal_uInt16 nAttr = 0; nAttr < aAttribs.Count(); nAttr++ )
- {
- EditCharAttrib* pAttr = aAttribs[nAttr];
- if ( pAttr->GetStart() > pAttr->GetEnd() )
- {
- bOK = sal_False;
- OSL_FAIL( "Attribute is distorted" );
- }
- else if ( pAttr->IsFeature() && ( pAttr->GetLen() != 1 ) )
- {
- bOK = sal_False;
- OSL_FAIL( "Feature, Len != 1" );
- }
- }
- return bOK;
-#else
- return sal_True;
-#endif
-}
-
-
-
-SvxFontTable::SvxFontTable()
-{
-}
-
-SvxFontTable::~SvxFontTable()
-{
- SvxFontItem* pItem = First();
- while( pItem )
- {
- delete pItem;
- pItem = Next();
- }
-}
-
-sal_uLong SvxFontTable::GetId( const SvxFontItem& rFontItem )
-{
- SvxFontItem* pItem = First();
- while ( pItem )
- {
- if ( *pItem == rFontItem )
- return GetCurKey();
- pItem = Next();
- }
- DBG_WARNING( "Font not found: GetId()" );
- return 0;
-}
-
-SvxColorList::SvxColorList()
-{
-}
-
-SvxColorList::~SvxColorList()
-{
- for ( size_t i = 0, n = aColorList.size(); i < n; ++i )
- delete aColorList[ i ];
- aColorList.clear();
-}
-
-size_t SvxColorList::GetId( const SvxColorItem& rColorItem )
-{
- 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() )
- {
- aColorList.push_back( pItem );
- }
- else
- {
- DummyColorList::iterator it = aColorList.begin();
- ::std::advance( it, nIndex );
- aColorList.insert( it, pItem );
- }
-}
-
-SvxColorItem* SvxColorList::GetObject( size_t nIndex )
-{
- return ( nIndex >= aColorList.size() ) ? NULL : aColorList[ nIndex ];
-}
-
-EditEngineItemPool::EditEngineItemPool( sal_Bool bPersistenRefCounts )
- : SfxItemPool( String( "EditEngineItemPool", RTL_TEXTENCODING_ASCII_US ), EE_ITEMS_START, EE_ITEMS_END,
- aItemInfos, 0, bPersistenRefCounts )
-{
- SetVersionMap( 1, 3999, 4015, aV1Map );
- SetVersionMap( 2, 3999, 4019, aV2Map );
- SetVersionMap( 3, 3997, 4020, aV3Map );
- SetVersionMap( 4, 3994, 4022, aV4Map );
- SetVersionMap( 5, 3994, 4037, aV5Map );
-
- SfxPoolItem** ppDefItems = EE_DLL().GetGlobalData()->GetDefItems();
- SetDefaults( ppDefItems );
-}
-
-EditEngineItemPool::~EditEngineItemPool()
-{
-}
-
-SvStream& EditEngineItemPool::Store( SvStream& rStream ) const
-{
- // 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.
-
- // 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 ) )
- ? sal_True : sal_False;
-
- EditEngineItemPool* pThis = (EditEngineItemPool*)this;
- if ( b31Format )
- pThis->SetStoringRange( 3997, 4022 );
- else
- pThis->SetStoringRange( EE_ITEMS_START, EE_ITEMS_END );
-
- 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
deleted file mode 100644
index 055c48d3f5..0000000000
--- a/editeng/source/editeng/editdoc.hxx
+++ /dev/null
@@ -1,827 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDITDOC_HXX
-#define _EDITDOC_HXX
-
-#include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
-
-#include <editattr.hxx>
-#include <edtspell.hxx>
-#include <editeng/svxfont.hxx>
-#include <svl/itemset.hxx>
-#include <svl/style.hxx>
-#include <svl/itempool.hxx>
-#include <tools/table.hxx>
-#include <vector>
-
-#include <deque>
-
-class ImpEditEngine;
-class SvxTabStop;
-class SvtCTLOptions;
-
-DBG_NAMEEX( EE_TextPortion )
-
-#define CHARPOSGROW 16
-#define DEFTAB 720
-
-void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent = true, short nScriptType = 0 );
-sal_uInt16 GetScriptItemId( sal_uInt16 nItemId, short nScriptType );
-sal_Bool IsScriptItemValid( sal_uInt16 nItemId, short nScriptType );
-
-EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE );
-
-class ContentNode;
-class EditDoc;
-
-struct EPaM
-{
- sal_uInt16 nPara;
- sal_uInt16 nIndex;
-
- EPaM() { nPara = 0; nIndex = 0; }
- EPaM( sal_uInt16 nP, sal_uInt16 nI ) { nPara = nP; nIndex = nI; }
- EPaM( const EPaM& r) { nPara = r.nPara; nIndex = r.nIndex; }
- EPaM& operator = ( const EPaM& r ) { nPara = r.nPara; nIndex = r.nIndex; return *this; }
- inline sal_Bool operator == ( const EPaM& r ) const;
- inline sal_Bool operator < ( const EPaM& r ) const;
-};
-
-inline sal_Bool EPaM::operator < ( const EPaM& r ) const
-{
- return ( ( nPara < r.nPara ) ||
- ( ( nPara == r.nPara ) && nIndex < r.nIndex ) ) ? sal_True : sal_False;
-}
-
-inline sal_Bool EPaM::operator == ( const EPaM& r ) const
-{
- return ( ( nPara == r.nPara ) && ( nIndex == r.nIndex ) ) ? sal_True : sal_False;
-}
-
-struct ScriptTypePosInfo
-{
- short nScriptType;
- sal_uInt16 nStartPos;
- sal_uInt16 nEndPos;
-
- ScriptTypePosInfo( short _Type, sal_uInt16 _Start, sal_uInt16 _End )
- {
- nScriptType = _Type;
- nStartPos = _Start;
- nEndPos = _End;
- }
-};
-
-typedef std::deque< ScriptTypePosInfo > ScriptTypePosInfos;
-
-struct WritingDirectionInfo
-{
- sal_uInt8 nType;
- sal_uInt16 nStartPos;
- sal_uInt16 nEndPos;
-
- WritingDirectionInfo( sal_uInt8 _Type, sal_uInt16 _Start, sal_uInt16 _End )
- {
- nType = _Type;
- nStartPos = _Start;
- nEndPos = _End;
- }
-};
-
-
-typedef std::deque< WritingDirectionInfo > WritingDirectionInfos;
-
-typedef EditCharAttrib* EditCharAttribPtr;
-SV_DECL_PTRARR( CharAttribArray, EditCharAttribPtr, 0, 4 )
-
-class ContentAttribsInfo
-{
-private:
- SfxItemSet aPrevParaAttribs;
- CharAttribArray aPrevCharAttribs;
-
-public:
- ContentAttribsInfo( const SfxItemSet& rParaAttribs );
-
- const SfxItemSet& GetPrevParaAttribs() const { return aPrevParaAttribs; }
- const CharAttribArray& GetPrevCharAttribs() const { return aPrevCharAttribs; }
-
- CharAttribArray& GetPrevCharAttribs() { return aPrevCharAttribs; }
-};
-
-typedef ContentAttribsInfo* ContentAttribsInfoPtr;
-SV_DECL_PTRARR( ContentInfoArray, ContentAttribsInfoPtr, 1, 1 )
-
-// ----------------------------------------------------------------------
-// class SvxFontTable
-// ----------------------------------------------------------------------
-DECLARE_TABLE( DummyFontTable, SvxFontItem* )
-
-class SvxFontTable : public DummyFontTable
-{
-public:
- SvxFontTable();
- ~SvxFontTable();
-
- sal_uLong GetId( const SvxFontItem& rFont );
-};
-
-// ----------------------------------------------------------------------
-// class SvxColorList
-// ----------------------------------------------------------------------
-typedef ContentNode* ContentNodePtr;
-typedef ::std::vector< SvxColorItem* > DummyColorList;
-
-class SvxColorList
-{
-private:
- DummyColorList aColorList;
-
-public:
- SvxColorList();
- ~SvxColorList();
-
- 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;
-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(); };
-};
-
-// -------------------------------------------------------------------------
-// class ContentAttribs
-// -------------------------------------------------------------------------
-class ContentAttribs
-{
-private:
- SfxStyleSheet* pStyle;
- SfxItemSet aAttribSet;
-
-public:
- ContentAttribs( SfxItemPool& rItemPool );
- ContentAttribs( const ContentAttribs& );
- ~ContentAttribs(); // only for larger Tabs
-
- SvxTabStop FindTabStop( long nCurPos, sal_uInt16 nDefTab );
- SfxItemSet& GetItems() { return aAttribSet; }
- SfxStyleSheet* GetStyleSheet() const { return pStyle; }
- void SetStyleSheet( SfxStyleSheet* pS );
-
- const SfxPoolItem& GetItem( sal_uInt16 nWhich );
- sal_Bool HasItem( sal_uInt16 nWhich );
-};
-
-// -------------------------------------------------------------------------
-// class CharAttribList
-// -------------------------------------------------------------------------
-class CharAttribList
-{
-private:
- CharAttribArray aAttribs;
- SvxFont aDefFont; // faster than ever from the pool!
- sal_Bool bHasEmptyAttribs;
-
- CharAttribList( const CharAttribList& ) {;}
-
-public:
- CharAttribList();
- ~CharAttribList();
-
- void DeleteEmptyAttribs( SfxItemPool& rItemPool );
- void RemoveItemsFromPool( SfxItemPool* pItemPool );
-
- EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos );
- EditCharAttrib* FindNextAttrib( sal_uInt16 nWhich, sal_uInt16 nFromPos ) const;
- EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos );
- EditCharAttrib* FindFeature( sal_uInt16 nPos ) const;
-
-
- void ResortAttribs();
- void OptimizeRanges( SfxItemPool& rItemPool );
-
- sal_uInt16 Count() { return aAttribs.Count(); }
- void Clear() { aAttribs.Remove( 0, aAttribs.Count()); }
- void InsertAttrib( EditCharAttrib* pAttrib );
-
- SvxFont& GetDefFont() { return aDefFont; }
-
- sal_Bool HasEmptyAttribs() const { return bHasEmptyAttribs; }
- sal_Bool& HasEmptyAttribs() { return bHasEmptyAttribs; }
- sal_Bool HasBoundingAttrib( sal_uInt16 nBound );
- sal_Bool HasAttrib( sal_uInt16 nWhich ) const;
- sal_Bool HasAttrib( sal_uInt16 nStartPos, sal_uInt16 nEndPos ) const;
-
- CharAttribArray& GetAttribs() { return aAttribs; }
- const CharAttribArray& GetAttribs() const { return aAttribs; }
-
- // Debug:
- sal_Bool DbgCheckAttribs();
-};
-
-// -------------------------------------------------------------------------
-// class ContentNode
-// -------------------------------------------------------------------------
-class ContentNode : public XubString
-{
-private:
- ContentAttribs aContentAttribs;
- CharAttribList aCharAttribList;
- WrongList* pWrongList;
-
-public:
- ContentNode( SfxItemPool& rItemPool );
- ContentNode( const XubString& rStr, const ContentAttribs& rContentAttribs );
- ~ContentNode();
-
- ContentAttribs& GetContentAttribs() { return aContentAttribs; }
- CharAttribList& GetCharAttribs() { return aCharAttribList; }
-
- void ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNewChars, SfxItemPool& rItemPool );
- void CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDelChars, SfxItemPool& rItemPool );
- void AppendAttribs( ContentNode* pNextNode );
- void CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, sal_Bool bKeepEndingAttribs );
-
- void SetStyleSheet( SfxStyleSheet* pS, sal_Bool bRecalcFont = sal_True );
- void SetStyleSheet( SfxStyleSheet* pS, const SvxFont& rFontFromStyle );
- SfxStyleSheet* GetStyleSheet() { return aContentAttribs.GetStyleSheet(); }
-
- void CreateDefFont();
-
- WrongList* GetWrongList() { return pWrongList; }
- void SetWrongList( WrongList* p );
-
- void CreateWrongList();
- void DestroyWrongList();
-
- sal_Bool IsFeature( sal_uInt16 nPos ) const { return ( GetChar( nPos ) == CH_FEATURE ); }
-};
-
-typedef ContentNode* ContentNodePtr;
-SV_DECL_PTRARR( DummyContentList, ContentNodePtr, 0, 4 )
-
-class ContentList : public DummyContentList
-{
- sal_uInt16 nLastCache;
-public:
- ContentList() : DummyContentList( 0, 4 ), nLastCache(0) {}
- sal_uInt16 GetPos( const ContentNodePtr &rPtr ) const;
-};
-
-// -------------------------------------------------------------------------
-// class EditPaM
-// -------------------------------------------------------------------------
-class EditPaM
-{
-private:
- ContentNode* pNode;
- sal_uInt16 nIndex;
-
-public:
- EditPaM() { pNode = NULL; nIndex = 0; }
- EditPaM( ContentNode* p, sal_uInt16 n ) { pNode = p; nIndex = n; }
-
- ContentNode* GetNode() const { return pNode; }
- void SetNode( ContentNode* p) { pNode = p; }
-
- sal_uInt16 GetIndex() const { return nIndex; }
- sal_uInt16& GetIndex() { return nIndex; }
- void SetIndex( sal_uInt16 n ) { nIndex = n; }
-
- sal_Bool IsParaStart() const { return nIndex == 0; }
- sal_Bool IsParaEnd() const { return nIndex == pNode->Len(); }
-
- sal_Bool DbgIsBuggy( EditDoc& rDoc );
-
- EditPaM& operator = ( const EditPaM& rPaM );
- friend sal_Bool operator == ( const EditPaM& r1, const EditPaM& r2 );
- friend sal_Bool operator != ( const EditPaM& r1, const EditPaM& r2 );
-};
-
-#define PORTIONKIND_TEXT 0
-#define PORTIONKIND_TAB 1
-#define PORTIONKIND_LINEBREAK 2
-#define PORTIONKIND_FIELD 3
-#define PORTIONKIND_HYPHENATOR 4
-
-#define DELMODE_SIMPLE 0
-#define DELMODE_RESTOFWORD 1
-#define DELMODE_RESTOFCONTENT 2
-
-#define CHAR_NORMAL 0x00
-#define CHAR_KANA 0x01
-#define CHAR_PUNCTUATIONLEFT 0x02
-#define CHAR_PUNCTUATIONRIGHT 0x04
-
-// -------------------------------------------------------------------------
-// struct ExtraPortionInfos
-// -------------------------------------------------------------------------
-struct ExtraPortionInfo
-{
- long nOrgWidth;
- long nWidthFullCompression;
-
- long nPortionOffsetX;
-
- sal_uInt16 nMaxCompression100thPercent;
-
- sal_uInt8 nAsianCompressionTypes;
- sal_Bool bFirstCharIsRightPunktuation;
- sal_Bool bCompressed;
-
- sal_Int32* pOrgDXArray;
-
-
- ExtraPortionInfo();
- ~ExtraPortionInfo();
-
- void SaveOrgDXArray( const sal_Int32* pDXArray, sal_uInt16 nLen );
-};
-
-
-// -------------------------------------------------------------------------
-// class TextPortion
-// -------------------------------------------------------------------------
-class TextPortion
-{
-private:
- ExtraPortionInfo* pExtraInfos;
- sal_uInt16 nLen;
- Size aOutSz;
- sal_uInt8 nKind;
- sal_uInt8 nRightToLeft;
- sal_Unicode nExtraValue;
-
-
- TextPortion() { DBG_CTOR( EE_TextPortion, 0 );
- pExtraInfos = NULL; nLen = 0; nKind = PORTIONKIND_TEXT; nExtraValue = 0; nRightToLeft = sal_False;}
-
-public:
- TextPortion( sal_uInt16 nL ) : aOutSz( -1, -1 )
- { DBG_CTOR( EE_TextPortion, 0 );
- pExtraInfos = NULL; nLen = nL; nKind = PORTIONKIND_TEXT; nExtraValue = 0; nRightToLeft = sal_False;}
- TextPortion( const TextPortion& r ) : aOutSz( r.aOutSz )
- { DBG_CTOR( EE_TextPortion, 0 );
- pExtraInfos = NULL; nLen = r.nLen; nKind = r.nKind; nExtraValue = r.nExtraValue; nRightToLeft = r.nRightToLeft; }
-
- ~TextPortion() { DBG_DTOR( EE_TextPortion, 0 ); delete pExtraInfos; }
-
- sal_uInt16 GetLen() const { return nLen; }
- sal_uInt16& GetLen() { return nLen; }
- void SetLen( sal_uInt16 nL ) { nLen = nL; }
-
- Size& GetSize() { return aOutSz; }
- Size GetSize() const { return aOutSz; }
-
- sal_uInt8& GetKind() { return nKind; }
- sal_uInt8 GetKind() const { return nKind; }
-
- void SetRightToLeft( sal_uInt8 b ) { nRightToLeft = b; }
- sal_uInt8 GetRightToLeft() const { return nRightToLeft; }
- sal_Bool IsRightToLeft() const { return (nRightToLeft&1); }
-
- sal_Unicode GetExtraValue() const { return nExtraValue; }
- void SetExtraValue( sal_Unicode n ) { nExtraValue = n; }
-
- sal_Bool HasValidSize() const { return aOutSz.Width() != (-1); }
-
- ExtraPortionInfo* GetExtraInfos() const { return pExtraInfos; }
- void SetExtraInfos( ExtraPortionInfo* p ) { delete pExtraInfos; pExtraInfos = p; }
-};
-
-// -------------------------------------------------------------------------
-// class TextPortionList
-// -------------------------------------------------------------------------
-typedef TextPortion* TextPortionPtr;
-SV_DECL_PTRARR( TextPortionArray, TextPortionPtr, 0, 8 )
-
-class TextPortionList : public TextPortionArray
-{
-public:
- TextPortionList();
- ~TextPortionList();
-
- void Reset();
- sal_uInt16 FindPortion( sal_uInt16 nCharPos, sal_uInt16& rPortionStart, sal_Bool bPreferStartingPortion = sal_False );
- sal_uInt16 GetStartPos( sal_uInt16 nPortion );
- void DeleteFromPortion( sal_uInt16 nDelFrom );
-};
-
-class ParaPortion;
-
-SV_DECL_VARARR( CharPosArray, sal_Int32, 0, CHARPOSGROW )
-
-// ------------------------------------------------------------------------
-// class EditLine
-// -------------------------------------------------------------------------
-class EditLine
-{
-private:
- CharPosArray aPositions;
- long nTxtWidth;
- sal_uInt16 nStartPosX;
- sal_uInt16 nStart; // could be replaced by nStartPortion
- sal_uInt16 nEnd; // could be replaced by nEndPortion
- sal_uInt16 nStartPortion;
- sal_uInt16 nEndPortion;
- sal_uInt16 nHeight; // Total height of the line
- sal_uInt16 nTxtHeight; // Pure Text height
- sal_uInt16 nCrsrHeight; // For contour flow high lines => cursor is large.
- sal_uInt16 nMaxAscent;
- sal_Bool bHangingPunctuation;
- sal_Bool bInvalid; // for skillful formatting
-
-public:
- EditLine();
- EditLine( const EditLine& );
- ~EditLine();
-
- sal_Bool IsIn( sal_uInt16 nIndex ) const
- { return ( (nIndex >= nStart ) && ( nIndex < nEnd ) ); }
-
- sal_Bool IsIn( sal_uInt16 nIndex, sal_Bool bInclEnd ) const
- { return ( ( nIndex >= nStart ) && ( bInclEnd ? ( nIndex <= nEnd ) : ( nIndex < nEnd ) ) ); }
-
- void SetStart( sal_uInt16 n ) { nStart = n; }
- sal_uInt16 GetStart() const { return nStart; }
- sal_uInt16& GetStart() { return nStart; }
-
- void SetEnd( sal_uInt16 n ) { nEnd = n; }
- sal_uInt16 GetEnd() const { return nEnd; }
- sal_uInt16& GetEnd() { return nEnd; }
-
- void SetStartPortion( sal_uInt16 n ) { nStartPortion = n; }
- sal_uInt16 GetStartPortion() const { return nStartPortion; }
- sal_uInt16& GetStartPortion() { return nStartPortion; }
-
- void SetEndPortion( sal_uInt16 n ) { nEndPortion = n; }
- sal_uInt16 GetEndPortion() const { return nEndPortion; }
- sal_uInt16& GetEndPortion() { return nEndPortion; }
-
- void SetHeight( sal_uInt16 nH, sal_uInt16 nTxtH = 0, sal_uInt16 nCrsrH = 0 )
- { nHeight = nH;
- nTxtHeight = ( nTxtH ? nTxtH : nH );
- nCrsrHeight = ( nCrsrH ? nCrsrH : nTxtHeight );
- }
- sal_uInt16 GetHeight() const { return nHeight; }
- sal_uInt16 GetTxtHeight() const { return nTxtHeight; }
- sal_uInt16 GetCrsrHeight() const { return nCrsrHeight; }
-
- void SetTextWidth( long n ) { nTxtWidth = n; }
- long GetTextWidth() const { return nTxtWidth; }
-
- void SetMaxAscent( sal_uInt16 n ) { nMaxAscent = n; }
- sal_uInt16 GetMaxAscent() const { return nMaxAscent; }
-
- void SetHangingPunctuation( sal_Bool b ) { bHangingPunctuation = b; }
- sal_Bool IsHangingPunctuation() const { return bHangingPunctuation; }
-
- sal_uInt16 GetLen() const { return nEnd - nStart; }
-
- sal_uInt16 GetStartPosX() const { return nStartPosX; }
- void SetStartPosX( sal_uInt16 start ) { nStartPosX = start; }
-
- Size CalcTextSize( ParaPortion& rParaPortion );
-
- sal_Bool IsInvalid() const { return bInvalid; }
- sal_Bool IsValid() const { return !bInvalid; }
- void SetInvalid() { bInvalid = sal_True; }
- void SetValid() { bInvalid = sal_False; }
-
- sal_Bool IsEmpty() const { return (nEnd > nStart) ? sal_False : sal_True; }
-
- CharPosArray& GetCharPosArray() { return aPositions; }
-
- EditLine* Clone() const;
-
- EditLine& operator = ( const EditLine& rLine );
- friend sal_Bool operator == ( const EditLine& r1, const EditLine& r2 );
- friend sal_Bool operator != ( const EditLine& r1, const EditLine& r2 );
-};
-
-
-// -------------------------------------------------------------------------
-// class LineList
-// -------------------------------------------------------------------------
-typedef EditLine* EditLinePtr;
-SV_DECL_PTRARR( LineArray, EditLinePtr, 0, 4 )
-
-class EditLineList : public LineArray
-{
-public:
- EditLineList();
- ~EditLineList();
-
- void Reset();
- void DeleteFromLine( sal_uInt16 nDelFrom );
- sal_uInt16 FindLine( sal_uInt16 nChar, sal_Bool bInclEnd );
-};
-
-// -------------------------------------------------------------------------
-// class ParaPortion
-// -------------------------------------------------------------------------
-class ParaPortion
-{
- friend class ImpEditEngine; // to adjust the height
-private:
- EditLineList aLineList;
- TextPortionList aTextPortionList;
- ContentNode* pNode;
- long nHeight;
-
- ScriptTypePosInfos aScriptInfos;
- WritingDirectionInfos aWritingDirectionInfos;
-
- sal_uInt16 nInvalidPosStart;
- sal_uInt16 nFirstLineOffset; // For Writer-LineSpacing-Interpretation
- sal_uInt16 nBulletX;
- short nInvalidDiff;
-
- sal_Bool bInvalid : 1;
- sal_Bool bSimple : 1; // only linear Tap
- sal_Bool bVisible : 1; // Belongs to the node!
- sal_Bool bForceRepaint : 1;
-
- ParaPortion( const ParaPortion& );
-
-public:
- ParaPortion( ContentNode* pNode );
- ~ParaPortion();
-
- sal_uInt16 GetLineNumber( sal_uInt16 nIndex );
-
- EditLineList& GetLines() { return aLineList; }
-
- sal_Bool IsInvalid() const { return bInvalid; }
- sal_Bool IsSimpleInvalid() const { return bSimple; }
- void SetValid() { bInvalid = sal_False; bSimple = sal_True;}
-
- sal_Bool MustRepaint() const { return bForceRepaint; }
- void SetMustRepaint( sal_Bool bRP ) { bForceRepaint = bRP; }
-
- sal_uInt16 GetBulletX() const { return nBulletX; }
- void SetBulletX( sal_uInt16 n ) { nBulletX = n; }
-
- void MarkInvalid( sal_uInt16 nStart, short nDiff);
- void MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 nEnd );
-
- 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; }
-
- ContentNode* GetNode() const { return pNode; }
- TextPortionList& GetTextPortions() { return aTextPortionList; }
-
- sal_uInt16 GetInvalidPosStart() const { return nInvalidPosStart; }
- short GetInvalidDiff() const { return nInvalidDiff; }
-
- void CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormattedLine );
-
- sal_Bool DbgCheckTextPortions();
-};
-
-typedef ParaPortion* ParaPortionPtr;
-SV_DECL_PTRARR( DummyParaPortionList, ParaPortionPtr, 0, 4 )
-
-// -------------------------------------------------------------------------
-// class ParaPortionList
-// -------------------------------------------------------------------------
-class ParaPortionList : public DummyParaPortionList
-{
- sal_uInt16 nLastCache;
-public:
- ParaPortionList();
- ~ParaPortionList();
-
- void Reset();
- long GetYOffset( ParaPortion* pPPortion );
- sal_uInt16 FindParagraph( long nYOffset );
-
- inline ParaPortion* SaveGetObject( sal_uInt16 nPos ) const
- { return ( nPos < Count() ) ? GetObject( nPos ) : 0; }
-
- sal_uInt16 GetPos( const ParaPortionPtr &rPtr ) const;
-
- // temporary:
- void DbgCheck( EditDoc& rDoc );
-};
-
-// -------------------------------------------------------------------------
-// class EditSelection
-// -------------------------------------------------------------------------
-class EditSelection
-{
-private:
- EditPaM aStartPaM;
- EditPaM aEndPaM;
-
-public:
- EditSelection(); // No constructor and destructor
- // are automtically excecuted correctly!
- EditSelection( const EditPaM& rStartAndAnd );
- EditSelection( const EditPaM& rStart, const EditPaM& rEnd );
-
- EditPaM& Min() { return aStartPaM; }
- EditPaM& Max() { return aEndPaM; }
-
- const EditPaM& Min() const { return aStartPaM; }
- const EditPaM& Max() const { return aEndPaM; }
-
- sal_Bool HasRange() const { return aStartPaM != aEndPaM; }
- sal_Bool IsInvalid() const;
- sal_Bool DbgIsBuggy( EditDoc& rDoc );
-
- sal_Bool Adjust( const ContentList& rNodes );
-
- EditSelection& operator = ( const EditPaM& r );
- sal_Bool operator == ( const EditSelection& r ) const
- { return ( ( aStartPaM == r.aStartPaM ) && ( aEndPaM == r.aEndPaM ) )
- ? sal_True : sal_False; }
- sal_Bool operator != ( const EditSelection& r ) const { return !( r == *this ); }
-};
-
-// -------------------------------------------------------------------------
-// class DeletedNodeInfo
-// -------------------------------------------------------------------------
-class DeletedNodeInfo
-{
-private:
- sal_uIntPtr nInvalidAdressPtr;
- sal_uInt16 nInvalidParagraph;
-
-public:
- DeletedNodeInfo( sal_uIntPtr nInvAdr, sal_uInt16 nPos )
- { nInvalidAdressPtr = nInvAdr;
- nInvalidParagraph = nPos; }
-
- sal_uIntPtr GetInvalidAdress() { return nInvalidAdressPtr; }
- sal_uInt16 GetPosition() { return nInvalidParagraph; }
-};
-
-typedef DeletedNodeInfo* DeletedNodeInfoPtr;
-SV_DECL_PTRARR( DeletedNodesList, DeletedNodeInfoPtr, 0, 4 )
-
-// -------------------------------------------------------------------------
-// class EditDoc
-// -------------------------------------------------------------------------
-class EditDoc : public ContentList
-{
-private:
- SfxItemPool* pItemPool;
- Link aModifyHdl;
-
- SvxFont aDefFont; //faster than ever from the pool!!
- sal_uInt16 nDefTab;
- sal_Bool bIsVertical;
- sal_Bool bIsFixedCellHeight;
-
- sal_Bool bOwnerOfPool;
- sal_Bool bModified;
-
-protected:
- void ImplDestroyContents();
-
-public:
- EditDoc( SfxItemPool* pItemPool );
- ~EditDoc();
-
- sal_Bool IsModified() const { return bModified; }
- void SetModified( sal_Bool b );
-
- void SetModifyHdl( const Link& rLink ) { aModifyHdl = rLink; }
- Link GetModifyHdl() const { return aModifyHdl; }
-
- void CreateDefFont( sal_Bool bUseStyles );
- const SvxFont& GetDefFont() { return aDefFont; }
-
- void SetDefTab( sal_uInt16 nTab ) { nDefTab = nTab ? nTab : DEFTAB; }
- sal_uInt16 GetDefTab() const { return nDefTab; }
-
- void SetVertical( sal_Bool bVertical ) { bIsVertical = bVertical; }
- sal_Bool IsVertical() const { return bIsVertical; }
-
- void SetFixedCellHeight( sal_Bool bUseFixedCellHeight ) { bIsFixedCellHeight = bUseFixedCellHeight; }
- sal_Bool IsFixedCellHeight() const { return bIsFixedCellHeight; }
-
- EditPaM Clear();
- EditPaM RemoveText();
- EditPaM RemoveChars( EditPaM aPaM, sal_uInt16 nChars );
- void InsertText( const EditPaM& rPaM, xub_Unicode c );
- EditPaM InsertText( EditPaM aPaM, const XubString& rStr );
- EditPaM InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs );
- EditPaM InsertFeature( EditPaM aPaM, const SfxPoolItem& rItem );
- EditPaM ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight );
-
- String GetText( LineEnd eEnd ) const;
- sal_uLong GetTextLen() const;
-
- XubString GetParaAsString( sal_uInt16 nNode ) const;
- XubString GetParaAsString( ContentNode* pNode, sal_uInt16 nStartPos = 0, sal_uInt16 nEndPos = 0xFFFF, sal_Bool bResolveFields = sal_True ) const;
-
- inline EditPaM GetStartPaM() const;
- inline EditPaM GetEndPaM() const;
-
- SfxItemPool& GetItemPool() { return *pItemPool; }
- const SfxItemPool& GetItemPool() const { return *pItemPool; }
-
- void RemoveItemsFromPool( ContentNode* pNode );
-
- void InsertAttrib( const SfxPoolItem& rItem, ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd );
- void InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem );
- void InsertAttribInSelection( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem );
- sal_Bool RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt16 nWhich = 0 );
- sal_Bool RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich = 0 );
- void FindAttribs( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, SfxItemSet& rCurSet );
-
- sal_uInt16 GetPos( ContentNode* pNode ) const { return ContentList::GetPos(pNode); }
- ContentNode* SaveGetObject( sal_uInt16 nPos ) const { return ( nPos < Count() ) ? GetObject( nPos ) : 0; }
-
- static XubString GetSepStr( LineEnd eEnd );
-};
-
-inline EditPaM EditDoc::GetStartPaM() const
-{
- return EditPaM( GetObject( 0 ), 0 );
-}
-
-inline EditPaM EditDoc::GetEndPaM() const
-{
- ContentNode* pLastNode = GetObject( Count()-1 );
- return EditPaM( pLastNode, pLastNode->Len() );
-}
-
-inline EditCharAttrib* GetAttrib( const CharAttribArray& rAttribs, sal_uInt16 nAttr )
-{
- return ( nAttr < rAttribs.Count() ) ? rAttribs[nAttr] : 0;
-}
-
-sal_Bool CheckOrderedList( CharAttribArray& rAttribs, sal_Bool bStart );
-
-// -------------------------------------------------------------------------
-// class EditEngineItemPool
-// -------------------------------------------------------------------------
-class EditEngineItemPool : public SfxItemPool
-{
-public:
- EditEngineItemPool( sal_Bool bPersistenRefCounts );
-protected:
- virtual ~EditEngineItemPool();
-public:
-
- virtual SvStream& Store( SvStream& rStream ) const;
-};
-
-#endif // _EDITDOC_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editdoc2.cxx b/editeng/source/editeng/editdoc2.cxx
deleted file mode 100644
index 249ab3f0c0..0000000000
--- a/editeng/source/editeng/editdoc2.cxx
+++ /dev/null
@@ -1,502 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-#include <svl/smplhint.hxx>
-
-#include <tools/rtti.hxx>
-#include <editeng/lspcitem.hxx>
-#include <editeng/adjitem.hxx>
-#include <editeng/tstpitem.hxx>
-
-#include <editdoc.hxx>
-#include <impedit.hxx>
-#include <editdbg.hxx>
-
-#include <editeng/numitem.hxx>
-
-#include <editeng/akrnitem.hxx>
-#include <editeng/cntritem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/crsditem.hxx>
-#include <editeng/escpitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/wrlmitem.hxx>
-#include <editeng/charscaleitem.hxx>
-
-#include <vcl/svapp.hxx> // For AppWindow...
-
-DBG_NAME( EE_ParaPortion )
-
-SV_IMPL_VARARR( CharPosArray, sal_Int32 );
-
-
-TextPortionList::TextPortionList()
-{
-}
-
-TextPortionList::~TextPortionList()
-{
- Reset();
-}
-
-void TextPortionList::Reset()
-{
- for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ )
- delete GetObject( nPortion );
- Remove( 0, Count() );
-}
-
-void TextPortionList::DeleteFromPortion( sal_uInt16 nDelFrom )
-{
- DBG_ASSERT( ( nDelFrom < Count() ) || ( (nDelFrom == 0) && (Count() == 0) ), "DeleteFromPortion: Out of range" );
- for ( sal_uInt16 nP = nDelFrom; nP < Count(); nP++ )
- delete GetObject( nP );
- Remove( nDelFrom, Count()-nDelFrom );
-}
-
-sal_uInt16 TextPortionList::FindPortion( sal_uInt16 nCharPos, sal_uInt16& nPortionStart, sal_Bool bPreferStartingPortion )
-{
- // When nCharPos at portion limit, the left portion is found
- sal_uInt16 nTmpPos = 0;
- for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ )
- {
- TextPortion* pPortion = GetObject( nPortion );
- nTmpPos = nTmpPos + pPortion->GetLen();
- if ( nTmpPos >= nCharPos )
- {
- // take this one if we don't prefer the starting portion, or if it's the last one
- if ( ( nTmpPos != nCharPos ) || !bPreferStartingPortion || ( nPortion == Count() - 1 ) )
- {
- nPortionStart = nTmpPos - pPortion->GetLen();
- return nPortion;
- }
- }
- }
- OSL_FAIL( "FindPortion: Not found!" );
- return ( Count() - 1 );
-}
-
-sal_uInt16 TextPortionList::GetStartPos( sal_uInt16 nPortion )
-{
- sal_uInt16 nPos = 0;
- for ( sal_uInt16 n = 0; n < nPortion; n++ )
- {
- TextPortion* pPortion = GetObject( n );
- nPos = nPos + pPortion->GetLen();
- }
- return nPos;
-}
-
-
-ExtraPortionInfo::ExtraPortionInfo()
-{
- nOrgWidth = 0;
- nWidthFullCompression = 0;
- nMaxCompression100thPercent = 0;
- nAsianCompressionTypes = 0;
- nPortionOffsetX = 0;
- bFirstCharIsRightPunktuation = sal_False;
- bCompressed = sal_False;
- pOrgDXArray = NULL;
-}
-
-ExtraPortionInfo::~ExtraPortionInfo()
-{
- delete[] pOrgDXArray;
-}
-
-void ExtraPortionInfo::SaveOrgDXArray( const sal_Int32* pDXArray, sal_uInt16 nLen )
-{
- delete[] pOrgDXArray;
- pOrgDXArray = new sal_Int32[nLen];
- memcpy( pOrgDXArray, pDXArray, nLen*sizeof(sal_Int32) );
-}
-
-
-ParaPortion::ParaPortion( ContentNode* pN )
-{
- DBG_CTOR( EE_ParaPortion, 0 );
-
- pNode = pN;
- bInvalid = sal_True;
- bVisible = sal_True;
- bSimple = sal_False;
- bForceRepaint = sal_False;
- nInvalidPosStart = 0;
- nInvalidDiff = 0;
- nHeight = 0;
- nFirstLineOffset = 0;
- nBulletX = 0;
-}
-
-ParaPortion::~ParaPortion()
-{
- DBG_DTOR( EE_ParaPortion, 0 );
-}
-
-void ParaPortion::MarkInvalid( sal_uInt16 nStart, short nDiff )
-{
- if ( bInvalid == sal_False )
- {
-// nInvalidPosEnd = nStart; // ??? => CreateLines
- nInvalidPosStart = ( nDiff >= 0 ) ? nStart : ( nStart + nDiff );
- nInvalidDiff = nDiff;
- }
- else
- {
- // Simple tap in succession
- if ( ( nDiff > 0 ) && ( nInvalidDiff > 0 ) &&
- ( ( nInvalidPosStart+nInvalidDiff ) == nStart ) )
- {
- nInvalidDiff = nInvalidDiff + nDiff;
- }
- // Simple delete in succession
- else if ( ( nDiff < 0 ) && ( nInvalidDiff < 0 ) && ( nInvalidPosStart == nStart ) )
- {
- nInvalidPosStart = nInvalidPosStart + nDiff;
- nInvalidDiff = nInvalidDiff + nDiff;
- }
- else
- {
-// nInvalidPosEnd = pNode->Len();
- DBG_ASSERT( ( nDiff >= 0 ) || ( (nStart+nDiff) >= 0 ), "MarkInvalid: Diff out of Range" );
- nInvalidPosStart = Min( nInvalidPosStart, (sal_uInt16) ( nDiff < 0 ? nStart+nDiff : nDiff ) );
- nInvalidDiff = 0;
- bSimple = sal_False;
- }
- }
- bInvalid = sal_True;
- aScriptInfos.clear();
- aWritingDirectionInfos.clear();
-}
-
-void ParaPortion::MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 /* nEnd */ )
-{
- if ( bInvalid == sal_False )
- {
- nInvalidPosStart = nStart;
-// nInvalidPosEnd = nEnd;
- }
- else
- {
- nInvalidPosStart = Min( nInvalidPosStart, nStart );
-// nInvalidPosEnd = pNode->Len();
- }
- nInvalidDiff = 0;
- bInvalid = sal_True;
- bSimple = sal_False;
- aScriptInfos.clear();
- aWritingDirectionInfos.clear();
-}
-
-sal_uInt16 ParaPortion::GetLineNumber( sal_uInt16 nIndex )
-{
- 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++ )
- {
- if ( aLineList[nLine]->IsIn( nIndex ) )
- return nLine;
- }
-
- // Then it should be at the end of the last line!
- DBG_ASSERT( nIndex == aLineList[ aLineList.Count() - 1 ]->GetEnd(), "Index dead wrong!" );
- return (aLineList.Count()-1);
-}
-
-void ParaPortion::SetVisible( sal_Bool bMakeVisible )
-{
- bVisible = bMakeVisible;
-}
-
-void ParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormattedLine )
-{
- sal_uInt16 nLines = aLineList.Count();
- DBG_ASSERT( nLines, "CorrectPortionNumbersFromLine: Empty Portion?" );
- if ( nLastFormattedLine < ( nLines - 1 ) )
- {
- const EditLine* pLastFormatted = aLineList[ nLastFormattedLine ];
- const EditLine* pUnformatted = aLineList[ nLastFormattedLine+1 ];
- short nPortionDiff = pUnformatted->GetStartPortion() - pLastFormatted->GetEndPortion();
- short nTextDiff = pUnformatted->GetStart() - pLastFormatted->GetEnd();
- nTextDiff++; // LastFormatted->GetEnd() was included => 1 deducted too much!
-
- // The first unformatted must begin exactly one Portion behind the last
- // of the formatted:
- // If the modified line was split into one portion, can
- // nLastEnd > nNextStart!
- int nPDiff = -( nPortionDiff-1 );
- int nTDiff = -( nTextDiff-1 );
- if ( nPDiff || nTDiff )
- {
- for ( sal_uInt16 nL = nLastFormattedLine+1; nL < nLines; nL++ )
- {
- EditLine* pLine = aLineList[ nL ];
-
- pLine->GetStartPortion() = sal::static_int_cast< sal_uInt16 >(
- pLine->GetStartPortion() + nPDiff);
- pLine->GetEndPortion() = sal::static_int_cast< sal_uInt16 >(
- pLine->GetEndPortion() + nPDiff);
-
- pLine->GetStart() = sal::static_int_cast< sal_uInt16 >(
- pLine->GetStart() + nTDiff);
- pLine->GetEnd() = sal::static_int_cast< sal_uInt16 >(
- pLine->GetEnd() + nTDiff);
-
- pLine->SetValid();
- }
- }
- }
- DBG_ASSERT( aLineList[ aLineList.Count()-1 ]->GetEnd() == pNode->Len(), "CorrectLines: The end is not right!" );
-}
-
-// Shared reverse lookup acceleration pieces ...
-
-static sal_uInt16 FastGetPos( const VoidPtr *pPtrArray, sal_uInt16 nPtrArrayLen,
- VoidPtr pPtr, sal_uInt16 &rLastPos )
-{
- // Through certain filter code-paths we do a lot of appends, which in
- // turn call GetPos - creating some N^2 nightmares. If we have a
- // non-trivially large list, do a few checks from the end first.
- if( rLastPos > 16 )
- {
- sal_uInt16 nEnd;
- if (rLastPos > nPtrArrayLen - 2)
- nEnd = nPtrArrayLen;
- else
- nEnd = rLastPos + 2;
-
- for( sal_uInt16 nIdx = rLastPos - 2; nIdx < nEnd; nIdx++ )
- {
- if( pPtrArray[ nIdx ] == pPtr )
- {
- rLastPos = nIdx;
- return nIdx;
- }
- }
- }
- // The world's lamest linear search from svarray ...
- for( sal_uInt16 nIdx = 0; nIdx < nPtrArrayLen; nIdx++ )
- if (pPtrArray[ nIdx ] == pPtr )
- return rLastPos = nIdx;
- return USHRT_MAX;
-}
-
-ParaPortionList::ParaPortionList() : nLastCache( 0 )
-{
-}
-
-ParaPortionList::~ParaPortionList()
-{
- Reset();
-}
-
-sal_uInt16 ParaPortionList::GetPos( const ParaPortionPtr &rPtr ) const
-{
- return FastGetPos( reinterpret_cast<const VoidPtr *>( GetData() ),
- Count(), static_cast<VoidPtr>( rPtr ),
- ((ParaPortionList *)this)->nLastCache );
-}
-
-sal_uInt16 ContentList::GetPos( const ContentNodePtr &rPtr ) const
-{
- return FastGetPos( reinterpret_cast<const VoidPtr *>( GetData() ),
- Count(), static_cast<VoidPtr>( rPtr ),
- ((ContentList *)this)->nLastCache );
-}
-
-void ParaPortionList::Reset()
-{
- for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ )
- delete GetObject( nPortion );
- Remove( 0, Count() );
-}
-
-long ParaPortionList::GetYOffset( ParaPortion* pPPortion )
-{
- long nHeight = 0;
- for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ )
- {
- ParaPortion* pTmpPortion = GetObject(nPortion);
- if ( pTmpPortion == pPPortion )
- return nHeight;
- nHeight += pTmpPortion->GetHeight();
- }
- OSL_FAIL( "GetYOffset: Portion not found" );
- return nHeight;
-}
-
-sal_uInt16 ParaPortionList::FindParagraph( long nYOffset )
-{
- long nY = 0;
- for ( sal_uInt16 nPortion = 0; nPortion < Count(); nPortion++ )
- {
- nY += GetObject(nPortion)->GetHeight(); // should also be correct even in bVisible!
- if ( nY > nYOffset )
- return nPortion;
- }
- return 0xFFFF; // Should be reachable through EE_PARA_NOT_FOUND!
-}
-
-void ParaPortionList::DbgCheck( EditDoc&
-#ifdef DBG_UTIL
- rDoc
-#endif
- )
-{
-#ifdef DBG_UTIL
- 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 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
-}
-
-
-ContentAttribsInfo::ContentAttribsInfo( const SfxItemSet& rParaAttribs ) :
- aPrevParaAttribs( rParaAttribs)
-{
-}
-
-
-void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit )
-{
- DBG_ASSERT( eSourceUnit != eDestUnit, "ConvertItem - Why?!" );
-
- switch ( rPoolItem.Which() )
- {
- case EE_PARA_LRSPACE:
- {
- 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.SetRight( OutputDevice::LogicToLogic( rItem.GetRight(), eSourceUnit, eDestUnit ) );
- }
- break;
- case EE_PARA_ULSPACE:
- {
- 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 ) ) );
- }
- break;
- case EE_PARA_SBL:
- {
- DBG_ASSERT( rPoolItem.IsA( TYPE( SvxLineSpacingItem ) ), "ConvertItem: Invalid Item!" );
- SvxLineSpacingItem& rItem = (SvxLineSpacingItem&)rPoolItem;
- // 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: Invalid Item!" );
- SvxTabStopItem& rItem = (SvxTabStopItem&)rPoolItem;
- SvxTabStopItem aNewItem( EE_PARA_TABS );
- for ( sal_uInt16 i = 0; i < rItem.Count(); i++ )
- {
- const SvxTabStop& rTab = rItem[i];
- SvxTabStop aNewStop( OutputDevice::LogicToLogic( rTab.GetTabPos(), eSourceUnit, eDestUnit ), rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() );
- aNewItem.Insert( aNewStop );
- }
- rItem = aNewItem;
- }
- break;
- case EE_CHAR_FONTHEIGHT:
- case EE_CHAR_FONTHEIGHT_CJK:
- case EE_CHAR_FONTHEIGHT_CTL:
- {
- DBG_ASSERT( rPoolItem.IsA( TYPE( SvxFontHeightItem ) ), "ConvertItem: Invalid Item!" );
- SvxFontHeightItem& rItem = (SvxFontHeightItem&)rPoolItem;
- rItem.SetHeight( OutputDevice::LogicToLogic( rItem.GetHeight(), eSourceUnit, eDestUnit ) );
- }
- break;
- }
-}
-
-void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const MapUnit* pSourceUnit, const MapUnit* pDestUnit )
-{
- const SfxItemPool* pSourcePool = rSource.GetPool();
- const SfxItemPool* pDestPool = rDest.GetPool();
-
- for ( sal_uInt16 nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ )
- {
- // If possible go through SlotID ...
-
- sal_uInt16 nSourceWhich = nWhich;
- sal_uInt16 nSlot = pDestPool->GetTrueSlotId( nWhich );
- if ( nSlot )
- {
- sal_uInt16 nW = pSourcePool->GetTrueWhich( nSlot );
- if ( nW )
- nSourceWhich = nW;
- }
-
- if ( rSource.GetItemState( nSourceWhich, sal_False ) == SFX_ITEM_ON )
- {
- MapUnit eSourceUnit = pSourceUnit ? *pSourceUnit : (MapUnit)pSourcePool->GetMetric( nSourceWhich );
- MapUnit eDestUnit = pDestUnit ? *pDestUnit : (MapUnit)pDestPool->GetMetric( nWhich );
- if ( eSourceUnit != eDestUnit )
- {
- SfxPoolItem* pItem = rSource.Get( nSourceWhich ).Clone();
-// pItem->SetWhich( nWhich );
- ConvertItem( *pItem, eSourceUnit, eDestUnit );
- rDest.Put( *pItem, nWhich );
- delete pItem;
- }
- else
- {
- rDest.Put( rSource.Get( nSourceWhich ), nWhich );
- }
- }
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
deleted file mode 100644
index d709553039..0000000000
--- a/editeng/source/editeng/editeng.cxx
+++ /dev/null
@@ -1,2846 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-
-#define USE_SVXFONT
-
-#define _SVSTDARR_sal_uInt16S
-#include <svl/svstdarr.hxx>
-#include <svl/ctloptions.hxx>
-#include <svtools/ctrltool.hxx>
-
-#include <editeng/svxfont.hxx>
-#include <impedit.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/editstat.hxx>
-#include <editdbg.hxx>
-#include <eerdll2.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng.hrc>
-#include <editeng/acorrcfg.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/txtrange.hxx>
-#include <vcl/graph.hxx>
-
-#include <editeng/akrnitem.hxx>
-#include <editeng/cntritem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/crsditem.hxx>
-#include <editeng/escpitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/wrlmitem.hxx>
-#include <editeng/brshitem.hxx>
-#include <editeng/cscoitem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/emphitem.hxx>
-#include <editeng/charscaleitem.hxx>
-#include <editeng/charreliefitem.hxx>
-
-#include <sot/exchange.hxx>
-#include <sot/formats.hxx>
-
-#include <editeng/numitem.hxx>
-#include <editeng/bulitem.hxx>
-#include <editeng/unolingu.hxx>
-#include <linguistic/lngprops.hxx>
-#include <i18npool/mslangid.hxx>
-#include <vcl/help.hxx>
-#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
-#include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
-
-#include <svl/srchdefs.hxx>
-
-#if OSL_DEBUG_LEVEL > 1
-#include <editeng/frmdiritem.hxx>
-#endif
-#include <basegfx/polygon/b2dpolygon.hxx>
-
-// later -> TOOLS\STRING.H (for Grep: WS_TARGET)
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::linguistic2;
-
-
-DBG_NAME( EditEngine )
-DBG_NAMEEX( EditView )
-
-#if (OSL_DEBUG_LEVEL > 1) || defined ( DBG_UTIL )
-static sal_Bool bDebugPaint = sal_False;
-#endif
-
-SV_IMPL_VARARR( EECharAttribArray, EECharAttrib );
-
-static SfxItemPool* pGlobalPool=0;
-
-// ----------------------------------------------------------------------
-// EditEngine
-// ----------------------------------------------------------------------
-EditEngine::EditEngine( SfxItemPool* pItemPool )
-{
- DBG_CTOR( EditEngine, 0 );
- pImpEditEngine = new ImpEditEngine( this, pItemPool );
-}
-
-EditEngine::~EditEngine()
-{
- DBG_DTOR( EditEngine, 0 );
- delete pImpEditEngine;
-}
-
-void EditEngine::EnableUndo( sal_Bool bEnable )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->EnableUndo( bEnable );
-}
-
-sal_Bool EditEngine::IsUndoEnabled()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->IsUndoEnabled();
-}
-
-sal_Bool EditEngine::IsInUndo()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->IsInUndo();
-}
-
-::svl::IUndoManager& EditEngine::GetUndoManager()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetUndoManager();
-}
-
-void EditEngine::UndoActionStart( sal_uInt16 nId )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- DBG_ASSERT( !pImpEditEngine->IsInUndo(), "Calling UndoActionStart in Undomode!" );
- if ( !pImpEditEngine->IsInUndo() )
- pImpEditEngine->UndoActionStart( nId );
-}
-
-void EditEngine::UndoActionEnd( sal_uInt16 nId )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- DBG_ASSERT( !pImpEditEngine->IsInUndo(), "Calling UndoActionStart in Undomode!" );
- if ( !pImpEditEngine->IsInUndo() )
- pImpEditEngine->UndoActionEnd( nId );
-}
-
-sal_Bool EditEngine::HasTriedMergeOnLastAddUndo() const
-{
- return pImpEditEngine->mbLastTryMerge;
-}
-
-void EditEngine::SetRefDevice( OutputDevice* pRefDev )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetRefDevice( pRefDev );
-}
-
-OutputDevice* EditEngine::GetRefDevice() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetRefDevice();
-}
-
-void EditEngine::SetRefMapMode( const MapMode& rMapMode )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetRefMapMode( rMapMode );
-}
-
-MapMode EditEngine::GetRefMapMode()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetRefMapMode();
-}
-
-void EditEngine::SetBackgroundColor( const Color& rColor )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetBackgroundColor( rColor );
-}
-
-Color EditEngine::GetBackgroundColor() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetBackgroundColor();
-}
-
-Color EditEngine::GetAutoColor() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetAutoColor();
-}
-
-void EditEngine::EnableAutoColor( sal_Bool b )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->EnableAutoColor( b );
-}
-
-sal_Bool EditEngine::IsAutoColorEnabled() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->IsAutoColorEnabled();
-}
-
-void EditEngine::ForceAutoColor( sal_Bool b )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->ForceAutoColor( b );
-}
-
-sal_Bool EditEngine::IsForceAutoColor() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->IsForceAutoColor();
-}
-
-const SfxItemSet& EditEngine::GetEmptyItemSet()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetEmptyItemSet();
-}
-
-void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- Draw( pOutDev, rOutRect, Point( 0, 0 ) );
-}
-
-void EditEngine::Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- // 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();
- Point aStartPos( rStartPos );
- if ( IsVertical() )
- {
- aStartPos.X() += GetPaperSize().Width();
- aStartPos = Rotate( aStartPos, nOrientation, rStartPos );
- }
- pImpEditEngine->Paint( pOutDev, aBigRec, aStartPos, sal_False, nOrientation );
- if( pOutDev->GetConnectMetaFile() )
- pOutDev->Pop();
-}
-
-void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos )
-{
- Draw( pOutDev, rOutRect, rStartDocPos, sal_True );
-}
-
-void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos, sal_Bool bClip )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
-#if defined( DBG_UTIL ) || (OSL_DEBUG_LEVEL > 1)
- if ( bDebugPaint )
- EditDbg::ShowEditEngineData( this, sal_False );
-#endif
-
- // Align to the pixel boundary, so that it becomes exactly the same
- // as Paint ().
- Rectangle aOutRect( pOutDev->LogicToPixel( rOutRect ) );
- aOutRect = pOutDev->PixelToLogic( aOutRect );
-
- Point aStartPos;
- if ( !IsVertical() )
- {
- aStartPos.X() = aOutRect.Left() - rStartDocPos.X();
- aStartPos.Y() = aOutRect.Top() - rStartDocPos.Y();
- }
- else
- {
- aStartPos.X() = aOutRect.Right() + rStartDocPos.Y();
- aStartPos.Y() = aOutRect.Top() - rStartDocPos.X();
- }
-
- sal_Bool bClipRegion = pOutDev->IsClipRegion();
- sal_Bool bMetafile = pOutDev->GetConnectMetaFile() ? sal_True : sal_False;
- Region aOldRegion = pOutDev->GetClipRegion();
-
- // If one existed => intersection!
- // Use Push/pop for creating the Meta file
- if ( bMetafile )
- pOutDev->Push();
-
- // Always use the Intersect method, it is a must for Metafile!
- if ( bClip )
- {
- // Clip only if neccesary...
- if ( !rStartDocPos.X() && !rStartDocPos.Y() &&
- ( rOutRect.GetHeight() >= (long)GetTextHeight() ) &&
- ( rOutRect.GetWidth() >= (long)CalcTextWidth() ) )
- {
- bClip = sal_False;
- }
- else
- {
- // Some printer drivers cause problems if characters graze the
- // ClipRegion, therefore rather add a pixel more ...
- Rectangle aClipRect( aOutRect );
- if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
- {
- Size aPixSz( 1, 0 );
- aPixSz = pOutDev->PixelToLogic( aPixSz );
- aClipRect.Right() += aPixSz.Width();
- aClipRect.Bottom() += aPixSz.Width();
- }
- pOutDev->IntersectClipRegion( aClipRect );
- }
- }
-
- pImpEditEngine->Paint( pOutDev, aOutRect, aStartPos );
-
- if ( bMetafile )
- pOutDev->Pop();
- else if ( bClipRegion )
- pOutDev->SetClipRegion( aOldRegion );
- else
- pOutDev->SetClipRegion();
-}
-
-void EditEngine::InsertView( EditView* pEditView, sal_uInt16 nIndex )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- DBG_CHKOBJ( pEditView, EditView, 0 );
-
- if ( nIndex > pImpEditEngine->GetEditViews().Count() )
- nIndex = pImpEditEngine->GetEditViews().Count();
-
- pImpEditEngine->GetEditViews().Insert( pEditView, nIndex );
- EditSelection aStartSel;
- aStartSel = pImpEditEngine->GetEditDoc().GetStartPaM();
- pEditView->pImpEditView->SetEditSelection( aStartSel );
- if ( !pImpEditEngine->GetActiveView() )
- pImpEditEngine->SetActiveView( pEditView );
-
- pEditView->pImpEditView->AddDragAndDropListeners();
-}
-
-EditView* EditEngine::RemoveView( EditView* pView )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- DBG_CHKOBJ( pView, EditView, 0 );
-
- pView->HideCursor();
- EditView* pRemoved = 0;
- sal_uInt16 nPos = pImpEditEngine->GetEditViews().GetPos( pView );
- DBG_ASSERT( nPos != USHRT_MAX, "RemoveView with invalid index" );
- if ( nPos != USHRT_MAX )
- {
- pRemoved = pImpEditEngine->GetEditViews().GetObject( nPos );
- pImpEditEngine->GetEditViews().Remove( nPos );
- if ( pImpEditEngine->GetActiveView() == pView )
- {
- pImpEditEngine->SetActiveView( 0 );
- pImpEditEngine->GetSelEngine().SetCurView( 0 );
- }
- pView->pImpEditView->RemoveDragAndDropListeners();
-
- }
- return pRemoved;
-}
-
-EditView* EditEngine::RemoveView( sal_uInt16 nIndex )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- EditView* pView = pImpEditEngine->GetEditViews().GetObject( nIndex );
- if ( pView )
- return RemoveView( pView );
- return NULL;
-}
-
-EditView* EditEngine::GetView( sal_uInt16 nIndex ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetEditViews().GetObject( nIndex );
-}
-
-sal_uInt16 EditEngine::GetViewCount() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetEditViews().Count();
-}
-
-sal_Bool EditEngine::HasView( EditView* pView ) const
-{
- return pImpEditEngine->GetEditViews().GetPos( pView ) != USHRT_MAX;
-}
-
-EditView* EditEngine::GetActiveView() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetActiveView();
-}
-
-void EditEngine::SetActiveView( EditView* pView )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( pView )
- {
- DBG_CHKOBJ( pView, EditView, 0 );
- }
- pImpEditEngine->SetActiveView( pView );
-}
-
-void EditEngine::SetDefTab( sal_uInt16 nDefTab )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->GetEditDoc().SetDefTab( nDefTab );
- if ( pImpEditEngine->IsFormatted() )
- {
- pImpEditEngine->FormatFullDoc();
- pImpEditEngine->UpdateViews( (EditView*) 0 );
- }
-}
-
-sal_uInt16 EditEngine::GetDefTab() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetEditDoc().GetDefTab();
-}
-
-void EditEngine::SetPaperSize( const Size& rNewSize )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- Size aOldSize( pImpEditEngine->GetPaperSize() );
- pImpEditEngine->SetValidPaperSize( rNewSize );
- Size aNewSize( pImpEditEngine->GetPaperSize() );
-
- sal_Bool bAutoPageSize = pImpEditEngine->GetStatus().AutoPageSize();
- if ( bAutoPageSize || ( aNewSize.Width() != aOldSize.Width() ) )
- {
- for ( sal_uInt16 nView = 0; nView < pImpEditEngine->aEditViews.Count(); nView++ )
- {
- EditView* pView = pImpEditEngine->aEditViews[nView];
- DBG_CHKOBJ( pView, EditView, 0 );
- if ( bAutoPageSize )
- pView->pImpEditView->RecalcOutputArea();
- else if ( pView->pImpEditView->DoAutoSize() )
- {
- pView->pImpEditView->ResetOutputArea( Rectangle(
- pView->pImpEditView->GetOutputArea().TopLeft(), aNewSize ) );
- }
- }
-
- if ( bAutoPageSize || pImpEditEngine->IsFormatted() )
- {
- // 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();
-
- pImpEditEngine->UpdateViews( pImpEditEngine->GetActiveView() );
-
- if ( pImpEditEngine->GetUpdateMode() && pImpEditEngine->GetActiveView() )
- pImpEditEngine->pActiveView->ShowCursor( sal_False, sal_False );
- }
- }
-}
-
-const Size& EditEngine::GetPaperSize() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetPaperSize();
-}
-
-void EditEngine::SetVertical( sal_Bool bVertical )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetVertical( bVertical );
-}
-
-sal_Bool EditEngine::IsVertical() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->IsVertical();
-}
-
-void EditEngine::SetFixedCellHeight( sal_Bool bUseFixedCellHeight )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetFixedCellHeight( bUseFixedCellHeight );
-}
-
-sal_Bool EditEngine::IsFixedCellHeight() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->IsFixedCellHeight();
-}
-
-void EditEngine::SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetDefaultHorizontalTextDirection( eHTextDir );
-}
-
-EEHorizontalTextDirection EditEngine::GetDefaultHorizontalTextDirection() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetDefaultHorizontalTextDirection();
-}
-
-sal_uInt16 EditEngine::GetScriptType( const ESelection& rSelection ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- EditSelection aSel( pImpEditEngine->CreateSel( rSelection ) );
- return pImpEditEngine->GetScriptType( aSel );
-}
-
-LanguageType EditEngine::GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
- DBG_ASSERT( pNode, "GetLanguage - nPara is invalid!" );
- return pNode ? pImpEditEngine->GetLanguage( EditPaM( pNode, nPos ) ) : LANGUAGE_DONTKNOW;
-}
-
-
-void EditEngine::TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditEngine->TransliterateText( pImpEditEngine->CreateSel( rSelection ), nTransliterationMode );
-}
-
-void EditEngine::SetAsianCompressionMode( sal_uInt16 n )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditEngine->SetAsianCompressionMode( n );
-}
-
-sal_uInt16 EditEngine::GetAsianCompressionMode() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditEngine->GetAsianCompressionMode();
-}
-
-void EditEngine::SetKernAsianPunctuation( sal_Bool b )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditEngine->SetKernAsianPunctuation( b );
-}
-
-sal_Bool EditEngine::IsKernAsianPunctuation() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditEngine->IsKernAsianPunctuation();
-}
-
-void EditEngine::SetAddExtLeading( sal_Bool b )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetAddExtLeading( b );
-}
-
-sal_Bool EditEngine::IsAddExtLeading() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->IsAddExtLeading();
-}
-
-void EditEngine::SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- SetPolygon( rPolyPolygon, 0L );
-}
-
-void EditEngine::SetPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon)
-{
- DBG_CHKTHIS( EditEngine, 0 );
- sal_Bool bSimple(sal_False);
-
- if(pLinePolyPolygon && 1L == rPolyPolygon.count())
- {
- if(rPolyPolygon.getB2DPolygon(0L).isClosed())
- {
- // open polygon
- bSimple = sal_True;
- }
- }
-
- TextRanger* pRanger = new TextRanger( rPolyPolygon, pLinePolyPolygon, 30, 2, 2, bSimple, sal_True );
- pImpEditEngine->SetTextRanger( pRanger );
- pImpEditEngine->SetPaperSize( pRanger->GetBoundRect().GetSize() );
-}
-
-void EditEngine::ClearPolygon()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetTextRanger( 0 );
-}
-
-const PolyPolygon* EditEngine::GetPolygon()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetTextRanger() ?
- &pImpEditEngine->GetTextRanger()->GetPolyPolygon() : NULL;
-}
-
-const Size& EditEngine::GetMinAutoPaperSize() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetMinAutoPaperSize();
-}
-
-void EditEngine::SetMinAutoPaperSize( const Size& rSz )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetMinAutoPaperSize( rSz );
-}
-
-const Size& EditEngine::GetMaxAutoPaperSize() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetMaxAutoPaperSize();
-}
-
-void EditEngine::SetMaxAutoPaperSize( const Size& rSz )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetMaxAutoPaperSize( rSz );
-}
-
-XubString EditEngine::GetText( LineEnd eEnd ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetEditDoc().GetText( eEnd );
-}
-
-XubString EditEngine::GetText( const ESelection& rESelection, const LineEnd eEnd ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- EditSelection aSel( pImpEditEngine->CreateSel( rESelection ) );
- return pImpEditEngine->GetSelected( aSel, eEnd );
-}
-
-sal_uInt32 EditEngine::GetTextLen() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetEditDoc().GetTextLen();
-}
-
-sal_uInt16 EditEngine::GetParagraphCount() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->aEditDoc.Count();
-}
-
-sal_uInt16 EditEngine::GetLineCount( sal_uInt16 nParagraph ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
- return pImpEditEngine->GetLineCount( nParagraph );
-}
-
-sal_uInt16 EditEngine::GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
- return pImpEditEngine->GetLineLen( nParagraph, nLine );
-}
-
-void EditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
- return pImpEditEngine->GetLineBoundaries( rStart, rEnd, nParagraph, nLine );
-}
-
-sal_uInt16 EditEngine::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
- return pImpEditEngine->GetLineNumberAtIndex( nPara, nIndex );
-}
-
-sal_uInt32 EditEngine::GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- // If someone calls GetLineHeight() with an empty Engine.
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
- return pImpEditEngine->GetLineHeight( nParagraph, nLine );
-}
-
-sal_uInt16 EditEngine::GetFirstLineOffset( sal_uInt16 nParagraph )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
- ParaPortion* pPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nParagraph );
- return ( pPortion ? pPortion->GetFirstLineOffset() : 0 );
-}
-
-sal_uInt32 EditEngine::GetTextHeight( sal_uInt16 nParagraph ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
-
- sal_uInt32 nHeight = pImpEditEngine->GetParaHeight( nParagraph );
- return nHeight;
-}
-
-XubString EditEngine::GetWord( sal_uInt16 nPara, sal_uInt16 nIndex )
-{
- ESelection aESel( nPara, nIndex, nPara, nIndex );
- EditSelection aSel( pImpEditEngine->CreateSel( aESel ) );
- aSel = pImpEditEngine->SelectWord( aSel );
- return pImpEditEngine->GetSelected( aSel );
-}
-
-ESelection EditEngine::GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const
-{
- // ImpEditEngine-Iteration-Methods should be const!
- EditEngine* pE = (EditEngine*)this;
-
- EditSelection aSel( pE->pImpEditEngine->CreateSel( rSelection ) );
- aSel = pE->pImpEditEngine->SelectWord( aSel, nWordType );
- return pE->pImpEditEngine->CreateESel( aSel );
-}
-
-ESelection EditEngine::WordLeft( const ESelection& rSelection, sal_uInt16 nWordType ) const
-{
- // ImpEditEngine-Iteration-Methods should be const!
- EditEngine* pE = (EditEngine*)this;
-
- EditSelection aSel( pE->pImpEditEngine->CreateSel( rSelection ) );
- aSel = pE->pImpEditEngine->WordLeft( aSel.Min(), nWordType );
- return pE->pImpEditEngine->CreateESel( aSel );
-}
-
-ESelection EditEngine::WordRight( const ESelection& rSelection, sal_uInt16 nWordType ) const
-{
- // ImpEditEngine-Iteration-Methods should be const!
- EditEngine* pE = (EditEngine*)this;
-
- EditSelection aSel( pE->pImpEditEngine->CreateSel( rSelection ) );
- aSel = pE->pImpEditEngine->WordRight( aSel.Max(), nWordType );
- return pE->pImpEditEngine->CreateESel( aSel );
-}
-
-ESelection EditEngine::CursorLeft( const ESelection& rSelection, sal_uInt16 nCharacterIteratorMode ) const
-{
- // ImpEditEngine-Iteration-Methods should be const!
- EditEngine* pE = (EditEngine*)this;
-
- EditSelection aSel( pE->pImpEditEngine->CreateSel( rSelection ) );
- aSel = pE->pImpEditEngine->CursorLeft( aSel.Min(), nCharacterIteratorMode );
- return pE->pImpEditEngine->CreateESel( aSel );
-}
-
-ESelection EditEngine::CursorRight( const ESelection& rSelection, sal_uInt16 nCharacterIteratorMode ) const
-{
- // ImpEditEngine-Iteration-Methods should be const!
- EditEngine* pE = (EditEngine*)this;
-
- EditSelection aSel( pE->pImpEditEngine->CreateSel( rSelection ) );
- aSel = pE->pImpEditEngine->CursorRight( aSel.Max(), nCharacterIteratorMode );
- return pE->pImpEditEngine->CreateESel( aSel );
-}
-
-ESelection EditEngine::SelectSentence( const ESelection& rCurSel ) const
-{
- EditEngine* pE = (EditEngine*)this;
- EditSelection aCurSel( pE->pImpEditEngine->CreateSel( rCurSel ) );
- EditSelection aSentenceSel( pE->pImpEditEngine->SelectSentence( aCurSel ) );
- return pE->pImpEditEngine->CreateESel( aSentenceSel );
-}
-
-sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, Window* pFrameWin )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- DBG_CHKOBJ( pEditView, EditView, 0 );
- DBG_ASSERT( pEditView, "no View - no cookie !" );
-
- sal_Bool bDone = sal_True;
-
- sal_Bool bModified = sal_False;
- sal_Bool bMoved = sal_False;
- sal_Bool bAllowIdle = sal_True;
- sal_Bool bReadOnly = pEditView->IsReadOnly();
-
- sal_uInt16 nNewCursorFlags = 0;
- sal_Bool bSetCursorFlags = sal_True;
-
- EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() );
- DBG_ASSERT( !aCurSel.IsInvalid(), "Blinde Selection in EditEngine::PostKeyEvent" );
-
- String aAutoText( pImpEditEngine->GetAutoCompleteText() );
- if ( pImpEditEngine->GetAutoCompleteText().Len() )
- pImpEditEngine->SetAutoCompleteText( String(), sal_True );
-
- sal_uInt16 nCode = rKeyEvent.GetKeyCode().GetCode();
- KeyFuncType eFunc = rKeyEvent.GetKeyCode().GetFunction();
- if ( eFunc != KEYFUNC_DONTKNOW )
- {
- switch ( eFunc )
- {
- case KEYFUNC_UNDO:
- {
- if ( !bReadOnly )
- pEditView->Undo();
- return sal_True;
- }
- // break;
- case KEYFUNC_REDO:
- {
- if ( !bReadOnly )
- pEditView->Redo();
- return sal_True;
- }
- // break;
-
- default: // is then possible edited below.
- eFunc = KEYFUNC_DONTKNOW;
- }
- }
-
- pImpEditEngine->EnterBlockNotifications();
-
- if ( GetNotifyHdl().IsSet() )
- {
- EENotify aNotify( EE_NOTIFY_INPUT_START );
- aNotify.pEditEngine = this;
- pImpEditEngine->CallNotify( aNotify );
- }
-
- if ( eFunc == KEYFUNC_DONTKNOW )
- {
- switch ( nCode )
- {
- #if defined( DBG_UTIL ) || (OSL_DEBUG_LEVEL > 1)
- case KEY_F1:
- {
- if ( rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() )
- {
- sal_uInt16 nParas = GetParagraphCount();
- Point aPos;
- Point aViewStart( pEditView->GetOutputArea().TopLeft() );
- long n20 = 40 * pImpEditEngine->nOnePixelInRef;
- for ( sal_uInt16 n = 0; n < nParas; n++ )
- {
- long nH = GetTextHeight( n );
- Point P1( aViewStart.X() + n20 + n20*(n%2), aViewStart.Y() + aPos.Y() );
- Point P2( P1 );
- P2.X() += n20;
- P2.Y() += nH;
- pEditView->GetWindow()->SetLineColor();
- pEditView->GetWindow()->SetFillColor( Color( (n%2) ? COL_YELLOW : COL_LIGHTGREEN ) );
- pEditView->GetWindow()->DrawRect( Rectangle( P1, P2 ) );
- aPos.Y() += nH;
- }
- }
- bDone = sal_False;
- }
- break;
- case KEY_F11:
- {
- if ( rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() )
- {
- bDebugPaint = !bDebugPaint;
- ByteString aInfo( "DebugPaint: " );
- aInfo += bDebugPaint ? "On" : "Off";
- InfoBox( NULL, String( aInfo, RTL_TEXTENCODING_ASCII_US ) ).Execute();
- }
- bDone = sal_False;
- }
- break;
- case KEY_F12:
- {
- if ( rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() )
- {
- EditDbg::ShowEditEngineData( this );
- }
- bDone = sal_False;
- }
- break;
- #endif
- case KEY_UP:
- case KEY_DOWN:
- case KEY_LEFT:
- case KEY_RIGHT:
- case KEY_HOME:
- case KEY_END:
- case KEY_PAGEUP:
- case KEY_PAGEDOWN:
- case com::sun::star::awt::Key::MOVE_WORD_FORWARD:
- case com::sun::star::awt::Key::SELECT_WORD_FORWARD:
- case com::sun::star::awt::Key::MOVE_WORD_BACKWARD:
- case com::sun::star::awt::Key::SELECT_WORD_BACKWARD:
- case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE:
- case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE:
- case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE:
- case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE:
- case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH:
- case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH:
- case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH:
- case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH:
- case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT:
- case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT:
- case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT:
- case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT:
- {
- if ( !rKeyEvent.GetKeyCode().IsMod2() || ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) )
- {
- if ( pImpEditEngine->DoVisualCursorTraveling( aCurSel.Max().GetNode() ) && ( ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) /* || ( nCode == KEY_HOME ) || ( nCode == KEY_END ) */ ) )
- bSetCursorFlags = sal_False; // Will be manipulated within visual cursor move
-
- aCurSel = pImpEditEngine->MoveCursor( rKeyEvent, pEditView );
-
- if ( aCurSel.HasRange() ) {
- Reference<com::sun::star::datatransfer::clipboard::XClipboard> aSelection(pEditView->GetWindow()->GetPrimarySelection());
- pEditView->pImpEditView->CutCopy( aSelection, sal_False );
- }
-
- bMoved = sal_True;
- if ( nCode == KEY_HOME )
- nNewCursorFlags |= GETCRSR_STARTOFLINE;
- else if ( nCode == KEY_END )
- nNewCursorFlags |= GETCRSR_ENDOFLINE;
-
- }
-#if OSL_DEBUG_LEVEL > 1
- GetLanguage( pImpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() ), aCurSel.Max().GetIndex() );
-#endif
- }
- break;
- case KEY_BACKSPACE:
- case KEY_DELETE:
- case com::sun::star::awt::Key::DELETE_WORD_BACKWARD:
- case com::sun::star::awt::Key::DELETE_WORD_FORWARD:
- case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_PARAGRAPH:
- case com::sun::star::awt::Key::DELETE_TO_END_OF_PARAGRAPH:
- {
- if ( !bReadOnly && !rKeyEvent.GetKeyCode().IsMod2() )
- {
- // check if we are behind a bullet and using the backspace key
- ContentNode *pNode = aCurSel.Min().GetNode();
- const SvxNumberFormat *pFmt = pImpEditEngine->GetNumberFormat( pNode );
- if (pFmt && nCode == KEY_BACKSPACE &&
- !aCurSel.HasRange() && aCurSel.Min().GetIndex() == 0)
- {
- // if the bullet is still visible just do not paint it from
- // now on and that will be all. Otherwise continue as usual.
- // ...
-
- sal_uInt16 nPara = pImpEditEngine->GetEditDoc().GetPos( pNode );
- SfxBoolItem aBulletState( (const SfxBoolItem&) pImpEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ) );
- bool bBulletIsVisible = aBulletState.GetValue() ? true : false;
-
- // just toggling EE_PARA_BULLETSTATE should be fine for both cases...
- aBulletState.SetValue( !bBulletIsVisible );
- SfxItemSet aSet( pImpEditEngine->GetParaAttribs( nPara ) );
- aSet.Put( aBulletState );
- pImpEditEngine->SetParaAttribs( nPara, aSet );
-
- // have this and the following paragraphs formatted and repainted.
- // (not painting a numbering in the list may cause the following
- // numberings to have different numbers than before and thus the
- // length may have changed as well )
- pImpEditEngine->FormatAndUpdate( pImpEditEngine->GetActiveView() );
-
- if (bBulletIsVisible) // bullet just turned invisible...
- break;
- }
-
- sal_uInt8 nDel = 0, nMode = 0;
- switch( nCode )
- {
- case com::sun::star::awt::Key::DELETE_WORD_BACKWARD:
- nMode = DELMODE_RESTOFWORD;
- nDel = DEL_LEFT;
- break;
- case com::sun::star::awt::Key::DELETE_WORD_FORWARD:
- nMode = DELMODE_RESTOFWORD;
- nDel = DEL_RIGHT;
- break;
- case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_PARAGRAPH:
- nMode = DELMODE_RESTOFCONTENT;
- nDel = DEL_LEFT;
- break;
- case com::sun::star::awt::Key::DELETE_TO_END_OF_PARAGRAPH:
- nMode = DELMODE_RESTOFCONTENT;
- nDel = DEL_RIGHT;
- break;
- default:
- nDel = ( nCode == KEY_DELETE ) ? DEL_RIGHT : DEL_LEFT;
- nMode = rKeyEvent.GetKeyCode().IsMod1() ? DELMODE_RESTOFWORD : DELMODE_SIMPLE;
- if ( ( nMode == DELMODE_RESTOFWORD ) && rKeyEvent.GetKeyCode().IsShift() )
- nMode = DELMODE_RESTOFCONTENT;
- break;
- }
-
- pEditView->pImpEditView->DrawSelection();
- pImpEditEngine->UndoActionStart( EDITUNDO_DELETE );
- aCurSel = pImpEditEngine->DeleteLeftOrRight( aCurSel, nDel, nMode );
- pImpEditEngine->UndoActionEnd( EDITUNDO_DELETE );
- bModified = sal_True;
- bAllowIdle = sal_False;
- }
- }
- break;
- case KEY_TAB:
- {
- if ( !bReadOnly && !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() )
- {
- sal_Bool bShift = rKeyEvent.GetKeyCode().IsShift();
- if ( pImpEditEngine->GetStatus().DoTabIndenting() &&
- ( aCurSel.Min().GetNode() != aCurSel.Max().GetNode() ) )
- {
- pImpEditEngine->IndentBlock( pEditView, !bShift );
- }
- else if ( !bShift )
- {
- sal_Bool bSel = pEditView->HasSelection();
- if ( bSel )
- pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
- if ( pImpEditEngine->GetStatus().DoAutoCorrect() )
- aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode(), pFrameWin );
- aCurSel = pImpEditEngine->InsertTab( aCurSel );
- if ( bSel )
- pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
- bModified = sal_True;
- }
- }
- else
- bDone = sal_False;
- }
- break;
- case KEY_RETURN:
- {
- if ( !bReadOnly )
- {
- pEditView->pImpEditView->DrawSelection();
- if ( !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() )
- {
- pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
- if ( rKeyEvent.GetKeyCode().IsShift() )
- {
- aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode(), pFrameWin );
- aCurSel = pImpEditEngine->InsertLineBreak( aCurSel );
- }
- else
- {
- if ( !aAutoText.Len() )
- {
- if ( pImpEditEngine->GetStatus().DoAutoCorrect() )
- aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode(), pFrameWin );
- aCurSel = pImpEditEngine->InsertParaBreak( aCurSel );
- }
- else
- {
- DBG_ASSERT( !aCurSel.HasRange(), "Selektion bei Complete?!" );
- EditPaM aStart( pImpEditEngine->WordLeft( aCurSel.Max() ) );
- aCurSel = pImpEditEngine->InsertText(
- EditSelection( aStart, aCurSel.Max() ), aAutoText );
- pImpEditEngine->SetAutoCompleteText( String(), sal_True );
- }
- }
- pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
- bModified = sal_True;
- }
- }
- }
- break;
- case KEY_INSERT:
- {
- if ( !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() )
- pEditView->SetInsertMode( !pEditView->IsInsertMode() );
- }
- break;
- default:
- {
- #if (OSL_DEBUG_LEVEL > 1) && defined(DBG_UTIL)
- if ( ( nCode == KEY_W ) && rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() )
- {
- SfxItemSet aAttribs = pEditView->GetAttribs();
- const SvxFrameDirectionItem& rCurrentWritingMode = (const SvxFrameDirectionItem&)aAttribs.Get( EE_PARA_WRITINGDIR );
- SvxFrameDirectionItem aNewItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR );
- if ( rCurrentWritingMode.GetValue() != FRMDIR_HORI_RIGHT_TOP )
- aNewItem.SetValue( FRMDIR_HORI_RIGHT_TOP );
- aAttribs.Put( aNewItem );
- pEditView->SetAttribs( aAttribs );
- }
- #endif
- if ( !bReadOnly && IsSimpleCharInput( rKeyEvent ) )
- {
- xub_Unicode nCharCode = rKeyEvent.GetCharCode();
- pEditView->pImpEditView->DrawSelection();
- // Autocorrection?
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
- if ( ( pImpEditEngine->GetStatus().DoAutoCorrect() ) &&
- ( SvxAutoCorrect::IsAutoCorrectChar( nCharCode ) ||
- pAutoCorrect->HasRunNext() ) )
- {
- aCurSel = pImpEditEngine->AutoCorrect(
- aCurSel, nCharCode, !pEditView->IsInsertMode(), pFrameWin );
- }
- else
- {
- aCurSel = pImpEditEngine->InsertText( (const EditSelection&)aCurSel, nCharCode, !pEditView->IsInsertMode(), sal_True );
- }
- // AutoComplete ???
- if ( pImpEditEngine->GetStatus().DoAutoComplete() && ( nCharCode != ' ' ) )
- {
- // 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 ) )
- {
- EditPaM aStart( pImpEditEngine->WordLeft( aCurSel.Max() ) );
- String aWord = pImpEditEngine->GetSelected( EditSelection( aStart, aCurSel.Max() ) );
- if ( aWord.Len() >= 3 )
- {
- String aComplete;
-
- LanguageType eLang = pImpEditEngine->GetLanguage( EditPaM( aStart.GetNode(), aStart.GetIndex()+1));
- lang::Locale aLocale( MsLangId::convertLanguageToLocale( eLang));
-
- if (!pImpEditEngine->xLocaleDataWrapper.isInitialized())
- pImpEditEngine->xLocaleDataWrapper.init( SvtSysLocale().GetLocaleData().getServiceFactory(), aLocale, eLang);
- else
- pImpEditEngine->xLocaleDataWrapper.changeLocale( aLocale, eLang);
-
- if (!pImpEditEngine->xTransliterationWrapper.isInitialized())
- pImpEditEngine->xTransliterationWrapper.init( SvtSysLocale().GetLocaleData().getServiceFactory(), eLang, i18n::TransliterationModules_IGNORE_CASE);
- else
- pImpEditEngine->xTransliterationWrapper.changeLocale( eLang);
-
- const ::utl::TransliterationWrapper* pTransliteration = pImpEditEngine->xTransliterationWrapper.get();
- Sequence< i18n::CalendarItem > xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarDays();
- sal_Int32 nCount = xItem.getLength();
- const i18n::CalendarItem* pArr = xItem.getArray();
- for( sal_Int32 n = 0; n <= nCount; ++n )
- {
- const ::rtl::OUString& rDay = pArr[n].FullName;
- if( pTransliteration->isMatch( aWord, rDay) )
- {
- aComplete = rDay;
- break;
- }
- }
-
- if ( !aComplete.Len() )
- {
- xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarMonths();
- sal_Int32 nMonthCount = xItem.getLength();
- const i18n::CalendarItem* pMonthArr = xItem.getArray();
- for( sal_Int32 n = 0; n <= nMonthCount; ++n )
- {
- const ::rtl::OUString& rMon = pMonthArr[n].FullName;
- if( pTransliteration->isMatch( aWord, rMon) )
- {
- aComplete = rMon;
- break;
- }
- }
- }
-
- if( aComplete.Len() && ( ( aWord.Len() + 1 ) < aComplete.Len() ) )
- {
- pImpEditEngine->SetAutoCompleteText( aComplete, sal_False );
- Point aPos = pImpEditEngine->PaMtoEditCursor( aCurSel.Max() ).TopLeft();
- aPos = pEditView->pImpEditView->GetWindowPos( aPos );
- aPos = pEditView->pImpEditView->GetWindow()->LogicToPixel( aPos );
- aPos = pEditView->GetWindow()->OutputToScreenPixel( aPos );
- aPos.Y() -= 3;
- Help::ShowQuickHelp( pEditView->GetWindow(), Rectangle( aPos, Size( 1, 1 ) ), aComplete, QUICKHELP_BOTTOM|QUICKHELP_LEFT );
- }
- }
- }
- }
- bModified = sal_True;
- }
- else
- bDone = sal_False;
- }
- }
- }
-
- pEditView->pImpEditView->SetEditSelection( aCurSel );
- pImpEditEngine->UpdateSelections();
-
- if ( ( !IsVertical() && ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) ) ||
- ( IsVertical() && ( nCode != KEY_LEFT ) && ( nCode != KEY_RIGHT ) ))
- {
- pEditView->pImpEditView->nTravelXPos = TRAVEL_X_DONTKNOW;
- }
-
- if ( /* ( nCode != KEY_HOME ) && ( nCode != KEY_END ) && */
- ( !IsVertical() && ( nCode != KEY_LEFT ) && ( nCode != KEY_RIGHT ) ) ||
- ( IsVertical() && ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) ))
- {
- pEditView->pImpEditView->SetCursorBidiLevel( 0xFFFF );
- }
-
- if ( bSetCursorFlags )
- pEditView->pImpEditView->nExtraCursorFlags = nNewCursorFlags;
-
- if ( bModified )
- {
- DBG_ASSERT( !bReadOnly, "ReadOnly but modified???" );
- // Idle-Formatter only when AnyInput.
- if ( bAllowIdle && pImpEditEngine->GetStatus().UseIdleFormatter()
- && Application::AnyInput( INPUT_KEYBOARD) )
- pImpEditEngine->IdleFormatAndUpdate( pEditView );
- else
- pImpEditEngine->FormatAndUpdate( pEditView );
- }
- else if ( bMoved )
- {
- sal_Bool bGotoCursor = pEditView->pImpEditView->DoAutoScroll();
- pEditView->pImpEditView->ShowCursor( bGotoCursor, sal_True );
- pImpEditEngine->CallStatusHdl();
- }
-
- if ( GetNotifyHdl().IsSet() )
- {
- EENotify aNotify( EE_NOTIFY_INPUT_END );
- aNotify.pEditEngine = this;
- pImpEditEngine->CallNotify( aNotify );
- }
-
- pImpEditEngine->LeaveBlockNotifications();
-
- return bDone;
-}
-
-sal_uInt32 EditEngine::GetTextHeight() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
-
- sal_uInt32 nHeight = !IsVertical() ? pImpEditEngine->GetTextHeight() : pImpEditEngine->CalcTextWidth( sal_True );
- return nHeight;
-}
-
-sal_uInt32 EditEngine::GetTextHeightNTP() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
-
- if ( IsVertical() )
- return pImpEditEngine->CalcTextWidth( sal_True );
-
- return pImpEditEngine->GetTextHeightNTP();
-}
-
-sal_uInt32 EditEngine::CalcTextWidth()
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
-
- sal_uInt32 nWidth = !IsVertical() ? pImpEditEngine->CalcTextWidth( sal_True ) : pImpEditEngine->GetTextHeight();
- return nWidth;
-}
-
-void EditEngine::SetUpdateMode( sal_Bool bUpdate )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetUpdateMode( bUpdate );
- if ( pImpEditEngine->pActiveView )
- pImpEditEngine->pActiveView->ShowCursor( sal_False, sal_False );
-}
-
-sal_Bool EditEngine::GetUpdateMode() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetUpdateMode();
-}
-
-void EditEngine::Clear()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->Clear();
-}
-
-void EditEngine::SetText( const XubString& rText )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetText( rText );
- if ( rText.Len() )
- pImpEditEngine->FormatAndUpdate();
-}
-
-sal_uLong EditEngine::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs /* = NULL */ )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- sal_Bool bUndoEnabled = pImpEditEngine->IsUndoEnabled();
- pImpEditEngine->EnableUndo( sal_False );
- pImpEditEngine->SetText( XubString() );
- EditPaM aPaM( pImpEditEngine->GetEditDoc().GetStartPaM() );
- pImpEditEngine->Read( rInput, rBaseURL, eFormat, EditSelection( aPaM, aPaM ), pHTTPHeaderAttrs );
- pImpEditEngine->EnableUndo( bUndoEnabled );
- return rInput.GetError();
-}
-
-sal_uLong EditEngine::Write( SvStream& rOutput, EETextFormat eFormat )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- EditPaM aStartPaM( pImpEditEngine->GetEditDoc().GetStartPaM() );
- EditPaM aEndPaM( pImpEditEngine->GetEditDoc().GetEndPaM() );
- pImpEditEngine->Write( rOutput, eFormat, EditSelection( aStartPaM, aEndPaM ) );
- return rOutput.GetError();
-}
-
-EditTextObject* EditEngine::CreateTextObject()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->CreateTextObject();
-}
-
-EditTextObject* EditEngine::CreateTextObject( const ESelection& rESelection )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- EditSelection aSel( pImpEditEngine->CreateSel( rESelection ) );
- return pImpEditEngine->CreateTextObject( aSel );
-}
-
-void EditEngine::SetText( const EditTextObject& rTextObject )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->EnterBlockNotifications();
- pImpEditEngine->SetText( rTextObject );
- pImpEditEngine->FormatAndUpdate();
- pImpEditEngine->LeaveBlockNotifications();
-}
-
-void EditEngine::ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->ShowParagraph( nParagraph, bShow );
-}
-
-sal_Bool EditEngine::IsParagraphVisible( sal_uInt16 nParagraph )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->IsParagraphVisible( nParagraph );
-}
-
-void EditEngine::SetNotifyHdl( const Link& rLink )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetNotifyHdl( rLink );
-}
-
-Link EditEngine::GetNotifyHdl() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetNotifyHdl();
-}
-
-void EditEngine::SetStatusEventHdl( const Link& rLink )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetStatusEventHdl( rLink );
-}
-
-Link EditEngine::GetStatusEventHdl() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetStatusEventHdl();
-}
-
-void EditEngine::SetImportHdl( const Link& rLink )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->aImportHdl = rLink;
-}
-
-Link EditEngine::GetImportHdl() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->aImportHdl;
-}
-
-void EditEngine::SetBeginMovingParagraphsHdl( const Link& rLink )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->aBeginMovingParagraphsHdl = rLink;
-}
-
-void EditEngine::SetEndMovingParagraphsHdl( const Link& rLink )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->aEndMovingParagraphsHdl = rLink;
-}
-
-void EditEngine::SetBeginPasteOrDropHdl( const Link& rLink )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- pImpEditEngine->aBeginPasteOrDropHdl = rLink;
-}
-
-void EditEngine::SetEndPasteOrDropHdl( const Link& rLink )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->aEndPasteOrDropHdl = rLink;
-}
-
-EditTextObject* EditEngine::CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- DBG_ASSERT( nPara < pImpEditEngine->GetEditDoc().Count(), "CreateTextObject: Startpara out of Range" );
- DBG_ASSERT( nPara+nParas-1 < pImpEditEngine->GetEditDoc().Count(), "CreateTextObject: Endpara out of Range" );
-
- ContentNode* pStartNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
- ContentNode* pEndNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara+nParas-1 );
- DBG_ASSERT( pStartNode, "Start-Paragraph does not exist: CreateTextObject" );
- DBG_ASSERT( pEndNode, "End-Paragraph does not exist: CreateTextObject" );
-
- if ( pStartNode && pEndNode )
- {
- EditSelection aTmpSel;
- aTmpSel.Min() = EditPaM( pStartNode, 0 );
- aTmpSel.Max() = EditPaM( pEndNode, pEndNode->Len() );
- return pImpEditEngine->CreateTextObject( aTmpSel );
- }
- return 0;
-}
-
-void EditEngine::RemoveParagraph( sal_uInt16 nPara )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- 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, "Paragraph not found: RemoveParagraph" );
- if ( pNode && pPortion )
- {
- // No Undo encapsulation needed.
- pImpEditEngine->ImpRemoveParagraph( nPara );
- pImpEditEngine->InvalidateFromParagraph( nPara );
- pImpEditEngine->UpdateSelections();
- pImpEditEngine->FormatAndUpdate();
- }
-}
-
-sal_uInt16 EditEngine::GetTextLen( sal_uInt16 nPara ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
- DBG_ASSERT( pNode, "Paragraph not found: GetTextLen" );
- if ( pNode )
- return pNode->Len();
- return 0;
-}
-
-XubString EditEngine::GetText( sal_uInt16 nPara ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- XubString aStr;
- if ( nPara < pImpEditEngine->GetEditDoc().Count() )
- aStr = pImpEditEngine->GetEditDoc().GetParaAsString( nPara );
- return aStr;
-}
-
-void EditEngine::SetModifyHdl( const Link& rLink )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetModifyHdl( rLink );
-}
-
-Link EditEngine::GetModifyHdl() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetModifyHdl();
-}
-
-
-void EditEngine::ClearModifyFlag()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetModifyFlag( sal_False );
-}
-
-void EditEngine::SetModified()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetModifyFlag( sal_True );
-}
-
-sal_Bool EditEngine::IsModified() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->IsModified();
-}
-
-sal_Bool EditEngine::IsInSelectionMode() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return ( pImpEditEngine->IsInSelectionMode() ||
- pImpEditEngine->GetSelEngine().IsInSelection() );
-}
-
-void EditEngine::StopSelectionMode()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->StopSelectionMode();
-}
-
-void EditEngine::InsertParagraph( sal_uInt16 nPara, const EditTextObject& rTxtObj )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( nPara > GetParagraphCount() )
- {
- DBG_ASSERTWARNING( nPara == USHRT_MAX, "Paragraph number to large, but not LIST_APPEND!" );
- nPara = GetParagraphCount();
- }
-
- pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
-
- // No Undo componding needed.
- EditPaM aPaM( pImpEditEngine->InsertParagraph( nPara ) );
- // When InsertParagraph from the outside, no hard attributes
- // should be taken over!
- pImpEditEngine->RemoveCharAttribs( nPara );
- pImpEditEngine->InsertText( rTxtObj, EditSelection( aPaM, aPaM ) );
-
- pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
-
- pImpEditEngine->FormatAndUpdate();
-}
-
-void EditEngine::InsertParagraph( sal_uInt16 nPara, const XubString& rTxt )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( nPara > GetParagraphCount() )
- {
- DBG_ASSERTWARNING( nPara == USHRT_MAX, "Paragraph number to large, but not LIST_APPEND!" );
- nPara = GetParagraphCount();
- }
-
- pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
- EditPaM aPaM( pImpEditEngine->InsertParagraph( nPara ) );
- // 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 );
- pImpEditEngine->FormatAndUpdate();
-}
-
-void EditEngine::SetText( sal_uInt16 nPara, const EditTextObject& rTxtObj )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- EditSelection* pSel = pImpEditEngine->SelectParagraph( nPara );
- if ( pSel )
- {
- pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
- pImpEditEngine->InsertText( rTxtObj, *pSel );
- pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
- pImpEditEngine->FormatAndUpdate();
- delete pSel;
- }
-}
-
-void EditEngine::SetText( sal_uInt16 nPara, const XubString& rTxt )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- EditSelection* pSel = pImpEditEngine->SelectParagraph( nPara );
- if ( pSel )
- {
- pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
- pImpEditEngine->ImpInsertText( *pSel, rTxt );
- pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
- pImpEditEngine->FormatAndUpdate();
- delete pSel;
- }
-}
-
-void EditEngine::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetParaAttribs( nPara, rSet );
- pImpEditEngine->FormatAndUpdate();
-}
-
-const SfxItemSet& EditEngine::GetParaAttribs( sal_uInt16 nPara ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetParaAttribs( nPara );
-}
-
-sal_Bool EditEngine::HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->HasParaAttrib( nPara, nWhich );
-}
-
-const SfxPoolItem& EditEngine::GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetParaAttrib( nPara, nWhich );
-}
-
-void EditEngine::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->GetCharAttribs( nPara, rLst );
-}
-
-SfxItemSet EditEngine::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- EditSelection aSel( pImpEditEngine->
- ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
- return pImpEditEngine->GetAttribs( aSel, bOnlyHardAttrib );
-}
-
-SfxItemSet EditEngine::GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetAttribs( nPara, nStart, nEnd, nFlags );
-}
-
-void EditEngine::RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- pImpEditEngine->UndoActionStart( EDITUNDO_RESETATTRIBS );
- EditSelection aSel( pImpEditEngine->ConvertSelection( rSelection.nStartPara, rSelection.nStartPos, rSelection.nEndPara, rSelection.nEndPos ) );
- pImpEditEngine->RemoveCharAttribs( aSel, bRemoveParaAttribs, nWhich );
- pImpEditEngine->UndoActionEnd( EDITUNDO_RESETATTRIBS );
- pImpEditEngine->FormatAndUpdate();
-}
-
-Font EditEngine::GetStandardFont( sal_uInt16 nPara )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return GetStandardSvxFont( nPara );
-}
-
-SvxFont EditEngine::GetStandardSvxFont( sal_uInt16 nPara )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
- return pNode->GetCharAttribs().GetDefFont();
-}
-
-void EditEngine::StripPortions()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- VirtualDevice aTmpDev;
- Rectangle aBigRec( Point( 0, 0 ), Size( 0x7FFFFFFF, 0x7FFFFFFF ) );
- if ( IsVertical() )
- {
- aBigRec.Right() = 0;
- aBigRec.Left() = -0x7FFFFFFF;
- }
- pImpEditEngine->Paint( &aTmpDev, aBigRec, Point(), sal_True );
-}
-
-void EditEngine::GetPortions( sal_uInt16 nPara, SvUShorts& rList )
-{
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatFullDoc();
-
- ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
- if ( pParaPortion )
- {
- sal_uInt16 nEnd = 0;
- sal_uInt16 nTextPortions = pParaPortion->GetTextPortions().Count();
- for ( sal_uInt16 n = 0; n < nTextPortions; n++ )
- {
- nEnd = nEnd + pParaPortion->GetTextPortions()[n]->GetLen();
- rList.Insert( nEnd, rList.Count() );
- }
- }
-}
-
-void EditEngine::SetFlatMode( sal_Bool bFlat)
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetFlatMode( bFlat );
-}
-
-sal_Bool EditEngine::IsFlatMode() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return !( pImpEditEngine->aStatus.UseCharAttribs() );
-}
-
-void EditEngine::SetControlWord( sal_uInt32 nWord )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- if ( nWord != pImpEditEngine->aStatus.GetControlWord() )
- {
- sal_uInt32 nPrev = pImpEditEngine->aStatus.GetControlWord();
- pImpEditEngine->aStatus.GetControlWord() = nWord;
-
- sal_uInt32 nChanges = nPrev ^ nWord;
- if ( pImpEditEngine->IsFormatted() )
- {
- // possibly reformat:
- if ( ( nChanges & EE_CNTRL_USECHARATTRIBS ) ||
- ( nChanges & EE_CNTRL_USEPARAATTRIBS ) ||
- ( nChanges & EE_CNTRL_ONECHARPERLINE ) ||
- ( nChanges & EE_CNTRL_STRETCHING ) ||
- ( nChanges & EE_CNTRL_OUTLINER ) ||
- ( nChanges & EE_CNTRL_NOCOLORS ) ||
- ( nChanges & EE_CNTRL_OUTLINER2 ) )
- {
- if ( ( nChanges & EE_CNTRL_USECHARATTRIBS ) ||
- ( nChanges & EE_CNTRL_USEPARAATTRIBS ) )
- {
- sal_Bool bUseCharAttribs = ( nWord & EE_CNTRL_USECHARATTRIBS ) ? sal_True : sal_False;
- pImpEditEngine->GetEditDoc().CreateDefFont( bUseCharAttribs );
- }
-
- pImpEditEngine->FormatFullDoc();
- pImpEditEngine->UpdateViews( pImpEditEngine->GetActiveView() );
- }
- }
-
- sal_Bool bSpellingChanged = nChanges & EE_CNTRL_ONLINESPELLING ? sal_True : sal_False;
-
- if ( bSpellingChanged )
- {
- pImpEditEngine->StopOnlineSpellTimer();
- if ( bSpellingChanged && ( nWord & EE_CNTRL_ONLINESPELLING ) )
- {
- // 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();
- }
- if (pImpEditEngine->IsFormatted())
- pImpEditEngine->StartOnlineSpellTimer();
- }
- else
- {
- long nY = 0;
- sal_uInt16 nNodes = pImpEditEngine->GetEditDoc().Count();
- for ( sal_uInt16 n = 0; n < nNodes; n++ )
- {
- 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 )
- pNode->DestroyWrongList();
- if ( bWrongs )
- {
- pImpEditEngine->aInvalidRec.Left() = 0;
- pImpEditEngine->aInvalidRec.Right() = pImpEditEngine->GetPaperSize().Width();
- pImpEditEngine->aInvalidRec.Top() = nY+1;
- pImpEditEngine->aInvalidRec.Bottom() = nY+pPortion->GetHeight()-1;
- pImpEditEngine->UpdateViews( pImpEditEngine->pActiveView );
- }
- nY += pPortion->GetHeight();
- }
- }
- }
- }
-}
-
-sal_uInt32 EditEngine::GetControlWord() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->aStatus.GetControlWord();
-}
-
-long EditEngine::GetFirstLineStartX( sal_uInt16 nParagraph )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- long nX = 0;
- ParaPortion* pPPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nParagraph );
- if ( pPPortion )
- {
- DBG_ASSERT( pImpEditEngine->IsFormatted() || !pImpEditEngine->IsFormatting(), "GetFirstLineStartX: Doc not formatted - unable to format!" );
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
- EditLine* pFirstLine = pPPortion->GetLines()[0];
- nX = pFirstLine->GetStartPosX();
- }
- return nX;
-}
-
-Point EditEngine::GetDocPos( const Point& rPaperPos ) const
-{
- Point aDocPos( rPaperPos );
- if ( IsVertical() )
- {
- aDocPos.X() = rPaperPos.Y();
- aDocPos.Y() = GetPaperSize().Width() - rPaperPos.X();
- }
- return aDocPos;
-}
-
-Point EditEngine::GetDocPosTopLeft( sal_uInt16 nParagraph )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- ParaPortion* pPPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nParagraph );
- DBG_ASSERT( pPPortion, "Paragraph not found: GetWindowPosTopLeft" );
- Point aPoint;
- if ( pPPortion )
- {
-
- // 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() )
- {
- // Correct it if large Bullet.
- EditLine* pFirstLine = pPPortion->GetLines()[0];
- aPoint.X() = pFirstLine->GetStartPosX();
- }
- else
- {
- const SvxLRSpaceItem& rLRItem = pImpEditEngine->GetLRSpaceItem( pPPortion->GetNode() );
-// TL_NF_LR aPoint.X() = pImpEditEngine->GetXValue( (short)(rLRItem.GetTxtLeft() + rLRItem.GetTxtFirstLineOfst()) );
- sal_Int32 nSpaceBefore = 0;
- pImpEditEngine->GetSpaceBeforeAndMinLabelWidth( pPPortion->GetNode(), &nSpaceBefore );
- short nX = (short)(rLRItem.GetTxtLeft()
- + rLRItem.GetTxtFirstLineOfst()
- + nSpaceBefore);
- aPoint.X() = pImpEditEngine->GetXValue( nX
- );
- }
- aPoint.Y() = pImpEditEngine->GetParaPortions().GetYOffset( pPPortion );
- }
- return aPoint;
-}
-
-const SvxNumberFormat* EditEngine::GetNumberFormat( sal_uInt16 nPara ) const
-{
- // derived objects may overload this function to give access to
- // bullet information (see Outliner)
- (void) nPara;
- return 0;
-}
-
-sal_Bool EditEngine::IsRightToLeft( sal_uInt16 nPara ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->IsRightToLeft( nPara );
-}
-
-sal_Bool EditEngine::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
-
- sal_Bool bTextPos = sal_False;
- // take unrotated positions for calculation here
- Point aDocPos = GetDocPos( rPaperPos );
-
- if ( ( aDocPos.Y() > 0 ) && ( aDocPos.Y() < (long)pImpEditEngine->GetTextHeight() ) )
- {
- EditPaM aPaM = pImpEditEngine->GetPaM( aDocPos, sal_False );
- if ( aPaM.GetNode() )
- {
- ParaPortion* pParaPortion = pImpEditEngine->FindParaPortion( aPaM.GetNode() );
- DBG_ASSERT( pParaPortion, "ParaPortion?" );
-
- sal_uInt16 nLine = pParaPortion->GetLineNumber( aPaM.GetIndex() );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
- Range aLineXPosStartEnd = pImpEditEngine->GetLineXPosStartEnd( pParaPortion, pLine );
- if ( ( aDocPos.X() >= aLineXPosStartEnd.Min() - nBorder ) &&
- ( aDocPos.X() <= aLineXPosStartEnd.Max() + nBorder ) )
- {
- bTextPos = sal_True;
- }
- }
- }
- return bTextPos;
-}
-
-void EditEngine::SetEditTextObjectPool( SfxItemPool* pPool )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetEditTextObjectPool( pPool );
-}
-
-SfxItemPool* EditEngine::GetEditTextObjectPool() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetEditTextObjectPool();
-}
-
-void EditEngine::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- EditSelection aSel( pImpEditEngine->
- ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
-
- pImpEditEngine->SetAttribs( aSel, rSet );
-}
-
-void EditEngine::QuickMarkInvalid( const ESelection& rSel )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- DBG_ASSERT( rSel.nStartPara < pImpEditEngine->GetEditDoc().Count(), "MarkInvalid: Start out of Range!" );
- DBG_ASSERT( rSel.nEndPara < pImpEditEngine->GetEditDoc().Count(), "MarkInvalid: End out of Range!" );
- for ( sal_uInt16 nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++ )
- {
- ParaPortion* pPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
- if ( pPortion )
- pPortion->MarkSelectionInvalid( 0, pPortion->GetNode()->Len() );
- }
-}
-
-void EditEngine::QuickInsertText( const XubString& rText, const ESelection& rSel )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- EditSelection aSel( pImpEditEngine->
- ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
-
- pImpEditEngine->ImpInsertText( aSel, rText );
-}
-
-void EditEngine::QuickDelete( const ESelection& rSel )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- EditSelection aSel( pImpEditEngine->
- ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
-
- pImpEditEngine->ImpDeleteSelection( aSel );
-}
-
-void EditEngine::QuickMarkToBeRepainted( sal_uInt16 nPara )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- ParaPortion* pPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
- if ( pPortion )
- pPortion->SetMustRepaint( sal_True );
-}
-
-void EditEngine::QuickInsertLineBreak( const ESelection& rSel )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- EditSelection aSel( pImpEditEngine->
- ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
-
- pImpEditEngine->InsertLineBreak( aSel );
-}
-
-void EditEngine::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- EditSelection aSel( pImpEditEngine->
- ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
-
- pImpEditEngine->ImpInsertFeature( aSel, rFld );
-}
-
-void EditEngine::QuickFormatDoc( sal_Bool bFull )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( bFull )
- pImpEditEngine->FormatFullDoc();
- else
- pImpEditEngine->FormatDoc();
-
- // Don't pass active view, maybe selection is not updated yet...
- pImpEditEngine->UpdateViews( NULL );
-}
-
-void EditEngine::QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->RemoveCharAttribs( nPara, nWhich );
-}
-
-void EditEngine::SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetStyleSheet( nPara, pStyle );
-}
-
-SfxStyleSheet* EditEngine::GetStyleSheet( sal_uInt16 nPara ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetStyleSheet( nPara );
-}
-
-void EditEngine::SetStyleSheetPool( SfxStyleSheetPool* pSPool )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetStyleSheetPool( pSPool );
-}
-
-SfxStyleSheetPool* EditEngine::GetStyleSheetPool()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetStyleSheetPool();
-}
-
-void EditEngine::SetWordDelimiters( const XubString& rDelimiters )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->aWordDelimiters = rDelimiters;
- if ( pImpEditEngine->aWordDelimiters.Search( CH_FEATURE ) == STRING_NOTFOUND )
- pImpEditEngine->aWordDelimiters.Insert( CH_FEATURE );
-}
-
-XubString EditEngine::GetWordDelimiters() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->aWordDelimiters;
-}
-
-void EditEngine::SetGroupChars( const XubString& rChars )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- DBG_ASSERT( ( rChars.Len() % 2 ) == 0, "SetGroupChars: Odd number!" );
- pImpEditEngine->aGroupChars = rChars;
-}
-
-XubString EditEngine::GetGroupChars() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->aGroupChars;
-}
-
-void EditEngine::EnablePasteSpecial( sal_Bool bEnable )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( bEnable )
- pImpEditEngine->GetStatus().TurnOnFlags( EE_CNTRL_PASTESPECIAL );
- else
- pImpEditEngine->GetStatus().TurnOffFlags( EE_CNTRL_PASTESPECIAL );
-}
-
-sal_Bool EditEngine::IsPasteSpecialEnabled() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetStatus().AllowPasteSpecial();
-}
-
-void EditEngine::EnableIdleFormatter( sal_Bool bEnable )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( bEnable )
- pImpEditEngine->GetStatus().TurnOnFlags( EE_CNTRL_DOIDLEFORMAT );
- else
- pImpEditEngine->GetStatus().TurnOffFlags( EE_CNTRL_DOIDLEFORMAT);
-}
-
-sal_Bool EditEngine::IsIdleFormatterEnabled() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetStatus().UseIdleFormatter();
-}
-
-void EditEngine::EraseVirtualDevice()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->EraseVirtualDevice();
-}
-
-void EditEngine::SetSpeller( Reference< XSpellChecker1 > &xSpeller )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetSpeller( xSpeller );
-}
-Reference< XSpellChecker1 > EditEngine::GetSpeller()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetSpeller();
-}
-Reference< XHyphenator > EditEngine::GetHyphenator() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetHyphenator();
-}
-
-void EditEngine::SetHyphenator( Reference< XHyphenator > & xHyph )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetHyphenator( xHyph );
-}
-
-void EditEngine::SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetForbiddenCharsTable( xForbiddenChars );
-}
-
-rtl::Reference<SvxForbiddenCharactersTable> EditEngine::GetForbiddenCharsTable() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetForbiddenCharsTable( sal_False );
-}
-
-
-void EditEngine::SetDefaultLanguage( LanguageType eLang )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetDefaultLanguage( eLang );
-}
-
-LanguageType EditEngine::GetDefaultLanguage() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetDefaultLanguage();
-}
-
-sal_Bool EditEngine::SpellNextDocument()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return sal_False;
-}
-
-EESpellState EditEngine::HasSpellErrors()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( !pImpEditEngine->GetSpeller().is() )
- return EE_SPELL_NOSPELLER;
-
- return pImpEditEngine->HasSpellErrors();
-}
-
-void EditEngine::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc)
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->StartSpelling(rEditView, bMultipleDoc);
-}
-
-void EditEngine::EndSpelling()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->EndSpelling();
-}
-
-bool EditEngine::SpellSentence(EditView& rView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->SpellSentence( rView, rToFill, bIsGrammarChecking );
-}
-
-void EditEngine::PutSpellingToSentenceStart( EditView& rEditView )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->PutSpellingToSentenceStart( rEditView );
-}
-
-void EditEngine::ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->ApplyChangedSentence( rEditView, rNewPortions, bRecheck );
-}
-
-sal_Bool EditEngine::HasConvertibleTextPortion( LanguageType nLang )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->HasConvertibleTextPortion( nLang );
-}
-
-sal_Bool EditEngine::ConvertNextDocument()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return sal_False;
-}
-
-sal_Bool EditEngine::HasText( const SvxSearchItem& rSearchItem )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->HasText( rSearchItem );
-}
-
-void EditEngine::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetCharStretching( nX, nY );
-}
-
-void EditEngine::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->GetCharStretching( rX, rY );
-}
-
-void EditEngine::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->DoStretchChars( nX, nY );
-}
-
-void EditEngine::SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- pImpEditEngine->SetBigTextObjectStart( nStartAtPortionCount );
-}
-
-sal_uInt16 EditEngine::GetBigTextObjectStart() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetBigTextObjectStart();
-}
-
-sal_Bool EditEngine::ShouldCreateBigTextObject() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- sal_uInt16 nTextPortions = 0;
- sal_uInt16 nParas = pImpEditEngine->GetEditDoc().Count();
- for ( sal_uInt16 nPara = 0; nPara < nParas; nPara++ )
- {
- ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions()[nPara];
- nTextPortions = nTextPortions + pParaPortion->GetTextPortions().Count();
- }
- return ( nTextPortions >= pImpEditEngine->GetBigTextObjectStart() ) ? sal_True : sal_False;
-}
-
-sal_uInt16 EditEngine::GetFieldCount( sal_uInt16 nPara ) const
-{
- sal_uInt16 nFields = 0;
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
- if ( pNode )
- {
- const CharAttribArray& rAttrs = pNode->GetCharAttribs().GetAttribs();
- for ( sal_uInt16 nAttr = 0; nAttr < rAttrs.Count(); nAttr++ )
- {
- EditCharAttrib* pAttr = rAttrs[nAttr];
- if ( pAttr->Which() == EE_FEATURE_FIELD )
- nFields++;
- }
- }
-
- return nFields;
-}
-
-EFieldInfo EditEngine::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const
-{
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
- if ( pNode )
- {
- sal_uInt16 nCurrentField = 0;
- const CharAttribArray& rAttrs = pNode->GetCharAttribs().GetAttribs();
- for ( sal_uInt16 nAttr = 0; nAttr < rAttrs.Count(); nAttr++ )
- {
- EditCharAttrib* pAttr = rAttrs[nAttr];
- if ( pAttr->Which() == EE_FEATURE_FIELD )
- {
- if ( nCurrentField == nField )
- {
- EFieldInfo aInfo( *(const SvxFieldItem*)pAttr->GetItem(), nPara, pAttr->GetStart() );
- aInfo.aCurrentText = ((EditCharAttribField*)pAttr)->GetFieldValue();
- return aInfo;
- }
-
- nCurrentField++;
- }
- }
- }
- return EFieldInfo();
-}
-
-
-sal_Bool EditEngine::UpdateFields()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- sal_Bool bChanges = pImpEditEngine->UpdateFields();
- if ( bChanges )
- pImpEditEngine->FormatAndUpdate();
- return bChanges;
-}
-
-void EditEngine::RemoveFields( sal_Bool bKeepFieldText, TypeId aType )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- if ( bKeepFieldText )
- pImpEditEngine->UpdateFields();
-
- sal_uInt16 nParas = pImpEditEngine->GetEditDoc().Count();
- for ( sal_uInt16 nPara = 0; nPara < nParas; nPara++ )
- {
- ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
- const CharAttribArray& rAttrs = pNode->GetCharAttribs().GetAttribs();
- for ( sal_uInt16 nAttr = rAttrs.Count(); nAttr; )
- {
- const EditCharAttrib* pAttr = rAttrs[--nAttr];
- if ( pAttr->Which() == EE_FEATURE_FIELD )
- {
- const SvxFieldData* pFldData = ((const SvxFieldItem*)pAttr->GetItem())->GetField();
- if ( pFldData && ( !aType || ( pFldData->IsA( aType ) ) ) )
- {
- 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 );
- }
- }
- }
- }
-}
-
-sal_Bool EditEngine::HasOnlineSpellErrors() const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- sal_uInt16 nNodes = pImpEditEngine->GetEditDoc().Count();
- for ( sal_uInt16 n = 0; n < nNodes; n++ )
- {
- ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n );
- if ( pNode->GetWrongList() && pNode->GetWrongList()->Count() )
- return sal_True;
- }
- return sal_False;
-}
-
-void EditEngine::CompleteOnlineSpelling()
-{
- DBG_CHKTHIS( EditEngine, 0 );
- if ( pImpEditEngine->GetStatus().DoOnlineSpelling() )
- {
- if( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatAndUpdate();
-
- pImpEditEngine->StopOnlineSpellTimer();
- pImpEditEngine->DoOnlineSpelling( 0, sal_True, sal_False );
- }
-}
-
-sal_uInt16 EditEngine::FindParagraph( long nDocPosY )
-{
- return pImpEditEngine->GetParaPortions().FindParagraph( nDocPosY );
-}
-
-EPosition EditEngine::FindDocPosition( const Point& rDocPos ) const
-{
- EPosition aPos;
- // From the point of the API, this is const....
- EditPaM aPaM = ((EditEngine*)this)->pImpEditEngine->GetPaM( rDocPos, sal_False );
- if ( aPaM.GetNode() )
- {
- aPos.nPara = pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
- aPos.nIndex = aPaM.GetIndex();
- }
- return aPos;
-}
-
-Rectangle EditEngine::GetCharacterBounds( const EPosition& rPos ) const
-{
- Rectangle aBounds;
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( rPos.nPara );
-
- // Check against index, not paragraph
- if ( pNode && ( rPos.nIndex < pNode->Len() ) )
- {
- aBounds = pImpEditEngine->PaMtoEditCursor( EditPaM( pNode, rPos.nIndex ), GETCRSR_TXTONLY );
- Rectangle aR2 = pImpEditEngine->PaMtoEditCursor( EditPaM( pNode, rPos.nIndex+1 ), GETCRSR_TXTONLY|GETCRSR_ENDOFLINE );
- if ( aR2.Right() > aBounds.Right() )
- aBounds.Right() = aR2.Right();
- }
- return aBounds;
-}
-
-ParagraphInfos EditEngine::GetParagraphInfos( sal_uInt16 nPara )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- // This only works if not already in the format ...
- if ( !pImpEditEngine->IsFormatted() )
- pImpEditEngine->FormatDoc();
-
- ParagraphInfos aInfos;
- aInfos.bValid = pImpEditEngine->IsFormatted();
- if ( pImpEditEngine->IsFormatted() )
- {
- ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions()[nPara];
- EditLine* pLine = (pParaPortion && pParaPortion->GetLines().Count()) ?
- pParaPortion->GetLines().GetObject( 0 ) : NULL;
- DBG_ASSERT( pParaPortion && pLine, "GetParagraphInfos - Paragraph out of range" );
- if ( pParaPortion && pLine )
- {
- aInfos.nParaHeight = (sal_uInt16)pParaPortion->GetHeight();
- aInfos.nLines = pParaPortion->GetLines().Count();
- aInfos.nFirstLineStartX = pLine->GetStartPosX();
- aInfos.nFirstLineOffset = pParaPortion->GetFirstLineOffset();
- aInfos.nFirstLineHeight = pLine->GetHeight();
- aInfos.nFirstLineTextHeight = pLine->GetTxtHeight();
- aInfos.nFirstLineMaxAscent = pLine->GetMaxAscent();
- }
- }
- return aInfos;
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >
- EditEngine::CreateTransferable( const ESelection& rSelection ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- EditSelection aSel( pImpEditEngine->CreateSel( rSelection ) );
- return pImpEditEngine->CreateTransferable( aSel );
-}
-
-// =====================================================================
-// ====================== Virtual Methods ========================
-// =====================================================================
-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&)
-
-{
- DBG_CHKTHIS( EditEngine, 0 );
-}
-
-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 EditEngine::ParagraphInserted( sal_uInt16 nPara )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- if ( GetNotifyHdl().IsSet() )
- {
- EENotify aNotify( EE_NOTIFY_PARAGRAPHINSERTED );
- aNotify.pEditEngine = this;
- aNotify.nParagraph = nPara;
- pImpEditEngine->CallNotify( aNotify );
- }
-}
-
-void EditEngine::ParagraphDeleted( sal_uInt16 nPara )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- if ( GetNotifyHdl().IsSet() )
- {
- EENotify aNotify( EE_NOTIFY_PARAGRAPHREMOVED );
- aNotify.pEditEngine = this;
- aNotify.nParagraph = nPara;
- pImpEditEngine->CallNotify( aNotify );
- }
-}
-void EditEngine::ParagraphConnected( sal_uInt16 /*nLeftParagraph*/, sal_uInt16 /*nRightParagraph*/ )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-}
-
-sal_Bool EditEngine::FormattingParagraph( sal_uInt16 )
-{
- // return sal_True, if the Attribute was changed ...
- DBG_CHKTHIS( EditEngine, 0 );
- return sal_False;
-}
-
-void EditEngine::ParaAttribsChanged( sal_uInt16 /* nParagraph */ )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-}
-
-void EditEngine::StyleSheetChanged( SfxStyleSheet* /* pStyle */ )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-}
-
-void EditEngine::ParagraphHeightChanged( sal_uInt16 nPara )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-
- if ( GetNotifyHdl().IsSet() )
- {
- EENotify aNotify( EE_NOTIFY_TEXTHEIGHTCHANGED );
- aNotify.pEditEngine = this;
- aNotify.nParagraph = nPara;
- pImpEditEngine->CallNotify( aNotify );
- }
-}
-
-XubString EditEngine::GetUndoComment( sal_uInt16 nId ) const
-{
- DBG_CHKTHIS( EditEngine, 0 );
- XubString aComment;
- switch ( nId )
- {
- case EDITUNDO_REMOVECHARS:
- case EDITUNDO_CONNECTPARAS:
- case EDITUNDO_REMOVEFEATURE:
- case EDITUNDO_DELCONTENT:
- case EDITUNDO_DELETE:
- case EDITUNDO_CUT:
- aComment = XubString( EditResId( RID_EDITUNDO_DEL ) );
- break;
- case EDITUNDO_MOVEPARAGRAPHS:
- case EDITUNDO_MOVEPARAS:
- case EDITUNDO_DRAGANDDROP:
- aComment = XubString( EditResId( RID_EDITUNDO_MOVE ) );
- break;
- case EDITUNDO_INSERTFEATURE:
- case EDITUNDO_SPLITPARA:
- case EDITUNDO_INSERTCHARS:
- case EDITUNDO_PASTE:
- case EDITUNDO_INSERT:
- case EDITUNDO_READ:
- aComment = XubString( EditResId( RID_EDITUNDO_INSERT ) );
- break;
- case EDITUNDO_SRCHANDREPL:
- case EDITUNDO_REPLACEALL:
- aComment = XubString( EditResId( RID_EDITUNDO_REPLACE ) );
- break;
- case EDITUNDO_ATTRIBS:
- case EDITUNDO_PARAATTRIBS:
- case EDITUNDO_STRETCH:
- aComment = XubString( EditResId( RID_EDITUNDO_SETATTRIBS ) );
- break;
- case EDITUNDO_RESETATTRIBS:
- aComment = XubString( EditResId( RID_EDITUNDO_RESETATTRIBS ) );
- break;
- case EDITUNDO_STYLESHEET:
- aComment = XubString( EditResId( RID_EDITUNDO_SETSTYLE ) );
- break;
- case EDITUNDO_TRANSLITERATE:
- aComment = XubString( EditResId( RID_EDITUNDO_TRANSLITERATE ) );
- break;
- case EDITUNDO_INDENTBLOCK:
- case EDITUNDO_UNINDENTBLOCK:
- aComment = XubString( EditResId( RID_EDITUNDO_INDENT ) );
- break;
- }
- return aComment;
-}
-
-Rectangle EditEngine::GetBulletArea( sal_uInt16 )
-{
- return Rectangle( Point(), Point() );
-}
-
-XubString EditEngine::CalcFieldValue( const SvxFieldItem&, sal_uInt16, sal_uInt16, Color*&, Color*& )
-{
- DBG_CHKTHIS( EditEngine, 0 );
- return ' ';
-}
-
-void EditEngine::FieldClicked( const SvxFieldItem&, sal_uInt16, sal_uInt16 )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-}
-
-void EditEngine::FieldSelected( const SvxFieldItem&, sal_uInt16, sal_uInt16 )
-{
- DBG_CHKTHIS( EditEngine, 0 );
-}
-
-// =====================================================================
-// ====================== Static Methods =======================
-// =====================================================================
-SfxItemPool* EditEngine::CreatePool( sal_Bool bPersistentRefCounts )
-{
- SfxItemPool* pPool = new EditEngineItemPool( bPersistentRefCounts );
- return pPool;
-}
-
-SfxItemPool& EditEngine::GetGlobalItemPool()
-{
- if ( !pGlobalPool )
- pGlobalPool = CreatePool();
- return *pGlobalPool;
-}
-
-sal_uInt32 EditEngine::RegisterClipboardFormatName()
-{
- static sal_uInt32 nFormat = 0;
- if ( !nFormat )
- nFormat = SotExchange::RegisterFormatName( String( RTL_CONSTASCII_USTRINGPARAM( "EditEngineFormat" ) ) );
- return nFormat;
-}
-
-sal_uInt16 EditEngine::GetAvailableSearchOptions()
-{
- return SEARCH_OPTIONS_SEARCH | SEARCH_OPTIONS_REPLACE |
- SEARCH_OPTIONS_REPLACE_ALL | SEARCH_OPTIONS_WHOLE_WORDS |
- SEARCH_OPTIONS_BACKWARDS | SEARCH_OPTIONS_REG_EXP |
- SEARCH_OPTIONS_EXACT | SEARCH_OPTIONS_SELECTION;
-}
-
-void EditEngine::SetFontInfoInItemSet( SfxItemSet& rSet, const Font& rFont )
-{
- SvxFont aSvxFont( rFont );
- SetFontInfoInItemSet( rSet, aSvxFont );
-
-}
-
-void EditEngine::SetFontInfoInItemSet( SfxItemSet& rSet, const SvxFont& rFont )
-{
- rSet.Put( SvxLanguageItem( rFont.GetLanguage(), EE_CHAR_LANGUAGE ) );
- rSet.Put( SvxFontItem( rFont.GetFamily(), rFont.GetName(), XubString(), rFont.GetPitch(), rFont.GetCharSet(), EE_CHAR_FONTINFO ) );
- rSet.Put( SvxFontHeightItem( rFont.GetSize().Height(), 100, EE_CHAR_FONTHEIGHT ) );
- rSet.Put( SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH ) );
- rSet.Put( SvxShadowedItem( rFont.IsShadow(), EE_CHAR_SHADOW ) );
- rSet.Put( SvxEscapementItem( rFont.GetEscapement(), rFont.GetPropr(), EE_CHAR_ESCAPEMENT ) );
- rSet.Put( SvxWeightItem( rFont.GetWeight(), EE_CHAR_WEIGHT ) );
- rSet.Put( SvxColorItem( rFont.GetColor(), EE_CHAR_COLOR ) );
- rSet.Put( SvxUnderlineItem( rFont.GetUnderline(), EE_CHAR_UNDERLINE ) );
- rSet.Put( SvxOverlineItem( rFont.GetOverline(), EE_CHAR_OVERLINE ) );
- rSet.Put( SvxCrossedOutItem( rFont.GetStrikeout(), EE_CHAR_STRIKEOUT ) );
- rSet.Put( SvxPostureItem( rFont.GetItalic(), EE_CHAR_ITALIC ) );
- rSet.Put( SvxContourItem( rFont.IsOutline(), EE_CHAR_OUTLINE ) );
- rSet.Put( SvxAutoKernItem( rFont.IsKerning(), EE_CHAR_PAIRKERNING ) );
- rSet.Put( SvxKerningItem( rFont.GetFixKerning(), EE_CHAR_KERNING ) );
- rSet.Put( SvxWordLineModeItem( rFont.IsWordLineMode(), EE_CHAR_WLM ) );
- rSet.Put( SvxEmphasisMarkItem( rFont.GetEmphasisMark(), EE_CHAR_EMPHASISMARK ) );
- rSet.Put( SvxCharReliefItem( rFont.GetRelief(), EE_CHAR_RELIEF ) );
-}
-
-Font EditEngine::CreateFontFromItemSet( const SfxItemSet& rItemSet, sal_uInt16 nScriptType )
-{
- SvxFont aFont;
- CreateFont( aFont, rItemSet, true, nScriptType );
- return aFont;
-}
-
-// Maybe we can remove the next two methods, check after 6.x
-Font EditEngine::CreateFontFromItemSet( const SfxItemSet& rItemSet )
-{
- return CreateSvxFontFromItemSet( rItemSet );
-}
-
-SvxFont EditEngine::CreateSvxFontFromItemSet( const SfxItemSet& rItemSet )
-{
- SvxFont aFont;
- CreateFont( aFont, rItemSet );
- return aFont;
-}
-
-sal_Bool EditEngine::DoesKeyMoveCursor( const KeyEvent& rKeyEvent )
-{
- sal_Bool bDoesMove = sal_False;
-
- switch ( rKeyEvent.GetKeyCode().GetCode() )
- {
- case KEY_UP:
- case KEY_DOWN:
- case KEY_LEFT:
- case KEY_RIGHT:
- case KEY_HOME:
- case KEY_END:
- case KEY_PAGEUP:
- case KEY_PAGEDOWN:
- {
- if ( !rKeyEvent.GetKeyCode().IsMod2() )
- bDoesMove = sal_True;
- }
- break;
- }
- return bDoesMove;
-}
-
-sal_Bool EditEngine::DoesKeyChangeText( const KeyEvent& rKeyEvent )
-{
- sal_Bool bDoesChange = sal_False;
-
- KeyFuncType eFunc = rKeyEvent.GetKeyCode().GetFunction();
- if ( eFunc != KEYFUNC_DONTKNOW )
- {
- switch ( eFunc )
- {
- case KEYFUNC_UNDO:
- case KEYFUNC_REDO:
- case KEYFUNC_CUT:
- case KEYFUNC_PASTE: bDoesChange = sal_True;
- break;
- default: // is then possibly edited below.
- eFunc = KEYFUNC_DONTKNOW;
- }
- }
- if ( eFunc == KEYFUNC_DONTKNOW )
- {
- switch ( rKeyEvent.GetKeyCode().GetCode() )
- {
- case KEY_DELETE:
- case KEY_BACKSPACE: bDoesChange = sal_True;
- break;
- case KEY_RETURN:
- case KEY_TAB:
- {
- if ( !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() )
- bDoesChange = sal_True;
- }
- break;
- default:
- {
- bDoesChange = IsSimpleCharInput( rKeyEvent );
- }
- }
- }
- return bDoesChange;
-}
-
-sal_Bool EditEngine::IsSimpleCharInput( const KeyEvent& rKeyEvent )
-{
- if( EditEngine::IsPrintable( rKeyEvent.GetCharCode() ) &&
- ( KEY_MOD2 != (rKeyEvent.GetKeyCode().GetModifier() & ~KEY_SHIFT ) ) &&
- ( KEY_MOD1 != (rKeyEvent.GetKeyCode().GetModifier() & ~KEY_SHIFT ) ) )
- {
- return sal_True;
- }
- return sal_False;
-}
-
-// should be moved to the Outliner...
-void EditEngine::ImportBulletItem( SvxNumBulletItem& /*rNumBullet*/, sal_uInt16 /*nLevel*/,
- const SvxBulletItem* /*pOldBullet*/, const SvxLRSpaceItem* /*pOldLRSpace*/ )
-{
-}
-
-sal_Bool EditEngine::HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable )
-{
- sal_Bool bValidData = sal_False;
-
- if ( rTransferable.is() )
- {
- // Every application that copies rtf or any other text format also copies plain text into the clipboard....
- datatransfer::DataFlavor aFlavor;
- SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor );
- bValidData = rTransferable->isDataFlavorSupported( aFlavor );
- }
-
- return bValidData;
-}
-
-/** sets a link that is called at the beginning of a drag operation at an edit view */
-void EditEngine::SetBeginDropHdl( const Link& rLink )
-{
- pImpEditEngine->SetBeginDropHdl( rLink );
-}
-
-Link EditEngine::GetBeginDropHdl() const
-{
- return pImpEditEngine->GetBeginDropHdl();
-}
-
-/** sets a link that is called at the end of a drag operation at an edit view */
-void EditEngine::SetEndDropHdl( const Link& rLink )
-{
- pImpEditEngine->SetEndDropHdl( rLink );
-}
-
-Link EditEngine::GetEndDropHdl() const
-{
- return pImpEditEngine->GetEndDropHdl();
-}
-
-void EditEngine::SetFirstWordCapitalization( sal_Bool bCapitalize )
-{
- pImpEditEngine->SetFirstWordCapitalization( bCapitalize );
-}
-
-sal_Bool EditEngine::IsFirstWordCapitalization() const
-{
- return pImpEditEngine->IsFirstWordCapitalization();
-}
-
-
-EFieldInfo::EFieldInfo()
-{
- pFieldItem = NULL;
-}
-
-
-EFieldInfo::EFieldInfo( const SvxFieldItem& rFieldItem, sal_uInt16 nPara, sal_uInt16 nPos ) : aPosition( nPara, nPos )
-{
- pFieldItem = new SvxFieldItem( rFieldItem );
-}
-
-EFieldInfo::~EFieldInfo()
-{
- delete pFieldItem;
-}
-
-EFieldInfo::EFieldInfo( const EFieldInfo& rFldInfo )
-{
- *this = rFldInfo;
-}
-
-EFieldInfo& EFieldInfo::operator= ( const EFieldInfo& rFldInfo )
-{
- if( this == &rFldInfo )
- return *this;
-
- pFieldItem = rFldInfo.pFieldItem ? new SvxFieldItem( *rFldInfo.pFieldItem ) : 0;
- aCurrentText = rFldInfo.aCurrentText;
- aPosition = rFldInfo.aPosition;
-
- return *this;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editeng.src b/editeng/source/editeng/editeng.src
deleted file mode 100644
index 4ee600edc8..0000000000
--- a/editeng/source/editeng/editeng.src
+++ /dev/null
@@ -1,124 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <editeng.hrc>
-#include <helpid.hrc>
-
-String RID_EDITUNDO_DEL
-{
- Text [ en-US ] = "Delete" ;
-};
-
-String RID_EDITUNDO_MOVE
-{
- Text [ en-US ] = "Move" ;
-};
-
-String RID_EDITUNDO_INSERT
-{
- Text [ en-US ] = "Insert" ;
-};
-
-String RID_EDITUNDO_REPLACE
-{
- Text [ en-US ] = "Replace" ;
-};
-
-String RID_EDITUNDO_SETATTRIBS
-{
- Text [ en-US ] = "Apply attributes" ;
-};
-
-String RID_EDITUNDO_RESETATTRIBS
-{
- Text [ en-US ] = "Reset attributes" ;
-};
-
-String RID_EDITUNDO_INDENT
-{
- Text [ en-US ] = "Indent" ;
-};
-
-String RID_EDITUNDO_SETSTYLE
-{
- Text [ en-US ] = "Apply Styles" ;
-};
-
-String RID_EDITUNDO_TRANSLITERATE
-{
- Text [ en-US ] = "~Change Case";
-};
-
-
-Menu RID_MENU_SPELL
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = MN_SPELLING ;
- HelpId = HID_EDITENG_SPELLER_START;
- Text [ en-US ] = "~Spellcheck..." ;
- };
- MenuItem
- {
- Identifier = MN_INSERT ;
- HelpId = HID_EDITENG_SPELLER_ADDWORD;
- SubMenu = Menu
- {
- };
- Text [ en-US ] = "~Add" ;
- };
- MenuItem
- {
- Identifier = MN_IGNORE ;
- HelpId = HID_EDITENG_SPELLER_IGNORE;
- Text [ en-US ] = "Ignore All" ;
- };
- MenuItem
- {
- Identifier = MN_AUTOCORR ;
- HelpId = HID_EDITENG_SPELLER_AUTOCORRECT;
- SubMenu = Menu
- {
- };
- Text [ en-US ] = "AutoCorrect" ;
- };
- };
-};
-
-
-String RID_STR_WORD
-{
- Text [ en-US ] = "Word is %x";
-};
-
-String RID_STR_PARAGRAPH
-{
- Text [ en-US ] = "Paragraph is %x";
-};
-
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
deleted file mode 100644
index c0555ccabf..0000000000
--- a/editeng/source/editeng/editobj.cxx
+++ /dev/null
@@ -1,1594 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-
-#define ENABLE_STRING_STREAM_OPERATORS
-#include <tools/stream.hxx>
-
-#include <editobj2.hxx>
-#include <editeng/editdata.hxx>
-#include <editattr.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/cscoitem.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/tstpitem.hxx>
-#include <editeng/bulitem.hxx>
-#include <editeng/numitem.hxx>
-#include <editeng/brshitem.hxx>
-#include <vcl/graph.hxx>
-#include <svl/intitem.hxx>
-#include <unotools/fontcvt.hxx>
-#include <tools/tenccvt.hxx>
-
-DBG_NAME( EE_EditTextObject )
-DBG_NAME( XEditAttribute )
-
-//--------------------------------------------------------------
-
-XEditAttribute* MakeXEditAttribute( SfxItemPool& rPool, const SfxPoolItem& rItem, sal_uInt16 nStart, sal_uInt16 nEnd )
-{
- // Create thw new attribute in the pool
- const SfxPoolItem& rNew = rPool.Put( rItem );
-
- XEditAttribute* pNew = new XEditAttribute( rNew, nStart, nEnd );
- return pNew;
-}
-
-
-XEditAttribute::XEditAttribute( const SfxPoolItem& rAttr )
-{
- DBG_CTOR( XEditAttribute, 0 );
- pItem = &rAttr;
- nStart = 0;
- nEnd = 0;
-}
-
-XEditAttribute::XEditAttribute( const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE )
-{
- DBG_CTOR( XEditAttribute, 0 );
- pItem = &rAttr;
- nStart = nS;
- nEnd = nE;
-}
-
-XEditAttribute::~XEditAttribute()
-{
- DBG_DTOR( XEditAttribute, 0 );
- pItem = 0; // belongs to the Pool.
-}
-
-XEditAttribute* XEditAttributeList::FindAttrib( sal_uInt16 _nWhich, sal_uInt16 nChar ) const
-{
- for ( sal_uInt16 n = Count(); n; )
- {
- XEditAttribute* pAttr = GetObject( --n );
- if( ( pAttr->GetItem()->Which() == _nWhich ) && ( pAttr->GetStart() <= nChar ) && ( pAttr->GetEnd() > nChar ) )
- return pAttr;
- }
- return NULL;
-}
-
-ContentInfo::ContentInfo( SfxItemPool& rPool ) : aParaAttribs( rPool, EE_PARA_START, EE_CHAR_END )
-{
- eFamily = SFX_STYLE_FAMILY_PARA;
- pWrongs = NULL;
-}
-
-// 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)
-{
- // 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();
-
- for ( sal_uInt16 n = 0; n < rCopyFrom.GetAttribs().Count(); n++ )
- {
- XEditAttribute* pAttr = rCopyFrom.GetAttribs().GetObject( n );
- XEditAttribute* pMyAttr = MakeXEditAttribute( rPoolToUse, *pAttr->GetItem(), pAttr->GetStart(), pAttr->GetEnd() );
- aAttribs.Insert( pMyAttr, aAttribs.Count() );
- }
-
- if ( rCopyFrom.GetWrongList() )
- pWrongs = rCopyFrom.GetWrongList()->Clone();
-}
-
-ContentInfo::~ContentInfo()
-{
- for ( sal_uInt16 nAttr = 0; nAttr < aAttribs.Count(); nAttr++ )
- {
- XEditAttribute* pAttr = aAttribs.GetObject(nAttr);
- aParaAttribs.GetPool()->Remove( *pAttr->GetItem() );
- delete pAttr;
- }
- aAttribs.Remove( 0, aAttribs.Count() );
- delete pWrongs;
-}
-
-// #i102062#
-bool ContentInfo::isWrongListEqual(const ContentInfo& rCompare) const
-{
- if(GetWrongList() == rCompare.GetWrongList())
- return true;
-
- if(!GetWrongList() || !rCompare.GetWrongList())
- return false;
-
- return (*GetWrongList() == *rCompare.GetWrongList());
-}
-
-bool ContentInfo::operator==( const ContentInfo& rCompare ) const
-{
- if( (aText == rCompare.aText) &&
- (aStyle == rCompare.aStyle ) &&
- (aAttribs.Count() == rCompare.aAttribs.Count() ) &&
- (eFamily == rCompare.eFamily ) &&
- (aParaAttribs == rCompare.aParaAttribs ) )
- {
- const sal_uInt16 nCount = aAttribs.Count();
- if( nCount == rCompare.aAttribs.Count() )
- {
- sal_uInt16 n;
- for( n = 0; n < nCount; n++ )
- {
- if( !(*aAttribs.GetObject(n) == *rCompare.aAttribs.GetObject(n)) )
- return false;
- }
-
- return true;
- }
- }
-
- return false;
-}
-
-EditTextObject::EditTextObject( sal_uInt16 n)
-{
- DBG_CTOR( EE_EditTextObject, 0 );
- nWhich = n;
-}
-
-EditTextObject::EditTextObject( const EditTextObject& r )
-{
- DBG_CTOR( EE_EditTextObject, 0 );
- nWhich = r.nWhich;
-}
-
-EditTextObject::~EditTextObject()
-{
- DBG_DTOR( EE_EditTextObject, 0 );
-}
-
-sal_uInt16 EditTextObject::GetParagraphCount() const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return 0;
-}
-
-XubString EditTextObject::GetText( sal_uInt16 /* nParagraph */ ) const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return XubString();
-}
-
-void EditTextObject::Insert( const EditTextObject& /* rObj */, sal_uInt16 /* nPara */)
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
-}
-
-EditTextObject* EditTextObject::CreateTextObject( sal_uInt16 /*nPara*/, sal_uInt16 /*nParas*/ ) const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return 0;
-}
-
-void EditTextObject::RemoveParagraph( sal_uInt16 /*nPara*/ )
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
-}
-
-sal_Bool EditTextObject::HasPortionInfo() const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return sal_False;
-}
-
-void EditTextObject::ClearPortionInfo()
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
-}
-
-sal_Bool EditTextObject::HasOnlineSpellErrors() const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return sal_False;
-}
-
-sal_Bool EditTextObject::HasCharAttribs( sal_uInt16 ) const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return sal_False;
-}
-
-void EditTextObject::GetCharAttribs( sal_uInt16 /*nPara*/, EECharAttribArray& /*rLst*/ ) const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
-}
-
-void EditTextObject::MergeParaAttribs( const SfxItemSet& /*rAttribs*/, sal_uInt16 /*nStart*/, sal_uInt16 /*nEnd*/ )
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
-}
-
-sal_Bool EditTextObject::IsFieldObject() const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return sal_False;
-}
-
-const SvxFieldItem* EditTextObject::GetField() const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return 0;
-}
-
-sal_Bool EditTextObject::HasField( TypeId /*aType*/ ) const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return sal_False;
-}
-
-SfxItemSet EditTextObject::GetParaAttribs( sal_uInt16 /*nPara*/ ) const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return SfxItemSet( *(SfxItemPool*)NULL );
-}
-
-void EditTextObject::SetParaAttribs( sal_uInt16 /*nPara*/, const SfxItemSet& /*rAttribs*/ )
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
-}
-
-sal_Bool EditTextObject::RemoveCharAttribs( sal_uInt16 /*nWhich*/ )
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return sal_False;
-}
-
-sal_Bool EditTextObject::RemoveParaAttribs( sal_uInt16 /*nWhich*/ )
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return sal_False;
-}
-
-sal_Bool EditTextObject::HasStyleSheet( const XubString& /*rName*/, SfxStyleFamily /*eFamily*/ ) const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return sal_False;
-}
-
-void EditTextObject::GetStyleSheet( sal_uInt16 /*nPara*/, XubString& /*rName*/, SfxStyleFamily& /*eFamily*/ ) const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
-}
-
-void EditTextObject::SetStyleSheet( sal_uInt16 /*nPara*/, const XubString& /*rName*/, const SfxStyleFamily& /*eFamily*/ )
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
-}
-
-sal_Bool EditTextObject::ChangeStyleSheets( const XubString&, SfxStyleFamily,
- const XubString&, SfxStyleFamily )
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return sal_False;
-}
-
-void EditTextObject::ChangeStyleSheetName( SfxStyleFamily /*eFamily*/,
- const XubString& /*rOldName*/, const XubString& /*rNewName*/ )
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
-}
-
-sal_uInt16 EditTextObject::GetUserType() const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return 0;
-}
-
-void EditTextObject::SetUserType( sal_uInt16 )
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
-}
-
-sal_uLong EditTextObject::GetObjectSettings() const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return 0;
-}
-
-void EditTextObject::SetObjectSettings( sal_uLong )
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
-}
-
-sal_Bool EditTextObject::IsVertical() const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return sal_False;
-}
-
-void EditTextObject::SetVertical( sal_Bool bVertical )
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- ((BinTextObject*)this)->SetVertical( bVertical );
-}
-
-sal_uInt16 EditTextObject::GetScriptType() const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return ((const BinTextObject*)this)->GetScriptType();
-}
-
-
-sal_Bool EditTextObject::Store( SvStream& rOStream ) const
-{
- if ( rOStream.GetError() )
- return sal_False;
-
- sal_Size nStartPos = rOStream.Tell();
-
- rOStream << (sal_uInt16)Which();
-
- sal_uInt32 nStructSz = 0;
- rOStream << nStructSz;
-
- StoreData( rOStream );
-
- sal_Size nEndPos = rOStream.Tell();
- nStructSz = nEndPos - nStartPos - sizeof( nWhich ) - sizeof( nStructSz );
- rOStream.Seek( nStartPos + sizeof( nWhich ) );
- rOStream << nStructSz;
- rOStream.Seek( nEndPos );
-
- return rOStream.GetError() ? sal_False : sal_True;
-}
-
-EditTextObject* EditTextObject::Create( SvStream& rIStream, SfxItemPool* pGlobalTextObjectPool )
-{
- sal_uLong nStartPos = rIStream.Tell();
-
- // 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: Unknown Object!" );
-
- if ( rIStream.GetError() )
- return NULL;
-
- EditTextObject* pTxtObj = NULL;
- switch ( nWhich )
- {
- case 0x22 /*BIN300*/: pTxtObj = new BinTextObject( 0 );
- ((BinTextObject*)pTxtObj)->CreateData300( rIStream );
- break;
- case EE_FORMAT_BIN: pTxtObj = new BinTextObject( pGlobalTextObjectPool );
- pTxtObj->CreateData( rIStream );
- break;
- default:
- {
- // If I do not know the format, I overwrite the contents:
- rIStream.SetError( EE_READWRITE_WRONGFORMAT );
- }
- }
-
- // 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;
-}
-
-void EditTextObject::Skip( SvStream& rIStream )
-{
- sal_Size nStartPos = rIStream.Tell();
-
- sal_uInt16 _nWhich;
- rIStream >> _nWhich;
-
- sal_uInt32 nStructSz;
- rIStream >> nStructSz;
-
- sal_Size nFullSz = sizeof( _nWhich ) + sizeof( nStructSz ) + nStructSz;
- rIStream.Seek( nStartPos + nFullSz );
-}
-
-void EditTextObject::StoreData( SvStream& ) const
-{
- OSL_FAIL( "StoreData: Base class!" );
-}
-
-void EditTextObject::CreateData( SvStream& )
-{
- OSL_FAIL( "CreateData: Base class!" );
-}
-
-sal_uInt16 EditTextObject::GetVersion() const
-{
- OSL_FAIL( "Virtual method direct from EditTextObject!" );
- return 0;
-}
-
-bool EditTextObject::operator==( const EditTextObject& rCompare ) const
-{
- return static_cast< const BinTextObject* >( this )->operator==( static_cast< const BinTextObject& >( rCompare ) );
-}
-
-// #i102062#
-bool EditTextObject::isWrongListEqual(const EditTextObject& rCompare) const
-{
- return static_cast< const BinTextObject* >(this)->isWrongListEqual(static_cast< const BinTextObject& >(rCompare));
-}
-
-// from SfxItemPoolUser
-void BinTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool)
-{
- if(!bOwnerOfPool && pPool && pPool == &rSfxItemPool)
- {
- // The pool we are based on gets destructed; get owner of pool by creating own one.
- // No need to call RemoveSfxItemPoolUser(), this is done from the pool's destructor
- // Base new pool on EditEnginePool; it would also be possible to clone the used
- // pool if needed, but only text attributes should be used.
- SfxItemPool* pNewPool = EditEngine::CreatePool();
-
- if(pPool)
- {
- pNewPool->SetDefaultMetric(pPool->GetMetric(DEF_METRIC));
- }
-
- for(sal_uInt16 n(0); n < aContents.Count(); n++)
- {
- // clone ContentInfos for new pool
- ContentInfo* pOrg = aContents.GetObject(n);
- DBG_ASSERT(pOrg, "NULL-Pointer in ContentList!");
-
- ContentInfo* pNew = new ContentInfo(*pOrg, *pNewPool);
- aContents.Replace(pNew, n);
- delete pOrg;
- }
-
- // set local variables
- pPool = pNewPool;
- bOwnerOfPool = sal_True;
- }
-}
-
-EditEngineItemPool* getEditEngineItemPool(SfxItemPool* pPool)
-{
- EditEngineItemPool* pRetval = dynamic_cast< EditEngineItemPool* >(pPool);
-
- while(!pRetval && pPool && pPool->GetSecondaryPool())
- {
- pPool = pPool->GetSecondaryPool();
-
- if(pPool)
- {
- pRetval = dynamic_cast< EditEngineItemPool* >(pPool);
- }
- }
-
- return pRetval;
-}
-
-BinTextObject::BinTextObject( SfxItemPool* pP ) :
- EditTextObject( EE_FORMAT_BIN ),
- SfxItemPoolUser()
-{
- nVersion = 0;
- nMetric = 0xFFFF;
- nUserType = 0;
- nObjSettings = 0;
- pPortionInfo = 0;
-
- // #i101239# ensure target is a EditEngineItemPool, else
- // fallback to pool ownership. This is needed to ensure that at
- // pool destruction time of an alien pool, the pool is still alive.
- // When registering would happen at an alien pool which just uses an
- // EditEngineItemPool as some sub-pool, that pool could already
- // be decoupled and deleted whcih would lead to crashes.
- pPool = getEditEngineItemPool(pP);
-
- if ( pPool )
- {
- bOwnerOfPool = sal_False;
- }
- else
- {
- pPool = EditEngine::CreatePool();
- bOwnerOfPool = sal_True;
- }
-
- if(!bOwnerOfPool && pPool)
- {
- // it is sure now that the pool is an EditEngineItemPool
- pPool->AddSfxItemPoolUser(*this);
- }
-
- bVertical = sal_False;
- bStoreUnicodeStrings = sal_False;
- nScriptType = 0;
-}
-
-BinTextObject::BinTextObject( const BinTextObject& r ) :
- EditTextObject( r ),
- SfxItemPoolUser()
-{
- nVersion = r.nVersion;
- nMetric = r.nMetric;
- nUserType = r.nUserType;
- nObjSettings = r.nObjSettings;
- bVertical = r.bVertical;
- nScriptType = r.nScriptType;
- pPortionInfo = NULL; // Do not copy PortionInfo
- bStoreUnicodeStrings = sal_False;
-
- if ( !r.bOwnerOfPool )
- {
- // reuse alien pool; this must be a EditEngineItemPool
- // since there is no other way to construct a BinTextObject
- // than it's regular constructor where that is ensured
- pPool = r.pPool;
- bOwnerOfPool = sal_False;
- }
- else
- {
- pPool = EditEngine::CreatePool();
- bOwnerOfPool = sal_True;
-
- }
-
- if(!bOwnerOfPool && pPool)
- {
- // it is sure now that the pool is an EditEngineItemPool
- pPool->AddSfxItemPoolUser(*this);
- }
-
- if ( bOwnerOfPool && pPool && r.pPool )
- pPool->SetDefaultMetric( r.pPool->GetMetric( DEF_METRIC ) );
-
- for ( sal_uInt16 n = 0; n < r.aContents.Count(); n++ )
- {
- ContentInfo* pOrg = r.aContents.GetObject( n );
- DBG_ASSERT( pOrg, "NULL-Pointer in ContentList!" );
- ContentInfo* pNew = new ContentInfo( *pOrg, *pPool );
- aContents.Insert( pNew, aContents.Count() );
- }
-}
-
-BinTextObject::~BinTextObject()
-{
- if(!bOwnerOfPool && pPool)
- {
- pPool->RemoveSfxItemPoolUser(*this);
- }
-
- ClearPortionInfo();
- DeleteContents();
- if ( bOwnerOfPool )
- {
- SfxItemPool::Free(pPool);
- }
-}
-
-sal_uInt16 BinTextObject::GetUserType() const
-{
- return nUserType;
-}
-
-void BinTextObject::SetUserType( sal_uInt16 n )
-{
- nUserType = n;
-}
-
-sal_uLong BinTextObject::GetObjectSettings() const
-{
- return nObjSettings;
-}
-
-void BinTextObject::SetObjectSettings( sal_uLong n )
-{
- nObjSettings = n;
-}
-
-sal_Bool BinTextObject::IsVertical() const
-{
- return bVertical;
-}
-
-void BinTextObject::SetVertical( sal_Bool b )
-{
- if ( b != bVertical )
- {
- bVertical = b;
- ClearPortionInfo();
- }
-}
-
-sal_uInt16 BinTextObject::GetScriptType() const
-{
- return nScriptType;
-}
-
-void BinTextObject::SetScriptType( sal_uInt16 nType )
-{
- nScriptType = nType;
-}
-
-
-void BinTextObject::DeleteContents()
-{
- for ( sal_uInt16 n = 0; n < aContents.Count(); n++ )
- {
- ContentInfo* p = aContents.GetObject( n );
- DBG_ASSERT( p, "NULL-Pointer in ContentList!" );
- delete p;
- }
- aContents.Remove( 0, aContents.Count() );
-}
-
-EditTextObject* BinTextObject::Clone() const
-{
- return new BinTextObject( *this );
-}
-
-XEditAttribute* BinTextObject::CreateAttrib( const SfxPoolItem& rItem, sal_uInt16 nStart, sal_uInt16 nEnd )
-{
- return MakeXEditAttribute( *pPool, rItem, nStart, nEnd );
-}
-
-void BinTextObject::DestroyAttrib( XEditAttribute* pAttr )
-{
- pPool->Remove( *pAttr->GetItem() );
- delete pAttr;
-}
-
-ContentInfo* BinTextObject::CreateAndInsertContent()
-{
- ContentInfo* pC = new ContentInfo( *pPool );
- aContents.Insert( pC, aContents.Count() );
- return pC;
-}
-
-sal_uInt16 BinTextObject::GetParagraphCount() const
-{
- return aContents.Count();
-}
-
-XubString BinTextObject::GetText( sal_uInt16 nPara ) const
-{
- DBG_ASSERT( nPara < aContents.Count(), "BinTextObject::GetText: Paragraph does not exist!" );
- if ( nPara < aContents.Count() )
- {
- ContentInfo* pC = aContents[ nPara ];
- return pC->GetText();
- }
- return XubString();
-}
-
-void BinTextObject::Insert( const EditTextObject& rObj, sal_uInt16 nDestPara )
-{
- DBG_ASSERT( rObj.Which() == EE_FORMAT_BIN, "UTO: unknown Textobjekt" );
-
- const BinTextObject& rBinObj = (const BinTextObject&)rObj;
-
- if ( nDestPara > aContents.Count() )
- nDestPara = aContents.Count();
-
- const sal_uInt16 nParas = rBinObj.GetContents().Count();
- for ( sal_uInt16 nP = 0; nP < nParas; nP++ )
- {
- ContentInfo* pC = rBinObj.GetContents()[ nP ];
- ContentInfo* pNew = new ContentInfo( *pC, *GetPool() );
- aContents.Insert( pNew, nDestPara+nP );
- }
- ClearPortionInfo();
-}
-
-EditTextObject* BinTextObject::CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas ) const
-{
- if ( ( nPara >= aContents.Count() ) || !nParas )
- return NULL;
-
- // 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 ) );
-
- // If complete text is only one ScriptType, this is valid.
- // If text contains different ScriptTypes, this shouldn't be a problem...
- pObj->nScriptType = nScriptType;
-
- const sal_uInt16 nEndPara = nPara+nParas-1;
- for ( sal_uInt16 nP = nPara; nP <= nEndPara; nP++ )
- {
- ContentInfo* pC = aContents[ nP ];
- ContentInfo* pNew = new ContentInfo( *pC, *pObj->GetPool() );
- pObj->GetContents().Insert( pNew, pObj->GetContents().Count() );
- }
- return pObj;
-}
-
-void BinTextObject::RemoveParagraph( sal_uInt16 nPara )
-{
- DBG_ASSERT( nPara < aContents.Count(), "BinTextObject::GetText: Paragraph does not exist!" );
- if ( nPara < aContents.Count() )
- {
- ContentInfo* pC = aContents[ nPara ];
- aContents.Remove( nPara );
- delete pC;
- ClearPortionInfo();
- }
-}
-
-sal_Bool BinTextObject::HasPortionInfo() const
-{
- return pPortionInfo ? sal_True : sal_False;
-}
-
-void BinTextObject::ClearPortionInfo()
-{
- if ( pPortionInfo )
- {
- for ( sal_uInt16 n = pPortionInfo->Count(); n; )
- delete pPortionInfo->GetObject( --n );
- delete pPortionInfo;
- pPortionInfo = NULL;
- }
-}
-
-sal_Bool BinTextObject::HasOnlineSpellErrors() const
-{
- for ( sal_uInt16 n = 0; n < aContents.Count(); n++ )
- {
- ContentInfo* p = aContents.GetObject( n );
- if ( p->GetWrongList() && p->GetWrongList()->Count() )
- return sal_True;
- }
- return sal_False;
-
-}
-
-sal_Bool BinTextObject::HasCharAttribs( sal_uInt16 _nWhich ) const
-{
- for ( sal_uInt16 nPara = GetContents().Count(); nPara; )
- {
- ContentInfo* pC = GetContents().GetObject( --nPara );
-
- sal_uInt16 nAttribs = pC->GetAttribs().Count();
- if ( nAttribs && !_nWhich )
- return sal_True;
-
- for ( sal_uInt16 nAttr = nAttribs; nAttr; )
- {
- XEditAttribute* pX = pC->GetAttribs().GetObject( --nAttr );
- if ( pX->GetItem()->Which() == _nWhich )
- return sal_True;
- }
- }
- return sal_False;
-}
-
-void BinTextObject::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const
-{
- rLst.Remove( 0, rLst.Count() );
- ContentInfo* pC = GetContents().GetObject( nPara );
- if ( pC )
- {
- for ( sal_uInt16 nAttr = 0; nAttr < pC->GetAttribs().Count(); nAttr++ )
- {
- XEditAttribute* pAttr = pC->GetAttribs().GetObject( nAttr );
- EECharAttrib aEEAttr;
- aEEAttr.pAttr = pAttr->GetItem();
- aEEAttr.nPara = nPara;
- aEEAttr.nStart = pAttr->GetStart();
- aEEAttr.nEnd = pAttr->GetEnd();
- rLst.Insert( aEEAttr, rLst.Count() );
- }
- }
-}
-
-void BinTextObject::MergeParaAttribs( const SfxItemSet& rAttribs, sal_uInt16 nStart, sal_uInt16 nEnd )
-{
- sal_Bool bChanged = sal_False;
-
- for ( sal_uInt16 nPara = GetContents().Count(); nPara; )
- {
- ContentInfo* pC = GetContents().GetObject( --nPara );
-
- for ( sal_uInt16 nW = nStart; nW <= nEnd; nW++ )
- {
- if ( ( pC->GetParaAttribs().GetItemState( nW, sal_False ) != SFX_ITEM_ON )
- && ( rAttribs.GetItemState( nW, sal_False ) == SFX_ITEM_ON ) )
- {
- pC->GetParaAttribs().Put( rAttribs.Get( nW ) );
- bChanged = sal_True;
- }
- }
- }
-
- if ( bChanged )
- ClearPortionInfo();
-}
-
-sal_Bool BinTextObject::IsFieldObject() const
-{
- return BinTextObject::GetField() ? sal_True : sal_False;
-}
-
-const SvxFieldItem* BinTextObject::GetField() const
-{
- if ( GetContents().Count() == 1 )
- {
- ContentInfo* pC = GetContents()[0];
- if ( pC->GetText().Len() == 1 )
- {
- sal_uInt16 nAttribs = pC->GetAttribs().Count();
- for ( sal_uInt16 nAttr = nAttribs; nAttr; )
- {
- XEditAttribute* pX = pC->GetAttribs().GetObject( --nAttr );
- if ( pX->GetItem()->Which() == EE_FEATURE_FIELD )
- return (const SvxFieldItem*)pX->GetItem();
- }
- }
- }
- return 0;
-}
-
-sal_Bool BinTextObject::HasField( TypeId aType ) const
-{
- sal_uInt16 nParagraphs = GetContents().Count();
- for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
- {
- ContentInfo* pC = GetContents().GetObject( nPara );
- sal_uInt16 nAttrs = pC->GetAttribs().Count();
- for ( sal_uInt16 nAttr = 0; nAttr < nAttrs; nAttr++ )
- {
- XEditAttribute* pAttr = pC->GetAttribs()[nAttr];
- if ( pAttr->GetItem()->Which() == EE_FEATURE_FIELD )
- {
- if ( !aType )
- return sal_True;
-
- const SvxFieldData* pFldData = ((const SvxFieldItem*)pAttr->GetItem())->GetField();
- if ( pFldData && pFldData->IsA( aType ) )
- return sal_True;
- }
- }
- }
- return sal_False;
-}
-
-SfxItemSet BinTextObject::GetParaAttribs( sal_uInt16 nPara ) const
-{
- ContentInfo* pC = GetContents().GetObject( nPara );
- return pC->GetParaAttribs();
-}
-
-void BinTextObject::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rAttribs )
-{
- ContentInfo* pC = GetContents().GetObject( nPara );
- pC->GetParaAttribs().Set( rAttribs );
- ClearPortionInfo();
-}
-
-sal_Bool BinTextObject::RemoveCharAttribs( sal_uInt16 _nWhich )
-{
- sal_Bool bChanged = sal_False;
-
- for ( sal_uInt16 nPara = GetContents().Count(); nPara; )
- {
- ContentInfo* pC = GetContents().GetObject( --nPara );
-
- for ( sal_uInt16 nAttr = pC->GetAttribs().Count(); nAttr; )
- {
- XEditAttribute* pAttr = pC->GetAttribs().GetObject( --nAttr );
- if ( !_nWhich || ( pAttr->GetItem()->Which() == _nWhich ) )
- {
- pC->GetAttribs().Remove( nAttr );
- DestroyAttrib( pAttr );
- bChanged = sal_True;
- }
- }
- }
-
- if ( bChanged )
- ClearPortionInfo();
-
- return bChanged;
-}
-
-sal_Bool BinTextObject::RemoveParaAttribs( sal_uInt16 _nWhich )
-{
- sal_Bool bChanged = sal_False;
-
- for ( sal_uInt16 nPara = GetContents().Count(); nPara; )
- {
- ContentInfo* pC = GetContents().GetObject( --nPara );
-
- if ( !_nWhich )
- {
- if( pC->GetParaAttribs().Count() )
- bChanged = sal_True;
- pC->GetParaAttribs().ClearItem();
- }
- else
- {
- if ( pC->GetParaAttribs().GetItemState( _nWhich ) == SFX_ITEM_ON )
- {
- pC->GetParaAttribs().ClearItem( _nWhich );
- bChanged = sal_True;
- }
- }
- }
-
- if ( bChanged )
- ClearPortionInfo();
-
- return bChanged;
-}
-
-sal_Bool BinTextObject::HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const
-{
- sal_uInt16 nParagraphs = GetContents().Count();
- for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
- {
- ContentInfo* pC = GetContents().GetObject( nPara );
- if ( ( pC->GetFamily() == eFamily ) && ( pC->GetStyle() == rName ) )
- return sal_True;
- }
- return sal_False;
-}
-
-void BinTextObject::GetStyleSheet( sal_uInt16 nPara, XubString& rName, SfxStyleFamily& rFamily ) const
-{
- if ( nPara < aContents.Count() )
- {
- ContentInfo* pC = aContents[ nPara ];
- rName = pC->GetStyle();
- rFamily = pC->GetFamily();
- }
-}
-
-void BinTextObject::SetStyleSheet( sal_uInt16 nPara, const XubString& rName, const SfxStyleFamily& rFamily )
-{
- if ( nPara < aContents.Count() )
- {
- ContentInfo* pC = aContents[ nPara ];
- pC->GetStyle() = rName;
- pC->GetFamily() = rFamily;
- }
-}
-
-sal_Bool BinTextObject::ImpChangeStyleSheets(
- const XubString& rOldName, SfxStyleFamily eOldFamily,
- const XubString& rNewName, SfxStyleFamily eNewFamily )
-{
- const sal_uInt16 nParagraphs = GetContents().Count();
- sal_Bool bChanges = sal_False;
-
- for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
- {
- ContentInfo* pC = GetContents().GetObject( nPara );
- if ( pC->GetFamily() == eOldFamily )
- {
- if ( pC->GetStyle() == rOldName )
- {
- pC->GetStyle() = rNewName;
- pC->GetFamily() = eNewFamily;
- bChanges = sal_True;
- }
- }
- }
- return bChanges;
-}
-
-sal_Bool BinTextObject::ChangeStyleSheets(
- const XubString& rOldName, SfxStyleFamily eOldFamily,
- const XubString& rNewName, SfxStyleFamily eNewFamily )
-{
- sal_Bool bChanges = ImpChangeStyleSheets( rOldName, eOldFamily, rNewName, eNewFamily );
- if ( bChanges )
- ClearPortionInfo();
-
- return bChanges;
-}
-
-void BinTextObject::ChangeStyleSheetName( SfxStyleFamily eFamily,
- const XubString& rOldName, const XubString& rNewName )
-{
- ImpChangeStyleSheets( rOldName, eFamily, rNewName, eFamily );
-}
-
-void BinTextObject::StoreData( SvStream& rOStream ) const
-{
- sal_uInt16 nVer = 602;
- rOStream << nVer;
-
- rOStream << bOwnerOfPool;
-
- // First store the pool, later only the Surregate
- if ( bOwnerOfPool )
- {
- GetPool()->SetFileFormatVersion( SOFFICE_FILEFORMAT_50 );
- GetPool()->Store( rOStream );
- }
-
- // Store Current text encoding ...
- rtl_TextEncoding eEncoding = GetSOStoreTextEncoding( gsl_getSystemTextEncoding(), (sal_uInt16) rOStream.GetVersion() );
- rOStream << (sal_uInt16) eEncoding;
-
- // The number of paragraphs ...
- sal_uInt16 nParagraphs = GetContents().Count();
- rOStream << nParagraphs;
-
- char cFeatureConverted = ByteString( CH_FEATURE, eEncoding ).GetChar(0);
-
- // The individual paragraphs ...
- for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
- {
- ContentInfo* pC = GetContents().GetObject( nPara );
-
- // Text...
- ByteString aText( pC->GetText(), eEncoding );
-
- // Symbols?
- sal_Bool bSymbolPara = sal_False;
- if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON )
- {
- const SvxFontItem& rFontItem = (const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO );
- if ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
- {
- aText = ByteString( pC->GetText(), RTL_TEXTENCODING_SYMBOL );
- bSymbolPara = sal_True;
- }
- }
- for ( sal_uInt16 nA = 0; nA < pC->GetAttribs().Count(); nA++ )
- {
- XEditAttribute* pAttr = pC->GetAttribs().GetObject( nA );
-
- if ( pAttr->GetItem()->Which() == EE_CHAR_FONTINFO )
- {
- const SvxFontItem& rFontItem = (const SvxFontItem&)*pAttr->GetItem();
- if ( ( !bSymbolPara && ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL ) )
- || ( bSymbolPara && ( rFontItem.GetCharSet() != RTL_TEXTENCODING_SYMBOL ) ) )
- {
- // Not correctly converted
- String aPart( pC->GetText(), pAttr->GetStart(), pAttr->GetEnd() - pAttr->GetStart() );
- ByteString aNew( aPart, rFontItem.GetCharSet() );
- aText.Erase( pAttr->GetStart(), pAttr->GetEnd() - pAttr->GetStart() );
- aText.Insert( aNew, pAttr->GetStart() );
- }
-
- // Convert StarSymbol back to StarBats
- FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FONTTOSUBSFONT_EXPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
- if ( hConv )
- {
- // Don't create a new Attrib with StarBats font, MBR changed the
- // SvxFontItem::Store() to store StarBats instead of StarSymbol!
- for ( sal_uInt16 nChar = pAttr->GetStart(); nChar < pAttr->GetEnd(); nChar++ )
- {
- sal_Unicode cOld = pC->GetText().GetChar( nChar );
- char cConv = ByteString::ConvertFromUnicode( ConvertFontToSubsFontChar( hConv, cOld ), RTL_TEXTENCODING_SYMBOL );
- if ( cConv )
- aText.SetChar( nChar, cConv );
- }
-
- DestroyFontToSubsFontConverter( hConv );
- }
- }
- }
-
- // Convert StarSymbol back to StarBats
- // StarSymbol as paragraph attribute or in StyleSheet?
-
- FontToSubsFontConverter hConv = NULL;
- if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON )
- {
- hConv = CreateFontToSubsFontConverter( ((const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO )).GetFamilyName(), FONTTOSUBSFONT_EXPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
- }
- if ( hConv )
- {
- for ( sal_uInt16 nChar = 0; nChar < pC->GetText().Len(); nChar++ )
- {
- if ( !pC->GetAttribs().FindAttrib( EE_CHAR_FONTINFO, nChar ) )
- {
- sal_Unicode cOld = pC->GetText().GetChar( nChar );
- char cConv = ByteString::ConvertFromUnicode( ConvertFontToSubsFontChar( hConv, cOld ), RTL_TEXTENCODING_SYMBOL );
- if ( cConv )
- aText.SetChar( nChar, cConv );
- }
- }
-
- DestroyFontToSubsFontConverter( hConv );
-
- }
-
-
- // Convert CH_FEATURE to CH_FEATURE_OLD
- aText.SearchAndReplaceAll( cFeatureConverted, CH_FEATURE_OLD );
- rOStream.WriteByteString( aText );
-
- // StyleName and Family...
- rOStream.WriteByteString( ByteString( pC->GetStyle(), eEncoding ) );
- rOStream << (sal_uInt16)pC->GetFamily();
-
- // Paragraph attributes ...
- pC->GetParaAttribs().Store( rOStream );
-
- // The number of attributes ...
- sal_uInt16 nAttribs = pC->GetAttribs().Count();
- rOStream << nAttribs;
-
- // 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++ )
- {
- XEditAttribute* pX = pC->GetAttribs().GetObject( nAttr );
-
- rOStream << pX->GetItem()->Which();
- GetPool()->StoreSurrogate( rOStream, pX->GetItem() );
- rOStream << pX->GetStart();
- rOStream << pX->GetEnd();
- }
- }
-
- rOStream << nMetric;
-
- rOStream << nUserType;
- rOStream << nObjSettings;
-
- rOStream << bVertical;
- rOStream << nScriptType;
-
- rOStream << bStoreUnicodeStrings;
- if ( bStoreUnicodeStrings )
- {
- for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
- {
- ContentInfo* pC = GetContents().GetObject( nPara );
- sal_uInt16 nL = pC->GetText().Len();
- rOStream << nL;
- rOStream.Write( pC->GetText().GetBuffer(), nL*sizeof(sal_Unicode) );
-
- // 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();
- rOStream << nL;
- rOStream.Write( pC->GetStyle().GetBuffer(), nL*sizeof(sal_Unicode) );
- }
- }
-}
-
-void BinTextObject::CreateData( SvStream& rIStream )
-{
- rIStream >> nVersion;
-
- // The text object was first created with the current setting of
- // pTextObjectPool.
- sal_Bool bOwnerOfCurrent = bOwnerOfPool;
- rIStream >> bOwnerOfPool;
-
- if ( bOwnerOfCurrent && !bOwnerOfPool )
- {
- // 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 )
- {
- // A global Pool should be used, but this Textobject has its own.
- pPool = EditEngine::CreatePool();
- }
-
- if ( bOwnerOfPool )
- GetPool()->Load( rIStream );
-
- // CharSet, in which it was saved:
- sal_uInt16 nCharSet;
- rIStream >> nCharSet;
-
- rtl_TextEncoding eSrcEncoding = GetSOLoadTextEncoding( (rtl_TextEncoding)nCharSet, (sal_uInt16)rIStream.GetVersion() );
-
- // The number of paragraphs ...
- sal_uInt16 nParagraphs;
- rIStream >> nParagraphs;
-
- // The individual paragraphs ...
- for ( sal_uLong nPara = 0; nPara < nParagraphs; nPara++ )
- {
- ContentInfo* pC = CreateAndInsertContent();
-
- // The Text...
- ByteString aByteString;
- rIStream.ReadByteString( aByteString );
- pC->GetText() = String( aByteString, eSrcEncoding );
-
- // StyleName and Family...
- rIStream.ReadByteString( pC->GetStyle(), eSrcEncoding );
- sal_uInt16 nStyleFamily;
- rIStream >> nStyleFamily;
- pC->GetFamily() = (SfxStyleFamily)nStyleFamily;
-
- // Paragraph attributes ...
- pC->GetParaAttribs().Load( rIStream );
-
- // The number of attributes ...
- sal_uInt16 nAttribs;
- rIStream >> nAttribs;
-
- // 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++ )
- {
- sal_uInt16 _nWhich, nStart, nEnd;
- const SfxPoolItem* pItem;
-
- rIStream >> _nWhich;
- _nWhich = pPool->GetNewWhich( _nWhich );
- pItem = pPool->LoadSurrogate( rIStream, _nWhich, 0 );
- rIStream >> nStart;
- rIStream >> nEnd;
- if ( pItem )
- {
- if ( pItem->Which() == EE_FEATURE_NOTCONV )
- {
- pC->GetText().SetChar( nStart, ByteString::ConvertToUnicode( aByteString.GetChar( nStart ), ((SvxCharSetColorItem*)pItem)->GetCharSet() ) );
- }
- else
- {
- XEditAttribute* pAttr = new XEditAttribute( *pItem, nStart, nEnd );
- pC->GetAttribs().Insert( pAttr, pC->GetAttribs().Count() );
-
- if ( ( _nWhich >= EE_FEATURE_START ) && ( _nWhich <= EE_FEATURE_END ) )
- {
- // Convert CH_FEATURE to CH_FEATURE_OLD
- DBG_ASSERT( (sal_uInt8) aByteString.GetChar( nStart ) == CH_FEATURE_OLD, "CreateData: CH_FEATURE expected!" );
- if ( (sal_uInt8) aByteString.GetChar( nStart ) == CH_FEATURE_OLD )
- pC->GetText().SetChar( nStart, CH_FEATURE );
- }
- }
- }
- }
-
- // But check for paragraph and character symbol attribs here,
- // FinishLoad will not be called in OpenOffice Calc, no StyleSheets...
-
- sal_Bool bSymbolPara = sal_False;
- if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON )
- {
- const SvxFontItem& rFontItem = (const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO );
- if ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
- {
- pC->GetText() = String( aByteString, RTL_TEXTENCODING_SYMBOL );
- bSymbolPara = sal_True;
- }
- }
-
- for ( nAttr = pC->GetAttribs().Count(); nAttr; )
- {
- XEditAttribute* pAttr = pC->GetAttribs().GetObject( --nAttr );
- if ( pAttr->GetItem()->Which() == EE_CHAR_FONTINFO )
- {
- const SvxFontItem& rFontItem = (const SvxFontItem&)*pAttr->GetItem();
- if ( ( !bSymbolPara && ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL ) )
- || ( bSymbolPara && ( rFontItem.GetCharSet() != RTL_TEXTENCODING_SYMBOL ) ) )
- {
- // Not correctly converted
- ByteString aPart( aByteString, pAttr->GetStart(), pAttr->GetEnd()-pAttr->GetStart() );
- String aNew( aPart, rFontItem.GetCharSet() );
- pC->GetText().Erase( pAttr->GetStart(), pAttr->GetEnd()-pAttr->GetStart() );
- pC->GetText().Insert( aNew, pAttr->GetStart() );
- }
-
- // Convert StarMath and StarBats to StarSymbol
- FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FONTTOSUBSFONT_IMPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
- if ( hConv )
- {
- SvxFontItem aNewFontItem( rFontItem );
- aNewFontItem.SetFamilyName( GetFontToSubsFontName( hConv ) );
-
- pC->GetAttribs().Remove( nAttr );
- XEditAttribute* pNewAttr = CreateAttrib( aNewFontItem, pAttr->GetStart(), pAttr->GetEnd() );
- pC->GetAttribs().Insert( pNewAttr, nAttr );
- DestroyAttrib( pAttr );
-
- for ( sal_uInt16 nChar = pNewAttr->GetStart(); nChar < pNewAttr->GetEnd(); nChar++ )
- {
- sal_Unicode cOld = pC->GetText().GetChar( nChar );
- DBG_ASSERT( cOld >= 0xF000, "cOld not converted?!" );
- sal_Unicode cConv = ConvertFontToSubsFontChar( hConv, cOld );
- if ( cConv )
- pC->GetText().SetChar( nChar, cConv );
- }
-
- DestroyFontToSubsFontConverter( hConv );
- }
- }
- }
-
-
- // Convert StarMath and StarBats to StarSymbol
- // Maybe old symbol font as paragraph attribute?
- if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON )
- {
- const SvxFontItem& rFontItem = (const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO );
- FontToSubsFontConverter hConv = CreateFontToSubsFontConverter( rFontItem.GetFamilyName(), FONTTOSUBSFONT_IMPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
- if ( hConv )
- {
- SvxFontItem aNewFontItem( rFontItem );
- aNewFontItem.SetFamilyName( GetFontToSubsFontName( hConv ) );
- pC->GetParaAttribs().Put( aNewFontItem );
-
- for ( sal_uInt16 nChar = 0; nChar < pC->GetText().Len(); nChar++ )
- {
- if ( !pC->GetAttribs().FindAttrib( EE_CHAR_FONTINFO, nChar ) )
- {
- sal_Unicode cOld = pC->GetText().GetChar( nChar );
- DBG_ASSERT( cOld >= 0xF000, "cOld not converted?!" );
- sal_Unicode cConv = ConvertFontToSubsFontChar( hConv, cOld );
- if ( cConv )
- pC->GetText().SetChar( nChar, cConv );
- }
- }
-
- DestroyFontToSubsFontConverter( hConv );
- }
- }
- }
-
- // From 400 also the DefMetric:
- if ( nVersion >= 400 )
- {
- sal_uInt16 nTmpMetric;
- rIStream >> nTmpMetric;
- if ( nVersion >= 401 )
- {
- // 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 );
- }
- }
-
- if ( nVersion >= 600 )
- {
- rIStream >> nUserType;
- rIStream >> nObjSettings;
- }
-
- if ( nVersion >= 601 )
- {
- rIStream >> bVertical;
- }
-
- if ( nVersion >= 602 )
- {
- rIStream >> nScriptType;
-
- sal_Bool bUnicodeStrings;
- rIStream >> bUnicodeStrings;
- if ( bUnicodeStrings )
- {
- for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
- {
- ContentInfo* pC = GetContents().GetObject( nPara );
- sal_uInt16 nL;
-
- // Text
- rIStream >> nL;
- if ( nL )
- {
- pC->GetText().AllocBuffer( nL );
- rIStream.Read( pC->GetText().GetBufferAccess(), nL*sizeof(sal_Unicode) );
- pC->GetText().ReleaseBufferAccess( (sal_uInt16)nL );
- }
-
- // StyleSheetName
- rIStream >> nL;
- if ( nL )
- {
- pC->GetStyle().AllocBuffer( nL );
- rIStream.Read( pC->GetStyle().GetBufferAccess(), nL*sizeof(sal_Unicode) );
- pC->GetStyle().ReleaseBufferAccess( (sal_uInt16)nL );
- }
- }
- }
- }
-
-
- // 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++ )
- {
- ContentInfo* pC = aContents.GetObject( n );
- const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&) pC->GetParaAttribs().Get( EE_PARA_LRSPACE );
- if ( rLRSpace.GetTxtLeft() && ( pC->GetParaAttribs().GetItemState( EE_PARA_TABS ) == SFX_ITEM_ON ) )
- {
- const SvxTabStopItem& rTabs = (const SvxTabStopItem&) pC->GetParaAttribs().Get( EE_PARA_TABS );
- SvxTabStopItem aNewTabs( 0, 0, SVX_TAB_ADJUST_LEFT, EE_PARA_TABS );
- for ( sal_uInt16 t = 0; t < rTabs.Count(); t++ )
- {
- const SvxTabStop& rT = rTabs[ t ];
- aNewTabs.Insert( SvxTabStop( rT.GetTabPos() - rLRSpace.GetTxtLeft(),
- rT.GetAdjustment(), rT.GetDecimal(), rT.GetFill() ) );
- }
- pC->GetParaAttribs().Put( aNewTabs );
- }
- }
- }
-}
-
-sal_uInt16 BinTextObject::GetVersion() const
-{
- return nVersion;
-}
-
-bool BinTextObject::operator==( const BinTextObject& rCompare ) const
-{
- if( this == &rCompare )
- return true;
-
- if( ( aContents.Count() != rCompare.aContents.Count() ) ||
- ( pPool != rCompare.pPool ) ||
- ( nMetric != rCompare.nMetric ) ||
- ( nUserType!= rCompare.nUserType ) ||
- ( nScriptType != rCompare.nScriptType ) ||
- ( bVertical != rCompare.bVertical ) )
- return false;
-
- sal_uInt16 n;
- for( n = 0; n < aContents.Count(); n++ )
- {
- if( !( *aContents.GetObject( n ) == *rCompare.aContents.GetObject( n ) ) )
- return false;
- }
-
- return true;
-}
-
-// #i102062#
-bool BinTextObject::isWrongListEqual(const BinTextObject& rCompare) const
-{
- if(GetContents().Count() != rCompare.GetContents().Count())
- {
- return false;
- }
-
- for(sal_uInt16 a(0); a < GetContents().Count(); a++)
- {
- const ContentInfo& rCandA(*GetContents().GetObject(a));
- const ContentInfo& rCandB(*rCompare.GetContents().GetObject(a));
-
- if(!rCandA.isWrongListEqual(rCandB))
- {
- return false;
- }
- }
-
- return true;
-}
-
-#define CHARSETMARKER 0x9999
-
-void BinTextObject::CreateData300( SvStream& rIStream )
-{
- // For forward compatibility.
-
- // First load the Pool...
- // Is always saved in the 300!
- GetPool()->Load( rIStream );
-
- // The number of paragraphs ...
- sal_uInt32 nParagraphs;
- rIStream >> nParagraphs;
-
- // The individual paragraphs...
- for ( sal_uLong nPara = 0; nPara < nParagraphs; nPara++ )
- {
- ContentInfo* pC = CreateAndInsertContent();
-
- // The Text...
- rIStream.ReadByteString( pC->GetText() );
-
- // StyleName and Family...
- rIStream.ReadByteString( pC->GetStyle() );
- sal_uInt16 nStyleFamily;
- rIStream >> nStyleFamily;
- pC->GetFamily() = (SfxStyleFamily)nStyleFamily;
-
- // Paragraph attributes ...
- pC->GetParaAttribs().Load( rIStream );
-
- // The number of attributes ...
- sal_uInt32 nAttribs;
- rIStream >> nAttribs;
-
- // 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++ )
- {
- sal_uInt16 _nWhich, nStart, nEnd;
- const SfxPoolItem* pItem;
-
- rIStream >> _nWhich;
- _nWhich = pPool->GetNewWhich( _nWhich );
- pItem = pPool->LoadSurrogate( rIStream, _nWhich, 0 );
- rIStream >> nStart;
- rIStream >> nEnd;
- if ( pItem )
- {
- XEditAttribute* pAttr = new XEditAttribute( *pItem, nStart, nEnd );
- pC->GetAttribs().Insert( pAttr, pC->GetAttribs().Count() );
- }
- }
- }
-
- // Check whether a font was saved
- sal_uInt16 nCharSetMarker;
- rIStream >> nCharSetMarker;
- if ( nCharSetMarker == CHARSETMARKER )
- {
- sal_uInt16 nCharSet;
- rIStream >> nCharSet;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
deleted file mode 100644
index f7bb04e91b..0000000000
--- a/editeng/source/editeng/editobj2.hxx
+++ /dev/null
@@ -1,305 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDITOBJ2_HXX
-#define _EDITOBJ2_HXX
-
-#include <editeng/editobj.hxx>
-#include <editdoc.hxx>
-
-#include <unotools/fontcvt.hxx>
-
-
-class SfxStyleSheetPool;
-
-class XEditAttribute
-{
- friend class ContentInfo; // for destructor
- friend class BinTextObject; // for destructor
-
-private:
- const SfxPoolItem* pItem;
- sal_uInt16 nStart;
- sal_uInt16 nEnd;
-
- XEditAttribute();
- XEditAttribute( const XEditAttribute& rCopyFrom );
-
- ~XEditAttribute();
-
-public:
- XEditAttribute( const SfxPoolItem& rAttr );
- XEditAttribute( const SfxPoolItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- const SfxPoolItem* GetItem() const { return pItem; }
-
- sal_uInt16& GetStart() { return nStart; }
- sal_uInt16& GetEnd() { return nEnd; }
-
- sal_uInt16 GetStart() const { return nStart; }
- sal_uInt16 GetEnd() const { return nEnd; }
-
- sal_uInt16 GetLen() const { return nEnd-nStart; }
-
- inline sal_Bool IsFeature();
-
- inline bool operator==( const XEditAttribute& rCompare );
-};
-
-inline bool XEditAttribute::operator==( const XEditAttribute& rCompare )
-{
- return (nStart == rCompare.nStart) &&
- (nEnd == rCompare.nEnd) &&
- ( (pItem == rCompare.pItem) ||
- ( pItem->Which() != rCompare.pItem->Which()) ||
- (*pItem == *rCompare.pItem));
-}
-
-inline sal_Bool XEditAttribute::IsFeature()
-{
- sal_uInt16 nWhich = pItem->Which();
- return ( ( nWhich >= EE_FEATURE_START ) &&
- ( nWhich <= EE_FEATURE_END ) );
-}
-
-typedef XEditAttribute* XEditAttributePtr;
-SV_DECL_PTRARR( XEditAttributeListImpl, XEditAttributePtr, 0, 4 )
-
-class XEditAttributeList : public XEditAttributeListImpl
-{
-public:
- XEditAttribute* FindAttrib( sal_uInt16 nWhich, sal_uInt16 nChar ) const;
-};
-
-struct XParaPortion
-{
- long nHeight;
- sal_uInt16 nFirstLineOffset;
-
- EditLineList aLines;
- TextPortionList aTextPortions;
-};
-
-typedef XParaPortion* XParaPortionPtr;
-SV_DECL_PTRARR( XBaseParaPortionList, XParaPortionPtr, 0, 4 )
-
-class XParaPortionList : public XBaseParaPortionList
-{
- sal_uIntPtr nRefDevPtr;
- OutDevType eRefDevType;
- MapMode aRefMapMode;
- sal_uInt16 nStretchX;
- sal_uInt16 nStretchY;
- sal_uLong nPaperWidth;
-
-
-public:
- 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();
- }
-
- sal_uIntPtr GetRefDevPtr() const { return nRefDevPtr; }
- sal_uLong GetPaperWidth() const { return nPaperWidth; }
- OutDevType GetRefDevType() const { return eRefDevType; }
- const MapMode& GetRefMapMode() const { return aRefMapMode; }
- sal_uInt16 GetStretchX() const { return nStretchX; }
- sal_uInt16 GetStretchY() const { return nStretchY; }
-};
-
-/* cl removed because not needed anymore since binfilter
-struct LoadStoreTempInfos
-{
- ByteString aOrgString_Load;
-
- FontToSubsFontConverter hOldSymbolConv_Store;
- sal_Bool bSymbolParagraph_Store;
-
-
- LoadStoreTempInfos() { bSymbolParagraph_Store = sal_False; hOldSymbolConv_Store = NULL; }
-};
-*/
-
-class ContentInfo
-{
- friend class BinTextObject;
-
-private:
- String aText;
- String aStyle;
- XEditAttributeList aAttribs;
- SfxStyleFamily eFamily;
- SfxItemSet aParaAttribs;
- WrongList* pWrongs;
-
- ContentInfo( SfxItemPool& rPool );
- ContentInfo( const ContentInfo& rCopyFrom, SfxItemPool& rPoolToUse );
-
-public:
- ~ContentInfo();
-
- const String& GetText() const { return aText; }
- const String& GetStyle() const { return aStyle; }
- const XEditAttributeList& GetAttribs() const { return aAttribs; }
- const SfxItemSet& GetParaAttribs() const { return aParaAttribs; }
- SfxStyleFamily GetFamily() const { return eFamily; }
-
- String& GetText() { return aText; }
- String& GetStyle() { return aStyle; }
- XEditAttributeList& GetAttribs() { return aAttribs; }
- SfxItemSet& GetParaAttribs() { return aParaAttribs; }
- SfxStyleFamily& GetFamily() { return eFamily; }
-
- WrongList* GetWrongList() const { return pWrongs; }
- void SetWrongList( WrongList* p ) { pWrongs = p; }
- bool operator==( const ContentInfo& rCompare ) const;
-
- // #i102062#
- bool isWrongListEqual(const ContentInfo& rCompare) const;
-};
-
-typedef ContentInfo* ContentInfoPtr;
-SV_DECL_PTRARR( ContentInfoList, ContentInfoPtr, 1, 4 )
-
-class BinTextObject : public EditTextObject, public SfxItemPoolUser
-{
- using EditTextObject::operator==;
- using EditTextObject::isWrongListEqual;
-
-private:
- ContentInfoList aContents;
- SfxItemPool* pPool;
- sal_Bool bOwnerOfPool;
- XParaPortionList* pPortionInfo;
-
- sal_uInt32 nObjSettings;
- sal_uInt16 nMetric;
- sal_uInt16 nVersion;
- sal_uInt16 nUserType;
- sal_uInt16 nScriptType;
-
- sal_Bool bVertical;
- sal_Bool bStoreUnicodeStrings;
-
-protected:
- void DeleteContents();
- virtual void StoreData( SvStream& rOStream ) const;
- virtual void CreateData( SvStream& rIStream );
- sal_Bool ImpChangeStyleSheets( const String& rOldName, SfxStyleFamily eOldFamily,
- const String& rNewName, SfxStyleFamily eNewFamily );
-
-public:
- BinTextObject( SfxItemPool* pPool );
- BinTextObject( const BinTextObject& );
- virtual ~BinTextObject();
-
- virtual EditTextObject* Clone() const;
-
- sal_uInt16 GetUserType() const;
- void SetUserType( sal_uInt16 n );
-
- sal_uLong GetObjectSettings() const;
- void SetObjectSettings( sal_uLong n );
-
- sal_Bool IsVertical() const;
- void SetVertical( sal_Bool b );
-
- sal_uInt16 GetScriptType() const;
- void SetScriptType( sal_uInt16 nType );
-
- 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 );
- void DestroyAttrib( XEditAttribute* pAttr );
-
- ContentInfoList& GetContents() { return aContents; }
- const ContentInfoList& GetContents() const { return aContents; }
- SfxItemPool* GetPool() const { return pPool; }
- XParaPortionList* GetPortionInfo() const { return pPortionInfo; }
- void SetPortionInfo( XParaPortionList* pP )
- { pPortionInfo = pP; }
-
- virtual sal_uInt16 GetParagraphCount() const;
- virtual String GetText( sal_uInt16 nParagraph ) const;
- virtual void Insert( const EditTextObject& rObj, sal_uInt16 nPara );
- virtual EditTextObject* CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas = 1 ) const;
- virtual void RemoveParagraph( sal_uInt16 nPara );
-
- virtual sal_Bool HasPortionInfo() const;
- virtual void ClearPortionInfo();
-
- virtual sal_Bool HasOnlineSpellErrors() const;
-
- virtual sal_Bool HasCharAttribs( sal_uInt16 nWhich = 0 ) const;
- virtual void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const;
-
- virtual sal_Bool RemoveCharAttribs( sal_uInt16 nWhich = 0 );
- virtual sal_Bool RemoveParaAttribs( sal_uInt16 nWhich = 0 );
-
- virtual void MergeParaAttribs( const SfxItemSet& rAttribs, sal_uInt16 nStart, sal_uInt16 nEnd );
-
- virtual sal_Bool IsFieldObject() const;
- virtual const SvxFieldItem* GetField() const;
- virtual sal_Bool HasField( TypeId Type = NULL ) const;
-
- SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
- void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rAttribs );
-
- virtual sal_Bool HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const;
- virtual void GetStyleSheet( sal_uInt16 nPara, XubString& rName, SfxStyleFamily& eFamily ) const;
- virtual void SetStyleSheet( sal_uInt16 nPara, const XubString& rName, const SfxStyleFamily& eFamily );
- virtual sal_Bool ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily,
- const String& rNewName, SfxStyleFamily eNewFamily );
- virtual void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName );
-
- void CreateData300( SvStream& rIStream );
-
- sal_Bool HasMetric() const { return nMetric != 0xFFFF; }
- sal_uInt16 GetMetric() const { return nMetric; }
- void SetMetric( sal_uInt16 n ) { nMetric = n; }
-
- sal_Bool IsOwnerOfPool() const { return bOwnerOfPool; }
- void StoreUnicodeStrings( sal_Bool b ) { bStoreUnicodeStrings = b; }
-
- bool operator==( const BinTextObject& rCompare ) const;
-
- // #i102062#
- bool isWrongListEqual(const BinTextObject& rCompare) const;
-
- // from SfxItemPoolUser
- virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool);
-};
-
-#endif // _EDITOBJ2_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editsel.cxx b/editeng/source/editeng/editsel.cxx
deleted file mode 100644
index 6da806b243..0000000000
--- a/editeng/source/editeng/editsel.cxx
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <eeng_pch.hxx>
-
-#include <editsel.hxx>
-#include <impedit.hxx>
-#include <editeng/editview.hxx>
-
-// ----------------------------------------------------------------------
-// class EditSelFunctionSet
-// ----------------------------------------------------------------------
-EditSelFunctionSet::EditSelFunctionSet()
-{
- pCurView = NULL;
-}
-
-void EditSelFunctionSet::CreateAnchor()
-{
- if ( pCurView )
- pCurView->pImpEditView->CreateAnchor();
-}
-
-void EditSelFunctionSet::DestroyAnchor()
-{
- // Only with multiple selection
-}
-
-sal_Bool EditSelFunctionSet::SetCursorAtPoint( const Point& rPointPixel, sal_Bool )
-{
- if ( pCurView )
- return pCurView->pImpEditView->SetCursorAtPoint( rPointPixel );
-
- return sal_False;
-}
-
-sal_Bool EditSelFunctionSet::IsSelectionAtPoint( const Point& rPointPixel )
-{
- if ( pCurView )
- return pCurView->pImpEditView->IsSelectionAtPoint( rPointPixel );
-
- return sal_False;
-}
-
-void EditSelFunctionSet::DeselectAtPoint( const Point& )
-{
-// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-// ! Implement when multiple selection is possible !
-// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-}
-
-void EditSelFunctionSet::BeginDrag()
-{
- // Only with multiple selection
-}
-
-
-void EditSelFunctionSet::DeselectAll()
-{
- if ( pCurView )
- pCurView->pImpEditView->DeselectAll();
-}
-
-// ----------------------------------------------------------------------
-// class EditSelectionEngine
-// ----------------------------------------------------------------------
-EditSelectionEngine::EditSelectionEngine() : SelectionEngine( (Window*)0 )
-{
- SetSelectionMode( RANGE_SELECTION );
- EnableDrag( sal_True );
-}
-
-void EditSelectionEngine::SetCurView( EditView* pNewView )
-{
- if ( GetFunctionSet() )
- ((EditSelFunctionSet*)GetFunctionSet())->SetCurView( pNewView );
-
- if ( pNewView )
- SetWindow( pNewView->GetWindow() );
- else
- SetWindow( (Window*)0 );
-}
-
-EditView* EditSelectionEngine::GetCurView()
-{
- EditView* pView = 0;
- if ( GetFunctionSet() )
- pView = ((EditSelFunctionSet*)GetFunctionSet())->GetCurView();
-
- return pView;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editsel.hxx b/editeng/source/editeng/editsel.hxx
deleted file mode 100644
index 034d61cdb1..0000000000
--- a/editeng/source/editeng/editsel.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDITSEL_HXX
-#define _EDITSEL_HXX
-
-#include <vcl/seleng.hxx>
-
-class EditView;
-
-class EditSelFunctionSet: public FunctionSet
-{
-private:
- EditView* pCurView;
-
-public:
- EditSelFunctionSet();
-
- virtual void BeginDrag();
-
- virtual void CreateAnchor();
- virtual void DestroyAnchor();
-
- virtual sal_Bool SetCursorAtPoint( const Point& rPointPixel, sal_Bool bDontSelectAtCursor = sal_False );
-
- virtual sal_Bool IsSelectionAtPoint( const Point& rPointPixel );
- virtual void DeselectAtPoint( const Point& rPointPixel );
- virtual void DeselectAll();
-
- void SetCurView( EditView* pView ) { pCurView = pView; }
- EditView* GetCurView() { return pCurView; }
-};
-
-class EditSelectionEngine : public SelectionEngine
-{
-private:
-
-public:
- EditSelectionEngine();
-
- void SetCurView( EditView* pNewView );
- EditView* GetCurView();
-};
-
-#endif // _EDITSEL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editstt2.hxx b/editeng/source/editeng/editstt2.hxx
deleted file mode 100644
index a992f21534..0000000000
--- a/editeng/source/editeng/editstt2.hxx
+++ /dev/null
@@ -1,132 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDITSTT2_HXX
-#define _EDITSTT2_HXX
-
-#include <editeng/editstat.hxx>
-
-class InternalEditStatus : public EditStatus
-{
-
-public:
- InternalEditStatus() { ; }
-
- void TurnOnFlags( sal_uLong nFlags )
- { nControlBits |= nFlags; }
-
- void TurnOffFlags( sal_uLong nFlags )
- { nControlBits &= ~nFlags; }
-
- void TurnOnStatusBits( sal_uLong nBits )
- { nStatusBits |= nBits; }
-
- void TurnOffStatusBits( sal_uLong nBits )
- { nStatusBits &= ~nBits; }
-
-
- sal_Bool UseCharAttribs() const
- { return ( ( nControlBits & EE_CNTRL_USECHARATTRIBS ) != 0 ); }
-
- sal_Bool NotifyCursorMovements() const
- { return ( ( nControlBits & EE_CNTRL_CRSRLEFTPARA ) != 0 ); }
-
- sal_Bool UseIdleFormatter() const
- { return ( ( nControlBits & EE_CNTRL_DOIDLEFORMAT) != 0 ); }
-
- sal_Bool AllowPasteSpecial() const
- { return ( ( nControlBits & EE_CNTRL_PASTESPECIAL ) != 0 ); }
-
- sal_Bool DoAutoIndenting() const
- { return ( ( nControlBits & EE_CNTRL_AUTOINDENTING ) != 0 ); }
-
- sal_Bool DoUndoAttribs() const
- { return ( ( nControlBits & EE_CNTRL_UNDOATTRIBS ) != 0 ); }
-
- sal_Bool OneCharPerLine() const
- { return ( ( nControlBits & EE_CNTRL_ONECHARPERLINE ) != 0 ); }
-
- sal_Bool IsOutliner() const
- { return ( ( nControlBits & EE_CNTRL_OUTLINER ) != 0 ); }
-
- sal_Bool IsOutliner2() const
- { return ( ( nControlBits & EE_CNTRL_OUTLINER2 ) != 0 ); }
-
- sal_Bool IsAnyOutliner() const
- { return IsOutliner() || IsOutliner2(); }
-
- sal_Bool DoNotUseColors() const
- { return ( ( nControlBits & EE_CNTRL_NOCOLORS ) != 0 ); }
-
- sal_Bool AllowBigObjects() const
- { return ( ( nControlBits & EE_CNTRL_ALLOWBIGOBJS ) != 0 ); }
-
- sal_Bool DoOnlineSpelling() const
- { return ( ( nControlBits & EE_CNTRL_ONLINESPELLING ) != 0 ); }
-
- sal_Bool DoStretch() const
- { return ( ( nControlBits & EE_CNTRL_STRETCHING ) != 0 ); }
-
- sal_Bool AutoPageSize() const
- { return ( ( nControlBits & EE_CNTRL_AUTOPAGESIZE ) != 0 ); }
- sal_Bool AutoPageWidth() const
- { return ( ( nControlBits & EE_CNTRL_AUTOPAGESIZEX ) != 0 ); }
- sal_Bool AutoPageHeight() const
- { return ( ( nControlBits & EE_CNTRL_AUTOPAGESIZEY ) != 0 ); }
-
- sal_Bool MarkFields() const
- { return ( ( nControlBits & EE_CNTRL_MARKFIELDS ) != 0 ); }
-
- sal_Bool DoRestoreFont() const
- { return ( ( nControlBits & EE_CNTRL_RESTOREFONT ) != 0 ); }
-
- sal_Bool DoImportRTFStyleSheets() const
- { return ( ( nControlBits & EE_CNTRL_RTFSTYLESHEETS ) != 0 ); }
-
- sal_Bool DoAutoCorrect() const
- { return ( ( nControlBits & EE_CNTRL_AUTOCORRECT ) != 0 ); }
-
- sal_Bool DoAutoComplete() const
- { return ( ( nControlBits & EE_CNTRL_AUTOCOMPLETE ) != 0 ); }
-
- sal_Bool DoTabIndenting() const
- { return ( ( nControlBits & EE_CNTRL_TABINDENTING ) != 0 ); }
-
- sal_Bool DoFormat100() const
- { return ( ( nControlBits & EE_CNTRL_FORMAT100 ) != 0 ); }
-
- sal_Bool ULSpaceSummation() const
- { return ( ( nControlBits & EE_CNTRL_ULSPACESUMMATION ) != 0 ); }
-
- sal_Bool ULSpaceFirstParagraph() const
- { return ( ( nControlBits & EE_CNTRL_ULSPACEFIRSTPARA ) != 0 ); }
-};
-
-#endif // _EDITSTT2_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
deleted file mode 100644
index d59bb93503..0000000000
--- a/editeng/source/editeng/editundo.cxx
+++ /dev/null
@@ -1,707 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <eeng_pch.hxx>
-
-#include <impedit.hxx>
-#include <editundo.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/editeng.hxx>
-
-DBG_NAME( EditUndo )
-
-#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
-
-TYPEINIT1( EditUndo, SfxUndoAction );
-TYPEINIT1( EditUndoDelContent, EditUndo );
-TYPEINIT1( EditUndoConnectParas, EditUndo );
-TYPEINIT1( EditUndoSplitPara, EditUndo );
-TYPEINIT1( EditUndoInsertChars, EditUndo );
-TYPEINIT1( EditUndoRemoveChars, EditUndo );
-TYPEINIT1( EditUndoInsertFeature, EditUndo );
-TYPEINIT1( EditUndoMoveParagraphs, EditUndo );
-TYPEINIT1( EditUndoSetStyleSheet, EditUndo );
-TYPEINIT1( EditUndoSetParaAttribs, EditUndo );
-TYPEINIT1( EditUndoSetAttribs, EditUndo );
-TYPEINIT1( EditUndoTransliteration, EditUndo );
-TYPEINIT1( EditUndoMarkSelection, EditUndo );
-
-void lcl_DoSetSelection( EditView* pView, sal_uInt16 nPara )
-{
- EPaM aEPaM( nPara, 0 );
- EditPaM aPaM( pView->GetImpEditEngine()->CreateEditPaM( aEPaM ) );
- aPaM.SetIndex( aPaM.GetNode()->Len() );
- EditSelection aSel( aPaM, aPaM );
- pView->GetImpEditView()->SetEditSelection( aSel );
-}
-
-EditUndoManager::EditUndoManager( ImpEditEngine* p )
-{
- pImpEE = p;
-}
-
-sal_Bool EditUndoManager::Undo()
-{
- if ( GetUndoActionCount() == 0 )
- return sal_False;
-
- DBG_ASSERT( pImpEE->GetActiveView(), "Active View?" );
-
- if ( !pImpEE->GetActiveView() )
- {
- if ( pImpEE->GetEditViews().Count() )
- pImpEE->SetActiveView( pImpEE->GetEditViews().GetObject(0) );
- else
- {
- OSL_FAIL("Undo in engine is not possible without a View! ");
- return sal_False;
- }
- }
-
- 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(), "Invalid selection after Undo () ");
- DBG_ASSERT( !aNewSel.DbgIsBuggy( pImpEE->GetEditDoc() ), "Broken selection afte Undo () ");
-
- aNewSel.Min() = aNewSel.Max();
- pImpEE->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
- pImpEE->FormatAndUpdate( pImpEE->GetActiveView() );
-
- return bDone;
-}
-
-sal_Bool EditUndoManager::Redo()
-{
- if ( GetRedoActionCount() == 0 )
- return sal_False;
-
- DBG_ASSERT( pImpEE->GetActiveView(), "Active View?" );
-
- if ( !pImpEE->GetActiveView() )
- {
- if ( pImpEE->GetEditViews().Count() )
- pImpEE->SetActiveView( pImpEE->GetEditViews().GetObject(0) );
- else
- {
- OSL_FAIL( "Redo in Engine ohne View nicht moeglich!" );
- return sal_False;
- }
- }
-
- 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(), "Invalid selection after Undo () ");
- DBG_ASSERT( !aNewSel.DbgIsBuggy( pImpEE->GetEditDoc() ), "Broken selection afte Undo () ");
-
- aNewSel.Min() = aNewSel.Max();
- pImpEE->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
- pImpEE->FormatAndUpdate( pImpEE->GetActiveView() );
-
- return bDone;
-}
-
-EditUndo::EditUndo( sal_uInt16 nI, ImpEditEngine* p )
-{
- DBG_CTOR( EditUndo, 0 );
- nId = nI;
- pImpEE = p;
-}
-
-EditUndo::~EditUndo()
-{
- DBG_DTOR( EditUndo, 0 );
-}
-
-sal_uInt16 EditUndo::GetId() const
-{
- DBG_CHKTHIS( EditUndo, 0 );
- return nId;
-}
-
-sal_Bool EditUndo::CanRepeat(SfxRepeatTarget&) const
-{
- return sal_False;
-}
-
-XubString EditUndo::GetComment() const
-{
- XubString aComment;
- if ( pImpEE )
- {
- EditEngine* pEditEng = pImpEE->GetEditEnginePtr();
- aComment = pEditEng->GetUndoComment( GetId() );
- }
- return aComment;
-}
-
-EditUndoDelContent::EditUndoDelContent( ImpEditEngine* _pImpEE, ContentNode* pNode, sal_uInt16 n )
- : EditUndo( EDITUNDO_DELCONTENT, _pImpEE )
-{
- pContentNode = pNode;
- nNode = n;
- bDelObject = sal_True;
-}
-
-EditUndoDelContent::~EditUndoDelContent()
-{
- if ( bDelObject )
- delete pContentNode;
-}
-
-void EditUndoDelContent::Undo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- GetImpEditEngine()->InsertContent( pContentNode, nNode );
- bDelObject = sal_False; // belongs to the Engine again
- EditSelection aSel( EditPaM( pContentNode, 0 ), EditPaM( pContentNode, pContentNode->Len() ) );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel );
-}
-
-void EditUndoDelContent::Redo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
-
- ImpEditEngine* _pImpEE = GetImpEditEngine();
-
- // 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 );
-
- // Do not delete node, depends on the undo!
- _pImpEE->GetEditDoc().Remove( nNode );
- if( _pImpEE->IsCallParaInsertedOrDeleted() )
- _pImpEE->GetEditEnginePtr()->ParagraphDeleted( nNode );
-
- DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pContentNode, nNode );
- _pImpEE->aDeletedNodes.Insert( pInf, _pImpEE->aDeletedNodes.Count() );
- _pImpEE->UpdateSelections();
-
- ContentNode* pN = ( nNode < _pImpEE->GetEditDoc().Count() )
- ? _pImpEE->GetEditDoc().SaveGetObject( nNode )
- : _pImpEE->GetEditDoc().SaveGetObject( nNode-1 );
- DBG_ASSERT( pN && ( pN != pContentNode ), "?! RemoveContent !? " );
- EditPaM aPaM( pN, pN->Len() );
-
- bDelObject = sal_True; // belongs to the Engine again
-
- _pImpEE->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
-}
-
-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 )
- : EditUndo( EDITUNDO_CONNECTPARAS, _pImpEE ),
- aLeftParaAttribs( rLeftParaAttribs ),
- aRightParaAttribs( rRightParaAttribs )
-{
- nNode = nN;
- nSepPos = nSP;
-
- if ( pLeftStyle )
- {
- aLeftStyleName = pLeftStyle->GetName();
- eLeftStyleFamily = pLeftStyle->GetFamily();
- }
- if ( pRightStyle )
- {
- aRightStyleName = pRightStyle->GetName();
- eRightStyleFamily = pRightStyle->GetFamily();
- }
-
- bBackward = bBkwrd;
-}
-
-EditUndoConnectParas::~EditUndoConnectParas()
-{
-}
-
-void EditUndoConnectParas::Undo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
-
- // 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 );
-
- EditPaM aPaM = GetImpEditEngine()->SplitContent( nNode, nSepPos );
- GetImpEditEngine()->SetParaAttribs( nNode, aLeftParaAttribs );
- GetImpEditEngine()->SetParaAttribs( nNode+1, aRightParaAttribs );
-
- GetImpEditEngine()->SetCallParaInsertedOrDeleted( bCall );
- if ( GetImpEditEngine()->IsCallParaInsertedOrDeleted() )
- GetImpEditEngine()->GetEditEnginePtr()->ParagraphInserted( nNode+1 );
-
- if ( GetImpEditEngine()->GetStyleSheetPool() )
- {
- if ( aLeftStyleName.Len() )
- GetImpEditEngine()->SetStyleSheet( (sal_uInt16)nNode, (SfxStyleSheet*)GetImpEditEngine()->GetStyleSheetPool()->Find( aLeftStyleName, eLeftStyleFamily ) );
- if ( aRightStyleName.Len() )
- GetImpEditEngine()->SetStyleSheet( nNode+1, (SfxStyleSheet*)GetImpEditEngine()->GetStyleSheetPool()->Find( aRightStyleName, eRightStyleFamily ) );
- }
-
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
-}
-
-void EditUndoConnectParas::Redo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Np Active View!" );
- EditPaM aPaM = GetImpEditEngine()->ConnectContents( nNode, bBackward );
-
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
-}
-
-EditUndoSplitPara::EditUndoSplitPara( ImpEditEngine* _pImpEE, sal_uInt16 nN, sal_uInt16 nSP )
- : EditUndo( EDITUNDO_SPLITPARA, _pImpEE )
-{
- nNode = nN;
- nSepPos = nSP;
-}
-
-EditUndoSplitPara::~EditUndoSplitPara()
-{
-}
-
-void EditUndoSplitPara::Undo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditPaM aPaM = GetImpEditEngine()->ConnectContents( nNode, sal_False );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
-}
-
-void EditUndoSplitPara::Redo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditPaM aPaM = GetImpEditEngine()->SplitContent( nNode, nSepPos );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) );
-}
-
-EditUndoInsertChars::EditUndoInsertChars( ImpEditEngine* _pImpEE, const EPaM& rEPaM, const XubString& rStr )
- : EditUndo( EDITUNDO_INSERTCHARS, _pImpEE ),
- aEPaM( rEPaM ), aText( rStr )
-{
-}
-
-void EditUndoInsertChars::Undo()
-{
- 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();
- EditPaM aNewPaM( GetImpEditEngine()->ImpDeleteSelection( aSel ) );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aNewPaM, aNewPaM ) );
-}
-
-void EditUndoInsertChars::Redo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" );
- EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) );
- GetImpEditEngine()->ImpInsertText( EditSelection( aPaM, aPaM ), aText );
- EditPaM aNewPaM( aPaM );
- aNewPaM.GetIndex() = aNewPaM.GetIndex() + aText.Len();
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aNewPaM ) );
-}
-
-sal_Bool EditUndoInsertChars::Merge( SfxUndoAction* pNextAction )
-{
- if ( !pNextAction->ISA( EditUndoInsertChars ) )
- return sal_False;
-
- EditUndoInsertChars* pNext = (EditUndoInsertChars*)pNextAction;
-
- if ( aEPaM.nPara != pNext->aEPaM.nPara )
- return sal_False;
-
- if ( ( aEPaM.nIndex + aText.Len() ) == pNext->aEPaM.nIndex )
- {
- aText += pNext->aText;
- return sal_True;
- }
- return sal_False;
-}
-
-EditUndoRemoveChars::EditUndoRemoveChars( ImpEditEngine* _pImpEE, const EPaM& rEPaM, const XubString& rStr )
- : EditUndo( EDITUNDO_REMOVECHARS, _pImpEE ),
- aEPaM( rEPaM ), aText( rStr )
-{
-}
-
-void EditUndoRemoveChars::Undo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: Keine Active View!" );
- EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) );
- EditSelection aSel( aPaM, aPaM );
- GetImpEditEngine()->ImpInsertText( aSel, aText );
- aSel.Max().GetIndex() = aSel.Max().GetIndex() + aText.Len();
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel );
-}
-
-void EditUndoRemoveChars::Redo()
-{
- 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();
- EditPaM aNewPaM = GetImpEditEngine()->ImpDeleteSelection( aSel );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewPaM );
-}
-
-EditUndoInsertFeature::EditUndoInsertFeature( ImpEditEngine* _pImpEE, const EPaM& rEPaM, const SfxPoolItem& rFeature)
- : EditUndo( EDITUNDO_INSERTFEATURE, _pImpEE ), aEPaM( rEPaM )
-{
- pFeature = rFeature.Clone();
- DBG_ASSERT( pFeature, "Feature could not be duplicated: EditUndoInsertFeature" );
-}
-
-EditUndoInsertFeature::~EditUndoInsertFeature()
-{
- delete pFeature;
-}
-
-void EditUndoInsertFeature::Undo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) );
- EditSelection aSel( aPaM, aPaM );
- // Attributes are then corrected implicitly by the document ...
- aSel.Max().GetIndex()++;
- GetImpEditEngine()->ImpDeleteSelection( aSel );
- aSel.Max().GetIndex()--; // For Selection
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel );
-}
-
-void EditUndoInsertFeature::Redo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditPaM aPaM( GetImpEditEngine()->CreateEditPaM( aEPaM ) );
- EditSelection aSel( aPaM, aPaM );
- GetImpEditEngine()->ImpInsertFeature( aSel, *pFeature );
- if ( pFeature->Which() == EE_FEATURE_FIELD )
- GetImpEditEngine()->UpdateFields();
- aSel.Max().GetIndex()++;
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel );
-}
-
-EditUndoMoveParagraphs::EditUndoMoveParagraphs
- ( ImpEditEngine* _pImpEE, const Range& rParas, sal_uInt16 n )
- : EditUndo( EDITUNDO_MOVEPARAGRAPHS, _pImpEE ),
- nParagraphs( rParas )
-{
- nDest = n;
-}
-
-EditUndoMoveParagraphs::~EditUndoMoveParagraphs()
-{
-}
-
-void EditUndoMoveParagraphs::Undo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- Range aTmpRange( nParagraphs );
- long nTmpDest = aTmpRange.Min();
-
- long nDiff = ( nDest - aTmpRange.Min() );
- aTmpRange.Min() += nDiff;
- aTmpRange.Max() += nDiff;
-
- if ( nParagraphs.Min() < (long)nDest )
- {
- long nLen = aTmpRange.Len();
- aTmpRange.Min() -= nLen;
- aTmpRange.Max() -= nLen;
- }
- else
- nTmpDest += aTmpRange.Len();
-
- EditSelection aNewSel( GetImpEditEngine()->MoveParagraphs( aTmpRange, (sal_uInt16)nTmpDest, 0 ) );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
-}
-
-void EditUndoMoveParagraphs::Redo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- EditSelection aNewSel( GetImpEditEngine()->MoveParagraphs( nParagraphs, nDest, 0 ) );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
-}
-
-EditUndoSetStyleSheet::EditUndoSetStyleSheet( ImpEditEngine* _pImpEE, sal_uInt16 nP,
- const XubString& rPrevName, SfxStyleFamily ePrevFam,
- const XubString& rNewName, SfxStyleFamily eNewFam,
- const SfxItemSet& rPrevParaAttribs )
- : EditUndo( EDITUNDO_STYLESHEET, _pImpEE ), aPrevName( rPrevName ), aNewName( rNewName ),
- aPrevParaAttribs( rPrevParaAttribs )
-{
- ePrevFamily = ePrevFam;
- eNewFamily = eNewFam;
- nPara = nP;
-}
-
-EditUndoSetStyleSheet::~EditUndoSetStyleSheet()
-{
-}
-
-void EditUndoSetStyleSheet::Undo()
-{
- 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 EditUndoSetStyleSheet::Redo()
-{
- 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( ImpEditEngine* _pImpEE, sal_uInt16 nP, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems )
- : EditUndo( EDITUNDO_PARAATTRIBS, _pImpEE ),
- aPrevItems( rPrevItems ),
- aNewItems(rNewItems )
-{
- nPara = nP;
-}
-
-EditUndoSetParaAttribs::~EditUndoSetParaAttribs()
-{
-}
-
-void EditUndoSetParaAttribs::Undo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- GetImpEditEngine()->SetParaAttribs( nPara, aPrevItems );
- lcl_DoSetSelection( GetImpEditEngine()->GetActiveView(), nPara );
-}
-
-void EditUndoSetParaAttribs::Redo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- GetImpEditEngine()->SetParaAttribs( nPara, aNewItems );
- lcl_DoSetSelection( GetImpEditEngine()->GetActiveView(), nPara );
-}
-
-EditUndoSetAttribs::EditUndoSetAttribs( ImpEditEngine* _pImpEE, const ESelection& rESel, const SfxItemSet& rNewItems )
- : EditUndo( EDITUNDO_ATTRIBS, _pImpEE ),
- aESel( rESel ),
- aNewAttribs( rNewItems )
-{
- // When EditUndoSetAttribs actually is a RemoveAttribs this could be
- // /recognize by the empty itemset, but then it would have to be caught in
- // its own place, which possible a setAttribs does with an empty itemset.
- bSetIsRemove = sal_False;
- bRemoveParaAttribs = sal_False;
- nRemoveWhich = 0;
- nSpecial = 0;
-}
-
-EditUndoSetAttribs::~EditUndoSetAttribs()
-{
- // Get Items from Pool...
- SfxItemPool* pPool = aNewAttribs.GetPool();
- sal_uInt16 nContents = aPrevAttribs.Count();
- for ( sal_uInt16 n = 0; n < nContents; n++ )
- {
- ContentAttribsInfo* pInf = aPrevAttribs[n];
- DBG_ASSERT( pInf, "Undo_DTOR (SetAttribs): pInf = NULL!" );
- for ( sal_uInt16 nAttr = 0; nAttr < pInf->GetPrevCharAttribs().Count(); nAttr++ )
- {
- EditCharAttrib* pX = pInf->GetPrevCharAttribs()[nAttr];
- DBG_ASSERT( pX, "Undo_DTOR (SetAttribs): pX = NULL!" );
- pPool->Remove( *pX->GetItem() );
- delete pX;
- }
- delete pInf;
- }
-}
-
-void EditUndoSetAttribs::Undo()
-{
- 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++ )
- {
- ContentAttribsInfo* pInf = aPrevAttribs[ (sal_uInt16)(nPara-aESel.nStartPara) ];
- DBG_ASSERT( pInf, "Undo (SetAttribs): pInf = NULL!" );
-
- // first the paragraph attributes ...
- _pImpEE->SetParaAttribs( nPara, pInf->GetPrevParaAttribs() );
-
- // Then the character attributes ...
- // Remove all attributes including features, are later re-established.
- _pImpEE->RemoveCharAttribs( nPara, 0, sal_True );
- DBG_ASSERT( _pImpEE->GetEditDoc().SaveGetObject( nPara ), "Undo (SetAttribs): pNode = NULL!" );
- ContentNode* pNode = _pImpEE->GetEditDoc().GetObject( nPara );
- for ( sal_uInt16 nAttr = 0; nAttr < pInf->GetPrevCharAttribs().Count(); nAttr++ )
- {
- EditCharAttrib* pX = pInf->GetPrevCharAttribs()[nAttr];
- DBG_ASSERT( pX, "Redo (SetAttribs): pX = NULL!" );
- // is automatically "poolsized"
- _pImpEE->GetEditDoc().InsertAttrib( pNode, pX->GetStart(), pX->GetEnd(), *pX->GetItem() );
- if ( pX->Which() == EE_FEATURE_FIELD )
- bFields = sal_True;
- }
- }
- if ( bFields )
- _pImpEE->UpdateFields();
- ImpSetSelection( GetImpEditEngine()->GetActiveView() );
-}
-
-void EditUndoSetAttribs::Redo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- ImpEditEngine* _pImpEE = GetImpEditEngine();
-
- EditSelection aSel( _pImpEE->CreateSel( aESel ) );
- if ( !bSetIsRemove )
- _pImpEE->SetAttribs( aSel, aNewAttribs, nSpecial );
- else
- _pImpEE->RemoveCharAttribs( aSel, bRemoveParaAttribs, nRemoveWhich );
-
- ImpSetSelection( GetImpEditEngine()->GetActiveView() );
-}
-
-void EditUndoSetAttribs::ImpSetSelection( EditView* /*pView*/ )
-{
- ImpEditEngine* _pImpEE = GetImpEditEngine();
- EditSelection aSel( _pImpEE->CreateSel( aESel ) );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aSel );
-}
-
-EditUndoTransliteration::EditUndoTransliteration( ImpEditEngine* _pImpEE, const ESelection& rESel, sal_Int32 nM )
- : EditUndo( EDITUNDO_TRANSLITERATE, _pImpEE ), aOldESel( rESel )
-{
- nMode = nM;
- pTxtObj = NULL;
-}
-
-EditUndoTransliteration::~EditUndoTransliteration()
-{
- delete pTxtObj;
-}
-
-void EditUndoTransliteration::Undo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
-
- ImpEditEngine* _pImpEE = GetImpEditEngine();
-
- EditSelection aSel( _pImpEE->CreateSel( aNewESel ) );
-
- // Insert text, but don't expand Atribs at the current position:
- aSel = _pImpEE->DeleteSelected( aSel );
- EditSelection aDelSel( aSel );
- aSel = _pImpEE->InsertParaBreak( aSel );
- aDelSel.Max() = aSel.Min();
- aDelSel.Max().GetNode()->GetCharAttribs().DeleteEmptyAttribs( _pImpEE->GetEditDoc().GetItemPool() );
- EditSelection aNewSel;
- if ( pTxtObj )
- {
- aNewSel = _pImpEE->InsertText( *pTxtObj, aSel );
- }
- else
- {
- aNewSel = _pImpEE->InsertText( aSel, aText );
- }
- if ( aNewSel.Min().GetNode() == aDelSel.Max().GetNode() )
- {
- aNewSel.Min().SetNode( aDelSel.Min().GetNode() );
- aNewSel.Min().GetIndex() =
- aNewSel.Min().GetIndex() + aDelSel.Min().GetIndex();
- }
- if ( aNewSel.Max().GetNode() == aDelSel.Max().GetNode() )
- {
- aNewSel.Max().SetNode( aDelSel.Min().GetNode() );
- aNewSel.Max().GetIndex() =
- aNewSel.Max().GetIndex() + aDelSel.Min().GetIndex();
- }
- _pImpEE->DeleteSelected( aDelSel );
-
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
-}
-
-void EditUndoTransliteration::Redo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- ImpEditEngine* _pImpEE = GetImpEditEngine();
-
- EditSelection aSel( _pImpEE->CreateSel( aOldESel ) );
- EditSelection aNewSel = _pImpEE->TransliterateText( aSel, nMode );
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
-}
-
-EditUndoMarkSelection::EditUndoMarkSelection( ImpEditEngine* _pImpEE, const ESelection& rSel )
- : EditUndo( EDITUNDO_MARKSELECTION, _pImpEE ), aSelection( rSel )
-{
-}
-
-EditUndoMarkSelection::~EditUndoMarkSelection()
-{
-}
-
-void EditUndoMarkSelection::Undo()
-{
- DBG_ASSERT( GetImpEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" );
- if ( GetImpEditEngine()->GetActiveView() )
- {
- if ( GetImpEditEngine()->IsFormatted() )
- GetImpEditEngine()->GetActiveView()->SetSelection( aSelection );
- else
- GetImpEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( GetImpEditEngine()->CreateSel( aSelection ) );
- }
-}
-
-void EditUndoMarkSelection::Redo()
-{
- // 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
deleted file mode 100644
index b884136635..0000000000
--- a/editeng/source/editeng/editundo.hxx
+++ /dev/null
@@ -1,318 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDITUNDO_HXX
-#define _EDITUNDO_HXX
-
-#include <editdoc.hxx>
-#include <editeng/editund2.hxx>
-#include <editeng/editdata.hxx>
-
-#define UNDO_NOACTION 0
-#define UNDO_NEWUNDO 1
-#define UNDO_UNDOSDELETED 2
-#define UNDO_EMPTYGROUPDELETED 3
-#define UNDO_INVALIDEND 4
-
-class ImpEditEngine;
-class EditView;
-
-// -----------------------------------------------------------------------
-// EditUndoDelContent
-// ------------------------------------------------------------------------
-class EditUndoDelContent : public EditUndo
-{
-private:
- sal_Bool bDelObject;
- sal_uInt16 nNode;
- ContentNode* pContentNode; // Points to the valid,
- // undestroyed object!
-
-public:
- TYPEINFO();
- EditUndoDelContent( ImpEditEngine* pImpEE, ContentNode* pNode, sal_uInt16 nPortio );
- ~EditUndoDelContent();
-
- virtual void Undo();
- virtual void Redo();
-};
-
-// -----------------------------------------------------------------------
-// EditUndoConnectParas
-// ------------------------------------------------------------------------
-class EditUndoConnectParas : public EditUndo
-{
-private:
- sal_uInt16 nNode;
- sal_uInt16 nSepPos;
- SfxItemSet aLeftParaAttribs;
- SfxItemSet aRightParaAttribs;
-
- // 2 Pointers would be nicer but then it would have to be a SfxListener.
- String aLeftStyleName;
- String aRightStyleName;
- SfxStyleFamily eLeftStyleFamily;
- SfxStyleFamily eRightStyleFamily;
-
- sal_Bool bBackward;
-
-public:
- TYPEINFO();
- EditUndoConnectParas( ImpEditEngine* pImpEE, sal_uInt16 nNode, sal_uInt16 nSepPos,
- const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs,
- const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, sal_Bool bBackward );
- ~EditUndoConnectParas();
-
- virtual void Undo();
- virtual void Redo();
-};
-
-// -----------------------------------------------------------------------
-// EditUndoSplitPara
-// ------------------------------------------------------------------------
-class EditUndoSplitPara : public EditUndo
-{
-private:
- sal_uInt16 nNode;
- sal_uInt16 nSepPos;
-
-public:
- TYPEINFO();
- EditUndoSplitPara( ImpEditEngine* pImpEE, sal_uInt16 nNode, sal_uInt16 nSepPos );
- ~EditUndoSplitPara();
-
- virtual void Undo();
- virtual void Redo();
-};
-
-// -----------------------------------------------------------------------
-// EditUndoInsertChars
-// ------------------------------------------------------------------------
-class EditUndoInsertChars : public EditUndo
-{
-private:
- EPaM aEPaM;
- String aText;
-
-public:
- TYPEINFO();
- EditUndoInsertChars( ImpEditEngine* pImpEE, const EPaM& rEPaM, const String& rStr );
-
- const EPaM& GetEPaM() { return aEPaM; }
- String& GetStr() { return aText; }
-
- virtual void Undo();
- virtual void Redo();
-
- virtual sal_Bool Merge( SfxUndoAction *pNextAction );
-};
-
-// -----------------------------------------------------------------------
-// EditUndoRemoveChars
-// ------------------------------------------------------------------------
-class EditUndoRemoveChars : public EditUndo
-{
-private:
- EPaM aEPaM;
- String aText;
-
-public:
- TYPEINFO();
- EditUndoRemoveChars( ImpEditEngine* pImpEE, const EPaM& rEPaM, const String& rStr );
-
- const EPaM& GetEPaM() { return aEPaM; }
- String& GetStr() { return aText; }
-
- virtual void Undo();
- virtual void Redo();
-};
-
-// -----------------------------------------------------------------------
-// EditUndoInsertFeature
-// ------------------------------------------------------------------------
-class EditUndoInsertFeature : public EditUndo
-{
-private:
- EPaM aEPaM;
- SfxPoolItem* pFeature;
-
-public:
- TYPEINFO();
- EditUndoInsertFeature( ImpEditEngine* pImpEE, const EPaM& rEPaM,
- const SfxPoolItem& rFeature);
- ~EditUndoInsertFeature();
-
- virtual void Undo();
- virtual void Redo();
-};
-
-// -----------------------------------------------------------------------
-// EditUndoMoveParagraphs
-// ------------------------------------------------------------------------
-class EditUndoMoveParagraphs: public EditUndo
-{
-private:
- Range nParagraphs;
- sal_uInt16 nDest;
-
-public:
- TYPEINFO();
- EditUndoMoveParagraphs( ImpEditEngine* pImpEE, const Range& rParas, sal_uInt16 nDest );
- ~EditUndoMoveParagraphs();
-
- virtual void Undo();
- virtual void Redo();
-};
-
-// -----------------------------------------------------------------------
-// EditUndoSetStyleSheet
-// ------------------------------------------------------------------------
-class EditUndoSetStyleSheet: public EditUndo
-{
-private:
- sal_uInt16 nPara;
- XubString aPrevName;
- XubString aNewName;
- SfxStyleFamily ePrevFamily;
- SfxStyleFamily eNewFamily;
- SfxItemSet aPrevParaAttribs;
-
-public:
- TYPEINFO();
-
- EditUndoSetStyleSheet( ImpEditEngine* pImpEE, sal_uInt16 nPara,
- const XubString& rPrevName, SfxStyleFamily ePrevFamily,
- const XubString& rNewName, SfxStyleFamily eNewFamily,
- const SfxItemSet& rPrevParaAttribs );
- ~EditUndoSetStyleSheet();
-
- virtual void Undo();
- virtual void Redo();
-};
-
-// -----------------------------------------------------------------------
-// EditUndoSetParaAttribs
-// ------------------------------------------------------------------------
-class EditUndoSetParaAttribs: public EditUndo
-{
-private:
- sal_uInt16 nPara;
- SfxItemSet aPrevItems;
- SfxItemSet aNewItems;
-
-public:
- TYPEINFO();
- EditUndoSetParaAttribs( ImpEditEngine* pImpEE, sal_uInt16 nPara, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems );
- ~EditUndoSetParaAttribs();
-
- virtual void Undo();
- virtual void Redo();
-};
-
-// -----------------------------------------------------------------------
-// EditUndoSetAttribs
-// ------------------------------------------------------------------------
-class EditUndoSetAttribs: public EditUndo
-{
-private:
- ESelection aESel;
- SfxItemSet aNewAttribs;
- ContentInfoArray aPrevAttribs;
-
- sal_uInt8 nSpecial;
- sal_Bool bSetIsRemove;
- sal_Bool bRemoveParaAttribs;
- sal_uInt16 nRemoveWhich;
-
- void ImpSetSelection( EditView* pView );
-
-
-public:
- TYPEINFO();
- EditUndoSetAttribs( ImpEditEngine* pImpEE, const ESelection& rESel, const SfxItemSet& rNewItems );
- ~EditUndoSetAttribs();
-
- ContentInfoArray& GetContentInfos() { return aPrevAttribs; }
- SfxItemSet& GetNewAttribs() { return aNewAttribs; }
-
- void SetSpecial( sal_uInt8 n ) { nSpecial = n; }
- void SetRemoveAttribs( sal_Bool b ) { bSetIsRemove = b; }
- void SetRemoveParaAttribs( sal_Bool b ) { bRemoveParaAttribs = b; }
- void SetRemoveWhich( sal_uInt16 n ) { nRemoveWhich = n; }
-
- virtual void Undo();
- virtual void Redo();
-};
-
-// -----------------------------------------------------------------------
-// EditUndoTransliteration
-// ------------------------------------------------------------------------
-class EditUndoTransliteration: public EditUndo
-{
-private:
- ESelection aOldESel;
- ESelection aNewESel;
-
- sal_Int32 nMode;
- EditTextObject* pTxtObj;
- String aText;
-
-public:
- TYPEINFO();
- EditUndoTransliteration( ImpEditEngine* pImpEE, const ESelection& rESel, sal_Int32 nMode );
- ~EditUndoTransliteration();
-
- void SetText( const String& rText ) { aText = rText; }
- void SetText( EditTextObject* pObj ) { pTxtObj = pObj; }
- void SetNewSelection( const ESelection& rSel ) { aNewESel = rSel; }
-
- virtual void Undo();
- virtual void Redo();
-};
-
-// -----------------------------------------------------------------------
-// EditUndoMarkSelection
-// ------------------------------------------------------------------------
-class EditUndoMarkSelection: public EditUndo
-{
-private:
- ESelection aSelection;
-
-public:
- TYPEINFO();
- EditUndoMarkSelection( ImpEditEngine* pImpEE, const ESelection& rSel );
- ~EditUndoMarkSelection();
-
- virtual void Undo();
- virtual void Redo();
-};
-
-
-#endif // _EDITUNDO_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
deleted file mode 100644
index e005eafdde..0000000000
--- a/editeng/source/editeng/editview.cxx
+++ /dev/null
@@ -1,1630 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// 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>
-#include <vcl/svapp.hxx>
-
-#include <com/sun/star/i18n/WordType.hpp>
-#include <vcl/metric.hxx>
-
-#include <i18npool/mslangid.hxx>
-#include <svl/languageoptions.hxx>
-#include <svtools/ctrltool.hxx>
-#include <svtools/langtab.hxx>
-#include <svtools/filter.hxx>
-
-#include <svl/srchitem.hxx>
-
-#define _SVSTDARR_sal_uIt16S
-#include <svl/svstdarr.hxx>
-
-#include <impedit.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/svxacorr.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/eerdll.hxx>
-#include <eerdll2.hxx>
-#include <editeng.hrc>
-#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>
-#include <unotools/lingucfg.hxx>
-#include <osl/file.hxx>
-
-#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/beans/PropertyValues.hdl>
-#include <com/sun/star/lang/Locale.hpp>
-#include <linguistic/lngprops.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
-#include <unotools/lingucfg.hxx>
-#include <sal/macros.h>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-
-using ::rtl::OUString;
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::linguistic2;
-
-
-DBG_NAME( EditView )
-
-
-// From SW => Create common method
-LanguageType lcl_CheckLanguage(
- const OUString &rText,
- Reference< XSpellChecker1 > xSpell,
- Reference< linguistic2::XLanguageGuessing > xLangGuess,
- sal_Bool bIsParaText )
-{
- LanguageType nLang = LANGUAGE_NONE;
- if (bIsParaText) // check longer texts with language-guessing...
- {
- if (!xLangGuess.is())
- return nLang;
-
- lang::Locale aLocale( xLangGuess->guessPrimaryLanguage( rText, 0, rText.getLength()) );
-
- // get language as from "Tools/Options - Language Settings - Languages: Locale setting"
- LanguageType nTmpLang = Application::GetSettings().GetLanguage();
-
- // if the result from language guessing does not provide a 'Country' part
- // try to get it by looking up the locale setting of the office.
- if (aLocale.Country.getLength() == 0)
- {
- lang::Locale aTmpLocale = SvxCreateLocale( nTmpLang );
- if (aTmpLocale.Language == aLocale.Language)
- nLang = nTmpLang;
- }
- if (nLang == LANGUAGE_NONE) // language not found by looking up the sytem language...
- nLang = MsLangId::convertLocaleToLanguageWithFallback( aLocale );
- if (nLang == LANGUAGE_SYSTEM)
- nLang = nTmpLang;
- if (nLang == LANGUAGE_DONTKNOW)
- nLang = LANGUAGE_NONE;
- }
- else // check single word
- {
- if (!xSpell.is())
- return nLang;
-
- //
- // build list of languages to check
- //
- LanguageType aLangList[4];
- const AllSettings& rSettings = Application::GetSettings();
- SvtLinguOptions aLinguOpt;
- SvtLinguConfig().GetOptions( aLinguOpt );
- // The default document language from "Tools/Options - Language Settings - Languages: Western"
- aLangList[0] = aLinguOpt.nDefaultLanguage;
- // The one from "Tools/Options - Language Settings - Languages: User interface"
- aLangList[1] = rSettings.GetUILanguage();
- // The one from "Tools/Options - Language Settings - Languages: Locale setting"
- aLangList[2] = rSettings.GetLanguage();
- // en-US
- aLangList[3] = LANGUAGE_ENGLISH_US;
-#ifdef DEBUG
- lang::Locale a0( SvxCreateLocale( aLangList[0] ) );
- lang::Locale a1( SvxCreateLocale( aLangList[1] ) );
- lang::Locale a2( SvxCreateLocale( aLangList[2] ) );
- lang::Locale a3( SvxCreateLocale( aLangList[3] ) );
-#endif
-
- sal_Int32 nCount = SAL_N_ELEMENTS(aLangList);
- for (sal_Int32 i = 0; i < nCount; i++)
- {
- sal_Int16 nTmpLang = aLangList[i];
- if (nTmpLang != LANGUAGE_NONE && nTmpLang != LANGUAGE_DONTKNOW)
- {
- if (xSpell->hasLanguage( nTmpLang ) &&
- xSpell->isValid( rText, nTmpLang, Sequence< PropertyValue >() ))
- {
- nLang = nTmpLang;
- break;
- }
- }
- }
- }
-
- return nLang;
-}
-
-
- // ----------------------------------------------------------------------
-// class EditView
-// ----------------------------------------------------------------------
-EditView::EditView( EditEngine* pEng, Window* pWindow )
-{
- DBG_CTOR( EditView, 0 );
- pImpEditView = new ImpEditView( this, pEng, pWindow );
-}
-
-EditView::~EditView()
-{
- DBG_DTOR( EditView, 0 );
- delete pImpEditView;
-}
-
-ImpEditEngine* EditView::GetImpEditEngine() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditView->pEditEngine->pImpEditEngine;
-}
-
-EditEngine* EditView::GetEditEngine() const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return pImpEditView->pEditEngine;
-}
-
-void EditView::Invalidate()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- if ( !pImpEditView->DoInvalidateMore() )
- pImpEditView->GetWindow()->Invalidate( pImpEditView->aOutArea );
- else
- {
- Rectangle aRect( pImpEditView->aOutArea );
- long nMore = pImpEditView->GetWindow()->PixelToLogic( Size( pImpEditView->GetInvalidateMore(), 0 ) ).Width();
- aRect.Left() -= nMore;
- aRect.Right() += nMore;
- aRect.Top() -= nMore;
- aRect.Bottom() += nMore;
- pImpEditView->GetWindow()->Invalidate( aRect );
- }
-}
-
-void EditView::SetReadOnly( sal_Bool bReadOnly )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditView->bReadOnly = bReadOnly;
-}
-
-sal_Bool EditView::IsReadOnly() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditView->bReadOnly;
-}
-
-void EditView::SetSelection( const ESelection& rESel )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- // 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();
- PIMPEE->CursorMoved( pNode );
- }
- EditSelection aNewSelection( PIMPEE->ConvertSelection( rESel.nStartPara, rESel.nStartPos, rESel.nEndPara, rESel.nEndPos ) );
-
- // If the selection is manipulated after a KeyInput:
- PIMPEE->CheckIdleFormatter();
-
- // Selection may not start/end at an invisible paragraph:
- ParaPortion* pPortion = PIMPEE->FindParaPortion( aNewSelection.Min().GetNode() );
- if ( !pPortion->IsVisible() )
- {
- pPortion = PIMPEE->GetPrevVisPortion( pPortion );
- ContentNode* pNode = pPortion ? pPortion->GetNode() : PIMPEE->GetEditDoc().GetObject( 0 );
- aNewSelection.Min() = EditPaM( pNode, pNode->Len() );
- }
- pPortion = PIMPEE->FindParaPortion( aNewSelection.Max().GetNode() );
- if ( !pPortion->IsVisible() )
- {
- pPortion = PIMPEE->GetPrevVisPortion( pPortion );
- ContentNode* pNode = pPortion ? pPortion->GetNode() : PIMPEE->GetEditDoc().GetObject( 0 );
- aNewSelection.Max() = EditPaM( pNode, pNode->Len() );
- }
-
- pImpEditView->DrawSelection();
- pImpEditView->SetEditSelection( aNewSelection );
- pImpEditView->DrawSelection();
- sal_Bool bGotoCursor = pImpEditView->DoAutoScroll();
- ShowCursor( bGotoCursor );
-}
-
-ESelection EditView::GetSelection() const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- ESelection aSelection;
-
- aSelection.nStartPara = PIMPEE->GetEditDoc().GetPos( pImpEditView->GetEditSelection().Min().GetNode() );
- aSelection.nEndPara = PIMPEE->GetEditDoc().GetPos( pImpEditView->GetEditSelection().Max().GetNode() );
-
- aSelection.nStartPos = pImpEditView->GetEditSelection().Min().GetIndex();
- aSelection.nEndPos = pImpEditView->GetEditSelection().Max().GetIndex();
-
- return aSelection;
-}
-
-sal_Bool EditView::HasSelection() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditView->HasSelection();
-}
-
-void EditView::DeleteSelected()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- pImpEditView->DeleteSelected();
-}
-
-sal_uInt16 EditView::GetSelectedScriptType() const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return PIMPEE->GetScriptType( pImpEditView->GetEditSelection() );
-}
-
-void EditView::Paint( const Rectangle& rRect )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- PIMPEE->Paint( pImpEditView, rRect );
-}
-
-void EditView::SetEditEngine( EditEngine* pEditEng )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- pImpEditView->pEditEngine = pEditEng;
- EditSelection aStartSel;
- aStartSel = PIMPEE->GetEditDoc().GetStartPaM();
- pImpEditView->SetEditSelection( aStartSel );
-}
-
-void EditView::SetWindow( Window* pWin )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditView->pOutWin = pWin;
- PIMPEE->GetSelEngine().Reset();
-}
-
-Window* EditView::GetWindow() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditView->pOutWin;
-}
-
-void EditView::SetVisArea( const Rectangle& rRec )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditView->SetVisDocStartPos( rRec.TopLeft() );
-}
-
-const Rectangle& EditView::GetVisArea() const
-{
- DBG_CHKTHIS( EditView, 0 );
- // Change return value to Rectangle in next incompatible build !!!
- static Rectangle aRect;
- aRect = pImpEditView->GetVisDocArea();
- return aRect;
-}
-
-void EditView::SetOutputArea( const Rectangle& rRec )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditView->SetOutputArea( rRec );
-
- // the rest here only if it is an API call:
- pImpEditView->CalcAnchorPoint();
- if ( PIMPEE->GetStatus().AutoPageSize() )
- pImpEditView->RecalcOutputArea();
- pImpEditView->ShowCursor( sal_False, sal_False );
-}
-
-const Rectangle& EditView::GetOutputArea() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditView->GetOutputArea();
-}
-
-void EditView::SetPointer( const Pointer& rPointer )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditView->SetPointer( rPointer );
-}
-
-const Pointer& EditView::GetPointer() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditView->GetPointer();
-}
-
-void EditView::SetCursor( const Cursor& rCursor )
-{
- DBG_CHKTHIS( EditView, 0 );
- delete pImpEditView->pCursor;
- pImpEditView->pCursor = new Cursor( rCursor );
-}
-
-Cursor* EditView::GetCursor() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditView->pCursor;
-}
-
-void EditView::InsertText( const XubString& rStr, sal_Bool bSelect )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- ImpEditEngine* pImpEE = PIMPEE;
- pImpEditView->DrawSelection();
-
- EditPaM aPaM1;
- if ( bSelect )
- {
- EditSelection aTmpSel( pImpEditView->GetEditSelection() );
- aTmpSel.Adjust( pImpEE->GetEditDoc() );
- aPaM1 = aTmpSel.Min();
- }
-
- pImpEE->UndoActionStart( EDITUNDO_INSERT );
- EditPaM aPaM2( pImpEE->InsertText( pImpEditView->GetEditSelection(), rStr ) );
- pImpEE->UndoActionEnd( EDITUNDO_INSERT );
-
- if ( bSelect )
- {
- DBG_ASSERT( !aPaM1.DbgIsBuggy( pImpEE->GetEditDoc() ), "Insert: PaM broken" );
- pImpEditView->SetEditSelection( EditSelection( aPaM1, aPaM2 ) );
- }
- else
- pImpEditView->SetEditSelection( EditSelection( aPaM2, aPaM2 ) );
-
- pImpEE->FormatAndUpdate( this );
-}
-
-sal_Bool EditView::PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return pImpEditView->PostKeyEvent( rKeyEvent, pFrameWin );
-}
-
-sal_Bool EditView::MouseButtonUp( const MouseEvent& rMouseEvent )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return pImpEditView->MouseButtonUp( rMouseEvent );
-}
-
-sal_Bool EditView::MouseButtonDown( const MouseEvent& rMouseEvent )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return pImpEditView->MouseButtonDown( rMouseEvent );
-}
-
-sal_Bool EditView::MouseMove( const MouseEvent& rMouseEvent )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return pImpEditView->MouseMove( rMouseEvent );
-}
-
-void EditView::Command( const CommandEvent& rCEvt )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- pImpEditView->Command( rCEvt );
-}
-
-void EditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- if ( pImpEditView->pEditEngine->HasView( this ) )
- {
- // The control word is more important:
- if ( !pImpEditView->DoAutoScroll() )
- bGotoCursor = sal_False;
- pImpEditView->ShowCursor( bGotoCursor, bForceVisCursor );
- }
-}
-
-void EditView::HideCursor()
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditView->GetCursor()->Hide();
-}
-
-Pair EditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return pImpEditView->Scroll( ndX, ndY, nRangeCheck );
-}
-
-const SfxItemSet& EditView::GetEmptyItemSet()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return PIMPEE->GetEmptyItemSet();
-}
-
-void EditView::SetAttribs( const SfxItemSet& rSet )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in ...." );
-
- pImpEditView->DrawSelection();
- PIMPEE->SetAttribs( pImpEditView->GetEditSelection(), rSet, ATTRSPECIAL_WHOLEWORD );
- PIMPEE->FormatAndUpdate( this );
-}
-
-void EditView::SetParaAttribs( const SfxItemSet& rSet, sal_uInt16 nPara )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- PIMPEE->SetParaAttribs( nPara, rSet );
- // When you change paragraph attributes you must always format...
- PIMPEE->FormatAndUpdate( this );
-}
-
-void EditView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- pImpEditView->DrawSelection();
- PIMPEE->UndoActionStart( EDITUNDO_RESETATTRIBS );
- EditSelection aSelection( pImpEditView->GetEditSelection() );
-
- for (sal_uInt16 nWID = EE_ITEMS_START; nWID <= EE_ITEMS_END; ++nWID)
- {
- bool bIsLang = EE_CHAR_LANGUAGE == nWID ||
- EE_CHAR_LANGUAGE_CJK == nWID ||
- EE_CHAR_LANGUAGE_CTL == nWID;
- if (!bIsLang)
- PIMPEE->RemoveCharAttribs( aSelection, bRemoveParaAttribs, nWID );
- }
-
- PIMPEE->UndoActionEnd( EDITUNDO_RESETATTRIBS );
- PIMPEE->FormatAndUpdate( this );
-}
-
-void EditView::RemoveAttribs( sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- pImpEditView->DrawSelection();
- PIMPEE->UndoActionStart( EDITUNDO_RESETATTRIBS );
- PIMPEE->RemoveCharAttribs( pImpEditView->GetEditSelection(), bRemoveParaAttribs, nWhich );
- PIMPEE->UndoActionEnd( EDITUNDO_RESETATTRIBS );
- PIMPEE->FormatAndUpdate( this );
-}
-
-void EditView::RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- PIMPEE->UndoActionStart( EDITUNDO_RESETATTRIBS );
- PIMPEE->RemoveCharAttribs( nPara, nWhich );
- PIMPEE->UndoActionEnd( EDITUNDO_RESETATTRIBS );
- PIMPEE->FormatAndUpdate( this );
-}
-
-SfxItemSet EditView::GetAttribs()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in ...." );
- return PIMPEE->GetAttribs( pImpEditView->GetEditSelection() );
-}
-
-void EditView::Undo()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- PIMPEE->Undo( this );
-}
-
-void EditView::Redo()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- PIMPEE->Redo( this );
-}
-
-sal_uLong EditView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect, SvKeyValueIterator* pHTTPHeaderAttrs )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- EditSelection aOldSel( pImpEditView->GetEditSelection() );
- pImpEditView->DrawSelection();
- PIMPEE->UndoActionStart( EDITUNDO_READ );
- EditPaM aEndPaM = PIMPEE->Read( rInput, rBaseURL, eFormat, aOldSel, pHTTPHeaderAttrs );
- PIMPEE->UndoActionEnd( EDITUNDO_READ );
- EditSelection aNewSel( aEndPaM, aEndPaM );
- if ( bSelect )
- {
- aOldSel.Adjust( PIMPEE->GetEditDoc() );
- aNewSel.Min() = aOldSel.Min();
- }
-
- pImpEditView->SetEditSelection( aNewSel );
- sal_Bool bGotoCursor = pImpEditView->DoAutoScroll();
- ShowCursor( bGotoCursor );
-
- return rInput.GetError();
-}
-
-void EditView::Cut()
-{
- DBG_CHKTHIS( EditView, 0 );
- Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipBoard(GetWindow()->GetClipboard());
- pImpEditView->CutCopy( aClipBoard, sal_True );
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > EditView::GetTransferable()
-{
- uno::Reference< datatransfer::XTransferable > xData = GetEditEngine()->pImpEditEngine->CreateTransferable( pImpEditView->GetEditSelection() );
- return xData;
-}
-
-void EditView::Copy()
-{
- DBG_CHKTHIS( EditView, 0 );
- Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipBoard(GetWindow()->GetClipboard());
- pImpEditView->CutCopy( aClipBoard, sal_False );
-}
-
-void EditView::Paste()
-{
- DBG_CHKTHIS( EditView, 0 );
- Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipBoard(GetWindow()->GetClipboard());
- pImpEditView->Paste( aClipBoard, sal_False );
-}
-
-void EditView::PasteSpecial()
-{
- DBG_CHKTHIS( EditView, 0 );
- Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipBoard(GetWindow()->GetClipboard());
- pImpEditView->Paste(aClipBoard, sal_True );
-}
-
-void EditView::EnablePaste( sal_Bool bEnable )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- pImpEditView->EnablePaste( bEnable );
-}
-
-sal_Bool EditView::IsPasteEnabled() const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return pImpEditView->IsPasteEnabled();
-}
-
-Point EditView::GetWindowPosTopLeft( sal_uInt16 nParagraph )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- Point aDocPos( pImpEditView->pEditEngine->GetDocPosTopLeft( nParagraph ) );
- return pImpEditView->GetWindowPos( aDocPos );
-}
-
-sal_uInt16 EditView::GetParagraph( const Point& rMousePosPixel )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- Point aMousePos( rMousePosPixel );
- aMousePos = GetWindow()->PixelToLogic( aMousePos );
- Point aDocPos( pImpEditView->GetDocPos( aMousePos ) );
- sal_uInt16 nParagraph = PIMPEE->GetParaPortions().FindParagraph( aDocPos.Y() );
- return nParagraph;
-}
-
-void EditView::IndentBlock()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- PIMPEE->IndentBlock( this, sal_True );
-}
-
-void EditView::UnindentBlock()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- PIMPEE->IndentBlock( this, sal_False );
-}
-
-EESelectionMode EditView::GetSelectionMode() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditView->GetSelectionMode();
-}
-
-void EditView::SetSelectionMode( EESelectionMode eMode )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditView->SetSelectionMode( eMode );
-}
-
-XubString EditView::GetSelected()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return PIMPEE->GetSelected( pImpEditView->GetEditSelection() );
-}
-
-void EditView::MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- PIMPEE->UndoActionStart( EDITUNDO_MOVEPARAS );
- PIMPEE->MoveParagraphs( aParagraphs, nNewPos, this );
- PIMPEE->UndoActionEnd( EDITUNDO_MOVEPARAS );
-}
-
-void EditView::MoveParagraphs( long nDiff )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- ESelection aSel = GetSelection();
- Range aRange( aSel.nStartPara, aSel.nEndPara );
- aRange.Justify();
- long nDest = ( nDiff > 0 ? aRange.Max() : aRange.Min() ) + nDiff;
- if ( nDiff > 0 )
- nDest++;
- DBG_ASSERT( ( nDest >= 0 ) && ( nDest <= pImpEditView->pEditEngine->GetParagraphCount() ), "MoveParagraphs - wrong Parameters!" );
- MoveParagraphs( aRange,
- sal::static_int_cast< sal_uInt16 >( nDest ) );
-}
-
-void EditView::SetBackgroundColor( const Color& rColor )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- pImpEditView->SetBackgroundColor( rColor );
-}
-
-Color EditView::GetBackgroundColor() const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return pImpEditView->GetBackgroundColor();
-}
-
-void EditView::SetControlWord( sal_uInt32 nWord )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditView->nControl = nWord;
-}
-
-sal_uInt32 EditView::GetControlWord() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditView->nControl;
-}
-
-EditTextObject* EditView::CreateTextObject()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return PIMPEE->CreateTextObject( pImpEditView->GetEditSelection() );
-}
-
-void EditView::InsertText( const EditTextObject& rTextObject )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- pImpEditView->DrawSelection();
-
- PIMPEE->UndoActionStart( EDITUNDO_INSERT );
- EditSelection aTextSel( PIMPEE->InsertText( rTextObject, pImpEditView->GetEditSelection() ) );
- PIMPEE->UndoActionEnd( EDITUNDO_INSERT );
-
- aTextSel.Min() = aTextSel.Max(); // Selection not retained.
- pImpEditView->SetEditSelection( aTextSel );
- PIMPEE->FormatAndUpdate( this );
-}
-
-void EditView::InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, sal_Bool bUseSpecial )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- PIMPEE->UndoActionStart( EDITUNDO_INSERT );
- pImpEditView->DeleteSelected();
- EditSelection aTextSel( PIMPEE->InsertText( xDataObj, rBaseURL, pImpEditView->GetEditSelection().Max(), bUseSpecial ) );
- PIMPEE->UndoActionEnd( EDITUNDO_INSERT );
-
- aTextSel.Min() = aTextSel.Max(); // Selection not retained.
- pImpEditView->SetEditSelection( aTextSel );
- PIMPEE->FormatAndUpdate( this );
-}
-
-sal_Bool EditView::Drop( const DropEvent& )
-{
- return sal_False;
-}
-
-ESelection EditView::GetDropPos()
-{
- OSL_FAIL( "GetDropPos - Why?!" );
- return ESelection();
-}
-
-sal_Bool EditView::QueryDrop( DropEvent& )
-{
- return sal_False;
-}
-
-void EditView::SetEditEngineUpdateMode( sal_Bool bUpdate )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- PIMPEE->SetUpdateMode( bUpdate, this );
-}
-
-void EditView::ForceUpdate()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- PIMPEE->SetUpdateMode( sal_True, this, sal_True );
-}
-
-void EditView::SetStyleSheet( SfxStyleSheet* pStyle )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- EditSelection aSel( pImpEditView->GetEditSelection() );
- PIMPEE->UndoActionStart( EDITUNDO_STYLESHEET );
- PIMPEE->SetStyleSheet( aSel, pStyle );
- PIMPEE->UndoActionEnd( EDITUNDO_STYLESHEET );
-}
-
-SfxStyleSheet* EditView::GetStyleSheet() const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
-
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( PIMPEE->GetEditDoc() );
- sal_uInt16 nStartPara = PIMPEE->GetEditDoc().GetPos( aSel.Min().GetNode() );
- sal_uInt16 nEndPara = PIMPEE->GetEditDoc().GetPos( aSel.Max().GetNode() );
-
- SfxStyleSheet* pStyle = NULL;
- for ( sal_uInt16 n = nStartPara; n <= nEndPara; n++ )
- {
- SfxStyleSheet* pTmpStyle = PIMPEE->GetStyleSheet( n );
- if ( ( n != nStartPara ) && ( pStyle != pTmpStyle ) )
- return NULL; // Not unique.
- pStyle = pTmpStyle;
- }
- return pStyle;
-}
-
-sal_Bool EditView::IsInsertMode() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditView->IsInsertMode();
-}
-
-void EditView::SetInsertMode( sal_Bool bInsert )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditView->SetInsertMode( bInsert );
-}
-
-void EditView::SetAnchorMode( EVAnchorMode eMode )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditView->SetAnchorMode( eMode );
-}
-
-EVAnchorMode EditView::GetAnchorMode() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return pImpEditView->GetAnchorMode();
-}
-
-void EditView::TransliterateText( sal_Int32 nTransliterationMode )
-{
- DBG_CHKTHIS( EditView, 0 );
- EditSelection aOldSel( pImpEditView->GetEditSelection() );
- EditSelection aNewSel = PIMPEE->TransliterateText( pImpEditView->GetEditSelection(), nTransliterationMode );
- if ( aNewSel != aOldSel )
- {
- pImpEditView->DrawSelection();
- pImpEditView->SetEditSelection( aNewSel );
- pImpEditView->DrawSelection();
- }
-}
-
-
-sal_Bool EditView::MatchGroup()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- EditSelection aNewSel( PIMPEE->MatchGroup( pImpEditView->GetEditSelection() ) );
- if ( aNewSel.HasRange() )
- {
- pImpEditView->DrawSelection();
- pImpEditView->SetEditSelection( aNewSel );
- pImpEditView->DrawSelection();
- ShowCursor();
- return sal_True;
- }
- return sal_False;
-}
-
-void EditView::CompleteAutoCorrect( Window* pFrameWin )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- if ( !pImpEditView->HasSelection() && PIMPEE->GetStatus().DoAutoCorrect() )
- {
- pImpEditView->DrawSelection();
- EditSelection aSel = pImpEditView->GetEditSelection();
- aSel = PIMPEE->EndOfWord( aSel.Max() );
- aSel = PIMPEE->AutoCorrect( aSel, 0, !IsInsertMode(), pFrameWin );
- pImpEditView->SetEditSelection( aSel );
- if ( PIMPEE->IsModified() )
- PIMPEE->FormatAndUpdate( this );
- }
-}
-
-EESpellState EditView::StartSpeller( sal_Bool bMultipleDoc )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- if ( !PIMPEE->GetSpeller().is() )
- return EE_SPELL_NOSPELLER;
-
- return PIMPEE->Spell( this, bMultipleDoc );
-}
-
-EESpellState EditView::StartThesaurus()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- if ( !PIMPEE->GetSpeller().is() )
- return EE_SPELL_NOSPELLER;
-
- return PIMPEE->StartThesaurus( this );
-}
-
-
-void EditView::StartTextConversion(
- LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont,
- sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- PIMPEE->Convert( this, nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc );
-}
-
-
-sal_uInt16 EditView::StartSearchAndReplace( const SvxSearchItem& rSearchItem )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return PIMPEE->StartSearchAndReplace( this, rSearchItem );
-}
-
-sal_Bool EditView::IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- sal_Bool bIsWrong = sal_False;
- if ( !HasSelection() )
- {
- EditPaM aPaM = pImpEditView->GetEditSelection().Max();
- bIsWrong = pImpEditView->IsWrongSpelledWord( aPaM, bMarkIfWrong );
- }
- return bIsWrong;
-}
-
-sal_Bool EditView::IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- Point aPos ( pImpEditView->GetWindow()->PixelToLogic( rPosPixel ) );
- aPos = pImpEditView->GetDocPos( aPos );
- EditPaM aPaM = pImpEditView->pEditEngine->pImpEditEngine->GetPaM( aPos, sal_False );
- return pImpEditView->IsWrongSpelledWord( aPaM , bMarkIfWrong );
-}
-
-
-static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl )
-{
- Image aRes;
- OUString aTmp;
- osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp );
-// ::rtl::OString aPath = OString( aTmp.getStr(), aTmp.getLength(), osl_getThreadTextEncoding() );
-#if defined(WNT)
-// aTmp = lcl_Win_GetShortPathName( aTmp );
-#endif
- Graphic aGraphic;
- const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) );
- if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) )
- {
- aRes = Image( aGraphic.GetBitmapEx() );
- }
- return aRes;
-}
-
-
-void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- Point aPos ( pImpEditView->GetWindow()->PixelToLogic( rPosPixel ) );
- aPos = pImpEditView->GetDocPos( aPos );
- EditPaM aPaM = pImpEditView->pEditEngine->pImpEditEngine->GetPaM( aPos, sal_False );
- Reference< XSpellChecker1 > xSpeller( PIMPEE->GetSpeller() );
- ESelection aOldSel = GetSelection();
- if ( xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, sal_True ) )
- {
- PopupMenu aPopupMenu( EditResId( RID_MENU_SPELL ) );
- PopupMenu *pAutoMenu = aPopupMenu.GetPopupMenu( MN_AUTOCORR );
- PopupMenu *pInsertMenu = aPopupMenu.GetPopupMenu( MN_INSERT ); // add word to user-dictionaries
- pInsertMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); //! necessary to retrieve the correct dictionary names later
-
- EditPaM aPaM2( aPaM );
- aPaM2.GetIndex()++;
-
- // Are there any replace suggestions?
- String aSelected( GetSelected() );
- //
- // restrict the maximal number of suggestions displayed
- // in the context menu.
- // Note: That could of course be done by clipping the
- // resulting sequence but the current third party
- // implementations result differs greatly if the number of
- // suggestions to be retuned gets changed. Statistically
- // it gets much better if told to return e.g. only 7 strings
- // than returning e.g. 16 suggestions and using only the
- // first 7. Thus we hand down the value to use to that
- // implementation here by providing an additional parameter.
- Sequence< PropertyValue > aPropVals(1);
- PropertyValue &rVal = aPropVals.getArray()[0];
- rVal.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( UPN_MAX_NUMBER_OF_SUGGESTIONS ));
- rVal.Value <<= (sal_Int16) 7;
- //
- // Are there any replace suggestions?
- Reference< XSpellAlternatives > xSpellAlt =
- xSpeller->spell( aSelected, PIMPEE->GetLanguage( aPaM2 ), aPropVals );
-
- Reference< XLanguageGuessing > xLangGuesser( EE_DLL().GetGlobalData()->GetLanguageGuesser() );
-
- // check if text might belong to a different language...
- LanguageType nGuessLangWord = LANGUAGE_NONE;
- LanguageType nGuessLangPara = LANGUAGE_NONE;
- if (xSpellAlt.is() && xLangGuesser.is())
- {
- String aParaText;
- ContentNode *pNode = aPaM.GetNode();
- if (pNode)
- {
- aParaText = *pNode;
- }
- else
- {
- OSL_FAIL( "content node is NULL" );
- }
-
- nGuessLangWord = lcl_CheckLanguage( xSpellAlt->getWord(), xSpeller, xLangGuesser, sal_False );
- nGuessLangPara = lcl_CheckLanguage( aParaText, xSpeller, xLangGuesser, sal_True );
- }
- if (nGuessLangWord != LANGUAGE_NONE || nGuessLangPara != LANGUAGE_NONE)
- {
- // make sure LANGUAGE_NONE gets not used as menu entry
- if (nGuessLangWord == LANGUAGE_NONE)
- nGuessLangWord = nGuessLangPara;
- if (nGuessLangPara == LANGUAGE_NONE)
- nGuessLangPara = nGuessLangWord;
-
- aPopupMenu.InsertSeparator();
- String aTmpWord( SvtLanguageTable::GetLanguageString( nGuessLangWord ) );
- String aTmpPara( SvtLanguageTable::GetLanguageString( nGuessLangPara ) );
- String aWordStr( EditResId( RID_STR_WORD ) );
- aWordStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%x" ) ), aTmpWord );
- String aParaStr( EditResId( RID_STR_PARAGRAPH ) );
- aParaStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%x" ) ), aTmpPara );
- aPopupMenu.InsertItem( MN_WORDLANGUAGE, aWordStr );
- aPopupMenu.SetHelpId( MN_WORDLANGUAGE, HID_EDITENG_SPELLER_WORDLANGUAGE );
- aPopupMenu.InsertItem( MN_PARALANGUAGE, aParaStr );
- aPopupMenu.SetHelpId( MN_PARALANGUAGE, HID_EDITENG_SPELLER_PARALANGUAGE );
- }
-
- // ## Create mnemonics here
- if ( Application::IsAutoMnemonicEnabled() )
- {
- aPopupMenu.CreateAutoMnemonics();
- aPopupMenu.SetMenuFlags( aPopupMenu.GetMenuFlags() | MENU_FLAG_NOAUTOMNEMONICS );
- }
-
- // Replace suggestions...
- Sequence< OUString > aAlt;
- if (xSpellAlt.is())
- aAlt = xSpellAlt->getAlternatives();
- const OUString *pAlt = aAlt.getConstArray();
- sal_uInt16 nWords = (sal_uInt16) aAlt.getLength();
- if ( nWords )
- {
- for ( sal_uInt16 nW = 0; nW < nWords; nW++ )
- {
- String aAlternate( pAlt[nW] );
- aPopupMenu.InsertItem( MN_ALTSTART+nW, aAlternate, 0, nW );
- pAutoMenu->InsertItem( MN_AUTOSTART+nW, aAlternate, 0, nW );
- }
- aPopupMenu.InsertSeparator( nWords );
- }
- else
- aPopupMenu.RemoveItem( MN_AUTOCORR ); // delete?
-
- SvtLinguConfig aCfg;
-
- Reference< XDictionaryList > xDicList( SvxGetDictionaryList() );
- Sequence< Reference< XDictionary > > aDics;
- const Reference< XDictionary > *pDic = NULL;
- if (xDicList.is())
- {
- // add the default positive dictionary to dic-list (if not already done).
- // This is to ensure that there is at least one dictionary to which
- // words could be added.
- uno::Reference< linguistic2::XDictionary > xDic( SvxGetOrCreatePosDic( xDicList ) );
- if (xDic.is())
- xDic->setActive( sal_True );
-
- aDics = xDicList->getDictionaries();
- pDic = aDics.getConstArray();
- sal_uInt16 nCheckedLanguage = PIMPEE->GetLanguage( aPaM2 );
- sal_uInt16 nDicCount = (sal_uInt16)aDics.getLength();
- for (sal_uInt16 i = 0; i < nDicCount; i++)
- {
- uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY );
- if (!xDicTmp.is() || SvxGetIgnoreAllList() == xDicTmp)
- continue;
-
- uno::Reference< frame::XStorable > xStor( xDicTmp, uno::UNO_QUERY );
- LanguageType nActLanguage = SvxLocaleToLanguage( xDicTmp->getLocale() );
- if( xDicTmp->isActive()
- && xDicTmp->getDictionaryType() != linguistic2::DictionaryType_NEGATIVE
- && (nCheckedLanguage == nActLanguage || LANGUAGE_NONE == nActLanguage )
- && (!xStor.is() || !xStor->isReadonly()) )
- {
- // the extra 1 is because of the (possible) external
- // linguistic entry above
- sal_uInt16 nPos = MN_DICTSTART + i;
- pInsertMenu->InsertItem( nPos, xDicTmp->getName() );
-
- uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY );
- if (xSvcInfo.is())
- {
- OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage(
- xSvcInfo->getImplementationName()) );
- if (aDictionaryImageUrl.getLength() > 0)
- {
- Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) );
- pInsertMenu->SetItemImage( nPos, aImage );
- }
- }
- }
- }
- }
-
- if ( !pInsertMenu->GetItemCount() )
- aPopupMenu.EnableItem( MN_INSERT, sal_False );
-
- aPopupMenu.RemoveDisabledEntries( sal_True, sal_True );
-
- Rectangle aTempRect = PIMPEE->PaMtoEditCursor( aPaM, GETCRSR_TXTONLY );
- Point aScreenPos = pImpEditView->GetWindowPos( aTempRect.TopLeft() );
- aScreenPos = pImpEditView->GetWindow()->OutputToScreenPixel( aScreenPos );
- aTempRect = pImpEditView->GetWindow()->LogicToPixel( Rectangle(aScreenPos, aTempRect.GetSize() ));
-
- sal_uInt16 nId = aPopupMenu.Execute( pImpEditView->GetWindow(), aTempRect, POPUPMENU_NOMOUSEUPCLOSE );
- if ( nId == MN_IGNORE )
- {
- String aWord = pImpEditView->SpellIgnoreOrAddWord( sal_False );
- if ( pCallBack )
- {
- SpellCallbackInfo aInf( SPELLCMD_IGNOREWORD, aWord );
- pCallBack->Call( &aInf );
- }
- SetSelection( aOldSel );
- }
- else if ( ( nId == MN_WORDLANGUAGE ) || ( nId == MN_PARALANGUAGE ) )
- {
- LanguageType nLangToUse = (nId == MN_WORDLANGUAGE) ? nGuessLangWord : nGuessLangPara;
- sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse );
-
- SfxItemSet aAttrs = GetEditEngine()->GetEmptyItemSet();
- if (nScriptType == SCRIPTTYPE_LATIN)
- aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE ) );
- if (nScriptType == SCRIPTTYPE_COMPLEX)
- aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE_CTL ) );
- if (nScriptType == SCRIPTTYPE_ASIAN)
- aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE_CJK ) );
- if ( nId == MN_PARALANGUAGE )
- {
- ESelection aSel = GetSelection();
- aSel.nStartPos = 0;
- aSel.nEndPos = 0xFFFF;
- SetSelection( aSel );
- }
- SetAttribs( aAttrs );
- PIMPEE->StartOnlineSpellTimer();
-
- if ( pCallBack )
- {
- SpellCallbackInfo aInf( ( nId == MN_WORDLANGUAGE ) ? SPELLCMD_WORDLANGUAGE : SPELLCMD_PARALANGUAGE, nLangToUse );
- pCallBack->Call( &aInf );
- }
- SetSelection( aOldSel );
- }
- else if ( nId == MN_SPELLING )
- {
- if ( !pCallBack )
- {
- // Set Cursor before word...
- EditPaM aCursor = pImpEditView->GetEditSelection().Min();
- pImpEditView->DrawSelection();
- pImpEditView->SetEditSelection( EditSelection( aCursor, aCursor ) );
- pImpEditView->DrawSelection();
- // Crashes when no SfxApp
- PIMPEE->Spell( this, sal_False );
- }
- else
- {
- SpellCallbackInfo aInf( SPELLCMD_STARTSPELLDLG, String() );
- pCallBack->Call( &aInf );
- }
- }
- else if ( nId >= MN_DICTSTART )
- {
- String aDicName ( pInsertMenu->GetItemText(nId) );
-
- uno::Reference< linguistic2::XDictionary > xDic;
- if (xDicList.is())
- xDic = xDicList->getDictionaryByName( aDicName );
-
- if (xDic.is())
- xDic->add( aSelected, sal_False, String() );
- // save modified user-dictionary if it is persistent
- Reference< frame::XStorable > xSavDic( xDic, UNO_QUERY );
- if (xSavDic.is())
- xSavDic->store();
-
- aPaM.GetNode()->GetWrongList()->GetInvalidStart() = 0;
- aPaM.GetNode()->GetWrongList()->GetInvalidEnd() = aPaM.GetNode()->Len();
- PIMPEE->StartOnlineSpellTimer();
-
- if ( pCallBack )
- {
- SpellCallbackInfo aInf( SPELLCMD_ADDTODICTIONARY, aSelected );
- pCallBack->Call( &aInf );
- }
- SetSelection( aOldSel );
- }
- else if ( nId >= MN_AUTOSTART )
- {
- DBG_ASSERT(nId - MN_AUTOSTART < aAlt.getLength(), "index out of range");
- String aWord = pAlt[nId - MN_AUTOSTART];
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
- if ( pAutoCorrect )
- pAutoCorrect->PutText( aSelected, aWord, PIMPEE->GetLanguage( aPaM2 ) );
- InsertText( aWord );
- }
- else if ( nId >= MN_ALTSTART ) // Replace
- {
- DBG_ASSERT(nId - MN_ALTSTART < aAlt.getLength(), "index out of range");
- String aWord = pAlt[nId - MN_ALTSTART];
- InsertText( aWord );
- }
- else
- {
- SetSelection( aOldSel );
- }
- }
-}
-
-void EditView::SpellIgnoreWord()
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- pImpEditView->SpellIgnoreOrAddWord( sal_False );
-}
-
-sal_Bool EditView::SelectCurrentWord( sal_Int16 nWordType )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- EditSelection aCurSel( pImpEditView->GetEditSelection() );
- pImpEditView->DrawSelection();
- aCurSel = PIMPEE->SelectWord( aCurSel.Max(), nWordType );
- pImpEditView->SetEditSelection( aCurSel );
- pImpEditView->DrawSelection();
- ShowCursor( sal_True, sal_False );
- return aCurSel.HasRange() ? sal_True : sal_False;
-}
-
-void EditView::InsertField( const SvxFieldItem& rFld )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- ImpEditEngine* pImpEE = PIMPEE;
- pImpEditView->DrawSelection();
- pImpEE->UndoActionStart( EDITUNDO_INSERT );
- EditPaM aPaM( pImpEE->InsertField( pImpEditView->GetEditSelection(), rFld ) );
- pImpEE->UndoActionEnd( EDITUNDO_INSERT );
- pImpEditView->SetEditSelection( EditSelection( aPaM, aPaM ) );
- pImpEE->UpdateFields();
- pImpEE->FormatAndUpdate( this );
-}
-
-const SvxFieldItem* EditView::GetFieldUnderMousePointer() const
-{
- DBG_CHKTHIS( EditView, 0 );
- sal_uInt16 nPara, nPos;
- return GetFieldUnderMousePointer( nPara, nPos );
-}
-
-const SvxFieldItem* EditView::GetField( const Point& rPos, sal_uInt16* pPara, sal_uInt16* pPos ) const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return pImpEditView->GetField( rPos, pPara, pPos );
-}
-
-const SvxFieldItem* EditView::GetFieldUnderMousePointer( sal_uInt16& nPara, sal_uInt16& nPos ) const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- Point aPos = pImpEditView->GetWindow()->GetPointerPosPixel();
- aPos = pImpEditView->GetWindow()->PixelToLogic( aPos );
- return GetField( aPos, &nPara, &nPos );
-}
-
-const SvxFieldItem* EditView::GetFieldAtSelection() const
-{
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( pImpEditView->pEditEngine->pImpEditEngine->GetEditDoc() );
- // 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 ) ) )
- {
- EditPaM aPaM = aSel.Min();
- const CharAttribArray& rAttrs = aPaM.GetNode()->GetCharAttribs().GetAttribs();
- sal_uInt16 nXPos = aPaM.GetIndex();
- for ( sal_uInt16 nAttr = rAttrs.Count(); nAttr; )
- {
- EditCharAttrib* pAttr = rAttrs[--nAttr];
- if ( pAttr->GetStart() == nXPos )
- if ( pAttr->Which() == EE_FEATURE_FIELD )
- {
- DBG_ASSERT( pAttr->GetItem()->ISA( SvxFieldItem ), "No FeldItem..." );
- return (const SvxFieldItem*)pAttr->GetItem();
- }
- }
- }
- return 0;
-}
-
-XubString EditView::GetWordUnderMousePointer() const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- Rectangle aRect;
- return GetWordUnderMousePointer( aRect );
-}
-
-XubString EditView::GetWordUnderMousePointer( Rectangle& rWordRect ) const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- Point aPos = pImpEditView->GetWindow()->GetPointerPosPixel();
- aPos = pImpEditView->GetWindow()->PixelToLogic( aPos );
-
- XubString aWord;
-
- if( GetOutputArea().IsInside( aPos ) )
- {
- ImpEditEngine* pImpEE = pImpEditView->pEditEngine->pImpEditEngine;
- Point aDocPos( pImpEditView->GetDocPos( aPos ) );
- EditPaM aPaM = pImpEE->GetPaM( aDocPos, sal_False );
- EditSelection aWordSel = pImpEE->SelectWord( aPaM );
-
- Rectangle aTopLeftRec( pImpEE->PaMtoEditCursor( aWordSel.Min() ) );
- Rectangle aBottomRightRec( pImpEE->PaMtoEditCursor( aWordSel.Max() ) );
-
-#if OSL_DEBUG_LEVEL > 1
- DBG_ASSERT( aTopLeftRec.Top() == aBottomRightRec.Top(), "Top () is different in one line?");
-#endif
-
- Point aPnt1( pImpEditView->GetWindowPos( aTopLeftRec.TopLeft() ) );
- Point aPnt2( pImpEditView->GetWindowPos( aBottomRightRec.BottomRight()) );
- rWordRect = Rectangle( aPnt1, aPnt2 );
- aWord = pImpEE->GetSelected( aWordSel );
- }
-
- return aWord;
-}
-
-void EditView::SetInvalidateMore( sal_uInt16 nPixel )
-{
- DBG_CHKTHIS( EditView, 0 );
- pImpEditView->SetInvalidateMore( nPixel );
-}
-
-sal_uInt16 EditView::GetInvalidateMore() const
-{
- DBG_CHKTHIS( EditView, 0 );
- return (sal_uInt16)pImpEditView->GetInvalidateMore();
-}
-
-static void ChangeFontSizeImpl( EditView* pEditView, bool bGrow, const ESelection& rSel, const FontList* pFontList )
-{
- pEditView->SetSelection( rSel );
-
- SfxItemSet aSet( pEditView->GetAttribs() );
- if( EditView::ChangeFontSize( bGrow, aSet, pFontList ) )
- {
- SfxItemSet aNewSet( pEditView->GetEmptyItemSet() );
- aNewSet.Put( aSet.Get( EE_CHAR_FONTHEIGHT ), EE_CHAR_FONTHEIGHT );
- aNewSet.Put( aSet.Get( EE_CHAR_FONTHEIGHT_CJK ), EE_CHAR_FONTHEIGHT_CJK );
- aNewSet.Put( aSet.Get( EE_CHAR_FONTHEIGHT_CTL ), EE_CHAR_FONTHEIGHT_CTL );
- pEditView->SetAttribs( aNewSet );
- }
-}
-
-void EditView::ChangeFontSize( bool bGrow, const FontList* pFontList )
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- EditEngine& rEditEngine = *pImpEditView->pEditEngine;
-
- ESelection aSel( GetSelection() );
- ESelection aOldSelection( aSel );
- aSel.Adjust();
-
- if( !aSel.HasRange() )
- {
- aSel = rEditEngine.GetWord( aSel, com::sun::star::i18n::WordType::DICTIONARY_WORD );
- }
-
- if( aSel.HasRange() )
- {
- for( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
- {
- SvUShorts aPortions;
- rEditEngine.GetPortions( nPara, aPortions );
-
- if( aPortions.Count() == 0 )
- aPortions.Insert( rEditEngine.GetTextLen(nPara), 0 );
-
- const sal_uInt16 nBeginPos = (nPara == aSel.nStartPara) ? aSel.nStartPos : 0;
- const sal_uInt16 nEndPos = (nPara == aSel.nEndPara) ? aSel.nEndPos : 0xffff;
-
- for ( sal_uInt16 nPos = 0; nPos < aPortions.Count(); ++nPos )
- {
- sal_uInt16 nPortionEnd = aPortions.GetObject( nPos );
- sal_uInt16 nPortionStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0;
-
- if( (nPortionEnd < nBeginPos) || (nPortionStart > nEndPos) )
- continue;
-
- if( nPortionStart < nBeginPos )
- nPortionStart = nBeginPos;
- if( nPortionEnd > nEndPos )
- nPortionEnd = nEndPos;
-
- if( nPortionStart == nPortionEnd )
- continue;
-
- ESelection aPortionSel( nPara, nPortionStart, nPara, nPortionEnd );
- ChangeFontSizeImpl( this, bGrow, aPortionSel, pFontList );
- }
- }
- }
- else
- {
- ChangeFontSizeImpl( this, bGrow, aSel, pFontList );
- }
-
- SetSelection( aOldSelection );
-}
-
-bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList )
-{
- static const sal_uInt16 gFontSizeWichMap[] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL, 0 };
-
- const SvxFontItem* pFontItem = static_cast<const SvxFontItem*>(&rSet.Get( EE_CHAR_FONTINFO ));
- if( !pFontItem || !pFontList )
- return false;
-
- bool bRet = false;
-
- const sal_uInt16* pWhich = gFontSizeWichMap;
- while( *pWhich )
- {
- SvxFontHeightItem aFontHeightItem( static_cast<const SvxFontHeightItem&>(rSet.Get( *pWhich )) );
- long nHeight = aFontHeightItem.GetHeight();
- const SfxMapUnit eUnit = rSet.GetPool()->GetMetric( *pWhich );
- nHeight = OutputDevice::LogicToLogic( nHeight * 10, (MapUnit)eUnit, MAP_POINT );
-
- FontInfo aFontInfo = pFontList->Get( pFontItem->GetFamilyName(), pFontItem->GetStyleName() );
- const long* pAry = pFontList->GetSizeAry( aFontInfo );
-
- if( bGrow )
- {
- while( *pAry )
- {
- if( *pAry > nHeight )
- {
- nHeight = *pAry;
- break;
- }
- pAry++;
- }
-
- if( *pAry == 0 )
- {
- nHeight += (nHeight + 5) / 10;
- if( nHeight > 9999 )
- nHeight = 9999;
- }
-
- }
- else if( *pAry )
- {
- bool bFound = false;
- if( *pAry < nHeight )
- {
- pAry++;
- while( *pAry )
- {
- if( *pAry >= nHeight )
- {
- nHeight = pAry[-1];
- bFound = true;
- break;
- }
- pAry++;
- }
- }
-
- if( !bFound )
- {
- nHeight -= (nHeight + 5) / 10;
- if( nHeight < 2 )
- nHeight = 2;
- }
- }
-
- if( (nHeight >= 2) && (nHeight <= 9999 ) )
- {
- nHeight = OutputDevice::LogicToLogic( nHeight, MAP_POINT, (MapUnit)eUnit ) / 10;
-
- if( nHeight != (long)aFontHeightItem.GetHeight() )
- {
- aFontHeightItem.SetHeight( nHeight );
- rSet.Put( aFontHeightItem, *pWhich );
- bRet = true;
- }
- }
- pWhich++;
- }
- return bRet;
-}
-
-String EditView::GetSurroundingText() const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( PIMPEE->GetEditDoc() );
-
- if( HasSelection() )
- {
- XubString aStr = PIMPEE->GetSelected( aSel );
-
- // Stop reconversion if the selected text includes a line break.
- if ( aStr.Search( 0x0A ) == STRING_NOTFOUND )
- return aStr;
- else
- return String();
- }
- else
- {
- aSel.Min().SetIndex( 0 );
- aSel.Max().SetIndex( aSel.Max().GetNode()->Len() );
- return PIMPEE->GetSelected( aSel );
- }
-}
-
-Selection EditView::GetSurroundingTextSelection() const
-{
- DBG_CHKTHIS( EditView, 0 );
-
- ESelection aSelection( GetSelection() );
- aSelection.Adjust();
-
- if( HasSelection() )
- {
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( PIMPEE->GetEditDoc() );
- XubString aStr = PIMPEE->GetSelected( aSel );
-
- // Stop reconversion if the selected text includes a line break.
- if ( aStr.Search( 0x0A ) == STRING_NOTFOUND )
- return Selection( 0, aSelection.nEndPos - aSelection.nStartPos );
- else
- return Selection( 0, 0 );
- }
- else
- {
- 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
deleted file mode 100644
index 7396bc7d93..0000000000
--- a/editeng/source/editeng/edtspell.cxx
+++ /dev/null
@@ -1,761 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-
-#include <impedit.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/editeng.hxx>
-#include <edtspell.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/fontitem.hxx>
-#include <svl/intitem.hxx>
-#include <svl/eitem.hxx>
-#include <editeng/unolingu.hxx>
-#include <linguistic/lngprops.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-using ::rtl::OUString;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::linguistic2;
-
-
-EditSpellWrapper::EditSpellWrapper( Window* _pWin,
- Reference< XSpellChecker1 > &xChecker,
- sal_Bool bIsStart, sal_Bool bIsAllRight, EditView* pView ) :
- SvxSpellWrapper( _pWin, xChecker, bIsStart, bIsAllRight )
-{
- DBG_ASSERT( pView, "One view has to be abandoned!" );
- // Keep IgnoreList, delete ReplaceList...
- if (SvxGetChangeAllList().is())
- SvxGetChangeAllList()->clear();
- pEditView = pView;
-}
-
-void EditSpellWrapper::SpellStart( SvxSpellArea eArea )
-{
- ImpEditEngine* pImpEE = pEditView->GetImpEditEngine();
- SpellInfo* pSpellInfo = pImpEE->GetSpellInfo();
-
- if ( eArea == SVX_SPELL_BODY_START )
- {
- // 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;
- pSpellInfo->aSpellTo = pSpellInfo->aSpellStart;
- pEditView->GetImpEditView()->SetEditSelection(
- pImpEE->GetEditDoc().GetStartPaM() );
- }
- else
- {
- pSpellInfo->bSpellToEnd = sal_True;
- pSpellInfo->aSpellTo = pImpEE->CreateEPaM(
- pImpEE->GetEditDoc().GetStartPaM() );
- }
- }
- else if ( eArea == SVX_SPELL_BODY_END )
- {
- // 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;
- pSpellInfo->aSpellTo = pImpEE->CreateEPaM(
- pImpEE->GetEditDoc().GetEndPaM() );
- }
- else
- {
- pSpellInfo->bSpellToEnd = sal_False;
- pSpellInfo->aSpellTo = pSpellInfo->aSpellStart;
- pEditView->GetImpEditView()->SetEditSelection(
- pImpEE->GetEditDoc().GetEndPaM() );
- }
- }
- else if ( eArea == SVX_SPELL_BODY )
- {
- ; // Is handled by the App through SpellNextDocument
- }
- else
- {
- OSL_FAIL( "SpellStart: Unknown Area!" );
- }
-}
-
-sal_Bool EditSpellWrapper::SpellContinue()
-{
- SetLast( pEditView->GetImpEditEngine()->ImpSpell( pEditView ) );
- return GetLast().is();
-}
-
-void EditSpellWrapper::SpellEnd()
-{
- // Base class will show language errors...
- SvxSpellWrapper::SpellEnd();
-}
-
-sal_Bool EditSpellWrapper::HasOtherCnt()
-{
- return sal_False;
-}
-
-sal_Bool EditSpellWrapper::SpellMore()
-{
- ImpEditEngine* pImpEE = pEditView->GetImpEditEngine();
- SpellInfo* pSpellInfo = pImpEE->GetSpellInfo();
- sal_Bool bMore = sal_False;
- if ( pSpellInfo->bMultipleDoc )
- {
- bMore = pImpEE->GetEditEnginePtr()->SpellNextDocument();
- if ( bMore )
- {
- // 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() );
- }
- }
- return bMore;
-}
-
-void EditSpellWrapper::ScrollArea()
-{
- // No further action needed ...
- // Except for, that the area is to be scrolled in the center, and not stand
- // still anywhere.
-}
-
-void EditSpellWrapper::ReplaceAll( const String &rNewText,
- sal_Int16 )
-{
- // Is called when the word is in ReplaceList of the spell checker
- pEditView->InsertText( rNewText );
- CheckSpellTo();
-}
-
-void EditSpellWrapper::ChangeWord( const String& rNewWord,
- const sal_uInt16 )
-{
- // Will be called when Word Button Change
- // or internally by me ChangeAll
-
- // 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 EditSpellWrapper::ChangeThesWord( const String& rNewWord )
-{
- pEditView->InsertText( rNewWord );
- CheckSpellTo();
-}
-
-void EditSpellWrapper::AutoCorrect( const String&, const String& )
-{
-}
-
-void EditSpellWrapper::CheckSpellTo()
-{
- ImpEditEngine* pImpEE = pEditView->GetImpEditEngine();
- SpellInfo* pSpellInfo = pImpEE->GetSpellInfo();
- EditPaM aPaM( pEditView->GetImpEditView()->GetEditSelection().Max() );
- EPaM aEPaM = pImpEE->CreateEPaM( aPaM );
- if ( aEPaM.nPara == pSpellInfo->aSpellTo.nPara )
- {
- // 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();
- }
-}
-
-//////////////////////////////////////////////////////////////////////
-
-SV_IMPL_VARARR( WrongRanges, WrongRange );
-
-WrongList::WrongList()
-{
- nInvalidStart = 0;
- nInvalidEnd = 0xFFFF;
-}
-
-WrongList::~WrongList()
-{
-}
-
-void WrongList::MarkInvalid( sal_uInt16 nS, sal_uInt16 nE )
-{
- if ( ( nInvalidStart == NOT_INVALID ) || ( nInvalidStart > nS ) )
- nInvalidStart = nS;
- if ( nInvalidEnd < nE )
- nInvalidEnd = nE;
-}
-
-void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsSep )
-{
- if ( !IsInvalid() )
- {
- nInvalidStart = nPos;
- nInvalidEnd = nPos+nNew;
- }
- else
- {
- if ( nInvalidStart > nPos )
- nInvalidStart = nPos;
- if ( nInvalidEnd >= nPos )
- nInvalidEnd = nInvalidEnd + nNew;
- else
- nInvalidEnd = nPos+nNew;
- }
-
- for ( sal_uInt16 n = 0; n < Count(); n++ )
- {
- WrongRange& rWrong = GetObject( n );
- sal_Bool bRefIsValid = sal_True;
- if ( rWrong.nEnd >= nPos )
- {
- // Move all Wrongs after the insert position...
- if ( rWrong.nStart > nPos )
- {
- rWrong.nStart = rWrong.nStart + nNew;
- rWrong.nEnd = rWrong.nEnd + nNew;
- }
- // 1: Starts before and goes until nPos...
- else if ( rWrong.nEnd == nPos )
- {
- // Should be halted at a blank!
- if ( !bPosIsSep )
- rWrong.nEnd = rWrong.nEnd + nNew;
- }
- // 2: Starts before and goes until after nPos...
- else if ( ( rWrong.nStart < nPos ) && ( rWrong.nEnd > nPos ) )
- {
- rWrong.nEnd = rWrong.nEnd + nNew;
- // When a separator remove and re-examine the Wrong
- if ( bPosIsSep )
- {
- // Split Wrong...
- WrongRange aNewWrong( rWrong.nStart, nPos );
- rWrong.nStart = nPos+1;
- Insert( aNewWrong, n );
- bRefIsValid = sal_False; // Reference no longer valid after Insert, the other was inserted in front of this position
- n++; // This not again ...
- }
- }
- // 3: Attribute starts at position ..
- else if ( rWrong.nStart == nPos )
- {
- rWrong.nEnd = rWrong.nEnd + nNew;
- if ( bPosIsSep )
- rWrong.nStart++;
- }
- }
- DBG_ASSERT( !bRefIsValid || ( rWrong.nStart < rWrong.nEnd ),
- "TextInserted, WrongRange: Start >= End?!" );
- (void)bRefIsValid;
- }
-
- DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList broken!" );
-}
-
-void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nDeleted )
-{
- sal_uInt16 nEndChanges = nPos+nDeleted;
- if ( !IsInvalid() )
- {
- sal_uInt16 nNewInvalidStart = nPos ? nPos - 1 : 0;
- nInvalidStart = nNewInvalidStart;
- nInvalidEnd = nNewInvalidStart + 1;
- }
- else
- {
- if ( nInvalidStart > nPos )
- nInvalidStart = nPos;
- if ( nInvalidEnd > nPos )
- {
- if ( nInvalidEnd > nEndChanges )
- nInvalidEnd = nInvalidEnd - nDeleted;
- else
- nInvalidEnd = nPos+1;
- }
- }
-
- for ( sal_uInt16 n = 0; n < Count(); n++ )
- {
- WrongRange& rWrong = GetObject( n );
- sal_Bool bDelWrong = sal_False;
- if ( rWrong.nEnd >= nPos )
- {
- // Move all Wrongs after the insert position...
- if ( rWrong.nStart >= nEndChanges )
- {
- rWrong.nStart = rWrong.nStart - nDeleted;
- rWrong.nEnd = rWrong.nEnd - nDeleted;
- }
- // 1. Delete Internal Wrongs ...
- else if ( ( rWrong.nStart >= nPos ) && ( rWrong.nEnd <= nEndChanges ) )
- {
- bDelWrong = sal_True;
- }
- // 2. Wrong begins before, ends inside or behind it ...
- else if ( ( rWrong.nStart <= nPos ) && ( rWrong.nEnd > nPos ) )
- {
- if ( rWrong.nEnd <= nEndChanges ) // ends inside
- rWrong.nEnd = nPos;
- else
- rWrong.nEnd = rWrong.nEnd - nDeleted; // ends after
- }
- // 3. Wrong begins inside, ending after ...
- else if ( ( rWrong.nStart >= nPos ) && ( rWrong.nEnd > nEndChanges ) )
- {
- rWrong.nStart = nEndChanges;
- rWrong.nStart = rWrong.nStart - nDeleted;
- rWrong.nEnd = rWrong.nEnd - nDeleted;
- }
- }
- DBG_ASSERT( rWrong.nStart < rWrong.nEnd,
- "TextInserted, WrongRange: Start >= End?!" );
- if ( bDelWrong )
- {
- Remove( n, 1 );
- n--;
- }
- }
-
- DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList broken!" );
-}
-
-sal_Bool WrongList::NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const
-{
- /*
- 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++ )
- {
- WrongRange& rWrong = GetObject( n );
- if ( rWrong.nEnd > rnStart )
- {
- rnStart = rWrong.nStart;
- rnEnd = rWrong.nEnd;
- return sal_True;
- }
- }
- return sal_False;
-}
-
-sal_Bool WrongList::HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const
-{
- for ( sal_uInt16 n = 0; n < Count(); n++ )
- {
- WrongRange& rWrong = GetObject( n );
- if ( ( rWrong.nStart == nStart ) && ( rWrong.nEnd == nEnd ) )
- return sal_True;
- else if ( rWrong.nStart >= nStart )
- break;
- }
- return sal_False;
-}
-
-sal_Bool WrongList::HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const
-{
- for ( sal_uInt16 n = 0; n < Count(); n++ )
- {
- WrongRange& rWrong = GetObject( n );
- if ( ( rWrong.nEnd >= nStart ) && ( rWrong.nStart < nEnd ) )
- return sal_True;
- else if ( rWrong.nStart >= nEnd )
- break;
- }
- return sal_False;
-}
-
-void WrongList::ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd,
- const ContentNode* pNode )
-{
- for ( sal_uInt16 n = 0; n < Count(); n++ )
- {
- WrongRange& rWrong = GetObject( n );
- if ( ( rWrong.nEnd > nStart ) && ( rWrong.nStart < nEnd ) )
- {
- if ( rWrong.nEnd > nEnd ) // Runs out
- {
- rWrong.nStart = nEnd;
- // Blanks?
- while ( ( rWrong.nStart < pNode->Len() ) &&
- ( ( pNode->GetChar( rWrong.nStart ) == ' ' ) ||
- ( pNode->IsFeature( rWrong.nStart ) ) ) )
- {
- rWrong.nStart++;
- }
- }
- else
- {
- Remove( n, 1 );
- n--;
- }
- }
- }
-
- DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList broken!" );
-}
-
-void WrongList::InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd,
- sal_Bool bClearRange )
-{
- sal_uInt16 nPos = Count();
- for ( sal_uInt16 n = 0; n < Count(); n++ )
- {
- WrongRange& rWrong = GetObject( n );
- if ( rWrong.nStart >= nStart )
- {
- nPos = n;
- if ( bClearRange )
- {
- // 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 ) )
- rWrong.nStart = nEnd+1;
- }
- break;
- }
- }
- Insert( WrongRange( nStart, nEnd ), nPos );
-
- DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList broken!" );
-}
-
-void WrongList::MarkWrongsInvalid()
-{
- if ( Count() )
- MarkInvalid( GetObject( 0 ).nStart, GetObject( Count()-1 ).nEnd );
-}
-
-WrongList* WrongList::Clone() const
-{
- WrongList* pNew = new WrongList;
- for ( sal_uInt16 n = 0; n < Count(); n++ )
- {
- WrongRange& rWrong = GetObject( n );
- pNew->Insert( rWrong, pNew->Count() );
- }
-
- return pNew;
-}
-
-// #i102062#
-bool WrongList::operator==(const WrongList& rCompare) const
-{
- // cleck direct members
- if(GetInvalidStart() != rCompare.GetInvalidStart()
- || GetInvalidEnd() != rCompare.GetInvalidEnd()
- || Count() != rCompare.Count())
- {
- return false;
- }
-
- for(sal_uInt16 a(0); a < Count(); a++)
- {
- const WrongRange& rCandA(GetObject(a));
- const WrongRange& rCandB(rCompare.GetObject(a));
-
- if(rCandA.nStart != rCandB.nStart
- || rCandA.nEnd != rCandB.nEnd)
- {
- return false;
- }
- }
-
- return true;
-}
-
-#ifdef DBG_UTIL
-sal_Bool WrongList::DbgIsBuggy() const
-{
- // Check if the ranges overlap.
- sal_Bool bError = sal_False;
- for ( sal_uInt16 _nA = 0; !bError && ( _nA < Count() ); _nA++ )
- {
- WrongRange& rWrong = GetObject( _nA );
- for ( sal_uInt16 nB = _nA+1; !bError && ( nB < Count() ); nB++ )
- {
- WrongRange& rNextWrong = GetObject( nB );
- // 1) Start before, End after the second Start
- if ( ( rWrong.nStart <= rNextWrong.nStart )
- && ( rWrong.nEnd >= rNextWrong.nStart ) )
- bError = sal_True;
- // 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;
- }
- }
- return bError;
-}
-#endif
-
-//////////////////////////////////////////////////////////////////////
-
-EdtAutoCorrDoc::EdtAutoCorrDoc( ImpEditEngine* pE, ContentNode* pN,
- sal_uInt16 nCrsr, xub_Unicode cIns )
-{
- pImpEE = pE;
- pCurNode = pN;
- nCursor = nCrsr;
-
- bUndoAction = sal_False;
- bAllowUndoAction = cIns ? sal_True : sal_False;
-}
-
-EdtAutoCorrDoc::~EdtAutoCorrDoc()
-{
- if ( bUndoAction )
- pImpEE->UndoActionEnd( EDITUNDO_INSERT );
-}
-
-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 in the heart of the action?!" );
- nCursor -= ( nEnd-nStt );
- bAllowUndoAction = sal_False;
- return sal_True;
-}
-
-sal_Bool EdtAutoCorrDoc::Insert( sal_uInt16 nPos, const String& rTxt )
-{
- EditSelection aSel = EditPaM( pCurNode, nPos );
- pImpEE->ImpInsertText( aSel, rTxt );
- DBG_ASSERT( nCursor >= nPos, "Cursor in the heart of the action?!" );
- nCursor = nCursor + rTxt.Len();
-
- if ( bAllowUndoAction && ( rTxt.Len() == 1 ) )
- ImplStartUndoAction();
- bAllowUndoAction = sal_False;
-
- return sal_True;
-}
-
-sal_Bool EdtAutoCorrDoc::Replace( sal_uInt16 nPos, const String& rTxt )
-{
- return ReplaceRange( nPos, rTxt.Len(), rTxt );
-}
-
-sal_Bool EdtAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength, const String& rTxt )
-{
- // Actually a Replace introduce => corresponds to UNDO
- sal_uInt16 nEnd = nPos+nSourceLength;
- if ( nEnd > pCurNode->Len() )
- nEnd = pCurNode->Len();
-
- // #i5925# First insert new text behind to be deleted text, for keeping attributes.
- pImpEE->ImpInsertText( EditSelection( EditPaM( pCurNode, nEnd ) ), rTxt );
- pImpEE->ImpDeleteSelection( EditSelection( EditPaM( pCurNode, nPos ), EditPaM( pCurNode, nEnd ) ) );
-
- if ( nPos == nCursor )
- nCursor = nCursor + rTxt.Len();
-
- if ( bAllowUndoAction && ( rTxt.Len() == 1 ) )
- ImplStartUndoAction();
-
- bAllowUndoAction = sal_False;
-
- return sal_True;
-}
-
-sal_Bool EdtAutoCorrDoc::SetAttr( sal_uInt16 nStt, sal_uInt16 nEnd,
- sal_uInt16 nSlotId, SfxPoolItem& rItem )
-{
- SfxItemPool* pPool = &pImpEE->GetEditDoc().GetItemPool();
- while ( pPool->GetSecondaryPool() &&
- !pPool->GetName().EqualsAscii( "EditEngineItemPool" ) )
- {
- pPool = pPool->GetSecondaryPool();
-
- }
- sal_uInt16 nWhich = pPool->GetWhich( nSlotId );
- if ( nWhich )
- {
- rItem.SetWhich( nWhich );
-
- SfxItemSet aSet( pImpEE->GetEmptyItemSet() );
- aSet.Put( rItem );
-
- EditSelection aSel( EditPaM( pCurNode, nStt ), EditPaM( pCurNode, nEnd ) );
- aSel.Max().SetIndex( nEnd ); // ???
- pImpEE->SetAttribs( aSel, aSet, ATTRSPECIAL_EDGE );
- bAllowUndoAction = sal_False;
- }
- return sal_True;
-}
-
-sal_Bool EdtAutoCorrDoc::SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd,
- const String& rURL )
-{
- // 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 in the heart of the action ?!" );
- nCursor -= ( nEnd-nStt );
- SvxFieldItem aField( SvxURLField( rURL, aText, SVXURLFORMAT_REPR ),
- EE_FEATURE_FIELD );
- pImpEE->InsertField( aSel, aField );
- nCursor++;
- pImpEE->UpdateFields();
- bAllowUndoAction = sal_False;
- return sal_True;
-}
-
-sal_Bool EdtAutoCorrDoc::HasSymbolChars( sal_uInt16 nStt, sal_uInt16 nEnd )
-{
- sal_uInt16 nScriptType = pImpEE->GetScriptType( EditPaM( pCurNode, nStt ) );
- sal_uInt16 nScriptFontInfoItemId = GetScriptItemId( EE_CHAR_FONTINFO, nScriptType );
-
- CharAttribArray& rAttribs = pCurNode->GetCharAttribs().GetAttribs();
- sal_uInt16 nAttrs = rAttribs.Count();
- for ( sal_uInt16 n = 0; n < nAttrs; n++ )
- {
- EditCharAttrib* pAttr = rAttribs.GetObject( n );
- if ( pAttr->GetStart() >= nEnd )
- return sal_False;
-
- if ( ( pAttr->Which() == nScriptFontInfoItemId ) &&
- ( ((SvxFontItem*)pAttr->GetItem())->GetCharSet() == RTL_TEXTENCODING_SYMBOL ) )
- {
- // check if the Attribtuteis within range...
- if ( pAttr->GetEnd() >= nStt )
- return sal_True;
- }
- }
- return sal_False;
-}
-
-const String* EdtAutoCorrDoc::GetPrevPara( sal_Bool )
-{
- // Return previous paragraph, so that it can be determined,
- // whether the current word is at the beginning of a sentence.
-
- bAllowUndoAction = sal_False; // Not anymore ...
-
- ContentList& rNodes = pImpEE->GetEditDoc();
- sal_uInt16 nPos = rNodes.GetPos( pCurNode );
-
- // 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 ) )
- {
- // The Outliner has still a Bullet at Level 0.
- const SfxInt16Item& rLevel = (const SfxInt16Item&)
- pImpEE->GetParaAttrib( nPos, EE_PARA_OUTLLEVEL );
- if ( rLevel.GetValue() == 0 )
- bBullet = sal_True;
- }
- if ( bBullet )
- return NULL;
-
- for ( sal_uInt16 n = nPos; n; )
- {
- n--;
- ContentNode* pNode = rNodes[n];
- if ( pNode->Len() )
- return pNode;
- }
- return NULL;
-
-}
-
-sal_Bool EdtAutoCorrDoc::ChgAutoCorrWord( sal_uInt16& rSttPos,
- sal_uInt16 nEndPos, SvxAutoCorrect& rACorrect,
- const String** ppPara )
-{
- // 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;
-
- if( !aShort.Len() )
- return bRet;
-
- LanguageType eLang = pImpEE->GetLanguage( EditPaM( pCurNode, rSttPos+1 ) );
- const SvxAutocorrWord* pFnd = rACorrect.SearchWordsInList( *pCurNode, rSttPos, nEndPos, *this, eLang );
- if( pFnd && pFnd->IsTextOnly() )
- {
- // then replace
- EditSelection aSel( EditPaM( pCurNode, rSttPos ),
- EditPaM( pCurNode, nEndPos ) );
- aSel = pImpEE->ImpDeleteSelection( aSel );
- DBG_ASSERT( nCursor >= nEndPos, "Cursor in the heart of the action?!" );
- nCursor -= ( nEndPos-rSttPos );
- pImpEE->ImpInsertText( aSel, pFnd->GetLong() );
- nCursor = nCursor + pFnd->GetLong().Len();
- if( ppPara )
- *ppPara = pCurNode;
- bRet = sal_True;
- }
-
- return bRet;
-}
-
-LanguageType EdtAutoCorrDoc::GetLanguage( sal_uInt16 nPos, sal_Bool ) const
-{
- return pImpEE->GetLanguage( EditPaM( pCurNode, nPos+1 ) );
-}
-
-void EdtAutoCorrDoc::ImplStartUndoAction()
-{
- sal_uInt16 nPara = pImpEE->GetEditDoc().GetPos( pCurNode );
- ESelection aSel( nPara, nCursor, nPara, nCursor );
- pImpEE->UndoActionStart( EDITUNDO_INSERT, aSel );
- bUndoAction = sal_True;
- bAllowUndoAction = sal_False;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx
deleted file mode 100644
index e62fd29103..0000000000
--- a/editeng/source/editeng/edtspell.hxx
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EDTSPELL_HXX
-#define _EDTSPELL_HXX
-
-#include <svtools/svxbox.hxx>
-#include <editeng/svxenum.hxx>
-#include <editeng/splwrap.hxx>
-#include <editeng/svxacorr.hxx>
-#include <com/sun/star/uno/Reference.h>
-#include <editeng/editengdllapi.h>
-
-namespace com { namespace sun { namespace star { namespace linguistic2 {
- class XSpellChecker1;
-}}}}
-
-
-class EditView;
-class ImpEditEngine;
-class ContentNode;
-
-class EditSpellWrapper : public SvxSpellWrapper
-{
-private:
- EditView* pEditView;
- void CheckSpellTo();
-
-protected:
- virtual void SpellStart( SvxSpellArea eArea );
- virtual sal_Bool SpellContinue(); // Check area
- virtual void ReplaceAll( const String &rNewText, sal_Int16 nLanguage );
- virtual void SpellEnd();
- virtual sal_Bool SpellMore();
- virtual sal_Bool HasOtherCnt();
- virtual void ScrollArea();
- virtual void ChangeWord( const String& rNewWord, const sal_uInt16 nLang );
- virtual void ChangeThesWord( const String& rNewWord );
- virtual void AutoCorrect( const String& rOldWord, const String& rNewWord );
-
-public:
- EditSpellWrapper( Window* pWin,
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > &xChecker,
- sal_Bool bIsStart,
- sal_Bool bIsAllRight, EditView* pView );
-
-};
-
-
-struct WrongRange
-{
- sal_uInt16 nStart;
- sal_uInt16 nEnd;
-
- WrongRange( sal_uInt16 nS, sal_uInt16 nE ) { nStart = nS; nEnd = nE; }
-};
-
-SV_DECL_VARARR( WrongRanges, WrongRange, 4, 4 )
-#define NOT_INVALID 0xFFFF
-
-class WrongList : private WrongRanges
-{
-private:
- sal_uInt16 nInvalidStart;
- sal_uInt16 nInvalidEnd;
-
- sal_Bool DbgIsBuggy() const;
-
-public:
- WrongList();
- ~WrongList();
-
- sal_Bool IsInvalid() const { return nInvalidStart != NOT_INVALID; }
- void SetValid() { nInvalidStart = NOT_INVALID; nInvalidEnd = 0; }
- void MarkInvalid( sal_uInt16 nS, sal_uInt16 nE );
-
- sal_uInt16 Count() const { return WrongRanges::Count(); }
-
- // When one knows what to do:
- WrongRange& GetObject( sal_uInt16 n ) const { return WrongRanges::GetObject( n ); }
- void InsertWrong( const WrongRange& rWrong, sal_uInt16 nPos );
-
- sal_uInt16 GetInvalidStart() const { return nInvalidStart; }
- sal_uInt16& GetInvalidStart() { return nInvalidStart; }
-
- sal_uInt16 GetInvalidEnd() const { return nInvalidEnd; }
- sal_uInt16& GetInvalidEnd() { return nInvalidEnd; }
-
- void TextInserted( sal_uInt16 nPos, sal_uInt16 nChars, sal_Bool bPosIsSep );
- void TextDeleted( sal_uInt16 nPos, sal_uInt16 nChars );
-
- void ResetRanges() { Remove( 0, Count() ); }
- sal_Bool HasWrongs() const { return Count() != 0; }
- void InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd, sal_Bool bClearRange );
- sal_Bool NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const;
- sal_Bool HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const;
- sal_Bool HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const;
- void ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd, const ContentNode* pNode );
- void MarkWrongsInvalid();
-
- WrongList* Clone() const;
-
- // #i102062#
- bool operator==(const WrongList& rCompare) const;
-};
-
-inline void WrongList::InsertWrong( const WrongRange& rWrong, sal_uInt16 nPos )
-{
- WrongRanges::Insert( rWrong, nPos );
-#ifdef DBG_UTIL
- DBG_ASSERT( !DbgIsBuggy(), "Insert: WrongList broken!" );
-#endif
-}
-
-
-
-class EdtAutoCorrDoc : public SvxAutoCorrDoc
-{
- ImpEditEngine* pImpEE;
- ContentNode* pCurNode;
- sal_uInt16 nCursor;
-
- sal_Bool bAllowUndoAction;
- sal_Bool bUndoAction;
-
-protected:
- void ImplStartUndoAction();
-
-public:
- EdtAutoCorrDoc( ImpEditEngine* pImpEE, ContentNode* pCurNode, sal_uInt16 nCrsr, xub_Unicode cIns );
- ~EdtAutoCorrDoc();
-
- virtual sal_Bool Delete( sal_uInt16 nStt, sal_uInt16 nEnd );
- virtual sal_Bool Insert( sal_uInt16 nPos, const String& rTxt );
- virtual sal_Bool Replace( sal_uInt16 nPos, const String& rTxt );
- virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt );
-
- virtual sal_Bool SetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, sal_uInt16 nSlotId, SfxPoolItem& );
- virtual sal_Bool SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, const String& rURL );
-
- virtual sal_Bool HasSymbolChars( sal_uInt16 nStt, sal_uInt16 nEnd );
-
- virtual const String* GetPrevPara( sal_Bool bAtNormalPos );
-
- virtual sal_Bool ChgAutoCorrWord( sal_uInt16& rSttPos, sal_uInt16 nEndPos,
- SvxAutoCorrect& rACorrect, const String** ppPara );
-
- virtual LanguageType GetLanguage( sal_uInt16 nPos, sal_Bool bPrevPara = sal_False ) const;
-
- sal_uInt16 GetCursor() const { return nCursor; }
-
-};
-
-#endif // EDTSPELL
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx
deleted file mode 100644
index ecd4124c67..0000000000
--- a/editeng/source/editeng/eehtml.cxx
+++ /dev/null
@@ -1,860 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-#include <eehtml.hxx>
-#include <impedit.hxx>
-#include <editeng/adjitem.hxx>
-#include <editeng/flditem.hxx>
-#include <tools/urlobj.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <svtools/htmltokn.h>
-#include <svtools/htmlkywd.hxx>
-#include <tools/tenccvt.hxx>
-
-#define ACTION_INSERTTEXT 1
-#define ACTION_INSERTPARABRK 2
-
-#define STYLE_PRE 101
-
-EditHTMLParser::EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValueIterator* pHTTPHeaderAttrs )
- : HTMLParser( rIn, true ),
- aBaseURL( rBaseURL ),
- pImpEditEngine(NULL),
- pCurAnchor(NULL),
- bInPara(false),
- bWasInPara(false),
- bFieldsInserted(false),
- bInTitle(false),
- nInTable(0),
- nInCell(0),
- nDefListLevel(0),
- nBulletLevel(0),
- nNumberingLevel(0)
-{
- DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW == GetSrcEncoding( ), "EditHTMLParser::EditHTMLParser: Where does the encoding come from?" );
- DBG_ASSERT( !IsSwitchToUCS2(), "EditHTMLParser::::EditHTMLParser: Switch to UCS2?" );
-
- // Altough the real default encoding is ISO8859-1, we use MS-1252
- // als default encoding.
- SetSrcEncoding( GetExtendedCompatibilityTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) );
-
- // If the file starts with a BOM, switch to UCS2.
- SetSwitchToUCS2( true );
-
- if ( pHTTPHeaderAttrs )
- SetEncodingByHTTPHeader( pHTTPHeaderAttrs );
-}
-
-EditHTMLParser::~EditHTMLParser()
-{
- delete pCurAnchor;
-}
-
-SvParserState EditHTMLParser::CallParser( ImpEditEngine* pImpEE, const EditPaM& rPaM )
-{
- DBG_ASSERT( pImpEE, "CallParser: ImpEditEngine ?!" );
- pImpEditEngine = pImpEE;
- SvParserState _eState = SVPAR_NOTSTARTED;
- if ( pImpEditEngine )
- {
- // Build in wrap mimic in RTF import?
- aCurSel = EditSelection( rPaM, rPaM );
-
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- ImportInfo aImportInfo( HTMLIMP_START, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
-
- ImpSetStyleSheet( 0 );
- _eState = HTMLParser::CallParser();
-
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- ImportInfo aImportInfo( HTMLIMP_END, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
-
- if ( bFieldsInserted )
- pImpEditEngine->UpdateFields();
- }
- return _eState;
-}
-
-void EditHTMLParser::NextToken( int nToken )
-{
- #ifdef DBG_UTIL
- HTML_TOKEN_IDS xID = (HTML_TOKEN_IDS)nToken;
- (void)xID;
- #endif
-
- switch( nToken )
- {
- case HTML_META:
- {
- const HTMLOptions& aOptions = GetOptions();
- size_t nArrLen = aOptions.size();
- bool bEquiv = false;
- for ( size_t i = 0; i < nArrLen; i++ )
- {
- const HTMLOption& aOption = aOptions[i];
- switch( aOption.GetToken() )
- {
- case HTML_O_HTTPEQUIV:
- {
- bEquiv = true;
- }
- break;
- case HTML_O_CONTENT:
- {
- if ( bEquiv )
- {
- rtl_TextEncoding eEnc = GetEncodingByMIME( aOption.GetString() );
- if ( eEnc != RTL_TEXTENCODING_DONTKNOW )
- SetSrcEncoding( eEnc );
- }
- }
- break;
- }
- }
-
- }
- break;
- case HTML_PLAINTEXT_ON:
- case HTML_PLAINTEXT2_ON:
- bInPara = true;
- break;
- case HTML_PLAINTEXT_OFF:
- case HTML_PLAINTEXT2_OFF:
- bInPara = false;
- break;
-
- case HTML_LINEBREAK:
- case HTML_NEWPARA:
- {
- if ( ( bInPara || nInTable ) &&
- ( ( nToken == HTML_LINEBREAK ) || HasTextInCurrentPara() ) )
- {
- ImpInsertParaBreak();
- }
- }
- break;
- case HTML_HORZRULE:
- {
- if ( HasTextInCurrentPara() )
- ImpInsertParaBreak();
- ImpInsertParaBreak();
- }
- case HTML_NONBREAKSPACE:
- {
- if ( bInPara )
- {
- ImpInsertText( String( RTL_CONSTASCII_USTRINGPARAM( " " ) ) );
- }
- }
- break;
- case HTML_RAWDATA:
- if (IsReadStyle() && aToken.Len())
- {
- // Each token represents a single line.
- maStyleSource.append(aToken);
- maStyleSource.append(sal_Unicode('\n'));
- }
- break;
- case HTML_TEXTTOKEN:
- {
- // #i110937# for <title> content, call aImportHdl (no SkipGroup), but don't insert the text into the EditEngine
- if (!bInTitle)
- {
- if ( !bInPara )
- StartPara( false );
-
- String aText = aToken;
- if ( aText.Len() && ( aText.GetChar( 0 ) == ' ' )
- && ThrowAwayBlank() && !IsReadPRE() )
- aText.Erase( 0, 1 );
-
- if ( pCurAnchor )
- {
- pCurAnchor->aText += aText;
- }
- else
- {
- // Only written until HTML with 319?
- if ( IsReadPRE() )
- {
- sal_uInt16 nTabPos = aText.Search( '\t', 0 );
- while ( nTabPos != STRING_NOTFOUND )
- {
- aText.Erase( nTabPos, 1 );
- aText.Insert( String( RTL_CONSTASCII_USTRINGPARAM( " " ) ), nTabPos );
- nTabPos = aText.Search( '\t', nTabPos+8 );
- }
- }
- ImpInsertText( aText );
- }
- }
- }
- break;
-
- case HTML_CENTER_ON:
- case HTML_CENTER_OFF:
- {
- sal_uInt16 nNode = pImpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() );
- SfxItemSet aItems( aCurSel.Max().GetNode()->GetContentAttribs().GetItems() );
- aItems.ClearItem( EE_PARA_JUST );
- if ( nToken == HTML_CENTER_ON )
- aItems.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
- pImpEditEngine->SetParaAttribs( nNode, aItems );
- }
- break;
-
- case HTML_ANCHOR_ON: AnchorStart();
- break;
- case HTML_ANCHOR_OFF: AnchorEnd();
- break;
-
- case HTML_PARABREAK_ON:
- if( bInPara && HasTextInCurrentPara() )
- EndPara( true );
- StartPara( true );
- break;
-
- case HTML_PARABREAK_OFF:
- if( bInPara )
- EndPara( true );
- break;
-
- case HTML_HEAD1_ON:
- case HTML_HEAD2_ON:
- case HTML_HEAD3_ON:
- case HTML_HEAD4_ON:
- case HTML_HEAD5_ON:
- case HTML_HEAD6_ON:
- {
- HeadingStart( nToken );
- }
- break;
-
- case HTML_HEAD1_OFF:
- case HTML_HEAD2_OFF:
- case HTML_HEAD3_OFF:
- case HTML_HEAD4_OFF:
- case HTML_HEAD5_OFF:
- case HTML_HEAD6_OFF:
- {
- HeadingEnd( nToken );
- }
- break;
-
- case HTML_PREFORMTXT_ON:
- case HTML_XMP_ON:
- case HTML_LISTING_ON:
- {
- StartPara( true );
- ImpSetStyleSheet( STYLE_PRE );
- }
- break;
-
- case HTML_DEFLIST_ON:
- {
- nDefListLevel++;
- }
- break;
-
- case HTML_DEFLIST_OFF:
- {
- if( nDefListLevel )
- nDefListLevel--;
- }
- break;
-
- case HTML_TABLE_ON: nInTable++;
- break;
- case HTML_TABLE_OFF: DBG_ASSERT( nInTable, "Not in Table, but TABLE_OFF?" );
- nInTable--;
- break;
-
- case HTML_TABLEHEADER_ON:
- case HTML_TABLEDATA_ON:
- nInCell++;
- // fall through
- case HTML_BLOCKQUOTE_ON:
- case HTML_BLOCKQUOTE_OFF:
- case HTML_BLOCKQUOTE30_ON:
- case HTML_BLOCKQUOTE30_OFF:
- case HTML_LISTHEADER_ON:
- case HTML_LI_ON:
- case HTML_DD_ON:
- case HTML_DT_ON:
- case HTML_ORDERLIST_ON:
- case HTML_UNORDERLIST_ON:
- {
- bool bHasText = HasTextInCurrentPara();
- if ( bHasText )
- ImpInsertParaBreak();
- StartPara( false );
- }
- break;
-
- case HTML_TABLEHEADER_OFF:
- case HTML_TABLEDATA_OFF:
- {
- if ( nInCell )
- nInCell--;
- }
- // fall through
- case HTML_LISTHEADER_OFF:
- case HTML_LI_OFF:
- case HTML_DD_OFF:
- case HTML_DT_OFF:
- case HTML_ORDERLIST_OFF:
- case HTML_UNORDERLIST_OFF: EndPara( false );
- break;
-
- case HTML_TABLEROW_ON:
- case HTML_TABLEROW_OFF: // A RETURN only after a CELL, for Calc
-
- case HTML_COL_ON:
- case HTML_COLGROUP_ON:
- case HTML_COLGROUP_OFF: break;
-
- case HTML_FONT_ON: // ...
- break;
- case HTML_FONT_OFF: // ...
- break;
-
- case HTML_TITLE_ON:
- bInTitle = true;
- break;
- case HTML_TITLE_OFF:
- bInTitle = false;
- break;
-
- // globals
- case HTML_HTML_ON:
- case HTML_HTML_OFF:
- case HTML_STYLE_ON:
- case HTML_STYLE_OFF:
- case HTML_BODY_ON:
- case HTML_BODY_OFF:
- case HTML_HEAD_ON:
- case HTML_HEAD_OFF:
- case HTML_FORM_ON:
- case HTML_FORM_OFF:
- case HTML_THEAD_ON:
- case HTML_THEAD_OFF:
- case HTML_TBODY_ON:
- case HTML_TBODY_OFF:
- // inline elements, structural markup
- // HTML 3.0
- case HTML_BANNER_ON:
- case HTML_BANNER_OFF:
- case HTML_DIVISION_ON:
- case HTML_DIVISION_OFF:
-// case HTML_LISTHEADER_ON: //! special handling
-// case HTML_LISTHEADER_OFF:
- case HTML_NOTE_ON:
- case HTML_NOTE_OFF:
- // inline elements, logical markup
- // HTML 2.0
- case HTML_ADDRESS_ON:
- case HTML_ADDRESS_OFF:
-// case HTML_BLOCKQUOTE_ON: //! special handling
-// case HTML_BLOCKQUOTE_OFF:
- case HTML_CITIATION_ON:
- case HTML_CITIATION_OFF:
- case HTML_CODE_ON:
- case HTML_CODE_OFF:
- case HTML_DEFINSTANCE_ON:
- case HTML_DEFINSTANCE_OFF:
- case HTML_EMPHASIS_ON:
- case HTML_EMPHASIS_OFF:
- case HTML_KEYBOARD_ON:
- case HTML_KEYBOARD_OFF:
- case HTML_SAMPLE_ON:
- case HTML_SAMPLE_OFF:
- case HTML_STRIKE_ON:
- case HTML_STRIKE_OFF:
- case HTML_STRONG_ON:
- case HTML_STRONG_OFF:
- case HTML_VARIABLE_ON:
- case HTML_VARIABLE_OFF:
- // HTML 3.0
- case HTML_ABBREVIATION_ON:
- case HTML_ABBREVIATION_OFF:
- case HTML_ACRONYM_ON:
- case HTML_ACRONYM_OFF:
- case HTML_AUTHOR_ON:
- case HTML_AUTHOR_OFF:
-// case HTML_BLOCKQUOTE30_ON: //! special handling
-// case HTML_BLOCKQUOTE30_OFF:
- case HTML_DELETEDTEXT_ON:
- case HTML_DELETEDTEXT_OFF:
- case HTML_INSERTEDTEXT_ON:
- case HTML_INSERTEDTEXT_OFF:
- case HTML_LANGUAGE_ON:
- case HTML_LANGUAGE_OFF:
- case HTML_PERSON_ON:
- case HTML_PERSON_OFF:
- case HTML_SHORTQUOTE_ON:
- case HTML_SHORTQUOTE_OFF:
- case HTML_SUBSCRIPT_ON:
- case HTML_SUBSCRIPT_OFF:
- case HTML_SUPERSCRIPT_ON:
- case HTML_SUPERSCRIPT_OFF:
- // inline elements, visual markup
- // HTML 2.0
- case HTML_BOLD_ON:
- case HTML_BOLD_OFF:
- case HTML_ITALIC_ON:
- case HTML_ITALIC_OFF:
- case HTML_TELETYPE_ON:
- case HTML_TELETYPE_OFF:
- case HTML_UNDERLINE_ON:
- case HTML_UNDERLINE_OFF:
- // HTML 3.0
- case HTML_BIGPRINT_ON:
- case HTML_BIGPRINT_OFF:
- case HTML_STRIKETHROUGH_ON:
- case HTML_STRIKETHROUGH_OFF:
- case HTML_SMALLPRINT_ON:
- case HTML_SMALLPRINT_OFF:
- // figures
- case HTML_FIGURE_ON:
- case HTML_FIGURE_OFF:
- case HTML_CAPTION_ON:
- case HTML_CAPTION_OFF:
- case HTML_CREDIT_ON:
- case HTML_CREDIT_OFF:
- // misc
- case HTML_DIRLIST_ON:
- case HTML_DIRLIST_OFF:
- case HTML_FOOTNOTE_ON: //! land so im Text
- case HTML_FOOTNOTE_OFF:
- case HTML_MENULIST_ON:
- case HTML_MENULIST_OFF:
-// case HTML_PLAINTEXT_ON: //! special handling
-// case HTML_PLAINTEXT_OFF:
-// case HTML_PREFORMTXT_ON: //! special handling
-// case HTML_PREFORMTXT_OFF:
- case HTML_SPAN_ON:
- case HTML_SPAN_OFF:
- // obsolete
-// case HTML_XMP_ON: //! special handling
-// case HTML_XMP_OFF:
-// case HTML_LISTING_ON: //! special handling
-// case HTML_LISTING_OFF:
- // Netscape
- case HTML_BLINK_ON:
- case HTML_BLINK_OFF:
- case HTML_NOBR_ON:
- case HTML_NOBR_OFF:
- case HTML_NOEMBED_ON:
- case HTML_NOEMBED_OFF:
- case HTML_NOFRAMES_ON:
- case HTML_NOFRAMES_OFF:
- // Internet Explorer
- case HTML_MARQUEE_ON:
- case HTML_MARQUEE_OFF:
-// case HTML_PLAINTEXT2_ON: //! special handling
-// case HTML_PLAINTEXT2_OFF:
- break;
-
- default:
- {
- if ( nToken & HTML_TOKEN_ONOFF )
- {
- if ( ( nToken == HTML_UNKNOWNCONTROL_ON ) || ( nToken == HTML_UNKNOWNCONTROL_OFF ) )
- {
- ;
- }
- else if ( !(nToken & 1) )
- {
- DBG_ASSERT( !( nToken & 1 ), "No Start-Token ?!" );
- SkipGroup( nToken + 1 );
- }
- }
- }
- } // SWITCH
-
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- ImportInfo aImportInfo( HTMLIMP_NEXTTOKEN, this, pImpEditEngine->CreateESel( aCurSel ) );
- aImportInfo.nToken = nToken;
- aImportInfo.nTokenValue = (short)nTokenValue;
- if ( nToken == HTML_TEXTTOKEN )
- aImportInfo.aText = aToken;
- else if (nToken == HTML_STYLE_OFF)
- aImportInfo.aText = maStyleSource.makeStringAndClear();
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
-
-}
-
-void EditHTMLParser::ImpInsertParaBreak()
-{
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- ImportInfo aImportInfo( HTMLIMP_INSERTPARA, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
- aCurSel = pImpEditEngine->ImpInsertParaBreak( aCurSel );
-}
-
-void EditHTMLParser::ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSel )
-{
- // 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() );
-
- if ( !pSel )
- {
- aStartPaM.SetIndex( 0 );
- aEndPaM.SetIndex( aEndPaM.GetNode()->Len() );
- }
-
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- EditSelection aSel( aStartPaM, aEndPaM );
- ImportInfo aImportInfo( HTMLIMP_SETATTR, this, pImpEditEngine->CreateESel( aSel ) );
- aImportInfo.pAttrs = (void*)&rItems;
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
-
- ContentNode* pSN = aStartPaM.GetNode();
- sal_uInt16 nStartNode = pImpEditEngine->GetEditDoc().GetPos( pSN );
-
- // If an attribute goes from 0 to current Paragraph length,
- // then it should be a paragraph attribute!
-
- // Note: Selection can reach over several Paragraphs.
- // All complete paragraphs are paragraph attributes ...
-
- // not really HTML:
-#ifdef DBG_UTIL
- ContentNode* pEN = aEndPaM.GetNode();
- sal_uInt16 nEndNode = pImpEditEngine->GetEditDoc().GetPos( pEN );
- DBG_ASSERT( nStartNode == nEndNode, "ImpSetAttribs: Several paragraphs?" );
-#endif
-
- if ( ( aStartPaM.GetIndex() == 0 ) && ( aEndPaM.GetIndex() == aEndPaM.GetNode()->Len() ) )
- {
- // Has to be merged:
- SfxItemSet aItems( pImpEditEngine->GetParaAttribs( nStartNode ) );
- aItems.Put( rItems );
- pImpEditEngine->SetParaAttribs( nStartNode, aItems );
- }
- else
- pImpEditEngine->SetAttribs( EditSelection( aStartPaM, aEndPaM ), rItems );
-}
-
-void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel )
-{
- /*
- 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() );
-
- 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 );
-
- 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 );
-
- // 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 )
-{
- String aText( rText );
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- ImportInfo aImportInfo( HTMLIMP_INSERTTEXT, this, pImpEditEngine->CreateESel( aCurSel ) );
- aImportInfo.aText = aText;
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
-
- aCurSel = pImpEditEngine->ImpInsertText( aCurSel, aText );
-}
-
-void EditHTMLParser::SkipGroup( int nEndToken )
-{
- // 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;
- int nToken;
- while( nCellLevel <= nInCell && ( (nToken = GetNextToken() ) != nEndToken ) && nToken )
- {
- switch ( nToken )
- {
- case HTML_TABLEHEADER_ON:
- case HTML_TABLEDATA_ON:
- nInCell++;
- break;
- case HTML_TABLEHEADER_OFF:
- case HTML_TABLEDATA_OFF:
- if ( nInCell )
- nInCell--;
- break;
- }
- }
-}
-
-void EditHTMLParser::StartPara( bool bReal )
-{
- if ( bReal )
- {
- const HTMLOptions& aOptions = GetOptions();
- SvxAdjust eAdjust = SVX_ADJUST_LEFT;
- for ( size_t i = 0, n = aOptions.size(); i < n; ++i )
- {
- const HTMLOption& aOption = aOptions[i];
- switch( aOption.GetToken() )
- {
- case HTML_O_ALIGN:
- {
- if ( aOption.GetString().CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_AL_right ) == COMPARE_EQUAL )
- eAdjust = SVX_ADJUST_RIGHT;
- else if ( aOption.GetString().CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_AL_middle ) == COMPARE_EQUAL )
- eAdjust = SVX_ADJUST_CENTER;
- else if ( aOption.GetString().CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_AL_center ) == COMPARE_EQUAL )
- eAdjust = SVX_ADJUST_CENTER;
- else
- eAdjust = SVX_ADJUST_LEFT;
- }
- break;
- }
- }
- SfxItemSet aItemSet( pImpEditEngine->GetEmptyItemSet() );
- aItemSet.Put( SvxAdjustItem( eAdjust, EE_PARA_JUST ) );
- ImpSetAttribs( aItemSet );
- }
- bInPara = true;
-}
-
-void EditHTMLParser::EndPara( bool )
-{
- if ( bInPara )
- {
- bool bHasText = HasTextInCurrentPara();
- if ( bHasText )
- ImpInsertParaBreak();
- }
- bInPara = false;
-}
-
-bool EditHTMLParser::ThrowAwayBlank()
-{
- // A blank must be thrown away if the new text begins with a Blank and
- // if the current paragraph is empty or ends with a Blank...
- ContentNode* pNode = aCurSel.Max().GetNode();
- if ( pNode->Len() && ( pNode->GetChar( pNode->Len()-1 ) != ' ' ) )
- return false;
- return true;
-}
-
-bool EditHTMLParser::HasTextInCurrentPara()
-{
- return aCurSel.Max().GetNode()->Len() ? true : false;
-}
-
-void EditHTMLParser::AnchorStart()
-{
- // ignore anchor in anchor
- if ( !pCurAnchor )
- {
- const HTMLOptions& aOptions = GetOptions();
- String aRef;
-
- for ( size_t i = 0, n = aOptions.size(); i < n; ++i )
- {
- const HTMLOption& aOption = aOptions[i];
- switch( aOption.GetToken() )
- {
- case HTML_O_HREF:
- aRef = aOption.GetString();
- break;
- }
- }
-
- if ( aRef.Len() )
- {
- String aURL = aRef;
- if ( aURL.Len() && ( aURL.GetChar( 0 ) != '#' ) )
- {
- INetURLObject aTargetURL;
- INetURLObject aRootURL( aBaseURL );
- aRootURL.GetNewAbsURL( aRef, &aTargetURL );
- aURL = aTargetURL.GetMainURL( INetURLObject::DECODE_TO_IURI );
- }
- pCurAnchor = new AnchorInfo;
- pCurAnchor->aHRef = aURL;
- }
- }
-}
-
-void EditHTMLParser::AnchorEnd()
-{
- if ( pCurAnchor )
- {
- // Insert as URL-Field...
- SvxFieldItem aFld( SvxURLField( pCurAnchor->aHRef, pCurAnchor->aText, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
- aCurSel = pImpEditEngine->InsertField( aCurSel, aFld );
- bFieldsInserted = true;
- delete pCurAnchor;
- pCurAnchor = NULL;
-
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- ImportInfo aImportInfo( HTMLIMP_INSERTFIELD, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
- }
-}
-
-void EditHTMLParser::HeadingStart( int nToken )
-{
- bWasInPara = bInPara;
- StartPara( false );
-
- if ( bWasInPara && HasTextInCurrentPara() )
- ImpInsertParaBreak();
-
- sal_uInt16 nId = sal::static_int_cast< sal_uInt16 >(
- 1 + ( ( nToken - HTML_HEAD1_ON ) / 2 ) );
- DBG_ASSERT( (nId >= 1) && (nId <= 9), "HeadingStart: ID can not be correct!" );
- ImpSetStyleSheet( nId );
-}
-
-void EditHTMLParser::HeadingEnd( int )
-{
- EndPara( false );
- ImpSetStyleSheet( 0 );
-
- if ( bWasInPara )
- {
- bInPara = true;
- bWasInPara = false;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/eehtml.hxx b/editeng/source/editeng/eehtml.hxx
deleted file mode 100644
index b5ae986963..0000000000
--- a/editeng/source/editeng/eehtml.hxx
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EEHTML_HXX
-#define _EEHTML_HXX
-
-#include <svl/svarray.hxx>
-
-#include <editdoc.hxx>
-#include <svtools/parhtml.hxx>
-
-class ImpEditEngine;
-
-#define MAX_NUMBERLEVEL 10
-
-struct AnchorInfo
-{
- String aHRef;
- String aText;
-};
-
-class EditHTMLParser : public HTMLParser
-{
- using HTMLParser::CallParser;
-private:
- ::rtl::OUStringBuffer maStyleSource;
- EditSelection aCurSel;
- String aBaseURL;
- ImpEditEngine* pImpEditEngine;
- AnchorInfo* pCurAnchor;
-
- bool bInPara:1;
- bool bWasInPara:1; // Remember bInPara before HeadingStart, because afterwards it will be gone.
- bool bFieldsInserted:1;
- bool bInTitle:1;
-
- sal_uInt8 nInTable;
- sal_uInt8 nInCell;
- sal_uInt8 nDefListLevel;
- sal_uInt8 nBulletLevel;
- sal_uInt8 nNumberingLevel;
-
- void StartPara( bool bReal );
- void EndPara( bool bReal );
- void AnchorStart();
- void AnchorEnd();
- void HeadingStart( int nToken );
- void HeadingEnd( int nToken );
- void SkipGroup( int nEndToken );
- bool ThrowAwayBlank();
- bool HasTextInCurrentPara();
-
- void ImpInsertParaBreak();
- void ImpInsertText( const String& rText );
- void ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSel = 0 );
- void ImpSetStyleSheet( sal_uInt16 nHeadingLevel );
-
-protected:
- virtual void NextToken( int nToken );
-
-public:
- EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValueIterator* pHTTPHeaderAttrs );
- ~EditHTMLParser();
-
- virtual SvParserState CallParser( ImpEditEngine* pImpEE, const EditPaM& rPaM );
-
- const EditSelection& GetCurSelection() const { return aCurSel; }
-};
-
-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
deleted file mode 100644
index 31a3b5e376..0000000000
--- a/editeng/source/editeng/eeng_pch.cxx
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// 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
deleted file mode 100644
index 1ae7d8beed..0000000000
--- a/editeng/source/editeng/eeng_pch.hxx
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#define _STD_VAR_ARRAYS
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#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
deleted file mode 100644
index cbe5e85fe0..0000000000
--- a/editeng/source/editeng/eeobj.cxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-
-#include <eeng_pch.hxx>
-
-#include <eeobj.hxx>
-#include <sot/exchange.hxx>
-#include <sot/formats.hxx>
-#include <editeng/editeng.hxx>
-#include <svl/itempool.hxx>
-#include <osl/mutex.hxx>
-#include <vcl/svapp.hxx>
-using namespace ::com::sun::star;
-
-
-EditDataObject::EditDataObject()
-{
-}
-
-EditDataObject::~EditDataObject()
-{
-}
-
-// uno::XInterface
-uno::Any EditDataObject::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( datatransfer::XTransferable*, this ) );
- return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
-}
-
-// datatransfer::XTransferable
-uno::Any EditDataObject::getTransferData( const datatransfer::DataFlavor& rFlavor ) throw(datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeException)
-{
- uno::Any aAny;
-
- sal_uLong nT = SotExchange::GetFormat( rFlavor );
- if ( nT == SOT_FORMAT_STRING )
- {
- aAny <<= (::rtl::OUString)GetString();
- }
- else if ( ( nT == SOT_FORMATSTR_ID_EDITENGINE ) || ( nT == SOT_FORMAT_RTF ) )
- {
- // No RTF on demand any more:
- // 1) Was not working, because I had to flush() the clipboard immediately anyway
- // 2) Don't have the old pool defaults and the StyleSheetPool here.
-
- SvMemoryStream* pStream = ( nT == SOT_FORMATSTR_ID_EDITENGINE ) ? &GetStream() : &GetRTFStream();
- pStream->Seek( STREAM_SEEK_TO_END );
- sal_uLong nLen = pStream->Tell();
- pStream->Seek(0);
-
- uno::Sequence< sal_Int8 > aSeq( nLen );
- memcpy( aSeq.getArray(), pStream->GetData(), nLen );
- aAny <<= aSeq;
- }
- else
- {
- datatransfer::UnsupportedFlavorException aException;
- throw( aException );
- }
-
- return aAny;
-}
-
-uno::Sequence< datatransfer::DataFlavor > EditDataObject::getTransferDataFlavors( ) throw(uno::RuntimeException)
-{
- uno::Sequence< datatransfer::DataFlavor > aDataFlavors(3);
- SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_EDITENGINE, aDataFlavors.getArray()[0] );
- SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aDataFlavors.getArray()[1] );
- SotExchange::GetFormatDataFlavor( SOT_FORMAT_RTF, aDataFlavors.getArray()[2] );
-
- return aDataFlavors;
-}
-
-sal_Bool EditDataObject::isDataFlavorSupported( const datatransfer::DataFlavor& rFlavor ) throw(uno::RuntimeException)
-{
- sal_Bool bSupported = sal_False;
-
- sal_uLong nT = SotExchange::GetFormat( rFlavor );
- if ( ( nT == SOT_FORMAT_STRING ) || ( nT == SOT_FORMAT_RTF ) || ( nT == SOT_FORMATSTR_ID_EDITENGINE ) )
- bSupported = sal_True;
-
- return bSupported;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/eeobj.hxx b/editeng/source/editeng/eeobj.hxx
deleted file mode 100644
index 5629721ecc..0000000000
--- a/editeng/source/editeng/eeobj.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _DATAOBJ_HXX
-#define _DATAOBJ_HXX
-
-#include <cppuhelper/weak.hxx>
-#include <com/sun/star/datatransfer/XTransferable.hpp>
-
-#include <tools/stream.hxx>
-
-class EditDataObject : public ::com::sun::star::datatransfer::XTransferable,
- public ::cppu::OWeakObject
-
-{
-private:
- SvMemoryStream maBinData;
- SvMemoryStream maRTFData;
- String maText;
-
- String maOfficeBookmark;
-
-public:
- EditDataObject();
- ~EditDataObject();
-
- SvMemoryStream& GetStream() { return maBinData; }
- SvMemoryStream& GetRTFStream() { return maRTFData; }
- String& GetString() { return maText; }
- String& GetURL() { return maOfficeBookmark; }
-
-
- // ::com::sun::star::uno::XInterface
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
- void SAL_CALL release() throw() { OWeakObject::release(); }
-
- // ::com::sun::star::datatransfer::XTransferable
- ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw(::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) throw(::com::sun::star::uno::RuntimeException);
- sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw(::com::sun::star::uno::RuntimeException);
-};
-
-#endif // _DATAOBJ_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
deleted file mode 100644
index 9a4e56313a..0000000000
--- a/editeng/source/editeng/eerdll.cxx
+++ /dev/null
@@ -1,236 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <comphelper/processfactory.hxx>
-
-#include <svl/solar.hrc>
-#include <editeng/eerdll.hxx>
-#include <eerdll2.hxx>
-#include <editeng/lspcitem.hxx>
-#include <editeng/adjitem.hxx>
-#include <editeng/tstpitem.hxx>
-#include <editeng/bulitem.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/emphitem.hxx>
-#include <editeng/scriptspaceitem.hxx>
-#include <svl/itempool.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/svapp.hxx>
-
-#include <editeng/akrnitem.hxx>
-#include <editeng/cntritem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/crsditem.hxx>
-#include <editeng/cscoitem.hxx>
-#include <editeng/escpitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/wrlmitem.hxx>
-#include <editeng/numitem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/charscaleitem.hxx>
-#include <editeng/charreliefitem.hxx>
-#include <editeng/frmdiritem.hxx>
-#include <editeng/xmlcnitm.hxx>
-#include <editeng/forbiddencharacterstable.hxx>
-#include <editeng/justifyitem.hxx>
-#include <comphelper/processfactory.hxx>
-#include <rtl/instance.hxx>
-
-using namespace ::com::sun::star;
-
-namespace
-{
- 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;
-}
-
-GlobalEditData::~GlobalEditData()
-{
- // Destroy DefItems...
- // Or simply keep them, since at end of excecution?!
- if ( ppDefItems )
- SfxItemPool::ReleaseDefaults( ppDefItems, EDITITEMCOUNT, sal_True );
-}
-
-SfxPoolItem** GlobalEditData::GetDefItems()
-{
- if ( !ppDefItems )
- {
- ppDefItems = new SfxPoolItem*[EDITITEMCOUNT];
-
- // Paragraph attributes:
- SvxNumRule aTmpNumRule( 0, 0, sal_False );
-
- ppDefItems[0] = new SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR );
- ppDefItems[1] = new SvXMLAttrContainerItem( EE_PARA_XMLATTRIBS );
- ppDefItems[2] = new SfxBoolItem( EE_PARA_HANGINGPUNCTUATION, sal_False );
- ppDefItems[3] = new SfxBoolItem( EE_PARA_FORBIDDENRULES, sal_True );
- ppDefItems[4] = new SvxScriptSpaceItem( sal_True, EE_PARA_ASIANCJKSPACING );
- ppDefItems[5] = new SvxNumBulletItem( aTmpNumRule, EE_PARA_NUMBULLET );
- ppDefItems[6] = new SfxBoolItem( EE_PARA_HYPHENATE, sal_False );
- ppDefItems[7] = new SfxBoolItem( EE_PARA_BULLETSTATE, sal_True );
- ppDefItems[8] = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE );
- ppDefItems[9] = new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 );
- ppDefItems[10] = new SvxBulletItem( EE_PARA_BULLET );
- 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[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 == 52, "ITEMCOUNT geaendert, DefItems nicht angepasst!" );
-
- // Init DefFonts:
- GetDefaultFonts( *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO - EE_ITEMS_START],
- *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO_CJK - EE_ITEMS_START],
- *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO_CTL - EE_ITEMS_START] );
- }
-
- return ppDefItems;
-}
-
-rtl::Reference<SvxForbiddenCharactersTable> GlobalEditData::GetForbiddenCharsTable()
-{
- if ( !xForbiddenCharsTable.is() )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- xForbiddenCharsTable = new SvxForbiddenCharactersTable( xMSF );
- }
- return xForbiddenCharsTable;
-}
-
-uno::Reference< linguistic2::XLanguageGuessing > GlobalEditData::GetLanguageGuesser()
-{
- if (!xLanguageGuesser.is())
- {
- uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() );
- if (xMgr.is())
- {
- xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
- xMgr->createInstance(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.linguistic2.LanguageGuessing" )) ),
- uno::UNO_QUERY );
- }
- }
- return xLanguageGuesser;
-}
-
-OutputDevice* GlobalEditData::GetStdRefDevice()
-{
- if ( !m_aStdRefDevice )
- {
- m_aStdRefDevice.reset(new VirtualDevice);
- m_aStdRefDevice->SetMapMode( MAP_TWIP );
- }
- return m_aStdRefDevice.get();
-}
-
-EditResId::EditResId( sal_uInt16 nId ):
- ResId( nId, *EE_DLL().GetResMgr() )
-{
-}
-
-EditDLL::EditDLL()
-{
- pGlobalData = new GlobalEditData;
- pResMgr = ResMgr::CreateResMgr( "editeng", Application::GetSettings().GetUILocale() );
-}
-
-EditDLL::~EditDLL()
-{
- delete pGlobalData;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/eerdll2.hxx b/editeng/source/editeng/eerdll2.hxx
deleted file mode 100644
index 4073f7ae8d..0000000000
--- a/editeng/source/editeng/eerdll2.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _EERDLL2_HXX
-#define _EERDLL2_HXX
-
-#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
-#include <editeng/forbiddencharacterstable.hxx>
-#include <rtl/ref.hxx>
-#include <comphelper/scoped_disposing_ptr.hxx>
-
-class SfxPoolItem;
-
-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;
-
- rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharsTable;
-
-public:
- GlobalEditData();
- ~GlobalEditData();
-
- SfxPoolItem** GetDefItems();
- OutputDevice* GetStdRefDevice();
-
- 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
deleted file mode 100644
index 15f30917e6..0000000000
--- a/editeng/source/editeng/eertfpar.cxx
+++ /dev/null
@@ -1,633 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-
-#include <eertfpar.hxx>
-#include <impedit.hxx>
-#include <svl/intitem.hxx>
-#include <editeng/escpitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/flditem.hxx>
-
-#include <svtools/rtftoken.h>
-
-// Set all values to defaultt; is called after loading the bitmap!
-void SvxRTFPictureType::ResetValues()
-{ // 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; // Scale in percent
- nCropT = nCropB = nCropL = nCropR = 0;
- aPropertyPairs.clear();
-}
-
-ImportInfo::ImportInfo( ImportState eSt, SvParser* pPrsrs, const ESelection& rSel )
- : aSelection( rSel )
-{
- pParser = pPrsrs,
- eState = eSt;
-
- nToken = 0;
- nTokenValue = 0;
- pAttrs = NULL;
-}
-
-ImportInfo::~ImportInfo()
-{
-}
-
-EditRTFParser::EditRTFParser( SvStream& rIn, EditSelection aSel, SfxItemPool& rAttrPool, ImpEditEngine* pImpEE )
- : SvxRTFParser( rAttrPool, rIn, 0 ), aRTFMapMode( MAP_TWIP )
-{
-
- pImpEditEngine = pImpEE;
- aCurSel = aSel;
- eDestCharSet = RTL_TEXTENCODING_DONTKNOW;
- nDefFont = 0;
- nDefTab = 0;
- nLastAction = 0;
- nDefFontHeight = 0;
-
- SetInsPos( EditPosition( pImpEditEngine, &aCurSel ) );
-
- // Convert the twips values ...
- SetCalcValue( sal_True );
- SetChkStyleAttr( pImpEE->GetStatus().DoImportRTFStyleSheets() );
- SetNewDoc( sal_False ); // So that the Pool-Defaults are not overwritten...
- aEditMapMode = MapMode( pImpEE->GetRefDevice()->GetMapMode().GetMapUnit() );
-}
-
-EditRTFParser::~EditRTFParser()
-{
-}
-
-SvParserState EditRTFParser::CallParser()
-{
- 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();
- // Useful or not?
- aStart2PaM.GetNode()->GetContentAttribs().GetItems().ClearItem();
- AddRTFDefaultValues( aStart2PaM, aStart2PaM );
- EditPaM aEnd1PaM( pImpEditEngine->ImpInsertParaBreak( aCurSel.Max() ) );
- // aCurCel now points to the gap
-
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- ImportInfo aImportInfo( RTFIMP_START, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
-
- SvParserState _eState = SvxRTFParser::CallParser();
-
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- ImportInfo aImportInfo( RTFIMP_END, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
-
- if ( nLastAction == ACTION_INSERTPARABRK )
- {
- ContentNode* pCurNode = aCurSel.Max().GetNode();
- sal_uInt16 nPara = pImpEditEngine->GetEditDoc().GetPos( pCurNode );
- ContentNode* pPrevNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara-1 );
- DBG_ASSERT( pPrevNode, "Invalid RTF-Document?!" );
- EditSelection aSel;
- aSel.Min() = EditPaM( pPrevNode, pPrevNode->Len() );
- aSel.Max() = EditPaM( pCurNode, 0 );
- aCurSel.Max() = pImpEditEngine->ImpDeleteSelection( aSel );
- }
- EditPaM aEnd2PaM( aCurSel.Max() );
- //AddRTFDefaultValues( aStart2PaM, aEnd2PaM );
- sal_Bool bOnlyOnePara = ( aEnd2PaM.GetNode() == aStart2PaM.GetNode() );
- // 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() )
- pImpEditEngine->ParaAttribsToCharAttribs( aStart2PaM.GetNode() );
- aCurSel.Min() = pImpEditEngine->ImpConnectParagraphs(
- aStart1PaM.GetNode(), aStart2PaM.GetNode(), bSpecialBackward );
- bSpecialBackward = aEnd1PaM.GetNode()->Len() ? sal_True : sal_False;
- // when bOnlyOnePara, then the node is gone on Connect.
- if ( !bOnlyOnePara && aEnd1PaM.GetNode()->Len() )
- pImpEditEngine->ParaAttribsToCharAttribs( aEnd2PaM.GetNode() );
- aCurSel.Max() = pImpEditEngine->ImpConnectParagraphs(
- ( bOnlyOnePara ? aStart1PaM.GetNode() : aEnd2PaM.GetNode() ),
- aEnd1PaM.GetNode(), bSpecialBackward );
-
- return _eState;
-}
-
-void EditRTFParser::AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& rEnd )
-{
- // Problem: DefFont and DefFontHeight
- Size aSz( 12, 0 );
- MapMode aPntMode( MAP_POINT );
- MapMode _aEditMapMode( pImpEditEngine->GetRefDevice()->GetMapMode().GetMapUnit() );
- aSz = pImpEditEngine->GetRefDevice()->LogicToLogic( aSz, &aPntMode, &_aEditMapMode );
- SvxFontHeightItem aFontHeightItem( aSz.Width(), 100, EE_CHAR_FONTHEIGHT );
- Font aDefFont( GetDefFont() );
- SvxFontItem aFontItem( aDefFont.GetFamily(), aDefFont.GetName(),
- aDefFont.GetStyleName(), aDefFont.GetPitch(), aDefFont.GetCharSet(), EE_CHAR_FONTINFO );
-
- sal_uInt16 nStartPara = pImpEditEngine->GetEditDoc().GetPos( rStart.GetNode() );
- sal_uInt16 nEndPara = pImpEditEngine->GetEditDoc().GetPos( rEnd.GetNode() );
- for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ )
- {
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
- DBG_ASSERT( pNode, "AddRTFDefaultValues - No paragraph?!" );
- if ( !pNode->GetContentAttribs().HasItem( EE_CHAR_FONTINFO ) )
- pNode->GetContentAttribs().GetItems().Put( aFontItem );
- if ( !pNode->GetContentAttribs().HasItem( EE_CHAR_FONTHEIGHT ) )
- pNode->GetContentAttribs().GetItems().Put( aFontHeightItem );
- }
-}
-
-void EditRTFParser::NextToken( int nToken )
-{
- switch( nToken )
- {
- case RTF_DEFF:
- {
- nDefFont = sal_uInt16(nTokenValue);
- }
- break;
- case RTF_DEFTAB:
- {
- nDefTab = sal_uInt16(nTokenValue);
- }
- break;
- case RTF_CELL:
- {
- aCurSel = pImpEditEngine->ImpInsertParaBreak( aCurSel );
- }
- break;
- case RTF_LINE:
- {
- aCurSel = pImpEditEngine->InsertLineBreak( aCurSel );
- }
- break;
- case RTF_FIELD:
- {
- ReadField();
- }
- break;
- case RTF_PGDSCTBL: // #i29453# ignore \*\pgdsctbl destination
- case RTF_LISTTEXT:
- {
- SkipGroup();
- }
- break;
- default:
- {
- SvxRTFParser::NextToken( nToken );
- if ( nToken == RTF_STYLESHEET )
- CreateStyleSheets();
- }
- break;
- }
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- ImportInfo aImportInfo( RTFIMP_NEXTTOKEN, this, pImpEditEngine->CreateESel( aCurSel ) );
- aImportInfo.nToken = nToken;
- aImportInfo.nTokenValue = short(nTokenValue);
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
-}
-
-void EditRTFParser::UnknownAttrToken( int nToken, SfxItemSet* )
-{
- // 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 ) );
- aImportInfo.nToken = nToken;
- aImportInfo.nTokenValue = short(nTokenValue);
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
-}
-
-void EditRTFParser::InsertText()
-{
- String aText( aToken );
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- ImportInfo aImportInfo( RTFIMP_INSERTTEXT, this, pImpEditEngine->CreateESel( aCurSel ) );
- aImportInfo.aText = aText;
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
- aCurSel = pImpEditEngine->ImpInsertText( aCurSel, aText );
- nLastAction = ACTION_INSERTTEXT;
-}
-
-void EditRTFParser::InsertPara()
-{
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- ImportInfo aImportInfo( RTFIMP_INSERTPARA, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
- aCurSel = pImpEditEngine->ImpInsertParaBreak( aCurSel );
- nLastAction = ACTION_INSERTPARABRK;
-}
-
-void EditRTFParser::MovePos( int bForward )
-{
- if( bForward )
- aCurSel = pImpEditEngine->CursorRight( aCurSel.Max(), ::com::sun::star::i18n::CharacterIteratorMode::SKIPCHARACTER );
- else
- aCurSel = pImpEditEngine->CursorLeft( aCurSel.Max(), ::com::sun::star::i18n::CharacterIteratorMode::SKIPCHARACTER );
-}
-
-void EditRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos,
- sal_uInt16& rCntPos )
-{
- // 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, "Paragraph equal to 0: SetEnfPrevPara" );
- if ( nCurPara )
- nCurPara--;
- ContentNode* pPrevNode = pImpEditEngine->GetEditDoc().SaveGetObject( nCurPara );
- DBG_ASSERT( pPrevNode, "pPrevNode = 0!" );
- rpNodePos = new EditNodeIdx( pImpEditEngine, pPrevNode );
- rCntPos = pPrevNode->Len();
-}
-
-int EditRTFParser::IsEndPara( SvxNodeIdx* pNd, sal_uInt16 nCnt ) const
-{
- return ( nCnt == ( ((EditNodeIdx*)pNd)->GetNode()->Len()) );
-}
-
-void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
-{
- ContentNode* pSttNode = ((EditNodeIdx&)rSet.GetSttNode()).GetNode();
- ContentNode* pEndNode = ((EditNodeIdx&)rSet.GetEndNode()).GetNode();
-
- EditPaM aStartPaM( pSttNode, rSet.GetSttCnt() );
- EditPaM aEndPaM( pEndNode, rSet.GetEndCnt() );
-
- // If possible adjust the Escapemant-Item:
- const SfxPoolItem* pItem;
-
- // #i66167# adapt font heights to destination MapUnit if necessary
- const MapUnit eDestUnit = ( MapUnit )( pImpEditEngine->GetEditDoc().GetItemPool().GetMetric(0) );
- const MapUnit eSrcUnit = aRTFMapMode.GetMapUnit();
- if (eDestUnit != eSrcUnit)
- {
- sal_uInt16 aFntHeightIems[3] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL };
- for (int i = 0; i < 2; ++i)
- {
- if (SFX_ITEM_SET == rSet.GetAttrSet().GetItemState( aFntHeightIems[i], sal_False, &pItem ))
- {
- sal_uInt32 nHeight = ((SvxFontHeightItem*)pItem)->GetHeight();
- long nNewHeight;
- nNewHeight = pImpEditEngine->GetRefDevice()->LogicToLogic( (long)nHeight, eSrcUnit, eDestUnit );
-
- SvxFontHeightItem aFntHeightItem( nNewHeight, ((SvxFontHeightItem*)pItem)->GetProp(), aFntHeightIems[i] );
- rSet.GetAttrSet().Put( aFntHeightItem );
- }
- }
- }
-
- if( SFX_ITEM_SET == rSet.GetAttrSet().GetItemState( EE_CHAR_ESCAPEMENT, sal_False, &pItem ))
- {
- // die richtige
- long nEsc = ((SvxEscapementItem*)pItem)->GetEsc();
-
- if( ( DFLT_ESC_AUTO_SUPER != nEsc ) && ( DFLT_ESC_AUTO_SUB != nEsc ) )
- {
- nEsc *= 10; //HalPoints => Twips was embezzled in RTFITEM.CXX!
- SvxFont aFont;
- pImpEditEngine->SeekCursor( aStartPaM.GetNode(), aStartPaM.GetIndex()+1, aFont );
- nEsc = nEsc * 100 / aFont.GetSize().Height();
-
- SvxEscapementItem aEscItem( (short) nEsc, ((SvxEscapementItem*)pItem)->GetProp(), EE_CHAR_ESCAPEMENT );
- rSet.GetAttrSet().Put( aEscItem );
- }
- }
-
- if ( pImpEditEngine->aImportHdl.IsSet() )
- {
- EditSelection aSel( aStartPaM, aEndPaM );
- ImportInfo aImportInfo( RTFIMP_SETATTR, this, pImpEditEngine->CreateESel( aSel ) );
- aImportInfo.pAttrs = &rSet;
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
- }
-
- ContentNode* pSN = aStartPaM.GetNode();
- ContentNode* pEN = aEndPaM.GetNode();
- sal_uInt16 nStartNode = pImpEditEngine->GetEditDoc().GetPos( pSN );
- sal_uInt16 nEndNode = pImpEditEngine->GetEditDoc().GetPos( pEN );
- sal_Int16 nOutlLevel = 0xff;
-
- if ( rSet.StyleNo() && pImpEditEngine->GetStyleSheetPool() && pImpEditEngine->GetStatus().DoImportRTFStyleSheets() )
- {
- SvxRTFStyleType* pS = GetStyleTbl().Get( rSet.StyleNo() );
- DBG_ASSERT( pS, "Template not defined in RTF!" );
- if ( pS )
- {
- pImpEditEngine->SetStyleSheet( EditSelection( aStartPaM, aEndPaM ), (SfxStyleSheet*)pImpEditEngine->GetStyleSheetPool()->Find( pS->sName, SFX_STYLE_FAMILY_ALL ) );
- nOutlLevel = pS->nOutlineNo;
- }
- }
-
- // When an Attribute goes from 0 to the current paragraph length,
- // it should be a paragraph attribute!
-
- // 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 does not exist yet(RTF)" );
- pImpEditEngine->SetParaAttribs( z, rSet.GetAttrSet() );
- }
-
- if ( aStartPaM.GetNode() != aEndPaM.GetNode() )
- {
- // 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() );
-
- // the beginning of the EndNodes....
- if ( aEndPaM.GetIndex() == aEndPaM.GetNode()->Len() )
- pImpEditEngine->SetParaAttribs( nEndNode, rSet.GetAttrSet() );
- else
- pImpEditEngine->SetAttribs( EditSelection( EditPaM( aEndPaM.GetNode(), 0 ), aEndPaM ), rSet.GetAttrSet() );
- }
- else
- {
- if ( ( aStartPaM.GetIndex() == 0 ) && ( aEndPaM.GetIndex() == aEndPaM.GetNode()->Len() ) )
- {
- // 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 );
- }
- else
- {
- pImpEditEngine->SetAttribs( EditSelection( aStartPaM, aEndPaM ), rSet.GetAttrSet() );
- }
- }
-
- // OutlLevel...
- if ( nOutlLevel != 0xff )
- {
- for ( sal_uInt16 n = nStartNode; n <= nEndNode; n++ )
- {
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( n );
- pNode->GetContentAttribs().GetItems().Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nOutlLevel ) );
- }
- }
-}
-
-SvxRTFStyleType* EditRTFParser::FindStyleSheet( const XubString& rName )
-{
- SvxRTFStyleType* pS = GetStyleTbl().First();
- while ( pS && ( pS->sName != rName ) )
- pS = GetStyleTbl().Next();
-
- return pS;
-}
-
-SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle )
-{
- // 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;
-
- String aName( pRTFStyle->sName );
- String aParent;
- if ( pRTFStyle->nBasedOn )
- {
- SvxRTFStyleType* pS = GetStyleTbl().Get( pRTFStyle->nBasedOn );
- if ( pS && ( pS !=pRTFStyle ) )
- aParent = pS->sName;
- }
-
- pStyle = (SfxStyleSheet*) &pImpEditEngine->GetStyleSheetPool()->Make( aName, SFX_STYLE_FAMILY_PARA );
-
- // 1) convert and take over Items ...
- ConvertAndPutItems( pStyle->GetItemSet(), pRTFStyle->aAttrSet );
-
- // 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 )
- {
- // If not found anywhere, create from RTF ...
- SvxRTFStyleType* _pRTFStyle = FindStyleSheet( aParent );
- if ( _pRTFStyle )
- pS = CreateStyleSheet( _pRTFStyle );
- }
- // 2b) Link Itemset with Parent ...
- if ( pS )
- pStyle->GetItemSet().SetParent( &pS->GetItemSet() );
- }
- return pStyle;
-}
-
-void EditRTFParser::CreateStyleSheets()
-{
- // the SvxRTFParser haa now created the template...
- if ( pImpEditEngine->GetStyleSheetPool() && pImpEditEngine->GetStatus().DoImportRTFStyleSheets() )
- {
- SvxRTFStyleType* pRTFStyle = GetStyleTbl().First();
- while ( pRTFStyle )
- {
- CreateStyleSheet( pRTFStyle );
-
- pRTFStyle = GetStyleTbl().Next();
- }
- }
-}
-
-void EditRTFParser::CalcValue()
-{
- const MapUnit eDestUnit = static_cast< MapUnit >( aEditMapMode.GetMapUnit() );
- const MapUnit eSrcUnit = aRTFMapMode.GetMapUnit();
- if (eDestUnit != eSrcUnit)
- nTokenValue = OutputDevice::LogicToLogic( (long)nTokenValue, eSrcUnit, eDestUnit );
-}
-
-void EditRTFParser::ReadField()
-{
- // From SwRTFParser::ReadField()
- int _nOpenBrakets = 1; // the first was already detected earlier
- sal_Bool bFldInst = sal_False;
- sal_Bool bFldRslt = sal_False;
- String aFldInst;
- String aFldRslt;
-
- while( _nOpenBrakets && IsParserWorking() )
- {
- switch( GetNextToken() )
- {
- case '}':
- {
- _nOpenBrakets--;
- if ( _nOpenBrakets == 1 )
- {
- bFldInst = sal_False;
- bFldRslt = sal_False;
- }
- }
- break;
-
- case '{': _nOpenBrakets++;
- break;
-
- case RTF_FIELD: SkipGroup();
- break;
-
- case RTF_FLDINST: bFldInst = sal_True;
- break;
-
- case RTF_FLDRSLT: bFldRslt = sal_True;
- break;
-
- case RTF_TEXTTOKEN:
- {
- if ( bFldInst )
- aFldInst += aToken;
- else if ( bFldRslt )
- aFldRslt += aToken;
- }
- break;
- }
- }
- if ( aFldInst.Len() )
- {
- String aHyperLinkMarker( RTL_CONSTASCII_USTRINGPARAM( "HYPERLINK " ) );
- if ( aFldInst.CompareIgnoreCaseToAscii( aHyperLinkMarker, aHyperLinkMarker.Len() ) == COMPARE_EQUAL )
- {
- aFldInst.Erase( 0, aHyperLinkMarker.Len() );
- aFldInst.EraseLeadingChars();
- aFldInst.EraseTrailingChars();
- aFldInst.Erase( 0, 1 ); // "
- aFldInst.Erase( aFldInst.Len()-1, 1 ); // "
-
- if ( !aFldRslt.Len() )
- aFldRslt = aFldInst;
-
- SvxFieldItem aField( SvxURLField( aFldInst, aFldRslt, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
- aCurSel = pImpEditEngine->InsertField( aCurSel, aField );
- pImpEditEngine->UpdateFields();
- nLastAction = ACTION_INSERTTEXT;
- }
- }
-
- SkipToken( -1 ); // the closing brace is evaluated "above"
-}
-
-void EditRTFParser::SkipGroup()
-{
- int _nOpenBrakets = 1; // the first was already detected earlier
-
- while( _nOpenBrakets && IsParserWorking() )
- {
- switch( GetNextToken() )
- {
- case '}':
- {
- _nOpenBrakets--;
- }
- break;
-
- case '{':
- {
- _nOpenBrakets++;
- }
- break;
- }
- }
-
- SkipToken( -1 ); // the closing brace is evaluated "above"
-}
-
-sal_uLong EditNodeIdx::GetIdx() const
-{
- return pImpEditEngine->GetEditDoc().GetPos( pNode );
-}
-
-SvxNodeIdx* EditNodeIdx::Clone() const
-{
- return new EditNodeIdx( pImpEditEngine, pNode );
-}
-
-SvxPosition* EditPosition::Clone() const
-{
- return new EditPosition( pImpEditEngine, pCurSel );
-}
-
-SvxNodeIdx* EditPosition::MakeNodeIdx() const
-{
- return new EditNodeIdx( pImpEditEngine, pCurSel->Max().GetNode() );
-}
-
-sal_uLong EditPosition::GetNodeIdx() const
-{
- ContentNode* pN = pCurSel->Max().GetNode();
- return pImpEditEngine->GetEditDoc().GetPos( pN );
-}
-
-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
deleted file mode 100644
index a3a824d5cb..0000000000
--- a/editeng/source/editeng/eertfpar.hxx
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _EERTFPAR_HXX
-#define _EERTFPAR_HXX
-
-#include <editeng/svxrtf.hxx>
-
-#include <editdoc.hxx>
-#include <impedit.hxx>
-
-class EditNodeIdx : public SvxNodeIdx
-{
-private:
- ContentNode* pNode;
- ImpEditEngine* pImpEditEngine;
-
-public:
- EditNodeIdx( ImpEditEngine* pIEE, ContentNode* pNd = 0)
- { pImpEditEngine = pIEE; pNode = pNd; }
- virtual sal_uLong GetIdx() const;
- virtual SvxNodeIdx* Clone() const;
- ContentNode* GetNode() { return pNode; }
-};
-
-class EditPosition : public SvxPosition
-{
-private:
- EditSelection* pCurSel;
- ImpEditEngine* pImpEditEngine;
-
-public:
- EditPosition( ImpEditEngine* pIEE, EditSelection* pSel )
- { pImpEditEngine = pIEE; pCurSel = pSel; }
-
- virtual sal_uLong GetNodeIdx() const;
- virtual sal_uInt16 GetCntIdx() const;
-
- // clone
- virtual SvxPosition* Clone() const;
-
- // clone NodeIndex
- virtual SvxNodeIdx* MakeNodeIdx() const;
-};
-
-#define ACTION_INSERTTEXT 1
-#define ACTION_INSERTPARABRK 2
-
-class EditRTFParser : public SvxRTFParser
-{
-private:
- EditSelection aCurSel;
- ImpEditEngine* pImpEditEngine;
- CharSet eDestCharSet;
- MapMode aRTFMapMode;
- MapMode aEditMapMode;
-
- sal_uInt16 nDefFont;
- sal_uInt16 nDefTab;
- sal_uInt16 nDefFontHeight;
- sal_uInt8 nLastAction;
-
-protected:
- virtual void InsertPara();
- virtual void InsertText();
- virtual void MovePos( int bForward = sal_True );
- virtual void SetEndPrevPara( SvxNodeIdx*& rpNodePos,
- sal_uInt16& rCntPos );
-
- virtual void UnknownAttrToken( int nToken, SfxItemSet* pSet );
- virtual void NextToken( int nToken );
- virtual void SetAttrInDoc( SvxRTFItemStackType &rSet );
- virtual int IsEndPara( SvxNodeIdx* pNd, sal_uInt16 nCnt ) const;
- virtual void CalcValue();
- void CreateStyleSheets();
- SfxStyleSheet* CreateStyleSheet( SvxRTFStyleType* pRTFStyle );
- SvxRTFStyleType* FindStyleSheet( const String& rName );
- void AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& rEnd );
- void ReadField();
- void SkipGroup();
-
-public:
- EditRTFParser( SvStream& rIn, EditSelection aCurSel, SfxItemPool& rAttrPool, ImpEditEngine* pImpEditEngine );
- ~EditRTFParser();
-
- virtual SvParserState CallParser();
-
-
- void SetDestCharSet( CharSet eCharSet ) { eDestCharSet = eCharSet; }
- CharSet GetDestCharSet() const { return eDestCharSet; }
-
- sal_uInt16 GetDefTab() const { return nDefTab; }
- Font GetDefFont() { return GetFont( nDefFont ); }
-
- EditPaM GetCurPaM() const { return aCurSel.Max(); }
-};
-
-SV_DECL_REF( EditRTFParser )
-SV_IMPL_REF( EditRTFParser );
-
-
-#endif //_EERTFPAR_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
deleted file mode 100644
index faacef226f..0000000000
--- a/editeng/source/editeng/impedit.cxx
+++ /dev/null
@@ -1,1992 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <eeng_pch.hxx>
-
-#include <impedit.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <tools/poly.hxx>
-#include <editeng/unolingu.hxx>
-#include <com/sun/star/linguistic2/XDictionaryEntry.hpp>
-#include <com/sun/star/linguistic2/DictionaryType.hpp>
-#include <com/sun/star/linguistic2/DictionaryEvent.hpp>
-#include <com/sun/star/linguistic2/XDictionaryEventListener.hpp>
-#include <com/sun/star/linguistic2/DictionaryEventFlags.hpp>
-#include <com/sun/star/linguistic2/XDictionary.hpp>
-#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
-#include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
-#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
-#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
-#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
-#include <osl/mutex.hxx>
-#include <editeng/flditem.hxx>
-#include <svl/intitem.hxx>
-#include <svtools/transfer.hxx>
-#include <sot/exchange.hxx>
-#include <sot/formats.hxx>
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::linguistic2;
-
-#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 )
-{
- rPoint = pOutDev->LogicToPixel( rPoint );
-
- if ( nDiffX )
- rPoint.X() += nDiffX;
- if ( nDiffY )
- rPoint.Y() += nDiffY;
-
- rPoint = pOutDev->PixelToLogic( rPoint );
-}
-
- // ----------------------------------------------------------------------
-// class ImpEditView
-// ----------------------------------------------------------------------
-ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, Window* pWindow ) :
- aOutArea( Point(), pEng->GetPaperSize() )
-{
- pEditView = pView;
- pEditEngine = pEng;
- pOutWin = pWindow;
- pPointer = NULL;
- pBackgroundColor = NULL;
- nScrollDiffX = 0;
- nExtraCursorFlags = 0;
- nCursorBidiLevel = CURSOR_BIDILEVEL_DONTKNOW;
- pCursor = NULL;
- pDragAndDropInfo = NULL;
- bReadOnly = sal_False;
- bClickedInSelection = sal_False;
- eSelectionMode = EE_SELMODE_TXTONLY;
- eAnchorMode = ANCHOR_TOP_LEFT;
- nInvMore = 1;
- nTravelXPos = TRAVEL_X_DONTKNOW;
- nControl = EV_CNTRL_AUTOSCROLL | EV_CNTRL_ENABLEPASTE;
- bActiveDragAndDropListener = sal_False;
-
- aEditSelection.Min() = pEng->pImpEditEngine->GetEditDoc().GetStartPaM();
- aEditSelection.Max() = pEng->pImpEditEngine->GetEditDoc().GetEndPaM();
-}
-
-ImpEditView::~ImpEditView()
-{
- RemoveDragAndDropListeners();
-
- if ( pOutWin && ( pOutWin->GetCursor() == pCursor ) )
- pOutWin->SetCursor( NULL );
-
- delete pCursor;
- delete pBackgroundColor;
- delete pPointer;
- delete pDragAndDropInfo;
-}
-
-void ImpEditView::SetBackgroundColor( const Color& rColor )
-{
- delete pBackgroundColor;
- pBackgroundColor = new Color( rColor );
-}
-
-void ImpEditView::SetEditSelection( const EditSelection& rEditSelection )
-{
- // set state before notification
- aEditSelection = rEditSelection;
-
- if ( pEditEngine->pImpEditEngine->GetNotifyHdl().IsSet() )
- {
- EENotify aNotify( EE_NOTIFY_TEXTVIEWSELECTIONCHANGED );
- aNotify.pEditEngine = pEditEngine;
- aNotify.pEditView = GetEditViewPtr();
- pEditEngine->pImpEditEngine->CallNotify( aNotify );
- }
-}
-
-
-void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
-{
- if ( GetSelectionMode() == EE_SELMODE_HIDDEN )
- return;
-
- // 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: When not NULL, then only calculate Region.
- PolyPolygon* pPolyPoly = NULL;
- if ( pRegion )
- pPolyPoly = new PolyPolygon;
-
- sal_Bool bClipRegion = pOutWin->IsClipRegion();
- Region aOldRegion = pOutWin->GetClipRegion();
-
- if ( !pRegion )
- {
- if ( pEditEngine->pImpEditEngine->GetUpdateMode() == sal_False )
- return;
- if ( pEditEngine->pImpEditEngine->IsInUndo() )
- return;
-
- if ( !aTmpSel.HasRange() )
- return;
-
- // 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();
- pOutWin->IntersectClipRegion( aTmpOutArea );
-
- if ( pOutWin->GetCursor() )
- pOutWin->GetCursor()->Hide();
- }
-
- DBG_ASSERT( !pEditEngine->pImpEditEngine->aIdleFormatter.IsActive(), "DrawSelection: Not formatted!" );
- aTmpSel.Adjust( pEditEngine->pImpEditEngine->GetEditDoc() );
-
- ContentNode* pStartNode = aTmpSel.Min().GetNode();
- ContentNode* pEndNode = aTmpSel.Max().GetNode();
- sal_uInt16 nStartPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( pStartNode );
- sal_uInt16 nEndPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( pEndNode );
- for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ )
- {
- ParaPortion* pTmpPortion = pEditEngine->pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
- DBG_ASSERT( pTmpPortion, "Portion in Selection not found!" );
- DBG_ASSERT( !pTmpPortion->IsInvalid(), "Portion in Selection not formatted!" );
-
- if ( !pTmpPortion->IsVisible() || pTmpPortion->IsInvalid() )
- continue;
-
- long nParaStart = pEditEngine->pImpEditEngine->GetParaPortions().GetYOffset( pTmpPortion );
- if ( ( nParaStart + pTmpPortion->GetHeight() ) < GetVisDocTop() )
- continue;
- if ( nParaStart > GetVisDocBottom() )
- break;
-
- sal_uInt16 nStartLine = 0;
- sal_uInt16 nEndLine = pTmpPortion->GetLines().Count() -1;
- if ( nPara == nStartPara )
- nStartLine = pTmpPortion->GetLines().FindLine( aTmpSel.Min().GetIndex(), sal_False );
- if ( nPara == nEndPara )
- nEndLine = pTmpPortion->GetLines().FindLine( aTmpSel.Max().GetIndex(), sal_True );
-
- for ( sal_uInt16 nLine = nStartLine; nLine <= nEndLine; nLine++ )
- {
- EditLine* pLine = pTmpPortion->GetLines().GetObject( nLine );
- DBG_ASSERT( pLine, "Line not found: DrawSelection()" );
-
- sal_Bool bPartOfLine = sal_False;
- sal_uInt16 nStartIndex = pLine->GetStart();
- sal_uInt16 nEndIndex = pLine->GetEnd();
- if ( ( nPara == nStartPara ) && ( nLine == nStartLine ) && ( nStartIndex != aTmpSel.Min().GetIndex() ) )
- {
- nStartIndex = aTmpSel.Min().GetIndex();
- bPartOfLine = sal_True;
- }
- if ( ( nPara == nEndPara ) && ( nLine == nEndLine ) && ( nEndIndex != aTmpSel.Max().GetIndex() ) )
- {
- nEndIndex = aTmpSel.Max().GetIndex();
- bPartOfLine = sal_True;
- }
-
- // Can happen if at the beginning of a wrapped line.
- if ( nEndIndex < nStartIndex )
- nEndIndex = nStartIndex;
-
- Rectangle aTmpRec( pEditEngine->pImpEditEngine->GetEditCursor( pTmpPortion, nStartIndex ) );
- Point aTopLeft( aTmpRec.TopLeft() );
- Point aBottomRight( aTmpRec.BottomRight() );
-
- aTopLeft.Y() += nParaStart;
- aBottomRight.Y() += nParaStart;
-
- // Only paint if in the visible range ...
- if ( aTopLeft.Y() > GetVisDocBottom() )
- break;
-
- if ( aBottomRight.Y() < GetVisDocTop() )
- continue;
-
- // Now that we have Bidi, the first/last index doesn't have to be the 'most outside' postion
- if ( !bPartOfLine )
- {
- Range aLineXPosStartEnd = pEditEngine->pImpEditEngine->GetLineXPosStartEnd( pTmpPortion, pLine );
- aTopLeft.X() = aLineXPosStartEnd.Min();
- aBottomRight.X() = aLineXPosStartEnd.Max();
- ImplDrawHighlightRect( pOutWin, aTopLeft, aBottomRight, pPolyPoly );
- }
- else
- {
- sal_uInt16 nTmpStartIndex = nStartIndex;
- sal_uInt16 nWritingDirStart, nTmpEndIndex;
-
- while ( nTmpStartIndex < nEndIndex )
- {
- pEditEngine->pImpEditEngine->GetRightToLeft( nPara, nTmpStartIndex+1, &nWritingDirStart, &nTmpEndIndex );
- if ( nTmpEndIndex > nEndIndex )
- nTmpEndIndex = nEndIndex;
-
- DBG_ASSERT( nTmpEndIndex > nTmpStartIndex, "DrawSelection, Start >= End?" );
-
- long nX1 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpStartIndex, sal_True );
- long nX2 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpEndIndex );
-
- Point aPt1( Min( nX1, nX2 ), aTopLeft.Y() );
- Point aPt2( Max( nX1, nX2 ), aBottomRight.Y() );
-
- ImplDrawHighlightRect( pOutWin, aPt1, aPt2, pPolyPoly );
-
- nTmpStartIndex = nTmpEndIndex;
- }
- }
-
- }
- }
-
- if ( pRegion )
- {
- *pRegion = Region( *pPolyPoly );
- delete pPolyPoly;
- }
- else
- {
- if ( pOutWin->GetCursor() )
- pOutWin->GetCursor()->Show();
-
- if ( bClipRegion )
- pOutWin->SetClipRegion( aOldRegion );
- else
- pOutWin->SetClipRegion();
- }
-}
-
-void ImpEditView::ImplDrawHighlightRect( Window* _pOutWin, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, PolyPolygon* pPolyPoly )
-{
- if ( rDocPosTopLeft.X() != rDocPosBottomRight.X() )
- {
- sal_Bool bPixelMode = _pOutWin->GetMapMode() == MAP_PIXEL;
-
- Point aPnt1( GetWindowPos( rDocPosTopLeft ) );
- Point aPnt2( GetWindowPos( rDocPosBottomRight ) );
-
- if ( !IsVertical() )
- {
- lcl_AllignToPixel( aPnt1, _pOutWin, +1, 0 );
- lcl_AllignToPixel( aPnt2, _pOutWin, 0, ( bPixelMode ? 0 : -1 ) );
- }
- else
- {
- lcl_AllignToPixel( aPnt1, _pOutWin, 0, +1 );
- lcl_AllignToPixel( aPnt2, _pOutWin, ( bPixelMode ? 0 : +1 ), 0 );
- }
-
- Rectangle aRect( aPnt1, aPnt2 );
- if ( pPolyPoly )
- {
- Polygon aTmpPoly( 4 );
- aTmpPoly[0] = aRect.TopLeft();
- aTmpPoly[1] = aRect.TopRight();
- aTmpPoly[2] = aRect.BottomRight();
- aTmpPoly[3] = aRect.BottomLeft();
- pPolyPoly->Insert( aTmpPoly );
- }
- else
- {
- _pOutWin->Invert( aRect );
- }
- }
-}
-
-
-sal_Bool ImpEditView::IsVertical() const
-{
- return pEditEngine->pImpEditEngine->IsVertical();
-}
-
-Rectangle ImpEditView::GetVisDocArea() const
-{
- return Rectangle( GetVisDocLeft(), GetVisDocTop(), GetVisDocRight(), GetVisDocBottom() );
-}
-
-Point ImpEditView::GetDocPos( const Point& rWindowPos ) const
-{
- // Window Position => Position Document
- Point aPoint;
-
- if ( !pEditEngine->pImpEditEngine->IsVertical() )
- {
- aPoint.X() = rWindowPos.X() - aOutArea.Left() + GetVisDocLeft();
- aPoint.Y() = rWindowPos.Y() - aOutArea.Top() + GetVisDocTop();
- }
- else
- {
- aPoint.X() = rWindowPos.Y() - aOutArea.Top() + GetVisDocLeft();
- aPoint.Y() = aOutArea.Right() - rWindowPos.X() + GetVisDocTop();
- }
-
- return aPoint;
-}
-
-Point ImpEditView::GetWindowPos( const Point& rDocPos ) const
-{
- // Document position => window position
- Point aPoint;
-
- if ( !pEditEngine->pImpEditEngine->IsVertical() )
- {
- aPoint.X() = rDocPos.X() + aOutArea.Left() - GetVisDocLeft();
- aPoint.Y() = rDocPos.Y() + aOutArea.Top() - GetVisDocTop();
- }
- else
- {
- aPoint.X() = aOutArea.Right() - rDocPos.Y() + GetVisDocTop();
- aPoint.Y() = rDocPos.X() + aOutArea.Top() - GetVisDocLeft();
- }
-
- return aPoint;
-}
-
-Rectangle ImpEditView::GetWindowPos( const Rectangle& rDocRect ) const
-{
- // Document position => window position
- Point aPos( GetWindowPos( rDocRect.TopLeft() ) );
- Size aSz = rDocRect.GetSize();
- Rectangle aRect;
- if ( !pEditEngine->pImpEditEngine->IsVertical() )
- {
- aRect = Rectangle( aPos, aSz );
- }
- else
- {
- Point aNewPos( aPos.X()-aSz.Height(), aPos.Y() );
- aRect = Rectangle( aNewPos, Size( aSz.Height(), aSz.Width() ) );
- }
- return aRect;
-}
-
-
-Region* ImpEditView::CalcSelectedRegion()
-{
- Region* pRegion = new Region;
- DrawSelection( GetEditSelection(), pRegion );
- return pRegion;
-}
-
-void ImpEditView::SetSelectionMode( EESelectionMode eNewMode )
-{
- if ( eSelectionMode != eNewMode )
- {
- DrawSelection();
- eSelectionMode = eNewMode;
- DrawSelection(); // redraw
- }
-}
-
-void ImpEditView::SetOutputArea( const Rectangle& rRec )
-{
- // should be better be aligned on pixels!
- Rectangle aNewRec( pOutWin->LogicToPixel( rRec ) );
- aNewRec = pOutWin->PixelToLogic( aNewRec );
- aOutArea = aNewRec;
- if ( aOutArea.Right() < aOutArea.Left() )
- aOutArea.Right() = aOutArea.Left();
- if ( aOutArea.Bottom() < aOutArea.Top() )
- aOutArea.Bottom() = aOutArea.Top();
-
- if ( DoBigScroll() )
- SetScrollDiffX( (sal_uInt16)aOutArea.GetWidth() * 3 / 10 );
- else
- SetScrollDiffX( (sal_uInt16)aOutArea.GetWidth() * 2 / 10 );
-}
-
-void ImpEditView::ResetOutputArea( const Rectangle& rRec )
-{
- Rectangle aCurArea( aOutArea );
- SetOutputArea( rRec );
- // Invalidate surrounding areas if in update mode of the engine on sal_True
- if ( !aCurArea.IsEmpty() && pEditEngine->pImpEditEngine->GetUpdateMode() )
- {
- long nMore = 0;
- if ( DoInvalidateMore() )
- nMore = GetWindow()->PixelToLogic( Size( nInvMore, 0 ) ).Width();
- if ( aCurArea.Left() < aOutArea.Left() )
- {
- Rectangle aRect( aCurArea.TopLeft(),
- Size( aOutArea.Left()-aCurArea.Left(), aCurArea.GetHeight() ) );
- if ( nMore )
- {
- aRect.Left() -= nMore;
- aRect.Top() -= nMore;
- aRect.Bottom() += nMore;
- }
- GetWindow()->Invalidate( aRect );
- }
- if ( aCurArea.Right() > aOutArea.Right() )
- {
- long nW = aCurArea.Right() - aOutArea.Right();
- Point aPos( aCurArea.TopRight() );
- aPos.X() -= nW;
- Rectangle aRect( aPos, Size( nW, aCurArea.GetHeight() ) );
- if ( nMore )
- {
- aRect.Right() += nMore;
- aRect.Top() -= nMore;
- aRect.Bottom() += nMore;
- }
- GetWindow()->Invalidate( aRect );
- }
- if ( aCurArea.Top() < aOutArea.Top() )
- {
- Rectangle aRect( aCurArea.TopLeft(), Size( aCurArea.GetWidth(), aOutArea.Top() - aCurArea.Top() ) );
- if ( nMore )
- {
- aRect.Top() -= nMore;
- aRect.Left() -= nMore;
- aRect.Right() += nMore;
- }
- GetWindow()->Invalidate( aRect );
- }
- if ( aCurArea.Bottom() > aOutArea.Bottom() )
- {
- long nH = aCurArea.Bottom() - aOutArea.Bottom();
- Point aPos( aCurArea.BottomLeft() );
- aPos.Y() -= nH;
- Rectangle aRect( aPos, Size( aCurArea.GetWidth(), nH ) );
- if ( nMore )
- {
- aRect.Bottom() += nMore;
- aRect.Left() -= nMore;
- aRect.Right() += nMore;
- }
-
- GetWindow()->Invalidate( aRect );
- }
- }
-}
-
-void ImpEditView::RecalcOutputArea()
-{
- Rectangle aOldArea( aOutArea );
- Point aNewTopLeft( aOutArea.TopLeft() );
- Size aNewSz( aOutArea.GetSize() );
-
- // X:
- if ( DoAutoWidth() )
- {
- if ( pEditEngine->pImpEditEngine->GetStatus().AutoPageWidth() )
- aNewSz.Width() = pEditEngine->pImpEditEngine->GetPaperSize().Width();
- switch ( eAnchorMode )
- {
- case ANCHOR_TOP_LEFT:
- case ANCHOR_VCENTER_LEFT:
- case ANCHOR_BOTTOM_LEFT:
- {
- aNewTopLeft.X() = aAnchorPoint.X();
- }
- break;
- case ANCHOR_TOP_HCENTER:
- case ANCHOR_VCENTER_HCENTER:
- case ANCHOR_BOTTOM_HCENTER:
- {
- aNewTopLeft.X() = aAnchorPoint.X() - aNewSz.Width() / 2;
- }
- break;
- case ANCHOR_TOP_RIGHT:
- case ANCHOR_VCENTER_RIGHT:
- case ANCHOR_BOTTOM_RIGHT:
- {
- aNewTopLeft.X() = aAnchorPoint.X() - aNewSz.Width() - 1;
- }
- break;
- }
- }
-
- // Y:
- if ( DoAutoHeight() )
- {
- if ( pEditEngine->pImpEditEngine->GetStatus().AutoPageHeight() )
- aNewSz.Height() = pEditEngine->pImpEditEngine->GetPaperSize().Height();
- switch ( eAnchorMode )
- {
- case ANCHOR_TOP_LEFT:
- case ANCHOR_TOP_HCENTER:
- case ANCHOR_TOP_RIGHT:
- {
- aNewTopLeft.Y() = aAnchorPoint.Y();
- }
- break;
- case ANCHOR_VCENTER_LEFT:
- case ANCHOR_VCENTER_HCENTER:
- case ANCHOR_VCENTER_RIGHT:
- {
- aNewTopLeft.Y() = aAnchorPoint.Y() - aNewSz.Height() / 2;
- }
- break;
- case ANCHOR_BOTTOM_LEFT:
- case ANCHOR_BOTTOM_HCENTER:
- case ANCHOR_BOTTOM_RIGHT:
- {
- aNewTopLeft.Y() = aAnchorPoint.Y() - aNewSz.Height() - 1;
- }
- break;
- }
- }
- ResetOutputArea( Rectangle( aNewTopLeft, aNewSz ) );
-}
-
-void ImpEditView::SetAnchorMode( EVAnchorMode eMode )
-{
- eAnchorMode = eMode;
- CalcAnchorPoint();
-}
-
-void ImpEditView::CalcAnchorPoint()
-{
- // GetHeight() and GetWidth() -1, because rectangle calculation not prefered.
-
- // X:
- switch ( eAnchorMode )
- {
- case ANCHOR_TOP_LEFT:
- case ANCHOR_VCENTER_LEFT:
- case ANCHOR_BOTTOM_LEFT:
- {
- aAnchorPoint.X() = aOutArea.Left();
- }
- break;
- case ANCHOR_TOP_HCENTER:
- case ANCHOR_VCENTER_HCENTER:
- case ANCHOR_BOTTOM_HCENTER:
- {
- aAnchorPoint.X() = aOutArea.Left() + (aOutArea.GetWidth()-1) / 2;
- }
- break;
- case ANCHOR_TOP_RIGHT:
- case ANCHOR_VCENTER_RIGHT:
- case ANCHOR_BOTTOM_RIGHT:
- {
- aAnchorPoint.X() = aOutArea.Right();
- }
- break;
- }
-
- // Y:
- switch ( eAnchorMode )
- {
- case ANCHOR_TOP_LEFT:
- case ANCHOR_TOP_HCENTER:
- case ANCHOR_TOP_RIGHT:
- {
- aAnchorPoint.Y() = aOutArea.Top();
- }
- break;
- case ANCHOR_VCENTER_LEFT:
- case ANCHOR_VCENTER_HCENTER:
- case ANCHOR_VCENTER_RIGHT:
- {
- aAnchorPoint.Y() = aOutArea.Top() + (aOutArea.GetHeight()-1) / 2;
- }
- break;
- case ANCHOR_BOTTOM_LEFT:
- case ANCHOR_BOTTOM_HCENTER:
- case ANCHOR_BOTTOM_RIGHT:
- {
- aAnchorPoint.Y() = aOutArea.Bottom() - 1;
- }
- break;
- }
-}
-
-void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sal_uInt16 nShowCursorFlags )
-{
- // No ShowCursor in an empty View ...
- if ( ( aOutArea.Left() >= aOutArea.Right() ) && ( aOutArea.Top() >= aOutArea.Bottom() ) )
- return;
-
- pEditEngine->pImpEditEngine->CheckIdleFormatter();
- if ( !pEditEngine->pImpEditEngine->IsFormatted() )
- pEditEngine->pImpEditEngine->FormatDoc();
-
- // 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 )
- return;
- if ( pEditEngine->pImpEditEngine->IsInUndo() )
- return;
-
- if ( pOutWin->GetCursor() != GetCursor() )
- pOutWin->SetCursor( GetCursor() );
-
- EditPaM aPaM( aEditSelection.Max() );
-
- sal_uInt16 nTextPortionStart = 0;
- sal_uInt16 nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
- if (nPara == USHRT_MAX) // #i94322
- return;
- ParaPortion* pParaPortion = pEditEngine->pImpEditEngine->GetParaPortions().GetObject( nPara );
-
- nShowCursorFlags |= nExtraCursorFlags;
-
- nShowCursorFlags |= GETCRSR_TXTONLY;
-
- // Use CursorBidiLevel 0/1 in meaning of
- // 0: prefer portion end, normal mode
- // 1: prefer portion start
-
- if ( ( GetCursorBidiLevel() != CURSOR_BIDILEVEL_DONTKNOW ) && GetCursorBidiLevel() )
- {
- nShowCursorFlags |= GETCRSR_PREFERPORTIONSTART;
- }
-
- Rectangle aEditCursor = pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, nShowCursorFlags );
- if ( !IsInsertMode() && !aEditSelection.HasRange() )
- {
- if ( aPaM.GetNode()->Len() && ( aPaM.GetIndex() < aPaM.GetNode()->Len() ) )
- {
- // If we are behind a portion, and the next portion has other direction, we must change position...
- aEditCursor.Left() = aEditCursor.Right() = pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GETCRSR_TXTONLY|GETCRSR_PREFERPORTIONSTART ).Left();
-
- sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, sal_True );
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
- if ( pTextPortion->GetKind() == PORTIONKIND_TAB )
- {
- aEditCursor.Right() += pTextPortion->GetSize().Width();
- }
- else
- {
- EditPaM aNext = pEditEngine->pImpEditEngine->CursorRight( aPaM, (sal_uInt16)i18n::CharacterIteratorMode::SKIPCELL );
- Rectangle aTmpRect = pEditEngine->pImpEditEngine->PaMtoEditCursor( aNext, GETCRSR_TXTONLY );
- if ( aTmpRect.Top() != aEditCursor.Top() )
- aTmpRect = pEditEngine->pImpEditEngine->PaMtoEditCursor( aNext, GETCRSR_TXTONLY|GETCRSR_ENDOFLINE );
- aEditCursor.Right() = aTmpRect.Left();
- }
- }
- }
- long nMaxHeight = !IsVertical() ? aOutArea.GetHeight() : aOutArea.GetWidth();
- if ( aEditCursor.GetHeight() > nMaxHeight )
- {
- aEditCursor.Bottom() = aEditCursor.Top() + nMaxHeight - 1;
- }
- if ( bGotoCursor ) // && (!pEditEngine->pImpEditEngine->GetStatus().AutoPageSize() ) )
- {
- // check if scrolling is necessary...
- // if scrolling, then update () and Scroll ()!
- long nDocDiffX = 0;
- long nDocDiffY = 0;
-
- Rectangle aTmpVisArea( GetVisDocArea() );
- // 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() )
- { // Scroll up, here positive
- nDocDiffY = aEditCursor.Bottom() - aTmpVisArea.Bottom();
- }
- else if ( aEditCursor.Top() < aTmpVisArea.Top() )
- { // Scroll down, here negative
- nDocDiffY = aEditCursor.Top() - aTmpVisArea.Top();
- }
-
- if ( aEditCursor.Right() > aTmpVisArea.Right() )
- {
- // Scroll left, positiv
- nDocDiffX = aEditCursor.Right() - aTmpVisArea.Right();
- // Can it be a little more?
- if ( aEditCursor.Right() < ( nMaxTextWidth - GetScrollDiffX() ) )
- nDocDiffX += GetScrollDiffX();
- else
- {
- long n = nMaxTextWidth - aEditCursor.Right();
- // If MapMode != RefMapMode then the EditCursor can go beyond
- // the paper width!
- nDocDiffX += ( n > 0 ? n : -n );
- }
- }
- else if ( aEditCursor.Left() < aTmpVisArea.Left() )
- {
- // Scroll right, negative:
- nDocDiffX = aEditCursor.Left() - aTmpVisArea.Left();
- // Can it be a little more?
- if ( aEditCursor.Left() > ( - (long)GetScrollDiffX() ) )
- nDocDiffX -= GetScrollDiffX();
- else
- nDocDiffX -= aEditCursor.Left();
- }
- if ( aPaM.GetIndex() == 0 ) // Olli needed for the Outliner
- {
- // But make sure that the cursor is not leaving visible area
- // because of this!
- if ( aEditCursor.Left() < aTmpVisArea.GetWidth() )
- {
- nDocDiffX = -aTmpVisArea.Left();
- }
- }
-
- if ( nDocDiffX | nDocDiffY )
- {
- long nDiffX = !IsVertical() ? nDocDiffX : -nDocDiffY;
- long nDiffY = !IsVertical() ? nDocDiffY : nDocDiffX;
-
- // Negative: Back to the top or left edge
- if ( ( Abs( nDiffY ) > pEditEngine->pImpEditEngine->nOnePixelInRef ) && DoBigScroll() )
- {
- long nH = aOutArea.GetHeight() / 4;
- if ( ( nH > aEditCursor.GetHeight() ) && ( Abs( nDiffY ) < nH ) )
- {
- if ( nDiffY < 0 )
- nDiffY -= nH;
- else
- nDiffY += nH;
- }
- }
-
- if ( ( Abs( nDiffX ) > pEditEngine->pImpEditEngine->nOnePixelInRef ) && DoBigScroll() )
- {
- long nW = aOutArea.GetWidth() / 4;
- if ( Abs( nDiffX ) < nW )
- {
- if ( nDiffY < 0 )
- nDiffY -= nW;
- else
- nDiffY += nW;
- }
- }
-
- if ( nDiffX )
- pEditEngine->pImpEditEngine->aStatus.GetStatusWord() = pEditEngine->pImpEditEngine->aStatus.GetStatusWord() | EE_STAT_HSCROLL;
- if ( nDiffY )
- pEditEngine->pImpEditEngine->aStatus.GetStatusWord() = pEditEngine->pImpEditEngine->aStatus.GetStatusWord() | EE_STAT_VSCROLL;
- Scroll( -nDiffX, -nDiffY );
- pEditEngine->pImpEditEngine->DelayedCallStatusHdl();
- }
- }
-
- // Cursor may trim a little ...
- if ( ( aEditCursor.Bottom() > GetVisDocTop() ) &&
- ( aEditCursor.Top() < GetVisDocBottom() ) )
- {
- if ( aEditCursor.Bottom() > GetVisDocBottom() )
- aEditCursor.Bottom() = GetVisDocBottom();
- if ( aEditCursor.Top() < GetVisDocTop() )
- aEditCursor.Top() = GetVisDocTop();
- }
-
- long nOnePixel = pOutWin->PixelToLogic( Size( 1, 0 ) ).Width();
-
- if ( /* pEditEngine->pImpEditEngine->GetStatus().AutoPageSize() || */
- ( ( aEditCursor.Top() + nOnePixel >= GetVisDocTop() ) &&
- ( aEditCursor.Bottom() - nOnePixel <= GetVisDocBottom() ) &&
- ( aEditCursor.Left() + nOnePixel >= GetVisDocLeft() ) &&
- ( aEditCursor.Right() - nOnePixel <= GetVisDocRight() ) ) )
- {
- Rectangle aCursorRect = GetWindowPos( aEditCursor );
- GetCursor()->SetPos( aCursorRect.TopLeft() );
- Size aCursorSz( aCursorRect.GetSize() );
- // Rectangle is inclusive
- aCursorSz.Width()--;
- aCursorSz.Height()--;
- if ( !aCursorSz.Width() || !aCursorSz.Height() )
- {
- long nCursorSz = pOutWin->GetSettings().GetStyleSettings().GetCursorSize();
- nCursorSz = pOutWin->PixelToLogic( Size( nCursorSz, 0 ) ).Width();
- if ( !aCursorSz.Width() )
- aCursorSz.Width() = nCursorSz;
- if ( !aCursorSz.Height() )
- aCursorSz.Height() = nCursorSz;
- }
- // #111036# Let VCL do orientation for cursor, otherwise problem when cursor has direction flag
- if ( IsVertical() )
- {
- Size aOldSz( aCursorSz );
- aCursorSz.Width() = aOldSz.Height();
- aCursorSz.Height() = aOldSz.Width();
- GetCursor()->SetPos( aCursorRect.TopRight() );
- GetCursor()->SetOrientation( 2700 );
- }
- else
- // #i32593# Reset correct orientation in horizontal layout
- GetCursor()->SetOrientation( 0 );
-
- GetCursor()->SetSize( aCursorSz );
-
- unsigned char nCursorDir = CURSOR_DIRECTION_NONE;
- if ( IsInsertMode() && !aEditSelection.HasRange() && ( pEditEngine->pImpEditEngine->HasDifferentRTLLevels( aPaM.GetNode() ) ) )
- {
- sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, nShowCursorFlags & GETCRSR_PREFERPORTIONSTART ? sal_True : sal_False );
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
- sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft();
- if ( nRTLLevel%2 )
- nCursorDir = CURSOR_DIRECTION_RTL;
- else
- nCursorDir = CURSOR_DIRECTION_LTR;
-
- }
- GetCursor()->SetDirection( nCursorDir );
-
- if ( bForceVisCursor )
- GetCursor()->Show();
- {
- SvxFont aFont;
- pEditEngine->pImpEditEngine->SeekCursor( aPaM.GetNode(), aPaM.GetIndex()+1, aFont );
- sal_uLong nContextFlags = INPUTCONTEXT_TEXT|INPUTCONTEXT_EXTTEXTINPUT;
- GetWindow()->SetInputContext( InputContext( aFont, nContextFlags ) );
- }
- }
- else
- {
- pEditEngine->pImpEditEngine->GetStatus().GetStatusWord() = pEditEngine->pImpEditEngine->GetStatus().GetStatusWord() | EE_STAT_CURSOROUT;
- GetCursor()->Hide();
- GetCursor()->SetPos( Point( -1, -1 ) );
- GetCursor()->SetSize( Size( 0, 0 ) );
- }
-}
-
-Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck )
-{
- DBG_ASSERT( pEditEngine->pImpEditEngine->IsFormatted(), "Scroll: Not formatted!" );
- if ( !ndX && !ndY )
- return Range( 0, 0 );
-
-#ifdef DBG_UTIL
- Rectangle aR( aOutArea );
- aR = pOutWin->LogicToPixel( aR );
- aR = pOutWin->PixelToLogic( aR );
- DBG_ASSERTWARNING( aR == aOutArea, "OutArea before Scroll not aligned" );
-#endif
-
- Rectangle aNewVisArea( GetVisDocArea() );
- Size aPaperSz( pEditEngine->pImpEditEngine->GetPaperSize() );
-
- // Vertical:
- if ( !IsVertical() )
- {
- aNewVisArea.Top() -= ndY;
- aNewVisArea.Bottom() -= ndY;
- }
- else
- {
- aNewVisArea.Top() += ndX;
- aNewVisArea.Bottom() += ndX;
- }
- if ( ( nRangeCheck == RGCHK_PAPERSZ1 ) && ( aNewVisArea.Bottom() > (long)pEditEngine->pImpEditEngine->GetTextHeight() ) )
- {
- // 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() );
-
- // Horizontal:
- if ( !IsVertical() )
- {
- aNewVisArea.Left() -= ndX;
- aNewVisArea.Right() -= ndX;
- }
- else
- {
- aNewVisArea.Left() -= ndY;
- aNewVisArea.Right() -= ndY;
- }
- if ( ( nRangeCheck == RGCHK_PAPERSZ1 ) && ( aNewVisArea.Right() > (long)pEditEngine->pImpEditEngine->CalcTextWidth( sal_False ) ) )
- {
- 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 );
-
- // 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() );
-
- Size aDiffs( nDiffX, nDiffY );
- aDiffs = pOutWin->LogicToPixel( aDiffs );
- aDiffs = pOutWin->PixelToLogic( aDiffs );
-
- long nRealDiffX = aDiffs.Width();
- long nRealDiffY = aDiffs.Height();
-
-
- if ( nRealDiffX || nRealDiffY )
- {
- Cursor* pCrsr = GetCursor();
- sal_Bool bVisCursor = pCrsr->IsVisible();
- pCrsr->Hide();
- pOutWin->Update();
- if ( !IsVertical() )
- aVisDocStartPos.Move( -nRealDiffX, -nRealDiffY );
- else
- aVisDocStartPos.Move( -nRealDiffY, nRealDiffX );
- // Das Move um den allignten Wert ergibt nicht unbedingt ein
- // alligntes Rechteck...
- // Aligned value of the move does not necessarily result in aligned
- // rectangle ...
- aVisDocStartPos = pOutWin->LogicToPixel( aVisDocStartPos );
- aVisDocStartPos = pOutWin->PixelToLogic( aVisDocStartPos );
- Rectangle aRec( aOutArea );
- pOutWin->Scroll( nRealDiffX, nRealDiffY, aRec, sal_True );
- pOutWin->Update();
- pCrsr->SetPos( pCrsr->GetPos() + Point( nRealDiffX, nRealDiffY ) );
- if ( bVisCursor )
- {
- Rectangle aCursorRec( pCrsr->GetPos(), pCrsr->GetSize() );
- if ( aOutArea.IsInside( aCursorRec ) )
- pCrsr->Show();
- }
-
- if ( pEditEngine->pImpEditEngine->GetNotifyHdl().IsSet() )
- {
- EENotify aNotify( EE_NOTIFY_TEXTVIEWSCROLLED );
- aNotify.pEditEngine = pEditEngine;
- aNotify.pEditView = GetEditViewPtr();
- pEditEngine->pImpEditEngine->CallNotify( aNotify );
- }
- }
-
- return Pair( nRealDiffX, nRealDiffY );
-}
-
-sal_Bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin )
-{
- sal_Bool bDone = sal_False;
-
- KeyFuncType eFunc = rKeyEvent.GetKeyCode().GetFunction();
- if ( eFunc != KEYFUNC_DONTKNOW )
- {
- switch ( eFunc )
- {
- case KEYFUNC_CUT:
- {
- if ( !bReadOnly )
- {
- Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipBoard(GetWindow()->GetClipboard());
- CutCopy( aClipBoard, sal_True );
- bDone = sal_True;
- }
- }
- break;
- case KEYFUNC_COPY:
- {
- Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipBoard(GetWindow()->GetClipboard());
- CutCopy( aClipBoard, sal_False );
- bDone = sal_True;
- }
- break;
- case KEYFUNC_PASTE:
- {
- if ( !bReadOnly && IsPasteEnabled() )
- {
- pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_PASTE );
- Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipBoard(GetWindow()->GetClipboard());
- Paste( aClipBoard, pEditEngine->pImpEditEngine->GetStatus().AllowPasteSpecial() );
- pEditEngine->pImpEditEngine->UndoActionEnd( EDITUNDO_PASTE );
- bDone = sal_True;
- }
- }
- break;
- default:
- break;
- }
- }
-
- if( !bDone )
- bDone = pEditEngine->PostKeyEvent( rKeyEvent, GetEditViewPtr(), pFrameWin );
-
- return bDone;
-}
-
-sal_Bool ImpEditView::MouseButtonUp( const MouseEvent& rMouseEvent )
-{
- if ( pEditEngine->pImpEditEngine->aStatus.NotifyCursorMovements() )
- {
- if ( pEditEngine->pImpEditEngine->aStatus.GetPrevParagraph() != pEditEngine->pImpEditEngine->GetEditDoc().GetPos( GetEditSelection().Max().GetNode() ) )
- {
- pEditEngine->pImpEditEngine->aStatus.GetStatusWord() = pEditEngine->pImpEditEngine->aStatus.GetStatusWord() | EE_STAT_CRSRLEFTPARA;
- pEditEngine->pImpEditEngine->CallStatusHdl();
- }
- }
- nTravelXPos = TRAVEL_X_DONTKNOW;
- nCursorBidiLevel = CURSOR_BIDILEVEL_DONTKNOW;
- nExtraCursorFlags = 0;
- bClickedInSelection = sal_False;
-
- if ( rMouseEvent.IsMiddle() && !bReadOnly &&
- ( GetWindow()->GetSettings().GetMouseSettings().GetMiddleButtonAction() == MOUSE_MIDDLE_PASTESELECTION ) )
- {
- Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipBoard(GetWindow()->GetPrimarySelection());
- Paste( aClipBoard );
- }
- else if ( rMouseEvent.IsLeft() && GetEditSelection().HasRange() )
- {
- Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipBoard(GetWindow()->GetPrimarySelection());
- CutCopy( aClipBoard, sal_False );
- }
-
- return pEditEngine->pImpEditEngine->MouseButtonUp( rMouseEvent, GetEditViewPtr() );
-}
-
-sal_Bool ImpEditView::MouseButtonDown( const MouseEvent& rMouseEvent )
-{
- 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;
- nExtraCursorFlags = 0;
- nCursorBidiLevel = CURSOR_BIDILEVEL_DONTKNOW;
- bClickedInSelection = IsSelectionAtPoint( rMouseEvent.GetPosPixel() );
- return pEditEngine->pImpEditEngine->MouseButtonDown( rMouseEvent, GetEditViewPtr() );
-}
-
-sal_Bool ImpEditView::MouseMove( const MouseEvent& rMouseEvent )
-{
- return pEditEngine->pImpEditEngine->MouseMove( rMouseEvent, GetEditViewPtr() );
-}
-
-void ImpEditView::Command( const CommandEvent& rCEvt )
-{
- pEditEngine->pImpEditEngine->CheckIdleFormatter(); // If fast typing and mouse button down
- pEditEngine->pImpEditEngine->Command( rCEvt, GetEditViewPtr() );
-}
-
-
-void ImpEditView::SetInsertMode( sal_Bool bInsert )
-{
- if ( bInsert != IsInsertMode() )
- {
- SetFlags( nControl, EV_CNTRL_OVERWRITE, !bInsert );
- ShowCursor( DoAutoScroll(), sal_False );
- }
-}
-
-sal_Bool ImpEditView::IsWrongSpelledWord( const EditPaM& rPaM, sal_Bool bMarkIfWrong )
-{
- sal_Bool bIsWrong = sal_False;
- 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();
- SetEditSelection( aSel );
- DrawSelection();
- }
- }
- return bIsWrong;
-}
-
-String ImpEditView::SpellIgnoreOrAddWord( sal_Bool bAdd )
-{
- String aWord;
- if ( pEditEngine->pImpEditEngine->GetSpeller().is() )
- {
- EditPaM aPaM = GetEditSelection().Max();
- if ( !HasSelection() )
- {
- EditSelection aSel = pEditEngine->pImpEditEngine->SelectWord( aPaM );
- aWord = pEditEngine->pImpEditEngine->GetSelected( aSel );
- }
- else
- {
- aWord = pEditEngine->pImpEditEngine->GetSelected( GetEditSelection() );
- // And deselect
- DrawSelection();
- SetEditSelection( EditSelection( aPaM, aPaM ) );
- DrawSelection();
- }
-
- if ( aWord.Len() )
- {
- if ( bAdd )
- {
- OSL_FAIL( "Sorry, AddWord not implemented" );
- }
- else // Ignore
- {
- Reference< XDictionary > xDic( SvxGetIgnoreAllList(), UNO_QUERY );
- if (xDic.is())
- xDic->add( aWord, sal_False, String() );
- }
- const EditDoc& rDoc = pEditEngine->pImpEditEngine->GetEditDoc();
- sal_uInt16 nNodes = rDoc.Count();
- for ( sal_uInt16 n = 0; n < nNodes; n++ )
- {
- ContentNode* pNode = rDoc.GetObject( n );
- pNode->GetWrongList()->MarkWrongsInvalid();
- }
- pEditEngine->pImpEditEngine->DoOnlineSpelling( aPaM.GetNode() );
- pEditEngine->pImpEditEngine->StartOnlineSpellTimer();
- }
- }
- return aWord;
-}
-
-void ImpEditView::DeleteSelected()
-{
- DrawSelection();
-
- pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_DELETE );
-
- EditPaM aPaM = pEditEngine->pImpEditEngine->DeleteSelected( GetEditSelection() );
-
- pEditEngine->pImpEditEngine->UndoActionEnd( EDITUNDO_DELETE );
-
- SetEditSelection( EditSelection( aPaM, aPaM ) );
- pEditEngine->pImpEditEngine->FormatAndUpdate( GetEditViewPtr() );
- ShowCursor( DoAutoScroll(), sal_True );
-}
-
-const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_uInt16* pPara, sal_uInt16* pPos ) const
-{
- if( !GetOutputArea().IsInside( rPos ) )
- return 0;
-
- Point aDocPos( GetDocPos( rPos ) );
- EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos, sal_False );
-
- if ( aPaM.GetIndex() == aPaM.GetNode()->Len() )
- {
- // Otherwise, whenever the Field at the very end and mouse under the text
- return 0;
- }
-
- const CharAttribArray& rAttrs = aPaM.GetNode()->GetCharAttribs().GetAttribs();
- sal_uInt16 nXPos = aPaM.GetIndex();
- for ( sal_uInt16 nAttr = rAttrs.Count(); nAttr; )
- {
- EditCharAttrib* pAttr = rAttrs[--nAttr];
- if ( pAttr->GetStart() == nXPos )
- if ( pAttr->Which() == EE_FEATURE_FIELD )
- {
- DBG_ASSERT( pAttr->GetItem()->ISA( SvxFieldItem ), "No FieldItem..." );
- if ( pPara )
- *pPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
- if ( pPos )
- *pPos = pAttr->GetStart();
- return (const SvxFieldItem*)pAttr->GetItem();
- }
- }
- return NULL;
-}
-
-sal_Bool ImpEditView::IsBulletArea( const Point& rPos, sal_uInt16* pPara )
-{
- if ( pPara )
- *pPara = 0xFFFF;
-
- if( !GetOutputArea().IsInside( rPos ) )
- return sal_False;
-
- Point aDocPos( GetDocPos( rPos ) );
- EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos, sal_False );
-
- if ( aPaM.GetIndex() == 0 )
- {
- sal_uInt16 nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
- Rectangle aBulletArea = pEditEngine->GetBulletArea( nPara );
- long nY = pEditEngine->GetDocPosTopLeft( nPara ).Y();
- ParaPortion* pParaPortion = pEditEngine->pImpEditEngine->GetParaPortions().GetObject( nPara );
- nY += pParaPortion->GetFirstLineOffset();
- if ( ( aDocPos.Y() > ( nY + aBulletArea.Top() ) ) &&
- ( aDocPos.Y() < ( nY + aBulletArea.Bottom() ) ) &&
- ( aDocPos.X() > ( aBulletArea.Left() ) ) &&
- ( aDocPos.X() < ( aBulletArea.Right() ) ) )
- {
- if ( pPara )
- *pPara = nPara;
- return sal_True;
- }
- }
-
- return sal_False;
-}
-
-void ImpEditView::CutCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard, sal_Bool bCut )
-{
- if ( rxClipboard.is() && GetEditSelection().HasRange() )
- {
- uno::Reference< datatransfer::XTransferable > xData = pEditEngine->pImpEditEngine->CreateTransferable( GetEditSelection() );
-
- const sal_uInt32 nRef = Application::ReleaseSolarMutex();
-
- try
- {
- rxClipboard->setContents( xData, NULL );
-
- // #87756# FlushClipboard, but it would be better to become a TerminateListener to the Desktop and flush on demand...
- uno::Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( rxClipboard, uno::UNO_QUERY );
- if( xFlushableClipboard.is() )
- xFlushableClipboard->flushClipboard();
- }
- catch( const ::com::sun::star::uno::Exception& )
- {
- }
-
- Application::AcquireSolarMutex( nRef );
-
- if ( bCut )
- {
- pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_CUT );
- DeleteSelected();
- pEditEngine->pImpEditEngine->UndoActionEnd( EDITUNDO_CUT );
-
- }
- }
-}
-
-void ImpEditView::Paste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard, sal_Bool bUseSpecial )
-{
- if ( rxClipboard.is() )
- {
- uno::Reference< datatransfer::XTransferable > xDataObj;
-
- const sal_uInt32 nRef = Application::ReleaseSolarMutex();
-
- try
- {
- xDataObj = rxClipboard->getContents();
- }
- catch( const ::com::sun::star::uno::Exception& )
- {
- }
-
- Application::AcquireSolarMutex( nRef );
-
- if ( xDataObj.is() && EditEngine::HasValidData( xDataObj ) )
- {
- pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_PASTE );
-
- EditSelection aSel( GetEditSelection() );
- if ( aSel.HasRange() )
- {
- DrawSelection();
- aSel = pEditEngine->pImpEditEngine->ImpDeleteSelection( aSel );
- }
-
- PasteOrDropInfos aPasteOrDropInfos;
- aPasteOrDropInfos.nAction = EE_ACTION_PASTE;
- aPasteOrDropInfos.nStartPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() );
- pEditEngine->pImpEditEngine->aBeginPasteOrDropHdl.Call( &aPasteOrDropInfos );
-
- if ( DoSingleLinePaste() )
- {
- datatransfer::DataFlavor aFlavor;
- SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor );
- if ( xDataObj->isDataFlavorSupported( aFlavor ) )
- {
- try
- {
- uno::Any aData = xDataObj->getTransferData( aFlavor );
- ::rtl::OUString aTmpText;
- aData >>= aTmpText;
- String aText( aTmpText );
- aText.ConvertLineEnd( LINEEND_LF );
- aText.SearchAndReplaceAll( LINE_SEP, ' ' );
- aSel = pEditEngine->pImpEditEngine->ImpInsertText( aSel, aText );
- }
- catch( ... )
- {
- ; // #i9286# can happen, even if isDataFlavorSupported returns true...
- }
- }
- }
- else
- {
- aSel = pEditEngine->pImpEditEngine->InsertText( xDataObj, String(), aSel.Min(), bUseSpecial && pEditEngine->pImpEditEngine->GetStatus().AllowPasteSpecial() );
- }
-
- aPasteOrDropInfos.nEndPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() );
- pEditEngine->pImpEditEngine->aEndPasteOrDropHdl.Call( &aPasteOrDropInfos );
-
- pEditEngine->pImpEditEngine->UndoActionEnd( EDITUNDO_PASTE );
- SetEditSelection( aSel );
- pEditEngine->pImpEditEngine->UpdateSelections();
- pEditEngine->pImpEditEngine->FormatAndUpdate( GetEditViewPtr() );
- ShowCursor( DoAutoScroll(), sal_True );
- }
- }
-}
-
-
-sal_Bool ImpEditView::IsInSelection( const EditPaM& rPaM )
-{
- EditSelection aSel = GetEditSelection();
- if ( !aSel.HasRange() )
- return sal_False;
-
- aSel.Adjust( pEditEngine->pImpEditEngine->GetEditDoc() );
-
- sal_uInt16 nStartNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() );
- sal_uInt16 nEndNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() );
- sal_uInt16 nCurNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( rPaM.GetNode() );
-
- if ( ( nCurNode > nStartNode ) && ( nCurNode < nEndNode ) )
- return sal_True;
-
- if ( nStartNode == nEndNode )
- {
- if ( nCurNode == nStartNode )
- if ( ( rPaM.GetIndex() >= aSel.Min().GetIndex() ) && ( rPaM.GetIndex() < aSel.Max().GetIndex() ) )
- return sal_True;
- }
- else if ( ( nCurNode == nStartNode ) && ( rPaM.GetIndex() >= aSel.Min().GetIndex() ) )
- return sal_True;
- else if ( ( nCurNode == nEndNode ) && ( rPaM.GetIndex() < aSel.Max().GetIndex() ) )
- return sal_True;
-
- return sal_False;
-}
-
-void ImpEditView::CreateAnchor()
-{
- pEditEngine->pImpEditEngine->bInSelection = sal_True;
- GetEditSelection().Min() = GetEditSelection().Max();
-}
-
-void ImpEditView::DeselectAll()
-{
- pEditEngine->pImpEditEngine->bInSelection = sal_False;
- DrawSelection();
- GetEditSelection().Min() = GetEditSelection().Max();
-}
-
-sal_Bool ImpEditView::IsSelectionAtPoint( const Point& rPosPixel )
-{
- if ( pDragAndDropInfo && pDragAndDropInfo->pField )
- return sal_True;
-
- Point aMousePos( rPosPixel );
-
- // Logical units ...
- aMousePos = GetWindow()->PixelToLogic( aMousePos );
-
- if ( ( !GetOutputArea().IsInside( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() )
- {
- return sal_False;
- }
-
- Point aDocPos( GetDocPos( aMousePos ) );
- EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos, sal_False );
- return IsInSelection( aPaM );
-}
-
-sal_Bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel )
-{
- pEditEngine->pImpEditEngine->CheckIdleFormatter();
-
- Point aMousePos( rPointPixel );
-
- // Logical units ...
- aMousePos = GetWindow()->PixelToLogic( aMousePos );
-
- if ( ( !GetOutputArea().IsInside( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() )
- {
- return sal_False;
- }
-
- Point aDocPos( GetDocPos( aMousePos ) );
-
- // 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 between old and new, not the new selection
- EditSelection aTmpNewSel( GetEditSelection().Max(), aPaM );
-
- // #i27299#
- // work on copy of current selection and set new selection, if it has changed.
- EditSelection aNewEditSelection( GetEditSelection() );
-
- aNewEditSelection.Max() = aPaM;
- if ( !pEditEngine->pImpEditEngine->aSelEngine.HasAnchor() )
- {
- if ( aNewEditSelection.Min() != aPaM )
- pEditEngine->pImpEditEngine->CursorMoved( aNewEditSelection.Min().GetNode() );
- aNewEditSelection.Min() = aPaM;
- }
- else
- {
- DrawSelection( aTmpNewSel );
- }
-
- // set changed text selection
- if ( GetEditSelection() != aNewEditSelection )
- {
- SetEditSelection( aNewEditSelection );
- }
-
- sal_Bool bForceCursor = ( pDragAndDropInfo ? sal_False : sal_True ) && !pEditEngine->pImpEditEngine->IsInSelectionMode();
- ShowCursor( bGotoCursor, bForceCursor );
- return sal_True;
-}
-
-
-void ImpEditView::HideDDCursor()
-{
- if ( pDragAndDropInfo && pDragAndDropInfo->bVisCursor )
- {
- GetWindow()->DrawOutDev( pDragAndDropInfo->aCurSavedCursor.TopLeft(), pDragAndDropInfo->aCurSavedCursor.GetSize(),
- Point(0,0), pDragAndDropInfo->aCurSavedCursor.GetSize(),*pDragAndDropInfo->pBackground );
- pDragAndDropInfo->bVisCursor = sal_False;
- }
-}
-
-void ImpEditView::ShowDDCursor( const Rectangle& rRect )
-{
- if ( pDragAndDropInfo && !pDragAndDropInfo->bVisCursor )
- {
- if ( pOutWin->GetCursor() )
- pOutWin->GetCursor()->Hide();
-
- Color aOldFillColor = GetWindow()->GetFillColor();
- GetWindow()->SetFillColor( Color(4210752) ); // GRAY BRUSH_50, OLDSV, change to DDCursor!
-
- // Save background ...
- Rectangle aSaveRec( GetWindow()->LogicToPixel( rRect ) );
- // prefer to save some more ...
- aSaveRec.Right() += 1;
- aSaveRec.Bottom() += 1;
-
- Size aNewSzPx( aSaveRec.GetSize() );
- if ( !pDragAndDropInfo->pBackground )
- {
- pDragAndDropInfo->pBackground = new VirtualDevice( *GetWindow() );
- MapMode aMapMode( GetWindow()->GetMapMode() );
- aMapMode.SetOrigin( Point( 0, 0 ) );
- pDragAndDropInfo->pBackground->SetMapMode( aMapMode );
-
- }
-
-#ifdef DBG_UTIL
- Size aCurSzPx( pDragAndDropInfo->pBackground->GetOutputSizePixel() );
- if ( ( aCurSzPx.Width() < aNewSzPx.Width() ) ||( aCurSzPx.Height() < aNewSzPx.Height() ) )
- {
- sal_Bool bDone = pDragAndDropInfo->pBackground->SetOutputSizePixel( aNewSzPx );
- DBG_ASSERT( bDone, "Virtual Device broken?" );
- }
-#endif
-
- aSaveRec = GetWindow()->PixelToLogic( aSaveRec );
-
- pDragAndDropInfo->pBackground->DrawOutDev( Point(0,0), aSaveRec.GetSize(),
- aSaveRec.TopLeft(), aSaveRec.GetSize(), *GetWindow() );
- pDragAndDropInfo->aCurSavedCursor = aSaveRec;
-
- // Draw Cursor...
- GetWindow()->DrawRect( rRect );
-
- pDragAndDropInfo->bVisCursor = sal_True;
- pDragAndDropInfo->aCurCursor = rRect;
-
- GetWindow()->SetFillColor( aOldFillColor );
- }
-}
-
-void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& rDGE ) throw (::com::sun::star::uno::RuntimeException)
-{
- DBG_ASSERT( !pDragAndDropInfo, "dragGestureRecognized - DragAndDropInfo exist!" );
-
- SolarMutexGuard aVclGuard;
-
- pDragAndDropInfo = NULL;
-
- Point aMousePosPixel( rDGE.DragOriginX, rDGE.DragOriginY );
-
- EditSelection aCopySel( GetEditSelection() );
- aCopySel.Adjust( pEditEngine->pImpEditEngine->GetEditDoc() );
-
- if ( GetEditSelection().HasRange() && bClickedInSelection )
- {
- pDragAndDropInfo = new DragAndDropInfo();
- }
- else
- {
- // Field?!
- sal_uInt16 nPara, nPos;
- Point aMousePos = GetWindow()->PixelToLogic( aMousePosPixel );
- const SvxFieldItem* pField = GetField( aMousePos, &nPara, &nPos );
- if ( pField )
- {
- pDragAndDropInfo = new DragAndDropInfo();
- pDragAndDropInfo->pField = pField;
- ContentNode* pNode = pEditEngine->pImpEditEngine->GetEditDoc().GetObject( nPara );
- aCopySel = EditSelection( EditPaM( pNode, nPos ), EditPaM( pNode, nPos+1 ) );
- GetEditSelection() = aCopySel;
- DrawSelection();
- sal_Bool bGotoCursor = DoAutoScroll();
- sal_Bool bForceCursor = ( pDragAndDropInfo ? sal_False : sal_True ) && !pEditEngine->pImpEditEngine->IsInSelectionMode();
- ShowCursor( bGotoCursor, bForceCursor );
- }
- else if ( IsBulletArea( aMousePos, &nPara ) )
- {
- pDragAndDropInfo = new DragAndDropInfo();
- pDragAndDropInfo->bOutlinerMode = sal_True;
- EditPaM aStartPaM( pEditEngine->pImpEditEngine->GetEditDoc().GetObject( nPara ), 0 );
- EditPaM aEndPaM( aStartPaM );
- const SfxInt16Item& rLevel = (const SfxInt16Item&) pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL );
- for ( sal_uInt16 n = nPara +1; n < pEditEngine->pImpEditEngine->GetEditDoc().Count(); n++ )
- {
- const SfxInt16Item& rL = (const SfxInt16Item&) pEditEngine->GetParaAttrib( n, EE_PARA_OUTLLEVEL );
- if ( rL.GetValue() > rLevel.GetValue() )
- {
- aEndPaM.SetNode( pEditEngine->pImpEditEngine->GetEditDoc().GetObject( n ) );
- }
- else
- {
- break;
- }
- }
- aEndPaM.GetIndex() = aEndPaM.GetNode()->Len();
- SetEditSelection( EditSelection( aStartPaM, aEndPaM ) );
- }
- }
-
- if ( pDragAndDropInfo )
- {
-
- pDragAndDropInfo->bStarterOfDD = sal_True;
-
- // Sensitive area to be scrolled.
- Size aSz( 5, 0 );
- aSz = GetWindow()->PixelToLogic( aSz );
- pDragAndDropInfo->nSensibleRange = (sal_uInt16) aSz.Width();
- pDragAndDropInfo->nCursorWidth = (sal_uInt16) aSz.Width() / 2;
- pDragAndDropInfo->aBeginDragSel = pEditEngine->pImpEditEngine->CreateESel( aCopySel );
-
- uno::Reference< datatransfer::XTransferable > xData = pEditEngine->pImpEditEngine->CreateTransferable( aCopySel );
-
- 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 );
- // If Drag&Move in an Engine, thenCopy&Del has to be optional!
- GetCursor()->Hide();
-
- }
-}
-
-void ImpEditView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& rDSDE ) throw (::com::sun::star::uno::RuntimeException)
-{
- SolarMutexGuard aVclGuard;
-
- DBG_ASSERT( pDragAndDropInfo, "ImpEditView::dragDropEnd: pDragAndDropInfo is NULL!" );
-
- // #123688# Shouldn't happen, but seems to happen...
- if ( pDragAndDropInfo )
- {
- if ( !bReadOnly && rDSDE.DropSuccess && !pDragAndDropInfo->bOutlinerMode && ( rDSDE.DropAction & datatransfer::dnd::DNDConstants::ACTION_MOVE ) )
- {
- if ( pDragAndDropInfo->bStarterOfDD && pDragAndDropInfo->bDroppedInMe )
- {
- // 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,
- pDragAndDropInfo->aDropSel.nEndPara, pDragAndDropInfo->aDropSel.nEndPos );
- sal_Bool bBeforeSelection = aDropPos.IsLess( pDragAndDropInfo->aBeginDragSel );
- sal_uInt16 nParaDiff = pDragAndDropInfo->aBeginDragSel.nEndPara - pDragAndDropInfo->aBeginDragSel.nStartPara;
- if ( bBeforeSelection )
- {
- // Adjust aToBeDelSel.
- DBG_ASSERT( pDragAndDropInfo->aBeginDragSel.nStartPara >= pDragAndDropInfo->aDropSel.nStartPara, "But not before? ");
- aToBeDelSel.nStartPara = aToBeDelSel.nStartPara + nParaDiff;
- aToBeDelSel.nEndPara = aToBeDelSel.nEndPara + nParaDiff;
- // To correct the character?
- if ( aToBeDelSel.nStartPara == pDragAndDropInfo->aDropSel.nEndPara )
- {
- sal_uInt16 nMoreChars;
- if ( pDragAndDropInfo->aDropSel.nStartPara == pDragAndDropInfo->aDropSel.nEndPara )
- nMoreChars = pDragAndDropInfo->aDropSel.nEndPos - pDragAndDropInfo->aDropSel.nStartPos;
- else
- nMoreChars = pDragAndDropInfo->aDropSel.nEndPos;
- aToBeDelSel.nStartPos =
- aToBeDelSel.nStartPos + nMoreChars;
- if ( aToBeDelSel.nStartPara == aToBeDelSel.nEndPara )
- aToBeDelSel.nEndPos =
- aToBeDelSel.nEndPos + nMoreChars;
- }
- }
- else
- {
- // 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;
- // To correct the character?
- if ( pDragAndDropInfo->aBeginDragSel.nEndPara == pDragAndDropInfo->aDropSel.nStartPara )
- {
- sal_uInt16 nLessChars;
- if ( pDragAndDropInfo->aBeginDragSel.nStartPara == pDragAndDropInfo->aBeginDragSel.nEndPara )
- nLessChars = pDragAndDropInfo->aBeginDragSel.nEndPos - pDragAndDropInfo->aBeginDragSel.nStartPos;
- else
- nLessChars = pDragAndDropInfo->aBeginDragSel.nEndPos;
- aNewSel.nStartPos = aNewSel.nStartPos - nLessChars;
- if ( aNewSel.nStartPara == aNewSel.nEndPara )
- aNewSel.nEndPos = aNewSel.nEndPos - nLessChars;
- }
- }
-
- DrawSelection();
- EditSelection aDelSel( pEditEngine->pImpEditEngine->CreateSel( aToBeDelSel ) );
- DBG_ASSERT( !aDelSel.DbgIsBuggy( pEditEngine->pImpEditEngine->aEditDoc ), "ToBeDel is buggy!" );
- pEditEngine->pImpEditEngine->ImpDeleteSelection( aDelSel );
- if ( !bBeforeSelection )
- {
- DBG_ASSERT( !pEditEngine->pImpEditEngine->CreateSel( aNewSel ).DbgIsBuggy(pEditEngine->pImpEditEngine->aEditDoc), "Bad" );
- SetEditSelection( pEditEngine->pImpEditEngine->CreateSel( aNewSel ) );
- }
- pEditEngine->pImpEditEngine->FormatAndUpdate( pEditEngine->pImpEditEngine->GetActiveView() );
- DrawSelection();
- }
- else
- {
- // other EditEngine ...
- if ( pEditEngine->pImpEditEngine->ImplHasText() ) // #88630# SC ist removing the content when switching the task
- DeleteSelected();
- }
- }
-
- if ( pDragAndDropInfo->bUndoAction )
- pEditEngine->pImpEditEngine->UndoActionEnd( EDITUNDO_DRAGANDDROP );
-
- HideDDCursor();
- ShowCursor( DoAutoScroll(), sal_True );
- delete pDragAndDropInfo;
- pDragAndDropInfo = NULL;
- pEditEngine->GetEndDropHdl().Call(GetEditViewPtr());
- }
-}
-
-void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException)
-{
- SolarMutexGuard aVclGuard;
-
- DBG_ASSERT( pDragAndDropInfo, "Drop - No Drag&Drop info?!" );
-
- if ( pDragAndDropInfo && pDragAndDropInfo->bDragAccepted )
- {
- pEditEngine->GetBeginDropHdl().Call(GetEditViewPtr());
- sal_Bool bChanges = sal_False;
-
- HideDDCursor();
-
- if ( pDragAndDropInfo->bStarterOfDD )
- {
- pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_DRAGANDDROP );
- pDragAndDropInfo->bUndoAction = sal_True;
- }
-
- if ( pDragAndDropInfo->bOutlinerMode )
- {
- bChanges = sal_True;
- GetEditViewPtr()->MoveParagraphs( Range( pDragAndDropInfo->aBeginDragSel.nStartPara, pDragAndDropInfo->aBeginDragSel.nEndPara ), pDragAndDropInfo->nOutlinerDropDest );
- }
- else
- {
- uno::Reference< datatransfer::XTransferable > xDataObj = rDTDE.Transferable;
- if ( xDataObj.is() )
- {
- bChanges = sal_True;
- // remove Selection ...
- DrawSelection();
- EditPaM aPaM( pDragAndDropInfo->aDropDest );
-
- PasteOrDropInfos aPasteOrDropInfos;
- aPasteOrDropInfos.nAction = EE_ACTION_DROP;
- aPasteOrDropInfos.nStartPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
- pEditEngine->pImpEditEngine->aBeginPasteOrDropHdl.Call( &aPasteOrDropInfos );
-
- EditSelection aNewSel = pEditEngine->pImpEditEngine->InsertText( xDataObj, String(), aPaM, pEditEngine->pImpEditEngine->GetStatus().AllowPasteSpecial() );
-
- aPasteOrDropInfos.nEndPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() );
- pEditEngine->pImpEditEngine->aEndPasteOrDropHdl.Call( &aPasteOrDropInfos );
-
- SetEditSelection( aNewSel );
- pEditEngine->pImpEditEngine->FormatAndUpdate( pEditEngine->pImpEditEngine->GetActiveView() );
- if ( pDragAndDropInfo->bStarterOfDD )
- {
- // 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() );
- pDragAndDropInfo->aDropSel.nEndPos = aNewSel.Max().GetIndex();
- pDragAndDropInfo->bDroppedInMe = sal_True;
- }
- }
- }
-
- if ( bChanges )
- {
- rDTDE.Context->acceptDrop( rDTDE.DropAction );
- }
-
- if ( !pDragAndDropInfo->bStarterOfDD )
- {
- delete pDragAndDropInfo;
- pDragAndDropInfo = NULL;
- }
-
- rDTDE.Context->dropComplete( bChanges );
- }
-}
-
-void ImpEditView::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& rDTDEE ) throw (::com::sun::star::uno::RuntimeException)
-{
- SolarMutexGuard aVclGuard;
-
- if ( !pDragAndDropInfo )
- pDragAndDropInfo = new DragAndDropInfo( );
-
- pDragAndDropInfo->bHasValidData = sal_False;
-
- // Check for supported format...
- // Only check for text, will also be there if bin or rtf
- datatransfer::DataFlavor aTextFlavor;
- SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aTextFlavor );
- const ::com::sun::star::datatransfer::DataFlavor* pFlavors = rDTDEE.SupportedDataFlavors.getConstArray();
- int nFlavors = rDTDEE.SupportedDataFlavors.getLength();
- for ( int n = 0; n < nFlavors; n++ )
- {
- if( TransferableDataHelper::IsEqual( pFlavors[n], aTextFlavor ) )
- {
- pDragAndDropInfo->bHasValidData = sal_True;
- break;
- }
- }
-
- dragOver( rDTDEE );
-}
-
-void ImpEditView::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& ) throw (::com::sun::star::uno::RuntimeException)
-{
- SolarMutexGuard aVclGuard;
-
- HideDDCursor();
-
- if ( pDragAndDropInfo && !pDragAndDropInfo->bStarterOfDD )
- {
- delete pDragAndDropInfo;
- pDragAndDropInfo = NULL;
- }
-}
-
-void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException)
-{
- SolarMutexGuard aVclGuard;
-
- Point aMousePos( rDTDE.LocationX, rDTDE.LocationY );
- aMousePos = GetWindow()->PixelToLogic( aMousePos );
-
- sal_Bool bAccept = sal_False;
-
- if ( GetOutputArea().IsInside( aMousePos ) && !bReadOnly )
- {
- if ( pDragAndDropInfo && pDragAndDropInfo->bHasValidData )
- {
- bAccept = sal_True;
-
- sal_Bool bAllowScroll = DoAutoScroll();
- if ( bAllowScroll )
- {
- long nScrollX = 0;
- long nScrollY = 0;
- // 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() ) )
- nScrollX = -( GetOutputArea().GetWidth() / SCRLRANGE );
-
- if ( ( (aMousePos.Y()-pDragAndDropInfo->nSensibleRange) < GetOutputArea().Top() ) && ( ( aMousePos.Y() + pDragAndDropInfo->nSensibleRange ) > GetOutputArea().Top() ) )
- nScrollY = GetOutputArea().GetHeight() / SCRLRANGE;
- else if ( ( (aMousePos.Y()+pDragAndDropInfo->nSensibleRange) > GetOutputArea().Bottom() ) && ( ( aMousePos.Y() - pDragAndDropInfo->nSensibleRange ) < GetOutputArea().Bottom() ) )
- nScrollY = -( GetOutputArea().GetHeight() / SCRLRANGE );
-
- if ( nScrollX || nScrollY )
- {
- HideDDCursor();
- Scroll( nScrollX, nScrollY, RGCHK_PAPERSZ1 );
- }
- }
-
- Point aDocPos( GetDocPos( aMousePos ) );
- EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos );
- pDragAndDropInfo->aDropDest = aPaM;
- if ( pDragAndDropInfo->bOutlinerMode )
- {
- sal_uInt16 nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
- ParaPortion* pPPortion = pEditEngine->pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
- long nDestParaStartY = pEditEngine->pImpEditEngine->GetParaPortions().GetYOffset( pPPortion );
- long nRel = aDocPos.Y() - nDestParaStartY;
- if ( nRel < ( pPPortion->GetHeight() / 2 ) )
- {
- pDragAndDropInfo->nOutlinerDropDest = nPara;
- }
- else
- {
- pDragAndDropInfo->nOutlinerDropDest = nPara+1;
- }
-
- if( ( pDragAndDropInfo->nOutlinerDropDest >= pDragAndDropInfo->aBeginDragSel.nStartPara ) &&
- ( pDragAndDropInfo->nOutlinerDropDest <= (pDragAndDropInfo->aBeginDragSel.nEndPara+1) ) )
- {
- bAccept = sal_False;
- }
- }
- else if ( HasSelection() )
- {
- // it must not be dropped into a selection
- EPaM aP = pEditEngine->pImpEditEngine->CreateEPaM( aPaM );
- ESelection aDestSel( aP.nPara, aP.nIndex, aP.nPara, aP.nIndex);
- ESelection aCurSel = pEditEngine->pImpEditEngine->CreateESel( GetEditSelection() );
- aCurSel.Adjust();
- if ( !aDestSel.IsLess( aCurSel ) && !aDestSel.IsGreater( aCurSel ) )
- {
- bAccept = sal_False;
- }
- }
- if ( bAccept )
- {
- Rectangle aEditCursor;
- if ( pDragAndDropInfo->bOutlinerMode )
- {
- long nDDYPos;
- if ( pDragAndDropInfo->nOutlinerDropDest < pEditEngine->pImpEditEngine->GetEditDoc().Count() )
- {
- ParaPortion* pPPortion = pEditEngine->pImpEditEngine->GetParaPortions().SaveGetObject( pDragAndDropInfo->nOutlinerDropDest );
- nDDYPos = pEditEngine->pImpEditEngine->GetParaPortions().GetYOffset( pPPortion );
- }
- else
- {
- nDDYPos = pEditEngine->pImpEditEngine->GetTextHeight();
- }
- Point aStartPos( 0, nDDYPos );
- aStartPos = GetWindowPos( aStartPos );
- Point aEndPos( GetOutputArea().GetWidth(), nDDYPos );
- aEndPos = GetWindowPos( aEndPos );
- aEditCursor = GetWindow()->LogicToPixel( Rectangle( aStartPos, aEndPos ) );
- if ( !pEditEngine->IsVertical() )
- {
- aEditCursor.Top()--;
- aEditCursor.Bottom()++;
- }
- else
- {
- aEditCursor.Left()--;
- aEditCursor.Right()++;
- }
- aEditCursor = GetWindow()->PixelToLogic( aEditCursor );
- }
- else
- {
- aEditCursor = pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM );
- Point aTopLeft( GetWindowPos( aEditCursor.TopLeft() ) );
- aEditCursor.SetPos( aTopLeft );
- aEditCursor.Right() = aEditCursor.Left() + pDragAndDropInfo->nCursorWidth;
- aEditCursor = GetWindow()->LogicToPixel( aEditCursor );
- aEditCursor = GetWindow()->PixelToLogic( aEditCursor );
- }
-
- sal_Bool bCursorChanged = !pDragAndDropInfo->bVisCursor || ( pDragAndDropInfo->aCurCursor != aEditCursor );
- if ( bCursorChanged )
- {
- HideDDCursor();
- ShowDDCursor(aEditCursor );
- }
- pDragAndDropInfo->bDragAccepted = sal_True;
- rDTDE.Context->acceptDrag( rDTDE.DropAction );
- }
- }
- }
-
- if ( !bAccept )
- {
- HideDDCursor();
- if (pDragAndDropInfo)
- pDragAndDropInfo->bDragAccepted = sal_False;
- rDTDE.Context->rejectDrag();
- }
-}
-
-void ImpEditView::AddDragAndDropListeners()
-{
- Window* pWindow = GetWindow();
- if ( !bActiveDragAndDropListener && pWindow && pWindow->GetDragGestureRecognizer().is() )
- {
- vcl::unohelper::DragAndDropWrapper* pDnDWrapper = new vcl::unohelper::DragAndDropWrapper( this );
- mxDnDListener = pDnDWrapper;
-
- uno::Reference< datatransfer::dnd::XDragGestureListener> xDGL( mxDnDListener, uno::UNO_QUERY );
- pWindow->GetDragGestureRecognizer()->addDragGestureListener( xDGL );
- uno::Reference< datatransfer::dnd::XDropTargetListener> xDTL( xDGL, uno::UNO_QUERY );
- pWindow->GetDropTarget()->addDropTargetListener( xDTL );
- pWindow->GetDropTarget()->setActive( sal_True );
- pWindow->GetDropTarget()->setDefaultActions( datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE );
-
- bActiveDragAndDropListener = sal_True;
- }
-}
-
-void ImpEditView::RemoveDragAndDropListeners()
-{
- if ( bActiveDragAndDropListener && GetWindow() && GetWindow()->GetDragGestureRecognizer().is() )
- {
- uno::Reference< datatransfer::dnd::XDragGestureListener> xDGL( mxDnDListener, uno::UNO_QUERY );
- GetWindow()->GetDragGestureRecognizer()->removeDragGestureListener( xDGL );
- uno::Reference< datatransfer::dnd::XDropTargetListener> xDTL( xDGL, uno::UNO_QUERY );
- GetWindow()->GetDropTarget()->removeDropTargetListener( xDTL );
-
- if ( mxDnDListener.is() )
- {
- uno::Reference< lang::XEventListener> xEL( mxDnDListener, uno::UNO_QUERY );
- xEL->disposing( lang::EventObject() ); // #95154# Empty Source means it's the Client
- mxDnDListener.clear();
- }
-
- bActiveDragAndDropListener = sal_False;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
deleted file mode 100644
index b2038d070a..0000000000
--- a/editeng/source/editeng/impedit.hxx
+++ /dev/null
@@ -1,1222 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _IMPEDIT_HXX
-#define _IMPEDIT_HXX
-
-#include <editdoc.hxx>
-#include <editsel.hxx>
-#include <editundo.hxx>
-#include <editobj2.hxx>
-#include <editstt2.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/svxacorr.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/gdimtf.hxx>
-#include <vcl/cursor.hxx>
-
-#include <vcl/dndhelp.hxx>
-#include <svl/ondemand.hxx>
-#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
-#include <com/sun/star/linguistic2/SpellFailure.hpp>
-#include <com/sun/star/linguistic2/XSpellChecker.hpp>
-#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
-#include <com/sun/star/linguistic2/XHyphenator.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
-#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
-#include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <i18npool/lang.h>
-#include <rtl/ref.hxx>
-
-DBG_NAMEEX( EditView )
-DBG_NAMEEX( EditEngine )
-
-#define PIMPEE pImpEditView->pEditEngine->pImpEditEngine
-
-#define DEL_LEFT 1
-#define DEL_RIGHT 2
-#define TRAVEL_X_DONTKNOW 0xFFFFFFFF
-#define CURSOR_BIDILEVEL_DONTKNOW 0xFFFF
-#define MAXCHARSINPARA 0x3FFF-CHARPOSGROW // Max 16K, because WYSIWYG array
-
-#define ATTRSPECIAL_WHOLEWORD 1
-#define ATTRSPECIAL_EDGE 2
-
-#define GETCRSR_TXTONLY 0x0001
-#define GETCRSR_STARTOFLINE 0x0002
-#define GETCRSR_ENDOFLINE 0x0004
-#define GETCRSR_PREFERPORTIONSTART 0x0008
-
-#define LINE_SEP 0x0A
-
-typedef EENotify* EENotifyPtr;
-SV_DECL_PTRARR_DEL( NotifyList, EENotifyPtr, 1, 1 ) // IMPL is in outliner.cxx, move to EE later and share declaration, or use BlockNotifications from EE directly
-
-
-class EditView;
-class EditEngine;
-class SvxFontTable;
-class SvxColorList;
-
-class SvxSearchItem;
-class SvxLRSpaceItem;
-class TextRanger;
-class SvKeyValueIterator;
-class SvxForbiddenCharactersTable;
-class SvtCTLOptions;
-class Window;
-
-#include <editeng/SpellPortions.hxx>
-
-#include <editeng/eedata.hxx>
-
-class SvUShorts;
-class SvxNumberFormat;
-
-
-namespace com {
-namespace sun {
-namespace star {
-namespace datatransfer {
-namespace clipboard {
- class XClipboard;
-}}}}}
-
-namespace svtools {
- class ColorConfig;
-}
-
-struct DragAndDropInfo
-{
- Rectangle aCurCursor;
- Rectangle aCurSavedCursor;
- sal_uInt16 nSensibleRange;
- sal_uInt16 nCursorWidth;
- ESelection aBeginDragSel;
- EditPaM aDropDest;
- sal_uInt16 nOutlinerDropDest;
- ESelection aDropSel;
- VirtualDevice* pBackground;
- const SvxFieldItem* pField;
- sal_Bool bVisCursor : 1;
- sal_Bool bDroppedInMe : 1;
- sal_Bool bStarterOfDD : 1;
- sal_Bool bHasValidData : 1;
- sal_Bool bUndoAction : 1;
- sal_Bool bOutlinerMode : 1;
- sal_Bool bDragAccepted : 1;
-
- DragAndDropInfo()
- {
- pBackground = NULL; bVisCursor = sal_False; bDroppedInMe = sal_False; bStarterOfDD = sal_False;
- bHasValidData = sal_False; bUndoAction = sal_False; bOutlinerMode = sal_False;
- nSensibleRange = 0; nCursorWidth = 0; pField = 0; nOutlinerDropDest = 0; bDragAccepted = sal_False;
- }
-};
-
-struct ImplIMEInfos
-{
- String aOldTextAfterStartPos;
- sal_uInt16* pAttribs;
- EditPaM aPos;
- sal_uInt16 nLen;
- sal_Bool bCursor;
- sal_Bool bWasCursorOverwrite;
-
- ImplIMEInfos( const EditPaM& rPos, const String& rOldTextAfterStartPos );
- ~ImplIMEInfos();
-
- void CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL );
- void DestroyAttribs();
-};
-
-// #i18881# to be able to identify the postions of changed words
-// the positions of each portion need to be saved
-typedef std::vector<EditSelection> SpellContentSelections;
-
-struct SpellInfo
-{
- EESpellState eState;
- EPaM aSpellStart;
- EPaM aSpellTo;
- EditPaM aCurSentenceStart;
- sal_Bool bSpellToEnd;
- sal_Bool bMultipleDoc;
- ::svx::SpellPortions aLastSpellPortions;
- SpellContentSelections aLastSpellContentSelections;
- SpellInfo()
- { bSpellToEnd = sal_True; eState = EE_SPELL_OK; bMultipleDoc = sal_False; }
-};
-
-// used for text conversion
-struct ConvInfo
-{
- EPaM aConvStart;
- EPaM aConvTo;
- EPaM aConvContinue; // position to start search for next text portion (word) with
- sal_Bool bConvToEnd;
- sal_Bool bMultipleDoc;
-
- ConvInfo() { bConvToEnd = sal_True; bMultipleDoc = sal_False; }
-};
-
-struct FormatterFontMetric
-{
- sal_uInt16 nMaxAscent;
- sal_uInt16 nMaxDescent;
-
- FormatterFontMetric() { nMaxAscent = 0; nMaxDescent = 0; /* nMinLeading = 0xFFFF; */ }
- sal_uInt16 GetHeight() const { return nMaxAscent+nMaxDescent; }
-};
-
-class IdleFormattter : public Timer
-{
-private:
- EditView* pView;
- int nRestarts;
-
-public:
- IdleFormattter();
- ~IdleFormattter();
-
- void DoIdleFormat( EditView* pV );
- void ForceTimeout();
- void ResetRestarts() { nRestarts = 0; }
- EditView* GetView() { return pView; }
-};
-
- // ----------------------------------------------------------------------
-// class ImpEditView
-// ----------------------------------------------------------------------
-class ImpEditView : public vcl::unohelper::DragAndDropClient
-{
- friend class EditView;
- friend class EditEngine;
- friend class ImpEditEngine;
- using vcl::unohelper::DragAndDropClient::dragEnter;
- using vcl::unohelper::DragAndDropClient::dragExit;
- using vcl::unohelper::DragAndDropClient::dragOver;
-
-private:
- EditView* pEditView;
- Cursor* pCursor;
- Color* pBackgroundColor;
- EditEngine* pEditEngine;
- Window* pOutWin;
- Pointer* pPointer;
- DragAndDropInfo* pDragAndDropInfo;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener > mxDnDListener;
-
-
- long nInvMore;
- sal_uLong nControl;
- sal_uInt32 nTravelXPos;
- sal_uInt16 nExtraCursorFlags;
- sal_uInt16 nCursorBidiLevel;
- sal_uInt16 nScrollDiffX;
- sal_Bool bReadOnly;
- sal_Bool bClickedInSelection;
- sal_Bool bActiveDragAndDropListener;
-
- Point aAnchorPoint;
- Rectangle aOutArea;
- Point aVisDocStartPos;
- EESelectionMode eSelectionMode;
- EditSelection aEditSelection;
- EVAnchorMode eAnchorMode;
-
-protected:
-
- // DragAndDropClient
- void dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw (::com::sun::star::uno::RuntimeException);
- void dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw (::com::sun::star::uno::RuntimeException);
- void drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw (::com::sun::star::uno::RuntimeException);
- void dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw (::com::sun::star::uno::RuntimeException);
- void dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException);
- void dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException);
-
- void ShowDDCursor( const Rectangle& rRect );
- void HideDDCursor();
-
- void ImplDrawHighlightRect( Window* pOutWin, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, PolyPolygon* pPolyPoly );
-
-public:
- ImpEditView( EditView* pView, EditEngine* pEng, Window* pWindow );
- ~ImpEditView();
-
- EditView* GetEditViewPtr() { return pEditView; }
-
- sal_uInt16 GetScrollDiffX() const { return nScrollDiffX; }
- void SetScrollDiffX( sal_uInt16 n ) { nScrollDiffX = n; }
-
- sal_uInt16 GetCursorBidiLevel() const { return nCursorBidiLevel; }
- void SetCursorBidiLevel( sal_uInt16 n ) { nCursorBidiLevel = n; }
-
- Point GetDocPos( const Point& rWindowPos ) const;
- Point GetWindowPos( const Point& rDocPos ) const;
- Rectangle GetWindowPos( const Rectangle& rDocPos ) const;
-
- void SetOutputArea( const Rectangle& rRec );
- void ResetOutputArea( const Rectangle& rRec );
- const Rectangle& GetOutputArea() const { return aOutArea; }
-
- sal_Bool IsVertical() const;
-
- sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL );
-
- sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent );
- sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent );
- sal_Bool MouseMove( const MouseEvent& rMouseEvent );
- void Command( const CommandEvent& rCEvt );
-
- void CutCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard, sal_Bool bCut );
- void Paste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard, sal_Bool bUseSpecial = sal_False );
-
- void SetVisDocStartPos( const Point& rPos ) { aVisDocStartPos = rPos; }
- const Point& GetVisDocStartPos() const { return aVisDocStartPos; }
-
- long GetVisDocLeft() const { return aVisDocStartPos.X(); }
- long GetVisDocTop() const { return aVisDocStartPos.Y(); }
- long GetVisDocRight() const { return aVisDocStartPos.X() + ( !IsVertical() ? aOutArea.GetWidth() : aOutArea.GetHeight() ); }
- long GetVisDocBottom() const { return aVisDocStartPos.Y() + ( !IsVertical() ? aOutArea.GetHeight() : aOutArea.GetWidth() ); }
- Rectangle GetVisDocArea() const;
-
- EditSelection& GetEditSelection() { return aEditSelection; }
- void SetEditSelection( const EditSelection& rEditSelection );
- sal_Bool HasSelection() const { return aEditSelection.HasRange(); }
-
- void DrawSelection() { DrawSelection( aEditSelection ); }
- void DrawSelection( EditSelection, Region* pRegion = NULL );
- Region* CalcSelectedRegion();
-
- Window* GetWindow() const { return pOutWin; }
-
- EESelectionMode GetSelectionMode() const { return eSelectionMode; }
- void SetSelectionMode( EESelectionMode eMode );
-
- inline void SetPointer( const Pointer& rPointer );
- inline const Pointer& GetPointer();
-
- inline void SetCursor( const Cursor& rCursor );
- inline Cursor* GetCursor();
-
- void AddDragAndDropListeners();
- void RemoveDragAndDropListeners();
-
- sal_Bool IsBulletArea( const Point& rPos, sal_uInt16* pPara );
-
-// For the Selection Engine...
- void CreateAnchor();
- void DeselectAll();
- sal_Bool SetCursorAtPoint( const Point& rPointPixel );
- sal_Bool IsSelectionAtPoint( const Point& rPosPixel );
- sal_Bool IsInSelection( const EditPaM& rPaM );
-
-
- void SetAnchorMode( EVAnchorMode eMode );
- EVAnchorMode GetAnchorMode() const { return eAnchorMode; }
- void CalcAnchorPoint();
- void RecalcOutputArea();
-
- void ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sal_Bool test );
- void ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sal_uInt16 nShowCursorFlags = 0 );
- Pair Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck = RGCHK_NEG );
-
- void SetInsertMode( sal_Bool bInsert );
- sal_Bool IsInsertMode() const { return ( ( nControl & EV_CNTRL_OVERWRITE ) == 0 ); }
-
- void EnablePaste( sal_Bool bEnable ) { SetFlags( nControl, EV_CNTRL_ENABLEPASTE, bEnable ); }
- sal_Bool IsPasteEnabled() const { return ( ( nControl & EV_CNTRL_ENABLEPASTE ) != 0 ); }
-
- sal_Bool DoSingleLinePaste() const { return ( ( nControl & EV_CNTRL_SINGLELINEPASTE ) != 0 ); }
- sal_Bool DoAutoScroll() const { return ( ( nControl & EV_CNTRL_AUTOSCROLL ) != 0 ); }
- sal_Bool DoBigScroll() const { return ( ( nControl & EV_CNTRL_BIGSCROLL ) != 0 ); }
- sal_Bool DoAutoSize() const { return ( ( nControl & EV_CNTRL_AUTOSIZE ) != 0 ); }
- sal_Bool DoAutoWidth() const { return ( ( nControl & EV_CNTRL_AUTOSIZEX) != 0 ); }
- sal_Bool DoAutoHeight() const { return ( ( nControl & EV_CNTRL_AUTOSIZEY) != 0 ); }
- sal_Bool DoInvalidateMore() const { return ( ( nControl & EV_CNTRL_INVONEMORE ) != 0 ); }
-
- void SetBackgroundColor( const Color& rColor );
- const Color& GetBackgroundColor() const {
- return ( pBackgroundColor ? *pBackgroundColor : pOutWin->GetBackground().GetColor() ); }
-
- sal_Bool IsWrongSpelledWord( const EditPaM& rPaM, sal_Bool bMarkIfWrong );
- String SpellIgnoreOrAddWord( sal_Bool bAdd );
-
- const SvxFieldItem* GetField( const Point& rPos, sal_uInt16* pPara, sal_uInt16* pPos ) const;
- void DeleteSelected();
-
- // 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; }
-};
-
-// ----------------------------------------------------------------------
-// ImpEditEngine
-// ----------------------------------------------------------------------
-
-typedef EditView* EditViewPtr;
-SV_DECL_PTRARR( EditViews, EditViewPtr, 0, 1 )
-
-class ImpEditEngine : public SfxListener
-{
- // The Undos have to manipulate directly ( private-Methods ),
- // do that no new Undo is inserted!
- friend class EditUndoInsertChars;
- friend class EditUndoRemoveChars;
- friend class EditUndoDelContent;
- friend class EditUndoConnectParas;
- friend class EditUndoSplitPara;
- friend class EditUndoInsertFeature;
- friend class EditUndoMoveParagraphs;
-
- friend class EditView;
- friend class ImpEditView;
- 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:
-
- // ================================================================
- // Data ...
- // ================================================================
-
- // Document Specific data ...
- ParaPortionList aParaPortionList; // Formatting
- Size aPaperSize; // Layout
- Size aMinAutoPaperSize; // Layout ?
- Size aMaxAutoPaperSize; // Layout ?
- EditDoc aEditDoc; // Document content
-
- // Engine Specific data ...
- EditEngine* pEditEngine;
- EditViews aEditViews;
- EditView* pActiveView;
- TextRanger* pTextRanger;
-
- SfxStyleSheetPool* pStylePool;
- SfxItemPool* pTextObjectPool;
-
- VirtualDevice* pVirtDev;
- OutputDevice* pRefDev;
-
- svtools::ColorConfig* pColorConfig;
- mutable SvtCTLOptions* pCTLOptions;
-
- SfxItemSet* pEmptyItemSet;
- EditUndoManager* pUndoManager;
- ESelection* pUndoMarkSelection;
-
- ImplIMEInfos* mpIMEInfos;
-
- NotifyList aNotifyCache;
-
- XubString aWordDelimiters;
- XubString aGroupChars;
-
- EditSelFunctionSet aSelFuncSet;
- EditSelectionEngine aSelEngine;
-
- Color maBackgroundColor;
-
- sal_uInt32 nBlockNotifications;
- sal_uInt16 nStretchX;
- sal_uInt16 nStretchY;
-
- sal_uInt16 nAsianCompressionMode;
- sal_Bool bKernAsianPunctuation;
- sal_Bool bAddExtLeading;
-
- EEHorizontalTextDirection eDefaultHorizontalTextDirection;
-
- sal_uInt16 nBigTextObjectStart;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > xSpeller;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator > xHyphenator;
- SpellInfo* pSpellInfo;
- mutable ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > xBI;
- mutable ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > xISC;
-
- ConvInfo * pConvInfo;
-
- XubString aAutoCompleteText;
-
- InternalEditStatus aStatus;
-
- LanguageType eDefLanguage;
-
- OnDemandLocaleDataWrapper xLocaleDataWrapper;
- OnDemandTransliterationWrapper xTransliterationWrapper;
-
- sal_Bool bIsFormatting;
- sal_Bool bFormatted;
- sal_Bool bInSelection;
- sal_Bool bIsInUndo;
- sal_Bool bUpdate;
- sal_Bool bUndoEnabled;
- sal_Bool bOwnerOfRefDev;
- sal_Bool bDowning;
- sal_Bool bUseAutoColor;
- sal_Bool bForceAutoColor;
- sal_Bool bCallParaInsertedOrDeleted;
- 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
-
- // For Formatting / Update ....
- DeletedNodesList aDeletedNodes;
- Rectangle aInvalidRec;
- sal_uInt32 nCurTextHeight;
- sal_uInt32 nCurTextHeightNTP; // without trailing empty paragraphs
- sal_uInt16 nOnePixelInRef;
-
- IdleFormattter aIdleFormatter;
-
- Timer aOnlineSpellTimer;
-
- // 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;
- Link aImportHdl;
- Link aBeginMovingParagraphsHdl;
- Link aEndMovingParagraphsHdl;
- Link aBeginPasteOrDropHdl;
- Link aEndPasteOrDropHdl;
- Link aModifyHdl;
- Link maBeginDropHdl;
- Link maEndDropHdl;
-
- rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharsTable;
-
-
- // ================================================================
- // Methods...
- // ================================================================
-
- void CursorMoved( ContentNode* pPrevNode );
- void ParaAttribsChanged( ContentNode* pNode );
- void TextModified();
- void CalcHeight( ParaPortion* pPortion );
-
- // 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; }
-
- EditUndoSetAttribs* CreateAttribUndo( EditSelection aSel, const SfxItemSet& rSet );
-
- EditPaM GetPaM( Point aDocPos, sal_Bool bSmart = sal_True );
- EditPaM GetPaM( ParaPortion* pPortion, Point aPos, sal_Bool bSmart = sal_True );
- long GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, sal_Bool bPreferPortionStart = sal_False );
- long GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion );
- sal_uInt16 GetChar( ParaPortion* pParaPortion, EditLine* pLine, long nX, sal_Bool bSmart = sal_True );
- Range GetInvalidYOffsets( ParaPortion* pPortion );
- Range GetLineXPosStartEnd( ParaPortion* pParaPortion, EditLine* pLine );
-
- void SetParaAttrib( sal_uInt8 nFunc, EditSelection aSel, sal_uInt16 nValue );
- sal_uInt16 GetParaAttrib( sal_uInt8 nFunc, EditSelection aSel );
- void SetCharAttrib( EditSelection aSel, const SfxPoolItem& rItem );
- void ParaAttribsToCharAttribs( ContentNode* pNode );
- void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const;
-
- EditTextObject* CreateBinTextObject( EditSelection aSelection, SfxItemPool*, sal_Bool bAllowBigObjects = sal_False, sal_uInt16 nBigObjStart = 0 ) const;
- void StoreBinTextObject( SvStream& rOStream, BinTextObject& rTextObject );
- EditSelection InsertBinTextObject( BinTextObject&, EditPaM aPaM );
- EditSelection InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxDataObj, const String& rBaseURL, const EditPaM& rPaM, sal_Bool bUseSpecial );
-
- EditPaM Clear();
- EditPaM RemoveText();
- EditPaM RemoveText( EditSelection aEditSelection );
- sal_Bool CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY );
- void CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uInt32 nStartPosY );
- sal_Bool FinishCreateLines( ParaPortion* pParaPortion );
- void CalcCharPositions( ParaPortion* pParaPortion );
- void CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& rStartPos /*, sal_Bool bCreateBlockPortions */ );
- void RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nStartPos, short nNewChars );
- sal_uInt16 SplitTextPortion( ParaPortion* pParaPortion, sal_uInt16 nPos, EditLine* pCurLine = 0 );
- void SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut = NULL, sal_uInt16 nIgnoreWhich = 0 );
- void RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics, SvxFont& rFont );
- void CheckAutoPageSize();
-
- void ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, TextPortion* pPortion, sal_uInt16 nPortionStart, long nRemainingWidth, sal_Bool bCanHyphenate );
- void ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, long nRemainingSpace );
- EditPaM ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pRight, sal_Bool bBackward = sal_False );
- EditPaM ImpDeleteSelection( EditSelection aEditSelection);
- EditPaM ImpInsertParaBreak( const EditPaM& rPaM, sal_Bool bKeepEndingAttribs = sal_True );
- EditPaM ImpInsertParaBreak( const EditSelection& rEditSelection, sal_Bool bKeepEndingAttribs = sal_True );
- EditPaM ImpInsertText( EditSelection aCurEditSelection, const String& rStr );
- EditPaM ImpInsertFeature( EditSelection aEditSelection, const SfxPoolItem& rItem );
- void ImpRemoveChars( const EditPaM& rPaM, sal_uInt16 nChars, EditUndoRemoveChars* pCurUndo = 0 );
- void ImpRemoveParagraph( sal_uInt16 nPara );
- EditSelection ImpMoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos );
-
- EditPaM ImpFastInsertText( EditPaM aPaM, const String& rStr );
- EditPaM ImpFastInsertParagraph( sal_uInt16 nPara );
-
- sal_Bool ImpCheckRefMapMode();
-
- sal_Bool ImplHasText() const;
-
- void ImpFindKashidas( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, SvUShorts& rArray );
-
- void InsertContent( ContentNode* pNode, sal_uInt16 nPos );
- EditPaM SplitContent( sal_uInt16 nNode, sal_uInt16 nSepPos );
- EditPaM ConnectContents( sal_uInt16 nLeftNode, sal_Bool bBackward );
-
- void ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow );
- sal_Bool IsParagraphVisible( sal_uInt16 nParagraph );
-
- EditPaM PageUp( const EditPaM& rPaM, EditView* pView);
- EditPaM PageDown( const EditPaM& rPaM, EditView* pView);
- EditPaM CursorUp( const EditPaM& rPaM, EditView* pEditView );
- EditPaM CursorDown( const EditPaM& rPaM, EditView* pEditView );
- EditPaM CursorLeft( const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL );
- EditPaM CursorRight( const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL );
- EditPaM CursorStartOfLine( const EditPaM& rPaM );
- EditPaM CursorEndOfLine( const EditPaM& rPaM );
- EditPaM CursorStartOfParagraph( const EditPaM& rPaM );
- EditPaM CursorEndOfParagraph( const EditPaM& rPaM );
- EditPaM CursorStartOfDoc();
- EditPaM CursorEndOfDoc();
- EditPaM WordLeft( const EditPaM& rPaM, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
- EditPaM WordRight( const EditPaM& rPaM, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
- EditPaM StartOfWord( const EditPaM& rPaM, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
- EditPaM EndOfWord( const EditPaM& rPaM, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
- EditSelection SelectWord( const EditSelection& rCurSelection, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_Bool bAcceptStartOfWord = sal_True );
- EditSelection SelectSentence( const EditSelection& rCurSel );
- EditPaM CursorVisualLeftRight( EditView* pEditView, const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode, sal_Bool bToLeft );
- EditPaM CursorVisualStartEnd( EditView* pEditView, const EditPaM& rPaM, sal_Bool bStart );
-
-
- void InitScriptTypes( sal_uInt16 nPara );
- sal_uInt16 GetScriptType( const EditPaM& rPaM, sal_uInt16* pEndPos = NULL ) const;
- sal_uInt16 GetScriptType( const EditSelection& rSel ) const;
- sal_Bool IsScriptChange( const EditPaM& rPaM ) const;
- sal_Bool HasScriptType( sal_uInt16 nPara, sal_uInt16 nType ) const;
-
- sal_Bool ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_uInt16 nStartPos, sal_Int32* pDXArray, sal_uInt16 n100thPercentFromMax, sal_Bool bManipulateDXArray );
- void ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* pParaPortion, long nRemainingWidth );
-
- void ImplInitLayoutMode( OutputDevice* pOutDev, sal_uInt16 nPara, sal_uInt16 nIndex );
- void ImplInitDigitMode( OutputDevice* pOutDev, String* pString, xub_StrLen nStt, xub_StrLen nLen, LanguageType eLang );
-
- EditPaM ReadText( SvStream& rInput, EditSelection aSel );
- EditPaM ReadRTF( SvStream& rInput, EditSelection aSel );
- EditPaM ReadXML( SvStream& rInput, EditSelection aSel );
- EditPaM ReadHTML( SvStream& rInput, const String& rBaseURL, EditSelection aSel, SvKeyValueIterator* pHTTPHeaderAttrs );
- EditPaM ReadBin( SvStream& rInput, EditSelection aSel );
- sal_uInt32 WriteText( SvStream& rOutput, EditSelection aSel );
- sal_uInt32 WriteRTF( SvStream& rOutput, EditSelection aSel );
- sal_uInt32 WriteXML( SvStream& rOutput, EditSelection aSel );
- sal_uInt32 WriteHTML( SvStream& rOutput, EditSelection aSel );
- sal_uInt32 WriteBin( SvStream& rOutput, EditSelection aSel, sal_Bool bStoreUnicode = sal_False ) const;
-
- void WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_uInt16 nPara, sal_uInt16 nPos,
- SvxFontTable& rFontTable, SvxColorList& rColorList );
- sal_Bool WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, sal_uInt16 nPara, sal_uInt16 nPos,
- SvxFontTable& rFontTable, SvxColorList& rColorList );
- sal_Int32 LogicToTwips( sal_Int32 n );
-
- inline short GetXValue( short nXValue ) const;
- inline sal_uInt16 GetXValue( sal_uInt16 nXValue ) const;
- inline long GetXValue( long nXValue ) const;
-
- inline short GetYValue( short nYValue ) const;
- inline sal_uInt16 GetYValue( sal_uInt16 nYValue ) const;
-
- ContentNode* GetPrevVisNode( ContentNode* pCurNode );
- ContentNode* GetNextVisNode( ContentNode* pCurNode );
-
- ParaPortion* GetPrevVisPortion( ParaPortion* pCurPortion );
- ParaPortion* GetNextVisPortion( ParaPortion* pCurPortion );
-
- 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; }
- void ForceAutoColor( sal_Bool b ) { bForceAutoColor = b; }
- sal_Bool IsForceAutoColor() const { return bForceAutoColor; }
-
- inline VirtualDevice* GetVirtualDevice( const MapMode& rMapMode, sal_uLong nDrawMode );
- inline void EraseVirtualDevice();
-
- DECL_LINK( StatusTimerHdl, Timer * );
- DECL_LINK( IdleFormatHdl, Timer * );
- DECL_LINK( OnlineSpellHdl, Timer * );
- DECL_LINK( DocModified, void* );
-
- void CheckIdleFormatter();
-
- inline ParaPortion* FindParaPortion( ContentNode* pNode ) const;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CreateTransferable( const EditSelection& rSelection ) const;
-
- void SetValidPaperSize( const Size& rSz );
-
- ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator() const;
- ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > ImplGetInputSequenceChecker() const;
-
- /** Decorate metafile output with verbose text comments
-
- This method is used to wrap SvxFont::QuickDrawText, to
- determine character-by-character wise, which logical text
- units like characters, words and sentences are contained in
- the output string at hand. This is necessary for slideshow
- text effects.
- */
- void ImplFillTextMarkingVector(const ::com::sun::star::lang::Locale& rLocale, EEngineData::TextMarkingVector& rTextMarkingVector, const String& rTxt, const sal_uInt16 nIdx, const sal_uInt16 nLen) const;
-
- SpellInfo * CreateSpellInfo( const EditSelection &rSel, bool bMultipleDocs );
-
-protected:
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
-
-public:
- ImpEditEngine( EditEngine* pEditEngine, SfxItemPool* pPool );
- ~ImpEditEngine();
-
- void InitDoc( sal_Bool bKeepParaAttribs );
- EditDoc& GetEditDoc() { return aEditDoc; }
- const EditDoc& GetEditDoc() const { return aEditDoc; }
-
- inline EditUndoManager& GetUndoManager();
-
- void SetUpdateMode( sal_Bool bUp, EditView* pCurView = 0, sal_Bool bForceUpdate = sal_False );
- sal_Bool GetUpdateMode() const { return bUpdate; }
-
- const ParaPortionList& GetParaPortions() const { return aParaPortionList; }
- ParaPortionList& GetParaPortions() { return aParaPortionList; }
- EditViews& GetEditViews() { return aEditViews; }
-
- const Size& GetPaperSize() const { return aPaperSize; }
- void SetPaperSize( const Size& rSz ) { aPaperSize = rSz; }
-
- void SetVertical( sal_Bool bVertical );
- sal_Bool IsVertical() const { return GetEditDoc().IsVertical(); }
-
- void SetFixedCellHeight( sal_Bool bUseFixedCellHeight );
- sal_Bool IsFixedCellHeight() const { return GetEditDoc().IsFixedCellHeight(); }
-
- void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir ) { eDefaultHorizontalTextDirection = eHTextDir; }
- EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const { return eDefaultHorizontalTextDirection; }
-
-
- void InitWritingDirections( sal_uInt16 nPara );
- sal_Bool IsRightToLeft( sal_uInt16 nPara ) const;
- sal_uInt8 GetRightToLeft( sal_uInt16 nPara, sal_uInt16 nChar, sal_uInt16* pStart = NULL, sal_uInt16* pEnd = NULL );
- sal_Bool HasDifferentRTLLevels( const ContentNode* pNode );
-
- void SetTextRanger( TextRanger* pRanger );
- TextRanger* GetTextRanger() const { return pTextRanger; }
-
- const Size& GetMinAutoPaperSize() const { return aMinAutoPaperSize; }
- void SetMinAutoPaperSize( const Size& rSz ) { aMinAutoPaperSize = rSz; }
-
- const Size& GetMaxAutoPaperSize() const { return aMaxAutoPaperSize; }
- void SetMaxAutoPaperSize( const Size& rSz ) { aMaxAutoPaperSize = rSz; }
-
- void FormatDoc();
- void FormatFullDoc();
- void UpdateViews( EditView* pCurView = 0 );
- void Paint( ImpEditView* pView, const Rectangle& rRect, sal_Bool bUseVirtDev = sal_False );
- void Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aStartPos, sal_Bool bStripOnly = sal_False, short nOrientation = 0 );
-
- sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent, EditView* pView );
- sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent, EditView* pView );
- sal_Bool MouseMove( const MouseEvent& rMouseEvent, EditView* pView );
- void Command( const CommandEvent& rCEvt, EditView* pView );
-
- EditSelectionEngine& GetSelEngine() { return aSelEngine; }
- XubString GetSelected( const EditSelection& rSel, const LineEnd eParaSep = LINEEND_LF ) const;
-
- const SfxItemSet& GetEmptyItemSet();
-
- void UpdateSelections();
-
- void EnableUndo( sal_Bool bEnable );
- sal_Bool IsUndoEnabled() { return bUndoEnabled; }
- void SetUndoMode( sal_Bool b ) { bIsInUndo = b; }
- sal_Bool IsInUndo() { return bIsInUndo; }
-
- void SetCallParaInsertedOrDeleted( sal_Bool b ) { bCallParaInsertedOrDeleted = b; }
- sal_Bool IsCallParaInsertedOrDeleted() const { return bCallParaInsertedOrDeleted; }
-
- sal_Bool IsFormatted() const { return bFormatted; }
- sal_Bool IsFormatting() const { return bIsFormatting; }
-
- void SetText( const String& rText );
- 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, Window* pFrameWin = NULL );
- EditPaM DeleteLeftOrRight( const EditSelection& rEditSelection, sal_uInt8 nMode, sal_uInt8 nDelMode = DELMODE_SIMPLE );
- EditPaM InsertParaBreak( EditSelection aEditSelection );
- EditPaM InsertLineBreak( EditSelection aEditSelection );
- EditPaM InsertTab( EditSelection aEditSelection );
- EditPaM InsertField( EditSelection aEditSelection, const SvxFieldItem& rFld );
- sal_Bool UpdateFields();
-
- EditPaM Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, EditSelection aSel, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
- void Write( SvStream& rOutput, EETextFormat eFormat, EditSelection aSel );
-
- EditTextObject* CreateTextObject();
- EditTextObject* CreateTextObject( EditSelection aSel );
- void SetText( const EditTextObject& rTextObject );
- EditSelection InsertText( const EditTextObject& rTextObject, EditSelection aSel );
-
- EditSelection MoveCursor( const KeyEvent& rKeyEvent, EditView* pEditView );
-
- EditSelection MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos, EditView* pCurView );
-
- 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;
- sal_uInt16 GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
- void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
- sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
- sal_uInt16 GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine );
- sal_uInt32 GetParaHeight( sal_uInt16 nParagraph );
-
- SfxItemSet GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const;
- SfxItemSet GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttrib = sal_False );
- void SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0 );
- void RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich = 0 );
- void RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0, sal_Bool bRemoveFeatures = sal_False );
- void SetFlatMode( sal_Bool bFlat );
-
- void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
- const SfxItemSet& GetParaAttribs( sal_uInt16 nPara ) const;
-
- sal_Bool HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
- const SfxPoolItem& GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
-
- Rectangle PaMtoEditCursor( EditPaM aPaM, sal_uInt16 nFlags = 0 );
- Rectangle GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex, sal_uInt16 nFlags = 0 );
-
- sal_Bool IsModified() const { return aEditDoc.IsModified(); }
- void SetModifyFlag( sal_Bool b ) { aEditDoc.SetModified( b ); }
- void SetModifyHdl( const Link& rLink ) { aModifyHdl = rLink; }
- Link GetModifyHdl() const { return aModifyHdl; }
-
-
- sal_Bool IsInSelectionMode() { return bInSelection; }
- void StopSelectionMode();
-
- void IndentBlock( EditView* pView, sal_Bool bRight );
-
-// For Undo/Redo
- sal_Bool Undo( EditView* pView );
- sal_Bool Redo( EditView* pView );
- sal_Bool Repeat( EditView* pView );
-
-// OV-Special
- void InvalidateFromParagraph( sal_uInt16 nFirstInvPara );
- EditPaM InsertParagraph( sal_uInt16 nPara );
- EditSelection* SelectParagraph( sal_uInt16 nPara );
-
- void SetStatusEventHdl( const Link& rLink ) { aStatusHdlLink = rLink; }
- Link GetStatusEventHdl() const { return aStatusHdlLink; }
-
- void SetNotifyHdl( const Link& rLink ) { aNotifyHdl = rLink; }
- Link GetNotifyHdl() const { return aNotifyHdl; }
-
- void FormatAndUpdate( EditView* pCurView = 0 );
- inline void IdleFormatAndUpdate( EditView* pCurView = 0 );
-
- svtools::ColorConfig& GetColorConfig();
- sal_Bool IsVisualCursorTravelingEnabled();
- sal_Bool DoVisualCursorTraveling( const ContentNode* pNode );
-
- EditSelection ConvertSelection( sal_uInt16 nStartPara, sal_uInt16 nStartPos, sal_uInt16 nEndPara, sal_uInt16 nEndPos ) const;
- inline EPaM CreateEPaM( const EditPaM& rPaM );
- inline EditPaM CreateEditPaM( const EPaM& rEPaM );
- inline ESelection CreateESel( const EditSelection& rSel );
- inline EditSelection CreateSel( const ESelection& rSel );
-
-
- void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
- SfxStyleSheetPool* GetStyleSheetPool() const { return pStylePool; }
-
- void SetStyleSheet( EditSelection aSel, SfxStyleSheet* pStyle );
- void SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle );
- SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const;
-
- void UpdateParagraphsWithStyleSheet( SfxStyleSheet* pStyle );
- void RemoveStyleFromParagraphs( SfxStyleSheet* pStyle );
-
- OutputDevice* GetRefDevice() const { return pRefDev; }
- void SetRefDevice( OutputDevice* pRefDef );
-
- const MapMode& GetRefMapMode() { return pRefDev->GetMapMode(); }
- void SetRefMapMode( const MapMode& rMapMode );
-
- InternalEditStatus& GetStatus() { return aStatus; }
- void CallStatusHdl();
- void DelayedCallStatusHdl() { aStatusTimer.Start(); }
-
- void CallNotify( EENotify& rNotify );
- void EnterBlockNotifications();
- void LeaveBlockNotifications();
-
-
- EditSelection MatchGroup( const EditSelection& rSel );
-
- void UndoActionStart( sal_uInt16 nId );
- void UndoActionStart( sal_uInt16 nId, const ESelection& rSel );
- void UndoActionEnd( sal_uInt16 nId );
-
- EditView* GetActiveView() const { return pActiveView; }
- void SetActiveView( EditView* pView );
-
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 >
- GetSpeller();
- void SetSpeller( ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl )
- { xSpeller = xSpl; }
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator >
- GetHyphenator() const { return xHyphenator; }
- void SetHyphenator( ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator > &xHyph )
- { xHyphenator = xHyph; }
- SpellInfo* GetSpellInfo() const { return pSpellInfo; }
-
- void SetDefaultLanguage( LanguageType eLang ) { eDefLanguage = eLang; }
- LanguageType GetDefaultLanguage() const { return eDefLanguage; }
-
-
- LanguageType GetLanguage( const EditSelection rSelection ) const;
- LanguageType GetLanguage( const EditPaM& rPaM, sal_uInt16* pEndPos = NULL ) const;
- ::com::sun::star::lang::Locale GetLocale( const EditPaM& rPaM ) const;
-
- void DoOnlineSpelling( ContentNode* pThisNodeOnly = 0, sal_Bool bSpellAtCursorPos = sal_False, sal_Bool bInteruptable = sal_True );
- EESpellState Spell( EditView* pEditView, sal_Bool bMultipleDoc );
- EESpellState HasSpellErrors();
- EESpellState StartThesaurus( EditView* pEditView );
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives >
- ImpSpell( EditView* pEditView );
-
- // text conversion functions
- void Convert( EditView* pEditView, LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
- void ImpConvert( rtl::OUString &rConvTxt, LanguageType &rConvTxtLang, EditView* pEditView, LanguageType nSrcLang, const ESelection &rConvRange,
- sal_Bool bAllowImplicitChangesForNotConvertibleText, LanguageType nTargetLang, const Font *pTargetFont );
- ConvInfo * GetConvInfo() const { return pConvInfo; }
- sal_Bool HasConvertibleTextPortion( LanguageType nLang );
- void SetLanguageAndFont( const ESelection &rESel,
- LanguageType nLang, sal_uInt16 nLangWhichId,
- const Font *pFont, sal_uInt16 nFontWhichId );
-
- // returns true if input sequence checking should be applied
- sal_Bool IsInputSequenceCheckingRequired( sal_Unicode nChar, const EditSelection& rCurSel ) const;
-
- //find the next error within the given selection - forward only!
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives >
- ImpFindNextError(EditSelection& rSelection);
- //initialize sentence spelling
- void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
- //spell and return a sentence
- bool SpellSentence(EditView& rView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
- //put spelling back to start of current sentence - needed after switch of grammar support
- void PutSpellingToSentenceStart( EditView& rEditView );
- //applies a changed sentence
- void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck );
- //deinitialize sentence spelling
- void EndSpelling();
- //adds one or more portions of text to the SpellPortions depending on language changes
- void AddPortionIterated(
- EditView& rEditView,
- const EditSelection rSel,
- ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives > xAlt,
- ::svx::SpellPortions& rToFill);
- //adds one portion to the SpellPortions
- void AddPortion(
- const EditSelection rSel,
- ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives > xAlt,
- ::svx::SpellPortions& rToFill,
- bool bIsField );
-
- sal_Bool Search( const SvxSearchItem& rSearchItem, EditView* pView );
- sal_Bool ImpSearch( const SvxSearchItem& rSearchItem, const EditSelection& rSearchSelection, const EditPaM& rStartPos, EditSelection& rFoundSel );
- sal_uInt16 StartSearchAndReplace( EditView* pEditView, const SvxSearchItem& rSearchItem );
- sal_Bool HasText( const SvxSearchItem& rSearchItem );
-
- void SetEditTextObjectPool( SfxItemPool* pP ) { pTextObjectPool = pP; }
- SfxItemPool* GetEditTextObjectPool() const { return pTextObjectPool; }
-
- const SvxNumberFormat * GetNumberFormat( const ContentNode* pNode ) const;
- sal_Int32 GetSpaceBeforeAndMinLabelWidth( const ContentNode *pNode, sal_Int32 *pnSpaceBefore = 0, sal_Int32 *pnMinLabelWidth = 0 ) const;
-
- 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 );
- void DoStretchChars( sal_uInt16 nX, sal_uInt16 nY );
-
- void SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount ) { nBigTextObjectStart = nStartAtPortionCount; }
- sal_uInt16 GetBigTextObjectStart() const { return nBigTextObjectStart; }
-
- inline EditEngine* GetEditEnginePtr() const { return pEditEngine; }
-
- void StartOnlineSpellTimer() { aOnlineSpellTimer.Start(); }
- void StopOnlineSpellTimer() { aOnlineSpellTimer.Stop(); }
-
- const XubString& GetAutoCompleteText() const { return aAutoCompleteText; }
- void SetAutoCompleteText( const String& rStr, sal_Bool bUpdateTipWindow );
-
- EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode );
- short ReplaceTextOnly( ContentNode* pNode, sal_uInt16 nCurrentStart, xub_StrLen nLen, const String& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rOffsets );
-
-
- void SetAsianCompressionMode( sal_uInt16 n );
- sal_uInt16 GetAsianCompressionMode() const { return nAsianCompressionMode; }
-
- void SetKernAsianPunctuation( sal_Bool b );
- sal_Bool IsKernAsianPunctuation() const { return bKernAsianPunctuation; }
-
- void SetAddExtLeading( sal_Bool b );
- sal_Bool IsAddExtLeading() const { return bAddExtLeading; }
-
- rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable( sal_Bool bGetInternal = sal_True ) const;
- void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
-
- sal_Bool mbLastTryMerge;
-
- /** sets a link that is called at the beginning of a drag operation at an edit view */
- void SetBeginDropHdl( const Link& rLink ) { maBeginDropHdl = rLink; }
- Link GetBeginDropHdl() const { return maBeginDropHdl; }
-
- /** sets a link that is called at the end of a drag operation at an edit view */
- void SetEndDropHdl( const Link& rLink ) { maEndDropHdl = rLink; }
- Link GetEndDropHdl() const { return maEndDropHdl; }
-
- /// specifies if auto-correction should capitalize the first word or not (default is on)
- void SetFirstWordCapitalization( sal_Bool bCapitalize ) { bFirstWordCapitalization = bCapitalize; }
- sal_Bool IsFirstWordCapitalization() const { return bFirstWordCapitalization; }
-};
-
-inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM )
-{
- ContentNode* pNode = rPaM.GetNode();
- return EPaM( aEditDoc.GetPos( pNode ), rPaM.GetIndex() );
-}
-
-inline EditPaM ImpEditEngine::CreateEditPaM( const EPaM& rEPaM )
-{
- 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 );
-}
-
-inline ESelection ImpEditEngine::CreateESel( const EditSelection& rSel )
-{
- ContentNode* pStartNode = rSel.Min().GetNode();
- ContentNode* pEndNode = rSel.Max().GetNode();
- ESelection aESel;
- aESel.nStartPara = aEditDoc.GetPos( pStartNode );
- aESel.nStartPos = rSel.Min().GetIndex();
- aESel.nEndPara = aEditDoc.GetPos( pEndNode );
- aESel.nEndPos = rSel.Max().GetIndex();
- return aESel;
-}
-
-inline EditSelection ImpEditEngine::CreateSel( const ESelection& rSel )
-{
- 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: incorrect selection!" );
- return aSel;
-}
-
-inline VirtualDevice* ImpEditEngine::GetVirtualDevice( const MapMode& rMapMode, sal_uLong nDrawMode )
-{
- if ( !pVirtDev )
- pVirtDev = new VirtualDevice;
-
- if ( ( pVirtDev->GetMapMode().GetMapUnit() != rMapMode.GetMapUnit() ) ||
- ( pVirtDev->GetMapMode().GetScaleX() != rMapMode.GetScaleX() ) ||
- ( pVirtDev->GetMapMode().GetScaleY() != rMapMode.GetScaleY() ) )
- {
- MapMode aMapMode( rMapMode );
- aMapMode.SetOrigin( Point( 0, 0 ) );
- pVirtDev->SetMapMode( aMapMode );
- }
-
- pVirtDev->SetDrawMode( nDrawMode );
-
- return pVirtDev;
-}
-
-inline void ImpEditEngine::EraseVirtualDevice()
-{
- delete pVirtDev;
- pVirtDev = 0;
-}
-
-inline void ImpEditEngine::IdleFormatAndUpdate( EditView* pCurView )
-{
- aIdleFormatter.DoIdleFormat( pCurView );
-}
-
-inline EditUndoManager& ImpEditEngine::GetUndoManager()
-{
- if ( !pUndoManager )
- pUndoManager = new EditUndoManager( this );
- return *pUndoManager;
-}
-
-inline ParaPortion* ImpEditEngine::FindParaPortion( ContentNode* pNode ) const
-{
- sal_uInt16 nPos = aEditDoc.GetPos( pNode );
- DBG_ASSERT( nPos < GetParaPortions().Count(), "Portionloser Node?" );
- return GetParaPortions()[ nPos ];
-}
-
-inline void ImpEditEngine::GetCharStretching( sal_uInt16& rX, sal_uInt16& rY )
-{
- rX = nStretchX;
- rY = nStretchY;
-}
-
-inline short ImpEditEngine::GetXValue( short nXValue ) const
-{
- if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
- return nXValue;
-
- return (short) ((long)nXValue*nStretchX/100);
-}
-
-inline sal_uInt16 ImpEditEngine::GetXValue( sal_uInt16 nXValue ) const
-{
- if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
- return nXValue;
-
- return (sal_uInt16) ((long)nXValue*nStretchX/100);
-}
-
-inline long ImpEditEngine::GetXValue( long nXValue ) const
-{
- if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
- return nXValue;
-
- return nXValue*nStretchX/100;
-}
-
-inline short ImpEditEngine::GetYValue( short nYValue ) const
-{
- if ( !aStatus.DoStretch() || ( nStretchY == 100 ) )
- return nYValue;
-
- return (short) ((long)nYValue*nStretchY/100);
-}
-
-inline sal_uInt16 ImpEditEngine::GetYValue( sal_uInt16 nYValue ) const
-{
- if ( !aStatus.DoStretch() || ( nStretchY == 100 ) )
- return nYValue;
-
- return (sal_uInt16) ((long)nYValue*nStretchY/100);
-}
-
-inline void ImpEditView::SetPointer( const Pointer& rPointer )
-{
- delete pPointer;
- pPointer = new Pointer( rPointer );
-}
-
-inline const Pointer& ImpEditView::GetPointer()
-{
- if ( !pPointer )
- {
- pPointer = new Pointer( IsVertical() ? POINTER_TEXT_VERTICAL : POINTER_TEXT );
- return *pPointer;
- }
-
- if(POINTER_TEXT == pPointer->GetStyle() && IsVertical())
- {
- delete pPointer;
- pPointer = new Pointer(POINTER_TEXT_VERTICAL);
- }
- else if(POINTER_TEXT_VERTICAL == pPointer->GetStyle() && !IsVertical())
- {
- delete pPointer;
- pPointer = new Pointer(POINTER_TEXT);
- }
-
- return *pPointer;
-}
-
-inline void ImpEditView::SetCursor( const Cursor& rCursor )
-{
- delete pCursor;
- pCursor = new Cursor( rCursor );
-}
-
-inline Cursor* ImpEditView::GetCursor()
-{
- if ( !pCursor )
- pCursor = new Cursor;
- return pCursor;
-}
-
-void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit );
-void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const MapUnit* pSourceUnit = NULL, const MapUnit* pDestUnit = NULL );
-sal_uInt8 GetCharTypeForCompression( xub_Unicode cChar );
-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
deleted file mode 100644
index 689025d951..0000000000
--- a/editeng/source/editeng/impedit2.cxx
+++ /dev/null
@@ -1,4565 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-
-#include <editeng/lspcitem.hxx>
-#include <editeng/flditem.hxx>
-#include <impedit.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editdbg.hxx>
-#include <eerdll2.hxx>
-#include <editeng/eerdll.hxx>
-#include <edtspell.hxx>
-#include <eeobj.hxx>
-#include <editeng/txtrange.hxx>
-#include <svl/urlbmk.hxx>
-#include <svtools/colorcfg.hxx>
-#include <svl/ctloptions.hxx>
-#include <editeng/acorrcfg.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/adjitem.hxx>
-#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>
-#include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/text/CharacterCompressionType.hpp>
-#include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
-
-#include <comphelper/processfactory.hxx>
-
-#include <sot/formats.hxx>
-
-#include <unicode/ubidi.h>
-
-using namespace ::com::sun::star;
-
-sal_uInt16 lcl_CalcExtraSpace( ParaPortion*, const SvxLineSpacingItem& rLSItem )
-{
- sal_uInt16 nExtra = 0;
- if ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX )
- {
- nExtra = rLSItem.GetInterLineSpace();
- }
-
- return nExtra;
-}
-
-ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
- aPaperSize( 0x7FFFFFFF, 0x7FFFFFFF ),
- aMinAutoPaperSize( 0x0, 0x0 ),
- aMaxAutoPaperSize( 0x7FFFFFFF, 0x7FFFFFFF ),
- aEditDoc( pItemPool ),
- aWordDelimiters( RTL_CONSTASCII_USTRINGPARAM( " .,;:-'`'?!_=\"{}()[]\0xFF" ) ),
- aGroupChars( RTL_CONSTASCII_USTRINGPARAM( "{}()[]" ) )
-{
- pEditEngine = pEE;
- pRefDev = NULL;
- pVirtDev = NULL;
- pEmptyItemSet = NULL;
- pActiveView = NULL;
- pSpellInfo = NULL;
- pConvInfo = NULL;
- pTextObjectPool = NULL;
- mpIMEInfos = NULL;
- pStylePool = NULL;
- pUndoManager = NULL;
- pUndoMarkSelection = NULL;
- pTextRanger = NULL;
- pColorConfig = NULL;
- pCTLOptions = NULL;
-
- nCurTextHeight = 0;
- nCurTextHeightNTP = 0;
- nBlockNotifications = 0;
- nBigTextObjectStart = 20;
-
- nStretchX = 100;
- nStretchY = 100;
-
- bInSelection = sal_False;
- bOwnerOfRefDev = sal_False;
- bDowning = sal_False;
- bIsInUndo = sal_False;
- bIsFormatting = sal_False;
- bFormatted = sal_False;
- bUpdate = sal_True;
- bUseAutoColor = sal_True;
- bForceAutoColor = sal_False;
- bAddExtLeading = sal_False;
- bUndoEnabled = sal_True;
- bCallParaInsertedOrDeleted = sal_False;
- bImpConvertFirstCall= sal_False;
- bFirstWordCapitalization = sal_True;
-
- eDefLanguage = LANGUAGE_DONTKNOW;
- maBackgroundColor = COL_AUTO;
-
- nAsianCompressionMode = text::CharacterCompressionType::NONE;
- bKernAsianPunctuation = sal_False;
-
- eDefaultHorizontalTextDirection = EE_HTEXTDIR_DEFAULT;
-
-
- aStatus.GetControlWord() = EE_CNTRL_USECHARATTRIBS | EE_CNTRL_DOIDLEFORMAT |
- EE_CNTRL_PASTESPECIAL | EE_CNTRL_UNDOATTRIBS |
- EE_CNTRL_ALLOWBIGOBJS | EE_CNTRL_RTFSTYLESHEETS |
- EE_CNTRL_FORMAT100;
-
- aSelEngine.SetFunctionSet( &aSelFuncSet );
-
- aStatusTimer.SetTimeout( 200 );
- aStatusTimer.SetTimeoutHdl( LINK( this, ImpEditEngine, StatusTimerHdl ) );
-
- aIdleFormatter.SetTimeout( 5 );
- aIdleFormatter.SetTimeoutHdl( LINK( this, ImpEditEngine, IdleFormatHdl ) );
-
- aOnlineSpellTimer.SetTimeout( 100 );
- aOnlineSpellTimer.SetTimeoutHdl( LINK( this, ImpEditEngine, OnlineSpellHdl ) );
-
- pRefDev = EE_DLL().GetGlobalData()->GetStdRefDevice();
-
- // Access data already from here on!
- SetRefDevice( pRefDev );
- InitDoc( sal_False );
-
- bCallParaInsertedOrDeleted = sal_True;
-
- aEditDoc.SetModifyHdl( LINK( this, ImpEditEngine, DocModified ) );
-
- mbLastTryMerge = sal_False;
-}
-
-ImpEditEngine::~ImpEditEngine()
-{
- aStatusTimer.Stop();
- aOnlineSpellTimer.Stop();
- aIdleFormatter.Stop();
-
- // Destroying templates may otherwise cause unnecessary formatting,
- // when a parent template is destroyed.
- // And this after the destruction of the data!
- bDowning = sal_True;
- SetUpdateMode( sal_False );
-
- delete pVirtDev;
- delete pEmptyItemSet;
- delete pUndoManager;
- delete pTextRanger;
- delete mpIMEInfos;
- delete pColorConfig;
- delete pCTLOptions;
- if ( bOwnerOfRefDev )
- delete pRefDev;
- delete pSpellInfo;
-}
-
-void ImpEditEngine::SetRefDevice( OutputDevice* pRef )
-{
- if ( bOwnerOfRefDev )
- delete pRefDev;
-
- pRefDev = pRef;
- bOwnerOfRefDev = sal_False;
-
- if ( !pRef )
- pRefDev = EE_DLL().GetGlobalData()->GetStdRefDevice();
-
- nOnePixelInRef = (sal_uInt16)pRefDev->PixelToLogic( Size( 1, 0 ) ).Width();
-
- if ( IsFormatted() )
- {
- FormatFullDoc();
- UpdateViews( (EditView*) 0);
- }
-}
-
-void ImpEditEngine::SetRefMapMode( const MapMode& rMapMode )
-{
- if ( GetRefDevice()->GetMapMode() == rMapMode )
- return;
-
- // When RefDev == GlobalRefDev => create own!
- if ( !bOwnerOfRefDev && ( pRefDev == EE_DLL().GetGlobalData()->GetStdRefDevice() ) )
- {
- pRefDev = new VirtualDevice;
- pRefDev->SetMapMode( MAP_TWIP );
- SetRefDevice( pRefDev );
- bOwnerOfRefDev = sal_True;
- }
- pRefDev->SetMapMode( rMapMode );
- nOnePixelInRef = (sal_uInt16)pRefDev->PixelToLogic( Size( 1, 0 ) ).Width();
- if ( IsFormatted() )
- {
- FormatFullDoc();
- UpdateViews( (EditView*) 0);
- }
-}
-
-void ImpEditEngine::InitDoc( sal_Bool bKeepParaAttribs )
-{
- sal_uInt16 nParas = aEditDoc.Count();
- for ( sal_uInt16 n = bKeepParaAttribs ? 1 : 0; n < nParas; n++ )
- {
- if ( aEditDoc[n]->GetStyleSheet() )
- EndListening( *aEditDoc[n]->GetStyleSheet(), sal_False );
- }
-
- if ( bKeepParaAttribs )
- aEditDoc.RemoveText();
- else
- aEditDoc.Clear();
-
- GetParaPortions().Reset();
-
- ParaPortion* pIniPortion = new ParaPortion( aEditDoc[0] );
- GetParaPortions().Insert( pIniPortion, 0 );
-
- bFormatted = sal_False;
-
- if ( IsCallParaInsertedOrDeleted() )
- {
- GetEditEnginePtr()->ParagraphDeleted( EE_PARA_ALL );
- GetEditEnginePtr()->ParagraphInserted( 0 );
- }
-
- if ( GetStatus().DoOnlineSpelling() )
- aEditDoc.GetObject( 0 )->CreateWrongList();
-}
-
-EditPaM ImpEditEngine::DeleteSelected( EditSelection aSel )
-{
- EditPaM aPaM ( ImpDeleteSelection( aSel ) );
- return aPaM;
-}
-
-XubString ImpEditEngine::GetSelected( const EditSelection& rSel, const LineEnd eEnd ) const
-{
- XubString aText;
- if ( !rSel.HasRange() )
- return aText;
-
- String aSep = EditDoc::GetSepStr( eEnd );
-
- EditSelection aSel( rSel );
- aSel.Adjust( aEditDoc );
-
- ContentNode* pStartNode = aSel.Min().GetNode();
- ContentNode* pEndNode = aSel.Max().GetNode();
- sal_uInt16 nStartNode = aEditDoc.GetPos( pStartNode );
- sal_uInt16 nEndNode = aEditDoc.GetPos( pEndNode );
-
- OSL_ENSURE( nStartNode <= nEndNode, "Selection not sorted ?" );
-
- // iterate over the paragraphs ...
- for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )
- {
- 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 ) // can also be == nStart!
- nEndPos = aSel.Max().GetIndex();
-
- aText += aEditDoc.GetParaAsString( pNode, nStartPos, nEndPos );
- if ( nNode < nEndNode )
- aText += aSep;
- }
- return aText;
-}
-
-sal_Bool ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pView )
-{
- GetSelEngine().SetCurView( pView );
- SetActiveView( pView );
-
- if ( GetAutoCompleteText().Len() )
- SetAutoCompleteText( String(), sal_True );
-
- GetSelEngine().SelMouseButtonDown( rMEvt );
- // Special treatment
- EditSelection aCurSel( pView->pImpEditView->GetEditSelection() );
- if ( !rMEvt.IsShift() )
- {
- if ( rMEvt.GetClicks() == 2 )
- {
- // So that the SelectionEngine knows about the anchor.
- aSelEngine.CursorPosChanging( sal_True, sal_False );
-
- EditSelection aNewSelection( SelectWord( aCurSel ) );
- pView->pImpEditView->DrawSelection();
- pView->pImpEditView->SetEditSelection( aNewSelection );
- pView->pImpEditView->DrawSelection();
- pView->ShowCursor( sal_True, sal_True );
- }
- else if ( rMEvt.GetClicks() == 3 )
- {
- // So that the SelectionEngine knows about the anchor.
- aSelEngine.CursorPosChanging( sal_True, sal_False );
-
- EditSelection aNewSelection( aCurSel );
- aNewSelection.Min().SetIndex( 0 );
- aNewSelection.Max().SetIndex( aCurSel.Min().GetNode()->Len() );
- pView->pImpEditView->DrawSelection();
- pView->pImpEditView->SetEditSelection( aNewSelection );
- pView->pImpEditView->DrawSelection();
- pView->ShowCursor( sal_True, sal_True );
- }
- }
- return sal_True;
-}
-
-void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView )
-{
- GetSelEngine().SetCurView( pView );
- SetActiveView( pView );
- if ( rCEvt.GetCommand() == COMMAND_VOICE )
- {
- const CommandVoiceData* pData = rCEvt.GetVoiceData();
- if ( pData->GetType() == VOICECOMMANDTYPE_DICTATION )
- {
- // Turn functions into KeyEvent if no corresponding method to
- // EditView/EditEngine so that Undo remains consistent.
- SfxPoolItem* pNewAttr = NULL;
-
- switch ( pData->GetCommand() )
- {
- case DICTATIONCOMMAND_UNKNOWN:
- {
- pView->InsertText( pData->GetText() );
- }
- break;
- case DICTATIONCOMMAND_NEWPARAGRAPH:
- {
- pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_RETURN, 0 ) ) );
- }
- break;
- case DICTATIONCOMMAND_NEWLINE:
- {
- pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_RETURN, KEY_SHIFT ) ) );
- }
- break;
- case DICTATIONCOMMAND_TAB:
- {
- pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_TAB, 0 ) ) );
- }
- break;
- case DICTATIONCOMMAND_LEFT:
- {
- pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_LEFT, KEY_MOD1 ) ) );
- }
- break;
- case DICTATIONCOMMAND_RIGHT:
- {
- pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_RIGHT, KEY_MOD1 ) ) );
- }
- break;
- case DICTATIONCOMMAND_UP:
- {
- pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_UP, 0 ) ) );
- }
- break;
- case DICTATIONCOMMAND_DOWN:
- {
- pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_UP, 0 ) ) );
- }
- break;
- case DICTATIONCOMMAND_UNDO:
- {
- pView->Undo();
- }
- break;
- case DICTATIONCOMMAND_DEL:
- {
- pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_LEFT, KEY_MOD1|KEY_SHIFT ) ) );
- pView->DeleteSelected();
- }
- break;
- case DICTATIONCOMMAND_BOLD_ON:
- {
- pNewAttr = new SvxWeightItem( WEIGHT_BOLD, EE_CHAR_WEIGHT );
- }
- break;
- case DICTATIONCOMMAND_BOLD_OFF:
- {
- pNewAttr = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT );
- }
- break;
- case DICTATIONCOMMAND_ITALIC_ON:
- {
- pNewAttr = new SvxPostureItem( ITALIC_NORMAL, EE_CHAR_ITALIC );
- }
- break;
- case DICTATIONCOMMAND_ITALIC_OFF:
- {
- pNewAttr = new SvxPostureItem( ITALIC_NORMAL, EE_CHAR_ITALIC );
- }
- break;
- case DICTATIONCOMMAND_UNDERLINE_ON:
- {
- pNewAttr = new SvxUnderlineItem( UNDERLINE_SINGLE, EE_CHAR_UNDERLINE );
- }
- break;
- case DICTATIONCOMMAND_UNDERLINE_OFF:
- {
- pNewAttr = new SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE );
- }
- break;
- }
-
- if ( pNewAttr )
- {
- SfxItemSet aSet( GetEmptyItemSet() );
- aSet.Put( *pNewAttr );
- pView->SetAttribs( aSet );
- delete pNewAttr;
- }
- }
- }
- else if ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT )
- {
- pView->DeleteSelected();
- delete mpIMEInfos;
- EditPaM aPaM = pView->GetImpEditView()->GetEditSelection().Max();
- String aOldTextAfterStartPos = aPaM.GetNode()->Copy( aPaM.GetIndex() );
- sal_uInt16 nMax = aOldTextAfterStartPos.Search( CH_FEATURE );
- if ( nMax != STRING_NOTFOUND ) // don't overwrite features!
- aOldTextAfterStartPos.Erase( nMax );
- mpIMEInfos = new ImplIMEInfos( aPaM, aOldTextAfterStartPos );
- mpIMEInfos->bWasCursorOverwrite = !pView->IsInsertMode();
- UndoActionStart( EDITUNDO_INSERT );
- }
- else if ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT )
- {
- OSL_ENSURE( mpIMEInfos, "COMMAND_ENDEXTTEXTINPUT => Kein Start ?" );
- if( mpIMEInfos )
- {
- // #102812# convert quotes in IME text
- // works on the last input character, this is escpecially in Korean text often done
- // quotes that are inside of the string are not replaced!
- // Borrowed from sw: edtwin.cxx
- if ( mpIMEInfos->nLen )
- {
- EditSelection aSel( mpIMEInfos->aPos );
- aSel.Min().GetIndex() += mpIMEInfos->nLen-1;
- aSel.Max().GetIndex() =
- aSel.Max().GetIndex() + mpIMEInfos->nLen;
- // #102812# convert quotes in IME text
- // works on the last input character, this is escpecially in Korean text often done
- // quotes that are inside of the string are not replaced!
- const sal_Unicode nCharCode = aSel.Min().GetNode()->GetChar( aSel.Min().GetIndex() );
- if ( ( GetStatus().DoAutoCorrect() ) && ( ( nCharCode == '\"' ) || ( nCharCode == '\'' ) ) )
- {
- aSel = DeleteSelected( aSel );
- aSel = AutoCorrect( aSel, nCharCode, mpIMEInfos->bWasCursorOverwrite );
- pView->pImpEditView->SetEditSelection( aSel );
- }
- }
-
- ParaPortion* pPortion = FindParaPortion( mpIMEInfos->aPos.GetNode() );
- pPortion->MarkSelectionInvalid( mpIMEInfos->aPos.GetIndex(), 0 );
-
- sal_Bool bWasCursorOverwrite = mpIMEInfos->bWasCursorOverwrite;
-
- delete mpIMEInfos;
- mpIMEInfos = NULL;
-
- FormatAndUpdate( pView );
-
- pView->SetInsertMode( !bWasCursorOverwrite );
- }
- UndoActionEnd( EDITUNDO_INSERT );
- }
- else if ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT )
- {
- OSL_ENSURE( mpIMEInfos, "COMMAND_EXTTEXTINPUT => No Start ?" );
- if( mpIMEInfos )
- {
- const CommandExtTextInputData* pData = rCEvt.GetExtTextInputData();
-
- if ( !pData->IsOnlyCursorChanged() )
- {
- EditSelection aSel( mpIMEInfos->aPos );
- aSel.Max().GetIndex() =
- aSel.Max().GetIndex() + mpIMEInfos->nLen;
- aSel = DeleteSelected( aSel );
- aSel = ImpInsertText( aSel, pData->GetText() );
-
- if ( mpIMEInfos->bWasCursorOverwrite )
- {
- sal_uInt16 nOldIMETextLen = mpIMEInfos->nLen;
- sal_uInt16 nNewIMETextLen = pData->GetText().Len();
-
- if ( ( nOldIMETextLen > nNewIMETextLen ) &&
- ( nNewIMETextLen < mpIMEInfos->aOldTextAfterStartPos.Len() ) )
- {
- // restore old characters
- sal_uInt16 nRestore = nOldIMETextLen - nNewIMETextLen;
- EditPaM aPaM( mpIMEInfos->aPos );
- aPaM.GetIndex() = aPaM.GetIndex() + nNewIMETextLen;
- ImpInsertText( aPaM, mpIMEInfos->aOldTextAfterStartPos.Copy( nNewIMETextLen, nRestore ) );
- }
- else if ( ( nOldIMETextLen < nNewIMETextLen ) &&
- ( nOldIMETextLen < mpIMEInfos->aOldTextAfterStartPos.Len() ) )
- {
- // overwrite
- sal_uInt16 nOverwrite = nNewIMETextLen - nOldIMETextLen;
- if ( ( nOldIMETextLen + nOverwrite ) > mpIMEInfos->aOldTextAfterStartPos.Len() )
- nOverwrite = mpIMEInfos->aOldTextAfterStartPos.Len() - nOldIMETextLen;
- OSL_ENSURE( nOverwrite && (nOverwrite < 0xFF00), "IME Overwrite?!" );
- EditPaM aPaM( mpIMEInfos->aPos );
- aPaM.GetIndex() = aPaM.GetIndex() + nNewIMETextLen;
- EditSelection _aSel( aPaM );
- _aSel.Max().GetIndex() =
- _aSel.Max().GetIndex() + nOverwrite;
- DeleteSelected( _aSel );
- }
- }
- if ( pData->GetTextAttr() )
- {
- mpIMEInfos->CopyAttribs( pData->GetTextAttr(), pData->GetText().Len() );
- mpIMEInfos->bCursor = pData->IsCursorVisible();
- }
- else
- {
- mpIMEInfos->DestroyAttribs();
- mpIMEInfos->nLen = pData->GetText().Len();
- }
-
- ParaPortion* pPortion = FindParaPortion( mpIMEInfos->aPos.GetNode() );
- pPortion->MarkSelectionInvalid( mpIMEInfos->aPos.GetIndex(), 0 );
- FormatAndUpdate( pView );
- }
-
- EditSelection aNewSel = EditPaM( mpIMEInfos->aPos.GetNode(), mpIMEInfos->aPos.GetIndex()+pData->GetCursorPos() );
- pView->SetSelection( CreateESel( aNewSel ) );
- pView->SetInsertMode( !pData->IsCursorOverwrite() );
-
- if ( pData->IsCursorVisible() )
- pView->ShowCursor();
- else
- pView->HideCursor();
- }
- }
- else if ( rCEvt.GetCommand() == COMMAND_INPUTCONTEXTCHANGE )
- {
- }
- else if ( rCEvt.GetCommand() == COMMAND_CURSORPOS )
- {
- if ( mpIMEInfos && mpIMEInfos->nLen )
- {
- EditPaM aPaM( pView->pImpEditView->GetEditSelection().Max() );
- Rectangle aR1 = PaMtoEditCursor( aPaM, 0 );
-
- sal_uInt16 nInputEnd = mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen;
-
- if ( !IsFormatted() )
- FormatDoc();
-
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( GetEditDoc().GetPos( aPaM.GetNode() ) );
- sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_True );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
- if ( pLine && ( nInputEnd > pLine->GetEnd() ) )
- nInputEnd = pLine->GetEnd();
- Rectangle aR2 = PaMtoEditCursor( EditPaM( aPaM.GetNode(), nInputEnd ), GETCRSR_ENDOFLINE );
- Rectangle aRect = pView->GetImpEditView()->GetWindowPos( aR1 );
- pView->GetWindow()->SetCursorRect( &aRect, aR2.Left()-aR1.Right() );
- }
- else
- {
- pView->GetWindow()->SetCursorRect();
- }
- }
- else if ( rCEvt.GetCommand() == COMMAND_SELECTIONCHANGE )
- {
- const CommandSelectionChangeData *pData = rCEvt.GetSelectionChangeData();
-
- ESelection aSelection = pView->GetSelection();
- aSelection.Adjust();
-
- if( pView->HasSelection() )
- {
- aSelection.nEndPos = aSelection.nStartPos;
- aSelection.nStartPos += pData->GetStart();
- aSelection.nEndPos += pData->GetEnd();
- }
- else
- {
- aSelection.nStartPos = pData->GetStart();
- aSelection.nEndPos = pData->GetEnd();
- }
- pView->SetSelection( aSelection );
- }
- else if ( rCEvt.GetCommand() == COMMAND_PREPARERECONVERSION )
- {
- if ( pView->HasSelection() )
- {
- ESelection aSelection = pView->GetSelection();
- aSelection.Adjust();
-
- if ( aSelection.nStartPara != aSelection.nEndPara )
- {
- xub_StrLen aParaLen = pEditEngine->GetTextLen( aSelection.nStartPara );
- aSelection.nEndPara = aSelection.nStartPara;
- aSelection.nEndPos = aParaLen;
- pView->SetSelection( aSelection );
- }
- }
- }
-
- GetSelEngine().Command( rCEvt );
-}
-
-sal_Bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, EditView* pView )
-{
- GetSelEngine().SetCurView( pView );
- GetSelEngine().SelMouseButtonUp( rMEvt );
- bInSelection = sal_False;
- // Special treatments
- EditSelection aCurSel( pView->pImpEditView->GetEditSelection() );
- if ( !aCurSel.HasRange() )
- {
- if ( ( rMEvt.GetClicks() == 1 ) && rMEvt.IsLeft() && !rMEvt.IsMod2() )
- {
- const SvxFieldItem* pFld = pView->GetFieldUnderMousePointer();
- if ( pFld )
- {
- EditPaM aPaM( aCurSel.Max() );
- sal_uInt16 nPara = GetEditDoc().GetPos( aPaM.GetNode() );
- GetEditEnginePtr()->FieldClicked( *pFld, nPara, aPaM.GetIndex() );
- }
- }
- }
- return sal_True;
-}
-
-sal_Bool ImpEditEngine::MouseMove( const MouseEvent& rMEvt, EditView* pView )
-{
- // MouseMove is called directly after ShowQuickHelp()!
- GetSelEngine().SetCurView( pView );
- GetSelEngine().SelMouseMove( rMEvt );
- return sal_True;
-}
-
-EditPaM ImpEditEngine::InsertText( EditSelection aSel, const XubString& rStr )
-{
- EditPaM aPaM = ImpInsertText( aSel, rStr );
- return aPaM;
-}
-
-EditPaM ImpEditEngine::Clear()
-{
- InitDoc( sal_False );
-
- EditPaM aPaM = aEditDoc.GetStartPaM();
- EditSelection aSel( aPaM );
-
- nCurTextHeight = 0;
- nCurTextHeightNTP = 0;
-
- ResetUndoManager();
-
- for ( sal_uInt16 nView = aEditViews.Count(); nView; )
- {
- EditView* pView = aEditViews[--nView];
- DBG_CHKOBJ( pView, EditView, 0 );
- pView->pImpEditView->SetEditSelection( aSel );
- }
-
- return aPaM;
-}
-
-EditPaM ImpEditEngine::RemoveText()
-{
- InitDoc( sal_True );
-
- EditPaM aStartPaM = aEditDoc.GetStartPaM();
- EditSelection aEmptySel( aStartPaM, aStartPaM );
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
- {
- EditView* pView = aEditViews.GetObject(nView);
- DBG_CHKOBJ( pView, EditView, 0 );
- pView->pImpEditView->SetEditSelection( aEmptySel );
- }
- ResetUndoManager();
- return aEditDoc.GetStartPaM();
-}
-
-
-void ImpEditEngine::SetText( const XubString& rText )
-{
- // RemoveText deletes the undo list!
- EditPaM aStartPaM = RemoveText();
- sal_Bool bUndoCurrentlyEnabled = IsUndoEnabled();
- // The text inserted manually can not be made reversable by the user
- EnableUndo( sal_False );
-
- EditSelection aEmptySel( aStartPaM, aStartPaM );
- EditPaM aPaM = aStartPaM;
- if ( rText.Len() )
- aPaM = ImpInsertText( aEmptySel, rText );
-
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
- {
- EditView* pView = aEditViews[nView];
- DBG_CHKOBJ( pView, EditView, 0 );
- pView->pImpEditView->SetEditSelection( EditSelection( aPaM, aPaM ) );
- // If no text then also no Format&Update
- // => The text remains.
- if ( !rText.Len() && GetUpdateMode() )
- {
- Rectangle aTmpRec( pView->GetOutputArea().TopLeft(),
- Size( aPaperSize.Width(), nCurTextHeight ) );
- aTmpRec.Intersection( pView->GetOutputArea() );
- pView->GetWindow()->Invalidate( aTmpRec );
- }
- }
- if( !rText.Len() ) { // otherwise it must be invalidated later, !bFormatted is enough.
- nCurTextHeight = 0;
- nCurTextHeightNTP = 0;
- }
- EnableUndo( bUndoCurrentlyEnabled );
- OSL_ENSURE( !HasUndoManager() || !GetUndoManager().GetUndoActionCount(), "Undo after SetText?" );
-}
-
-
-const SfxItemSet& ImpEditEngine::GetEmptyItemSet()
-{
- if ( !pEmptyItemSet )
- {
- pEmptyItemSet = new SfxItemSet( aEditDoc.GetItemPool(), EE_ITEMS_START, EE_ITEMS_END );
- for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++)
- {
- pEmptyItemSet->ClearItem( nWhich );
- }
- }
- return *pEmptyItemSet;
-}
-
-// ----------------------------------------------------------------------
-// MISC
-// ----------------------------------------------------------------------
-void ImpEditEngine::CursorMoved( ContentNode* pPrevNode )
-{
- // Delete empty attributes, but only if paragraph is not empty!
- if ( pPrevNode->GetCharAttribs().HasEmptyAttribs() && pPrevNode->Len() )
- pPrevNode->GetCharAttribs().DeleteEmptyAttribs( aEditDoc.GetItemPool() );
-}
-
-void ImpEditEngine::TextModified()
-{
- bFormatted = sal_False;
-
- if ( GetNotifyHdl().IsSet() )
- {
- EENotify aNotify( EE_NOTIFY_TEXTMODIFIED );
- aNotify.pEditEngine = GetEditEnginePtr();
- CallNotify( aNotify );
- }
-}
-
-
-void ImpEditEngine::ParaAttribsChanged( ContentNode* pNode )
-{
- OSL_ENSURE( pNode, "ParaAttribsChanged: Which one?" );
-
- aEditDoc.SetModified( sal_True );
- bFormatted = sal_False;
-
- ParaPortion* pPortion = FindParaPortion( pNode );
- 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 );
- // => is formatted again anyway, if Invalid.
- if ( pNextPortion && !pNextPortion->IsInvalid() )
- CalcHeight( pNextPortion );
-}
-
-// ----------------------------------------------------------------------
-// Cursor movements
-// ----------------------------------------------------------------------
-
-EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pEditView )
-{
- // Actually, only necessary for up/down, but whatever.
- CheckIdleFormatter();
-
- EditPaM aPaM( pEditView->pImpEditView->GetEditSelection().Max() );
-
- EditPaM aOldPaM( aPaM );
-
- TextDirectionality eTextDirection = TextDirectionality_LeftToRight_TopToBottom;
- if ( IsVertical() )
- eTextDirection = TextDirectionality_TopToBottom_RightToLeft;
- else if ( IsRightToLeft( GetEditDoc().GetPos( aPaM.GetNode() ) ) )
- eTextDirection = TextDirectionality_RightToLeft_TopToBottom;
-
- KeyEvent aTranslatedKeyEvent = rKeyEvent.LogicalTextDirectionality( eTextDirection );
-
- sal_Bool bCtrl = aTranslatedKeyEvent.GetKeyCode().IsMod1() ? sal_True : sal_False;
- sal_uInt16 nCode = aTranslatedKeyEvent.GetKeyCode().GetCode();
-
- if ( DoVisualCursorTraveling( aPaM.GetNode() ) )
- {
- // Only for simple cursor movement...
- if ( !bCtrl && ( ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) ) )
- {
- aPaM = CursorVisualLeftRight( pEditView, aPaM, rKeyEvent.GetKeyCode().IsMod2() ? i18n::CharacterIteratorMode::SKIPCHARACTER : i18n::CharacterIteratorMode::SKIPCELL, rKeyEvent.GetKeyCode().GetCode() == KEY_LEFT );
- nCode = 0; // skip switch statement
- }
- }
-
- bool bKeyModifySelection = aTranslatedKeyEvent.GetKeyCode().IsShift();
- switch ( nCode )
- {
- case KEY_UP: aPaM = CursorUp( aPaM, pEditView );
- break;
- case KEY_DOWN: aPaM = CursorDown( aPaM, pEditView );
- break;
- case KEY_LEFT: aPaM = bCtrl ? WordLeft( aPaM ) : CursorLeft( aPaM, aTranslatedKeyEvent.GetKeyCode().IsMod2() ? i18n::CharacterIteratorMode::SKIPCHARACTER : i18n::CharacterIteratorMode::SKIPCELL );
- break;
- case KEY_RIGHT: aPaM = bCtrl ? WordRight( aPaM ) : CursorRight( aPaM, aTranslatedKeyEvent.GetKeyCode().IsMod2() ? i18n::CharacterIteratorMode::SKIPCHARACTER : i18n::CharacterIteratorMode::SKIPCELL );
- break;
- case KEY_HOME: aPaM = bCtrl ? CursorStartOfDoc() : CursorStartOfLine( aPaM );
- break;
- case KEY_END: aPaM = bCtrl ? CursorEndOfDoc() : CursorEndOfLine( aPaM );
- break;
- case KEY_PAGEUP: aPaM = bCtrl ? CursorStartOfDoc() : PageUp( aPaM, pEditView );
- break;
- case KEY_PAGEDOWN: aPaM = bCtrl ? CursorEndOfDoc() : PageDown( aPaM, pEditView );
- break;
- case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE:
- aPaM = CursorStartOfLine( aPaM );
- bKeyModifySelection = false;
- break;
- case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE:
- aPaM = CursorEndOfLine( aPaM );
- bKeyModifySelection = false;
- break;
- case com::sun::star::awt::Key::MOVE_WORD_BACKWARD:
- aPaM = WordLeft( aPaM );
- bKeyModifySelection = false;
- break;
- case com::sun::star::awt::Key::MOVE_WORD_FORWARD:
- aPaM = WordRight( aPaM );
- bKeyModifySelection = false;
- break;
- case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH:
- aPaM = CursorStartOfParagraph( aPaM );
- if( aPaM == aOldPaM )
- {
- aPaM = CursorLeft( aPaM, i18n::CharacterIteratorMode::SKIPCELL );
- aPaM = CursorStartOfParagraph( aPaM );
- }
- bKeyModifySelection = false;
- break;
- case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH:
- aPaM = CursorEndOfParagraph( aPaM );
- if( aPaM == aOldPaM )
- {
- aPaM = CursorRight( aPaM, i18n::CharacterIteratorMode::SKIPCELL );
- aPaM = CursorEndOfParagraph( aPaM );
- }
- bKeyModifySelection = false;
- break;
- case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT:
- aPaM = CursorStartOfDoc();
- bKeyModifySelection = false;
- break;
- case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT:
- aPaM = CursorEndOfDoc();
- bKeyModifySelection = false;
- break;
- case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE:
- aPaM = CursorStartOfLine( aPaM );
- bKeyModifySelection = true;
- break;
- case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE:
- aPaM = CursorEndOfLine( aPaM );
- bKeyModifySelection = true;
- break;
- case com::sun::star::awt::Key::SELECT_BACKWARD:
- aPaM = CursorLeft( aPaM, i18n::CharacterIteratorMode::SKIPCELL );
- bKeyModifySelection = true;
- break;
- case com::sun::star::awt::Key::SELECT_FORWARD:
- aPaM = CursorRight( aPaM, i18n::CharacterIteratorMode::SKIPCELL );
- bKeyModifySelection = true;
- break;
- case com::sun::star::awt::Key::SELECT_WORD_BACKWARD:
- aPaM = WordLeft( aPaM );
- bKeyModifySelection = true;
- break;
- case com::sun::star::awt::Key::SELECT_WORD_FORWARD:
- aPaM = WordRight( aPaM );
- bKeyModifySelection = true;
- break;
- case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH:
- aPaM = CursorStartOfParagraph( aPaM );
- if( aPaM == aOldPaM )
- {
- aPaM = CursorLeft( aPaM, i18n::CharacterIteratorMode::SKIPCELL );
- aPaM = CursorStartOfParagraph( aPaM );
- }
- bKeyModifySelection = true;
- break;
- case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH:
- aPaM = CursorEndOfParagraph( aPaM );
- if( aPaM == aOldPaM )
- {
- aPaM = CursorRight( aPaM, i18n::CharacterIteratorMode::SKIPCELL );
- aPaM = CursorEndOfParagraph( aPaM );
- }
- bKeyModifySelection = true;
- break;
- case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT:
- aPaM = CursorStartOfDoc();
- bKeyModifySelection = true;
- break;
- case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT:
- aPaM = CursorEndOfDoc();
- bKeyModifySelection = true;
- break;
- }
-
- if ( aOldPaM != aPaM )
- {
- CursorMoved( aOldPaM.GetNode() );
- if ( aStatus.NotifyCursorMovements() && ( aOldPaM.GetNode() != aPaM.GetNode() ) )
- {
- aStatus.GetStatusWord() = aStatus.GetStatusWord() | EE_STAT_CRSRLEFTPARA;
- aStatus.GetPrevParagraph() = aEditDoc.GetPos( aOldPaM.GetNode() );
- }
- }
- else
- aStatus.GetStatusWord() = aStatus.GetStatusWord() | EE_STAT_CRSRMOVEFAIL;
-
- // 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 )
- {
- // Then the selection is expanded ...
- EditSelection aTmpNewSel( aOldEnd, aPaM );
- pEditView->pImpEditView->DrawSelection( aTmpNewSel );
- }
- else
- pEditView->pImpEditView->GetEditSelection().Min() = aPaM;
-
- return pEditView->pImpEditView->GetEditSelection();
-}
-
-EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& rPaM, sal_Bool bStart )
-{
- EditPaM aPaM( rPaM );
-
- sal_uInt16 nPara = GetEditDoc().GetPos( aPaM.GetNode() );
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
-
- sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_False );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
- sal_Bool bEmptyLine = pLine->GetStart() == pLine->GetEnd();
-
- pEditView->pImpEditView->nExtraCursorFlags = 0;
-
- if ( !bEmptyLine )
- {
- String aLine( *aPaM.GetNode(), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart() );
-
- const sal_Unicode* pLineString = aLine.GetBuffer();
-
- UErrorCode nError = U_ZERO_ERROR;
- UBiDi* pBidi = ubidi_openSized( aLine.Len(), 0, &nError );
-
- const UBiDiLevel nBidiLevel = IsRightToLeft( nPara ) ? 1 /*RTL*/ : 0 /*LTR*/;
- ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(pLineString), aLine.Len(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW
-
- sal_uInt16 nVisPos = bStart ? 0 : aLine.Len()-1;
- sal_uInt16 nLogPos = (sal_uInt16)ubidi_getLogicalIndex( pBidi, nVisPos, &nError );
-
- ubidi_close( pBidi );
-
- aPaM.GetIndex() = nLogPos + pLine->GetStart();
-
- sal_uInt16 nTmp;
- sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTmp, sal_True );
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
- sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft();
- sal_Bool bPortionRTL = (nRTLLevel%2) ? sal_True : sal_False;
-
- if ( bStart )
- {
- pEditView->pImpEditView->SetCursorBidiLevel( bPortionRTL ? 0 : 1 );
- // Maybe we must be *behind* the character
- if ( bPortionRTL && pEditView->IsInsertMode() )
- aPaM.GetIndex()++;
- }
- else
- {
- pEditView->pImpEditView->SetCursorBidiLevel( bPortionRTL ? 1 : 0 );
- if ( !bPortionRTL && pEditView->IsInsertMode() )
- aPaM.GetIndex()++;
- }
- }
-
- return aPaM;
-}
-
-EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode, sal_Bool bVisualToLeft )
-{
- EditPaM aPaM( rPaM );
-
- sal_uInt16 nPara = GetEditDoc().GetPos( aPaM.GetNode() );
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
-
- sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), sal_False );
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
- sal_Bool bEmptyLine = pLine->GetStart() == pLine->GetEnd();
-
- pEditView->pImpEditView->nExtraCursorFlags = 0;
-
- sal_Bool bParaRTL = IsRightToLeft( nPara );
-
- sal_Bool bDone = sal_False;
-
- if ( bEmptyLine )
- {
- if ( bVisualToLeft )
- {
- aPaM = CursorUp( aPaM, pEditView );
- if ( aPaM != rPaM )
- aPaM = CursorVisualStartEnd( pEditView, aPaM, sal_False );
- }
- else
- {
- aPaM = CursorDown( aPaM, pEditView );
- if ( aPaM != rPaM )
- aPaM = CursorVisualStartEnd( pEditView, aPaM, sal_True );
- }
-
- bDone = sal_True;
- }
-
- sal_Bool bLogicalBackward = bParaRTL ? !bVisualToLeft : bVisualToLeft;
-
- if ( !bDone && pEditView->IsInsertMode() )
- {
- // Check if we are within a portion and don't have overwrite mode, then it's easy...
- sal_uInt16 nPortionStart;
- sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, sal_False );
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
-
- sal_Bool bPortionBoundary = ( aPaM.GetIndex() == nPortionStart ) || ( aPaM.GetIndex() == (nPortionStart+pTextPortion->GetLen()) );
- sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft();
-
- // Portion boundary doesn't matter if both have same RTL level
- sal_uInt16 nRTLLevelNextPortion = 0xFFFF;
- if ( bPortionBoundary && aPaM.GetIndex() && ( aPaM.GetIndex() < aPaM.GetNode()->Len() ) )
- {
- sal_uInt16 nTmp;
- sal_uInt16 nNextTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex()+1, nTmp, bLogicalBackward ? sal_False : sal_True );
- TextPortion* pNextTextPortion = pParaPortion->GetTextPortions().GetObject( nNextTextPortion );
- nRTLLevelNextPortion = pNextTextPortion->GetRightToLeft();
- }
-
- if ( !bPortionBoundary || ( nRTLLevel == nRTLLevelNextPortion ) )
- {
- if ( ( bVisualToLeft && !(nRTLLevel%2) ) || ( !bVisualToLeft && (nRTLLevel%2) ) )
- {
- aPaM = CursorLeft( aPaM, nCharacterIteratorMode );
- pEditView->pImpEditView->SetCursorBidiLevel( 1 );
- }
- else
- {
- aPaM = CursorRight( aPaM, nCharacterIteratorMode );
- pEditView->pImpEditView->SetCursorBidiLevel( 0 );
- }
- bDone = sal_True;
- }
- }
-
- if ( !bDone )
- {
- sal_Bool bGotoStartOfNextLine = sal_False;
- sal_Bool bGotoEndOfPrevLine = sal_False;
-
- String aLine( *aPaM.GetNode(), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart() );
- sal_uInt16 nPosInLine = aPaM.GetIndex() - pLine->GetStart();
-
- const sal_Unicode* pLineString = aLine.GetBuffer();
-
- UErrorCode nError = U_ZERO_ERROR;
- UBiDi* pBidi = ubidi_openSized( aLine.Len(), 0, &nError );
-
- const UBiDiLevel nBidiLevel = IsRightToLeft( nPara ) ? 1 /*RTL*/ : 0 /*LTR*/;
- ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(pLineString), aLine.Len(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW
-
- if ( !pEditView->IsInsertMode() )
- {
- sal_Bool bEndOfLine = nPosInLine == aLine.Len();
- sal_uInt16 nVisPos = (sal_uInt16)ubidi_getVisualIndex( pBidi, !bEndOfLine ? nPosInLine : nPosInLine-1, &nError );
- if ( bVisualToLeft )
- {
- bGotoEndOfPrevLine = nVisPos == 0;
- if ( !bEndOfLine )
- nVisPos--;
- }
- else
- {
- bGotoStartOfNextLine = nVisPos == (aLine.Len() - 1);
- if ( !bEndOfLine )
- nVisPos++;
- }
-
- if ( !bGotoEndOfPrevLine && !bGotoStartOfNextLine )
- {
- sal_uInt16 nLogPos = (sal_uInt16)ubidi_getLogicalIndex( pBidi, nVisPos, &nError );
- aPaM.GetIndex() = pLine->GetStart() + nLogPos;
- pEditView->pImpEditView->SetCursorBidiLevel( 0 );
- }
- }
- else
- {
- sal_Bool bWasBehind = sal_False;
- sal_Bool bBeforePortion = !nPosInLine || pEditView->pImpEditView->GetCursorBidiLevel() == 1;
- if ( nPosInLine && ( !bBeforePortion ) ) // before the next portion
- bWasBehind = sal_True; // step one back, otherwise visual will be unusable when rtl portion follows.
-
- sal_uInt16 nPortionStart;
- sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, bBeforePortion );
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
- sal_Bool bRTLPortion = (pTextPortion->GetRightToLeft() % 2) != 0;
-
- // -1: We are 'behind' the character
- long nVisPos = (long)ubidi_getVisualIndex( pBidi, bWasBehind ? nPosInLine-1 : nPosInLine, &nError );
- if ( bVisualToLeft )
- {
- if ( !bWasBehind || bRTLPortion )
- nVisPos--;
- }
- else
- {
- if ( bWasBehind || bRTLPortion || bBeforePortion )
- nVisPos++;
- }
-
- bGotoEndOfPrevLine = nVisPos < 0;
- bGotoStartOfNextLine = nVisPos >= aLine.Len();
-
- if ( !bGotoEndOfPrevLine && !bGotoStartOfNextLine )
- {
- sal_uInt16 nLogPos = (sal_uInt16)ubidi_getLogicalIndex( pBidi, nVisPos, &nError );
-
- 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 );
- }
- }
-
- ubidi_close( pBidi );
-
- if ( bGotoEndOfPrevLine )
- {
- aPaM = CursorUp( aPaM, pEditView );
- if ( aPaM != rPaM )
- aPaM = CursorVisualStartEnd( pEditView, aPaM, sal_False );
- }
- else if ( bGotoStartOfNextLine )
- {
- aPaM = CursorDown( aPaM, pEditView );
- if ( aPaM != rPaM )
- aPaM = CursorVisualStartEnd( pEditView, aPaM, sal_True );
- }
- }
- return aPaM;
-}
-
-
-EditPaM ImpEditEngine::CursorLeft( const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode )
-{
- EditPaM aCurPaM( rPaM );
- EditPaM aNewPaM( aCurPaM );
-
- if ( aCurPaM.GetIndex() )
- {
- sal_Int32 nCount = 1;
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- aNewPaM.SetIndex( (sal_uInt16)_xBI->previousCharacters( *aNewPaM.GetNode(), aNewPaM.GetIndex(), GetLocale( aNewPaM ), nCharacterIteratorMode, nCount, nCount ) );
- }
- else
- {
- ContentNode* pNode = aCurPaM.GetNode();
- pNode = GetPrevVisNode( pNode );
- if ( pNode )
- {
- aNewPaM.SetNode( pNode );
- aNewPaM.SetIndex( pNode->Len() );
- }
- }
-
- return aNewPaM;
-}
-
-EditPaM ImpEditEngine::CursorRight( const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode )
-{
- EditPaM aCurPaM( rPaM );
- EditPaM aNewPaM( aCurPaM );
-
- if ( aCurPaM.GetIndex() < aCurPaM.GetNode()->Len() )
- {
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- sal_Int32 nCount = 1;
- aNewPaM.SetIndex( (sal_uInt16)_xBI->nextCharacters( *aNewPaM.GetNode(), aNewPaM.GetIndex(), GetLocale( aNewPaM ), nCharacterIteratorMode, nCount, nCount ) );
- }
- else
- {
- ContentNode* pNode = aCurPaM.GetNode();
- pNode = GetNextVisNode( pNode );
- if ( pNode )
- {
- aNewPaM.SetNode( pNode );
- aNewPaM.SetIndex( 0 );
- }
- }
-
- return aNewPaM;
-}
-
-EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView )
-{
- OSL_ENSURE( pView, "No View - No Cursor Movement!" );
-
- ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() );
- OSL_ENSURE( pPPortion, "No matching portion found: CursorUp ");
- sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() );
- EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
-
- long nX;
- if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW )
- {
- nX = GetXPos( pPPortion, pLine, rPaM.GetIndex() );
- pView->pImpEditView->nTravelXPos = nX+nOnePixelInRef;
- }
- else
- nX = pView->pImpEditView->nTravelXPos;
-
- EditPaM aNewPaM( rPaM );
- if ( nLine ) // same paragraph
- {
- EditLine* pPrevLine = pPPortion->GetLines().GetObject(nLine-1);
- aNewPaM.SetIndex( GetChar( pPPortion, pPrevLine, nX ) );
- // 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 // previous paragraph
- {
- ParaPortion* pPrevPortion = GetPrevVisPortion( pPPortion );
- if ( pPrevPortion )
- {
- pLine = pPrevPortion->GetLines().GetObject( pPrevPortion->GetLines().Count()-1 );
- OSL_ENSURE( pLine, "Line in front not found: CursorUp" );
- aNewPaM.SetNode( pPrevPortion->GetNode() );
- aNewPaM.SetIndex( GetChar( pPrevPortion, pLine, nX+nOnePixelInRef ) );
- }
- }
-
- return aNewPaM;
-}
-
-EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView )
-{
- OSL_ENSURE( pView, "No View - No Cursor Movement!" );
-
- ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() );
- OSL_ENSURE( pPPortion, "No matching portion found: CursorDown" );
- sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() );
-
- long nX;
- if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW )
- {
- EditLine* pLine = pPPortion->GetLines().GetObject(nLine);
- nX = GetXPos( pPPortion, pLine, rPaM.GetIndex() );
- pView->pImpEditView->nTravelXPos = nX+nOnePixelInRef;
- }
- else
- nX = pView->pImpEditView->nTravelXPos;
-
- EditPaM aNewPaM( rPaM );
- if ( nLine < pPPortion->GetLines().Count()-1 )
- {
- EditLine* pNextLine = pPPortion->GetLines().GetObject(nLine+1);
- aNewPaM.SetIndex( GetChar( pPPortion, pNextLine, nX ) );
- // Special treatment, see CursorUp ...
- if ( ( aNewPaM.GetIndex() == pNextLine->GetEnd() ) && ( aNewPaM.GetIndex() > pNextLine->GetStart() ) && ( aNewPaM.GetIndex() < pPPortion->GetNode()->Len() ) )
- aNewPaM = CursorLeft( aNewPaM );
- }
- else // next paragraph
- {
- ParaPortion* pNextPortion = GetNextVisPortion( pPPortion );
- if ( pNextPortion )
- {
- EditLine* pLine = pNextPortion->GetLines().GetObject(0);
- OSL_ENSURE( pLine, "Line in front not found: CursorUp" );
- aNewPaM.SetNode( pNextPortion->GetNode() );
- // 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 );
- }
- }
-
- return aNewPaM;
-}
-
-EditPaM ImpEditEngine::CursorStartOfLine( const EditPaM& rPaM )
-{
- ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() );
- OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" );
- sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() );
- EditLine* pLine = pCurPortion->GetLines().GetObject(nLine);
- OSL_ENSURE( pLine, "Current line not found ?!" );
-
- EditPaM aNewPaM( rPaM );
- aNewPaM.SetIndex( pLine->GetStart() );
- return aNewPaM;
-}
-
-EditPaM ImpEditEngine::CursorEndOfLine( const EditPaM& rPaM )
-{
- ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() );
- OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" );
- sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() );
- EditLine* pLine = pCurPortion->GetLines().GetObject(nLine);
- OSL_ENSURE( pLine, "Current line not found ?!" );
-
- EditPaM aNewPaM( rPaM );
- aNewPaM.SetIndex( pLine->GetEnd() );
- if ( pLine->GetEnd() > pLine->GetStart() )
- {
- if ( aNewPaM.GetNode()->IsFeature( aNewPaM.GetIndex() - 1 ) )
- {
- // 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() ) )
- {
- // 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 );
- }
- }
- return aNewPaM;
-}
-
-EditPaM ImpEditEngine::CursorStartOfParagraph( const EditPaM& rPaM )
-{
- EditPaM aPaM( rPaM.GetNode(), 0 );
- return aPaM;
-}
-
-EditPaM ImpEditEngine::CursorEndOfParagraph( const EditPaM& rPaM )
-{
- EditPaM aPaM( rPaM.GetNode(), rPaM.GetNode()->Len() );
- return aPaM;
-}
-
-EditPaM ImpEditEngine::CursorStartOfDoc()
-{
- EditPaM aPaM( aEditDoc.SaveGetObject( 0 ), 0 );
- return aPaM;
-}
-
-EditPaM ImpEditEngine::CursorEndOfDoc()
-{
- ContentNode* pLastNode = aEditDoc.SaveGetObject( aEditDoc.Count()-1 );
- ParaPortion* pLastPortion = GetParaPortions().SaveGetObject( aEditDoc.Count()-1 );
- OSL_ENSURE( pLastNode && pLastPortion, "CursorEndOfDoc: Node or Portion not found" );
-
- if ( !pLastPortion->IsVisible() )
- {
- pLastNode = GetPrevVisNode( pLastPortion->GetNode() );
- OSL_ENSURE( pLastNode, "Kein sichtbarer Absatz?" );
- if ( !pLastNode )
- pLastNode = aEditDoc.SaveGetObject( aEditDoc.Count()-1 );
- }
-
- EditPaM aPaM( pLastNode, pLastNode->Len() );
- return aPaM;
-}
-
-EditPaM ImpEditEngine::PageUp( const EditPaM& rPaM, EditView* pView )
-{
- Rectangle aRec = PaMtoEditCursor( rPaM );
- Point aTopLeft = aRec.TopLeft();
- aTopLeft.Y() -= pView->GetVisArea().GetHeight() *9/10;
- aTopLeft.X() += nOnePixelInRef;
- if ( aTopLeft.Y() < 0 )
- {
- aTopLeft.Y() = 0;
- }
- return GetPaM( aTopLeft );
-}
-
-EditPaM ImpEditEngine::PageDown( const EditPaM& rPaM, EditView* pView )
-{
- Rectangle aRec = PaMtoEditCursor( rPaM );
- Point aBottomRight = aRec.BottomRight();
- aBottomRight.Y() += pView->GetVisArea().GetHeight() *9/10;
- aBottomRight.X() += nOnePixelInRef;
- long nHeight = GetTextHeight();
- if ( aBottomRight.Y() > nHeight )
- {
- aBottomRight.Y() = nHeight-2;
- }
- return GetPaM( aBottomRight );
-}
-
-EditPaM ImpEditEngine::WordLeft( const EditPaM& rPaM, sal_Int16 nWordType )
-{
- sal_uInt16 nCurrentPos = rPaM.GetIndex();
- EditPaM aNewPaM( rPaM );
- if ( nCurrentPos == 0 )
- {
- // Previous paragraph...
- sal_uInt16 nCurPara = aEditDoc.GetPos( aNewPaM.GetNode() );
- ContentNode* pPrevNode = aEditDoc.SaveGetObject( --nCurPara );
- if ( pPrevNode )
- {
- aNewPaM.SetNode( pPrevNode );
- aNewPaM.SetIndex( pPrevNode->Len() );
- }
- }
- else
- {
- // we need to increase the position by 1 when retrieving the locale
- // since the attribute for the char left to the cursor position is returned
- EditPaM aTmpPaM( aNewPaM );
- xub_StrLen nMax = rPaM.GetNode()->Len();
- if ( aTmpPaM.GetIndex() < nMax )
- aTmpPaM.SetIndex( aTmpPaM.GetIndex() + 1 );
- lang::Locale aLocale( GetLocale( aTmpPaM ) );
-
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- i18n::Boundary aBoundary = _xBI->getWordBoundary( *aNewPaM.GetNode(), nCurrentPos, aLocale, nWordType, sal_True );
- if ( aBoundary.startPos >= nCurrentPos )
- aBoundary = _xBI->previousWord( *aNewPaM.GetNode(), nCurrentPos, aLocale, nWordType );
- aNewPaM.SetIndex( ( aBoundary.startPos != (-1) ) ? (sal_uInt16)aBoundary.startPos : 0 );
- }
-
- return aNewPaM;
-}
-
-EditPaM ImpEditEngine::WordRight( const EditPaM& rPaM, sal_Int16 nWordType )
-{
- xub_StrLen nMax = rPaM.GetNode()->Len();
- EditPaM aNewPaM( rPaM );
- if ( aNewPaM.GetIndex() < nMax )
- {
- // we need to increase the position by 1 when retrieving the locale
- // since the attribute for the char left to the cursor position is returned
- EditPaM aTmpPaM( aNewPaM );
- aTmpPaM.SetIndex( aTmpPaM.GetIndex() + 1 );
- lang::Locale aLocale( GetLocale( aTmpPaM ) );
-
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- i18n::Boundary aBoundary = _xBI->nextWord( *aNewPaM.GetNode(), aNewPaM.GetIndex(), aLocale, nWordType );
- aNewPaM.SetIndex( (sal_uInt16)aBoundary.startPos );
- }
- // not 'else', maybe the index reached nMax now...
- if ( aNewPaM.GetIndex() >= nMax )
- {
- // Next paragraph ...
- sal_uInt16 nCurPara = aEditDoc.GetPos( aNewPaM.GetNode() );
- ContentNode* pNextNode = aEditDoc.SaveGetObject( ++nCurPara );
- if ( pNextNode )
- {
- aNewPaM.SetNode( pNextNode );
- aNewPaM.SetIndex( 0 );
- }
- }
- return aNewPaM;
-}
-
-EditPaM ImpEditEngine::StartOfWord( const EditPaM& rPaM, sal_Int16 nWordType )
-{
- EditPaM aNewPaM( rPaM );
-
- // we need to increase the position by 1 when retrieving the locale
- // since the attribute for the char left to the cursor position is returned
- EditPaM aTmpPaM( aNewPaM );
- xub_StrLen nMax = rPaM.GetNode()->Len();
- if ( aTmpPaM.GetIndex() < nMax )
- aTmpPaM.SetIndex( aTmpPaM.GetIndex() + 1 );
- lang::Locale aLocale( GetLocale( aTmpPaM ) );
-
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- i18n::Boundary aBoundary = _xBI->getWordBoundary( *rPaM.GetNode(), rPaM.GetIndex(), aLocale, nWordType, sal_True );
- aNewPaM.SetIndex( (sal_uInt16)aBoundary.startPos );
- return aNewPaM;
-}
-
-EditPaM ImpEditEngine::EndOfWord( const EditPaM& rPaM, sal_Int16 nWordType )
-{
- EditPaM aNewPaM( rPaM );
-
- // we need to increase the position by 1 when retrieving the locale
- // since the attribute for the char left to the cursor position is returned
- EditPaM aTmpPaM( aNewPaM );
- xub_StrLen nMax = rPaM.GetNode()->Len();
- if ( aTmpPaM.GetIndex() < nMax )
- aTmpPaM.SetIndex( aTmpPaM.GetIndex() + 1 );
- lang::Locale aLocale( GetLocale( aTmpPaM ) );
-
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- i18n::Boundary aBoundary = _xBI->getWordBoundary( *rPaM.GetNode(), rPaM.GetIndex(), aLocale, nWordType, sal_True );
- aNewPaM.SetIndex( (sal_uInt16)aBoundary.endPos );
- return aNewPaM;
-}
-
-EditSelection ImpEditEngine::SelectWord( const EditSelection& rCurSel, sal_Int16 nWordType, sal_Bool bAcceptStartOfWord )
-{
- EditSelection aNewSel( rCurSel );
- EditPaM aPaM( rCurSel.Max() );
-
- // we need to increase the position by 1 when retrieving the locale
- // since the attribute for the char left to the cursor position is returned
- EditPaM aTmpPaM( aPaM );
- xub_StrLen nMax = aPaM.GetNode()->Len();
- if ( aTmpPaM.GetIndex() < nMax )
- aTmpPaM.SetIndex( aTmpPaM.GetIndex() + 1 );
- lang::Locale aLocale( GetLocale( aTmpPaM ) );
-
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- sal_Int16 nType = _xBI->getWordType( *aPaM.GetNode(), aPaM.GetIndex(), aLocale );
- if ( nType == i18n::WordType::ANY_WORD )
- {
- i18n::Boundary aBoundary = _xBI->getWordBoundary( *aPaM.GetNode(), aPaM.GetIndex(), aLocale, nWordType, sal_True );
- // don't select when curser at end of word
- if ( ( aBoundary.endPos > aPaM.GetIndex() ) &&
- ( ( aBoundary.startPos < aPaM.GetIndex() ) || ( bAcceptStartOfWord && ( aBoundary.startPos == aPaM.GetIndex() ) ) ) )
- {
- aNewSel.Min().SetIndex( (sal_uInt16)aBoundary.startPos );
- aNewSel.Max().SetIndex( (sal_uInt16)aBoundary.endPos );
- }
- }
-
- return aNewSel;
-}
-
-EditSelection ImpEditEngine::SelectSentence( const EditSelection& rCurSel )
-{
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- const EditPaM& rPaM = rCurSel.Min();
- const ContentNode* pNode = rPaM.GetNode();
- // #i50710# line breaks are marked with 0x01 - the break iterator prefers 0x0a for that
- String sParagraph(*pNode);
- sParagraph.SearchAndReplaceAll(0x01,0x0a);
- //return Null if search starts at the beginning of the string
- sal_Int32 nStart = rPaM.GetIndex() ? _xBI->beginOfSentence( sParagraph, rPaM.GetIndex(), GetLocale( rPaM ) ) : 0;
-
- sal_Int32 nEnd = _xBI->endOfSentence( *pNode, rPaM.GetIndex(), GetLocale( rPaM ) );
- EditSelection aNewSel( rCurSel );
- OSL_ENSURE(pNode->Len() ? (nStart < pNode->Len()) : (nStart == 0), "sentence start index out of range");
- OSL_ENSURE(nEnd <= pNode->Len(), "sentence end index out of range");
- aNewSel.Min().SetIndex( (sal_uInt16)nStart );
- aNewSel.Max().SetIndex( (sal_uInt16)nEnd );
- return aNewSel;
-}
-
-sal_Bool ImpEditEngine::IsInputSequenceCheckingRequired( sal_Unicode nChar, const EditSelection& rCurSel ) const
-{
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- if (!pCTLOptions)
- pCTLOptions = new SvtCTLOptions;
-
- // get the index that really is first
- sal_uInt16 nFirstPos = rCurSel.Min().GetIndex();
- sal_uInt16 nMaxPos = rCurSel.Max().GetIndex();
- if (nMaxPos < nFirstPos)
- nFirstPos = nMaxPos;
-
- sal_Bool bIsSequenceChecking =
- pCTLOptions->IsCTLFontEnabled() &&
- pCTLOptions->IsCTLSequenceChecking() &&
- nFirstPos != 0 && /* first char needs not to be checked */
- _xBI.is() && i18n::ScriptType::COMPLEX == _xBI->getScriptType( rtl::OUString( nChar ), 0 );
-
- return bIsSequenceChecking;
-}
-
- bool lcl_HasStrongLTR ( const String& rTxt, xub_StrLen nStart, xub_StrLen nEnd )
- {
- for ( xub_StrLen nCharIdx = nStart; nCharIdx < nEnd; ++nCharIdx )
- {
- const UCharDirection nCharDir = u_charDirection ( rTxt.GetChar ( nCharIdx ));
- if ( nCharDir == U_LEFT_TO_RIGHT ||
- nCharDir == U_LEFT_TO_RIGHT_EMBEDDING ||
- nCharDir == U_LEFT_TO_RIGHT_OVERRIDE )
- return true;
- }
- return false;
- }
-
-
-
-void ImpEditEngine::InitScriptTypes( sal_uInt16 nPara )
-{
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
- ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
- rTypes.clear();
-
- ContentNode* pNode = pParaPortion->GetNode();
- if ( pNode->Len() )
- {
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
-
- String aText( *pNode );
-
- // To handle fields put the character from the field in the string,
- // because endOfScript( ... ) will skip the CH_FEATURE, because this is WEAK
- EditCharAttrib* pField = pNode->GetCharAttribs().FindNextAttrib( EE_FEATURE_FIELD, 0 );
- while ( pField )
- {
- ::rtl::OUString aFldText( ((EditCharAttribField*)pField)->GetFieldValue() );
- if ( aFldText.getLength() )
- {
- aText.SetChar( pField->GetStart(), aFldText.getStr()[0] );
- short nFldScriptType = _xBI->getScriptType( aFldText, 0 );
-
- for ( sal_uInt16 nCharInField = 1; nCharInField < aFldText.getLength(); nCharInField++ )
- {
- short nTmpType = _xBI->getScriptType( aFldText, nCharInField );
-
- // First char from field wins...
- if ( nFldScriptType == i18n::ScriptType::WEAK )
- {
- nFldScriptType = nTmpType;
- aText.SetChar( pField->GetStart(), aFldText.getStr()[nCharInField] );
- }
-
- // ... but if the first one is LATIN, and there are CJK or CTL chars too,
- // we prefer that ScripType because we need an other font.
- if ( ( nTmpType == i18n::ScriptType::ASIAN ) || ( nTmpType == i18n::ScriptType::COMPLEX ) )
- {
- aText.SetChar( pField->GetStart(), aFldText.getStr()[nCharInField] );
- break;
- }
- }
- }
- // #112831# Last Field might go from 0xffff to 0x0000
- pField = pField->GetEnd() ? pNode->GetCharAttribs().FindNextAttrib( EE_FEATURE_FIELD, pField->GetEnd() ) : NULL;
- }
-
- ::rtl::OUString aOUText( aText );
- sal_uInt16 nTextLen = (sal_uInt16)aOUText.getLength();
-
- sal_Int32 nPos = 0;
- short nScriptType = _xBI->getScriptType( aOUText, nPos );
- rTypes.push_back( ScriptTypePosInfo( nScriptType, (sal_uInt16)nPos, nTextLen ) );
- nPos = _xBI->endOfScript( aOUText, nPos, nScriptType );
- while ( ( nPos != (-1) ) && ( nPos < nTextLen ) )
- {
- rTypes.back().nEndPos = (sal_uInt16)nPos;
-
- nScriptType = _xBI->getScriptType( aOUText, nPos );
- long nEndPos = _xBI->endOfScript( aOUText, nPos, nScriptType );
-
- if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == rTypes.back().nScriptType ) )
- {
- // Expand last ScriptTypePosInfo, don't create weak or unecessary portions
- rTypes.back().nEndPos = (sal_uInt16)nEndPos;
- }
- else
- {
- if ( _xBI->getScriptType( aOUText, nPos - 1 ) == i18n::ScriptType::WEAK )
- {
- switch ( u_charType(aOUText.iterateCodePoints(&nPos, 0) ) ) {
- case U_NON_SPACING_MARK:
- case U_ENCLOSING_MARK:
- case U_COMBINING_SPACING_MARK:
- --nPos;
- rTypes.back().nEndPos--;
- break;
- }
- }
- rTypes.push_back( ScriptTypePosInfo( nScriptType, (sal_uInt16)nPos, nTextLen ) );
- }
-
- nPos = nEndPos;
- }
-
- if ( rTypes[0].nScriptType == i18n::ScriptType::WEAK )
- rTypes[0].nScriptType = ( rTypes.size() > 1 ) ? rTypes[1].nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() );
-
- // create writing direction information:
- if ( pParaPortion->aWritingDirectionInfos.empty() )
- InitWritingDirections( nPara );
-
- // i89825: Use CTL font for numbers embedded into an RTL run:
- WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos;
- for ( size_t n = 0; n < rDirInfos.size(); ++n )
- {
- const xub_StrLen nStart = rDirInfos[n].nStartPos;
- const xub_StrLen nEnd = rDirInfos[n].nEndPos;
- const sal_uInt8 nCurrDirType = rDirInfos[n].nType;
-
- if ( nCurrDirType % 2 == UBIDI_RTL || // text in RTL run
- ( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( aText, nStart, nEnd ) ) ) // non-strong text in embedded LTR run
- {
- size_t nIdx = 0;
-
- // Skip entries in ScriptArray which are not inside the RTL run:
- while ( nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart )
- ++nIdx;
-
- // Remove any entries *inside* the current run:
- while ( nIdx < rTypes.size() && rTypes[nIdx].nEndPos <= nEnd )
- rTypes.erase( rTypes.begin()+nIdx );
-
- // special case:
- if(nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart && rTypes[nIdx].nEndPos > nEnd)
- {
- rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( rTypes[nIdx].nScriptType, (sal_uInt16)nEnd, rTypes[nIdx].nEndPos ) );
- rTypes[nIdx].nEndPos = nStart;
- }
-
- if( nIdx )
- rTypes[nIdx - 1].nEndPos = nStart;
-
- rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( i18n::ScriptType::COMPLEX, (sal_uInt16)nStart, (sal_uInt16)nEnd) );
- ++nIdx;
-
- if( nIdx < rTypes.size() )
- rTypes[nIdx].nStartPos = nEnd;
- }
- }
- }
-}
-
-sal_uInt16 ImpEditEngine::GetScriptType( const EditPaM& rPaM, sal_uInt16* pEndPos ) const
-{
- sal_uInt16 nScriptType = 0;
-
- if ( pEndPos )
- *pEndPos = rPaM.GetNode()->Len();
-
- if ( rPaM.GetNode()->Len() )
- {
- sal_uInt16 nPara = GetEditDoc().GetPos( rPaM.GetNode() );
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
- if ( pParaPortion->aScriptInfos.empty() )
- ((ImpEditEngine*)this)->InitScriptTypes( nPara );
-
- ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
- sal_uInt16 nPos = rPaM.GetIndex();
- for ( size_t n = 0; n < rTypes.size(); n++ )
- {
- if ( ( rTypes[n].nStartPos <= nPos ) && ( rTypes[n].nEndPos >= nPos ) )
- {
- nScriptType = rTypes[n].nScriptType;
- if( pEndPos )
- *pEndPos = rTypes[n].nEndPos;
- break;
- }
- }
- }
- return nScriptType ? nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() );
-}
-
-sal_uInt16 ImpEditEngine::GetScriptType( const EditSelection& rSel ) const
-{
- EditSelection aSel( rSel );
- aSel.Adjust( aEditDoc );
-
- short nScriptType = 0;
-
- sal_uInt16 nStartPara = GetEditDoc().GetPos( aSel.Min().GetNode() );
- sal_uInt16 nEndPara = GetEditDoc().GetPos( aSel.Max().GetNode() );
-
- for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ )
- {
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
- if ( pParaPortion->aScriptInfos.empty() )
- ((ImpEditEngine*)this)->InitScriptTypes( nPara );
-
- ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
-
- // find the first(!) script type position that holds the
- // complete selection. Thus it will work for selections as
- // well as with just moving the cursor from char to char.
- sal_uInt16 nS = ( nPara == nStartPara ) ? aSel.Min().GetIndex() : 0;
- sal_uInt16 nE = ( nPara == nEndPara ) ? aSel.Max().GetIndex() : pParaPortion->GetNode()->Len();
- for ( size_t n = 0; n < rTypes.size(); n++ )
- {
- if (rTypes[n].nStartPos <= nS && nE <= rTypes[n].nEndPos)
- {
- if ( rTypes[n].nScriptType != i18n::ScriptType::WEAK )
- {
- nScriptType |= GetItemScriptType ( rTypes[n].nScriptType );
- }
- else
- {
- if ( !nScriptType && n )
- {
- // #93548# When starting with WEAK, use prev ScriptType...
- nScriptType = rTypes[n-1].nScriptType;
- }
- }
- break;
- }
- }
- }
- return nScriptType ? nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() );
-}
-
-sal_Bool ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const
-{
- sal_Bool bScriptChange = sal_False;
-
- if ( rPaM.GetNode()->Len() )
- {
- sal_uInt16 nPara = GetEditDoc().GetPos( rPaM.GetNode() );
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
- if ( pParaPortion->aScriptInfos.empty() )
- ((ImpEditEngine*)this)->InitScriptTypes( nPara );
-
- ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
- sal_uInt16 nPos = rPaM.GetIndex();
- for ( size_t n = 0; n < rTypes.size(); n++ )
- {
- if ( rTypes[n].nStartPos == nPos )
- {
- bScriptChange = sal_True;
- break;
- }
- }
- }
- return bScriptChange;
-}
-
-sal_Bool ImpEditEngine::HasScriptType( sal_uInt16 nPara, sal_uInt16 nType ) const
-{
- sal_Bool bTypeFound = sal_False;
-
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
- if ( pParaPortion->aScriptInfos.empty() )
- ((ImpEditEngine*)this)->InitScriptTypes( nPara );
-
- ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
- for ( size_t n = rTypes.size(); n && !bTypeFound; )
- {
- if ( rTypes[--n].nScriptType == nType )
- bTypeFound = sal_True;
- }
- return bTypeFound;
-}
-
-void ImpEditEngine::InitWritingDirections( sal_uInt16 nPara )
-{
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
- WritingDirectionInfos& rInfos = pParaPortion->aWritingDirectionInfos;
- rInfos.clear();
-
- sal_Bool bCTL = sal_False;
- ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
- for ( size_t n = 0; n < rTypes.size(); n++ )
- {
- if ( rTypes[n].nScriptType == i18n::ScriptType::COMPLEX )
- {
- bCTL = sal_True;
- break;
- }
- }
-
- const UBiDiLevel nBidiLevel = IsRightToLeft( nPara ) ? 1 /*RTL*/ : 0 /*LTR*/;
- if ( ( bCTL || ( nBidiLevel == 1 /*RTL*/ ) ) && pParaPortion->GetNode()->Len() )
- {
-
- String aText( *pParaPortion->GetNode() );
-
- //
- // Bidi functions from icu 2.0
- //
- UErrorCode nError = U_ZERO_ERROR;
- UBiDi* pBidi = ubidi_openSized( aText.Len(), 0, &nError );
- nError = U_ZERO_ERROR;
-
- ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.GetBuffer()), aText.Len(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW
- nError = U_ZERO_ERROR;
-
- size_t nCount = ubidi_countRuns( pBidi, &nError );
-
- int32_t nStart = 0;
- int32_t nEnd;
- UBiDiLevel nCurrDir;
-
- for ( size_t nIdx = 0; nIdx < nCount; ++nIdx )
- {
- ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir );
- rInfos.push_back( WritingDirectionInfo( nCurrDir, (sal_uInt16)nStart, (sal_uInt16)nEnd ) );
- nStart = nEnd;
- }
-
- ubidi_close( pBidi );
- }
-
- // No infos mean no CTL and default dir is L2R...
- if ( rInfos.empty() )
- rInfos.push_back( WritingDirectionInfo( 0, 0, (sal_uInt16)pParaPortion->GetNode()->Len() ) );
-
-}
-
-sal_Bool ImpEditEngine::IsRightToLeft( sal_uInt16 nPara ) const
-{
- sal_Bool bR2L = sal_False;
- const SvxFrameDirectionItem* pFrameDirItem = NULL;
-
- if ( !IsVertical() )
- {
- bR2L = GetDefaultHorizontalTextDirection() == EE_HTEXTDIR_R2L;
- pFrameDirItem = &(const SvxFrameDirectionItem&)GetParaAttrib( nPara, EE_PARA_WRITINGDIR );
- if ( pFrameDirItem->GetValue() == FRMDIR_ENVIRONMENT )
- {
- // #103045# if DefaultHorizontalTextDirection is set, use that value, otherwise pool default.
- if ( GetDefaultHorizontalTextDirection() != EE_HTEXTDIR_DEFAULT )
- {
- pFrameDirItem = NULL; // bR2L allready set to default horizontal text direction
- }
- else
- {
- // Use pool default
- pFrameDirItem = &(const SvxFrameDirectionItem&)((ImpEditEngine*)this)->GetEmptyItemSet().Get( EE_PARA_WRITINGDIR );
- }
- }
- }
-
- if ( pFrameDirItem )
- bR2L = pFrameDirItem->GetValue() == FRMDIR_HORI_RIGHT_TOP;
-
- return bR2L;
-}
-
-sal_Bool ImpEditEngine::HasDifferentRTLLevels( const ContentNode* pNode )
-{
- sal_uInt16 nPara = GetEditDoc().GetPos( (ContentNode*)pNode );
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
-
- sal_Bool bHasDifferentRTLLevels = sal_False;
-
- sal_uInt16 nRTLLevel = IsRightToLeft( nPara ) ? 1 : 0;
- for ( sal_uInt16 n = 0; n < pParaPortion->GetTextPortions().Count(); n++ )
- {
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject( n );
- if ( pTextPortion->GetRightToLeft() != nRTLLevel )
- {
- bHasDifferentRTLLevels = sal_True;
- break;
- }
- }
- return bHasDifferentRTLLevels;
-}
-
-
-sal_uInt8 ImpEditEngine::GetRightToLeft( sal_uInt16 nPara, sal_uInt16 nPos, sal_uInt16* pStart, sal_uInt16* pEnd )
-{
- sal_uInt8 nRightToLeft = 0;
-
- ContentNode* pNode = aEditDoc.SaveGetObject( nPara );
- if ( pNode && pNode->Len() )
- {
- ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara );
- if ( pParaPortion->aWritingDirectionInfos.empty() )
- InitWritingDirections( nPara );
-
- WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos;
- for ( size_t n = 0; n < rDirInfos.size(); n++ )
- {
- if ( ( rDirInfos[n].nStartPos <= nPos ) && ( rDirInfos[n].nEndPos >= nPos ) )
- {
- nRightToLeft = rDirInfos[n].nType;
- if ( pStart )
- *pStart = rDirInfos[n].nStartPos;
- if ( pEnd )
- *pEnd = rDirInfos[n].nEndPos;
- break;
- }
- }
- }
- return nRightToLeft;
-}
-
-SvxAdjust ImpEditEngine::GetJustification( sal_uInt16 nPara ) const
-{
- SvxAdjust eJustification = SVX_ADJUST_LEFT;
-
- if ( !aStatus.IsOutliner() )
- {
- eJustification = ((const SvxAdjustItem&) GetParaAttrib( nPara, EE_PARA_JUST )).GetAdjust();
-
- if ( IsRightToLeft( nPara ) )
- {
- if ( eJustification == SVX_ADJUST_LEFT )
- eJustification = SVX_ADJUST_RIGHT;
- else if ( eJustification == SVX_ADJUST_RIGHT )
- eJustification = SVX_ADJUST_LEFT;
- }
- }
- 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());
-}
-
-// ----------------------------------------------------------------------
-// Text changes
-// ----------------------------------------------------------------------
-
-void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, sal_uInt16 nChars, EditUndoRemoveChars* pCurUndo )
-{
- if ( IsUndoEnabled() && !IsInUndo() )
- {
- XubString aStr( rPaM.GetNode()->Copy( rPaM.GetIndex(), nChars ) );
-
- // Check whether attributes are deleted or changed:
- sal_uInt16 nStart = rPaM.GetIndex();
- sal_uInt16 nEnd = nStart + nChars;
- CharAttribArray& rAttribs = rPaM.GetNode()->GetCharAttribs().GetAttribs();
- for ( sal_uInt16 nAttr = 0; nAttr < rAttribs.Count(); nAttr++ )
- {
- EditCharAttrib* pAttr = rAttribs[nAttr];
- if ( ( pAttr->GetEnd() >= nStart ) && ( pAttr->GetStart() < nEnd ) )
- {
- EditSelection aSel( rPaM );
- aSel.Max().GetIndex() = aSel.Max().GetIndex() + nChars;
- EditUndoSetAttribs* pAttrUndo = CreateAttribUndo( aSel, GetEmptyItemSet() );
- InsertUndo( pAttrUndo );
- break; // for
- }
- }
- if ( pCurUndo && ( CreateEditPaM( pCurUndo->GetEPaM() ) == rPaM ) )
- pCurUndo->GetStr() += aStr;
- else
- InsertUndo( new EditUndoRemoveChars( this, CreateEPaM( rPaM ), aStr ) );
- }
-
- aEditDoc.RemoveChars( rPaM, nChars );
- TextModified();
-}
-
-EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16 nNewPos )
-{
- aOldPositions.Justify();
- sal_Bool bValidAction = ( (long)nNewPos < aOldPositions.Min() ) || ( (long)nNewPos > aOldPositions.Max() );
- OSL_ENSURE( bValidAction, "Move in itself?" );
- OSL_ENSURE( aOldPositions.Max() <= (long)GetParaPortions().Count(), "totally over it: MoveParagraphs" );
-
- EditSelection aSelection;
-
- if ( !bValidAction )
- {
- aSelection = aEditDoc.GetStartPaM();
- return aSelection;
- }
-
- sal_uLong nParaCount = GetParaPortions().Count();
-
- if ( nNewPos >= nParaCount )
- nNewPos = GetParaPortions().Count();
-
- // Height may change when moving first or last Paragraph
- ParaPortion* pRecalc1 = NULL;
- ParaPortion* pRecalc2 = NULL;
- ParaPortion* pRecalc3 = NULL;
- ParaPortion* pRecalc4 = NULL;
-
- if ( nNewPos == 0 ) // Move to Start
- {
- pRecalc1 = GetParaPortions().GetObject( 0 );
- pRecalc2 = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Min() );
-
- }
- else if ( nNewPos == nParaCount )
- {
- pRecalc1 = GetParaPortions().GetObject( (sal_uInt16)(nParaCount-1) );
- pRecalc2 = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Max() );
- }
-
- if ( aOldPositions.Min() == 0 ) // Move from Start
- {
- pRecalc3 = GetParaPortions().GetObject( 0 );
- pRecalc4 = GetParaPortions().GetObject(
- sal::static_int_cast< sal_uInt16 >( aOldPositions.Max()+1 ) );
- }
- else if ( (sal_uInt16)aOldPositions.Max() == (nParaCount-1) )
- {
- pRecalc3 = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Max() );
- pRecalc4 = GetParaPortions().GetObject( (sal_uInt16)(aOldPositions.Min()-1) );
- }
-
- MoveParagraphsInfo aMoveParagraphsInfo( sal::static_int_cast< sal_uInt16 >(aOldPositions.Min()), sal::static_int_cast< sal_uInt16 >(aOldPositions.Max()), nNewPos );
- aBeginMovingParagraphsHdl.Call( &aMoveParagraphsInfo );
-
- if ( IsUndoEnabled() && !IsInUndo())
- InsertUndo( new EditUndoMoveParagraphs( this, aOldPositions, nNewPos ) );
-
- // 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++ )
- {
- // always aOldPositions.Min(), since Remove().
- ParaPortion* pTmpPortion = GetParaPortions().GetObject( (sal_uInt16)aOldPositions.Min() );
- GetParaPortions().Remove( (sal_uInt16)aOldPositions.Min() );
- aEditDoc.Remove( (sal_uInt16)aOldPositions.Min() );
- aTmpPortionList.Insert( pTmpPortion, aTmpPortionList.Count() );
- }
-
- sal_uInt16 nRealNewPos = pDestPortion ? GetParaPortions().GetPos( pDestPortion ) : GetParaPortions().Count();
- OSL_ENSURE( nRealNewPos != USHRT_MAX, "ImpMoveParagraphs: Invalid Position!" );
-
- for ( i = 0; i < (sal_uInt16)aTmpPortionList.Count(); i++ )
- {
- ParaPortion* pTmpPortion = aTmpPortionList.GetObject( i );
- if ( i == 0 )
- aSelection.Min().SetNode( pTmpPortion->GetNode() );
-
- aSelection.Max().SetNode( pTmpPortion->GetNode() );
- aSelection.Max().SetIndex( pTmpPortion->GetNode()->Len() );
-
- ContentNode* pN = pTmpPortion->GetNode();
- aEditDoc.Insert( pN, nRealNewPos+i );
-
- GetParaPortions().Insert( pTmpPortion, nRealNewPos+i );
- }
-
- aEndMovingParagraphsHdl.Call( &aMoveParagraphsInfo );
-
- if ( GetNotifyHdl().IsSet() )
- {
- EENotify aNotify( EE_NOTIFY_PARAGRAPHSMOVED );
- aNotify.pEditEngine = GetEditEnginePtr();
- aNotify.nParagraph = nNewPos;
- aNotify.nParam1 = sal::static_int_cast< sal_uInt16 >(aOldPositions.Min());
- aNotify.nParam2 = sal::static_int_cast< sal_uInt16 >(aOldPositions.Max());
- CallNotify( aNotify );
- }
-
- aEditDoc.SetModified( sal_True );
-
- if ( pRecalc1 )
- CalcHeight( pRecalc1 );
- if ( pRecalc2 )
- CalcHeight( pRecalc2 );
- if ( pRecalc3 )
- CalcHeight( pRecalc3 );
- if ( pRecalc4 )
- CalcHeight( pRecalc4 );
-
- aTmpPortionList.Remove( 0, aTmpPortionList.Count() ); // important !
-
-#if OSL_DEBUG_LEVEL > 2
- GetParaPortions().DbgCheck(aEditDoc);
-#endif
- return aSelection;
-}
-
-
-EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pRight, sal_Bool bBackward )
-{
- 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 );
- aDeletedNodes.Insert( pInf, aDeletedNodes.Count() );
-
- GetEditEnginePtr()->ParagraphConnected( aEditDoc.GetPos( pLeft ), aEditDoc.GetPos( pRight ) );
-
- if ( IsUndoEnabled() && !IsInUndo() )
- {
- InsertUndo( new EditUndoConnectParas( this,
- aEditDoc.GetPos( pLeft ), pLeft->Len(),
- pLeft->GetContentAttribs().GetItems(), pRight->GetContentAttribs().GetItems(),
- pLeft->GetStyleSheet(), pRight->GetStyleSheet(), bBackward ) );
- }
-
- if ( bBackward )
- {
- pLeft->SetStyleSheet( pRight->GetStyleSheet(), sal_True );
- pLeft->GetContentAttribs().GetItems().Set( pRight->GetContentAttribs().GetItems() );
- pLeft->GetCharAttribs().GetDefFont() = pRight->GetCharAttribs().GetDefFont();
- }
-
- ParaAttribsChanged( pLeft );
-
- // First search for Portions since pRight is gone after ConnectParagraphs.
- ParaPortion* pLeftPortion = FindParaPortion( pLeft );
- ParaPortion* pRightPortion = FindParaPortion( pRight );
- OSL_ENSURE( pLeftPortion, "Blind Portion in ImpConnectParagraphs(1)" );
- OSL_ENSURE( pRightPortion, "Blind Portion in ImpConnectParagraphs(2)" );
- OSL_ENSURE( nParagraphTobeDeleted == GetParaPortions().GetPos( pRightPortion ), "NodePos != PortionPos?" );
-
- if ( GetStatus().DoOnlineSpelling() )
- {
- xub_StrLen nEnd = pLeft->Len();
- xub_StrLen nInv = nEnd ? nEnd-1 : nEnd;
- pLeft->GetWrongList()->ClearWrongs( nInv, 0xFFFF, pLeft ); // Possibly remove one
- pLeft->GetWrongList()->MarkInvalid( nInv, nEnd+1 );
- // 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 ) // Not a subsequent
- {
- aWrong.nStart = aWrong.nStart + nEnd;
- aWrong.nEnd = aWrong.nEnd + nEnd;
- pLeft->GetWrongList()->InsertWrong( aWrong, pLeft->GetWrongList()->Count() );
- }
- }
- }
-
- if ( IsCallParaInsertedOrDeleted() )
- GetEditEnginePtr()->ParagraphDeleted( nParagraphTobeDeleted );
-
- EditPaM aPaM = aEditDoc.ConnectParagraphs( pLeft, pRight );
- GetParaPortions().Remove( nParagraphTobeDeleted );
- delete pRightPortion;
-
- pLeftPortion->MarkSelectionInvalid( aPaM.GetIndex(), pLeft->Len() );
-
- // the right node is deleted by EditDoc:ConnectParagraphs().
- if ( GetTextRanger() )
- {
- // By joining together the two, the left is although reformatted,
- // however if its height does not change then the formatting receives
- // the change of the total text hight too late...
- for ( sal_uInt16 n = nParagraphTobeDeleted; n < GetParaPortions().Count(); n++ )
- {
- ParaPortion* pPP = GetParaPortions().GetObject( n );
- pPP->MarkSelectionInvalid( 0, pPP->GetNode()->Len() );
- pPP->GetLines().Reset();
- }
- }
-
- TextModified();
-
- return aPaM;
-}
-
-EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, sal_uInt8 nMode, sal_uInt8 nDelMode )
-{
- OSL_ENSURE( !EditSelection( rSel ).DbgIsBuggy( aEditDoc ), "Index out of range in DeleteLeftOrRight" );
-
- if ( rSel.HasRange() ) // only then Delete Selection
- return ImpDeleteSelection( rSel );
-
- const EditPaM aCurPos( rSel.Max() );
- EditPaM aDelStart( aCurPos );
- EditPaM aDelEnd( aCurPos );
- if ( nMode == DEL_LEFT )
- {
- if ( nDelMode == DELMODE_SIMPLE )
- {
- aDelStart = CursorLeft( aCurPos, i18n::CharacterIteratorMode::SKIPCHARACTER );
- }
- else if ( nDelMode == DELMODE_RESTOFWORD )
- {
- aDelStart = StartOfWord( aCurPos );
- if ( aDelStart.GetIndex() == aCurPos.GetIndex() )
- aDelStart = WordLeft( aCurPos );
- }
- else // DELMODE_RESTOFCONTENT
- {
- aDelStart.SetIndex( 0 );
- if ( aDelStart == aCurPos )
- {
- // Complete paragraph previous
- ContentNode* pPrev = GetPrevVisNode( aCurPos.GetNode() );
- if ( pPrev )
- aDelStart = EditPaM( pPrev, 0 );
- }
- }
- }
- else
- {
- if ( nDelMode == DELMODE_SIMPLE )
- {
- aDelEnd = CursorRight( aCurPos );
- }
- else if ( nDelMode == DELMODE_RESTOFWORD )
- {
- aDelEnd = EndOfWord( aCurPos );
- if (aDelEnd.GetIndex() == aCurPos.GetIndex())
- {
- xub_StrLen nLen = aCurPos.GetNode()->Len();
- // end of para?
- if (aDelEnd.GetIndex() == nLen)
- aDelEnd = WordLeft( aCurPos );
- else // there's still sth to delete on the right
- {
- aDelEnd = EndOfWord( WordRight( aCurPos ) );
- // if there'n no next word...
- if (aDelEnd.GetIndex() == nLen )
- aDelEnd.SetIndex( nLen );
- }
- }
- }
- else // DELMODE_RESTOFCONTENT
- {
- aDelEnd.SetIndex( aCurPos.GetNode()->Len() );
- if ( aDelEnd == aCurPos )
- {
- // Complete paragraph next
- ContentNode* pNext = GetNextVisNode( aCurPos.GetNode() );
- if ( pNext )
- aDelEnd = EditPaM( pNext, pNext->Len() );
- }
- }
- }
-
- // ConnectParagraphs not enoguh for different Nodes when
- // DELMODE_RESTOFCONTENT.
- if ( ( nDelMode == DELMODE_RESTOFCONTENT ) || ( aDelStart.GetNode() == aDelEnd.GetNode() ) )
- return ImpDeleteSelection( EditSelection( aDelStart, aDelEnd ) );
-
- // Decide now if to delete selection (RESTOFCONTENTS)
- sal_Bool bSpecialBackward = ( ( nMode == DEL_LEFT ) && ( nDelMode == DELMODE_SIMPLE ) )
- ? sal_True : sal_False;
- if ( aStatus.IsAnyOutliner() )
- bSpecialBackward = sal_False;
-
- return ImpConnectParagraphs( aDelStart.GetNode(), aDelEnd.GetNode(), bSpecialBackward );
-}
-
-EditPaM ImpEditEngine::ImpDeleteSelection( EditSelection aSel )
-{
- if ( !aSel.HasRange() )
- return aSel.Min();
-
- aSel.Adjust( aEditDoc );
- EditPaM aStartPaM( aSel.Min() );
- EditPaM aEndPaM( aSel.Max() );
-
- CursorMoved( aStartPaM.GetNode() ); // only so that newly set Attributes dissapear...
- CursorMoved( aEndPaM.GetNode() ); // only so that newly set Attributes dissapear...
-
- 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() );
-
- OSL_ENSURE( nEndNode != USHRT_MAX, "Start > End ?!" );
- OSL_ENSURE( nStartNode <= nEndNode, "Start > End ?!" );
-
- // Remove all nodes in between ....
- for ( sal_uLong z = nStartNode+1; z < nEndNode; z++ )
- {
- // Always nStartNode+1, due to Remove()!
- ImpRemoveParagraph( nStartNode+1 );
- }
-
- if ( aStartPaM.GetNode() != aEndPaM.GetNode() )
- {
- // The Rest of the StartNodes...
- sal_uInt16 nChars;
- nChars = aStartPaM.GetNode()->Len() - aStartPaM.GetIndex();
- ImpRemoveChars( aStartPaM, nChars );
- ParaPortion* pPortion = FindParaPortion( aStartPaM.GetNode() );
- OSL_ENSURE( pPortion, "Blind Portion in ImpDeleteSelection(3)" );
- pPortion->MarkSelectionInvalid( aStartPaM.GetIndex(), aStartPaM.GetNode()->Len() );
-
- // The beginning of the EndNodes....
- nChars = aEndPaM.GetIndex();
- aEndPaM.SetIndex( 0 );
- ImpRemoveChars( aEndPaM, nChars );
- pPortion = FindParaPortion( aEndPaM.GetNode() );
- OSL_ENSURE( pPortion, "Blind Portion in ImpDeleteSelection(4)" );
- pPortion->MarkSelectionInvalid( 0, aEndPaM.GetNode()->Len() );
- // Join together....
- aStartPaM = ImpConnectParagraphs( aStartPaM.GetNode(), aEndPaM.GetNode() );
- }
- else
- {
- sal_uInt16 nChars;
- nChars = aEndPaM.GetIndex() - aStartPaM.GetIndex();
- ImpRemoveChars( aStartPaM, nChars );
- ParaPortion* pPortion = FindParaPortion( aStartPaM.GetNode() );
- OSL_ENSURE( pPortion, "Blind Portion in ImpDeleteSelection(5)" );
- pPortion->MarkInvalid( aEndPaM.GetIndex(), aStartPaM.GetIndex() - aEndPaM.GetIndex() );
- }
-
- UpdateSelections();
- TextModified();
- return aStartPaM;
-}
-
-void ImpEditEngine::ImpRemoveParagraph( sal_uInt16 nPara )
-{
- ContentNode* pNode = aEditDoc.SaveGetObject( nPara );
- ContentNode* pNextNode = aEditDoc.SaveGetObject( nPara+1 );
- ParaPortion* pPortion = GetParaPortions().SaveGetObject( nPara );
-
- 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() );
-
- // The node is managed by the undo and possibly destroyed!
- /* delete */ aEditDoc.Remove( nPara );
- GetParaPortions().Remove( nPara );
- delete pPortion;
-
- if ( IsCallParaInsertedOrDeleted() )
- {
- GetEditEnginePtr()->ParagraphDeleted( nPara );
- }
-
- // 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 );
-
- if ( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new EditUndoDelContent( this, pNode, nPara ) );
- else
- {
- aEditDoc.RemoveItemsFromPool( pNode );
- if ( pNode->GetStyleSheet() )
- EndListening( *pNode->GetStyleSheet(), sal_False );
- delete pNode;
- }
-}
-
-EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c,
- sal_Bool bOverwrite, Window* pFrameWin )
-{
- EditSelection aSel( rCurSel );
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
- if ( pAutoCorrect )
- {
- if ( aSel.HasRange() )
- aSel = ImpDeleteSelection( rCurSel );
-
- // #i78661 allow application to turn off capitalization of
- // start sentence explicitly.
- // (This is done by setting IsFirstWordCapitalization to sal_False.)
- sal_Bool bOldCptlSttSntnc = pAutoCorrect->IsAutoCorrFlag( CptlSttSntnc );
- if (!IsFirstWordCapitalization())
- {
- ESelection aESel( CreateESel(aSel) );
- EditSelection aFirstWordSel;
- EditSelection aSecondWordSel;
- if (aESel.nEndPara == 0) // is this the first para?
- {
- // select first word...
- // start by checking if para starts with word.
- aFirstWordSel = SelectWord( CreateSel(ESelection()) );
- if (aFirstWordSel.Min().GetIndex() == 0 && aFirstWordSel.Max().GetIndex() == 0)
- {
- // para does not start with word -> select next/first word
- EditPaM aRightWord( WordRight( aFirstWordSel.Max(), 1 ) );
- aFirstWordSel = SelectWord( EditSelection( aRightWord ) );
- }
-
- // select second word
- // (sometimes aSel mightnot point to the end of the first word
- // but to some following char like '.'. ':', ...
- // In those cases we need aSecondWordSel to see if aSel
- // will actually effect the first word.)
- EditPaM aRight2Word( WordRight( aFirstWordSel.Max(), 1 ) );
- aSecondWordSel = SelectWord( EditSelection( aRight2Word ) );
- }
- sal_Bool bIsFirstWordInFirstPara = aESel.nEndPara == 0 &&
- aFirstWordSel.Max().GetIndex() <= aSel.Max().GetIndex() &&
- aSel.Max().GetIndex() <= aSecondWordSel.Min().GetIndex();
-
- if (bIsFirstWordInFirstPara)
- pAutoCorrect->SetAutoCorrFlag( CptlSttSntnc, IsFirstWordCapitalization() );
- }
-
- ContentNode* pNode = aSel.Max().GetNode();
- sal_uInt16 nIndex = aSel.Max().GetIndex();
- EdtAutoCorrDoc aAuto( this, pNode, nIndex, c );
- pAutoCorrect->AutoCorrect( aAuto, *pNode, nIndex, c, !bOverwrite, pFrameWin );
- aSel.Max().SetIndex( aAuto.GetCursor() );
-
- // #i78661 since the SvxAutoCorrect object used here is
- // shared we need to reset the value to it's original state.
- pAutoCorrect->SetAutoCorrFlag( CptlSttSntnc, bOldCptlSttSntnc );
- }
- return aSel.Max();
-}
-
-
-EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel,
- xub_Unicode c, sal_Bool bOverwrite, sal_Bool bIsUserInput )
-{
- OSL_ENSURE( c != '\t', "Tab for InsertText ?" );
- OSL_ENSURE( c != '\n', "Word wrapping for InsertText ?");
-
- EditPaM aPaM( rCurSel.Min() );
-
- sal_Bool bDoOverwrite = ( bOverwrite &&
- ( aPaM.GetIndex() < aPaM.GetNode()->Len() ) ) ? sal_True : sal_False;
-
- sal_Bool bUndoAction = ( rCurSel.HasRange() || bDoOverwrite );
-
- if ( bUndoAction )
- UndoActionStart( EDITUNDO_INSERT );
-
- if ( rCurSel.HasRange() )
- {
- aPaM = ImpDeleteSelection( rCurSel );
- }
- else if ( bDoOverwrite )
- {
- // If selected, then do not also overwrite a character!
- EditSelection aTmpSel( aPaM );
- aTmpSel.Max().GetIndex()++;
- OSL_ENSURE( !aTmpSel.DbgIsBuggy( aEditDoc ), "Overwrite: Wrong selection! ");
- ImpDeleteSelection( aTmpSel );
- }
-
- if ( aPaM.GetNode()->Len() < MAXCHARSINPARA )
- {
- if (bIsUserInput && IsInputSequenceCheckingRequired( c, rCurSel ))
- {
- uno::Reference < i18n::XExtendedInputSequenceChecker > _xISC( ImplGetInputSequenceChecker() );
- if (!pCTLOptions)
- pCTLOptions = new SvtCTLOptions;
-
- if (_xISC.is() || pCTLOptions)
- {
- xub_StrLen nTmpPos = aPaM.GetIndex();
- sal_Int16 nCheckMode = pCTLOptions->IsCTLSequenceCheckingRestricted() ?
- i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
-
- // the text that needs to be checked is only the one
- // before the current cursor position
- rtl::OUString aOldText( aPaM.GetNode()->Copy(0, nTmpPos) );
- rtl::OUString aNewText( aOldText );
- if (pCTLOptions->IsCTLSequenceCheckingTypeAndReplace())
- {
- /*const xub_StrLen nPrevPos = static_cast< xub_StrLen >*/( _xISC->correctInputSequence( aNewText, nTmpPos - 1, c, nCheckMode ) );
-
- // find position of first character that has changed
- sal_Int32 nOldLen = aOldText.getLength();
- sal_Int32 nNewLen = aNewText.getLength();
- const sal_Unicode *pOldTxt = aOldText.getStr();
- const sal_Unicode *pNewTxt = aNewText.getStr();
- sal_Int32 nChgPos = 0;
- while ( nChgPos < nOldLen && nChgPos < nNewLen &&
- pOldTxt[nChgPos] == pNewTxt[nChgPos] )
- ++nChgPos;
-
- xub_StrLen nChgLen = static_cast< xub_StrLen >( nNewLen - nChgPos );
- String aChgText( aNewText.copy( nChgPos ), nChgLen );
-
- // select text from first pos to be changed to current pos
- EditSelection aSel( EditPaM( aPaM.GetNode(), (sal_uInt16) nChgPos ), aPaM );
-
- if (aChgText.Len())
- return InsertText( aSel, aChgText ); // implicitly handles undo
- else
- return aPaM;
- }
- else
- {
- // should the character be ignored (i.e. not get inserted) ?
- if (!_xISC->checkInputSequence( aOldText, nTmpPos - 1, c, nCheckMode ))
- return aPaM; // nothing to be done -> no need for undo
- }
- }
-
- // at this point now we will insert the character 'normally' some lines below...
- }
-
- if ( IsUndoEnabled() && !IsInUndo() )
- {
- EditUndoInsertChars* pNewUndo = new EditUndoInsertChars( this, CreateEPaM( aPaM ), c );
- sal_Bool bTryMerge = ( !bDoOverwrite && ( c != ' ' ) ) ? sal_True : sal_False;
- InsertUndo( pNewUndo, bTryMerge );
- }
-
- aEditDoc.InsertText( (const EditPaM&)aPaM, c );
- ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() );
- OSL_ENSURE( pPortion, "Blind Portion in InsertText" );
- pPortion->MarkInvalid( aPaM.GetIndex(), 1 );
- aPaM.GetIndex()++; // does not do EditDoc-Method anymore
- }
-
- TextModified();
-
- if ( bUndoAction )
- UndoActionEnd( EDITUNDO_INSERT );
-
- return aPaM;
-}
-
-EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rStr )
-{
- UndoActionStart( EDITUNDO_INSERT );
-
- EditPaM aPaM;
- if ( aCurSel.HasRange() )
- aPaM = ImpDeleteSelection( aCurSel );
- else
- aPaM = aCurSel.Max();
-
- 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
- // start of the word)
- // #i107201# do the expensive SelectWord call only if online spelling is active
- EditSelection aCurWord;
- if ( GetStatus().DoOnlineSpelling() )
- aCurWord = SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD );
-
- XubString aText( rStr );
- aText.ConvertLineEnd( LINEEND_LF );
- SfxVoidItem aTabItem( EE_FEATURE_TAB );
-
- // Converts to linesep = \n
- // Token LINE_SEP query,
- // since the MAC-Compiler makes something else from \n !
-
- // fdo#39869 The loop run variable must be capable to hold STRLEN_MAX+1,
- // that with STRING32 would be SAL_MAX_INT32+1 but with 16-bit is 0xFFFF+1
- sal_uInt32 nStart = 0;
- while ( nStart < aText.Len() )
- {
- sal_uInt32 nEnd = aText.Search( LINE_SEP, static_cast<xub_StrLen>(nStart) );
- if ( nEnd == STRING_NOTFOUND )
- nEnd = aText.Len(); // not dereference!
-
- // Start == End => empty line
- if ( nEnd > nStart )
- {
- XubString aLine( aText, nStart, static_cast<xub_StrLen>(nEnd-nStart) );
- xub_StrLen nChars = aPaM.GetNode()->Len() + aLine.Len();
- if ( nChars > MAXCHARSINPARA )
- {
- xub_StrLen nMaxNewChars = MAXCHARSINPARA-aPaM.GetNode()->Len();
- nEnd -= ( aLine.Len() - nMaxNewChars ); // Then the characters end up in the next paragraph.
- aLine.Erase( nMaxNewChars ); // Delete the Rest...
- }
- if ( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new EditUndoInsertChars( this, CreateEPaM( aPaM ), aLine ) );
- // Tabs ?
- if ( aLine.Search( '\t' ) == STRING_NOTFOUND )
- aPaM = aEditDoc.InsertText( aPaM, aLine );
- else
- {
- sal_uInt32 nStart2 = 0;
- while ( nStart2 < aLine.Len() )
- {
- sal_uInt32 nEnd2 = aLine.Search( '\t', static_cast<xub_StrLen>(nStart2) );
- if ( nEnd2 == STRING_NOTFOUND )
- nEnd2 = aLine.Len(); // not dereference!
-
- if ( nEnd2 > nStart2 )
- aPaM = aEditDoc.InsertText( aPaM, XubString( aLine,
- static_cast<xub_StrLen>(nStart2),
- static_cast<xub_StrLen>(nEnd2-nStart2) ) );
- if ( nEnd2 < aLine.Len() )
- {
- aPaM = aEditDoc.InsertFeature( aPaM, aTabItem );
- }
- nStart2 = nEnd2+1;
- }
- }
- ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() );
- OSL_ENSURE( pPortion, "Blind Portion in InsertText" );
-
- if ( GetStatus().DoOnlineSpelling() )
- {
- // now remove the Wrongs (red spell check marks) from both words...
- WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList();
- if (pWrongs && pWrongs->HasWrongs())
- pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() );
- // ... and mark both words as 'to be checked again'
- pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() );
- }
- else
- pPortion->MarkInvalid( aCurPaM.GetIndex(), aLine.Len() );
- }
- if ( nEnd < aText.Len() )
- aPaM = ImpInsertParaBreak( aPaM );
-
- nStart = nEnd+1;
- }
-
- UndoActionEnd( EDITUNDO_INSERT );
-
- TextModified();
- return aPaM;
-}
-
-EditPaM ImpEditEngine::ImpFastInsertText( EditPaM aPaM, const XubString& rStr )
-{
- 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 )
- {
- if ( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new EditUndoInsertChars( this, CreateEPaM( aPaM ), rStr ) );
-
- aPaM = aEditDoc.InsertText( aPaM, rStr );
- TextModified();
- }
- else
- {
- aPaM = ImpInsertText( aPaM, rStr );
- }
-
- return aPaM;
-}
-
-EditPaM ImpEditEngine::ImpInsertFeature( EditSelection aCurSel, const SfxPoolItem& rItem )
-{
- EditPaM aPaM;
- if ( aCurSel.HasRange() )
- aPaM = ImpDeleteSelection( aCurSel );
- else
- aPaM = aCurSel.Max();
-
- if ( aPaM.GetIndex() >= 0xfffe )
- return aPaM;
-
- if ( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new EditUndoInsertFeature( this, CreateEPaM( aPaM ), rItem ) );
- aPaM = aEditDoc.InsertFeature( aPaM, rItem );
-
- ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() );
- OSL_ENSURE( pPortion, "Blind Portion in InsertFeature" );
- pPortion->MarkInvalid( aPaM.GetIndex()-1, 1 );
-
- TextModified();
-
- return aPaM;
-}
-
-EditPaM ImpEditEngine::ImpInsertParaBreak( const EditSelection& rCurSel, sal_Bool bKeepEndingAttribs )
-{
- EditPaM aPaM;
- if ( rCurSel.HasRange() )
- aPaM = ImpDeleteSelection( rCurSel );
- else
- aPaM = rCurSel.Max();
-
- return ImpInsertParaBreak( aPaM, bKeepEndingAttribs );
-}
-
-EditPaM ImpEditEngine::ImpInsertParaBreak( const EditPaM& rPaM, sal_Bool bKeepEndingAttribs )
-{
- if ( aEditDoc.Count() >= 0xFFFE )
- {
- OSL_FAIL( "Can't process more than 64K paragraphs!" );
- return rPaM;
- }
-
- if ( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new EditUndoSplitPara( this, aEditDoc.GetPos( rPaM.GetNode() ), rPaM.GetIndex() ) );
-
- EditPaM aPaM( aEditDoc.InsertParaBreak( rPaM, bKeepEndingAttribs ) );
-
- if ( GetStatus().DoOnlineSpelling() )
- {
- xub_StrLen nEnd = rPaM.GetNode()->Len();
- aPaM.GetNode()->CreateWrongList();
- WrongList* pLWrongs = rPaM.GetNode()->GetWrongList();
- WrongList* pRWrongs = aPaM.GetNode()->GetWrongList();
- // take over misspelled words:
- sal_uInt16 nLWrongs = pLWrongs->Count();
- for ( sal_uInt16 nW = 0; nW < nLWrongs; nW++ )
- {
- WrongRange& rWrong = pLWrongs->GetObject( nW );
- // Correct only if really a word gets overlapped in the process of
- // Spell checking
- if ( rWrong.nStart > nEnd )
- {
- pRWrongs->InsertWrong( rWrong, pRWrongs->Count() );
- WrongRange& rRWrong = pRWrongs->GetObject( pRWrongs->Count() - 1 );
- rRWrong.nStart = rRWrong.nStart - nEnd;
- rRWrong.nEnd = rRWrong.nEnd - nEnd;
- }
- else if ( ( rWrong.nStart < nEnd ) && ( rWrong.nEnd > nEnd ) )
- rWrong.nEnd = nEnd;
- }
- sal_uInt16 nInv = nEnd ? nEnd-1 : nEnd;
- if ( nEnd )
- pLWrongs->MarkInvalid( nInv, nEnd );
- else
- pLWrongs->SetValid();
- pRWrongs->SetValid(); // otherwise 0 - 0xFFFF
- pRWrongs->MarkInvalid( 0, 1 ); // Only test the first word
- }
-
- ParaPortion* pPortion = FindParaPortion( rPaM.GetNode() );
- OSL_ENSURE( pPortion, "Blind Portion in ImpInsertParaBreak" );
- pPortion->MarkInvalid( rPaM.GetIndex(), 0 );
-
- // Optimization: Do not place unnecessarily many getPos to Listen!
- // Here, as in undo, but also in all other methods.
- sal_uInt16 nPos = GetParaPortions().GetPos( pPortion );
- ParaPortion* pNewPortion = new ParaPortion( aPaM.GetNode() );
- GetParaPortions().Insert( pNewPortion, nPos + 1 );
- ParaAttribsChanged( pNewPortion->GetNode() );
- if ( IsCallParaInsertedOrDeleted() )
- GetEditEnginePtr()->ParagraphInserted( nPos+1 );
-
- CursorMoved( rPaM.GetNode() ); // if empty Attributes have emerged.
- TextModified();
- return aPaM;
-}
-
-EditPaM ImpEditEngine::ImpFastInsertParagraph( sal_uInt16 nPara )
-{
- if ( IsUndoEnabled() && !IsInUndo() )
- {
- if ( nPara )
- {
- 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 ) );
- }
-
- ContentNode* pNode = new ContentNode( aEditDoc.GetItemPool() );
- // If flat mode, then later no Font is set:
- pNode->GetCharAttribs().GetDefFont() = aEditDoc.GetDefFont();
-
- if ( GetStatus().DoOnlineSpelling() )
- pNode->CreateWrongList();
-
- aEditDoc.Insert( pNode, nPara );
-
- ParaPortion* pNewPortion = new ParaPortion( pNode );
- GetParaPortions().Insert( pNewPortion, nPara );
- if ( IsCallParaInsertedOrDeleted() )
- GetEditEnginePtr()->ParagraphInserted( nPara );
-
- return EditPaM( pNode, 0 );
-}
-
-EditPaM ImpEditEngine::InsertParaBreak( EditSelection aCurSel )
-{
- EditPaM aPaM( ImpInsertParaBreak( aCurSel ) );
- if ( aStatus.DoAutoIndenting() )
- {
- sal_uInt16 nPara = aEditDoc.GetPos( aPaM.GetNode() );
- OSL_ENSURE( nPara > 0, "AutoIndenting: Error!" );
- XubString aPrevParaText( GetEditDoc().GetParaAsString( nPara-1 ) );
- sal_uInt16 n = 0;
- while ( ( n < aPrevParaText.Len() ) &&
- ( ( aPrevParaText.GetChar(n) == ' ' ) || ( aPrevParaText.GetChar(n) == '\t' ) ) )
- {
- if ( aPrevParaText.GetChar(n) == '\t' )
- aPaM = ImpInsertFeature( aPaM, SfxVoidItem( EE_FEATURE_TAB ) );
- else
- aPaM = ImpInsertText( aPaM, aPrevParaText.GetChar(n) );
- n++;
- }
-
- }
- return aPaM;
-}
-
-EditPaM ImpEditEngine::InsertTab( EditSelection aCurSel )
-{
- EditPaM aPaM( ImpInsertFeature( aCurSel, SfxVoidItem( EE_FEATURE_TAB ) ) );
- return aPaM;
-}
-
-EditPaM ImpEditEngine::InsertField( EditSelection aCurSel, const SvxFieldItem& rFld )
-{
- EditPaM aPaM( ImpInsertFeature( aCurSel, rFld ) );
- return aPaM;
-}
-
-sal_Bool ImpEditEngine::UpdateFields()
-{
- sal_Bool bChanges = sal_False;
- sal_uInt16 nParas = GetEditDoc().Count();
- for ( sal_uInt16 nPara = 0; nPara < nParas; nPara++ )
- {
- sal_Bool bChangesInPara = sal_False;
- ContentNode* pNode = GetEditDoc().GetObject( nPara );
- OSL_ENSURE( pNode, "NULL-Pointer in Doc" );
- CharAttribArray& rAttribs = pNode->GetCharAttribs().GetAttribs();
- for ( sal_uInt16 nAttr = 0; nAttr < rAttribs.Count(); nAttr++ )
- {
- EditCharAttrib* pAttr = rAttribs[nAttr];
- if ( pAttr->Which() == EE_FEATURE_FIELD )
- {
- EditCharAttribField* pField = (EditCharAttribField*)pAttr;
- EditCharAttribField* pCurrent = new EditCharAttribField( *pField );
- pField->Reset();
-
- if ( aStatus.MarkFields() )
- pField->GetFldColor() = new Color( GetColorConfig().GetColorValue( svtools::WRITERFIELDSHADINGS ).nColor );
-
- XubString aFldValue = GetEditEnginePtr()->CalcFieldValue(
- (const SvxFieldItem&)*pField->GetItem(),
- nPara, pField->GetStart(),
- pField->GetTxtColor(), pField->GetFldColor() );
- pField->GetFieldValue() = aFldValue;
- if ( *pField != *pCurrent )
- {
- bChanges = sal_True;
- bChangesInPara = sal_True;
- }
- delete pCurrent;
- }
- }
- if ( bChangesInPara )
- {
- // If possible be more precise when invalidate.
- ParaPortion* pPortion = GetParaPortions().GetObject( nPara );
- OSL_ENSURE( pPortion, "NULL-Pointer in Doc" );
- pPortion->MarkSelectionInvalid( 0, pNode->Len() );
- }
- }
- return bChanges;
-}
-
-EditPaM ImpEditEngine::InsertLineBreak( EditSelection aCurSel )
-{
- EditPaM aPaM( ImpInsertFeature( aCurSel, SfxVoidItem( EE_FEATURE_LINEBR ) ) );
- return aPaM;
-}
-
-// ----------------------------------------------------------------------
-// Helper functions
-// ----------------------------------------------------------------------
-Rectangle ImpEditEngine::PaMtoEditCursor( EditPaM aPaM, sal_uInt16 nFlags )
-{
- OSL_ENSURE( GetUpdateMode(), "Must not be reached when Update=FALSE: PaMtoEditCursor" );
-
- Rectangle aEditCursor;
- long nY = 0;
- for ( sal_uInt16 nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ )
- {
- ParaPortion* pPortion = GetParaPortions().GetObject(nPortion);
- ContentNode* pNode = pPortion->GetNode();
- OSL_ENSURE( pNode, "Invalid Node in Portion!" );
- if ( pNode != aPaM.GetNode() )
- {
- nY += pPortion->GetHeight();
- }
- else
- {
- aEditCursor = GetEditCursor( pPortion, aPaM.GetIndex(), nFlags );
- aEditCursor.Top() += nY;
- aEditCursor.Bottom() += nY;
- return aEditCursor;
- }
- }
- OSL_FAIL( "Portion not found!" );
- return aEditCursor;
-}
-
-EditPaM ImpEditEngine::GetPaM( Point aDocPos, sal_Bool bSmart )
-{
- OSL_ENSURE( GetUpdateMode(), "Must not be reached when Update=FALSE: GetPaM" );
-
- long nY = 0;
- long nTmpHeight;
- EditPaM aPaM;
- sal_uInt16 nPortion;
- for ( nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ )
- {
- ParaPortion* pPortion = GetParaPortions().GetObject(nPortion);
- nTmpHeight = pPortion->GetHeight(); // should also be correct for !bVisible!
- nY += nTmpHeight;
- if ( nY > aDocPos.Y() )
- {
- nY -= nTmpHeight;
- aDocPos.Y() -= nY;
- // Skip invisible Portions:
- while ( pPortion && !pPortion->IsVisible() )
- {
- nPortion++;
- pPortion = GetParaPortions().SaveGetObject( nPortion );
- }
- OSL_ENSURE( pPortion, "No visible paragraph found: GetPaM" );
- aPaM = GetPaM( pPortion, aDocPos, bSmart );
- return aPaM;
-
- }
- }
- // Then search for the last visible:
- nPortion = GetParaPortions().Count()-1;
- while ( nPortion && !GetParaPortions()[nPortion]->IsVisible() )
- nPortion--;
-
- OSL_ENSURE( GetParaPortions()[nPortion]->IsVisible(), "No visible paragraph found: GetPaM" );
- aPaM.SetNode( GetParaPortions()[nPortion]->GetNode() );
- aPaM.SetIndex( GetParaPortions()[nPortion]->GetNode()->Len() );
- return aPaM;
-}
-
-sal_uInt32 ImpEditEngine::GetTextHeight() const
-{
- 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 )
-{
- // If still not formatted and not in the process.
- // Will be brought in the formatting for AutoPageSize.
- if ( !IsFormatted() && !IsFormatting() )
- FormatDoc();
-
- EditLine* pLine;
-
- long nMaxWidth = 0;
- long nCurWidth = 0;
-
- // --------------------------------------------------
- // Over all the paragraphs ...
- // --------------------------------------------------
- sal_uInt16 nParas = GetParaPortions().Count();
- for ( sal_uInt16 nPara = 0; nPara < nParas; nPara++ )
- {
- ParaPortion* pPortion = GetParaPortions().GetObject( nPara );
- if ( pPortion->IsVisible() )
- {
- const SvxLRSpaceItem& rLRItem = GetLRSpaceItem( pPortion->GetNode() );
- sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth( pPortion->GetNode() );
-
- // --------------------------------------------------
- // 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 );
- OSL_ENSURE( pLine, "NULL-Pointer in the line iterator in CalcWidth" );
- // nCurWidth = pLine->GetStartPosX();
- // 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 )
- {
- long nFI = GetXValue( rLRItem.GetTxtFirstLineOfst() );
- nCurWidth -= nFI;
- if ( pPortion->GetBulletX() > nCurWidth )
- {
- nCurWidth += nFI; // LI?
- if ( pPortion->GetBulletX() > nCurWidth )
- nCurWidth = pPortion->GetBulletX();
- }
- }
- nCurWidth += GetXValue( rLRItem.GetRight() );
- nCurWidth += CalcLineWidth( pPortion, pLine, bIgnoreExtraSpace );
- if ( nCurWidth > nMaxWidth )
- {
- nMaxWidth = nCurWidth;
- }
- }
- }
- }
- if ( nMaxWidth < 0 )
- nMaxWidth = 0;
-
- nMaxWidth++; // widen it, because in CreateLines for >= is wrapped.
- return (sal_uInt32)nMaxWidth;
-}
-
-sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, sal_Bool bIgnoreExtraSpace )
-{
- sal_uInt16 nPara = GetEditDoc().GetPos( pPortion->GetNode() );
-
- // #114278# Saving both layout mode and language (since I'm
- // potentially changing both)
- GetRefDevice()->Push( PUSH_TEXTLAYOUTMODE|PUSH_TEXTLANGUAGE );
-
- ImplInitLayoutMode( GetRefDevice(), nPara, 0xFFFF );
-
- SvxAdjust eJustification = GetJustification( nPara );
-
- // 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++ )
- {
- TextPortion* pTextPortion = pPortion->GetTextPortions().GetObject( nTP );
- switch ( pTextPortion->GetKind() )
- {
- case PORTIONKIND_FIELD:
- case PORTIONKIND_HYPHENATOR:
- case PORTIONKIND_TAB:
- {
- nWidth += pTextPortion->GetSize().Width();
- }
- break;
- case PORTIONKIND_TEXT:
- {
- if ( ( eJustification != SVX_ADJUST_BLOCK ) || ( !bIgnoreExtraSpace ) )
- {
- nWidth += pTextPortion->GetSize().Width();
- }
- else
- {
- SvxFont aTmpFont( pPortion->GetNode()->GetCharAttribs().GetDefFont() );
- SeekCursor( pPortion->GetNode(), nPos+1, aTmpFont );
- aTmpFont.SetPhysFont( GetRefDevice() );
- ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
- nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), *pPortion->GetNode(), nPos, pTextPortion->GetLen(), NULL ).Width();
- }
- }
- break;
- }
- nPos = nPos + pTextPortion->GetLen();
- }
-
- GetRefDevice()->Pop();
-
- return nWidth;
-}
-
-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 )
-{
- OSL_ENSURE( GetUpdateMode(), "Should not be used when Update=FALSE: CalcTextHeight" );
- sal_uInt32 nY = 0;
- 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
-{
- OSL_ENSURE( nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" );
- ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
- OSL_ENSURE( pPPortion, "Paragraph not found: GetLineCount" );
- if ( pPPortion )
- return pPPortion->GetLines().Count();
-
- return 0xFFFF;
-}
-
-xub_StrLen ImpEditEngine::GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const
-{
- OSL_ENSURE( nParagraph < GetParaPortions().Count(), "GetLineLen: Out of range" );
- ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
- OSL_ENSURE( pPPortion, "Paragraph not found: GetLineLen" );
- if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
- {
- EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
- OSL_ENSURE( pLine, "Line not found: GetLineHeight" );
- return pLine->GetLen();
- }
-
- return 0xFFFF;
-}
-
-void ImpEditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const
-{
- OSL_ENSURE( nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" );
- ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
- 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 );
- OSL_ENSURE( pLine, "Line not found: GetLineBoundaries" );
- rStart = pLine->GetStart();
- rEnd = pLine->GetEnd();
- }
-}
-
-sal_uInt16 ImpEditEngine::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- sal_uInt16 nLineNo = 0xFFFF;
- ContentNode* pNode = GetEditDoc().SaveGetObject( nPara );
- 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();
- OSL_ENSURE( bValidIndex, "GetLineNumberAtIndex: invalid index" );
- const sal_uInt16 nLineCount = GetLineCount( nPara );
- if (nIndex == pNode->Len())
- nLineNo = nLineCount > 0 ? nLineCount - 1 : 0;
- else if (bValidIndex) // nIndex < pNode->Len()
- {
- sal_uInt16 nStart = USHRT_MAX, nEnd = USHRT_MAX;
- for (sal_uInt16 i = 0; i < nLineCount && nLineNo == 0xFFFF; ++i)
- {
- GetLineBoundaries( nStart, nEnd, nPara, i );
- if (nStart <= nIndex && nIndex < nEnd)
- nLineNo = i;
- }
- }
- }
- return nLineNo;
-}
-
-sal_uInt16 ImpEditEngine::GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine )
-{
- OSL_ENSURE( nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" );
- ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
- OSL_ENSURE( pPPortion, "Paragraph not found: GetLineHeight" );
- if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
- {
- EditLine* pLine = pPPortion->GetLines().GetObject( nLine );
- OSL_ENSURE( pLine, "Paragraph not found: GetLineHeight" );
- return pLine->GetHeight();
- }
-
- return 0xFFFF;
-}
-
-sal_uInt32 ImpEditEngine::GetParaHeight( sal_uInt16 nParagraph )
-{
- sal_uInt32 nHeight = 0;
-
- ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
- OSL_ENSURE( pPPortion, "Paragraph not found: GetParaHeight" );
-
- if ( pPPortion )
- nHeight = pPPortion->GetHeight();
-
- return nHeight;
-}
-
-void ImpEditEngine::UpdateSelections()
-{
- sal_uInt16 nInvNodes = aDeletedNodes.Count();
-
- // Check whether one of the selections is at a deleted node...
- // If the node is valid, the index has yet to be examined!
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
- {
- EditView* pView = aEditViews.GetObject(nView);
- DBG_CHKOBJ( pView, EditView, 0 );
- EditSelection aCurSel( pView->pImpEditView->GetEditSelection() );
- sal_Bool bChanged = sal_False;
- for ( sal_uInt16 n = 0; n < nInvNodes; n++ )
- {
- DeletedNodeInfo* pInf = aDeletedNodes.GetObject( n );
- if ( ( ( sal_uLong )(aCurSel.Min().GetNode()) == pInf->GetInvalidAdress() ) ||
- ( ( sal_uLong )(aCurSel.Max().GetNode()) == pInf->GetInvalidAdress() ) )
- {
- // 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 ) // Last paragraph
- {
- nPara = GetParaPortions().Count()-1;
- pPPortion = GetParaPortions().GetObject( nPara );
- }
- 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 ) // then also backwards ...
- {
- nPara = nCurPara;
- while ( nPara && !GetParaPortions()[nPara]->IsVisible() )
- nPara--;
- }
- 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 loop
- }
- }
- if ( !bChanged )
- {
- // Check Index if node shrunk.
- if ( aCurSel.Min().GetIndex() > aCurSel.Min().GetNode()->Len() )
- {
- aCurSel.Min().GetIndex() = aCurSel.Min().GetNode()->Len();
- pView->pImpEditView->SetEditSelection( aCurSel );
- }
- if ( aCurSel.Max().GetIndex() > aCurSel.Max().GetNode()->Len() )
- {
- aCurSel.Max().GetIndex() = aCurSel.Max().GetNode()->Len();
- pView->pImpEditView->SetEditSelection( aCurSel );
- }
- }
- }
-
- // Delete ...
- for ( sal_uInt16 n = 0; n < nInvNodes; n++ )
- {
- DeletedNodeInfo* pInf = aDeletedNodes.GetObject( n );
- delete pInf;
- }
- aDeletedNodes.Remove( 0, aDeletedNodes.Count() );
-}
-
-EditSelection ImpEditEngine::ConvertSelection( sal_uInt16 nStartPara, sal_uInt16 nStartPos,
- sal_uInt16 nEndPara, sal_uInt16 nEndPos ) const
-{
- EditSelection aNewSelection;
-
- // Start...
- ContentNode* pNode = aEditDoc.SaveGetObject( nStartPara );
- sal_uInt16 nIndex = nStartPos;
- if ( !pNode )
- {
- pNode = aEditDoc[ aEditDoc.Count()-1 ];
- nIndex = pNode->Len();
- }
- else if ( nIndex > pNode->Len() )
- nIndex = pNode->Len();
-
- aNewSelection.Min().SetNode( pNode );
- aNewSelection.Min().SetIndex( nIndex );
-
- // End...
- pNode = aEditDoc.SaveGetObject( nEndPara );
- nIndex = nEndPos;
- if ( !pNode )
- {
- pNode = aEditDoc[ aEditDoc.Count()-1 ];
- nIndex = pNode->Len();
- }
- else if ( nIndex > pNode->Len() )
- nIndex = pNode->Len();
-
- aNewSelection.Max().SetNode( pNode );
- aNewSelection.Max().SetIndex( nIndex );
-
- return aNewSelection;
-}
-
-EditSelection ImpEditEngine::MatchGroup( const EditSelection& rSel )
-{
- EditSelection aMatchSel;
- EditSelection aTmpSel( rSel );
- aTmpSel.Adjust( GetEditDoc() );
- if ( ( aTmpSel.Min().GetNode() != aTmpSel.Max().GetNode() ) ||
- ( ( aTmpSel.Max().GetIndex() - aTmpSel.Min().GetIndex() ) > 1 ) )
- {
- return aMatchSel;
- }
-
- sal_uInt16 nPos = aTmpSel.Min().GetIndex();
- ContentNode* pNode = aTmpSel.Min().GetNode();
- if ( nPos >= pNode->Len() )
- return aMatchSel;
-
- sal_uInt16 nMatchChar = aGroupChars.Search( pNode->GetChar( nPos ) );
- if ( nMatchChar != STRING_NOTFOUND )
- {
- sal_uInt16 nNode = aEditDoc.GetPos( pNode );
- if ( ( nMatchChar % 2 ) == 0 )
- {
- // Search forward...
- xub_Unicode nSC = aGroupChars.GetChar( nMatchChar );
- OSL_ENSURE( aGroupChars.Len() > (nMatchChar+1), "Invalid group of MatchChars!" );
- xub_Unicode nEC = aGroupChars.GetChar( nMatchChar+1 );
-
- sal_uInt16 nCur = aTmpSel.Min().GetIndex()+1;
- sal_uInt16 nLevel = 1;
- while ( pNode && nLevel )
- {
- XubString& rStr = *pNode;
- while ( nCur < rStr.Len() )
- {
- if ( rStr.GetChar( nCur ) == nSC )
- nLevel++;
- else if ( rStr.GetChar( nCur ) == nEC )
- {
- nLevel--;
- if ( !nLevel )
- break; // while nCur...
- }
- nCur++;
- }
-
- if ( nLevel )
- {
- nNode++;
- pNode = nNode < aEditDoc.Count() ? aEditDoc.GetObject( nNode ) : 0;
- nCur = 0;
- }
- }
- if ( nLevel == 0 ) // found
- {
- aMatchSel.Min() = aTmpSel.Min();
- aMatchSel.Max() = EditPaM( pNode, nCur+1 );
- }
- }
- else
- {
- // Search backwards...
- xub_Unicode nEC = aGroupChars.GetChar( nMatchChar );
- xub_Unicode nSC = aGroupChars.GetChar( nMatchChar-1 );
-
- sal_uInt16 nCur = aTmpSel.Min().GetIndex()-1;
- sal_uInt16 nLevel = 1;
- while ( pNode && nLevel )
- {
- if ( pNode->Len() )
- {
- XubString& rStr = *pNode;
- while ( nCur )
- {
- if ( rStr.GetChar( nCur ) == nSC )
- {
- nLevel--;
- if ( !nLevel )
- break; // while nCur...
- }
- else if ( rStr.GetChar( nCur ) == nEC )
- nLevel++;
-
- nCur--;
- }
- }
-
- if ( nLevel )
- {
- pNode = nNode ? aEditDoc.GetObject( --nNode ) : 0;
- if ( pNode )
- nCur = pNode->Len()-1; // no matter if negative, because if Len ()
- }
- }
-
- if ( nLevel == 0 ) // found
- {
- aMatchSel.Min() = aTmpSel.Min();
- aMatchSel.Min().GetIndex()++; // after the character
- aMatchSel.Max() = EditPaM( pNode, nCur );
- }
- }
- }
- return aMatchSel;
-}
-
-void ImpEditEngine::StopSelectionMode()
-{
- if ( ( IsInSelectionMode() || aSelEngine.IsInSelection() ) && pActiveView )
- {
- pActiveView->pImpEditView->DrawSelection();
- EditSelection aSel( pActiveView->pImpEditView->GetEditSelection() );
- aSel.Min() = aSel.Max();
- pActiveView->pImpEditView->SetEditSelection( aSel );
- pActiveView->ShowCursor();
- aSelEngine.Reset();
- bInSelection = sal_False;
- }
-}
-
-void ImpEditEngine::SetActiveView( EditView* pView )
-{
- // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- // Actually, now bHasVisSel and HideSelection would be necessary !!!
-
- if ( pView == pActiveView )
- return;
-
- if ( pActiveView && pActiveView->HasSelection() )
- pActiveView->pImpEditView->DrawSelection();
-
- pActiveView = pView;
-
- if ( pActiveView && pActiveView->HasSelection() )
- pActiveView->pImpEditView->DrawSelection();
-
- // NN: Quick fix for #78668#:
- // When editing of a cell in Calc is ended, the edit engine is not deleted,
- // only the edit views are removed. If mpIMEInfos is still set in that case,
- // mpIMEInfos->aPos points to an invalid selection.
- // -> reset mpIMEInfos now
- // (probably something like this is necessary whenever the content is modified
- // from the outside)
-
- if ( !pView && mpIMEInfos )
- {
- delete mpIMEInfos;
- mpIMEInfos = NULL;
- }
-}
-
-uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable( const EditSelection& rSelection ) const
-{
- EditSelection aSelection( rSelection );
- aSelection.Adjust( GetEditDoc() );
-
- EditDataObject* pDataObj = new EditDataObject;
- uno::Reference< datatransfer::XTransferable > xDataObj;
- xDataObj = pDataObj;
-
- XubString aText( GetSelected( aSelection ) );
- aText.ConvertLineEnd(); // System specific
- pDataObj->GetString() = aText;
-
- SvxFontItem::EnableStoreUnicodeNames( sal_True );
- WriteBin( pDataObj->GetStream(), aSelection, sal_True );
- pDataObj->GetStream().Seek( 0 );
- SvxFontItem::EnableStoreUnicodeNames( sal_False );
-
- ((ImpEditEngine*)this)->WriteRTF( pDataObj->GetRTFStream(), aSelection );
- pDataObj->GetRTFStream().Seek( 0 );
-
- if ( ( aSelection.Min().GetNode() == aSelection.Max().GetNode() )
- && ( aSelection.Max().GetIndex() == (aSelection.Min().GetIndex()+1) ) )
- {
- const EditCharAttrib* pAttr = aSelection.Min().GetNode()->GetCharAttribs().
- FindFeature( aSelection.Min().GetIndex() );
- if ( pAttr &&
- ( pAttr->GetStart() == aSelection.Min().GetIndex() ) &&
- ( pAttr->Which() == EE_FEATURE_FIELD ) )
- {
- const SvxFieldItem* pField = (const SvxFieldItem*)pAttr->GetItem();
- const SvxFieldData* pFld = pField->GetField();
- if ( pFld && pFld->ISA( SvxURLField ) )
- {
- // Office-Bookmark
- String aURL( ((const SvxURLField*)pFld)->GetURL() );
- String aTxt( ((const SvxURLField*)pFld)->GetRepresentation() );
- pDataObj->GetURL() = aURL;
- }
- }
- }
-
- return xDataObj;
-}
-
-EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransferable >& rxDataObj, const String& rBaseURL, const EditPaM& rPaM, sal_Bool bUseSpecial )
-{
- EditSelection aNewSelection( rPaM );
-
- if ( rxDataObj.is() )
- {
- datatransfer::DataFlavor aFlavor;
- sal_Bool bDone = sal_False;
-
- if ( bUseSpecial )
- {
- // BIN
- SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_EDITENGINE, aFlavor );
- if ( rxDataObj->isDataFlavorSupported( aFlavor ) )
- {
- try
- {
- uno::Any aData = rxDataObj->getTransferData( aFlavor );
- uno::Sequence< sal_Int8 > aSeq;
- aData >>= aSeq;
- {
- SvMemoryStream aBinStream( aSeq.getArray(), aSeq.getLength(), STREAM_READ );
- aNewSelection = Read( aBinStream, rBaseURL, EE_FORMAT_BIN, rPaM );
- }
- bDone = sal_True;
- }
- catch( const ::com::sun::star::uno::Exception& )
- {
- }
- }
-
- if ( !bDone )
- {
- // RTF
- SotExchange::GetFormatDataFlavor( SOT_FORMAT_RTF, aFlavor );
- if ( rxDataObj->isDataFlavorSupported( aFlavor ) )
- {
- try
- {
- uno::Any aData = rxDataObj->getTransferData( aFlavor );
- uno::Sequence< sal_Int8 > aSeq;
- aData >>= aSeq;
- {
- SvMemoryStream aRTFStream( aSeq.getArray(), aSeq.getLength(), STREAM_READ );
- aNewSelection = Read( aRTFStream, rBaseURL, EE_FORMAT_RTF, rPaM );
- }
- bDone = sal_True;
- }
- catch( const ::com::sun::star::uno::Exception& )
- {
- }
- }
- }
- if ( !bDone )
- {
- // XML ?
- // Currently, there is nothing like "The" XML format, StarOffice doesn't offer plain XML in Clipboard...
- }
- }
- if ( !bDone )
- {
- SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor );
- if ( rxDataObj->isDataFlavorSupported( aFlavor ) )
- {
- try
- {
- uno::Any aData = rxDataObj->getTransferData( aFlavor );
- ::rtl::OUString aText;
- aData >>= aText;
- aNewSelection = ImpInsertText( rPaM, aText );
- bDone = sal_True;
- }
- catch( ... )
- {
- ; // #i9286# can happen, even if isDataFlavorSupported returns true...
- }
- }
- }
- }
-
- return aNewSelection;
-}
-
-Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion )
-{
- Range aRange( 0, 0 );
-
- if ( pPortion->IsVisible() )
- {
- const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE );
- 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;
-
- // only from the top ...
- sal_uInt16 nFirstInvalid = 0xFFFF;
- sal_uInt16 nLine;
- for ( nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
- {
- EditLine* pL = pPortion->GetLines().GetObject( nLine );
- if ( pL->IsInvalid() )
- {
- nFirstInvalid = nLine;
- break;
- }
- if ( nLine && !aStatus.IsOutliner() ) // not the first line
- aRange.Min() += nSBL;
- aRange.Min() += pL->GetHeight();
- }
- OSL_ENSURE( nFirstInvalid != 0xFFFF, "No invalid line found in GetInvalidYOffset(1)" );
-
-
- // Syndicate and more ...
- aRange.Max() = aRange.Min();
- aRange.Max() += pPortion->GetFirstLineOffset();
- if ( nFirstInvalid != 0 ) // Only if the first line is invalid
- aRange.Min() = aRange.Max();
-
- sal_uInt16 nLastInvalid = pPortion->GetLines().Count()-1;
- for ( nLine = nFirstInvalid; nLine < pPortion->GetLines().Count(); nLine++ )
- {
- EditLine* pL = pPortion->GetLines().GetObject( nLine );
- if ( pL->IsValid() )
- {
- nLastInvalid = nLine;
- break;
- }
-
- if ( nLine && !aStatus.IsOutliner() )
- aRange.Max() += nSBL;
- aRange.Max() += pL->GetHeight();
- }
-
- if( ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) && rLSItem.GetPropLineSpace() &&
- ( rLSItem.GetPropLineSpace() < 100 ) )
- {
- EditLine* pL = pPortion->GetLines().GetObject( nFirstInvalid );
- long n = pL->GetTxtHeight() * ( 100 - rLSItem.GetPropLineSpace() );
- n /= 100;
- aRange.Min() -= n;
- aRange.Max() += n;
- }
-
- if ( ( nLastInvalid == pPortion->GetLines().Count()-1 ) && ( !aStatus.IsOutliner() ) )
- aRange.Max() += GetYValue( rULSpace.GetLower() );
- }
- return aRange;
-}
-
-EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bSmart )
-{
- OSL_ENSURE( pPortion->IsVisible(), "Why GetPaM() for an invisible paragraph?" );
- OSL_ENSURE( IsFormatted(), "GetPaM: Not formatted" );
-
- sal_uInt16 nCurIndex = 0;
- EditPaM aPaM;
- aPaM.SetNode( pPortion->GetNode() );
-
- 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;
-
- long nY = pPortion->GetFirstLineOffset();
-
- OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetPaM!" );
-
- EditLine* pLine = 0;
- for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
- {
- EditLine* pTmpLine = pPortion->GetLines().GetObject( nLine );
- nY += pTmpLine->GetHeight();
- if ( !aStatus.IsOutliner() )
- nY += nSBL;
- if ( nY > aDocPos.Y() )
- {
- pLine = pTmpLine;
- break; // correct Y-position is not of interest
- }
-
- nCurIndex = nCurIndex + pTmpLine->GetLen();
- }
-
- if ( !pLine ) // may happen only in the range of SA!
- {
-#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;
- }
-
- // If no line found, only just X-Position => Index
- nCurIndex = GetChar( pPortion, pLine, aDocPos.X(), bSmart );
- aPaM.SetIndex( nCurIndex );
-
- if ( nCurIndex && ( nCurIndex == pLine->GetEnd() ) &&
- ( pLine != pPortion->GetLines().GetObject( pPortion->GetLines().Count()-1) ) )
- {
- aPaM = CursorLeft( aPaM, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL );
- }
-
- return aPaM;
-}
-
-sal_uInt16 ImpEditEngine::GetChar( ParaPortion* pParaPortion, EditLine* pLine, long nXPos, sal_Bool bSmart )
-{
- OSL_ENSURE( pLine, "No line received: GetChar" );
-
- sal_uInt16 nChar = 0xFFFF;
- sal_uInt16 nCurIndex = pLine->GetStart();
-
-
- // Search best matching portion with GetPortionXOffset()
- for ( sal_uInt16 i = pLine->GetStartPortion(); i <= pLine->GetEndPortion(); i++ )
- {
- TextPortion* pPortion = pParaPortion->GetTextPortions().GetObject( i );
- long nXLeft = GetPortionXOffset( pParaPortion, pLine, i );
- long nXRight = nXLeft + pPortion->GetSize().Width();
- if ( ( nXLeft <= nXPos ) && ( nXRight >= nXPos ) )
- {
- nChar = nCurIndex;
-
- // Search within Portion...
-
- // Don't search within special portions...
- if ( pPortion->GetKind() != PORTIONKIND_TEXT )
- {
- // ...but check on which side
- if ( bSmart )
- {
- long nLeftDiff = nXPos-nXLeft;
- long nRightDiff = nXRight-nXPos;
- if ( nRightDiff < nLeftDiff )
- nChar++;
- }
- }
- else
- {
- sal_uInt16 nMax = pPortion->GetLen();
- sal_uInt16 nOffset = 0xFFFF;
- sal_uInt16 nTmpCurIndex = nChar - pLine->GetStart();
-
- long nXInPortion = nXPos - nXLeft;
- if ( pPortion->IsRightToLeft() )
- nXInPortion = nXRight - nXPos;
-
- // Search in Array...
- for ( sal_uInt16 x = 0; x < nMax; x++ )
- {
- long nTmpPosMax = pLine->GetCharPosArray().GetObject( nTmpCurIndex+x );
- if ( nTmpPosMax > nXInPortion )
- {
- // Check whether this or the previous...
- long nTmpPosMin = x ? pLine->GetCharPosArray().GetObject( nTmpCurIndex+x-1 ) : 0;
- long nDiffLeft = nXInPortion - nTmpPosMin;
- long nDiffRight = nTmpPosMax - nXInPortion;
- 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.
- // Skip all 0-positions, cheaper than using XBreakIterator:
- if ( nOffset < nMax )
- {
- const long nX = pLine->GetCharPosArray().GetObject(nOffset);
- while ( ( (nOffset+1) < nMax ) && ( pLine->GetCharPosArray().GetObject(nOffset+1) == nX ) )
- nOffset++;
- }
- break;
- }
- }
-
- // 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;
-
- OSL_ENSURE( nOffset <= nMax, "nOffset > nMax" );
-
- nChar = nChar + nOffset;
-
- // Check if index is within a cell:
- if ( nChar && ( nChar < pParaPortion->GetNode()->Len() ) )
- {
- EditPaM aPaM( pParaPortion->GetNode(), nChar+1 );
- sal_uInt16 nScriptType = GetScriptType( aPaM );
- if ( nScriptType == i18n::ScriptType::COMPLEX )
- {
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- sal_Int32 nCount = 1;
- lang::Locale aLocale = GetLocale( aPaM );
- sal_uInt16 nRight = (sal_uInt16)_xBI->nextCharacters( *pParaPortion->GetNode(), nChar, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount );
- sal_uInt16 nLeft = (sal_uInt16)_xBI->previousCharacters( *pParaPortion->GetNode(), nRight, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount );
- if ( ( nLeft != nChar ) && ( nRight != nChar ) )
- {
- nChar = ( Abs( nRight - nChar ) < Abs( nLeft - nChar ) ) ? nRight : nLeft;
- }
- }
- }
- }
- }
-
- nCurIndex = nCurIndex + pPortion->GetLen();
- }
-
- if ( nChar == 0xFFFF )
- {
- nChar = ( nXPos <= pLine->GetStartPosX() ) ? pLine->GetStart() : pLine->GetEnd();
- }
-
- return nChar;
-}
-
-Range ImpEditEngine::GetLineXPosStartEnd( ParaPortion* pParaPortion, EditLine* pLine )
-{
- Range aLineXPosStartEnd;
-
- sal_uInt16 nPara = GetEditDoc().GetPos( pParaPortion->GetNode() );
- if ( !IsRightToLeft( nPara ) )
- {
- aLineXPosStartEnd.Min() = pLine->GetStartPosX();
- aLineXPosStartEnd.Max() = pLine->GetStartPosX() + pLine->GetTextWidth();
- }
- else
- {
- aLineXPosStartEnd.Min() = GetPaperSize().Width() - ( pLine->GetStartPosX() + pLine->GetTextWidth() );
- aLineXPosStartEnd.Max() = GetPaperSize().Width() - pLine->GetStartPosX();
- }
-
-
- return aLineXPosStartEnd;
-}
-
-long ImpEditEngine::GetPortionXOffset( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion )
-{
- long nX = pLine->GetStartPosX();
-
- for ( sal_uInt16 i = pLine->GetStartPortion(); i < nTextPortion; i++ )
- {
- TextPortion* pPortion = pParaPortion->GetTextPortions().GetObject( i );
- switch ( pPortion->GetKind() )
- {
- case PORTIONKIND_FIELD:
- case PORTIONKIND_TEXT:
- case PORTIONKIND_HYPHENATOR:
- case PORTIONKIND_TAB:
- {
- nX += pPortion->GetSize().Width();
- }
- break;
- }
- }
-
- sal_uInt16 nPara = GetEditDoc().GetPos( pParaPortion->GetNode() );
- sal_Bool bR2LPara = IsRightToLeft( nPara );
-
- TextPortion* pDestPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
- if ( pDestPortion->GetKind() != PORTIONKIND_TAB )
- {
- if ( !bR2LPara && pDestPortion->GetRightToLeft() )
- {
- // Portions behind must be added, visual before this portion
- sal_uInt16 nTmpPortion = nTextPortion+1;
- while ( nTmpPortion <= pLine->GetEndPortion() )
- {
- TextPortion* pNextTextPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
- if ( pNextTextPortion->GetRightToLeft() && ( pNextTextPortion->GetKind() != PORTIONKIND_TAB ) )
- nX += pNextTextPortion->GetSize().Width();
- else
- break;
- nTmpPortion++;
- }
- // Portions before must be removed, visual behind this portion
- nTmpPortion = nTextPortion;
- while ( nTmpPortion > pLine->GetStartPortion() )
- {
- --nTmpPortion;
- TextPortion* pPrevTextPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
- if ( pPrevTextPortion->GetRightToLeft() && ( pPrevTextPortion->GetKind() != PORTIONKIND_TAB ) )
- nX -= pPrevTextPortion->GetSize().Width();
- else
- break;
- }
- }
- else if ( bR2LPara && !pDestPortion->IsRightToLeft() )
- {
- // Portions behind must be removed, visual behind this portion
- sal_uInt16 nTmpPortion = nTextPortion+1;
- while ( nTmpPortion <= pLine->GetEndPortion() )
- {
- TextPortion* pNextTextPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
- if ( !pNextTextPortion->IsRightToLeft() && ( pNextTextPortion->GetKind() != PORTIONKIND_TAB ) )
- nX += pNextTextPortion->GetSize().Width();
- else
- break;
- nTmpPortion++;
- }
- // Portions before must be added, visual before this portion
- nTmpPortion = nTextPortion;
- while ( nTmpPortion > pLine->GetStartPortion() )
- {
- --nTmpPortion;
- TextPortion* pPrevTextPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
- if ( !pPrevTextPortion->IsRightToLeft() && ( pPrevTextPortion->GetKind() != PORTIONKIND_TAB ) )
- nX -= pPrevTextPortion->GetSize().Width();
- else
- break;
- }
- }
- }
- if ( bR2LPara )
- {
- // Switch X postions...
- 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();
- }
-
- return nX;
-}
-
-long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, sal_Bool bPreferPortionStart )
-{
- 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:
- if ( nIndex == pLine->GetStart() )
- bDoPreferPortionStart = sal_True;
- else if ( nIndex == pLine->GetEnd() )
- bDoPreferPortionStart = sal_False;
-
- sal_uInt16 nTextPortionStart = 0;
- sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( nIndex, nTextPortionStart, bDoPreferPortionStart );
-
- OSL_ENSURE( ( nTextPortion >= pLine->GetStartPortion() ) && ( nTextPortion <= pLine->GetEndPortion() ), "GetXPos: Portion not in current line! " );
-
- TextPortion* pPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion );
-
- long nX = GetPortionXOffset( pParaPortion, pLine, nTextPortion );
-
- // calc text width, portion size may include CJK/CTL spacing...
- // But the array migh not be init yet, if using text ranger this method is called within CreateLines()...
- long nPortionTextWidth = pPortion->GetSize().Width();
- if ( ( pPortion->GetKind() == PORTIONKIND_TEXT ) && pPortion->GetLen() && !GetTextRanger() )
- nPortionTextWidth = pLine->GetCharPosArray().GetObject( nTextPortionStart + pPortion->GetLen() - 1 - pLine->GetStart() );
-
- if ( nTextPortionStart != nIndex )
- {
- // Search within portion...
- if ( nIndex == ( nTextPortionStart + pPortion->GetLen() ) )
- {
- // End of Portion
- if ( pPortion->GetKind() == PORTIONKIND_TAB )
- {
- if ( (nTextPortion+1) < pParaPortion->GetTextPortions().Count() )
- {
- TextPortion* pNextPortion = pParaPortion->GetTextPortions().GetObject( nTextPortion+1 );
- if ( pNextPortion->GetKind() != PORTIONKIND_TAB )
- {
- if ( !bPreferPortionStart )
- nX = GetXPos( pParaPortion, pLine, nIndex, sal_True );
- else if ( !IsRightToLeft( GetEditDoc().GetPos( pParaPortion->GetNode() ) ) )
- nX += nPortionTextWidth;
- }
- }
- else if ( !IsRightToLeft( GetEditDoc().GetPos( pParaPortion->GetNode() ) ) )
- {
- nX += nPortionTextWidth;
- }
- }
- else if ( !pPortion->IsRightToLeft() )
- {
- nX += nPortionTextWidth;
- }
- }
- else if ( pPortion->GetKind() == PORTIONKIND_TEXT )
- {
- 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() )
- {
- sal_uInt16 nPos = nIndex - 1 - pLine->GetStart();
- if( nPos >= pLine->GetCharPosArray().Count() )
- {
- nPos = pLine->GetCharPosArray().Count()-1;
- OSL_FAIL("svx::ImpEditEngine::GetXPos(), index out of range!");
- }
-
- // old code restored see #i112788 (which leaves #i74188 unfixed again)
- long nPosInPortion = pLine->GetCharPosArray().GetObject( nPos );
-
- if ( !pPortion->IsRightToLeft() )
- {
- nX += nPosInPortion;
- }
- else
- {
- nX += nPortionTextWidth - nPosInPortion;
- }
-
- if ( pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed )
- {
- nX += pPortion->GetExtraInfos()->nPortionOffsetX;
- if ( pPortion->GetExtraInfos()->nAsianCompressionTypes & CHAR_PUNCTUATIONRIGHT )
- {
- sal_uInt8 nType = GetCharTypeForCompression( pParaPortion->GetNode()->GetChar( nIndex ) );
- if ( nType == CHAR_PUNCTUATIONRIGHT )
- {
- sal_uInt16 n = nIndex - nTextPortionStart;
- const sal_Int32* pDXArray = pLine->GetCharPosArray().GetData()+( nTextPortionStart-pLine->GetStart() );
- sal_Int32 nCharWidth = ( ( (n+1) < pPortion->GetLen() ) ? pDXArray[n] : pPortion->GetSize().Width() )
- - ( n ? pDXArray[n-1] : 0 );
- if ( (n+1) < pPortion->GetLen() )
- {
- // smaller, when char behind is CHAR_PUNCTUATIONRIGHT also
- nType = GetCharTypeForCompression( pParaPortion->GetNode()->GetChar( nIndex+1 ) );
- if ( nType == CHAR_PUNCTUATIONRIGHT )
- {
- sal_Int32 nNextCharWidth = ( ( (n+2) < pPortion->GetLen() ) ? pDXArray[n+1] : pPortion->GetSize().Width() )
- - pDXArray[n];
- sal_Int32 nCompressed = nNextCharWidth/2;
- nCompressed *= pPortion->GetExtraInfos()->nMaxCompression100thPercent;
- nCompressed /= 10000;
- nCharWidth += nCompressed;
- }
- }
- else
- {
- nCharWidth *= 2; // last char pos to portion end is only compressed size
- }
- nX += nCharWidth/2; // 50% compression
- }
- }
- }
- }
- }
- }
- else // if ( nIndex == pLine->GetStart() )
- {
- if ( pPortion->IsRightToLeft() )
- {
- nX += nPortionTextWidth;
- }
- }
-
- return nX;
-}
-
-void ImpEditEngine::CalcHeight( ParaPortion* pPortion )
-{
- pPortion->nHeight = 0;
- pPortion->nFirstLineOffset = 0;
-
- if ( pPortion->IsVisible() )
- {
- OSL_ENSURE( pPortion->GetLines().Count(), "Paragraph with no lines in ParaPortion::CalcHeight" );
- for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
- pPortion->nHeight += pPortion->GetLines().GetObject( nLine )->GetHeight();
-
- if ( !aStatus.IsOutliner() )
- {
- const SvxULSpaceItem& rULItem = (const SvxULSpaceItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE );
- const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL );
- sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0;
-
- if ( nSBL )
- {
- if ( pPortion->GetLines().Count() > 1 )
- pPortion->nHeight += ( pPortion->GetLines().Count() - 1 ) * nSBL;
- if ( aStatus.ULSpaceSummation() )
- pPortion->nHeight += nSBL;
- }
-
- sal_uInt16 nPortion = GetParaPortions().GetPos( pPortion );
- if ( nPortion || aStatus.ULSpaceFirstParagraph() )
- {
- sal_uInt16 nUpper = GetYValue( rULItem.GetUpper() );
- pPortion->nHeight += nUpper;
- pPortion->nFirstLineOffset = nUpper;
- }
-
- if ( ( nPortion != (GetParaPortions().Count()-1) ) )
- {
- pPortion->nHeight += GetYValue( rULItem.GetLower() ); // not in the last
- }
-
-
- if ( nPortion && !aStatus.ULSpaceSummation() )
- {
- ParaPortion* pPrev = GetParaPortions().SaveGetObject( nPortion-1 );
- const SvxULSpaceItem& rPrevULItem = (const SvxULSpaceItem&)pPrev->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE );
- const SvxLineSpacingItem& rPrevLSItem = (const SvxLineSpacingItem&)pPrev->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL );
-
- // 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.
-
- // check if distance by LineSpacing > Upper:
- sal_uInt16 nExtraSpace = GetYValue( lcl_CalcExtraSpace( pPortion, rLSItem ) );
- if ( nExtraSpace > pPortion->nFirstLineOffset )
- {
- // Paragraph becomes 'bigger':
- pPortion->nHeight += ( nExtraSpace - pPortion->nFirstLineOffset );
- pPortion->nFirstLineOffset = nExtraSpace;
- }
-
- // Determine nFirstLineOffset now f(pNode) => now f(pNode, pPrev):
- sal_uInt16 nPrevLower = GetYValue( rPrevULItem.GetLower() );
-
- // This PrevLower is still in the height of PrevPortion ...
- if ( nPrevLower > pPortion->nFirstLineOffset )
- {
- // Paragraph is 'small':
- pPortion->nHeight -= pPortion->nFirstLineOffset;
- pPortion->nFirstLineOffset = 0;
- }
- else if ( nPrevLower )
- {
- // Paragraph becomes 'somewhat smaller':
- pPortion->nHeight -= nPrevLower;
- pPortion->nFirstLineOffset =
- pPortion->nFirstLineOffset - nPrevLower;
- }
- // 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;
- // Paragraph becomes 'bigger', 'grows' downwards:
- if ( nMoreLower > pPortion->nFirstLineOffset )
- {
- pPortion->nHeight += ( nMoreLower - pPortion->nFirstLineOffset );
- pPortion->nFirstLineOffset = nMoreLower;
- }
- }
- }
- }
- }
- }
-}
-
-Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex, sal_uInt16 nFlags )
-{
- OSL_ENSURE( pPortion->IsVisible(), "Why GetEditCursor() for an invisible paragraph?" );
- OSL_ENSURE( IsFormatted() || GetTextRanger(), "GetEditCursor: Not formatted" );
-
- /*
- GETCRSR_ENDOFLINE: If after the last character of a wrapped line, remaining
- at the end of the line, not the beginning of the next one.
- Purpose: - END => really after the last character
- - Selection....
- */
-
- long nY = pPortion->GetFirstLineOffset();
-
- const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL );
- sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX )
- ? GetYValue( rLSItem.GetInterLineSpace() ) : 0;
-
- sal_uInt16 nCurIndex = 0;
- 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++ )
- {
- EditLine* pTmpLine = pPortion->GetLines().GetObject( nLine );
- if ( ( pTmpLine->GetStart() == nIndex ) || ( pTmpLine->IsIn( nIndex, bEOL ) ) )
- {
- pLine = pTmpLine;
- break;
- }
-
- nCurIndex = nCurIndex + pTmpLine->GetLen();
- nY += pTmpLine->GetHeight();
- if ( !aStatus.IsOutliner() )
- nY += nSBL;
- }
- if ( !pLine )
- {
- // 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();
- if ( !aStatus.IsOutliner() )
- nY -= nSBL;
- nCurIndex = nCurIndex - pLine->GetLen();
- }
-
- Rectangle aEditCursor;
-
- aEditCursor.Top() = nY;
- nY += pLine->GetHeight();
- aEditCursor.Bottom() = nY-1;
-
- // Search within the line...
- long nX;
-
- if ( ( nIndex == pLine->GetStart() ) && ( nFlags & GETCRSR_STARTOFLINE ) )
- {
- Range aXRange = GetLineXPosStartEnd( pPortion, pLine );
- nX = !IsRightToLeft( GetEditDoc().GetPos( pPortion->GetNode() ) ) ? aXRange.Min() : aXRange.Max();
- }
- else if ( ( nIndex == pLine->GetEnd() ) && ( nFlags & GETCRSR_ENDOFLINE ) )
- {
- Range aXRange = GetLineXPosStartEnd( pPortion, pLine );
- nX = !IsRightToLeft( GetEditDoc().GetPos( pPortion->GetNode() ) ) ? aXRange.Max() : aXRange.Min();
- }
- else
- {
- nX = GetXPos( pPortion, pLine, nIndex, ( nFlags & GETCRSR_PREFERPORTIONSTART ) ? sal_True : sal_False );
- }
-
- aEditCursor.Left() = aEditCursor.Right() = nX;
-
- if ( nFlags & GETCRSR_TXTONLY )
- aEditCursor.Top() = aEditCursor.Bottom() - pLine->GetTxtHeight() + 1;
- else
- aEditCursor.Top() = aEditCursor.Bottom() - Min( pLine->GetTxtHeight(), pLine->GetHeight() ) + 1;
-
- return aEditCursor;
-}
-
-void ImpEditEngine::SetValidPaperSize( const Size& rNewSz )
-{
- aPaperSize = rNewSz;
-
- long nMinWidth = aStatus.AutoPageWidth() ? aMinAutoPaperSize.Width() : 0;
- long nMaxWidth = aStatus.AutoPageWidth() ? aMaxAutoPaperSize.Width() : 0x7FFFFFFF;
- long nMinHeight = aStatus.AutoPageHeight() ? aMinAutoPaperSize.Height() : 0;
- long nMaxHeight = aStatus.AutoPageHeight() ? aMaxAutoPaperSize.Height() : 0x7FFFFFFF;
-
- // Minimum/Maximum width:
- if ( aPaperSize.Width() < nMinWidth )
- aPaperSize.Width() = nMinWidth;
- else if ( aPaperSize.Width() > nMaxWidth )
- aPaperSize.Width() = nMaxWidth;
-
- // Minimum/Maximum height:
- if ( aPaperSize.Height() < nMinHeight )
- aPaperSize.Height() = nMinHeight;
- else if ( aPaperSize.Height() > nMaxHeight )
- aPaperSize.Height() = nMaxHeight;
-}
-
-void ImpEditEngine::IndentBlock( EditView* pEditView, sal_Bool bRight )
-{
- ESelection aESel( CreateESel( pEditView->pImpEditView->GetEditSelection() ) );
- aESel.Adjust();
-
- // Only if more selected Paragraphs ...
- if ( aESel.nEndPara > aESel.nStartPara )
- {
- ESelection aNewSel = aESel;
- aNewSel.nStartPos = 0;
- aNewSel.nEndPos = 0xFFFF;
-
- if ( aESel.nEndPos == 0 )
- {
- aESel.nEndPara--; // then not this paragraph ...
- aNewSel.nEndPos = 0;
- }
-
- pEditView->pImpEditView->DrawSelection();
- pEditView->pImpEditView->SetEditSelection(
- pEditView->pImpEditView->GetEditSelection().Max() );
- UndoActionStart( bRight ? EDITUNDO_INDENTBLOCK : EDITUNDO_UNINDENTBLOCK );
-
- for ( sal_uInt16 nPara = aESel.nStartPara; nPara <= aESel.nEndPara; nPara++ )
- {
- ContentNode* pNode = GetEditDoc().GetObject( nPara );
- if ( bRight )
- {
- // Insert Tabs
- EditPaM aPaM( pNode, 0 );
- InsertTab( aPaM );
- }
- else
- {
- // Remove Tabs
- EditCharAttrib* pFeature = pNode->GetCharAttribs().FindFeature( 0 );
- if ( pFeature && ( pFeature->GetStart() == 0 ) &&
- ( pFeature->GetItem()->Which() == EE_FEATURE_TAB ) )
- {
- EditPaM aStartPaM( pNode, 0 );
- EditPaM aEndPaM( pNode, 1 );
- ImpDeleteSelection( EditSelection( aStartPaM, aEndPaM ) );
- }
- }
- }
-
- UndoActionEnd( bRight ? EDITUNDO_INDENTBLOCK : EDITUNDO_UNINDENTBLOCK );
- UpdateSelections();
- FormatAndUpdate( pEditView );
-
- ContentNode* pLastNode = GetEditDoc().GetObject( aNewSel.nEndPara );
- if ( pLastNode->Len() < aNewSel.nEndPos )
- aNewSel.nEndPos = pLastNode->Len();
- pEditView->pImpEditView->SetEditSelection( CreateSel( aNewSel ) );
- pEditView->pImpEditView->DrawSelection();
- pEditView->pImpEditView->ShowCursor( sal_False, sal_True );
- }
-}
-
-rtl::Reference<SvxForbiddenCharactersTable> ImpEditEngine::GetForbiddenCharsTable( sal_Bool bGetInternal ) const
-{
- rtl::Reference<SvxForbiddenCharactersTable> xF = xForbiddenCharsTable;
- if ( !xF.is() && bGetInternal )
- xF = EE_DLL().GetGlobalData()->GetForbiddenCharsTable();
- return xF;
-}
-
-void ImpEditEngine::SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars )
-{
- EE_DLL().GetGlobalData()->SetForbiddenCharsTable( xForbiddenChars );
-}
-
-svtools::ColorConfig& ImpEditEngine::GetColorConfig()
-{
- if ( !pColorConfig )
- pColorConfig = new svtools::ColorConfig;
-
- return *pColorConfig;
-}
-
-sal_Bool ImpEditEngine::IsVisualCursorTravelingEnabled()
-{
- sal_Bool bVisualCursorTravaling = sal_False;
-
- if( !pCTLOptions )
- pCTLOptions = new SvtCTLOptions;
-
- if ( pCTLOptions->IsCTLFontEnabled() && ( pCTLOptions->GetCTLCursorMovement() == SvtCTLOptions::MOVEMENT_VISUAL ) )
- {
- bVisualCursorTravaling = sal_True;
- }
-
- return bVisualCursorTravaling;
-
-}
-
-sal_Bool ImpEditEngine::DoVisualCursorTraveling( const ContentNode* )
-{
- // Don't check if it's necessary, because we also need it when leaving the paragraph
- return IsVisualCursorTravelingEnabled();
-}
-
-
-void ImpEditEngine::CallNotify( EENotify& rNotify )
-{
- if ( !nBlockNotifications )
- {
- GetNotifyHdl().Call( &rNotify );
- }
- else
- {
- EENotify* pNewNotify = new EENotify( rNotify );
- aNotifyCache.Insert( pNewNotify, aNotifyCache.Count() );
- }
-}
-
-void ImpEditEngine::EnterBlockNotifications()
-{
- if( !nBlockNotifications )
- {
- // #109864# Send out START notification immediately, to allow
- // external, non-queued events to be captured as well from
- // client side
- EENotify aNotify( EE_NOTIFY_BLOCKNOTIFICATION_START );
- aNotify.pEditEngine = GetEditEnginePtr();
- GetNotifyHdl().Call( &aNotify );
- }
-
- nBlockNotifications++;
-}
-
-void ImpEditEngine::LeaveBlockNotifications()
-{
- OSL_ENSURE( nBlockNotifications, "LeaveBlockNotifications - Why?" );
-
- nBlockNotifications--;
- if ( !nBlockNotifications )
- {
- // Call blocked notify events...
- while ( aNotifyCache.Count() )
- {
- EENotify* pNotify = aNotifyCache[0];
- // Remove from list before calling, maybe we enter LeaveBlockNotifications while calling the handler...
- aNotifyCache.Remove( 0 );
- GetNotifyHdl().Call( pNotify );
- delete pNotify;
- }
-
- EENotify aNotify( EE_NOTIFY_BLOCKNOTIFICATION_END );
- aNotify.pEditEngine = GetEditEnginePtr();
- GetNotifyHdl().Call( &aNotify );
- }
-}
-
-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
deleted file mode 100644
index 74eb81ad91..0000000000
--- a/editeng/source/editeng/impedit3.cxx
+++ /dev/null
@@ -1,4653 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/metaact.hxx>
-#include <vcl/gdimtf.hxx>
-
-#define _SVSTDARR_sal_uIt16S
-#include <svl/svstdarr.hxx>
-
-#include <vcl/wrkwin.hxx>
-#include <editeng/adjitem.hxx>
-#include <editeng/tstpitem.hxx>
-#include <editeng/lspcitem.hxx>
-#include <editeng/flditem.hxx>
-#include <impedit.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/txtrange.hxx>
-#include <editeng/cscoitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/scriptspaceitem.hxx>
-#include <editeng/charscaleitem.hxx>
-#include <editeng/numitem.hxx>
-#include <editeng/justifyitem.hxx>
-
-#include <svtools/colorcfg.hxx>
-#include <svl/ctloptions.hxx>
-
-#include <editeng/forbiddencharacterstable.hxx>
-
-#include <unotools/localedatawrapper.hxx>
-
-#include <editeng/unolingu.hxx>
-
-#include <math.h>
-#include <vcl/svapp.hxx>
-#include <vcl/metric.hxx>
-#include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/text/CharacterCompressionType.hpp>
-#include <vcl/pdfextoutdevdata.hxx>
-#include <i18npool/mslangid.hxx>
-
-#include <comphelper/processfactory.hxx>
-
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::linguistic2;
-
-SV_DECL_VARARR_SORT( SortedPositions, sal_uInt32, 16, 8 )
-SV_IMPL_VARARR_SORT( SortedPositions, sal_uInt32 );
-
-#define CH_HYPH '-'
-
-#define RESDIFF 10
-
-#define WRONG_SHOW_MIN 5
-#define WRONG_SHOW_SMALL 11
-#define WRONG_SHOW_MEDIUM 15
-
-struct TabInfo
-{
- sal_Bool bValid;
-
- SvxTabStop aTabStop;
- xub_StrLen nCharPos;
- sal_uInt16 nTabPortion;
- long nStartPosX;
- long nTabPos;
-
- TabInfo() { bValid = sal_False; }
-};
-
-Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin )
-{
- double nRealOrientation = nOrientation*F_PI1800;
- double nCos = cos( nRealOrientation );
- double nSin = sin( nRealOrientation );
-
- Point aRotatedPos;
- Point aTranslatedPos( rPoint );
-
- // Translation
- aTranslatedPos -= rOrigin;
-
- // Rotation...
- aRotatedPos.X() = (long) ( nCos*aTranslatedPos.X() + nSin*aTranslatedPos.Y() );
- aRotatedPos.Y() = (long) - ( nSin*aTranslatedPos.X() - nCos*aTranslatedPos.Y() );
- aTranslatedPos = aRotatedPos;
-
- // Translation...
- aTranslatedPos += rOrigin;
- return aTranslatedPos;
-}
-
-sal_uInt8 GetCharTypeForCompression( xub_Unicode cChar )
-{
- switch ( cChar )
- {
- case 0x3008: case 0x300A: case 0x300C: case 0x300E:
- case 0x3010: case 0x3014: case 0x3016: case 0x3018:
- case 0x301A: case 0x301D:
- {
- return CHAR_PUNCTUATIONRIGHT;
- }
- case 0x3001: case 0x3002: case 0x3009: case 0x300B:
- case 0x300D: case 0x300F: case 0x3011: case 0x3015:
- case 0x3017: case 0x3019: case 0x301B: case 0x301E:
- case 0x301F:
- {
- return CHAR_PUNCTUATIONLEFT;
- }
- default:
- {
- return ( ( 0x3040 <= cChar ) && ( 0x3100 > cChar ) ) ? CHAR_KANA : CHAR_NORMAL;
- }
- }
-}
-
-void lcl_DrawRedLines(
- OutputDevice* pOutDev,
- long nFontHeight,
- const Point& rPnt,
- sal_uInt16 nIndex,
- sal_uInt16 nMaxEnd,
- const sal_Int32* pDXArray,
- WrongList* pWrongs,
- short nOrientation,
- const Point& rOrigin,
- sal_Bool bVertical,
- sal_Bool bIsRightToLeft )
-{
- // But only if font is not too small ...
- long nHght = pOutDev->LogicToPixel( Size( 0, nFontHeight ) ).Height();
- if( WRONG_SHOW_MIN < nHght )
- {
- sal_uInt16 nStyle;
- if( WRONG_SHOW_MEDIUM < nHght )
- nStyle = WAVE_NORMAL;
- else if( WRONG_SHOW_SMALL < nHght )
- nStyle = WAVE_SMALL;
- else
- nStyle = WAVE_FLAT;
-
- sal_uInt16 nEnd, nStart = nIndex;
- sal_Bool bWrong = pWrongs->NextWrong( nStart, nEnd );
- while ( bWrong )
- {
- if ( nStart >= nMaxEnd )
- break;
-
- if ( nStart < nIndex ) // Corrected
- nStart = nIndex;
- if ( nEnd > nMaxEnd )
- nEnd = nMaxEnd;
- Point aPnt1( rPnt );
- if ( bVertical && ( nStyle != WAVE_FLAT ) )
- {
- // VCL doesn't know that the text is vertical, and is manipulating
- // the positions a little bit in y direction...
- long nOnePixel = pOutDev->PixelToLogic( Size( 0, 1 ) ).Height();
- long nCorrect = ( nStyle == WAVE_NORMAL ) ? 2*nOnePixel : nOnePixel;
- aPnt1.Y() -= nCorrect;
- aPnt1.X() -= nCorrect;
- }
- if ( nStart > nIndex )
- {
- if ( !bVertical )
- {
- // since for RTL portions rPnt is on the visual right end of the portion
- // (i.e. at the start of the first RTL char) we need to subtract the offset
- // for RTL portions...
- aPnt1.X() += (bIsRightToLeft ? -1 : 1) * pDXArray[ nStart - nIndex - 1 ];
- }
- else
- aPnt1.Y() += pDXArray[ nStart - nIndex - 1 ];
- }
- Point aPnt2( rPnt );
- DBG_ASSERT( nEnd > nIndex, "RedLine: aPnt2?" );
- if ( !bVertical )
- {
- // since for RTL portions rPnt is on the visual right end of the portion
- // (i.e. at the start of the first RTL char) we need to subtract the offset
- // for RTL portions...
- aPnt2.X() += (bIsRightToLeft ? -1 : 1) * pDXArray[ nEnd - nIndex - 1 ];
- }
- else
- aPnt2.Y() += pDXArray[ nEnd - nIndex - 1 ];
- if ( nOrientation )
- {
- aPnt1 = Rotate( aPnt1, nOrientation, rOrigin );
- aPnt2 = Rotate( aPnt2, nOrientation, rOrigin );
- }
-
- pOutDev->DrawWaveLine( aPnt1, aPnt2, nStyle );
-
- nStart = nEnd+1;
- if ( nEnd < nMaxEnd )
- bWrong = pWrongs->NextWrong( nStart, nEnd );
- else
- bWrong = sal_False;
- }
- }
-}
-
-Point lcl_ImplCalcRotatedPos( Point rPos, Point rOrigin, double nSin, double nCos )
-{
- Point aRotatedPos;
- // Translation...
- Point aTranslatedPos( rPos);
- aTranslatedPos -= rOrigin;
-
- aRotatedPos.X() = (long) ( nCos*aTranslatedPos.X() + nSin*aTranslatedPos.Y() );
- aRotatedPos.Y() = (long) - ( nSin*aTranslatedPos.X() - nCos*aTranslatedPos.Y() );
- aTranslatedPos = aRotatedPos;
- // Translation...
- aTranslatedPos += rOrigin;
-
- return aTranslatedPos;
-}
-
-sal_Bool lcl_IsLigature( xub_Unicode cCh, xub_Unicode cNextCh ) // For Kashidas from sw/source/core/text/porlay.txt
-{
- // Lam + Alef
- return ( 0x644 == cCh && 0x627 == cNextCh ) ||
- // Beh + Reh
- ( 0x628 == cCh && 0x631 == cNextCh );
-}
-
-sal_Bool lcl_ConnectToPrev( xub_Unicode cCh, xub_Unicode cPrevCh ) // For Kashidas from sw/source/core/text/porlay.txt
-{
- // Alef, Dal, Thal, Reh, Zain, and Waw do not connect to the left
- sal_Bool bRet = 0x627 != cPrevCh && 0x62F != cPrevCh && 0x630 != cPrevCh &&
- 0x631 != cPrevCh && 0x632 != cPrevCh && 0x648 != cPrevCh;
-
- // check for ligatures cPrevChar + cChar
- if ( bRet )
- bRet = ! lcl_IsLigature( cPrevCh, cCh );
-
- return bRet;
-}
-
-
-// ----------------------------------------------------------------------
-// class ImpEditEngine
-// ----------------------------------------------------------------------
-void ImpEditEngine::UpdateViews( EditView* pCurView )
-{
- if ( !GetUpdateMode() || IsFormatting() || aInvalidRec.IsEmpty() )
- return;
-
- DBG_ASSERT( IsFormatted(), "UpdateViews: Doc not formatted!" );
-
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
- {
- EditView* pView = aEditViews[nView];
- DBG_CHKOBJ( pView, EditView, 0 );
- pView->HideCursor();
-
- Rectangle aClipRec( aInvalidRec );
- Rectangle aVisArea( pView->GetVisArea() );
- aClipRec.Intersection( aVisArea );
-
- if ( !aClipRec.IsEmpty() )
- {
- // convert to window coordinates ....
- aClipRec = pView->pImpEditView->GetWindowPos( aClipRec );
-
- if ( ( pView == pCurView ) )
- Paint( pView->pImpEditView, aClipRec, sal_True );
- else
- pView->GetWindow()->Invalidate( aClipRec );
- }
- }
-
- if ( pCurView )
- {
- sal_Bool bGotoCursor = pCurView->pImpEditView->DoAutoScroll();
- pCurView->ShowCursor( bGotoCursor );
- }
-
- aInvalidRec = Rectangle();
- CallStatusHdl();
-}
-
-IMPL_LINK( ImpEditEngine, OnlineSpellHdl, Timer *, EMPTYARG )
-{
- if ( !Application::AnyInput( INPUT_KEYBOARD ) && GetUpdateMode() && IsFormatted() )
- DoOnlineSpelling();
- else
- aOnlineSpellTimer.Start();
-
- return 0;
-}
-
-IMPL_LINK_INLINE_START( ImpEditEngine, IdleFormatHdl, Timer *, EMPTYARG )
-{
- aIdleFormatter.ResetRestarts();
-
- // #i97146# check if that view is still available
- // else probably the idle format timer fired while we're already
- // downing
- EditView* pView = aIdleFormatter.GetView();
- for( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
- {
- if( aEditViews[nView] == pView )
- {
- FormatAndUpdate( pView );
- break;
- }
- }
- return 0;
-}
-IMPL_LINK_INLINE_END( ImpEditEngine, IdleFormatHdl, Timer *, EMPTYARG )
-
-void ImpEditEngine::CheckIdleFormatter()
-{
- aIdleFormatter.ForceTimeout();
- // If not idle, but still not formatted:
- if ( !IsFormatted() )
- FormatDoc();
-}
-
-void ImpEditEngine::FormatFullDoc()
-{
- for ( sal_uInt16 nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ )
- GetParaPortions()[nPortion]->MarkSelectionInvalid( 0, GetParaPortions()[nPortion]->GetNode()->Len() );
- FormatDoc();
-}
-
-void ImpEditEngine::FormatDoc()
-{
- if ( !GetUpdateMode() || IsFormatting() )
- return;
-
- EnterBlockNotifications();
-
- bIsFormatting = sal_True;
-
- // Then I can also start the spell-timer ...
- if ( GetStatus().DoOnlineSpelling() )
- StartOnlineSpellTimer();
-
- long nY = 0;
- sal_Bool bGrow = sal_False;
-
- Font aOldFont( GetRefDevice()->GetFont() );
-
- // Here already, so that not always in CreateLines...
- sal_Bool bMapChanged = ImpCheckRefMapMode();
-
- aInvalidRec = Rectangle(); // make empty
- for ( sal_uInt16 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
- {
- ParaPortion* pParaPortion = GetParaPortions().GetObject( nPara );
- if ( pParaPortion->MustRepaint() || ( pParaPortion->IsInvalid() && pParaPortion->IsVisible() ) )
- {
- if ( pParaPortion->IsInvalid() )
- {
- sal_Bool bChangedByDerivedClass = GetEditEnginePtr()->FormattingParagraph( nPara );
- if ( bChangedByDerivedClass )
- {
- pParaPortion->GetTextPortions().Reset();
- pParaPortion->MarkSelectionInvalid( 0, pParaPortion->GetNode()->Len() );
- }
- }
- // No formatting should be necessary for MustRepaint()!
- if ( ( pParaPortion->MustRepaint() && !pParaPortion->IsInvalid() )
- || CreateLines( nPara, nY ) )
- {
- if ( !bGrow && GetTextRanger() )
- {
- // 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 );
- pPP->MarkSelectionInvalid( 0, pPP->GetNode()->Len() );
- pPP->GetLines().Reset();
- }
- }
- bGrow = sal_True;
- if ( IsCallParaInsertedOrDeleted() )
- GetEditEnginePtr()->ParagraphHeightChanged( nPara );
- pParaPortion->SetMustRepaint( sal_False );
- }
-
- // InvalidRec set only once...
- if ( aInvalidRec.IsEmpty() )
- {
- // 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() ),
- Size( nWidth, aInvRange.Len() ) );
- }
- else
- {
- aInvalidRec.Bottom() = nY + pParaPortion->GetHeight();
- }
- }
- else if ( bGrow )
- {
- aInvalidRec.Bottom() = nY + pParaPortion->GetHeight();
- }
- nY += pParaPortion->GetHeight();
- }
-
- // One can also get into the formatting through UpdateMode ON=>OFF=>ON...
- // enable optimization first after Vobis delivery ...
- {
- sal_uInt32 nNewHeightNTP;
- sal_uInt32 nNewHeight = CalcTextHeight( &nNewHeightNTP );
- long nDiff = nNewHeight - nCurTextHeight;
- if ( nDiff )
- aStatus.GetStatusWord() |= !IsVertical() ? EE_STAT_TEXTHEIGHTCHANGED : EE_STAT_TEXTWIDTHCHANGED;
- if ( nNewHeight < nCurTextHeight )
- {
- aInvalidRec.Bottom() = (long)Max( nNewHeight, nCurTextHeight );
- if ( aInvalidRec.IsEmpty() )
- {
- aInvalidRec.Top() = 0;
- // 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();
- else if ( nDiff )
- {
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
- {
- EditView* pView = aEditViews[nView];
- ImpEditView* pImpView = pView->pImpEditView;
- if ( pImpView->DoAutoHeight() )
- {
- Size aSz( pImpView->GetOutputArea().GetWidth(), nCurTextHeight );
- if ( aSz.Height() > aMaxAutoPaperSize.Height() )
- aSz.Height() = aMaxAutoPaperSize.Height();
- else if ( aSz.Height() < aMinAutoPaperSize.Height() )
- aSz.Height() = aMinAutoPaperSize.Height();
- pImpView->ResetOutputArea( Rectangle(
- pImpView->GetOutputArea().TopLeft(), aSz ) );
- }
- }
- }
- }
-
- if ( aStatus.DoRestoreFont() )
- GetRefDevice()->SetFont( aOldFont );
- bIsFormatting = sal_False;
- bFormatted = sal_True;
-
- if ( bMapChanged )
- GetRefDevice()->Pop();
-
- CallStatusHdl(); // If Modified...
-
- LeaveBlockNotifications();
-}
-
-sal_Bool ImpEditEngine::ImpCheckRefMapMode()
-{
- sal_Bool bChange = sal_False;
-
- if ( aStatus.DoFormat100() )
- {
- MapMode aMapMode( GetRefDevice()->GetMapMode() );
- if ( aMapMode.GetScaleX().GetNumerator() != aMapMode.GetScaleX().GetDenominator() )
- bChange = sal_True;
- else if ( aMapMode.GetScaleY().GetNumerator() != aMapMode.GetScaleY().GetDenominator() )
- bChange = sal_True;
-
- if ( bChange )
- {
- Fraction Scale1( 1, 1 );
- aMapMode.SetScaleX( Scale1 );
- aMapMode.SetScaleY( Scale1 );
- GetRefDevice()->Push();
- GetRefDevice()->SetMapMode( aMapMode );
- }
- }
-
- return bChange;
-}
-
-void ImpEditEngine::CheckAutoPageSize()
-{
- Size aPrevPaperSize( GetPaperSize() );
- if ( GetStatus().AutoPageWidth() )
- aPaperSize.Width() = (long) !IsVertical() ? CalcTextWidth( sal_True ) : GetTextHeight();
- if ( GetStatus().AutoPageHeight() )
- aPaperSize.Height() = (long) !IsVertical() ? GetTextHeight() : CalcTextWidth( sal_True );
-
- SetValidPaperSize( aPaperSize ); // consider Min, Max
-
- if ( aPaperSize != aPrevPaperSize )
- {
- if ( ( !IsVertical() && ( aPaperSize.Width() != aPrevPaperSize.Width() ) )
- || ( IsVertical() && ( aPaperSize.Height() != aPrevPaperSize.Height() ) ) )
- {
- // 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++ )
- {
- // 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: For AutoPageSize no TextRange!
- }
- }
- }
-
- Size aInvSize = aPaperSize;
- if ( aPaperSize.Width() < aPrevPaperSize.Width() )
- aInvSize.Width() = aPrevPaperSize.Width();
- if ( aPaperSize.Height() < aPrevPaperSize.Height() )
- aInvSize.Height() = aPrevPaperSize.Height();
-
- Size aSz( aInvSize );
- if ( IsVertical() )
- {
- aSz.Width() = aInvSize.Height();
- aSz.Height() = aInvSize.Width();
- }
- aInvalidRec = Rectangle( Point(), aSz );
-
-
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
- {
- EditView* pView = aEditViews[nView];
- pView->pImpEditView->RecalcOutputArea();
- }
- }
-}
-
-static sal_Int32 ImplCalculateFontIndependentLineSpacing( const sal_Int32 nFontHeight )
-{
- return ( nFontHeight * 12 ) / 10; // + 20%
-}
-
-sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
-{
- ParaPortion* pParaPortion = GetParaPortions().GetObject( nPara );
-
- // 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();
-
- // ---------------------------------------------------------------
- // Fast special treatment for empty paragraphs ...
- // ---------------------------------------------------------------
- if ( ( pParaPortion->GetNode()->Len() == 0 ) && !GetTextRanger() )
- {
- // fast special treatment ...
- if ( pParaPortion->GetTextPortions().Count() )
- pParaPortion->GetTextPortions().Reset();
- if ( pParaPortion->GetLines().Count() )
- pParaPortion->GetLines().Reset();
- CreateAndInsertEmptyLine( pParaPortion, nStartPosY );
- return FinishCreateLines( pParaPortion );
- }
-
- // ---------------------------------------------------------------
- // Initialization ......
- // ---------------------------------------------------------------
-
- // Always format for 100%:
- sal_Bool bMapChanged = ImpCheckRefMapMode();
-
- if ( pParaPortion->GetLines().Count() == 0 )
- {
- EditLine* pL = new EditLine;
- pParaPortion->GetLines().Insert( pL, 0 );
- }
-
- // ---------------------------------------------------------------
- // Get Paragraph attributes ......
- // ---------------------------------------------------------------
- ContentNode* const pNode = pParaPortion->GetNode();
-
- sal_Bool bRightToLeftPara = IsRightToLeft( nPara );
-
- SvxAdjust eJustification = GetJustification( nPara );
- sal_Bool bHyphenatePara = ((const SfxBoolItem&)pNode->GetContentAttribs().GetItem( EE_PARA_HYPHENATE )).GetValue();
- sal_Int32 nSpaceBefore = 0;
- sal_Int32 nMinLabelWidth = 0;
- sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth( pNode, &nSpaceBefore, &nMinLabelWidth );
- const SvxLRSpaceItem& rLRItem = GetLRSpaceItem( pNode );
- 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 short nInvalidDiff = pParaPortion->GetInvalidDiff();
- const sal_uInt16 nInvalidStart = pParaPortion->GetInvalidPosStart();
- const sal_uInt16 nInvalidEnd = nInvalidStart + Abs( nInvalidDiff );
-
- sal_Bool bQuickFormat = sal_False;
- if ( !bEmptyNodeWithPolygon && !HasScriptType( nPara, i18n::ScriptType::COMPLEX ) )
- {
- if ( ( pParaPortion->IsSimpleInvalid() ) && ( nInvalidDiff > 0 ) &&
- ( pNode->Search( CH_FEATURE, nInvalidStart ) > nInvalidEnd ) )
- {
- bQuickFormat = sal_True;
- }
- else if ( ( pParaPortion->IsSimpleInvalid() ) && ( nInvalidDiff < 0 ) )
- {
- // 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++ )
- {
- // 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 ) )
- {
- bQuickFormat = sal_False;
- break;
- }
- }
- }
- }
-
- // SW disables TEXT_LAYOUT_COMPLEX_DISABLED, so maybe I have to enable it...
-
- // Saving both layout mode and language (since I'm potentially changing both)
- GetRefDevice()->Push( PUSH_TEXTLAYOUTMODE|PUSH_TEXTLANGUAGE );
-
- ImplInitLayoutMode( GetRefDevice(), nPara, 0xFFFF );
-
- sal_uInt16 nRealInvalidStart = nInvalidStart;
-
- if ( bEmptyNodeWithPolygon )
- {
- TextPortion* pDummyPortion = new TextPortion( 0 );
- pParaPortion->GetTextPortions().Reset();
- pParaPortion->GetTextPortions().Insert( pDummyPortion, 0 );
- }
- else if ( bQuickFormat )
- {
- // faster Method:
- RecalcTextPortion( pParaPortion, nInvalidStart, nInvalidDiff );
- }
- else // nRealInvalidStart can be before InvalidStart, since Portions were deleted....
- {
- CreateTextPortions( pParaPortion, nRealInvalidStart );
- }
-
-
- // ---------------------------------------------------------------
- // 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 ) // not nInvalidStart!
- {
- nLine = nL;
- break;
- }
- pLine->SetValid();
- }
- // 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--;
-
- EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
-
- static Rectangle aZeroArea = Rectangle( Point(), Point() );
- Rectangle aBulletArea( aZeroArea );
- if ( !nLine )
- {
- aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) );
- if ( aBulletArea.Right() > 0 )
- pParaPortion->SetBulletX( (sal_uInt16) GetXValue( aBulletArea.Right() ) );
- else
- pParaPortion->SetBulletX( 0 ); // if Bullet is set incorrectly
- }
-
- // ---------------------------------------------------------------
- // Reformat all lines from here ...
- // ---------------------------------------------------------------
- sal_uInt16 nDelFromLine = 0xFFFF;
- sal_Bool bLineBreak = sal_False;
-
- sal_uInt16 nIndex = pLine->GetStart();
- EditLine aSaveLine( *pLine );
- SvxFont aTmpFont( pNode->GetCharAttribs().GetDefFont() );
-
- sal_Bool bCalcCharPositions = sal_True;
- sal_Int32* pBuf = new sal_Int32[ pNode->Len() ];
-
- sal_Bool bSameLineAgain = sal_False; // For TextRanger, if the height changes.
- TabInfo aCurrentTab;
-
- sal_Bool bForceOneRun = bEmptyNodeWithPolygon;
- sal_Bool bCompressedChars = sal_False;
-
- while ( ( nIndex < pNode->Len() ) || bForceOneRun )
- {
- bForceOneRun = sal_False;
-
- sal_Bool bEOL = sal_False;
- sal_Bool bEOC = sal_False;
- sal_uInt16 nPortionStart = 0;
- sal_uInt16 nPortionEnd = 0;
-
- long nStartX = GetXValue( rLRItem.GetTxtLeft() + nSpaceBeforeAndMinLabelWidth );
- if ( nIndex == 0 )
- {
- long nFI = GetXValue( rLRItem.GetTxtFirstLineOfst() );
- nStartX += nFI;
-
- if ( !nLine && ( pParaPortion->GetBulletX() > nStartX ) )
- {
- nStartX = pParaPortion->GetBulletX();
- }
- }
-
- long nMaxLineWidth;
- if ( !IsVertical() )
- nMaxLineWidth = aStatus.AutoPageWidth() ? aMaxAutoPaperSize.Width() : aPaperSize.Width();
- else
- nMaxLineWidth = aStatus.AutoPageHeight() ? aMaxAutoPaperSize.Height() : aPaperSize.Height();
-
- nMaxLineWidth -= GetXValue( rLRItem.GetRight() );
- nMaxLineWidth -= nStartX;
-
- // 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() );
-
- // If still less than 0, it may be just the right edge.
- if ( nMaxLineWidth <= 0 )
- nMaxLineWidth = 1;
-
- // 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() );
-
- sal_uInt16 nTmpPos = nIndex;
- sal_uInt16 nTmpPortion = pLine->GetStartPortion();
- long nTmpWidth = 0;
- long nXWidth = nMaxLineWidth;
- if ( nXWidth <= nTmpWidth ) // while has to be looped once
- nXWidth = nTmpWidth+1;
-
- LongDqPtr pTextRanges = 0;
- long nTextExtraYOffset = 0;
- long nTextXOffset = 0;
- long nTextLineHeight = 0;
- if ( GetTextRanger() )
- {
- GetTextRanger()->SetVertical( IsVertical() );
-
- long nTextY = nStartPosY + GetEditCursor( pParaPortion, pLine->GetStart() ).Top();
- if ( !bSameLineAgain )
- {
- SeekCursor( pNode, nTmpPos+1, aTmpFont );
- aTmpFont.SetPhysFont( GetRefDevice() );
- ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
-
- if ( IsFixedCellHeight() )
- nTextLineHeight = ImplCalculateFontIndependentLineSpacing( aTmpFont.GetHeight() );
- else
- nTextLineHeight = aTmpFont.GetPhysTxtSize( GetRefDevice(), String() ).Height();
- // Metrics can be greater
- FormatterFontMetric aTempFormatterMetrics;
- RecalcFormatterFontMetrics( aTempFormatterMetrics, aTmpFont );
- sal_uInt16 nLineHeight = aTempFormatterMetrics.GetHeight();
- if ( nLineHeight > nTextLineHeight )
- nTextLineHeight = nLineHeight;
- }
- else
- nTextLineHeight = pLine->GetHeight();
-
- nXWidth = 0;
- while ( !nXWidth )
- {
- long nYOff = nTextY + nTextExtraYOffset;
- long nYDiff = nTextLineHeight;
- if ( IsVertical() )
- {
- long nMaxPolygonX = GetTextRanger()->GetBoundRect().Right();
- nYOff = nMaxPolygonX-nYOff;
- nYDiff = -nTextLineHeight;
- }
- pTextRanges = GetTextRanger()->GetTextRanges( Range( nYOff, nYOff + nYDiff ) );
- DBG_ASSERT( pTextRanges, "GetTextRanges?!" );
- long nMaxRangeWidth = 0;
- // 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->at(n++);
- long nB = pTextRanges->at(n++);
- DBG_ASSERT( nA <= nB, "TextRange distorted?" );
- long nW = nB - nA;
- if ( nW > nMaxRangeWidth )
- {
- nMaxRangeWidth = nW;
- nTextXOffset = nA;
- }
- }
- nXWidth = nMaxRangeWidth;
- if ( nXWidth )
- nMaxLineWidth = nXWidth - nStartX - GetXValue( rLRItem.GetRight() );
- else
- {
- // Try further down in the polygon.
- // Below the polygon use the Paper Width.
- nTextExtraYOffset += Max( (long)(nTextLineHeight / 10), (long)1 );
- if ( ( nTextY + nTextExtraYOffset ) > GetTextRanger()->GetBoundRect().Bottom() )
- {
- nXWidth = !IsVertical() ? GetPaperSize().Width() : GetPaperSize().Height();
- if ( !nXWidth ) // AutoPaperSize
- nXWidth = 0x7FFFFFFF;
- }
- }
- }
- }
-
- // search for Portion that no longer fits in line ....
- TextPortion* pPortion = 0;
- sal_Bool bBrokenLine = sal_False;
- bLineBreak = sal_False;
- EditCharAttrib* pNextFeature = pNode->GetCharAttribs().FindFeature( pLine->GetStart() );
- while ( ( nTmpWidth < nXWidth ) && !bEOL && ( nTmpPortion < pParaPortion->GetTextPortions().Count() ) )
- {
- nPortionStart = nTmpPos;
- pPortion = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
- if ( pPortion->GetKind() == PORTIONKIND_HYPHENATOR )
- {
- // 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() )
- {
- nTmpPortion--;
- TextPortion* pPrev = pParaPortion->GetTextPortions().GetObject( nTmpPortion );
- DBG_ASSERT( pPrev->GetKind() == PORTIONKIND_TEXT, "Portion?!" );
- nTmpWidth -= pPrev->GetSize().Width();
- nTmpPos = nTmpPos - pPrev->GetLen();
- pPrev->SetLen( pPrev->GetLen() + pPortion->GetLen() );
- pPrev->GetSize().Width() = (-1);
- }
- delete pPortion;
- 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, "Empty Portion in CreateLines ?!" );
- (void)bProcessingEmptyLine;
- if ( pNextFeature && ( pNextFeature->GetStart() == nTmpPos ) )
- {
- sal_uInt16 nWhich = pNextFeature->GetItem()->Which();
- switch ( nWhich )
- {
- case EE_FEATURE_TAB:
- {
- long nOldTmpWidth = nTmpWidth;
-
- // Search for Tab-Pos...
- long nCurPos = nTmpWidth+nStartX;
- // consider scaling
- if ( aStatus.DoStretch() && ( nStretchX != 100 ) )
- 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() );
- aCurrentTab.nTabPos = GetXValue( (long) ( aCurrentTab.aTabStop.GetTabPos() + nAllSpaceBeforeText /*rLRItem.GetTxtLeft()*/ ) );
- aCurrentTab.bValid = sal_False;
-
- // Switch direction in R2L para...
- if ( bRightToLeftPara )
- {
- if ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_RIGHT )
- aCurrentTab.aTabStop.GetAdjustment() = SVX_TAB_ADJUST_LEFT;
- else if ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_LEFT )
- aCurrentTab.aTabStop.GetAdjustment() = SVX_TAB_ADJUST_RIGHT;
- }
-
- if ( ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_RIGHT ) ||
- ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_CENTER ) ||
- ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL ) )
- {
- // For LEFT / DEFAULT this tab is not considered.
- aCurrentTab.bValid = sal_True;
- aCurrentTab.nStartPosX = nTmpWidth;
- aCurrentTab.nCharPos = nTmpPos;
- aCurrentTab.nTabPortion = nTmpPortion;
- }
-
- pPortion->GetKind() = PORTIONKIND_TAB;
- pPortion->SetExtraValue( aCurrentTab.aTabStop.GetFill() );
- pPortion->GetSize().Width() = aCurrentTab.nTabPos - (nTmpWidth+nStartX);
-
- // 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 incorrectly calculated!" );
-
- nTmpWidth = aCurrentTab.nTabPos-nStartX;
-
- // If this is the first token on the line,
- // and nTmpWidth > aPaperSize.Width, => infinite loop!
- if ( ( nTmpWidth >= nXWidth ) && ( nTmpPortion == pLine->GetStartPortion() ) )
- {
- // What now?
- // make the tab fitting
- pPortion->GetSize().Width() = nXWidth-nOldTmpWidth;
- nTmpWidth = nXWidth-1;
- bEOL = sal_True;
- bBrokenLine = sal_True;
- }
- pLine->GetCharPosArray().Insert( pPortion->GetSize().Width(), nTmpPos-pLine->GetStart() );
- bCompressedChars = sal_False;
- }
- break;
- case EE_FEATURE_LINEBR:
- {
- DBG_ASSERT( pPortion, "?!" );
- pPortion->GetSize().Width() = 0;
- bEOL = sal_True;
- bLineBreak = sal_True;
- pPortion->GetKind() = PORTIONKIND_LINEBREAK;
- bCompressedChars = sal_False;
- pLine->GetCharPosArray().Insert( pPortion->GetSize().Width(), nTmpPos-pLine->GetStart() );
- }
- break;
- case EE_FEATURE_FIELD:
- {
- SeekCursor( pNode, nTmpPos+1, aTmpFont );
- sal_Unicode cChar = 0; // later: NBS?
- aTmpFont.SetPhysFont( GetRefDevice() );
- ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
-
- String aFieldValue = cChar ? String(cChar) : ((EditCharAttribField*)pNextFeature)->GetFieldValue();
- if ( bCalcCharPositions || !pPortion->HasValidSize() )
- {
- pPortion->GetSize() = aTmpFont.QuickGetTextSize( GetRefDevice(), aFieldValue, 0, aFieldValue.Len(), 0 );
- // 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;
- // If this is the first token on the line,
- // and nTmpWidth > aPaperSize.Width, => infinite loop!
- if ( ( nTmpWidth >= nXWidth ) && ( nTmpPortion == pLine->GetStartPortion() ) )
- {
- nTmpWidth = nXWidth-1;
- bEOL = sal_True;
- bBrokenLine = sal_True;
- }
- // Compression in Fields????
- // I think this could be a little bit difficult and is not very usefull
- bCompressedChars = sal_False;
- }
- break;
- 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() );
-
- if ( bCalcCharPositions || !pPortion->HasValidSize() )
- {
- pPortion->GetSize() = aTmpFont.QuickGetTextSize( GetRefDevice(), *pParaPortion->GetNode(), nTmpPos, pPortion->GetLen(), pBuf );
-
- // #i9050# Do Kerning also behind portions...
- if ( ( aTmpFont.GetFixKerning() > 0 ) && ( ( nTmpPos + pPortion->GetLen() ) < pNode->Len() ) )
- pPortion->GetSize().Width() += aTmpFont.GetFixKerning();
- if ( IsFixedCellHeight() )
- pPortion->GetSize().Height() = ImplCalculateFontIndependentLineSpacing( aTmpFont.GetHeight() );
- }
- if ( bCalcCharPositions )
- {
- sal_uInt16 nLen = pPortion->GetLen();
- // The array is generally flattened at the beginning
- // => Always simply quick inserts.
- sal_uInt16 nPos = nTmpPos - pLine->GetStart();
- pLine->GetCharPosArray().Insert( pBuf, nLen, nPos );
- }
-
- // And now check for Compression:
- if ( pPortion->GetLen() && GetAsianCompressionMode() )
- bCompressedChars |= ImplCalcAsianCompression( pNode, pPortion, nTmpPos, (sal_Int32*)pLine->GetCharPosArray().GetData() + (nTmpPos-pLine->GetStart()), 10000, sal_False );
-
- nTmpWidth += pPortion->GetSize().Width();
-
- pPortion->SetRightToLeft( GetRightToLeft( nPara, nTmpPos+1 ) );
-
- sal_uInt16 _nPortionEnd = nTmpPos + pPortion->GetLen();
- if( bScriptSpace && ( _nPortionEnd < pNode->Len() ) && ( nTmpWidth < nXWidth ) && IsScriptChange( EditPaM( pNode, _nPortionEnd ) ) )
- {
- sal_Bool bAllow = sal_False;
- sal_uInt16 nScriptTypeLeft = GetScriptType( EditPaM( pNode, _nPortionEnd ) );
- sal_uInt16 nScriptTypeRight = GetScriptType( EditPaM( pNode, _nPortionEnd+1 ) );
- if ( ( nScriptTypeLeft == i18n::ScriptType::ASIAN ) || ( nScriptTypeRight == i18n::ScriptType::ASIAN ) )
- bAllow = sal_True;
-
- // No spacing within L2R/R2L nesting
- if ( bAllow )
- {
- long nExtraSpace = pPortion->GetSize().Height()/5;
- nExtraSpace = GetXValue( nExtraSpace );
- pPortion->GetSize().Width() += nExtraSpace;
- nTmpWidth += nExtraSpace;
- }
- }
- }
-
- if ( aCurrentTab.bValid && ( nTmpPortion != aCurrentTab.nTabPortion ) )
- {
- long nWidthAfterTab = 0;
- for ( sal_uInt16 n = aCurrentTab.nTabPortion+1; n <= nTmpPortion; n++ )
- {
- TextPortion* pTP = pParaPortion->GetTextPortions().GetObject( n );
- nWidthAfterTab += pTP->GetSize().Width();
- }
- long nW = nWidthAfterTab; // Length before tab position
- if ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_RIGHT )
- {
- }
- else if ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_CENTER )
- {
- nW = nWidthAfterTab/2;
- }
- else if ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL )
- {
- String aText = GetSelected( EditSelection( EditPaM( pParaPortion->GetNode(), nTmpPos ),
- EditPaM( pParaPortion->GetNode(), nTmpPos + pPortion->GetLen() ) ) );
- sal_uInt16 nDecPos = aText.Search( aCurrentTab.aTabStop.GetDecimal() );
- if ( nDecPos != STRING_NOTFOUND )
- {
- nW -= pParaPortion->GetTextPortions().GetObject( nTmpPortion )->GetSize().Width();
- nW += aTmpFont.QuickGetTextSize( GetRefDevice(), *pParaPortion->GetNode(), nTmpPos, nDecPos, NULL ).Width();
- aCurrentTab.bValid = sal_False;
- }
- }
- else
- {
- OSL_FAIL( "CreateLines: Tab not handled!" );
- }
- long nMaxW = aCurrentTab.nTabPos - aCurrentTab.nStartPosX - nStartX;
- if ( nW >= nMaxW )
- {
- nW = nMaxW;
- aCurrentTab.bValid = sal_False;
- }
- TextPortion* pTabPortion = pParaPortion->GetTextPortions().GetObject( aCurrentTab.nTabPortion );
- pTabPortion->GetSize().Width() = aCurrentTab.nTabPos - aCurrentTab.nStartPosX - nW - nStartX;
- nTmpWidth = aCurrentTab.nStartPosX + pTabPortion->GetSize().Width() + nWidthAfterTab;
- }
-
- nTmpPos = nTmpPos + pPortion->GetLen();
- nPortionEnd = nTmpPos;
- nTmpPortion++;
- if ( aStatus.OneCharPerLine() )
- bEOL = sal_True;
- }
-
- DBG_ASSERT( pPortion, "no portion!?" );
-
- aCurrentTab.bValid = sal_False;
-
- // this was possibly a portion too far:
- sal_Bool bFixedEnd = sal_False;
- if ( aStatus.OneCharPerLine() )
- {
- // State before Portion (apart from nTmpWidth):
- nPortionEnd = nTmpPos;
- nTmpPos -= pPortion ? pPortion->GetLen() : 0;
- nPortionStart = nTmpPos;
- nTmpPortion--;
-
- bEOL = sal_True;
- bEOC = sal_False;
-
- // And now just one character:
- nTmpPos++;
- nTmpPortion++;
- nPortionEnd = nTmpPortion;
- // one Non-Feature-Portion has to be wrapped
- if ( pPortion->GetLen() > 1 )
- {
- 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 );
- DBG_ASSERT( p, "Portion ?!" );
- nTmpWidth += p->GetSize().Width();
- }
- }
- else if ( nTmpWidth >= nXWidth )
- {
- nPortionEnd = nTmpPos;
- nTmpPos -= pPortion ? pPortion->GetLen() : 0;
- nPortionStart = nTmpPos;
- nTmpPortion--;
- bEOL = sal_False;
- bEOC = sal_False;
- if( pPortion ) switch ( pPortion->GetKind() )
- {
- case PORTIONKIND_TEXT:
- {
- nTmpWidth -= pPortion->GetSize().Width();
- }
- break;
- case PORTIONKIND_FIELD:
- case PORTIONKIND_TAB:
- {
- nTmpWidth -= pPortion->GetSize().Width();
- bEOL = sal_True;
- bFixedEnd = sal_True;
- }
- break;
- default:
- {
- // A feature is not wrapped:
- DBG_ASSERT( ( pPortion->GetKind() == PORTIONKIND_LINEBREAK ), "What Feature ?" );
- bEOL = sal_True;
- bFixedEnd = sal_True;
- }
- }
- }
- else
- {
- bEOL = sal_True;
- bEOC = sal_True;
- pLine->SetEnd( nPortionEnd );
- DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "No TextPortions?" );
- pLine->SetEndPortion( (sal_uInt16)pParaPortion->GetTextPortions().Count() - 1 );
- }
-
- if ( aStatus.OneCharPerLine() )
- {
- pLine->SetEnd( nPortionEnd );
- pLine->SetEndPortion( nTmpPortion-1 );
- }
- else if ( bFixedEnd )
- {
- pLine->SetEnd( nPortionStart );
- pLine->SetEndPortion( nTmpPortion-1 );
- }
- else if ( bLineBreak || bBrokenLine )
- {
- pLine->SetEnd( nPortionStart+1 );
- pLine->SetEndPortion( nTmpPortion-1 );
- bEOC = sal_False; // was set above, maybe change the sequence of the if's?
- }
- else if ( !bEOL )
- {
- DBG_ASSERT( pPortion && ((nPortionEnd-nPortionStart) == pPortion->GetLen()), "However, another portion?!" );
- long nRemainingWidth = nMaxLineWidth - nTmpWidth;
- sal_Bool bCanHyphenate = ( aTmpFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL );
- if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed )
- {
- // I need the manipulated DXArray for determining the break postion...
- ImplCalcAsianCompression( pNode, pPortion, nPortionStart, const_cast<sal_Int32*>(( pLine->GetCharPosArray().GetData() + (nPortionStart-pLine->GetStart()) )), 10000, sal_True );
- }
- if( pPortion )
- ImpBreakLine( pParaPortion, pLine, pPortion, nPortionStart,
- nRemainingWidth, bCanHyphenate && bHyphenatePara );
- }
-
- // ------------------------------------------------------------------
- // Line finished => adjust
- // ------------------------------------------------------------------
-
- // CalcTextSize should be replaced by a continuous registering!
- Size aTextSize = pLine->CalcTextSize( *pParaPortion );
-
- if ( aTextSize.Height() == 0 )
- {
- SeekCursor( pNode, pLine->GetStart()+1, aTmpFont );
- aTmpFont.SetPhysFont( pRefDev );
- ImplInitDigitMode( pRefDev, 0, 0, 0, aTmpFont.GetLanguage() );
-
- if ( IsFixedCellHeight() )
- aTextSize.Height() = ImplCalculateFontIndependentLineSpacing( aTmpFont.GetHeight() );
- else
- aTextSize.Height() = aTmpFont.GetPhysTxtSize( pRefDev, String() ).Height();
- pLine->SetHeight( (sal_uInt16)aTextSize.Height() );
- }
-
- // 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 );
- // 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 );
- aTmpFont.SetPhysFont( GetRefDevice() );
- ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
- RecalcFormatterFontMetrics( aFormatterMetrics, aTmpFont );
- }
- nTPos = nTPos + pTP->GetLen();
- }
- sal_uInt16 nLineHeight = aFormatterMetrics.GetHeight();
- if ( nLineHeight > pLine->GetHeight() )
- pLine->SetHeight( nLineHeight );
- pLine->SetMaxAscent( aFormatterMetrics.nMaxAscent );
-
- bSameLineAgain = sal_False;
- if ( GetTextRanger() && ( pLine->GetHeight() > nTextLineHeight ) )
- {
- // put down with the other size!
- bSameLineAgain = sal_True;
- }
-
-
- if ( !bSameLineAgain && !aStatus.IsOutliner() )
- {
- if ( rLSItem.GetLineSpaceRule() == SVX_LINE_SPACE_MIN )
- {
- sal_uInt16 nMinHeight = GetYValue( rLSItem.GetLineHeight() );
- sal_uInt16 nTxtHeight = pLine->GetHeight();
- if ( nTxtHeight < nMinHeight )
- {
- // 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() ) // Not the very first line
- {
- // 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 ) )
- {
- sal_uInt16 nTxtHeight = pLine->GetHeight();
- sal_Int32 nH = nTxtHeight;
- nH *= rLSItem.GetPropLineSpace();
- nH /= 100;
- // The Ascent has to be adjusted for the difference:
- long nDiff = pLine->GetHeight() - nH;
- if ( nDiff > pLine->GetMaxAscent() )
- nDiff = pLine->GetMaxAscent();
- pLine->SetMaxAscent( (sal_uInt16)(pLine->GetMaxAscent() - nDiff) );
- pLine->SetHeight( (sal_uInt16)nH, nTxtHeight );
- }
- }
- }
- }
-
- if ( ( !IsVertical() && aStatus.AutoPageWidth() ) ||
- ( IsVertical() && aStatus.AutoPageHeight() ) )
- {
- // 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 )
- nMaxLineWidth = nMaxLineWidthFix;
- }
-
- if ( bCompressedChars )
- {
- long nRemainingWidth = nMaxLineWidth - aTextSize.Width();
- if ( nRemainingWidth > 0 )
- {
- ImplExpandCompressedPortions( pLine, pParaPortion, nRemainingWidth );
- aTextSize = pLine->CalcTextSize( *pParaPortion );
- }
- }
-
- if ( pLine->IsHangingPunctuation() )
- {
- // Width from HangingPunctuation was set to 0 in ImpBreakLine,
- // check for rel width now, maybe create compression...
- long n = nMaxLineWidth - aTextSize.Width();
- TextPortion* pTP = pParaPortion->GetTextPortions().GetObject( pLine->GetEndPortion() );
- sal_uInt16 nPosInArray = pLine->GetEnd()-1-pLine->GetStart();
- long nNewValue = ( nPosInArray ? pLine->GetCharPosArray()[ nPosInArray-1 ] : 0 ) + n;
- pLine->GetCharPosArray()[ nPosInArray ] = nNewValue;
- pTP->GetSize().Width() += n;
- }
-
- pLine->SetTextWidth( aTextSize.Width() );
- switch ( eJustification )
- {
- case SVX_ADJUST_CENTER:
- {
- long n = ( nMaxLineWidth - aTextSize.Width() ) / 2;
- n += nStartX; // Indentation is kept.
- if ( n > 0 )
- pLine->SetStartPosX( (sal_uInt16)n );
- else
- pLine->SetStartPosX( 0 );
-
- }
- break;
- case SVX_ADJUST_RIGHT:
- {
- // For automatically wrapped lines, which has a blank at the end
- // the blank must not be displayed!
- long n = nMaxLineWidth - aTextSize.Width();
- n += nStartX; // Indentation is kept.
- if ( n > 0 )
- pLine->SetStartPosX( (sal_uInt16)n );
- else
- pLine->SetStartPosX( 0 );
- }
- break;
- case SVX_ADJUST_BLOCK:
- {
- bool bDistLastLine = (GetJustifyMethod(nPara) == SVX_JUSTIFY_METHOD_DISTRIBUTE);
- long nRemainingSpace = nMaxLineWidth - aTextSize.Width();
- pLine->SetStartPosX( (sal_uInt16)nStartX );
- if ( nRemainingSpace > 0 && (!bEOC || bDistLastLine) )
- ImpAdjustBlocks( pParaPortion, pLine, nRemainingSpace );
- }
- break;
- default:
- {
- pLine->SetStartPosX( (sal_uInt16)nStartX ); // FI, LI
- }
- break;
- }
-
- // -----------------------------------------------------------------
- // Check whether the line must be re-issued ...
- // -----------------------------------------------------------------
- pLine->SetInvalid();
-
- // If a portion was wrapped there may be far too many positions in
- // CharPosArray:
- if ( bCalcCharPositions )
- {
- sal_uInt16 nLen = pLine->GetLen();
- sal_uInt16 nCount = pLine->GetCharPosArray().Count();
- if ( nCount > nLen )
- pLine->GetCharPosArray().Remove( nLen, nCount-nLen );
- }
-
- if ( GetTextRanger() )
- {
- if ( nTextXOffset )
- pLine->SetStartPosX( (sal_uInt16) ( pLine->GetStartPosX() + nTextXOffset ) );
- if ( nTextExtraYOffset )
- {
- pLine->SetHeight( (sal_uInt16) ( pLine->GetHeight() + nTextExtraYOffset ), 0, pLine->GetHeight() );
- pLine->SetMaxAscent( (sal_uInt16) ( pLine->GetMaxAscent() + nTextExtraYOffset ) );
- }
- }
-
- // for <0 think over !
- if ( pParaPortion->IsSimpleInvalid() )
- {
- // 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 )
- {
- pLine->SetValid();
- }
- }
- else
- {
- sal_uInt16 nStart = pLine->GetStart();
- sal_uInt16 nEnd = pLine->GetEnd();
-
- if ( nStart > nInvalidEnd )
- {
- if ( ( ( nStart-nInvalidDiff ) == aSaveLine.GetStart() ) &&
- ( ( nEnd-nInvalidDiff ) == aSaveLine.GetEnd() ) )
- {
- pLine->SetValid();
- if ( bCalcCharPositions && bQuickFormat )
- {
- bCalcCharPositions = sal_False;
- bLineBreak = sal_False;
- pParaPortion->CorrectValuesBehindLastFormattedLine( nLine );
- break;
- }
- }
- }
- else if ( bCalcCharPositions && bQuickFormat && ( nEnd > nInvalidEnd) )
- {
- // 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;
- bLineBreak = sal_False;
- pParaPortion->CorrectValuesBehindLastFormattedLine( nLine );
- break;
- }
- }
- }
- }
-
- if ( !bSameLineAgain )
- {
- nIndex = pLine->GetEnd(); // next line start = last line end
- // as nEnd points to the last charecter!
-
- sal_uInt16 nEndPortion = pLine->GetEndPortion();
-
- // Next line or maybe a new line....
- pLine = 0;
- if ( nLine < pParaPortion->GetLines().Count()-1 )
- pLine = pParaPortion->GetLines().GetObject( ++nLine );
- if ( pLine && ( nIndex >= pNode->Len() ) )
- {
- nDelFromLine = nLine;
- break;
- }
- if ( !pLine )
- {
- if ( nIndex < pNode->Len() )
- {
- pLine = new EditLine;
- pParaPortion->GetLines().Insert( pLine, ++nLine );
- }
- else if ( nIndex && bLineBreak && GetTextRanger() )
- {
- // normaly CreateAndInsertEmptyLine would be called, but I want to use
- // CreateLines, so I need Polygon code only here...
- TextPortion* pDummyPortion = new TextPortion( 0 );
- pParaPortion->GetTextPortions().Insert( pDummyPortion, pParaPortion->GetTextPortions().Count() );
- pLine = new EditLine;
- pParaPortion->GetLines().Insert( pLine, ++nLine );
- bForceOneRun = sal_True;
- bProcessingEmptyLine = sal_True;
- }
- }
- if ( pLine )
- {
- aSaveLine = *pLine;
- pLine->SetStart( nIndex );
- pLine->SetEnd( nIndex );
- pLine->SetStartPortion( nEndPortion+1 );
- pLine->SetEndPortion( nEndPortion+1 );
- }
- }
- } // while ( Index < Len )
-
- if ( nDelFromLine != 0xFFFF )
- pParaPortion->GetLines().DeleteFromLine( nDelFromLine );
-
- DBG_ASSERT( pParaPortion->GetLines().Count(), "No line after CreateLines!" );
-
- if ( bLineBreak == sal_True )
- CreateAndInsertEmptyLine( pParaPortion, nStartPosY );
-
- delete[] pBuf;
-
- sal_Bool bHeightChanged = FinishCreateLines( pParaPortion );
-
- if ( bMapChanged )
- GetRefDevice()->Pop();
-
- GetRefDevice()->Pop();
-
- return bHeightChanged;
-}
-
-void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uInt32 )
-{
- DBG_ASSERT( !GetTextRanger(), "Don't use CreateAndInsertEmptyLine with a polygon!" );
-
- EditLine* pTmpLine = new EditLine;
- pTmpLine->SetStart( pParaPortion->GetNode()->Len() );
- pTmpLine->SetEnd( pParaPortion->GetNode()->Len() );
- pParaPortion->GetLines().Insert( pTmpLine, pParaPortion->GetLines().Count() );
-
- sal_Bool bLineBreak = pParaPortion->GetNode()->Len() ? sal_True : sal_False;
- sal_Int32 nSpaceBefore = 0;
- sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth( pParaPortion->GetNode(), &nSpaceBefore );
- const SvxLRSpaceItem& rLRItem = GetLRSpaceItem( pParaPortion->GetNode() );
- const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&)pParaPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL );
- short nStartX = GetXValue( (short)(rLRItem.GetTxtLeft() + rLRItem.GetTxtFirstLineOfst() + nSpaceBefore));
-
- Rectangle aBulletArea = Rectangle( Point(), Point() );
- if ( bLineBreak == sal_True )
- {
- nStartX = (short)GetXValue( rLRItem.GetTxtLeft() + rLRItem.GetTxtFirstLineOfst() + nSpaceBeforeAndMinLabelWidth );
- }
- else
- {
- aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) );
- if ( aBulletArea.Right() > 0 )
- pParaPortion->SetBulletX( (sal_uInt16) GetXValue( aBulletArea.Right() ) );
- else
- pParaPortion->SetBulletX( 0 ); // If Bullet set incorrectly.
- if ( pParaPortion->GetBulletX() > nStartX )
- {
- nStartX = (short)GetXValue( rLRItem.GetTxtLeft() + rLRItem.GetTxtFirstLineOfst() + nSpaceBeforeAndMinLabelWidth );
- if ( pParaPortion->GetBulletX() > nStartX )
- nStartX = pParaPortion->GetBulletX();
- }
- }
-
- SvxFont aTmpFont;
- SeekCursor( pParaPortion->GetNode(), bLineBreak ? pParaPortion->GetNode()->Len() : 0, aTmpFont );
- aTmpFont.SetPhysFont( pRefDev );
-
- TextPortion* pDummyPortion = new TextPortion( 0 );
- pDummyPortion->GetSize() = aTmpFont.GetPhysTxtSize( pRefDev, String() );
- if ( IsFixedCellHeight() )
- pDummyPortion->GetSize().Height() = ImplCalculateFontIndependentLineSpacing( aTmpFont.GetHeight() );
- pParaPortion->GetTextPortions().Insert( pDummyPortion, pParaPortion->GetTextPortions().Count() );
- FormatterFontMetric aFormatterMetrics;
- RecalcFormatterFontMetrics( aFormatterMetrics, aTmpFont );
- pTmpLine->SetMaxAscent( aFormatterMetrics.nMaxAscent );
- pTmpLine->SetHeight( (sal_uInt16) pDummyPortion->GetSize().Height() );
- sal_uInt16 nLineHeight = aFormatterMetrics.GetHeight();
- if ( nLineHeight > pTmpLine->GetHeight() )
- pTmpLine->SetHeight( nLineHeight );
-
- if ( !aStatus.IsOutliner() )
- {
- sal_uInt16 nPara = GetParaPortions().GetPos( pParaPortion );
- SvxAdjust eJustification = GetJustification( nPara );
- long nMaxLineWidth = !IsVertical() ? aPaperSize.Width() : aPaperSize.Height();
- nMaxLineWidth -= GetXValue( rLRItem.GetRight() );
- long nTextXOffset = 0;
- if ( nMaxLineWidth < 0 )
- nMaxLineWidth = 1;
- if ( eJustification == SVX_ADJUST_CENTER )
- nStartX = sal::static_int_cast< short >(nMaxLineWidth / 2);
- else if ( eJustification == SVX_ADJUST_RIGHT )
- nStartX = sal::static_int_cast< short >(nMaxLineWidth);
-
- nStartX = sal::static_int_cast< short >(nStartX + nTextXOffset);
- }
-
- pTmpLine->SetStartPosX( nStartX );
-
- if ( !aStatus.IsOutliner() )
- {
- if ( rLSItem.GetLineSpaceRule() == SVX_LINE_SPACE_MIN )
- {
- sal_uInt16 nMinHeight = rLSItem.GetLineHeight();
- sal_uInt16 nTxtHeight = pTmpLine->GetHeight();
- if ( nTxtHeight < nMinHeight )
- {
- // 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() ) // Not the very first line
- {
- // 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 ) )
- {
- sal_uInt16 nTxtHeight = pTmpLine->GetHeight();
- sal_Int32 nH = nTxtHeight;
- nH *= rLSItem.GetPropLineSpace();
- nH /= 100;
- // The Ascent has to be adjusted for the difference:
- long nDiff = pTmpLine->GetHeight() - nH;
- if ( nDiff > pTmpLine->GetMaxAscent() )
- nDiff = pTmpLine->GetMaxAscent();
- pTmpLine->SetMaxAscent( (sal_uInt16)(pTmpLine->GetMaxAscent() - nDiff) );
- pTmpLine->SetHeight( (sal_uInt16)nH, nTxtHeight );
- }
- }
- }
- }
-
- if ( !bLineBreak )
- {
- long nMinHeight = aBulletArea.GetHeight();
- if ( nMinHeight > (long)pTmpLine->GetHeight() )
- {
- long nDiff = nMinHeight - (long)pTmpLine->GetHeight();
- // distribute nDiff upwards and downwards
- pTmpLine->SetMaxAscent( (sal_uInt16)(pTmpLine->GetMaxAscent() + nDiff/2) );
- pTmpLine->SetHeight( (sal_uInt16)nMinHeight );
- }
- }
- else
- {
- // -2: The new one is already inserted.
-#ifdef DBG_UTIL
- EditLine* pLastLine = pParaPortion->GetLines().GetObject( pParaPortion->GetLines().Count()-2 );
- DBG_ASSERT( pLastLine, "soft wrap no line?!" );
- DBG_ASSERT( pLastLine->GetEnd() == pParaPortion->GetNode()->Len(), "different anyway?" );
-#endif
- sal_uInt16 nPos = (sal_uInt16) pParaPortion->GetTextPortions().Count() - 1 ;
- pTmpLine->SetStartPortion( nPos );
- pTmpLine->SetEndPortion( nPos );
- }
-}
-
-sal_Bool ImpEditEngine::FinishCreateLines( ParaPortion* pParaPortion )
-{
-// CalcCharPositions( pParaPortion );
- pParaPortion->SetValid();
- long nOldHeight = pParaPortion->GetHeight();
- CalcHeight( pParaPortion );
-
- DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "FinishCreateLines: No Text-Portion?" );
- sal_Bool bRet = ( pParaPortion->GetHeight() != nOldHeight );
- return bRet;
-}
-
-void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, TextPortion* pPortion, sal_uInt16 nPortionStart, long nRemainingWidth, sal_Bool bCanHyphenate )
-{
- ContentNode* const pNode = pParaPortion->GetNode();
-
- sal_uInt16 nBreakInLine = nPortionStart - pLine->GetStart();
- sal_uInt16 nMax = nBreakInLine + pPortion->GetLen();
- while ( ( nBreakInLine < nMax ) && ( pLine->GetCharPosArray()[nBreakInLine] < nRemainingWidth ) )
- nBreakInLine++;
-
- sal_uInt16 nMaxBreakPos = nBreakInLine + pLine->GetStart();
- sal_uInt16 nBreakPos = 0xFFFF;
-
- sal_Bool bCompressBlank = sal_False;
- sal_Bool bHyphenated = sal_False;
- sal_Bool bHangingPunctuation = sal_False;
- sal_Unicode cAlternateReplChar = 0;
- sal_Unicode cAlternateExtraChar = 0;
-
- if ( ( nMaxBreakPos < ( nMax + pLine->GetStart() ) ) && ( pNode->GetChar( nMaxBreakPos ) == ' ' ) )
- {
- // Break behind the blank, blank will be compressed...
- nBreakPos = nMaxBreakPos + 1;
- bCompressBlank = sal_True;
- }
- else
- {
- sal_uInt16 nMinBreakPos = pLine->GetStart();
- sal_uInt16 nAttrs = pNode->GetCharAttribs().GetAttribs().Count();
- for ( sal_uInt16 nAttr = nAttrs; nAttr; )
- {
- EditCharAttrib* pAttr = pNode->GetCharAttribs().GetAttribs()[--nAttr];
- if ( pAttr->IsFeature() && ( pAttr->GetEnd() > nMinBreakPos ) && ( pAttr->GetEnd() <= nMaxBreakPos ) )
- {
- nMinBreakPos = pAttr->GetEnd();
- break;
- }
- }
-
- lang::Locale aLocale = GetLocale( EditPaM( pNode, nMaxBreakPos ) );
-
- Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- OUString aText( *pNode );
- Reference< XHyphenator > xHyph;
- if ( bCanHyphenate )
- xHyph = GetHyphenator();
- i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, Sequence< PropertyValue >(), 1 );
- i18n::LineBreakUserOptions aUserOptions;
-
- const i18n::ForbiddenCharacters* pForbidden = GetForbiddenCharsTable()->GetForbiddenCharacters( SvxLocaleToLanguage( aLocale ), sal_True );
- aUserOptions.forbiddenBeginCharacters = pForbidden->beginLine;
- aUserOptions.forbiddenEndCharacters = pForbidden->endLine;
- aUserOptions.applyForbiddenRules = ((const SfxBoolItem&)pNode->GetContentAttribs().GetItem( EE_PARA_FORBIDDENRULES )).GetValue();
- aUserOptions.allowPunctuationOutsideMargin = ((const SfxBoolItem&)pNode->GetContentAttribs().GetItem( EE_PARA_HANGINGPUNCTUATION )).GetValue();
- aUserOptions.allowHyphenateEnglish = sal_False;
-
- i18n::LineBreakResults aLBR = _xBI->getLineBreak( *pNode, nMaxBreakPos, aLocale, nMinBreakPos, aHyphOptions, aUserOptions );
- nBreakPos = (sal_uInt16)aLBR.breakIndex;
-
- // BUG in I18N - under special condition (break behind field, #87327#) breakIndex is < nMinBreakPos
- if ( nBreakPos < nMinBreakPos )
- {
- nBreakPos = nMinBreakPos;
- }
- else if ( ( nBreakPos > nMaxBreakPos ) && !aUserOptions.allowPunctuationOutsideMargin )
- {
- OSL_FAIL( "I18N: XBreakIterator::getLineBreak returns position > Max" );
- nBreakPos = nMaxBreakPos;
- }
-
- // 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!
- // !!! Test!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- if ( (nBreakPos + ( aUserOptions.allowPunctuationOutsideMargin ? 0 : 1 ) ) <= nMaxBreakPos )
- {
- sal_Unicode cFirstInNextLine = ( (nBreakPos+1) < pNode->Len() ) ? pNode->GetChar( nBreakPos ) : 0;
- if ( cFirstInNextLine == 12290 )
- nBreakPos++;
- }
-
- bHangingPunctuation = ( nBreakPos > nMaxBreakPos ) ? sal_True : sal_False;
- pLine->SetHangingPunctuation( bHangingPunctuation );
-
- // 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 nWordEnd = (sal_uInt16) aBoundary.endPos;
- DBG_ASSERT( nWordEnd > nWordStart, "ImpBreakLine: Start >= End?" );
-
- sal_uInt16 nWordLen = nWordEnd - nWordStart;
- if ( ( nWordEnd >= nMaxBreakPos ) && ( nWordLen > 3 ) )
- {
- // May happen, because getLineBreak may differ from getWordBoudary with DICTIONARY_WORD
- String aWord( *pNode, nWordStart, nWordLen );
- 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 >() );
- if (xHyphWord.is())
- {
- sal_Bool bAlternate = xHyphWord->isAlternativeSpelling();
- sal_uInt16 _nWordLen = 1 + xHyphWord->getHyphenPos();
-
- if ( ( _nWordLen >= 2 ) && ( (nWordStart+_nWordLen) >= (pLine->GetStart() + 2 ) ) )
- {
- if ( !bAlternate )
- {
- bHyphenated = sal_True;
- nBreakPos = nWordStart + _nWordLen;
- }
- else
- {
- String aAlt( xHyphWord->getHyphenatedWord() );
-
- // 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;
-
- // 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) )
- {
- ++nTxtEnd;
- ++nAltEnd;
- }
-
- // If a character is added, then we notice it now:
- if( nAltEnd > nTxtEnd && nAltStart == nAltEnd &&
- aWord.GetChar( nTxtEnd ) == aAlt.GetChar(nAltEnd) )
- {
- ++nAltEnd;
- ++nTxtStart;
- ++nTxtEnd;
- }
-
- DBG_ASSERT( ( nAltEnd - nAltStart ) == 1, "Alternate: Wrong assumption!" );
-
- if ( nTxtEnd > nTxtStart )
- cAlternateReplChar = aAlt.GetChar( nAltStart );
- else
- cAlternateExtraChar = aAlt.GetChar( nAltStart );
-
- bHyphenated = sal_True;
- nBreakPos = nWordStart + nTxtStart;
- if ( cAlternateReplChar )
- nBreakPos++;
- }
- }
- }
- }
- }
-
- if ( nBreakPos <= pLine->GetStart() )
- {
- // No separator in line => Chop!
- nBreakPos = nMaxBreakPos;
- // I18N nextCharacters !
- if ( nBreakPos <= pLine->GetStart() )
- nBreakPos = pLine->GetStart() + 1; // Otherwise infinite loop!
- }
- }
-
- // the dickey portion is the end portion
- pLine->SetEnd( nBreakPos );
-
- sal_uInt16 nEndPortion = SplitTextPortion( pParaPortion, nBreakPos, pLine );
-
- if ( !bCompressBlank && !bHangingPunctuation )
- {
- // 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!" );
- if ( pNode->GetChar( nBreakPos-1 ) == ' ' )
- bCompressBlank = sal_True;
- }
-
- if ( bCompressBlank || bHangingPunctuation )
- {
- TextPortion* pTP = pParaPortion->GetTextPortions().GetObject( nEndPortion );
- 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 )
- {
- // A portion for inserting the separator ...
- TextPortion* pHyphPortion = new TextPortion( 0 );
- pHyphPortion->GetKind() = PORTIONKIND_HYPHENATOR;
- String aHyphText( CH_HYPH );
- if ( cAlternateReplChar )
- {
- TextPortion* pPrev = pParaPortion->GetTextPortions().GetObject( nEndPortion );
- DBG_ASSERT( pPrev && pPrev->GetLen(), "Hyphenate: Prev portion?!" );
- pPrev->SetLen( pPrev->GetLen() - 1 );
- pHyphPortion->SetLen( 1 );
- pHyphPortion->SetExtraValue( cAlternateReplChar );
- // Correct width of the portion above:
- pPrev->GetSize().Width() =
- pLine->GetCharPosArray()[ nBreakPos-1 - pLine->GetStart() - 1 ];
- }
- else if ( cAlternateExtraChar )
- {
- pHyphPortion->SetExtraValue( cAlternateExtraChar );
- aHyphText.Insert( cAlternateExtraChar, 0 );
- }
-
- // Determine the width of the Hyph-Portion:
- SvxFont aFont;
- SeekCursor( pParaPortion->GetNode(), nBreakPos, aFont );
- aFont.SetPhysFont( GetRefDevice() );
- pHyphPortion->GetSize().Height() = GetRefDevice()->GetTextHeight();
- pHyphPortion->GetSize().Width() = GetRefDevice()->GetTextWidth( aHyphText );
-
- pParaPortion->GetTextPortions().Insert( pHyphPortion, ++nEndPortion );
- }
- pLine->SetEndPortion( nEndPortion );
-}
-
-void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, long nRemainingSpace )
-{
- 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 points behind
- ContentNode* pNode = pParaPortion->GetNode();
-
- DBG_ASSERT( nLastChar < pNode->Len(), "AdjustBlocks: Out of range!" );
-
- // Search blanks or Kashidas...
- SvUShorts aPositions;
- 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) == ' ' )
- {
- // 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;
-
- // 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 );
- sal_uInt16 nPortionStart, nPortion;
- nPortion = pParaPortion->GetTextPortions().FindPortion( nLastChar+1, nPortionStart );
- TextPortion* pLastPortion = pParaPortion->GetTextPortions()[ nPortion ];
- long nRealWidth = pLine->GetCharPosArray()[nLastChar-nFirstChar];
- long nBlankWidth = nRealWidth;
- if ( nLastChar > nPortionStart )
- nBlankWidth -= pLine->GetCharPosArray()[nLastChar-nFirstChar-1];
- // Possibly the blank has already been deducted in ImpBreakLine:
- if ( nRealWidth == pLastPortion->GetSize().Width() )
- {
- // For the last character the portion must stop behind the blank
- // => Simplify correction:
- DBG_ASSERT( ( nPortionStart + pLastPortion->GetLen() ) == ( nLastChar+1 ), "Blank actually not at the end of the portion!?");
- pLastPortion->GetSize().Width() -= nBlankWidth;
- nRemainingSpace += nBlankWidth;
- }
- pLine->GetCharPosArray()[nLastChar-nFirstChar] -= nBlankWidth;
- }
-
- sal_uInt16 nGaps = aPositions.Count();
- const long nMore4Everyone = nRemainingSpace / nGaps;
- long nSomeExtraSpace = nRemainingSpace - nMore4Everyone*nGaps;
-
- DBG_ASSERT( nSomeExtraSpace < (long)nGaps, "AdjustBlocks: ExtraSpace too large" );
- DBG_ASSERT( nSomeExtraSpace >= 0, "AdjustBlocks: ExtraSpace < 0 " );
-
- // 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++ )
- {
- sal_uInt16 nChar = aPositions[n];
- if ( nChar < nLastChar )
- {
- sal_uInt16 nPortionStart, nPortion;
- nPortion = pParaPortion->GetTextPortions().FindPortion( nChar, nPortionStart, true );
- TextPortion* pLastPortion = pParaPortion->GetTextPortions()[ nPortion ];
-
- // The width of the portion:
- pLastPortion->GetSize().Width() += nMore4Everyone;
- if ( nSomeExtraSpace )
- pLastPortion->GetSize().Width()++;
-
- // Correct positions in array
- // Even for kashidas just change positions, VCL will then draw the kashida automaticly
- sal_uInt16 nPortionEnd = nPortionStart + pLastPortion->GetLen();
- for ( sal_uInt16 _n = nChar; _n < nPortionEnd; _n++ )
- {
- pLine->GetCharPosArray()[_n-nFirstChar] += nMore4Everyone;
- if ( nSomeExtraSpace )
- pLine->GetCharPosArray()[_n-nFirstChar]++;
- }
-
- if ( nSomeExtraSpace )
- nSomeExtraSpace--;
- }
- }
-
- // Now the text width contains the extra width...
- pLine->SetTextWidth( pLine->GetTextWidth() + nRemainingSpace );
-}
-
-void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, SvUShorts& rArray )
-{
- // the search has to be performed on a per word base
-
- EditSelection aWordSel( EditPaM( pNode, nStart ) );
- aWordSel = SelectWord( aWordSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- if ( aWordSel.Min().GetIndex() < nStart )
- aWordSel.Min().GetIndex() = nStart;
-
- while ( ( aWordSel.Min().GetNode() == pNode ) && ( aWordSel.Min().GetIndex() < nEnd ) )
- {
- sal_uInt16 nSavPos = aWordSel.Max().GetIndex();
- if ( aWordSel.Max().GetIndex() > nEnd )
- aWordSel.Max().GetIndex() = nEnd;
-
- String aWord = GetSelected( aWordSel );
-
- // restore selection for proper iteration at the end of the function
- aWordSel.Max().GetIndex() = nSavPos;
-
- xub_StrLen nIdx = 0;
- xub_StrLen nKashidaPos = STRING_LEN;
- xub_Unicode cCh;
- xub_Unicode cPrevCh = 0;
-
- while ( nIdx < aWord.Len() )
- {
- cCh = aWord.GetChar( nIdx );
-
- // 1. Priority:
- // after user inserted kashida
- if ( 0x640 == cCh )
- {
- nKashidaPos = aWordSel.Min().GetIndex() + nIdx;
- break;
- }
-
- // 2. Priority:
- // after a Seen or Sad
- if ( nIdx + 1 < aWord.Len() &&
- ( 0x633 == cCh || 0x635 == cCh ) )
- {
- nKashidaPos = aWordSel.Min().GetIndex() + nIdx;
- break;
- }
-
- // 3. Priority:
- // before final form of Teh Marbuta, Hah, Dal
- // 4. Priority:
- // before final form of Alef, Lam or Kaf
- if ( nIdx && nIdx + 1 == aWord.Len() &&
- ( 0x629 == cCh || 0x62D == cCh || 0x62F == cCh ||
- 0x627 == cCh || 0x644 == cCh || 0x643 == cCh ) )
- {
- DBG_ASSERT( 0 != cPrevCh, "No previous character" );
-
- // check if character is connectable to previous character,
- if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
- {
- nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
- break;
- }
- }
-
- // 5. Priority:
- // before media Bah
- if ( nIdx && nIdx + 1 < aWord.Len() && 0x628 == cCh )
- {
- DBG_ASSERT( 0 != cPrevCh, "No previous character" );
-
- // check if next character is Reh, Yeh or Alef Maksura
- xub_Unicode cNextCh = aWord.GetChar( nIdx + 1 );
-
- if ( 0x631 == cNextCh || 0x64A == cNextCh ||
- 0x649 == cNextCh )
- {
- // check if character is connectable to previous character,
- if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
- nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
- }
- }
-
- // 6. Priority:
- // other connecting possibilities
- if ( nIdx && nIdx + 1 == aWord.Len() &&
- 0x60C <= cCh && 0x6FE >= cCh )
- {
- DBG_ASSERT( 0 != cPrevCh, "No previous character" );
-
- // check if character is connectable to previous character,
- if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
- {
- // only choose this position if we did not find
- // a better one:
- if ( STRING_LEN == nKashidaPos )
- nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
- break;
- }
- }
-
- // Do not consider Fathatan, Dammatan, Kasratan, Fatha,
- // Damma, Kasra, Shadda and Sukun when checking if
- // a character can be connected to previous character.
- if ( cCh < 0x64B || cCh > 0x652 )
- cPrevCh = cCh;
-
- ++nIdx;
- } // end of current word
-
- if ( STRING_LEN != nKashidaPos )
- rArray.Insert( nKashidaPos, rArray.Count() );
-
- aWordSel = WordRight( aWordSel.Max(), ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- aWordSel = SelectWord( aWordSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- }
-}
-
-sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nPos, EditLine* pCurLine )
-{
- DBG_ASSERT( pPortion, "SplitTextPortion: Which ?" );
-
- // The portion at nPos is split, if there is not a transition at nPos anyway
- if ( nPos == 0 )
- return 0;
-
- sal_uInt16 nSplitPortion;
- sal_uInt16 nTmpPos = 0;
- TextPortion* pTextPortion = 0;
- sal_uInt16 nPortions = pPortion->GetTextPortions().Count();
- for ( nSplitPortion = 0; nSplitPortion < nPortions; nSplitPortion++ )
- {
- TextPortion* pTP = pPortion->GetTextPortions().GetObject(nSplitPortion);
- nTmpPos = nTmpPos + pTP->GetLen();
- if ( nTmpPos >= nPos )
- {
- if ( nTmpPos == nPos ) // then nothing needs to be split
- {
- return nSplitPortion;
- }
- pTextPortion = pTP;
- break;
- }
- }
-
- 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 );
- // Set sizes
- if ( pCurLine )
- {
- // No new GetTextSize, instead use values from the Array:
- DBG_ASSERT( nPos > pCurLine->GetStart(), "SplitTextPortion at the beginning of the line?" );
- pTextPortion->GetSize().Width() = pCurLine->GetCharPosArray()[ nPos-pCurLine->GetStart()-1 ];
-
- if ( pTextPortion->GetExtraInfos() && pTextPortion->GetExtraInfos()->bCompressed )
- {
- // We need the original size from the portion
- sal_uInt16 nTxtPortionStart = pPortion->GetTextPortions().GetStartPos( nSplitPortion );
- SvxFont aTmpFont( pPortion->GetNode()->GetCharAttribs().GetDefFont() );
- SeekCursor( pPortion->GetNode(), nTxtPortionStart+1, aTmpFont );
- aTmpFont.SetPhysFont( GetRefDevice() );
- GetRefDevice()->Push( PUSH_TEXTLANGUAGE );
- ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
- Size aSz = aTmpFont.QuickGetTextSize( GetRefDevice(), *pPortion->GetNode(), nTxtPortionStart, pTextPortion->GetLen(), NULL );
- GetRefDevice()->Pop();
- pTextPortion->GetExtraInfos()->nOrgWidth = aSz.Width();
- }
- }
- else
- pTextPortion->GetSize().Width() = (-1);
-
- return nSplitPortion;
-}
-
-void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& rStart /* , sal_Bool bCreateBlockPortions */ )
-{
- sal_uInt16 nStartPos = rStart;
- ContentNode* pNode = pParaPortion->GetNode();
- DBG_ASSERT( pNode->Len(), "CreateTextPortions should not be used for empty paragraphs!" );
-
- SortedPositions aPositions;
- aPositions.Insert( (sal_uInt32) 0 );
-
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttrib = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- while ( pAttrib )
- {
- // 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++;
- pAttrib = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- }
- aPositions.Insert( pNode->Len() );
-
- if ( pParaPortion->aScriptInfos.empty() )
- ((ImpEditEngine*)this)->InitScriptTypes( GetParaPortions().GetPos( pParaPortion ) );
-
- const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
- for ( size_t nT = 0; nT < rTypes.size(); nT++ )
- aPositions.Insert( rTypes[nT].nStartPos );
-
- const WritingDirectionInfos& rWritingDirections = pParaPortion->aWritingDirectionInfos;
- for ( size_t nD = 0; nD < rWritingDirections.size(); nD++ )
- aPositions.Insert( rWritingDirections[nD].nStartPos );
-
- if ( mpIMEInfos && mpIMEInfos->nLen && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetNode() == pNode ) )
- {
- sal_uInt16 nLastAttr = 0xFFFF;
- for( sal_uInt16 n = 0; n < mpIMEInfos->nLen; n++ )
- {
- if ( mpIMEInfos->pAttribs[n] != nLastAttr )
- {
- aPositions.Insert( mpIMEInfos->aPos.GetIndex() + n );
- nLastAttr = mpIMEInfos->pAttribs[n];
- }
- }
- aPositions.Insert( mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen );
- }
-
- // 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;
- for ( nP = 0; nP < pParaPortion->GetTextPortions().Count(); nP++ )
- {
- TextPortion* pTmpPortion = pParaPortion->GetTextPortions().GetObject(nP);
- nPortionStart = nPortionStart + pTmpPortion->GetLen();
- if ( nPortionStart >= nStartPos )
- {
- nPortionStart = nPortionStart - pTmpPortion->GetLen();
- rStart = nPortionStart;
- nInvPortion = nP;
- break;
- }
- }
- DBG_ASSERT( nP < pParaPortion->GetTextPortions().Count() || !pParaPortion->GetTextPortions().Count(), "Nothing to delete: CreateTextPortions" );
- if ( nInvPortion && ( nPortionStart+pParaPortion->GetTextPortions().GetObject(nInvPortion)->GetLen() > nStartPos ) )
- {
- // 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 );
-
- // A portion may also have been formed by a line break:
- aPositions.Insert( nPortionStart );
-
- sal_uInt16 nInvPos;
-#ifdef DBG_UTIL
- sal_Bool bFound =
-#endif
- aPositions.Seek_Entry( nPortionStart, &nInvPos );
-
- DBG_ASSERT( bFound && ( nInvPos < (aPositions.Count()-1) ), "InvPos ?!" );
- for ( sal_uInt16 i = nInvPos+1; i < aPositions.Count(); i++ )
- {
- TextPortion* pNew = new TextPortion( (sal_uInt16)aPositions[i] - (sal_uInt16)aPositions[i-1] );
- pParaPortion->GetTextPortions().Insert( pNew, pParaPortion->GetTextPortions().Count());
- }
-
- DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "No Portions?!" );
-#if OSL_DEBUG_LEVEL > 2
- OSL_ENSURE( pParaPortion->DbgCheckTextPortions(), "Portion is broken?" );
-#endif
-}
-
-void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nStartPos, short nNewChars )
-{
- DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "No Portions!" );
- DBG_ASSERT( nNewChars, "RecalcTextPortion with Diff == 0" );
-
- ContentNode* const pNode = pParaPortion->GetNode();
- if ( nNewChars > 0 )
- {
- // 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;
-
- // 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, "the empty portion was no TextPortion!" );
- sal_uInt16 & r =
- pParaPortion->GetTextPortions()[nNewPortionPos]->GetLen();
- r = r + nNewChars;
- }
- else
- {
- TextPortion* pNewPortion = new TextPortion( nNewChars );
- pParaPortion->GetTextPortions().Insert( pNewPortion, nNewPortionPos );
- }
- }
- else
- {
- sal_uInt16 nPortionStart;
- const sal_uInt16 nTP = pParaPortion->GetTextPortions().
- FindPortion( nStartPos, nPortionStart );
- TextPortion* const pTP = pParaPortion->GetTextPortions()[ nTP ];
- DBG_ASSERT( pTP, "RecalcTextPortion: Portion not found" );
- pTP->GetLen() = pTP->GetLen() + nNewChars;
- pTP->GetSize().Width() = (-1);
- }
- }
- else
- {
- // Shrink or remove portion if necessary.
- // Before calling this method it must be ensured that no portions were
- // in the deleted area!
-
- // 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;
- sal_uInt16 nPortions = pParaPortion->GetTextPortions().Count();
- TextPortion* pTP = 0;
- for ( nPortion = 0; nPortion < nPortions; nPortion++ )
- {
- pTP = pParaPortion->GetTextPortions()[ nPortion ];
- if ( ( nPos+pTP->GetLen() ) > nStartPos )
- {
- DBG_ASSERT( nPos <= nStartPos, "Wrong Start!" );
- DBG_ASSERT( nPos+pTP->GetLen() >= nEnd, "Wrong End!" );
- break;
- }
- nPos = nPos + pTP->GetLen();
- }
- DBG_ASSERT( pTP, "RecalcTextPortion: Portion not found" );
- if ( ( nPos == nStartPos ) && ( (nPos+pTP->GetLen()) == nEnd ) )
- {
- // Remove portion;
- sal_uInt8 nType = pTP->GetKind();
- pParaPortion->GetTextPortions().Remove( nPortion );
- delete pTP;
- if ( nType == PORTIONKIND_LINEBREAK )
- {
- TextPortion* pNext = pParaPortion->GetTextPortions()[ nPortion ];
- if ( pNext && !pNext->GetLen() )
- {
- // Remove dummy portion
- pParaPortion->GetTextPortions().Remove( nPortion );
- delete pNext;
- }
- }
- }
- else
- {
- DBG_ASSERT( pTP->GetLen() > (-nNewChars), "Portion too small to shrink! ");
- pTP->GetLen() = pTP->GetLen() + nNewChars;
- }
-
- // 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 )
- {
- // Discard portion; if possible, correct the ones before,
- // if the Hyphenator portion has swallowed one character...
- pParaPortion->GetTextPortions().Remove( nLastPortion );
- if ( nLastPortion && pTP->GetLen() )
- {
- TextPortion* pPrev = pParaPortion->GetTextPortions().GetObject( nLastPortion - 1 );
- DBG_ASSERT( pPrev->GetKind() == PORTIONKIND_TEXT, "Portion?!" );
- pPrev->SetLen( pPrev->GetLen() + pTP->GetLen() );
- pPrev->GetSize().Width() = (-1);
- }
- delete pTP;
- }
- }
-#if OSL_DEBUG_LEVEL > 2
- OSL_ENSURE( pParaPortion->DbgCheckTextPortions(), "Portions are broken?" );
-#endif
-}
-
-void ImpEditEngine::SetTextRanger( TextRanger* pRanger )
-{
- if ( pTextRanger != pRanger )
- {
- delete pTextRanger;
- pTextRanger = pRanger;
-
- for ( sal_uInt16 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
- {
- ParaPortion* pParaPortion = GetParaPortions().GetObject( nPara );
- pParaPortion->MarkSelectionInvalid( 0, pParaPortion->GetNode()->Len() );
- pParaPortion->GetLines().Reset();
- }
-
- FormatFullDoc();
- UpdateViews( GetActiveView() );
- if ( GetUpdateMode() && GetActiveView() )
- pActiveView->ShowCursor( sal_False, sal_False );
- }
-}
-
-void ImpEditEngine::SetVertical( sal_Bool bVertical )
-{
- if ( IsVertical() != bVertical )
- {
- GetEditDoc().SetVertical( bVertical );
- sal_Bool bUseCharAttribs = ( aStatus.GetControlWord() & EE_CNTRL_USECHARATTRIBS ) ? sal_True : sal_False;
- GetEditDoc().CreateDefFont( bUseCharAttribs );
- if ( IsFormatted() )
- {
- FormatFullDoc();
- UpdateViews( GetActiveView() );
- }
- }
-}
-
-void ImpEditEngine::SetFixedCellHeight( sal_Bool bUseFixedCellHeight )
-{
- if ( IsFixedCellHeight() != bUseFixedCellHeight )
- {
- GetEditDoc().SetFixedCellHeight( bUseFixedCellHeight );
- if ( IsFormatted() )
- {
- FormatFullDoc();
- UpdateViews( GetActiveView() );
- }
- }
-}
-
-void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut, sal_uInt16 nIgnoreWhich )
-{
- // 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() )
- nPos = pNode->Len();
-
- rFont = pNode->GetCharAttribs().GetDefFont();
-
- short nScriptType = GetScriptType( EditPaM( pNode, nPos ) );
- if ( ( nScriptType == i18n::ScriptType::ASIAN ) || ( nScriptType == i18n::ScriptType::COMPLEX ) )
- {
- const SvxFontItem& rFontItem = (const SvxFontItem&)pNode->GetContentAttribs().GetItem( GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ) );
- rFont.SetName( rFontItem.GetFamilyName() );
- rFont.SetFamily( rFontItem.GetFamily() );
- rFont.SetPitch( rFontItem.GetPitch() );
- rFont.SetCharSet( rFontItem.GetCharSet() );
- Size aSz( rFont.GetSize() );
- aSz.Height() = ((const SvxFontHeightItem&)pNode->GetContentAttribs().GetItem( GetScriptItemId( EE_CHAR_FONTHEIGHT, nScriptType ) ) ).GetHeight();
- rFont.SetSize( aSz );
- rFont.SetWeight( ((const SvxWeightItem&)pNode->GetContentAttribs().GetItem( GetScriptItemId( EE_CHAR_WEIGHT, nScriptType ))).GetWeight() );
- rFont.SetItalic( ((const SvxPostureItem&)pNode->GetContentAttribs().GetItem( GetScriptItemId( EE_CHAR_ITALIC, nScriptType ))).GetPosture() );
- rFont.SetLanguage( ((const SvxLanguageItem&)pNode->GetContentAttribs().GetItem( GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ))).GetLanguage() );
- }
-
- sal_uInt16 nRelWidth = ((const SvxCharScaleWidthItem&)pNode->GetContentAttribs().GetItem( EE_CHAR_FONTWIDTH)).GetValue();
-
- if ( pOut )
- {
- const SvxUnderlineItem& rTextLineColor = (const SvxUnderlineItem&)pNode->GetContentAttribs().GetItem( EE_CHAR_UNDERLINE );
- if ( rTextLineColor.GetColor() != COL_TRANSPARENT )
- pOut->SetTextLineColor( rTextLineColor.GetColor() );
- else
- pOut->SetTextLineColor();
- }
-
- if ( pOut )
- {
- const SvxOverlineItem& rOverlineColor = (const SvxOverlineItem&)pNode->GetContentAttribs().GetItem( EE_CHAR_OVERLINE );
- if ( rOverlineColor.GetColor() != COL_TRANSPARENT )
- pOut->SetOverlineColor( rOverlineColor.GetColor() );
- else
- pOut->SetOverlineColor();
- }
-
- const SvxLanguageItem* pCJKLanguageItem = NULL;
-
- if ( aStatus.UseCharAttribs() )
- {
- const CharAttribArray& rAttribs = pNode->GetCharAttribs().GetAttribs();
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttrib = GetAttrib( rAttribs, nAttr );
- while ( pAttrib && ( pAttrib->GetStart() <= nPos ) )
- {
- // 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 ), "Invalid Attribute in Seek() " );
- if ( IsScriptItemValid( pAttrib->Which(), nScriptType ) )
- {
- pAttrib->SetFont( rFont, pOut );
- // #i1550# hard color attrib should win over text color from field
- if ( pAttrib->Which() == EE_FEATURE_FIELD )
- {
- EditCharAttrib* pColorAttr = pNode->GetCharAttribs().FindAttrib( EE_CHAR_COLOR, nPos );
- if ( pColorAttr )
- pColorAttr->SetFont( rFont, pOut );
- }
- }
- if ( pAttrib->Which() == EE_CHAR_FONTWIDTH )
- nRelWidth = ((const SvxCharScaleWidthItem*)pAttrib->GetItem())->GetValue();
- if ( pAttrib->Which() == EE_CHAR_LANGUAGE_CJK )
- pCJKLanguageItem = (const SvxLanguageItem*) pAttrib->GetItem();
- }
- pAttrib = GetAttrib( rAttribs, ++nAttr );
- }
- }
-
- if ( !pCJKLanguageItem )
- pCJKLanguageItem = (const SvxLanguageItem*) &pNode->GetContentAttribs().GetItem( EE_CHAR_LANGUAGE_CJK );
-
- rFont.SetCJKContextLanguage( pCJKLanguageItem->GetLanguage() );
-
- if ( rFont.GetKerning() && IsKernAsianPunctuation() && ( nScriptType == i18n::ScriptType::ASIAN ) )
- rFont.SetKerning( rFont.GetKerning() | KERNING_ASIAN );
-
- if ( aStatus.DoNotUseColors() )
- {
- rFont.SetColor( /* rColorItem.GetValue() */ COL_BLACK );
- }
-
- if ( aStatus.DoStretch() || ( nRelWidth != 100 ) )
- {
- // 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() );
- // 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() )
- {
- if ( nStretchY != 100 )
- {
- aRealSz.Height() *= nStretchY;
- aRealSz.Height() /= 100;
- }
- if ( nStretchX != 100 )
- {
- if ( nStretchX == nStretchY &&
- nRelWidth == 100 )
- {
- aRealSz.Width() = 0;
- }
- else
- {
- 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 );
- }
- }
- }
- if ( nRelWidth != 100 )
- {
- aRealSz.Width() *= nRelWidth;
- aRealSz.Width() /= 100;
- }
- rFont.SetSize( aRealSz );
- // Font is not restored ...
- }
-
- if ( ( ( rFont.GetColor() == COL_AUTO ) || ( IsForceAutoColor() ) ) && pOut )
- {
- // #i75566# Do not use AutoColor when printing OR Pdf export
- const bool bPrinting(OUTDEV_PRINTER == pOut->GetOutDevType());
- const bool bPDFExporting(0 != pOut->GetPDFWriter());
-
- if ( IsAutoColorEnabled() && !bPrinting && !bPDFExporting)
- {
- // Never use WindowTextColor on the printer
- rFont.SetColor( GetAutoColor() );
- }
- else
- {
- if ( ( GetBackgroundColor() != COL_AUTO ) && GetBackgroundColor().IsDark() )
- rFont.SetColor( COL_WHITE );
- else
- rFont.SetColor( COL_BLACK );
- }
- }
-
- if ( mpIMEInfos && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetNode() == pNode ) &&
- ( nPos > mpIMEInfos->aPos.GetIndex() ) && ( nPos <= ( mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen ) ) )
- {
- sal_uInt16 nAttr = mpIMEInfos->pAttribs[ nPos - mpIMEInfos->aPos.GetIndex() - 1 ];
- if ( nAttr & EXTTEXTINPUT_ATTR_UNDERLINE )
- rFont.SetUnderline( UNDERLINE_SINGLE );
- else if ( nAttr & EXTTEXTINPUT_ATTR_BOLDUNDERLINE )
- rFont.SetUnderline( UNDERLINE_BOLD );
- else if ( nAttr & EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE )
- rFont.SetUnderline( UNDERLINE_DOTTED );
- else if ( nAttr & EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE )
- rFont.SetUnderline( UNDERLINE_DOTTED );
- else if ( nAttr & EXTTEXTINPUT_ATTR_REDTEXT )
- rFont.SetColor( Color( COL_RED ) );
- else if ( nAttr & EXTTEXTINPUT_ATTR_HALFTONETEXT )
- rFont.SetColor( Color( COL_LIGHTGRAY ) );
- if ( nAttr & EXTTEXTINPUT_ATTR_HIGHLIGHT )
- {
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- rFont.SetColor( rStyleSettings.GetHighlightTextColor() );
- rFont.SetFillColor( rStyleSettings.GetHighlightColor() );
- rFont.SetTransparent( sal_False );
- }
- else if ( nAttr & EXTTEXTINPUT_ATTR_GRAYWAVELINE )
- {
- rFont.SetUnderline( UNDERLINE_WAVE );
- if( pOut )
- pOut->SetTextLineColor( Color( COL_LIGHTGRAY ) );
- }
- }
-}
-
-void ImpEditEngine::RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics, SvxFont& rFont )
-{
- // for line height at high / low first without Propr!
- sal_uInt16 nPropr = rFont.GetPropr();
- DBG_ASSERT( ( nPropr == 100 ) || rFont.GetEscapement(), "Propr without Escape?!" );
- if ( nPropr != 100 )
- {
- rFont.SetPropr( 100 );
- rFont.SetPhysFont( pRefDev );
- }
- sal_uInt16 nAscent, nDescent;
-
- FontMetric aMetric( pRefDev->GetFontMetric() );
- nAscent = (sal_uInt16)aMetric.GetAscent();
- if ( IsAddExtLeading() )
- nAscent = sal::static_int_cast< sal_uInt16 >(
- nAscent + aMetric.GetExtLeading() );
- nDescent = (sal_uInt16)aMetric.GetDescent();
-
- if ( IsFixedCellHeight() )
- {
- 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 without leading cause problems
- if ( ( nIntLeading == 0 ) && ( pRefDev->GetOutDevType() == OUTDEV_PRINTER ) )
- {
- // Lets see what Leading one gets on the screen
- VirtualDevice* pVDev = GetVirtualDevice( pRefDev->GetMapMode(), pRefDev->GetDrawMode() );
- rFont.SetPhysFont( pVDev );
- aMetric = pVDev->GetFontMetric();
-
- // 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();
- }
- }
- if ( nAscent > rCurMetrics.nMaxAscent )
- rCurMetrics.nMaxAscent = nAscent;
- if ( nDescent > rCurMetrics.nMaxDescent )
- rCurMetrics.nMaxDescent= nDescent;
- // Special treatment of high/low:
- if ( rFont.GetEscapement() )
- {
- // Now in consideration of Escape/Propr
- // possibly enlarge Ascent or Descent
- short nDiff = (short)(rFont.GetSize().Height()*rFont.GetEscapement()/100L);
- if ( rFont.GetEscapement() > 0 )
- {
- nAscent = (sal_uInt16) (((long)nAscent)*nPropr/100 + nDiff);
- if ( nAscent > rCurMetrics.nMaxAscent )
- rCurMetrics.nMaxAscent = nAscent;
- }
- else // has to be < 0
- {
- nDescent = (sal_uInt16) (((long)nDescent)*nPropr/100 - nDiff);
- if ( nDescent > rCurMetrics.nMaxDescent )
- rCurMetrics.nMaxDescent= nDescent;
- }
- }
-}
-
-void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aStartPos, sal_Bool bStripOnly, short nOrientation )
-{
- if ( !GetUpdateMode() && !bStripOnly )
- return;
-
- if ( !IsFormatted() )
- FormatDoc();
-
- long nFirstVisXPos = - pOutDev->GetMapMode().GetOrigin().X();
- long nFirstVisYPos = - pOutDev->GetMapMode().GetOrigin().Y();
-
- EditLine* pLine;
- Point aTmpPos;
- Point aRedLineTmpPos;
- 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() );
-
- // 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 )
- {
- double nRealOrientation = nOrientation*F_PI1800;
- nCos = cos( nRealOrientation );
- nSin = sin( nRealOrientation );
- }
-
- // #110496# Added some more optional metafile comments. This
- // change: factored out some duplicated code.
- GDIMetaFile* pMtf = pOutDev->GetConnectMetaFile();
- const bool bMetafileValid( pMtf != NULL );
-
- long nVertLineSpacing = CalcVertLineSpacing(aStartPos);
-
- // --------------------------------------------------
- // 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" );
- // if when typing idle formatting, asynchronous Paint.
- // Invisible Portions may be invalid.
- if ( pPortion->IsVisible() && pPortion->IsInvalid() )
- return;
-
- if ( pPDFExtOutDevData )
- pPDFExtOutDevData->BeginStructureElement( vcl::PDFWriter::Paragraph );
-
- long nParaHeight = pPortion->GetHeight();
- sal_uInt16 nIndex = 0;
- if ( pPortion->IsVisible() && (
- ( !IsVertical() && ( ( aStartPos.Y() + nParaHeight ) > aClipRec.Top() ) ) ||
- ( IsVertical() && ( ( aStartPos.X() - nParaHeight ) < aClipRec.Right() ) ) ) )
-
- {
- // --------------------------------------------------
- // Over the lines of the paragraph ...
- // --------------------------------------------------
- sal_uInt16 nLines = pPortion->GetLines().Count();
- sal_uInt16 nLastLine = nLines-1;
-
- if ( !IsVertical() )
- aStartPos.Y() += pPortion->GetFirstLineOffset();
- else
- aStartPos.X() -= pPortion->GetFirstLineOffset();
-
- Point aParaStart( aStartPos );
-
- 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;
- for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ )
- {
- pLine = pPortion->GetLines().GetObject(nLine);
- 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() ) )
- || ( IsVertical() && aStartPos.X() < aClipRec.Right() ) )
- {
- // Why not just also call when stripping portions? This will give the correct values
- // and needs no position corrections in OutlinerEditEng::DrawingText which tries to call
- // PaintBullet correctly; exactly what GetEditEnginePtr()->PaintingFirstLine
- // does, too. No change for not-layouting (painting).
- if(0 == nLine) // && !bStripOnly)
- {
- GetEditEnginePtr()->PaintingFirstLine( n, aParaStart, aTmpPos.Y(), aOrigin, nOrientation, pOutDev );
- }
-
- // --------------------------------------------------
- // Over the Portions of the line ...
- // --------------------------------------------------
- nIndex = pLine->GetStart();
- for ( sal_uInt16 y = pLine->GetStartPortion(); y <= pLine->GetEndPortion(); y++ )
- {
- DBG_ASSERT( pPortion->GetTextPortions().Count(), "Line without Textportion in Paint!" );
- TextPortion* pTextPortion = pPortion->GetTextPortions().GetObject( y );
- 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; // No further output in line necessary
- }
- else
- {
- aTmpPos.Y() = aStartPos.Y() + nPortionXOffset;
- if ( aTmpPos.Y() > aClipRec.Bottom() )
- break; // No further output in line necessary
- }
-
- switch ( pTextPortion->GetKind() )
- {
- case PORTIONKIND_TEXT:
- case PORTIONKIND_FIELD:
- case PORTIONKIND_HYPHENATOR:
- {
- SeekCursor( pPortion->GetNode(), nIndex+1, aTmpFont, pOutDev );
-
- sal_Bool bDrawFrame = sal_False;
-
- if ( ( pTextPortion->GetKind() == PORTIONKIND_FIELD ) && !aTmpFont.IsTransparent() &&
- ( GetBackgroundColor() != COL_AUTO ) && GetBackgroundColor().IsDark() &&
- ( IsAutoColorEnabled() && ( pOutDev->GetOutDevType() != OUTDEV_PRINTER ) ) )
- {
- aTmpFont.SetTransparent( sal_True );
- pOutDev->SetFillColor();
- pOutDev->SetLineColor( GetAutoColor() );
- bDrawFrame = sal_True;
- }
-
-#if OSL_DEBUG_LEVEL > 2
- if ( pTextPortion->GetKind() == PORTIONKIND_HYPHENATOR )
- {
- aTmpFont.SetFillColor( COL_LIGHTGRAY );
- aTmpFont.SetTransparent( sal_False );
- }
- if ( pTextPortion->GetRightToLeft() )
- {
- aTmpFont.SetFillColor( COL_LIGHTGRAY );
- aTmpFont.SetTransparent( sal_False );
- }
- else if ( GetScriptType( EditPaM( pPortion->GetNode(), nIndex+1 ) ) == i18n::ScriptType::COMPLEX )
- {
- aTmpFont.SetFillColor( COL_LIGHTCYAN );
- aTmpFont.SetTransparent( sal_False );
- }
-#endif
- aTmpFont.SetPhysFont( pOutDev );
-
- // #114278# Saving both layout mode and language (since I'm
- // potentially changing both)
- pOutDev->Push( PUSH_TEXTLAYOUTMODE|PUSH_TEXTLANGUAGE );
- ImplInitLayoutMode( pOutDev, n, nIndex );
- ImplInitDigitMode( pOutDev, 0, 0, 0, aTmpFont.GetLanguage() );
-
- XubString aText;
- sal_uInt16 nTextStart = 0;
- sal_uInt16 nTextLen = 0;
- const sal_Int32* pDXArray = 0;
- sal_Int32* pTmpDXArray = 0;
-
- if ( pTextPortion->GetKind() == PORTIONKIND_TEXT )
- {
- aText = *pPortion->GetNode();
- nTextStart = nIndex;
- nTextLen = pTextPortion->GetLen();
- pDXArray = pLine->GetCharPosArray().GetData()+( nIndex-pLine->GetStart() );
-
- // Paint control characters (#i55716#)
- if ( aStatus.MarkFields() )
- {
- xub_StrLen nTmpIdx;
- const xub_StrLen nTmpEnd = nTextStart + pTextPortion->GetLen();
-
- for ( nTmpIdx = nTextStart; nTmpIdx <= nTmpEnd ; ++nTmpIdx )
- {
- const sal_Unicode cChar = ( nTmpIdx != aText.Len() && ( nTmpIdx != nTextStart || 0 == nTextStart ) ) ?
- aText.GetChar( nTmpIdx ) :
- 0;
-
- if ( 0x200B == cChar || 0x2060 == cChar )
- {
- const String aBlank( ' ' );
- long nHalfBlankWidth = aTmpFont.QuickGetTextSize( pOutDev, aBlank, 0, 1, 0 ).Width() / 2;
-
- const long nAdvanceX = ( nTmpIdx == nTmpEnd ?
- pTextPortion->GetSize().Width() :
- pDXArray[ nTmpIdx - nTextStart ] ) - nHalfBlankWidth;
- const long nAdvanceY = -pLine->GetMaxAscent();
-
- Point aTopLeftRectPos( aTmpPos );
- if ( !IsVertical() )
- {
- aTopLeftRectPos.X() += nAdvanceX;
- aTopLeftRectPos.Y() += nAdvanceY;
- }
- else
- {
- aTopLeftRectPos.Y() += nAdvanceX;
- aTopLeftRectPos.X() -= nAdvanceY;
- }
-
- Point aBottomRightRectPos( aTopLeftRectPos );
- if ( !IsVertical() )
- {
- aBottomRightRectPos.X() += 2 * nHalfBlankWidth;
- aBottomRightRectPos.Y() += pLine->GetHeight();
- }
- else
- {
- aBottomRightRectPos.X() -= pLine->GetHeight();
- aBottomRightRectPos.Y() += 2 * nHalfBlankWidth;
- }
-
- pOutDev->Push( PUSH_FILLCOLOR );
- pOutDev->Push( PUSH_LINECOLOR );
- pOutDev->SetFillColor( COL_LIGHTGRAY );
- pOutDev->SetLineColor( COL_LIGHTGRAY );
-
- const Rectangle aBackRect( aTopLeftRectPos, aBottomRightRectPos );
- pOutDev->DrawRect( aBackRect );
-
- pOutDev->Pop();
- pOutDev->Pop();
-
- if ( 0x200B == cChar )
- {
- const String aSlash( '/' );
- const short nOldEscapement = aTmpFont.GetEscapement();
- const sal_uInt8 nOldPropr = aTmpFont.GetPropr();
-
- aTmpFont.SetEscapement( -20 );
- aTmpFont.SetPropr( 25 );
- aTmpFont.SetPhysFont( pOutDev );
-
- const Size aSlashSize = aTmpFont.QuickGetTextSize( pOutDev, aSlash, 0, 1, 0 );
- Point aSlashPos( aTmpPos );
- const long nAddX = nHalfBlankWidth - aSlashSize.Width() / 2;
- if ( !IsVertical() )
- {
- aSlashPos.X() = aTopLeftRectPos.X() + nAddX;
- }
- else
- {
- aSlashPos.Y() = aTopLeftRectPos.Y() + nAddX;
- }
-
- aTmpFont.QuickDrawText( pOutDev, aSlashPos, aSlash, 0, 1, 0 );
-
- aTmpFont.SetEscapement( nOldEscapement );
- aTmpFont.SetPropr( nOldPropr );
- aTmpFont.SetPhysFont( pOutDev );
- }
- }
- }
- }
- }
- else if ( pTextPortion->GetKind() == PORTIONKIND_FIELD )
- {
- EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature( nIndex );
- 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();
-
- pTmpDXArray = new sal_Int32[ aText.Len() ];
- pDXArray = pTmpDXArray;
- Font _aOldFont( GetRefDevice()->GetFont() );
- aTmpFont.SetPhysFont( GetRefDevice() );
- aTmpFont.QuickGetTextSize( GetRefDevice(), aText, 0, aText.Len(), pTmpDXArray );
- if ( aStatus.DoRestoreFont() )
- GetRefDevice()->SetFont( _aOldFont );
-
- // add a meta file comment if we record to a metafile
- if( bMetafileValid )
- {
- SvxFieldItem* pFieldItem = PTR_CAST( SvxFieldItem, pAttr->GetItem() );
- if( pFieldItem )
- {
- const SvxFieldData* pFieldData = pFieldItem->GetField();
- if( pFieldData )
- pMtf->AddAction( pFieldData->createBeginComment() );
- }
- }
-
- }
- else if ( pTextPortion->GetKind() == PORTIONKIND_HYPHENATOR )
- {
- if ( pTextPortion->GetExtraValue() )
- aText = pTextPortion->GetExtraValue();
- aText += CH_HYPH;
- nTextStart = 0;
- nTextLen = aText.Len();
-
- // crash when accessing 0 pointer in pDXArray
- pTmpDXArray = new sal_Int32[ aText.Len() ];
- pDXArray = pTmpDXArray;
- Font _aOldFont( GetRefDevice()->GetFont() );
- aTmpFont.SetPhysFont( GetRefDevice() );
- aTmpFont.QuickGetTextSize( GetRefDevice(), aText, 0, aText.Len(), pTmpDXArray );
- if ( aStatus.DoRestoreFont() )
- GetRefDevice()->SetFont( _aOldFont );
- }
-
- long nTxtWidth = pTextPortion->GetSize().Width();
-
- Point aOutPos( aTmpPos );
- aRedLineTmpPos = aTmpPos;
- // In RTL portions spell markup pos should be at the start of the
- // first chara as well. That is on the right end of the portion
- if (pTextPortion->IsRightToLeft())
- aRedLineTmpPos.X() += pTextPortion->GetSize().Width();
-
- if ( bStripOnly )
- {
- EEngineData::WrongSpellVector aWrongSpellVector;
-
- if(GetStatus().DoOnlineSpelling() && pTextPortion->GetLen())
- {
- WrongList* pWrongs = pPortion->GetNode()->GetWrongList();
-
- if(pWrongs && pWrongs->HasWrongs())
- {
- sal_uInt16 nStart(nIndex);
- sal_uInt16 nEnd(0);
- sal_Bool bWrong(pWrongs->NextWrong(nStart, nEnd));
- const sal_uInt16 nMaxEnd(nIndex + pTextPortion->GetLen());
-
- while(bWrong)
- {
- if(nStart >= nMaxEnd)
- {
- break;
- }
-
- if(nStart < nIndex)
- {
- nStart = nIndex;
- }
-
- if(nEnd > nMaxEnd)
- {
- nEnd = nMaxEnd;
- }
-
- // add to vector
- aWrongSpellVector.push_back(EEngineData::WrongSpellClass(nStart, nEnd));
-
- // goto next index
- nStart = nEnd + 1;
-
- if(nEnd < nMaxEnd)
- {
- bWrong = pWrongs->NextWrong(nStart, nEnd);
- }
- else
- {
- bWrong = sal_False;
- }
- }
- }
- }
-
- const SvxFieldData* pFieldData = 0;
-
- if(PORTIONKIND_FIELD == pTextPortion->GetKind())
- {
- EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex);
- SvxFieldItem* pFieldItem = PTR_CAST(SvxFieldItem, pAttr->GetItem());
-
- if(pFieldItem)
- {
- pFieldData = pFieldItem->GetField();
- }
- }
-
- // support for EOC, EOW, EOS TEXT comments. To support that,
- // the locale is needed. With the locale and a XBreakIterator it is
- // possible to re-create the text marking info on primitive level
- const lang::Locale aLocale(GetLocale(EditPaM(pPortion->GetNode(), nIndex + 1)));
-
- // create EOL and EOP bools
- const bool bEndOfLine(y == pLine->GetEndPortion());
- const bool bEndOfParagraph(bEndOfLine && nLine + 1 == nLines);
-
- // get Overline color (from ((const SvxOverlineItem*)GetItem())->GetColor() in
- // consequence, but also already set at pOutDev)
- const Color aOverlineColor(pOutDev->GetOverlineColor());
-
- // get TextLine color (from ((const SvxUnderlineItem*)GetItem())->GetColor() in
- // consequence, but also already set at pOutDev)
- const Color aTextLineColor(pOutDev->GetTextLineColor());
-
- // Unicode code points conversion according to ctl text numeral setting
- ImplInitDigitMode( 0, &aText, nTextStart, nTextLen, aTmpFont.GetLanguage() );
-
- // StripPortions() data callback
- GetEditEnginePtr()->DrawingText( aOutPos, aText, nTextStart, nTextLen, pDXArray,
- aTmpFont, n, nIndex, pTextPortion->GetRightToLeft(),
- aWrongSpellVector.size() ? &aWrongSpellVector : 0,
- pFieldData,
- bEndOfLine, bEndOfParagraph, false, // support for EOL/EOP TEXT comments
- &aLocale,
- aOverlineColor,
- aTextLineColor);
- }
- else
- {
- short nEsc = aTmpFont.GetEscapement();
- if ( nOrientation )
- {
- // In case of high/low do it yourself:
- if ( aTmpFont.GetEscapement() )
- {
- long nDiff = aTmpFont.GetSize().Height() * aTmpFont.GetEscapement() / 100L;
- if ( !IsVertical() )
- aOutPos.Y() -= nDiff;
- else
- aOutPos.X() += nDiff;
- aRedLineTmpPos = aOutPos;
- aTmpFont.SetEscapement( 0 );
- }
-
- aOutPos = lcl_ImplCalcRotatedPos( aOutPos, aOrigin, nSin, nCos );
- aTmpFont.SetOrientation( aTmpFont.GetOrientation()+nOrientation );
- aTmpFont.SetPhysFont( pOutDev );
-
- }
-
- // 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 ) ) )
- {
- // 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;
- // Underscore in front?
- if ( pPrev->GetStart() )
- {
- SeekCursor( pPortion->GetNode(), pPrev->GetStart(), aDummy );
- if ( aDummy.GetUnderline() != UNDERLINE_NONE )
- bSpecialUnderline = sal_True;
- }
- if ( !bSpecialUnderline && ( pPrev->GetEnd() < pPortion->GetNode()->Len() ) )
- {
- SeekCursor( pPortion->GetNode(), pPrev->GetEnd()+1, aDummy );
- if ( aDummy.GetUnderline() != UNDERLINE_NONE )
- bSpecialUnderline = sal_True;
- }
- }
- if ( bSpecialUnderline )
- {
- Size aSz = aTmpFont.GetPhysTxtSize( pOutDev, aText, nTextStart, nTextLen );
- sal_uInt8 nProp = aTmpFont.GetPropr();
- aTmpFont.SetEscapement( 0 );
- aTmpFont.SetPropr( 100 );
- aTmpFont.SetPhysFont( pOutDev );
- String aBlanks;
- aBlanks.Fill( nTextLen, ' ' );
- Point aUnderlinePos( aOutPos );
- if ( nOrientation )
- aUnderlinePos = lcl_ImplCalcRotatedPos( aTmpPos, aOrigin, nSin, nCos );
- pOutDev->DrawStretchText( aUnderlinePos, aSz.Width(), aBlanks, 0, nTextLen );
-
- aTmpFont.SetUnderline( UNDERLINE_NONE );
- if ( !nOrientation )
- aTmpFont.SetEscapement( nEsc );
- aTmpFont.SetPropr( nProp );
- aTmpFont.SetPhysFont( pOutDev );
- }
- }
- Point aRealOutPos( aOutPos );
- if ( ( pTextPortion->GetKind() == PORTIONKIND_TEXT )
- && pTextPortion->GetExtraInfos() && pTextPortion->GetExtraInfos()->bCompressed
- && pTextPortion->GetExtraInfos()->bFirstCharIsRightPunktuation )
- {
- aRealOutPos.X() += pTextPortion->GetExtraInfos()->nPortionOffsetX;
- }
-
- // 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 );
-
- if ( bDrawFrame )
- {
- Point aTopLeft( aTmpPos );
- aTopLeft.Y() -= pLine->GetMaxAscent();
- if ( nOrientation )
- aTopLeft = lcl_ImplCalcRotatedPos( aTopLeft, aOrigin, nSin, nCos );
- Rectangle aRect( aTopLeft, pTextPortion->GetSize() );
- pOutDev->DrawRect( aRect );
- }
-
- // PDF export:
- if ( pPDFExtOutDevData )
- {
- if ( pTextPortion->GetKind() == PORTIONKIND_FIELD )
- {
- EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature( nIndex );
- SvxFieldItem* pFieldItem = PTR_CAST( SvxFieldItem, pAttr->GetItem() );
- if( pFieldItem )
- {
- const SvxFieldData* pFieldData = pFieldItem->GetField();
- if ( pFieldData->ISA( SvxURLField ) )
- {
- Point aTopLeft( aTmpPos );
- aTopLeft.Y() -= pLine->GetMaxAscent();
-// if ( nOrientation )
-// aTopLeft = lcl_ImplCalcRotatedPos( aTopLeft, aOrigin, nSin, nCos );
-
- Rectangle aRect( aTopLeft, pTextPortion->GetSize() );
- vcl::PDFExtOutDevBookmarkEntry aBookmark;
- aBookmark.nLinkId = pPDFExtOutDevData->CreateLink( aRect );
- aBookmark.aBookmark = ((SvxURLField*)pFieldData)->GetURL();
- std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks();
- rBookmarks.push_back( aBookmark );
- }
- }
- }
- }
-
- // comment
-
-
-
-
- }
-
- if ( GetStatus().DoOnlineSpelling() && pPortion->GetNode()->GetWrongList()->HasWrongs() && pTextPortion->GetLen() )
- {
- {//#105750# adjust LinePos for superscript or subscript text
- short _nEsc = aTmpFont.GetEscapement();
- if( _nEsc )
- {
- long nShift = ((_nEsc*long(aTmpFont.GetSize().Height()))/ 100L);
- if( !IsVertical() )
- aRedLineTmpPos.Y() -= nShift;
- else
- aRedLineTmpPos.X() += nShift;
- }
- }
- Color aOldColor( pOutDev->GetLineColor() );
- pOutDev->SetLineColor( Color( GetColorConfig().GetColorValue( svtools::SPELL ).nColor ) );
- lcl_DrawRedLines( pOutDev, aTmpFont.GetSize().Height(), aRedLineTmpPos, nIndex, nIndex + pTextPortion->GetLen(), pDXArray, pPortion->GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical(), pTextPortion->IsRightToLeft() );
- pOutDev->SetLineColor( aOldColor );
- }
- }
-
- pOutDev->Pop();
-
- if ( pTmpDXArray )
- delete[] pTmpDXArray;
-
- if ( pTextPortion->GetKind() == PORTIONKIND_FIELD )
- {
- EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature( nIndex );
- 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 )
- {
- SvxFieldItem* pFieldItem = PTR_CAST( SvxFieldItem, pAttr->GetItem() );
-
- if( pFieldItem )
- {
- const SvxFieldData* pFieldData = pFieldItem->GetField();
- if( pFieldData )
- pMtf->AddAction( pFieldData->createEndComment() );
- }
- }
-
- }
-
- }
- break;
- case PORTIONKIND_TAB:
- {
- if ( pTextPortion->GetExtraValue() && ( pTextPortion->GetExtraValue() != ' ' ) )
- {
- SeekCursor( pPortion->GetNode(), nIndex+1, aTmpFont, pOutDev );
- aTmpFont.SetTransparent( sal_False );
- aTmpFont.SetEscapement( 0 );
- aTmpFont.SetPhysFont( pOutDev );
- long nCharWidth = aTmpFont.QuickGetTextSize( pOutDev, pTextPortion->GetExtraValue(), 0, 1, NULL ).Width();
- long nChars = 2;
- if( nCharWidth )
- nChars = pTextPortion->GetSize().Width() / nCharWidth;
- if ( nChars < 2 )
- nChars = 2; // is compressed by DrawStretchText.
- else if ( nChars == 2 )
- 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;
- }
- nIndex = nIndex + pTextPortion->GetLen();
- }
- }
-
- if ( ( nLine != nLastLine ) && !aStatus.IsOutliner() )
- {
- if ( !IsVertical() )
- aStartPos.Y() += nSBL;
- else
- aStartPos.X() -= nSBL;
- }
-
- // no more visible actions?
- if ( !IsVertical() && ( aStartPos.Y() >= aClipRec.Bottom() ) )
- break;
- else if ( IsVertical() && ( aStartPos.X() <= aClipRec.Left() ) )
- break;
- }
-
- if ( !aStatus.IsOutliner() )
- {
- const SvxULSpaceItem& rULItem = (const SvxULSpaceItem&)pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE );
- long nUL = GetYValue( rULItem.GetLower() );
- if ( !IsVertical() )
- aStartPos.Y() += nUL;
- else
- aStartPos.X() -= nUL;
- }
- }
- else
- {
- if ( !IsVertical() )
- aStartPos.Y() += nParaHeight;
- else
- aStartPos.X() -= nParaHeight;
- }
-
- if ( pPDFExtOutDevData )
- pPDFExtOutDevData->EndStructureElement();
-
- // no more visible actions?
- if ( !IsVertical() && ( aStartPos.Y() > aClipRec.Bottom() ) )
- break;
- if ( IsVertical() && ( aStartPos.X() < aClipRec.Left() ) )
- break;
- }
- if ( aStatus.DoRestoreFont() )
- pOutDev->SetFont( aOldFont );
-}
-
-void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool bUseVirtDev )
-{
- DBG_ASSERT( pView, "No View - No Paint!" );
- DBG_CHKOBJ( GetEditEnginePtr(), EditEngine, 0 );
-
- if ( !GetUpdateMode() || IsInUndo() )
- return;
-
- // Intersection of paint area and output area.
- Rectangle aClipRec( pView->GetOutputArea() );
- aClipRec.Intersection( rRec );
-
- Window* pOutWin = pView->GetWindow();
-
- if ( bUseVirtDev )
- {
- Rectangle aClipRecPixel( pOutWin->LogicToPixel( aClipRec ) );
- if ( !IsVertical() )
- {
- // etwas mehr, falls abgerundet!
- aClipRecPixel.Right() += 1;
- aClipRecPixel.Bottom() += 1;
- }
- else
- {
- aClipRecPixel.Left() -= 1;
- aClipRecPixel.Bottom() += 1;
- }
-
- // If aClipRecPixel > XXXX, then invalidate?!
-
- VirtualDevice* pVDev = GetVirtualDevice( pOutWin->GetMapMode(), pOutWin->GetDrawMode() );
- pVDev->SetDigitLanguage( GetRefDevice()->GetDigitLanguage() );
-
- {
- Color aBackgroundColor( pView->GetBackgroundColor() );
- // #i47161# Check if text is visible on background
- SvxFont aTmpFont;
- ContentNode* pNode = GetEditDoc().SaveGetObject( 0 );
- SeekCursor( pNode, 1, aTmpFont );
- Color aFontColor( aTmpFont.GetColor() );
- if( (aFontColor == COL_AUTO) || IsForceAutoColor() )
- aFontColor = GetAutoColor();
-
- // #i69346# check for reverse color of input method attribute
- if( mpIMEInfos && (mpIMEInfos->aPos.GetNode() == pNode &&
- mpIMEInfos->pAttribs))
- {
- sal_uInt16 nAttr = mpIMEInfos->pAttribs[ 0 ];
- if ( nAttr & EXTTEXTINPUT_ATTR_HIGHLIGHT )
- {
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- aFontColor = rStyleSettings.GetHighlightColor() ;
- }
- }
-
- sal_uInt8 nColorDiff = aFontColor.GetColorError( aBackgroundColor );
- if( nColorDiff < 8 )
- aBackgroundColor = aFontColor.IsDark() ? COL_WHITE : COL_BLACK;
- pVDev->SetBackground( aBackgroundColor );
- }
-
- sal_Bool bVDevValid = sal_True;
- Size aOutSz( pVDev->GetOutputSizePixel() );
- if ( ( aOutSz.Width() < aClipRecPixel.GetWidth() ) ||
- ( aOutSz.Height() < aClipRecPixel.GetHeight() ) )
- {
- bVDevValid = pVDev->SetOutputSizePixel( aClipRecPixel.GetSize() );
- }
- else
- {
- // The VirtDev can become very big during a Resize =>
- // eventually make it smaller!
- if ( ( aOutSz.Height() > ( aClipRecPixel.GetHeight() + RESDIFF ) ) ||
- ( aOutSz.Width() > ( aClipRecPixel.GetWidth() + RESDIFF ) ) )
- {
- bVDevValid = pVDev->SetOutputSizePixel( aClipRecPixel.GetSize() );
- }
- else
- {
- pVDev->Erase();
- }
- }
- DBG_ASSERT( bVDevValid, "VDef could not be enlarged!" );
- if ( !bVDevValid )
- {
- Paint( pView, rRec, sal_False /* ohne VDev */ );
- return;
- }
-
- // 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 );
- Point aStartPos;
- if ( !IsVertical() )
- {
- aStartPos = aClipRec.TopLeft();
- aStartPos = pView->GetDocPos( aStartPos );
- aStartPos.X() *= (-1);
- aStartPos.Y() *= (-1);
- }
- else
- {
- aStartPos = aClipRec.TopRight();
- Point aDocPos( pView->GetDocPos( aStartPos ) );
- aStartPos.X() = aClipRec.GetSize().Width() + aDocPos.Y();
- aStartPos.Y() = -aDocPos.X();
- }
-
- Paint( pVDev, aTmpRec, aStartPos );
-
- sal_Bool bClipRegion = sal_False;
- Region aOldRegion;
- MapMode aOldMapMode;
- if ( GetTextRanger() )
- {
- // Some problems here with push/pop, why?!
- bClipRegion = pOutWin->IsClipRegion();
- aOldRegion = pOutWin->GetClipRegion();
- // 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();
- aOrigin.Move( aViewPos.X(), aViewPos.Y() );
- aClipRec.Move( -aViewPos.X(), -aViewPos.Y() );
- MapMode aNewMapMode( aOldMapMode );
- aNewMapMode.SetOrigin( aOrigin );
- pOutWin->SetMapMode( aNewMapMode );
- pOutWin->SetClipRegion( Region( GetTextRanger()->GetPolyPolygon() ) );
- }
-
- pOutWin->DrawOutDev( aClipRec.TopLeft(), aClipRec.GetSize(),
- Point(0,0), aClipRec.GetSize(), *pVDev );
-
- if ( GetTextRanger() )
- {
- if ( bClipRegion )
- pOutWin->SetClipRegion( aOldRegion );
- else
- pOutWin->SetClipRegion();
- pOutWin->SetMapMode( aOldMapMode );
- }
-
-
- pView->DrawSelection();
- }
- else
- {
- Point aStartPos;
- if ( !IsVertical() )
- {
- aStartPos = pView->GetOutputArea().TopLeft();
- aStartPos.X() -= pView->GetVisDocLeft();
- aStartPos.Y() -= pView->GetVisDocTop();
- }
- else
- {
- aStartPos = pView->GetOutputArea().TopRight();
- aStartPos.X() += pView->GetVisDocTop();
- aStartPos.Y() -= pView->GetVisDocLeft();
- }
-
- // 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();
- if ( aClipRec.Left() > nMaxX )
- return;
- if ( aClipRec.Right() > nMaxX )
- aClipRec.Right() = nMaxX;
- }
-
- sal_Bool bClipRegion = pOutWin->IsClipRegion();
- Region aOldRegion = pOutWin->GetClipRegion();
- pOutWin->IntersectClipRegion( aClipRec );
-
- Paint( pOutWin, aClipRec, aStartPos );
-
- if ( bClipRegion )
- pOutWin->SetClipRegion( aOldRegion );
- else
- pOutWin->SetClipRegion();
-
- pView->DrawSelection();
- }
-
-}
-
-void ImpEditEngine::InsertContent( ContentNode* pNode, sal_uInt16 nPos )
-{
- 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 );
- if ( IsCallParaInsertedOrDeleted() )
- GetEditEnginePtr()->ParagraphInserted( nPos );
-}
-
-EditPaM ImpEditEngine::SplitContent( sal_uInt16 nNode, sal_uInt16 nSepPos )
-{
- ContentNode* pNode = aEditDoc.SaveGetObject( nNode );
- 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 );
-}
-
-EditPaM ImpEditEngine::ConnectContents( sal_uInt16 nLeftNode, sal_Bool bBackward )
-{
- ContentNode* pLeftNode = aEditDoc.SaveGetObject( nLeftNode );
- ContentNode* pRightNode = aEditDoc.SaveGetObject( nLeftNode+1 );
- 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 );
-}
-
-void ImpEditEngine::SetUpdateMode( sal_Bool bUp, EditView* pCurView, sal_Bool bForceUpdate )
-{
- sal_Bool bChanged = ( GetUpdateMode() != bUp );
-
- // 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 );
-}
-
-void ImpEditEngine::ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow )
-{
- ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
- DBG_ASSERT( pPPortion, "ShowParagraph: Paragraph does not exist! ");
- if ( pPPortion && ( pPPortion->IsVisible() != bShow ) )
- {
- pPPortion->SetVisible( bShow );
-
- if ( !bShow )
- {
- // 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();
- // 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 ) )
- {
- if ( !GetTextRanger() )
- {
- if ( pPPortion->IsInvalid() )
- {
- Font aOldFont( GetRefDevice()->GetFont() );
- CreateLines( nParagraph, 0 ); // 0: No TextRanger
- if ( aStatus.DoRestoreFont() )
- GetRefDevice()->SetFont( aOldFont );
- }
- else
- {
- CalcHeight( pPPortion );
- }
- nCurTextHeight += pPPortion->GetHeight();
- }
- else
- {
- nCurTextHeight = 0x7fffffff;
- }
- }
-
- pPPortion->SetMustRepaint( sal_True );
- if ( GetUpdateMode() && !IsInUndo() && !GetTextRanger() )
- {
- aInvalidRec = Rectangle( Point( 0, GetParaPortions().GetYOffset( pPPortion ) ),
- Point( GetPaperSize().Width(), nCurTextHeight ) );
- UpdateViews( GetActiveView() );
- }
- }
-}
-
-sal_Bool ImpEditEngine::IsParagraphVisible( sal_uInt16 nParagraph )
-{
- ParaPortion* pPPortion = GetParaPortions().SaveGetObject( nParagraph );
- DBG_ASSERT( pPPortion, "IsParagraphVisible: Paragraph does not exist! ");
- if ( pPPortion )
- return pPPortion->IsVisible();
- return sal_False;
-}
-
-EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_uInt16 nNewPos, EditView* pCurView )
-{
- DBG_ASSERT( GetParaPortions().Count() != 0, "No paragraphs found: MoveParagraphs" );
- if ( GetParaPortions().Count() == 0 )
- return EditSelection();
- aOldPositions.Justify();
-
- EditSelection aSel( ImpMoveParagraphs( aOldPositions, nNewPos ) );
-
- if ( nNewPos >= GetParaPortions().Count() )
- nNewPos = GetParaPortions().Count() - 1;
-
- // 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 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(); // make empty
- aInvalidRec.Left() = 0;
- aInvalidRec.Right() = aPaperSize.Width();
- aInvalidRec.Top() = GetParaPortions().GetYOffset( pUpperPortion );
- aInvalidRec.Bottom() = GetParaPortions().GetYOffset( pLowerPortion ) + pLowerPortion->GetHeight();
-
- UpdateViews( pCurView );
- }
- else
- {
- // redraw from the upper invalid position
- sal_uInt16 nFirstInvPara = Min( (sal_uInt16)aOldPositions.Min(), nNewPos );
- InvalidateFromParagraph( nFirstInvPara );
- }
- return aSel;
-}
-
-void ImpEditEngine::InvalidateFromParagraph( sal_uInt16 nFirstInvPara )
-{
- // The following paragraphs are not invalidated, since ResetHeight()
- // => size change => all the following are re-issued anyway.
- ParaPortion* pTmpPortion;
- if ( nFirstInvPara != 0 )
- {
- pTmpPortion = GetParaPortions().GetObject( nFirstInvPara-1 );
- pTmpPortion->MarkInvalid( pTmpPortion->GetNode()->Len(), 0 );
- }
- else
- {
- pTmpPortion = GetParaPortions().GetObject( 0 );
- pTmpPortion->MarkSelectionInvalid( 0, pTmpPortion->GetNode()->Len() );
- }
- pTmpPortion->ResetHeight();
-}
-
-IMPL_LINK_INLINE_START( ImpEditEngine, StatusTimerHdl, Timer *, EMPTYARG )
-{
- CallStatusHdl();
- return 0;
-}
-IMPL_LINK_INLINE_END( ImpEditEngine, StatusTimerHdl, Timer *, EMPTYARG )
-
-void ImpEditEngine::CallStatusHdl()
-{
- if ( aStatusHdlLink.IsSet() && aStatus.GetStatusWord() )
- {
- // 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(); // If called by hand ...
- }
-}
-
-ContentNode* ImpEditEngine::GetPrevVisNode( ContentNode* pCurNode )
-{
- ParaPortion* pPortion = FindParaPortion( pCurNode );
- DBG_ASSERT( pPortion, "GetPrevVisibleNode: No matching portion!" );
- pPortion = GetPrevVisPortion( pPortion );
- if ( pPortion )
- return pPortion->GetNode();
- return 0;
-}
-
-ContentNode* ImpEditEngine::GetNextVisNode( ContentNode* pCurNode )
-{
- ParaPortion* pPortion = FindParaPortion( pCurNode );
- DBG_ASSERT( pPortion, "GetNextVisibleNode: No matching portion!" );
- pPortion = GetNextVisPortion( pPortion );
- if ( pPortion )
- return pPortion->GetNode();
- return 0;
-}
-
-ParaPortion* ImpEditEngine::GetPrevVisPortion( ParaPortion* pCurPortion )
-{
- sal_uInt16 nPara = GetParaPortions().GetPos( pCurPortion );
- DBG_ASSERT( nPara < GetParaPortions().Count() , "Portion not found: GetPrevVisPortion" );
- ParaPortion* pPortion = nPara ? GetParaPortions()[--nPara] : 0;
- while ( pPortion && !pPortion->IsVisible() )
- pPortion = nPara ? GetParaPortions()[--nPara] : 0;
-
- return pPortion;
-}
-
-ParaPortion* ImpEditEngine::GetNextVisPortion( ParaPortion* pCurPortion )
-{
- sal_uInt16 nPara = GetParaPortions().GetPos( pCurPortion );
- DBG_ASSERT( nPara < GetParaPortions().Count() , "Portion not found: GetPrevVisNode" );
- ParaPortion* pPortion = GetParaPortions().SaveGetObject( ++nPara );
- while ( pPortion && !pPortion->IsVisible() )
- pPortion = GetParaPortions().SaveGetObject( ++nPara );
-
- 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;
- if ( nPara != 0 )
- {
- ContentNode* pNode = GetEditDoc().SaveGetObject( nPara-1 );
- if ( !pNode )
- pNode = GetEditDoc().SaveGetObject( GetEditDoc().Count() - 1 );
- DBG_ASSERT( pNode, "Not a single paragraph in InsertParagraph ?" );
- aPaM = EditPaM( pNode, pNode->Len() );
- }
- else
- {
- ContentNode* pNode = GetEditDoc().SaveGetObject( 0 );
- aPaM = EditPaM( pNode, 0 );
- }
-
- return ImpInsertParaBreak( aPaM );
-}
-
-EditSelection* ImpEditEngine::SelectParagraph( sal_uInt16 nPara )
-{
- EditSelection* pSel = 0;
- ContentNode* pNode = GetEditDoc().SaveGetObject( nPara );
- DBG_ASSERTWARNING( pNode, "Paragraph does not exist: SelectParagraph" );
- if ( pNode )
- pSel = new EditSelection( EditPaM( pNode, 0 ), EditPaM( pNode, pNode->Len() ) );
-
- return pSel;
-}
-
-void ImpEditEngine::FormatAndUpdate( EditView* pCurView )
-{
- if ( bDowning )
- return ;
-
- if ( IsInUndo() )
- IdleFormatAndUpdate( pCurView );
- else
- {
- FormatDoc();
- UpdateViews( pCurView );
- }
-}
-
-void ImpEditEngine::SetFlatMode( sal_Bool bFlat )
-{
- if ( bFlat != aStatus.UseCharAttribs() )
- return;
-
- if ( !bFlat )
- aStatus.TurnOnFlags( EE_CNTRL_USECHARATTRIBS );
- else
- aStatus.TurnOffFlags( EE_CNTRL_USECHARATTRIBS );
-
- aEditDoc.CreateDefFont( !bFlat );
-
- FormatFullDoc();
- UpdateViews( (EditView*) 0);
- if ( pActiveView )
- pActiveView->ShowCursor();
-}
-
-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 (bChanged && aStatus.DoStretch())
- {
- FormatFullDoc();
- // (potentially) need everything redrawn
- aInvalidRec=Rectangle(0,0,1000000,1000000);
- UpdateViews( GetActiveView() );
- }
-}
-
-void ImpEditEngine::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY )
-{
- UndoActionStart( EDITUNDO_STRETCH );
- sal_uInt16 nParas = GetEditDoc().Count();
- for ( sal_uInt16 nPara = 0; nPara < nParas; nPara++ )
- {
- ContentNode* pNode = GetEditDoc()[nPara];
- SfxItemSet aTmpSet( pNode->GetContentAttribs().GetItems() );
-
- if ( nX != 100 )
- {
- // Font width
- SvxCharScaleWidthItem* pNewWidth = (SvxCharScaleWidthItem*) pNode->GetContentAttribs().GetItem( EE_CHAR_FONTWIDTH ).Clone();
- sal_uInt32 nProp = pNewWidth->GetValue(); // sal_uInt32, can get big temporary
- nProp *= nX;
- nProp /= 100;
- pNewWidth->SetValue( (sal_uInt16)nProp );
- aTmpSet.Put( *pNewWidth );
- delete pNewWidth;
-
- // Kerning:
- const SvxKerningItem& rKerningItem =
- (const SvxKerningItem&)pNode->GetContentAttribs().GetItem( EE_CHAR_KERNING );
- SvxKerningItem* pNewKerning = (SvxKerningItem*)rKerningItem.Clone();
- long nKerning = pNewKerning->GetValue();
- if ( nKerning > 0 )
- {
- nKerning *= nX;
- nKerning /= 100;
- }
- else if ( nKerning < 0 )
- {
- // For negative values:
- // For stretching > 100 the values must become smaller and vice versa
- nKerning *= 100;
- nKerning /= nX;
- }
- pNewKerning->SetValue( (short)nKerning );
- aTmpSet.Put( *pNewKerning);
- delete pNewKerning;
- }
- else
- aTmpSet.ClearItem( EE_CHAR_FONTWIDTH );
-
- if ( nY != 100 )
- {
- // Font height
- for ( int nItem = 0; nItem < 3; nItem++ )
- {
- sal_uInt16 nItemId = EE_CHAR_FONTHEIGHT;
- if ( nItem == 1 )
- nItemId = EE_CHAR_FONTHEIGHT_CJK;
- else if ( nItem == 2 )
- nItemId = EE_CHAR_FONTHEIGHT_CTL;
-
- const SvxFontHeightItem& rHeightItem =
- (const SvxFontHeightItem&)pNode->GetContentAttribs().GetItem( nItemId );
- SvxFontHeightItem* pNewHeight = (SvxFontHeightItem*)rHeightItem.Clone();
- sal_uInt32 nHeight = pNewHeight->GetHeight();
- nHeight *= nY;
- nHeight /= 100;
- pNewHeight->SetHeightValue( nHeight );
- aTmpSet.Put( *pNewHeight );
- delete pNewHeight;
- }
-
- // Paragraph spacing
- const SvxULSpaceItem& rULSpaceItem =
- (const SvxULSpaceItem&)pNode->GetContentAttribs().GetItem( EE_PARA_ULSPACE );
- SvxULSpaceItem* pNewUL = (SvxULSpaceItem*)rULSpaceItem.Clone();
- sal_uInt32 nUpper = pNewUL->GetUpper();
- nUpper *= nY;
- nUpper /= 100;
- pNewUL->SetUpper( (sal_uInt16)nUpper );
- sal_uInt32 nLower = pNewUL->GetLower();
- nLower *= nY;
- nLower /= 100;
- pNewUL->SetLower( (sal_uInt16)nLower );
- aTmpSet.Put( *pNewUL );
- delete pNewUL;
- }
- else
- aTmpSet.ClearItem( EE_CHAR_FONTHEIGHT );
-
- SetParaAttribs( nPara, aTmpSet );
-
- // 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++ )
- {
- EditCharAttrib* pAttr = rAttribs[nAttr];
- if ( pAttr->GetStart() >= nLastEnd )
- {
- sal_uInt16 nWhich = pAttr->Which();
- SfxPoolItem* pNew = 0;
- if ( nWhich == EE_CHAR_FONTHEIGHT )
- {
- SvxFontHeightItem* pNewHeight = (SvxFontHeightItem*)pAttr->GetItem()->Clone();
- sal_uInt32 nHeight = pNewHeight->GetHeight();
- nHeight *= nY;
- nHeight /= 100;
- pNewHeight->SetHeightValue( nHeight );
- pNew = pNewHeight;
- }
- else if ( nWhich == EE_CHAR_FONTWIDTH )
- {
- SvxCharScaleWidthItem* pNewWidth = (SvxCharScaleWidthItem*)pAttr->GetItem()->Clone();
- sal_uInt32 nProp = pNewWidth->GetValue();
- nProp *= nX;
- nProp /= 100;
- pNewWidth->SetValue( (sal_uInt16)nProp );
- pNew = pNewWidth;
- }
- else if ( nWhich == EE_CHAR_KERNING )
- {
- SvxKerningItem* pNewKerning = (SvxKerningItem*)pAttr->GetItem()->Clone();
- long nKerning = pNewKerning->GetValue();
- if ( nKerning > 0 )
- {
- nKerning *= nX;
- nKerning /= 100;
- }
- else if ( nKerning < 0 )
- {
- // For negative values:
- // For stretching > 100 the values must become smaller and vice versa.
- nKerning *= 100;
- nKerning /= nX;
- }
- pNewKerning->SetValue( (short)nKerning );
- pNew = pNewKerning;
- }
- if ( pNew )
- {
- SfxItemSet _aTmpSet( GetEmptyItemSet() );
- _aTmpSet.Put( *pNew );
- SetAttribs( EditSelection( EditPaM( pNode, pAttr->GetStart() ),
- EditPaM( pNode, pAttr->GetEnd() ) ), _aTmpSet );
-
- nLastEnd = pAttr->GetEnd();
- delete pNew;
- }
- }
- }
- }
- UndoActionEnd( EDITUNDO_STRETCH );
-}
-
-const SvxNumberFormat* ImpEditEngine::GetNumberFormat( const ContentNode *pNode ) const
-{
- const SvxNumberFormat *pRes = 0;
-
- if (pNode)
- {
- // get index of paragraph
- sal_uInt16 nPara = GetEditDoc().GetPos( const_cast< ContentNode * >(pNode) );
- DBG_ASSERT( nPara < USHRT_MAX, "node not found in array" );
- if (nPara < USHRT_MAX)
- {
- // the called function may be overloaded by an OutlinerEditEng object to provide
- // access to the SvxNumberFormat of the Outliner.
- // The EditEngine implementation will just return 0.
- pRes = pEditEngine->GetNumberFormat( nPara );
- }
- }
-
- return pRes;
-}
-
-sal_Int32 ImpEditEngine::GetSpaceBeforeAndMinLabelWidth(
- const ContentNode *pNode,
- sal_Int32 *pnSpaceBefore, sal_Int32 *pnMinLabelWidth ) const
-{
- // nSpaceBefore matches the ODF attribut text:space-before
- // nMinLabelWidth matches the ODF attribut text:min-label-width
-
- const SvxNumberFormat *pNumFmt = GetNumberFormat( pNode );
-
- // if no number format was found we have no Outliner or the numbering level
- // within the Outliner is -1 which means no number format should be applied.
- // Thus the default values to be returned are 0.
- sal_Int32 nSpaceBefore = 0;
- sal_Int32 nMinLabelWidth = 0;
-
- if (pNumFmt)
- {
- nMinLabelWidth = -pNumFmt->GetFirstLineOffset();
- nSpaceBefore = pNumFmt->GetAbsLSpace() - nMinLabelWidth;
- DBG_ASSERT( nMinLabelWidth >= 0, "ImpEditEngine::GetSpaceBeforeAndMinLabelWidth: min-label-width < 0 encountered" );
- }
- if (pnSpaceBefore)
- *pnSpaceBefore = nSpaceBefore;
- if (pnMinLabelWidth)
- *pnMinLabelWidth = nMinLabelWidth;
-
- return nSpaceBefore + nMinLabelWidth;
-}
-
-const SvxLRSpaceItem& ImpEditEngine::GetLRSpaceItem( ContentNode* pNode )
-{
- return (const SvxLRSpaceItem&)pNode->GetContentAttribs().GetItem( aStatus.IsOutliner() ? EE_PARA_OUTLLRSPACE : EE_PARA_LRSPACE );
-}
-
-// Either sets the digit mode at the output device or
-// modifies the passed string according to the text numeral setting:
-void ImpEditEngine::ImplInitDigitMode( OutputDevice* pOutDev, String* pString, xub_StrLen nStt, xub_StrLen nLen, LanguageType eCurLang )
-{
- // #114278# Also setting up digit language from Svt options
- // (cannot reliably inherit the outdev's setting)
- if( !pCTLOptions )
- pCTLOptions = new SvtCTLOptions;
-
- LanguageType eLang = eCurLang;
- const SvtCTLOptions::TextNumerals nCTLTextNumerals = pCTLOptions->GetCTLTextNumerals();
-
- if ( SvtCTLOptions::NUMERALS_HINDI == nCTLTextNumerals )
- eLang = LANGUAGE_ARABIC_SAUDI_ARABIA;
- else if ( SvtCTLOptions::NUMERALS_ARABIC == nCTLTextNumerals )
- eLang = LANGUAGE_ENGLISH;
- else if ( SvtCTLOptions::NUMERALS_SYSTEM == nCTLTextNumerals )
- eLang = (LanguageType) Application::GetSettings().GetLanguage();
-
- if(pOutDev)
- {
- pOutDev->SetDigitLanguage( eLang );
- }
- else if (pString)
- {
- // see sallayout.cxx in vcl
- int nOffset;
- switch( eLang & LANGUAGE_MASK_PRIMARY )
- {
- default:
- nOffset = 0;
- break;
- case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY:
- nOffset = 0x0660 - '0'; // arabic-indic digits
- break;
- case LANGUAGE_URDU & LANGUAGE_MASK_PRIMARY:
- case LANGUAGE_PUNJABI & LANGUAGE_MASK_PRIMARY: //???
- case LANGUAGE_SINDHI & LANGUAGE_MASK_PRIMARY:
- nOffset = 0x06F0 - '0'; // eastern arabic-indic digits
- break;
- }
- if (nOffset)
- {
- const xub_StrLen nEnd = nStt + nLen;
- for( xub_StrLen nIdx = nStt; nIdx < nEnd; ++nIdx )
- {
- sal_Unicode nChar = pString->GetChar( nIdx );
- if( (nChar < '0') || ('9' < nChar) )
- continue;
- nChar = (sal_Unicode)(nChar + nOffset);
- pString->SetChar( nIdx, nChar );
- }
- }
- }
-}
-
-void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, sal_uInt16 nPara, sal_uInt16 nIndex )
-{
- sal_Bool bCTL = sal_False;
- sal_uInt8 bR2L = sal_False;
- if ( nIndex == 0xFFFF )
- {
- bCTL = HasScriptType( nPara, i18n::ScriptType::COMPLEX );
- bR2L = IsRightToLeft( nPara );
- }
- else
- {
- ContentNode* pNode = GetEditDoc().SaveGetObject( nPara );
- short nScriptType = GetScriptType( EditPaM( pNode, nIndex+1 ) );
- bCTL = nScriptType == i18n::ScriptType::COMPLEX;
- bR2L = GetRightToLeft( nPara, nIndex + 1); // this change was discussed in issue 37190
- // it also works for issue 55927
- }
-
- sal_uLong nLayoutMode = pOutDev->GetLayoutMode();
-
- // We always use the left postion for DrawText()
- nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL);
-
- if ( !bCTL && !bR2L)
- {
- // No CTL/Bidi checking neccessary
- nLayoutMode |= ( TEXT_LAYOUT_COMPLEX_DISABLED | TEXT_LAYOUT_BIDI_STRONG );
- }
- else
- {
- // CTL/Bidi checking neccessary
- // Don't use BIDI_STRONG, VCL must do some checks.
- nLayoutMode &= ~( TEXT_LAYOUT_COMPLEX_DISABLED | TEXT_LAYOUT_BIDI_STRONG );
-
- if ( bR2L )
- nLayoutMode |= TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_TEXTORIGIN_LEFT;
- }
-
- pOutDev->SetLayoutMode( nLayoutMode );
-
- // #114278# Also setting up digit language from Svt options
- // (cannot reliably inherit the outdev's setting)
- LanguageType eLang;
-
- if( !pCTLOptions )
- pCTLOptions = new SvtCTLOptions;
-
- if ( SvtCTLOptions::NUMERALS_HINDI == pCTLOptions->GetCTLTextNumerals() )
- eLang = LANGUAGE_ARABIC_SAUDI_ARABIA;
- else if ( SvtCTLOptions::NUMERALS_ARABIC == pCTLOptions->GetCTLTextNumerals() )
- eLang = LANGUAGE_ENGLISH;
- else
- eLang = (LanguageType) Application::GetSettings().GetLanguage();
-
- pOutDev->SetDigitLanguage( eLang );
-}
-
-Reference < i18n::XBreakIterator > ImpEditEngine::ImplGetBreakIterator() const
-{
- if ( !xBI.is() )
- {
- Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- xBI.set( xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.BreakIterator" )) ), UNO_QUERY );
- }
- return xBI;
-}
-
-Reference < i18n::XExtendedInputSequenceChecker > ImpEditEngine::ImplGetInputSequenceChecker() const
-{
- if ( !xISC.is() )
- {
- Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- 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) );
- x >>= xISC;
- }
- }
- return xISC;
-}
-
-Color ImpEditEngine::GetAutoColor() const
-{
- Color aColor = const_cast<ImpEditEngine*>(this)->GetColorConfig().GetColorValue( svtools::FONTCOLOR ).nColor;
-
- if ( GetBackgroundColor() != COL_AUTO )
- {
- if ( GetBackgroundColor().IsDark() && aColor.IsDark() )
- aColor = COL_WHITE;
- else if ( GetBackgroundColor().IsBright() && aColor.IsBright() )
- aColor = COL_BLACK;
- }
-
- return aColor;
-}
-
-
-sal_Bool ImpEditEngine::ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_uInt16 nStartPos, sal_Int32* pDXArray, sal_uInt16 n100thPercentFromMax, sal_Bool bManipulateDXArray )
-{
- DBG_ASSERT( GetAsianCompressionMode(), "ImplCalcAsianCompression - Why?" );
- DBG_ASSERT( pTextPortion->GetLen(), "ImplCalcAsianCompression - Empty Portion?" );
-
- // Percent is 1/100 Percent...
- if ( n100thPercentFromMax == 10000 )
- pTextPortion->SetExtraInfos( NULL );
-
- sal_Bool bCompressed = sal_False;
-
- if ( GetScriptType( EditPaM( pNode, nStartPos+1 ) ) == i18n::ScriptType::ASIAN )
- {
- long nNewPortionWidth = pTextPortion->GetSize().Width();
- sal_uInt16 nPortionLen = pTextPortion->GetLen();
- for ( sal_uInt16 n = 0; n < nPortionLen; n++ )
- {
- sal_uInt8 nType = GetCharTypeForCompression( pNode->GetChar( n+nStartPos ) );
-
- sal_Bool bCompressPunctuation = ( nType == CHAR_PUNCTUATIONLEFT ) || ( nType == CHAR_PUNCTUATIONRIGHT );
- sal_Bool bCompressKana = ( nType == CHAR_KANA ) && ( GetAsianCompressionMode() == text::CharacterCompressionType::PUNCTUATION_AND_KANA );
-
- // create Extra infos only if needed...
- if ( bCompressPunctuation || bCompressKana )
- {
- if ( !pTextPortion->GetExtraInfos() )
- {
- ExtraPortionInfo* pExtraInfos = new ExtraPortionInfo;
- pTextPortion->SetExtraInfos( pExtraInfos );
- pExtraInfos->nOrgWidth = pTextPortion->GetSize().Width();
- pExtraInfos->nAsianCompressionTypes = CHAR_NORMAL;
- }
- pTextPortion->GetExtraInfos()->nMaxCompression100thPercent = n100thPercentFromMax;
- pTextPortion->GetExtraInfos()->nAsianCompressionTypes |= nType;
-
- long nOldCharWidth;
- if ( (n+1) < nPortionLen )
- {
- nOldCharWidth = pDXArray[n];
- }
- else
- {
- if ( bManipulateDXArray )
- nOldCharWidth = nNewPortionWidth - pTextPortion->GetExtraInfos()->nPortionOffsetX;
- else
- nOldCharWidth = pTextPortion->GetExtraInfos()->nOrgWidth;
- }
- nOldCharWidth -= ( n ? pDXArray[n-1] : 0 );
-
- long nCompress = 0;
-
- if ( bCompressPunctuation )
- {
- nCompress = nOldCharWidth / 2;
- }
- else // Kana
- {
- nCompress = nOldCharWidth / 10;
- }
-
- if ( n100thPercentFromMax != 10000 )
- {
- nCompress *= n100thPercentFromMax;
- nCompress /= 10000;
- }
-
- if ( nCompress )
- {
- bCompressed = sal_True;
- nNewPortionWidth -= nCompress;
- pTextPortion->GetExtraInfos()->bCompressed = sal_True;
-
-
- // Special handling for rightpunctuation: For the 'compression' we must
- // start the output before the normal char position....
- if ( bManipulateDXArray && ( pTextPortion->GetLen() > 1 ) )
- {
- if ( !pTextPortion->GetExtraInfos()->pOrgDXArray )
- pTextPortion->GetExtraInfos()->SaveOrgDXArray( pDXArray, pTextPortion->GetLen()-1 );
-
- if ( nType == CHAR_PUNCTUATIONRIGHT )
- {
- // If it's the first char, I must handle it in Paint()...
- if ( n )
- {
- // -1: No entry for the last character
- for ( sal_uInt16 i = n-1; i < (nPortionLen-1); i++ )
- pDXArray[i] -= nCompress;
- }
- else
- {
- pTextPortion->GetExtraInfos()->bFirstCharIsRightPunktuation = sal_True;
- pTextPortion->GetExtraInfos()->nPortionOffsetX = -nCompress;
- }
- }
- else
- {
- // -1: No entry for the last character
- for ( sal_uInt16 i = n; i < (nPortionLen-1); i++ )
- pDXArray[i] -= nCompress;
- }
- }
- }
- }
- }
-
- if ( bCompressed && ( n100thPercentFromMax == 10000 ) )
- pTextPortion->GetExtraInfos()->nWidthFullCompression = nNewPortionWidth;
-
- pTextPortion->GetSize().Width() = nNewPortionWidth;
-
- if ( pTextPortion->GetExtraInfos() && ( n100thPercentFromMax != 10000 ) )
- {
- // Maybe rounding errors in nNewPortionWidth, assure that width not bigger than expected
- long nShrink = pTextPortion->GetExtraInfos()->nOrgWidth - pTextPortion->GetExtraInfos()->nWidthFullCompression;
- nShrink *= n100thPercentFromMax;
- nShrink /= 10000;
- long nNewWidth = pTextPortion->GetExtraInfos()->nOrgWidth - nShrink;
- if ( nNewWidth < pTextPortion->GetSize().Width() )
- pTextPortion->GetSize().Width() = nNewWidth;
- }
- }
- return bCompressed;
-}
-
-
-void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* pParaPortion, long nRemainingWidth )
-{
- sal_Bool bFoundCompressedPortion = sal_False;
- long nCompressed = 0;
- TextPortionList aCompressedPortions;
-
- sal_uInt16 nPortion = pLine->GetEndPortion();
- TextPortion* pTP = pParaPortion->GetTextPortions()[ nPortion ];
- while ( pTP && ( pTP->GetKind() == PORTIONKIND_TEXT ) )
- {
- if ( pTP->GetExtraInfos() && pTP->GetExtraInfos()->bCompressed )
- {
- bFoundCompressedPortion = sal_True;
- nCompressed += pTP->GetExtraInfos()->nOrgWidth - pTP->GetSize().Width();
- aCompressedPortions.Insert( pTP, aCompressedPortions.Count() );
- }
- pTP = ( nPortion > pLine->GetStartPortion() ) ? pParaPortion->GetTextPortions()[ --nPortion ] : NULL;
- }
-
- if ( bFoundCompressedPortion )
- {
- long nCompressPercent = 0;
- if ( nCompressed > nRemainingWidth )
- {
- nCompressPercent = nCompressed - nRemainingWidth;
- DBG_ASSERT( nCompressPercent < 200000, "ImplExpandCompressedPortions - Overflow!" );
- nCompressPercent *= 10000;
- nCompressPercent /= nCompressed;
- }
-
- for ( sal_uInt16 n = 0; n < aCompressedPortions.Count(); n++ )
- {
- pTP = aCompressedPortions[n];
- pTP->GetExtraInfos()->bCompressed = sal_False;
- pTP->GetSize().Width() = pTP->GetExtraInfos()->nOrgWidth;
- if ( nCompressPercent )
- {
- sal_uInt16 nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP );
- sal_uInt16 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion );
- DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" );
- sal_Int32* pDXArray = const_cast< sal_Int32* >( pLine->GetCharPosArray().GetData()+( nTxtPortionStart-pLine->GetStart() ) );
- if ( pTP->GetExtraInfos()->pOrgDXArray )
- memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray, (pTP->GetLen()-1)*sizeof(sal_Int32) );
- ImplCalcAsianCompression( pParaPortion->GetNode(), pTP, nTxtPortionStart, pDXArray, (sal_uInt16)nCompressPercent, sal_True );
- }
- }
- }
-
- aCompressedPortions.Remove( 0, aCompressedPortions.Count() );
-}
-
-// redesigned to work with TextMarkingVector
-void ImpEditEngine::ImplFillTextMarkingVector(const lang::Locale& rLocale, EEngineData::TextMarkingVector& rTextMarkingVector, const String& rTxt, const sal_uInt16 nIdx, const sal_uInt16 nLen) const
-{
- // determine relevant logical text elements for the just-rendered
- // string of characters.
- Reference< i18n::XBreakIterator > _xBI(ImplGetBreakIterator());
-
- if(_xBI.is())
- {
- sal_Int32 nDone;
- sal_Int32 nNextCellBreak(_xBI->nextCharacters(rTxt, nIdx, rLocale, i18n::CharacterIteratorMode::SKIPCELL, 0, nDone));
- i18n::Boundary nNextWordBoundary(_xBI->getWordBoundary(rTxt, nIdx, rLocale, i18n::WordType::ANY_WORD, sal_True));
- sal_Int32 nNextSentenceBreak(_xBI->endOfSentence(rTxt, nIdx, rLocale));
-
- const sal_Int32 nEndPos(nIdx + nLen);
- sal_Int32 i;
-
- for(i = nIdx; i < nEndPos; i++)
- {
- // create the entries for the respective break positions
- if(i == nNextCellBreak)
- {
- rTextMarkingVector.push_back(EEngineData::TextMarkingClass(EEngineData::EndOfCaracter, i - nIdx));
- nNextCellBreak = _xBI->nextCharacters(rTxt, i, rLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
- }
- if(i == nNextWordBoundary.endPos)
- {
- rTextMarkingVector.push_back(EEngineData::TextMarkingClass(EEngineData::EndOfWord, i - nIdx));
- nNextWordBoundary = _xBI->getWordBoundary(rTxt, i + 1, rLocale, i18n::WordType::ANY_WORD, sal_True);
- }
- if(i == nNextSentenceBreak)
- {
- rTextMarkingVector.push_back(EEngineData::TextMarkingClass(EEngineData::EndOfSentence, i - nIdx));
- nNextSentenceBreak = _xBI->endOfSentence(rTxt, i + 1, rLocale);
- }
- }
- }
-}
-
-// eof
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
deleted file mode 100644
index ca3aa5717d..0000000000
--- a/editeng/source/editeng/impedit4.cxx
+++ /dev/null
@@ -1,3097 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-
-#include <svl/srchitem.hxx>
-#include <editeng/lspcitem.hxx>
-#include <editeng/adjitem.hxx>
-#include <editeng/tstpitem.hxx>
-
-#include <eertfpar.hxx>
-#include <editeng/editeng.hxx>
-#include <impedit.hxx>
-#include <editeng/editview.hxx>
-#include <eehtml.hxx>
-#include <editobj2.hxx>
-#include <i18npool/lang.h>
-
-#include "editxml.hxx"
-
-#include <editeng/akrnitem.hxx>
-#include <editeng/cntritem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/crsditem.hxx>
-#include <editeng/escpitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/charreliefitem.hxx>
-#include <editeng/frmdiritem.hxx>
-#include <editeng/emphitem.hxx>
-#include <textconv.hxx>
-#include <rtl/tencinfo.h>
-#include <svtools/rtfout.hxx>
-#include <edtspell.hxx>
-#include <editeng/scripttypeitem.hxx>
-#include <editeng/unolingu.hxx>
-#include <linguistic/lngprops.hxx>
-#include <com/sun/star/linguistic2/XThesaurus.hpp>
-#include <com/sun/star/linguistic2/XMeaning.hpp>
-#include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/TransliterationModules.hpp>
-#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
-#include <unotools/transliterationwrapper.hxx>
-#include <unotools/textsearch.hxx>
-#include <comphelper/processfactory.hxx>
-#include <vcl/help.hxx>
-#include <svtools/rtfkeywd.hxx>
-#include <editeng/edtdlg.hxx>
-
-#include <vector>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::linguistic2;
-
-void Swapsal_uIt16s( sal_uInt16& rX, sal_uInt16& rY )
-{
- sal_uInt16 n = rX;
- rX = rY;
- rY = n;
-}
-
-EditPaM ImpEditEngine::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, EditSelection aSel, SvKeyValueIterator* pHTTPHeaderAttrs )
-{
- sal_Bool _bUpdate = GetUpdateMode();
- SetUpdateMode( sal_False );
- EditPaM aPaM;
- if ( eFormat == EE_FORMAT_TEXT )
- aPaM = ReadText( rInput, aSel );
- else if ( eFormat == EE_FORMAT_RTF )
- aPaM = ReadRTF( rInput, aSel );
- else if ( eFormat == EE_FORMAT_XML )
- aPaM = ReadXML( rInput, aSel );
- else if ( eFormat == EE_FORMAT_HTML )
- aPaM = ReadHTML( rInput, rBaseURL, aSel, pHTTPHeaderAttrs );
- else if ( eFormat == EE_FORMAT_BIN)
- aPaM = ReadBin( rInput, aSel );
- else
- {
- OSL_FAIL( "Read: Unknown Format" );
- }
-
- FormatFullDoc(); // perhaps a simple format is enough?
- SetUpdateMode( _bUpdate );
-
- return aPaM;
-}
-
-EditPaM ImpEditEngine::ReadText( SvStream& rInput, EditSelection aSel )
-{
- if ( aSel.HasRange() )
- aSel = ImpDeleteSelection( aSel );
- EditPaM aPaM = aSel.Max();
-
- XubString aTmpStr, aStr;
- sal_Bool bDone = rInput.ReadByteStringLine( aTmpStr );
- while ( bDone )
- {
- aTmpStr.Erase( MAXCHARSINPARA );
- aPaM = ImpInsertText( EditSelection( aPaM, aPaM ), aTmpStr );
- aPaM = ImpInsertParaBreak( aPaM );
- bDone = rInput.ReadByteStringLine( aTmpStr );
- }
- return aPaM;
-}
-
-EditPaM ImpEditEngine::ReadXML( SvStream& rInput, EditSelection aSel )
-{
- if ( aSel.HasRange() )
- aSel = ImpDeleteSelection( aSel );
-
- ESelection aESel = CreateESel( aSel );
-
- ::SvxReadXML( *GetEditEnginePtr(), rInput, aESel );
-
- return aSel.Max();
-}
-
-EditPaM ImpEditEngine::ReadRTF( SvStream& rInput, EditSelection aSel )
-{
-#if (OSL_DEBUG_LEVEL > 2) && !defined( UNX )
- SvFileStream aRTFOut( String( RTL_CONSTASCII_USTRINGPARAM ( "d:\\rtf_in.rtf" ) ), STREAM_WRITE );
- aRTFOut << rInput;
- aRTFOut.Close();
- rInput.Seek( 0 );
-#endif
- if ( aSel.HasRange() )
- aSel = ImpDeleteSelection( aSel );
-
- // 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: no EditEnginePool!" );
-
- EditRTFParserRef xPrsr = new EditRTFParser( rInput, aSel, *pPool, this );
- SvParserState eState = xPrsr->CallParser();
- if ( ( eState != SVPAR_ACCEPTED ) && ( !rInput.GetError() ) )
- {
- rInput.SetError( EE_READWRITE_WRONGFORMAT );
- return aSel.Min();
- }
- return xPrsr->GetCurPaM();
-}
-
-EditPaM ImpEditEngine::ReadHTML( SvStream& rInput, const String& rBaseURL, EditSelection aSel, SvKeyValueIterator* pHTTPHeaderAttrs )
-{
- if ( aSel.HasRange() )
- aSel = ImpDeleteSelection( aSel );
-
- EditHTMLParserRef xPrsr = new EditHTMLParser( rInput, rBaseURL, pHTTPHeaderAttrs );
- SvParserState eState = xPrsr->CallParser( this, aSel.Max() );
- if ( ( eState != SVPAR_ACCEPTED ) && ( !rInput.GetError() ) )
- {
- rInput.SetError( EE_READWRITE_WRONGFORMAT );
- return aSel.Min();
- }
- return xPrsr->GetCurSelection().Max();
-}
-
-EditPaM ImpEditEngine::ReadBin( SvStream& rInput, EditSelection aSel )
-{
- // Simply abuse a temporary text object ...
- EditTextObject* pObj = EditTextObject::Create( rInput, NULL );
-
- EditPaM aLastPaM = aSel.Max();
- if ( pObj )
- aLastPaM = InsertText( *pObj, aSel ).Max();
-
- delete pObj;
- return aLastPaM;
-}
-
-void ImpEditEngine::Write( SvStream& rOutput, EETextFormat eFormat, EditSelection aSel )
-{
- if ( !rOutput.IsWritable() )
- rOutput.SetError( SVSTREAM_WRITE_ERROR );
-
- if ( !rOutput.GetError() )
- {
- if ( eFormat == EE_FORMAT_TEXT )
- WriteText( rOutput, aSel );
- else if ( eFormat == EE_FORMAT_RTF )
- WriteRTF( rOutput, aSel );
- else if ( eFormat == EE_FORMAT_XML )
- WriteXML( rOutput, aSel );
- else if ( eFormat == EE_FORMAT_HTML )
- WriteHTML( rOutput, aSel );
- else if ( eFormat == EE_FORMAT_BIN)
- WriteBin( rOutput, aSel );
- else
- {
- OSL_FAIL( "Write: Unknown Format" );
- }
- }
-}
-
-sal_uInt32 ImpEditEngine::WriteText( SvStream& rOutput, EditSelection aSel )
-{
- sal_uInt16 nStartNode, nEndNode;
- sal_Bool bRange = aSel.HasRange();
- if ( bRange )
- {
- aSel.Adjust( aEditDoc );
- nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
- nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
- }
- else
- {
- nStartNode = 0;
- nEndNode = aEditDoc.Count()-1;
- }
-
- // iterate over the paragraphs ...
- for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )
- {
- ContentNode* pNode = aEditDoc.GetObject( nNode );
- DBG_ASSERT( pNode, "Node not founden: Search&Replace" );
-
- sal_uInt16 nStartPos = 0;
- sal_uInt16 nEndPos = pNode->Len();
- if ( bRange )
- {
- if ( nNode == nStartNode )
- nStartPos = aSel.Min().GetIndex();
- if ( nNode == nEndNode ) // can also be == nStart!
- nEndPos = aSel.Max().GetIndex();
- }
- XubString aTmpStr = aEditDoc.GetParaAsString( pNode, nStartPos, nEndPos );
- rOutput.WriteByteStringLine( aTmpStr );
- }
-
- return rOutput.GetError();
-}
-
-sal_Bool ImpEditEngine::WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, sal_uInt16 nPara, sal_uInt16 nPos,
- SvxFontTable& rFontTable, SvxColorList& rColorList )
-{
- const SfxPoolItem* pAttrItem = rLst.First();
- while ( pAttrItem )
- {
- WriteItemAsRTF( *pAttrItem, rOutput, nPara, nPos,rFontTable, rColorList );
- pAttrItem = rLst.Next();
- }
- return ( rLst.Count() ? sal_True : sal_False );
-}
-
-void lcl_FindValidAttribs( ItemList& rLst, ContentNode* pNode, sal_uInt16 nIndex, sal_uInt16 nScriptType )
-{
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- while ( pAttr && ( pAttr->GetStart() <= nIndex ) )
- {
- // Start is checked in while ...
- if ( pAttr->GetEnd() > nIndex )
- {
- if ( IsScriptItemValid( pAttr->GetItem()->Which(), nScriptType ) )
- rLst.Insert( pAttr->GetItem() );
- }
- nAttr++;
- pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- }
-}
-
-sal_uInt32 ImpEditEngine::WriteBin( SvStream& rOutput, EditSelection aSel, sal_Bool bStoreUnicodeStrings ) const
-{
- BinTextObject* pObj = (BinTextObject*)CreateBinTextObject( aSel, NULL );
- pObj->StoreUnicodeStrings( bStoreUnicodeStrings );
- pObj->Store( rOutput );
- delete pObj;
- return 0;
-}
-
-sal_uInt32 ImpEditEngine::WriteXML( SvStream& rOutput, EditSelection aSel )
-{
- ESelection aESel = CreateESel( aSel );
-
- SvxWriteXML( *GetEditEnginePtr(), rOutput, aESel );
-
- return 0;
-}
-
-static sal_uInt16 getStylePos( const SfxStyles& rStyles, SfxStyleSheet* pSheet )
-{
- sal_uInt16 nNumber = 0;
- SfxStyles::const_iterator iter( rStyles.begin() );
- while( iter != rStyles.end() )
- {
- if( (*iter++).get() == pSheet )
- return nNumber;
- ++nNumber;
- }
- return 0;
-}
-
-sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel )
-{
- DBG_ASSERT( GetUpdateMode(), "WriteRTF for UpdateMode = sal_False!" );
- CheckIdleFormatter();
- if ( !IsFormatted() )
- FormatDoc();
-
- sal_uInt16 nStartNode, nEndNode;
- aSel.Adjust( aEditDoc );
-
- nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
- nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
-
- // RTF header ...
- rOutput << '{' ;
-
- rOutput << OOO_STRING_SVTOOLS_RTF_RTF;
-
- rOutput << OOO_STRING_SVTOOLS_RTF_ANSI;
- rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252;
-
- // Generate and write out Font table ...
- SvxFontTable aFontTable;
- // default font must be up front, so DEF font in RTF
- aFontTable.Insert( 0, new SvxFontItem( (const SvxFontItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_FONTINFO ) ) );
- aFontTable.Insert( 1, new SvxFontItem( (const SvxFontItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_FONTINFO_CJK ) ) );
- aFontTable.Insert( 2, new SvxFontItem( (const SvxFontItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_FONTINFO_CTL ) ) );
- for ( sal_uInt16 nScriptType = 0; nScriptType < 3; nScriptType++ )
- {
- sal_uInt16 nWhich = EE_CHAR_FONTINFO;
- if ( nScriptType == 1 )
- nWhich = EE_CHAR_FONTINFO_CJK;
- else if ( nScriptType == 2 )
- nWhich = EE_CHAR_FONTINFO_CTL;
-
- sal_uInt32 i = 0;
- SvxFontItem* pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem2( nWhich, i );
- while ( pFontItem )
- {
- bool bAlreadyExist = false;
- sal_uLong nTestMax = nScriptType ? aFontTable.Count() : 1;
- for ( sal_uLong nTest = 0; !bAlreadyExist && ( nTest < nTestMax ); nTest++ )
- {
- bAlreadyExist = *aFontTable.Get( nTest ) == *pFontItem;
- }
-
- if ( !bAlreadyExist )
- aFontTable.Insert( aFontTable.Count(), new SvxFontItem( *pFontItem ) );
-
- pFontItem = (SvxFontItem*)aEditDoc.GetItemPool().GetItem2( nWhich, ++i );
- }
- }
-
- rOutput << endl << '{' << OOO_STRING_SVTOOLS_RTF_FONTTBL;
- sal_uInt16 j;
- for ( j = 0; j < aFontTable.Count(); j++ )
- {
- SvxFontItem* pFontItem = aFontTable.Get( j );
- rOutput << '{';
- rOutput << OOO_STRING_SVTOOLS_RTF_F;
- rOutput.WriteNumber( static_cast<sal_uInt32>( j ) );
- switch ( pFontItem->GetFamily() )
- {
- case FAMILY_DONTKNOW: rOutput << OOO_STRING_SVTOOLS_RTF_FNIL;
- break;
- case FAMILY_DECORATIVE: rOutput << OOO_STRING_SVTOOLS_RTF_FDECOR;
- break;
- case FAMILY_MODERN: rOutput << OOO_STRING_SVTOOLS_RTF_FMODERN;
- break;
- case FAMILY_ROMAN: rOutput << OOO_STRING_SVTOOLS_RTF_FROMAN;
- break;
- case FAMILY_SCRIPT: rOutput << OOO_STRING_SVTOOLS_RTF_FSCRIPT;
- break;
- case FAMILY_SWISS: rOutput << OOO_STRING_SVTOOLS_RTF_FSWISS;
- break;
- default:
- break;
- }
- rOutput << OOO_STRING_SVTOOLS_RTF_FPRQ;
- sal_uInt16 nVal = 0;
- switch( pFontItem->GetPitch() )
- {
- case PITCH_FIXED: nVal = 1; break;
- case PITCH_VARIABLE: nVal = 2; break;
- default:
- break;
- }
- 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( static_cast<sal_uInt32>( rtl_getBestWindowsCharsetFromTextEncoding( eChrSet ) ) );
-
- rOutput << ' ';
- RTFOutFuncs::Out_String( rOutput, pFontItem->GetFamilyName(), eDestEnc );
- rOutput << ";}";
- }
- rOutput << '}';
- rOutput << endl;
-
- // Write out ColorList ...
- SvxColorList aColorList;
- sal_uInt32 i = 0;
- SvxColorItem* pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem2( EE_CHAR_COLOR, i );
- while ( pColorItem )
- {
- sal_uInt32 nPos = i;
- if ( pColorItem->GetValue() == COL_AUTO )
- nPos = 0;
- aColorList.Insert( new SvxColorItem( *pColorItem ), nPos );
- pColorItem = (SvxColorItem*)aEditDoc.GetItemPool().GetItem2( EE_CHAR_COLOR, ++i );
- }
- aColorList.Insert( new SvxColorItem( (const SvxColorItem&)aEditDoc.GetItemPool().GetDefaultItem( EE_CHAR_COLOR) ), i );
-
- rOutput << '{' << OOO_STRING_SVTOOLS_RTF_COLORTBL;
- for ( j = 0; j < aColorList.Count(); j++ )
- {
- pColorItem = aColorList.GetObject( j );
- if ( !j || ( pColorItem->GetValue() != COL_AUTO ) )
- {
- rOutput << OOO_STRING_SVTOOLS_RTF_RED;
- rOutput.WriteNumber( static_cast<sal_uInt32>(pColorItem->GetValue().GetRed()) );
- rOutput << OOO_STRING_SVTOOLS_RTF_GREEN;
- rOutput.WriteNumber( static_cast<sal_uInt32>(pColorItem->GetValue().GetGreen()) );
- rOutput << OOO_STRING_SVTOOLS_RTF_BLUE;
- rOutput.WriteNumber( static_cast<sal_uInt32>(pColorItem->GetValue().GetBlue()) );
- }
- rOutput << ';';
- }
- rOutput << '}';
- rOutput << endl;
-
- // StyleSheets...
- if ( GetStyleSheetPool() )
- {
- sal_uInt16 nStyles = (sal_uInt16)GetStyleSheetPool()->GetStyles().size();
- if ( nStyles )
- {
- rOutput << '{' << OOO_STRING_SVTOOLS_RTF_STYLESHEET;
-
- for ( sal_uInt16 nStyle = 0; nStyle < nStyles; nStyle++ )
- {
-
- SfxStyleSheet* pStyle = (SfxStyleSheet*)GetStyleSheetPool()->GetStyles()[ nStyle ].get();
-
- rOutput << endl << '{' << OOO_STRING_SVTOOLS_RTF_S;
- sal_uInt32 nNumber = nStyle + 1;
- rOutput.WriteNumber( nNumber );
-
- // Attribute, alos from Parent!
- for ( sal_uInt16 nParAttr = EE_PARA_START; nParAttr <= EE_CHAR_END; nParAttr++ )
- {
- if ( pStyle->GetItemSet().GetItemState( nParAttr ) == SFX_ITEM_ON )
- {
- const SfxPoolItem& rItem = pStyle->GetItemSet().Get( nParAttr );
- WriteItemAsRTF( rItem, rOutput, 0, 0, aFontTable, aColorList );
- }
- }
-
- // 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 not found!" );
- rOutput << OOO_STRING_SVTOOLS_RTF_SBASEDON;
- nNumber = getStylePos( GetStyleSheetPool()->GetStyles(), pParent ) + 1;
- rOutput.WriteNumber( nNumber );
- }
-
- // 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, "Next ot found!" );
- rOutput << OOO_STRING_SVTOOLS_RTF_SNEXT;
- nNumber = getStylePos( GetStyleSheetPool()->GetStyles(), pNext ) + 1;
- rOutput.WriteNumber( nNumber );
-
- // Name of the template ...
- rOutput << " " << ByteString( pStyle->GetName(), eDestEnc ).GetBuffer();
- rOutput << ";}";
- }
- rOutput << '}';
- rOutput << endl;
- }
- }
-
- // 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++)
- {
- const SfxPoolItem& rItem = aEditDoc.GetItemPool().GetDefaultItem( nPoolDefItem );
- WriteItemAsRTF( rItem, rOutput, 0, 0, aFontTable, aColorList );
- }
- rOutput << '}' << 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( static_cast<sal_uInt32>( nDefTabTwps ) );
- rOutput << endl;
-
- // iterate over the paragraphs ...
- rOutput << '{' << endl;
- for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )
- {
- ContentNode* pNode = aEditDoc.SaveGetObject( nNode );
- DBG_ASSERT( pNode, "Node not found: Search&Replace" );
-
- // The paragraph attributes in advance ...
- sal_Bool bAttr = sal_False;
-
- // Template?
- if ( pNode->GetStyleSheet() )
- {
- // Number of template
- rOutput << OOO_STRING_SVTOOLS_RTF_S;
- sal_uInt32 nNumber = getStylePos( GetStyleSheetPool()->GetStyles(), pNode->GetStyleSheet() ) + 1;
- rOutput.WriteNumber( nNumber );
-
- // 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 )
- {
- const SfxPoolItem& rItem = pNode->GetStyleSheet()->GetItemSet().Get( nParAttr );
- WriteItemAsRTF( rItem, rOutput, nNode, 0, aFontTable, aColorList );
- bAttr = sal_True;
- }
- }
- }
-
- for ( sal_uInt16 nParAttr = EE_PARA_START; nParAttr <= EE_CHAR_END; nParAttr++ )
- {
- // 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 );
- WriteItemAsRTF( rItem, rOutput, nNode, 0, aFontTable, aColorList );
- bAttr = sal_True;
- }
- }
- if ( bAttr )
- rOutput << ' '; // Separator
-
- ItemList aAttribItems;
- ParaPortion* pParaPortion = FindParaPortion( pNode );
- DBG_ASSERT( pParaPortion, "Portion not found: WriteRTF" );
-
- sal_uInt16 nIndex = 0;
- sal_uInt16 nStartPos = 0;
- sal_uInt16 nEndPos = pNode->Len();
- sal_uInt16 nStartPortion = 0;
- sal_uInt16 nEndPortion = (sal_uInt16)pParaPortion->GetTextPortions().Count() - 1;
- sal_Bool bFinishPortion = sal_False;
- sal_uInt16 nPortionStart;
-
- if ( nNode == nStartNode )
- {
- nStartPos = aSel.Min().GetIndex();
- nStartPortion = pParaPortion->GetTextPortions().FindPortion( nStartPos, nPortionStart );
- if ( nStartPos != 0 )
- {
- aAttribItems.Clear();
- lcl_FindValidAttribs( aAttribItems, pNode, nStartPos, GetScriptType( EditPaM( pNode, 0 ) ) );
- if ( aAttribItems.Count() )
- {
- // These attributes may not apply to the entire paragraph:
- rOutput << '{';
- WriteItemListAsRTF( aAttribItems, rOutput, nNode, nStartPos, aFontTable, aColorList );
- bFinishPortion = sal_True;
- }
- aAttribItems.Clear();
- }
- }
- if ( nNode == nEndNode ) // can also be == nStart!
- {
- nEndPos = aSel.Max().GetIndex();
- nEndPortion = pParaPortion->GetTextPortions().FindPortion( nEndPos, nPortionStart );
- }
-
- EditCharAttrib* pNextFeature = pNode->GetCharAttribs().FindFeature( nIndex );
- // start at 0, so the index is right ...
- for ( sal_uInt16 n = 0; n <= nEndPortion; n++ )
- {
- TextPortion* pTextPortion = pParaPortion->GetTextPortions().GetObject(n);
- if ( n < nStartPortion )
- {
- nIndex = nIndex + pTextPortion->GetLen();
- continue;
- }
-
- if ( pNextFeature && ( pNextFeature->GetStart() == nIndex ) && ( pNextFeature->GetItem()->Which() != EE_FEATURE_FIELD ) )
- {
- WriteItemAsRTF( *pNextFeature->GetItem(), rOutput, nNode, nIndex, aFontTable, aColorList );
- pNextFeature = pNode->GetCharAttribs().FindFeature( pNextFeature->GetStart() + 1 );
- }
- else
- {
- aAttribItems.Clear();
- sal_uInt16 nScriptType = GetScriptType( EditPaM( pNode, nIndex+1 ) );
- if ( !n || IsScriptChange( EditPaM( pNode, nIndex ) ) )
- {
- SfxItemSet aAttribs = GetAttribs( nNode, nIndex+1, nIndex+1 );
- aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ) ) );
- 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 ) ) );
- }
- // Insert hard attribs AFTER CJK attribs...
- lcl_FindValidAttribs( aAttribItems, pNode, nIndex, nScriptType );
-
- rOutput << '{';
- if ( WriteItemListAsRTF( aAttribItems, rOutput, nNode, nIndex, aFontTable, aColorList ) )
- rOutput << ' ';
-
- sal_uInt16 nS = nIndex;
- sal_uInt16 nE = nIndex + pTextPortion->GetLen();
- if ( n == nStartPortion )
- nS = nStartPos;
- if ( n == nEndPortion )
- nE = nEndPos;
-
- XubString aRTFStr = aEditDoc.GetParaAsString( pNode, nS, nE);
- RTFOutFuncs::Out_String( rOutput, aRTFStr, eDestEnc );
- rOutput << '}';
- }
- if ( bFinishPortion )
- {
- rOutput << '}';
- bFinishPortion = sal_False;
- }
-
- nIndex = nIndex + pTextPortion->GetLen();
- }
-
- rOutput << OOO_STRING_SVTOOLS_RTF_PAR << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN;;
- rOutput << endl;
- }
- // RTF-trailer ...
- rOutput << "}}"; // 1xparentheses paragraphs, 1xparentheses RTF document
- rOutput.Flush();
-
-#if (OSL_DEBUG_LEVEL > 2) && !defined( UNX )
- {
- SvFileStream aStream( String( RTL_CONSTASCII_USTRINGPARAM ( "d:\\rtf_out.rtf" ) ), STREAM_WRITE|STREAM_TRUNC );
- sal_uLong nP = rOutput.Tell();
- rOutput.Seek( 0 );
- aStream << rOutput;
- rOutput.Seek( nP );
- }
-#endif
-
- return rOutput.GetError();
-}
-
-
-void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_uInt16 nPara, sal_uInt16 nPos,
- SvxFontTable& rFontTable, SvxColorList& rColorList )
-{
- sal_uInt16 nWhich = rItem.Which();
- switch ( nWhich )
- {
- case EE_PARA_WRITINGDIR:
- {
- const SvxFrameDirectionItem& rWritingMode = (const SvxFrameDirectionItem&)rItem;
- if ( rWritingMode.GetValue() == FRMDIR_HORI_RIGHT_TOP )
- rOutput << "\\rtlpar";
- else
- rOutput << "\\ltrpar";
- }
- break;
- case EE_PARA_OUTLLEVEL:
- {
- sal_Int32 nLevel = ((const SfxInt16Item&)rItem).GetValue();
- if( nLevel >= 0 )
- {
- rOutput << "\\level";
- rOutput.WriteNumber( nLevel );
- }
- }
- break;
- case EE_PARA_OUTLLRSPACE:
- case EE_PARA_LRSPACE:
- {
- rOutput << OOO_STRING_SVTOOLS_RTF_FI;
- sal_Int32 nTxtFirst = ((const SvxLRSpaceItem&)rItem).GetTxtFirstLineOfst();
- nTxtFirst = LogicToTwips( nTxtFirst );
- rOutput.WriteNumber( nTxtFirst );
- rOutput << OOO_STRING_SVTOOLS_RTF_LI;
- 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();
- nTxtRight = LogicToTwips( nTxtRight);
- rOutput.WriteNumber( nTxtRight );
- }
- break;
- case EE_PARA_ULSPACE:
- {
- rOutput << OOO_STRING_SVTOOLS_RTF_SB;
- sal_uInt32 nUpper = ((const SvxULSpaceItem&)rItem).GetUpper();
- nUpper = (sal_uInt32)LogicToTwips( nUpper );
- rOutput.WriteNumber( nUpper );
- rOutput << OOO_STRING_SVTOOLS_RTF_SA;
- sal_uInt32 nLower = ((const SvxULSpaceItem&)rItem).GetLower();
- nLower = LogicToTwips( nLower );
- rOutput.WriteNumber( nLower );
- }
- break;
- case EE_PARA_SBL:
- {
- rOutput << OOO_STRING_SVTOOLS_RTF_SL;
- sal_Int32 nVal = ((const SvxLineSpacingItem&)rItem).GetLineHeight();
- char cMult = '0';
- if ( ((const SvxLineSpacingItem&)rItem).GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP )
- {
- // 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;
- cMult = '1';
- }
- rOutput.WriteNumber( nVal );
- rOutput << OOO_STRING_SVTOOLS_RTF_SLMULT << cMult;
- }
- break;
- case EE_PARA_JUST:
- {
- SvxAdjust eJustification = ((const SvxAdjustItem&)rItem).GetAdjust();
- switch ( eJustification )
- {
- case SVX_ADJUST_CENTER: rOutput << OOO_STRING_SVTOOLS_RTF_QC;
- break;
- case SVX_ADJUST_RIGHT: rOutput << OOO_STRING_SVTOOLS_RTF_QR;
- break;
- default: rOutput << OOO_STRING_SVTOOLS_RTF_QL;
- break;
- }
- }
- break;
- case EE_PARA_TABS:
- {
- const SvxTabStopItem& rTabs = (const SvxTabStopItem&) rItem;
- for ( sal_uInt16 i = 0; i < rTabs.Count(); i++ )
- {
- const SvxTabStop& rTab = rTabs[i];
- rOutput << OOO_STRING_SVTOOLS_RTF_TX;
- rOutput.WriteNumber( LogicToTwips( rTab.GetTabPos() ) );
- }
- }
- break;
- case EE_CHAR_COLOR:
- {
- sal_uInt32 n = rColorList.GetId( (const SvxColorItem&)rItem );
- rOutput << OOO_STRING_SVTOOLS_RTF_CF;
- rOutput.WriteNumber( n );
- }
- break;
- case EE_CHAR_FONTINFO:
- case EE_CHAR_FONTINFO_CJK:
- case EE_CHAR_FONTINFO_CTL:
- {
- sal_uInt32 n = rFontTable.GetId( (const SvxFontItem&)rItem );
- rOutput << OOO_STRING_SVTOOLS_RTF_F;
- rOutput.WriteNumber( n );
- }
- break;
- case EE_CHAR_FONTHEIGHT:
- case EE_CHAR_FONTHEIGHT_CJK:
- case EE_CHAR_FONTHEIGHT_CTL:
- {
- rOutput << OOO_STRING_SVTOOLS_RTF_FS;
- sal_Int32 nHeight = ((const SvxFontHeightItem&)rItem).GetHeight();
- nHeight = LogicToTwips( nHeight );
- // Twips => HalfPoints
- nHeight /= 10;
- rOutput.WriteNumber( nHeight );
- }
- break;
- case EE_CHAR_WEIGHT:
- case EE_CHAR_WEIGHT_CJK:
- case EE_CHAR_WEIGHT_CTL:
- {
- FontWeight e = ((const SvxWeightItem&)rItem).GetWeight();
- switch ( e )
- {
- case WEIGHT_BOLD: rOutput << OOO_STRING_SVTOOLS_RTF_B; break;
- default: rOutput << OOO_STRING_SVTOOLS_RTF_B << '0'; break;
- }
- }
- break;
- case EE_CHAR_UNDERLINE:
- {
- // Must underlined if in WordLineMode, but the information is
- // missing here
- FontUnderline e = ((const SvxUnderlineItem&)rItem).GetLineStyle();
- switch ( e )
- {
- case UNDERLINE_NONE: rOutput << OOO_STRING_SVTOOLS_RTF_ULNONE; break;
- case UNDERLINE_SINGLE: rOutput << OOO_STRING_SVTOOLS_RTF_UL; break;
- case UNDERLINE_DOUBLE: rOutput << OOO_STRING_SVTOOLS_RTF_ULDB; break;
- case UNDERLINE_DOTTED: rOutput << OOO_STRING_SVTOOLS_RTF_ULD; break;
- default:
- break;
- }
- }
- break;
- case EE_CHAR_OVERLINE:
- {
- FontUnderline e = ((const SvxOverlineItem&)rItem).GetLineStyle();
- switch ( e )
- {
- case UNDERLINE_NONE: rOutput << OOO_STRING_SVTOOLS_RTF_OLNONE; break;
- case UNDERLINE_SINGLE: rOutput << OOO_STRING_SVTOOLS_RTF_OL; break;
- case UNDERLINE_DOUBLE: rOutput << OOO_STRING_SVTOOLS_RTF_OLDB; break;
- case UNDERLINE_DOTTED: rOutput << OOO_STRING_SVTOOLS_RTF_OLD; break;
- default:
- break;
- }
- }
- break;
- case EE_CHAR_STRIKEOUT:
- {
- FontStrikeout e = ((const SvxCrossedOutItem&)rItem).GetStrikeout();
- switch ( e )
- {
- case STRIKEOUT_SINGLE:
- case STRIKEOUT_DOUBLE: rOutput << OOO_STRING_SVTOOLS_RTF_STRIKE; break;
- case STRIKEOUT_NONE: rOutput << OOO_STRING_SVTOOLS_RTF_STRIKE << '0'; break;
- default:
- break;
- }
- }
- break;
- case EE_CHAR_ITALIC:
- case EE_CHAR_ITALIC_CJK:
- case EE_CHAR_ITALIC_CTL:
- {
- FontItalic e = ((const SvxPostureItem&)rItem).GetPosture();
- switch ( e )
- {
- case ITALIC_OBLIQUE:
- case ITALIC_NORMAL: rOutput << OOO_STRING_SVTOOLS_RTF_I; break;
- case ITALIC_NONE: rOutput << OOO_STRING_SVTOOLS_RTF_I << '0'; break;
- default:
- break;
- }
- }
- break;
- case EE_CHAR_OUTLINE:
- {
- rOutput << OOO_STRING_SVTOOLS_RTF_OUTL;
- if ( ((const SvxContourItem&)rItem).GetValue() == 0 )
- rOutput << '0';
- }
- break;
- case EE_CHAR_RELIEF:
- {
- sal_uInt16 nRelief = ((const SvxCharReliefItem&)rItem).GetValue();
- if ( nRelief == RELIEF_EMBOSSED )
- rOutput << OOO_STRING_SVTOOLS_RTF_EMBO;
- if ( nRelief == RELIEF_ENGRAVED )
- rOutput << OOO_STRING_SVTOOLS_RTF_IMPR;
- }
- break;
- case EE_CHAR_EMPHASISMARK:
- {
- sal_uInt16 nMark = ((const SvxEmphasisMarkItem&)rItem).GetValue();
- if ( nMark == EMPHASISMARK_NONE )
- rOutput << OOO_STRING_SVTOOLS_RTF_ACCNONE;
- else if ( nMark == EMPHASISMARK_SIDE_DOTS )
- rOutput << OOO_STRING_SVTOOLS_RTF_ACCCOMMA;
- else
- rOutput << OOO_STRING_SVTOOLS_RTF_ACCDOT;
- }
- break;
- case EE_CHAR_SHADOW:
- {
- rOutput << OOO_STRING_SVTOOLS_RTF_SHAD;
- if ( ((const SvxShadowedItem&)rItem).GetValue() == 0 )
- rOutput << '0';
- }
- break;
- case EE_FEATURE_TAB:
- {
- rOutput << OOO_STRING_SVTOOLS_RTF_TAB;
- }
- break;
- case EE_FEATURE_LINEBR:
- {
- rOutput << OOO_STRING_SVTOOLS_RTF_SL;
- }
- break;
- case EE_CHAR_KERNING:
- {
- rOutput << OOO_STRING_SVTOOLS_RTF_EXPNDTW;
- rOutput.WriteNumber( LogicToTwips(
- ((const SvxKerningItem&)rItem).GetValue() ) );
- }
- break;
- case EE_CHAR_PAIRKERNING:
- {
- rOutput << OOO_STRING_SVTOOLS_RTF_KERNING;
- rOutput.WriteNumber( static_cast<sal_uInt32>(((const SvxAutoKernItem&)rItem).GetValue() ? 1 : 0 ));
- }
- break;
- case EE_CHAR_ESCAPEMENT:
- {
- SvxFont aFont;
- ContentNode* pNode = aEditDoc.GetObject( nPara );
- SeekCursor( pNode, nPos, aFont );
- MapMode aPntMode( MAP_POINT );
- long nFontHeight = GetRefDevice()->LogicToLogic(
- aFont.GetSize(), &GetRefMapMode(), &aPntMode ).Height();
- nFontHeight *=2; // HalfP oints
- sal_uInt16 nProp = ((const SvxEscapementItem&)rItem).GetProp();
- 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++; // A 1 afterwards means 'automatic'.
- }
- else if ( nEsc == DFLT_ESC_AUTO_SUB )
- {
- nEsc = sal::static_int_cast< short >( -( 100 - nProp ) );
- nProp100++;
- }
- // SWG:
- if ( nEsc )
- {
- rOutput << "{\\*\\updnprop" << rtl::OString::valueOf(
- static_cast<sal_Int32>(nProp100)).getStr() << '}';
- }
- long nUpDown = nFontHeight * Abs( nEsc ) / 100;
- rtl::OString aUpDown = rtl::OString::valueOf(
- static_cast<sal_Int32>(nUpDown));
- if ( nEsc < 0 )
- rOutput << OOO_STRING_SVTOOLS_RTF_DN << aUpDown.getStr();
- else if ( nEsc > 0 )
- rOutput << OOO_STRING_SVTOOLS_RTF_UP << aUpDown.getStr();
- }
- break;
- }
-}
-
-sal_uInt32 ImpEditEngine::WriteHTML( SvStream&, EditSelection )
-{
- return 0;
-}
-
-
-EditTextObject* ImpEditEngine::CreateTextObject()
-{
- EditSelection aCompleteSelection;
- aCompleteSelection.Min() = aEditDoc.GetStartPaM();
- aCompleteSelection.Max() = aEditDoc.GetEndPaM();
-
- return CreateTextObject( aCompleteSelection );
-}
-
-EditTextObject* ImpEditEngine::CreateTextObject( EditSelection aSel )
-{
- return CreateBinTextObject( aSel, GetEditTextObjectPool(), aStatus.AllowBigObjects(), nBigTextObjectStart );
-}
-
-EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemPool* pPool, sal_Bool bAllowBigObjects, sal_uInt16 nBigObjectStart ) const
-{
- BinTextObject* pTxtObj = new BinTextObject( pPool );
- pTxtObj->SetVertical( IsVertical() );
- MapUnit eMapUnit = (MapUnit)aEditDoc.GetItemPool().GetMetric( DEF_METRIC );
- pTxtObj->SetMetric( (sal_uInt16) eMapUnit );
- if ( pTxtObj->IsOwnerOfPool() )
- pTxtObj->GetPool()->SetDefaultMetric( (SfxMapUnit) eMapUnit );
-
- sal_uInt16 nStartNode, nEndNode;
- sal_uInt32 nTextPortions = 0;
-
- aSel.Adjust( aEditDoc );
- nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
- nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
-
- sal_Bool bOnlyFullParagraphs = ( aSel.Min().GetIndex() ||
- ( aSel.Max().GetIndex() < aSel.Max().GetNode()->Len() ) ) ?
- sal_False : sal_True;
-
- // Templates are not saved!
- // (Only the name and family, template itself must be in App!)
- pTxtObj->SetScriptType( GetScriptType( aSel ) );
-
- // iterate over the paragraphs ...
- sal_uInt16 nNode;
- for ( nNode = nStartNode; nNode <= nEndNode; nNode++ )
- {
- ContentNode* pNode = aEditDoc.SaveGetObject( nNode );
- DBG_ASSERT( pNode, "Node not found: Search&Replace" );
-
- if ( bOnlyFullParagraphs )
- {
- ParaPortion* pParaPortion = GetParaPortions()[nNode];
- nTextPortions += pParaPortion->GetTextPortions().Count();
- }
-
- sal_uInt16 nStartPos = 0;
- sal_uInt16 nEndPos = pNode->Len();
-
- sal_Bool bEmptyPara = nEndPos ? sal_False : sal_True;
-
- if ( ( nNode == nStartNode ) && !bOnlyFullParagraphs )
- nStartPos = aSel.Min().GetIndex();
- if ( ( nNode == nEndNode ) && !bOnlyFullParagraphs )
- nEndPos = aSel.Max().GetIndex();
-
-
- ContentInfo* pC = pTxtObj->CreateAndInsertContent();
-
- // The paragraph attributes ...
- pC->GetParaAttribs().Set( pNode->GetContentAttribs().GetItems() );
-
- // The StyleSheet...
- if ( pNode->GetStyleSheet() )
- {
- pC->GetStyle() = pNode->GetStyleSheet()->GetName();
- pC->GetFamily() = pNode->GetStyleSheet()->GetFamily();
- }
-
- // The Text...
- pC->GetText() = pNode->Copy( nStartPos, nEndPos-nStartPos );
-
- // and the Attribute...
- sal_uInt16 nAttr = 0;
- EditCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- while ( pAttr )
- {
- // 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() );
- // Possibly Correct ...
- if ( ( nNode == nStartNode ) && ( nStartPos != 0 ) )
- {
- pX->GetStart() = ( pX->GetStart() > nStartPos ) ? pX->GetStart()-nStartPos : 0;
- pX->GetEnd() = pX->GetEnd() - nStartPos;
-
- }
- if ( nNode == nEndNode )
- {
- if ( pX->GetEnd() > (nEndPos-nStartPos) )
- pX->GetEnd() = nEndPos-nStartPos;
- }
- DBG_ASSERT( pX->GetEnd() <= (nEndPos-nStartPos), "CreateBinTextObject: Attribute too long!" );
- if ( !pX->GetLen() && !bEmptyPara )
- pTxtObj->DestroyAttrib( pX );
- else
- pC->GetAttribs().Insert( pX, pC->GetAttribs().Count() );
- }
- nAttr++;
- pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- }
-
- // If possible online spelling
- if ( bAllowBigObjects && bOnlyFullParagraphs && pNode->GetWrongList() )
- pC->SetWrongList( pNode->GetWrongList()->Clone() );
-
- }
-
- // Remember the portions info in case of large text objects:
- // sleeper set up when Olli paragraphs not hacked!
- if ( bAllowBigObjects && bOnlyFullParagraphs && IsFormatted() && GetUpdateMode() && ( nTextPortions >= nBigObjectStart ) )
- {
- XParaPortionList* pXList = new XParaPortionList( GetRefDevice(), aPaperSize.Width(), nStretchX, nStretchY );
- pTxtObj->SetPortionInfo( pXList );
- for ( nNode = nStartNode; nNode <= nEndNode; nNode++ )
- {
- ParaPortion* pParaPortion = GetParaPortions()[nNode];
- XParaPortion* pX = new XParaPortion;
- pXList->Insert( pX, pXList->Count() );
-
- pX->nHeight = pParaPortion->GetHeight();
- pX->nFirstLineOffset = pParaPortion->GetFirstLineOffset();
-
- // The TextPortions
- sal_uInt16 nCount = pParaPortion->GetTextPortions().Count();
- sal_uInt16 n;
- for ( n = 0; n < nCount; n++ )
- {
- TextPortion* pTextPortion = pParaPortion->GetTextPortions()[n];
- TextPortion* pNew = new TextPortion( *pTextPortion );
- pX->aTextPortions.Insert( pNew, pX->aTextPortions.Count() );
- }
-
- // The lines
- nCount = pParaPortion->GetLines().Count();
- for ( n = 0; n < nCount; n++ )
- {
- EditLine* pLine = pParaPortion->GetLines()[n];
- EditLine* pNew = pLine->Clone();
- pX->aLines.Insert( pNew, pX->aLines.Count() );
- }
-#ifdef DBG_UTIL
- sal_uInt16 nTest;
- int nTPLen = 0, nTxtLen = 0;
- for ( nTest = pParaPortion->GetTextPortions().Count(); nTest; )
- nTPLen += pParaPortion->GetTextPortions().GetObject( --nTest )->GetLen();
- for ( nTest = pParaPortion->GetLines().Count(); nTest; )
- nTxtLen += pParaPortion->GetLines().GetObject( --nTest )->GetLen();
- DBG_ASSERT( ( nTPLen == pParaPortion->GetNode()->Len() ) && ( nTxtLen == pParaPortion->GetNode()->Len() ), "CreateBinTextObject: ParaPortion not completely formatted!" );
-#endif
- }
- }
- return pTxtObj;
-}
-
-void ImpEditEngine::SetText( const EditTextObject& rTextObject )
-{
- // Since setting a text object is not undo-able!
- ResetUndoManager();
- sal_Bool _bUpdate = GetUpdateMode();
- sal_Bool _bUndo = IsUndoEnabled();
-
- SetText( XubString() );
- EditPaM aPaM = aEditDoc.GetStartPaM();
-
- SetUpdateMode( sal_False );
- EnableUndo( sal_False );
-
- InsertText( rTextObject, EditSelection( aPaM, aPaM ) );
- SetVertical( rTextObject.IsVertical() );
-
- DBG_ASSERT( !HasUndoManager() || !GetUndoManager().GetUndoActionCount(), "From where comes the Undo in SetText ?!" );
- SetUpdateMode( _bUpdate );
- EnableUndo( _bUndo );
-}
-
-EditSelection ImpEditEngine::InsertText( const EditTextObject& rTextObject, EditSelection aSel )
-{
- EnterBlockNotifications();
- aSel.Adjust( aEditDoc );
- if ( aSel.HasRange() )
- aSel = ImpDeleteSelection( aSel );
- EditSelection aNewSel = InsertBinTextObject( (BinTextObject&)rTextObject, aSel.Max() );
- LeaveBlockNotifications();
- return aNewSel;
-}
-
-EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, EditPaM aPaM )
-{
- // Optimize: No getPos undFindParaportion, instead calculate index!
- EditSelection aSel( aPaM, aPaM );
- DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "InsertBibTextObject: Selection broken!(1)" );
-
- sal_Bool bUsePortionInfo = sal_False;
- XParaPortionList* pPortionInfo = rTextObject.GetPortionInfo();
-
- if ( pPortionInfo && ( (long)pPortionInfo->GetPaperWidth() == aPaperSize.Width() )
- && ( pPortionInfo->GetRefMapMode() == GetRefDevice()->GetMapMode() )
- && ( pPortionInfo->GetStretchX() == nStretchX )
- && ( pPortionInfo->GetStretchY() == nStretchY ) )
- {
- if ( ( pPortionInfo->GetRefDevPtr() == (sal_uIntPtr)GetRefDevice() ) ||
- ( ( pPortionInfo->GetRefDevType() == OUTDEV_VIRDEV ) &&
- ( GetRefDevice()->GetOutDevType() == OUTDEV_VIRDEV ) ) )
- bUsePortionInfo = sal_True;
- }
-
- sal_Bool bConvertItems = sal_False;
- MapUnit eSourceUnit = MapUnit(), eDestUnit = MapUnit();
- if ( rTextObject.HasMetric() )
- {
- eSourceUnit = (MapUnit)rTextObject.GetMetric();
- eDestUnit = (MapUnit)aEditDoc.GetItemPool().GetMetric( DEF_METRIC );
- if ( eSourceUnit != eDestUnit )
- bConvertItems = sal_True;
- }
-
- sal_uInt16 nContents = rTextObject.GetContents().Count();
- sal_uInt16 nPara = aEditDoc.GetPos( aPaM.GetNode() );
-
- for ( sal_uInt16 n = 0; n < nContents; n++, nPara++ )
- {
- ContentInfo* pC = rTextObject.GetContents().GetObject( n );
- sal_Bool bNewContent = aPaM.GetNode()->Len() ? sal_False: sal_True;
- sal_uInt16 nStartPos = aPaM.GetIndex();
-
- aPaM = ImpFastInsertText( aPaM, pC->GetText() );
-
- ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() );
- DBG_ASSERT( pPortion, "Blind Portion in FastInsertText" );
- pPortion->MarkInvalid( nStartPos, pC->GetText().Len() );
-
- // Character attributes ...
- sal_Bool bAllreadyHasAttribs = aPaM.GetNode()->GetCharAttribs().Count() ? sal_True : sal_False;
- sal_uInt16 nNewAttribs = pC->GetAttribs().Count();
- if ( nNewAttribs )
- {
- sal_Bool bUpdateFields = sal_False;
- for ( sal_uInt16 nAttr = 0; nAttr < nNewAttribs; nAttr++ )
- {
- XEditAttribute* pX = pC->GetAttribs().GetObject( nAttr );
- // Can happen when paragraphs > 16K, it is simply wrapped.
- if ( pX->GetEnd() <= aPaM.GetNode()->Len() )
- {
- if ( !bAllreadyHasAttribs || pX->IsFeature() )
- {
- // 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 );
- else
- {
- SfxPoolItem* pNew = pX->GetItem()->Clone();
- ConvertItem( *pNew, eSourceUnit, eDestUnit );
- pAttr = MakeCharAttrib( aEditDoc.GetItemPool(), *pNew, pX->GetStart()+nStartPos, pX->GetEnd()+nStartPos );
- delete pNew;
- }
- 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: 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() );
- }
- }
- }
- if ( bUpdateFields )
- UpdateFields();
-
- // Otherwise, quick format => no attributes!
- pPortion->MarkSelectionInvalid( nStartPos, pC->GetText().Len() );
- }
-
- 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;
- {
- // only style and ParaAttribs when new paragraph, or
- // completely internal ...
- bParaAttribs = pC->GetParaAttribs().Count() ? sal_True : sal_False;
- if ( GetStyleSheetPool() && pC->GetStyle().Len() )
- {
- SfxStyleSheet* pStyle = (SfxStyleSheet*)GetStyleSheetPool()->Find( pC->GetStyle(), pC->GetFamily() );
- DBG_ASSERT( pStyle, "InsertBinTextObject - Style not found!" );
- SetStyleSheet( nPara, pStyle );
- }
- if ( !bConvertItems )
- SetParaAttribs( aEditDoc.GetPos( aPaM.GetNode() ), pC->GetParaAttribs() );
- else
- {
- SfxItemSet aAttribs( GetEmptyItemSet() );
- ConvertAndPutItems( aAttribs, pC->GetParaAttribs(), &eSourceUnit, &eDestUnit );
- SetParaAttribs( aEditDoc.GetPos( aPaM.GetNode() ), aAttribs );
- }
- }
- if ( bNewContent && bUsePortionInfo )
- {
- XParaPortion* pXP = pPortionInfo->GetObject( n );
- DBG_ASSERT( pXP, "InsertBinTextObject: PortionInfo?" );
- ParaPortion* pParaPortion = GetParaPortions()[ nPara ];
- DBG_ASSERT( pParaPortion, "InsertBinTextObject: ParaPortion?" );
- pParaPortion->nHeight = pXP->nHeight;
- pParaPortion->nFirstLineOffset = pXP->nFirstLineOffset;
- pParaPortion->bForceRepaint = sal_True;
- pParaPortion->SetValid(); // Do not format
-
- // The Text Portions
- pParaPortion->GetTextPortions().Reset();
- sal_uInt16 nCount = pXP->aTextPortions.Count();
- for ( sal_uInt16 _n = 0; _n < nCount; _n++ )
- {
- TextPortion* pTextPortion = pXP->aTextPortions[_n];
- TextPortion* pNew = new TextPortion( *pTextPortion );
- pParaPortion->GetTextPortions().Insert( pNew, _n );
- }
-
- // 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(); // Paint again!
- pParaPortion->GetLines().Insert( pNew, m );
- }
-#ifdef DBG_UTIL
- sal_uInt16 nTest;
- int nTPLen = 0, nTxtLen = 0;
- for ( nTest = pParaPortion->GetTextPortions().Count(); nTest; )
- nTPLen += pParaPortion->GetTextPortions().GetObject( --nTest )->GetLen();
- for ( nTest = pParaPortion->GetLines().Count(); nTest; )
- nTxtLen += pParaPortion->GetLines().GetObject( --nTest )->GetLen();
- DBG_ASSERT( ( nTPLen == pParaPortion->GetNode()->Len() ) && ( nTxtLen == pParaPortion->GetNode()->Len() ), "InsertBinTextObject: ParaPortion not completely formatted!" );
-#endif
- }
- }
- if ( !bParaAttribs ) // DefFont is not calculated for FastInsertParagraph
- {
- aPaM.GetNode()->GetCharAttribs().GetDefFont() = aEditDoc.GetDefFont();
- if ( aStatus.UseCharAttribs() )
- aPaM.GetNode()->CreateDefFont();
- }
-
- if ( bNewContent && GetStatus().DoOnlineSpelling() && pC->GetWrongList() )
- {
- aPaM.GetNode()->DestroyWrongList(); // otherwise MLK, if list exists...
- aPaM.GetNode()->SetWrongList( pC->GetWrongList()->Clone() );
- }
-
- // Wrap when followed by other ...
- if ( n < ( nContents-1) )
- {
- if ( bNewContent )
- aPaM = ImpFastInsertParagraph( nPara+1 );
- else
- aPaM = ImpInsertParaBreak( aPaM, sal_False );
- }
- }
-
- aSel.Max() = aPaM;
- DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "InsertBibTextObject: Selection broken!(1)" );
- return aSel;
-}
-
-LanguageType ImpEditEngine::GetLanguage( const EditPaM& rPaM, sal_uInt16* pEndPos ) const
-{
- short nScriptType = GetScriptType( rPaM, pEndPos ); // pEndPos will be valid now, pointing to ScriptChange or NodeLen
- sal_uInt16 nLangId = GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType );
- const SvxLanguageItem* pLangItem = &(const SvxLanguageItem&)rPaM.GetNode()->GetContentAttribs().GetItem( nLangId );
- EditCharAttrib* pAttr = rPaM.GetNode()->GetCharAttribs().FindAttrib( nLangId, rPaM.GetIndex() );
- if ( pAttr )
- pLangItem = (const SvxLanguageItem*)pAttr->GetItem();
-
- if ( pEndPos && pAttr && ( pAttr->GetEnd() < *pEndPos ) )
- *pEndPos = pAttr->GetEnd();
-
- return pLangItem->GetLanguage();
-}
-
-::com::sun::star::lang::Locale ImpEditEngine::GetLocale( const EditPaM& rPaM ) const
-{
- return SvxCreateLocale( GetLanguage( rPaM ) );
-}
-
-Reference< XSpellChecker1 > ImpEditEngine::GetSpeller()
-{
- if ( !xSpeller.is() )
- xSpeller = SvxGetSpellChecker();
- return xSpeller;
-}
-
-
-SpellInfo * ImpEditEngine::CreateSpellInfo( const EditSelection &rSel, bool bMultipleDocs )
-{
- if (!pSpellInfo)
- pSpellInfo = new SpellInfo;
- else
- *pSpellInfo = SpellInfo(); // reset to default values
-
- pSpellInfo->bMultipleDoc = bMultipleDocs;
- EditSelection aSentenceSel( SelectSentence( rSel ) );
- // 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)
- pSpellInfo->aSpellStart = EPaM();
- pSpellInfo->aSpellTo = EPaM( EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND );
- return pSpellInfo;
-}
-
-
-EESpellState ImpEditEngine::Spell( EditView* pEditView, sal_Bool bMultipleDoc )
-{
- DBG_ASSERTWARNING( xSpeller.is(), "No Spell checker set!" );
-
- if ( !xSpeller.is() )
- return EE_SPELL_NOSPELLER;
-
- aOnlineSpellTimer.Stop();
-
- // In MultipleDoc always from the front / rear ...
- if ( bMultipleDoc )
- {
- pEditView->pImpEditView->SetEditSelection( aEditDoc.GetStartPaM() );
- }
-
- EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() );
- pSpellInfo = CreateSpellInfo( aCurSel, bMultipleDoc );
-
- sal_Bool bIsStart = sal_False;
- if ( bMultipleDoc )
- bIsStart = sal_True; // Accessible from the front or from behind ...
- else if ( ( CreateEPaM( aEditDoc.GetStartPaM() ) == pSpellInfo->aSpellStart ) )
- bIsStart = sal_True;
-
- EditSpellWrapper* pWrp = new EditSpellWrapper( Application::GetDefDialogParent(),
- xSpeller, bIsStart, sal_False, pEditView );
- pWrp->SpellDocument();
- delete pWrp;
-
- if ( !bMultipleDoc )
- {
- pEditView->pImpEditView->DrawSelection();
- if ( aCurSel.Max().GetIndex() > aCurSel.Max().GetNode()->Len() )
- aCurSel.Max().GetIndex() = aCurSel.Max().GetNode()->Len();
- aCurSel.Min() = aCurSel.Max();
- pEditView->pImpEditView->SetEditSelection( aCurSel );
- pEditView->pImpEditView->DrawSelection();
- pEditView->ShowCursor( sal_True, sal_False );
- }
- EESpellState eState = pSpellInfo->eState;
- delete pSpellInfo;
- pSpellInfo = 0;
- return eState;
-}
-
-
-sal_Bool ImpEditEngine::HasConvertibleTextPortion( LanguageType nSrcLang )
-{
- sal_Bool bHasConvTxt = sal_False;
-
- sal_uInt16 nParas = pEditEngine->GetParagraphCount();
- for (sal_uInt16 k = 0; k < nParas; ++k)
- {
- SvUShorts aPortions;
- pEditEngine->GetPortions( k, aPortions );
- for ( sal_uInt16 nPos = 0; nPos < aPortions.Count(); ++nPos )
- {
- sal_uInt16 nEnd = aPortions.GetObject( nPos );
- sal_uInt16 nStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0;
-
- // if the paragraph is not empty we need to increase the index
- // by one since the attribute of the character left to the
- // specified position is evaluated.
- if (nEnd > nStart) // empty para?
- ++nStart;
- LanguageType nLangFound = pEditEngine->GetLanguage( k, nStart );
-#ifdef DEBUG
- lang::Locale aLocale( SvxCreateLocale( nLangFound ) );
-#endif
- bHasConvTxt = (nSrcLang == nLangFound) ||
- (editeng::HangulHanjaConversion::IsChinese( nLangFound ) &&
- editeng::HangulHanjaConversion::IsChinese( nSrcLang ));
- if (bHasConvTxt)
- return bHasConvTxt;
- }
- }
-
- return bHasConvTxt;
-}
-
-
-void ImpEditEngine::Convert( EditView* pEditView,
- LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont,
- sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc )
-{
- // modified version of ImpEditEngine::Spell
-
- // 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;
- pConvInfo->bMultipleDoc = bMultipleDoc;
- pConvInfo->aConvStart = CreateEPaM( aCurSel.Min() );
- //
- // if it is not just a selection and we are about to begin
- // with the current conversion for the very first time
- // we need to find the start of the current (initial)
- // convertible unit in order for the text conversion to give
- // the correct result for that. Since it is easier to obtain
- // the start of the word we use that though.
- if (!aCurSel.HasRange() && ImplGetBreakIterator().is())
- {
- EditPaM aWordStartPaM( SelectWord( aCurSel, i18n::WordType::DICTIONARY_WORD ).Min() );
-
- // since #118246 / #117803 still occurs if the cursor is placed
- // between the two chinese characters to be converted (because both
- // of them are words on their own!) using the word boundary here does
- // not work. Thus since chinese conversion is not interactive we start
- // at the begin of the paragraph to solve the problem, i.e. have the
- // TextConversion service get those characters together in the same call.
- sal_uInt16 nStartIdx = ( editeng::HangulHanjaConversion::IsChinese( nSrcLang ) ) ?
- 0 : aWordStartPaM.GetIndex();
- pConvInfo->aConvStart.nIndex = nStartIdx;
- }
- //
- pConvInfo->aConvContinue = pConvInfo->aConvStart;
-
- sal_Bool bIsStart = sal_False;
- if ( bMultipleDoc )
- bIsStart = sal_True; // Accessible from the front or from behind ...
- else if ( CreateEPaM( aEditDoc.GetStartPaM() ) == pConvInfo->aConvStart )
- bIsStart = sal_True;
-
- bImpConvertFirstCall = sal_True; // next ImpConvert call is the very first in this conversion turn
-
- Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- TextConvWrapper aWrp( Application::GetDefDialogParent(), xMSF,
- SvxCreateLocale( nSrcLang ), SvxCreateLocale( nDestLang ),
- pDestFont,
- nOptions, bIsInteractive,
- bIsStart, pEditView );
-
- //
- //!! optimization does not work since when update mode is false
- //!! the object is 'lying' about it portions, paragraphs,
- //!! EndPaM... later on.
- //!! Should not be a great problem since text boxes or cells in
- //!! Calc usually have only a rather short text.
- //
- // disallow formatting, updating the view, ... while
- // non-interactively converting the document. (saves time)
- //if (!bIsInteractive)
- // SetUpdateMode( sal_False );
-
- aWrp.Convert();
-
- //if (!bIsInteractive)
- //SetUpdateMode( sal_True, 0, sal_True );
-
- if ( !bMultipleDoc )
- {
- pEditView->pImpEditView->DrawSelection();
- if ( aCurSel.Max().GetIndex() > aCurSel.Max().GetNode()->Len() )
- aCurSel.Max().GetIndex() = aCurSel.Max().GetNode()->Len();
- aCurSel.Min() = aCurSel.Max();
- pEditView->pImpEditView->SetEditSelection( aCurSel );
- pEditView->pImpEditView->DrawSelection();
- pEditView->ShowCursor( sal_True, sal_False );
- }
- delete pConvInfo;
- pConvInfo = 0;
-}
-
-
-void ImpEditEngine::SetLanguageAndFont(
- const ESelection &rESel,
- LanguageType nLang, sal_uInt16 nLangWhichId,
- const Font *pFont, sal_uInt16 nFontWhichId )
-{
- ESelection aOldSel = pActiveView->GetSelection();
- pActiveView->SetSelection( rESel );
-
- // set new language attribute
- SfxItemSet aNewSet( pActiveView->GetEmptyItemSet() );
- aNewSet.Put( SvxLanguageItem( nLang, nLangWhichId ) );
-
- // new font to be set?
- DBG_ASSERT( pFont, "target font missing?" );
- if (pFont)
- {
- // set new font attribute
- SvxFontItem aFontItem = (SvxFontItem&) aNewSet.Get( nFontWhichId );
- aFontItem.SetFamilyName( pFont->GetName());
- aFontItem.SetFamily( pFont->GetFamily());
- aFontItem.SetStyleName( pFont->GetStyleName());
- aFontItem.SetPitch( pFont->GetPitch());
- aFontItem.SetCharSet( pFont->GetCharSet() );
- aNewSet.Put( aFontItem );
- }
-
- // apply new attributes
- pActiveView->SetAttribs( aNewSet );
-
- pActiveView->SetSelection( aOldSel );
-}
-
-
-void ImpEditEngine::ImpConvert( rtl::OUString &rConvTxt, LanguageType &rConvTxtLang,
- EditView* pEditView, LanguageType nSrcLang, const ESelection &rConvRange,
- sal_Bool bAllowImplicitChangesForNotConvertibleText,
- LanguageType nTargetLang, const Font *pTargetFont )
-{
- // modified version of ImpEditEngine::ImpSpell
-
- // looks for next convertible text portion to be passed on to the wrapper
-
- String aRes;
- LanguageType nResLang = LANGUAGE_NONE;
-
- /* ContentNode* pLastNode = */ aEditDoc.SaveGetObject( aEditDoc.Count()-1 );
-
- EditPaM aPos( CreateEditPaM( pConvInfo->aConvContinue ) );
- EditSelection aCurSel = EditSelection( aPos, aPos );
-
- String aWord;
-
- while (!aRes.Len())
- {
- // empty paragraph found that needs to have language and font set?
- if (bAllowImplicitChangesForNotConvertibleText &&
- !pEditEngine->GetText( pConvInfo->aConvContinue.nPara ).Len())
- {
- sal_uInt16 nPara = pConvInfo->aConvContinue.nPara;
- ESelection aESel( nPara, 0, nPara, 0 );
- // see comment for below same function call
- SetLanguageAndFont( aESel,
- nTargetLang, EE_CHAR_LANGUAGE_CJK,
- pTargetFont, EE_CHAR_FONTINFO_CJK );
- }
-
-
- if (pConvInfo->aConvContinue.nPara == pConvInfo->aConvTo.nPara &&
- pConvInfo->aConvContinue.nIndex >= pConvInfo->aConvTo.nIndex)
- break;
-
- sal_uInt16 nAttribStart = USHRT_MAX;
- sal_uInt16 nAttribEnd = USHRT_MAX;
- sal_uInt16 nCurPos = USHRT_MAX;
- EPaM aCurStart = CreateEPaM( aCurSel.Min() );
- SvUShorts aPortions;
- pEditEngine->GetPortions( (sal_uInt16)aCurStart.nPara, aPortions );
- for ( sal_uInt16 nPos = 0; nPos < aPortions.Count(); ++nPos )
- {
- sal_uInt16 nEnd = aPortions.GetObject( nPos );
- sal_uInt16 nStart = nPos > 0 ? aPortions.GetObject( nPos - 1 ) : 0;
-
- // the language attribute is obtained from the left character
- // (like usually all other attributes)
- // thus we usually have to add 1 in order to get the language
- // of the text right to the cursor position
- sal_uInt16 nLangIdx = nEnd > nStart ? nStart + 1 : nStart;
- LanguageType nLangFound = pEditEngine->GetLanguage( aCurStart.nPara, nLangIdx );
-#ifdef DEBUG
- lang::Locale aLocale( SvxCreateLocale( nLangFound ) );
-#endif
- sal_Bool bLangOk = (nLangFound == nSrcLang) ||
- (editeng::HangulHanjaConversion::IsChinese( nLangFound ) &&
- editeng::HangulHanjaConversion::IsChinese( nSrcLang ));
-
- if (nAttribEnd != USHRT_MAX) // start already found?
- {
- DBG_ASSERT(nEnd >= aCurStart.nIndex, "error while scanning attributes (a)" );
- DBG_ASSERT(nEnd >= nAttribEnd, "error while scanning attributes (b)" );
- if (/*nEnd >= aCurStart.nIndex &&*/ nLangFound == nResLang)
- nAttribEnd = nEnd;
- else // language attrib has changed
- break;
- }
- if (nAttribStart == USHRT_MAX && // start not yet found?
- nEnd > aCurStart.nIndex && bLangOk)
- {
- nAttribStart = nStart;
- nAttribEnd = nEnd;
- nResLang = nLangFound;
- }
- //! the list of portions may have changed compared to the previous
- //! call to this function (because of possibly changed language
- //! attribute!)
- //! But since we don't want to start in the already processed part
- //! we clip the start accordingly.
- if (nAttribStart < aCurStart.nIndex)
- {
- nAttribStart = aCurStart.nIndex;
- }
-
- // check script type to the right of the start of the current portion
- EditPaM aPaM( CreateEditPaM( EPaM(aCurStart.nPara, nLangIdx) ) );
- sal_Bool bIsAsianScript = (i18n::ScriptType::ASIAN == GetScriptType( aPaM ));
- // not yet processed text part with for conversion
- // not suitable language found that needs to be changed?
- if (bAllowImplicitChangesForNotConvertibleText &&
- !bLangOk && !bIsAsianScript && nEnd > aCurStart.nIndex)
- {
- ESelection aESel( aCurStart.nPara, nStart, aCurStart.nPara, nEnd );
- // set language and font to target language and font of conversion
- //! Now this especially includes all non convertible text e.g.
- //! spaces, empty paragraphs and western text.
- // This is in order for every *new* text entered at *any* position to
- // have the correct language and font attributes set.
- SetLanguageAndFont( aESel,
- nTargetLang, EE_CHAR_LANGUAGE_CJK,
- pTargetFont, EE_CHAR_FONTINFO_CJK );
- }
-
- nCurPos = nEnd;
- }
-
- if (nAttribStart != USHRT_MAX && nAttribEnd != USHRT_MAX)
- {
- aCurSel.Min().SetIndex( nAttribStart );
- aCurSel.Max().SetIndex( nAttribEnd );
- }
- else if (nCurPos != USHRT_MAX)
- {
- // set selection to end of scanned text
- // (used to set the position where to continue from later on)
- aCurSel.Min().SetIndex( nCurPos );
- aCurSel.Max().SetIndex( nCurPos );
- }
-
- if ( !pConvInfo->bConvToEnd )
- {
- EPaM aEPaM( CreateEPaM( aCurSel.Min() ) );
- if ( !( aEPaM < pConvInfo->aConvTo ) )
- break;
- }
-
- // clip selected word to the converted area
- // (main use when conversion starts/ends **within** a word)
- EditPaM aPaM( CreateEditPaM( pConvInfo->aConvStart ) );
- if (pConvInfo->bConvToEnd &&
- aCurSel.Min().GetNode() == aPaM.GetNode() &&
- aCurSel.Min().GetIndex() < aPaM.GetIndex())
- aCurSel.Min().SetIndex( aPaM.GetIndex() );
- aPaM = CreateEditPaM( pConvInfo->aConvContinue );
- if (aCurSel.Min().GetNode() == aPaM.GetNode() &&
- aCurSel.Min().GetIndex() < aPaM.GetIndex())
- aCurSel.Min().SetIndex( aPaM.GetIndex() );
- aPaM = CreateEditPaM( pConvInfo->aConvTo );
- if ((!pConvInfo->bConvToEnd || rConvRange.HasRange())&&
- aCurSel.Max().GetNode() == aPaM.GetNode() &&
- aCurSel.Max().GetIndex() > aPaM.GetIndex())
- aCurSel.Max().SetIndex( aPaM.GetIndex() );
-
- aWord = GetSelected( aCurSel );
-
- if ( aWord.Len() > 0 /* && bLangOk */)
- aRes = aWord;
-
- // move to next word/paragraph if necessary
- if ( !aRes.Len() )
- aCurSel = WordRight( aCurSel.Min(), ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
-
- pConvInfo->aConvContinue = CreateEPaM( aCurSel.Max() );
- }
-
- pEditView->pImpEditView->DrawSelection();
- pEditView->pImpEditView->SetEditSelection( aCurSel );
- pEditView->pImpEditView->DrawSelection();
- pEditView->ShowCursor( sal_True, sal_False );
-
- rConvTxt = aRes;
- if (rConvTxt.getLength())
- rConvTxtLang = nResLang;
-}
-
-
-Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView )
-{
- DBG_ASSERT( xSpeller.is(), "No spell checker set!" );
-
- ContentNode* pLastNode = aEditDoc.SaveGetObject( (aEditDoc.Count()-1) );
- EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() );
- aCurSel.Min() = aCurSel.Max();
-
- String aWord;
- Reference< XSpellAlternatives > xSpellAlt;
- Sequence< PropertyValue > aEmptySeq;
- while (!xSpellAlt.is())
- {
- // 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 )
- {
- if ( ( aCurSel.Max().GetIndex() >= pLastNode->Len() ) )
- break;
- }
- }
- else if ( !pSpellInfo->bSpellToEnd )
- {
- EPaM aEPaM( CreateEPaM( aCurSel.Max() ) );
- if ( !( aEPaM < pSpellInfo->aSpellTo ) )
- break;
- }
-
- aCurSel = SelectWord( aCurSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- aWord = GetSelected( aCurSel );
-
- // 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() );
- if ( cNext == '.' )
- {
- aCurSel.Max().GetIndex()++;
- aWord += cNext;
- }
- }
-
- if ( aWord.Len() > 0 )
- {
- LanguageType eLang = GetLanguage( aCurSel.Max() );
- SvxSpellWrapper::CheckSpellLang( xSpeller, eLang );
- xSpellAlt = xSpeller->spell( aWord, eLang, aEmptySeq );
- }
-
- if ( !xSpellAlt.is() )
- aCurSel = WordRight( aCurSel.Min(), ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- else
- pSpellInfo->eState = EE_SPELL_ERRORFOUND;
- }
-
- pEditView->pImpEditView->DrawSelection();
- pEditView->pImpEditView->SetEditSelection( aCurSel );
- pEditView->pImpEditView->DrawSelection();
- pEditView->ShowCursor( sal_True, sal_False );
- return xSpellAlt;
-}
-
-void ImpEditEngine::EndSpelling()
-{
- DELETEZ(pSpellInfo);
-}
-
-void ImpEditEngine::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc)
-{
- DBG_ASSERT(!pSpellInfo, "pSpellInfo already set?");
- rEditView.pImpEditView->SetEditSelection( aEditDoc.GetStartPaM() );
- EditSelection aCurSel( rEditView.pImpEditView->GetEditSelection() );
- pSpellInfo = CreateSpellInfo( aCurSel, bMultipleDoc );
-}
-
-Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& rSelection)
-{
- /* ContentNode* pLastNode = */ aEditDoc.SaveGetObject( (aEditDoc.Count()-1) );
- EditSelection aCurSel( rSelection.Min() );
-
- String aWord;
- Reference< XSpellAlternatives > xSpellAlt;
- Sequence< PropertyValue > aEmptySeq;
- while (!xSpellAlt.is())
- {
- //check if the end of the selection has been reached
- {
- EPaM aEPaM( CreateEPaM( aCurSel.Max() ) );
- if ( !( aEPaM < CreateEPaM( rSelection.Max()) ) )
- break;
- }
-
- aCurSel = SelectWord( aCurSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- aWord = GetSelected( aCurSel );
-
- // 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() );
- if ( cNext == '.' )
- {
- aCurSel.Max().GetIndex()++;
- aWord += cNext;
- }
- }
-
- if ( aWord.Len() > 0 )
- xSpellAlt = xSpeller->spell( aWord, GetLanguage( aCurSel.Max() ), aEmptySeq );
-
- if ( !xSpellAlt.is() )
- aCurSel = WordRight( aCurSel.Min(), ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- else
- {
- pSpellInfo->eState = EE_SPELL_ERRORFOUND;
- rSelection = aCurSel;
- }
- }
- return xSpellAlt;
-}
-
-bool ImpEditEngine::SpellSentence(EditView& rEditView,
- ::svx::SpellPortions& rToFill,
- bool /*bIsGrammarChecking*/ )
-{
- bool bRet = false;
- EditSelection aCurSel( rEditView.pImpEditView->GetEditSelection() );
- if(!pSpellInfo)
- pSpellInfo = CreateSpellInfo( aCurSel, true );
- pSpellInfo->aCurSentenceStart = aCurSel.Min();
- DBG_ASSERT( xSpeller.is(), "No spell checker set!" );
- pSpellInfo->aLastSpellPortions.clear();
- pSpellInfo->aLastSpellContentSelections.clear();
- rToFill.clear();
- //if no selection previously exists the range is extended to the end of the object
- if(aCurSel.Min() == aCurSel.Max())
- {
- ContentNode* pLastNode = aEditDoc.SaveGetObject( aEditDoc.Count()-1);
- aCurSel.Max() = EditPaM(pLastNode, pLastNode->Len());
- }
- // check for next error in aCurSel and set aCurSel to that one if any was found
- Reference< XSpellAlternatives > xAlt = ImpFindNextError(aCurSel);
- if (xAlt.is())
- {
- bRet = true;
- //find the sentence boundaries
- EditSelection aSentencePaM = SelectSentence(aCurSel);
- //make sure that the sentence is never smaller than the error range!
- if(aSentencePaM.Max().GetIndex() < aCurSel.Max().GetIndex())
- aSentencePaM.Max() = aCurSel.Max();
- //add the portion preceeding the error
- EditSelection aStartSelection(aSentencePaM.Min(), aCurSel.Min());
- if(aStartSelection.HasRange())
- AddPortionIterated(rEditView, aStartSelection, 0, rToFill);
- //add the error portion
- AddPortionIterated(rEditView, aCurSel, xAlt, rToFill);
- //find the end of the sentence
- //search for all errors in the rest of the sentence and add all the portions
- do
- {
- EditSelection aNextSel = EditSelection(aCurSel.Max(), aSentencePaM.Max());
- xAlt = ImpFindNextError(aNextSel);
- if(xAlt.is())
- {
- //add the part between the previous and the current error
- AddPortionIterated(rEditView, EditSelection(aCurSel.Max(), aNextSel.Min()), 0, rToFill);
- //add the current error
- AddPortionIterated(rEditView, aNextSel, xAlt, rToFill);
- }
- else
- AddPortionIterated(rEditView, EditSelection(aCurSel.Max(), aSentencePaM.Max()), xAlt, rToFill);
- aCurSel = aNextSel;
- }
- while( xAlt.is() );
-
- //set the selection to the end of the current sentence
- rEditView.pImpEditView->SetEditSelection(aSentencePaM.Max());
- }
- return bRet;
-}
-
-// Adds one portion to the SpellPortions
-void ImpEditEngine::AddPortion(
- const EditSelection rSel,
- uno::Reference< XSpellAlternatives > xAlt,
- ::svx::SpellPortions& rToFill,
- bool bIsField)
-{
- if(rSel.HasRange())
- {
- svx::SpellPortion aPortion;
- aPortion.sText = GetSelected( rSel );
- aPortion.eLanguage = GetLanguage( rSel.Min() );
- aPortion.xAlternatives = xAlt;
- aPortion.bIsField = bIsField;
- rToFill.push_back(aPortion);
-
- //save the spelled portions for later use
- pSpellInfo->aLastSpellPortions.push_back(aPortion);
- pSpellInfo->aLastSpellContentSelections.push_back(rSel);
-
- }
-}
-
-// 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)
-{
- if(rSel.Min() != rSel.Max())
- {
- if(xAlt.is())
- {
- AddPortion(rSel, xAlt, rToFill, false);
- }
- else
- {
- //iterate and search for language attribute changes
- //save the start and end positions
- bool bTest = rSel.Min().GetIndex() <= rSel.Max().GetIndex();
- EditPaM aStart(bTest ? rSel.Min() : rSel.Max());
- EditPaM aEnd(bTest ? rSel.Max() : rSel.Min());
- //iterate over the text to find changes in language
- //set the mark equal to the point
- EditPaM aCursor(aStart);
- rEditView.pImpEditView->SetEditSelection( aCursor );
- LanguageType eStartLanguage = GetLanguage( aCursor );
- //search for a field attribute at the beginning - only the end position
- //of this field is kept to end a portion at that position
- const EditCharAttrib* pFieldAttr = aCursor.GetNode()->GetCharAttribs().
- FindFeature( aCursor.GetIndex() );
- bool bIsField = pFieldAttr &&
- pFieldAttr->GetStart() == aCursor.GetIndex() &&
- pFieldAttr->GetStart() != pFieldAttr->GetEnd() &&
- pFieldAttr->Which() == EE_FEATURE_FIELD;
- sal_uInt16 nEndField = bIsField ? pFieldAttr->GetEnd() : USHRT_MAX;
- bool bIsEndField = false;
- do
- {
- aCursor = CursorRight( aCursor);
- //determine whether a field and has been reached
- bIsEndField = nEndField == aCursor.GetIndex();
- //search for a new field attribute
- EditCharAttrib* _pFieldAttr = aCursor.GetNode()->GetCharAttribs().
- FindFeature( aCursor.GetIndex() );
- bIsField = _pFieldAttr &&
- _pFieldAttr->GetStart() == aCursor.GetIndex() &&
- _pFieldAttr->GetStart() != _pFieldAttr->GetEnd() &&
- _pFieldAttr->Which() == EE_FEATURE_FIELD;
- //on every new field move the end position
- if(bIsField)
- nEndField = bIsField ? _pFieldAttr->GetEnd() : USHRT_MAX;
-
- LanguageType eCurLanguage = GetLanguage( aCursor );
- if(eCurLanguage != eStartLanguage || bIsField || bIsEndField)
- {
- eStartLanguage = eCurLanguage;
- //go one step back - the cursor currently selects the first character
- //with a different language
- //create a selection from start to the current Cursor
- EditSelection aSelection(aStart, aCursor);
- AddPortion(aSelection, xAlt, rToFill, bIsEndField);
- aStart = aCursor;
- }
- }
- while(aCursor.GetIndex() < aEnd.GetIndex());
- EditSelection aSelection(aStart, aCursor);
- AddPortion(aSelection, xAlt, rToFill, bIsField);
- }
- }
-}
-
-void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
- const ::svx::SpellPortions& rNewPortions,
- bool bRecheck )
-{
- // Note: rNewPortions.size() == 0 is valid and happens when the whole
- // sentence got removed in the dialog
-
- DBG_ASSERT(pSpellInfo, "pSpellInfo not initialized");
- if (pSpellInfo &&
- pSpellInfo->aLastSpellPortions.size() > 0) // no portions -> no text to be changed
- {
- // get current paragraph length to calculate later on how the sentence length changed,
- // in order to place the cursor at the end of the sentence again
- EditSelection aOldSel( rEditView.pImpEditView->GetEditSelection() );
- xub_StrLen nOldLen = aOldSel.Max().GetNode()->Len();
-
- UndoActionStart( EDITUNDO_INSERT );
- if(pSpellInfo->aLastSpellPortions.size() == rNewPortions.size())
- {
- DBG_ASSERT( rNewPortions.size() > 0, "rNewPortions should not be empty here" );
- DBG_ASSERT( pSpellInfo->aLastSpellPortions.size() == pSpellInfo->aLastSpellContentSelections.size(),
- "aLastSpellPortions and aLastSpellContentSelections size mismatch" );
-
- //the simple case: the same number of elements on both sides
- //each changed element has to be applied to the corresponding source element
- svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.end();
- svx::SpellPortions::const_iterator aCurrentOldPortion = pSpellInfo->aLastSpellPortions.end();
- SpellContentSelections::const_iterator aCurrentOldPosition = pSpellInfo->aLastSpellContentSelections.end();
- bool bSetToEnd = false;
- do
- {
- --aCurrentNewPortion;
- --aCurrentOldPortion;
- --aCurrentOldPosition;
- //set the cursor to the end of the sentence - necessary to
- //resume there at the next step
- if(!bSetToEnd)
- {
- bSetToEnd = true;
- rEditView.pImpEditView->SetEditSelection( aCurrentOldPosition->Max() );
- }
-
- sal_uInt16 nScriptType = GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
- sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE;
- switch(nScriptType)
- {
- case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
- case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
- }
- if(aCurrentNewPortion->sText != aCurrentOldPortion->sText)
- {
- //change text and apply language
- SfxItemSet aSet( aEditDoc.GetItemPool(), nLangWhichId, nLangWhichId);
- aSet.Put(SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId));
- SetAttribs( *aCurrentOldPosition, aSet );
- ImpInsertText( *aCurrentOldPosition, aCurrentNewPortion->sText );
- }
- else if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
- {
- //apply language
- SfxItemSet aSet( aEditDoc.GetItemPool(), nLangWhichId, nLangWhichId);
- aSet.Put(SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId));
- SetAttribs( *aCurrentOldPosition, aSet );
- }
- if(aCurrentNewPortion == rNewPortions.begin())
- break;
- }
- while(aCurrentNewPortion != rNewPortions.begin());
- }
- else
- {
- DBG_ASSERT( pSpellInfo->aLastSpellContentSelections.size() > 0, "aLastSpellContentSelections should not be empty here" );
-
- //select the complete sentence
- SpellContentSelections::const_iterator aCurrentEndPosition = pSpellInfo->aLastSpellContentSelections.end();
- --aCurrentEndPosition;
- SpellContentSelections::const_iterator aCurrentStartPosition = pSpellInfo->aLastSpellContentSelections.begin();
- EditSelection aAllSentence(aCurrentStartPosition->Min(), aCurrentEndPosition->Max());
-
- //delete the sentence completely
- ImpDeleteSelection( aAllSentence );
- svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.begin();
- EditPaM aCurrentPaM = aAllSentence.Min();
- while(aCurrentNewPortion != rNewPortions.end())
- {
- //set the language attribute
- LanguageType eCurLanguage = GetLanguage( aCurrentPaM );
- if(eCurLanguage != aCurrentNewPortion->eLanguage)
- {
- sal_uInt16 nScriptType = GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
- sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE;
- switch(nScriptType)
- {
- case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
- case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
- }
- SfxItemSet aSet( aEditDoc.GetItemPool(), nLangWhichId, nLangWhichId);
- aSet.Put(SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId));
- SetAttribs( aCurrentPaM, aSet );
- }
- //insert the new string and set the cursor to the end of the inserted string
- aCurrentPaM = ImpInsertText( aCurrentPaM , aCurrentNewPortion->sText );
- ++aCurrentNewPortion;
- }
- }
- UndoActionEnd( EDITUNDO_INSERT );
-
- EditPaM aNext;
- if (bRecheck)
- aNext = pSpellInfo->aCurSentenceStart;
- else
- {
- // restore cursor position to the end of the modified sentence.
- // (This will define the continuation position for spell/grammar checking)
- // First: check if the sentence/para length changed
- sal_Int32 nDelta = rEditView.pImpEditView->GetEditSelection().Max().GetNode()->Len() - nOldLen;
- xub_StrLen nEndOfSentence = aOldSel.Max().GetIndex() + nDelta;
- aNext = EditPaM( aOldSel.Max().GetNode(), nEndOfSentence );
- }
- rEditView.pImpEditView->SetEditSelection( aNext );
-
- FormatAndUpdate();
- aEditDoc.SetModified(sal_True);
- }
-}
-
-void ImpEditEngine::PutSpellingToSentenceStart( EditView& rEditView )
-{
- if( pSpellInfo && pSpellInfo->aLastSpellContentSelections.size() )
- {
- rEditView.pImpEditView->SetEditSelection( pSpellInfo->aLastSpellContentSelections.begin()->Min() );
- }
-}
-
-
-void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpellAtCursorPos, sal_Bool bInteruptable )
-{
- /*
- 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() )
- return;
-
- EditPaM aCursorPos;
- if( pActiveView && !bSpellAtCursorPos )
- {
- DBG_CHKOBJ( pActiveView, EditView, 0 );
- aCursorPos = pActiveView->pImpEditView->GetEditSelection().Max();
- }
- sal_Bool bRestartTimer = sal_False;
-
- ContentNode* pLastNode = aEditDoc.SaveGetObject( aEditDoc.Count() - 1 );
- sal_uInt16 nNodes = GetEditDoc().Count();
- sal_uInt16 nInvalids = 0;
- Sequence< PropertyValue > aEmptySeq;
- for ( sal_uInt16 n = 0; n < nNodes; n++ )
- {
- ContentNode* pNode = GetEditDoc().GetObject( n );
- if ( pThisNodeOnly )
- pNode = pThisNodeOnly;
-
- if ( pNode->GetWrongList()->IsInvalid() )
- {
- WrongList* pWrongList = pNode->GetWrongList();
- sal_uInt16 nInvStart = pWrongList->GetInvalidStart();
- sal_uInt16 nInvEnd = pWrongList->GetInvalidEnd();
-
- sal_uInt16 nWrongs = 0; // Lose control also in the paragraphs
- sal_uInt16 nPaintFrom = 0xFFFF, nPaintTo = 0;
- sal_Bool bSimpleRepaint = sal_True;
-
- pWrongList->SetValid();
-
- EditPaM aPaM( pNode, nInvStart );
- EditSelection aSel( aPaM, aPaM );
- while ( ( aSel.Max().GetNode() == pNode ) /* && !bStop */ )
- {
- if ( ( aSel.Min().GetIndex() > nInvEnd )
- || ( ( aSel.Max().GetNode() == pLastNode ) && ( aSel.Max().GetIndex() >= pLastNode->Len() ) ) )
- break; // Document end or end of invalid region
-
- aSel = SelectWord( aSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- String aWord( GetSelected( aSel ) );
- // 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() )
- {
- sal_Unicode cNext = aSel.Max().GetNode()->GetChar( aSel.Max().GetIndex() );
- if ( cNext == '.' )
- {
- aSel.Max().GetIndex()++;
- aWord += cNext;
- bDottAdded = sal_True;
- }
- }
-
-
- sal_Bool bChanged = sal_False;
- if ( aWord.Len() > 0 )
- {
- sal_uInt16 nWStart = aSel.Min().GetIndex();
- sal_uInt16 nWEnd= aSel.Max().GetIndex();
- if ( !xSpeller->isValid( aWord, GetLanguage( EditPaM( aSel.Min().GetNode(), nWStart+1 ) ), aEmptySeq ) )
- {
- // Check if already marked correctly...
- nWrongs++;
- sal_uInt16 nXEnd = bDottAdded ? nWEnd -1 : nWEnd;
- if ( !pWrongList->HasWrong( nWStart, nXEnd ) )
- {
- // Mark Word as wrong...
- // But only when not at Cursor-Position...
- sal_Bool bCursorPos = sal_False;
- if ( aCursorPos.GetNode() == pNode )
- {
- if ( ( nWStart <= aCursorPos.GetIndex() ) && nWEnd >= aCursorPos.GetIndex() )
- bCursorPos = sal_True;
- }
- if ( bCursorPos )
- {
- // Then continue to mark as invalid ...
- pWrongList->GetInvalidStart() = nWStart;
- pWrongList->GetInvalidEnd() = nWEnd;
- bRestartTimer = sal_True;
- }
- else
- {
- // 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;
- }
- }
- }
- else
- {
- // Check if not marked as wrong
- if ( pWrongList->HasAnyWrong( nWStart, nWEnd ) )
- {
- pWrongList->ClearWrongs( nWStart, nWEnd, pNode );
- bSimpleRepaint = sal_False;
- bChanged = sal_True;
- }
- }
- if ( bChanged )
- {
- if ( nPaintFrom == 0xFFFF )
- nPaintFrom = nWStart;
- nPaintTo = nWEnd;
- }
- }
-
- EditPaM aLastEnd( aSel.Max() );
- aSel = WordRight( aSel.Max(), ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- if ( bChanged && ( aSel.Min().GetNode() == pNode ) &&
- ( ( aSel.Min().GetIndex()-aLastEnd.GetIndex() > 1 ) ) )
- {
- // 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 );
- }
- }
-
- // Invalidate?
- if ( ( nPaintFrom != 0xFFFF ) )
- {
- aStatus.GetStatusWord() |= EE_STAT_WRONGWORDCHANGED;
- CallStatusHdl();
-
- if ( aEditViews.Count() )
- {
- // 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 set!" );
- aInvalidRec.Left() = 0;
- aInvalidRec.Right() = GetPaperSize().Width();
- aInvalidRec.Top() = aStartCursor.Top();
- aInvalidRec.Bottom() = aEndCursor.Bottom();
- if ( pActiveView && pActiveView->HasSelection() )
- {
- // Then no output through VDev.
- UpdateViews( NULL );
- }
- else if ( bSimpleRepaint )
- {
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
- {
- EditView* pView = aEditViews[nView];
- Rectangle aClipRec( aInvalidRec );
- aClipRec.Intersection( pView->GetVisArea() );
- if ( !aClipRec.IsEmpty() )
- {
- // convert to window coordinates ....
- aClipRec.SetPos( pView->pImpEditView->GetWindowPos( aClipRec.TopLeft() ) );
- // If selected, then VDev ...
- Paint( pView->pImpEditView, aClipRec, pView->HasSelection() );
- }
- }
- }
- else
- {
- UpdateViews( pActiveView );
- }
- aInvalidRec = Rectangle();
- }
- }
- // After two corrected nodes give up the control ...
- nInvalids++;
- if ( bInteruptable && ( nInvalids >= 2 ) )
- {
- bRestartTimer = sal_True;
- break;
- }
- }
-
- if ( pThisNodeOnly )
- break;
- }
- if ( bRestartTimer )
- aOnlineSpellTimer.Start();
-}
-
-
-EESpellState ImpEditEngine::HasSpellErrors()
-{
- DBG_ASSERT( xSpeller.is(), "No spell checker set!" );
-
- ContentNode* pLastNode = aEditDoc.SaveGetObject( aEditDoc.Count() - 1 );
- EditSelection aCurSel( aEditDoc.GetStartPaM() );
-
- String aWord;
- Reference< XSpellAlternatives > xSpellAlt;
- Sequence< PropertyValue > aEmptySeq;
- while ( !xSpellAlt.is() )
- {
- if ( ( aCurSel.Max().GetNode() == pLastNode ) &&
- ( aCurSel.Max().GetIndex() >= pLastNode->Len() ) )
- {
- return EE_SPELL_OK;
- }
-
- aCurSel = SelectWord( aCurSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- aWord = GetSelected( aCurSel );
- if ( aWord.Len() > 0 )
- {
- LanguageType eLang = GetLanguage( aCurSel.Max() );
- SvxSpellWrapper::CheckSpellLang( xSpeller, eLang );
- xSpellAlt = xSpeller->spell( aWord, eLang, aEmptySeq );
- }
- aCurSel = WordRight( aCurSel.Max(), ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- }
-
- return EE_SPELL_ERRORFOUND;
-}
-
-EESpellState ImpEditEngine::StartThesaurus( EditView* pEditView )
-{
- EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() );
- if ( !aCurSel.HasRange() )
- aCurSel = SelectWord( aCurSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
- String aWord( GetSelected( aCurSel ) );
-
- Reference< XThesaurus > xThes( SvxGetThesaurus() );
- if (!xThes.is())
- return EE_SPELL_ERRORFOUND;
-
- EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
- AbstractThesaurusDialog* pDlg = pFact->CreateThesaurusDialog( pEditView->GetWindow(), xThes, aWord, GetLanguage( aCurSel.Max() ) );
- if ( pDlg->Execute() == RET_OK )
- {
- // Replace Word...
- pEditView->pImpEditView->DrawSelection();
- pEditView->pImpEditView->SetEditSelection( aCurSel );
- pEditView->pImpEditView->DrawSelection();
- pEditView->InsertText( pDlg->GetWord() );
- pEditView->ShowCursor( sal_True, sal_False );
- }
-
- delete pDlg;
- return EE_SPELL_OK;
-}
-
-sal_uInt16 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSearchItem& rSearchItem )
-{
- sal_uInt16 nFound = 0;
-
- EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() );
-
- // FIND_ALL is not possible without multiple selection.
- if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND ) ||
- ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL ) )
- {
- if ( Search( rSearchItem, pEditView ) )
- nFound++;
- }
- else if ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE )
- {
- // The word is selected if the user not altered the selection
- // in between:
- if ( aCurSel.HasRange() )
- {
- pEditView->InsertText( rSearchItem.GetReplaceString() );
- nFound = 1;
- }
- else
- if( Search( rSearchItem, pEditView ) )
- nFound = 1;
- }
- else if ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL )
- {
- // The Writer replaces all front beginning to end ...
- SvxSearchItem aTmpItem( rSearchItem );
- aTmpItem.SetBackward( sal_False );
-
- pEditView->pImpEditView->DrawSelection();
-
- aCurSel.Adjust( aEditDoc );
- EditPaM aStartPaM = aTmpItem.GetSelection() ? aCurSel.Min() : aEditDoc.GetStartPaM();
- EditSelection aFoundSel( aCurSel.Max() );
- sal_Bool bFound = ImpSearch( aTmpItem, aCurSel, aStartPaM, aFoundSel );
- if ( bFound )
- UndoActionStart( EDITUNDO_REPLACEALL );
- while ( bFound )
- {
- nFound++;
- aStartPaM = ImpInsertText( aFoundSel, rSearchItem.GetReplaceString() );
- bFound = ImpSearch( aTmpItem, aCurSel, aStartPaM, aFoundSel );
- }
- if ( nFound )
- {
- EditPaM aNewPaM( aFoundSel.Max() );
- if ( aNewPaM.GetIndex() > aNewPaM.GetNode()->Len() )
- aNewPaM.GetIndex() = aNewPaM.GetNode()->Len();
- pEditView->pImpEditView->SetEditSelection( aNewPaM );
- FormatAndUpdate( pEditView );
- UndoActionEnd( EDITUNDO_REPLACEALL );
- }
- else
- {
- pEditView->pImpEditView->DrawSelection();
- pEditView->ShowCursor( sal_True, sal_False );
- }
- }
- return nFound;
-}
-
-sal_Bool ImpEditEngine::Search( const SvxSearchItem& rSearchItem, EditView* pEditView )
-{
- EditSelection aSel( pEditView->pImpEditView->GetEditSelection() );
- aSel.Adjust( aEditDoc );
- EditPaM aStartPaM( aSel.Max() );
- if ( rSearchItem.GetSelection() && !rSearchItem.GetBackward() )
- aStartPaM = aSel.Min();
-
- EditSelection aFoundSel;
- sal_Bool bFound = ImpSearch( rSearchItem, aSel, aStartPaM, aFoundSel );
- if ( bFound && ( aFoundSel == aSel ) ) // For backwards-search
- {
- aStartPaM = aSel.Min();
- bFound = ImpSearch( rSearchItem, aSel, aStartPaM, aFoundSel );
- }
-
- pEditView->pImpEditView->DrawSelection();
- if ( bFound )
- {
- // 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 );
- }
- else
- pEditView->pImpEditView->SetEditSelection( aSel.Max() );
-
- pEditView->pImpEditView->DrawSelection();
- pEditView->ShowCursor( sal_True, sal_False );
- return bFound;
-}
-
-sal_Bool ImpEditEngine::ImpSearch( const SvxSearchItem& rSearchItem,
- const EditSelection& rSearchSelection, const EditPaM& rStartPos, EditSelection& rFoundSel )
-{
- util::SearchOptions aSearchOptions( rSearchItem.GetSearchOptions() );
- aSearchOptions.Locale = GetLocale( rStartPos );
-
- sal_Bool bBack = rSearchItem.GetBackward();
- sal_Bool bSearchInSelection = rSearchItem.GetSelection();
- sal_uInt16 nStartNode = aEditDoc.GetPos( rStartPos.GetNode() );
- sal_uInt16 nEndNode;
- if ( bSearchInSelection )
- {
- nEndNode = aEditDoc.GetPos( bBack ? rSearchSelection.Min().GetNode() : rSearchSelection.Max().GetNode() );
- }
- else
- {
- nEndNode = bBack ? 0 : aEditDoc.Count()-1;
- }
-
- utl::TextSearch aSearcher( aSearchOptions );
-
- // iterate over the paragraphs ...
- for ( sal_uInt16 nNode = nStartNode;
- bBack ? ( nNode >= nEndNode ) : ( nNode <= nEndNode) ;
- bBack ? nNode-- : nNode++ )
- {
- // For backwards-search if nEndNode = 0:
- if ( nNode >= 0xFFFF )
- return sal_False;
-
- ContentNode* pNode = aEditDoc.GetObject( nNode );
-
- sal_uInt16 nStartPos = 0;
- sal_uInt16 nEndPos = pNode->Len();
- if ( nNode == nStartNode )
- {
- if ( bBack )
- nEndPos = rStartPos.GetIndex();
- else
- nStartPos = rStartPos.GetIndex();
- }
- if ( ( nNode == nEndNode ) && bSearchInSelection )
- {
- if ( bBack )
- nStartPos = rSearchSelection.Min().GetIndex();
- else
- nEndPos = rSearchSelection.Max().GetIndex();
- }
-
- // Searching ...
- XubString aParaStr( GetEditDoc().GetParaAsString( pNode ) );
- bool bFound = false;
- if ( bBack )
- {
- Swapsal_uIt16s( nStartPos, nEndPos );
- bFound = aSearcher.SearchBkwrd( aParaStr, &nStartPos, &nEndPos);
- }
- else
- bFound = aSearcher.SearchFrwrd( aParaStr, &nStartPos, &nEndPos);
-
- if ( bFound )
- {
- rFoundSel.Min().SetNode( pNode );
- rFoundSel.Min().SetIndex( nStartPos );
- rFoundSel.Max().SetNode( pNode );
- rFoundSel.Max().SetIndex( nEndPos );
- return sal_True;
- }
- }
- return sal_False;
-}
-
-sal_Bool ImpEditEngine::HasText( const SvxSearchItem& rSearchItem )
-{
- SvxSearchItem aTmpItem( rSearchItem );
- aTmpItem.SetBackward( sal_False );
- aTmpItem.SetSelection( sal_False );
-
- EditPaM aStartPaM( aEditDoc.GetStartPaM() );
- EditSelection aDummySel( aStartPaM );
- EditSelection aFoundSel;
- return ImpSearch( aTmpItem, aDummySel, aStartPaM, aFoundSel );
-}
-
-void ImpEditEngine::SetAutoCompleteText( const String& rStr, sal_Bool bClearTipWindow )
-{
- aAutoCompleteText = rStr;
- if ( bClearTipWindow && pActiveView )
- Help::ShowQuickHelp( pActiveView->GetWindow(), Rectangle(), String(), 0 );
-}
-
-
-struct TransliterationChgData
-{
- sal_uInt16 nStart;
- xub_StrLen nLen;
- EditSelection aSelection;
- String aNewText;
- uno::Sequence< sal_Int32 > aOffsets;
-};
-
-
-EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode )
-{
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- if (!_xBI.is())
- return rSelection;
-
- EditSelection aSel( rSelection );
- aSel.Adjust( aEditDoc );
-
- if ( !aSel.HasRange() )
- aSel = SelectWord( aSel );
-
- EditSelection aNewSel( aSel );
-
- const sal_uInt16 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
- const sal_uInt16 nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
-
- sal_Bool bChanges = sal_False;
- sal_Bool bLenChanged = sal_False;
- EditUndoTransliteration* pUndo = NULL;
-
- utl::TransliterationWrapper aTranslitarationWrapper( ::comphelper::getProcessServiceFactory(), nTransliterationMode );
- sal_Bool bConsiderLanguage = aTranslitarationWrapper.needLanguageForTheMode();
-
- for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )
- {
- ContentNode* pNode = aEditDoc.GetObject( nNode );
- xub_StrLen nStartPos = 0;
- xub_StrLen nEndPos = pNode->Len();
- if ( nNode == nStartNode )
- nStartPos = aSel.Min().GetIndex();
- if ( nNode == nEndNode ) // can also be == nStart!
- nEndPos = aSel.Max().GetIndex();
-
- sal_uInt16 nCurrentStart = nStartPos;
- sal_uInt16 nCurrentEnd = nEndPos;
- sal_uInt16 nLanguage = LANGUAGE_SYSTEM;
-
- // since we don't use Hiragana/Katakana or half-width/full-width transliterations here
- // it is fine to use ANYWORD_IGNOREWHITESPACES. (ANY_WORD btw is broken and will
- // occasionaly miss words in consecutive sentences). Also with ANYWORD_IGNOREWHITESPACES
- // text like 'just-in-time' will be converted to 'Just-In-Time' which seems to be the
- // proper thing to do.
- const sal_Int16 nWordType = i18n::WordType::ANYWORD_IGNOREWHITESPACES;
-
- //! In order to have less trouble with changing text size, e.g. because
- //! of ligatures or � (German small sz) being resolved, we need to process
- //! the text replacements from end to start.
- //! This way the offsets for the yet to be changed words will be
- //! left unchanged by the already replaced text.
- //! For this we temporarily save the changes to be done in this vector
- std::vector< TransliterationChgData > aChanges;
- TransliterationChgData aChgData;
-
- if (nTransliterationMode == i18n::TransliterationModulesExtra::TITLE_CASE)
- {
- // for 'capitalize every word' we need to iterate over each word
-
- i18n::Boundary aSttBndry;
- i18n::Boundary aEndBndry;
- aSttBndry = _xBI->getWordBoundary(
- *pNode, nStartPos,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ),
- nWordType, sal_True /*prefer forward direction*/);
- aEndBndry = _xBI->getWordBoundary(
- *pNode, nEndPos,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ),
- nWordType, sal_False /*prefer backward direction*/);
-
- // prevent backtracking to the previous word if selection is at word boundary
- if (aSttBndry.endPos <= nStartPos)
- {
- aSttBndry = _xBI->nextWord(
- *pNode, aSttBndry.endPos,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, aSttBndry.endPos + 1 ) ) ),
- nWordType);
- }
- // prevent advancing to the next word if selection is at word boundary
- if (aEndBndry.startPos >= nEndPos)
- {
- aEndBndry = _xBI->previousWord(
- *pNode, aEndBndry.startPos,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, aEndBndry.startPos + 1 ) ) ),
- nWordType);
- }
-
- i18n::Boundary aCurWordBndry( aSttBndry );
- while (aCurWordBndry.startPos <= aEndBndry.startPos)
- {
- nCurrentStart = (xub_StrLen)aCurWordBndry.startPos;
- nCurrentEnd = (xub_StrLen)aCurWordBndry.endPos;
- sal_Int32 nLen = nCurrentEnd - nCurrentStart;
- DBG_ASSERT( nLen > 0, "invalid word length of 0" );
-#if OSL_DEBUG_LEVEL > 1
- String aText( pNode->Copy( nCurrentStart, nLen ) );
-#endif
-
- Sequence< sal_Int32 > aOffsets;
- String aNewText( aTranslitarationWrapper.transliterate( *pNode,
- GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ),
- nCurrentStart, nLen, &aOffsets ));
-
- if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
- {
- aChgData.nStart = nCurrentStart;
- aChgData.nLen = nLen;
- aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) );
- aChgData.aNewText = aNewText;
- aChgData.aOffsets = aOffsets;
- aChanges.push_back( aChgData );
- }
-#if OSL_DEBUG_LEVEL > 1
- String aSelTxt ( GetSelected( aChgData.aSelection ) );
- (void) aSelTxt;
-#endif
-
- aCurWordBndry = _xBI->nextWord( *pNode, nCurrentEnd,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
- nWordType);
- }
- DBG_ASSERT( nCurrentEnd >= aEndBndry.endPos, "failed to reach end of transliteration" );
- }
- else if (nTransliterationMode == i18n::TransliterationModulesExtra::SENTENCE_CASE)
- {
- // for 'sentence case' we need to iterate sentence by sentence
-
- sal_Int32 nLastStart = _xBI->beginOfSentence(
- *pNode, nEndPos,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ) );
- sal_Int32 nLastEnd = _xBI->endOfSentence(
- *pNode, nLastStart,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ) );
-
- // extend nCurrentStart, nCurrentEnd to the current sentence boundaries
- nCurrentStart = _xBI->beginOfSentence(
- *pNode, nStartPos,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ) );
- nCurrentEnd = _xBI->endOfSentence(
- *pNode, nCurrentStart,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
-
- // prevent backtracking to the previous sentence if selection starts at end of a sentence
- if (nCurrentEnd <= nStartPos)
- {
- // now nCurrentStart is probably located on a non-letter word. (unless we
- // are in Asian text with no spaces...)
- // Thus to get the real sentence start we should locate the next real word,
- // that is one found by DICTIONARY_WORD
- i18n::Boundary aBndry = _xBI->nextWord( *pNode, nCurrentEnd,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
- i18n::WordType::DICTIONARY_WORD);
-
- // now get new current sentence boundaries
- nCurrentStart = _xBI->beginOfSentence(
- *pNode, aBndry.startPos,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) );
- nCurrentEnd = _xBI->endOfSentence(
- *pNode, nCurrentStart,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
- }
- // prevent advancing to the next sentence if selection ends at start of a sentence
- if (nLastStart >= nEndPos)
- {
- // now nCurrentStart is probably located on a non-letter word. (unless we
- // are in Asian text with no spaces...)
- // Thus to get the real sentence start we should locate the previous real word,
- // that is one found by DICTIONARY_WORD
- i18n::Boundary aBndry = _xBI->previousWord( *pNode, nLastStart,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ),
- i18n::WordType::DICTIONARY_WORD);
- nLastEnd = _xBI->endOfSentence(
- *pNode, aBndry.startPos,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) );
- if (nCurrentEnd > nLastEnd)
- nCurrentEnd = nLastEnd;
- }
-
- while (nCurrentStart < nLastEnd)
- {
- sal_Int32 nLen = nCurrentEnd - nCurrentStart;
- DBG_ASSERT( nLen > 0, "invalid word length of 0" );
-#if OSL_DEBUG_LEVEL > 1
- String aText( pNode->Copy( nCurrentStart, nLen ) );
-#endif
-
- Sequence< sal_Int32 > aOffsets;
- String aNewText( aTranslitarationWrapper.transliterate( *pNode,
- GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ),
- nCurrentStart, nLen, &aOffsets ));
-
- if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
- {
- aChgData.nStart = nCurrentStart;
- aChgData.nLen = nLen;
- aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) );
- aChgData.aNewText = aNewText;
- aChgData.aOffsets = aOffsets;
- aChanges.push_back( aChgData );
- }
-
- i18n::Boundary aFirstWordBndry;
- aFirstWordBndry = _xBI->nextWord(
- *pNode, nCurrentEnd,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
- nWordType);
- nCurrentStart = aFirstWordBndry.startPos;
- nCurrentEnd = _xBI->endOfSentence(
- *pNode, nCurrentStart,
- SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
- }
- DBG_ASSERT( nCurrentEnd >= nLastEnd, "failed to reach end of transliteration" );
- }
- else
- {
- do
- {
- if ( bConsiderLanguage )
- {
- nLanguage = GetLanguage( EditPaM( pNode, nCurrentStart+1 ), &nCurrentEnd );
- if ( nCurrentEnd > nEndPos )
- nCurrentEnd = nEndPos;
- }
-
- xub_StrLen nLen = nCurrentEnd - nCurrentStart;
-
- Sequence< sal_Int32 > aOffsets;
- String aNewText( aTranslitarationWrapper.transliterate( *pNode, nLanguage, nCurrentStart, nLen, &aOffsets ) );
-
- if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
- {
- aChgData.nStart = nCurrentStart;
- aChgData.nLen = nLen;
- aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) );
- aChgData.aNewText = aNewText;
- aChgData.aOffsets = aOffsets;
- aChanges.push_back( aChgData );
- }
-
- nCurrentStart = nCurrentEnd;
- } while( nCurrentEnd < nEndPos );
- }
-
- if (!aChanges.empty())
- {
- // Create a single UndoAction on Demand for all the changes ...
- if ( !pUndo && IsUndoEnabled() && !IsInUndo() )
- {
- // adjust selection to include all changes
- for (size_t i = 0; i < aChanges.size(); ++i)
- {
- const EditSelection &rSel = aChanges[i].aSelection;
- if (aSel.Min().GetNode() == rSel.Min().GetNode() &&
- aSel.Min().GetIndex() > rSel.Min().GetIndex())
- aSel.Min().SetIndex( rSel.Min().GetIndex() );
- if (aSel.Max().GetNode() == rSel.Max().GetNode() &&
- aSel.Max().GetIndex() < rSel.Max().GetIndex())
- aSel.Max().SetIndex( rSel.Max().GetIndex() );
- }
- aNewSel = aSel;
-
- ESelection aESel( CreateESel( aSel ) );
- pUndo = new EditUndoTransliteration( this, aESel, nTransliterationMode );
-
- const bool bSingleNode = aSel.Min().GetNode()== aSel.Max().GetNode();
- const bool bHasAttribs = aSel.Min().GetNode()->GetCharAttribs().HasAttrib( aSel.Min().GetIndex(), aSel.Max().GetIndex() );
- if (bSingleNode && !bHasAttribs)
- pUndo->SetText( aSel.Min().GetNode()->Copy( aSel.Min().GetIndex(), aSel.Max().GetIndex()-aSel.Min().GetIndex() ) );
- else
- pUndo->SetText( CreateBinTextObject( aSel, NULL ) );
- }
-
- // now apply the changes from end to start to leave the offsets of the
- // yet unchanged text parts remain the same.
- for (size_t i = 0; i < aChanges.size(); ++i)
- {
- const TransliterationChgData &rData = aChanges[ aChanges.size() - 1 - i ];
-
- bChanges = sal_True;
- if (rData.nLen != rData.aNewText.Len())
- bLenChanged = sal_True;
-
- // Change text without loosing the attributes
- sal_uInt16 nDiffs = ReplaceTextOnly( rData.aSelection.Min().GetNode(),
- rData.nStart, rData.nLen, rData.aNewText, rData.aOffsets );
-
- // adjust selection in end node to possibly changed size
- if (aSel.Max().GetNode() == rData.aSelection.Max().GetNode())
- aNewSel.Max().GetIndex() = aNewSel.Max().GetIndex() + nDiffs;
-
- sal_uInt16 nSelNode = aEditDoc.GetPos( rData.aSelection.Min().GetNode() );
- ParaPortion* pParaPortion = GetParaPortions()[nSelNode];
- pParaPortion->MarkSelectionInvalid( rData.nStart,
- std::max< sal_uInt16 >( rData.nStart + rData.nLen,
- rData.nStart + rData.aNewText.Len() ) );
- }
- }
- }
-
- if ( pUndo )
- {
- ESelection aESel( CreateESel( aNewSel ) );
- pUndo->SetNewSelection( aESel );
- InsertUndo( pUndo );
- }
-
- if ( bChanges )
- {
- TextModified();
- SetModifyFlag( sal_True );
- if ( bLenChanged )
- UpdateSelections();
- FormatAndUpdate();
- }
-
- return aNewSel;
-}
-
-
-short ImpEditEngine::ReplaceTextOnly(
- ContentNode* pNode,
- sal_uInt16 nCurrentStart, xub_StrLen nLen,
- const String& rNewText,
- const uno::Sequence< sal_Int32 >& rOffsets )
-{
- (void) nLen;
-
- // Change text without loosing the attributes
- sal_uInt16 nCharsAfterTransliteration =
- sal::static_int_cast< sal_uInt16 >(rOffsets.getLength());
- const sal_Int32* pOffsets = rOffsets.getConstArray();
- short nDiffs = 0;
- for ( sal_uInt16 n = 0; n < nCharsAfterTransliteration; n++ )
- {
- sal_uInt16 nCurrentPos = nCurrentStart+n;
- sal_Int32 nDiff = (nCurrentPos-nDiffs) - pOffsets[n];
-
- if ( !nDiff )
- {
- DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" );
- pNode->SetChar( nCurrentPos, rNewText.GetChar(n) );
- }
- else if ( nDiff < 0 )
- {
- // Replace first char, delete the rest...
- DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" );
- pNode->SetChar( nCurrentPos, rNewText.GetChar(n) );
-
- DBG_ASSERT( (nCurrentPos+1) < pNode->Len(), "TransliterateText - String smaller than expected!" );
- GetEditDoc().RemoveChars( EditPaM( pNode, nCurrentPos+1 ), sal::static_int_cast< sal_uInt16 >(-nDiff) );
- }
- else
- {
- DBG_ASSERT( nDiff == 1, "TransliterateText - Diff other than expected! But should work..." );
- GetEditDoc().InsertText( EditPaM( pNode, nCurrentPos ), rNewText.GetChar(n) );
-
- }
- nDiffs = sal::static_int_cast< short >(nDiffs + nDiff);
- }
-
- return nDiffs;
-}
-
-
-void ImpEditEngine::SetAsianCompressionMode( sal_uInt16 n )
-{
- if ( n != nAsianCompressionMode )
- {
- nAsianCompressionMode = n;
- if ( ImplHasText() )
- {
- FormatFullDoc();
- UpdateViews();
- }
- }
-}
-
-void ImpEditEngine::SetKernAsianPunctuation( sal_Bool b )
-{
- if ( b != bKernAsianPunctuation )
- {
- bKernAsianPunctuation = b;
- if ( ImplHasText() )
- {
- FormatFullDoc();
- UpdateViews();
- }
- }
-}
-
-void ImpEditEngine::SetAddExtLeading( sal_Bool bExtLeading )
-{
- if ( IsAddExtLeading() != bExtLeading )
- {
- bAddExtLeading = bExtLeading;
- if ( ImplHasText() )
- {
- FormatFullDoc();
- UpdateViews();
- }
- }
-};
-
-
-
-sal_Bool ImpEditEngine::ImplHasText() const
-{
- return ( ( GetEditDoc().Count() > 1 ) || GetEditDoc().GetObject(0)->Len() );
-}
-
-sal_Int32 ImpEditEngine::LogicToTwips(sal_Int32 n)
-{
- 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
deleted file mode 100644
index 835ee1263e..0000000000
--- a/editeng/source/editeng/impedit5.cxx
+++ /dev/null
@@ -1,869 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <eeng_pch.hxx>
-
-#include <impedit.hxx>
-#include <editeng/editeng.hxx>
-#include <editdbg.hxx>
-
-#include <svl/smplhint.hxx>
-
-
-#include <editeng/lrspitem.hxx>
-
-void ImpEditEngine::SetStyleSheetPool( SfxStyleSheetPool* pSPool )
-{
- if ( pStylePool != pSPool )
- {
- pStylePool = pSPool;
- }
-}
-
-SfxStyleSheet* ImpEditEngine::GetStyleSheet( sal_uInt16 nPara ) const
-{
- ContentNode* pNode = aEditDoc.SaveGetObject( nPara );
- return pNode ? pNode->GetContentAttribs().GetStyleSheet() : NULL;
-}
-
-void ImpEditEngine::SetStyleSheet( EditSelection aSel, SfxStyleSheet* pStyle )
-{
- aSel.Adjust( aEditDoc );
-
- sal_uInt16 nStartPara = aEditDoc.GetPos( aSel.Min().GetNode() );
- sal_uInt16 nEndPara = aEditDoc.GetPos( aSel.Max().GetNode() );
-
- sal_Bool _bUpdate = GetUpdateMode();
- SetUpdateMode( sal_False );
-
- for ( sal_uInt16 n = nStartPara; n <= nEndPara; n++ )
- SetStyleSheet( n, pStyle );
-
- SetUpdateMode( _bUpdate, 0 );
-}
-
-void ImpEditEngine::SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle )
-{
- DBG_ASSERT( GetStyleSheetPool() || !pStyle, "SetStyleSheet: No StyleSheetPool registered!" );
- ContentNode* pNode = aEditDoc.SaveGetObject( nPara );
- SfxStyleSheet* pCurStyle = pNode->GetStyleSheet();
- if ( pStyle != pCurStyle )
- {
- if ( IsUndoEnabled() && !IsInUndo() && aStatus.DoUndoAttribs() )
- {
- XubString aPrevStyleName;
- if ( pCurStyle )
- aPrevStyleName = pCurStyle->GetName();
-
- XubString aNewStyleName;
- if ( pStyle )
- aNewStyleName = pStyle->GetName();
-
- InsertUndo(
- new EditUndoSetStyleSheet( this, aEditDoc.GetPos( pNode ),
- aPrevStyleName, pCurStyle ? pCurStyle->GetFamily() : SFX_STYLE_FAMILY_PARA,
- aNewStyleName, pStyle ? pStyle->GetFamily() : SFX_STYLE_FAMILY_PARA,
- pNode->GetContentAttribs().GetItems() ) );
- }
- if ( pCurStyle )
- EndListening( *pCurStyle, sal_False );
- pNode->SetStyleSheet( pStyle, aStatus.UseCharAttribs() );
- if ( pStyle )
- StartListening( *pStyle, sal_False );
- ParaAttribsChanged( pNode );
- }
- FormatAndUpdate();
-}
-
-void ImpEditEngine::UpdateParagraphsWithStyleSheet( SfxStyleSheet* pStyle )
-{
- SvxFont aFontFromStyle;
- CreateFont( aFontFromStyle, pStyle->GetItemSet() );
-
- sal_Bool bUsed = sal_False;
- for ( sal_uInt16 nNode = 0; nNode < aEditDoc.Count(); nNode++ )
- {
- ContentNode* pNode = aEditDoc.GetObject( nNode );
- if ( pNode->GetStyleSheet() == pStyle )
- {
- bUsed = sal_True;
- if ( aStatus.UseCharAttribs() )
- pNode->SetStyleSheet( pStyle, aFontFromStyle );
- else
- pNode->SetStyleSheet( pStyle, sal_False );
-
- ParaAttribsChanged( pNode );
- }
- }
- if ( bUsed )
- {
- GetEditEnginePtr()->StyleSheetChanged( pStyle );
- FormatAndUpdate();
- }
-}
-
-void ImpEditEngine::RemoveStyleFromParagraphs( SfxStyleSheet* pStyle )
-{
- for ( sal_uInt16 nNode = 0; nNode < aEditDoc.Count(); nNode++ )
- {
- ContentNode* pNode = aEditDoc.GetObject(nNode);
- if ( pNode->GetStyleSheet() == pStyle )
- {
- pNode->SetStyleSheet( NULL );
- ParaAttribsChanged( pNode );
- }
- }
- FormatAndUpdate();
-}
-
-void ImpEditEngine::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
-{
- // So that not a lot of unnecessary formatting is done when destructing:
- if ( !bDowning )
- {
- DBG_CHKOBJ( GetEditEnginePtr(), EditEngine, 0 );
-
- SfxStyleSheet* pStyle = NULL;
- sal_uLong nId = 0;
-
- if ( rHint.ISA( SfxStyleSheetHint ) )
- {
- const SfxStyleSheetHint& rH = (const SfxStyleSheetHint&) rHint;
- DBG_ASSERT( rH.GetStyleSheet()->ISA( SfxStyleSheet ), "No SfxStyleSheet!" );
- pStyle = (SfxStyleSheet*) rH.GetStyleSheet();
- nId = rH.GetHint();
- }
- else if ( ( rHint.Type() == TYPE(SfxSimpleHint ) ) && ( rBC.ISA( SfxStyleSheet ) ) )
- {
- pStyle = (SfxStyleSheet*)&rBC;
- nId = ((SfxSimpleHint&)rHint).GetId();
- }
-
- if ( pStyle )
- {
- if ( ( nId == SFX_HINT_DYING ) ||
- ( nId == SFX_STYLESHEET_INDESTRUCTION ) ||
- ( nId == SFX_STYLESHEET_ERASED ) )
- {
- RemoveStyleFromParagraphs( pStyle );
- }
- else if ( ( nId == SFX_HINT_DATACHANGED ) ||
- ( nId == SFX_STYLESHEET_MODIFIED ) )
- {
- UpdateParagraphsWithStyleSheet( pStyle );
- }
- }
- }
-}
-
-EditUndoSetAttribs* ImpEditEngine::CreateAttribUndo( EditSelection aSel, const SfxItemSet& rSet )
-{
- DBG_ASSERT( !aSel.DbgIsBuggy( aEditDoc ), "CreateAttribUndo: Incorrect selection ");
- aSel.Adjust( aEditDoc );
-
- ESelection aESel( CreateESel( aSel ) );
-
- sal_uInt16 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
- sal_uInt16 nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
-
- DBG_ASSERT( nStartNode <= nEndNode, "CreateAttribUndo: Start > End ?!" );
-
- EditUndoSetAttribs* pUndo = NULL;
- if ( rSet.GetPool() != &aEditDoc.GetItemPool() )
- {
- SfxItemSet aTmpSet( GetEmptyItemSet() );
- aTmpSet.Put( rSet );
- pUndo = new EditUndoSetAttribs( this, aESel, aTmpSet );
- }
- else
- {
- pUndo = new EditUndoSetAttribs( this, aESel, rSet );
- }
-
- SfxItemPool* pPool = pUndo->GetNewAttribs().GetPool();
-
- for ( sal_uInt16 nPara = nStartNode; nPara <= nEndNode; nPara++ )
- {
- ContentNode* pNode = aEditDoc.GetObject( nPara );
- DBG_ASSERT( aEditDoc.SaveGetObject( nPara ), "Node not found: CreateAttribUndo" );
- ContentAttribsInfo* pInf = new ContentAttribsInfo( pNode->GetContentAttribs().GetItems() );
- pUndo->GetContentInfos().Insert( pInf, pUndo->GetContentInfos().Count() );
-
- for ( sal_uInt16 nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ )
- {
- EditCharAttribPtr pAttr = pNode->GetCharAttribs().GetAttribs()[ nAttr ];
- if ( pAttr->GetLen() )
- {
- EditCharAttribPtr pNew = MakeCharAttrib( *pPool, *pAttr->GetItem(), pAttr->GetStart(), pAttr->GetEnd() );
- pInf->GetPrevCharAttribs().Insert( pNew, pInf->GetPrevCharAttribs().Count() );
- }
- }
- }
- return pUndo;
-}
-
-void ImpEditEngine::UndoActionStart( sal_uInt16 nId, const ESelection& aSel )
-{
- if ( IsUndoEnabled() && !IsInUndo() )
- {
- GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), XubString(), nId );
- DBG_ASSERT( !pUndoMarkSelection, "UndoAction SelectionMarker?" );
- pUndoMarkSelection = new ESelection( aSel );
- }
-}
-
-void ImpEditEngine::UndoActionStart( sal_uInt16 nId )
-{
- if ( IsUndoEnabled() && !IsInUndo() )
- {
- GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), XubString(), nId );
- DBG_ASSERT( !pUndoMarkSelection, "UndoAction SelectionMarker?" );
- }
-}
-
-void ImpEditEngine::UndoActionEnd( sal_uInt16 )
-{
- if ( IsUndoEnabled() && !IsInUndo() )
- {
- GetUndoManager().LeaveListAction();
- delete pUndoMarkSelection;
- pUndoMarkSelection = NULL;
- }
-}
-
-void ImpEditEngine::InsertUndo( EditUndo* pUndo, sal_Bool bTryMerge )
-{
- DBG_ASSERT( !IsInUndo(), "InsertUndo in Undomodus!" );
- if ( pUndoMarkSelection )
- {
- EditUndoMarkSelection* pU = new EditUndoMarkSelection( this, *pUndoMarkSelection );
- GetUndoManager().AddUndoAction( pU, sal_False );
- delete pUndoMarkSelection;
- pUndoMarkSelection = NULL;
- }
- GetUndoManager().AddUndoAction( pUndo, bTryMerge );
-
- mbLastTryMerge = bTryMerge;
-}
-
-void ImpEditEngine::ResetUndoManager()
-{
- if ( HasUndoManager() )
- GetUndoManager().Clear();
-}
-
-void ImpEditEngine::EnableUndo( sal_Bool bEnable )
-{
- // When switching the mode Delete list:
- if ( bEnable != IsUndoEnabled() )
- ResetUndoManager();
-
- bUndoEnabled = bEnable;
-}
-
-sal_Bool ImpEditEngine::Undo( EditView* pView )
-{
- if ( HasUndoManager() && GetUndoManager().GetUndoActionCount() )
- {
- SetActiveView( pView );
- GetUndoManager().Undo();
- return sal_True;
- }
- return sal_False;
-}
-
-sal_Bool ImpEditEngine::Redo( EditView* pView )
-{
- if ( HasUndoManager() && GetUndoManager().GetRedoActionCount() )
- {
- SetActiveView( pView );
- GetUndoManager().Redo();
- return sal_True;
- }
- return sal_False;
-}
-
-sal_Bool ImpEditEngine::Repeat( EditView* /* pView */ )
-{
- if ( HasUndoManager() && GetUndoManager().GetRepeatActionCount() )
- {
- DBG_WARNING( "Repeat not implemented!" );
- return sal_True;
- }
- return sal_False;
-}
-
-SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttrib )
-{
- DBG_CHKOBJ( GetEditEnginePtr(), EditEngine, 0 );
-
- aSel.Adjust( aEditDoc );
-
- SfxItemSet aCurSet( GetEmptyItemSet() );
-
- sal_uInt16 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
- sal_uInt16 nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
-
- // iterate over the paragraphs ...
- for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )
- {
- ContentNode* pNode = aEditDoc.GetObject( nNode );
- 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 ) // Can also be == nStart!
- nEndPos = aSel.Max().GetIndex();
-
- // Problem: Templates ....
- // => Other way:
- // 1) Hard character attributes, as usual ...
- // 2) Examine Style and paragraph attributes only when OFF ...
-
- // First the very hard formatting ...
- aEditDoc.FindAttribs( pNode, nStartPos, nEndPos, aCurSet );
-
- if( bOnlyHardAttrib != EditEngineAttribs_OnlyHard )
- {
- // 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 )
- {
- if ( bOnlyHardAttrib == EditEngineAttribs_All )
- {
- const SfxPoolItem& rItem = pNode->GetContentAttribs().GetItem( nWhich );
- aCurSet.Put( rItem );
- }
- else if ( pNode->GetContentAttribs().GetItems().GetItemState( nWhich ) == SFX_ITEM_ON )
- {
- const SfxPoolItem& rItem = pNode->GetContentAttribs().GetItems().Get( nWhich );
- aCurSet.Put( rItem );
- }
- }
- else if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_ON )
- {
- const SfxPoolItem* pItem = NULL;
- if ( bOnlyHardAttrib == EditEngineAttribs_All )
- {
- pItem = &pNode->GetContentAttribs().GetItem( nWhich );
- }
- else if ( pNode->GetContentAttribs().GetItems().GetItemState( nWhich ) == SFX_ITEM_ON )
- {
- pItem = &pNode->GetContentAttribs().GetItems().Get( nWhich );
- }
- // pItem can only be NULL when bOnlyHardAttrib...
- if ( !pItem || ( *pItem != aCurSet.Get( 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 );
- }
- }
- }
- }
- }
-
- // fill empty slots with defaults ...
- if ( bOnlyHardAttrib == EditEngineAttribs_All )
- {
- for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++ )
- {
- if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF )
- {
- aCurSet.Put( aEditDoc.GetItemPool().GetDefaultItem( nWhich ) );
- }
- }
- }
- return aCurSet;
-}
-
-
-SfxItemSet ImpEditEngine::GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags ) const
-{
- // 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 );
-
- ContentNode* pNode = aEditDoc.SaveGetObject( nPara );
- DBG_ASSERT( pNode, "GetAttribs - unknown paragraph!" );
- DBG_ASSERT( nStart <= nEnd, "getAttribs: Start > End not supported!" );
-
- SfxItemSet aAttribs( ((ImpEditEngine*)this)->GetEmptyItemSet() );
-
- if ( pNode )
- {
- if ( nEnd > pNode->Len() )
- nEnd = pNode->Len();
-
- if ( nStart > nEnd )
- nStart = nEnd;
-
- // StyleSheet / Parattribs...
-
- if ( pNode->GetStyleSheet() && ( nFlags & GETATTRIBS_STYLESHEET ) )
- aAttribs.Set( pNode->GetStyleSheet()->GetItemSet(), sal_True );
-
- if ( nFlags & GETATTRIBS_PARAATTRIBS )
- aAttribs.Put( pNode->GetContentAttribs().GetItems() );
-
- // CharAttribs...
-
- if ( nFlags & GETATTRIBS_CHARATTRIBS )
- {
- // Make testing easier...
- pNode->GetCharAttribs().OptimizeRanges( ((ImpEditEngine*)this)->GetEditDoc().GetItemPool() );
-
- const CharAttribArray& rAttrs = pNode->GetCharAttribs().GetAttribs();
- for ( sal_uInt16 nAttr = 0; nAttr < rAttrs.Count(); nAttr++ )
- {
- EditCharAttrib* pAttr = rAttrs.GetObject( nAttr );
-
- if ( nStart == nEnd )
- {
- sal_uInt16 nCursorPos = nStart;
- if ( ( pAttr->GetStart() <= nCursorPos ) && ( pAttr->GetEnd() >= nCursorPos ) )
- {
- // To be used the attribute has to start BEFORE the position, or it must be a
- // new empty attr AT the position, or we are on position 0.
- if ( ( pAttr->GetStart() < nCursorPos ) || pAttr->IsEmpty() || !nCursorPos )
- {
- // maybe this attrib ends here and a new attrib with 0 Len may follow and be valid here,
- // but that s no problem, the empty item will come later and win.
- aAttribs.Put( *pAttr->GetItem() );
- }
- }
- }
- else
- {
- // Check every attribute covering the area, partial or full.
- if ( ( pAttr->GetStart() < nEnd ) && ( pAttr->GetEnd() > nStart ) )
- {
- if ( ( pAttr->GetStart() <= nStart ) && ( pAttr->GetEnd() >= nEnd ) )
- {
- // full coverage
- aAttribs.Put( *pAttr->GetItem() );
- }
- else
- {
- // OptimizeRagnge() assures that not the same attr can follow for full coverage
- // only partial, check with current, when using para/styhe, otherwise invalid.
- if ( !( nFlags & (GETATTRIBS_PARAATTRIBS|GETATTRIBS_STYLESHEET) ) ||
- ( *pAttr->GetItem() != aAttribs.Get( pAttr->Which() ) ) )
- {
- aAttribs.InvalidateItem( pAttr->Which() );
- }
- }
- }
- }
-
- if ( pAttr->GetStart() > nEnd )
- {
- break;
- }
- }
- }
- }
-
- return aAttribs;
-}
-
-
-void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_uInt8 nSpecial )
-{
- aSel.Adjust( aEditDoc );
-
- // 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 );
-
- sal_uInt16 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
- sal_uInt16 nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
-
- if ( IsUndoEnabled() && !IsInUndo() && aStatus.DoUndoAttribs() )
- {
- EditUndoSetAttribs* pUndo = CreateAttribUndo( aSel, rSet );
- pUndo->SetSpecial( nSpecial );
- InsertUndo( pUndo );
- }
-
- sal_Bool bCheckLanguage = sal_False;
- if ( GetStatus().DoOnlineSpelling() )
- {
- bCheckLanguage = ( rSet.GetItemState( EE_CHAR_LANGUAGE ) == SFX_ITEM_ON ) ||
- ( rSet.GetItemState( EE_CHAR_LANGUAGE_CJK ) == SFX_ITEM_ON ) ||
- ( rSet.GetItemState( EE_CHAR_LANGUAGE_CTL ) == SFX_ITEM_ON );
- }
-
- // iterate over the paragraphs ...
- for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )
- {
- sal_Bool bParaAttribFound = sal_False;
- sal_Bool bCharAttribFound = sal_False;
-
- ContentNode* pNode = aEditDoc.GetObject( nNode );
- ParaPortion* pPortion = GetParaPortions().GetObject( nNode );
-
- DBG_ASSERT( aEditDoc.SaveGetObject( nNode ), "Node 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 ) // can also be == nStart!
- nEndPos = aSel.Max().GetIndex();
-
- // Iterate over the Items...
- for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++)
- {
- if ( rSet.GetItemState( nWhich ) == SFX_ITEM_ON )
- {
- const SfxPoolItem& rItem = rSet.Get( nWhich );
- if ( nWhich <= EE_PARA_END )
- {
- pNode->GetContentAttribs().GetItems().Put( rItem );
- bParaAttribFound = sal_True;
- }
- else
- {
- aEditDoc.InsertAttrib( pNode, nStartPos, nEndPos, rItem );
- bCharAttribFound = sal_True;
- if ( nSpecial == ATTRSPECIAL_EDGE )
- {
- CharAttribArray& rAttribs = pNode->GetCharAttribs().GetAttribs();
- sal_uInt16 nAttrs = rAttribs.Count();
- for ( sal_uInt16 n = 0; n < nAttrs; n++ )
- {
- EditCharAttrib* pAttr = rAttribs.GetObject( n );
- if ( pAttr->GetStart() > nEndPos )
- break;
-
- if ( ( pAttr->GetEnd() == nEndPos ) && ( pAttr->Which() == nWhich ) )
- {
- pAttr->SetEdge( sal_True );
- break;
- }
- }
- }
- }
- }
- }
-
- if ( bParaAttribFound )
- {
- ParaAttribsChanged( pPortion->GetNode() );
- }
- else if ( bCharAttribFound )
- {
- bFormatted = sal_False;
- if ( !pNode->Len() || ( nStartPos != nEndPos ) )
- {
- pPortion->MarkSelectionInvalid( nStartPos, nEndPos-nStartPos );
- if ( bCheckLanguage )
- pNode->GetWrongList()->MarkInvalid( nStartPos, nEndPos );
- }
- }
- }
-}
-
-void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich )
-{
- aSel.Adjust( aEditDoc );
-
- sal_uInt16 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
- sal_uInt16 nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() );
-
- const SfxItemSet* _pEmptyItemSet = bRemoveParaAttribs ? &GetEmptyItemSet() : 0;
-
- if ( IsUndoEnabled() && !IsInUndo() && aStatus.DoUndoAttribs() )
- {
- // Possibly a special Undo, or itemset*
- EditUndoSetAttribs* pUndo = CreateAttribUndo( aSel, GetEmptyItemSet() );
- pUndo->SetRemoveAttribs( sal_True );
- pUndo->SetRemoveParaAttribs( bRemoveParaAttribs );
- pUndo->SetRemoveWhich( nWhich );
- InsertUndo( pUndo );
- }
-
- // 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 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 ) // can also be == nStart!
- nEndPos = aSel.Max().GetIndex();
-
- // Optimize: If whole paragraph, then RemoveCharAttribs (nPara)?
- sal_Bool bChanged = aEditDoc.RemoveAttribs( pNode, nStartPos, nEndPos, nWhich );
- if ( bRemoveParaAttribs )
- {
- SetParaAttribs( nNode, *_pEmptyItemSet ); // Invalidated
- }
- else
- {
- // For 'Format-Standard' also the character attributes should
- // disappear, which were set as paragraph attributes by the
- // DrawingEngine. These could not have been set by the user anyway.
-
- // #106871# Not when nWhich
- // Would have been better to offer a separate method for format/standard...
- if ( !nWhich )
- {
- SfxItemSet aAttribs( GetParaAttribs( nNode ) );
- for ( sal_uInt16 nW = EE_CHAR_START; nW <= EE_CHAR_END; nW++ )
- aAttribs.ClearItem( nW );
- SetParaAttribs( nNode, aAttribs );
- }
- }
-
- if ( bChanged && !bRemoveParaAttribs )
- {
- bFormatted = sal_False;
- pPortion->MarkSelectionInvalid( nStartPos, nEndPos-nStartPos );
- }
- }
-}
-
-typedef EditCharAttrib* EditCharAttribPtr;
-
-void ImpEditEngine::RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich, sal_Bool bRemoveFeatures )
-{
- ContentNode* pNode = aEditDoc.SaveGetObject( nPara );
- ParaPortion* pPortion = GetParaPortions().SaveGetObject( nPara );
-
- DBG_ASSERT( pNode, "Node not found: RemoveCharAttribs" );
- DBG_ASSERT( pPortion, "Portion not found: RemoveCharAttribs" );
-
- if ( !pNode )
- return;
-
- sal_uInt16 nAttr = 0;
- EditCharAttribPtr pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- while ( pAttr )
- {
- if ( ( !pAttr->IsFeature() || bRemoveFeatures ) &&
- ( !nWhich || ( pAttr->GetItem()->Which() == nWhich ) ) )
- {
- pNode->GetCharAttribs().GetAttribs().Remove( nAttr );
- delete pAttr;
- nAttr--;
- }
- nAttr++;
- pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
- }
-
- pPortion->MarkSelectionInvalid( 0, pNode->Len() );
-}
-
-void ImpEditEngine::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
-{
- ContentNode* pNode = aEditDoc.SaveGetObject( nPara );
-
- if ( !pNode )
- return;
-
- if ( !( pNode->GetContentAttribs().GetItems() == rSet ) )
- {
- if ( IsUndoEnabled() && !IsInUndo() && aStatus.DoUndoAttribs() )
- {
- if ( rSet.GetPool() != &aEditDoc.GetItemPool() )
- {
- SfxItemSet aTmpSet( GetEmptyItemSet() );
- aTmpSet.Put( rSet );
- InsertUndo( new EditUndoSetParaAttribs( this, nPara, pNode->GetContentAttribs().GetItems(), aTmpSet ) );
- }
- else
- {
- InsertUndo( new EditUndoSetParaAttribs( this, nPara, pNode->GetContentAttribs().GetItems(), rSet ) );
- }
- }
- pNode->GetContentAttribs().GetItems().Set( rSet );
- if ( aStatus.UseCharAttribs() )
- pNode->CreateDefFont();
-
- ParaAttribsChanged( pNode );
- }
-}
-
-const SfxItemSet& ImpEditEngine::GetParaAttribs( sal_uInt16 nPara ) const
-{
- ContentNode* pNode = aEditDoc.GetObject( nPara );
- 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 not found: HasParaAttrib" );
-
- return pNode->GetContentAttribs().HasItem( nWhich );
-}
-
-const SfxPoolItem& ImpEditEngine::GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const
-{
- ContentNode* pNode = aEditDoc.GetObject( nPara );
- DBG_ASSERT( pNode, "Node not found: GetParaAttrib" );
-
- return pNode->GetContentAttribs().GetItem( nWhich );
-}
-
-void ImpEditEngine::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const
-{
- rLst.Remove( 0, rLst.Count() );
- ContentNode* pNode = aEditDoc.GetObject( nPara );
- if ( pNode )
- {
- for ( sal_uInt16 nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ )
- {
- EditCharAttribPtr pAttr = pNode->GetCharAttribs().GetAttribs()[ nAttr ];
- EECharAttrib aEEAttr;
- aEEAttr.pAttr = pAttr->GetItem();
- aEEAttr.nPara = nPara;
- aEEAttr.nStart = pAttr->GetStart();
- aEEAttr.nEnd = pAttr->GetEnd();
- rLst.Insert( aEEAttr, rLst.Count() );
- }
- }
-}
-
-void ImpEditEngine::ParaAttribsToCharAttribs( ContentNode* pNode )
-{
- pNode->GetCharAttribs().DeleteEmptyAttribs( GetEditDoc().GetItemPool() );
- xub_StrLen nEndPos = pNode->Len();
- for ( sal_uInt16 nWhich = EE_CHAR_START; nWhich <= EE_CHAR_END; nWhich++ )
- {
- if ( pNode->GetContentAttribs().HasItem( nWhich ) )
- {
- const SfxPoolItem& rItem = pNode->GetContentAttribs().GetItem( nWhich );
- // Fill the gap:
- sal_uInt16 nLastEnd = 0;
- EditCharAttrib* pAttr = pNode->GetCharAttribs().FindNextAttrib( nWhich, nLastEnd );
- while ( pAttr )
- {
- nLastEnd = pAttr->GetEnd();
- if ( pAttr->GetStart() > nLastEnd )
- aEditDoc.InsertAttrib( pNode, nLastEnd, pAttr->GetStart(), rItem );
- // #112831# Last Attr might go from 0xffff to 0x0000
- pAttr = nLastEnd ? pNode->GetCharAttribs().FindNextAttrib( nWhich, nLastEnd ) : NULL;
- }
-
- // And the Rest:
- if ( nLastEnd < nEndPos )
- aEditDoc.InsertAttrib( pNode, nLastEnd, nEndPos, rItem );
- }
- }
- bFormatted = sal_False;
- // Portion does not need to be invalidated here, happens elsewhere.
-}
-
-IdleFormattter::IdleFormattter()
-{
- pView = 0;
- nRestarts = 0;
-}
-
-IdleFormattter::~IdleFormattter()
-{
- pView = 0;
-}
-
-void IdleFormattter::DoIdleFormat( EditView* pV )
-{
- pView = pV;
-
- if ( IsActive() )
- nRestarts++;
-
- if ( nRestarts > 4 )
- ForceTimeout();
- else
- Start();
-}
-
-void IdleFormattter::ForceTimeout()
-{
- if ( IsActive() )
- {
- Stop();
- ((Link&)GetTimeoutHdl()).Call( this );
- }
-}
-
-ImplIMEInfos::ImplIMEInfos( const EditPaM& rPos, const String& rOldTextAfterStartPos )
- : aOldTextAfterStartPos( rOldTextAfterStartPos )
-{
- aPos = rPos;
- nLen = 0;
- bCursor = sal_True;
- pAttribs = NULL;
- bWasCursorOverwrite = sal_False;
-}
-
-ImplIMEInfos::~ImplIMEInfos()
-{
- delete[] pAttribs;
-}
-
-void ImplIMEInfos::CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL )
-{
- nLen = nL;
- delete[] pAttribs;
- pAttribs = new sal_uInt16[ nL ];
- memcpy( pAttribs, pA, nL*sizeof(sal_uInt16) );
-}
-
-void ImplIMEInfos::DestroyAttribs()
-{
- delete[] pAttribs;
- 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
deleted file mode 100644
index 838ad50246..0000000000
--- a/editeng/source/editeng/makefile.mk
+++ /dev/null
@@ -1,71 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..$/..
-
-PRJNAME=editeng
-TARGET=editeng
-AUTOSEG=true
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/makefile.pmk
-
-# --- General ----------------------------------------------------------
-
-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
deleted file mode 100644
index b7d6a8c421..0000000000
--- a/editeng/source/editeng/textconv.cxx
+++ /dev/null
@@ -1,602 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
-
-#include <impedit.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/unolingu.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-#include <editeng/langitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <textconv.hxx>
-
-
-using ::rtl::OUString;
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::linguistic2;
-
-#define C2U(cChar) OUString::createFromAscii(cChar)
-
-//////////////////////////////////////////////////////////////////////
-
-TextConvWrapper::TextConvWrapper( Window* pWindow,
- const Reference< XMultiServiceFactory >& rxMSF,
- const Locale& rSourceLocale,
- const Locale& rTargetLocale,
- const Font* pTargetFont,
- sal_Int32 nOptions,
- sal_Bool bIsInteractive,
- sal_Bool bIsStart,
- EditView* pView ) :
- HangulHanjaConversion( pWindow, rxMSF, rSourceLocale, rTargetLocale, pTargetFont, nOptions, bIsInteractive )
-{
- DBG_ASSERT( pWindow, "TextConvWrapper: window missing" );
-
- nConvTextLang = LANGUAGE_NONE;
- nUnitOffset = 0;
-
- bStartChk = sal_False;
- bStartDone = bIsStart;
- bEndDone = sal_False;
- pWin = pWindow;
- pEditView = pView;
-
- aConvSel = pEditView->GetSelection();
- aConvSel.Adjust(); // make Start <= End
-
- bAllowChange = sal_False;
-}
-
-
-TextConvWrapper::~TextConvWrapper()
-{
-}
-
-
-sal_Bool TextConvWrapper::ConvNext_impl()
-{
- // modified version of SvxSpellWrapper::SpellNext
-
- if( bStartChk )
- bStartDone = sal_True;
- else
- bEndDone = sal_True;
-
- if ( bStartDone && bEndDone )
- {
- if ( ConvMore_impl() ) // examine another document?
- {
- bStartDone = sal_True;
- bEndDone = sal_False;
- ConvStart_impl( SVX_SPELL_BODY );
- return sal_True;
- }
- return sal_False;
-
- }
-
- sal_Bool bGoOn = sal_False;
-
- if ( bStartDone && bEndDone )
- {
- if ( ConvMore_impl() ) // examine another document?
- {
- bStartDone = sal_True;
- bEndDone = sal_False;
- ConvStart_impl( SVX_SPELL_BODY );
- return sal_True;
- }
- }
- else if (!aConvSel.HasRange())
- {
- bStartChk = !bStartDone;
- ConvStart_impl( bStartChk ? SVX_SPELL_BODY_START : SVX_SPELL_BODY_END );
- bGoOn = sal_True;
- }
- return bGoOn;
-}
-
-
-sal_Bool TextConvWrapper::FindConvText_impl()
-{
- // modified version of SvxSpellWrapper::FindSpellError
-
- sal_Bool bFound = sal_False;
-
- pWin->EnterWait();
- sal_Bool bConvert = sal_True;
-
- while ( bConvert )
- {
- bFound = ConvContinue_impl();
- if (bFound)
- {
- bConvert = sal_False;
- }
- else
- {
- ConvEnd_impl();
- bConvert = ConvNext_impl();
- }
- }
- pWin->LeaveWait();
- return bFound;
-}
-
-
-sal_Bool TextConvWrapper::ConvMore_impl()
-{
- // modified version of SvxSpellWrapper::SpellMore
-
- sal_Bool bMore = sal_False;
- ImpEditEngine* pImpEE = pEditView->GetImpEditEngine();
- ConvInfo* pConvInfo = pImpEE->GetConvInfo();
- if ( pConvInfo->bMultipleDoc )
- {
- bMore = pImpEE->GetEditEnginePtr()->ConvertNextDocument();
- if ( bMore )
- {
- // The text has been entered in this engine ...
- pEditView->GetImpEditView()->SetEditSelection(
- pImpEE->GetEditDoc().GetStartPaM() );
- }
- }
- return bMore;
-}
-
-
-void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea )
-{
- // modified version of EditSpellWrapper::SpellStart
-
- ImpEditEngine* pImpEE = pEditView->GetImpEditEngine();
- ConvInfo* pConvInfo = pImpEE->GetConvInfo();
-
- if ( eArea == SVX_SPELL_BODY_START )
- {
- // Is called when Spell-forward has reached the end, and to start over
- if ( bEndDone )
- {
- pConvInfo->bConvToEnd = sal_False;
- pConvInfo->aConvTo = pConvInfo->aConvStart;
- pConvInfo->aConvContinue = EPaM( 0, 0 );
- pEditView->GetImpEditView()->SetEditSelection(
- pImpEE->GetEditDoc().GetStartPaM() );
- }
- else
- {
- pConvInfo->bConvToEnd = sal_True;
- pConvInfo->aConvTo = pImpEE->CreateEPaM(
- pImpEE->GetEditDoc().GetStartPaM() );
- }
- }
- else if ( eArea == SVX_SPELL_BODY_END )
- {
- // Is called when Spell-forward starts
- pConvInfo->bConvToEnd = sal_True;
- if (aConvSel.HasRange())
- {
- // user selection: convert to end of selection
- pConvInfo->aConvTo.nPara = aConvSel.nEndPara;
- pConvInfo->aConvTo.nIndex = aConvSel.nEndPos;
- pConvInfo->bConvToEnd = sal_False;
- }
- else
- {
- // nothing selected: convert to end of document
- pConvInfo->aConvTo = pImpEE->CreateEPaM(
- pImpEE->GetEditDoc().GetEndPaM() );
- }
- }
- else if ( eArea == SVX_SPELL_BODY )
- {
- // called by ConvNext_impl...
- pConvInfo->aConvContinue = pConvInfo->aConvStart;
- pConvInfo->aConvTo = pImpEE->CreateEPaM(
- pImpEE->GetEditDoc().GetEndPaM() );
- }
- else
- {
- OSL_FAIL( "ConvStart_impl: Unknown Area!" );
- }
-}
-
-
-void TextConvWrapper::ConvEnd_impl()
-{
-}
-
-
-sal_Bool TextConvWrapper::ConvContinue_impl()
-{
- // modified version of EditSpellWrapper::SpellContinue
-
- // get next convertible text portion and its language
- aConvText = rtl::OUString();
- nConvTextLang = LANGUAGE_NONE;
- pEditView->GetImpEditEngine()->ImpConvert( aConvText, nConvTextLang,
- pEditView, GetSourceLanguage(), aConvSel,
- bAllowChange, GetTargetLanguage(), GetTargetFont() );
- return aConvText.getLength() != 0;
-}
-
-
-void TextConvWrapper::SetLanguageAndFont( const ESelection &rESel,
- LanguageType nLang, sal_uInt16 nLangWhichId,
- const Font *pFont, sal_uInt16 nFontWhichId )
-{
- ESelection aOldSel = pEditView->GetSelection();
- pEditView->SetSelection( rESel );
-
- // set new language attribute
- SfxItemSet aNewSet( pEditView->GetEmptyItemSet() );
- aNewSet.Put( SvxLanguageItem( nLang, nLangWhichId ) );
-
- // new font to be set?
- DBG_ASSERT( pFont, "target font missing?" );
- if (pFont)
- {
- // set new font attribute
- SvxFontItem aFontItem = (SvxFontItem&) aNewSet.Get( nFontWhichId );
- aFontItem.SetFamilyName( pFont->GetName());
- aFontItem.SetFamily( pFont->GetFamily());
- aFontItem.SetStyleName( pFont->GetStyleName());
- aFontItem.SetPitch( pFont->GetPitch());
- aFontItem.SetCharSet(pFont->GetCharSet());
- aNewSet.Put( aFontItem );
- }
-
- // apply new attributes
- pEditView->SetAttribs( aNewSet );
-
- pEditView->SetSelection( aOldSel );
-}
-
-
-void TextConvWrapper::SelectNewUnit_impl(
- const sal_Int32 nUnitStart,
- const sal_Int32 nUnitEnd )
-{
- sal_Bool bOK = 0 <= nUnitStart && 0 <= nUnitEnd && nUnitStart <= nUnitEnd;
- DBG_ASSERT( bOK, "invalid arguments" );
- if (!bOK)
- return;
-
- ESelection aSelection = pEditView->GetSelection();
- DBG_ASSERT( aSelection.nStartPara == aSelection.nEndPara,
- "paragraph mismatch in selection" );
- aSelection.nStartPos = (sal_uInt16) (nLastPos + nUnitOffset + nUnitStart);
- aSelection.nEndPos = (sal_uInt16) (nLastPos + nUnitOffset + nUnitEnd);
- pEditView->SetSelection( aSelection );
-}
-
-
-void TextConvWrapper::GetNextPortion(
- ::rtl::OUString& /* [out] */ rNextPortion,
- LanguageType& /* [out] */ rLangOfPortion,
- sal_Bool /* [in] */ _bAllowImplicitChangesForNotConvertibleText )
-{
- bAllowChange = _bAllowImplicitChangesForNotConvertibleText;
-
- FindConvText_impl();
- rNextPortion = aConvText;
- rLangOfPortion = nConvTextLang;
- nUnitOffset = 0;
-
- ESelection aSelection = pEditView->GetSelection();
- DBG_ASSERT( aSelection.nStartPara == aSelection.nEndPara,
- "paragraph mismatch in selection" );
- DBG_ASSERT( aSelection.nStartPos <= aSelection.nEndPos,
- "start pos > end pos" );
- nLastPos = aSelection.nStartPos;
-}
-
-
-void TextConvWrapper::HandleNewUnit(
- const sal_Int32 nUnitStart,
- const sal_Int32 nUnitEnd )
-{
- SelectNewUnit_impl( nUnitStart, nUnitEnd );
-}
-
-
-void TextConvWrapper::ReplaceUnit(
- const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd,
- const ::rtl::OUString& rOrigText,
- const ::rtl::OUString& rReplaceWith,
- const ::com::sun::star::uno::Sequence< sal_Int32 > &rOffsets,
- ReplacementAction eAction,
- LanguageType *pNewUnitLanguage )
-{
- sal_Bool bOK = 0 <= nUnitStart && 0 <= nUnitEnd && nUnitStart <= nUnitEnd;
- DBG_ASSERT( bOK, "invalid arguments" );
- if (!bOK)
- return;
-
- static OUString aBracketedStart( C2U( "(" ) );
- static OUString aBracketedEnd( C2U( ")" ) );
-
- // select current unit
- SelectNewUnit_impl( nUnitStart, nUnitEnd );
-
- OUString aOrigTxt( pEditView->GetSelected() );
- OUString aNewTxt( rReplaceWith );
- String aNewOrigText;
- switch (eAction)
- {
- case eExchange :
- break;
- case eReplacementBracketed :
- (((aNewTxt = aOrigTxt) += aBracketedStart) += rReplaceWith) += aBracketedEnd;
- break;
- case eOriginalBracketed :
- (((aNewTxt = rReplaceWith) += aBracketedStart) += aOrigTxt) += aBracketedEnd;
- break;
- case eReplacementAbove :
- case eOriginalAbove :
- case eReplacementBelow :
- case eOriginalBelow :
- OSL_FAIL( "Rubies not supported" );
- break;
- default:
- OSL_FAIL( "unexpected case" );
- }
- nUnitOffset = sal::static_int_cast< sal_uInt16 >(
- nUnitOffset + nUnitStart + aNewTxt.getLength());
-
- // remember current original language for kater use
- ImpEditEngine *pImpEditEng = pEditView->GetImpEditEngine();
- ESelection _aOldSel = pEditView->GetSelection();
- //EditSelection aOldEditSel = pEditView->GetImpEditView()->GetEditSelection();
-
-#ifdef DBG_UTIL
- LanguageType nOldLang = pImpEditEng->GetLanguage( pImpEditEng->CreateSel( _aOldSel ).Min() );
-#endif
-
- pImpEditEng->UndoActionStart( EDITUNDO_INSERT );
-
- // according to FT we should currently not bother about keeping
- // attributes in Hangul/Hanja conversion and leave that untouched.
- // Thus we do this only for Chinese translation...
- sal_Bool bIsChineseConversion = IsChinese( GetSourceLanguage() );
- if (bIsChineseConversion)
- ChangeText( aNewTxt, rOrigText, &rOffsets, &_aOldSel );
- else
- ChangeText( aNewTxt, rOrigText, NULL, NULL );
-
- // change language and font if necessary
- if (bIsChineseConversion)
- {
- DBG_ASSERT( GetTargetLanguage() == LANGUAGE_CHINESE_SIMPLIFIED || GetTargetLanguage() == LANGUAGE_CHINESE_TRADITIONAL,
- "TextConvWrapper::ReplaceUnit : unexpected target language" );
-
- ESelection aOldSel = pEditView->GetSelection();
- ESelection aNewSel( aOldSel );
- aNewSel.nStartPos = sal::static_int_cast< xub_StrLen >(
- aNewSel.nStartPos - aNewTxt.getLength());
-
- if (pNewUnitLanguage)
- {
- DBG_ASSERT(!IsSimilarChinese( *pNewUnitLanguage, nOldLang ),
- "similar language should not be changed!");
- SetLanguageAndFont( aNewSel, *pNewUnitLanguage, EE_CHAR_LANGUAGE_CJK,
- GetTargetFont(), EE_CHAR_FONTINFO_CJK );
- }
- }
-
- pImpEditEng->UndoActionEnd( EDITUNDO_INSERT );
-
- // adjust ConvContinue / ConvTo if necessary
- ImpEditEngine* pImpEE = pEditView->GetImpEditEngine();
- ConvInfo* pConvInfo = pImpEE->GetConvInfo();
- sal_Int32 nDelta = aNewTxt.getLength() - aOrigTxt.getLength();
- if (nDelta != 0)
- {
- // Note: replacement is always done in the current paragraph
- // which is the one ConvContinue points to
- pConvInfo->aConvContinue.nIndex = sal::static_int_cast< sal_uInt16 >(
- pConvInfo->aConvContinue.nIndex + nDelta);
-
- // if that is the same as the one where the conversions ends
- // the end needs to be updated also
- if (pConvInfo->aConvTo.nPara == pConvInfo->aConvContinue.nPara)
- pConvInfo->aConvTo.nIndex = sal::static_int_cast< sal_uInt16 >(
- pConvInfo->aConvTo.nIndex + nDelta);
- }
-}
-
-
-void TextConvWrapper::ChangeText( const String &rNewText,
- const OUString& rOrigText,
- const uno::Sequence< sal_Int32 > *pOffsets,
- ESelection *pESelection )
-{
- //!! code is a modifed copy of SwHHCWrapper::ChangeText from sw !!
-
- DBG_ASSERT( rNewText.Len() != 0, "unexpected empty string" );
- if (rNewText.Len() == 0)
- return;
-
- if (pOffsets && pESelection) // try to keep as much attributation as possible ?
- {
- pESelection->Adjust();
-
- // remember cursor start position for later setting of the cursor
- const xub_StrLen nStartIndex = pESelection->nStartPos;
-
- const sal_Int32 nIndices = pOffsets->getLength();
- const sal_Int32 *pIndices = pOffsets->getConstArray();
- xub_StrLen nConvTextLen = rNewText.Len();
- xub_StrLen nPos = 0;
- xub_StrLen nChgPos = STRING_NOTFOUND;
- xub_StrLen nChgLen = 0;
- xub_StrLen nConvChgPos = STRING_NOTFOUND;
- xub_StrLen nConvChgLen = 0;
-
- // offset to calculate the position in the text taking into
- // account that text may have been replaced with new text of
- // different length. Negative values allowed!
- long nCorrectionOffset = 0;
-
- DBG_ASSERT(nIndices == 0 || nIndices == nConvTextLen,
- "mismatch between string length and sequence length!" );
-
- // find all substrings that need to be replaced (and only those)
- while (sal_True)
- {
- // get index in original text that matches nPos in new text
- xub_StrLen nIndex;
- if (nPos < nConvTextLen)
- nIndex = (sal_Int32) nPos < nIndices ? (xub_StrLen) pIndices[nPos] : nPos;
- else
- {
- nPos = nConvTextLen;
- nIndex = static_cast< xub_StrLen >( rOrigText.getLength() );
- }
-
- if (rOrigText.getStr()[nIndex] == rNewText.GetChar(nPos) ||
- nPos == nConvTextLen /* end of string also terminates non-matching char sequence */)
- {
- // substring that needs to be replaced found?
- if (nChgPos != STRING_NOTFOUND && nConvChgPos != STRING_NOTFOUND)
- {
- nChgLen = nIndex - nChgPos;
- nConvChgLen = nPos - nConvChgPos;
-#ifdef DEBUG
- String aInOrig( rOrigText.copy( nChgPos, nChgLen ) );
-#endif
- String aInNew( rNewText.Copy( nConvChgPos, nConvChgLen ) );
-
- // set selection to sub string to be replaced in original text
- ESelection aSel( *pESelection );
- xub_StrLen nChgInNodeStartIndex = static_cast< xub_StrLen >( nStartIndex + nCorrectionOffset + nChgPos );
- aSel.nStartPos = nChgInNodeStartIndex;
- aSel.nEndPos = nChgInNodeStartIndex + nChgLen;
- pEditView->SetSelection( aSel );
-#ifdef DEBUG
- String aSelTxt1( pEditView->GetSelected() );
-#endif
-
- // replace selected sub string with the corresponding
- // sub string from the new text while keeping as
- // much from the attributes as possible
- ChangeText_impl( aInNew, sal_True );
-
- nCorrectionOffset += nConvChgLen - nChgLen;
-
- nChgPos = STRING_NOTFOUND;
- nConvChgPos = STRING_NOTFOUND;
- }
- }
- else
- {
- // begin of non-matching char sequence found ?
- if (nChgPos == STRING_NOTFOUND && nConvChgPos == STRING_NOTFOUND)
- {
- nChgPos = nIndex;
- nConvChgPos = nPos;
- }
- }
- if (nPos >= nConvTextLen)
- break;
- ++nPos;
- }
-
- // set cursor to the end of the inserted text
- // (as it would happen after ChangeText_impl (Delete and Insert)
- // of the whole text in the 'else' branch below)
- pESelection->nStartPos = pESelection->nEndPos = nStartIndex + nConvTextLen;
- }
- else
- {
- ChangeText_impl( rNewText, sal_False );
- }
-}
-
-
-void TextConvWrapper::ChangeText_impl( const String &rNewText, sal_Bool bKeepAttributes )
-{
- if (bKeepAttributes)
- {
- // save attributes to be restored
- SfxItemSet aSet( pEditView->GetAttribs() );
-
-#ifdef DEBUG
- String aSelTxt1( pEditView->GetSelected() );
-#endif
- // replace old text and select new text
- pEditView->InsertText( rNewText, sal_True );
-#ifdef DEBUG
- String aSelTxt2( pEditView->GetSelected() );
-#endif
-
- // since 'SetAttribs' below function like merging with the attributes
- // from the itemset with any existing ones we have to get rid of all
- // all attributes now. (Those attributes that may take effect left
- // to the position where the new text gets inserted after the old text
- // was deleted)
- pEditView->RemoveAttribs();
- // apply saved attributes to new inserted text
- pEditView->SetAttribs( aSet );
- }
- else
- {
- pEditView->InsertText( rNewText );
- }
-}
-
-
-void TextConvWrapper::Convert()
-{
- bStartChk = sal_False;
- ConvStart_impl( SVX_SPELL_BODY_END );
- ConvertDocument();
- ConvEnd_impl();
-}
-
-
-sal_Bool TextConvWrapper::HasRubySupport() const
-{
- return sal_False;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/textconv.hxx b/editeng/source/editeng/textconv.hxx
deleted file mode 100644
index 3323e53035..0000000000
--- a/editeng/source/editeng/textconv.hxx
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _TEXTCONV_HXX
-#define _TEXTCONV_HXX
-
-#include <editeng/splwrap.hxx>
-#include <editeng/svxacorr.hxx>
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <editeng/hangulhanja.hxx>
-
-class EditView;
-class ImpEditEngine;
-class ContentNode;
-
-class TextConvWrapper : public editeng::HangulHanjaConversion
-{
- rtl::OUString aConvText; // convertible text part found last time
- LanguageType nConvTextLang; // language of aConvText
- sal_uInt16 nLastPos; // starting position of the last found text portion (word)
- sal_uInt16 nUnitOffset; // offset of current unit in the current text portion (word)
-
- ESelection aConvSel; // selection to be converted if
- // 'HasRange' is true, other conversion
- // starts from the cursor position
-
- EditView * pEditView;
- Window * pWin;
-
- sal_Bool bStartChk;
- sal_Bool bStartDone;
- sal_Bool bEndDone;
- sal_Bool bAllowChange; // storage for _bAllowImplicitChangesForNotConvertibleText
- // paramters value of function GetNextPortion.
- // used to transport the value to where it is needed.
-
-
- // from SvxSpellWrapper copied and modified
- sal_Bool ConvNext_impl(); // former SpellNext
- sal_Bool FindConvText_impl(); // former FindSpellError
- sal_Bool ConvMore_impl(); // former SpellMore
-
- // from EditSpellWrapper copied and modified
- void ConvStart_impl( SvxSpellArea eSpell ); // former SpellStart
- void ConvEnd_impl(); // former SpellEnd
- sal_Bool ConvContinue_impl(); // former SpellContinue
-
- void SelectNewUnit_impl( const sal_Int32 nUnitStart,
- const sal_Int32 nUnitEnd );
-
- void ChangeText( const String &rNewText,
- const ::rtl::OUString& rOrigText,
- const ::com::sun::star::uno::Sequence< sal_Int32 > *pOffsets,
- ESelection *pESelection );
- void ChangeText_impl( const String &rNewText, sal_Bool bKeepAttributes );
-
- // Forbidden and not implemented.
- TextConvWrapper (const TextConvWrapper &);
- TextConvWrapper & operator= (const TextConvWrapper &);
-
-protected:
- virtual void GetNextPortion( ::rtl::OUString& /* [out] */ rNextPortion,
- LanguageType& /* [out] */ rLangOfPortion,
- sal_Bool /* [in] */ _bAllowImplicitChangesForNotConvertibleText );
- virtual void HandleNewUnit( const sal_Int32 nUnitStart,
- const sal_Int32 nUnitEnd );
- virtual void ReplaceUnit(
- const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd,
- const ::rtl::OUString& rOrigText,
- const ::rtl::OUString& rReplaceWith,
- const ::com::sun::star::uno::Sequence< sal_Int32 > &rOffsets,
- ReplacementAction eAction,
- LanguageType *pNewUnitLanguage );
-
- virtual sal_Bool HasRubySupport() const;
-
- void SetLanguageAndFont( const ESelection &rESel,
- LanguageType nLang, sal_uInt16 nLangWhichId,
- const Font *pFont, sal_uInt16 nFontWhichId );
-
-
-public:
- TextConvWrapper( Window* pWindow,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF,
- const ::com::sun::star::lang::Locale& rSourceLocale,
- const ::com::sun::star::lang::Locale& rTargetLocale,
- const Font* pTargetFont,
- sal_Int32 nOptions,
- sal_Bool bIsInteractive,
- sal_Bool bIsStart, EditView* pView );
-
- virtual ~TextConvWrapper();
-
- void Convert();
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
deleted file mode 100644
index de24284b92..0000000000
--- a/editeng/source/items/borderline.cxx
+++ /dev/null
@@ -1,495 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// 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
deleted file mode 100644
index 6caea23c4e..0000000000
--- a/editeng/source/items/bulitem.cxx
+++ /dev/null
@@ -1,532 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-// include ---------------------------------------------------------------
-#include <tools/stream.hxx>
-#include <vcl/outdev.hxx>
-
-#define _SVX_BULITEM_CXX
-
-#include <editeng/bulitem.hxx>
-#include <editeng/editrids.hrc>
-
-#include <tools/tenccvt.hxx>
-
-#define BULITEM_VERSION ((sal_uInt16)2)
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1(SvxBulletItem,SfxPoolItem);
-
-// -----------------------------------------------------------------------
-
-void SvxBulletItem::StoreFont( SvStream& rStream, const Font& rFont )
-{
- sal_uInt16 nTemp;
-
- rStream << rFont.GetColor();
- nTemp = (sal_uInt16)rFont.GetFamily(); rStream << nTemp;
-
- nTemp = (sal_uInt16)GetSOStoreTextEncoding((rtl_TextEncoding)rFont.GetCharSet(), (sal_uInt16)rStream.GetVersion());
- rStream << nTemp;
-
- nTemp = (sal_uInt16)rFont.GetPitch(); rStream << nTemp;
- nTemp = (sal_uInt16)rFont.GetAlign(); rStream << nTemp;
- nTemp = (sal_uInt16)rFont.GetWeight(); rStream << nTemp;
- nTemp = (sal_uInt16)rFont.GetUnderline(); rStream << nTemp;
- nTemp = (sal_uInt16)rFont.GetStrikeout(); rStream << nTemp;
- nTemp = (sal_uInt16)rFont.GetItalic(); rStream << nTemp;
-
- // UNICODE: rStream << rFont.GetName();
- rStream.WriteByteString(rFont.GetName());
-
- rStream << rFont.IsOutline();
- rStream << rFont.IsShadow();
- rStream << rFont.IsTransparent();
-}
-
-// -----------------------------------------------------------------------
-
-Font SvxBulletItem::CreateFont( SvStream& rStream, sal_uInt16 nVer )
-{
- Font aFont;
- Color aColor;
- rStream >> aColor; aFont.SetColor( aColor );
- sal_uInt16 nTemp;
- rStream >> nTemp; aFont.SetFamily((FontFamily)nTemp);
-
- rStream >> nTemp;
- nTemp = (sal_uInt16)GetSOLoadTextEncoding((rtl_TextEncoding)nTemp, (sal_uInt16)rStream.GetVersion());
- aFont.SetCharSet((rtl_TextEncoding)nTemp);
-
- rStream >> nTemp; aFont.SetPitch((FontPitch)nTemp);
- rStream >> nTemp; aFont.SetAlign((FontAlign)nTemp);
- rStream >> nTemp; aFont.SetWeight((FontWeight)nTemp);
- rStream >> nTemp; aFont.SetUnderline((FontUnderline)nTemp);
- rStream >> nTemp; aFont.SetStrikeout((FontStrikeout)nTemp);
- rStream >> nTemp; aFont.SetItalic((FontItalic)nTemp);
-
- // UNICODE: rStream >> aName; aFont.SetName( aName );
- String aName;
- rStream.ReadByteString(aName);
- aFont.SetName( aName );
-
- if( nVer == 1 )
- {
- long nHeight, nWidth;
- rStream >> nHeight; rStream >> nWidth; Size aSize( nWidth, nHeight );
- aFont.SetSize( aSize );
- }
-
- sal_Bool bTemp;
- rStream >> bTemp; aFont.SetOutline( bTemp );
- rStream >> bTemp; aFont.SetShadow( bTemp );
- rStream >> bTemp; aFont.SetTransparent( bTemp );
- return aFont;
-}
-
-
-// -----------------------------------------------------------------------
-
-SvxBulletItem::SvxBulletItem( sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
-{
- SetDefaultFont_Impl();
- SetDefaults_Impl();
- nValidMask = 0xFFFF;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBulletItem::SvxBulletItem( sal_uInt8 nNewStyle, const Font& rFont, sal_uInt16 /*nStart*/, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
-{
- SetDefaults_Impl();
- nStyle = nNewStyle;
- aFont = rFont;
- nValidMask = 0xFFFF;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBulletItem::SvxBulletItem( const Font& rFont, xub_Unicode cSymb, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
-{
- SetDefaults_Impl();
- aFont = rFont;
- cSymbol = cSymb;
- nStyle = BS_BULLET;
- nValidMask = 0xFFFF;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBulletItem::SvxBulletItem( const Bitmap& rBmp, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
-{
- SetDefaults_Impl();
-
- if( !rBmp.IsEmpty() )
- {
- pGraphicObject = new GraphicObject( rBmp );
- nStyle = BS_BMP;
- }
-
- nValidMask = 0xFFFF;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBulletItem::SvxBulletItem( const GraphicObject& rGraphicObject, sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
-{
- SetDefaults_Impl();
-
- if( ( GRAPHIC_NONE != pGraphicObject->GetType() ) && ( GRAPHIC_DEFAULT != pGraphicObject->GetType() ) )
- {
- pGraphicObject = new GraphicObject( rGraphicObject );
- nStyle = BS_BMP;
- }
-
- nValidMask = 0xFFFF;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) :
- SfxPoolItem( _nWhich ),
- pGraphicObject( NULL )
-{
- rStrm >> nStyle;
-
- if( nStyle != BS_BMP )
- aFont = CreateFont( rStrm, BULITEM_VERSION );
- else
- {
- // Safe Load with Test on empty Bitmap
- Bitmap aBmp;
- const sal_uInt32 nOldPos = rStrm.Tell();
- // Ignore Errorcode when reading Bitmap,
- // see comment in SvxBulletItem::Store()
- sal_Bool bOldError = rStrm.GetError() ? sal_True : sal_False;
- rStrm >> aBmp;
- if ( !bOldError && rStrm.GetError() )
- {
- rStrm.ResetError();
- }
-
- if( aBmp.IsEmpty() )
- {
- rStrm.Seek( nOldPos );
- nStyle = BS_NONE;
- }
- else
- pGraphicObject = new GraphicObject( aBmp );
- }
-
- rStrm >> nWidth;
- rStrm >> nStart;
- rStrm >> nJustify;
-
- char cTmpSymbol;
- rStrm >> cTmpSymbol;
- //convert single byte to unicode
- cSymbol = rtl::OUString(&cTmpSymbol, 1, aFont.GetCharSet()).toChar();
-
- rStrm >> nScale;
-
- // UNICODE: rStrm >> aPrevText;
- rStrm.ReadByteString(aPrevText);
-
- // UNICODE: rStrm >> aFollowText;
- rStrm.ReadByteString(aFollowText);
-
- nValidMask = 0xFFFF;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBulletItem::SvxBulletItem( const SvxBulletItem& rItem) : SfxPoolItem( rItem )
-{
- aFont = rItem.aFont;
- pGraphicObject = ( rItem.pGraphicObject ? new GraphicObject( *rItem.pGraphicObject ) : NULL );
- aPrevText = rItem.aPrevText;
- aFollowText = rItem.aFollowText;
- nStart = rItem.nStart;
- nStyle = rItem.nStyle;
- nWidth = rItem.nWidth;
- nScale = rItem.nScale;
- cSymbol = rItem.cSymbol;
- nJustify = rItem.nJustify;
- nValidMask = rItem.nValidMask;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBulletItem::~SvxBulletItem()
-{
- if( pGraphicObject )
- delete pGraphicObject;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxBulletItem::Clone( SfxItemPool * /*pPool*/ ) const
-{
- return new SvxBulletItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxBulletItem::Create( SvStream& rStrm, sal_uInt16 /*nVersion*/ ) const
-{
- return new SvxBulletItem( rStrm, Which() );
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBulletItem::SetDefaultFont_Impl()
-{
- aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, LANGUAGE_SYSTEM, 0 );
- aFont.SetAlign( ALIGN_BOTTOM);
- aFont.SetTransparent( sal_True );
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBulletItem::SetDefaults_Impl()
-{
- pGraphicObject = NULL;
- nWidth = 1200; // 1.2cm
- nStart = 1;
- nStyle = BS_123;
- nJustify = BJ_HLEFT | BJ_VCENTER;
- cSymbol = sal_Unicode(' ');
- nScale = 75;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxBulletItem::GetVersion( sal_uInt16 /*nVersion*/ ) const
-{
- return BULITEM_VERSION;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBulletItem::CopyValidProperties( const SvxBulletItem& rCopyFrom )
-{
- Font _aFont = GetFont();
- Font aNewFont = rCopyFrom.GetFont();
- if ( rCopyFrom.IsValid( VALID_FONTNAME ) )
- {
- _aFont.SetName( aNewFont.GetName() );
- _aFont.SetFamily( aNewFont.GetFamily() );
- _aFont.SetStyleName( aNewFont.GetStyleName() );
- }
- if ( rCopyFrom.IsValid( VALID_FONTCOLOR ) )
- _aFont.SetColor( aNewFont.GetColor() );
- if ( rCopyFrom.IsValid( VALID_SYMBOL ) )
- SetSymbol( rCopyFrom.GetSymbol() );
- if ( rCopyFrom.IsValid( VALID_BITMAP ) )
- SetGraphicObject( rCopyFrom.GetGraphicObject() );
- if ( rCopyFrom.IsValid( VALID_SCALE ) )
- SetScale( rCopyFrom.GetScale() );
- if ( rCopyFrom.IsValid( VALID_START ) )
- SetStart( rCopyFrom.GetStart() );
- if ( rCopyFrom.IsValid( VALID_STYLE ) )
- SetStyle( rCopyFrom.GetStyle() );
- if ( rCopyFrom.IsValid( VALID_PREVTEXT ) )
- SetPrevText( rCopyFrom.GetPrevText() );
- if ( rCopyFrom.IsValid( VALID_FOLLOWTEXT ) )
- SetFollowText( rCopyFrom.GetFollowText() );
-
- SetFont( _aFont );
-}
-
-
-// -----------------------------------------------------------------------
-
-int SvxBulletItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT(rItem.ISA(SvxBulletItem),"operator==Types not matching");
- const SvxBulletItem& rBullet = (const SvxBulletItem&)rItem;
- // 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 ||
- nJustify != rBullet.nJustify ||
- nWidth != rBullet.nWidth ||
- nStart != rBullet.nStart ||
- cSymbol != rBullet.cSymbol ||
- aPrevText != rBullet.aPrevText ||
- aFollowText != rBullet.aFollowText )
- return 0;
-
- if( ( nStyle != BS_BMP ) && ( aFont != rBullet.aFont ) )
- return 0;
-
- if( nStyle == BS_BMP )
- {
- if( ( pGraphicObject && !rBullet.pGraphicObject ) || ( !pGraphicObject && rBullet.pGraphicObject ) )
- return 0;
-
- if( ( pGraphicObject && rBullet.pGraphicObject ) &&
- ( ( *pGraphicObject != *rBullet.pGraphicObject ) ||
- ( pGraphicObject->GetPrefSize() != rBullet.pGraphicObject->GetPrefSize() ) ) )
- {
- return 0;
- }
- }
-
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
-{
- // Correction for empty bitmap
- if( ( nStyle == BS_BMP ) &&
- ( !pGraphicObject || ( GRAPHIC_NONE == pGraphicObject->GetType() ) || ( GRAPHIC_DEFAULT == pGraphicObject->GetType() ) ) )
- {
- if( pGraphicObject )
- {
- delete( const_cast< SvxBulletItem* >( this )->pGraphicObject );
- const_cast< SvxBulletItem* >( this )->pGraphicObject = NULL;
- }
-
- const_cast< SvxBulletItem* >( this )->nStyle = BS_NONE;
- }
-
- rStrm << nStyle;
-
- if( nStyle != BS_BMP )
- StoreFont( rStrm, aFont );
- else
- {
- sal_uLong _nStart = rStrm.Tell();
-
- // 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();
- if ( nBytes < sal_uLong(0xFF00*nFac) )
- rStrm << aBmp;
-
- sal_uLong nEnd = rStrm.Tell();
- // Item can not write with an overhead more than 64K or SfxMultiRecord
- // will crash. Then prefer to forego on the bitmap, it is only
- // important for the outliner and only for <= 5.0.
- // When reading, the stream-operator makes note of the bitmap and the
- // fact that there is none. This is now the case how it works with
- // large bitmap created from another file format, which do not occupy a
- // 64K chunk, but if a bitmap > 64K is used, the SvxNumBulletItem will
- // have problem loading it, but does not crash.
-
- if ( (nEnd-_nStart) > 0xFF00 )
- rStrm.Seek( _nStart );
- }
- rStrm << nWidth;
- rStrm << nStart;
- rStrm << nJustify;
- rStrm << (char)ByteString::ConvertFromUnicode( cSymbol, aFont.GetCharSet() );
- rStrm << nScale;
-
- // UNICODE: rStrm << aPrevText;
- rStrm.WriteByteString(aPrevText);
-
- // UNICODE: rStrm << aFollowText;
- rStrm.WriteByteString(aFollowText);
-
- return rStrm;
-}
-
-//------------------------------------------------------------------------
-
-XubString SvxBulletItem::GetFullText() const
-{
- XubString aStr( aPrevText );
- aStr += cSymbol;
- aStr += aFollowText;
- return aStr;
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxBulletItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
-) const
-{
- SfxItemPresentation eRet = SFX_ITEM_PRESENTATION_NONE;
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- eRet = SFX_ITEM_PRESENTATION_NONE;
- break;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = GetFullText();
- eRet = SFX_ITEM_PRESENTATION_COMPLETE;
- break;
- default: ; //prevent warning
- }
- return eRet;
-}
-
-//------------------------------------------------------------------------
-
-Bitmap SvxBulletItem::GetBitmap() const
-{
- if( pGraphicObject )
- return pGraphicObject->GetGraphic().GetBitmap();
- else
- {
- const Bitmap aDefaultBitmap;
- return aDefaultBitmap;
- }
-}
-
-//------------------------------------------------------------------------
-
-void SvxBulletItem::SetBitmap( const Bitmap& rBmp )
-{
- if( rBmp.IsEmpty() )
- {
- if( pGraphicObject )
- {
- delete pGraphicObject;
- pGraphicObject = NULL;
- }
- }
- else
- {
- delete pGraphicObject;
- pGraphicObject = new GraphicObject( rBmp );
-
- }
-}
-
-//------------------------------------------------------------------------
-
-const GraphicObject& SvxBulletItem::GetGraphicObject() const
-{
- if( pGraphicObject )
- return *pGraphicObject;
- else
- {
- static const GraphicObject aDefaultObject;
- return aDefaultObject;
- }
-}
-
-//------------------------------------------------------------------------
-
-void SvxBulletItem::SetGraphicObject( const GraphicObject& rGraphicObject )
-{
- if( ( GRAPHIC_NONE == rGraphicObject.GetType() ) || ( GRAPHIC_DEFAULT == rGraphicObject.GetType() ) )
- {
- if( pGraphicObject )
- {
- delete pGraphicObject;
- pGraphicObject = NULL;
- }
- }
- else
- {
- delete pGraphicObject;
- 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
deleted file mode 100644
index dad17e9c01..0000000000
--- a/editeng/source/items/charhiddenitem.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-
-#include <editeng/charhiddenitem.hxx>
-#include <editeng/editrids.hrc>
-#include <editeng/eerdll.hxx>
-
-TYPEINIT1_FACTORY(SvxCharHiddenItem, SfxBoolItem, new SvxCharHiddenItem(sal_False, 0));
-
-SvxCharHiddenItem::SvxCharHiddenItem( const sal_Bool bHidden, const sal_uInt16 nId ) :
- SfxBoolItem( nId, bHidden )
-{
-}
-
-SfxPoolItem* SvxCharHiddenItem::Clone( SfxItemPool * ) const
-{
- return new SvxCharHiddenItem( *this );
-}
-
-SfxItemPresentation SvxCharHiddenItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nId = RID_SVXITEMS_CHARHIDDEN_FALSE;
-
- if ( GetValue() )
- nId = RID_SVXITEMS_CHARHIDDEN_TRUE;
- rText = EE_RESSTR(nId);
- return ePres;
- }
- default: ; //prevent warning
- }
- 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
deleted file mode 100644
index d72f955ba2..0000000000
--- a/editeng/source/items/flditem.cxx
+++ /dev/null
@@ -1,1052 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <vcl/metaact.hxx>
-#include <svl/zforlist.hxx>
-#include <tools/urlobj.hxx>
-
-#define _SVX_FLDITEM_CXX
-#include <unotools/localfilehelper.hxx>
-
-#include <editeng/flditem.hxx>
-
-#include <editeng/measfld.hxx>
-
-#include <tools/tenccvt.hxx>
-
-#define FRAME_MARKER (sal_uInt32)0x21981357
-#define CHARSET_MARKER (FRAME_MARKER+1)
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1( SvxFieldItem, SfxPoolItem );
-
-SV_IMPL_PERSIST1( SvxFieldData, SvPersistBase );
-
-// -----------------------------------------------------------------------
-
-SvxFieldData::SvxFieldData()
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxFieldData::~SvxFieldData()
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxFieldData* SvxFieldData::Clone() const
-{
- return new SvxFieldData;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxFieldData::operator==( const SvxFieldData& rFld ) const
-{
- DBG_ASSERT( Type() == rFld.Type(), "==: Different Types" );
- (void)rFld;
- return sal_True; // Basic class is always the same.
-}
-
-// -----------------------------------------------------------------------
-
-void SvxFieldData::Load( SvPersistStream & /*rStm*/ )
-{
-}
-
-// -----------------------------------------------------------------------
-
-void SvxFieldData::Save( SvPersistStream & /*rStm*/ )
-{
-}
-
-
-MetaAction* SvxFieldData::createBeginComment() const
-{
- return new MetaCommentAction( "FIELD_SEQ_BEGIN" );
-}
-
-MetaAction* SvxFieldData::createEndComment() const
-{
- return new MetaCommentAction( "FIELD_SEQ_END" );
-}
-
-// -----------------------------------------------------------------------
-
-SvxFieldItem::SvxFieldItem( SvxFieldData* pFld, const sal_uInt16 nId ) :
- SfxPoolItem( nId )
-{
- pField = pFld; // belongs directly to the item
-}
-
-// -----------------------------------------------------------------------
-
-SvxFieldItem::SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId ) :
- SfxPoolItem( nId )
-{
- pField = rField.Clone();
-}
-
-// -----------------------------------------------------------------------
-
-SvxFieldItem::SvxFieldItem( const SvxFieldItem& rItem ) :
- SfxPoolItem ( rItem )
-{
- pField = rItem.GetField() ? rItem.GetField()->Clone() : 0;
-}
-
-// -----------------------------------------------------------------------
-
-SvxFieldItem::~SvxFieldItem()
-{
- delete pField;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFieldItem::Clone( SfxItemPool* ) const
-{
- return new SvxFieldItem(*this);
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFieldItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- SvxFieldData* pData = 0;
- SvPersistStream aPStrm( GetClassManager(), &rStrm );
- aPStrm >> pData;
-
- if( aPStrm.IsEof() )
- aPStrm.SetError( SVSTREAM_GENERALERROR );
-
- if ( aPStrm.GetError() == ERRCODE_IO_NOFACTORY )
- aPStrm.ResetError(); // Actually a code for that not all were read Attr ...
-
- return new SvxFieldItem( pData, Which() );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxFieldItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
-{
- DBG_ASSERT( pField, "SvxFieldItem::Store: Field?!" );
- SvPersistStream aPStrm( GetClassManager(), &rStrm );
- // 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 not enough, because not registered on ClassMgr.
- SvxURLField aDummyData;
- aPStrm << &aDummyData;
- }
- else
- aPStrm << pField;
-
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxFieldItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal which or type" );
-
- const SvxFieldData* pOtherFld = ((const SvxFieldItem&)rItem).GetField();
- if ( !pField && !pOtherFld )
- return sal_True;
-
- if ( ( !pField && pOtherFld ) || ( pField && !pOtherFld ) )
- return sal_False;
-
- return ( ( pField->Type() == pOtherFld->Type() )
- && ( *pField == *pOtherFld ) );
-}
-
-// =================================================================
-// The following are the derivatives of SvxFieldData ...
-// =================================================================
-
-SV_IMPL_PERSIST1( SvxDateField, SvxFieldData );
-
-// -----------------------------------------------------------------------
-
-SvxDateField::SvxDateField()
-{
- nFixDate = Date().GetDate();
- eType = SVXDATETYPE_VAR;
- eFormat = SVXDATEFORMAT_STDSMALL;
-}
-
-// -----------------------------------------------------------------------
-
-SvxDateField::SvxDateField( const Date& rDate, SvxDateType eT, SvxDateFormat eF )
-{
- nFixDate = rDate.GetDate();
- eType = eT;
- eFormat = eF;
-}
-
-// -----------------------------------------------------------------------
-
-SvxFieldData* SvxDateField::Clone() const
-{
- return new SvxDateField( *this );
-}
-
-// -----------------------------------------------------------------------
-
-int SvxDateField::operator==( const SvxFieldData& rOther ) const
-{
- if ( rOther.Type() != Type() )
- return sal_False;
-
- const SvxDateField& rOtherFld = (const SvxDateField&) rOther;
- return ( ( nFixDate == rOtherFld.nFixDate ) &&
- ( eType == rOtherFld.eType ) &&
- ( eFormat == rOtherFld.eFormat ) );
-}
-
-// -----------------------------------------------------------------------
-
-void SvxDateField::Load( SvPersistStream & rStm )
-{
- sal_uInt16 nType, nFormat;
-
- rStm >> nFixDate;
- rStm >> nType;
- rStm >> nFormat;
-
- eType = (SvxDateType)nType;
- eFormat= (SvxDateFormat)nFormat;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxDateField::Save( SvPersistStream & rStm )
-{
- rStm << nFixDate;
- rStm << (sal_uInt16)eType;
- rStm << (sal_uInt16)eFormat;
-}
-
-// -----------------------------------------------------------------------
-
-String SvxDateField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLang ) const
-{
- Date aDate; // current date
- if ( eType == SVXDATETYPE_FIX )
- aDate.SetDate( nFixDate );
-
- return GetFormatted( aDate, eFormat, rFormatter, eLang );
-}
-
-String SvxDateField::GetFormatted( Date& aDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLang )
-{
- if ( eFormat == SVXDATEFORMAT_SYSTEM )
- {
- OSL_FAIL( "SVXDATEFORMAT_SYSTEM not implemented!" );
- eFormat = SVXDATEFORMAT_STDSMALL;
- }
- else if ( eFormat == SVXDATEFORMAT_APPDEFAULT )
- {
- OSL_FAIL( "SVXDATEFORMAT_APPDEFAULT: take them from where? ");
- eFormat = SVXDATEFORMAT_STDSMALL;
- }
-
- sal_uLong nFormatKey;
-
- switch( eFormat )
- {
- case SVXDATEFORMAT_STDSMALL:
- // short
- nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYSTEM_SHORT, eLang );
- break;
- case SVXDATEFORMAT_STDBIG:
- // long
- nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYSTEM_LONG, eLang );
- break;
- case SVXDATEFORMAT_A:
- // 13.02.96
- nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_DDMMYY, eLang );
- break;
- case SVXDATEFORMAT_B:
- // 13.02.1996
- nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_DDMMYYYY, eLang );
- break;
- case SVXDATEFORMAT_C:
- // 13. Feb 1996
- nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_DMMMYYYY, eLang );
- break;
- case SVXDATEFORMAT_D:
- // 13. February 1996
- nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_DMMMMYYYY, eLang );
- break;
- case SVXDATEFORMAT_E:
- // The, 13. February 1996
- nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_NNDMMMMYYYY, eLang );
- break;
- case SVXDATEFORMAT_F:
- // Tuesday, 13. February 1996
- nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_NNNNDMMMMYYYY, eLang );
- break;
- default:
- nFormatKey = rFormatter.GetStandardFormat( NUMBERFORMAT_DATE, eLang );
- }
-
- double fDiffDate = aDate - *(rFormatter.GetNullDate());
- String aStr;
- Color* pColor = NULL;
- rFormatter.GetOutputString( fDiffDate, nFormatKey, aStr, &pColor );
- return aStr;
-}
-
-MetaAction* SvxDateField::createBeginComment() const
-{
- return new MetaCommentAction( "FIELD_SEQ_BEGIN" );
-}
-
-SV_IMPL_PERSIST1( SvxURLField, SvxFieldData );
-
-// -----------------------------------------------------------------------
-
-SvxURLField::SvxURLField()
-{
- eFormat = SVXURLFORMAT_URL;
-}
-
-// -----------------------------------------------------------------------
-
-SvxURLField::SvxURLField( const XubString& rURL, const XubString& rRepres, SvxURLFormat eFmt )
- : aURL( rURL ), aRepresentation( rRepres )
-{
- eFormat = eFmt;
-}
-
-// -----------------------------------------------------------------------
-
-SvxFieldData* SvxURLField::Clone() const
-{
- return new SvxURLField( *this );
-}
-
-// -----------------------------------------------------------------------
-
-int SvxURLField::operator==( const SvxFieldData& rOther ) const
-{
- if ( rOther.Type() != Type() )
- return sal_False;
-
- const SvxURLField& rOtherFld = (const SvxURLField&) rOther;
- return ( ( eFormat == rOtherFld.eFormat ) &&
- ( aURL == rOtherFld.aURL ) &&
- ( aRepresentation == rOtherFld.aRepresentation ) &&
- ( aTargetFrame == rOtherFld.aTargetFrame ) );
-}
-
-// -----------------------------------------------------------------------
-
-static void write_unicode( SvPersistStream & rStm, const String& rString )
-{
- sal_uInt16 nL = rString.Len();
- rStm << nL;
- rStm.Write( rString.GetBuffer(), nL*sizeof(sal_Unicode) );
-}
-
-static void read_unicode( SvPersistStream & rStm, String& rString )
-{
- sal_uInt16 nL = 0;
- rStm >> nL;
- if ( nL )
- {
- rString.AllocBuffer( nL );
- rStm.Read( rString.GetBufferAccess(), nL*sizeof(sal_Unicode) );
- rString.ReleaseBufferAccess( nL );
- }
-}
-
-void SvxURLField::Load( SvPersistStream & rStm )
-{
- sal_uInt16 nFormat = 0;
-
- rStm >> nFormat;
- eFormat= (SvxURLFormat)nFormat;
-
- read_unicode( rStm, aURL );
- read_unicode( rStm, aRepresentation );
- read_unicode( rStm, aTargetFrame );
-}
-
-// -----------------------------------------------------------------------
-
-void SvxURLField::Save( SvPersistStream & rStm )
-{
- rStm << (sal_uInt16)eFormat;
-
- write_unicode( rStm, aURL );
- write_unicode( rStm, aRepresentation );
- write_unicode( rStm, aTargetFrame );
-}
-
-MetaAction* SvxURLField::createBeginComment() const
-{
- // #i46618# Adding target URL to metafile comment
- return new MetaCommentAction( "FIELD_SEQ_BEGIN",
- 0,
- reinterpret_cast<const sal_uInt8*>(aURL.GetBuffer()),
- 2*aURL.Len() );
-}
-
-// =================================================================
-// The fields that were removed from Calc:
-// =================================================================
-
-SV_IMPL_PERSIST1( SvxPageField, SvxFieldData );
-
-SvxFieldData* SvxPageField::Clone() const
-{
- return new SvxPageField; // empty
-}
-
-int SvxPageField::operator==( const SvxFieldData& rCmp ) const
-{
- return ( rCmp.Type() == TYPE(SvxPageField) );
-}
-
-void SvxPageField::Load( SvPersistStream & /*rStm*/ )
-{
-}
-
-void SvxPageField::Save( SvPersistStream & /*rStm*/ )
-{
-}
-
-MetaAction* SvxPageField::createBeginComment() const
-{
- return new MetaCommentAction( "FIELD_SEQ_BEGIN;PageField" );
-}
-
-
-SV_IMPL_PERSIST1( SvxPagesField, SvxFieldData );
-
-SvxFieldData* SvxPagesField::Clone() const
-{
- return new SvxPagesField; // empty
-}
-
-int SvxPagesField::operator==( const SvxFieldData& rCmp ) const
-{
- return ( rCmp.Type() == TYPE(SvxPagesField) );
-}
-
-void SvxPagesField::Load( SvPersistStream & /*rStm*/ )
-{
-}
-
-void SvxPagesField::Save( SvPersistStream & /*rStm*/ )
-{
-}
-
-SV_IMPL_PERSIST1( SvxTimeField, SvxFieldData );
-
-SvxFieldData* SvxTimeField::Clone() const
-{
- return new SvxTimeField; // empty
-}
-
-int SvxTimeField::operator==( const SvxFieldData& rCmp ) const
-{
- return ( rCmp.Type() == TYPE(SvxTimeField) );
-}
-
-void SvxTimeField::Load( SvPersistStream & /*rStm*/ )
-{
-}
-
-void SvxTimeField::Save( SvPersistStream & /*rStm*/ )
-{
-}
-
-MetaAction* SvxTimeField::createBeginComment() const
-{
- return new MetaCommentAction( "FIELD_SEQ_BEGIN" );
-}
-
-SV_IMPL_PERSIST1( SvxFileField, SvxFieldData );
-
-SvxFieldData* SvxFileField::Clone() const
-{
- return new SvxFileField; // empty
-}
-
-int SvxFileField::operator==( const SvxFieldData& rCmp ) const
-{
- return ( rCmp.Type() == TYPE(SvxFileField) );
-}
-
-void SvxFileField::Load( SvPersistStream & /*rStm*/ )
-{
-}
-
-void SvxFileField::Save( SvPersistStream & /*rStm*/ )
-{
-}
-
-SV_IMPL_PERSIST1( SvxTableField, SvxFieldData );
-
-SvxFieldData* SvxTableField::Clone() const
-{
- return new SvxTableField; // empty
-}
-
-int SvxTableField::operator==( const SvxFieldData& rCmp ) const
-{
- return ( rCmp.Type() == TYPE(SvxTableField) );
-}
-
-void SvxTableField::Load( SvPersistStream & /*rStm*/ )
-{
-}
-
-void SvxTableField::Save( SvPersistStream & /*rStm*/ )
-{
-}
-
-//----------------------------------------------------------------------------
-// SvxExtTimeField
-//----------------------------------------------------------------------------
-
-SV_IMPL_PERSIST1( SvxExtTimeField, SvxFieldData );
-
-//----------------------------------------------------------------------------
-
-SvxExtTimeField::SvxExtTimeField()
-{
- nFixTime = Time().GetTime();
- eType = SVXTIMETYPE_VAR;
- eFormat = SVXTIMEFORMAT_STANDARD;
-}
-
-//----------------------------------------------------------------------------
-
-SvxExtTimeField::SvxExtTimeField( const Time& rTime, SvxTimeType eT, SvxTimeFormat eF )
-{
- nFixTime = rTime.GetTime();
- eType = eT;
- eFormat = eF;
-}
-
-//----------------------------------------------------------------------------
-
-SvxFieldData* SvxExtTimeField::Clone() const
-{
- return new SvxExtTimeField( *this );
-}
-
-//----------------------------------------------------------------------------
-
-int SvxExtTimeField::operator==( const SvxFieldData& rOther ) const
-{
- if ( rOther.Type() != Type() )
- return sal_False;
-
- const SvxExtTimeField& rOtherFld = (const SvxExtTimeField&) rOther;
- return ( ( nFixTime == rOtherFld.nFixTime ) &&
- ( eType == rOtherFld.eType ) &&
- ( eFormat == rOtherFld.eFormat ) );
-}
-
-//----------------------------------------------------------------------------
-
-void SvxExtTimeField::Load( SvPersistStream & rStm )
-{
- sal_uInt16 nType, nFormat;
-
- rStm >> nFixTime;
- rStm >> nType;
- rStm >> nFormat;
-
- eType = (SvxTimeType) nType;
- eFormat= (SvxTimeFormat) nFormat;
-}
-
-//----------------------------------------------------------------------------
-
-void SvxExtTimeField::Save( SvPersistStream & rStm )
-{
- rStm << nFixTime;
- rStm << (sal_uInt16) eType;
- rStm << (sal_uInt16) eFormat;
-}
-
-//----------------------------------------------------------------------------
-
-String SvxExtTimeField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLang ) const
-{
- Time aTime; // current time
- if ( eType == SVXTIMETYPE_FIX )
- aTime.SetTime( nFixTime );
- return GetFormatted( aTime, eFormat, rFormatter, eLang );
-}
-
-String SvxExtTimeField::GetFormatted( Time& aTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLang )
-{
- switch( eFormat )
- {
- case SVXTIMEFORMAT_SYSTEM :
- OSL_FAIL( "SVXTIMEFORMAT_SYSTEM: not implemented" );
- eFormat = SVXTIMEFORMAT_STANDARD;
- break;
- case SVXTIMEFORMAT_APPDEFAULT :
- OSL_FAIL( "SVXTIMEFORMAT_APPDEFAULT: not implemented" );
- eFormat = SVXTIMEFORMAT_STANDARD;
- break;
- default: ;//prevent warning
- }
-
- sal_uInt32 nFormatKey;
-
- switch( eFormat )
- {
- case SVXTIMEFORMAT_12_HM:
- nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMAMPM, eLang );
- break;
- case SVXTIMEFORMAT_12_HMSH:
- { // no builtin format available, try to insert or reuse
- String aFormatCode( RTL_CONSTASCII_USTRINGPARAM( "HH:MM:SS.00 AM/PM" ) );
- xub_StrLen nCheckPos;
- short nType;
- /*sal_Bool bInserted = */rFormatter.PutandConvertEntry( aFormatCode,
- nCheckPos, nType, nFormatKey, LANGUAGE_ENGLISH_US, eLang );
- DBG_ASSERT( nCheckPos == 0, "SVXTIMEFORMAT_12_HMSH: could not insert format code" );
- if ( nCheckPos )
- nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HH_MMSS00, eLang );
- }
- break;
- case SVXTIMEFORMAT_24_HM:
- nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMM, eLang );
- break;
- case SVXTIMEFORMAT_24_HMSH:
- nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HH_MMSS00, eLang );
- break;
- case SVXTIMEFORMAT_12_HMS:
- nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMSSAMPM, eLang );
- break;
- case SVXTIMEFORMAT_24_HMS:
- nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMSS, eLang );
- break;
- case SVXTIMEFORMAT_STANDARD:
- default:
- nFormatKey = rFormatter.GetStandardFormat( NUMBERFORMAT_TIME, eLang );
- }
-
- double fFracTime = aTime.GetTimeInDays();
- String aStr;
- Color* pColor = NULL;
- rFormatter.GetOutputString( fFracTime, nFormatKey, aStr, &pColor );
- return aStr;
-}
-
-MetaAction* SvxExtTimeField::createBeginComment() const
-{
- return new MetaCommentAction( "FIELD_SEQ_BEGIN" );
-}
-
-//----------------------------------------------------------------------------
-// SvxExtFileField
-//----------------------------------------------------------------------------
-
-SV_IMPL_PERSIST1( SvxExtFileField, SvxFieldData );
-
-//----------------------------------------------------------------------------
-
-SvxExtFileField::SvxExtFileField()
-{
- eType = SVXFILETYPE_VAR;
- eFormat = SVXFILEFORMAT_FULLPATH;
-}
-
-//----------------------------------------------------------------------------
-
-SvxExtFileField::SvxExtFileField( const XubString& rStr, SvxFileType eT, SvxFileFormat eF )
-{
- aFile = rStr;
- eType = eT;
- eFormat = eF;
-}
-
-//----------------------------------------------------------------------------
-
-SvxFieldData* SvxExtFileField::Clone() const
-{
- return new SvxExtFileField( *this );
-}
-
-//----------------------------------------------------------------------------
-
-int SvxExtFileField::operator==( const SvxFieldData& rOther ) const
-{
- if ( rOther.Type() != Type() )
- return sal_False;
-
- const SvxExtFileField& rOtherFld = (const SvxExtFileField&) rOther;
- return ( ( aFile == rOtherFld.aFile ) &&
- ( eType == rOtherFld.eType ) &&
- ( eFormat == rOtherFld.eFormat ) );
-}
-
-//----------------------------------------------------------------------------
-
-void SvxExtFileField::Load( SvPersistStream & rStm )
-{
- sal_uInt16 nType, nFormat;
-
- // UNICODE: rStm >> aFile;
- rStm.ReadByteString(aFile);
-
- rStm >> nType;
- rStm >> nFormat;
-
- eType = (SvxFileType) nType;
- eFormat= (SvxFileFormat) nFormat;
-}
-
-//----------------------------------------------------------------------------
-
-void SvxExtFileField::Save( SvPersistStream & rStm )
-{
- // UNICODE: rStm << aFile;
- rStm.WriteByteString(aFile);
-
- rStm << (sal_uInt16) eType;
- rStm << (sal_uInt16) eFormat;
-}
-
-//----------------------------------------------------------------------------
-
-XubString SvxExtFileField::GetFormatted() const
-{
- XubString aString;
-
- INetURLObject aURLObj( aFile );
-
- if( INET_PROT_NOT_VALID == aURLObj.GetProtocol() )
- {
- // invalid? try to interpret string as system file name
- String aURLStr;
-
- ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aFile, aURLStr );
-
- aURLObj.SetURL( aURLStr );
- }
-
- // #92009# Be somewhat liberate when trying to
- // get formatted content out of the FileField
- if( INET_PROT_NOT_VALID == aURLObj.GetProtocol() )
- {
- // still not valid? Then output as is
- aString = aFile;
- }
- else if( INET_PROT_FILE == aURLObj.GetProtocol() )
- {
- switch( eFormat )
- {
- case SVXFILEFORMAT_FULLPATH:
- aString = aURLObj.getFSysPath(INetURLObject::FSYS_DETECT);
- break;
-
- case SVXFILEFORMAT_PATH:
- aURLObj.removeSegment(INetURLObject::LAST_SEGMENT, false);
- // #101742# Leave trailing slash at the pathname
- aURLObj.setFinalSlash();
- aString = aURLObj.getFSysPath(INetURLObject::FSYS_DETECT);
- break;
-
- case SVXFILEFORMAT_NAME:
- aString = aURLObj.getBase(INetURLObject::LAST_SEGMENT,true,INetURLObject::DECODE_UNAMBIGUOUS);
- break;
-
- case SVXFILEFORMAT_NAME_EXT:
- aString = aURLObj.getName(INetURLObject::LAST_SEGMENT,true,INetURLObject::DECODE_UNAMBIGUOUS);
- break;
- }
- }
- else
- {
- switch( eFormat )
- {
- case SVXFILEFORMAT_FULLPATH:
- aString = aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI );
- break;
-
- case SVXFILEFORMAT_PATH:
- aURLObj.removeSegment(INetURLObject::LAST_SEGMENT, false);
- // #101742# Leave trailing slash at the pathname
- aURLObj.setFinalSlash();
- aString = aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI );
- break;
-
- case SVXFILEFORMAT_NAME:
- aString = aURLObj.getBase();
- break;
-
- case SVXFILEFORMAT_NAME_EXT:
- aString = aURLObj.getName();
- break;
- }
- }
-
- return( aString );
-}
-
-//----------------------------------------------------------------------------
-// SvxAuthorField
-//----------------------------------------------------------------------------
-
-SV_IMPL_PERSIST1( SvxAuthorField, SvxFieldData );
-
-//----------------------------------------------------------------------------
-
-SvxAuthorField::SvxAuthorField()
-{
- eType = SVXAUTHORTYPE_VAR;
- eFormat = SVXAUTHORFORMAT_FULLNAME;
-}
-
-//----------------------------------------------------------------------------
-
-SvxAuthorField::SvxAuthorField( const XubString& rFirstName,
- const XubString& rLastName,
- const XubString& rShortName,
- SvxAuthorType eT, SvxAuthorFormat eF )
-{
- aName = rLastName;
- aFirstName = rFirstName;
- aShortName = rShortName;
- eType = eT;
- eFormat = eF;
-}
-
-//----------------------------------------------------------------------------
-
-SvxFieldData* SvxAuthorField::Clone() const
-{
- return new SvxAuthorField( *this );
-}
-
-//----------------------------------------------------------------------------
-
-int SvxAuthorField::operator==( const SvxFieldData& rOther ) const
-{
- if ( rOther.Type() != Type() )
- return sal_False;
-
- const SvxAuthorField& rOtherFld = (const SvxAuthorField&) rOther;
- return ( ( aName == rOtherFld.aName ) &&
- ( aFirstName == rOtherFld.aFirstName ) &&
- ( aShortName == rOtherFld.aShortName ) &&
- ( eType == rOtherFld.eType ) &&
- ( eFormat == rOtherFld.eFormat ) );
-}
-
-//----------------------------------------------------------------------------
-
-void SvxAuthorField::Load( SvPersistStream & rStm )
-{
- sal_uInt16 nType = 0, nFormat = 0;
-
- read_unicode( rStm, aName );
- read_unicode( rStm, aFirstName );
- read_unicode( rStm, aShortName );
-
- rStm >> nType;
- rStm >> nFormat;
-
- eType = (SvxAuthorType) nType;
- eFormat= (SvxAuthorFormat) nFormat;
-}
-
-//----------------------------------------------------------------------------
-
-void SvxAuthorField::Save( SvPersistStream & rStm )
-{
- write_unicode( rStm, aName );
- write_unicode( rStm, aFirstName );
- write_unicode( rStm, aShortName );
-
- rStm << (sal_uInt16) eType;
- rStm << (sal_uInt16) eFormat;
-}
-
-//----------------------------------------------------------------------------
-
-XubString SvxAuthorField::GetFormatted() const
-{
- XubString aString;
-
- switch( eFormat )
- {
- case SVXAUTHORFORMAT_FULLNAME:
- aString = aFirstName;
- aString += sal_Unicode(' ');
- aString += aName;
- break;
-
- case SVXAUTHORFORMAT_NAME:
- aString = aName;
- break;
-
- case SVXAUTHORFORMAT_FIRSTNAME:
- aString = aFirstName;
- break;
-
- case SVXAUTHORFORMAT_SHORTNAME:
- aString = aShortName;
- break;
- }
-
- return( aString );
-}
-
-static SvClassManager* pClassMgr=0;
-
-SvClassManager& SvxFieldItem::GetClassManager()
-{
- if ( !pClassMgr )
- {
- pClassMgr = new SvClassManager;
- pClassMgr->SV_CLASS_REGISTER( SvxFieldData );
- pClassMgr->SV_CLASS_REGISTER( SvxURLField );
- pClassMgr->SV_CLASS_REGISTER( SvxDateField );
- pClassMgr->SV_CLASS_REGISTER( SvxPageField );
- pClassMgr->SV_CLASS_REGISTER( SvxTimeField );
- pClassMgr->SV_CLASS_REGISTER( SvxExtTimeField );
- pClassMgr->SV_CLASS_REGISTER( SvxExtFileField );
- pClassMgr->SV_CLASS_REGISTER( SvxAuthorField );
- }
-
- return *pClassMgr;
-}
-
-///////////////////////////////////////////////////////////////////////
-
-SV_IMPL_PERSIST1( SvxHeaderField, SvxFieldData );
-
-SvxFieldData* SvxHeaderField::Clone() const
-{
- return new SvxHeaderField; // empty
-}
-
-int SvxHeaderField::operator==( const SvxFieldData& rCmp ) const
-{
- return ( rCmp.Type() == TYPE(SvxHeaderField) );
-}
-
-void SvxHeaderField::Load( SvPersistStream & /*rStm*/ )
-{
-}
-
-void SvxHeaderField::Save( SvPersistStream & /*rStm*/ )
-{
-}
-
-///////////////////////////////////////////////////////////////////////
-
-SV_IMPL_PERSIST1( SvxFooterField, SvxFieldData );
-
-SvxFieldData* SvxFooterField::Clone() const
-{
- return new SvxFooterField; // empty
-}
-
-int SvxFooterField::operator==( const SvxFieldData& rCmp ) const
-{
- return ( rCmp.Type() == TYPE(SvxFooterField) );
-}
-
-void SvxFooterField::Load( SvPersistStream & /*rStm*/ )
-{
-}
-
-void SvxFooterField::Save( SvPersistStream & /*rStm*/ )
-{
-}
-
-///////////////////////////////////////////////////////////////////////
-
-SV_IMPL_PERSIST1( SvxDateTimeField, SvxFieldData );
-
-SvxFieldData* SvxDateTimeField::Clone() const
-{
- return new SvxDateTimeField; // empty
-}
-
-int SvxDateTimeField::operator==( const SvxFieldData& rCmp ) const
-{
- return ( rCmp.Type() == TYPE(SvxDateTimeField) );
-}
-
-void SvxDateTimeField::Load( SvPersistStream & /*rStm*/ )
-{
-}
-
-void SvxDateTimeField::Save( SvPersistStream & /*rStm*/ )
-{
-}
-
-String SvxDateTimeField::GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage )
-{
- String aRet;
-
- SvxDateFormat eDateFormat = (SvxDateFormat)(eFormat & 0x0f);
-
- if(eDateFormat)
- {
- aRet = SvxDateField::GetFormatted( rDate, eDateFormat, rFormatter, eLanguage );
- }
-
- SvxTimeFormat eTimeFormat = (SvxTimeFormat)((eFormat >> 4) & 0x0f);
-
- if(eTimeFormat)
- {
- if(aRet.Len())
- aRet += sal_Unicode(' ');
-
- aRet += SvxExtTimeField::GetFormatted( rTime, eTimeFormat, rFormatter, eLanguage );
- }
-
- return aRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
deleted file mode 100644
index ef52df3e73..0000000000
--- a/editeng/source/items/frmitems.cxx
+++ /dev/null
@@ -1,4224 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-// include ---------------------------------------------------------------
-#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/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/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>
-#include <com/sun/star/style/BreakType.hpp>
-#include <com/sun/star/style/GraphicLocation.hpp>
-#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/awt/Selection.hpp>
-#include <com/sun/star/awt/Size.hpp>
-#include <com/sun/star/text/WritingMode2.hpp>
-#include <com/sun/star/frame/status/UpperLowerMarginScale.hpp>
-
-#include <unotools/ucbstreamhelper.hxx>
-#include <limits.h>
-#include <comphelper/processfactory.hxx>
-#include <svtools/grfmgr.hxx>
-#include <tools/urlobj.hxx>
-#include <comphelper/types.hxx>
-#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>
-
-#define GLOBALOVERFLOW3
-
-#define _SVX_FRMITEMS_CXX
-
-#include <editeng/editids.hrc>
-#include <editeng/editrids.hrc>
-#include <editeng/pbinitem.hxx>
-#include <editeng/sizeitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/prntitem.hxx>
-#include <editeng/opaqitem.hxx>
-#include <editeng/protitem.hxx>
-#include <editeng/shaditem.hxx>
-#include <editeng/boxitem.hxx>
-#include <editeng/brkitem.hxx>
-#include <editeng/keepitem.hxx>
-#include <editeng/bolnitem.hxx>
-#include <editeng/brshitem.hxx>
-#include <editeng/frmdiritem.hxx>
-#include <editeng/itemtype.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng/unoprnms.hxx>
-#include <editeng/memberids.hrc>
-#include <editeng/editerr.hxx>
-
-using namespace ::editeng;
-using namespace ::rtl;
-using namespace ::com::sun::star;
-
-
-// Conversion for UNO
-#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
-#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
-#define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L))
-#define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L))
-
-// STATIC DATA -----------------------------------------------------------
-
-inline void SetValueProp( XubString& rStr, const sal_uInt16 nValue,
- const sal_uInt16 nProp )
-{
- if( 100 == nProp )
- rStr += String::CreateFromInt32( nValue );
- else
- ( rStr += String::CreateFromInt32( nProp )) += sal_Unicode('%');
-}
-
-inline void SetValueProp( XubString& rStr, const short nValue,
- const sal_uInt16 nProp )
-{
- if( 100 == nProp )
- rStr += String::CreateFromInt32( nValue );
- else
- ( rStr += String::CreateFromInt32( nProp )) += sal_Unicode('%');
-}
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1_FACTORY(SvxPaperBinItem, SfxByteItem, new SvxPaperBinItem(0));
-TYPEINIT1_FACTORY(SvxSizeItem, SfxPoolItem, new SvxSizeItem(0));
-TYPEINIT1_FACTORY(SvxLRSpaceItem, SfxPoolItem, new SvxLRSpaceItem(0));
-TYPEINIT1_FACTORY(SvxULSpaceItem, SfxPoolItem, new SvxULSpaceItem(0));
-TYPEINIT1_FACTORY(SvxPrintItem, SfxBoolItem, new SvxPrintItem(0));
-TYPEINIT1_FACTORY(SvxOpaqueItem, SfxBoolItem, new SvxOpaqueItem(0));
-TYPEINIT1_FACTORY(SvxProtectItem, SfxPoolItem, new SvxProtectItem(0));
-TYPEINIT1_FACTORY(SvxBrushItem, SfxPoolItem, new SvxBrushItem(0));
-TYPEINIT1_FACTORY(SvxShadowItem, SfxPoolItem, new SvxShadowItem(0));
-TYPEINIT1_FACTORY(SvxBoxItem, SfxPoolItem, new SvxBoxItem(0));
-TYPEINIT1_FACTORY(SvxBoxInfoItem, SfxPoolItem, new SvxBoxInfoItem(0));
-TYPEINIT1_FACTORY(SvxFmtBreakItem, SfxEnumItem, new SvxFmtBreakItem(SVX_BREAK_NONE, 0));
-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
-{
- return new SvxPaperBinItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxPaperBinItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxPaperBinItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Int8 nBin;
- rStrm >> nBin;
- return new SvxPaperBinItem( Which(), nBin );
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SvxPaperBinItem::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:
- rText = String::CreateFromInt32( GetValue() );
- return SFX_ITEM_PRESENTATION_NAMELESS;
-
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt8 nValue = GetValue();
-
- if ( PAPERBIN_PRINTER_SETTINGS == nValue )
- rText = EE_RESSTR(RID_SVXSTR_PAPERBIN_SETTINGS);
- else
- {
- rText = EE_RESSTR(RID_SVXSTR_PAPERBIN);
- rText += sal_Unicode(' ');
- rText += String::CreateFromInt32( nValue );
- }
- return SFX_ITEM_PRESENTATION_COMPLETE;
- }
- //no break necessary
- default: ;//prevent warning
- }
-
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxSizeItem -----------------------------------------------------
-
-SvxSizeItem::SvxSizeItem( const sal_uInt16 nId, const Size& rSize ) :
-
- SfxPoolItem( nId ),
-
- aSize( rSize )
-{
-}
-
-// -----------------------------------------------------------------------
-bool SvxSizeItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
-
- awt::Size aTmp(aSize.Width(), aSize.Height());
- if( bConvert )
- {
- aTmp.Height = TWIP_TO_MM100(aTmp.Height);
- aTmp.Width = TWIP_TO_MM100(aTmp.Width);
- }
-
- switch( nMemberId )
- {
- case MID_SIZE_SIZE: rVal <<= aTmp; break;
- case MID_SIZE_WIDTH: rVal <<= aTmp.Width; break;
- case MID_SIZE_HEIGHT: rVal <<= aTmp.Height; break;
- default: OSL_FAIL("Wrong MemberId!"); return false;
- }
-
- return true;
-}
-// -----------------------------------------------------------------------
-bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
-
- switch( nMemberId )
- {
- case MID_SIZE_SIZE:
- {
- awt::Size aTmp;
- if( rVal >>= aTmp )
- {
- if(bConvert)
- {
- aTmp.Height = MM100_TO_TWIP(aTmp.Height);
- aTmp.Width = MM100_TO_TWIP(aTmp.Width);
- }
- aSize = Size( aTmp.Width, aTmp.Height );
- }
- else
- {
- return false;
- }
- }
- break;
- case MID_SIZE_WIDTH:
- {
- sal_Int32 nVal = 0;
- if(!(rVal >>= nVal ))
- return false;
-
- aSize.Width() = bConvert ? MM100_TO_TWIP(nVal) : nVal;
- }
- break;
- case MID_SIZE_HEIGHT:
- {
- sal_Int32 nVal = 0;
- if(!(rVal >>= nVal))
- return true;
-
- aSize.Height() = bConvert ? MM100_TO_TWIP(nVal) : nVal;
- }
- break;
- default: OSL_FAIL("Wrong MemberId!");
- return false;
- }
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SvxSizeItem::SvxSizeItem( const sal_uInt16 nId ) :
-
- SfxPoolItem( nId )
-{
-}
-
-// -----------------------------------------------------------------------
-
-int SvxSizeItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return ( aSize == ( (SvxSizeItem&)rAttr ).GetSize() );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxSizeItem::Clone( SfxItemPool* ) const
-{
- return new SvxSizeItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxSizeItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreUnit,
- SfxMapUnit ePresUnit,
- XubString& rText, const IntlWrapper *pIntl
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NONE;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- rText = GetMetricText( aSize.Width(), eCoreUnit, ePresUnit, pIntl );
- rText += cpDelim;
- rText += GetMetricText( aSize.Height(), eCoreUnit, ePresUnit, pIntl );
- return SFX_ITEM_PRESENTATION_NAMELESS;
-
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = EE_RESSTR(RID_SVXITEMS_SIZE_WIDTH);
- rText += GetMetricText( aSize.Width(), eCoreUnit, ePresUnit, pIntl );
- rText += EE_RESSTR(GetMetricId(ePresUnit));
- rText += cpDelim;
- rText += EE_RESSTR(RID_SVXITEMS_SIZE_HEIGHT);
- rText += GetMetricText( aSize.Height(), eCoreUnit, ePresUnit, pIntl );
- rText += EE_RESSTR(GetMetricId(ePresUnit));
- return SFX_ITEM_PRESENTATION_COMPLETE;
- //no break necessary
- default: ;//prevent warning
-
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxSizeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << aSize.Width();
- rStrm << aSize.Height();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxSizeItem::ScaleMetrics( long nMult, long nDiv )
-{
- aSize.Width() = Scale( aSize.Width(), nMult, nDiv );
- aSize.Height() = Scale( aSize.Height(), nMult, nDiv );
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxSizeItem::HasMetrics() const
-{
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxSizeItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- long nWidth, nHeight;
- rStrm >> nWidth >> nHeight;
-
- SvxSizeItem* pAttr = new SvxSizeItem( Which() );
- pAttr->SetSize(Size(nWidth, nHeight));
-
- return pAttr;
-}
-
-// class SvxLRSpaceItem --------------------------------------------------
-
-SvxLRSpaceItem::SvxLRSpaceItem( const sal_uInt16 nId ) :
-
- SfxPoolItem( nId ),
-
- nFirstLineOfst ( 0 ),
- nTxtLeft ( 0 ),
- nLeftMargin ( 0 ),
- nRightMargin ( 0 ),
- nPropFirstLineOfst( 100 ),
- nPropLeftMargin( 100 ),
- nPropRightMargin( 100 ),
- bAutoFirst ( 0 )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxLRSpaceItem::SvxLRSpaceItem( const long nLeft, const long nRight,
- const long nTLeft, const short nOfset,
- const sal_uInt16 nId ) :
-
- SfxPoolItem( nId ),
-
- nFirstLineOfst ( nOfset ),
- nTxtLeft ( nTLeft ),
- nLeftMargin ( nLeft ),
- nRightMargin ( nRight ),
- nPropFirstLineOfst( 100 ),
- nPropLeftMargin( 100 ),
- nPropRightMargin( 100 ),
- bAutoFirst ( 0 )
-{
-}
-
-// -----------------------------------------------------------------------
-bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- bool bRet = true;
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId )
- {
- // now all signed
- case MID_L_MARGIN:
- rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nLeftMargin) : nLeftMargin);
- break;
-
- case MID_TXT_LMARGIN :
- rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nTxtLeft) : nTxtLeft);
- break;
- case MID_R_MARGIN:
- rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nRightMargin) : nRightMargin);
- break;
- case MID_L_REL_MARGIN:
- rVal <<= (sal_Int16)nPropLeftMargin;
- break;
- case MID_R_REL_MARGIN:
- rVal <<= (sal_Int16)nPropRightMargin;
- break;
-
- case MID_FIRST_LINE_INDENT:
- rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100(nFirstLineOfst) : nFirstLineOfst);
- break;
-
- case MID_FIRST_LINE_REL_INDENT:
- rVal <<= (sal_Int16)(nPropFirstLineOfst);
- break;
-
- case MID_FIRST_AUTO:
- rVal = Bool2Any(IsAutoFirst());
- break;
-
- default:
- bRet = false;
- OSL_FAIL("unknown MemberId");
- }
- return bRet;
-}
-
-// -----------------------------------------------------------------------
-bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
- sal_Int32 nVal = 0;
- if( nMemberId != MID_FIRST_AUTO &&
- nMemberId != MID_L_REL_MARGIN && nMemberId != MID_R_REL_MARGIN)
- if(!(rVal >>= nVal))
- return sal_False;
-
- switch( nMemberId )
- {
- case MID_L_MARGIN:
- SetLeft((sal_Int32)bConvert ? MM100_TO_TWIP(nVal) : nVal);
- break;
-
- case MID_TXT_LMARGIN :
- SetTxtLeft((sal_Int32)bConvert ? MM100_TO_TWIP(nVal) : nVal);
- break;
-
- case MID_R_MARGIN:
- SetRight((sal_Int32) bConvert ? MM100_TO_TWIP(nVal) : nVal);
- break;
- case MID_L_REL_MARGIN:
- case MID_R_REL_MARGIN:
- {
- sal_Int32 nRel = 0;
- if((rVal >>= nRel) && nRel >= 0 && nRel < USHRT_MAX)
- {
- if(MID_L_REL_MARGIN== nMemberId)
- nPropLeftMargin = (sal_uInt16)nRel;
- else
- nPropRightMargin = (sal_uInt16)nRel;
- }
- else
- return false;
- }
- break;
- case MID_FIRST_LINE_INDENT :
- SetTxtFirstLineOfst((short)(bConvert ? MM100_TO_TWIP(nVal) : nVal));
- break;
-
- case MID_FIRST_LINE_REL_INDENT:
- SetPropTxtFirstLineOfst ( (sal_uInt16)nVal );
- break;
-
- case MID_FIRST_AUTO:
- SetAutoFirst( Any2Bool(rVal) );
- break;
-
- default:
- OSL_FAIL("unknown MemberId");
- return false;
- }
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-// Adapt nLeftMargin and nTxtLeft.
-
-void SvxLRSpaceItem::AdjustLeft()
-{
- if ( 0 > nFirstLineOfst )
- nLeftMargin = nTxtLeft + nFirstLineOfst;
- else
- nLeftMargin = nTxtLeft;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return (
- nLeftMargin == ((SvxLRSpaceItem&)rAttr).GetLeft() &&
- nRightMargin == ((SvxLRSpaceItem&)rAttr).GetRight() &&
- nFirstLineOfst == ((SvxLRSpaceItem&)rAttr).GetTxtFirstLineOfst() &&
- nPropLeftMargin == ((SvxLRSpaceItem&)rAttr).GetPropLeft() &&
- nPropRightMargin == ((SvxLRSpaceItem&)rAttr).GetPropRight() &&
- nPropFirstLineOfst == ((SvxLRSpaceItem&)rAttr).GetPropTxtFirstLineOfst() &&
- bAutoFirst == ((SvxLRSpaceItem&)rAttr).IsAutoFirst() );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxLRSpaceItem::Clone( SfxItemPool* ) const
-{
- return new SvxLRSpaceItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxLRSpaceItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreUnit,
- SfxMapUnit ePresUnit,
- XubString& rText, const IntlWrapper* pIntl
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NONE;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- {
- if ( 100 != nPropLeftMargin )
- ( rText = String::CreateFromInt32( nPropLeftMargin )) += sal_Unicode('%');
- else
- rText = GetMetricText( (long)nLeftMargin,
- eCoreUnit, ePresUnit, pIntl );
- rText += cpDelim;
- if ( 100 != nPropFirstLineOfst )
- ( rText += String::CreateFromInt32( nPropFirstLineOfst )) += sal_Unicode('%');
- else
- rText += GetMetricText( (long)nFirstLineOfst,
- eCoreUnit, ePresUnit, pIntl );
- rText += cpDelim;
- if ( 100 != nRightMargin )
- ( rText += String::CreateFromInt32( nRightMargin )) += sal_Unicode('%');
- else
- rText += GetMetricText( (long)nRightMargin,
- eCoreUnit, ePresUnit, pIntl );
- return SFX_ITEM_PRESENTATION_NAMELESS;
- }
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- rText = EE_RESSTR(RID_SVXITEMS_LRSPACE_LEFT);
- if ( 100 != nPropLeftMargin )
- ( rText += String::CreateFromInt32( nPropLeftMargin )) += sal_Unicode('%');
- else
- {
- rText += GetMetricText( (long)nLeftMargin,
- eCoreUnit, ePresUnit, pIntl );
- rText += EE_RESSTR(GetMetricId(ePresUnit));
- }
- rText += cpDelim;
- if ( 100 != nPropFirstLineOfst || nFirstLineOfst )
- {
- rText += EE_RESSTR(RID_SVXITEMS_LRSPACE_FLINE);
- if ( 100 != nPropFirstLineOfst )
- ( rText += String::CreateFromInt32( nPropFirstLineOfst ))
- += sal_Unicode('%');
- else
- {
- rText += GetMetricText( (long)nFirstLineOfst,
- eCoreUnit, ePresUnit, pIntl );
- rText += EE_RESSTR(GetMetricId(ePresUnit));
- }
- rText += cpDelim;
- }
- rText += EE_RESSTR(RID_SVXITEMS_LRSPACE_RIGHT);
- if ( 100 != nPropRightMargin )
- ( rText += String::CreateFromInt32( nPropRightMargin )) += sal_Unicode('%');
- else
- {
- rText += GetMetricText( (long)nRightMargin,
- eCoreUnit, ePresUnit, pIntl );
- rText += EE_RESSTR(GetMetricId(ePresUnit));
- }
- return SFX_ITEM_PRESENTATION_COMPLETE;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-// 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 is manipulated together with this, see Create()
-
- sal_uInt16 nMargin = 0;
- if( nLeftMargin > 0 )
- nMargin = sal_uInt16( nLeftMargin );
- rStrm << nMargin;
- rStrm << nPropLeftMargin;
- if( nRightMargin > 0 )
- nMargin = sal_uInt16( nRightMargin );
- else
- nMargin = 0;
- rStrm << nMargin;
- rStrm << nPropRightMargin;
- rStrm << nFirstLineOfst;
- rStrm << nPropFirstLineOfst;
- if( nTxtLeft > 0 )
- nMargin = sal_uInt16( nTxtLeft );
- else
- nMargin = 0;
- rStrm << nMargin;
- if( nItemVersion >= LRSPACE_AUTOFIRST_VERSION )
- {
- sal_Int8 nAutoFirst = bAutoFirst ? 1 : 0;
- if( nItemVersion >= LRSPACE_NEGATIVE_VERSION &&
- ( nLeftMargin < 0 || nRightMargin < 0 || nTxtLeft < 0 ) )
- nAutoFirst |= 0x80;
- rStrm << nAutoFirst;
-
- // 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;
-
- if( 0x80 & nAutoFirst )
- {
- rStrm << nLeftMargin;
- rStrm << nRightMargin;
- }
- }
-
- ((SvxLRSpaceItem*)this)->SetTxtFirstLineOfst( nSaveFI );
-
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxLRSpaceItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const
-{
- sal_uInt16 left, prpleft, right, prpright, prpfirstline, txtleft;
- short firstline;
- sal_Int8 autofirst = 0;
-
- if ( nVersion >= LRSPACE_AUTOFIRST_VERSION )
- {
- rStrm >> left >> prpleft >> right >> prpright >> firstline >>
- prpfirstline >> txtleft >> autofirst;
-
- sal_uInt32 nPos = rStrm.Tell();
- sal_uInt32 nMarker;
- rStrm >> nMarker;
- if ( nMarker == BULLETLR_MARKER )
- {
- rStrm >> firstline;
- if ( firstline < 0 )
- left = left + static_cast<sal_uInt16>(firstline); // see below: txtleft = ...
- }
- else
- rStrm.Seek( nPos );
- }
- else if ( nVersion == LRSPACE_TXTLEFT_VERSION )
- {
- rStrm >> left >> prpleft >> right >> prpright >> firstline >>
- prpfirstline >> txtleft;
- }
- else if ( nVersion == LRSPACE_16_VERSION )
- {
- rStrm >> left >> prpleft >> right >> prpright >> firstline >>
- prpfirstline;
- }
- else
- {
- sal_Int8 nL, nR, nFL;
- rStrm >> left >> nL >> right >> nR >> firstline >> nFL;
- prpleft = (sal_uInt16)nL;
- prpright = (sal_uInt16)nR;
- prpfirstline = (sal_uInt16)nFL;
- }
-
- txtleft = firstline >= 0 ? left : left - firstline;
- SvxLRSpaceItem* pAttr = new SvxLRSpaceItem( Which() );
-
- pAttr->nLeftMargin = left;
- pAttr->nPropLeftMargin = prpleft;
- pAttr->nRightMargin = right;
- pAttr->nPropRightMargin = prpright;
- pAttr->nFirstLineOfst = firstline;
- pAttr->nPropFirstLineOfst = prpfirstline;
- pAttr->nTxtLeft = txtleft;
- pAttr->bAutoFirst = autofirst & 0x01;
- if( nVersion >= LRSPACE_NEGATIVE_VERSION && ( autofirst & 0x80 ) )
- {
- sal_Int32 nMargin;
- rStrm >> nMargin;
- pAttr->nLeftMargin = nMargin;
- pAttr->nTxtLeft = firstline >= 0 ? nMargin : nMargin - firstline;
- rStrm >> nMargin;
- pAttr->nRightMargin = nMargin;
- }
- return pAttr;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxLRSpaceItem::GetVersion( sal_uInt16 nFileVersion ) const
-{
- return (nFileVersion == SOFFICE_FILEFORMAT_31)
- ? LRSPACE_TXTLEFT_VERSION
- : LRSPACE_NEGATIVE_VERSION;
-}
-
-// -----------------------------------------------------------------------
-
-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 true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxLRSpaceItem::HasMetrics() const
-{
- return true;
-}
-
-// class SvxULSpaceItem --------------------------------------------------
-
-SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nId ) :
-
- SfxPoolItem( nId ),
-
- nUpper( 0 ),
- nLower( 0 ),
- nPropUpper( 100 ),
- nPropLower( 100 )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
- const sal_uInt16 nId ) :
-
- SfxPoolItem( nId ),
-
- nUpper( nUp ),
- nLower( nLow ),
- nPropUpper( 100 ),
- nPropLower( 100 )
-{
-}
-
-// -----------------------------------------------------------------------
-bool SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId )
- {
- // now all signed
- case 0:
- {
- ::com::sun::star::frame::status::UpperLowerMarginScale aUpperLowerMarginScale;
- aUpperLowerMarginScale.Upper = (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nUpper) : nUpper);
- aUpperLowerMarginScale.Lower = (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nLower) : nPropUpper);
- aUpperLowerMarginScale.ScaleUpper = (sal_Int16)nPropUpper;
- aUpperLowerMarginScale.ScaleLower = (sal_Int16)nPropLower;
- rVal <<= aUpperLowerMarginScale;
- break;
- }
- case MID_UP_MARGIN: rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nUpper) : nUpper); break;
- case MID_LO_MARGIN: rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(nLower) : nLower); break;
- case MID_UP_REL_MARGIN: rVal <<= (sal_Int16) nPropUpper; break;
- case MID_LO_REL_MARGIN: rVal <<= (sal_Int16) nPropLower; break;
- }
- return true;
-}
-
-// -----------------------------------------------------------------------
-bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
- sal_Int32 nVal = 0;
- switch( nMemberId )
- {
- case 0:
- {
- ::com::sun::star::frame::status::UpperLowerMarginScale aUpperLowerMarginScale;
- if ( !(rVal >>= aUpperLowerMarginScale ))
- return false;
- {
- SetUpper((sal_uInt16)(bConvert ? MM100_TO_TWIP( aUpperLowerMarginScale.Upper ) : aUpperLowerMarginScale.Upper));
- SetLower((sal_uInt16)(bConvert ? MM100_TO_TWIP( aUpperLowerMarginScale.Lower ) : aUpperLowerMarginScale.Lower));
- if( aUpperLowerMarginScale.ScaleUpper > 1 )
- nPropUpper = aUpperLowerMarginScale.ScaleUpper;
- if( aUpperLowerMarginScale.ScaleLower > 1 )
- nPropUpper = aUpperLowerMarginScale.ScaleLower;
- }
- }
-
- case MID_UP_MARGIN :
- if(!(rVal >>= nVal) || nVal < 0)
- return false;
- SetUpper((sal_uInt16)(bConvert ? MM100_TO_TWIP(nVal) : nVal));
- break;
- case MID_LO_MARGIN :
- if(!(rVal >>= nVal) || nVal < 0)
- return false;
- SetLower((sal_uInt16)(bConvert ? MM100_TO_TWIP(nVal) : nVal));
- break;
- case MID_UP_REL_MARGIN:
- case MID_LO_REL_MARGIN:
- {
- sal_Int32 nRel = 0;
- if((rVal >>= nRel) && nRel > 1 )
- {
- if(MID_UP_REL_MARGIN == nMemberId)
- nPropUpper = (sal_uInt16)nRel;
- else
- nPropLower = (sal_uInt16)nRel;
- }
- else
- return false;
- }
- break;
-
- default:
- OSL_FAIL("unknown MemberId");
- return false;
- }
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxULSpaceItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return ( nUpper == ( (SvxULSpaceItem&)rAttr ).nUpper &&
- nLower == ( (SvxULSpaceItem&)rAttr ).nLower &&
- nPropUpper == ( (SvxULSpaceItem&)rAttr ).nPropUpper &&
- nPropLower == ( (SvxULSpaceItem&)rAttr ).nPropLower );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxULSpaceItem::Clone( SfxItemPool* ) const
-{
- return new SvxULSpaceItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxULSpaceItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreUnit,
- SfxMapUnit ePresUnit,
- XubString& rText, const IntlWrapper *pIntl
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NONE;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- {
- if ( 100 != nPropUpper )
- ( rText = String::CreateFromInt32( nPropUpper )) += sal_Unicode('%');
- else
- rText = GetMetricText( (long)nUpper, eCoreUnit, ePresUnit, pIntl );
- rText += cpDelim;
- if ( 100 != nPropLower )
- ( rText += String::CreateFromInt32( nPropLower )) += sal_Unicode('%');
- else
- rText += GetMetricText( (long)nLower, eCoreUnit, ePresUnit, pIntl );
- return SFX_ITEM_PRESENTATION_NAMELESS;
- }
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- rText = EE_RESSTR(RID_SVXITEMS_ULSPACE_UPPER);
- if ( 100 != nPropUpper )
- ( rText += String::CreateFromInt32( nPropUpper )) += sal_Unicode('%');
- else
- {
- rText += GetMetricText( (long)nUpper, eCoreUnit, ePresUnit, pIntl );
- rText += EE_RESSTR(GetMetricId(ePresUnit));
- }
- rText += cpDelim;
- rText += EE_RESSTR(RID_SVXITEMS_ULSPACE_LOWER);
- if ( 100 != nPropLower )
- ( rText += String::CreateFromInt32( nPropLower )) += sal_Unicode('%');
- else
- {
- rText += GetMetricText( (long)nLower, eCoreUnit, ePresUnit, pIntl );
- rText += EE_RESSTR(GetMetricId(ePresUnit));
- }
- return SFX_ITEM_PRESENTATION_COMPLETE;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxULSpaceItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << GetUpper()
- << GetPropUpper()
- << GetLower()
- << GetPropLower();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxULSpaceItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const
-{
- sal_uInt16 upper, lower, nPL = 0, nPU = 0;
-
- if ( nVersion == ULSPACE_16_VERSION )
- rStrm >> upper >> nPU >> lower >> nPL;
- else
- {
- sal_Int8 nU, nL;
- rStrm >> upper >> nU >> lower >> nL;
- nPL = (sal_uInt16)nL;
- nPU = (sal_uInt16)nU;
- }
-
- SvxULSpaceItem* pAttr = new SvxULSpaceItem( Which() );
- pAttr->SetUpperValue( upper );
- pAttr->SetLowerValue( lower );
- pAttr->SetPropUpper( nPU );
- pAttr->SetPropLower( nPL );
- return pAttr;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxULSpaceItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
-{
- return ULSPACE_16_VERSION;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxULSpaceItem::ScaleMetrics( long nMult, long nDiv )
-{
- nUpper = (sal_uInt16)Scale( nUpper, nMult, nDiv );
- nLower = (sal_uInt16)Scale( nLower, nMult, nDiv );
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxULSpaceItem::HasMetrics() const
-{
- return true;
-}
-
-// class SvxPrintItem ----------------------------------------------------
-
-SfxPoolItem* SvxPrintItem::Clone( SfxItemPool* ) const
-{
- return new SvxPrintItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxPrintItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Int8)GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxPrintItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Int8 bIsPrint;
- rStrm >> bIsPrint;
- return new SvxPrintItem( Which(), sal_Bool( bIsPrint != 0 ) );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxPrintItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nId = RID_SVXITEMS_PRINT_FALSE;
-
- if ( GetValue() )
- nId = RID_SVXITEMS_PRINT_TRUE;
- rText = EE_RESSTR(nId);
- return ePres;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxOpaqueItem ---------------------------------------------------
-
-SfxPoolItem* SvxOpaqueItem::Clone( SfxItemPool* ) const
-{
- return new SvxOpaqueItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxOpaqueItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Int8)GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxOpaqueItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Int8 bIsOpaque;
- rStrm >> bIsOpaque;
- return new SvxOpaqueItem( Which(), sal_Bool( bIsOpaque != 0 ) );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxOpaqueItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nId = RID_SVXITEMS_OPAQUE_FALSE;
-
- if ( GetValue() )
- nId = RID_SVXITEMS_OPAQUE_TRUE;
- rText = EE_RESSTR(nId);
- return ePres;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxProtectItem --------------------------------------------------
-
-int SvxProtectItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return ( bCntnt == ( (SvxProtectItem&)rAttr ).bCntnt &&
- bSize == ( (SvxProtectItem&)rAttr ).bSize &&
- bPos == ( (SvxProtectItem&)rAttr ).bPos );
-}
-
-bool SvxProtectItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- sal_Bool bValue;
- switch(nMemberId)
- {
- case MID_PROTECT_CONTENT : bValue = bCntnt; break;
- case MID_PROTECT_SIZE : bValue = bSize; break;
- case MID_PROTECT_POSITION: bValue = bPos; break;
- default:
- OSL_FAIL("Wrong MemberId");
- return false;
- }
-
- rVal = Bool2Any( bValue );
- return true;
-}
-
-bool SvxProtectItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- sal_Bool bVal( Any2Bool(rVal) );
- switch(nMemberId)
- {
- case MID_PROTECT_CONTENT : bCntnt = bVal; break;
- case MID_PROTECT_SIZE : bSize = bVal; break;
- case MID_PROTECT_POSITION: bPos = bVal; break;
- default:
- OSL_FAIL("Wrong MemberId");
- return false;
- }
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxProtectItem::Clone( SfxItemPool* ) const
-{
- return new SvxProtectItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxProtectItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nId = RID_SVXITEMS_PROT_CONTENT_FALSE;
-
- if ( bCntnt )
- nId = RID_SVXITEMS_PROT_CONTENT_TRUE;
- rText = EE_RESSTR(nId);
- rText += cpDelim;
- nId = RID_SVXITEMS_PROT_SIZE_FALSE;
-
- if ( bSize )
- nId = RID_SVXITEMS_PROT_SIZE_TRUE;
- rText += EE_RESSTR(nId);
- rText += cpDelim;
- nId = RID_SVXITEMS_PROT_POS_FALSE;
-
- if ( bPos )
- nId = RID_SVXITEMS_PROT_POS_TRUE;
- rText += EE_RESSTR(nId);
- return ePres;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxProtectItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- sal_Int8 cProt = 0;
- if( IsPosProtected() ) cProt |= 0x01;
- if( IsSizeProtected() ) cProt |= 0x02;
- if( IsCntntProtected() ) cProt |= 0x04;
- rStrm << (sal_Int8) cProt;
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxProtectItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Int8 cFlags;
- rStrm >> cFlags;
- SvxProtectItem* pAttr = new SvxProtectItem( Which() );
- pAttr->SetPosProtect( sal_Bool( ( cFlags & 0x01 ) != 0 ) );
- pAttr->SetSizeProtect( sal_Bool( ( cFlags & 0x02 ) != 0 ) );
- pAttr->SetCntntProtect( sal_Bool( ( cFlags & 0x04 ) != 0 ) );
- return pAttr;
-}
-
-// class SvxShadowItem ---------------------------------------------------
-
-SvxShadowItem::SvxShadowItem( const sal_uInt16 nId,
- const Color *pColor, const sal_uInt16 nW,
- const SvxShadowLocation eLoc ) :
- SfxEnumItemInterface( nId ),
- aShadowColor(COL_GRAY),
- nWidth ( nW ),
- eLocation ( eLoc )
-{
- if ( pColor )
- aShadowColor = *pColor;
-}
-
-// -----------------------------------------------------------------------
-bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
-
- table::ShadowFormat aShadow;
- table::ShadowLocation eSet = table::ShadowLocation_NONE;
- switch( eLocation )
- {
- case SVX_SHADOW_TOPLEFT : eSet = table::ShadowLocation_TOP_LEFT ; break;
- case SVX_SHADOW_TOPRIGHT : eSet = table::ShadowLocation_TOP_RIGHT ; break;
- case SVX_SHADOW_BOTTOMLEFT : eSet = table::ShadowLocation_BOTTOM_LEFT ; break;
- case SVX_SHADOW_BOTTOMRIGHT: eSet = table::ShadowLocation_BOTTOM_RIGHT; break;
- default: ;//prevent warning
- }
- aShadow.Location = eSet;
- aShadow.ShadowWidth = bConvert ? TWIP_TO_MM100_UNSIGNED(nWidth) : nWidth;
- aShadow.IsTransparent = aShadowColor.GetTransparency() > 0;
- aShadow.Color = aShadowColor.GetRGBColor();
-
- switch ( nMemberId )
- {
- case MID_LOCATION: rVal <<= aShadow.Location; break;
- case MID_WIDTH: rVal <<= aShadow.ShadowWidth; break;
- case MID_TRANSPARENT: rVal <<= aShadow.IsTransparent; break;
- case MID_BG_COLOR: rVal <<= aShadow.Color; break;
- case 0: rVal <<= aShadow; break;
- default: OSL_FAIL("Wrong MemberId!"); return false;
- }
-
- return true;
-}
-// -----------------------------------------------------------------------
-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;
- bool bRet = QueryValue( aAny, bConvert ? CONVERT_TWIPS : 0 ) && ( aAny >>= aShadow );
- switch ( nMemberId )
- {
- case MID_LOCATION:
- {
- bRet = (rVal >>= aShadow.Location);
- if ( !bRet )
- {
- sal_Int16 nVal = 0;
- bRet = (rVal >>= nVal);
- aShadow.Location = (table::ShadowLocation) nVal;
- }
-
- break;
- }
-
- case MID_WIDTH: rVal >>= aShadow.ShadowWidth; break;
- case MID_TRANSPARENT: rVal >>= aShadow.IsTransparent; break;
- case MID_BG_COLOR: rVal >>= aShadow.Color; break;
- case 0: rVal >>= aShadow; break;
- default: OSL_FAIL("Wrong MemberId!"); return sal_False;
- }
-
- if ( bRet )
- {
-// SvxShadowLocation eSet = SVX_SHADOW_NONE;
- switch( aShadow.Location )
- {
- case table::ShadowLocation_TOP_LEFT : eLocation = SVX_SHADOW_TOPLEFT; break;
- case table::ShadowLocation_TOP_RIGHT : eLocation = SVX_SHADOW_TOPRIGHT; break;
- case table::ShadowLocation_BOTTOM_LEFT : eLocation = SVX_SHADOW_BOTTOMLEFT ; break;
- case table::ShadowLocation_BOTTOM_RIGHT: eLocation = SVX_SHADOW_BOTTOMRIGHT; break;
- default: ;//prevent warning
- }
-
- nWidth = bConvert ? MM100_TO_TWIP(aShadow.ShadowWidth) : aShadow.ShadowWidth;
- Color aSet(aShadow.Color);
- aSet.SetTransparency(aShadow.IsTransparent ? 0xff : 0);
- aShadowColor = aSet;
- }
-
- return bRet;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxShadowItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return ( ( aShadowColor == ( (SvxShadowItem&)rAttr ).aShadowColor ) &&
- ( nWidth == ( (SvxShadowItem&)rAttr ).GetWidth() ) &&
- ( eLocation == ( (SvxShadowItem&)rAttr ).GetLocation() ) );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxShadowItem::Clone( SfxItemPool* ) const
-{
- return new SvxShadowItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxShadowItem::CalcShadowSpace( sal_uInt16 nShadow ) const
-{
- sal_uInt16 nSpace = 0;
-
- switch ( nShadow )
- {
- case SHADOW_TOP:
- if ( eLocation == SVX_SHADOW_TOPLEFT ||
- eLocation == SVX_SHADOW_TOPRIGHT )
- nSpace = nWidth;
- break;
-
- case SHADOW_BOTTOM:
- if ( eLocation == SVX_SHADOW_BOTTOMLEFT ||
- eLocation == SVX_SHADOW_BOTTOMRIGHT )
- nSpace = nWidth;
- break;
-
- case SHADOW_LEFT:
- if ( eLocation == SVX_SHADOW_TOPLEFT ||
- eLocation == SVX_SHADOW_BOTTOMLEFT )
- nSpace = nWidth;
- break;
-
- case SHADOW_RIGHT:
- if ( eLocation == SVX_SHADOW_TOPRIGHT ||
- eLocation == SVX_SHADOW_BOTTOMRIGHT )
- nSpace = nWidth;
- break;
-
- default:
- OSL_FAIL( "wrong shadow" );
- }
- return nSpace;
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxShadowItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreUnit,
- SfxMapUnit ePresUnit,
- XubString& rText, const IntlWrapper *pIntl
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- {
- rText = ::GetColorString( aShadowColor );
- rText += cpDelim;
- sal_uInt16 nId = RID_SVXITEMS_TRANSPARENT_FALSE;
-
- if ( aShadowColor.GetTransparency() )
- nId = RID_SVXITEMS_TRANSPARENT_TRUE;
- rText += EE_RESSTR(nId);
- rText += cpDelim;
- rText += GetMetricText( (long)nWidth, eCoreUnit, ePresUnit, pIntl );
- rText += cpDelim;
- rText += EE_RESSTR(RID_SVXITEMS_SHADOW_BEGIN + eLocation);
- return ePres;
- }
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- rText = EE_RESSTR(RID_SVXITEMS_SHADOW_COMPLETE);
- rText += ::GetColorString( aShadowColor );
- rText += cpDelim;
-
- sal_uInt16 nId = RID_SVXITEMS_TRANSPARENT_FALSE;
- if ( aShadowColor.GetTransparency() )
- nId = RID_SVXITEMS_TRANSPARENT_TRUE;
- rText += EE_RESSTR(nId);
- rText += cpDelim;
- rText += GetMetricText( (long)nWidth, eCoreUnit, ePresUnit, pIntl );
- rText += EE_RESSTR(GetMetricId(ePresUnit));
- rText += cpDelim;
- rText += EE_RESSTR(RID_SVXITEMS_SHADOW_BEGIN + eLocation);
- return ePres;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxShadowItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Int8) GetLocation()
- << (sal_uInt16) GetWidth()
- << (sal_Bool)(aShadowColor.GetTransparency() > 0)
- << GetColor()
- << GetColor()
- << (sal_Int8)(aShadowColor.GetTransparency() > 0 ? 0 : 1); //BRUSH_NULL : BRUSH_SOLID
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxShadowItem::ScaleMetrics( long nMult, long nDiv )
-{
- nWidth = (sal_uInt16)Scale( nWidth, nMult, nDiv );
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxShadowItem::HasMetrics() const
-{
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxShadowItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Int8 cLoc;
- sal_uInt16 _nWidth;
- sal_Bool bTrans;
- Color aColor;
- Color aFillColor;
- sal_Int8 nStyle;
- rStrm >> cLoc >> _nWidth
- >> bTrans >> aColor >> aFillColor >> nStyle;
- aColor.SetTransparency(bTrans ? 0xff : 0);
- return new SvxShadowItem( Which(), &aColor, _nWidth, (SvxShadowLocation)cLoc );
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxShadowItem::GetValueCount() const
-{
- return SVX_SHADOW_END; // SVX_SHADOW_BOTTOMRIGHT + 1
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxShadowItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- DBG_ASSERT( nPos < SVX_SHADOW_END, "enum overflow!" );
- return XubString( EditResId( RID_SVXITEMS_SHADOW_BEGIN + nPos ) );
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxShadowItem::GetEnumValue() const
-{
- return (sal_uInt16)GetLocation();
-}
-
-// -----------------------------------------------------------------------
-
-void SvxShadowItem::SetEnumValue( sal_uInt16 nVal )
-{
- SetLocation( (const SvxShadowLocation)nVal );
-}
-
-// class SvxBoxItem ------------------------------------------------------
-
-SvxBoxItem::SvxBoxItem( const SvxBoxItem& rCpy ) :
-
- SfxPoolItem ( rCpy ),
- nTopDist ( rCpy.nTopDist ),
- nBottomDist ( rCpy.nBottomDist ),
- nLeftDist ( rCpy.nLeftDist ),
- nRightDist ( rCpy.nRightDist )
-
-{
- pTop = rCpy.GetTop() ? new SvxBorderLine( *rCpy.GetTop() ) : 0;
- pBottom = rCpy.GetBottom() ? new SvxBorderLine( *rCpy.GetBottom() ) : 0;
- pLeft = rCpy.GetLeft() ? new SvxBorderLine( *rCpy.GetLeft() ) : 0;
- pRight = rCpy.GetRight() ? new SvxBorderLine( *rCpy.GetRight() ) : 0;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBoxItem::SvxBoxItem( const sal_uInt16 nId ) :
- SfxPoolItem( nId ),
-
- pTop ( 0 ),
- pBottom ( 0 ),
- pLeft ( 0 ),
- pRight ( 0 ),
- nTopDist ( 0 ),
- nBottomDist ( 0 ),
- nLeftDist ( 0 ),
- nRightDist ( 0 )
-
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxBoxItem::~SvxBoxItem()
-{
- delete pTop;
- delete pBottom;
- delete pLeft;
- delete pRight;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBoxItem& SvxBoxItem::operator=( const SvxBoxItem& rBox )
-{
- nTopDist = rBox.nTopDist;
- nBottomDist = rBox.nBottomDist;
- nLeftDist = rBox.nLeftDist;
- nRightDist = rBox.nRightDist;
- SetLine( rBox.GetTop(), BOX_LINE_TOP );
- SetLine( rBox.GetBottom(), BOX_LINE_BOTTOM );
- SetLine( rBox.GetLeft(), BOX_LINE_LEFT );
- SetLine( rBox.GetRight(), BOX_LINE_RIGHT );
- return *this;
-}
-
-// -----------------------------------------------------------------------
-
-inline sal_Bool CmpBrdLn( const SvxBorderLine* pBrd1, const SvxBorderLine* pBrd2 )
-{
- sal_Bool bRet;
- if( 0 != pBrd1 ? 0 == pBrd2 : 0 != pBrd2 )
- bRet = sal_False;
- else
- if( !pBrd1 )
- bRet = sal_True;
- else
- bRet = (*pBrd1 == *pBrd2);
- return bRet;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxBoxItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return (
- ( nTopDist == ( (SvxBoxItem&)rAttr ).nTopDist ) &&
- ( nBottomDist == ( (SvxBoxItem&)rAttr ).nBottomDist ) &&
- ( nLeftDist == ( (SvxBoxItem&)rAttr ).nLeftDist ) &&
- ( nRightDist == ( (SvxBoxItem&)rAttr ).nRightDist ) &&
- CmpBrdLn( pTop, ( (SvxBoxItem&)rAttr ).GetTop() ) &&
- CmpBrdLn( pBottom, ( (SvxBoxItem&)rAttr ).GetBottom() ) &&
- CmpBrdLn( pLeft, ( (SvxBoxItem&)rAttr ).GetLeft() ) &&
- CmpBrdLn( pRight, ( (SvxBoxItem&)rAttr ).GetRight() ) );
-}
-
-// -----------------------------------------------------------------------
-table::BorderLine2 SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, sal_Bool bConvert)
-{
- 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;
-}
-// -----------------------------------------------------------------------
-bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- table::BorderLine2 aRetLine;
- sal_uInt16 nDist = 0;
- sal_Bool bDistMember = sal_False;
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case 0:
- {
- // 4 Borders and 5 distances
- uno::Sequence< uno::Any > aSeq( 9 );
- aSeq[0] = uno::makeAny( SvxBoxItem::SvxLineToLine(GetLeft(), bConvert) );
- aSeq[1] = uno::makeAny( SvxBoxItem::SvxLineToLine(GetRight(), bConvert) );
- aSeq[2] = uno::makeAny( SvxBoxItem::SvxLineToLine(GetBottom(), bConvert) );
- aSeq[3] = uno::makeAny( SvxBoxItem::SvxLineToLine(GetTop(), bConvert) );
- aSeq[4] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( GetDistance()) : GetDistance()));
- aSeq[5] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nTopDist ) : nTopDist ));
- aSeq[6] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nBottomDist ) : nBottomDist ));
- aSeq[7] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nLeftDist ) : nLeftDist ));
- aSeq[8] <<= uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED( nRightDist ) : nRightDist ));
- rVal = uno::makeAny( aSeq );
- return sal_True;
- }
- case MID_LEFT_BORDER:
- case LEFT_BORDER:
- aRetLine = SvxBoxItem::SvxLineToLine(GetLeft(), bConvert);
- break;
- case MID_RIGHT_BORDER:
- case RIGHT_BORDER:
- aRetLine = SvxBoxItem::SvxLineToLine(GetRight(), bConvert);
- break;
- case MID_BOTTOM_BORDER:
- case BOTTOM_BORDER:
- aRetLine = SvxBoxItem::SvxLineToLine(GetBottom(), bConvert);
- break;
- case MID_TOP_BORDER:
- case TOP_BORDER:
- aRetLine = SvxBoxItem::SvxLineToLine(GetTop(), bConvert);
- break;
- case BORDER_DISTANCE:
- nDist = GetDistance();
- bDistMember = sal_True;
- break;
- case TOP_BORDER_DISTANCE:
- nDist = nTopDist;
- bDistMember = sal_True;
- break;
- case BOTTOM_BORDER_DISTANCE:
- nDist = nBottomDist;
- bDistMember = sal_True;
- break;
- case LEFT_BORDER_DISTANCE:
- nDist = nLeftDist;
- bDistMember = sal_True;
- break;
- case RIGHT_BORDER_DISTANCE:
- nDist = nRightDist;
- bDistMember = sal_True;
- break;
- }
-
- 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 )
- {
- rSvxLine.GuessLinesWidths( rSvxLine.GetStyle(),
- sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.OuterLineWidth) : rLine.OuterLineWidth ),
- sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.InnerLineWidth) : rLine.InnerLineWidth ),
- sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.LineDistance ) : rLine.LineDistance ));
- }
-
- sal_Bool bRet = !rSvxLine.isEmpty();
- return bRet;
-}
-
-}
-
-// -----------------------------------------------------------------------
-sal_Bool SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert)
-{
- 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);
-}
-
-// -----------------------------------------------------------------------
-
-namespace
-{
-
-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;
- switch(nMemberId)
- {
- case 0:
- {
- uno::Sequence< uno::Any > aSeq;
- if (( rVal >>= aSeq ) && ( aSeq.getLength() == 9 ))
- {
- // 4 Borders and 5 distances
- 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)
- {
- if (!lcl_setLine(aSeq[n], *this, aBorders[n], bConvert))
- 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 )
- nDist = MM100_TO_TWIP(nDist);
- if ( n == 4 )
- SetDistance( sal_uInt16( nDist ));
- else
- SetDistance( sal_uInt16( nDist ), nLines[n-5] );
- }
- else
- return sal_False;
- }
-
- return sal_True;
- }
- else
- return sal_False;
- }
- case LEFT_BORDER_DISTANCE:
- bDistMember = sal_True;
- case LEFT_BORDER:
- case MID_LEFT_BORDER:
- nLine = BOX_LINE_LEFT;
- break;
- case RIGHT_BORDER_DISTANCE:
- bDistMember = sal_True;
- case RIGHT_BORDER:
- case MID_RIGHT_BORDER:
- nLine = BOX_LINE_RIGHT;
- break;
- case BOTTOM_BORDER_DISTANCE:
- bDistMember = sal_True;
- case BOTTOM_BORDER:
- case MID_BOTTOM_BORDER:
- nLine = BOX_LINE_BOTTOM;
- break;
- case TOP_BORDER_DISTANCE:
- bDistMember = sal_True;
- case TOP_BORDER:
- case MID_TOP_BORDER:
- nLine = BOX_LINE_TOP;
- break;
- }
-
- if( bDistMember || nMemberId == BORDER_DISTANCE )
- {
- sal_Int32 nDist = 0;
- if(!(rVal >>= nDist))
- return sal_False;
-
- if(nDist >= 0)
- {
- if( bConvert )
- nDist = MM100_TO_TWIP(nDist);
- if( nMemberId == BORDER_DISTANCE )
- SetDistance( sal_uInt16( nDist ));
- else
- SetDistance( sal_uInt16( nDist ), nLine );
- }
- }
- else
- {
- SvxBorderLine aLine;
- if( !rVal.hasValue() )
- return sal_False;
-
- table::BorderLine2 aBorderLine;
- if( lcl_extractBorderLine(rVal, aBorderLine) )
- {
- // usual struct
- }
- else if (rVal.getValueTypeClass() == uno::TypeClass_SEQUENCE )
- {
- // serialization for basic macro recording
- uno::Reference < script::XTypeConverter > xConverter
- ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))),
- uno::UNO_QUERY );
- uno::Sequence < uno::Any > aSeq;
- uno::Any aNew;
- try { aNew = xConverter->convertTo( rVal, ::getCppuType((const uno::Sequence < uno::Any >*)0) ); }
- catch (uno::Exception&) {}
-
- aNew >>= aSeq;
- if ( aSeq.getLength() == 4 )
- {
- sal_Int32 nVal = 0;
- if ( aSeq[0] >>= nVal )
- aBorderLine.Color = nVal;
- if ( aSeq[1] >>= nVal )
- aBorderLine.InnerLineWidth = (sal_Int16) nVal;
- if ( aSeq[2] >>= nVal )
- aBorderLine.OuterLineWidth = (sal_Int16) nVal;
- if ( aSeq[3] >>= nVal )
- aBorderLine.LineDistance = (sal_Int16) nVal;
- }
- else
- return sal_False;
- }
- else
- return sal_False;
-
- sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
- SetLine(bSet ? &aLine : 0, nLine);
- }
-
- return sal_True;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxBoxItem::Clone( SfxItemPool* ) const
-{
- return new SvxBoxItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxBoxItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreUnit,
- SfxMapUnit ePresUnit,
- XubString& rText, const IntlWrapper *pIntl
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NONE;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- {
- rText.Erase();
-
- if ( pTop )
- {
- rText = pTop->GetValueString( eCoreUnit, ePresUnit, pIntl );
- rText += cpDelim;
- }
- if( !(pTop && pBottom && pLeft && pRight &&
- *pTop == *pBottom && *pTop == *pLeft && *pTop == *pRight) )
- {
- if ( pBottom )
- {
- rText += pBottom->GetValueString( eCoreUnit, ePresUnit, pIntl );
- rText += cpDelim;
- }
- if ( pLeft )
- {
- rText += pLeft->GetValueString( eCoreUnit, ePresUnit, pIntl );
- rText += cpDelim;
- }
- if ( pRight )
- {
- rText += pRight->GetValueString( eCoreUnit, ePresUnit, pIntl );
- rText += cpDelim;
- }
- }
- rText += GetMetricText( (long)nTopDist, eCoreUnit, ePresUnit, pIntl );
- if( nTopDist != nBottomDist || nTopDist != nLeftDist ||
- nTopDist != nRightDist )
- {
- (((((rText += cpDelim)
- += GetMetricText( (long)nBottomDist, eCoreUnit,
- ePresUnit, pIntl ))
- += cpDelim)
- += GetMetricText( (long)nLeftDist, eCoreUnit, ePresUnit, pIntl ))
- += cpDelim)
- += GetMetricText( (long)nRightDist, eCoreUnit,
- ePresUnit, pIntl );
- }
- return SFX_ITEM_PRESENTATION_NAMELESS;
- }
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- if( !(pTop || pBottom || pLeft || pRight) )
- {
- rText = EE_RESSTR(RID_SVXITEMS_BORDER_NONE);
- rText += cpDelim;
- }
- else
- {
- rText = EE_RESSTR(RID_SVXITEMS_BORDER_COMPLETE);
- if( pTop && pBottom && pLeft && pRight &&
- *pTop == *pBottom && *pTop == *pLeft && *pTop == *pRight )
- {
- rText += pTop->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True );
- rText += cpDelim;
- }
- else
- {
- if ( pTop )
- {
- rText += EE_RESSTR(RID_SVXITEMS_BORDER_TOP);
- rText += pTop->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True );
- rText += cpDelim;
- }
- if ( pBottom )
- {
- rText += EE_RESSTR(RID_SVXITEMS_BORDER_BOTTOM);
- rText += pBottom->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True );
- rText += cpDelim;
- }
- if ( pLeft )
- {
- rText += EE_RESSTR(RID_SVXITEMS_BORDER_LEFT);
- rText += pLeft->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True );
- rText += cpDelim;
- }
- if ( pRight )
- {
- rText += EE_RESSTR(RID_SVXITEMS_BORDER_RIGHT);
- rText += pRight->GetValueString( eCoreUnit, ePresUnit, pIntl, sal_True );
- rText += cpDelim;
- }
- }
- }
-
- rText += EE_RESSTR(RID_SVXITEMS_BORDER_DISTANCE);
- if( nTopDist == nBottomDist && nTopDist == nLeftDist &&
- nTopDist == nRightDist )
- {
- rText += GetMetricText( (long)nTopDist, eCoreUnit,
- ePresUnit, pIntl );
- rText += EE_RESSTR(GetMetricId(ePresUnit));
- }
- else
- {
- (((rText += EE_RESSTR(RID_SVXITEMS_BORDER_TOP))
- += GetMetricText( (long)nTopDist, eCoreUnit,
- ePresUnit, pIntl ))
- += EE_RESSTR(GetMetricId(ePresUnit)))
- += cpDelim;
- (((rText += EE_RESSTR(RID_SVXITEMS_BORDER_BOTTOM))
- += GetMetricText( (long)nBottomDist, eCoreUnit,
- ePresUnit, pIntl ))
- += EE_RESSTR(GetMetricId(ePresUnit)))
- += cpDelim;
- (((rText += EE_RESSTR(RID_SVXITEMS_BORDER_LEFT))
- += GetMetricText( (long)nLeftDist, eCoreUnit,
- ePresUnit, pIntl ))
- += EE_RESSTR(GetMetricId(ePresUnit)))
- += cpDelim;
- ((rText += EE_RESSTR(RID_SVXITEMS_BORDER_RIGHT))
- += GetMetricText( (long)nRightDist, eCoreUnit,
- ePresUnit, pIntl ))
- += EE_RESSTR(GetMetricId(ePresUnit));
- }
- return SFX_ITEM_PRESENTATION_COMPLETE;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxBoxItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
-{
- rStrm << (sal_uInt16) GetDistance();
- const SvxBorderLine* pLine[ 4 ]; // top, left, right, bottom
- pLine[ 0 ] = GetTop();
- pLine[ 1 ] = GetLeft();
- pLine[ 2 ] = GetRight();
- pLine[ 3 ] = GetBottom();
-
- for( int i = 0; i < 4; i++ )
- {
- const SvxBorderLine* l = pLine[ i ];
- if( l )
- {
- rStrm << (sal_Int8) i
- << l->GetColor()
- << (sal_uInt16) l->GetOutWidth()
- << (sal_uInt16) l->GetInWidth()
- << (sal_uInt16) l->GetDistance();
- }
- }
- sal_Int8 cLine = 4;
- if( nItemVersion >= BOX_4DISTS_VERSION &&
- !(nTopDist == nLeftDist &&
- nTopDist == nRightDist &&
- nTopDist == nBottomDist) )
- {
- cLine |= 0x10;
- }
-
- rStrm << cLine;
-
- if( nItemVersion >= BOX_4DISTS_VERSION && (cLine & 0x10) != 0 )
- {
- rStrm << (sal_uInt16)nTopDist
- << (sal_uInt16)nLeftDist
- << (sal_uInt16)nRightDist
- << (sal_uInt16)nBottomDist;
- }
-
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxBoxItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxBoxItem: Gibt es ein neues Fileformat?" );
- return SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ? 0 : BOX_4DISTS_VERSION;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxBoxItem::ScaleMetrics( long nMult, long nDiv )
-{
- if ( pTop ) pTop->ScaleMetrics( nMult, nDiv );
- if ( pBottom ) pBottom->ScaleMetrics( nMult, nDiv );
- if ( pLeft ) pLeft->ScaleMetrics( nMult, nDiv );
- if ( pRight ) pBottom->ScaleMetrics( nMult, nDiv );
- nTopDist = (sal_uInt16)Scale( nTopDist, nMult, nDiv );
- nBottomDist = (sal_uInt16)Scale( nBottomDist, nMult, nDiv );
- nLeftDist = (sal_uInt16)Scale( nLeftDist, nMult, nDiv );
- nRightDist = (sal_uInt16)Scale( nRightDist, nMult, nDiv );
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxBoxItem::HasMetrics() const
-{
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const
-{
- sal_uInt16 nDistance;
- rStrm >> nDistance;
- SvxBoxItem* pAttr = new SvxBoxItem( Which() );
-
- sal_uInt16 aLineMap[4] = { BOX_LINE_TOP, BOX_LINE_LEFT,
- BOX_LINE_RIGHT, BOX_LINE_BOTTOM };
-
- sal_Int8 cLine;
- while( sal_True )
- {
- rStrm >> cLine;
-
- if( cLine > 3 )
- break;
- sal_uInt16 nOutline, nInline, _nDistance;
- Color aColor;
- rStrm >> aColor >> nOutline >> nInline >> _nDistance;
- SvxBorderLine aBorder( &aColor );
- aBorder.GuessLinesWidths( NO_STYLE, nOutline, nInline, _nDistance );
-
- pAttr->SetLine( &aBorder, aLineMap[cLine] );
- }
-
- if( nIVersion >= BOX_4DISTS_VERSION && (cLine&0x10) != 0 )
- {
- for( sal_uInt16 i=0; i < 4; i++ )
- {
- sal_uInt16 nDist;
- rStrm >> nDist;
- pAttr->SetDistance( nDist, aLineMap[i] );
- }
- }
- else
- {
- pAttr->SetDistance( nDistance );
- }
-
- return pAttr;
-}
-
-// -----------------------------------------------------------------------
-
-const SvxBorderLine *SvxBoxItem::GetLine( sal_uInt16 nLine ) const
-{
- const SvxBorderLine *pRet = 0;
-
- switch ( nLine )
- {
- case BOX_LINE_TOP:
- pRet = pTop;
- break;
- case BOX_LINE_BOTTOM:
- pRet = pBottom;
- break;
- case BOX_LINE_LEFT:
- pRet = pLeft;
- break;
- case BOX_LINE_RIGHT:
- pRet = pRight;
- break;
- default:
- OSL_FAIL( "wrong line" );
- break;
- }
-
- return pRet;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBoxItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine )
-{
- SvxBorderLine* pTmp = pNew ? new SvxBorderLine( *pNew ) : 0;
-
- switch ( nLine )
- {
- case BOX_LINE_TOP:
- delete pTop;
- pTop = pTmp;
- break;
- case BOX_LINE_BOTTOM:
- delete pBottom;
- pBottom = pTmp;
- break;
- case BOX_LINE_LEFT:
- delete pLeft;
- pLeft = pTmp;
- break;
- case BOX_LINE_RIGHT:
- delete pRight;
- pRight = pTmp;
- break;
- default:
- delete pTmp;
- OSL_FAIL( "wrong line" );
- }
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxBoxItem::GetDistance() const
-{
- // The smallest distance that is not 0 will be returned.
- sal_uInt16 nDist = nTopDist;
- if( nBottomDist && (!nDist || nBottomDist < nDist) )
- nDist = nBottomDist;
- if( nLeftDist && (!nDist || nLeftDist < nDist) )
- nDist = nLeftDist;
- if( nRightDist && (!nDist || nRightDist < nDist) )
- nDist = nRightDist;
-
- return nDist;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxBoxItem::GetDistance( sal_uInt16 nLine ) const
-{
- sal_uInt16 nDist = 0;
- switch ( nLine )
- {
- case BOX_LINE_TOP:
- nDist = nTopDist;
- break;
- case BOX_LINE_BOTTOM:
- nDist = nBottomDist;
- break;
- case BOX_LINE_LEFT:
- nDist = nLeftDist;
- break;
- case BOX_LINE_RIGHT:
- nDist = nRightDist;
- break;
- default:
- OSL_FAIL( "wrong line" );
- }
-
- return nDist;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBoxItem::SetDistance( sal_uInt16 nNew, sal_uInt16 nLine )
-{
- switch ( nLine )
- {
- case BOX_LINE_TOP:
- nTopDist = nNew;
- break;
- case BOX_LINE_BOTTOM:
- nBottomDist = nNew;
- break;
- case BOX_LINE_LEFT:
- nLeftDist = nNew;
- break;
- case BOX_LINE_RIGHT:
- nRightDist = nNew;
- break;
- default:
- OSL_FAIL( "wrong line" );
- }
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxBoxItem::CalcLineSpace( sal_uInt16 nLine, sal_Bool bIgnoreLine ) const
-{
- SvxBorderLine* pTmp = 0;
- sal_uInt16 nDist = 0;
- switch ( nLine )
- {
- case BOX_LINE_TOP:
- pTmp = pTop;
- nDist = nTopDist;
- break;
- case BOX_LINE_BOTTOM:
- pTmp = pBottom;
- nDist = nBottomDist;
- break;
- case BOX_LINE_LEFT:
- pTmp = pLeft;
- nDist = nLeftDist;
- break;
- case BOX_LINE_RIGHT:
- pTmp = pRight;
- nDist = nRightDist;
- break;
- default:
- OSL_FAIL( "wrong line" );
- }
-
- if( pTmp )
- {
- nDist = nDist + (sal_uInt16)(pTmp->GetOutWidth()) + (sal_uInt16)(pTmp->GetInWidth()) + (sal_uInt16)(pTmp->GetDistance());
- }
- else if( !bIgnoreLine )
- nDist = 0;
- return nDist;
-}
-
-// class SvxBoxInfoItem --------------------------------------------------
-
-SvxBoxInfoItem::SvxBoxInfoItem( const sal_uInt16 nId ) :
- SfxPoolItem( nId ),
- pHori ( 0 ),
- pVert ( 0 ),
- mbEnableHor( false ),
- mbEnableVer( false ),
- nDefDist( 0 )
-{
- bDist = bMinDist = sal_False;
- ResetFlags();
-}
-
-// -----------------------------------------------------------------------
-
-SvxBoxInfoItem::SvxBoxInfoItem( const SvxBoxInfoItem& rCpy ) :
- SfxPoolItem( rCpy ),
- mbEnableHor( rCpy.mbEnableHor ),
- mbEnableVer( rCpy.mbEnableVer )
-{
- pHori = rCpy.GetHori() ? new SvxBorderLine( *rCpy.GetHori() ) : 0;
- pVert = rCpy.GetVert() ? new SvxBorderLine( *rCpy.GetVert() ) : 0;
- bDist = rCpy.IsDist();
- bMinDist = rCpy.IsMinDist();
- nValidFlags = rCpy.nValidFlags;
- nDefDist = rCpy.GetDefDist();
-}
-
-// -----------------------------------------------------------------------
-
-SvxBoxInfoItem::~SvxBoxInfoItem()
-{
- delete pHori;
- delete pVert;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBoxInfoItem &SvxBoxInfoItem::operator=( const SvxBoxInfoItem& rCpy )
-{
- delete pHori;
- delete pVert;
- pHori = rCpy.GetHori() ? new SvxBorderLine( *rCpy.GetHori() ) : 0;
- pVert = rCpy.GetVert() ? new SvxBorderLine( *rCpy.GetVert() ) : 0;
- mbEnableHor = rCpy.mbEnableHor;
- mbEnableVer = rCpy.mbEnableVer;
- bDist = rCpy.IsDist();
- bMinDist = rCpy.IsMinDist();
- nValidFlags = rCpy.nValidFlags;
- nDefDist = rCpy.GetDefDist();
- return *this;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxBoxInfoItem::operator==( const SfxPoolItem& rAttr ) const
-{
- SvxBoxInfoItem& rBoxInfo = (SvxBoxInfoItem&)rAttr;
-
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return ( mbEnableHor == rBoxInfo.mbEnableHor
- && mbEnableVer == rBoxInfo.mbEnableVer
- && bDist == rBoxInfo.IsDist()
- && bMinDist == rBoxInfo.IsMinDist()
- && nValidFlags == rBoxInfo.nValidFlags
- && nDefDist == rBoxInfo.GetDefDist()
- && CmpBrdLn( pHori, rBoxInfo.GetHori() )
- && CmpBrdLn( pVert, rBoxInfo.GetVert() )
- );
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBoxInfoItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine )
-{
- SvxBorderLine* pTmp = pNew ? new SvxBorderLine( *pNew ) : 0;
-
- if ( BOXINFO_LINE_HORI == nLine )
- {
- delete pHori;
- pHori = pTmp;
- }
- else if ( BOXINFO_LINE_VERT == nLine )
- {
- delete pVert;
- pVert = pTmp;
- }
- else
- {
- delete pTmp;
- OSL_FAIL( "wrong line" );
- }
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxBoxInfoItem::Clone( SfxItemPool* ) const
-{
- return new SvxBoxInfoItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxBoxInfoItem::GetPresentation
-(
- SfxItemPresentation /*ePres*/,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
-) const
-{
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxBoxInfoItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- sal_Int8 cFlags = 0;
-
- if ( IsTable() )
- cFlags |= 0x01;
- if ( IsDist() )
- cFlags |= 0x02;
- if ( IsMinDist() )
- cFlags |= 0x04;
- rStrm << (sal_Int8) cFlags
- << (sal_uInt16) GetDefDist();
- const SvxBorderLine* pLine[ 2 ];
- pLine[ 0 ] = GetHori();
- pLine[ 1 ] = GetVert();
-
- for( int i = 0; i < 2; i++ )
- {
- const SvxBorderLine* l = pLine[ i ];
- if( l )
- {
- rStrm << (char) i
- << l->GetColor()
- << (short) l->GetOutWidth()
- << (short) l->GetInWidth()
- << (short) l->GetDistance();
- }
- }
- rStrm << (char) 2;
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-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 true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxBoxInfoItem::HasMetrics() const
-{
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxBoxInfoItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Int8 cFlags;
- sal_uInt16 _nDefDist;
- rStrm >> cFlags >> _nDefDist;
-
- SvxBoxInfoItem* pAttr = new SvxBoxInfoItem( Which() );
-
- pAttr->SetTable ( ( cFlags & 0x01 ) != 0 );
- pAttr->SetDist ( ( cFlags & 0x02 ) != 0 );
- pAttr->SetMinDist( ( cFlags & 0x04 ) != 0 );
- pAttr->SetDefDist( _nDefDist );
-
- while( sal_True )
- {
- sal_Int8 cLine;
- rStrm >> cLine;
-
- if( cLine > 1 )
- break;
- short nOutline, nInline, nDistance;
- Color aColor;
- rStrm >> aColor >> nOutline >> nInline >> nDistance;
- SvxBorderLine aBorder( &aColor );
- aBorder.GuessLinesWidths( NO_STYLE, nOutline, nInline, nDistance );
-
- switch( cLine )
- {
- case 0: pAttr->SetLine( &aBorder, BOXINFO_LINE_HORI ); break;
- case 1: pAttr->SetLine( &aBorder, BOXINFO_LINE_VERT ); break;
- }
- }
- return pAttr;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBoxInfoItem::ResetFlags()
-{
- nValidFlags = 0x7F; // all valid except Disable
-}
-
-bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- table::BorderLine2 aRetLine;
- sal_Int16 nVal=0;
- sal_Bool bIntMember = sal_False;
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case 0:
- {
- // 2 BorderLines, flags, valid flags and distance
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq( 5 );
- aSeq[0] = ::com::sun::star::uno::makeAny( SvxBoxItem::SvxLineToLine( pHori, bConvert) );
- aSeq[1] = ::com::sun::star::uno::makeAny( SvxBoxItem::SvxLineToLine( pVert, bConvert) );
- if ( IsTable() )
- nVal |= 0x01;
- if ( IsDist() )
- nVal |= 0x02;
- if ( IsMinDist() )
- nVal |= 0x04;
- aSeq[2] = ::com::sun::star::uno::makeAny( nVal );
- nVal = nValidFlags;
- aSeq[3] = ::com::sun::star::uno::makeAny( nVal );
- aSeq[4] = ::com::sun::star::uno::makeAny( (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(GetDefDist()) : GetDefDist()) );
- rVal = ::com::sun::star::uno::makeAny( aSeq );
- return sal_True;
- }
-
- case MID_HORIZONTAL:
- aRetLine = SvxBoxItem::SvxLineToLine( pHori, bConvert);
- break;
- case MID_VERTICAL:
- aRetLine = SvxBoxItem::SvxLineToLine( pVert, bConvert);
- break;
- case MID_FLAGS:
- bIntMember = sal_True;
- if ( IsTable() )
- nVal |= 0x01;
- if ( IsDist() )
- nVal |= 0x02;
- if ( IsMinDist() )
- nVal |= 0x04;
- rVal <<= nVal;
- break;
- case MID_VALIDFLAGS:
- bIntMember = sal_True;
- nVal = nValidFlags;
- rVal <<= nVal;
- break;
- case MID_DISTANCE:
- bIntMember = sal_True;
- rVal <<= (sal_Int32)(bConvert ? TWIP_TO_MM100_UNSIGNED(GetDefDist()) : GetDefDist());
- break;
- default: OSL_FAIL("Wrong MemberId!"); return false;
- }
-
- if( !bIntMember )
- rVal <<= aRetLine;
-
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
- sal_Bool bRet;
- switch(nMemberId)
- {
- case 0:
- {
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq;
- if (( rVal >>= aSeq ) && ( aSeq.getLength() == 5 ))
- {
- // 2 BorderLines, flags, valid flags and distance
- if (!lcl_setLine(aSeq[0], *this, BOXINFO_LINE_HORI, bConvert))
- return sal_False;
- 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 );
- SetDist ( ( nFlags & 0x02 ) != 0 );
- SetMinDist( ( nFlags & 0x04 ) != 0 );
- }
- else
- return sal_False;
- if ( aSeq[3] >>= nFlags )
- nValidFlags = (sal_uInt8)nFlags;
- else
- return sal_False;
- if (( aSeq[4] >>= nVal ) && ( nVal >= 0 ))
- {
- if( bConvert )
- nVal = MM100_TO_TWIP(nVal);
- SetDefDist( (sal_uInt16)nVal );
- }
- }
- return sal_True;
- }
-
- case MID_HORIZONTAL:
- case MID_VERTICAL:
- {
- if( !rVal.hasValue() )
- return sal_False;
-
- table::BorderLine2 aBorderLine;
- if( lcl_extractBorderLine(rVal, aBorderLine) )
- {
- // usual struct
- }
- else if (rVal.getValueTypeClass() == uno::TypeClass_SEQUENCE )
- {
- // serialization for basic macro recording
- uno::Reference < script::XTypeConverter > xConverter
- ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))),
- uno::UNO_QUERY );
- uno::Any aNew;
- uno::Sequence < uno::Any > aSeq;
- try { aNew = xConverter->convertTo( rVal, ::getCppuType((const uno::Sequence < uno::Any >*)0) ); }
- catch (uno::Exception&) {}
-
- if( (aNew >>= aSeq) && aSeq.getLength() == 4 )
- {
- sal_Int32 nVal = 0;
- if ( aSeq[0] >>= nVal )
- aBorderLine.Color = nVal;
- if ( aSeq[1] >>= nVal )
- aBorderLine.InnerLineWidth = (sal_Int16) nVal;
- if ( aSeq[2] >>= nVal )
- aBorderLine.OuterLineWidth = (sal_Int16) nVal;
- if ( aSeq[3] >>= nVal )
- aBorderLine.LineDistance = (sal_Int16) nVal;
- }
- else
- return sal_False;
- }
- else if (rVal.getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence < sal_Int16 >*)0) )
- {
- // serialization for basic macro recording
- ::com::sun::star::uno::Sequence < sal_Int16 > aSeq;
- rVal >>= aSeq;
- if ( aSeq.getLength() == 4 )
- {
- aBorderLine.Color = aSeq[0];
- aBorderLine.InnerLineWidth = aSeq[1];
- aBorderLine.OuterLineWidth = aSeq[2];
- aBorderLine.LineDistance = aSeq[3];
- }
- else
- return sal_False;
- }
- else
- return sal_False;
-
- SvxBorderLine aLine;
- sal_Bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
- if ( bSet )
- SetLine( &aLine, nMemberId == MID_HORIZONTAL ? BOXINFO_LINE_HORI : BOXINFO_LINE_VERT );
- break;
- }
- case MID_FLAGS:
- {
- sal_Int16 nFlags = sal_Int16();
- bRet = (rVal >>= nFlags);
- if ( bRet )
- {
- SetTable ( ( nFlags & 0x01 ) != 0 );
- SetDist ( ( nFlags & 0x02 ) != 0 );
- SetMinDist( ( nFlags & 0x04 ) != 0 );
- }
-
- break;
- }
- case MID_VALIDFLAGS:
- {
- sal_Int16 nFlags = sal_Int16();
- bRet = (rVal >>= nFlags);
- if ( bRet )
- nValidFlags = (sal_uInt8)nFlags;
- break;
- }
- case MID_DISTANCE:
- {
- sal_Int32 nVal = 0;
- bRet = (rVal >>= nVal);
- if ( bRet && nVal>=0 )
- {
- if( bConvert )
- nVal = MM100_TO_TWIP(nVal);
- SetDefDist( (sal_uInt16)nVal );
- }
- break;
- }
- default: OSL_FAIL("Wrong MemberId!"); return sal_False;
- }
-
- return sal_True;
-}
-
-// class SvxFmtBreakItem -------------------------------------------------
-
-int SvxFmtBreakItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "unequal types" );
-
- return GetValue() == ( (SvxFmtBreakItem&)rAttr ).GetValue();
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxFmtBreakItem::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 = GetValueTextByPos( GetValue() );
- return ePres;
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxFmtBreakItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- DBG_ASSERT( nPos < SVX_BREAK_END, "enum overflow!" );
- XubString aStr( EditResId( RID_SVXITEMS_BREAK_BEGIN + nPos ) );
- return aStr;
-}
-
-// -----------------------------------------------------------------------
-bool SvxFmtBreakItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
-{
- style::BreakType eBreak = style::BreakType_NONE;
- switch ( (SvxBreak)GetValue() )
- {
- case SVX_BREAK_COLUMN_BEFORE: eBreak = style::BreakType_COLUMN_BEFORE; break;
- case SVX_BREAK_COLUMN_AFTER: eBreak = style::BreakType_COLUMN_AFTER ; break;
- case SVX_BREAK_COLUMN_BOTH: eBreak = style::BreakType_COLUMN_BOTH ; break;
- case SVX_BREAK_PAGE_BEFORE: eBreak = style::BreakType_PAGE_BEFORE ; break;
- case SVX_BREAK_PAGE_AFTER: eBreak = style::BreakType_PAGE_AFTER ; break;
- case SVX_BREAK_PAGE_BOTH: eBreak = style::BreakType_PAGE_BOTH ; break;
- default: ;//prevent warning
- }
- rVal <<= eBreak;
- return true;
-}
-// -----------------------------------------------------------------------
-bool SvxFmtBreakItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
-{
- style::BreakType nBreak;
-
- if(!(rVal >>= nBreak))
- {
- sal_Int32 nValue = 0;
- if(!(rVal >>= nValue))
- return sal_False;
-
- nBreak = (style::BreakType) nValue;
- }
-
- SvxBreak eBreak = SVX_BREAK_NONE;
- switch( nBreak )
- {
- case style::BreakType_COLUMN_BEFORE: eBreak = SVX_BREAK_COLUMN_BEFORE; break;
- case style::BreakType_COLUMN_AFTER: eBreak = SVX_BREAK_COLUMN_AFTER; break;
- case style::BreakType_COLUMN_BOTH: eBreak = SVX_BREAK_COLUMN_BOTH; break;
- case style::BreakType_PAGE_BEFORE: eBreak = SVX_BREAK_PAGE_BEFORE; break;
- case style::BreakType_PAGE_AFTER: eBreak = SVX_BREAK_PAGE_AFTER; break;
- case style::BreakType_PAGE_BOTH: eBreak = SVX_BREAK_PAGE_BOTH; break;
- default: ;//prevent warning
- }
- SetValue((sal_uInt16) eBreak);
-
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFmtBreakItem::Clone( SfxItemPool* ) const
-{
- return new SvxFmtBreakItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxFmtBreakItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
-{
- rStrm << (sal_Int8)GetValue();
- if( FMTBREAK_NOAUTO > nItemVersion )
- rStrm << (sal_Int8)0x01;
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxFmtBreakItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxFmtBreakItem: Is there a new file format? ");
- return SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ? 0 : FMTBREAK_NOAUTO;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFmtBreakItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const
-{
- sal_Int8 eBreak, bDummy;
- rStrm >> eBreak;
- if( FMTBREAK_NOAUTO > nVersion )
- rStrm >> bDummy;
- return new SvxFmtBreakItem( (const SvxBreak)eBreak, Which() );
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxFmtBreakItem::GetValueCount() const
-{
- return SVX_BREAK_END; // SVX_BREAK_PAGE_BOTH + 1
-}
-
-// class SvxFmtKeepItem -------------------------------------------------
-
-SfxPoolItem* SvxFmtKeepItem::Clone( SfxItemPool* ) const
-{
- return new SvxFmtKeepItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxFmtKeepItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Int8)GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFmtKeepItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Int8 bIsKeep;
- rStrm >> bIsKeep;
- return new SvxFmtKeepItem( sal_Bool( bIsKeep != 0 ), Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxFmtKeepItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
- ) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nId = RID_SVXITEMS_FMTKEEP_FALSE;
-
- if ( GetValue() )
- nId = RID_SVXITEMS_FMTKEEP_TRUE;
- rText = EE_RESSTR(nId);
- return ePres;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxLineItem ------------------------------------------------------
-
-SvxLineItem::SvxLineItem( const sal_uInt16 nId ) :
-
- SfxPoolItem ( nId ),
-
- pLine( NULL )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxLineItem::SvxLineItem( const SvxLineItem& rCpy ) :
-
- SfxPoolItem ( rCpy )
-{
- pLine = rCpy.GetLine() ? new SvxBorderLine( *rCpy.GetLine() ) : 0;
-}
-
-// -----------------------------------------------------------------------
-
-SvxLineItem::~SvxLineItem()
-{
- delete pLine;
-}
-
-// -----------------------------------------------------------------------
-
-SvxLineItem& SvxLineItem::operator=( const SvxLineItem& rLine )
-{
- SetLine( rLine.GetLine() );
-
- return *this;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxLineItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return CmpBrdLn( pLine, ((SvxLineItem&)rAttr).GetLine() );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxLineItem::Clone( SfxItemPool* ) const
-{
- return new SvxLineItem( *this );
-}
-
-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 true;
- }
- else if ( pLine )
- {
- switch ( nMemId )
- {
- case MID_FG_COLOR: rVal <<= sal_Int32(pLine->GetColor().GetColor()); break;
- case MID_OUTER_WIDTH: rVal <<= sal_Int32(pLine->GetOutWidth()); break;
- case MID_INNER_WIDTH: rVal <<= sal_Int32(pLine->GetInWidth( )); break;
- case MID_DISTANCE: rVal <<= sal_Int32(pLine->GetDistance()); break;
- default:
- OSL_FAIL( "Wrong MemberId" );
- return false;
- }
- }
-
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-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::BorderLine2 aLine;
- if ( lcl_extractBorderLine(rVal, aLine) )
- {
- if ( !pLine )
- pLine = new SvxBorderLine;
- if( !SvxBoxItem::LineToSvxLine(aLine, *pLine, bConvert) )
- DELETEZ( pLine );
- return true;
- }
- return false;
- }
- else if ( rVal >>= nVal )
- {
- if ( !pLine )
- pLine = new SvxBorderLine;
-
- switch ( nMemId )
- {
- case MID_FG_COLOR: pLine->SetColor( Color(nVal) ); break;
- case MID_LINE_STYLE: pLine->SetStyle((SvxBorderStyle)nVal); break;
- default:
- OSL_FAIL( "Wrong MemberId" );
- return sal_False;
- }
-
- return true;
- }
-
- return false;
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxLineItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreUnit,
- SfxMapUnit ePresUnit,
- XubString& rText, const IntlWrapper *pIntl
-) const
-{
- rText.Erase();
-
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- return SFX_ITEM_PRESENTATION_NONE;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- if ( pLine )
- rText = pLine->GetValueString( eCoreUnit, ePresUnit, pIntl,
- (SFX_ITEM_PRESENTATION_COMPLETE == ePres) );
- return ePres;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- if( pLine )
- {
- rStrm << pLine->GetColor()
- << (short)pLine->GetOutWidth()
- << (short)pLine->GetInWidth()
- << (short)pLine->GetDistance();
- }
- else
- rStrm << Color() << (short)0 << (short)0 << (short)0;
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxLineItem::ScaleMetrics( long nMult, long nDiv )
-{
- if ( pLine ) pLine->ScaleMetrics( nMult, nDiv );
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxLineItem::HasMetrics() const
-{
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxLineItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- SvxLineItem* _pLine = new SvxLineItem( Which() );
- short nOutline, nInline, nDistance;
- Color aColor;
-
- rStrm >> aColor >> nOutline >> nInline >> nDistance;
- if( nOutline )
- {
- SvxBorderLine aLine( &aColor );
- aLine.GuessLinesWidths( NO_STYLE, nOutline, nInline, nDistance );
- _pLine->SetLine( &aLine );
- }
- return _pLine;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxLineItem::SetLine( const SvxBorderLine* pNew )
-{
- delete pLine;
- pLine = pNew ? new SvxBorderLine( *pNew ) : 0;
-}
-
-#ifdef _MSC_VER
-#pragma optimize ( "", off )
-#endif
-
-// class SvxBrushItem ----------------------------------------------------
-
-#define LOAD_GRAPHIC ((sal_uInt16)0x0001)
-#define LOAD_LINK ((sal_uInt16)0x0002)
-#define LOAD_FILTER ((sal_uInt16)0x0004)
-
-// class SvxBrushItem_Impl -----------------------------------------------
-
-class SvxBrushItem_Impl
-{
-public:
- GraphicObject* pGraphicObject;
- sal_Int8 nGraphicTransparency; //contains a percentage value which is
- //copied to the GraphicObject when necessary
- Link aDoneLink;
- SvStream* pStream;
-
- SvxBrushItem_Impl( GraphicObject* p ) : pGraphicObject( p ), nGraphicTransparency(0), pStream(0) {}
-};
-
-// -----------------------------------------------------------------------
-
-void SvxBrushItem::SetDoneLink( const Link& rLink )
-{
- pImpl->aDoneLink = rLink;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBrushItem::SvxBrushItem( sal_uInt16 _nWhich ) :
-
- SfxPoolItem( _nWhich ),
-
- aColor ( COL_TRANSPARENT ),
- pImpl ( new SvxBrushItem_Impl( 0 ) ),
- pStrLink ( NULL ),
- pStrFilter ( NULL ),
- eGraphicPos ( GPOS_NONE ),
- bLoadAgain ( sal_True )
-
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxBrushItem::SvxBrushItem( const Color& rColor, sal_uInt16 _nWhich) :
-
- SfxPoolItem( _nWhich ),
-
- aColor ( rColor ),
- pImpl ( new SvxBrushItem_Impl( 0 ) ),
- pStrLink ( NULL ),
- pStrFilter ( NULL ),
- eGraphicPos ( GPOS_NONE ),
- bLoadAgain ( sal_True )
-
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxBrushItem::SvxBrushItem( const Graphic& rGraphic, SvxGraphicPosition ePos,
- sal_uInt16 _nWhich ) :
-
- SfxPoolItem( _nWhich ),
-
- aColor ( COL_TRANSPARENT ),
- pImpl ( new SvxBrushItem_Impl( new GraphicObject( rGraphic ) ) ),
- pStrLink ( NULL ),
- pStrFilter ( NULL ),
- eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
- bLoadAgain ( sal_True )
-
-{
- DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
-}
-
-// -----------------------------------------------------------------------
-
-SvxBrushItem::SvxBrushItem( const GraphicObject& rGraphicObj,
- SvxGraphicPosition ePos, sal_uInt16 _nWhich ) :
-
- SfxPoolItem( _nWhich ),
-
- aColor ( COL_TRANSPARENT ),
- pImpl ( new SvxBrushItem_Impl( new GraphicObject( rGraphicObj ) ) ),
- pStrLink ( NULL ),
- pStrFilter ( NULL ),
- eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
- bLoadAgain ( sal_True )
-
-{
- DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
-}
-
-// -----------------------------------------------------------------------
-
-SvxBrushItem::SvxBrushItem(
- const String& rLink, const String& rFilter,
- SvxGraphicPosition ePos, sal_uInt16 _nWhich ) :
-
- SfxPoolItem( _nWhich ),
-
- aColor ( COL_TRANSPARENT ),
- pImpl ( new SvxBrushItem_Impl( NULL ) ),
- pStrLink ( new String( rLink ) ),
- pStrFilter ( new String( rFilter ) ),
- eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
- bLoadAgain ( sal_True )
-
-{
- DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
-}
-
-// -----------------------------------------------------------------------
-
-SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
- sal_uInt16 _nWhich ) :
-
- SfxPoolItem( _nWhich ),
-
- aColor ( COL_TRANSPARENT ),
- pImpl ( new SvxBrushItem_Impl( NULL ) ),
- pStrLink ( NULL ),
- pStrFilter ( NULL ),
- eGraphicPos ( GPOS_NONE )
-
-{
- sal_Bool bTrans;
- Color aTempColor;
- Color aTempFillColor;
- sal_Int8 nStyle;
-
- rStream >> bTrans;
- rStream >> aTempColor;
- rStream >> aTempFillColor;
- rStream >> nStyle;
-
- switch ( nStyle )
- {
- case 8://BRUSH_25:
- {
- sal_uInt32 nRed = aTempColor.GetRed();
- sal_uInt32 nGreen = aTempColor.GetGreen();
- sal_uInt32 nBlue = aTempColor.GetBlue();
- nRed += (sal_uInt32)(aTempFillColor.GetRed())*2;
- nGreen += (sal_uInt32)(aTempFillColor.GetGreen())*2;
- nBlue += (sal_uInt32)(aTempFillColor.GetBlue())*2;
- aColor = Color( (sal_Int8)(nRed/3), (sal_Int8)(nGreen/3), (sal_Int8)(nBlue/3) );
- }
- break;
-
- case 9://BRUSH_50:
- {
- sal_uInt32 nRed = aTempColor.GetRed();
- sal_uInt32 nGreen = aTempColor.GetGreen();
- sal_uInt32 nBlue = aTempColor.GetBlue();
- nRed += (sal_uInt32)(aTempFillColor.GetRed());
- nGreen += (sal_uInt32)(aTempFillColor.GetGreen());
- nBlue += (sal_uInt32)(aTempFillColor.GetBlue());
- aColor = Color( (sal_Int8)(nRed/2), (sal_Int8)(nGreen/2), (sal_Int8)(nBlue/2) );
- }
- break;
-
- case 10://BRUSH_75:
- {
- sal_uInt32 nRed = aTempColor.GetRed()*2;
- sal_uInt32 nGreen = aTempColor.GetGreen()*2;
- sal_uInt32 nBlue = aTempColor.GetBlue()*2;
- nRed += (sal_uInt32)(aTempFillColor.GetRed());
- nGreen += (sal_uInt32)(aTempFillColor.GetGreen());
- nBlue += (sal_uInt32)(aTempFillColor.GetBlue());
- aColor = Color( (sal_Int8)(nRed/3), (sal_Int8)(nGreen/3), (sal_Int8)(nBlue/3) );
- }
- break;
-
- case 0://BRUSH_NULL:
- aColor = Color( COL_TRANSPARENT );
- break;
-
- default:
- aColor = aTempColor;
- }
-
- if ( nVersion >= BRUSH_GRAPHIC_VERSION )
- {
- sal_uInt16 nDoLoad = 0;
- sal_Int8 nPos;
-
- rStream >> nDoLoad;
-
- if ( nDoLoad & LOAD_GRAPHIC )
- {
- Graphic aGraphic;
-
- rStream >> aGraphic;
- pImpl->pGraphicObject = new GraphicObject( aGraphic );
-
- if( SVSTREAM_FILEFORMAT_ERROR == rStream.GetError() )
- {
- rStream.ResetError();
- rStream.SetError( ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT|
- ERRCODE_WARNING_MASK );
- }
- }
-
- if ( nDoLoad & LOAD_LINK )
- {
- String aRel;
- // UNICODE: rStream >> aRel;
- rStream.ReadByteString(aRel);
-
- // TODO/MBA: how can we get a BaseURL here?!
- OSL_FAIL("No BaseURL!");
- String aAbs = INetURLObject::GetAbsURL( String(), aRel );
- DBG_ASSERT( aAbs.Len(), "Invalid URL!" );
- pStrLink = new String( aAbs );
- }
-
- if ( nDoLoad & LOAD_FILTER )
- {
- pStrFilter = new String;
- // UNICODE: rStream >> *pStrFilter;
- rStream.ReadByteString(*pStrFilter);
- }
-
- rStream >> nPos;
-
- eGraphicPos = (SvxGraphicPosition)nPos;
- }
-}
-
-// -----------------------------------------------------------------------
-
-SvxBrushItem::SvxBrushItem( const SvxBrushItem& rItem ) :
-
- SfxPoolItem( rItem.Which() ),
-
- pImpl ( new SvxBrushItem_Impl( NULL ) ),
- pStrLink ( NULL ),
- pStrFilter ( NULL ),
- eGraphicPos ( GPOS_NONE ),
- bLoadAgain ( sal_True )
-
-{
- *this = rItem;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBrushItem::~SvxBrushItem()
-{
- delete pImpl->pGraphicObject;
- delete pImpl;
- delete pStrLink;
- delete pStrFilter;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxBrushItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
-{
- return BRUSH_GRAPHIC_VERSION;
-}
-
-// -----------------------------------------------------------------------
-inline sal_Int8 lcl_PercentToTransparency(long nPercent)
-{
- //0xff must not be returned!
- return sal_Int8(nPercent ? (50 + 0xfe * nPercent) / 100 : 0);
-}
-inline sal_Int8 lcl_TransparencyToPercent(sal_Int32 nTrans)
-{
- return (sal_Int8)((nTrans * 100 + 127) / 254);
-}
-
-bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId)
- {
- case MID_BACK_COLOR:
- rVal <<= (sal_Int32)( aColor.GetColor() );
- break;
- case MID_BACK_COLOR_R_G_B:
- rVal <<= (sal_Int32)( aColor.GetRGBColor() );
- break;
- case MID_BACK_COLOR_TRANSPARENCY:
- rVal <<= lcl_TransparencyToPercent(aColor.GetTransparency());
- break;
- case MID_GRAPHIC_POSITION:
- rVal <<= (style::GraphicLocation)(sal_Int16)eGraphicPos;
- break;
-
- case MID_GRAPHIC:
- DBG_ERRORFILE( "not implemented" );
- break;
-
- case MID_GRAPHIC_TRANSPARENT:
- rVal = Bool2Any( aColor.GetTransparency() == 0xff );
- break;
-
- case MID_GRAPHIC_URL:
- {
- OUString sLink;
- if ( pStrLink )
- sLink = *pStrLink;
- else if( pImpl->pGraphicObject )
- {
- OUString sPrefix(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
- String sId( pImpl->pGraphicObject->GetUniqueID(),
- RTL_TEXTENCODING_ASCII_US );
- sLink = sPrefix;
- sLink += OUString(sId);
- }
- rVal <<= sLink;
- }
- break;
-
- case MID_GRAPHIC_FILTER:
- {
- OUString sFilter;
- if ( pStrFilter )
- sFilter = *pStrFilter;
- rVal <<= sFilter;
- }
- break;
- case MID_GRAPHIC_TRANSPARENCY :
- rVal <<= pImpl->nGraphicTransparency;
- break;
- }
-
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId)
- {
- case MID_BACK_COLOR:
- case MID_BACK_COLOR_R_G_B:
- {
- sal_Int32 nCol = 0;
- if ( !( rVal >>= nCol ) )
- return sal_False;
- if(MID_BACK_COLOR_R_G_B == nMemberId)
- {
- nCol = COLORDATA_RGB( nCol );
- nCol += aColor.GetColor() & 0xff000000;
- }
- aColor = Color( nCol );
- }
- break;
- case MID_BACK_COLOR_TRANSPARENCY:
- {
- sal_Int32 nTrans = 0;
- if ( !( rVal >>= nTrans ) || nTrans < 0 || nTrans > 100 )
- return sal_False;
- aColor.SetTransparency(lcl_PercentToTransparency(nTrans));
- }
- break;
-
- case MID_GRAPHIC_POSITION:
- {
- style::GraphicLocation eLocation;
- if ( !( rVal>>=eLocation ) )
- {
- sal_Int32 nValue = 0;
- if ( !( rVal >>= nValue ) )
- return sal_False;
- eLocation = (style::GraphicLocation)nValue;
- }
- SetGraphicPos( (SvxGraphicPosition)(sal_uInt16)eLocation );
- }
- break;
-
- case MID_GRAPHIC:
- DBG_ERRORFILE( "not implemented" );
- break;
-
- case MID_GRAPHIC_TRANSPARENT:
- aColor.SetTransparency( Any2Bool( rVal ) ? 0xff : 0 );
- break;
-
- case MID_GRAPHIC_URL:
- {
- if ( rVal.getValueType() == ::getCppuType( (OUString*)0 ) )
- {
- OUString sLink;
- rVal >>= sLink;
- if( 0 == sLink.compareToAscii( UNO_NAME_GRAPHOBJ_URLPKGPREFIX,
- sizeof(UNO_NAME_GRAPHOBJ_URLPKGPREFIX)-1 ) )
- {
- OSL_FAIL( "package urls aren't implemented" );
- }
- else if( 0 == sLink.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX,
- sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1 ) )
- {
- DELETEZ( pStrLink );
- String sTmp( sLink );
- ByteString sId( sTmp.Copy(
- sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1),
- RTL_TEXTENCODING_ASCII_US );
- GraphicObject *pOldGrfObj = pImpl->pGraphicObject;
- pImpl->pGraphicObject = new GraphicObject( sId );
- ApplyGraphicTransparency_Impl();
- delete pOldGrfObj;
- }
- else
- {
- SetGraphicLink(sLink);
- }
- if ( sLink.getLength() && eGraphicPos == GPOS_NONE )
- eGraphicPos = GPOS_MM;
- else if( !sLink.getLength() )
- eGraphicPos = GPOS_NONE;
- }
- }
- break;
-
- case MID_GRAPHIC_FILTER:
- {
- if( rVal.getValueType() == ::getCppuType( (OUString*)0 ) )
- {
- OUString sLink;
- rVal >>= sLink;
- SetGraphicFilter( sLink );
- }
- }
- break;
- case MID_GRAPHIC_TRANSPARENCY :
- {
- sal_Int32 nTmp = 0;
- rVal >>= nTmp;
- if(nTmp >= 0 && nTmp <= 100)
- {
- pImpl->nGraphicTransparency = sal_Int8(nTmp);
- if(pImpl->pGraphicObject)
- ApplyGraphicTransparency_Impl();
- }
- }
- break;
- }
-
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SvxBrushItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
- ) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- if ( GPOS_NONE == eGraphicPos )
- {
- rText = ::GetColorString( aColor );
- rText += cpDelim;
- sal_uInt16 nId = RID_SVXITEMS_TRANSPARENT_FALSE;
-
- if ( aColor.GetTransparency() )
- nId = RID_SVXITEMS_TRANSPARENT_TRUE;
- rText += EE_RESSTR(nId);
- }
- else
- {
- rText = EE_RESSTR(RID_SVXITEMS_GRAPHIC);
- }
-
- return ePres;
- }
- default: ;//prevent warning
- }
-
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-SvxBrushItem& SvxBrushItem::operator=( const SvxBrushItem& rItem )
-{
- aColor = rItem.aColor;
- eGraphicPos = rItem.eGraphicPos;
-
- DELETEZ( pImpl->pGraphicObject );
- DELETEZ( pStrLink );
- DELETEZ( pStrFilter );
-
- if ( GPOS_NONE != eGraphicPos )
- {
- if ( rItem.pStrLink )
- pStrLink = new String( *rItem.pStrLink );
- if ( rItem.pStrFilter )
- pStrFilter = new String( *rItem.pStrFilter );
- if ( rItem.pImpl->pGraphicObject )
- {
- pImpl->pGraphicObject = new GraphicObject( *rItem.pImpl->pGraphicObject );
- }
- }
- pImpl->nGraphicTransparency = rItem.pImpl->nGraphicTransparency;
- return *this;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- SvxBrushItem& rCmp = (SvxBrushItem&)rAttr;
- sal_Bool bEqual = ( aColor == rCmp.aColor && eGraphicPos == rCmp.eGraphicPos &&
- pImpl->nGraphicTransparency == rCmp.pImpl->nGraphicTransparency);
-
- if ( bEqual )
- {
- if ( GPOS_NONE != eGraphicPos )
- {
- if ( !rCmp.pStrLink )
- bEqual = !pStrLink;
- else
- bEqual = pStrLink && ( *pStrLink == *rCmp.pStrLink );
-
- if ( bEqual )
- {
- if ( !rCmp.pStrFilter )
- bEqual = !pStrFilter;
- else
- bEqual = pStrFilter && ( *pStrFilter == *rCmp.pStrFilter );
- }
-
- if ( bEqual && !rCmp.pStrLink )
- {
- if ( !rCmp.pImpl->pGraphicObject )
- bEqual = !pImpl->pGraphicObject;
- else
- bEqual = pImpl->pGraphicObject &&
- ( *pImpl->pGraphicObject == *rCmp.pImpl->pGraphicObject );
- }
- }
- }
-
- return bEqual;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxBrushItem::Clone( SfxItemPool* ) const
-{
- return new SvxBrushItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxBrushItem::Create( SvStream& rStream, sal_uInt16 nVersion ) const
-{
- return new SvxBrushItem( rStream, nVersion, Which() );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStream << (sal_Bool)sal_False;
- rStream << aColor;
- rStream << aColor;
- rStream << (sal_Int8)(aColor.GetTransparency() > 0 ? 0 : 1); //BRUSH_NULL : BRUSH_SOLID
-
- sal_uInt16 nDoLoad = 0;
-
- if ( pImpl->pGraphicObject && !pStrLink )
- nDoLoad |= LOAD_GRAPHIC;
- if ( pStrLink )
- nDoLoad |= LOAD_LINK;
- if ( pStrFilter )
- nDoLoad |= LOAD_FILTER;
- rStream << nDoLoad;
-
- if ( pImpl->pGraphicObject && !pStrLink )
- rStream << pImpl->pGraphicObject->GetGraphic();
- if ( pStrLink )
- {
- OSL_FAIL("No BaseURL!");
- // TODO/MBA: how to get a BaseURL?!
- String aRel = INetURLObject::GetRelURL( String(), *pStrLink );
- // UNICODE: rStream << aRel;
- rStream.WriteByteString(aRel);
- }
- if ( pStrFilter )
- {
- // UNICODE: rStream << *pStrFilter;
- rStream.WriteByteString(*pStrFilter);
- }
- rStream << (sal_Int8)eGraphicPos;
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBrushItem::PurgeMedium() const
-{
- DELETEZ( pImpl->pStream );
-}
-
-// -----------------------------------------------------------------------
-const GraphicObject* SvxBrushItem::GetGraphicObject() const
-{
- if ( bLoadAgain && pStrLink && !pImpl->pGraphicObject )
- // when graphics already loaded, use as a cache
- {
- // only with "valid" names - empty names now allowed
- if( pStrLink->Len() )
- {
- 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().
- ImportGraphic( aGraphic, *pStrLink, *pImpl->pStream,
- GRFILTER_FORMAT_DONTKNOW, NULL, GRFILTER_I_FLAGS_DONT_SET_LOGSIZE_FOR_JPEG );
-
- if( nRes != GRFILTER_OK )
- {
- const_cast < SvxBrushItem*> (this)->bLoadAgain = sal_False;
- }
- else
- {
- pImpl->pGraphicObject = new GraphicObject;
- pImpl->pGraphicObject->SetGraphic( aGraphic );
- const_cast < SvxBrushItem*> (this)->ApplyGraphicTransparency_Impl();
- }
- }
- else
- {
- const_cast < SvxBrushItem*> (this)->bLoadAgain = sal_False;
- }
- }
- }
-
- return pImpl->pGraphicObject;
-}
-
-// -----------------------------------------------------------------------
-
-const Graphic* SvxBrushItem::GetGraphic() const
-{
- const GraphicObject* pGrafObj = GetGraphicObject();
- return( pGrafObj ? &( pGrafObj->GetGraphic() ) : NULL );
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBrushItem::SetGraphicPos( SvxGraphicPosition eNew )
-{
- eGraphicPos = eNew;
-
- if ( GPOS_NONE == eGraphicPos )
- {
- DELETEZ( pImpl->pGraphicObject );
- DELETEZ( pStrLink );
- DELETEZ( pStrFilter );
- }
- else
- {
- if ( !pImpl->pGraphicObject && !pStrLink )
- {
- pImpl->pGraphicObject = new GraphicObject; // Creating a dummy
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBrushItem::SetGraphic( const Graphic& rNew )
-{
- if ( !pStrLink )
- {
- if ( pImpl->pGraphicObject )
- pImpl->pGraphicObject->SetGraphic( rNew );
- else
- pImpl->pGraphicObject = new GraphicObject( rNew );
-
- ApplyGraphicTransparency_Impl();
-
- if ( GPOS_NONE == eGraphicPos )
- eGraphicPos = GPOS_MM; // None would be brush, then Default: middle
- }
- else
- {
- OSL_FAIL( "SetGraphic() on linked graphic! :-/" );
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBrushItem::SetGraphicObject( const GraphicObject& rNewObj )
-{
- if ( !pStrLink )
- {
- if ( pImpl->pGraphicObject )
- *pImpl->pGraphicObject = rNewObj;
- else
- pImpl->pGraphicObject = new GraphicObject( rNewObj );
-
- ApplyGraphicTransparency_Impl();
-
- if ( GPOS_NONE == eGraphicPos )
- eGraphicPos = GPOS_MM; // None would be brush, then Default: middle
- }
- else
- {
- OSL_FAIL( "SetGraphic() on linked graphic! :-/" );
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBrushItem::SetGraphicLink( const String& rNew )
-{
- if ( !rNew.Len() )
- DELETEZ( pStrLink );
- else
- {
- if ( pStrLink )
- *pStrLink = rNew;
- else
- pStrLink = new String( rNew );
-
- DELETEZ( pImpl->pGraphicObject );
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SvxBrushItem::SetGraphicFilter( const String& rNew )
-{
- if ( !rNew.Len() )
- DELETEZ( pStrFilter );
- else
- {
- if ( pStrFilter )
- *pStrFilter = rNew;
- else
- pStrFilter = new String( rNew );
- }
-}
-
-//static
-SvxGraphicPosition SvxBrushItem::WallpaperStyle2GraphicPos( WallpaperStyle eStyle )
-{
- SvxGraphicPosition eResult;
- // The switch is not the fastest, but the safest
- switch( eStyle )
- {
- case WALLPAPER_NULL: eResult = GPOS_NONE; break;
- case WALLPAPER_TILE: eResult = GPOS_TILED; break;
- case WALLPAPER_CENTER: eResult = GPOS_MM; break;
- case WALLPAPER_SCALE: eResult = GPOS_AREA; break;
- case WALLPAPER_TOPLEFT: eResult = GPOS_LT; break;
- case WALLPAPER_TOP: eResult = GPOS_MT; break;
- case WALLPAPER_TOPRIGHT: eResult = GPOS_RT; break;
- case WALLPAPER_LEFT: eResult = GPOS_LM; break;
- case WALLPAPER_RIGHT: eResult = GPOS_RM; break;
- case WALLPAPER_BOTTOMLEFT: eResult = GPOS_LB; break;
- case WALLPAPER_BOTTOM: eResult = GPOS_MB; break;
- case WALLPAPER_BOTTOMRIGHT: eResult = GPOS_RB; break;
- default: eResult = GPOS_NONE;
- }
- return eResult;
-};
-
-//static
-WallpaperStyle SvxBrushItem::GraphicPos2WallpaperStyle( SvxGraphicPosition ePos )
-{
- WallpaperStyle eResult;
- switch( ePos )
- {
- case GPOS_NONE: eResult = WALLPAPER_NULL; break;
- case GPOS_TILED: eResult = WALLPAPER_TILE; break;
- case GPOS_MM: eResult = WALLPAPER_CENTER; break;
- case GPOS_AREA: eResult = WALLPAPER_SCALE; break;
- case GPOS_LT: eResult = WALLPAPER_TOPLEFT; break;
- case GPOS_MT: eResult = WALLPAPER_TOP; break;
- case GPOS_RT: eResult = WALLPAPER_TOPRIGHT; break;
- case GPOS_LM: eResult = WALLPAPER_LEFT; break;
- case GPOS_RM: eResult = WALLPAPER_RIGHT; break;
- case GPOS_LB: eResult = WALLPAPER_BOTTOMLEFT; break;
- case GPOS_MB: eResult = WALLPAPER_BOTTOM; break;
- case GPOS_RB: eResult = WALLPAPER_BOTTOMRIGHT; break;
- default: eResult = WALLPAPER_NULL;
- }
- return eResult;
-}
-
-SvxBrushItem::SvxBrushItem( const CntWallpaperItem& rItem, sal_uInt16 _nWhich ) :
- SfxPoolItem( _nWhich ),
- pImpl( new SvxBrushItem_Impl( 0 ) ),
- pStrLink(0),
- pStrFilter(0),
- bLoadAgain( sal_True )
-{
- aColor = rItem.GetColor();
-
- if( rItem.GetBitmapURL().Len() )
- {
- pStrLink = new String( rItem.GetBitmapURL() );
- SetGraphicPos( WallpaperStyle2GraphicPos((WallpaperStyle)rItem.GetStyle() ) );
- }
-}
-
-#ifdef _MSC_VER
-#pragma optimize ( "", on )
-#endif
-
-void SvxBrushItem::ApplyGraphicTransparency_Impl()
-{
- DBG_ASSERT(pImpl->pGraphicObject, "no GraphicObject available" );
- if(pImpl->pGraphicObject)
- {
- GraphicAttr aAttr(pImpl->pGraphicObject->GetAttr());
- aAttr.SetTransparency(lcl_PercentToTransparency(
- pImpl->nGraphicTransparency));
- pImpl->pGraphicObject->SetAttr(aAttr);
- }
-}
-// class SvxFrameDirectionItem ----------------------------------------------
-
-SvxFrameDirectionItem::SvxFrameDirectionItem( sal_uInt16 _nWhich )
- : SfxUInt16Item( _nWhich, (sal_uInt16)FRMDIR_HORI_LEFT_TOP )
-{
-}
-
-SvxFrameDirectionItem::SvxFrameDirectionItem( SvxFrameDirection nValue ,
- sal_uInt16 _nWhich )
- : SfxUInt16Item( _nWhich, (sal_uInt16)nValue )
-{
-}
-
-SvxFrameDirectionItem::~SvxFrameDirectionItem()
-{
-}
-
-int SvxFrameDirectionItem::operator==( const SfxPoolItem& rCmp ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal types" );
-
- return GetValue() == ((SvxFrameDirectionItem&)rCmp).GetValue();
-}
-
-SfxPoolItem* SvxFrameDirectionItem::Clone( SfxItemPool * ) const
-{
- return new SvxFrameDirectionItem( *this );
-}
-
-SfxPoolItem* SvxFrameDirectionItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/ ) const
-{
- sal_uInt16 nValue;
- rStrm >> nValue;
- return new SvxFrameDirectionItem( (SvxFrameDirection)nValue, Which() );
-}
-
-SvStream& SvxFrameDirectionItem::Store( SvStream & rStrm, sal_uInt16 /*nIVer*/ ) const
-{
- sal_uInt16 nValue = GetValue();
- rStrm << nValue;
- return rStrm;
-}
-
-sal_uInt16 SvxFrameDirectionItem::GetVersion( sal_uInt16 nFVer ) const
-{
- return SOFFICE_FILEFORMAT_50 > nFVer ? USHRT_MAX : 0;
-}
-
-SfxItemPresentation SvxFrameDirectionItem::GetPresentation(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *) const
-{
- SfxItemPresentation eRet = ePres;
- switch( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- break;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = EE_RESSTR( RID_SVXITEMS_FRMDIR_BEGIN + GetValue() );
- break;
-
- default:
- eRet = SFX_ITEM_PRESENTATION_NONE;
- }
- return eRet;
-}
-
-bool SvxFrameDirectionItem::PutValue( const com::sun::star::uno::Any& rVal,
- sal_uInt8 )
-{
- sal_Int16 nVal = sal_Int16();
- sal_Bool bRet = ( rVal >>= nVal );
- if( bRet )
- {
- // translate WritingDirection2 constants into SvxFrameDirection
- switch( nVal )
- {
- case text::WritingMode2::LR_TB:
- SetValue( FRMDIR_HORI_LEFT_TOP );
- break;
- case text::WritingMode2::RL_TB:
- SetValue( FRMDIR_HORI_RIGHT_TOP );
- break;
- case text::WritingMode2::TB_RL:
- SetValue( FRMDIR_VERT_TOP_RIGHT );
- break;
- case text::WritingMode2::TB_LR:
- SetValue( FRMDIR_VERT_TOP_LEFT );
- break;
- case text::WritingMode2::PAGE:
- SetValue( FRMDIR_ENVIRONMENT );
- break;
- default:
- bRet = false;
- break;
- }
- }
-
- return bRet;
-}
-
-bool SvxFrameDirectionItem::QueryValue( com::sun::star::uno::Any& rVal,
- sal_uInt8 ) const
-{
- // translate SvxFrameDirection into WritingDirection2
- sal_Int16 nVal;
- bool bRet = true;
- switch( GetValue() )
- {
- case FRMDIR_HORI_LEFT_TOP:
- nVal = text::WritingMode2::LR_TB;
- break;
- case FRMDIR_HORI_RIGHT_TOP:
- nVal = text::WritingMode2::RL_TB;
- break;
- case FRMDIR_VERT_TOP_RIGHT:
- nVal = text::WritingMode2::TB_RL;
- break;
- case FRMDIR_VERT_TOP_LEFT:
- nVal = text::WritingMode2::TB_LR;
- break;
- case FRMDIR_ENVIRONMENT:
- nVal = text::WritingMode2::PAGE;
- break;
- default:
- OSL_FAIL("Unknown SvxFrameDirection value!");
- bRet = false;
- break;
- }
-
- // return value + error state
- if( bRet )
- {
- rVal <<= nVal;
- }
- return bRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx
deleted file mode 100644
index ea8808ce75..0000000000
--- a/editeng/source/items/itemtype.cxx
+++ /dev/null
@@ -1,232 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-// include ---------------------------------------------------------------
-#include <vcl/outdev.hxx>
-#include <editeng/editrids.hrc>
-#include <unotools/intlwrapper.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <editeng/itemtype.hxx>
-#include <editeng/eerdll.hxx>
-
-// -----------------------------------------------------------------------
-
-XubString GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, const IntlWrapper* pIntl )
-{
- sal_Bool bNeg = sal_False;
- long nRet = 0;
- XubString sRet;
-
- if ( nVal < 0 )
- {
- bNeg = sal_True;
- nVal *= -1;
- }
-
- switch ( eDestUnit )
- {
- case SFX_MAPUNIT_100TH_MM:
- case SFX_MAPUNIT_10TH_MM:
- case SFX_MAPUNIT_MM:
- case SFX_MAPUNIT_CM:
- {
- nRet = (long)OutputDevice::LogicToLogic(
- nVal, (MapUnit)eSrcUnit, (MapUnit)SFX_MAPUNIT_100TH_MM );
-
- switch ( eDestUnit )
- {
- case SFX_MAPUNIT_100TH_MM: nRet *= 1000; break;
- case SFX_MAPUNIT_10TH_MM: nRet *= 100; break;
- case SFX_MAPUNIT_MM: nRet *= 10; break;
- default: ;//prevent warning
- }
- break;
- }
-
- case SFX_MAPUNIT_1000TH_INCH:
- case SFX_MAPUNIT_100TH_INCH:
- case SFX_MAPUNIT_10TH_INCH:
- case SFX_MAPUNIT_INCH:
- {
- nRet = (long)OutputDevice::LogicToLogic(
- nVal, (MapUnit)eSrcUnit, (MapUnit)SFX_MAPUNIT_1000TH_INCH );
-
- switch ( eDestUnit )
- {
- case SFX_MAPUNIT_1000TH_INCH: nRet *= 1000; break;
- case SFX_MAPUNIT_100TH_INCH: nRet *= 100; break;
- case SFX_MAPUNIT_10TH_INCH: nRet *= 10; break;
- default: ;//prevent warning
- }
- break;
- }
-
- case SFX_MAPUNIT_POINT:
- case SFX_MAPUNIT_TWIP:
- case SFX_MAPUNIT_PIXEL:
- return String::CreateFromInt32( (long)OutputDevice::LogicToLogic(
- nVal, (MapUnit)eSrcUnit, (MapUnit)eDestUnit ));
-
- default:
- OSL_FAIL( "not supported mapunit" );
- return sRet;
- }
-
- if ( SFX_MAPUNIT_CM == eDestUnit || SFX_MAPUNIT_INCH == eDestUnit )
- {
- long nMod = nRet % 10;
-
- if ( nMod > 4 )
- nRet += 10 - nMod;
- else if ( nMod > 0 )
- nRet -= nMod;
- }
-
- if ( bNeg )
- sRet += sal_Unicode('-');
-
- long nDiff = 1000;
- for( int nDigits = 4; nDigits; --nDigits, nDiff /= 10 )
- {
- if ( nRet < nDiff )
- sRet += sal_Unicode('0');
- else
- sRet += String::CreateFromInt32( nRet / nDiff );
- nRet %= nDiff;
- if( 4 == nDigits )
- {
- if(pIntl)
- sRet += pIntl->getLocaleData()->getNumDecimalSep();
- else
- sRet += ',';
- if( !nRet )
- {
- sRet += sal_Unicode('0');
- break;
- }
- }
- else if( !nRet )
- break;
- }
- return sRet;
-}
-
-// -----------------------------------------------------------------------
-
-XubString GetSvxString( sal_uInt16 nId )
-{
- return EE_RESSTR( nId );
-}
-
-// -----------------------------------------------------------------------
-
-XubString GetColorString( const Color& rCol )
-{
- XubString sStr;
-
- ColorData nColData =
- RGB_COLORDATA( rCol.GetRed(), rCol.GetGreen(), rCol.GetBlue() );
- sal_uInt16 nColor = 0;
-
- static ColorData aColAry[] = {
- COL_BLACK, COL_BLUE, COL_GREEN, COL_CYAN,
- COL_RED, COL_MAGENTA, COL_BROWN, COL_GRAY,
- COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTGREEN, COL_LIGHTCYAN,
- COL_LIGHTRED, COL_LIGHTMAGENTA, COL_YELLOW, COL_WHITE };
-
- while ( nColor < sizeof(aColAry)/sizeof(ColorData) &&
- aColAry[nColor] != nColData )
- {
- nColor += 1;
- }
-
- if ( nColor < sizeof(aColAry)/sizeof(ColorData) )
- sStr = EE_RESSTR( RID_SVXITEMS_COLOR_BEGIN + nColor + 1 );
-
- if ( !sStr.Len() )
- {
- sStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "RGB" ));
- sStr += sal_Unicode('(');
- sStr += String::CreateFromInt32( rCol.GetRed() );
- sStr += cpDelim;
- sStr += String::CreateFromInt32( rCol.GetGreen() );
- sStr += cpDelim;
- sStr += String::CreateFromInt32( rCol.GetBlue() );
- sStr += sal_Unicode(')');
- }
- return sStr;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 GetMetricId( SfxMapUnit eUnit )
-{
- sal_uInt16 nId = RID_SVXITEMS_METRIC_MM;
-
- switch ( eUnit )
- {
- case SFX_MAPUNIT_100TH_MM:
- case SFX_MAPUNIT_10TH_MM:
- case SFX_MAPUNIT_MM:
- nId = RID_SVXITEMS_METRIC_MM;
- break;
-
- case SFX_MAPUNIT_CM:
- nId = RID_SVXITEMS_METRIC_CM;
- break;
-
- case SFX_MAPUNIT_1000TH_INCH:
- case SFX_MAPUNIT_100TH_INCH:
- case SFX_MAPUNIT_10TH_INCH:
- case SFX_MAPUNIT_INCH:
- nId = RID_SVXITEMS_METRIC_INCH;
- break;
-
- case SFX_MAPUNIT_POINT:
- nId = RID_SVXITEMS_METRIC_POINT;
- break;
-
- case SFX_MAPUNIT_TWIP:
- nId = RID_SVXITEMS_METRIC_TWIP;
- break;
-
- case SFX_MAPUNIT_PIXEL:
- nId = RID_SVXITEMS_METRIC_PIXEL;
- break;
-
- default:
- 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
deleted file mode 100644
index c8f4c7c3e1..0000000000
--- a/editeng/source/items/justifyitem.cxx
+++ /dev/null
@@ -1,461 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// 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
deleted file mode 100644
index 9ebb12c66f..0000000000
--- a/editeng/source/items/makefile.mk
+++ /dev/null
@@ -1,67 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# 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
deleted file mode 100644
index 9f4d838ac1..0000000000
--- a/editeng/source/items/numitem.cxx
+++ /dev/null
@@ -1,960 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <editeng/numitem.hxx>
-
-#include <com/sun/star/text/HoriOrientation.hpp>
-#include <com/sun/star/text/VertOrientation.hpp>
-#include <com/sun/star/text/RelOrientation.hpp>
-#include <editeng/brshitem.hxx>
-#include <vcl/font.hxx>
-#include <editeng/editids.hrc>
-#include <editeng/editrids.hrc>
-#include <editeng/numdef.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/window.hxx>
-#include <vcl/svapp.hxx>
-#include <editeng/unolingu.hxx>
-#include <com/sun/star/text/XNumberingFormatter.hpp>
-#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
-#include <com/sun/star/style/NumberingType.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <comphelper/processfactory.hxx>
-
-#include <editeng/unonrule.hxx>
-
-#define MM100_TO_TWIP(MM100) ((MM100*72L+63L)/127L)
-
-#define DEF_WRITER_LSPACE 500 //Standard Indentation
-#define DEF_DRAW_LSPACE 800 //Standard Indentation
-
-#define NUMITEM_VERSION_01 0x01
-#define NUMITEM_VERSION_02 0x02
-#define NUMITEM_VERSION_03 0x03
-#define NUMITEM_VERSION_04 0x04
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::text;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::style;
-
-sal_Int32 SvxNumberType::nRefCount = 0;
-com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> SvxNumberType::xFormatter = 0;
-void lcl_getFormatter(com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& _xFormatter)
-{
- if(!_xFormatter.is())
- {
- try
- {
- Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- Reference < XInterface > xI = xMSF->createInstance(
- ::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);
- }
- catch(Exception& )
- {
- }
- }
-}
-
-SvxNumberType::SvxNumberType(sal_Int16 nType) :
- nNumType(nType),
- bShowSymbol(sal_True)
-{
- nRefCount++;
-}
-
-SvxNumberType::SvxNumberType(const SvxNumberType& rType) :
- nNumType(rType.nNumType),
- bShowSymbol(rType.bShowSymbol)
-{
- nRefCount++;
-}
-
-SvxNumberType::~SvxNumberType()
-{
- if(!--nRefCount)
- xFormatter = 0;
-}
-
-String SvxNumberType::GetNumStr( sal_uLong nNo ) const
-{
- LanguageType eLang = Application::GetSettings().GetLanguage();
- Locale aLocale = SvxCreateLocale(eLang);
- return GetNumStr( nNo, aLocale );
-}
-
-String SvxNumberType::GetNumStr( sal_uLong nNo, const Locale& rLocale ) const
-{
- lcl_getFormatter(xFormatter);
- String aTmpStr;
- if(!xFormatter.is())
- return aTmpStr;
-
- if(bShowSymbol)
- {
- switch(nNumType)
- {
- case NumberingType::CHAR_SPECIAL:
- case NumberingType::BITMAP:
- break;
- default:
- {
- // '0' allowed for ARABIC numberings
- if(NumberingType::ARABIC == nNumType && 0 == nNo )
- aTmpStr = '0';
- else
- {
- Sequence< PropertyValue > aProperties(2);
- PropertyValue* pValues = aProperties.getArray();
- pValues[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingType"));
- pValues[0].Value <<= nNumType;
- pValues[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value"));
- pValues[1].Value <<= (sal_Int32)nNo;
-
- try
- {
- aTmpStr = xFormatter->makeNumberingString( aProperties, rLocale );
- }
- catch(Exception&)
- {
- }
- }
- }
- }
- }
- return aTmpStr;
-}
-
-SvxNumberFormat::SvxNumberFormat( sal_Int16 eType,
- SvxNumPositionAndSpaceMode ePositionAndSpaceMode )
- : SvxNumberType(eType),
- eNumAdjust(SVX_ADJUST_LEFT),
- nInclUpperLevels(0),
- nStart(1),
- cBullet(SVX_DEF_BULLET),
- nBulletRelSize(100),
- nBulletColor(COL_BLACK),
- mePositionAndSpaceMode( ePositionAndSpaceMode ),
- nFirstLineOffset(0),
- nAbsLSpace(0),
- nLSpace(0),
- nCharTextDistance(0),
- meLabelFollowedBy( LISTTAB ),
- mnListtabPos( 0 ),
- mnFirstLineIndent( 0 ),
- mnIndentAt( 0 ),
- pGraphicBrush(0),
- eVertOrient(text::VertOrientation::NONE),
- pBulletFont(0)
-{
-}
-
-SvxNumberFormat::SvxNumberFormat(const SvxNumberFormat& rFormat) :
- SvxNumberType(rFormat),
- mePositionAndSpaceMode( rFormat.mePositionAndSpaceMode ),
- pGraphicBrush(0),
- pBulletFont(0)
-{
- *this = rFormat;
-}
-
-SvxNumberFormat::~SvxNumberFormat()
-{
- delete pGraphicBrush;
- delete pBulletFont;
-}
-
-SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter)
-{
- if(pConverter && pBulletFont)
- {
- cBullet = ConvertFontToSubsFontChar(pConverter, cBullet);
- String sFontName = GetFontToSubsFontName(pConverter);
- pBulletFont->SetName(sFontName);
- }
-
- rStream << (sal_uInt16)NUMITEM_VERSION_04;
-
- rStream << (sal_uInt16)GetNumberingType();
- rStream << (sal_uInt16)eNumAdjust;
- rStream << (sal_uInt16)nInclUpperLevels;
- rStream << nStart;
- rStream << (sal_uInt16)cBullet;
-
- rStream << nFirstLineOffset;
- rStream << nAbsLSpace;
- rStream << nLSpace;
-
- rStream << nCharTextDistance;
- rtl_TextEncoding eEnc = gsl_getSystemTextEncoding();
- rStream.WriteByteString(sPrefix, eEnc);
- rStream.WriteByteString(sSuffix, eEnc);
- rStream.WriteByteString(sCharStyleName, eEnc);
- if(pGraphicBrush)
- {
- rStream << (sal_uInt16)1;
-
- // 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())
- {
- String aEmpty;
- pGraphicBrush->SetGraphicLink(aEmpty);
- }
-
- pGraphicBrush->Store(rStream, BRUSH_GRAPHIC_VERSION);
- }
- else
- rStream << (sal_uInt16)0;
-
- rStream << (sal_uInt16)eVertOrient;
- if(pBulletFont)
- {
- rStream << (sal_uInt16)1;
- rStream << *pBulletFont;
- }
- else
- rStream << (sal_uInt16)0;
- rStream << aGraphicSize;
-
- Color nTempColor = nBulletColor;
- if(COL_AUTO == nBulletColor.GetColor())
- nTempColor = COL_BLACK;
- rStream << nTempColor;
- rStream << nBulletRelSize;
- rStream << (sal_uInt16)IsShowSymbol();
-
- rStream << ( sal_uInt16 ) mePositionAndSpaceMode;
- rStream << ( sal_uInt16 ) meLabelFollowedBy;
- rStream << ( long ) mnListtabPos;
- rStream << ( long ) mnFirstLineIndent;
- rStream << ( long ) mnIndentAt;
-
- return rStream;
-}
-
-SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat )
-{
- if (& rFormat == this) { return *this; }
-
- SetNumberingType(rFormat.GetNumberingType());
- eNumAdjust = rFormat.eNumAdjust ;
- nInclUpperLevels = rFormat.nInclUpperLevels ;
- nStart = rFormat.nStart ;
- cBullet = rFormat.cBullet ;
- mePositionAndSpaceMode = rFormat.mePositionAndSpaceMode;
- nFirstLineOffset = rFormat.nFirstLineOffset;
- nAbsLSpace = rFormat.nAbsLSpace ;
- nLSpace = rFormat.nLSpace ;
- nCharTextDistance = rFormat.nCharTextDistance ;
- meLabelFollowedBy = rFormat.meLabelFollowedBy;
- mnListtabPos = rFormat.mnListtabPos;
- mnFirstLineIndent = rFormat.mnFirstLineIndent;
- mnIndentAt = rFormat.mnIndentAt;
- eVertOrient = rFormat.eVertOrient ;
- sPrefix = rFormat.sPrefix ;
- sSuffix = rFormat.sSuffix ;
- aGraphicSize = rFormat.aGraphicSize ;
- nBulletColor = rFormat.nBulletColor ;
- nBulletRelSize = rFormat.nBulletRelSize;
- SetShowSymbol(rFormat.IsShowSymbol());
- sCharStyleName = rFormat.sCharStyleName;
- DELETEZ(pGraphicBrush);
- if(rFormat.pGraphicBrush)
- {
- pGraphicBrush = new SvxBrushItem(*rFormat.pGraphicBrush);
- pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) );
- }
- DELETEZ(pBulletFont);
- if(rFormat.pBulletFont)
- pBulletFont = new Font(*rFormat.pBulletFont);
- return *this;
-}
-
-sal_Bool SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const
-{
- if( GetNumberingType() != rFormat.GetNumberingType() ||
- eNumAdjust != rFormat.eNumAdjust ||
- nInclUpperLevels != rFormat.nInclUpperLevels ||
- nStart != rFormat.nStart ||
- cBullet != rFormat.cBullet ||
- mePositionAndSpaceMode != rFormat.mePositionAndSpaceMode ||
- nFirstLineOffset != rFormat.nFirstLineOffset ||
- nAbsLSpace != rFormat.nAbsLSpace ||
- nLSpace != rFormat.nLSpace ||
- nCharTextDistance != rFormat.nCharTextDistance ||
- meLabelFollowedBy != rFormat.meLabelFollowedBy ||
- mnListtabPos != rFormat.mnListtabPos ||
- mnFirstLineIndent != rFormat.mnFirstLineIndent ||
- mnIndentAt != rFormat.mnIndentAt ||
- eVertOrient != rFormat.eVertOrient ||
- sPrefix != rFormat.sPrefix ||
- sSuffix != rFormat.sSuffix ||
- aGraphicSize != rFormat.aGraphicSize ||
- nBulletColor != rFormat.nBulletColor ||
- nBulletRelSize != rFormat.nBulletRelSize ||
- IsShowSymbol() != rFormat.IsShowSymbol() ||
- sCharStyleName != rFormat.sCharStyleName
- )
- return sal_False;
- if (
- (pGraphicBrush && !rFormat.pGraphicBrush) ||
- (!pGraphicBrush && rFormat.pGraphicBrush) ||
- (pGraphicBrush && *pGraphicBrush != *rFormat.pGraphicBrush)
- )
- {
- return sal_False;
- }
- if (
- (pBulletFont && !rFormat.pBulletFont) ||
- (!pBulletFont && rFormat.pBulletFont) ||
- (pBulletFont && *pBulletFont != *rFormat.pBulletFont)
- )
- {
- return sal_False;
- }
- return sal_True;
-}
-
-void SvxNumberFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem,
- const Size* pSize, const sal_Int16* pOrient)
-{
- if(!pBrushItem)
- {
- delete pGraphicBrush;
- pGraphicBrush = 0;
- }
- else if ( !pGraphicBrush || (pGraphicBrush && !(*pBrushItem == *pGraphicBrush)) )
- {
- delete pGraphicBrush;
- pGraphicBrush = (SvxBrushItem*)pBrushItem->Clone();
- pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) );
- }
-
- if(pOrient)
- eVertOrient = *pOrient;
- else
- eVertOrient = text::VertOrientation::NONE;
- if(pSize)
- aGraphicSize = *pSize;
- else
- aGraphicSize.Width() = aGraphicSize.Height() = 0;
-}
-
-void SvxNumberFormat::SetGraphic( const String& rName )
-{
- const String* pName;
- if( pGraphicBrush &&
- 0 != (pName = pGraphicBrush->GetGraphicLink())
- && *pName == rName )
- return ;
-
- delete pGraphicBrush;
- String sTmp;
- pGraphicBrush = new SvxBrushItem( rName, sTmp, GPOS_AREA, 0 );
- pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) );
- if( eVertOrient == text::VertOrientation::NONE )
- eVertOrient = text::VertOrientation::TOP;
-
- aGraphicSize.Width() = aGraphicSize.Height() = 0;
-}
-
-void SvxNumberFormat::SetVertOrient(sal_Int16 eSet)
-{
- eVertOrient = eSet;
-}
-
-sal_Int16 SvxNumberFormat::GetVertOrient() const
-{
- return eVertOrient;
-}
-
-void SvxNumberFormat::SetBulletFont(const Font* pFont)
-{
- delete pBulletFont;
- pBulletFont = pFont ? new Font(*pFont): 0;
-}
-
-SvxNumberFormat::SvxNumPositionAndSpaceMode SvxNumberFormat::GetPositionAndSpaceMode() const
-{
- return mePositionAndSpaceMode;
-}
-void SvxNumberFormat::SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode )
-{
- mePositionAndSpaceMode = ePositionAndSpaceMode;
-}
-
-short SvxNumberFormat::GetLSpace() const
-{
- return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nLSpace : 0;
-}
-short SvxNumberFormat::GetAbsLSpace() const
-{
- return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
- ? nAbsLSpace
- : static_cast<short>( GetFirstLineIndent() + GetIndentAt() );
-}
-short SvxNumberFormat::GetFirstLineOffset() const
-{
- return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
- ? nFirstLineOffset
- : static_cast<short>( GetFirstLineIndent() );
-}
-short SvxNumberFormat::GetCharTextDistance() const
-{
- return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nCharTextDistance : 0;
-}
-
-void SvxNumberFormat::SetLabelFollowedBy( const SvxNumLabelFollowedBy eLabelFollowedBy )
-{
- meLabelFollowedBy = eLabelFollowedBy;
-}
-SvxNumberFormat::SvxNumLabelFollowedBy SvxNumberFormat::GetLabelFollowedBy() const
-{
- return meLabelFollowedBy;
-}
-void SvxNumberFormat::SetListtabPos( const long nListtabPos )
-{
- mnListtabPos = nListtabPos;
-}
-long SvxNumberFormat::GetListtabPos() const
-{
- return mnListtabPos;
-}
-void SvxNumberFormat::SetFirstLineIndent( const long nFirstLineIndent )
-{
- mnFirstLineIndent = nFirstLineIndent;
-}
-long SvxNumberFormat::GetFirstLineIndent() const
-{
- return mnFirstLineIndent;
-}
-void SvxNumberFormat::SetIndentAt( const long nIndentAt )
-{
- mnIndentAt = nIndentAt;
-}
-long SvxNumberFormat::GetIndentAt() const
-{
- return mnIndentAt;
-}
-
-IMPL_STATIC_LINK( SvxNumberFormat, GraphicArrived, void *, EMPTYARG )
-{
- // if necessary, set the GrfSize:
- if( !pThis->aGraphicSize.Width() || !pThis->aGraphicSize.Height() )
- {
- const Graphic* pGrf = pThis->pGraphicBrush->GetGraphic();
- if( pGrf )
- pThis->aGraphicSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf );
- }
- pThis->NotifyGraphicArrived();
- return 0;
-}
-
-void SvxNumberFormat::NotifyGraphicArrived()
-{
-}
-
-Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* pGraphic)
-{
- const MapMode aMapMM100( MAP_100TH_MM );
- const Size& rSize = pGraphic->GetPrefSize();
- Size aRetSize;
- if ( pGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
- {
- OutputDevice* pOutDev = Application::GetDefaultDevice();
- MapMode aOldMap( pOutDev->GetMapMode() );
- pOutDev->SetMapMode( aMapMM100 );
- aRetSize = pOutDev->PixelToLogic( rSize );
- pOutDev->SetMapMode( aOldMap );
- }
- else
- aRetSize = OutputDevice::LogicToLogic( rSize, pGraphic->GetPrefMapMode(), aMapMM100 );
- return aRetSize;
-}
-
-String SvxNumberFormat::CreateRomanString( sal_uLong nNo, sal_Bool bUpper )
-{
- 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 entries!
- : "mdclxvi--"; // +2 Dummy entries!
-
- String sRet;
- sal_uInt16 nMask = 1000;
- while( nMask )
- {
- sal_uInt8 nZahl = sal_uInt8(nNo / nMask);
- sal_uInt8 nDiff = 1;
- nNo %= nMask;
-
- if( 5 < nZahl )
- {
- if( nZahl < 9 )
- sRet += sal_Unicode(*(cRomanArr-1));
- ++nDiff;
- nZahl -= 5;
- }
- switch( nZahl )
- {
- case 3: { sRet += sal_Unicode(*cRomanArr); }
- case 2: { sRet += sal_Unicode(*cRomanArr); }
- case 1: { sRet += sal_Unicode(*cRomanArr); }
- break;
-
- case 4: {
- sRet += sal_Unicode(*cRomanArr);
- sRet += sal_Unicode(*(cRomanArr-nDiff));
- }
- break;
- case 5: { sRet += sal_Unicode(*(cRomanArr-nDiff)); }
- break;
- }
-
- nMask /= 10; // for the next decade
- cRomanArr += 2;
- }
- return sRet;
-}
-
-const String& SvxNumberFormat::GetCharFmtName()const
-{
- return sCharStyleName;
-}
-
-sal_Int32 SvxNumRule::nRefCount = 0;
-static SvxNumberFormat* pStdNumFmt = 0;
-static SvxNumberFormat* pStdOutlineNumFmt = 0;
-SvxNumRule::SvxNumRule( sal_uLong nFeatures,
- sal_uInt16 nLevels,
- sal_Bool bCont,
- SvxNumRuleType eType,
- SvxNumberFormat::SvxNumPositionAndSpaceMode
- eDefaultNumberFormatPositionAndSpaceMode )
- : nLevelCount(nLevels),
- nFeatureFlags(nFeatures),
- eNumberingType(eType),
- bContinuousNumbering(bCont)
-{
- ++nRefCount;
- LanguageType eLang = Application::GetSettings().GetLanguage();
- aLocale = SvxCreateLocale(eLang);
- for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
- {
- if(i < nLevels)
- {
- aFmts[i] = new SvxNumberFormat(SVX_NUM_CHARS_UPPER_LETTER);
- // It is a distinction between writer and draw
- if(nFeatures & NUM_CONTINUOUS)
- {
- if ( eDefaultNumberFormatPositionAndSpaceMode ==
- SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
- {
- aFmts[i]->SetLSpace( MM100_TO_TWIP(DEF_WRITER_LSPACE) );
- aFmts[i]->SetAbsLSpace( MM100_TO_TWIP(DEF_WRITER_LSPACE * (i+1)) );
- aFmts[i]->SetFirstLineOffset(MM100_TO_TWIP(-DEF_WRITER_LSPACE));
- }
- else if ( eDefaultNumberFormatPositionAndSpaceMode ==
- SvxNumberFormat::LABEL_ALIGNMENT )
- {
- // first line indent of general numbering in inch: -0,25 inch
- const long cFirstLineIndent = -1440/4;
- // indent values of general numbering in inch:
- // 0,5 0,75 1,0 1,25 1,5
- // 1,75 2,0 2,25 2,5 2,75
- const long cIndentAt = 1440/4;
- aFmts[i]->SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT );
- aFmts[i]->SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
- aFmts[i]->SetListtabPos( cIndentAt * (i+2) );
- aFmts[i]->SetFirstLineIndent( cFirstLineIndent );
- aFmts[i]->SetIndentAt( cIndentAt * (i+2) );
- }
- }
- else
- {
- aFmts[i]->SetLSpace( DEF_DRAW_LSPACE );
- aFmts[i]->SetAbsLSpace( DEF_DRAW_LSPACE * (i) );
- }
- }
- else
- aFmts[i] = 0;
- aFmtsSet[i] = sal_False;
- }
-}
-
-SvxNumRule::SvxNumRule(const SvxNumRule& rCopy)
-{
- ++nRefCount;
- aLocale = rCopy.aLocale;
- nLevelCount = rCopy.nLevelCount ;
- nFeatureFlags = rCopy.nFeatureFlags ;
- bContinuousNumbering = rCopy.bContinuousNumbering;
- eNumberingType = rCopy.eNumberingType;
- memset( aFmts, 0, sizeof( aFmts ));
- for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
- {
- if(rCopy.aFmts[i])
- aFmts[i] = new SvxNumberFormat(*rCopy.aFmts[i]);
- else
- aFmts[i] = 0;
- aFmtsSet[i] = rCopy.aFmtsSet[i];
- }
-}
-
-SvStream& SvxNumRule::Store(SvStream &rStream)
-{
- rStream<<(sal_uInt16)NUMITEM_VERSION_03;
- rStream<<nLevelCount;
- //first save of nFeatureFlags for old versions
- rStream<<(sal_uInt16)nFeatureFlags;
- rStream<<(sal_uInt16)bContinuousNumbering;
- rStream<<(sal_uInt16)eNumberingType;
-
- FontToSubsFontConverter pConverter = 0;
- sal_Bool bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50;
- for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
- {
- if(aFmts[i])
- {
- rStream << sal_uInt16(1);
- if(bConvertBulletFont && aFmts[i]->GetBulletFont())
- {
- if(!pConverter)
- pConverter =
- CreateFontToSubsFontConverter(aFmts[i]->GetBulletFont()->GetName(),
- FONTTOSUBSFONT_EXPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS);
- }
- aFmts[i]->Store(rStream, pConverter);
- }
- else
- rStream << sal_uInt16(0);
- }
- //second save of nFeatureFlags for new versions
- rStream<<(sal_uInt16)nFeatureFlags;
- if(pConverter)
- DestroyFontToSubsFontConverter(pConverter);
-
- return rStream;
-}
-
-SvxNumRule::~SvxNumRule()
-{
- for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
- delete aFmts[i];
- if(!--nRefCount)
- {
- DELETEZ(pStdNumFmt);
- DELETEZ(pStdOutlineNumFmt);
- }
-}
-
-SvxNumRule& SvxNumRule::operator=( const SvxNumRule& rCopy )
-{
- nLevelCount = rCopy.nLevelCount;
- nFeatureFlags = rCopy.nFeatureFlags;
- bContinuousNumbering = rCopy.bContinuousNumbering;
- eNumberingType = rCopy.eNumberingType;
- for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
- {
- delete aFmts[i];
- if(rCopy.aFmts[i])
- aFmts[i] = new SvxNumberFormat(*rCopy.aFmts[i]);
- else
- aFmts[i] = 0;
- aFmtsSet[i] = rCopy.aFmtsSet[i];
- }
- return *this;
-}
-
-int SvxNumRule::operator==( const SvxNumRule& rCopy) const
-{
- if(nLevelCount != rCopy.nLevelCount ||
- nFeatureFlags != rCopy.nFeatureFlags ||
- bContinuousNumbering != rCopy.bContinuousNumbering ||
- eNumberingType != rCopy.eNumberingType)
- return sal_False;
- for(sal_uInt16 i = 0; i < nLevelCount; i++)
- {
- if (
- (aFmtsSet[i] != rCopy.aFmtsSet[i]) ||
- (!aFmts[i] && rCopy.aFmts[i]) ||
- (aFmts[i] && !rCopy.aFmts[i]) ||
- (aFmts[i] && *aFmts[i] != *rCopy.aFmts[i])
- )
- {
- return sal_False;
- }
- }
- return sal_True;
-}
-
-const SvxNumberFormat* SvxNumRule::Get(sal_uInt16 nLevel)const
-{
- DBG_ASSERT(nLevel < SVX_MAX_NUM, "Wrong Level" );
- if( nLevel < SVX_MAX_NUM )
- return aFmtsSet[nLevel] ? aFmts[nLevel] : 0;
- else
- return 0;
-}
-
-const SvxNumberFormat& SvxNumRule::GetLevel(sal_uInt16 nLevel)const
-{
- if(!pStdNumFmt)
- {
- pStdNumFmt = new SvxNumberFormat(SVX_NUM_ARABIC);
- pStdOutlineNumFmt = new SvxNumberFormat(SVX_NUM_NUMBER_NONE);
- }
-
- DBG_ASSERT(nLevel < SVX_MAX_NUM, "Wrong Level" );
-
- return ( ( nLevel < SVX_MAX_NUM ) && aFmts[nLevel] ) ?
- *aFmts[nLevel] : eNumberingType == SVX_RULETYPE_NUMBERING ?
- *pStdNumFmt : *pStdOutlineNumFmt;
-}
-
-void SvxNumRule::SetLevel( sal_uInt16 i, const SvxNumberFormat& rNumFmt, sal_Bool bIsValid )
-{
- 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;
- }
-}
-
-void SvxNumRule::SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt)
-{
- DBG_ASSERT(nLevel < SVX_MAX_NUM, "Wrong Level" );
-
- if( nLevel < SVX_MAX_NUM )
- {
- aFmtsSet[nLevel] = 0 != pFmt;
- if(pFmt)
- SetLevel(nLevel, *pFmt);
- else
- {
- delete aFmts[nLevel];
- aFmts[nLevel] = 0;
- }
- }
-}
-
-String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings ) const
-{
- String aStr;
- if( SVX_NO_NUM > rNum.GetLevel() && !( SVX_NO_NUMLEVEL & rNum.GetLevel() ) )
- {
- const SvxNumberFormat& rMyNFmt = GetLevel( rNum.GetLevel() );
- if( SVX_NUM_NUMBER_NONE != rMyNFmt.GetNumberingType() )
- {
- sal_uInt8 i = rNum.GetLevel();
-
- if( !IsContinuousNumbering() &&
- 1 < rMyNFmt.GetIncludeUpperLevels() ) // only on own level?
- {
- sal_uInt8 n = rMyNFmt.GetIncludeUpperLevels();
- if( 1 < n )
- {
- if( i+1 >= n )
- i -= n - 1;
- else
- i = 0;
- }
- }
-
- for( ; i <= rNum.GetLevel(); ++i )
- {
- const SvxNumberFormat& rNFmt = GetLevel( i );
- if( SVX_NUM_NUMBER_NONE == rNFmt.GetNumberingType() )
- {
- continue;
- }
-
- sal_Bool bDot = sal_True;
- if( rNum.GetLevelVal()[ i ] )
- {
- if(SVX_NUM_BITMAP != rNFmt.GetNumberingType())
- aStr += rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], aLocale );
- else
- bDot = sal_False;
- }
- else
- aStr += sal_Unicode('0'); // all 0-levels are a 0
- if( i != rNum.GetLevel() && bDot)
- aStr += sal_Unicode('.');
- }
- }
-
- if( bInclStrings )
- {
- aStr.Insert( rMyNFmt.GetPrefix(), 0 );
- aStr += rMyNFmt.GetSuffix();
- }
- }
- return aStr;
-}
-
-// changes linked to embedded bitmaps
-sal_Bool SvxNumRule::UnLinkGraphics()
-{
- sal_Bool bRet = sal_False;
- for(sal_uInt16 i = 0; i < GetLevelCount(); i++)
- {
- SvxNumberFormat aFmt(GetLevel(i));
- const SvxBrushItem* pBrush = aFmt.GetBrush();
- const String* pLinkStr;
- const Graphic* pGraphic;
- if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
- {
- if(pBrush &&
- 0 != (pLinkStr = pBrush->GetGraphicLink()) &&
- pLinkStr->Len() &&
- 0 !=(pGraphic = pBrush->GetGraphic()))
- {
- SvxBrushItem aTempItem(*pBrush);
- aTempItem.SetGraphicLink( String());
- aTempItem.SetGraphic(*pGraphic);
- sal_Int16 eOrient = aFmt.GetVertOrient();
- aFmt.SetGraphicBrush( &aTempItem, &aFmt.GetGraphicSize(), &eOrient );
- bRet = sal_True;
- }
- }
- else if((SVX_NUM_BITMAP|LINK_TOKEN) == aFmt.GetNumberingType())
- aFmt.SetNumberingType(SVX_NUM_BITMAP);
- SetLevel(i, aFmt);
- }
- return bRet;
-}
-
-SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule) :
- SfxPoolItem(SID_ATTR_NUMBERING_RULE),
- pNumRule(new SvxNumRule(rRule))
-{
-}
-
-SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule, sal_uInt16 _nWhich ) :
- SfxPoolItem(_nWhich),
- pNumRule(new SvxNumRule(rRule))
-{
-}
-
-SfxPoolItem* SvxNumBulletItem::Create(SvStream &s, sal_uInt16 n) const
-{
- return SfxPoolItem::Create(s, n );
-}
-
-SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) :
- SfxPoolItem(rCopy.Which())
-{
- pNumRule = new SvxNumRule(*rCopy.pNumRule);
-}
-
-SvxNumBulletItem::~SvxNumBulletItem()
-{
- delete pNumRule;
-}
-
-int SvxNumBulletItem::operator==( const SfxPoolItem& rCopy) const
-{
- return *pNumRule == *((SvxNumBulletItem&)rCopy).pNumRule;
-}
-
-SfxPoolItem* SvxNumBulletItem::Clone( SfxItemPool * ) const
-{
- return new SvxNumBulletItem(*this);
-}
-
-sal_uInt16 SvxNumBulletItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
-{
- return NUMITEM_VERSION_03;
-}
-
-SvStream& SvxNumBulletItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/ )const
-{
- pNumRule->Store(rStream);
- return rStream;
-}
-
-bool SvxNumBulletItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
-{
- rVal <<= SvxCreateNumRule( pNumRule );
- return true;
-}
-
-bool SvxNumBulletItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
-{
- uno::Reference< container::XIndexReplace > xRule;
- if( rVal >>= xRule )
- {
- try
- {
- SvxNumRule* pNewRule = new SvxNumRule( SvxGetNumRule( xRule ) );
- if( pNewRule->GetLevelCount() != pNumRule->GetLevelCount() ||
- pNewRule->GetNumRuleType() != pNumRule->GetNumRuleType() )
- {
- SvxNumRule* pConverted = SvxConvertNumRule( pNewRule, pNumRule->GetLevelCount(), pNumRule->GetNumRuleType() );
- delete pNewRule;
- pNewRule = pConverted;
- }
- delete pNumRule;
- pNumRule = pNewRule;
- return true;
- }
- catch(lang::IllegalArgumentException&)
- {
- }
- }
- return false;
-}
-
-SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevels, SvxNumRuleType eType )
-{
- const sal_uInt16 nSrcLevels = pRule->GetLevelCount();
- SvxNumRule* pNewRule = new SvxNumRule( pRule->GetFeatureFlags(), nLevels, pRule->IsContinuousNumbering(), eType );
-
- for( sal_uInt16 nLevel = 0; (nLevel < nLevels) && (nLevel < nSrcLevels); nLevel++ )
- pNewRule->SetLevel( nLevel, pRule->GetLevel( nLevel ) );
-
- return pNewRule;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/optitems.cxx b/editeng/source/items/optitems.cxx
deleted file mode 100644
index 82df688afd..0000000000
--- a/editeng/source/items/optitems.cxx
+++ /dev/null
@@ -1,205 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <tools/shl.hxx>
-#include <tools/resid.hxx>
-#include <tools/stream.hxx>
-#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
-
-#include <editeng/optitems.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng/editrids.hrc>
-#include <editeng/eerdll.hxx>
-#include <editeng/editrids.hrc>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::linguistic2;
-
-// STATIC DATA -----------------------------------------------------------
-
-TYPEINIT1(SfxSpellCheckItem, SfxPoolItem);
-TYPEINIT1(SfxHyphenRegionItem, SfxPoolItem);
-
-// class SfxSpellCheckItem -----------------------------------------------
-
-SfxSpellCheckItem::SfxSpellCheckItem
-(
- Reference< XSpellChecker1 > &xChecker,
- sal_uInt16 _nWhich
-) :
-
- SfxPoolItem( _nWhich )
-{
- xSpellCheck = xChecker;
-}
-
-// -----------------------------------------------------------------------
-
-SfxSpellCheckItem::SfxSpellCheckItem( const SfxSpellCheckItem& rItem ) :
-
- SfxPoolItem( rItem ),
- xSpellCheck( rItem.GetXSpellChecker() )
-{
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SfxSpellCheckItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit ,
- SfxMapUnit ,
- String& 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:
- {
- return ePres;
- }
- default:
- return SFX_ITEM_PRESENTATION_NONE;
- }
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxSpellCheckItem::Clone( SfxItemPool* ) const
-{
- return new SfxSpellCheckItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-int SfxSpellCheckItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rItem), "unequal types" );
- return ( xSpellCheck == ( (const SfxSpellCheckItem& )rItem ).GetXSpellChecker() );
-}
-
-// class SfxHyphenRegionItem -----------------------------------------------
-
-SfxHyphenRegionItem::SfxHyphenRegionItem( const sal_uInt16 nId ) :
-
- SfxPoolItem( nId )
-{
- nMinLead = nMinTrail = 0;
-}
-
-// -----------------------------------------------------------------------
-
-SfxHyphenRegionItem::SfxHyphenRegionItem( const SfxHyphenRegionItem& rItem ) :
-
- SfxPoolItem ( rItem ),
-
- nMinLead ( rItem.GetMinLead() ),
- nMinTrail ( rItem.GetMinTrail() )
-{
-}
-
-// -----------------------------------------------------------------------
-
-int SfxHyphenRegionItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return ( ( ( (SfxHyphenRegionItem&)rAttr ).nMinLead == nMinLead ) &&
- ( ( (SfxHyphenRegionItem&)rAttr ).nMinTrail == nMinTrail ) );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxHyphenRegionItem::Clone( SfxItemPool* ) const
-{
- return new SfxHyphenRegionItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SfxHyphenRegionItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit ,
- SfxMapUnit ,
- String& 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 += String::CreateFromInt32( nMinLead );
- rText += String( EditResId( RID_SVXITEMS_HYPHEN_MINLEAD ) );
- rText += ',';
- rText += String::CreateFromInt32( nMinTrail );
- rText += String( EditResId( RID_SVXITEMS_HYPHEN_MINTRAIL ) );
- return ePres;
- }
- default:
- return SFX_ITEM_PRESENTATION_NONE;
- }
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxHyphenRegionItem::Create(SvStream& rStrm, sal_uInt16 ) const
-{
- sal_uInt8 _nMinLead, _nMinTrail;
- rStrm >> _nMinLead >> _nMinTrail;
- SfxHyphenRegionItem* pAttr = new SfxHyphenRegionItem( Which() );
- pAttr->GetMinLead() = _nMinLead;
- pAttr->GetMinTrail() = _nMinTrail;
- return pAttr;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxHyphenRegionItem::Store( SvStream& rStrm, sal_uInt16 ) const
-{
- rStrm << (sal_uInt8) GetMinLead()
- << (sal_uInt8) GetMinTrail();
- return rStrm;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/page.src b/editeng/source/items/page.src
deleted file mode 100644
index 5d1448858a..0000000000
--- a/editeng/source/items/page.src
+++ /dev/null
@@ -1,107 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
- // include ---------------------------------------------------------------
-
-#include <editeng/editrids.hrc>
-
-String RID_SVXSTR_PAPERBIN
-{
- Text [ en-US ] = "Paper tray" ;
-};
-String RID_SVXSTR_PAPERBIN_SETTINGS
-{
- Text [ en-US ] = "[From printer settings]" ;
-};
- // ********************************************************************** EOF
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/editeng/source/items/paperinf.cxx b/editeng/source/items/paperinf.cxx
deleted file mode 100644
index 8796f6d7bc..0000000000
--- a/editeng/source/items/paperinf.cxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-// include ---------------------------------------------------------------
-
-#include <limits.h>
-#include <tools/shl.hxx>
-#include <tools/debug.hxx>
-#include <vcl/svapp.hxx>
-#include <editeng/editrids.hrc>
-#include <editeng/paperinf.hxx>
-#include <editeng/eerdll.hxx>
-
-/*--------------------------------------------------------------------
- Description: Is the printer valid
- --------------------------------------------------------------------*/
-
-inline sal_Bool IsValidPrinter( const Printer* pPtr )
-{
- return pPtr->GetName().Len() ? sal_True : sal_False;
-}
-
-//------------------------------------------------------------------------
-
-Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit )
-{
- PaperInfo aInfo(ePaper);
- Size aRet(aInfo.getWidth(), aInfo.getHeight()); // in 100thMM
- return eUnit == MAP_100TH_MM ? aRet : OutputDevice::LogicToLogic(aRet, MAP_100TH_MM, eUnit);
-}
-
-/*------------------------------------------------------------------------
- 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 ?
-//Always returns TWIPS for known paper sizes or on failure.
-//But in the case of PAPER_USER paper and with a Printer with a mapmode set
-//will return in those printer units ?
-Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter )
-{
- if ( !IsValidPrinter(pPrinter) )
- return GetPaperSize( PAPER_A4 );
- const Paper ePaper = pPrinter->GetPaper();
-
- if ( ePaper == PAPER_USER )
- {
- // Orientation not take into account, as the right size has
- // been already set by SV
- Size aPaperSize = pPrinter->GetPaperSize();
- const Size aInvalidSize;
-
- if ( aPaperSize == aInvalidSize )
- return GetPaperSize(PAPER_A4);
- MapMode aMap1 = pPrinter->GetMapMode();
- MapMode aMap2;
-
- if ( aMap1 == aMap2 )
- aPaperSize =
- pPrinter->PixelToLogic( aPaperSize, MapMode( MAP_TWIP ) );
- return aPaperSize;
- }
-
- const Orientation eOrient = pPrinter->GetOrientation();
- Size aSize( GetPaperSize( ePaper ) );
- // for Landscape exchange the pages, has already been done by SV
- if ( eOrient == ORIENTATION_LANDSCAPE )
- Swap( aSize );
- return aSize;
-}
-
-// -----------------------------------------------------------------------
-
-Paper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit, bool bSloppy )
-{
- Size aSize(eUnit == MAP_100TH_MM ? rSize : OutputDevice::LogicToLogic(rSize, eUnit, MAP_100TH_MM));
- PaperInfo aInfo(aSize.Width(), aSize.Height());
- if (bSloppy)
- aInfo.doSloppyFit();
- return aInfo.getPaper();
-}
-
-// -----------------------------------------------------------------------
-
-long SvxPaperInfo::GetSloppyPaperDimension( long nSize, MapUnit eUnit )
-{
- nSize = eUnit == MAP_100TH_MM ? nSize : OutputDevice::LogicToLogic(nSize, eUnit, MAP_100TH_MM);
- nSize = PaperInfo::sloppyFitPageDimension(nSize);
- return eUnit == MAP_100TH_MM ? nSize : OutputDevice::LogicToLogic(nSize, MAP_100TH_MM, eUnit);
-}
-
-// -----------------------------------------------------------------------
-
-Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit )
-{
- PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
- Size aRet(aInfo.getWidth(), aInfo.getHeight());
- return eUnit == MAP_100TH_MM ? aRet : OutputDevice::LogicToLogic(aRet, MAP_100TH_MM, eUnit);
-}
-
-/*------------------------------------------------------------------------
- Description: String representation for the SV-defines of paper size
-------------------------------------------------------------------------*/
-
-String SvxPaperInfo::GetName( Paper ePaper )
-{
- return String( Printer::GetPaperName( ePaper ) );
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
deleted file mode 100644
index 0ee0c2b189..0000000000
--- a/editeng/source/items/paraitem.cxx
+++ /dev/null
@@ -1,1705 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-// include ---------------------------------------------------------------
-#include <com/sun/star/style/TabStop.hpp>
-#include <com/sun/star/style/LineSpacing.hpp>
-#include <com/sun/star/style/LineSpacingMode.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <comphelper/processfactory.hxx>
-#include <unotools/syslocale.hxx>
-#include <comphelper/types.hxx>
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-
-#include <tools/rtti.hxx>
-#define GLOBALOVERFLOW3
-
-#define _SVX_PARAITEM_CXX
-#include <svl/itempool.hxx>
-
-#include <svl/memberid.hrc>
-#include <editeng/editrids.hrc>
-
-#include <editeng/lspcitem.hxx>
-#include <editeng/adjitem.hxx>
-#include <editeng/orphitem.hxx>
-#include <editeng/widwitem.hxx>
-#include <editeng/tstpitem.hxx>
-#include <editeng/pmdlitem.hxx>
-#include <editeng/spltitem.hxx>
-#include <editeng/hyznitem.hxx>
-#include <editeng/scriptspaceitem.hxx>
-#include <editeng/hngpnctitem.hxx>
-#include <editeng/forbiddenruleitem.hxx>
-#include <editeng/paravertalignitem.hxx>
-#include <editeng/pgrditem.hxx>
-#include <rtl/ustring.hxx>
-#include <editeng/memberids.hrc>
-#include <editeng/editids.hrc>
-#include <editeng/itemtype.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng/paperinf.hxx>
-#include <vcl/svapp.hxx>
-#include <algorithm>
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-
-// Konvertierung fuer UNO
-#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
-#define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L))
-#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
-#define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L))
-
-
-// STATIC DATA -----------------------------------------------------------
-
-
-// -----------------------------------------------------------------------
-
-
-TYPEINIT1_FACTORY(SvxLineSpacingItem, SfxPoolItem , new SvxLineSpacingItem(LINE_SPACE_DEFAULT_HEIGHT, 0));
-TYPEINIT1_FACTORY(SvxAdjustItem, SfxPoolItem, new SvxAdjustItem(SVX_ADJUST_LEFT, 0));
-TYPEINIT1_FACTORY(SvxWidowsItem, SfxByteItem, new SvxWidowsItem(0, 0));
-TYPEINIT1_FACTORY(SvxOrphansItem, SfxByteItem, new SvxOrphansItem(0, 0));
-TYPEINIT1_FACTORY(SvxHyphenZoneItem, SfxPoolItem, new SvxHyphenZoneItem(sal_False, 0));
-TYPEINIT1_FACTORY(SvxTabStopItem, SfxPoolItem, new SvxTabStopItem(0));
-TYPEINIT1_FACTORY(SvxFmtSplitItem, SfxBoolItem, new SvxFmtSplitItem(sal_False, 0));
-TYPEINIT1_FACTORY(SvxPageModelItem, SfxStringItem, new SvxPageModelItem(0));
-TYPEINIT1_FACTORY(SvxScriptSpaceItem, SfxBoolItem, new SvxScriptSpaceItem(sal_False, 0));
-TYPEINIT1_FACTORY(SvxHangingPunctuationItem, SfxBoolItem, new SvxHangingPunctuationItem(sal_False, 0));
-TYPEINIT1_FACTORY(SvxForbiddenRuleItem, SfxBoolItem, new SvxForbiddenRuleItem(sal_False, 0));
-TYPEINIT1_FACTORY(SvxParaVertAlignItem, SfxUInt16Item, new SvxParaVertAlignItem(0, 0));
-TYPEINIT1_FACTORY(SvxParaGridItem, SfxBoolItem, new SvxParaGridItem(sal_True, 0));
-
-SV_IMPL_VARARR_SORT( SvxTabStopArr, SvxTabStop )
-
-// -----------------------------------------------------------------------
-
-SvxLineSpacingItem::SvxLineSpacingItem( sal_uInt16 nHeight, const sal_uInt16 nId )
- : SfxEnumItemInterface( nId )
-{
- nPropLineSpace = 100;
- nInterLineSpace = 0;
- nLineHeight = nHeight;
- eLineSpace = SVX_LINE_SPACE_AUTO;
- eInterLineSpace = SVX_INTER_LINE_SPACE_OFF;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxLineSpacingItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- const SvxLineSpacingItem& rLineSpace = (const SvxLineSpacingItem&)rAttr;
- return (
- // Same Linespacing Rule?
- (eLineSpace == rLineSpace.eLineSpace)
- // For maximum and minimum Linespacing be the size must coincide.
- && (eLineSpace == SVX_LINE_SPACE_AUTO ||
- nLineHeight == rLineSpace.nLineHeight)
- // Same Linespacing Rule?
- && ( eInterLineSpace == rLineSpace.eInterLineSpace )
- // Either set proportional or additive.
- && (( eInterLineSpace == SVX_INTER_LINE_SPACE_OFF)
- || (eInterLineSpace == SVX_INTER_LINE_SPACE_PROP
- && nPropLineSpace == rLineSpace.nPropLineSpace)
- || (eInterLineSpace == SVX_INTER_LINE_SPACE_FIX
- && (nInterLineSpace == rLineSpace.nInterLineSpace)))) ?
- 1 : 0;
-}
-
-/* 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;
-
- style::LineSpacing aLSp;
- switch( eLineSpace )
- {
- case SVX_LINE_SPACE_AUTO:
- if(eInterLineSpace == SVX_INTER_LINE_SPACE_FIX)
- {
- aLSp.Mode = style::LineSpacingMode::LEADING;
- aLSp.Height = ( bConvert ? (short)TWIP_TO_MM100(nInterLineSpace) : nInterLineSpace);
- }
- else if(eInterLineSpace == SVX_INTER_LINE_SPACE_OFF)
- {
- aLSp.Mode = style::LineSpacingMode::PROP;
- aLSp.Height = 100;
- }
- else
- {
- aLSp.Mode = style::LineSpacingMode::PROP;
- aLSp.Height = nPropLineSpace;
- }
- break;
- case SVX_LINE_SPACE_FIX :
- case SVX_LINE_SPACE_MIN :
- aLSp.Mode = eLineSpace == SVX_LINE_SPACE_FIX ? style::LineSpacingMode::FIX : style::LineSpacingMode::MINIMUM;
- aLSp.Height = ( bConvert ? (short)TWIP_TO_MM100_UNSIGNED(nLineHeight) : nLineHeight );
- break;
- default:
- ;//prevent warning about SVX_LINE_SPACE_END
- }
-
- switch ( nMemberId )
- {
- case 0 : rVal <<= aLSp; break;
- case MID_LINESPACE : rVal <<= aLSp.Mode; break;
- case MID_HEIGHT : rVal <<= aLSp.Height; break;
- default: OSL_FAIL("Wrong MemberId!"); break;
- }
-
- return true;
-}
-
-bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
-
- // fill with current data
- style::LineSpacing aLSp;
- uno::Any aAny;
- sal_Bool bRet = QueryValue( aAny, bConvert ? CONVERT_TWIPS : 0 ) && ( aAny >>= aLSp );
-
- // get new data
- switch ( nMemberId )
- {
- case 0 : bRet = (rVal >>= aLSp); break;
- case MID_LINESPACE : bRet = (rVal >>= aLSp.Mode); break;
- case MID_HEIGHT : bRet = (rVal >>= aLSp.Height); break;
- default: OSL_FAIL("Wrong MemberId!"); break;
- }
-
- if( bRet )
- {
- nLineHeight = aLSp.Height;
- switch( aLSp.Mode )
- {
- case style::LineSpacingMode::LEADING:
- {
- eInterLineSpace = SVX_INTER_LINE_SPACE_FIX;
- eLineSpace = SVX_LINE_SPACE_AUTO;
- nInterLineSpace = aLSp.Height;
- if(bConvert)
- nInterLineSpace = (short)MM100_TO_TWIP(nInterLineSpace);
-
- }
- break;
- case style::LineSpacingMode::PROP:
- {
- eLineSpace = SVX_LINE_SPACE_AUTO;
- nPropLineSpace = (sal_Int8)std::min(aLSp.Height, (short)0xFF);
- if(100 == aLSp.Height)
- eInterLineSpace = SVX_INTER_LINE_SPACE_OFF;
- else
- eInterLineSpace = SVX_INTER_LINE_SPACE_PROP;
- }
- break;
- case style::LineSpacingMode::FIX:
- case style::LineSpacingMode::MINIMUM:
- {
- eInterLineSpace = SVX_INTER_LINE_SPACE_OFF;
- eLineSpace = aLSp.Mode == style::LineSpacingMode::FIX ? SVX_LINE_SPACE_FIX : SVX_LINE_SPACE_MIN;
- nLineHeight = aLSp.Height;
- if(bConvert)
- nLineHeight = (sal_uInt16)MM100_TO_TWIP_UNSIGNED(nLineHeight);
- }
- break;
- }
- }
-
- return bRet;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxLineSpacingItem::Clone( SfxItemPool * ) const
-{
- return new SvxLineSpacingItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxLineSpacingItem::GetPresentation
-(
- SfxItemPresentation /*ePres*/,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
-) const
-{
-#ifdef DBG_UTIL
- rText.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SvxLineSpacingItem" ));
-#else
- rText.Erase();
-#endif
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxLineSpacingItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_Int8 nPropSpace;
- short nInterSpace;
- sal_uInt16 nHeight;
- sal_Int8 nRule, nInterRule;
-
- rStrm >> nPropSpace
- >> nInterSpace
- >> nHeight
- >> nRule
- >> nInterRule;
-
- SvxLineSpacingItem* pAttr = new SvxLineSpacingItem( nHeight, Which() );
- pAttr->SetInterLineSpace( nInterSpace );
- pAttr->SetPropLineSpace( nPropSpace );
- pAttr->GetLineSpaceRule() = (SvxLineSpace)nRule;
- pAttr->GetInterLineSpaceRule() = (SvxInterLineSpace)nInterRule;
- return pAttr;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxLineSpacingItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Int8) GetPropLineSpace()
- << (short) GetInterLineSpace()
- << (sal_uInt16) GetLineHeight()
- << (sal_Int8) GetLineSpaceRule()
- << (sal_Int8) GetInterLineSpaceRule();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxLineSpacingItem::GetValueCount() const
-{
- return SVX_LINESPACE_END; // SVX_LINESPACE_TWO_LINES + 1
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxLineSpacingItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- //! load strings from resource
- XubString aText;
- switch ( nPos )
- {
- 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;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxLineSpacingItem::GetEnumValue() const
-{
- sal_uInt16 nVal;
- switch ( nPropLineSpace )
- {
- case 100: nVal = SVX_LINESPACE_ONE_LINE; break;
- case 150: nVal = SVX_LINESPACE_ONE_POINT_FIVE_LINES; break;
- case 200: nVal = SVX_LINESPACE_TWO_LINES; break;
- default: nVal = SVX_LINESPACE_USER; break;
- }
- return nVal;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal )
-{
- switch ( nVal )
- {
- case SVX_LINESPACE_ONE_LINE: nPropLineSpace = 100; break;
- case SVX_LINESPACE_ONE_POINT_FIVE_LINES: nPropLineSpace = 150; break;
- case SVX_LINESPACE_TWO_LINES: nPropLineSpace = 200; break;
- }
-}
-
-// class SvxAdjustItem ---------------------------------------------------
-
-SvxAdjustItem::SvxAdjustItem(const SvxAdjust eAdjst, const sal_uInt16 nId )
- : SfxEnumItemInterface( nId ),
- bOneBlock( sal_False ), bLastCenter( sal_False ), bLastBlock( sal_False )
-{
- SetAdjust( eAdjst );
-}
-
-// -----------------------------------------------------------------------
-
-int SvxAdjustItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return( ( GetAdjust() == ((SvxAdjustItem&)rAttr).GetAdjust() &&
- bOneBlock == ((SvxAdjustItem&)rAttr).bOneBlock &&
- bLastCenter == ((SvxAdjustItem&)rAttr).bLastCenter &&
- bLastBlock == ((SvxAdjustItem&)rAttr).bLastBlock )
- ? 1 : 0 );
-}
-
-bool SvxAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId )
- {
- case MID_PARA_ADJUST : rVal <<= (sal_Int16)GetAdjust(); break;
- case MID_LAST_LINE_ADJUST : rVal <<= (sal_Int16)GetLastBlock(); break;
- case MID_EXPAND_SINGLE :
- {
- sal_Bool bValue = bOneBlock;
- rVal.setValue( &bValue, ::getCppuBooleanType() );
- break;
- }
- default: ;//prevent warning
- }
- return true;
-}
-
-bool SvxAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId )
- {
- case MID_PARA_ADJUST :
- case MID_LAST_LINE_ADJUST :
- {
- sal_Int32 eVal = - 1;
- try
- {
- eVal = ::comphelper::getEnumAsINT32(rVal);
- }
- catch(...) {}
- if(eVal >= 0 && eVal <= 4)
- {
- if(MID_LAST_LINE_ADJUST == nMemberId &&
- eVal != SVX_ADJUST_LEFT &&
- eVal != SVX_ADJUST_BLOCK &&
- eVal != SVX_ADJUST_CENTER)
- return sal_False;
- if(eVal < (sal_uInt16)SVX_ADJUST_END)
- nMemberId == MID_PARA_ADJUST ?
- SetAdjust((SvxAdjust)eVal) :
- SetLastBlock((SvxAdjust)eVal);
- }
- }
- break;
- case MID_EXPAND_SINGLE :
- bOneBlock = Any2Bool(rVal);
- break;
- }
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxAdjustItem::Clone( SfxItemPool * ) const
-{
- return new SvxAdjustItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxAdjustItem::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 = GetValueTextByPos( (sal_uInt16)GetAdjust() );
- return ePres;
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxAdjustItem::GetValueCount() const
-{
- return SVX_ADJUST_END; // SVX_ADJUST_BLOCKLINE + 1
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxAdjustItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- DBG_ASSERT( nPos <= (sal_uInt16)SVX_ADJUST_BLOCKLINE, "enum overflow!" );
- return EE_RESSTR(RID_SVXITEMS_ADJUST_BEGIN + nPos);
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxAdjustItem::GetEnumValue() const
-{
- return (sal_uInt16)GetAdjust();
-}
-
-// -----------------------------------------------------------------------
-
-void SvxAdjustItem::SetEnumValue( sal_uInt16 nVal )
-{
- SetAdjust( (const SvxAdjust)nVal );
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxAdjustItem::GetVersion( sal_uInt16 nFileVersion ) const
-{
- return (nFileVersion == SOFFICE_FILEFORMAT_31)
- ? 0 : ADJUST_LASTBLOCK_VERSION;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxAdjustItem::Create(SvStream& rStrm, sal_uInt16 nVersion) const
-{
- char eAdjustment;
- rStrm >> eAdjustment;
- SvxAdjustItem *pRet = new SvxAdjustItem( (SvxAdjust)eAdjustment, Which() );
- if( nVersion >= ADJUST_LASTBLOCK_VERSION )
- {
- sal_Int8 nFlags;
- rStrm >> nFlags;
- pRet->bOneBlock = 0 != (nFlags & 0x0001);
- pRet->bLastCenter = 0 != (nFlags & 0x0002);
- pRet->bLastBlock = 0 != (nFlags & 0x0004);
- }
- return pRet;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxAdjustItem::Store( SvStream& rStrm, sal_uInt16 nItemVersion ) const
-{
- rStrm << (char)GetAdjust();
- if ( nItemVersion >= ADJUST_LASTBLOCK_VERSION )
- {
- sal_Int8 nFlags = 0;
- if ( bOneBlock )
- nFlags |= 0x0001;
- if ( bLastCenter )
- nFlags |= 0x0002;
- if ( bLastBlock )
- nFlags |= 0x0004;
- rStrm << (sal_Int8) nFlags;
- }
- return rStrm;
-}
-
-// class SvxWidowsItem ---------------------------------------------------
-
-SvxWidowsItem::SvxWidowsItem(const sal_uInt8 nL, const sal_uInt16 nId ) :
- SfxByteItem( nId, nL )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxWidowsItem::Clone( SfxItemPool * ) const
-{
- return new SvxWidowsItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxWidowsItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_Int8 nLines;
- rStrm >> nLines;
- return new SvxWidowsItem( nLines, Which() );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxWidowsItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Int8)GetValue();
- return rStrm;
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxWidowsItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- {
- rText.Erase();
- break;
- }
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- {
- rText = EE_RESSTR(RID_SVXITEMS_LINES);
- break;
- }
-
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- rText = EE_RESSTR(RID_SVXITEMS_WIDOWS_COMPLETE);
- rText += ' ';
- rText += EE_RESSTR(RID_SVXITEMS_LINES);
- }
-
- default:
- {
- DBG_ERRORFILE( "SvxWidowsItem::GetPresentation(): unknown SfxItemPresentation" );
- }
- }
-
- rText.SearchAndReplace( String::CreateFromAscii( "%1" ), String::CreateFromInt32( GetValue() ) );
- return ePres;
-}
-
-// class SvxOrphansItem --------------------------------------------------
-
-SvxOrphansItem::SvxOrphansItem(const sal_uInt8 nL, const sal_uInt16 nId ) :
- SfxByteItem( nId, nL )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxOrphansItem::Clone( SfxItemPool * ) const
-{
- return new SvxOrphansItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxOrphansItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_Int8 nLines;
- rStrm >> nLines;
- return new SvxOrphansItem( nLines, Which() );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxOrphansItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Int8) GetValue();
- return rStrm;
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxOrphansItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- {
- rText.Erase();
- break;
- }
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- {
- rText = EE_RESSTR(RID_SVXITEMS_LINES);
- break;
- }
-
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- rText = EE_RESSTR(RID_SVXITEMS_ORPHANS_COMPLETE);
- rText += ' ';
- rText += EE_RESSTR(RID_SVXITEMS_LINES);
- }
-
- default:
- {
- DBG_ERRORFILE( "SvxOrphansItem::GetPresentation(): unknown SfxItemPresentation" );
- }
- }
-
- rText.SearchAndReplace( String::CreateFromAscii( "%1" ), String::CreateFromInt32( GetValue() ) );
- return ePres;
-}
-
-// class SvxHyphenZoneItem -----------------------------------------------
-
-SvxHyphenZoneItem::SvxHyphenZoneItem( const sal_Bool bHyph, const sal_uInt16 nId ) :
- SfxPoolItem( nId )
-{
- bHyphen = bHyph;
- bPageEnd = sal_True;
- nMinLead = nMinTrail = 0;
- nMaxHyphens = 255;
-}
-
-// -----------------------------------------------------------------------
-bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case MID_IS_HYPHEN:
- rVal = Bool2Any(bHyphen);
- break;
- case MID_HYPHEN_MIN_LEAD:
- rVal <<= (sal_Int16)nMinLead;
- break;
- case MID_HYPHEN_MIN_TRAIL:
- rVal <<= (sal_Int16)nMinTrail;
- break;
- case MID_HYPHEN_MAX_HYPHENS:
- rVal <<= (sal_Int16)nMaxHyphens;
- break;
- }
- return true;
-}
-// -----------------------------------------------------------------------
-bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- sal_Int16 nNewVal = 0;
-
- if( nMemberId != MID_IS_HYPHEN )
- if(!(rVal >>= nNewVal))
- return false;
-
- switch(nMemberId)
- {
- case MID_IS_HYPHEN:
- bHyphen = Any2Bool(rVal);
- break;
- case MID_HYPHEN_MIN_LEAD:
- nMinLead = (sal_uInt8)nNewVal;
- break;
- case MID_HYPHEN_MIN_TRAIL:
- nMinTrail = (sal_uInt8)nNewVal;
- break;
- case MID_HYPHEN_MAX_HYPHENS:
- nMaxHyphens = (sal_uInt8)nNewVal;
- break;
- }
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxHyphenZoneItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return ( (((SvxHyphenZoneItem&)rAttr).bHyphen == bHyphen)
- && (((SvxHyphenZoneItem&)rAttr).bPageEnd == bPageEnd)
- && (((SvxHyphenZoneItem&)rAttr).nMinLead == nMinLead)
- && (((SvxHyphenZoneItem&)rAttr).nMinTrail == nMinTrail)
- && (((SvxHyphenZoneItem&)rAttr).nMaxHyphens == nMaxHyphens) );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxHyphenZoneItem::Clone( SfxItemPool * ) const
-{
- return new SvxHyphenZoneItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxHyphenZoneItem::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:
- {
- sal_uInt16 nId = RID_SVXITEMS_HYPHEN_FALSE;
-
- if ( bHyphen )
- nId = RID_SVXITEMS_HYPHEN_TRUE;
- rText = EE_RESSTR(nId);
- rText += cpDelim;
- nId = RID_SVXITEMS_PAGE_END_FALSE;
-
- if ( bPageEnd )
- nId = RID_SVXITEMS_PAGE_END_TRUE;
- rText += EE_RESSTR(nId);
- rText += cpDelim;
- rText += String::CreateFromInt32( nMinLead );
- rText += cpDelim;
- rText += String::CreateFromInt32( nMinTrail );
- rText += cpDelim;
- rText += String::CreateFromInt32( nMaxHyphens );
- return SFX_ITEM_PRESENTATION_COMPLETE;
- }
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nId = RID_SVXITEMS_HYPHEN_FALSE;
-
- if ( bHyphen )
- nId = RID_SVXITEMS_HYPHEN_TRUE;
- rText = EE_RESSTR(nId);
- rText += cpDelim;
- nId = RID_SVXITEMS_PAGE_END_FALSE;
-
- if ( bPageEnd )
- nId = RID_SVXITEMS_PAGE_END_TRUE;
- rText += EE_RESSTR(nId);
- rText += cpDelim;
- rText += String::CreateFromInt32(nMinLead);
- rText += EE_RESSTR(RID_SVXITEMS_HYPHEN_MINLEAD);
- rText += cpDelim;
- rText += String::CreateFromInt32(nMinTrail);
- rText += EE_RESSTR(RID_SVXITEMS_HYPHEN_MINTRAIL);
- rText += cpDelim;
- rText += String::CreateFromInt32(nMaxHyphens);
- rText += EE_RESSTR(RID_SVXITEMS_HYPHEN_MAX);
- return SFX_ITEM_PRESENTATION_COMPLETE;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxHyphenZoneItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_Int8 _bHyphen, _bHyphenPageEnd;
- sal_Int8 _nMinLead, _nMinTrail, _nMaxHyphens;
- rStrm >> _bHyphen >> _bHyphenPageEnd >> _nMinLead >> _nMinTrail >> _nMaxHyphens;
- SvxHyphenZoneItem* pAttr = new SvxHyphenZoneItem( sal_False, Which() );
- pAttr->SetHyphen( sal_Bool( _bHyphen != 0 ) );
- pAttr->SetPageEnd( sal_Bool( _bHyphenPageEnd != 0 ) );
- pAttr->GetMinLead() = _nMinLead;
- pAttr->GetMinTrail() = _nMinTrail;
- pAttr->GetMaxHyphens() = _nMaxHyphens;
- return pAttr;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxHyphenZoneItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Int8) IsHyphen()
- << (sal_Int8) IsPageEnd()
- << (sal_Int8) GetMinLead()
- << (sal_Int8) GetMinTrail()
- << (sal_Int8) GetMaxHyphens();
- return rStrm;
-}
-
-// class SvxTabStop ------------------------------------------------------
-
-SvxTabStop::SvxTabStop()
-{
- nTabPos = 0;
- eAdjustment = SVX_TAB_ADJUST_LEFT;
- m_cDecimal = cDfltDecimalChar;
- cFill = cDfltFillChar;
-}
-
-// -----------------------------------------------------------------------
-
-SvxTabStop::SvxTabStop( const sal_Int32 nPos, const SvxTabAdjust eAdjst,
- const sal_Unicode cDec, const sal_Unicode cFil )
-{
- nTabPos = nPos;
- eAdjustment = eAdjst;
- m_cDecimal = cDec;
- cFill = cFil;
-}
-// -----------------------------------------------------------------------------
-void SvxTabStop::fillDecimal() const
-{
- if ( cDfltDecimalChar == m_cDecimal )
- m_cDecimal = SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0);
-}
-// -----------------------------------------------------------------------
-
-XubString SvxTabStop::GetValueString() const
-{
- XubString aStr;
-
- aStr += sal_Unicode( '(' );
- aStr += UniString::CreateFromInt32(nTabPos);
- aStr += cpDelim;
- aStr += XubString( EditResId( RID_SVXITEMS_TAB_ADJUST_BEGIN + (sal_uInt16)eAdjustment ) );
-
- aStr += cpDelim;
- aStr += sal_Unicode('[');
- aStr += XubString( EditResId( RID_SVXITEMS_TAB_DECIMAL_CHAR ) );
- aStr += GetDecimal();
- aStr += sal_Unicode(']');
- aStr += cpDelim;
- aStr += cpDelim;
- aStr += sal_Unicode('[');
- aStr += XubString( EditResId( RID_SVXITEMS_TAB_FILL_CHAR ) );
- aStr += cFill;
- aStr += sal_Unicode(']');
- aStr += sal_Unicode(')');
-
- return aStr;
-}
-
-// class SvxTabStopItem --------------------------------------------------
-
-SvxTabStopItem::SvxTabStopItem( sal_uInt16 _nWhich ) :
- SfxPoolItem( _nWhich ),
- SvxTabStopArr( sal_Int8(SVX_TAB_DEFCOUNT) )
-{
- const sal_uInt16 nTabs = SVX_TAB_DEFCOUNT, nDist = SVX_TAB_DEFDIST;
- const SvxTabAdjust eAdjst= SVX_TAB_ADJUST_DEFAULT;
-
- for (sal_uInt16 i = 0; i < nTabs; ++i)
- {
- SvxTabStop aTab( (i + 1) * nDist, eAdjst );
- SvxTabStopArr::Insert( aTab );
- }
-}
-
-// -----------------------------------------------------------------------
-
-SvxTabStopItem::SvxTabStopItem( const sal_uInt16 nTabs,
- const sal_uInt16 nDist,
- const SvxTabAdjust eAdjst,
- sal_uInt16 _nWhich ) :
- SfxPoolItem( _nWhich ),
- SvxTabStopArr( sal_Int8(nTabs) )
-{
- for ( sal_uInt16 i = 0; i < nTabs; ++i )
- {
- SvxTabStop aTab( (i + 1) * nDist, eAdjst );
- SvxTabStopArr::Insert( aTab );
- }
-}
-
-// -----------------------------------------------------------------------
-
-SvxTabStopItem::SvxTabStopItem( const SvxTabStopItem& rTSI ) :
- SfxPoolItem( rTSI.Which() ),
- SvxTabStopArr( (sal_Int8)rTSI.Count() )
-{
- SvxTabStopArr::Insert( &rTSI );
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxTabStopItem::GetPos( const SvxTabStop& rTab ) const
-{
- sal_uInt16 nFound;
- return Seek_Entry( rTab, &nFound ) ? nFound : SVX_TAB_NOTFOUND;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxTabStopItem::GetPos( const sal_Int32 nPos ) const
-{
- sal_uInt16 nFound;
- return Seek_Entry( SvxTabStop( nPos ), &nFound ) ? nFound : SVX_TAB_NOTFOUND;
-}
-
-// -----------------------------------------------------------------------
-
-SvxTabStopItem& SvxTabStopItem::operator=( const SvxTabStopItem& rTSI )
-{
- Remove( 0, Count() );
- SvxTabStopArr::Insert( &rTSI );
- return *this;
-}
-
-bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
- switch ( nMemberId )
- {
- case MID_TABSTOPS:
- {
- sal_uInt16 nCount = Count();
- uno::Sequence< style::TabStop> aSeq(nCount);
- style::TabStop* pArr = aSeq.getArray();
- for(sal_uInt16 i = 0; i < nCount; i++)
- {
- const SvxTabStop& rTab = *(GetStart() + i);
- pArr[i].Position = bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos();
- switch(rTab.GetAdjustment())
- {
- case SVX_TAB_ADJUST_LEFT : pArr[i].Alignment = style::TabAlign_LEFT; break;
- case SVX_TAB_ADJUST_RIGHT : pArr[i].Alignment = style::TabAlign_RIGHT; break;
- case SVX_TAB_ADJUST_DECIMAL: pArr[i].Alignment = style::TabAlign_DECIMAL; break;
- case SVX_TAB_ADJUST_CENTER : pArr[i].Alignment = style::TabAlign_CENTER; break;
- default: //SVX_TAB_ADJUST_DEFAULT
- pArr[i].Alignment = style::TabAlign_DEFAULT;
-
- }
- pArr[i].DecimalChar = rTab.GetDecimal();
- pArr[i].FillChar = rTab.GetFill();
- }
- rVal <<= aSeq;
- break;
- }
- case MID_STD_TAB:
- {
- const SvxTabStop &rTab = *(GetStart());
- rVal <<= (static_cast<sal_Int32>(bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos()));
- break;
- }
- }
- return sal_True;
-}
-
-bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
- switch ( nMemberId )
- {
- case MID_TABSTOPS:
- {
- uno::Sequence< style::TabStop> aSeq;
- if(!(rVal >>= aSeq))
- {
- uno::Sequence < uno::Sequence < uno::Any > > aAnySeq;
- if (!(rVal >>= aAnySeq))
- return sal_False;
- sal_Int32 nLength = aAnySeq.getLength();
- aSeq.realloc( nLength );
- for ( sal_Int32 n=0; n<nLength; n++ )
- {
- uno::Sequence < uno::Any >& rAnySeq = aAnySeq[n];
- if ( rAnySeq.getLength() == 4 )
- {
- if (!(rAnySeq[0] >>= aSeq[n].Position)) return sal_False;
- if (!(rAnySeq[1] >>= aSeq[n].Alignment))
- {
- sal_Int32 nVal = 0;
- if (rAnySeq[1] >>= nVal)
- aSeq[n].Alignment = (com::sun::star::style::TabAlign) nVal;
- else
- return sal_False;
- }
- if (!(rAnySeq[2] >>= aSeq[n].DecimalChar))
- {
- ::rtl::OUString aVal;
- if ( (rAnySeq[2] >>= aVal) && aVal.getLength() == 1 )
- aSeq[n].DecimalChar = aVal.toChar();
- else
- return sal_False;
- }
- if (!(rAnySeq[3] >>= aSeq[n].FillChar))
- {
- ::rtl::OUString aVal;
- if ( (rAnySeq[3] >>= aVal) && aVal.getLength() == 1 )
- aSeq[n].FillChar = aVal.toChar();
- else
- return sal_False;
- }
- }
- else
- return sal_False;
- }
- }
-
- SvxTabStopArr::Remove( 0, Count() );
- const style::TabStop* pArr = aSeq.getConstArray();
- const sal_uInt16 nCount = (sal_uInt16)aSeq.getLength();
- for(sal_uInt16 i = 0; i < nCount ; i++)
- {
- SvxTabAdjust eAdjust = SVX_TAB_ADJUST_DEFAULT;
- switch(pArr[i].Alignment)
- {
- case style::TabAlign_LEFT : eAdjust = SVX_TAB_ADJUST_LEFT; break;
- case style::TabAlign_CENTER : eAdjust = SVX_TAB_ADJUST_CENTER; break;
- case style::TabAlign_RIGHT : eAdjust = SVX_TAB_ADJUST_RIGHT; break;
- case style::TabAlign_DECIMAL: eAdjust = SVX_TAB_ADJUST_DECIMAL; break;
- default: ;//prevent warning
- }
- sal_Unicode cFill = pArr[i].FillChar;
- sal_Unicode cDecimal = pArr[i].DecimalChar;
- SvxTabStop aTab( bConvert ? MM100_TO_TWIP(pArr[i].Position) : pArr[i].Position,
- eAdjust,
- cDecimal,
- cFill );
- Insert(aTab);
- }
- break;
- }
- case MID_STD_TAB:
- {
- 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 ( nNewPos, rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() );
- Remove ( 0 );
- Insert( aNewTab );
- break;
- }
- }
- return sal_True;
-}
-// -----------------------------------------------------------------------
-
-int SvxTabStopItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- const SvxTabStopItem& rTSI = (SvxTabStopItem&)rAttr;
-
- if ( Count() != rTSI.Count() )
- return 0;
-
- for ( sal_uInt16 i = 0; i < Count(); ++i )
- if( !(*this)[i].IsEqual( rTSI[i] ) )
- return 0;
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxTabStopItem::Clone( SfxItemPool * ) const
-{
- return new SvxTabStopItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxTabStopItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreUnit,
- SfxMapUnit ePresUnit,
- XubString& rText, const IntlWrapper *pIntl
-) const
-{
- rText.Erase();
-
- if ( ePres > SFX_ITEM_PRESENTATION_NONE )
- {
- sal_Bool bComma = sal_False;
-
- for ( sal_uInt16 i = 0; i < Count(); ++i )
- {
- if ( SVX_TAB_ADJUST_DEFAULT != ((*this)[i]).GetAdjustment() )
- {
- if ( bComma )
- rText += sal_Unicode(',');
- rText += GetMetricText(
- ((*this)[i]).GetTabPos(), eCoreUnit, ePresUnit, pIntl );
- if ( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
- rText += EE_RESSTR(GetMetricId(ePresUnit));
- bComma = sal_True;
- }
- }
- }
- return ePres;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxTabStopItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Int8 nTabs;
- rStrm >> nTabs;
- SvxTabStopItem* pAttr =
- new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_DEFAULT, Which() );
-
- for ( sal_Int8 i = 0; i < nTabs; i++ )
- {
- sal_Int32 nPos(0);
- sal_Int8 eAdjust;
- unsigned char cDecimal, cFill;
- rStrm >> nPos >> eAdjust >> cDecimal >> cFill;
- if( !i || SVX_TAB_ADJUST_DEFAULT != eAdjust )
- pAttr->Insert( SvxTabStop
- ( nPos, (SvxTabAdjust)eAdjust, sal_Unicode(cDecimal), sal_Unicode(cFill) ) );
- }
- return pAttr;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
-{
- // Default-Tabs are only expanded for the default Attribute. For complete
- // backward compabillity (<=304) all tabs have to be expanded, this makes
- // the files grow large in size. All only SWG!
-
- const SfxItemPool *pPool = SfxItemPool::GetStoringPool();
- const bool bStoreDefTabs = pPool
- && pPool->GetName().EqualsAscii("SWG")
- && ::IsDefaultItem( this );
-
- const short nTabs = Count();
- sal_uInt16 nCount = 0, nDefDist = 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 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;
-
- sal_Int32 lA3Width = SvxPaperInfo::GetPaperSize(PAPER_A3).Width();
- nCount = (sal_uInt16)(nNew < lA3Width ? ( lA3Width - nNew ) / nDefDist + 1 : 0);
- }
-
- rStrm << (sal_Int8) ( nTabs + nCount );
- for ( short i = 0; i < nTabs; i++ )
- {
- const SvxTabStop& rTab = (*this)[ i ];
- rStrm << rTab.GetTabPos()
- << (sal_Int8) rTab.GetAdjustment()
- << (unsigned char) rTab.GetDecimal()
- << (unsigned char) rTab.GetFill();
- }
-
- if ( bStoreDefTabs )
- for( ; nCount; --nCount )
- {
- SvxTabStop aSwTabStop(nNew, SVX_TAB_ADJUST_DEFAULT);
- rStrm << aSwTabStop.GetTabPos()
- << (sal_Int8) aSwTabStop.GetAdjustment()
- << (unsigned char) aSwTabStop.GetDecimal()
- << (unsigned char) aSwTabStop.GetFill();
- nNew += nDefDist;
- }
-
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-sal_Bool SvxTabStopItem::Insert( const SvxTabStop& rTab )
-{
- sal_uInt16 nTabPos = GetPos(rTab);
- if(SVX_TAB_NOTFOUND != nTabPos )
- Remove(nTabPos);
- return SvxTabStopArr::Insert( rTab );
-}
-// -----------------------------------------------------------------------
-void SvxTabStopItem::Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart,
- sal_uInt16 nEnd )
-{
- for( sal_uInt16 i = nStart; i < nEnd && i < pTabs->Count(); i++ )
- {
- const SvxTabStop& rTab = (*pTabs)[i];
- sal_uInt16 nTabPos = GetPos(rTab);
- if(SVX_TAB_NOTFOUND != nTabPos)
- Remove(nTabPos);
- }
- SvxTabStopArr::Insert( pTabs, nStart, nEnd );
-}
-
-
-
-// class SvxFmtSplitItem -------------------------------------------------
-SvxFmtSplitItem::~SvxFmtSplitItem()
-{
-}
-// -----------------------------------------------------------------------
-SfxPoolItem* SvxFmtSplitItem::Clone( SfxItemPool * ) const
-{
- return new SvxFmtSplitItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxFmtSplitItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Int8)GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFmtSplitItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Int8 bIsSplit;
- rStrm >> bIsSplit;
- return new SvxFmtSplitItem( sal_Bool( bIsSplit != 0 ), Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxFmtSplitItem::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:
- {
- sal_uInt16 nId = RID_SVXITEMS_FMTSPLIT_FALSE;
-
- if ( GetValue() )
- nId = RID_SVXITEMS_FMTSPLIT_TRUE;
- rText = EE_RESSTR(nId);
- return ePres;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// --------------------------------------------------------------------
-
-SfxPoolItem* SvxPageModelItem::Clone( SfxItemPool* ) const
-{
- return new SvxPageModelItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-bool SvxPageModelItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
-
- switch ( nMemberId )
- {
- case MID_AUTO: rVal <<= (sal_Bool) bAuto; break;
- case MID_NAME: rVal <<= ::rtl::OUString( GetValue() ); break;
- default: OSL_FAIL("Wrong MemberId!"); return sal_False;
- }
-
- return sal_True;
-}
-
-bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- sal_Bool bRet;
- ::rtl::OUString aStr;
- switch ( nMemberId )
- {
- case MID_AUTO: bRet = ( rVal >>= bAuto ); break;
- case MID_NAME: bRet = ( rVal >>= aStr ); if ( bRet ) SetValue(aStr); break;
- default: OSL_FAIL("Wrong MemberId!"); return sal_False;
- }
-
- return bRet;
-}
-
-SfxItemPresentation SvxPageModelItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *
-) const
-{
- rText.Erase();
- bool bSet = ( GetValue().Len() > 0 );
-
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- return SFX_ITEM_PRESENTATION_NONE;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- if ( bSet )
- rText = GetValue();
- return SFX_ITEM_PRESENTATION_NAMELESS;
-
- case SFX_ITEM_PRESENTATION_COMPLETE:
- if ( bSet )
- {
- rText = EE_RESSTR(RID_SVXITEMS_PAGEMODEL_COMPLETE);
- rText += GetValue();
- }
- return SFX_ITEM_PRESENTATION_COMPLETE;
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-//------------------------------------------------------------------------
-
-SvxScriptSpaceItem::SvxScriptSpaceItem( sal_Bool bOn, const sal_uInt16 nId )
- : SfxBoolItem( nId, bOn )
-{
-}
-
-SfxPoolItem* SvxScriptSpaceItem::Clone( SfxItemPool * ) const
-{
- return new SvxScriptSpaceItem( GetValue(), Which() );
-}
-
-SfxPoolItem* SvxScriptSpaceItem::Create(SvStream & rStrm, sal_uInt16) const
-{
- sal_Bool bFlag;
- rStrm >> bFlag;
- return new SvxScriptSpaceItem( bFlag, Which() );
-}
-
-sal_uInt16 SvxScriptSpaceItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxTwoLinesItem: Is there a new file format? ");
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-SfxItemPresentation SvxScriptSpaceItem::GetPresentation(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
- String &rText, const IntlWrapper* /*pIntl*/ ) const
-{
- switch( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- break;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- rText = EE_RESSTR( !GetValue()
- ? RID_SVXITEMS_SCRPTSPC_OFF
- : RID_SVXITEMS_SCRPTSPC_ON );
- return ePres;
- }
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-//------------------------------------------------------------------------
-
-SvxHangingPunctuationItem::SvxHangingPunctuationItem(
- sal_Bool bOn, const sal_uInt16 nId )
- : SfxBoolItem( nId, bOn )
-{
-}
-
-SfxPoolItem* SvxHangingPunctuationItem::Clone( SfxItemPool * ) const
-{
- return new SvxHangingPunctuationItem( GetValue(), Which() );
-}
-
-SfxPoolItem* SvxHangingPunctuationItem::Create(SvStream & rStrm, sal_uInt16) const
-{
- sal_Bool nValue;
- rStrm >> nValue;
- return new SvxHangingPunctuationItem( nValue, Which() );
-}
-
-sal_uInt16 SvxHangingPunctuationItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxHangingPunctuationItem: Is there a new file format? ");
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-SfxItemPresentation SvxHangingPunctuationItem::GetPresentation(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
- String &rText, const IntlWrapper* /*pIntl*/ ) const
-{
- switch( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- break;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- rText = EE_RESSTR( !GetValue()
- ? RID_SVXITEMS_HNGPNCT_OFF
- : RID_SVXITEMS_HNGPNCT_ON );
- return ePres;
- }
- default: ;//prevent warning
- break;
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-//------------------------------------------------------------------------
-
-SvxForbiddenRuleItem::SvxForbiddenRuleItem(
- sal_Bool bOn, const sal_uInt16 nId )
- : SfxBoolItem( nId, bOn )
-{
-}
-
-SfxPoolItem* SvxForbiddenRuleItem::Clone( SfxItemPool * ) const
-{
- return new SvxForbiddenRuleItem( GetValue(), Which() );
-}
-
-SfxPoolItem* SvxForbiddenRuleItem::Create(SvStream & rStrm, sal_uInt16) const
-{
- sal_Bool nValue;
- rStrm >> nValue;
- return new SvxForbiddenRuleItem( nValue, Which() );
-}
-
-sal_uInt16 SvxForbiddenRuleItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxForbiddenRuleItem: Is there a new file format? ");
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-SfxItemPresentation SvxForbiddenRuleItem::GetPresentation(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
- String &rText, const IntlWrapper* /*pIntl*/ ) const
-{
- switch( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- break;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- rText = EE_RESSTR( !GetValue()
- ? RID_SVXITEMS_FORBIDDEN_RULE_OFF
- : RID_SVXITEMS_FORBIDDEN_RULE_ON );
- return ePres;
- }
- default: ;//prevent warning
- break;
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-/*************************************************************************
-|* class SvxParaVertAlignItem
-*************************************************************************/
-
-SvxParaVertAlignItem::SvxParaVertAlignItem( sal_uInt16 nValue,
- const sal_uInt16 nW )
- : SfxUInt16Item( nW, nValue )
-{
-}
-
-SfxPoolItem* SvxParaVertAlignItem::Clone( SfxItemPool* ) const
-{
- return new SvxParaVertAlignItem( GetValue(), Which() );
-}
-
-SfxPoolItem* SvxParaVertAlignItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_uInt16 nVal;
- rStrm >> nVal;
- return new SvxParaVertAlignItem( nVal, Which() );
-}
-
-SvStream& SvxParaVertAlignItem::Store( SvStream & rStrm, sal_uInt16 ) const
-{
- rStrm << GetValue();
- return rStrm;
-}
-
-sal_uInt16 SvxParaVertAlignItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-SfxItemPresentation SvxParaVertAlignItem::GetPresentation(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
- String &rText, const IntlWrapper* ) const
-{
- switch( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- break;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nTmp;
- switch( GetValue() )
- {
- case AUTOMATIC: nTmp = RID_SVXITEMS_PARAVERTALIGN_AUTO; break;
- case TOP: nTmp = RID_SVXITEMS_PARAVERTALIGN_TOP; break;
- case CENTER: nTmp = RID_SVXITEMS_PARAVERTALIGN_CENTER; break;
- case BOTTOM: nTmp = RID_SVXITEMS_PARAVERTALIGN_BOTTOM; break;
- default: nTmp = RID_SVXITEMS_PARAVERTALIGN_BASELINE; break;
- }
- rText = EE_RESSTR( nTmp );
- return ePres;
- }
- default: ;//prevent warning
- break;
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-bool SvxParaVertAlignItem::QueryValue( com::sun::star::uno::Any& rVal,
- sal_uInt8 /*nMemberId*/ ) const
-{
- rVal <<= (sal_Int16)GetValue();
- return sal_True;
-}
-
-bool SvxParaVertAlignItem::PutValue( const com::sun::star::uno::Any& rVal,
- sal_uInt8 /*nMemberId*/ )
-{
- sal_Int16 nVal = sal_Int16();
- if((rVal >>= nVal) && nVal >=0 && nVal <= BOTTOM )
- {
- SetValue( (sal_uInt16)nVal );
- return sal_True;
- }
- else
- return sal_False;
-}
-
-int SvxParaVertAlignItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return SfxUInt16Item::operator==( rItem );
-}
-
-
-SvxParaGridItem::SvxParaGridItem( sal_Bool bOn, const sal_uInt16 nId )
- : SfxBoolItem( nId, bOn )
-{
-}
-
-SfxPoolItem* SvxParaGridItem::Clone( SfxItemPool * ) const
-{
- return new SvxParaGridItem( GetValue(), Which() );
-}
-
-SfxPoolItem* SvxParaGridItem::Create(SvStream & rStrm, sal_uInt16) const
-{
- sal_Bool bFlag;
- rStrm >> bFlag;
- return new SvxParaGridItem( bFlag, Which() );
-}
-
-sal_uInt16 SvxParaGridItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxParaGridItem: Is there a new file format? ");
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-SfxItemPresentation SvxParaGridItem::GetPresentation(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
- String &rText, const IntlWrapper* /*pIntl*/ ) const
-{
- switch( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- break;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- rText = GetValue() ?
- EE_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_ON ) :
- EE_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_OFF );
-
- return ePres;
- }
- default: ;//prevent warning
- break;
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/svdfield.cxx b/editeng/source/items/svdfield.cxx
deleted file mode 100644
index 856364d3dd..0000000000
--- a/editeng/source/items/svdfield.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <editeng/measfld.hxx>
-
-SV_IMPL_PERSIST1(SdrMeasureField,SvxFieldData);
-
-SdrMeasureField::~SdrMeasureField()
-{
-}
-
-SvxFieldData* SdrMeasureField::Clone() const
-{
- return new SdrMeasureField(*this);
-}
-
-int SdrMeasureField::operator==(const SvxFieldData& rSrc) const
-{
- return eMeasureFieldKind==((SdrMeasureField&)rSrc).GetMeasureFieldKind();
-}
-
-void SdrMeasureField::Load(SvPersistStream& rIn)
-{
- sal_uInt16 nFieldKind;
- rIn>>nFieldKind;
- eMeasureFieldKind=(SdrMeasureFieldKind)nFieldKind;
-}
-
-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
deleted file mode 100644
index 909f2c580e..0000000000
--- a/editeng/source/items/svxfont.cxx
+++ /dev/null
@@ -1,809 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-// include ----------------------------------------------------------------
-
-#include <vcl/outdev.hxx>
-#include <vcl/print.hxx>
-#include <tools/poly.hxx>
-#include <unotools/charclass.hxx>
-#include <editeng/unolingu.hxx>
-#include <com/sun/star/i18n/KCharacterType.hpp>
-
-#define _SVX_SVXFONT_CXX
-
-#include <editeng/svxfont.hxx>
-#include <editeng/escpitem.hxx>
-
-// Minimum: Percentage of kernel
-#define MINKERNPERCENT 5
-
-#ifndef REDUCEDSVXFONT
- const sal_Unicode CH_BLANK = sal_Unicode(' '); // ' ' Space character
- static sal_Char const sDoubleSpace[] = " ";
-#endif
-
-
-SvxFont::SvxFont()
-{
- nKern = nEsc = 0;
- nPropr = 100;
- eCaseMap = SVX_CASEMAP_NOT_MAPPED;
- eLang = LANGUAGE_SYSTEM;
-}
-
-SvxFont::SvxFont( const Font &rFont )
- : Font( rFont )
-{
- nKern = nEsc = 0;
- nPropr = 100;
- eCaseMap = SVX_CASEMAP_NOT_MAPPED;
- eLang = LANGUAGE_SYSTEM;
-}
-
-SvxFont::SvxFont( const SvxFont &rFont )
- : Font( rFont )
-{
- nKern = rFont.GetFixKerning();
- nEsc = rFont.GetEscapement();
- nPropr = rFont.GetPropr();
- eCaseMap = rFont.GetCaseMap();
- eLang = rFont.GetLanguage();
-}
-
-
-void SvxFont::DrawArrow( OutputDevice &rOut, const Rectangle& rRect,
- const Size& rSize, const Color& rCol, sal_Bool bLeft )
-{
- long nLeft = ( rRect.Left() + rRect.Right() - rSize.Width() )/ 2;
- long nRight = nLeft + rSize.Width();
- long nMid = ( rRect.Top() + rRect.Bottom() ) / 2;
- long nTop = nMid - rSize.Height() / 2;
- long nBottom = nTop + rSize.Height();
- if( nLeft < rRect.Left() )
- {
- nLeft = rRect.Left();
- nRight = rRect.Right();
- }
- if( nTop < rRect.Top() )
- {
- nTop = rRect.Top();
- nBottom = rRect.Bottom();
- }
- Polygon aPoly;
- Point aTmp( bLeft ? nLeft : nRight, nMid );
- Point aNxt( bLeft ? nRight : nLeft, nTop );
- aPoly.Insert( 0, aTmp );
- aPoly.Insert( 0, aNxt );
- aNxt.Y() = nBottom;
- aPoly.Insert( 0, aNxt );
- aPoly.Insert( 0, aTmp );
- Color aOldLineColor = rOut.GetLineColor();
- Color aOldFillColor = rOut.GetFillColor();
- rOut.SetFillColor( rCol );
- rOut.SetLineColor( Color( COL_BLACK ) );
- rOut.DrawPolygon( aPoly );
- rOut.DrawLine( aTmp, aNxt );
- rOut.SetLineColor( aOldLineColor );
- rOut.SetFillColor( aOldFillColor );
-}
-
-
-XubString SvxFont::CalcCaseMap( const XubString &rTxt ) const
-{
- if( !IsCaseMap() || !rTxt.Len() ) return rTxt;
- XubString aTxt( rTxt );
- // I still have to get the language
- const LanguageType eLng = LANGUAGE_DONTKNOW == eLang
- ? LANGUAGE_SYSTEM : eLang;
-
- CharClass aCharClass( SvxCreateLocale( eLng ) );
-
- switch( eCaseMap )
- {
- case SVX_CASEMAP_KAPITAELCHEN:
- case SVX_CASEMAP_VERSALIEN:
- {
- aCharClass.toUpper( aTxt );
- break;
- }
-
- case SVX_CASEMAP_GEMEINE:
- {
- aCharClass.toLower( aTxt );
- break;
- }
- case SVX_CASEMAP_TITEL:
- {
- // 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 )
- {
- if( sal_Unicode(' ') == aTxt.GetChar(i) || sal_Unicode('\t') == aTxt.GetChar(i) )
- bBlank = sal_True;
- else
- {
- if( bBlank )
- {
- String aTemp( aTxt.GetChar( i ) );
- aCharClass.toUpper( aTemp );
- aTxt.Replace( i, 1, aTemp );
- }
- bBlank = sal_False;
- }
- }
- break;
- }
- default:
- {
- DBG_ASSERT(!this, "SvxFont::CaseMapTxt: unknown casemap");
- break;
- }
- }
- return aTxt;
-}
-
-/*************************************************************************
-* 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
- * 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
-{
-protected:
- OutputDevice *pOut;
- const XubString &rTxt;
- const xub_StrLen nIdx;
- const xub_StrLen nLen;
-
-public:
- SvxDoCapitals( OutputDevice *_pOut, const XubString &_rTxt,
- const xub_StrLen _nIdx, const xub_StrLen _nLen )
- : pOut(_pOut), rTxt(_rTxt), nIdx(_nIdx), nLen(_nLen)
- { }
-
- virtual void DoSpace( const sal_Bool bDraw );
- virtual void SetSpace();
- virtual void Do( const XubString &rTxt,
- const xub_StrLen nIdx, const xub_StrLen nLen,
- const sal_Bool bUpper ) = 0;
-
- inline OutputDevice *GetOut() { return pOut; }
- inline const XubString &GetTxt() const { return rTxt; }
- xub_StrLen GetIdx() const { return nIdx; }
- xub_StrLen GetLen() const { return nLen; }
-};
-
-void SvxDoCapitals::DoSpace( const sal_Bool /*bDraw*/ ) { }
-
-void SvxDoCapitals::SetSpace() { }
-
-void SvxDoCapitals::Do( const XubString &/*_rTxt*/, const xub_StrLen /*_nIdx*/,
- const xub_StrLen /*_nLen*/, const sal_Bool /*bUpper*/ ) { }
-
-/*************************************************************************
- * SvxFont::DoOnCapitals() const
- * 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
-{
- const XubString &rTxt = rDo.GetTxt();
- const xub_StrLen nIdx = rDo.GetIdx();
- const xub_StrLen nLen = STRING_LEN == nPartLen ? rDo.GetLen() : nPartLen;
-
- const XubString aTxt( CalcCaseMap( rTxt ) );
- const sal_uInt16 nTxtLen = Min( rTxt.Len(), nLen );
- sal_uInt16 nPos = 0;
- sal_uInt16 nOldPos = nPos;
-
- // #108210#
- // Test if string length differ between original and CaseMapped
- sal_Bool bCaseMapLengthDiffers(aTxt.Len() != rTxt.Len());
-
- const LanguageType eLng = LANGUAGE_DONTKNOW == eLang
- ? LANGUAGE_SYSTEM : eLang;
-
- CharClass aCharClass( SvxCreateLocale( eLng ) );
- String aCharString;
-
- while( nPos < nTxtLen )
- {
- // first in turn are teh uppercase letters
-
- // 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 )
- {
- aCharString = rTxt.GetChar( nPos + nIdx );
- sal_Int32 nCharacterType = aCharClass.getCharacterType( aCharString, 0 );
- if ( nCharacterType & ::com::sun::star::i18n::KCharacterType::LOWER )
- break;
- if ( ! ( nCharacterType & ::com::sun::star::i18n::KCharacterType::UPPER ) )
- break;
- ++nPos;
- }
- if( nOldPos != nPos )
- {
- if(bCaseMapLengthDiffers)
- {
- // #108210#
- // If strings differ work preparing the necessary snippet to address that
- // potential difference
- const XubString aSnippet(rTxt, nIdx + nOldPos, nPos-nOldPos);
- XubString aNewText = CalcCaseMap(aSnippet);
-
- rDo.Do( aNewText, 0, aNewText.Len(), sal_True );
- }
- else
- {
- rDo.Do( aTxt, nIdx + nOldPos, nPos-nOldPos, sal_True );
- }
-
- nOldPos = nPos;
- }
- // Now the lowercase are processed (without blanks)
- while( nPos < nTxtLen )
- {
- sal_uInt32 nCharacterType = aCharClass.getCharacterType( aCharString, 0 );
- if ( ( nCharacterType & ::com::sun::star::i18n::KCharacterType::UPPER ) )
- break;
- if ( CH_BLANK == aCharString )
- break;
- if( ++nPos < nTxtLen )
- aCharString = rTxt.GetChar( nPos + nIdx );
- }
- if( nOldPos != nPos )
- {
- if(bCaseMapLengthDiffers)
- {
- // #108210#
- // If strings differ work preparing the necessary snippet to address that
- // potential difference
- const XubString aSnippet(rTxt, nIdx + nOldPos, nPos - nOldPos);
- XubString aNewText = CalcCaseMap(aSnippet);
-
- rDo.Do( aNewText, 0, aNewText.Len(), sal_False );
- }
- else
- {
- rDo.Do( aTxt, nIdx + nOldPos, nPos-nOldPos, sal_False );
- }
-
- nOldPos = nPos;
- }
- // Now the blanks are<processed
- while( nPos < nTxtLen && CH_BLANK == aCharString && ++nPos < nTxtLen )
- aCharString = rTxt.GetChar( nPos + nIdx );
-
- if( nOldPos != nPos )
- {
- rDo.DoSpace( sal_False );
-
- if(bCaseMapLengthDiffers)
- {
- // #108210#
- // If strings differ work preparing the necessary snippet to address that
- // potential difference
- const XubString aSnippet(rTxt, nIdx + nOldPos, nPos - nOldPos);
- XubString aNewText = CalcCaseMap(aSnippet);
-
- rDo.Do( aNewText, 0, aNewText.Len(), sal_False );
- }
- else
- {
- rDo.Do( aTxt, nIdx + nOldPos, nPos - nOldPos, sal_False );
- }
-
- nOldPos = nPos;
- rDo.SetSpace();
- }
- }
- rDo.DoSpace( sal_True );
-}
-
-
-void SvxFont::SetPhysFont( OutputDevice *pOut ) const
-{
- const Font& rCurrentFont = pOut->GetFont();
- if ( nPropr == 100 )
- {
- if ( !rCurrentFont.IsSameInstance( *this ) )
- pOut->SetFont( *this );
- }
- else
- {
- Font aNewFont( *this );
- Size aSize( aNewFont.GetSize() );
- aNewFont.SetSize( Size( aSize.Width() * nPropr / 100L,
- aSize.Height() * nPropr / 100L ) );
- if ( !rCurrentFont.IsSameInstance( aNewFont ) )
- pOut->SetFont( aNewFont );
- }
-}
-
-
-Font SvxFont::ChgPhysFont( OutputDevice *pOut ) const
-{
- Font aOldFont( pOut->GetFont() );
- SetPhysFont( pOut );
- return aOldFont;
-}
-
-
-Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, const XubString &rTxt,
- const xub_StrLen nIdx, const xub_StrLen nLen ) const
-{
- if ( !IsCaseMap() && !IsKern() )
- return Size( pOut->GetTextWidth( rTxt, nIdx, nLen ),
- pOut->GetTextHeight() );
-
- Size aTxtSize;
- aTxtSize.setHeight( pOut->GetTextHeight() );
- if ( !IsCaseMap() )
- aTxtSize.setWidth( pOut->GetTextWidth( rTxt, nIdx, nLen ) );
- else
- {
- // #108210#
- const XubString aNewText = CalcCaseMap(rTxt);
- sal_Bool bCaseMapLengthDiffers(aNewText.Len() != rTxt.Len());
- sal_Int32 nWidth(0L);
-
- if(bCaseMapLengthDiffers)
- {
- // If strings differ work preparing the necessary snippet to address that
- // potential difference
- const XubString aSnippet(rTxt, nIdx, nLen);
- XubString _aNewText = CalcCaseMap(aSnippet);
- nWidth = pOut->GetTextWidth( _aNewText, 0, _aNewText.Len() );
- }
- else
- {
- nWidth = pOut->GetTextWidth( aNewText, nIdx, nLen );
- }
-
- aTxtSize.setWidth(nWidth);
- }
-
- if( IsKern() && ( nLen > 1 ) )
- aTxtSize.Width() += ( ( nLen-1 ) * long( nKern ) );
-
- return aTxtSize;
-}
-
-Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, const XubString &rTxt )
-{
- if ( !IsCaseMap() && !IsKern() )
- return Size( pOut->GetTextWidth( rTxt ), pOut->GetTextHeight() );
-
- Size aTxtSize;
- aTxtSize.setHeight( pOut->GetTextHeight() );
- if ( !IsCaseMap() )
- aTxtSize.setWidth( pOut->GetTextWidth( rTxt ) );
- else
- aTxtSize.setWidth( pOut->GetTextWidth( CalcCaseMap( rTxt ) ) );
-
- if( IsKern() && ( rTxt.Len() > 1 ) )
- aTxtSize.Width() += ( ( rTxt.Len()-1 ) * long( nKern ) );
-
- return aTxtSize;
-}
-
-Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const XubString &rTxt,
- const sal_uInt16 nIdx, const sal_uInt16 nLen, sal_Int32* pDXArray ) const
-{
- if ( !IsCaseMap() && !IsKern() )
- return Size( pOut->GetTextArray( rTxt, pDXArray, nIdx, nLen ),
- pOut->GetTextHeight() );
-
- Size aTxtSize;
- aTxtSize.setHeight( pOut->GetTextHeight() );
- if ( !IsCaseMap() )
- aTxtSize.setWidth( pOut->GetTextArray( rTxt, pDXArray, nIdx, nLen ) );
- else
- aTxtSize.setWidth( pOut->GetTextArray( CalcCaseMap( rTxt ),
- pDXArray, nIdx, nLen ) );
-
- if( IsKern() && ( nLen > 1 ) )
- {
- aTxtSize.Width() += ( ( nLen-1 ) * long( nKern ) );
-
- if ( pDXArray )
- {
- for ( xub_StrLen i = 0; i < nLen; i++ )
- pDXArray[i] += ( (i+1) * long( nKern ) );
- // The last one is a nKern too big:
- pDXArray[nLen-1] -= nKern;
- }
- }
- return aTxtSize;
-}
-
-
-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 ) // already initialized?
- nTmp = rTxt.Len();
- Font aOldFont( ChgPhysFont((OutputDevice *)pOut) );
- Size aTxtSize;
- if( IsCapital() && rTxt.Len() )
- {
- aTxtSize = GetCapitalSize( pOut, rTxt, nIdx, nTmp );
- }
- else aTxtSize = GetPhysTxtSize(pOut,rTxt,nIdx,nTmp);
- ((OutputDevice *)pOut)->SetFont( aOldFont );
- return aTxtSize;
-}
-
-
-void SvxFont::DrawText( OutputDevice *pOut,
- const Point &rPos, const XubString &rTxt,
- const xub_StrLen nIdx, const xub_StrLen nLen ) const
-{
- if( !nLen || !rTxt.Len() ) return;
- xub_StrLen nTmp = nLen;
- if ( nTmp == STRING_LEN ) // already initialized?
- nTmp = rTxt.Len();
- Point aPos( rPos );
- if ( nEsc )
- {
- Size aSize = (this->GetSize());
- aPos.Y() -= ((nEsc*long(aSize.Height()))/ 100L);
- }
- Font aOldFont( ChgPhysFont( pOut ) );
-
- if ( IsCapital() )
- DrawCapital( pOut, aPos, rTxt, nIdx, nTmp );
- else
- {
- Size aSize = GetPhysTxtSize( pOut, rTxt, nIdx, nTmp );
-
- if ( !IsCaseMap() )
- pOut->DrawStretchText( aPos, aSize.Width(), rTxt, nIdx, nTmp );
- else
- pOut->DrawStretchText( aPos, aSize.Width(), CalcCaseMap( rTxt ),
- nIdx, nTmp );
- }
- pOut->SetFont(aOldFont);
-}
-
-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 has to be selected in OutputDevice...
- if ( !IsCaseMap() && !IsCapital() && !IsKern() && !IsEsc() )
- {
- pOut->DrawTextArray( rPos, rTxt, pDXArray, nIdx, nLen );
- return;
- }
-
- Point aPos( rPos );
-
- if ( nEsc )
- {
- long nDiff = GetSize().Height();
- nDiff *= nEsc;
- nDiff /= 100;
-
- if ( !IsVertical() )
- aPos.Y() -= nDiff;
- else
- aPos.X() += nDiff;
- }
-
- if( IsCapital() )
- {
- DBG_ASSERT( !pDXArray, "DrawCapital not for TextArray!" );
- DrawCapital( pOut, aPos, rTxt, nIdx, nLen );
- }
- else
- {
- if ( IsKern() && !pDXArray )
- {
- Size aSize = GetPhysTxtSize( pOut, rTxt, nIdx, nLen );
-
- if ( !IsCaseMap() )
- pOut->DrawStretchText( aPos, aSize.Width(), rTxt, nIdx, nLen );
- else
- pOut->DrawStretchText( aPos, aSize.Width(), CalcCaseMap( rTxt ), nIdx, nLen );
- }
- else
- {
- if ( !IsCaseMap() )
- pOut->DrawTextArray( aPos, rTxt, pDXArray, nIdx, nLen );
- else
- pOut->DrawTextArray( aPos, CalcCaseMap( rTxt ), pDXArray, nIdx, nLen );
- }
- }
-}
-
-
-void SvxFont::DrawPrev( OutputDevice *pOut, Printer* pPrinter,
- const Point &rPos, const XubString &rTxt,
- const xub_StrLen nIdx, const xub_StrLen nLen ) const
-{
- if ( !nLen || !rTxt.Len() )
- return;
- xub_StrLen nTmp = nLen;
-
- if ( nTmp == STRING_LEN ) // already initialized?
- nTmp = rTxt.Len();
- Point aPos( rPos );
-
- if ( nEsc )
- {
- short nTmpEsc;
- if( DFLT_ESC_AUTO_SUPER == nEsc )
- nTmpEsc = 33;
- else if( DFLT_ESC_AUTO_SUB == nEsc )
- nTmpEsc = -20;
- else
- nTmpEsc = nEsc;
- Size aSize = ( this->GetSize() );
- aPos.Y() -= ( ( nTmpEsc * long( aSize.Height() ) ) / 100L );
- }
- Font aOldFont( ChgPhysFont( pOut ) );
- Font aOldPrnFont( ChgPhysFont( pPrinter ) );
-
- if ( IsCapital() )
- DrawCapital( pOut, aPos, rTxt, nIdx, nTmp );
- else
- {
- Size aSize = GetPhysTxtSize( pPrinter, rTxt, nIdx, nTmp );
-
- if ( !IsCaseMap() )
- pOut->DrawStretchText( aPos, aSize.Width(), rTxt, nIdx, nTmp );
- else
- {
- // #108210#
- const XubString aNewText = CalcCaseMap(rTxt);
- sal_Bool bCaseMapLengthDiffers(aNewText.Len() != rTxt.Len());
-
- if(bCaseMapLengthDiffers)
- {
- // If strings differ work preparing the necessary snippet to address that
- // potential difference
- const XubString aSnippet(rTxt, nIdx, nTmp);
- XubString _aNewText = CalcCaseMap(aSnippet);
-
- pOut->DrawStretchText( aPos, aSize.Width(), _aNewText, 0, _aNewText.Len() );
- }
- else
- {
- pOut->DrawStretchText( aPos, aSize.Width(), CalcCaseMap( rTxt ), nIdx, nTmp );
- }
- }
- }
- pOut->SetFont(aOldFont);
- pPrinter->SetFont( aOldPrnFont );
-}
-
-
-SvxFont& SvxFont::operator=( const Font& rFont )
-{
- Font::operator=( rFont );
- return *this;
-}
-
-SvxFont& SvxFont::operator=( const SvxFont& rFont )
-{
- Font::operator=( rFont );
- eLang = rFont.eLang;
- eCaseMap = rFont.eCaseMap;
- nEsc = rFont.nEsc;
- nPropr = rFont.nPropr;
- nKern = rFont.nKern;
- return *this;
-}
-
-class SvxDoGetCapitalSize : public SvxDoCapitals
-{
-protected:
- SvxFont* pFont;
- Size aTxtSize;
- short nKern;
-public:
- SvxDoGetCapitalSize( SvxFont *_pFnt, const OutputDevice *_pOut,
- const XubString &_rTxt, const xub_StrLen _nIdx,
- const xub_StrLen _nLen, const short _nKrn )
- : SvxDoCapitals( (OutputDevice*)_pOut, _rTxt, _nIdx, _nLen ),
- pFont( _pFnt ),
- nKern( _nKrn )
- { }
-
- virtual void Do( const XubString &rTxt, const xub_StrLen nIdx,
- const xub_StrLen nLen, const sal_Bool bUpper );
-
- inline const Size &GetSize() const { return aTxtSize; };
-};
-
-void SvxDoGetCapitalSize::Do( const XubString &_rTxt, const xub_StrLen _nIdx,
- const xub_StrLen _nLen, const sal_Bool bUpper )
-{
- Size aPartSize;
- if ( !bUpper )
- {
- sal_uInt8 nProp = pFont->GetPropr();
- pFont->SetProprRel( SMALL_CAPS_PERCENTAGE );
- pFont->SetPhysFont( pOut );
- aPartSize.setWidth( pOut->GetTextWidth( _rTxt, _nIdx, _nLen ) );
- aPartSize.setHeight( pOut->GetTextHeight() );
- aTxtSize.Height() = aPartSize.Height();
- pFont->SetPropr( nProp );
- pFont->SetPhysFont( pOut );
- }
- else
- {
- aPartSize.setWidth( pOut->GetTextWidth( _rTxt, _nIdx, _nLen ) );
- aPartSize.setHeight( pOut->GetTextHeight() );
- }
- aTxtSize.Width() += aPartSize.Width();
- aTxtSize.Width() += ( _nLen * long( nKern ) );
-}
-
-Size SvxFont::GetCapitalSize( const OutputDevice *pOut, const XubString &rTxt,
- const xub_StrLen nIdx, const xub_StrLen nLen) const
-{
- // Start:
- SvxDoGetCapitalSize aDo( (SvxFont *)this, pOut, rTxt, nIdx, nLen, nKern );
- DoOnCapitals( aDo );
- Size aTxtSize( aDo.GetSize() );
-
- // End:
- if( !aTxtSize.Height() )
- {
- aTxtSize.setWidth( 0 );
- aTxtSize.setHeight( pOut->GetTextHeight() );
- }
- return aTxtSize;
-}
-
-class SvxDoDrawCapital : public SvxDoCapitals
-{
-protected:
- SvxFont *pFont;
- Point aPos;
- Point aSpacePos;
- short nKern;
-public:
- SvxDoDrawCapital( SvxFont *pFnt, OutputDevice *_pOut, const XubString &_rTxt,
- const xub_StrLen _nIdx, const xub_StrLen _nLen,
- const Point &rPos, const short nKrn )
- : SvxDoCapitals( _pOut, _rTxt, _nIdx, _nLen ),
- pFont( pFnt ),
- aPos( rPos ),
- aSpacePos( rPos ),
- nKern( nKrn )
- { }
- virtual void DoSpace( const sal_Bool bDraw );
- virtual void SetSpace();
- virtual void Do( const XubString &rTxt, const xub_StrLen nIdx,
- const xub_StrLen nLen, const sal_Bool bUpper );
-};
-
-void SvxDoDrawCapital::DoSpace( const sal_Bool bDraw )
-{
- if ( bDraw || pFont->IsWordLineMode() )
- {
- sal_uInt16 nDiff = (sal_uInt16)(aPos.X() - aSpacePos.X());
- if ( nDiff )
- {
- sal_Bool bWordWise = pFont->IsWordLineMode();
- sal_Bool bTrans = pFont->IsTransparent();
- pFont->SetWordLineMode( sal_False );
- pFont->SetTransparent( sal_True );
- pFont->SetPhysFont( pOut );
- pOut->DrawStretchText( aSpacePos, nDiff, XubString( sDoubleSpace,
- RTL_TEXTENCODING_MS_1252 ), 0, 2 );
- pFont->SetWordLineMode( bWordWise );
- pFont->SetTransparent( bTrans );
- pFont->SetPhysFont( pOut );
- }
- }
-}
-
-void SvxDoDrawCapital::SetSpace()
-{
- if ( pFont->IsWordLineMode() )
- aSpacePos.X() = aPos.X();
-}
-
-void SvxDoDrawCapital::Do( const XubString &_rTxt, const xub_StrLen _nIdx,
- const xub_StrLen _nLen, const sal_Bool bUpper)
-{
- sal_uInt8 nProp = 0;
- Size aPartSize;
-
- // Set the desired font
- FontUnderline eUnder = pFont->GetUnderline();
- FontStrikeout eStrike = pFont->GetStrikeout();
- pFont->SetUnderline( UNDERLINE_NONE );
- pFont->SetStrikeout( STRIKEOUT_NONE );
- if ( !bUpper )
- {
- nProp = pFont->GetPropr();
- pFont->SetProprRel( SMALL_CAPS_PERCENTAGE );
- }
- pFont->SetPhysFont( pOut );
-
- aPartSize.setWidth( pOut->GetTextWidth( _rTxt, _nIdx, _nLen ) );
- aPartSize.setHeight( pOut->GetTextHeight() );
- long nWidth = aPartSize.Width();
- if ( nKern )
- {
- aPos.X() += (nKern/2);
- if ( _nLen ) nWidth += (_nLen*long(nKern));
- }
- pOut->DrawStretchText(aPos,nWidth-nKern,_rTxt,_nIdx,_nLen);
-
- // Restore Font
- pFont->SetUnderline( eUnder );
- pFont->SetStrikeout( eStrike );
- if ( !bUpper )
- pFont->SetPropr( nProp );
- pFont->SetPhysFont( pOut );
-
- aPos.X() += nWidth-(nKern/2);
-}
-
-/*************************************************************************
- * SvxFont::DrawCapital() draws the uppercase letter.
- *************************************************************************/
-
-void SvxFont::DrawCapital( OutputDevice *pOut,
- const Point &rPos, const XubString &rTxt,
- const xub_StrLen nIdx, const xub_StrLen nLen ) const
-{
- SvxDoDrawCapital aDo( (SvxFont *)this,pOut,rTxt,nIdx,nLen,rPos,nKern );
- DoOnCapitals( aDo );
-}
-
-#endif // !REDUCEDSVXFONT
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/svxitems.src b/editeng/source/items/svxitems.src
deleted file mode 100644
index 1cc547cebe..0000000000
--- a/editeng/source/items/svxitems.src
+++ /dev/null
@@ -1,1067 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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.
- *
- ************************************************************************/
- // include ------------------------------------------------------------------
-#include <editeng/editrids.hrc>
- // pragma -------------------------------------------------------------------
-
- // Value strings ------------------------------------------------------------
-String RID_SVXITEMS_TRUE
-{
- Text [ en-US ] = "True" ;
-};
-String RID_SVXITEMS_FALSE
-{
- Text [ en-US ] = "False" ;
-};
- // enum SvxBreak ------------------------------------------------------------
-String RID_SVXITEMS_BREAK_NONE
-{
- Text [ en-US ] = "No break" ;
-};
-String RID_SVXITEMS_BREAK_COLUMN_BEFORE
-{
- Text [ en-US ] = "Break before new column" ;
-};
-String RID_SVXITEMS_BREAK_COLUMN_AFTER
-{
- Text [ en-US ] = "Break after new column" ;
-};
-String RID_SVXITEMS_BREAK_COLUMN_BOTH
-{
- Text [ en-US ] = "Break before and after new column" ;
-};
-String RID_SVXITEMS_BREAK_PAGE_BEFORE
-{
- Text [ en-US ] = "Break before new page" ;
-};
-String RID_SVXITEMS_BREAK_PAGE_AFTER
-{
- Text [ en-US ] = "Break after new page" ;
-};
-String RID_SVXITEMS_BREAK_PAGE_BOTH
-{
- Text [ en-US ] = "Break before and after new page" ;
-};
- // enum SvxShadowLocation ---------------------------------------------------
-String RID_SVXITEMS_SHADOW_NONE
-{
- Text [ en-US ] = "No Shadow" ;
-};
-String RID_SVXITEMS_SHADOW_TOPLEFT
-{
- Text [ en-US ] = "Shadow top left" ;
-};
-String RID_SVXITEMS_SHADOW_TOPRIGHT
-{
- Text [ en-US ] = "Shadow top right" ;
-};
-String RID_SVXITEMS_SHADOW_BOTTOMLEFT
-{
- Text [ en-US ] = "Shadow bottom left" ;
-};
-String RID_SVXITEMS_SHADOW_BOTTOMRIGHT
-{
- Text [ en-US ] = "Shadow bottom right" ;
-};
- // enum ColorName -----------------------------------------------------------
-String RID_SVXITEMS_COLOR
-{
- Text [ en-US ] = "Color " ;
-};
-String RID_SVXITEMS_COLOR_BLACK
-{
- Text [ en-US ] = "Black" ;
-};
-String RID_SVXITEMS_COLOR_BLUE
-{
- Text [ en-US ] = "Blue" ;
-};
-String RID_SVXITEMS_COLOR_GREEN
-{
- Text [ en-US ] = "Green" ;
-};
-String RID_SVXITEMS_COLOR_CYAN
-{
- Text [ en-US ] = "Cyan" ;
-};
-String RID_SVXITEMS_COLOR_RED
-{
- Text [ en-US ] = "Red" ;
-};
-String RID_SVXITEMS_COLOR_MAGENTA
-{
- Text [ en-US ] = "Magenta" ;
-};
-String RID_SVXITEMS_COLOR_BROWN
-{
- Text [ en-US ] = "Brown" ;
-};
-String RID_SVXITEMS_COLOR_GRAY
-{
- Text [ en-US ] = "Gray" ;
-};
-String RID_SVXITEMS_COLOR_LIGHTGRAY
-{
- Text [ en-US ] = "Light Gray" ;
-};
-String RID_SVXITEMS_COLOR_LIGHTBLUE
-{
- Text [ en-US ] = "Light Blue" ;
-};
-String RID_SVXITEMS_COLOR_LIGHTGREEN
-{
- Text [ en-US ] = "Light Green" ;
-};
-String RID_SVXITEMS_COLOR_LIGHTCYAN
-{
- Text [ en-US ] = "Light Cyan" ;
-};
-String RID_SVXITEMS_COLOR_LIGHTRED
-{
- Text [ en-US ] = "Light Red" ;
-};
-String RID_SVXITEMS_COLOR_LIGHTMAGENTA
-{
- Text [ en-US ] = "Light Magenta" ;
-};
-String RID_SVXITEMS_COLOR_YELLOW
-{
- Text [ en-US ] = "Yellow" ;
-};
-String RID_SVXITEMS_COLOR_WHITE
-{
- Text [ en-US ] = "White" ;
-};
-String RID_SVXITEMS_COLOR_MENUBAR
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_MENUBARTEXT
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_POPUPMENU
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_POPUPMENUTEXT
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_WINDOWTEXT
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_WINDOWWORKSPACE
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_HIGHLIGHT
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_HIGHLIGHTTEXT
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_3DTEXT
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_3DFACE
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_3DLIGHT
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_3DSHADOW
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_SCROLLBAR
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_FIELD
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_COLOR_FIELDTEXT
-{
- Text = "?" ;
-};
- // enum FontItalic -------------------------------------------------------
-String RID_SVXITEMS_ITALIC_NONE
-{
- Text [ en-US ] = "Not Italic" ;
-};
-String RID_SVXITEMS_ITALIC_OBLIQUE
-{
- Text [ en-US ] = "Oblique italic" ;
-};
-String RID_SVXITEMS_ITALIC_NORMAL
-{
- Text [ en-US ] = "Italic" ;
-};
- // enum FontWeight -------------------------------------------------------
-String RID_SVXITEMS_WEIGHT_DONTKNOW
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_WEIGHT_THIN
-{
- Text [ en-US ] = "thin" ;
-};
-String RID_SVXITEMS_WEIGHT_ULTRALIGHT
-{
- Text [ en-US ] = "ultra thin" ;
-};
-String RID_SVXITEMS_WEIGHT_LIGHT
-{
- Text [ en-US ] = "light" ;
-};
-String RID_SVXITEMS_WEIGHT_SEMILIGHT
-{
- Text [ en-US ] = "semi light" ;
-};
-String RID_SVXITEMS_WEIGHT_NORMAL
-{
- Text [ en-US ] = "normal" ;
-};
-String RID_SVXITEMS_WEIGHT_MEDIUM
-{
- Text [ en-US ] = "medium" ;
-};
-String RID_SVXITEMS_WEIGHT_SEMIBOLD
-{
- Text [ en-US ] = "semi bold" ;
-};
-String RID_SVXITEMS_WEIGHT_BOLD
-{
- Text [ en-US ] = "bold" ;
-};
-String RID_SVXITEMS_WEIGHT_ULTRABOLD
-{
- Text [ en-US ] = "ultra bold" ;
-};
-String RID_SVXITEMS_WEIGHT_BLACK
-{
- Text [ en-US ] = "black" ;
-};
- // enum FontUnderline - used for underline ------------------------------
-String RID_SVXITEMS_UL_NONE
-{
- Text [ en-US ] = "No underline" ;
-};
-String RID_SVXITEMS_UL_SINGLE
-{
- Text [ en-US ] = "Single underline" ;
-};
-String RID_SVXITEMS_UL_DOUBLE
-{
- Text [ en-US ] = "Double underline" ;
-};
-String RID_SVXITEMS_UL_DOTTED
-{
- Text [ en-US ] = "Dotted underline" ;
-};
-String RID_SVXITEMS_UL_DONTKNOW
-{
- Text [ en-US ] = "Underline";
-};
-String RID_SVXITEMS_UL_DASH
-{
- Text [ en-US ] = "Underline (dashes)";
-};
-String RID_SVXITEMS_UL_LONGDASH
-{
- Text [ en-US ] = "Underline (long dashes)";
-};
-String RID_SVXITEMS_UL_DASHDOT
-{
- Text [ en-US ] = "Underline (dot dash)";
-};
-String RID_SVXITEMS_UL_DASHDOTDOT
-{
- Text [ en-US ] = "Underline (dot dot dash)";
-};
-String RID_SVXITEMS_UL_SMALLWAVE
-{
- Text [ en-US ] = "Underline (small wave)";
-};
-String RID_SVXITEMS_UL_WAVE
-{
- Text [ en-US ] = "Underline (Wave)";
-};
-String RID_SVXITEMS_UL_DOUBLEWAVE
-{
- Text [ en-US ] = "Underline (Double wave)";
-};
-String RID_SVXITEMS_UL_BOLD
-{
- Text [ en-US ] = "Underlined (Bold)";
-};
-String RID_SVXITEMS_UL_BOLDDOTTED
-{
- Text [ en-US ] = "Dotted underline (Bold)";
-};
-String RID_SVXITEMS_UL_BOLDDASH
-{
- Text [ en-US ] = "Underline (Dash bold)";
-};
-String RID_SVXITEMS_UL_BOLDLONGDASH
-{
- Text [ en-US ] = "Underline (long dash, bold)";
-};
-String RID_SVXITEMS_UL_BOLDDASHDOT
-{
- Text [ en-US ] = "Underline (dot dash, bold)";
-};
-String RID_SVXITEMS_UL_BOLDDASHDOTDOT
-{
- Text [ en-US ] = "Underline (dot dot dash, bold)";
-};
-String RID_SVXITEMS_UL_BOLDWAVE
-{
- Text [ en-US ] = "Underline (wave, bold)";
-};
- // enum FontUnderline - used for overline -------------------------------
-String RID_SVXITEMS_OL_NONE
-{
- Text [ en-US ] = "No overline" ;
-};
-String RID_SVXITEMS_OL_SINGLE
-{
- Text [ en-US ] = "Single overline" ;
-};
-String RID_SVXITEMS_OL_DOUBLE
-{
- Text [ en-US ] = "Double overline" ;
-};
-String RID_SVXITEMS_OL_DOTTED
-{
- Text [ en-US ] = "Dotted overline" ;
-};
-String RID_SVXITEMS_OL_DONTKNOW
-{
- Text [ en-US ] = "Overline";
-};
-String RID_SVXITEMS_OL_DASH
-{
- Text [ en-US ] = "Overline (dashes)";
-};
-String RID_SVXITEMS_OL_LONGDASH
-{
- Text [ en-US ] = "Overline (long dashes)";
-};
-String RID_SVXITEMS_OL_DASHDOT
-{
- Text [ en-US ] = "Overline (dot dash)";
-};
-String RID_SVXITEMS_OL_DASHDOTDOT
-{
- Text [ en-US ] = "Overline (dot dot dash)";
-};
-String RID_SVXITEMS_OL_SMALLWAVE
-{
- Text [ en-US ] = "Overline (small wave)";
-};
-String RID_SVXITEMS_OL_WAVE
-{
- Text [ en-US ] = "Overline (Wave)";
-};
-String RID_SVXITEMS_OL_DOUBLEWAVE
-{
- Text [ en-US ] = "Overline (Double wave)";
-};
-String RID_SVXITEMS_OL_BOLD
-{
- Text [ en-US ] = "Overlined (Bold)";
-};
-String RID_SVXITEMS_OL_BOLDDOTTED
-{
- Text [ en-US ] = "Dotted overline (Bold)";
-};
-String RID_SVXITEMS_OL_BOLDDASH
-{
- Text [ en-US ] = "Overline (Dash bold)";
-};
-String RID_SVXITEMS_OL_BOLDLONGDASH
-{
- Text [ en-US ] = "Overline (long dash, bold)";
-};
-String RID_SVXITEMS_OL_BOLDDASHDOT
-{
- Text [ en-US ] = "Overline (dot dash, bold)";
-};
-String RID_SVXITEMS_OL_BOLDDASHDOTDOT
-{
- Text [ en-US ] = "Overline (dot dot dash, bold)";
-};
-String RID_SVXITEMS_OL_BOLDWAVE
-{
- Text [ en-US ] = "Overline (wave, bold)";
-};
- // enum FontStrikeout ----------------------------------------------------
-String RID_SVXITEMS_STRIKEOUT_NONE
-{
- Text [ en-US ] = "No strikethrough" ;
-};
-String RID_SVXITEMS_STRIKEOUT_SINGLE
-{
- Text [ en-US ] = "Single strikethrough" ;
-};
-String RID_SVXITEMS_STRIKEOUT_DOUBLE
-{
- Text [ en-US ] = "Double strikethrough" ;
-};
-String RID_SVXITEMS_STRIKEOUT_BOLD
-{
- Text [ en-US ] = "Bold strikethrough";
-};
-String RID_SVXITEMS_STRIKEOUT_SLASH
-{
- Text [ en-US ] = "Strike through with slash";
-};
-String RID_SVXITEMS_STRIKEOUT_X
-{
- Text [ en-US ] = "Strike through with Xes";
-};
- // enum CASEMAP ----------------------------------------------------------
-String RID_SVXITEMS_CASEMAP_NONE
-{
- Text [ en-US ] = "None" ;
-};
-String RID_SVXITEMS_CASEMAP_VERSALIEN
-{
- Text [ en-US ] = "Caps" ;
-};
-String RID_SVXITEMS_CASEMAP_GEMEINE
-{
- Text [ en-US ] = "Lowercase" ;
-};
-String RID_SVXITEMS_CASEMAP_TITEL
-{
- Text [ en-US ] = "Title" ;
-};
-String RID_SVXITEMS_CASEMAP_KAPITAELCHEN
-{
- Text [ en-US ] = "Small caps" ;
-};
- // enum ESCAPEMENT -------------------------------------------------------
-String RID_SVXITEMS_ESCAPEMENT_OFF
-{
- Text [ en-US ] = "Normal position" ;
-};
-String RID_SVXITEMS_ESCAPEMENT_SUPER
-{
- Text [ en-US ] = "Superscript " ;
-};
-String RID_SVXITEMS_ESCAPEMENT_SUB
-{
- Text [ en-US ] = "Subscript " ;
-};
-String RID_SVXITEMS_ESCAPEMENT_AUTO
-{
- Text [ en-US ] = "automatic" ;
-};
- // enum SvxAdjust -----------------------------------------------------------
-String RID_SVXITEMS_ADJUST_LEFT
-{
- Text [ en-US ] = "Align left" ;
-};
-String RID_SVXITEMS_ADJUST_RIGHT
-{
- Text [ en-US ] = "Align right" ;
-};
-String RID_SVXITEMS_ADJUST_BLOCK
-{
- Text [ en-US ] = "Justify" ;
-};
-String RID_SVXITEMS_ADJUST_CENTER
-{
- Text [ en-US ] = "Centered" ;
-};
-String RID_SVXITEMS_ADJUST_BLOCKLINE
-{
- Text [ en-US ] = "Justify" ;
-};
- // enum SvxTabAdjust --------------------------------------------------------
-String RID_SVXITEMS_TAB_DECIMAL_CHAR
-{
- Text [ en-US ] = "Decimal Symbol:" ;
-};
-String RID_SVXITEMS_TAB_FILL_CHAR
-{
- Text [ en-US ] = "Fill character:" ;
-};
-String RID_SVXITEMS_TAB_ADJUST_LEFT
-{
- Text [ en-US ] = "Left" ;
-};
-String RID_SVXITEMS_TAB_ADJUST_RIGHT
-{
- Text [ en-US ] = "Right" ;
-};
-String RID_SVXITEMS_TAB_ADJUST_DECIMAL
-{
- Text [ en-US ] = "Decimal" ;
-};
-String RID_SVXITEMS_TAB_ADJUST_CENTER
-{
- Text [ en-US ] = "Centered" ;
-};
-String RID_SVXITEMS_TAB_ADJUST_DEFAULT
-{
- Text [ en-US ] = "Default" ;
-};
-String RID_SOLID
-{
- Text [ en-US ] = "Single, solid" ;
-};
-String RID_DOTTED
-{
- Text [ en-US ] = "Single, dotted" ;
-};
-String RID_DASHED
-{
- Text [ en-US ] = "Single, dashed" ;
-};
-String RID_DOUBLE
-{
- Text [ en-US ] = "Double" ;
-};
-String RID_THINTHICK_SMALLGAP
-{
- Text [ en-US ] = "Double, inside: fine, outside: thick, spacing: small";
-};
-String RID_THINTHICK_MEDIUMGAP
-{
- Text [ en-US ] = "Double, inside: fine, outside: thick, spacing: medium";
-};
-String RID_THINTHICK_LARGEGAP
-{
- Text [ en-US ] = "Double, inside: fine, outside: thick, spacing: large";
-};
-String RID_THICKTHIN_SMALLGAP
-{
- Text [ en-US ] = "Double, inside: thick, outside: fine, spacing: small";
-};
-String RID_THICKTHIN_MEDIUMGAP
-{
- Text [ en-US ] = "Double, inside: thick, outside: fine, spacing: medium";
-};
-String RID_THICKTHIN_LARGEGAP
-{
- Text [ en-US ] = "Double, inside: thick, outside: fine, spacing: large";
-};
-String RID_EMBOSSED
-{
- Text [ en-US ] = "3D embossed" ;
-};
-String RID_ENGRAVED
-{
- Text [ en-US ] = "3D engraved" ;
-};
-String RID_INSET
-{
- Text [ en-US ] = "Inset" ;
-};
-String RID_OUTSET
-{
- Text [ en-US ] = "Outset" ;
-};
-String RID_SVXITEMS_METRIC_MM
-{
- Text = "mm" ;
-};
-String RID_SVXITEMS_METRIC_CM
-{
- Text = "cm" ;
-};
-String RID_SVXITEMS_METRIC_INCH
-{
- Text = "inch" ;
-};
-String RID_SVXITEMS_METRIC_POINT
-{
- Text = "pt" ;
-};
-String RID_SVXITEMS_METRIC_TWIP
-{
- Text = "twip" ;
-};
-String RID_SVXITEMS_METRIC_PIXEL
-{
- Text = "pixel" ;
-};
- // GetValueText von BoolItems
-String RID_SVXITEMS_SHADOWED_TRUE
-{
- Text [ en-US ] = "Shadowed" ;
-};
-String RID_SVXITEMS_SHADOWED_FALSE
-{
- Text [ en-US ] = "Not Shadowed" ;
-};
-String RID_SVXITEMS_BLINK_TRUE
-{
- Text [ en-US ] = "Blinking" ;
-};
-String RID_SVXITEMS_BLINK_FALSE
-{
- Text [ en-US ] = "Not Blinking" ;
-};
-String RID_SVXITEMS_AUTOKERN_TRUE
-{
- Text [ en-US ] = "Pair Kerning" ;
-};
-String RID_SVXITEMS_AUTOKERN_FALSE
-{
- Text [ en-US ] = "No pair kerning" ;
-};
-String RID_SVXITEMS_WORDLINE_TRUE
-{
- Text [ en-US ] = "Individual words" ;
-};
-String RID_SVXITEMS_WORDLINE_FALSE
-{
- Text [ en-US ] = "Not Words Only" ;
-};
-String RID_SVXITEMS_CONTOUR_TRUE
-{
- Text [ en-US ] = "Outline" ;
-};
-String RID_SVXITEMS_CONTOUR_FALSE
-{
- Text [ en-US ] = "No Outline" ;
-};
-String RID_SVXITEMS_NOLINEBREAK_TRUE
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_NOLINEBREAK_FALSE
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_NOHYPHEN_TRUE
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_NOHYPHEN_FALSE
-{
- Text = "?" ;
-};
-String RID_SVXITEMS_PRINT_TRUE
-{
- Text [ en-US ] = "Print" ;
-};
-String RID_SVXITEMS_PRINT_FALSE
-{
- Text [ en-US ] = "Don't print" ;
-};
-String RID_SVXITEMS_OPAQUE_TRUE
-{
- Text [ en-US ] = "Opaque" ;
-};
-String RID_SVXITEMS_OPAQUE_FALSE
-{
- Text [ en-US ] = "Not Opaque" ;
-};
-String RID_SVXITEMS_FMTKEEP_TRUE
-{
- Text [ en-US ] = "Keep with next paragraph" ;
-};
-String RID_SVXITEMS_FMTKEEP_FALSE
-{
- Text [ en-US ] = "Don't Keep Paragraphs Together" ;
-};
-String RID_SVXITEMS_FMTSPLIT_TRUE
-{
- Text [ en-US ] = "Split paragraph" ;
-};
-String RID_SVXITEMS_FMTSPLIT_FALSE
-{
- Text [ en-US ] = "Don't split paragraph" ;
-};
-String RID_SVXITEMS_PROT_CONTENT_TRUE
-{
- Text [ en-US ] = "Contents protected" ;
-};
-String RID_SVXITEMS_PROT_CONTENT_FALSE
-{
- Text [ en-US ] = "Contents not protected" ;
-};
-String RID_SVXITEMS_PROT_SIZE_TRUE
-{
- Text [ en-US ] = "Size protected" ;
-};
-String RID_SVXITEMS_PROT_SIZE_FALSE
-{
- Text [ en-US ] = "Size not protected" ;
-};
-String RID_SVXITEMS_PROT_POS_TRUE
-{
- Text [ en-US ] = "Position protected" ;
-};
-String RID_SVXITEMS_PROT_POS_FALSE
-{
- Text [ en-US ] = "Position not protected" ;
-};
-String RID_SVXITEMS_TRANSPARENT_TRUE
-{
- Text [ en-US ] = "Transparent" ;
-};
-String RID_SVXITEMS_TRANSPARENT_FALSE
-{
- Text [ en-US ] = "Not Transparent" ;
-};
-String RID_SVXITEMS_HYPHEN_TRUE
-{
- Text [ en-US ] = "Hyphenation" ;
-};
-String RID_SVXITEMS_HYPHEN_FALSE
-{
- Text [ en-US ] = "No hyphenation" ;
-};
-String RID_SVXITEMS_PAGE_END_TRUE
-{
- Text [ en-US ] = "Page End" ;
-};
-String RID_SVXITEMS_PAGE_END_FALSE
-{
- Text [ en-US ] = "No Page End" ;
-};
-String RID_SVXITEMS_SIZE_WIDTH
-{
- Text [ en-US ] = "Width: " ;
-};
-String RID_SVXITEMS_SIZE_HEIGHT
-{
- Text [ en-US ] = "Height: " ;
-};
-String RID_SVXITEMS_LRSPACE_LEFT
-{
- Text [ en-US ] = "Indent left " ;
-};
-String RID_SVXITEMS_LRSPACE_FLINE
-{
- Text [ en-US ] = "First Line " ;
-};
-String RID_SVXITEMS_LRSPACE_RIGHT
-{
- Text [ en-US ] = "Indent right " ;
-};
-String RID_SVXITEMS_SHADOW_COMPLETE
-{
- Text [ en-US ] = "Shadow: " ;
-};
-String RID_SVXITEMS_BORDER_COMPLETE
-{
- Text [ en-US ] = "Borders " ;
-};
-String RID_SVXITEMS_BORDER_NONE
-{
- Text [ en-US ] = "No border";
-};
-String RID_SVXITEMS_BORDER_TOP
-{
- Text [ en-US ] = "top " ;
-};
-String RID_SVXITEMS_BORDER_BOTTOM
-{
- Text [ en-US ] = "bottom " ;
-};
-String RID_SVXITEMS_BORDER_LEFT
-{
- Text [ en-US ] = "left " ;
-};
-String RID_SVXITEMS_BORDER_RIGHT
-{
- Text [ en-US ] = "right " ;
-};
-String RID_SVXITEMS_BORDER_DISTANCE
-{
- Text [ en-US ] = "Spacing " ;
-};
-String RID_SVXITEMS_ULSPACE_UPPER
-{
- Text [ en-US ] = "From top " ;
-};
-String RID_SVXITEMS_ULSPACE_LOWER
-{
- Text [ en-US ] = "From bottom " ;
-};
-String RID_SVXITEMS_LINES
-{
- Text [ en-US ] = "%1 Lines" ;
- Text [ x-comment ] = "pb: %1 == will be replaced by the number of lines";
-};
-String RID_SVXITEMS_WIDOWS_COMPLETE
-{
- Text [ en-US ] = "Widow control" ;
-};
-String RID_SVXITEMS_ORPHANS_COMPLETE
-{
- Text [ en-US ] = "Orphan control" ;
-};
-String RID_SVXITEMS_HYPHEN_MINLEAD
-{
- Text [ en-US ] = "Characters at end of line" ;
-};
-String RID_SVXITEMS_HYPHEN_MINTRAIL
-{
- Text [ en-US ] = "Characters at beginning of line" ;
-};
-String RID_SVXITEMS_HYPHEN_MAX
-{
- Text [ en-US ] = "Hyphens" ;
-};
-String RID_SVXITEMS_PAGEMODEL_COMPLETE
-{
- Text [ en-US ] = "Page Style: " ;
-};
-String RID_SVXITEMS_KERNING_COMPLETE
-{
- Text [ en-US ] = "Kerning " ;
-};
-String RID_SVXITEMS_KERNING_EXPANDED
-{
- Text [ en-US ] = "locked " ;
-};
-String RID_SVXITEMS_KERNING_CONDENSED
-{
- Text [ en-US ] = "Condensed " ;
-};
-String RID_SVXITEMS_GRAPHIC
-{
- Text [ en-US ] = "Graphic" ;
-};
-String RID_SVXITEMS_EMPHASIS_NONE_STYLE
-{
- Text [ en-US ] = "none";
-};
-String RID_SVXITEMS_EMPHASIS_DOT_STYLE
-{
- Text [ en-US ] = "Dots ";
-};
-String RID_SVXITEMS_EMPHASIS_CIRCLE_STYLE
-{
- Text [ en-US ] = "Circle ";
-};
-String RID_SVXITEMS_EMPHASIS_DISC_STYLE
-{
-// ??? disc == filled ring
- Text [ en-US ] = "Filled circle ";
-};
-String RID_SVXITEMS_EMPHASIS_ACCENT_STYLE
-{
- Text [ en-US ] = "Accent ";
-};
-String RID_SVXITEMS_EMPHASIS_ABOVE_POS
-{
- Text [ en-US ] = "Above";
-};
-String RID_SVXITEMS_EMPHASIS_BELOW_POS
-{
- Text [ en-US ] = "Below";
-};
-String RID_SVXITEMS_TWOLINES_OFF
-{
- Text [ en-US ] = "Double-lined off";
-};
-String RID_SVXITEMS_TWOLINES
-{
- Text [ en-US ] = "Double-lined";
-};
-String RID_SVXITEMS_SCRPTSPC_OFF
-{
- Text [ en-US ] = "No automatic character spacing";
-};
-String RID_SVXITEMS_SCRPTSPC_ON
-{
- Text [ en-US ] = "No automatic character spacing";
-};
-String RID_SVXITEMS_HNGPNCT_OFF
-{
- Text [ en-US ] = "No hanging punctuation at line end";
-};
-String RID_SVXITEMS_HNGPNCT_ON
-{
- Text [ en-US ] = "Hanging punctuation at line end";
-};
-String RID_SVXITEMS_FORBIDDEN_RULE_OFF
-{
- Text [ en-US ] = "Apply list of forbidden characters to beginning and end of lines";
-};
-String RID_SVXITEMS_FORBIDDEN_RULE_ON
-{
- Text [ en-US ] = "Don't apply list of forbidden characters to beginning and end of lines";
-};
-String RID_SVXITEMS_CHARROTATE_OFF
-{
- Text [ en-US ] = "No rotated characters";
-};
-String RID_SVXITEMS_CHARROTATE
-{
- Text [ en-US ] = "Character rotated by $(ARG1)°";
-};
-String RID_SVXITEMS_CHARROTATE_FITLINE
-{
- Text [ en-US ] = "Fit to line";
-};
-String RID_SVXITEMS_CHARSCALE
-{
- Text [ en-US ] = "Characters scaled $(ARG1)%";
-};
-String RID_SVXITEMS_CHARSCALE_OFF
-{
- Text [ en-US ] = "No scaled characters";
-};
-String RID_SVXITEMS_RELIEF_NONE
-{
- Text [ en-US ] = "No relief";
-};
-String RID_SVXITEMS_RELIEF_EMBOSSED
-{
- Text [ en-US ] = "Relief";
-};
-String RID_SVXITEMS_RELIEF_ENGRAVED
-{
- Text [ en-US ] = "Engraved";
-};
-String RID_SVXITEMS_PARAVERTALIGN_AUTO
-{
- Text [ en-US ] = "Automatic text alignment";
-};
-String RID_SVXITEMS_PARAVERTALIGN_BASELINE
-{
- Text [ en-US ] = "Text aligned to base line";
-};
-String RID_SVXITEMS_PARAVERTALIGN_TOP
-{
- Text [ en-US ] = "Text aligned top";
-};
-String RID_SVXITEMS_PARAVERTALIGN_CENTER
-{
- Text [ en-US ] = "Text aligned middle";
-};
-String RID_SVXITEMS_PARAVERTALIGN_BOTTOM
-{
- Text [ en-US ] = "Text aligned bottom";
-};
-String RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP
-{
- Text [ en-US ] = "Text direction left-to-right (horizontal)";
-};
-String RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP
-{
- Text [ en-US ] = "Text direction right-to-left (horizontal)";
-};
-String RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT
-{
- Text [ en-US ] = "Text direction right-to-left (vertical)";
-};
-String RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT
-{
- Text [ en-US ] = "Text direction left-to-right (vertical)";
-};
-String RID_SVXITEMS_FRMDIR_ENVIRONMENT
-{
- Text [ en-US ] = "Use superordinate object text direction setting";
-};
-String RID_SVXITEMS_PARASNAPTOGRID_ON
-{
- Text[ en-US ] = "Paragraph snaps to text grid (if active)";
-};
-String RID_SVXITEMS_PARASNAPTOGRID_OFF
-{
- Text[ en-US ] = "Paragraph does not snap to text grid";
-};
-String RID_SVXITEMS_CHARHIDDEN_FALSE
-{
- Text [ en-US ] = "Not hidden";
-};
-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
deleted file mode 100644
index 2f0da8ebed..0000000000
--- a/editeng/source/items/textitem.cxx
+++ /dev/null
@@ -1,3754 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-// include ---------------------------------------------------------------
-#include <com/sun/star/style/CaseMap.hpp>
-#include <com/sun/star/awt/FontDescriptor.hpp>
-#include <com/sun/star/frame/status/FontHeight.hpp>
-#include <vcl/bitmapex.hxx>
-#include <tools/stream.hxx>
-#include <toolkit/unohlp.hxx>
-#include <math.h>
-#include <rtl/math.hxx>
-#include <unotools/fontdefs.hxx>
-#include <vcl/outdev.hxx>
-#include <editeng/eeitem.hxx>
-#include <svtools/unitconv.hxx>
-
-#define GLOBALOVERFLOW3
-
-#include <svl/memberid.hrc>
-#include <editeng/editids.hrc>
-#include <editeng/editrids.hrc>
-#include <vcl/vclenum.hxx>
-#include <tools/bigint.hxx>
-#include <tools/tenccvt.hxx>
-
-#include <rtl/ustring.hxx>
-#include <i18npool/mslangid.hxx>
-#include <svl/itemset.hxx>
-
-#include <svtools/langtab.hxx>
-#include <svl/itempool.hxx>
-#include <svtools/ctrltool.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/svapp.hxx>
-#include <com/sun/star/style/CaseMap.hpp>
-#include <com/sun/star/awt/SimpleFontMetric.hpp>
-#include <com/sun/star/awt/FontWeight.hpp>
-#include <com/sun/star/awt/FontSlant.hpp>
-#include <com/sun/star/awt/CharSet.hpp>
-#include <com/sun/star/awt/FontDescriptor.hpp>
-#include <com/sun/star/awt/FontWidth.hpp>
-#include <com/sun/star/awt/XFont.hpp>
-#include <com/sun/star/awt/FontType.hpp>
-#include <com/sun/star/awt/FontUnderline.hpp>
-#include <com/sun/star/awt/FontStrikeout.hpp>
-#include <com/sun/star/awt/FontFamily.hpp>
-#include <com/sun/star/awt/FontPitch.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/text/FontEmphasis.hpp>
-#include <com/sun/star/i18n/ScriptType.hpp>
-#include <editeng/memberids.hrc>
-#include <editeng/flstitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/fwdtitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/crsditem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/akrnitem.hxx>
-#include <editeng/wrlmitem.hxx>
-#include <editeng/cntritem.hxx>
-#include <editeng/prszitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/cscoitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/cmapitem.hxx>
-#include <editeng/escpitem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/nlbkitem.hxx>
-#include <editeng/nhypitem.hxx>
-#include <editeng/lcolitem.hxx>
-#include <editeng/blnkitem.hxx>
-#include <editeng/emphitem.hxx>
-#include <editeng/twolinesitem.hxx>
-#include <editeng/scripttypeitem.hxx>
-#include <editeng/charrotateitem.hxx>
-#include <editeng/charscaleitem.hxx>
-#include <editeng/charreliefitem.hxx>
-#include <editeng/itemtype.hxx>
-#include <editeng/eerdll.hxx>
-
-#include <tools/tenccvt.hxx>
-
-#define STORE_UNICODE_MAGIC_MARKER 0xFE331188
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::text;
-
-// Conversion for UNO
-#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
-#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
-#define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L))
-#define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L))
-
-sal_Bool SvxFontItem::bEnableStoreUnicodeNames = sal_False;
-
-// STATIC DATA -----------------------------------------------------------
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1(SvxFontListItem, SfxPoolItem);
-TYPEINIT1_FACTORY(SvxFontItem, SfxPoolItem, new SvxFontItem(0));
-TYPEINIT1_FACTORY(SvxPostureItem, SfxEnumItem, new SvxPostureItem(ITALIC_NONE, 0));
-TYPEINIT1_FACTORY(SvxWeightItem, SfxEnumItem, new SvxWeightItem(WEIGHT_NORMAL, 0));
-TYPEINIT1_FACTORY(SvxFontHeightItem, SfxPoolItem, new SvxFontHeightItem(240, 100, 0));
-TYPEINIT1_FACTORY(SvxFontWidthItem, SfxPoolItem, new SvxFontWidthItem(0, 100, 0));
-TYPEINIT1_FACTORY(SvxTextLineItem, SfxEnumItem, new SvxTextLineItem(UNDERLINE_NONE, 0));
-TYPEINIT1_FACTORY(SvxUnderlineItem, SfxEnumItem, new SvxUnderlineItem(UNDERLINE_NONE, 0));
-TYPEINIT1_FACTORY(SvxOverlineItem, SfxEnumItem, new SvxOverlineItem(UNDERLINE_NONE, 0));
-TYPEINIT1_FACTORY(SvxCrossedOutItem, SfxEnumItem, new SvxCrossedOutItem(STRIKEOUT_NONE, 0));
-TYPEINIT1_FACTORY(SvxShadowedItem, SfxBoolItem, new SvxShadowedItem(sal_False, 0));
-TYPEINIT1_FACTORY(SvxAutoKernItem, SfxBoolItem, new SvxAutoKernItem(sal_False, 0));
-TYPEINIT1_FACTORY(SvxWordLineModeItem, SfxBoolItem, new SvxWordLineModeItem(sal_False, 0));
-TYPEINIT1_FACTORY(SvxContourItem, SfxBoolItem, new SvxContourItem(sal_False, 0));
-TYPEINIT1_FACTORY(SvxPropSizeItem, SfxUInt16Item, new SvxPropSizeItem(100, 0));
-TYPEINIT1_FACTORY(SvxColorItem, SfxPoolItem, new SvxColorItem(0));
-TYPEINIT1_FACTORY(SvxCharSetColorItem, SvxColorItem, new SvxCharSetColorItem(0));
-TYPEINIT1_FACTORY(SvxKerningItem, SfxInt16Item, new SvxKerningItem(0, 0));
-TYPEINIT1_FACTORY(SvxCaseMapItem, SfxEnumItem, new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, 0));
-TYPEINIT1_FACTORY(SvxEscapementItem, SfxPoolItem, new SvxEscapementItem(0));
-TYPEINIT1_FACTORY(SvxLanguageItem, SfxEnumItem, new SvxLanguageItem(LANGUAGE_GERMAN, 0));
-TYPEINIT1_FACTORY(SvxNoLinebreakItem, SfxBoolItem, new SvxNoLinebreakItem(sal_True, 0));
-TYPEINIT1_FACTORY(SvxNoHyphenItem, SfxBoolItem, new SvxNoHyphenItem(sal_True, 0));
-TYPEINIT1_FACTORY(SvxLineColorItem, SvxColorItem, new SvxLineColorItem(0));
-TYPEINIT1_FACTORY(SvxBlinkItem, SfxBoolItem, new SvxBlinkItem(sal_False, 0));
-TYPEINIT1_FACTORY(SvxEmphasisMarkItem, SfxUInt16Item, new SvxEmphasisMarkItem(EMPHASISMARK_NONE, 0));
-TYPEINIT1_FACTORY(SvxTwoLinesItem, SfxPoolItem, new SvxTwoLinesItem(sal_True, 0, 0, 0));
-TYPEINIT1_FACTORY(SvxScriptTypeItem, SfxUInt16Item, new SvxScriptTypeItem);
-TYPEINIT1_FACTORY(SvxCharRotateItem, SfxUInt16Item, new SvxCharRotateItem(0, sal_False, 0));
-TYPEINIT1_FACTORY(SvxCharScaleWidthItem, SfxUInt16Item, new SvxCharScaleWidthItem(100, 0));
-TYPEINIT1_FACTORY(SvxCharReliefItem, SfxEnumItem, new SvxCharReliefItem(RELIEF_NONE, 0));
-
-
-TYPEINIT1(SvxScriptSetItem, SfxSetItem );
-
-
-// class SvxFontListItem -------------------------------------------------
-
-SvxFontListItem::SvxFontListItem( const FontList* pFontLst,
- const sal_uInt16 nId ) :
- SfxPoolItem( nId ),
- pFontList( pFontLst )
-{
- if ( pFontList )
- {
- sal_Int32 nCount = pFontList->GetFontNameCount();
- aFontNameSeq.realloc( nCount );
-
- for ( sal_uInt16 i = 0; i < nCount; i++ )
- aFontNameSeq[i] = pFontList->GetFontName(i).GetName();
- }
-}
-
-// -----------------------------------------------------------------------
-
-SvxFontListItem::SvxFontListItem( const SvxFontListItem& rItem ) :
-
- SfxPoolItem( rItem ),
- pFontList( rItem.GetFontList() ),
- aFontNameSeq( rItem.aFontNameSeq )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFontListItem::Clone( SfxItemPool* ) const
-{
- return new SvxFontListItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-int SvxFontListItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return( pFontList == ((SvxFontListItem&)rAttr).pFontList );
-}
-
-bool SvxFontListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
-{
- rVal <<= aFontNameSeq;
- return true;
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxFontListItem::GetPresentation
-(
- SfxItemPresentation /*ePres*/,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxFontItem -----------------------------------------------------
-
-SvxFontItem::SvxFontItem( const sal_uInt16 nId ) :
- SfxPoolItem( nId )
-{
- eFamily = FAMILY_SWISS;
- ePitch = PITCH_VARIABLE;
- eTextEncoding = RTL_TEXTENCODING_DONTKNOW;
-}
-
-// -----------------------------------------------------------------------
-
-SvxFontItem::SvxFontItem( const FontFamily eFam, const XubString& aName,
- const XubString& aStName, const FontPitch eFontPitch,
- const rtl_TextEncoding eFontTextEncoding, const sal_uInt16 nId ) :
-
- SfxPoolItem( nId ),
-
- aFamilyName(aName),
- aStyleName(aStName)
-{
- eFamily = eFam;
- ePitch = eFontPitch;
- eTextEncoding = eFontTextEncoding;
-}
-
-// -----------------------------------------------------------------------
-SvxFontItem& SvxFontItem::operator=(const SvxFontItem& rFont)
-{
- aFamilyName = rFont.GetFamilyName();
- aStyleName = rFont.GetStyleName();
- eFamily = rFont.GetFamily();
- ePitch = rFont.GetPitch();
- eTextEncoding = rFont.GetCharSet();
- return *this;
-}
-// -----------------------------------------------------------------------
-
-bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case 0:
- {
- com::sun::star::awt::FontDescriptor aFontDescriptor;
- aFontDescriptor.Name = aFamilyName.GetBuffer();
- aFontDescriptor.StyleName = aStyleName.GetBuffer();
- aFontDescriptor.Family = (sal_Int16)(eFamily);
- aFontDescriptor.CharSet = (sal_Int16)(eTextEncoding);
- aFontDescriptor.Pitch = (sal_Int16)(ePitch);
- rVal <<= aFontDescriptor;
- }
- break;
- case MID_FONT_FAMILY_NAME :
- rVal <<= OUString(aFamilyName.GetBuffer());
- break;
- case MID_FONT_STYLE_NAME:
- rVal <<= OUString(aStyleName.GetBuffer());
- break;
- case MID_FONT_FAMILY : rVal <<= (sal_Int16)(eFamily); break;
- case MID_FONT_CHAR_SET : rVal <<= (sal_Int16)(eTextEncoding); break;
- case MID_FONT_PITCH : rVal <<= (sal_Int16)(ePitch); break;
- }
- return true;
-}
-// -----------------------------------------------------------------------
-bool SvxFontItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId)
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case 0:
- {
- com::sun::star::awt::FontDescriptor aFontDescriptor;
- if ( !( rVal >>= aFontDescriptor ))
- return sal_False;
-
- aFamilyName = aFontDescriptor.Name;
- aStyleName = aFontDescriptor.StyleName;
- eFamily = (FontFamily)aFontDescriptor.Family;
- eTextEncoding = (rtl_TextEncoding)aFontDescriptor.CharSet;
- ePitch = (FontPitch)aFontDescriptor.Pitch;
- }
- break;
- case MID_FONT_FAMILY_NAME :
- {
- OUString aStr;
- if(!(rVal >>= aStr))
- return sal_False;
- aFamilyName = aStr.getStr();
- }
- break;
- case MID_FONT_STYLE_NAME:
- {
- OUString aStr;
- if(!(rVal >>= aStr))
- return sal_False;
- aStyleName = aStr.getStr();
- }
- break;
- case MID_FONT_FAMILY :
- {
- sal_Int16 nFamily = sal_Int16();
- if(!(rVal >>= nFamily))
- return sal_False;
- eFamily = (FontFamily)nFamily;
- }
- break;
- case MID_FONT_CHAR_SET :
- {
- sal_Int16 nSet = sal_Int16();
- if(!(rVal >>= nSet))
- return sal_False;
- eTextEncoding = (rtl_TextEncoding)nSet;
- }
- break;
- case MID_FONT_PITCH :
- {
- sal_Int16 nPitch = sal_Int16();
- if(!(rVal >>= nPitch))
- return sal_False;
- ePitch = (FontPitch)nPitch;
- }
- break;
- }
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxFontItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- const SvxFontItem& rItem = (const SvxFontItem&)rAttr;
-
- int bRet = ( eFamily == rItem.eFamily &&
- aFamilyName == rItem.aFamilyName &&
- aStyleName == rItem.aStyleName );
-
- if ( bRet )
- {
- if ( ePitch != rItem.ePitch || eTextEncoding != rItem.eTextEncoding )
- {
- bRet = sal_False;
- DBG_WARNING( "FontItem::operator==(): only pitch or rtl_TextEncoding different ");
- }
- }
- return bRet;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFontItem::Clone( SfxItemPool * ) const
-{
- return new SvxFontItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- sal_Bool bToBats =
- GetFamilyName().EqualsAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) ||
- GetFamilyName().EqualsAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 );
-
- rStrm << (sal_uInt8) GetFamily() << (sal_uInt8) GetPitch()
- << (sal_uInt8)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion()));
-
- String aStoreFamilyName( GetFamilyName() );
- if( bToBats )
- aStoreFamilyName = String( "StarBats", sizeof("StarBats")-1, RTL_TEXTENCODING_ASCII_US );
- rStrm.WriteByteString(aStoreFamilyName);
- rStrm.WriteByteString(GetStyleName());
-
- // cach for EditEngine, only set while creating clipboard stream.
- if ( bEnableStoreUnicodeNames )
- {
- sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER;
- rStrm << nMagic;
- rStrm.WriteByteString( aStoreFamilyName, RTL_TEXTENCODING_UNICODE );
- rStrm.WriteByteString( GetStyleName(), RTL_TEXTENCODING_UNICODE );
- }
-
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 _eFamily, eFontPitch, eFontTextEncoding;
- String aName, aStyle;
- rStrm >> _eFamily;
- rStrm >> eFontPitch;
- rStrm >> eFontTextEncoding;
-
- // UNICODE: rStrm >> aName;
- rStrm.ReadByteString(aName);
-
- // UNICODE: rStrm >> aStyle;
- rStrm.ReadByteString(aStyle);
-
- // Set the "correct" textencoding
- eFontTextEncoding = (sal_uInt8)GetSOLoadTextEncoding( eFontTextEncoding, (sal_uInt16)rStrm.GetVersion() );
-
- // at some point, the StarBats changes from ANSI font to SYMBOL font
- if ( RTL_TEXTENCODING_SYMBOL != eFontTextEncoding && aName.EqualsAscii("StarBats") )
- eFontTextEncoding = RTL_TEXTENCODING_SYMBOL;
-
- // Check if we have stored unicode
- sal_Size nStreamPos = rStrm.Tell();
- sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER;
- rStrm >> nMagic;
- if ( nMagic == STORE_UNICODE_MAGIC_MARKER )
- {
- rStrm.ReadByteString( aName, RTL_TEXTENCODING_UNICODE );
- rStrm.ReadByteString( aStyle, RTL_TEXTENCODING_UNICODE );
- }
- else
- {
- rStrm.Seek( nStreamPos );
- }
-
-
-
- return new SvxFontItem( (FontFamily)_eFamily, aName, aStyle,
- (FontPitch)eFontPitch, (rtl_TextEncoding)eFontTextEncoding, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxFontItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = aFamilyName;
- return ePres;
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-//------------------------------------------------------------------------
-
-void SvxFontItem::EnableStoreUnicodeNames( sal_Bool bEnable )
-{
- bEnableStoreUnicodeNames = bEnable;
-}
-
-// class SvxPostureItem --------------------------------------------------
-
-SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const sal_uInt16 nId ) :
- SfxEnumItem( nId, (sal_uInt16)ePosture )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxPostureItem::Clone( SfxItemPool * ) const
-{
- return new SvxPostureItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxPostureItem::GetValueCount() const
-{
- return ITALIC_NORMAL + 1; // ITALIC_NONE also belongs here
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxPostureItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt8)GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxPostureItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nPosture;
- rStrm >> nPosture;
- return new SvxPostureItem( (const FontItalic)nPosture, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxPostureItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = GetValueTextByPos( GetValue() );
- return ePres;
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxPostureItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- DBG_ASSERT( nPos <= (sal_uInt16)ITALIC_NORMAL, "enum overflow!" );
-
- XubString sTxt;
- FontItalic eItalic = (FontItalic)nPos;
- sal_uInt16 nId = 0;
-
- switch ( eItalic )
- {
- case ITALIC_NONE: nId = RID_SVXITEMS_ITALIC_NONE; break;
- case ITALIC_OBLIQUE: nId = RID_SVXITEMS_ITALIC_OBLIQUE; break;
- case ITALIC_NORMAL: nId = RID_SVXITEMS_ITALIC_NORMAL; break;
- default: ;//prevent warning
- }
-
- if ( nId )
- sTxt = EditResId( nId );
- return sTxt;
-}
-
-bool SvxPostureItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId )
- {
- case MID_ITALIC:
- rVal = Bool2Any(GetBoolValue());
- break;
- case MID_POSTURE:
- rVal <<= (awt::FontSlant)GetValue(); // values from awt::FontSlant and FontItalic are equal
- break;
- }
- return true;
-}
-
-bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId )
- {
- case MID_ITALIC:
- SetBoolValue(Any2Bool(rVal));
- break;
- case MID_POSTURE:
- {
- awt::FontSlant eSlant;
- if(!(rVal >>= eSlant))
- {
- sal_Int32 nValue = 0;
- if(!(rVal >>= nValue))
- return sal_False;
-
- eSlant = (awt::FontSlant)nValue;
- }
- SetValue((sal_uInt16)eSlant);
- }
- }
- return true;
-}
-// -----------------------------------------------------------------------
-
-int SvxPostureItem::HasBoolValue() const
-{
- return sal_True;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvxPostureItem::GetBoolValue() const
-{
- return ( (FontItalic)GetValue() >= ITALIC_OBLIQUE );
-}
-
-// -----------------------------------------------------------------------
-
-void SvxPostureItem::SetBoolValue( sal_Bool bVal )
-{
- SetValue( (sal_uInt16)(bVal ? ITALIC_NORMAL : ITALIC_NONE) );
-}
-
-// class SvxWeightItem ---------------------------------------------------
-
-SvxWeightItem::SvxWeightItem( const FontWeight eWght, const sal_uInt16 nId ) :
- SfxEnumItem( nId, (sal_uInt16)eWght )
-{
-}
-
-
-
-// -----------------------------------------------------------------------
-
-int SvxWeightItem::HasBoolValue() const
-{
- return sal_True;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvxWeightItem::GetBoolValue() const
-{
- return (FontWeight)GetValue() >= WEIGHT_BOLD;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxWeightItem::SetBoolValue( sal_Bool bVal )
-{
- SetValue( (sal_uInt16)(bVal ? WEIGHT_BOLD : WEIGHT_NORMAL) );
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxWeightItem::GetValueCount() const
-{
- return WEIGHT_BLACK; // WEIGHT_DONTKNOW does not belong
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxWeightItem::Clone( SfxItemPool * ) const
-{
- return new SvxWeightItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxWeightItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt8)GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxWeightItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nWeight;
- rStrm >> nWeight;
- return new SvxWeightItem( (FontWeight)nWeight, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxWeightItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = GetValueTextByPos( GetValue() );
- return ePres;
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxWeightItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- DBG_ASSERT( nPos <= (sal_uInt16)WEIGHT_BLACK, "enum overflow!" );
- return EE_RESSTR( RID_SVXITEMS_WEIGHT_BEGIN + nPos );
-}
-
-bool SvxWeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId )
- {
- case MID_BOLD :
- rVal = Bool2Any(GetBoolValue());
- break;
- case MID_WEIGHT:
- {
- rVal <<= (float)( VCLUnoHelper::ConvertFontWeight( (FontWeight)GetValue() ) );
- }
- break;
- }
- return true;
-}
-
-bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId )
- {
- case MID_BOLD :
- SetBoolValue(Any2Bool(rVal));
- break;
- case MID_WEIGHT:
- {
- double fValue = 0;
- if(!(rVal >>= fValue))
- {
- sal_Int32 nValue = 0;
- if(!(rVal >>= nValue))
- return sal_False;
- fValue = (float)nValue;
- }
- SetValue( (sal_uInt16)VCLUnoHelper::ConvertFontWeight((float)fValue) );
- }
- break;
- }
- return true;
-}
-
-// class SvxFontHeightItem -----------------------------------------------
-
-SvxFontHeightItem::SvxFontHeightItem( const sal_uLong nSz,
- const sal_uInt16 nPrp,
- const sal_uInt16 nId ) :
- SfxPoolItem( nId )
-{
- SetHeight( nSz,nPrp ); // calculate in percentage
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFontHeightItem::Clone( SfxItemPool * ) const
-{
- return new SvxFontHeightItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
-{
- rStrm << (sal_uInt16)GetHeight();
-
- if( FONTHEIGHT_UNIT_VERSION <= nItemVersion )
- rStrm << GetProp() << (sal_uInt16)GetPropUnit();
- else
- {
- // When exporting to the old versions the relative information is lost
- // when there is no percentage
- sal_uInt16 _nProp = GetProp();
- if( SFX_MAPUNIT_RELATIVE != GetPropUnit() )
- _nProp = 100;
- rStrm << _nProp;
- }
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm,
- sal_uInt16 nVersion ) const
-{
- sal_uInt16 nsize, nprop = 0, nPropUnit = SFX_MAPUNIT_RELATIVE;
-
- rStrm >> nsize;
-
- if( FONTHEIGHT_16_VERSION <= nVersion )
- rStrm >> nprop;
- else
- {
- sal_uInt8 nP;
- rStrm >> nP;
- nprop = (sal_uInt16)nP;
- }
-
- if( FONTHEIGHT_UNIT_VERSION <= nVersion )
- rStrm >> nPropUnit;
-
- SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() );
- pItem->SetProp( nprop, (SfxMapUnit)nPropUnit );
- return pItem;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxFontHeightItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return GetHeight() == ((SvxFontHeightItem&)rItem).GetHeight() &&
- GetProp() == ((SvxFontHeightItem&)rItem).GetProp() &&
- GetPropUnit() == ((SvxFontHeightItem&)rItem).GetPropUnit();
-}
-
-bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- // 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;
- switch( nMemberId )
- {
- case 0:
- {
- ::com::sun::star::frame::status::FontHeight aFontHeight;
-
- // 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);
- aFontHeight.Height = (float)( nTwips / 20.0 );
- }
- else
- {
- double fPoints = MM100_TO_TWIP_UNSIGNED(nHeight) / 20.0;
- float fRoundPoints =
- static_cast<float>(::rtl::math::round(fPoints, 1));
- aFontHeight.Height = fRoundPoints;
- }
-
- aFontHeight.Prop = (sal_Int16)(SFX_MAPUNIT_RELATIVE == ePropUnit ? nProp : 100);
-
- float fRet = (float)(short)nProp;
- switch( ePropUnit )
- {
- case SFX_MAPUNIT_RELATIVE:
- fRet = 0.;
- break;
- case SFX_MAPUNIT_100TH_MM:
- fRet = MM100_TO_TWIP(fRet);
- fRet /= 20.;
- break;
- case SFX_MAPUNIT_POINT:
-
- break;
- case SFX_MAPUNIT_TWIP:
- fRet /= 20.;
- break;
- default: ;//prevent warning
- }
- aFontHeight.Diff = fRet;
- rVal <<= aFontHeight;
- }
- break;
- case MID_FONTHEIGHT:
- {
- // 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);
- rVal <<= (float)( nTwips / 20.0 );
- }
- else
- {
- double fPoints = MM100_TO_TWIP_UNSIGNED(nHeight) / 20.0;
- float fRoundPoints =
- static_cast<float>(::rtl::math::round(fPoints, 1));
- rVal <<= fRoundPoints;
- }
- }
- break;
- case MID_FONTHEIGHT_PROP:
- rVal <<= (sal_Int16)(SFX_MAPUNIT_RELATIVE == ePropUnit ? nProp : 100);
- break;
- case MID_FONTHEIGHT_DIFF:
- {
- float fRet = (float)(short)nProp;
- switch( ePropUnit )
- {
- case SFX_MAPUNIT_RELATIVE:
- fRet = 0.;
- break;
- case SFX_MAPUNIT_100TH_MM:
- fRet = MM100_TO_TWIP(fRet);
- fRet /= 20.;
- break;
- case SFX_MAPUNIT_POINT:
-
- break;
- case SFX_MAPUNIT_TWIP:
- fRet /= 20.;
- break;
- default: ;//prevent warning
- }
- rVal <<= fRet;
- }
- break;
- }
- return sal_True;
-}
-
-// 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;
- short nDiff = 0;
- switch( eProp )
- {
- case SFX_MAPUNIT_RELATIVE:
- nRet *= 100;
- nRet /= nProp;
- break;
- case SFX_MAPUNIT_POINT:
- {
- short nTemp = (short)nProp;
- nDiff = nTemp * 20;
- if(!bCoreInTwip)
- nDiff = (short)TWIP_TO_MM100((long)(nDiff));
- }
- break;
- case SFX_MAPUNIT_100TH_MM:
- //then the core is surely also in 1/100 mm
- nDiff = (short)nProp;
- break;
- case SFX_MAPUNIT_TWIP:
- // Here surely TWIP
- nDiff = ((short)nProp);
- break;
- default: ;//prevent warning
- }
- nRet -= nDiff;
-
- return nRet;
-}
-
-bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId )
- {
- case 0:
- {
- ::com::sun::star::frame::status::FontHeight aFontHeight;
- if ( rVal >>= aFontHeight )
- {
- // Height
- ePropUnit = SFX_MAPUNIT_RELATIVE;
- nProp = 100;
- double fPoint = aFontHeight.Height;
- if( fPoint < 0. || fPoint > 10000. )
- return sal_False;
-
- nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips
- if (!bConvert)
- nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // Convert, if the item contains 1/100mm
-
- nProp = aFontHeight.Prop;
- }
- else
- return sal_False;
- }
- break;
- case MID_FONTHEIGHT:
- {
- ePropUnit = SFX_MAPUNIT_RELATIVE;
- nProp = 100;
- double fPoint = 0;
- if(!(rVal >>= fPoint))
- {
- sal_Int32 nValue = 0;
- if(!(rVal >>= nValue))
- return sal_False;
- fPoint = (float)nValue;
- }
- if(fPoint < 0. || fPoint > 10000.)
- return sal_False;
-
- nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips
- if (!bConvert)
- nHeight = TWIP_TO_MM100_UNSIGNED(nHeight); // Convert, if the item contains 1/100mm
- }
- break;
- case MID_FONTHEIGHT_PROP:
- {
- sal_Int16 nNew = sal_Int16();
- if(!(rVal >>= nNew))
- return sal_True;
-
- nHeight = lcl_GetRealHeight_Impl(nHeight, nProp, ePropUnit, bConvert);
-
- nHeight *= nNew;
- nHeight /= 100;
- nProp = nNew;
- ePropUnit = SFX_MAPUNIT_RELATIVE;
- }
- break;
- case MID_FONTHEIGHT_DIFF:
- {
- nHeight = lcl_GetRealHeight_Impl(nHeight, nProp, ePropUnit, bConvert);
- float fValue = 0;
- if(!(rVal >>= fValue))
- {
- sal_Int32 nValue = 0;
- if(!(rVal >>= nValue))
- return sal_False;
- fValue = (float)nValue;
- }
- sal_Int16 nCoreDiffValue = (sal_Int16)(fValue * 20.);
- nHeight += bConvert ? nCoreDiffValue : TWIP_TO_MM100(nCoreDiffValue);
- nProp = (sal_uInt16)((sal_Int16)fValue);
- ePropUnit = SFX_MAPUNIT_POINT;
- }
- break;
- }
- return sal_True;
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxFontHeightItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreUnit,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *pIntl
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- if( SFX_MAPUNIT_RELATIVE != ePropUnit )
- {
- ( rText = String::CreateFromInt32( (short)nProp ) ) +=
- EE_RESSTR( GetMetricId( ePropUnit ) );
- if( 0 <= (short)nProp )
- rText.Insert( sal_Unicode('+'), 0 );
- }
- else if( 100 == nProp )
- {
- rText = GetMetricText( (long)nHeight,
- eCoreUnit, SFX_MAPUNIT_POINT, pIntl );
- rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
- }
- else
- ( rText = String::CreateFromInt32( nProp )) += sal_Unicode('%');
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxFontHeightItem::GetVersion(sal_uInt16 nFileVersion) const
-{
- return (nFileVersion <= SOFFICE_FILEFORMAT_40)
- ? FONTHEIGHT_16_VERSION
- : FONTHEIGHT_UNIT_VERSION;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxFontHeightItem::ScaleMetrics( long nMult, long nDiv )
-{
- nHeight = (sal_uInt32)Scale( nHeight, nMult, nDiv );
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxFontHeightItem::HasMetrics() const
-{
- return true;
-}
-
-void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp,
- SfxMapUnit eUnit )
-{
- DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
-
- if( SFX_MAPUNIT_RELATIVE != eUnit )
- nHeight = nNewHeight + ::ItemToControl( (short)nNewProp, eUnit,
- SFX_FUNIT_TWIP );
- else
- if( 100 != nNewProp )
- nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 );
- else
- nHeight = nNewHeight;
-
- nProp = nNewProp;
- ePropUnit = eUnit;
-}
-
-void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
- SfxMapUnit eMetric, SfxMapUnit eCoreMetric )
-{
- DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
-
- if( SFX_MAPUNIT_RELATIVE != eMetric )
- nHeight = nNewHeight +
- ::ControlToItem( ::ItemToControl((short)nNewProp, eMetric,
- SFX_FUNIT_TWIP ), SFX_FUNIT_TWIP,
- eCoreMetric );
- else
- if( 100 != nNewProp )
- nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 );
- else
- nHeight = nNewHeight;
-
- nProp = nNewProp;
- ePropUnit = eMetric;
-}
-
-// class SvxFontWidthItem -----------------------------------------------
-
-SvxFontWidthItem::SvxFontWidthItem( const sal_uInt16 nSz, const sal_uInt16 nPrp, const sal_uInt16 nId ) :
- SfxPoolItem( nId )
-{
- nWidth = nSz;
- nProp = nPrp;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFontWidthItem::Clone( SfxItemPool * ) const
-{
- return new SvxFontWidthItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxFontWidthItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << GetWidth() << GetProp();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxFontWidthItem::ScaleMetrics( long nMult, long nDiv )
-{
- nWidth = (sal_uInt16)Scale( nWidth, nMult, nDiv );
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxFontWidthItem::HasMetrics() const
-{
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxFontWidthItem::Create( SvStream& rStrm,
- sal_uInt16 /*nVersion*/ ) const
-{
- sal_uInt16 nS;
- sal_uInt16 nP;
-
- rStrm >> nS;
- rStrm >> nP;
- SvxFontWidthItem* pItem = new SvxFontWidthItem( 0, nP, Which() );
- pItem->SetWidthValue( nS );
- return pItem;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxFontWidthItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return GetWidth() == ((SvxFontWidthItem&)rItem).GetWidth() &&
- GetProp() == ((SvxFontWidthItem&)rItem).GetProp();
-}
-
-bool SvxFontWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
-// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case MID_FONTWIDTH:
- rVal <<= (sal_Int16)(nWidth);
- break;
- case MID_FONTWIDTH_PROP:
- rVal <<= (sal_Int16)(nProp);
- break;
- }
- return true;
-}
-
-bool SvxFontWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
-// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
- sal_Int16 nVal = sal_Int16();
- if(!(rVal >>= nVal))
- return sal_False;
-
- switch(nMemberId)
- {
- case MID_FONTWIDTH:
- nProp = nVal;
- break;
- case MID_FONTWIDTH_PROP:
- nWidth = nVal;
- break;
- }
- return true;
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxFontWidthItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreUnit,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *pIntl
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- if ( 100 == nProp )
- {
- rText = GetMetricText( (long)nWidth,
- eCoreUnit, SFX_MAPUNIT_POINT, pIntl );
- rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
- }
- else
- ( rText = String::CreateFromInt32( nProp )) += sal_Unicode('%');
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxTextLineItem ------------------------------------------------
-
-SvxTextLineItem::SvxTextLineItem( const FontUnderline eSt, const sal_uInt16 nId )
- : SfxEnumItem( nId, (sal_uInt16)eSt ), mColor( COL_TRANSPARENT )
-{
-}
-
-// -----------------------------------------------------------------------
-
-int SvxTextLineItem::HasBoolValue() const
-{
- return sal_True;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvxTextLineItem::GetBoolValue() const
-{
- return (FontUnderline)GetValue() != UNDERLINE_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxTextLineItem::SetBoolValue( sal_Bool bVal )
-{
- SetValue( (sal_uInt16)(bVal ? UNDERLINE_SINGLE : UNDERLINE_NONE) );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxTextLineItem::Clone( SfxItemPool * ) const
-{
- SvxTextLineItem* pNew = new SvxTextLineItem( *this );
- pNew->SetColor( GetColor() );
- return pNew;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxTextLineItem::GetValueCount() const
-{
- return UNDERLINE_DOTTED + 1; // UNDERLINE_NONE also belongs here
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxTextLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt8)GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxTextLineItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nState;
- rStrm >> nState;
- return new SvxTextLineItem( (FontUnderline)nState, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxTextLineItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = GetValueTextByPos( GetValue() );
- if( !mColor.GetTransparency() )
- ( rText += cpDelim ) += ::GetColorString( mColor );
- return ePres;
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxTextLineItem::GetValueTextByPos( sal_uInt16 /*nPos*/ ) const
-{
- OSL_FAIL("SvxTextLineItem::GetValueTextByPos: Pure virtual method");
- return XubString();
-}
-
-bool SvxTextLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case MID_TEXTLINED:
- rVal = Bool2Any(GetBoolValue());
- break;
- case MID_TL_STYLE:
- rVal <<= (sal_Int16)(GetValue());
- break;
- case MID_TL_COLOR:
- rVal <<= (sal_Int32)( mColor.GetColor() );
- break;
- case MID_TL_HASCOLOR:
- rVal = Bool2Any( !mColor.GetTransparency() );
- break;
- }
- return true;
-
-}
-
-bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- sal_Bool bRet = sal_True;
- switch(nMemberId)
- {
- case MID_TEXTLINED:
- SetBoolValue(Any2Bool(rVal));
- break;
- case MID_TL_STYLE:
- {
- sal_Int32 nValue = 0;
- if(!(rVal >>= nValue))
- bRet = sal_False;
- else
- SetValue((sal_Int16)nValue);
- }
- break;
- case MID_TL_COLOR:
- {
- sal_Int32 nCol = 0;
- if( !( rVal >>= nCol ) )
- bRet = sal_False;
- else
- {
- // Keep transparence, because it contains the information
- // whether the font color or the stored color should be used
- sal_uInt8 nTrans = mColor.GetTransparency();
- mColor = Color( nCol );
- mColor.SetTransparency( nTrans );
- }
- }
- break;
- case MID_TL_HASCOLOR:
- mColor.SetTransparency( Any2Bool( rVal ) ? 0 : 0xff );
- break;
- }
- return bRet;
-}
-
-int SvxTextLineItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return SfxEnumItem::operator==( rItem ) &&
- GetColor() == ((SvxTextLineItem&)rItem).GetColor();
-}
-
-// class SvxUnderlineItem ------------------------------------------------
-
-SvxUnderlineItem::SvxUnderlineItem( const FontUnderline eSt, const sal_uInt16 nId )
- : SvxTextLineItem( eSt, nId )
-{
-}
-
-//------------------------------------------------------------------------
-
-SfxPoolItem* SvxUnderlineItem::Clone( SfxItemPool * ) const
-{
- SvxUnderlineItem* pNew = new SvxUnderlineItem( *this );
- pNew->SetColor( GetColor() );
- return pNew;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxUnderlineItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nState;
- rStrm >> nState;
- return new SvxUnderlineItem( (FontUnderline)nState, Which() );
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" );
- return EE_RESSTR( RID_SVXITEMS_UL_BEGIN + nPos );
-}
-
-// class SvxOverlineItem ------------------------------------------------
-
-SvxOverlineItem::SvxOverlineItem( const FontUnderline eSt, const sal_uInt16 nId )
- : SvxTextLineItem( eSt, nId )
-{
-}
-
-//------------------------------------------------------------------------
-
-SfxPoolItem* SvxOverlineItem::Clone( SfxItemPool * ) const
-{
- SvxOverlineItem* pNew = new SvxOverlineItem( *this );
- pNew->SetColor( GetColor() );
- return pNew;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxOverlineItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nState;
- rStrm >> nState;
- return new SvxOverlineItem( (FontUnderline)nState, Which() );
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" );
- return EE_RESSTR( RID_SVXITEMS_OL_BEGIN + nPos );
-}
-
-// class SvxCrossedOutItem -----------------------------------------------
-
-SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const sal_uInt16 nId )
- : SfxEnumItem( nId, (sal_uInt16)eSt )
-{
-}
-
-// -----------------------------------------------------------------------
-
-int SvxCrossedOutItem::HasBoolValue() const
-{
- return sal_True;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvxCrossedOutItem::GetBoolValue() const
-{
- return (FontStrikeout)GetValue() != STRIKEOUT_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxCrossedOutItem::SetBoolValue( sal_Bool bVal )
-{
- SetValue( (sal_uInt16)(bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE) );
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxCrossedOutItem::GetValueCount() const
-{
- return STRIKEOUT_DOUBLE + 1; // STRIKEOUT_NONE belongs also here
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxCrossedOutItem::Clone( SfxItemPool * ) const
-{
- return new SvxCrossedOutItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxCrossedOutItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt8)GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxCrossedOutItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 eCross;
- rStrm >> eCross;
- return new SvxCrossedOutItem( (FontStrikeout)eCross, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxCrossedOutItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = GetValueTextByPos( GetValue() );
- return ePres;
- default: ;//prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxCrossedOutItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- DBG_ASSERT( nPos <= (sal_uInt16)STRIKEOUT_X, "enum overflow!" );
- return EE_RESSTR( RID_SVXITEMS_STRIKEOUT_BEGIN + nPos );
-}
-
-bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case MID_CROSSED_OUT:
- rVal = Bool2Any(GetBoolValue());
- break;
- case MID_CROSS_OUT:
- rVal <<= (sal_Int16)(GetValue());
- break;
- }
- return true;
-}
-
-bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case MID_CROSSED_OUT:
- SetBoolValue(Any2Bool(rVal));
- break;
- case MID_CROSS_OUT:
- {
- sal_Int32 nValue = 0;
- if(!(rVal >>= nValue))
- return sal_False;
- SetValue((sal_Int16)nValue);
- }
- break;
- }
- return sal_True;
-}
-// class SvxShadowedItem -------------------------------------------------
-
-SvxShadowedItem::SvxShadowedItem( const sal_Bool bShadowed, const sal_uInt16 nId ) :
- SfxBoolItem( nId, bShadowed )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxShadowedItem::Clone( SfxItemPool * ) const
-{
- return new SvxShadowedItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxShadowedItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt8) GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxShadowedItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nState;
- rStrm >> nState;
- return new SvxShadowedItem( nState, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxShadowedItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nId = RID_SVXITEMS_SHADOWED_FALSE;
-
- if ( GetValue() )
- nId = RID_SVXITEMS_SHADOWED_TRUE;
- rText = EE_RESSTR(nId);
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxAutoKernItem -------------------------------------------------
-
-SvxAutoKernItem::SvxAutoKernItem( const sal_Bool bAutoKern, const sal_uInt16 nId ) :
- SfxBoolItem( nId, bAutoKern )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxAutoKernItem::Clone( SfxItemPool * ) const
-{
- return new SvxAutoKernItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxAutoKernItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt8) GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxAutoKernItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nState;
- rStrm >> nState;
- return new SvxAutoKernItem( nState, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxAutoKernItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nId = RID_SVXITEMS_AUTOKERN_FALSE;
-
- if ( GetValue() )
- nId = RID_SVXITEMS_AUTOKERN_TRUE;
- rText = EE_RESSTR(nId);
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxWordLineModeItem ---------------------------------------------
-
-SvxWordLineModeItem::SvxWordLineModeItem( const sal_Bool bWordLineMode,
- const sal_uInt16 nId ) :
- SfxBoolItem( nId, bWordLineMode )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxWordLineModeItem::Clone( SfxItemPool * ) const
-{
- return new SvxWordLineModeItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxWordLineModeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Bool) GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxWordLineModeItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_Bool bValue;
- rStrm >> bValue;
- return new SvxWordLineModeItem( bValue, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxWordLineModeItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nId = RID_SVXITEMS_WORDLINE_FALSE;
-
- if ( GetValue() )
- nId = RID_SVXITEMS_WORDLINE_TRUE;
- rText = EE_RESSTR(nId);
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxContourItem --------------------------------------------------
-
-SvxContourItem::SvxContourItem( const sal_Bool bContoured, const sal_uInt16 nId ) :
- SfxBoolItem( nId, bContoured )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxContourItem::Clone( SfxItemPool * ) const
-{
- return new SvxContourItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxContourItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Bool) GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxContourItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_Bool bValue;
- rStrm >> bValue;
- return new SvxContourItem( bValue, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxContourItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nId = RID_SVXITEMS_CONTOUR_FALSE;
-
- if ( GetValue() )
- nId = RID_SVXITEMS_CONTOUR_TRUE;
- rText = EE_RESSTR(nId);
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxPropSizeItem -------------------------------------------------
-
-SvxPropSizeItem::SvxPropSizeItem( const sal_uInt16 nPercent, const sal_uInt16 nId ) :
- SfxUInt16Item( nId, nPercent )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxPropSizeItem::Clone( SfxItemPool * ) const
-{
- return new SvxPropSizeItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxPropSizeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt16) GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxPropSizeItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt16 nSize;
- rStrm >> nSize;
- return new SvxPropSizeItem( nSize, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxPropSizeItem::GetPresentation
-(
- SfxItemPresentation /*ePres*/,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxColorItem ----------------------------------------------------
-
-SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
- SfxPoolItem( nId ),
- mColor( COL_BLACK )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) :
- SfxPoolItem( nId ),
- mColor( rCol )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxColorItem::SvxColorItem( SvStream &rStrm, const sal_uInt16 nId ) :
- SfxPoolItem( nId )
-{
- Color aColor;
- rStrm >> aColor;
- mColor = aColor;
-}
-
-// -----------------------------------------------------------------------
-
-SvxColorItem::SvxColorItem( const SvxColorItem &rCopy ) :
- SfxPoolItem( rCopy ),
- mColor( rCopy.mColor )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxColorItem::~SvxColorItem()
-{
-}
-
-// -----------------------------------------------------------------------
-sal_uInt16 SvxColorItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxColorItem: Is there a new file format? ");
- return SOFFICE_FILEFORMAT_50 >= nFFVer ? VERSION_USEAUTOCOLOR : 0;
-}
-
-// -----------------------------------------------------------------------
-
-int SvxColorItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return mColor == ( (const SvxColorItem&)rAttr ).mColor;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
-{
- rVal <<= (sal_Int32)(mColor.GetColor());
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
-{
- sal_Int32 nColor = 0;
- if(!(rVal >>= nColor))
- return sal_False;
-
- mColor.SetColor( nColor );
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxColorItem::Clone( SfxItemPool * ) const
-{
- return new SvxColorItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxColorItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
-{
- if( VERSION_USEAUTOCOLOR == nItemVersion &&
- COL_AUTO == mColor.GetColor() )
- rStrm << Color( COL_BLACK );
- else
- rStrm << mColor;
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxColorItem::Create(SvStream& rStrm, sal_uInt16 /*nVer*/ ) const
-{
- return new SvxColorItem( rStrm, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxColorItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = ::GetColorString( mColor );
- return ePres;
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxColorItem::SetValue( const Color& rNewCol )
-{
- mColor = rNewCol;
-}
-
-// class SvxCharSetColorItem ---------------------------------------------
-
-SvxCharSetColorItem::SvxCharSetColorItem( const sal_uInt16 nId ) :
- SvxColorItem( nId ),
-
- eFrom( RTL_TEXTENCODING_DONTKNOW )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxCharSetColorItem::SvxCharSetColorItem( const Color& rCol,
- const rtl_TextEncoding _eFrom,
- const sal_uInt16 nId ) :
- SvxColorItem( rCol, nId ),
-
- eFrom( _eFrom )
-{
-}
-
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxCharSetColorItem::Clone( SfxItemPool * ) const
-{
- return new SvxCharSetColorItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxCharSetColorItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt8)GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion())
- << GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxCharSetColorItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 cSet;
- Color aColor;
- rStrm >> cSet >> aColor;
- return new SvxCharSetColorItem( aColor, (rtl_TextEncoding)cSet, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxCharSetColorItem::GetPresentation
-(
- SfxItemPresentation /*ePres*/,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxKerningItem --------------------------------------------------
-
-SvxKerningItem::SvxKerningItem( const short nKern, const sal_uInt16 nId ) :
- SfxInt16Item( nId, nKern )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxKerningItem::Clone( SfxItemPool * ) const
-{
- return new SvxKerningItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxKerningItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (short) GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxKerningItem::ScaleMetrics( long nMult, long nDiv )
-{
- SetValue( (sal_Int16)Scale( GetValue(), nMult, nDiv ) );
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxKerningItem::HasMetrics() const
-{
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxKerningItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- short nValue;
- rStrm >> nValue;
- return new SvxKerningItem( nValue, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxKerningItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreUnit,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper *pIntl
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- rText = GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl );
- rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
- return ePres;
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- rText = EE_RESSTR(RID_SVXITEMS_KERNING_COMPLETE);
- sal_uInt16 nId = 0;
-
- if ( GetValue() > 0 )
- nId = RID_SVXITEMS_KERNING_EXPANDED;
- else if ( GetValue() < 0 )
- nId = RID_SVXITEMS_KERNING_CONDENSED;
-
- if ( nId )
- rText += EE_RESSTR(nId);
- rText += GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl );
- rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-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 true;
-}
-// -----------------------------------------------------------------------
-bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId)
-{
- sal_Int16 nVal = sal_Int16();
- if(!(rVal >>= nVal))
- return false;
- if(nMemberId & CONVERT_TWIPS)
- nVal = (sal_Int16)MM100_TO_TWIP(nVal);
- SetValue(nVal);
- return true;
-}
-
-// class SvxCaseMapItem --------------------------------------------------
-
-SvxCaseMapItem::SvxCaseMapItem( const SvxCaseMap eMap, const sal_uInt16 nId ) :
- SfxEnumItem( nId, (sal_uInt16)eMap )
-{
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxCaseMapItem::GetValueCount() const
-{
- return SVX_CASEMAP_END; // SVX_CASEMAP_KAPITAELCHEN + 1
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxCaseMapItem::Clone( SfxItemPool * ) const
-{
- return new SvxCaseMapItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxCaseMapItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt8) GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxCaseMapItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 cMap;
- rStrm >> cMap;
- return new SvxCaseMapItem( (const SvxCaseMap)cMap, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxCaseMapItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = GetValueTextByPos( GetValue() );
- return ePres;
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxCaseMapItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- DBG_ASSERT( nPos < (sal_uInt16)SVX_CASEMAP_END, "enum overflow!" );
- return EE_RESSTR( RID_SVXITEMS_CASEMAP_BEGIN + nPos );
-}
-
-bool SvxCaseMapItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
-{
- sal_Int16 nRet = style::CaseMap::NONE;
- switch( GetValue() )
- {
- 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 true;
-}
-
-bool SvxCaseMapItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
-{
- sal_uInt16 nVal = sal_uInt16();
- if(!(rVal >>= nVal))
- return sal_False;
-
- switch( nVal )
- {
- case style::CaseMap::NONE : nVal = SVX_CASEMAP_NOT_MAPPED ; break;
- case style::CaseMap::UPPERCASE: nVal = SVX_CASEMAP_VERSALIEN ; break;
- case style::CaseMap::LOWERCASE: nVal = SVX_CASEMAP_GEMEINE ; break;
- case style::CaseMap::TITLE : nVal = SVX_CASEMAP_TITEL ; break;
- case style::CaseMap::SMALLCAPS: nVal = SVX_CASEMAP_KAPITAELCHEN; break;
- }
- SetValue(nVal);
- return true;
-}
-
-// class SvxEscapementItem -----------------------------------------------
-
-SvxEscapementItem::SvxEscapementItem( const sal_uInt16 nId ) :
- SfxEnumItemInterface( nId ),
-
- nEsc ( 0 ),
- nProp ( 100 )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxEscapementItem::SvxEscapementItem( const SvxEscapement eEscape,
- const sal_uInt16 nId ) :
- SfxEnumItemInterface( nId ),
- nProp( 100 )
-{
- SetEscapement( eEscape );
- if( nEsc )
- nProp = 58;
-}
-
-// -----------------------------------------------------------------------
-
-SvxEscapementItem::SvxEscapementItem( const short _nEsc,
- const sal_uInt8 _nProp,
- const sal_uInt16 nId ) :
- SfxEnumItemInterface( nId ),
- nEsc ( _nEsc ),
- nProp ( _nProp )
-{
-}
-
-// -----------------------------------------------------------------------
-
-int SvxEscapementItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- return( nEsc == ((SvxEscapementItem&)rAttr).nEsc &&
- nProp == ((SvxEscapementItem&)rAttr).nProp );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxEscapementItem::Clone( SfxItemPool * ) const
-{
- return new SvxEscapementItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxEscapementItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- short _nEsc = GetEsc();
- if( SOFFICE_FILEFORMAT_31 == rStrm.GetVersion() )
- {
- if( DFLT_ESC_AUTO_SUPER == _nEsc )
- _nEsc = DFLT_ESC_SUPER;
- else if( DFLT_ESC_AUTO_SUB == _nEsc )
- _nEsc = DFLT_ESC_SUB;
- }
- rStrm << (sal_uInt8) GetProp()
- << (short) _nEsc;
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxEscapementItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 _nProp;
- short _nEsc;
- rStrm >> _nProp >> _nEsc;
- return new SvxEscapementItem( _nEsc, _nProp, Which() );
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxEscapementItem::GetValueCount() const
-{
- return SVX_ESCAPEMENT_END; // SVX_ESCAPEMENT_SUBSCRIPT + 1
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxEscapementItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- rText = GetValueTextByPos( GetEnumValue() );
-
- if ( nEsc != 0 )
- {
- if( DFLT_ESC_AUTO_SUPER == nEsc || DFLT_ESC_AUTO_SUB == nEsc )
- rText += String( EE_RESSTR(RID_SVXITEMS_ESCAPEMENT_AUTO) );
- else
- ( rText += String::CreateFromInt32( nEsc )) += sal_Unicode('%');
- }
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-XubString SvxEscapementItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- DBG_ASSERT( nPos < (sal_uInt16)SVX_ESCAPEMENT_END, "enum overflow!" );
- return EE_RESSTR(RID_SVXITEMS_ESCAPEMENT_BEGIN + nPos);
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxEscapementItem::GetEnumValue() const
-{
- if ( nEsc < 0 )
- return SVX_ESCAPEMENT_SUBSCRIPT;
- else if ( nEsc > 0 )
- return SVX_ESCAPEMENT_SUPERSCRIPT;
- return SVX_ESCAPEMENT_OFF;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxEscapementItem::SetEnumValue( sal_uInt16 nVal )
-{
- SetEscapement( (const SvxEscapement)nVal );
-}
-
-bool SvxEscapementItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case MID_ESC:
- rVal <<= (sal_Int16)(nEsc);
- break;
- case MID_ESC_HEIGHT:
- rVal <<= (sal_Int8)(nProp);
- break;
- case MID_AUTO_ESC:
- rVal = Bool2Any(DFLT_ESC_AUTO_SUB == nEsc || DFLT_ESC_AUTO_SUPER == nEsc);
- break;
- }
- return true;
-}
-
-bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case MID_ESC:
- {
- sal_Int16 nVal = sal_Int16();
- if( (rVal >>= nVal) && (Abs(nVal) <= 101))
- nEsc = nVal;
- else
- return sal_False;
- }
- break;
- case MID_ESC_HEIGHT:
- {
- sal_Int8 nVal = sal_Int8();
- if( (rVal >>= nVal) && (nVal <= 100))
- nProp = nVal;
- else
- return sal_False;
- }
- break;
- case MID_AUTO_ESC:
- {
- sal_Bool bVal = Any2Bool(rVal);
- if(bVal)
- {
- if(nEsc < 0)
- nEsc = DFLT_ESC_AUTO_SUB;
- else
- nEsc = DFLT_ESC_AUTO_SUPER;
- }
- else
- if(DFLT_ESC_AUTO_SUPER == nEsc )
- --nEsc;
- else if(DFLT_ESC_AUTO_SUB == nEsc)
- ++nEsc;
- }
- break;
- }
- return true;
-}
-
-// class SvxLanguageItem -------------------------------------------------
-
-SvxLanguageItem::SvxLanguageItem( const LanguageType eLang, const sal_uInt16 nId )
- : SfxEnumItem( nId , eLang )
-{
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 SvxLanguageItem::GetValueCount() const
-{
- // #i50205# got rid of class International
- DBG_ERRORFILE("SvxLanguageItem::GetValueCount: supposed to return a count of what?");
- // FIXME: previously returned LANGUAGE_COUNT from tools/intn.hxx which was wrong anyway.
- // Could be SvtLanguageTable::GetEntryCount() (all locales with resource string)?
- // Could be LocaleDataWrapper::getInstalledLanguageTypes() (all locales with locale data)?
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxLanguageItem::Clone( SfxItemPool * ) const
-{
- return new SvxLanguageItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxLanguageItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt16) GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxLanguageItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt16 nValue;
- rStrm >> nValue;
- return new SvxLanguageItem( (LanguageType)nValue, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxLanguageItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- SvtLanguageTable aLangTable;
- rText = aLangTable.GetString( (LanguageType)GetValue() );
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-bool SvxLanguageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case MID_LANG_INT: // for basic conversions!
- rVal <<= (sal_Int16)(GetValue());
- break;
- case MID_LANG_LOCALE:
- lang::Locale aRet( MsLangId::convertLanguageToLocale( GetValue(), false));
- rVal <<= aRet;
- break;
- }
- return true;
-}
-
-bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch(nMemberId)
- {
- case MID_LANG_INT: // for basic conversions!
- {
- sal_Int32 nValue = 0;
- if(!(rVal >>= nValue))
- return false;
-
- SetValue((sal_Int16)nValue);
- }
- break;
- case MID_LANG_LOCALE:
- {
- lang::Locale aLocale;
- if(!(rVal >>= aLocale))
- return sal_False;
-
- if (aLocale.Language.getLength() || aLocale.Country.getLength())
- SetValue(MsLangId::convertLocaleToLanguage( aLocale ));
- else
- SetValue(LANGUAGE_NONE);
- }
- break;
- }
- return true;
-}
-
-// class SvxNoLinebreakItem ----------------------------------------------
-SvxNoLinebreakItem::SvxNoLinebreakItem( const sal_Bool bBreak, const sal_uInt16 nId ) :
- SfxBoolItem( nId, bBreak )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxNoLinebreakItem::Clone( SfxItemPool* ) const
-{
- return new SvxNoLinebreakItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxNoLinebreakItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Bool)GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxNoLinebreakItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_Bool bValue;
- rStrm >> bValue;
- return new SvxNoLinebreakItem( bValue, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxNoLinebreakItem::GetPresentation
-(
- SfxItemPresentation /*ePres*/,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxNoHyphenItem -------------------------------------------------
-
-SvxNoHyphenItem::SvxNoHyphenItem( const sal_Bool bHyphen, const sal_uInt16 nId ) :
- SfxBoolItem( nId , bHyphen )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxNoHyphenItem::Clone( SfxItemPool* ) const
-{
- return new SvxNoHyphenItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxNoHyphenItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_Bool) GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxNoHyphenItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Bool bValue;
- rStrm >> bValue;
- return new SvxNoHyphenItem( bValue, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxNoHyphenItem::GetPresentation
-(
- SfxItemPresentation /*ePres*/,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-/*
- * Dummy item for ToolBox controls:
- *
- */
-
-// -----------------------------------------------------------------------
-// class SvxLineColorItem (== SvxColorItem)
-// -----------------------------------------------------------------------
-
-SvxLineColorItem::SvxLineColorItem( const sal_uInt16 nId ) :
- SvxColorItem( nId )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxLineColorItem::SvxLineColorItem( const Color& rCol, const sal_uInt16 nId ) :
- SvxColorItem( rCol, nId )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxLineColorItem::SvxLineColorItem( const SvxLineColorItem &rCopy ) :
- SvxColorItem( rCopy )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvxLineColorItem::~SvxLineColorItem()
-{
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxLineColorItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreUnit,
- SfxMapUnit ePresUnit,
- XubString& rText,
- const IntlWrapper * pIntlWrapper
-) const
-{
- return SvxColorItem::GetPresentation( ePres, eCoreUnit, ePresUnit,
- rText, pIntlWrapper );
-}
-
-// class SvxBlinkItem -------------------------------------------------
-
-
-SvxBlinkItem::SvxBlinkItem( const sal_Bool bBlink, const sal_uInt16 nId ) :
- SfxBoolItem( nId, bBlink )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxBlinkItem::Clone( SfxItemPool * ) const
-{
- return new SvxBlinkItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxBlinkItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt8) GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxBlinkItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nState;
- rStrm >> nState;
- return new SvxBlinkItem( nState, Which() );
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SvxBlinkItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nId = RID_SVXITEMS_BLINK_FALSE;
-
- if ( GetValue() )
- nId = RID_SVXITEMS_BLINK_TRUE;
- rText = EE_RESSTR(nId);
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// class SvxEmphaisMarkItem ---------------------------------------------------
-
-SvxEmphasisMarkItem::SvxEmphasisMarkItem( const FontEmphasisMark nValue,
- const sal_uInt16 nId )
- : SfxUInt16Item( nId, nValue )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxEmphasisMarkItem::Clone( SfxItemPool * ) const
-{
- return new SvxEmphasisMarkItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxEmphasisMarkItem::Store( SvStream& rStrm,
- sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm << (sal_uInt16)GetValue();
- return rStrm;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxEmphasisMarkItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_uInt16 nValue;
- rStrm >> nValue;
- return new SvxEmphasisMarkItem( (FontEmphasisMark)nValue, Which() );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxEmphasisMarkItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText,
- const IntlWrapper * /*pIntl*/
-) const
-{
- switch ( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- return ePres;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- sal_uInt16 nVal = GetValue();
- rText = EE_RESSTR( RID_SVXITEMS_EMPHASIS_BEGIN_STYLE +
- ( EMPHASISMARK_STYLE & nVal ));
- sal_uInt16 nId = ( EMPHASISMARK_POS_ABOVE & nVal )
- ? RID_SVXITEMS_EMPHASIS_ABOVE_POS
- : ( EMPHASISMARK_POS_BELOW & nVal )
- ? RID_SVXITEMS_EMPHASIS_BELOW_POS
- : 0;
- if( nId )
- rText += EE_RESSTR( nId );
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch( nMemberId )
- {
- case MID_EMPHASIS:
- {
- sal_Int16 nValue = GetValue();
- sal_Int16 nRet = 0;
- switch(nValue & EMPHASISMARK_STYLE)
- {
- case EMPHASISMARK_NONE : nRet = FontEmphasis::NONE; break;
- case EMPHASISMARK_DOT : nRet = FontEmphasis::DOT_ABOVE; break;
- case EMPHASISMARK_CIRCLE : nRet = FontEmphasis::CIRCLE_ABOVE; break;
- case EMPHASISMARK_DISC : nRet = FontEmphasis::DISK_ABOVE; break;
- case EMPHASISMARK_ACCENT : nRet = FontEmphasis::ACCENT_ABOVE; break;
- }
- if(nRet && nValue & EMPHASISMARK_POS_BELOW)
- nRet += 10;
- rVal <<= nRet;
- }
- break;
- }
- return true;
-}
-
-bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- sal_Bool bRet = true;
- switch( nMemberId )
- {
- case MID_EMPHASIS:
- {
- sal_Int32 nValue = -1;
- rVal >>= nValue;
- switch(nValue)
- {
- case FontEmphasis::NONE : nValue = EMPHASISMARK_NONE; break;
- case FontEmphasis::DOT_ABOVE : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_ABOVE; break;
- case FontEmphasis::CIRCLE_ABOVE: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_ABOVE; break;
- case FontEmphasis::DISK_ABOVE : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_ABOVE; break;
- case FontEmphasis::ACCENT_ABOVE: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_ABOVE; break;
- case FontEmphasis::DOT_BELOW : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW; break;
- 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 false;
- }
- SetValue( (sal_Int16)nValue );
- }
- break;
- }
- return bRet;
-}
-
-sal_uInt16 SvxEmphasisMarkItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxEmphasisMarkItem: Is there a new file format? ");
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-
-/*************************************************************************
-|* class SvxTwoLinesItem
-*************************************************************************/
-
-SvxTwoLinesItem::SvxTwoLinesItem( sal_Bool bFlag, sal_Unicode nStartBracket,
- sal_Unicode nEndBracket, sal_uInt16 nW )
- : SfxPoolItem( nW ),
- cStartBracket( nStartBracket ), cEndBracket( nEndBracket ), bOn( bFlag )
-{
-}
-
-SvxTwoLinesItem::SvxTwoLinesItem( const SvxTwoLinesItem& rAttr )
- : SfxPoolItem( rAttr.Which() ),
- cStartBracket( rAttr.cStartBracket ),
- cEndBracket( rAttr.cEndBracket ),
- bOn( rAttr.bOn )
-{
-}
-
-SvxTwoLinesItem::~SvxTwoLinesItem()
-{
-}
-
-int SvxTwoLinesItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "not equal attribute types" );
- return bOn == ((SvxTwoLinesItem&)rAttr).bOn &&
- cStartBracket == ((SvxTwoLinesItem&)rAttr).cStartBracket &&
- cEndBracket == ((SvxTwoLinesItem&)rAttr).cEndBracket;
-}
-
-SfxPoolItem* SvxTwoLinesItem::Clone( SfxItemPool* ) const
-{
- return new SvxTwoLinesItem( *this );
-}
-
-bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal,
- sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- sal_Bool bRet = true;
- switch( nMemberId )
- {
- case MID_TWOLINES:
- rVal = Bool2Any( bOn );
- break;
- case MID_START_BRACKET:
- {
- OUString s;
- if( cStartBracket )
- s = OUString( cStartBracket );
- rVal <<= s;
- }
- break;
- case MID_END_BRACKET:
- {
- OUString s;
- if( cEndBracket )
- s = OUString( cEndBracket );
- rVal <<= s;
- }
- break;
- default:
- bRet = false;
- break;
- }
- return bRet;
-}
-
-bool SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any& rVal,
- sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- sal_Bool bRet = sal_False;
- OUString s;
- switch( nMemberId )
- {
- case MID_TWOLINES:
- bOn = Any2Bool( rVal );
- bRet = sal_True;
- break;
- case MID_START_BRACKET:
- if( rVal >>= s )
- {
- cStartBracket = s.getLength() ? s[ 0 ] : 0;
- bRet = sal_True;
- }
- break;
- case MID_END_BRACKET:
- if( rVal >>= s )
- {
- cEndBracket = s.getLength() ? s[ 0 ] : 0;
- bRet = sal_True;
- }
- break;
- }
- return bRet;
-}
-
-SfxItemPresentation SvxTwoLinesItem::GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
- String &rText, const IntlWrapper* /*pIntl*/ ) const
-{
- switch( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- break;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- if( !GetValue() )
- rText = EE_RESSTR( RID_SVXITEMS_TWOLINES_OFF );
- else
- {
- rText = EE_RESSTR( RID_SVXITEMS_TWOLINES );
- if( GetStartBracket() )
- rText.Insert( GetStartBracket(), 0 );
- if( GetEndBracket() )
- rText += GetEndBracket();
- }
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-
-SfxPoolItem* SvxTwoLinesItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/) const
-{
- sal_Bool _bOn;
- sal_Unicode cStart, cEnd;
- rStrm >> _bOn >> cStart >> cEnd;
- return new SvxTwoLinesItem( _bOn, cStart, cEnd, Which() );
-}
-
-SvStream& SvxTwoLinesItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const
-{
- rStrm << GetValue() << GetStartBracket() << GetEndBracket();
- return rStrm;
-}
-
-sal_uInt16 SvxTwoLinesItem::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?" );
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-
-/*************************************************************************
-|* class SvxCharRotateItem
-*************************************************************************/
-
-SvxCharRotateItem::SvxCharRotateItem( sal_uInt16 nValue,
- sal_Bool bFitIntoLine,
- const sal_uInt16 nW )
- : SfxUInt16Item( nW, nValue ), bFitToLine( bFitIntoLine )
-{
-}
-
-SfxPoolItem* SvxCharRotateItem::Clone( SfxItemPool* ) const
-{
- return new SvxCharRotateItem( GetValue(), IsFitToLine(), Which() );
-}
-
-SfxPoolItem* SvxCharRotateItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_uInt16 nVal;
- sal_Bool b;
- rStrm >> nVal >> b;
- return new SvxCharRotateItem( nVal, b, Which() );
-}
-
-SvStream& SvxCharRotateItem::Store( SvStream & rStrm, sal_uInt16 ) const
-{
- sal_Bool bFlag = IsFitToLine();
- rStrm << GetValue() << bFlag;
- return rStrm;
-}
-
-sal_uInt16 SvxCharRotateItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-SfxItemPresentation SvxCharRotateItem::GetPresentation(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
- String &rText, const IntlWrapper* ) const
-{
- switch( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- break;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- if( !GetValue() )
- rText = EE_RESSTR( RID_SVXITEMS_CHARROTATE_OFF );
- else
- {
- rText = EE_RESSTR( RID_SVXITEMS_CHARROTATE );
- rText.SearchAndReplaceAscii( "$(ARG1)",
- String::CreateFromInt32( GetValue() / 10 ));
- if( IsFitToLine() )
- rText += EE_RESSTR( RID_SVXITEMS_CHARROTATE_FITLINE );
- }
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal,
- sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- bool bRet = true;
- switch( nMemberId )
- {
- case MID_ROTATE:
- rVal <<= (sal_Int16)GetValue();
- break;
- case MID_FITTOLINE:
- rVal = Bool2Any( IsFitToLine() );
- break;
- default:
- bRet = false;
- break;
- }
- return bRet;
-}
-
-bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal,
- sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- bool bRet = true;
- switch( nMemberId )
- {
- case MID_ROTATE:
- {
- sal_Int16 nVal = 0;
- if((rVal >>= nVal) && (0 == nVal || 900 == nVal || 2700 == nVal))
- SetValue( (sal_uInt16)nVal );
- else
- bRet = sal_False;
- break;
- }
-
- case MID_FITTOLINE:
- SetFitToLine( Any2Bool( rVal ) );
- break;
- default:
- bRet = false;
- }
- return bRet;
-}
-
-int SvxCharRotateItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return SfxUInt16Item::operator==( rItem ) &&
- IsFitToLine() == ((const SvxCharRotateItem&)rItem).IsFitToLine();
-}
-
-
-/*************************************************************************
-|* class SvxCharScaleItem
-*************************************************************************/
-
-SvxCharScaleWidthItem::SvxCharScaleWidthItem( sal_uInt16 nValue,
- const sal_uInt16 nW )
- : SfxUInt16Item( nW, nValue )
-{
-}
-
-SfxPoolItem* SvxCharScaleWidthItem::Clone( SfxItemPool* ) const
-{
- return new SvxCharScaleWidthItem( GetValue(), Which() );
-}
-
-SfxPoolItem* SvxCharScaleWidthItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_uInt16 nVal;
- rStrm >> nVal;
- SvxCharScaleWidthItem* pItem = new SvxCharScaleWidthItem( nVal, Which() );
-
- if ( Which() == EE_CHAR_FONTWIDTH )
- {
- // Was a SvxFontWidthItem in 5.2
- // USHORT nFixWidth, USHORT nPropWidth.
- // nFixWidth has never been used...
- rStrm >> nVal;
- sal_uInt16 nTest;
- rStrm >> nTest;
- if ( nTest == 0x1234 )
- pItem->SetValue( nVal );
- else
- rStrm.SeekRel( -2*(long)sizeof(sal_uInt16) );
- }
-
- return pItem;
-}
-
-SvStream& SvxCharScaleWidthItem::Store( SvStream& rStream, sal_uInt16 nVer ) const
-{
- SvStream& rRet = SfxUInt16Item::Store( rStream, nVer );
- if ( Which() == EE_CHAR_FONTWIDTH )
- {
- // see comment in Create()....
- rRet.SeekRel( -1*(long)sizeof(sal_uInt16) );
- rRet << (sal_uInt16)0;
- rRet << GetValue();
- // Really ugly, but not a problem for reading the doc in 5.2
- rRet << (sal_uInt16)0x1234;
- }
- return rRet;
-}
-
-
-sal_uInt16 SvxCharScaleWidthItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-SfxItemPresentation SvxCharScaleWidthItem::GetPresentation(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
- String &rText, const IntlWrapper* ) const
-{
- switch( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- break;
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- {
- if( !GetValue() )
- rText = EE_RESSTR( RID_SVXITEMS_CHARSCALE_OFF );
- else
- {
- rText = EE_RESSTR( RID_SVXITEMS_CHARSCALE );
- rText.SearchAndReplaceAscii( "$(ARG1)",
- String::CreateFromInt32( GetValue() ));
- }
- return ePres;
- }
- default: ; //prevent warning
- }
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-bool SvxCharScaleWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
-{
- // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w)
- // where we still want this to be a sal_Int16
- sal_Int16 nValue = sal_Int16();
- if (rVal >>= nValue)
- {
- SetValue( (sal_uInt16) nValue );
- return true;
- }
-
- OSL_TRACE( "SvxCharScaleWidthItem::PutValue - Wrong type!" );
- return false;
-}
-
-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 true;
-}
-
-/*************************************************************************
-|* class SvxCharReliefItem
-*************************************************************************/
-
-SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue,
- const sal_uInt16 nId )
- : SfxEnumItem( nId, (sal_uInt16)eValue )
-{
-}
-
-SfxPoolItem* SvxCharReliefItem::Clone( SfxItemPool * ) const
-{
- return new SvxCharReliefItem( *this );
-}
-
-SfxPoolItem* SvxCharReliefItem::Create(SvStream & rStrm, sal_uInt16) const
-{
- sal_uInt16 nVal;
- rStrm >> nVal;
- return new SvxCharReliefItem( (FontRelief)nVal, Which() );
-}
-
-SvStream& SvxCharReliefItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const
-{
- sal_uInt16 nVal = GetValue();
- rStrm << nVal;
- return rStrm;
-}
-
-sal_uInt16 SvxCharReliefItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-String SvxCharReliefItem::GetValueTextByPos( sal_uInt16 nPos ) const
-{
- DBG_ASSERT( RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE,
- "enum overflow" );
- return String( EditResId( RID_SVXITEMS_RELIEF_BEGIN + nPos ));
-}
-
-sal_uInt16 SvxCharReliefItem::GetValueCount() const
-{
- return RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE;
-}
-
-SfxItemPresentation SvxCharReliefItem::GetPresentation
-(
- SfxItemPresentation ePres,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText, const IntlWrapper * /*pIntl*/
-) const
-{
- SfxItemPresentation eRet = ePres;
- switch( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- break;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = GetValueTextByPos( GetValue() );
- break;
-
- default:
- eRet = SFX_ITEM_PRESENTATION_NONE;
- }
- return eRet;
-}
-
-bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal,
- sal_uInt8 nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- bool bRet = true;
- switch( nMemberId )
- {
- case MID_RELIEF:
- {
- sal_Int16 nVal = -1;
- rVal >>= nVal;
- if(nVal >= 0 && nVal <= RELIEF_ENGRAVED)
- SetValue( (sal_uInt16)nVal );
- else
- bRet = false;
- }
- break;
- default:
- bRet = false;
- break;
- }
- return bRet;
-}
-
-bool SvxCharReliefItem::QueryValue( com::sun::star::uno::Any& rVal,
- sal_uInt8 nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- bool bRet = true;
- switch( nMemberId )
- {
- case MID_RELIEF:
- rVal <<= (sal_Int16)GetValue();
- break;
- default:
- bRet = false;
- break;
- }
- return bRet;
-}
-
-/*************************************************************************
-|* class SvxScriptTypeItemItem
-*************************************************************************/
-
-SvxScriptTypeItem::SvxScriptTypeItem( sal_uInt16 nType )
- : SfxUInt16Item( SID_ATTR_CHAR_SCRIPTTYPE, nType )
-{
-}
-SfxPoolItem* SvxScriptTypeItem::Clone( SfxItemPool * ) const
-{
- return new SvxScriptTypeItem( GetValue() );
-}
-
-/*************************************************************************
-|* class SvxScriptSetItem
-*************************************************************************/
-
-SvxScriptSetItem::SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool )
- : SfxSetItem( nSlotId, new SfxItemSet( rPool,
- SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_FONT ))
-{
- sal_uInt16 nLatin, nAsian, nComplex;
- GetWhichIds( nLatin, nAsian, nComplex );
-
- sal_uInt16 aIds[ 9 ] = { 0 };
- aIds[ 0 ] = aIds[ 1 ] = nLatin;
- aIds[ 2 ] = aIds[ 3 ] = nAsian;
- aIds[ 4 ] = aIds[ 5 ] = nComplex;
- aIds[ 6 ] = aIds[ 7 ] = SID_ATTR_CHAR_SCRIPTTYPE;
- aIds[ 8 ] = 0;
-
- GetItemSet().SetRanges( aIds );
-}
-
-SfxPoolItem* SvxScriptSetItem::Clone( SfxItemPool * ) const
-{
- SvxScriptSetItem* p = new SvxScriptSetItem( Which(), *GetItemSet().GetPool() );
- p->GetItemSet().Put( GetItemSet(), sal_False );
- return p;
-}
-
-SfxPoolItem* SvxScriptSetItem::Create( SvStream &, sal_uInt16 ) const
-{
- return 0;
-}
-
-const SfxPoolItem* SvxScriptSetItem::GetItemOfScriptSet(
- const SfxItemSet& rSet, sal_uInt16 nId )
-{
- const SfxPoolItem* pI;
- SfxItemState eSt = rSet.GetItemState( nId, sal_False, &pI );
- if( SFX_ITEM_SET != eSt )
- pI = SFX_ITEM_DEFAULT == eSt ? &rSet.Get( nId ) : 0;
- return pI;
-}
-
-const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript )
-{
- sal_uInt16 nLatin, nAsian, nComplex;
- GetWhichIds( nSlotId, rSet, nLatin, nAsian, nComplex );
-
- const SfxPoolItem *pRet, *pAsn, *pCmplx;
- switch( nScript )
- {
- default: //no one valid -> match to latin
- // case SCRIPTTYPE_LATIN:
- pRet = GetItemOfScriptSet( rSet, nLatin );
- break;
- case SCRIPTTYPE_ASIAN:
- pRet = GetItemOfScriptSet( rSet, nAsian );
- break;
- case SCRIPTTYPE_COMPLEX:
- pRet = GetItemOfScriptSet( rSet, nComplex );
- break;
-
- case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN:
- if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
- 0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) ||
- *pRet != *pAsn )
- pRet = 0;
- break;
-
- case SCRIPTTYPE_LATIN|SCRIPTTYPE_COMPLEX:
- if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
- 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
- *pRet != *pCmplx )
- pRet = 0;
- break;
-
- case SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX:
- if( 0 == (pRet = GetItemOfScriptSet( rSet, nAsian )) ||
- 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
- *pRet != *pCmplx )
- pRet = 0;
- break;
-
- case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX:
- if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
- 0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) ||
- 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
- *pRet != *pAsn || *pRet != *pCmplx )
- pRet = 0;
- break;
- }
- return pRet;
-}
-
-const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nScript ) const
-{
- return GetItemOfScript( Which(), GetItemSet(), nScript );
-}
-
-void SvxScriptSetItem::PutItemForScriptType( sal_uInt16 nScriptType,
- const SfxPoolItem& rItem )
-{
- sal_uInt16 nLatin, nAsian, nComplex;
- GetWhichIds( nLatin, nAsian, nComplex );
-
- SfxPoolItem* pCpy = rItem.Clone();
- if( SCRIPTTYPE_LATIN & nScriptType )
- {
- pCpy->SetWhich( nLatin );
- GetItemSet().Put( *pCpy );
- }
- if( SCRIPTTYPE_ASIAN & nScriptType )
- {
- pCpy->SetWhich( nAsian );
- GetItemSet().Put( *pCpy );
- }
- if( SCRIPTTYPE_COMPLEX & nScriptType )
- {
- pCpy->SetWhich( nComplex );
- GetItemSet().Put( *pCpy );
- }
- delete pCpy;
-}
-
-void SvxScriptSetItem::GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex )
-{
- const SfxItemPool& rPool = *rSet.GetPool();
- GetSlotIds( nSlotId, rLatin, rAsian, rComplex );
- rLatin = rPool.GetWhich( rLatin );
- rAsian = rPool.GetWhich( rAsian );
- rComplex = rPool.GetWhich( rComplex );
-}
-
-void SvxScriptSetItem::GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian,
- sal_uInt16& rComplex ) const
-{
- GetWhichIds( Which(), GetItemSet(), rLatin, rAsian, rComplex );
-}
-
-void SvxScriptSetItem::GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin,
- sal_uInt16& rAsian, sal_uInt16& rComplex )
-{
- switch( nSlotId )
- {
- default:
- DBG_ASSERT( sal_False, "wrong SlotId for class SvxScriptSetItem" );
- // no break - default to font - Id Range !!
-
- case SID_ATTR_CHAR_FONT:
- rLatin = SID_ATTR_CHAR_FONT;
- rAsian = SID_ATTR_CHAR_CJK_FONT;
- rComplex = SID_ATTR_CHAR_CTL_FONT;
- break;
- case SID_ATTR_CHAR_FONTHEIGHT:
- rLatin = SID_ATTR_CHAR_FONTHEIGHT;
- rAsian = SID_ATTR_CHAR_CJK_FONTHEIGHT;
- rComplex = SID_ATTR_CHAR_CTL_FONTHEIGHT;
- break;
- case SID_ATTR_CHAR_WEIGHT:
- rLatin = SID_ATTR_CHAR_WEIGHT;
- rAsian = SID_ATTR_CHAR_CJK_WEIGHT;
- rComplex = SID_ATTR_CHAR_CTL_WEIGHT;
- break;
- case SID_ATTR_CHAR_POSTURE:
- rLatin = SID_ATTR_CHAR_POSTURE;
- rAsian = SID_ATTR_CHAR_CJK_POSTURE;
- rComplex = SID_ATTR_CHAR_CTL_POSTURE;
- break;
- case SID_ATTR_CHAR_LANGUAGE:
- rLatin = SID_ATTR_CHAR_LANGUAGE;
- rAsian = SID_ATTR_CHAR_CJK_LANGUAGE;
- rComplex = SID_ATTR_CHAR_CTL_LANGUAGE;
- break;
- }
-}
-
-void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rComplex )
-{
- const sal_uInt16 nItemCnt = 3;
-
- static struct
- {
- sal_uInt16 nFontType;
- sal_uInt16 nLanguage;
- }
- aOutTypeArr[ nItemCnt ] =
- {
- { DEFAULTFONT_LATIN_TEXT, LANGUAGE_ENGLISH_US },
- { DEFAULTFONT_CJK_TEXT, LANGUAGE_ENGLISH_US },
- { DEFAULTFONT_CTL_TEXT, LANGUAGE_ARABIC_SAUDI_ARABIA }
- };
-
- SvxFontItem* aItemArr[ nItemCnt ] = { &rLatin, &rAsian, &rComplex };
-
- for ( sal_uInt16 n = 0; n < nItemCnt; ++n )
- {
- Font aFont( OutputDevice::GetDefaultFont( aOutTypeArr[ n ].nFontType,
- aOutTypeArr[ n ].nLanguage,
- DEFAULTFONT_FLAGS_ONLYONE, 0 ) );
- SvxFontItem* pItem = aItemArr[ n ];
- pItem->SetFamily( aFont.GetFamily() );
- pItem->SetFamilyName( aFont.GetName() );
- pItem->SetStyleName( String() );
- pItem->SetPitch( aFont.GetPitch());
- pItem->SetCharSet(aFont.GetCharSet());
- }
-}
-
-
-sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang )
-{
- return GetI18NScriptType( SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ) );
-}
-
-sal_uInt16 GetItemScriptType( short nI18NType )
-{
- switch ( nI18NType )
- {
- case i18n::ScriptType::LATIN: return SCRIPTTYPE_LATIN;
- case i18n::ScriptType::ASIAN: return SCRIPTTYPE_ASIAN;
- case i18n::ScriptType::COMPLEX: return SCRIPTTYPE_COMPLEX;
- }
- return 0;
-}
-
-short GetI18NScriptType( sal_uInt16 nItemType )
-{
- switch ( nItemType )
- {
- case SCRIPTTYPE_LATIN: return i18n::ScriptType::LATIN;
- case SCRIPTTYPE_ASIAN: return i18n::ScriptType::ASIAN;
- case SCRIPTTYPE_COMPLEX: return i18n::ScriptType::COMPLEX;
- }
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/writingmodeitem.cxx b/editeng/source/items/writingmodeitem.cxx
deleted file mode 100644
index 549d1213e3..0000000000
--- a/editeng/source/items/writingmodeitem.cxx
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-// include ---------------------------------------------------------------
-
-
-#include <editeng/writingmodeitem.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng/editrids.hrc>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::text;
-
-
-TYPEINIT1_FACTORY(SvxWritingModeItem, SfxUInt16Item, new SvxWritingModeItem(com::sun::star::text::WritingMode_LR_TB, 0));
-
-SvxWritingModeItem::SvxWritingModeItem( WritingMode eValue, sal_uInt16 _nWhich )
- : SfxUInt16Item( _nWhich, (sal_uInt16)eValue )
-{
-}
-
-SvxWritingModeItem::~SvxWritingModeItem()
-{
-}
-
-int SvxWritingModeItem::operator==( const SfxPoolItem& rCmp ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal types" );
-
- return GetValue() == ((SvxWritingModeItem&)rCmp).GetValue();
-}
-
-SfxPoolItem* SvxWritingModeItem::Clone( SfxItemPool * ) const
-{
- return new SvxWritingModeItem( *this );
-}
-
-SfxPoolItem* SvxWritingModeItem::Create( SvStream & , sal_uInt16 ) const
-{
- OSL_FAIL("SvxWritingModeItem should not be streamed!");
- return NULL;
-}
-
-SvStream& SvxWritingModeItem::Store( SvStream & rStrm, sal_uInt16 ) const
-{
- OSL_FAIL("SvxWritingModeItem should not be streamed!");
- return rStrm;
-}
-
-sal_uInt16 SvxWritingModeItem::GetVersion( sal_uInt16 /*nFVer*/ ) const
-{
- return USHRT_MAX;
-}
-
-SfxItemPresentation SvxWritingModeItem::GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresMetric*/,
- String &rText,
- const IntlWrapper * ) const
-{
- SfxItemPresentation eRet = ePres;
- switch( ePres )
- {
- case SFX_ITEM_PRESENTATION_NONE:
- rText.Erase();
- break;
-
- case SFX_ITEM_PRESENTATION_NAMELESS:
- case SFX_ITEM_PRESENTATION_COMPLETE:
- rText = String( EditResId( RID_SVXITEMS_FRMDIR_BEGIN + GetValue() ) );
- break;
-
- default:
- eRet = SFX_ITEM_PRESENTATION_NONE;
- }
- return eRet;
-}
-
-bool SvxWritingModeItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
-{
- sal_Int32 nVal = 0;
- bool bRet = ( rVal >>= nVal );
-
- if( !bRet )
- {
- WritingMode eMode;
- bRet = rVal >>= eMode;
-
- if( bRet )
- {
- nVal = (sal_Int32)eMode;
- }
- }
-
- if( bRet )
- {
- switch( nVal )
- {
- case WritingMode_LR_TB:
- case WritingMode_RL_TB:
- case WritingMode_TB_RL:
- SetValue( (sal_uInt16)nVal );
- bRet = true;
- break;
- default:
- bRet = false;
- break;
- }
- }
-
- return bRet;
-}
-
-bool SvxWritingModeItem::QueryValue( com::sun::star::uno::Any& rVal,
- sal_uInt8 ) const
-{
- rVal <<= (WritingMode)GetValue();
- return true;
-}
-
-SvxWritingModeItem& SvxWritingModeItem::operator=( const SvxWritingModeItem& rItem )
-{
- 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
deleted file mode 100644
index 489841a686..0000000000
--- a/editeng/source/items/xmlcnitm.cxx
+++ /dev/null
@@ -1,243 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <com/sun/star/xml/AttributeData.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <xmloff/xmlcnimp.hxx>
-#include <xmloff/unoatrcn.hxx>
-#include <editeng/xmlcnitm.hxx>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::xml;
-
-
-TYPEINIT1(SvXMLAttrContainerItem, SfxPoolItem);
-
-SvXMLAttrContainerItem::SvXMLAttrContainerItem( sal_uInt16 _nWhich ) :
- SfxPoolItem( _nWhich )
-{
- pImpl = new SvXMLAttrContainerData;
-}
-
-SvXMLAttrContainerItem::SvXMLAttrContainerItem(
- const SvXMLAttrContainerItem& rItem ) :
- SfxPoolItem( rItem )
-{
- pImpl = new SvXMLAttrContainerData( *rItem.pImpl );
-}
-
-SvXMLAttrContainerItem::~SvXMLAttrContainerItem()
-{
- delete pImpl;
-}
-
-int SvXMLAttrContainerItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT( rItem.ISA(SvXMLAttrContainerItem),
- "SvXMLAttrContainerItem::operator ==(): Bad type");
- return *pImpl == *((const SvXMLAttrContainerItem&)rItem).pImpl;
-}
-
-int SvXMLAttrContainerItem::Compare( const SfxPoolItem &/*rWith*/ ) const
-{
- DBG_ASSERT( !this, "not yet implemented" );
-
- return 0;
-}
-
-SfxItemPresentation SvXMLAttrContainerItem::GetPresentation(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString &/*rText*/,
- const IntlWrapper * /*pIntlWrapper*/ ) const
-{
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-sal_uInt16 SvXMLAttrContainerItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const
-{
- // This item should never be stored
- return USHRT_MAX;
-}
-
-bool SvXMLAttrContainerItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
-{
- Reference<XNameContainer> xContainer =
- new SvUnoAttributeContainer( new SvXMLAttrContainerData( *pImpl ) );
-
- rVal.setValue( &xContainer, ::getCppuType((Reference<XNameContainer>*)0) );
- return true;
-}
-
-bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
-{
- Reference<XInterface> xRef;
- SvUnoAttributeContainer* pContainer = NULL;
-
- if( rVal.getValue() != NULL && rVal.getValueType().getTypeClass() == TypeClass_INTERFACE )
- {
- xRef = *(Reference<XInterface>*)rVal.getValue();
- Reference<XUnoTunnel> xTunnel(xRef, UNO_QUERY);
- if( xTunnel.is() )
- pContainer = (SvUnoAttributeContainer*)(sal_uLong)xTunnel->getSomething(SvUnoAttributeContainer::getUnoTunnelId());
- }
-
- if( pContainer )
- {
- delete pImpl;
- pImpl = new SvXMLAttrContainerData( * pContainer->GetContainerImpl() );
- }
- else
- {
- std::auto_ptr<SvXMLAttrContainerData> pNewImpl(new SvXMLAttrContainerData);
-
- try
- {
- Reference<XNameContainer> xContainer( xRef, UNO_QUERY );
- if( !xContainer.is() )
- return sal_False;
-
- const Sequence< ::rtl::OUString > aNameSequence( xContainer->getElementNames() );
- const ::rtl::OUString* pNames = aNameSequence.getConstArray();
- const sal_Int32 nCount = aNameSequence.getLength();
- Any aAny;
- AttributeData* pData;
- sal_Int32 nAttr;
-
- for( nAttr = 0; nAttr < nCount; nAttr++ )
- {
- const ::rtl::OUString aName( *pNames++ );
-
- aAny = xContainer->getByName( aName );
- if( aAny.getValue() == NULL || aAny.getValueType() != ::getCppuType((AttributeData*)0) )
- return sal_False;
-
- pData = (AttributeData*)aAny.getValue();
- sal_Int32 pos = aName.indexOf( sal_Unicode(':') );
- if( pos != -1 )
- {
- const ::rtl::OUString aPrefix( aName.copy( 0, pos ));
- const ::rtl::OUString aLName( aName.copy( pos+1 ));
-
- if( pData->Namespace.getLength() == 0 )
- {
- if( !pNewImpl->AddAttr( aPrefix, aLName, pData->Value ) )
- break;
- }
- else
- {
- if( !pNewImpl->AddAttr( aPrefix, pData->Namespace, aLName, pData->Value ) )
- break;
- }
- }
- else
- {
- if( !pNewImpl->AddAttr( aName, pData->Value ) )
- break;
- }
- }
-
- if( nAttr == nCount )
- pImpl = pNewImpl.release();
- else
- return false;
- }
- catch(...)
- {
- return false;
- }
- }
- return true;
-}
-
-
-sal_Bool SvXMLAttrContainerItem::AddAttr( const ::rtl::OUString& rLName,
- const ::rtl::OUString& rValue )
-{
- return pImpl->AddAttr( rLName, rValue );
-}
-
-sal_Bool SvXMLAttrContainerItem::AddAttr( const ::rtl::OUString& rPrefix,
- const ::rtl::OUString& rNamespace, const ::rtl::OUString& rLName,
- const ::rtl::OUString& rValue )
-{
- return pImpl->AddAttr( rPrefix, rNamespace, rLName, rValue );
-}
-
-sal_uInt16 SvXMLAttrContainerItem::GetAttrCount() const
-{
- return (sal_uInt16)pImpl->GetAttrCount();
-}
-
-::rtl::OUString SvXMLAttrContainerItem::GetAttrNamespace( sal_uInt16 i ) const
-{
- return pImpl->GetAttrNamespace( i );
-}
-
-::rtl::OUString SvXMLAttrContainerItem::GetAttrPrefix( sal_uInt16 i ) const
-{
- return pImpl->GetAttrPrefix( i );
-}
-
-const ::rtl::OUString& SvXMLAttrContainerItem::GetAttrLName( sal_uInt16 i ) const
-{
- return pImpl->GetAttrLName( i );
-}
-
-const ::rtl::OUString& SvXMLAttrContainerItem::GetAttrValue( sal_uInt16 i ) const
-{
- return pImpl->GetAttrValue( i );
-}
-
-
-sal_uInt16 SvXMLAttrContainerItem::GetFirstNamespaceIndex() const
-{
- return pImpl->GetFirstNamespaceIndex();
-}
-
-sal_uInt16 SvXMLAttrContainerItem::GetNextNamespaceIndex( sal_uInt16 nIdx ) const
-{
- return pImpl->GetNextNamespaceIndex( nIdx );
-}
-
-const ::rtl::OUString& SvXMLAttrContainerItem::GetNamespace( sal_uInt16 i ) const
-{
- return pImpl->GetNamespace( i );
-}
-
-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
deleted file mode 100644
index 0c5bd94f16..0000000000
--- a/editeng/source/misc/SvXMLAutoCorrectExport.cxx
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <SvXMLAutoCorrectExport.hxx>
-#define _SVSTDARR_STRINGSISORTDTOR
-#define _SVSTDARR_STRINGSDTOR
-#include <svl/svstdarr.hxx>
-#include <xmloff/xmltoken.hxx>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star;
-using namespace ::xmloff::token;
-using namespace ::rtl;
-
-SvXMLAutoCorrectExport::SvXMLAutoCorrectExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const SvxAutocorrWordList * pNewAutocorr_List,
- const rtl::OUString &rFileName,
- com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler)
-: SvXMLExport( xServiceFactory, rFileName, rHandler ),
- pAutocorr_List( pNewAutocorr_List )
-{
- _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST),
- GetXMLToken ( XML_N_BLOCK_LIST ),
- XML_NAMESPACE_BLOCKLIST );
-}
-
-sal_uInt32 SvXMLAutoCorrectExport::exportDoc(enum XMLTokenEnum /*eClass*/)
-{
- GetDocHandler()->startDocument();
-
- AddAttribute ( XML_NAMESPACE_NONE,
- _GetNamespaceMap().GetAttrNameByKey ( XML_NAMESPACE_BLOCKLIST ),
- _GetNamespaceMap().GetNameByKey ( XML_NAMESPACE_BLOCKLIST ) );
- {
- SvXMLElementExport aRoot (*this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK_LIST, sal_True, sal_True);
- sal_uInt16 nBlocks= pAutocorr_List->Count();
- for ( sal_uInt16 i = 0; i < nBlocks; i++)
- {
- SvxAutocorrWord* p = pAutocorr_List->GetObject(i);
-
- AddAttribute( XML_NAMESPACE_BLOCKLIST,
- XML_ABBREVIATED_NAME,
- OUString(p->GetShort()));
- AddAttribute( XML_NAMESPACE_BLOCKLIST,
- XML_NAME,
- OUString(p->IsTextOnly() ? p->GetLong() : p->GetShort()));
-
- SvXMLElementExport aBlock( *this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK, sal_True, sal_True);
- }
- }
- GetDocHandler()->endDocument();
- return 0;
-}
-
-SvXMLExceptionListExport::SvXMLExceptionListExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const SvStringsISortDtor &rNewList,
- const rtl::OUString &rFileName,
- com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler)
-: SvXMLExport( xServiceFactory, rFileName, rHandler ),
- rList( rNewList )
-{
- _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST ),
- GetXMLToken ( XML_N_BLOCK_LIST ),
- XML_NAMESPACE_BLOCKLIST );
-}
-
-sal_uInt32 SvXMLExceptionListExport::exportDoc(enum XMLTokenEnum /*eClass*/)
-{
- GetDocHandler()->startDocument();
-
- AddAttribute ( XML_NAMESPACE_NONE,
- _GetNamespaceMap().GetAttrNameByKey ( XML_NAMESPACE_BLOCKLIST ),
- _GetNamespaceMap().GetNameByKey ( XML_NAMESPACE_BLOCKLIST ) );
- {
- SvXMLElementExport aRoot (*this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK_LIST, sal_True, sal_True);
- sal_uInt16 nBlocks= rList.Count();
- for ( sal_uInt16 i = 0; i < nBlocks; i++)
- {
- AddAttribute( XML_NAMESPACE_BLOCKLIST,
- XML_ABBREVIATED_NAME,
- OUString( *rList[i] ) );
- SvXMLElementExport aBlock( *this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK, sal_True, sal_True);
- }
- }
- 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
deleted file mode 100644
index 68e7ce41f2..0000000000
--- a/editeng/source/misc/SvXMLAutoCorrectExport.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SV_XMLAUTOCORRECTEXPORT_HXX
-#define _SV_XMLAUTOCORRECTEXPORT_HXX
-
-#include <xmloff/xmlictxt.hxx>
-#include <xmloff/xmlexp.hxx>
-#include <xmloff/nmspmap.hxx>
-#include <xmloff/xmlnmspe.hxx>
-#include <editeng/svxacorr.hxx>
-
-class SvXMLAutoCorrectExport : public SvXMLExport
-{
-private:
- const SvxAutocorrWordList *pAutocorr_List;
-public:
- SvXMLAutoCorrectExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const SvxAutocorrWordList * pNewAutocorr_List,
- const rtl::OUString &rFileName,
- com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler);
-
- virtual ~SvXMLAutoCorrectExport ( void ) {}
- sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum eClass);
- void _ExportAutoStyles() {}
- void _ExportMasterStyles () {}
- void _ExportContent() {}
-};
-
-class SvStringsISortDtor;
-
-class SvXMLExceptionListExport : public SvXMLExport
-{
-private:
- const SvStringsISortDtor & rList;
-public:
- SvXMLExceptionListExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const SvStringsISortDtor &rNewList,
- const rtl::OUString &rFileName,
- com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler);
-
- virtual ~SvXMLExceptionListExport ( void ) {}
- sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum eClass);
- void _ExportAutoStyles() {}
- void _ExportMasterStyles () {}
- void _ExportContent() {}
-};
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/misc/SvXMLAutoCorrectImport.cxx b/editeng/source/misc/SvXMLAutoCorrectImport.cxx
deleted file mode 100644
index c70bb3ce53..0000000000
--- a/editeng/source/misc/SvXMLAutoCorrectImport.cxx
+++ /dev/null
@@ -1,263 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <SvXMLAutoCorrectImport.hxx>
-#include <vcl/svapp.hxx>
-
-#define _SVSTDARR_STRINGSISORTDTOR
-#define _SVSTDARR_STRINGSDTOR
-#include <svl/svstdarr.hxx>
-#include <xmloff/xmltoken.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::xmloff::token;
-using namespace ::rtl;
-
-
-static OUString sBlockList ( RTL_CONSTASCII_USTRINGPARAM ( "_block-list" ) );
-
-SvXMLAutoCorrectImport::SvXMLAutoCorrectImport(
- const uno::Reference< lang::XMultiServiceFactory > xServiceFactory,
- SvxAutocorrWordList *pNewAutocorr_List,
- SvxAutoCorrect &rNewAutoCorrect,
- const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rNewStorage)
-: SvXMLImport( xServiceFactory ),
- pAutocorr_List (pNewAutocorr_List),
- rAutoCorrect ( rNewAutoCorrect ),
- xStorage ( rNewStorage )
-{
- GetNamespaceMap().Add(
- sBlockList,
- GetXMLToken ( XML_N_BLOCK_LIST),
- XML_NAMESPACE_BLOCKLIST );
-}
-
-SvXMLAutoCorrectImport::~SvXMLAutoCorrectImport ( void ) throw ()
-{
-}
-
-SvXMLImportContext *SvXMLAutoCorrectImport::CreateContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList > & xAttrList )
-{
- SvXMLImportContext *pContext = 0;
-
- if( XML_NAMESPACE_BLOCKLIST == nPrefix &&
- IsXMLToken ( rLocalName, XML_BLOCK_LIST ) )
- pContext = new SvXMLWordListContext( *this, nPrefix, rLocalName, xAttrList );
- else
- pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
- return pContext;
-}
-
-SvXMLWordListContext::SvXMLWordListContext(
- SvXMLAutoCorrectImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const com::sun::star::uno::Reference<
- com::sun::star::xml::sax::XAttributeList > & /*xAttrList*/ ) :
- SvXMLImportContext ( rImport, nPrefix, rLocalName ),
- rLocalRef(rImport)
-{
-}
-
-SvXMLImportContext *SvXMLWordListContext::CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList > & xAttrList )
-{
- SvXMLImportContext *pContext = 0;
-
- if (nPrefix == XML_NAMESPACE_BLOCKLIST &&
- IsXMLToken ( rLocalName, XML_BLOCK ) )
- pContext = new SvXMLWordContext (rLocalRef, nPrefix, rLocalName, xAttrList);
- else
- pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName);
- return pContext;
-}
-SvXMLWordListContext::~SvXMLWordListContext ( void )
-{
-}
-
-SvXMLWordContext::SvXMLWordContext(
- SvXMLAutoCorrectImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const com::sun::star::uno::Reference<
- com::sun::star::xml::sax::XAttributeList > & xAttrList ) :
- SvXMLImportContext ( rImport, nPrefix, rLocalName ),
- rLocalRef(rImport)
-{
- String sRight, sWrong;
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-
- for (sal_Int16 i=0; i < nAttrCount; i++)
- {
- const OUString& rAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nAttrPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName);
- const OUString& rAttrValue = xAttrList->getValueByIndex( i );
- if (XML_NAMESPACE_BLOCKLIST == nAttrPrefix)
- {
- if ( IsXMLToken ( aLocalName, XML_ABBREVIATED_NAME ) )
- {
- sWrong = rAttrValue;
- }
- else if ( IsXMLToken ( aLocalName, XML_NAME ) )
- {
- sRight = rAttrValue;
- }
- }
- }
- if (!sWrong.Len() || !sRight.Len() )
- return;
-
- sal_Bool bOnlyTxt = sRight != sWrong;
- if( !bOnlyTxt )
- {
- String sLongSave( sRight );
- if( !rLocalRef.rAutoCorrect.GetLongText( rLocalRef.xStorage, String(), sWrong, sRight ) &&
- sLongSave.Len() )
- {
- sRight = sLongSave;
- bOnlyTxt = sal_True;
- }
- }
- SvxAutocorrWordPtr pNew = new SvxAutocorrWord( sWrong, sRight, bOnlyTxt );
-
- if( !rLocalRef.pAutocorr_List->Insert( pNew ) )
- delete pNew;
-}
-
-SvXMLWordContext::~SvXMLWordContext ( void )
-{
-}
-
-SvXMLExceptionListImport::SvXMLExceptionListImport(
- const uno::Reference< lang::XMultiServiceFactory > xServiceFactory,
- SvStringsISortDtor & rNewList )
-: SvXMLImport( xServiceFactory ),
- rList (rNewList)
-{
- GetNamespaceMap().Add(
- sBlockList,
- GetXMLToken ( XML_N_BLOCK_LIST),
- XML_NAMESPACE_BLOCKLIST );
-}
-
-SvXMLExceptionListImport::~SvXMLExceptionListImport ( void ) throw ()
-{
-}
-
-SvXMLImportContext *SvXMLExceptionListImport::CreateContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList > & xAttrList )
-{
- SvXMLImportContext *pContext = 0;
-
- if( XML_NAMESPACE_BLOCKLIST==nPrefix &&
- IsXMLToken ( rLocalName, XML_BLOCK_LIST ) )
- pContext = new SvXMLExceptionListContext( *this, nPrefix, rLocalName, xAttrList );
- else
- pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
- return pContext;
-}
-
-SvXMLExceptionListContext::SvXMLExceptionListContext(
- SvXMLExceptionListImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const com::sun::star::uno::Reference<
- com::sun::star::xml::sax::XAttributeList > & /* xAttrList */ ) :
- SvXMLImportContext ( rImport, nPrefix, rLocalName ),
- rLocalRef(rImport)
-{
-}
-
-SvXMLImportContext *SvXMLExceptionListContext::CreateChildContext(
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList > & xAttrList )
-{
- SvXMLImportContext *pContext = 0;
-
- if (nPrefix == XML_NAMESPACE_BLOCKLIST &&
- IsXMLToken ( rLocalName, XML_BLOCK ) )
- pContext = new SvXMLExceptionContext (rLocalRef, nPrefix, rLocalName, xAttrList);
- else
- pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName);
- return pContext;
-}
-SvXMLExceptionListContext::~SvXMLExceptionListContext ( void )
-{
-}
-
-SvXMLExceptionContext::SvXMLExceptionContext(
- SvXMLExceptionListImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const com::sun::star::uno::Reference<
- com::sun::star::xml::sax::XAttributeList > & xAttrList ) :
- SvXMLImportContext ( rImport, nPrefix, rLocalName ),
- rLocalRef(rImport)
-{
- String sWord;
- sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-
- for (sal_Int16 i=0; i < nAttrCount; i++)
- {
- const OUString& rAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nAttrPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName);
- const OUString& rAttrValue = xAttrList->getValueByIndex( i );
- if (XML_NAMESPACE_BLOCKLIST == nAttrPrefix)
- {
- if ( IsXMLToken ( aLocalName, XML_ABBREVIATED_NAME ) )
- {
- sWord = rAttrValue;
- }
- }
- }
- if (!sWord.Len() )
- return;
-
- String * pNew = new String( sWord );
-
- if( !rLocalRef.rList.Insert( pNew ) )
- delete pNew;
-}
-
-SvXMLExceptionContext::~SvXMLExceptionContext ( void )
-{
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/misc/SvXMLAutoCorrectImport.hxx b/editeng/source/misc/SvXMLAutoCorrectImport.hxx
deleted file mode 100644
index 67cd30f036..0000000000
--- a/editeng/source/misc/SvXMLAutoCorrectImport.hxx
+++ /dev/null
@@ -1,146 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SV_XMLAUTOCORRECTIMPORT_HXX
-#define _SV_XMLAUTOCORRECTIMPORT_HXX
-
-#include <sot/storage.hxx>
-#include <xmloff/xmlictxt.hxx>
-#include <xmloff/xmlimp.hxx>
-#include <xmloff/nmspmap.hxx>
-#include <xmloff/xmlnmspe.hxx>
-#include <editeng/svxacorr.hxx>
-
-class SvXMLAutoCorrectImport : public SvXMLImport
-{
-protected:
-
- // This method is called after the namespace map has been updated, but
- // before a context for the current element has been pushed.
- virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
- const ::rtl::OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
-public:
- SvxAutocorrWordList *pAutocorr_List;
- SvxAutoCorrect &rAutoCorrect;
- com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStorage;
-
- SvXMLAutoCorrectImport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- SvxAutocorrWordList *pNewAutocorr_List,
- SvxAutoCorrect &rNewAutoCorrect,
- const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rNewStorage);
-
- ~SvXMLAutoCorrectImport ( void ) throw ();
-};
-
-class SvXMLWordListContext : public SvXMLImportContext
-{
-private:
- SvXMLAutoCorrectImport & rLocalRef;
-public:
- SvXMLWordListContext ( SvXMLAutoCorrectImport& rImport,
- sal_uInt16 nPrefix,
- const rtl::OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
- virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
- const rtl::OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
- ~SvXMLWordListContext ( void );
-};
-
-class SvXMLWordContext : public SvXMLImportContext
-{
-private:
- SvXMLAutoCorrectImport & rLocalRef;
-public:
- SvXMLWordContext ( SvXMLAutoCorrectImport& rImport,
- sal_uInt16 nPrefix,
- const rtl::OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
- ~SvXMLWordContext ( void );
-};
-
-
-class SvXMLExceptionListImport : public SvXMLImport
-{
-protected:
-
- // This method is called after the namespace map has been updated, but
- // before a context for the current element has been pushed.
- virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
- const ::rtl::OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
-public:
- SvStringsISortDtor &rList;
-
- SvXMLExceptionListImport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- SvStringsISortDtor & rNewList );
-
- ~SvXMLExceptionListImport ( void ) throw ();
-};
-
-class SvXMLExceptionListContext : public SvXMLImportContext
-{
-private:
- SvXMLExceptionListImport & rLocalRef;
-public:
- SvXMLExceptionListContext ( SvXMLExceptionListImport& rImport,
- sal_uInt16 nPrefix,
- const rtl::OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
- virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
- const rtl::OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
- ~SvXMLExceptionListContext ( void );
-};
-
-class SvXMLExceptionContext : public SvXMLImportContext
-{
-private:
- SvXMLExceptionListImport & rLocalRef;
-public:
- SvXMLExceptionContext ( SvXMLExceptionListImport& rImport,
- sal_uInt16 nPrefix,
- const rtl::OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
- ~SvXMLExceptionContext ( void );
-};
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
deleted file mode 100644
index 1c6d8e149d..0000000000
--- a/editeng/source/misc/acorrcfg.cxx
+++ /dev/null
@@ -1,661 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <editeng/acorrcfg.hxx>
-#include <tools/debug.hxx>
-#include <tools/urlobj.hxx>
-#include <unotools/pathoptions.hxx>
-#include <svl/urihelper.hxx>
-
-#include <editeng/svxacorr.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <rtl/instance.hxx>
-
-using namespace utl;
-using namespace com::sun::star::uno;
-
-using ::rtl::OUString;
-
-SvxAutoCorrCfg::SvxAutoCorrCfg() :
- aBaseConfig(*this),
- aSwConfig(*this),
- bFileRel(sal_True),
- bNetRel(sal_True),
- bAutoTextTip(sal_True),
- bAutoTextPreview(sal_False),
- bAutoFmtByInput(sal_True),
- bSearchInAllCategories(sal_False)
-{
- SvtPathOptions aPathOpt;
- String sSharePath, sUserPath, sAutoPath( aPathOpt.GetAutoCorrectPath() );
-
- String* pS = &sSharePath;
- for( sal_uInt16 n = 0; n < 2; ++n, pS = &sUserPath )
- {
- *pS = sAutoPath.GetToken( n, ';' );
- INetURLObject aPath( *pS );
- aPath.insertName( String::CreateFromAscii("acor") );
- *pS = aPath.GetMainURL(INetURLObject::DECODE_TO_IURI);
- }
- pAutoCorrect = new SvxAutoCorrect( sSharePath, sUserPath );
-
- aBaseConfig.Load(sal_True);
- aSwConfig.Load(sal_True);
-}
-
-SvxAutoCorrCfg::~SvxAutoCorrCfg()
-{
- delete pAutoCorrect;
-}
-
-void SvxAutoCorrCfg::SetAutoCorrect( SvxAutoCorrect* pNew )
-{
- if( pNew && pNew != pAutoCorrect )
- {
- if( pAutoCorrect->GetFlags() != pNew->GetFlags() )
- {
- aBaseConfig.SetModified();
- aSwConfig.SetModified();
- }
- delete pAutoCorrect;
- pAutoCorrect = pNew;
- }
-}
-
-Sequence<OUString> SvxBaseAutoCorrCfg::GetPropertyNames()
-{
- static const char* aPropNames[] =
- {
- "Exceptions/TwoCapitalsAtStart", // 0
- "Exceptions/CapitalAtStartSentence", // 1
- "UseReplacementTable", // 2
- "TwoCapitalsAtStart", // 3
- "CapitalAtStartSentence", // 4
- "ChangeUnderlineWeight", // 5
- "SetInetAttribute", // 6
- "ChangeOrdinalNumber", // 7
- "AddNonBreakingSpace", // 8
- "ChangeDash", // 9
- "RemoveDoubleSpaces", // 10
- "ReplaceSingleQuote", // 11
- "SingleQuoteAtStart", // 12
- "SingleQuoteAtEnd", // 13
- "ReplaceDoubleQuote", // 14
- "DoubleQuoteAtStart", // 15
- "DoubleQuoteAtEnd", // 16
- "CorrectAccidentalCapsLock" // 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;
-}
-
-void SvxBaseAutoCorrCfg::Load(sal_Bool bInit)
-{
- Sequence<OUString> aNames = GetPropertyNames();
- Sequence<Any> aValues = GetProperties(aNames);
- if(bInit)
- EnableNotification(aNames);
- const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
- {
- long nFlags = 0; // default all off
- sal_Int32 nTemp = 0;
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
- {
- if(pValues[nProp].hasValue())
- {
- switch(nProp)
- {
- case 0:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= SaveWordCplSttLst;
- break;//"Exceptions/TwoCapitalsAtStart",
- case 1:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= SaveWordWrdSttLst;
- break;//"Exceptions/CapitalAtStartSentence",
- case 2:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= Autocorrect;
- break;//"UseReplacementTable",
- case 3:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= CptlSttWrd;
- break;//"TwoCapitalsAtStart",
- case 4:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= CptlSttSntnc;
- break;//"CapitalAtStartSentence",
- case 5:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= ChgWeightUnderl;
- break;//"ChangeUnderlineWeight",
- case 6:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= SetINetAttr;
- break;//"SetInetAttribute",
- case 7:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= ChgOrdinalNumber;
- break;//"ChangeOrdinalNumber",
- case 8:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= AddNonBrkSpace;
- break;//"AddNonBreakingSpace"
- case 9:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= ChgToEnEmDash;
- break;//"ChangeDash",
- case 10:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= IgnoreDoubleSpace;
- break;//"RemoveDoubleSpaces",
- case 11:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= ChgSglQuotes;
- break;//"ReplaceSingleQuote",
- case 12:
- pValues[nProp] >>= nTemp;
- rParent.pAutoCorrect->SetStartSingleQuote(
- sal::static_int_cast< sal_Unicode >( nTemp ) );
- break;//"SingleQuoteAtStart",
- case 13:
- pValues[nProp] >>= nTemp;
- rParent.pAutoCorrect->SetEndSingleQuote(
- sal::static_int_cast< sal_Unicode >( nTemp ) );
- break;//"SingleQuoteAtEnd",
- case 14:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= ChgQuotes;
- break;//"ReplaceDoubleQuote",
- case 15:
- pValues[nProp] >>= nTemp;
- rParent.pAutoCorrect->SetStartDoubleQuote(
- sal::static_int_cast< sal_Unicode >( nTemp ) );
- break;//"DoubleQuoteAtStart",
- case 16:
- pValues[nProp] >>= nTemp;
- rParent.pAutoCorrect->SetEndDoubleQuote(
- sal::static_int_cast< sal_Unicode >( nTemp ) );
- break;//"DoubleQuoteAtEnd"
- case 17:
- if(*(sal_Bool*)pValues[nProp].getValue())
- nFlags |= CorrectCapsLock;
- break;//"CorrectAccidentalCapsLock"
- }
- }
- }
- if( nFlags )
- rParent.pAutoCorrect->SetAutoCorrFlag( nFlags, sal_True );
- rParent.pAutoCorrect->SetAutoCorrFlag( ( 0xffff & ~nFlags ), sal_False );
-
- }
-}
-
-SvxBaseAutoCorrCfg::SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rPar) :
- utl::ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/AutoCorrect"))),
- rParent(rPar)
-{
-}
-
-SvxBaseAutoCorrCfg::~SvxBaseAutoCorrCfg()
-{
-}
-
-void SvxBaseAutoCorrCfg::Commit()
-{
- Sequence<OUString> aNames( GetPropertyNames() );
-
- Sequence<Any> aValues(aNames.getLength());
- Any* pValues = aValues.getArray();
-
- const Type& rType = ::getBooleanCppuType();
- sal_Bool bVal;
- const long nFlags = rParent.pAutoCorrect->GetFlags();
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
- {
- switch(nProp)
- {
- case 0:
- bVal = 0 != (nFlags & SaveWordCplSttLst);
- pValues[nProp].setValue(&bVal, rType);
- break;//"Exceptions/TwoCapitalsAtStart",
- case 1:
- bVal = 0 != (nFlags & SaveWordWrdSttLst);
- pValues[nProp].setValue(&bVal, rType);
- break;//"Exceptions/CapitalAtStartSentence",
- case 2:
- bVal = 0 != (nFlags & Autocorrect);
- pValues[nProp].setValue(&bVal, rType);
- break;//"UseReplacementTable",
- case 3:
- bVal = 0 != (nFlags & CptlSttWrd);
- pValues[nProp].setValue(&bVal, rType);
- break;//"TwoCapitalsAtStart",
- case 4:
- bVal = 0 != (nFlags & CptlSttSntnc);
- pValues[nProp].setValue(&bVal, rType);
- break;//"CapitalAtStartSentence",
- case 5:
- bVal = 0 != (nFlags & ChgWeightUnderl);
- pValues[nProp].setValue(&bVal, rType);
- break;//"ChangeUnderlineWeight",
- case 6:
- bVal = 0 != (nFlags & SetINetAttr);
- pValues[nProp].setValue(&bVal, rType);
- break;//"SetInetAttribute",
- case 7:
- bVal = 0 != (nFlags & ChgOrdinalNumber);
- pValues[nProp].setValue(&bVal, rType);
- break;//"ChangeOrdinalNumber",
- case 8:
- bVal = 0 != (nFlags & AddNonBrkSpace);
- pValues[nProp].setValue(&bVal, rType);
- break;//"AddNonBreakingSpace"
- case 9:
- bVal = 0 != (nFlags & ChgToEnEmDash);
- pValues[nProp].setValue(&bVal, rType);
- break;//"ChangeDash",
- case 10:
- bVal = 0 != (nFlags & IgnoreDoubleSpace);
- pValues[nProp].setValue(&bVal, rType);
- break;//"RemoveDoubleSpaces",
- case 11:
- bVal = 0 != (nFlags & ChgSglQuotes);
- pValues[nProp].setValue(&bVal, rType);
- break;//"ReplaceSingleQuote",
- case 12:
- pValues[nProp] <<= (sal_Int32)rParent.pAutoCorrect->GetStartSingleQuote();
- break;//"SingleQuoteAtStart",
- case 13:
- pValues[nProp] <<= (sal_Int32) rParent.pAutoCorrect->GetEndSingleQuote();
- break;//"SingleQuoteAtEnd",
- case 14:
- bVal = 0 != (nFlags & ChgQuotes);
- pValues[nProp].setValue(&bVal, rType);
- break;//"ReplaceDoubleQuote",
- case 15:
- pValues[nProp] <<= (sal_Int32) rParent.pAutoCorrect->GetStartDoubleQuote();
- break;//"DoubleQuoteAtStart",
- 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);
-}
-
-void SvxBaseAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */)
-{
- Load(sal_False);
-}
-
-Sequence<OUString> SvxSwAutoCorrCfg::GetPropertyNames()
-{
- static const char* aPropNames[] =
- {
- "Text/FileLinks", // 0
- "Text/InternetLinks", // 1
- "Text/ShowPreview", // 2
- "Text/ShowToolTip", // 3
- "Text/SearchInAllCategories", // 4
- "Format/Option/UseReplacementTable", // 5
- "Format/Option/TwoCapitalsAtStart", // 6
- "Format/Option/CapitalAtStartSentence", // 7
- "Format/Option/ChangeUnderlineWeight", // 8
- "Format/Option/SetInetAttribute", // 9
- "Format/Option/ChangeOrdinalNumber", //10
- "Format/Option/AddNonBreakingSpace", //11
- "Format/Option/ChangeDash", //12
- "Format/Option/DelEmptyParagraphs", //13
- "Format/Option/ReplaceUserStyle", //14
- "Format/Option/ChangeToBullets/Enable", //15
- "Format/Option/ChangeToBullets/SpecialCharacter/Char", //16
- "Format/Option/ChangeToBullets/SpecialCharacter/Font", //17
- "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily", //18
- "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset", //19
- "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch", //20
- "Format/Option/CombineParagraphs", //21
- "Format/Option/CombineValue", //22
- "Format/Option/DelSpacesAtStartEnd", //23
- "Format/Option/DelSpacesBetween", //24
- "Format/ByInput/Enable", //25
- "Format/ByInput/ChangeDash", //26
- "Format/ByInput/ApplyNumbering/Enable", //27
- "Format/ByInput/ChangeToBorders", //28
- "Format/ByInput/ChangeToTable", //29
- "Format/ByInput/ReplaceStyle", //30
- "Format/ByInput/DelSpacesAtStartEnd", //31
- "Format/ByInput/DelSpacesBetween", //32
- "Completion/Enable", //33
- "Completion/MinWordLen", //34
- "Completion/MaxListLen", //35
- "Completion/CollectWords", //36
- "Completion/EndlessList", //37
- "Completion/AppendBlank", //38
- "Completion/ShowAsTip", //39
- "Completion/AcceptKey", //40
- "Completion/KeepList", //41
- "Format/ByInput/ApplyNumbering/SpecialCharacter/Char", //42
- "Format/ByInput/ApplyNumbering/SpecialCharacter/Font", //43
- "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily", //44
- "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", //45
- "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch" //46
- };
- const int nCount = 47;
- Sequence<OUString> aNames(nCount);
- OUString* pNames = aNames.getArray();
- for(int i = 0; i < nCount; i++)
- pNames[i] = OUString::createFromAscii(aPropNames[i]);
- return aNames;
-}
-
-void SvxSwAutoCorrCfg::Load(sal_Bool bInit)
-{
- Sequence<OUString> aNames = GetPropertyNames();
- Sequence<Any> aValues = GetProperties(aNames);
- if(bInit)
- EnableNotification(aNames);
- const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
- {
- SvxSwAutoFmtFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags();
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
- {
- if(pValues[nProp].hasValue())
- {
- switch(nProp)
- {
- case 0: rParent.bFileRel = *(sal_Bool*)pValues[nProp].getValue(); break; // "Text/FileLinks",
- case 1: rParent.bNetRel = *(sal_Bool*)pValues[nProp].getValue(); break; // "Text/InternetLinks",
- case 2: rParent.bAutoTextPreview = *(sal_Bool*)pValues[nProp].getValue(); break; // "Text/ShowPreview",
- case 3: rParent.bAutoTextTip = *(sal_Bool*)pValues[nProp].getValue(); break; // "Text/ShowToolTip",
- case 4: rParent.bSearchInAllCategories = *(sal_Bool*)pValues[nProp].getValue(); break; //"Text/SearchInAllCategories"
- case 5: rSwFlags.bAutoCorrect = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/UseReplacementTable",
- case 6: rSwFlags.bCptlSttSntnc = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/TwoCapitalsAtStart",
- case 7: rSwFlags.bCptlSttWrd = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/CapitalAtStartSentence",
- case 8: rSwFlags.bChgWeightUnderl = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeUnderlineWeight",
- case 9: rSwFlags.bSetINetAttr = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/SetInetAttribute",
- case 10: rSwFlags.bChgOrdinalNumber = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeOrdinalNumber",
- case 11: rSwFlags.bAddNonBrkSpace = *(sal_Bool*)pValues[nProp].getValue( ); break; // "Format/Option/AddNonBreakingSpace",
-// it doesn't exist here - the common flags are used for that -> LM
-// case 12: rSwFlags.bChgToEnEmDash = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeDash",
- case 13: rSwFlags.bDelEmptyNode = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelEmptyParagraphs",
- case 14: rSwFlags.bChgUserColl = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ReplaceUserStyle",
- case 15: rSwFlags.bChgEnumNum = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeToBullets/Enable",
- case 16:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.cBullet =
- sal::static_int_cast< sal_Unicode >(nVal);
- }
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
- case 17:
- {
- OUString sTemp; pValues[nProp] >>= sTemp;
- rSwFlags.aBulletFont.SetName(sTemp);
- }
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
- case 18:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aBulletFont.SetFamily(FontFamily(nVal));
- }
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
- case 19:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aBulletFont.SetCharSet(CharSet(nVal));
- }
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
- case 20:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aBulletFont.SetPitch(FontPitch(nVal));
- }
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
- case 21: rSwFlags.bRightMargin = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/CombineParagraphs",
- case 22:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.nRightMargin =
- sal::static_int_cast< sal_uInt8 >(nVal);
- }
- break; // "Format/Option/CombineValue",
- case 23: rSwFlags.bAFmtDelSpacesAtSttEnd = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelSpacesAtStartEnd",
- case 24: rSwFlags.bAFmtDelSpacesBetweenLines = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelSpacesBetween",
- case 25: rParent.bAutoFmtByInput = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/Enable",
- case 26: rSwFlags.bChgToEnEmDash = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeDash",
- case 27: rSwFlags.bSetNumRule = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ApplyNumbering/Enable",
- case 28: rSwFlags.bSetBorder = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeToBorders",
- case 29: rSwFlags.bCreateTable = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeToTable",
- case 30: rSwFlags.bReplaceStyles = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ReplaceStyle",
- case 31: rSwFlags.bAFmtByInpDelSpacesAtSttEnd = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/DelSpacesAtStartEnd",
- case 32: rSwFlags.bAFmtByInpDelSpacesBetweenLines = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/DelSpacesBetween",
- case 33: rSwFlags.bAutoCompleteWords = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/Enable",
- case 34:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.nAutoCmpltWordLen =
- sal::static_int_cast< sal_uInt16 >(nVal);
- }
- break; // "Completion/MinWordLen",
- case 35:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.nAutoCmpltListLen =
- sal::static_int_cast< sal_uInt16 >(nVal);
- }
- break; // "Completion/MaxListLen",
- case 36: rSwFlags.bAutoCmpltCollectWords = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/CollectWords",
- case 37: rSwFlags.bAutoCmpltEndless = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/EndlessList",
- case 38: rSwFlags.bAutoCmpltAppendBlanc = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/AppendBlank",
- case 39: rSwFlags.bAutoCmpltShowAsTip = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/ShowAsTip",
- case 40:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.nAutoCmpltExpandKey =
- sal::static_int_cast< sal_uInt16 >(nVal);
- }
- break; // "Completion/AcceptKey"
- case 41 :rSwFlags.bAutoCmpltKeepList = *(sal_Bool*)pValues[nProp].getValue(); break;//"Completion/KeepList"
- case 42 :
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.cByInputBullet =
- sal::static_int_cast< sal_Unicode >(nVal);
- }
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
- case 43 :
- {
- OUString sTemp; pValues[nProp] >>= sTemp;
- rSwFlags.aByInputBulletFont.SetName(sTemp);
- }
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
- case 44 :
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aByInputBulletFont.SetFamily(FontFamily(nVal));
- }
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
- case 45 :
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aByInputBulletFont.SetCharSet(CharSet(nVal));
- }
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
- case 46 :
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aByInputBulletFont.SetPitch(FontPitch(nVal));
- }
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
- }
- }
- }
- }
-}
-
-SvxSwAutoCorrCfg::SvxSwAutoCorrCfg(SvxAutoCorrCfg& rPar) :
- utl::ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Writer/AutoFunction"))),
- rParent(rPar)
-{
-}
-
-SvxSwAutoCorrCfg::~SvxSwAutoCorrCfg()
-{
-}
-
-void SvxSwAutoCorrCfg::Commit()
-{
- Sequence<OUString> aNames = GetPropertyNames();
-
- Sequence<Any> aValues(aNames.getLength());
- Any* pValues = aValues.getArray();
-
- const Type& rType = ::getBooleanCppuType();
- sal_Bool bVal;
- SvxSwAutoFmtFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags();
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
- {
- switch(nProp)
- {
- case 0: pValues[nProp].setValue(&rParent.bFileRel, rType); break; // "Text/FileLinks",
- case 1: pValues[nProp].setValue(&rParent.bNetRel, rType); break; // "Text/InternetLinks",
- case 2: pValues[nProp].setValue(&rParent.bAutoTextPreview, rType); break; // "Text/ShowPreview",
- case 3: pValues[nProp].setValue(&rParent.bAutoTextTip, rType); break; // "Text/ShowToolTip",
- case 4: pValues[nProp].setValue(&rParent.bSearchInAllCategories, rType );break; //"Text/SearchInAllCategories"
- case 5: bVal = rSwFlags.bAutoCorrect; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/UseReplacementTable",
- case 6: bVal = rSwFlags.bCptlSttSntnc; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/TwoCapitalsAtStart",
- case 7: bVal = rSwFlags.bCptlSttWrd; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/CapitalAtStartSentence",
- case 8: bVal = rSwFlags.bChgWeightUnderl; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeUnderlineWeight",
- case 9: bVal = rSwFlags.bSetINetAttr; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/SetInetAttribute",
- case 10: bVal = rSwFlags.bChgOrdinalNumber; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeOrdinalNumber",
- case 11: bVal = rSwFlags.bAddNonBrkSpace; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/AddNonBreakingSpace",
-// it doesn't exist here - the common flags are used for that -> LM
- case 12:
- bVal = sal_True; pValues[nProp].setValue(&bVal, rType);
- break; // "Format/Option/ChangeDash",
- case 13: bVal = rSwFlags.bDelEmptyNode; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelEmptyParagraphs",
- case 14: bVal = rSwFlags.bChgUserColl; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ReplaceUserStyle",
- case 15: bVal = rSwFlags.bChgEnumNum; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeToBullets/Enable",
- case 16:
- pValues[nProp] <<= (sal_Int32)rSwFlags.cBullet;
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
- case 17:
- pValues[nProp] <<= OUString(rSwFlags.aBulletFont.GetName());
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
- case 18:
- pValues[nProp] <<= (sal_Int32)rSwFlags.aBulletFont.GetFamily();
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
- case 19:
- pValues[nProp] <<= (sal_Int32)rSwFlags.aBulletFont.GetCharSet();
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
- case 20:
- pValues[nProp] <<= (sal_Int32)rSwFlags.aBulletFont.GetPitch();
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
- case 21: bVal = rSwFlags.bRightMargin; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/CombineParagraphs",
- case 22:
- pValues[nProp] <<= (sal_Int32)rSwFlags.nRightMargin;
- break; // "Format/Option/CombineValue",
- case 23: bVal = rSwFlags.bAFmtDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesAtStartEnd",
- case 24: bVal = rSwFlags.bAFmtDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesBetween",
- case 25: bVal = rParent.bAutoFmtByInput; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/Enable",
- case 26: bVal = rSwFlags.bChgToEnEmDash; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeDash",
- case 27: bVal = rSwFlags.bSetNumRule; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ApplyNumbering/Enable",
- case 28: bVal = rSwFlags.bSetBorder; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToBorders",
- case 29: bVal = rSwFlags.bCreateTable; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToTable",
- case 30: bVal = rSwFlags.bReplaceStyles; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ReplaceStyle",
- case 31: bVal = rSwFlags.bAFmtByInpDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesAtStartEnd",
- case 32: bVal = rSwFlags.bAFmtByInpDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesBetween",
- case 33: bVal = rSwFlags.bAutoCompleteWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/Enable",
- case 34:
- pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltWordLen;
- break; // "Completion/MinWordLen",
- case 35:
- pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltListLen;
- break; // "Completion/MaxListLen",
- case 36: bVal = rSwFlags.bAutoCmpltCollectWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/CollectWords",
- case 37: bVal = rSwFlags.bAutoCmpltEndless; pValues[nProp].setValue(&bVal, rType); break; // "Completion/EndlessList",
- case 38: bVal = rSwFlags.bAutoCmpltAppendBlanc; pValues[nProp].setValue(&bVal, rType); break; // "Completion/AppendBlank",
- case 39: bVal = rSwFlags.bAutoCmpltShowAsTip; pValues[nProp].setValue(&bVal, rType); break; // "Completion/ShowAsTip",
- case 40:
- pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltExpandKey;
- break; // "Completion/AcceptKey"
- case 41 :bVal = rSwFlags.bAutoCmpltKeepList; pValues[nProp].setValue(&bVal, rType); break;// "Completion/KeepList"
- case 42 :
- pValues[nProp] <<= (sal_Int32)rSwFlags.cByInputBullet;
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
- case 43 :
- pValues[nProp] <<= OUString(rSwFlags.aByInputBulletFont.GetName());
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
- case 44 :
- pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetFamily();
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
- case 45 :
- pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetCharSet();
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
- case 46 :
- pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetPitch();
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
- }
- }
- PutProperties(aNames, aValues);
-}
-
-void SvxSwAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */ )
-{
- Load(sal_False);
-}
-
-namespace
-{
- 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
deleted file mode 100644
index 5ac52a556a..0000000000
--- a/editeng/source/misc/edtdlg.cxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <editeng/edtdlg.hxx>
-
-EditAbstractDialogFactory* EditAbstractDialogFactory::Create()
-{
- return dynamic_cast <EditAbstractDialogFactory*>( VclAbstractDialogFactory::Create() );
-}
-
-EditAbstractDialogFactory::~EditAbstractDialogFactory()
-{
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/misc/forbiddencharacterstable.cxx b/editeng/source/misc/forbiddencharacterstable.cxx
deleted file mode 100644
index 74d3f7a7a5..0000000000
--- a/editeng/source/misc/forbiddencharacterstable.cxx
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <editeng/forbiddencharacterstable.hxx>
-
-#include <unotools/localedatawrapper.hxx>
-#include <editeng/unolingu.hxx>
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, sal_uInt16 nISize, sal_uInt16 nGrow )
- : SvxForbiddenCharactersTableImpl( nISize, nGrow )
-{
- mxMSF = xMSF;
-}
-
-
-SvxForbiddenCharactersTable::~SvxForbiddenCharactersTable()
-{
- for ( sal_uLong n = Count(); n; )
- delete GetObject( --n );
-}
-
-
-
-const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenCharacters( sal_uInt16 nLanguage, sal_Bool bGetDefault ) const
-{
- ForbiddenCharactersInfo* pInf = Get( nLanguage );
- if ( !pInf && bGetDefault && mxMSF.is() )
- {
- const SvxForbiddenCharactersTableImpl *pConstImpl = dynamic_cast<const SvxForbiddenCharactersTableImpl*>(this);
- SvxForbiddenCharactersTableImpl* pImpl = const_cast<SvxForbiddenCharactersTableImpl*>(pConstImpl);
- pInf = new ForbiddenCharactersInfo;
- pImpl->Insert( nLanguage, pInf );
-
- pInf->bTemporary = sal_True;
- LocaleDataWrapper aWrapper( mxMSF, SvxCreateLocale( nLanguage ) );
- pInf->aForbiddenChars = aWrapper.getForbiddenCharacters();
- }
- return pInf ? &pInf->aForbiddenChars : NULL;
-}
-
-
-
-void SvxForbiddenCharactersTable::SetForbiddenCharacters( sal_uInt16 nLanguage, const com::sun::star::i18n::ForbiddenCharacters& rForbiddenChars )
-{
- ForbiddenCharactersInfo* pInf = Get( nLanguage );
- if ( !pInf )
- {
- pInf = new ForbiddenCharactersInfo;
- Insert( nLanguage, pInf );
- }
- pInf->bTemporary = sal_False;
- pInf->aForbiddenChars = rForbiddenChars;
-}
-
-void SvxForbiddenCharactersTable::ClearForbiddenCharacters( sal_uInt16 nLanguage )
-{
- ForbiddenCharactersInfo* pInf = Get( nLanguage );
- if ( pInf )
- {
- Remove( nLanguage );
- delete pInf;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx
deleted file mode 100644
index ba94e00ce6..0000000000
--- a/editeng/source/misc/hangulhanja.cxx
+++ /dev/null
@@ -1,1084 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <editeng/hangulhanja.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/button.hxx>
-#include <unotools/lingucfg.hxx>
-#include <unotools/linguprops.hxx>
-
-#include <set>
-#include <map>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
-#include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/UnicodeScript.hpp>
-#include <com/sun/star/i18n/XTextConversion.hpp>
-#include <com/sun/star/i18n/XExtendedTextConversion.hpp>
-#include <com/sun/star/i18n/TextConversionType.hpp>
-#include <com/sun/star/i18n/TextConversionOption.hpp>
-#include <com/sun/star/i18n/WordType.hpp>
-#include <vcl/stdtext.hxx>
-#include <unotools/charclass.hxx>
-
-#include <editeng/edtdlg.hxx>
-#include <editeng/editrids.hrc>
-#include <editeng/unolingu.hxx>
-
-#define HHC HangulHanjaConversion
-
-//.............................................................................
-namespace editeng
-{
-//.............................................................................
-
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::i18n;
- using namespace ::com::sun::star::i18n::TextConversionOption;
- using namespace ::com::sun::star::i18n::TextConversionType;
- using namespace ::com::sun::star::lang;
-
- class HangulHanjaConversion_Impl
- {
- private:
- typedef ::std::set< ::rtl::OUString, ::std::less< ::rtl::OUString > > StringBag;
- typedef ::std::map< ::rtl::OUString, ::rtl::OUString, ::std::less< ::rtl::OUString > > StringMap;
-
- private:
- StringBag m_sIgnoreList;
- StringMap m_aChangeList;
- static StringMap m_aRecentlyUsedList;
-
- // general
- AbstractHangulHanjaConversionDialog*
- m_pConversionDialog; // the dialog to display for user interaction
- Window* m_pUIParent; // the parent window for any UI we raise
- Reference< XMultiServiceFactory >
- m_xORB; // the service factory to use
- Reference< XTextConversion >
- m_xConverter; // the text conversion service
- Locale m_aSourceLocale; // the locale we're working with
-
- // additions for Chinese simplified / traditional conversion
- HHC::ConversionType m_eConvType; // conversion type (Hangul/Hanja, simplified/traditional Chinese,...)
- LanguageType m_nSourceLang; // just a 'copy' of m_aSourceLocale in order in order to
- // save the applications from always converting to this
- // type in their implementations
- LanguageType m_nTargetLang; // target language of new replacement text
- const Font* m_pTargetFont; // target font of new replacement text
- sal_Int32 m_nConvOptions; // text conversion options (as used by 'getConversions')
- sal_Bool m_bIsInteractive; // specifies if the conversion requires user interaction
- // (and likeley a specialised dialog) or if it is to run
- // automatically without any user interaction.
- // True for Hangul / Hanja conversion
- // False for Chinese simlified / traditional conversion
-
- HangulHanjaConversion* m_pAntiImpl; // our "anti-impl" instance
-
- // options
- sal_Bool m_bByCharacter; // are we in "by character" mode currently?
- HHC::ConversionFormat m_eConversionFormat; // the current format for the conversion
- HHC::ConversionDirection m_ePrimaryConversionDirection; // the primary conversion direction
- HHC::ConversionDirection m_eCurrentConversionDirection; // the primary conversion direction
-
- //options from Hangul/Hanja Options dialog (also saved to configuration)
- bool m_bIgnorePostPositionalWord;
- bool m_bShowRecentlyUsedFirst;
- bool m_bAutoReplaceUnique;
-
- // state
- ::rtl::OUString m_sCurrentPortion; // the text which we are currently working on
- LanguageType m_nCurrentPortionLang; // language of m_sCurrentPortion found
- sal_Int32 m_nCurrentStartIndex; // the start index within m_sCurrentPortion of the current convertible portion
- sal_Int32 m_nCurrentEndIndex; // the end index (excluding) within m_sCurrentPortion of the current convertible portion
- sal_Int32 m_nReplacementBaseIndex;// index which ReplaceUnit-calls need to be relative to
- sal_Int32 m_nCurrentConversionOption;
- sal_Int16 m_nCurrentConversionType;
- Sequence< ::rtl::OUString >
- m_aCurrentSuggestions; // the suggestions for the current unit
- // (means for the text [m_nCurrentStartIndex, m_nCurrentEndIndex) in m_sCurrentPortion)
- sal_Bool m_bTryBothDirections; // specifies if other conversion directions should be tried when looking for convertible characters
-
-
- public:
- HangulHanjaConversion_Impl(
- Window* _pUIParent,
- const Reference< XMultiServiceFactory >& _rxORB,
- const Locale& _rSourceLocale,
- const Locale& _rTargetLocale,
- const Font* _pTargetFont,
- sal_Int32 _nConvOptions,
- sal_Bool _bIsInteractive,
- HangulHanjaConversion* _pAntiImpl );
-
- public:
-
- static void SetUseSavedConversionDirectionState( sal_Bool bVal );
-
- void DoDocumentConversion( );
-
- inline sal_Bool IsByCharacter( ) const { return m_bByCharacter; }
-
- inline sal_Bool IsValid() const { return m_xConverter.is(); }
-
- inline LanguageType GetSourceLang() const { return m_nSourceLang; }
- inline LanguageType GetTargetLang() const { return m_nTargetLang; }
- inline const Font * GetTargetFont() const { return m_pTargetFont; }
- inline sal_Int32 GetConvOptions() const { return m_nConvOptions; }
- inline sal_Bool IsInteractive() const { return m_bIsInteractive; }
-
- protected:
- void createDialog();
-
- /** continue with the conversion, return <TRUE/> if and only if the complete conversion is done
- @param _bRepeatCurrentUnit
- if <TRUE/>, an implNextConvertible will be called initially to advance to the next convertible.
- if <FALSE/>, the method will initially work with the current convertible unit
- */
- sal_Bool ContinueConversion( bool _bRepeatCurrentUnit );
-
- private:
- DECL_LINK( OnOptionsChanged, void* );
- DECL_LINK( OnIgnore, void* );
- DECL_LINK( OnIgnoreAll, void* );
- DECL_LINK( OnChange, void* );
- DECL_LINK( OnChangeAll, void* );
- DECL_LINK( OnByCharClicked, CheckBox* );
- DECL_LINK( OnConversionTypeChanged, void* );
- DECL_LINK( OnFind, void* );
-
- /** proceed, after the current convertible has been handled
-
- <p><b>Attention:</b>
- When returning from this method, the dialog may have been deleted!</p>
-
- @param _bRepeatCurrentUnit
- will be passed to the <member>ContinueConversion</member> call
- */
- void implProceed( bool _bRepeatCurrentUnit );
-
- // change the current convertible, and do _not_ proceed
- void implChange( const ::rtl::OUString& _rChangeInto );
-
- /** find the next convertible piece of text, with possibly advancing to the next portion
-
- @see HangulHanjaConversion::GetNextPortion
- */
- sal_Bool implNextConvertible( bool _bRepeatUnit );
-
- /** find the next convertible unit within the current portion
- @param _bRepeatUnit
- if <TRUE/>, the search will start at the beginning of the current unit,
- if <FALSE/>, it will start at the end of the current unit
- */
- bool implNextConvertibleUnit( const sal_Int32 _nStartAt );
-
- /** retrieves the next portion, with setting the index members properly
- @return
- <TRUE/> if and only if there is a next portion
- */
- bool implRetrieveNextPortion( );
-
- /** determine the ConversionDirection for m_sCurrentPortion
- @return
- <FALSE/> if and only if something went wrong
- */
- bool implGetConversionDirectionForCurrentPortion( HHC::ConversionDirection& rDirection );
-
- /** member m_aCurrentSuggestions and m_nCurrentEndIndex are updated according to the other settings and current dictionaries
-
- if _bAllowSearchNextConvertibleText is true _nStartAt is used as starting point to search the next
- convertible text portion. This may result in changing of the member m_nCurrentStartIndex additionally.
-
- @return
- <TRUE/> if Suggestions were found
- */
- bool implUpdateSuggestions( const bool _bAllowSearchNextConvertibleText=false, const sal_Int32 _nStartAt=-1 );
-
- /** reads the options from Hangul/Hanja Options dialog that are saved to configuration
- */
- void implReadOptionsFromConfiguration();
-
- /** get the string currently considered to be replaced or ignored
- */
- ::rtl::OUString GetCurrentUnit() const;
-
- /** read options from configuration, update suggestion list and dialog content
- */
- void implUpdateData();
-
- /** get the conversion direction dependent from m_eConvType and m_eCurrentConversionDirection
- in case of switching the direction is allowed this can be triggered with parameter bSwitchDirection
- */
- sal_Int16 implGetConversionType( bool bSwitchDirection=false ) const;
- };
-
- HangulHanjaConversion_Impl::StringMap HangulHanjaConversion_Impl::m_aRecentlyUsedList = HangulHanjaConversion_Impl::StringMap();
-
- HangulHanjaConversion_Impl::HangulHanjaConversion_Impl( Window* _pUIParent,
- const Reference< XMultiServiceFactory >& _rxORB,
- const Locale& _rSourceLocale,
- const Locale& _rTargetLocale,
- const Font* _pTargetFont,
- sal_Int32 _nOptions,
- sal_Bool _bIsInteractive,
- HangulHanjaConversion* _pAntiImpl )
-: m_pConversionDialog( NULL )
-, m_pUIParent( _pUIParent )
-, m_xORB( _rxORB )
-, m_aSourceLocale( _rSourceLocale )
-, m_nSourceLang( SvxLocaleToLanguage( _rSourceLocale ) )
-, m_nTargetLang( SvxLocaleToLanguage( _rTargetLocale ) )
-, m_pTargetFont( _pTargetFont )
-, m_bIsInteractive( _bIsInteractive )
-, m_pAntiImpl( _pAntiImpl )
-, m_nCurrentPortionLang( LANGUAGE_NONE )
-, m_nCurrentStartIndex( 0 )
-, m_nCurrentEndIndex( 0 )
-, m_nReplacementBaseIndex( 0 )
-, m_nCurrentConversionOption( TextConversionOption::NONE )
-, m_nCurrentConversionType( -1 ) // not yet known
-, m_bTryBothDirections( sal_True )
- {
- implReadOptionsFromConfiguration();
-
- DBG_ASSERT( m_xORB.is(), "HangulHanjaConversion_Impl::HangulHanjaConversion_Impl: no ORB!" );
-
- // determine conversion type
- if (m_nSourceLang == LANGUAGE_KOREAN && m_nTargetLang == LANGUAGE_KOREAN)
- m_eConvType = HHC::eConvHangulHanja;
- else if ( (m_nSourceLang == LANGUAGE_CHINESE_TRADITIONAL && m_nTargetLang == LANGUAGE_CHINESE_SIMPLIFIED) ||
- (m_nSourceLang == LANGUAGE_CHINESE_SIMPLIFIED && m_nTargetLang == LANGUAGE_CHINESE_TRADITIONAL) )
- m_eConvType = HHC::eConvSimplifiedTraditional;
- else
- {
- OSL_FAIL( "failed to determine conversion type from languages" );
- }
-
- // set remaining conversion parameters to their default values
- m_nConvOptions = _nOptions;
- m_bByCharacter = 0 != (_nOptions & CHARACTER_BY_CHARACTER);
- m_eConversionFormat = HHC::eSimpleConversion;
- m_ePrimaryConversionDirection = HHC::eHangulToHanja; // used for eConvHangulHanja
- m_eCurrentConversionDirection = HHC::eHangulToHanja; // used for eConvHangulHanja
-
- if ( m_xORB.is() )
- {
- ::rtl::OUString sTextConversionService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.TextConversion" ) );
- m_xConverter = m_xConverter.query( m_xORB->createInstance( sTextConversionService ) );
- if ( !m_xConverter.is() )
- ShowServiceNotAvailableError( m_pUIParent, sTextConversionService, sal_True );
- }
-
- }
-
- void HangulHanjaConversion_Impl::createDialog()
- {
- DBG_ASSERT( m_bIsInteractive, "createDialog when the conversion should not be interactive?" );
- if ( m_bIsInteractive && !m_pConversionDialog )
- {
- EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
- if(pFact)
- {
- m_pConversionDialog = pFact->CreateHangulHanjaConversionDialog(m_pUIParent, m_ePrimaryConversionDirection );
- DBG_ASSERT(m_pConversionDialog, "Dialogdiet fail!");
-
- m_pConversionDialog->EnableRubySupport( m_pAntiImpl->HasRubySupport() );
-
- m_pConversionDialog->SetByCharacter( m_bByCharacter );
- m_pConversionDialog->SetConversionFormat( m_eConversionFormat );
- m_pConversionDialog->SetConversionDirectionState( m_bTryBothDirections, m_ePrimaryConversionDirection );
-
- // the handlers
- m_pConversionDialog->SetOptionsChangedHdl( LINK( this, HangulHanjaConversion_Impl, OnOptionsChanged ) );
- m_pConversionDialog->SetIgnoreHdl( LINK( this, HangulHanjaConversion_Impl, OnIgnore ) );
- m_pConversionDialog->SetIgnoreAllHdl( LINK( this, HangulHanjaConversion_Impl, OnIgnoreAll ) );
- m_pConversionDialog->SetChangeHdl( LINK( this, HangulHanjaConversion_Impl, OnChange ) );
- m_pConversionDialog->SetChangeAllHdl( LINK( this, HangulHanjaConversion_Impl, OnChangeAll ) );
- m_pConversionDialog->SetClickByCharacterHdl( LINK( this, HangulHanjaConversion_Impl, OnByCharClicked ) );
- m_pConversionDialog->SetConversionFormatChangedHdl( LINK( this, HangulHanjaConversion_Impl, OnConversionTypeChanged ) );
- m_pConversionDialog->SetFindHdl( LINK( this, HangulHanjaConversion_Impl, OnFind ) );
- }
- }
- }
-
- sal_Int16 HangulHanjaConversion_Impl::implGetConversionType( bool bSwitchDirection ) const
- {
- sal_Int16 nConversionType = -1;
- if (m_eConvType == HHC::eConvHangulHanja)
- nConversionType = HHC::eHangulToHanja == ( m_eCurrentConversionDirection && !bSwitchDirection ) ? TO_HANJA : TO_HANGUL;
- else if (m_eConvType == HHC::eConvSimplifiedTraditional)
- nConversionType = LANGUAGE_CHINESE_SIMPLIFIED == m_nTargetLang ? TO_SCHINESE : TO_TCHINESE;
- DBG_ASSERT( nConversionType != -1, "unexpected conversion type" );
- return nConversionType;
- }
-
- bool HangulHanjaConversion_Impl::implUpdateSuggestions( bool _bAllowSearchNextConvertibleText, const sal_Int32 _nStartAt )
- {
- // parameters for the converter
- sal_Int32 nStartSearch = m_nCurrentStartIndex;
- if( _bAllowSearchNextConvertibleText )
- nStartSearch = _nStartAt;
-
- sal_Int32 nLength = m_sCurrentPortion.getLength() - nStartSearch;
- m_nCurrentConversionType = implGetConversionType();
- m_nCurrentConversionOption = IsByCharacter() ? CHARACTER_BY_CHARACTER : NONE;
- if( m_bIgnorePostPositionalWord )
- m_nCurrentConversionOption = m_nCurrentConversionOption | IGNORE_POST_POSITIONAL_WORD;
-
- // no need to check both directions for chinese conversion (saves time)
- if (m_eConvType == HHC::eConvSimplifiedTraditional)
- m_bTryBothDirections = sal_False;
-
- sal_Bool bFoundAny = sal_True;
- try
- {
- TextConversionResult aResult = m_xConverter->getConversions(
- m_sCurrentPortion,
- nStartSearch,
- nLength,
- m_aSourceLocale,
- m_nCurrentConversionType,
- m_nCurrentConversionOption
- );
- sal_Bool bFoundPrimary = aResult.Boundary.startPos < aResult.Boundary.endPos;
- bFoundAny = bFoundPrimary;
-
- if ( m_bTryBothDirections )
- { // see if we find another convertible when assuming the other direction
- TextConversionResult aSecondResult = m_xConverter->getConversions(
- m_sCurrentPortion,
- nStartSearch,
- nLength,
- m_aSourceLocale,
- implGetConversionType( true ), // switched!
- m_nCurrentConversionOption
- );
- if ( aSecondResult.Boundary.startPos < aSecondResult.Boundary.endPos )
- { // we indeed found such a convertible
-
- // in case the first attempt (with the original conversion direction)
- // didn't find anything
- if ( !bFoundPrimary
- // or if the second location is _before_ the first one
- || ( aSecondResult.Boundary.startPos < aResult.Boundary.startPos )
- )
- {
- // then use the second finding
- aResult = aSecondResult;
-
- // our current conversion direction changed now
- m_eCurrentConversionDirection = ( HHC::eHangulToHanja == m_eCurrentConversionDirection )
- ? HHC::eHanjaToHangul : HHC::eHangulToHanja;
- bFoundAny = sal_True;
- }
- }
- }
-
- if( _bAllowSearchNextConvertibleText )
- {
- //this might change the current position
- m_aCurrentSuggestions = aResult.Candidates;
- m_nCurrentStartIndex = aResult.Boundary.startPos;
- m_nCurrentEndIndex = aResult.Boundary.endPos;
- }
- else
- {
- //the change of starting position is not allowed
- if( m_nCurrentStartIndex == aResult.Boundary.startPos
- && aResult.Boundary.endPos != aResult.Boundary.startPos )
- {
- m_aCurrentSuggestions = aResult.Candidates;
- m_nCurrentEndIndex = aResult.Boundary.endPos;
- }
- else
- {
- m_aCurrentSuggestions.realloc( 0 );
- if( m_sCurrentPortion.getLength() >= m_nCurrentStartIndex+1 )
- m_nCurrentEndIndex = m_nCurrentStartIndex+1;
- }
- }
-
- //put recently used string to front:
- if( m_bShowRecentlyUsedFirst && m_aCurrentSuggestions.getLength()>1 )
- {
- ::rtl::OUString sCurrentUnit( GetCurrentUnit() );
- StringMap::const_iterator aRecentlyUsed = m_aRecentlyUsedList.find( sCurrentUnit );
- bool bUsedBefore = aRecentlyUsed != m_aRecentlyUsedList.end();
- if( bUsedBefore && m_aCurrentSuggestions[0] != aRecentlyUsed->second )
- {
- sal_Int32 nCount = m_aCurrentSuggestions.getLength();
- Sequence< ::rtl::OUString > aTmp(nCount);
- aTmp[0]=aRecentlyUsed->second;
- sal_Int32 nDiff = 1;
- for( sal_Int32 n=1; n<nCount; n++)//we had 0 already
- {
- if( nDiff && m_aCurrentSuggestions[n-nDiff]==aRecentlyUsed->second )
- nDiff=0;
- aTmp[n]=m_aCurrentSuggestions[n-nDiff];
- }
- m_aCurrentSuggestions = aTmp;
- }
- }
- }
- catch( const 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...
- return false;
- }
- return bFoundAny;
- }
-
- bool HangulHanjaConversion_Impl::implNextConvertibleUnit( const sal_Int32 _nStartAt )
- {
- m_aCurrentSuggestions.realloc( 0 );
-
- // ask the TextConversion service for the next convertible piece of text
-
- // get current values from dialog
- if( m_eConvType == HHC::eConvHangulHanja && m_pConversionDialog )
- {
- m_bTryBothDirections = m_pConversionDialog->GetUseBothDirections();
- HHC::ConversionDirection eDialogDirection = HHC::eHangulToHanja;
- eDialogDirection = m_pConversionDialog->GetDirection( eDialogDirection );
-
- if( !m_bTryBothDirections && eDialogDirection != m_eCurrentConversionDirection )
- {
- m_eCurrentConversionDirection = eDialogDirection;
- }
-
- // save curently used value for possible later use
- m_pAntiImpl->m_bTryBothDirectionsSave = m_bTryBothDirections;
- m_pAntiImpl->m_ePrimaryConversionDirectionSave = m_eCurrentConversionDirection;
- }
-
- bool bFoundAny = implUpdateSuggestions( true, _nStartAt );
-
- return bFoundAny &&
- (m_nCurrentStartIndex < m_sCurrentPortion.getLength());
- }
-
- bool HangulHanjaConversion_Impl::implRetrieveNextPortion( )
- {
- sal_Bool bAllowImplicitChanges = m_eConvType == HHC::eConvSimplifiedTraditional;
-
- m_sCurrentPortion = ::rtl::OUString();
- m_nCurrentPortionLang = LANGUAGE_NONE;
- m_pAntiImpl->GetNextPortion( m_sCurrentPortion, m_nCurrentPortionLang, bAllowImplicitChanges );
- m_nReplacementBaseIndex = 0;
- m_nCurrentStartIndex = m_nCurrentEndIndex = 0;
-
- bool bRet = 0 != m_sCurrentPortion.getLength();
-
- if (m_eConvType == HHC::eConvHangulHanja && m_bTryBothDirections)
- implGetConversionDirectionForCurrentPortion( m_eCurrentConversionDirection );
-
- return bRet;
- }
-
- sal_Bool HangulHanjaConversion_Impl::implNextConvertible( bool _bRepeatUnit )
- {
- if ( _bRepeatUnit || ( m_nCurrentEndIndex < m_sCurrentPortion.getLength() ) )
- {
- if ( implNextConvertibleUnit(
- _bRepeatUnit
- ? ( IsByCharacter() ? m_nCurrentStartIndex : m_nCurrentStartIndex )
- : m_nCurrentEndIndex
- ) )
- return sal_True;
- }
-
- // no convertible text in the current portion anymore
- // -> advance to the next portion
- do
- {
- // next portion
- if ( implRetrieveNextPortion( ) )
- { // there is a next portion
- // -> find the next convertible unit in the current portion
- if ( implNextConvertibleUnit( 0 ) )
- return sal_True;
- }
- }
- while ( m_sCurrentPortion.getLength() );
-
- // no more portions
- return sal_False;
- }
-
- ::rtl::OUString HangulHanjaConversion_Impl::GetCurrentUnit() const
- {
- DBG_ASSERT( m_nCurrentStartIndex < m_sCurrentPortion.getLength(),
- "HangulHanjaConversion_Impl::GetCurrentUnit: invalid index into current portion!" );
- DBG_ASSERT( m_nCurrentEndIndex <= m_sCurrentPortion.getLength(),
- "HangulHanjaConversion_Impl::GetCurrentUnit: invalid index into current portion!" );
- DBG_ASSERT( m_nCurrentStartIndex <= m_nCurrentEndIndex,
- "HangulHanjaConversion_Impl::GetCurrentUnit: invalid interval!" );
-
- ::rtl::OUString sCurrentUnit = m_sCurrentPortion.copy( m_nCurrentStartIndex, m_nCurrentEndIndex - m_nCurrentStartIndex );
- return sCurrentUnit;
- }
-
- sal_Bool HangulHanjaConversion_Impl::ContinueConversion( bool _bRepeatCurrentUnit )
- {
- sal_Bool bNeedUserInteraction = sal_False; // when we leave here, do we need user interaction?
- sal_Bool bDocumentDone = sal_False; // did we already check the whole document?
-
- while ( !bDocumentDone && !bNeedUserInteraction && implNextConvertible( _bRepeatCurrentUnit ) )
- {
- ::rtl::OUString sCurrentUnit( GetCurrentUnit() );
-
- // do we need to ignore it?
- sal_Bool bAlwaysIgnoreThis = m_sIgnoreList.end() != m_sIgnoreList.find( sCurrentUnit );
-
- // do we need to change it?
- StringMap::const_iterator aChangeListPos = m_aChangeList.find( sCurrentUnit );
- sal_Bool bAlwaysChangeThis = m_aChangeList.end() != aChangeListPos;
-
- // do we automatically change this?
- sal_Bool bAutoChange = m_bAutoReplaceUnique && m_aCurrentSuggestions.getLength() == 1;
-
- if (!m_bIsInteractive)
- {
- // silent conversion (e.g. for simplified/traditional Chinese)...
- if(m_aCurrentSuggestions.getLength()>0)
- implChange( m_aCurrentSuggestions.getConstArray()[0] );
- }
- else if (bAutoChange)
- {
- implChange( m_aCurrentSuggestions.getConstArray()[0] );
- }
- else if ( bAlwaysChangeThis )
- {
- implChange( aChangeListPos->second );
- }
- else if ( !bAlwaysIgnoreThis )
- {
- // here we need to ask the user for what to do with the text
- // for this, allow derivees to highlight the current text unit in a possible document view
- m_pAntiImpl->HandleNewUnit( m_nCurrentStartIndex - m_nReplacementBaseIndex, m_nCurrentEndIndex - m_nReplacementBaseIndex );
-
- DBG_ASSERT( m_pConversionDialog, "we should always have a dialog here!" );
- if( m_pConversionDialog )
- m_pConversionDialog->SetCurrentString( sCurrentUnit, m_aCurrentSuggestions );
-
- // do not look for the next convertible: We have to wait for the user to interactivly
- // decide what happens with the current convertible
- bNeedUserInteraction = sal_True;
- }
- }
-
- return bDocumentDone || !bNeedUserInteraction;
- }
-
- bool HangulHanjaConversion_Impl::implGetConversionDirectionForCurrentPortion( HHC::ConversionDirection& rDirection )
- {
- // - For eConvHangulHanja the direction is determined by
- // the first encountered Korean character.
- // - For eConvSimplifiedTraditional the conversion direction
- // is already specified by the source language.
-
- bool bSuccess = true;
-
- if (m_eConvType == HHC::eConvHangulHanja)
- {
- bSuccess = false;
- try
- {
- // get the break iterator service
- ::rtl::OUString sBreakIteratorService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.BreakIterator" ) );
- Reference< XInterface > xBI( m_xORB->createInstance( ::rtl::OUString( sBreakIteratorService ) ) );
- Reference< XBreakIterator > xBreakIter( xBI, UNO_QUERY );
- if ( !xBreakIter.is() )
- {
- ShowServiceNotAvailableError( m_pUIParent, sBreakIteratorService, sal_True );
- }
- else
- {
- sal_Int32 nNextAsianScript = xBreakIter->beginOfScript( m_sCurrentPortion, m_nCurrentStartIndex, com::sun::star::i18n::ScriptType::ASIAN );
- if ( -1 == nNextAsianScript )
- nNextAsianScript = xBreakIter->nextScript( m_sCurrentPortion, m_nCurrentStartIndex, com::sun::star::i18n::ScriptType::ASIAN );
- if ( ( nNextAsianScript >= m_nCurrentStartIndex ) && ( nNextAsianScript < m_sCurrentPortion.getLength() ) )
- { // found asian text
-
- // determine if it's Hangul
- CharClass aCharClassificaton( m_xORB, m_aSourceLocale );
- sal_Int16 nScript = aCharClassificaton.getScript( m_sCurrentPortion, sal::static_int_cast< sal_uInt16 >(nNextAsianScript) );
- if ( ( UnicodeScript_kHangulJamo == nScript )
- || ( UnicodeScript_kHangulCompatibilityJamo == nScript )
- || ( UnicodeScript_kHangulSyllable == nScript )
- )
- {
- rDirection = HHC::eHangulToHanja;
- }
- else
- {
- rDirection = HHC::eHanjaToHangul;
- }
-
- bSuccess = true;
- }
- }
- }
- catch( const 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
- {
- StringMap aEmpty;
- m_aChangeList.swap( aEmpty );
- }
-
- // first of all, we need to guess the direction of our conversion - it is determined by the first
- // hangul or hanja character in the first text
- if ( !implRetrieveNextPortion() )
- {
- DBG_WARNING( "HangulHanjaConversion_Impl::DoDocumentConversion: why did you call me if you do have nothing to convert?" );
- // nothing to do
- return;
- }
- if( m_eConvType == HHC::eConvHangulHanja )
- {
- //init conversion direction from saved value
- HHC::ConversionDirection eDirection = HHC::eHangulToHanja;
- if(!implGetConversionDirectionForCurrentPortion( eDirection ))
- // something went wrong, has already been asserted
- return;
-
- if (m_pAntiImpl->IsUseSavedConversionDirectionState())
- {
- m_ePrimaryConversionDirection = m_pAntiImpl->m_ePrimaryConversionDirectionSave;
- m_bTryBothDirections = m_pAntiImpl->m_bTryBothDirectionsSave;
- if( m_bTryBothDirections )
- m_eCurrentConversionDirection = eDirection;
- else
- m_eCurrentConversionDirection = m_ePrimaryConversionDirection;
- }
- else
- {
- m_ePrimaryConversionDirection = eDirection;
- m_eCurrentConversionDirection = eDirection;
- }
- }
-
- if (m_bIsInteractive && m_eConvType == HHC::eConvHangulHanja)
- {
- //always open dialog if at least having a hangul or hanja text portion
- createDialog();
- if(m_pAntiImpl->IsUseSavedConversionDirectionState())
- ContinueConversion( sal_False );
- else
- implUpdateData();
- m_pConversionDialog->Execute();
- DELETEZ( m_pConversionDialog );
- }
- else
- {
-#ifdef DBG_UTIL
- sal_Bool bCompletelyDone =
-#endif
- ContinueConversion( sal_False );
- DBG_ASSERT( bCompletelyDone, "HangulHanjaConversion_Impl::DoDocumentConversion: ContinueConversion should have returned true here!" );
- }
- }
-
- void HangulHanjaConversion_Impl::implProceed( bool _bRepeatCurrentUnit )
- {
- if ( ContinueConversion( _bRepeatCurrentUnit ) )
- { // we're done with the whole document
- DBG_ASSERT( !m_bIsInteractive || m_pConversionDialog, "HangulHanjaConversion_Impl::implProceed: we should not reach this here without dialog!" );
- if ( m_pConversionDialog )
- m_pConversionDialog->EndDialog( RET_OK );
- }
- }
-
- void HangulHanjaConversion_Impl::implChange( const ::rtl::OUString& _rChangeInto )
- {
- if( !_rChangeInto.getLength() )
- return;
-
- // translate the conversion format into a replacement action
- // this translation depends on whether we have a Hangul original, or a Hanja original
-
- HHC::ReplacementAction eAction( HHC::eExchange );
-
- if (m_eConvType == HHC::eConvHangulHanja)
- {
- // is the original we're about to change in Hangul?
- sal_Bool bOriginalIsHangul = HHC::eHangulToHanja == m_eCurrentConversionDirection;
-
- switch ( m_eConversionFormat )
- {
- case HHC::eSimpleConversion: eAction = HHC::eExchange; break;
- case HHC::eHangulBracketed: eAction = bOriginalIsHangul ? HHC::eOriginalBracketed : HHC::eReplacementBracketed; break;
- case HHC::eHanjaBracketed: eAction = bOriginalIsHangul ? HHC::eReplacementBracketed : HHC::eOriginalBracketed; break;
- case HHC::eRubyHanjaAbove: eAction = bOriginalIsHangul ? HHC::eReplacementAbove : HHC::eOriginalAbove; break;
- case HHC::eRubyHanjaBelow: eAction = bOriginalIsHangul ? HHC::eReplacementBelow : HHC::eOriginalBelow; break;
- case HHC::eRubyHangulAbove: eAction = bOriginalIsHangul ? HHC::eOriginalAbove : HHC::eReplacementAbove; break;
- case HHC::eRubyHangulBelow: eAction = bOriginalIsHangul ? HHC::eOriginalBelow : HHC::eReplacementBelow; break;
- default:
- OSL_FAIL( "HangulHanjaConversion_Impl::implChange: invalid/unexpected conversion format!" );
- }
- }
-
- // the proper indicies (the wrapper implementation needs indicies relative to the
- // previous replacement)
- DBG_ASSERT( ( m_nReplacementBaseIndex <= m_nCurrentStartIndex ) && ( m_nReplacementBaseIndex <= m_nCurrentEndIndex ),
- "HangulHanjaConversion_Impl::implChange: invalid replacement base!" );
-
- sal_Int32 nStartIndex = m_nCurrentStartIndex - m_nReplacementBaseIndex;
- sal_Int32 nEndIndex = m_nCurrentEndIndex - m_nReplacementBaseIndex;
-
- //remind this decision
- m_aRecentlyUsedList[ GetCurrentUnit() ] = _rChangeInto;
-
- LanguageType *pNewUnitLang = 0;
- LanguageType nNewUnitLang = LANGUAGE_NONE;
- if (m_eConvType == HHC::eConvSimplifiedTraditional)
- {
- // check if language needs to be changed
- if ( m_pAntiImpl->GetTargetLanguage() == LANGUAGE_CHINESE_TRADITIONAL &&
- !m_pAntiImpl->IsTraditional( m_nCurrentPortionLang ))
- nNewUnitLang = LANGUAGE_CHINESE_TRADITIONAL;
- else if ( m_pAntiImpl->GetTargetLanguage() == LANGUAGE_CHINESE_SIMPLIFIED &&
- !m_pAntiImpl->IsSimplified( m_nCurrentPortionLang ))
- nNewUnitLang = LANGUAGE_CHINESE_SIMPLIFIED;
- if (nNewUnitLang != LANGUAGE_NONE)
- pNewUnitLang = &nNewUnitLang;
- }
-
- // according to FT we should not (yet) bother about Hangul/Hanja conversion here
- //
- // aOffsets is needed in ReplaceUnit below in order to to find out
- // exactly which characters are really changed in order to keep as much
- // from attributation for the text as possible.
- Sequence< sal_Int32 > aOffsets;
- Reference< XExtendedTextConversion > xExtConverter( m_xConverter, UNO_QUERY );
- if (m_eConvType == HHC::eConvSimplifiedTraditional && xExtConverter.is())
- {
- try
- {
- ::rtl::OUString aConvText = xExtConverter->getConversionWithOffset(
- m_sCurrentPortion,
- m_nCurrentStartIndex,
- m_nCurrentEndIndex - m_nCurrentStartIndex,
- m_aSourceLocale,
- m_nCurrentConversionType,
- m_nCurrentConversionOption,
- aOffsets
- );
- }
- catch( const Exception& )
- {
- OSL_FAIL( "HangulHanjaConversion_Impl::implChange: caught unexpected exception!" );
- aOffsets.realloc(0);
- }
- }
-
- // do the replacement
- m_pAntiImpl->ReplaceUnit( nStartIndex, nEndIndex, m_sCurrentPortion,
- _rChangeInto, aOffsets, eAction, pNewUnitLang );
-
-
- // adjust the replacement base
- m_nReplacementBaseIndex = m_nCurrentEndIndex;
- }
-
- void HangulHanjaConversion_Impl::implReadOptionsFromConfiguration()
- {
- SvtLinguConfig aLngCfg;
- aLngCfg.GetProperty( UPH_IS_IGNORE_POST_POSITIONAL_WORD ) >>= m_bIgnorePostPositionalWord;
- aLngCfg.GetProperty( UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST ) >>= m_bShowRecentlyUsedFirst;
- aLngCfg.GetProperty( UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES ) >>= m_bAutoReplaceUnique;
- }
-
- void HangulHanjaConversion_Impl::implUpdateData()
- {
- implReadOptionsFromConfiguration();
- implUpdateSuggestions();
-
- if(m_pConversionDialog)
- {
- ::rtl::OUString sCurrentUnit( GetCurrentUnit() );
-
- m_pConversionDialog->SetCurrentString( sCurrentUnit, m_aCurrentSuggestions );
- m_pConversionDialog->FocusSuggestion();
- }
-
- 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
- //-> update our internal settings and the dialog
- implUpdateData();
-
- return 0L;
- }
-
- IMPL_LINK( HangulHanjaConversion_Impl, OnIgnore, void*, EMPTYARG )
- {
- // simply ignore, and proceed
- implProceed( sal_False );
- return 0L;
- }
-
- IMPL_LINK( HangulHanjaConversion_Impl, OnIgnoreAll, void*, EMPTYARG )
- {
- DBG_ASSERT( m_pConversionDialog, "HangulHanjaConversion_Impl::OnIgnoreAll: no dialog! How this?" );
-
- if ( m_pConversionDialog )
- {
- String sCurrentUnit = m_pConversionDialog->GetCurrentString();
- DBG_ASSERT( m_sIgnoreList.end() == m_sIgnoreList.find( sCurrentUnit ),
- "HangulHanjaConversion_Impl, OnIgnoreAll: shouldn't this have been ignored before" );
-
- // put into the "ignore all" list
- m_sIgnoreList.insert( sCurrentUnit );
-
- // and proceed
- implProceed( sal_False );
- }
-
- return 0L;
- }
-
- IMPL_LINK( HangulHanjaConversion_Impl, OnChange, void*, EMPTYARG )
- {
- // change
- DBG_ASSERT( m_pConversionDialog, "we should always have a dialog here!" );
- if( m_pConversionDialog )
- implChange( m_pConversionDialog->GetCurrentSuggestion( ) );
- // and proceed
- implProceed( sal_False );
-
- return 0L;
- }
-
- IMPL_LINK( HangulHanjaConversion_Impl, OnChangeAll, void*, EMPTYARG )
- {
- DBG_ASSERT( m_pConversionDialog, "HangulHanjaConversion_Impl::OnChangeAll: no dialog! How this?" );
- if ( m_pConversionDialog )
- {
- ::rtl::OUString sCurrentUnit( m_pConversionDialog->GetCurrentString() );
- ::rtl::OUString sChangeInto( m_pConversionDialog->GetCurrentSuggestion( ) );
-
- if( sChangeInto.getLength() )
- {
- // change the current occurrence
- implChange( sChangeInto );
-
- // put into the "change all" list
- m_aChangeList.insert( StringMap::value_type( sCurrentUnit, sChangeInto ) );
- }
-
- // and proceed
- implProceed( sal_False );
- }
-
- return 0L;
- }
-
- IMPL_LINK( HangulHanjaConversion_Impl, OnByCharClicked, CheckBox*, _pBox )
- {
- m_bByCharacter = _pBox->IsChecked();
-
- // continue conversion, without advancing to the next unit, but instead continuing with the current unit
- implProceed( sal_True );
- return 0L;
- }
-
- IMPL_LINK( HangulHanjaConversion_Impl, OnConversionTypeChanged, void*, EMPTYARG )
- {
- DBG_ASSERT( m_pConversionDialog, "we should always have a dialog here!" );
- if( m_pConversionDialog )
- m_eConversionFormat = m_pConversionDialog->GetConversionFormat( );
- return 0L;
- }
-
- IMPL_LINK( HangulHanjaConversion_Impl, OnFind, void*, EMPTYARG )
- {
- DBG_ASSERT( m_pConversionDialog, "HangulHanjaConversion_Impl::OnFind: where did this come from?" );
- if ( m_pConversionDialog )
- {
- try
- {
- ::rtl::OUString sNewOriginal( m_pConversionDialog->GetCurrentSuggestion( ) );
- Sequence< ::rtl::OUString > aSuggestions;
-
- DBG_ASSERT( m_xConverter.is(), "HangulHanjaConversion_Impl::OnFind: no converter!" );
- TextConversionResult aToHanja = m_xConverter->getConversions(
- sNewOriginal,
- 0, sNewOriginal.getLength(),
- m_aSourceLocale,
- TextConversionType::TO_HANJA,
- TextConversionOption::NONE
- );
- TextConversionResult aToHangul = m_xConverter->getConversions(
- sNewOriginal,
- 0, sNewOriginal.getLength(),
- m_aSourceLocale,
- TextConversionType::TO_HANGUL,
- TextConversionOption::NONE
- );
-
- bool bHaveToHanja = ( aToHanja.Boundary.startPos < aToHanja.Boundary.endPos );
- bool bHaveToHangul = ( aToHangul.Boundary.startPos < aToHangul.Boundary.endPos );
-
- TextConversionResult* pResult = NULL;
- if ( bHaveToHanja && bHaveToHangul )
- { // it found convertibles in both directions -> use the first
- if ( aToHangul.Boundary.startPos < aToHanja.Boundary.startPos )
- pResult = &aToHangul;
- else
- pResult = &aToHanja;
- }
- else if ( bHaveToHanja )
- { // only found toHanja
- pResult = &aToHanja;
- }
- else
- { // only found toHangul
- pResult = &aToHangul;
- }
- if ( pResult )
- aSuggestions = pResult->Candidates;
-
- m_pConversionDialog->SetCurrentString( sNewOriginal, aSuggestions, false );
- m_pConversionDialog->FocusSuggestion();
- }
- catch( const Exception& )
- {
- OSL_FAIL( "HangulHanjaConversion_Impl::OnFind: caught an exception!" );
- }
- }
- return 0L;
- }
-
- 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,
- const Font* _pTargetFont,
- sal_Int32 _nOptions, sal_Bool _bIsInteractive)
- :m_pImpl( new HangulHanjaConversion_Impl( _pUIParent, _rxORB, _rSourceLocale, _rTargetLocale, _pTargetFont, _nOptions, _bIsInteractive, this ) )
- {
- }
-
- 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 )
- {
- OSL_FAIL( "HangulHanjaConversion::GetNextPortion: to be overridden!" );
- }
-
- void HangulHanjaConversion::ReplaceUnit(
- const sal_Int32, const sal_Int32,
- const ::rtl::OUString&,
- const ::rtl::OUString&,
- const ::com::sun::star::uno::Sequence< sal_Int32 > &,
- ReplacementAction,
- LanguageType * )
- {
- OSL_FAIL( "HangulHanjaConversion::ReplaceUnit: to be overridden!" );
- }
-
- sal_Bool HangulHanjaConversion::HasRubySupport() const
- {
- 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
deleted file mode 100644
index ad65e169e4..0000000000
--- a/editeng/source/misc/lingu.src
+++ /dev/null
@@ -1,104 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
- // include ---------------------------------------------------------------
-#include <editeng/editrids.hrc>
- // pragma ----------------------------------------------------------------
-
- // QueryBoxen ---------------------------------------------------------------
-QueryBox RID_SVXQB_CONTINUE
-{
- BUTTONS = WB_YES_NO ;
- DEFBUTTON = WB_DEF_YES ;
- /* ### WARNING: New Text in Resource? überpüfung am Anfang des Dokumentes fortsetzen? : šberpr³fung am Anfang des Dokumentes fortsetzen? */
- /* ### WARNING: New Text in Resource? Überprüfung am Anfang des Dokumentes fortsetzen? : šberpr³fung am Anfang des Dokumentes fortsetzen? */
- Message [ en-US ] = "Continue checking at beginning of document?" ;
-};
-QueryBox RID_SVXQB_BW_CONTINUE
-{
- BUTTONS = WB_YES_NO ;
- DEFBUTTON = WB_DEF_YES ;
- /* ### WARNING: New Text in Resource? Überprüfung am Ende des Dokumentes fortsetzen? : šberpr³fung am Ende des Dokumentes fortsetzen? */
- /* ### WARNING: New Text in Resource? Überprüfung am Ende des Dokumentes fortsetzen? : šberpr³fung am Ende des Dokumentes fortsetzen? */
- Message [ en-US ] = "Continue checking at end of document?" ;
-};
-String RID_SVXSTR_HMERR_THESAURUS
-{
- /* ### WARNING: New Text in Resource? Ein Thesaurus für die eingestellte Sprache ist nicht verfügbar. \nÜberprüfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewünschte Sprache : Ein Thesaurus f³r die eingestellte Sprache ist nicht verf³gbar. \nšberpr³fen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gew³nschte Sprache */
- /* ### WARNING: New Text in Resource? Ein Thesaurus für die eingestellte Sprache ist nicht verfügbar. \nÜberprüfen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gewünschte Sprache : Ein Thesaurus f³r die eingestellte Sprache ist nicht verf³gbar. \nšberpr³fen Sie bitte Ihre Installation und installieren Sie \ngegebenenfalls die gew³nschte Sprache */
- Text [ en-US ] = "No thesaurus is available for the selected language. \nPlease check your installation and install the desired language\n" ;
-};
-String RID_SVXSTR_DIC_ERR_UNKNOWN
-{
- Text [ en-US ] = "Word cannot be added to dictionary\ndue to unknown reason.";
-};
-String RID_SVXSTR_DIC_ERR_FULL
-{
- Text [ en-US ] = "The dictionary is already full.";
-};
-String RID_SVXSTR_DIC_ERR_READONLY
-{
- Text [ en-US ] = "The dictionary is read-only.";
-};
-
- // ********************************************************************** EOF
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx
deleted file mode 100644
index 3e5a4db514..0000000000
--- a/editeng/source/misc/splwrap.cxx
+++ /dev/null
@@ -1,623 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include<rtl/ustring.hxx>
-#include <tools/shl.hxx>
-#include <vcl/wrkwin.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/msgbox.hxx>
-#include <tools/debug.hxx>
-#include <svtools/langtab.hxx>
-
-#ifndef __RSC
-#include <tools/errinf.hxx>
-#endif
-#include <editeng/unolingu.hxx>
-#include <linguistic/lngprops.hxx>
-#include <com/sun/star/frame/XStorable.hpp>
-
-#include <map>
-
-#include <editeng/svxenum.hxx>
-#include <editeng/splwrap.hxx>
-#include <editeng/edtdlg.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng/editrids.hrc>
-#include <editeng/editids.hrc>
-#include <editeng/editerr.hxx>
-
-#define WAIT_ON() if(pWin != NULL) { pWin->EnterWait(); }
-
-#define WAIT_OFF() if(pWin != NULL) { pWin->LeaveWait(); }
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::linguistic2;
-
-
-// misc functions ---------------------------------------------
-
-void SvxPrepareAutoCorrect( String &rOldText, String &rNewText )
-{
- // This function should be used to strip (or add) trailing '.' from
- // the strings before passing them on to the autocorrect function in
- // order that the autocorrect function will hopefully
- // works properly with normal words and abbreviations (with trailing '.')
- // independ of if they are at the end of the sentence or not.
- //
- // rOldText: text to be replaced
- // rNewText: replacement text
-
- xub_StrLen nOldLen = rOldText.Len(),
- nNewLen = rNewText.Len();
- if (nOldLen && nNewLen)
- {
- sal_Bool bOldHasDot = sal_Unicode( '.' ) == rOldText.GetChar( nOldLen - 1 ),
- bNewHasDot = sal_Unicode( '.' ) == rNewText.GetChar( nNewLen - 1 );
- if (bOldHasDot && !bNewHasDot
- /*this is: !(bOldHasDot && bNewHasDot) && bOldHasDot*/)
- rOldText.Erase( nOldLen - 1 );
- }
-}
-
-#define SVX_LANG_NEED_CHECK 0
-#define SVX_LANG_OK 1
-#define SVX_LANG_MISSING 2
-#define SVX_LANG_MISSING_DO_WARN 3
-
-#define SVX_FLAGS_NEW
-
-
-struct lt_LanguageType
-{
- bool operator()( LanguageType n1, LanguageType n2 ) const
- {
- return n1 < n2;
- }
-};
-
-typedef std::map< LanguageType, sal_uInt16, lt_LanguageType > LangCheckState_map_t;
-
-static LangCheckState_map_t & GetLangCheckState()
-{
- static LangCheckState_map_t aLangCheckState;
- return aLangCheckState;
-}
-
-void SvxSpellWrapper::ShowLanguageErrors()
-{
- // display message boxes for languages not available for
- // spellchecking or hyphenation
- LangCheckState_map_t &rLCS = GetLangCheckState();
- LangCheckState_map_t::iterator aIt( rLCS.begin() );
- while (aIt != rLCS.end())
- {
- LanguageType nLang = aIt->first;
- sal_uInt16 nVal = aIt->second;
- sal_uInt16 nTmpSpell = nVal & 0x00FF;
- sal_uInt16 nTmpHyph = (nVal >> 8) & 0x00FF;
-
- if (SVX_LANG_MISSING_DO_WARN == nTmpSpell)
- {
- String aErr( SvtLanguageTable::GetLanguageString( nLang ) );
- ErrorHandler::HandleError(
- *new StringErrorInfo( ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aErr ) );
- nTmpSpell = SVX_LANG_MISSING;
- }
- if (SVX_LANG_MISSING_DO_WARN == nTmpHyph)
- {
- String aErr( SvtLanguageTable::GetLanguageString( nLang ) );
- ErrorHandler::HandleError(
- *new StringErrorInfo( ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aErr ) );
- nTmpHyph = SVX_LANG_MISSING;
- }
-
- rLCS[ nLang ] = (nTmpHyph << 8) | nTmpSpell;
- ++aIt;
- }
-
-}
-
-SvxSpellWrapper::~SvxSpellWrapper()
-{
-}
-
-/*--------------------------------------------------------------------
- * Description: Constructor, the test sequence is determined
- *
- * !bStart && !bOtherCntnt: BODY_END, BODY_START, OTHER
- * !bStart && bOtherCntnt: OTHER, BODY
- * bStart && !bOtherCntnt: BODY_END, OTHER
- * bStart && bOtherCntnt: OTHER
- *
- --------------------------------------------------------------------*/
-
-SvxSpellWrapper::SvxSpellWrapper( Window* pWn,
- Reference< XSpellChecker1 > &xSpellChecker,
- const sal_Bool bStart, const sal_Bool bIsAllRight,
- const sal_Bool bOther, const sal_Bool bRevAllow ) :
-
- pWin ( pWn ),
- xSpell ( xSpellChecker ),
- bOtherCntnt ( bOther ),
- bDialog ( sal_False ),
- bHyphen ( sal_False ),
- bAuto ( sal_False ),
- bStartChk ( bOther ),
- bRevAllowed ( bRevAllow ),
- bAllRight ( bIsAllRight )
-{
- Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() );
- sal_Bool bWrapReverse = xProp.is() ?
- *(sal_Bool*)xProp->getPropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UPN_IS_WRAP_REVERSE)) ).getValue()
- : sal_False;
- bReverse = bRevAllow && bWrapReverse;
- bStartDone = bOther || ( !bReverse && bStart );
- bEndDone = bReverse && bStart && !bOther;
-}
-
-// -----------------------------------------------------------------------
-
-SvxSpellWrapper::SvxSpellWrapper( Window* pWn,
- Reference< XHyphenator > &xHyphenator,
- const sal_Bool bStart, const sal_Bool bOther ) :
- pWin ( pWn ),
- xHyph ( xHyphenator ),
- bOtherCntnt ( bOther ),
- bDialog ( sal_False ),
- bHyphen ( sal_False ),
- bAuto ( sal_False ),
- bReverse ( sal_False ),
- bStartDone ( bOther || ( !bReverse && bStart ) ),
- bEndDone ( bReverse && bStart && !bOther ),
- bStartChk ( bOther ),
- bRevAllowed ( sal_False ),
- bAllRight ( sal_True )
-{
-}
-
-// -----------------------------------------------------------------------
-
-sal_Int16 SvxSpellWrapper::CheckSpellLang(
- Reference< XSpellChecker1 > xSpell, sal_Int16 nLang)
-{
- LangCheckState_map_t &rLCS = GetLangCheckState();
-
- LangCheckState_map_t::iterator aIt( rLCS.find( nLang ) );
- sal_uInt16 nVal = aIt == rLCS.end() ? SVX_LANG_NEED_CHECK : aIt->second;
-
- if (aIt == rLCS.end())
- rLCS[ nLang ] = nVal;
-
- if (SVX_LANG_NEED_CHECK == (nVal & 0x00FF))
- {
- sal_uInt16 nTmpVal = SVX_LANG_MISSING_DO_WARN;
- if (xSpell.is() && xSpell->hasLanguage( nLang ))
- nTmpVal = SVX_LANG_OK;
- nVal &= 0xFF00;
- nVal |= nTmpVal;
-
- rLCS[ nLang ] = nVal;
- }
-
- return (sal_Int16) nVal;
-}
-
-sal_Int16 SvxSpellWrapper::CheckHyphLang(
- Reference< XHyphenator > xHyph, sal_Int16 nLang)
-{
- LangCheckState_map_t &rLCS = GetLangCheckState();
-
- LangCheckState_map_t::iterator aIt( rLCS.find( nLang ) );
- sal_uInt16 nVal = aIt == rLCS.end() ? 0 : aIt->second;
-
- if (aIt == rLCS.end())
- rLCS[ nLang ] = nVal;
-
- if (SVX_LANG_NEED_CHECK == ((nVal >> 8) & 0x00FF))
- {
- sal_uInt16 nTmpVal = SVX_LANG_MISSING_DO_WARN;
- if (xHyph.is() && xHyph->hasLocale( SvxCreateLocale( nLang ) ))
- nTmpVal = SVX_LANG_OK;
- nVal &= 0x00FF;
- nVal |= nTmpVal << 8;
-
- rLCS[ nLang ] = nVal;
- }
-
- return (sal_Int16) nVal;
-}
-
-// -----------------------------------------------------------------------
-
-
-void SvxSpellWrapper::SpellStart( SvxSpellArea /*eSpell*/ )
-{ // Here, the necessary preparations be made for SpellContinue in the
-} // given area.
-
-// -----------------------------------------------------------------------
-
-
-sal_Bool SvxSpellWrapper::HasOtherCnt()
-{
- return sal_False; // Is there a special area?
-}
-
-// -----------------------------------------------------------------------
-
-
-sal_Bool SvxSpellWrapper::SpellMore()
-{
- return sal_False; // Should additional documents be examined?
-}
-
-// -----------------------------------------------------------------------
-
-
-void SvxSpellWrapper::SpellEnd()
-{ // Area is complete, tidy up if necessary
-
- // display error for last language not found
- ShowLanguageErrors();
-}
-
-// -----------------------------------------------------------------------
-
-
-sal_Bool SvxSpellWrapper::SpellContinue()
-{
- return sal_False;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxSpellWrapper::AutoCorrect( const String&, const String& )
-{
-}
-
-// -----------------------------------------------------------------------
-
-
-void SvxSpellWrapper::ScrollArea()
-{ // Set Scroll area
-}
-
-// -----------------------------------------------------------------------
-
-
-void SvxSpellWrapper::ChangeWord( const String&, const sal_uInt16 )
-{ // Insert Word
-}
-
-// -----------------------------------------------------------------------
-
-
-String SvxSpellWrapper::GetThesWord()
-{
- // What word should be looked up?
- return String();
-}
-
-// -----------------------------------------------------------------------
-
-
-void SvxSpellWrapper::ChangeThesWord( const String& )
-{
- // replace word due to Thesaurus.
-}
-
-// -----------------------------------------------------------------------
-
-void SvxSpellWrapper::StartThesaurus( const String &rWord, sal_uInt16 nLanguage )
-{
- Reference< XThesaurus > xThes( SvxGetThesaurus() );
- if (!xThes.is())
- {
- InfoBox( pWin, EE_RESSTR( RID_SVXSTR_HMERR_THESAURUS ) ).Execute();
- return;
- }
-
- WAIT_ON(); // while looking up for initial word
- EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
- AbstractThesaurusDialog* pDlg = pFact->CreateThesaurusDialog( pWin, xThes, rWord, nLanguage );
- WAIT_OFF();
- if ( pDlg->Execute()== RET_OK )
- {
- ChangeThesWord( pDlg->GetWord() );
- }
- delete pDlg;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxSpellWrapper::ReplaceAll( const String &, sal_Int16 )
-{ // Replace Word from the the Replace list
-}
-
-// -----------------------------------------------------------------------
-
-
-void SvxSpellWrapper::SetLanguage( const sal_uInt16 )
-{ // Set Language
-}
-
-// -----------------------------------------------------------------------
-
-
-void SvxSpellWrapper::InsertHyphen( const sal_uInt16 )
-{ // inserting and deleting Hyphae
-}
-
-// -----------------------------------------------------------------------
-// Testing of the document areas in the order specified by the flags
-
-
-void SvxSpellWrapper::SpellDocument( )
-{
- if ( bOtherCntnt )
- {
- bReverse = sal_False;
- SpellStart( SVX_SPELL_OTHER );
- }
- else
- {
- bStartChk = bReverse;
- SpellStart( bReverse ? SVX_SPELL_BODY_START : SVX_SPELL_BODY_END );
- }
-
- if ( FindSpellError() )
- {
- Reference< XSpellAlternatives > xAlt( GetLast(), UNO_QUERY );
- Reference< XHyphenatedWord > xHyphWord( GetLast(), UNO_QUERY );
-
- Window *pOld = pWin;
- bDialog = sal_True;
- if (xHyphWord.is())
- {
- EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
- AbstractHyphenWordDialog* pDlg = pFact->CreateHyphenWordDialog( pWin,
- xHyphWord->getWord(),
- SvxLocaleToLanguage( xHyphWord->getLocale() ),
- xHyph, this );
- pWin = pDlg->GetWindow();
- pDlg->Execute();
- delete pDlg;
- }
- bDialog = sal_False;
- pWin = pOld;
- };
-}
-
-// -----------------------------------------------------------------------
-// Select the next area
-
-
-sal_Bool SvxSpellWrapper::SpellNext( )
-{
- Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() );
- sal_Bool bWrapReverse = xProp.is() ?
- *(sal_Bool*)xProp->getPropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UPN_IS_WRAP_REVERSE)) ).getValue()
- : sal_False;
- sal_Bool bActRev = bRevAllowed && bWrapReverse;
-
- // bActRev is the direction after Spell checking, bReverse is the one
- // at the beginning.
- if( bActRev == bReverse )
- { // 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 ) //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 ) // Document has been fully checked?
- {
- if ( SpellMore() ) // spell check another document?
- {
- bOtherCntnt = sal_False;
- bStartDone = !bReverse;
- bEndDone = bReverse;
- SpellStart( SVX_SPELL_BODY );
- return sal_True;
- }
- return sal_False;
- }
-
- sal_Bool bGoOn = sal_False;
-
- if ( bOtherCntnt )
- {
- bStartChk = sal_False;
- SpellStart( SVX_SPELL_BODY );
- bGoOn = sal_True;
- }
- else if ( bStartDone && bEndDone )
- {
- sal_Bool bIsSpellSpecial = xProp.is() ?
- *(sal_Bool*)xProp->getPropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UPN_IS_SPELL_SPECIAL)) ).getValue()
- : sal_False;
- // Body area done, ask for special area
- if( !IsHyphen() && bIsSpellSpecial && HasOtherCnt() )
- {
- SpellStart( SVX_SPELL_OTHER );
- bOtherCntnt = bGoOn = sal_True;
- }
- else if ( SpellMore() ) // check another document?
- {
- bOtherCntnt = sal_False;
- bStartDone = !bReverse;
- bEndDone = bReverse;
- SpellStart( SVX_SPELL_BODY );
- return sal_True;
- }
- }
- else
- {
- // a BODY_area done, ask for the other BODY_area
- WAIT_OFF();
-
- sal_uInt16 nResId = bReverse ? RID_SVXQB_BW_CONTINUE : RID_SVXQB_CONTINUE;
- QueryBox aBox( pWin, EditResId( nResId ) );
- if ( aBox.Execute() != RET_YES )
- {
- // sacrifice the other area if necessary ask for special area
- WAIT_ON();
- bStartDone = bEndDone = sal_True;
- return SpellNext();
- }
- else
- {
- bStartChk = !bStartDone;
- SpellStart( bStartChk ? SVX_SPELL_BODY_START : SVX_SPELL_BODY_END );
- bGoOn = sal_True;
- }
- WAIT_ON();
- }
- return bGoOn;
-}
-
-// -----------------------------------------------------------------------
-
-Reference< XDictionary > SvxSpellWrapper::GetAllRightDic() const
-{
- Reference< XDictionary > xDic;
-
- Reference< XDictionaryList > xDicList( SvxGetDictionaryList() );
- if (xDicList.is())
- {
- Sequence< Reference< XDictionary > > aDics( xDicList->getDictionaries() );
- const Reference< XDictionary > *pDic = aDics.getConstArray();
- sal_Int32 nCount = aDics.getLength();
-
- sal_Int32 i = 0;
- while (!xDic.is() && i < nCount)
- {
- Reference< XDictionary > xTmp( pDic[i], UNO_QUERY );
- if (xTmp.is())
- {
- if ( xTmp->isActive() &&
- xTmp->getDictionaryType() != DictionaryType_NEGATIVE &&
- SvxLocaleToLanguage( xTmp->getLocale() ) == LANGUAGE_NONE )
- {
- Reference< frame::XStorable > xStor( xTmp, UNO_QUERY );
- if (xStor.is() && xStor->hasLocation() && !xStor->isReadonly())
- {
- xDic = xTmp;
- }
- }
- }
- ++i;
- }
-
- if (!xDic.is())
- {
- xDic = SvxGetOrCreatePosDic( xDicList );
- if (xDic.is())
- xDic->setActive( sal_True );
- }
- }
-
- return xDic;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvxSpellWrapper::FindSpellError()
-{
- ShowLanguageErrors();
-
- Reference< XInterface > xRef;
-
- WAIT_ON();
- sal_Bool bSpell = sal_True;
-
- Reference< XDictionary > xAllRightDic;
- if (IsAllRight())
- xAllRightDic = GetAllRightDic();
-
- while ( bSpell )
- {
- SpellContinue();
-
- Reference< XSpellAlternatives > xAlt( GetLast(), UNO_QUERY );
- Reference< XHyphenatedWord > xHyphWord( GetLast(), UNO_QUERY );
-
- if (xAlt.is())
- {
- if (IsAllRight() && xAllRightDic.is())
- {
- xAllRightDic->add( xAlt->getWord(), sal_False, ::rtl::OUString() );
- }
- else
- {
- // look up in ChangeAllList for misspelled word
- Reference< XDictionary > xChangeAllList(
- SvxGetChangeAllList(), UNO_QUERY );
- Reference< XDictionaryEntry > xEntry;
- if (xChangeAllList.is())
- xEntry = xChangeAllList->getEntry( xAlt->getWord() );
-
- if (xEntry.is())
- {
- // replace word without asking
- ReplaceAll( xEntry->getReplacementText(),
- SvxLocaleToLanguage( xAlt->getLocale() ) );
- }
- else
- bSpell = sal_False;
- }
- }
- else if (xHyphWord.is())
- bSpell = sal_False;
- else
- {
- SpellEnd();
- bSpell = SpellNext();
- }
- }
- WAIT_OFF();
- return GetLast().is();
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
deleted file mode 100644
index 675bd0f1c4..0000000000
--- a/editeng/source/misc/svxacorr.cxx
+++ /dev/null
@@ -1,2692 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-#include <tools/urlobj.hxx>
-#include <tools/table.hxx>
-#include <i18npool/mslangid.hxx>
-#include <vcl/svapp.hxx>
-#include <sot/storinfo.hxx>
-// for the Sort-String-Arrays from SVMEM.HXX
-#define _SVSTDARR_STRINGSISORTDTOR
-#define _SVSTDARR_STRINGSDTOR
-#include <svl/svstdarr.hxx>
-#include <svl/fstathelper.hxx>
-#include <svtools/helpopt.hxx>
-#include <svl/urihelper.hxx>
-#include <unotools/charclass.hxx>
-#include <com/sun/star/i18n/UnicodeType.hdl>
-#include <unotools/collatorwrapper.hxx>
-#include <com/sun/star/i18n/CollatorOptions.hpp>
-#include <com/sun/star/i18n/UnicodeScript.hpp>
-#include <com/sun/star/i18n/XOrdinalSuffix.hpp>
-#include <unotools/localedatawrapper.hxx>
-#include <unotools/transliterationwrapper.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <editeng/editids.hrc>
-#include <sot/storage.hxx>
-#include <comphelper/storagehelper.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/wghtitem.hxx>
-#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>
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <unotools/streamwrap.hxx>
-#include <SvXMLAutoCorrectImport.hxx>
-#include <SvXMLAutoCorrectExport.hxx>
-#include <ucbhelper/content.hxx>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-#include <com/sun/star/ucb/TransferInfo.hpp>
-#include <com/sun/star/ucb/NameClash.hpp>
-#include <xmloff/xmltoken.hxx>
-#include <vcl/help.hxx>
-
-#define CHAR_HARDBLANK ((sal_Unicode)0x00A0)
-
-using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star;
-using namespace ::xmloff::token;
-using namespace ::rtl;
-using namespace ::utl;
-
-const int C_NONE = 0x00;
-const int C_FULL_STOP = 0x01;
-const int C_EXCLAMATION_MARK = 0x02;
-const int C_QUESTION_MARK = 0x04;
-
-static const sal_Char pImplWrdStt_ExcptLstStr[] = "WordExceptList";
-static const sal_Char pImplCplStt_ExcptLstStr[] = "SentenceExceptList";
-static const sal_Char pImplAutocorr_ListStr[] = "DocumentList";
-static const sal_Char pXMLImplWrdStt_ExcptLstStr[] = "WordExceptList.xml";
-static const sal_Char pXMLImplCplStt_ExcptLstStr[] = "SentenceExceptList.xml";
-static const sal_Char pXMLImplAutocorr_ListStr[] = "DocumentList.xml";
-
-static const sal_Char
- /* also at these beginnings - Brackets and all kinds of begin characters */
- sImplSttSkipChars[] = "\"\'([{\x83\x84\x89\x91\x92\x93\x94",
- /* also at these ends - Brackets and all kinds of begin characters */
- sImplEndSkipChars[] = "\"\')]}\x83\x84\x89\x91\x92\x93\x94";
-
-// These characters are allowed in words: (for FnCptlSttSntnc)
-static const sal_Char sImplWordChars[] = "-'";
-
-void EncryptBlockName_Imp( String& rName );
-
-
-// FileVersions Number for the Substitution-/Exception list separately
-#define WORDLIST_VERSION_358 1
-#define EXEPTLIST_VERSION_358 0
-
-
-_SV_IMPL_SORTAR_ALG( SvxAutocorrWordList, SvxAutocorrWordPtr )
-TYPEINIT0(SvxAutoCorrect)
-
-typedef SvxAutoCorrectLanguageLists* SvxAutoCorrectLanguageListsPtr;
-DECLARE_TABLE( SvxAutoCorrLanguageTable_Impl, SvxAutoCorrectLanguageListsPtr)
-
-DECLARE_TABLE( SvxAutoCorrLastFileAskTable_Impl, long )
-
-
-inline int IsWordDelim( const sal_Unicode c )
-{
- return ' ' == c || '\t' == c || 0x0a == c ||
- 0xA0 == c || 0x2011 == c || 0x1 == c;
-}
-
-inline int IsLowerLetter( sal_Int32 nCharType )
-{
- return CharClass::isLetterType( nCharType ) &&
- 0 == ( ::com::sun::star::i18n::KCharacterType::UPPER & nCharType);
-}
-inline int IsUpperLetter( sal_Int32 nCharType )
-{
- return CharClass::isLetterType( nCharType ) &&
- 0 == ( ::com::sun::star::i18n::KCharacterType::LOWER & nCharType);
-}
-
-sal_Bool lcl_IsSymbolChar( CharClass& rCC, const String& rTxt,
- xub_StrLen nStt, xub_StrLen nEnd )
-{
- for( ; nStt < nEnd; ++nStt )
- {
- if( ::com::sun::star::i18n::UnicodeType::PRIVATE_USE ==
- rCC.getType( rTxt, nStt ))
- return sal_True;
- }
- return sal_False;
-}
-
-
-static sal_Bool lcl_IsInAsciiArr( const sal_Char* pArr, const sal_Unicode c )
-{
- sal_Bool bRet = sal_False;
- for( ; *pArr; ++pArr )
- if( *pArr == c )
- {
- bRet = sal_True;
- break;
- }
- return bRet;
-}
-
-SvxAutoCorrDoc::~SvxAutoCorrDoc()
-{
-}
- // Is called by the functions:
- // - FnCptlSttWrd
- // - FnCptlSttSntnc
- // after the exchange of characters. then the words can maybe be inserted
- // into the exception list.
-void SvxAutoCorrDoc::SaveCpltSttWord( sal_uLong, xub_StrLen, const String&,
- sal_Unicode )
-{
-}
-
-LanguageType SvxAutoCorrDoc::GetLanguage( xub_StrLen , sal_Bool ) const
-{
- return LANGUAGE_SYSTEM;
-}
-
-static ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >& GetProcessFact()
-{
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory > xMSF =
- ::comphelper::getProcessServiceFactory();
- return xMSF;
-}
-
-static sal_uInt16 GetAppLang()
-{
- return Application::GetSettings().GetLanguage();
-}
-static LocaleDataWrapper& GetLocaleDataWrapper( sal_uInt16 nLang )
-{
- static LocaleDataWrapper aLclDtWrp( GetProcessFact(),
- SvxCreateLocale( GetAppLang() ) );
- ::com::sun::star::lang::Locale aLcl( SvxCreateLocale( nLang ));
- const ::com::sun::star::lang::Locale& rLcl = aLclDtWrp.getLoadedLocale();
- if( aLcl.Language != rLcl.Language ||
- aLcl.Country != rLcl.Country ||
- aLcl.Variant != rLcl.Variant )
- aLclDtWrp.setLocale( aLcl );
- return aLclDtWrp;
-}
-static TransliterationWrapper& GetIgnoreTranslWrapper()
-{
- static int bIsInit = 0;
- static TransliterationWrapper aWrp( GetProcessFact(),
- ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA |
- ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH );
- if( !bIsInit )
- {
- aWrp.loadModuleIfNeeded( GetAppLang() );
- bIsInit = 1;
- }
- return aWrp;
-}
-static CollatorWrapper& GetCollatorWrapper()
-{
- static int bIsInit = 0;
- static CollatorWrapper aCollWrp( GetProcessFact() );
- if( !bIsInit )
- {
- aCollWrp.loadDefaultCollator( SvxCreateLocale( GetAppLang() ), 0 );
- bIsInit = 1;
- }
- return aCollWrp;
-}
-
-
-void SvxAutocorrWordList::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL )
-{
- if( nL )
- {
- 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 );
- }
-}
-
-
-sal_Bool SvxAutocorrWordList::Seek_Entry( const SvxAutocorrWordPtr aE, sal_uInt16* pP ) const
-{
- register sal_uInt16 nO = SvxAutocorrWordList_SAR::Count(),
- nM,
- nU = 0;
- if( nO > 0 )
- {
- CollatorWrapper& rCmp = ::GetCollatorWrapper();
- nO--;
- while( nU <= nO )
- {
- nM = nU + ( nO - nU ) / 2;
- long nCmp = rCmp.compareString( aE->GetShort(),
- (*((SvxAutocorrWordPtr*)pData + nM))->GetShort() );
- if( 0 == nCmp )
- {
- if( pP ) *pP = nM;
- return sal_True;
- }
- else if( 0 < nCmp )
- nU = nM + 1;
- else if( nM == 0 )
- {
- if( pP ) *pP = nU;
- return sal_False;
- }
- else
- nO = nM - 1;
- }
- }
- if( pP ) *pP = nU;
- return sal_False;
-}
-
-void lcl_ClearTable(SvxAutoCorrLanguageTable_Impl& rLangTable)
-{
- SvxAutoCorrectLanguageListsPtr pLists = rLangTable.Last();
- while(pLists)
- {
- delete pLists;
- pLists = rLangTable.Prev();
- }
- rLangTable.Clear();
-}
-
-sal_Bool SvxAutoCorrect::IsAutoCorrectChar( sal_Unicode cChar )
-{
- return cChar == '\0' || cChar == '\t' || cChar == 0x0a ||
- cChar == ' ' || cChar == '\'' || cChar == '\"' ||
- cChar == '*' || cChar == '_' ||
- cChar == '.' || cChar == ',' || cChar == ';' ||
- cChar == ':' || cChar == '?' || cChar == '!' || cChar == '/';
-}
-
-sal_Bool SvxAutoCorrect::NeedsHardspaceAutocorr( sal_Unicode cChar )
-{
- return cChar == ';' || cChar == ':' || cChar == '?' || cChar == '!' ||
- cChar == '/' /*case for the urls exception*/;
-}
-
-long SvxAutoCorrect::GetDefaultFlags()
-{
- long nRet = Autocorrect
- | CptlSttSntnc
- | CptlSttWrd
- | ChgOrdinalNumber
- | ChgToEnEmDash
- | AddNonBrkSpace
- | ChgWeightUnderl
- | SetINetAttr
- | ChgQuotes
- | SaveWordCplSttLst
- | SaveWordWrdSttLst
- | CorrectCapsLock;
- LanguageType eLang = GetAppLang();
- switch( eLang )
- {
- case LANGUAGE_ENGLISH:
- case LANGUAGE_ENGLISH_US:
- case LANGUAGE_ENGLISH_UK:
- case LANGUAGE_ENGLISH_AUS:
- case LANGUAGE_ENGLISH_CAN:
- case LANGUAGE_ENGLISH_NZ:
- case LANGUAGE_ENGLISH_EIRE:
- case LANGUAGE_ENGLISH_SAFRICA:
- case LANGUAGE_ENGLISH_JAMAICA:
- case LANGUAGE_ENGLISH_CARRIBEAN:
- nRet &= ~(ChgQuotes|ChgSglQuotes);
- break;
- }
- return nRet;
-}
-
-
-SvxAutoCorrect::SvxAutoCorrect( const String& rShareAutocorrFile,
- const String& rUserAutocorrFile )
- : sShareAutoCorrFile( rShareAutocorrFile ),
- sUserAutoCorrFile( rUserAutocorrFile ),
- pLangTable( new SvxAutoCorrLanguageTable_Impl ),
- pLastFileTable( new SvxAutoCorrLastFileAskTable_Impl ),
- pCharClass( 0 ), bRunNext( false ),
- cStartDQuote( 0 ), cEndDQuote( 0 ), cStartSQuote( 0 ), cEndSQuote( 0 )
-{
- nFlags = SvxAutoCorrect::GetDefaultFlags();
-
- cEmDash = 0x2014;
- cEnDash = 0x2013;
-}
-
-SvxAutoCorrect::SvxAutoCorrect( const SvxAutoCorrect& rCpy )
-: sShareAutoCorrFile( rCpy.sShareAutoCorrFile ),
- sUserAutoCorrFile( rCpy.sUserAutoCorrFile ),
-
- aSwFlags( rCpy.aSwFlags ),
-
- pLangTable( new SvxAutoCorrLanguageTable_Impl ),
- pLastFileTable( new SvxAutoCorrLastFileAskTable_Impl ),
- pCharClass( 0 ), bRunNext( false ),
-
- nFlags( rCpy.nFlags & ~(ChgWordLstLoad|CplSttLstLoad|WrdSttLstLoad)),
- cStartDQuote( rCpy.cStartDQuote ), cEndDQuote( rCpy.cEndDQuote ),
- cStartSQuote( rCpy.cStartSQuote ), cEndSQuote( rCpy.cEndSQuote ),
- cEmDash( rCpy.cEmDash ), cEnDash( rCpy.cEnDash )
-{
-}
-
-
-SvxAutoCorrect::~SvxAutoCorrect()
-{
- lcl_ClearTable(*pLangTable);
- delete pLangTable;
- delete pLastFileTable;
- delete pCharClass;
-}
-
-void SvxAutoCorrect::_GetCharClass( LanguageType eLang )
-{
- delete pCharClass;
- pCharClass = new CharClass( SvxCreateLocale( eLang ));
- eCharClassLang = eLang;
-}
-
-void SvxAutoCorrect::SetAutoCorrFlag( long nFlag, sal_Bool bOn )
-{
- long nOld = nFlags;
- nFlags = bOn ? nFlags | nFlag
- : nFlags & ~nFlag;
-
- if( !bOn )
- {
- if( (nOld & CptlSttSntnc) != (nFlags & CptlSttSntnc) )
- nFlags &= ~CplSttLstLoad;
- if( (nOld & CptlSttWrd) != (nFlags & CptlSttWrd) )
- nFlags &= ~WrdSttLstLoad;
- if( (nOld & Autocorrect) != (nFlags & Autocorrect) )
- nFlags &= ~ChgWordLstLoad;
- }
-}
-
-
- // 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 )
-{
- sal_Bool bRet = sal_False;
- CharClass& rCC = GetCharClass( eLang );
-
- // 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;
- for( ; nSttPos < nEndPos; --nEndPos )
- if( rCC.isLetterNumeric( rTxt, nEndPos - 1 ))
- break;
-
- // Two capital letters at the beginning of word?
- if( nSttPos+2 < nEndPos &&
- IsUpperLetter( rCC.getCharacterType( rTxt, nSttPos )) &&
- IsUpperLetter( rCC.getCharacterType( rTxt, ++nSttPos )) &&
- // Is the third character a lower case
- IsLowerLetter( rCC.getCharacterType( rTxt, nSttPos +1 )) &&
- // Do not replace special attributes
- 0x1 != rTxt.GetChar( nSttPos ) && 0x2 != rTxt.GetChar( nSttPos ))
- {
- // test if the word is in an exception list
- String sWord( rTxt.Copy( nSttPos - 1, nEndPos - nSttPos + 1 ));
- if( !FindInWrdSttExceptList(eLang, sWord) )
- {
- ::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())
- {
- 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;
- }
- }
- }
- }
- return bRet;
-}
-
-
-sal_Bool SvxAutoCorrect::FnChgOrdinalNumber(
- SvxAutoCorrDoc& rDoc, const String& rTxt,
- xub_StrLen nSttPos, xub_StrLen nEndPos,
- LanguageType eLang )
-{
-// 1st, 2nd, 3rd, 4 - 0th
-// 201th or 201st
-// 12th or 12nd
- CharClass& rCC = GetCharClass( eLang );
- sal_Bool bChg = sal_False;
-
- for( ; nSttPos < nEndPos; ++nSttPos )
- if( !lcl_IsInAsciiArr( sImplSttSkipChars, rTxt.GetChar( nSttPos ) ))
- break;
- for( ; nSttPos < nEndPos; --nEndPos )
- if( !lcl_IsInAsciiArr( sImplEndSkipChars, rTxt.GetChar( nEndPos - 1 ) ))
- break;
-
-
- // 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 )
- {
- i--;
- bool isDigit = rCC.isDigit( rTxt, i );
- if ( foundEnd )
- validNumber |= isDigit;
-
- if ( isDigit && !foundEnd )
- {
- foundEnd = true;
- nNumEnd = i;
- }
- }
-
- if ( foundEnd && validNumber ) {
- sal_Int32 nNum = rTxt.Copy( nSttPos, nNumEnd - nSttPos + 1 ).ToInt32( );
-
- // 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 ( xOrdSuffix.is( ) )
- {
- 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 )
- {
- // 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);
- }
- }
- }
- }
-
- }
- return bChg;
-}
-
-
-sal_Bool SvxAutoCorrect::FnChgToEnEmDash(
- SvxAutoCorrDoc& rDoc, const String& rTxt,
- xub_StrLen nSttPos, xub_StrLen nEndPos,
- LanguageType eLang )
-{
- sal_Bool bRet = sal_False;
- CharClass& rCC = GetCharClass( eLang );
- if (eLang == LANGUAGE_SYSTEM)
- eLang = GetAppLang();
- bool bAlwaysUseEmDash = (cEmDash && (eLang == LANGUAGE_RUSSIAN || eLang == LANGUAGE_UKRAINIAN));
-
- // replace " - " or " --" with "enDash"
- if( cEnDash && 1 < nSttPos && 1 <= nEndPos - nSttPos )
- {
- sal_Unicode cCh = rTxt.GetChar( nSttPos );
- if( '-' == cCh )
- {
- if( ' ' == rTxt.GetChar( nSttPos-1 ) &&
- '-' == rTxt.GetChar( nSttPos+1 ))
- {
- xub_StrLen n;
- for( n = nSttPos+2; n < nEndPos && lcl_IsInAsciiArr(
- sImplSttSkipChars,(cCh = rTxt.GetChar( n )));
- ++n )
- ;
-
- // found: " --[<AnySttChars>][A-z0-9]
- if( rCC.isLetterNumeric( cCh ) )
- {
- for( n = nSttPos-1; n && lcl_IsInAsciiArr(
- sImplEndSkipChars,(cCh = rTxt.GetChar( --n ))); )
- ;
-
- // found: "[A-z0-9][<AnyEndChars>] --[<AnySttChars>][A-z0-9]
- if( rCC.isLetterNumeric( cCh ))
- {
- rDoc.Delete( nSttPos, nSttPos + 2 );
- rDoc.Insert( nSttPos, bAlwaysUseEmDash ? cEmDash : cEnDash );
- bRet = sal_True;
- }
- }
- }
- }
- else if( 3 < nSttPos &&
- ' ' == rTxt.GetChar( nSttPos-1 ) &&
- '-' == rTxt.GetChar( nSttPos-2 ))
- {
- xub_StrLen n, nLen = 1, nTmpPos = nSttPos - 2;
- if( '-' == ( cCh = rTxt.GetChar( nTmpPos-1 )) )
- {
- --nTmpPos;
- ++nLen;
- cCh = rTxt.GetChar( nTmpPos-1 );
- }
- if( ' ' == cCh )
- {
- for( n = nSttPos; n < nEndPos && lcl_IsInAsciiArr(
- sImplSttSkipChars,(cCh = rTxt.GetChar( n )));
- ++n )
- ;
-
- // found: " - [<AnySttChars>][A-z0-9]
- if( rCC.isLetterNumeric( cCh ) )
- {
- cCh = ' ';
- for( n = nTmpPos-1; n && lcl_IsInAsciiArr(
- sImplEndSkipChars,(cCh = rTxt.GetChar( --n ))); )
- ;
- // found: "[A-z0-9][<AnyEndChars>] - [<AnySttChars>][A-z0-9]
- if( rCC.isLetterNumeric( cCh ))
- {
- rDoc.Delete( nTmpPos, nTmpPos + nLen );
- rDoc.Insert( nTmpPos, bAlwaysUseEmDash ? cEmDash : cEnDash );
- bRet = sal_True;
- }
- }
- }
- }
- }
-
- // Replace [A-z0-9]--[A-z0-9] double dash with "emDash" or "enDash".
- // Finnish and Hungarian use enDash instead of emDash.
- bool bEnDash = (eLang == LANGUAGE_HUNGARIAN || eLang == LANGUAGE_FINNISH);
- if( ((cEmDash && !bEnDash) || (cEnDash && bEnDash)) && 4 <= nEndPos - nSttPos )
- {
- String sTmp( rTxt.Copy( nSttPos, nEndPos - nSttPos ) );
- xub_StrLen nFndPos = sTmp.SearchAscii( "--" );
- if( STRING_NOTFOUND != nFndPos && nFndPos &&
- nFndPos + 2 < sTmp.Len() &&
- ( rCC.isLetterNumeric( sTmp, nFndPos - 1 ) ||
- lcl_IsInAsciiArr( sImplEndSkipChars, rTxt.GetChar( nFndPos - 1 ) )) &&
- ( rCC.isLetterNumeric( sTmp, nFndPos + 2 ) ||
- lcl_IsInAsciiArr( sImplSttSkipChars, rTxt.GetChar( nFndPos + 2 ) )))
- {
- nSttPos = nSttPos + nFndPos;
- rDoc.Delete( nSttPos, nSttPos + 2 );
- rDoc.Insert( nSttPos, (bEnDash ? cEnDash : cEmDash) );
- bRet = sal_True;
- }
- }
- return bRet;
-}
-
-sal_Bool SvxAutoCorrect::FnAddNonBrkSpace(
- SvxAutoCorrDoc& rDoc, const String& rTxt,
- xub_StrLen, xub_StrLen nEndPos,
- LanguageType eLang )
-{
- bool bRet = false;
-
- CharClass& rCC = GetCharClass( eLang );
- const lang::Locale rLocale = rCC.getLocale( );
-
- if ( rLocale.Language == OUString(RTL_CONSTASCII_USTRINGPARAM( "fr" )) )
- {
- bool bFrCA = rLocale.Country == OUString(RTL_CONSTASCII_USTRINGPARAM( "CA" ));
- OUString allChars = OUString(RTL_CONSTASCII_USTRINGPARAM( ":;!?" ));
- OUString chars( allChars );
- if ( bFrCA )
- chars = OUString(RTL_CONSTASCII_USTRINGPARAM( ":" ));
-
- sal_Unicode cChar = rTxt.GetChar( nEndPos );
- bool bHasSpace = chars.indexOf( cChar ) != -1;
- bool bIsSpecial = allChars.indexOf( cChar ) != -1;
- if ( bIsSpecial )
- {
- // Get the last word delimiter position
- xub_StrLen nSttWdPos = nEndPos;
- 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( cPrevChar ) == -1 ) && cPrevChar != '\t' )
- {
- // Remove any previous normal space
- xub_StrLen nPos = nEndPos - 1;
- while ( cPrevChar == ' ' || cPrevChar == CHAR_HARDBLANK )
- {
- if ( nPos == 0 ) break;
- nPos--;
- cPrevChar = rTxt.GetChar( nPos );
- }
-
- 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( cPrevChar ) != -1 )
- bRunNext = true;
- }
- }
- else if ( cChar == '/' && nEndPos > 1 && rTxt.Len() > (nEndPos - 1) )
- {
- // Remove the hardspace right before to avoid formatting URLs
- sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 );
- sal_Unicode cMaybeSpaceChar = rTxt.GetChar( nEndPos - 2 );
- if ( cPrevChar == ':' && cMaybeSpaceChar == CHAR_HARDBLANK )
- {
- rDoc.Delete( nEndPos - 2, nEndPos - 1 );
- bRet = true;
- }
- }
- }
-
- return bRet;
-}
-
-sal_Bool SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const String& rTxt,
- xub_StrLen nSttPos, xub_StrLen nEndPos,
- LanguageType eLang )
-{
- String sURL( URIHelper::FindFirstURLInText( rTxt, nSttPos, nEndPos,
- GetCharClass( eLang ) ));
- sal_Bool bRet = 0 != sURL.Len();
- if( bRet ) // also Attribut setzen:
- rDoc.SetINetAttr( nSttPos, nEndPos, sURL );
- return bRet;
-}
-
-
-sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const String& rTxt,
- xub_StrLen, xub_StrLen nEndPos,
- LanguageType eLang )
-{
- // 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 ); // underline or bold
- if( ++nEndPos != rTxt.Len() &&
- !IsWordDelim( rTxt.GetChar( nEndPos ) ) )
- return sal_False;
-
- --nEndPos;
-
- sal_Bool bAlphaNum = sal_False;
- xub_StrLen nPos = nEndPos, nFndPos = STRING_NOTFOUND;
- CharClass& rCC = GetCharClass( eLang );
-
- while( nPos )
- {
- switch( c = rTxt.GetChar( --nPos ) )
- {
- case '_':
- case '*':
- if( c == cInsChar )
- {
- if( bAlphaNum && nPos+1 < nEndPos && ( !nPos ||
- IsWordDelim( rTxt.GetChar( nPos-1 ))) &&
- !IsWordDelim( rTxt.GetChar( nPos+1 )))
- nFndPos = nPos;
- else
- // Condition is not satisfied, so cancel
- nFndPos = STRING_NOTFOUND;
- nPos = 0;
- }
- break;
- default:
- if( !bAlphaNum )
- bAlphaNum = rCC.isLetterNumeric( rTxt, nPos );
- }
- }
-
- if( STRING_NOTFOUND != nFndPos )
- {
- // 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 // underline
- {
- SvxUnderlineItem aSvxUnderlineItem( UNDERLINE_SINGLE, SID_ATTR_CHAR_UNDERLINE );
- rDoc.SetAttr( nFndPos + 1, nEndPos,
- SID_ATTR_CHAR_UNDERLINE,
- aSvxUnderlineItem);
- }
- rDoc.Delete( nEndPos, nEndPos + 1 );
- rDoc.Delete( nFndPos, nFndPos + 1 );
- }
-
- return STRING_NOTFOUND != nFndPos;
-}
-
-
-sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
- const String& rTxt, sal_Bool bNormalPos,
- xub_StrLen nSttPos, xub_StrLen nEndPos,
- LanguageType eLang )
-{
-
- if( !rTxt.Len() || nEndPos <= nSttPos )
- return sal_False;
-
- 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;
- do {
- --pStr;
- if( rCC.isLetter(
- aText, sal::static_int_cast< xub_StrLen >( pStr - pStart ) ) )
- {
- if( !pWordStt )
- pDelim = pStr+1;
- pWordStt = pStr;
- }
- else if( pWordStt &&
- !rCC.isDigit(
- aText,
- sal::static_int_cast< xub_StrLen >( pStr - pStart ) ) )
- {
- if( lcl_IsInAsciiArr( sImplWordChars, *pStr ) &&
- pWordStt - 1 == pStr &&
- // 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 ) ) )
- pWordStt = --pStr;
- else
- break;
- }
- } while( 0 == ( bAtStart = (pStart == pStr)) );
-
- if( !pWordStt ||
- rCC.isDigit(
- aText, sal::static_int_cast< xub_StrLen >( pStr - pStart ) ) ||
- IsUpperLetter(
- 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; // no character to be replaced, or already ok
-
- if( *pDelim && 2 >= pDelim - pWordStt &&
- lcl_IsInAsciiArr( ".-)>", *pDelim ) )
- return sal_False;
-
- if( !bAtStart ) // Still no beginning of a paragraph?
- {
- if ( IsWordDelim( *pStr ) )
- {
- while( 0 == ( bAtStart = (pStart == pStr--) ) && IsWordDelim( *pStr ))
- ;
- }
- // Asian full stop, full width full stop, full width exclamation mark
- // and full width question marks are treated as word delimiters
- else if ( 0x3002 != *pStr && 0xFF0E != *pStr && 0xFF01 != *pStr &&
- 0xFF1F != *pStr )
- return sal_False; // no valid separator -> no replacement
- }
-
- if( bAtStart ) // at the beginning of a paragraph?
- {
- // 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 )
- {
- // valid separator -> replace
- String sChar( *pWordStt );
- rCC.toUpper( sChar );
- return sChar != *pWordStt &&
- rDoc.ReplaceRange( xub_StrLen( pWordStt - pStart ), 1, sChar );
- }
-
- aText = *pPrevPara;
- bAtStart = sal_False;
- pStart = aText.GetBuffer();
- pStr = pStart + aText.Len();
-
- do { // overwrite all blanks
- --pStr;
- if( !IsWordDelim( *pStr ))
- break;
- } while( 0 == ( bAtStart = (pStart == pStr)) );
-
- if( bAtStart )
- return sal_False; // no valid separator -> no replacement
- }
-
- // 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 )
- {
- sal_Bool bWeiter = sal_True;
- int nFlag = C_NONE;
- do {
- switch( *pStr )
- {
- // Western and Asian full stop
- case '.':
- case 0x3002 :
- case 0xFF0E :
- {
- if( nFlag & C_FULL_STOP )
- return sal_False; // no valid separator -> no replacement
- nFlag |= C_FULL_STOP;
- pExceptStt = pStr;
- }
- break;
- case '!':
- case 0xFF01 :
- {
- if( nFlag & C_EXCLAMATION_MARK )
- return sal_False; // no valid separator -> no replacement
- nFlag |= C_EXCLAMATION_MARK;
- }
- break;
- case '?':
- case 0xFF1F :
- {
- if( nFlag & C_QUESTION_MARK)
- return sal_False; // no valid separator -> no replacement
- nFlag |= C_QUESTION_MARK;
- }
- break;
- default:
- if( !nFlag )
- return sal_False; // no valid separator -> no replacement
- else
- bWeiter = sal_False;
- break;
- }
-
- if( bWeiter && pStr-- == pStart )
- {
- return sal_False; // no valid separator -> no replacement
- }
- } while( bWeiter );
- if( C_FULL_STOP != nFlag )
- pExceptStt = 0;
- }
-
- if( 2 > ( pStr - pStart ) )
- return sal_False;
-
- if( !rCC.isLetterNumeric(
- aText, sal::static_int_cast< xub_StrLen >( pStr-- - pStart ) ) )
- {
- sal_Bool bValid = sal_False, bAlphaFnd = sal_False;
- const sal_Unicode* pTmpStr = pStr;
- while( !bValid )
- {
- if( rCC.isDigit(
- aText,
- sal::static_int_cast< xub_StrLen >( pTmpStr - pStart ) ) )
- {
- bValid = sal_True;
- pStr = pTmpStr - 1;
- }
- else if( rCC.isLetter(
- aText,
- sal::static_int_cast< xub_StrLen >(
- pTmpStr - pStart ) ) )
- {
- if( bAlphaFnd )
- {
- bValid = sal_True;
- pStr = pTmpStr;
- }
- else
- bAlphaFnd = sal_True;
- }
- else if( bAlphaFnd || IsWordDelim( *pTmpStr ) )
- break;
-
- if( pTmpStr == pStart )
- break;
-
- --pTmpStr;
- }
-
- if( !bValid )
- return sal_False; // no valid separator -> no replacement
- }
-
- sal_Bool bNumericOnly = '0' <= *(pStr+1) && *(pStr+1) <= '9';
-
- // Search for the beginning of the word
- while( !IsWordDelim( *pStr ))
- {
- if( bNumericOnly &&
- rCC.isLetter(
- aText, sal::static_int_cast< xub_StrLen >( pStr - pStart ) ) )
- bNumericOnly = sal_False;
-
- if( pStart == pStr )
- break;
-
- --pStr;
- }
-
- if( bNumericOnly ) // consists of only numbers, then not
- return sal_False;
-
- if( IsWordDelim( *pStr ))
- ++pStr;
-
- String sWord;
-
- // check on the basis of the exception list
- if( pExceptStt )
- {
- sWord = String(
- pStr, sal::static_int_cast< xub_StrLen >( pExceptStt - pStr + 1 ) );
- if( FindInCplSttExceptList(eLang, sWord) )
- return sal_False;
-
- // 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 );
-
- // 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;
- if( nLen + 1 < sTmp.Len() )
- sTmp.Erase( nLen + 1 );
-
- if( sTmp.Len() && sTmp.Len() != sWord.Len() &&
- FindInCplSttExceptList(eLang, sTmp))
- return sal_False;
-
- if(FindInCplSttExceptList(eLang, sWord, sal_True))
- return sal_False;
- }
-
- // 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 );
-
- // Parahaps someone wants to have the word
- if( bRet && SaveWordCplSttLst & nFlags )
- rDoc.SaveCpltSttWord( CptlSttSntnc, nSttPos, sWord, cSave );
-
- return bRet;
-}
-
-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
-{
- sal_Unicode cRet = bSttQuote ? ( '\"' == cInsChar
- ? GetStartDoubleQuote()
- : GetStartSingleQuote() )
- : ( '\"' == cInsChar
- ? GetEndDoubleQuote()
- : GetEndSingleQuote() );
- if( !cRet )
- {
- // then through the Language find the right character
- if( LANGUAGE_NONE == eLang )
- cRet = cInsChar;
- else
- {
- LocaleDataWrapper& rLcl = GetLocaleDataWrapper( eLang );
- String sRet( bSttQuote
- ? ( '\"' == cInsChar
- ? rLcl.getDoubleQuotationMarkStart()
- : rLcl.getQuotationMarkStart() )
- : ( '\"' == cInsChar
- ? rLcl.getDoubleQuotationMarkEnd()
- : rLcl.getQuotationMarkEnd() ));
- cRet = sRet.Len() ? sRet.GetChar( 0 ) : cInsChar;
- }
- }
- return cRet;
-}
-
-void SvxAutoCorrect::InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos,
- sal_Unicode cInsChar, sal_Bool bSttQuote,
- sal_Bool bIns )
-{
- LanguageType eLang = rDoc.GetLanguage( nInsPos, sal_False );
- sal_Unicode cRet = GetQuote( cInsChar, bSttQuote, eLang );
-
- String sChg( cInsChar );
- if( bIns )
- rDoc.Insert( nInsPos, sChg );
- else
- rDoc.Replace( nInsPos, sChg );
-
- sChg = cRet;
-
- if( '\"' == cInsChar )
- {
- if( LANGUAGE_SYSTEM == eLang )
- eLang = GetAppLang();
- switch( eLang )
- {
- case LANGUAGE_FRENCH:
- case LANGUAGE_FRENCH_BELGIAN:
- case LANGUAGE_FRENCH_CANADIAN:
- case LANGUAGE_FRENCH_SWISS:
- case LANGUAGE_FRENCH_LUXEMBOURG:
- {
- String s( static_cast< sal_Unicode >(0xA0) );
- // UNICODE code for no break space
- if( rDoc.Insert( bSttQuote ? nInsPos+1 : nInsPos, s ))
- {
- if( !bSttQuote )
- ++nInsPos;
- }
- }
- break;
- }
- }
-
- rDoc.Replace( nInsPos, sChg );
-}
-
-String SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos,
- sal_Unicode cInsChar, sal_Bool bSttQuote )
-{
- LanguageType eLang = rDoc.GetLanguage( nInsPos, sal_False );
- sal_Unicode cRet = GetQuote( cInsChar, bSttQuote, eLang );
-
- String sRet( cRet );
-
- if( '\"' == cInsChar )
- {
- if( LANGUAGE_SYSTEM == eLang )
- eLang = GetAppLang();
- switch( eLang )
- {
- case LANGUAGE_FRENCH:
- case LANGUAGE_FRENCH_BELGIAN:
- case LANGUAGE_FRENCH_CANADIAN:
- case LANGUAGE_FRENCH_SWISS:
- case LANGUAGE_FRENCH_LUXEMBOURG:
- if( bSttQuote )
- sRet += ' ';
- else
- sRet.Insert( ' ', 0 );
- break;
- }
- }
- return sRet;
-}
-
-sal_uLong SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt,
- xub_StrLen nInsPos, sal_Unicode cChar,
- sal_Bool bInsert, Window* pFrameWin )
-{
- sal_uLong nRet = 0;
- bool bIsNextRun = bRunNext;
- bRunNext = false; // if it was set, then it has to be turned off
-
- do{ // only for middle check loop !!
- if( cChar )
- {
- // Prevent double space
- if( nInsPos && ' ' == cChar &&
- IsAutoCorrFlag( IgnoreDoubleSpace ) &&
- ' ' == rTxt.GetChar( nInsPos - 1 ) )
- {
- nRet = IgnoreDoubleSpace;
- break;
- }
-
- sal_Bool bSingle = '\'' == cChar;
- sal_Bool bIsReplaceQuote =
- (IsAutoCorrFlag( ChgQuotes ) && ('\"' == cChar )) ||
- (IsAutoCorrFlag( ChgSglQuotes ) && bSingle );
- if( bIsReplaceQuote )
- {
- sal_Unicode cPrev;
- sal_Bool bSttQuote = !nInsPos ||
- IsWordDelim( ( cPrev = rTxt.GetChar( nInsPos-1 ))) ||
- lcl_IsInAsciiArr( "([{", cPrev ) ||
- ( cEmDash && cEmDash == cPrev ) ||
- ( cEnDash && cEnDash == cPrev );
-
- InsertQuote( rDoc, nInsPos, cChar, bSttQuote, bInsert );
- nRet = bSingle ? ChgSglQuotes : ChgQuotes;
- break;
- }
-
- if( bInsert )
- rDoc.Insert( nInsPos, cChar );
- else
- rDoc.Replace( nInsPos, cChar );
-
- // Hardspaces autocorrection
- if ( IsAutoCorrFlag( AddNonBrkSpace ) )
- {
- if ( NeedsHardspaceAutocorr( cChar ) &&
- FnAddNonBrkSpace( rDoc, rTxt, 0, nInsPos, rDoc.GetLanguage( nInsPos, sal_False ) ) )
- {
- nRet = AddNonBrkSpace;
- }
- else if ( bIsNextRun && !IsAutoCorrectChar( cChar ) )
- {
- // Remove the NBSP if it wasn't an autocorrection
- if ( nInsPos != 0 && NeedsHardspaceAutocorr( rTxt.GetChar( nInsPos - 1 ) ) &&
- cChar != ' ' && cChar != '\t' && cChar != CHAR_HARDBLANK )
- {
- // Look for the last HARD_SPACE
- xub_StrLen nPos = nInsPos - 1;
- bool bContinue = true;
- while ( bContinue )
- {
- const sal_Unicode cTmpChar = rTxt.GetChar( nPos );
- if ( cTmpChar == CHAR_HARDBLANK )
- {
- rDoc.Delete( nPos, nPos + 1 );
- nRet = AddNonBrkSpace;
- bContinue = false;
- }
- else if ( !NeedsHardspaceAutocorr( cTmpChar ) || nPos == 0 )
- bContinue = false;
- nPos--;
- }
- }
- }
- }
- }
-
- if( !nInsPos )
- break;
-
- xub_StrLen nPos = nInsPos - 1;
-
- if( IsWordDelim( rTxt.GetChar( nPos )))
- break;
-
- // Set bold or underline automatically?
- if( '*' == cChar || '_' == cChar )
- {
- if( IsAutoCorrFlag( ChgWeightUnderl ) &&
- FnChgWeightUnderl( rDoc, rTxt, 0, nPos+1 ) )
- nRet = ChgWeightUnderl;
- break;
- }
-
- while( nPos && !IsWordDelim( rTxt.GetChar( --nPos )))
- ;
-
- // Found a Paragraph-start or a Blank, search for the word shortcut in
- // auto.
- xub_StrLen nCapLttrPos = nPos+1; // on the 1st Character
- if( !nPos && !IsWordDelim( rTxt.GetChar( 0 )))
- --nCapLttrPos; // Absatz Anfang und kein Blank !
-
- LanguageType eLang = rDoc.GetLanguage( nCapLttrPos, sal_False );
- if( LANGUAGE_SYSTEM == eLang )
- eLang = MsLangId::getSystemLanguage();
- CharClass& rCC = GetCharClass( eLang );
-
- // no symbol characters
- if( lcl_IsSymbolChar( rCC, rTxt, nCapLttrPos, nInsPos ))
- break;
-
- if( IsAutoCorrFlag( Autocorrect ) )
- {
- const String* pPara = 0;
- const String** ppPara = IsAutoCorrFlag(CptlSttSntnc) ? &pPara : 0;
-
- sal_Bool bChgWord = rDoc.ChgAutoCorrWord( nCapLttrPos, nInsPos,
- *this, ppPara );
- if( !bChgWord )
- {
- xub_StrLen nCapLttrPos1 = nCapLttrPos, nInsPos1 = nInsPos;
- while( nCapLttrPos1 < nInsPos &&
- lcl_IsInAsciiArr( sImplSttSkipChars, rTxt.GetChar( nCapLttrPos1 ) )
- )
- ++nCapLttrPos1;
- while( nCapLttrPos1 < nInsPos1 && nInsPos1 &&
- lcl_IsInAsciiArr( sImplEndSkipChars, rTxt.GetChar( nInsPos1-1 ) )
- )
- --nInsPos1;
-
- if( (nCapLttrPos1 != nCapLttrPos || nInsPos1 != nInsPos ) &&
- nCapLttrPos1 < nInsPos1 &&
- rDoc.ChgAutoCorrWord( nCapLttrPos1, nInsPos1, *this, ppPara ))
- {
- bChgWord = sal_True;
- nCapLttrPos = nCapLttrPos1;
- }
- }
-
- if( bChgWord )
- {
- nRet = Autocorrect;
- if( pPara )
- {
- xub_StrLen nEnd = nCapLttrPos;
- while( nEnd < pPara->Len() &&
- !IsWordDelim( pPara->GetChar( nEnd )))
- ++nEnd;
-
- // Capital letter at beginning of paragraph?
- if( IsAutoCorrFlag( CptlSttSntnc ) &&
- FnCptlSttSntnc( rDoc, *pPara, sal_False,
- nCapLttrPos, nEnd, eLang ) )
- nRet |= CptlSttSntnc;
-
- if( IsAutoCorrFlag( ChgToEnEmDash ) &&
- FnChgToEnEmDash( rDoc, rTxt, nCapLttrPos, nEnd, eLang ) )
- nRet |= ChgToEnEmDash;
- }
- break;
- }
- }
-
- if( ( IsAutoCorrFlag( nRet = ChgOrdinalNumber ) &&
- FnChgOrdinalNumber( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) ) ||
- ( IsAutoCorrFlag( nRet = SetINetAttr ) &&
- ( ' ' == cChar || '\t' == cChar || 0x0a == cChar || !cChar ) &&
- FnSetINetAttr( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) ) )
- ;
- else
- {
- bool bLockKeyOn = pFrameWin && (pFrameWin->GetIndicatorState() & INDICATOR_CAPSLOCK);
-
- nRet = 0;
- 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;
-
- // Two capital letters at beginning of word ??
- if( IsAutoCorrFlag( CptlSttWrd ) &&
- FnCptlSttWrd( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) )
- nRet |= CptlSttWrd;
-
- if( IsAutoCorrFlag( ChgToEnEmDash ) &&
- FnChgToEnEmDash( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) )
- nRet |= ChgToEnEmDash;
- }
-
- } while( sal_False );
-
- if( nRet )
- {
- const char* aHelpIds[] =
- {
- HID_AUTOCORR_HELP_WORD,
- HID_AUTOCORR_HELP_SENT,
- HID_AUTOCORR_HELP_SENTWORD,
- HID_AUTOCORR_HELP_ACORWORD,
- "",
- HID_AUTOCORR_HELP_ACORSENTWORD,
- "",
- HID_AUTOCORR_HELP_CHGTOENEMDASH,
- HID_AUTOCORR_HELP_WORDENEMDASH,
- HID_AUTOCORR_HELP_SENTENEMDASH,
- HID_AUTOCORR_HELP_SENTWORDENEMDASH,
- HID_AUTOCORR_HELP_ACORWORDENEMDASH,
- "",
- HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH,
- "",
- HID_AUTOCORR_HELP_CHGQUOTES,
- HID_AUTOCORR_HELP_CHGSGLQUOTES,
- HID_AUTOCORR_HELP_SETINETATTR,
- HID_AUTOCORR_HELP_INGNOREDOUBLESPACE,
- HID_AUTOCORR_HELP_CHGWEIGHTUNDERL,
- HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL,
- HID_AUTOCORR_HELP_CHGORDINALNUMBER
- };
-
- sal_uLong nHelpId = 0;
- if( nRet & ( Autocorrect|CptlSttSntnc|CptlSttWrd|ChgToEnEmDash ) )
- {
- // from 0 - 15
- if( nRet & ChgToEnEmDash )
- nHelpId += 8;
- if( nRet & Autocorrect )
- nHelpId += 4;
- if( nRet & CptlSttSntnc )
- nHelpId += 2;
- if( nRet & CptlSttWrd )
- nHelpId += 1;
- }
- else
- {
- if( nRet & ChgQuotes) nHelpId = 16;
- else if( nRet & ChgSglQuotes) nHelpId = 17;
- else if( nRet & SetINetAttr) nHelpId = 18;
- else if( nRet & IgnoreDoubleSpace) nHelpId = 19;
- else if( nRet & ChgWeightUnderl) nHelpId = 20;
- else if( nRet & AddNonBrkSpace) nHelpId = 21;
- else if( nRet & ChgOrdinalNumber) nHelpId = 22;
- }
-
- if( nHelpId )
- {
- nHelpId -= 1;
- Application::GetHelp()->OpenHelpAgent( aHelpIds[nHelpId] );
- }
- }
-
-
- return nRet;
-}
-
-SvxAutoCorrectLanguageLists& SvxAutoCorrect::_GetLanguageList(
- LanguageType eLang )
-{
- if( !pLangTable->IsKeyValid( sal_uLong( eLang )))
- CreateLanguageFile( eLang, sal_True);
- return *pLangTable->Seek( sal_uLong( eLang ) );
-}
-
-void SvxAutoCorrect::SaveCplSttExceptList( LanguageType eLang )
-{
- if( pLangTable->IsKeyValid( sal_uLong( eLang )))
- {
- SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(sal_uLong(eLang));
- if( pLists )
- pLists->SaveCplSttExceptList();
- }
-#ifdef DBG_UTIL
- else
- {
- OSL_FAIL("Save an empty list? ");
- }
-#endif
-}
-
-void SvxAutoCorrect::SaveWrdSttExceptList(LanguageType eLang)
-{
- if(pLangTable->IsKeyValid(sal_uLong(eLang)))
- {
- SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(sal_uLong(eLang));
- if(pLists)
- pLists->SaveWrdSttExceptList();
- }
-#ifdef DBG_UTIL
- else
- {
- OSL_FAIL("Save an empty list? ");
- }
-#endif
-}
-
- // 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;
- // either the right language is present or it will be this in the general list
- if( pLangTable->IsKeyValid(sal_uLong(eLang)))
- pLists = pLangTable->Seek(sal_uLong(eLang));
- else if(pLangTable->IsKeyValid(sal_uLong(LANGUAGE_DONTKNOW))||
- CreateLanguageFile(LANGUAGE_DONTKNOW, sal_True))
- {
- pLists = pLangTable->Seek(sal_uLong(LANGUAGE_DONTKNOW));
- }
- OSL_ENSURE(pLists, "No auto correction data");
- return pLists->AddToCplSttExceptList(rNew);
-}
-
-
- // Adds a single word. The list will immediately be written to the file!
-sal_Bool SvxAutoCorrect::AddWrtSttException( const String& rNew,
- LanguageType eLang )
-{
- SvxAutoCorrectLanguageListsPtr pLists = 0;
- //either the right language is present or it is set in the general list
- if(pLangTable->IsKeyValid(sal_uLong(eLang)))
- pLists = pLangTable->Seek(sal_uLong(eLang));
- else if(pLangTable->IsKeyValid(sal_uLong(LANGUAGE_DONTKNOW))||
- CreateLanguageFile(LANGUAGE_DONTKNOW, sal_True))
- pLists = pLangTable->Seek(sal_uLong(LANGUAGE_DONTKNOW));
- OSL_ENSURE(pLists, "keine Autokorrekturdatei");
- return pLists->AddToWrdSttExceptList(rNew);
-}
-
-
-
-
-void SvxAutoCorrect::SetUserAutoCorrFileName( const String& rNew )
-{
- if( sUserAutoCorrFile != rNew )
- {
- sUserAutoCorrFile = rNew;
-
- // if the lists are set, they must now be deleted
- lcl_ClearTable(*pLangTable);
- nFlags &= ~(CplSttLstLoad | WrdSttLstLoad | ChgWordLstLoad );
- }
-}
-
-void SvxAutoCorrect::SetShareAutoCorrFileName( const String& rNew )
-{
- if( sShareAutoCorrFile != rNew )
- {
- sShareAutoCorrFile = rNew;
-
- // if the lists are set, they must now be deleted
- lcl_ClearTable(*pLangTable);
- nFlags &= ~(CplSttLstLoad | WrdSttLstLoad | ChgWordLstLoad );
- }
-}
-
-
-sal_Bool SvxAutoCorrect::GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc,
- const String& rTxt, xub_StrLen nPos,
- String& rWord ) const
-{
- if( !nPos )
- return sal_False;
-
- xub_StrLen nEnde = nPos;
-
- // it must be followed by a blank or tab!
- if( ( nPos < rTxt.Len() &&
- !IsWordDelim( rTxt.GetChar( nPos ))) ||
- IsWordDelim( rTxt.GetChar( --nPos )))
- return sal_False;
-
- while( nPos && !IsWordDelim( rTxt.GetChar( --nPos )))
- ;
-
- // 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; // Beginning of pargraph and no Blank!
-
- while( lcl_IsInAsciiArr( sImplSttSkipChars, rTxt.GetChar( nCapLttrPos )) )
- if( ++nCapLttrPos >= nEnde )
- return sal_False;
-
- if( 3 > nEnde - nCapLttrPos )
- return sal_False;
-
- LanguageType eLang = rDoc.GetLanguage( nCapLttrPos, sal_False );
- if( LANGUAGE_SYSTEM == eLang )
- eLang = MsLangId::getSystemLanguage();
-
- SvxAutoCorrect* pThis = (SvxAutoCorrect*)this;
- CharClass& rCC = pThis->GetCharClass( eLang );
-
- if( lcl_IsSymbolChar( rCC, rTxt, nCapLttrPos, nEnde ))
- return sal_False;
-
- rWord = rTxt.Copy( nCapLttrPos, nEnde - nCapLttrPos );
- return sal_True;
-}
-
-sal_Bool SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, sal_Bool bNewFile )
-{
- OSL_ENSURE(!pLangTable->IsKeyValid(sal_uLong(eLang)), "Language already exists ");
-
- String sUserDirFile( GetAutoCorrFileName( eLang, sal_True, sal_False )),
- sShareDirFile( sUserDirFile );
- SvxAutoCorrectLanguageListsPtr pLists = 0;
-
- Time nMinTime( 0, 2 ), nAktTime, nLastCheckTime;
- sal_uLong nFndPos;
- if( TABLE_ENTRY_NOTFOUND !=
- pLastFileTable->SearchKey( sal_uLong( eLang ), &nFndPos ) &&
- ( nLastCheckTime.SetTime( pLastFileTable->GetObject( nFndPos )),
- nLastCheckTime < nAktTime ) &&
- ( nAktTime - nLastCheckTime ) < nMinTime )
- {
- // no need to test the file, because the last check is not older then
- // 2 minutes.
- if( bNewFile )
- {
- sShareDirFile = sUserDirFile;
- pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile,
- sUserDirFile, eLang );
- pLangTable->Insert( sal_uLong(eLang), pLists );
- pLastFileTable->Remove( sal_uLong( eLang ) );
- }
- }
- else if( ( FStatHelper::IsDocument( sUserDirFile ) ||
- FStatHelper::IsDocument( sShareDirFile =
- GetAutoCorrFileName( eLang, sal_False, sal_False ) ) ) ||
- ( sShareDirFile = sUserDirFile, bNewFile ))
- {
- pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile,
- sUserDirFile, eLang );
- pLangTable->Insert( sal_uLong(eLang), pLists );
- pLastFileTable->Remove( sal_uLong( eLang ) );
- }
- else if( !bNewFile )
- {
- if( !pLastFileTable->Insert( sal_uLong( eLang ), nAktTime.GetTime() ))
- pLastFileTable->Replace( sal_uLong( eLang ), nAktTime.GetTime() );
- }
- return pLists != 0;
-}
-
-sal_Bool SvxAutoCorrect::PutText( const String& rShort, const String& rLong,
- LanguageType eLang )
-{
- sal_Bool bRet = sal_False;
- if( pLangTable->IsKeyValid( sal_uLong(eLang)) || CreateLanguageFile(eLang) )
- bRet = pLangTable->Seek( sal_uLong(eLang) )->PutText(rShort, rLong);
- return bRet;
-}
-
-
- // - Delete an entry
-sal_Bool SvxAutoCorrect::DeleteText( const String& rShort, LanguageType eLang )
-{
- sal_Bool bRet = sal_False;
- if( pLangTable->IsKeyValid( sal_uLong( eLang )) )
- bRet = pLangTable->Seek( sal_uLong( eLang ))->DeleteText( rShort );
- return bRet;
-}
-
-
- // - 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 with attribution (only the SWG - SWG format!)
-sal_Bool SvxAutoCorrect::PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String&, const String&, SfxObjectShell&,
- String& )
-{
- return sal_False;
-}
-
-void EncryptBlockName_Imp( String& rName )
-{
- xub_StrLen nLen, nPos = 1;
- rName.Insert( '#', 0 );
- sal_Unicode* pName = rName.GetBufferAccess();
- for ( nLen = rName.Len(), ++pName; nPos < nLen; ++nPos, ++pName )
- {
- if( lcl_IsInAsciiArr( "!/:.\\", *pName ))
- *pName &= 0x0f;
- }
-}
-
-/* This code is copied from SwXMLTextBlocks::GeneratePackageName */
-void GeneratePackageName ( const String& rShort, String& rPackageName )
-{
- rPackageName = rShort;
- xub_StrLen nPos = 0;
- sal_Unicode pDelims[] = { '!', '/', ':', '.', '\\', 0 };
- ByteString sByte ( rPackageName, RTL_TEXTENCODING_UTF7);
- rPackageName = String (sByte, RTL_TEXTENCODING_ASCII_US);
- while( STRING_NOTFOUND != ( nPos = rPackageName.SearchChar( pDelims, nPos )))
- {
- rPackageName.SetChar( nPos, '_' );
- ++nPos;
- }
-}
-
-const SvxAutocorrWord* lcl_SearchWordsInList(
- SvxAutoCorrectLanguageListsPtr pList, const String& rTxt,
- xub_StrLen& rStt, xub_StrLen nEndPos, SvxAutoCorrDoc& )
-{
- const SvxAutocorrWordList* pAutoCorrWordList = pList->GetAutocorrWordList();
- TransliterationWrapper& rCmp = GetIgnoreTranslWrapper();
- for( xub_StrLen nPos = 0; nPos < pAutoCorrWordList->Count(); ++nPos )
- {
- const SvxAutocorrWord* pFnd = (*pAutoCorrWordList)[ nPos ];
- const String& rChk = pFnd->GetShort();
- if( nEndPos >= rChk.Len() )
- {
- xub_StrLen nCalcStt = nEndPos - rChk.Len();
- if( ( !nCalcStt || nCalcStt == rStt ||
- ( nCalcStt < rStt &&
- IsWordDelim( rTxt.GetChar(nCalcStt - 1 ) ))) )
- {
- String sWord( rTxt.GetBuffer() + nCalcStt, rChk.Len() );
- if( rCmp.isEqual( rChk, sWord ))
- {
- rStt = nCalcStt;
- return pFnd;
- }
- }
- }
- }
- return 0;
-}
-
-
-// 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 )
-{
- LanguageType eLang = rLang;
- const SvxAutocorrWord* pRet = 0;
- if( LANGUAGE_SYSTEM == eLang )
- eLang = MsLangId::getSystemLanguage();
-
- // First search for eLang, then US-English -> English
- // and last in LANGUAGE_DONTKNOW
- if( pLangTable->IsKeyValid( sal_uLong( eLang ) ) ||
- CreateLanguageFile( eLang, sal_False ))
- {
- //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 )
- {
- rLang = eLang;
- return pRet;
- }
- }
-
- // 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 &&
- ( pLangTable->IsKeyValid( nTmpKey1 ) ||
- CreateLanguageFile( LanguageType( nTmpKey1 ), sal_False ) )) ||
- (( nTmp = nTmpKey2) != (sal_uLong)eLang &&
- ( pLangTable->IsKeyValid( nTmpKey2 ) ||
- CreateLanguageFile( LanguageType( nTmpKey2 ), sal_False ) )) )
- {
- //the language is available - so bring it on
- SvxAutoCorrectLanguageListsPtr pList = pLangTable->Seek( nTmp );
- pRet = lcl_SearchWordsInList( pList, rTxt, rStt, nEndPos, rDoc);
- if( pRet )
- {
- rLang = LanguageType( nTmp );
- return pRet;
- }
- }
- if( pLangTable->IsKeyValid( sal_uLong( LANGUAGE_DONTKNOW ) ) ||
- CreateLanguageFile( LANGUAGE_DONTKNOW, sal_False ) )
- {
- //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 )
- {
- rLang = LANGUAGE_DONTKNOW;
- return pRet;
- }
- }
- return 0;
-}
-
-sal_Bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
- const String& sWord )
-{
- // 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 ) )
- {
- //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;
-
- }
- // If it still could not be found here, then keep on searching
- sal_uLong nTmp;
- if( ((nTmp = nTmpKey1) != (sal_uLong)eLang &&
- ( pLangTable->IsKeyValid( nTmpKey1 ) ||
- CreateLanguageFile( LanguageType( nTmpKey1 ), sal_False ) )) ||
- (( nTmp = nTmpKey2) != (sal_uLong)eLang &&
- ( pLangTable->IsKeyValid( nTmpKey2 ) ||
- CreateLanguageFile( LanguageType( nTmpKey2 ), sal_False ) )) )
- {
- //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))
- {
- //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;
-}
-
-sal_Bool lcl_FindAbbreviation( const SvStringsISortDtor* pList, const String& sWord)
-{
- String sAbk( '~' );
- sal_uInt16 nPos;
- pList->Seek_Entry( &sAbk, &nPos );
- if( nPos < pList->Count() )
- {
- String sLowerWord( sWord ); sLowerWord.ToLowerAscii();
- const String* pAbk;
- for( sal_uInt16 n = nPos;
- n < pList->Count() &&
- '~' == ( pAbk = (*pList)[ n ])->GetChar( 0 );
- ++n )
- {
- // ~ 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 ) // agrees
- return sal_True;
-
- if( sLowerAbk.GetChar( i ) != sLowerWord.GetChar( --ii ))
- break;
- }
- }
- }
- }
- OSL_ENSURE( !(nPos && '~' == (*pList)[ --nPos ]->GetChar( 0 ) ),
- "Wrongly sorted exception list?" );
- return sal_False;
-}
-
-sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
- const String& sWord, sal_Bool bAbbreviation)
-{
- // First search for eLang, then US-English -> English
- // and last in LANGUAGE_DONTKNOW
- sal_uLong nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE
- sal_uLong nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
- String sTemp( sWord );
- if( pLangTable->IsKeyValid( sal_uLong( eLang )) ||
- CreateLanguageFile( eLang, sal_False ))
- {
- //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;
- }
- // If it still could not be found here, then keep on searching
- sal_uLong nTmp;
-
- if( ((nTmp = nTmpKey1) != (sal_uLong)eLang &&
- ( pLangTable->IsKeyValid( nTmpKey1 ) ||
- CreateLanguageFile( LanguageType( nTmpKey1 ), sal_False ) )) ||
- (( nTmp = nTmpKey2) != (sal_uLong)eLang &&
- ( pLangTable->IsKeyValid( nTmpKey2 ) ||
- CreateLanguageFile( LanguageType( nTmpKey2 ), sal_False ) )) )
- {
- //the language is available - so bring it on
- SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(nTmp);
- const SvStringsISortDtor* pList = pLists->GetCplSttExceptList();
- if(bAbbreviation ? lcl_FindAbbreviation( pList, sWord)
- : pList->Seek_Entry( &sTemp ) )
- return sal_True;
- }
- if(pLangTable->IsKeyValid(sal_uLong(LANGUAGE_DONTKNOW))|| CreateLanguageFile(LANGUAGE_DONTKNOW, sal_False))
- {
- //the language is available - so bring it on
- SvxAutoCorrectLanguageListsPtr pLists = pLangTable->Seek(LANGUAGE_DONTKNOW);
- const SvStringsISortDtor* pList = pLists->GetCplSttExceptList();
- if(bAbbreviation ? lcl_FindAbbreviation( pList, sWord)
- : pList->Seek_Entry( &sTemp ) )
- return sal_True;
- }
- return sal_False;
-
-}
-
-String SvxAutoCorrect::GetAutoCorrFileName( LanguageType eLang,
- sal_Bool bNewFile, sal_Bool bTst ) const
-{
- String sRet, sExt( MsLangId::convertLanguageToIsoString( eLang ) );
- sExt.Insert('_', 0);
- sExt.AppendAscii( ".dat" );
- if( bNewFile )
- ( sRet = sUserAutoCorrFile ) += sExt;
- else if( !bTst )
- ( sRet = sShareAutoCorrFile ) += sExt;
- else
- {
- // test first in the user directory - if not exist, then
- ( sRet = sUserAutoCorrFile ) += sExt;
- if( !FStatHelper::IsDocument( sRet ))
- ( sRet = sShareAutoCorrFile ) += sExt;
- }
- return sRet;
-}
-
-SvxAutoCorrectLanguageLists::SvxAutoCorrectLanguageLists(
- SvxAutoCorrect& rParent,
- const String& rShareAutoCorrectFile,
- const String& rUserAutoCorrectFile,
- LanguageType eLang)
-: sShareAutoCorrFile( rShareAutoCorrectFile ),
- sUserAutoCorrFile( rUserAutoCorrectFile ),
- eLanguage(eLang),
- pCplStt_ExcptLst( 0 ),
- pWrdStt_ExcptLst( 0 ),
- pAutocorr_List( 0 ),
- rAutoCorrect(rParent),
- nFlags(0)
-{
-}
-
-SvxAutoCorrectLanguageLists::~SvxAutoCorrectLanguageLists()
-{
- delete pCplStt_ExcptLst;
- delete pWrdStt_ExcptLst;
- delete pAutocorr_List;
-}
-
-sal_Bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp()
-{
- // 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 || // overflow?
- ( nAktTime -= aLastCheckTime ) > nMinTime ) // min time past
- {
- Date aTstDate; Time aTstTime;
- if( FStatHelper::GetModifiedDateTimeOfFile( sShareAutoCorrFile,
- &aTstDate, &aTstTime ) &&
- ( aModifiedDate != aTstDate || aModifiedTime != aTstTime ))
- {
- bRet = sal_True;
- // then remove all the lists fast!
- if( CplSttLstLoad & nFlags && pCplStt_ExcptLst )
- delete pCplStt_ExcptLst, pCplStt_ExcptLst = 0;
- if( WrdSttLstLoad & nFlags && pWrdStt_ExcptLst )
- delete pWrdStt_ExcptLst, pWrdStt_ExcptLst = 0;
- if( ChgWordLstLoad & nFlags && pAutocorr_List )
- delete pAutocorr_List, pAutocorr_List = 0;
- nFlags &= ~(CplSttLstLoad | WrdSttLstLoad | ChgWordLstLoad );
- }
- aLastCheckTime = Time();
- }
- return bRet;
-}
-
-void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
- SvStringsISortDtor*& rpLst,
- const sal_Char* pStrmName,
- SotStorageRef& rStg)
-{
- if( rpLst )
- rpLst->DeleteAndDestroy( 0, rpLst->Count() );
- else
- rpLst = new SvStringsISortDtor( 16, 16 );
-
- {
- String sStrmName( pStrmName, RTL_TEXTENCODING_MS_1252 );
- String sTmp( sStrmName );
-
- if( rStg.Is() && rStg->IsStream( sStrmName ) )
- {
- SvStorageStreamRef xStrm = rStg->OpenSotStream( sTmp,
- ( STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE ) );
- if( SVSTREAM_OK != xStrm->GetError())
- {
- xStrm.Clear();
- rStg.Clear();
- RemoveStream_Imp( sStrmName );
- }
- else
- {
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
- comphelper::getProcessServiceFactory();
- OSL_ENSURE( xServiceFactory.is(),
- "XMLReader::Read: got no service manager" );
- if( !xServiceFactory.is() )
- {
- // Throw an exception ?
- }
-
- xml::sax::InputSource aParserInput;
- aParserInput.sSystemId = sStrmName;
-
- xStrm->Seek( 0L );
- xStrm->SetBufferSize( 8 * 1024 );
- aParserInput.aInputStream = new utl::OInputStreamWrapper( *xStrm );
-
- // get parser
- 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() )
- {
- // Maybe throw an exception?
- }
-
- // get filter
- uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLExceptionListImport ( xServiceFactory, *rpLst );
-
- // connect parser and filter
- uno::Reference< xml::sax::XParser > xParser( xXMLParser, UNO_QUERY );
- xParser->setDocumentHandler( xFilter );
-
- // parse
- try
- {
- xParser->parseStream( aParserInput );
- }
- catch( xml::sax::SAXParseException& )
- {
- // re throw ?
- }
- catch( xml::sax::SAXException& )
- {
- // re throw ?
- }
- catch( io::IOException& )
- {
- // re throw ?
- }
- }
- }
-
- // Set time stamp
- FStatHelper::GetModifiedDateTimeOfFile( sShareAutoCorrFile,
- &aModifiedDate, &aModifiedTime );
- aLastCheckTime = Time();
- }
-
-}
-
-void SvxAutoCorrectLanguageLists::SaveExceptList_Imp(
- const SvStringsISortDtor& rLst,
- const sal_Char* pStrmName,
- SotStorageRef &rStg,
- sal_Bool bConvert )
-{
- if( rStg.Is() )
- {
- String sStrmName( pStrmName, RTL_TEXTENCODING_MS_1252 );
- if( !rLst.Count() )
- {
- rStg->Remove( sStrmName );
- rStg->Commit();
- }
- else
- {
- SotStorageStreamRef xStrm = rStg->OpenSotStream( sStrmName,
- ( STREAM_READ | STREAM_WRITE | STREAM_SHARE_DENYWRITE ) );
- if( xStrm.Is() )
- {
- xStrm->SetSize( 0 );
- xStrm->SetBufferSize( 8192 );
- String aPropName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("MediaType") ) );
- OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
- uno::Any aAny;
- aAny <<= aMime;
- xStrm->SetProperty( aPropName, aAny );
-
-
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
- comphelper::getProcessServiceFactory();
- OSL_ENSURE( xServiceFactory.is(),
- "XMLReader::Read: got no service manager" );
- if( !xServiceFactory.is() )
- {
- // Throw an exception ?
- }
-
- uno::Reference < XInterface > xWriter (xServiceFactory->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"))));
- 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);
-
- SvXMLExceptionListExport aExp( xServiceFactory, rLst, sStrmName, xHandler );
-
- aExp.exportDoc( XML_BLOCK_LIST );
-
- xStrm->Commit();
- if( xStrm->GetError() == SVSTREAM_OK )
- {
- xStrm.Clear();
- if (!bConvert)
- {
- rStg->Commit();
- if( SVSTREAM_OK != rStg->GetError() )
- {
- rStg->Remove( sStrmName );
- rStg->Commit();
- }
- }
- }
- }
- }
- }
-}
-
-SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList()
-{
- if( pAutocorr_List )
- pAutocorr_List->DeleteAndDestroy( 0, pAutocorr_List->Count() );
- else
- pAutocorr_List = new SvxAutocorrWordList( 16, 16 );
-
- SvStringsDtor aRemoveArr;
- try
- {
- uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sShareAutoCorrFile, embed::ElementModes::READ );
- String aXMLWordListName( pXMLImplAutocorr_ListStr, RTL_TEXTENCODING_MS_1252 );
- uno::Reference < io::XStream > xStrm = xStg->openStreamElement( aXMLWordListName, embed::ElementModes::READ );
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory();
-
- xml::sax::InputSource aParserInput;
- aParserInput.sSystemId = aXMLWordListName;
- aParserInput.aInputStream = xStrm->getInputStream();
-
- // get parser
- 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 );
-
- // connect parser and filter
- uno::Reference< xml::sax::XParser > xParser( xXMLParser, UNO_QUERY );
- xParser->setDocumentHandler( xFilter );
-
- // parse
- xParser->parseStream( aParserInput );
- }
- }
- catch ( uno::Exception& )
- {
- }
-
- // Set time stamp
- FStatHelper::GetModifiedDateTimeOfFile( sShareAutoCorrFile,
- &aModifiedDate, &aModifiedTime );
- aLastCheckTime = Time();
-
- return pAutocorr_List;
-}
-
-void SvxAutoCorrectLanguageLists::SetAutocorrWordList( SvxAutocorrWordList* pList )
-{
- if( pAutocorr_List && pList != pAutocorr_List )
- delete pAutocorr_List;
- pAutocorr_List = pList;
- if( !pAutocorr_List )
- {
- OSL_ENSURE( !this, "No valid list" );
- pAutocorr_List = new SvxAutocorrWordList( 16, 16 );
- }
- nFlags |= ChgWordLstLoad;
-}
-
-const SvxAutocorrWordList* SvxAutoCorrectLanguageLists::GetAutocorrWordList()
-{
- if( !( ChgWordLstLoad & nFlags ) || IsFileChanged_Imp() )
- SetAutocorrWordList( LoadAutocorrWordList() );
- return pAutocorr_List;
-}
-
-SvStringsISortDtor* SvxAutoCorrectLanguageLists::GetCplSttExceptList()
-{
- if( !( CplSttLstLoad & nFlags ) || IsFileChanged_Imp() )
- SetCplSttExceptList( LoadCplSttExceptList() );
- return pCplStt_ExcptLst;
-}
-
-sal_Bool SvxAutoCorrectLanguageLists::AddToCplSttExceptList(const String& rNew)
-{
- String* pNew = new String( rNew );
- if( rNew.Len() && GetCplSttExceptList()->Insert( pNew ) )
- {
- MakeUserStorage_Impl();
- SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True );
-
- SaveExceptList_Imp( *pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg );
-
- xStg = 0;
- // Set time stamp
- FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile,
- &aModifiedDate, &aModifiedTime );
- aLastCheckTime = Time();
- }
- else
- delete pNew, pNew = 0;
- return 0 != pNew;
-}
-
-sal_Bool SvxAutoCorrectLanguageLists::AddToWrdSttExceptList(const String& rNew)
-{
- String* pNew = new String( rNew );
- SvStringsISortDtor* pExceptList = LoadWrdSttExceptList();
- if( rNew.Len() && pExceptList && pExceptList->Insert( pNew ) )
- {
- MakeUserStorage_Impl();
- SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True );
-
- SaveExceptList_Imp( *pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg );
-
- xStg = 0;
- // Set time stamp
- FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile,
- &aModifiedDate, &aModifiedTime );
- aLastCheckTime = Time();
- }
- else
- delete pNew, pNew = 0;
- return 0 != pNew;
-}
-
-SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadCplSttExceptList()
-{
- SotStorageRef xStg = new SotStorage( sShareAutoCorrFile, STREAM_READ | STREAM_SHARE_DENYNONE, sal_True );
- String sTemp ( RTL_CONSTASCII_USTRINGPARAM ( pXMLImplCplStt_ExcptLstStr ) );
- if( xStg.Is() && xStg->IsContained( sTemp ) )
- LoadXMLExceptList_Imp( pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg );
-
- return pCplStt_ExcptLst;
-}
-
-void SvxAutoCorrectLanguageLists::SaveCplSttExceptList()
-{
- MakeUserStorage_Impl();
- SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True );
-
- SaveExceptList_Imp( *pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg );
-
- xStg = 0;
-
- // Set time stamp
- FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile,
- &aModifiedDate, &aModifiedTime );
- aLastCheckTime = Time();
-}
-
-void SvxAutoCorrectLanguageLists::SetCplSttExceptList( SvStringsISortDtor* pList )
-{
- if( pCplStt_ExcptLst && pList != pCplStt_ExcptLst )
- delete pCplStt_ExcptLst;
-
- pCplStt_ExcptLst = pList;
- if( !pCplStt_ExcptLst )
- {
- OSL_ENSURE( !this, "No valid list" );
- pCplStt_ExcptLst = new SvStringsISortDtor( 16, 16 );
- }
- nFlags |= CplSttLstLoad;
-}
-
-SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadWrdSttExceptList()
-{
- SotStorageRef xStg = new SotStorage( sShareAutoCorrFile, STREAM_READ | STREAM_SHARE_DENYNONE, sal_True );
- String sTemp ( RTL_CONSTASCII_USTRINGPARAM ( pXMLImplWrdStt_ExcptLstStr ) );
- if( xStg.Is() && xStg->IsContained( sTemp ) )
- LoadXMLExceptList_Imp( pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg );
- return pWrdStt_ExcptLst;
-}
-
-void SvxAutoCorrectLanguageLists::SaveWrdSttExceptList()
-{
- MakeUserStorage_Impl();
- SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True );
-
- SaveExceptList_Imp( *pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg );
-
- xStg = 0;
- // Set time stamp
- FStatHelper::GetModifiedDateTimeOfFile( sUserAutoCorrFile,
- &aModifiedDate, &aModifiedTime );
- aLastCheckTime = Time();
-}
-
-void SvxAutoCorrectLanguageLists::SetWrdSttExceptList( SvStringsISortDtor* pList )
-{
- if( pWrdStt_ExcptLst && pList != pWrdStt_ExcptLst )
- delete pWrdStt_ExcptLst;
- pWrdStt_ExcptLst = pList;
- if( !pWrdStt_ExcptLst )
- {
- OSL_ENSURE( !this, "No valid list" );
- pWrdStt_ExcptLst = new SvStringsISortDtor( 16, 16 );
- }
- nFlags |= WrdSttLstLoad;
-}
-
-SvStringsISortDtor* SvxAutoCorrectLanguageLists::GetWrdSttExceptList()
-{
- if( !( WrdSttLstLoad & nFlags ) || IsFileChanged_Imp() )
- SetWrdSttExceptList( LoadWrdSttExceptList() );
- return pWrdStt_ExcptLst;
-}
-
-void SvxAutoCorrectLanguageLists::RemoveStream_Imp( const String& rName )
-{
- if( sShareAutoCorrFile != sUserAutoCorrFile )
- {
- SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True );
- if( xStg.Is() && SVSTREAM_OK == xStg->GetError() &&
- xStg->IsStream( rName ) )
- {
- xStg->Remove( rName );
- xStg->Commit();
-
- xStg = 0;
- }
- }
-}
-
-void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
-{
- // The conversion needs to happen if the file is already in the user
- // directory and is in the old format. Additionally it needs to
- // happen when the file is being copied from share to user.
-
- sal_Bool bError = sal_False, bConvert = sal_False, bCopy = sal_False;
- INetURLObject aDest;
- INetURLObject aSource;
-
- if (sUserAutoCorrFile != sShareAutoCorrFile )
- {
- aSource = INetURLObject ( sShareAutoCorrFile );
- aDest = INetURLObject ( sUserAutoCorrFile );
- if ( SotStorage::IsOLEStorage ( sShareAutoCorrFile ) )
- {
- aDest.SetExtension ( String::CreateFromAscii ( "bak" ) );
- bConvert = sal_True;
- }
- bCopy = sal_True;
- }
- else if ( SotStorage::IsOLEStorage ( sUserAutoCorrFile ) )
- {
- aSource = INetURLObject ( sUserAutoCorrFile );
- aDest = INetURLObject ( sUserAutoCorrFile );
- aDest.SetExtension ( String::CreateFromAscii ( "bak" ) );
- bCopy = bConvert = sal_True;
- }
- if (bCopy)
- {
- try
- {
- String sMain(aDest.GetMainURL( INetURLObject::DECODE_TO_IURI ));
- sal_Unicode cSlash = '/';
- xub_StrLen nSlashPos = sMain.SearchBackward(cSlash);
- sMain.Erase(nSlashPos);
- ::ucbhelper::Content aNewContent( sMain, uno::Reference< XCommandEnvironment > ());
- Any aAny;
- TransferInfo aInfo;
- aInfo.NameClash = NameClash::OVERWRITE;
- aInfo.NewTitle = aDest.GetName();
- aInfo.SourceURL = aSource.GetMainURL( INetURLObject::DECODE_TO_IURI );
- aInfo.MoveData = sal_False;
- aAny <<= aInfo;
- aNewContent.executeCommand( OUString ( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), aAny);
- }
- catch (...)
- {
- bError = sal_True;
- }
- }
- if (bConvert && !bError)
- {
- SotStorageRef xSrcStg = new SotStorage( aDest.GetMainURL( INetURLObject::DECODE_TO_IURI ), STREAM_READ, sal_True );
- SotStorageRef xDstStg = new SotStorage( sUserAutoCorrFile, STREAM_WRITE, sal_True );
-
- if( xSrcStg.Is() && xDstStg.Is() )
- {
- String sWord ( RTL_CONSTASCII_USTRINGPARAM ( pImplWrdStt_ExcptLstStr ) );
- String sSentence ( RTL_CONSTASCII_USTRINGPARAM ( pImplCplStt_ExcptLstStr ) );
- String sXMLWord ( RTL_CONSTASCII_USTRINGPARAM ( pXMLImplWrdStt_ExcptLstStr ) );
- String sXMLSentence ( RTL_CONSTASCII_USTRINGPARAM ( pXMLImplCplStt_ExcptLstStr ) );
- SvStringsISortDtor *pTmpWordList = NULL;
-
- if (xSrcStg->IsContained( sXMLWord ) )
- LoadXMLExceptList_Imp( pTmpWordList, pXMLImplWrdStt_ExcptLstStr, xSrcStg );
-
- if (pTmpWordList)
- {
- SaveExceptList_Imp( *pTmpWordList, pXMLImplWrdStt_ExcptLstStr, xDstStg, sal_True );
- pTmpWordList->DeleteAndDestroy( 0, pTmpWordList->Count() );
- pTmpWordList = NULL;
- }
-
-
- if (xSrcStg->IsContained( sXMLSentence ) )
- LoadXMLExceptList_Imp( pTmpWordList, pXMLImplCplStt_ExcptLstStr, xSrcStg );
-
- if (pTmpWordList)
- {
- SaveExceptList_Imp( *pTmpWordList, pXMLImplCplStt_ExcptLstStr, xDstStg, sal_True );
- pTmpWordList->DeleteAndDestroy( 0, pTmpWordList->Count() );
- }
-
- GetAutocorrWordList();
- MakeBlocklist_Imp( *xDstStg );
- sShareAutoCorrFile = sUserAutoCorrFile;
- xDstStg = 0;
- try
- {
- ::ucbhelper::Content aContent ( aDest.GetMainURL( INetURLObject::DECODE_TO_IURI ), uno::Reference < XCommandEnvironment > ());
- aContent.executeCommand ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "delete" ) ), makeAny ( sal_Bool (sal_True ) ) );
- }
- catch (...)
- {
- }
- }
- }
- else if( bCopy && !bError )
- sShareAutoCorrFile = sUserAutoCorrFile;
-}
-
-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 )
- {
- SvStorageStreamRef refList = rStg.OpenSotStream( sStrmName,
- ( STREAM_READ | STREAM_WRITE | STREAM_SHARE_DENYWRITE ) );
- if( refList.Is() )
- {
- refList->SetSize( 0 );
- refList->SetBufferSize( 8192 );
- String aPropName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("MediaType") ) );
- OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
- uno::Any aAny;
- aAny <<= aMime;
- refList->SetProperty( aPropName, aAny );
-
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
- comphelper::getProcessServiceFactory();
- OSL_ENSURE( xServiceFactory.is(),
- "XMLReader::Read: got no service manager" );
- if( !xServiceFactory.is() )
- {
- // Throw an exception ?
- }
-
- uno::Reference < XInterface > xWriter (xServiceFactory->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"))));
- 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);
-
- SvXMLAutoCorrectExport aExp( xServiceFactory, pAutocorr_List, sStrmName, xHandler );
-
- aExp.exportDoc( XML_BLOCK_LIST );
-
- 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;
- }
-
- if( bRemove )
- {
- rStg.Remove( sStrmName );
- rStg.Commit();
- }
-
- return bRet;
-}
-
-sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort,
- const String& rLong )
-{
- // First get the current list!
- GetAutocorrWordList();
-
- MakeUserStorage_Impl();
- SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True );
-
- sal_Bool bRet = xStg.Is() && SVSTREAM_OK == xStg->GetError();
-
- // Update the word list
- if( bRet )
- {
- sal_uInt16 nPos;
- SvxAutocorrWord* pNew = new SvxAutocorrWord( rShort, rLong, sal_True );
- if( pAutocorr_List->Seek_Entry( pNew, &nPos ) )
- {
- if( !(*pAutocorr_List)[ nPos ]->IsTextOnly() )
- {
- // Still have to remove the Storage
- String sStgNm( rShort );
- if (xStg->IsOLEStorage())
- EncryptBlockName_Imp( sStgNm );
- else
- GeneratePackageName ( rShort, sStgNm);
-
- if( xStg->IsContained( sStgNm ) )
- xStg->Remove( sStgNm );
- }
- pAutocorr_List->DeleteAndDestroy( nPos );
- }
-
- if( pAutocorr_List->Insert( pNew ) )
- {
- bRet = MakeBlocklist_Imp( *xStg );
- xStg = 0;
- }
- else
- {
- delete pNew;
- bRet = sal_False;
- }
- }
- return bRet;
-}
-
-sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort,
- SfxObjectShell& rShell )
-{
- // First get the current list!
- GetAutocorrWordList();
-
- MakeUserStorage_Impl();
-
- sal_Bool bRet = sal_False;
- String sLong;
- try
- {
- uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sUserAutoCorrFile, embed::ElementModes::READWRITE );
- bRet = rAutoCorrect.PutText( xStg, sUserAutoCorrFile, rShort, rShell, sLong );
- xStg = 0;
-
- // Update the word list
- if( bRet )
- {
- SvxAutocorrWord* pNew = new SvxAutocorrWord( rShort, sLong, sal_False );
- if( pAutocorr_List->Insert( pNew ) )
- {
- SotStorageRef xStor = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True );
- MakeBlocklist_Imp( *xStor );
- }
- else
- delete pNew;
- }
- }
- catch ( uno::Exception& )
- {
- }
-
- return bRet;
-}
-
-// Delete an entry
-sal_Bool SvxAutoCorrectLanguageLists::DeleteText( const String& rShort )
-{
- // First get the current list!
- GetAutocorrWordList();
-
- MakeUserStorage_Impl();
-
- SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True );
- sal_Bool bRet = xStg.Is() && SVSTREAM_OK == xStg->GetError();
- if( bRet )
- {
- sal_uInt16 nPos;
- SvxAutocorrWord aTmp( rShort, rShort );
- if( pAutocorr_List->Seek_Entry( &aTmp, &nPos ) )
- {
- SvxAutocorrWord* pFnd = (*pAutocorr_List)[ nPos ];
- if( !pFnd->IsTextOnly() )
- {
- String aName( rShort );
- if (xStg->IsOLEStorage())
- EncryptBlockName_Imp( aName );
- else
- GeneratePackageName ( rShort, aName );
- if( xStg->IsContained( aName ) )
- {
- xStg->Remove( aName );
- bRet = xStg->Commit();
- }
-
- }
- // Update the word list
- pAutocorr_List->DeleteAndDestroy( nPos );
- MakeBlocklist_Imp( *xStg );
- xStg = 0;
- }
- else
- bRet = sal_False;
- }
- return bRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/misc/swafopt.cxx b/editeng/source/misc/swafopt.cxx
deleted file mode 100644
index 0aca4533ab..0000000000
--- a/editeng/source/misc/swafopt.cxx
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <vcl/keycodes.hxx>
-#include <tools/string.hxx>
-
-#include <editeng/swafopt.hxx>
-
-SvxSwAutoFmtFlags::SvxSwAutoFmtFlags()
- : aBulletFont( String::CreateFromAscii(
- RTL_CONSTASCII_STRINGPARAM( "StarSymbol" )),
- Size( 0, 14 ) )
-{
- bAutoCorrect =
- bCptlSttSntnc =
- bCptlSttWrd =
- bChkFontAttr =
- bChgUserColl =
- bChgEnumNum =
- bAddNonBrkSpace =
- bChgOrdinalNumber =
- bChgToEnEmDash =
- bChgWeightUnderl =
- bSetINetAttr =
- bAFmtDelSpacesAtSttEnd =
- bAFmtDelSpacesBetweenLines =
- bAFmtByInpDelSpacesAtSttEnd =
- bAFmtByInpDelSpacesBetweenLines =
- bDummy = sal_True;
-
- bReplaceStyles =
- bDelEmptyNode =
- bWithRedlining =
- bAutoCmpltEndless =
- bAutoCmpltAppendBlanc =
- bAutoCmpltShowAsTip = sal_False;
-
- bSetBorder =
- bCreateTable =
- bSetNumRule =
- bAFmtByInput =
- bRightMargin =
- bAutoCompleteWords =
- bAutoCmpltCollectWords =
- bAutoCmpltKeepList = sal_True;
-
- bDummy6 = bDummy7 = bDummy8 =
- sal_False;
-
- nRightMargin = 50; // dflt. 50 %
- nAutoCmpltExpandKey = KEY_RETURN;
-
- aBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
- aBulletFont.SetFamily( FAMILY_DONTKNOW );
- aBulletFont.SetPitch( PITCH_DONTKNOW );
- aBulletFont.SetWeight( WEIGHT_DONTKNOW );
- aBulletFont.SetTransparent( sal_True );
-
- cBullet = 0x2022;
- cByInputBullet = cBullet;
- aByInputBulletFont = aBulletFont;
-
- nAutoCmpltWordLen = 10;
- nAutoCmpltListLen = 500;
- pAutoCmpltList = 0;
- pSmartTagMgr = 0;
-}
-
-
-SvxSwAutoFmtFlags& SvxSwAutoFmtFlags::operator=( const SvxSwAutoFmtFlags& rAFFlags )
-{
- bAutoCorrect = rAFFlags.bAutoCorrect;
- bCptlSttSntnc = rAFFlags.bCptlSttSntnc;
- bCptlSttWrd = rAFFlags.bCptlSttWrd;
- bChkFontAttr = rAFFlags.bChkFontAttr;
-
- bChgUserColl = rAFFlags.bChgUserColl;
- bChgEnumNum = rAFFlags.bChgEnumNum;
- bDelEmptyNode = rAFFlags.bDelEmptyNode;
- bSetNumRule = rAFFlags.bSetNumRule;
- bAFmtByInput = rAFFlags.bAFmtByInput;
-
- bAddNonBrkSpace = rAFFlags.bAddNonBrkSpace;
- bChgOrdinalNumber = rAFFlags.bChgOrdinalNumber;
- bChgToEnEmDash = rAFFlags.bChgToEnEmDash;
- bChgWeightUnderl = rAFFlags.bChgWeightUnderl;
- bSetINetAttr = rAFFlags.bSetINetAttr;
- bSetBorder = rAFFlags.bSetBorder;
- bCreateTable = rAFFlags.bCreateTable;
- bReplaceStyles = rAFFlags.bReplaceStyles;
- bAFmtDelSpacesAtSttEnd = rAFFlags.bAFmtDelSpacesAtSttEnd;
- bAFmtDelSpacesBetweenLines = rAFFlags.bAFmtDelSpacesBetweenLines;
- bAFmtByInpDelSpacesAtSttEnd = rAFFlags.bAFmtByInpDelSpacesAtSttEnd;
- bAFmtByInpDelSpacesBetweenLines = rAFFlags.bAFmtByInpDelSpacesBetweenLines;
-
- bDummy = rAFFlags.bDummy;
-
- bDummy6 = rAFFlags.bDummy6;
- bDummy7 = rAFFlags.bDummy7;
- bDummy8 = rAFFlags.bDummy8;
-
- bWithRedlining = rAFFlags.bWithRedlining;
-
- bRightMargin = rAFFlags.bRightMargin;
- nRightMargin = rAFFlags.nRightMargin;
-
- cBullet = rAFFlags.cBullet;
- aBulletFont = rAFFlags.aBulletFont;
-
- cByInputBullet = rAFFlags.cByInputBullet;
- aByInputBulletFont = rAFFlags.aByInputBulletFont;
-
- bAutoCompleteWords = rAFFlags.bAutoCompleteWords;
- bAutoCmpltCollectWords = rAFFlags.bAutoCmpltCollectWords;
- bAutoCmpltKeepList = rAFFlags.bAutoCmpltKeepList;
- bAutoCmpltEndless = rAFFlags.bAutoCmpltEndless;
- bAutoCmpltAppendBlanc = rAFFlags.bAutoCmpltAppendBlanc;
- bAutoCmpltShowAsTip = rAFFlags.bAutoCmpltShowAsTip;
- pAutoCmpltList = rAFFlags.pAutoCmpltList;
- pSmartTagMgr = rAFFlags.pSmartTagMgr;
- nAutoCmpltExpandKey = rAFFlags.nAutoCmpltExpandKey;
-
- nAutoCmpltWordLen = rAFFlags.nAutoCmpltWordLen;
- nAutoCmpltListLen = rAFFlags.nAutoCmpltListLen;
-
- return *this;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx
deleted file mode 100644
index 51634f173a..0000000000
--- a/editeng/source/misc/txtrange.cxx
+++ /dev/null
@@ -1,672 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <editeng/txtrange.hxx>
-#include <math.h>
-#include <tools/poly.hxx>
-#include <tools/debug.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-
-#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 ),
- nRight( nRght ),
- nLeft( nLft ),
- nUpper( 0 ),
- nLower( 0 ),
- nPointCount( 0 ),
- bSimple( bSimpl ),
- bInner( bInnr ),
- bVertical( bVert )
-{
-#ifdef DBG_UTIL
- bFlag3 = bFlag4 = bFlag5 = bFlag6 = bFlag7 = sal_False;
-#endif
- sal_uInt32 nCount(rPolyPolygon.count());
- mpPolyPolygon = new PolyPolygon( (sal_uInt16)nCount );
-
- for(sal_uInt32 i(0L); i < nCount; i++)
- {
- const basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(i).getDefaultAdaptiveSubdivision());
- nPointCount += aCandidate.count();
- mpPolyPolygon->Insert( Polygon(aCandidate), (sal_uInt16)i );
- }
-
- if( pLinePolyPolygon )
- {
- nCount = pLinePolyPolygon->count();
- mpLinePolyPolygon = new PolyPolygon();
-
- for(sal_uInt32 i(0L); i < nCount; i++)
- {
- const basegfx::B2DPolygon aCandidate(pLinePolyPolygon->getB2DPolygon(i).getDefaultAdaptiveSubdivision());
- nPointCount += aCandidate.count();
- mpLinePolyPolygon->Insert( Polygon(aCandidate), (sal_uInt16)i );
- }
- }
- else
- mpLinePolyPolygon = NULL;
-}
-
-
-TextRanger::~TextRanger()
-{
- mRangeCache.clear();
- delete mpPolyPolygon;
- delete mpLinePolyPolygon;
-}
-
-/* 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;
- mRangeCache.clear();
- }
-}
-
-//! SvxBoundArgs is used to perform temporary calculations on a range array.
-//! Temporary instances are created in TextRanger::GetTextRanges()
-class SvxBoundArgs
-{
- std::vector<bool> aBoolArr;
- LongDqPtr pLongArr;
- TextRanger *pTextRanger;
- long nMin;
- long nMax;
- long nTop;
- long nBottom;
- long nUpDiff;
- long nLowDiff;
- long nUpper;
- long nLower;
- long nStart;
- long nEnd;
- sal_uInt16 nCut;
- sal_uInt16 nLast;
- sal_uInt16 nNext;
- sal_uInt8 nAct;
- sal_uInt8 nFirst;
- sal_Bool bClosed : 1;
- sal_Bool bInner : 1;
- sal_Bool bMultiple : 1;
- sal_Bool bConcat : 1;
- sal_Bool bRotate : 1;
- void NoteRange( sal_Bool bToggle );
- long Cut( long nY, const Point& rPt1, const Point& rPt2 );
- void Add();
- void _NoteFarPoint( long nPx, long nPyDiff, long nDiff );
- void NoteFarPoint( long nPx, long nPyDiff, long nDiff )
- { if( nDiff ) _NoteFarPoint( nPx, nPyDiff, nDiff ); }
- long CalcMax( const Point& rPt1, const Point& rPt2, long nRange, long nFar );
- void CheckCut( const Point& rLst, const Point& rNxt );
- 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, 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; }
- sal_uInt16 Area( const Point& rPt );
- void NoteUpLow( long nA, const sal_uInt8 nArea );
- void Calc( const PolyPolygon& rPoly );
- void Concat( const PolyPolygon* pPoly );
- // inlines
- void NoteLast() { if( bMultiple ) NoteRange( nAct == nFirst ); }
- void SetClosed( const sal_Bool bNew ){ bClosed = bNew; }
- sal_Bool IsClosed() const { return bClosed; }
- void SetConcat( const sal_Bool bNew ){ bConcat = bNew; }
- sal_Bool IsConcat() const { return bConcat; }
- sal_uInt8 GetAct() const { return nAct; }
-};
-
-SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, LongDqPtr pLong,
- const Range& rRange )
- : pLongArr( pLong ), pTextRanger( pRanger ),
- nTop( rRange.Min() ), nBottom( rRange.Max() ),
- bInner( pRanger->IsInner() ), bMultiple( bInner || !pRanger->IsSimple() ),
- bConcat( sal_False ), bRotate( pRanger->IsVertical() )
-{
- if( bRotate )
- {
- nStart = pRanger->GetUpper();
- nEnd = pRanger->GetLower();
- nLowDiff = pRanger->GetLeft();
- nUpDiff = pRanger->GetRight();
- }
- else
- {
- nStart = pRanger->GetLeft();
- nEnd = pRanger->GetRight();
- nLowDiff = pRanger->GetUpper();
- nUpDiff = pRanger->GetLower();
- }
- nUpper = nTop - nUpDiff;
- nLower = nBottom + nLowDiff;
- pLongArr->clear();
-}
-
-long SvxBoundArgs::CalcMax( const Point& rPt1, const Point& rPt2,
- long nRange, long nFarRange )
-{
- double nDa = Cut( nRange, rPt1, rPt2 ) - Cut( nFarRange, rPt1, rPt2 );
- double nB;
- if( nDa < 0 )
- {
- nDa = -nDa;
- nB = nEnd;
- }
- else
- nB = nStart;
- nB *= nB;
- nB += nDa * nDa;
- nB = nRange + nDa * ( nFarRange - nRange ) / sqrt( nB );
-
- sal_Bool bNote;
- if( nB < B(rPt2) )
- bNote = nB > B(rPt1);
- else
- bNote = nB < B(rPt1);
- if( bNote )
- return( long( nB ) );
- return 0;
-}
-
-void SvxBoundArgs::CheckCut( const Point& rLst, const Point& rNxt )
-{
- if( nCut & 1 )
- NotePoint( Cut( nBottom, rLst, rNxt ) );
- if( nCut & 2 )
- NotePoint( Cut( nTop, rLst, rNxt ) );
- if( rLst.X() != rNxt.X() && rLst.Y() != rNxt.Y() )
- {
- long nYps;
- if( nLowDiff && ( ( nCut & 1 ) || nLast == 1 || nNext == 1 ) )
- {
- nYps = CalcMax( rLst, rNxt, nBottom, nLower );
- if( nYps )
- _NoteFarPoint( Cut( nYps, rLst, rNxt ), nLower-nYps, nLowDiff );
- }
- if( nUpDiff && ( ( nCut & 2 ) || nLast == 2 || nNext == 2 ) )
- {
- nYps = CalcMax( rLst, rNxt, nTop, nUpper );
- if( nYps )
- _NoteFarPoint( Cut( nYps, rLst, rNxt ), nYps-nUpper, nUpDiff );
- }
- }
-}
-
-void SvxBoundArgs::_NoteFarPoint( long nPa, long nPbDiff, long nDiff )
-{
- long nTmpA;
- double nQuot = 2 * nDiff - nPbDiff;
- nQuot *= nPbDiff;
- nQuot = sqrt( nQuot );
- nQuot /= nDiff;
- nTmpA = nPa - long( nStart * nQuot );
- nPbDiff = nPa + long( nEnd * nQuot );
- NoteMargin( nTmpA, nPbDiff );
-}
-
-void SvxBoundArgs::NoteRange( sal_Bool bToggle )
-{
- DBG_ASSERT( nMax >= nMin || bInner, "NoteRange: Min > Max?");
- if( nMax < nMin )
- return;
- if( !bClosed )
- bToggle = sal_False;
- sal_uInt16 nIdx = 0;
- sal_uInt16 nCount = pLongArr->size();
- DBG_ASSERT( nCount == 2 * aBoolArr.size(), "NoteRange: Incompatible Sizes" );
- while( nIdx < nCount && (*pLongArr)[ nIdx ] < nMin )
- ++nIdx;
- sal_Bool bOdd = (nIdx % 2) ? sal_True : sal_False;
- // No overlap with existing intervals?
- if( nIdx == nCount || ( !bOdd && nMax < (*pLongArr)[ nIdx ] ) )
- { // 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
- { // expand an existing interval ...
- sal_uInt16 nMaxIdx = nIdx;
- // If we end up on a left interval boundary, it must be reduced to nMin.
- if( bOdd )
- --nIdx;
- else
- (*pLongArr)[ nIdx ] = nMin;
- while( nMaxIdx < nCount && (*pLongArr)[ nMaxIdx ] < nMax )
- ++nMaxIdx;
- DBG_ASSERT( nMaxIdx > nIdx || nMin == nMax, "NoteRange: Funny Situation." );
- if( nMaxIdx )
- --nMaxIdx;
- if( nMaxIdx < nIdx )
- nMaxIdx = nIdx;
- // If we end up on a right interval boundary, it must be raised to nMax.
- if( nMaxIdx % 2 )
- (*pLongArr)[ nMaxIdx-- ] = nMax;
- // Possible merge of intervals.
- sal_uInt16 nDiff = nMaxIdx - nIdx;
- nMaxIdx = nIdx / 2; // From here on is nMaxIdx the Index in BoolArray.
- if( 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 )
- bToggle ^= aBoolArr[ i ];
- aBoolArr.erase( aBoolArr.begin() + nMaxIdx, aBoolArr.begin() + (nMaxIdx + nDiff) );
- }
- DBG_ASSERT( nMaxIdx < aBoolArr.size(), "NoteRange: Too much deleted" );
- aBoolArr[ nMaxIdx ] = aBoolArr[ nMaxIdx ] ^ bToggle;
- }
-}
-
-void SvxBoundArgs::Calc( const PolyPolygon& rPoly )
-{
- sal_uInt16 nCount;
- nAct = 0;
- for( sal_uInt16 i = 0; i < rPoly.Count(); ++i )
- {
- const Polygon& rPol = rPoly[ i ];
- nCount = rPol.GetSize();
- if( nCount )
- {
- const Point& rNull = rPol[ 0 ];
- SetClosed( IsConcat() || ( rNull == rPol[ nCount - 1 ] ) );
- nLast = Area( rNull );
- if( nLast & 12 )
- {
- nFirst = 3;
- if( bMultiple )
- nAct = 0;
- }
- else
- {
- // The first point of the polygon is within the line.
- if( nLast )
- {
- if( bMultiple || !nAct )
- {
- nMin = USHRT_MAX;
- nMax = 0;
- }
- if( nLast & 1 )
- NoteFarPoint( A(rNull), nLower - B(rNull), nLowDiff );
- else
- NoteFarPoint( A(rNull), B(rNull) - nUpper, nUpDiff );
- }
- else
- {
- if( bMultiple || !nAct )
- {
- nMin = A(rNull);
- nMax = nMin + nEnd;
- nMin -= nStart;
- }
- else
- NotePoint( A(rNull) );
- }
- nFirst = 0; // leaving the line in which direction?
- nAct = 3; // we are within the line at the moment.
- }
- if( nCount > 1 )
- {
- sal_uInt16 nIdx = 1;
- while( sal_True )
- {
- const Point& rLast = rPol[ nIdx - 1 ];
- if( nIdx == nCount )
- nIdx = 0;
- const Point& rNext = rPol[ nIdx ];
- nNext = Area( rNext );
- nCut = nNext ^ nLast;
- sal_uInt16 nOldAct = nAct;
- if( nAct )
- CheckCut( rLast, rNext );
- if( nCut & 4 )
- {
- NoteUpLow( Cut( nLower, rLast, rNext ), 2 );
- if( nAct && nAct != nOldAct )
- {
- nOldAct = nAct;
- CheckCut( rLast, rNext );
- }
- }
- if( nCut & 8 )
- {
- NoteUpLow( Cut( nUpper, rLast, rNext ), 1 );
- if( nAct && nAct != nOldAct )
- CheckCut( rLast, rNext );
- }
- if( !nIdx )
- {
- if( !( nNext & 12 ) )
- NoteLast();
- break;
- }
- if( !( nNext & 12 ) )
- {
- if( !nNext )
- NotePoint( A(rNext) );
- else if( nNext & 1 )
- NoteFarPoint( A(rNext), nLower-B(rNext), nLowDiff );
- else
- NoteFarPoint( A(rNext), B(rNext)-nUpper, nUpDiff );
- }
- nLast = nNext;
- if( ++nIdx == nCount && !IsClosed() )
- {
- if( !( nNext & 12 ) )
- NoteLast();
- break;
- }
- }
- }
- if( bMultiple && IsConcat() )
- {
- Add();
- nAct = 0;
- }
- }
- }
- if( !bMultiple )
- {
- DBG_ASSERT( pLongArr->size() == 0, "I said: Simple!" );
- if( nAct )
- {
- if( bInner )
- {
- long nTmpMin, nTmpMax;
- {
- nTmpMin = nMin + 2 * nStart;
- nTmpMax = nMax - 2 * nEnd;
- if( nTmpMin <= nTmpMax )
- {
- pLongArr->push_front(nTmpMax);
- pLongArr->push_front(nTmpMin);
- }
- }
- }
- else
- {
- pLongArr->push_front(nMax);
- pLongArr->push_front(nMin);
- }
- }
- }
- else if( !IsConcat() )
- Add();
-}
-
-void SvxBoundArgs::Add()
-{
- sal_uInt16 nLongIdx = 1;
- size_t nCount = aBoolArr.size();
- if( nCount && ( !bInner || !pTextRanger->IsSimple() ) )
- {
- sal_Bool bDelete = aBoolArr.front();
- if( bInner )
- bDelete = !bDelete;
- for( size_t nBoolIdx = 1; nBoolIdx < nCount; ++nBoolIdx )
- {
- if( bDelete )
- {
- sal_uInt16 next = 2;
- while( nBoolIdx < nCount && !aBoolArr[ nBoolIdx++ ] &&
- (!bInner || nBoolIdx < nCount ) )
- next += 2;
- pLongArr->erase( pLongArr->begin() + nLongIdx, pLongArr->begin() + nLongIdx + next );
- next /= 2;
- nBoolIdx = nBoolIdx - next;
- nCount = nCount - next;
- aBoolArr.erase( aBoolArr.begin() + nBoolIdx, aBoolArr.begin() + (nBoolIdx + next) );
- if( nBoolIdx )
- aBoolArr[ nBoolIdx - 1 ] = sal_False;
-#if OSL_DEBUG_LEVEL > 1
- else
- ++next;
-#endif
- }
- bDelete = nBoolIdx < nCount && aBoolArr[ nBoolIdx ];
- nLongIdx += 2;
- DBG_ASSERT( nLongIdx == 2*nBoolIdx+1, "BoundArgs: Array-Idx Confusion" );
- DBG_ASSERT( aBoolArr.size()*2 == pLongArr->size(),
- "BoundArgs: Array-Count: Confusion" );
- }
- }
- if( 0 != ( nCount = pLongArr->size() ) )
- {
- if( bInner )
- {
- 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 );
-
- }
- }
-}
-
-void SvxBoundArgs::Concat( const PolyPolygon* pPoly )
-{
- SetConcat( sal_True );
- DBG_ASSERT( pPoly, "Nothing to do?" );
- LongDqPtr pOld = pLongArr;
- pLongArr = new std::deque<long>();
- aBoolArr.clear();
- bInner = sal_False;
- Calc( *pPoly ); // Note that this updates pLongArr, which is why we swapped it out earlier.
- sal_uInt16 nCount = pLongArr->size();
- sal_uInt16 nIdx = 0;
- sal_uInt16 i = 0;
- sal_Bool bSubtract = pTextRanger->IsInner();
- while( i < nCount )
- {
- sal_uLong nOldCount = pOld->size();
- if( nIdx == nOldCount )
- { // Reached the end of the old Array...
- if( !bSubtract )
- pOld->insert( pOld->begin() + nIdx, pLongArr->begin() + i, pLongArr->end() );
- break;
- }
- long nLeft = (*pLongArr)[ i++ ];
- long nRight = (*pLongArr)[ i++ ];
- sal_uInt16 nLeftPos = nIdx + 1;
- while( nLeftPos < nOldCount && nLeft > (*pOld)[ nLeftPos ] )
- nLeftPos += 2;
- if( nLeftPos >= nOldCount )
- { // The current interval belongs to the end of the old array ...
- if( !bSubtract )
- 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 )
- { // The current interval belongs between two old intervals
- if( !bSubtract )
- pOld->insert( pOld->begin() + nRightPos, pLongArr->begin() + i - 2, pLongArr->begin() + i );
- nIdx = nRightPos + 2;
- }
- else if( bSubtract ) // Subtract, if necessary separate
- {
- long nOld;
- if( nLeft > ( nOld = (*pOld)[ nLeftPos - 1 ] ) )
- { // Now we split the left part...
- if( nLeft - 1 > nOld )
- {
- pOld->insert( pOld->begin() + nLeftPos - 1, nOld );
- pOld->insert( pOld->begin() + nLeftPos, nLeft - 1 );
- nLeftPos += 2;
- nRightPos += 2;
- }
- }
- if( nRightPos - nLeftPos > 1 )
- pOld->erase( pOld->begin() + nLeftPos, pOld->begin() + nRightPos - 1 );
- if( ++nRight >= ( nOld = (*pOld)[ nLeftPos ] ) )
- pOld->erase( pOld->begin() + nLeftPos - 1, pOld->begin() + nLeftPos + 1 );
- else
- (*pOld)[ nLeftPos - 1 ] = nRight;
- }
- 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->erase( pOld->begin() + nLeftPos, pOld->begin() + nRightPos - 1 );
-
- }
- nIdx = nLeftPos - 1;
- }
- delete pLongArr;
-}
-
-/*************************************************************************
- * 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 )
-{
- long nB = B( rPt );
- if( nB >= nBottom )
- {
- if( nB >= nLower )
- return 5;
- return 1;
- }
- if( nB <= nTop )
- {
- if( nB <= nUpper )
- return 10;
- return 2;
- }
- return 0;
-}
-
-/*************************************************************************
- * 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 )
-{
- if( pTextRanger->IsVertical() )
- {
- double nQuot = nB - rPt1.X();
- nQuot /= ( rPt2.X() - rPt1.X() );
- nQuot *= ( rPt2.Y() - rPt1.Y() );
- return long( rPt1.Y() + nQuot );
- }
- double nQuot = nB - rPt1.Y();
- nQuot /= ( rPt2.Y() - rPt1.Y() );
- nQuot *= ( rPt2.X() - rPt1.X() );
- return long( rPt1.X() + nQuot );
-}
-
-void SvxBoundArgs::NoteUpLow( long nA, const sal_uInt8 nArea )
-{
- if( nAct )
- {
- NoteMargin( nA, nA );
- if( bMultiple )
- {
- NoteRange( nArea != nAct );
- nAct = 0;
- }
- if( !nFirst )
- nFirst = nArea;
- }
- else
- {
- nAct = nArea;
- nMin = nA;
- nMax = nA;
- }
-}
-
-LongDqPtr TextRanger::GetTextRanges( const Range& rRange )
-{
- DBG_ASSERT( rRange.Min() || rRange.Max(), "Zero-Range not allowed, Bye Bye" );
- //Can we find the result we need in the cache?
- for (std::deque<RangeCache>::iterator it = mRangeCache.begin(); it != mRangeCache.end(); ++it)
- {
- if (it->range == rRange)
- return &(it->results);
- }
- //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()
-{
- DBG_ASSERT( 0 == pBound, "Don't call twice." );
- pBound = new Rectangle( mpPolyPolygon->GetBoundRect() );
- return *pBound;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx
deleted file mode 100644
index 7db6c78de3..0000000000
--- a/editeng/source/misc/unolingu.cxx
+++ /dev/null
@@ -1,1309 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <map>
-#include <set>
-#include <vector>
-#include <list>
-#include <memory>
-#include <editeng/unolingu.hxx>
-#include <tools/urlobj.hxx>
-#include <rtl/logfile.hxx>
-#include <unotools/pathoptions.hxx>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/linguistic2/XAvailableLocales.hpp>
-#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
-#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
-#include <com/sun/star/ucb/NumberedSortingInfo.hpp>
-#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/util/DateTime.hpp>
-
-#include <comphelper/processfactory.hxx>
-#include <cppuhelper/implbase1.hxx> // helper for implementations
-#include <i18npool/mslangid.hxx>
-#include <unotools/lingucfg.hxx>
-#include <unotools/ucbhelper.hxx>
-#include <unotools/localfilehelper.hxx>
-#include <ucbhelper/commandenvironment.hxx>
-#include <ucbhelper/content.hxx>
-#include <comphelper/processfactory.hxx>
-#include <vcl/msgbox.hxx>
-#include <tools/shl.hxx>
-#include <linguistic/misc.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng/editrids.hrc>
-
-using namespace ::rtl;
-using namespace ::comphelper;
-using namespace ::linguistic;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::linguistic2;
-
-#define CSS com::sun::star
-
-static uno::Reference< XLinguServiceManager > GetLngSvcMgr_Impl()
-{
- uno::Reference< XLinguServiceManager > xRes;
- uno::Reference< XMultiServiceFactory > xMgr = getProcessServiceFactory();
- if (xMgr.is())
- {
- xRes = uno::Reference< XLinguServiceManager > ( xMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.linguistic2.LinguServiceManager" ) ) ), UNO_QUERY ) ;
- }
- return xRes;
-}
-
-sal_Bool lcl_FindEntry( const OUString &rEntry, const Sequence< OUString > &rCfgSvcs )
-{
- sal_Int32 nRes = -1;
- sal_Int32 nEntries = rCfgSvcs.getLength();
- const OUString *pEntry = rCfgSvcs.getConstArray();
- for (sal_Int32 i = 0; i < nEntries && nRes == -1; ++i)
- {
- if (rEntry == pEntry[i])
- nRes = i;
- }
- return nRes != -1;
-}
-
-
-Sequence< OUString > lcl_RemoveMissingEntries(
- const Sequence< OUString > &rCfgSvcs,
- const Sequence< OUString > &rAvailSvcs )
-{
- Sequence< OUString > aRes( rCfgSvcs.getLength() );
- OUString *pRes = aRes.getArray();
- sal_Int32 nCnt = 0;
-
- sal_Int32 nEntries = rCfgSvcs.getLength();
- const OUString *pEntry = rCfgSvcs.getConstArray();
- for (sal_Int32 i = 0; i < nEntries; ++i)
- {
- if (pEntry[i].getLength() && lcl_FindEntry( pEntry[i], rAvailSvcs ))
- pRes[ nCnt++ ] = pEntry[i];
- }
-
- aRes.realloc( nCnt );
- return aRes;
-}
-
-
-Sequence< OUString > lcl_GetLastFoundSvcs(
- SvtLinguConfig &rCfg,
- const OUString &rLastFoundList ,
- const Locale &rAvailLocale )
-{
- Sequence< OUString > aRes;
-
- OUString aCfgLocaleStr( MsLangId::convertLanguageToIsoString(
- SvxLocaleToLanguage( rAvailLocale ) ) );
-
- Sequence< OUString > aNodeNames( rCfg.GetNodeNames(rLastFoundList) );
- sal_Bool bFound = lcl_FindEntry( aCfgLocaleStr, aNodeNames);
-
- if (bFound)
- {
- Sequence< OUString > aNames(1);
- OUString &rNodeName = aNames.getArray()[0];
- rNodeName = rLastFoundList;
- rNodeName += OUString::valueOf( (sal_Unicode)'/' );
- rNodeName += aCfgLocaleStr;
- Sequence< Any > aValues( rCfg.GetProperties( aNames ) );
- if (aValues.getLength())
- {
- OSL_ENSURE( aValues.getLength() == 1, "unexpected length of sequence" );
- Sequence< OUString > aSvcImplNames;
- if (aValues.getConstArray()[0] >>= aSvcImplNames)
- aRes = aSvcImplNames;
- else
- {
- OSL_FAIL( "type mismatch" );
- }
- }
- }
-
- return aRes;
-}
-
-
-Sequence< OUString > lcl_GetNewEntries(
- const Sequence< OUString > &rLastFoundSvcs,
- const Sequence< OUString > &rAvailSvcs )
-{
- sal_Int32 nLen = rAvailSvcs.getLength();
- Sequence< OUString > aRes( nLen );
- OUString *pRes = aRes.getArray();
- sal_Int32 nCnt = 0;
-
- const OUString *pEntry = rAvailSvcs.getConstArray();
- for (sal_Int32 i = 0; i < nLen; ++i)
- {
- if (pEntry[i].getLength() && !lcl_FindEntry( pEntry[i], rLastFoundSvcs ))
- pRes[ nCnt++ ] = pEntry[i];
- }
-
- aRes.realloc( nCnt );
- return aRes;
-}
-
-
-Sequence< OUString > lcl_MergeSeq(
- const Sequence< OUString > &rCfgSvcs,
- const Sequence< OUString > &rNewSvcs )
-{
- Sequence< OUString > aRes( rCfgSvcs.getLength() + rNewSvcs.getLength() );
- OUString *pRes = aRes.getArray();
- sal_Int32 nCnt = 0;
-
- for (sal_Int32 k = 0; k < 2; ++k)
- {
- // add previously configuerd service first and append
- // new found services at the end
- const Sequence< OUString > &rSeq = k == 0 ? rCfgSvcs : rNewSvcs;
-
- sal_Int32 nLen = rSeq.getLength();
- const OUString *pEntry = rSeq.getConstArray();
- for (sal_Int32 i = 0; i < nLen; ++i)
- {
- if (pEntry[i].getLength() && !lcl_FindEntry( pEntry[i], aRes ))
- pRes[ nCnt++ ] = pEntry[i];
- }
- }
-
- aRes.realloc( nCnt );
- return aRes;
-}
-
-sal_Int16 SvxLinguConfigUpdate::nNeedUpdating = -1;
-sal_Int32 SvxLinguConfigUpdate::nCurrentDataFilesChangedCheckValue = -1;
-
-void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck )
-{
- RTL_LOGFILE_CONTEXT( aLog, "svx: SvxLinguConfigUpdate::UpdateAll" );
-
- if (IsNeedUpdateAll( bForceCheck ))
- {
- typedef OUString OUstring_t;
- typedef Sequence< OUString > Sequence_OUString_t;
- typedef std::vector< OUstring_t > OUString_vector_t;
- typedef std::set< OUstring_t > OUString_set_t;
- std::vector< OUString_vector_t > aVector;
- typedef std::map< OUstring_t, Sequence_OUString_t > list_entry_map_t;
-
- RTL_LOGFILE_CONTEXT( aLog, "svx: SvxLinguConfigUpdate::UpdateAll - updating..." );
-
- OSL_ENSURE( nNeedUpdating == 1, "SvxLinguConfigUpdate::UpdateAll already updated!" );
-
- uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() );
- OSL_ENSURE( xLngSvcMgr.is(), "service manager missing");
- if (!xLngSvcMgr.is())
- return;
-
- SvtLinguConfig aCfg;
-
- const int nNumServices = 4;
- const sal_Char * apServices[nNumServices] = { SN_SPELLCHECKER, SN_GRAMMARCHECKER, SN_HYPHENATOR, SN_THESAURUS };
- const sal_Char * apCurLists[nNumServices] = { "ServiceManager/SpellCheckerList", "ServiceManager/GrammarCheckerList", "ServiceManager/HyphenatorList", "ServiceManager/ThesaurusList" };
- const sal_Char * apLastFoundLists[nNumServices] = { "ServiceManager/LastFoundSpellCheckers", "ServiceManager/LastFoundGrammarCheckers", "ServiceManager/LastFoundHyphenators", "ServiceManager/LastFoundThesauri" };
-
- // usage of indices as above: 0 = spell checker, 1 = grammar checker, 2 = hyphenator, 3 = thesaurus
- std::vector< list_entry_map_t > aLastFoundSvcs(nNumServices);
- std::vector< list_entry_map_t > aCurSvcs(nNumServices);
-
- for (int k = 0; k < nNumServices; ++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;
-
- //
- // remove configured but not available language/services entries
- //
- Sequence< OUString > aNodeNames( aCfg.GetNodeNames( aActiveList ) ); // list of configured locales
- sal_Int32 nNodeNames = aNodeNames.getLength();
- const OUString *pNodeName = aNodeNames.getConstArray();
- for (i = 0; i < nNodeNames; ++i)
- {
- Locale aLocale( SvxCreateLocale( MsLangId::convertIsoStringToLanguage(pNodeName[i]) ) );
- Sequence< OUString > aCfgSvcs(
- xLngSvcMgr->getConfiguredServices( aService, aLocale ));
- Sequence< OUString > aAvailSvcs(
- xLngSvcMgr->getAvailableServices( aService, aLocale ));
-#if OSL_DEBUG_LEVEL > 1
- const OUString * pCfgSvcs = aCfgSvcs.getConstArray();;
- const OUString * pAvailSvcs = aAvailSvcs.getConstArray();;
- (void) pCfgSvcs;
- (void) pAvailSvcs;
-#endif
- aCfgSvcs = lcl_RemoveMissingEntries( aCfgSvcs, aAvailSvcs );
-
- aCurSvcs[k][ pNodeName[i] ] = aCfgSvcs;
- }
-
- //
- // add new available language/servcice entries
- //
- uno::Reference< XAvailableLocales > xAvail( xLngSvcMgr, UNO_QUERY );
- Sequence< Locale > aAvailLocales( xAvail->getAvailableLocales(aService) );
- sal_Int32 nAvailLocales = aAvailLocales.getLength();
- const Locale *pAvailLocale = aAvailLocales.getConstArray();
- for (i = 0; i < nAvailLocales; ++i)
- {
- Sequence< OUString > aAvailSvcs(
- xLngSvcMgr->getAvailableServices( aService, pAvailLocale[i] ));
- Sequence< OUString > aLastSvcs(
- lcl_GetLastFoundSvcs( aCfg, aLastFoundList , pAvailLocale[i] ));
- Sequence< OUString > aNewSvcs =
- lcl_GetNewEntries( aLastSvcs, aAvailSvcs );
-#if OSL_DEBUG_LEVEL > 1
- const OUString * pAvailSvcs = aAvailSvcs.getConstArray();
- const OUString * pLastSvcs = aLastSvcs.getConstArray();
- const OUString * pNewSvcs = aNewSvcs.getConstArray();
- (void) pAvailSvcs;
- (void) pLastSvcs;
- (void) pNewSvcs;
-#endif
-
- OUString aCfgLocaleStr( MsLangId::convertLanguageToIsoString(
- SvxLocaleToLanguage( pAvailLocale[i] ) ) );
- Sequence< OUString > aCfgSvcs( aCurSvcs[k][ aCfgLocaleStr ] );
-
- // merge services list (previously configured to be listed first).
- aCfgSvcs = lcl_MergeSeq( aCfgSvcs, aNewSvcs );
-
-/*
- // there is at most one Hyphenator per language allowed
- // to be configured, thus we only use the first one found.
- if (k == 2 && aCfgSvcs.getLength() > 1)
- aCfgSvcs.realloc(1);
-*/
- aCurSvcs[k][ aCfgLocaleStr ] = aCfgSvcs;
- }
-
- //
- // set last found services to currently available ones
- //
- for (i = 0; i < nAvailLocales; ++i)
- {
- Sequence< OUString > aSvcImplNames(
- xLngSvcMgr->getAvailableServices( aService, pAvailLocale[i] ) );
-
-#if OSL_DEBUG_LEVEL > 1
- sal_Int32 nSvcs = aSvcImplNames.getLength();
- const OUString *pSvcImplName = aSvcImplNames.getConstArray();
- for (sal_Int32 j = 0; j < nSvcs; ++j)
- {
- OUString aImplName( pSvcImplName[j] );
- }
-#endif
-
- OUString aCfgLocaleStr( MsLangId::convertLanguageToIsoString(
- SvxLocaleToLanguage( pAvailLocale[i] ) ) );
- aLastFoundSvcs[k][ aCfgLocaleStr ] = aSvcImplNames;
- }
- }
-
- //
- // write new data back to configuration
- //
- for (int k = 0; k < nNumServices; ++k)
- {
- for (int i = 0; i < 2; ++i)
- {
- const sal_Char *pSubNodeName = (i == 0) ? apCurLists[k] : apLastFoundLists[k];
- 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() );
- sal_Int32 nVals = static_cast< sal_Int32 >( rCurMap.size() );
- Sequence< PropertyValue > aNewValues( nVals );
- PropertyValue *pNewValue = aNewValues.getArray();
- while (aIt != rCurMap.end())
- {
- OUString aCfgEntryName( aSubNodeName );
- aCfgEntryName += OUString::valueOf( (sal_Unicode) '/' );
- aCfgEntryName += (*aIt).first;
-
-#if OSL_DEBUG_LEVEL > 1
- Sequence< OUString > aSvcImplNames( (*aIt).second );
- sal_Int32 nSvcs = aSvcImplNames.getLength();
- const OUString *pSvcImplName = aSvcImplNames.getConstArray();
- for (sal_Int32 j = 0; j < nSvcs; ++j)
- {
- OUString aImplName( pSvcImplName[j] );
- }
-#endif
- pNewValue->Name = aCfgEntryName;
- pNewValue->Value <<= (*aIt).second;
- ++pNewValue;
- ++aIt;
- }
- OSL_ENSURE( pNewValue - aNewValues.getArray() == nVals,
- "possible mismatch of sequence size and property number" );
-
- {
- RTL_LOGFILE_CONTEXT( aLog, "svx: SvxLinguConfigUpdate::UpdateAll - ReplaceSetProperties" );
- // add new or replace existing entries.
- sal_Bool bRes = aCfg.ReplaceSetProperties( aSubNodeName, aNewValues );
- if (!bRes)
- {
-#if OSL_DEBUG_LEVEL > 1
- OSL_FAIL( "failed to set new configuration values" );
-#endif
- }
- }
- }
- }
- OSL_ENSURE( nCurrentDataFilesChangedCheckValue != -1, "SvxLinguConfigUpdate::UpdateAll DataFilesChangedCheckValue not yet calculated!" );
- Any aAny;
-
- // for the time being (developer builds until OOo 3.0)
- // we should always check for everything available
- // otherwise we may miss a new installed extension dicitonary
- // just because e.g. the spellchecker is not asked what
- // languages it does support currently...
- // Since the check is on-demand occuring and executed once it should
- // not be too troublesome.
- // In OOo 3.0 we will not need the respective code anymore at all.
-// aAny <<= nCurrentDataFilesChangedCheckValue;
- aAny <<= (sal_Int32) -1; // keep the value set to 'need to check'
-
- aCfg.SetProperty( A2OU( "DataFilesChangedCheckValue" ), aAny );
-
- //! Note 1: the new values are commited when the 'aCfg' object
- //! gets destroyed.
- //! Note 2: the new settings in the configuration get applied
- //! because the 'LngSvcMgr' (in linguistic/source/lngsvcmgr.hxx)
- //! listens to the configuration for changes of the relevant
- //! properties and then applies the new settings.
-
- // nothing needs to be done anymore
- nNeedUpdating = 0;
- }
-}
-
-
-sal_Int32 SvxLinguConfigUpdate::CalcDataFilesChangedCheckValue()
-{
- RTL_LOGFILE_CONTEXT( aLog, "svx: SvxLinguConfigUpdate::CalcDataFilesChangedCheckValue" );
-
- sal_Int32 nHashVal = 0;
- // nothing to be checked anymore since those old directory paths are gone by now
- return nHashVal;
-}
-
-
-sal_Bool SvxLinguConfigUpdate::IsNeedUpdateAll( sal_Bool bForceCheck )
-{
- RTL_LOGFILE_CONTEXT( aLog, "svx: SvxLinguConfigUpdate::IsNeedUpdateAll" );
- if (nNeedUpdating == -1 || bForceCheck ) // need to check if updating is necessary
- {
- // calculate hash value for current data files
- nCurrentDataFilesChangedCheckValue = CalcDataFilesChangedCheckValue();
-
- // compare hash value and check value to see if anything has changed
- // and thus the configuration needs to be updated
- SvtLinguOptions aLinguOpt;
- SvtLinguConfig aCfg;
- aCfg.GetOptions( aLinguOpt );
- nNeedUpdating = (nCurrentDataFilesChangedCheckValue == aLinguOpt.nDataFilesChangedCheckValue) ? 0 : 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.
-//! The dummy accesses the real implementation (and thus loading the DLL)
-//! when "real" work needs to be done only.
-class ThesDummy_Impl :
- public cppu::WeakImplHelper1< XThesaurus >
-{
- uno::Reference< XThesaurus > xThes; // the real one...
- Sequence< Locale > *pLocaleSeq;
-
- void GetCfgLocales();
-
- void GetThes_Impl();
-
-public:
- ThesDummy_Impl() : pLocaleSeq(0) {}
- ~ThesDummy_Impl();
-
- // XSupportedLocales
- virtual ::com::sun::star::uno::Sequence<
- ::com::sun::star::lang::Locale > SAL_CALL
- getLocales()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL
- hasLocale( const ::com::sun::star::lang::Locale& rLocale )
- throw(::com::sun::star::uno::RuntimeException);
-
- // XThesaurus
- virtual ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XMeaning > > SAL_CALL
- queryMeanings( const ::rtl::OUString& rTerm,
- const ::com::sun::star::lang::Locale& rLocale,
- const ::com::sun::star::beans::PropertyValues& rProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
-};
-
-
-ThesDummy_Impl::~ThesDummy_Impl()
-{
- delete pLocaleSeq;
-}
-
-
-void ThesDummy_Impl::GetCfgLocales()
-{
- if (!pLocaleSeq)
- {
- SvtLinguConfig aCfg;
- String aNode( A2OU( "ServiceManager/ThesaurusList" ) );
- Sequence < OUString > aNodeNames( aCfg.GetNodeNames( aNode ) );
- const OUString *pNodeNames = aNodeNames.getConstArray();
- sal_Int32 nLen = aNodeNames.getLength();
- pLocaleSeq = new Sequence< Locale >( nLen );
- Locale *pLocale = pLocaleSeq->getArray();
- for (sal_Int32 i = 0; i < nLen; ++i)
- {
- pLocale[i] = SvxCreateLocale(
- MsLangId::convertIsoStringToLanguage( pNodeNames[i] ) );
- }
- }
-}
-
-
-void ThesDummy_Impl::GetThes_Impl()
-{
- // update configuration before accessing the service
- if (SvxLinguConfigUpdate::IsNeedUpdateAll())
- SvxLinguConfigUpdate::UpdateAll();
-
- if (!xThes.is())
- {
- uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() );
- if (xLngSvcMgr.is())
- xThes = xLngSvcMgr->getThesaurus();
-
- if (xThes.is())
- {
- // no longer needed...
- delete pLocaleSeq; pLocaleSeq = 0;
- }
- }
-}
-
-
-uno::Sequence< lang::Locale > SAL_CALL
- ThesDummy_Impl::getLocales()
- throw(uno::RuntimeException)
-{
- if (!SvxLinguConfigUpdate::IsNeedUpdateAll()) // configuration already update and thus lingu DLL's already loaded ?
- GetThes_Impl();
- if (xThes.is())
- return xThes->getLocales();
- else if (!pLocaleSeq) // if not already loaded save startup time by avoiding loading them now
- GetCfgLocales();
- return *pLocaleSeq;
-}
-
-
-sal_Bool SAL_CALL
- ThesDummy_Impl::hasLocale( const lang::Locale& rLocale )
- throw(uno::RuntimeException)
-{
- if (!SvxLinguConfigUpdate::IsNeedUpdateAll()) // configuration already update and thus lingu DLL's already loaded ?
- GetThes_Impl();
- if (xThes.is())
- return xThes->hasLocale( rLocale );
- else if (!pLocaleSeq) // if not already loaded save startup time by avoiding loading them now
- GetCfgLocales();
- GetCfgLocales();
- sal_Bool bFound = sal_False;
- sal_Int32 nLen = pLocaleSeq->getLength();
- const Locale *pLocale = pLocaleSeq->getConstArray();
- const Locale *pEnd = pLocale + nLen;
- for ( ; pLocale < pEnd && !bFound; ++pLocale)
- {
- bFound = pLocale->Language == rLocale.Language &&
- pLocale->Country == rLocale.Country &&
- pLocale->Variant == rLocale.Variant;
- }
- return bFound;
-}
-
-
-uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL
- ThesDummy_Impl::queryMeanings(
- const rtl::OUString& rTerm,
- const lang::Locale& rLocale,
- const beans::PropertyValues& rProperties )
- throw(lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- GetThes_Impl();
- uno::Sequence< uno::Reference< linguistic2::XMeaning > > aRes;
- 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.
-class SpellDummy_Impl :
- public cppu::WeakImplHelper1< XSpellChecker1 >
-{
- uno::Reference< XSpellChecker1 > xSpell; // the real one...
-
- void GetSpell_Impl();
-
-public:
-
- // XSupportedLanguages (for XSpellChecker1)
- virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL
- getLanguages()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL
- hasLanguage( sal_Int16 nLanguage )
- throw(::com::sun::star::uno::RuntimeException);
-
- // XSpellChecker1 (same as XSpellChecker but sal_Int16 for language)
- virtual sal_Bool SAL_CALL
- isValid( const ::rtl::OUString& rWord, sal_Int16 nLanguage,
- const ::com::sun::star::beans::PropertyValues& rProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives > SAL_CALL
- spell( const ::rtl::OUString& rWord, sal_Int16 nLanguage,
- const ::com::sun::star::beans::PropertyValues& rProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
-};
-
-
-void SpellDummy_Impl::GetSpell_Impl()
-{
- // update configuration before accessing the service
- if (SvxLinguConfigUpdate::IsNeedUpdateAll())
- SvxLinguConfigUpdate::UpdateAll();
-
- if (!xSpell.is())
- {
- uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() );
- if (xLngSvcMgr.is())
- xSpell = uno::Reference< XSpellChecker1 >( xLngSvcMgr->getSpellChecker(), UNO_QUERY );
- }
-}
-
-
-uno::Sequence< sal_Int16 > SAL_CALL
- SpellDummy_Impl::getLanguages()
- throw(uno::RuntimeException)
-{
- GetSpell_Impl();
- if (xSpell.is())
- return xSpell->getLanguages();
- else
- return uno::Sequence< sal_Int16 >();
-}
-
-
-sal_Bool SAL_CALL
- SpellDummy_Impl::hasLanguage( sal_Int16 nLanguage )
- throw(uno::RuntimeException)
-{
- GetSpell_Impl();
- sal_Bool bRes = sal_False;
- if (xSpell.is())
- bRes = xSpell->hasLanguage( nLanguage );
- return bRes;
-}
-
-
-sal_Bool SAL_CALL
- SpellDummy_Impl::isValid( const rtl::OUString& rWord, sal_Int16 nLanguage,
- const beans::PropertyValues& rProperties )
- throw(lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- GetSpell_Impl();
- sal_Bool bRes = sal_True;
- if (xSpell.is())
- bRes = xSpell->isValid( rWord, nLanguage, rProperties );
- return bRes;
-}
-
-
-uno::Reference< linguistic2::XSpellAlternatives > SAL_CALL
- SpellDummy_Impl::spell( const rtl::OUString& rWord, sal_Int16 nLanguage,
- const beans::PropertyValues& rProperties )
- throw(lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- GetSpell_Impl();
- uno::Reference< linguistic2::XSpellAlternatives > xRes;
- if (xSpell.is())
- xRes = xSpell->spell( rWord, nLanguage, rProperties );
- return xRes;
-}
-
-
-//! 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.
-class HyphDummy_Impl :
- public cppu::WeakImplHelper1< XHyphenator >
-{
- uno::Reference< XHyphenator > xHyph; // the real one...
-
- void GetHyph_Impl();
-
-public:
-
- // XSupportedLocales
- virtual ::com::sun::star::uno::Sequence<
- ::com::sun::star::lang::Locale > SAL_CALL
- getLocales()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL
- hasLocale( const ::com::sun::star::lang::Locale& rLocale )
- throw(::com::sun::star::uno::RuntimeException);
-
- // XHyphenator
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL
- hyphenate( const ::rtl::OUString& rWord,
- const ::com::sun::star::lang::Locale& rLocale,
- sal_Int16 nMaxLeading,
- const ::com::sun::star::beans::PropertyValues& rProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL
- queryAlternativeSpelling( const ::rtl::OUString& rWord,
- const ::com::sun::star::lang::Locale& rLocale,
- sal_Int16 nIndex,
- const ::com::sun::star::beans::PropertyValues& rProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XPossibleHyphens > SAL_CALL
- createPossibleHyphens(
- const ::rtl::OUString& rWord,
- const ::com::sun::star::lang::Locale& rLocale,
- const ::com::sun::star::beans::PropertyValues& rProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
-};
-
-
-void HyphDummy_Impl::GetHyph_Impl()
-{
- // update configuration before accessing the service
- if (SvxLinguConfigUpdate::IsNeedUpdateAll())
- SvxLinguConfigUpdate::UpdateAll();
-
- if (!xHyph.is())
- {
- uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() );
- if (xLngSvcMgr.is())
- xHyph = xLngSvcMgr->getHyphenator();
- }
-}
-
-
-uno::Sequence< lang::Locale > SAL_CALL
- HyphDummy_Impl::getLocales()
- throw(uno::RuntimeException)
-{
- GetHyph_Impl();
- if (xHyph.is())
- return xHyph->getLocales();
- else
- return uno::Sequence< lang::Locale >();
-}
-
-
-sal_Bool SAL_CALL
- HyphDummy_Impl::hasLocale( const lang::Locale& rLocale )
- throw(uno::RuntimeException)
-{
- GetHyph_Impl();
- sal_Bool bRes = sal_False;
- if (xHyph.is())
- bRes = xHyph->hasLocale( rLocale );
- return bRes;
-}
-
-
-uno::Reference< linguistic2::XHyphenatedWord > SAL_CALL
- HyphDummy_Impl::hyphenate(
- const rtl::OUString& rWord,
- const lang::Locale& rLocale,
- sal_Int16 nMaxLeading,
- const beans::PropertyValues& rProperties )
- throw(lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- GetHyph_Impl();
- uno::Reference< linguistic2::XHyphenatedWord > xRes;
- if (xHyph.is())
- xRes = xHyph->hyphenate( rWord, rLocale, nMaxLeading, rProperties );
- return xRes;
-}
-
-
-uno::Reference< linguistic2::XHyphenatedWord > SAL_CALL
- HyphDummy_Impl::queryAlternativeSpelling(
- const rtl::OUString& rWord,
- const lang::Locale& rLocale,
- sal_Int16 nIndex,
- const PropertyValues& rProperties )
- throw(lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- GetHyph_Impl();
- uno::Reference< linguistic2::XHyphenatedWord > xRes;
- if (xHyph.is())
- xRes = xHyph->queryAlternativeSpelling( rWord, rLocale, nIndex, rProperties );
- return xRes;
-}
-
-
-uno::Reference< linguistic2::XPossibleHyphens > SAL_CALL
- HyphDummy_Impl::createPossibleHyphens(
- const rtl::OUString& rWord,
- const lang::Locale& rLocale,
- const beans::PropertyValues& rProperties )
- throw(lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- GetHyph_Impl();
- uno::Reference< linguistic2::XPossibleHyphens > xRes;
- if (xHyph.is())
- xRes = xHyph->createPossibleHyphens( rWord, rLocale, rProperties );
- return xRes;
-}
-
-
-typedef cppu::WeakImplHelper1 < XEventListener > LinguMgrAppExitLstnrBaseClass;
-
-
-class LinguMgrAppExitLstnr : public LinguMgrAppExitLstnrBaseClass
-{
- uno::Reference< XComponent > xDesktop;
-
-public:
- LinguMgrAppExitLstnr();
- virtual ~LinguMgrAppExitLstnr();
-
- virtual void AtExit() = 0;
-
-
- // lang::XEventListener
- virtual void SAL_CALL disposing(const EventObject& rSource)
- throw( RuntimeException );
-};
-
-LinguMgrAppExitLstnr::LinguMgrAppExitLstnr()
-{
- // add object to frame::Desktop EventListeners in order to properly call
- // the AtExit function at appliction exit.
-
- uno::Reference< XMultiServiceFactory > xMgr = getProcessServiceFactory();
- if ( xMgr.is() )
- {
- xDesktop = uno::Reference< XComponent > ( xMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ) ), UNO_QUERY ) ;
- if (xDesktop.is())
- xDesktop->addEventListener( this );
- }
-}
-
-LinguMgrAppExitLstnr::~LinguMgrAppExitLstnr()
-{
- if (xDesktop.is())
- {
- xDesktop->removeEventListener( this );
- xDesktop = NULL; //! release reference to desktop
- }
- OSL_ENSURE(!xDesktop.is(), "reference to desktop should be realeased");
-}
-
-void LinguMgrAppExitLstnr::disposing(const EventObject& rSource)
- throw( RuntimeException )
-{
- if (xDesktop.is() && rSource.Source == xDesktop)
- {
- xDesktop->removeEventListener( this );
- xDesktop = NULL; //! release reference to desktop
-
- AtExit();
- }
-}
-
-class LinguMgrExitLstnr : public LinguMgrAppExitLstnr
-{
-public:
- virtual void AtExit();
-};
-
-void LinguMgrExitLstnr::AtExit()
-{
- // release references
- LinguMgr::xLngSvcMgr = 0;
- LinguMgr::xSpell = 0;
- LinguMgr::xHyph = 0;
- LinguMgr::xThes = 0;
- LinguMgr::xDicList = 0;
- LinguMgr::xProp = 0;
- LinguMgr::xIgnoreAll = 0;
- LinguMgr::xChangeAll = 0;
-
- LinguMgr::bExiting = sal_True;
-
- LinguMgr::pExitLstnr = 0;
-}
-
-
-LinguMgrExitLstnr * LinguMgr::pExitLstnr = 0;
-sal_Bool LinguMgr::bExiting = sal_False;
-uno::Reference< XLinguServiceManager > LinguMgr::xLngSvcMgr = 0;
-uno::Reference< XSpellChecker1 > LinguMgr::xSpell = 0;
-uno::Reference< XHyphenator > LinguMgr::xHyph = 0;
-uno::Reference< XThesaurus > LinguMgr::xThes = 0;
-uno::Reference< XDictionaryList > LinguMgr::xDicList = 0;
-uno::Reference< XPropertySet > LinguMgr::xProp = 0;
-uno::Reference< XDictionary > LinguMgr::xIgnoreAll = 0;
-uno::Reference< XDictionary > LinguMgr::xChangeAll = 0;
-
-
-uno::Reference< XLinguServiceManager > LinguMgr::GetLngSvcMgr()
-{
- if (bExiting)
- return 0;
-
- if (!pExitLstnr)
- pExitLstnr = new LinguMgrExitLstnr;
-
- if (!xLngSvcMgr.is())
- xLngSvcMgr = GetLngSvcMgr_Impl();
-
- return xLngSvcMgr;
-}
-
-
-uno::Reference< XSpellChecker1 > LinguMgr::GetSpellChecker()
-{
- return xSpell.is() ? xSpell : GetSpell();
-}
-
-uno::Reference< XHyphenator > LinguMgr::GetHyphenator()
-{
- return xHyph.is() ? xHyph : GetHyph();
-}
-
-uno::Reference< XThesaurus > LinguMgr::GetThesaurus()
-{
- return xThes.is() ? xThes : GetThes();
-}
-
-uno::Reference< XDictionaryList > LinguMgr::GetDictionaryList()
-{
- return xDicList.is() ? xDicList : GetDicList();
-}
-
-uno::Reference< XPropertySet > LinguMgr::GetLinguPropertySet()
-{
- return xProp.is() ? xProp : GetProp();
-}
-
-uno::Reference< XDictionary > LinguMgr::GetStandardDic()
-{
- //! don't hold reference to this
- //! (it may be removed from dictionary list and needs to be
- //! created empty if accessed again)
- return GetStandard();
-}
-
-uno::Reference< XDictionary > LinguMgr::GetIgnoreAllList()
-{
- return xIgnoreAll.is() ? xIgnoreAll : GetIgnoreAll();
-}
-
-uno::Reference< XDictionary > LinguMgr::GetChangeAllList()
-{
- return xChangeAll.is() ? xChangeAll : GetChangeAll();
-}
-
-uno::Reference< XSpellChecker1 > LinguMgr::GetSpell()
-{
- if (bExiting)
- return 0;
-
- if (!pExitLstnr)
- pExitLstnr = new LinguMgrExitLstnr;
-
- //! use dummy implementation in order to avoid loading of lingu DLL
- xSpell = new SpellDummy_Impl;
- return xSpell;
-}
-
-uno::Reference< XHyphenator > LinguMgr::GetHyph()
-{
- if (bExiting)
- return 0;
-
- if (!pExitLstnr)
- pExitLstnr = new LinguMgrExitLstnr;
-
- //! use dummy implementation in order to avoid loading of lingu DLL
- xHyph = new HyphDummy_Impl;
- return xHyph;
-}
-
-uno::Reference< XThesaurus > LinguMgr::GetThes()
-{
- if (bExiting)
- return 0;
-
- if (!pExitLstnr)
- pExitLstnr = new LinguMgrExitLstnr;
-
- //! use dummy implementation in order to avoid loading of lingu DLL
- //! when only the XSupportedLocales interface is used.
- //! The dummy accesses the real implementation (and thus loading the DLL)
- //! when "real" work needs to be done only.
- xThes = new ThesDummy_Impl;
- return xThes;
-}
-
-
-void LinguMgr::UpdateAll()
-{
-}
-
-
-uno::Reference< XDictionaryList > LinguMgr::GetDicList()
-{
- if (bExiting)
- return 0;
-
- if (!pExitLstnr)
- pExitLstnr = new LinguMgrExitLstnr;
-
- uno::Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() );
- if (xMgr.is())
- {
- xDicList = uno::Reference< XDictionaryList > ( xMgr->createInstance(
- A2OU("com.sun.star.linguistic2.DictionaryList") ), UNO_QUERY );
- }
- return xDicList;
-}
-
-uno::Reference< XPropertySet > LinguMgr::GetProp()
-{
- if (bExiting)
- return 0;
-
- if (!pExitLstnr)
- pExitLstnr = new LinguMgrExitLstnr;
-
- uno::Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() );
- if (xMgr.is())
- {
- xProp = uno::Reference< XPropertySet > ( xMgr->createInstance(
- A2OU("com.sun.star.linguistic2.LinguProperties") ), UNO_QUERY );
- }
- return xProp;
-}
-
-uno::Reference< XDictionary > LinguMgr::GetIgnoreAll()
-{
- if (bExiting)
- return 0;
-
- if (!pExitLstnr)
- pExitLstnr = new LinguMgrExitLstnr;
-
- uno::Reference< XDictionaryList > xTmpDicList( GetDictionaryList() );
- if (xTmpDicList.is())
- {
- xIgnoreAll = uno::Reference< XDictionary > ( xTmpDicList->getDictionaryByName(
- A2OU("IgnoreAllList") ), UNO_QUERY );
- }
- return xIgnoreAll;
-}
-
-uno::Reference< XDictionary > LinguMgr::GetChangeAll()
-{
- if (bExiting)
- return 0;
-
- if (!pExitLstnr)
- pExitLstnr = new LinguMgrExitLstnr;
-
- uno::Reference< XDictionaryList > _xDicList( GetDictionaryList() , UNO_QUERY );
- if (_xDicList.is())
- {
- xChangeAll = uno::Reference< XDictionary > (
- _xDicList->createDictionary(
- A2OU("ChangeAllList"),
- SvxCreateLocale( LANGUAGE_NONE ),
- DictionaryType_NEGATIVE, String() ), UNO_QUERY );
- }
- return xChangeAll;
-}
-
-uno::Reference< XDictionary > LinguMgr::GetStandard()
-{
- // Tries to return a dictionary which may hold positive entries is
- // persistent and not read-only.
-
- if (bExiting)
- return 0;
-
- uno::Reference< XDictionaryList > xTmpDicList( GetDictionaryList() );
- if (!xTmpDicList.is())
- return NULL;
-
- const OUString aDicName( RTL_CONSTASCII_USTRINGPARAM( "standard.dic" ) );
- uno::Reference< XDictionary > xDic( xTmpDicList->getDictionaryByName( aDicName ),
- UNO_QUERY );
- if (!xDic.is())
- {
- // try to create standard dictionary
- uno::Reference< XDictionary > xTmp;
- try
- {
- xTmp = xTmpDicList->createDictionary( aDicName,
- SvxCreateLocale( LANGUAGE_NONE ),
- DictionaryType_POSITIVE,
- linguistic::GetWritableDictionaryURL( aDicName ) );
- }
- catch(com::sun::star::uno::Exception &)
- {
- }
-
- // add new dictionary to list
- if (xTmp.is())
- {
- xTmpDicList->addDictionary( xTmp );
- xTmp->setActive( sal_True );
- }
- xDic = uno::Reference< XDictionary > ( xTmp, UNO_QUERY );
- }
-#if OSL_DEBUG_LEVEL > 1
- uno::Reference< XStorable > xStor( xDic, UNO_QUERY );
- OSL_ENSURE( xDic.is() && xDic->getDictionaryType() == DictionaryType_POSITIVE,
- "wrong dictionary type");
- OSL_ENSURE( xDic.is() && SvxLocaleToLanguage( xDic->getLocale() ) == LANGUAGE_NONE,
- "wrong dictionary language");
- OSL_ENSURE( !xStor.is() || (xStor->hasLocation() && !xStor->isReadonly()),
- "dictionary not editable" );
-#endif
-
- return xDic;
-}
-
-uno::Reference< XSpellChecker1 > SvxGetSpellChecker()
-{
- return LinguMgr::GetSpellChecker();
-}
-
-uno::Reference< XHyphenator > SvxGetHyphenator()
-{
- return LinguMgr::GetHyphenator();
-}
-
-uno::Reference< XThesaurus > SvxGetThesaurus()
-{
- return LinguMgr::GetThesaurus();
-}
-
-uno::Reference< XDictionaryList > SvxGetDictionaryList()
-{
- return LinguMgr::GetDictionaryList();
-}
-
-uno::Reference< XPropertySet > SvxGetLinguPropertySet()
-{
- return LinguMgr::GetLinguPropertySet();
-}
-
-//TODO: remove argument or provide SvxGetIgnoreAllList with the same one
-uno::Reference< XDictionary > SvxGetOrCreatePosDic(
- uno::Reference< XDictionaryList > /* xDicList */ )
-{
- return LinguMgr::GetStandardDic();
-}
-
-uno::Reference< XDictionary > SvxGetIgnoreAllList()
-{
- return LinguMgr::GetIgnoreAllList();
-}
-
-uno::Reference< XDictionary > SvxGetChangeAllList()
-{
- return LinguMgr::GetChangeAllList();
-}
-
-#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
-
-SvxAlternativeSpelling SvxGetAltSpelling(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenatedWord > & rHyphWord )
-{
- SvxAlternativeSpelling aRes;
- if (rHyphWord.is() && rHyphWord->isAlternativeSpelling())
- {
- OUString aWord( rHyphWord->getWord() ),
- aAltWord( rHyphWord->getHyphenatedWord() );
- sal_Int16 nHyphenationPos = rHyphWord->getHyphenationPos(),
- nHyphenPos = rHyphWord->getHyphenPos();
- sal_Int16 nLen = (sal_Int16)aWord.getLength();
- sal_Int16 nAltLen = (sal_Int16)aAltWord.getLength();
- const sal_Unicode *pWord = aWord.getStr(),
- *pAltWord = aAltWord.getStr();
-
- // count number of chars from the left to the
- // hyphenation pos / hyphen pos that are equal
- sal_Int16 nL = 0;
- while (nL <= nHyphenationPos && nL <= nHyphenPos
- && pWord[ nL ] == pAltWord[ nL ])
- ++nL;
- // count number of chars from the right to the
- // hyphenation pos / hyphen pos that are equal
- sal_Int16 nR = 0;
- sal_Int32 nIdx = nLen - 1;
- sal_Int32 nAltIdx = nAltLen - 1;
- while (nIdx > nHyphenationPos && nAltIdx > nHyphenPos
- && pWord[ nIdx-- ] == pAltWord[ nAltIdx-- ])
- ++nR;
-
- aRes.aReplacement = OUString( aAltWord.copy( nL, nAltLen - nL - nR ) );
- aRes.nChangedPos = (sal_Int16) nL;
- aRes.nChangedLength = nLen - nL - nR;
- aRes.bIsAltSpelling = sal_True;
- aRes.xHyphWord = rHyphWord;
- }
- return aRes;
-}
-
-
-SvxDicListChgClamp::SvxDicListChgClamp( uno::Reference< XDictionaryList > &rxDicList ) :
- xDicList ( rxDicList )
-{
- if (xDicList.is())
- {
- xDicList->beginCollectEvents();
- }
-}
-
-SvxDicListChgClamp::~SvxDicListChgClamp()
-{
- if (xDicList.is())
- {
- xDicList->endCollectEvents();
- }
-}
-
-short SvxDicError( Window *pParent, sal_Int16 nError )
-{
- short nRes = 0;
- if (DIC_ERR_NONE != nError)
- {
- int nRid;
- switch (nError)
- {
- case DIC_ERR_FULL : nRid = RID_SVXSTR_DIC_ERR_FULL; break;
- case DIC_ERR_READONLY : nRid = RID_SVXSTR_DIC_ERR_READONLY; break;
- default:
- nRid = RID_SVXSTR_DIC_ERR_UNKNOWN;
- OSL_FAIL("unexpected case");
- }
- nRes = InfoBox( pParent, EE_RESSTR( nRid ) ).Execute();
- }
- return nRes;
-}
-
-LanguageType SvxLocaleToLanguage( const Locale& rLocale )
-{
- if ( rLocale.Language.getLength() == 0 )
- return LANGUAGE_NONE;
-
- return MsLangId::convertLocaleToLanguage( rLocale );
-}
-
-Locale& SvxLanguageToLocale( Locale& rLocale, LanguageType eLang )
-{
- if ( eLang != LANGUAGE_NONE )
- MsLangId::convertLanguageToLocale( eLang, rLocale );
- else
- rLocale = Locale();
-
- return rLocale;
-}
-
-Locale SvxCreateLocale( LanguageType eLang )
-{
- Locale aLocale;
- 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
deleted file mode 100644
index 1eff044ef9..0000000000
--- a/editeng/source/outliner/outl_pch.cxx
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#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
deleted file mode 100644
index 289b475f98..0000000000
--- a/editeng/source/outliner/outl_pch.hxx
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#include <svl/intitem.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/editdata.hxx>
-#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
deleted file mode 100644
index 75164f9ebd..0000000000
--- a/editeng/source/outliner/outleeng.cxx
+++ /dev/null
@@ -1,222 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <svl/intitem.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/fhgtitem.hxx>
-
-#define _OUTLINER_CXX
-#include <editeng/outliner.hxx>
-#include <outleeng.hxx>
-#include <paralist.hxx>
-#include <editeng/editrids.hrc>
-#include <svl/itemset.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/editstat.hxx>
-#include "outlundo.hxx"
-
-OutlinerEditEng::OutlinerEditEng( Outliner* pEngOwner, SfxItemPool* pPool )
- : EditEngine( pPool )
-{
- pOwner = pEngOwner;
-}
-
-OutlinerEditEng::~OutlinerEditEng()
-{
-}
-
-void OutlinerEditEng::PaintingFirstLine( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
-{
- if( GetControlWord() && EE_CNTRL_OUTLINER )
- {
- PaintFirstLineInfo aInfo( nPara, rStartPos, nBaseLineY, rOrigin, nOrientation, pOutDev );
- pOwner->maPaintFirstLineHdl.Call( &aInfo );
- }
-
- pOwner->PaintBullet( nPara, rStartPos, rOrigin, nOrientation, pOutDev );
-}
-
-const SvxNumberFormat* OutlinerEditEng::GetNumberFormat( sal_uInt16 nPara ) const
-{
- const SvxNumberFormat* pFmt = NULL;
- if (pOwner)
- pFmt = pOwner->GetNumberFormat( nPara );
- return pFmt;
-}
-
-
-Rectangle OutlinerEditEng::GetBulletArea( sal_uInt16 nPara )
-{
- Rectangle aBulletArea = Rectangle( Point(), Point() );
- if ( nPara < pOwner->pParaList->GetParagraphCount() )
- {
- if ( pOwner->ImplHasBullet( nPara ) )
- aBulletArea = pOwner->ImpCalcBulletArea( nPara, sal_False, sal_False );
- }
- return aBulletArea;
-}
-
-void OutlinerEditEng::ParagraphInserted( sal_uInt16 nNewParagraph )
-{
- pOwner->ParagraphInserted( nNewParagraph );
-
- EditEngine::ParagraphInserted( nNewParagraph );
-}
-
-void OutlinerEditEng::ParagraphDeleted( sal_uInt16 nDeletedParagraph )
-{
- pOwner->ParagraphDeleted( nDeletedParagraph );
-
- EditEngine::ParagraphDeleted( nDeletedParagraph );
-}
-
-void OutlinerEditEng::ParagraphConnected( sal_uInt16 /*nLeftParagraph*/, sal_uInt16 nRightParagraph )
-{
- if( pOwner && pOwner->IsUndoEnabled() && !const_cast<EditEngine&>(pOwner->GetEditEngine()).IsInUndo() )
- {
- Paragraph* pPara = pOwner->GetParagraph( nRightParagraph );
- if( pPara && pOwner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
- {
- pOwner->InsertUndo( new OutlinerUndoChangeParaFlags( pOwner, nRightParagraph, PARAFLAG_ISPAGE, 0 ) );
- }
- }
-}
-
-
-void OutlinerEditEng::StyleSheetChanged( SfxStyleSheet* pStyle )
-{
- pOwner->StyleSheetChanged( pStyle );
-}
-
-void OutlinerEditEng::ParaAttribsChanged( sal_uInt16 nPara )
-{
- pOwner->ParaAttribsChanged( nPara );
-}
-
-sal_Bool OutlinerEditEng::SpellNextDocument()
-{
- return pOwner->SpellNextDocument();
-}
-
-sal_Bool OutlinerEditEng::ConvertNextDocument()
-{
- return pOwner->ConvertNextDocument();
-}
-
-XubString OutlinerEditEng::GetUndoComment( sal_uInt16 nUndoId ) const
-{
- switch( nUndoId )
- {
- case OLUNDO_DEPTH:
- return XubString( EditResId( RID_OUTLUNDO_DEPTH ));
-
- case OLUNDO_EXPAND:
- return XubString( EditResId( RID_OUTLUNDO_EXPAND ));
-
- case OLUNDO_COLLAPSE:
- return XubString( EditResId( RID_OUTLUNDO_COLLAPSE ));
-
- case OLUNDO_ATTR:
- return XubString( EditResId( RID_OUTLUNDO_ATTR ));
-
- case OLUNDO_INSERT:
- return XubString( EditResId( RID_OUTLUNDO_INSERT ));
-
- default:
- return EditEngine::GetUndoComment( nUndoId );
- }
-}
-
-void OutlinerEditEng::DrawingText( const Point& rStartPos, const XubString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen,
- const sal_Int32* pDXArray, const SvxFont& rFont, sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt8 nRightToLeft,
- const EEngineData::WrongSpellVector* pWrongSpellVector,
- const SvxFieldData* pFieldData,
- bool bEndOfLine,
- bool bEndOfParagraph,
- bool bEndOfBullet,
- const ::com::sun::star::lang::Locale* pLocale,
- const Color& rOverlineColor,
- const Color& rTextLineColor)
-{
- 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 ); // If URL
- pOwner->FieldClicked( rField, nPara, nPos );
-}
-
-void OutlinerEditEng::FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos )
-{
- pOwner->FieldSelected( rField, nPara, nPos );
-}
-
-XubString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor )
-{
- return pOwner->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
-}
-
-void OutlinerEditEng::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
-{
- Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
- if( pPara )
- {
- if ( !IsInUndo() && IsUndoEnabled() )
- pOwner->UndoActionStart( OLUNDO_ATTR );
-
- EditEngine::SetParaAttribs( (sal_uInt16)nPara, rSet );
-
- pOwner->ImplCheckNumBulletItem( (sal_uInt16)nPara );
- // #i100014#
- // It is not a good idea to substract 1 from a count and cast the result
- // to USHORT without check, if the count is 0.
- pOwner->ImplCheckParagraphs( (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
deleted file mode 100644
index cbe254c845..0000000000
--- a/editeng/source/outliner/outleeng.hxx
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _OUTLEENG_HXX
-#define _OUTLEENG_HXX
-
-#include <editeng/outliner.hxx>
-#include <editeng/editeng.hxx>
-
-typedef EENotify* EENotifyPtr;
-SV_DECL_PTRARR_DEL( NotifyList, EENotifyPtr, 1, 1 )
-
-class OutlinerEditEng : public EditEngine
-{
- Outliner* pOwner;
-
-protected:
-
- // derived from EditEngine. Allows Outliner objetcs to provide
- // bullet access to the EditEngine.
- virtual const SvxNumberFormat* GetNumberFormat( sal_uInt16 nPara ) const;
-
-public:
- OutlinerEditEng( Outliner* pOwner, SfxItemPool* pPool );
- ~OutlinerEditEng();
-
- virtual void PaintingFirstLine( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev );
-
- virtual void ParagraphInserted( sal_uInt16 nNewParagraph );
- virtual void ParagraphDeleted( sal_uInt16 nDeletedParagraph );
- virtual void ParagraphConnected( sal_uInt16 nLeftParagraph, sal_uInt16 nRightParagraph );
-
- virtual void DrawingText(
- const Point& rStartPos, const XubString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, const sal_Int32* pDXArray, const SvxFont& rFont,
- sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt8 nRightToLeft,
- const EEngineData::WrongSpellVector* pWrongSpellVector,
- const SvxFieldData* pFieldData,
- bool bEndOfLine,
- bool bEndOfParagraph,
- bool bEndOfBullet,
- const ::com::sun::star::lang::Locale* pLocale,
- 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();
- virtual XubString GetUndoComment( sal_uInt16 nUndoId ) const;
-
- // for text conversion
- virtual sal_Bool ConvertNextDocument();
-
- virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos );
- virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos );
- virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rTxtColor, Color*& rFldColor );
-
- virtual Rectangle GetBulletArea( sal_uInt16 nPara );
-
- virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
-
- // belongs into class Outliner, move there before incompatible update!
- Link aOutlinerNotifyHdl;
- NotifyList aNotifyCache;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx
deleted file mode 100644
index 0db66467b4..0000000000
--- a/editeng/source/outliner/outlin2.cxx
+++ /dev/null
@@ -1,819 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <svl/intitem.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <svl/style.hxx>
-#include <vcl/mapmod.hxx>
-
-#include <editeng/forbiddencharacterstable.hxx>
-
-#define _OUTLINER_CXX
-
-#include <editeng/outliner.hxx>
-#include <paralist.hxx>
-#include <editeng/outlobj.hxx>
-#include <outleeng.hxx>
-#include <outlundo.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/editstat.hxx>
-
-DBG_NAMEEX(Outliner)
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::linguistic2;
-
-// ======================================================================
-// ====================== Simple pass-through =======================
-// ======================================================================
-
-void Outliner::SetUpdateMode( sal_Bool bUpdate )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetUpdateMode( bUpdate );
-}
-
-
-sal_Bool Outliner::GetUpdateMode() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetUpdateMode();
-}
-
-const SfxItemSet& Outliner::GetEmptyItemSet() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetEmptyItemSet();
-}
-
-void Outliner::EnableUndo( sal_Bool bEnable )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->EnableUndo( bEnable );
-}
-
-sal_Bool Outliner::IsUndoEnabled() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->IsUndoEnabled();
-}
-
-MapMode Outliner::GetRefMapMode() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetRefMapMode();
-}
-
-void Outliner::SetRefMapMode( const MapMode& rMMode )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetRefMapMode( rMMode );
-}
-
-void Outliner::SetBackgroundColor( const Color& rColor )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetBackgroundColor( rColor );
-}
-
-Color Outliner::GetBackgroundColor() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetBackgroundColor();
-}
-
-
-void Outliner::ClearModifyFlag()
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->ClearModifyFlag();
-}
-
-sal_Bool Outliner::IsModified() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->IsModified();
-}
-
-sal_uLong Outliner::GetTextHeight() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetTextHeight();
-}
-
-void Outliner::SetModifyHdl( const Link& rLink )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetModifyHdl( rLink );
-}
-
-Link Outliner::GetModifyHdl() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetModifyHdl();
-}
-
-void Outliner::SetNotifyHdl( const Link& rLink )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->aOutlinerNotifyHdl = rLink;
-
- if ( rLink.IsSet() )
- pEditEngine->SetNotifyHdl( LINK( this, Outliner, EditEngineNotifyHdl ) );
- else
- pEditEngine->SetNotifyHdl( Link() );
-
-}
-
-Link Outliner::GetNotifyHdl() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->aOutlinerNotifyHdl;
-}
-
-void Outliner::SetStatusEventHdl( const Link& rLink )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetStatusEventHdl( rLink );
-}
-
-Link Outliner::GetStatusEventHdl() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetStatusEventHdl();
-}
-
-void Outliner::SetDefTab( sal_uInt16 nTab )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetDefTab( nTab );
-}
-
-sal_uInt16 Outliner::GetDefTab() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetDefTab();
-}
-
-sal_Bool Outliner::IsFlatMode() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->IsFlatMode();
-}
-
-sal_Bool Outliner::UpdateFields()
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->UpdateFields();
-}
-
-void Outliner::RemoveFields( sal_Bool bKeepFieldText, TypeId aType )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->RemoveFields( bKeepFieldText, aType );
-}
-
-void Outliner::SetWordDelimiters( const String& rDelimiters )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetWordDelimiters( rDelimiters );
-}
-
-String Outliner::GetWordDelimiters() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetWordDelimiters();
-}
-
-String Outliner::GetWord( sal_uInt16 nPara, sal_uInt16 nIndex )
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetWord( nPara, nIndex );
-}
-
-void Outliner::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->Draw( pOutDev, rOutRect );
-}
-
-void Outliner::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->Draw( pOutDev, rOutRect, rStartDocPos );
-}
-
-
-void Outliner::Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->Draw( pOutDev, rStartPos, nOrientation );
-}
-
-void Outliner::SetPaperSize( const Size& rSize )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetPaperSize( rSize );
-}
-
-const Size& Outliner::GetPaperSize() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetPaperSize();
-}
-
-void Outliner::SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon )
-{
- DBG_CHKTHIS( Outliner, 0 );
- pEditEngine->SetPolygon( rPolyPolygon );
-}
-
-void Outliner::SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon)
-{
- DBG_CHKTHIS( Outliner, 0 );
- pEditEngine->SetPolygon( rPolyPolygon, pLinePolyPolygon);
-}
-
-void Outliner::ClearPolygon()
-{
- DBG_CHKTHIS( Outliner, 0 );
- pEditEngine->ClearPolygon();
-}
-
-const PolyPolygon* Outliner::GetPolygon()
-{
- DBG_CHKTHIS( Outliner, 0 );
- return pEditEngine->GetPolygon();
-}
-
-const Size& Outliner::GetMinAutoPaperSize() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetMinAutoPaperSize();
-}
-
-void Outliner::SetMinAutoPaperSize( const Size& rSz )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetMinAutoPaperSize( rSz );
-}
-
-const Size& Outliner::GetMaxAutoPaperSize() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetMaxAutoPaperSize();
-}
-
-void Outliner::SetMaxAutoPaperSize( const Size& rSz )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetMaxAutoPaperSize( rSz );
-}
-
-sal_Bool Outliner::IsExpanded( Paragraph* pPara ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return pParaList->HasVisibleChilds( pPara );
-}
-
-Paragraph* Outliner::GetParent( Paragraph* pParagraph ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return pParaList->GetParent( pParagraph );
-}
-
-sal_uLong Outliner::GetChildCount( Paragraph* pParent ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return pParaList->GetChildCount( pParent );
-}
-
-Size Outliner::CalcTextSize()
-{
- DBG_CHKTHIS(Outliner,0);
- return Size(pEditEngine->CalcTextWidth(),pEditEngine->GetTextHeight());
-}
-
-Size Outliner::CalcTextSizeNTP()
-{
- DBG_CHKTHIS(Outliner,0);
- return Size(pEditEngine->CalcTextWidth(),pEditEngine->GetTextHeightNTP());
-}
-
-Point Outliner::GetDocPos( Paragraph* pPara )
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetDocPosTopLeft( (sal_uInt16)pParaList->GetAbsPos( pPara ) );
-}
-
-void Outliner::SetStyleSheetPool( SfxStyleSheetPool* pSPool )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetStyleSheetPool( pSPool );
-}
-
-SfxStyleSheetPool* Outliner::GetStyleSheetPool()
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetStyleSheetPool();
-}
-
-SfxStyleSheet* Outliner::GetStyleSheet( sal_uLong nPara )
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetStyleSheet( (sal_uInt16)nPara );
-}
-
-sal_Bool Outliner::IsInSelectionMode() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->IsInSelectionMode();
-}
-
-void Outliner::SetControlWord( sal_uLong nWord )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetControlWord( nWord );
-}
-
-sal_uLong Outliner::GetControlWord() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetControlWord();
-}
-
-void Outliner::SetAsianCompressionMode( sal_uInt16 n )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetAsianCompressionMode( n );
-}
-
-sal_uInt16 Outliner::GetAsianCompressionMode() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetAsianCompressionMode();
-}
-
-void Outliner::SetKernAsianPunctuation( sal_Bool b )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetKernAsianPunctuation( b );
-}
-
-sal_Bool Outliner::IsKernAsianPunctuation() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->IsKernAsianPunctuation();
-}
-
-void Outliner::SetAddExtLeading( sal_Bool bExtLeading )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetAddExtLeading( bExtLeading );
-}
-
-sal_Bool Outliner::IsAddExtLeading() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->IsAddExtLeading();
-}
-
-void Outliner::UndoActionStart( sal_uInt16 nId )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->UndoActionStart( nId );
-}
-
-void Outliner::UndoActionEnd( sal_uInt16 nId )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->UndoActionEnd( nId );
-}
-
-void Outliner::InsertUndo( EditUndo* pUndo )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->GetUndoManager().AddUndoAction( pUndo, sal_False );
-}
-
-sal_Bool Outliner::IsInUndo()
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->IsInUndo();
-}
-
-sal_uLong Outliner::GetLineCount( sal_uLong nParagraph ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetLineCount( (sal_uInt16)nParagraph );
-}
-
-sal_uInt16 Outliner::GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetLineLen( (sal_uInt16)nParagraph, nLine );
-}
-
-sal_uLong Outliner::GetLineHeight( sal_uLong nParagraph, sal_uLong nLine )
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetLineHeight( (sal_uInt16)nParagraph, (sal_uInt16)nLine );
-}
-
-void Outliner::QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->QuickRemoveCharAttribs( nPara, nWhich );
-}
-
-EESpellState Outliner::HasSpellErrors()
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->HasSpellErrors();
-}
-
-sal_Bool Outliner::HasConvertibleTextPortion( LanguageType nLang )
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->HasConvertibleTextPortion( nLang );
-}
-
-sal_Bool Outliner::ConvertNextDocument()
-{
- DBG_CHKTHIS(Outliner,0);
- return sal_False;
-}
-
-void Outliner::SetDefaultLanguage( LanguageType eLang )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetDefaultLanguage( eLang );
-}
-
-LanguageType Outliner::GetDefaultLanguage() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetDefaultLanguage();
-}
-
-sal_Bool Outliner::HasOnlineSpellErrors() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->HasOnlineSpellErrors();
-}
-
-void Outliner::CompleteOnlineSpelling()
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->CompleteOnlineSpelling();
-}
-
-sal_Bool Outliner::HasText( const SvxSearchItem& rSearchItem )
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->HasText( rSearchItem );
-}
-
-void Outliner::SetEditTextObjectPool( SfxItemPool* pPool )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetEditTextObjectPool( pPool );
-}
-
-SfxItemPool* Outliner::GetEditTextObjectPool() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetEditTextObjectPool();
-}
-
-sal_Bool Outliner::SpellNextDocument()
-{
- DBG_CHKTHIS(Outliner,0);
- return sal_False;
-}
-
-
-void Outliner::SetSpeller( Reference< XSpellChecker1 > &xSpeller )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetSpeller( xSpeller );
-}
-Reference< XSpellChecker1 > Outliner::GetSpeller()
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetSpeller();
-}
-
-void Outliner::SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetForbiddenCharsTable( xForbiddenChars );
-}
-
-rtl::Reference<SvxForbiddenCharactersTable> Outliner::GetForbiddenCharsTable() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetForbiddenCharsTable();
-}
-
-
-Reference< XHyphenator > Outliner::GetHyphenator() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetHyphenator();
-}
-
-void Outliner::SetHyphenator( Reference< XHyphenator >& xHyph )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetHyphenator( xHyph );
-}
-
-OutputDevice* Outliner::GetRefDevice() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetRefDevice();
-}
-
-sal_uInt16 Outliner::GetFirstLineOffset( sal_uLong nParagraph )
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetFirstLineOffset( (sal_uInt16)nParagraph );
-}
-
-sal_uLong Outliner::GetTextHeight( sal_uLong nParagraph ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetTextHeight((sal_uInt16)nParagraph );
-}
-
-Point Outliner::GetDocPos( const Point& rPaperPos ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetDocPos( rPaperPos );
-}
-
-Point Outliner::GetDocPosTopLeft( sal_uLong nParagraph )
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetDocPosTopLeft( (sal_uInt16)nParagraph );
-}
-
-sal_Bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder )
-{
- return IsTextPos( rPaperPos, nBorder, NULL );
-}
-
-sal_Bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bool* pbBullet )
-{
- DBG_CHKTHIS(Outliner,0);
- if ( pbBullet)
- *pbBullet = sal_False;
- sal_Bool bTextPos = pEditEngine->IsTextPos( rPaperPos, nBorder );
- if ( !bTextPos )
- {
- Point aDocPos = GetDocPos( rPaperPos );
- sal_uInt16 nPara = pEditEngine->FindParagraph( aDocPos.Y() );
- if ( ( nPara != EE_PARA_NOT_FOUND ) && ImplHasBullet( nPara ) )
- {
- Rectangle aBulArea = ImpCalcBulletArea( nPara, sal_True, sal_True );
- if ( aBulArea.IsInside( rPaperPos ) )
- {
- bTextPos = sal_True;
- if ( pbBullet)
- *pbBullet = sal_True;
- }
- }
- }
-
- return bTextPos;
-}
-
-void Outliner::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->QuickSetAttribs( rSet, rSel );
-}
-
-void Outliner::QuickInsertText( const XubString& rText, const ESelection& rSel )
-{
- bFirstParaIsEmpty = sal_False;
- pEditEngine->QuickInsertText( rText, rSel );
-}
-
-void Outliner::QuickDelete( const ESelection& rSel )
-{
- bFirstParaIsEmpty = sal_False;
- pEditEngine->QuickDelete( rSel );
-}
-
-void Outliner::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
-{
- DBG_CHKTHIS(Outliner,0);
- bFirstParaIsEmpty = sal_False;
- pEditEngine->QuickInsertField( rFld, rSel );
-}
-
-void Outliner::QuickInsertLineBreak( const ESelection& rSel )
-{
- DBG_CHKTHIS(Outliner,0);
- bFirstParaIsEmpty = sal_False;
- pEditEngine->QuickInsertLineBreak( rSel );
-}
-
-void Outliner::QuickFormatDoc( sal_Bool bFull )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->QuickFormatDoc( 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 );
-}
-
-void Outliner::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->GetGlobalCharStretching( rX, rY );
-}
-
-
-void Outliner::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->DoStretchChars( nX, nY );
-}
-
-void Outliner::EraseVirtualDevice()
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->EraseVirtualDevice();
-}
-
-void Outliner::SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetBigTextObjectStart( nStartAtPortionCount );
-}
-
-sal_uInt16 Outliner::GetBigTextObjectStart() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetBigTextObjectStart();
-}
-
-sal_Bool Outliner::ShouldCreateBigTextObject() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->ShouldCreateBigTextObject();
-}
-
-void Outliner::SetVertical( sal_Bool b )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetVertical( b );
-}
-
-sal_Bool Outliner::IsVertical() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->IsVertical();
-}
-
-void Outliner::SetFixedCellHeight( sal_Bool bUseFixedCellHeight )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetFixedCellHeight( bUseFixedCellHeight );
-}
-
-sal_Bool Outliner::IsFixedCellHeight() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->IsFixedCellHeight();
-}
-
-
-void Outliner::SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetDefaultHorizontalTextDirection( eHTextDir );
-}
-
-EEHorizontalTextDirection Outliner::GetDefaultHorizontalTextDirection() const
-{
- return pEditEngine->GetDefaultHorizontalTextDirection();
-}
-
-sal_uInt16 Outliner::GetScriptType( const ESelection& rSelection ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetScriptType( rSelection );
-}
-
-LanguageType Outliner::GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetLanguage( nPara, nPos );
-}
-
-void Outliner::RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->RemoveAttribs( rSelection, bRemoveParaAttribs, nWhich );
-}
-
-void Outliner::EnableAutoColor( sal_Bool b )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->EnableAutoColor( b );
-}
-
-sal_Bool Outliner::IsAutoColorEnabled() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->IsAutoColorEnabled();
-}
-
-void Outliner::ForceAutoColor( sal_Bool b )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->ForceAutoColor( b );
-}
-
-sal_Bool Outliner::IsForceAutoColor() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->IsForceAutoColor();
-}
-
-void Outliner::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc)
-{
- pEditEngine->StartSpelling(rEditView, bMultipleDoc);
-}
-
-void Outliner::EndSpelling()
-{
- pEditEngine->EndSpelling();
-}
-
-bool Outliner::SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking )
-{
- return pEditEngine->SpellSentence(rEditView, rToFill, bIsGrammarChecking );
-}
-
-void Outliner::PutSpellingToSentenceStart( EditView& rEditView )
-{
- pEditEngine->PutSpellingToSentenceStart( rEditView );
-}
-
-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
deleted file mode 100644
index 7e23e18235..0000000000
--- a/editeng/source/outliner/outliner.cxx
+++ /dev/null
@@ -1,2193 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <svl/intitem.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/fhgtitem.hxx>
-
-#include <math.h>
-#include <svl/style.hxx>
-#include <vcl/wrkwin.hxx>
-#define _OUTLINER_CXX
-#include <editeng/outliner.hxx>
-#include <paralist.hxx>
-#include <editeng/outlobj.hxx>
-#include <outleeng.hxx>
-#include <outlundo.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/editstat.hxx>
-#include <editeng/scripttypeitem.hxx>
-#include <editeng/editobj.hxx>
-#include <svl/itemset.hxx>
-#include <svl/whiter.hxx>
-#include <vcl/metric.hxx>
-#include <editeng/numitem.hxx>
-#include <editeng/adjitem.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/gdimtf.hxx>
-#include <vcl/metaact.hxx>
-#include <svtools/grfmgr.hxx>
-#include <editeng/svxfont.hxx>
-#include <editeng/brshitem.hxx>
-#include <svl/itempool.hxx>
-
-// 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; // Special treatment for the first 3 levels
-static const sal_uInt16 nDefBulletIndent = 800;
-static const sal_uInt16 nDefBulletWidth = 700;
-static const sal_uInt16 pDefBulletIndents[nDefStyles]= { 1400, 800, 800 };
-static const sal_uInt16 pDefBulletWidths[nDefStyles] = { 1000, 850, 700 };
-
-// ----------------------------------------------------------------------
-// Outliner
-// ----------------------------------------------------------------------
-DBG_NAME(Outliner);
-
-void Outliner::ImplCheckDepth( sal_Int16& rnDepth ) const
-{
- if( rnDepth < nMinDepth )
- rnDepth = nMinDepth;
- else if( rnDepth > nMaxDepth )
- rnDepth = nMaxDepth;
-}
-
-Paragraph* Outliner::Insert(const XubString& rText, sal_uLong nAbsPos, sal_Int16 nDepth)
-{
- DBG_CHKTHIS(Outliner,0);
- DBG_ASSERT(pParaList->GetParagraphCount(),"Insert:No Paras");
-
- Paragraph* pPara;
-
- ImplCheckDepth( nDepth );
-
- sal_uLong nParagraphCount = pParaList->GetParagraphCount();
- if( nAbsPos > nParagraphCount )
- nAbsPos = nParagraphCount;
-
- if( bFirstParaIsEmpty )
- {
- pPara = pParaList->GetParagraph( 0 );
- if( pPara->GetDepth() != nDepth )
- {
- nDepthChangedHdlPrevDepth = pPara->GetDepth();
- mnDepthChangeHdlPrevFlags = pPara->nFlags;
- pPara->SetDepth( nDepth );
- pHdlParagraph = pPara;
- DepthChangedHdl();
- }
- pPara->nFlags |= PARAFLAG_HOLDDEPTH;
- SetText( rText, pPara );
- }
- else
- {
- sal_Bool bUpdate = pEditEngine->GetUpdateMode();
- pEditEngine->SetUpdateMode( sal_False );
- ImplBlockInsertionCallbacks( sal_True );
- pPara = new Paragraph( nDepth );
- pParaList->Insert( pPara, nAbsPos );
- pEditEngine->InsertParagraph( (sal_uInt16)nAbsPos, String() );
- DBG_ASSERT(pPara==pParaList->GetParagraph(nAbsPos),"Insert:Failed");
- ImplInitDepth( (sal_uInt16)nAbsPos, nDepth, sal_False );
- pHdlParagraph = pPara;
- ParagraphInsertedHdl();
- pPara->nFlags |= PARAFLAG_HOLDDEPTH;
- SetText( rText, pPara );
- ImplBlockInsertionCallbacks( sal_False );
- pEditEngine->SetUpdateMode( bUpdate );
- }
- bFirstParaIsEmpty = sal_False;
- DBG_ASSERT(pEditEngine->GetParagraphCount()==pParaList->GetParagraphCount(),"SetText failed");
- return pPara;
-}
-
-
-void Outliner::ParagraphInserted( sal_uInt16 nPara )
-{
- DBG_CHKTHIS(Outliner,0);
-
- if ( bBlockInsCallback )
- return;
-
- if( bPasting || pEditEngine->IsInUndo() )
- {
- Paragraph* pPara = new Paragraph( -1 );
- pParaList->Insert( pPara, nPara );
- if( pEditEngine->IsInUndo() )
- {
- pPara->nFlags = PARAFLAG_SETBULLETTEXT;
- pPara->bVisible = sal_True;
- const SfxInt16Item& rLevel = (const SfxInt16Item&) pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL );
- pPara->SetDepth( rLevel.GetValue() );
- }
- }
- else
- {
- sal_Int16 nDepth = -1;
- Paragraph* pParaBefore = pParaList->GetParagraph( nPara-1 );
- if ( pParaBefore )
- nDepth = pParaBefore->GetDepth();
-
- Paragraph* pPara = new Paragraph( nDepth );
- pParaList->Insert( pPara, nPara );
-
- if( !pEditEngine->IsInUndo() )
- {
- ImplCalcBulletText( nPara, sal_True, sal_False );
- pHdlParagraph = pPara;
- ParagraphInsertedHdl();
- }
- }
-}
-
-void Outliner::ParagraphDeleted( sal_uInt16 nPara )
-{
- DBG_CHKTHIS(Outliner,0);
-
- if ( bBlockInsCallback || ( nPara == EE_PARA_ALL ) )
- return;
-
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- if (!pPara)
- return;
-
- sal_Int16 nDepth = pPara->GetDepth();
-
- if( !pEditEngine->IsInUndo() )
- {
- pHdlParagraph = pPara;
- ParagraphRemovingHdl();
- }
-
- pParaList->Remove( nPara );
- delete pPara;
-
- if( !pEditEngine->IsInUndo() && !bPasting )
- {
- pPara = pParaList->GetParagraph( nPara );
- if ( pPara && ( pPara->GetDepth() > nDepth ) )
- {
- ImplCalcBulletText( nPara, sal_True, sal_False );
- // Search for next on the this level ...
- while ( pPara && pPara->GetDepth() > nDepth )
- pPara = pParaList->GetParagraph( ++nPara );
- }
-
- if ( pPara && ( pPara->GetDepth() == nDepth ) )
- ImplCalcBulletText( nPara, sal_True, sal_False );
- }
-}
-
-void Outliner::Init( sal_uInt16 nMode )
-{
- nOutlinerMode = nMode;
-
- Clear();
-
- sal_uLong nCtrl = pEditEngine->GetControlWord();
- nCtrl &= ~(EE_CNTRL_OUTLINER|EE_CNTRL_OUTLINER2);
-
- SetMaxDepth( 9 );
-
- switch ( ImplGetOutlinerMode() )
- {
- case OUTLINERMODE_TEXTOBJECT:
- case OUTLINERMODE_TITLEOBJECT:
- break;
-
- case OUTLINERMODE_OUTLINEOBJECT:
- nCtrl |= EE_CNTRL_OUTLINER2;
- break;
- case OUTLINERMODE_OUTLINEVIEW:
- nCtrl |= EE_CNTRL_OUTLINER;
- break;
-
- default: OSL_FAIL( "Outliner::Init - Invalid Mode!" );
- }
-
- pEditEngine->SetControlWord( nCtrl );
-
- ImplInitDepth( 0, GetMinDepth(), sal_False );
-
- GetUndoManager().Clear();
-}
-
-void Outliner::SetMaxDepth( sal_Int16 nDepth, sal_Bool bCheckParagraphs )
-{
- if( nMaxDepth != nDepth )
- {
- nMaxDepth = Min( nDepth, (sal_Int16)(SVX_MAX_NUM-1) );
-
- if( bCheckParagraphs )
- {
- sal_uInt16 nParagraphs = (sal_uInt16)pParaList->GetParagraphCount();
- for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
- {
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- if( pPara && pPara->GetDepth() > nMaxDepth )
- {
- SetDepth( pPara, nMaxDepth );
- }
- }
- }
- }
-}
-
-sal_Int16 Outliner::GetDepth( sal_uLong nPara ) const
-{
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- DBG_ASSERT( pPara, "Outliner::GetDepth - Paragraph not found!" );
- return pPara ? pPara->GetDepth() : -1;
-}
-
-void Outliner::SetDepth( Paragraph* pPara, sal_Int16 nNewDepth )
-{
- DBG_CHKTHIS(Outliner,0);
-
- ImplCheckDepth( nNewDepth );
-
- if ( nNewDepth != pPara->GetDepth() )
- {
- nDepthChangedHdlPrevDepth = pPara->GetDepth();
- mnDepthChangeHdlPrevFlags = pPara->nFlags;
- pHdlParagraph = pPara;
-
- sal_uInt16 nPara = (sal_uInt16)GetAbsPos( pPara );
- ImplInitDepth( nPara, nNewDepth, sal_True );
- ImplCalcBulletText( nPara, sal_False, sal_False );
-
- if ( ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
- ImplSetLevelDependendStyleSheet( nPara );
-
- DepthChangedHdl();
- }
-}
-
-sal_Int16 Outliner::GetNumberingStartValue( sal_uInt16 nPara )
-{
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- DBG_ASSERT( pPara, "Outliner::GetNumberingStartValue - Paragraph not found!" );
- return pPara ? pPara->GetNumberingStartValue() : -1;
-}
-
-void Outliner::SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue )
-{
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- DBG_ASSERT( pPara, "Outliner::GetNumberingStartValue - Paragraph not found!" );
- if( pPara && pPara->GetNumberingStartValue() != nNumberingStartValue )
- {
- if( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new OutlinerUndoChangeParaNumberingRestart( this, nPara,
- pPara->GetNumberingStartValue(), nNumberingStartValue,
- pPara->IsParaIsNumberingRestart(), pPara->IsParaIsNumberingRestart() ) );
-
- pPara->SetNumberingStartValue( nNumberingStartValue );
- // #i100014#
- // It is not a good idea to substract 1 from a count and cast the result
- // to USHORT without check, if the count is 0.
- ImplCheckParagraphs( nPara, (sal_uInt16) (pParaList->GetParagraphCount()) );
- pEditEngine->SetModified();
- }
-}
-
-sal_Bool Outliner::IsParaIsNumberingRestart( sal_uInt16 nPara )
-{
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- DBG_ASSERT( pPara, "Outliner::IsParaIsNumberingRestart - Paragraph not found!" );
- return pPara ? pPara->IsParaIsNumberingRestart() : sal_False;
-}
-
-void Outliner::SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart )
-{
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- DBG_ASSERT( pPara, "Outliner::SetParaIsNumberingRestart - Paragraph not found!" );
- if( pPara && (pPara->IsParaIsNumberingRestart() != bParaIsNumberingRestart) )
- {
- if( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new OutlinerUndoChangeParaNumberingRestart( this, nPara,
- pPara->GetNumberingStartValue(), pPara->GetNumberingStartValue(),
- pPara->IsParaIsNumberingRestart(), bParaIsNumberingRestart ) );
-
- pPara->SetParaIsNumberingRestart( bParaIsNumberingRestart );
- // #i100014#
- // It is not a good idea to substract 1 from a count and cast the result
- // to USHORT without check, if the count is 0.
- ImplCheckParagraphs( nPara, (sal_uInt16) (pParaList->GetParagraphCount()) );
- pEditEngine->SetModified();
- }
-}
-
-OutlinerParaObject* Outliner::CreateParaObject( sal_uInt16 nStartPara, sal_uInt16 nCount ) const
-{
- DBG_CHKTHIS(Outliner,0);
-
- if ( sal::static_int_cast< sal_uLong >( nStartPara + nCount ) >
- pParaList->GetParagraphCount() )
- nCount = sal::static_int_cast< sal_uInt16 >(
- pParaList->GetParagraphCount() - nStartPara );
-
- // When a new OutlinerParaObject is created because a paragraph is just beeing deleted,
- // it can happen that the ParaList is not updated yet...
- if ( ( nStartPara + nCount ) > pEditEngine->GetParagraphCount() )
- nCount = pEditEngine->GetParagraphCount() - nStartPara;
-
- if( !nCount )
- return NULL;
-
- EditTextObject* pText = pEditEngine->CreateTextObject( nStartPara, nCount );
- const bool bIsEditDoc(OUTLINERMODE_TEXTOBJECT == ImplGetOutlinerMode());
- ParagraphDataVector aParagraphDataVector(nCount);
- const sal_uInt16 nLastPara(nStartPara + nCount - 1);
-
- for(sal_uInt16 nPara(nStartPara); nPara <= nLastPara; nPara++)
- {
- aParagraphDataVector[nPara-nStartPara] = *GetParagraph(nPara);
- }
-
- OutlinerParaObject* pPObj = new OutlinerParaObject(*pText, aParagraphDataVector, bIsEditDoc);
- pPObj->SetOutlinerMode(GetMode());
- delete pText;
-
- return pPObj;
-}
-
-void Outliner::SetText( const XubString& rText, Paragraph* pPara )
-{
- DBG_CHKTHIS(Outliner,0);
- DBG_ASSERT(pPara,"SetText:No Para");
-
- sal_Bool bUpdate = pEditEngine->GetUpdateMode();
- pEditEngine->SetUpdateMode( sal_False );
- ImplBlockInsertionCallbacks( sal_True );
-
- sal_uInt16 nPara = (sal_uInt16)pParaList->GetAbsPos( pPara );
-
- if( !rText.Len() )
- {
- pEditEngine->SetText( nPara, rText );
- ImplInitDepth( nPara, pPara->GetDepth(), sal_False );
- }
- else
- {
- XubString aText( rText );
- aText.ConvertLineEnd( LINEEND_LF );
-
- if( aText.GetChar( aText.Len()-1 ) == '\x0A' )
- aText.Erase( aText.Len()-1, 1 ); // Delete the last break
-
- sal_uInt16 nCount = aText.GetTokenCount( '\x0A' );
- sal_uInt16 nPos = 0;
- sal_uInt16 nInsPos = nPara+1;
- while( nCount > nPos )
- {
- XubString aStr = aText.GetToken( nPos, '\x0A' );
-
- sal_Int16 nCurDepth;
- if( nPos )
- {
- pPara = new Paragraph( -1 );
- nCurDepth = -1;
- }
- else
- nCurDepth = pPara->GetDepth();
-
- // 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 ) )
- {
- // Extract Tabs
- sal_uInt16 nTabs = 0;
- while ( ( nTabs < aStr.Len() ) && ( aStr.GetChar( nTabs ) == '\t' ) )
- nTabs++;
- if ( nTabs )
- aStr.Erase( 0, nTabs );
-
- // Keep depth? (see Outliner::Insert)
- if( !(pPara->nFlags & PARAFLAG_HOLDDEPTH) )
- {
- nCurDepth = nTabs-1;
- ImplCheckDepth( nCurDepth );
- pPara->SetDepth( nCurDepth );
- pPara->nFlags &= (~PARAFLAG_HOLDDEPTH);
- }
- }
- if( nPos ) // not with the first paragraph
- {
- pParaList->Insert( pPara, nInsPos );
- pEditEngine->InsertParagraph( nInsPos, aStr );
- pHdlParagraph = pPara;
- ParagraphInsertedHdl();
- }
- else
- {
- nInsPos--;
- pEditEngine->SetText( nInsPos, aStr );
- }
- ImplInitDepth( nInsPos, nCurDepth, sal_False );
- nInsPos++;
- nPos++;
- }
- }
-
- DBG_ASSERT(pParaList->GetParagraphCount()==pEditEngine->GetParagraphCount(),"SetText failed!");
- bFirstParaIsEmpty = sal_False;
- ImplBlockInsertionCallbacks( sal_False );
- pEditEngine->SetUpdateMode( bUpdate );
-}
-
-// pView == 0 -> Ignore tabs
-
-bool Outliner::ImpConvertEdtToOut( sal_uInt32 nPara,EditView* pView)
-{
- DBG_CHKTHIS(Outliner,0);
-
- bool bConverted = false;
- sal_uInt16 nTabs = 0;
- ESelection aDelSel;
-
-// const SfxItemSet& rAttrs = pEditEngine->GetParaAttribs( (sal_uInt16)nPara );
-// bool bAlreadyOutliner = rAttrs.GetItemState( EE_PARA_OUTLLRSPACE ) == SFX_ITEM_ON ? true : false;
-
- XubString aName;
- XubString aHeading_US( RTL_CONSTASCII_USTRINGPARAM( "heading" ) );
- XubString aNumber_US( RTL_CONSTASCII_USTRINGPARAM( "Numbering" ) );
-
- XubString aStr( pEditEngine->GetText( (sal_uInt16)nPara ) );
- xub_Unicode* pPtr = (xub_Unicode*)aStr.GetBuffer();
-
- sal_uInt16 nHeadingNumberStart = 0;
- sal_uInt16 nNumberingNumberStart = 0;
- SfxStyleSheet* pStyle= pEditEngine->GetStyleSheet( (sal_uInt16)nPara );
- if( pStyle )
- {
- aName = pStyle->GetName();
- sal_uInt16 nSearch;
- if ( ( nSearch = aName.Search( aHeading_US ) ) != STRING_NOTFOUND )
- nHeadingNumberStart = nSearch + aHeading_US.Len();
- else if ( ( nSearch = aName.Search( aNumber_US ) ) != STRING_NOTFOUND )
- nNumberingNumberStart = nSearch + aNumber_US.Len();
- }
-
- if ( nHeadingNumberStart || nNumberingNumberStart )
- {
- // PowerPoint import ?
- if( nHeadingNumberStart && ( aStr.Len() >= 2 ) &&
- ( pPtr[0] != '\t' ) && ( pPtr[1] == '\t' ) )
- {
- // Extract Bullet and Tab
- aDelSel = ESelection( (sal_uInt16)nPara, 0, (sal_uInt16)nPara, 2 );
- }
-
- sal_uInt16 nPos = nHeadingNumberStart ? nHeadingNumberStart : nNumberingNumberStart;
- String aLevel = aName.Copy( nPos );
- aLevel.EraseLeadingChars( ' ' );
- nTabs = sal::static_int_cast< sal_uInt16 >(aLevel.ToInt32());
- if( nTabs )
- nTabs--; // Level 0 = "heading 1"
- bConverted = sal_True;
- }
- else
- {
- // filter leading tabs
- while( *pPtr == '\t' )
- {
- pPtr++;
- nTabs++;
- }
- // Remove tabs from the text
- if( nTabs )
- aDelSel = ESelection( (sal_uInt16)nPara, 0, (sal_uInt16)nPara, nTabs );
- }
-
- if ( aDelSel.HasRange() )
- {
- if ( pView )
- {
- pView->SetSelection( aDelSel );
- pView->DeleteSelected();
- }
- else
- pEditEngine->QuickDelete( aDelSel );
- }
-
- const SfxInt16Item& rLevel = (const SfxInt16Item&) pEditEngine->GetParaAttrib( sal::static_int_cast< sal_uInt16 >(nPara), EE_PARA_OUTLLEVEL );
- sal_Int16 nOutlLevel = rLevel.GetValue();
-
- ImplCheckDepth( nOutlLevel );
- ImplInitDepth( sal::static_int_cast< sal_uInt16 >(nPara), nOutlLevel, sal_False );
-
- return bConverted;
-}
-
-void Outliner::SetText( const OutlinerParaObject& rPObj )
-{
- DBG_CHKTHIS(Outliner,0);
-
- sal_Bool bUpdate = pEditEngine->GetUpdateMode();
- pEditEngine->SetUpdateMode( sal_False );
-
- sal_Bool bUndo = pEditEngine->IsUndoEnabled();
- EnableUndo( sal_False );
-
- Init( rPObj.GetOutlinerMode() );
-
- ImplBlockInsertionCallbacks( sal_True );
- pEditEngine->SetText(rPObj.GetTextObject());
- if( rPObj.Count() != pEditEngine->GetParagraphCount() )
- {
- int nop=0;nop++;
- }
-
- bFirstParaIsEmpty = sal_False;
-
- pParaList->Clear( sal_True );
- for( sal_uInt16 nCurPara = 0; nCurPara < rPObj.Count(); nCurPara++ )
- {
- Paragraph* pPara = new Paragraph( rPObj.GetParagraphData(nCurPara));
- ImplCheckDepth( pPara->nDepth );
-
- pParaList->Append(pPara);
- ImplCheckNumBulletItem( nCurPara );
- }
-
- // #i100014#
- // It is not a good idea to substract 1 from a count and cast the result
- // to USHORT without check, if the count is 0.
- ImplCheckParagraphs( 0, (sal_uInt16) (pParaList->GetParagraphCount()) );
-
- EnableUndo( bUndo );
- ImplBlockInsertionCallbacks( sal_False );
- pEditEngine->SetUpdateMode( bUpdate );
-
- DBG_ASSERT( pParaList->GetParagraphCount()==rPObj.Count(),"SetText failed");
- DBG_ASSERT( pEditEngine->GetParagraphCount()==rPObj.Count(),"SetText failed");
-}
-
-void Outliner::AddText( const OutlinerParaObject& rPObj )
-{
- DBG_CHKTHIS(Outliner,0);
- Paragraph* pPara;
-
- sal_Bool bUpdate = pEditEngine->GetUpdateMode();
- pEditEngine->SetUpdateMode( sal_False );
-
- ImplBlockInsertionCallbacks( sal_True );
- sal_uLong nPara;
- if( bFirstParaIsEmpty )
- {
- pParaList->Clear( sal_True );
- pEditEngine->SetText(rPObj.GetTextObject());
- nPara = 0;
- }
- else
- {
- nPara = pParaList->GetParagraphCount();
- pEditEngine->InsertParagraph( EE_PARA_APPEND, rPObj.GetTextObject() );
- }
- bFirstParaIsEmpty = sal_False;
-
- for( sal_uInt16 n = 0; n < rPObj.Count(); n++ )
- {
- pPara = new Paragraph( rPObj.GetParagraphData(n) );
- pParaList->Append(pPara);
- sal_uInt16 nP = sal::static_int_cast< sal_uInt16 >(nPara+n);
- DBG_ASSERT(pParaList->GetAbsPos(pPara)==nP,"AddText:Out of sync");
- ImplInitDepth( nP, pPara->GetDepth(), sal_False );
- }
- DBG_ASSERT( pEditEngine->GetParagraphCount()==pParaList->GetParagraphCount(), "SetText: OutOfSync" );
-
- // #i100014#
- // It is not a good idea to substract 1 from a count and cast the result
- // to USHORT without check, if the count is 0.
- ImplCheckParagraphs( (sal_uInt16)nPara, (sal_uInt16) (pParaList->GetParagraphCount()) );
-
- ImplBlockInsertionCallbacks( sal_False );
- pEditEngine->SetUpdateMode( bUpdate );
-}
-
-void Outliner::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos )
-{
- DBG_CHKTHIS(Outliner,0);
-
- if ( aFieldClickedHdl.IsSet() )
- {
- EditFieldInfo aFldInfo( this, rField, nPara, nPos );
- aFldInfo.SetSimpleClick( sal_True );
- aFieldClickedHdl.Call( &aFldInfo );
- }
-}
-
-
-void Outliner::FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos )
-{
- DBG_CHKTHIS(Outliner,0);
- if ( !aFieldClickedHdl.IsSet() )
- return;
-
- EditFieldInfo aFldInfo( this, rField, nPara, nPos );
- aFldInfo.SetSimpleClick( sal_False );
- aFieldClickedHdl.Call( &aFldInfo );
-}
-
-
-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 );
- // The FldColor is preset with COL_LIGHTGRAY.
- if ( rpFldColor )
- aFldInfo.SetFldColor( *rpFldColor );
-
- aCalcFieldValueHdl.Call( &aFldInfo );
- if ( aFldInfo.GetTxtColor() )
- {
- delete rpTxtColor;
- rpTxtColor = new Color( *aFldInfo.GetTxtColor() );
- }
-
- delete rpFldColor;
- rpFldColor = aFldInfo.GetFldColor() ? new Color( *aFldInfo.GetFldColor() ) : 0;
-
- return aFldInfo.GetRepresentation();
-}
-
-void Outliner::SetStyleSheet( sal_uLong nPara, SfxStyleSheet* pStyle )
-{
- DBG_CHKTHIS(Outliner,0);
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- if (pPara)
- {
- pEditEngine->SetStyleSheet( (sal_uInt16)nPara, pStyle );
- pPara->nFlags |= PARAFLAG_SETBULLETTEXT;
- ImplCheckNumBulletItem( (sal_uInt16) nPara );
- }
-}
-
-void Outliner::SetVisible( Paragraph* pPara, sal_Bool bVisible )
-{
- DBG_CHKTHIS(Outliner,0);
- DBG_ASSERT( pPara, "SetVisible: pPara = NULL" );
-
- if (pPara)
- {
- pPara->bVisible = bVisible;
- sal_uLong nPara = pParaList->GetAbsPos( pPara );
- pEditEngine->ShowParagraph( (sal_uInt16)nPara, bVisible );
- }
-}
-
-void Outliner::ImplCheckNumBulletItem( sal_uInt16 nPara )
-{
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- if (pPara)
- pPara->aBulSize.Width() = -1;
-}
-
-void Outliner::ImplSetLevelDependendStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pLevelStyle )
-{
- DBG_CHKTHIS(Outliner,0);
-
- DBG_ASSERT( ( ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT ) || ( ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEVIEW ), "SetLevelDependendStyleSheet: Wrong Mode!" );
-
- SfxStyleSheet* pStyle = pLevelStyle;
- if ( !pStyle )
- pStyle = GetStyleSheet( nPara );
-
- if ( pStyle )
- {
- sal_Int16 nDepth = GetDepth( nPara );
- if( nDepth < 0 )
- nDepth = 0;
-
- String aNewStyleSheetName( pStyle->GetName() );
- aNewStyleSheetName.Erase( aNewStyleSheetName.Len()-1, 1 );
- aNewStyleSheetName += String::CreateFromInt32( nDepth+1 );
- SfxStyleSheet* pNewStyle = (SfxStyleSheet*)GetStyleSheetPool()->Find( aNewStyleSheetName, pStyle->GetFamily() );
- DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );
- if ( pNewStyle && ( pNewStyle != GetStyleSheet( nPara ) ) )
- {
- SfxItemSet aOldAttrs( GetParaAttribs( nPara ) );
- SetStyleSheet( nPara, pNewStyle );
- if ( aOldAttrs.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
- {
- SfxItemSet aAttrs( GetParaAttribs( nPara ) );
- aAttrs.Put( aOldAttrs.Get( EE_PARA_NUMBULLET ) );
- SetParaAttribs( nPara, aAttrs );
- }
- }
- }
-}
-
-void Outliner::ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction )
-{
- DBG_CHKTHIS(Outliner,0);
-
- DBG_ASSERT( ( nDepth >= nMinDepth ) && ( nDepth <= nMaxDepth ), "ImplInitDepth - Depth is invalid!" );
-
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- if (!pPara)
- return;
- sal_Int16 nOldDepth = pPara->GetDepth();
- pPara->SetDepth( nDepth );
-
- // 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();
- pEditEngine->SetUpdateMode( sal_False );
-
- sal_Bool bUndo = bCreateUndo && IsUndoEnabled();
- if ( bUndo && bUndoAction )
- UndoActionStart( OLUNDO_DEPTH );
-
- SfxItemSet aAttrs( pEditEngine->GetParaAttribs( nPara ) );
- aAttrs.Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nDepth ) );
- pEditEngine->SetParaAttribs( nPara, aAttrs );
- ImplCheckNumBulletItem( nPara );
- ImplCalcBulletText( nPara, sal_False, sal_False );
-
- if ( bUndo )
- {
- InsertUndo( new OutlinerUndoChangeDepth( this, nPara, nOldDepth, nDepth ) );
- if ( bUndoAction )
- UndoActionEnd( OLUNDO_DEPTH );
- }
-
- pEditEngine->SetUpdateMode( bUpdate );
- }
-}
-
-void Outliner::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
-{
- DBG_CHKTHIS(Outliner,0);
-
- pEditEngine->SetParaAttribs( nPara, rSet );
-}
-
-sal_Bool Outliner::Expand( Paragraph* pPara )
-{
- DBG_CHKTHIS(Outliner,0);
-
- if ( pParaList->HasHiddenChilds( pPara ) )
- {
- OLUndoExpand* pUndo = 0;
- sal_Bool bUndo = IsUndoEnabled() && !IsInUndo();
- if( bUndo )
- {
- UndoActionStart( OLUNDO_EXPAND );
- pUndo = new OLUndoExpand( this, OLUNDO_EXPAND );
- pUndo->pParas = 0;
- pUndo->nCount = (sal_uInt16)pParaList->GetAbsPos( pPara );
- }
- pHdlParagraph = pPara;
- bIsExpanding = sal_True;
- pParaList->Expand( pPara );
- ExpandHdl();
- InvalidateBullet( pPara, pParaList->GetAbsPos(pPara) );
- if( bUndo )
- {
- InsertUndo( pUndo );
- UndoActionEnd( OLUNDO_EXPAND );
- }
- return sal_True;
- }
- return sal_False;
-}
-
-
-sal_Bool Outliner::Collapse( Paragraph* pPara )
-{
- DBG_CHKTHIS(Outliner,0);
- if ( pParaList->HasVisibleChilds( pPara ) ) // expanded
- {
- OLUndoExpand* pUndo = 0;
- sal_Bool bUndo = sal_False;
-
- if( !IsInUndo() && IsUndoEnabled() )
- bUndo = sal_True;
- if( bUndo )
- {
- UndoActionStart( OLUNDO_COLLAPSE );
- pUndo = new OLUndoExpand( this, OLUNDO_COLLAPSE );
- pUndo->pParas = 0;
- pUndo->nCount = (sal_uInt16)pParaList->GetAbsPos( pPara );
- }
-
- pHdlParagraph = pPara;
- bIsExpanding = sal_False;
- pParaList->Collapse( pPara );
- ExpandHdl();
- InvalidateBullet( pPara, pParaList->GetAbsPos(pPara) );
- if( bUndo )
- {
- InsertUndo( pUndo );
- UndoActionEnd( OLUNDO_COLLAPSE );
- }
- return sal_True;
- }
- return sal_False;
-}
-
-
-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;
- if ( !pEditEngine->IsFlatMode() )
- {
- ESelection aSel( nPara, 0, nPara, 0 );
- aStdFont = EditEngine::CreateFontFromItemSet( pEditEngine->GetAttribs( aSel ), GetScriptType( aSel ) );
- }
- else
- {
- aStdFont = pEditEngine->GetStandardFont( nPara );
- }
-
- Font aBulletFont;
- if ( pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL )
- {
- aBulletFont = *pFmt->GetBulletFont();
- }
- else
- {
- aBulletFont = aStdFont;
- aBulletFont.SetUnderline( UNDERLINE_NONE );
- aBulletFont.SetOverline( UNDERLINE_NONE );
- aBulletFont.SetStrikeout( STRIKEOUT_NONE );
- aBulletFont.SetEmphasisMark( EMPHASISMARK_NONE );
- aBulletFont.SetRelief( RELIEF_NONE );
- }
-
- // 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;
-
- aBulletFont.SetAlign( ALIGN_BOTTOM );
- aBulletFont.SetSize( Size( 0, nScaledLineHeight ) );
- sal_Bool bVertical = IsVertical();
- aBulletFont.SetVertical( bVertical );
- aBulletFont.SetOrientation( bVertical ? 2700 : 0 );
-
- Color aColor( COL_AUTO );
- if( !pEditEngine->IsFlatMode() && !( pEditEngine->GetControlWord() & EE_CNTRL_NOCOLORS ) )
- {
- aColor = pFmt->GetBulletColor();
- }
-
- if ( ( aColor == COL_AUTO ) || ( IsForceAutoColor() ) )
- aColor = pEditEngine->GetAutoColor();
-
- aBulletFont.SetColor( aColor );
- return aBulletFont;
-}
-
-void Outliner::PaintBullet( sal_uInt16 nPara, const Point& rStartPos,
- const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
-{
- DBG_CHKTHIS(Outliner,0);
-
- bool bDrawBullet = false;
- if (pEditEngine)
- {
- const SfxBoolItem& rBulletState = (const SfxBoolItem&) pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE );
- bDrawBullet = rBulletState.GetValue() ? true : false;
- }
-
- if ( ImplHasBullet( nPara ) && bDrawBullet)
- {
- sal_Bool bVertical = IsVertical();
-
- 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 );
- if ( pFmt && ( pFmt->GetNumberingType() != SVX_NUM_NUMBER_NONE ) )
- {
- if( pFmt->GetNumberingType() != SVX_NUM_BITMAP )
- {
- Font aBulletFont( ImpCalcBulletFont( nPara ) );
- // Use baseline
- sal_Bool bSymbol = pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
- aBulletFont.SetAlign( bSymbol ? ALIGN_BOTTOM : ALIGN_BASELINE );
- Font aOldFont = pOutDev->GetFont();
- pOutDev->SetFont( aBulletFont );
-
- ParagraphInfos aParaInfos = pEditEngine->GetParagraphInfos( nPara );
- Point aTextPos;
- if ( !bVertical )
- {
-// aTextPos.Y() = rStartPos.Y() + aBulletArea.Bottom();
- aTextPos.Y() = rStartPos.Y() + ( bSymbol ? aBulletArea.Bottom() : aParaInfos.nFirstLineMaxAscent );
- if ( !bRightToLeftPara )
- aTextPos.X() = rStartPos.X() + aBulletArea.Left();
- else
- aTextPos.X() = rStartPos.X() + GetPaperSize().Width() - aBulletArea.Left();
- }
- else
- {
-// aTextPos.X() = rStartPos.X() - aBulletArea.Bottom();
- aTextPos.X() = rStartPos.X() - ( bSymbol ? aBulletArea.Bottom() : aParaInfos.nFirstLineMaxAscent );
- aTextPos.Y() = rStartPos.Y() + aBulletArea.Left();
- }
-
- if ( nOrientation )
- {
- // 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 );
- Point aRotatedPos;
- // Translation...
- aTextPos -= rOrigin;
- // Rotation...
- aRotatedPos.X()=(long) (nCos*aTextPos.X() + nSin*aTextPos.Y());
- aRotatedPos.Y()=(long) - (nSin*aTextPos.X() - nCos*aTextPos.Y());
- aTextPos = aRotatedPos;
- // Translation...
- aTextPos += rOrigin;
- Font aRotatedFont( aBulletFont );
- aRotatedFont.SetOrientation( nOrientation );
- pOutDev->SetFont( aRotatedFont );
- }
-
- // VCL will take care of brackets and so on...
- sal_uLong nLayoutMode = pOutDev->GetLayoutMode();
- nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG);
- if ( bRightToLeftPara )
- nLayoutMode |= TEXT_LAYOUT_BIDI_RTL;
- pOutDev->SetLayoutMode( nLayoutMode );
-
- if(bStrippingPortions)
- {
- const Font aSvxFont(pOutDev->GetFont());
- sal_Int32* pBuf = new sal_Int32[ pPara->GetText().Len() ];
- pOutDev->GetTextArray( pPara->GetText(), pBuf );
-
- if(bSymbol)
- {
- // aTextPos is Bottom, go to Baseline
- FontMetric aMetric(pOutDev->GetFontMetric());
- aTextPos.Y() -= aMetric.GetDescent();
- }
-
- DrawingText(aTextPos, pPara->GetText(), 0, pPara->GetText().Len(), pBuf,
- aSvxFont, nPara, 0xFFFF, 0xFF, 0, 0, false, false, true, 0, Color(), Color());
-
- delete[] pBuf;
- }
- else
- {
- pOutDev->DrawText( aTextPos, pPara->GetText() );
- }
-
- pOutDev->SetFont( aOldFont );
- }
- else
- {
- if ( pFmt->GetBrush()->GetGraphicObject() )
- {
- Point aBulletPos;
- if ( !bVertical )
- {
- aBulletPos.Y() = rStartPos.Y() + aBulletArea.Top();
- if ( !bRightToLeftPara )
- aBulletPos.X() = rStartPos.X() + aBulletArea.Left();
- else
- aBulletPos.X() = rStartPos.X() + GetPaperSize().Width() - aBulletArea.Right();
- }
- else
- {
- aBulletPos.X() = rStartPos.X() - aBulletArea.Bottom();
- aBulletPos.Y() = rStartPos.Y() + aBulletArea.Left();
- }
-
- if(bStrippingPortions)
- {
- if(aDrawBulletHdl.IsSet())
- {
- // call something analog to aDrawPortionHdl (if set) and feed it something
- // analog to DrawPortionInfo...
- // created aDrawBulletHdl, Set/GetDrawBulletHdl.
- // created DrawBulletInfo and added handling to sdrtextdecomposition.cxx
- DrawBulletInfo aDrawBulletInfo(
- *pFmt->GetBrush()->GetGraphicObject(),
- aBulletPos,
- pPara->aBulSize);
-
- aDrawBulletHdl.Call(&aDrawBulletInfo);
- }
- }
- else
- {
- // Remove CAST when KA made the Draw-Method const
- ((GraphicObject*)pFmt->GetBrush()->GetGraphicObject())->Draw( pOutDev, aBulletPos, pPara->aBulSize );
- }
- }
- }
- }
-
- // In case of collapsed subparagraphs paint a line before the text.
- if( pParaList->HasChilds(pPara) && !pParaList->HasVisibleChilds(pPara) &&
- !bStrippingPortions && !nOrientation )
- {
- long nWidth = pOutDev->PixelToLogic( Size( 10, 0 ) ).Width();
-
- Point aStartPos, aEndPos;
- if ( !bVertical )
- {
- aStartPos.Y() = rStartPos.Y() + aBulletArea.Bottom();
- if ( !bRightToLeftPara )
- aStartPos.X() = rStartPos.X() + aBulletArea.Right();
- else
- aStartPos.X() = rStartPos.X() + GetPaperSize().Width() - aBulletArea.Left();
- aEndPos = aStartPos;
- aEndPos.X() += nWidth;
- }
- else
- {
- aStartPos.X() = rStartPos.X() - aBulletArea.Bottom();
- aStartPos.Y() = rStartPos.Y() + aBulletArea.Right();
- aEndPos = aStartPos;
- aEndPos.Y() += nWidth;
- }
-
- const Color& rOldLineColor = pOutDev->GetLineColor();
- pOutDev->SetLineColor( Color( COL_BLACK ) );
- pOutDev->DrawLine( aStartPos, aEndPos );
- pOutDev->SetLineColor( rOldLineColor );
- }
- }
-}
-
-void Outliner::InvalidateBullet( Paragraph* /*pPara*/, sal_uLong nPara )
-{
- DBG_CHKTHIS(Outliner,0);
-
- long nLineHeight = (long)pEditEngine->GetLineHeight((sal_uInt16)nPara );
- 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();
- aRect.Top() = aPos.Y();
- aRect.Bottom() = aPos.Y();
- aRect.Bottom() += nLineHeight;
-
- pView->GetWindow()->Invalidate( aRect );
- }
-}
-
-sal_uLong Outliner::Read( SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat, SvKeyValueIterator* pHTTPHeaderAttrs )
-{
- DBG_CHKTHIS(Outliner,0);
-
- sal_Bool bOldUndo = pEditEngine->IsUndoEnabled();
- EnableUndo( sal_False );
-
- sal_Bool bUpdate = pEditEngine->GetUpdateMode();
- pEditEngine->SetUpdateMode( sal_False );
-
- Clear();
-
- ImplBlockInsertionCallbacks( sal_True );
- sal_uLong nRet = pEditEngine->Read( rInput, rBaseURL, (EETextFormat)eFormat, pHTTPHeaderAttrs );
-
- bFirstParaIsEmpty = sal_False;
-
- sal_uInt16 nParas = pEditEngine->GetParagraphCount();
- pParaList->Clear( sal_True );
- sal_uInt16 n;
- for ( n = 0; n < nParas; n++ )
- {
- Paragraph* pPara = new Paragraph( 0 );
- pParaList->Append(pPara);
-
- if ( eFormat == EE_FORMAT_BIN )
- {
- const SfxItemSet& rAttrs = pEditEngine->GetParaAttribs( n );
- const SfxInt16Item& rLevel = (const SfxInt16Item&) rAttrs.Get( EE_PARA_OUTLLEVEL );
- sal_Int16 nDepth = rLevel.GetValue();
- ImplInitDepth( n, nDepth, sal_False );
- }
- }
-
- if ( eFormat != EE_FORMAT_BIN )
- {
- ImpFilterIndents( 0, nParas-1 );
- }
-
- ImplBlockInsertionCallbacks( sal_False );
- pEditEngine->SetUpdateMode( bUpdate );
- EnableUndo( bOldUndo );
-
- return nRet;
-}
-
-
-void Outliner::ImpFilterIndents( sal_uLong nFirstPara, sal_uLong nLastPara )
-{
- DBG_CHKTHIS(Outliner,0);
-
- sal_Bool bUpdate = pEditEngine->GetUpdateMode();
- pEditEngine->SetUpdateMode( sal_False );
-
- Paragraph* pLastConverted = NULL;
- for( sal_uLong nPara = nFirstPara; nPara <= nLastPara; nPara++ )
- {
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- if (pPara)
- {
- if( ImpConvertEdtToOut( nPara ) )
- {
- pLastConverted = pPara;
- }
- else if ( pLastConverted )
- {
- // Arrange normal paragraphs below the heading ...
- pPara->SetDepth( pLastConverted->GetDepth() );
- }
-
- ImplInitDepth( (sal_uInt16)nPara, pPara->GetDepth(), sal_False );
- }
- }
-
- pEditEngine->SetUpdateMode( bUpdate );
-}
-
-::svl::IUndoManager& Outliner::GetUndoManager()
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetUndoManager();
-}
-
-void Outliner::ImpTextPasted( sal_uLong nStartPara, sal_uInt16 nCount )
-{
- DBG_CHKTHIS(Outliner,0);
-
- sal_Bool bUpdate = pEditEngine->GetUpdateMode();
- pEditEngine->SetUpdateMode( sal_False );
-
- const sal_uLong nStart = nStartPara;
-
- Paragraph* pPara = pParaList->GetParagraph( nStartPara );
-
- while( nCount && pPara )
- {
- if( ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT )
- {
- nDepthChangedHdlPrevDepth = pPara->GetDepth();
- mnDepthChangeHdlPrevFlags = pPara->nFlags;
-
- ImpConvertEdtToOut( nStartPara );
-
- pHdlParagraph = pPara;
-
- if( nStartPara == nStart )
- {
- // the existing paragraph has changed depth or flags
- if( (pPara->GetDepth() != nDepthChangedHdlPrevDepth) || (pPara->nFlags != mnDepthChangeHdlPrevFlags) )
- DepthChangedHdl();
- }
- }
- else // EditEngine mode
- {
- sal_Int16 nDepth = -1;
- const SfxItemSet& rAttrs = pEditEngine->GetParaAttribs( (sal_uInt16)nStartPara );
- if ( rAttrs.GetItemState( EE_PARA_OUTLLEVEL ) == SFX_ITEM_ON )
- {
- const SfxInt16Item& rLevel = (const SfxInt16Item&) rAttrs.Get( EE_PARA_OUTLLEVEL );
- nDepth = rLevel.GetValue();
- }
- if ( nDepth != GetDepth( nStartPara ) )
- ImplInitDepth( (sal_uInt16)nStartPara, nDepth, sal_False );
- }
-
- nCount--;
- nStartPara++;
- pPara = pParaList->GetParagraph( nStartPara );
- }
-
- pEditEngine->SetUpdateMode( bUpdate );
-
- DBG_ASSERT(pParaList->GetParagraphCount()==pEditEngine->GetParagraphCount(),"ImpTextPasted failed");
-}
-
-long Outliner::IndentingPagesHdl( OutlinerView* pView )
-{
- DBG_CHKTHIS(Outliner,0);
- if( !aIndentingPagesHdl.IsSet() )
- return 1;
- return aIndentingPagesHdl.Call( pView );
-}
-
-sal_Bool Outliner::ImpCanIndentSelectedPages( OutlinerView* pCurView )
-{
- DBG_CHKTHIS(Outliner,0);
- // The selected pages must already be set in advance through
- // ImpCalcSelectedPages
-
- // 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 ) // is the only page
- return sal_False;
- else
- pCurView->ImpCalcSelectedPages( sal_False ); // without the first
- }
- return (sal_Bool)IndentingPagesHdl( pCurView );
-}
-
-
-sal_Bool Outliner::ImpCanDeleteSelectedPages( OutlinerView* pCurView )
-{
- DBG_CHKTHIS(Outliner,0);
- // The selected pages must already be set in advance through
- // ImpCalcSelectedPages
- return (sal_Bool)RemovingPagesHdl( pCurView );
-}
-
-Outliner::Outliner( SfxItemPool* pPool, sal_uInt16 nMode )
-: nMinDepth( -1 )
-{
- DBG_CTOR( Outliner, 0 );
-
- bStrippingPortions = sal_False;
- bPasting = sal_False;
-
- nFirstPage = 1;
- bBlockInsCallback = sal_False;
-
- nMaxDepth = 9;
-
- pParaList = new ParagraphList;
- pParaList->SetVisibleStateChangedHdl( LINK( this, Outliner, ParaVisibleStateChangedHdl ) );
- Paragraph* pPara = new Paragraph( 0 );
- pParaList->Append(pPara);
- bFirstParaIsEmpty = sal_True;
-
- pEditEngine = new OutlinerEditEng( this, pPool );
- pEditEngine->SetBeginMovingParagraphsHdl( LINK( this, Outliner, BeginMovingParagraphsHdl ) );
- pEditEngine->SetEndMovingParagraphsHdl( LINK( this, Outliner, EndMovingParagraphsHdl ) );
- pEditEngine->SetBeginPasteOrDropHdl( LINK( this, Outliner, BeginPasteOrDropHdl ) );
- pEditEngine->SetEndPasteOrDropHdl( LINK( this, Outliner, EndPasteOrDropHdl ) );
-
- Init( nMode );
-}
-
-Outliner::~Outliner()
-{
- DBG_DTOR(Outliner,0);
-
- pParaList->Clear( sal_True );
- delete pParaList;
- delete pEditEngine;
-}
-
-size_t Outliner::InsertView( OutlinerView* pView, size_t nIndex )
-{
- DBG_CHKTHIS(Outliner,0);
- size_t ActualIndex;
-
- if ( nIndex >= aViewList.size() )
- {
- aViewList.push_back( pView );
- ActualIndex = aViewList.size() - 1;
- }
- else
- {
- ViewList::iterator it = aViewList.begin();
- advance( it, nIndex );
- ActualIndex = nIndex;
- }
- pEditEngine->InsertView( pView->pEditView, (sal_uInt16)nIndex );
- return ActualIndex;
-}
-
-OutlinerView* Outliner::RemoveView( OutlinerView* pView )
-{
- DBG_CHKTHIS(Outliner,0);
-
- for ( ViewList::iterator it = aViewList.begin(); it < aViewList.end(); ++it )
- {
- if ( *it == pView )
- {
- pView->pEditView->HideCursor(); // HACK
- pEditEngine->RemoveView( pView->pEditView );
- aViewList.erase( it );
- break;
- }
- }
- return NULL; // return superfluous
-}
-
-OutlinerView* Outliner::RemoveView( size_t nIndex )
-{
- DBG_CHKTHIS(Outliner,0);
-
- EditView* pEditView = pEditEngine->GetView( (sal_uInt16)nIndex );
- pEditView->HideCursor(); // HACK
-
- pEditEngine->RemoveView( (sal_uInt16)nIndex );
-
- {
- ViewList::iterator it = aViewList.begin();
- advance( it, nIndex );
- aViewList.erase( it );
- }
-
- return NULL; // return superfluous
-}
-
-
-OutlinerView* Outliner::GetView( size_t nIndex ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return ( nIndex >= aViewList.size() ) ? NULL : aViewList[ nIndex ];
-}
-
-size_t Outliner::GetViewCount() const
-{
- DBG_CHKTHIS(Outliner,0);
- return aViewList.size();
-}
-
-void Outliner::ParagraphInsertedHdl()
-{
- DBG_CHKTHIS(Outliner,0);
- if( !IsInUndo() )
- aParaInsertedHdl.Call( this );
-}
-
-
-void Outliner::ParagraphRemovingHdl()
-{
- DBG_CHKTHIS(Outliner,0);
- if( !IsInUndo() )
- aParaRemovingHdl.Call( this );
-}
-
-
-void Outliner::DepthChangedHdl()
-{
- DBG_CHKTHIS(Outliner,0);
- if( !IsInUndo() )
- aDepthChangedHdl.Call( this );
-}
-
-
-sal_uLong Outliner::GetAbsPos( Paragraph* pPara )
-{
- DBG_CHKTHIS(Outliner,0);
- DBG_ASSERT(pPara,"GetAbsPos:No Para");
- return pParaList->GetAbsPos( pPara );
-}
-
-sal_uLong Outliner::GetParagraphCount() const
-{
- DBG_CHKTHIS(Outliner,0);
- return pParaList->GetParagraphCount();
-}
-
-Paragraph* Outliner::GetParagraph( sal_uLong nAbsPos ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return pParaList->GetParagraph( nAbsPos );
-}
-
-sal_Bool Outliner::HasChilds( Paragraph* pParagraph ) const
-{
- DBG_CHKTHIS(Outliner,0);
- return pParaList->HasChilds( pParagraph );
-}
-
-sal_Bool Outliner::ImplHasBullet( sal_uInt16 nPara ) const
-{
- return GetNumberFormat(nPara) != 0;
-}
-
-const SvxNumberFormat* Outliner::GetNumberFormat( sal_uInt16 nPara ) const
-{
- const SvxNumberFormat* pFmt = NULL;
-
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- if (pPara == NULL)
- return NULL;
-
- sal_Int16 nDepth = pPara? pPara->GetDepth() : -1;
-
- if( nDepth >= 0 )
- {
- const SvxNumBulletItem& rNumBullet = (const SvxNumBulletItem&) pEditEngine->GetParaAttrib( nPara, EE_PARA_NUMBULLET );
- if ( rNumBullet.GetNumRule()->GetLevelCount() > nDepth )
- pFmt = rNumBullet.GetNumRule()->Get( nDepth );
- }
-
- return pFmt;
-}
-
-Size Outliner::ImplGetBulletSize( sal_uInt16 nPara )
-{
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- if (!pPara)
- return Size();
-
- if( pPara->aBulSize.Width() == -1 )
- {
- const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
- DBG_ASSERT( pFmt, "ImplGetBulletSize - no Bullet!" );
-
- if ( pFmt->GetNumberingType() == SVX_NUM_NUMBER_NONE )
- {
- pPara->aBulSize = Size( 0, 0 );
- }
- else if( pFmt->GetNumberingType() != SVX_NUM_BITMAP )
- {
- String aBulletText = ImplGetBulletText( nPara );
- OutputDevice* pRefDev = pEditEngine->GetRefDevice();
- Font aBulletFont( ImpCalcBulletFont( nPara ) );
- Font aRefFont( pRefDev->GetFont());
- pRefDev->SetFont( aBulletFont );
- pPara->aBulSize.Width() = pRefDev->GetTextWidth( aBulletText );
- pPara->aBulSize.Height() = pRefDev->GetTextHeight();
- pRefDev->SetFont( aRefFont );
- }
- else
- {
- pPara->aBulSize = OutputDevice::LogicToLogic( pFmt->GetGraphicSize(), MAP_100TH_MM, pEditEngine->GetRefDevice()->GetMapMode() );
- }
- }
-
- return pPara->aBulSize;
-}
-
-void Outliner::ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd )
-{
- DBG_CHKTHIS( Outliner, 0 );
-
- // i100014#
- // assure that the following for-loop does not loop forever
- for ( sal_uInt16 n = nStart; n < nEnd; n++ )
- {
- Paragraph* pPara = pParaList->GetParagraph( n );
- if (pPara)
- {
- pPara->Invalidate();
- ImplCalcBulletText( n, sal_False, sal_False );
- }
- }
-}
-
-void Outliner::SetRefDevice( OutputDevice* pRefDev )
-{
- DBG_CHKTHIS(Outliner,0);
- pEditEngine->SetRefDevice( pRefDev );
- for ( sal_uInt16 n = (sal_uInt16) pParaList->GetParagraphCount(); n; )
- {
- Paragraph* pPara = pParaList->GetParagraph( --n );
- pPara->Invalidate();
- }
-}
-
-void Outliner::ParaAttribsChanged( sal_uInt16 nPara )
-{
- DBG_CHKTHIS(Outliner,0);
-
- // 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() )
- {
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- const SfxInt16Item& rLevel = (const SfxInt16Item&) pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL );
- if ( pPara && pPara->GetDepth() != rLevel.GetValue() )
- {
- pPara->SetDepth( rLevel.GetValue() );
- ImplCalcBulletText( nPara, sal_True, sal_True );
- }
- }
- }
-}
-
-void Outliner::StyleSheetChanged( SfxStyleSheet* pStyle )
-{
- DBG_CHKTHIS(Outliner,0);
-
- // The EditEngine calls StyleSheetChanged also for derived styles.
- // Here all the paragraphs, which had the said template, used to be
- // hunted by a ImpRecalcParaAttribs, why?
- // => only the Bullet-representation can really change...
- sal_uInt16 nParas = (sal_uInt16)pParaList->GetParagraphCount();
- for( sal_uInt16 nPara = 0; nPara < nParas; nPara++ )
- {
- if ( pEditEngine->GetStyleSheet( nPara ) == pStyle )
- {
- ImplCheckNumBulletItem( nPara );
- ImplCalcBulletText( nPara, sal_False, sal_False );
- // EditEngine formats changed paragraphs before calling this method,
- // so they are not reformatted now and use wrong bullet indent
- pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) );
- }
- }
-}
-
-Rectangle Outliner::ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_Bool bReturnPaperPos )
-{
- // Bullet area within the paragraph ...
- Rectangle aBulletArea;
-
- const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
- if ( pFmt )
- {
- Point aTopLeft;
- Size aBulletSize( ImplGetBulletSize( nPara ) );
-
- sal_Bool bOutlineMode = ( pEditEngine->GetControlWord() & EE_CNTRL_OUTLINER ) != 0;
-
- // the ODF attribut text:space-before which holds the spacing to add to the left of the label
- const short nSpaceBefore = pFmt->GetAbsLSpace() + pFmt->GetFirstLineOffset();
-
- const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&) pEditEngine->GetParaAttrib( nPara, bOutlineMode ? EE_PARA_OUTLLRSPACE : EE_PARA_LRSPACE );
- aTopLeft.X() = rLR.GetTxtLeft() + rLR.GetTxtFirstLineOfst() + nSpaceBefore;
-
- long nBulletWidth = Max( (long) -rLR.GetTxtFirstLineOfst(), (long) ((-pFmt->GetFirstLineOffset()) + pFmt->GetCharTextDistance()) );
- if ( nBulletWidth < aBulletSize.Width() ) // The Bullet creates its space
- nBulletWidth = aBulletSize.Width();
-
- if ( bAdjust && !bOutlineMode )
- {
- // 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 ) ) )
- {
- aTopLeft.X() = pEditEngine->GetFirstLineStartX( nPara ) - nBulletWidth;
- }
- }
-
- // Vertical:
- ParagraphInfos aInfos = pEditEngine->GetParagraphInfos( nPara );
- if ( aInfos.bValid )
- {
- 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;
- // 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 ) );
- if ( aBulletFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL )
- {
- OutputDevice* pRefDev = pEditEngine->GetRefDevice();
- Font aOldFont = pRefDev->GetFont();
- pRefDev->SetFont( aBulletFont );
- FontMetric aMetric( pRefDev->GetFontMetric() );
- // Leading on the first line ...
- aTopLeft.Y() = /* aInfos.nFirstLineOffset + */ aInfos.nFirstLineMaxAscent;
- aTopLeft.Y() -= aMetric.GetAscent();
- pRefDev->SetFont( aOldFont );
- }
- }
- }
-
- // Horizontal:
- if( pFmt->GetNumAdjust() == SVX_ADJUST_RIGHT )
- {
- aTopLeft.X() += nBulletWidth - aBulletSize.Width();
- }
- else if( pFmt->GetNumAdjust() == SVX_ADJUST_CENTER )
- {
- aTopLeft.X() += ( nBulletWidth - aBulletSize.Width() ) / 2;
- }
-
- if ( aTopLeft.X() < 0 ) // then push
- aTopLeft.X() = 0;
-
- aBulletArea = Rectangle( aTopLeft, aBulletSize );
- }
- if ( bReturnPaperPos )
- {
- Size aBulletSize( aBulletArea.GetSize() );
- Point aBulletDocPos( aBulletArea.TopLeft() );
- aBulletDocPos.Y() += pEditEngine->GetDocPosTopLeft( nPara ).Y();
- Point aBulletPos( aBulletDocPos );
-
- if ( IsVertical() )
- {
- aBulletPos.Y() = aBulletDocPos.X();
- aBulletPos.X() = GetPaperSize().Width() - aBulletDocPos.Y();
- // Rotate:
- aBulletPos.X() -= aBulletSize.Height();
- Size aSz( aBulletSize );
- aBulletSize.Width() = aSz.Height();
- aBulletSize.Height() = aSz.Width();
- }
- else if ( pEditEngine->IsRightToLeft( nPara ) )
- {
- aBulletPos.X() = GetPaperSize().Width() - aBulletDocPos.X() - aBulletSize.Width();
- }
-
- aBulletArea = Rectangle( aBulletPos, aBulletSize );
- }
- return aBulletArea;
-}
-
-void Outliner::ExpandHdl()
-{
- DBG_CHKTHIS(Outliner,0);
- aExpandHdl.Call( this );
-}
-
-EBulletInfo Outliner::GetBulletInfo( sal_uInt16 nPara )
-{
- EBulletInfo aInfo;
-
- aInfo.nParagraph = nPara;
- aInfo.bVisible = ImplHasBullet( nPara );
-
- const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
- aInfo.nType = pFmt ? pFmt->GetNumberingType() : 0;
-
- if( pFmt )
- {
- if( pFmt->GetNumberingType() != SVX_NUM_BITMAP )
- {
- aInfo.aText = ImplGetBulletText( nPara );
-
- if( pFmt->GetBulletFont() )
- aInfo.aFont = *pFmt->GetBulletFont();
- }
- else if ( pFmt->GetBrush()->GetGraphicObject() )
- {
- aInfo.aGraphic = pFmt->GetBrush()->GetGraphicObject()->GetGraphic();
- }
- }
-
- if ( aInfo.bVisible )
- {
- aInfo.aBounds = ImpCalcBulletArea( nPara, sal_True, sal_True );
- }
-
- return aInfo;
-}
-
-XubString Outliner::GetText( Paragraph* pParagraph, sal_uLong nCount ) const
-{
- DBG_CHKTHIS(Outliner,0);
-
- XubString aText;
- sal_uInt16 nStartPara = (sal_uInt16) pParaList->GetAbsPos( pParagraph );
- for ( sal_uInt16 n = 0; n < nCount; n++ )
- {
- aText += pEditEngine->GetText( nStartPara + n );
- if ( (n+1) < (sal_uInt16)nCount )
- aText += '\n';
- }
- return aText;
-}
-
-void Outliner::Remove( Paragraph* pPara, sal_uLong nParaCount )
-{
- DBG_CHKTHIS(Outliner,0);
-
- sal_uLong nPos = pParaList->GetAbsPos( pPara );
- if( !nPos && ( nParaCount >= pParaList->GetParagraphCount() ) )
- {
- Clear();
- }
- else
- {
- for( sal_uInt16 n = 0; n < (sal_uInt16)nParaCount; n++ )
- pEditEngine->RemoveParagraph( (sal_uInt16) nPos );
- }
-}
-
-void Outliner::StripPortions()
-{
- DBG_CHKTHIS(Outliner,0);
- bStrippingPortions = sal_True;
- pEditEngine->StripPortions();
- bStrippingPortions = sal_False;
-}
-
-void Outliner::DrawingText( const Point& rStartPos, const XubString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, const sal_Int32* pDXArray,const SvxFont& rFont,
- sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt8 nRightToLeft,
- const EEngineData::WrongSpellVector* pWrongSpellVector,
- const SvxFieldData* pFieldData,
- bool bEndOfLine,
- bool bEndOfParagraph,
- bool bEndOfBullet,
- const ::com::sun::star::lang::Locale* pLocale,
- const Color& rOverlineColor,
- const Color& rTextLineColor)
-{
- DBG_CHKTHIS(Outliner,0);
-
- if(aDrawPortionHdl.IsSet())
- {
- DrawPortionInfo aInfo( rStartPos, rText, nTextStart, nTextLen, rFont, nPara, nIndex, pDXArray, pWrongSpellVector,
- 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 );
- }
-}
-
-long Outliner::RemovingPagesHdl( OutlinerView* pView )
-{
- DBG_CHKTHIS(Outliner,0);
- return aRemovingPagesHdl.IsSet() ? aRemovingPagesHdl.Call( pView ) : sal_True;
-}
-
-sal_Bool Outliner::ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_uInt16 _nFirstPage, sal_uInt16 nPages )
-{
- DBG_CHKTHIS(Outliner,0);
-
- nDepthChangedHdlPrevDepth = nPages;
- mnFirstSelPage = _nFirstPage;
- pHdlParagraph = 0;
- return (sal_Bool)RemovingPagesHdl( pCurView );
-}
-
-SfxItemSet Outliner::GetParaAttribs( sal_uInt16 nPara )
-{
- DBG_CHKTHIS(Outliner,0);
- return pEditEngine->GetParaAttribs( nPara );
-}
-
-IMPL_LINK( Outliner, ParaVisibleStateChangedHdl, Paragraph*, pPara )
-{
- DBG_CHKTHIS(Outliner,0);
-
- sal_uLong nPara = pParaList->GetAbsPos( pPara );
- pEditEngine->ShowParagraph( (sal_uInt16)nPara, pPara->IsVisible() );
-
- return 0;
-}
-
-IMPL_LINK( Outliner, BeginMovingParagraphsHdl, MoveParagraphsInfo*, EMPTYARG )
-{
- DBG_CHKTHIS(Outliner,0);
-
- if( !IsInUndo() )
- GetBeginMovingHdl().Call( this );
-
- return 0;
-}
-
-IMPL_LINK( Outliner, BeginPasteOrDropHdl, PasteOrDropInfos*, pInfos )
-{
- UndoActionStart( EDITUNDO_DRAGANDDROP );
- maBeginPasteOrDropHdl.Call(pInfos);
- return 0;
-}
-
-IMPL_LINK( Outliner, EndPasteOrDropHdl, PasteOrDropInfos*, pInfos )
-{
- bPasting = sal_False;
- ImpTextPasted( pInfos->nStartPara, pInfos->nEndPara - pInfos->nStartPara + 1 );
- maEndPasteOrDropHdl.Call( pInfos );
- UndoActionEnd( EDITUNDO_DRAGANDDROP );
- return 0;
-}
-
-IMPL_LINK( Outliner, EndMovingParagraphsHdl, MoveParagraphsInfo*, pInfos )
-{
- DBG_CHKTHIS(Outliner,0);
-
- pParaList->MoveParagraphs( pInfos->nStartPara, pInfos->nDestPara, pInfos->nEndPara - pInfos->nStartPara + 1 );
- sal_uInt16 nChangesStart = Min( pInfos->nStartPara, pInfos->nDestPara );
- sal_uInt16 nParas = (sal_uInt16)pParaList->GetParagraphCount();
- for ( sal_uInt16 n = nChangesStart; n < nParas; n++ )
- ImplCalcBulletText( n, sal_False, sal_False );
-
- if( !IsInUndo() )
- aEndMovingHdl.Call( this );
-
- return 0;
-}
-
-static bool isSameNumbering( const SvxNumberFormat& rN1, const SvxNumberFormat& rN2 )
-{
- if( rN1.GetNumberingType() != rN2.GetNumberingType() )
- return false;
-
- if( rN1.GetNumStr(1) != rN2.GetNumStr(1) )
- return false;
-
- if( (rN1.GetPrefix() != rN2.GetPrefix()) || (rN1.GetSuffix() != rN2.GetSuffix()) )
- return false;
-
- return true;
-}
-
-sal_uInt16 Outliner::ImplGetNumbering( sal_uInt16 nPara, const SvxNumberFormat* pParaFmt )
-{
- sal_uInt16 nNumber = pParaFmt->GetStart() - 1;
-
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- const sal_Int16 nParaDepth = pPara->GetDepth();
-
- do
- {
- pPara = pParaList->GetParagraph( nPara );
- const sal_Int16 nDepth = pPara->GetDepth();
-
- // ignore paragraphs that are below our paragraph or have no numbering
- if( (nDepth > nParaDepth) || (nDepth == -1) )
- continue;
-
- // stop on paragraphs that are above our paragraph
- if( nDepth < nParaDepth )
- break;
-
- const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
-
- if( pFmt == 0 )
- continue; // ignore paragraphs without bullets
-
- // check if numbering is the same
- if( !isSameNumbering( *pFmt, *pParaFmt ) )
- break;
-
- const SfxBoolItem& rBulletState = (const SfxBoolItem&) pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE );
-
- if( rBulletState.GetValue() )
- nNumber += 1;
-
- // same depth, same number format, check for restart
- const sal_Int16 nNumberingStartValue = pPara->GetNumberingStartValue();
- if( (nNumberingStartValue != -1) || pPara->IsParaIsNumberingRestart() )
- {
- if( nNumberingStartValue != -1 )
- nNumber += nNumberingStartValue - 1;
- break;
- }
- }
- while( nPara-- );
-
- return nNumber;
-}
-
-void Outliner::ImplCalcBulletText( sal_uInt16 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChilds )
-{
- DBG_CHKTHIS(Outliner,0);
-
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- sal_uInt16 nRelPos = 0xFFFF;
-
- while ( pPara )
- {
- XubString aBulletText;
- const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
- if( pFmt && ( pFmt->GetNumberingType() != SVX_NUM_BITMAP ) )
- {
- aBulletText += pFmt->GetPrefix();
- if( pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL )
- {
- aBulletText += pFmt->GetBulletChar();
- }
- else if( pFmt->GetNumberingType() != SVX_NUM_NUMBER_NONE )
- {
- aBulletText += pFmt->GetNumStr( ImplGetNumbering( nPara, pFmt ) );
- }
- aBulletText += pFmt->GetSuffix();
- }
-
- if( aBulletText != pPara->GetText() )
- pPara->SetText( aBulletText );
-
- pPara->nFlags &= (~PARAFLAG_SETBULLETTEXT);
-
- if ( bRecalcLevel )
- {
- if ( nRelPos != 0xFFFF )
- nRelPos++;
-
- sal_Int16 nDepth = pPara->GetDepth();
- pPara = pParaList->GetParagraph( ++nPara );
- if ( !bRecalcChilds )
- {
- while ( pPara && ( pPara->GetDepth() > nDepth ) )
- pPara = pParaList->GetParagraph( ++nPara );
- }
-
- if ( pPara && ( pPara->GetDepth() < nDepth ) )
- pPara = NULL;
- }
- else
- {
- pPara = NULL;
- }
- }
-}
-
-void Outliner::Clear()
-{
- DBG_CHKTHIS(Outliner,0);
-
- if( !bFirstParaIsEmpty )
- {
- ImplBlockInsertionCallbacks( sal_True );
- pEditEngine->Clear();
- pParaList->Clear( sal_True );
- pParaList->Append( new Paragraph( nMinDepth ));
- bFirstParaIsEmpty = sal_True;
- ImplBlockInsertionCallbacks( sal_False );
- }
- else
- {
- Paragraph* pPara = pParaList->GetParagraph( 0 );
- if(pPara)
- pPara->SetDepth( nMinDepth );
- }
-}
-
-void Outliner::SetFlatMode( sal_Bool bFlat )
-{
- DBG_CHKTHIS(Outliner,0);
-
- if( bFlat != pEditEngine->IsFlatMode() )
- {
- for ( sal_uInt16 nPara = (sal_uInt16)pParaList->GetParagraphCount(); nPara; )
- pParaList->GetParagraph( --nPara )->aBulSize.Width() = -1;
-
- pEditEngine->SetFlatMode( bFlat );
- }
-}
-
-String Outliner::ImplGetBulletText( sal_uInt16 nPara )
-{
- String aRes;
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- if (pPara)
- {
- // Enable optimization again ...
-// if( pPara->nFlags & PARAFLAG_SETBULLETTEXT )
- ImplCalcBulletText( nPara, sal_False, sal_False );
- aRes = pPara->GetText();
- }
- return aRes;
-}
-
-// this is needed for StarOffice Api
-void Outliner::SetLevelDependendStyleSheet( sal_uInt16 nPara )
-{
- SfxItemSet aOldAttrs( pEditEngine->GetParaAttribs( nPara ) );
- ImplSetLevelDependendStyleSheet( nPara );
- pEditEngine->SetParaAttribs( nPara, aOldAttrs );
-}
-
-SV_IMPL_PTRARR( NotifyList, EENotifyPtr );
-
-void Outliner::ImplBlockInsertionCallbacks( sal_Bool b )
-{
- if ( b )
- {
- bBlockInsCallback++;
- }
- else
- {
- DBG_ASSERT( bBlockInsCallback, "ImplBlockInsertionCallbacks ?!" );
- bBlockInsCallback--;
- if ( !bBlockInsCallback )
- {
- // Call blocked notify events...
- while ( pEditEngine->aNotifyCache.Count() )
- {
- EENotify* pNotify = pEditEngine->aNotifyCache[0];
- // Remove from list before calling, maybe we enter LeaveBlockNotifications while calling the handler...
- pEditEngine->aNotifyCache.Remove( 0 );
- pEditEngine->aOutlinerNotifyHdl.Call( pNotify );
- delete pNotify;
- }
- }
- }
-}
-
-IMPL_LINK( Outliner, EditEngineNotifyHdl, EENotify*, pNotify )
-{
- if ( !bBlockInsCallback )
- {
- pEditEngine->aOutlinerNotifyHdl.Call( pNotify );
- }
- else
- {
- EENotify* pNewNotify = new EENotify( *pNotify );
- pEditEngine->aNotifyCache.Insert( pNewNotify, pEditEngine->aNotifyCache.Count() );
- }
-
- return 0;
-}
-
-/** sets a link that is called at the beginning of a drag operation at an edit view */
-void Outliner::SetBeginDropHdl( const Link& rLink )
-{
- pEditEngine->SetBeginDropHdl( rLink );
-}
-
-Link Outliner::GetBeginDropHdl() const
-{
- return pEditEngine->GetBeginDropHdl();
-}
-
-/** sets a link that is called at the end of a drag operation at an edit view */
-void Outliner::SetEndDropHdl( const Link& rLink )
-{
- pEditEngine->SetEndDropHdl( rLink );
-}
-
-Link Outliner::GetEndDropHdl() const
-{
- return pEditEngine->GetEndDropHdl();
-}
-
-/** sets a link that is called before a drop or paste operation. */
-void Outliner::SetBeginPasteOrDropHdl( const Link& rLink )
-{
- maBeginPasteOrDropHdl = rLink;
-}
-
-/** sets a link that is called after a drop or paste operation. */
-void Outliner::SetEndPasteOrDropHdl( const Link& rLink )
-{
- maEndPasteOrDropHdl = rLink;
-}
-
-void Outliner::SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag )
-{
- if( pPara && !pPara->HasFlag( nFlag ) )
- {
- if( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new OutlinerUndoChangeParaFlags( this, (sal_uInt16)GetAbsPos( pPara ), pPara->nFlags, pPara->nFlags|nFlag ) );
-
- pPara->SetFlag( nFlag );
- }
-}
-
-void Outliner::RemoveParaFlag( Paragraph* pPara, sal_uInt16 nFlag )
-{
- if( pPara && pPara->HasFlag( nFlag ) )
- {
- if( IsUndoEnabled() && !IsInUndo() )
- InsertUndo( new OutlinerUndoChangeParaFlags( this, (sal_uInt16)GetAbsPos( pPara ), pPara->nFlags, pPara->nFlags & ~nFlag ) );
-
- pPara->RemoveFlag( nFlag );
- }
-}
-
-bool Outliner::HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const
-{
- return pPara && pPara->HasFlag( nFlag );
-}
-
-
-sal_Bool DrawPortionInfo::IsRTL() const
-{
- if(0xFF == mnBiDiLevel)
- {
- // Use Bidi functions from icu 2.0 to calculate if this portion
- // is RTL or not.
- UErrorCode nError(U_ZERO_ERROR);
- UBiDi* pBidi = ubidi_openSized(mrText.Len(), 0, &nError);
- nError = U_ZERO_ERROR;
-
- // I do not have this info here. Is it necessary? I'll have to ask MT.
- const sal_uInt8 nDefaultDir = UBIDI_LTR; //IsRightToLeft( nPara ) ? UBIDI_RTL : UBIDI_LTR;
-
- ubidi_setPara(pBidi, reinterpret_cast<const UChar *>(mrText.GetBuffer()), mrText.Len(), nDefaultDir, NULL, &nError); // UChar != sal_Unicode in MinGW
- nError = U_ZERO_ERROR;
-
- int32_t nStart(0);
- int32_t nEnd;
- UBiDiLevel nCurrDir;
-
- ubidi_getLogicalRun(pBidi, nStart, &nEnd, &nCurrDir);
-
- ubidi_close(pBidi);
-
- // remember on-demand calculated state
- ((DrawPortionInfo*)this)->mnBiDiLevel = nCurrDir;
- }
-
- return (1 == (mnBiDiLevel % 2));
-}
-
-// eof
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/outliner/outliner.src b/editeng/source/outliner/outliner.src
deleted file mode 100644
index e7e557e040..0000000000
--- a/editeng/source/outliner/outliner.src
+++ /dev/null
@@ -1,84 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <editeng/editrids.hrc>
-
-String RID_OUTLUNDO_HEIGHT
-{
- Text [ en-US ] = "Move" ;
-};
-String RID_OUTLUNDO_DEPTH
-{
- Text [ en-US ] = "Indent" ;
-};
-String RID_OUTLUNDO_EXPAND
-{
- Text [ en-US ] = "Show subpoints" ;
-};
-String RID_OUTLUNDO_COLLAPSE
-{
- Text [ en-US ] = "Collapse" ;
-};
-String RID_OUTLUNDO_ATTR
-{
- Text [ en-US ] = "Apply attributes" ;
-};
-String RID_OUTLUNDO_INSERT
-{
- Text [ en-US ] = "Insert" ;
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/editeng/source/outliner/outlobj.cxx b/editeng/source/outliner/outlobj.cxx
deleted file mode 100644
index 633fd33737..0000000000
--- a/editeng/source/outliner/outlobj.cxx
+++ /dev/null
@@ -1,274 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <outl_pch.hxx>
-
-#define _OUTLINER_CXX
-#include <editeng/outliner.hxx>
-#include <editeng/outlobj.hxx>
-#include <outleeng.hxx>
-#include <editeng/editobj.hxx>
-#include <vcl/bitmap.hxx>
-#include <tools/stream.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-class ImplOutlinerParaObject
-{
-public:
- // data members
- EditTextObject* mpEditTextObject;
- ParagraphDataVector maParagraphDataVector;
- bool mbIsEditDoc;
-
- // refcounter
- sal_uInt32 mnRefCount;
-
- // constuctor
- ImplOutlinerParaObject(EditTextObject* pEditTextObject, const ParagraphDataVector& rParagraphDataVector, bool bIsEditDoc)
- : mpEditTextObject(pEditTextObject),
- maParagraphDataVector(rParagraphDataVector),
- mbIsEditDoc(bIsEditDoc),
- mnRefCount(0)
- {
- if( (maParagraphDataVector.size() == 0) && (pEditTextObject->GetParagraphCount() != 0) )
- maParagraphDataVector.resize(pEditTextObject->GetParagraphCount());
- }
-
- // destructor
- ~ImplOutlinerParaObject()
- {
- delete mpEditTextObject;
- }
-
- bool operator==(const ImplOutlinerParaObject& rCandidate) const
- {
- return (*mpEditTextObject == *rCandidate.mpEditTextObject
- && maParagraphDataVector == rCandidate.maParagraphDataVector
- && mbIsEditDoc == rCandidate.mbIsEditDoc);
- }
-
- // #i102062#
- bool isWrongListEqual(const ImplOutlinerParaObject& rCompare) const
- {
- return mpEditTextObject->isWrongListEqual(*rCompare.mpEditTextObject);
- }
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-void OutlinerParaObject::ImplMakeUnique()
-{
- if(mpImplOutlinerParaObject->mnRefCount)
- {
- ImplOutlinerParaObject* pNew = new ImplOutlinerParaObject(
- mpImplOutlinerParaObject->mpEditTextObject->Clone(),
- mpImplOutlinerParaObject->maParagraphDataVector,
- mpImplOutlinerParaObject->mbIsEditDoc);
- mpImplOutlinerParaObject->mnRefCount--;
- mpImplOutlinerParaObject = pNew;
- }
-}
-
-OutlinerParaObject::OutlinerParaObject(const EditTextObject& rEditTextObject, const ParagraphDataVector& rParagraphDataVector, bool bIsEditDoc)
-: mpImplOutlinerParaObject(new ImplOutlinerParaObject(rEditTextObject.Clone(), rParagraphDataVector, bIsEditDoc))
-{
-}
-
-OutlinerParaObject::OutlinerParaObject(const OutlinerParaObject& rCandidate)
-: mpImplOutlinerParaObject(rCandidate.mpImplOutlinerParaObject)
-{
- mpImplOutlinerParaObject->mnRefCount++;
-}
-
-OutlinerParaObject::~OutlinerParaObject()
-{
- if(mpImplOutlinerParaObject->mnRefCount)
- {
- mpImplOutlinerParaObject->mnRefCount--;
- }
- else
- {
- delete mpImplOutlinerParaObject;
- }
-}
-
-OutlinerParaObject& OutlinerParaObject::operator=(const OutlinerParaObject& rCandidate)
-{
- if(rCandidate.mpImplOutlinerParaObject != mpImplOutlinerParaObject)
- {
- if(mpImplOutlinerParaObject->mnRefCount)
- {
- mpImplOutlinerParaObject->mnRefCount--;
- }
- else
- {
- delete mpImplOutlinerParaObject;
- }
-
- mpImplOutlinerParaObject = rCandidate.mpImplOutlinerParaObject;
- mpImplOutlinerParaObject->mnRefCount++;
- }
-
- return *this;
-}
-
-bool OutlinerParaObject::operator==(const OutlinerParaObject& rCandidate) const
-{
- if(rCandidate.mpImplOutlinerParaObject == mpImplOutlinerParaObject)
- {
- return true;
- }
-
- return (*rCandidate.mpImplOutlinerParaObject == *mpImplOutlinerParaObject);
-}
-
-// #i102062#
-bool OutlinerParaObject::isWrongListEqual(const OutlinerParaObject& rCompare) const
-{
- if(rCompare.mpImplOutlinerParaObject == mpImplOutlinerParaObject)
- {
- return true;
- }
-
- return mpImplOutlinerParaObject->isWrongListEqual(*rCompare.mpImplOutlinerParaObject);
-}
-
-sal_uInt16 OutlinerParaObject::GetOutlinerMode() const
-{
- return mpImplOutlinerParaObject->mpEditTextObject->GetUserType();
-}
-
-void OutlinerParaObject::SetOutlinerMode(sal_uInt16 nNew)
-{
- if(mpImplOutlinerParaObject->mpEditTextObject->GetUserType() != nNew)
- {
- ImplMakeUnique();
- mpImplOutlinerParaObject->mpEditTextObject->SetUserType(nNew);
- }
-}
-
-bool OutlinerParaObject::IsVertical() const
-{
- return mpImplOutlinerParaObject->mpEditTextObject->IsVertical();
-}
-
-void OutlinerParaObject::SetVertical(bool bNew)
-{
- if((bool)mpImplOutlinerParaObject->mpEditTextObject->IsVertical() != bNew)
- {
- ImplMakeUnique();
- mpImplOutlinerParaObject->mpEditTextObject->SetVertical(bNew);
- }
-}
-
-sal_uInt32 OutlinerParaObject::Count() const
-{
- return mpImplOutlinerParaObject->maParagraphDataVector.size();
-}
-
-sal_Int16 OutlinerParaObject::GetDepth(sal_uInt16 nPara) const
-{
- if(nPara < mpImplOutlinerParaObject->maParagraphDataVector.size())
- {
- return mpImplOutlinerParaObject->maParagraphDataVector[nPara].getDepth();
- }
- else
- {
- return -1;
- }
-}
-
-const EditTextObject& OutlinerParaObject::GetTextObject() const
-{
- return *mpImplOutlinerParaObject->mpEditTextObject;
-}
-
-bool OutlinerParaObject::IsEditDoc() const
-{
- return mpImplOutlinerParaObject->mbIsEditDoc;
-}
-
-const ParagraphData& OutlinerParaObject::GetParagraphData(sal_uInt32 nIndex) const
-{
- if(nIndex < mpImplOutlinerParaObject->maParagraphDataVector.size())
- {
- return mpImplOutlinerParaObject->maParagraphDataVector[nIndex];
- }
- else
- {
- OSL_FAIL("OutlinerParaObject::GetParagraphData: Access out of range (!)");
- static ParagraphData aEmptyParagraphData;
- return aEmptyParagraphData;
- }
-}
-
-void OutlinerParaObject::ClearPortionInfo()
-{
- ImplMakeUnique();
- mpImplOutlinerParaObject->mpEditTextObject->ClearPortionInfo();
-}
-
-bool OutlinerParaObject::ChangeStyleSheets(const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily)
-{
- ImplMakeUnique();
- return mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheets(rOldName, eOldFamily, rNewName, eNewFamily);
-}
-
-void OutlinerParaObject::ChangeStyleSheetName(SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName)
-{
- ImplMakeUnique();
- mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheetName(eFamily, rOldName, rNewName);
-}
-
-void OutlinerParaObject::SetStyleSheets(sal_uInt16 nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily)
-{
- const sal_uInt32 nCount(mpImplOutlinerParaObject->maParagraphDataVector.size());
-
- if(nCount)
- {
- ImplMakeUnique();
- sal_uInt16 nDecrementer(sal::static_int_cast< sal_uInt16 >(nCount));
-
- for(;nDecrementer;)
- {
- if(GetDepth(--nDecrementer) == nLevel)
- {
- mpImplOutlinerParaObject->mpEditTextObject->SetStyleSheet(nDecrementer, rNewName, rNewFamily);
- }
- }
- }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/outliner/outlundo.cxx b/editeng/source/outliner/outlundo.cxx
deleted file mode 100644
index 933b6a9c7e..0000000000
--- a/editeng/source/outliner/outlundo.cxx
+++ /dev/null
@@ -1,237 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <svl/intitem.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/fhgtitem.hxx>
-
-#define _OUTLINER_CXX
-#include <editeng/outliner.hxx>
-#include <outlundo.hxx>
-
-
-OutlinerUndoBase::OutlinerUndoBase( sal_uInt16 _nId, Outliner* pOutliner )
- : EditUndo( _nId, NULL )
-{
- DBG_ASSERT( pOutliner, "Undo: Outliner?!" );
- mpOutliner = pOutliner;
-}
-
-OutlinerUndoChangeParaFlags::OutlinerUndoChangeParaFlags( Outliner* pOutliner, sal_uInt16 nPara, sal_uInt16 nOldFlags, sal_uInt16 nNewFlags )
-: OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
-{
- mnPara = nPara;
- mnOldFlags = nOldFlags;
- mnNewFlags = nNewFlags;
-}
-
-void OutlinerUndoChangeParaFlags::Undo()
-{
- ImplChangeFlags( mnOldFlags );
-}
-
-void OutlinerUndoChangeParaFlags::Redo()
-{
- ImplChangeFlags( mnNewFlags );
-}
-
-void OutlinerUndoChangeParaFlags::ImplChangeFlags( sal_uInt16 nFlags )
-{
- Outliner* pOutliner = GetOutliner();
- Paragraph* pPara = pOutliner->GetParagraph( mnPara );
- if( pPara )
- {
- pOutliner->nDepthChangedHdlPrevDepth = pPara->GetDepth();
- pOutliner->mnDepthChangeHdlPrevFlags = pPara->nFlags;
- pOutliner->pHdlParagraph = pPara;
-
- pPara->nFlags = nFlags;
- pOutliner->DepthChangedHdl();
- }
-}
-
-OutlinerUndoChangeParaNumberingRestart::OutlinerUndoChangeParaNumberingRestart( Outliner* pOutliner, sal_uInt16 nPara,
- sal_Int16 nOldNumberingStartValue, sal_Int16 nNewNumberingStartValue,
- sal_Bool bOldParaIsNumberingRestart, sal_Bool bNewParaIsNumberingRestart )
-: OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
-{
- mnPara = nPara;
-
- maUndoData.mnNumberingStartValue = nOldNumberingStartValue;
- maUndoData.mbParaIsNumberingRestart = bOldParaIsNumberingRestart;
- maRedoData.mnNumberingStartValue = nNewNumberingStartValue;
- maRedoData.mbParaIsNumberingRestart = bNewParaIsNumberingRestart;
-}
-
-void OutlinerUndoChangeParaNumberingRestart::Undo()
-{
- ImplApplyData( maUndoData );
-}
-
-void OutlinerUndoChangeParaNumberingRestart::Redo()
-{
- ImplApplyData( maRedoData );
-}
-
-void OutlinerUndoChangeParaNumberingRestart::ImplApplyData( const ParaRestartData& rData )
-{
- Outliner* pOutliner = GetOutliner();
- pOutliner->SetNumberingStartValue( mnPara, rData.mnNumberingStartValue );
- pOutliner->SetParaIsNumberingRestart( mnPara, rData.mbParaIsNumberingRestart );
-}
-
-OutlinerUndoChangeDepth::OutlinerUndoChangeDepth( Outliner* pOutliner, sal_uInt16 nPara, sal_Int16 nOldDepth, sal_Int16 nNewDepth )
- : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
-{
- mnPara = nPara;
- mnOldDepth = nOldDepth;
- mnNewDepth = nNewDepth;
-}
-
-void OutlinerUndoChangeDepth::Undo()
-{
- GetOutliner()->ImplInitDepth( mnPara, mnOldDepth, sal_False );
-}
-
-void OutlinerUndoChangeDepth::Redo()
-{
- GetOutliner()->ImplInitDepth( mnPara, mnNewDepth, sal_False );
-}
-
-void OutlinerUndoChangeDepth::Repeat()
-{
- OSL_FAIL( "Repeat not implemented!" );
-}
-
-
-OutlinerUndoCheckPara::OutlinerUndoCheckPara( Outliner* pOutliner, sal_uInt16 nPara )
- : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
-{
- mnPara = nPara;
-}
-
-void OutlinerUndoCheckPara::Undo()
-{
- Paragraph* pPara = GetOutliner()->GetParagraph( mnPara );
- pPara->Invalidate();
- GetOutliner()->ImplCalcBulletText( mnPara, sal_False, sal_False );
-}
-
-void OutlinerUndoCheckPara::Redo()
-{
- Paragraph* pPara = GetOutliner()->GetParagraph( mnPara );
- pPara->Invalidate();
- GetOutliner()->ImplCalcBulletText( mnPara, sal_False, sal_False );
-}
-
-void OutlinerUndoCheckPara::Repeat()
-{
- OSL_FAIL( "Repeat not implemented!" );
-}
-
-DBG_NAME(OLUndoExpand);
-
-OLUndoExpand::OLUndoExpand(Outliner* pOut, sal_uInt16 _nId )
- : EditUndo( _nId, 0 )
-{
- DBG_CTOR(OLUndoExpand,0);
- DBG_ASSERT(pOut,"Undo:No Outliner");
- pOutliner = pOut;
- nCount = 0;
- pParas = 0;
-}
-
-
-OLUndoExpand::~OLUndoExpand()
-{
- DBG_DTOR(OLUndoExpand,0);
- delete pParas;
-}
-
-
-void OLUndoExpand::Restore( sal_Bool bUndo )
-{
- DBG_CHKTHIS(OLUndoExpand,0);
- DBG_ASSERT(pOutliner,"Undo:No Outliner");
- DBG_ASSERT(pOutliner->pEditEngine,"Outliner already deleted");
- Paragraph* pPara;
-
- sal_Bool bExpand = sal_False;
- sal_uInt16 _nId = GetId();
- if((_nId == OLUNDO_EXPAND && !bUndo) || (_nId == OLUNDO_COLLAPSE && bUndo))
- bExpand = sal_True;
- if( !pParas )
- {
- pPara = pOutliner->GetParagraph( (sal_uLong)nCount );
- if( bExpand )
- pOutliner->Expand( pPara );
- else
- pOutliner->Collapse( pPara );
- }
- else
- {
- for( sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++ )
- {
- pPara = pOutliner->GetParagraph( (sal_uLong)(pParas[nIdx]) );
- if( bExpand )
- pOutliner->Expand( pPara );
- else
- pOutliner->Collapse( pPara );
- }
- }
-}
-
-
-void OLUndoExpand::Undo()
-{
- DBG_CHKTHIS(OLUndoExpand,0);
- Restore( sal_True );
-}
-
-
-void OLUndoExpand::Redo()
-{
- DBG_CHKTHIS(OLUndoExpand,0);
- Restore( sal_False );
-}
-
-
-void OLUndoExpand::Repeat()
-{
- DBG_CHKTHIS(OLUndoExpand,0);
- 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
deleted file mode 100644
index fcdce80be4..0000000000
--- a/editeng/source/outliner/outlundo.hxx
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _OUTLUNDO_HXX
-#define _OUTLUNDO_HXX
-
-#include <editeng/outliner.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/editund2.hxx>
-
-class OutlinerUndoBase : public EditUndo
-{
-private:
- Outliner* mpOutliner;
-
-public:
- OutlinerUndoBase( sal_uInt16 nId, Outliner* pOutliner );
-
- Outliner* GetOutliner() const { return mpOutliner; }
-};
-
-class OutlinerUndoChangeParaFlags : public OutlinerUndoBase
-{
-private:
- sal_uInt16 mnPara;
- sal_uInt16 mnOldFlags;
- sal_uInt16 mnNewFlags;
-
- void ImplChangeFlags( sal_uInt16 nFlags );
-
-public:
- OutlinerUndoChangeParaFlags( Outliner* pOutliner, sal_uInt16 nPara, sal_uInt16 nOldDepth, sal_uInt16 nNewDepth );
-
- virtual void Undo();
- virtual void Redo();
-};
-
-class OutlinerUndoChangeParaNumberingRestart : public OutlinerUndoBase
-{
-private:
- sal_uInt16 mnPara;
-
- struct ParaRestartData
- {
- sal_Int16 mnNumberingStartValue;
- sal_Bool mbParaIsNumberingRestart;
- };
-
- ParaRestartData maUndoData;
- ParaRestartData maRedoData;
-
- void ImplApplyData( const ParaRestartData& rData );
-public:
- OutlinerUndoChangeParaNumberingRestart( Outliner* pOutliner, sal_uInt16 nPara,
- sal_Int16 nOldNumberingStartValue, sal_Int16 mnNewNumberingStartValue,
- sal_Bool nOldbParaIsNumberingRestart, sal_Bool nbNewParaIsNumberingRestart );
-
- virtual void Undo();
- virtual void Redo();
-};
-
-class OutlinerUndoChangeDepth : public OutlinerUndoBase
-{
- using SfxUndoAction::Repeat;
-private:
- sal_uInt16 mnPara;
- sal_Int16 mnOldDepth;
- sal_Int16 mnNewDepth;
-
-public:
- OutlinerUndoChangeDepth( Outliner* pOutliner, sal_uInt16 nPara, sal_Int16 nOldDepth, sal_Int16 nNewDepth );
-
- virtual void Undo();
- virtual void Redo();
- virtual void Repeat();
-};
-
-// Help-Undo: If it does not exist an OutlinerUndoAction for a certain action
-// because this is handled by the EditEngine, but for example the bullet has
-// to be recalculated.
-class OutlinerUndoCheckPara : public OutlinerUndoBase
-{
- using SfxUndoAction::Repeat;
-private:
- sal_uInt16 mnPara;
-
-public:
- OutlinerUndoCheckPara( Outliner* pOutliner, sal_uInt16 nPara );
-
- virtual void Undo();
- virtual void Redo();
- virtual void Repeat();
-};
-
-
-
-// -------------------------------------
-
-
-class OLUndoExpand : public EditUndo
-{
- using SfxUndoAction::Repeat;
- void Restore( sal_Bool bUndo );
-public:
- OLUndoExpand( Outliner* pOut, sal_uInt16 nId );
- ~OLUndoExpand();
- virtual void Undo();
- virtual void Redo();
- virtual void Repeat();
-
- 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
deleted file mode 100644
index f71864adbb..0000000000
--- a/editeng/source/outliner/outlvw.cxx
+++ /dev/null
@@ -1,1715 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-
-#include "precompiled_editeng.hxx"
-
-#include <com/sun/star/i18n/WordType.hpp>
-
-#include <svl/intitem.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/eerdll.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/fhgtitem.hxx>
-
-#include <svl/style.hxx>
-#include <i18npool/mslangid.hxx>
-
-#define _OUTLINER_CXX
-#include <editeng/outliner.hxx>
-#include <outleeng.hxx>
-#include <paralist.hxx>
-#include <outlundo.hxx>
-#include <editeng/outlobj.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/numitem.hxx>
-#include <vcl/window.hxx>
-#include <svl/itemset.hxx>
-#include <editeng/editstat.hxx>
-
-
-// Width of the border zones within which is scrolled during Drag and Drop
-#define OL_SCROLL_LRBORDERWIDTHPIX 10
-#define OL_SCROLL_TBBORDERWIDTHPIX 10
-
-// 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;
-
-DBG_NAME(OutlinerView)
-
-
-OutlinerView::OutlinerView( Outliner* pOut, Window* pWin )
-{
- DBG_CTOR( OutlinerView, 0 );
-
- pOwner = pOut;
- bDDCursorVisible = sal_False;
- bInDragMode = sal_False;
- nDDScrollLRBorderWidthWin = 0;
- nDDScrollTBBorderWidthWin = 0;
- pHorTabArrDoc = 0;
-
- pEditView = new EditView( pOut->pEditEngine, pWin );
- pEditView->SetSelectionMode( EE_SELMODE_TXTONLY );
-}
-
-OutlinerView::~OutlinerView()
-{
- DBG_DTOR(OutlinerView,0);
- delete pEditView;
-}
-
-void OutlinerView::Paint( const Rectangle& rRect )
-{
- DBG_CHKTHIS(OutlinerView,0);
-
- // 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, Window* pFrameWin )
-{
- DBG_CHKTHIS( OutlinerView, 0 );
-
- // For the first Paint/KeyInput/Drop an emty Outliner is turned into
- // an Outliner with exactly one paragraph.
- if( pOwner->bFirstParaIsEmpty )
- pOwner->Insert( String() );
-
-
- sal_Bool bKeyProcessed = sal_False;
- ESelection aSel( pEditView->GetSelection() );
- sal_Bool bSelection = aSel.HasRange();
- KeyCode aKeyCode = rKEvt.GetKeyCode();
- KeyFuncType eFunc = aKeyCode.GetFunction();
- sal_uInt16 nCode = aKeyCode.GetCode();
- sal_Bool bReadOnly = IsReadOnly();
-
- if( bSelection && ( nCode != KEY_TAB ) && EditEngine::DoesKeyChangeText( rKEvt ) )
- {
- if ( ImpCalcSelectedPages( sal_False ) && !pOwner->ImpCanDeleteSelectedPages( this ) )
- return sal_True;
- }
-
- if ( eFunc != KEYFUNC_DONTKNOW )
- {
- switch ( eFunc )
- {
- case KEYFUNC_CUT:
- {
- if ( !bReadOnly )
- {
- Cut();
- bKeyProcessed = sal_True;
- }
- }
- break;
- case KEYFUNC_COPY:
- {
- Copy();
- bKeyProcessed = sal_True;
- }
- break;
- case KEYFUNC_PASTE:
- {
- if ( !bReadOnly )
- {
- PasteSpecial();
- bKeyProcessed = sal_True;
- }
- }
- break;
- case KEYFUNC_DELETE:
- {
- if( !bReadOnly && !bSelection && ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ) )
- {
- if( aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) )
- {
- Paragraph* pNext = pOwner->pParaList->GetParagraph( aSel.nEndPara+1 );
- if( pNext && pNext->HasFlag(PARAFLAG_ISPAGE) )
- {
- if( !pOwner->ImpCanDeleteSelectedPages( this, aSel.nEndPara, 1 ) )
- return sal_False;
- }
- }
- }
- }
- break;
- default: // is then possibly edited below.
- eFunc = KEYFUNC_DONTKNOW;
- }
- }
- if ( eFunc == KEYFUNC_DONTKNOW )
- {
- switch ( nCode )
- {
- case KEY_TAB:
- {
- if ( !bReadOnly && !aKeyCode.IsMod1() && !aKeyCode.IsMod2() )
- {
- if ( ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ) &&
- ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TITLEOBJECT ) &&
- ( bSelection || !aSel.nStartPos ) )
- {
- Indent( aKeyCode.IsShift() ? (-1) : (+1) );
- bKeyProcessed = sal_True;
- }
- else if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) &&
- !bSelection && !aSel.nEndPos && pOwner->ImplHasBullet( aSel.nEndPara ) )
- {
- Indent( aKeyCode.IsShift() ? (-1) : (+1) );
- bKeyProcessed = sal_True;
- }
- }
- }
- break;
- case KEY_BACKSPACE:
- {
- if( !bReadOnly && !bSelection && aSel.nEndPara && !aSel.nEndPos )
- {
- Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara );
- Paragraph* pPrev = pOwner->pParaList->GetParagraph( aSel.nEndPara-1 );
- if( !pPrev->IsVisible() )
- return sal_True;
- if( !pPara->GetDepth() )
- {
- if(!pOwner->ImpCanDeleteSelectedPages(this, aSel.nEndPara , 1 ) )
- return sal_True;
- }
- }
- }
- break;
- case KEY_RETURN:
- {
- if ( !bReadOnly )
- {
- // Special treatment: hard return at the end of a paragraph,
- // which has collapsed subparagraphs.
- Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara );
-
- if( !aKeyCode.IsShift() )
- {
- // ImpGetCursor again???
- if( !bSelection &&
- aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) )
- {
- sal_uLong nChilds = pOwner->pParaList->GetChildCount(pPara);
- if( nChilds && !pOwner->pParaList->HasVisibleChilds(pPara))
- {
- pOwner->UndoActionStart( OLUNDO_INSERT );
- sal_uLong nTemp = aSel.nEndPara;
- nTemp += nChilds;
- nTemp++; // insert above next Non-Child
- pOwner->Insert( String(),nTemp,pPara->GetDepth());
- // Position the cursor
- ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0);
- pEditView->SetSelection( aTmpSel );
- pEditView->ShowCursor( sal_True, sal_True );
- pOwner->UndoActionEnd( OLUNDO_INSERT );
- bKeyProcessed = sal_True;
- }
- }
- }
- if( !bKeyProcessed && !bSelection &&
- !aKeyCode.IsShift() && aKeyCode.IsMod1() &&
- ( aSel.nEndPos == pOwner->pEditEngine->GetTextLen(aSel.nEndPara) ) )
- {
- pOwner->UndoActionStart( OLUNDO_INSERT );
- sal_uLong nTemp = aSel.nEndPara;
- nTemp++;
- pOwner->Insert( String(), nTemp, pPara->GetDepth()+1 );
-
- // Position the cursor
- ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0);
- pEditView->SetSelection( aTmpSel );
- pEditView->ShowCursor( sal_True, sal_True );
- pOwner->UndoActionEnd( OLUNDO_INSERT );
- bKeyProcessed = sal_True;
- }
- }
- }
- break;
- }
- }
-
- return bKeyProcessed ? sal_True : pEditView->PostKeyEvent( rKEvt, pFrameWin );
-
-}
-
-
-sal_uLong OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTarget)
-{
- DBG_CHKTHIS(OutlinerView,0);
- sal_uLong nPara = EE_PARA_NOT_FOUND;
-
- Point aMousePosWin = pEditView->GetWindow()->PixelToLogic( rPosPix );
- if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
- {
- reTarget = MouseOutside;
- }
- else
- {
- reTarget = MouseText;
-
- Point aPaperPos( aMousePosWin );
- Rectangle aOutArea = pEditView->GetOutputArea();
- Rectangle aVisArea = pEditView->GetVisArea();
- aPaperPos.X() -= aOutArea.Left();
- aPaperPos.X() += aVisArea.Left();
- aPaperPos.Y() -= aOutArea.Top();
- aPaperPos.Y() += aVisArea.Top();
-
- sal_Bool bBullet;
- if ( pOwner->IsTextPos( aPaperPos, 0, &bBullet ) )
- {
- Point aDocPos = pOwner->GetDocPos( aPaperPos );
- nPara = pOwner->pEditEngine->FindParagraph( aDocPos.Y() );
-
- if ( bBullet )
- {
- reTarget = MouseBullet;
- }
- else
- {
- // Check for hyperlink
- const SvxFieldItem* pFieldItem = pEditView->GetField( aMousePosWin );
- if ( pFieldItem && pFieldItem->GetField() && pFieldItem->GetField()->ISA( SvxURLField ) )
- reTarget = MouseHypertext;
- }
- }
- }
- return nPara;
-}
-
-sal_Bool OutlinerView::MouseMove( const MouseEvent& rMEvt )
-{
- DBG_CHKTHIS(OutlinerView,0);
-
- if( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode())
- return pEditView->MouseMove( rMEvt );
-
- Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
- if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
- return sal_False;
-
- Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
- pEditView->GetWindow()->SetPointer( aPointer );
- return pEditView->MouseMove( rMEvt );
-}
-
-
-sal_Bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt )
-{
- DBG_CHKTHIS(OutlinerView,0);
- if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() )
- return pEditView->MouseButtonDown( rMEvt );
-
- Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
- if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
- return sal_False;
-
- Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
- pEditView->GetWindow()->SetPointer( aPointer );
-
- MouseTarget eTarget;
- sal_uLong nPara = ImpCheckMousePos( rMEvt.GetPosPixel(), eTarget );
- if ( eTarget == MouseBullet )
- {
- Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
- sal_Bool bHasChilds = (pPara && pOwner->pParaList->HasChilds(pPara));
- if( rMEvt.GetClicks() == 1 )
- {
- sal_uLong nEndPara = nPara;
- if ( bHasChilds && pOwner->pParaList->HasVisibleChilds(pPara) )
- nEndPara += pOwner->pParaList->GetChildCount( pPara );
- // The selection is inverted, so that EditEngine does not scroll
- ESelection aSel((sal_uInt16)nEndPara, 0xffff,(sal_uInt16)nPara, 0 );
- pEditView->SetSelection( aSel );
- }
- else if( rMEvt.GetClicks() == 2 && bHasChilds )
- ImpToggleExpand( pPara );
-
- aDDStartPosPix = rMEvt.GetPosPixel();
- aDDStartPosRef=pEditView->GetWindow()->PixelToLogic( aDDStartPosPix,pOwner->GetRefMapMode());
- return sal_True;
- }
-
- // special case for outliner view in impress, check if double click hits the page icon for toggle
- if( (nPara == EE_PARA_NOT_FOUND) && (pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEVIEW) && (eTarget == MouseText) && (rMEvt.GetClicks() == 2) )
- {
- ESelection aSel( pEditView->GetSelection() );
- nPara = aSel.nStartPara;
- Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
- if( (pPara && pOwner->pParaList->HasChilds(pPara)) && pPara->HasFlag(PARAFLAG_ISPAGE) )
- {
- ImpToggleExpand( pPara );
- }
- }
- return pEditView->MouseButtonDown( rMEvt );
-}
-
-
-sal_Bool OutlinerView::MouseButtonUp( const MouseEvent& rMEvt )
-{
- DBG_CHKTHIS(OutlinerView,0);
- if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() )
- return pEditView->MouseButtonUp( rMEvt );
-
- Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
- if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
- return sal_False;
-
- Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
- pEditView->GetWindow()->SetPointer( aPointer );
-
- return pEditView->MouseButtonUp( rMEvt );
-}
-
-void OutlinerView::ImpHideDDCursor()
-{
- DBG_CHKTHIS(OutlinerView,0);
- if ( bDDCursorVisible )
- {
- bDDCursorVisible = sal_False;
- ImpPaintDDCursor();
- }
-}
-
-void OutlinerView::ImpShowDDCursor()
-{
- DBG_CHKTHIS(OutlinerView,0);
- if ( !bDDCursorVisible )
- {
- bDDCursorVisible = sal_True;
- ImpPaintDDCursor();
- }
-}
-
-void OutlinerView::ImpPaintDDCursor()
-{
- DBG_CHKTHIS(OutlinerView,0);
-
- Window* pWindow = pEditView->GetWindow();
- RasterOp eOldOp = pWindow->GetRasterOp();
- pWindow->SetRasterOp( ROP_INVERT );
-
- const Color& rOldLineColor = pWindow->GetLineColor();
- pWindow->SetLineColor( Color( COL_BLACK ) );
-
- Point aStartPointWin, aEndPointWin;
- Rectangle aOutputArWin = pEditView->GetOutputArea();
-
- if( bDDChangingDepth )
- {
- aStartPointWin.X() = pHorTabArrDoc[ nDDCurDepth ];
- aStartPointWin.X() += aOutputArWin.Left();
- aStartPointWin.Y() = aOutputArWin.Top();
- aEndPointWin.X() = aStartPointWin.X();
- aEndPointWin.Y() = aOutputArWin.Bottom();
- }
- else
- {
- sal_uLong nPara = nDDCurPara;
- if ( nDDCurPara == LIST_APPEND )
- {
- Paragraph* pTemp = pOwner->pParaList->LastVisible();
- nPara = pOwner->pParaList->GetAbsPos( pTemp );
- }
- aStartPointWin = pEditView->GetWindowPosTopLeft((sal_uInt16) nPara );
- if ( nDDCurPara == LIST_APPEND )
- {
- long nHeight = pOwner->pEditEngine->GetTextHeight((sal_uInt16)nPara );
- aStartPointWin.Y() += nHeight;
- }
- aStartPointWin.X() = aOutputArWin.Left();
- aEndPointWin.Y() = aStartPointWin.Y();
- aEndPointWin.X() = aOutputArWin.Right();
- }
-
- pWindow->DrawLine( aStartPointWin, aEndPointWin );
- pWindow->SetLineColor( rOldLineColor );
- pWindow->SetRasterOp( eOldOp );
-}
-
-// Calculates above which paragraph must it must be inserted
-
-sal_uLong OutlinerView::ImpGetInsertionPara( const Point& rPosPixel )
-{
- DBG_CHKTHIS(OutlinerView,0);
- sal_uLong nCurPara = pEditView->GetParagraph( rPosPixel );
- ParagraphList* pParaList = pOwner->pParaList;
-
- if ( nCurPara == EE_PARA_NOT_FOUND )
- nCurPara = LIST_APPEND;
- else
- {
- Point aPosWin = pEditView->GetWindow()->PixelToLogic( rPosPixel );
- Point aParaPosWin = pEditView->GetWindowPosTopLeft((sal_uInt16)nCurPara);
- long nHeightRef = pOwner->pEditEngine->GetTextHeight((sal_uInt16)nCurPara);
- long nParaYOffs = aPosWin.Y() - aParaPosWin.Y();
-
- if ( nParaYOffs > nHeightRef / 2 )
- {
- Paragraph* p = pParaList->GetParagraph( nCurPara );
- p = pParaList->NextVisible( p );
- nCurPara = p ? pParaList->GetAbsPos( p ) : LIST_APPEND;
- }
- }
- return nCurPara;
-}
-
-
-void OutlinerView::ImpToggleExpand( Paragraph* pPara )
-{
- DBG_CHKTHIS(OutlinerView,0);
-
- sal_uInt16 nPara = (sal_uInt16) pOwner->pParaList->GetAbsPos( pPara );
- pEditView->SetSelection( ESelection( nPara, 0, nPara, 0 ) );
- ImplExpandOrCollaps( nPara, nPara, !pOwner->pParaList->HasVisibleChilds( pPara ) );
- pEditView->ShowCursor();
-}
-
-
-void OutlinerView::SetOutliner( Outliner* pOutliner )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pOwner = pOutliner;
- pEditView->SetEditEngine( pOutliner->pEditEngine );
-}
-
-
-
-sal_uLong OutlinerView::Select( Paragraph* pParagraph, sal_Bool bSelect,
- sal_Bool bWithChilds )
-{
- DBG_CHKTHIS(OutlinerView,0);
-
- sal_uLong nPara = pOwner->pParaList->GetAbsPos( pParagraph );
- sal_uInt16 nEnd = 0;
- if ( bSelect )
- nEnd = 0xffff;
-
- sal_uLong nChildCount = 0;
- if ( bWithChilds )
- nChildCount = pOwner->pParaList->GetChildCount( pParagraph );
-
- ESelection aSel( (sal_uInt16)nPara, 0,(sal_uInt16)(nPara+nChildCount), nEnd );
- pEditView->SetSelection( aSel );
- return nChildCount+1;
-}
-
-
-void OutlinerView::SetAttribs( const SfxItemSet& rAttrs )
-{
- DBG_CHKTHIS(OutlinerView,0);
-
- sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
- pOwner->pEditEngine->SetUpdateMode( sal_False );
-
- if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
- pOwner->UndoActionStart( OLUNDO_ATTR );
-
- ParaRange aSel = ImpGetSelectedParagraphs( sal_False );
-
- pEditView->SetAttribs( rAttrs );
-
- // Update Bullet text
- for( sal_uInt16 nPara= aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
- {
- pOwner->ImplCheckNumBulletItem( nPara );
- pOwner->ImplCalcBulletText( nPara, sal_False, sal_False );
-
- if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
- pOwner->InsertUndo( new OutlinerUndoCheckPara( pOwner, nPara ) );
- }
-
- if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
- pOwner->UndoActionEnd( OLUNDO_ATTR );
-
- pEditView->SetEditEngineUpdateMode( bUpdate );
-}
-
-ParaRange OutlinerView::ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChilds )
-{
- DBG_CHKTHIS( OutlinerView, 0 );
-
- ESelection aSel = pEditView->GetSelection();
- ParaRange aParas( aSel.nStartPara, aSel.nEndPara );
- aParas.Adjust();
-
- // Record the invisible Children of the last Parents in the selection
- if ( bIncludeHiddenChilds )
- {
- Paragraph* pLast = pOwner->pParaList->GetParagraph( aParas.nEndPara );
- if ( pOwner->pParaList->HasHiddenChilds( pLast ) )
- aParas.nEndPara =
- sal::static_int_cast< sal_uInt16 >(
- aParas.nEndPara +
- pOwner->pParaList->GetChildCount( pLast ) );
- }
- return aParas;
-}
-
-// TODO: Name should be changed!
-void OutlinerView::AdjustDepth( short nDX )
-{
- Indent( nDX );
-}
-
-void OutlinerView::Indent( short nDiff )
-{
- DBG_CHKTHIS( OutlinerView, 0 );
-
- if( !nDiff || ( ( nDiff > 0 ) && ImpCalcSelectedPages( sal_True ) && !pOwner->ImpCanIndentSelectedPages( this ) ) )
- return;
-
- const bool bOutlinerView = pOwner->pEditEngine->GetControlWord() & EE_CNTRL_OUTLINER;
- sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
- pOwner->pEditEngine->SetUpdateMode( sal_False );
-
- sal_Bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
-
- if( bUndo )
- pOwner->UndoActionStart( OLUNDO_DEPTH );
-
- 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++ )
- {
- Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
-
- sal_Int16 nOldDepth = pPara->GetDepth();
- sal_Int16 nNewDepth = nOldDepth + nDiff;
-
- if( bOutlinerView && nPara )
- {
- const bool bPage = pPara->HasFlag(PARAFLAG_ISPAGE);
- if( (bPage && (nDiff == +1)) || (!bPage && (nDiff == -1) && (nOldDepth <= 0)) )
- {
- // Notify App
- pOwner->nDepthChangedHdlPrevDepth = (sal_Int16)nOldDepth;
- pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags;
- pOwner->pHdlParagraph = pPara;
-
- if( bPage )
- pPara->RemoveFlag( PARAFLAG_ISPAGE );
- else
- pPara->SetFlag( PARAFLAG_ISPAGE );
-
- pOwner->DepthChangedHdl();
- pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) );
-
- if( bUndo )
- pOwner->InsertUndo( new OutlinerUndoChangeParaFlags( pOwner, nPara, pOwner->mnDepthChangeHdlPrevFlags, pPara->nFlags ) );
-
- continue;
- }
- }
-
- // do not switch off numeration with tab
- if( (nOldDepth == 0) && (nNewDepth == -1) )
- continue;
-
- // do not indent if there is no numeration enabled
- if( nOldDepth == -1 )
- continue;
-
- if ( nNewDepth < pOwner->nMinDepth )
- nNewDepth = pOwner->nMinDepth;
- if ( nNewDepth > pOwner->nMaxDepth )
- nNewDepth = pOwner->nMaxDepth;
-
- if( nOldDepth < nMinDepth )
- nMinDepth = nOldDepth;
- if( nNewDepth < nMinDepth )
- nMinDepth = nNewDepth;
-
- if( nOldDepth != nNewDepth )
- {
- if ( ( nPara == aSel.nStartPara ) && aSel.nStartPara && ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ))
- {
- // 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 ?!");
-#endif
- Paragraph* pPrev= pOwner->pParaList->GetParagraph( aSel.nStartPara-1 );
-
- if( !pPrev->IsVisible() && ( pPrev->GetDepth() == nNewDepth ) )
- {
- // 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 );
-
- pOwner->Expand( pPrev );
- pOwner->InvalidateBullet( pPrev, pOwner->pParaList->GetAbsPos( pPrev ) );
- }
- }
-
- pOwner->nDepthChangedHdlPrevDepth = (sal_Int16)nOldDepth;
- pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags;
- pOwner->pHdlParagraph = pPara;
-
- pOwner->ImplInitDepth( nPara, nNewDepth, sal_True, sal_False );
- pOwner->ImplCalcBulletText( nPara, sal_False, sal_False );
-
- if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
- pOwner->ImplSetLevelDependendStyleSheet( nPara );
-
- // Notify App
- pOwner->DepthChangedHdl();
- }
- else
- {
- // Needs at least a repaint...
- pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) );
- }
- }
-
- sal_uInt16 nParas = (sal_uInt16)pOwner->pParaList->GetParagraphCount();
- for ( sal_uInt16 n = aSel.nEndPara+1; n < nParas; n++ )
- {
- Paragraph* pPara = pOwner->pParaList->GetParagraph( n );
- if ( pPara->GetDepth() < nMinDepth )
- break;
- pOwner->ImplCalcBulletText( n, sal_False, sal_False );
- }
-
- if ( bUpdate )
- {
- pEditView->SetEditEngineUpdateMode( sal_True );
- pEditView->ShowCursor();
- }
-
- if( bUndo )
- pOwner->UndoActionEnd( OLUNDO_DEPTH );
-}
-
-sal_Bool OutlinerView::AdjustHeight( long nDY )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->MoveParagraphs( nDY );
- return sal_True; // remove return value...
-}
-
-void OutlinerView::AdjustDepth( Paragraph* pPara, short nDX, sal_Bool bWithChilds)
-{
- DBG_CHKTHIS(OutlinerView,0);
- sal_uLong nStartPara = pOwner->pParaList->GetAbsPos( pPara );
- sal_uLong nEndPara = nStartPara;
- if ( bWithChilds )
- nEndPara += pOwner->pParaList->GetChildCount( pPara );
- ESelection aSel((sal_uInt16)nStartPara, 0,(sal_uInt16)nEndPara, 0xffff );
- pEditView->SetSelection( aSel );
- AdjustDepth( nDX );
-}
-
-void OutlinerView::AdjustHeight( Paragraph* pPara, long nDY, sal_Bool bWithChilds )
-{
- DBG_CHKTHIS(OutlinerView,0);
- sal_uLong nStartPara = pOwner->pParaList->GetAbsPos( pPara );
- sal_uLong nEndPara = nStartPara;
- if ( bWithChilds )
- nEndPara += pOwner->pParaList->GetChildCount( pPara );
- ESelection aSel( (sal_uInt16)nStartPara, 0, (sal_uInt16)nEndPara, 0xffff );
- pEditView->SetSelection( aSel );
- AdjustHeight( nDY );
-}
-
-
-Rectangle OutlinerView::GetVisArea() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetVisArea();
-}
-
-
-Point OutlinerView::ImpGetDocPos( const Point& rPosPixel )
-{
- DBG_CHKTHIS(OutlinerView,0);
- Rectangle aOutArWin = GetOutputArea();
- // Calculate position in the OutputArea
- Point aCurPosDoc( rPosPixel );
- aCurPosDoc = pEditView->GetWindow()->PixelToLogic( aCurPosDoc );
- aCurPosDoc -= aOutArWin.TopLeft();
- aCurPosDoc += pEditView->GetVisArea().TopLeft();
- return aCurPosDoc;
-}
-
-void OutlinerView::ImpDragScroll( const Point& rPosPix )
-{
- DBG_CHKTHIS(OutlinerView,0);
- Point aPosWin = pEditView->GetWindow()->PixelToLogic( rPosPix );
- Rectangle aOutputArWin = pEditView->GetOutputArea();
- if ( aPosWin.X() <= aOutputArWin.Left() + nDDScrollLRBorderWidthWin)
- ImpScrollLeft();
- else if( aPosWin.X() >= aOutputArWin.Right()- nDDScrollLRBorderWidthWin)
- ImpScrollRight();
- else if( aPosWin.Y() <= aOutputArWin.Top() + nDDScrollTBBorderWidthWin)
- ImpScrollUp();
- else if(aPosWin.Y() >= aOutputArWin.Bottom() - nDDScrollTBBorderWidthWin)
- ImpScrollDown();
-}
-
-
-void OutlinerView::ImpScrollLeft()
-{
- DBG_CHKTHIS(OutlinerView,0);
- Rectangle aVisArea( pEditView->GetVisArea() );
- long nMaxScrollOffs = aVisArea.Left();
- if ( !nMaxScrollOffs )
- return;
- long nScrollOffsRef = (aVisArea.GetWidth() * OL_SCROLL_HOROFFSET) / 100;
- if ( !nScrollOffsRef )
- nScrollOffsRef = 1;
- if ( nScrollOffsRef > nMaxScrollOffs )
- nScrollOffsRef = nMaxScrollOffs;
-
- ImpHideDDCursor();
- Scroll( -nScrollOffsRef, 0 );
-
- EditStatus aScrollStat;
- aScrollStat.GetStatusWord() = EE_STAT_HSCROLL;
- pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat );
-}
-
-
-void OutlinerView::ImpScrollRight()
-{
- DBG_CHKTHIS(OutlinerView,0);
- Rectangle aVisArea( pEditView->GetVisArea() );
- long nMaxScrollOffs = pOwner->pEditEngine->GetPaperSize().Width() -
- aVisArea.Right();
- if ( !nMaxScrollOffs )
- return;
- long nScrollOffsRef = (aVisArea.GetWidth() * OL_SCROLL_HOROFFSET) / 100;
- if ( !nScrollOffsRef )
- nScrollOffsRef = 1;
- if ( nScrollOffsRef > nMaxScrollOffs )
- nScrollOffsRef = nMaxScrollOffs;
-
- ImpHideDDCursor();
- Scroll( nScrollOffsRef, 0 );
-
- EditStatus aScrollStat;
- aScrollStat.GetStatusWord() = EE_STAT_HSCROLL;
- pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat );
-}
-
-
-void OutlinerView::ImpScrollDown()
-{
- DBG_CHKTHIS(OutlinerView,0);
- Rectangle aVisArea( pEditView->GetVisArea() );
- Size aDocSize( 0, (long)pOwner->pEditEngine->GetTextHeight() );
-
- long nMaxScrollOffs = aDocSize.Height();
- nMaxScrollOffs -= aVisArea.Top();
- nMaxScrollOffs -= aVisArea.GetHeight();
- if ( !nMaxScrollOffs )
- return;
-
- long nScrollOffsRef = (aVisArea.GetHeight() * OL_SCROLL_VEROFFSET) / 100;
-
- if ( nScrollOffsRef > nMaxScrollOffs )
- nScrollOffsRef = nMaxScrollOffs;
- if ( !nScrollOffsRef )
- nScrollOffsRef = 1;
-
- ImpHideDDCursor();
- Scroll( 0, -nScrollOffsRef );
-
- EditStatus aScrollStat;
- aScrollStat.GetStatusWord() = EE_STAT_VSCROLL;
- pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat );
-}
-
-
-void OutlinerView::ImpScrollUp()
-{
- DBG_CHKTHIS(OutlinerView,0);
- Rectangle aVisArea( pEditView->GetVisArea() );
- long nMaxScrollOffs = aVisArea.Top();
- if ( !nMaxScrollOffs )
- return;
- long nScrollOffsRef = (aVisArea.GetHeight() * OL_SCROLL_VEROFFSET) / 100;
-
-
- if ( nScrollOffsRef > nMaxScrollOffs )
- nScrollOffsRef = nMaxScrollOffs;
- if ( !nScrollOffsRef )
- nScrollOffsRef = 1;
-
- ImpHideDDCursor();
- Scroll( 0, nScrollOffsRef );
-
- EditStatus aScrollStat;
- aScrollStat.GetStatusWord() = EE_STAT_VSCROLL;
- pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat );
-}
-
-
-void OutlinerView::Expand()
-{
- DBG_CHKTHIS( OutlinerView, 0 );
- ParaRange aParas = ImpGetSelectedParagraphs( sal_False );
- ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, sal_True );
-}
-
-
-void OutlinerView::Collapse()
-{
- DBG_CHKTHIS( OutlinerView, 0 );
- ParaRange aParas = ImpGetSelectedParagraphs( sal_False );
- ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, sal_False );
-}
-
-
-void OutlinerView::ExpandAll()
-{
- DBG_CHKTHIS( OutlinerView, 0 );
- ImplExpandOrCollaps( 0, (sal_uInt16)(pOwner->pParaList->GetParagraphCount()-1), sal_True );
-}
-
-
-void OutlinerView::CollapseAll()
-{
- DBG_CHKTHIS(OutlinerView,0);
- ImplExpandOrCollaps( 0, (sal_uInt16)(pOwner->pParaList->GetParagraphCount()-1), sal_False );
-}
-
-void OutlinerView::ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand )
-{
- DBG_CHKTHIS( OutlinerView, 0 );
-
- sal_Bool bUpdate = pOwner->GetUpdateMode();
- pOwner->SetUpdateMode( sal_False );
-
- sal_Bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
- if( bUndo )
- pOwner->UndoActionStart( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE );
-
- for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ )
- {
- Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
- sal_Bool bDone = bExpand ? pOwner->Expand( pPara ) : pOwner->Collapse( pPara );
- if( bDone )
- {
- // The line under the paragraph should disappear ...
- pOwner->pEditEngine->QuickMarkToBeRepainted( nPara );
- }
- }
-
- if( bUndo )
- pOwner->UndoActionEnd( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE );
-
- if ( bUpdate )
- {
- pOwner->SetUpdateMode( sal_True );
- pEditView->ShowCursor();
- }
-}
-
-
-void OutlinerView::Expand( Paragraph* pPara)
-{
- DBG_CHKTHIS(OutlinerView,0);
- pOwner->Expand( pPara );
-}
-
-
-void OutlinerView::Collapse( Paragraph* pPara)
-{
- DBG_CHKTHIS(OutlinerView,0);
- pOwner->Collapse( pPara );
-}
-
-void OutlinerView::InsertText( const OutlinerParaObject& rParaObj )
-{
- // Like Paste, only EditView::Insert, instead of EditView::Paste.
- // Actually not quite true that possible indentations must be corrected,
- // but that comes later by a universal import. The indentation level is
- // then determined right in the Inserted method.
- // Possible structure:
- // pImportInfo with DestPara, DestPos, nFormat, pParaObj...
- // Possibly problematic:
- // EditEngine, RTF => Splitting the area, later join together.
-
- DBG_CHKTHIS(OutlinerView,0);
-
- if ( ImpCalcSelectedPages( sal_False ) && !pOwner->ImpCanDeleteSelectedPages( this ) )
- return;
-
- pOwner->UndoActionStart( OLUNDO_INSERT );
-
- pOwner->pEditEngine->SetUpdateMode( sal_False );
- sal_uLong nStart, nParaCount;
- nParaCount = pOwner->pEditEngine->GetParagraphCount();
- sal_uInt16 nSize = ImpInitPaste( nStart );
- pEditView->InsertText( rParaObj.GetTextObject() );
- ImpPasted( nStart, nParaCount, nSize);
- pEditView->SetEditEngineUpdateMode( sal_True );
-
- pOwner->UndoActionEnd( OLUNDO_INSERT );
-
- pEditView->ShowCursor( sal_True, sal_True );
-}
-
-
-
-void OutlinerView::Cut()
-{
- DBG_CHKTHIS(OutlinerView,0);
- if ( !ImpCalcSelectedPages( sal_False ) || pOwner->ImpCanDeleteSelectedPages( this ) )
- pEditView->Cut();
-}
-
-void OutlinerView::Paste()
-{
- DBG_CHKTHIS(OutlinerView,0);
- PasteSpecial(); // HACK(SD does not call PasteSpecial)
-}
-
-void OutlinerView::PasteSpecial()
-{
- DBG_CHKTHIS(OutlinerView,0);
- if ( !ImpCalcSelectedPages( sal_False ) || pOwner->ImpCanDeleteSelectedPages( this ) )
- {
- pOwner->UndoActionStart( OLUNDO_INSERT );
-
- pOwner->pEditEngine->SetUpdateMode( sal_False );
- pOwner->bPasting = sal_True;
- pEditView->PasteSpecial();
-
- if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
- {
- const sal_uInt16 nParaCount = pOwner->pEditEngine->GetParagraphCount();
-
- for( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ )
- pOwner->ImplSetLevelDependendStyleSheet( nPara );
- }
-
- pEditView->SetEditEngineUpdateMode( sal_True );
- pOwner->UndoActionEnd( OLUNDO_INSERT );
- pEditView->ShowCursor( sal_True, sal_True );
- }
-}
-
-void OutlinerView::CreateSelectionList (std::vector<Paragraph*> &aSelList)
-{
- DBG_CHKTHIS( OutlinerView, 0 );
-
- ParaRange aParas = ImpGetSelectedParagraphs( sal_True );
-
- for ( sal_uInt16 nPara = aParas.nStartPara; nPara <= aParas.nEndPara; nPara++ )
- {
- Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
- aSelList.push_back(pPara);
- }
-}
-
-SfxStyleSheet* OutlinerView::GetStyleSheet() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetStyleSheet();
-}
-
-void OutlinerView::SetStyleSheet( SfxStyleSheet* pStyle )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->SetStyleSheet( pStyle );
-
- ParaRange aSel = ImpGetSelectedParagraphs( sal_True );
- for( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
- {
- pOwner->ImplCheckNumBulletItem( nPara );
- pOwner->ImplCalcBulletText( nPara, sal_False, sal_False );
- }
-}
-
-Pointer OutlinerView::GetPointer( const Point& rPosPixel )
-{
- DBG_CHKTHIS(OutlinerView,0);
-
- MouseTarget eTarget;
- ImpCheckMousePos( rPosPixel, eTarget );
-
- PointerStyle ePointerStyle = POINTER_ARROW;
- if ( eTarget == MouseText )
- {
- ePointerStyle = GetOutliner()->IsVertical() ? POINTER_TEXT_VERTICAL : POINTER_TEXT;
- }
- else if ( eTarget == MouseHypertext )
- {
- ePointerStyle = POINTER_REFHAND;
- }
- else if ( eTarget == MouseBullet )
- {
- ePointerStyle = POINTER_MOVE;
- }
-
- return Pointer( ePointerStyle );
-}
-
-
-sal_uInt16 OutlinerView::ImpInitPaste( sal_uLong& rStart )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pOwner->bPasting = sal_True;
- ESelection aSelection( pEditView->GetSelection() );
- aSelection.Adjust();
- rStart = aSelection.nStartPara;
- sal_uInt16 nSize = aSelection.nEndPara - aSelection.nStartPara + 1;
- return nSize;
-}
-
-
-void OutlinerView::ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize)
-{
- DBG_CHKTHIS(OutlinerView,0);
- pOwner->bPasting = sal_False;
- sal_uLong nCurParaCount = (sal_uLong)pOwner->pEditEngine->GetParagraphCount();
- if( nCurParaCount < nPrevParaCount )
- nSize = sal::static_int_cast< sal_uInt16 >(
- nSize - ( nPrevParaCount - nCurParaCount ) );
- else
- nSize = sal::static_int_cast< sal_uInt16 >(
- nSize + ( nCurParaCount - nPrevParaCount ) );
- pOwner->ImpTextPasted( nStart, nSize );
-}
-
-
-void OutlinerView::Command( const CommandEvent& rCEvt )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->Command( rCEvt );
-}
-
-
-void OutlinerView::SelectRange( sal_uLong nFirst, sal_uInt16 nCount )
-{
- DBG_CHKTHIS(OutlinerView,0);
- sal_uLong nLast = nFirst+nCount;
- nCount = (sal_uInt16)pOwner->pParaList->GetParagraphCount();
- if( nLast <= nCount )
- nLast = nCount - 1;
- ESelection aSel( (sal_uInt16)nFirst, 0, (sal_uInt16)nLast, 0xffff );
- pEditView->SetSelection( aSel );
-}
-
-
-sal_uInt16 OutlinerView::ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected )
-{
- DBG_CHKTHIS(OutlinerView,0);
-
- ESelection aSel( pEditView->GetSelection() );
- aSel.Adjust();
-
- sal_uInt16 nPages = 0;
- sal_uInt16 nFirstPage = 0xFFFF;
- sal_uInt16 nStartPara = aSel.nStartPara;
- if ( !bIncludeFirstSelected )
- 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: invalid Selection? ");
- if( pPara->HasFlag(PARAFLAG_ISPAGE) )
- {
- nPages++;
- if( nFirstPage == 0xFFFF )
- nFirstPage = nPara;
- }
- }
-
- if( nPages )
- {
- pOwner->nDepthChangedHdlPrevDepth = nPages;
- pOwner->pHdlParagraph = 0;
- pOwner->mnFirstSelPage = nFirstPage;
- }
-
- return nPages;
-}
-
-
-void OutlinerView::ToggleBullets()
-{
- pOwner->UndoActionStart( OLUNDO_DEPTH );
-
- ESelection aSel( pEditView->GetSelection() );
- aSel.Adjust();
-
- const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
- pOwner->pEditEngine->SetUpdateMode( sal_False );
-
- sal_Int16 nDepth = -2;
-
- for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
- {
- Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
- DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
-
- if( pPara )
- {
- if( nDepth == -2 )
- nDepth = (pOwner->GetDepth(nPara) == -1) ? 0 : -1;
-
- pOwner->SetDepth( pPara, nDepth );
-
- if( nDepth == -1 )
- {
- const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
- if(rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET)
- {
- SfxItemSet aAttrs(rAttrs);
- aAttrs.ClearItem( EE_PARA_BULLETSTATE );
- pOwner->SetParaAttribs( nPara, aAttrs );
- }
- }
- }
- }
-
- // #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 ) );
-
- pOwner->pEditEngine->SetUpdateMode( bUpdate );
-
- pOwner->UndoActionEnd( OLUNDO_DEPTH );
-}
-
-void OutlinerView::EnableBullets()
-{
- pOwner->UndoActionStart( OLUNDO_DEPTH );
-
- ESelection aSel( pEditView->GetSelection() );
- aSel.Adjust();
-
- const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
- pOwner->pEditEngine->SetUpdateMode( sal_False );
-
- for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
- {
- Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
- DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
-
- if( pPara && (pOwner->GetDepth(nPara) == -1) )
- {
- pOwner->SetDepth( pPara, 0 );
- }
- }
-
- // #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 ) );
-
- pOwner->pEditEngine->SetUpdateMode( bUpdate );
-
- pOwner->UndoActionEnd( OLUNDO_DEPTH );
-}
-
-
-void OutlinerView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs )
-{
- RemoveAttribs( bRemoveParaAttribs, 0, sal_True /*keep language attribs*/ );
-}
-
-void OutlinerView::RemoveAttribs( sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich, sal_Bool bKeepLanguages )
-{
- DBG_CHKTHIS(OutlinerView,0);
- sal_Bool bUpdate = pOwner->GetUpdateMode();
- pOwner->SetUpdateMode( sal_False );
- pOwner->UndoActionStart( OLUNDO_ATTR );
- if (bKeepLanguages)
- pEditView->RemoveAttribsKeepLanguages( bRemoveParaAttribs );
- else
- pEditView->RemoveAttribs( bRemoveParaAttribs, nWhich );
- if ( bRemoveParaAttribs )
- {
- // 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++ )
- {
- Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
- pOwner->ImplInitDepth( nPara, pPara->GetDepth(), sal_False, sal_False );
- }
- }
- pOwner->UndoActionEnd( OLUNDO_ATTR );
- pOwner->SetUpdateMode( bUpdate );
-}
-
-
-
-// ======================================================================
-// ====================== Simple pass-through =======================
-// ======================================================================
-
-
-void OutlinerView::InsertText( const XubString& rNew, sal_Bool bSelect )
-{
- DBG_CHKTHIS(OutlinerView,0);
- if( pOwner->bFirstParaIsEmpty )
- pOwner->Insert( String() );
- pEditView->InsertText( rNew, bSelect );
-}
-
-void OutlinerView::SetVisArea( const Rectangle& rRec )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->SetVisArea( rRec );
-}
-
-
-void OutlinerView::SetSelection( const ESelection& rSel )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->SetSelection( rSel );
-}
-
-void OutlinerView::SetReadOnly( sal_Bool bReadOnly )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->SetReadOnly( bReadOnly );
-}
-
-sal_Bool OutlinerView::IsReadOnly() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->IsReadOnly();
-}
-
-sal_Bool OutlinerView::HasSelection() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->HasSelection();
-}
-
-
-void OutlinerView::ShowCursor( sal_Bool bGotoCursor )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->ShowCursor( bGotoCursor );
-}
-
-
-void OutlinerView::HideCursor()
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->HideCursor();
-}
-
-
-void OutlinerView::SetWindow( Window* pWin )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->SetWindow( pWin );
-}
-
-
-Window* OutlinerView::GetWindow() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetWindow();
-}
-
-
-void OutlinerView::SetOutputArea( const Rectangle& rRect )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->SetOutputArea( rRect );
-}
-
-
-Rectangle OutlinerView::GetOutputArea() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetOutputArea();
-}
-
-
-XubString OutlinerView::GetSelected() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetSelected();
-}
-
-
-void OutlinerView::RemoveCharAttribs( sal_uLong nPara, sal_uInt16 nWhich)
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->RemoveCharAttribs( (sal_uInt16)nPara, nWhich);
-}
-
-
-void OutlinerView::CompleteAutoCorrect()
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->CompleteAutoCorrect();
-}
-
-
-EESpellState OutlinerView::StartSpeller( sal_Bool bMultiDoc )
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->StartSpeller( bMultiDoc );
-}
-
-
-EESpellState OutlinerView::StartThesaurus()
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->StartThesaurus();
-}
-
-
-void OutlinerView::StartTextConversion(
- LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont,
- sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc )
-{
- DBG_CHKTHIS(OutlinerView,0);
- if (
- (LANGUAGE_KOREAN == nSrcLang && LANGUAGE_KOREAN == nDestLang) ||
- (LANGUAGE_CHINESE_SIMPLIFIED == nSrcLang && LANGUAGE_CHINESE_TRADITIONAL == nDestLang) ||
- (LANGUAGE_CHINESE_TRADITIONAL == nSrcLang && LANGUAGE_CHINESE_SIMPLIFIED == nDestLang)
- )
- {
- pEditView->StartTextConversion( nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc );
- }
- else
- {
- OSL_FAIL( "unexpected language" );
- }
-}
-
-
-sal_uInt16 OutlinerView::StartSearchAndReplace( const SvxSearchItem& rSearchItem )
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->StartSearchAndReplace( rSearchItem );
-}
-
-void OutlinerView::TransliterateText( sal_Int32 nTransliterationMode )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->TransliterateText( nTransliterationMode );
-}
-
-
-
-ESelection OutlinerView::GetSelection()
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetSelection();
-}
-
-
-void OutlinerView::Scroll( long nHorzScroll, long nVertScroll )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->Scroll( nHorzScroll, nVertScroll );
-}
-
-
-void OutlinerView::SetControlWord( sal_uLong nWord )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->SetControlWord( nWord );
-}
-
-
-sal_uLong OutlinerView::GetControlWord() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetControlWord();
-}
-
-
-void OutlinerView::SetAnchorMode( EVAnchorMode eMode )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->SetAnchorMode( eMode );
-}
-
-
-EVAnchorMode OutlinerView::GetAnchorMode() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetAnchorMode();
-}
-
-
-void OutlinerView::Undo()
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->Undo();
-}
-
-
-void OutlinerView::Redo()
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->Redo();
-}
-
-
-void OutlinerView::EnablePaste( sal_Bool bEnable )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->EnablePaste( bEnable );
-}
-
-
-void OutlinerView::Copy()
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->Copy();
-}
-
-
-void OutlinerView::InsertField( const SvxFieldItem& rFld )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->InsertField( rFld );
-}
-
-
-const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetFieldUnderMousePointer();
-}
-
-
-const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer( sal_uInt16& nPara, sal_uInt16& nPos ) const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetFieldUnderMousePointer( nPara, nPos );
-}
-
-
-const SvxFieldItem* OutlinerView::GetFieldAtSelection() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetFieldAtSelection();
-}
-
-void OutlinerView::SetInvalidateMore( sal_uInt16 nPixel )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->SetInvalidateMore( nPixel );
-}
-
-
-sal_uInt16 OutlinerView::GetInvalidateMore() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetInvalidateMore();
-}
-
-
-sal_Bool OutlinerView::IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong )
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->IsCursorAtWrongSpelledWord( bMarkIfWrong );
-}
-
-
-sal_Bool OutlinerView::IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong )
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->IsWrongSpelledWordAtPos( rPosPixel, bMarkIfWrong );
-}
-
-
-void OutlinerView::SpellIgnoreWord()
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->SpellIgnoreWord();
-}
-
-
-void OutlinerView::ExecuteSpellPopup( const Point& rPosPixel, Link* pStartDlg )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->ExecuteSpellPopup( rPosPixel, pStartDlg );
-}
-
-sal_uLong OutlinerView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect, SvKeyValueIterator* pHTTPHeaderAttrs )
-{
- DBG_CHKTHIS(OutlinerView,0);
- sal_uInt16 nOldParaCount = pEditView->GetEditEngine()->GetParagraphCount();
- ESelection aOldSel = pEditView->GetSelection();
- aOldSel.Adjust();
-
- sal_uLong nRet = pEditView->Read( rInput, rBaseURL, eFormat, bSelect, pHTTPHeaderAttrs );
-
- 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));
-
- for ( sal_uInt16 n = nChangesStart; n <= nChangesEnd; n++ )
- {
- if ( eFormat == EE_FORMAT_BIN )
- {
- sal_uInt16 nDepth = 0;
- const SfxItemSet& rAttrs = pOwner->GetParaAttribs( n );
- const SfxInt16Item& rLevel = (const SfxInt16Item&) rAttrs.Get( EE_PARA_OUTLLEVEL );
- nDepth = rLevel.GetValue();
- pOwner->ImplInitDepth( n, nDepth, sal_False );
- }
-
- if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
- pOwner->ImplSetLevelDependendStyleSheet( n );
- }
-
- if ( eFormat != EE_FORMAT_BIN )
- {
- pOwner->ImpFilterIndents( nChangesStart, nChangesEnd );
- }
-
- return nRet;
-}
-
-void OutlinerView::SetBackgroundColor( const Color& rColor )
-{
- DBG_CHKTHIS(OutlinerView,0);
- pEditView->SetBackgroundColor( rColor );
-}
-
-
-Color OutlinerView::GetBackgroundColor()
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetBackgroundColor();
-}
-
-SfxItemSet OutlinerView::GetAttribs()
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetAttribs();
-}
-
-sal_uInt16 OutlinerView::GetSelectedScriptType() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetSelectedScriptType();
-}
-
-String OutlinerView::GetSurroundingText() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetSurroundingText();
-}
-
-Selection OutlinerView::GetSurroundingTextSelection() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetSurroundingTextSelection();
-}
-
-
-// ======================================================================
-// ===== some code for thesaurus sub menu within context menu
-// ======================================================================
-
-// returns: true if a word for thesaurus look-up was found at the current cursor position.
-// The status string will be word + iso language string (e.g. "light#en-US")
-bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext(
- String &rStatusVal,
- LanguageType &rLang,
- const EditView &rEditView )
-{
- // get text and locale for thesaurus look up
- String aText;
- EditEngine *pEditEngine = rEditView.GetEditEngine();
- ESelection aTextSel( rEditView.GetSelection() );
- if (!aTextSel.HasRange())
- aTextSel = pEditEngine->GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD );
- aText = pEditEngine->GetText( aTextSel );
- aTextSel.Adjust();
- LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos );
- String aLangText( MsLangId::convertLanguageToIsoString( nLang ) );
-
- // set word and locale to look up as status value
- String aStatusVal( aText );
- aStatusVal.AppendAscii( "#" );
- aStatusVal += aLangText;
-
- rStatusVal = aStatusVal;
- rLang = nLang;
-
- return aText.Len() > 0;
-}
-
-
-void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText )
-{
- // get selection to use
- ESelection aCurSel( rEditView.GetSelection() );
- if (!rEditView.HasSelection())
- {
- // select the same word that was used in GetStatusValueForThesaurusFromContext by calling GetWord.
- // (In the end both functions will call ImpEditEngine::SelectWord)
- rEditView.SelectCurrentWord( i18n::WordType::DICTIONARY_WORD );
- aCurSel = rEditView.GetSelection();
- }
-
- // replace word ...
- rEditView.InsertText( rSynonmText );
- rEditView.ShowCursor( sal_True, sal_False );
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/outliner/paralist.cxx b/editeng/source/outliner/paralist.cxx
deleted file mode 100644
index c646710c4d..0000000000
--- a/editeng/source/outliner/paralist.cxx
+++ /dev/null
@@ -1,333 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <paralist.hxx>
-
-#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()
-: nDepth( -1 )
-, mnNumberingStartValue( -1 )
-, mbParaIsNumberingRestart( sal_False )
-{
-}
-
-ParagraphData::ParagraphData( const ParagraphData& r )
-: nDepth( r.nDepth )
-, mnNumberingStartValue( r.mnNumberingStartValue )
-, mbParaIsNumberingRestart( r.mbParaIsNumberingRestart )
-{
-}
-
-ParagraphData& ParagraphData::operator=( const ParagraphData& r)
-{
- nDepth = r.nDepth;
- mnNumberingStartValue = r.mnNumberingStartValue;
- mbParaIsNumberingRestart = r.mbParaIsNumberingRestart;
- return *this;
-}
-
-bool ParagraphData::operator==(const ParagraphData& rCandidate) const
-{
- return (nDepth == rCandidate.nDepth
- && mnNumberingStartValue == rCandidate.mnNumberingStartValue
- && mbParaIsNumberingRestart == rCandidate.mbParaIsNumberingRestart);
-}
-
-Paragraph::Paragraph( sal_Int16 nDDepth )
-: aBulSize( -1, -1)
-{
- DBG_CTOR( Paragraph, 0 );
-
- DBG_ASSERT( ( nDDepth >= -1 ) && ( nDDepth < SVX_MAX_NUM ), "Paragraph-CTOR: nDepth invalid!" );
-
- nDepth = nDDepth;
- nFlags = 0;
- bVisible = sal_True;
-}
-
-Paragraph::Paragraph( const Paragraph& rPara )
-: ParagraphData( rPara )
-, aBulText( rPara.aBulText )
-, aBulSize( rPara.aBulSize )
-{
- DBG_CTOR( Paragraph, 0 );
-
- nDepth = rPara.nDepth;
- nFlags = rPara.nFlags;
- bVisible = rPara.bVisible;
-}
-
-Paragraph::Paragraph( const ParagraphData& rData )
-: nFlags( 0 )
-, aBulSize( -1, -1)
-, bVisible( sal_True )
-{
- DBG_CTOR( Paragraph, 0 );
-
- nDepth = rData.nDepth;
- mnNumberingStartValue = rData.mnNumberingStartValue;
- mbParaIsNumberingRestart = rData.mbParaIsNumberingRestart;
-}
-
-Paragraph::~Paragraph()
-{
- DBG_DTOR( Paragraph, 0 );
-}
-
-void Paragraph::SetNumberingStartValue( sal_Int16 nNumberingStartValue )
-{
- mnNumberingStartValue = nNumberingStartValue;
- if( mnNumberingStartValue != -1 )
- mbParaIsNumberingRestart = true;
-}
-
-void Paragraph::SetParaIsNumberingRestart( sal_Bool bParaIsNumberingRestart )
-{
- mbParaIsNumberingRestart = bParaIsNumberingRestart;
- if( !mbParaIsNumberingRestart )
- mnNumberingStartValue = -1;
-}
-
-void ParagraphList::Clear( sal_Bool bDestroyParagraphs )
-{
- if ( bDestroyParagraphs )
- {
- std::vector<Paragraph*>::iterator iter;
- for (iter = maEntries.begin(); iter != maEntries.end(); ++iter)
- delete *iter;
- }
-
- 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 ) ) )
- {
- 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;
-
- std::vector<Paragraph*>::iterator iterIns = maEntries.begin() + nDest;
-
- std::copy(aParas.begin(),aParas.end(),std::inserter(maEntries,iterIns));
- }
- else
- {
- OSL_FAIL( "MoveParagraphs: Invalid Parameters" );
- }
-}
-
-Paragraph* ParagraphList::NextVisible( Paragraph* pPara ) const
-{
- std::vector<Paragraph*>::const_iterator iter = std::find(maEntries.begin(),
- maEntries.end(),
- pPara);
- for (; iter != maEntries.end(); ++iter)
- {
- if ((*iter)->IsVisible())
- break;
- }
-
- return iter != maEntries.end() ? *iter : NULL;
-}
-
-Paragraph* ParagraphList::PrevVisible( Paragraph* pPara ) const
-{
- std::vector<Paragraph*>::const_reverse_iterator iter = std::find(maEntries.rbegin(),
- maEntries.rend(),
- pPara);
- for (; iter != maEntries.rend(); ++iter)
- {
- if ((*iter)->IsVisible())
- break;
- }
-
- return iter != maEntries.rend() ? *iter : NULL;
-}
-
-Paragraph* ParagraphList::LastVisible() const
-{
- std::vector<Paragraph*>::const_reverse_iterator iter;
- for (iter = maEntries.rbegin(); iter != maEntries.rend(); ++iter)
- {
- if ((*iter)->IsVisible())
- break;
- }
-
- return iter != maEntries.rend() ? *iter : NULL;
-}
-
-sal_Bool ParagraphList::HasChilds( Paragraph* pParagraph ) const
-{
- sal_uLong n = GetAbsPos( pParagraph );
- Paragraph* pNext = GetParagraph( ++n );
- return ( pNext && ( pNext->GetDepth() > pParagraph->GetDepth() ) ) ? sal_True : sal_False;
-}
-
-sal_Bool ParagraphList::HasHiddenChilds( Paragraph* pParagraph ) const
-{
- sal_uLong n = GetAbsPos( pParagraph );
- Paragraph* pNext = GetParagraph( ++n );
- return ( pNext && ( pNext->GetDepth() > pParagraph->GetDepth() ) && !pNext->IsVisible() ) ? sal_True : sal_False;
-}
-
-sal_Bool ParagraphList::HasVisibleChilds( Paragraph* pParagraph ) const
-{
- sal_uLong n = GetAbsPos( pParagraph );
- Paragraph* pNext = GetParagraph( ++n );
- return ( pNext && ( pNext->GetDepth() > pParagraph->GetDepth() ) && pNext->IsVisible() ) ? sal_True : sal_False;
-}
-
-sal_uLong ParagraphList::GetChildCount( Paragraph* pParent ) const
-{
- sal_uLong nChildCount = 0;
- sal_uLong n = GetAbsPos( pParent );
- Paragraph* pPara = GetParagraph( ++n );
- while ( pPara && ( pPara->GetDepth() > pParent->GetDepth() ) )
- {
- nChildCount++;
- pPara = GetParagraph( ++n );
- }
- return nChildCount;
-}
-
-Paragraph* ParagraphList::GetParent( Paragraph* pParagraph /*, sal_uInt16& rRelPos */ ) const
-{
- /* rRelPos = 0 */;
- sal_uLong n = GetAbsPos( pParagraph );
- Paragraph* pPrev = GetParagraph( --n );
- while ( pPrev && ( pPrev->GetDepth() >= pParagraph->GetDepth() ) )
- {
-// if ( pPrev->GetDepth() == pParagraph->GetDepth() )
-// rRelPos++;
- pPrev = GetParagraph( --n );
- }
-
- return pPrev;
-}
-
-void ParagraphList::Expand( Paragraph* pParent )
-{
- sal_uLong nChildCount = GetChildCount( pParent );
- sal_uLong nPos = GetAbsPos( pParent );
-
- for ( sal_uLong n = 1; n <= nChildCount; n++ )
- {
- Paragraph* pPara = GetParagraph( nPos+n );
- if ( !( pPara->IsVisible() ) )
- {
- pPara->bVisible = sal_True;
- aVisibleStateChangedHdl.Call( pPara );
- }
- }
-}
-
-void ParagraphList::Collapse( Paragraph* pParent )
-{
- sal_uLong nChildCount = GetChildCount( pParent );
- sal_uLong nPos = GetAbsPos( pParent );
-
- for ( sal_uLong n = 1; n <= nChildCount; n++ )
- {
- Paragraph* pPara = GetParagraph( nPos+n );
- if ( pPara->IsVisible() )
- {
- pPara->bVisible = sal_False;
- aVisibleStateChangedHdl.Call( 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;
- std::vector<Paragraph*>::const_iterator iter;
- for (iter = maEntries.begin(); iter != maEntries.end(); ++iter, ++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
deleted file mode 100644
index f95ee37fd4..0000000000
--- a/editeng/source/outliner/paralist.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _PARALIST_HXX
-#define _PARALIST_HXX
-
-#include <vector>
-
-#include <tools/link.hxx>
-
-class Paragraph;
-
-class ParagraphList
-{
-public:
- void Clear( sal_Bool bDestroyParagraphs );
-
- sal_uInt32 GetParagraphCount() const
- {
- return maEntries.size();
- }
-
- Paragraph* GetParagraph( sal_uLong nPos ) const
- {
- return nPos < maEntries.size() ? maEntries[nPos] : NULL;
- }
-
- 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;
- Paragraph* PrevVisible( Paragraph* ) const;
- Paragraph* LastVisible() const;
-
- Paragraph* GetParent( Paragraph* pParagraph /*, sal_uInt16& rRelPos */ ) const;
- sal_Bool HasChilds( Paragraph* pParagraph ) const;
- sal_Bool HasHiddenChilds( Paragraph* pParagraph ) const;
- sal_Bool HasVisibleChilds( Paragraph* pParagraph ) const;
- sal_uLong GetChildCount( Paragraph* pParagraph ) const;
-
- void Expand( Paragraph* pParent );
- void Collapse( Paragraph* pParent );
-
- void SetVisibleStateChangedHdl( const Link& rLink ) { aVisibleStateChangedHdl = rLink; }
- Link GetVisibleStateChangedHdl() const { return aVisibleStateChangedHdl; }
-
-private:
-
- Link aVisibleStateChangedHdl;
- std::vector<Paragraph*> maEntries;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/rtf/rtfgrf.cxx b/editeng/source/rtf/rtfgrf.cxx
deleted file mode 100644
index 0ba18ab4ee..0000000000
--- a/editeng/source/rtf/rtfgrf.cxx
+++ /dev/null
@@ -1,548 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <boost/scoped_ptr.hpp>
-
-#include <osl/endian.h>
-#include <tools/cachestr.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/svapp.hxx>
-#include <svtools/rtfkeywd.hxx>
-#include <svtools/rtftoken.h>
-#include <svtools/filter.hxx>
-#include <svtools/wmf.hxx>
-
-#include <editeng/svxrtf.hxx>
-
-using namespace ::rtl;
-
-static sal_uInt8 aPal1[ 2 * 4 ] = {
- 0x00, 0x00, 0x00, 0x00, // Black
- 0xFF, 0xFF, 0xFF, 0x00 // White
-};
-
-static sal_uInt8 aPal4[ 16 * 4 ] = {
- 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x00, 0x00,
- 0x00, 0x80, 0x00, 0x00,
- 0x80, 0x80, 0x00, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x80, 0x00, 0x80, 0x00,
- 0x00, 0x80, 0x80, 0x00,
- 0x80, 0x80, 0x80, 0x00,
- 0xC0, 0xC0, 0xC0, 0x00,
- 0xFF, 0x00, 0x00, 0x00,
- 0x00, 0xFF, 0x00, 0x00,
- 0xFF, 0xFF, 0x00, 0x00,
- 0x00, 0x00, 0xFF, 0x00,
- 0xFF, 0x00, 0xFF, 0x00,
- 0x00, 0xFF, 0xFF, 0x00,
- 0xFF, 0xFF, 0xFF, 0x00
-};
-
-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,
-0x00, 0x92, 0xAA, 0x00, 0xC1, 0xC1, 0xC1, 0x00, 0xC9, 0xC9, 0xC9, 0x00,
-0xAA, 0xDB, 0xFF, 0x00, 0x00, 0x49, 0xAA, 0x00, 0x00, 0x49, 0xFF, 0x00,
-0x00, 0x6D, 0x00, 0x00, 0x00, 0x6D, 0x55, 0x00, 0x00, 0x6D, 0xAA, 0x00,
-0x00, 0x6D, 0xFF, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x92, 0x55, 0x00,
-0x00, 0x24, 0xAA, 0x00, 0x00, 0x92, 0xFF, 0x00, 0x00, 0xB6, 0x00, 0x00,
-0x00, 0xB6, 0x55, 0x00, 0x00, 0xB6, 0xAA, 0x00, 0x00, 0xB6, 0xFF, 0x00,
-0x00, 0xDB, 0x00, 0x00, 0x00, 0xDB, 0x55, 0x00, 0x00, 0xDB, 0xAA, 0x00,
-0x00, 0xDB, 0xFF, 0x00, 0xFF, 0xDB, 0xAA, 0x00, 0x00, 0xFF, 0x55, 0x00,
-0x00, 0xFF, 0xAA, 0x00, 0xFF, 0xFF, 0xAA, 0x00, 0x2B, 0x00, 0x00, 0x00,
-0x2B, 0x00, 0x55, 0x00, 0x2B, 0x00, 0xAA, 0x00, 0x2B, 0x00, 0xFF, 0x00,
-0x2B, 0x24, 0x00, 0x00, 0x2B, 0x24, 0x55, 0x00, 0x2B, 0x24, 0xAA, 0x00,
-0x2B, 0x24, 0xFF, 0x00, 0x2B, 0x49, 0x00, 0x00, 0x2B, 0x49, 0x55, 0x00,
-0x2B, 0x49, 0xAA, 0x00, 0x2B, 0x49, 0xFF, 0x00, 0x2B, 0x6D, 0x00, 0x00,
-0x2B, 0x6D, 0x55, 0x00, 0x2B, 0x6D, 0xAA, 0x00, 0x2B, 0x6D, 0xFF, 0x00,
-0x2B, 0x92, 0x00, 0x00, 0x2B, 0x92, 0x55, 0x00, 0x2B, 0x92, 0xAA, 0x00,
-0x2B, 0x92, 0xFF, 0x00, 0x2B, 0xB6, 0x00, 0x00, 0x2B, 0xB6, 0x55, 0x00,
-0x2B, 0xB6, 0xAA, 0x00, 0x2B, 0xB6, 0xFF, 0x00, 0x2B, 0xDB, 0x00, 0x00,
-0x2B, 0xDB, 0x55, 0x00, 0x2B, 0xDB, 0xAA, 0x00, 0x2B, 0xDB, 0xFF, 0x00,
-0x2B, 0xFF, 0x00, 0x00, 0x2B, 0xFF, 0x55, 0x00, 0x2B, 0xFF, 0xAA, 0x00,
-0x2B, 0xFF, 0xFF, 0x00, 0x55, 0x00, 0x00, 0x00, 0x55, 0x00, 0x55, 0x00,
-0x55, 0x00, 0xAA, 0x00, 0x55, 0x00, 0xFF, 0x00, 0x55, 0x24, 0x00, 0x00,
-0x55, 0x24, 0x55, 0x00, 0x55, 0x24, 0xAA, 0x00, 0x55, 0x24, 0xFF, 0x00,
-0x55, 0x49, 0x00, 0x00, 0x55, 0x49, 0x55, 0x00, 0x55, 0x49, 0xAA, 0x00,
-0x55, 0x49, 0xFF, 0x00, 0x55, 0x6D, 0x00, 0x00, 0x55, 0x6D, 0x55, 0x00,
-0x55, 0x6D, 0xAA, 0x00, 0x55, 0x6D, 0xFF, 0x00, 0x55, 0x92, 0x00, 0x00,
-0x55, 0x92, 0x55, 0x00, 0x55, 0x92, 0xAA, 0x00, 0x55, 0x92, 0xFF, 0x00,
-0x55, 0xB6, 0x00, 0x00, 0x55, 0xB6, 0x55, 0x00, 0x55, 0xB6, 0xAA, 0x00,
-0x55, 0xB6, 0xFF, 0x00, 0x55, 0xDB, 0x00, 0x00, 0x55, 0xDB, 0x55, 0x00,
-0x55, 0xDB, 0xAA, 0x00, 0x55, 0xDB, 0xFF, 0x00, 0x55, 0xFF, 0x00, 0x00,
-0x55, 0xFF, 0x55, 0x00, 0x55, 0xFF, 0xAA, 0x00, 0x55, 0xFF, 0xFF, 0x00,
-0x00, 0x00, 0x55, 0x00, 0x80, 0x00, 0x55, 0x00, 0x00, 0x24, 0x55, 0x00,
-0x80, 0x00, 0xFF, 0x00, 0x80, 0x24, 0x00, 0x00, 0x80, 0x24, 0x55, 0x00,
-0x80, 0x24, 0xAA, 0x00, 0x80, 0x24, 0xFF, 0x00, 0x80, 0x49, 0x00, 0x00,
-0x80, 0x49, 0x55, 0x00, 0x80, 0x49, 0xAA, 0x00, 0x80, 0x49, 0xFF, 0x00,
-0x80, 0x6D, 0x00, 0x00, 0x80, 0x6D, 0x55, 0x00, 0x80, 0x6D, 0xAA, 0x00,
-0x80, 0x6D, 0xFF, 0x00, 0x08, 0x08, 0x08, 0x00, 0x0F, 0x0F, 0x0F, 0x00,
-0x17, 0x17, 0x17, 0x00, 0x1F, 0x1F, 0x1F, 0x00, 0x27, 0x27, 0x27, 0x00,
-0x2E, 0x2E, 0x2E, 0x00, 0x36, 0x36, 0x36, 0x00, 0x3E, 0x3E, 0x3E, 0x00,
-0x46, 0x46, 0x46, 0x00, 0x4D, 0x4D, 0x4D, 0x00, 0x55, 0x55, 0x55, 0x00,
-0x5D, 0x5D, 0x5D, 0x00, 0x64, 0x64, 0x64, 0x00, 0x6C, 0x6C, 0x6C, 0x00,
-0x74, 0x74, 0x74, 0x00, 0x7C, 0x7C, 0x7C, 0x00, 0xFF, 0xDB, 0x00, 0x00,
-0x8B, 0x8B, 0x8B, 0x00, 0x93, 0x93, 0x93, 0x00, 0x9B, 0x9B, 0x9B, 0x00,
-0xFF, 0xB6, 0xFF, 0x00, 0xAA, 0xAA, 0xAA, 0x00, 0xB2, 0xB2, 0xB2, 0x00,
-0xB9, 0xB9, 0xB9, 0x00, 0x00, 0x24, 0xFF, 0x00, 0x00, 0x49, 0x00, 0x00,
-0xD1, 0xD1, 0xD1, 0x00, 0xD8, 0xD8, 0xD8, 0x00, 0xE0, 0xE0, 0xE0, 0x00,
-0xE8, 0xE8, 0xE8, 0x00, 0xF0, 0xF0, 0xF0, 0x00, 0xFF, 0xB6, 0xAA, 0x00,
-0xFF, 0xDB, 0xFF, 0x00, 0x80, 0x92, 0x55, 0x00, 0x80, 0x92, 0xAA, 0x00,
-0x80, 0x92, 0xFF, 0x00, 0x80, 0xB6, 0x00, 0x00, 0x80, 0xB6, 0x55, 0x00,
-0x80, 0xB6, 0xAA, 0x00, 0x80, 0xB6, 0xFF, 0x00, 0x80, 0xDB, 0x00, 0x00,
-0x80, 0xDB, 0x55, 0x00, 0x80, 0xDB, 0xAA, 0x00, 0x80, 0xDB, 0xFF, 0x00,
-0x80, 0xFF, 0x00, 0x00, 0x80, 0xFF, 0x55, 0x00, 0x80, 0xFF, 0xAA, 0x00,
-0x80, 0xFF, 0xFF, 0x00, 0xAA, 0x00, 0x00, 0x00, 0xAA, 0x00, 0x55, 0x00,
-0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0xFF, 0x00, 0xAA, 0x24, 0x00, 0x00,
-0xAA, 0x24, 0x55, 0x00, 0xAA, 0x24, 0xAA, 0x00, 0xAA, 0x24, 0xFF, 0x00,
-0xAA, 0x49, 0x00, 0x00, 0xAA, 0x49, 0x55, 0x00, 0xAA, 0x49, 0xAA, 0x00,
-0xAA, 0x49, 0xFF, 0x00, 0xAA, 0x6D, 0x00, 0x00, 0xAA, 0x6D, 0x55, 0x00,
-0xAA, 0x6D, 0xAA, 0x00, 0xAA, 0x6D, 0xFF, 0x00, 0xAA, 0x92, 0x00, 0x00,
-0xAA, 0x92, 0x55, 0x00, 0xAA, 0x92, 0xAA, 0x00, 0xAA, 0x92, 0xFF, 0x00,
-0xAA, 0xB6, 0x00, 0x00, 0xAA, 0xB6, 0x55, 0x00, 0xAA, 0xB6, 0xAA, 0x00,
-0xAA, 0xB6, 0xFF, 0x00, 0xAA, 0xDB, 0x00, 0x00, 0xAA, 0xDB, 0x55, 0x00,
-0xAA, 0xDB, 0xAA, 0x00, 0x00, 0x49, 0x55, 0x00, 0xAA, 0xFF, 0x00, 0x00,
-0xAA, 0xFF, 0x55, 0x00, 0xAA, 0xFF, 0xAA, 0x00, 0xAA, 0xFF, 0xFF, 0x00,
-0xD5, 0x00, 0x00, 0x00, 0xD5, 0x00, 0x55, 0x00, 0xD5, 0x00, 0xAA, 0x00,
-0xD5, 0x00, 0xFF, 0x00, 0xD5, 0x24, 0x00, 0x00, 0xD5, 0x24, 0x55, 0x00,
-0xD5, 0x24, 0xAA, 0x00, 0xD5, 0x24, 0xFF, 0x00, 0xD5, 0x49, 0x00, 0x00,
-0xD5, 0x49, 0x55, 0x00, 0xD5, 0x49, 0xAA, 0x00, 0xD5, 0x49, 0xFF, 0x00,
-0xD5, 0x6D, 0x00, 0x00, 0xD5, 0x6D, 0x55, 0x00, 0xD5, 0x6D, 0xAA, 0x00,
-0xD5, 0x6D, 0xFF, 0x00, 0xD5, 0x92, 0x00, 0x00, 0xD5, 0x92, 0x55, 0x00,
-0xD5, 0x92, 0xAA, 0x00, 0xD5, 0x92, 0xFF, 0x00, 0xD5, 0xB6, 0x00, 0x00,
-0xD5, 0xB6, 0x55, 0x00, 0xD5, 0xB6, 0xAA, 0x00, 0xD5, 0xB6, 0xFF, 0x00,
-0xD5, 0xDB, 0x00, 0x00, 0xD5, 0xDB, 0x55, 0x00, 0xD5, 0xDB, 0xAA, 0x00,
-0xD5, 0xDB, 0xFF, 0x00, 0xD5, 0xFF, 0x00, 0x00, 0xD5, 0xFF, 0x55, 0x00,
-0xD5, 0xFF, 0xAA, 0x00, 0xD5, 0xFF, 0xFF, 0x00, 0xFF, 0xDB, 0x55, 0x00,
-0xFF, 0x00, 0x55, 0x00, 0xFF, 0x00, 0xAA, 0x00, 0xFF, 0xFF, 0x55, 0x00,
-0xFF, 0x24, 0x00, 0x00, 0xFF, 0x24, 0x55, 0x00, 0xFF, 0x24, 0xAA, 0x00,
-0xFF, 0x24, 0xFF, 0x00, 0xFF, 0x49, 0x00, 0x00, 0xFF, 0x49, 0x55, 0x00,
-0xFF, 0x49, 0xAA, 0x00, 0xFF, 0x49, 0xFF, 0x00, 0xFF, 0x6D, 0x00, 0x00,
-0xFF, 0x6D, 0x55, 0x00, 0xFF, 0x6D, 0xAA, 0x00, 0xFF, 0x6D, 0xFF, 0x00,
-0xFF, 0x92, 0x00, 0x00, 0xFF, 0x92, 0x55, 0x00, 0xFF, 0x92, 0xAA, 0x00,
-0xFF, 0x92, 0xFF, 0x00, 0xFF, 0xB6, 0x00, 0x00, 0xFF, 0xB6, 0x55, 0x00,
-0xF7, 0xF7, 0xF7, 0x00, 0xA2, 0xA2, 0xA2, 0x00, 0x83, 0x83, 0x83, 0x00,
-0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00,
-0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00,
-0xFF, 0xFF, 0xFF, 0x00
-};
-
-
-
-
-inline long SwapLong( long n )
-{
-#ifndef OSL_LITENDIAN
- return SWAPLONG( n );
-#else
- return n;
-#endif
-}
-
-inline short SwapShort( short n )
-{
-#ifndef OSL_LITENDIAN
- return SWAPSHORT( n );
-#else
- return n;
-#endif
-}
-
-
-static void WriteBMPHeader( SvStream& rStream,
- const SvxRTFPictureType& rPicType )
-{
- sal_uInt32 n4Width = rPicType.nWidth;
- sal_uInt32 n4Height = rPicType.nHeight;
- sal_uInt16 n4ColBits = rPicType.nBitsPerPixel;
-
- 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 );
-
- long nOffset = 14 + 40; // BMP_FILE_HD_SIZ + sizeof(*pBmpInfo);
- if( 256 >= nColors )
- nOffset += nColors * 4;
- long nSize = nOffset + nWdtOut * n4Height;
- rStream << "BM" // = "BM"
- << SwapLong(nSize) // Filesize in Bytes
- << SwapShort(0) // Reserved
- << SwapShort(0) // Reserved
- << SwapLong(nOffset); // Offset?
-
- rStream << SwapLong(40) // sizeof( BmpInfo )
- << SwapLong(n4Width)
- << SwapLong(n4Height)
- << (sal_uInt16)1
- << n4ColBits
- << SwapLong(0)
- << SwapLong(0)
- << SwapLong( rPicType.nGoalWidth
- ? rPicType.nGoalWidth * 1000L / 254L
- : 0 ) // DPI in Pixel per Meter
- << SwapLong( rPicType.nGoalHeight
- ? rPicType.nGoalHeight * 1000L / 254L // dito
- : 0 )
- << SwapLong(0)
- << SwapLong(0);
-
-
- switch( rPicType.nBitsPerPixel )
- {
- case 1: rStream.Write( aPal1, sizeof( aPal1 )); break;
- case 4: rStream.Write( aPal4, sizeof( aPal4 )); break;
- case 8: rStream.Write( aPal8, sizeof( aPal8 )); break;
- }
-}
-
- // 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 )
-{
- // then create "Binary data" from the hex values.
- // (missuse the String as temp Buffer)
- if( rToken.Len() & 1 ) // odd number, fill out with 0
- rToken += '0';
-
- xub_StrLen n, nLen;
- sal_Unicode nVal;
- sal_Bool bValidData = sal_True;
- const sal_Unicode* pStr = rToken.GetBufferAccess();
- sal_Char* pData = (sal_Char*)pStr;
- for( n = 0, nLen = rToken.Len(); n < nLen; ++n, ++pStr )
- {
- if( ((nVal = *pStr) >= '0') && ( nVal <= '9') )
- nVal -= '0';
- else if( (nVal >= 'A') && (nVal <= 'F') )
- nVal -= 'A' - 10;
- else if( (nVal >= 'a') && (nVal <= 'f') )
- nVal -= 'a' - 10;
- else
- {
- DBG_ASSERT( !this, "invalid Hex value" );
- bValidData = sal_False;
- break;
- }
-
- if( n & 1 )
- *(pData++) |= nVal & 0x0f;
- else
- *(pData) = sal::static_int_cast< char >( ( nVal << 4 ) & 0xf0 );
- }
- // the len div 2, because 2 character are one byte
- return bValidData ? nLen / 2 : STRING_NOTFOUND;
-}
-
-sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType )
-{
- // Delete the old data
- rGrf.Clear();
-
- rtl_TextEncoding eOldEnc = GetSrcEncoding();
- SetSrcEncoding( RTL_TEXTENCODING_MS_1252 );
-
- const sal_Char* pFilterNm = 0;
- boost::scoped_ptr<SvCacheStream> pTmpFile;
-
- int nToken = 0;
- bool bValidBmp = true, bFirstTextToken = true;
- int _nOpenBrakets = 1, // the first was already recognized before!
- nValidDataBraket = 1;
-
- if( RTF_SHPPICT == GetStackPtr(0)->nTokenId )
- ++nValidDataBraket;
- OUString sShapePropertyName, sShapePropertyValue;
- int nShapePropertyBracket = -1;
- while( _nOpenBrakets && IsParserWorking() && bValidBmp )
- {
- nToken = GetNextToken();
- sal_uInt16 nVal = sal_uInt16( nTokenValue );
- switch( nToken )
- {
- case '}':
- --_nOpenBrakets;
- if( nShapePropertyBracket > 0 && nShapePropertyBracket > _nOpenBrakets )
- {
- nShapePropertyBracket = -1;
- if( sShapePropertyName.getLength() )
- {
- rPicType.aPropertyPairs.push_back( ::std::pair< OUString, OUString >( sShapePropertyName, sShapePropertyValue ) );
- sShapePropertyName = sShapePropertyValue = ::rtl::OUString();
- }
- }
- break;
- case '{':
- {
- if( RTF_IGNOREFLAG != GetNextToken() )
- nToken = SkipToken( -1 );
- else if( RTF_UNKNOWNCONTROL != GetNextToken() )
- nToken = SkipToken( -2 );
- else
- {
- // gleich herausfiltern
- ReadUnknownData();
- nToken = GetNextToken();
- if( '}' != nToken )
- eState = SVPAR_ERROR;
- break;
- }
- ++_nOpenBrakets;
- }
- break;
-
- case RTF_MACPICT:
- {
- rPicType.eStyle = SvxRTFPictureType::MAC_QUICKDRAW;
- // Mac-Pict gets a empty header above
- pTmpFile.reset(new SvCacheStream);
- ByteString aStr;
- aStr.Fill( 512, '\0' );
- pTmpFile->Write( aStr.GetBuffer(), aStr.Len() );
- pFilterNm = "PCT";
- }
- break;
-
- case RTF_EMFBLIP:
- case RTF_WMETAFILE:
- case RTF_PNGBLIP:
- case RTF_JPEGBLIP:
- case RTF_WBITMAP:
- case RTF_OSMETAFILE:
- case RTF_DIBITMAP:
- {
- switch( nToken )
- {
- case RTF_EMFBLIP:
- rPicType.eStyle = SvxRTFPictureType::ENHANCED_MF;
- pFilterNm = "EMF";
- break;
- case RTF_WMETAFILE:
- rPicType.eStyle = SvxRTFPictureType::WIN_METAFILE;
- pFilterNm = "WMF";
- break;
- case RTF_PNGBLIP:
- rPicType.eStyle = SvxRTFPictureType::RTF_PNG;
- pFilterNm = "PNG";
- break;
- case RTF_JPEGBLIP:
- rPicType.eStyle = SvxRTFPictureType::RTF_JPG;
- pFilterNm = "JPG";
- break;
-
- case RTF_WBITMAP:
- rPicType.eStyle = SvxRTFPictureType::RTF_BITMAP;
- break;
- case RTF_OSMETAFILE:
- rPicType.eStyle = SvxRTFPictureType::OS2_METAFILE;
- break;
- case RTF_DIBITMAP:
- rPicType.eStyle = SvxRTFPictureType::RTF_DI_BMP;
- break;
- }
-
- rPicType.nType = nVal;
- pTmpFile.reset(new SvCacheStream);
- }
- break;
-
- case RTF_PICW: rPicType.nWidth = nVal; break;
- case RTF_PICH: rPicType.nHeight = nVal; break;
- case RTF_WBMBITSPIXEL: rPicType.nBitsPerPixel = nVal; break;
- case RTF_WBMPLANES: rPicType.nPlanes = nVal; break;
- case RTF_WBMWIDTHBYTES: rPicType.nWidthBytes = nVal; break;
- case RTF_PICWGOAL: rPicType.nGoalWidth = nVal; break;
- case RTF_PICHGOAL: rPicType.nGoalHeight = nVal; break;
- case RTF_BIN:
- rPicType.nMode = SvxRTFPictureType::BINARY_MODE;
- rPicType.uPicLen = nTokenValue;
- if (rPicType.uPicLen)
- {
- rStrm.SeekRel(-1);
- sal_uInt8 aData[4096];
- sal_uInt32 nSize = sizeof(aData);
-
- while (rPicType.uPicLen > 0)
- {
- if (rPicType.uPicLen < nSize)
- nSize = rPicType.uPicLen;
-
- rStrm.Read(aData, nSize);
- pTmpFile->Write(aData, nSize);
- rPicType.uPicLen -= nSize;
- }
- nNextCh = GetNextChar();
- bValidBmp = !pTmpFile->GetError();
- }
- break;
- case RTF_PICSCALEX: rPicType.nScalX = nVal; break;
- case RTF_PICSCALEY: rPicType.nScalY = nVal; break;
- case RTF_PICSCALED: break;
-
- case RTF_PICCROPT: rPicType.nCropT = (short)nTokenValue; break;
- case RTF_PICCROPB: rPicType.nCropB = (short)nTokenValue; break;
- case RTF_PICCROPL: rPicType.nCropL = (short)nTokenValue; break;
- case RTF_PICCROPR: rPicType.nCropR = (short)nTokenValue; break;
- case RTF_SP:
- //read pairs of {\sn Name}{\sv Value}
- nShapePropertyBracket = _nOpenBrakets;
- break;
- case RTF_SN:
- nToken = GetNextToken();
- if( nToken != '}' )
- sShapePropertyName = aToken;
- else
- nToken = SkipToken( -1 );
- break;
- case RTF_SV:
- nToken = GetNextToken();
- if( nToken != '}' )
- sShapePropertyValue = aToken;
- else
- nToken = SkipToken( -1 );
- break;
- case RTF_TEXTTOKEN:
- if( nValidDataBraket != _nOpenBrakets )
- break;
-
- if( bFirstTextToken )
- {
- switch( rPicType.eStyle )
- {
- case SvxRTFPictureType::RTF_BITMAP:
- // first write the header and the info structure
- if( pTmpFile )
- ::WriteBMPHeader( *pTmpFile, rPicType );
- break;
- default:
- break;
- }
- bFirstTextToken = sal_False;
- }
-
- if( pTmpFile && SvxRTFPictureType::HEX_MODE == rPicType.nMode )
- {
- xub_StrLen nTokenLen = HexToBin( aToken );
- if( STRING_NOTFOUND == nTokenLen )
- bValidBmp = sal_False;
- else
- {
- pTmpFile->Write( (sal_Char*)aToken.GetBuffer(),
- nTokenLen );
- bValidBmp = 0 == pTmpFile->GetError();
- }
- }
- break;
- }
- }
-
- if (pTmpFile)
- {
- //#i20775#
- if (pTmpFile->Tell() == 0)
- bValidBmp = false;
-
- if( bValidBmp )
- {
- GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
- sal_uInt16 nImportFilter = GRFILTER_FORMAT_DONTKNOW;
-
- if( pFilterNm )
- {
- String sTmp;
- for( sal_uInt16 n = rGF.GetImportFormatCount(); n; )
- {
- sTmp = rGF.GetImportFormatShortName( --n );
- if( sTmp.EqualsAscii( pFilterNm ))
- {
- nImportFilter = n;
- break;
- }
- }
- }
-
- 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 == rGF.ImportGraphic( rGrf, sTmpStr, *pTmpFile, nImportFilter, NULL, 0, pAPMHeader );
- }
- }
-
- if( !bValidBmp )
- {
- rGrf.Clear();
- // 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 )
- SkipGroup();
- }
- else
- {
- switch( rPicType.eStyle )
- {
- case SvxRTFPictureType::RTF_PNG:
- case SvxRTFPictureType::RTF_JPG:
- {
- const MapMode aMap( MAP_100TH_MM );
- Size aSize( rGrf.GetPrefSize() );
- if( MAP_PIXEL == rGrf.GetPrefMapMode().GetMapUnit() )
- aSize = Application::GetDefaultDevice()->PixelToLogic(
- aSize, aMap );
- else
- aSize = OutputDevice::LogicToLogic( aSize,
- rGrf.GetPrefMapMode(), aMap );
- rPicType.nWidth = sal::static_int_cast< sal_uInt16 >(aSize.Width());
- rPicType.nHeight = sal::static_int_cast< sal_uInt16 >(
- aSize.Height());
- }
- break;
- default:
- break;
- }
- }
- SetSrcEncoding( eOldEnc );
-
- SkipToken( -1 ); // the closing brace is evaluated "above"
- return bValidBmp;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
deleted file mode 100644
index da0aa48f99..0000000000
--- a/editeng/source/rtf/rtfitem.cxx
+++ /dev/null
@@ -1,1923 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <editeng/flstitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/fwdtitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/crsditem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/akrnitem.hxx>
-#include <editeng/wrlmitem.hxx>
-#include <editeng/cntritem.hxx>
-#include <editeng/prszitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/cscoitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/cmapitem.hxx>
-#include <editeng/escpitem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/nlbkitem.hxx>
-#include <editeng/nhypitem.hxx>
-#include <editeng/lcolitem.hxx>
-#include <editeng/blnkitem.hxx>
-#include <editeng/emphitem.hxx>
-#include <editeng/twolinesitem.hxx>
-#include <editeng/pbinitem.hxx>
-#include <editeng/sizeitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/prntitem.hxx>
-#include <editeng/opaqitem.hxx>
-#include <editeng/protitem.hxx>
-#include <editeng/shaditem.hxx>
-#include <editeng/boxitem.hxx>
-#include <editeng/brkitem.hxx>
-#include <editeng/keepitem.hxx>
-#include <editeng/bolnitem.hxx>
-#include <editeng/brshitem.hxx>
-#include <editeng/lspcitem.hxx>
-#include <editeng/adjitem.hxx>
-#include <editeng/orphitem.hxx>
-#include <editeng/widwitem.hxx>
-#include <editeng/tstpitem.hxx>
-#include <editeng/pmdlitem.hxx>
-#include <editeng/spltitem.hxx>
-#include <editeng/hyznitem.hxx>
-#include <editeng/charscaleitem.hxx>
-#include <editeng/charrotateitem.hxx>
-#include <editeng/charreliefitem.hxx>
-#include <editeng/paravertalignitem.hxx>
-#include <editeng/forbiddenruleitem.hxx>
-#include <editeng/hngpnctitem.hxx>
-#include <editeng/scriptspaceitem.hxx>
-#include <editeng/frmdiritem.hxx>
-#include <editeng/charhiddenitem.hxx>
-
-#include <svtools/rtftoken.h>
-#include <svl/itempool.hxx>
-#include <svl/itemiter.hxx>
-
-#include <editeng/svxrtf.hxx>
-#include <editeng/editids.hrc>
-
-#define BRACELEFT '{'
-#define BRACERIGHT '}'
-
-using namespace editeng;
-
-// 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); }
-inline const SvxLineSpacingItem& GetLineSpacing(const SfxItemSet& rSet,sal_uInt16 nId,sal_Bool bInP=sal_True)
- { return (const SvxLineSpacingItem&)rSet.Get( nId,bInP); }
-// frm
-inline const SvxLRSpaceItem& GetLRSpace(const SfxItemSet& rSet,sal_uInt16 nId,sal_Bool bInP=sal_True)
- { return (const SvxLRSpaceItem&)rSet.Get( nId,bInP); }
-inline const SvxULSpaceItem& GetULSpace(const SfxItemSet& rSet,sal_uInt16 nId,sal_Bool bInP=sal_True)
- { return (const SvxULSpaceItem&)rSet.Get( nId,bInP); }
-
-#define PARDID ((RTFPardAttrMapIds*)aPardMap.GetData())
-#define PLAINID ((RTFPlainAttrMapIds*)aPlainMap.GetData())
-
-void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet,
- SfxPoolItem& rItem )
-{
- const sal_uInt16 *pNormal = 0, *pCJK = 0, *pCTL = 0;
- const RTFPlainAttrMapIds* pIds = (RTFPlainAttrMapIds*)aPlainMap.GetData();
- switch( rItem.Which() )
- {
- case SID_ATTR_CHAR_FONT:
- pNormal = &pIds->nFont;
- pCJK = &pIds->nCJKFont;
- pCTL = &pIds->nCTLFont;
- break;
-
- case SID_ATTR_CHAR_FONTHEIGHT:
- pNormal = &pIds->nFontHeight;
- pCJK = &pIds->nCJKFontHeight;
- pCTL = &pIds->nCTLFontHeight;
- break;
-
- case SID_ATTR_CHAR_POSTURE:
- pNormal = &pIds->nPosture;
- pCJK = &pIds->nCJKPosture;
- pCTL = &pIds->nCTLPosture;
- break;
-
- case SID_ATTR_CHAR_WEIGHT:
- pNormal = &pIds->nWeight;
- pCJK = &pIds->nCJKWeight;
- pCTL = &pIds->nCTLWeight;
- break;
-
- case SID_ATTR_CHAR_LANGUAGE:
- pNormal = &pIds->nLanguage;
- pCJK = &pIds->nCJKLanguage;
- pCTL = &pIds->nCTLLanguage;
- break;
-
- case 0:
- // it exist no WhichId - don't set this item
- break;
-
- default:
- rSet.Put( rItem );
- break;
- }
-
-
- if( DOUBLEBYTE_CHARTYPE == eType )
- {
- if( bIsLeftToRightDef && *pCJK )
- {
- rItem.SetWhich( *pCJK );
- rSet.Put( rItem );
- }
- }
- else if( !bIsLeftToRightDef )
- {
- if( *pCTL )
- {
- rItem.SetWhich( *pCTL );
- rSet.Put( rItem );
- }
- }
- else
- {
- if( LOW_CHARTYPE == eType )
- {
- if( *pNormal )
- {
- rItem.SetWhich( *pNormal );
- rSet.Put( rItem );
- }
- }
- else if( HIGH_CHARTYPE == eType )
- {
- if( *pCTL )
- {
- rItem.SetWhich( *pCTL );
- rSet.Put( rItem );
- }
- }
- else
- {
- if( *pCJK )
- {
- rItem.SetWhich( *pCJK );
- rSet.Put( rItem );
- }
- if( *pCTL )
- {
- rItem.SetWhich( *pCTL );
- rSet.Put( rItem );
- }
- if( *pNormal )
- {
- rItem.SetWhich( *pNormal );
- rSet.Put( rItem );
- }
- }
- }
-}
-
-// --------------------
-
-void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
-{
- DBG_ASSERT( pSet, "A SfxItemSet has to be provided as argument!" );
- int bFirstToken = sal_True, bWeiter = sal_True;
- sal_uInt16 nStyleNo = 0; // default
- FontUnderline eUnderline;
- FontUnderline eOverline;
- FontEmphasisMark eEmphasis;
- bPardTokenRead = sal_False;
- RTF_CharTypeDef eCharType = NOTDEF_CHARTYPE;
- sal_uInt16 nFontAlign;
-
- int bChkStkPos = !bNewGroup && !aAttrStack.empty();
-
- while( bWeiter && IsParserWorking() ) // as long as known Attribute are recognized
- {
- switch( nToken )
- {
- case RTF_PARD:
- RTFPardPlain( sal_True, &pSet );
- ResetPard();
- nStyleNo = 0;
- bPardTokenRead = sal_True;
- break;
-
- case RTF_PLAIN:
- RTFPardPlain( sal_False, &pSet );
- break;
-
- default:
- do { // middle checked loop
- if( !bChkStkPos )
- break;
-
- SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
- if( !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() &&
- pAkt->nSttCnt == pInsPos->GetCntIdx() ))
- break;
-
- int nLastToken = GetStackPtr(-1)->nTokenId;
- if( RTF_PARD == nLastToken || RTF_PLAIN == nLastToken )
- break;
-
- if( pAkt->aAttrSet.Count() || pAkt->pChildList ||
- pAkt->nStyleNo )
- {
- // Open a new Group
- SvxRTFItemStackType* pNew = new SvxRTFItemStackType(
- *pAkt, *pInsPos, sal_True );
- pNew->SetRTFDefaults( GetRTFDefaults() );
-
- // "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 );
-
- aAttrStack.push_back( pNew );
- pAkt = pNew;
- }
- else
- // continue to use this entry as a new one
- pAkt->SetStartPos( *pInsPos );
-
- pSet = &pAkt->aAttrSet;
- } while( sal_False );
-
- switch( nToken )
- {
- case RTF_INTBL:
- case RTF_PAGEBB:
- case RTF_SBYS:
- case RTF_CS:
- case RTF_LS:
- case RTF_ILVL:
- UnknownAttrToken( nToken, pSet );
- break;
-
- case RTF_S:
- if( bIsInReadStyleTab )
- {
- if( !bFirstToken )
- SkipToken( -1 );
- bWeiter = sal_False;
- }
- else
- {
- nStyleNo = -1 == nTokenValue ? 0 : sal_uInt16(nTokenValue);
- // setze am akt. auf dem AttrStack stehenden Style die
- // StyleNummer
- SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
- if( !pAkt )
- break;
-
- pAkt->nStyleNo = sal_uInt16( nStyleNo );
-
- }
- break;
-
- case RTF_KEEP:
- if( PARDID->nSplit )
- {
- pSet->Put( SvxFmtSplitItem( sal_False, PARDID->nSplit ));
- }
- break;
-
- case RTF_KEEPN:
- if( PARDID->nKeep )
- {
- pSet->Put( SvxFmtKeepItem( sal_True, PARDID->nKeep ));
- }
- break;
-
- case RTF_LEVEL:
- if( PARDID->nOutlineLvl )
- {
- pSet->Put( SfxUInt16Item( PARDID->nOutlineLvl,
- (sal_uInt16)nTokenValue ));
- }
- break;
-
- case RTF_QL:
- if( PARDID->nAdjust )
- {
- pSet->Put( SvxAdjustItem( SVX_ADJUST_LEFT, PARDID->nAdjust ));
- }
- break;
- case RTF_QR:
- if( PARDID->nAdjust )
- {
- pSet->Put( SvxAdjustItem( SVX_ADJUST_RIGHT, PARDID->nAdjust ));
- }
- break;
- case RTF_QJ:
- if( PARDID->nAdjust )
- {
- pSet->Put( SvxAdjustItem( SVX_ADJUST_BLOCK, PARDID->nAdjust ));
- }
- break;
- case RTF_QC:
- if( PARDID->nAdjust )
- {
- pSet->Put( SvxAdjustItem( SVX_ADJUST_CENTER, PARDID->nAdjust ));
- }
- break;
-
- case RTF_FI:
- if( PARDID->nLRSpace )
- {
- SvxLRSpaceItem aLR( GetLRSpace(*pSet, PARDID->nLRSpace ));
- sal_uInt16 nSz = 0;
- if( -1 != nTokenValue )
- {
- if( IsCalcValue() )
- CalcValue();
- nSz = sal_uInt16(nTokenValue);
- }
- aLR.SetTxtFirstLineOfst( nSz );
- pSet->Put( aLR );
- }
- break;
-
- case RTF_LI:
- case RTF_LIN:
- if( PARDID->nLRSpace )
- {
- SvxLRSpaceItem aLR( GetLRSpace(*pSet, PARDID->nLRSpace ));
- sal_uInt16 nSz = 0;
- if( 0 < nTokenValue )
- {
- if( IsCalcValue() )
- CalcValue();
- nSz = sal_uInt16(nTokenValue);
- }
- aLR.SetTxtLeft( nSz );
- pSet->Put( aLR );
- }
- break;
-
- case RTF_RI:
- case RTF_RIN:
- if( PARDID->nLRSpace )
- {
- SvxLRSpaceItem aLR( GetLRSpace(*pSet, PARDID->nLRSpace ));
- sal_uInt16 nSz = 0;
- if( 0 < nTokenValue )
- {
- if( IsCalcValue() )
- CalcValue();
- nSz = sal_uInt16(nTokenValue);
- }
- aLR.SetRight( nSz );
- pSet->Put( aLR );
- }
- break;
-
- case RTF_SB:
- if( PARDID->nULSpace )
- {
- SvxULSpaceItem aUL( GetULSpace(*pSet, PARDID->nULSpace ));
- sal_uInt16 nSz = 0;
- if( 0 < nTokenValue )
- {
- if( IsCalcValue() )
- CalcValue();
- nSz = sal_uInt16(nTokenValue);
- }
- aUL.SetUpper( nSz );
- pSet->Put( aUL );
- }
- break;
-
- case RTF_SA:
- if( PARDID->nULSpace )
- {
- SvxULSpaceItem aUL( GetULSpace(*pSet, PARDID->nULSpace ));
- sal_uInt16 nSz = 0;
- if( 0 < nTokenValue )
- {
- if( IsCalcValue() )
- CalcValue();
- nSz = sal_uInt16(nTokenValue);
- }
- aUL.SetLower( nSz );
- pSet->Put( aUL );
- }
- break;
-
- case RTF_SLMULT:
- if( PARDID->nLinespacing && 1 == nTokenValue )
- {
- // then switches to multi-line!
- SvxLineSpacingItem aLSpace( GetLineSpacing( *pSet,
- PARDID->nLinespacing, sal_False ));
-
- // how much do you get from the line height value?
-
- // Proportional-Size:
- // Ie, the ratio is (n / 240) twips
-
- nTokenValue = 240;
- if( IsCalcValue() )
- CalcValue();
-
- nTokenValue = short( 100L * aLSpace.GetLineHeight()
- / long( nTokenValue ) );
-
- if( nTokenValue > 200 ) // Data value for PropLnSp
- nTokenValue = 200; // is one BYTE !!!
-
- aLSpace.SetPropLineSpace( (const sal_uInt8)nTokenValue );
- aLSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
-
- pSet->Put( aLSpace );
- }
- break;
-
- case RTF_SL:
- if( PARDID->nLinespacing )
- {
- // 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;
- if (1000 == nTokenValue )
- nTokenValue = 240;
-
- SvxLineSpace eLnSpc;
- if (nTokenValue < 0)
- {
- eLnSpc = SVX_LINE_SPACE_FIX;
- nTokenValue = -nTokenValue;
- }
- else if (nTokenValue == 0)
- {
- //if \sl0 is used, the line spacing is automatically
- //determined
- eLnSpc = SVX_LINE_SPACE_AUTO;
- }
- else
- eLnSpc = SVX_LINE_SPACE_MIN;
-
- if (IsCalcValue())
- CalcValue();
-
- if (eLnSpc != SVX_LINE_SPACE_AUTO)
- aLSpace.SetLineHeight( (const sal_uInt16)nTokenValue );
-
- aLSpace.GetLineSpaceRule() = eLnSpc;
- pSet->Put(aLSpace);
- }
- break;
-
- case RTF_NOCWRAP:
- if( PARDID->nForbRule )
- {
- pSet->Put( SvxForbiddenRuleItem( sal_False,
- PARDID->nForbRule ));
- }
- break;
- case RTF_NOOVERFLOW:
- if( PARDID->nHangPunct )
- {
- pSet->Put( SvxHangingPunctuationItem( sal_False,
- PARDID->nHangPunct ));
- }
- break;
-
- case RTF_ASPALPHA:
- if( PARDID->nScriptSpace )
- {
- pSet->Put( SvxScriptSpaceItem( sal_True,
- PARDID->nScriptSpace ));
- }
- break;
-
- case RTF_FAFIXED:
- case RTF_FAAUTO: nFontAlign = SvxParaVertAlignItem::AUTOMATIC;
- goto SET_FONTALIGNMENT;
- case RTF_FAHANG: nFontAlign = SvxParaVertAlignItem::TOP;
- goto SET_FONTALIGNMENT;
- case RTF_FAVAR: nFontAlign = SvxParaVertAlignItem::BOTTOM;
- goto SET_FONTALIGNMENT;
- case RTF_FACENTER: nFontAlign = SvxParaVertAlignItem::CENTER;
- goto SET_FONTALIGNMENT;
- case RTF_FAROMAN: nFontAlign = SvxParaVertAlignItem::BASELINE;
- goto SET_FONTALIGNMENT;
-SET_FONTALIGNMENT:
- if( PARDID->nFontAlign )
- {
- pSet->Put( SvxParaVertAlignItem( nFontAlign,
- PARDID->nFontAlign ));
- }
- break;
-
- case RTF_B:
- case RTF_AB:
- if( IsAttrSttPos() ) // not in the text flow?
- {
-
- SvxWeightItem aTmpItem(
- nTokenValue ? WEIGHT_BOLD : WEIGHT_NORMAL,
- SID_ATTR_CHAR_WEIGHT );
- SetScriptAttr( eCharType, *pSet, aTmpItem);
- }
- break;
-
- case RTF_CAPS:
- case RTF_SCAPS:
- if( PLAINID->nCaseMap &&
- IsAttrSttPos() ) // not in the text flow?
- {
- SvxCaseMap eCaseMap;
- if( !nTokenValue )
- eCaseMap = SVX_CASEMAP_NOT_MAPPED;
- else if( RTF_CAPS == nToken )
- eCaseMap = SVX_CASEMAP_VERSALIEN;
- else
- eCaseMap = SVX_CASEMAP_KAPITAELCHEN;
-
- pSet->Put( SvxCaseMapItem( eCaseMap, PLAINID->nCaseMap ));
- }
- break;
-
- case RTF_DN:
- case RTF_SUB:
- if( PLAINID->nEscapement )
- {
- const sal_uInt16 nEsc = PLAINID->nEscapement;
- if( -1 == nTokenValue || RTF_SUB == nToken )
- nTokenValue = 6;
- if( IsCalcValue() )
- CalcValue();
- const SvxEscapementItem& rOld = GetEscapement( *pSet, nEsc, sal_False );
- short nEs;
- sal_uInt8 nProp;
- if( DFLT_ESC_AUTO_SUPER == rOld.GetEsc() )
- {
- nEs = DFLT_ESC_AUTO_SUB;
- nProp = rOld.GetProp();
- }
- else
- {
- nEs = (short)-nTokenValue;
- nProp = (nToken == RTF_SUB) ? DFLT_ESC_PROP : 100;
- }
- pSet->Put( SvxEscapementItem( nEs, nProp, nEsc ));
- }
- break;
-
- case RTF_NOSUPERSUB:
- if( PLAINID->nEscapement )
- {
- const sal_uInt16 nEsc = PLAINID->nEscapement;
- pSet->Put( SvxEscapementItem( nEsc ));
- }
- break;
-
- case RTF_EXPND:
- if( PLAINID->nKering )
- {
- if( -1 == nTokenValue )
- nTokenValue = 0;
- else
- nTokenValue *= 5;
- if( IsCalcValue() )
- CalcValue();
- pSet->Put( SvxKerningItem( (short)nTokenValue, PLAINID->nKering ));
- }
- break;
-
- case RTF_KERNING:
- if( PLAINID->nAutoKerning )
- {
- if( -1 == nTokenValue )
- nTokenValue = 0;
- else
- nTokenValue *= 10;
- if( IsCalcValue() )
- CalcValue();
- pSet->Put( SvxAutoKernItem( 0 != nTokenValue,
- PLAINID->nAutoKerning ));
- }
- break;
-
- case RTF_EXPNDTW:
- if( PLAINID->nKering )
- {
- if( -1 == nTokenValue )
- nTokenValue = 0;
- if( IsCalcValue() )
- CalcValue();
- pSet->Put( SvxKerningItem( (short)nTokenValue, PLAINID->nKering ));
- }
- break;
-
- case RTF_F:
- case RTF_AF:
- {
- const Font& rSVFont = GetFont( sal_uInt16(nTokenValue) );
- SvxFontItem aTmpItem( rSVFont.GetFamily(),
- rSVFont.GetName(), rSVFont.GetStyleName(),
- rSVFont.GetPitch(), rSVFont.GetCharSet(),
- SID_ATTR_CHAR_FONT );
- SetScriptAttr( eCharType, *pSet, aTmpItem );
- if( RTF_F == nToken )
- {
- SetEncoding( rSVFont.GetCharSet() );
- RereadLookahead();
- }
- }
- break;
-
- case RTF_FS:
- case RTF_AFS:
- {
- if( -1 == nTokenValue )
- nTokenValue = 240;
- else
- nTokenValue *= 10;
-// #i66167#
-// for the SwRTFParser 'IsCalcValue' will be false and for the EditRTFParser
-// the converiosn takes now place in EditRTFParser since for other reasons
-// the wrong MapUnit might still be use there
-// if( IsCalcValue() )
-// CalcValue();
- SvxFontHeightItem aTmpItem(
- (const sal_uInt16)nTokenValue, 100,
- SID_ATTR_CHAR_FONTHEIGHT );
- SetScriptAttr( eCharType, *pSet, aTmpItem );
- }
- break;
-
- case RTF_I:
- case RTF_AI:
- if( IsAttrSttPos() ) // not in the text flow?
- {
- SvxPostureItem aTmpItem(
- nTokenValue ? ITALIC_NORMAL : ITALIC_NONE,
- SID_ATTR_CHAR_POSTURE );
- SetScriptAttr( eCharType, *pSet, aTmpItem );
- }
- break;
-
- case RTF_OUTL:
- if( PLAINID->nContour &&
- IsAttrSttPos() ) // not in the text flow?
- {
- pSet->Put( SvxContourItem( nTokenValue ? sal_True : sal_False,
- PLAINID->nContour ));
- }
- break;
-
- case RTF_SHAD:
- if( PLAINID->nShadowed &&
- IsAttrSttPos() ) // not in the text flow?
- {
- pSet->Put( SvxShadowedItem( nTokenValue ? sal_True : sal_False,
- PLAINID->nShadowed ));
- }
- break;
-
- case RTF_STRIKE:
- if( PLAINID->nCrossedOut &&
- IsAttrSttPos() ) // not in the text flow?
- {
- pSet->Put( SvxCrossedOutItem(
- nTokenValue ? STRIKEOUT_SINGLE : STRIKEOUT_NONE,
- PLAINID->nCrossedOut ));
- }
- break;
-
- case RTF_STRIKED:
- if( PLAINID->nCrossedOut ) // not in the text flow?
- {
- pSet->Put( SvxCrossedOutItem(
- nTokenValue ? STRIKEOUT_DOUBLE : STRIKEOUT_NONE,
- PLAINID->nCrossedOut ));
- }
- break;
-
- case RTF_UL:
- if( !IsAttrSttPos() )
- break;
- eUnderline = nTokenValue ? UNDERLINE_SINGLE : UNDERLINE_NONE;
- goto ATTR_SETUNDERLINE;
-
- case RTF_ULD:
- eUnderline = UNDERLINE_DOTTED;
- goto ATTR_SETUNDERLINE;
- case RTF_ULDASH:
- eUnderline = UNDERLINE_DASH;
- goto ATTR_SETUNDERLINE;
- case RTF_ULDASHD:
- eUnderline = UNDERLINE_DASHDOT;
- goto ATTR_SETUNDERLINE;
- case RTF_ULDASHDD:
- eUnderline = UNDERLINE_DASHDOTDOT;
- goto ATTR_SETUNDERLINE;
- case RTF_ULDB:
- eUnderline = UNDERLINE_DOUBLE;
- goto ATTR_SETUNDERLINE;
- case RTF_ULNONE:
- eUnderline = UNDERLINE_NONE;
- goto ATTR_SETUNDERLINE;
- case RTF_ULTH:
- eUnderline = UNDERLINE_BOLD;
- goto ATTR_SETUNDERLINE;
- case RTF_ULWAVE:
- eUnderline = UNDERLINE_WAVE;
- goto ATTR_SETUNDERLINE;
- case RTF_ULTHD:
- eUnderline = UNDERLINE_BOLDDOTTED;
- goto ATTR_SETUNDERLINE;
- case RTF_ULTHDASH:
- eUnderline = UNDERLINE_BOLDDASH;
- goto ATTR_SETUNDERLINE;
- case RTF_ULLDASH:
- eUnderline = UNDERLINE_LONGDASH;
- goto ATTR_SETUNDERLINE;
- case RTF_ULTHLDASH:
- eUnderline = UNDERLINE_BOLDLONGDASH;
- goto ATTR_SETUNDERLINE;
- case RTF_ULTHDASHD:
- eUnderline = UNDERLINE_BOLDDASHDOT;
- goto ATTR_SETUNDERLINE;
- case RTF_ULTHDASHDD:
- eUnderline = UNDERLINE_BOLDDASHDOTDOT;
- goto ATTR_SETUNDERLINE;
- case RTF_ULHWAVE:
- eUnderline = UNDERLINE_BOLDWAVE;
- goto ATTR_SETUNDERLINE;
- case RTF_ULULDBWAVE:
- eUnderline = UNDERLINE_DOUBLEWAVE;
- goto ATTR_SETUNDERLINE;
-
- case RTF_ULW:
- eUnderline = UNDERLINE_SINGLE;
-
- if( PLAINID->nWordlineMode )
- {
- pSet->Put( SvxWordLineModeItem( sal_True, PLAINID->nWordlineMode ));
- }
- goto ATTR_SETUNDERLINE;
-
-ATTR_SETUNDERLINE:
- if( PLAINID->nUnderline )
- {
- pSet->Put( SvxUnderlineItem( eUnderline, PLAINID->nUnderline ));
- }
- break;
-
- case RTF_ULC:
- if( PLAINID->nUnderline )
- {
- SvxUnderlineItem aUL( UNDERLINE_SINGLE, PLAINID->nUnderline );
- const SfxPoolItem* pItem;
- if( SFX_ITEM_SET == pSet->GetItemState(
- PLAINID->nUnderline, sal_False, &pItem ) )
- {
- // is switched off ?
- if( UNDERLINE_NONE ==
- ((SvxUnderlineItem*)pItem)->GetLineStyle() )
- break;
- aUL = *(SvxUnderlineItem*)pItem;
- }
- else
- aUL = (const SvxUnderlineItem&)pSet->Get( PLAINID->nUnderline, sal_False );
-
- if( UNDERLINE_NONE == aUL.GetLineStyle() )
- aUL.SetLineStyle( UNDERLINE_SINGLE );
- aUL.SetColor( GetColor( sal_uInt16(nTokenValue) ));
- pSet->Put( aUL );
- }
- break;
-
- case RTF_OL:
- if( !IsAttrSttPos() )
- break;
- eOverline = nTokenValue ? UNDERLINE_SINGLE : UNDERLINE_NONE;
- goto ATTR_SETOVERLINE;
-
- case RTF_OLD:
- eOverline = UNDERLINE_DOTTED;
- goto ATTR_SETOVERLINE;
- case RTF_OLDASH:
- eOverline = UNDERLINE_DASH;
- goto ATTR_SETOVERLINE;
- case RTF_OLDASHD:
- eOverline = UNDERLINE_DASHDOT;
- goto ATTR_SETOVERLINE;
- case RTF_OLDASHDD:
- eOverline = UNDERLINE_DASHDOTDOT;
- goto ATTR_SETOVERLINE;
- case RTF_OLDB:
- eOverline = UNDERLINE_DOUBLE;
- goto ATTR_SETOVERLINE;
- case RTF_OLNONE:
- eOverline = UNDERLINE_NONE;
- goto ATTR_SETOVERLINE;
- case RTF_OLTH:
- eOverline = UNDERLINE_BOLD;
- goto ATTR_SETOVERLINE;
- case RTF_OLWAVE:
- eOverline = UNDERLINE_WAVE;
- goto ATTR_SETOVERLINE;
- case RTF_OLTHD:
- eOverline = UNDERLINE_BOLDDOTTED;
- goto ATTR_SETOVERLINE;
- case RTF_OLTHDASH:
- eOverline = UNDERLINE_BOLDDASH;
- goto ATTR_SETOVERLINE;
- case RTF_OLLDASH:
- eOverline = UNDERLINE_LONGDASH;
- goto ATTR_SETOVERLINE;
- case RTF_OLTHLDASH:
- eOverline = UNDERLINE_BOLDLONGDASH;
- goto ATTR_SETOVERLINE;
- case RTF_OLTHDASHD:
- eOverline = UNDERLINE_BOLDDASHDOT;
- goto ATTR_SETOVERLINE;
- case RTF_OLTHDASHDD:
- eOverline = UNDERLINE_BOLDDASHDOTDOT;
- goto ATTR_SETOVERLINE;
- case RTF_OLHWAVE:
- eOverline = UNDERLINE_BOLDWAVE;
- goto ATTR_SETOVERLINE;
- case RTF_OLOLDBWAVE:
- eOverline = UNDERLINE_DOUBLEWAVE;
- goto ATTR_SETOVERLINE;
-
- case RTF_OLW:
- eOverline = UNDERLINE_SINGLE;
-
- if( PLAINID->nWordlineMode )
- {
- pSet->Put( SvxWordLineModeItem( sal_True, PLAINID->nWordlineMode ));
- }
- goto ATTR_SETOVERLINE;
-
-ATTR_SETOVERLINE:
- if( PLAINID->nUnderline )
- {
- pSet->Put( SvxOverlineItem( eOverline, PLAINID->nOverline ));
- }
- break;
-
- case RTF_OLC:
- if( PLAINID->nOverline )
- {
- SvxOverlineItem aOL( UNDERLINE_SINGLE, PLAINID->nOverline );
- const SfxPoolItem* pItem;
- if( SFX_ITEM_SET == pSet->GetItemState(
- PLAINID->nOverline, sal_False, &pItem ) )
- {
- // is switched off ?
- if( UNDERLINE_NONE ==
- ((SvxOverlineItem*)pItem)->GetLineStyle() )
- break;
- aOL = *(SvxOverlineItem*)pItem;
- }
- else
- aOL = (const SvxOverlineItem&)pSet->Get( PLAINID->nUnderline, sal_False );
-
- if( UNDERLINE_NONE == aOL.GetLineStyle() )
- aOL.SetLineStyle( UNDERLINE_SINGLE );
- aOL.SetColor( GetColor( sal_uInt16(nTokenValue) ));
- pSet->Put( aOL );
- }
- break;
-
- case RTF_UP:
- case RTF_SUPER:
- if( PLAINID->nEscapement )
- {
- const sal_uInt16 nEsc = PLAINID->nEscapement;
- if( -1 == nTokenValue || RTF_SUPER == nToken )
- nTokenValue = 6;
- if( IsCalcValue() )
- CalcValue();
- const SvxEscapementItem& rOld = GetEscapement( *pSet, nEsc, sal_False );
- short nEs;
- sal_uInt8 nProp;
- if( DFLT_ESC_AUTO_SUB == rOld.GetEsc() )
- {
- nEs = DFLT_ESC_AUTO_SUPER;
- nProp = rOld.GetProp();
- }
- else
- {
- nEs = (short)nTokenValue;
- nProp = (nToken == RTF_SUPER) ? DFLT_ESC_PROP : 100;
- }
- pSet->Put( SvxEscapementItem( nEs, nProp, nEsc ));
- }
- break;
-
- case RTF_CF:
- if( PLAINID->nColor )
- {
- pSet->Put( SvxColorItem( GetColor( sal_uInt16(nTokenValue) ),
- PLAINID->nColor ));
- }
- break;
- //#i12501# While cb is clearly documented in the rtf spec, word
- //doesn't accept it at all
-#if 0
- case RTF_CB:
- if( PLAINID->nBgColor )
- {
- pSet->Put( SvxBrushItem( GetColor( sal_uInt16(nTokenValue) ),
- PLAINID->nBgColor ));
- }
- break;
-#endif
-
- case RTF_LANG:
- if( PLAINID->nLanguage )
- {
- pSet->Put( SvxLanguageItem( (LanguageType)nTokenValue,
- PLAINID->nLanguage ));
- }
- break;
-
- case RTF_LANGFE:
- if( PLAINID->nCJKLanguage )
- {
- pSet->Put( SvxLanguageItem( (LanguageType)nTokenValue,
- PLAINID->nCJKLanguage ));
- }
- break;
- case RTF_ALANG:
- {
- SvxLanguageItem aTmpItem( (LanguageType)nTokenValue,
- SID_ATTR_CHAR_LANGUAGE );
- SetScriptAttr( eCharType, *pSet, aTmpItem );
- }
- break;
-
- case RTF_RTLCH:
- bIsLeftToRightDef = sal_False;
- break;
- case RTF_LTRCH:
- bIsLeftToRightDef = sal_True;
- break;
- case RTF_RTLPAR:
- if (PARDID->nDirection)
- {
- pSet->Put(SvxFrameDirectionItem(FRMDIR_HORI_RIGHT_TOP,
- PARDID->nDirection));
- }
- break;
- case RTF_LTRPAR:
- if (PARDID->nDirection)
- {
- pSet->Put(SvxFrameDirectionItem(FRMDIR_HORI_LEFT_TOP,
- PARDID->nDirection));
- }
- break;
- case RTF_LOCH: eCharType = LOW_CHARTYPE; break;
- case RTF_HICH: eCharType = HIGH_CHARTYPE; break;
- case RTF_DBCH: eCharType = DOUBLEBYTE_CHARTYPE; break;
-
-
- case RTF_ACCNONE:
- eEmphasis = EMPHASISMARK_NONE;
- goto ATTR_SETEMPHASIS;
- case RTF_ACCDOT:
- eEmphasis = EMPHASISMARK_DOTS_ABOVE;
- goto ATTR_SETEMPHASIS;
-
- case RTF_ACCCOMMA:
- eEmphasis = EMPHASISMARK_SIDE_DOTS;
-ATTR_SETEMPHASIS:
- if( PLAINID->nEmphasis )
- {
- pSet->Put( SvxEmphasisMarkItem( eEmphasis,
- PLAINID->nEmphasis ));
- }
- break;
-
- case RTF_TWOINONE:
- if( PLAINID->nTwoLines )
- {
- sal_Unicode cStt, cEnd;
- switch ( nTokenValue )
- {
- case 1: cStt = '(', cEnd = ')'; break;
- case 2: cStt = '[', cEnd = ']'; break;
- case 3: cStt = '<', cEnd = '>'; break;
- case 4: cStt = '{', cEnd = '}'; break;
- default: cStt = 0, cEnd = 0; break;
- }
-
- pSet->Put( SvxTwoLinesItem( sal_True, cStt, cEnd,
- PLAINID->nTwoLines ));
- }
- break;
-
- case RTF_CHARSCALEX :
- if (PLAINID->nCharScaleX)
- {
- //i21372
- if (nTokenValue < 1 || nTokenValue > 600)
- nTokenValue = 100;
- pSet->Put( SvxCharScaleWidthItem( sal_uInt16(nTokenValue),
- PLAINID->nCharScaleX ));
- }
- break;
-
- case RTF_HORZVERT:
- if( PLAINID->nHorzVert )
- {
- // RTF knows only 90deg
- pSet->Put( SvxCharRotateItem( 900, 1 == nTokenValue,
- PLAINID->nHorzVert ));
- }
- break;
-
- case RTF_EMBO:
- if (PLAINID->nRelief)
- {
- pSet->Put(SvxCharReliefItem(RELIEF_EMBOSSED,
- PLAINID->nRelief));
- }
- break;
- case RTF_IMPR:
- if (PLAINID->nRelief)
- {
- pSet->Put(SvxCharReliefItem(RELIEF_ENGRAVED,
- PLAINID->nRelief));
- }
- break;
- case RTF_V:
- if (PLAINID->nHidden)
- {
- pSet->Put(SvxCharHiddenItem(nTokenValue != 0,
- PLAINID->nHidden));
- }
- break;
- case RTF_CHBGFDIAG:
- case RTF_CHBGDKVERT:
- case RTF_CHBGDKHORIZ:
- case RTF_CHBGVERT:
- case RTF_CHBGHORIZ:
- case RTF_CHBGDKFDIAG:
- case RTF_CHBGDCROSS:
- case RTF_CHBGCROSS:
- case RTF_CHBGBDIAG:
- case RTF_CHBGDKDCROSS:
- case RTF_CHBGDKCROSS:
- case RTF_CHBGDKBDIAG:
- case RTF_CHCBPAT:
- case RTF_CHCFPAT:
- case RTF_CHSHDNG:
- if( PLAINID->nBgColor )
- ReadBackgroundAttr( nToken, *pSet );
- break;
-
- case BRACELEFT:
- {
- // tests on Swg internal tokens
- bool bHandled = false;
- short nSkip = 0;
- if( RTF_IGNOREFLAG != GetNextToken())
- nSkip = -1;
- else if( (nToken = GetNextToken() ) & RTF_SWGDEFS )
- {
- bHandled = true;
- switch( nToken )
- {
- case RTF_PGDSCNO:
- case RTF_PGBRK:
- case RTF_SOUTLVL:
- UnknownAttrToken( nToken, pSet );
- // overwrite the closing parenthesis
- break;
-
- case RTF_SWG_ESCPROP:
- {
- // Store percentage change!
- sal_uInt8 nProp = sal_uInt8( nTokenValue / 100 );
- short nEsc = 0;
- if( 1 == ( nTokenValue % 100 ))
- // Recognize own auto-flags!
- nEsc = DFLT_ESC_AUTO_SUPER;
-
- if( PLAINID->nEscapement )
- pSet->Put( SvxEscapementItem( nEsc, nProp,
- PLAINID->nEscapement ));
- }
- break;
-
- case RTF_HYPHEN:
- {
- SvxHyphenZoneItem aHypenZone(
- (nTokenValue & 1) ? sal_True : sal_False,
- PARDID->nHyphenzone );
- aHypenZone.SetPageEnd(
- (nTokenValue & 2) ? sal_True : sal_False );
-
- if( PARDID->nHyphenzone &&
- RTF_HYPHLEAD == GetNextToken() &&
- RTF_HYPHTRAIL == GetNextToken() &&
- RTF_HYPHMAX == GetNextToken() )
- {
- aHypenZone.GetMinLead() =
- sal_uInt8(GetStackPtr( -2 )->nTokenValue);
- aHypenZone.GetMinTrail() =
- sal_uInt8(GetStackPtr( -1 )->nTokenValue);
- aHypenZone.GetMaxHyphens() =
- sal_uInt8(nTokenValue);
-
- pSet->Put( aHypenZone );
- }
- else
- SkipGroup(); // at the end of the group
- }
- break;
-
- case RTF_SHADOW:
- {
- int bSkip = sal_True;
- do { // middle check loop
- SvxShadowLocation eSL = SvxShadowLocation( nTokenValue );
- if( RTF_SHDW_DIST != GetNextToken() )
- break;
- sal_uInt16 nDist = sal_uInt16( nTokenValue );
-
- if( RTF_SHDW_STYLE != GetNextToken() )
- break;
-
- if( RTF_SHDW_COL != GetNextToken() )
- break;
- sal_uInt16 nCol = sal_uInt16( nTokenValue );
-
- if( RTF_SHDW_FCOL != GetNextToken() )
- break;
-
- Color aColor = GetColor( nCol );
-
- if( PARDID->nShadow )
- pSet->Put( SvxShadowItem( PARDID->nShadow,
- &aColor, nDist, eSL ) );
-
- bSkip = sal_False;
- } while( sal_False );
-
- if( bSkip )
- SkipGroup(); // at the end of the group
- }
- break;
-
- default:
- bHandled = false;
- if( (nToken & ~(0xff | RTF_SWGDEFS)) == RTF_TABSTOPDEF )
- {
- nToken = SkipToken( -2 );
- ReadTabAttr( nToken, *pSet );
-
- /*
- cmc: #i76140, he who consumed the { must consume the }
- We rewound to a state of { being the current
- token so it is our responsibility to consume the }
- token if we consumed the {. We will not have consumed
- the { if it belonged to our caller, i.e. if the { we
- are handling is the "firsttoken" passed to us then
- the *caller* must consume it, not us. Otherwise *we*
- should consume it.
- */
- if (nToken == BRACELEFT && !bFirstToken)
- {
- nToken = GetNextToken();
- DBG_ASSERT( nToken == BRACERIGHT,
- "} did not follow { as expected\n");
- }
- }
- else if( (nToken & ~(0xff| RTF_SWGDEFS)) == RTF_BRDRDEF)
- {
- nToken = SkipToken( -2 );
- ReadBorderAttr( nToken, *pSet );
- }
- else // so no more attribute
- nSkip = -2;
- break;
- }
-
-#if 1
- /*
- cmc: #i4727# / #i12713# Who owns this closing bracket?
- If we read the opening one, we must read this one, if
- other is counting the brackets so as to push/pop off
- the correct environment then we will have pushed a new
- environment for the start { of this, but will not see
- the } and so is out of sync for the rest of the
- document.
- */
- if (bHandled && !bFirstToken)
- GetNextToken();
-#endif
- }
- else
- nSkip = -2;
-
- if( nSkip ) // all completely unknown
- {
- if (!bFirstToken)
- --nSkip; // BRACELEFT: is the next token
- SkipToken( nSkip );
- bWeiter = sal_False;
- }
- }
- break;
- default:
- if( (nToken & ~0xff ) == RTF_TABSTOPDEF )
- ReadTabAttr( nToken, *pSet );
- else if( (nToken & ~0xff ) == RTF_BRDRDEF )
- ReadBorderAttr( nToken, *pSet );
- else if( (nToken & ~0xff ) == RTF_SHADINGDEF )
- ReadBackgroundAttr( nToken, *pSet );
- else
- {
- // unknown token, so token "returned in Parser"
- if( !bFirstToken )
- SkipToken( -1 );
- bWeiter = sal_False;
- }
- }
- }
- if( bWeiter )
- {
- nToken = GetNextToken();
- }
- bFirstToken = sal_False;
- }
-}
-
-void SvxRTFParser::ReadTabAttr( int nToken, SfxItemSet& rSet )
-{
- bool bMethodOwnsToken = false; // #i52542# patch from cmc.
-// then read all the TabStops
- SvxTabStop aTabStop;
- SvxTabStopItem aAttr( 0, 0, SVX_TAB_ADJUST_DEFAULT, PARDID->nTabStop );
- int bWeiter = sal_True;
- do {
- switch( nToken )
- {
- case RTF_TB: // BarTab ???
- case RTF_TX:
- {
- if( IsCalcValue() )
- CalcValue();
- aTabStop.GetTabPos() = nTokenValue;
- aAttr.Insert( aTabStop );
- aTabStop = SvxTabStop(); // all values default
- }
- break;
-
- case RTF_TQL:
- aTabStop.GetAdjustment() = SVX_TAB_ADJUST_LEFT;
- break;
- case RTF_TQR:
- aTabStop.GetAdjustment() = SVX_TAB_ADJUST_RIGHT;
- break;
- case RTF_TQC:
- aTabStop.GetAdjustment() = SVX_TAB_ADJUST_CENTER;
- break;
- case RTF_TQDEC:
- aTabStop.GetAdjustment() = SVX_TAB_ADJUST_DECIMAL;
- break;
-
- case RTF_TLDOT: aTabStop.GetFill() = '.'; break;
- case RTF_TLHYPH: aTabStop.GetFill() = ' '; break;
- case RTF_TLUL: aTabStop.GetFill() = '_'; break;
- case RTF_TLTH: aTabStop.GetFill() = '-'; break;
- case RTF_TLEQ: aTabStop.GetFill() = '='; break;
-
- case BRACELEFT:
- {
- // Swg - control BRACELEFT RTF_IGNOREFLAG RTF_TLSWG BRACERIGHT
- short nSkip = 0;
- if( RTF_IGNOREFLAG != GetNextToken() )
- nSkip = -1;
- else if( RTF_TLSWG != ( nToken = GetNextToken() ))
- nSkip = -2;
- else
- {
- aTabStop.GetDecimal() = sal_uInt8(nTokenValue & 0xff);
- aTabStop.GetFill() = sal_uInt8((nTokenValue >> 8) & 0xff);
- // overwrite the closing parenthesis
- if (bMethodOwnsToken)
- GetNextToken();
- }
- if( nSkip )
- {
- SkipToken( nSkip ); // Ignore back again
- bWeiter = sal_False;
- }
- }
- break;
-
- default:
- bWeiter = sal_False;
- }
- if( bWeiter )
- {
- nToken = GetNextToken();
- bMethodOwnsToken = true;
- }
- } while( bWeiter );
-
- // Fill with defaults is still missing!
- rSet.Put( aAttr );
- SkipToken( -1 );
-}
-
-static void SetBorderLine( int nBorderTyp, SvxBoxItem& rItem,
- const SvxBorderLine& rBorder )
-{
- switch( nBorderTyp )
- {
- case RTF_BOX: // run through all levels
-
- case RTF_BRDRT:
- rItem.SetLine( &rBorder, BOX_LINE_TOP );
- if( RTF_BOX != nBorderTyp )
- return;
-
- case RTF_BRDRB:
- rItem.SetLine( &rBorder, BOX_LINE_BOTTOM );
- if( RTF_BOX != nBorderTyp )
- return;
-
- case RTF_BRDRL:
- rItem.SetLine( &rBorder, BOX_LINE_LEFT );
- if( RTF_BOX != nBorderTyp )
- return;
-
- case RTF_BRDRR:
- rItem.SetLine( &rBorder, BOX_LINE_RIGHT );
- if( RTF_BOX != nBorderTyp )
- return;
- }
-}
-
-void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet,
- int bTableDef )
-{
- // 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 ); // Simple plain line
- int bWeiter = sal_True, nBorderTyp = 0;
-
- long nWidth = 1;
- bool bDoubleWidth = false;
-
- do {
- switch( nToken )
- {
- case RTF_BOX:
- case RTF_BRDRT:
- case RTF_BRDRB:
- case RTF_BRDRL:
- case RTF_BRDRR:
- nBorderTyp = nToken;
- break;
-
- case RTF_CLBRDRT: // Cell top border
- {
- if( bTableDef )
- {
- if (nBorderTyp != 0)
- SetBorderLine( nBorderTyp, aAttr, aBrd );
- nBorderTyp = RTF_BRDRT;
- }
- break;
- }
- case RTF_CLBRDRB: // Cell bottom border
- {
- if( bTableDef )
- {
- if (nBorderTyp != 0)
- SetBorderLine( nBorderTyp, aAttr, aBrd );
- nBorderTyp = RTF_BRDRB;
- }
- break;
- }
- case RTF_CLBRDRL: // Cell left border
- {
- if( bTableDef )
- {
- if (nBorderTyp != 0)
- SetBorderLine( nBorderTyp, aAttr, aBrd );
- nBorderTyp = RTF_BRDRL;
- }
- break;
- }
- case RTF_CLBRDRR: // Cell right border
- {
- if( bTableDef )
- {
- if (nBorderTyp != 0)
- SetBorderLine( nBorderTyp, aAttr, aBrd );
- nBorderTyp = RTF_BRDRR;
- }
- break;
- }
-
- case RTF_BRDRDOT: // dotted border
- aBrd.SetStyle( DOTTED );
- break;
- case RTF_BRDRDASH: // dashed border
- aBrd.SetStyle( DASHED );
- break;
- case RTF_BRDRHAIR: // hairline border
- {
- 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;
-
- case RTF_BRDRCF: // Border color
- aBrd.SetColor( GetColor( sal_uInt16(nTokenValue) ) );
- break;
-
- case RTF_BRDRSH: // Shadowed border
- rSet.Put( SvxShadowItem( PARDID->nShadow, (Color*) 0, 60 /*3pt*/,
- SVX_SHADOW_BOTTOMRIGHT ) );
- break;
-
- case RTF_BRSP: // Spacing to content in twip
- {
- switch( nBorderTyp )
- {
- case RTF_BRDRB:
- aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_BOTTOM );
- break;
-
- case RTF_BRDRT:
- aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_TOP );
- break;
-
- case RTF_BRDRL:
- aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_LEFT );
- break;
-
- case RTF_BRDRR:
- aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_RIGHT );
- break;
-
- case RTF_BOX:
- aAttr.SetDistance( (sal_uInt16)nTokenValue );
- break;
- }
- }
- break;
-
- case RTF_BRDRBTW: // Border formatting group
- case RTF_BRDRBAR: // Border outside
- // TODO unhandled ATM
- break;
-
- default:
- bWeiter = (nToken & ~(0xff| RTF_SWGDEFS)) == RTF_BRDRDEF;
- }
- if( bWeiter )
- nToken = GetNextToken();
- } while( bWeiter );
-
- // Finally compute the border width
- if ( bDoubleWidth ) nWidth *= 2;
- aBrd.SetWidth( nWidth );
-
- SetBorderLine( nBorderTyp, aAttr, aBrd );
-
- rSet.Put( aAttr );
- SkipToken( -1 );
-}
-
-inline sal_uInt32 CalcShading( sal_uInt32 nColor, sal_uInt32 nFillColor, sal_uInt8 nShading )
-{
- nColor = (nColor * nShading) / 100;
- nFillColor = (nFillColor * ( 100 - nShading )) / 100;
- return nColor + nFillColor;
-}
-
-void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet,
- int bTableDef )
-{
- // then read the border attribute
- int bWeiter = sal_True;
- sal_uInt16 nColor = USHRT_MAX, nFillColor = USHRT_MAX;
- sal_uInt8 nFillValue = 0;
-
- sal_uInt16 nWh = ( nToken & ~0xff ) == RTF_CHRFMT
- ? PLAINID->nBgColor
- : PARDID->nBrush;
-
- do {
- switch( nToken )
- {
- case RTF_CLCBPAT:
- case RTF_CHCBPAT:
- case RTF_CBPAT:
- nFillColor = sal_uInt16( nTokenValue );
- break;
-
- case RTF_CLCFPAT:
- case RTF_CHCFPAT:
- case RTF_CFPAT:
- nColor = sal_uInt16( nTokenValue );
- break;
-
- case RTF_CLSHDNG:
- case RTF_CHSHDNG:
- case RTF_SHADING:
- nFillValue = (sal_uInt8)( nTokenValue / 100 );
- break;
-
- case RTF_CLBGDKHOR:
- case RTF_CHBGDKHORIZ:
- case RTF_BGDKHORIZ:
- case RTF_CLBGDKVERT:
- case RTF_CHBGDKVERT:
- case RTF_BGDKVERT:
- case RTF_CLBGDKBDIAG:
- case RTF_CHBGDKBDIAG:
- case RTF_BGDKBDIAG:
- case RTF_CLBGDKFDIAG:
- case RTF_CHBGDKFDIAG:
- case RTF_BGDKFDIAG:
- case RTF_CLBGDKCROSS:
- case RTF_CHBGDKCROSS:
- case RTF_BGDKCROSS:
- case RTF_CLBGDKDCROSS:
- case RTF_CHBGDKDCROSS:
- case RTF_BGDKDCROSS:
- // dark -> 60%
- nFillValue = 60;
- break;
-
- case RTF_CLBGHORIZ:
- case RTF_CHBGHORIZ:
- case RTF_BGHORIZ:
- case RTF_CLBGVERT:
- case RTF_CHBGVERT:
- case RTF_BGVERT:
- case RTF_CLBGBDIAG:
- case RTF_CHBGBDIAG:
- case RTF_BGBDIAG:
- case RTF_CLBGFDIAG:
- case RTF_CHBGFDIAG:
- case RTF_BGFDIAG:
- case RTF_CLBGCROSS:
- case RTF_CHBGCROSS:
- case RTF_BGCROSS:
- case RTF_CLBGDCROSS:
- case RTF_CHBGDCROSS:
- case RTF_BGDCROSS:
- // light -> 20%
- nFillValue = 20;
- break;
-
- default:
- if( bTableDef )
- bWeiter = (nToken & ~(0xff | RTF_TABLEDEF) ) == RTF_SHADINGDEF;
- else
- bWeiter = (nToken & ~0xff) == RTF_SHADINGDEF;
- }
- if( bWeiter )
- nToken = GetNextToken();
- } while( bWeiter );
-
- Color aCol( COL_WHITE ), aFCol;
- if( !nFillValue )
- {
- // there was only one of two colors specified or no BrushTyp
- if( USHRT_MAX != nFillColor )
- {
- nFillValue = 100;
- aCol = GetColor( nFillColor );
- }
- else if( USHRT_MAX != nColor )
- aFCol = GetColor( nColor );
- }
- else
- {
- if( USHRT_MAX != nColor )
- aCol = GetColor( nColor );
- else
- aCol = Color( COL_BLACK );
-
- if( USHRT_MAX != nFillColor )
- aFCol = GetColor( nFillColor );
- else
- aFCol = Color( COL_WHITE );
- }
-
- Color aColor;
- if( 0 == nFillValue || 100 == nFillValue )
- aColor = aCol;
- else
- aColor = Color(
- (sal_uInt8)CalcShading( aCol.GetRed(), aFCol.GetRed(), nFillValue ),
- (sal_uInt8)CalcShading( aCol.GetGreen(), aFCol.GetGreen(), nFillValue ),
- (sal_uInt8)CalcShading( aCol.GetBlue(), aFCol.GetBlue(), nFillValue ) );
-
- rSet.Put( SvxBrushItem( aColor, nWh ) );
- SkipToken( -1 );
-}
-
-
-// pard / plain abarbeiten
-void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet )
-{
- if( !bNewGroup && !aAttrStack.empty() ) // not at the beginning of a new group
- {
- SvxRTFItemStackType* pAkt = aAttrStack.back();
-
- int nLastToken = GetStackPtr(-1)->nTokenId;
- int bNewStkEntry = sal_True;
- if( RTF_PARD != nLastToken &&
- RTF_PLAIN != nLastToken &&
- BRACELEFT != nLastToken )
- {
- if( pAkt->aAttrSet.Count() || pAkt->pChildList || pAkt->nStyleNo )
- {
- // open a new group
- SvxRTFItemStackType* pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, sal_True );
- pNew->SetRTFDefaults( GetRTFDefaults() );
-
- // 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 );
- aAttrStack.push_back( pNew );
- pAkt = pNew;
- }
- else
- {
- // continue to use this entry as new
- pAkt->SetStartPos( *pInsPos );
- bNewStkEntry = sal_False;
- }
- }
-
- // now reset all to default
- if( bNewStkEntry &&
- ( pAkt->aAttrSet.GetParent() || pAkt->aAttrSet.Count() ))
- {
- const SfxPoolItem *pItem, *pDef;
- const sal_uInt16* pPtr;
- sal_uInt16 nCnt;
- const SfxItemSet* pDfltSet = &GetRTFDefaults();
- if( bPard )
- {
- pAkt->nStyleNo = 0;
- pPtr = aPardMap.GetData();
- nCnt = aPardMap.Count();
- }
- else
- {
- pPtr = aPlainMap.GetData();
- nCnt = aPlainMap.Count();
- }
-
- for( sal_uInt16 n = 0; n < nCnt; ++n, ++pPtr )
- {
- // Item set and different -> Set the Default Pool
- if( !*pPtr )
- ;
- else if( SFX_WHICH_MAX < *pPtr )
- pAkt->aAttrSet.ClearItem( *pPtr );
- else if( IsChkStyleAttr() )
- pAkt->aAttrSet.Put( pDfltSet->Get( *pPtr ) );
- else if( !pAkt->aAttrSet.GetParent() )
- {
- if( SFX_ITEM_SET ==
- pDfltSet->GetItemState( *pPtr, sal_False, &pDef ))
- pAkt->aAttrSet.Put( *pDef );
- else
- pAkt->aAttrSet.ClearItem( *pPtr );
- }
- else if( SFX_ITEM_SET == pAkt->aAttrSet.GetParent()->
- GetItemState( *pPtr, sal_True, &pItem ) &&
- *( pDef = &pDfltSet->Get( *pPtr )) != *pItem )
- pAkt->aAttrSet.Put( *pDef );
- else
- {
- if( SFX_ITEM_SET ==
- pDfltSet->GetItemState( *pPtr, sal_False, &pDef ))
- pAkt->aAttrSet.Put( *pDef );
- else
- pAkt->aAttrSet.ClearItem( *pPtr );
- }
- }
- }
- else if( bPard )
- pAkt->nStyleNo = 0; // reset Style number
-
- *ppSet = &pAkt->aAttrSet;
-
- if (!bPard)
- {
- //Once we have a default font, then any text without a font specifier is
- //in the default font, and thus has the default font charset, otherwise
- //we can fall back to the ansicpg set codeset
- if (nDfltFont != -1)
- {
- const Font& rSVFont = GetFont(sal_uInt16(nDfltFont));
- SetEncoding(rSVFont.GetCharSet());
- }
- else
- SetEncoding(GetCodeSet());
- }
- }
-}
-
-void SvxRTFParser::SetDefault( int nToken, int nValue )
-{
- if( !bNewDoc )
- return;
-
- SfxItemSet aTmp( *pAttrPool, aWhichMap.GetData() );
- sal_Bool bOldFlag = bIsLeftToRightDef;
- bIsLeftToRightDef = sal_True;
- switch( nToken )
- {
- case RTF_ADEFF: bIsLeftToRightDef = sal_False; // no break!
- case RTF_DEFF:
- {
- if( -1 == nValue )
- nValue = 0;
- const Font& rSVFont = GetFont( sal_uInt16(nValue) );
- SvxFontItem aTmpItem(
- rSVFont.GetFamily(), rSVFont.GetName(),
- rSVFont.GetStyleName(), rSVFont.GetPitch(),
- rSVFont.GetCharSet(), SID_ATTR_CHAR_FONT );
- SetScriptAttr( NOTDEF_CHARTYPE, aTmp, aTmpItem );
- }
- break;
-
- case RTF_ADEFLANG: bIsLeftToRightDef = sal_False; // no break!
- case RTF_DEFLANG:
- // store default Language
- if( -1 != nValue )
- {
- SvxLanguageItem aTmpItem( (const LanguageType)nValue,
- SID_ATTR_CHAR_LANGUAGE );
- SetScriptAttr( NOTDEF_CHARTYPE, aTmp, aTmpItem );
- }
- break;
-
- case RTF_DEFTAB:
- if( PARDID->nTabStop )
- {
- // RTF defines 720 twips as default
- bIsSetDfltTab = sal_True;
- if( -1 == nValue || !nValue )
- nValue = 720;
-
- // who would like to have no twips ...
- if( IsCalcValue() )
- {
- nTokenValue = nValue;
- CalcValue();
- nValue = nTokenValue;
- }
-
- // Calculate the ratio of default TabWidth / Tabs and
- // calculate the corresponding new number.
- // ?? how did one come up with 13 ??
- sal_uInt16 nAnzTabs = (SVX_TAB_DEFDIST * 13 ) / sal_uInt16(nValue);
- /*
- cmc, make sure we have at least one, or all hell breaks loose in
- everybodies exporters, #i8247#
- */
- if (nAnzTabs < 1)
- nAnzTabs = 1;
-
- // we want Defaulttabs
- SvxTabStopItem aNewTab( nAnzTabs, sal_uInt16(nValue),
- SVX_TAB_ADJUST_DEFAULT, PARDID->nTabStop );
- while( nAnzTabs )
- ((SvxTabStop&)aNewTab[ --nAnzTabs ]).GetAdjustment() = SVX_TAB_ADJUST_DEFAULT;
-
- pAttrPool->SetPoolDefaultItem( aNewTab );
- }
- break;
- }
- bIsLeftToRightDef = bOldFlag;
-
- if( aTmp.Count() )
- {
- SfxItemIter aIter( aTmp );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- while( sal_True )
- {
- pAttrPool->SetPoolDefaultItem( *pItem );
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
- }
- }
-}
-
-// default: no conversion, leaving everything in twips.
-void SvxRTFParser::CalcValue()
-{
-}
-
-// for tokens that are not evaluated in ReadAttr
-void SvxRTFParser::UnknownAttrToken( int, SfxItemSet* )
-{
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
deleted file mode 100644
index 0041f87fcf..0000000000
--- a/editeng/source/rtf/svxrtf.cxx
+++ /dev/null
@@ -1,1433 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <ctype.h>
-#include <tools/datetime.hxx>
-#include <rtl/tencinfo.h>
-#include <svl/itemiter.hxx>
-#include <svl/whiter.hxx>
-#include <svtools/rtftoken.h>
-#include <svl/itempool.hxx>
-
-#include <comphelper/string.hxx>
-
-#include <com/sun/star/lang/Locale.hpp>
-#include <editeng/scriptspaceitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/svxrtf.hxx>
-#include <editeng/editids.hrc>
-#include <vcl/svapp.hxx>
-
-#include <com/sun/star/document/XDocumentProperties.hpp>
-
-
-using namespace ::com::sun::star;
-
-
-SV_IMPL_PTRARR( SvxRTFItemStackList, SvxRTFItemStackType* )
-
-CharSet lcl_GetDefaultTextEncodingForRTF()
-{
-
- ::com::sun::star::lang::Locale aLocale;
- ::rtl::OUString aLangString;
-
- aLocale = Application::GetSettings().GetLocale();
- aLangString = aLocale.Language;
-
- 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(RTL_CONSTASCII_USTRINGPARAM( "tr" )) ) )
- return RTL_TEXTENCODING_MS_1254;
- else
- return RTL_TEXTENCODING_MS_1252;
-}
-
-// -------------- Methods --------------------
-
-SvxRTFParser::SvxRTFParser( SfxItemPool& rPool, SvStream& rIn,
- uno::Reference<document::XDocumentProperties> i_xDocProps,
- int bReadNewDoc )
- : SvRTFParser( rIn, 5 ),
- rStrm(rIn),
- aFontTbl( 16, 4 ),
- pInsPos( 0 ),
- pAttrPool( &rPool ),
- m_xDocProps( i_xDocProps ),
- pRTFDefaults( 0 ),
- nVersionNo( 0 )
-{
- bNewDoc = bReadNewDoc;
-
- bChkStyleAttr = bCalcValue = bReadDocInfo = bIsInReadStyleTab = sal_False;
- bIsLeftToRightDef = sal_True;
-
- {
- RTFPlainAttrMapIds aTmp( rPool );
- aPlainMap.Insert( (sal_uInt16*)&aTmp,
- sizeof( RTFPlainAttrMapIds ) / sizeof(sal_uInt16), 0 );
- }
- {
- RTFPardAttrMapIds aTmp( rPool );
- aPardMap.Insert( (sal_uInt16*)&aTmp,
- sizeof( RTFPardAttrMapIds ) / sizeof(sal_uInt16), 0 );
- }
- pDfltFont = new Font;
- pDfltColor = new Color;
-}
-
-void SvxRTFParser::EnterEnvironment()
-{
-}
-
-void SvxRTFParser::LeaveEnvironment()
-{
-}
-
-void SvxRTFParser::ResetPard()
-{
-}
-
-SvxRTFParser::~SvxRTFParser()
-{
- if( !aColorTbl.empty() )
- ClearColorTbl();
- if( aFontTbl.Count() )
- ClearFontTbl();
- if( aStyleTbl.Count() )
- ClearStyleTbl();
- if( !aAttrStack.empty() )
- ClearAttrStack();
-
- delete pRTFDefaults;
-
- delete pInsPos;
- delete pDfltFont;
- delete pDfltColor;
-}
-
-void SvxRTFParser::SetInsPos( const SvxPosition& rNew )
-{
- if( pInsPos )
- delete pInsPos;
- pInsPos = rNew.Clone();
-}
-
-SvParserState SvxRTFParser::CallParser()
-{
- DBG_ASSERT( pInsPos, "no insertion position");
-
- if( !pInsPos )
- return SVPAR_ERROR;
-
- if( !aColorTbl.empty() )
- ClearColorTbl();
- if( aFontTbl.Count() )
- ClearFontTbl();
- if( aStyleTbl.Count() )
- ClearStyleTbl();
- if( !aAttrStack.empty() )
- ClearAttrStack();
-
- bIsSetDfltTab = sal_False;
- bNewGroup = sal_False;
- nDfltFont = 0;
-
- sBaseURL.Erase();
-
- // generate the correct WhichId table from the set WhichIds.
- BuildWhichTbl();
-
- return SvRTFParser::CallParser();
-}
-
-void SvxRTFParser::Continue( int nToken )
-{
- SvRTFParser::Continue( nToken );
-
- if( SVPAR_PENDING != GetStatus() )
- {
- SetAllAttrOfStk();
- //Regardless of what "color 0" is, word defaults to auto as the default colour.
- //e.g. see #i7713#
- }
-}
-
-
-// is called for each token that is recognized in CallParser
-void SvxRTFParser::NextToken( int nToken )
-{
- sal_Unicode cCh;
- switch( nToken )
- {
- case RTF_COLORTBL: ReadColorTable(); break;
- case RTF_FONTTBL: ReadFontTable(); break;
- case RTF_STYLESHEET: ReadStyleTable(); break;
-
- case RTF_DEFF:
- if( bNewDoc )
- {
- if( aFontTbl.Count() )
- // Can immediately be set
- SetDefault( nToken, nTokenValue );
- else
- // is set after reading the font table
- nDfltFont = int(nTokenValue);
- }
- break;
-
- case RTF_DEFTAB:
- case RTF_DEFLANG:
- if( bNewDoc )
- SetDefault( nToken, nTokenValue );
- break;
-
-
- case RTF_PICT: ReadBitmapData(); break;
-
- case RTF_LINE: cCh = '\n'; goto INSINGLECHAR;
- case RTF_TAB: cCh = '\t'; goto INSINGLECHAR;
- case RTF_SUBENTRYINDEX: cCh = ':'; goto INSINGLECHAR;
-
- case RTF_EMDASH: cCh = 151; goto INSINGLECHAR;
- case RTF_ENDASH: cCh = 150; goto INSINGLECHAR;
- case RTF_BULLET: cCh = 149; goto INSINGLECHAR;
- case RTF_LQUOTE: cCh = 145; goto INSINGLECHAR;
- case RTF_RQUOTE: cCh = 146; goto INSINGLECHAR;
- case RTF_LDBLQUOTE: cCh = 147; goto INSINGLECHAR;
- case RTF_RDBLQUOTE: cCh = 148; goto INSINGLECHAR;
-INSINGLECHAR:
- aToken = ByteString::ConvertToUnicode( (sal_Char)cCh,
- RTL_TEXTENCODING_MS_1252 );
-
- // no Break, aToken is set as Text
- case RTF_TEXTTOKEN:
- {
- InsertText();
- // all collected Attributes are set
- for( sal_uInt16 n = aAttrSetList.Count(); n; )
- {
- SvxRTFItemStackType* pStkSet = aAttrSetList[--n];
- SetAttrSet( *pStkSet );
- aAttrSetList.DeleteAndDestroy( n );
- }
- }
- break;
-
-
- case RTF_PAR:
- InsertPara();
- break;
- case '{':
- if (bNewGroup) // Nesting!
- _GetAttrSet();
- EnterEnvironment();
- bNewGroup = true;
- break;
- case '}':
- if( !bNewGroup ) // Empty Group ??
- AttrGroupEnd();
- LeaveEnvironment();
- bNewGroup = false;
- break;
- case RTF_INFO:
- if (bReadDocInfo && bNewDoc && m_xDocProps.is())
- ReadInfo();
- else
- SkipGroup();
- break;
-
- // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- // 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:
- case RTF_ATNID:
- case RTF_ANNOTATION:
-
- case RTF_BKMKSTART:
- case RTF_BKMKEND:
- case RTF_BKMK_KEY:
- case RTF_XE:
- case RTF_TC:
- case RTF_NEXTFILE:
- case RTF_TEMPLATE:
- // RTF_SHPRSLT disabled for #i19718#
- SkipGroup();
- break;
- // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
- case RTF_PGDSCNO:
- case RTF_PGBRK:
- case RTF_SHADOW:
- if( RTF_IGNOREFLAG != GetStackPtr( -1 )->nTokenId )
- break;
- nToken = SkipToken( -1 );
- if( '{' == GetStackPtr( -1 )->nTokenId )
- nToken = SkipToken( -1 );
-
- ReadAttr( nToken, &GetAttrSet() );
- break;
-
- default:
- switch( nToken & ~(0xff | RTF_SWGDEFS) )
- {
- case RTF_PARFMT: // hier gibts keine Swg-Defines
- ReadAttr( nToken, &GetAttrSet() );
- break;
-
- case RTF_CHRFMT:
- case RTF_BRDRDEF:
- case RTF_TABSTOPDEF:
-
- if( RTF_SWGDEFS & nToken)
- {
- if( RTF_IGNOREFLAG != GetStackPtr( -1 )->nTokenId )
- break;
- nToken = SkipToken( -1 );
- if( '{' == GetStackPtr( -1 )->nTokenId )
- {
- nToken = SkipToken( -1 );
- }
- }
- ReadAttr( nToken, &GetAttrSet() );
- break;
- default:
- {
- if( /*( '{' == GetStackPtr( -1 )->nTokenId ) ||*/
- ( RTF_IGNOREFLAG == GetStackPtr( -1 )->nTokenId &&
- '{' == GetStackPtr( -2 )->nTokenId ) )
- SkipGroup();
- }
- break;
- }
- break;
- }
-}
-
-void SvxRTFParser::ReadStyleTable()
-{
- int nToken, bSaveChkStyleAttr = bChkStyleAttr;
- short nStyleNo = 0;
- 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; // Do not check Attribute against the Styles
-
- while( _nOpenBrakets && IsParserWorking() )
- {
- switch( nToken = GetNextToken() )
- {
- case '}': if( --_nOpenBrakets && IsParserWorking() )
- // Style has been completely read,
- // so this is still a stable status
- SaveState( RTF_STYLESHEET );
- break;
- case '{':
- {
- if( RTF_IGNOREFLAG != GetNextToken() )
- nToken = SkipToken( -1 );
- else if( RTF_UNKNOWNCONTROL != ( nToken = GetNextToken() ) &&
- RTF_PN != nToken )
- nToken = SkipToken( -2 );
- else
- {
- // filter out at once
- ReadUnknownData();
- nToken = GetNextToken();
- if( '}' != nToken )
- eState = SVPAR_ERROR;
- break;
- }
- ++_nOpenBrakets;
- }
- break;
-
- case RTF_SBASEDON: pStyle->nBasedOn = sal_uInt16(nTokenValue); pStyle->bBasedOnIsSet=sal_True; break;
- case RTF_SNEXT: pStyle->nNext = sal_uInt16(nTokenValue); break;
- case RTF_OUTLINELEVEL:
- case RTF_SOUTLVL: pStyle->nOutlineNo = sal_uInt8(nTokenValue); break;
- case RTF_S: nStyleNo = (short)nTokenValue; break;
- case RTF_CS: nStyleNo = (short)nTokenValue;
- pStyle->bIsCharFmt = sal_True;
- break;
-
- case RTF_TEXTTOKEN:
- {
- pStyle->sName = DelCharAtEnd( aToken, ';' );
-
- if( aStyleTbl.Count() )
- {
- SvxRTFStyleType* pOldSt = aStyleTbl.Remove( nStyleNo );
- if( pOldSt )
- delete pOldSt;
- }
- // 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() );
- nStyleNo = 0;
- }
- break;
- default:
- switch( nToken & ~(0xff | RTF_SWGDEFS) )
- {
- case RTF_PARFMT: // hier gibts keine Swg-Defines
- ReadAttr( nToken, &pStyle->aAttrSet );
- break;
-
- case RTF_CHRFMT:
- case RTF_BRDRDEF:
- case RTF_TABSTOPDEF:
-
- if( RTF_SWGDEFS & nToken)
- {
- if( RTF_IGNOREFLAG != GetStackPtr( -1 )->nTokenId )
- break;
- nToken = SkipToken( -1 );
- if( '{' == GetStackPtr( -1 )->nTokenId )
- {
- nToken = SkipToken( -1 );
- }
- }
- ReadAttr( nToken, &pStyle->aAttrSet );
- break;
- }
- break;
- }
- }
- delete pStyle; // Delete the Last Style
- SkipToken( -1 ); // the closing brace is evaluated "above"
-
- // Flag back to old state
- bChkStyleAttr = bSaveChkStyleAttr;
- bIsInReadStyleTab = sal_False;
-}
-
-void SvxRTFParser::ReadColorTable()
-{
- int nToken;
- sal_uInt8 nRed = 0xff, nGreen = 0xff, nBlue = 0xff;
-
- while( '}' != ( nToken = GetNextToken() ) && IsParserWorking() )
- {
- switch( nToken )
- {
- case RTF_RED: nRed = sal_uInt8(nTokenValue); break;
- case RTF_GREEN: nGreen = sal_uInt8(nTokenValue); break;
- case RTF_BLUE: nBlue = sal_uInt8(nTokenValue); break;
-
- case RTF_TEXTTOKEN:
- if( 1 == aToken.Len()
- ? aToken.GetChar( 0 ) != ';'
- : STRING_NOTFOUND == aToken.Search( ';' ) )
- break; // At least the ';' must be found
-
- // else no break !!
-
- case ';':
- if( IsParserWorking() )
- {
- // 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 )
- pColor->SetColor( COL_AUTO );
- aColorTbl.push_back( pColor );
- nRed = 0, nGreen = 0, nBlue = 0;
-
- // Color has been completely read,
- // so this is still a stable status
- SaveState( RTF_COLORTBL );
- }
- break;
- }
- }
- SkipToken( -1 ); // the closing brace is evaluated "above"
-}
-
-void SvxRTFParser::ReadFontTable()
-{
- int nToken;
- int _nOpenBrakets = 1; // the first was already detected earlier!!
- Font* pFont = new Font();
- short nFontNo(0), nInsFontNo (0);
- String sAltNm, sFntNm;
- sal_Bool bIsAltFntNm = sal_False, bCheckNewFont;
-
- CharSet nSystemChar = lcl_GetDefaultTextEncodingForRTF();
- pFont->SetCharSet( nSystemChar );
- SetEncoding( nSystemChar );
-
- while( _nOpenBrakets && IsParserWorking() )
- {
- bCheckNewFont = sal_False;
- switch( ( nToken = GetNextToken() ))
- {
- case '}':
- bIsAltFntNm = sal_False;
- // Style has been completely read,
- // so this is still a stable status
- if( --_nOpenBrakets <= 1 && IsParserWorking() )
- SaveState( RTF_FONTTBL );
- bCheckNewFont = sal_True;
- nInsFontNo = nFontNo;
- break;
- case '{':
- if( RTF_IGNOREFLAG != GetNextToken() )
- nToken = SkipToken( -1 );
- // 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
- {
- // filter out at once
- ReadUnknownData();
- nToken = GetNextToken();
- if( '}' != nToken )
- eState = SVPAR_ERROR;
- break;
- }
- ++_nOpenBrakets;
- break;
- case RTF_FROMAN:
- pFont->SetFamily( FAMILY_ROMAN );
- break;
- case RTF_FSWISS:
- pFont->SetFamily( FAMILY_SWISS );
- break;
- case RTF_FMODERN:
- pFont->SetFamily( FAMILY_MODERN );
- break;
- case RTF_FSCRIPT:
- pFont->SetFamily( FAMILY_SCRIPT );
- break;
- case RTF_FDECOR:
- pFont->SetFamily( FAMILY_DECORATIVE );
- break;
- // for technical/symbolic font of the CharSet is changed!
- case RTF_FTECH:
- pFont->SetCharSet( RTL_TEXTENCODING_SYMBOL );
- // deliberate fall through
- case RTF_FNIL:
- pFont->SetFamily( FAMILY_DONTKNOW );
- break;
- case RTF_FCHARSET:
- if (-1 != nTokenValue)
- {
- CharSet nCharSet = rtl_getTextEncodingFromWindowsCharset(
- (sal_uInt8)nTokenValue);
- pFont->SetCharSet(nCharSet);
- //When we're in a font, the fontname is in the font
- //charset, except for symbol fonts I believe
- if (nCharSet == RTL_TEXTENCODING_SYMBOL)
- nCharSet = RTL_TEXTENCODING_DONTKNOW;
- SetEncoding(nCharSet);
- }
- break;
- case RTF_FPRQ:
- switch( nTokenValue )
- {
- case 1:
- pFont->SetPitch( PITCH_FIXED );
- break;
- case 2:
- pFont->SetPitch( PITCH_VARIABLE );
- break;
- }
- break;
- case RTF_F:
- bCheckNewFont = sal_True;
- nInsFontNo = nFontNo;
- nFontNo = (short)nTokenValue;
- break;
- case RTF_FALT:
- bIsAltFntNm = sal_True;
- break;
- case RTF_TEXTTOKEN:
- DelCharAtEnd( aToken, ';' );
- if ( aToken.Len() )
- {
- if( bIsAltFntNm )
- sAltNm = aToken;
- else
- sFntNm = aToken;
- }
- break;
- }
-
- if( bCheckNewFont && 1 >= _nOpenBrakets && sFntNm.Len() ) // one font is ready
- {
- // All data from the font is available, so off to the table
- if (sAltNm.Len())
- (sFntNm += ';' ) += sAltNm;
-
- pFont->SetName( sFntNm );
- aFontTbl.Insert( nInsFontNo, pFont );
- pFont = new Font();
- pFont->SetCharSet( nSystemChar );
- sAltNm.Erase();
- sFntNm.Erase();
- }
- }
- // the last one we have to delete manually
- delete pFont;
- SkipToken( -1 ); // the closing brace is evaluated "above"
-
- // set the default font in the Document
- if( bNewDoc && IsParserWorking() )
- SetDefault( RTF_DEFF, nDfltFont );
-}
-
-void SvxRTFParser::ReadBitmapData()
-{
- SvRTFParser::ReadBitmapData();
-}
-
-void SvxRTFParser::ReadOLEData()
-{
- SvRTFParser::ReadOLEData();
-}
-
-String& SvxRTFParser::GetTextToEndGroup( String& rStr )
-{
- rStr.Erase( 0 );
- int _nOpenBrakets = 1, nToken; // the first was already detected earlier!!
-
- while( _nOpenBrakets && IsParserWorking() )
- {
- switch( nToken = GetNextToken() )
- {
- case '}': --_nOpenBrakets; break;
- case '{':
- {
- if( RTF_IGNOREFLAG != GetNextToken() )
- nToken = SkipToken( -1 );
- else if( RTF_UNKNOWNCONTROL != GetNextToken() )
- nToken = SkipToken( -2 );
- else
- {
- // filter out at once
- ReadUnknownData();
- nToken = GetNextToken();
- if( '}' != nToken )
- eState = SVPAR_ERROR;
- break;
- }
- ++_nOpenBrakets;
- }
- break;
-
- case RTF_TEXTTOKEN:
- rStr += aToken;
- break;
- }
- }
- SkipToken( -1 ); // the closing brace is evaluated "above"
- return rStr;
-}
-
-util::DateTime SvxRTFParser::GetDateTimeStamp( )
-{
- util::DateTime aDT;
- sal_Bool bWeiter = sal_True;
- int nToken;
- while( bWeiter && IsParserWorking() )
- {
- switch( nToken = GetNextToken() )
- {
- case RTF_YR: aDT.Year = (sal_uInt16)nTokenValue; break;
- case RTF_MO: aDT.Month = (sal_uInt16)nTokenValue; break;
- case RTF_DY: aDT.Day = (sal_uInt16)nTokenValue; break;
- case RTF_HR: aDT.Hours = (sal_uInt16)nTokenValue; break;
- case RTF_MIN: aDT.Minutes = (sal_uInt16)nTokenValue; break;
- default:
- bWeiter = sal_False;
- }
- }
- SkipToken( -1 ); // the closing brace is evaluated "above"
- return aDT;
-}
-
-void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo )
-{
- int _nOpenBrakets = 1, nToken; // the first was already detected earlier!!
- DBG_ASSERT(m_xDocProps.is(),
- "SvxRTFParser::ReadInfo: no DocumentProperties");
- String sStr, sComment;
- long nVersNo = 0;
-
- while( _nOpenBrakets && IsParserWorking() )
- {
- switch( nToken = GetNextToken() )
- {
- case '}': --_nOpenBrakets; break;
- case '{':
- {
- if( RTF_IGNOREFLAG != GetNextToken() )
- nToken = SkipToken( -1 );
- else if( RTF_UNKNOWNCONTROL != GetNextToken() )
- nToken = SkipToken( -2 );
- else
- {
- // filter out at once
- ReadUnknownData();
- nToken = GetNextToken();
- if( '}' != nToken )
- eState = SVPAR_ERROR;
- break;
- }
- ++_nOpenBrakets;
- }
- break;
-
- case RTF_TITLE:
- m_xDocProps->setTitle( GetTextToEndGroup( sStr ) );
- break;
- case RTF_SUBJECT:
- m_xDocProps->setSubject( GetTextToEndGroup( sStr ) );
- break;
- case RTF_AUTHOR:
- m_xDocProps->setAuthor( GetTextToEndGroup( sStr ) );
- break;
- case RTF_OPERATOR:
- m_xDocProps->setModifiedBy( GetTextToEndGroup( sStr ) );
- break;
- case RTF_KEYWORDS:
- {
- ::rtl::OUString sTemp = GetTextToEndGroup( sStr );
- m_xDocProps->setKeywords(
- ::comphelper::string::convertCommaSeparated(sTemp) );
- break;
- }
- case RTF_DOCCOMM:
- m_xDocProps->setDescription( GetTextToEndGroup( sStr ) );
- break;
-
- case RTF_HLINKBASE:
- sBaseURL = GetTextToEndGroup( sStr ) ;
- break;
-
- case RTF_CREATIM:
- m_xDocProps->setCreationDate( GetDateTimeStamp() );
- break;
-
- case RTF_REVTIM:
- m_xDocProps->setModificationDate( GetDateTimeStamp() );
- break;
-
- case RTF_PRINTIM:
- m_xDocProps->setPrintDate( GetDateTimeStamp() );
- break;
-
- case RTF_COMMENT:
- GetTextToEndGroup( sComment );
- break;
-
- case RTF_BUPTIM:
- SkipGroup();
- break;
-
- case RTF_VERN:
- nVersNo = nTokenValue;
- break;
-
- case RTF_EDMINS:
- case RTF_ID:
- case RTF_VERSION:
- case RTF_NOFPAGES:
- case RTF_NOFWORDS:
- case RTF_NOFCHARS:
- NextToken( nToken );
- break;
-
-// default:
- }
- }
-
- if( pChkForVerNo &&
- COMPARE_EQUAL == sComment.CompareToAscii( pChkForVerNo ))
- nVersionNo = nVersNo;
-
- SkipToken( -1 ); // the closing brace is evaluated "above"
-}
-
-
-void SvxRTFParser::ClearColorTbl()
-{
- while ( !aColorTbl.empty() )
- {
- delete aColorTbl.back();
- aColorTbl.pop_back();
- }
-}
-
-void SvxRTFParser::ClearFontTbl()
-{
- for( sal_uInt32 nCnt = aFontTbl.Count(); nCnt; )
- delete aFontTbl.GetObject( --nCnt );
-}
-
-void SvxRTFParser::ClearStyleTbl()
-{
- for( sal_uInt32 nCnt = aStyleTbl.Count(); nCnt; )
- delete aStyleTbl.GetObject( --nCnt );
-}
-
-void SvxRTFParser::ClearAttrStack()
-{
- SvxRTFItemStackType* pTmp;
- for( size_t nCnt = aAttrStack.size(); nCnt; --nCnt )
- {
- pTmp = aAttrStack.back();
- aAttrStack.pop_back();
- delete pTmp;
- }
-}
-
-String& SvxRTFParser::DelCharAtEnd( String& rStr, const sal_Unicode cDel )
-{
- if( rStr.Len() && ' ' == rStr.GetChar( 0 ))
- rStr.EraseLeadingChars();
- if( rStr.Len() && ' ' == rStr.GetChar( rStr.Len()-1 ))
- rStr.EraseTrailingChars();
- if( rStr.Len() && cDel == rStr.GetChar( rStr.Len()-1 ))
- rStr.Erase( rStr.Len()-1 );
- return rStr;
-}
-
-
-const Font& SvxRTFParser::GetFont( sal_uInt16 nId )
-{
- const Font* pFont = aFontTbl.Get( nId );
- if( !pFont )
- {
- const SvxFontItem& rDfltFont = (const SvxFontItem&)
- pAttrPool->GetDefaultItem(
- ((RTFPlainAttrMapIds*)aPlainMap.GetData())->nFont );
- pDfltFont->SetName( rDfltFont.GetStyleName() );
- pDfltFont->SetFamily( rDfltFont.GetFamily() );
- pFont = pDfltFont;
- }
- return *pFont;
-}
-
-SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr )
-{
- SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
- SvxRTFItemStackType* pNew;
- if( pAkt )
- pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, bCopyAttr );
- else
- pNew = new SvxRTFItemStackType( *pAttrPool, aWhichMap.GetData(),
- *pInsPos );
- pNew->SetRTFDefaults( GetRTFDefaults() );
-
- aAttrStack.push_back( pNew );
- bNewGroup = sal_False;
- return pNew;
-}
-
-
-void SvxRTFParser::_ClearStyleAttr( SvxRTFItemStackType& rStkType )
-{
- // check attributes to the attributes of the stylesheet or to
- // the default attrs of the document
- SfxItemSet &rSet = rStkType.GetAttrSet();
- const SfxItemPool& rPool = *rSet.GetPool();
- const SfxPoolItem* pItem;
- SfxWhichIter aIter( rSet );
-
- SvxRTFStyleType* pStyle;
- if( !IsChkStyleAttr() ||
- !rStkType.GetAttrSet().Count() ||
- 0 == ( pStyle = aStyleTbl.Get( rStkType.nStyleNo ) ))
- {
- for( sal_uInt16 nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() )
- {
- if( SFX_WHICH_MAX > nWhich &&
- SFX_ITEM_SET == rSet.GetItemState( nWhich, sal_False, &pItem ) &&
- rPool.GetDefaultItem( nWhich ) == *pItem )
- rSet.ClearItem( nWhich ); // delete
- }
- }
- else
- {
- // 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 ))
- {
- if( SFX_ITEM_SET == rSet.GetItemState( nWhich, sal_False, &pItem )
- && *pItem == *pSItem )
- rSet.ClearItem( nWhich ); // delete
- }
- else if( SFX_WHICH_MAX > nWhich &&
- SFX_ITEM_SET == rSet.GetItemState( nWhich, sal_False, &pItem ) &&
- rPool.GetDefaultItem( nWhich ) == *pItem )
- rSet.ClearItem( nWhich ); // delete
- }
- }
-}
-
-void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack
-{
- if( !aAttrStack.empty() )
- {
- SvxRTFItemStackType *pOld = aAttrStack.empty() ? 0 : aAttrStack.back();
- aAttrStack.pop_back();
- SvxRTFItemStackType *pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
-
- do { // middle check loop
- sal_uLong nOldSttNdIdx = pOld->pSttNd->GetIdx();
- if( !pOld->pChildList &&
- ((!pOld->aAttrSet.Count() && !pOld->nStyleNo ) ||
- (nOldSttNdIdx == pInsPos->GetNodeIdx() &&
- pOld->nSttCnt == pInsPos->GetCntIdx() )))
- break; // no attributes or Area
-
- // set only the attributes that are different from the parent
- if( pAkt && pOld->aAttrSet.Count() )
- {
- SfxItemIter aIter( pOld->aAttrSet );
- const SfxPoolItem* pItem = aIter.GetCurItem(), *pGet;
- while( sal_True )
- {
- if( SFX_ITEM_SET == pAkt->aAttrSet.GetItemState(
- pItem->Which(), sal_False, &pGet ) &&
- *pItem == *pGet )
- pOld->aAttrSet.ClearItem( pItem->Which() );
-
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
- }
-
- if( !pOld->aAttrSet.Count() && !pOld->pChildList &&
- !pOld->nStyleNo )
- break;
- }
-
- // Set all attributes which have been defined from start until here
- int bCrsrBack = !pInsPos->GetCntIdx();
- if( bCrsrBack )
- {
- // 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();
- }
-
- if( ( pOld->pSttNd->GetIdx() < pInsPos->GetNodeIdx() ||
- ( pOld->pSttNd->GetIdx() == pInsPos->GetNodeIdx() &&
- pOld->nSttCnt <= pInsPos->GetCntIdx() ))
- )
- {
- if( !bCrsrBack )
- {
- // all pard attributes are only valid until the previous
- // paragraph !!
- if( nOldSttNdIdx == pInsPos->GetNodeIdx() )
- {
- }
- else
- {
- // 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() );
-
- // 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() );
-
- // Were there any?
- if( pNew->aAttrSet.Count() == pOld->aAttrSet.Count() )
- delete pNew;
- else
- {
- pNew->nStyleNo = 0;
-
- // Now span the real area of pNew from old
- SetEndPrevPara( pOld->pEndNd, pOld->nEndCnt );
- pNew->nSttCnt = 0;
-
- if( IsChkStyleAttr() )
- {
- _ClearStyleAttr( *pOld );
- _ClearStyleAttr( *pNew ); //#i10381#, methinks.
- }
-
- if( pAkt )
- {
- pAkt->Add( pOld );
- pAkt->Add( pNew );
- }
- else
- {
- // 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; // Do not delete pOld
- break;
- }
- }
- }
-
- pOld->pEndNd = pInsPos->MakeNodeIdx();
- pOld->nEndCnt = pInsPos->GetCntIdx();
-
- /*
- #i21422#
- If the parent (pAkt) sets something e.g. , and the child (pOld)
- unsets it and the style both are based on has it unset then
- clearing the pOld by looking at the style is clearly a disaster
- as the text ends up with pAkts bold and not pOlds no bold, this
- should be rethought out. For the moment its safest to just do
- the clean if we have no parent, all we suffer is too many
- redundant properties.
- */
- if (IsChkStyleAttr() && !pAkt)
- _ClearStyleAttr( *pOld );
-
- if( pAkt )
- {
- pAkt->Add( pOld );
- // split up and create new entry, because it make no sense
- // to create a "so long" depend list. Bug 95010
- if( bCrsrBack && 50 < pAkt->pChildList->Count() )
- {
- // at the beginning of a paragraph? Move back one position
- MovePos( sal_True );
- bCrsrBack = sal_False;
-
- // Open a new Group.
- SvxRTFItemStackType* pNew = new SvxRTFItemStackType(
- *pAkt, *pInsPos, sal_True );
- pNew->SetRTFDefaults( GetRTFDefaults() );
-
- // 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 );
- aAttrStack.push_back( pNew );
- pAkt = pNew;
- }
- }
- else
- // 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 )
- // at the beginning of a paragraph? Move back one position
- MovePos( sal_True );
-
- } while( sal_False );
-
- if( pOld )
- delete pOld;
-
- bNewGroup = sal_False;
- }
-}
-
-void SvxRTFParser::SetAllAttrOfStk() // end all Attr. and set it into doc
-{
- // repeat until all attributes will be taken from stack
- while( !aAttrStack.empty() )
- AttrGroupEnd();
-
- for( sal_uInt16 n = aAttrSetList.Count(); n; )
- {
- SvxRTFItemStackType* pStkSet = aAttrSetList[--n];
- SetAttrSet( *pStkSet );
- aAttrSetList.DeleteAndDestroy( n );
- }
-}
-
-// sets all the attributes that are different from the current
-void SvxRTFParser::SetAttrSet( SvxRTFItemStackType &rSet )
-{
- // Was DefTab never read? then set to default
- if( !bIsSetDfltTab )
- SetDefault( RTF_DEFTAB, 720 );
-
- if( rSet.pChildList )
- rSet.Compress( *this );
- if( rSet.aAttrSet.Count() || rSet.nStyleNo )
- SetAttrInDoc( rSet );
-
- // then process all the children
- if( rSet.pChildList )
- for( sal_uInt16 n = 0; n < rSet.pChildList->Count(); ++n )
- SetAttrSet( *(*rSet.pChildList)[ n ] );
-}
-
- // Has no Text been inserted yet? (SttPos from the top Stack entry!)
-int SvxRTFParser::IsAttrSttPos()
-{
- SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
- return !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() &&
- pAkt->nSttCnt == pInsPos->GetCntIdx());
-}
-
-
-void SvxRTFParser::SetAttrInDoc( SvxRTFItemStackType & )
-{
-}
-
-void SvxRTFParser::BuildWhichTbl()
-{
- if( aWhichMap.Count() )
- aWhichMap.Remove( 0, aWhichMap.Count() );
- aWhichMap.Insert( (sal_uInt16)0, (sal_uInt16)0 );
-
- // Building a Which-Map 'rWhichMap' from an Array of
- // 'pWhichIds' frm Which-Ids. It has the long 'nWhichIds'.
- // The Which-Map is not going to be deleted.
- SvParser::BuildWhichTbl( aWhichMap, (sal_uInt16*)aPardMap.GetData(), aPardMap.Count() );
- SvParser::BuildWhichTbl( aWhichMap, (sal_uInt16*)aPlainMap.GetData(), aPlainMap.Count() );
-}
-
-const SfxItemSet& SvxRTFParser::GetRTFDefaults()
-{
- if( !pRTFDefaults )
- {
- pRTFDefaults = new SfxItemSet( *pAttrPool, aWhichMap.GetData() );
- sal_uInt16 nId;
- if( 0 != ( nId = ((RTFPardAttrMapIds*)aPardMap.GetData())->nScriptSpace ))
- {
- SvxScriptSpaceItem aItem( sal_False, nId );
- if( bNewDoc )
- pAttrPool->SetPoolDefaultItem( aItem );
- else
- pRTFDefaults->Put( aItem );
- }
- }
- return *pRTFDefaults;
-}
-
-/* */
-
-SvxRTFStyleType::SvxRTFStyleType( SfxItemPool& rPool, const sal_uInt16* pWhichRange )
- : aAttrSet( rPool, pWhichRange )
-{
- nOutlineNo = sal_uInt8(-1); // not set
- nBasedOn = 0;
- bBasedOnIsSet = sal_False; //$flr #117411#
- nNext = 0;
- bIsCharFmt = sal_False;
-}
-
-
-SvxRTFItemStackType::SvxRTFItemStackType(
- SfxItemPool& rPool, const sal_uInt16* pWhichRange,
- const SvxPosition& rPos )
- : aAttrSet( rPool, pWhichRange ),
- pChildList( 0 ),
- nStyleNo( 0 )
-{
- pSttNd = rPos.MakeNodeIdx();
- nSttCnt = rPos.GetCntIdx();
- pEndNd = pSttNd;
- nEndCnt = nSttCnt;
-}
-
-SvxRTFItemStackType::SvxRTFItemStackType(
- const SvxRTFItemStackType& rCpy,
- const SvxPosition& rPos,
- int bCopyAttr )
- : aAttrSet( *rCpy.aAttrSet.GetPool(), rCpy.aAttrSet.GetRanges() ),
- pChildList( 0 ),
- nStyleNo( rCpy.nStyleNo )
-{
- pSttNd = rPos.MakeNodeIdx();
- nSttCnt = rPos.GetCntIdx();
- pEndNd = pSttNd;
- nEndCnt = nSttCnt;
-
- aAttrSet.SetParent( &rCpy.aAttrSet );
- if( bCopyAttr )
- aAttrSet.Put( rCpy.aAttrSet );
-}
-
-SvxRTFItemStackType::~SvxRTFItemStackType()
-{
- if( pChildList )
- delete pChildList;
- if( pSttNd != pEndNd )
- delete pEndNd;
- delete pSttNd;
-}
-
-void SvxRTFItemStackType::Add( SvxRTFItemStackType* pIns )
-{
- if( !pChildList )
- pChildList = new SvxRTFItemStackList( 4, 16 );
- pChildList->Insert( pIns, pChildList->Count() );
-}
-
-void SvxRTFItemStackType::SetStartPos( const SvxPosition& rPos )
-{
- if (pSttNd != pEndNd)
- delete pEndNd;
- delete pSttNd;
- pSttNd = rPos.MakeNodeIdx();
- pEndNd = pSttNd;
- nSttCnt = rPos.GetCntIdx();
-}
-
-void SvxRTFItemStackType::MoveFullNode(const SvxNodeIdx &rOldNode,
- const SvxNodeIdx &rNewNode)
-{
- bool bSameEndAsStart = (pSttNd == pEndNd) ? true : false;
-
- if (GetSttNodeIdx() == rOldNode.GetIdx())
- {
- delete pSttNd;
- pSttNd = rNewNode.Clone();
- if (bSameEndAsStart)
- pEndNd = pSttNd;
- }
-
- if (!bSameEndAsStart && GetEndNodeIdx() == rOldNode.GetIdx())
- {
- delete pEndNd;
- pEndNd = rNewNode.Clone();
- }
-
- //And the same for all the children
- sal_uInt16 nCount = pChildList ? pChildList->Count() : 0;
- for (sal_uInt16 i = 0; i < nCount; ++i)
- {
- SvxRTFItemStackType* pStk = (*pChildList)[i];
- pStk->MoveFullNode(rOldNode, rNewNode);
- }
-}
-
-bool SvxRTFParser::UncompressableStackEntry(const SvxRTFItemStackType &) const
-{
- return false;
-}
-
-void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser )
-{
- DBG_ASSERT( pChildList, "There is no child list" );
-
- sal_uInt16 n;
- SvxRTFItemStackType* pTmp = (*pChildList)[0];
-
- if( !pTmp->aAttrSet.Count() ||
- pSttNd->GetIdx() != pTmp->pSttNd->GetIdx() ||
- nSttCnt != pTmp->nSttCnt )
- return;
-
- SvxNodeIdx* pLastNd = pTmp->pEndNd;
- xub_StrLen nLastCnt = pTmp->nEndCnt;
-
- SfxItemSet aMrgSet( pTmp->aAttrSet );
- for( n = 1; n < pChildList->Count(); ++n )
- {
- pTmp = (*pChildList)[n];
- if( pTmp->pChildList )
- pTmp->Compress( rParser );
-
- if( !pTmp->nSttCnt
- ? (pLastNd->GetIdx()+1 != pTmp->pSttNd->GetIdx() ||
- !rParser.IsEndPara( pLastNd, nLastCnt ) )
- : ( pTmp->nSttCnt != nLastCnt ||
- pLastNd->GetIdx() != pTmp->pSttNd->GetIdx() ))
- {
- while( ++n < pChildList->Count() )
- if( (pTmp = (*pChildList)[n])->pChildList )
- pTmp->Compress( rParser );
- return;
- }
-
- if (rParser.UncompressableStackEntry(*pTmp))
- return;
-
- if( n )
- {
- // Search for all which are set over the whole area
- SfxItemIter aIter( aMrgSet );
- const SfxPoolItem* pItem;
- do {
- sal_uInt16 nWhich = aIter.GetCurItem()->Which();
- if( SFX_ITEM_SET != pTmp->aAttrSet.GetItemState( nWhich,
- sal_False, &pItem ) || *pItem != *aIter.GetCurItem() )
- aMrgSet.ClearItem( nWhich );
-
- if( aIter.IsAtEnd() )
- break;
- aIter.NextItem();
- } while( sal_True );
-
- if( !aMrgSet.Count() )
- return;
- }
-
- pLastNd = pTmp->pEndNd;
- nLastCnt = pTmp->nEndCnt;
- }
-
- if( pEndNd->GetIdx() != pLastNd->GetIdx() || nEndCnt != nLastCnt )
- return;
-
- // It can be merged
- aAttrSet.Put( aMrgSet );
-
- for( n = 0; n < pChildList->Count(); ++n )
- {
- pTmp = (*pChildList)[n];
- pTmp->aAttrSet.Differentiate( aMrgSet );
-
- if( !pTmp->pChildList && !pTmp->aAttrSet.Count() && !pTmp->nStyleNo )
- {
- pChildList->Remove( n );
- delete pTmp;
- --n;
- continue;
- }
- }
- if( !pChildList->Count() )
- {
- delete pChildList;
- pChildList = 0;
- }
-}
-void SvxRTFItemStackType::SetRTFDefaults( const SfxItemSet& rDefaults )
-{
- if( rDefaults.Count() )
- {
- SfxItemIter aIter( rDefaults );
- do {
- sal_uInt16 nWhich = aIter.GetCurItem()->Which();
- if( SFX_ITEM_SET != aAttrSet.GetItemState( nWhich, sal_False ))
- aAttrSet.Put( *aIter.GetCurItem() );
-
- if( aIter.IsAtEnd() )
- break;
- aIter.NextItem();
- } while( sal_True );
- }
-}
-
-/* */
-
-RTFPlainAttrMapIds::RTFPlainAttrMapIds( const SfxItemPool& rPool )
-{
- nCaseMap = rPool.GetTrueWhich( SID_ATTR_CHAR_CASEMAP, sal_False );
- nBgColor = rPool.GetTrueWhich( SID_ATTR_BRUSH_CHAR, sal_False );
- nColor = rPool.GetTrueWhich( SID_ATTR_CHAR_COLOR, sal_False );
- nContour = rPool.GetTrueWhich( SID_ATTR_CHAR_CONTOUR, sal_False );
- nCrossedOut = rPool.GetTrueWhich( SID_ATTR_CHAR_STRIKEOUT, sal_False );
- nEscapement = rPool.GetTrueWhich( SID_ATTR_CHAR_ESCAPEMENT, sal_False );
- nFont = rPool.GetTrueWhich( SID_ATTR_CHAR_FONT, sal_False );
- nFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_FONTHEIGHT, sal_False );
- nKering = rPool.GetTrueWhich( SID_ATTR_CHAR_KERNING, sal_False );
- nLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_LANGUAGE, sal_False );
- nPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_POSTURE, sal_False );
- nShadowed = rPool.GetTrueWhich( SID_ATTR_CHAR_SHADOWED, sal_False );
- nUnderline = rPool.GetTrueWhich( SID_ATTR_CHAR_UNDERLINE, sal_False );
- nOverline = rPool.GetTrueWhich( SID_ATTR_CHAR_OVERLINE, sal_False );
- nWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_WEIGHT, sal_False );
- nWordlineMode = rPool.GetTrueWhich( SID_ATTR_CHAR_WORDLINEMODE, sal_False );
- nAutoKerning = rPool.GetTrueWhich( SID_ATTR_CHAR_AUTOKERN, sal_False );
-
- nCJKFont = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_FONT, sal_False );
- nCJKFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT, sal_False );
- nCJKLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_LANGUAGE, sal_False );
- nCJKPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_POSTURE, sal_False );
- nCJKWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_WEIGHT, sal_False );
- nCTLFont = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_FONT, sal_False );
- nCTLFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT, sal_False );
- nCTLLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_LANGUAGE, sal_False );
- nCTLPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_POSTURE, sal_False );
- nCTLWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_WEIGHT, sal_False );
- nEmphasis = rPool.GetTrueWhich( SID_ATTR_CHAR_EMPHASISMARK, sal_False );
- nTwoLines = rPool.GetTrueWhich( SID_ATTR_CHAR_TWO_LINES, sal_False );
- nRuby = 0; //rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_RUBY, sal_False );
- nCharScaleX = rPool.GetTrueWhich( SID_ATTR_CHAR_SCALEWIDTH, sal_False );
- nHorzVert = rPool.GetTrueWhich( SID_ATTR_CHAR_ROTATED, sal_False );
- nRelief = rPool.GetTrueWhich( SID_ATTR_CHAR_RELIEF, sal_False );
- nHidden = rPool.GetTrueWhich( SID_ATTR_CHAR_HIDDEN, sal_False );
-}
-
-RTFPardAttrMapIds ::RTFPardAttrMapIds ( const SfxItemPool& rPool )
-{
- nLinespacing = rPool.GetTrueWhich( SID_ATTR_PARA_LINESPACE, sal_False );
- nAdjust = rPool.GetTrueWhich( SID_ATTR_PARA_ADJUST, sal_False );
- nTabStop = rPool.GetTrueWhich( SID_ATTR_TABSTOP, sal_False );
- nHyphenzone = rPool.GetTrueWhich( SID_ATTR_PARA_HYPHENZONE, sal_False );
- nLRSpace = rPool.GetTrueWhich( SID_ATTR_LRSPACE, sal_False );
- nULSpace = rPool.GetTrueWhich( SID_ATTR_ULSPACE, sal_False );
- nBrush = rPool.GetTrueWhich( SID_ATTR_BRUSH, sal_False );
- nBox = rPool.GetTrueWhich( SID_ATTR_BORDER_OUTER, sal_False );
- nShadow = rPool.GetTrueWhich( SID_ATTR_BORDER_SHADOW, sal_False );
- nOutlineLvl = rPool.GetTrueWhich( SID_ATTR_PARA_OUTLLEVEL, sal_False );
- nSplit = rPool.GetTrueWhich( SID_ATTR_PARA_SPLIT, sal_False );
- nKeep = rPool.GetTrueWhich( SID_ATTR_PARA_KEEP, sal_False );
- nFontAlign = rPool.GetTrueWhich( SID_PARA_VERTALIGN, sal_False );
- nScriptSpace = rPool.GetTrueWhich( SID_ATTR_PARA_SCRIPTSPACE, sal_False );
- nHangPunct = rPool.GetTrueWhich( SID_ATTR_PARA_HANGPUNCTUATION, sal_False );
- nForbRule = rPool.GetTrueWhich( SID_ATTR_PARA_FORBIDDEN_RULES, sal_False );
- nDirection = rPool.GetTrueWhich( SID_ATTR_FRAMEDIRECTION, sal_False );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/uno/UnoForbiddenCharsTable.cxx b/editeng/source/uno/UnoForbiddenCharsTable.cxx
deleted file mode 100644
index 985c27be9e..0000000000
--- a/editeng/source/uno/UnoForbiddenCharsTable.cxx
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <editeng/UnoForbiddenCharsTable.hxx>
-#include <editeng/forbiddencharacterstable.hxx>
-#include <osl/mutex.hxx>
-#include <vcl/svapp.hxx>
-#include <editeng/unolingu.hxx> // LocalToLanguage, LanguageToLocale
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::i18n;
-using namespace ::rtl;
-using namespace ::cppu;
-
-SvxUnoForbiddenCharsTable::SvxUnoForbiddenCharsTable(::rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars) :
- mxForbiddenChars( xForbiddenChars )
-{
-}
-
-SvxUnoForbiddenCharsTable::~SvxUnoForbiddenCharsTable()
-{
-}
-
-void SvxUnoForbiddenCharsTable::onChange()
-{
-}
-
-ForbiddenCharacters SvxUnoForbiddenCharsTable::getForbiddenCharacters( const Locale& rLocale )
- throw(NoSuchElementException, RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(!mxForbiddenChars.is())
- throw RuntimeException();
-
- const LanguageType eLang = SvxLocaleToLanguage( rLocale );
- const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, sal_False );
- if(!pForbidden)
- throw NoSuchElementException();
-
- return *pForbidden;
-}
-
-sal_Bool SvxUnoForbiddenCharsTable::hasForbiddenCharacters( const Locale& rLocale )
- throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(!mxForbiddenChars.is())
- return sal_False;
-
- const LanguageType eLang = SvxLocaleToLanguage( rLocale );
- const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, sal_False );
-
- return NULL != pForbidden;
-}
-
-void SvxUnoForbiddenCharsTable::setForbiddenCharacters(const Locale& rLocale, const ForbiddenCharacters& rForbiddenCharacters )
- throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(!mxForbiddenChars.is())
- throw RuntimeException();
-
- const LanguageType eLang = SvxLocaleToLanguage( rLocale );
- mxForbiddenChars->SetForbiddenCharacters( eLang, rForbiddenCharacters );
-
- onChange();
-}
-
-void SvxUnoForbiddenCharsTable::removeForbiddenCharacters( const Locale& rLocale )
- throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(!mxForbiddenChars.is())
- throw RuntimeException();
-
- const LanguageType eLang = SvxLocaleToLanguage( rLocale );
- mxForbiddenChars->ClearForbiddenCharacters( eLang );
-
- onChange();
-}
-
-// XSupportedLocales
-Sequence< Locale > SAL_CALL SvxUnoForbiddenCharsTable::getLocales()
- throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- const sal_Int32 nCount = mxForbiddenChars.is() ? mxForbiddenChars->Count() : 0;
-
- Sequence< Locale > aLocales( nCount );
- if( nCount )
- {
- Locale* pLocales = aLocales.getArray();
-
- for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
- {
- const sal_uLong nLanguage = mxForbiddenChars->GetObjectKey( nIndex );
- SvxLanguageToLocale ( *pLocales++, static_cast < LanguageType > (nLanguage) );
- }
- }
-
- return aLocales;
-}
-
-sal_Bool SAL_CALL SvxUnoForbiddenCharsTable::hasLocale( const Locale& aLocale )
- throw(RuntimeException)
-{
- 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
deleted file mode 100644
index 1280f3b83a..0000000000
--- a/editeng/source/uno/unoedhlp.cxx
+++ /dev/null
@@ -1,198 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <tools/debug.hxx>
-
-#include <editeng/unoedhlp.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/editeng.hxx>
-
-//------------------------------------------------------------------------
-
-TYPEINIT1( SvxEditSourceHint, TextHint );
-
-SvxEditSourceHint::SvxEditSourceHint( sal_uLong _nId ) :
- TextHint( _nId ),
- mnStart( 0 ),
- mnEnd( 0 )
-{
-}
-
-SvxEditSourceHint::SvxEditSourceHint( sal_uLong _nId, sal_uLong nValue, sal_uLong nStart, sal_uLong nEnd ) :
- TextHint( _nId, nValue ),
- mnStart( nStart),
- mnEnd( nEnd )
-{
-}
-
-sal_uLong SvxEditSourceHint::GetValue() const
-{
- return TextHint::GetValue();
-}
-
-sal_uLong SvxEditSourceHint::GetStartValue() const
-{
- return mnStart;
-}
-
-sal_uLong SvxEditSourceHint::GetEndValue() const
-{
- return mnEnd;
-}
-
-void SvxEditSourceHint::SetValue( sal_uLong n )
-{
- TextHint::SetValue( n );
-}
-
-void SvxEditSourceHint::SetStartValue( sal_uLong n )
-{
- mnStart = n;
-}
-
-void SvxEditSourceHint::SetEndValue( sal_uLong n )
-{
- mnEnd = n;
-}
-
-//------------------------------------------------------------------------
-
-::std::auto_ptr<SfxHint> SvxEditSourceHelper::EENotification2Hint( EENotify* aNotify )
-{
- if( aNotify )
- {
- switch( aNotify->eNotificationType )
- {
- case EE_NOTIFY_TEXTMODIFIED:
- return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_MODIFIED, aNotify->nParagraph ) );
-
- case EE_NOTIFY_PARAGRAPHINSERTED:
- return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_PARAINSERTED, aNotify->nParagraph ) );
-
- case EE_NOTIFY_PARAGRAPHREMOVED:
- return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_PARAREMOVED, aNotify->nParagraph ) );
-
- case EE_NOTIFY_PARAGRAPHSMOVED:
- return ::std::auto_ptr<SfxHint>( new SvxEditSourceHint( EDITSOURCE_HINT_PARASMOVED, aNotify->nParagraph, aNotify->nParam1, aNotify->nParam2 ) );
-
- case EE_NOTIFY_TEXTHEIGHTCHANGED:
- return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_TEXTHEIGHTCHANGED, aNotify->nParagraph ) );
-
- case EE_NOTIFY_TEXTVIEWSCROLLED:
- return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_VIEWSCROLLED ) );
-
- case EE_NOTIFY_TEXTVIEWSELECTIONCHANGED:
- return ::std::auto_ptr<SfxHint>( new SvxEditSourceHint( EDITSOURCE_HINT_SELECTIONCHANGED ) );
-
- case EE_NOTIFY_BLOCKNOTIFICATION_START:
- return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_BLOCKNOTIFICATION_START, 0 ) );
-
- case EE_NOTIFY_BLOCKNOTIFICATION_END:
- return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_BLOCKNOTIFICATION_END, 0 ) );
-
- case EE_NOTIFY_INPUT_START:
- return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_INPUT_START, 0 ) );
-
- case EE_NOTIFY_INPUT_END:
- return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_INPUT_END, 0 ) );
-
- default:
- OSL_FAIL( "SvxEditSourceHelper::EENotification2Hint unknown notification" );
- break;
- }
- }
-
- return ::std::auto_ptr<SfxHint>( new SfxHint() );
-}
-
-sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex )
-{
- EECharAttribArray aCharAttribs;
-
- rEE.GetCharAttribs( nPara, aCharAttribs );
-
- // find closest index in front of nIndex
- sal_uInt16 nAttr, nCurrIndex;
- sal_Int32 nClosestStartIndex;
- for( nAttr=0, nClosestStartIndex=0; nAttr<aCharAttribs.Count(); ++nAttr )
- {
- nCurrIndex = aCharAttribs[nAttr].nStart;
-
- if( nCurrIndex > nIndex )
- break; // aCharAttribs array is sorted in increasing order for nStart values
-
- if( nCurrIndex > nClosestStartIndex )
- {
- nClosestStartIndex = nCurrIndex;
- }
- }
-
- // find closest index behind of nIndex
- sal_Int32 nClosestEndIndex;
- for( nAttr=0, nClosestEndIndex=rEE.GetTextLen(nPara); nAttr<aCharAttribs.Count(); ++nAttr )
- {
- nCurrIndex = aCharAttribs[nAttr].nEnd;
-
- if( nCurrIndex > nIndex &&
- nCurrIndex < nClosestEndIndex )
- {
- nClosestEndIndex = nCurrIndex;
- }
- }
-
- nStartIndex = static_cast<sal_uInt16>( nClosestStartIndex );
- nEndIndex = static_cast<sal_uInt16>( nClosestEndIndex );
-
- return sal_True;
-}
-
-Point SvxEditSourceHelper::EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical )
-{
- return bIsVertical ? Point( -rPoint.Y() + rEESize.Height(), rPoint.X() ) : rPoint;
-}
-
-Point SvxEditSourceHelper::UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical )
-{
- return bIsVertical ? Point( rPoint.Y(), -rPoint.X() + rEESize.Height() ) : rPoint;
-}
-
-Rectangle SvxEditSourceHelper::EEToUserSpace( const Rectangle& rRect, const Size& rEESize, bool bIsVertical )
-{
- 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 )
-{
- 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
deleted file mode 100644
index 8cc4e1f157..0000000000
--- a/editeng/source/uno/unoedprx.cxx
+++ /dev/null
@@ -1,1318 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-//------------------------------------------------------------------------
-//
-// Global header
-//
-//------------------------------------------------------------------------
-
-#include <limits.h>
-#include <vector>
-#include <algorithm>
-#include <osl/mutex.hxx>
-#include <vcl/window.hxx>
-#include <vcl/svapp.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-
-//------------------------------------------------------------------------
-//
-// Project-local header
-//
-//------------------------------------------------------------------------
-#include "editeng/unoedprx.hxx"
-#include <editeng/unotext.hxx>
-#include <editeng/unoedhlp.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/AccessibleStringWrap.hxx>
-#include <editeng/outliner.hxx>
-
-using namespace ::com::sun::star;
-
-
-class SvxAccessibleTextIndex
-{
-public:
- SvxAccessibleTextIndex() :
- mnPara(0),
- mnIndex(0),
- mnEEIndex(0),
- mnFieldOffset(0),
- mnFieldLen(0),
- mbInField(sal_False),
- mnBulletOffset(0),
- mnBulletLen(0),
- mbInBullet(sal_False) {};
- ~SvxAccessibleTextIndex() {};
-
- // Get/Set current paragraph
- void SetParagraph( sal_uInt16 nPara )
- {
- mnPara = nPara;
- }
- sal_uInt16 GetParagraph() const { return mnPara; }
-
- /** Set the index in the UAA semantic
-
- @param nIndex
- The index from the UA API (fields and bullets are expanded)
-
- @param rTF
- The text forwarder to use in the calculations
- */
- void SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF );
- void SetIndex( sal_uInt16 nPara, sal_Int32 nIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetIndex(nIndex, rTF); }
- sal_Int32 GetIndex() const { return mnIndex; }
-
- /** Set the index in the edit engine semantic
-
- Update the object state to reflect the given index position in
- EditEngine/Outliner index values
-
- @param nEEIndex
- The index from the edit engine (fields span exactly one index increment)
-
- @param rTF
- The text forwarder to use in the calculations
- */
- void SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF );
- void SetEEIndex( sal_uInt16 nPara, sal_uInt16 nEEIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetEEIndex(nEEIndex, rTF); }
- sal_uInt16 GetEEIndex() const;
-
- void SetFieldOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnFieldOffset = nOffset; mnFieldLen = nLen; }
- sal_Int32 GetFieldOffset() const { return mnFieldOffset; }
- sal_Int32 GetFieldLen() const { return mnFieldLen; }
- void AreInField( sal_Bool bInField = sal_True ) { mbInField = bInField; }
- sal_Bool InField() const { return mbInField; }
-
- void SetBulletOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnBulletOffset = nOffset; mnBulletLen = nLen; }
- sal_Int32 GetBulletOffset() const { return mnBulletOffset; }
- sal_Int32 GetBulletLen() const { return mnBulletLen; }
- void AreInBullet( sal_Bool bInBullet = sal_True ) { mbInBullet = bInBullet; }
- sal_Bool InBullet() const { return mbInBullet; }
-
- /// returns false if the current index contains non-editable text (e.g. bullets)
- sal_Bool IsEditable() const;
-
- /// returns false if the given range is non-editable (e.g. contains bullets or _parts_ of fields)
- sal_Bool IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const;
-
-private:
- sal_uInt16 mnPara;
- sal_Int32 mnIndex;
- sal_Int32 mnEEIndex;
- sal_Int32 mnFieldOffset;
- sal_Int32 mnFieldLen;
- sal_Bool mbInField;
- sal_Int32 mnBulletOffset;
- sal_Int32 mnBulletLen;
- sal_Bool mbInBullet;
-};
-
-ESelection MakeEESelection( const SvxAccessibleTextIndex& rStart, const SvxAccessibleTextIndex& rEnd )
-{
- // deal with field special case: to really get a field contained
- // within a selection, the start index must be before or on the
- // field, the end index after it.
-
- // The SvxAccessibleTextIndex.GetEEIndex method gives the index on
- // the field, as long the input index is on the field. Thus,
- // correction necessary for the end index
-
- // Therefore, for _ranges_, if part of the field is touched, all
- // of the field must be selected
- if( rStart.GetParagraph() <= rEnd.GetParagraph() ||
- (rStart.GetParagraph() == rEnd.GetParagraph() &&
- rStart.GetEEIndex() <= rEnd.GetEEIndex()) )
- {
- if( rEnd.InField() && rEnd.GetFieldOffset() )
- return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
- rEnd.GetParagraph(), rEnd.GetEEIndex()+1 );
- }
- else if( rStart.GetParagraph() > rEnd.GetParagraph() ||
- (rStart.GetParagraph() == rEnd.GetParagraph() &&
- rStart.GetEEIndex() > rEnd.GetEEIndex()) )
- {
- if( rStart.InField() && rStart.GetFieldOffset() )
- return ESelection( rStart.GetParagraph(), rStart.GetEEIndex()+1,
- rEnd.GetParagraph(), rEnd.GetEEIndex() );
- }
-
- return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
- rEnd.GetParagraph(), rEnd.GetEEIndex() );
-}
-
-ESelection MakeEESelection( const SvxAccessibleTextIndex& rIndex )
-{
- return ESelection( rIndex.GetParagraph(), rIndex.GetEEIndex(),
- rIndex.GetParagraph(), rIndex.GetEEIndex() + 1 );
-}
-
-sal_uInt16 SvxAccessibleTextIndex::GetEEIndex() const
-{
- DBG_ASSERT(mnEEIndex >= 0 && mnEEIndex <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetEEIndex: index value overflow");
-
- return static_cast< sal_uInt16 > (mnEEIndex);
-}
-
-void SvxAccessibleTextIndex::SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF )
-{
- // reset
- mnFieldOffset = 0;
- mbInField = sal_False;
- mnFieldLen = 0;
- mnBulletOffset = 0;
- mbInBullet = sal_False;
- mnBulletLen = 0;
-
- // set known values
- mnEEIndex = nEEIndex;
-
- // calculate unknowns
- sal_uInt16 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
-
- mnIndex = nEEIndex;
-
- EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
-
- // any text bullets?
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType != SVX_NUM_BITMAP )
- {
- mnIndex += aBulletInfo.aText.Len();
- }
-
- for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
- {
- EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
-
- if( aFieldInfo.aPosition.nIndex > nEEIndex )
- break;
-
- if( aFieldInfo.aPosition.nIndex == nEEIndex )
- {
- AreInField();
- break;
- }
-
- // #106010#
- mnIndex += ::std::max(aFieldInfo.aCurrentText.Len()-1, 0);
- }
-}
-
-void SvxAccessibleTextIndex::SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF )
-{
- // reset
- mnFieldOffset = 0;
- mbInField = sal_False;
- mnFieldLen = 0;
- mnBulletOffset = 0;
- mbInBullet = sal_False;
- mnBulletLen = 0;
-
- // set known values
- mnIndex = nIndex;
-
- // calculate unknowns
- sal_uInt16 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
-
- DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- mnEEIndex = nIndex;
-
- EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
-
- // any text bullets?
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType != SVX_NUM_BITMAP )
- {
- sal_Int32 nBulletLen = aBulletInfo.aText.Len();
-
- if( nIndex < nBulletLen )
- {
- AreInBullet();
- SetBulletOffset( nIndex, nBulletLen );
- mnEEIndex = 0;
- return;
- }
-
- mnEEIndex = mnEEIndex - nBulletLen;
- }
-
- for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
- {
- EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
-
- // we're before a field
- if( aFieldInfo.aPosition.nIndex > mnEEIndex )
- break;
-
- // #106010#
- mnEEIndex -= ::std::max(aFieldInfo.aCurrentText.Len()-1, 0);
-
- // we're within a field
- if( aFieldInfo.aPosition.nIndex >= mnEEIndex )
- {
- AreInField();
- SetFieldOffset( ::std::max(aFieldInfo.aCurrentText.Len()-1, 0) - (aFieldInfo.aPosition.nIndex - mnEEIndex),
- aFieldInfo.aCurrentText.Len() );
- mnEEIndex = aFieldInfo.aPosition.nIndex ;
- break;
- }
- }
-}
-
-sal_Bool SvxAccessibleTextIndex::IsEditable() const
-{
- if( InBullet() || InField() )
- return sal_False;
-
- return sal_True;
-}
-
-sal_Bool SvxAccessibleTextIndex::IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const
-{
- if( GetIndex() > rEnd.GetIndex() )
- return rEnd.IsEditableRange( *this );
-
- if( InBullet() || rEnd.InBullet() )
- return sal_False;
-
- if( InField() && GetFieldOffset() )
- return sal_False; // within field
-
- if( rEnd.InField() && rEnd.GetFieldOffset() >= rEnd.GetFieldLen() - 1 )
- return sal_False; // within field
-
- return sal_True;
-}
-
-//---------------------------------------------------------------------------------
-
-SvxEditSourceAdapter::SvxEditSourceAdapter() : mbEditSourceValid( sal_False )
-{
-}
-
-SvxEditSourceAdapter::~SvxEditSourceAdapter()
-{
-}
-
-SvxEditSource* SvxEditSourceAdapter::Clone() const
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- {
- ::std::auto_ptr< SvxEditSource > pClonedAdaptee( mpAdaptee->Clone() );
-
- if( pClonedAdaptee.get() )
- {
- SvxEditSourceAdapter* pClone = new SvxEditSourceAdapter();
-
- if( pClone )
- {
- pClone->SetEditSource( pClonedAdaptee );
- return pClone;
- }
- }
- }
-
- return NULL;
-}
-
-SvxAccessibleTextAdapter* SvxEditSourceAdapter::GetTextForwarderAdapter()
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- {
- SvxTextForwarder* pTextForwarder = mpAdaptee->GetTextForwarder();
-
- if( pTextForwarder )
- {
- maTextAdapter.SetForwarder(*pTextForwarder);
-
- return &maTextAdapter;
- }
- }
-
- return NULL;
-}
-
-SvxTextForwarder* SvxEditSourceAdapter::GetTextForwarder()
-{
- return GetTextForwarderAdapter();
-}
-
-SvxViewForwarder* SvxEditSourceAdapter::GetViewForwarder()
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- return mpAdaptee->GetViewForwarder();
-
- return NULL;
-}
-
-SvxAccessibleTextEditViewAdapter* SvxEditSourceAdapter::GetEditViewForwarderAdapter( sal_Bool bCreate )
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- {
- SvxEditViewForwarder* pEditViewForwarder = mpAdaptee->GetEditViewForwarder(bCreate);
-
- if( pEditViewForwarder )
- {
- SvxAccessibleTextAdapter* pTextAdapter = GetTextForwarderAdapter();
-
- if( pTextAdapter )
- {
- maEditViewAdapter.SetForwarder(*pEditViewForwarder, *pTextAdapter);
-
- return &maEditViewAdapter;
- }
- }
- }
-
- return NULL;
-}
-
-SvxEditViewForwarder* SvxEditSourceAdapter::GetEditViewForwarder( sal_Bool bCreate )
-{
- return GetEditViewForwarderAdapter( bCreate );
-}
-
-void SvxEditSourceAdapter::UpdateData()
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- mpAdaptee->UpdateData();
-}
-
-SfxBroadcaster& SvxEditSourceAdapter::GetBroadcaster() const
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- return mpAdaptee->GetBroadcaster();
-
- return maDummyBroadcaster;
-}
-
-void SvxEditSourceAdapter::SetEditSource( ::std::auto_ptr< SvxEditSource > pAdaptee )
-{
- if( pAdaptee.get() )
- {
- mpAdaptee = pAdaptee;
- mbEditSourceValid = sal_True;
- }
- else
- {
- // do a lazy delete (prevents us from deleting the broadcaster
- // from within a broadcast in
- // AccessibleTextHelper_Impl::Notify)
- mbEditSourceValid = sal_False;
- }
-}
-
-sal_Bool SvxEditSourceAdapter::IsValid() const
-{
- return mbEditSourceValid;
-}
-
-
-//--------------------------------------------------------------------------------------
-
-SvxAccessibleTextAdapter::SvxAccessibleTextAdapter() : mrTextForwarder( NULL )
-{
-}
-
-SvxAccessibleTextAdapter::~SvxAccessibleTextAdapter()
-{
-}
-
-sal_uInt16 SvxAccessibleTextAdapter::GetParagraphCount() const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetParagraphCount();
-}
-
-sal_uInt16 SvxAccessibleTextAdapter::GetTextLen( sal_uInt16 nParagraph ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetEEIndex( nParagraph, mrTextForwarder->GetTextLen( nParagraph ), *this );
-
- return static_cast< sal_uInt16 >(aIndex.GetIndex());
-}
-
-String SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- // normalize selection
- if( rSel.nStartPara > rSel.nEndPara ||
- (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) )
- {
- ::std::swap( aStartIndex, aEndIndex );
- }
-
- String sStr = mrTextForwarder->GetText( MakeEESelection(aStartIndex, aEndIndex) );
-
- // trim field text, if necessary
- if( aStartIndex.InField() )
- {
- DBG_ASSERT(aStartIndex.GetFieldOffset() >= 0 &&
- aStartIndex.GetFieldOffset() <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetText: index value overflow");
-
- sStr.Erase(0, static_cast< sal_uInt16 > (aStartIndex.GetFieldOffset()) );
- }
- if( aEndIndex.InField() && aEndIndex.GetFieldOffset() )
- {
- DBG_ASSERT(sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) >= 0 &&
- sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetText: index value overflow");
-
- sStr = sStr.Copy(0, static_cast< sal_uInt16 > (sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset())) );
- }
-
- EBulletInfo aBulletInfo1 = GetBulletInfo( static_cast< sal_uInt16 >(aStartIndex.GetParagraph()) );
- EBulletInfo aBulletInfo2 = GetBulletInfo( static_cast< sal_uInt16 >(aEndIndex.GetParagraph()) );
-
- if( aStartIndex.InBullet() )
- {
- // prepend leading bullet
- String sBullet = aBulletInfo1.aText;
-
- DBG_ASSERT(aStartIndex.GetBulletOffset() >= 0 &&
- aStartIndex.GetBulletOffset() <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetText: index value overflow");
-
- sBullet.Erase(0, static_cast< sal_uInt16 > (aStartIndex.GetBulletOffset()) );
-
- sBullet += sStr;
- sStr = sBullet;
- }
-
- if( aEndIndex.InBullet() )
- {
- // append trailing bullet
- sStr += aBulletInfo2.aText;;
-
- DBG_ASSERT(sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
- sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetText: index value overflow");
-
- sStr = sStr.Copy(0, static_cast< sal_uInt16 > (sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) );
- }
- else if( aStartIndex.GetParagraph() != aEndIndex.GetParagraph() &&
- HaveTextBullet( aEndIndex.GetParagraph() ) )
- {
- String sBullet = aBulletInfo2.aText;
-
- DBG_ASSERT(sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
- sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetText: index value overflow");
-
- sBullet = sBullet.Copy(0, static_cast< sal_uInt16 > (sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) );
-
- // insert bullet
- sStr.Insert( sBullet,
- static_cast< sal_uInt16 > (GetTextLen(aStartIndex.GetParagraph()) - aStartIndex.GetIndex()) );
- }
-
- return sStr;
-}
-
-SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- return mrTextForwarder->GetAttribs( MakeEESelection(aStartIndex, aEndIndex),
- bOnlyHardAttrib );
-}
-
-SfxItemSet SvxAccessibleTextAdapter::GetParaAttribs( sal_uInt16 nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetParaAttribs( nPara );
-}
-
-void SvxAccessibleTextAdapter::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- mrTextForwarder->SetParaAttribs( nPara, rSet );
-}
-
-void SvxAccessibleTextAdapter::RemoveAttribs( const ESelection& , sal_Bool , sal_uInt16 )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-}
-
-void SvxAccessibleTextAdapter::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- mrTextForwarder->GetPortions( nPara, rList );
-}
-
-sal_uInt16 SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- return mrTextForwarder->GetItemState( MakeEESelection(aStartIndex, aEndIndex),
- nWhich );
-}
-
-sal_uInt16 SvxAccessibleTextAdapter::GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetItemState( nPara, nWhich );
-}
-
-void SvxAccessibleTextAdapter::QuickInsertText( const String& rText, const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- mrTextForwarder->QuickInsertText( rText,
- MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-void SvxAccessibleTextAdapter::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- mrTextForwarder->QuickInsertField( rFld,
- MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-void SvxAccessibleTextAdapter::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- mrTextForwarder->QuickSetAttribs( rSet,
- MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-void SvxAccessibleTextAdapter::QuickInsertLineBreak( const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- mrTextForwarder->QuickInsertLineBreak( MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-SfxItemPool* SvxAccessibleTextAdapter::GetPool() const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetPool();
-}
-
-XubString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
-}
-
-void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- mrTextForwarder->FieldClicked( rField, nPara, nPos );
-}
-
-sal_Int32 SvxAccessibleTextAdapter::CalcLogicalIndex( sal_uInt16 nPara, sal_uInt16 nEEIndex )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetEEIndex(nPara, nEEIndex, *mrTextForwarder);
- return aIndex.GetIndex();
-}
-
-sal_uInt16 SvxAccessibleTextAdapter::CalcEditEngineIndex( sal_uInt16 nPara, sal_Int32 nLogicalIndex )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetIndex(nPara, nLogicalIndex, *mrTextForwarder);
- return aIndex.GetEEIndex();
-}
-
-
-
-sal_Bool SvxAccessibleTextAdapter::IsValid() const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- if( mrTextForwarder )
- return mrTextForwarder->IsValid();
- else
- return sal_False;
-}
-
-LanguageType SvxAccessibleTextAdapter::GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
-
- aIndex.SetIndex( nPara, nPos, *this );
-
- return mrTextForwarder->GetLanguage( nPara, aIndex.GetEEIndex() );
-}
-
-sal_uInt16 SvxAccessibleTextAdapter::GetFieldCount( sal_uInt16 nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetFieldCount( nPara );
-}
-
-EFieldInfo SvxAccessibleTextAdapter::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetFieldInfo( nPara, nField );
-}
-
-EBulletInfo SvxAccessibleTextAdapter::GetBulletInfo( sal_uInt16 nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetBulletInfo( nPara );
-}
-
-Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetIndex( nPara, nIndex, *this );
-
- // preset if anything goes wrong below
- // n-th char in GetParagraphIndex's paragraph
- Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, static_cast< sal_uInt16 >( aIndex.GetEEIndex() ) );
-
- if( aIndex.InBullet() )
- {
- EBulletInfo aBulletInfo = GetBulletInfo( nPara );
-
- OutputDevice* pOutDev = GetRefDevice();
-
- DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
-
- // preset if anything goes wrong below
- aRect = aBulletInfo.aBounds; // better than nothing
- if( pOutDev )
- {
- AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
-
- if( aStringWrap.GetCharacterBounds( aIndex.GetBulletOffset(), aRect ) )
- aRect.Move( aBulletInfo.aBounds.Left(), aBulletInfo.aBounds.Top() );
- }
- }
- else
- {
- // handle field content manually
- if( aIndex.InField() )
- {
- OutputDevice* pOutDev = GetRefDevice();
-
- DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
-
- if( pOutDev )
- {
- ESelection aSel = MakeEESelection( aIndex );
-
- SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mrTextForwarder->GetAttribs( aSel ) );
- AccessibleStringWrap aStringWrap( *pOutDev,
- aFont,
- mrTextForwarder->GetText( aSel ) );
-
- Rectangle aStartRect = mrTextForwarder->GetCharBounds( nPara, static_cast< sal_uInt16 >( aIndex.GetEEIndex() ) );
-
- if( !aStringWrap.GetCharacterBounds( aIndex.GetFieldOffset(), aRect ) )
- aRect = aStartRect;
- else
- aRect.Move( aStartRect.Left(), aStartRect.Top() );
- }
- }
- }
-
- return aRect;
-}
-
-Rectangle SvxAccessibleTextAdapter::GetParaBounds( sal_uInt16 nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- EBulletInfo aBulletInfo = GetBulletInfo( nPara );
-
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType != SVX_NUM_BITMAP )
- {
- // include bullet in para bounding box
- Rectangle aRect( mrTextForwarder->GetParaBounds( nPara ) );
-
- aRect.Union( aBulletInfo.aBounds );
-
- return aRect;
- }
-
- return mrTextForwarder->GetParaBounds( nPara );
-}
-
-MapMode SvxAccessibleTextAdapter::GetMapMode() const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetMapMode();
-}
-
-OutputDevice* SvxAccessibleTextAdapter::GetRefDevice() const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetRefDevice();
-}
-
-sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_uInt16& nPara, sal_uInt16& nIndex ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- if( !mrTextForwarder->GetIndexAtPoint( rPoint, nPara, nIndex ) )
- return sal_False;
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetEEIndex(nPara, nIndex, *this);
-
- DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- nIndex = static_cast< sal_uInt16 > (aIndex.GetIndex());
-
- EBulletInfo aBulletInfo = GetBulletInfo( nPara );
-
- // any text bullets?
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType != SVX_NUM_BITMAP )
- {
- if( aBulletInfo.aBounds.IsInside( rPoint) )
- {
- OutputDevice* pOutDev = GetRefDevice();
-
- DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
-
- if( !pOutDev )
- return sal_False;
-
- AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
-
- Point aPoint = rPoint;
- aPoint.Move( -aBulletInfo.aBounds.Left(), -aBulletInfo.aBounds.Top() );
-
- DBG_ASSERT(aStringWrap.GetIndexAtPoint( aPoint ) >= 0 &&
- aStringWrap.GetIndexAtPoint( aPoint ) <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- nIndex = static_cast< sal_uInt16 > (aStringWrap.GetIndexAtPoint( aPoint ));
- return sal_True;
- }
- }
-
- if( aIndex.InField() )
- {
- OutputDevice* pOutDev = GetRefDevice();
-
- DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
-
- if( !pOutDev )
- return sal_False;
-
- ESelection aSelection = MakeEESelection( aIndex );
- SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mrTextForwarder->GetAttribs( aSelection ) );
- AccessibleStringWrap aStringWrap( *pOutDev,
- aFont,
- mrTextForwarder->GetText( aSelection ) );
-
- Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
- Point aPoint = rPoint;
- aPoint.Move( -aRect.Left(), -aRect.Top() );
-
- DBG_ASSERT(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) >= 0 &&
- aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- nIndex = static_cast< sal_uInt16 >(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint ));
- return sal_True;
- }
-
- return sal_True;
-}
-
-sal_Bool SvxAccessibleTextAdapter::GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetIndex(nPara, nIndex, *this);
- nIndex = aIndex.GetEEIndex();
-
- if( aIndex.InBullet() )
- {
- DBG_ASSERT(aIndex.GetBulletLen() >= 0 &&
- aIndex.GetBulletLen() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- // always treat bullet as separate word
- nStart = 0;
- nEnd = static_cast< sal_uInt16 > (aIndex.GetBulletLen());
-
- return sal_True;
- }
-
- if( aIndex.InField() )
- {
- DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0 &&
- aIndex.GetIndex() - aIndex.GetFieldOffset() <= USHRT_MAX &&
- nStart + aIndex.GetFieldLen() >= 0 &&
- nStart + aIndex.GetFieldLen() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- // always treat field as separate word
- // TODO: to circumvent this, _we_ would have to do the break iterator stuff!
- nStart = static_cast< sal_uInt16 > (aIndex.GetIndex() - aIndex.GetFieldOffset());
- nEnd = static_cast< sal_uInt16 > (nStart + aIndex.GetFieldLen());
-
- return sal_True;
- }
-
- if( !mrTextForwarder->GetWordIndices( nPara, nIndex, nStart, nEnd ) )
- return sal_False;
-
- aIndex.SetEEIndex( nPara, nStart, *this );
- DBG_ASSERT(aIndex.GetIndex() >= 0 &&
- aIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
- nStart = static_cast< sal_uInt16 > (aIndex.GetIndex());
-
- aIndex.SetEEIndex( nPara, nEnd, *this );
- DBG_ASSERT(aIndex.GetIndex() >= 0 &&
- aIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
- nEnd = static_cast< sal_uInt16 > (aIndex.GetIndex());
-
- return sal_True;
-}
-
-sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetIndex(nPara, nIndex, *this);
- nIndex = aIndex.GetEEIndex();
-
- if( aIndex.InBullet() )
- {
- DBG_ASSERT(aIndex.GetBulletLen() >= 0 &&
- aIndex.GetBulletLen() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- // always treat bullet as distinct attribute
- nStartIndex = 0;
- nEndIndex = static_cast< sal_uInt16 > (aIndex.GetBulletLen());
-
- return sal_True;
- }
-
- if( aIndex.InField() )
- {
- DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0 &&
- aIndex.GetIndex() - aIndex.GetFieldOffset() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- // always treat field as distinct attribute
- nStartIndex = static_cast< sal_uInt16 > (aIndex.GetIndex() - aIndex.GetFieldOffset());
- nEndIndex = static_cast< sal_uInt16 > (nStartIndex + aIndex.GetFieldLen());
-
- return sal_True;
- }
-
- if( !mrTextForwarder->GetAttributeRun( nStartIndex, nEndIndex, nPara, nIndex ) )
- return sal_False;
-
- aIndex.SetEEIndex( nPara, nStartIndex, *this );
- DBG_ASSERT(aIndex.GetIndex() >= 0 &&
- aIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
- nStartIndex = static_cast< sal_uInt16 > (aIndex.GetIndex());
-
- aIndex.SetEEIndex( nPara, nEndIndex, *this );
- DBG_ASSERT(aIndex.GetIndex() >= 0 &&
- aIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
- nEndIndex = static_cast< sal_uInt16 > (aIndex.GetIndex());
-
- return sal_True;
-}
-
-sal_uInt16 SvxAccessibleTextAdapter::GetLineCount( sal_uInt16 nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetLineCount( nPara );
-}
-
-sal_uInt16 SvxAccessibleTextAdapter::GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
- sal_uInt16 nCurrLine;
- sal_uInt16 nCurrIndex, nLastIndex;
- for( nCurrLine=0, nCurrIndex=0, nLastIndex=0; nCurrLine<=nLine; ++nCurrLine )
- {
- nLastIndex = nCurrIndex;
- nCurrIndex =
- nCurrIndex + mrTextForwarder->GetLineLen( nPara, nCurrLine );
- }
-
- aEndIndex.SetEEIndex( nPara, nCurrIndex, *this );
- if( nLine > 0 )
- {
- aStartIndex.SetEEIndex( nPara, nLastIndex, *this );
-
- return static_cast< sal_uInt16 >(aEndIndex.GetIndex() - aStartIndex.GetIndex());
- }
- else
- return static_cast< sal_uInt16 >(aEndIndex.GetIndex());
-}
-
-void SvxAccessibleTextAdapter::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const
-{
- mrTextForwarder->GetLineBoundaries( rStart, rEnd, nParagraph, nLine );
-}
-
-sal_uInt16 SvxAccessibleTextAdapter::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- return mrTextForwarder->GetLineNumberAtIndex( nPara, nIndex );
-}
-
-sal_Bool SvxAccessibleTextAdapter::Delete( const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- return mrTextForwarder->Delete( MakeEESelection(aStartIndex, aEndIndex ) );
-}
-
-sal_Bool SvxAccessibleTextAdapter::InsertText( const String& rStr, const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- return mrTextForwarder->InsertText( rStr, MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-sal_Bool SvxAccessibleTextAdapter::QuickFormatDoc( sal_Bool bFull )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->QuickFormatDoc( bFull );
-}
-
-sal_Int16 SvxAccessibleTextAdapter::GetDepth( sal_uInt16 nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetDepth( nPara );
-}
-
-sal_Bool SvxAccessibleTextAdapter::SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->SetDepth( nPara, nNewDepth );
-}
-
-void SvxAccessibleTextAdapter::SetForwarder( SvxTextForwarder& rForwarder )
-{
- mrTextForwarder = &rForwarder;
-}
-
-sal_Bool SvxAccessibleTextAdapter::HaveImageBullet( sal_uInt16 nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- EBulletInfo aBulletInfo = GetBulletInfo( nPara );
-
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType == SVX_NUM_BITMAP )
- {
- return sal_True;
- }
- else
- {
- return sal_False;
- }
-}
-
-sal_Bool SvxAccessibleTextAdapter::HaveTextBullet( sal_uInt16 nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- EBulletInfo aBulletInfo = GetBulletInfo( nPara );
-
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType != SVX_NUM_BITMAP )
- {
- return sal_True;
- }
- else
- {
- return sal_False;
- }
-}
-
-sal_Bool SvxAccessibleTextAdapter::IsEditable( const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- // normalize selection
- if( rSel.nStartPara > rSel.nEndPara ||
- (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) )
- {
- ::std::swap( aStartIndex, aEndIndex );
- }
-
- return aStartIndex.IsEditableRange( aEndIndex );
-}
-
-const SfxItemSet * SvxAccessibleTextAdapter::GetEmptyItemSetPtr()
-{
- OSL_FAIL( "not implemented" );
- return 0;
-}
-
-void SvxAccessibleTextAdapter::AppendParagraph()
-{
- OSL_FAIL( "not implemented" );
-}
-
-xub_StrLen SvxAccessibleTextAdapter::AppendTextPortion( sal_uInt16, const String &, const SfxItemSet & )
-{
- OSL_FAIL( "not implemented" );
- return 0;
-}
-void SvxAccessibleTextAdapter::CopyText(const SvxTextForwarder&)
-{
- OSL_FAIL( "not implemented" );
-}
-
-
-
-//---------------------------------------------------------------------------------------
-
-SvxAccessibleTextEditViewAdapter::SvxAccessibleTextEditViewAdapter()
-{
-}
-
-SvxAccessibleTextEditViewAdapter::~SvxAccessibleTextEditViewAdapter()
-{
-}
-
-sal_Bool SvxAccessibleTextEditViewAdapter::IsValid() const
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- if( mrViewForwarder )
- return mrViewForwarder->IsValid();
- else
- return sal_False;
-}
-
-Rectangle SvxAccessibleTextEditViewAdapter::GetVisArea() const
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->GetVisArea();
-}
-
-Point SvxAccessibleTextEditViewAdapter::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->LogicToPixel(rPoint, rMapMode);
-}
-
-Point SvxAccessibleTextEditViewAdapter::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->PixelToLogic(rPoint, rMapMode);
-}
-
-sal_Bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) const
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- ESelection aSelection;
-
- if( !mrViewForwarder->GetSelection( aSelection ) )
- return sal_False;
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetEEIndex( aSelection.nStartPara, aSelection.nStartPos, *mrTextForwarder );
- aEndIndex.SetEEIndex( aSelection.nEndPara, aSelection.nEndPos, *mrTextForwarder );
-
- DBG_ASSERT(aStartIndex.GetIndex() >= 0 && aStartIndex.GetIndex() <= USHRT_MAX &&
- aEndIndex.GetIndex() >= 0 && aEndIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextEditViewAdapter::GetSelection: index value overflow");
-
- rSel = ESelection( aStartIndex.GetParagraph(), static_cast< sal_uInt16 > (aStartIndex.GetIndex()),
- aEndIndex.GetParagraph(), static_cast< sal_uInt16 > (aEndIndex.GetIndex()) );
-
- return sal_True;
-}
-
-sal_Bool SvxAccessibleTextEditViewAdapter::SetSelection( const ESelection& rSel )
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *mrTextForwarder );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *mrTextForwarder );
-
- return mrViewForwarder->SetSelection( MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-sal_Bool SvxAccessibleTextEditViewAdapter::Copy()
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->Copy();
-}
-
-sal_Bool SvxAccessibleTextEditViewAdapter::Cut()
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->Cut();
-}
-
-sal_Bool SvxAccessibleTextEditViewAdapter::Paste()
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->Paste();
-}
-
-void SvxAccessibleTextEditViewAdapter::SetForwarder( SvxEditViewForwarder& rForwarder,
- SvxAccessibleTextAdapter& rTextForwarder )
-{
- mrViewForwarder = &rForwarder;
- mrTextForwarder = &rTextForwarder;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/uno/unoedsrc.cxx b/editeng/source/uno/unoedsrc.cxx
deleted file mode 100644
index 06337654b5..0000000000
--- a/editeng/source/uno/unoedsrc.cxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <svl/brdcst.hxx>
-
-#include <editeng/unoedsrc.hxx>
-
-
-//------------------------------------------------------------------------
-
-void SvxEditSource::addRange( SvxUnoTextRangeBase* )
-{
-}
-
-//------------------------------------------------------------------------
-
-void SvxEditSource::removeRange( SvxUnoTextRangeBase* )
-{
-}
-
-//------------------------------------------------------------------------
-
-const SvxUnoTextRangeBaseList& SvxEditSource::getRanges() const
-{
- static SvxUnoTextRangeBaseList gList;
- return gList;
-}
-
-//------------------------------------------------------------------------
-
-SvxTextForwarder::~SvxTextForwarder()
-{
-}
-
-//------------------------------------------------------------------------
-
-SvxViewForwarder::~SvxViewForwarder()
-{
-}
-
-//------------------------------------------------------------------------
-
-SvxEditSource::~SvxEditSource()
-{
-}
-
-SvxViewForwarder* SvxEditSource::GetViewForwarder()
-{
- return NULL;
-}
-
-SvxEditViewForwarder* SvxEditSource::GetEditViewForwarder( sal_Bool )
-{
- return NULL;
-}
-
-SfxBroadcaster& SvxEditSource::GetBroadcaster() const
-{
- 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
deleted file mode 100644
index 7c24f97893..0000000000
--- a/editeng/source/uno/unofdesc.cxx
+++ /dev/null
@@ -1,266 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <editeng/eeitem.hxx>
-#include <com/sun/star/uno/Any.hxx>
-
-#include <toolkit/helper/vclunohelper.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/crsditem.hxx>
-#include <editeng/wrlmitem.hxx>
-#include <editeng/memberids.hrc>
-#include <svl/itempool.hxx>
-
-#include <editeng/unofdesc.hxx>
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-
-
-void SvxUnoFontDescriptor::ConvertToFont( const awt::FontDescriptor& rDesc, Font& rFont )
-{
- rFont.SetName( rDesc.Name );
- rFont.SetStyleName( rDesc.StyleName );
- rFont.SetSize( Size( rDesc.Width, rDesc.Height ) );
- rFont.SetFamily( (FontFamily)rDesc.Family );
- rFont.SetCharSet( (CharSet)rDesc.CharSet );
- rFont.SetPitch( (FontPitch)rDesc.Pitch );
- rFont.SetOrientation( (short)(rDesc.Orientation*10) );
- rFont.SetKerning( rDesc.Kerning );
- rFont.SetWeight( VCLUnoHelper::ConvertFontWeight(rDesc.Weight) );
- rFont.SetItalic( (FontItalic)rDesc.Slant );
- rFont.SetUnderline( (FontUnderline)rDesc.Underline );
- rFont.SetStrikeout( (FontStrikeout)rDesc.Strikeout );
- rFont.SetWordLineMode( rDesc.WordLineMode );
-}
-
-void SvxUnoFontDescriptor::ConvertFromFont( const Font& rFont, awt::FontDescriptor& rDesc )
-{
- rDesc.Name = rFont.GetName();
- rDesc.StyleName = rFont.GetStyleName();
- rDesc.Width = sal::static_int_cast< sal_Int16 >(rFont.GetSize().Width());
- rDesc.Height = sal::static_int_cast< sal_Int16 >(rFont.GetSize().Height());
- rDesc.Family = sal::static_int_cast< sal_Int16 >(rFont.GetFamily());
- rDesc.CharSet = rFont.GetCharSet();
- rDesc.Pitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch());
- rDesc.Orientation = static_cast< float >(rFont.GetOrientation() / 10);
- rDesc.Kerning = rFont.IsKerning();
- rDesc.Weight = VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() );
- rDesc.Slant = (awt::FontSlant)rFont.GetItalic();
- rDesc.Underline = sal::static_int_cast< sal_Int16 >(rFont.GetUnderline());
- rDesc.Strikeout = sal::static_int_cast< sal_Int16 >(rFont.GetStrikeout());
- rDesc.WordLineMode = rFont.IsWordLineMode();
-}
-
-void SvxUnoFontDescriptor::FillItemSet( const awt::FontDescriptor& rDesc, SfxItemSet& rSet )
-{
- uno::Any aTemp;
-
- {
- SvxFontItem aFontItem( EE_CHAR_FONTINFO );
- aFontItem.SetFamilyName( rDesc.Name);
- aFontItem.SetStyleName( rDesc.StyleName);
- aFontItem.SetFamily( (FontFamily)rDesc.Family);
- aFontItem.SetCharSet( rDesc.CharSet );
- aFontItem.SetPitch( (FontPitch)rDesc.Pitch);
- rSet.Put(aFontItem);
- }
-
- {
- SvxFontHeightItem aFontHeightItem( 0, 100, EE_CHAR_FONTHEIGHT );
- aTemp <<= (float)rDesc.Height;
- ((SfxPoolItem*)&aFontHeightItem)->PutValue( aTemp, MID_FONTHEIGHT|CONVERT_TWIPS );
- rSet.Put(aFontHeightItem);
- }
-
- {
- SvxPostureItem aPostureItem( (FontItalic)0, EE_CHAR_ITALIC );
- aTemp <<= rDesc.Slant;
- ((SfxPoolItem*)&aPostureItem)->PutValue( aTemp, MID_POSTURE );
- rSet.Put(aPostureItem);
- }
-
- {
- SvxUnderlineItem aUnderlineItem( (FontUnderline)0, EE_CHAR_UNDERLINE );
- aTemp <<= (sal_Int16)rDesc.Underline;
- ((SfxPoolItem*)&aUnderlineItem)->PutValue( aTemp, MID_TL_STYLE );
- rSet.Put( aUnderlineItem );
- }
-
- {
- SvxWeightItem aWeightItem( (FontWeight)0, EE_CHAR_WEIGHT );
- aTemp <<= rDesc.Weight;
- ((SfxPoolItem*)&aWeightItem)->PutValue( aTemp, MID_WEIGHT );
- rSet.Put( aWeightItem );
- }
-
- {
- SvxCrossedOutItem aCrossedOutItem( (FontStrikeout)0, EE_CHAR_STRIKEOUT );
- aTemp <<= rDesc.Strikeout;
- ((SfxPoolItem*)&aCrossedOutItem)->PutValue( aTemp, MID_CROSS_OUT );
- rSet.Put( aCrossedOutItem );
- }
-
- {
- SvxWordLineModeItem aWLMItem( rDesc.WordLineMode, EE_CHAR_WLM );
- rSet.Put( aWLMItem );
- }
-}
-
-void SvxUnoFontDescriptor::FillFromItemSet( const SfxItemSet& rSet, awt::FontDescriptor& rDesc )
-{
- const SfxPoolItem* pItem = NULL;
- {
- SvxFontItem* pFontItem = (SvxFontItem*)&rSet.Get( EE_CHAR_FONTINFO, sal_True );
- rDesc.Name = pFontItem->GetFamilyName();
- rDesc.StyleName = pFontItem->GetStyleName();
- rDesc.Family = sal::static_int_cast< sal_Int16 >(
- pFontItem->GetFamily());
- rDesc.CharSet = pFontItem->GetCharSet();
- rDesc.Pitch = sal::static_int_cast< sal_Int16 >(
- pFontItem->GetPitch());
- }
- {
- pItem = &rSet.Get( EE_CHAR_FONTHEIGHT, sal_True );
- uno::Any aHeight;
- if( pItem->QueryValue( aHeight, MID_FONTHEIGHT ) )
- aHeight >>= rDesc.Height;
- }
- {
- pItem = &rSet.Get( EE_CHAR_ITALIC, sal_True );
- uno::Any aFontSlant;
- if(pItem->QueryValue( aFontSlant, MID_POSTURE ))
- aFontSlant >>= rDesc.Slant;
- }
- {
- pItem = &rSet.Get( EE_CHAR_UNDERLINE, sal_True );
- uno::Any aUnderline;
- if(pItem->QueryValue( aUnderline, MID_TL_STYLE ))
- aUnderline >>= rDesc.Underline;
- }
- {
- pItem = &rSet.Get( EE_CHAR_WEIGHT, sal_True );
- uno::Any aWeight;
- if(pItem->QueryValue( aWeight, MID_WEIGHT ))
- aWeight >>= rDesc.Weight;
- }
- {
- pItem = &rSet.Get( EE_CHAR_STRIKEOUT, sal_True );
- uno::Any aStrikeOut;
- if(pItem->QueryValue( aStrikeOut, MID_CROSS_OUT ))
- aStrikeOut >>= rDesc.Strikeout;
- }
- {
- SvxWordLineModeItem* pWLMItem = (SvxWordLineModeItem*)&rSet.Get( EE_CHAR_WLM, sal_True );
- rDesc.WordLineMode = pWLMItem->GetValue();
- }
-}
-
-#define CheckState( state ) \
- switch( state ) \
- { \
- case SFX_ITEM_DONTCARE: \
- case SFX_ITEM_DISABLED: \
- return beans::PropertyState_AMBIGUOUS_VALUE; \
- case SFX_ITEM_READONLY: \
- case SFX_ITEM_SET: \
- return beans::PropertyState_DIRECT_VALUE; \
- }
-
-beans::PropertyState SvxUnoFontDescriptor::getPropertyState( const SfxItemSet& rSet )
-{
- CheckState(rSet.GetItemState( EE_CHAR_FONTINFO, sal_False ));
- CheckState(rSet.GetItemState( EE_CHAR_FONTHEIGHT, sal_False ));
- CheckState(rSet.GetItemState( EE_CHAR_ITALIC, sal_False ));
- CheckState(rSet.GetItemState( EE_CHAR_UNDERLINE, sal_False ));
- CheckState(rSet.GetItemState( EE_CHAR_WEIGHT, sal_False ));
- CheckState(rSet.GetItemState( EE_CHAR_STRIKEOUT, sal_False ));
- CheckState(rSet.GetItemState( EE_CHAR_WLM, sal_False ));
-
- return beans::PropertyState_DEFAULT_VALUE;
-}
-
-void SvxUnoFontDescriptor::setPropertyToDefault( SfxItemSet& rSet )
-{
- rSet.InvalidateItem( EE_CHAR_FONTINFO );
- rSet.InvalidateItem( EE_CHAR_FONTHEIGHT );
- rSet.InvalidateItem( EE_CHAR_ITALIC );
- rSet.InvalidateItem( EE_CHAR_UNDERLINE );
- rSet.InvalidateItem( EE_CHAR_WEIGHT );
- rSet.InvalidateItem( EE_CHAR_STRIKEOUT );
- rSet.InvalidateItem( EE_CHAR_WLM );
-}
-
-uno::Any SvxUnoFontDescriptor::getPropertyDefault( SfxItemPool* pPool )
-{
- SfxItemSet aSet( *pPool, EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
- EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT,
- EE_CHAR_ITALIC, EE_CHAR_ITALIC,
- EE_CHAR_UNDERLINE, EE_CHAR_UNDERLINE,
- EE_CHAR_WEIGHT, EE_CHAR_WEIGHT,
- EE_CHAR_STRIKEOUT, EE_CHAR_STRIKEOUT,
- EE_CHAR_WLM, EE_CHAR_WLM, 0 );
-
- uno::Any aAny;
-
- if(!pPool->IsWhich(EE_CHAR_FONTINFO)||
- !pPool->IsWhich(EE_CHAR_FONTHEIGHT)||
- !pPool->IsWhich(EE_CHAR_ITALIC)||
- !pPool->IsWhich(EE_CHAR_UNDERLINE)||
- !pPool->IsWhich(EE_CHAR_WEIGHT)||
- !pPool->IsWhich(EE_CHAR_STRIKEOUT)||
- !pPool->IsWhich(EE_CHAR_WLM))
- return aAny;
-
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_FONTINFO));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_FONTHEIGHT));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_ITALIC));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_UNDERLINE));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_WEIGHT));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_STRIKEOUT));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_WLM));
-
- awt::FontDescriptor aDesc;
-
- FillFromItemSet( aSet, aDesc );
-
- aAny <<= aDesc;
-
- return aAny;
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
deleted file mode 100644
index 6fd51ed0d7..0000000000
--- a/editeng/source/uno/unofield.cxx
+++ /dev/null
@@ -1,1179 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <com/sun/star/util/DateTime.hpp>
-#include <com/sun/star/text/FilenameDisplayFormat.hpp>
-#include <com/sun/star/lang/NoSupportException.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <vcl/svapp.hxx>
-#include <osl/mutex.hxx>
-
-#include <editeng/eeitem.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/measfld.hxx>
-#include <editeng/unofield.hxx>
-#include <editeng/unotext.hxx>
-#include <comphelper/serviceinfohelper.hxx>
-#include <comphelper/servicehelper.hxx>
-
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::com::sun::star;
-
-#define QUERYINT( xint ) \
- if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
- aAny <<= uno::Reference< xint >(this)
-
-
-#define WID_DATE 0
-#define WID_BOOL1 1
-#define WID_BOOL2 2
-#define WID_INT32 3
-#define WID_INT16 4
-#define WID_STRING1 5
-#define WID_STRING2 6
-#define WID_STRING3 7
-
-class SvxUnoFieldData_Impl
-{
-public:
- sal_Bool mbBoolean1;
- sal_Bool mbBoolean2;
- sal_Int32 mnInt32;
- sal_Int16 mnInt16;
- OUString msString1;
- OUString msString2;
- OUString msString3;
- util::DateTime maDateTime;
-
- OUString msPresentation;
-};
-
-const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
-{
- static SfxItemPropertyMapEntry aExDateTimeFieldPropertyMap_Impl[] =
- {
- { MAP_CHAR_LEN("DateTime"), WID_DATE, &::getCppuType((const util::DateTime*)0), 0, 0 },
- { MAP_CHAR_LEN("IsFixed"), WID_BOOL1, &::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN("IsDate"), WID_BOOL2, &::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN("NumberFormat"), WID_INT32, &::getCppuType((const sal_Int16*)0), 0, 0 },
- {0,0,0,0,0,0}
- };
- static SfxItemPropertySet aExDateTimeFieldPropertySet_Impl(aExDateTimeFieldPropertyMap_Impl);
-
- static SfxItemPropertyMapEntry aDateTimeFieldPropertyMap_Impl[] =
- {
- { MAP_CHAR_LEN("IsDate"), WID_BOOL2, &::getBooleanCppuType(), 0, 0 },
- {0,0,0,0,0,0}
- };
- static SfxItemPropertySet aDateTimeFieldPropertySet_Impl(aDateTimeFieldPropertyMap_Impl);
-
- static SfxItemPropertyMapEntry aUrlFieldPropertyMap_Impl[] =
- {
-
- { MAP_CHAR_LEN("Format"), WID_INT16, &::getCppuType((const sal_Int16*)0), 0, 0 },
- { MAP_CHAR_LEN("Representation"), WID_STRING1, &::getCppuType((const OUString*)0), 0, 0 },
- { MAP_CHAR_LEN("TargetFrame"), WID_STRING2, &::getCppuType((const OUString*)0), 0, 0 },
- { MAP_CHAR_LEN("URL"), WID_STRING3, &::getCppuType((const OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
- };
- static SfxItemPropertySet aUrlFieldPropertySet_Impl(aUrlFieldPropertyMap_Impl);
-
- static SfxItemPropertyMapEntry aEmptyPropertyMap_Impl[] =
- {
- {0,0,0,0,0,0}
- };
- static SfxItemPropertySet aEmptyPropertySet_Impl(aEmptyPropertyMap_Impl);
-
- static SfxItemPropertyMapEntry aExtFileFieldPropertyMap_Impl[] =
- {
- { MAP_CHAR_LEN("IsFixed"), WID_BOOL1, &::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN("FileFormat"), WID_INT16, &::getCppuType((const sal_Int16*)0), 0, 0 },
- { MAP_CHAR_LEN("CurrentPresentation"), WID_STRING1,&::getCppuType((const OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
- };
- static SfxItemPropertySet aExtFileFieldPropertySet_Impl(aExtFileFieldPropertyMap_Impl);
-
- static SfxItemPropertyMapEntry aAuthorFieldPropertyMap_Impl[] =
- {
- { MAP_CHAR_LEN("IsFixed"), WID_BOOL1, &::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN("CurrentPresentation"), WID_STRING1,&::getCppuType((const OUString*)0), 0, 0 },
- { MAP_CHAR_LEN("Content"), WID_STRING2,&::getCppuType((const OUString*)0), 0, 0 },
- { MAP_CHAR_LEN("AuthorFormat"), WID_INT16, &::getCppuType((const sal_Int16*)0), 0, 0 },
- { MAP_CHAR_LEN("FullName"), WID_BOOL2, &::getBooleanCppuType(), 0, 0 },
- {0,0,0,0,0,0}
- };
- static SfxItemPropertySet aAuthorFieldPropertySet_Impl(aAuthorFieldPropertyMap_Impl);
-
- static SfxItemPropertyMapEntry aMeasureFieldPropertyMap_Impl[] =
- {
- { MAP_CHAR_LEN("Kind"), WID_INT16, &::getCppuType((const sal_Int16*)0), 0, 0 },
- {0,0,0,0,0,0}
- };
- static SfxItemPropertySet aMeasureFieldPropertySet_Impl(aMeasureFieldPropertyMap_Impl);
-
- switch( mnId )
- {
- case ID_EXT_DATEFIELD:
- case ID_EXT_TIMEFIELD:
- return &aExDateTimeFieldPropertySet_Impl;
- case ID_URLFIELD:
- return &aUrlFieldPropertySet_Impl;
- case ID_DATEFIELD:
- case ID_TIMEFIELD:
- return &aDateTimeFieldPropertySet_Impl;
- case ID_EXT_FILEFIELD:
- return &aExtFileFieldPropertySet_Impl;
- case ID_AUTHORFIELD:
- return &aAuthorFieldPropertySet_Impl;
- case ID_MEASUREFIELD:
- return &aMeasureFieldPropertySet_Impl;
-// case ID_PAGEFIELD:
-// case ID_PAGESFIELD:
-// case ID_FILEFIELD:
-// case ID_TABLEFIELD:
-// case ID_HEADERFIELD:
-// case ID_FOOTERFIELD:
-// case ID_DATETIMEFIELD::
- default:
- return &aEmptyPropertySet_Impl;
- }
-}
-
-static sal_Char const* aFieldItemNameMap_Impl[] =
-{
- "Date",
- "URL",
- "Page",
- "Pages",
- "Time",
- "File",
- "Table",
- "ExtTime",
- "ExtFile",
- "Author",
- "Measure",
- "ExtDate",
- "Header",
- "Footer",
- "DateTime",
- "Unknown"
-};
-
-/* conversion routines */
-
-static sal_Int16 getFileNameDisplayFormat( SvxFileFormat nFormat )
-{
- switch( nFormat )
- {
- case SVXFILEFORMAT_NAME_EXT: return text::FilenameDisplayFormat::NAME_AND_EXT;
- case SVXFILEFORMAT_FULLPATH: return text::FilenameDisplayFormat::FULL;
- case SVXFILEFORMAT_PATH: return text::FilenameDisplayFormat::PATH;
-// case SVXFILEFORMAT_NAME:
- default: return text::FilenameDisplayFormat::NAME;
- }
-}
-
-static SvxFileFormat setFileNameDisplayFormat( sal_Int16 nFormat )
-{
- switch( nFormat )
- {
- case text::FilenameDisplayFormat::FULL: return SVXFILEFORMAT_FULLPATH;
- case text::FilenameDisplayFormat::PATH: return SVXFILEFORMAT_PATH;
- case text::FilenameDisplayFormat::NAME: return SVXFILEFORMAT_NAME;
-// case text::FilenameDisplayFormat::NAME_AND_EXT:
- default:
- return SVXFILEFORMAT_NAME_EXT;
- }
-}
-
-static util::DateTime getDate( sal_uLong nDate )
-{
- util::DateTime aDate;
- memset( &aDate, 0, sizeof( util::DateTime ) );
-
- Date aTempDate( nDate );
-
- aDate.Day = aTempDate.GetDay();
- aDate.Month = aTempDate.GetMonth();
- aDate.Year = aTempDate.GetYear();
-
- return aDate;
-}
-
-inline Date setDate( util::DateTime& rDate )
-{
- return Date( rDate.Day, rDate.Month, rDate.Year );
-}
-
-static util::DateTime getTime( long nTime )
-{
- util::DateTime aTime;
- memset( &aTime, 0, sizeof( util::DateTime ) );
-
- Time aTempTime( nTime );
-
- aTime.HundredthSeconds = aTempTime.Get100Sec();
- aTime.Seconds = aTempTime.GetSec();
- aTime.Minutes = aTempTime.GetMin();
- aTime.Hours = aTempTime.GetHour();
-
- return aTime;
-}
-
-inline Time setTime( util::DateTime& rDate )
-{
- return Time( rDate.Hours, rDate.Minutes, rDate.Seconds, rDate.HundredthSeconds );
-}
-
-// ====================================================================
-// class SvxUnoTextField
-// ====================================================================
-UNO3_GETIMPLEMENTATION_IMPL( SvxUnoTextField );
-
-SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) throw()
-: OComponentHelper( getMutex() )
-, mpPropSet(NULL)
-, mnServiceId(nServiceId)
-, mpImpl( new SvxUnoFieldData_Impl )
-{
- mpPropSet = ImplGetFieldItemPropertySet(mnServiceId);
-
- memset( &(mpImpl->maDateTime), 0, sizeof( util::DateTime ) );
-
- switch( nServiceId )
- {
- case ID_EXT_DATEFIELD:
- case ID_DATEFIELD:
- mpImpl->mbBoolean2 = sal_True;
- mpImpl->mnInt32 = SVXDATEFORMAT_STDSMALL;
- mpImpl->mbBoolean1 = sal_False;
- break;
-
- case ID_EXT_TIMEFIELD:
- case ID_TIMEFIELD:
- mpImpl->mbBoolean2 = sal_False;
- mpImpl->mbBoolean1 = sal_False;
- mpImpl->mnInt32 = SVXTIMEFORMAT_STANDARD;
- break;
-
- case ID_URLFIELD:
- mpImpl->mnInt16 = SVXURLFORMAT_REPR;
- break;
-
- case ID_EXT_FILEFIELD:
- mpImpl->mbBoolean1 = sal_False;
- mpImpl->mnInt16 = text::FilenameDisplayFormat::FULL;
- break;
-
- case ID_AUTHORFIELD:
- mpImpl->mnInt16 = SVXAUTHORFORMAT_FULLNAME;
- mpImpl->mbBoolean1 = sal_False;
- mpImpl->mbBoolean2 = sal_True;
- break;
-
- case ID_MEASUREFIELD:
- mpImpl->mnInt16 = SDRMEASUREFIELD_VALUE;
- break;
-
- default:
- mpImpl->mbBoolean1 = sal_False;
- mpImpl->mbBoolean2 = sal_False;
- mpImpl->mnInt32 = 0;
- mpImpl->mnInt16 = 0;
-
- }
-}
-
-SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, const OUString& rPresentation, const SvxFieldData* pData ) throw()
-: OComponentHelper( getMutex() )
-, mxAnchor( xAnchor )
-, mpPropSet(NULL)
-, mnServiceId(ID_UNKNOWN)
-, mpImpl( new SvxUnoFieldData_Impl )
-{
- DBG_ASSERT(pData, "pFieldData == NULL! [CL]" );
-
- mpImpl->msPresentation = rPresentation;
-
- if(pData)
- {
- mnServiceId = GetFieldId(pData);
- DBG_ASSERT(mnServiceId != ID_UNKNOWN, "unknown SvxFieldData! [CL]");
- if(mnServiceId != ID_UNKNOWN)
- {
- // extract field properties from data class
- switch( mnServiceId )
- {
- case ID_DATEFIELD:
- case ID_EXT_DATEFIELD:
- {
- mpImpl->mbBoolean2 = sal_True;
- // #i35416# for variable date field, don't use invalid "0000-00-00" date,
- // use current date instead
- sal_Bool bFixed = ((SvxDateField*)pData)->GetType() == SVXDATETYPE_FIX;
- mpImpl->maDateTime = getDate( bFixed ?
- ((SvxDateField*)pData)->GetFixDate() :
- Date().GetDate() );
- mpImpl->mnInt32 = ((SvxDateField*)pData)->GetFormat();
- mpImpl->mbBoolean1 = bFixed;
- }
- break;
-
- case ID_TIMEFIELD:
- mpImpl->mbBoolean2 = sal_False;
- mpImpl->mbBoolean1 = sal_False;
- mpImpl->mnInt32 = SVXTIMEFORMAT_STANDARD;
- break;
-
- case ID_EXT_TIMEFIELD:
- mpImpl->mbBoolean2 = sal_False;
- mpImpl->maDateTime = getTime( ((SvxExtTimeField*)pData)->GetFixTime() );
- mpImpl->mbBoolean1 = ((SvxExtTimeField*)pData)->GetType() == SVXTIMETYPE_FIX;
- mpImpl->mnInt32 = ((SvxExtTimeField*)pData)->GetFormat();
- break;
-
- case ID_URLFIELD:
- mpImpl->msString1 = ((SvxURLField*)pData)->GetRepresentation();
- mpImpl->msString2 = ((SvxURLField*)pData)->GetTargetFrame();
- mpImpl->msString3 = ((SvxURLField*)pData)->GetURL();
- mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >(
- ((SvxURLField*)pData)->GetFormat());
- break;
-
- case ID_EXT_FILEFIELD:
- mpImpl->msString1 = ((SvxExtFileField*)pData)->GetFile();
- mpImpl->mbBoolean1 = ((SvxExtFileField*)pData)->GetType() == SVXFILETYPE_FIX;
- mpImpl->mnInt16 = getFileNameDisplayFormat(((SvxExtFileField*)pData)->GetFormat());
- break;
-
- case ID_AUTHORFIELD:
- mpImpl->msString1 = ((SvxAuthorField*)pData)->GetFormatted();
- mpImpl->msString2 = ((SvxAuthorField*)pData)->GetFormatted();
- mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >(
- ((SvxAuthorField*)pData)->GetFormat());
- mpImpl->mbBoolean1 = ((SvxAuthorField*)pData)->GetType() == SVXAUTHORTYPE_FIX;
- mpImpl->mbBoolean2 = ((SvxAuthorField*)pData)->GetFormat() != SVXAUTHORFORMAT_SHORTNAME;
- break;
-
- case ID_MEASUREFIELD:
- mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >(((SdrMeasureField*)pData)->GetMeasureFieldKind());
- break;
- }
- }
- }
-
- mpPropSet = ImplGetFieldItemPropertySet(mnServiceId);
-}
-
-SvxUnoTextField::~SvxUnoTextField() throw()
-{
- delete mpImpl;
-}
-
-SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
-{
- SvxFieldData* pData = NULL;
-
- switch( mnServiceId )
- {
- case ID_TIMEFIELD:
- case ID_EXT_TIMEFIELD:
- case ID_DATEFIELD:
- case ID_EXT_DATEFIELD:
- {
- if( mpImpl->mbBoolean2 ) // IsDate?
- {
- Date aDate( setDate( mpImpl->maDateTime ) );
- pData = new SvxDateField( aDate, mpImpl->mbBoolean1?SVXDATETYPE_FIX:SVXDATETYPE_VAR );
- if( mpImpl->mnInt32 >= SVXDATEFORMAT_APPDEFAULT && mpImpl->mnInt32 <= SVXDATEFORMAT_F )
- ((SvxDateField*)pData)->SetFormat( (SvxDateFormat)mpImpl->mnInt32 );
- }
- else
- {
- if( mnServiceId != ID_TIMEFIELD && mnServiceId != ID_DATEFIELD )
- {
- Time aTime( setTime( mpImpl->maDateTime ) );
- pData = new SvxExtTimeField( aTime, mpImpl->mbBoolean1?SVXTIMETYPE_FIX:SVXTIMETYPE_VAR );
-
- if( mpImpl->mnInt32 >= SVXTIMEFORMAT_APPDEFAULT && mpImpl->mnInt32 <= SVXTIMEFORMAT_AM_HMSH )
- ((SvxExtTimeField*)pData)->SetFormat( (SvxTimeFormat)mpImpl->mnInt32 );
- }
- else
- {
- pData = new SvxTimeField();
- }
- }
-
- }
- break;
-
- case ID_URLFIELD:
- pData = new SvxURLField( mpImpl->msString3, mpImpl->msString1, mpImpl->msString1.getLength() ? SVXURLFORMAT_REPR : SVXURLFORMAT_URL );
- ((SvxURLField*)pData)->SetTargetFrame( mpImpl->msString2 );
- if( mpImpl->mnInt16 >= SVXURLFORMAT_APPDEFAULT && mpImpl->mnInt16 <= SVXURLFORMAT_REPR )
- ((SvxURLField*)pData)->SetFormat( (SvxURLFormat)mpImpl->mnInt16 );
- break;
-
- case ID_PAGEFIELD:
- pData = new SvxPageField();
- break;
-
- case ID_PAGESFIELD:
- pData = new SvxPagesField();
- break;
-
- case ID_FILEFIELD:
- pData = new SvxFileField();
- break;
-
- case ID_TABLEFIELD:
- pData = new SvxTableField();
- break;
-
- case ID_EXT_FILEFIELD:
- {
- // #92009# pass fixed attribute to constructor
- pData = new SvxExtFileField( mpImpl->msString1,
- mpImpl->mbBoolean1 ? SVXFILETYPE_FIX : SVXFILETYPE_VAR,
- setFileNameDisplayFormat(mpImpl->mnInt16 ) );
- break;
- }
-
- case ID_AUTHORFIELD:
- {
- ::rtl::OUString aContent;
- String aFirstName;
- String aLastName;
- String aEmpty;
-
- // do we have CurrentPresentation given?
- // mimic behaviour of writer, which means:
- // prefer CurrentPresentation over Content
- // if both are given.
- if( mpImpl->msString1.getLength() )
- aContent = mpImpl->msString1;
- else
- aContent = mpImpl->msString2;
-
- sal_Int32 nPos = aContent.lastIndexOf( sal_Char(' '), 0 );
- if( nPos > 0 )
- {
- aFirstName = aContent.copy( 0, nPos );
- aLastName = aContent.copy( nPos + 1 );
- }
- else
- {
- aLastName = aContent;
- }
-
- // #92009# pass fixed attribute to constructor
- pData = new SvxAuthorField( aFirstName, aLastName, aEmpty,
- mpImpl->mbBoolean1 ? SVXAUTHORTYPE_FIX : SVXAUTHORTYPE_VAR );
-
- if( !mpImpl->mbBoolean2 )
- {
- ((SvxAuthorField*)pData)->SetFormat( SVXAUTHORFORMAT_SHORTNAME );
- }
- else if( mpImpl->mnInt16 >= SVXAUTHORFORMAT_FULLNAME || mpImpl->mnInt16 <= SVXAUTHORFORMAT_SHORTNAME )
- {
- ((SvxAuthorField*)pData)->SetFormat( (SvxAuthorFormat) mpImpl->mnInt16 );
- }
-
- break;
- }
-
- case ID_MEASUREFIELD:
- {
- SdrMeasureFieldKind eKind = SDRMEASUREFIELD_VALUE;
- if( mpImpl->mnInt16 == (sal_Int16)SDRMEASUREFIELD_UNIT || mpImpl->mnInt16 == (sal_Int16)SDRMEASUREFIELD_ROTA90BLANCS )
- eKind = (SdrMeasureFieldKind) mpImpl->mnInt16;
- pData = new SdrMeasureField( eKind);
- break;
- }
- case ID_HEADERFIELD:
- pData = new SvxHeaderField();
- break;
- case ID_FOOTERFIELD:
- pData = new SvxFooterField();
- break;
- case ID_DATETIMEFIELD:
- pData = new SvxDateTimeField();
- break;
- };
-
- return pData;
-}
-
-// uno::XInterface
-uno::Any SAL_CALL SvxUnoTextField::queryAggregation( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- uno::Any aAny;
-
- QUERYINT( beans::XPropertySet );
- else QUERYINT( text::XTextContent );
- else QUERYINT( text::XTextField );
- else QUERYINT( lang::XServiceInfo );
- else QUERYINT( lang::XUnoTunnel );
- else
- return OComponentHelper::queryAggregation( rType );
-
- return aAny;
-}
-
-// XTypeProvider
-
-uno::Sequence< uno::Type > SAL_CALL SvxUnoTextField::getTypes()
- throw (uno::RuntimeException)
-{
- if( maTypeSequence.getLength() == 0 )
- {
- maTypeSequence = OComponentHelper::getTypes();
- sal_Int32 nOldCount = maTypeSequence.getLength();
-
- maTypeSequence.realloc( nOldCount + 4 ); // !DANGER! keep this updated
- uno::Type* pTypes = &maTypeSequence.getArray()[nOldCount];
-
- *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextField >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0);
- }
- return maTypeSequence;
-}
-
-namespace
-{
- class theSvxUnoTextFieldImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextFieldImplementationId > {};
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextField::getImplementationId()
- throw (uno::RuntimeException)
-{
- return theSvxUnoTextFieldImplementationId::get().getSeq();
-}
-
-uno::Any SAL_CALL SvxUnoTextField::queryInterface( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- return OComponentHelper::queryInterface(rType);
-}
-
-void SAL_CALL SvxUnoTextField::acquire() throw( )
-{
- OComponentHelper::acquire();
-}
-
-void SAL_CALL SvxUnoTextField::release() throw( )
-{
- OComponentHelper::release();
-}
-
-// Interface text::XTextField
-OUString SAL_CALL SvxUnoTextField::getPresentation( sal_Bool bShowCommand )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(bShowCommand)
- {
- DBG_ASSERT( ((sal_uInt32)mnServiceId) < ID_UNKNOWN, "Unknown field type" );
- return OUString::createFromAscii( aFieldItemNameMap_Impl[(((sal_uInt32)mnServiceId) > ID_UNKNOWN)? ID_UNKNOWN : mnServiceId ] );
- }
- else
- {
- return mpImpl->msPresentation;
- }
-}
-
-// Interface text::XTextContent
-void SAL_CALL SvxUnoTextField::attach( const uno::Reference< text::XTextRange >& xTextRange )
- throw(lang::IllegalArgumentException, uno::RuntimeException)
-{
- SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xTextRange );
- if(pRange == NULL)
- throw lang::IllegalArgumentException();
-
- SvxFieldData* pData = CreateFieldData();
- if( pData )
- pRange->attachField( pData );
-
- delete pData;
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextField::getAnchor()
- throw(uno::RuntimeException)
-{
- return mxAnchor;
-}
-
-// lang::XComponent
-void SAL_CALL SvxUnoTextField::dispose()
- throw(uno::RuntimeException)
-{
- OComponentHelper::dispose();
-}
-
-void SAL_CALL SvxUnoTextField::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw(uno::RuntimeException)
-{
- OComponentHelper::addEventListener(xListener);
-}
-
-void SAL_CALL SvxUnoTextField::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
- throw(uno::RuntimeException)
-{
- OComponentHelper::removeEventListener(aListener);
-}
-
-
-// Interface beans::XPropertySet
-uno::Reference< beans::XPropertySetInfo > SAL_CALL SvxUnoTextField::getPropertySetInfo( )
- throw(uno::RuntimeException)
-{
- 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)
-{
- SolarMutexGuard aGuard;
-
- if( mpImpl == NULL )
- throw uno::RuntimeException();
-
- const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMap()->getByName( aPropertyName );
- if ( !pMap )
- throw beans::UnknownPropertyException();
-
- switch( pMap->nWID )
- {
- case WID_DATE:
- if(aValue >>= mpImpl->maDateTime)
- return;
- break;
- case WID_BOOL1:
- if(aValue >>= mpImpl->mbBoolean1)
- return;
- break;
- case WID_BOOL2:
- if(aValue >>= mpImpl->mbBoolean2)
- return;
- break;
- case WID_INT16:
- if(aValue >>= mpImpl->mnInt16)
- return;
- break;
- case WID_INT32:
- if(aValue >>= mpImpl->mnInt32)
- return;
- break;
- case WID_STRING1:
- if(aValue >>= mpImpl->msString1)
- return;
- break;
- case WID_STRING2:
- if(aValue >>= mpImpl->msString2)
- return;
- break;
- case WID_STRING3:
- if(aValue >>= mpImpl->msString3)
- return;
- break;
- }
-
- throw lang::IllegalArgumentException();
-
-/*
- case WID_FORMAT:
- {
- sal_Int32 nFormat;
-
- switch( mnId )
- {
- case ID_DATEFIELD:
- {
- SvxDateField* pDate = PTR_CAST( SvxDateField, aFieldItem.GetField() );
- if(pDate)
- pDate->SetFormat( (SvxDateFormat)nFormat );
- break;
- }
- case ID_URLFIELD:
- {
- SvxURLField* pURL = PTR_CAST( SvxURLField, aFieldItem.GetField() );
- if(pURL)
- pURL->SetFormat( (SvxURLFormat)nFormat );
- break;
- }
- case ID_EXT_TIMEFIELD:
- {
- SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, aFieldItem.GetField() );
- if(pTime)
- pTime->SetFormat( (SvxTimeFormat)nFormat );
- break;
- }
- case ID_EXT_FILEFIELD:
- {
- SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, aFieldItem.GetField() );
- if(pFile)
- pFile->SetFormat( (SvxFileFormat)nFormat );
- break;
- }
- case ID_AUTHORFIELD:
- {
- SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, aFieldItem.GetField() );
- if(pAuthor)
- pAuthor->SetFormat( (SvxAuthorFormat)nFormat );
- break;
- }
- default:
- throw beans::UnknownPropertyException();
- }
- }
- break;
- case WID_FIX:
- {
- if( aValue.hasValue() || aValue.getValueType() != ::getCppuBooleanType() )
- throw lang::IllegalArgumentException();
- sal_Bool bFix( *(sal_Bool*)aValue.getValue() );
- switch( mnId )
- {
- case ID_EXT_TIMEFIELD:
- {
- SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, aFieldItem.GetField() );
- if(pTime)
- pTime->SetType( (SvxTimeType)bFix?SVXTIMETYPE_FIX:SVXTIMETYPE_VAR );
- break;
- }
- case ID_DATEFIELD:
- {
- SvxDateField* pDate = PTR_CAST( SvxDateField, aFieldItem.GetField() );
- if(pDate)
- pDate->SetType( (SvxDateType)bFix?SVXDATETYPE_FIX:SVXDATETYPE_VAR );
- break;
- }
- case ID_EXT_FILEFIELD:
- {
- SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, aFieldItem.GetField() );
- if(pFile)
- pFile->SetType( (SvxFileType)bFix?SVXFILETYPE_FIX:SVXFILETYPE_VAR );
- break;
- }
- case ID_AUTHORFIELD:
- {
- SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, aFieldItem.GetField() );
- if(pAuthor)
- pAuthor->SetType( (SvxAuthorType)bFix?SVXAUTHORTYPE_FIX:SVXAUTHORTYPE_VAR );
- break;
- }
- default:
- throw beans::UnknownPropertyException();
- }
- }
- break;
- case WID_PRES:
- case WID_URL:
- case WID_TARGET:
- {
- SvxURLField* pURL = PTR_CAST( SvxURLField, aFieldItem.GetField() );
- if(pURL)
- {
- OUString aUnoStr;
- if(!(aValue >>= aUnoStr))
- throw lang::IllegalArgumentException();
-
- switch( pMap->nWID )
- {
- case WID_PRES:
- pURL->SetRepresentation( aUnoStr );
- break;
- case WID_URL:
- pURL->SetURL( aUnoStr );
- break;
- case WID_TARGET:
- pURL->SetTargetFrame( aUnoStr );
- break;
- }
- }
- break;
- }
- }
-
- SfxItemSet aSet = pForwarder->GetAttribs( GetSelection() );
- aSet.Put( aFieldItem );
-*/
-}
-
-uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- uno::Any aValue;
-
- const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMap()->getByName( PropertyName );
- if ( !pMap )
- throw beans::UnknownPropertyException();
-
- switch( pMap->nWID )
- {
- case WID_DATE:
- aValue <<= mpImpl->maDateTime;
- break;
- case WID_BOOL1:
- aValue <<= mpImpl->mbBoolean1;
- break;
- case WID_BOOL2:
- aValue <<= mpImpl->mbBoolean2;
- break;
- case WID_INT16:
- aValue <<= mpImpl->mnInt16;
- break;
- case WID_INT32:
- aValue <<= mpImpl->mnInt32;
- break;
- case WID_STRING1:
- aValue <<= mpImpl->msString1;
- break;
- case WID_STRING2:
- aValue <<= mpImpl->msString2;
- break;
- case WID_STRING3:
- aValue <<= mpImpl->msString3;
- break;
- }
-
- return aValue;
-
-/*
- switch(pMap->nWID)
- {
- case WID_FORMAT:
- switch( mnId )
- {
- case ID_DATEFIELD:
- {
- SvxDateField* pDate = PTR_CAST( SvxDateField, pFieldItem->GetField() );
- if(pDate)
- aValue <<= (sal_Int32)pDate->GetFormat();
- break;
- }
- case ID_URLFIELD:
- {
- SvxURLField* pURL = PTR_CAST( SvxURLField, pFieldItem->GetField() );
- if(pURL)
- aValue <<= (sal_Int32)pURL->GetFormat();
- break;
- }
- case ID_EXT_TIMEFIELD:
- {
- SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, pFieldItem->GetField() );
- if(pTime)
- aValue <<= (sal_Int32)pTime->GetFormat();
- break;
- }
- case ID_EXT_FILEFIELD:
- {
- SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, pFieldItem->GetField() );
- if(pFile)
- aValue <<= (sal_Int32)pFile->GetFormat();
- break;
- }
- case ID_AUTHORFIELD:
- {
- SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, pFieldItem->GetField() );
- if(pAuthor)
- aValue <<= (sal_Int32)pAuthor->GetFormat();
- break;
- }
- default:
- throw beans::UnknownPropertyException();
- }
- break;
- case WID_FIX:
- {
- sal_Bool bFix = sal_False;
- switch( mnId )
- {
- case ID_EXT_TIMEFIELD:
- {
- SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, pFieldItem->GetField() );
- if(pTime)
- bFix = pTime->GetType() == SVXTIMETYPE_FIX;
- break;
- }
- case ID_DATEFIELD:
- {
- SvxDateField* pDate = PTR_CAST( SvxDateField, pFieldItem->GetField() );
- if(pDate)
- bFix = pDate->GetType() == SVXDATETYPE_FIX;
- break;
- }
- case ID_EXT_FILEFIELD:
- {
- SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, pFieldItem->GetField() );
- if(pFile)
- bFix = pFile->GetType() == SVXFILETYPE_FIX;
- break;
- }
- case ID_AUTHORFIELD:
- {
- SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, pFieldItem->GetField() );
- if(pAuthor)
- bFix = pAuthor->GetType() == SVXAUTHORTYPE_FIX;
- break;
- }
- default:
- throw beans::UnknownPropertyException();
- }
- aValue.setValue( &bFix, ::getCppuBooleanType() );
- }
- break;
- case WID_PRES:
- case WID_URL:
- case WID_TARGET:
- {
- SvxURLField* pURL = PTR_CAST( SvxURLField, pFieldItem->GetField() );
- if(pURL)
- {
- OUString aStr;
- switch( pMap->nWID )
- {
- case WID_PRES:
- aStr = pURL->GetRepresentation();
- break;
- case WID_URL:
- aStr = pURL->GetURL();
- break;
- case WID_TARGET:
- aStr = pURL->GetTargetFrame();
- break;
- }
- aValue <<= aStr;
- }
- break;
- }
- case WID_FCOLOR:
- case WID_TCOLOR:
- {
- Color* pFColor = NULL;
- Color* pTColor = NULL;
- const ESelection aSel = GetSelection();
-
- pForwarder->CalcFieldValue( *pFieldItem, aSel.nStartPara, aSel.nStartPos, pTColor, pFColor );
-
- if( pMap->nWID == WID_FCOLOR )
- aValue <<= (sal_Int32)pFColor->GetColor();
- else
- aValue <<= (sal_Int32)pTColor->GetColor();
- break;
-
- delete pTColor;
- delete pFColor;
- }
- }
- return aValue;
-*/
-}
-
-void SAL_CALL SvxUnoTextField::addPropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-void SAL_CALL SvxUnoTextField::removePropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-void SAL_CALL SvxUnoTextField::addVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-void SAL_CALL SvxUnoTextField::removeVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-
-// OComponentHelper
-void SvxUnoTextField::disposing()
-{
- // nothing to do
-}
-
-sal_Int32 SvxUnoTextField::GetFieldId( const SvxFieldData* pFieldData ) const throw()
-{
- if( pFieldData->ISA( SvxURLField ) )
- return ID_URLFIELD;
- else if( pFieldData->ISA( SvxPageField ) )
- return ID_PAGEFIELD;
- else if( pFieldData->ISA( SvxPagesField ) )
- return ID_PAGESFIELD;
- else if( pFieldData->ISA( SvxTimeField ) )
- return ID_TIMEFIELD;
- else if( pFieldData->ISA( SvxFileField ) )
- return ID_FILEFIELD;
- else if( pFieldData->ISA( SvxTableField ) )
- return ID_TABLEFIELD;
- else if( pFieldData->ISA( SvxExtTimeField ) )
- return ID_EXT_TIMEFIELD;
- else if( pFieldData->ISA( SvxExtFileField ) )
- return ID_EXT_FILEFIELD;
- else if( pFieldData->ISA( SvxAuthorField ) )
- return ID_AUTHORFIELD;
- else if( pFieldData->ISA( SvxDateField ) )
- return ID_EXT_DATEFIELD;
- else if( pFieldData->ISA( SdrMeasureField ) )
- return ID_MEASUREFIELD;
- else if( pFieldData->ISA( SvxHeaderField ) )
- return ID_HEADERFIELD;
- else if( pFieldData->ISA( SvxFooterField ) )
- return ID_FOOTERFIELD;
- else if( pFieldData->ISA( SvxDateTimeField ) )
- return ID_DATETIMEFIELD;
-
- return ID_UNKNOWN;
-}
-
-// lang::XServiceInfo
-OUString SAL_CALL SvxUnoTextField::getImplementationName() throw(uno::RuntimeException)
-{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextField"));
-}
-
-static const sal_Char* pOldServiceNames[] =
-{
- "com.sun.star.text.TextField.DateTime",
- "com.sun.star.text.TextField.URL",
- "com.sun.star.text.TextField.PageNumber",
- "com.sun.star.text.TextField.PageCount",
- "com.sun.star.text.TextField.DateTime",
- "com.sun.star.text.TextField.DocInfo.Title", // SvxFileField is used for title
- "com.sun.star.text.TextField.SheetName",
- "com.sun.star.text.TextField.DateTime",
- "com.sun.star.text.TextField.FileName",
- "com.sun.star.text.TextField.Author",
- "com.sun.star.text.TextField.Measure",
- "com.sun.star.text.TextField.DateTime",
- "com.sun.star.presentation.TextField.Header",
- "com.sun.star.presentation.TextField.Footer",
- "com.sun.star.presentation.TextField.DateTime"
-};
-
-static const sal_Char* pNewServiceNames[] =
-{
- "com.sun.star.text.textfield.DateTime",
- "com.sun.star.text.textfield.URL",
- "com.sun.star.text.textfield.PageNumber",
- "com.sun.star.text.textfield.PageCount",
- "com.sun.star.text.textfield.DateTime",
- "com.sun.star.text.textfield.docinfo.Title", // SvxFileField is used for title
- "com.sun.star.text.textfield.SheetName",
- "com.sun.star.text.textfield.DateTime",
- "com.sun.star.text.textfield.FileName",
- "com.sun.star.text.textfield.Author",
- "com.sun.star.text.textfield.Measure",
- "com.sun.star.text.textfield.DateTime",
- "com.sun.star.presentation.textfield.Header",
- "com.sun.star.presentation.textfield.Footer",
- "com.sun.star.presentation.textfield.DateTime"
-};
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames()
- throw(uno::RuntimeException)
-{
- uno::Sequence< OUString > aSeq( 4 );
- OUString* pServices = aSeq.getArray();
- pServices[0] = OUString::createFromAscii( pNewServiceNames[mnServiceId] );
- pServices[1] = OUString::createFromAscii( pOldServiceNames[mnServiceId] );
- pServices[2] = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextContent" )),
- pServices[3] = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextField" ));
-
- return aSeq;
-}
-
-sal_Bool SAL_CALL SvxUnoTextField::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
-{
- return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
-}
-
-uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rtl::OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
-{
- uno::Reference< uno::XInterface > xRet;
-
- const OUString aTextFieldPrexit( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.textfield.") );
-
- // #i93308# up to OOo 3.2 we used this wrong namespace name with the capital T & F. This is
- // fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation.
- const OUString aTextFieldPrexit2( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField.") );
-
- if( (ServiceSpecifier.compareTo( aTextFieldPrexit, aTextFieldPrexit.getLength() ) == 0) ||
- (ServiceSpecifier.compareTo( aTextFieldPrexit2, aTextFieldPrexit2.getLength() ) == 0) )
- {
- OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) );
-
- sal_Int32 nId = ID_UNKNOWN;
-
- if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("DateTime") ) )
- {
- nId = ID_DATEFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("URL") ) )
- {
- nId = ID_URLFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("PageNumber") ) )
- {
- nId = ID_PAGEFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("PageCount") ) )
- {
- nId = ID_PAGESFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("SheetName") ) )
- {
- nId = ID_TABLEFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FileName") ) )
- {
- nId = ID_EXT_FILEFIELD;
- }
- else if (aFieldType.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("docinfo.Title") ) ||
- aFieldType.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("DocInfo.Title") ) )
- {
- nId = ID_FILEFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Author") ) )
- {
- nId = ID_AUTHORFIELD;
- }
- else if( aFieldType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Measure") ) )
- {
- nId = ID_MEASUREFIELD;
- }
-
- if( nId != ID_UNKNOWN )
- xRet = (::cppu::OWeakObject * )new SvxUnoTextField( nId );
- }
-
- return xRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx
deleted file mode 100644
index 27991ab88a..0000000000
--- a/editeng/source/uno/unofored.cxx
+++ /dev/null
@@ -1,559 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <algorithm>
-#include <editeng/eeitem.hxx>
-#include <com/sun/star/i18n/WordType.hpp>
-
-#include <svl/itemset.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/unoedhlp.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/outliner.hxx>
-#include <editeng/editobj.hxx> // only for the GetText crutch
-
-#include <editeng/unofored.hxx>
-
-using namespace ::com::sun::star;
-
-//------------------------------------------------------------------------
-
-SvxEditEngineForwarder::SvxEditEngineForwarder( EditEngine& rEngine ) :
- rEditEngine( rEngine )
-{
-}
-
-SvxEditEngineForwarder::~SvxEditEngineForwarder()
-{
- // the EditEngine may need to be deleted from the outside
-}
-
-sal_uInt16 SvxEditEngineForwarder::GetParagraphCount() const
-{
- return rEditEngine.GetParagraphCount();
-}
-
-sal_uInt16 SvxEditEngineForwarder::GetTextLen( sal_uInt16 nParagraph ) const
-{
- return rEditEngine.GetTextLen( nParagraph );
-}
-
-String SvxEditEngineForwarder::GetText( const ESelection& rSel ) const
-{
- String aRet = rEditEngine.GetText( rSel, LINEEND_LF );
- aRet.ConvertLineEnd();
- return aRet;
-}
-
-SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const
-{
- if( rSel.nStartPara == rSel.nEndPara )
- {
- sal_uInt8 nFlags = 0;
- switch( bOnlyHardAttrib )
- {
- case EditEngineAttribs_All:
- nFlags = GETATTRIBS_ALL;
- break;
- case EditEngineAttribs_HardAndPara:
- nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS;
- break;
- case EditEngineAttribs_OnlyHard:
- nFlags = GETATTRIBS_CHARATTRIBS;
- break;
- default:
- OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs");
- }
-
- return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags );
- }
- else
- {
- return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib );
- }
-}
-
-SfxItemSet SvxEditEngineForwarder::GetParaAttribs( sal_uInt16 nPara ) const
-{
- SfxItemSet aSet( rEditEngine.GetParaAttribs( nPara ) );
-
- sal_uInt16 nWhich = EE_PARA_START;
- while( nWhich <= EE_PARA_END )
- {
- if( aSet.GetItemState( nWhich, sal_True ) != SFX_ITEM_ON )
- {
- if( rEditEngine.HasParaAttrib( nPara, nWhich ) )
- aSet.Put( rEditEngine.GetParaAttrib( nPara, nWhich ) );
- }
- nWhich++;
- }
-
- return aSet;
-}
-
-void SvxEditEngineForwarder::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
-{
- rEditEngine.SetParaAttribs( nPara, rSet );
-}
-
-void SvxEditEngineForwarder::RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich )
-{
- rEditEngine.RemoveAttribs( rSelection, bRemoveParaAttribs, nWhich );
-}
-
-SfxItemPool* SvxEditEngineForwarder::GetPool() const
-{
- return rEditEngine.GetEmptyItemSet().GetPool();
-}
-
-void SvxEditEngineForwarder::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const
-{
- rEditEngine.GetPortions( nPara, rList );
-}
-
-void SvxEditEngineForwarder::QuickInsertText( const String& rText, const ESelection& rSel )
-{
- rEditEngine.QuickInsertText( rText, rSel );
-}
-
-void SvxEditEngineForwarder::QuickInsertLineBreak( const ESelection& rSel )
-{
- rEditEngine.QuickInsertLineBreak( rSel );
-}
-
-void SvxEditEngineForwarder::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
-{
- rEditEngine.QuickInsertField( rFld, rSel );
-}
-
-void SvxEditEngineForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
-{
- rEditEngine.QuickSetAttribs( rSet, rSel );
-}
-
-sal_Bool SvxEditEngineForwarder::IsValid() const
-{
- // cannot reliably query EditEngine state
- // while in the middle of an update
- return rEditEngine.GetUpdateMode();
-}
-
-XubString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor )
-{
- return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
-}
-
-void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos )
-{
- rEditEngine.FieldClicked( rField, nPara, nPos );
-}
-
-sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich )
-{
- EECharAttribArray aAttribs;
-
- const SfxPoolItem* pLastItem = NULL;
-
- SfxItemState eState = SFX_ITEM_DEFAULT;
-
- // check all paragraphs inside the selection
- for( sal_uInt16 nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++ )
- {
- SfxItemState eParaState = SFX_ITEM_DEFAULT;
-
- // calculate start and endpos for this paragraph
- sal_uInt16 nPos = 0;
- if( rSel.nStartPara == nPara )
- nPos = rSel.nStartPos;
-
- sal_uInt16 nEndPos = rSel.nEndPos;
- if( rSel.nEndPara != nPara )
- nEndPos = rEditEngine.GetTextLen( nPara );
-
-
- // get list of char attribs
- rEditEngine.GetCharAttribs( nPara, aAttribs );
-
- sal_Bool bEmpty = sal_True; // we found no item inside the selektion of this paragraph
- sal_Bool bGaps = sal_False; // we found items but theire gaps between them
- sal_uInt16 nLastEnd = nPos;
-
- const SfxPoolItem* pParaItem = NULL;
-
- for( sal_uInt16 nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++ )
- {
- struct EECharAttrib aAttrib = aAttribs.GetObject( nAttrib );
- DBG_ASSERT( aAttrib.pAttr, "GetCharAttribs gives corrupt data" );
-
- const sal_Bool bEmptyPortion = aAttrib.nStart == aAttrib.nEnd;
- if( (!bEmptyPortion && (aAttrib.nStart >= nEndPos)) || (bEmptyPortion && (aAttrib.nStart > nEndPos)) )
- break; // break if we are already behind our selektion
-
- if( (!bEmptyPortion && (aAttrib.nEnd <= nPos)) || (bEmptyPortion && (aAttrib.nEnd < nPos)) )
- continue; // or if the attribute ends before our selektion
-
- if( aAttrib.pAttr->Which() != nWhich )
- continue; // skip if is not the searched item
-
- // if we already found an item
- if( pParaItem )
- {
- // ... and its different to this one than the state is dont care
- if( *pParaItem != *aAttrib.pAttr )
- return SFX_ITEM_DONTCARE;
- }
- else
- {
- pParaItem = aAttrib.pAttr;
- }
-
- if( bEmpty )
- bEmpty = sal_False;
-
- if( !bGaps && aAttrib.nStart > nLastEnd )
- bGaps = sal_True;
-
- nLastEnd = aAttrib.nEnd;
- }
-
- if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
- bGaps = sal_True;
-/*
- // since we have no portion with our item or if there were gaps
- if( bEmpty || bGaps )
- {
- // we need to check the paragraph item
- const SfxItemSet& rParaSet = rEditEngine.GetParaAttribs( nPara );
- if( rParaSet.GetItemState( nWhich ) == SFX_ITEM_SET )
- {
- eState = SFX_ITEM_SET;
- // get item from the paragraph
- const SfxPoolItem* pTempItem = rParaSet.GetItem( nWhich );
- if( pParaItem )
- {
- if( *pParaItem != *pTempItem )
- return SFX_ITEM_DONTCARE;
- }
- else
- {
- pParaItem = pTempItem;
- }
-
- // set if theres no last item or if its the same
- eParaState = SFX_ITEM_SET;
- }
- else if( bEmpty )
- {
- eParaState = SFX_ITEM_DEFAULT;
- }
- else if( bGaps )
- {
- // gaps and item not set in paragraph, thats a dont care
- return SFX_ITEM_DONTCARE;
- }
- }
- else
- {
- eParaState = SFX_ITEM_SET;
- }
-*/
- if( bEmpty )
- eParaState = SFX_ITEM_DEFAULT;
- else if( bGaps )
- eParaState = SFX_ITEM_DONTCARE;
- else
- eParaState = SFX_ITEM_SET;
-
- // if we already found an item check if we found the same
- if( pLastItem )
- {
- if( (pParaItem == NULL) || (*pLastItem != *pParaItem) )
- return SFX_ITEM_DONTCARE;
- }
- else
- {
- pLastItem = pParaItem;
- eState = eParaState;
- }
- }
-
- return eState;
-}
-
-sal_uInt16 SvxEditEngineForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
-{
- return GetSvxEditEngineItemState( rEditEngine, rSel, nWhich );
-}
-
-sal_uInt16 SvxEditEngineForwarder::GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const
-{
- const SfxItemSet& rSet = rEditEngine.GetParaAttribs( nPara );
- return rSet.GetItemState( nWhich );
-}
-
-LanguageType SvxEditEngineForwarder::GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- return rEditEngine.GetLanguage(nPara, nIndex);
-}
-
-sal_uInt16 SvxEditEngineForwarder::GetFieldCount( sal_uInt16 nPara ) const
-{
- return rEditEngine.GetFieldCount(nPara);
-}
-
-EFieldInfo SvxEditEngineForwarder::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const
-{
- return rEditEngine.GetFieldInfo( nPara, nField );
-}
-
-EBulletInfo SvxEditEngineForwarder::GetBulletInfo( sal_uInt16 ) const
-{
- return EBulletInfo();
-}
-
-Rectangle SvxEditEngineForwarder::GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- // #101701#
- // EditEngine's 'internal' methods like GetCharacterBounds()
- // don't rotate for vertical text.
- Size aSize( rEditEngine.CalcTextWidth(), rEditEngine.GetTextHeight() );
- ::std::swap( aSize.Width(), aSize.Height() );
- bool bIsVertical( rEditEngine.IsVertical() == sal_True );
-
- // #108900# Handle virtual position one-past-the end of the string
- if( nIndex >= rEditEngine.GetTextLen(nPara) )
- {
- Rectangle aLast;
-
- if( nIndex )
- {
- // use last character, if possible
- aLast = rEditEngine.GetCharacterBounds( EPosition(nPara, nIndex-1) );
-
- // move at end of this last character, make one pixel wide
- aLast.Move( aLast.Right() - aLast.Left(), 0 );
- aLast.SetSize( Size(1, aLast.GetHeight()) );
-
- // take care for CTL
- aLast = SvxEditSourceHelper::EEToUserSpace( aLast, aSize, bIsVertical );
- }
- else
- {
- // #109864# Bounds must lie within the paragraph
- aLast = GetParaBounds( nPara );
-
- // #109151# Don't use paragraph height, but line height
- // instead. aLast is already CTL-correct
- if( bIsVertical)
- aLast.SetSize( Size( rEditEngine.GetLineHeight(nPara,0), 1 ) );
- else
- aLast.SetSize( Size( 1, rEditEngine.GetLineHeight(nPara,0) ) );
- }
-
- return aLast;
- }
- else
- {
- return SvxEditSourceHelper::EEToUserSpace( rEditEngine.GetCharacterBounds( EPosition(nPara, nIndex) ),
- aSize, bIsVertical );
- }
-}
-
-Rectangle SvxEditEngineForwarder::GetParaBounds( sal_uInt16 nPara ) const
-{
- const Point aPnt = rEditEngine.GetDocPosTopLeft( nPara );
- sal_uLong nWidth;
- sal_uLong nHeight;
- sal_uLong nTextWidth;
-
- if( rEditEngine.IsVertical() )
- {
- // #101701#
- // Hargl. EditEngine's 'external' methods return the rotated
- // dimensions, 'internal' methods like GetTextHeight( n )
- // don't rotate.
- nWidth = rEditEngine.GetTextHeight( nPara );
- nHeight = rEditEngine.GetTextHeight();
- nTextWidth = rEditEngine.GetTextHeight();
-
- return Rectangle( nTextWidth - aPnt.Y() - nWidth, 0, nTextWidth - aPnt.Y(), nHeight );
- }
- else
- {
- nWidth = rEditEngine.CalcTextWidth();
- nHeight = rEditEngine.GetTextHeight( nPara );
-
- return Rectangle( 0, aPnt.Y(), nWidth, aPnt.Y() + nHeight );
- }
-}
-
-MapMode SvxEditEngineForwarder::GetMapMode() const
-{
- return rEditEngine.GetRefMapMode();
-}
-
-OutputDevice* SvxEditEngineForwarder::GetRefDevice() const
-{
- return rEditEngine.GetRefDevice();
-}
-
-sal_Bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, sal_uInt16& nPara, sal_uInt16& nIndex ) const
-{
- Size aSize( rEditEngine.CalcTextWidth(), rEditEngine.GetTextHeight() );
- ::std::swap( aSize.Width(), aSize.Height() );
- Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos,
- aSize,
- rEditEngine.IsVertical() == sal_True ));
-
- EPosition aDocPos = rEditEngine.FindDocPosition( aEEPos );
-
- nPara = aDocPos.nPara;
- nIndex = aDocPos.nIndex;
-
- return sal_True;
-}
-
-sal_Bool SvxEditEngineForwarder::GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const
-{
- ESelection aRes = rEditEngine.GetWord( ESelection(nPara, nIndex, nPara, nIndex), com::sun::star::i18n::WordType::DICTIONARY_WORD );
-
- if( aRes.nStartPara == nPara &&
- aRes.nStartPara == aRes.nEndPara )
- {
- nStart = aRes.nStartPos;
- nEnd = aRes.nEndPos;
-
- return sal_True;
- }
-
- return sal_False;
-}
-
-sal_Bool SvxEditEngineForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rEditEngine, nPara, nIndex );
-}
-
-sal_uInt16 SvxEditEngineForwarder::GetLineCount( sal_uInt16 nPara ) const
-{
- return rEditEngine.GetLineCount(nPara);
-}
-
-sal_uInt16 SvxEditEngineForwarder::GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const
-{
- return rEditEngine.GetLineLen(nPara, nLine);
-}
-
-void SvxEditEngineForwarder::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const
-{
- rEditEngine.GetLineBoundaries(rStart, rEnd, nPara, nLine);
-}
-
-sal_uInt16 SvxEditEngineForwarder::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- return rEditEngine.GetLineNumberAtIndex(nPara, nIndex);
-}
-
-
-sal_Bool SvxEditEngineForwarder::QuickFormatDoc( sal_Bool )
-{
- rEditEngine.QuickFormatDoc();
-
- return sal_True;
-}
-
-sal_Bool SvxEditEngineForwarder::Delete( const ESelection& rSelection )
-{
- rEditEngine.QuickDelete( rSelection );
- rEditEngine.QuickFormatDoc();
-
- return sal_True;
-}
-
-sal_Bool SvxEditEngineForwarder::InsertText( const String& rStr, const ESelection& rSelection )
-{
- rEditEngine.QuickInsertText( rStr, rSelection );
- rEditEngine.QuickFormatDoc();
-
- return sal_True;
-}
-
-sal_Int16 SvxEditEngineForwarder::GetDepth( sal_uInt16 ) const
-{
- // EditEngine does not support outline depth
- return -1;
-}
-
-sal_Bool SvxEditEngineForwarder::SetDepth( sal_uInt16, sal_Int16 nNewDepth )
-{
- // EditEngine does not support outline depth
- return nNewDepth == -1 ? sal_True : sal_False;
-}
-
-const SfxItemSet * SvxEditEngineForwarder::GetEmptyItemSetPtr()
-{
- return &rEditEngine.GetEmptyItemSet();
-}
-
-void SvxEditEngineForwarder::AppendParagraph()
-{
- rEditEngine.InsertParagraph( rEditEngine.GetParagraphCount(), String::EmptyString() );
-}
-
-xub_StrLen SvxEditEngineForwarder::AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet & /*rSet*/ )
-{
- xub_StrLen nLen = 0;
-
- sal_uInt16 nParaCount = rEditEngine.GetParagraphCount();
- DBG_ASSERT( nPara < nParaCount, "paragraph index out of bounds" );
- if (/*0 <= nPara && */nPara < nParaCount)
- {
- nLen = rEditEngine.GetTextLen( nPara );
- rEditEngine.QuickInsertText( rText, ESelection( nPara, nLen, nPara, nLen ) );
- }
-
- return nLen;
-}
-
-void SvxEditEngineForwarder::CopyText(const SvxTextForwarder& rSource)
-{
- const SvxEditEngineForwarder* pSourceForwarder = dynamic_cast< const SvxEditEngineForwarder* >( &rSource );
- if( !pSourceForwarder )
- return;
- EditTextObject* pNewTextObject = pSourceForwarder->rEditEngine.CreateTextObject();
- rEditEngine.SetText( *pNewTextObject );
- delete pNewTextObject;
-}
-
-//------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx
deleted file mode 100644
index f95c1bf90b..0000000000
--- a/editeng/source/uno/unoforou.cxx
+++ /dev/null
@@ -1,614 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#include <algorithm>
-#include <svl/style.hxx>
-#include <com/sun/star/i18n/WordType.hpp>
-
-#include <svl/itemset.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/outliner.hxx>
-#include <editeng/unoedhlp.hxx>
-#include <svl/poolitem.hxx>
-#include <vcl/wrkwin.hxx>
-#include <editeng/eeitem.hxx>
-
-#include <editeng/unoforou.hxx>
-#include <editeng/unofored.hxx>
-#include <editeng/outlobj.hxx>
-
-using namespace ::com::sun::star;
-
-//------------------------------------------------------------------------
-
-SvxOutlinerForwarder::SvxOutlinerForwarder( Outliner& rOutl, sal_Bool bOutlText /* = sal_False */ ) :
- rOutliner( rOutl ),
- bOutlinerText( bOutlText ),
- mpAttribsCache( NULL ),
- mpParaAttribsCache( NULL ),
- mnParaAttribsCache( 0 )
-{
-}
-
-SvxOutlinerForwarder::~SvxOutlinerForwarder()
-{
- flushCache();
-}
-
-sal_uInt16 SvxOutlinerForwarder::GetParagraphCount() const
-{
- return (sal_uInt16)rOutliner.GetParagraphCount();
-}
-
-sal_uInt16 SvxOutlinerForwarder::GetTextLen( sal_uInt16 nParagraph ) const
-{
- return rOutliner.GetEditEngine().GetTextLen( nParagraph );
-}
-
-String SvxOutlinerForwarder::GetText( const ESelection& rSel ) const
-{
- //! GetText (ESelection) should probably also be in the Outliner
- // in the time beeing use as the hack for the EditEngine:
- EditEngine* pEditEngine = (EditEngine*)&rOutliner.GetEditEngine();
- return pEditEngine->GetText( rSel, LINEEND_LF );
-}
-
-static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib, EditEngine& rEditEngine )
-{
- if( rSel.nStartPara == rSel.nEndPara )
- {
- sal_uInt8 nFlags = 0;
-
- switch( bOnlyHardAttrib )
- {
- case EditEngineAttribs_All:
- nFlags = GETATTRIBS_ALL;
- break;
- case EditEngineAttribs_HardAndPara:
- nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS;
- break;
- case EditEngineAttribs_OnlyHard:
- nFlags = GETATTRIBS_CHARATTRIBS;
- break;
- default:
- OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs");
- }
- return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags );
- }
- else
- {
- return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib );
- }
-}
-
-SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const
-{
- if( mpAttribsCache && ( 0 == bOnlyHardAttrib ) )
- {
- // have we the correct set in cache?
- if( ((SvxOutlinerForwarder*)this)->maAttribCacheSelection.IsEqual(rSel) )
- {
- // yes! just return the cache
- return *mpAttribsCache;
- }
- else
- {
- // no, we need delete the old cache
- delete mpAttribsCache;
- mpAttribsCache = NULL;
- }
- }
-
- //! 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 ) );
-
- if( 0 == bOnlyHardAttrib )
- {
- mpAttribsCache = new SfxItemSet( aSet );
- maAttribCacheSelection = rSel;
- }
-
- SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( rSel.nStartPara );
- if( pStyle )
- aSet.SetParent( &(pStyle->GetItemSet() ) );
-
- return aSet;
-}
-
-SfxItemSet SvxOutlinerForwarder::GetParaAttribs( sal_uInt16 nPara ) const
-{
- if( mpParaAttribsCache )
- {
- // have we the correct set in cache?
- if( nPara == mnParaAttribsCache )
- {
- // yes! just return the cache
- return *mpParaAttribsCache;
- }
- else
- {
- // no, we need delete the old cache
- delete mpParaAttribsCache;
- mpParaAttribsCache = NULL;
- }
- }
-
- mpParaAttribsCache = new SfxItemSet( rOutliner.GetParaAttribs( nPara ) );
- mnParaAttribsCache = nPara;
-
- EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine();
-
- SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( nPara );
- if( pStyle )
- mpParaAttribsCache->SetParent( &(pStyle->GetItemSet() ) );
-
- return *mpParaAttribsCache;
-}
-
-void SvxOutlinerForwarder::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
-{
- flushCache();
-
- const SfxItemSet* pOldParent = rSet.GetParent();
- if( pOldParent )
- ((SfxItemSet*)&rSet)->SetParent( NULL );
-
- rOutliner.SetParaAttribs( nPara, rSet );
-
- if( pOldParent )
- ((SfxItemSet*)&rSet)->SetParent( pOldParent );
-}
-
-void SvxOutlinerForwarder::RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich )
-{
- rOutliner.RemoveAttribs( rSelection, bRemoveParaAttribs, nWhich );
-}
-
-SfxItemPool* SvxOutlinerForwarder::GetPool() const
-{
- return rOutliner.GetEmptyItemSet().GetPool();
-}
-
-void SvxOutlinerForwarder::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const
-{
- ((EditEngine&)rOutliner.GetEditEngine()).GetPortions( nPara, rList );
-}
-
-void SvxOutlinerForwarder::QuickInsertText( const String& rText, const ESelection& rSel )
-{
- flushCache();
- if( rText.Len() == 0 )
- {
- rOutliner.QuickDelete( rSel );
- }
- else
- {
- rOutliner.QuickInsertText( rText, rSel );
- }
-}
-
-void SvxOutlinerForwarder::QuickInsertLineBreak( const ESelection& rSel )
-{
- flushCache();
- rOutliner.QuickInsertLineBreak( rSel );
-}
-
-void SvxOutlinerForwarder::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
-{
- flushCache();
- rOutliner.QuickInsertField( rFld, rSel );
-}
-
-void SvxOutlinerForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
-{
- flushCache();
- rOutliner.QuickSetAttribs( rSet, rSel );
-}
-
-XubString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor )
-{
- return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
-}
-
-void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos )
-{
- rOutliner.FieldClicked( rField, nPara, nPos );
-}
-
-sal_Bool SvxOutlinerForwarder::IsValid() const
-{
- // cannot reliably query outliner state
- // while in the middle of an update
- return rOutliner.GetUpdateMode();
-}
-
-extern sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich );
-
-sal_uInt16 SvxOutlinerForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
-{
- return GetSvxEditEngineItemState( (EditEngine&)rOutliner.GetEditEngine(), rSel, nWhich );
-}
-
-sal_uInt16 SvxOutlinerForwarder::GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const
-{
- const SfxItemSet& rSet = rOutliner.GetParaAttribs( nPara );
- return rSet.GetItemState( nWhich );
-}
-
-
-void SvxOutlinerForwarder::flushCache()
-{
- if( mpAttribsCache )
- {
- delete mpAttribsCache;
- mpAttribsCache = NULL;
- }
-
- if( mpParaAttribsCache )
- {
- delete mpParaAttribsCache;
- mpParaAttribsCache = NULL;
- }
-}
-
-LanguageType SvxOutlinerForwarder::GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- return rOutliner.GetLanguage(nPara, nIndex);
-}
-
-sal_uInt16 SvxOutlinerForwarder::GetFieldCount( sal_uInt16 nPara ) const
-{
- return rOutliner.GetEditEngine().GetFieldCount(nPara);
-}
-
-EFieldInfo SvxOutlinerForwarder::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const
-{
- return rOutliner.GetEditEngine().GetFieldInfo( nPara, nField );
-}
-
-EBulletInfo SvxOutlinerForwarder::GetBulletInfo( sal_uInt16 nPara ) const
-{
- return rOutliner.GetBulletInfo( nPara );
-}
-
-Rectangle SvxOutlinerForwarder::GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- // EditEngine's 'internal' methods like GetCharacterBounds()
- // don't rotate for vertical text.
- Size aSize( rOutliner.CalcTextSize() );
- ::std::swap( aSize.Width(), aSize.Height() );
- bool bIsVertical( rOutliner.IsVertical() == sal_True );
-
- // #108900# Handle virtual position one-past-the end of the string
- if( nIndex >= GetTextLen(nPara) )
- {
- Rectangle aLast;
-
- if( nIndex )
- {
- // use last character, if possible
- aLast = rOutliner.GetEditEngine().GetCharacterBounds( EPosition(nPara, nIndex-1) );
-
- // move at end of this last character, make one pixel wide
- aLast.Move( aLast.Right() - aLast.Left(), 0 );
- aLast.SetSize( Size(1, aLast.GetHeight()) );
-
- // take care for CTL
- aLast = SvxEditSourceHelper::EEToUserSpace( aLast, aSize, bIsVertical );
- }
- else
- {
- // #109864# Bounds must lie within the paragraph
- aLast = GetParaBounds( nPara );
-
- // #109151# Don't use paragraph height, but line height
- // instead. aLast is already CTL-correct
- if( bIsVertical)
- aLast.SetSize( Size( rOutliner.GetLineHeight(nPara,0), 1 ) );
- else
- aLast.SetSize( Size( 1, rOutliner.GetLineHeight(nPara,0) ) );
- }
-
- return aLast;
- }
- else
- {
- return SvxEditSourceHelper::EEToUserSpace( rOutliner.GetEditEngine().GetCharacterBounds( EPosition(nPara, nIndex) ),
- aSize, bIsVertical );
- }
-}
-
-Rectangle SvxOutlinerForwarder::GetParaBounds( sal_uInt16 nPara ) const
-{
- Point aPnt = rOutliner.GetDocPosTopLeft( nPara );
- Size aSize = rOutliner.CalcTextSize();
-
- if( rOutliner.IsVertical() )
- {
- // Hargl. Outliner's 'external' methods return the rotated
- // dimensions, 'internal' methods like GetTextHeight( n )
- // don't rotate.
- sal_uLong nWidth = rOutliner.GetTextHeight( nPara );
-
- return Rectangle( aSize.Width() - aPnt.Y() - nWidth, 0, aSize.Width() - aPnt.Y(), aSize.Height() );
- }
- else
- {
- sal_uLong nHeight = rOutliner.GetTextHeight( nPara );
-
- return Rectangle( 0, aPnt.Y(), aSize.Width(), aPnt.Y() + nHeight );
- }
-}
-
-MapMode SvxOutlinerForwarder::GetMapMode() const
-{
- return rOutliner.GetRefMapMode();
-}
-
-OutputDevice* SvxOutlinerForwarder::GetRefDevice() const
-{
- return rOutliner.GetRefDevice();
-}
-
-sal_Bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, sal_uInt16& nPara, sal_uInt16& nIndex ) const
-{
- Size aSize( rOutliner.CalcTextSize() );
- ::std::swap( aSize.Width(), aSize.Height() );
- Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos,
- aSize,
- rOutliner.IsVertical() == sal_True ));
-
- EPosition aDocPos = rOutliner.GetEditEngine().FindDocPosition( aEEPos );
-
- nPara = aDocPos.nPara;
- nIndex = aDocPos.nIndex;
-
- return sal_True;
-}
-
-sal_Bool SvxOutlinerForwarder::GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const
-{
- ESelection aRes = rOutliner.GetEditEngine().GetWord( ESelection(nPara, nIndex, nPara, nIndex), com::sun::star::i18n::WordType::DICTIONARY_WORD );
-
- if( aRes.nStartPara == nPara &&
- aRes.nStartPara == aRes.nEndPara )
- {
- nStart = aRes.nStartPos;
- nEnd = aRes.nEndPos;
-
- return sal_True;
- }
-
- return sal_False;
-}
-
-sal_Bool SvxOutlinerForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rOutliner.GetEditEngine(), nPara, nIndex );
-}
-
-sal_uInt16 SvxOutlinerForwarder::GetLineCount( sal_uInt16 nPara ) const
-{
- return static_cast < sal_uInt16 >( rOutliner.GetLineCount(nPara) );
-}
-
-sal_uInt16 SvxOutlinerForwarder::GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const
-{
- return rOutliner.GetLineLen(nPara, nLine);
-}
-
-void SvxOutlinerForwarder::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const
-{
- return rOutliner.GetEditEngine().GetLineBoundaries( rStart, rEnd, nPara, nLine );
-}
-
-sal_uInt16 SvxOutlinerForwarder::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const
-{
- return rOutliner.GetEditEngine().GetLineNumberAtIndex( nPara, nIndex );
-}
-
-sal_Bool SvxOutlinerForwarder::QuickFormatDoc( sal_Bool )
-{
- rOutliner.QuickFormatDoc();
-
- return sal_True;
-}
-
-sal_Bool SvxOutlinerForwarder::Delete( const ESelection& rSelection )
-{
- flushCache();
- rOutliner.QuickDelete( rSelection );
- rOutliner.QuickFormatDoc();
-
- return sal_True;
-}
-
-sal_Bool SvxOutlinerForwarder::InsertText( const String& rStr, const ESelection& rSelection )
-{
- flushCache();
- rOutliner.QuickInsertText( rStr, rSelection );
- rOutliner.QuickFormatDoc();
-
- return sal_True;
-}
-
-sal_Int16 SvxOutlinerForwarder::GetDepth( sal_uInt16 nPara ) const
-{
- DBG_ASSERT( nPara < GetParagraphCount(), "SvxOutlinerForwarder::GetDepth: Invalid paragraph index");
-
- Paragraph* pPara = rOutliner.GetParagraph( nPara );
-
- sal_Int16 nLevel = -1;
-
- if( pPara )
- nLevel = rOutliner.GetDepth( nPara );
-
- return nLevel;
-}
-
-sal_Bool SvxOutlinerForwarder::SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth )
-{
- DBG_ASSERT( nPara < GetParagraphCount(), "SvxOutlinerForwarder::SetDepth: Invalid paragraph index");
-
- if( (nNewDepth >= -1) && (nNewDepth <= 9) && (nPara < GetParagraphCount()) )
- {
- Paragraph* pPara = rOutliner.GetParagraph( nPara );
- if( pPara )
- {
- rOutliner.SetDepth( pPara, nNewDepth );
-
-// const bool bOutlinerText = pSdrObject && (pSdrObject->GetObjInventor() == SdrInventor) && (pSdrObject->GetObjIdentifier() == OBJ_OUTLINETEXT);
- if( bOutlinerText )
- rOutliner.SetLevelDependendStyleSheet( nPara );
-
- return sal_True;
- }
- }
-
- return sal_False;
-}
-
-sal_Int16 SvxOutlinerForwarder::GetNumberingStartValue( sal_uInt16 nPara )
-{
- if( nPara < GetParagraphCount() )
- {
- return rOutliner.GetNumberingStartValue( nPara );
- }
- else
- {
- OSL_FAIL( "SvxOutlinerForwarder::GetNumberingStartValue)(), Invalid paragraph index");
- return -1;
- }
-}
-
-void SvxOutlinerForwarder::SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue )
-{
- if( nPara < GetParagraphCount() )
- {
- rOutliner.SetNumberingStartValue( nPara, nNumberingStartValue );
- }
- else
- {
- OSL_FAIL( "SvxOutlinerForwarder::SetNumberingStartValue)(), Invalid paragraph index");
- }
-}
-
-sal_Bool SvxOutlinerForwarder::IsParaIsNumberingRestart( sal_uInt16 nPara )
-{
- if( nPara < GetParagraphCount() )
- {
- return rOutliner.IsParaIsNumberingRestart( nPara );
- }
- else
- {
- OSL_FAIL( "SvxOutlinerForwarder::IsParaIsNumberingRestart)(), Invalid paragraph index");
- return sal_False;
- }
-}
-
-void SvxOutlinerForwarder::SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart )
-{
- if( nPara < GetParagraphCount() )
- {
- rOutliner.SetParaIsNumberingRestart( nPara, bParaIsNumberingRestart );
- }
- else
- {
- OSL_FAIL( "SvxOutlinerForwarder::SetParaIsNumberingRestart)(), Invalid paragraph index");
- }
-}
-
-const SfxItemSet * SvxOutlinerForwarder::GetEmptyItemSetPtr()
-{
- EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() );
- return &rEditEngine.GetEmptyItemSet();
-}
-
-void SvxOutlinerForwarder::AppendParagraph()
-{
- EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() );
- rEditEngine.InsertParagraph( rEditEngine.GetParagraphCount(), String::EmptyString() );
-}
-
-xub_StrLen SvxOutlinerForwarder::AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet & /*rSet*/ )
-{
- xub_StrLen nLen = 0;
-
- EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() );
- sal_uInt16 nParaCount = rEditEngine.GetParagraphCount();
- DBG_ASSERT( nPara < nParaCount, "paragraph index out of bounds" );
- if (/*0 <= nPara && */nPara < nParaCount)
- {
- nLen = rEditEngine.GetTextLen( nPara );
- rEditEngine.QuickInsertText( rText, ESelection( nPara, nLen, nPara, nLen ) );
- }
-
- return nLen;
-}
-
-void SvxOutlinerForwarder::CopyText(const SvxTextForwarder& rSource)
-{
- const SvxOutlinerForwarder* pSourceForwarder = dynamic_cast< const SvxOutlinerForwarder* >( &rSource );
- if( !pSourceForwarder )
- return;
- OutlinerParaObject* pNewOutlinerParaObject = pSourceForwarder->rOutliner.CreateParaObject();
- rOutliner.SetText( *pNewOutlinerParaObject );
- delete pNewOutlinerParaObject;
-}
-
-//------------------------------------------------------------------------
-
-
-sal_Int16 SvxTextForwarder::GetNumberingStartValue( sal_uInt16 )
-{
- return -1;
-}
-
-void SvxTextForwarder::SetNumberingStartValue( sal_uInt16, sal_Int16 )
-{
-}
-
-sal_Bool SvxTextForwarder::IsParaIsNumberingRestart( sal_uInt16 )
-{
- return sal_False;
-}
-
-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
deleted file mode 100644
index 1aa2737458..0000000000
--- a/editeng/source/uno/unoipset.cxx
+++ /dev/null
@@ -1,383 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <svl/eitem.hxx>
-
-#include <boost/unordered_map.hpp>
-#include <svl/itemprop.hxx>
-
-#include <editeng/unoipset.hxx>
-#include <editeng/editids.hrc>
-#include <editeng/editeng.hxx>
-#include <svl/itempool.hxx>
-#include <algorithm>
-
-using namespace ::com::sun::star;
-using namespace ::rtl;
-
-using ::std::vector;
-
-//----------------------------------------------------------------------
-
-struct SfxItemPropertyMapEntryHash
-{
- size_t operator()(const SfxItemPropertyMapEntry* pMap) const { return (size_t)pMap; }
-};
-
-//----------------------------------------------------------------------
-
-struct SvxIDPropertyCombine
-{
- sal_uInt16 nWID;
- uno::Any aAny;
-};
-
-
-SvxItemPropertySet::SvxItemPropertySet( const SfxItemPropertyMapEntry* pMap, SfxItemPool& rItemPool, sal_Bool bConvertTwips )
-: m_aPropertyMap( pMap ),
- _pMap(pMap), mbConvertTwips(bConvertTwips), mrItemPool( rItemPool )
-{
-}
-
-//----------------------------------------------------------------------
-SvxItemPropertySet::~SvxItemPropertySet()
-{
- ClearAllUsrAny();
-}
-
-//----------------------------------------------------------------------
-uno::Any* SvxItemPropertySet::GetUsrAnyForID(sal_uInt16 nWID) const
-{
- for ( size_t i = 0, n = aCombineList.size(); i < n; ++i )
- {
- SvxIDPropertyCombine* pActual = aCombineList[ i ];
- if( pActual->nWID == nWID )
- return &pActual->aAny;
- }
- return NULL;
-}
-
-//----------------------------------------------------------------------
-void SvxItemPropertySet::AddUsrAnyForID(const uno::Any& rAny, sal_uInt16 nWID)
-{
- SvxIDPropertyCombine* pNew = new SvxIDPropertyCombine;
- pNew->nWID = nWID;
- pNew->aAny = rAny;
- aCombineList.push_back( pNew );
-}
-
-//----------------------------------------------------------------------
-
-void SvxItemPropertySet::ClearAllUsrAny()
-{
- for ( size_t i = 0, n = aCombineList.size(); i < n; ++i )
- delete aCombineList[ i ];
- aCombineList.clear();
-}
-
-//----------------------------------------------------------------------
-
-sal_Bool SvxUnoCheckForPositiveValue( const uno::Any& rVal )
-{
- sal_Bool bConvert = sal_True; // the default is that all metric items must be converted
- sal_Int32 nValue = 0;
- if( rVal >>= nValue )
- bConvert = (nValue > 0);
- return bConvert;
-}
-
-
-//----------------------------------------------------------------------
-uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet, bool bSearchInParent, bool bDontConvertNegativeValues ) const
-{
- uno::Any aVal;
- if(!pMap || !pMap->nWID)
- return aVal;
-
- const SfxPoolItem* pItem = 0;
- SfxItemPool* pPool = rSet.GetPool();
- rSet.GetItemState( pMap->nWID, bSearchInParent, &pItem );
- if( NULL == pItem && pPool )
- pItem = &(pPool->GetDefaultItem( pMap->nWID ));
-
- const SfxMapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : SFX_MAPUNIT_100TH_MM;
- sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM);
- if( eMapUnit == SFX_MAPUNIT_100TH_MM )
- nMemberId &= (~CONVERT_TWIPS);
-
- if(pItem)
- {
- pItem->QueryValue( aVal, nMemberId );
- if( pMap->nMemberId & SFX_METRIC_ITEM )
- {
- if( eMapUnit != SFX_MAPUNIT_100TH_MM )
- {
- if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aVal ) )
- SvxUnoConvertToMM( eMapUnit, aVal );
- }
- }
- else if ( pMap->pType->getTypeClass() == uno::TypeClass_ENUM &&
- aVal.getValueType() == ::getCppuType((const sal_Int32*)0) )
- {
- // convert typeless SfxEnumItem to enum type
- sal_Int32 nEnum;
- aVal >>= nEnum;
- aVal.setValue( &nEnum, *pMap->pType );
- }
- }
- else
- {
- OSL_FAIL( "No SfxPoolItem found for property!" );
- }
-
- return aVal;
-}
-
-//----------------------------------------------------------------------
-void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const uno::Any& rVal, SfxItemSet& rSet, bool bDontConvertNegativeValues ) const
-{
- if(!pMap || !pMap->nWID)
- return;
-
- // Get item
- const SfxPoolItem* pItem = 0;
- SfxPoolItem *pNewItem = 0;
- SfxItemState eState = rSet.GetItemState( pMap->nWID, sal_True, &pItem );
- SfxItemPool* pPool = rSet.GetPool();
-
- // Put UnoAny in the item value
- if(eState < SFX_ITEM_DEFAULT || pItem == NULL)
- {
- if( pPool == NULL )
- {
- OSL_FAIL( "No default item and no pool?" );
- return;
- }
-
- pItem = &pPool->GetDefaultItem( pMap->nWID );
- }
-
- DBG_ASSERT( pItem, "Got no default for item!" );
- if( pItem )
- {
- uno::Any aValue( rVal );
-
- const SfxMapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : SFX_MAPUNIT_100TH_MM;
-
- // check for needed metric translation
- if( (pMap->nMemberId & SFX_METRIC_ITEM) && eMapUnit != SFX_MAPUNIT_100TH_MM )
- {
- if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aValue ) )
- SvxUnoConvertFromMM( eMapUnit, aValue );
- }
-
- pNewItem = pItem->Clone();
-
- sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM);
- if( eMapUnit == SFX_MAPUNIT_100TH_MM )
- nMemberId &= (~CONVERT_TWIPS);
-
- if( pNewItem->PutValue( aValue, nMemberId ) )
- {
- // Set new item in item set
- rSet.Put( *pNewItem, pMap->nWID );
- }
- delete pNewItem;
- }
-}
-
-//----------------------------------------------------------------------
-uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* pMap ) const
-{
- // Already entered a value? Then finish quickly
- uno::Any* pUsrAny = GetUsrAnyForID(pMap->nWID);
- if(pUsrAny)
- return *pUsrAny;
-
- // 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 ) )
- {
- // Get Default from ItemPool
- if(mrItemPool.IsWhich(pMap->nWID))
- aSet.Put(mrItemPool.GetDefaultItem(pMap->nWID));
- }
-
- if(aSet.Count())
- {
- const SfxPoolItem* pItem = NULL;
- SfxItemState eState = aSet.GetItemState( pMap->nWID, sal_True, &pItem );
- if(eState >= SFX_ITEM_DEFAULT && pItem)
- {
- pItem->QueryValue( aVal, nMemberId );
- ((SvxItemPropertySet*)this)->AddUsrAnyForID(aVal, pMap->nWID);
- }
- }
-
- if( pMap->nMemberId & SFX_METRIC_ITEM )
- {
- // check for needed metric translation
- if(pMap->nMemberId & SFX_METRIC_ITEM && eMapUnit != SFX_MAPUNIT_100TH_MM)
- {
- SvxUnoConvertToMM( eMapUnit, aVal );
- }
- }
-
- if ( pMap->pType->getTypeClass() == uno::TypeClass_ENUM &&
- aVal.getValueType() == ::getCppuType((const sal_Int32*)0) )
- {
- sal_Int32 nEnum;
- aVal >>= nEnum;
-
- aVal.setValue( &nEnum, *pMap->pType );
- }
-
- return aVal;
-}
-
-//----------------------------------------------------------------------
-
-void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const uno::Any& rVal ) const
-{
- uno::Any* pUsrAny = GetUsrAnyForID(pMap->nWID);
- if(!pUsrAny)
- ((SvxItemPropertySet*)this)->AddUsrAnyForID(rVal, pMap->nWID);
- else
- *pUsrAny = rVal;
-}
-
-//----------------------------------------------------------------------
-
-const SfxItemPropertySimpleEntry* SvxItemPropertySet::getPropertyMapEntry(const OUString &rName) const
-{
- return m_aPropertyMap.getByName( rName );
- }
-
-//----------------------------------------------------------------------
-
-uno::Reference< beans::XPropertySetInfo > SvxItemPropertySet::getPropertySetInfo() const
-{
- if( !m_xInfo.is() )
- m_xInfo = new SfxItemPropertySetInfo( &m_aPropertyMap );
- return m_xInfo;
-}
-
-//----------------------------------------------------------------------
-
-#ifndef TWIPS_TO_MM
-#define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
-#endif
-#ifndef MM_TO_TWIPS
-#define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
-#endif
-
-/** converts the given any with a metric to 100th/mm if needed */
-void SvxUnoConvertToMM( const SfxMapUnit eSourceMapUnit, uno::Any & rMetric ) throw()
-{
- // map the metric of the itempool to 100th mm
- switch(eSourceMapUnit)
- {
- case SFX_MAPUNIT_TWIP :
- {
- switch( rMetric.getValueTypeClass() )
- {
- case uno::TypeClass_BYTE:
- rMetric <<= (sal_Int8)(TWIPS_TO_MM(*(sal_Int8*)rMetric.getValue()));
- break;
- case uno::TypeClass_SHORT:
- rMetric <<= (sal_Int16)(TWIPS_TO_MM(*(sal_Int16*)rMetric.getValue()));
- break;
- case uno::TypeClass_UNSIGNED_SHORT:
- rMetric <<= (sal_uInt16)(TWIPS_TO_MM(*(sal_uInt16*)rMetric.getValue()));
- break;
- case uno::TypeClass_LONG:
- rMetric <<= (sal_Int32)(TWIPS_TO_MM(*(sal_Int32*)rMetric.getValue()));
- break;
- case uno::TypeClass_UNSIGNED_LONG:
- rMetric <<= (sal_uInt32)(TWIPS_TO_MM(*(sal_uInt32*)rMetric.getValue()));
- break;
- default:
- OSL_FAIL("AW: Missing unit translation to 100th mm!");
- }
- break;
- }
- default:
- {
- OSL_FAIL("AW: Missing unit translation to 100th mm!");
- }
- }
-}
-
-//----------------------------------------------------------------------
-
-/** converts the given any with a metric from 100th/mm to the given metric if needed */
-void SvxUnoConvertFromMM( const SfxMapUnit eDestinationMapUnit, uno::Any & rMetric ) throw()
-{
- switch(eDestinationMapUnit)
- {
- case SFX_MAPUNIT_TWIP :
- {
- switch( rMetric.getValueTypeClass() )
- {
- case uno::TypeClass_BYTE:
- rMetric <<= (sal_Int8)(MM_TO_TWIPS(*(sal_Int8*)rMetric.getValue()));
- break;
- case uno::TypeClass_SHORT:
- rMetric <<= (sal_Int16)(MM_TO_TWIPS(*(sal_Int16*)rMetric.getValue()));
- break;
- case uno::TypeClass_UNSIGNED_SHORT:
- rMetric <<= (sal_uInt16)(MM_TO_TWIPS(*(sal_uInt16*)rMetric.getValue()));
- break;
- case uno::TypeClass_LONG:
- rMetric <<= (sal_Int32)(MM_TO_TWIPS(*(sal_Int32*)rMetric.getValue()));
- break;
- case uno::TypeClass_UNSIGNED_LONG:
- rMetric <<= (sal_uInt32)(MM_TO_TWIPS(*(sal_uInt32*)rMetric.getValue()));
- break;
- default:
- OSL_FAIL("AW: Missing unit translation to 100th mm!");
- }
- break;
- }
- default:
- {
- 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
deleted file mode 100644
index ee00ab2ccf..0000000000
--- a/editeng/source/uno/unonrule.cxx
+++ /dev/null
@@ -1,577 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-#define PROPERTY_NONE 0
-
-#include <com/sun/star/text/HoriOrientation.hpp>
-#include <com/sun/star/awt/XBitmap.hpp>
-
-#include <vcl/svapp.hxx>
-#include <osl/mutex.hxx>
-#include <vcl/graph.hxx>
-#include <svtools/grfmgr.hxx>
-#include <toolkit/unohlp.hxx>
-
-#include <editeng/brshitem.hxx>
-#include <editeng/unoprnms.hxx>
-#include <editeng/numitem.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/unotext.hxx>
-#include <editeng/numitem.hxx>
-#include <editeng/unofdesc.hxx>
-#include <editeng/unonrule.hxx>
-#include <editeng/editids.hrc>
-
-using ::rtl::OUString;
-using ::com::sun::star::util::XCloneable;
-using ::com::sun::star::ucb::XAnyCompare;
-
-
-using namespace ::std;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-
-const SvxAdjust aUnoToSvxAdjust[] =
-{
- SVX_ADJUST_LEFT,
- SVX_ADJUST_RIGHT,
- SVX_ADJUST_CENTER,
- SVX_ADJUST_LEFT,
- SVX_ADJUST_LEFT,
- SVX_ADJUST_LEFT,
- SVX_ADJUST_BLOCK
-};
-
-const unsigned short aSvxToUnoAdjust[] =
-{
- text::HoriOrientation::LEFT,
- text::HoriOrientation::RIGHT,
- text::HoriOrientation::FULL,
- text::HoriOrientation::CENTER,
- text::HoriOrientation::FULL,
- text::HoriOrientation::LEFT
-};
-
-SvxAdjust ConvertUnoAdjust( unsigned short nAdjust )
-{
- DBG_ASSERT( nAdjust <= 7, "Enum hat sich geaendert! [CL]" );
- return aUnoToSvxAdjust[nAdjust];
-}
-
-unsigned short ConvertUnoAdjust( SvxAdjust eAdjust )
-{
- DBG_ASSERT( eAdjust <= 6, "Enum hat sich geaendert! [CL]" );
- return aSvxToUnoAdjust[eAdjust];
-}
-
-/******************************************************************
- * SvxUnoNumberingRules
- ******************************************************************/
-
-UNO3_GETIMPLEMENTATION_IMPL( SvxUnoNumberingRules );
-
-SvxUnoNumberingRules::SvxUnoNumberingRules( const SvxNumRule& rRule ) throw()
-: maRule( rRule )
-{
-}
-
-SvxUnoNumberingRules::~SvxUnoNumberingRules() throw()
-{
-}
-
-//XIndexReplace
-void SAL_CALL SvxUnoNumberingRules::replaceByIndex( sal_Int32 Index, const uno::Any& Element )
- throw( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- if( Index < 0 || Index >= maRule.GetLevelCount() )
- throw IndexOutOfBoundsException();
-
- Sequence< beans::PropertyValue > aSeq;
-
- if( !( Element >>= aSeq) )
- throw IllegalArgumentException();
- setNumberingRuleByIndex( aSeq, Index );
-}
-
-// XIndexAccess
-sal_Int32 SAL_CALL SvxUnoNumberingRules::getCount() throw( RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- return maRule.GetLevelCount();
-}
-
-Any SAL_CALL SvxUnoNumberingRules::getByIndex( sal_Int32 Index )
- throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- if( Index < 0 || Index >= maRule.GetLevelCount() )
- throw IndexOutOfBoundsException();
-
- return Any( getNumberingRuleByIndex(Index) );
-}
-
-//XElementAccess
-Type SAL_CALL SvxUnoNumberingRules::getElementType()
- throw( RuntimeException )
-{
- return ::getCppuType(( const Sequence< beans::PropertyValue >*)0);
-}
-
-sal_Bool SAL_CALL SvxUnoNumberingRules::hasElements() throw( RuntimeException )
-{
- return sal_True;
-}
-
-// XAnyCompare
-sal_Int16 SAL_CALL SvxUnoNumberingRules::compare( const Any& rAny1, const Any& rAny2 ) throw(RuntimeException)
-{
- return SvxUnoNumberingRules::Compare( rAny1, rAny2 );
-}
-
-// XCloneable
-Reference< XCloneable > SAL_CALL SvxUnoNumberingRules::createClone( ) throw (RuntimeException)
-{
- return new SvxUnoNumberingRules(maRule);
-}
-
-// XServiceInfo
-sal_Char pSvxUnoNumberingRulesService[sizeof("com.sun.star.text.NumberingRules")] = "com.sun.star.text.NumberingRules";
-
-OUString SAL_CALL SvxUnoNumberingRules::getImplementationName( ) throw(RuntimeException)
-{
- return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoNumberingRules" ) );
-}
-
-sal_Bool SAL_CALL SvxUnoNumberingRules::supportsService( const OUString& ServiceName ) throw(RuntimeException)
-{
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSvxUnoNumberingRulesService ) );
-}
-
-Sequence< OUString > SAL_CALL SvxUnoNumberingRules::getSupportedServiceNames( ) throw(RuntimeException)
-{
- OUString aService( RTL_CONSTASCII_USTRINGPARAM( pSvxUnoNumberingRulesService ) );
- Sequence< OUString > aSeq( &aService, 1 );
- return aSeq;
-}
-
-Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex( sal_Int32 nIndex) const throw()
-{
- // NumberingRule aRule;
- const SvxNumberFormat& rFmt = maRule.GetLevel((sal_uInt16) nIndex);
- sal_uInt16 nIdx = 0;
-
- const int nProps = 15;
- beans::PropertyValue* pArray = new beans::PropertyValue[nProps];
-
- Any aVal;
- {
- aVal <<= rFmt.GetNumberingType();
- beans::PropertyValue aAlignProp( OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_NRULE_NUMBERINGTYPE)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
- pArray[nIdx++] = aAlignProp;
- }
-
- {
- SvxAdjust eAdj = rFmt.GetNumAdjust();
- aVal <<= ConvertUnoAdjust(eAdj);
- pArray[nIdx++] = beans::PropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_NRULE_ADJUST)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
- }
-
- {
- aVal <<= OUString(rFmt.GetPrefix());
- beans::PropertyValue aPrefixProp( OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_NRULE_PREFIX)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
- pArray[nIdx++] = aPrefixProp;
- }
-
- {
- aVal <<= OUString(rFmt.GetSuffix());
- beans::PropertyValue aSuffixProp( OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_NRULE_SUFFIX)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
- pArray[nIdx++] = aSuffixProp;
- }
-
- {
- sal_Unicode nCode = rFmt.GetBulletChar();
- OUString aStr( &nCode, 1 );
- aVal <<= aStr;
- beans::PropertyValue aBulletProp( OUString(RTL_CONSTASCII_USTRINGPARAM("BulletChar")), -1, aVal, beans::PropertyState_DIRECT_VALUE);
- pArray[nIdx++] = aBulletProp;
- }
-
- if( rFmt.GetBulletFont() )
- {
- awt::FontDescriptor aDesc;
- SvxUnoFontDescriptor::ConvertFromFont( *rFmt.GetBulletFont(), aDesc );
- aVal.setValue(&aDesc, ::getCppuType((const awt::FontDescriptor*)0));
- pArray[nIdx++] = beans::PropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_NRULE_BULLET_FONT)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
- }
-
- {
- const SvxBrushItem* pBrush = rFmt.GetBrush();
- if(pBrush && pBrush->GetGraphicObject())
- {
- const GraphicObject* pGrafObj = pBrush->GetGraphicObject();
- OUString aURL( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
- aURL += OUString::createFromAscii( pGrafObj->GetUniqueID().GetBuffer() );
-
- aVal <<= aURL;
- const beans::PropertyValue aGraphicProp( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL")), -1, aVal, beans::PropertyState_DIRECT_VALUE);
- pArray[nIdx++] = aGraphicProp;
- }
- }
-
- {
- const Size aSize( rFmt.GetGraphicSize() );
- const awt::Size aUnoSize( aSize.Width(), aSize.Height() );
- aVal <<= aUnoSize;
- const beans::PropertyValue aGraphicSizeProp(OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicSize")), -1, aVal, beans::PropertyState_DIRECT_VALUE );
- pArray[nIdx++] = aGraphicSizeProp;
- }
-
- aVal <<= (sal_Int16)rFmt.GetStart();
- pArray[nIdx++] = beans::PropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_NRULE_START_WITH)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
-
- aVal <<= (sal_Int32)rFmt.GetAbsLSpace();
- pArray[nIdx++] = beans::PropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_NRULE_LEFT_MARGIN)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
-
- aVal <<= (sal_Int32)rFmt.GetFirstLineOffset();
- pArray[nIdx++] = beans::PropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_NRULE_FIRST_LINE_OFFSET)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
-
- pArray[nIdx++] = beans::PropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("SymbolTextDistance")), -1, aVal, beans::PropertyState_DIRECT_VALUE);
-
- aVal <<= (sal_Int32)rFmt.GetBulletColor().GetColor();
- pArray[nIdx++] = beans::PropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_NRULE_BULLET_COLOR)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
-
- 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: overflow in Array!!! [CL]" );
- Sequence< beans::PropertyValue> aSeq(pArray, nIdx);
-
- delete [] pArray;
- return aSeq;
-}
-
-void SvxUnoNumberingRules::setNumberingRuleByIndex( const Sequence< beans::PropertyValue >& rProperties, sal_Int32 nIndex)
- throw( RuntimeException, IllegalArgumentException )
-{
- SvxNumberFormat aFmt(maRule.GetLevel( (sal_uInt16)nIndex ));
- const beans::PropertyValue* pPropArray = rProperties.getConstArray();
- for(int i = 0; i < rProperties.getLength(); i++)
- {
- const beans::PropertyValue& rProp = pPropArray[i];
- const OUString& rPropName = rProp.Name;
- const Any& aVal = rProp.Value;
-
- if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_NRULE_NUMBERINGTYPE)))
- {
- sal_Int16 nSet = sal_Int16();
- aVal >>= nSet;
-
- switch(nSet)
- {
- case SVX_NUM_BITMAP:
- case SVX_NUM_CHAR_SPECIAL:
- case SVX_NUM_ROMAN_UPPER:
- case SVX_NUM_ROMAN_LOWER:
- case SVX_NUM_CHARS_UPPER_LETTER:
- case SVX_NUM_CHARS_LOWER_LETTER:
- case SVX_NUM_ARABIC:
- case SVX_NUM_NUMBER_NONE:
- case SVX_NUM_CHARS_UPPER_LETTER_N:
- case SVX_NUM_CHARS_LOWER_LETTER_N:
- aFmt.SetNumberingType(nSet);
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_NRULE_PREFIX)))
- {
- OUString aPrefix;
- if( aVal >>= aPrefix )
- {
- aFmt.SetPrefix(aPrefix);
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_NRULE_SUFFIX)))
- {
- OUString aSuffix;
- if( aVal >>= aSuffix )
- {
- aFmt.SetSuffix(aSuffix);
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_NRULE_BULLETID)))
- {
- sal_Int16 nSet = sal_Int16();
- if( aVal >>= nSet )
- {
- if(nSet < 0x100)
- {
- aFmt.SetBulletChar(nSet);
- continue;
- }
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("BulletChar")))
- {
- OUString aStr;
- if( aVal >>= aStr )
- {
- if(aStr.getLength())
- {
- aFmt.SetBulletChar(aStr[0]);
- }
- else
- {
- aFmt.SetBulletChar(0);
- }
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_NRULE_ADJUST)))
- {
- sal_Int16 nAdjust = sal_Int16();
- if( aVal >>= nAdjust )
- {
- aFmt.SetNumAdjust(ConvertUnoAdjust( (unsigned short)nAdjust ));
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_NRULE_BULLET_FONT)))
- {
- awt::FontDescriptor aDesc;
- if( aVal >>= aDesc )
- {
- Font aFont;
- SvxUnoFontDescriptor::ConvertToFont( aDesc, aFont );
- aFmt.SetBulletFont(&aFont);
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Graphic")))
- {
- Reference< awt::XBitmap > xBmp;
- if( aVal >>= xBmp )
- {
- Graphic aGraf( VCLUnoHelper::GetBitmap( xBmp ) );
- SvxBrushItem aBrushItem(aGraf, GPOS_AREA, SID_ATTR_BRUSH);
- aFmt.SetGraphicBrush( &aBrushItem );
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("GraphicURL")))
- {
- OUString aURL;
- if( aVal >>= aURL )
- {
- GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
- SvxBrushItem aBrushItem( aGrafObj, GPOS_AREA, SID_ATTR_BRUSH );
- aFmt.SetGraphicBrush( &aBrushItem );
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("GraphicSize")))
- {
- awt::Size aUnoSize;
- if( aVal >>= aUnoSize )
- {
- aFmt.SetGraphicSize( Size( aUnoSize.Width, aUnoSize.Height ) );
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_NRULE_START_WITH)))
- {
- sal_Int16 nStart = sal_Int16();
- if( aVal >>= nStart )
- {
- aFmt.SetStart( nStart );
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_NRULE_LEFT_MARGIN)))
- {
- sal_Int32 nMargin = 0;
- if( aVal >>= nMargin )
- {
- aFmt.SetAbsLSpace((sal_uInt16)nMargin);
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_NRULE_FIRST_LINE_OFFSET)))
- {
- sal_Int32 nMargin = 0;
- if( aVal >>= nMargin )
- {
- aFmt.SetFirstLineOffset((sal_uInt16)nMargin);
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("SymbolTextDistance")))
- {
- sal_Int32 nTextDistance = 0;
- if( aVal >>= nTextDistance )
- {
- aFmt.SetCharTextDistance((sal_uInt16)nTextDistance);
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_NRULE_BULLET_COLOR)))
- {
- sal_Int32 nColor = 0;
- if( aVal >>= nColor )
- {
- aFmt.SetBulletColor( (Color) nColor );
- continue;
- }
- }
- else if(rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_NRULE_BULLET_RELSIZE)))
- {
- sal_Int16 nSize = sal_Int16();
- if( aVal >>= nSize )
- {
- aFmt.SetBulletRelSize( (short)nSize );
- continue;
- }
- }
- else
- {
- continue;
- }
-
- throw IllegalArgumentException();
- }
-
- // check that we always have a brush item for bitmap numbering
- if( aFmt.GetNumberingType() == SVX_NUM_BITMAP )
- {
- if( NULL == aFmt.GetBrush() )
- {
- GraphicObject aGrafObj;
- SvxBrushItem aBrushItem( aGrafObj, GPOS_AREA, SID_ATTR_BRUSH );
- aFmt.SetGraphicBrush( &aBrushItem );
- }
- }
- maRule.SetLevel( (sal_uInt16)nIndex, aFmt );
-}
-
-///////////////////////////////////////////////////////////////////////
-
-const SvxNumRule& SvxGetNumRule( Reference< XIndexReplace > xRule ) throw( IllegalArgumentException )
-{
- SvxUnoNumberingRules* pRule = SvxUnoNumberingRules::getImplementation( xRule );
- if( pRule == NULL )
- throw IllegalArgumentException();
-
- return pRule->getNumRule();
-}
-
-com::sun::star::uno::Reference< com::sun::star::container::XIndexReplace > SvxCreateNumRule( const SvxNumRule* pRule ) throw()
-{
- DBG_ASSERT( pRule, "No default SvxNumRule!" );
- if( pRule )
- {
- return new SvxUnoNumberingRules( *pRule );
- }
- else
- {
- SvxNumRule aDefaultRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10 , sal_False);
- return new SvxUnoNumberingRules( aDefaultRule );
- }
-}
-
-
-///////////////////////////////////////////////////////////////////////
-
-class SvxUnoNumberingRulesCompare : public ::cppu::WeakAggImplHelper1< XAnyCompare >
-{
-public:
- virtual sal_Int16 SAL_CALL compare( const Any& Any1, const Any& Any2 ) throw(RuntimeException);
-};
-
-sal_Int16 SAL_CALL SvxUnoNumberingRulesCompare::compare( const Any& Any1, const Any& Any2 ) throw(RuntimeException)
-{
- return SvxUnoNumberingRules::Compare( Any1, Any2 );
-}
-
-sal_Int16 SvxUnoNumberingRules::Compare( const Any& Any1, const Any& Any2 )
-{
- Reference< XIndexReplace > x1( Any1, UNO_QUERY ), x2( Any2, UNO_QUERY );
- if( x1.is() && x2.is() )
- {
- if( x1.get() == x2.get() )
- return 0;
-
- SvxUnoNumberingRules* pRule1 = SvxUnoNumberingRules::getImplementation( x1 );
- if( pRule1 )
- {
- SvxUnoNumberingRules* pRule2 = SvxUnoNumberingRules::getImplementation( x2 );
- if( pRule2 )
- {
- const SvxNumRule& rRule1 = pRule1->getNumRule();
- const SvxNumRule& rRule2 = pRule2->getNumRule();
-
- const sal_uInt16 nLevelCount1 = rRule1.GetLevelCount();
- const sal_uInt16 nLevelCount2 = rRule2.GetLevelCount();
-
- if( nLevelCount1 == 0 || nLevelCount2 == 0 )
- return -1;
-
- for( sal_uInt16 i = 0; (i < nLevelCount1) && (i < nLevelCount2); i++ )
- {
- if( rRule1.GetLevel(i) != rRule2.GetLevel(i) )
- return -1;
- }
- return 0;
- }
- }
- }
-
- return -1;
-}
-
-Reference< XAnyCompare > SvxCreateNumRuleCompare() throw()
-{
- return new SvxUnoNumberingRulesCompare();
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > SvxCreateNumRule() 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
deleted file mode 100644
index 176262007c..0000000000
--- a/editeng/source/uno/unopracc.cxx
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-//------------------------------------------------------------------------
-//
-// Global header
-//
-//------------------------------------------------------------------------
-#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>
-
-
-//------------------------------------------------------------------------
-//
-// Project-local header
-//
-//------------------------------------------------------------------------
-
-#include <editeng/unopracc.hxx>
-#include <editeng/unoedsrc.hxx>
-
-using namespace ::com::sun::star;
-
-//------------------------------------------------------------------------
-//
-// SvxAccessibleTextPropertySet implementation
-//
-//------------------------------------------------------------------------
-
-SvxAccessibleTextPropertySet::SvxAccessibleTextPropertySet( const SvxEditSource* pEditSrc, const SvxItemPropertySet* pPropSet )
- : SvxUnoTextRangeBase( pEditSrc, pPropSet )
-{
-}
-
-SvxAccessibleTextPropertySet::~SvxAccessibleTextPropertySet() throw()
-{
-}
-
-uno::Reference< text::XText > SAL_CALL SvxAccessibleTextPropertySet::getText() throw (uno::RuntimeException)
-{
- // TODO (empty?)
- return uno::Reference< text::XText > ();
-}
-
-uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryAggregation( const uno::Type & ) throw(uno::RuntimeException)
-{
- // TODO (empty?)
- return uno::Any();
-}
-
-uno::Any SAL_CALL SvxAccessibleTextPropertySet::queryInterface( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- return OWeakObject::queryInterface(rType);
-}
-
-void SAL_CALL SvxAccessibleTextPropertySet::acquire()
- throw()
-{
- OWeakObject::acquire();
-}
-
-void SAL_CALL SvxAccessibleTextPropertySet::release()
- throw()
-{
- OWeakObject::release();
-}
-
-// XTypeProvider
-uno::Sequence< uno::Type > SAL_CALL SvxAccessibleTextPropertySet::getTypes() throw ( uno::RuntimeException )
-{
- static ::cppu::OTypeCollection* pTypeCollection = NULL ;
-
- // double-checked locking pattern.
- if ( pTypeCollection == NULL )
- {
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
-
- // Control these pointer again ... it can be, that another instance will be faster then these!
- if ( pTypeCollection == NULL )
- {
- // Create a static typecollection ...
- static ::cppu::OTypeCollection aTypeCollection(
- ::getCppuType( static_cast< const uno::Reference< beans::XPropertySet >* > (0) ),
- ::getCppuType( static_cast< const uno::Reference< beans::XMultiPropertySet >* > (0) ),
- ::getCppuType( static_cast< const uno::Reference< beans::XPropertyState >* > (0) ),
- ::getCppuType( static_cast< const uno::Reference< lang::XServiceInfo >* > (0) ),
- ::getCppuType( static_cast< const uno::Reference< lang::XTypeProvider >* > (0) ) );
-
- // ... and set his address to static pointer!
- pTypeCollection = &aTypeCollection ;
- }
- }
-
- return pTypeCollection->getTypes() ;
-}
-
-namespace
-{
- class theSvxAccessibleTextPropertySetImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxAccessibleTextPropertySetImplementationId > {};
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxAccessibleTextPropertySet::getImplementationId()
- throw (uno::RuntimeException)
-{
- return theSvxAccessibleTextPropertySetImplementationId::get().getSeq();
-}
-
-// XServiceInfo
-::rtl::OUString SAL_CALL SAL_CALL SvxAccessibleTextPropertySet::getImplementationName (void) throw (uno::RuntimeException)
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("SvxAccessibleTextPropertySet"));
-}
-
-sal_Bool SAL_CALL SvxAccessibleTextPropertySet::supportsService (const ::rtl::OUString& sServiceName) throw (uno::RuntimeException)
-{
- // Iterate over all supported service names and return true if on of them
- // matches the given name.
- uno::Sequence< ::rtl::OUString> aSupportedServices (
- getSupportedServiceNames ());
- for (int i=0; i<aSupportedServices.getLength(); i++)
- if (sServiceName == aSupportedServices[i])
- return sal_True;
- return sal_False;
-}
-
-uno::Sequence< ::rtl::OUString> SAL_CALL SvxAccessibleTextPropertySet::getSupportedServiceNames (void) throw (uno::RuntimeException)
-{
- // TODO
- return SvxUnoTextRangeBase::getSupportedServiceNames();
-}
-
-// XServiceName
-::rtl::OUString SAL_CALL SvxAccessibleTextPropertySet::getServiceName() throw (uno::RuntimeException)
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.PropertyValue"));
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
deleted file mode 100644
index 9b1f2aefac..0000000000
--- a/editeng/source/uno/unotext.cxx
+++ /dev/null
@@ -1,2660 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <vcl/svapp.hxx>
-#include <com/sun/star/style/LineSpacing.hpp>
-#include <com/sun/star/text/ControlCharacter.hpp>
-#include <com/sun/star/text/ControlCharacter.hpp>
-#include <com/sun/star/text/XTextField.hdl>
-#include <osl/mutex.hxx>
-#include <svl/itemset.hxx>
-#include <svl/itempool.hxx>
-#include <svl/intitem.hxx>
-#include <svl/eitem.hxx>
-#include <rtl/instance.hxx>
-
-#include <editeng/fontitem.hxx>
-#include <editeng/tstpitem.hxx>
-#include <editeng/unoprnms.hxx>
-#include <editeng/unotext.hxx>
-#include <editeng/unoedsrc.hxx>
-#include <editeng/unonrule.hxx>
-#include <editeng/unofdesc.hxx>
-#include <editeng/unofield.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/numitem.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/outliner.hxx>
-#include <editeng/unoipset.hxx>
-#include <comphelper/serviceinfohelper.hxx>
-#include <comphelper/servicehelper.hxx>
-
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::com::sun::star;
-
-#define QUERYINT( xint ) \
- if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
- return uno::makeAny(uno::Reference< xint >(this))
-
-const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet()
-{
- static SvxItemPropertySet aTextCursorSvxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap(), EditEngine::GetGlobalItemPool() );
- return &aTextCursorSvxPropertySet;
-}
-
-const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap()
-{
- // Propertymap for an Outliner Text
- static const SfxItemPropertyMapEntry aSvxTextPortionPropertyMap[] =
- {
- SVX_UNOEDIT_CHAR_PROPERTIES,
- SVX_UNOEDIT_FONT_PROPERTIES,
- SVX_UNOEDIT_OUTLINER_PROPERTIES,
- SVX_UNOEDIT_PARA_PROPERTIES,
- {MAP_CHAR_LEN("TextField"), EE_FEATURE_FIELD, &::getCppuType((const uno::Reference< text::XTextField >*)0), beans::PropertyAttribute::READONLY, 0 },
- {MAP_CHAR_LEN("TextPortionType"), WID_PORTIONTYPE, &::getCppuType((const ::rtl::OUString*)0), beans::PropertyAttribute::READONLY, 0 },
- {MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
- {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
- {0,0,0,0,0,0}
- };
- return aSvxTextPortionPropertyMap;
-}
-const SvxItemPropertySet* ImplGetSvxTextPortionSvxPropertySet()
-{
- static SvxItemPropertySet aSvxTextPortionPropertySet( ImplGetSvxTextPortionPropertyMap(), EditEngine::GetGlobalItemPool() );
- return &aSvxTextPortionPropertySet;
-}
-
-const SfxItemPropertySet* ImplGetSvxTextPortionSfxPropertySet()
-{
- static SfxItemPropertySet aSvxTextPortionSfxPropertySet( ImplGetSvxTextPortionPropertyMap() );
- return &aSvxTextPortionSfxPropertySet;
-}
-
-const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap()
-{
- // Propertymap for an Outliner Text
- static const SfxItemPropertyMapEntry aSvxUnoOutlinerTextCursorPropertyMap[] =
- {
- SVX_UNOEDIT_CHAR_PROPERTIES,
- SVX_UNOEDIT_FONT_PROPERTIES,
- SVX_UNOEDIT_OUTLINER_PROPERTIES,
- SVX_UNOEDIT_PARA_PROPERTIES,
- {MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
- {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
- {0,0,0,0,0,0}
- };
-
- return aSvxUnoOutlinerTextCursorPropertyMap;
-}
-const SfxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSfxPropertySet()
-{
- static SfxItemPropertySet aTextCursorSfxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap() );
- return &aTextCursorSfxPropertySet;
-}
-
-// ====================================================================
-// helper for Item/Property conversion
-// ====================================================================
-
-void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw()
-{
- DBG_ASSERT( pForwarder, "I need a valid SvxTextForwarder!" );
- if( pForwarder )
- {
- sal_Int16 nParaCount = pForwarder->GetParagraphCount();
- if(nParaCount>0)
- nParaCount--;
-
- rSel = ESelection( 0,0, nParaCount, pForwarder->GetTextLen( nParaCount ));
- }
-}
-
-void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw()
-{
- DBG_ASSERT( pForwarder, "I need a valid SvxTextForwarder!" );
- if( pForwarder )
- {
- if( rSel.nStartPara == 0xffff )
- {
- ::GetSelection( rSel, pForwarder );
- }
- else
- {
- ESelection aMaxSelection;
- GetSelection( aMaxSelection, pForwarder );
-
- // check start position
- if( rSel.nStartPara < aMaxSelection.nStartPara )
- {
- rSel.nStartPara = aMaxSelection.nStartPara;
- rSel.nStartPos = aMaxSelection.nStartPos;
- }
- else if( rSel.nStartPara > aMaxSelection.nEndPara )
- {
- rSel.nStartPara = aMaxSelection.nEndPara;
- rSel.nStartPos = aMaxSelection.nEndPos;
- }
- else if( rSel.nStartPos > pForwarder->GetTextLen( rSel.nStartPara ) )
- {
- rSel.nStartPos = pForwarder->GetTextLen( rSel.nStartPara );
- }
-
- // check end position
- if( rSel.nEndPara < aMaxSelection.nStartPara )
- {
- rSel.nEndPara = aMaxSelection.nStartPara;
- rSel.nEndPos = aMaxSelection.nStartPos;
- }
- else if( rSel.nEndPara > aMaxSelection.nEndPara )
- {
- rSel.nEndPara = aMaxSelection.nEndPara;
- rSel.nEndPos = aMaxSelection.nEndPos;
- }
- else if( rSel.nEndPos > pForwarder->GetTextLen( rSel.nEndPara ) )
- {
- rSel.nEndPos = pForwarder->GetTextLen( rSel.nEndPara );
- }
- }
- }
-}
-
-// ====================================================================
-// class SvxUnoTextRangeBase
-// ====================================================================
-
-UNO3_GETIMPLEMENTATION_IMPL( SvxUnoTextRangeBase );
-
-SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxItemPropertySet* _pSet ) throw()
-: mpEditSource(NULL) , mpPropSet(_pSet)
-{
-}
-
-SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw()
-: mpPropSet(_pSet)
-{
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!");
-
- mpEditSource = pSource->Clone();
- if (mpEditSource != NULL)
- {
- ESelection aSelection;
- ::GetSelection( aSelection, mpEditSource->GetTextForwarder() );
- SetSelection( aSelection );
-
- mpEditSource->addRange( this );
- }
-}
-
-SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw()
-: text::XTextRange()
-, beans::XPropertySet()
-, beans::XMultiPropertySet()
-, beans::XMultiPropertyStates()
-, beans::XPropertyState()
-, lang::XServiceInfo()
-, text::XTextRangeCompare()
-, lang::XUnoTunnel()
-, mpPropSet(rRange.getPropertySet())
-{
- SolarMutexGuard aGuard;
-
- mpEditSource = rRange.mpEditSource ? rRange.mpEditSource->Clone() : NULL;
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- maSelection = rRange.maSelection;
- CheckSelection( maSelection, pForwarder );
- }
-
- if( mpEditSource )
- mpEditSource->addRange( this );
-}
-
-SvxUnoTextRangeBase::~SvxUnoTextRangeBase() throw()
-{
- if( mpEditSource )
- mpEditSource->removeRange( this );
-
- delete mpEditSource;
-}
-
-void SvxUnoTextRangeBase::SetEditSource( SvxEditSource* pSource ) throw()
-{
- DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!");
- DBG_ASSERT(mpEditSource==NULL,"SvxUnoTextRangeBase::SetEditSource called while SvxEditSource already set" );
-
- mpEditSource = pSource;
-
- maSelection.nStartPara = 0xffff;
-
- if( mpEditSource )
- mpEditSource->addRange( this );
-}
-
-/** puts a field item with a copy of the given FieldData into the itemset
- corresponding with this range */
-void SvxUnoTextRangeBase::attachField( const SvxFieldData* pData ) throw()
-{
- SolarMutexGuard aGuard;
-
- if( pData )
- {
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- SvxFieldItem aField( *pData, EE_FEATURE_FIELD );
- pForwarder->QuickInsertField( aField, maSelection );
- }
- }
-}
-
-void SvxUnoTextRangeBase::SetSelection( const ESelection& rSelection ) throw()
-{
- SolarMutexGuard aGuard;
-
- maSelection = rSelection;
- if (mpEditSource != NULL)
- CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
-}
-
-// Interface XTextRange ( XText )
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart(void)
- throw( uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- uno::Reference< text::XTextRange > xRange;
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
-
- CheckSelection( maSelection, pForwarder );
-
- SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() );
-
- if(pText == NULL)
- throw uno::RuntimeException();
-
- SvxUnoTextRange* pRange = new SvxUnoTextRange( *pText );
- xRange = pRange;
-
- ESelection aNewSel = maSelection;
- aNewSel.nEndPara = aNewSel.nStartPara;
- aNewSel.nEndPos = aNewSel.nStartPos;
- pRange->SetSelection( aNewSel );
- }
-
- return xRange;
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd(void)
- throw( uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- uno::Reference< text::XTextRange > xRet;
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- CheckSelection( maSelection, pForwarder );
-
- SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() );
-
- if(pText == NULL)
- throw uno::RuntimeException();
-
- SvxUnoTextRange* pNew = new SvxUnoTextRange( *pText );
- xRet = pNew;
-
- ESelection aNewSel = maSelection;
- aNewSel.nStartPara = aNewSel.nEndPara;
- aNewSel.nStartPos = aNewSel.nEndPos;
- pNew->SetSelection( aNewSel );
- }
- return xRet;
-}
-
-OUString SAL_CALL SvxUnoTextRangeBase::getString(void)
- throw( uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- CheckSelection( maSelection, pForwarder );
-
- return pForwarder->GetText( maSelection );
- }
- else
- {
- const OUString aEmpty;
- return aEmpty;
- }
-}
-
-void SAL_CALL SvxUnoTextRangeBase::setString(const OUString& aString)
- throw( uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- CheckSelection( maSelection, pForwarder );
-
- String aConverted( aString );
- aConverted.ConvertLineEnd( LINEEND_LF ); // Simply count the number of line endings
-
- pForwarder->QuickInsertText( aConverted, maSelection );
- mpEditSource->UpdateData();
-
- // Adapt selection
- //! It would be easier if the EditEngine would return the selection
- //! on QuickInsertText...
- CollapseToStart();
-
- sal_uInt16 nLen = aConverted.Len();
- if (nLen)
- GoRight( nLen, sal_True );
- }
-}
-
-// Interface beans::XPropertySet
-uno::Reference< beans::XPropertySetInfo > SAL_CALL SvxUnoTextRangeBase::getPropertySetInfo(void)
- throw( uno::RuntimeException )
-{
- return mpPropSet->getPropertySetInfo();
-}
-
-void SAL_CALL SvxUnoTextRangeBase::setPropertyValue(const OUString& PropertyName, const uno::Any& aValue)
- throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
-{
- _setPropertyValue( PropertyName, aValue, -1 );
-}
-
-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 )
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
-
- CheckSelection( maSelection, pForwarder );
-
- const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName );
- if ( pMap )
- {
- ESelection aSel( GetSelection() );
- sal_Bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
-
- if( nPara == -1 && !bParaAttrib )
- {
- SfxItemSet aOldSet( pForwarder->GetAttribs( aSel ) );
- // we have a selection and no para attribute
- SfxItemSet aNewSet( *aOldSet.GetPool(), aOldSet.GetRanges() );
-
- setPropertyValue( pMap, aValue, maSelection, aOldSet, aNewSet );
-
-
- pForwarder->QuickSetAttribs( aNewSet, GetSelection() );
- }
- else
- {
- sal_Int32 nEndPara;
-
- if( nPara == -1 )
- {
- nPara = aSel.nStartPara;
- nEndPara = aSel.nEndPara;
- }
- else
- {
- // only one paragraph
- nEndPara = nPara;
- }
-
- while( nPara <= nEndPara )
- {
- // we have a paragraph
- SfxItemSet aSet( pForwarder->GetParaAttribs( (sal_uInt16)nPara ) );
- setPropertyValue( pMap, aValue, maSelection, aSet, aSet );
- pForwarder->SetParaAttribs( (sal_uInt16)nPara, aSet );
- nPara++;
- }
- }
-
- GetEditSource()->UpdateData();
- return;
- }
- }
-
- throw beans::UnknownPropertyException();
-}
-
-void SvxUnoTextRangeBase::setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const uno::Any& rValue, const ESelection& rSelection, const SfxItemSet& rOldSet, SfxItemSet& rNewSet ) throw( beans::UnknownPropertyException, lang::IllegalArgumentException )
-{
- if(!SetPropertyValueHelper( rOldSet, pMap, rValue, rNewSet, &rSelection, GetEditSource() ))
- {
- // 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 );
- }
-}
-
-sal_Bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemSet&, const SfxItemPropertySimpleEntry* pMap, const uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection /* = NULL */, SvxEditSource* pEditSource /* = NULL*/ ) throw( uno::RuntimeException )
-{
- switch( pMap->nWID )
- {
- case WID_FONTDESC:
- {
- awt::FontDescriptor aDesc;
- if(aValue >>= aDesc)
- {
- SvxUnoFontDescriptor::FillItemSet( aDesc, rNewSet );
- return sal_True;
- }
- }
- break;
-
- case EE_PARA_NUMBULLET:
- {
- uno::Reference< container::XIndexReplace > xRule;
- if( !aValue.hasValue() || ((aValue >>= xRule) && !xRule.is()) )
- return sal_True;
-
- return sal_False;
- }
-
- case WID_NUMLEVEL:
- {
- SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
- if(pForwarder && pSelection)
- {
- sal_Int16 nLevel = sal_Int16();
- if( aValue >>= nLevel )
- {
- // #101004# Call interface method instead of unsafe cast
- if(! pForwarder->SetDepth( pSelection->nStartPara, nLevel ) )
- throw lang::IllegalArgumentException();
-
- return sal_True;
- }
- }
- }
- break;
- case WID_NUMBERINGSTARTVALUE:
- {
- SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
- if(pForwarder && pSelection)
- {
- sal_Int16 nStartValue = -1;
- if( aValue >>= nStartValue )
- {
- pForwarder->SetNumberingStartValue( pSelection->nStartPara, nStartValue );
- return sal_True;
- }
- }
- }
- break;
- case WID_PARAISNUMBERINGRESTART:
- {
- SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
- if(pForwarder && pSelection)
- {
- sal_Bool bParaIsNumberingRestart = sal_False;
- if( aValue >>= bParaIsNumberingRestart )
- {
- pForwarder->SetParaIsNumberingRestart( pSelection->nStartPara, bParaIsNumberingRestart );
- return sal_True;
- }
- }
- }
- break;
- case EE_PARA_BULLETSTATE:
- {
- sal_Bool bBullet = sal_True;
- if( aValue >>= bBullet )
- {
- SfxBoolItem aItem( EE_PARA_BULLETSTATE, bBullet );
- rNewSet.Put(aItem);
- return sal_True;
- }
- }
- break;
-
- default:
- return sal_False;
- }
-
- throw lang::IllegalArgumentException();
-}
-
-uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyValue(const OUString& PropertyName)
- throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
-{
- return _getPropertyValue( PropertyName, -1 );
-}
-
-uno::Any SAL_CALL SvxUnoTextRangeBase::_getPropertyValue(const OUString& PropertyName, sal_Int32 nPara )
- throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- uno::Any aAny;
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName );
- if( pMap )
- {
- SfxItemSet* pAttribs = NULL;
- if( nPara != -1 )
- pAttribs = pForwarder->GetParaAttribs( (sal_uInt16)nPara ).Clone();
- else
- pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
-
- // Replace Dontcare with Default, so that one always has a mirror
- pAttribs->ClearInvalidItems();
-
- getPropertyValue( pMap, aAny, *pAttribs );
-
- delete pAttribs;
- return aAny;
- }
- }
-
- throw beans::UnknownPropertyException();
-}
-
-void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertySimpleEntry* pMap, uno::Any& rAny, const SfxItemSet& rSet ) throw( beans::UnknownPropertyException )
-{
- switch( pMap->nWID )
- {
- case EE_FEATURE_FIELD:
- if ( rSet.GetItemState( EE_FEATURE_FIELD, sal_False ) == SFX_ITEM_SET )
- {
- SvxFieldItem* pItem = (SvxFieldItem*)rSet.GetItem( EE_FEATURE_FIELD );
- const SvxFieldData* pData = pItem->GetField();
- uno::Reference< text::XTextRange > xAnchor( this );
-
- // get presentation string for field
- Color* pTColor = NULL;
- Color* pFColor = NULL;
-
- SvxTextForwarder* pForwarder = mpEditSource->GetTextForwarder();
- OUString aPresentation( pForwarder->CalcFieldValue( SvxFieldItem(*pData, EE_FEATURE_FIELD), maSelection.nStartPara, maSelection.nStartPos, pTColor, pFColor ) );
-
- delete pTColor;
- delete pFColor;
-
- uno::Reference< text::XTextField > xField( new SvxUnoTextField( xAnchor, aPresentation, pData ) );
- rAny <<= xField;
- }
- break;
-
- case WID_PORTIONTYPE:
- if ( rSet.GetItemState( EE_FEATURE_FIELD, sal_False ) == SFX_ITEM_SET )
- {
- OUString aType( RTL_CONSTASCII_USTRINGPARAM("TextField") );
- rAny <<= aType;
- }
- else
- {
- OUString aType( RTL_CONSTASCII_USTRINGPARAM("Text") );
- rAny <<= aType;
- }
- break;
-
- default:
- if(!GetPropertyValueHelper( *((SfxItemSet*)(&rSet)), pMap, rAny, &maSelection, GetEditSource() ))
- rAny = mpPropSet->getPropertyValue(pMap, rSet, true, false );
- }
-}
-
-sal_Bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet& rSet, const SfxItemPropertySimpleEntry* pMap, uno::Any& aAny, const ESelection* pSelection /* = NULL */, SvxEditSource* pEditSource /* = NULL */ )
- throw( uno::RuntimeException )
-{
- switch( pMap->nWID )
- {
- case WID_FONTDESC:
- {
- awt::FontDescriptor aDesc;
- SvxUnoFontDescriptor::FillFromItemSet( rSet, aDesc );
- aAny <<= aDesc;
- }
- break;
-
- case EE_PARA_NUMBULLET:
- {
- if((rSet.GetItemState( EE_PARA_NUMBULLET, sal_True ) & (SFX_ITEM_SET|SFX_ITEM_DEFAULT)) == 0)
- throw uno::RuntimeException();
-
- SvxNumBulletItem* pBulletItem = (SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET, sal_True );
-
- if( pBulletItem == NULL )
- throw uno::RuntimeException();
-
- aAny <<= SvxCreateNumRule( pBulletItem->GetNumRule() );
- }
- break;
-
- case WID_NUMLEVEL:
- {
- SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
- if(pForwarder && pSelection)
- {
- sal_Int16 nLevel = pForwarder->GetDepth( pSelection->nStartPara );
- if( nLevel >= 0 )
- aAny <<= nLevel;
- }
- }
- break;
- case WID_NUMBERINGSTARTVALUE:
- {
- SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
- if(pForwarder && pSelection)
- aAny <<= pForwarder->GetNumberingStartValue( pSelection->nStartPara );
- }
- break;
- case WID_PARAISNUMBERINGRESTART:
- {
- SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
- if(pForwarder && pSelection)
- aAny <<= pForwarder->IsParaIsNumberingRestart( pSelection->nStartPara );
- }
- break;
-
- case EE_PARA_BULLETSTATE:
- {
- sal_Bool bState = sal_False;
- if( rSet.GetItemState( EE_PARA_BULLETSTATE, sal_True ) & (SFX_ITEM_SET|SFX_ITEM_DEFAULT))
- {
- SfxBoolItem* pItem = (SfxBoolItem*)rSet.GetItem( EE_PARA_BULLETSTATE, sal_True );
- bState = pItem->GetValue() ? sal_True : sal_False;
- }
-
- aAny <<= bState;
- }
- break;
- default:
-
- return sal_False;
- }
-
- return sal_True;
-}
-
-// 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) {}
-void SAL_CALL SvxUnoTextRangeBase::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-
-// XMultiPropertySet
-void SAL_CALL SvxUnoTextRangeBase::setPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- _setPropertyValues( aPropertyNames, aValues, -1 );
-}
-
-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)
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- CheckSelection( maSelection, pForwarder );
-
- ESelection aSel( GetSelection() );
-
- const OUString* pPropertyNames = aPropertyNames.getConstArray();
- const uno::Any* pValues = aValues.getConstArray();
- sal_Int32 nCount = aPropertyNames.getLength();
-
- sal_Int32 nEndPara = nPara;
- sal_Int32 nTempPara = nPara;
-
- if( nTempPara == -1 )
- {
- nTempPara = aSel.nStartPara;
- nEndPara = aSel.nEndPara;
- }
-
- SfxItemSet* pOldAttrSet = NULL;
- SfxItemSet* pNewAttrSet = NULL;
-
- SfxItemSet* pOldParaSet = NULL;
- SfxItemSet* pNewParaSet = NULL;
-
- for( ; nCount; nCount--, pPropertyNames++, pValues++ )
- {
- const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
-
- if( pMap )
- {
- sal_Bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
-
- if( (nPara == -1) && !bParaAttrib )
- {
- if( NULL == pNewAttrSet )
- {
- const SfxItemSet aSet( pForwarder->GetAttribs( aSel ) );
- pOldAttrSet = new SfxItemSet( aSet );
- pNewAttrSet = new SfxItemSet( *pOldAttrSet->GetPool(), pOldAttrSet->GetRanges() );
- }
-
- setPropertyValue( pMap, *pValues, GetSelection(), *pOldAttrSet, *pNewAttrSet );
-
- if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
- {
- const SfxPoolItem* pItem;
- if( pNewAttrSet->GetItemState( pMap->nWID, sal_True, &pItem ) == SFX_ITEM_SET )
- {
- pOldAttrSet->Put( *pItem );
- }
- }
- }
- else
- {
- if( NULL == pNewParaSet )
- {
- const SfxItemSet aSet( pForwarder->GetParaAttribs( (sal_uInt16)nTempPara ) );
- pOldParaSet = new SfxItemSet( aSet );
- pNewParaSet = new SfxItemSet( *pOldParaSet->GetPool(), pOldParaSet->GetRanges() );
- }
-
- setPropertyValue( pMap, *pValues, GetSelection(), *pOldParaSet, *pNewParaSet );
-
- if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
- {
- const SfxPoolItem* pItem;
- if( pNewParaSet->GetItemState( pMap->nWID, sal_True, &pItem ) == SFX_ITEM_SET )
- {
- pOldParaSet->Put( *pItem );
- }
- }
-
- }
- }
- }
-
- sal_Bool bNeedsUpdate = sal_False;
-
- if( pNewParaSet )
- {
- if( pNewParaSet->Count() )
- {
- while( nTempPara <= nEndPara )
- {
- SfxItemSet aSet( pForwarder->GetParaAttribs( (sal_uInt16)nTempPara ) );
- aSet.Put( *pNewParaSet );
- pForwarder->SetParaAttribs( (sal_uInt16)nTempPara, aSet );
- nTempPara++;
- }
- bNeedsUpdate = sal_True;
- }
-
- delete pNewParaSet;
- delete pOldParaSet;
- }
-
- if( pNewAttrSet )
- {
- if( pNewAttrSet->Count() )
- {
- pForwarder->QuickSetAttribs( *pNewAttrSet, GetSelection() );
- bNeedsUpdate = sal_True;
- }
- delete pNewAttrSet;
- delete pOldAttrSet;
-
- }
-
- if( bNeedsUpdate )
- GetEditSource()->UpdateData();
- }
-}
-
-uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::getPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (uno::RuntimeException)
-{
- return _getPropertyValues( aPropertyNames, -1 );
-}
-
-uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::_getPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, sal_Int32 nPara ) throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- sal_Int32 nCount = aPropertyNames.getLength();
-
-
- uno::Sequence< uno::Any > aValues( nCount );
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- SfxItemSet* pAttribs = NULL;
- if( nPara != -1 )
- pAttribs = pForwarder->GetParaAttribs( (sal_uInt16)nPara ).Clone();
- else
- pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
-
- pAttribs->ClearInvalidItems();
-
- const OUString* pPropertyNames = aPropertyNames.getConstArray();
- uno::Any* pValues = aValues.getArray();
-
- for( ; nCount; nCount--, pPropertyNames++, pValues++ )
- {
- const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
- if( pMap )
- {
- getPropertyValue( pMap, *pValues, *pAttribs );
- }
- }
-
- delete pAttribs;
-
- }
-
- return aValues;
-}
-
-void SAL_CALL SvxUnoTextRangeBase::addPropertiesChangeListener( const uno::Sequence< ::rtl::OUString >& , const uno::Reference< beans::XPropertiesChangeListener >& ) throw (uno::RuntimeException)
-{
-}
-
-void SAL_CALL SvxUnoTextRangeBase::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& ) throw (uno::RuntimeException)
-{
-}
-
-void SAL_CALL SvxUnoTextRangeBase::firePropertiesChangeEvent( const uno::Sequence< ::rtl::OUString >& , const uno::Reference< beans::XPropertiesChangeListener >& ) throw (uno::RuntimeException)
-{
-}
-
-// beans::XPropertyState
-beans::PropertyState SAL_CALL SvxUnoTextRangeBase::getPropertyState( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- return _getPropertyState( PropertyName, -1 );
-}
-
-static sal_uInt16 aSvxUnoFontDescriptorWhichMap[] = { EE_CHAR_FONTINFO, EE_CHAR_FONTHEIGHT, EE_CHAR_ITALIC,
- EE_CHAR_UNDERLINE, EE_CHAR_WEIGHT, EE_CHAR_STRIKEOUT,
- EE_CHAR_WLM, 0 };
-
-beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara)
- throw( beans::UnknownPropertyException, uno::RuntimeException )
-{
- if ( pMap )
- {
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- SfxItemState eItemState = SFX_ITEM_UNKNOWN;
- sal_uInt16 nWID = 0;
-
- switch( pMap->nWID )
- {
- case WID_FONTDESC:
- {
- sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap;
- SfxItemState eTempItemState;
- while( *pWhichId )
- {
- if(nPara != -1)
- eTempItemState = pForwarder->GetItemState( (sal_uInt16)nPara, *pWhichId );
- else
- eTempItemState = pForwarder->GetItemState( GetSelection(), *pWhichId );
-
- switch( eTempItemState )
- {
- case SFX_ITEM_DISABLED:
- case SFX_ITEM_DONTCARE:
- eItemState = SFX_ITEM_DONTCARE;
- break;
-
- case SFX_ITEM_DEFAULT:
- if( eItemState != SFX_ITEM_DEFAULT )
- {
- if( eItemState == SFX_ITEM_UNKNOWN )
- eItemState = SFX_ITEM_DEFAULT;
- }
- break;
-
- case SFX_ITEM_READONLY:
- case SFX_ITEM_SET:
- if( eItemState != SFX_ITEM_SET )
- {
- if( eItemState == SFX_ITEM_UNKNOWN )
- eItemState = SFX_ITEM_SET;
- }
- break;
- default:
- throw beans::UnknownPropertyException();
- }
-
- pWhichId++;
- }
- }
- break;
-
- case WID_NUMLEVEL:
- case WID_NUMBERINGSTARTVALUE:
- case WID_PARAISNUMBERINGRESTART:
- eItemState = SFX_ITEM_SET;
- break;
-
- default:
- nWID = pMap->nWID;
- }
-
- if( nWID != 0 )
- {
- if( nPara != -1 )
- eItemState = pForwarder->GetItemState( (sal_uInt16)nPara, nWID );
- else
- eItemState = pForwarder->GetItemState( GetSelection(), nWID );
- }
-
- switch( eItemState )
- {
- case SFX_ITEM_DONTCARE:
- case SFX_ITEM_DISABLED:
- return beans::PropertyState_AMBIGUOUS_VALUE;
- case SFX_ITEM_READONLY:
- case SFX_ITEM_SET:
- return beans::PropertyState_DIRECT_VALUE;
- case SFX_ITEM_DEFAULT:
- return beans::PropertyState_DEFAULT_VALUE;
-// case SFX_ITEM_UNKNOWN:
- }
- }
- }
- throw beans::UnknownPropertyException();
-}
-
-beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const OUString& PropertyName, sal_Int32 nPara /* = -1 */)
- throw( beans::UnknownPropertyException, uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- return _getPropertyState( mpPropSet->getPropertyMapEntry( PropertyName ), nPara);
-}
-
-uno::Sequence< beans::PropertyState > SAL_CALL SvxUnoTextRangeBase::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- return _getPropertyStates( aPropertyName, -1 );
-}
-
-uno::Sequence< beans::PropertyState > SvxUnoTextRangeBase::_getPropertyStates(const uno::Sequence< OUString >& PropertyName, sal_Int32 nPara /* = -1 */)
- throw( beans::UnknownPropertyException, uno::RuntimeException )
-{
- const sal_Int32 nCount = PropertyName.getLength();
- const OUString* pNames = PropertyName.getConstArray();
-
- uno::Sequence< beans::PropertyState > aRet( nCount );
- beans::PropertyState* pState = aRet.getArray();
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- SfxItemSet* pSet = NULL;
- if( nPara != -1 )
- {
- pSet = new SfxItemSet( pForwarder->GetParaAttribs( (sal_uInt16)nPara ) );
- }
- else
- {
- ESelection aSel( GetSelection() );
- CheckSelection( aSel, pForwarder );
- pSet = new SfxItemSet( pForwarder->GetAttribs( aSel, EditEngineAttribs_OnlyHard ) );
- }
-
- sal_Bool bUnknownPropertyFound = sal_False;
- for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
- {
- const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pNames++ );
- if( NULL == pMap )
- {
- bUnknownPropertyFound = sal_True;
- break;
- }
- bUnknownPropertyFound = !_getOnePropertyStates(pSet, pMap, *pState++);
- }
-
- delete pSet;
-
- if( bUnknownPropertyFound )
- throw beans::UnknownPropertyException();
- }
-
- return aRet;
-}
-
-sal_Bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertySimpleEntry* pMap, beans::PropertyState& rState)
-{
- sal_Bool bUnknownPropertyFound = sal_False;
- if(pSet && pMap)
- {
- SfxItemState eItemState = SFX_ITEM_UNKNOWN;
- sal_uInt16 nWID = 0;
-
- switch( pMap->nWID )
- {
- case WID_FONTDESC:
- {
- sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap;
- SfxItemState eTempItemState;
- while( *pWhichId )
- {
- eTempItemState = pSet->GetItemState( *pWhichId );
-
- switch( eTempItemState )
- {
- case SFX_ITEM_DISABLED:
- case SFX_ITEM_DONTCARE:
- eItemState = SFX_ITEM_DONTCARE;
- break;
-
- case SFX_ITEM_DEFAULT:
- if( eItemState != SFX_ITEM_DEFAULT )
- {
- if( eItemState == SFX_ITEM_UNKNOWN )
- eItemState = SFX_ITEM_DEFAULT;
- }
- break;
-
- case SFX_ITEM_READONLY:
- case SFX_ITEM_SET:
- if( eItemState != SFX_ITEM_SET )
- {
- if( eItemState == SFX_ITEM_UNKNOWN )
- eItemState = SFX_ITEM_SET;
- }
- break;
- default:
- bUnknownPropertyFound = sal_True;
- break;
- }
-
- pWhichId++;
- }
- }
- break;
-
- case WID_NUMLEVEL:
- case WID_NUMBERINGSTARTVALUE:
- case WID_PARAISNUMBERINGRESTART:
- eItemState = SFX_ITEM_SET;
- break;
-
- default:
- nWID = pMap->nWID;
- }
-
- if( bUnknownPropertyFound )
- return !bUnknownPropertyFound;
-
- if( nWID != 0 )
- eItemState = pSet->GetItemState( nWID, sal_False );
-
- switch( eItemState )
- {
- case SFX_ITEM_READONLY:
- case SFX_ITEM_SET:
- rState = beans::PropertyState_DIRECT_VALUE;
- break;
- case SFX_ITEM_DEFAULT:
- rState = beans::PropertyState_DEFAULT_VALUE;
- break;
-// case SFX_ITEM_UNKNOWN:
-// case SFX_ITEM_DONTCARE:
-// case SFX_ITEM_DISABLED:
- default:
- rState = beans::PropertyState_AMBIGUOUS_VALUE;
- }
- }
- return !bUnknownPropertyFound;
-}
-
-void SAL_CALL SvxUnoTextRangeBase::setPropertyToDefault( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- _setPropertyToDefault( PropertyName, -1 );
-}
-
-void SvxUnoTextRangeBase::_setPropertyToDefault(const OUString& PropertyName, sal_Int32 nPara /* = -1 */)
- throw( beans::UnknownPropertyException, uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
-
- if( pForwarder )
- {
- const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( PropertyName );
- if ( pMap )
- {
- CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
- _setPropertyToDefault( pForwarder, pMap, nPara );
- return;
- }
- }
-
- throw beans::UnknownPropertyException();
-}
-
-void SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara )
- throw( beans::UnknownPropertyException, uno::RuntimeException )
-{
- do
- {
- SfxItemSet aSet( *pForwarder->GetPool(), sal_True );
-
- if( pMap->nWID == WID_FONTDESC )
- {
- SvxUnoFontDescriptor::setPropertyToDefault( aSet );
- }
- else if( pMap->nWID == WID_NUMLEVEL )
- {
- // #101004# Call interface method instead of unsafe cast
- pForwarder->SetDepth( maSelection.nStartPara, -1 );
- return;
- }
- else if( pMap->nWID == WID_NUMBERINGSTARTVALUE )
- {
- pForwarder->SetNumberingStartValue( maSelection.nStartPara, -1 );
- }
- else if( pMap->nWID == WID_PARAISNUMBERINGRESTART )
- {
- pForwarder->SetParaIsNumberingRestart( maSelection.nStartPara, sal_False );
- }
- else
- {
- aSet.InvalidateItem( pMap->nWID );
- }
-
- if(nPara != -1)
- pForwarder->SetParaAttribs( (sal_uInt16)nPara, aSet );
- else
- pForwarder->QuickSetAttribs( aSet, GetSelection() );
-
- GetEditSource()->UpdateData();
-
- return;
- }
- while(0);
-}
-
-uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aPropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( aPropertyName );
- if( pMap )
- {
- SfxItemPool* pPool = pForwarder->GetPool();
-
- switch( pMap->nWID )
- {
- case WID_FONTDESC:
- return SvxUnoFontDescriptor::getPropertyDefault( pPool );
-
- case WID_NUMLEVEL:
- {
- uno::Any aAny;
- return aAny;
- }
-
- case WID_NUMBERINGSTARTVALUE:
- return uno::Any( (sal_Int16)-1 );
-
- case WID_PARAISNUMBERINGRESTART:
- return uno::Any( (sal_Bool)sal_False );
-
- default:
- {
- // Get Default from ItemPool
- if(pPool->IsWhich(pMap->nWID))
- {
- SfxItemSet aSet( *pPool, pMap->nWID, pMap->nWID);
- aSet.Put(pPool->GetDefaultItem(pMap->nWID));
- return mpPropSet->getPropertyValue(pMap, aSet, true, false );
- }
- }
- }
- }
- }
- throw beans::UnknownPropertyException();
-}
-
-// beans::XMultiPropertyStates
-void SAL_CALL SvxUnoTextRangeBase::setAllPropertiesToDefault( ) throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
-
- if( pForwarder )
- {
- PropertyEntryVector_t aEntries = mpPropSet->getPropertyMap()->getPropertyEntries();
- PropertyEntryVector_t::const_iterator aIt = aEntries.begin();
- while( aIt != aEntries.end() )
- {
- _setPropertyToDefault( pForwarder, &(*aIt), -1 );
- ++aIt;
- }
- }
-}
-
-void SAL_CALL SvxUnoTextRangeBase::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException)
-{
- sal_Int32 nCount = aPropertyNames.getLength();
- for( const OUString* pName = aPropertyNames.getConstArray(); nCount; pName++, nCount-- )
- {
- setPropertyToDefault( *pName );
- }
-}
-
-uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- sal_Int32 nCount = aPropertyNames.getLength();
- uno::Sequence< uno::Any > ret( nCount );
- uno::Any* pDefaults = ret.getArray();
-
- for( const OUString* pName = aPropertyNames.getConstArray(); nCount; pName++, nCount--, pDefaults++ )
- {
- *pDefaults = getPropertyDefault( *pName );
- }
-
- return ret;
-}
-
-// internal
-void SvxUnoTextRangeBase::CollapseToStart(void) throw()
-{
- CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
-
- maSelection.nEndPara = maSelection.nStartPara;
- maSelection.nEndPos = maSelection.nStartPos;
-}
-
-void SvxUnoTextRangeBase::CollapseToEnd(void) throw()
-{
- CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
-
- maSelection.nStartPara = maSelection.nEndPara;
- maSelection.nStartPos = maSelection.nEndPos;
-}
-
-sal_Bool SvxUnoTextRangeBase::IsCollapsed(void) throw()
-{
- CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
-
- return ( maSelection.nStartPara == maSelection.nEndPara &&
- maSelection.nStartPos == maSelection.nEndPos );
-}
-
-sal_Bool SvxUnoTextRangeBase::GoLeft(sal_Int16 nCount, sal_Bool Expand) throw()
-{
- CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
-
- // #75098# use end position, as in Writer (start is anchor, end is cursor)
- sal_uInt16 nNewPos = maSelection.nEndPos;
- sal_uInt16 nNewPar = maSelection.nEndPara;
-
- sal_Bool bOk = sal_True;
- SvxTextForwarder* pForwarder = NULL;
- while ( nCount > nNewPos && bOk )
- {
- if ( nNewPar == 0 )
- bOk = sal_False;
- else
- {
- if ( !pForwarder )
- pForwarder = mpEditSource->GetTextForwarder(); // first here, it it is necessary...
-
- --nNewPar;
- nCount -= nNewPos + 1;
- nNewPos = pForwarder->GetTextLen( nNewPar );
- }
- }
-
- if ( bOk )
- {
- nNewPos = nNewPos - nCount;
- maSelection.nStartPara = nNewPar;
- maSelection.nStartPos = nNewPos;
- }
-
- if (!Expand)
- CollapseToStart();
-
- return bOk;
-}
-
-sal_Bool SvxUnoTextRangeBase::GoRight(sal_Int16 nCount, sal_Bool Expand) throw()
-{
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- CheckSelection( maSelection, pForwarder );
-
-
- sal_uInt16 nNewPos = maSelection.nEndPos + nCount; //! Overflow???
- sal_uInt16 nNewPar = maSelection.nEndPara;
-
- sal_Bool bOk = sal_True;
- sal_uInt16 nParCount = pForwarder->GetParagraphCount();
- sal_uInt16 nThisLen = pForwarder->GetTextLen( nNewPar );
- while ( nNewPos > nThisLen && bOk )
- {
- if ( nNewPar + 1 >= nParCount )
- bOk = sal_False;
- else
- {
- nNewPos -= nThisLen+1;
- ++nNewPar;
- nThisLen = pForwarder->GetTextLen( nNewPar );
- }
- }
-
- if (bOk)
- {
- maSelection.nEndPara = nNewPar;
- maSelection.nEndPos = nNewPos;
- }
-
- if (!Expand)
- CollapseToEnd();
-
- return bOk;
- }
- return sal_False;
-}
-
-void SvxUnoTextRangeBase::GotoStart(sal_Bool Expand) throw()
-{
- maSelection.nStartPara = 0;
- maSelection.nStartPos = 0;
-
- if (!Expand)
- CollapseToStart();
-}
-
-void SvxUnoTextRangeBase::GotoEnd(sal_Bool Expand) throw()
-{
- CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
-
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
-
- sal_uInt16 nPar = pForwarder->GetParagraphCount();
- if (nPar)
- --nPar;
-
- maSelection.nEndPara = nPar;
- maSelection.nEndPos = pForwarder->GetTextLen( nPar );
-
- if (!Expand)
- CollapseToEnd();
- }
-}
-
-// lang::XServiceInfo
-sal_Bool SAL_CALL SvxUnoTextRangeBase::supportsService( const OUString& ServiceName )
- throw(uno::RuntimeException)
-{
- return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
-}
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextRangeBase::getSupportedServiceNames()
- throw(uno::RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextRangeBase::getSupportedServiceNames_Static()
- SAL_THROW(())
-{
- uno::Sequence< OUString > aSeq;
- comphelper::ServiceInfoHelper::addToSequence( aSeq, 3, "com.sun.star.style.CharacterProperties",
- "com.sun.star.style.CharacterPropertiesComplex",
- "com.sun.star.style.CharacterPropertiesAsian");
- return aSeq;
-}
-
-// XTextRangeCompare
-sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionStarts( const uno::Reference< text::XTextRange >& xR1, const uno::Reference< text::XTextRange >& xR2 ) throw (lang::IllegalArgumentException, uno::RuntimeException)
-{
- SvxUnoTextRangeBase* pR1 = SvxUnoTextRangeBase::getImplementation( xR1 );
- SvxUnoTextRangeBase* pR2 = SvxUnoTextRangeBase::getImplementation( xR2 );
-
- if( (pR1 == 0) || (pR2 == 0) )
- throw lang::IllegalArgumentException();
-
- const ESelection& r1 = pR1->maSelection;
- const ESelection& r2 = pR2->maSelection;
-
- if( r1.nStartPara == r2.nStartPara )
- {
- if( r1.nStartPos == r2.nStartPos )
- return 0;
- else
- return r1.nStartPos < r2.nStartPos ? 1 : -1;
- }
- else
- {
- return r1.nStartPara < r2.nStartPara ? 1 : -1;
- }
-}
-
-sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionEnds( const uno::Reference< text::XTextRange >& xR1, const uno::Reference< text::XTextRange >& xR2 ) throw (lang::IllegalArgumentException, uno::RuntimeException)
-{
- SvxUnoTextRangeBase* pR1 = SvxUnoTextRangeBase::getImplementation( xR1 );
- SvxUnoTextRangeBase* pR2 = SvxUnoTextRangeBase::getImplementation( xR2 );
-
- if( (pR1 == 0) || (pR2 == 0) )
- throw lang::IllegalArgumentException();
-
- const ESelection& r1 = pR1->maSelection;
- const ESelection& r2 = pR2->maSelection;
-
- if( r1.nEndPara == r2.nEndPara )
- {
- if( r1.nEndPos == r2.nEndPos )
- return 0;
- else
- return r1.nEndPos < r2.nEndPos ? 1 : -1;
- }
- else
- {
- return r1.nEndPara < r2.nEndPara ? 1 : -1;
- }
-}
-
-// ====================================================================
-// class SvxUnoTextRange
-// ====================================================================
-
-uno::Reference< uno::XInterface > SvxUnoTextRange_NewInstance()
-{
- SvxUnoText aText;
- uno::Reference< text::XTextRange > xRange( new SvxUnoTextRange( aText ) );
-#if (_MSC_VER < 1300)
- return xRange;
-#else
- return (uno::Reference< uno::XInterface >)xRange;
-#endif
-}
-
-SvxUnoTextRange::SvxUnoTextRange( const SvxUnoTextBase& rParent, sal_Bool bPortion /* = sal_False */ ) throw()
-:SvxUnoTextRangeBase( rParent.GetEditSource(), bPortion ? ImplGetSvxTextPortionSvxPropertySet() : rParent.getPropertySet() ),
- mbPortion( bPortion )
-{
- xParentText = (text::XText*)&rParent;
-}
-
-SvxUnoTextRange::~SvxUnoTextRange() throw()
-{
-}
-
-uno::Any SAL_CALL SvxUnoTextRange::queryAggregation( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- QUERYINT( text::XTextRange );
- else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertyStates >*)0) )
- return uno::makeAny(uno::Reference< beans::XMultiPropertyStates >(this));
- else if( rType == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) )
- return uno::makeAny(uno::Reference< beans::XPropertySet >(this));
- else QUERYINT( beans::XPropertyState );
- else QUERYINT( text::XTextRangeCompare );
- else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0) )
- return uno::makeAny(uno::Reference< beans::XMultiPropertySet >(this));
- else QUERYINT( lang::XServiceInfo );
- else QUERYINT( lang::XTypeProvider );
- else QUERYINT( lang::XUnoTunnel );
- else
- return OWeakAggObject::queryAggregation( rType );
-}
-
-uno::Any SAL_CALL SvxUnoTextRange::queryInterface( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- return OWeakAggObject::queryInterface(rType);
-}
-
-void SAL_CALL SvxUnoTextRange::acquire()
- throw( )
-{
- OWeakAggObject::acquire();
-}
-
-void SAL_CALL SvxUnoTextRange::release()
- throw( )
-{
- OWeakAggObject::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)
-{
- return theSvxUnoTextRangeTypes::get();
-}
-
-namespace
-{
- class theSvxUnoTextRangeImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextRangeImplementationId > {};
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextRange::getImplementationId()
- throw (uno::RuntimeException)
-{
- return theSvxUnoTextRangeImplementationId::get().getSeq();
-}
-
-// XTextRange
-uno::Reference< text::XText > SAL_CALL SvxUnoTextRange::getText()
- throw(uno::RuntimeException)
-{
- return xParentText;
-}
-
-// lang::XServiceInfo
-OUString SAL_CALL SvxUnoTextRange::getImplementationName()
- throw(uno::RuntimeException)
-{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextRange"));
-}
-
-// ====================================================================
-// class SvxUnoText
-// ====================================================================
-
-SvxUnoTextBase::SvxUnoTextBase() throw()
-: SvxUnoTextRangeBase( NULL )
-{
-
-}
-
-SvxUnoTextBase::SvxUnoTextBase( const SvxItemPropertySet* _pSet ) throw()
-: SvxUnoTextRangeBase( _pSet )
-{
-}
-
-SvxUnoTextBase::SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw()
-: SvxUnoTextRangeBase( pSource, _pSet )
-{
- ESelection aSelection;
- ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
- SetSelection( aSelection );
-}
-
-SvxUnoTextBase::SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, uno::Reference < text::XText > xParent ) throw()
-: SvxUnoTextRangeBase( pSource, _pSet )
-{
- xParentText = xParent;
- ESelection aSelection;
- ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
- SetSelection( aSelection );
-}
-
-SvxUnoTextBase::SvxUnoTextBase( const SvxUnoTextBase& rText ) throw()
-: SvxUnoTextRangeBase( rText )
-, text::XTextAppend()
-, text::XTextCopy()
-, container::XEnumerationAccess()
-, text::XTextRangeMover()
-, lang::XTypeProvider()
-{
- xParentText = rText.xParentText;
-}
-
-SvxUnoTextBase::~SvxUnoTextBase() throw()
-{
-}
-
-// Internal
-ESelection SvxUnoTextBase::InsertField( const SvxFieldItem& rField ) throw()
-{
- SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- pForwarder->QuickInsertField( rField, GetSelection() );
- GetEditSource()->UpdateData();
-
- // Adapt selection
- //! It would be easier if the EditEngine would return the selection
- //! on QuickInsertText...
- CollapseToStart();
- GoRight( 1, sal_True ); // Field is always 1 character
- }
-
- return GetSelection(); // Selection with the field
-}
-
-// XInterface
-uno::Any SAL_CALL SvxUnoTextBase::queryAggregation( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- QUERYINT( text::XText );
- QUERYINT( text::XSimpleText );
- if( rType == ::getCppuType((const uno::Reference< text::XTextRange >*)0) )
- return uno::makeAny(uno::Reference< text::XTextRange >((text::XText*)(this)));
- QUERYINT(container::XEnumerationAccess );
- QUERYINT( container::XElementAccess );
- QUERYINT( beans::XMultiPropertyStates );
- QUERYINT( beans::XPropertySet );
- QUERYINT( beans::XMultiPropertySet );
- QUERYINT( beans::XPropertyState );
- QUERYINT( text::XTextRangeCompare );
- QUERYINT( lang::XServiceInfo );
- QUERYINT( text::XTextRangeMover );
- QUERYINT( text::XTextCopy );
- QUERYINT( text::XTextAppend );
- QUERYINT( text::XParagraphAppend );
- QUERYINT( text::XTextPortionAppend );
- QUERYINT( lang::XTypeProvider );
- QUERYINT( lang::XUnoTunnel );
-
- return uno::Any();
-}
-
-// XTypeProvider
-
-namespace
-{
- struct theSvxUnoTextBaseTypes :
- public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextBaseTypes>
- {
- 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()
- throw (uno::RuntimeException)
-{
- return getStaticTypes();
-}
-
-namespace
-{
- class theSvxUnoTextBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextBaseImplementationId > {};
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextBase::getImplementationId()
- throw (uno::RuntimeException)
-{
- return theSvxUnoTextBaseImplementationId::get().getSeq();
-}
-
-uno::Reference< text::XTextCursor > SvxUnoTextBase::createTextCursorBySelection( const ESelection& rSel )
-{
- SvxUnoTextCursor* pCursor = new SvxUnoTextCursor( *this );
- uno::Reference< text::XTextCursor > xCursor( pCursor );
- pCursor->SetSelection( rSel );
- return xCursor;
-}
-
-// XSimpleText
-
-uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursor()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return new SvxUnoTextCursor( *this );
-}
-
-uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursorByRange( const uno::Reference< text::XTextRange >& aTextPosition )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- uno::Reference< text::XTextCursor > xCursor;
-
- if( aTextPosition.is() )
- {
- SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( aTextPosition );
- if(pRange)
- xCursor = createTextCursorBySelection( pRange->GetSelection() );
- }
-
- return xCursor;
-}
-
-void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if( !xRange.is() )
- return;
-
- ESelection aSelection;
- ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
- SetSelection( aSelection );
-
- SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
- if(pRange)
- {
- // 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) // do not replace -> append on tail
- pRange->CollapseToEnd();
-
- pRange->setString( aString );
-
- pRange->CollapseToEnd();
- }
-}
-
-void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb )
- throw(lang::IllegalArgumentException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
-
- if( pForwarder )
- {
- ESelection aSelection;
- ::GetSelection( aSelection, pForwarder );
- SetSelection( aSelection );
-
- switch( nControlCharacter )
- {
- case text::ControlCharacter::PARAGRAPH_BREAK:
- {
- const String aText( (sal_Unicode)13 ); // '\r' does not work on Mac
- insertString( xRange, aText, bAbsorb );
-
- return;
- }
- case text::ControlCharacter::LINE_BREAK:
- {
- SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
- if(pRange)
- {
- ESelection aRange = pRange->GetSelection();
-
- if( bAbsorb )
- {
- const String aEmpty;
- pForwarder->QuickInsertText( aEmpty, aRange );
-
- aRange.nEndPos = aRange.nStartPos;
- aRange.nEndPara = aRange.nStartPara;
- }
- else
- {
- aRange.nStartPos = aRange.nEndPos;
- aRange.nStartPara = aRange.nStartPara;
- }
-
- pForwarder->QuickInsertLineBreak( aRange );
- GetEditSource()->UpdateData();
-
- aRange.nEndPos += 1;
- if( !bAbsorb )
- aRange.nStartPos += 1;
-
- pRange->SetSelection( aRange );
- }
- return;
- }
- case text::ControlCharacter::APPEND_PARAGRAPH:
- {
- SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
- if(pRange)
- {
- ESelection aRange = pRange->GetSelection();
-// ESelection aOldSelection = aRange;
-
- aRange.nStartPos = pForwarder->GetTextLen( aRange.nStartPara );
-
- aRange.nEndPara = aRange.nStartPara;
- aRange.nEndPos = aRange.nStartPos;
-
- pRange->SetSelection( aRange );
- const String aText( (sal_Unicode)13 ); // '\r' geht auf'm Mac nicht
- pRange->setString( aText );
-
- aRange.nStartPos = 0;
- aRange.nStartPara += 1;
- aRange.nEndPos = 0;
- aRange.nEndPara += 1;
-
- pRange->SetSelection( aRange );
-
- return;
- }
- }
- }
- }
-
- throw lang::IllegalArgumentException();
-}
-
-// XText
-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)
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
- if( pForwarder )
- {
-
- SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
- SvxUnoTextField* pField = SvxUnoTextField::getImplementation( xContent );
-
- if( pRange == NULL || pField == NULL )
- throw lang::IllegalArgumentException();
-
- ESelection aSelection = pRange->GetSelection();
- if( !bAbsorb )
- {
- aSelection.nStartPara = aSelection.nEndPara;
- aSelection.nStartPos = aSelection.nEndPos;
- }
-
- SvxFieldData* pFieldData = pField->CreateFieldData();
- if( pFieldData == NULL )
- throw lang::IllegalArgumentException();
-
- SvxFieldItem aField( *pFieldData, EE_FEATURE_FIELD );
- pForwarder->QuickInsertField( aField, aSelection );
- GetEditSource()->UpdateData();
-
- pField->SetAnchor( uno::Reference< text::XTextRange >::query( (cppu::OWeakObject*)this ) );
-
- aSelection.nEndPos += 1;
- aSelection.nStartPos = aSelection.nEndPos;
- //maSelection = aSelection; //???
- pRange->SetSelection( aSelection );
-
- delete pFieldData;
- }
-}
-
-void SAL_CALL SvxUnoTextBase::removeTextContent( const uno::Reference< text::XTextContent >& ) throw(container::NoSuchElementException, uno::RuntimeException)
-{
-}
-
-// XTextRange
-
-uno::Reference< text::XText > SAL_CALL SvxUnoTextBase::getText()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if (GetEditSource())
- {
- ESelection aSelection;
- ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
- ((SvxUnoTextBase*)this)->SetSelection( aSelection );
- }
-
- return (text::XText*)this;
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::getStart()
- throw(uno::RuntimeException)
-{
- return SvxUnoTextRangeBase::getStart();
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::getEnd()
- throw(uno::RuntimeException)
-{
- return SvxUnoTextRangeBase::getEnd();
-}
-
-OUString SAL_CALL SvxUnoTextBase::getString() throw( uno::RuntimeException )
-{
- return SvxUnoTextRangeBase::getString();
-}
-
-void SAL_CALL SvxUnoTextBase::setString( const OUString& aString ) throw(uno::RuntimeException)
-{
- SvxUnoTextRangeBase::setString(aString);
-}
-
-
-// XEnumerationAccess
-uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextBase::createEnumeration()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- ESelection aSelection;
- ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
- SetSelection( aSelection );
-
- uno::Reference< container::XEnumeration > xEnum( (container::XEnumeration*) new SvxUnoTextContentEnumeration( *this ) );
- return xEnum;
-}
-
-// XElementAccess ( container::XEnumerationAccess )
-uno::Type SAL_CALL SvxUnoTextBase::getElementType( ) throw(uno::RuntimeException)
-{
- return ::getCppuType((const uno::Reference< text::XTextRange >*)0 );
-}
-
-sal_Bool SAL_CALL SvxUnoTextBase::hasElements( ) throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(GetEditSource())
- {
- SvxTextForwarder* pForwarder = GetEditSource()->GetTextForwarder();
- if(pForwarder)
- return pForwarder->GetParagraphCount() != 0;
- }
-
- return sal_False;
-}
-
-// text::XTextRangeMover
-void SAL_CALL SvxUnoTextBase::moveTextRange( const uno::Reference< text::XTextRange >&, sal_Int16 )
- throw(uno::RuntimeException)
-{
-}
-
-void SvxPropertyValuesToItemSet(
- SfxItemSet &rItemSet,
- const uno::Sequence< beans::PropertyValue > rPropertyVaules,
- const SfxItemPropertySet *pPropSet,
- SvxTextForwarder *pForwarder /*needed for WID_NUMLEVEL*/,
- sal_uInt16 nPara /*needed for WID_NUMLEVEL*/)
- throw(lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
-{
- sal_Int32 nProps = rPropertyVaules.getLength();
- const beans::PropertyValue *pProps = rPropertyVaules.getConstArray();
- for (sal_Int32 i = 0; i < nProps; ++i)
- {
- const SfxItemPropertySimpleEntry *pEntry = pPropSet->getPropertyMap()->getByName( pProps[i].Name );
- if (pEntry)
- {
- // Note: there is no need to take special care of the properties
- // TextField (EE_FEATURE_FIELD) and
- // TextPortionType (WID_PORTIONTYPE)
- // since they are read-only and thus are already taken care of below.
-
- if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
- // should be PropertyVetoException which is not yet defined for the new import API's functions
- throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pProps[i].Name, static_cast < cppu::OWeakObject * > ( 0 ) );
- //throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pProps[i].Name, static_cast < cppu::OWeakObject * > ( 0 ) );
-
- if (pEntry->nWID == WID_FONTDESC)
- {
- awt::FontDescriptor aDesc;
- if (pProps[i].Value >>= aDesc)
- SvxUnoFontDescriptor::FillItemSet( aDesc, rItemSet );
- }
- else if (pEntry->nWID == WID_NUMLEVEL)
- {
- if (pForwarder)
- {
- sal_Int16 nLevel = -1;
- pProps[i].Value >>= nLevel;
-
- // #101004# Call interface method instead of unsafe cast
- if (!pForwarder->SetDepth( nPara, nLevel ))
- throw lang::IllegalArgumentException();
- }
- }
- else if (pEntry->nWID == WID_NUMBERINGSTARTVALUE )
- {
- if( pForwarder )
- {
- sal_Int16 nStartValue = -1;
- if( !(pProps[i].Value >>= nStartValue) )
- throw lang::IllegalArgumentException();
-
- pForwarder->SetNumberingStartValue( nPara, nStartValue );
- }
- }
- else if (pEntry->nWID == WID_PARAISNUMBERINGRESTART )
- {
- if( pForwarder )
- {
- sal_Bool bParaIsNumberingRestart = sal_False;
- if( !(pProps[i].Value >>= bParaIsNumberingRestart) )
- throw lang::IllegalArgumentException();
-
- pForwarder->SetParaIsNumberingRestart( nPara, bParaIsNumberingRestart );
- }
- }
- else
- pPropSet->setPropertyValue( pProps[i].Name, pProps[i].Value, rItemSet );
- }
- else
- throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pProps[i].Name, static_cast < cppu::OWeakObject * > ( 0 ) );
- }
-}
-
-// com::sun::star::text::XParagraphAppend (new import API)
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendParagraph(
- const uno::Sequence< beans::PropertyValue >& rCharAndParaProps )
- throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference< text::XTextRange > xRet;
- SvxEditSource *pEditSource = GetEditSource();
- SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
- if (pTextForwarder)
- {
- sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount();
- DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
- pTextForwarder->AppendParagraph();
-
- // set properties for new appended (now last) paragraph
- ESelection aSel( nParaCount, 0, nParaCount, 0 );
- SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
- SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
- ImplGetSvxUnoOutlinerTextCursorSfxPropertySet(),
- pTextForwarder,
- nParaCount );
- pTextForwarder->QuickSetAttribs( aItemSet, aSel );
- pEditSource->UpdateData();
- SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
- xRet = pRange;
- pRange->SetSelection( aSel );
- }
- return xRet;
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph(
- const uno::Sequence< beans::PropertyValue >& rCharAndParaProps )
- throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- uno::Reference< text::XTextRange > xRet;
- SvxEditSource *pEditSource = GetEditSource();
- SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
- if (pTextForwarder)
- {
- sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount();
- DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
- pTextForwarder->AppendParagraph();
-
- // set properties for the previously last paragraph
- sal_uInt16 nPara = nParaCount - 1;
- ESelection aSel( nPara, 0, nPara, 0 );
- SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
- SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
- ImplGetSvxUnoOutlinerTextCursorSfxPropertySet(), pTextForwarder, nPara );
- pTextForwarder->QuickSetAttribs( aItemSet, aSel );
- pEditSource->UpdateData();
- SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
- xRet = pRange;
- pRange->SetSelection( aSel );
- }
- return xRet;
-}
-
-// com::sun::star::text::XTextPortionAppend (new import API)
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion(
- const ::rtl::OUString& rText,
- const uno::Sequence< beans::PropertyValue >& rCharAndParaProps )
- throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- SvxEditSource *pEditSource = GetEditSource();
- SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
- uno::Reference< text::XTextRange > xRet;
- if (pTextForwarder)
- {
- sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount();
- DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
- sal_uInt16 nPara = nParaCount - 1;
- SfxItemSet aSet( pTextForwarder->GetParaAttribs( nPara ) );
- xub_StrLen nStart = pTextForwarder->AppendTextPortion( nPara, rText, aSet );
- pEditSource->UpdateData();
- xub_StrLen nEnd = pTextForwarder->GetTextLen( nPara );
-
- // set properties for the new text portion
- ESelection aSel( nPara, nStart, nPara, nEnd );
- pTextForwarder->RemoveAttribs( aSel, sal_False, 0 );
- pEditSource->UpdateData();
-
- SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
- SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
- ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, nPara );
- pTextForwarder->QuickSetAttribs( aItemSet, aSel );
- SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
- xRet = pRange;
- pRange->SetSelection( aSel );
- const beans::PropertyValue* pProps = rCharAndParaProps.getConstArray();
- for( sal_Int32 nProp = 0; nProp < rCharAndParaProps.getLength(); ++nProp )
- pRange->setPropertyValue( pProps[nProp].Name, pProps[nProp].Value );
- }
- return xRet;
-}
-
-void SvxUnoTextBase::copyText(
- const uno::Reference< text::XTextCopy >& xSource ) throw ( uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
- uno::Reference< lang::XUnoTunnel > xUT( xSource, uno::UNO_QUERY );
- SvxEditSource *pEditSource = GetEditSource();
- SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
- if( !pTextForwarder )
- return;
- if( xUT.is() )
- {
- SvxUnoTextBase* pSource = reinterpret_cast<SvxUnoTextBase*>(sal::static_int_cast<sal_uIntPtr>(
- xUT->getSomething( SvxUnoTextBase::getUnoTunnelId())));
- SvxEditSource *pSourceEditSource = pSource->GetEditSource();
- SvxTextForwarder *pSourceTextForwarder = pSourceEditSource ? pSourceEditSource->GetTextForwarder() : 0;
- if( pSourceTextForwarder )
- {
- pTextForwarder->CopyText( *pSourceTextForwarder );
- pEditSource->UpdateData();
- }
- }
- else
- {
- uno::Reference< text::XText > xSourceText( xSource, uno::UNO_QUERY );
- if( xSourceText.is() )
- {
- setString( xSourceText->getString() );
- }
- }
-}
-
-// lang::XServiceInfo
-OUString SAL_CALL SvxUnoTextBase::getImplementationName()
- throw(uno::RuntimeException)
-{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextBase"));
-}
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames( )
- throw(uno::RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames_Static( )
- SAL_THROW(())
-{
- uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames_Static() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.text.Text" );
- return aSeq;
-}
-
-namespace
-{
- class theSvxUnoTextBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextBaseUnoTunnelId > {};
-}
-
-const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() throw()
-{
- return theSvxUnoTextBaseUnoTunnelId::get().getSeq();
-}
-
-SvxUnoTextBase* SvxUnoTextBase::getImplementation( const uno::Reference< uno::XInterface >& xInt )
-{
- uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
- if( xUT.is() )
- return reinterpret_cast<SvxUnoTextBase*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxUnoTextBase::getUnoTunnelId())));
- else
- return NULL;
-}
-
-sal_Int64 SAL_CALL SvxUnoTextBase::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) \
-{
- if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
- rId.getConstArray(), 16 ) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
- }
- else
- {
- return SvxUnoTextRangeBase::getSomething( rId );
- }
-}
-
-// --------------------------------------------------------------------
-
-SvxUnoText::SvxUnoText( ) throw()
-{
-}
-
-SvxUnoText::SvxUnoText( const SvxItemPropertySet* _pSet ) throw()
-: SvxUnoTextBase( _pSet )
-{
-}
-
-SvxUnoText::SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, uno::Reference < text::XText > xParent ) throw()
-: SvxUnoTextBase( pSource, _pSet, xParent )
-{
-}
-
-SvxUnoText::SvxUnoText( const SvxUnoText& rText ) throw()
-: SvxUnoTextBase( rText )
-, cppu::OWeakAggObject()
-{
-}
-
-SvxUnoText::~SvxUnoText() throw()
-{
-}
-
-uno::Sequence< uno::Type > SAL_CALL getStaticTypes() throw()
-{
- return SvxUnoTextBase::getStaticTypes();
-}
-
-// uno::XInterface
-uno::Any SAL_CALL SvxUnoText::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException )
-{
- uno::Any aAny( SvxUnoTextBase::queryAggregation( rType ) );
- if( !aAny.hasValue() )
- aAny = OWeakAggObject::queryAggregation( rType );
-
- return aAny;
-}
-
-uno::Any SAL_CALL SvxUnoText::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException )
-{
- return OWeakAggObject::queryInterface( rType );
-}
-
-void SAL_CALL SvxUnoText::acquire() throw( )
-{
- OWeakAggObject::acquire();
-}
-
-void SAL_CALL SvxUnoText::release() throw( )
-{
- OWeakAggObject::release();
-}
-
-// lang::XTypeProvider
-uno::Sequence< uno::Type > SAL_CALL SvxUnoText::getTypes( ) throw( uno::RuntimeException )
-{
- return SvxUnoTextBase::getTypes();
-}
-
-namespace
-{
- class theSvxUnoTextImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextImplementationId > {};
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoText::getImplementationId( ) throw( uno::RuntimeException )
-{
- return theSvxUnoTextImplementationId::get().getSeq();
-}
-
-SvxUnoText* SvxUnoText::getImplementation( const uno::Reference< uno::XInterface >& xInt )
-{
- uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
- if( xUT.is() )
- return reinterpret_cast<SvxUnoText*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxUnoText::getUnoTunnelId())));
- else
- return NULL;
-}
-
-namespace
-{
- class theSvxUnoTextUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextUnoTunnelId > {};
-}
-
-const uno::Sequence< sal_Int8 > & SvxUnoText::getUnoTunnelId() throw()
-{
- return theSvxUnoTextUnoTunnelId::get().getSeq();
-}
-
-sal_Int64 SAL_CALL SvxUnoText::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) \
-{
- if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
- rId.getConstArray(), 16 ) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
- }
- else
- {
- return SvxUnoTextBase::getSomething( rId );
- }
-}
-
-
-// --------------------------------------------------------------------
-
-SvxDummyTextSource::~SvxDummyTextSource()
-{
-};
-
-SvxEditSource* SvxDummyTextSource::Clone() const
-{
- return new SvxDummyTextSource();
-}
-
-SvxTextForwarder* SvxDummyTextSource::GetTextForwarder()
-{
- return this;
-}
-
-void SvxDummyTextSource::UpdateData()
-{
-}
-
-sal_uInt16 SvxDummyTextSource::GetParagraphCount() const
-{
- return 0;
-}
-
-sal_uInt16 SvxDummyTextSource::GetTextLen( sal_uInt16 ) const
-{
- return 0;
-}
-
-String SvxDummyTextSource::GetText( const ESelection& ) const
-{
- return String();
-}
-
-SfxItemSet SvxDummyTextSource::GetAttribs( const ESelection&, sal_Bool ) const
-{
- // 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());
-}
-
-SfxItemSet SvxDummyTextSource::GetParaAttribs( sal_uInt16 ) const
-{
- return GetAttribs(ESelection());
-}
-
-void SvxDummyTextSource::SetParaAttribs( sal_uInt16, const SfxItemSet& )
-{
-}
-
-void SvxDummyTextSource::RemoveAttribs( const ESelection& , sal_Bool , sal_uInt16 )
-{
-}
-
-void SvxDummyTextSource::GetPortions( sal_uInt16, SvUShorts& ) const
-{
-}
-
-sal_uInt16 SvxDummyTextSource::GetItemState( const ESelection&, sal_uInt16 ) const
-{
- return 0;
-}
-
-sal_uInt16 SvxDummyTextSource::GetItemState( sal_uInt16, sal_uInt16 ) const
-{
- return 0;
-}
-
-SfxItemPool* SvxDummyTextSource::GetPool() const
-{
- return NULL;
-}
-
-void SvxDummyTextSource::QuickInsertText( const String&, const ESelection& )
-{
-}
-
-void SvxDummyTextSource::QuickInsertField( const SvxFieldItem&, const ESelection& )
-{
-}
-
-void SvxDummyTextSource::QuickSetAttribs( const SfxItemSet&, const ESelection& )
-{
-}
-
-void SvxDummyTextSource::QuickInsertLineBreak( const ESelection& )
-{
-};
-
-XubString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_uInt16, sal_uInt16, Color*&, Color*& )
-{
- return XubString();
-}
-
-void SvxDummyTextSource::FieldClicked( const SvxFieldItem&, sal_uInt16, xub_StrLen )
-{
-}
-
-sal_Bool SvxDummyTextSource::IsValid() const
-{
- return sal_False;
-}
-
-void SvxDummyTextSource::SetNotifyHdl( const Link& )
-{
-}
-
-LanguageType SvxDummyTextSource::GetLanguage( sal_uInt16, sal_uInt16 ) const
-{
- return LANGUAGE_DONTKNOW;
-}
-
-sal_uInt16 SvxDummyTextSource::GetFieldCount( sal_uInt16 ) const
-{
- return 0;
-}
-
-EFieldInfo SvxDummyTextSource::GetFieldInfo( sal_uInt16, sal_uInt16 ) const
-{
- return EFieldInfo();
-}
-
-EBulletInfo SvxDummyTextSource::GetBulletInfo( sal_uInt16 ) const
-{
- return EBulletInfo();
-}
-
-Rectangle SvxDummyTextSource::GetCharBounds( sal_uInt16, sal_uInt16 ) const
-{
- return Rectangle();
-}
-
-Rectangle SvxDummyTextSource::GetParaBounds( sal_uInt16 ) const
-{
- return Rectangle();
-}
-
-MapMode SvxDummyTextSource::GetMapMode() const
-{
- return MapMode();
-}
-
-OutputDevice* SvxDummyTextSource::GetRefDevice() const
-{
- return NULL;
-}
-
-sal_Bool SvxDummyTextSource::GetIndexAtPoint( const Point&, sal_uInt16&, sal_uInt16& ) const
-{
- return sal_False;
-}
-
-sal_Bool SvxDummyTextSource::GetWordIndices( sal_uInt16, sal_uInt16, sal_uInt16&, sal_uInt16& ) const
-{
- return sal_False;
-}
-
-sal_Bool SvxDummyTextSource::GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16 ) const
-{
- return sal_False;
-}
-
-sal_uInt16 SvxDummyTextSource::GetLineCount( sal_uInt16 ) const
-{
- return 0;
-}
-
-sal_uInt16 SvxDummyTextSource::GetLineLen( sal_uInt16, sal_uInt16 ) const
-{
- return 0;
-}
-
-void SvxDummyTextSource::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 /*nParagraph*/, sal_uInt16 /*nLine*/ ) const
-{
- rStart = rEnd = 0;
-}
-
-sal_uInt16 SvxDummyTextSource::GetLineNumberAtIndex( sal_uInt16 /*nPara*/, sal_uInt16 /*nIndex*/ ) const
-{
- return 0;
-}
-
-sal_Bool SvxDummyTextSource::QuickFormatDoc( sal_Bool )
-{
- return sal_False;
-}
-
-sal_Int16 SvxDummyTextSource::GetDepth( sal_uInt16 ) const
-{
- return -1;
-}
-
-sal_Bool SvxDummyTextSource::SetDepth( sal_uInt16, sal_Int16 nNewDepth )
-{
- return nNewDepth == 0 ? sal_True : sal_False;
-}
-
-sal_Bool SvxDummyTextSource::Delete( const ESelection& )
-{
- return sal_False;
-}
-
-sal_Bool SvxDummyTextSource::InsertText( const String&, const ESelection& )
-{
- return sal_False;
-}
-
-const SfxItemSet * SvxDummyTextSource::GetEmptyItemSetPtr()
-{
- return 0;
-}
-
-void SvxDummyTextSource::AppendParagraph()
-{
-}
-
-xub_StrLen SvxDummyTextSource::AppendTextPortion( sal_uInt16, const String &, const SfxItemSet & )
-{
- return 0;
-}
-
-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
deleted file mode 100644
index 7c2d59827c..0000000000
--- a/editeng/source/uno/unotext2.cxx
+++ /dev/null
@@ -1,731 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <vcl/svapp.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/instance.hxx>
-
-#define _SVSTDARR_sal_uIt16S
-#include <svl/svstdarr.hxx>
-
-#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 ::cppu;
-using namespace ::com::sun::star;
-
-#define QUERYINT( xint ) \
- if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
- return uno::makeAny(uno::Reference< xint >(this))
-
-// ====================================================================
-// SvxUnoTextContentEnumeration
-// ====================================================================
-
-SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText ) throw()
-: mrText( _rText )
-{
- mxParentText = const_cast<SvxUnoTextBase*>(&_rText);
- if( mrText.GetEditSource() )
- mpEditSource = mrText.GetEditSource()->Clone();
- else
- mpEditSource = NULL;
- mnNextParagraph = 0;
-}
-
-SvxUnoTextContentEnumeration::~SvxUnoTextContentEnumeration() throw()
-{
- delete mpEditSource;
-}
-
-// container::XEnumeration
-sal_Bool SAL_CALL SvxUnoTextContentEnumeration::hasMoreElements(void)
- throw( uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
- if( mpEditSource && mpEditSource->GetTextForwarder() )
- return mnNextParagraph < mpEditSource->GetTextForwarder()->GetParagraphCount();
- else
- return sal_False;
-}
-
-uno::Any SvxUnoTextContentEnumeration::nextElement(void) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- if(!hasMoreElements())
- throw container::NoSuchElementException();
-
- SvxUnoTextContent* pContent = 0;
-
- const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
- SvxUnoTextRangeBaseList::const_iterator aIter;
- for( aIter = rRanges.begin(); (aIter != rRanges.end()) && (pContent == 0); ++aIter )
- {
- SvxUnoTextContent* pIterContent = dynamic_cast< SvxUnoTextContent* >( (*aIter ) );
- if( pIterContent && (pIterContent->mnParagraph == mnNextParagraph) )
- pContent = pIterContent;
- }
-
- if( pContent == 0 )
- pContent = new SvxUnoTextContent( mrText, mnNextParagraph );
-
- mnNextParagraph++;
-
- uno::Reference< text::XTextContent > xRef( pContent );
- return uno::makeAny( xRef );
-}
-
-// ====================================================================
-// class SvxUnoTextContent
-// ====================================================================
-uno::Reference< text::XText > xDummyText;
-
-static SvxUnoText* getDummyText() throw()
-{
- if(!xDummyText.is())
- xDummyText = new SvxUnoText();
-
- return SvxUnoText::getImplementation( xDummyText );
-}
-
-SvxUnoTextContent::SvxUnoTextContent() throw()
-: SvxUnoTextRangeBase(*getDummyText())
-, mnParagraph(0)
-, mrParentText(*getDummyText())
-, maDisposeListeners(maDisposeContainerMutex)
-, mbDisposing( false )
-{
-}
-
-SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw()
-: SvxUnoTextRangeBase(rText)
-, mnParagraph(nPara)
-, mrParentText(rText)
-, maDisposeListeners(maDisposeContainerMutex)
-, mbDisposing( false )
-{
- mxParentText = const_cast<SvxUnoTextBase*>(&rText);
- if( GetEditSource() && GetEditSource()->GetTextForwarder() )
- SetSelection( ESelection( mnParagraph,0, mnParagraph, GetEditSource()->GetTextForwarder()->GetTextLen( mnParagraph ) ) );
-}
-
-SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw()
-: SvxUnoTextRangeBase(rContent)
-, text::XTextContent()
-, container::XEnumerationAccess()
-, lang::XTypeProvider()
-, cppu::OWeakAggObject()
-, mrParentText(rContent.mrParentText)
-, maDisposeListeners(maDisposeContainerMutex)
-, mbDisposing( false )
-{
- mxParentText = rContent.mxParentText;
- mnParagraph = rContent.mnParagraph;
- SetSelection( rContent.GetSelection() );
-}
-
-SvxUnoTextContent::~SvxUnoTextContent() throw()
-{
-}
-
-// uno::XInterface
-uno::Any SAL_CALL SvxUnoTextContent::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException )
-{
- QUERYINT( text::XTextRange );
- else QUERYINT( beans::XMultiPropertyStates );
- else QUERYINT( beans::XPropertySet );
- else QUERYINT( beans::XMultiPropertySet );
- else QUERYINT( beans::XPropertyState );
- else QUERYINT( text::XTextContent );
- else QUERYINT( text::XTextRangeCompare );
- else QUERYINT( lang::XComponent );
- else QUERYINT( container::XEnumerationAccess );
- else QUERYINT( container::XElementAccess );
- else QUERYINT( lang::XServiceInfo );
- else QUERYINT( lang::XTypeProvider );
- else QUERYINT( lang::XUnoTunnel );
- else
- return OWeakAggObject::queryAggregation( rType );
-}
-
-uno::Any SAL_CALL SvxUnoTextContent::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException )
-{
- return OWeakAggObject::queryInterface(rType);
-}
-
-void SAL_CALL SvxUnoTextContent::acquire() throw( )
-{
- OWeakAggObject::acquire();
-}
-
-void SAL_CALL SvxUnoTextContent::release() throw( )
-{
- OWeakAggObject::release();
-}
-
-// 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)
-{
- return theSvxUnoTextContentTypes::get();
-}
-
-namespace
-{
- class theSvxUnoTextContentImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextContentImplementationId > {};
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextContent::getImplementationId()
- throw (uno::RuntimeException)
-{
- return theSvxUnoTextContentImplementationId::get().getSeq();
-}
-
-// text::XTextRange
-
-uno::Reference< text::XText > SAL_CALL SvxUnoTextContent::getText()
- throw(uno::RuntimeException)
-{
- return mxParentText;
-}
-
-// text::XTextContent
-void SAL_CALL SvxUnoTextContent::attach( const uno::Reference< text::XTextRange >& )
- throw(lang::IllegalArgumentException, uno::RuntimeException)
-{
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextContent::getAnchor() throw( uno::RuntimeException )
-{
- return uno::Reference< text::XTextRange >::query( mxParentText );
-}
-
-// XComponent
-
-void SAL_CALL SvxUnoTextContent::dispose()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if( mbDisposing )
- return; // catched a recursion
-
- mbDisposing = true;
-
- lang::EventObject aEvt;
- aEvt.Source = *(OWeakAggObject*) this;
- maDisposeListeners.disposeAndClear(aEvt);
-
- if( mxParentText.is() )
- mxParentText->removeTextContent( this );
-}
-
-void SAL_CALL SvxUnoTextContent::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw(uno::RuntimeException)
-{
- maDisposeListeners.addInterface(xListener);
-}
-
-void SAL_CALL SvxUnoTextContent::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
- throw(uno::RuntimeException)
-{
- maDisposeListeners.removeInterface(aListener);
-}
-
-// XEnumerationAccess
-
-uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextContent::createEnumeration( )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- return new SvxUnoTextRangeEnumeration( mrParentText, mnParagraph );
-}
-
-// XElementAccess ( container::XEnumerationAccess )
-
-uno::Type SAL_CALL SvxUnoTextContent::getElementType()
- throw(uno::RuntimeException)
-{
- return ::getCppuType((const uno::Reference< text::XTextRange >*)0);
-}
-
-sal_Bool SAL_CALL SvxUnoTextContent::hasElements()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- SvUShorts aPortions;
- pForwarder->GetPortions( mnParagraph, aPortions );
- return aPortions.Count() > 0;
- }
- else
- {
- return 0;
- }
-}
-
-// XPropertySet
-
-void SAL_CALL SvxUnoTextContent::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
- throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- _setPropertyValue( aPropertyName, aValue, mnParagraph );
-}
-
-uno::Any SAL_CALL SvxUnoTextContent::getPropertyValue( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return _getPropertyValue( PropertyName, mnParagraph );
-}
-
-// XMultiPropertySet
-void SAL_CALL SvxUnoTextContent::setPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- _setPropertyValues( aPropertyNames, aValues, mnParagraph );
-}
-
-uno::Sequence< uno::Any > SAL_CALL SvxUnoTextContent::getPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (uno::RuntimeException)
-{
- return _getPropertyValues( aPropertyNames, mnParagraph );
-}
-
-/*// XTolerantMultiPropertySet
-uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SvxUnoTextContent::setPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (lang::IllegalArgumentException, uno::RuntimeException)
-{
- return _setPropertyValuesTolerant(aPropertyNames, aValues, mnParagraph);
-}
-
-uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL SvxUnoTextContent::getPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (uno::RuntimeException)
-{
- return _getPropertyValuesTolerant(aPropertyNames, mnParagraph);
-}
-
-uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SvxUnoTextContent::getDirectPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames )
- throw (uno::RuntimeException)
-{
- return _getDirectPropertyValuesTolerant(aPropertyNames, mnParagraph);
-}*/
-
-// beans::XPropertyState
-beans::PropertyState SAL_CALL SvxUnoTextContent::getPropertyState( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- return _getPropertyState( PropertyName, mnParagraph );
-}
-
-uno::Sequence< beans::PropertyState > SAL_CALL SvxUnoTextContent::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- return _getPropertyStates( aPropertyName, mnParagraph );
-}
-
-void SAL_CALL SvxUnoTextContent::setPropertyToDefault( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- _setPropertyToDefault( PropertyName, mnParagraph );
-}
-
-// lang::XServiceInfo
-
-OUString SAL_CALL SvxUnoTextContent::getImplementationName()
- throw(uno::RuntimeException)
-{
- return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextContent") );
-}
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextContent::getSupportedServiceNames()
- throw(uno::RuntimeException)
-{
- uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, 5, "com.sun.star.style.ParagraphProperties",
- "com.sun.star.style.ParagraphPropertiesComplex",
- "com.sun.star.style.ParagraphPropertiesAsian",
- "com.sun.star.text.TextContent",
- "com.sun.star.text.Paragraph");
- return aSeq;
-}
-
-// ====================================================================
-// class SvxUnoTextRangeEnumeration
-// ====================================================================
-
-SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw()
-: mxParentText( const_cast<SvxUnoTextBase*>(&rText) ),
- mrParentText( rText ),
- mnParagraph( nPara ),
- mnNextPortion( 0 )
-{
- mpEditSource = rText.GetEditSource() ? rText.GetEditSource()->Clone() : NULL;
-
- if( mpEditSource && mpEditSource->GetTextForwarder() )
- {
- mpPortions = new SvUShorts;
- mpEditSource->GetTextForwarder()->GetPortions( nPara, *mpPortions );
- }
- else
- {
- mpPortions = NULL;
- }
-}
-
-SvxUnoTextRangeEnumeration::~SvxUnoTextRangeEnumeration() throw()
-{
- delete mpEditSource;
- delete mpPortions;
-}
-
-// container::XEnumeration
-
-sal_Bool SAL_CALL SvxUnoTextRangeEnumeration::hasMoreElements()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- return mpPortions && mnNextPortion < mpPortions->Count();
-}
-
-uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement()
- throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if( mpPortions == NULL || mnNextPortion >= mpPortions->Count() )
- throw container::NoSuchElementException();
-
- sal_uInt16 nStartPos = 0;
- if (mnNextPortion > 0)
- nStartPos = mpPortions->GetObject(mnNextPortion-1);
- sal_uInt16 nEndPos = mpPortions->GetObject(mnNextPortion);
- ESelection aSel( mnParagraph, nStartPos, mnParagraph, nEndPos );
-
- uno::Reference< text::XTextRange > xRange;
-
- const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
-
- SvxUnoTextRange* pRange = 0;
-
- SvxUnoTextRangeBaseList::const_iterator 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 ) ) )
- pRange = pIterRange;
- }
-
- if( pRange == 0 )
- {
- pRange = new SvxUnoTextRange( mrParentText, sal_True );
- pRange->SetSelection(aSel);
- }
-
- xRange = pRange;
-
- mnNextPortion++;
-
- return uno::makeAny( xRange );
-}
-
-// ====================================================================
-// class SvxUnoTextCursor
-// ====================================================================
-
-uno::Reference< uno::XInterface > SvxUnoTextCursor_NewInstance()
-{
- SvxUnoText aText;
- uno::Reference< text::XText > xText( (text::XText*)new SvxUnoTextCursor( aText ) );
- uno::Reference< uno::XInterface > xInt( xText, uno::UNO_QUERY );
- return xInt;
-}
-
-SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw()
-: SvxUnoTextRangeBase(rText),
- mxParentText( const_cast<SvxUnoTextBase*>(&rText) )
-{
-}
-
-SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw()
-: SvxUnoTextRangeBase(rCursor)
-, text::XTextCursor()
-, lang::XTypeProvider()
-, cppu::OWeakAggObject()
-, mxParentText(rCursor.mxParentText)
-{
-}
-
-SvxUnoTextCursor::~SvxUnoTextCursor() throw()
-{
-}
-
-// 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)
-{
- if( rType == ::getCppuType((const uno::Reference< text::XTextRange >*)0) )
- return uno::makeAny(uno::Reference< text::XTextRange >((text::XText*)(this)));
- else QUERYINT( text::XTextCursor );
- else QUERYINT( beans::XMultiPropertyStates );
- else QUERYINT( beans::XPropertySet );
- else QUERYINT( beans::XMultiPropertySet );
- else QUERYINT( beans::XPropertyState );
- else QUERYINT( text::XTextRangeCompare );
- else QUERYINT( lang::XServiceInfo );
- else QUERYINT( lang::XTypeProvider );
- else QUERYINT( lang::XUnoTunnel );
- else
- return OWeakAggObject::queryAggregation( rType );
-}
-
-uno::Any SAL_CALL SvxUnoTextCursor::queryInterface( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- return OWeakAggObject::queryInterface(rType);
-}
-
-void SAL_CALL SvxUnoTextCursor::acquire() throw ( )
-{
- OWeakAggObject::acquire();
-}
-
-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)
-{
- return theSvxUnoTextCursorTypes::get();
-}
-
-namespace
-{
- class theSvxUnoTextCursorImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextCursorImplementationId > {};
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextCursor::getImplementationId()
- throw (uno::RuntimeException)
-{
- return theSvxUnoTextCursorImplementationId::get().getSeq();
-}
-
-// text::XTextCursor
-void SAL_CALL SvxUnoTextCursor::collapseToStart()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- CollapseToStart();
-}
-
-void SAL_CALL SvxUnoTextCursor::collapseToEnd()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- CollapseToEnd();
-}
-
-sal_Bool SAL_CALL SvxUnoTextCursor::isCollapsed()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return IsCollapsed();
-}
-
-sal_Bool SAL_CALL SvxUnoTextCursor::goLeft( sal_Int16 nCount, sal_Bool bExpand )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return GoLeft( nCount, bExpand );
-}
-
-sal_Bool SAL_CALL SvxUnoTextCursor::goRight( sal_Int16 nCount, sal_Bool bExpand )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return GoRight( nCount, bExpand );
-}
-
-void SAL_CALL SvxUnoTextCursor::gotoStart( sal_Bool bExpand )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GotoStart( bExpand );
-}
-
-void SAL_CALL SvxUnoTextCursor::gotoEnd( sal_Bool bExpand )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GotoEnd( bExpand );
-}
-
-void SAL_CALL SvxUnoTextCursor::gotoRange( const uno::Reference< text::XTextRange >& xRange, sal_Bool bExpand )
- throw(uno::RuntimeException)
-{
- if( !xRange.is() )
- return;
-
- SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( xRange );
-
- if( pRange )
- {
- ESelection aNewSel = pRange->GetSelection();
-
- if( bExpand )
- {
- const ESelection& rOldSel = GetSelection();
- aNewSel.nStartPara = rOldSel.nStartPara;
- aNewSel.nStartPos = rOldSel.nStartPos;
- }
-
- SetSelection( aNewSel );
- }
-}
-
-// text::XTextRange (rest in SvxTextRange)
-uno::Reference< text::XText > SAL_CALL SvxUnoTextCursor::getText(void) throw( uno::RuntimeException )
-{
- return mxParentText;
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextCursor::getStart()
- throw(uno::RuntimeException)
-{
- return SvxUnoTextRangeBase::getStart();
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextCursor::getEnd()
- throw(uno::RuntimeException)
-{
- return SvxUnoTextRangeBase::getEnd();
-}
-
-OUString SAL_CALL SvxUnoTextCursor::getString() throw( uno::RuntimeException )
-{
- return SvxUnoTextRangeBase::getString();
-}
-
-void SAL_CALL SvxUnoTextCursor::setString( const OUString& aString ) throw(uno::RuntimeException)
-{
- SvxUnoTextRangeBase::setString(aString);
-}
-// lang::XServiceInfo
-OUString SAL_CALL SvxUnoTextCursor::getImplementationName() throw(uno::RuntimeException)
-{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextCursor"));
-}
-
-sal_Bool SAL_CALL SvxUnoTextCursor::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
-{
- return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
-}
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextCursor::getSupportedServiceNames() throw(uno::RuntimeException)
-{
- uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, 4,"com.sun.star.style.ParagraphProperties",
- "com.sun.star.style.ParagraphPropertiesComplex",
- "com.sun.star.style.ParagraphPropertiesAsian",
- "com.sun.star.text.TextCursor");
- return aSeq;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/uno/unoviwed.cxx b/editeng/source/uno/unoviwed.cxx
deleted file mode 100644
index 161f9bc070..0000000000
--- a/editeng/source/uno/unoviwed.cxx
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <vcl/outdev.hxx>
-#include <vcl/window.hxx>
-
-#include <editeng/unoviwed.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/editeng.hxx>
-
-SvxEditEngineViewForwarder::SvxEditEngineViewForwarder( EditView& rView ) :
- mrView( rView )
-{
-}
-
-SvxEditEngineViewForwarder::~SvxEditEngineViewForwarder()
-{
-}
-
-sal_Bool SvxEditEngineViewForwarder::IsValid() const
-{
- return sal_True;
-}
-
-Rectangle SvxEditEngineViewForwarder::GetVisArea() const
-{
- OutputDevice* pOutDev = mrView.GetWindow();
-
- if( pOutDev )
- {
- Rectangle aVisArea = mrView.GetVisArea();
-
- // figure out map mode from edit engine
- EditEngine* pEditEngine = mrView.GetEditEngine();
-
- if( pEditEngine )
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- aVisArea = OutputDevice::LogicToLogic( aVisArea,
- pEditEngine->GetRefMapMode(),
- aMapMode.GetMapUnit() );
- aMapMode.SetOrigin(Point());
- return pOutDev->LogicToPixel( aVisArea, aMapMode );
- }
- }
-
- return Rectangle();
-}
-
-Point SvxEditEngineViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
-{
- OutputDevice* pOutDev = mrView.GetWindow();
-
- if( pOutDev )
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- Point aPoint( OutputDevice::LogicToLogic( rPoint, rMapMode,
- aMapMode.GetMapUnit() ) );
- aMapMode.SetOrigin(Point());
- return pOutDev->LogicToPixel( aPoint, aMapMode );
- }
-
- return Point();
-}
-
-Point SvxEditEngineViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
-{
- OutputDevice* pOutDev = mrView.GetWindow();
-
- if( pOutDev )
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- aMapMode.SetOrigin(Point());
- Point aPoint( pOutDev->PixelToLogic( rPoint, aMapMode ) );
- return OutputDevice::LogicToLogic( aPoint,
- aMapMode.GetMapUnit(),
- rMapMode );
- }
-
- return Point();
-}
-
-sal_Bool SvxEditEngineViewForwarder::GetSelection( ESelection& rSelection ) const
-{
- rSelection = mrView.GetSelection();
- return sal_True;
-}
-
-sal_Bool SvxEditEngineViewForwarder::SetSelection( const ESelection& rSelection )
-{
- mrView.SetSelection( rSelection );
- return sal_True;
-}
-
-sal_Bool SvxEditEngineViewForwarder::Copy()
-{
- mrView.Copy();
- return sal_True;
-}
-
-sal_Bool SvxEditEngineViewForwarder::Cut()
-{
- mrView.Cut();
- return sal_True;
-}
-
-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
deleted file mode 100644
index 0f5e2305a6..0000000000
--- a/editeng/source/uno/unoviwou.cxx
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <vcl/outdev.hxx>
-#include <vcl/window.hxx>
-
-#include <editeng/unoviwou.hxx>
-#include <editeng/outliner.hxx>
-#include <editeng/editeng.hxx>
-
-SvxDrawOutlinerViewForwarder::SvxDrawOutlinerViewForwarder( OutlinerView& rOutl ) :
- mrOutlinerView ( rOutl ), maTextShapeTopLeft()
-{
-}
-
-SvxDrawOutlinerViewForwarder::SvxDrawOutlinerViewForwarder( OutlinerView& rOutl, const Point& rShapePosTopLeft ) :
- mrOutlinerView ( rOutl ), maTextShapeTopLeft( rShapePosTopLeft )
-{
-}
-
-SvxDrawOutlinerViewForwarder::~SvxDrawOutlinerViewForwarder()
-{
-}
-
-Point SvxDrawOutlinerViewForwarder::GetTextOffset() const
-{
- // calc text offset from shape anchor
- Rectangle aOutputRect( mrOutlinerView.GetOutputArea() );
-
- return aOutputRect.TopLeft() - maTextShapeTopLeft;
-}
-
-sal_Bool SvxDrawOutlinerViewForwarder::IsValid() const
-{
- return sal_True;
-}
-
-Rectangle SvxDrawOutlinerViewForwarder::GetVisArea() const
-{
- OutputDevice* pOutDev = mrOutlinerView.GetWindow();
-
- if( pOutDev )
- {
- Rectangle aVisArea = mrOutlinerView.GetVisArea();
-
- Point aTextOffset( GetTextOffset() );
- aVisArea.Move( aTextOffset.X(), aTextOffset.Y() );
-
- // figure out map mode from edit engine
- Outliner* pOutliner = mrOutlinerView.GetOutliner();
-
- if( pOutliner )
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- aVisArea = OutputDevice::LogicToLogic( aVisArea,
- pOutliner->GetRefMapMode(),
- aMapMode.GetMapUnit() );
- aMapMode.SetOrigin(Point());
- return pOutDev->LogicToPixel( aVisArea, aMapMode );
- }
- }
-
- return Rectangle();
-}
-
-Point SvxDrawOutlinerViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
-{
- OutputDevice* pOutDev = mrOutlinerView.GetWindow();
-
- if( pOutDev )
- {
- Point aPoint1( rPoint );
- Point aTextOffset( GetTextOffset() );
-
- aPoint1.X() += aTextOffset.X();
- aPoint1.Y() += aTextOffset.Y();
-
- MapMode aMapMode(pOutDev->GetMapMode());
- Point aPoint2( OutputDevice::LogicToLogic( aPoint1, rMapMode,
- aMapMode.GetMapUnit() ) );
- aMapMode.SetOrigin(Point());
- return pOutDev->LogicToPixel( aPoint2, aMapMode );
- }
-
- return Point();
-}
-
-Point SvxDrawOutlinerViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
-{
- OutputDevice* pOutDev = mrOutlinerView.GetWindow();
-
- if( pOutDev )
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- aMapMode.SetOrigin(Point());
- Point aPoint1( pOutDev->PixelToLogic( rPoint, aMapMode ) );
- Point aPoint2( OutputDevice::LogicToLogic( aPoint1,
- aMapMode.GetMapUnit(),
- rMapMode ) );
- Point aTextOffset( GetTextOffset() );
-
- aPoint2.X() -= aTextOffset.X();
- aPoint2.Y() -= aTextOffset.Y();
-
- return aPoint2;
- }
-
- return Point();
-}
-
-sal_Bool SvxDrawOutlinerViewForwarder::GetSelection( ESelection& rSelection ) const
-{
- rSelection = mrOutlinerView.GetSelection();
- return sal_True;
-}
-
-sal_Bool SvxDrawOutlinerViewForwarder::SetSelection( const ESelection& rSelection )
-{
- mrOutlinerView.SetSelection( rSelection );
- return sal_True;
-}
-
-sal_Bool SvxDrawOutlinerViewForwarder::Copy()
-{
- mrOutlinerView.Copy();
- return sal_True;
-}
-
-sal_Bool SvxDrawOutlinerViewForwarder::Cut()
-{
- mrOutlinerView.Cut();
- return sal_True;
-}
-
-sal_Bool SvxDrawOutlinerViewForwarder::Paste()
-{
- mrOutlinerView.Paste();
- return sal_True;
-}
-
-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
deleted file mode 100644
index e412e99d64..0000000000
--- a/editeng/source/xml/editsource.hxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_EDITSOURCE_HXX
-#define _SVX_EDITSOURCE_HXX
-
-#include <editeng/unoedsrc.hxx>
-
-class EditEngine;
-class SvxEditEngineSourceImpl;
-
-class SvxEditEngineSource : public SvxEditSource
-{
-public:
- SvxEditEngineSource( EditEngine* pEditEngine );
- virtual ~SvxEditEngineSource();
-
- virtual SvxEditSource* Clone() const;
- virtual SvxTextForwarder* GetTextForwarder();
- virtual void UpdateData();
-
-private:
- SvxEditEngineSource( SvxEditEngineSourceImpl* pImpl );
-
- SvxEditEngineSourceImpl* mpImpl;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx
deleted file mode 100644
index 4a428c98a6..0000000000
--- a/editeng/source/xml/xmltxtexp.cxx
+++ /dev/null
@@ -1,500 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-
-/** this file implements an export of a selected EditEngine content into
- a xml stream. See editeng/source/inc/xmledit.hxx for interface */
-#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
-#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <tools/debug.hxx>
-#include <svl/itemprop.hxx>
-#include <svl/brdcst.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <sot/storage.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <xmloff/xmluconv.hxx>
-#include <xmloff/xmlnmspe.hxx>
-#include <xmloff/nmspmap.hxx>
-#include <xmloff/xmlmetae.hxx>
-#include <cppuhelper/implbase4.hxx>
-#include <comphelper/processfactory.hxx>
-#include <unotools/streamwrap.hxx>
-#include <xmloff/xmlexp.hxx>
-#include <editeng/unoedsrc.hxx>
-#include <editeng/unofored.hxx>
-#include <editeng/unotext.hxx>
-#include <editeng/unoprnms.hxx>
-#include <editeng/unofield.hxx>
-#include <editeng/editeng.hxx>
-#include "editsource.hxx"
-#include <editeng/unonrule.hxx>
-#include <editeng/unoipset.hxx>
-
-using namespace com::sun::star;
-using namespace com::sun::star::container;
-using namespace com::sun::star::document;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::awt;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::xml::sax;
-using namespace ::rtl;
-using namespace cppu;
-
-///////////////////////////////////////////////////////////////////////
-
-class SvxEditEngineSourceImpl;
-
-///////////////////////////////////////////////////////////////////////
-
-class SvxEditEngineSourceImpl
-{
-private:
- oslInterlockedCount maRefCount;
-
- EditEngine* mpEditEngine;
- SvxTextForwarder* mpTextForwarder;
-
- ~SvxEditEngineSourceImpl();
-
-public:
- SvxEditEngineSourceImpl( EditEngine* pEditEngine );
-
- void SAL_CALL acquire();
- void SAL_CALL release();
-
- SvxTextForwarder* GetTextForwarder();
-};
-
-///////////////////////////////////////////////////////////////////////
-
-
-//------------------------------------------------------------------------
-
-SvxEditEngineSourceImpl::SvxEditEngineSourceImpl( EditEngine* pEditEngine )
-: maRefCount(0),
- mpEditEngine( pEditEngine ),
- mpTextForwarder(NULL)
-{
-}
-
-//------------------------------------------------------------------------
-
-SvxEditEngineSourceImpl::~SvxEditEngineSourceImpl()
-{
- delete mpTextForwarder;
-}
-
-//------------------------------------------------------------------------
-
-void SAL_CALL SvxEditEngineSourceImpl::acquire()
-{
- osl_incrementInterlockedCount( &maRefCount );
-}
-
-//------------------------------------------------------------------------
-
-void SAL_CALL SvxEditEngineSourceImpl::release()
-{
- if( ! osl_decrementInterlockedCount( &maRefCount ) )
- delete this;
-}
-
-//------------------------------------------------------------------------
-
-SvxTextForwarder* SvxEditEngineSourceImpl::GetTextForwarder()
-{
- if (!mpTextForwarder)
- mpTextForwarder = new SvxEditEngineForwarder( *mpEditEngine );
-
- return mpTextForwarder;
-}
-
-// --------------------------------------------------------------------
-// SvxTextEditSource
-// --------------------------------------------------------------------
-
-SvxEditEngineSource::SvxEditEngineSource( EditEngine* pEditEngine )
-{
- mpImpl = new SvxEditEngineSourceImpl( pEditEngine );
- mpImpl->acquire();
-}
-
-// --------------------------------------------------------------------
-
-SvxEditEngineSource::SvxEditEngineSource( SvxEditEngineSourceImpl* pImpl )
-{
- mpImpl = pImpl;
- mpImpl->acquire();
-}
-
-//------------------------------------------------------------------------
-
-SvxEditEngineSource::~SvxEditEngineSource()
-{
- mpImpl->release();
-}
-
-//------------------------------------------------------------------------
-
-SvxEditSource* SvxEditEngineSource::Clone() const
-{
- return new SvxEditEngineSource( mpImpl );
-}
-
-//------------------------------------------------------------------------
-
-SvxTextForwarder* SvxEditEngineSource::GetTextForwarder()
-{
- return mpImpl->GetTextForwarder();
-}
-
-//------------------------------------------------------------------------
-
-void SvxEditEngineSource::UpdateData()
-{
-}
-
-class SvxSimpleUnoModel : public cppu::WeakAggImplHelper4<
- ::com::sun::star::frame::XModel,
- ::com::sun::star::ucb::XAnyCompareFactory,
- ::com::sun::star::style::XStyleFamiliesSupplier,
- ::com::sun::star::lang::XMultiServiceFactory >
-{
-public:
- SvxSimpleUnoModel();
- virtual ~SvxSimpleUnoModel();
-
-
- // XMultiServiceFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XStyleFamiliesSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getStyleFamilies( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XAnyCompareFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SAL_CALL createAnyCompareByName( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
-
- // XModel
- virtual sal_Bool SAL_CALL attachResource( const ::rtl::OUString& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getURL( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getArgs( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL connectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL disconnectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL lockControllers( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL unlockControllers( ) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasControllersLocked( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > SAL_CALL getCurrentController( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCurrentController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getCurrentSelection( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XComponent
- virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-SvxSimpleUnoModel::SvxSimpleUnoModel()
-{
-}
-
-SvxSimpleUnoModel::~SvxSimpleUnoModel()
-{
-}
-
-// XMultiServiceFactory ( SvxFmMSFactory )
-uno::Reference< uno::XInterface > SAL_CALL SvxSimpleUnoModel::createInstance( const OUString& aServiceSpecifier )
- throw(uno::Exception, uno::RuntimeException)
-{
- if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.NumberingRules" ) ) )
- {
- return uno::Reference< uno::XInterface >(
- SvxCreateNumRule(), uno::UNO_QUERY );
- }
- if ( (0 == aServiceSpecifier.reverseCompareToAsciiL(
- RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.textfield.DateTime")))
- || (0 == aServiceSpecifier.reverseCompareToAsciiL(
- RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime")))
- )
- {
- return (::cppu::OWeakObject * )new SvxUnoTextField( ID_EXT_DATEFIELD );
- }
-
- return SvxUnoTextCreateTextField( aServiceSpecifier );
-
-}
-
-uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxSimpleUnoModel::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
-{
- return createInstance( ServiceSpecifier );
-}
-
-Sequence< ::rtl::OUString > SAL_CALL SvxSimpleUnoModel::getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
-{
- Sequence< OUString > aSeq;
- return aSeq;
-}
-
-// XAnyCompareFactory
-uno::Reference< com::sun::star::ucb::XAnyCompare > SAL_CALL SvxSimpleUnoModel::createAnyCompareByName( const OUString& PropertyName )
- throw(uno::RuntimeException)
-{
- (void)PropertyName;
- return SvxCreateNumRuleCompare();
-}
-
-// XStyleFamiliesSupplier
-uno::Reference< container::XNameAccess > SAL_CALL SvxSimpleUnoModel::getStyleFamilies( )
- throw(uno::RuntimeException)
-{
- uno::Reference< container::XNameAccess > xStyles;
- return xStyles;
-}
-
-// XModel
-sal_Bool SAL_CALL SvxSimpleUnoModel::attachResource( const ::rtl::OUString& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)aURL;
- (void)aArgs;
- return sal_False;
-}
-
-::rtl::OUString SAL_CALL SvxSimpleUnoModel::getURL( ) throw (::com::sun::star::uno::RuntimeException)
-{
- OUString aStr;
- return aStr;
-}
-
-::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL SvxSimpleUnoModel::getArgs( ) throw (::com::sun::star::uno::RuntimeException)
-{
- Sequence< beans::PropertyValue > aSeq;
- return aSeq;
-}
-
-void SAL_CALL SvxSimpleUnoModel::connectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& ) throw (::com::sun::star::uno::RuntimeException)
-{
-}
-
-void SAL_CALL SvxSimpleUnoModel::disconnectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& ) throw (::com::sun::star::uno::RuntimeException)
-{
-}
-
-void SAL_CALL SvxSimpleUnoModel::lockControllers( ) throw (::com::sun::star::uno::RuntimeException)
-{
-}
-
-void SAL_CALL SvxSimpleUnoModel::unlockControllers( ) throw (::com::sun::star::uno::RuntimeException)
-{
-}
-
-sal_Bool SAL_CALL SvxSimpleUnoModel::hasControllersLocked( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return sal_True;
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > SAL_CALL SvxSimpleUnoModel::getCurrentController( ) throw (::com::sun::star::uno::RuntimeException)
-{
- uno::Reference< frame::XController > xRet;
- return xRet;
-}
-
-void SAL_CALL SvxSimpleUnoModel::setCurrentController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException)
-{
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxSimpleUnoModel::getCurrentSelection( ) throw (::com::sun::star::uno::RuntimeException)
-{
- uno::Reference< XInterface > xRet;
- return xRet;
-}
-
-
-// XComponent
-void SAL_CALL SvxSimpleUnoModel::dispose( ) throw (::com::sun::star::uno::RuntimeException)
-{
-}
-
-void SAL_CALL SvxSimpleUnoModel::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& ) throw (::com::sun::star::uno::RuntimeException)
-{
-}
-
-void SAL_CALL SvxSimpleUnoModel::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& ) throw (::com::sun::star::uno::RuntimeException)
-{
-}
-
-///////////////////////////////////////////////////////////////////////
-
-class SvxXMLTextExportComponent : public SvXMLExport
-{
-public:
- SvxXMLTextExportComponent(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- EditEngine* pEditEngine,
- const ESelection& rSel,
- const ::rtl::OUString& rFileName,
- const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > & xHandler );
-
- ~SvxXMLTextExportComponent();
-
- // methods without content:
- virtual void _ExportAutoStyles();
- virtual void _ExportMasterStyles();
- virtual void _ExportContent();
-
-private:
- com::sun::star::uno::Reference< com::sun::star::text::XText > mxText;
- EditEngine* mpEditEngine;
- ESelection maSelection;
-};
-
-///////////////////////////////////////////////////////////////////////
-
-SvxXMLTextExportComponent::SvxXMLTextExportComponent(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- EditEngine* pEditEngine,
- const ESelection& rSel,
- const ::rtl::OUString& rFileName,
- const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > & xHandler)
-: SvXMLExport( xServiceFactory, rFileName, xHandler, ((frame::XModel*)new SvxSimpleUnoModel()), MAP_CM ),
- mpEditEngine( pEditEngine ),
- maSelection( rSel )
-{
- SvxEditEngineSource aEditSource( pEditEngine );
-
- static const SfxItemPropertyMapEntry SvxXMLTextExportComponentPropertyMap[] =
- {
- SVX_UNOEDIT_CHAR_PROPERTIES,
- SVX_UNOEDIT_FONT_PROPERTIES,
-// SVX_UNOEDIT_OUTLINER_PROPERTIES,
- {MAP_CHAR_LEN(UNO_NAME_NUMBERING_RULES), EE_PARA_NUMBULLET, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace>*)0), 0, 0 },
- {MAP_CHAR_LEN(UNO_NAME_NUMBERING), EE_PARA_BULLETSTATE,&::getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(UNO_NAME_NUMBERING_LEVEL), EE_PARA_OUTLLEVEL, &::getCppuType((const sal_Int16*)0), 0, 0 },
- SVX_UNOEDIT_PARA_PROPERTIES,
- {0,0,0,0,0,0}
- };
- static SvxItemPropertySet aSvxXMLTextExportComponentPropertySet( SvxXMLTextExportComponentPropertyMap, EditEngine::GetGlobalItemPool() );
-
- SvxUnoText* pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextExportComponentPropertySet, mxText );
- pUnoText->SetSelection( rSel );
- mxText = pUnoText;
-
- setExportFlags( EXPORT_AUTOSTYLES|EXPORT_CONTENT );
-}
-
-SvxXMLTextExportComponent::~SvxXMLTextExportComponent()
-{
-}
-
-void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel )
-{
- try
- {
- do
- {
- // create service factory
-
- uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
-
- if( !xServiceFactory.is() )
- {
- OSL_FAIL( "got no service manager" );
- break;
- }
-
- // create document handler
-
- uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) );
-
- if( !xWriter.is() )
- {
- OSL_FAIL( "com.sun.star.xml.sax.Writer service missing" );
- break;
- }
-
- uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
-
- // create output stream and active data source
- uno::Reference<io::XOutputStream> xOut( new utl::OOutputStreamWrapper( rStream ) );
-
-/* testcode
- const OUString aURL( RTL_CONSTASCII_USTRINGPARAM( "file:///e:/test.xml" ) );
- SfxMedium aMedium( aURL, STREAM_WRITE | STREAM_TRUNC, sal_True );
- aMedium.IsRemote();
- uno::Reference<io::XOutputStream> xOut( new utl::OOutputStreamWrapper( *aMedium.GetOutStream() ) );
-*/
-
-
- uno::Reference<io::XActiveDataSource> xMetaSrc( xWriter, uno::UNO_QUERY );
- xMetaSrc->setOutputStream( xOut );
-
- // export text
- const OUString aName;
-
- // SvxXMLTextExportComponent aExporter( &rEditEngine, rSel, aName, xHandler );
- SvxXMLTextExportComponent aExporter( xServiceFactory, &rEditEngine, rSel, aName, xHandler );
-
- aExporter.exportDoc();
-
-/* testcode
- aMedium.Commit();
-*/
-
- }
- while( 0 );
- }
- catch( uno::Exception& )
- {
- OSL_FAIL("exception during xml export");
- }
-}
-
-// methods without content:
-void SvxXMLTextExportComponent::_ExportAutoStyles()
-{
- UniReference< XMLTextParagraphExport > xTextExport( GetTextParagraphExport() );
-
- xTextExport->collectTextAutoStyles( mxText );
- xTextExport->exportTextAutoStyles();
-}
-
-void SvxXMLTextExportComponent::_ExportContent()
-{
- UniReference< XMLTextParagraphExport > xTextExport( GetTextParagraphExport() );
-
- xTextExport->exportText( mxText );
-}
-
-void SvxXMLTextExportComponent::_ExportMasterStyles() {}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx
deleted file mode 100644
index dbc293c64f..0000000000
--- a/editeng/source/xml/xmltxtimp.cxx
+++ /dev/null
@@ -1,259 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_editeng.hxx"
-#include <tools/debug.hxx>
-#include <com/sun/star/io/XActiveDataControl.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/text/XText.hpp>
-#include <comphelper/processfactory.hxx>
-#include <unotools/streamwrap.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <sot/storage.hxx>
-#include <svl/itemprop.hxx>
-#include <xmloff/xmlimp.hxx>
-#include <xmloff/xmlmetae.hxx>
-#include <xmloff/xmlictxt.hxx>
-#include <xmloff/xmltoken.hxx>
-#include <xmloff/xmlnmspe.hxx>
-#include <xmloff/xmlstyle.hxx>
-#include "editsource.hxx"
-#include <editeng/editeng.hxx>
-#include <editeng/unotext.hxx>
-#include <editeng/unoprnms.hxx>
-#include <editeng/unoipset.hxx>
-
-using namespace com::sun::star;
-using namespace com::sun::star::document;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::xml::sax;
-using namespace com::sun::star::text;
-using namespace ::rtl;
-using namespace cppu;
-using namespace xmloff::token;
-
-
-///////////////////////////////////////////////////////////////////////
-
-class SvxXMLTextImportContext : public SvXMLImportContext
-{
-public:
- SvxXMLTextImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< XAttributeList >& xAttrList, const uno::Reference< XText >& xText );
- virtual ~SvxXMLTextImportContext();
-
- virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList );
-
-// SvxXMLXTableImport& getImport() const { return *(SvxXMLXTableImport*)&GetImport(); }
-
-private:
- const uno::Reference< XText > mxText;
-};
-
-///////////////////////////////////////////////////////////////////////
-
-SvxXMLTextImportContext::SvxXMLTextImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< XAttributeList >&, const uno::Reference< XText >& xText )
-: SvXMLImportContext( rImport, nPrfx, rLName ), mxText( xText )
-{
-}
-
-SvxXMLTextImportContext::~SvxXMLTextImportContext()
-{
-}
-
-SvXMLImportContext *SvxXMLTextImportContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList )
-{
- SvXMLImportContext* pContext = NULL;
- if(XML_NAMESPACE_OFFICE == nPrefix && IsXMLToken( rLocalName, XML_BODY ) )
- {
- pContext = new SvxXMLTextImportContext( GetImport(), nPrefix, rLocalName, xAttrList, mxText );
- }
- else if( XML_NAMESPACE_OFFICE == nPrefix && IsXMLToken( rLocalName, XML_AUTOMATIC_STYLES ) )
- {
- pContext = new SvXMLStylesContext( GetImport(), nPrefix, rLocalName, xAttrList );
- GetImport().GetTextImport()->SetAutoStyles( (SvXMLStylesContext*)pContext );
-
- }
- else
- {
- pContext = GetImport().GetTextImport()->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList );
- }
-
- if( NULL == pContext )
- pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
-
- return pContext;
-}
-
-///////////////////////////////////////////////////////////////////////
-
-class SvxXMLXTextImportComponent : public SvXMLImport
-{
-public:
- SvxXMLXTextImportComponent(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const uno::Reference< XText > & xText );
-
- virtual ~SvxXMLXTextImportComponent() throw ();
-
- static sal_Bool load( const rtl::OUString& rUrl, const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xTable ) throw();
-protected:
- virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList );
-
-private:
- const uno::Reference< XText > mxText;
-};
-
-// --------------------------------------------------------------------
-
-SvxXMLXTextImportComponent::SvxXMLXTextImportComponent(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const uno::Reference< XText > & xText )
-: SvXMLImport(xServiceFactory),
- mxText( xText )
-{
- GetTextImport()->SetCursor( mxText->createTextCursor() );
-}
-
-SvxXMLXTextImportComponent::~SvxXMLXTextImportComponent() throw ()
-{
-}
-
-void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel )
-{
- SvxEditEngineSource aEditSource( &rEditEngine );
-
- static const SfxItemPropertyMapEntry SvxXMLTextImportComponentPropertyMap[] =
- {
- SVX_UNOEDIT_CHAR_PROPERTIES,
- SVX_UNOEDIT_FONT_PROPERTIES,
-// SVX_UNOEDIT_OUTLINER_PROPERTIES,
- SVX_UNOEDIT_PARA_PROPERTIES,
- {0,0,0,0,0,0}
- };
- static SvxItemPropertySet aSvxXMLTextImportComponentPropertySet( SvxXMLTextImportComponentPropertyMap, EditEngine::GetGlobalItemPool() );
-
- uno::Reference<text::XText > xParent;
- SvxUnoText* pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextImportComponentPropertySet, xParent );
- pUnoText->SetSelection( rSel );
- uno::Reference<text::XText > xText( pUnoText );
-
- try
- {
- do
- {
- uno::Reference<lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
- if( !xServiceFactory.is() )
- {
- 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() )
- {
- OSL_FAIL( "com.sun.star.xml.sax.Parser service missing" );
- break;
- }
-
- uno::Reference<io::XInputStream> xInputStream = new utl::OInputStreamWrapper( rStream );
-
-/* testcode
- const OUString aURL( RTL_CONSTASCII_USTRINGPARAM( "file:///e:/test.xml" ) );
- SfxMedium aMedium( aURL, STREAM_READ | STREAM_NOCREATE, sal_True );
- aMedium.IsRemote();
- uno::Reference<io::XOutputStream> xOut( new utl::OOutputStreamWrapper( *aMedium.GetOutStream() ) );
-
- aMedium.GetInStream()->Seek( 0 );
- uno::Reference< io::XActiveDataSource > xSource( aMedium.GetDataSource() );
-
- if( !xSource.is() )
- {
- 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() )
- {
- OSL_FAIL( "XMLReader::Read: com.sun.star.io.Pipe service missing" );
- break;
- }
-
- // connect pipe's output stream to the data source
- xSource->setOutputStream( uno::Reference< io::XOutputStream >::query( xPipe ) );
-
- xml::sax::InputSource aParserInput;
- aParserInput.aInputStream = uno::Reference< io::XInputStream >::query( xPipe );
- aParserInput.sSystemId = aMedium.GetName();
-
-
- if( xSource.is() )
- {
- uno::Reference< io::XActiveDataControl > xSourceControl( xSource, UNO_QUERY );
- xSourceControl->start();
- }
-
-*/
-
- // uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTextImportComponent( xText ) );
- uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTextImportComponent( xServiceFactory, xText ) );
-
- xParser->setDocumentHandler( xHandler );
-
- xml::sax::InputSource aParserInput;
- aParserInput.aInputStream = xInputStream;
-// aParserInput.sSystemId = aMedium.GetName();
- xParser->parseStream( aParserInput );
- }
- while(0);
- }
- catch( uno::Exception& )
- {
- }
-}
-
-SvXMLImportContext *SvxXMLXTextImportComponent::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList )
-{
- SvXMLImportContext* pContext;
- if(XML_NAMESPACE_OFFICE == nPrefix && ( IsXMLToken( rLocalName, XML_DOCUMENT ) || IsXMLToken( rLocalName, XML_DOCUMENT_CONTENT ) ) )
- {
- pContext = new SvxXMLTextImportContext(*this, nPrefix, rLocalName, xAttrList, mxText );
- }
- else
- {
- pContext = SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
- }
- return pContext;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/util/editeng.dxp b/editeng/util/editeng.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/editeng/util/editeng.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/editeng/util/hidother.src b/editeng/util/hidother.src
deleted file mode 100644
index 0203afa929..0000000000
--- a/editeng/util/hidother.src
+++ /dev/null
@@ -1,49 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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.
- *
- ************************************************************************/
-
-#include "../inc/helpid.hrc"
-
-hidspecial HID_AUTOCORR_HELP_ACORSENTWORD { HelpID = HID_AUTOCORR_HELP_ACORSENTWORD;};
-hidspecial HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH { HelpID = HID_AUTOCORR_HELP_ACORSENTWORDENEMDASH;};
-hidspecial HID_AUTOCORR_HELP_ACORWORD { HelpID = HID_AUTOCORR_HELP_ACORWORD;};
-hidspecial HID_AUTOCORR_HELP_ACORWORDENEMDASH { HelpID = HID_AUTOCORR_HELP_ACORWORDENEMDASH;};
-hidspecial HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL { HelpID = HID_AUTOCORR_HELP_CHGFRACTIONSYMBOL;};
-hidspecial HID_AUTOCORR_HELP_CHGORDINALNUMBER { HelpID = HID_AUTOCORR_HELP_CHGORDINALNUMBER;};
-hidspecial HID_AUTOCORR_HELP_CHGQUOTES { HelpID = HID_AUTOCORR_HELP_CHGQUOTES;};
-hidspecial HID_AUTOCORR_HELP_CHGSGLQUOTES { HelpID = HID_AUTOCORR_HELP_CHGSGLQUOTES;};
-hidspecial HID_AUTOCORR_HELP_CHGTOENEMDASH { HelpID = HID_AUTOCORR_HELP_CHGTOENEMDASH;};
-hidspecial HID_AUTOCORR_HELP_CHGWEIGHTUNDERL { HelpID = HID_AUTOCORR_HELP_CHGWEIGHTUNDERL;};
-hidspecial HID_AUTOCORR_HELP_INGNOREDOUBLESPACE { HelpID = HID_AUTOCORR_HELP_INGNOREDOUBLESPACE;};
-hidspecial HID_AUTOCORR_HELP_SENT { HelpID = HID_AUTOCORR_HELP_SENT;};
-hidspecial HID_AUTOCORR_HELP_SENTENEMDASH { HelpID = HID_AUTOCORR_HELP_SENTENEMDASH;};
-hidspecial HID_AUTOCORR_HELP_SENTWORD { HelpID = HID_AUTOCORR_HELP_SENTWORD;};
-hidspecial HID_AUTOCORR_HELP_SENTWORDENEMDASH { HelpID = HID_AUTOCORR_HELP_SENTWORDENEMDASH;};
-hidspecial HID_AUTOCORR_HELP_SETINETATTR { HelpID = HID_AUTOCORR_HELP_SETINETATTR;};
-hidspecial HID_AUTOCORR_HELP_WORD { HelpID = HID_AUTOCORR_HELP_WORD;};
-hidspecial HID_AUTOCORR_HELP_WORDENEMDASH { HelpID = HID_AUTOCORR_HELP_WORDENEMDASH;};
-
-
diff --git a/editeng/util/makefile.mk b/editeng/util/makefile.mk
deleted file mode 100644
index 80c8939b1b..0000000000
--- a/editeng/util/makefile.mk
+++ /dev/null
@@ -1,98 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# 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
-