update dev300-m58
[ooovba.git] / sccomp / source / solver / solver.hxx
blob91be988ef0c2dbf91e107f92fa31fcc2f33519ae
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: solver.hxx,v $
10 * $Revision: 1.2 $
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 SOLVER_HXX
32 #define SOLVER_HXX
34 #include <com/sun/star/sheet/XSolver.hpp>
35 #include <com/sun/star/sheet/XSolverDescription.hpp>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/uno/XComponentContext.hpp>
38 #include <cppuhelper/implbase3.hxx>
39 #include <comphelper/broadcasthelper.hxx>
40 #include <comphelper/propertycontainer.hxx>
41 #include <comphelper/proparrhlp.hxx>
43 typedef cppu::WeakImplHelper3<
44 com::sun::star::sheet::XSolver,
45 com::sun::star::sheet::XSolverDescription,
46 com::sun::star::lang::XServiceInfo >
47 SolverComponent_Base;
49 class SolverComponent : public comphelper::OMutexAndBroadcastHelper,
50 public comphelper::OPropertyContainer,
51 public comphelper::OPropertyArrayUsageHelper< SolverComponent >,
52 public SolverComponent_Base
54 // settings
55 com::sun::star::uno::Reference< com::sun::star::sheet::XSpreadsheetDocument > mxDoc;
56 com::sun::star::table::CellAddress maObjective;
57 com::sun::star::uno::Sequence< com::sun::star::table::CellAddress > maVariables;
58 com::sun::star::uno::Sequence< com::sun::star::sheet::SolverConstraint > maConstraints;
59 sal_Bool mbMaximize;
60 // set via XPropertySet
61 sal_Bool mbNonNegative;
62 sal_Bool mbInteger;
63 sal_Int32 mnTimeout;
64 sal_Int32 mnEpsilonLevel;
65 sal_Bool mbLimitBBDepth;
66 // results
67 sal_Bool mbSuccess;
68 double mfResultValue;
69 com::sun::star::uno::Sequence< double > maSolution;
70 rtl::OUString maStatus;
72 public:
73 SolverComponent( const com::sun::star::uno::Reference<
74 com::sun::star::uno::XComponentContext >& rxMSF );
75 virtual ~SolverComponent();
77 DECLARE_XINTERFACE()
78 DECLARE_XTYPEPROVIDER()
80 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
81 throw (::com::sun::star::uno::RuntimeException);
82 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); // from OPropertySetHelper
83 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; // from OPropertyArrayUsageHelper
85 // XSolver
86 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument > SAL_CALL getDocument()
87 throw(::com::sun::star::uno::RuntimeException);
88 virtual void SAL_CALL setDocument( const ::com::sun::star::uno::Reference<
89 ::com::sun::star::sheet::XSpreadsheetDocument >& _document )
90 throw(::com::sun::star::uno::RuntimeException);
91 virtual ::com::sun::star::table::CellAddress SAL_CALL getObjective() throw(::com::sun::star::uno::RuntimeException);
92 virtual void SAL_CALL setObjective( const ::com::sun::star::table::CellAddress& _objective )
93 throw(::com::sun::star::uno::RuntimeException);
94 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellAddress > SAL_CALL getVariables()
95 throw(::com::sun::star::uno::RuntimeException);
96 virtual void SAL_CALL setVariables( const ::com::sun::star::uno::Sequence<
97 ::com::sun::star::table::CellAddress >& _variables )
98 throw(::com::sun::star::uno::RuntimeException);
99 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::SolverConstraint > SAL_CALL getConstraints()
100 throw(::com::sun::star::uno::RuntimeException);
101 virtual void SAL_CALL setConstraints( const ::com::sun::star::uno::Sequence<
102 ::com::sun::star::sheet::SolverConstraint >& _constraints )
103 throw(::com::sun::star::uno::RuntimeException);
104 virtual ::sal_Bool SAL_CALL getMaximize() throw(::com::sun::star::uno::RuntimeException);
105 virtual void SAL_CALL setMaximize( ::sal_Bool _maximize ) throw(::com::sun::star::uno::RuntimeException);
107 virtual ::sal_Bool SAL_CALL getSuccess() throw(::com::sun::star::uno::RuntimeException);
108 virtual double SAL_CALL getResultValue() throw(::com::sun::star::uno::RuntimeException);
109 virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getSolution()
110 throw(::com::sun::star::uno::RuntimeException);
112 virtual void SAL_CALL solve() throw(::com::sun::star::uno::RuntimeException);
114 // XSolverDescription
115 virtual ::rtl::OUString SAL_CALL getComponentDescription() throw (::com::sun::star::uno::RuntimeException);
116 virtual ::rtl::OUString SAL_CALL getStatusDescription() throw (::com::sun::star::uno::RuntimeException);
117 virtual ::rtl::OUString SAL_CALL getPropertyDescription( const ::rtl::OUString& aPropertyName )
118 throw (::com::sun::star::uno::RuntimeException);
120 // XServiceInfo
121 virtual ::rtl::OUString SAL_CALL getImplementationName()
122 throw(::com::sun::star::uno::RuntimeException);
123 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
124 throw(::com::sun::star::uno::RuntimeException);
125 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
126 throw(::com::sun::star::uno::RuntimeException);
129 #endif