LibreOffice Module sc (master) 1
dbfunc4.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/svditer.hxx>
21#include <svx/svdoole2.hxx>
22#include <svx/svdpage.hxx>
23#include <osl/diagnose.h>
24
25#include <dbfunc.hxx>
26#include <drwlayer.hxx>
27#include <document.hxx>
28
29using namespace com::sun::star;
30
31sal_uInt16 ScDBFunc::DoUpdateCharts(const ScAddress& rPos, ScDocument& rDoc, bool bAllCharts)
32{
33 ScDrawLayer* pModel = rDoc.GetDrawLayer();
34 if (!pModel)
35 return 0;
36
37 sal_uInt16 nFound = 0;
38
39 sal_uInt16 nPageCount = pModel->GetPageCount();
40 for (sal_uInt16 nPageNo = 0; nPageNo < nPageCount; nPageNo++)
41 {
42 SdrPage* pPage = pModel->GetPage(nPageNo);
43 OSL_ENSURE(pPage, "Page ?");
44
45 SdrObjListIter aIter(pPage, SdrIterMode::DeepNoGroups);
46 SdrObject* pObject = aIter.Next();
47 while (pObject)
48 {
49 if (pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart(pObject))
50 {
51 OUString aName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName();
52 bool bHit = true;
53 if (!bAllCharts)
54 {
55 ScRangeList aRanges;
56 bool bColHeaders = false;
57 bool bRowHeaders = false;
58 rDoc.GetOldChartParameters(aName, aRanges, bColHeaders, bRowHeaders);
59 bHit = aRanges.Contains(rPos);
60 }
61 if (bHit)
62 {
63 rDoc.UpdateChart(aName);
64 ++nFound;
65 }
66 }
67 pObject = aIter.Next();
68 }
69 }
70 return nFound;
71}
72
73/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static sal_uInt16 DoUpdateCharts(const ScAddress &rPos, ScDocument &rDoc, bool bAllCharts)
Definition: dbfunc4.cxx:31
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1084
static bool IsChart(const SdrObject *pObject)
Definition: documen9.cxx:209
void UpdateChart(const OUString &rName)
Definition: documen5.cxx:335
void GetOldChartParameters(std::u16string_view rName, ScRangeList &rRanges, bool &rColHeaders, bool &rRowHeaders)
Definition: documen5.cxx:204
bool Contains(const ScRange &) const
Definition: rangelst.cxx:1082
const SdrPage * GetPage(sal_uInt16 nPgNum) const
sal_uInt16 GetPageCount() const
SdrObject * Next()
EmbeddedObjectRef * pObject
OUString aName