[Libreoffice-commits] core.git: 7 commits - filter/source sc/source sd/inc sd/source vcl/source vcl/workben xmloff/source
Caolán McNamara
caolanm at redhat.com
Sat Apr 1 18:51:54 UTC 2017
filter/source/config/fragments/filters/CGM___Computer_Graphics_Metafile.xcu | 2
filter/source/graphicfilter/icgm/cgm.cxx | 60 ++++----
filter/source/graphicfilter/icgm/cgm.hxx | 6
filter/source/graphicfilter/icgm/class7.cxx | 27 +---
sc/source/core/tool/interpr1.cxx | 20 +-
sd/inc/sdfilter.hxx | 7 -
sd/source/filter/cgm/sdcgmfilter.cxx | 67 ++++++----
vcl/source/window/toolbox.cxx | 6
vcl/workben/fftester.cxx | 15 ++
xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx | 4
xmloff/source/text/XMLLineNumberingImportContext.cxx | 4
11 files changed, 122 insertions(+), 96 deletions(-)
New commits:
commit 6a9478481c42a717191cc6beb8534e263b98036d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Apr 1 19:26:53 2017 +0100
coverity#1403666 Uninitialized scalar variable
and a bunch others
Change-Id: I569913ddab8eba2c168b1aa0877fbfc809dc34b6
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index f8d682a9c1c5..fb1503e697d2 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3994,9 +3994,9 @@ void ScInterpreter::ScColumn()
{
case svSingleRef :
{
- SCCOL nCol1;
- SCROW nRow1;
- SCTAB nTab1;
+ SCCOL nCol1(0);
+ SCROW nRow1(0);
+ SCTAB nTab1(0);
PopSingleRef( nCol1, nRow1, nTab1 );
nVal = (double) (nCol1 + 1);
}
@@ -4075,9 +4075,9 @@ void ScInterpreter::ScRow()
{
case svSingleRef :
{
- SCCOL nCol1;
- SCROW nRow1;
- SCTAB nTab1;
+ SCCOL nCol1(0);
+ SCROW nRow1(0);
+ SCTAB nTab1(0);
PopSingleRef( nCol1, nRow1, nTab1 );
nVal = (double) (nRow1 + 1);
}
@@ -4142,10 +4142,10 @@ void ScInterpreter::ScSheet()
break;
case svSingleRef :
{
- SCCOL nCol1;
- SCROW nRow1;
- SCTAB nTab1;
- PopSingleRef( nCol1, nRow1, nTab1 );
+ SCCOL nCol1(0);
+ SCROW nRow1(0);
+ SCTAB nTab1(0);
+ PopSingleRef(nCol1, nRow1, nTab1);
nVal = nTab1 + 1;
}
break;
commit 18713e5e922d60439b5850dcc2640c654dffcdb7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Apr 1 19:16:07 2017 +0100
coverity#1403664 Dereference null return value
and
coverity#1403663 Dereference null return value
Change-Id: I17b7f977e802aa5bdc5b58895fe2cdeea2c96ebe
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index d026b94b7c6e..75cc405e2f32 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -4822,8 +4822,8 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt )
// leave toolbox and move focus to document
if( mnHighItemId )
{
- ImplToolItem *pItem = ImplGetItem( mnHighItemId );
- if( !pItem->mbEnabled )
+ ImplToolItem *pItem = ImplGetItem(mnHighItemId);
+ if (!pItem || !pItem->mbEnabled)
{
bGrabFocusToDocument = true;
}
@@ -5208,7 +5208,7 @@ void ToolBox::ImplShowFocus()
if( mnHighItemId && HasFocus() )
{
ImplToolItem* pItem = ImplGetItem( mnHighItemId );
- if( pItem->mpWindow && !pItem->mpWindow->IsDisposed() )
+ if (pItem && pItem->mpWindow && !pItem->mpWindow->IsDisposed())
{
vcl::Window *pWin = pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow ? pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow.get() : pItem->mpWindow.get();
pWin->ImplGetWindowImpl()->mbDrawSelectionBackground = true;
commit 68273aaae40b054b7b7e80b472450a5f64196971
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Apr 1 19:13:55 2017 +0100
coverity#1403657 Unchecked return value
and
coverity#1403656 Unchecked return value
Change-Id: I41660df2685b1a07c5ec8f363f6b9c4c581d7c83
diff --git a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
index 3ea9582dc344..667660a92df2 100644
--- a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
@@ -264,8 +264,8 @@ void XMLFootnoteConfigurationImportContext::StartElement(
break;
case XML_TOK_FTNCONFIG_START_AT:
{
- SvXMLUnitConverter::convertEnum(nNumbering, sValue,
- aFootnoteNumberingMap);
+ (void)SvXMLUnitConverter::convertEnum(nNumbering, sValue,
+ aFootnoteNumberingMap);
break;
}
case XML_TOK_FTNCONFIG_POSITION:
diff --git a/xmloff/source/text/XMLLineNumberingImportContext.cxx b/xmloff/source/text/XMLLineNumberingImportContext.cxx
index ce2d059dc4f9..e70cd6db2bd1 100644
--- a/xmloff/source/text/XMLLineNumberingImportContext.cxx
+++ b/xmloff/source/text/XMLLineNumberingImportContext.cxx
@@ -190,8 +190,8 @@ void XMLLineNumberingImportContext::ProcessAttribute(
{ XML_TOKEN_INVALID, 0 }
};
- SvXMLUnitConverter::convertEnum(nNumberPosition, sValue,
- aLineNumberPositionMap);
+ (void)SvXMLUnitConverter::convertEnum(nNumberPosition, sValue,
+ aLineNumberPositionMap);
break;
}
commit f050faebabec8a0c2d63fe63a1195bb845ea4443
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Apr 1 19:07:52 2017 +0100
cgm mode is now unused
Change-Id: Iea58345633cdea50fdecfe9376160ae4ffcfc6a9
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
index 970416a45941..8caba71e88a0 100644
--- a/filter/source/graphicfilter/icgm/cgm.cxx
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -31,7 +31,7 @@
using namespace ::com::sun::star;
-CGM::CGM( sal_uInt32 nMode, uno::Reference< frame::XModel > const & rModel )
+CGM::CGM(uno::Reference< frame::XModel > const & rModel)
: mnOutdx(28000)
, mnOutdy(21000)
, mnVDCXadd(0)
@@ -60,7 +60,6 @@ CGM::CGM( sal_uInt32 nMode, uno::Reference< frame::XModel > const & rModel )
, mnParaSize(0)
, mnActCount(0)
, mpBuf(nullptr)
- , mnMode(nMode)
, mnEscape(0)
, mnElementClass(0)
, mnElementID(0)
@@ -706,7 +705,7 @@ bool CGM::Write( SvStream& rIStm )
// GraphicImport - the exported function
extern "C" SAL_DLLPUBLIC_EXPORT sal_uInt32 SAL_CALL
-ImportCGM(SvStream& rIn, uno::Reference< frame::XModel > const & rXModel, sal_uInt32 nMode, css::uno::Reference<css::task::XStatusIndicator> const & aXStatInd)
+ImportCGM(SvStream& rIn, uno::Reference< frame::XModel > const & rXModel, css::uno::Reference<css::task::XStatusIndicator> const & aXStatInd)
{
sal_uInt32 nStatus = 0; // retvalue == 0 -> ERROR
@@ -716,7 +715,7 @@ ImportCGM(SvStream& rIn, uno::Reference< frame::XModel > const & rXModel, sal_uI
{
try
{
- std::unique_ptr<CGM> pCGM(new CGM( nMode, rXModel ));
+ std::unique_ptr<CGM> pCGM(new CGM(rXModel));
if (pCGM && pCGM->IsValid())
{
rIn.SetEndian(SvStreamEndian::BIG);
diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx
index 9de86ba8881b..4da49ea302de 100644
--- a/filter/source/graphicfilter/icgm/cgm.hxx
+++ b/filter/source/graphicfilter/icgm/cgm.hxx
@@ -83,7 +83,6 @@ class CGM
sal_uInt8* mpBuf; // source stream operation -> then this is allocated for
// the temp input buffer
- sal_uInt32 mnMode; // source description
sal_uInt32 mnEscape;
sal_uInt32 mnElementClass;
sal_uInt32 mnElementID;
@@ -134,7 +133,7 @@ class CGM
~CGM();
- CGM( sal_uInt32 nMode, css::uno::Reference< css::frame::XModel > const & rModel );
+ CGM(css::uno::Reference< css::frame::XModel > const & rModel);
GDIMetaFile* mpGDIMetaFile;
sal_uInt32 GetBackGroundColor();
bool IsValid() const { return mbStatus; };
diff --git a/sd/source/filter/cgm/sdcgmfilter.cxx b/sd/source/filter/cgm/sdcgmfilter.cxx
index 70e35bcbcb9d..0d24bcf88097 100644
--- a/sd/source/filter/cgm/sdcgmfilter.cxx
+++ b/sd/source/filter/cgm/sdcgmfilter.cxx
@@ -33,18 +33,16 @@
#include "../../ui/inc/DrawDocShell.hxx"
-#define CGM_BIG_ENDIAN 0x00020000
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::frame;
-typedef sal_uInt32 ( SAL_CALL *ImportCGMPointer )(SvStream&, Reference< XModel > const &, sal_uInt32, Reference< XStatusIndicator > const &);
+typedef sal_uInt32 ( SAL_CALL *ImportCGMPointer )(SvStream&, Reference< XModel > const &, Reference< XStatusIndicator > const &);
#ifdef DISABLE_DYNLOADING
-extern "C" sal_uInt32 ImportCGM(SvStream&, Reference< XModel > const &, sal_uInt32, Reference< XStatusIndicator > const &);
+extern "C" sal_uInt32 ImportCGM(SvStream&, Reference< XModel > const &, Reference< XStatusIndicator > const &);
#endif
@@ -95,7 +93,7 @@ bool SdCGMFilter::Import()
CreateStatusIndicator();
std::unique_ptr<SvStream> xIn(::utl::UcbStreamHelper::CreateStream(aFileURL, StreamMode::READ));
- nRetValue = xIn ? FncImportCGM(*xIn, mxModel, CGM_BIG_ENDIAN, mxStatusIndicator) : 0;
+ nRetValue = xIn ? FncImportCGM(*xIn, mxModel, mxStatusIndicator) : 0;
if( nRetValue )
{
@@ -133,7 +131,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportCGM(SvStream &rStream)
CGMPointer aPointer;
- bool bRet = aPointer.get()(rStream, xDocShRef->GetModel(), CGM_BIG_ENDIAN, css::uno::Reference<css::task::XStatusIndicator>()) == 0;
+ bool bRet = aPointer.get()(rStream, xDocShRef->GetModel(), css::uno::Reference<css::task::XStatusIndicator>()) == 0;
xDocShRef->DoClose();
commit 7c7204ceefd7f2828225d40e8d88f69c84927c43
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Apr 1 19:04:08 2017 +0100
CGM_EXPORT_IMPRESS is always used
Change-Id: Ic5d9f0f015deae6e4db00912f1b432dbfefd8534
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
index 0183cb2fc539..970416a45941 100644
--- a/filter/source/graphicfilter/icgm/cgm.cxx
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -60,7 +60,7 @@ CGM::CGM( sal_uInt32 nMode, uno::Reference< frame::XModel > const & rModel )
, mnParaSize(0)
, mnActCount(0)
, mpBuf(nullptr)
- , mnMode(nMode | CGM_EXPORT_IMPRESS)
+ , mnMode(nMode)
, mnEscape(0)
, mnElementClass(0)
, mnElementID(0)
diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx
index a9e8fbffb70d..9de86ba8881b 100644
--- a/filter/source/graphicfilter/icgm/cgm.hxx
+++ b/filter/source/graphicfilter/icgm/cgm.hxx
@@ -22,8 +22,6 @@
#include <com/sun/star/frame/XModel.hpp>
-#define CGM_EXPORT_IMPRESS 0x00000100
-
#include <rtl/ustring.hxx>
#include <vector>
#include <vcl/vclptr.hxx>
diff --git a/filter/source/graphicfilter/icgm/class7.cxx b/filter/source/graphicfilter/icgm/class7.cxx
index a18c5fd30272..116338b870da 100644
--- a/filter/source/graphicfilter/icgm/class7.cxx
+++ b/filter/source/graphicfilter/icgm/class7.cxx
@@ -76,25 +76,22 @@ void CGM::ImplDoClass7()
break;
case 0x2BE : /*AppData - SHWSLIDEREC*/
{
- if ( mnMode & CGM_EXPORT_IMPRESS )
+ if ( pAppData[ 16 ] == 0 ) // a blank template ?
{
- if ( pAppData[ 16 ] == 0 ) // a blank template ?
+ if ( pAppData[ 2 ] == 46 )
{
- if ( pAppData[ 2 ] == 46 )
- {
- // this starts the document -> maybe we could insert a new document
- }
- else if ( pAppData[ 2 ] & 0x80 )
- {
- // this is a template
- }
- else
- {
- mpOutAct->InsertPage();
- }
+ // this starts the document -> maybe we could insert a new document
+ }
+ else if ( pAppData[ 2 ] & 0x80 )
+ {
+ // this is a template
+ }
+ else
+ {
+ mpOutAct->InsertPage();
}
- mpChart->ResetAnnotation();
}
+ mpChart->ResetAnnotation();
}
break;
case 0x2C0 : /*AppData - SHWKEYTABLE */break;
diff --git a/sd/source/filter/cgm/sdcgmfilter.cxx b/sd/source/filter/cgm/sdcgmfilter.cxx
index 1dc775256435..70e35bcbcb9d 100644
--- a/sd/source/filter/cgm/sdcgmfilter.cxx
+++ b/sd/source/filter/cgm/sdcgmfilter.cxx
@@ -33,7 +33,6 @@
#include "../../ui/inc/DrawDocShell.hxx"
-#define CGM_EXPORT_IMPRESS 0x00000100
#define CGM_BIG_ENDIAN 0x00020000
using namespace ::com::sun::star;
@@ -96,7 +95,7 @@ bool SdCGMFilter::Import()
CreateStatusIndicator();
std::unique_ptr<SvStream> xIn(::utl::UcbStreamHelper::CreateStream(aFileURL, StreamMode::READ));
- nRetValue = xIn ? FncImportCGM(*xIn, mxModel, CGM_BIG_ENDIAN | CGM_EXPORT_IMPRESS, mxStatusIndicator) : 0;
+ nRetValue = xIn ? FncImportCGM(*xIn, mxModel, CGM_BIG_ENDIAN, mxStatusIndicator) : 0;
if( nRetValue )
{
@@ -134,7 +133,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportCGM(SvStream &rStream)
CGMPointer aPointer;
- bool bRet = aPointer.get()(rStream, xDocShRef->GetModel(), CGM_BIG_ENDIAN | CGM_EXPORT_IMPRESS, css::uno::Reference<css::task::XStatusIndicator>()) == 0;
+ bool bRet = aPointer.get()(rStream, xDocShRef->GetModel(), CGM_BIG_ENDIAN, css::uno::Reference<css::task::XStatusIndicator>()) == 0;
xDocShRef->DoClose();
commit 537fff14c233ad85a22588557ff0e9a3caeea155
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Apr 1 19:01:38 2017 +0100
CGM_IMPORT_CGM is always used
Change-Id: I77616b97970486aa6bb3c9af577d4bb412c35ca2
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
index 3e9e0fcdf05e..0183cb2fc539 100644
--- a/filter/source/graphicfilter/icgm/cgm.cxx
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -717,42 +717,39 @@ ImportCGM(SvStream& rIn, uno::Reference< frame::XModel > const & rXModel, sal_uI
try
{
std::unique_ptr<CGM> pCGM(new CGM( nMode, rXModel ));
- if ( pCGM && pCGM->IsValid() )
+ if (pCGM && pCGM->IsValid())
{
- if ( nMode & CGM_IMPORT_CGM )
- {
- rIn.SetEndian(SvStreamEndian::BIG);
- sal_uInt64 const nInSize = rIn.remainingSize();
- rIn.Seek(0);
+ rIn.SetEndian(SvStreamEndian::BIG);
+ sal_uInt64 const nInSize = rIn.remainingSize();
+ rIn.Seek(0);
- sal_uInt32 nNext = 0;
- sal_uInt32 nAdd = nInSize / 20;
- bool bProgressBar = aXStatInd.is();
- if ( bProgressBar )
- aXStatInd->start( "CGM Import" , nInSize );
+ sal_uInt32 nNext = 0;
+ sal_uInt32 nAdd = nInSize / 20;
+ bool bProgressBar = aXStatInd.is();
+ if ( bProgressBar )
+ aXStatInd->start( "CGM Import" , nInSize );
- while (pCGM->IsValid() && (rIn.Tell() < nInSize) && !pCGM->IsFinished())
+ while (pCGM->IsValid() && (rIn.Tell() < nInSize) && !pCGM->IsFinished())
+ {
+ if ( bProgressBar )
{
- if ( bProgressBar )
+ sal_uInt32 nCurrentPos = rIn.Tell();
+ if ( nCurrentPos >= nNext )
{
- sal_uInt32 nCurrentPos = rIn.Tell();
- if ( nCurrentPos >= nNext )
- {
- aXStatInd->setValue( nCurrentPos );
- nNext = nCurrentPos + nAdd;
- }
+ aXStatInd->setValue( nCurrentPos );
+ nNext = nCurrentPos + nAdd;
}
-
- if (!pCGM->Write(rIn))
- break;
}
- if ( pCGM->IsValid() )
- {
- nStatus = pCGM->GetBackGroundColor() | 0xff000000;
- }
- if ( bProgressBar )
- aXStatInd->end();
+
+ if (!pCGM->Write(rIn))
+ break;
+ }
+ if ( pCGM->IsValid() )
+ {
+ nStatus = pCGM->GetBackGroundColor() | 0xff000000;
}
+ if ( bProgressBar )
+ aXStatInd->end();
}
}
catch (const css::uno::Exception&)
diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx
index 777e53913e24..a9e8fbffb70d 100644
--- a/filter/source/graphicfilter/icgm/cgm.hxx
+++ b/filter/source/graphicfilter/icgm/cgm.hxx
@@ -22,7 +22,6 @@
#include <com/sun/star/frame/XModel.hpp>
-#define CGM_IMPORT_CGM 0x00000001
#define CGM_EXPORT_IMPRESS 0x00000100
#include <rtl/ustring.hxx>
diff --git a/sd/source/filter/cgm/sdcgmfilter.cxx b/sd/source/filter/cgm/sdcgmfilter.cxx
index 6837343e6e79..1dc775256435 100644
--- a/sd/source/filter/cgm/sdcgmfilter.cxx
+++ b/sd/source/filter/cgm/sdcgmfilter.cxx
@@ -33,7 +33,6 @@
#include "../../ui/inc/DrawDocShell.hxx"
-#define CGM_IMPORT_CGM 0x00000001
#define CGM_EXPORT_IMPRESS 0x00000100
#define CGM_BIG_ENDIAN 0x00020000
@@ -97,7 +96,7 @@ bool SdCGMFilter::Import()
CreateStatusIndicator();
std::unique_ptr<SvStream> xIn(::utl::UcbStreamHelper::CreateStream(aFileURL, StreamMode::READ));
- nRetValue = xIn ? FncImportCGM(*xIn, mxModel, CGM_IMPORT_CGM | CGM_BIG_ENDIAN | CGM_EXPORT_IMPRESS, mxStatusIndicator) : 0;
+ nRetValue = xIn ? FncImportCGM(*xIn, mxModel, CGM_BIG_ENDIAN | CGM_EXPORT_IMPRESS, mxStatusIndicator) : 0;
if( nRetValue )
{
@@ -135,7 +134,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportCGM(SvStream &rStream)
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;
+ bool bRet = aPointer.get()(rStream, xDocShRef->GetModel(), CGM_BIG_ENDIAN | CGM_EXPORT_IMPRESS, css::uno::Reference<css::task::XStatusIndicator>()) == 0;
xDocShRef->DoClose();
commit 252f59b70223c8fdbd16532125a1089ff8c12c8b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Apr 1 18:01:58 2017 +0100
adjust cgm import to make testing easier
Change-Id: I2979af77522e085075d4f1e1e379fe82e614163b
diff --git a/filter/source/config/fragments/filters/CGM___Computer_Graphics_Metafile.xcu b/filter/source/config/fragments/filters/CGM___Computer_Graphics_Metafile.xcu
index e6627f2d6fd6..26fa9e638e1f 100644
--- a/filter/source/config/fragments/filters/CGM___Computer_Graphics_Metafile.xcu
+++ b/filter/source/config/fragments/filters/CGM___Computer_Graphics_Metafile.xcu
@@ -19,7 +19,7 @@
<prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"/>
- <prop oor:name="UserData"><value>icg</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
<prop oor:name="UIName">
<value xml:lang="en-US">CGM - Computer Graphics Metafile</value>
</prop>
diff --git a/sd/inc/sdfilter.hxx b/sd/inc/sdfilter.hxx
index c88a490c2856..df1421f51727 100644
--- a/sd/inc/sdfilter.hxx
+++ b/sd/inc/sdfilter.hxx
@@ -43,6 +43,10 @@ public:
bool IsDraw() const { return mbIsDraw; }
virtual bool Export() = 0;
+#ifndef DISABLE_DYNLOADING
+ static ::osl::Module* OpenLibrary( const OUString& rLibraryName );
+#endif
+
protected:
css::uno::Reference< css::frame::XModel > mxModel;
css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator;
@@ -51,9 +55,6 @@ protected:
::sd::DrawDocShell& mrDocShell;
SdDrawDocument& mrDocument;
bool mbIsDraw : 1;
-#ifndef DISABLE_DYNLOADING
- static ::osl::Module* OpenLibrary( const OUString& rLibraryName );
-#endif
void CreateStatusIndicator();
private:
diff --git a/sd/source/filter/cgm/sdcgmfilter.cxx b/sd/source/filter/cgm/sdcgmfilter.cxx
index 1c22e164f676..6837343e6e79 100644
--- a/sd/source/filter/cgm/sdcgmfilter.cxx
+++ b/sd/source/filter/cgm/sdcgmfilter.cxx
@@ -26,14 +26,15 @@
#include <svx/xflclit.hxx>
#include <svx/xfillit0.hxx>
+#include "sddll.hxx"
#include "sdpage.hxx"
#include "drawdoc.hxx"
#include "sdcgmfilter.hxx"
-#define CGM_IMPORT_CGM 0x00000001
+#include "../../ui/inc/DrawDocShell.hxx"
+#define CGM_IMPORT_CGM 0x00000001
#define CGM_EXPORT_IMPRESS 0x00000100
-
#define CGM_BIG_ENDIAN 0x00020000
using namespace ::com::sun::star;
@@ -58,24 +59,36 @@ SdCGMFilter::~SdCGMFilter()
{
}
-bool SdCGMFilter::Import()
+namespace
{
+ class CGMPointer
+ {
+ ImportCGMPointer m_pPointer;
#ifndef DISABLE_DYNLOADING
- ::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() );
+ 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 bRet = false;
- if(
-#ifndef DISABLE_DYNLOADING
- pLibrary &&
-#endif
- mxModel.is() )
+ CGMPointer aPointer;
+ ImportCGMPointer FncImportCGM = aPointer.get();
+ if (FncImportCGM && 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 ) );
sal_uInt32 nRetValue;
@@ -105,9 +118,6 @@ bool SdCGMFilter::Import()
}
}
}
-#ifndef DISABLE_DYNLOADING
- delete pLibrary;
-#endif
return bRet;
}
@@ -117,4 +127,19 @@ bool SdCGMFilter::Export()
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: */
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index ec4ceefe3b3a..1dc51e2bdafd 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -430,6 +430,21 @@ try_again:
SvFileStream aFileStream(out, StreamMode::READ);
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
}
More information about the Libreoffice-commits
mailing list