1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 #include <com/sun/star/sheet/XSolver.hpp>
24 #include <com/sun/star/sheet/XSolverDescription.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/uno/XComponentContext.hpp>
27 #include <cppuhelper/implbase3.hxx>
28 #include <comphelper/broadcasthelper.hxx>
29 #include <comphelper/propertycontainer.hxx>
30 #include <comphelper/proparrhlp.hxx>
32 typedef cppu::WeakImplHelper3
<
33 com::sun::star::sheet::XSolver
,
34 com::sun::star::sheet::XSolverDescription
,
35 com::sun::star::lang::XServiceInfo
>
38 class SolverComponent
: public comphelper::OMutexAndBroadcastHelper
,
39 public comphelper::OPropertyContainer
,
40 public comphelper::OPropertyArrayUsageHelper
< SolverComponent
>,
41 public SolverComponent_Base
44 com::sun::star::uno::Reference
< com::sun::star::sheet::XSpreadsheetDocument
> mxDoc
;
45 com::sun::star::table::CellAddress maObjective
;
46 com::sun::star::uno::Sequence
< com::sun::star::table::CellAddress
> maVariables
;
47 com::sun::star::uno::Sequence
< com::sun::star::sheet::SolverConstraint
> maConstraints
;
49 // set via XPropertySet
50 sal_Bool mbNonNegative
;
53 sal_Int32 mnEpsilonLevel
;
54 sal_Bool mbLimitBBDepth
;
58 com::sun::star::uno::Sequence
< double > maSolution
;
59 rtl::OUString maStatus
;
62 SolverComponent( const com::sun::star::uno::Reference
<
63 com::sun::star::uno::XComponentContext
>& rxMSF
);
64 virtual ~SolverComponent();
67 DECLARE_XTYPEPROVIDER()
69 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
70 throw (::com::sun::star::uno::RuntimeException
);
71 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper(); // from OPropertySetHelper
72 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper() const; // from OPropertyArrayUsageHelper
75 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XSpreadsheetDocument
> SAL_CALL
getDocument()
76 throw(::com::sun::star::uno::RuntimeException
);
77 virtual void SAL_CALL
setDocument( const ::com::sun::star::uno::Reference
<
78 ::com::sun::star::sheet::XSpreadsheetDocument
>& _document
)
79 throw(::com::sun::star::uno::RuntimeException
);
80 virtual ::com::sun::star::table::CellAddress SAL_CALL
getObjective() throw(::com::sun::star::uno::RuntimeException
);
81 virtual void SAL_CALL
setObjective( const ::com::sun::star::table::CellAddress
& _objective
)
82 throw(::com::sun::star::uno::RuntimeException
);
83 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::table::CellAddress
> SAL_CALL
getVariables()
84 throw(::com::sun::star::uno::RuntimeException
);
85 virtual void SAL_CALL
setVariables( const ::com::sun::star::uno::Sequence
<
86 ::com::sun::star::table::CellAddress
>& _variables
)
87 throw(::com::sun::star::uno::RuntimeException
);
88 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::SolverConstraint
> SAL_CALL
getConstraints()
89 throw(::com::sun::star::uno::RuntimeException
);
90 virtual void SAL_CALL
setConstraints( const ::com::sun::star::uno::Sequence
<
91 ::com::sun::star::sheet::SolverConstraint
>& _constraints
)
92 throw(::com::sun::star::uno::RuntimeException
);
93 virtual ::sal_Bool SAL_CALL
getMaximize() throw(::com::sun::star::uno::RuntimeException
);
94 virtual void SAL_CALL
setMaximize( ::sal_Bool _maximize
) throw(::com::sun::star::uno::RuntimeException
);
96 virtual ::sal_Bool SAL_CALL
getSuccess() throw(::com::sun::star::uno::RuntimeException
);
97 virtual double SAL_CALL
getResultValue() throw(::com::sun::star::uno::RuntimeException
);
98 virtual ::com::sun::star::uno::Sequence
< double > SAL_CALL
getSolution()
99 throw(::com::sun::star::uno::RuntimeException
);
101 virtual void SAL_CALL
solve() throw(::com::sun::star::uno::RuntimeException
);
103 // XSolverDescription
104 virtual ::rtl::OUString SAL_CALL
getComponentDescription() throw (::com::sun::star::uno::RuntimeException
);
105 virtual ::rtl::OUString SAL_CALL
getStatusDescription() throw (::com::sun::star::uno::RuntimeException
);
106 virtual ::rtl::OUString SAL_CALL
getPropertyDescription( const ::rtl::OUString
& aPropertyName
)
107 throw (::com::sun::star::uno::RuntimeException
);
110 virtual ::rtl::OUString SAL_CALL
getImplementationName()
111 throw(::com::sun::star::uno::RuntimeException
);
112 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
113 throw(::com::sun::star::uno::RuntimeException
);
114 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
115 throw(::com::sun::star::uno::RuntimeException
);
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */