22#include <com/sun/star/uno/Sequence.hxx>
23#include <com/sun/star/beans/PropertyValue.hpp>
24#include <com/sun/star/lang/XMultiServiceFactory.hpp>
25#include <com/sun/star/container/XNameAccess.hpp>
26#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
27#include <com/sun/star/ui/XUIConfigurationManager.hpp>
28#include <com/sun/star/graphic/XGraphic.hpp>
29#include <com/sun/star/ui/XImageManager.hpp>
36#include <osl/diagnose.h>
43 using ::com::sun::star::uno::Reference;
44 using ::com::sun::star::uno::Exception;
45 using ::com::sun::star::uno::Sequence;
46 using ::com::sun::star::uno::XComponentContext;
47 using ::com::sun::star::container::XNameAccess;
48 using ::com::sun::star::beans::PropertyValue;
49 using ::com::sun::star::ui::theModuleUIConfigurationManagerSupplier;
50 using ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier;
51 using ::com::sun::star::ui::XUIConfigurationManager;
52 using ::com::sun::star::ui::XImageManager;
53 using ::com::sun::star::graphic::XGraphic;
55 Reference< XGraphic> GetCommandIcon(
const char* _pCommandURL,
const OUString& _rModuleName )
57 if ( !_pCommandURL || !*_pCommandURL )
60 OUString sCommandURL = OUString::createFromAscii( _pCommandURL );
66 Reference< css::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
70 Reference< XModuleUIConfigurationManagerSupplier > xSupplier(
71 theModuleUIConfigurationManagerSupplier::get(xContext) );
73 Reference< XUIConfigurationManager > xManager( xSupplier->getUIConfigurationManager( _rModuleName ) );
74 Reference< XImageManager > xImageManager;
76 xImageManager.set(xManager->getImageManager(), css::uno::UNO_QUERY);
77 if ( !xImageManager.is() )
80 Sequence< OUString > aCommandList( &sCommandURL, 1 );
81 Sequence<Reference< XGraphic> > xIconList( xImageManager->getImages( 0, aCommandList ) );
82 if ( !xIconList.hasElements() )
89 catch ( Exception& ) {}
105 OSL_ENSURE( _pAsciiModuleName,
"OpenDocumentButton::impl_init: invalid module name!" );
106 m_sModule = OUString::createFromAscii( _pAsciiModuleName );
111 m_xControl->set_label(
" " + sLabel.replaceAll(
"~",
""));
123 int nWidth =
m_xControl->get_approximate_digit_width() * 50;
131 OSL_ENSURE( _pAsciiModuleName,
"OpenDocumentListBox::impl_init: invalid module name!" );
135 xFilterFactory.set(::comphelper::getProcessServiceFactory()->
createInstance(
136 "com.sun.star.document.FilterFactory" ), css::uno::UNO_QUERY);
143 OUString sURL = rHistoryItem.sURL;
144 OUString sFilter = rHistoryItem.sFilter;
145 OUString sTitle = rHistoryItem.sTitle;
146 OUString sPassword = rHistoryItem.sPassword;
151 xFilterFactory->getByName( sFilter ) >>= aProps;
155 "DocumentService", OUString() );
160 aURL.SetSmartURL( sURL );
162 if ( !sPassword.isEmpty() )
163 aURL.SetPass( sPassword );
165 if ( sTitle.isEmpty() )
171 m_aURLs.emplace_back(sDecodedURL, sFilter);
181 sal_Int32 nSelected =
m_xControl->get_active();
PropertiesInfo aProperties
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
constexpr OUStringLiteral sDocumentService
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
std::pair< OUString, OUString > StringPair
const StringPair & impl_getDocumentAtIndex(sal_uInt16 _nListIndex) const
std::vector< StringPair > m_aURLs
void impl_init(const char *_pAsciiModuleName)
OUString GetSelectedDocumentURL() const
std::unique_ptr< weld::ComboBox > m_xControl
OpenDocumentListBox(std::unique_ptr< weld::ComboBox > xControl, const char *_pAsciiModuleName)
std::vector< HistoryItem > GetList(EHistoryType eHistory)
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)