1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef BASCTL_DOCSIGNATURE_HXX
24 #define BASCTL_DOCSIGNATURE_HXX
25 
26 /** === begin UNO includes === **/
27 #include <com/sun/star/frame/XModel.hpp>
28 /** === end UNO includes === **/
29 
30 #include <memory>
31 
32 //........................................................................
33 namespace basctl
34 {
35 //........................................................................
36 
37     class ScriptDocument;
38 	//====================================================================
39 	//= DocumentSignature
40 	//====================================================================
41     struct DocumentSignature_Data;
42     /// encapsulates (actions on) the signature/state of a document
43 	class DocumentSignature
44 	{
45     public:
46         /** creates a DocumentSignature instance for the given document
47 
48             If the given ScriptDocument instance refers to the application, or to a document
49             which does not support being signed, the DocumentSignature instance is invalid afterwards.
50         */
51         DocumentSignature( const ScriptDocument& _rDocument );
52         ~DocumentSignature();
53 
54         /** determines whether the instance is valid
55 
56             An instance is valid if and only if it has been constructed with a document
57             which supports signatures.
58         */
59         bool    supportsSignatures() const;
60 
61         /** signs the scripting content inside the document
62 
63             @precond
64                 isValid returns <TRUE/>
65         */
66         void        signScriptingContent() const;
67 
68         /** retrieves the state of the signature of the scripting content inside the document
69 
70             If the instance is not valid, then SIGNATURESTATE_NOSIGNATURES is returned.
71         */
72         sal_uInt16  getScriptingSignatureState() const;
73 
74     private:
75         DocumentSignature();        // not implemented
76 
77     private:
78         ::std::auto_ptr< DocumentSignature_Data >   m_pData;
79 	};
80 
81 //........................................................................
82 } // namespace basctl
83 //........................................................................
84 
85 #endif // BASCTL_DOCSIGNATURE_HXX
86