Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright IBM Corporation 2009, 2010.
7 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
8 : : *
9 : : * OpenOffice.org - a multi-platform office productivity suite
10 : : *
11 : : * This file is part of OpenOffice.org.
12 : : *
13 : : * OpenOffice.org is free software: you can redistribute it and/or modify
14 : : * it under the terms of the GNU Lesser General Public License version 3
15 : : * only, as published by the Free Software Foundation.
16 : : *
17 : : * OpenOffice.org is distributed in the hope that it will be useful,
18 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 : : * GNU Lesser General Public License version 3 for more details
21 : : * (a copy is included in the LICENSE file that accompanied this code).
22 : : *
23 : : * You should have received a copy of the GNU Lesser General Public License
24 : : * version 3 along with OpenOffice.org. If not, see
25 : : * <http://www.openoffice.org/license.html>
26 : : * for a copy of the LGPLv3 License.
27 : : *
28 : : ************************************************************************/
29 : :
30 : : #include "vbaquerytable.hxx"
31 : : #include "document.hxx"
32 : : #include "docsh.hxx"
33 : : #include "sfx2/lnkbase.hxx"
34 : : #include "sfx2/linkmgr.hxx"
35 : : #include "arealink.hxx"
36 : : #include "vbarange.hxx"
37 : :
38 : : using namespace com::sun::star;
39 : :
40 : :
41 : 0 : ScVbaQueryTable::ScVbaQueryTable(const css::uno::Reference< ov::XHelperInterface >& /*xParent*/,
42 : : const css::uno::Reference< css::uno::XComponentContext > & /*xContext*/,
43 : : ScDocument *pDocument ,
44 : : ScVbaRange *pParent
45 : 0 : )
46 : : //:QueryTable_Base(xParent, xContext)
47 : : {
48 : 0 : m_pDocument = pDocument;
49 : 0 : m_pParent = pParent;
50 : 0 : }
51 : :
52 : 0 : ScVbaQueryTable::~ScVbaQueryTable()
53 : : {
54 : :
55 [ # # ]: 0 : }
56 : :
57 : : ::sal_Bool SAL_CALL
58 : 0 : ScVbaQueryTable::Refresh( const ::com::sun::star::uno::Any& /*aBackgroundQuery*/ ) throw (::com::sun::star::uno::RuntimeException)
59 : : {
60 : :
61 : : //Get parent Info
62 [ # # ]: 0 : SCROW nRow = m_pParent->getRow();
63 [ # # ]: 0 : SCCOL nClm = m_pParent->getColumn();
64 [ # # ][ # # ]: 0 : SCTAB nTab = m_pParent->getWorksheet()->getIndex() - 1; //The vba index begin from 1.
[ # # ]
65 : 0 : ScAddress crrRngAddr(nClm, nRow, nTab);
66 : :
67 : : //Get link info
68 [ # # ]: 0 : sfx2::LinkManager *pLinkMng = m_pDocument->GetLinkManager();
69 : 0 : const ::sfx2::SvBaseLinks &rLinks = pLinkMng->GetLinks();
70 : 0 : sal_uInt16 nCount = rLinks.size();
71 : :
72 [ # # ]: 0 : for (sal_uInt16 i=0; i<nCount; i++)
73 : : {
74 : 0 : ::sfx2::SvBaseLink* pBase = *rLinks[i];
75 [ # # ][ # # ]: 0 : if (pBase->ISA(ScAreaLink))
[ # # ]
76 : : {
77 : :
78 : 0 : ScAreaLink *pAreaLink = (ScAreaLink *)pBase;
79 : 0 : const ScRange &destRange = pAreaLink->GetDestArea();
80 [ # # ]: 0 : if (destRange.In(crrRngAddr))
81 : : {
82 [ # # ]: 0 : pBase->Update();
83 : : }
84 : : }
85 : : }
86 : :
87 : 0 : return sal_True;
88 : : }
89 : :
90 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|