xref: /aoo41x/main/sw/inc/HandleAnchorNodeChg.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _HANDLEANCHORNODECHG_HXX
28 #define _HANDLEANCHORNODECHG_HXX
29 
30 class SwFlyFrmFmt;
31 class SwFmtAnchor;
32 class SwFlyFrm;
33 
34 // OD 2006-02-28 #125892#
35 // helper class to track change of anchor node of at-paragraph respectively
36 // at-character anchored fly frames
37 // if such a change happens, it has to be checked, if the count of the anchor
38 // frames also change. if yes, a re-creation of the fly frames is needed:
39 // - deletion of existing fly frames before the intrinsic anchor node changes
40 // - creation of new fly frames after the intrinsic anchor node change.
41 class SwHandleAnchorNodeChg
42 {
43 public:
44     /** checks, if re-creation of fly frames for an anchor node change at the
45         given fly frame format is necessary, and performs the first part.
46 
47         @author OD
48 
49         @param _rFlyFrmFmt
50         reference to the fly frame format instance, which is handled.
51 
52         @param _rNewAnchorFmt
53         new anchor attribute, which will be applied at the given fly frame format
54 
55         @param _pKeepThisFlyFrm
56         optional parameter - pointer to a fly frame of the given fly frame format,
57         which isn't deleted, if re-creation of fly frames is necessary.
58     */
59     SwHandleAnchorNodeChg( SwFlyFrmFmt& _rFlyFrmFmt,
60                            const SwFmtAnchor& _rNewAnchorFmt,
61                            SwFlyFrm* _pKeepThisFlyFrm = 0L );
62 
63     /** calls <SwFlyFrmFmt::MakeFrms>, if re-creation of fly frames is necessary.
64 
65         @author OD
66     */
67     ~SwHandleAnchorNodeChg();
68 
69 private:
70     // fly frame format, which is tracked for a anchor node change.
71     SwFlyFrmFmt& mrFlyFrmFmt;
72     // internal flag, which indicates that the certain anchor node change occurs
73     // and that re-creation of fly frames is necessary.
74     bool mbAnchorNodeChanged;
75 
76     // no copy-constructor
77     SwHandleAnchorNodeChg( const SwHandleAnchorNodeChg& );
78     // no assignment-operator
79     void operator=( const SwHandleAnchorNodeChg );
80 };
81 #endif
82