2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-30 12:23:25 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
#include "externalrefmgr.hxx"
|
|
|
|
#include "document.hxx"
|
|
|
|
#include "token.hxx"
|
|
|
|
#include "tokenarray.hxx"
|
|
|
|
#include "address.hxx"
|
|
|
|
#include "tablink.hxx"
|
|
|
|
#include "docsh.hxx"
|
|
|
|
#include "scextopt.hxx"
|
|
|
|
#include "rangenam.hxx"
|
2013-03-28 15:20:14 -04:00
|
|
|
#include "formulacell.hxx"
|
2008-12-12 09:38:47 +00:00
|
|
|
#include "viewdata.hxx"
|
|
|
|
#include "tabvwsh.hxx"
|
|
|
|
#include "sc.hrc"
|
2012-01-06 19:32:19 +01:00
|
|
|
#include "globstr.hrc"
|
2013-03-26 19:38:24 -04:00
|
|
|
#include "cellvalue.hxx"
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2014-05-10 18:19:39 +02:00
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
#include <sfx2/docfilt.hxx>
|
|
|
|
#include <sfx2/docfile.hxx>
|
|
|
|
#include <sfx2/fcontnr.hxx>
|
|
|
|
#include <sfx2/sfxsids.hrc>
|
|
|
|
#include <sfx2/objsh.hxx>
|
|
|
|
#include <svl/broadcast.hxx>
|
|
|
|
#include <svl/smplhint.hxx>
|
|
|
|
#include <svl/itemset.hxx>
|
|
|
|
#include <svl/stritem.hxx>
|
|
|
|
#include <svl/urihelper.hxx>
|
|
|
|
#include <svl/zformat.hxx>
|
|
|
|
#include <svl/sharedstringpool.hxx>
|
|
|
|
#include <sfx2/linkmgr.hxx>
|
|
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#include <unotools/ucbhelper.hxx>
|
|
|
|
#include <unotools/localfilehelper.hxx>
|
|
|
|
#include <vcl/msgbox.hxx>
|
2013-03-20 22:24:57 -04:00
|
|
|
#include "stringutil.hxx"
|
2013-07-01 16:04:35 -04:00
|
|
|
#include "scmatrix.hxx"
|
2014-05-20 13:57:13 -04:00
|
|
|
#include <columnspanset.hxx>
|
|
|
|
#include <column.hxx>
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <algorithm>
|
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
using ::std::auto_ptr;
|
|
|
|
using ::com::sun::star::uno::Any;
|
|
|
|
using ::std::vector;
|
|
|
|
using ::std::find;
|
|
|
|
using ::std::find_if;
|
2011-05-06 00:07:35 -04:00
|
|
|
using ::std::remove_if;
|
2008-12-12 09:38:47 +00:00
|
|
|
using ::std::distance;
|
|
|
|
using ::std::pair;
|
|
|
|
using ::std::list;
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
using ::std::unary_function;
|
2009-01-13 11:01:13 +00:00
|
|
|
using namespace formula;
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2014-05-20 00:59:29 -04:00
|
|
|
#define SRCDOC_LIFE_SPAN 30000 // 5 minutes (in 100th of a sec)
|
|
|
|
#define SRCDOC_SCAN_INTERVAL 1000*30 // every 30 seconds (in msec)
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2011-05-06 00:07:35 -04:00
|
|
|
class TabNameSearchPredicate : public unary_function<ScExternalRefCache::TableName, bool>
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-05-28 16:20:59 -04:00
|
|
|
explicit TabNameSearchPredicate(const OUString& rSearchName) :
|
2012-01-06 23:00:40 +00:00
|
|
|
maSearchName(ScGlobal::pCharClass->uppercase(rSearchName))
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator()(const ScExternalRefCache::TableName& rTabNameSet) const
|
|
|
|
{
|
|
|
|
// Ok, I'm doing case insensitive search here.
|
2011-05-28 16:20:59 -04:00
|
|
|
return rTabNameSet.maUpperName.equals(maSearchName);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString maSearchName;
|
2008-12-12 09:38:47 +00:00
|
|
|
};
|
|
|
|
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
class FindSrcFileByName : public unary_function<ScExternalRefManager::SrcFileData, bool>
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-05-28 16:20:59 -04:00
|
|
|
FindSrcFileByName(const OUString& rMatchName) :
|
2008-12-12 09:38:47 +00:00
|
|
|
mrMatchName(rMatchName)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator()(const ScExternalRefManager::SrcFileData& rSrcData) const
|
|
|
|
{
|
2011-05-28 16:20:59 -04:00
|
|
|
return rSrcData.maFileName.equals(mrMatchName);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2011-05-28 16:20:59 -04:00
|
|
|
const OUString& mrMatchName;
|
2008-12-12 09:38:47 +00:00
|
|
|
};
|
|
|
|
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
class NotifyLinkListener : public unary_function<ScExternalRefManager::LinkListener*, void>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NotifyLinkListener(sal_uInt16 nFileId, ScExternalRefManager::LinkUpdateType eType) :
|
|
|
|
mnFileId(nFileId), meType(eType) {}
|
|
|
|
|
|
|
|
NotifyLinkListener(const NotifyLinkListener& r) :
|
|
|
|
mnFileId(r.mnFileId), meType(r.meType) {}
|
|
|
|
|
|
|
|
void operator() (ScExternalRefManager::LinkListener* p) const
|
|
|
|
{
|
|
|
|
p->notify(mnFileId, meType);
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
sal_uInt16 mnFileId;
|
|
|
|
ScExternalRefManager::LinkUpdateType meType;
|
|
|
|
};
|
|
|
|
|
2010-03-05 19:43:26 -05:00
|
|
|
struct UpdateFormulaCell : public unary_function<ScFormulaCell*, void>
|
|
|
|
{
|
|
|
|
void operator() (ScFormulaCell* pCell) const
|
|
|
|
{
|
|
|
|
// Check to make sure the cell really contains ocExternalRef.
|
|
|
|
// External names, external cell and range references all have a
|
|
|
|
// ocExternalRef token.
|
2014-05-19 23:42:05 -04:00
|
|
|
ScTokenArray* pCode = pCell->GetCode();
|
2010-10-05 18:14:37 -04:00
|
|
|
if (!pCode->HasExternalRef())
|
2010-03-05 19:43:26 -05:00
|
|
|
return;
|
|
|
|
|
2014-05-19 23:42:05 -04:00
|
|
|
if (pCode->GetCodeError())
|
|
|
|
{
|
2010-03-05 19:43:26 -05:00
|
|
|
// Clear the error code, or a cell with error won't get re-compiled.
|
2014-05-19 23:42:05 -04:00
|
|
|
pCode->SetCodeError(0);
|
|
|
|
pCell->SetCompile(true);
|
|
|
|
pCell->CompileTokenArray();
|
|
|
|
}
|
2010-03-05 19:43:26 -05:00
|
|
|
|
|
|
|
pCell->SetDirty();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class RemoveFormulaCell : public unary_function<pair<const sal_uInt16, ScExternalRefManager::RefCellSet>, void>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit RemoveFormulaCell(ScFormulaCell* p) : mpCell(p) {}
|
|
|
|
void operator() (pair<const sal_uInt16, ScExternalRefManager::RefCellSet>& r) const
|
|
|
|
{
|
|
|
|
r.second.erase(mpCell);
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
ScFormulaCell* mpCell;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ConvertFormulaToStatic : public unary_function<ScFormulaCell*, void>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit ConvertFormulaToStatic(ScDocument* pDoc) : mpDoc(pDoc) {}
|
|
|
|
void operator() (ScFormulaCell* pCell) const
|
|
|
|
{
|
|
|
|
ScAddress aPos = pCell->aPos;
|
|
|
|
|
|
|
|
// We don't check for empty cells because empty external cells are
|
|
|
|
// treated as having a value of 0.
|
|
|
|
|
|
|
|
if (pCell->IsValue())
|
|
|
|
{
|
|
|
|
// Turn this into value cell.
|
2013-03-20 22:24:57 -04:00
|
|
|
mpDoc->SetValue(aPos, pCell->GetValue());
|
2010-03-05 19:43:26 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// string cell otherwise.
|
2013-03-20 22:24:57 -04:00
|
|
|
ScSetStringParam aParam;
|
|
|
|
aParam.setTextInput();
|
2013-10-10 20:24:21 -04:00
|
|
|
mpDoc->SetString(aPos, pCell->GetString().getString(), &aParam);
|
2010-03-05 19:43:26 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
ScDocument* mpDoc;
|
|
|
|
};
|
|
|
|
|
2011-05-06 00:07:35 -04:00
|
|
|
/**
|
2011-05-06 01:12:37 -04:00
|
|
|
* Check whether a named range contains an external reference to a
|
|
|
|
* particular document.
|
2011-05-06 00:07:35 -04:00
|
|
|
*/
|
2011-05-06 01:12:37 -04:00
|
|
|
bool hasRefsToSrcDoc(ScRangeData& rData, sal_uInt16 nFileId)
|
2011-05-06 00:07:35 -04:00
|
|
|
{
|
2011-05-06 01:12:37 -04:00
|
|
|
ScTokenArray* pArray = rData.GetCode();
|
|
|
|
if (!pArray)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
pArray->Reset();
|
|
|
|
ScToken* p = static_cast<ScToken*>(pArray->GetNextReference());
|
|
|
|
for (; p; p = static_cast<ScToken*>(pArray->GetNextReference()))
|
2011-05-06 00:07:35 -04:00
|
|
|
{
|
2011-05-06 01:12:37 -04:00
|
|
|
if (!p->IsExternalRef())
|
|
|
|
continue;
|
2011-05-06 00:07:35 -04:00
|
|
|
|
2011-05-06 01:12:37 -04:00
|
|
|
if (p->GetIndex() == nFileId)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2011-05-06 00:07:35 -04:00
|
|
|
|
2011-05-06 01:12:37 -04:00
|
|
|
class EraseRangeByIterator : unary_function<ScRangeName::iterator, void>
|
|
|
|
{
|
|
|
|
ScRangeName& mrRanges;
|
|
|
|
public:
|
|
|
|
EraseRangeByIterator(ScRangeName& rRanges) : mrRanges(rRanges) {}
|
|
|
|
void operator() (const ScRangeName::iterator& itr)
|
|
|
|
{
|
|
|
|
mrRanges.erase(itr);
|
2011-05-06 00:07:35 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-05-06 01:12:37 -04:00
|
|
|
/**
|
|
|
|
* Remove all named ranges that contain references to specified source
|
|
|
|
* document.
|
|
|
|
*/
|
|
|
|
void removeRangeNamesBySrcDoc(ScRangeName& rRanges, sal_uInt16 nFileId)
|
|
|
|
{
|
|
|
|
ScRangeName::iterator itr = rRanges.begin(), itrEnd = rRanges.end();
|
|
|
|
vector<ScRangeName::iterator> v;
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
{
|
2011-11-24 07:48:41 +01:00
|
|
|
if (hasRefsToSrcDoc(*itr->second, nFileId))
|
2011-05-06 01:12:37 -04:00
|
|
|
v.push_back(itr);
|
|
|
|
}
|
|
|
|
for_each(v.begin(), v.end(), EraseRangeByIterator(rRanges));
|
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefCache::Table::Table()
|
2009-07-28 10:04:47 +00:00
|
|
|
: meReferenced( REFERENCED_MARKED )
|
|
|
|
// Prevent accidental data loss due to lack of knowledge.
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefCache::Table::~Table()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-05-20 13:57:13 -04:00
|
|
|
void ScExternalRefCache::Table::clear()
|
|
|
|
{
|
|
|
|
maRows.clear();
|
|
|
|
maCachedRanges.RemoveAll();
|
|
|
|
meReferenced = REFERENCED_MARKED;
|
|
|
|
}
|
|
|
|
|
2009-07-28 10:04:47 +00:00
|
|
|
void ScExternalRefCache::Table::setReferencedFlag( ScExternalRefCache::Table::ReferencedFlag eFlag )
|
|
|
|
{
|
|
|
|
meReferenced = eFlag;
|
|
|
|
}
|
|
|
|
|
2009-04-02 15:00:15 +00:00
|
|
|
void ScExternalRefCache::Table::setReferenced( bool bReferenced )
|
|
|
|
{
|
2009-07-28 10:04:47 +00:00
|
|
|
if (meReferenced != REFERENCED_PERMANENT)
|
|
|
|
meReferenced = (bReferenced ? REFERENCED_MARKED : UNREFERENCED);
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefCache::Table::ReferencedFlag ScExternalRefCache::Table::getReferencedFlag() const
|
|
|
|
{
|
|
|
|
return meReferenced;
|
2009-04-02 15:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ScExternalRefCache::Table::isReferenced() const
|
|
|
|
{
|
2009-07-28 10:04:47 +00:00
|
|
|
return meReferenced != UNREFERENCED;
|
2009-04-02 15:00:15 +00:00
|
|
|
}
|
|
|
|
|
2011-12-07 22:33:44 -05:00
|
|
|
void ScExternalRefCache::Table::setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uLong nFmtIndex, bool bSetCacheRange)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
using ::std::pair;
|
|
|
|
RowsDataType::iterator itrRow = maRows.find(nRow);
|
|
|
|
if (itrRow == maRows.end())
|
|
|
|
{
|
|
|
|
// This row does not exist yet.
|
|
|
|
pair<RowsDataType::iterator, bool> res = maRows.insert(
|
|
|
|
RowsDataType::value_type(nRow, RowDataType()));
|
|
|
|
|
|
|
|
if (!res.second)
|
|
|
|
return;
|
|
|
|
|
|
|
|
itrRow = res.first;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Insert this token into the specified column location. I don't need to
|
|
|
|
// check for existing data. Just overwrite it.
|
|
|
|
RowDataType& rRow = itrRow->second;
|
|
|
|
ScExternalRefCache::Cell aCell;
|
|
|
|
aCell.mxToken = pToken;
|
|
|
|
aCell.mnFmtIndex = nFmtIndex;
|
|
|
|
rRow.insert(RowDataType::value_type(nCol, aCell));
|
2010-02-11 17:28:24 -05:00
|
|
|
if (bSetCacheRange)
|
|
|
|
setCachedCell(nCol, nRow);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefCache::TokenRef ScExternalRefCache::Table::getCell(SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex) const
|
|
|
|
{
|
|
|
|
RowsDataType::const_iterator itrTable = maRows.find(nRow);
|
|
|
|
if (itrTable == maRows.end())
|
|
|
|
{
|
|
|
|
// this table doesn't have the specified row.
|
2010-02-11 17:28:24 -05:00
|
|
|
return getEmptyOrNullToken(nCol, nRow);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const RowDataType& rRowData = itrTable->second;
|
|
|
|
RowDataType::const_iterator itrRow = rRowData.find(nCol);
|
|
|
|
if (itrRow == rRowData.end())
|
|
|
|
{
|
|
|
|
// this row doesn't have the specified column.
|
2010-02-11 17:28:24 -05:00
|
|
|
return getEmptyOrNullToken(nCol, nRow);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const Cell& rCell = itrRow->second;
|
|
|
|
if (pnFmtIndex)
|
|
|
|
*pnFmtIndex = rCell.mnFmtIndex;
|
|
|
|
|
|
|
|
return rCell.mxToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ScExternalRefCache::Table::hasRow( SCROW nRow ) const
|
|
|
|
{
|
|
|
|
RowsDataType::const_iterator itrRow = maRows.find(nRow);
|
|
|
|
return itrRow != maRows.end();
|
|
|
|
}
|
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
void ScExternalRefCache::Table::getAllRows(vector<SCROW>& rRows, SCROW nLow, SCROW nHigh) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
vector<SCROW> aRows;
|
|
|
|
aRows.reserve(maRows.size());
|
|
|
|
RowsDataType::const_iterator itr = maRows.begin(), itrEnd = maRows.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
2010-02-11 17:28:24 -05:00
|
|
|
if (nLow <= itr->first && itr->first <= nHigh)
|
|
|
|
aRows.push_back(itr->first);
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
// hash map is not ordered, so we need to explicitly sort it.
|
|
|
|
::std::sort(aRows.begin(), aRows.end());
|
|
|
|
rRows.swap(aRows);
|
|
|
|
}
|
|
|
|
|
2009-12-15 17:17:08 +01:00
|
|
|
::std::pair< SCROW, SCROW > ScExternalRefCache::Table::getRowRange() const
|
|
|
|
{
|
|
|
|
::std::pair< SCROW, SCROW > aRange( 0, 0 );
|
|
|
|
if( !maRows.empty() )
|
|
|
|
{
|
|
|
|
// iterate over entire container (hash map is not sorted by key)
|
|
|
|
RowsDataType::const_iterator itr = maRows.begin(), itrEnd = maRows.end();
|
|
|
|
aRange.first = itr->first;
|
|
|
|
aRange.second = itr->first + 1;
|
|
|
|
while( ++itr != itrEnd )
|
|
|
|
{
|
|
|
|
if( itr->first < aRange.first )
|
|
|
|
aRange.first = itr->first;
|
|
|
|
else if( itr->first >= aRange.second )
|
|
|
|
aRange.second = itr->first + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aRange;
|
|
|
|
}
|
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
void ScExternalRefCache::Table::getAllCols(SCROW nRow, vector<SCCOL>& rCols, SCCOL nLow, SCCOL nHigh) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
RowsDataType::const_iterator itrRow = maRows.find(nRow);
|
|
|
|
if (itrRow == maRows.end())
|
|
|
|
// this table doesn't have the specified row.
|
|
|
|
return;
|
|
|
|
|
|
|
|
const RowDataType& rRowData = itrRow->second;
|
|
|
|
vector<SCCOL> aCols;
|
|
|
|
aCols.reserve(rRowData.size());
|
|
|
|
RowDataType::const_iterator itrCol = rRowData.begin(), itrColEnd = rRowData.end();
|
|
|
|
for (; itrCol != itrColEnd; ++itrCol)
|
2010-02-11 17:28:24 -05:00
|
|
|
if (nLow <= itrCol->first && itrCol->first <= nHigh)
|
|
|
|
aCols.push_back(itrCol->first);
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
// hash map is not ordered, so we need to explicitly sort it.
|
|
|
|
::std::sort(aCols.begin(), aCols.end());
|
|
|
|
rCols.swap(aCols);
|
|
|
|
}
|
|
|
|
|
2009-12-15 17:17:08 +01:00
|
|
|
::std::pair< SCCOL, SCCOL > ScExternalRefCache::Table::getColRange( SCROW nRow ) const
|
|
|
|
{
|
|
|
|
::std::pair< SCCOL, SCCOL > aRange( 0, 0 );
|
|
|
|
|
|
|
|
RowsDataType::const_iterator itrRow = maRows.find( nRow );
|
|
|
|
if (itrRow == maRows.end())
|
|
|
|
// this table doesn't have the specified row.
|
|
|
|
return aRange;
|
|
|
|
|
|
|
|
const RowDataType& rRowData = itrRow->second;
|
|
|
|
if( !rRowData.empty() )
|
|
|
|
{
|
|
|
|
// iterate over entire container (hash map is not sorted by key)
|
|
|
|
RowDataType::const_iterator itr = rRowData.begin(), itrEnd = rRowData.end();
|
|
|
|
aRange.first = itr->first;
|
|
|
|
aRange.second = itr->first + 1;
|
|
|
|
while( ++itr != itrEnd )
|
|
|
|
{
|
|
|
|
if( itr->first < aRange.first )
|
|
|
|
aRange.first = itr->first;
|
|
|
|
else if( itr->first >= aRange.second )
|
|
|
|
aRange.second = itr->first + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aRange;
|
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
void ScExternalRefCache::Table::getAllNumberFormats(vector<sal_uInt32>& rNumFmts) const
|
|
|
|
{
|
|
|
|
RowsDataType::const_iterator itrRow = maRows.begin(), itrRowEnd = maRows.end();
|
|
|
|
for (; itrRow != itrRowEnd; ++itrRow)
|
|
|
|
{
|
|
|
|
const RowDataType& rRowData = itrRow->second;
|
|
|
|
RowDataType::const_iterator itrCol = rRowData.begin(), itrColEnd = rRowData.end();
|
|
|
|
for (; itrCol != itrColEnd; ++itrCol)
|
|
|
|
{
|
|
|
|
const Cell& rCell = itrCol->second;
|
|
|
|
rNumFmts.push_back(rCell.mnFmtIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
bool ScExternalRefCache::Table::isRangeCached(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const
|
|
|
|
{
|
|
|
|
return maCachedRanges.In(ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefCache::Table::setCachedCell(SCCOL nCol, SCROW nRow)
|
|
|
|
{
|
|
|
|
setCachedCellRange(nCol, nRow, nCol, nRow);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefCache::Table::setCachedCellRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
|
|
|
|
{
|
|
|
|
ScRange aRange(nCol1, nRow1, 0, nCol2, nRow2, 0);
|
2010-12-08 22:38:24 -08:00
|
|
|
if ( maCachedRanges.empty() )
|
2010-02-11 17:28:24 -05:00
|
|
|
maCachedRanges.Append(aRange);
|
|
|
|
else
|
|
|
|
maCachedRanges.Join(aRange);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefCache::Table::setWholeTableCached()
|
|
|
|
{
|
|
|
|
setCachedCellRange(0, 0, MAXCOL, MAXROW);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ScExternalRefCache::Table::isInCachedRanges(SCCOL nCol, SCROW nRow) const
|
|
|
|
{
|
|
|
|
return maCachedRanges.In(ScRange(nCol, nRow, 0, nCol, nRow, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefCache::TokenRef ScExternalRefCache::Table::getEmptyOrNullToken(
|
|
|
|
SCCOL nCol, SCROW nRow) const
|
|
|
|
{
|
|
|
|
if (isInCachedRanges(nCol, nRow))
|
|
|
|
{
|
|
|
|
TokenRef p(new ScEmptyCellToken(false, false));
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
return TokenRef();
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
ScExternalRefCache::TableName::TableName(const OUString& rUpper, const OUString& rReal) :
|
2008-12-12 09:38:47 +00:00
|
|
|
maUpperName(rUpper), maRealName(rReal)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefCache::CellFormat::CellFormat() :
|
|
|
|
mbIsSet(false), mnType(NUMBERFORMAT_ALL), mnIndex(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-10-11 18:40:10 +02:00
|
|
|
ScExternalRefCache::ScExternalRefCache() {}
|
2013-10-09 22:12:12 -04:00
|
|
|
|
|
|
|
ScExternalRefCache::~ScExternalRefCache() {}
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
const OUString* ScExternalRefCache::getRealTableName(sal_uInt16 nFileId, const OUString& rTabName) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-11-05 16:49:55 -05:00
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
DocDataType::const_iterator itrDoc = maDocs.find(nFileId);
|
|
|
|
if (itrDoc == maDocs.end())
|
|
|
|
{
|
|
|
|
// specified document is not cached.
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const DocItem& rDoc = itrDoc->second;
|
|
|
|
TableNameIndexMap::const_iterator itrTabId = rDoc.maTableNameIndex.find(
|
2012-01-06 23:00:40 +00:00
|
|
|
ScGlobal::pCharClass->uppercase(rTabName));
|
2008-12-12 09:38:47 +00:00
|
|
|
if (itrTabId == rDoc.maTableNameIndex.end())
|
|
|
|
{
|
|
|
|
// the specified table is not in cache.
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return &rDoc.maTableNames[itrTabId->second].maRealName;
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
const OUString* ScExternalRefCache::getRealRangeName(sal_uInt16 nFileId, const OUString& rRangeName) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-11-05 16:49:55 -05:00
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
DocDataType::const_iterator itrDoc = maDocs.find(nFileId);
|
|
|
|
if (itrDoc == maDocs.end())
|
|
|
|
{
|
|
|
|
// specified document is not cached.
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const DocItem& rDoc = itrDoc->second;
|
|
|
|
NamePairMap::const_iterator itr = rDoc.maRealRangeNameMap.find(
|
2012-01-06 23:00:40 +00:00
|
|
|
ScGlobal::pCharClass->uppercase(rRangeName));
|
2008-12-12 09:38:47 +00:00
|
|
|
if (itr == rDoc.maRealRangeNameMap.end())
|
|
|
|
// range name not found.
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return &itr->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefCache::TokenRef ScExternalRefCache::getCellData(
|
2011-05-28 16:20:59 -04:00
|
|
|
sal_uInt16 nFileId, const OUString& rTabName, SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-11-05 16:49:55 -05:00
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
DocDataType::const_iterator itrDoc = maDocs.find(nFileId);
|
|
|
|
if (itrDoc == maDocs.end())
|
|
|
|
{
|
|
|
|
// specified document is not cached.
|
|
|
|
return TokenRef();
|
|
|
|
}
|
|
|
|
|
|
|
|
const DocItem& rDoc = itrDoc->second;
|
|
|
|
TableNameIndexMap::const_iterator itrTabId = rDoc.maTableNameIndex.find(
|
2012-01-06 23:00:40 +00:00
|
|
|
ScGlobal::pCharClass->uppercase(rTabName));
|
2008-12-12 09:38:47 +00:00
|
|
|
if (itrTabId == rDoc.maTableNameIndex.end())
|
|
|
|
{
|
|
|
|
// the specified table is not in cache.
|
|
|
|
return TokenRef();
|
|
|
|
}
|
|
|
|
|
|
|
|
const TableTypeRef& pTableData = rDoc.maTables[itrTabId->second];
|
|
|
|
if (!pTableData.get())
|
|
|
|
{
|
|
|
|
// the table data is not instantiated yet.
|
|
|
|
return TokenRef();
|
|
|
|
}
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
return pTableData->getCell(nCol, nRow, pnFmtIndex);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
|
2011-05-28 16:20:59 -04:00
|
|
|
sal_uInt16 nFileId, const OUString& rTabName, const ScRange& rRange)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-11-05 16:49:55 -05:00
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
DocDataType::iterator itrDoc = maDocs.find(nFileId);
|
|
|
|
if (itrDoc == maDocs.end())
|
|
|
|
// specified document is not cached.
|
|
|
|
return TokenArrayRef();
|
|
|
|
|
|
|
|
DocItem& rDoc = itrDoc->second;
|
|
|
|
|
|
|
|
TableNameIndexMap::iterator itrTabId = rDoc.maTableNameIndex.find(
|
2012-01-06 23:00:40 +00:00
|
|
|
ScGlobal::pCharClass->uppercase(rTabName));
|
2008-12-12 09:38:47 +00:00
|
|
|
if (itrTabId == rDoc.maTableNameIndex.end())
|
|
|
|
// the specified table is not in cache.
|
|
|
|
return TokenArrayRef();
|
|
|
|
|
|
|
|
const ScAddress& s = rRange.aStart;
|
|
|
|
const ScAddress& e = rRange.aEnd;
|
|
|
|
|
|
|
|
SCTAB nTab1 = s.Tab(), nTab2 = e.Tab();
|
|
|
|
SCCOL nCol1 = s.Col(), nCol2 = e.Col();
|
|
|
|
SCROW nRow1 = s.Row(), nRow2 = e.Row();
|
|
|
|
|
|
|
|
// Make sure I have all the tables cached.
|
|
|
|
size_t nTabFirstId = itrTabId->second;
|
|
|
|
size_t nTabLastId = nTabFirstId + nTab2 - nTab1;
|
|
|
|
if (nTabLastId >= rDoc.maTables.size())
|
|
|
|
// not all tables are cached.
|
|
|
|
return TokenArrayRef();
|
|
|
|
|
2009-10-21 13:32:17 +00:00
|
|
|
ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId));
|
2010-02-11 17:28:24 -05:00
|
|
|
|
2009-10-21 13:32:17 +00:00
|
|
|
RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find( aCacheRange);
|
|
|
|
if (itrRange != rDoc.maRangeArrays.end())
|
2010-02-11 17:28:24 -05:00
|
|
|
// Cache hit!
|
2009-10-21 13:32:17 +00:00
|
|
|
return itrRange->second;
|
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
::boost::scoped_ptr<ScRange> pNewRange;
|
|
|
|
TokenArrayRef pArray;
|
2008-12-12 09:38:47 +00:00
|
|
|
bool bFirstTab = true;
|
|
|
|
for (size_t nTab = nTabFirstId; nTab <= nTabLastId; ++nTab)
|
|
|
|
{
|
|
|
|
TableTypeRef pTab = rDoc.maTables[nTab];
|
|
|
|
if (!pTab.get())
|
|
|
|
return TokenArrayRef();
|
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
SCCOL nDataCol1 = nCol1, nDataCol2 = nCol2;
|
|
|
|
SCROW nDataRow1 = nRow1, nDataRow2 = nRow2;
|
|
|
|
|
|
|
|
if (!pTab->isRangeCached(nDataCol1, nDataRow1, nDataCol2, nDataRow2))
|
|
|
|
{
|
|
|
|
// specified range is not entirely within cached ranges.
|
|
|
|
return TokenArrayRef();
|
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
ScMatrixRef xMat = new ScMatrix(
|
2012-07-16 23:05:50 -04:00
|
|
|
static_cast<SCSIZE>(nDataCol2-nDataCol1+1), static_cast<SCSIZE>(nDataRow2-nDataRow1+1));
|
2010-02-11 17:28:24 -05:00
|
|
|
|
|
|
|
// Only fill non-empty cells, for better performance.
|
|
|
|
vector<SCROW> aRows;
|
|
|
|
pTab->getAllRows(aRows, nDataRow1, nDataRow2);
|
|
|
|
for (vector<SCROW>::const_iterator itr = aRows.begin(), itrEnd = aRows.end(); itr != itrEnd; ++itr)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2010-02-11 17:28:24 -05:00
|
|
|
SCROW nRow = *itr;
|
|
|
|
vector<SCCOL> aCols;
|
|
|
|
pTab->getAllCols(nRow, aCols, nDataCol1, nDataCol2);
|
|
|
|
for (vector<SCCOL>::const_iterator itrCol = aCols.begin(), itrColEnd = aCols.end(); itrCol != itrColEnd; ++itrCol)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2010-02-11 17:28:24 -05:00
|
|
|
SCCOL nCol = *itrCol;
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
TokenRef pToken = pTab->getCell(nCol, nRow);
|
2008-12-12 09:38:47 +00:00
|
|
|
if (!pToken)
|
2010-02-11 17:28:24 -05:00
|
|
|
// This should never happen!
|
|
|
|
return TokenArrayRef();
|
|
|
|
|
|
|
|
SCSIZE nC = nCol - nDataCol1, nR = nRow - nDataRow1;
|
|
|
|
switch (pToken->GetType())
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
{
|
2010-02-11 17:28:24 -05:00
|
|
|
case svDouble:
|
|
|
|
xMat->PutDouble(pToken->GetDouble(), nC, nR);
|
|
|
|
break;
|
|
|
|
case svString:
|
2013-10-10 20:24:21 -04:00
|
|
|
xMat->PutString(pToken->GetString(), nC, nR);
|
2010-02-11 17:28:24 -05:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
;
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
}
|
2010-02-11 17:28:24 -05:00
|
|
|
}
|
|
|
|
}
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
if (!bFirstTab)
|
|
|
|
pArray->AddOpCode(ocSep);
|
|
|
|
|
2010-12-17 01:59:24 -05:00
|
|
|
ScMatrixToken aToken(xMat);
|
2010-02-11 17:28:24 -05:00
|
|
|
if (!pArray)
|
|
|
|
pArray.reset(new ScTokenArray);
|
2008-12-12 09:38:47 +00:00
|
|
|
pArray->AddToken(aToken);
|
|
|
|
|
|
|
|
bFirstTab = false;
|
2010-02-11 17:28:24 -05:00
|
|
|
|
|
|
|
if (!pNewRange)
|
|
|
|
pNewRange.reset(new ScRange(nDataCol1, nDataRow1, 0, nDataCol2, nDataRow2, 0));
|
|
|
|
else
|
|
|
|
pNewRange->ExtendTo(ScRange(nDataCol1, nDataRow1, 0, nDataCol2, nDataRow2, 0));
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
2010-02-11 17:28:24 -05:00
|
|
|
|
|
|
|
if (pNewRange)
|
|
|
|
rDoc.maRangeArrays.insert( RangeArrayMap::value_type(*pNewRange, pArray));
|
2008-12-12 09:38:47 +00:00
|
|
|
return pArray;
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
ScExternalRefCache::TokenArrayRef ScExternalRefCache::getRangeNameTokens(sal_uInt16 nFileId, const OUString& rName)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-11-05 16:49:55 -05:00
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
DocItem* pDoc = getDocItem(nFileId);
|
|
|
|
if (!pDoc)
|
|
|
|
return TokenArrayRef();
|
|
|
|
|
|
|
|
RangeNameMap& rMap = pDoc->maRangeNames;
|
|
|
|
RangeNameMap::const_iterator itr = rMap.find(
|
2012-01-06 23:00:40 +00:00
|
|
|
ScGlobal::pCharClass->uppercase(rName));
|
2008-12-12 09:38:47 +00:00
|
|
|
if (itr == rMap.end())
|
|
|
|
return TokenArrayRef();
|
|
|
|
|
|
|
|
return itr->second;
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
void ScExternalRefCache::setRangeNameTokens(sal_uInt16 nFileId, const OUString& rName, TokenArrayRef pArray)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-11-05 16:49:55 -05:00
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
DocItem* pDoc = getDocItem(nFileId);
|
|
|
|
if (!pDoc)
|
|
|
|
return;
|
|
|
|
|
2013-10-07 14:02:47 +02:00
|
|
|
OUString aUpperName = ScGlobal::pCharClass->uppercase(rName);
|
2008-12-12 09:38:47 +00:00
|
|
|
RangeNameMap& rMap = pDoc->maRangeNames;
|
|
|
|
rMap.insert(RangeNameMap::value_type(aUpperName, pArray));
|
|
|
|
pDoc->maRealRangeNameMap.insert(NamePairMap::value_type(aUpperName, rName));
|
|
|
|
}
|
|
|
|
|
2013-11-05 19:06:15 -05:00
|
|
|
bool ScExternalRefCache::isValidRangeName(sal_uInt16 nFileId, const OUString& rName) const
|
|
|
|
{
|
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
|
|
|
|
|
|
|
DocItem* pDoc = getDocItem(nFileId);
|
|
|
|
if (!pDoc)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
const RangeNameMap& rMap = pDoc->maRangeNames;
|
|
|
|
return rMap.count(rName) > 0;
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
void ScExternalRefCache::setCellData(sal_uInt16 nFileId, const OUString& rTabName, SCCOL nCol, SCROW nRow,
|
2011-12-07 22:33:44 -05:00
|
|
|
TokenRef pToken, sal_uLong nFmtIndex)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
if (!isDocInitialized(nFileId))
|
|
|
|
return;
|
|
|
|
|
|
|
|
using ::std::pair;
|
|
|
|
DocItem* pDocItem = getDocItem(nFileId);
|
|
|
|
if (!pDocItem)
|
|
|
|
return;
|
|
|
|
|
|
|
|
DocItem& rDoc = *pDocItem;
|
|
|
|
|
|
|
|
// See if the table by this name already exists.
|
|
|
|
TableNameIndexMap::iterator itrTabName = rDoc.maTableNameIndex.find(
|
2012-01-06 23:00:40 +00:00
|
|
|
ScGlobal::pCharClass->uppercase(rTabName));
|
2008-12-12 09:38:47 +00:00
|
|
|
if (itrTabName == rDoc.maTableNameIndex.end())
|
|
|
|
// Table not found. Maybe the table name or the file id is wrong ???
|
|
|
|
return;
|
|
|
|
|
|
|
|
TableTypeRef& pTableData = rDoc.maTables[itrTabName->second];
|
|
|
|
if (!pTableData.get())
|
|
|
|
pTableData.reset(new Table);
|
|
|
|
|
|
|
|
pTableData->setCell(nCol, nRow, pToken, nFmtIndex);
|
2010-02-11 17:28:24 -05:00
|
|
|
pTableData->setCachedCell(nCol, nRow);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRange, const vector<SingleRangeData>& rData,
|
2011-01-11 17:38:24 -05:00
|
|
|
const TokenArrayRef& pArray)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
using ::std::pair;
|
|
|
|
if (rData.empty() || !isDocInitialized(nFileId))
|
|
|
|
// nothing to cache
|
|
|
|
return;
|
|
|
|
|
|
|
|
// First, get the document item for the given file ID.
|
|
|
|
DocItem* pDocItem = getDocItem(nFileId);
|
|
|
|
if (!pDocItem)
|
|
|
|
return;
|
|
|
|
|
|
|
|
DocItem& rDoc = *pDocItem;
|
|
|
|
|
|
|
|
// Now, find the table position of the first table to cache.
|
2013-10-07 14:02:47 +02:00
|
|
|
const OUString& rFirstTabName = rData.front().maTableName;
|
2008-12-12 09:38:47 +00:00
|
|
|
TableNameIndexMap::iterator itrTabName = rDoc.maTableNameIndex.find(
|
2012-01-06 23:00:40 +00:00
|
|
|
ScGlobal::pCharClass->uppercase(rFirstTabName));
|
2008-12-12 09:38:47 +00:00
|
|
|
if (itrTabName == rDoc.maTableNameIndex.end())
|
|
|
|
{
|
|
|
|
// table index not found.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-10-21 13:32:17 +00:00
|
|
|
size_t nTabFirstId = itrTabName->second;
|
2008-12-12 09:38:47 +00:00
|
|
|
SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
|
|
|
|
SCCOL nCol1 = rRange.aStart.Col(), nCol2 = rRange.aEnd.Col();
|
|
|
|
vector<SingleRangeData>::const_iterator itrDataBeg = rData.begin(), itrDataEnd = rData.end();
|
|
|
|
for (vector<SingleRangeData>::const_iterator itrData = itrDataBeg; itrData != itrDataEnd; ++itrData)
|
|
|
|
{
|
2009-10-21 13:32:17 +00:00
|
|
|
size_t i = nTabFirstId + ::std::distance(itrDataBeg, itrData);
|
2008-12-12 09:38:47 +00:00
|
|
|
TableTypeRef& pTabData = rDoc.maTables[i];
|
|
|
|
if (!pTabData.get())
|
|
|
|
pTabData.reset(new Table);
|
|
|
|
|
2013-08-16 16:29:14 +02:00
|
|
|
const ScMatrixRef& pMat = itrData->mpRangeData;
|
2008-12-12 09:38:47 +00:00
|
|
|
for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
|
|
|
|
{
|
2013-08-16 16:29:14 +02:00
|
|
|
const SCSIZE nR = nRow - nRow1;
|
2008-12-12 09:38:47 +00:00
|
|
|
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
|
|
|
|
{
|
2013-08-16 16:29:14 +02:00
|
|
|
const SCSIZE nC = nCol - nCol1;
|
|
|
|
|
|
|
|
ScMatrixValue value = pMat->Get(nC, nR);
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
TokenRef pToken;
|
2013-08-16 16:29:14 +02:00
|
|
|
|
|
|
|
switch (value.nType) {
|
|
|
|
case SC_MATVAL_VALUE:
|
|
|
|
case SC_MATVAL_BOOLEAN:
|
|
|
|
pToken.reset(new formula::FormulaDoubleToken(value.fVal));
|
|
|
|
break;
|
|
|
|
case SC_MATVAL_STRING:
|
|
|
|
pToken.reset(new formula::FormulaStringToken(value.aStr));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// Don't cache empty cells.
|
|
|
|
break;
|
|
|
|
}
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
if (pToken)
|
|
|
|
// Don't mark this cell 'cached' here, for better performance.
|
|
|
|
pTabData->setCell(nCol, nRow, pToken, 0, false);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
}
|
2010-02-11 17:28:24 -05:00
|
|
|
// Mark the whole range 'cached'.
|
|
|
|
pTabData->setCachedCellRange(nCol1, nRow1, nCol2, nRow2);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2009-10-21 13:32:17 +00:00
|
|
|
size_t nTabLastId = nTabFirstId + rRange.aEnd.Tab() - rRange.aStart.Tab();
|
|
|
|
ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId));
|
2010-02-11 17:28:24 -05:00
|
|
|
|
2009-10-21 13:32:17 +00:00
|
|
|
rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray));
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ScExternalRefCache::isDocInitialized(sal_uInt16 nFileId)
|
|
|
|
{
|
|
|
|
DocItem* pDoc = getDocItem(nFileId);
|
|
|
|
if (!pDoc)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return pDoc->mbInitFromSource;
|
|
|
|
}
|
|
|
|
|
2013-10-07 14:02:47 +02:00
|
|
|
static bool lcl_getTableDataIndex(const ScExternalRefCache::TableNameIndexMap& rMap, const OUString& rName, size_t& rIndex)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
ScExternalRefCache::TableNameIndexMap::const_iterator itr = rMap.find(rName);
|
|
|
|
if (itr == rMap.end())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
rIndex = itr->second;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
void ScExternalRefCache::initializeDoc(sal_uInt16 nFileId, const vector<OUString>& rTabNames)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
DocItem* pDoc = getDocItem(nFileId);
|
|
|
|
if (!pDoc)
|
|
|
|
return;
|
|
|
|
|
|
|
|
size_t n = rTabNames.size();
|
|
|
|
|
|
|
|
// table name list - the list must include all table names in the source
|
|
|
|
// document and only to be populated when loading the source document, not
|
|
|
|
// when loading cached data from, say, Excel XCT/CRN records.
|
|
|
|
vector<TableName> aNewTabNames;
|
|
|
|
aNewTabNames.reserve(n);
|
2011-05-28 16:20:59 -04:00
|
|
|
for (vector<OUString>::const_iterator itr = rTabNames.begin(), itrEnd = rTabNames.end();
|
2008-12-12 09:38:47 +00:00
|
|
|
itr != itrEnd; ++itr)
|
|
|
|
{
|
2012-01-06 23:00:40 +00:00
|
|
|
TableName aNameItem(ScGlobal::pCharClass->uppercase(*itr), *itr);
|
2008-12-12 09:38:47 +00:00
|
|
|
aNewTabNames.push_back(aNameItem);
|
|
|
|
}
|
|
|
|
pDoc->maTableNames.swap(aNewTabNames);
|
|
|
|
|
|
|
|
// data tables - preserve any existing data that may have been set during
|
|
|
|
// file import.
|
|
|
|
vector<TableTypeRef> aNewTables(n);
|
|
|
|
for (size_t i = 0; i < n; ++i)
|
|
|
|
{
|
|
|
|
size_t nIndex;
|
|
|
|
if (lcl_getTableDataIndex(pDoc->maTableNameIndex, pDoc->maTableNames[i].maUpperName, nIndex))
|
|
|
|
{
|
|
|
|
aNewTables[i] = pDoc->maTables[nIndex];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pDoc->maTables.swap(aNewTables);
|
|
|
|
|
|
|
|
// name index map
|
|
|
|
TableNameIndexMap aNewNameIndex;
|
|
|
|
for (size_t i = 0; i < n; ++i)
|
|
|
|
aNewNameIndex.insert(TableNameIndexMap::value_type(pDoc->maTableNames[i].maUpperName, i));
|
|
|
|
pDoc->maTableNameIndex.swap(aNewNameIndex);
|
|
|
|
|
|
|
|
pDoc->mbInitFromSource = true;
|
|
|
|
}
|
|
|
|
|
2013-09-17 12:49:11 +02:00
|
|
|
OUString ScExternalRefCache::getTableName(sal_uInt16 nFileId, size_t nCacheId) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
if( DocItem* pDoc = getDocItem( nFileId ) )
|
|
|
|
if( nCacheId < pDoc->maTableNames.size() )
|
|
|
|
return pDoc->maTableNames[ nCacheId ].maRealName;
|
2013-10-16 14:27:58 +02:00
|
|
|
return EMPTY_OUSTRING;
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2011-03-01 22:50:13 -05:00
|
|
|
void ScExternalRefCache::getAllTableNames(sal_uInt16 nFileId, vector<OUString>& rTabNames) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
rTabNames.clear();
|
|
|
|
DocItem* pDoc = getDocItem(nFileId);
|
|
|
|
if (!pDoc)
|
|
|
|
return;
|
|
|
|
|
|
|
|
size_t n = pDoc->maTableNames.size();
|
|
|
|
rTabNames.reserve(n);
|
|
|
|
for (vector<TableName>::const_iterator itr = pDoc->maTableNames.begin(), itrEnd = pDoc->maTableNames.end();
|
|
|
|
itr != itrEnd; ++itr)
|
|
|
|
rTabNames.push_back(itr->maRealName);
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
SCsTAB ScExternalRefCache::getTabSpan( sal_uInt16 nFileId, const OUString& rStartTabName, const OUString& rEndTabName ) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
DocItem* pDoc = getDocItem(nFileId);
|
|
|
|
if (!pDoc)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
vector<TableName>::const_iterator itrBeg = pDoc->maTableNames.begin();
|
|
|
|
vector<TableName>::const_iterator itrEnd = pDoc->maTableNames.end();
|
|
|
|
|
|
|
|
vector<TableName>::const_iterator itrStartTab = ::std::find_if( itrBeg, itrEnd,
|
|
|
|
TabNameSearchPredicate( rStartTabName));
|
|
|
|
if (itrStartTab == itrEnd)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
vector<TableName>::const_iterator itrEndTab = ::std::find_if( itrBeg, itrEnd,
|
|
|
|
TabNameSearchPredicate( rEndTabName));
|
|
|
|
if (itrEndTab == itrEnd)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
size_t nStartDist = ::std::distance( itrBeg, itrStartTab);
|
|
|
|
size_t nEndDist = ::std::distance( itrBeg, itrEndTab);
|
2009-03-04 12:41:00 +00:00
|
|
|
return nStartDist <= nEndDist ? static_cast<SCsTAB>(nEndDist - nStartDist + 1) : -static_cast<SCsTAB>(nStartDist - nEndDist + 1);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefCache::getAllNumberFormats(vector<sal_uInt32>& rNumFmts) const
|
|
|
|
{
|
2013-11-05 16:49:55 -05:00
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
using ::std::sort;
|
|
|
|
using ::std::unique;
|
|
|
|
|
|
|
|
vector<sal_uInt32> aNumFmts;
|
|
|
|
for (DocDataType::const_iterator itrDoc = maDocs.begin(), itrDocEnd = maDocs.end();
|
|
|
|
itrDoc != itrDocEnd; ++itrDoc)
|
|
|
|
{
|
|
|
|
const vector<TableTypeRef>& rTables = itrDoc->second.maTables;
|
|
|
|
for (vector<TableTypeRef>::const_iterator itrTab = rTables.begin(), itrTabEnd = rTables.end();
|
|
|
|
itrTab != itrTabEnd; ++itrTab)
|
|
|
|
{
|
|
|
|
TableTypeRef pTab = *itrTab;
|
|
|
|
if (!pTab)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
pTab->getAllNumberFormats(aNumFmts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// remove duplicates.
|
|
|
|
sort(aNumFmts.begin(), aNumFmts.end());
|
|
|
|
aNumFmts.erase(unique(aNumFmts.begin(), aNumFmts.end()), aNumFmts.end());
|
|
|
|
rNumFmts.swap(aNumFmts);
|
|
|
|
}
|
|
|
|
|
2009-04-02 15:00:15 +00:00
|
|
|
bool ScExternalRefCache::setCacheDocReferenced( sal_uInt16 nFileId )
|
|
|
|
{
|
|
|
|
DocItem* pDocItem = getDocItem(nFileId);
|
|
|
|
if (!pDocItem)
|
|
|
|
return areAllCacheTablesReferenced();
|
|
|
|
|
|
|
|
for (::std::vector<TableTypeRef>::iterator itrTab = pDocItem->maTables.begin();
|
|
|
|
itrTab != pDocItem->maTables.end(); ++itrTab)
|
|
|
|
{
|
|
|
|
if ((*itrTab).get())
|
|
|
|
(*itrTab)->setReferenced( true);
|
|
|
|
}
|
|
|
|
addCacheDocToReferenced( nFileId);
|
|
|
|
return areAllCacheTablesReferenced();
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
bool ScExternalRefCache::setCacheTableReferenced( sal_uInt16 nFileId, const OUString& rTabName, size_t nSheets, bool bPermanent )
|
2009-04-02 15:00:15 +00:00
|
|
|
{
|
2009-07-28 10:04:47 +00:00
|
|
|
DocItem* pDoc = getDocItem(nFileId);
|
|
|
|
if (pDoc)
|
2009-04-02 15:00:15 +00:00
|
|
|
{
|
2009-07-28 10:04:47 +00:00
|
|
|
size_t nIndex = 0;
|
2013-10-07 14:02:47 +02:00
|
|
|
OUString aTabNameUpper = ScGlobal::pCharClass->uppercase( rTabName);
|
2009-07-28 10:04:47 +00:00
|
|
|
if (lcl_getTableDataIndex( pDoc->maTableNameIndex, aTabNameUpper, nIndex))
|
2009-04-02 15:00:15 +00:00
|
|
|
{
|
2009-07-28 10:04:47 +00:00
|
|
|
size_t nStop = ::std::min( nIndex + nSheets, pDoc->maTables.size());
|
|
|
|
for (size_t i = nIndex; i < nStop; ++i)
|
|
|
|
{
|
|
|
|
TableTypeRef pTab = pDoc->maTables[i];
|
|
|
|
if (pTab.get())
|
|
|
|
{
|
|
|
|
Table::ReferencedFlag eNewFlag = (bPermanent ?
|
|
|
|
Table::REFERENCED_PERMANENT :
|
|
|
|
Table::REFERENCED_MARKED);
|
|
|
|
Table::ReferencedFlag eOldFlag = pTab->getReferencedFlag();
|
|
|
|
if (eOldFlag != Table::REFERENCED_PERMANENT && eNewFlag != eOldFlag)
|
|
|
|
{
|
|
|
|
pTab->setReferencedFlag( eNewFlag);
|
|
|
|
addCacheTableToReferenced( nFileId, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-04-02 15:00:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return areAllCacheTablesReferenced();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefCache::setAllCacheTableReferencedStati( bool bReferenced )
|
|
|
|
{
|
2013-11-05 16:49:55 -05:00
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
|
|
|
|
2009-04-02 15:00:15 +00:00
|
|
|
if (bReferenced)
|
|
|
|
{
|
|
|
|
maReferenced.reset(0);
|
|
|
|
for (DocDataType::iterator itrDoc = maDocs.begin(); itrDoc != maDocs.end(); ++itrDoc)
|
|
|
|
{
|
|
|
|
ScExternalRefCache::DocItem& rDocItem = (*itrDoc).second;
|
|
|
|
for (::std::vector<TableTypeRef>::iterator itrTab = rDocItem.maTables.begin();
|
|
|
|
itrTab != rDocItem.maTables.end(); ++itrTab)
|
|
|
|
{
|
|
|
|
if ((*itrTab).get())
|
|
|
|
(*itrTab)->setReferenced( true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
size_t nDocs = 0;
|
|
|
|
for (DocDataType::const_iterator itrDoc = maDocs.begin(); itrDoc != maDocs.end(); ++itrDoc)
|
|
|
|
{
|
|
|
|
if (nDocs <= (*itrDoc).first)
|
|
|
|
nDocs = (*itrDoc).first + 1;
|
|
|
|
}
|
|
|
|
maReferenced.reset( nDocs);
|
|
|
|
|
|
|
|
for (DocDataType::iterator itrDoc = maDocs.begin(); itrDoc != maDocs.end(); ++itrDoc)
|
|
|
|
{
|
|
|
|
ScExternalRefCache::DocItem& rDocItem = (*itrDoc).second;
|
|
|
|
sal_uInt16 nFileId = (*itrDoc).first;
|
|
|
|
size_t nTables = rDocItem.maTables.size();
|
|
|
|
ReferencedStatus::DocReferenced & rDocReferenced = maReferenced.maDocs[nFileId];
|
|
|
|
// All referenced => non-existing tables evaluate as completed.
|
|
|
|
rDocReferenced.maTables.resize( nTables, true);
|
|
|
|
for (size_t i=0; i < nTables; ++i)
|
|
|
|
{
|
|
|
|
TableTypeRef & xTab = rDocItem.maTables[i];
|
|
|
|
if (xTab.get())
|
|
|
|
{
|
2009-07-28 10:04:47 +00:00
|
|
|
if (xTab->getReferencedFlag() == Table::REFERENCED_PERMANENT)
|
|
|
|
addCacheTableToReferenced( nFileId, i);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xTab->setReferencedFlag( Table::UNREFERENCED);
|
|
|
|
rDocReferenced.maTables[i] = false;
|
|
|
|
rDocReferenced.mbAllTablesReferenced = false;
|
|
|
|
// An addCacheTableToReferenced() actually may have
|
|
|
|
// resulted in mbAllReferenced been set. Clear it.
|
|
|
|
maReferenced.mbAllReferenced = false;
|
|
|
|
}
|
2009-04-02 15:00:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefCache::addCacheTableToReferenced( sal_uInt16 nFileId, size_t nIndex )
|
|
|
|
{
|
|
|
|
if (nFileId >= maReferenced.maDocs.size())
|
|
|
|
return;
|
|
|
|
|
|
|
|
::std::vector<bool> & rTables = maReferenced.maDocs[nFileId].maTables;
|
|
|
|
size_t nTables = rTables.size();
|
|
|
|
if (nIndex >= nTables)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!rTables[nIndex])
|
|
|
|
{
|
|
|
|
rTables[nIndex] = true;
|
|
|
|
size_t i = 0;
|
|
|
|
while (i < nTables && rTables[i])
|
|
|
|
++i;
|
|
|
|
if (i == nTables)
|
|
|
|
{
|
|
|
|
maReferenced.maDocs[nFileId].mbAllTablesReferenced = true;
|
|
|
|
maReferenced.checkAllDocs();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefCache::addCacheDocToReferenced( sal_uInt16 nFileId )
|
|
|
|
{
|
|
|
|
if (nFileId >= maReferenced.maDocs.size())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!maReferenced.maDocs[nFileId].mbAllTablesReferenced)
|
|
|
|
{
|
|
|
|
::std::vector<bool> & rTables = maReferenced.maDocs[nFileId].maTables;
|
|
|
|
size_t nSize = rTables.size();
|
|
|
|
for (size_t i=0; i < nSize; ++i)
|
|
|
|
rTables[i] = true;
|
|
|
|
maReferenced.maDocs[nFileId].mbAllTablesReferenced = true;
|
|
|
|
maReferenced.checkAllDocs();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ScExternalRefCache::areAllCacheTablesReferenced() const
|
|
|
|
{
|
|
|
|
return maReferenced.mbAllReferenced;
|
|
|
|
}
|
|
|
|
|
2014-05-20 13:57:13 -04:00
|
|
|
void ScExternalRefCache::getAllCachedDataSpans( sal_uInt16 nFileId, sc::ColumnSpanSet& rSet ) const
|
|
|
|
{
|
|
|
|
const DocItem* pDocItem = getDocItem(nFileId);
|
|
|
|
if (!pDocItem)
|
|
|
|
// This document is not cached.
|
|
|
|
return;
|
|
|
|
|
|
|
|
const std::vector<TableTypeRef>& rTables = pDocItem->maTables;
|
|
|
|
for (size_t nTab = 0, nTabCount = rTables.size(); nTab < nTabCount; ++nTab)
|
|
|
|
{
|
|
|
|
const Table& rTable = *rTables[nTab];
|
|
|
|
std::vector<SCROW> aRows;
|
|
|
|
rTable.getAllRows(aRows);
|
|
|
|
std::vector<SCROW>::const_iterator itRow = aRows.begin(), itRowEnd = aRows.end();
|
|
|
|
for (; itRow != itRowEnd; ++itRow)
|
|
|
|
{
|
|
|
|
SCROW nRow = *itRow;
|
|
|
|
std::vector<SCCOL> aCols;
|
|
|
|
rTable.getAllCols(nRow, aCols);
|
|
|
|
std::vector<SCCOL>::const_iterator itCol = aCols.begin(), itColEnd = aCols.end();
|
|
|
|
for (; itCol != itColEnd; ++itCol)
|
|
|
|
{
|
|
|
|
SCCOL nCol = *itCol;
|
|
|
|
rSet.set(nTab, nCol, nRow, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-02 15:00:15 +00:00
|
|
|
ScExternalRefCache::ReferencedStatus::ReferencedStatus() :
|
|
|
|
mbAllReferenced(false)
|
|
|
|
{
|
|
|
|
reset(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefCache::ReferencedStatus::reset( size_t nDocs )
|
|
|
|
{
|
|
|
|
if (nDocs)
|
|
|
|
{
|
|
|
|
mbAllReferenced = false;
|
|
|
|
DocReferencedVec aRefs( nDocs);
|
|
|
|
maDocs.swap( aRefs);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mbAllReferenced = true;
|
|
|
|
DocReferencedVec aRefs;
|
|
|
|
maDocs.swap( aRefs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefCache::ReferencedStatus::checkAllDocs()
|
|
|
|
{
|
|
|
|
for (DocReferencedVec::const_iterator itr = maDocs.begin(); itr != maDocs.end(); ++itr)
|
|
|
|
{
|
|
|
|
if (!(*itr).mbAllTablesReferenced)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mbAllReferenced = true;
|
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nFileId, size_t nTabIndex) const
|
|
|
|
{
|
|
|
|
DocItem* pDoc = getDocItem(nFileId);
|
|
|
|
if (!pDoc || nTabIndex >= pDoc->maTables.size())
|
|
|
|
return TableTypeRef();
|
|
|
|
|
|
|
|
return pDoc->maTables[nTabIndex];
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nFileId, const OUString& rTabName, bool bCreateNew, size_t* pnIndex)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2009-09-17 11:09:25 +00:00
|
|
|
// In API, the index is transported as cached sheet ID of type sal_Int32 in
|
|
|
|
// sheet::SingleReference.Sheet or sheet::ComplexReference.Reference1.Sheet
|
|
|
|
// in a sheet::FormulaToken, choose a sensible value for N/A. Effectively
|
|
|
|
// being 0xffffffff
|
|
|
|
const size_t nNotAvailable = static_cast<size_t>( static_cast<sal_Int32>( -1));
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
DocItem* pDoc = getDocItem(nFileId);
|
|
|
|
if (!pDoc)
|
2009-09-17 11:09:25 +00:00
|
|
|
{
|
|
|
|
if (pnIndex) *pnIndex = nNotAvailable;
|
2008-12-12 09:38:47 +00:00
|
|
|
return TableTypeRef();
|
2009-09-17 11:09:25 +00:00
|
|
|
}
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
DocItem& rDoc = *pDoc;
|
|
|
|
|
|
|
|
size_t nIndex;
|
2013-10-07 14:02:47 +02:00
|
|
|
OUString aTabNameUpper = ScGlobal::pCharClass->uppercase(rTabName);
|
2008-12-12 09:38:47 +00:00
|
|
|
if (lcl_getTableDataIndex(rDoc.maTableNameIndex, aTabNameUpper, nIndex))
|
|
|
|
{
|
|
|
|
// specified table found.
|
|
|
|
if( pnIndex ) *pnIndex = nIndex;
|
2010-02-11 17:28:24 -05:00
|
|
|
if (bCreateNew && !rDoc.maTables[nIndex])
|
|
|
|
rDoc.maTables[nIndex].reset(new Table);
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
return rDoc.maTables[nIndex];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bCreateNew)
|
2009-09-17 11:09:25 +00:00
|
|
|
{
|
|
|
|
if (pnIndex) *pnIndex = nNotAvailable;
|
2008-12-12 09:38:47 +00:00
|
|
|
return TableTypeRef();
|
2009-09-17 11:09:25 +00:00
|
|
|
}
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
// Specified table doesn't exist yet. Create one.
|
|
|
|
nIndex = rDoc.maTables.size();
|
|
|
|
if( pnIndex ) *pnIndex = nIndex;
|
|
|
|
TableTypeRef pTab(new Table);
|
|
|
|
rDoc.maTables.push_back(pTab);
|
|
|
|
rDoc.maTableNames.push_back(TableName(aTabNameUpper, rTabName));
|
|
|
|
rDoc.maTableNameIndex.insert(
|
|
|
|
TableNameIndexMap::value_type(aTabNameUpper, nIndex));
|
|
|
|
return pTab;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefCache::clearCache(sal_uInt16 nFileId)
|
|
|
|
{
|
2013-11-05 16:49:55 -05:00
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
2008-12-12 09:38:47 +00:00
|
|
|
maDocs.erase(nFileId);
|
|
|
|
}
|
|
|
|
|
2014-05-20 13:57:13 -04:00
|
|
|
void ScExternalRefCache::clearCacheTables(sal_uInt16 nFileId)
|
|
|
|
{
|
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
|
|
|
DocItem* pDocItem = getDocItem(nFileId);
|
|
|
|
if (!pDocItem)
|
|
|
|
// This document is not cached at all.
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Clear all cache table content, but keep the tables.
|
|
|
|
std::vector<TableTypeRef>& rTabs = pDocItem->maTables;
|
|
|
|
for (size_t i = 0, n = rTabs.size(); i < n; ++i)
|
|
|
|
{
|
|
|
|
Table& rTab = *rTabs[i];
|
|
|
|
rTab.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clear the external range name caches.
|
|
|
|
pDocItem->maRangeNames.clear();
|
|
|
|
pDocItem->maRangeArrays.clear();
|
|
|
|
pDocItem->maRealRangeNameMap.clear();
|
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
ScExternalRefCache::DocItem* ScExternalRefCache::getDocItem(sal_uInt16 nFileId) const
|
|
|
|
{
|
2013-11-05 16:49:55 -05:00
|
|
|
osl::MutexGuard aGuard(&maMtxDocs);
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
using ::std::pair;
|
|
|
|
DocDataType::iterator itrDoc = maDocs.find(nFileId);
|
|
|
|
if (itrDoc == maDocs.end())
|
|
|
|
{
|
|
|
|
// specified document is not cached.
|
|
|
|
pair<DocDataType::iterator, bool> res = maDocs.insert(
|
|
|
|
DocDataType::value_type(nFileId, DocItem()));
|
|
|
|
|
|
|
|
if (!res.second)
|
|
|
|
// insertion failed.
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
itrDoc = res.first;
|
|
|
|
}
|
|
|
|
|
|
|
|
return &itrDoc->second;
|
|
|
|
}
|
|
|
|
|
2013-09-17 12:49:11 +02:00
|
|
|
ScExternalRefLink::ScExternalRefLink(ScDocument* pDoc, sal_uInt16 nFileId, const OUString& rFilter) :
|
2008-12-12 09:38:47 +00:00
|
|
|
::sfx2::SvBaseLink(::sfx2::LINKUPDATE_ONCALL, FORMAT_FILE),
|
|
|
|
mnFileId(nFileId),
|
|
|
|
maFilterName(rFilter),
|
|
|
|
mpDoc(pDoc),
|
|
|
|
mbDoRefresh(true)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefLink::~ScExternalRefLink()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefLink::Closed()
|
|
|
|
{
|
|
|
|
ScExternalRefManager* pMgr = mpDoc->GetExternalRefManager();
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
pMgr->breakLink(mnFileId);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2013-08-23 17:23:52 +02:00
|
|
|
::sfx2::SvBaseLink::UpdateResult ScExternalRefLink::DataChanged(const OUString& /*rMimeType*/, const Any& /*rValue*/)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
if (!mbDoRefresh)
|
2011-05-25 15:24:51 -04:00
|
|
|
return SUCCESS;
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aFile, aFilter;
|
2008-12-12 09:38:47 +00:00
|
|
|
mpDoc->GetLinkManager()->GetDisplayNames(this, NULL, &aFile, NULL, &aFilter);
|
|
|
|
ScExternalRefManager* pMgr = mpDoc->GetExternalRefManager();
|
2011-04-20 15:47:55 -04:00
|
|
|
|
|
|
|
if (!pMgr->isFileLoadable(aFile))
|
2011-05-25 15:24:51 -04:00
|
|
|
return ERROR_GENERAL;
|
2011-04-20 15:47:55 -04:00
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
const OUString* pCurFile = pMgr->getExternalFileName(mnFileId);
|
2008-12-12 09:38:47 +00:00
|
|
|
if (!pCurFile)
|
2011-05-25 15:24:51 -04:00
|
|
|
return ERROR_GENERAL;
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
if (pCurFile->equals(aFile))
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
// Refresh the current source document.
|
2014-05-19 23:42:05 -04:00
|
|
|
if (!pMgr->refreshSrcDocument(mnFileId))
|
|
|
|
return ERROR_GENERAL;
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// The source document has changed.
|
2009-09-03 21:54:32 -04:00
|
|
|
ScDocShell* pDocShell = ScDocShell::GetViewData()->GetDocShell();
|
|
|
|
ScDocShellModificator aMod(*pDocShell);
|
2009-09-17 11:09:25 +00:00
|
|
|
pMgr->switchSrcFile(mnFileId, aFile, aFilter);
|
2008-12-12 09:38:47 +00:00
|
|
|
maFilterName = aFilter;
|
2009-09-03 21:54:32 -04:00
|
|
|
aMod.SetDocumentModified();
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
2011-05-25 15:24:51 -04:00
|
|
|
|
|
|
|
return SUCCESS;
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefLink::Edit(Window* pParent, const Link& /*rEndEditHdl*/)
|
|
|
|
{
|
|
|
|
SvBaseLink::Edit(pParent, LINK(this, ScExternalRefLink, ExternalRefEndEditHdl));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefLink::SetDoReferesh(bool b)
|
|
|
|
{
|
|
|
|
mbDoRefresh = b;
|
|
|
|
}
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(ScExternalRefLink, ExternalRefEndEditHdl)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-02-20 16:05:51 -05:00
|
|
|
static FormulaToken* convertToToken( ScDocument* pHostDoc, ScDocument* pSrcDoc, ScRefCellValue& rCell )
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-03-26 19:38:24 -04:00
|
|
|
if (rCell.hasEmptyValue())
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-03-26 19:38:24 -04:00
|
|
|
bool bInherited = (rCell.meType == CELLTYPE_FORMULA);
|
|
|
|
return new ScEmptyCellToken(bInherited, false);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2013-03-26 19:38:24 -04:00
|
|
|
switch (rCell.meType)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
case CELLTYPE_EDIT:
|
|
|
|
case CELLTYPE_STRING:
|
2014-02-20 16:05:51 -05:00
|
|
|
{
|
|
|
|
OUString aStr = rCell.getString(pSrcDoc);
|
|
|
|
svl::SharedString aSS = pHostDoc->GetSharedStringPool().intern(aStr);
|
|
|
|
return new formula::FormulaStringToken(aSS);
|
|
|
|
}
|
2008-12-12 09:38:47 +00:00
|
|
|
case CELLTYPE_VALUE:
|
2013-03-26 19:38:24 -04:00
|
|
|
return new formula::FormulaDoubleToken(rCell.mfValue);
|
2008-12-12 09:38:47 +00:00
|
|
|
case CELLTYPE_FORMULA:
|
|
|
|
{
|
2013-03-26 19:38:24 -04:00
|
|
|
ScFormulaCell* pFCell = rCell.mpFormula;
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_uInt16 nError = pFCell->GetErrCode();
|
2008-12-12 09:38:47 +00:00
|
|
|
if (nError)
|
2009-01-13 11:01:13 +00:00
|
|
|
return new FormulaErrorToken( nError);
|
2008-12-12 09:38:47 +00:00
|
|
|
else if (pFCell->IsValue())
|
|
|
|
{
|
|
|
|
double fVal = pFCell->GetValue();
|
2009-01-13 11:01:13 +00:00
|
|
|
return new formula::FormulaDoubleToken(fVal);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-10-10 20:24:21 -04:00
|
|
|
svl::SharedString aStr = pFCell->GetString();
|
2009-01-13 11:01:13 +00:00
|
|
|
return new formula::FormulaStringToken(aStr);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
default:
|
2011-03-01 19:05:02 +01:00
|
|
|
OSL_FAIL("attempted to convert an unknown cell type.");
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-08-16 16:28:54 +02:00
|
|
|
template<class T>
|
|
|
|
struct ColumnBatch
|
|
|
|
{
|
2014-02-20 16:05:51 -05:00
|
|
|
ScDocument* mpHostDoc;
|
|
|
|
ScDocument* mpSrcDoc;
|
|
|
|
|
2013-08-16 16:28:54 +02:00
|
|
|
std::vector<T> maStorage;
|
|
|
|
CellType meType1;
|
|
|
|
CellType meType2;
|
|
|
|
SCROW mnRowStart;
|
|
|
|
|
2014-02-20 16:05:51 -05:00
|
|
|
ColumnBatch( ScDocument* pHostDoc, ScDocument* pSrcDoc, CellType eType1, CellType eType2 ) :
|
|
|
|
mpHostDoc(pHostDoc),
|
|
|
|
mpSrcDoc(pSrcDoc),
|
|
|
|
meType1(eType1),
|
|
|
|
meType2(eType2),
|
|
|
|
mnRowStart(-1) {}
|
2013-08-16 16:28:54 +02:00
|
|
|
|
|
|
|
void update(ScRefCellValue& raCell, const SCCOL nCol, const SCROW nRow, ScMatrixRef& xMat)
|
|
|
|
{
|
|
|
|
if (raCell.meType == meType1 || raCell.meType == meType2)
|
|
|
|
{
|
|
|
|
if (mnRowStart < 0)
|
|
|
|
mnRowStart = nRow;
|
|
|
|
maStorage.push_back(getValue(raCell));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flush(nCol, xMat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void flush(const SCCOL nCol, ScMatrixRef& xMat)
|
|
|
|
{
|
|
|
|
if (maStorage.empty())
|
|
|
|
return;
|
|
|
|
putValues(xMat, nCol);
|
|
|
|
mnRowStart = -1;
|
|
|
|
maStorage.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
T getValue(ScRefCellValue& raCell) const;
|
|
|
|
void putValues(ScMatrixRef& xMat, const SCCOL nCol) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
2013-10-07 17:27:02 -04:00
|
|
|
inline svl::SharedString ColumnBatch<svl::SharedString>::getValue(ScRefCellValue& rCell) const
|
2013-08-16 16:28:54 +02:00
|
|
|
{
|
2014-02-20 16:05:51 -05:00
|
|
|
OUString aStr = rCell.getString(mpSrcDoc);
|
|
|
|
return mpHostDoc->GetSharedStringPool().intern(aStr);
|
2013-08-16 16:28:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
inline T ColumnBatch<T>::getValue(ScRefCellValue& raCell) const
|
|
|
|
{
|
|
|
|
return raCell.mfValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<>
|
2013-10-07 17:27:02 -04:00
|
|
|
inline void ColumnBatch<svl::SharedString>::putValues(ScMatrixRef& xMat, const SCCOL nCol) const
|
2013-08-16 16:28:54 +02:00
|
|
|
{
|
2013-12-16 09:20:43 -05:00
|
|
|
xMat->PutString(&maStorage.front(), maStorage.size(), nCol, mnRowStart);
|
2013-08-16 16:28:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
inline void ColumnBatch<T>::putValues(ScMatrixRef& xMat, const SCCOL nCol) const
|
|
|
|
{
|
2013-12-16 09:20:43 -05:00
|
|
|
xMat->PutDouble(&maStorage.front(), maStorage.size(), nCol, mnRowStart);
|
2013-08-16 16:28:54 +02:00
|
|
|
}
|
|
|
|
|
2013-03-26 19:38:24 -04:00
|
|
|
static ScTokenArray* convertToTokenArray(
|
2014-02-20 16:05:51 -05:00
|
|
|
ScDocument* pHostDoc, ScDocument* pSrcDoc, ScRange& rRange, vector<ScExternalRefCache::SingleRangeData>& rCacheData )
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2010-02-11 17:28:24 -05:00
|
|
|
ScAddress& s = rRange.aStart;
|
|
|
|
ScAddress& e = rRange.aEnd;
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
SCTAB nTab1 = s.Tab(), nTab2 = e.Tab();
|
|
|
|
SCCOL nCol1 = s.Col(), nCol2 = e.Col();
|
|
|
|
SCROW nRow1 = s.Row(), nRow2 = e.Row();
|
|
|
|
|
|
|
|
if (nTab2 != nTab1)
|
|
|
|
// For now, we don't support multi-sheet ranges intentionally because
|
|
|
|
// we don't have a way to express them in a single token. In the
|
|
|
|
// future we can introduce a new stack variable type svMatrixList with
|
|
|
|
// a new token type that can store a 3D matrix value and convert a 3D
|
|
|
|
// range to it.
|
|
|
|
return NULL;
|
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
::boost::scoped_ptr<ScRange> pUsedRange;
|
|
|
|
|
2011-09-22 15:00:08 +01:00
|
|
|
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
2008-12-12 09:38:47 +00:00
|
|
|
auto_ptr<ScTokenArray> pArray(new ScTokenArray);
|
2011-09-22 15:00:08 +01:00
|
|
|
SAL_WNODEPRECATED_DECLARATIONS_POP
|
2008-12-12 09:38:47 +00:00
|
|
|
bool bFirstTab = true;
|
|
|
|
vector<ScExternalRefCache::SingleRangeData>::iterator
|
|
|
|
itrCache = rCacheData.begin(), itrCacheEnd = rCacheData.end();
|
2010-02-11 17:28:24 -05:00
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
for (SCTAB nTab = nTab1; nTab <= nTab2 && itrCache != itrCacheEnd; ++nTab, ++itrCache)
|
|
|
|
{
|
2010-02-11 17:28:24 -05:00
|
|
|
// Only loop within the data area.
|
|
|
|
SCCOL nDataCol1 = nCol1, nDataCol2 = nCol2;
|
|
|
|
SCROW nDataRow1 = nRow1, nDataRow2 = nRow2;
|
2011-01-19 12:54:02 -05:00
|
|
|
bool bShrunk;
|
|
|
|
if (!pSrcDoc->ShrinkToUsedDataArea( bShrunk, nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2, false))
|
2010-02-11 17:28:24 -05:00
|
|
|
// no data within specified range.
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (pUsedRange.get())
|
|
|
|
// Make sure the used area only grows, not shrinks.
|
|
|
|
pUsedRange->ExtendTo(ScRange(nDataCol1, nDataRow1, 0, nDataCol2, nDataRow2, 0));
|
|
|
|
else
|
|
|
|
pUsedRange.reset(new ScRange(nDataCol1, nDataRow1, 0, nDataCol2, nDataRow2, 0));
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
ScMatrixRef xMat = new ScMatrix(
|
2012-07-16 23:05:50 -04:00
|
|
|
static_cast<SCSIZE>(nCol2-nCol1+1), static_cast<SCSIZE>(nRow2-nRow1+1));
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2013-03-26 19:38:24 -04:00
|
|
|
ScRefCellValue aCell;
|
2014-02-20 16:05:51 -05:00
|
|
|
ColumnBatch<svl::SharedString> aStringBatch(pHostDoc, pSrcDoc, CELLTYPE_STRING, CELLTYPE_EDIT);
|
|
|
|
ColumnBatch<double> aDoubleBatch(pHostDoc, pSrcDoc, CELLTYPE_VALUE, CELLTYPE_VALUE);
|
2013-08-16 16:28:54 +02:00
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
for (SCCOL nCol = nDataCol1; nCol <= nDataCol2; ++nCol)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-08-16 16:28:54 +02:00
|
|
|
const SCSIZE nC = nCol - nCol1;
|
2010-02-11 17:28:24 -05:00
|
|
|
for (SCROW nRow = nDataRow1; nRow <= nDataRow2; ++nRow)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-08-16 16:28:54 +02:00
|
|
|
const SCSIZE nR = nRow - nRow1;
|
2013-03-26 19:38:24 -04:00
|
|
|
|
|
|
|
aCell.assign(*pSrcDoc, ScAddress(nCol, nRow, nTab));
|
|
|
|
|
2013-10-07 17:27:02 -04:00
|
|
|
aStringBatch.update(aCell, nC, nR, xMat);
|
|
|
|
aDoubleBatch.update(aCell, nC, nR, xMat);
|
2013-08-16 16:28:54 +02:00
|
|
|
|
2013-03-26 19:38:24 -04:00
|
|
|
if (aCell.hasEmptyValue())
|
2011-11-01 11:49:42 -04:00
|
|
|
// Skip empty cells. Matrix's default values are empty elements.
|
|
|
|
continue;
|
|
|
|
|
2013-03-26 19:38:24 -04:00
|
|
|
switch (aCell.meType)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2011-11-01 11:49:42 -04:00
|
|
|
case CELLTYPE_FORMULA:
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-03-26 19:38:24 -04:00
|
|
|
ScFormulaCell* pFCell = aCell.mpFormula;
|
2011-11-01 11:49:42 -04:00
|
|
|
sal_uInt16 nError = pFCell->GetErrCode();
|
|
|
|
if (nError)
|
|
|
|
xMat->PutDouble( CreateDoubleError( nError), nC, nR);
|
|
|
|
else if (pFCell->IsValue())
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2011-11-01 11:49:42 -04:00
|
|
|
double fVal = pFCell->GetValue();
|
|
|
|
xMat->PutDouble(fVal, nC, nR);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
2011-11-01 11:49:42 -04:00
|
|
|
else
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2013-10-10 20:24:21 -04:00
|
|
|
svl::SharedString aStr = pFCell->GetString();
|
2014-02-20 16:05:51 -05:00
|
|
|
aStr = pHostDoc->GetSharedStringPool().intern(aStr.getString());
|
2013-10-10 20:24:21 -04:00
|
|
|
xMat->PutString(aStr, nC, nR);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
}
|
2011-11-01 11:49:42 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OSL_FAIL("attempted to convert an unknown cell type.");
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
}
|
2013-08-16 16:28:54 +02:00
|
|
|
|
2013-10-07 17:27:02 -04:00
|
|
|
aStringBatch.flush(nC, xMat);
|
|
|
|
aDoubleBatch.flush(nC, xMat);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
if (!bFirstTab)
|
|
|
|
pArray->AddOpCode(ocSep);
|
|
|
|
|
2010-12-17 01:59:24 -05:00
|
|
|
ScMatrixToken aToken(xMat);
|
2008-12-12 09:38:47 +00:00
|
|
|
pArray->AddToken(aToken);
|
|
|
|
|
|
|
|
itrCache->mpRangeData = xMat;
|
|
|
|
|
|
|
|
bFirstTab = false;
|
|
|
|
}
|
2010-02-11 17:28:24 -05:00
|
|
|
|
|
|
|
if (!pUsedRange.get())
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
s.SetCol(pUsedRange->aStart.Col());
|
|
|
|
s.SetRow(pUsedRange->aStart.Row());
|
|
|
|
e.SetCol(pUsedRange->aEnd.Col());
|
|
|
|
e.SetRow(pUsedRange->aEnd.Row());
|
|
|
|
|
|
|
|
return pArray.release();
|
|
|
|
}
|
|
|
|
|
|
|
|
static ScTokenArray* lcl_fillEmptyMatrix(const ScRange& rRange)
|
|
|
|
{
|
|
|
|
SCSIZE nC = static_cast<SCSIZE>(rRange.aEnd.Col()-rRange.aStart.Col()+1);
|
|
|
|
SCSIZE nR = static_cast<SCSIZE>(rRange.aEnd.Row()-rRange.aStart.Row()+1);
|
|
|
|
ScMatrixRef xMat = new ScMatrix(nC, nR);
|
|
|
|
|
2010-12-17 01:59:24 -05:00
|
|
|
ScMatrixToken aToken(xMat);
|
2011-09-22 15:00:08 +01:00
|
|
|
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
2010-02-11 17:28:24 -05:00
|
|
|
auto_ptr<ScTokenArray> pArray(new ScTokenArray);
|
2011-09-22 15:00:08 +01:00
|
|
|
SAL_WNODEPRECATED_DECLARATIONS_POP
|
2010-02-11 17:28:24 -05:00
|
|
|
pArray->AddToken(aToken);
|
2008-12-12 09:38:47 +00:00
|
|
|
return pArray.release();
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefManager::ScExternalRefManager(ScDocument* pDoc) :
|
2009-04-02 15:00:15 +00:00
|
|
|
mpDoc(pDoc),
|
2010-03-09 14:51:15 -05:00
|
|
|
mbInReferenceMarking(false),
|
2014-05-20 00:59:29 -04:00
|
|
|
mbUserInteractionEnabled(true),
|
|
|
|
mbDocTimerEnabled(true)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
maSrcDocTimer.SetTimeoutHdl( LINK(this, ScExternalRefManager, TimeOutHdl) );
|
|
|
|
maSrcDocTimer.SetTimeout(SRCDOC_SCAN_INTERVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefManager::~ScExternalRefManager()
|
|
|
|
{
|
|
|
|
clear();
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString ScExternalRefManager::getCacheTableName(sal_uInt16 nFileId, size_t nTabIndex) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
return maRefCache.getTableName(nFileId, nTabIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefCache::TableTypeRef ScExternalRefManager::getCacheTable(sal_uInt16 nFileId, size_t nTabIndex) const
|
|
|
|
{
|
|
|
|
return maRefCache.getCacheTable(nFileId, nTabIndex);
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
ScExternalRefCache::TableTypeRef ScExternalRefManager::getCacheTable(
|
|
|
|
sal_uInt16 nFileId, const OUString& rTabName, bool bCreateNew, size_t* pnIndex)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
return maRefCache.getCacheTable(nFileId, rTabName, bCreateNew, pnIndex);
|
|
|
|
}
|
|
|
|
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
ScExternalRefManager::LinkListener::LinkListener()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefManager::LinkListener::~LinkListener()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-03-10 09:37:43 -05:00
|
|
|
ScExternalRefManager::ApiGuard::ApiGuard(ScDocument* pDoc) :
|
|
|
|
mpMgr(pDoc->GetExternalRefManager()),
|
|
|
|
mbOldInteractionEnabled(mpMgr->mbUserInteractionEnabled)
|
2010-03-09 14:51:15 -05:00
|
|
|
{
|
|
|
|
// We don't want user interaction handled in the API.
|
|
|
|
mpMgr->mbUserInteractionEnabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefManager::ApiGuard::~ApiGuard()
|
|
|
|
{
|
|
|
|
// Restore old value.
|
|
|
|
mpMgr->mbUserInteractionEnabled = mbOldInteractionEnabled;
|
|
|
|
}
|
|
|
|
|
2011-03-01 22:50:13 -05:00
|
|
|
void ScExternalRefManager::getAllCachedTableNames(sal_uInt16 nFileId, vector<OUString>& rTabNames) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
maRefCache.getAllTableNames(nFileId, rTabNames);
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
SCsTAB ScExternalRefManager::getCachedTabSpan( sal_uInt16 nFileId, const OUString& rStartTabName, const OUString& rEndTabName ) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
return maRefCache.getTabSpan( nFileId, rStartTabName, rEndTabName);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefManager::getAllCachedNumberFormats(vector<sal_uInt32>& rNumFmts) const
|
|
|
|
{
|
|
|
|
maRefCache.getAllNumberFormats(rNumFmts);
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_uInt16 ScExternalRefManager::getExternalFileCount() const
|
|
|
|
{
|
|
|
|
return static_cast< sal_uInt16 >( maSrcFiles.size() );
|
|
|
|
}
|
|
|
|
|
2009-04-02 15:00:15 +00:00
|
|
|
bool ScExternalRefManager::markUsedByLinkListeners()
|
|
|
|
{
|
|
|
|
bool bAllMarked = false;
|
|
|
|
for (LinkListenerMap::const_iterator itr = maLinkListeners.begin();
|
|
|
|
itr != maLinkListeners.end() && !bAllMarked; ++itr)
|
|
|
|
{
|
|
|
|
if (!(*itr).second.empty())
|
|
|
|
bAllMarked = maRefCache.setCacheDocReferenced( (*itr).first);
|
|
|
|
/* TODO: LinkListeners should remember the table they're listening to.
|
|
|
|
* As is, listening to one table will mark all tables of the document
|
|
|
|
* being referenced. */
|
|
|
|
}
|
|
|
|
return bAllMarked;
|
|
|
|
}
|
|
|
|
|
2010-03-08 10:38:03 -05:00
|
|
|
bool ScExternalRefManager::markUsedExternalRefCells()
|
|
|
|
{
|
|
|
|
RefCellMap::iterator itr = maRefCells.begin(), itrEnd = maRefCells.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
{
|
|
|
|
RefCellSet::iterator itrCell = itr->second.begin(), itrCellEnd = itr->second.end();
|
|
|
|
for (; itrCell != itrCellEnd; ++itrCell)
|
|
|
|
{
|
|
|
|
ScFormulaCell* pCell = *itrCell;
|
|
|
|
bool bUsed = pCell->MarkUsedExternalReferences();
|
|
|
|
if (bUsed)
|
2010-03-08 11:32:11 -05:00
|
|
|
// Return true when at least one cell references external docs.
|
2010-03-08 10:38:03 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
bool ScExternalRefManager::setCacheTableReferenced( sal_uInt16 nFileId, const OUString& rTabName, size_t nSheets )
|
2009-04-02 15:00:15 +00:00
|
|
|
{
|
2009-07-28 10:04:47 +00:00
|
|
|
return maRefCache.setCacheTableReferenced( nFileId, rTabName, nSheets, false);
|
|
|
|
}
|
|
|
|
|
2009-04-02 15:00:15 +00:00
|
|
|
void ScExternalRefManager::setAllCacheTableReferencedStati( bool bReferenced )
|
|
|
|
{
|
2010-03-09 14:51:15 -05:00
|
|
|
mbInReferenceMarking = !bReferenced;
|
2009-04-02 15:00:15 +00:00
|
|
|
maRefCache.setAllCacheTableReferencedStati( bReferenced );
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
void ScExternalRefManager::storeRangeNameTokens(sal_uInt16 nFileId, const OUString& rName, const ScTokenArray& rArray)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
ScExternalRefCache::TokenArrayRef pArray(rArray.Clone());
|
|
|
|
maRefCache.setRangeNameTokens(nFileId, rName, pArray);
|
|
|
|
}
|
|
|
|
|
2011-02-21 15:18:24 -05:00
|
|
|
namespace {
|
|
|
|
|
2011-02-21 15:33:43 -05:00
|
|
|
/**
|
|
|
|
* Put a single cell data into internal cache table.
|
|
|
|
*
|
|
|
|
* @param pFmt optional cell format index that may need to be stored with
|
|
|
|
* the cell value.
|
|
|
|
*/
|
2011-02-21 15:18:24 -05:00
|
|
|
void putCellDataIntoCache(
|
|
|
|
ScExternalRefCache& rRefCache, const ScExternalRefCache::TokenRef& pToken,
|
2013-10-07 14:02:47 +02:00
|
|
|
sal_uInt16 nFileId, const OUString& rTabName, const ScAddress& rCell,
|
2011-02-21 15:29:37 -05:00
|
|
|
const ScExternalRefCache::CellFormat* pFmt)
|
2011-02-21 15:18:24 -05:00
|
|
|
{
|
|
|
|
// Now, insert the token into cache table but don't cache empty cells.
|
|
|
|
if (pToken->GetType() != formula::svEmptyCell)
|
|
|
|
{
|
2011-12-07 22:33:44 -05:00
|
|
|
sal_uLong nFmtIndex = (pFmt && pFmt->mbIsSet) ? pFmt->mnIndex : 0;
|
2011-02-21 15:18:24 -05:00
|
|
|
rRefCache.setCellData(nFileId, rTabName, rCell.Col(), rCell.Row(), pToken, nFmtIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Put the data into our internal cache table.
|
|
|
|
*
|
|
|
|
* @param rRefCache cache table set.
|
|
|
|
* @param pArray single range data to be returned.
|
|
|
|
* @param nFileId external file ID
|
|
|
|
* @param rTabName name of the table where the data should be cached.
|
|
|
|
* @param rCacheData range data to be cached.
|
|
|
|
* @param rCacheRange original cache range, including the empty region if
|
|
|
|
* any.
|
|
|
|
* @param rDataRange reduced cache range that includes only the non-empty
|
|
|
|
* data area.
|
|
|
|
*/
|
|
|
|
void putRangeDataIntoCache(
|
|
|
|
ScExternalRefCache& rRefCache, ScExternalRefCache::TokenArrayRef& pArray,
|
2013-10-07 14:02:47 +02:00
|
|
|
sal_uInt16 nFileId, const OUString& rTabName,
|
2011-02-21 15:18:24 -05:00
|
|
|
const vector<ScExternalRefCache::SingleRangeData>& rCacheData,
|
|
|
|
const ScRange& rCacheRange, const ScRange& rDataRange)
|
|
|
|
{
|
|
|
|
if (pArray)
|
|
|
|
// Cache these values.
|
|
|
|
rRefCache.setCellRangeData(nFileId, rDataRange, rCacheData, pArray);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Array is empty. Fill it with an empty matrix of the required size.
|
|
|
|
pArray.reset(lcl_fillEmptyMatrix(rCacheRange));
|
|
|
|
|
|
|
|
// Make sure to set this range 'cached', to prevent unnecessarily
|
|
|
|
// accessing the src document time and time again.
|
|
|
|
ScExternalRefCache::TableTypeRef pCacheTab =
|
|
|
|
rRefCache.getCacheTable(nFileId, rTabName, true, NULL);
|
|
|
|
if (pCacheTab)
|
|
|
|
pCacheTab->setCachedCellRange(
|
|
|
|
rCacheRange.aStart.Col(), rCacheRange.aStart.Row(), rCacheRange.aEnd.Col(), rCacheRange.aEnd.Row());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-02 14:41:52 -05:00
|
|
|
/**
|
|
|
|
* When accessing an external document for the first time, we need to
|
|
|
|
* populate the cache with all its sheet names (whether they are referenced
|
|
|
|
* or not) in the correct order. Many client codes that use external
|
|
|
|
* references make this assumption.
|
|
|
|
*
|
|
|
|
* @param rRefCache cache table set.
|
|
|
|
* @param pSrcDoc source document instance.
|
|
|
|
* @param nFileId external file ID associated with the source document.
|
|
|
|
*/
|
|
|
|
void initDocInCache(ScExternalRefCache& rRefCache, const ScDocument* pSrcDoc, sal_uInt16 nFileId)
|
|
|
|
{
|
|
|
|
if (!pSrcDoc)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (rRefCache.isDocInitialized(nFileId))
|
|
|
|
// Already initialized. No need to do this twice.
|
|
|
|
return;
|
|
|
|
|
|
|
|
SCTAB nTabCount = pSrcDoc->GetTableCount();
|
|
|
|
if (nTabCount)
|
|
|
|
{
|
|
|
|
// Populate the cache with all table names in the source document.
|
2011-05-28 16:20:59 -04:00
|
|
|
vector<OUString> aTabNames;
|
2011-03-02 14:41:52 -05:00
|
|
|
aTabNames.reserve(nTabCount);
|
|
|
|
for (SCTAB i = 0; i < nTabCount; ++i)
|
|
|
|
{
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aName;
|
2011-03-02 14:41:52 -05:00
|
|
|
pSrcDoc->GetName(i, aName);
|
|
|
|
aTabNames.push_back(aName);
|
|
|
|
}
|
|
|
|
rRefCache.initializeDoc(nFileId, aTabNames);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-21 15:18:24 -05:00
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
|
2011-05-28 16:20:59 -04:00
|
|
|
sal_uInt16 nFileId, const OUString& rTabName, const ScAddress& rCell,
|
2008-12-12 09:38:47 +00:00
|
|
|
const ScAddress* pCurPos, SCTAB* pTab, ScExternalRefCache::CellFormat* pFmt)
|
|
|
|
{
|
|
|
|
if (pCurPos)
|
|
|
|
insertRefCell(nFileId, *pCurPos);
|
|
|
|
|
|
|
|
maybeLinkExternalFile(nFileId);
|
|
|
|
|
|
|
|
if (pTab)
|
|
|
|
*pTab = -1;
|
|
|
|
|
|
|
|
if (pFmt)
|
|
|
|
pFmt->mbIsSet = false;
|
|
|
|
|
2013-03-26 19:38:24 -04:00
|
|
|
ScDocument* pSrcDoc = getInMemorySrcDocument(nFileId);
|
2010-10-05 18:14:37 -04:00
|
|
|
if (pSrcDoc)
|
|
|
|
{
|
|
|
|
// source document already loaded in memory. Re-use this instance.
|
|
|
|
SCTAB nTab;
|
|
|
|
if (!pSrcDoc->GetTable(rTabName, nTab))
|
|
|
|
{
|
|
|
|
// specified table name doesn't exist in the source document.
|
|
|
|
ScExternalRefCache::TokenRef pToken(new FormulaErrorToken(errNoRef));
|
|
|
|
return pToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pTab)
|
|
|
|
*pTab = nTab;
|
|
|
|
|
2011-01-11 17:53:27 -05:00
|
|
|
ScExternalRefCache::TokenRef pToken =
|
|
|
|
getSingleRefTokenFromSrcDoc(
|
|
|
|
nFileId, pSrcDoc, ScAddress(rCell.Col(),rCell.Row(),nTab), pFmt);
|
|
|
|
|
2011-02-21 15:18:24 -05:00
|
|
|
putCellDataIntoCache(maRefCache, pToken, nFileId, rTabName, rCell, pFmt);
|
2011-01-11 17:53:27 -05:00
|
|
|
return pToken;
|
2010-10-05 18:14:37 -04:00
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
// Check if the given table name and the cell position is cached.
|
|
|
|
sal_uInt32 nFmtIndex = 0;
|
|
|
|
ScExternalRefCache::TokenRef pToken = maRefCache.getCellData(
|
2010-02-11 17:28:24 -05:00
|
|
|
nFileId, rTabName, rCell.Col(), rCell.Row(), &nFmtIndex);
|
2008-12-12 09:38:47 +00:00
|
|
|
if (pToken)
|
|
|
|
{
|
2010-02-11 17:28:24 -05:00
|
|
|
// Cache hit !
|
2010-10-05 18:14:37 -04:00
|
|
|
fillCellFormat(nFmtIndex, pFmt);
|
2008-12-12 09:38:47 +00:00
|
|
|
return pToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
// reference not cached. read from the source document.
|
2010-10-05 18:14:37 -04:00
|
|
|
pSrcDoc = getSrcDocument(nFileId);
|
2008-12-12 09:38:47 +00:00
|
|
|
if (!pSrcDoc)
|
|
|
|
{
|
2010-02-11 17:28:24 -05:00
|
|
|
// Source document not reachable. Throw a reference error.
|
|
|
|
pToken.reset(new FormulaErrorToken(errNoRef));
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
return pToken;
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SCTAB nTab;
|
|
|
|
if (!pSrcDoc->GetTable(rTabName, nTab))
|
|
|
|
{
|
|
|
|
// specified table name doesn't exist in the source document.
|
2010-02-11 17:28:24 -05:00
|
|
|
pToken.reset(new FormulaErrorToken(errNoRef));
|
|
|
|
return pToken;
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pTab)
|
|
|
|
*pTab = nTab;
|
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
SCCOL nDataCol1 = 0, nDataCol2 = MAXCOL;
|
|
|
|
SCROW nDataRow1 = 0, nDataRow2 = MAXROW;
|
2011-01-19 12:54:02 -05:00
|
|
|
bool bData = pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2);
|
|
|
|
if (!bData || rCell.Col() < nDataCol1 || nDataCol2 < rCell.Col() || rCell.Row() < nDataRow1 || nDataRow2 < rCell.Row())
|
2010-02-11 17:28:24 -05:00
|
|
|
{
|
|
|
|
// requested cell is outside the data area. Don't even bother caching
|
|
|
|
// this data, but add it to the cached range to prevent accessing the
|
|
|
|
// source document time and time again.
|
|
|
|
ScExternalRefCache::TableTypeRef pCacheTab =
|
|
|
|
maRefCache.getCacheTable(nFileId, rTabName, true, NULL);
|
|
|
|
if (pCacheTab)
|
|
|
|
pCacheTab->setCachedCell(rCell.Col(), rCell.Row());
|
|
|
|
|
|
|
|
pToken.reset(new ScEmptyCellToken(false, false));
|
|
|
|
return pToken;
|
|
|
|
}
|
|
|
|
|
2010-10-05 18:14:37 -04:00
|
|
|
pToken = getSingleRefTokenFromSrcDoc(
|
|
|
|
nFileId, pSrcDoc, ScAddress(rCell.Col(),rCell.Row(),nTab), pFmt);
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2011-02-21 15:18:24 -05:00
|
|
|
putCellDataIntoCache(maRefCache, pToken, nFileId, rTabName, rCell, pFmt);
|
2010-10-05 18:14:37 -04:00
|
|
|
return pToken;
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2010-02-11 17:28:24 -05:00
|
|
|
ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens(
|
2011-05-28 16:20:59 -04:00
|
|
|
sal_uInt16 nFileId, const OUString& rTabName, const ScRange& rRange, const ScAddress* pCurPos)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
if (pCurPos)
|
|
|
|
insertRefCell(nFileId, *pCurPos);
|
|
|
|
|
|
|
|
maybeLinkExternalFile(nFileId);
|
|
|
|
|
2011-01-11 17:38:24 -05:00
|
|
|
ScRange aDataRange(rRange);
|
2013-03-26 19:38:24 -04:00
|
|
|
ScDocument* pSrcDoc = getInMemorySrcDocument(nFileId);
|
2010-10-05 18:14:37 -04:00
|
|
|
if (pSrcDoc)
|
|
|
|
{
|
2011-01-11 17:38:24 -05:00
|
|
|
// Document already loaded in memory.
|
2010-10-05 18:14:37 -04:00
|
|
|
vector<ScExternalRefCache::SingleRangeData> aCacheData;
|
2011-01-11 17:38:24 -05:00
|
|
|
ScExternalRefCache::TokenArrayRef pArray =
|
|
|
|
getDoubleRefTokensFromSrcDoc(pSrcDoc, rTabName, aDataRange, aCacheData);
|
|
|
|
|
|
|
|
// Put the data into cache.
|
|
|
|
putRangeDataIntoCache(maRefCache, pArray, nFileId, rTabName, aCacheData, rRange, aDataRange);
|
|
|
|
return pArray;
|
2010-10-05 18:14:37 -04:00
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
// Check if the given table name and the cell position is cached.
|
2010-02-11 17:28:24 -05:00
|
|
|
ScExternalRefCache::TokenArrayRef pArray =
|
|
|
|
maRefCache.getCellRangeData(nFileId, rTabName, rRange);
|
|
|
|
if (pArray)
|
|
|
|
// Cache hit !
|
|
|
|
return pArray;
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2010-10-05 18:14:37 -04:00
|
|
|
pSrcDoc = getSrcDocument(nFileId);
|
2008-12-12 09:38:47 +00:00
|
|
|
if (!pSrcDoc)
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
{
|
2010-02-11 17:28:24 -05:00
|
|
|
// Source document is not reachable. Throw a reference error.
|
|
|
|
pArray.reset(new ScTokenArray);
|
|
|
|
pArray->AddToken(FormulaErrorToken(errNoRef));
|
|
|
|
return pArray;
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
}
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
vector<ScExternalRefCache::SingleRangeData> aCacheData;
|
2011-01-11 17:38:24 -05:00
|
|
|
pArray = getDoubleRefTokensFromSrcDoc(pSrcDoc, rTabName, aDataRange, aCacheData);
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2011-01-11 17:38:24 -05:00
|
|
|
// Put the data into cache.
|
|
|
|
putRangeDataIntoCache(maRefCache, pArray, nFileId, rTabName, aCacheData, rRange, aDataRange);
|
2008-12-12 09:38:47 +00:00
|
|
|
return pArray;
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
ScExternalRefCache::TokenArrayRef ScExternalRefManager::getRangeNameTokens(
|
|
|
|
sal_uInt16 nFileId, const OUString& rName, const ScAddress* pCurPos)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
if (pCurPos)
|
|
|
|
insertRefCell(nFileId, *pCurPos);
|
|
|
|
|
|
|
|
maybeLinkExternalFile(nFileId);
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aName = rName; // make a copy to have the casing corrected.
|
2013-03-26 19:38:24 -04:00
|
|
|
ScDocument* pSrcDoc = getInMemorySrcDocument(nFileId);
|
2010-10-05 18:14:37 -04:00
|
|
|
if (pSrcDoc)
|
|
|
|
{
|
|
|
|
// Document already loaded in memory.
|
2011-01-11 17:53:27 -05:00
|
|
|
ScExternalRefCache::TokenArrayRef pArray =
|
|
|
|
getRangeNameTokensFromSrcDoc(nFileId, pSrcDoc, aName);
|
|
|
|
|
|
|
|
if (pArray)
|
|
|
|
// Cache this range name array.
|
|
|
|
maRefCache.setRangeNameTokens(nFileId, aName, pArray);
|
|
|
|
|
|
|
|
return pArray;
|
2010-10-05 18:14:37 -04:00
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
ScExternalRefCache::TokenArrayRef pArray = maRefCache.getRangeNameTokens(nFileId, rName);
|
|
|
|
if (pArray.get())
|
2010-10-05 18:14:37 -04:00
|
|
|
// This range name is cached.
|
2008-12-12 09:38:47 +00:00
|
|
|
return pArray;
|
|
|
|
|
2010-10-05 18:14:37 -04:00
|
|
|
pSrcDoc = getSrcDocument(nFileId);
|
2008-12-12 09:38:47 +00:00
|
|
|
if (!pSrcDoc)
|
2010-10-05 18:14:37 -04:00
|
|
|
// failed to load document from disk.
|
2008-12-12 09:38:47 +00:00
|
|
|
return ScExternalRefCache::TokenArrayRef();
|
|
|
|
|
2010-10-05 18:14:37 -04:00
|
|
|
pArray = getRangeNameTokensFromSrcDoc(nFileId, pSrcDoc, aName);
|
|
|
|
|
|
|
|
if (pArray)
|
|
|
|
// Cache this range name array.
|
|
|
|
maRefCache.setRangeNameTokens(nFileId, aName, pArray);
|
|
|
|
|
|
|
|
return pArray;
|
|
|
|
}
|
|
|
|
|
2013-11-05 19:06:15 -05:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
bool hasRangeName(ScDocument& rDoc, const OUString& rName)
|
|
|
|
{
|
|
|
|
ScRangeName* pExtNames = rDoc.GetRangeName();
|
|
|
|
OUString aUpperName = ScGlobal::pCharClass->uppercase(rName);
|
|
|
|
const ScRangeData* pRangeData = pExtNames->findByUpperName(aUpperName);
|
|
|
|
return pRangeData != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ScExternalRefManager::isValidRangeName(sal_uInt16 nFileId, const OUString& rName)
|
|
|
|
{
|
|
|
|
maybeLinkExternalFile(nFileId);
|
|
|
|
ScDocument* pSrcDoc = getInMemorySrcDocument(nFileId);
|
|
|
|
if (pSrcDoc)
|
|
|
|
{
|
|
|
|
// Only check the presence of the name.
|
|
|
|
return hasRangeName(*pSrcDoc, rName);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (maRefCache.isValidRangeName(nFileId, rName))
|
|
|
|
// Range name is cached.
|
|
|
|
return true;
|
|
|
|
|
|
|
|
pSrcDoc = getSrcDocument(nFileId);
|
|
|
|
if (!pSrcDoc)
|
|
|
|
// failed to load document from disk.
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return hasRangeName(*pSrcDoc, rName);
|
|
|
|
}
|
|
|
|
|
2010-10-05 18:14:37 -04:00
|
|
|
void ScExternalRefManager::refreshAllRefCells(sal_uInt16 nFileId)
|
|
|
|
{
|
|
|
|
RefCellMap::iterator itrFile = maRefCells.find(nFileId);
|
|
|
|
if (itrFile == maRefCells.end())
|
|
|
|
return;
|
|
|
|
|
|
|
|
RefCellSet& rRefCells = itrFile->second;
|
|
|
|
for_each(rRefCells.begin(), rRefCells.end(), UpdateFormulaCell());
|
|
|
|
|
|
|
|
ScViewData* pViewData = ScDocShell::GetViewData();
|
|
|
|
if (!pViewData)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ScTabViewShell* pVShell = pViewData->GetViewShell();
|
|
|
|
if (!pVShell)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Repainting the grid also repaints the texts, but is there a better way
|
|
|
|
// to refresh texts?
|
|
|
|
pVShell->Invalidate(FID_REPAINT);
|
|
|
|
pVShell->PaintGrid();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefManager::insertRefCell(sal_uInt16 nFileId, const ScAddress& rCell)
|
|
|
|
{
|
|
|
|
RefCellMap::iterator itr = maRefCells.find(nFileId);
|
|
|
|
if (itr == maRefCells.end())
|
|
|
|
{
|
|
|
|
RefCellSet aRefCells;
|
|
|
|
pair<RefCellMap::iterator, bool> r = maRefCells.insert(
|
|
|
|
RefCellMap::value_type(nFileId, aRefCells));
|
|
|
|
if (!r.second)
|
|
|
|
// insertion failed.
|
|
|
|
return;
|
|
|
|
|
|
|
|
itr = r.first;
|
|
|
|
}
|
|
|
|
|
2013-03-26 23:48:30 -04:00
|
|
|
ScFormulaCell* pCell = mpDoc->GetFormulaCell(rCell);
|
|
|
|
if (pCell)
|
|
|
|
itr->second.insert(pCell);
|
2010-10-05 18:14:37 -04:00
|
|
|
}
|
|
|
|
|
2014-05-20 00:59:29 -04:00
|
|
|
void ScExternalRefManager::enableDocTimer( bool bEnable )
|
|
|
|
{
|
|
|
|
if (mbDocTimerEnabled == bEnable)
|
|
|
|
return;
|
|
|
|
|
|
|
|
mbDocTimerEnabled = bEnable;
|
|
|
|
if (mbDocTimerEnabled)
|
|
|
|
{
|
|
|
|
if (!maDocShells.empty())
|
|
|
|
{
|
|
|
|
DocShellMap::iterator it = maDocShells.begin(), itEnd = maDocShells.end();
|
|
|
|
for (; it != itEnd; ++it)
|
|
|
|
it->second.maLastAccess = Time(Time::SYSTEM);
|
|
|
|
|
|
|
|
maSrcDocTimer.Start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
maSrcDocTimer.Stop();
|
|
|
|
}
|
|
|
|
|
2011-12-07 22:33:44 -05:00
|
|
|
void ScExternalRefManager::fillCellFormat(sal_uLong nFmtIndex, ScExternalRefCache::CellFormat* pFmt) const
|
2010-10-05 18:14:37 -04:00
|
|
|
{
|
|
|
|
if (!pFmt)
|
|
|
|
return;
|
|
|
|
|
|
|
|
short nFmtType = mpDoc->GetFormatTable()->GetType(nFmtIndex);
|
|
|
|
if (nFmtType != NUMBERFORMAT_UNDEFINED)
|
|
|
|
{
|
|
|
|
pFmt->mbIsSet = true;
|
|
|
|
pFmt->mnIndex = nFmtIndex;
|
|
|
|
pFmt->mnType = nFmtType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefTokenFromSrcDoc(
|
2013-03-26 19:38:24 -04:00
|
|
|
sal_uInt16 nFileId, ScDocument* pSrcDoc, const ScAddress& rPos,
|
2010-10-05 18:14:37 -04:00
|
|
|
ScExternalRefCache::CellFormat* pFmt)
|
|
|
|
{
|
|
|
|
// Get the cell from src doc, and convert it into a token.
|
2013-03-26 19:38:24 -04:00
|
|
|
ScRefCellValue aCell;
|
|
|
|
aCell.assign(*pSrcDoc, rPos);
|
2014-02-20 16:05:51 -05:00
|
|
|
ScExternalRefCache::TokenRef pToken(convertToToken(mpDoc, pSrcDoc, aCell));
|
2010-10-05 18:14:37 -04:00
|
|
|
|
|
|
|
if (!pToken.get())
|
|
|
|
{
|
|
|
|
// Generate an error for unresolvable cells.
|
|
|
|
pToken.reset( new FormulaErrorToken( errNoValue));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get number format information.
|
|
|
|
sal_uInt32 nFmtIndex = 0;
|
2013-03-26 19:38:24 -04:00
|
|
|
pSrcDoc->GetNumberFormat(rPos.Col(), rPos.Row(), rPos.Tab(), nFmtIndex);
|
2010-10-05 18:14:37 -04:00
|
|
|
nFmtIndex = getMappedNumberFormat(nFileId, nFmtIndex, pSrcDoc);
|
|
|
|
fillCellFormat(nFmtIndex, pFmt);
|
|
|
|
return pToken;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokensFromSrcDoc(
|
2013-03-26 19:38:24 -04:00
|
|
|
ScDocument* pSrcDoc, const OUString& rTabName, ScRange& rRange,
|
2010-10-05 18:14:37 -04:00
|
|
|
vector<ScExternalRefCache::SingleRangeData>& rCacheData)
|
|
|
|
{
|
|
|
|
ScExternalRefCache::TokenArrayRef pArray;
|
|
|
|
SCTAB nTab1;
|
|
|
|
|
|
|
|
if (!pSrcDoc->GetTable(rTabName, nTab1))
|
|
|
|
{
|
|
|
|
// specified table name doesn't exist in the source document.
|
|
|
|
pArray.reset(new ScTokenArray);
|
|
|
|
pArray->AddToken(FormulaErrorToken(errNoRef));
|
|
|
|
return pArray;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScRange aRange(rRange);
|
2014-03-17 13:50:20 +01:00
|
|
|
aRange.Justify();
|
2010-10-05 18:14:37 -04:00
|
|
|
SCTAB nTabSpan = aRange.aEnd.Tab() - aRange.aStart.Tab();
|
|
|
|
|
|
|
|
vector<ScExternalRefCache::SingleRangeData> aCacheData;
|
|
|
|
aCacheData.reserve(nTabSpan+1);
|
|
|
|
aCacheData.push_back(ScExternalRefCache::SingleRangeData());
|
2012-01-06 23:00:40 +00:00
|
|
|
aCacheData.back().maTableName = ScGlobal::pCharClass->uppercase(rTabName);
|
2010-10-05 18:14:37 -04:00
|
|
|
|
|
|
|
for (SCTAB i = 1; i < nTabSpan + 1; ++i)
|
|
|
|
{
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aTabName;
|
2010-10-05 18:14:37 -04:00
|
|
|
if (!pSrcDoc->GetName(nTab1 + 1, aTabName))
|
|
|
|
// source document doesn't have any table by the specified name.
|
|
|
|
break;
|
|
|
|
|
|
|
|
aCacheData.push_back(ScExternalRefCache::SingleRangeData());
|
2012-01-06 23:00:40 +00:00
|
|
|
aCacheData.back().maTableName = ScGlobal::pCharClass->uppercase(aTabName);
|
2010-10-05 18:14:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
aRange.aStart.SetTab(nTab1);
|
|
|
|
aRange.aEnd.SetTab(nTab1 + nTabSpan);
|
|
|
|
|
2014-02-20 16:05:51 -05:00
|
|
|
pArray.reset(convertToTokenArray(mpDoc, pSrcDoc, aRange, aCacheData));
|
2010-10-05 18:14:37 -04:00
|
|
|
rRange = aRange;
|
|
|
|
rCacheData.swap(aCacheData);
|
|
|
|
return pArray;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScExternalRefCache::TokenArrayRef ScExternalRefManager::getRangeNameTokensFromSrcDoc(
|
2013-03-26 19:38:24 -04:00
|
|
|
sal_uInt16 nFileId, ScDocument* pSrcDoc, OUString& rName)
|
2010-10-05 18:14:37 -04:00
|
|
|
{
|
2008-12-12 09:38:47 +00:00
|
|
|
ScRangeName* pExtNames = pSrcDoc->GetRangeName();
|
2013-10-07 14:02:47 +02:00
|
|
|
OUString aUpperName = ScGlobal::pCharClass->uppercase(rName);
|
2011-03-04 18:21:43 -05:00
|
|
|
const ScRangeData* pRangeData = pExtNames->findByUpperName(aUpperName);
|
2008-12-12 09:38:47 +00:00
|
|
|
if (!pRangeData)
|
|
|
|
return ScExternalRefCache::TokenArrayRef();
|
|
|
|
|
|
|
|
// Parse all tokens in this external range data, and replace each absolute
|
|
|
|
// reference token with an external reference token, and cache them. Also
|
|
|
|
// register the source document with the link manager if it's a new
|
|
|
|
// source.
|
|
|
|
|
|
|
|
ScExternalRefCache::TokenArrayRef pNew(new ScTokenArray);
|
|
|
|
|
2011-03-04 18:21:43 -05:00
|
|
|
ScTokenArray aCode(*pRangeData->GetCode());
|
|
|
|
for (const FormulaToken* pToken = aCode.First(); pToken; pToken = aCode.Next())
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
bool bTokenAdded = false;
|
|
|
|
switch (pToken->GetType())
|
|
|
|
{
|
|
|
|
case svSingleRef:
|
|
|
|
{
|
2011-03-04 18:21:43 -05:00
|
|
|
const ScSingleRefData& rRef = static_cast<const ScToken*>(pToken)->GetSingleRef();
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aTabName;
|
2013-07-30 21:27:21 -04:00
|
|
|
pSrcDoc->GetName(rRef.Tab(), aTabName);
|
2011-03-04 18:21:43 -05:00
|
|
|
ScExternalSingleRefToken aNewToken(nFileId, aTabName, static_cast<const ScToken*>(pToken)->GetSingleRef());
|
2008-12-12 09:38:47 +00:00
|
|
|
pNew->AddToken(aNewToken);
|
|
|
|
bTokenAdded = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case svDoubleRef:
|
|
|
|
{
|
2011-03-04 18:21:43 -05:00
|
|
|
const ScSingleRefData& rRef = static_cast<const ScToken*>(pToken)->GetSingleRef();
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aTabName;
|
2013-07-30 21:27:21 -04:00
|
|
|
pSrcDoc->GetName(rRef.Tab(), aTabName);
|
2011-03-04 18:21:43 -05:00
|
|
|
ScExternalDoubleRefToken aNewToken(nFileId, aTabName, static_cast<const ScToken*>(pToken)->GetDoubleRef());
|
2008-12-12 09:38:47 +00:00
|
|
|
pNew->AddToken(aNewToken);
|
|
|
|
bTokenAdded = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
; // nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bTokenAdded)
|
|
|
|
pNew->AddToken(*pToken);
|
|
|
|
}
|
|
|
|
|
2010-10-05 18:14:37 -04:00
|
|
|
rName = pRangeData->GetName(); // Get the correctly-cased name.
|
2008-12-12 09:38:47 +00:00
|
|
|
return pNew;
|
|
|
|
}
|
|
|
|
|
2013-03-26 19:38:24 -04:00
|
|
|
ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2011-05-28 16:20:59 -04:00
|
|
|
const OUString* pFileName = getExternalFileName(nFileId);
|
2010-10-05 18:14:37 -04:00
|
|
|
if (!pFileName)
|
|
|
|
return NULL;
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2011-03-02 14:41:52 -05:00
|
|
|
ScDocument* pSrcDoc = NULL;
|
2010-10-05 18:14:37 -04:00
|
|
|
TypeId aType(TYPE(ScDocShell));
|
|
|
|
ScDocShell* pShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(&aType, false));
|
|
|
|
while (pShell)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2010-10-05 18:14:37 -04:00
|
|
|
SfxMedium* pMedium = pShell->GetMedium();
|
2012-07-25 09:31:59 -04:00
|
|
|
if (pMedium && !pMedium->GetName().isEmpty())
|
2010-10-05 18:14:37 -04:00
|
|
|
{
|
|
|
|
// TODO: We should make the case sensitivity platform dependent.
|
2012-07-25 09:31:59 -04:00
|
|
|
if (pFileName->equalsIgnoreAsciiCase(pMedium->GetName()))
|
2010-10-05 18:14:37 -04:00
|
|
|
{
|
|
|
|
// Found !
|
2011-03-02 14:41:52 -05:00
|
|
|
pSrcDoc = pShell->GetDocument();
|
|
|
|
break;
|
2010-10-05 18:14:37 -04:00
|
|
|
}
|
|
|
|
}
|
2011-12-19 22:23:44 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2010-10-05 18:14:37 -04:00
|
|
|
pShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pShell, &aType, false));
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
2011-03-02 14:41:52 -05:00
|
|
|
|
|
|
|
initDocInCache(maRefCache, pSrcDoc, nFileId);
|
|
|
|
return pSrcDoc;
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2013-03-26 19:38:24 -04:00
|
|
|
ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
if (!mpDoc->IsExecuteLinkEnabled())
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
DocShellMap::iterator itrEnd = maDocShells.end();
|
|
|
|
DocShellMap::iterator itr = maDocShells.find(nFileId);
|
|
|
|
|
|
|
|
if (itr != itrEnd)
|
|
|
|
{
|
2010-02-11 17:28:24 -05:00
|
|
|
// document already loaded.
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
SfxObjectShell* p = itr->second.maShell;
|
2011-12-01 21:03:42 +01:00
|
|
|
itr->second.maLastAccess = Time( Time::SYSTEM );
|
2008-12-12 09:38:47 +00:00
|
|
|
return static_cast<ScDocShell*>(p)->GetDocument();
|
|
|
|
}
|
|
|
|
|
2011-12-27 07:37:02 +01:00
|
|
|
itrEnd = maUnsavedDocShells.end();
|
|
|
|
itr = maUnsavedDocShells.find(nFileId);
|
|
|
|
if (itr != itrEnd)
|
|
|
|
{
|
|
|
|
//document is unsaved document
|
|
|
|
|
|
|
|
SfxObjectShell* p = itr->second.maShell;
|
|
|
|
itr->second.maLastAccess = Time( Time::SYSTEM );
|
|
|
|
return static_cast<ScDocShell*>(p)->GetDocument();
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
const OUString* pFile = getExternalFileName(nFileId);
|
2008-12-12 09:38:47 +00:00
|
|
|
if (!pFile)
|
|
|
|
// no file name associated with this ID.
|
|
|
|
return NULL;
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aFilter;
|
2008-12-12 09:38:47 +00:00
|
|
|
SrcShell aSrcDoc;
|
2014-03-02 16:44:12 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
aSrcDoc.maShell = loadSrcDocument(nFileId, aFilter);
|
|
|
|
}
|
|
|
|
catch (const css::uno::Exception&)
|
|
|
|
{
|
|
|
|
}
|
2008-12-12 09:38:47 +00:00
|
|
|
if (!aSrcDoc.maShell.Is())
|
|
|
|
{
|
|
|
|
// source document could not be loaded.
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-05-19 23:42:05 -04:00
|
|
|
return cacheNewDocShell(nFileId, aSrcDoc);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUString& rFilter)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
const SrcFileData* pFileData = getExternalFileData(nFileId);
|
|
|
|
if (!pFileData)
|
|
|
|
return NULL;
|
|
|
|
|
2009-09-17 11:09:25 +00:00
|
|
|
// Always load the document by using the path created from the relative
|
|
|
|
// path. If the referenced document is not there, simply exit. The
|
|
|
|
// original file name should be used only when the relative path is not
|
|
|
|
// given.
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aFile = pFileData->maFileName;
|
2009-09-17 11:09:25 +00:00
|
|
|
maybeCreateRealFileName(nFileId);
|
2011-05-28 16:20:59 -04:00
|
|
|
if (!pFileData->maRealFileName.isEmpty())
|
2009-09-17 11:09:25 +00:00
|
|
|
aFile = pFileData->maRealFileName;
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2009-09-17 11:09:25 +00:00
|
|
|
if (!isFileLoadable(aFile))
|
|
|
|
return NULL;
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aOptions = pFileData->maFilterOptions;
|
2012-01-06 14:22:10 -02:00
|
|
|
if ( !pFileData->maFilterName.isEmpty() )
|
2011-09-04 14:25:33 +02:00
|
|
|
rFilter = pFileData->maFilterName; // don't overwrite stored filter with guessed filter
|
|
|
|
else
|
|
|
|
ScDocumentLoader::GetFilterName(aFile, rFilter, aOptions, true, false);;
|
2008-12-12 09:38:47 +00:00
|
|
|
ScDocumentLoader::GetFilterName(aFile, rFilter, aOptions, true, false);
|
|
|
|
const SfxFilter* pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName(rFilter);
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
if (pFileData->maRelativeName.isEmpty())
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
// Generate a relative file path.
|
|
|
|
INetURLObject aBaseURL(getOwnDocumentName());
|
2013-03-19 09:22:44 +01:00
|
|
|
aBaseURL.insertName(OUString("content.xml"));
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aStr = URIHelper::simpleNormalizedMakeRelative(
|
2008-12-12 09:38:47 +00:00
|
|
|
aBaseURL.GetMainURL(INetURLObject::NO_DECODE), aFile);
|
|
|
|
|
|
|
|
setRelativeFileName(nFileId, aStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxItemSet* pSet = new SfxAllItemSet(SFX_APP()->GetPool());
|
2011-05-28 16:20:59 -04:00
|
|
|
if (!aOptions.isEmpty())
|
2008-12-12 09:38:47 +00:00
|
|
|
pSet->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, aOptions));
|
|
|
|
|
2009-12-15 17:17:08 +01:00
|
|
|
// make medium hidden to prevent assertion from progress bar
|
2011-05-28 16:20:59 -04:00
|
|
|
pSet->Put( SfxBoolItem(SID_HIDDEN, true) );
|
2009-12-15 17:17:08 +01:00
|
|
|
|
2011-09-22 15:00:08 +01:00
|
|
|
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
2012-05-24 11:38:12 +02:00
|
|
|
auto_ptr<SfxMedium> pMedium(new SfxMedium(aFile, STREAM_STD_READ, pFilter, pSet));
|
2011-09-22 15:00:08 +01:00
|
|
|
SAL_WNODEPRECATED_DECLARATIONS_POP
|
2008-12-12 09:38:47 +00:00
|
|
|
if (pMedium->GetError() != ERRCODE_NONE)
|
|
|
|
return NULL;
|
|
|
|
|
2010-03-09 14:51:15 -05:00
|
|
|
// To load encrypted documents with password, user interaction needs to be enabled.
|
|
|
|
pMedium->UseInteractionHandler(mbUserInteractionEnabled);
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2014-05-21 00:00:57 -04:00
|
|
|
ScDocShell* pNewShell = new ScDocShell(SFXMODEL_EXTERNAL_LINK);
|
2008-12-12 09:38:47 +00:00
|
|
|
SfxObjectShellRef aRef = pNewShell;
|
|
|
|
|
|
|
|
// increment the recursive link count of the source document.
|
|
|
|
ScExtDocOptions* pExtOpt = mpDoc->GetExtDocOptions();
|
|
|
|
sal_uInt32 nLinkCount = pExtOpt ? pExtOpt->GetDocSettings().mnLinkCnt : 0;
|
|
|
|
ScDocument* pSrcDoc = pNewShell->GetDocument();
|
2010-03-08 18:27:34 -05:00
|
|
|
pSrcDoc->EnableExecuteLink(false); // to prevent circular access of external references.
|
|
|
|
pSrcDoc->EnableUndo(false);
|
|
|
|
pSrcDoc->EnableAdjustHeight(false);
|
2012-12-04 16:23:18 -05:00
|
|
|
pSrcDoc->EnableUserInteraction(false);
|
2010-03-08 18:27:34 -05:00
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
ScExtDocOptions* pExtOptNew = pSrcDoc->GetExtDocOptions();
|
|
|
|
if (!pExtOptNew)
|
|
|
|
{
|
|
|
|
pExtOptNew = new ScExtDocOptions;
|
|
|
|
pSrcDoc->SetExtDocOptions(pExtOptNew);
|
|
|
|
}
|
|
|
|
pExtOptNew->GetDocSettings().mnLinkCnt = nLinkCount + 1;
|
|
|
|
|
2014-05-19 23:42:05 -04:00
|
|
|
if (!pNewShell->DoLoad(pMedium.release()))
|
|
|
|
{
|
|
|
|
aRef->DoClose();
|
|
|
|
aRef.Clear();
|
|
|
|
return aRef;
|
|
|
|
}
|
2010-07-28 17:58:52 +02:00
|
|
|
|
|
|
|
// with UseInteractionHandler, options may be set by dialog during DoLoad
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aNew = ScDocumentLoader::GetOptions(*pNewShell->GetMedium());
|
|
|
|
if (!aNew.isEmpty() && aNew != aOptions)
|
2010-07-28 17:58:52 +02:00
|
|
|
aOptions = aNew;
|
|
|
|
setFilterData(nFileId, rFilter, aOptions); // update the filter data, including the new options
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
return aRef;
|
|
|
|
}
|
|
|
|
|
2014-05-19 23:42:05 -04:00
|
|
|
ScDocument* ScExternalRefManager::cacheNewDocShell( sal_uInt16 nFileId, SrcShell& rSrcShell )
|
|
|
|
{
|
2014-05-20 00:59:29 -04:00
|
|
|
if (mbDocTimerEnabled && maDocShells.empty())
|
2014-05-19 23:42:05 -04:00
|
|
|
// If this is the first source document insertion, start up the timer.
|
|
|
|
maSrcDocTimer.Start();
|
|
|
|
|
|
|
|
maDocShells.insert(DocShellMap::value_type(nFileId, rSrcShell));
|
|
|
|
SfxObjectShell& rShell = *rSrcShell.maShell;
|
|
|
|
ScDocument* pSrcDoc = static_cast<ScDocShell&>(rShell).GetDocument();
|
|
|
|
initDocInCache(maRefCache, pSrcDoc, nFileId);
|
|
|
|
return pSrcDoc;
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
bool ScExternalRefManager::isFileLoadable(const OUString& rFile) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2011-05-28 16:20:59 -04:00
|
|
|
if (rFile.isEmpty())
|
2009-09-17 11:09:25 +00:00
|
|
|
return false;
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
if (isOwnDocument(rFile))
|
|
|
|
return false;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aPhysical;
|
2012-01-06 14:22:10 -02:00
|
|
|
if (utl::LocalFileHelper::ConvertURLToPhysicalName(rFile, aPhysical) && !aPhysical.isEmpty())
|
2011-09-04 14:25:33 +02:00
|
|
|
{
|
|
|
|
// #i114504# try IsFolder/Exists only for file URLs
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2011-09-04 14:25:33 +02:00
|
|
|
if (utl::UCBContentHelper::IsFolder(rFile))
|
|
|
|
return false;
|
2008-12-12 09:38:47 +00:00
|
|
|
|
2011-09-04 14:25:33 +02:00
|
|
|
return utl::UCBContentHelper::Exists(rFile);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return true; // for http and others, Exists doesn't work, but the URL can still be opened
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefManager::maybeLinkExternalFile(sal_uInt16 nFileId)
|
|
|
|
{
|
|
|
|
if (maLinkedDocs.count(nFileId))
|
2014-02-06 23:21:40 +01:00
|
|
|
// file already linked, or the link has been broken.
|
2008-12-12 09:38:47 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Source document not linked yet. Link it now.
|
2011-05-28 16:20:59 -04:00
|
|
|
const OUString* pFileName = getExternalFileName(nFileId);
|
2008-12-12 09:38:47 +00:00
|
|
|
if (!pFileName)
|
|
|
|
return;
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aFilter, aOptions;
|
2011-09-04 14:25:33 +02:00
|
|
|
const SrcFileData* pFileData = getExternalFileData(nFileId);
|
|
|
|
if (pFileData)
|
|
|
|
{
|
|
|
|
aFilter = pFileData->maFilterName;
|
|
|
|
aOptions = pFileData->maFilterOptions;
|
|
|
|
}
|
|
|
|
// If a filter was already set (for example, loading the cached table),
|
|
|
|
// don't call GetFilterName which has to access the source file.
|
2012-01-06 14:22:10 -02:00
|
|
|
if (aFilter.isEmpty())
|
2011-09-04 14:25:33 +02:00
|
|
|
ScDocumentLoader::GetFilterName(*pFileName, aFilter, aOptions, true, false);
|
2010-01-13 22:25:07 +01:00
|
|
|
sfx2::LinkManager* pLinkMgr = mpDoc->GetLinkManager();
|
2014-01-14 12:40:30 +01:00
|
|
|
if (!pLinkMgr)
|
|
|
|
{
|
|
|
|
SAL_WARN( "sc.ui", "ScExternalRefManager::maybeLinkExternalFile: pLinkMgr==NULL");
|
|
|
|
return;
|
|
|
|
}
|
2008-12-12 09:38:47 +00:00
|
|
|
ScExternalRefLink* pLink = new ScExternalRefLink(mpDoc, nFileId, aFilter);
|
2014-01-14 12:40:30 +01:00
|
|
|
OSL_ENSURE(pFileName, "ScExternalRefManager::maybeLinkExternalFile: file name pointer is NULL");
|
2013-08-26 15:22:55 +02:00
|
|
|
OUString aTmp = aFilter;
|
2011-05-28 16:20:59 -04:00
|
|
|
pLinkMgr->InsertFileLink(*pLink, OBJECT_CLIENT_FILE, *pFileName, &aTmp);
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
pLink->SetDoReferesh(false);
|
|
|
|
pLink->Update();
|
|
|
|
pLink->SetDoReferesh(true);
|
|
|
|
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
maLinkedDocs.insert(LinkedDocMap::value_type(nFileId, true));
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2013-09-17 12:49:11 +02:00
|
|
|
void ScExternalRefManager::SrcFileData::maybeCreateRealFileName(const OUString& rOwnDocName)
|
2009-09-17 11:09:25 +00:00
|
|
|
{
|
2011-05-28 16:20:59 -04:00
|
|
|
if (maRelativeName.isEmpty())
|
2009-09-17 11:09:25 +00:00
|
|
|
// No relative path given. Nothing to do.
|
|
|
|
return;
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
if (!maRealFileName.isEmpty())
|
2009-09-17 11:09:25 +00:00
|
|
|
// Real file name already created. Nothing to do.
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Formulate the absolute file path from the relative path.
|
2011-05-28 16:20:59 -04:00
|
|
|
const OUString& rRelPath = maRelativeName;
|
2009-09-17 11:09:25 +00:00
|
|
|
INetURLObject aBaseURL(rOwnDocName);
|
2013-03-19 09:22:44 +01:00
|
|
|
aBaseURL.insertName(OUString("content.xml"));
|
2009-09-17 11:09:25 +00:00
|
|
|
bool bWasAbs = false;
|
|
|
|
maRealFileName = aBaseURL.smartRel2Abs(rRelPath, bWasAbs).GetMainURL(INetURLObject::NO_DECODE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefManager::maybeCreateRealFileName(sal_uInt16 nFileId)
|
|
|
|
{
|
|
|
|
if (nFileId >= maSrcFiles.size())
|
|
|
|
return;
|
|
|
|
|
|
|
|
maSrcFiles[nFileId].maybeCreateRealFileName(getOwnDocumentName());
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString ScExternalRefManager::getOwnDocumentName() const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
SfxObjectShell* pShell = mpDoc->GetDocumentShell();
|
|
|
|
if (!pShell)
|
|
|
|
// This should not happen!
|
2011-05-28 16:20:59 -04:00
|
|
|
return OUString();
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
SfxMedium* pMed = pShell->GetMedium();
|
|
|
|
if (!pMed)
|
2011-05-28 16:20:59 -04:00
|
|
|
return OUString();
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
return pMed->GetName();
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
bool ScExternalRefManager::isOwnDocument(const OUString& rFile) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2011-05-28 16:20:59 -04:00
|
|
|
return getOwnDocumentName().equals(rFile);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
void ScExternalRefManager::convertToAbsName(OUString& rFile) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2011-12-27 07:37:02 +01:00
|
|
|
// unsaved documents have no AbsName
|
|
|
|
TypeId aType(TYPE(ScDocShell));
|
|
|
|
ScDocShell* pShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(&aType, false));
|
|
|
|
while (pShell)
|
|
|
|
{
|
2013-10-25 17:35:42 +02:00
|
|
|
if (rFile == pShell->GetName())
|
2011-12-27 07:37:02 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
pShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pShell, &aType, false));
|
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
SfxObjectShell* pDocShell = mpDoc->GetDocumentShell();
|
|
|
|
rFile = ScGlobal::GetAbsDocName(rFile, pDocShell);
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
sal_uInt16 ScExternalRefManager::getExternalFileId(const OUString& rFile)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
vector<SrcFileData>::const_iterator itrBeg = maSrcFiles.begin(), itrEnd = maSrcFiles.end();
|
|
|
|
vector<SrcFileData>::const_iterator itr = find_if(itrBeg, itrEnd, FindSrcFileByName(rFile));
|
|
|
|
if (itr != itrEnd)
|
|
|
|
{
|
|
|
|
size_t nId = distance(itrBeg, itr);
|
|
|
|
return static_cast<sal_uInt16>(nId);
|
|
|
|
}
|
|
|
|
|
|
|
|
SrcFileData aData;
|
|
|
|
aData.maFileName = rFile;
|
|
|
|
maSrcFiles.push_back(aData);
|
|
|
|
return static_cast<sal_uInt16>(maSrcFiles.size() - 1);
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
const OUString* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
if (nFileId >= maSrcFiles.size())
|
|
|
|
return NULL;
|
|
|
|
|
2009-09-17 11:09:25 +00:00
|
|
|
if (bForceOriginal)
|
|
|
|
return &maSrcFiles[nFileId].maFileName;
|
|
|
|
|
|
|
|
maybeCreateRealFileName(nFileId);
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
if (!maSrcFiles[nFileId].maRealFileName.isEmpty())
|
2009-09-17 11:09:25 +00:00
|
|
|
return &maSrcFiles[nFileId].maRealFileName;
|
2011-05-28 16:20:59 -04:00
|
|
|
|
|
|
|
return &maSrcFiles[nFileId].maFileName;
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2013-11-18 15:26:05 -05:00
|
|
|
std::vector<OUString> ScExternalRefManager::getAllCachedExternalFileNames() const
|
|
|
|
{
|
|
|
|
std::vector<OUString> aNames;
|
|
|
|
aNames.reserve(maSrcFiles.size());
|
|
|
|
std::vector<SrcFileData>::const_iterator it = maSrcFiles.begin(), itEnd = maSrcFiles.end();
|
|
|
|
for (; it != itEnd; ++it)
|
|
|
|
{
|
|
|
|
const SrcFileData& rData = *it;
|
|
|
|
aNames.push_back(rData.maFileName);
|
|
|
|
}
|
|
|
|
|
|
|
|
return aNames;
|
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
bool ScExternalRefManager::hasExternalFile(sal_uInt16 nFileId) const
|
|
|
|
{
|
|
|
|
return nFileId < maSrcFiles.size();
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
bool ScExternalRefManager::hasExternalFile(const OUString& rFile) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
vector<SrcFileData>::const_iterator itrBeg = maSrcFiles.begin(), itrEnd = maSrcFiles.end();
|
|
|
|
vector<SrcFileData>::const_iterator itr = find_if(itrBeg, itrEnd, FindSrcFileByName(rFile));
|
|
|
|
return itr != itrEnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
const ScExternalRefManager::SrcFileData* ScExternalRefManager::getExternalFileData(sal_uInt16 nFileId) const
|
|
|
|
{
|
|
|
|
if (nFileId >= maSrcFiles.size())
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return &maSrcFiles[nFileId];
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
const OUString* ScExternalRefManager::getRealTableName(sal_uInt16 nFileId, const OUString& rTabName) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
return maRefCache.getRealTableName(nFileId, rTabName);
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
const OUString* ScExternalRefManager::getRealRangeName(sal_uInt16 nFileId, const OUString& rRangeName) const
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
return maRefCache.getRealRangeName(nFileId, rRangeName);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename MapContainer>
|
2012-10-12 13:26:46 +02:00
|
|
|
static void lcl_removeByFileId(sal_uInt16 nFileId, MapContainer& rMap)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
typename MapContainer::iterator itr = rMap.find(nFileId);
|
|
|
|
if (itr != rMap.end())
|
2011-05-04 18:47:36 -04:00
|
|
|
{
|
|
|
|
// Close this document shell.
|
|
|
|
itr->second.maShell->DoClose();
|
2008-12-12 09:38:47 +00:00
|
|
|
rMap.erase(itr);
|
2011-05-04 18:47:36 -04:00
|
|
|
}
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2011-11-22 22:32:05 -05:00
|
|
|
void ScExternalRefManager::clearCache(sal_uInt16 nFileId)
|
|
|
|
{
|
|
|
|
maRefCache.clearCache(nFileId);
|
|
|
|
}
|
2011-05-04 18:47:36 -04:00
|
|
|
|
2014-05-20 13:57:13 -04:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
class RefCacheFiller : public sc::ColumnSpanSet::ColumnAction
|
|
|
|
{
|
|
|
|
svl::SharedStringPool& mrStrPool;
|
|
|
|
|
|
|
|
ScExternalRefCache& mrRefCache;
|
|
|
|
ScExternalRefCache::TableTypeRef mpRefTab;
|
|
|
|
sal_uInt16 mnFileId;
|
|
|
|
ScColumn* mpCurCol;
|
|
|
|
sc::ColumnBlockConstPosition maBlockPos;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RefCacheFiller( svl::SharedStringPool& rStrPool, ScExternalRefCache& rRefCache, sal_uInt16 nFileId ) :
|
|
|
|
mrStrPool(rStrPool), mrRefCache(rRefCache), mnFileId(nFileId), mpCurCol(NULL) {}
|
|
|
|
|
2014-05-21 21:53:07 +03:00
|
|
|
virtual void startColumn( ScColumn* pCol ) SAL_OVERRIDE
|
2014-05-20 13:57:13 -04:00
|
|
|
{
|
|
|
|
mpCurCol = pCol;
|
|
|
|
if (!mpCurCol)
|
|
|
|
return;
|
|
|
|
|
|
|
|
mpCurCol->InitBlockPosition(maBlockPos);
|
|
|
|
mpRefTab = mrRefCache.getCacheTable(mnFileId, mpCurCol->GetTab());
|
|
|
|
}
|
|
|
|
|
2014-05-21 21:53:07 +03:00
|
|
|
virtual void execute( SCROW nRow1, SCROW nRow2, bool bVal ) SAL_OVERRIDE
|
2014-05-20 13:57:13 -04:00
|
|
|
{
|
|
|
|
if (!mpCurCol || !bVal)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!mpRefTab)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
|
|
|
|
{
|
|
|
|
ScExternalRefCache::TokenRef pTok;
|
|
|
|
ScRefCellValue aCell = mpCurCol->GetCellValue(maBlockPos, nRow);
|
|
|
|
switch (aCell.meType)
|
|
|
|
{
|
|
|
|
case CELLTYPE_STRING:
|
|
|
|
case CELLTYPE_EDIT:
|
|
|
|
{
|
|
|
|
OUString aStr = aCell.getString(&mpCurCol->GetDoc());
|
|
|
|
svl::SharedString aSS = mrStrPool.intern(aStr);
|
|
|
|
pTok.reset(new formula::FormulaStringToken(aSS));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CELLTYPE_VALUE:
|
|
|
|
pTok.reset(new formula::FormulaDoubleToken(aCell.mfValue));
|
|
|
|
break;
|
|
|
|
case CELLTYPE_FORMULA:
|
|
|
|
{
|
|
|
|
sc::FormulaResultValue aRes = aCell.mpFormula->GetResult();
|
|
|
|
switch (aRes.meType)
|
|
|
|
{
|
|
|
|
case sc::FormulaResultValue::Value:
|
|
|
|
pTok.reset(new formula::FormulaDoubleToken(aRes.mfValue));
|
|
|
|
break;
|
|
|
|
case sc::FormulaResultValue::String:
|
|
|
|
{
|
|
|
|
// Re-intern the string to the host document pool.
|
|
|
|
svl::SharedString aInterned = mrStrPool.intern(aRes.maString.getString());
|
|
|
|
pTok.reset(new formula::FormulaStringToken(aInterned));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case sc::FormulaResultValue::Error:
|
|
|
|
case sc::FormulaResultValue::Invalid:
|
|
|
|
default:
|
|
|
|
pTok.reset(new FormulaErrorToken(errNoValue));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
pTok.reset(new FormulaErrorToken(errNoValue));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pTok)
|
|
|
|
{
|
|
|
|
// Cache this cell.
|
|
|
|
mpRefTab->setCell(mpCurCol->GetCol(), nRow, pTok, mpCurCol->GetNumberFormat(nRow));
|
|
|
|
mpRefTab->setCachedCell(mpCurCol->GetCol(), nRow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-05-19 23:42:05 -04:00
|
|
|
bool ScExternalRefManager::refreshSrcDocument(sal_uInt16 nFileId)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2014-05-20 13:57:13 -04:00
|
|
|
sc::ColumnSpanSet aCachedArea(false);
|
|
|
|
maRefCache.getAllCachedDataSpans(nFileId, aCachedArea);
|
|
|
|
|
2014-05-19 23:42:05 -04:00
|
|
|
OUString aFilter;
|
|
|
|
SfxObjectShellRef xDocShell;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
xDocShell = loadSrcDocument(nFileId, aFilter);
|
|
|
|
}
|
|
|
|
catch ( const css::uno::Exception& ) {}
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
|
2014-05-19 23:42:05 -04:00
|
|
|
if (!xDocShell.Is())
|
|
|
|
// Failed to load the document. Bail out.
|
|
|
|
return false;
|
|
|
|
|
2014-05-20 13:57:13 -04:00
|
|
|
ScDocShell& rDocSh = static_cast<ScDocShell&>(*xDocShell);
|
|
|
|
ScDocument* pSrcDoc = rDocSh.GetDocument();
|
|
|
|
|
|
|
|
// Clear the existing cache, and refill it. Make sure we keep the
|
|
|
|
// existing cache table instances here.
|
|
|
|
maRefCache.clearCacheTables(nFileId);
|
|
|
|
RefCacheFiller aAction(mpDoc->GetSharedStringPool(), maRefCache, nFileId);
|
|
|
|
aCachedArea.executeColumnAction(*pSrcDoc, aAction);
|
|
|
|
|
2014-05-19 23:42:05 -04:00
|
|
|
DocShellMap::iterator it = maDocShells.find(nFileId);
|
|
|
|
if (it != maDocShells.end())
|
|
|
|
{
|
|
|
|
it->second.maShell->DoClose();
|
|
|
|
it->second.maShell = xDocShell;
|
|
|
|
it->second.maLastAccess = Time(Time::SYSTEM);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SrcShell aSrcDoc;
|
|
|
|
aSrcDoc.maShell = xDocShell;
|
|
|
|
aSrcDoc.maLastAccess = Time(Time::SYSTEM);
|
|
|
|
cacheNewDocShell(nFileId, aSrcDoc);
|
|
|
|
}
|
2008-12-12 09:38:47 +00:00
|
|
|
|
|
|
|
// Update all cells containing names from this source document.
|
|
|
|
refreshAllRefCells(nFileId);
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
|
|
|
|
notifyAllLinkListeners(nFileId, LINK_MODIFIED);
|
2014-05-19 23:42:05 -04:00
|
|
|
|
|
|
|
return true;
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefManager::breakLink(sal_uInt16 nFileId)
|
|
|
|
{
|
2010-03-05 19:43:26 -05:00
|
|
|
// Turn all formula cells referencing this external document into static
|
|
|
|
// cells.
|
|
|
|
RefCellMap::iterator itrRefs = maRefCells.find(nFileId);
|
|
|
|
if (itrRefs != maRefCells.end())
|
|
|
|
{
|
|
|
|
// Make a copy because removing the formula cells below will modify
|
|
|
|
// the original container.
|
|
|
|
RefCellSet aSet = itrRefs->second;
|
|
|
|
for_each(aSet.begin(), aSet.end(), ConvertFormulaToStatic(mpDoc));
|
2011-05-06 01:50:02 -04:00
|
|
|
maRefCells.erase(nFileId);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove all named ranges that reference this document.
|
2011-05-06 00:07:35 -04:00
|
|
|
|
2011-05-06 01:50:02 -04:00
|
|
|
// Global named ranges.
|
|
|
|
ScRangeName* pRanges = mpDoc->GetRangeName();
|
|
|
|
if (pRanges)
|
|
|
|
removeRangeNamesBySrcDoc(*pRanges, nFileId);
|
2011-05-06 00:07:35 -04:00
|
|
|
|
2011-05-06 01:50:02 -04:00
|
|
|
// Sheet-local named ranges.
|
|
|
|
for (SCTAB i = 0, n = mpDoc->GetTableCount(); i < n; ++i)
|
|
|
|
{
|
|
|
|
pRanges = mpDoc->GetRangeName(i);
|
2011-05-06 00:07:35 -04:00
|
|
|
if (pRanges)
|
2011-05-06 01:12:37 -04:00
|
|
|
removeRangeNamesBySrcDoc(*pRanges, nFileId);
|
2010-03-05 19:43:26 -05:00
|
|
|
}
|
|
|
|
|
2011-11-22 22:32:05 -05:00
|
|
|
clearCache(nFileId);
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
lcl_removeByFileId(nFileId, maDocShells);
|
|
|
|
|
|
|
|
if (maDocShells.empty())
|
|
|
|
maSrcDocTimer.Stop();
|
|
|
|
|
|
|
|
LinkedDocMap::iterator itr = maLinkedDocs.find(nFileId);
|
|
|
|
if (itr != maLinkedDocs.end())
|
|
|
|
itr->second = false;
|
|
|
|
|
|
|
|
notifyAllLinkListeners(nFileId, LINK_BROKEN);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
void ScExternalRefManager::switchSrcFile(sal_uInt16 nFileId, const OUString& rNewFile, const OUString& rNewFilter)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
maSrcFiles[nFileId].maFileName = rNewFile;
|
2011-05-28 16:20:59 -04:00
|
|
|
maSrcFiles[nFileId].maRelativeName = OUString();
|
|
|
|
maSrcFiles[nFileId].maRealFileName = OUString();
|
|
|
|
if (!maSrcFiles[nFileId].maFilterName.equals(rNewFilter))
|
2009-09-17 11:09:25 +00:00
|
|
|
{
|
|
|
|
// Filter type has changed.
|
|
|
|
maSrcFiles[nFileId].maFilterName = rNewFilter;
|
2011-05-28 16:20:59 -04:00
|
|
|
maSrcFiles[nFileId].maFilterOptions = OUString();
|
2009-09-17 11:09:25 +00:00
|
|
|
}
|
2014-05-19 23:42:05 -04:00
|
|
|
refreshSrcDocument(nFileId);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
void ScExternalRefManager::setRelativeFileName(sal_uInt16 nFileId, const OUString& rRelUrl)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
if (nFileId >= maSrcFiles.size())
|
|
|
|
return;
|
|
|
|
maSrcFiles[nFileId].maRelativeName = rRelUrl;
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
void ScExternalRefManager::setFilterData(sal_uInt16 nFileId, const OUString& rFilterName, const OUString& rOptions)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
if (nFileId >= maSrcFiles.size())
|
|
|
|
return;
|
|
|
|
maSrcFiles[nFileId].maFilterName = rFilterName;
|
|
|
|
maSrcFiles[nFileId].maFilterOptions = rOptions;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefManager::clear()
|
|
|
|
{
|
|
|
|
DocShellMap::iterator itrEnd = maDocShells.end();
|
|
|
|
for (DocShellMap::iterator itr = maDocShells.begin(); itr != itrEnd; ++itr)
|
|
|
|
itr->second.maShell->DoClose();
|
|
|
|
|
|
|
|
maDocShells.clear();
|
|
|
|
maSrcDocTimer.Stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ScExternalRefManager::hasExternalData() const
|
|
|
|
{
|
|
|
|
return !maSrcFiles.empty();
|
|
|
|
}
|
|
|
|
|
2011-05-28 16:20:59 -04:00
|
|
|
void ScExternalRefManager::resetSrcFileData(const OUString& rBaseFileUrl)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
for (vector<SrcFileData>::iterator itr = maSrcFiles.begin(), itrEnd = maSrcFiles.end();
|
|
|
|
itr != itrEnd; ++itr)
|
|
|
|
{
|
2009-09-17 11:09:25 +00:00
|
|
|
// Re-generate relative file name from the absolute file name.
|
2011-05-28 16:20:59 -04:00
|
|
|
OUString aAbsName = itr->maRealFileName;
|
|
|
|
if (aAbsName.isEmpty())
|
2009-09-17 11:09:25 +00:00
|
|
|
aAbsName = itr->maFileName;
|
|
|
|
|
|
|
|
itr->maRelativeName = URIHelper::simpleNormalizedMakeRelative(
|
|
|
|
rBaseFileUrl, aAbsName);
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-21 16:27:34 +01:00
|
|
|
void ScExternalRefManager::updateAbsAfterLoad()
|
|
|
|
{
|
2013-10-07 14:02:47 +02:00
|
|
|
OUString aOwn( getOwnDocumentName() );
|
2011-02-21 16:27:34 +01:00
|
|
|
for (vector<SrcFileData>::iterator itr = maSrcFiles.begin(), itrEnd = maSrcFiles.end();
|
|
|
|
itr != itrEnd; ++itr)
|
|
|
|
{
|
|
|
|
// update maFileName to the real file name,
|
|
|
|
// to be called when the original name is no longer needed (after CompileXML)
|
|
|
|
|
|
|
|
itr->maybeCreateRealFileName( aOwn );
|
2013-10-07 14:02:47 +02:00
|
|
|
OUString aReal = itr->maRealFileName;
|
|
|
|
if (!aReal.isEmpty())
|
2011-02-21 16:27:34 +01:00
|
|
|
itr->maFileName = aReal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-05 19:43:26 -05:00
|
|
|
void ScExternalRefManager::removeRefCell(ScFormulaCell* pCell)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
2010-03-05 19:43:26 -05:00
|
|
|
for_each(maRefCells.begin(), maRefCells.end(), RemoveFormulaCell(pCell));
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
void ScExternalRefManager::addLinkListener(sal_uInt16 nFileId, LinkListener* pListener)
|
|
|
|
{
|
|
|
|
LinkListenerMap::iterator itr = maLinkListeners.find(nFileId);
|
|
|
|
if (itr == maLinkListeners.end())
|
|
|
|
{
|
|
|
|
pair<LinkListenerMap::iterator, bool> r = maLinkListeners.insert(
|
|
|
|
LinkListenerMap::value_type(nFileId, LinkListeners()));
|
|
|
|
if (!r.second)
|
|
|
|
{
|
2011-03-01 19:05:02 +01:00
|
|
|
OSL_FAIL("insertion of new link listener list failed");
|
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken
2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment.
2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges.
2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning.
2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts.
However, Excel doesn't entirely like my chart output if the chart contains
external references. The data are all there, but it refuses to draw it.
It works fine with charts with internal references.
2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token
array instead of a range list to represent the data ranges.
2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the
rest of the code there. Both strings are empty so this is just for aesthetic
reasons.
2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents
with an empty chart.
2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by
the older version of OOo. In the old syntax, the sheet name was dropped for
the 2nd reference of a range if the 1st and 2nd references are on the same
sheet. In the new syntax this is not the case.
Also fixed unintential display of the sheet name for the end range address of a
single-sheet range.
2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid
triggering assertions in a non-pro build.
2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the
external ref manager if the document itself is being destroyed.
2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken
type, not of ScAddress type.
2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build.
2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build.
2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value.
2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all.
2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor,
since explicit definition of copy constructor would cause a serious compiler
warning that's too ugly to fix.
2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature.
2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings.
2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers.
2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning.
* tab -> whitespace conversion in some code.
2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment.
2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper.
* a little code cleanup.
2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once.
2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment.
2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not
reachable.
2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken.
2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell
token instead of NULL, to be consistent with the old behavior.
2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken.
2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners.
2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated.
2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener.
2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing
ScChartListener.
2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string
from chart2uno to rangeutl & compile the range string to generate ref tokens
upon ods import.
2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage.
2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start
moving some of local ref token handling functions from chart2uno.cxx to
ScRefTokenHelper class to make them available in other places.
2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef.
2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method.
2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#).
2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula
module and its associated changes esp. wrt token classes.
2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39)
2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of
ScChart2TokenRef, since I need this typedef in the odf importer. In the future
this can also replace the similar typedef in ScExternalRefManager.
2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified
when the link is updated.
The work is not done yet.
2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet.
2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings.
2) fixed convertRangesToXML to convert ref tokens into correct ODF range format.
2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method.
2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions.
2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more.
2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation.
2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename.
2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of
one assertion to prevent it from being triggered incorrectly in non-pro build.
2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup.
2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used.
2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range.
2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains
external data after editing of chart.
2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens.
2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method.
2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in
order to use reference tokens instead of range list. The basis of that code
is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking
any existing legacy code that might still use it. It appears to be used by the
StarOffice 1.0 filter only.
Still not working with the external references.
2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does.
2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it.
2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list.
2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the
data to be displayed in the diagram.
2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it.
2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it.
2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo.
2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way
we can also display external reference addresses correctly.
2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function.
2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion.
2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code
into a single function object class.
2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method.
2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join
the missing upper-left corner cell with the existing range list. Also, I needed to join
ranges recursively instead of just doing it once.
2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing.
2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens.
2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress.
2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider.
Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens
instead of range list.
2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on
we will use a list of tokens to track data source ranges.
Now, if I haven't introduced any bugs in the process, normal charts with no external
references should work as before. But I still need to get the external refs to
work.
2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence.
2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method.
2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do.
2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list.
2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken
instances instead of ScRangeList, to keep track of data source ranges.
This way, the chart2uno code can tell whether the ranges are external or
internal, and act accordingly.
I'm not finished with it yet. Some things are still not working.
2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing.
2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes.
I need to be changing code around this area, and I don't want to redo my changes once
koheichart01 gets integrated for 3.2.
2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format.
I also added a helper method to append a table name because this is useful in a lot of
other places.
2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly.
2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable.
2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its
associated member variable (per Caolan's callcatcher output). I added that
method to allow reverse matching in some code but later retracted that logic.
I guess I forgot to remove the method itself afterwards...
2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention
when exporting to ODF, regardless of current address convention. Same for reading from ODF documents.
2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
2009-03-03 15:05:33 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
itr = r.first;
|
|
|
|
}
|
|
|
|
|
|
|
|
LinkListeners& rList = itr->second;
|
|
|
|
rList.insert(pListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefManager::removeLinkListener(sal_uInt16 nFileId, LinkListener* pListener)
|
|
|
|
{
|
|
|
|
LinkListenerMap::iterator itr = maLinkListeners.find(nFileId);
|
|
|
|
if (itr == maLinkListeners.end())
|
|
|
|
// no listeners for a specified file.
|
|
|
|
return;
|
|
|
|
|
|
|
|
LinkListeners& rList = itr->second;
|
|
|
|
rList.erase(pListener);
|
|
|
|
|
|
|
|
if (rList.empty())
|
|
|
|
// No more listeners for this file. Remove its entry.
|
|
|
|
maLinkListeners.erase(itr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefManager::removeLinkListener(LinkListener* pListener)
|
|
|
|
{
|
|
|
|
LinkListenerMap::iterator itr = maLinkListeners.begin(), itrEnd = maLinkListeners.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
itr->second.erase(pListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefManager::notifyAllLinkListeners(sal_uInt16 nFileId, LinkUpdateType eType)
|
|
|
|
{
|
|
|
|
LinkListenerMap::iterator itr = maLinkListeners.find(nFileId);
|
|
|
|
if (itr == maLinkListeners.end())
|
|
|
|
// no listeners for a specified file.
|
|
|
|
return;
|
|
|
|
|
|
|
|
LinkListeners& rList = itr->second;
|
|
|
|
for_each(rList.begin(), rList.end(), NotifyLinkListener(nFileId, eType));
|
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
void ScExternalRefManager::purgeStaleSrcDocument(sal_Int32 nTimeOut)
|
|
|
|
{
|
2014-05-20 10:19:25 -04:00
|
|
|
// To avoid potentially freezing Calc, we close one stale document at a time.
|
2008-12-12 09:38:47 +00:00
|
|
|
DocShellMap::iterator itr = maDocShells.begin(), itrEnd = maDocShells.end();
|
|
|
|
for (; itr != itrEnd; ++itr)
|
|
|
|
{
|
|
|
|
// in 100th of a second.
|
2011-12-01 21:03:42 +01:00
|
|
|
sal_Int32 nSinceLastAccess = (Time( Time::SYSTEM ) - itr->second.maLastAccess).GetTime();
|
2014-05-20 10:19:25 -04:00
|
|
|
if (nSinceLastAccess >= nTimeOut)
|
|
|
|
{
|
|
|
|
// Timed out. Let's close this, and exit the loop.
|
2011-05-04 18:47:36 -04:00
|
|
|
itr->second.maShell->DoClose();
|
2014-05-20 10:19:25 -04:00
|
|
|
maDocShells.erase(itr);
|
|
|
|
break;
|
|
|
|
}
|
2008-12-12 09:38:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (maDocShells.empty())
|
|
|
|
maSrcDocTimer.Stop();
|
|
|
|
}
|
|
|
|
|
2010-10-05 18:14:37 -04:00
|
|
|
sal_uInt32 ScExternalRefManager::getMappedNumberFormat(sal_uInt16 nFileId, sal_uInt32 nNumFmt, const ScDocument* pSrcDoc)
|
2008-12-12 09:38:47 +00:00
|
|
|
{
|
|
|
|
NumFmtMap::iterator itr = maNumFormatMap.find(nFileId);
|
|
|
|
if (itr == maNumFormatMap.end())
|
|
|
|
{
|
|
|
|
// Number formatter map is not initialized for this external document.
|
|
|
|
pair<NumFmtMap::iterator, bool> r = maNumFormatMap.insert(
|
|
|
|
NumFmtMap::value_type(nFileId, SvNumberFormatterMergeMap()));
|
|
|
|
|
|
|
|
if (!r.second)
|
|
|
|
// insertion failed.
|
|
|
|
return nNumFmt;
|
|
|
|
|
|
|
|
itr = r.first;
|
|
|
|
mpDoc->GetFormatTable()->MergeFormatter( *pSrcDoc->GetFormatTable());
|
|
|
|
SvNumberFormatterMergeMap aMap = mpDoc->GetFormatTable()->ConvertMergeTableToMap();
|
|
|
|
itr->second.swap(aMap);
|
|
|
|
}
|
|
|
|
const SvNumberFormatterMergeMap& rMap = itr->second;
|
|
|
|
SvNumberFormatterMergeMap::const_iterator itrNumFmt = rMap.find(nNumFmt);
|
|
|
|
if (itrNumFmt != rMap.end())
|
|
|
|
// mapped value found.
|
|
|
|
return itrNumFmt->second;
|
|
|
|
|
|
|
|
return nNumFmt;
|
|
|
|
}
|
|
|
|
|
2011-12-19 22:23:44 +01:00
|
|
|
void ScExternalRefManager::transformUnsavedRefToSavedRef( SfxObjectShell* pShell )
|
|
|
|
{
|
2012-01-04 15:18:09 +01:00
|
|
|
DocShellMap::iterator itr = maUnsavedDocShells.begin();
|
|
|
|
while( itr != maUnsavedDocShells.end() )
|
2011-12-19 22:23:44 +01:00
|
|
|
{
|
|
|
|
if (&(itr->second.maShell) == pShell)
|
|
|
|
{
|
|
|
|
// found that the shell is marked as unsaved
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aFileURL = pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI);
|
|
|
|
switchSrcFile(itr->first, aFileURL, OUString());
|
2011-12-19 22:23:44 +01:00
|
|
|
EndListening(*pShell);
|
2012-01-04 15:18:09 +01:00
|
|
|
maUnsavedDocShells.erase(itr++);
|
2011-12-19 22:23:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScExternalRefManager::Notify( SfxBroadcaster&, const SfxHint& rHint )
|
|
|
|
{
|
|
|
|
if ( rHint.ISA( SfxEventHint ) )
|
|
|
|
{
|
|
|
|
sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId();
|
|
|
|
switch ( nEventId )
|
|
|
|
{
|
2012-01-06 19:32:19 +01:00
|
|
|
case SFX_EVENT_PREPARECLOSEDOC:
|
|
|
|
{
|
|
|
|
SfxObjectShell* pObjShell = static_cast<const SfxEventHint&>( rHint ).GetObjShell();
|
|
|
|
ScDocShell* pDocShell = static_cast< ScDocShell* >( pObjShell );
|
|
|
|
WarningBox aBox( pDocShell->GetActiveDialogParent(), WinBits( WB_OK ),
|
|
|
|
ScGlobal::GetRscString( STR_CLOSE_WITH_UNSAVED_REFS ) );
|
|
|
|
aBox.Execute();
|
|
|
|
}
|
|
|
|
break;
|
2011-12-19 22:23:44 +01:00
|
|
|
case SFX_EVENT_SAVEDOCDONE:
|
|
|
|
case SFX_EVENT_SAVEASDOCDONE:
|
|
|
|
{
|
|
|
|
SfxObjectShell* pObjShell = static_cast<const SfxEventHint&>( rHint ).GetObjShell();
|
|
|
|
transformUnsavedRefToSavedRef(pObjShell);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-12 09:38:47 +00:00
|
|
|
IMPL_LINK(ScExternalRefManager, TimeOutHdl, AutoTimer*, pTimer)
|
|
|
|
{
|
|
|
|
if (pTimer == &maSrcDocTimer)
|
|
|
|
purgeStaleSrcDocument(SRCDOC_LIFE_SPAN);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-10-12 15:59:00 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|