diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2009-09-30 00:18:39 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2009-09-30 00:18:39 -0400 |
commit | c363eab53e44378091b4bb7ab653d1eb074d0094 (patch) | |
tree | d8e286a48ed97f06cd597e7ede326900e64ad463 /sc/inc | |
parent | ddf9f3eea0511c5971f88c9b4eb08a63a8a8d7fd (diff) | |
parent | c4c825af22a19fa4aeb17c86df03256a081cb83a (diff) |
rebased to DEV300_m60.
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/cell.hxx | 5 | ||||
-rw-r--r-- | sc/inc/clipparam.hxx | 91 | ||||
-rw-r--r-- | sc/inc/collect.hxx | 3 | ||||
-rw-r--r-- | sc/inc/column.hxx | 5 | ||||
-rw-r--r-- | sc/inc/compiler.hxx | 73 | ||||
-rw-r--r-- | sc/inc/detfunc.hxx | 1 | ||||
-rw-r--r-- | sc/inc/document.hxx | 64 | ||||
-rw-r--r-- | sc/inc/docuno.hxx | 3 | ||||
-rw-r--r-- | sc/inc/externalrefmgr.hxx | 48 | ||||
-rw-r--r-- | sc/inc/global.hxx | 20 | ||||
-rw-r--r-- | sc/inc/indexmap.hxx | 59 | ||||
-rw-r--r-- | sc/inc/rangenam.hxx | 7 | ||||
-rw-r--r-- | sc/inc/sc.hrc | 7 | ||||
-rw-r--r-- | sc/inc/sheetdata.hxx | 183 | ||||
-rw-r--r-- | sc/inc/table.hxx | 11 | ||||
-rw-r--r-- | sc/inc/textuno.hxx | 11 |
16 files changed, 478 insertions, 113 deletions
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx index 1e9a8618800e..1f2bff35ce98 100644 --- a/sc/inc/cell.hxx +++ b/sc/inc/cell.hxx @@ -37,6 +37,7 @@ #include <tools/mempool.hxx> #include <svtools/listener.hxx> #include "global.hxx" +#include "rangenam.hxx" #include "formula/grammar.hxx" #include "tokenarray.hxx" #include "formularesult.hxx" @@ -289,8 +290,6 @@ enum ScMatrixMode { MM_FAKE = 3 // Interpret "as-if" matrix formula (legacy) }; -class ScIndexMap; - class SC_DLLPUBLIC ScFormulaCell : public ScBaseCell, public SvtListener { private: @@ -413,7 +412,7 @@ public: void UpdateCompile( BOOL bForceIfNameInUse = FALSE ); BOOL IsRangeNameInUse(USHORT nIndex) const; void FindRangeNamesInUse(std::set<USHORT>& rIndexes) const; - void ReplaceRangeNamesInUse( const ScIndexMap& rMap ); + void ReplaceRangeNamesInUse( const ScRangeData::IndexMap& rMap ); BOOL IsSubTotal() const { return bSubTotal; } BOOL IsChanged() const { return bChanged; } void ResetChanged() { bChanged = FALSE; } diff --git a/sc/inc/clipparam.hxx b/sc/inc/clipparam.hxx new file mode 100644 index 000000000000..896117bdef69 --- /dev/null +++ b/sc/inc/clipparam.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: document.hxx,v $ + * $Revision: 1.115.36.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SC_CLIPPARAM_HXX +#define SC_CLIPPARAM_HXX + +#include "rangelst.hxx" +#include "rangenam.hxx" + +#include <vector> + +/** + * This struct stores general clipboard parameters associated with a + * ScDocument instance created in clipboard mode. + */ +struct ScClipParam +{ + enum Direction { Unspecified, Column, Row }; + + ScRangeList maRanges; + Direction meDirection; + bool mbCutMode; + + ScClipParam(); + ScClipParam(const ScRange& rRange, bool bCutMode); + explicit ScClipParam(const ScClipParam& r); + + bool isMultiRange() const; + + /** + * Get the column size of a pasted range. Note that when the range is + * non-contiguous, we first compress all individual ranges into a single + * range, and the size of that compressed range is returned. + */ + SCCOL getPasteColSize(); + + /** + * Same as the above method, but returns the row size of the compressed + * range. + */ + SCROW getPasteRowSize(); + + /** + * Return a single range that encompasses all individual ranges. + */ + ScRange getWholeRange() const; + + void transpose(); +}; + +// ============================================================================ + +struct ScClipRangeNameData +{ + ScRangeData::IndexMap maRangeMap; + ::std::vector<ScRangeData*> mpRangeNames; + bool mbReplace; + + ScClipRangeNameData(); + ~ScClipRangeNameData(); + void insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex); +}; + +#endif diff --git a/sc/inc/collect.hxx b/sc/inc/collect.hxx index 8f6388a86040..dc7778d12da3 100644 --- a/sc/inc/collect.hxx +++ b/sc/inc/collect.hxx @@ -80,7 +80,7 @@ public: ScDataObject* At(USHORT nIndex) const; virtual USHORT IndexOf(ScDataObject* pScDataObject) const; - USHORT GetCount() const { return nCount; } + USHORT GetCount() const; ScDataObject* operator[]( const USHORT nIndex) const {return At(nIndex);} ScCollection& operator=( const ScCollection& rCol ); @@ -192,6 +192,7 @@ public: TypedScStrCollection( const TypedScStrCollection& rCpy ) : ScSortedCollection( rCpy ) { bCaseSensitive = rCpy.bCaseSensitive; } + ~TypedScStrCollection(); virtual ScDataObject* Clone() const; virtual short Compare( ScDataObject* pKey1, ScDataObject* pKey2 ) const; diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 0f446ccc56ef..346e42cf81ad 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -35,6 +35,7 @@ #include "global.hxx" #include "compressedarray.hxx" #include "address.hxx" +#include "rangenam.hxx" #include <tools/solar.h> #include <set> @@ -97,8 +98,6 @@ struct ColEntry }; -class ScIndexMap; - class ScColumn { private: @@ -297,7 +296,7 @@ public: void SetTabNo(SCTAB nNewTab); BOOL IsRangeNameInUse(SCROW nRow1, SCROW nRow2, USHORT nIndex) const; void FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set<USHORT>& rIndexes) const; - void ReplaceRangeNamesInUse( SCROW nRow1, SCROW nRow2, const ScIndexMap& rMap ); + void ReplaceRangeNamesInUse( SCROW nRow1, SCROW nRow2, const ScRangeData::IndexMap& rMap ); const SfxPoolItem* GetAttr( SCROW nRow, USHORT nWhich ) const; const ScPatternAttr* GetPattern( SCROW nRow ) const; diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 76293479660c..c981af2dad18 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -64,7 +64,7 @@ // constants and data types also for external modules (ScInterpreter et al) #define MAXCODE 512 /* maximum number of tokens in formula */ -#define MAXSTRLEN 256 /* maximum length of input string of one symbol */ +#define MAXSTRLEN 1024 /* maximum length of input string of one symbol */ #define MAXJUMPCOUNT 32 /* maximum number of jumps (ocChose) */ // flag values of CharTable @@ -91,6 +91,8 @@ #define SC_COMPILER_C_ODF_RBRACKET 0x00080000 // ODF ']' reference bracket #define SC_COMPILER_C_ODF_LABEL_OP 0x00100000 // ODF '!!' automatic intersection of labels #define SC_COMPILER_C_ODF_NAME_MARKER 0x00200000 // ODF '$$' marker that starts a defined (range) name +#define SC_COMPILER_C_CHAR_NAME 0x00400000 // start character of a defined name +#define SC_COMPILER_C_NAME 0x00800000 // continuation character of a defined name #define SC_COMPILER_FILE_TAB_SEP '#' // 'Doc'#Tab @@ -217,6 +219,14 @@ typedef formula::SimpleIntrusiveReference< struct ScRawToken > ScRawTokenRef; class SC_DLLPUBLIC ScCompiler : public formula::FormulaCompiler { public: + + enum EncodeUrlMode + { + ENCODE_BY_GRAMMAR, + ENCODE_ALWAYS, + ENCODE_NEVER, + }; + struct Convention { const formula::FormulaGrammar::AddressConvention meConv; @@ -313,6 +323,7 @@ private: SCsTAB nMaxTab; // last sheet in document sal_Int32 mnRangeOpPosInSymbol; // if and where a range operator is in symbol const Convention *pConv; + EncodeUrlMode meEncodeUrlMode; bool mbCloseBrackets; // whether to close open brackets automatically, default TRUE bool mbExtendedErrorDetection; bool mbRewind; // whether symbol is to be rewound to some step during lexical analysis @@ -373,6 +384,8 @@ public: void SetGrammar( const formula::FormulaGrammar::Grammar eGrammar ); + void SetEncodeUrlMode( EncodeUrlMode eMode ); + EncodeUrlMode GetEncodeUrlMode() const; private: /** Set grammar and reference convention from within SetFormulaLanguage() or SetGrammar(). @@ -435,28 +448,66 @@ public: BOOL HasModifiedRange(); - /// If the character is allowed as first character in sheet names or references + /** If the character is allowed as first character in sheet names or + references, includes '$' and '?'. */ static inline BOOL IsCharWordChar( String const & rStr, xub_StrLen nPos, const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO ) { sal_Unicode c = rStr.GetChar( nPos ); - return c < 128 ? - static_cast<BOOL>( - (pConventions[eConv]->mpCharTable[ UINT8(c) ] & SC_COMPILER_C_CHAR_WORD) == SC_COMPILER_C_CHAR_WORD) : - ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); + if (c < 128) + { + return pConventions[eConv] ? static_cast<BOOL>( + (pConventions[eConv]->mpCharTable[ UINT8(c) ] & SC_COMPILER_C_CHAR_WORD) == SC_COMPILER_C_CHAR_WORD) : + FALSE; // no convention => assume invalid + } + else + return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); } - /// If the character is allowed in sheet names or references + /** If the character is allowed in sheet names, thus may be part of a + reference, includes '$' and '?' and such. */ static inline BOOL IsWordChar( String const & rStr, xub_StrLen nPos, const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO ) { sal_Unicode c = rStr.GetChar( nPos ); - return c < 128 ? - static_cast<BOOL>( - (pConventions[eConv]->mpCharTable[ UINT8(c) ] & SC_COMPILER_C_WORD) == SC_COMPILER_C_WORD) : - ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); + if (c < 128) + { + return pConventions[eConv] ? static_cast<BOOL>( + (pConventions[eConv]->mpCharTable[ UINT8(c) ] & SC_COMPILER_C_WORD) == SC_COMPILER_C_WORD) : + FALSE; // convention not known => assume invalid + } + else + return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); + } + + /** If the character is allowed as tested by nFlags (SC_COMPILER_C_... + bits) for all known address conventions. If more than one bit is given + in nFlags, all bits must match. If bTestLetterNumeric is FALSE and + char>=128, no LetterNumeric test is done and FALSE is returned. */ + static inline bool IsCharFlagAllConventions( String const & rStr, + xub_StrLen nPos, + ULONG nFlags, + bool bTestLetterNumeric = true ) + { + sal_Unicode c = rStr.GetChar( nPos ); + if (c < 128) + { + for ( int nConv = formula::FormulaGrammar::CONV_UNSPECIFIED; + ++nConv < formula::FormulaGrammar::CONV_LAST; ) + { + if (pConventions[nConv] && + ((pConventions[nConv]->mpCharTable[ UINT8(c) ] & nFlags) != nFlags)) + return false; + // convention not known => assume valid + } + return true; + } + else if (bTestLetterNumeric) + return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); + else + return false; } private: diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx index edfff3c8dc7c..98922c1776b8 100644 --- a/sc/inc/detfunc.hxx +++ b/sc/inc/detfunc.hxx @@ -132,6 +132,7 @@ class SC_DLLPUBLIC ScDetectiveFunc BOOL FindFrameForObject( SdrObject* pObject, ScRange& rRange ); + void Modified(); public: ScDetectiveFunc(ScDocument* pDocument, SCTAB nTable) : pDoc(pDocument),nTab(nTable) {} diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 07a9518e1bf8..87d31f194854 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -136,6 +136,8 @@ class ScLookupCache; struct ScLookupCacheMapImpl; class SfxUndoManager; class ScFormulaParserPool; +struct ScClipParam; +struct ScClipRangeNameData; namespace com { namespace sun { namespace star { namespace lang { @@ -258,7 +260,7 @@ private: ScChartCollection* pChartCollection; std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock; ScPatternAttr* pSelectionAttr; // Attribute eines Blocks - SvxLinkManager* pLinkManager; + mutable SvxLinkManager* pLinkManager; ScFormulaCell* pFormulaTree; // Berechnungsbaum Start ScFormulaCell* pEOFormulaTree; // Berechnungsbaum Ende, letzte Zelle ScFormulaCell* pFormulaTrack; // BroadcastTrack Start @@ -280,6 +282,7 @@ private: ScFieldEditEngine* pCacheFieldEditEngine; ::std::auto_ptr<ScDocProtection> pDocProtection; + ::std::auto_ptr<ScClipParam> mpClipParam; ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr; @@ -306,7 +309,6 @@ private: sal_uInt32 nRangeOverflowType; // used in (xml) loading for overflow warnings - ScRange aClipRange; ScRange aEmbedRange; ScAddress aCurTextWidthCalcPos; ScAddress aOnlineSpellPos; // within whole document @@ -356,7 +358,6 @@ private: BOOL bForcedFormulaPending; BOOL bCalculatingFormulaTree; BOOL bIsClip; - BOOL bCutMode; BOOL bIsUndo; BOOL bIsVisible; // set from view ctor @@ -411,6 +412,7 @@ private: bool mbAdjustHeightEnabled; bool mbExecuteLinkEnabled; bool mbChangeReadOnlyEnabled; // allow changes in read-only document (for API import filters) + bool mbStreamValidLocked; sal_Int16 mnNamedRangesLockCount; @@ -439,7 +441,7 @@ public: SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL ); XColorTable* GetColorTable(); - SvxLinkManager* GetLinkManager() { return pLinkManager; } + SC_DLLPUBLIC SvxLinkManager* GetLinkManager() const; SC_DLLPUBLIC const ScDocOptions& GetDocOptions() const; SC_DLLPUBLIC void SetDocOptions( const ScDocOptions& rOpt ); @@ -511,7 +513,7 @@ public: ::com::sun::star::embed::XEmbeddedObject > FindOleObjectByName( const String& rName ); - SC_DLLPUBLIC void MakeTable( SCTAB nTab ); + SC_DLLPUBLIC void MakeTable( SCTAB nTab,bool _bNeedsNameCheck = true ); SCTAB GetVisibleTab() const { return nVisibleTab; } SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab) { nVisibleTab = nTab; } @@ -571,6 +573,10 @@ public: SC_DLLPUBLIC void TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos); SC_DLLPUBLIC void SetVisible( SCTAB nTab, BOOL bVisible ); SC_DLLPUBLIC BOOL IsVisible( SCTAB nTab ) const; + BOOL IsStreamValid( SCTAB nTab ) const; + void SetStreamValid( SCTAB nTab, BOOL bSet, BOOL bIgnoreLock = FALSE ); + void LockStreamValid( bool bLock ); + bool IsStreamValidLocked() const { return mbStreamValidLocked; } BOOL IsPendingRowHeights( SCTAB nTab ) const; void SetPendingRowHeights( SCTAB nTab, BOOL bSet ); SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, BOOL bRTL ); @@ -604,8 +610,8 @@ public: const String& aFileName, const String& aTabName ); - bool HasExternalRefManager() { return pExternalRefMgr.get(); } - SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager(); + bool HasExternalRefManager() const { return pExternalRefMgr.get(); } + SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager() const; bool IsInExternalReferenceMarking() const; void MarkUsedExternalReferences(); bool MarkUsedExternalReferences( ScTokenArray & rArr ); @@ -826,6 +832,7 @@ public: void SetDirty(); void SetDirty( const ScRange& ); void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp + void InterpretDirtyCells( const ScRangeList& rRanges ); void CalcAll(); SC_DLLPUBLIC void CalcAfterLoad(); void CompileAll(); @@ -957,12 +964,11 @@ public: void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, USHORT nDelFlag); void DeleteAreaTab(const ScRange& rRange, USHORT nDelFlag); - void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - BOOL bCut, ScDocument* pClipDoc, BOOL bAllTabs, - const ScMarkData* pMarks = NULL, - BOOL bKeepScenarioFlags = FALSE, - BOOL bIncludeObjects = FALSE, - BOOL bCloneNoteCaptions = TRUE); + + void CopyToClip(const ScClipParam& rClipParam, ScDocument* pClipDoc, + const ScMarkData* pMarks = NULL, bool bAllTabs = false, bool bKeepScenarioFlags = false, + bool bIncludeObjects = false, bool bCloneNoteCaptions = true); + void CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, ScDocument* pClipDoc = NULL); void CopyBlockFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, @@ -990,6 +996,12 @@ public: BOOL bSkipAttrForEmpty = FALSE, const ScRangeList * pDestRanges = NULL ); + void CopyMultiRangeFromClip(const ScAddress& rDestPos, const ScMarkData& rMark, + sal_uInt16 nInsFlag, ScDocument* pClipDoc, + bool bResetCut = true, bool bAsLink = false, + bool bIncludeFiltered = true, + bool bSkipAttrForEmpty = false); + void GetClipArea(SCCOL& nClipX, SCROW& nClipY, BOOL bIncludeFiltered); void GetClipStart(SCCOL& nClipX, SCROW& nClipY); @@ -999,6 +1011,9 @@ public: SC_DLLPUBLIC void TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsLink ); + ScClipParam& GetClipParam(); + void SetClipParam(const ScClipParam& rParam); + void MixDocument( const ScRange& rRange, USHORT nFunction, BOOL bSkipEmpty, ScDocument* pSrcDoc ); @@ -1696,6 +1711,23 @@ public: SfxUndoManager* GetUndoManager(); private: // CLOOK-Impl-Methoden + /** + * Use this class as a locale variable to merge number formatter from + * another document, and set NULL pointer to pFormatExchangeList when + * done. + */ + class NumFmtMergeHandler + { + public: + explicit NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc); + ~NumFmtMergeHandler(); + + private: + ScDocument* mpDoc; + }; + + void MergeNumberFormatter(ScDocument* pSrcDoc); + void ImplCreateOptions(); // bei Gelegenheit auf on-demand umstellen? void ImplDeleteOptions(); @@ -1717,6 +1749,12 @@ private: // CLOOK-Impl-Methoden void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode, const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs); + void CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames); + void UpdateRangeNamesInFormulas( + ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark, + SCCOL nXw, SCROW nYw); + BOOL HasPartOfMerged( const ScRange& rRange ); std::map< SCTAB, ScSortParam > mSheetSortParams; diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index c4b6413c7d58..0d69c9f68670 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -75,6 +75,7 @@ class ScTableSheetObj; class SvxFmDrawPage; class SvxDrawPage; class ScRangeList; +class ScSheetSaveData; class SC_DLLPUBLIC ScModelObj : public SfxBaseModel, public com::sun::star::sheet::XSpreadsheetDocument, @@ -110,6 +111,7 @@ private: BOOL FillRenderMarkData( const com::sun::star::uno::Any& aSelection, ScMarkData& rMark, ScPrintSelectionStatus& rStatus ) const; + com::sun::star::uno::Reference<com::sun::star::uno::XAggregation> GetFormatter(); rtl::OUString maBuildId; protected: @@ -129,6 +131,7 @@ public: void BeforeXMLLoading(); void AfterXMLLoading(sal_Bool bRet); + ScSheetSaveData* GetSheetSaveData(); bool HasChangesListeners() const; diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx index 9b12dba52f1f..bf795f04fe1c 100644 --- a/sc/inc/externalrefmgr.hxx +++ b/sc/inc/externalrefmgr.hxx @@ -422,10 +422,13 @@ public: /** Source document meta-data container. */ struct SrcFileData { - String maFileName; + String maFileName; /// original file name as loaded from the file. + String maRealFileName; /// file name created from the relative name. String maRelativeName; String maFilterName; String maFilterOptions; + + void maybeCreateRealFileName(const String& rOwnDocName); }; public: @@ -576,7 +579,21 @@ public: */ void convertToAbsName(String& rFile) const; sal_uInt16 getExternalFileId(const String& rFile); - const String* getExternalFileName(sal_uInt16 nFileId) const; + + /** + * It returns a pointer to the name of the URI associated with a given + * external file ID. In case the original document has moved, it returns + * an URI adjusted for the relocation. + * + * @param nFileId file ID for an external document + * @param bForceOriginal If true, it always returns the original document + * URI even if the referring document has relocated. + * If false, it returns an URI adjusted for + * relocated document. + * + * @return const String* external document URI. + */ + const String* getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal = false); bool hasExternalFile(sal_uInt16 nFileId) const; bool hasExternalFile(const String& rFile) const; const SrcFileData* getExternalFileData(sal_uInt16 nFileId) const; @@ -585,8 +602,15 @@ public: const String* getRealRangeName(sal_uInt16 nFileId, const String& rRangeName) const; void refreshNames(sal_uInt16 nFileId); void breakLink(sal_uInt16 nFileId); - void switchSrcFile(sal_uInt16 nFileId, const String& rNewFile); + void switchSrcFile(sal_uInt16 nFileId, const String& rNewFile, const String& rNewFilter); + /** + * Set a relative file path for the specified file ID. Note that the + * caller must ensure that the passed URL is a valid relative URL. + * + * @param nFileId file ID for an external document + * @param rRelUrl relative URL + */ void setRelativeFileName(sal_uInt16 nFileId, const String& rRelUrl); /** @@ -607,8 +631,11 @@ public: * Re-generates relative names for all stored source files. This is * necessary when exporting to an ods document, to ensure that all source * files have their respective relative names for xlink:href export. + * + * @param rBaseFileUrl Absolute URL of the content.xml fragment of the + * document being exported. */ - void resetSrcFileData(); + void resetSrcFileData(const String& rBaseFileUrl); /** * Update a single referencing cell position. @@ -675,6 +702,19 @@ private: void maybeLinkExternalFile(sal_uInt16 nFileId); + /** + * Try to create a "real" file name from the relative path. The original + * file name may not point to the real document when the referencing and + * referenced documents have been moved. + * + * For the real file name to be created, the relative name should not be + * empty before calling this method, or the real file name will not be + * created. + * + * @param nFileId file ID for an external document + */ + void maybeCreateRealFileName(sal_uInt16 nFileId); + bool compileTokensByCell(const ScAddress& rCell); /** diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 9aa264e38931..4028c69adc80 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -541,9 +541,15 @@ class ScGlobal static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XOrdinalSuffix> xOrdinalSuffix; + static CalendarWrapper* pCalendar; + static CollatorWrapper* pCaseCollator; + static CollatorWrapper* pCollator; + static ::utl::TransliterationWrapper* pTransliteration; + static ::utl::TransliterationWrapper* pCaseTransliteration; + static IntlWrapper* pScIntlWrapper; + static ::com::sun::star::lang::Locale* pLocale; public: - static ::com::sun::star::lang::Locale* pLocale; static SvtSysLocale* pSysLocale; // for faster access a pointer to the single instance provided by SvtSysLocale SC_DLLPUBLIC static const CharClass* pCharClass; @@ -551,15 +557,15 @@ public: SC_DLLPUBLIC static const LocaleDataWrapper* pLocaleData; SC_DLLPUBLIC static const LocaleDataWrapper* GetpLocaleData(); - static CalendarWrapper* pCalendar; - SC_DLLPUBLIC static CollatorWrapper* pCollator; - static CollatorWrapper* pCaseCollator; + static CalendarWrapper* GetCalendar(); + SC_DLLPUBLIC static CollatorWrapper* GetCollator(); + static CollatorWrapper* GetCaseCollator(); + static IntlWrapper* GetScIntlWrapper(); + static ::com::sun::star::lang::Locale* GetLocale(); - static ::utl::TransliterationWrapper* pTransliteration; SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration(); //CHINA001 + static ::utl::TransliterationWrapper* GetCaseTransliteration(); - static ::utl::TransliterationWrapper* pCaseTransliteration; - static IntlWrapper* pScIntlWrapper; SC_DLLPUBLIC static LanguageType eLnge; static sal_Unicode cListDelimiter; diff --git a/sc/inc/indexmap.hxx b/sc/inc/indexmap.hxx deleted file mode 100644 index 4db5deb78d4e..000000000000 --- a/sc/inc/indexmap.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: indexmap.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SC_INDEXMAP_HXX -#define _SC_INDEXMAP_HXX - - -#include <tools/solar.h> - - -class ScIndexMap -{ - // not implemented - ScIndexMap( const ScIndexMap& ); - ScIndexMap& operator=( const ScIndexMap& ); - -private: - USHORT* pMap; - USHORT nCount; - -public: - ScIndexMap( USHORT nEntries ); - ~ScIndexMap(); - - void SetPair( USHORT nEntry, USHORT nIndex1, USHORT nIndex2 ); - /// returns nIndex2 if found, else nIndex1 - USHORT Find( USHORT nIndex1 ) const; -}; - - -#endif // _SC_INDEXMAP_HXX - diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx index 2c6f706ff403..9963cf65c895 100644 --- a/sc/inc/rangenam.hxx +++ b/sc/inc/rangenam.hxx @@ -37,6 +37,8 @@ #include "formula/grammar.hxx" #include "scdllapi.h" +#include <map> + //------------------------------------------------------------------------ class ScDocument; @@ -65,7 +67,6 @@ typedef USHORT RangeType; //------------------------------------------------------------------------ class ScTokenArray; -class ScIndexMap; class ScRangeData : public ScDataObject { @@ -87,6 +88,8 @@ private: friend class ScRangeName; ScRangeData( USHORT nIndex ); public: + typedef ::std::map<sal_uInt16, sal_uInt16> IndexMap; + SC_DLLPUBLIC ScRangeData( ScDocument* pDoc, const String& rName, const String& rSymbol, @@ -152,7 +155,7 @@ public: void ValidateTabRefs(); - void ReplaceRangeNamesInUse( const ScIndexMap& rMap ); + void ReplaceRangeNamesInUse( const IndexMap& rMap ); static void MakeValidName( String& rName ); SC_DLLPUBLIC static BOOL IsNameValid( const String& rName, ScDocument* pDoc ); diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 8fb6b929337b..375eebe30964 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -675,7 +675,6 @@ #define FILE_MENU_END (SC_FUNCTION_START + 20) #define EDIT_MENU_START (FILE_MENU_END) -#define FID_PASTE_CONTENTS (EDIT_MENU_START) #define FID_DELETE_CELLCONTENTS (EDIT_MENU_START + 1) #define FID_DELETE_CELL (EDIT_MENU_START + 2) #define FID_DELETE_TABLE (EDIT_MENU_START + 3) @@ -856,8 +855,6 @@ #define RID_INPUTBAR_END (RID_INPUTBAR_START+1) #define DRAW_BAR_START (RID_INPUTBAR_END) -//! SID_OBJECT_MIRROR wird sicher mal allgemein -#define SID_OBJECT_MIRROR (DRAW_BAR_START) #define SID_DRAWTOABOVE (DRAW_BAR_START+15) #define SID_DRAWTOBELOW (DRAW_BAR_START+16) //#define SID_GROUP (DRAW_BAR_START+17) @@ -1106,10 +1103,6 @@ #define SID_DELETE_SCENARIO (SID_NEW_SLOTS+95) #define SID_EDIT_SCENARIO (SID_NEW_SLOTS+96) -#define SID_GET_CLPBRD_FORMAT_COUNT (SID_NEW_SLOTS+97) -#define SID_GET_CLPBRD_FORMAT_BY_IDX (SID_NEW_SLOTS+98) -#define SID_GET_CLPBRD_FORMAT_NAME (SID_NEW_SLOTS+99) - // idl Parameter --------------------------------------------------------- //aus sfx: #define FN_PARAM_1 (SC_PARAM_START) diff --git a/sc/inc/sheetdata.hxx b/sc/inc/sheetdata.hxx new file mode 100644 index 000000000000..63853f6bc675 --- /dev/null +++ b/sc/inc/sheetdata.hxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sheetdata.hxx,v $ + * $Revision: 1.16.32.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SC_SHEETDATA_HXX +#define SC_SHEETDATA_HXX + +#include <xmloff/maptype.hxx> +#include <svx/editdata.hxx> +#include <vector> +#include <hash_set> + +#include "address.hxx" + +class ScAddress; +class SvXMLNamespaceMap; + + +struct ScStreamEntry +{ + sal_Int32 mnStartOffset; + sal_Int32 mnEndOffset; + + ScStreamEntry() : + mnStartOffset(-1), + mnEndOffset(-1) + { + } + + ScStreamEntry( sal_Int32 nStart, sal_Int32 nEnd ) : + mnStartOffset(nStart), + mnEndOffset(nEnd) + { + } +}; + +struct ScCellStyleEntry +{ + rtl::OUString maName; + ScAddress maCellPos; + + ScCellStyleEntry( const rtl::OUString& rName, const ScAddress& rPos ) : + maName(rName), + maCellPos(rPos) + { + } +}; + +struct ScNoteStyleEntry +{ + rtl::OUString maStyleName; + rtl::OUString maTextStyle; + ScAddress maCellPos; + + ScNoteStyleEntry( const rtl::OUString& rStyle, const rtl::OUString& rText, const ScAddress& rPos ) : + maStyleName(rStyle), + maTextStyle(rText), + maCellPos(rPos) + { + } +}; + +struct ScTextStyleEntry +{ + rtl::OUString maName; + ScAddress maCellPos; + ESelection maSelection; + + ScTextStyleEntry( const rtl::OUString& rName, const ScAddress& rPos, const ESelection& rSel ) : + maName(rName), + maCellPos(rPos), + maSelection(rSel) + { + } +}; + +struct ScLoadedNamespaceEntry +{ + rtl::OUString maPrefix; + rtl::OUString maName; + sal_uInt16 mnKey; + + ScLoadedNamespaceEntry( const rtl::OUString& rPrefix, const rtl::OUString& rName, sal_uInt16 nKey ) : + maPrefix(rPrefix), + maName(rName), + mnKey(nKey) + { + } +}; + +class ScSheetSaveData +{ + std::hash_set<rtl::OUString, rtl::OUStringHash> maInitialPrefixes; + std::vector<ScLoadedNamespaceEntry> maLoadedNamespaces; + + std::vector<ScCellStyleEntry> maCellStyles; + std::vector<ScCellStyleEntry> maColumnStyles; + std::vector<ScCellStyleEntry> maRowStyles; + std::vector<ScCellStyleEntry> maTableStyles; + std::vector<ScNoteStyleEntry> maNoteStyles; + std::vector<ScTextStyleEntry> maNoteParaStyles; + std::vector<ScTextStyleEntry> maNoteTextStyles; + std::vector<ScTextStyleEntry> maTextStyles; + std::vector<bool> maBlocked; + std::vector<ScStreamEntry> maStreamEntries; + std::vector<ScStreamEntry> maSaveEntries; + sal_Int32 mnStartTab; + sal_Int32 mnStartOffset; + + ScNoteStyleEntry maPreviousNote; + +public: + ScSheetSaveData(); + ~ScSheetSaveData(); + + void AddCellStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + void AddColumnStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + void AddRowStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + void AddTableStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + + void HandleNoteStyles( const rtl::OUString& rStyleName, const rtl::OUString& rTextName, const ScAddress& rCellPos ); + void AddNoteContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection ); + + void AddTextStyle( const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection ); + + void BlockSheet( sal_Int32 nTab ); + bool IsSheetBlocked( sal_Int32 nTab ) const; + + void AddStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset ); + void GetStreamPos( sal_Int32 nTab, sal_Int32& rStartOffset, sal_Int32& rEndOffset ) const; + bool HasStreamPos( sal_Int32 nTab ) const; + + void StartStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset ); + void EndStreamPos( sal_Int32 nEndOffset ); + + bool HasStartPos() const { return mnStartTab >= 0; } + + void ResetSaveEntries(); + void AddSavePos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset ); + void UseSaveEntries(); + + void StoreInitialNamespaces( const SvXMLNamespaceMap& rNamespaces ); + void StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespaces ); + bool AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) const; + + const std::vector<ScCellStyleEntry>& GetCellStyles() const { return maCellStyles; } + const std::vector<ScCellStyleEntry>& GetColumnStyles() const { return maColumnStyles; } + const std::vector<ScCellStyleEntry>& GetRowStyles() const { return maRowStyles; } + const std::vector<ScCellStyleEntry>& GetTableStyles() const { return maTableStyles; } + const std::vector<ScNoteStyleEntry>& GetNoteStyles() const { return maNoteStyles; } + const std::vector<ScTextStyleEntry>& GetNoteParaStyles() const { return maNoteParaStyles; } + const std::vector<ScTextStyleEntry>& GetNoteTextStyles() const { return maNoteTextStyles; } + const std::vector<ScTextStyleEntry>& GetTextStyles() const { return maTextStyles; } +}; + +#endif + diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 86da430638ec..08521f83b54b 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -71,7 +71,6 @@ class ScStyleSheet; class ScTableLink; class ScTableProtection; class ScUserListData; -class ScIndexMap; struct RowInfo; struct ScFunctionData; struct ScLineFlags; @@ -127,6 +126,7 @@ private: // interne Verwaltung ------------------ BOOL bVisible; + BOOL bStreamValid; BOOL bPendingRowHeights; SCTAB nTab; @@ -193,6 +193,9 @@ public: BOOL IsVisible() const { return bVisible; } void SetVisible( BOOL bVis ); + BOOL IsStreamValid() const { return bStreamValid; } + void SetStreamValid( BOOL bSet, BOOL bIgnoreLock = FALSE ); + BOOL IsPendingRowHeights() const { return bPendingRowHeights; } void SetPendingRowHeights( BOOL bSet ); @@ -318,6 +321,8 @@ public: void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nDelFlag); void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable, BOOL bKeepScenarioFlags, BOOL bCloneNoteCaptions); + void CopyToClip(const ScRangeList& rRanges, ScTable* pTable, + bool bKeepScenarioFlags, bool bCloneNoteCaptions); void CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, USHORT nInsFlag, BOOL bAsLink, BOOL bSkipAttrForEmpty, ScTable* pTable); void StartListeningInArea( SCCOL nCol1, SCROW nRow1, @@ -435,7 +440,7 @@ public: void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, std::set<USHORT>& rIndexes) const; void ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - const ScIndexMap& rMap ); + const ScRangeData::IndexMap& rMap ); void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ULONG nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, double nStepValue, double nMaxValue); @@ -726,7 +731,7 @@ private: BOOL GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, BOOL bInSel, const ScMarkData& rMark) const; BOOL GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ); - void SetDrawPageSize(); + void SetDrawPageSize(bool bResetStreamValid = true); BOOL TestTabRefAbs(SCTAB nTable); void CompileDBFormula(); void CompileDBFormula( BOOL bCreateFormulaString ); diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx index fdad032b8300..8ec7707874be 100644 --- a/sc/inc/textuno.hxx +++ b/sc/inc/textuno.hxx @@ -259,6 +259,8 @@ public: ScCellTextCursor(ScCellObj& rText); virtual ~ScCellTextCursor() throw(); + ScCellObj& GetCellObj() const { return rTextObj; } + // SvxUnoTextCursor methods reimplemented here: virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException); @@ -324,6 +326,15 @@ public: getStart() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScDrawTextCursor* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface> xObj ); }; |