summaryrefslogtreecommitdiff
path: root/writerperfect/source/draw
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2013-03-01 23:01:28 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2013-03-01 23:03:16 +0100
commit866ebf66b3a50b2d601825e4533898949d5b86c8 (patch)
treebc911d28b8b10aeb4b5928c9f9d42fecbb072882 /writerperfect/source/draw
parent6ee08cc0f1e3b38f21bd4d1cc47412ce38bb13e6 (diff)
Simplify a bit the boilerplate code
The XInputStream is guaranteed to be there always and if it is not there, do not try to create it. Change-Id: Ie133489dfcb3d9cec0c4efe78740348a1efa2423
Diffstat (limited to 'writerperfect/source/draw')
-rw-r--r--writerperfect/source/draw/CDRImportFilter.cxx7
-rw-r--r--writerperfect/source/draw/CMXImportFilter.cxx8
-rw-r--r--writerperfect/source/draw/MSPUBImportFilter.cxx8
-rw-r--r--writerperfect/source/draw/VisioImportFilter.cxx8
-rw-r--r--writerperfect/source/draw/WPGImportFilter.cxx8
5 files changed, 15 insertions, 24 deletions
diff --git a/writerperfect/source/draw/CDRImportFilter.cxx b/writerperfect/source/draw/CDRImportFilter.cxx
index 026c7b146a97..216e1fde77cb 100644
--- a/writerperfect/source/draw/CDRImportFilter.cxx
+++ b/writerperfect/source/draw/CDRImportFilter.cxx
@@ -74,16 +74,12 @@ throw (RuntimeException)
{
if ( pValue[i].Name == "InputStream" )
pValue[i].Value >>= xInputStream;
- else if ( pValue[i].Name == "URL" )
- pValue[i].Value >>= sURL;
}
if ( !xInputStream.is() )
{
OSL_ASSERT( 0 );
return sal_False;
}
- OString sFileName;
- sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
// An XML import service: what we push sax messages to..
OUString sXMLImportService ( "com.sun.star.comp.Draw.XMLOasisImporter" );
@@ -142,6 +138,9 @@ throw( com::sun::star::uno::RuntimeException )
pValue[i].Value >>= xInputStream;
}
+ if (!xInputStream.is())
+ return ::rtl::OUString();
+
WPXSvInputStream input( xInputStream );
if (libcdr::CDRDocument::isSupported(&input))
diff --git a/writerperfect/source/draw/CMXImportFilter.cxx b/writerperfect/source/draw/CMXImportFilter.cxx
index 9d53df394f5e..885449001b60 100644
--- a/writerperfect/source/draw/CMXImportFilter.cxx
+++ b/writerperfect/source/draw/CMXImportFilter.cxx
@@ -39,7 +39,6 @@ using com::sun::star::io::XInputStream;
using com::sun::star::io::XSeekable;
using com::sun::star::uno::Sequence;
using namespace ::rtl;
-using rtl::OString;
using rtl::OUString;
using com::sun::star::uno::Sequence;
using com::sun::star::uno::Reference;
@@ -74,16 +73,12 @@ throw (RuntimeException)
{
if ( pValue[i].Name == "InputStream" )
pValue[i].Value >>= xInputStream;
- else if ( pValue[i].Name == "URL" )
- pValue[i].Value >>= sURL;
}
if ( !xInputStream.is() )
{
OSL_ASSERT( 0 );
return sal_False;
}
- OString sFileName;
- sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
// An XML import service: what we push sax messages to..
OUString sXMLImportService ( "com.sun.star.comp.Draw.XMLOasisImporter" );
@@ -142,6 +137,9 @@ throw( com::sun::star::uno::RuntimeException )
pValue[i].Value >>= xInputStream;
}
+ if (!xInputStream.is())
+ return ::rtl::OUString();
+
WPXSvInputStream input( xInputStream );
if (libcdr::CMXDocument::isSupported(&input))
diff --git a/writerperfect/source/draw/MSPUBImportFilter.cxx b/writerperfect/source/draw/MSPUBImportFilter.cxx
index 5f886ab7cc92..b80b6d62e3ff 100644
--- a/writerperfect/source/draw/MSPUBImportFilter.cxx
+++ b/writerperfect/source/draw/MSPUBImportFilter.cxx
@@ -35,7 +35,6 @@ using com::sun::star::io::XInputStream;
using com::sun::star::io::XSeekable;
using com::sun::star::uno::Sequence;
using namespace ::rtl;
-using rtl::OString;
using rtl::OUString;
using com::sun::star::uno::Sequence;
using com::sun::star::uno::Reference;
@@ -70,16 +69,12 @@ throw (RuntimeException)
{
if ( pValue[i].Name == "InputStream" )
pValue[i].Value >>= xInputStream;
- else if ( pValue[i].Name == "URL" )
- pValue[i].Value >>= sURL;
}
if ( !xInputStream.is() )
{
OSL_ASSERT( 0 );
return sal_False;
}
- OString sFileName;
- sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
// An XML import service: what we push sax messages to..
OUString sXMLImportService ( "com.sun.star.comp.Draw.XMLOasisImporter" );
@@ -138,6 +133,9 @@ throw( com::sun::star::uno::RuntimeException )
pValue[i].Value >>= xInputStream;
}
+ if (!xInputStream.is())
+ return ::rtl::OUString();
+
WPXSvInputStream input( xInputStream );
if (libmspub::MSPUBDocument::isSupported(&input))
diff --git a/writerperfect/source/draw/VisioImportFilter.cxx b/writerperfect/source/draw/VisioImportFilter.cxx
index 291f35875d50..9b39b64aaaed 100644
--- a/writerperfect/source/draw/VisioImportFilter.cxx
+++ b/writerperfect/source/draw/VisioImportFilter.cxx
@@ -35,7 +35,6 @@ using com::sun::star::io::XInputStream;
using com::sun::star::io::XSeekable;
using com::sun::star::uno::Sequence;
using namespace ::rtl;
-using rtl::OString;
using rtl::OUString;
using com::sun::star::uno::Sequence;
using com::sun::star::uno::Reference;
@@ -70,16 +69,12 @@ throw (RuntimeException)
{
if ( pValue[i].Name == "InputStream" )
pValue[i].Value >>= xInputStream;
- else if ( pValue[i].Name == "URL" )
- pValue[i].Value >>= sURL;
}
if ( !xInputStream.is() )
{
OSL_ASSERT( 0 );
return sal_False;
}
- OString sFileName;
- sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
// An XML import service: what we push sax messages to..
OUString sXMLImportService ( "com.sun.star.comp.Draw.XMLOasisImporter" );
@@ -138,6 +133,9 @@ throw( com::sun::star::uno::RuntimeException )
pValue[i].Value >>= xInputStream;
}
+ if (!xInputStream.is())
+ return ::rtl::OUString();
+
WPXSvInputStream input( xInputStream );
if (libvisio::VisioDocument::isSupported(&input))
diff --git a/writerperfect/source/draw/WPGImportFilter.cxx b/writerperfect/source/draw/WPGImportFilter.cxx
index 7538ee92cdee..b142e1a640bd 100644
--- a/writerperfect/source/draw/WPGImportFilter.cxx
+++ b/writerperfect/source/draw/WPGImportFilter.cxx
@@ -40,7 +40,6 @@ using com::sun::star::io::XInputStream;
using com::sun::star::io::XSeekable;
using com::sun::star::uno::Sequence;
using namespace ::rtl;
-using rtl::OString;
using rtl::OUString;
using com::sun::star::uno::Sequence;
using com::sun::star::uno::Reference;
@@ -75,16 +74,12 @@ throw (RuntimeException)
{
if ( pValue[i].Name == "InputStream" )
pValue[i].Value >>= xInputStream;
- else if ( pValue[i].Name == "URL" )
- pValue[i].Value >>= sURL;
}
if ( !xInputStream.is() )
{
OSL_ASSERT( 0 );
return sal_False;
}
- OString sFileName;
- sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
// An XML import service: what we push sax messages to..
OUString sXMLImportService ( "com.sun.star.comp.Draw.XMLOasisImporter" );
@@ -143,6 +138,9 @@ throw( com::sun::star::uno::RuntimeException )
pValue[i].Value >>= xInputStream;
}
+ if (!xInputStream.is())
+ return ::rtl::OUString();
+
WPXSvInputStream input( xInputStream );
if (libwpg::WPGraphics::isSupported(&input))