26#include <com/sun/star/frame/Desktop.hpp>
27#include <com/sun/star/frame/XModel2.hpp>
28#include <com/sun/star/frame/FrameSearchFlag.hpp>
34 using ::com::sun::star::uno::Exception;
35 using ::com::sun::star::uno::Reference;
36 using ::com::sun::star::uno::UNO_QUERY_THROW;
37 using ::com::sun::star::uno::UNO_SET_THROW;
38 using ::com::sun::star::frame::Desktop;
39 using ::com::sun::star::frame::XDesktop2;
40 using ::com::sun::star::container::XEnumeration;
41 using ::com::sun::star::frame::XModel;
42 using ::com::sun::star::frame::XFrames;
43 using ::com::sun::star::frame::XController;
44 using ::com::sun::star::frame::XModel2;
45 using ::com::sun::star::uno::UNO_QUERY;
46 using ::com::sun::star::uno::Sequence;
47 using ::com::sun::star::frame::XFrame;
49 namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
54 , m_pFilter( _pFilter )
66 OSL_PRECOND( _io_rDocDesc.
xModel.is(),
"lcl_getDocumentControllers_nothrow: illegal model!" );
75 while ( xEnum->hasMoreElements() )
81 else if ( _io_rDocDesc.
xModel.is() )
84 catch(
const Exception& )
90 void lcl_getDocuments_nothrow(
const Sequence< Reference< XFrame > >& _rFrames,
Documents& _out_rDocuments,
91 const IDocumentDescriptorFilter* _pFilter )
94 std::set< Reference< XModel > > aEncounteredModels;
96 for (
auto const & rFrame : _rFrames )
100 OSL_ENSURE( rFrame.is(),
"lcl_getDocuments_nothrow: illegal frame!" );
103 Reference< XController >
xController( rFrame->getController() );
113 if ( !aEncounteredModels.insert( xModel ).second )
119 DocumentDescriptor aDescriptor;
120 aDescriptor.xModel =
xModel;
121 lcl_getDocumentControllers_nothrow( aDescriptor );
124 if ( _pFilter && !_pFilter->includeDocument( aDescriptor ) )
127 _out_rDocuments.push_back( aDescriptor );
129 catch(
const Exception& )
139 _out_rDocuments.clear();
147 lcl_getDocuments_nothrow( aFrames, _out_rDocuments,
m_pFilter );
Reference< XComponentContext > m_xContext
css::uno::Reference< css::uno::XComponentContext > m_xContext
void getDocuments(Documents &_out_rDocuments) const
retrieves a list of all currently known documents in the application
const IDocumentDescriptorFilter * m_pFilter
DocumentEnumeration(css::uno::Reference< css::uno::XComponentContext > const &_rContext, const IDocumentDescriptorFilter *_pFilter)
allows pre-filtering when enumerating document descriptors
#define DBG_UNHANDLED_EXCEPTION(...)
std::vector< DocumentDescriptor > Documents
css::uno::Reference< css::frame::XModel > xModel
Reference< XController > xController
Reference< XModel > xModel
std::vector< uno::Reference< frame::XModel > > Documents