LibreOffice Module filter (master) 1
xmlfiltertestdialog.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21#include <com/sun/star/beans/XPropertySet.hpp>
22#include <com/sun/star/document/XFilter.hpp>
23#include <com/sun/star/document/XExporter.hpp>
24#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
25#include <com/sun/star/document/XGraphicStorageHandler.hpp>
26#include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
27#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp>
28#include <com/sun/star/frame/Desktop.hpp>
29#include <com/sun/star/frame/XStorable.hpp>
30#include <com/sun/star/lang/XMultiServiceFactory.hpp>
31#include <com/sun/star/lang/XServiceInfo.hpp>
32#include <com/sun/star/system/SystemShellExecute.hpp>
33#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
34#include <com/sun/star/task/InteractionHandler.hpp>
35#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
36#include <com/sun/star/xml/XImportFilter.hpp>
37#include <com/sun/star/xml/XExportFilter.hpp>
38#include <com/sun/star/xml/sax/Writer.hpp>
39
42#include <vcl/svapp.hxx>
44#include <osl/file.hxx>
45#include <unotools/tempfile.hxx>
47#include <tools/debug.hxx>
48#include <tools/urlobj.hxx>
50
51#include "xmlfiltercommon.hxx"
53
54
55using namespace utl;
56using namespace osl;
57using namespace comphelper;
58using namespace com::sun::star::lang;
59using namespace com::sun::star::beans;
60using namespace com::sun::star::container;
61using namespace com::sun::star::document;
62using namespace com::sun::star::frame;
63using namespace com::sun::star::task;
64using namespace com::sun::star::uno;
65using namespace com::sun::star::io;
66using namespace com::sun::star::system;
67using namespace com::sun::star::xml;
68using namespace com::sun::star::xml::sax;
69
70namespace {
71
72class GlobalEventListenerImpl : public ::cppu::WeakImplHelper< css::document::XDocumentEventListener >
73{
74public:
75 explicit GlobalEventListenerImpl( XMLFilterTestDialog* pDialog );
76
77 // XDocumentEventListener
78 virtual void SAL_CALL documentEventOccured( const css::document::DocumentEvent& Event ) override;
79
80 // lang::XEventListener
81 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
82private:
83 XMLFilterTestDialog* mpDialog;
84};
85
86}
87
88GlobalEventListenerImpl::GlobalEventListenerImpl( XMLFilterTestDialog* pDialog )
89: mpDialog( pDialog )
90{
91}
92
93void SAL_CALL GlobalEventListenerImpl::documentEventOccured( const css::document::DocumentEvent& Event )
94{
95 ::SolarMutexGuard aGuard;
96 if( Event.EventName == "OnFocus" || Event.EventName == "OnUnload" )
97 {
98 Reference< XComponent > xComp( Event.Source, UNO_QUERY );
99 mpDialog->updateCurrentDocumentButtonState( &xComp );
100 }
101}
102
103void SAL_CALL GlobalEventListenerImpl::disposing( const css::lang::EventObject& /* Source */ )
104{
105}
106
108static bool checkComponent( Reference< XComponent > const & rxComponent, const OUString& rServiceName )
109{
110 try
111 {
112 Reference< XServiceInfo > xInfo( rxComponent, UNO_QUERY );
113 if( xInfo.is() )
114 {
115 if( xInfo->supportsService( rServiceName ) )
116 {
117 // special case for impress documents which supports same service as draw documents
118 if ( rServiceName == "com.sun.star.drawing.DrawingDocument" )
119 {
120 // so if we want a draw we need to check if it's not an impress
121 if( !xInfo->supportsService("com.sun.star.presentation.PresentationDocument") )
122 return true;
123 }
124 else
125 {
126 return true;
127 }
128 }
129 }
130 }
131 catch( const Exception& )
132 {
133 TOOLS_WARN_EXCEPTION("filter.xslt", "");
134 }
135
136 return false;
137}
138
140 const Reference<XComponentContext>& rxContext)
141 : GenericDialogController(pParent, "filter/ui/testxmlfilter.ui", "TestXMLFilterDialog")
142 , mxContext(rxContext)
143 , m_xExport(m_xBuilder->weld_widget("export"))
144 , m_xFTExportXSLTFile(m_xBuilder->weld_label("exportxsltfile"))
145 , m_xPBExportBrowse(m_xBuilder->weld_button("exportbrowse"))
146 , m_xPBCurrentDocument(m_xBuilder->weld_button("currentdocument"))
147 , m_xFTNameOfCurrentFile(m_xBuilder->weld_label("currentfilename"))
148 , m_xImport(m_xBuilder->weld_widget("import"))
149 , m_xFTImportXSLTFile(m_xBuilder->weld_label("importxsltfile"))
150 , m_xFTImportTemplate(m_xBuilder->weld_label("templateimport"))
151 , m_xFTImportTemplateFile(m_xBuilder->weld_label("importxslttemplate"))
152 , m_xCBXDisplaySource(m_xBuilder->weld_check_button("displaysource"))
153 , m_xPBImportBrowse(m_xBuilder->weld_button("importbrowse"))
154 , m_xPBRecentFile(m_xBuilder->weld_button("recentfile"))
155 , m_xFTNameOfRecentFile(m_xBuilder->weld_label("recentfilename"))
156 , m_xPBClose(m_xBuilder->weld_button("close"))
157{
158 m_xPBExportBrowse->connect_clicked(LINK( this, XMLFilterTestDialog, ClickHdl_Impl ) );
159 m_xPBCurrentDocument->connect_clicked(LINK( this, XMLFilterTestDialog, ClickHdl_Impl ) );
160 m_xPBImportBrowse->connect_clicked(LINK( this, XMLFilterTestDialog, ClickHdl_Impl ) );
161 m_xPBRecentFile->connect_clicked(LINK( this, XMLFilterTestDialog, ClickHdl_Impl ) );
162 m_xPBClose->connect_clicked(LINK( this, XMLFilterTestDialog, ClickHdl_Impl ) );
163
164 m_sDialogTitle = m_xDialog->get_title();
165
166 try
167 {
168 mxGlobalBroadcaster = theGlobalEventBroadcaster::get(mxContext);
169 mxGlobalEventListener = new GlobalEventListenerImpl( this );
170 mxGlobalBroadcaster->addDocumentEventListener( mxGlobalEventListener );
171 }
172 catch( const Exception& )
173 {
174 TOOLS_WARN_EXCEPTION("filter.xslt", "");
175 }
176}
177
179{
180 try
181 {
182 if( mxGlobalBroadcaster.is() )
183 mxGlobalBroadcaster->removeDocumentEventListener( mxGlobalEventListener );
184 }
185 catch( const Exception& )
186 {
187 TOOLS_WARN_EXCEPTION("filter.xslt", "");
188 }
189}
190
192{
193 m_xFilterInfo.reset(new filter_info_impl( rFilterInfo ));
194
195 m_sImportRecentFile.clear();
196
197 initDialog();
198
199 m_xDialog->run();
200}
201
202static OUString getFileNameFromURL( std::u16string_view rURL )
203{
204 INetURLObject aURL( rURL );
206 return aName;
207}
208
210{
211 if( pRef && pRef->is() )
212 {
213 if( checkComponent( *pRef, m_xFilterInfo->maDocumentService ) )
214 mxLastFocusModel = *pRef;
215 }
216
217 bool bExport = (m_xFilterInfo->maFlags & 2) == 2;
218 Reference< XComponent > xCurrentDocument;
219 if( bExport )
220 xCurrentDocument = getFrontMostDocument( m_xFilterInfo->maDocumentService );
221 m_xPBCurrentDocument->set_sensitive( bExport && xCurrentDocument.is() );
222 m_xFTNameOfCurrentFile->set_sensitive( bExport && xCurrentDocument.is() );
223
224 if( !xCurrentDocument.is() )
225 return;
226
227 OUString aTitle;
228 Reference< XDocumentPropertiesSupplier > xDPS( xCurrentDocument, UNO_QUERY );
229 if( xDPS.is() )
230 {
231 Reference< XDocumentProperties > xProps( xDPS->getDocumentProperties() );
232 if( xProps.is() )
233 {
234 aTitle = xProps->getTitle();
235 }
236 }
237
238 if( aTitle.isEmpty() )
239 {
240 Reference< XStorable > xStorable( xCurrentDocument, UNO_QUERY );
241 if( xStorable.is() )
242 {
243 if( xStorable->hasLocation() )
244 {
245 OUString aURL( xStorable->getLocation() );
246 aTitle = getFileNameFromURL( aURL );
247 }
248 }
249 }
250
251 m_xFTNameOfCurrentFile->set_label( aTitle );
252}
253
255{
256 DBG_ASSERT( m_xFilterInfo, "i need a filter I can test!" );
257 if( nullptr == m_xFilterInfo )
258 return;
259
260 OUString aTitle( m_sDialogTitle );
261 aTitle = aTitle.replaceFirst( "%s", m_xFilterInfo->maFilterName );
262 m_xDialog->set_title( aTitle );
263
264 bool bImport = (m_xFilterInfo->maFlags & 1) == 1;
265 bool bExport = (m_xFilterInfo->maFlags & 2) == 2;
266
268
269 m_xExport->set_sensitive(bExport);
270 m_xFTExportXSLTFile->set_label( getFileNameFromURL( m_xFilterInfo->maExportXSLT ) );
271
272
273 m_xImport->set_sensitive(bImport);
274 m_xFTImportTemplate->set_sensitive(bImport && !m_xFilterInfo->maImportTemplate.isEmpty());
275 m_xFTImportTemplateFile->set_sensitive(bImport && !m_xFilterInfo->maImportTemplate.isEmpty());
276 m_xPBRecentFile->set_sensitive(bImport && !m_sImportRecentFile.isEmpty());
277 m_xFTNameOfRecentFile->set_sensitive(bImport && !m_sImportRecentFile.isEmpty());
278
279 m_xFTImportXSLTFile->set_label( getFileNameFromURL( m_xFilterInfo->maImportXSLT ) );
280 m_xFTImportTemplateFile->set_label( getFileNameFromURL( m_xFilterInfo->maImportTemplate ) );
282}
283
285{
286 try
287 {
288 // Open Fileopen-Dialog
290 css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
291 FileDialogFlags::NONE, m_xDialog.get());
292
293 Reference< XNameAccess > xFilterContainer( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.FilterFactory", mxContext ), UNO_QUERY );
294 Reference< XNameAccess > xTypeDetection( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.TypeDetection", mxContext ), UNO_QUERY );
295 if( xFilterContainer.is() && xTypeDetection.is() )
296 {
297 const Sequence< OUString > aFilterNames( xFilterContainer->getElementNames() );
298
299 for( OUString const & filterName : aFilterNames )
300 {
302
303 Any aAny( xFilterContainer->getByName( filterName ) );
304 if( !(aAny >>= aValues) )
305 continue;
306
307 OUString aInterfaceName;
308 OUString aType, aService;
309 sal_Int32 nFlags( 0 );
310
311 int nFound = 0;
312
313 for( const PropertyValue& rValue : std::as_const(aValues) )
314 {
315 if ( rValue.Name == "Type" )
316 {
317 rValue.Value >>= aType;
318 nFound |= 1;
319 }
320 else if ( rValue.Name == "DocumentService" )
321 {
322 rValue.Value >>= aService;
323 nFound |= 2;
324 }
325 else if ( rValue.Name == "Flags" )
326 {
327 rValue.Value >>= nFlags;
328 nFound |= 4;
329 }
330 else if ( rValue.Name == "UIName" )
331 {
332 rValue.Value >>= aInterfaceName;
333 nFound |= 8;
334 }
335
336 if (nFound == 15)
337 break;
338 }
339
340 if( (nFound == 15) && (!aType.isEmpty() && aService == m_xFilterInfo->maDocumentService) )
341 {
342 // see if this filter is not suppressed in dialog
343 if( (nFlags & 0x1000) == 0 )
344 {
345 aAny = xTypeDetection->getByName( aType );
347
348 if( aAny >>= aValues2 )
349 {
350 OUString aExtension;
351 for( const PropertyValue& rProp : std::as_const(aValues2) )
352 {
353 if ( rProp.Name == "Extensions" )
354 {
355 Sequence< OUString > aExtensions;
356 if( rProp.Value >>= aExtensions )
357 {
358 const sal_Int32 nCount( aExtensions.getLength() );
359 OUString* pExtensions = aExtensions.getArray();
360 sal_Int32 n;
361 for( n = 0; n < nCount; n++ )
362 {
363 if( n > 0 )
364 aExtension += ";";
365 aExtension += "*." + *pExtensions++;
366 }
367 }
368 }
369 }
370
371 OUString aFilterName( aInterfaceName + " (" + aExtension + ")" );
372
373 aDlg.AddFilter( aFilterName, aExtension );
374
375 if( (nFlags & 0x100) == 0x100 )
376 aDlg.SetCurrentFilter( aFilterName );
377 }
378 }
379 }
380
381 }
382 }
383
385
386 if ( aDlg.Execute() == ERRCODE_NONE )
387 {
389
390 Reference< XDesktop2 > xLoader = Desktop::create( mxContext );
391 Reference< XInteractionHandler2 > xInter = InteractionHandler::createWithParent(mxContext, nullptr);
393 xInter) };
394 Reference< XComponent > xComp( xLoader->loadComponentFromURL( m_sExportRecentFile, "_default", 0, aArguments ) );
395 if( xComp.is() )
396 {
397 doExport( xComp );
398 }
399 }
400 }
401 catch(const Exception&)
402 {
403 TOOLS_WARN_EXCEPTION("filter.xslt", "");
404 }
405
406 initDialog();
407}
408
410{
411 doExport( getFrontMostDocument( m_xFilterInfo->maDocumentService ) );
412}
413
415{
416 try
417 {
418 Reference< XStorable > xStorable( xComp, UNO_QUERY );
419 if( xStorable.is() )
420 {
421 utl::TempFileNamed aTempFile(u"", true, u".xml");
422 OUString aTempFileURL( aTempFile.GetURL() );
423
424 const application_info_impl* pAppInfo = getApplicationInfo( m_xFilterInfo->maExportService );
425 if( pAppInfo )
426 {
427 File aOutputFile( aTempFileURL );
428 (void)aOutputFile.open( osl_File_OpenFlag_Write );
429
430 // create xslt exporter
432 int bUseDocType = m_xFilterInfo->maDocType.isEmpty() ? 0 : 1;
433 Sequence< PropertyValue > aSourceData( 2 + bUseDocType );
434 auto pSourceData = aSourceData.getArray();
435 int i = 0;
436
437
438 pSourceData[i ].Name = "OutputStream";
439 pSourceData[i++].Value <<= xIS;
440
441 pSourceData[i].Name = "Indent";
442 pSourceData[i++].Value <<= true;
443
444 if( bUseDocType )
445 {
446 pSourceData[i ].Name = "DocType_Public";
447 pSourceData[i++].Value <<= m_xFilterInfo->maDocType;
448 }
449
450 Reference< XExportFilter > xExporter( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.documentconversion.XSLTFilter", mxContext ), UNO_QUERY );
451 Reference< XDocumentHandler > xHandler( xExporter, UNO_QUERY );
452 if( xHandler.is() )
453 {
454 Sequence< OUString > aFilterUserData( m_xFilterInfo->getFilterUserData() );
455 xExporter->exporter( aSourceData, aFilterUserData );
456
457 Reference< XMultiServiceFactory > xDocFac( xComp, UNO_QUERY );
458
460 Reference<XGraphicStorageHandler> xGraphicStorageHandler;
461
462 if( xDocFac.is() )
463 {
464 try
465 {
466 xGraphicStorageHandler.set(xDocFac->createInstance("com.sun.star.document.ExportGraphicStorageHandler"), UNO_QUERY);
467 xObjectResolver.set( xDocFac->createInstance("com.sun.star.document.ExportEmbeddedObjectResolver"), UNO_QUERY );
468 }
469 catch( const Exception& )
470 {
471 }
472 }
473
474 Sequence< Any > aArgs( 1 + ( xGraphicStorageHandler.is() ? 1 : 0 ) + ( xObjectResolver.is() ? 1 : 0 ) );
475 Any* pArgs = aArgs.getArray();
476 if (xGraphicStorageHandler.is())
477 *pArgs++ <<= xGraphicStorageHandler;
478
479 if (xObjectResolver.is())
480 *pArgs++ <<= xObjectResolver;
481
482 // *pArgs++ <<= xInfoSet;
483 *pArgs <<= xHandler;
484
485 Reference< XFilter > xFilter( mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( pAppInfo->maXMLExporter, aArgs, mxContext ), UNO_QUERY );
486 if( xFilter.is() )
487 {
488 Reference< XExporter > xExporter2( xFilter, UNO_QUERY );
489 if( xExporter2.is() )
490 {
491 xExporter2->setSourceDocument( xComp );
492
494 "FileName", aTempFileURL) };
495
496 if( xFilter->filter( aDescriptor ) )
497 displayXMLFile( aTempFileURL );
498 }
499 }
500 }
501 }
502 }
503 }
504 catch( const Exception& )
505 {
506 TOOLS_WARN_EXCEPTION("filter.xslt", "");
507 }
508}
509
510void XMLFilterTestDialog::displayXMLFile( const OUString& rURL )
511{
512 Reference< XSystemShellExecute > xSystemShellExecute(
513 SystemShellExecute::create(comphelper::getProcessComponentContext()) );
514 xSystemShellExecute->execute( rURL, OUString(), SystemShellExecuteFlags::URIS_ONLY );
515}
516
518{
519 // Open Fileopen-Dialog
521 css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
522 FileDialogFlags::NONE, m_xDialog.get());
523 OUString aFilterName( m_xFilterInfo->maInterfaceName );
524 OUString aExtensions;
525
526 int nLastIndex = 0;
527 int nCurrentIndex = 0;
528 for( int i = 0; nLastIndex != -1; i++ )
529 {
530 nLastIndex = m_xFilterInfo->maExtension.indexOf( ';', nLastIndex );
531
532 if( i > 0 )
533 aExtensions += ";";
534
535 aExtensions += "*.";
536
537 if( nLastIndex == -1 )
538 {
539
540 aExtensions += m_xFilterInfo->maExtension.subView( nCurrentIndex );
541 }
542 else
543 {
544 aExtensions += m_xFilterInfo->maExtension.subView( nCurrentIndex, nLastIndex - nCurrentIndex );
545 nCurrentIndex = nLastIndex + 1;
546 nLastIndex = nCurrentIndex;
547 }
548 }
549
550 aFilterName += " (" + aExtensions + ")";
551
552 aDlg.AddFilter( aFilterName, aExtensions );
554
555 if ( aDlg.Execute() == ERRCODE_NONE )
556 {
558 import( m_sImportRecentFile );
559 }
560
561 initDialog();
562}
563
564void XMLFilterTestDialog::import( const OUString& rURL )
565{
566 try
567 {
568 Reference< XDesktop2 > xLoader = Desktop::create( mxContext );
569 Reference< XInteractionHandler2 > xInter = InteractionHandler::createWithParent(mxContext, nullptr);
570
572 comphelper::makePropertyValue("FilterName", m_xFilterInfo->maFilterName),
573 comphelper::makePropertyValue("InteractionHandler", xInter)
574 };
575
576 xLoader->loadComponentFromURL( rURL, "_default", 0, aArguments );
577
578 if( m_xCBXDisplaySource->get_active() )
579 {
580 TempFileNamed aTempFile(u"", true, u".xml");
581 OUString aTempFileURL( aTempFile.GetURL() );
582
583 Reference< XImportFilter > xImporter( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.documentconversion.XSLTFilter", mxContext ), UNO_QUERY );
584 if( xImporter.is() )
585 {
586 osl::File aInputFile( rURL );
587 (void)aInputFile.open( osl_File_OpenFlag_Read );
588
590
591 Sequence< PropertyValue > aSourceData{
592 comphelper::makePropertyValue("InputStream", xIS),
593 comphelper::makePropertyValue("FileName", rURL),
594 comphelper::makePropertyValue("Indent", true)
595 };
596
597 Reference< XWriter > xWriter = Writer::create( mxContext );
598
599 File aOutputFile( aTempFileURL );
600 (void)aOutputFile.open( osl_File_OpenFlag_Write );
601
602 Reference< XOutputStream > xOS( new OSLOutputStreamWrapper( aOutputFile ) );
603 xWriter->setOutputStream( xOS );
604
605 Sequence< OUString > aFilterUserData( m_xFilterInfo->getFilterUserData() );
606 xImporter->importer( aSourceData, xWriter, aFilterUserData );
607 }
608
609 displayXMLFile( aTempFileURL );
610 }
611 }
612 catch(const Exception&)
613 {
614 TOOLS_WARN_EXCEPTION("filter.xslt", "");
615 }
616}
617
618IMPL_LINK(XMLFilterTestDialog, ClickHdl_Impl, weld::Button&, rButton, void )
619{
620 if (m_xPBExportBrowse.get() == &rButton)
621 {
622 onExportBrowse();
623 }
624 else if (m_xPBCurrentDocument.get() == &rButton)
625 {
626 onExportCurrentDocument();
627 }
628 else if (m_xPBImportBrowse.get() == &rButton)
629 {
630 onImportBrowse();
631 }
632 else if (m_xPBRecentFile.get() == &rButton)
633 {
634 import( m_sImportRecentFile );
635 }
636 else if (m_xPBClose.get() == &rButton)
637 {
638 m_xDialog->response(RET_CLOSE);
639 }
640}
641
644{
646
647 try
648 {
649 Reference< XDesktop2 > xDesktop = Desktop::create( mxContext );
651 if( checkComponent( xTest, rServiceName ) )
652 {
653 xRet = xTest;
654 }
655 else
656 {
657 xTest = xDesktop->getCurrentComponent();
658
659 if( checkComponent( xTest, rServiceName ) )
660 {
661 xRet = xTest;
662 }
663 else
664 {
665 Reference< XEnumerationAccess > xAccess( xDesktop->getComponents() );
666 if( xAccess.is() )
667 {
668 Reference< XEnumeration > xEnum( xAccess->createEnumeration() );
669 if( xEnum.is() )
670 {
671 while( xEnum->hasMoreElements() )
672 {
673 if( (xEnum->nextElement() >>= xTest) && xTest.is() )
674 {
675 if( checkComponent( xTest, rServiceName ) )
676 {
677 xRet = xTest;
678 break;
679 }
680 }
681 }
682 }
683 }
684 }
685 }
686 }
687 catch( const Exception& )
688 {
689 TOOLS_WARN_EXCEPTION("filter.xslt", "");
690 }
691
692 return xRet;
693}
694
695/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::Widget > m_xExport
std::unique_ptr< weld::Label > m_xFTImportTemplateFile
std::unique_ptr< weld::Widget > m_xImport
std::unique_ptr< weld::Button > m_xPBRecentFile
void test(const filter_info_impl &rFilterInfo)
void updateCurrentDocumentButtonState(css::uno::Reference< css::lang::XComponent > const *pRef=nullptr)
static void displayXMLFile(const OUString &rURL)
std::unique_ptr< weld::Button > m_xPBImportBrowse
std::unique_ptr< weld::Button > m_xPBExportBrowse
css::uno::Reference< css::document::XDocumentEventListener > mxGlobalEventListener
std::unique_ptr< weld::Label > m_xFTImportXSLTFile
XMLFilterTestDialog(weld::Window *pParent, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
css::uno::Reference< css::lang::XComponent > getFrontMostDocument(const OUString &rServiceName)
returns the front most open component that supports the given service
virtual ~XMLFilterTestDialog() override
std::unique_ptr< weld::Label > m_xFTExportXSLTFile
css::uno::WeakReference< css::lang::XComponent > mxLastFocusModel
std::unique_ptr< filter_info_impl > m_xFilterInfo
css::uno::Reference< css::document::XDocumentEventBroadcaster > mxGlobalBroadcaster
void import(const OUString &rURL)
void doExport(const css::uno::Reference< css::lang::XComponent > &xComp)
std::unique_ptr< weld::Label > m_xFTNameOfRecentFile
std::unique_ptr< weld::CheckButton > m_xCBXDisplaySource
std::unique_ptr< weld::Button > m_xPBCurrentDocument
std::unique_ptr< weld::Label > m_xFTNameOfCurrentFile
css::uno::Reference< css::uno::XComponentContext > mxContext
std::unique_ptr< weld::Button > m_xPBClose
std::unique_ptr< weld::Label > m_xFTImportTemplate
OUString GetPath() const
void AddFilter(const OUString &rFilterName, const OUString &rExtension)
void SetDisplayDirectory(const OUString &rPath)
void SetCurrentFilter(const OUString &rFilter)
OUString const & GetURL() const
std::shared_ptr< weld::Dialog > m_xDialog
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
URL aURL
uno::Reference< uno::XComponentContext > mxContext
float u
#define ERRCODE_NONE
Sequence< PropertyValue > aArguments
OUString aName
sal_Int64 n
@ Exception
Reference< XComponentContext > getProcessComponentContext()
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
int i
Definition: gentoken.py:48
RET_CLOSE
const application_info_impl * getApplicationInfo(std::u16string_view rServiceName)
IMPL_LINK(XMLFilterTestDialog, ClickHdl_Impl, weld::Button &, rButton, void)
static bool checkComponent(Reference< XComponent > const &rxComponent, const OUString &rServiceName)
returns true if the given component supports the given service
static OUString getFileNameFromURL(std::u16string_view rURL)