Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_CELL_HXX
30 : : #define SC_CELL_HXX
31 : :
32 : : #include <stddef.h>
33 : :
34 : : #include <set>
35 : : #include <vector>
36 : : #include <boost/shared_ptr.hpp>
37 : :
38 : : #include <tools/mempool.hxx>
39 : : #include <svl/listener.hxx>
40 : : #include "global.hxx"
41 : : #include "rangenam.hxx"
42 : : #include "formula/grammar.hxx"
43 : : #include "tokenarray.hxx"
44 : : #include "formularesult.hxx"
45 : : #include <rtl/ustrbuf.hxx>
46 : : #include <unotools/fontcvt.hxx>
47 : : #include "scdllapi.h"
48 : :
49 : : #define USE_MEMPOOL
50 : : #define TEXTWIDTH_DIRTY 0xffff
51 : :
52 : : // in addition to SCRIPTTYPE_... flags from scripttypeitem.hxx:
53 : : // set (in nScriptType) if type has not been determined yet
54 : : #define SC_SCRIPTTYPE_UNKNOWN 0x08
55 : :
56 : : class ScDocument;
57 : : class EditTextObject;
58 : : class ScMatrix;
59 : : class SvtBroadcaster;
60 : : class ScProgress;
61 : : class ScPatternAttr;
62 : :
63 : : // ============================================================================
64 : :
65 : : /** Default cell clone flags: do not start listening, do not adjust 3D refs to
66 : : old position, clone note captions of cell notes. */
67 : : const int SC_CLONECELL_DEFAULT = 0x0000;
68 : :
69 : : /** If set, cloned formula cells will start to listen to the document. */
70 : : const int SC_CLONECELL_STARTLISTENING = 0x0001;
71 : :
72 : : /** If set, relative 3D references of cloned formula cells will be adjusted to
73 : : old position (used while swapping cells for sorting a cell range). */
74 : : const int SC_CLONECELL_ADJUST3DREL = 0x0002;
75 : :
76 : : /** If set, the caption object of a cell note will not be cloned (used while
77 : : copying cells to undo document, where captions are handled in drawing undo). */
78 : : const int SC_CLONECELL_NOCAPTION = 0x0004;
79 : :
80 : : /** If set, absolute refs will not transformed to external references */
81 : : const int SC_CLONECELL_NOMAKEABS_EXTERNAL = 0x0008;
82 : : // ============================================================================
83 : :
84 : : class SC_DLLPUBLIC ScBaseCell
85 : : {
86 : : protected:
87 : : ~ScBaseCell(); // not virtual - not to be called directly.
88 : :
89 : : public:
90 : : explicit ScBaseCell( CellType eNewType );
91 : :
92 : : /** Base copy constructor. Does NOT clone cell note or broadcaster! */
93 : : ScBaseCell( const ScBaseCell& rCell );
94 : :
95 : : /** Returns a clone of this cell at the same position,
96 : : broadcaster will not be cloned. */
97 : : ScBaseCell* Clone( ScDocument& rDestDoc, int nCloneFlags = SC_CLONECELL_DEFAULT ) const;
98 : :
99 : : /** Returns a clone of this cell for the passed document position,
100 : : broadcaster will not be cloned. */
101 : : ScBaseCell* Clone( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags = SC_CLONECELL_DEFAULT ) const;
102 : :
103 : : /** Due to the fact that ScBaseCell does not have a vtable, this function
104 : : deletes the cell by calling the appropriate d'tor of the derived class. */
105 : : void Delete();
106 : :
107 : 677669 : inline CellType GetCellType() const { return (CellType)eCellType; }
108 : :
109 : : /** Returns true, if the cell is empty (neither value nor formula nor cell note).
110 : : Returns false for formula cells returning nothing, use HasEmptyData() for that. */
111 : : bool IsBlank() const;
112 : :
113 : : // for idle-calculations
114 : 8367 : inline sal_uInt16 GetTextWidth() const { return nTextWidth; }
115 : 14180 : inline void SetTextWidth( sal_uInt16 nNew ) { nTextWidth = nNew; }
116 : :
117 : 128579 : inline sal_uInt8 GetScriptType() const { return nScriptType; }
118 : 37740 : inline void SetScriptType( sal_uInt8 nNew ) { nScriptType = nNew; }
119 : :
120 : : /** Returns true, if the cell contains a broadcaster. */
121 : 630 : inline bool HasBroadcaster() const { return mpBroadcaster != 0; }
122 : : /** Returns the pointer to the cell broadcaster. */
123 : 42993 : inline SvtBroadcaster* GetBroadcaster() const { return mpBroadcaster; }
124 : : /** Takes ownership of the passed cell broadcaster. */
125 : : void TakeBroadcaster( SvtBroadcaster* pBroadcaster );
126 : : /** Returns and forgets the own cell broadcaster. Caller takes ownership! */
127 : : SvtBroadcaster* ReleaseBroadcaster();
128 : : /** Deletes the own cell broadcaster. */
129 : : void DeleteBroadcaster();
130 : :
131 : : // String- oder EditCell
132 : : static ScBaseCell* CreateTextCell( const rtl::OUString& rString, ScDocument* );
133 : :
134 : : // nOnlyNames may be one or more of SC_LISTENING_NAMES_*
135 : : void StartListeningTo( ScDocument* pDoc );
136 : : void EndListeningTo( ScDocument* pDoc,
137 : : ScTokenArray* pArr = NULL,
138 : : ScAddress aPos = ScAddress() );
139 : :
140 : : /** Error code if ScFormulaCell, else 0. */
141 : : sal_uInt16 GetErrorCode() const;
142 : : /** ScFormulaCell with formula::svEmptyCell result, or ScNoteCell (may have been
143 : : created due to reference to empty cell). */
144 : : bool HasEmptyData() const;
145 : : bool HasValueData() const;
146 : : bool HasStringData() const;
147 : : rtl::OUString GetStringData() const; // only real strings
148 : :
149 : : static bool CellEqual( const ScBaseCell* pCell1, const ScBaseCell* pCell2 );
150 : :
151 : : private:
152 : : ScBaseCell& operator=( const ScBaseCell& );
153 : :
154 : : private:
155 : : SvtBroadcaster* mpBroadcaster; /// Broadcaster for changed values. Cell takes ownership!
156 : :
157 : : protected:
158 : : sal_uInt16 nTextWidth;
159 : : sal_uInt8 eCellType; // enum CellType - sal_uInt8 spart Speicher
160 : : sal_uInt8 nScriptType;
161 : : };
162 : :
163 : : // ============================================================================
164 : :
165 : 871 : class SC_DLLPUBLIC ScNoteCell : public ScBaseCell
166 : : {
167 : : public:
168 : : #ifdef USE_MEMPOOL
169 [ + - ][ + - ]: 1799 : DECL_FIXEDMEMPOOL_NEWDEL( ScNoteCell )
170 : : #endif
171 : :
172 : : /** Cell takes ownership of the passed broadcaster. */
173 : : explicit ScNoteCell( SvtBroadcaster* pBC = 0 );
174 : :
175 : : #if OSL_DEBUG_LEVEL > 0
176 : : ~ScNoteCell();
177 : : #endif
178 : :
179 : : private:
180 : : ScNoteCell( const ScNoteCell& );
181 : : };
182 : :
183 : 43359 : class SC_DLLPUBLIC ScValueCell : public ScBaseCell
184 : : {
185 : : public:
186 : : #ifdef USE_MEMPOOL
187 [ + - ][ + - ]: 80509 : DECL_FIXEDMEMPOOL_NEWDEL( ScValueCell )
188 : : #endif
189 : :
190 : : explicit ScValueCell( double fValue );
191 : :
192 : : #if OSL_DEBUG_LEVEL > 0
193 : : ~ScValueCell();
194 : : #endif
195 : :
196 : 120 : inline void SetValue( double fValue ) { mfValue = fValue; }
197 : 75072 : inline double GetValue() const { return mfValue; }
198 : :
199 : : private:
200 : : double mfValue;
201 : : };
202 : :
203 : 13677 : class SC_DLLPUBLIC ScStringCell : public ScBaseCell
204 : : {
205 : : public:
206 : : #ifdef USE_MEMPOOL
207 [ + - ][ + - ]: 23297 : DECL_FIXEDMEMPOOL_NEWDEL( ScStringCell )
208 : : #endif
209 : :
210 : : explicit ScStringCell(const rtl::OUString& rString);
211 : :
212 : : #if OSL_DEBUG_LEVEL > 0
213 : : ~ScStringCell();
214 : : #endif
215 : :
216 : : inline void SetString( const rtl::OUString& rString ) { maString = rString; }
217 : 28695 : inline const rtl::OUString& GetString() const { return maString; }
218 : :
219 : : private:
220 : : rtl::OUString maString;
221 : : };
222 : :
223 : : class SC_DLLPUBLIC ScEditCell : public ScBaseCell
224 : : {
225 : : private:
226 : : EditTextObject* pData;
227 : : mutable rtl::OUString* pString; // for faster access to formulas
228 : : ScDocument* pDoc; // for EditEngine access with Pool
229 : :
230 : : void SetTextObject( const EditTextObject* pObject,
231 : : const SfxItemPool* pFromPool );
232 : :
233 : : // not implemented
234 : : ScEditCell( const ScEditCell& );
235 : :
236 : : public:
237 : :
238 : : #ifdef USE_MEMPOOL
239 [ + - ][ + - ]: 1690 : DECL_FIXEDMEMPOOL_NEWDEL( ScEditCell )
240 : : #endif
241 : :
242 : : ~ScEditCell(); // always because of pData!
243 : :
244 : : ScEditCell( const EditTextObject* pObject, ScDocument*,
245 : : const SfxItemPool* pFromPool /* = NULL */ );
246 : : ScEditCell(const ScEditCell& rCell, ScDocument& rDoc, const ScAddress& rDestPos);
247 : : // for line breaks
248 : : ScEditCell( const rtl::OUString& rString, ScDocument* );
249 : :
250 : : void SetData( const EditTextObject* pObject,
251 : : const SfxItemPool* pFromPool /* = NULL */ );
252 : : void GetData( const EditTextObject*& rpObject ) const;
253 : : rtl::OUString GetString() const;
254 : :
255 : 905 : const EditTextObject* GetData() const { return pData; }
256 : :
257 : : /** Removes character attribute based on new pattern attributes. */
258 : : void RemoveCharAttribs( const ScPatternAttr& rAttr );
259 : :
260 : : /** Update field items if any. */
261 : : void UpdateFields(SCTAB nTab);
262 : : };
263 : :
264 : : class ScEditDataArray
265 : : {
266 : : public:
267 [ # # ]: 0 : class Item
268 : : {
269 : : public:
270 : : explicit Item(SCTAB nTab, SCCOL nCol, SCROW nRow,
271 : : EditTextObject* pOldData, EditTextObject* pNewData);
272 : : ~Item();
273 : :
274 : : const EditTextObject* GetOldData() const;
275 : : const EditTextObject* GetNewData() const;
276 : : SCTAB GetTab() const;
277 : : SCCOL GetCol() const;
278 : : SCROW GetRow() const;
279 : :
280 : : private:
281 : : Item(); // disabled
282 : :
283 : : private:
284 : : ::boost::shared_ptr<EditTextObject> mpOldData;
285 : : ::boost::shared_ptr<EditTextObject> mpNewData;
286 : : SCTAB mnTab;
287 : : SCCOL mnCol;
288 : : SCROW mnRow;
289 : :
290 : : };
291 : :
292 : : ScEditDataArray();
293 : : ~ScEditDataArray();
294 : :
295 : : void AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow,
296 : : EditTextObject* pOldData, EditTextObject* pNewData);
297 : :
298 : : const Item* First();
299 : : const Item* Next();
300 : :
301 : : private:
302 : : ::std::vector<Item>::const_iterator maIter;
303 : : ::std::vector<Item> maArray;
304 : : };
305 : :
306 : : enum ScMatrixMode {
307 : : MM_NONE = 0, // No matrix formula
308 : : MM_FORMULA = 1, // Upper left matrix formula cell
309 : : MM_REFERENCE = 2, // Remaining cells, via ocMatRef reference token
310 : : MM_FAKE = 3 // Interpret "as-if" matrix formula (legacy)
311 : : };
312 : :
313 : : class SC_DLLPUBLIC ScFormulaCell : public ScBaseCell, public SvtListener
314 : : {
315 : : private:
316 : : ScFormulaResult aResult;
317 : : formula::FormulaGrammar::Grammar eTempGrammar; // used between string (creation) and (re)compilation
318 : : ScTokenArray* pCode; // The (new) token array
319 : : ScDocument* pDocument;
320 : : ScFormulaCell* pPrevious;
321 : : ScFormulaCell* pNext;
322 : : ScFormulaCell* pPreviousTrack;
323 : : ScFormulaCell* pNextTrack;
324 : : sal_uLong nFormatIndex; // Number format set by calculation
325 : : short nFormatType; // Number format type set by calculation
326 : : sal_uInt16 nSeenInIteration; // Iteration cycle in which the cell was last encountered
327 : : sal_uInt8 cMatrixFlag; // One of ScMatrixMode
328 : : bool bDirty : 1; // Must be (re)calculated
329 : : bool bChanged : 1; // Whether something changed regarding display/representation
330 : : bool bRunning : 1; // Already interpreting right now
331 : : bool bCompile : 1; // Must be (re)compiled
332 : : bool bSubTotal : 1; // Cell is part of or contains a SubTotal
333 : : bool bIsIterCell : 1; // Cell is part of a circular reference
334 : : bool bInChangeTrack : 1; // Cell is in ChangeTrack
335 : : bool bTableOpDirty : 1; // Dirty flag for TableOp
336 : : bool bNeedListening : 1; // Listeners need to be re-established after UpdateReference
337 : :
338 : : enum ScInterpretTailParameter
339 : : {
340 : : SCITP_NORMAL,
341 : : SCITP_FROM_ITERATION,
342 : : SCITP_CLOSE_ITERATION_CIRCLE
343 : : };
344 : : void InterpretTail( ScInterpretTailParameter );
345 : :
346 : : ScFormulaCell( const ScFormulaCell& );
347 : :
348 : : public:
349 : :
350 : : #ifdef USE_MEMPOOL
351 [ + - ][ + - ]: 7938 : DECL_FIXEDMEMPOOL_NEWDEL( ScFormulaCell )
352 : : #endif
353 : :
354 : : ScAddress aPos;
355 : :
356 : : ~ScFormulaCell();
357 : :
358 : : /** Empty formula cell, or with a preconstructed token array. */
359 : : ScFormulaCell( ScDocument*, const ScAddress&, const ScTokenArray* = NULL,
360 : : const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT,
361 : : sal_uInt8 = MM_NONE );
362 : :
363 : : /** With formula string and grammar to compile with.
364 : : formula::FormulaGrammar::GRAM_DEFAULT effectively isformula::FormulaGrammar::GRAM_NATIVE_UI that
365 : : also includes formula::FormulaGrammar::CONV_UNSPECIFIED, therefor uses the address
366 : : convention associated with rPos::nTab by default. */
367 : : ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
368 : : const rtl::OUString& rFormula,
369 : : const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT,
370 : : sal_uInt8 cMatInd = MM_NONE );
371 : :
372 : : ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, const ScAddress& rPos, int nCloneFlags = SC_CLONECELL_DEFAULT );
373 : :
374 : : void GetFormula( rtl::OUString& rFormula,
375 : : const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
376 : : void GetFormula( rtl::OUStringBuffer& rBuffer,
377 : : const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
378 : :
379 : : void SetDirty();
380 : : void SetDirtyVar();
381 : : // If setting entire document dirty after load, no broadcasts but still append to FormulaTree.
382 : : void SetDirtyAfterLoad();
383 : 874 : inline void ResetTableOpDirtyVar() { bTableOpDirty = false; }
384 : : void SetTableOpDirty();
385 : : bool IsDirtyOrInTableOpDirty() const;
386 : 2532 : bool GetDirty() const { return bDirty; }
387 : 1295 : void ResetDirty() { bDirty = false; }
388 : 15 : bool NeedsListening() const { return bNeedListening; }
389 : 3888 : void SetNeedsListening( bool bVar ) { bNeedListening = bVar; }
390 : : void Compile(const rtl::OUString& rFormula,
391 : : bool bNoListening = false,
392 : : const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT );
393 : : void CompileTokenArray( bool bNoListening = false );
394 : : void CompileXML( ScProgress& rProgress ); // compile temporary string tokens
395 : : void CalcAfterLoad();
396 : : bool MarkUsedExternalReferences();
397 : : void Interpret();
398 : 0 : inline bool IsIterCell() const { return bIsIterCell; }
399 : 0 : inline sal_uInt16 GetSeenInIteration() const { return nSeenInIteration; }
400 : :
401 : : bool HasOneReference( ScRange& r ) const;
402 : : /* Checks if the formula contains reference list that can be
403 : : expressed by one reference (like A1;A2;A3:A5 -> A1:A5). The
404 : : reference list is not required to be sorted (i.e. A3;A1;A2 is
405 : : still recognized as A1:A3), but no overlapping is allowed.
406 : : If one reference is recognized, the rRange is filled.
407 : :
408 : : It is similar to HasOneReference(), but more general.
409 : : */
410 : : bool HasRefListExpressibleAsOneReference(ScRange& rRange) const;
411 : : bool HasRelNameReference() const;
412 : : bool HasColRowName() const;
413 : :
414 : : bool UpdateReference(UpdateRefMode eUpdateRefMode,
415 : : const ScRange& r,
416 : : SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
417 : : ScDocument* pUndoDoc = NULL,
418 : : const ScAddress* pUndoCellPos = NULL );
419 : :
420 : : void TransposeReference();
421 : : void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
422 : : ScDocument* pUndoDoc );
423 : :
424 : : void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
425 : :
426 : : void UpdateInsertTab(SCTAB nTable, SCTAB nNewSheets = 1);
427 : : void UpdateInsertTabAbs(SCTAB nTable);
428 : : bool UpdateDeleteTab(SCTAB nTable, bool bIsMove = false, SCTAB nSheets = 1);
429 : : void UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo);
430 : : void UpdateRenameTab(SCTAB nTable, const rtl::OUString& rName);
431 : : bool TestTabRefAbs(SCTAB nTable);
432 : : void UpdateCompile( bool bForceIfNameInUse = false );
433 : : void FindRangeNamesInUse(std::set<sal_uInt16>& rIndexes) const;
434 : 10 : bool IsSubTotal() const { return bSubTotal; }
435 : : bool IsChanged() const;
436 : : void ResetChanged();
437 : : bool IsEmpty(); // formula::svEmptyCell result
438 : : // display as empty string if formula::svEmptyCell result
439 : : bool IsEmptyDisplayedAsString();
440 : : bool IsValue(); // also true if formula::svEmptyCell
441 : : double GetValue();
442 : : double GetValueAlways(); // ignore errors
443 : : rtl::OUString GetString();
444 : : const ScMatrix* GetMatrix();
445 : : bool GetMatrixOrigin( ScAddress& rPos ) const;
446 : : void GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows );
447 : : sal_uInt16 GetMatrixEdge( ScAddress& rOrgPos );
448 : : sal_uInt16 GetErrCode(); // interpret first if necessary
449 : : sal_uInt16 GetRawError(); // don't interpret, just return code or result error
450 : 0 : short GetFormatType() const { return nFormatType; }
451 : : sal_uLong GetFormatIndex() const { return nFormatIndex; }
452 : 278 : void GetFormatInfo( short& nType, sal_uLong& nIndex ) const
453 : 278 : { nType = nFormatType; nIndex = nFormatIndex; }
454 : 2745 : sal_uInt8 GetMatrixFlag() const { return cMatrixFlag; }
455 : 16752 : ScTokenArray* GetCode() const { return pCode; }
456 : :
457 : 2325 : bool IsRunning() const { return bRunning; }
458 : 26 : void SetRunning( bool bVal ) { bRunning = bVal; }
459 : : void CompileDBFormula();
460 : : void CompileDBFormula( bool bCreateFormulaString );
461 : : void CompileNameFormula( bool bCreateFormulaString );
462 : : void CompileColRowNameFormula();
463 : 20559 : ScFormulaCell* GetPrevious() const { return pPrevious; }
464 : 4746 : ScFormulaCell* GetNext() const { return pNext; }
465 : 12109 : void SetPrevious( ScFormulaCell* pF ) { pPrevious = pF; }
466 : 14939 : void SetNext( ScFormulaCell* pF ) { pNext = pF; }
467 : 6514 : ScFormulaCell* GetPreviousTrack() const { return pPreviousTrack; }
468 : 7332 : ScFormulaCell* GetNextTrack() const { return pNextTrack; }
469 : 5958 : void SetPreviousTrack( ScFormulaCell* pF ) { pPreviousTrack = pF; }
470 : 5958 : void SetNextTrack( ScFormulaCell* pF ) { pNextTrack = pF; }
471 : :
472 : : virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint);
473 : 13 : void SetCompile( bool bVal ) { bCompile = bVal; }
474 : 1962 : ScDocument* GetDocument() const { return pDocument; }
475 : : void SetMatColsRows( SCCOL nCols, SCROW nRows );
476 : : void GetMatColsRows( SCCOL& nCols, SCROW& nRows ) const;
477 : :
478 : : // cell belongs to ChangeTrack and not to the real document
479 : 0 : void SetInChangeTrack( bool bVal ) { bInChangeTrack = bVal; }
480 : 6564 : bool IsInChangeTrack() const { return bInChangeTrack; }
481 : :
482 : : // standard format for type and format
483 : : // for format "Standard" possibly the format used in the formula cell
484 : : sal_uLong GetStandardFormat( SvNumberFormatter& rFormatter, sal_uLong nFormat ) const;
485 : :
486 : : // For import filters!
487 : : void AddRecalcMode( formula::ScRecalcMode );
488 : : /** For import only: set a double result. */
489 : 1117 : void SetHybridDouble( double n ) { aResult.SetHybridDouble( n); }
490 : : /** For import only: set a string result.
491 : : If for whatever reason you have to use both, SetHybridDouble() and
492 : : SetHybridString() or SetHybridFormula(), use SetHybridDouble() first
493 : : for performance reasons.*/
494 : 172 : void SetHybridString( const rtl::OUString& r )
495 : 172 : { aResult.SetHybridString( r); }
496 : : /** For import only: set a temporary formula string to be compiled later.
497 : : If for whatever reason you have to use both, SetHybridDouble() and
498 : : SetHybridString() or SetHybridFormula(), use SetHybridDouble() first
499 : : for performance reasons.*/
500 : 0 : void SetHybridFormula( const rtl::OUString& r,
501 : : const formula::FormulaGrammar::Grammar eGrammar )
502 [ # # ]: 0 : { aResult.SetHybridFormula( r); eTempGrammar = eGrammar; }
503 : :
504 : : /** For import only: set a double result.
505 : : Use this instead of SetHybridDouble() if there is no (temporary)
506 : : formula string because the formula is present as a token array, as it
507 : : is the case for binary Excel import.
508 : : */
509 : 1761 : void SetResultDouble( double n ) { aResult.SetDouble( n); }
510 : :
511 : : void SetErrCode( sal_uInt16 n );
512 [ # # ][ # # ]: 0 : inline bool IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); }
513 : : EditTextObject* CreateURLObject() ;
514 : : void GetURLResult( rtl::OUString& rURL, rtl::OUString& rCellText );
515 : :
516 : : /** Determines whether or not the result string contains more than one paragraph */
517 : : bool IsMultilineResult();
518 : :
519 : : void MaybeInterpret();
520 : : };
521 : :
522 : : // Iterator for references in a formula cell
523 : : class ScDetectiveRefIter
524 : : {
525 : : private:
526 : : ScTokenArray* pCode;
527 : : ScAddress aPos;
528 : : public:
529 : : ScDetectiveRefIter( ScFormulaCell* pCell );
530 : : bool GetNextRef( ScRange& rRange );
531 : : ScToken* GetNextRefToken();
532 : : };
533 : :
534 : : #endif
535 : :
536 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|