23#include <com/sun/star/container/XChild.hpp>
24#include <com/sun/star/lang/XServiceInfo.hpp>
25#include <com/sun/star/xforms/XFormsSupplier.hpp>
26#include <com/sun/star/frame/XModule.hpp>
38 using ::com::sun::star::uno::Reference;
39 using ::com::sun::star::uno::XInterface;
40 using ::com::sun::star::container::XChild;
41 using ::com::sun::star::frame::XModel;
42 using ::com::sun::star::uno::UNO_QUERY;
43 using ::com::sun::star::frame::XModule;
46 template<
class TYPE >
47 Reference< TYPE > getTypedModelNode(
const Reference< XInterface >& _rxModelNode )
49 Reference< TYPE > xTypedNode( _rxModelNode, UNO_QUERY );
50 if ( xTypedNode.is() )
54 Reference< XChild > xChild( _rxModelNode, UNO_QUERY );
56 return getTypedModelNode< TYPE >( xChild->getParent() );
58 return Reference< TYPE >();
63 Reference< XModel > getDocument(
const Reference< XInterface >& _rxModelNode )
65 return getTypedModelNode< XModel >( _rxModelNode );
86 const ModuleInfo* lcl_getModuleInfo()
88 static const ModuleInfo aModuleInfo[] =
113 OSL_ENSURE( _rxDocumentModel.is(),
"DocumentClassification::classifyDocument: invalid document!" );
114 if ( !_rxDocumentModel.is() )
120 Reference< XModule > xModule( _rxDocumentModel, UNO_QUERY );
127 Reference< XServiceInfo > xSI( _rxDocumentModel, UNO_QUERY_THROW );
128 const ModuleInfo* pModuleInfo = lcl_getModuleInfo();
129 while ( pModuleInfo->pAsciiModuleOrServiceName )
131 if ( xSI->supportsService( OUString::createFromAscii( pModuleInfo->pAsciiModuleOrServiceName ) ) )
132 return pModuleInfo->eType;
137 OSL_FAIL(
"DocumentClassification::classifyDocument: unknown document!" );
154 Reference< XModel > xDocument( getDocument( _rxFormComponent ) );
155 if ( !xDocument.is() )
170 const ModuleInfo* pModuleInfo = lcl_getModuleInfo();
171 while ( pModuleInfo->pAsciiModuleOrServiceName )
173 if (
o3tl::equalsAscii(_rModuleIdentifier, pModuleInfo->pAsciiModuleOrServiceName ) )
174 return pModuleInfo->eType;
183 const ModuleInfo* pModuleInfo = lcl_getModuleInfo();
184 while ( pModuleInfo->pAsciiModuleOrServiceName )
186 if ( pModuleInfo->eType == _eType )
187 return OUString::createFromAscii( pModuleInfo->pAsciiModuleOrServiceName );
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
const char * pAsciiModuleOrServiceName
bool equalsAscii(std::u16string_view s1, std::string_view s2)