26#include <com/sun/star/container/XEnumeration.hpp>
27#include <com/sun/star/frame/Desktop.hpp>
28#include <com/sun/star/frame/XModel2.hpp>
29#include <com/sun/star/frame/ModuleManager.hpp>
44 return frame::ModuleManager::create(xContext);
47typedef std::vector<uno::Reference<frame::XModel>> ModelVector;
49ModelVector CreateDocumentsEnumeration(
56 OUString aIdentifier = xModuleManager->identify( rxModel );
60 while( xEnumeration->hasMoreElements() )
63 if( xModuleManager->identify( xCurrModel ) == aIdentifier )
64 models.push_back( xCurrModel );
67 catch(
const uno::Exception& )
77 if( rxModel.is() )
try
79 if( bLockControllers )
80 rxModel->lockControllers();
82 rxModel->unlockControllers();
84 catch(
const uno::Exception& )
100 while( xControllersEnum->hasMoreElements() )
107 xWindow->setEnable( bEnableWindows );
109 catch(
const uno::Exception& )
114 catch(
const uno::Exception& )
127 ModelVector models(CreateDocumentsEnumeration(rxModel));
129 for (
auto const& xCurrModel : models)
133 pModifyDocumentFunc(xCurrModel, bModificator);
135 catch (
const uno::Exception&)
153 lclIterateDocuments( &lclLockControllers, rxModel, bLockControllers );
159 lclIterateDocuments( &lclEnableContainerWindows, rxModel, bEnableWindows );
165 if( rPath.isEmpty() )
168 static CurrDirPool StaticCurrDirPool;
170 CurrDirPool& rPool = StaticCurrDirPool;
171 std::unique_lock aGuard( rPool.maMutex );
175 OUString aIdentifier = xModuleManager->identify( rxModel );
176 if( !aIdentifier.isEmpty() )
177 rPool.maCurrDirs[ aIdentifier ] = rPath;
179 catch(
const uno::Exception& )
void enableContainerWindowsOfAllDocuments(const uno::Reference< frame::XModel > &rxModel, bool bEnableWindows)
void lockControllersOfAllDocuments(const uno::Reference< frame::XModel > &rxModel, bool bLockControllers)
void registerCurrentDirectory(const uno::Reference< frame::XModel > &rxModel, const OUString &rPath)
Reference< XController > xController
Reference< XFrame > xFrame
std::map< OUString, OUString > maCurrDirs