xref: /aoo4110/main/sc/inc/unoreflist.hxx (revision b1cdbd2c)
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 SC_UNOREFLIST_HXX
25 #define SC_UNOREFLIST_HXX
26 
27 #include <list>
28 #include <svl/hint.hxx>
29 #include "rangelst.hxx"
30 
31 
32 struct ScUnoRefEntry
33 {
34     sal_Int64   nObjectId;
35     ScRangeList aRanges;
36 
ScUnoRefEntryScUnoRefEntry37     ScUnoRefEntry( sal_Int64 nId, const ScRangeList& rOldRanges ) :
38         nObjectId( nId ),
39         aRanges( rOldRanges )
40     {
41     }
42 };
43 
44 /** List of RefUpdate changes made to UNO objects during ScUpdateRefHint broadcast.
45 */
46 
47 class ScUnoRefList
48 {
49 private:
50     ::std::list<ScUnoRefEntry> aEntries;
51 
52 public:
53                 ScUnoRefList();
54                 ~ScUnoRefList();
55 
56     void        Add( sal_Int64 nId, const ScRangeList& rOldRanges );
57     void        Undo( ScDocument* pDoc );
58 
IsEmpty() const59     bool        IsEmpty() const     { return aEntries.empty(); }
60 };
61 
62 /** Hint to restore a UNO object to its old state (used during undo).
63 */
64 
65 class ScUnoRefUndoHint : public SfxHint
66 {
67     ScUnoRefEntry   aEntry;
68 
69 public:
70                 TYPEINFO();
71                 ScUnoRefUndoHint( const ScUnoRefEntry& rRefEntry );
72                 ~ScUnoRefUndoHint();
73 
GetObjectId() const74     sal_Int64   GetObjectId() const         { return aEntry.nObjectId; }
GetRanges() const75     const ScRangeList& GetRanges() const    { return aEntry.aRanges; }
76 };
77 
78 
79 #endif
80 
81