xref: /trunk/main/oox/inc/oox/xls/ooxformulaparser.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef OOX_XLS_OOXFORMULAPARSER_HXX
29 #define OOX_XLS_OOXFORMULAPARSER_HXX
30 
31 #include <boost/shared_ptr.hpp>
32 #include <com/sun/star/lang/XComponent.hpp>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/sheet/XFilterFormulaParser.hpp>
36 #include <cppuhelper/implbase3.hxx>
37 
38 namespace oox {
39 namespace xls {
40 
41 class OOXMLFormulaParserImpl;
42 class OOXMLFormulaPrinterImpl;
43 
44 // ============================================================================
45 
46 typedef ::cppu::WeakImplHelper3<
47     ::com::sun::star::lang::XServiceInfo,
48     ::com::sun::star::lang::XInitialization,
49     ::com::sun::star::sheet::XFilterFormulaParser > OOXMLFormulaParser_BASE;
50 
51 /** OOXML formula parser/compiler service for usage in ODF filters. */
52 class OOXMLFormulaParser : public OOXMLFormulaParser_BASE
53 {
54 public:
55     explicit            OOXMLFormulaParser();
56     virtual             ~OOXMLFormulaParser();
57 
58     // com.sun.star.lang.XServiceInfo interface -------------------------------
59 
60     virtual ::rtl::OUString SAL_CALL
61                         getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
62 
63     virtual sal_Bool SAL_CALL
64                         supportsService( const ::rtl::OUString& rService )
65                             throw( ::com::sun::star::uno::RuntimeException );
66 
67     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
68                         getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
69 
70     // com.sun.star.lang.XInitialization interface ----------------------------
71 
72     virtual void SAL_CALL initialize(
73                             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs )
74                             throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException );
75 
76     // com.sun.star.sheet.XFilterFormulaParser interface ----------------------
77 
78     virtual ::rtl::OUString SAL_CALL
79                         getSupportedNamespace()
80                             throw( ::com::sun::star::uno::RuntimeException );
81 
82     // com.sun.star.sheet.XFormulaParser interface ----------------------------
83 
84     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL
85                         parseFormula(
86                             const ::rtl::OUString& rFormula,
87                             const ::com::sun::star::table::CellAddress& rReferencePos )
88                         throw( ::com::sun::star::uno::RuntimeException );
89 
90     virtual ::rtl::OUString SAL_CALL
91                         printFormula(
92                             const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& rTokens,
93                             const ::com::sun::star::table::CellAddress& rReferencePos )
94                         throw( ::com::sun::star::uno::RuntimeException );
95 
96 private:
97     typedef ::boost::shared_ptr< OOXMLFormulaParserImpl >   ParserImplRef;
98     typedef ::boost::shared_ptr< OOXMLFormulaPrinterImpl >  PrinterImplRef;
99 
100     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
101                         mxComponent;
102     ParserImplRef       mxParserImpl;       /// Implementation of import parser.
103     PrinterImplRef      mxPrinterImpl;      /// Implementation of export printer.
104 };
105 
106 // ============================================================================
107 
108 } // namespace xls
109 } // namespace oox
110 
111 #endif
112