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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 #include <objstmpconsiderwrapinfl.hxx>
27 #include <anchoredobject.hxx>
28 
SwObjsMarkedAsTmpConsiderWrapInfluence()29 SwObjsMarkedAsTmpConsiderWrapInfluence::SwObjsMarkedAsTmpConsiderWrapInfluence()
30 {
31 }
32 
~SwObjsMarkedAsTmpConsiderWrapInfluence()33 SwObjsMarkedAsTmpConsiderWrapInfluence::~SwObjsMarkedAsTmpConsiderWrapInfluence()
34 {
35     Clear();
36 }
37 
Insert(SwAnchoredObject & _rAnchoredObj)38 void SwObjsMarkedAsTmpConsiderWrapInfluence::Insert( SwAnchoredObject& _rAnchoredObj )
39 {
40 
41     bool bAlreadyInserted( false );
42     std::vector< SwAnchoredObject* >::const_iterator aIter = maObjsTmpConsiderWrapInfl.begin();
43     for ( ; aIter != maObjsTmpConsiderWrapInfl.end(); ++aIter )
44     {
45         const SwAnchoredObject* pAnchoredObj = *(aIter);
46         if ( pAnchoredObj == &_rAnchoredObj )
47         {
48             bAlreadyInserted = true;
49             break;
50         }
51     }
52 
53     if ( !bAlreadyInserted )
54     {
55         maObjsTmpConsiderWrapInfl.push_back( &_rAnchoredObj );
56     }
57 }
58 
Clear()59 void SwObjsMarkedAsTmpConsiderWrapInfluence::Clear()
60 {
61     while ( maObjsTmpConsiderWrapInfl.size() )
62     {
63         SwAnchoredObject* pAnchoredObj = maObjsTmpConsiderWrapInfl.back();
64         pAnchoredObj->SetTmpConsiderWrapInfluence( false );
65         pAnchoredObj->SetClearedEnvironment( false );
66 
67         maObjsTmpConsiderWrapInfl.pop_back();
68     }
69 }
70