update dev300-m58
[ooovba.git] / sw / source / core / access / accfrmobjmap.hxx
blobbfd83cb4ac186342409594c711739541868e416c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: accfrmobjmap.hxx,v $
10 * $Revision: 1.5 $
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 _ACCFRMOBJMAP_HXX
31 #define _ACCFRMOBJMAP_HXX
32 #include <accfrmobj.hxx>
34 #include <map>
36 class SwDoc;
38 class SwFrmOrObjMapKey
40 public:
41 enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS };
42 private:
44 LayerId eLayerId;
45 sal_uInt32 nOrdNum;
47 public:
49 inline SwFrmOrObjMapKey();
50 inline SwFrmOrObjMapKey( LayerId eId, sal_uInt32 nOrd );
52 inline sal_Bool operator()( const SwFrmOrObjMapKey& r1,
53 const SwFrmOrObjMapKey& r2 ) const;
56 typedef ::std::map < SwFrmOrObjMapKey, SwFrmOrObj, SwFrmOrObjMapKey >
57 _SwFrmOrObjMap;
59 class SwFrmOrObjMap : public _SwFrmOrObjMap
61 SdrLayerID nHellId;
62 SdrLayerID nControlsId;
63 sal_Bool bLayerIdsValid;
65 ::std::pair< iterator, bool > insert( sal_uInt32 nPos,
66 const SwFrmOrObj& rLower );
67 ::std::pair< iterator, bool > insert( const SdrObject *pObj,
68 const SwFrmOrObj& rLower,
69 const SwDoc *pDoc );
71 public:
73 SwFrmOrObjMap( const SwRect& rVisArea, const SwFrm *pFrm );
75 inline static sal_Bool IsSortingRequired( const SwFrm *pFrm );
78 inline SwFrmOrObjMapKey::SwFrmOrObjMapKey() :
79 eLayerId( INVALID ),
80 nOrdNum( 0 )
84 inline SwFrmOrObjMapKey::SwFrmOrObjMapKey(
85 LayerId eId, sal_uInt32 nOrd ) :
86 eLayerId( eId ),
87 nOrdNum( nOrd )
91 inline sal_Bool SwFrmOrObjMapKey::operator()(
92 const SwFrmOrObjMapKey& r1,
93 const SwFrmOrObjMapKey& r2 ) const
95 return (r1.eLayerId == r2.eLayerId) ? (r1.nOrdNum < r2.nOrdNum) :
96 (r1.eLayerId < r2.eLayerId);
99 inline sal_Bool SwFrmOrObjMap::IsSortingRequired( const SwFrm *pFrm )
101 return ( pFrm->IsPageFrm() &&
102 static_cast< const SwPageFrm * >( pFrm )->GetSortedObjs() ) ||
103 (pFrm->IsTxtFrm() && pFrm->GetDrawObjs() );
106 #endif