1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: accfrmobj.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _ACCFRMOBJ_HXX
31 #define _ACCFRMOBJ_HXX
33 #include <pagefrm.hxx>
34 #include <dflyobj.hxx>
35 #include <swtable.hxx>
39 const SdrObject
*pObj
;
42 inline void Init( const SdrObject
*pO
);
43 inline void Init( const SwFrm
*pF
);
48 inline SwFrmOrObj( const SdrObject
*pO
);
49 inline SwFrmOrObj( const SwFrm
*pF
);
50 inline SwFrmOrObj( const SwFrm
*pF
, const SdrObject
*pO
);
51 inline SwFrmOrObj( const SwFrmOrObj
& r
);
53 inline SwFrmOrObj
& operator=( const SwFrmOrObj
& r
);
54 inline SwFrmOrObj
& operator=( const SdrObject
*pO
);
55 inline SwFrmOrObj
& operator=( const SwFrm
*pF
);
57 inline sal_Bool
operator==( const SwFrmOrObj
& r
) const;
58 inline sal_Bool
operator==( const SdrObject
*pO
) const;
59 inline sal_Bool
operator==( const SwFrm
*pF
) const;
61 inline sal_Bool
IsValid() const;
63 inline const SdrObject
*GetSdrObject() const;
64 inline const SwFrm
*GetSwFrm() const;
66 sal_Bool
IsAccessible( sal_Bool bPagePreview
) const;
67 sal_Bool
IsBoundAsChar() const;
68 inline sal_Bool
IsVisibleChildrenOnly() const;
69 inline SwRect
GetBox() const;
70 inline SwRect
GetBounds() const;
73 inline void SwFrmOrObj::Init( const SdrObject
*pO
)
77 pFrm
= pObj
&& pObj
->ISA(SwVirtFlyDrawObj
)
78 ? static_cast < const SwVirtFlyDrawObj
* >( pObj
)->GetFlyFrm()
82 inline void SwFrmOrObj::Init( const SwFrm
*pF
)
85 pObj
= pFrm
&& pFrm
->IsFlyFrm()
86 ? static_cast < const SwFlyFrm
* >( pFrm
)->GetVirtDrawObj()
90 inline SwFrmOrObj::SwFrmOrObj() :
94 inline SwFrmOrObj::SwFrmOrObj( const SdrObject
*pO
)
99 inline SwFrmOrObj::SwFrmOrObj( const SwFrm
*pF
)
104 inline SwFrmOrObj::SwFrmOrObj( const SwFrm
*pF
, const SdrObject
*pO
)
110 ASSERT( (!pF
|| pF
== pFrm
) && (!pO
|| pO
== pObj
),
111 "invalid frame/object combination" );
115 inline SwFrmOrObj::SwFrmOrObj( const SwFrmOrObj
& r
) :
116 pObj( r
.pObj
), pFrm( r
.pFrm
)
119 inline SwFrmOrObj
& SwFrmOrObj::operator=( const SwFrmOrObj
& r
)
126 inline SwFrmOrObj
& SwFrmOrObj::operator=( const SdrObject
*pO
)
132 inline SwFrmOrObj
& SwFrmOrObj::operator=( const SwFrm
*pF
)
138 inline sal_Bool
SwFrmOrObj::operator==( const SwFrmOrObj
& r
) const
140 return pObj
== r
.pObj
&& pFrm
== r
.pFrm
;
143 inline sal_Bool
SwFrmOrObj::operator==( const SdrObject
*pO
) const
148 inline sal_Bool
SwFrmOrObj::operator==( const SwFrm
*pF
) const
153 inline sal_Bool
SwFrmOrObj::IsValid() const
155 return pObj
!= 0 || pFrm
!= 0;
158 inline const SdrObject
*SwFrmOrObj::GetSdrObject() const
163 inline const SwFrm
*SwFrmOrObj::GetSwFrm() const
168 inline sal_Bool
SwFrmOrObj::IsVisibleChildrenOnly() const
170 return !pFrm
|| pFrm
->IsRootFrm() ||
171 !( pFrm
->IsTabFrm() || pFrm
->IsInTab() ||
173 static_cast<const SwFlyFrm
*>(pFrm
)->GetAnchorFrm()->IsInTab()) );
176 inline SwRect
SwFrmOrObj::GetBox() const
180 if( pFrm
->IsPageFrm() &&
181 static_cast< const SwPageFrm
* >( pFrm
)->IsEmptyPage() )
183 SwRect
aBox( pFrm
->Frm().Left(), pFrm
->Frm().Top()-1, 1, 1 );
186 else if ( pFrm
->IsTabFrm() )
188 SwRect
aBox( pFrm
->Frm() );
189 aBox
.Intersection( pFrm
->GetUpper()->Frm() );
196 return SwRect( pObj
->GetCurrentBoundRect() );
201 inline SwRect
SwFrmOrObj::GetBounds() const
205 if( pFrm
->IsPageFrm() &&
206 static_cast< const SwPageFrm
* >( pFrm
)->IsEmptyPage() )
208 SwRect
aBox( pFrm
->Frm().Left(), pFrm
->Frm().Top()-1, 0, 0 );
212 return pFrm
->PaintArea();
215 return SwRect( pObj
->GetCurrentBoundRect() );