no need to dynamically ImportCGM symbol
we are preloading this library anyway, so whatever benefit this might have provided is long gone Change-Id: I36ca42de5f802c73b2e2da3b52a996657298211f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139865 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
c70ee4a6b9
commit
5cc45f148d
7 changed files with 34 additions and 37 deletions
|
@ -25,6 +25,10 @@ $(eval $(call gb_Library_use_external,icg,boost_headers))
|
|||
|
||||
$(eval $(call gb_Library_use_sdk_api,icg))
|
||||
|
||||
$(eval $(call gb_Library_add_defs,icg,\
|
||||
-DFILTER_DLLIMPLEMENTATION \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_use_libraries,icg,\
|
||||
comphelper \
|
||||
cppuhelper \
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <com/sun/star/task/XStatusIndicator.hpp>
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <osl/endian.h>
|
||||
#include <filter/importcgm.hxx>
|
||||
#include <tools/stream.hxx>
|
||||
#include "bitmap.hxx"
|
||||
#include "chart.hxx"
|
||||
|
@ -683,7 +683,7 @@ bool CGM::Write( SvStream& rIStm )
|
|||
};
|
||||
|
||||
// GraphicImport - the exported function
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT sal_uInt32
|
||||
FILTER_DLLPUBLIC sal_uInt32
|
||||
ImportCGM(SvStream& rIn, uno::Reference< frame::XModel > const & rXModel, css::uno::Reference<css::task::XStatusIndicator> const & aXStatInd)
|
||||
{
|
||||
|
||||
|
|
22
include/filter/importcgm.hxx
Normal file
22
include/filter/importcgm.hxx
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <com/sun/star/frame/XModel.hpp>
|
||||
#include <com/sun/star/task/XStatusIndicator.hpp>
|
||||
#include <filter/dllapi.h>
|
||||
|
||||
class SvStream;
|
||||
|
||||
FILTER_DLLPUBLIC sal_uInt32
|
||||
ImportCGM(SvStream& rIn, css::uno::Reference<css::frame::XModel> const& rXModel,
|
||||
css::uno::Reference<css::task::XStatusIndicator> const& aXStatInd);
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
|
@ -31,6 +31,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_uimpress,\
|
|||
editeng \
|
||||
i18nlangtag \
|
||||
i18nutil \
|
||||
icg \
|
||||
msfilter \
|
||||
oox \
|
||||
sal \
|
||||
|
|
|
@ -79,6 +79,7 @@ $(eval $(call gb_Library_use_libraries,sd,\
|
|||
editeng \
|
||||
i18nlangtag \
|
||||
i18nutil \
|
||||
icg \
|
||||
msfilter \
|
||||
oox \
|
||||
sal \
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <filter/importcgm.hxx>
|
||||
#include <tools/urlobj.hxx>
|
||||
#include <unotools/ucbstreamhelper.hxx>
|
||||
#include <sfx2/docfile.hxx>
|
||||
|
@ -36,14 +37,6 @@ using namespace ::com::sun::star::uno;
|
|||
using namespace ::com::sun::star::task;
|
||||
using namespace ::com::sun::star::frame;
|
||||
|
||||
typedef sal_uInt32 ( *ImportCGMPointer )(SvStream&, Reference< XModel > const &, Reference< XStatusIndicator > const &);
|
||||
|
||||
#ifdef DISABLE_DYNLOADING
|
||||
|
||||
extern "C" sal_uInt32 ImportCGM(SvStream&, Reference< XModel > const &, Reference< XStatusIndicator > const &);
|
||||
|
||||
#endif
|
||||
|
||||
SdCGMFilter::SdCGMFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell ) :
|
||||
SdFilter( rMedium, rDocShell )
|
||||
{
|
||||
|
@ -53,32 +46,11 @@ SdCGMFilter::~SdCGMFilter()
|
|||
{
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
class CGMPointer
|
||||
{
|
||||
ImportCGMPointer m_pPointer;
|
||||
public:
|
||||
CGMPointer()
|
||||
{
|
||||
#ifdef DISABLE_DYNLOADING
|
||||
m_pPointer = ImportCGM;
|
||||
#else
|
||||
m_pPointer = reinterpret_cast<ImportCGMPointer>(
|
||||
SdFilter::GetLibrarySymbol("icg", "ImportCGM"));
|
||||
#endif
|
||||
}
|
||||
ImportCGMPointer get() { return m_pPointer; }
|
||||
};
|
||||
}
|
||||
|
||||
bool SdCGMFilter::Import()
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
CGMPointer aPointer;
|
||||
ImportCGMPointer FncImportCGM = aPointer.get();
|
||||
if (FncImportCGM && mxModel.is())
|
||||
if (mxModel.is())
|
||||
{
|
||||
OUString aFileURL( mrMedium.GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
|
||||
sal_uInt32 nRetValue;
|
||||
|
@ -88,7 +60,7 @@ bool SdCGMFilter::Import()
|
|||
|
||||
CreateStatusIndicator();
|
||||
std::unique_ptr<SvStream> xIn(::utl::UcbStreamHelper::CreateStream(aFileURL, StreamMode::READ));
|
||||
nRetValue = xIn ? FncImportCGM(*xIn, mxModel, mxStatusIndicator) : 0;
|
||||
nRetValue = xIn ? ImportCGM(*xIn, mxModel, mxStatusIndicator) : 0;
|
||||
|
||||
if( nRetValue )
|
||||
{
|
||||
|
@ -124,10 +96,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportCGM(SvStream &rStream)
|
|||
|
||||
::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell(SfxObjectCreateMode::EMBEDDED, false, DocumentType::Impress);
|
||||
|
||||
CGMPointer aPointer;
|
||||
|
||||
xDocShRef->GetDoc()->EnableUndo(false);
|
||||
bool bRet = aPointer.get()(rStream, xDocShRef->GetModel(), css::uno::Reference<css::task::XStatusIndicator>()) == 0;
|
||||
bool bRet = ImportCGM(rStream, xDocShRef->GetModel(), css::uno::Reference<css::task::XStatusIndicator>()) == 0;
|
||||
|
||||
xDocShRef->DoClose();
|
||||
|
||||
|
|
|
@ -89,7 +89,6 @@ oslGenericFunction SdFilter::GetLibrarySymbol( const OUString& rLibraryName, con
|
|||
void SdFilter::Preload()
|
||||
{
|
||||
(void)GetLibrarySymbol("sdfilt", "ImportPPT");
|
||||
(void)GetLibrarySymbol("icg", "ImportCGM");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue