diff options
author | Eike Rathke <erack@redhat.com> | 2014-11-28 01:39:24 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-11-28 02:04:22 +0100 |
commit | 14aabee5a73e57e26b2062b1ebf00c3f1dff1250 (patch) | |
tree | de91041dbfabd6e7032ba1e5f2e521e46d5ccae4 /include | |
parent | 3dd241c52d6db424bd4696ff8f223976542e411b (diff) |
simplify RewriteMissing() and switch in Add...(), fdo#81596 related
Change-Id: If2ca37e1fda87ce56282fc2d2fc57a0784851139
Diffstat (limited to 'include')
-rw-r--r-- | include/formula/tokenarray.hxx | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx index e3589d997a96..ceb84253f246 100644 --- a/include/formula/tokenarray.hxx +++ b/include/formula/tokenarray.hxx @@ -53,14 +53,41 @@ typedef sal_uInt8 ScRecalcMode; class FormulaMissingContext; -class FORMULA_DLLPUBLIC MissingConventionPOF +class FORMULA_DLLPUBLIC MissingConvention { - bool mbODFF; /// TRUE: ODFF, FALSE: PODF public: - explicit MissingConventionPOF( bool bODFF ) : mbODFF(bODFF) {} + enum Convention + { + FORMULA_MISSING_CONVENTION_PODF, + FORMULA_MISSING_CONVENTION_ODFF, + FORMULA_MISSING_CONVENTION_OOXML + }; + explicit MissingConvention( Convention eConvention ) : meConvention(eConvention) {} + inline bool isPODF() const { return meConvention == FORMULA_MISSING_CONVENTION_PODF; } + inline Convention getConvention() const { return meConvention; } +private: + Convention meConvention; +}; + +class FORMULA_DLLPUBLIC MissingConventionODF : public MissingConvention +{ +public: + explicit MissingConventionODF( bool bODFF ) : + MissingConvention( bODFF ? + MissingConvention::FORMULA_MISSING_CONVENTION_ODFF : + MissingConvention::FORMULA_MISSING_CONVENTION_PODF) + { + } + // Implementation and usage only in token.cxx + inline bool isRewriteNeeded( OpCode eOp ) const; +}; + +class FORMULA_DLLPUBLIC MissingConventionOOXML : public MissingConvention +{ +public: + explicit MissingConventionOOXML() : MissingConvention( MissingConvention::FORMULA_MISSING_CONVENTION_OOXML) {} // Implementation and usage only in token.cxx inline bool isRewriteNeeded( OpCode eOp ) const; - inline bool isODFF() const { return mbODFF; } }; class FORMULA_DLLPUBLIC FormulaTokenArray @@ -238,18 +265,19 @@ public: FormulaTokenArray& operator=( const FormulaTokenArray& ); /** Determines if this formula needs any changes to convert it to something - previous versions of OOo could consume (Plain Old Formula). */ - bool NeedsPofRewrite(const MissingConventionPOF & rConv); + previous versions of OOo could consume (Plain Old Formula, pre-ODFF, or + also ODFF) */ + bool NeedsPodfRewrite( const MissingConventionODF & rConv ); - /** Determines if this formula needs any changes to convert it to OOXML */ - bool NeedsOOXMLRewrite(); + /** Determines if this formula needs any changes to convert it to OOXML. */ + bool NeedsOoxmlRewrite( const MissingConventionOOXML & rConv ); /** Rewrites to Plain Old Formula or OOXML, substituting missing parameters. The FormulaTokenArray* returned is new'ed. */ - FormulaTokenArray* RewriteMissing( bool bIsOOXML, const MissingConventionPOF & rConv ); + FormulaTokenArray* RewriteMissing( const MissingConvention & rConv ); /** Determines if this formula may be followed by a reference. */ - bool MayReferenceFollow(); + bool MayReferenceFollow(); }; inline OpCode FormulaTokenArray::GetOuterFuncOpCode() |