xref: /AOO41X/main/xmlsecurity/source/framework/elementcollector.hxx (revision ec61c6ed669d81c7df08233ccc38d0040f129ece)
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 
24 #ifndef _ELEMENTCOLLECTOR_HXX
25 #define _ELEMENTCOLLECTOR_HXX
26 
27 #include "elementmark.hxx"
28 #include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
29 #include <com/sun/star/xml/crypto/sax/ElementMarkPriority.hpp>
30 
31 class ElementCollector : public ElementMark
32 /****** elementcollector.hxx/CLASS ElementCollector ***************************
33  *
34  *   NAME
35  *  ElementCollector -- Class to manipulate an element collector
36  *
37  *   FUNCTION
38  *  This class is derived from the ElementMark class. Beyond the function
39  *  of the ElementMark class, this class also maintains the priority, and
40  *  manages the notify process
41  *
42  *   HISTORY
43  *  05.01.2004 -    implemented
44  *
45  *   AUTHOR
46  *  Michael Mi
47  *  Email: michael.mi@sun.com
48  ******************************************************************************/
49 {
50 private:
51     /*
52      * the notify priority, is one of following values:
53      * AFTERMODIFY  - this ElementCollector will notify after all
54      *                    internal modifications have finished.
55      * BEFOREMODIFY - this ElementCollector must notify before any
56      *                    internal modification happens.
57      */
58     com::sun::star::xml::crypto::sax::ElementMarkPriority m_nPriority;
59 
60     /*
61      * the modify flag, representing whether which elementcollector will
62      * modify its data.
63      */
64     bool m_bToModify;
65 
66     /* the notify enable flag, see notifyListener method */
67     bool m_bAbleToNotify;
68 
69     /* whether the listener has been notified */
70     bool m_bNotified;
71 
72     /* the listener to be notified */
73     com::sun::star::uno::Reference<
74         com::sun::star::xml::crypto::sax::XReferenceResolvedListener > m_xReferenceResolvedListener;
75 
76 public:
77     ElementCollector(
78         sal_Int32 nSecurityId,
79         sal_Int32 nBufferId,
80         com::sun::star::xml::crypto::sax::ElementMarkPriority nPriority,
81         bool bToModify,
82         const com::sun::star::uno::Reference<
83             com::sun::star::xml::crypto::sax::XReferenceResolvedListener >&
84             xReferenceResolvedListener);
~ElementCollector()85     virtual ~ElementCollector() {};
86 
87     //bool isInternalNotificationSuppressed() const;
88     com::sun::star::xml::crypto::sax::ElementMarkPriority getPriority() const;
89     bool getModify() const;
90     void notifyListener();
91     bool isAbleToNotify() const;
92     void setReferenceResolvedListener(
93         const com::sun::star::uno::Reference<
94             com::sun::star::xml::crypto::sax::XReferenceResolvedListener >&
95             referenceResolvedListener);
96     void setSecurityId(sal_Int32 nSecurityId);
97     void doNotify();
98     ElementCollector* clone(
99         sal_Int32 nId,
100         com::sun::star::xml::crypto::sax::ElementMarkPriority nPriority ) const;
101 };
102 
103 #endif
104 
105