summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorPeter Foley <pefoley2@verizon.net>2011-12-24 09:44:24 -0500
committerPeter Foley <pefoley2@verizon.net>2011-12-24 09:44:24 -0500
commitfd6649175956c9d322fe02fd413fe6970aa6819e (patch)
treece2691616f82ef55d3b8f3e45812777477e8668f /sc
parent79b252a56db8f1c2159d3269de415ffe2f2d9bb1 (diff)
parenta8feb5b1df99c12a5cb644097f935e9ccf512ed5 (diff)
Merge remote-tracking branch 'origin/master' into feature/gbuild_extensions
Conflicts: Module_tail_build.mk Repository.mk extensions/util/makefile.pmk postprocess/prj/build.lst svx/AllLangResTarget_svx.mk
Diffstat (limited to 'sc')
-rw-r--r--sc/CppunitTest_sc_cellrangesbase.mk5
-rw-r--r--sc/CppunitTest_sc_datapilotfieldobj.mk5
-rw-r--r--sc/CppunitTest_sc_filters_test.mk5
-rw-r--r--sc/CppunitTest_sc_macros_test.mk5
-rw-r--r--sc/CppunitTest_sc_namedrangeobj.mk8
-rw-r--r--sc/CppunitTest_sc_spreadsheetobj.mk141
-rw-r--r--sc/CppunitTest_sc_subsequent_filters_test.mk5
-rw-r--r--sc/CppunitTest_sc_tableautoformatfield.mk5
-rw-r--r--sc/CppunitTest_sc_ucalc.mk10
-rw-r--r--sc/Module_sc.mk7
-rw-r--r--sc/inc/chgtrack.hxx42
-rw-r--r--sc/inc/clipparam.hxx13
-rw-r--r--sc/inc/document.hxx13
-rw-r--r--sc/inc/externalrefmgr.hxx30
-rw-r--r--sc/inc/globstr.hrc3
-rw-r--r--sc/inc/reftokenhelper.hxx1
-rw-r--r--sc/inc/scmod.hxx1
-rw-r--r--sc/inc/token.hxx8
-rw-r--r--sc/inc/tokenarray.hxx15
-rw-r--r--sc/qa/extras/testdocuments/rangenames.odsbin10047 -> 9347 bytes
-rw-r--r--sc/qa/extras/testdocuments/rangenamessrc.odsbin0 -> 10768 bytes
-rw-r--r--sc/qa/extras/xnamecontainer.cxx85
-rw-r--r--sc/qa/extras/xnamedrange.cxx201
-rw-r--r--sc/qa/extras/xnamedranges.cxx (renamed from sc/qa/extras/xrangename.cxx)114
-rw-r--r--sc/qa/extras/xspreadsheets2.cxx265
-rw-r--r--sc/qa/unit/ucalc.cxx2
-rw-r--r--sc/qa/unoapi/sc.sce4
-rw-r--r--sc/source/core/data/cell.cxx13
-rw-r--r--sc/source/core/data/clipparam.cxx17
-rw-r--r--sc/source/core/data/documen2.cxx24
-rw-r--r--sc/source/core/data/document.cxx195
-rw-r--r--sc/source/core/data/patattr.cxx8
-rw-r--r--sc/source/core/data/table1.cxx2
-rw-r--r--sc/source/core/data/table3.cxx17
-rw-r--r--sc/source/core/tool/autoform.cxx14
-rw-r--r--sc/source/core/tool/chgtrack.cxx136
-rw-r--r--sc/source/core/tool/ddelink.cxx12
-rw-r--r--sc/source/core/tool/interpr2.cxx2
-rw-r--r--sc/source/core/tool/reftokenhelper.cxx59
-rw-r--r--sc/source/core/tool/token.cxx173
-rw-r--r--sc/source/core/tool/zforauto.cxx4
-rw-r--r--sc/source/filter/excel/impop.cxx4
-rw-r--r--sc/source/filter/ftools/ftools.cxx40
-rw-r--r--sc/source/filter/inc/ftools.hxx22
-rw-r--r--sc/source/filter/lotus/lotform.cxx7
-rw-r--r--sc/source/filter/qpro/qproform.cxx2
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx12
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx2
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx6
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.cxx85
-rw-r--r--sc/source/ui/app/inputwin.cxx10
-rw-r--r--sc/source/ui/app/scmod.cxx16
-rw-r--r--sc/source/ui/app/transobj.cxx4
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx23
-rw-r--r--sc/source/ui/dbgui/tpsubt.cxx17
-rw-r--r--sc/source/ui/docshell/docsh.cxx35
-rw-r--r--sc/source/ui/docshell/docsh8.cxx4
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx52
-rw-r--r--sc/source/ui/docshell/olinefun.cxx4
-rw-r--r--sc/source/ui/inc/acredlin.hxx8
-rw-r--r--sc/source/ui/inc/docsh.hxx2
-rw-r--r--sc/source/ui/inc/inputwin.hxx1
-rw-r--r--sc/source/ui/inc/namemgrtable.hxx2
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx1
-rw-r--r--sc/source/ui/inc/tpcalc.hxx1
-rw-r--r--sc/source/ui/inc/tpprint.hxx1
-rw-r--r--sc/source/ui/inc/tpsort.hxx2
-rw-r--r--sc/source/ui/inc/tpsubt.hxx2
-rw-r--r--sc/source/ui/inc/tpusrlst.hxx1
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx99
-rw-r--r--sc/source/ui/miscdlgs/conflictsdlg.cxx2
-rw-r--r--sc/source/ui/namedlg/namedefdlg.cxx7
-rw-r--r--sc/source/ui/namedlg/namemgrtable.cxx7
-rw-r--r--sc/source/ui/optdlg/tpcalc.cxx19
-rw-r--r--sc/source/ui/optdlg/tpprint.cxx14
-rw-r--r--sc/source/ui/optdlg/tpusrlst.cxx15
-rw-r--r--sc/source/ui/src/globstr.src4
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx5
-rw-r--r--sc/source/ui/unoobj/filtuno.cxx62
-rw-r--r--sc/source/ui/unoobj/scdetect.cxx2
-rw-r--r--sc/source/ui/vba/vbachart.cxx2
-rw-r--r--sc/source/ui/view/printfun.cxx23
-rw-r--r--sc/source/ui/view/tabvwsh.cxx9
-rw-r--r--sc/source/ui/view/viewfun2.cxx5
-rw-r--r--sc/source/ui/view/viewfun3.cxx19
-rw-r--r--sc/source/ui/view/viewfun4.cxx2
86 files changed, 1653 insertions, 678 deletions
diff --git a/sc/CppunitTest_sc_cellrangesbase.mk b/sc/CppunitTest_sc_cellrangesbase.mk
index 07822e5d0c0e..051ee27292e8 100644
--- a/sc/CppunitTest_sc_cellrangesbase.mk
+++ b/sc/CppunitTest_sc_cellrangesbase.mk
@@ -137,6 +137,9 @@ $(eval $(call gb_CppunitTest_set_args,sc_cellrangesbase,\
# a) explicitly depend on library msword because it is not implied by a link
# relation
# b) explicitly depend on the sc resource files needed at unit-test runtime
-$(call gb_CppunitTest_get_target,sc_cellrangesbase) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
+$(call gb_CppunitTest_get_target,sc_cellrangesbase) : \
+ $(WORKDIR)/AllLangRes/sc \
+ $(call gb_Library_get_target,localedata_en) \
+ $(call gb_Library_get_target,scfilt) \
# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_datapilotfieldobj.mk b/sc/CppunitTest_sc_datapilotfieldobj.mk
index 74cfeb37bb0c..236ffb9e0184 100644
--- a/sc/CppunitTest_sc_datapilotfieldobj.mk
+++ b/sc/CppunitTest_sc_datapilotfieldobj.mk
@@ -137,6 +137,9 @@ $(eval $(call gb_CppunitTest_set_args,sc_datapilotfieldobj,\
# a) explicitly depend on library msword because it is not implied by a link
# relation
# b) explicitly depend on the sc resource files needed at unit-test runtime
-$(call gb_CppunitTest_get_target,sc_datapilotfieldobj) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
+$(call gb_CppunitTest_get_target,sc_datapilotfieldobj) : \
+ $(WORKDIR)/AllLangRes/sc \
+ $(call gb_Library_get_target,localedata_en) \
+ $(call gb_Library_get_target,scfilt) \
# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_filters_test.mk b/sc/CppunitTest_sc_filters_test.mk
index 034debd3b98d..c6b69f131a55 100644
--- a/sc/CppunitTest_sc_filters_test.mk
+++ b/sc/CppunitTest_sc_filters_test.mk
@@ -133,6 +133,9 @@ $(eval $(call gb_CppunitTest_set_args,sc_filters_test,\
# a) explicitly depend on library msword because it is not implied by a link
# relation
# b) explicitly depend on the sc resource files needed at unit-test runtime
-$(call gb_CppunitTest_get_target,sc_filters_test) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
+$(call gb_CppunitTest_get_target,sc_filters_test) : \
+ $(WORKDIR)/AllLangRes/sc \
+ $(call gb_Library_get_target,localedata_en) \
+ $(call gb_Library_get_target,scfilt) \
# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_macros_test.mk b/sc/CppunitTest_sc_macros_test.mk
index 3252d1594634..e760cb2e3eaa 100644
--- a/sc/CppunitTest_sc_macros_test.mk
+++ b/sc/CppunitTest_sc_macros_test.mk
@@ -135,6 +135,9 @@ $(eval $(call gb_CppunitTest_set_args,sc_macros_test,\
# a) explicitly depend on library msword because it is not implied by a link
# relation
# b) explicitly depend on the sc resource files needed at unit-test runtime
-$(call gb_CppunitTest_get_target,sc_macros_test) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
+$(call gb_CppunitTest_get_target,sc_macros_test) : \
+ $(WORKDIR)/AllLangRes/sc \
+ $(call gb_Library_get_target,localedata_en) \
+ $(call gb_Library_get_target,scfilt) \
# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_namedrangeobj.mk b/sc/CppunitTest_sc_namedrangeobj.mk
index 87619a7911aa..c41c29ef6141 100644
--- a/sc/CppunitTest_sc_namedrangeobj.mk
+++ b/sc/CppunitTest_sc_namedrangeobj.mk
@@ -31,7 +31,8 @@
$(eval $(call gb_CppunitTest_CppunitTest,sc_namedrangeobj))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_namedrangeobj, \
- sc/qa/extras/xrangename \
+ sc/qa/extras/xnamedranges \
+ sc/qa/extras/xnamedrange \
))
$(eval $(call gb_CppunitTest_add_linked_libs,sc_namedrangeobj, \
@@ -136,6 +137,9 @@ $(eval $(call gb_CppunitTest_set_args,sc_namedrangeobj,\
# a) explicitly depend on library msword because it is not implied by a link
# relation
# b) explicitly depend on the sc resource files needed at unit-test runtime
-$(call gb_CppunitTest_get_target,sc_namedrangeobj) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
+$(call gb_CppunitTest_get_target,sc_namedrangeobj) : \
+ $(WORKDIR)/AllLangRes/sc \
+ $(call gb_Library_get_target,localedata_en) \
+ $(call gb_Library_get_target,scfilt) \
# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_spreadsheetobj.mk b/sc/CppunitTest_sc_spreadsheetobj.mk
new file mode 100644
index 000000000000..f29818bbbb0c
--- /dev/null
+++ b/sc/CppunitTest_sc_spreadsheetobj.mk
@@ -0,0 +1,141 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+# 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 or as specified alternatively below. 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
+# Markus Mohrhard <markus.mohrhard@googlemail.com>
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# 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.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_spreadsheetobj))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_spreadsheetobj, \
+ sc/qa/extras/xspreadsheets2 \
+))
+
+$(eval $(call gb_CppunitTest_add_linked_libs,sc_spreadsheetobj, \
+ avmedia \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ drawinglayer \
+ editeng \
+ fileacc \
+ for \
+ forui \
+ i18nisolang1 \
+ msfilter \
+ oox \
+ sal \
+ salhelper \
+ sax \
+ sb \
+ sc \
+ sfx \
+ sot \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ test \
+ tl \
+ tk \
+ ucbhelper \
+ unotest \
+ utl \
+ vbahelper \
+ vcl \
+ xo \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_spreadsheetobj,\
+ -I$(realpath $(SRCDIR)/sc/source/ui/inc) \
+ -I$(realpath $(SRCDIR)/sc/inc) \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc \
+))
+
+$(eval $(call gb_CppunitTest_add_api,sc_spreadsheetobj,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_uses_ure,sc_spreadsheetobj))
+
+$(eval $(call gb_CppunitTest_add_type_rdbs,sc_spreadsheetobj,\
+ types \
+))
+
+$(eval $(call gb_CppunitTest_add_components,sc_spreadsheetobj,\
+ basic/util/sb \
+ comphelper/util/comphelp \
+ configmgr/source/configmgr \
+ dbaccess/util/dba \
+ fileaccess/source/fileacc \
+ filter/source/config/cache/filterconfig1 \
+ forms/util/frm \
+ framework/util/fwk \
+ i18npool/util/i18npool \
+ oox/util/oox \
+ package/source/xstor/xstor \
+ package/util/package2 \
+ sax/source/expatwrap/expwrap \
+ sax/source/fastparser/fastsax \
+ sc/util/sc \
+ sc/util/scd \
+ sc/util/scfilt \
+ sc/util/vbaobj \
+ scripting/source/basprov/basprov \
+ scripting/util/scriptframe \
+ sfx2/util/sfx \
+ sot/util/sot \
+ svl/source/fsstor/fsstorage \
+ toolkit/util/tk \
+ unotools/util/utl \
+ unoxml/source/rdf/unordf \
+ unoxml/source/service/unoxml \
+))
+
+$(eval $(call gb_CppunitTest_add_old_components,sc_spreadsheetobj,\
+ ucb1 \
+ ucpfile1 \
+ ucptdoc1 \
+))
+
+$(eval $(call gb_CppunitTest_set_args,sc_spreadsheetobj,\
+ --headless \
+ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
+ "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool) xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/unittest/registry)" \
+))
+ # .../spool is required for the (somewhat strange) filter configuration
+
+# we need to
+# a) explicitly depend on library msword because it is not implied by a link
+# relation
+# b) explicitly depend on the sc resource files needed at unit-test runtime
+$(call gb_CppunitTest_get_target,sc_spreadsheetobj) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_subsequent_filters_test.mk b/sc/CppunitTest_sc_subsequent_filters_test.mk
index 6a97f9345403..2fe33e98e372 100644
--- a/sc/CppunitTest_sc_subsequent_filters_test.mk
+++ b/sc/CppunitTest_sc_subsequent_filters_test.mk
@@ -147,6 +147,9 @@ $(eval $(call gb_CppunitTest_set_args,sc_subsequent_filters_test,\
# a) explicitly depend on library msword because it is not implied by a link
# relation
# b) explicitly depend on the sc resource files needed at unit-test runtime
-$(call gb_CppunitTest_get_target,sc_subsequent_filters_test) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
+$(call gb_CppunitTest_get_target,sc_subsequent_filters_test) : \
+ $(WORKDIR)/AllLangRes/sc \
+ $(call gb_Library_get_target,localedata_en) \
+ $(call gb_Library_get_target,scfilt) \
# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_tableautoformatfield.mk b/sc/CppunitTest_sc_tableautoformatfield.mk
index 426cf9389c85..1a65fa6b79b3 100644
--- a/sc/CppunitTest_sc_tableautoformatfield.mk
+++ b/sc/CppunitTest_sc_tableautoformatfield.mk
@@ -136,6 +136,9 @@ $(eval $(call gb_CppunitTest_set_args,sc_tableautoformatfield,\
# a) explicitly depend on library msword because it is not implied by a link
# relation
# b) explicitly depend on the sc resource files needed at unit-test runtime
-$(call gb_CppunitTest_get_target,sc_tableautoformatfield) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
+$(call gb_CppunitTest_get_target,sc_tableautoformatfield) : \
+ $(WORKDIR)/AllLangRes/sc \
+ $(call gb_Library_get_target,localedata_en) \
+ $(call gb_Library_get_target,scfilt) \
# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index 8fc3d1dcb69d..3862ff260f1b 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -37,10 +37,12 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sc_ucalc, \
$(eval $(call gb_CppunitTest_add_library_objects,sc_ucalc,sc))
-$(call gb_CxxObject_get_target,sc/qa/unit/ucalc): $(WORKDIR)/AllLangRes/sc
-$(call gb_CxxObject_get_target,sc/qa/unit/ucalc): $(WORKDIR)/AllLangRes/frm
-$(call gb_CxxObject_get_target,sc/qa/unit/ucalc): $(WORKDIR)/AllLangRes/for
-$(call gb_CxxObject_get_target,sc/qa/unit/ucalc): $(WORKDIR)/AllLangRes/forui
+$(call gb_CxxObject_get_target,sc/qa/unit/ucalc): \
+ $(WORKDIR)/AllLangRes/for \
+ $(WORKDIR)/AllLangRes/forui \
+ $(WORKDIR)/AllLangRes/frm \
+ $(WORKDIR)/AllLangRes/sc \
+ $(call gb_Library_get_target,localedata_en) \
$(eval $(call gb_CppunitTest_add_linked_libs,sc_ucalc, \
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 00d4ea8dc97f..e57a43396a55 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -40,12 +40,13 @@ $(eval $(call gb_Module_add_check_targets,sc,\
))
$(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
- CppunitTest_sc_macros_test \
CppunitTest_sc_cellrangesbase \
- CppunitTest_sc_subsequent_filters_test \
+ CppunitTest_sc_datapilotfieldobj \
+ CppunitTest_sc_macros_test \
CppunitTest_sc_namedrangeobj \
+ CppunitTest_sc_spreadsheetobj \
+ CppunitTest_sc_subsequent_filters_test \
CppunitTest_sc_tableautoformatfield \
- CppunitTest_sc_datapilotfieldobj \
JunitTest_sc_complex \
JunitTest_sc_unoapi \
))
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 5dc02d81bc59..9dd27cac72a5 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -30,11 +30,11 @@
#define SC_CHGTRACK_HXX
#include <deque>
+#include <map>
#include <stack>
#include <tools/string.hxx>
#include <tools/datetime.hxx>
-#include <tools/table.hxx>
#include <tools/mempool.hxx>
#include <tools/link.hxx>
#include <unotools/options.hxx>
@@ -952,6 +952,7 @@ struct ScChangeTrackMsgInfo
// MsgQueue for notification via ModifiedLink
typedef std::deque<ScChangeTrackMsgInfo*> ScChangeTrackMsgQueue;
typedef std::stack<ScChangeTrackMsgInfo*> ScChangeTrackMsgStack;
+typedef std::map<sal_uLong, ScChangeAction*> ScChangeActionMap;
enum ScChangeTrackMergeState
{
@@ -962,9 +963,6 @@ enum ScChangeTrackMergeState
SC_CTMS_OTHER
};
-// Table, additionally to pFirst/pNext/pLast/pPrev, to enable fast access by ActionNumber and by list
-DECLARE_TABLE( ScChangeActionTable, ScChangeAction* )
-
// Internally generated actions start at this value (nearly all bits set)
// and are decremented, to keep values in a table seperated from "normal" actions.
#define SC_CHGTRACK_GENERATED_START ((sal_uInt32) 0xfffffff0)
@@ -981,9 +979,9 @@ class ScChangeTrack : public utl::ConfigurationListener
static const SCSIZE nContentSlots;
com::sun::star::uno::Sequence< sal_Int8 > aProtectPass;
- ScChangeActionTable aTable;
- ScChangeActionTable aGeneratedTable;
- ScChangeActionTable aPasteCutTable;
+ ScChangeActionMap aMap;
+ ScChangeActionMap aGeneratedMap;
+ ScChangeActionMap aPasteCutMap;
ScChangeTrackMsgQueue aMsgQueue;
ScChangeTrackMsgStack aMsgStackTmp;
ScChangeTrackMsgStack aMsgStackFinal;
@@ -1097,7 +1095,7 @@ class ScChangeTrack : public utl::ConfigurationListener
// is NULL otherwise.
// bRecursion == called from reject with table
sal_Bool Reject( ScChangeAction*,
- ScChangeActionTable*, sal_Bool bRecursion );
+ ScChangeActionMap*, sal_Bool bRecursion );
#endif // SC_CHGTRACK_CXX
@@ -1126,9 +1124,21 @@ public:
sal_Bool IsGenerated( sal_uLong nAction ) const
{ return nAction >= nGeneratedMin; }
ScChangeAction* GetAction( sal_uLong nAction ) const
- { return aTable.Get( nAction ); }
+ {
+ ScChangeActionMap::const_iterator it = aMap.find( nAction );
+ if( it != aMap.end() )
+ return it->second;
+ else
+ return NULL;
+ }
ScChangeAction* GetGenerated( sal_uLong nGenerated ) const
- { return aGeneratedTable.Get( nGenerated ); }
+ {
+ ScChangeActionMap::const_iterator it = aGeneratedMap.find( nGenerated );
+ if( it != aGeneratedMap.end() )
+ return it->second;
+ else
+ return NULL;
+ }
ScChangeAction* GetActionOrGenerated( sal_uLong nAction ) const
{
return IsGenerated( nAction ) ?
@@ -1140,7 +1150,13 @@ public:
void SetLastSavedActionNumber(sal_uLong nNew)
{ nMarkLastSaved = nNew; }
ScChangeAction* GetLastSaved() const
- { return aTable.Get( nMarkLastSaved ); }
+ {
+ ScChangeActionMap::const_iterator it = aMap.find( nMarkLastSaved );
+ if( it != aMap.end() )
+ return it->second;
+ else
+ return NULL;
+ }
ScChangeActionContent** GetContentSlots() const { return ppContentSlots; }
sal_Bool IsLoadSave() const { return bLoadSave; }
@@ -1278,8 +1294,8 @@ public:
// With bAllFlat (==TRUE ?) all dependents of dependents
// will be inserted flatly.
- SC_DLLPUBLIC void GetDependents( ScChangeAction*,
- ScChangeActionTable&,
+ SC_DLLPUBLIC void GetDependents( ScChangeAction*,
+ ScChangeActionMap&,
sal_Bool bListMasterDelete = false,
sal_Bool bAllFlat = false ) const;
diff --git a/sc/inc/clipparam.hxx b/sc/inc/clipparam.hxx
index f8a4038eaca4..63b4c9aecf53 100644
--- a/sc/inc/clipparam.hxx
+++ b/sc/inc/clipparam.hxx
@@ -79,19 +79,6 @@ struct ScClipParam
void setSourceDocID( sal_uInt32 nVal ) { mnSourceDocID = nVal; }
};
-// ============================================================================
-
-struct ScClipRangeNameData
-{
- ScRangeData::IndexMap maRangeMap;
- ::std::vector<ScRangeData*> mpRangeNames; // Don't insert NULL pointers.
- bool mbReplace;
-
- ScClipRangeNameData();
- ~ScClipRangeNameData();
- void insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex);
-};
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index d39940f8685f..8e41fea45158 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -146,7 +146,6 @@ struct ScLookupCacheMapImpl;
class SfxUndoManager;
class ScFormulaParserPool;
struct ScClipParam;
-struct ScClipRangeNameData;
class ScRowBreakIterator;
struct ScSetStringParam;
class ScDocRowHeightUpdater;
@@ -242,6 +241,7 @@ private:
ScValidationDataList* pValidationList; // validity
SvNumberFormatterIndexTable* pFormatExchangeList; // for application of number formats
TableContainer maTabs;
+ std::vector<rtl::OUString> maTabNames; // for undo document, we need the information tab name <-> index
mutable ScRangeName* pRangeName;
ScDBCollection* pDBCollection;
ScDPCollection* pDPCollection;
@@ -280,8 +280,9 @@ private:
mutable ::std::auto_ptr< ScFormulaParserPool >
mxFormulaParserPool; /// Pool for all external formula parsers used by this document.
- rtl::OUString aDocName; // optional: name of document
- rtl::OUString aDocCodeName; // optional: name of document (twice?)
+ rtl::OUString aDocName; // optional: name of document
+ rtl::OUString aDocCodeName; // optional: name of document (twice?)
+ rtl::OUString maFileURL; // file URL for copy & paste
ScRangePairListRef xColNameRanges;
ScRangePairListRef xRowNameRanges;
@@ -432,6 +433,7 @@ public:
void SetName( const rtl::OUString& r ) { aDocName = r; }
const rtl::OUString& GetCodeName() const { return aDocCodeName; }
void SetCodeName( const rtl::OUString& r ) { aDocCodeName = r; }
+ const rtl::OUString& GetFileURL() const { return maFileURL; }
void GetDocStat( ScDocStat& rDocStat );
@@ -533,6 +535,7 @@ public:
SC_DLLPUBLIC bool GetCodeName( SCTAB nTab, rtl::OUString& rName ) const;
SC_DLLPUBLIC bool SetCodeName( SCTAB nTab, const rtl::OUString& rName );
SC_DLLPUBLIC bool GetTable( const rtl::OUString& rName, SCTAB& rTab ) const;
+ rtl::OUString GetCopyTabName(SCTAB nTab) const;
SC_DLLPUBLIC void SetAnonymousDBData(SCTAB nTab, ScDBData* pDBData);
SC_DLLPUBLIC ScDBData* GetAnonymousDBData(SCTAB nTab);
@@ -1860,10 +1863,6 @@ private: // CLOOK-Impl-methods
void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs);
void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, SCTAB nTab);
- void CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames);
- void UpdateRangeNamesInFormulas(
- ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark,
- SCCOL nXw, SCROW nYw);
bool HasPartOfMerged( const ScRange& rRange );
diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index e39ac2ed6077..c44c8f1dc623 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -33,9 +33,11 @@
#include "address.hxx"
#include "sfx2/objsh.hxx"
#include "sfx2/lnkbase.hxx"
+#include "sfx2/event.hxx"
#include "tools/time.hxx"
#include "vcl/timer.hxx"
#include "svl/zforlist.hxx"
+#include "svl/lstner.hxx"
#include "scmatrix.hxx"
#include "rangelst.hxx"
#include "formula/token.hxx"
@@ -46,6 +48,7 @@
#include <vector>
#include <list>
#include <set>
+#include <iostream>
#include <formula/ExternalReferenceHelper.hxx>
class ScDocument;
@@ -353,7 +356,7 @@ private:
mutable DocDataType maDocs;
};
-class SC_DLLPUBLIC ScExternalRefManager : public formula::ExternalReferenceHelper
+class SC_DLLPUBLIC ScExternalRefManager : public formula::ExternalReferenceHelper, SfxListener
{
public:
@@ -426,6 +429,7 @@ public:
::rtl::OUString maRelativeName;
::rtl::OUString maFilterName;
::rtl::OUString maFilterOptions;
+ bool bUnsaved;
void maybeCreateRealFileName(const String& rOwnDocName);
};
@@ -673,6 +677,23 @@ public:
*/
bool isFileLoadable(const ::rtl::OUString& rFile) const;
+ /**
+ * If in maUnsavedDocShells move it to maDocShells and create a correct
+ * external reference entry
+ *
+ * @param Pointer to the newly saved DocumentShell
+ */
+ void transformUnsavedRefToSavedRef( SfxObjectShell* pShell );
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ /**
+ * If we still contain unsaved files we should warn the user before saving
+ *
+ * @return true if the document still contains references to an unsaved file
+ */
+ bool containsUnsavedReferences() { return !maUnsavedDocShells.empty(); }
+
private:
ScExternalRefManager();
ScExternalRefManager(const ScExternalRefManager&);
@@ -749,6 +770,7 @@ private:
sal_uInt32 getMappedNumberFormat(sal_uInt16 nFileId, sal_uInt32 nNumFmt, const ScDocument* pSrcDoc);
+
private:
/** cache of referenced ranges and names from source documents. */
ScExternalRefCache maRefCache;
@@ -761,6 +783,12 @@ private:
*/
DocShellMap maDocShells;
+ /**
+ * DocShells to unsaved but referenced documents. If not empty ask before saving!
+ * Move to maDocShells if document referenced here is saved
+ */
+ DocShellMap maUnsavedDocShells;
+
/** list of source documents that are managed by the link manager. */
LinkedDocMap maLinkedDocs;
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 2363aaf326fa..a545a0e69e17 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -599,8 +599,9 @@
#define STR_ERR_NAME_EXISTS 463
#define STR_ERR_NAME_INVALID 464
+#define STR_UNSAVED_EXT_REF 465
-#define STR_COUNT 465
+#define STR_COUNT 466
#endif
diff --git a/sc/inc/reftokenhelper.hxx b/sc/inc/reftokenhelper.hxx
index 9119e3eb9b82..c076f343937a 100644
--- a/sc/inc/reftokenhelper.hxx
+++ b/sc/inc/reftokenhelper.hxx
@@ -58,6 +58,7 @@ public:
const sal_Unicode cSep, ::formula::FormulaGrammar::Grammar eGrammar);
static bool getRangeFromToken(ScRange& rRange, const ScTokenRef& pToken, bool bExternal = false);
+ static bool getAbsRangeFromToken(ScRange& rRange, const ScTokenRef& pToken, const ScAddress& rPos, bool bExternal = false);
static void getRangeListFromTokens(ScRangeList& rRangeList, const ::std::vector<ScTokenRef>& pTokens);
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 5a51b088be9f..70af96a0b65d 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -256,7 +256,6 @@ SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rO
SC_DLLPUBLIC sal_Bool UnregisterRefWindow( sal_uInt16 nSlotId, Window *pWnd );
SC_DLLPUBLIC sal_Bool IsAliveRefDlg( sal_uInt16 nSlotId, Window *pWnd );
SC_DLLPUBLIC Window * Find1RefWindow( sal_uInt16 nSlotId, Window *pWndAncestor );
- SC_DLLPUBLIC Window * Find1RefWindow( Window *pWndAncestor );
};
#define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) )
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index 90c9dfbc48ac..fc65823d273b 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -455,7 +455,8 @@ class SingleDoubleRefModifier
public:
SingleDoubleRefModifier( ScToken& rT )
{
- if ( rT.GetType() == formula::svSingleRef )
+ formula::StackVar eType = rT.GetType();
+ if ( eType == formula::svSingleRef || eType == formula::svExternalSingleRef )
{
pS = &rT.GetSingleRef();
aDub.Ref1 = aDub.Ref2 = *pS;
@@ -490,8 +491,9 @@ public:
SingleDoubleRefProvider( const ScToken& r )
: Ref1( r.GetSingleRef() ),
- Ref2( r.GetType() == formula::svDoubleRef ?
- r.GetDoubleRef().Ref2 : Ref1 )
+ Ref2( (r.GetType() == formula::svDoubleRef ||
+ r.GetType() == formula::svExternalDoubleRef) ?
+ r.GetDoubleRef().Ref2 : Ref1 )
{}
SingleDoubleRefProvider( const ScSingleRefData& r )
: Ref1( r ), Ref2( r )
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index b2f4565d5a45..df214b07cebc 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -95,6 +95,21 @@ public:
void ReadjustRelative3DReferences(
const ScAddress& rOldPos,
const ScAddress& rNewPos );
+
+ /**
+ * Make all absolute references external references pointing to the old document
+ *
+ * @param pOldDoc old document
+ * @param pNewDoc new document
+ * @param rPos position of the cell to determine if the reference is in the copied area
+ * @param bRangeName set for range names, range names have special handling for absolute sheet ref + relative col/row ref
+ */
+ void ReadjustAbsolute3DReferences( const ScDocument* pOldDoc, const ScDocument* pNewDoc, const ScAddress& rPos, bool bRangeName = false );
+
+ /**
+ * Make all absolute references pointing to the copied range if the range is copied too
+ */
+ void AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddress& rOldPos, const ScAddress& rNewPos );
};
#endif // SC_TOKENARRAY_HXX
diff --git a/sc/qa/extras/testdocuments/rangenames.ods b/sc/qa/extras/testdocuments/rangenames.ods
index 7a743d76ddab..1b101fde24be 100644
--- a/sc/qa/extras/testdocuments/rangenames.ods
+++ b/sc/qa/extras/testdocuments/rangenames.ods
Binary files differ
diff --git a/sc/qa/extras/testdocuments/rangenamessrc.ods b/sc/qa/extras/testdocuments/rangenamessrc.ods
new file mode 100644
index 000000000000..c780aefedfa9
--- /dev/null
+++ b/sc/qa/extras/testdocuments/rangenamessrc.ods
Binary files differ
diff --git a/sc/qa/extras/xnamecontainer.cxx b/sc/qa/extras/xnamecontainer.cxx
new file mode 100644
index 000000000000..0a4233577ed4
--- /dev/null
+++ b/sc/qa/extras/xnamecontainer.cxx
@@ -0,0 +1,85 @@
+/* -*- 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 or as specified alternatively below. 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.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * 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 <test/unoapi_test.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+
+
+namespace ScTableSheetsObj
+{
+
+class ScXNameContainer : public UnoApiTest
+{
+ uno::Reference< container::XNameContainer > init();
+
+ void testRemoveByName();
+
+ CPPUNIT_TEST_SUITE(ScXNameContainer);
+ CPPUNIT_TEST(testRemoveByName);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void ScXNameContainer::testRemoveByName()
+{
+ rtl::OUString aSheet2(RTL_CONSTASCII_USTRINGPARAM("Sheet2"));
+ uno::Reference< container::XNameContainer > xNameContainer = init();
+ CPPUNIT_ASSERT(xNameContainer->hasByName(aSheet2));
+ xNameContainer->removeByName(aSheet2);
+ CPPUNIT_ASSERT(!xNameContainer->hasByName(aSheet2));
+
+ bool bExceptionThrown = false;
+ try
+ {
+ xNameContainer->removeByName(aSheet2);
+ }
+ catch( const container::NoSuchElementException& )
+ {
+ std::cout << "Exception Caught" << std::endl;
+ bExceptionThrown = true;
+ }
+
+ CPPUNIT_ASSERT_MESSAGE("no exception thrown", bExceptionThrown);
+}
+
+uno::Reference< container::XNameContainer > ScXNameContainer::init()
+{
+ uno::Reference< lang::XComponent > xComponent;
+ xComponent = loadFromDesktop(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc")));
+ CPPUNIT_ASSERT(xComponent.is());
+ uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
+ uno::Reference< container::XNameContainer > xNameContainer ( xDoc->getSheets(), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xNameContainer.is());
+ return xNameContainer;
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScXNameContainer);
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/xnamedrange.cxx b/sc/qa/extras/xnamedrange.cxx
new file mode 100644
index 000000000000..616c8353b79f
--- /dev/null
+++ b/sc/qa/extras/xnamedrange.cxx
@@ -0,0 +1,201 @@
+/* -*- 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 or as specified alternatively below. 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.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Laurent Godard lgodard.libre@laposte.net (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * 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 <test/unoapi_test.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
+#include <com/sun/star/sheet/XNamedRanges.hpp>
+#include <com/sun/star/sheet/XNamedRange.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/sheet/Border.hpp>
+#include <com/sun/star/sheet/NamedRangeFlag.hpp>
+
+#include <rtl/oustringostreaminserter.hxx>
+
+namespace ScNamedRangeObj {
+
+class ScXNamedRange : public UnoApiTest
+{
+ uno::Reference< sheet::XSpreadsheetDocument> init();
+ uno::Reference< sheet::XNamedRange> getTestedNamedRange(const rtl::OUString&);
+
+ // XNamedRange
+ void testGetContent();
+ void testSetContent();
+ void testGetType();
+ void testSetType();
+ void testGetReferencePosition();
+ void testSetReferencePosition();
+
+ CPPUNIT_TEST_SUITE(ScXNamedRange);
+ CPPUNIT_TEST(testGetContent);
+ CPPUNIT_TEST(testSetContent);
+ CPPUNIT_TEST(testGetType);
+ CPPUNIT_TEST(testSetType);
+ CPPUNIT_TEST(testGetReferencePosition);
+ CPPUNIT_TEST(testSetReferencePosition);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+
+void ScXNamedRange::testGetContent()
+{
+ rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
+ uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+
+ rtl::OUString aExpectedContent(RTL_CONSTASCII_USTRINGPARAM("$Sheet1.$B$1"));
+ CPPUNIT_ASSERT_MESSAGE("Wrong expected content for initial1 on GetContent", xNamedRange->getContent().equals(aExpectedContent));
+}
+
+void ScXNamedRange::testSetContent()
+{
+ rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
+ uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+
+ rtl::OUString aExpectedContent;
+
+ // test a cell
+ aExpectedContent = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D1"));
+ xNamedRange->setContent(aExpectedContent);
+ CPPUNIT_ASSERT_MESSAGE("Wrong expected content for initial1 after SetContent a cell", xNamedRange->getContent().equals(aExpectedContent));
+
+ // test a cellrange
+ aExpectedContent = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D1:D10"));
+ xNamedRange->setContent(aExpectedContent);
+ CPPUNIT_ASSERT_MESSAGE("Wrong expected content for initial1 after SetContent a cellrange", xNamedRange->getContent().equals(aExpectedContent));
+
+ // test a formula
+ aExpectedContent = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=D10"));
+ xNamedRange->setContent(aExpectedContent);
+ aExpectedContent = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D10"));
+ CPPUNIT_ASSERT_MESSAGE("Wrong expected content for initial1 after SetContent a formula", xNamedRange->getContent().equals(aExpectedContent));
+
+}
+
+void ScXNamedRange::testGetType()
+{
+ rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
+ uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+ CPPUNIT_ASSERT_MESSAGE("Wrong expected Type", xNamedRange->getType() == 0);
+}
+
+void ScXNamedRange::testSetType()
+{
+ rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
+ uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+
+ sal_Int32 nType = ::sheet::NamedRangeFlag::ROW_HEADER;;
+ xNamedRange->setType(nType);
+ CPPUNIT_ASSERT_MESSAGE("Wrong expected Type ROW_HEADER after setting it", xNamedRange->getType() == nType);
+
+ nType = ::sheet::NamedRangeFlag::COLUMN_HEADER;
+ xNamedRange->setType(nType);
+ CPPUNIT_ASSERT_MESSAGE("Wrong expected Type COLUMN_HEADER after setting it", xNamedRange->getType() == nType);
+
+ nType = ::sheet::NamedRangeFlag::FILTER_CRITERIA;
+ xNamedRange->setType(nType);
+ CPPUNIT_ASSERT_MESSAGE("Wrong expected Type FILTER_CRITERIA after setting it", xNamedRange->getType() == nType);
+
+ nType = ::sheet::NamedRangeFlag::PRINT_AREA;
+ xNamedRange->setType(nType);
+ CPPUNIT_ASSERT_MESSAGE("Wrong expected Type PRINT_AREA after setting it", xNamedRange->getType() == nType);
+
+ nType = 0;
+ xNamedRange->setType(nType);
+ CPPUNIT_ASSERT_MESSAGE("Wrong expected Type 0 after setting it", xNamedRange->getType() == nType);
+}
+
+void ScXNamedRange::testGetReferencePosition()
+{
+ rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial2"));
+ uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+
+ table::CellAddress xCellAddress = xNamedRange->getReferencePosition();
+ // the expeted address is on B1, as it was the active cell when intial2 created
+ CPPUNIT_ASSERT_MESSAGE("Wrong SHEET reference position", xCellAddress.Sheet == 0);
+ CPPUNIT_ASSERT_MESSAGE("Wrong COLUMN reference position", xCellAddress.Column == 1);
+ CPPUNIT_ASSERT_MESSAGE("Wrong ROW reference position", xCellAddress.Row == 0);
+}
+
+void ScXNamedRange::testSetReferencePosition()
+{
+ rtl::OUString aTestedNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
+ uno::Reference< sheet::XNamedRange > xNamedRange = getTestedNamedRange(aTestedNamedRangeString);
+
+ table::CellAddress aBaseAddress = table::CellAddress(1,2,3);
+
+ xNamedRange->setReferencePosition(aBaseAddress);
+
+ table::CellAddress xCellAddress = xNamedRange->getReferencePosition();
+ CPPUNIT_ASSERT_MESSAGE("Wrong SHEET reference position after setting it", xCellAddress.Sheet == 1);
+ CPPUNIT_ASSERT_MESSAGE("Wrong COLUMN reference position after setting it", xCellAddress.Column == 2);
+ CPPUNIT_ASSERT_MESSAGE("Wrong ROW reference position after setting it", xCellAddress.Row == 3);
+}
+
+uno::Reference< sheet::XSpreadsheetDocument> ScXNamedRange::init()
+{
+ rtl::OUString aFileURL;
+ const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods"));
+ createFileURL(aFileBase, aFileURL);
+ static uno::Reference< lang::XComponent > xComponent;
+ if( !xComponent.is())
+ xComponent = loadFromDesktop(aFileURL);
+ uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDoc.is());
+
+ return xDoc;
+}
+
+uno::Reference< sheet::XNamedRange> ScXNamedRange::getTestedNamedRange(const rtl::OUString& aTestedNamedRangeString)
+{
+ uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
+ uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
+ rtl::OUString aNamedRangesPropertyString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< container::XNameAccess > xNamedRangesNameAccess(xPropSet->getPropertyValue(aNamedRangesPropertyString), UNO_QUERY_THROW);
+
+ uno::Reference< sheet::XNamedRange > xNamedRange(xNamedRangesNameAccess->getByName(aTestedNamedRangeString), UNO_QUERY_THROW);
+
+ return xNamedRange;
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScXNamedRange);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/xrangename.cxx b/sc/qa/extras/xnamedranges.cxx
index 2a61145c95d7..70a599698e57 100644
--- a/sc/qa/extras/xrangename.cxx
+++ b/sc/qa/extras/xnamedranges.cxx
@@ -38,8 +38,6 @@
#include <com/sun/star/sheet/XNamedRange.hpp>
#include <com/sun/star/table/XCell.hpp>
#include <com/sun/star/text/XTextRange.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
@@ -48,9 +46,9 @@
#include <rtl/oustringostreaminserter.hxx>
-namespace ScNamedRangeObj {
+namespace ScNamedRangesObj {
-class ScXNamedRange : public UnoApiTest
+class ScXNamedRanges : public UnoApiTest
{
uno::Reference< sheet::XSpreadsheetDocument> init();
@@ -60,7 +58,7 @@ class ScXNamedRange : public UnoApiTest
void testRemoveByName();
void testOutputList();
- CPPUNIT_TEST_SUITE(ScXNamedRange);
+ CPPUNIT_TEST_SUITE(ScXNamedRanges);
CPPUNIT_TEST(testAddNewByName);
CPPUNIT_TEST(testAddNewFromTitles);
//fix first warning in ExceptionsTestCaseDecorator
@@ -70,70 +68,70 @@ class ScXNamedRange : public UnoApiTest
};
-void ScXNamedRange::testAddNewByName()
+void ScXNamedRanges::testAddNewByName()
{
uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
- uno::Reference< beans::XPropertySet > propSet (xDoc, UNO_QUERY_THROW);
- rtl::OUString namedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< sheet::XNamedRanges > xNamedRanges(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
- uno::Reference< container::XNameAccess > xNamedRangesNameAccess(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
+ rtl::OUString aNamedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
+ uno::Reference< container::XNameAccess > xNamedRangesNameAccess(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
- table::CellAddress xBaseAddress = table::CellAddress(0,0,0);
+ table::CellAddress aBaseAddress = table::CellAddress(0,0,0);
sal_Int32 nType = 0;
- rtl::OUString content1(RTL_CONSTASCII_USTRINGPARAM("D1"));
- rtl::OUString name1(RTL_CONSTASCII_USTRINGPARAM("type_0"));
- xNamedRanges->addNewByName(name1, content1, xBaseAddress, nType);
- CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type 0 - Normal case", xNamedRanges->hasByName(name1));
+ rtl::OUString aContent1(RTL_CONSTASCII_USTRINGPARAM("D1"));
+ rtl::OUString aName1(RTL_CONSTASCII_USTRINGPARAM("type_0"));
+ xNamedRanges->addNewByName(aName1, aContent1, aBaseAddress, nType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type 0 - Normal case", xNamedRanges->hasByName(aName1));
nType = ::sheet::NamedRangeFlag::COLUMN_HEADER;
- rtl::OUString content2(RTL_CONSTASCII_USTRINGPARAM("D2"));
- rtl::OUString name2(RTL_CONSTASCII_USTRINGPARAM("type_COLUMN_HEADER"));
- xNamedRanges->addNewByName(name2, content2, xBaseAddress, nType);
- CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type COLUMN_HEADER", xNamedRanges->hasByName(name2));
+ rtl::OUString aContent2(RTL_CONSTASCII_USTRINGPARAM("D2"));
+ rtl::OUString aName2(RTL_CONSTASCII_USTRINGPARAM("type_COLUMN_HEADER"));
+ xNamedRanges->addNewByName(aName2, aContent2, aBaseAddress, nType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type COLUMN_HEADER", xNamedRanges->hasByName(aName2));
nType = ::sheet::NamedRangeFlag::FILTER_CRITERIA;
- rtl::OUString content3(RTL_CONSTASCII_USTRINGPARAM("D3"));
- rtl::OUString name3(RTL_CONSTASCII_USTRINGPARAM("type_FILTER_CRITERIA"));
- xNamedRanges->addNewByName(name3, content3, xBaseAddress, nType);
- CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type FILTER_CRITERIA", xNamedRanges->hasByName(name3));
+ rtl::OUString aContent3(RTL_CONSTASCII_USTRINGPARAM("D3"));
+ rtl::OUString aName3(RTL_CONSTASCII_USTRINGPARAM("type_FILTER_CRITERIA"));
+ xNamedRanges->addNewByName(aName3, aContent3, aBaseAddress, nType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type FILTER_CRITERIA", xNamedRanges->hasByName(aName3));
nType = ::sheet::NamedRangeFlag::PRINT_AREA;
- rtl::OUString content4(RTL_CONSTASCII_USTRINGPARAM("D4"));
- rtl::OUString name4(RTL_CONSTASCII_USTRINGPARAM("type_PRINT_AREA"));
- xNamedRanges->addNewByName(name4, content4, xBaseAddress, nType);
- CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type PRINT_AREA", xNamedRanges->hasByName(name4));
+ rtl::OUString aContent4(RTL_CONSTASCII_USTRINGPARAM("D4"));
+ rtl::OUString aName4(RTL_CONSTASCII_USTRINGPARAM("type_PRINT_AREA"));
+ xNamedRanges->addNewByName(aName4, aContent4, aBaseAddress, nType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type PRINT_AREA", xNamedRanges->hasByName(aName4));
nType = ::sheet::NamedRangeFlag::ROW_HEADER;
- rtl::OUString content5(RTL_CONSTASCII_USTRINGPARAM("D5"));
- rtl::OUString name5(RTL_CONSTASCII_USTRINGPARAM("type_ROW_HEADERA"));
- xNamedRanges->addNewByName(name5, content5, xBaseAddress, nType);
- CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type ROW_HEADER", xNamedRanges->hasByName(name5));
+ rtl::OUString aContent5(RTL_CONSTASCII_USTRINGPARAM("D5"));
+ rtl::OUString aName5(RTL_CONSTASCII_USTRINGPARAM("type_ROW_HEADER"));
+ xNamedRanges->addNewByName(aName5, aContent5, aBaseAddress, nType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type ROW_HEADER", xNamedRanges->hasByName(aName5));
}
-void ScXNamedRange::testAddNewFromTitles()
+void ScXNamedRanges::testAddNewFromTitles()
{
uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(1), UNO_QUERY_THROW);
- uno::Reference< beans::XPropertySet > propSet (xDoc, UNO_QUERY_THROW);
- rtl::OUString namedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< sheet::XNamedRanges > xNamedRanges(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
- uno::Reference< container::XIndexAccess > xNamedRangesIndex(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
- uno::Reference< container::XNameAccess > xNamedRangesNameAccess(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
+ rtl::OUString aNamedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xNamedRangesIndex(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
+ uno::Reference< container::XNameAccess > xNamedRangesNameAccess(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
- table::CellRangeAddress xCellRangeAddress = table::CellRangeAddress(1,0,0,3,3);
+ table::CellRangeAddress aCellRangeAddress = table::CellRangeAddress(1,0,0,3,3);
rtl::OUString aString;
uno::Reference< table::XCell > xCell;
- xNamedRanges->addNewFromTitles(xCellRangeAddress, sheet::Border_TOP);
+ xNamedRanges->addNewFromTitles(aCellRangeAddress, sheet::Border_TOP);
for (sal_Int32 i = 1; i < 4; i++)
{
@@ -158,7 +156,7 @@ void ScXNamedRange::testAddNewFromTitles()
CPPUNIT_ASSERT(cellRangeAddress.Sheet == 1);
}
- xNamedRanges->addNewFromTitles(xCellRangeAddress, sheet::Border_LEFT);
+ xNamedRanges->addNewFromTitles(aCellRangeAddress, sheet::Border_LEFT);
for (sal_Int32 i = 1; i < 4; i++)
{
@@ -184,13 +182,13 @@ void ScXNamedRange::testAddNewFromTitles()
}
}
-void ScXNamedRange::testRemoveByName()
+void ScXNamedRanges::testRemoveByName()
{
uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
- uno::Reference< beans::XPropertySet > propSet (xDoc, UNO_QUERY_THROW);
- rtl::OUString namedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< sheet::XNamedRanges > xNamedRanges(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
- uno::Reference< container::XIndexAccess > xIndex(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
+ rtl::OUString aNamedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xIndex(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
rtl::OUString aNr1(RTL_CONSTASCII_USTRINGPARAM("initial1"));
bool bHasIt = xNamedRanges->hasByName(aNr1);
@@ -203,16 +201,14 @@ void ScXNamedRange::testRemoveByName()
xNamedRanges->removeByName(aNr1);
sal_Int32 nNewCount = xIndex->getCount();
CPPUNIT_ASSERT_MESSAGE("NamedRange initial1 not removed", nNewCount == nInitialCount - 1);
- bool bHasItAgain = xNamedRanges->hasByName(aNr1);
- CPPUNIT_ASSERT_MESSAGE("Wrong NamedRange removed, initial1 still present", !bHasItAgain);
-
- rtl::OUString nr2(RTL_CONSTASCII_USTRINGPARAM("dummyNamedRange"));
- xNamedRanges->removeByName(aNr1);
- // should throw an exception
+ CPPUNIT_ASSERT_MESSAGE("Wrong NamedRange removed, initial1 still present", !xNamedRanges->hasByName(aNr1));
+ // try to remove non existing
+ rtl::OUString aNr2(RTL_CONSTASCII_USTRINGPARAM("dummyNonExistingNamedRange"));
+ xNamedRanges->removeByName(aNr2);// an exception should be raised here
}
}
-void ScXNamedRange::testOutputList()
+void ScXNamedRanges::testOutputList()
{
uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
@@ -221,10 +217,10 @@ void ScXNamedRange::testOutputList()
table::CellAddress xCellAddress = table::CellAddress (0,2,0);
- uno::Reference< beans::XPropertySet > propSet (xDoc, UNO_QUERY_THROW);
- rtl::OUString namedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< sheet::XNamedRanges > xNamedRanges(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
- uno::Reference< container::XIndexAccess > xNamedRangesIndex(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
+ rtl::OUString aNamedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xNamedRangesIndex(xPropSet->getPropertyValue(aNamedRangesString), UNO_QUERY_THROW);
sal_Int32 nElementsCount = xNamedRangesIndex->getCount();
xNamedRanges->outputList(xCellAddress);
@@ -242,7 +238,7 @@ void ScXNamedRange::testOutputList()
}
}
-uno::Reference< sheet::XSpreadsheetDocument> ScXNamedRange::init()
+uno::Reference< sheet::XSpreadsheetDocument> ScXNamedRanges::init()
{
rtl::OUString aFileURL;
const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods"));
@@ -256,9 +252,7 @@ uno::Reference< sheet::XSpreadsheetDocument> ScXNamedRange::init()
return xDoc;
}
-CPPUNIT_TEST_SUITE_REGISTRATION(ScXNamedRange);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
+CPPUNIT_TEST_SUITE_REGISTRATION(ScXNamedRanges);
}
diff --git a/sc/qa/extras/xspreadsheets2.cxx b/sc/qa/extras/xspreadsheets2.cxx
new file mode 100644
index 000000000000..31a59f371c7a
--- /dev/null
+++ b/sc/qa/extras/xspreadsheets2.cxx
@@ -0,0 +1,265 @@
+/* -*- 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 or as specified alternatively below. 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.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Laurent Godard lgodard.libre@laposte.net (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * 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 <test/unoapi_test.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XSpreadsheets2.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
+#include <com/sun/star/sheet/XNamedRanges.hpp>
+#include <com/sun/star/sheet/XNamedRange.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/sheet/Border.hpp>
+#include <com/sun/star/sheet/NamedRangeFlag.hpp>
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/table/CellVertJustify.hpp>
+
+#include <rtl/oustringostreaminserter.hxx>
+
+namespace ScSpreadsheetObj {
+
+class ScXSpreadsheets2 : public UnoApiTest
+{
+ uno::Reference< sheet::XSpreadsheetDocument> getDoc(const rtl::OUString);
+ uno::Reference< sheet::XNamedRanges> getNamedRanges(uno::Reference< sheet::XSpreadsheetDocument >);
+
+ // XSpreadsheets2
+ void testImportSheet();
+
+ CPPUNIT_TEST_SUITE(ScXSpreadsheets2);
+ // disable test, test fails, might be the ongoing copy refs work
+ CPPUNIT_TEST(testImportSheet);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+
+void ScXSpreadsheets2::testImportSheet()
+{
+ const rtl::OUString aSrcFileBase(RTL_CONSTASCII_USTRINGPARAM("rangenamessrc.ods"));
+ uno::Reference< sheet::XSpreadsheetDocument> xSrcDoc = getDoc(aSrcFileBase);
+ CPPUNIT_ASSERT(xSrcDoc.is());
+
+ uno::Reference< container::XNameAccess > xSrcNamedRangesNameAccess (getNamedRanges(xSrcDoc), UNO_QUERY_THROW);
+
+ const rtl::OUString aDestFileBase(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods"));
+ uno::Reference< sheet::XSpreadsheetDocument> xDestDoc = getDoc(aDestFileBase);
+ CPPUNIT_ASSERT(xDestDoc.is());
+ uno::Reference< sheet::XSpreadsheets2 > xDest (xDestDoc->getSheets(), UNO_QUERY_THROW);
+
+ uno::Reference< container::XNameAccess > xDestNamedRangesNameAccess(getNamedRanges(xDestDoc), UNO_QUERY_THROW);
+
+ // import sheet
+ const sal_Int32 nDestPos = 0;
+ const rtl::OUString aSrcSheetName(RTL_CONSTASCII_USTRINGPARAM("SheetToCopy"));
+ sal_Int32 nDestPosEffecive = xDest->importSheet(xSrcDoc, aSrcSheetName, nDestPos);
+
+ //sheet index in dest is ok
+ CPPUNIT_ASSERT_MESSAGE("Wrong sheet index", nDestPosEffecive == nDestPos);
+
+ uno::Reference< container::XNameAccess > xDestSheetNameAccess (xDestDoc->getSheets(), UNO_QUERY_THROW);
+ uno::Reference< sheet::XSpreadsheet > xDestSheet( xDestSheetNameAccess->getByName(aSrcSheetName), UNO_QUERY_THROW);
+
+ uno::Reference< container::XNameAccess > xSrcSheetNameAccess (xSrcDoc->getSheets(), UNO_QUERY_THROW);
+ uno::Reference< sheet::XSpreadsheet > xSrcSheet( xSrcSheetNameAccess->getByName(aSrcSheetName), UNO_QUERY_THROW);
+
+ //new sheet name in dest is ok
+ CPPUNIT_ASSERT_MESSAGE("Wrong sheet name", xDestSheetNameAccess->hasByName(aSrcSheetName));
+
+ uno::Reference< table::XCell > xDestCell;
+ uno::Reference< table::XCell > xSrcCell;
+
+ //imported string
+ xSrcCell = xSrcSheet->getCellByPosition(0,0);
+ uno::Reference< text::XTextRange > xSrcTextRange(xSrcCell, UNO_QUERY_THROW);
+ rtl::OUString aSrcString = xSrcTextRange->getString();
+
+ xDestCell = xDestSheet->getCellByPosition(0,0);
+ uno::Reference< text::XTextRange > xDestTextRange(xDestCell, UNO_QUERY_THROW);
+ rtl::OUString aDestString = xDestTextRange->getString();
+
+ CPPUNIT_ASSERT_MESSAGE("Wrong string imported", aDestString.equals(aSrcString));
+
+ //imported value
+ xSrcCell = xSrcSheet->getCellByPosition(1,0);
+ sal_Int32 aSrcValue = xSrcCell->getValue();
+
+ xDestCell = xDestSheet->getCellByPosition(1,0);
+ sal_Int32 aDestValue = xDestCell->getValue();
+
+ CPPUNIT_ASSERT_MESSAGE("Wrong value imported", aSrcValue == aDestValue);
+
+ //mathematical formula
+ xSrcCell = xSrcSheet->getCellByPosition(2,0);
+ rtl::OUString aSrcFormula = xSrcCell->getFormula();
+
+ xDestCell = xDestSheet->getCellByPosition(2,0);
+ rtl::OUString aDestFormula = xDestCell->getFormula();
+
+ // potential problem later: formulas might be adjusted
+ // add some tests that the formulas are correctly adjusted
+ CPPUNIT_ASSERT_MESSAGE("Wrong formula imported", aDestFormula.equals(aSrcFormula));
+
+ //formula with an already existing named range in dest - initial1
+ xSrcCell = xSrcSheet->getCellByPosition(3,0);
+ aSrcFormula = xSrcCell->getFormula();
+
+ xDestCell = xDestSheet->getCellByPosition(3,0);
+ aDestFormula = xDestCell->getFormula();
+
+ CPPUNIT_ASSERT_MESSAGE("Wrong Namedrange formula imported", aDestFormula.equals(aSrcFormula));
+
+ // initial NamedRange content is correct
+ rtl::OUString aNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial1"));
+
+ uno::Any aNr = xDestNamedRangesNameAccess->getByName(aNamedRangeString);
+ uno::Reference< sheet::XNamedRange > xDestNamedRange(aNr, UNO_QUERY_THROW);
+ rtl::OUString aNrDestContent = xDestNamedRange->getContent();
+
+ aNr = xSrcNamedRangesNameAccess->getByName(aNamedRangeString);
+ uno::Reference< sheet::XNamedRange > xSrcNamedRange(aNr, UNO_QUERY_THROW);
+ rtl::OUString aNrSrcContent = xSrcNamedRange->getContent();
+
+ std::cout << "testImportSheet : initial1 aNrDestContent " << aNrDestContent << std::endl; // is $Sheet1.$B$1
+ std::cout << "testImportSheet : initial1 aNrSrcContent " << aNrSrcContent << std::endl; // is $Sheet1.$B$2
+ rtl::OUString aExpectedContent(RTL_CONSTASCII_USTRINGPARAM("$Sheet1.$B$1"));
+ CPPUNIT_ASSERT_MESSAGE("Sheet name for initial1 has been changed in dest (expected $Sheet1.$B$1) ", aNrDestContent.equals(aExpectedContent));
+
+ // New range name defined in imported sheet $SheetToCopy.$A$7
+ rtl::OUString aNewInSheetNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("InSheetRangeName"));
+ CPPUNIT_ASSERT_MESSAGE("InSheetRangeName", xDestNamedRangesNameAccess->hasByName(aNewInSheetNamedRangeString));
+
+ uno::Any aNewInSheetNr = xDestNamedRangesNameAccess->getByName(aNewInSheetNamedRangeString);
+ uno::Reference< sheet::XNamedRange > xDestNewInSheetNamedRange(aNewInSheetNr, UNO_QUERY_THROW);
+ rtl::OUString aNewInSheetNrDestContent = xDestNewInSheetNamedRange->getContent();
+ rtl::OUString aNewInSheetExpectedContent(RTL_CONSTASCII_USTRINGPARAM("$SheetToCopy.$A$7"));
+ std::cout << "testImportSheet : InSheetRangeName content " << aNewInSheetNrDestContent << std::endl;
+ //CPPUNIT_ASSERT_MESSAGE("Wrong address for InSheetRangeName", aNewInSheetNrDestContent.equals(aNewInSheetExpectedContent));
+
+ // the source file redefines an existing named range in the imported sheet --> the target should not be changed
+ rtl::OUString aRedefinedInSheetNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("initial2"));
+ CPPUNIT_ASSERT_MESSAGE("aRedefinedInSheetNamedRangeString", xDestNamedRangesNameAccess->hasByName(aRedefinedInSheetNamedRangeString));
+
+ uno::Any aRedefinedInSheetNr = xDestNamedRangesNameAccess->getByName(aRedefinedInSheetNamedRangeString);
+ uno::Reference< sheet::XNamedRange > xDestRedefinedInSheetNamedRange(aRedefinedInSheetNr, UNO_QUERY_THROW);
+ rtl::OUString aRedefinedInSheetNrDestContent = xDestRedefinedInSheetNamedRange->getContent();
+ rtl::OUString aRedefinedInSheetExpectedContent(RTL_CONSTASCII_USTRINGPARAM("$Sheet1.$B$2"));
+ std::cout << "testImportSheet : initial2 content " << aRedefinedInSheetNrDestContent << std::endl;
+ CPPUNIT_ASSERT_MESSAGE("Wrong address for Redefined InSheet named range", aRedefinedInSheetNrDestContent.equals(aRedefinedInSheetExpectedContent));
+
+ //formula with a non-existant named range in dest - new_rangename
+ rtl::OUString aNewNamedRangeString(RTL_CONSTASCII_USTRINGPARAM("new_rangename"));
+ CPPUNIT_ASSERT_MESSAGE("New NamedRange not created", xDestNamedRangesNameAccess->hasByName(aNewNamedRangeString));
+
+ // verify the content of this new namedrange, pointing on $Sheet1.$B$1 in source. This address is already defined in target as NR content
+
+ uno::Any aNewNr = xDestNamedRangesNameAccess->getByName(aNewNamedRangeString);
+ uno::Reference< sheet::XNamedRange > xDestNewNamedRange(aNewNr, UNO_QUERY_THROW);
+ rtl::OUString aNewNrDestContent = xDestNewNamedRange->getContent();
+
+ rtl::OUString aNewExpectedContent(RTL_CONSTASCII_USTRINGPARAM("$Sheet1.$B$1"));
+/*
+ xSrcCell = xSrcSheet->getCellByPosition(4,0);
+ uno::Reference< text::XTextRange > xSrcTextRange3(xSrcCell, UNO_QUERY_THROW);
+ aSrcString = xSrcTextRange3->getString();
+
+ xDestCell = xDestSheet->getCellByPosition(4,0);
+ uno::Reference< text::XTextRange > xDestTextRange3(xDestCell, UNO_QUERY_THROW);
+ aDestString = xDestTextRange3->getString();
+*/
+ std::cout << "testImportSheet : new_rangename aNewExpectedContent " << aNewExpectedContent << std::endl;
+ std::cout << "testImportSheet : new_rangename aNewNrDestContent " << aNewNrDestContent << std::endl;
+ CPPUNIT_ASSERT_MESSAGE("Wrong New NamedRange formula string value", aNewExpectedContent.equals(aNewExpectedContent));
+
+ //new style created in dest
+ uno::Reference< beans::XPropertySet > xSrcCellPropSet (xSrcCell, UNO_QUERY_THROW);
+ const rtl::OUString aCellProperty(RTL_CONSTASCII_USTRINGPARAM("CellStyle"));
+ rtl::OUString aSrcStyleName;
+ CPPUNIT_ASSERT(xSrcCellPropSet->getPropertyValue(aCellProperty) >>= aSrcStyleName);
+
+ uno::Reference< beans::XPropertySet > xDestCellPropSet (xSrcCell, UNO_QUERY_THROW);
+ rtl::OUString aDestStyleName;
+ CPPUNIT_ASSERT(xDestCellPropSet->getPropertyValue(aCellProperty) >>= aDestStyleName);
+
+ CPPUNIT_ASSERT_MESSAGE("Wrong imported Cell Style", aDestStyleName.equals(aSrcStyleName));
+
+ uno::Reference< style::XStyleFamiliesSupplier > xFamiliesSupplier (xDestDoc, UNO_QUERY_THROW);
+ uno::Reference< container::XNameAccess > xFamiliesNameAccess (xFamiliesSupplier->getStyleFamilies(), UNO_QUERY_THROW);
+ rtl::OUString aCellFamilyName(RTL_CONSTASCII_USTRINGPARAM("CellStyles"));
+ uno::Any xCellStylesFamily = xFamiliesNameAccess->getByName(aCellFamilyName);
+ uno::Reference< container::XNameContainer > xCellStylesFamilyNameAccess (xCellStylesFamily, UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT_MESSAGE("New cell style not present", xCellStylesFamilyNameAccess->hasByName(aDestStyleName));
+
+ uno::Any aCellStyle = xCellStylesFamilyNameAccess->getByName(aDestStyleName);
+ uno::Reference< beans::XPropertySet > xCellStyleProp (aCellStyle, UNO_QUERY_THROW);
+ rtl::OUString aProperty(RTL_CONSTASCII_USTRINGPARAM("VertJustify"));
+ sal_Int32 aVertJustify = 0;
+ CPPUNIT_ASSERT(xCellStyleProp->getPropertyValue(aProperty) >>= aVertJustify);
+
+ CPPUNIT_ASSERT_MESSAGE("New style: VertJustify not set", aVertJustify == table::CellVertJustify_CENTER);
+}
+
+uno::Reference< sheet::XSpreadsheetDocument> ScXSpreadsheets2::getDoc(const rtl::OUString aFileBase)
+{
+ rtl::OUString aFileURL;
+ createFileURL(aFileBase, aFileURL);
+ uno::Reference< lang::XComponent > xComponent;
+ xComponent = loadFromDesktop(aFileURL);
+
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComponent, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDoc.is());
+ return xDoc;
+}
+
+uno::Reference< sheet::XNamedRanges> ScXSpreadsheets2::getNamedRanges(uno::Reference< sheet::XSpreadsheetDocument> xDoc)
+{
+ uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW);
+ rtl::OUString NamedRangesPropertyString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue(NamedRangesPropertyString), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xNamedRanges.is());
+
+ return xNamedRanges;
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScXSpreadsheets2);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a4158c3e1bc5..f98195da9378 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2738,8 +2738,8 @@ void Test::testCopyPaste()
//check values after copying
rtl::OUString aString;
m_pDoc->GetValue(1,1,1, aValue);
- CPPUNIT_ASSERT_MESSAGE("copied formula should return 2", aValue == 2);
m_pDoc->GetFormula(1,1,1, aString);
+ CPPUNIT_ASSERT_MESSAGE("copied formula should return 2", aValue == 2);
CPPUNIT_ASSERT_MESSAGE("formula string was not copied correctly", aString == aFormulaString);
m_pDoc->GetValue(0,1,1, aValue);
CPPUNIT_ASSERT_MESSAGE("copied value should be 1", aValue == 1);
diff --git a/sc/qa/unoapi/sc.sce b/sc/qa/unoapi/sc.sce
index 3e4dfcb60104..b35fdd0bdcc8 100644
--- a/sc/qa/unoapi/sc.sce
+++ b/sc/qa/unoapi/sc.sce
@@ -37,8 +37,8 @@
-o sc.ScChartObj
-o sc.ScChartsObj
-o sc.ScConsolidationDescriptor
--o sc.ScDDELinkObj
--o sc.ScDDELinksObj
+# fdo43376 -o sc.ScDDELinkObj
+# fdo43376 -o sc.ScDDELinksObj
-o sc.ScDataPilotFieldGroupItemObj
-o sc.ScDataPilotFieldGroupObj
-o sc.ScDataPilotFieldGroupsObj
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 6cc8209f909e..cf5f70ffbd9e 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -179,6 +179,12 @@ void adjustRangeName(ScToken* pToken, ScDocument& rNewDoc, const ScDocument* pOl
{
bNewGlobal = bOldGlobal;
pRangeData = new ScRangeData(*pOldRangeData, &rNewDoc);
+ ScTokenArray* pRangeNameToken = pRangeData->GetCode();
+ if (rNewDoc.GetPool() != const_cast<ScDocument*>(pOldDoc)->GetPool())
+ {
+ pRangeNameToken->ReadjustAbsolute3DReferences(pOldDoc, &rNewDoc, pRangeData->GetPos(), true);
+ }
+
bool bInserted;
if (bNewGlobal)
bInserted = rNewDoc.GetRangeName()->insert(pRangeData);
@@ -881,6 +887,13 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons
adjustDBRange(pToken, rDoc, rCell.pDocument);
}
}
+
+ if (pDocument->GetPool() != rCell.pDocument->GetPool())
+ {
+ pCode->ReadjustAbsolute3DReferences( rCell.pDocument, &rDoc, rCell.aPos);
+ }
+
+ pCode->AdjustAbsoluteRefs( rCell.pDocument, rCell.aPos, aPos );
}
if( !bCompile )
diff --git a/sc/source/core/data/clipparam.cxx b/sc/source/core/data/clipparam.cxx
index b7e44144eb83..65155403f8bb 100644
--- a/sc/source/core/data/clipparam.cxx
+++ b/sc/source/core/data/clipparam.cxx
@@ -192,21 +192,4 @@ void ScClipParam::transpose()
maRanges = aNewRanges;
}
-// ============================================================================
-
-ScClipRangeNameData::ScClipRangeNameData() :
- mbReplace(false)
-{
-}
-
-ScClipRangeNameData::~ScClipRangeNameData()
-{
-}
-
-void ScClipRangeNameData::insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex)
-{
- maRangeMap.insert(
- ScRangeData::IndexMap::value_type(nOldIndex, nNewIndex));
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 37005ee37298..aa99070d9b77 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -41,6 +41,7 @@
#include <svx/svdobj.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/objsh.hxx>
+#include <sfx2/docfile.hxx>
#include <sfx2/printer.hxx>
#include <svl/zforlist.hxx>
#include <svl/zformat.hxx>
@@ -48,6 +49,7 @@
#include <comphelper/processfactory.hxx>
#include <svl/PasswordHelper.hxx>
#include <tools/tenccvt.hxx>
+#include <tools/urlobj.hxx>
#include <rtl/crc.h>
#include <basic/basmgr.hxx>
@@ -920,8 +922,21 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
bool bResultsOnly )
{
sal_uLong nRetVal = 1; // 0 => Fehler 1 = ok
- // 2 => RefBox, 3 => NameBox
+ // 3 => NameBox
// 4 => beides
+
+ if (pSrcDoc->pShell->GetMedium())
+ {
+ pSrcDoc->maFileURL = pSrcDoc->pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI);
+ // for unsaved files use the title name and adjust during save of file
+ if (pSrcDoc->maFileURL.isEmpty())
+ pSrcDoc->maFileURL = pSrcDoc->pShell->GetName();
+ }
+ else
+ {
+ pSrcDoc->maFileURL = pSrcDoc->pShell->GetName();
+ }
+
bool bValid = true;
if (bInsertNew) // neu einfuegen
{
@@ -1046,15 +1061,8 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
maTabs[nDestPos]->UpdateReference(URM_COPY, 0, 0, nDestPos,
MAXCOL, MAXROW, nDestPos,
0, 0, nDz, NULL);
- // Test for outside absolute references for info box
- bool bIsAbsRef = pSrcDoc->maTabs[nSrcPos]->TestTabRefAbs(nSrcPos);
// Readjust self-contained absolute references to this sheet
maTabs[nDestPos]->TestTabRefAbs(nSrcPos);
- if (bIsAbsRef)
- {
- nRetVal += 1;
- // InfoBox AbsoluteRefs sind moeglicherweise nicht mehr korrekt!!
- }
if (bNamesLost)
{
nRetVal += 2;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index efb003ba8f1b..eb03a7420b99 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -42,12 +42,14 @@
#include <svx/svdocapt.hxx>
#include <sfx2/app.hxx>
#include <sfx2/objsh.hxx>
+#include <sfx2/docfile.hxx>
#include <svl/poolcach.hxx>
#include <unotools/saveopt.hxx>
#include <svl/zforlist.hxx>
#include <unotools/charclass.hxx>
#include <unotools/transliterationwrapper.hxx>
#include <tools/tenccvt.hxx>
+#include <tools/urlobj.hxx>
#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
@@ -97,6 +99,9 @@
#include <map>
#include <limits>
+#include <rtl/oustringostreaminserter.hxx>
+#include <iostream>
+
using ::editeng::SvxBorderLine;
using namespace ::com::sun::star;
@@ -180,6 +185,14 @@ bool ScDocument::GetName( SCTAB nTab, rtl::OUString& rName ) const
return false;
}
+rtl::OUString ScDocument::GetCopyTabName( SCTAB nTab ) const
+{
+ if (nTab < static_cast<SCTAB>(maTabNames.size()))
+ return maTabNames[nTab];
+ else
+ return rtl::OUString();
+}
+
bool ScDocument::SetCodeName( SCTAB nTab, const rtl::OUString& rName )
{
if (VALIDTAB(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
@@ -1675,6 +1688,7 @@ void ScDocument::InitUndoSelected( ScDocument* pSrcDoc, const ScMarkData& rTabSe
xPoolHelper = pSrcDoc->xPoolHelper;
+
rtl::OUString aString;
for (SCTAB nTab = 0; nTab <= rTabSelection.GetLastSelected(); nTab++)
if ( rTabSelection.GetTableSelect( nTab ) )
@@ -1694,9 +1708,9 @@ void ScDocument::InitUndoSelected( ScDocument* pSrcDoc, const ScMarkData& rTabSe
}
}
else
- {
+ {
OSL_FAIL("InitUndo");
- }
+ }
}
@@ -1708,6 +1722,12 @@ void ScDocument::InitUndo( ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
Clear();
xPoolHelper = pSrcDoc->xPoolHelper;
+ if (pSrcDoc->pShell->GetMedium())
+ {
+ maFileURL = pSrcDoc->pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI);
+ std::cout << "SfxMedium: " << maFileURL << std::endl;
+ std::cout << "GetName: " << rtl::OUString(pSrcDoc->pShell->GetName()) << std::endl;
+ }
rtl::OUString aString;
if ( nTab2 >= static_cast<SCTAB>(maTabs.size()))
@@ -1893,6 +1913,31 @@ void ScDocument::CopyToClip(const ScClipParam& rClipParam,
pClipDoc = SC_MOD()->GetClipDoc();
}
+ if (pShell->GetMedium())
+ {
+ pClipDoc->maFileURL = pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI);
+ // for unsaved files use the title name and adjust during save of file
+ if (pClipDoc->maFileURL.isEmpty())
+ pClipDoc->maFileURL = pShell->GetName();
+ }
+ else
+ {
+ pClipDoc->maFileURL = pShell->GetName();
+ }
+
+ //init maTabNames
+ for (TableContainer::iterator itr = maTabs.begin(); itr != maTabs.end(); ++itr)
+ {
+ if( *itr )
+ {
+ rtl::OUString aTabName;
+ (*itr)->GetName(aTabName);
+ pClipDoc->maTabNames.push_back(aTabName);
+ }
+ else
+ pClipDoc->maTabNames.push_back(rtl::OUString());
+ }
+
pClipDoc->aDocName = aDocName;
pClipDoc->SetClipParam(rClipParam);
ScRange aClipRange = rClipParam.getWholeRange();
@@ -1943,6 +1988,31 @@ void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
{
if (!bIsClip)
{
+ if (pShell->GetMedium())
+ {
+ pClipDoc->maFileURL = pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI);
+ // for unsaved files use the title name and adjust during save of file
+ if (pClipDoc->maFileURL.isEmpty())
+ pClipDoc->maFileURL = pShell->GetName();
+ }
+ else
+ {
+ pClipDoc->maFileURL = pShell->GetName();
+ }
+
+ //init maTabNames
+ for (TableContainer::iterator itr = maTabs.begin(); itr != maTabs.end(); ++itr)
+ {
+ if( *itr )
+ {
+ rtl::OUString aTabName;
+ (*itr)->GetName(aTabName);
+ pClipDoc->maTabNames.push_back(aTabName);
+ }
+ else
+ pClipDoc->maTabNames.push_back(rtl::OUString());
+ }
+
PutInOrder( nCol1, nCol2 );
PutInOrder( nRow1, nRow2 );
if (!pClipDoc)
@@ -2114,116 +2184,6 @@ void ScDocument::MergeNumberFormatter(ScDocument* pSrcDoc)
}
}
-void ScDocument::CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames)
-{
- if (!pClipDoc->pRangeName)
- return;
-
- ScClipRangeNameData aClipRangeNames;
-
- ScRangeName::const_iterator itr = pClipDoc->pRangeName->begin();
- ScRangeName::const_iterator itrEnd = pClipDoc->pRangeName->end();
- for (; itr != itrEnd; ++itr) //! DB-Bereiche Pivot-Bereiche auch
- {
- /* Copy only if the name doesn't exist in this document.
- If it exists we use the already existing name instead,
- another possibility could be to create new names if
- documents differ.
- A proper solution would ask the user how to proceed.
- The adjustment of the indices in the formulas is done later.
- */
- const ScRangeData* pExistingData = GetRangeName()->findByUpperName(itr->first);
- if (pExistingData)
- {
- sal_uInt16 nOldIndex = itr->second->GetIndex();
- sal_uInt16 nNewIndex = pExistingData->GetIndex();
- aClipRangeNames.insert(nOldIndex, nNewIndex);
- if ( !aClipRangeNames.mbReplace )
- aClipRangeNames.mbReplace = ( nOldIndex != nNewIndex );
- }
- else
- {
- ScRangeData* pData = new ScRangeData( *itr->second );
- pData->SetDocument(this);
- if ( pRangeName->findByIndex( pData->GetIndex() ) )
- pData->SetIndex(0); // need new index, done in Insert
- if ( pRangeName->insert(pData) )
- {
- aClipRangeNames.mpRangeNames.push_back(pData);
- sal_uInt16 nOldIndex = itr->second->GetIndex();
- sal_uInt16 nNewIndex = pData->GetIndex();
- aClipRangeNames.insert(nOldIndex, nNewIndex);
- if ( !aClipRangeNames.mbReplace )
- aClipRangeNames.mbReplace = ( nOldIndex != nNewIndex );
- }
- else
- { // must be an overflow
- pData = NULL;
- aClipRangeNames.insert(itr->second->GetIndex(), 0);
- aClipRangeNames.mbReplace = true;
- }
- }
- }
- rRangeNames = aClipRangeNames;
-}
-
-void ScDocument::UpdateRangeNamesInFormulas(
- ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark,
- SCCOL nXw, SCROW nYw)
-{
- // nXw and nYw are the extra width and height of the destination range
- // extended due to presence of merged cell(s).
-
- if (!rRangeNames.mbReplace)
- return;
-
- // first update all inserted named formulas if they contain other
- // range names and used indices changed
- for (size_t i = 0, n = rRangeNames.mpRangeNames.size(); i < n; ++i) //! DB-Bereiche Pivot-Bereiche auch
- {
- rRangeNames.mpRangeNames[i]->ReplaceRangeNamesInUse(rRangeNames.maRangeMap);
- }
- // then update the formulas, they might need just the updated range names
- for ( size_t nRange = 0, n = rDestRanges.size(); nRange < n; ++nRange )
- {
- const ScRange* pRange = rDestRanges[nRange];
- SCCOL nCol1 = pRange->aStart.Col();
- SCROW nRow1 = pRange->aStart.Row();
- SCCOL nCol2 = pRange->aEnd.Col();
- SCROW nRow2 = pRange->aEnd.Row();
-
- SCCOL nC1 = nCol1;
- SCROW nR1 = nRow1;
- SCCOL nC2 = nC1 + nXw;
- if (nC2 > nCol2)
- nC2 = nCol2;
- SCROW nR2 = nR1 + nYw;
- if (nR2 > nRow2)
- nR2 = nRow2;
- do
- {
- do
- {
- ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
- for (; itr != itrEnd; ++itr)
- {
- if ( maTabs[*itr] )
- maTabs[*itr]->ReplaceRangeNamesInUse(nC1, nR1,
- nC2, nR2, rRangeNames.maRangeMap);
- }
- nC1 = nC2 + 1;
- nC2 = Min((SCCOL)(nC1 + nXw), nCol2);
- } while (nC1 <= nCol2);
- nC1 = nCol1;
- nC2 = nC1 + nXw;
- if (nC2 > nCol2)
- nC2 = nCol2;
- nR1 = nR2 + 1;
- nR2 = Min((SCROW)(nR1 + nYw), nRow2);
- } while (nR1 <= nRow2);
- }
-}
-
ScClipParam& ScDocument::GetClipParam()
{
if (!mpClipParam.get())
@@ -2428,9 +2388,6 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
NumFmtMergeHandler aNumFmtMergeHdl(this, pClipDoc);
- ScClipRangeNameData aClipRangeNames;
- CopyRangeNamesFromClip(pClipDoc, aClipRangeNames);
-
SCCOL nAllCol1 = rDestRange.aStart.Col();
SCROW nAllRow1 = rDestRange.aStart.Row();
SCCOL nAllCol2 = rDestRange.aEnd.Col();
@@ -2587,8 +2544,6 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
bInsertingFromOtherDoc = false;
- UpdateRangeNamesInFormulas(aClipRangeNames, *pDestRanges, rMark, nXw, nYw);
-
// Listener aufbauen nachdem alles inserted wurde
StartListeningFromClip( nAllCol1, nAllRow1, nAllCol2, nAllRow2, rMark, nInsFlag );
// nachdem alle Listener aufgebaut wurden, kann gebroadcastet werden
@@ -2631,9 +2586,6 @@ void ScDocument::CopyMultiRangeFromClip(
NumFmtMergeHandler aNumFmtMergeHdl(this, pClipDoc);
- ScClipRangeNameData aClipRangeNames;
- CopyRangeNamesFromClip(pClipDoc, aClipRangeNames);
-
SCCOL nCol1 = rDestPos.Col();
SCROW nRow1 = rDestPos.Row();
ScClipParam& rClipParam = pClipDoc->GetClipParam();
@@ -2728,9 +2680,6 @@ void ScDocument::CopyMultiRangeFromClip(
ScRangeList aRanges;
aRanges.Append(aDestRange);
- SCCOL nCols = aDestRange.aEnd.Col() - aDestRange.aStart.Col() + 1;
- SCROW nRows = aDestRange.aEnd.Row() - aDestRange.aStart.Row() + 1;
- UpdateRangeNamesInFormulas(aClipRangeNames, aRanges, rMark, nCols-1, nRows-1);
// Listener aufbauen nachdem alles inserted wurde
StartListeningFromClip(aDestRange.aStart.Col(), aDestRange.aStart.Row(),
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index fbd982db364a..93adcfeea75e 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -172,7 +172,7 @@ SfxPoolItem* ScPatternAttr::Create( SvStream& rStream, sal_uInt16 /* nVersion */
{
short eFamDummy;
pStr = new String;
- rStream.ReadByteString( *pStr, rStream.GetStreamCharSet() );
+ rStream.ReadUniOrByteString( *pStr, rStream.GetStreamCharSet() );
rStream >> eFamDummy; // wg. altem Dateiformat
}
else
@@ -194,11 +194,11 @@ SvStream& ScPatternAttr::Store(SvStream& rStream, sal_uInt16 /* nItemVersion */)
rStream << (sal_Bool)sal_True;
if ( pStyle )
- rStream.WriteByteString( pStyle->GetName(), rStream.GetStreamCharSet() );
+ rStream.WriteUniOrByteString( pStyle->GetName(), rStream.GetStreamCharSet() );
else if ( pName ) // wenn Style geloescht ist/war
- rStream.WriteByteString( *pName, rStream.GetStreamCharSet() );
+ rStream.WriteUniOrByteString( *pName, rStream.GetStreamCharSet() );
else
- rStream.WriteByteString( ScGlobal::GetRscString(STR_STYLENAME_STANDARD),
+ rStream.WriteUniOrByteString( ScGlobal::GetRscString(STR_STYLENAME_STANDARD),
rStream.GetStreamCharSet() );
rStream << (short)SFX_STYLE_FAMILY_PARA; // wg. altem Dateiformat
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 06b8203c15d2..93285a294c1c 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -239,7 +239,9 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const rtl::OUString& rNewName
nLinkMode( 0 ),
aPageStyle( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) ),
nRepeatStartX( SCCOL_REPEAT_NONE ),
+ nRepeatEndX( SCCOL_REPEAT_NONE ),
nRepeatStartY( SCROW_REPEAT_NONE ),
+ nRepeatEndY( SCROW_REPEAT_NONE ),
pTabProtection( NULL ),
pColWidth( NULL ),
mpRowHeights( static_cast<ScFlatUInt16RowSegments*>(NULL) ),
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index b0d261f15e17..e47d88eeefa5 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1683,15 +1683,26 @@ public:
void operator() (ScQueryEntry::Item& rItem)
{
- // Double-check if the query by date is really appropriate.
-
- if (rItem.meType != ScQueryEntry::ByDate)
+ if (rItem.meType != ScQueryEntry::ByString && rItem.meType != ScQueryEntry::ByDate)
return;
sal_uInt32 nIndex = 0;
bool bNumber = mrDoc.GetFormatTable()->
IsNumberFormat(rItem.maString, nIndex, rItem.mfVal);
+ // Advanced Filter creates only ByString queries that need to be
+ // converted to ByValue if appropriate. rItem.mfVal now holds the value
+ // if bNumber==true.
+
+ if (rItem.meType == ScQueryEntry::ByString)
+ {
+ if (bNumber)
+ rItem.meType = ScQueryEntry::ByValue;
+ return;
+ }
+
+ // Double-check if the query by date is really appropriate.
+
if (bNumber && ((nIndex % SV_COUNTRY_LANGUAGE_OFFSET) != 0))
{
const SvNumberformat* pEntry = mrDoc.GetFormatTable()->GetEntry(nIndex);
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index fa7836bc604a..c938a1796c6b 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -797,8 +797,14 @@ sal_Bool ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersion
(AUTOFORMAT_DATA_ID_504 <= nVer && nVer <= AUTOFORMAT_DATA_ID)) )
{
// --- from 680/dr25 on: store strings as UTF-8
- CharSet eCharSet = (nVer >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
- rStream.ReadByteString( aName, eCharSet );
+ if (nVer >= AUTOFORMAT_ID_680DR25)
+ {
+ aName = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rStream,
+ RTL_TEXTENCODING_UTF8);
+ }
+ else
+ rStream.ReadUniOrByteString( aName, rStream.GetStreamCharSet() );
+
if( AUTOFORMAT_DATA_ID_552 <= nVer )
{
rStream >> nStrResId;
@@ -838,7 +844,7 @@ sal_Bool ScAutoFormatData::LoadOld( SvStream& rStream, const ScAfVersions& rVers
bRet = (rStream.GetError() == 0);
if (bRet && (nVal == AUTOFORMAT_OLD_DATA_ID))
{
- rStream.ReadByteString( aName, rStream.GetStreamCharSet() );
+ rStream.ReadUniOrByteString( aName, rStream.GetStreamCharSet() );
sal_Bool b;
rStream >> b; bIncludeFont = b;
rStream >> b; bIncludeJustify = b;
@@ -863,7 +869,7 @@ sal_Bool ScAutoFormatData::Save(SvStream& rStream)
sal_Bool b;
rStream << nVal;
// --- from 680/dr25 on: store strings as UTF-8
- rStream.WriteByteString( aName, RTL_TEXTENCODING_UTF8 );
+ write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStream, aName, RTL_TEXTENCODING_UTF8);
rStream << nStrResId;
rStream << ( b = bIncludeFont );
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 7a850144965b..d38d0ce42ef4 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -454,12 +454,12 @@ void ScChangeAction::GetDescription( String& rStr, ScDocument* /* pDoc */,
}
else if (pReject->HasDependent())
{
- ScChangeActionTable aTable;
- pCT->GetDependents( pReject, aTable, false, sal_True );
- for ( const ScChangeAction* p = aTable.First(); p;
- p = aTable.Next() )
+ ScChangeActionMap aMap;
+ pCT->GetDependents( pReject, aMap, false, sal_True );
+ ScChangeActionMap::iterator itChangeAction;
+ for( itChangeAction = aMap.begin(); itChangeAction != aMap.end(); ++itChangeAction )
{
- if (p->GetType() == SC_CAT_MOVE)
+ if( itChangeAction->second->GetType() == SC_CAT_MOVE)
{
rStr += ScGlobal::GetRscString(
STR_CHANGED_MOVE_REJECTION_WARNING);
@@ -2116,6 +2116,7 @@ void ScChangeTrack::DtorClear()
{
ScChangeAction* p;
ScChangeAction* pNext;
+ ScChangeActionMap::iterator itChangeAction;
for ( p = GetFirst(); p; p = pNext )
{
pNext = p->GetNext();
@@ -2126,9 +2127,9 @@ void ScChangeTrack::DtorClear()
pNext = p->GetNext();
delete p;
}
- for ( p = aPasteCutTable.First(); p; p = aPasteCutTable.Next() )
+ for( itChangeAction = aPasteCutMap.begin(); itChangeAction != aPasteCutMap.end(); ++itChangeAction )
{
- delete p;
+ delete itChangeAction->second;
}
delete pLastCutMove;
ClearMsgQueue();
@@ -2164,9 +2165,9 @@ void ScChangeTrack::ClearMsgQueue()
void ScChangeTrack::Clear()
{
DtorClear();
- aTable.Clear();
- aGeneratedTable.Clear();
- aPasteCutTable.Clear();
+ aMap.clear();
+ aGeneratedMap.clear();
+ aPasteCutMap.clear();
aUserCollection.FreeAll();
aUser.Erase();
Init();
@@ -2339,7 +2340,7 @@ void ScChangeTrack::MasterLinks( ScChangeAction* pAppend )
void ScChangeTrack::AppendLoaded( ScChangeAction* pAppend )
{
- aTable.Insert( pAppend->GetActionNumber(), pAppend );
+ aMap.insert( ::std::make_pair( pAppend->GetActionNumber(), pAppend ) );
if ( !pLast )
pFirst = pLast = pAppend;
else
@@ -2360,7 +2361,7 @@ void ScChangeTrack::Append( ScChangeAction* pAppend, sal_uLong nAction )
if ( bUseFixDateTime )
pAppend->SetDateTimeUTC( aFixDateTime );
pAppend->SetActionNumber( nAction );
- aTable.Insert( nAction, pAppend );
+ aMap.insert( ::std::make_pair( nAction, pAppend ) );
// UpdateReference Inserts vor Dependencies.
// Delete rejectendes Insert hatte UpdateReference mit Delete-Undo.
// UpdateReference auch wenn pLast==NULL, weil pAppend ein Delete sein
@@ -2831,7 +2832,7 @@ ScChangeActionContent* ScChangeTrack::GenerateDelContent(
pContent->pNext = pFirstGeneratedDelContent;
}
pFirstGeneratedDelContent = pContent;
- aGeneratedTable.Insert( nGeneratedMin, pContent );
+ aGeneratedMap.insert( std::make_pair( nGeneratedMin, pContent ) );
NotifyModified( SC_CTM_APPEND, nGeneratedMin, nGeneratedMin );
return pContent;
}
@@ -2840,7 +2841,7 @@ ScChangeActionContent* ScChangeTrack::GenerateDelContent(
void ScChangeTrack::DeleteGeneratedDelContent( ScChangeActionContent* pContent )
{
sal_uLong nAct = pContent->GetActionNumber();
- aGeneratedTable.Remove( nAct );
+ aGeneratedMap.erase( nAct );
if ( pFirstGeneratedDelContent == pContent )
pFirstGeneratedDelContent = (ScChangeActionContent*) pContent->pNext;
if ( pContent->pNext )
@@ -3038,7 +3039,7 @@ void ScChangeTrack::Remove( ScChangeAction* pRemove )
{
// aus Track ausklinken
sal_uLong nAct = pRemove->GetActionNumber();
- aTable.Remove( nAct );
+ aMap.erase( nAct );
if ( nAct == nActionMax )
--nActionMax;
if ( pRemove == pLast )
@@ -3125,7 +3126,7 @@ void ScChangeTrack::Undo( sal_uLong nStartAction, sal_uLong nEndAction, bool bMe
SetInDeleteTop( false );
Remove( pAct );
if ( IsInPasteCut() )
- aPasteCutTable.Insert( pAct->GetActionNumber(), pAct );
+ aPasteCutMap.insert( ::std::make_pair( pAct->GetActionNumber(), pAct ) );
else
{
if ( j == nStartAction && pAct->GetType() == SC_CAT_MOVE )
@@ -3140,11 +3141,13 @@ void ScChangeTrack::Undo( sal_uLong nStartAction, sal_uLong nEndAction, bool bMe
StartBlockModify( SC_CTM_APPEND, nStart );
for ( sal_uLong nCut = nStart; nCut <= nEnd; nCut++ )
{
- ScChangeAction* pCut = aPasteCutTable.Remove( nCut );
- if ( pCut )
+ ScChangeActionMap::iterator itCut = aPasteCutMap.find( nCut );
+
+ if ( itCut != aPasteCutMap.end() )
{
- OSL_ENSURE( !aTable.Get( nCut ), "ScChangeTrack::Undo: nCut dup" );
- Append( pCut, nCut );
+ OSL_ENSURE( aMap.find( nCut ) == aMap.end(), "ScChangeTrack::Undo: nCut dup" );
+ Append( itCut->second, nCut );
+ aPasteCutMap.erase( itCut );
}
else
{
@@ -3848,7 +3851,7 @@ void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction,
void ScChangeTrack::GetDependents( ScChangeAction* pAct,
- ScChangeActionTable& rTable, sal_Bool bListMasterDelete, sal_Bool bAllFlat ) const
+ ScChangeActionMap& rMap, sal_Bool bListMasterDelete, sal_Bool bAllFlat ) const
{
//! bAllFlat==TRUE: intern aus Accept oder Reject gerufen,
//! => Generated werden nicht aufgenommen
@@ -3876,7 +3879,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
if ( bAllFlat )
{
sal_uLong n = p->GetActionNumber();
- if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
+ if ( !IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
if ( p->HasDependent() )
cStack.push( p );
}
@@ -3885,10 +3888,10 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
if ( p->GetType() == SC_CAT_CONTENT )
{
if ( ((ScChangeActionContent*)p)->IsTopContent() )
- rTable.Insert( p->GetActionNumber(), p );
+ rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
}
else
- rTable.Insert( p->GetActionNumber(), p );
+ rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
}
}
pL = pL->GetNext();
@@ -3907,9 +3910,9 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
ScChangeAction* p = pDel;
while ( (p = p->GetPrev()) != NULL && p->GetType() == eType &&
!((ScChangeActionDel*)p)->IsTopDelete() )
- rTable.Insert( p->GetActionNumber(), p );
- // dieses Delete auch in Table!
- rTable.Insert( pAct->GetActionNumber(), pAct );
+ rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
+ // delete this in the map too
+ rMap.insert( ::std::make_pair( pAct->GetActionNumber(), pAct ) );
}
else
{
@@ -3923,7 +3926,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
{
// nur ein TopContent einer Kette ist in LinkDeleted
sal_uLong n = p->GetActionNumber();
- if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
+ if ( !IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
if ( p->HasDeleted() ||
p->GetType() == SC_CAT_CONTENT )
cStack.push( p );
@@ -3934,10 +3937,10 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
{ // weiteres TopDelete in gleiche Ebene,
// es ist nicht rejectable
if ( ((ScChangeActionDel*)p)->IsTopDelete() )
- rTable.Insert( p->GetActionNumber(), p );
+ rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
}
else
- rTable.Insert( p->GetActionNumber(), p );
+ rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
}
}
pL = pL->GetNext();
@@ -3952,7 +3955,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
while ( pL )
{
ScChangeAction* p = (ScChangeAction*) pL->GetAction();
- if ( p != pAct && rTable.Insert( p->GetActionNumber(), p ) )
+ if ( p != pAct && rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) ).second )
{
// nur ein TopContent einer Kette ist in LinkDeleted
if ( bAllFlat && (p->HasDeleted() ||
@@ -3972,7 +3975,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
if ( bAllFlat )
{
sal_uLong n = p->GetActionNumber();
- if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
+ if ( !IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
if ( p->HasDependent() || p->HasDeleted() )
cStack.push( p );
}
@@ -3981,10 +3984,10 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
if ( p->GetType() == SC_CAT_CONTENT )
{
if ( ((ScChangeActionContent*)p)->IsTopContent() )
- rTable.Insert( p->GetActionNumber(), p );
+ rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
}
else
- rTable.Insert( p->GetActionNumber(), p );
+ rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
}
}
pL = pL->GetNext();
@@ -3997,14 +4000,14 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
while ( ( pContent = pContent->GetPrevContent() ) != NULL )
{
if ( !pContent->IsRejected() )
- rTable.Insert( pContent->GetActionNumber(), pContent );
+ rMap.insert( ::std::make_pair( pContent->GetActionNumber(), pContent ) );
}
pContent = (ScChangeActionContent*) pCur;
// alle nachfolgenden
while ( ( pContent = pContent->GetNextContent() ) != NULL )
{
if ( !pContent->IsRejected() )
- rTable.Insert( pContent->GetActionNumber(), pContent );
+ rMap.insert( ::std::make_pair( pContent->GetActionNumber(), pContent ) );
}
// all MatrixReferences of a MatrixOrigin
const ScChangeActionLinkEntry* pL = pCur->GetFirstDependentEntry();
@@ -4016,12 +4019,12 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
if ( bAllFlat )
{
sal_uLong n = p->GetActionNumber();
- if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
+ if ( !IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
if ( p->HasDependent() )
cStack.push( p );
}
else
- rTable.Insert( p->GetActionNumber(), p );
+ rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
}
pL = pL->GetNext();
}
@@ -4032,7 +4035,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
{
ScChangeAction* p = GetAction(
((ScChangeActionReject*)pCur)->GetRejectAction() );
- if ( p != pAct && !rTable.Get( p->GetActionNumber() ) )
+ if (p != pAct && rMap.find( p->GetActionNumber() ) == rMap.end())
cStack.push( p );
}
}
@@ -4137,11 +4140,14 @@ sal_Bool ScChangeTrack::Accept( ScChangeAction* pAct )
if ( pAct->IsDeleteType() || pAct->GetType() == SC_CAT_CONTENT )
{
- ScChangeActionTable aActionTable;
- GetDependents( pAct, aActionTable, false, sal_True );
- for ( ScChangeAction* p = aActionTable.First(); p; p = aActionTable.Next() )
+ ScChangeActionMap aActionMap;
+ ScChangeActionMap::iterator itChangeAction;
+
+ GetDependents( pAct, aActionMap, false, sal_True );
+
+ for( itChangeAction = aActionMap.begin(); itChangeAction != aActionMap.end(); ++itChangeAction )
{
- p->Accept();
+ itChangeAction->second->Accept();
}
}
pAct->Accept();
@@ -4171,20 +4177,20 @@ sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, bool bShared )
if ( !pAct->IsRejectable() )
return false;
- ScChangeActionTable* pTable = NULL;
+ ScChangeActionMap* pMap = NULL;
if ( pAct->HasDependent() )
{
- pTable = new ScChangeActionTable;
- GetDependents( pAct, *pTable, false, sal_True );
+ pMap = new ScChangeActionMap;
+ GetDependents( pAct, *pMap, false, sal_True );
}
- sal_Bool bRejected = Reject( pAct, pTable, false );
- if ( pTable )
- delete pTable;
+ sal_Bool bRejected = Reject( pAct, pMap, false );
+ if ( pMap )
+ delete pMap;
return bRejected;
}
-sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, ScChangeActionTable* pTable,
+sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, ScChangeActionMap* pMap,
sal_Bool bRecursion )
{
if ( !pAct->IsInternalRejectable() )
@@ -4196,16 +4202,18 @@ sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, ScChangeActionTable* pTabl
{
if ( pAct->HasDependent() && !bRecursion )
{
- OSL_ENSURE( pTable, "ScChangeTrack::Reject: Insert ohne Table" );
- for ( ScChangeAction* p = pTable->Last(); p && bOk; p = pTable->Prev() )
+ OSL_ENSURE( pMap, "ScChangeTrack::Reject: Insert ohne map" );
+ ScChangeActionMap::reverse_iterator itChangeAction;
+ for (itChangeAction = pMap->rbegin();
+ itChangeAction != pMap->rend() && bOk; ++itChangeAction)
{
// keine Contents restoren, die eh geloescht werden wuerden
- if ( p->GetType() == SC_CAT_CONTENT )
- p->SetRejected();
- else if ( p->IsDeleteType() )
- p->Accept(); // geloeschtes ins Nirvana
+ if ( itChangeAction->second->GetType() == SC_CAT_CONTENT )
+ itChangeAction->second->SetRejected();
+ else if ( itChangeAction->second->IsDeleteType() )
+ itChangeAction->second->Accept(); // geloeschtes ins Nirvana
else
- bOk = Reject( p, NULL, sal_True ); //! rekursiv
+ bOk = Reject( itChangeAction->second, NULL, sal_True ); //! rekursiv
}
}
if ( bOk && (bRejected = pAct->Reject( pDoc )) != false )
@@ -4217,7 +4225,7 @@ sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, ScChangeActionTable* pTabl
}
else if ( pAct->IsDeleteType() )
{
- OSL_ENSURE( !pTable, "ScChangeTrack::Reject: Delete mit Table" );
+ OSL_ENSURE( !pMap, "ScChangeTrack::Reject: Delete mit map" );
ScBigRange aDelRange;
sal_uLong nRejectAction = pAct->GetActionNumber();
sal_Bool bTabDel, bTabDelOk;
@@ -4312,10 +4320,12 @@ sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, ScChangeActionTable* pTabl
{
if ( pAct->HasDependent() && !bRecursion )
{
- OSL_ENSURE( pTable, "ScChangeTrack::Reject: Move ohne Table" );
- for ( ScChangeAction* p = pTable->Last(); p && bOk; p = pTable->Prev() )
+ OSL_ENSURE( pMap, "ScChangeTrack::Reject: Move ohne Map" );
+ ScChangeActionMap::reverse_iterator itChangeAction;
+
+ for( itChangeAction = pMap->rbegin(); itChangeAction != pMap->rend() && bOk; ++itChangeAction )
{
- bOk = Reject( p, NULL, sal_True ); //! rekursiv
+ bOk = Reject( itChangeAction->second, NULL, sal_True ); //! rekursiv
}
}
if ( bOk && (bRejected = pAct->Reject( pDoc )) != false )
@@ -4368,7 +4378,7 @@ sal_uLong ScChangeTrack::AddLoadedGenerated(ScBaseCell* pNewCell, const ScBigRan
pFirstGeneratedDelContent->pPrev = pAct;
pAct->pNext = pFirstGeneratedDelContent;
pFirstGeneratedDelContent = pAct;
- aGeneratedTable.Insert( pAct->GetActionNumber(), pAct );
+ aGeneratedMap.insert( ::std::make_pair( pAct->GetActionNumber(), pAct ) );
return pAct->GetActionNumber();
}
return 0;
@@ -4376,7 +4386,7 @@ sal_uLong ScChangeTrack::AddLoadedGenerated(ScBaseCell* pNewCell, const ScBigRan
void ScChangeTrack::AppendCloned( ScChangeAction* pAppend )
{
- aTable.Insert( pAppend->GetActionNumber(), pAppend );
+ aMap.insert( ::std::make_pair( pAppend->GetActionNumber(), pAppend ) );
if ( !pLast )
pFirst = pLast = pAppend;
else
diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx
index 7fbb58b0ea4f..ca956813697b 100644
--- a/sc/source/core/tool/ddelink.cxx
+++ b/sc/source/core/tool/ddelink.cxx
@@ -92,9 +92,9 @@ ScDdeLink::ScDdeLink( ScDocument* pD, SvStream& rStream, ScMultipleReadHeader& r
rHdr.StartEntry();
rtl_TextEncoding eCharSet = rStream.GetStreamCharSet();
- rStream.ReadByteString( aAppl, eCharSet );
- rStream.ReadByteString( aTopic, eCharSet );
- rStream.ReadByteString( aItem, eCharSet );
+ rStream.ReadUniOrByteString( aAppl, eCharSet );
+ rStream.ReadUniOrByteString( aTopic, eCharSet );
+ rStream.ReadUniOrByteString( aItem, eCharSet );
sal_Bool bHasValue;
rStream >> bHasValue;
@@ -114,9 +114,9 @@ void ScDdeLink::Store( SvStream& rStream, ScMultipleWriteHeader& rHdr ) const
rHdr.StartEntry();
rtl_TextEncoding eCharSet = rStream.GetStreamCharSet();
- rStream.WriteByteString( aAppl, eCharSet );
- rStream.WriteByteString( aTopic, eCharSet );
- rStream.WriteByteString( aItem, eCharSet );
+ rStream.WriteUniOrByteString( aAppl, eCharSet );
+ rStream.WriteUniOrByteString( aTopic, eCharSet );
+ rStream.WriteUniOrByteString( aItem, eCharSet );
sal_Bool bHasValue = ( pResult != NULL );
rStream << bHasValue;
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 388c318b575c..234988614994 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2772,7 +2772,7 @@ void ScInterpreter::ScEuroConvert()
#define UTF8_TH_MINUS "\340\270\245\340\270\232"
#define UTF8_STRINGPARAM( ascii ) ascii, static_cast< xub_StrLen >( sizeof( ascii ) - 1 )
-#define UTF8_CREATE( ascii ) ByteString( UTF8_STRINGPARAM( ascii ) )
+#define UTF8_CREATE( ascii ) rtl::OString( RTL_CONSTASCII_STRINGPARAM( ascii ) )
#define UTF8_APPEND( ascii ) Append( UTF8_STRINGPARAM( ascii ) )
#define UTF8_PREPEND( ascii ) Insert( UTF8_CREATE( ascii ), 0 )
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index 0a7ed4e64d99..1d966f1dea0d 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -136,6 +136,9 @@ void ScRefTokenHelper::compileRangeRepresentation(
rRefTokens.clear();
}
+namespace {
+
+//may return a relative address
void singleRefToAddr(const ScSingleRefData& rRef, ScAddress& rAddr)
{
if (rRef.IsColRel())
@@ -154,6 +157,27 @@ void singleRefToAddr(const ScSingleRefData& rRef, ScAddress& rAddr)
rAddr.SetTab(rRef.nTab);
}
+//returns an absolute address in reference to rPos
+void singleRefToAbsAddr(const ScSingleRefData& rRef, ScAddress& rAddr, const ScAddress& rPos)
+{
+ if (rRef.IsColRel())
+ rAddr.SetCol(rRef.nRelCol + rPos.Col());
+ else
+ rAddr.SetCol(rRef.nCol);
+
+ if (rRef.IsRowRel())
+ rAddr.SetRow(rRef.nRelRow + rPos.Row());
+ else
+ rAddr.SetRow(rRef.nRow);
+
+ if (rRef.IsTabRel())
+ rAddr.SetTab(rRef.nRelTab + rPos.Tab());
+ else
+ rAddr.SetTab(rRef.nTab);
+}
+
+}
+
bool ScRefTokenHelper::getRangeFromToken(ScRange& rRange, const ScTokenRef& pToken, bool bExternal)
{
StackVar eType = pToken->GetType();
@@ -189,6 +213,41 @@ bool ScRefTokenHelper::getRangeFromToken(ScRange& rRange, const ScTokenRef& pTok
return false;
}
+bool ScRefTokenHelper::getAbsRangeFromToken(ScRange& rRange, const ScTokenRef& pToken, const ScAddress& rPos, bool bExternal)
+{
+ StackVar eType = pToken->GetType();
+ switch (pToken->GetType())
+ {
+ case svSingleRef:
+ case svExternalSingleRef:
+ {
+ if ((eType == svExternalSingleRef && !bExternal) ||
+ (eType == svSingleRef && bExternal))
+ return false;
+
+ const ScSingleRefData& rRefData = pToken->GetSingleRef();
+ singleRefToAbsAddr(rRefData, rRange.aStart, rPos);
+ rRange.aEnd = rRange.aStart;
+ return true;
+ }
+ case svDoubleRef:
+ case svExternalDoubleRef:
+ {
+ if ((eType == svExternalDoubleRef && !bExternal) ||
+ (eType == svDoubleRef && bExternal))
+ return false;
+
+ const ScComplexRefData& rRefData = pToken->GetDoubleRef();
+ singleRefToAbsAddr(rRefData.Ref1, rRange.aStart, rPos);
+ singleRefToAbsAddr(rRefData.Ref2, rRange.aEnd, rPos);
+ return true;
+ }
+ default:
+ ; // do nothing
+ }
+ return false;
+}
+
void ScRefTokenHelper::getRangeListFromTokens(ScRangeList& rRangeList, const vector<ScTokenRef>& rTokens)
{
vector<ScTokenRef>::const_iterator itr = rTokens.begin(), itrEnd = rTokens.end();
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 11780223c9bf..6ef4346029fa 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -37,9 +37,12 @@
#include <string.h>
#include <tools/mempool.hxx>
#include <osl/diagnose.h>
+#include <sfx2/docfile.hxx>
#include "token.hxx"
#include "tokenarray.hxx"
+#include "reftokenhelper.hxx"
+#include "clipparam.hxx"
#include "compiler.hxx"
#include <formula/compiler.hrc>
#include "rechead.hxx"
@@ -49,6 +52,9 @@
#include "externalrefmgr.hxx"
#include "document.hxx"
+#include <iostream>
+#include <rtl/oustringostreaminserter.hxx>
+
using ::std::vector;
#include <com/sun/star/sheet/ComplexReference.hpp>
@@ -1815,5 +1821,172 @@ void ScTokenArray::ReadjustRelative3DReferences( const ScAddress& rOldPos,
}
}
+namespace {
+
+void GetExternalTableData(const ScDocument* pOldDoc, const ScDocument* pNewDoc, const SCTAB nTab, rtl::OUString& rTabName, sal_uInt16& rFileId)
+{
+ rtl::OUString aFileName = pOldDoc->GetFileURL();;
+ std::cout << aFileName << std::endl;
+ rFileId = pNewDoc->GetExternalRefManager()->getExternalFileId(aFileName);
+ rTabName = pOldDoc->GetCopyTabName(nTab);
+ if (rTabName.isEmpty())
+ pOldDoc->GetName(nTab, rTabName);
+ std::cout << "TabName: " << rTabName << std::endl;
+}
+
+bool IsInCopyRange( const ScRange& rRange, const ScDocument* pClipDoc )
+{
+ ScClipParam& rClipParam = const_cast<ScDocument*>(pClipDoc)->GetClipParam();
+ std::cout << "Col: " << rRange.aStart.Col() << "Row: " << rRange.aStart.Row() << "Tab: " << rRange.aStart.Tab() << std::endl;
+ return rClipParam.maRanges.In(rRange);
+}
+
+bool SkipReference(ScToken* pToken, const ScAddress& rPos, const ScDocument* pOldDoc, bool bRangeName)
+{
+ ScRange aRange;
+ if (!ScRefTokenHelper::getAbsRangeFromToken(aRange, pToken, rPos))
+ return true;
+
+ if (bRangeName && aRange.aStart.Tab() == rPos.Tab())
+ {
+ switch (pToken->GetType())
+ {
+ case svDoubleRef:
+ {
+ ScSingleRefData& rRef = pToken->GetSingleRef2();
+ if (rRef.IsColRel() || rRef.IsRowRel())
+ return true;
+ } // fall through
+ case svSingleRef:
+ {
+ ScSingleRefData& rRef = pToken->GetSingleRef();
+ if (rRef.IsColRel() || rRef.IsRowRel())
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (IsInCopyRange(aRange, pOldDoc))
+ return true;
+
+ return false;
+}
+
+void AdjustSingleRefData( ScSingleRefData& rRef, const ScAddress& rOldPos, const ScAddress& rNewPos)
+{
+ SCsCOL nCols = rNewPos.Col() - rOldPos.Col();
+ SCsROW nRows = rNewPos.Row() - rOldPos.Row();
+ SCsTAB nTabs = rNewPos.Tab() - rOldPos.Tab();
+
+ if (!rRef.IsColRel())
+ rRef.nCol += nCols;
+
+ if (!rRef.IsRowRel())
+ rRef.nRow += nRows;
+
+ if (!rRef.IsTabRel())
+ rRef.nTab += nTabs;
+}
+
+}
+
+void ScTokenArray::ReadjustAbsolute3DReferences( const ScDocument* pOldDoc, const ScDocument* pNewDoc, const ScAddress& rPos, bool bRangeName )
+{
+ for ( sal_uInt16 j=0; j<nLen; ++j )
+ {
+ switch ( pCode[j]->GetType() )
+ {
+ case svDoubleRef :
+ {
+ if (SkipReference(static_cast<ScToken*>(pCode[j]), rPos, pOldDoc, bRangeName))
+ continue;
+
+ ScComplexRefData& rRef = static_cast<ScToken*>(pCode[j])->GetDoubleRef();
+ ScSingleRefData& rRef2 = rRef.Ref2;
+ ScSingleRefData& rRef1 = rRef.Ref1;
+
+ if ( (rRef2.IsFlag3D() && !rRef2.IsTabRel()) || (rRef1.IsFlag3D() && !rRef1.IsTabRel()) )
+ {
+ rtl::OUString aTabName;
+ sal_uInt16 nFileId;
+ GetExternalTableData(pOldDoc, pNewDoc, rRef1.nTab, aTabName, nFileId);
+ pCode[j]->DecRef();
+ ScExternalDoubleRefToken* pToken = new ScExternalDoubleRefToken(nFileId, aTabName, rRef);
+ pToken->IncRef();
+ pCode[j] = pToken;
+ }
+ }
+ break;
+ case svSingleRef :
+ {
+ if (SkipReference(static_cast<ScToken*>(pCode[j]), rPos, pOldDoc, bRangeName))
+ continue;
+
+ ScSingleRefData& rRef = static_cast<ScToken*>(pCode[j])->GetSingleRef();
+
+ if ( rRef.IsFlag3D() && !rRef.IsTabRel() )
+ {
+ rtl::OUString aTabName;
+ sal_uInt16 nFileId;
+ GetExternalTableData(pOldDoc, pNewDoc, rRef.nTab, aTabName, nFileId);
+ //replace with ScExternalSingleRefToken and adjust references
+ pCode[j]->DecRef();
+ ScExternalSingleRefToken* pToken = new ScExternalSingleRefToken(nFileId, aTabName, rRef);
+ pToken->IncRef();
+ pCode[j] = pToken;
+ }
+ }
+ break;
+ default:
+ {
+ // added to avoid warnings
+ }
+ }
+ }
+}
+
+void ScTokenArray::AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddress& rOldPos, const ScAddress& rNewPos)
+{
+ for ( sal_uInt16 j=0; j<nLen; ++j )
+ {
+ switch ( pCode[j]->GetType() )
+ {
+ case svDoubleRef :
+ {
+ if (!SkipReference(static_cast<ScToken*>(pCode[j]), rOldPos, pOldDoc, false))
+ continue;
+
+ ScComplexRefData& rRef = static_cast<ScToken*>(pCode[j])->GetDoubleRef();
+ ScSingleRefData& rRef2 = rRef.Ref2;
+ ScSingleRefData& rRef1 = rRef.Ref1;
+
+ AdjustSingleRefData( rRef1, rOldPos, rNewPos );
+ AdjustSingleRefData( rRef2, rOldPos, rNewPos );
+
+ }
+ break;
+ case svSingleRef :
+ {
+ if (!SkipReference(static_cast<ScToken*>(pCode[j]), rOldPos, pOldDoc, false))
+ continue;
+
+ ScSingleRefData& rRef = static_cast<ScToken*>(pCode[j])->GetSingleRef();
+
+ AdjustSingleRefData( rRef, rOldPos, rNewPos );
+
+
+ }
+ break;
+ default:
+ {
+ // added to avoid warnings
+ }
+ }
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/zforauto.cxx b/sc/source/core/tool/zforauto.cxx
index 4ebbee3551c0..048c981df3bf 100644
--- a/sc/source/core/tool/zforauto.cxx
+++ b/sc/source/core/tool/zforauto.cxx
@@ -61,7 +61,7 @@ ScNumFormatAbbrev::ScNumFormatAbbrev(sal_uLong nFormat,
void ScNumFormatAbbrev::Load( SvStream& rStream, CharSet eByteStrSet )
{
sal_uInt16 nSysLang, nLang;
- rStream.ReadByteString( sFormatstring, eByteStrSet );
+ rStream.ReadUniOrByteString( sFormatstring, eByteStrSet );
rStream >> nSysLang >> nLang;
eLnge = (LanguageType) nLang;
eSysLnge = (LanguageType) nSysLang;
@@ -71,7 +71,7 @@ void ScNumFormatAbbrev::Load( SvStream& rStream, CharSet eByteStrSet )
void ScNumFormatAbbrev::Save( SvStream& rStream, CharSet eByteStrSet ) const
{
- rStream.WriteByteString( sFormatstring, eByteStrSet );
+ rStream.WriteUniOrByteString( sFormatstring, eByteStrSet );
rStream << (sal_uInt16) eSysLnge << (sal_uInt16) eLnge;
}
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 3c9648107405..533bbb9173ad 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -937,6 +937,10 @@ void ImportExcel::Row34( void )
aIn >> nRowHeight; // direkt in Twips angegeben
aIn.Ignore( 4 );
+ nRowHeight = nRowHeight & 0x7FFF; // Bit 15: Row Height not changed manually
+ if( !nRowHeight )
+ nRowHeight = (GetBiff() == EXC_BIFF2) ? 0x25 : 0x225;
+
aIn >> nGrbit >> nXF;
sal_uInt8 nLevel = ::extract_value< sal_uInt8 >( nGrbit, 0, 3 );
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx
index 52f848e457c4..bbfbe41a2881 100644
--- a/sc/source/filter/ftools/ftools.cxx
+++ b/sc/source/filter/ftools/ftools.cxx
@@ -276,44 +276,18 @@ ScStyleSheet& ScfTools::MakePageStyleSheet( ScStyleSheetPool& rPool, const Strin
// *** byte string import operations *** --------------------------------------
-ByteString ScfTools::ReadCString( SvStream& rStrm )
+rtl::OString ScfTools::read_zeroTerminated_uInt8s_ToOString(SvStream& rStrm, sal_Int32& rnBytesLeft)
{
- rtl::OStringBuffer aRet;
-
- while (1)
- {
- sal_Char cChar(0);
- rStrm >> cChar;
- if (!cChar)
- break;
- aRet.append(cChar);
- }
-
- return aRet.makeStringAndClear();
-}
-
-ByteString ScfTools::ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft )
-{
- rtl::OStringBuffer aRet;
-
- while (1)
- {
- sal_Char cChar(0);
- rStrm >> cChar;
- rnBytesLeft--;
- if (!cChar)
- break;
- aRet.append(cChar);
- }
-
- return aRet.makeStringAndClear();
+ rtl::OString aRet(::read_zeroTerminated_uInt8s_ToOString(rStrm));
+ rnBytesLeft -= aRet.getLength(); //we read this number of bytes anyway
+ if (rStrm.good()) //if the stream is happy we read the null terminator as well
+ --rnBytesLeft;
+ return aRet;
}
void ScfTools::AppendCString( SvStream& rStrm, String& rString, rtl_TextEncoding eTextEnc )
{
- ByteString aByteString;
- rStrm.ReadCString(aByteString);
- rString += String( aByteString, eTextEnc );
+ rString += ::read_zeroTerminated_uInt8s_ToOUString(rStrm, eTextEnc);
}
// *** HTML table names <-> named range names *** -----------------------------
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index 39c49dcdaac1..4bfac0961c83 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -236,19 +236,15 @@ public:
// *** byte string import operations *** --------------------------------------
- /** Reads and returns a zero terminted byte string. */
- static ByteString ReadCString( SvStream& rStrm );
- /** Reads and returns a zero terminted byte string. */
- inline static String ReadCString( SvStream& rStrm, rtl_TextEncoding eTextEnc )
- { return String( ReadCString( rStrm ), eTextEnc ); }
-
- /** Reads and returns a zero terminted byte string and decreases a stream counter. */
- static ByteString ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft );
- /** Reads and returns a zero terminted byte string and decreases a stream counter. */
- inline static String ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft, rtl_TextEncoding eTextEnc )
- { return String( ReadCString( rStrm, rnBytesLeft ), eTextEnc ); }
-
- /** Appends a zero terminted byte string. */
+ /** Reads and returns a zero terminated byte string and decreases a stream counter. */
+ static rtl::OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStrm, sal_Int32& rnBytesLeft);
+ /** Reads and returns a zero terminated byte string and decreases a stream counter. */
+ inline static rtl::OUString read_zeroTerminated_uInt8s_ToOUString(SvStream& rStrm, sal_Int32& rnBytesLeft, rtl_TextEncoding eTextEnc)
+ {
+ return rtl::OStringToOUString(read_zeroTerminated_uInt8s_ToOString(rStrm, rnBytesLeft), eTextEnc);
+ }
+
+ /** Appends a zero terminated byte string. */
static void AppendCString( SvStream& rStrm, String& rString, rtl_TextEncoding eTextEnc );
// *** HTML table names <-> named range names *** -----------------------------
diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx
index 8f8e4791865d..d649c447ff65 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -542,8 +542,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest,
break;
case FT_ConstString:
{
- String aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) );
-
+ String aTmp(ScfTools::read_zeroTerminated_uInt8s_ToOUString(aIn, nBytesLeft, eSrcChar));
aStack << aPool.Store( aTmp );
}
break;
@@ -562,7 +561,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest,
break;
case FT_Nrref:
{
- String aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) );
+ String aTmp(ScfTools::read_zeroTerminated_uInt8s_ToOUString(aIn, nBytesLeft, eSrcChar));
if( rRangeNameBufferWK3.FindRel( aTmp, nRngIndex ) )
aStack << aPool.Store( nRngIndex );
else
@@ -575,7 +574,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest,
break;
case FT_Absnref:
{
- String aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) );
+ String aTmp(ScfTools::read_zeroTerminated_uInt8s_ToOUString(aIn, nBytesLeft, eSrcChar));
if( rRangeNameBufferWK3.FindAbs( aTmp, nRngIndex ) )
aStack << aPool.Store( nRngIndex );
else
diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx
index 472d041df794..6c8e8b7d371c 100644
--- a/sc/source/filter/qpro/qproform.cxx
+++ b/sc/source/filter/qpro/qproform.cxx
@@ -249,7 +249,7 @@ ConvErr QProToSc::Convert( const ScTokenArray*& pArray, sal_uInt16 /*nLen*/, con
}
if( nFmla[ i ] == 0x06 )
{
- String aTmp( ScfTools::ReadCString( maIn ), maIn.GetStreamCharSet() );
+ String aTmp(::read_zeroTerminated_uInt8s_ToOUString(maIn, maIn.GetStreamCharSet()));
sStringArray[ nStringCount ] = aTmp;
nStringCount++;
SAFEDEC_OR_RET(nRef, aTmp.Len() + 1, ConvErrCount);
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 13c279f232da..e27ca39859d6 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -657,12 +657,14 @@ void XclExpChTrAction::AddDependentContents(
const XclExpRoot& rRoot,
ScChangeTrack& rChangeTrack )
{
- ScChangeActionTable aActionTable;
- rChangeTrack.GetDependents( (ScChangeAction*)(&rAction), aActionTable );
- for( const ScChangeAction* pDepAction = aActionTable.First(); pDepAction; pDepAction = aActionTable.Next() )
- if( pDepAction->GetType() == SC_CAT_CONTENT )
+ ScChangeActionMap aActionMap;
+ ScChangeActionMap::iterator itChangeAction;
+
+ rChangeTrack.GetDependents( (ScChangeAction*)(&rAction), aActionMap );
+ for( itChangeAction = aActionMap.begin(); itChangeAction != aActionMap.end(); ++itChangeAction )
+ if( itChangeAction->second->GetType() == SC_CAT_CONTENT )
SetAddAction( new XclExpChTrCellContent(
- *((const ScChangeActionContent*) pDepAction), rRoot, rIdBuffer ) );
+ *((const ScChangeActionContent*) itChangeAction->second), rRoot, rIdBuffer ) );
}
void XclExpChTrAction::SetIndex( sal_uInt32& rIndex )
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index b39ad754acdc..b2c8d1c38a19 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -56,7 +56,7 @@ ScChangeTrackingExportHelper::ScChangeTrackingExportHelper(ScXMLExport& rTempExp
sChangeIDPrefix(RTL_CONSTASCII_USTRINGPARAM(SC_CHANGE_ID_PREFIX))
{
pChangeTrack = rExport.GetDocument() ? rExport.GetDocument()->GetChangeTrack() : NULL;
- pDependings = new ScChangeActionTable();
+ pDependings = new ScChangeActionMap();
}
ScChangeTrackingExportHelper::~ScChangeTrackingExportHelper()
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx
index cfb518e58b29..8e59ee660bad 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx
@@ -31,6 +31,8 @@
#include <xmloff/xmltoken.hxx>
#include <list>
+#include <map>
+#include <tools/solar.h>
#include <com/sun/star/text/XText.hpp>
#include <rtl/ustrbuf.hxx>
@@ -41,11 +43,11 @@ class ScBaseCell;
class ScChangeActionDel;
class ScBigRange;
class ScEditEngineTextObj;
-class ScChangeActionTable;
class String;
class DateTime;
typedef std::list<ScChangeActionDel*> ScMyDeletionsList;
+typedef std::map<sal_uLong, ScChangeAction*> ScChangeActionMap;
class ScChangeTrackingExportHelper
{
@@ -53,7 +55,7 @@ class ScChangeTrackingExportHelper
ScChangeTrack* pChangeTrack;
ScEditEngineTextObj* pEditTextObj;
- ScChangeActionTable* pDependings;
+ ScChangeActionMap* pDependings;
rtl::OUString sChangeIDPrefix;
com::sun::star::uno::Reference<com::sun::star::text::XText> xText;
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 83a3fca25819..1c7897f47bd2 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -677,10 +677,35 @@ void ScRowFormatRanges::AddRange(ScMyRowFormatRange& rFormatRange,
const sal_Int32 nRow)
{
OSL_ENSURE(pRowDefaults, "no row defaults");
+ if (!pRowDefaults)
+ return;
OSL_ENSURE(pColDefaults, "no column defaults");
+ if (!pColDefaults)
+ return;
+ sal_Int32 nPrevIndex;
+ bool bPrevAutoStyle;
+ OSL_ENSURE( static_cast<size_t>(nRow) < pRowDefaults->size(), "nRow out of bounds");
+ if (!(static_cast<size_t>(nRow) < pRowDefaults->size()))
+ {
+ /* This is only to prevent out-of-bounds accesses, once reached here
+ * there's something else going wrong, so FIXME there! */
+ if (pRowDefaults->empty())
+ {
+ nPrevIndex = -1;
+ bPrevAutoStyle = false;
+ }
+ else
+ {
+ nPrevIndex = (*pRowDefaults)[pRowDefaults->size()-1].nIndex;
+ bPrevAutoStyle = (*pRowDefaults)[pRowDefaults->size()-1].bIsAutoStyle;
+ }
+ }
+ else
+ {
+ nPrevIndex = (*pRowDefaults)[nRow].nIndex;
+ bPrevAutoStyle = (*pRowDefaults)[nRow].bIsAutoStyle;
+ }
sal_uInt32 nEnd (rFormatRange.nRepeatRows + nRow - 1);
- sal_Int32 nPrevIndex((*pRowDefaults)[nRow].nIndex);
- bool bPrevAutoStyle((*pRowDefaults)[nRow].bIsAutoStyle);
sal_uInt32 i(nRow + 1);
bool bReady(false);
while ((i < nEnd) && !bReady && (i < pRowDefaults->size()))
@@ -697,12 +722,34 @@ void ScRowFormatRanges::AddRange(ScMyRowFormatRange& rFormatRange,
rFormatRange.nRepeatRows = i - nRow + 1;
if (nPrevIndex == -1)
{
- nPrevIndex = (*pColDefaults)[rFormatRange.nStartColumn].nIndex;
- bPrevAutoStyle = (*pColDefaults)[rFormatRange.nStartColumn].bIsAutoStyle;
sal_uInt32 nPrevStartCol(rFormatRange.nStartColumn);
- sal_uInt32 nRepeat((*pColDefaults)[rFormatRange.nStartColumn].nRepeat);
- nEnd = rFormatRange.nStartColumn + rFormatRange.nRepeatColumns;
- for(i = nPrevStartCol + nRepeat; i < nEnd; i += (*pColDefaults)[i].nRepeat)
+ OSL_ENSURE( static_cast<size_t>(nPrevStartCol) < pColDefaults->size(), "nPrevStartCol out of bounds");
+ sal_uInt32 nRepeat;
+ if (static_cast<size_t>(nPrevStartCol) < pColDefaults->size())
+ {
+ nRepeat = (*pColDefaults)[nPrevStartCol].nRepeat;
+ nPrevIndex = (*pColDefaults)[nPrevStartCol].nIndex;
+ bPrevAutoStyle = (*pColDefaults)[nPrevStartCol].bIsAutoStyle;
+ }
+ else
+ {
+ /* Again, this is to prevent out-of-bounds accesses, so FIXME
+ * elsewhere! */
+ if (pColDefaults->empty())
+ {
+ nRepeat = 1;
+ nPrevIndex = -1;
+ bPrevAutoStyle = false;
+ }
+ else
+ {
+ nRepeat = (*pColDefaults)[pColDefaults->size()-1].nRepeat;
+ nPrevIndex = (*pColDefaults)[pColDefaults->size()-1].nIndex;
+ bPrevAutoStyle = (*pColDefaults)[pColDefaults->size()-1].bIsAutoStyle;
+ }
+ }
+ nEnd = nPrevStartCol + rFormatRange.nRepeatColumns;
+ for(i = nPrevStartCol + nRepeat; i < nEnd && i < pColDefaults->size(); i += (*pColDefaults)[i].nRepeat)
{
OSL_ENSURE(sal_uInt32(nPrevStartCol + nRepeat) <= nEnd, "something wents wrong");
if ((nPrevIndex != (*pColDefaults)[i].nIndex) ||
@@ -923,6 +970,8 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable,
const sal_Int32 nColumn, const sal_Int32 nRow, bool& bIsAutoStyle) const
{
OSL_ENSURE(static_cast<size_t>(nTable) < aTables.size(), "wrong table");
+ if (!(static_cast<size_t>(nTable) < aTables.size()))
+ return -1;
ScMyFormatRangeAddresses* pFormatRanges(aTables[nTable]);
ScMyFormatRangeAddresses::iterator aItr(pFormatRanges->begin());
ScMyFormatRangeAddresses::iterator aEndItr(pFormatRanges->end());
@@ -946,6 +995,8 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const s
bool& bIsAutoStyle, sal_Int32& nValidationIndex, sal_Int32& nNumberFormat, const sal_Int32 nRemoveBeforeRow)
{
OSL_ENSURE(static_cast<size_t>(nTable) < aTables.size(), "wrong table");
+ if (!(static_cast<size_t>(nTable) < aTables.size()))
+ return -1;
ScMyFormatRangeAddresses* pFormatRanges(aTables[nTable]);
ScMyFormatRangeAddresses::iterator aItr(pFormatRanges->begin());
ScMyFormatRangeAddresses::iterator aEndItr(pFormatRanges->end());
@@ -959,7 +1010,10 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const s
bIsAutoStyle = aItr->bIsAutoStyle;
nValidationIndex = aItr->nValidationIndex;
nNumberFormat = aItr->nNumberFormat;
- if (((*pRowDefaults)[nRow].nIndex != -1))
+ /* out-of-bounds is an error elsewhere, so FIXME there! */
+ OSL_ENSURE( static_cast<size_t>(nRow) < pRowDefaults->size(), "nRow out of bounds");
+ if (static_cast<size_t>(nRow) < pRowDefaults->size() &&
+ ((*pRowDefaults)[nRow].nIndex != -1))
{
if (((*pRowDefaults)[nRow].nIndex == (*aItr).nStyleNameIndex) &&
((*pRowDefaults)[nRow].bIsAutoStyle == (*aItr).bIsAutoStyle))
@@ -967,12 +1021,17 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const s
else
return (*aItr).nStyleNameIndex;
}
- else if (((*pColDefaults)[nColumn].nIndex != -1) &&
- ((*pColDefaults)[nColumn].nIndex == (*aItr).nStyleNameIndex) &&
- ((*pColDefaults)[nColumn].bIsAutoStyle == (*aItr).bIsAutoStyle))
- return -1;
else
- return (*aItr).nStyleNameIndex;
+ {
+ OSL_ENSURE( static_cast<size_t>(nColumn) < pColDefaults->size(), "nColumn out of bounds");
+ if (static_cast<size_t>(nColumn) < pColDefaults->size() &&
+ ((*pColDefaults)[nColumn].nIndex != -1) &&
+ ((*pColDefaults)[nColumn].nIndex == (*aItr).nStyleNameIndex) &&
+ ((*pColDefaults)[nColumn].bIsAutoStyle == (*aItr).bIsAutoStyle))
+ return -1;
+ else
+ return (*aItr).nStyleNameIndex;
+ }
}
else
{
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index b9ab4127b6cf..1793fae56d80 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -987,13 +987,6 @@ void ScInputBarGroup::Resize()
Invalidate();
}
-
-void ScInputBarGroup::GainFocus()
-{
- aMultiTextWnd.GrabFocus();
-}
-
-
void ScInputBarGroup::StopEditEngine( sal_Bool bAll )
{
aMultiTextWnd.StopEditEngine( bAll );
@@ -1061,6 +1054,9 @@ IMPL_LINK( ScInputBarGroup, ClickHdl, PushButton*, EMPTYARG )
aMultiTextWnd.SetNumLines( aMultiTextWnd.GetLastNumExpandedLines() );
}
TriggerToolboxLayout();
+ // Restore focus to input line(s) if necessary
+ if ( SC_MOD()->GetInputHdl()->IsTopMode() )
+ aMultiTextWnd.GrabFocus();
return 0;
}
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 72c92e4fe131..47ef6b9d7ba4 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2201,20 +2201,4 @@ Window * ScModule::Find1RefWindow( sal_uInt16 nSlotId, Window *pWndAncestor )
return NULL;
}
-Window * ScModule::Find1RefWindow( Window *pWndAncestor )
-{
- if (!pWndAncestor)
- return NULL;
-
- while( Window *pParent = pWndAncestor->GetParent() ) pWndAncestor = pParent;
-
- for( std::map<sal_uInt16, std::list<Window*> >::iterator i = m_mapRefWindow.begin();
- i!=m_mapRefWindow.end(); ++i )
- for( std::list<Window*>::iterator j = i->second.begin(); j!=i->second.end(); ++j )
- if ( pWndAncestor->IsWindowOrChild( *j, (*j)->IsSystemWindow() ) )
- return *j;
-
- return NULL;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index c923fd6cbc1c..a61e5d3d8d9e 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -61,6 +61,7 @@
#include "scmod.hxx"
#include "dragdata.hxx"
#include "clipdata.hxx"
+#include "clipparam.hxx"
// for InitDocShell
#include <editeng/paperinf.hxx>
@@ -171,6 +172,9 @@ ScTransferObj::ScTransferObj( ScDocument* pClipDoc, const TransferableObjectDesc
}
OSL_ENSURE(!bFirst, "no sheet selected");
+ if (!pDoc->GetClipParam().isMultiRange() && nTab1 == nTab2)
+ pDoc->ShrinkToDataArea( nTab1, nCol1, nRow1, nCol2, nRow2 );
+
// only limit to used cells if whole sheet was marked
// (so empty cell areas can be copied)
if ( nCol2>=MAXCOL && nRow2>=MAXROW )
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 70e53b039db1..6609563a815e 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -58,15 +58,6 @@
using namespace com::sun::star;
-// STATIC DATA -----------------------------------------------------------
-
-static sal_uInt16 pSortRanges[] =
-{
- SID_SORT,
- SID_SORT,
- 0
-};
-
// -----------------------------------------------------------------------
/*
@@ -174,13 +165,6 @@ void ScTabPageSortFields::Init()
aFlArr[2] = &aFlSort3;
}
-//------------------------------------------------------------------------
-
-sal_uInt16* ScTabPageSortFields::GetRanges()
-{
- return pSortRanges;
-}
-
// -----------------------------------------------------------------------
SfxTabPage* ScTabPageSortFields::Create( Window* pParent,
@@ -690,13 +674,6 @@ void ScTabPageSortOptions::Init()
aLbLanguage.InsertLanguage( LANGUAGE_SYSTEM );
}
-//------------------------------------------------------------------------
-
-sal_uInt16* ScTabPageSortOptions::GetRanges()
-{
- return pSortRanges;
-}
-
// -----------------------------------------------------------------------
SfxTabPage* ScTabPageSortOptions::Create(
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index 14332e5e7a78..c2bc52f0f37c 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -26,7 +26,6 @@
*
************************************************************************/
-
#undef SC_DLLIMPLEMENTATION
#include "scitems.hxx"
@@ -42,15 +41,6 @@
#include "subtdlg.hrc"
#include "tpsubt.hxx"
-// STATIC DATA -----------------------------------------------------------
-
-static sal_uInt16 pSubTotalsRanges[] =
-{
- SID_SUBTOTALS,
- SID_SUBTOTALS,
- 0
-};
-
//========================================================================
// Zwischenergebnisgruppen-Tabpage:
@@ -126,13 +116,6 @@ void ScTpSubTotalGroup::Init()
FillListBoxes();
}
-//------------------------------------------------------------------------
-
-sal_uInt16* ScTpSubTotalGroup::GetRanges()
-{
- return pSubTotalsRanges;
-}
-
// -----------------------------------------------------------------------
bool ScTpSubTotalGroup::DoReset( sal_uInt16 nGroupNo,
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 9fa5769ee1ff..908446fcd482 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -913,11 +913,25 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
if ( !bSuccess )
SetError( ERRCODE_IO_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // this error code will produce no error message, but will break the further saving process
}
+
+
if (pSheetSaveData)
pSheetSaveData->SetInSupportedSave(true);
}
break;
case SFX_EVENT_SAVEASDOC:
+ {
+ if ( GetDocument()->GetExternalRefManager()->containsUnsavedReferences() )
+ {
+ WarningBox aBox( GetActiveDialogParent(), WinBits( WB_YES_NO ),
+ ScGlobal::GetRscString( STR_UNSAVED_EXT_REF ) );
+
+ if( RET_NO == aBox.Execute())
+ {
+ SetError( ERRCODE_IO_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // this error code will produce no error message, but will break the further saving process
+ }
+ }
+ } // fall through
case SFX_EVENT_SAVETODOC:
// #i108978# If no event is sent before saving, there will also be no "...DONE" event,
// and SAVE/SAVEAS can't be distinguished from SAVETO. So stream copying is only enabled
@@ -926,21 +940,11 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
pSheetSaveData->SetInSupportedSave(true);
break;
case SFX_EVENT_SAVEDOCDONE:
+ case SFX_EVENT_SAVEASDOCDONE:
{
- if ( IsDocShared() && !SC_MOD()->IsInSharedDocSaving() )
- {
- }
+ // new positions are used after "save" and "save as", but not "save to"
UseSheetSaveEntries(); // use positions from saved file for next saving
- if (pSheetSaveData)
- pSheetSaveData->SetInSupportedSave(false);
- }
- break;
- case SFX_EVENT_SAVEASDOCDONE:
- // new positions are used after "save" and "save as", but not "save to"
- UseSheetSaveEntries(); // use positions from saved file for next saving
- if (pSheetSaveData)
- pSheetSaveData->SetInSupportedSave(false);
- break;
+ } // fall through
case SFX_EVENT_SAVETODOCDONE:
// only reset the flag, don't use the new positions
if (pSheetSaveData)
@@ -1567,6 +1571,7 @@ sal_Bool ScDocShell::SaveAs( SfxMedium& rMedium )
return false;
}
+
ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
PrepareSaveGuard aPrepareGuard( *this);
@@ -2509,7 +2514,6 @@ ScDocShell::ScDocShell( const ScDocShell& rShell ) :
pDocHelper ( NULL ),
pAutoStyleList ( NULL ),
pPaintLockData ( NULL ),
- pOldJobSetup ( NULL ),
pSolverSaveData ( NULL ),
pSheetSaveData ( NULL ),
pModificator ( NULL )
@@ -2556,7 +2560,6 @@ ScDocShell::ScDocShell( const sal_uInt64 i_nSfxCreationFlags ) :
pDocHelper ( NULL ),
pAutoStyleList ( NULL ),
pPaintLockData ( NULL ),
- pOldJobSetup ( NULL ),
pSolverSaveData ( NULL ),
pSheetSaveData ( NULL ),
pModificator ( NULL )
@@ -2609,8 +2612,6 @@ ScDocShell::~ScDocShell()
delete pPaintLockData;
- delete pOldJobSetup; // gesetzt nur bei Fehler in StartJob()
-
delete pSolverSaveData;
delete pSheetSaveData;
delete pOldAutoDBRange;
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 5529579f297b..207f0f039de9 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -309,6 +309,10 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet
long i;
long nColCount = 0;
+ // Try to get the Text Encoding from the driver
+ if( eCharSet == RTL_TEXTENCODING_IBM_850 )
+ eCharSet = RTL_TEXTENCODING_DONTKNOW;
+
try
{
String aTabName;
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 6d23ab9fbf2b..bec7700e56ee 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2092,7 +2092,7 @@ const ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileI
while (pShell)
{
SfxMedium* pMedium = pShell->GetMedium();
- if (pMedium)
+ if (pMedium && pMedium->GetName().Len())
{
OUString aName = pMedium->GetName();
// TODO: We should make the case sensitivity platform dependent.
@@ -2103,6 +2103,21 @@ const ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileI
break;
}
}
+ else
+ {
+ // handle unsaved documents here
+ OUString aName = pShell->GetName();
+ if (pFileName->equalsIgnoreAsciiCase(aName))
+ {
+ // Found !
+ SrcShell aSrcDoc;
+ aSrcDoc.maShell = pShell;
+ maUnsavedDocShells.insert(DocShellMap::value_type(nFileId, aSrcDoc));
+ StartListening(*pShell);
+ pSrcDoc = pShell->GetDocument();
+ break;
+ }
+ }
pShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pShell, &aType, false));
}
@@ -2644,6 +2659,41 @@ sal_uInt32 ScExternalRefManager::getMappedNumberFormat(sal_uInt16 nFileId, sal_u
return nNumFmt;
}
+void ScExternalRefManager::transformUnsavedRefToSavedRef( SfxObjectShell* pShell )
+{
+ for(DocShellMap::iterator itr = maUnsavedDocShells.begin();
+ itr != maUnsavedDocShells.end(); ++itr)
+ {
+ if (&(itr->second.maShell) == pShell)
+ {
+ // found that the shell is marked as unsaved
+ rtl::OUString aFileURL = pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI);
+ switchSrcFile(itr->first, aFileURL, rtl::OUString());
+ EndListening(*pShell);
+ }
+ }
+}
+
+void ScExternalRefManager::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ if ( rHint.ISA( SfxEventHint ) )
+ {
+ sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId();
+ switch ( nEventId )
+ {
+ case SFX_EVENT_SAVEDOCDONE:
+ case SFX_EVENT_SAVEASDOCDONE:
+ {
+ SfxObjectShell* pObjShell = static_cast<const SfxEventHint&>( rHint ).GetObjShell();
+ transformUnsavedRefToSavedRef(pObjShell);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
IMPL_LINK(ScExternalRefManager, TimeOutHdl, AutoTimer*, pTimer)
{
if (pTimer == &maSrcDocTimer)
diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx
index 92dc97f84ee6..e99ff87778e6 100644
--- a/sc/source/ui/docshell/olinefun.cxx
+++ b/sc/source/ui/docshell/olinefun.cxx
@@ -310,9 +310,9 @@ sal_Bool ScOutlineDocFunc::AutoOutline( const ScRange& rRange, sal_Bool bRecord,
SCCOLROW nCol1, nCol2, nRow1, nRow2;
pTable->GetColArray()->GetRange( nCol1, nCol2 );
pTable->GetRowArray()->GetRange( nRow1, nRow2 );
- SCCOL nOutStartCol = static_cast<SCCOL>(nCol1);;
+ SCCOL nOutStartCol = static_cast<SCCOL>(nCol1);
SCROW nOutStartRow = nRow1;
- SCCOL nOutEndCol = static_cast<SCCOL>(nCol2);;
+ SCCOL nOutEndCol = static_cast<SCCOL>(nCol2);
SCROW nOutEndRow = nRow2;
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
diff --git a/sc/source/ui/inc/acredlin.hxx b/sc/source/ui/inc/acredlin.hxx
index 2f9c06663559..417ed14889a3 100644
--- a/sc/source/ui/inc/acredlin.hxx
+++ b/sc/source/ui/inc/acredlin.hxx
@@ -212,17 +212,17 @@ protected:
SvLBoxEntry* pParent,sal_uLong nSpecial);
void GetDependents( const ScChangeAction* pScChangeAction,
- ScChangeActionTable& aActionTable,
+ ScChangeActionMap& aActionMap,
SvLBoxEntry* pEntry);
- bool InsertContentChildren(ScChangeActionTable* pActionTable,SvLBoxEntry* pParent);
+ bool InsertContentChildren( ScChangeActionMap* pActionMap, SvLBoxEntry* pParent );
bool InsertAcceptedORejected(SvLBoxEntry* pParent);
- bool InsertDeletedChildren(const ScChangeAction *pChangeAction, ScChangeActionTable* pActionTable,
+ bool InsertDeletedChildren( const ScChangeAction* pChangeAction, ScChangeActionMap* pActionMap,
SvLBoxEntry* pParent);
- bool InsertChildren(ScChangeActionTable* pActionTable,SvLBoxEntry* pParent);
+ bool InsertChildren( ScChangeActionMap* pActionMap, SvLBoxEntry* pParent );
void AppendChanges(ScChangeTrack* pChanges,sal_uLong nStartAction, sal_uLong nEndAction,
sal_uLong nPos=LIST_APPEND);
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index fb23c04ba8a2..e52f2f1665d5 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -65,7 +65,6 @@ class ScAutoStyleList;
class ScRange;
class ScMarkData;
class ScPaintLockData;
-class ScJobSetup;
class ScChangeAction;
class VirtualDevice;
class ScImportOptions;
@@ -118,7 +117,6 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener
ScAutoStyleList* pAutoStyleList;
ScPaintLockData* pPaintLockData;
- ScJobSetup* pOldJobSetup;
ScOptSolverSave* pSolverSaveData;
ScSheetSaveData* pSheetSaveData;
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index 1f200c12ba06..7b5bc28eaf94 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -223,7 +223,6 @@ public:
virtual const String& GetTextString() const;
virtual void StopEditEngine( sal_Bool bAll );
void InitEditEngine(SfxObjectShell* pObjSh);
- void GainFocus();
void SetFormulaMode( sal_Bool bSet );
bool IsFocus();
void MakeDialogEditView();
diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx
index 69bc102bfb1a..3023e29eef2f 100644
--- a/sc/source/ui/inc/namemgrtable.hxx
+++ b/sc/source/ui/inc/namemgrtable.hxx
@@ -81,7 +81,7 @@ public:
ScRangeManagerTable( Window* pParent, boost::ptr_map<rtl::OUString, ScRangeName>& aTabRangeNames );
virtual ~ScRangeManagerTable();
- void addEntry( const ScRangeNameLine& rLine );
+ void addEntry( const ScRangeNameLine& rLine, bool bSetCurEntry = true );
void DeleteSelectedEntries();
void SetEntry( const ScRangeNameLine& rLine );
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 791bbc332bbd..05e68387d8ba 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -205,7 +205,6 @@ private:
DECL_LINK( SimpleRefAborted, String* );
DECL_LINK( SimpleRefChange, String* );
DECL_LINK( FormControlActivated, FmFormShell* );
- DECL_LINK( HtmlOptionsHdl, void * );
protected:
virtual void Activate(sal_Bool bMDI);
diff --git a/sc/source/ui/inc/tpcalc.hxx b/sc/source/ui/inc/tpcalc.hxx
index 9ab7c107561b..c680b0b38f3e 100644
--- a/sc/source/ui/inc/tpcalc.hxx
+++ b/sc/source/ui/inc/tpcalc.hxx
@@ -46,7 +46,6 @@ class ScTpCalcOptions : public SfxTabPage
public:
static SfxTabPage* Create ( Window* pParent,
const SfxItemSet& rCoreSet );
- static sal_uInt16* GetRanges ();
virtual sal_Bool FillItemSet ( SfxItemSet& rCoreSet );
virtual void Reset ( const SfxItemSet& rCoreSet );
using SfxTabPage::DeactivatePage;
diff --git a/sc/source/ui/inc/tpprint.hxx b/sc/source/ui/inc/tpprint.hxx
index 7aa00147fa64..20edfd036e62 100644
--- a/sc/source/ui/inc/tpprint.hxx
+++ b/sc/source/ui/inc/tpprint.hxx
@@ -46,7 +46,6 @@ class ScTpPrintOptions : public SfxTabPage
public:
static SfxTabPage* Create( Window* pParent, const SfxItemSet& rCoreSet );
- static sal_uInt16* GetRanges();
virtual sal_Bool FillItemSet( SfxItemSet& rCoreSet );
virtual void Reset( const SfxItemSet& rCoreSet );
using SfxTabPage::DeactivatePage;
diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx
index 059a5f4f7da5..987f20bb813d 100644
--- a/sc/source/ui/inc/tpsort.hxx
+++ b/sc/source/ui/inc/tpsort.hxx
@@ -62,7 +62,6 @@ public:
static SfxTabPage* Create ( Window* pParent,
const SfxItemSet& rArgSet );
- static sal_uInt16* GetRanges ();
virtual sal_Bool FillItemSet ( SfxItemSet& rArgSet );
virtual void Reset ( const SfxItemSet& rArgSet );
@@ -141,7 +140,6 @@ public:
#define SfxTabPage ::SfxTabPage
static SfxTabPage* Create ( Window* pParent,
const SfxItemSet& rArgSet );
- static sal_uInt16* GetRanges ();
virtual sal_Bool FillItemSet ( SfxItemSet& rArgSet );
virtual void Reset ( const SfxItemSet& rArgSet );
diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx
index 8accbe98279b..d3f987e17336 100644
--- a/sc/source/ui/inc/tpsubt.hxx
+++ b/sc/source/ui/inc/tpsubt.hxx
@@ -55,7 +55,6 @@ protected:
public:
virtual ~ScTpSubTotalGroup();
- static sal_uInt16* GetRanges ();
bool DoReset ( sal_uInt16 nGroupNo,
const SfxItemSet& rArgSet );
bool DoFillItemSet ( sal_uInt16 nGroupNo,
@@ -153,7 +152,6 @@ protected:
public:
virtual ~ScTpSubTotalOptions();
- static sal_uInt16* GetRanges ();
static SfxTabPage* Create ( Window* pParent,
const SfxItemSet& rArgSet );
virtual sal_Bool FillItemSet ( SfxItemSet& rArgSet );
diff --git a/sc/source/ui/inc/tpusrlst.hxx b/sc/source/ui/inc/tpusrlst.hxx
index bb223580572e..0ba8e3d45757 100644
--- a/sc/source/ui/inc/tpusrlst.hxx
+++ b/sc/source/ui/inc/tpusrlst.hxx
@@ -47,7 +47,6 @@ class ScTpUserLists : public SfxTabPage
public:
static SfxTabPage* Create ( Window* pParent,
const SfxItemSet& rAttrSet );
- static sal_uInt16* GetRanges ();
virtual sal_Bool FillItemSet ( SfxItemSet& rCoreAttrs );
virtual void Reset ( const SfxItemSet& rCoreAttrs );
using SfxTabPage::DeactivatePage;
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index b3deaeac5f1f..fee43d4b50d0 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -813,7 +813,6 @@ void ScAcceptChgDlg::UpdateView()
if(pChanges!=NULL)
pScChangeAction=pChanges->GetFirst();
}
- ScChangeActionTable ActionTable;
bool bTheFlag = false;
while(pScChangeAction!=NULL)
@@ -1168,7 +1167,7 @@ IMPL_LINK( ScAcceptChgDlg, SelectHandle, SvxRedlinTable*, EMPTYARG )
}
void ScAcceptChgDlg::GetDependents( const ScChangeAction* pScChangeAction,
- ScChangeActionTable& aActionTable,
+ ScChangeActionMap& aActionMap,
SvLBoxEntry* pEntry)
{
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
@@ -1181,17 +1180,17 @@ void ScAcceptChgDlg::GetDependents( const ScChangeAction* pScChangeAction,
if(pParentAction!=pScChangeAction)
pChanges->GetDependents((ScChangeAction*) pScChangeAction,
- aActionTable,pScChangeAction->IsMasterDelete());
+ aActionMap,pScChangeAction->IsMasterDelete());
else
- pChanges->GetDependents((ScChangeAction*) pScChangeAction,
- aActionTable);
+ pChanges->GetDependents( (ScChangeAction*) pScChangeAction,
+ aActionMap );
}
else
pChanges->GetDependents((ScChangeAction*) pScChangeAction,
- aActionTable,pScChangeAction->IsMasterDelete());
+ aActionMap, pScChangeAction->IsMasterDelete() );
}
-bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionTable* pActionTable,SvLBoxEntry* pParent)
+bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvLBoxEntry* pParent)
{
bool bTheTestFlag = true;
ScRedlinData *pEntryData=(ScRedlinData *)(pParent->GetUserData());
@@ -1205,23 +1204,27 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionTable* pActionTable,SvL
if ( pScChangeAction->GetType() == SC_CAT_CONTENT &&
((const ScChangeActionContent*)pScChangeAction)->IsMatrixOrigin() )
{
- pActionTable->Insert( pScChangeAction->GetActionNumber(),
- (ScChangeAction*) pScChangeAction );
+ pActionMap->insert( ::std::make_pair( pScChangeAction->GetActionNumber(),
+ const_cast<ScChangeAction*>( pScChangeAction ) ) );
bParentInserted = true;
}
SvLBoxEntry* pEntry=NULL;
- const ScChangeActionContent* pCChild=(const ScChangeActionContent*)pActionTable->First();
- while(pCChild!=NULL)
+ ScChangeActionMap::iterator itChangeAction = pActionMap->begin();
+ while( itChangeAction != pActionMap->end() )
{
- if( pCChild->GetState()==SC_CAS_VIRGIN )
+ if( itChangeAction->second->GetState()==SC_CAS_VIRGIN )
break;
- pCChild=(const ScChangeActionContent*)pActionTable->Next();
+ ++itChangeAction;
}
- if(pCChild==NULL) return true;
+ if( itChangeAction == pActionMap->end() )
+ return true;
+
+ SvLBoxEntry* pOriginal = InsertChangeActionContent(
+ dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
+ pParent, RD_SPECIAL_CONTENT );
- SvLBoxEntry* pOriginal=InsertChangeActionContent(pCChild,pParent,RD_SPECIAL_CONTENT);
if(pOriginal!=NULL)
{
bTheTestFlag=false;
@@ -1232,16 +1235,17 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionTable* pActionTable,SvL
pParentData->bIsRejectable=false;
pParentData->bDisabled=false;
}
- while(pCChild!=NULL)
+ while( itChangeAction != pActionMap->end() )
{
- if(pCChild->GetState()==SC_CAS_VIRGIN)
+ if( itChangeAction->second->GetState() == SC_CAS_VIRGIN )
{
- pEntry=InsertChangeActionContent(pCChild,pParent,RD_SPECIAL_NONE);
+ pEntry = InsertChangeActionContent( dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
+ pParent, RD_SPECIAL_NONE );
if(pEntry!=NULL)
bTheTestFlag=false;
}
- pCChild=(const ScChangeActionContent*)pActionTable->Next();
+ ++itChangeAction;
}
if ( !bParentInserted )
@@ -1293,15 +1297,16 @@ bool ScAcceptChgDlg::InsertAcceptedORejected(SvLBoxEntry* pParent)
return bTheTestFlag;
}
-bool ScAcceptChgDlg::InsertChildren(ScChangeActionTable* pActionTable,SvLBoxEntry* pParent)
+bool ScAcceptChgDlg::InsertChildren(ScChangeActionMap* pActionMap,SvLBoxEntry* pParent)
{
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
bool bTheTestFlag = true;
SvLBoxEntry* pEntry=NULL;
- const ScChangeAction* pChild=(const ScChangeAction*)pActionTable->First();
- while(pChild!=NULL)
+ ScChangeActionMap::iterator itChangeAction;
+
+ for( itChangeAction = pActionMap->begin(); itChangeAction != pActionMap->end(); ++itChangeAction )
{
- pEntry=InsertChangeAction(pChild,SC_CAS_VIRGIN,pParent,false,true);
+ pEntry=InsertChangeAction( itChangeAction->second, SC_CAS_VIRGIN, pParent, false, true );
if(pEntry!=NULL)
{
@@ -1312,30 +1317,28 @@ bool ScAcceptChgDlg::InsertChildren(ScChangeActionTable* pActionTable,SvLBoxEntr
pEntryData->bIsAcceptable=false;
pEntryData->bDisabled=true;
- if(pChild->IsDialogParent())
- Expand(pChanges,pChild,pEntry);
+ if( itChangeAction->second->IsDialogParent() )
+ Expand( pChanges, itChangeAction->second, pEntry );
}
- pChild=pActionTable->Next();
}
return bTheTestFlag;
}
bool ScAcceptChgDlg::InsertDeletedChildren(const ScChangeAction* pScChangeAction,
- ScChangeActionTable* pActionTable,SvLBoxEntry* pParent)
+ ScChangeActionMap* pActionMap,SvLBoxEntry* pParent)
{
ScChangeTrack* pChanges=pDoc->GetChangeTrack();
bool bTheTestFlag = true;
SvLBoxEntry* pEntry=NULL;
- ScChangeActionTable aDelActionTable;
- const ScChangeAction* pChild=(const ScChangeAction*)pActionTable->First();
+ ScChangeActionMap::iterator itChangeAction;
- while(pChild!=NULL)
+ for( itChangeAction = pActionMap->begin(); itChangeAction != pActionMap->end(); ++itChangeAction )
{
- if(pScChangeAction!=pChild)
- pEntry=InsertChangeAction(pChild,SC_CAS_VIRGIN,pParent,false,true);
+ if( pScChangeAction != itChangeAction->second )
+ pEntry = InsertChangeAction( itChangeAction->second, SC_CAS_VIRGIN, pParent, false, true );
else
- pEntry=InsertChangeAction(pChild,SC_CAS_VIRGIN,pParent,true,true);
+ pEntry = InsertChangeAction( itChangeAction->second, SC_CAS_VIRGIN, pParent, true, true );
if(pEntry!=NULL)
{
@@ -1346,10 +1349,9 @@ bool ScAcceptChgDlg::InsertDeletedChildren(const ScChangeAction* pScChangeAction
bTheTestFlag=false;
- if ( pChild->IsDialogParent() )
- Expand(pChanges,pChild,pEntry);
+ if( itChangeAction->second->IsDialogParent() )
+ Expand( pChanges, itChangeAction->second, pEntry );
}
- pChild=pActionTable->Next();
}
return bTheTestFlag;
}
@@ -1362,15 +1364,15 @@ bool ScAcceptChgDlg::Expand(
if(pChanges!=NULL &&pEntry!=NULL &&pScChangeAction!=NULL)
{
- ScChangeActionTable aActionTable;
+ ScChangeActionMap aActionMap;
- GetDependents( pScChangeAction,aActionTable,pEntry);
+ GetDependents( pScChangeAction, aActionMap, pEntry );
switch(pScChangeAction->GetType())
{
case SC_CAT_CONTENT:
{
- InsertContentChildren(&aActionTable,pEntry);
+ InsertContentChildren( &aActionMap, pEntry );
bTheTestFlag=!bHasFilterEntry;
break;
}
@@ -1378,18 +1380,18 @@ bool ScAcceptChgDlg::Expand(
case SC_CAT_DELETE_ROWS:
case SC_CAT_DELETE_TABS:
{
- InsertDeletedChildren(pScChangeAction,&aActionTable,pEntry);
+ InsertDeletedChildren( pScChangeAction, &aActionMap, pEntry );
bTheTestFlag=!bHasFilterEntry;
break;
}
default:
{
if(!bFilter)
- bTheTestFlag=InsertChildren(&aActionTable,pEntry);
+ bTheTestFlag = InsertChildren( &aActionMap, pEntry );
break;
}
}
- aActionTable.Clear();
+ aActionMap.clear();
}
return bTheTestFlag;
}
@@ -1401,7 +1403,7 @@ IMPL_LINK( ScAcceptChgDlg, ExpandingHandle, SvxRedlinTable*, pTable )
SetPointer(Pointer(POINTER_WAIT));
if(pTable!=NULL && pChanges!=NULL)
{
- ScChangeActionTable aActionTable;
+ ScChangeActionMap aActionMap;
SvLBoxEntry* pEntry=pTheView->GetHdlEntry();
if(pEntry!=NULL)
{
@@ -1419,29 +1421,29 @@ IMPL_LINK( ScAcceptChgDlg, ExpandingHandle, SvxRedlinTable*, pTable )
{
pScChangeAction=(ScChangeAction*) pEntryData->pData;
- GetDependents( pScChangeAction,aActionTable,pEntry);
+ GetDependents( pScChangeAction, aActionMap, pEntry );
switch(pScChangeAction->GetType())
{
case SC_CAT_CONTENT:
{
- bTheTestFlag=InsertContentChildren(&aActionTable,pEntry);
+ bTheTestFlag = InsertContentChildren( &aActionMap, pEntry );
break;
}
case SC_CAT_DELETE_COLS:
case SC_CAT_DELETE_ROWS:
case SC_CAT_DELETE_TABS:
{
- bTheTestFlag=InsertDeletedChildren(pScChangeAction,&aActionTable,pEntry);
+ bTheTestFlag = InsertDeletedChildren( pScChangeAction, &aActionMap, pEntry );
break;
}
default:
{
- bTheTestFlag=InsertChildren(&aActionTable,pEntry);
+ bTheTestFlag = InsertChildren( &aActionMap, pEntry );
break;
}
}
- aActionTable.Clear();
+ aActionMap.clear();
}
else
@@ -1470,7 +1472,6 @@ void ScAcceptChgDlg::AppendChanges(ScChangeTrack* pChanges,sal_uLong nStartActio
SetPointer(Pointer(POINTER_WAIT));
pTheView->SetUpdateMode(false);
- ScChangeActionTable ActionTable;
bool bTheFlag = false;
bool bFilterFlag = pTPFilter->IsDate() || pTPFilter->IsRange() ||
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index 71171ee03b89..4e087cb6221f 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -278,7 +278,7 @@ bool ScConflictsFinder::Find()
if ( aOwnActions.size() )
{
- ScConflictsListEntry* pEntry = GetEntry( pSharedAction->GetActionNumber(), aOwnActions );;
+ ScConflictsListEntry* pEntry = GetEntry( pSharedAction->GetActionNumber(), aOwnActions );
ScChangeActionList::iterator aEnd = aOwnActions.end();
for ( ScChangeActionList::iterator aItr = aOwnActions.begin(); aItr != aEnd; ++aItr )
{
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index 9f870475a2f5..1f335650fcd7 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -115,10 +115,11 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen
aRange.Format( aAreaStr, ABS_DREF3D, mpDoc,
ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0) );
- Selection aCurSel = Selection( 0, SELECTION_MAX );
- maEdRange.GrabFocus();
maEdRange.SetText( aAreaStr );
- maEdRange.SetSelection( aCurSel );
+
+ Selection aCurSel = Selection( 0, SELECTION_MAX );
+ maEdName.GrabFocus();
+ maEdName.SetSelection( aCurSel );
}
void ScNameDefDlg::CancelPushed()
diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx
index 99b1ea0367ba..7f8eb6bf3e06 100644
--- a/sc/source/ui/namedlg/namemgrtable.cxx
+++ b/sc/source/ui/namedlg/namemgrtable.cxx
@@ -104,10 +104,11 @@ ScRangeManagerTable::~ScRangeManagerTable()
Clear();
}
-void ScRangeManagerTable::addEntry(const ScRangeNameLine& rLine)
+void ScRangeManagerTable::addEntry(const ScRangeNameLine& rLine, bool bSetCurEntry)
{
SvLBoxEntry* pEntry = InsertEntryToColumn( createEntryString(rLine), LIST_APPEND, 0xffff);
- SetCurEntry(pEntry);
+ if (bSetCurEntry)
+ SetCurEntry(pEntry);
}
void ScRangeManagerTable::GetCurrentLine(ScRangeNameLine& rLine)
@@ -141,7 +142,7 @@ void ScRangeManagerTable::Init()
if (!it->second->HasType(RT_DATABASE) && !it->second->HasType(RT_SHARED))
{
aLine.aName = it->second->GetName();
- addEntry(aLine);
+ addEntry(aLine, false);
}
}
}
diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx
index 853c87b87664..0eb5bf78f00b 100644
--- a/sc/source/ui/optdlg/tpcalc.cxx
+++ b/sc/source/ui/optdlg/tpcalc.cxx
@@ -26,11 +26,8 @@
*
************************************************************************/
-
#undef SC_DLLIMPLEMENTATION
-
-
//------------------------------------------------------------------
#include "scitems.hxx"
@@ -52,15 +49,6 @@
#include <math.h>
-// STATIC DATA -----------------------------------------------------------
-
-static sal_uInt16 pCalcOptRanges[] =
-{
- SID_SCDOCOPTIONS,
- SID_SCDOCOPTIONS,
- 0
-};
-
//========================================================================
ScTpCalcOptions::ScTpCalcOptions( Window* pParent,
@@ -123,13 +111,6 @@ void ScTpCalcOptions::Init()
//-----------------------------------------------------------------------
-sal_uInt16* ScTpCalcOptions::GetRanges()
-{
- return pCalcOptRanges;
-}
-
-//-----------------------------------------------------------------------
-
SfxTabPage* ScTpCalcOptions::Create( Window* pParent, const SfxItemSet& rAttrSet )
{
return ( new ScTpCalcOptions( pParent, rAttrSet ) );
diff --git a/sc/source/ui/optdlg/tpprint.cxx b/sc/source/ui/optdlg/tpprint.cxx
index e8cac656ae9b..81850282dfab 100644
--- a/sc/source/ui/optdlg/tpprint.cxx
+++ b/sc/source/ui/optdlg/tpprint.cxx
@@ -40,15 +40,6 @@
// -----------------------------------------------------------------------
-static sal_uInt16 pPrintOptRanges[] =
-{
- SID_SCPRINTOPTIONS,
- SID_SCPRINTOPTIONS,
- 0
-};
-
-// -----------------------------------------------------------------------
-
ScTpPrintOptions::ScTpPrintOptions( Window* pParent,
const SfxItemSet& rCoreAttrs )
: SfxTabPage ( pParent,
@@ -66,11 +57,6 @@ ScTpPrintOptions::~ScTpPrintOptions()
{
}
-sal_uInt16* ScTpPrintOptions::GetRanges()
-{
- return pPrintOptRanges;
-}
-
SfxTabPage* ScTpPrintOptions::Create( Window* pParent, const SfxItemSet& rAttrSet )
{
return new ScTpPrintOptions( pParent, rAttrSet );
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index 5e69b75099b9..46b9037d6d74 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -54,16 +54,8 @@
#define CR (sal_Unicode)13
#define LF (sal_Unicode)10
-static sal_uInt16 pUserListsRanges[] =
-{
- SID_SCUSERLISTS,
- SID_SCUSERLISTS,
- 0
-};
-
static const sal_Unicode cDelimiter = ',';
-
//========================================================================
// Benutzerdefinierte Listen:
@@ -165,13 +157,6 @@ void ScTpUserLists::Init()
// -----------------------------------------------------------------------
-sal_uInt16* ScTpUserLists::GetRanges()
-{
- return pUserListsRanges;
-}
-
-// -----------------------------------------------------------------------
-
SfxTabPage* ScTpUserLists::Create( Window* pParent, const SfxItemSet& rAttrSet )
{
return ( new ScTpUserLists( pParent, rAttrSet ) );
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 464f14119a50..8d6425dfd45d 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -1851,5 +1851,9 @@ Resource RID_GLOBSTR
{
Text [ en-US ] = "Invalid name. Only use letters, numbers and underscore.";
};
+ String STR_UNSAVED_EXT_REF
+ {
+ Text [ en-US ] = "This Document contains external references to unsaved documents.\n\nDo you want to continue?";
+ };
};
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 97dca67b0857..48651281d6f2 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -1395,6 +1395,11 @@ public:
if (ScRefTokenHelper::isExternalRef(rRef))
return;
+ // Don't assume an ScDoubleRefToken if it isn't. It can be at least an
+ // ScSingleRefToken, then there isn't anything to shrink.
+ if (rRef->GetType() != svDoubleRef)
+ return;
+
ScComplexRefData& rData = rRef->GetDoubleRef();
ScSingleRefData& s = rData.Ref1;
ScSingleRefData& e = rData.Ref2;
diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index 8d16f38c2ce6..4fe9f0fd7cc5 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -51,8 +51,15 @@
#include <memory>
+#include <optutil.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+
using namespace ::com::sun::star;
using ::rtl::OUStringBuffer;
+using namespace rtl;
+using namespace com::sun::star::uno;
//------------------------------------------------------------------------
@@ -66,6 +73,57 @@ SC_SIMPLE_SERVICE_INFO( ScFilterOptionsObj, SCFILTEROPTIONSOBJ_IMPLNAME, SCFILTE
#define SC_UNONAME_FILTEROPTIONS "FilterOptions"
#define SC_UNONAME_INPUTSTREAM "InputStream"
+
+#define DBF_CHAR_SET "CharSet"
+#define DBF_SEP_PATH_IMPORT "Office.Calc/Dialogs/DBFImport"
+#define DBF_SEP_PATH_EXPORT "Office.Calc/Dialogs/DBFExport"
+
+//------------------------------------------------------------------------
+
+static void load_CharSet( rtl_TextEncoding &nCharSet, bool bExport )
+{
+ sal_Int32 nChar = 0;
+ Sequence<Any> aValues;
+ const Any *pProperties;
+ Sequence<OUString> aNames(1);
+ OUString* pNames = aNames.getArray();
+ ScLinkConfigItem aItem( OUString::createFromAscii(
+ bExport?DBF_SEP_PATH_EXPORT:DBF_SEP_PATH_IMPORT ) );
+
+ pNames[0] = OUString::createFromAscii( DBF_CHAR_SET );
+ aValues = aItem.GetProperties( aNames );
+ pProperties = aValues.getConstArray();
+
+ // Default choice
+ nCharSet = RTL_TEXTENCODING_IBM_850;
+
+ if( pProperties[0].hasValue() )
+ {
+ pProperties[0] >>= nChar;
+ if( nChar >= 0)
+ {
+ nCharSet = (rtl_TextEncoding) nChar;
+ }
+ }
+}
+
+static void save_CharSet( rtl_TextEncoding nCharSet, bool bExport )
+{
+ Sequence<Any> aValues;
+ Any *pProperties;
+ Sequence<OUString> aNames(1);
+ OUString* pNames = aNames.getArray();
+ ScLinkConfigItem aItem( OUString::createFromAscii(
+ bExport?DBF_SEP_PATH_EXPORT:DBF_SEP_PATH_IMPORT ) );
+
+ pNames[0] = OUString::createFromAscii( DBF_CHAR_SET );
+ aValues = aItem.GetProperties( aNames );
+ pProperties = aValues.getArray();
+ pProperties[0] <<= (sal_Int32) nCharSet;
+
+ aItem.PutProperties(aNames, aValues);
+}
+
//------------------------------------------------------------------------
ScFilterOptionsObj::ScFilterOptionsObj() :
@@ -250,8 +308,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
// dBase import
aTitle = ScGlobal::GetRscString( STR_IMPORT_DBF );
}
- // common for dBase import/export
- eEncoding = RTL_TEXTENCODING_IBM_850;
+ load_CharSet( eEncoding, bExport );
bDBEnc = sal_True;
}
else if ( aFilterString == ScDocShell::GetDifFilterName() )
@@ -279,6 +336,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
if ( pDlg->Execute() == RET_OK )
{
pDlg->GetImportOptions( aOptions );
+ save_CharSet( aOptions.eCharSet, bExport );
if ( bAscii )
aFilterOptions = aOptions.BuildString();
else
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 9d33f09eca2f..fd3b0d264ebd 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -734,7 +734,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
// get file header
rStr.Seek( 0 );
const sal_Size nTrySize = 80;
- ByteString aHeader = read_uInt8s_AsOString(rStr, nTrySize);
+ ByteString aHeader = read_uInt8s_ToOString(rStr, nTrySize);
if ( HTMLParser::IsHTMLFormat( aHeader.GetBuffer() ) )
{
diff --git a/sc/source/ui/vba/vbachart.cxx b/sc/source/ui/vba/vbachart.cxx
index 36c123e8253b..beaa45702743 100644
--- a/sc/source/ui/vba/vbachart.cxx
+++ b/sc/source/ui/vba/vbachart.cxx
@@ -592,7 +592,7 @@ ScVbaChart::setSourceData( const css::uno::Reference< ::ooo::vba::excel::XRange
ScDocument* pDoc = pRange->getScDocument();
if ( pDoc )
{
- bsetRowHeaders = pDoc->HasRowHeader( static_cast< SCCOL >( mSingleRangeAddress.StartColumn ), static_cast< SCROW >( mSingleRangeAddress.StartRow ), static_cast< SCCOL >( mSingleRangeAddress.EndColumn ), static_cast< SCROW >( mSingleRangeAddress.EndRow ), static_cast< SCTAB >( mSingleRangeAddress.Sheet ) );;
+ bsetRowHeaders = pDoc->HasRowHeader( static_cast< SCCOL >( mSingleRangeAddress.StartColumn ), static_cast< SCROW >( mSingleRangeAddress.StartRow ), static_cast< SCCOL >( mSingleRangeAddress.EndColumn ), static_cast< SCROW >( mSingleRangeAddress.EndRow ), static_cast< SCTAB >( mSingleRangeAddress.Sheet ) );
bsetColumnHeaders = pDoc->HasColHeader( static_cast< SCCOL >( mSingleRangeAddress.StartColumn ), static_cast< SCROW >( mSingleRangeAddress.StartRow ), static_cast< SCCOL >( mSingleRangeAddress.EndColumn ), static_cast< SCROW >( mSingleRangeAddress.EndRow ), static_cast< SCTAB >( mSingleRangeAddress.Sheet ));
;
}
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index e6484ceec031..1a0218962b0c 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -624,7 +624,7 @@ void lcl_FillHFParam( ScPrintHFParam& rParam, const SfxItemSet* pHFSet )
rParam.nRight = nTmp < 0 ? 0 : sal_uInt16(nTmp);
rParam.pBorder = (const SvxBoxItem*) &pHFSet->Get(ATTR_BORDER);
rParam.pBack = (const SvxBrushItem*) &pHFSet->Get(ATTR_BACKGROUND);
- rParam.pShadow = (const SvxShadowItem*)&pHFSet->Get(ATTR_SHADOW);;
+ rParam.pShadow = (const SvxShadowItem*)&pHFSet->Get(ATTR_SHADOW);
// jetzt doch wieder schon im Dialog:
// rParam.nHeight += rParam.nDistance; // nicht mehr im Dialog ???
@@ -3051,25 +3051,4 @@ void ScPrintFunc::CalcPages() // berechnet aPageRect und Seiten au
}
}
-//------------------------------------------------------------------------
-// class ScJobSetup
-//------------------------------------------------------------------------
-
-ScJobSetup::ScJobSetup( SfxPrinter* pPrinter )
-{
- eOrientation = pPrinter->GetOrientation();
- nPaperBin = pPrinter->GetPaperBin();
- ePaper = pPrinter->GetPaper();
-
- if ( PAPER_USER == ePaper )
- {
- aUserSize = pPrinter->GetPaperSize();
- aUserMapMode = pPrinter->GetMapMode();
- }
-};
-
-
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx
index f25002f66567..5f59adad258b 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -99,13 +99,4 @@ SFX_IMPL_NAMED_VIEWFACTORY( ScTabViewShell, "Default" )
SFX_VIEW_REGISTRATION(ScDocShell);
}
-//------------------------------------------------------------------
-
-IMPL_LINK( ScTabViewShell, HtmlOptionsHdl, void*, EMPTYARG )
-{
- // Invalidierung, falls blinkender Text erlaubt/verboten wurde
- GetViewFrame()->GetBindings().Invalidate(SID_DRAW_TEXT_MARQUEE);
- return 0;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index cfa027e8d54e..e2c950c4d9b9 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -89,6 +89,7 @@
#include "docuno.hxx"
#include "charthelper.hxx"
#include "tabbgcolor.hxx"
+#include "clipparam.hxx"
#include <basic/sbstar.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -2562,6 +2563,7 @@ void ScViewFunc::MoveTable(
if(nDestTab==SC_TAB_APPEND)
nDestTab=pDestDoc->GetTableCount();
SCTAB nDestTab1=nDestTab;
+ ScClipParam aParam;
for( sal_uInt16 j=0; j<TheTabs.size(); ++j, ++nDestTab1 )
{ // insert sheets first and update all references
rtl::OUString aName;
@@ -2576,7 +2578,10 @@ void ScViewFunc::MoveTable(
nErrVal = 0; // total error
break; // for
}
+ ScRange aRange( 0, 0, TheTabs[j], MAXCOL, MAXROW, TheTabs[j] );
+ aParam.maRanges.Append(aRange);
}
+ pDoc->SetClipParam(aParam);
if ( nErrVal > 0 )
{
nDestTab1 = nDestTab;
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 68ccf215583c..bd133148e82e 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -277,28 +277,9 @@ sal_Bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, sal_Bool bCut, sal_Bool b
{
ScRange aRange;
ScMarkType eMarkType = GetViewData()->GetSimpleArea( aRange );
- ScDocument* pDoc = GetViewData()->GetDocument();
ScMarkData& rMark = GetViewData()->GetMarkData();
sal_Bool bDone = sal_False;
- if( !pClipDoc ) // System Copy - adjust the ranges.
- {
- SCCOL nCol1 = aRange.aStart.Col();
- SCCOL nCol2 = aRange.aEnd.Col();
- SCROW nRow1 = aRange.aStart.Row();
- SCROW nRow2 = aRange.aEnd.Row();
- pDoc->ShrinkToDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2 );
- if( aRange.aStart.Col() == 0 && aRange.aEnd.Col() == MAXCOL )
- {
- aRange.aStart.SetCol( nCol1 );
- aRange.aEnd.SetCol( nCol2 );
- }
- if( aRange.aStart.Row() == 0 && aRange.aEnd.Row() == MAXROW )
- {
- aRange.aStart.SetRow( nRow1 );
- aRange.aEnd.SetRow( nRow2 );
- }
- }
if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED )
{
ScRangeList aRangeList;
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 184aa3623932..86c44961a02d 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -403,7 +403,7 @@ void ScViewFunc::DoThesaurus( sal_Bool bRecord )
{
OSL_FAIL("DoThesaurus: Keine String oder Editzelle");
}
- pEditView = GetViewData()->GetEditView(GetViewData()->GetActivePart());;
+ pEditView = GetViewData()->GetEditView(GetViewData()->GetActivePart());
if (pEditSel)
pEditView->SetSelection(*pEditSel);
else