12#include <com/sun/star/beans/NamedValue.hpp>
13#include <com/sun/star/frame/Desktop.hpp>
14#include <com/sun/star/frame/XStorable.hpp>
25using namespace css::uno;
28 : mbSkipValidation(false)
29 , m_aBaseString(
std::move(path))
40 CPPUNIT_ASSERT_MESSAGE(
"no desktop!",
mxDesktop.is());
72 std::vector<beans::PropertyValue>& rFilterOptions)
74 OUString sPassword = OUString::createFromAscii(pPassword);
75 rFilterOptions.emplace_back();
79 rFilterOptions[0].Name =
"InteractionHandler";
80 rFilterOptions[0].Value <<= xInteraction;
91 std::vector<beans::PropertyValue> aFilterOptions;
100 beans::PropertyValue aValue;
101 aValue.Name =
"FilterOptions";
103 aFilterOptions.push_back(aValue);
108 beans::PropertyValue aValue;
109 aValue.Name =
"FilterName";
111 aFilterOptions.push_back(aValue);
119 CPPUNIT_ASSERT_MESSAGE(
"Password set but not requested",
127 load(aFileName, pPassword);
132 const uno::Sequence<uno::Any>& rParams)
135 uno::Sequence<sal_Int16> aOutParamIndex;
136 uno::Sequence<uno::Any> aOutParam;
139 aOutParamIndex, aOutParam);
148 aMediaDescriptor[
"FilterName"] <<= rFilter;
151 css::uno::Reference<frame::XStorable> xStorable(
mxComponent, css::uno::UNO_QUERY_THROW);
155 if (rFilter !=
"Office Open XML Text" && rFilter !=
"Calc Office Open XML"
156 && rFilter !=
"Impress Office Open XML")
158 aMediaDescriptor[
"Password"] <<= OUString::createFromAscii(pPassword);
162 OUString sPassword = OUString::createFromAscii(pPassword);
163 uno::Sequence<beans::NamedValue> aEncryptionData{
164 {
"CryptoType",
uno::Any(OUString(
"Standard")) },
165 {
"OOXPassword",
uno::Any(sPassword) }
174 xStorable->storeToURL(
maTempFile.
GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
178 if (rFilter ==
"Calc Office Open XML")
185 else if (rFilter ==
"Impress Office Open XML")
187 else if (rFilter ==
"writer8")
189 else if (rFilter ==
"calc8")
191 else if (rFilter ==
"impress8")
193 else if (rFilter ==
"draw8")
195 else if (rFilter ==
"OpenDocument Text Flat XML")
197 else if (rFilter ==
"MS Word 97")
199 else if (rFilter ==
"MS Excel 97")
201 else if (rFilter ==
"MS PowerPoint 97")
208 save(rFilter, pPassword);
222 std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
224 CPPUNIT_ASSERT(pPdfDocument);
232 CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, e);
static SfxApplication * GetOrCreate()
ErrCode CallXScript(const OUString &rScriptURL, const css::uno::Sequence< css::uno::Any > &aParams, css::uno::Any &aRet, css::uno::Sequence< sal_Int16 > &aOutParamIndex, css::uno::Sequence< css::uno::Any > &aOutParam, bool bRaiseError=true, const css::uno::Any *aCaller=nullptr)
SvStream & WriteStream(SvStream &rStream)
virtual void tearDown() override
css::uno::Reference< css::lang::XComponent > mxComponent2
OUString createFilePath(std::u16string_view aFileBase)
css::uno::Any executeMacro(const OUString &rScriptURL, const css::uno::Sequence< css::uno::Any > &rParams={})
rtl::Reference< TestInteractionHandler > xInteractionHandler
void saveAndReload(const OUString &rFilter, const char *pPassword=nullptr)
void createTempCopy(std::u16string_view fileName)
OUString loadFromURL(std::u16string_view aFileBase, const char *pPassword=nullptr)
OUString maImportFilterName
UnoApiTest(OUString path)
void load(const OUString &rURL, const char *pPassword=nullptr)
OUString createFileURL(std::u16string_view aFileBase)
virtual void setUp() override
std::unique_ptr< vcl::pdf::PDFiumDocument > parsePDFExport(const OString &rPassword=OString())
utl::TempFileNamed maTempFile
void setTestInteractionHandler(const char *pPassword, std::vector< com::sun::star::beans::PropertyValue > &rFilterOptions)
css::uno::Reference< css::lang::XComponent > mxComponent
OUString maImportFilterOptions
void save(const OUString &rFilter, const char *pPassword=nullptr)
const css::uno::Reference< css::lang::XMultiServiceFactory > & getMultiServiceFactory() const
virtual void tearDown() override
Directories m_directories
virtual void setUp() override
void validate(const OUString &rURL, ValidationFormat) const
const OUString & getSrcRootPath() const
const OUString & getSrcRootURL() const
css::uno::Reference< css::frame::XDesktop2 > mxDesktop
css::uno::Reference< css::lang::XComponent > loadFromDesktop(const OUString &rURL, const OUString &rDocService=OUString(), const css::uno::Sequence< css::beans::PropertyValue > &rExtra_args=css::uno::Sequence< css::beans::PropertyValue >())
void EnableKillingFile(bool bEnable=true)
OUString const & GetURL() const
OUString GetFileName() const
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
static std::shared_ptr< PDFium > & get()