21#include <document.hxx>
27#include <config_features.h>
29#include <com/sun/star/container/XContainer.hpp>
30#include <com/sun/star/script/XLibraryContainer.hpp>
33using ::com::sun::star::uno::Reference;
47 ModuleCellMap::iterator itr =
maCells.find(rModuleName);
50 pair<ModuleCellMap::iterator, bool> r =
maCells.emplace(
51 rModuleName, vector<ScFormulaCell*>());
59 itr->second.push_back(pCell);
66 rEntry.second.erase(std::remove(rEntry.second.begin(), rEntry.second.end(), pCell), rEntry.second.end() );
72 ModuleCellMap::iterator itr =
maCells.find(rModuleName);
76 vector<ScFormulaCell*>& rCellList = itr->second;
79 std::sort(rCellList.begin(), rCellList.end());
80 auto last = std::unique(rCellList.begin(), rCellList.end());
81 rCellList.erase(
last, rCellList.end());
84 vector<ScFormulaCell*> temp(rCellList);
89 typedef std::unordered_map<OUString, vector<ScFormulaCell*>>
ModuleCellMap;
111 explicit VBAProjectListener(
ScMacroManager* pMacroMgr ) : mpMacroMgr( pMacroMgr ) {}
113 virtual void SAL_CALL disposing(
const lang::EventObject& )
override {}
116 virtual void SAL_CALL
elementInserted(
const container::ContainerEvent& )
override {}
117 virtual void SAL_CALL
elementReplaced(
const container::ContainerEvent& Event )
override
119 OUString sModuleName;
120 Event.Accessor >>= sModuleName;
124 virtual void SAL_CALL
elementRemoved(
const container::ContainerEvent& )
override {}
134 OUString sProjectName(
"Standard");
136 Reference< container::XContainer > xModuleContainer;
140#if HAVE_FEATURE_SCRIPTING
142 if (!pBasicManager->
GetName().isEmpty())
144 sProjectName = pBasicManager->
GetName();
149 Reference< script::XLibraryContainer > xLibraries( pShell->
GetBasicContainer(), uno::UNO_SET_THROW );
150 xModuleContainer.set( xLibraries->getByName( sProjectName ), uno::UNO_QUERY_THROW );
159 catch (
const uno::Exception&)
189 vector<ScFormulaCell*> aCells;
#define BCA_LISTEN_ALWAYS
const OUString & GetName() const
void StartListeningArea(const ScRange &rRange, bool bGroupListening, SvtListener *pListener)
SfxObjectShell * GetDocumentShell() const
void PutInFormulaTree(ScFormulaCell *pCell)
SC_DLLPUBLIC void InitUserFuncData()
ScMacroManager(ScDocument &rDoc)
void BroadcastModuleUpdate(const OUString &aModuleName)
SC_DLLPUBLIC void SetUserFuncVolatile(const OUString &sName, bool isVolatile)
SC_DLLPUBLIC bool GetUserFuncVolatile(const OUString &sName)
void AddDependentCell(const OUString &aModuleName, ScFormulaCell *pCell)
void RemoveDependentCell(const ScFormulaCell *pCell)
::std::unique_ptr< ScUserMacroDepTracker > mpDepTracker
css::uno::Reference< css::container::XContainerListener > mxContainerListener
NameBoolMap mhFuncToVolatile
A simple container to keep track of cells that depend on basic modules changes.
void removeCell(const ScFormulaCell *pCell)
std::unordered_map< OUString, vector< ScFormulaCell * > > ModuleCellMap
void getCellsByModule(const OUString &rModuleName, vector< ScFormulaCell * > &rCells)
void addCell(const OUString &rModuleName, ScFormulaCell *pCell)
css::uno::Reference< css::script::XLibraryContainer > GetBasicContainer()
BasicManager * GetBasicManager() const
void SAL_CALL elementReplaced(const css::container::ContainerEvent &Event) override
void SAL_CALL elementRemoved(const css::container::ContainerEvent &Event) override
DECL_LISTENERMULTIPLEXER_END void SAL_CALL elementInserted(const css::container::ContainerEvent &Event) override
::cppu::WeakImplHelper< css::container::XContainerListener > ContainerListenerHelper
::cppu::WeakImplHelper< css::container::XContainerListener > ContainerListenerHelper
constexpr OUStringLiteral last