1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
32 #include <com/sun/star/sheet/XSolver.hpp>
33 #include <com/sun/star/sheet/XSolverDescription.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <cppuhelper/implbase3.hxx>
37 #include <comphelper/broadcasthelper.hxx>
38 #include <comphelper/propertycontainer.hxx>
39 #include <comphelper/proparrhlp.hxx>
41 typedef cppu::WeakImplHelper3
<
42 com::sun::star::sheet::XSolver
,
43 com::sun::star::sheet::XSolverDescription
,
44 com::sun::star::lang::XServiceInfo
>
47 class SolverComponent
: public comphelper::OMutexAndBroadcastHelper
,
48 public comphelper::OPropertyContainer
,
49 public comphelper::OPropertyArrayUsageHelper
< SolverComponent
>,
50 public SolverComponent_Base
53 com::sun::star::uno::Reference
< com::sun::star::sheet::XSpreadsheetDocument
> mxDoc
;
54 com::sun::star::table::CellAddress maObjective
;
55 com::sun::star::uno::Sequence
< com::sun::star::table::CellAddress
> maVariables
;
56 com::sun::star::uno::Sequence
< com::sun::star::sheet::SolverConstraint
> maConstraints
;
58 // set via XPropertySet
59 sal_Bool mbNonNegative
;
62 sal_Int32 mnEpsilonLevel
;
63 sal_Bool mbLimitBBDepth
;
67 com::sun::star::uno::Sequence
< double > maSolution
;
68 rtl::OUString maStatus
;
71 SolverComponent( const com::sun::star::uno::Reference
<
72 com::sun::star::uno::XComponentContext
>& rxMSF
);
73 virtual ~SolverComponent();
76 DECLARE_XTYPEPROVIDER()
78 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
79 throw (::com::sun::star::uno::RuntimeException
);
80 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper(); // from OPropertySetHelper
81 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper() const; // from OPropertyArrayUsageHelper
84 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XSpreadsheetDocument
> SAL_CALL
getDocument()
85 throw(::com::sun::star::uno::RuntimeException
);
86 virtual void SAL_CALL
setDocument( const ::com::sun::star::uno::Reference
<
87 ::com::sun::star::sheet::XSpreadsheetDocument
>& _document
)
88 throw(::com::sun::star::uno::RuntimeException
);
89 virtual ::com::sun::star::table::CellAddress SAL_CALL
getObjective() throw(::com::sun::star::uno::RuntimeException
);
90 virtual void SAL_CALL
setObjective( const ::com::sun::star::table::CellAddress
& _objective
)
91 throw(::com::sun::star::uno::RuntimeException
);
92 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::table::CellAddress
> SAL_CALL
getVariables()
93 throw(::com::sun::star::uno::RuntimeException
);
94 virtual void SAL_CALL
setVariables( const ::com::sun::star::uno::Sequence
<
95 ::com::sun::star::table::CellAddress
>& _variables
)
96 throw(::com::sun::star::uno::RuntimeException
);
97 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::SolverConstraint
> SAL_CALL
getConstraints()
98 throw(::com::sun::star::uno::RuntimeException
);
99 virtual void SAL_CALL
setConstraints( const ::com::sun::star::uno::Sequence
<
100 ::com::sun::star::sheet::SolverConstraint
>& _constraints
)
101 throw(::com::sun::star::uno::RuntimeException
);
102 virtual ::sal_Bool SAL_CALL
getMaximize() throw(::com::sun::star::uno::RuntimeException
);
103 virtual void SAL_CALL
setMaximize( ::sal_Bool _maximize
) throw(::com::sun::star::uno::RuntimeException
);
105 virtual ::sal_Bool SAL_CALL
getSuccess() throw(::com::sun::star::uno::RuntimeException
);
106 virtual double SAL_CALL
getResultValue() throw(::com::sun::star::uno::RuntimeException
);
107 virtual ::com::sun::star::uno::Sequence
< double > SAL_CALL
getSolution()
108 throw(::com::sun::star::uno::RuntimeException
);
110 virtual void SAL_CALL
solve() throw(::com::sun::star::uno::RuntimeException
);
112 // XSolverDescription
113 virtual ::rtl::OUString SAL_CALL
getComponentDescription() throw (::com::sun::star::uno::RuntimeException
);
114 virtual ::rtl::OUString SAL_CALL
getStatusDescription() throw (::com::sun::star::uno::RuntimeException
);
115 virtual ::rtl::OUString SAL_CALL
getPropertyDescription( const ::rtl::OUString
& aPropertyName
)
116 throw (::com::sun::star::uno::RuntimeException
);
119 virtual ::rtl::OUString SAL_CALL
getImplementationName()
120 throw(::com::sun::star::uno::RuntimeException
);
121 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
122 throw(::com::sun::star::uno::RuntimeException
);
123 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
124 throw(::com::sun::star::uno::RuntimeException
);
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */