cid#1607171 Data race condition
[LibreOffice.git] / sc / source / ui / view / dbfunc4.cxx
blob56e1512c677554ec8d411a5a98ba67f1cbbadd76
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svx/svditer.hxx>
21 #include <svx/svdoole2.hxx>
22 #include <svx/svdpage.hxx>
23 #include <osl/diagnose.h>
25 #include <dbfunc.hxx>
26 #include <drwlayer.hxx>
27 #include <document.hxx>
29 using namespace com::sun::star;
31 sal_uInt16 ScDBFunc::DoUpdateCharts(const ScAddress& rPos, ScDocument& rDoc, bool bAllCharts)
33 ScDrawLayer* pModel = rDoc.GetDrawLayer();
34 if (!pModel)
35 return 0;
37 sal_uInt16 nFound = 0;
39 sal_uInt16 nPageCount = pModel->GetPageCount();
40 for (sal_uInt16 nPageNo = 0; nPageNo < nPageCount; nPageNo++)
42 SdrPage* pPage = pModel->GetPage(nPageNo);
43 OSL_ENSURE(pPage, "Page ?");
45 SdrObjListIter aIter(pPage, SdrIterMode::DeepNoGroups);
46 SdrObject* pObject = aIter.Next();
47 while (pObject)
49 if (pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart(pObject))
51 OUString aName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName();
52 bool bHit = true;
53 if (!bAllCharts)
55 ScRangeList aRanges;
56 bool bColHeaders = false;
57 bool bRowHeaders = false;
58 rDoc.GetOldChartParameters(aName, aRanges, bColHeaders, bRowHeaders);
59 bHit = aRanges.Contains(ScRange(rPos));
61 if (bHit)
63 rDoc.UpdateChart(aName);
64 ++nFound;
67 pObject = aIter.Next();
70 return nFound;
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */