adjust cgm import to make testing easier
Change-Id: I2979af77522e085075d4f1e1e379fe82e614163b
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
<prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
|
<prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
|
||||||
<prop oor:name="UIComponent"/>
|
<prop oor:name="UIComponent"/>
|
||||||
<prop oor:name="FilterService"/>
|
<prop oor:name="FilterService"/>
|
||||||
<prop oor:name="UserData"><value>icg</value></prop>
|
<prop oor:name="UserData"><value></value></prop>
|
||||||
<prop oor:name="UIName">
|
<prop oor:name="UIName">
|
||||||
<value xml:lang="en-US">CGM - Computer Graphics Metafile</value>
|
<value xml:lang="en-US">CGM - Computer Graphics Metafile</value>
|
||||||
</prop>
|
</prop>
|
||||||
|
@@ -43,6 +43,10 @@ public:
|
|||||||
bool IsDraw() const { return mbIsDraw; }
|
bool IsDraw() const { return mbIsDraw; }
|
||||||
virtual bool Export() = 0;
|
virtual bool Export() = 0;
|
||||||
|
|
||||||
|
#ifndef DISABLE_DYNLOADING
|
||||||
|
static ::osl::Module* OpenLibrary( const OUString& rLibraryName );
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
css::uno::Reference< css::frame::XModel > mxModel;
|
css::uno::Reference< css::frame::XModel > mxModel;
|
||||||
css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator;
|
css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator;
|
||||||
@@ -51,9 +55,6 @@ protected:
|
|||||||
::sd::DrawDocShell& mrDocShell;
|
::sd::DrawDocShell& mrDocShell;
|
||||||
SdDrawDocument& mrDocument;
|
SdDrawDocument& mrDocument;
|
||||||
bool mbIsDraw : 1;
|
bool mbIsDraw : 1;
|
||||||
#ifndef DISABLE_DYNLOADING
|
|
||||||
static ::osl::Module* OpenLibrary( const OUString& rLibraryName );
|
|
||||||
#endif
|
|
||||||
void CreateStatusIndicator();
|
void CreateStatusIndicator();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -26,14 +26,15 @@
|
|||||||
#include <svx/xflclit.hxx>
|
#include <svx/xflclit.hxx>
|
||||||
#include <svx/xfillit0.hxx>
|
#include <svx/xfillit0.hxx>
|
||||||
|
|
||||||
|
#include "sddll.hxx"
|
||||||
#include "sdpage.hxx"
|
#include "sdpage.hxx"
|
||||||
#include "drawdoc.hxx"
|
#include "drawdoc.hxx"
|
||||||
#include "sdcgmfilter.hxx"
|
#include "sdcgmfilter.hxx"
|
||||||
|
|
||||||
|
#include "../../ui/inc/DrawDocShell.hxx"
|
||||||
|
|
||||||
#define CGM_IMPORT_CGM 0x00000001
|
#define CGM_IMPORT_CGM 0x00000001
|
||||||
|
|
||||||
#define CGM_EXPORT_IMPRESS 0x00000100
|
#define CGM_EXPORT_IMPRESS 0x00000100
|
||||||
|
|
||||||
#define CGM_BIG_ENDIAN 0x00020000
|
#define CGM_BIG_ENDIAN 0x00020000
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
@@ -58,24 +59,36 @@ SdCGMFilter::~SdCGMFilter()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
class CGMPointer
|
||||||
|
{
|
||||||
|
ImportCGMPointer m_pPointer;
|
||||||
|
#ifndef DISABLE_DYNLOADING
|
||||||
|
std::unique_ptr<osl::Module> m_xLibrary;
|
||||||
|
#endif
|
||||||
|
public:
|
||||||
|
CGMPointer()
|
||||||
|
{
|
||||||
|
#ifdef DISABLE_DYNLOADING
|
||||||
|
m_pPointer = ImportCGM;
|
||||||
|
#else
|
||||||
|
m_xLibrary.reset(SdFilter::OpenLibrary("icg"));
|
||||||
|
m_pPointer = m_xLibrary ? reinterpret_cast<ImportCGMPointer>(m_xLibrary->getFunctionSymbol("ImportCGM")) : nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
ImportCGMPointer get() { return m_pPointer; }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
bool SdCGMFilter::Import()
|
bool SdCGMFilter::Import()
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_DYNLOADING
|
|
||||||
::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() );
|
|
||||||
#endif
|
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
|
|
||||||
if(
|
CGMPointer aPointer;
|
||||||
#ifndef DISABLE_DYNLOADING
|
ImportCGMPointer FncImportCGM = aPointer.get();
|
||||||
pLibrary &&
|
if (FncImportCGM && mxModel.is())
|
||||||
#endif
|
|
||||||
mxModel.is() )
|
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_DYNLOADING
|
|
||||||
ImportCGMPointer FncImportCGM = reinterpret_cast< ImportCGMPointer >( pLibrary->getFunctionSymbol( "ImportCGM" ) );
|
|
||||||
#else
|
|
||||||
ImportCGMPointer FncImportCGM = ImportCGM;
|
|
||||||
#endif
|
|
||||||
OUString aFileURL( mrMedium.GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
|
OUString aFileURL( mrMedium.GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
|
||||||
sal_uInt32 nRetValue;
|
sal_uInt32 nRetValue;
|
||||||
|
|
||||||
@@ -105,9 +118,6 @@ bool SdCGMFilter::Import()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef DISABLE_DYNLOADING
|
|
||||||
delete pLibrary;
|
|
||||||
#endif
|
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,4 +127,19 @@ bool SdCGMFilter::Export()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportCGM(SvStream &rStream)
|
||||||
|
{
|
||||||
|
SdDLL::Init();
|
||||||
|
|
||||||
|
::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell(SfxObjectCreateMode::EMBEDDED, false);
|
||||||
|
|
||||||
|
CGMPointer aPointer;
|
||||||
|
|
||||||
|
bool bRet = aPointer.get()(rStream, xDocShRef->GetModel(), CGM_IMPORT_CGM | CGM_BIG_ENDIAN | CGM_EXPORT_IMPRESS, css::uno::Reference<css::task::XStatusIndicator>()) == 0;
|
||||||
|
|
||||||
|
xDocShRef->DoClose();
|
||||||
|
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -430,6 +430,21 @@ try_again:
|
|||||||
SvFileStream aFileStream(out, StreamMode::READ);
|
SvFileStream aFileStream(out, StreamMode::READ);
|
||||||
ret = (int) (*pfnImport)(aFileStream);
|
ret = (int) (*pfnImport)(aFileStream);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(argv[2], "cgm") == 0)
|
||||||
|
{
|
||||||
|
static FFilterCall pfnImport(nullptr);
|
||||||
|
if (!pfnImport)
|
||||||
|
{
|
||||||
|
osl::Module aLibrary;
|
||||||
|
aLibrary.loadRelative(&thisModule, "libsdlo.so", SAL_LOADMODULE_LAZY);
|
||||||
|
pfnImport = reinterpret_cast<FFilterCall>(
|
||||||
|
aLibrary.getFunctionSymbol("TestImportCGM"));
|
||||||
|
aLibrary.release();
|
||||||
|
}
|
||||||
|
SvFileStream aFileStream(out, StreamMode::READ);
|
||||||
|
ret = (int) (*pfnImport)(aFileStream);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user