xref: /aoo42x/main/sc/source/ui/view/dbfunc4.cxx (revision b3f79822)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 
28 
29 //------------------------------------------------------------------
30 
31 // INCLUDE ---------------------------------------------------------------
32 
33 #include <svx/svditer.hxx>
34 #include <svx/svdoole2.hxx>
35 #include <svx/svdpage.hxx>
36 
37 #include "dbfunc.hxx"
38 #include "drwlayer.hxx"
39 #include "document.hxx"
40 
41 // -----------------------------------------------------------------------
42 
43 #ifdef _MSC_VER
44 #pragma optimize ( "", off )
45 #endif
46 
47 using namespace com::sun::star;
48 
49 //==================================================================
50 
51 // static
DoUpdateCharts(const ScAddress & rPos,ScDocument * pDoc,sal_Bool bAllCharts)52 sal_uInt16 ScDBFunc::DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc, sal_Bool bAllCharts )
53 {
54 	ScDrawLayer* pModel = pDoc->GetDrawLayer();
55 	if (!pModel)
56 		return 0;
57 
58 	sal_uInt16 nFound = 0;
59 
60 	sal_uInt16 nPageCount = pModel->GetPageCount();
61 	for (sal_uInt16 nPageNo=0; nPageNo<nPageCount; nPageNo++)
62 	{
63 		SdrPage* pPage = pModel->GetPage(nPageNo);
64 		DBG_ASSERT(pPage,"Page ?");
65 
66 		SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS );
67 		SdrObject* pObject = aIter.Next();
68 		while (pObject)
69 		{
70             if ( pObject->GetObjIdentifier() == OBJ_OLE2 && pDoc->IsChart( pObject ) )
71 			{
72                 String aName = ((SdrOle2Obj*)pObject)->GetPersistName();
73                 sal_Bool bHit = sal_True;
74                 if ( !bAllCharts )
75                 {
76                     ScRangeList aRanges;
77                     sal_Bool bColHeaders = sal_False;
78                     sal_Bool bRowHeaders = sal_False;
79                     pDoc->GetOldChartParameters( aName, aRanges, bColHeaders, bRowHeaders );
80                     bHit = aRanges.In( rPos );
81                 }
82                 if ( bHit )
83                 {
84                     pDoc->UpdateChart( aName );
85                     ++nFound;
86                 }
87 			}
88 			pObject = aIter.Next();
89 		}
90 	}
91 	return nFound;
92 }
93 
94 
95 
96 
97 
98 
99