1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "svx/svdviter.hxx"
31 #include <svx/svdobj.hxx>
32 #include <svx/svdpage.hxx>
33 #include <svx/svdmodel.hxx>
34 #include <svx/svdview.hxx>
35 #include <svx/svdpagv.hxx>
36 #include <svx/svdsob.hxx>
37 #include <svl/brdcst.hxx>
38 #include <svx/sdrpaintwindow.hxx>
40 ////////////////////////////////////////////////////////////////////////////////////////////////////
42 void SdrViewIter::ImpInitVars()
50 ////////////////////////////////////////////////////////////////////////////////////////////////////
52 SdrViewIter::SdrViewIter(const SdrPage
* pPage
, sal_Bool bNoMasterPage
)
55 mpModel
= (pPage
) ? pPage
->GetModel() : 0L;
57 mbNoMasterPage
= bNoMasterPage
;
61 ////////////////////////////////////////////////////////////////////////////////////////////////////
63 SdrViewIter::SdrViewIter(const SdrObject
* pObject
, sal_Bool bNoMasterPage
)
66 mpModel
= (pObject
) ? pObject
->GetModel() : 0L;
67 mpPage
= (pObject
) ? pObject
->GetPage() : 0L;
68 mbNoMasterPage
= bNoMasterPage
;
70 if(!mpModel
|| !mpPage
)
79 ////////////////////////////////////////////////////////////////////////////////////////////////////
81 sal_Bool
SdrViewIter::ImpCheckPageView(SdrPageView
* pPV
) const
85 sal_Bool
bMaster(mpPage
->IsMasterPage());
86 SdrPage
* pPg
= pPV
->GetPage();
92 // Looking for an object? First, determine if it visible in
95 mpObject
->getMergedHierarchyLayerSet(aObjLay
);
96 aObjLay
&= pPV
->GetVisibleLayers();
97 return !aObjLay
.IsEmpty();
106 if(!mbNoMasterPage
&& bMaster
&& (!mpObject
|| !mpObject
->IsNotVisibleAsMaster()))
108 if(pPg
->TRG_HasMasterPage())
110 SdrPage
& rMasterPage
= pPg
->TRG_GetMasterPage();
112 if(&rMasterPage
== mpPage
)
114 // the page we're looking for is a master page in this PageView
117 // Looking for an object? First, determine if it visible in
120 mpObject
->getMergedHierarchyLayerSet(aObjLay
);
121 aObjLay
&= pPV
->GetVisibleLayers();
122 aObjLay
&= pPg
->TRG_GetMasterPageVisibleLayers();
124 if(!aObjLay
.IsEmpty())
127 } // else, look at the next master page of this page...
137 // master page forbidden or no fitting master page found
147 ////////////////////////////////////////////////////////////////////////////////////////////////////
149 SdrView
* SdrViewIter::ImpFindView()
153 sal_uInt32
nLsAnz(mpModel
->GetListenerCount());
155 while(mnListenerNum
< nLsAnz
)
157 SfxListener
* pLs
= mpModel
->GetListener((sal_uInt16
)mnListenerNum
);
158 mpAktView
= PTR_CAST(SdrView
, pLs
);
164 SdrPageView
* pPV
= mpAktView
->GetSdrPageView();
168 if(ImpCheckPageView(pPV
))
188 ////////////////////////////////////////////////////////////////////////////////////////////////////
190 SdrView
* SdrViewIter::FirstView()
193 return ImpFindView();
196 ////////////////////////////////////////////////////////////////////////////////////////////////////
198 SdrView
* SdrViewIter::NextView()
201 return ImpFindView();
204 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */