LibreOffice Module svx (master) 1
svdviter.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <svx/svdviter.hxx>
21#include <svx/svdobj.hxx>
22#include <svx/svdpage.hxx>
23#include <svx/svdmodel.hxx>
24#include <svx/svdview.hxx>
25#include <svx/svdpagv.hxx>
26#include <svx/svdsob.hxx>
27
29{
30 mnListenerNum = 0;
31 mpCurrentView = nullptr;
32}
33
35{
36 mpPage = pPage;
37 mpModel = pPage ? &pPage->getSdrModelFromSdrPage() : nullptr;
38 mpObject = nullptr;
40}
41
43{
45 mpModel = pObject ? &pObject->getSdrModelFromSdrObject() : nullptr;
46 mpPage = pObject ? pObject->getSdrPageFromSdrObject() : nullptr;
47
48 if (!mpModel || !mpPage)
49 {
50 mpModel = nullptr;
51 mpPage = nullptr;
52 }
53
55}
56
58{
59 if (!mpPage)
60 return true;
61
62 bool bMaster(mpPage->IsMasterPage());
63 SdrPage* pPg = pPV->GetPage();
64
65 if (pPg == mpPage)
66 {
67 if (mpObject)
68 {
69 // Looking for an object? First, determine if it visible in
70 // this PageView.
71 SdrLayerIDSet aObjLay;
73 aObjLay &= pPV->GetVisibleLayers();
74 return !aObjLay.IsEmpty();
75 }
76 else
77 {
78 return true;
79 }
80 }
81 else if (bMaster && (!mpObject || !mpObject->IsNotVisibleAsMaster()))
82 {
83 if (pPg->TRG_HasMasterPage())
84 {
85 SdrPage& rMasterPage = pPg->TRG_GetMasterPage();
86
87 if (&rMasterPage == mpPage)
88 {
89 // the page we're looking for is a master page in this PageView
90 if (mpObject)
91 {
92 // Looking for an object? First, determine if it visible in
93 // this PageView.
94 SdrLayerIDSet aObjLay;
96 aObjLay &= pPV->GetVisibleLayers();
97 aObjLay &= pPg->TRG_GetMasterPageVisibleLayers();
98
99 if (!aObjLay.IsEmpty())
100 {
101 return true;
102 } // else, look at the next master page of this page...
103 }
104 else
105 {
106 return true;
107 }
108 }
109 }
110 }
111
112 // master page forbidden or no fitting master page found
113 return false;
114}
115
117{
118 if (mpModel)
119 {
120 const size_t nLsCnt(mpModel->GetSizeOfVector());
121
122 while (mnListenerNum < nLsCnt)
123 {
126 = pLs ? (pLs->IsSdrView() ? static_cast<SdrView*>(pLs) : nullptr) : nullptr;
127
128 if (mpCurrentView)
129 {
130 if (mpPage)
131 {
133
134 if (pPV && ImpCheckPageView(pPV))
135 {
136 return mpCurrentView;
137 }
138 }
139 else
140 {
141 return mpCurrentView;
142 }
143 }
144
146 }
147 }
148
149 mpCurrentView = nullptr;
150 return mpCurrentView;
151}
152
154{
155 ImpInitVars();
156 return ImpFindView();
157}
158
160{
162 return ImpFindView();
163}
164
165/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsEmpty() const
Definition: svdlayer.cxx:28
Abstract DrawObject.
Definition: svdobj.hxx:261
void getMergedHierarchySdrLayerIDSet(SdrLayerIDSet &rSet) const
Definition: svdobj.cxx:650
bool IsNotVisibleAsMaster() const
Definition: svdobj.hxx:841
const SdrLayerIDSet & GetVisibleLayers() const
Definition: svdpagv.hxx:210
SdrPage * GetPage() const
Definition: svdpagv.hxx:166
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:377
SdrPage & TRG_GetMasterPage() const
Definition: svdpage.cxx:1666
bool IsMasterPage() const
Definition: svdpage.hxx:462
bool TRG_HasMasterPage() const
Definition: svdpage.hxx:498
const SdrLayerIDSet & TRG_GetMasterPageVisibleLayers() const
Definition: svdpage.cxx:1672
SdrModel & getSdrModelFromSdrPage() const
Definition: svdpage.hxx:401
SdrPageView * GetSdrPageView() const
Definition: svdpntv.hxx:300
SdrView * NextView()
Definition: svdviter.cxx:159
SVX_DLLPRIVATE bool ImpCheckPageView(SdrPageView const *pPV) const
Definition: svdviter.cxx:57
const SdrModel * mpModel
Definition: svdviter.hxx:63
SdrView * FirstView()
Definition: svdviter.cxx:153
const SdrPage * mpPage
Definition: svdviter.hxx:64
SVX_DLLPRIVATE void ImpInitVars()
Definition: svdviter.cxx:28
const SdrObject * mpObject
Definition: svdviter.hxx:65
size_t mnListenerNum
Definition: svdviter.hxx:68
SVX_DLLPRIVATE SdrView * ImpFindView()
Definition: svdviter.cxx:116
SdrViewIter(const SdrPage *pPage)
Definition: svdviter.cxx:34
SdrView * mpCurrentView
Definition: svdviter.hxx:66
SfxListener * GetListener(size_t nNo) const
size_t GetSizeOfVector() const
virtual bool IsSdrView() const
EmbeddedObjectRef * pObject