1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tokenuno.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_TOKENUNO_HXX
32 #define SC_TOKENUNO_HXX
34 #include <com/sun/star/uno/Sequence.hxx>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
38 #include <com/sun/star/sheet/FormulaToken.hpp>
39 #include <com/sun/star/sheet/XFormulaParser.hpp>
40 #include <cppuhelper/implbase3.hxx>
41 #include <svtools/lstner.hxx>
42 #include <formula/FormulaOpCodeMapperObj.hxx>
43 #include "address.hxx"
44 #include "compiler.hxx"
49 // ============================================================================
51 class ScTokenConversion
54 static bool ConvertToTokenArray(
56 ScTokenArray
& rTokenArray
,
57 const com::sun::star::uno::Sequence
< com::sun::star::sheet::FormulaToken
>& rSequence
);
58 static bool ConvertToTokenSequence(
60 com::sun::star::uno::Sequence
< com::sun::star::sheet::FormulaToken
>& rSequence
,
61 const ScTokenArray
& rTokenArray
);
64 // ============================================================================
66 class ScFormulaParserObj
: public ::cppu::WeakImplHelper3
<
67 ::com::sun::star::sheet::XFormulaParser
,
68 ::com::sun::star::beans::XPropertySet
,
69 ::com::sun::star::lang::XServiceInfo
>,
73 ::com::sun::star::uno::Sequence
< const ::com::sun::star::sheet::FormulaOpCodeMapEntry
> maOpCodeMapping
;
74 ::com::sun::star::uno::Sequence
< const ::com::sun::star::sheet::ExternalLinkInfo
> maExternalLinks
;
75 ScCompiler::OpCodeMapPtr mxOpCodeMap
;
76 ScDocShell
* mpDocShell
;
82 void SetCompilerFlags( ScCompiler
& rCompiler
) const;
85 ScFormulaParserObj(ScDocShell
* pDocSh
);
86 virtual ~ScFormulaParserObj();
88 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
91 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::FormulaToken
> SAL_CALL
parseFormula(
92 const ::rtl::OUString
& aFormula
,
93 const ::com::sun::star::table::CellAddress
& rReferencePos
)
94 throw (::com::sun::star::uno::RuntimeException
);
95 virtual ::rtl::OUString SAL_CALL
printFormula( const ::com::sun::star::uno::Sequence
<
96 ::com::sun::star::sheet::FormulaToken
>& aTokens
,
97 const ::com::sun::star::table::CellAddress
& rReferencePos
)
98 throw (::com::sun::star::uno::RuntimeException
);
101 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
102 SAL_CALL
getPropertySetInfo()
103 throw(::com::sun::star::uno::RuntimeException
);
104 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
105 const ::com::sun::star::uno::Any
& aValue
)
106 throw(::com::sun::star::beans::UnknownPropertyException
,
107 ::com::sun::star::beans::PropertyVetoException
,
108 ::com::sun::star::lang::IllegalArgumentException
,
109 ::com::sun::star::lang::WrappedTargetException
,
110 ::com::sun::star::uno::RuntimeException
);
111 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
112 const ::rtl::OUString
& PropertyName
)
113 throw(::com::sun::star::beans::UnknownPropertyException
,
114 ::com::sun::star::lang::WrappedTargetException
,
115 ::com::sun::star::uno::RuntimeException
);
116 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
117 const ::com::sun::star::uno::Reference
<
118 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
119 throw(::com::sun::star::beans::UnknownPropertyException
,
120 ::com::sun::star::lang::WrappedTargetException
,
121 ::com::sun::star::uno::RuntimeException
);
122 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
123 const ::com::sun::star::uno::Reference
<
124 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
125 throw(::com::sun::star::beans::UnknownPropertyException
,
126 ::com::sun::star::lang::WrappedTargetException
,
127 ::com::sun::star::uno::RuntimeException
);
128 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
129 const ::com::sun::star::uno::Reference
<
130 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
131 throw(::com::sun::star::beans::UnknownPropertyException
,
132 ::com::sun::star::lang::WrappedTargetException
,
133 ::com::sun::star::uno::RuntimeException
);
134 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
135 const ::com::sun::star::uno::Reference
<
136 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
137 throw(::com::sun::star::beans::UnknownPropertyException
,
138 ::com::sun::star::lang::WrappedTargetException
,
139 ::com::sun::star::uno::RuntimeException
);
142 virtual ::rtl::OUString SAL_CALL
getImplementationName()
143 throw(::com::sun::star::uno::RuntimeException
);
144 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
145 throw(::com::sun::star::uno::RuntimeException
);
146 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
147 throw(::com::sun::star::uno::RuntimeException
);
150 // ============================================================================
152 class ScFormulaOpCodeMapperObj
: public formula::FormulaOpCodeMapperObj
155 ScFormulaOpCodeMapperObj(::std::auto_ptr
<formula::FormulaCompiler
> _pCompiler
);
158 // ============================================================================