summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/editeng/unoprnms.hxx1
-rw-r--r--include/svx/unoshprp.hxx3
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx47
-rw-r--r--sd/qa/unit/export-tests.cxx45
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx2
-rw-r--r--svx/source/unodraw/unoshap2.cxx84
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport8.cxx14
-rw-r--r--vcl/source/graphic/GraphicLoader.cxx16
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx38
-rw-r--r--writerfilter/source/dmapper/GraphicImport.hxx4
10 files changed, 84 insertions, 170 deletions
diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index 42292c38b2dd..0e1175eb4bf4 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -160,7 +160,6 @@
#define UNO_NAME_MISC_OBJ_DESCRIPTION "Description"
#define UNO_NAME_GRAPHOBJ_FILLBITMAP "GraphicObjectFillBitmap"
-#define UNO_NAME_GRAPHOBJ_GRAFURL "GraphicURL"
#define UNO_NAME_GRAPHOBJ_REPLACEMENT_GRAPHIC "ReplacementGraphic"
#define UNO_NAME_GRAPHOBJ_GRAFSTREAMURL "GraphicStreamURL"
#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index 73217bffb40c..56050252fd58 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -98,7 +98,7 @@
#define OWN_ATTR_LDNAME (OWN_ATTR_VALUE_START+30)
#define OWN_ATTR_LDBITMAP (OWN_ATTR_VALUE_START+31)
#define OWN_ATTR_OLESIZE (OWN_ATTR_VALUE_START+32)
-#define OWN_ATTR_GRAFURL (OWN_ATTR_VALUE_START+33)
+//#define free (OWN_ATTR_VALUE_START+33)
#define OWN_ATTR_OLEMODEL (OWN_ATTR_VALUE_START+34)
#define OWN_ATTR_MIRRORED (OWN_ATTR_VALUE_START+35)
#define OWN_ATTR_CLSID (OWN_ATTR_VALUE_START+36)
@@ -426,7 +426,6 @@
#define SPECIAL_GRAPHOBJ_PROPERTIES \
SPECIAL_GRAPHOBJ_PROPERTIES_DEFAULTS \
{ OUString(UNO_NAME_GRAPHIC_GRAPHICCROP), SDRATTR_GRAFCROP , ::cppu::UnoType<css::text::GraphicCrop>::get(), 0, 0 }, \
- { OUString(UNO_NAME_GRAPHOBJ_GRAFURL), OWN_ATTR_GRAFURL , ::cppu::UnoType<OUString>::get(), 0, 0 }, \
{ OUString(UNO_NAME_GRAPHOBJ_REPLACEMENT_GRAPHIC), OWN_ATTR_REPLACEMENT_GRAPHIC, cppu::UnoType<css::graphic::XGraphic>::get() , 0, 0}, \
{ OUString(UNO_NAME_GRAPHOBJ_GRAFSTREAMURL), OWN_ATTR_GRAFSTREAMURL , ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 }, \
{ OUString(UNO_NAME_GRAPHOBJ_FILLBITMAP), OWN_ATTR_VALUE_FILLBITMAP , cppu::UnoType<css::awt::XBitmap>::get() , 0, 0}, \
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index ff4063f8ed84..fe073203818b 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -74,6 +74,7 @@
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/GraphicType.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -3151,16 +3152,13 @@ void ScExportTest::testSwappedOutImageExport()
uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), uno::UNO_QUERY);
uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
- // Check URL
- {
- OUString sURL;
- XPropSet->getPropertyValue("GraphicURL") >>= sURL;
- CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
- }
- // Check size
+
+ // Check Graphic, Size
{
uno::Reference<graphic::XGraphic> xGraphic;
XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic->getType() != graphic::GraphicType::EMPTY);
uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
@@ -3169,16 +3167,13 @@ void ScExportTest::testSwappedOutImageExport()
// Second Image
xImage.set(xDraws->getByIndex(1), uno::UNO_QUERY);
XPropSet.set( xImage, uno::UNO_QUERY_THROW );
- // Check URL
- {
- OUString sURL;
- XPropSet->getPropertyValue("GraphicURL") >>= sURL;
- CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
- }
- // Check size
+
+ // Check Graphic, Size
{
uno::Reference<graphic::XGraphic> xGraphic;
XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic->getType() != graphic::GraphicType::EMPTY);
uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(900), xBitmap->getSize().Width );
@@ -3302,17 +3297,13 @@ void ScExportTest::testImageWithSpecialID()
uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), uno::UNO_QUERY);
uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
- // Check URL
- {
- OUString sURL;
- XPropSet->getPropertyValue("GraphicURL") >>= sURL;
- CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), !sURL.isEmpty());
- CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
- }
- // Check size
+
+ // Check Graphic, Size
{
uno::Reference<graphic::XGraphic> xGraphic;
XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic->getType() != graphic::GraphicType::EMPTY);
uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
@@ -3321,17 +3312,13 @@ void ScExportTest::testImageWithSpecialID()
// Second Image
xImage.set(xDraws->getByIndex(1), uno::UNO_QUERY);
XPropSet.set( xImage, uno::UNO_QUERY_THROW );
- // Check URL
- {
- OUString sURL;
- XPropSet->getPropertyValue("GraphicURL") >>= sURL;
- CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), !sURL.isEmpty());
- CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
- }
- // Check size
+
+ // Check Graphic, Size
{
uno::Reference<graphic::XGraphic> xGraphic;
XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic->getType() != graphic::GraphicType::EMPTY);
uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(900), xBitmap->getSize().Width );
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index d1f5a4e2097d..20addcee2bc0 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -56,6 +56,7 @@
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/GraphicType.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
@@ -460,16 +461,13 @@ void SdExportTest::testSwappedOutImageExport()
uno::Reference<drawing::XShape> xImage(xDrawPage->getByIndex(2), uno::UNO_QUERY);
uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
- // Check URL
- {
- OUString sURL;
- XPropSet->getPropertyValue("GraphicURL") >>= sURL;
- CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
- }
- // Check size
+
+ // Check Graphic, Size
{
uno::Reference<graphic::XGraphic> xGraphic;
XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic->getType() != graphic::GraphicType::EMPTY);
uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
@@ -480,16 +478,13 @@ void SdExportTest::testSwappedOutImageExport()
xDrawPage.set(xDrawPagesSupplier->getDrawPages()->getByIndex(1), uno::UNO_QUERY_THROW );
xImage.set(xDrawPage->getByIndex(1), uno::UNO_QUERY);
XPropSet.set( xImage, uno::UNO_QUERY_THROW );
- // Check URL
- {
- OUString sURL;
- XPropSet->getPropertyValue("GraphicURL") >>= sURL;
- CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
- }
- // Check size
+
+ // Check Graphic, Size
{
uno::Reference<graphic::XGraphic> xGraphic;
XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic->getType() != graphic::GraphicType::EMPTY);
uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(900), xBitmap->getSize().Width );
@@ -671,16 +666,13 @@ void SdExportTest::testImageWithSpecialID()
uno::Reference<drawing::XShape> xImage(xDrawPage->getByIndex(2), uno::UNO_QUERY);
uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
- // Check URL
- {
- OUString sURL;
- XPropSet->getPropertyValue("GraphicURL") >>= sURL;
- CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
- }
- // Check size
+
+ // Check Graphic, Size
{
uno::Reference<graphic::XGraphic> xGraphic;
XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic->getType() != graphic::GraphicType::EMPTY);
uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
@@ -691,16 +683,13 @@ void SdExportTest::testImageWithSpecialID()
xDrawPage.set(xDrawPagesSupplier->getDrawPages()->getByIndex(1), uno::UNO_QUERY_THROW );
xImage.set(xDrawPage->getByIndex(1), uno::UNO_QUERY);
XPropSet.set( xImage, uno::UNO_QUERY_THROW );
- // Check URL
- {
- OUString sURL;
- XPropSet->getPropertyValue("GraphicURL") >>= sURL;
- CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
- }
- // Check size
+
+ // Check Graphic, Size
{
uno::Reference<graphic::XGraphic> xGraphic;
XPropSet->getPropertyValue("Graphic") >>= xGraphic;
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+ CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic->getType() != graphic::GraphicType::EMPTY);
uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(900), xBitmap->getSize().Width );
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 2672f17c185f..fd0d586556bf 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2400,7 +2400,7 @@ ShapeExport& PowerPointShapeExport::WritePlaceholderShape(const Reference< XShap
WritePresetShape("rect");
Reference< XPropertySet > xProps(xShape, UNO_QUERY);
if (xProps.is())
- WriteBlipFill(xProps, "GraphicURL");
+ WriteBlipFill(xProps, "Graphic");
mpFS->endElementNS(XML_p, XML_spPr);
WriteTextBox(xShape, XML_p);
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 21b770c092d1..b237662242ab 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1331,69 +1331,6 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
}
break;
}
- case OWN_ATTR_GRAFURL:
- {
- OUString aURL;
- if( rValue >>= aURL )
- {
- if( aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
- {
- // graphic manager url
- aURL = aURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
- OUString aTmpStr(aURL);
- OString aUniqueID(OUStringToOString(aTmpStr, RTL_TEXTENCODING_UTF8));
- GraphicObject aGrafObj(aUniqueID);
-
- // #101808# since loading a graphic can cause a reschedule of the office
- // it is possible that our shape is removed while where in this
- // method.
- if( mpObj.is() )
- {
- static_cast<SdrGrafObj*>(mpObj.get())->ReleaseGraphicLink();
- static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( aGrafObj );
- }
- }
- else if( !aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
- {
- // normal link
- OUString aFilterName;
- std::shared_ptr<const SfxFilter> pSfxFilter;
- SfxMedium aSfxMedium( aURL, referer_, StreamMode::READ | StreamMode::SHARE_DENYNONE );
-
- SfxGetpApp()->GetFilterMatcher().GuessFilter( aSfxMedium, pSfxFilter );
-
- if( !pSfxFilter )
- {
- INetURLObject aURLObj( aURL );
-
- if( aURLObj.GetProtocol() == INetProtocol::NotValid )
- {
- OUString aValidURL;
-
- if( osl::FileBase::getFileURLFromSystemPath( aURL, aValidURL ) == osl::FileBase::E_None )
- aURLObj = INetURLObject( aValidURL );
- }
-
- if( aURLObj.GetProtocol() != INetProtocol::NotValid )
- {
- GraphicFilter &rGrfFilter = GraphicFilter::GetGraphicFilter();
- aFilterName = rGrfFilter.GetImportFormatName( rGrfFilter.GetImportFormatNumberForShortName( aURLObj.getExtension() ) );
- }
- }
- else
- aFilterName = pSfxFilter->GetFilterName();
-
- // #101808# since loading a graphic can cause a reschedule of the office
- // it is possible that our shape is removed while where in this
- // method.
- if( mpObj.is() )
- static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicLink( aURL, referer_, aFilterName );
-
- }
- bOk = true;
- }
- break;
- }
case OWN_ATTR_GRAFSTREAMURL:
{
@@ -1563,22 +1500,6 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
break;
}
- case OWN_ATTR_GRAFURL:
- {
- if( static_cast< SdrGrafObj*>( mpObj.get() )->IsLinkedGraphic() )
- {
- rValue <<= static_cast< SdrGrafObj*>( mpObj.get() )->GetFileName();
- }
- else
- {
- const GraphicObject& rGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true);
- OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
- aURL += OStringToOUString(rGrafObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
- rValue <<= aURL;
- }
- break;
- }
-
case OWN_ATTR_REPLACEMENT_GRAPHIC:
{
const GraphicObject* pGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject();
@@ -1601,7 +1522,10 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
case OWN_ATTR_VALUE_GRAPHIC:
{
- Reference< graphic::XGraphic > xGraphic( static_cast< SdrGrafObj* >( mpObj.get() )->GetGraphic().GetXGraphic() );
+ Reference<graphic::XGraphic> xGraphic;
+ auto pSdrGraphicObject = static_cast<SdrGrafObj*>(mpObj.get());
+ if (pSdrGraphicObject->GetGraphicObject().GetType() != GraphicType::NONE)
+ xGraphic = pSdrGraphicObject->GetGraphic().GetXGraphic();
rValue <<= xGraphic;
break;
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 9cd5aff5546f..9fdcab559430 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -491,9 +491,17 @@ DECLARE_OOXMLEXPORT_TEST(testTDF91122, "tdf91122.docx")
/*
* OLE object shape: default vertical position is top in MSO, not bottom
*/
- for (int i = 1; i <= 2; ++i)
- {
- uno::Reference<beans::XPropertySet> xShapeProperties( getShape(i), uno::UNO_QUERY );
+ { // Check first shape
+ uno::Reference<beans::XPropertySet> xShapeProperties( getShape(1), uno::UNO_QUERY );
+ uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xShapeProperties, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), xShapeDescriptor->getShapeType());
+ sal_Int16 nValue;
+ xShapeProperties->getPropertyValue("VertOrient") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation", text::VertOrientation::TOP, nValue);
+ }
+
+ { // Check second shape
+ uno::Reference<beans::XPropertySet> xShapeProperties( getShape(2), uno::UNO_QUERY );
uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xShapeProperties, uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), xShapeDescriptor->getShapeType());
sal_Int16 nValue;
diff --git a/vcl/source/graphic/GraphicLoader.cxx b/vcl/source/graphic/GraphicLoader.cxx
index 76495e290a9b..03ca2a6f56a3 100644
--- a/vcl/source/graphic/GraphicLoader.cxx
+++ b/vcl/source/graphic/GraphicLoader.cxx
@@ -39,9 +39,19 @@ Graphic loadFromURL(OUString const& rURL)
xGraphic = xProv->queryGraphic(aLoadProps);
- Graphic aGraphic(xGraphic);
- aGraphic.setOriginURL(rURL);
- return aGraphic;
+ std::unique_ptr<Graphic> pGraphic;
+ if (xGraphic.is())
+ {
+ pGraphic.reset(new Graphic(xGraphic));
+ }
+ else
+ {
+ pGraphic.reset(new Graphic);
+ pGraphic->SetDefaultType();
+ }
+ pGraphic->setOriginURL(rURL);
+
+ return *pGraphic.get();
}
}
} // end vcl::graphic
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index a6452c3d1a7a..5847e7d4a324 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -654,8 +654,8 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
uno::Reference< beans::XPropertySet > xShapeProps
( xShape, uno::UNO_QUERY_THROW );
- OUString sUrl;
- xShapeProps->getPropertyValue("GraphicURL") >>= sUrl;
+ uno::Reference<graphic::XGraphic> xGraphic;
+ xShapeProps->getPropertyValue("Graphic") >>= xGraphic;
sal_Int32 nRotation = 0;
xShapeProps->getPropertyValue("RotateAngle") >>= nRotation;
@@ -672,10 +672,6 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
bContainsEffects = true;
}
- beans::PropertyValues aMediaProperties( 1 );
- aMediaProperties[0].Name = "URL";
- aMediaProperties[0].Value <<= sUrl;
-
xShapeProps->getPropertyValue("Shadow") >>= m_pImpl->bShadow;
if (m_pImpl->bShadow)
{
@@ -691,7 +687,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
// fdo#70457: transform XShape into a SwXTextGraphicObject only if there's no rotation
if ( nRotation == 0 && !bContainsEffects )
- m_xGraphicObject = createGraphicObject( aMediaProperties, xShapeProps );
+ m_xGraphicObject = createGraphicObject( xGraphic, xShapeProps );
bUseShape = !m_xGraphicObject.is( );
@@ -1111,20 +1107,18 @@ void GraphicImport::lcl_entry(int /*pos*/, writerfilter::Reference<Properties>::
{
}
-uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const beans::PropertyValues& aMediaProperties, const uno::Reference<beans::XPropertySet>& xShapeProps )
+uno::Reference<text::XTextContent> GraphicImport::createGraphicObject(uno::Reference<graphic::XGraphic> const & rxGraphic,
+ uno::Reference<beans::XPropertySet> const & xShapeProps)
{
- uno::Reference< text::XTextContent > xGraphicObject;
+ uno::Reference<text::XTextContent> xGraphicObject;
try
{
- uno::Reference< graphic::XGraphicProvider > xGraphicProvider( graphic::GraphicProvider::create(m_xComponentContext) );
- uno::Reference< graphic::XGraphic > xGraphic = xGraphicProvider->queryGraphic( aMediaProperties );
-
- if(xGraphic.is())
+ if (rxGraphic.is())
{
uno::Reference< beans::XPropertySet > xGraphicObjectProperties(
m_xTextFactory->createInstance("com.sun.star.text.TextGraphicObject"),
uno::UNO_QUERY_THROW);
- xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_GRAPHIC), uno::makeAny( xGraphic ));
+ xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_GRAPHIC), uno::makeAny(rxGraphic));
xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_ANCHOR_TYPE),
uno::makeAny( m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR ?
text::TextContentAnchorType_AT_CHARACTER :
@@ -1293,7 +1287,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
m_pImpl->applyZOrder(xGraphicObjectProperties);
//there seems to be no way to detect the original size via _real_ API
- uno::Reference< beans::XPropertySet > xGraphicProperties( xGraphic, uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xGraphicProperties(rxGraphic, uno::UNO_QUERY_THROW);
if (m_pImpl->mpWrapPolygon.get() != nullptr)
{
@@ -1357,14 +1351,16 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Reference<Properties>::Pointer_t /*ref*/)
{
- beans::PropertyValues aMediaProperties( 1 );
- aMediaProperties[0].Name = getPropertyName(PROP_INPUT_STREAM);
+ beans::PropertyValues aMediaProperties( 1 );
+ aMediaProperties[0].Name = getPropertyName(PROP_INPUT_STREAM);
- uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len );
- aMediaProperties[0].Value <<= xIStream;
+ uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len );
+ aMediaProperties[0].Value <<= xIStream;
- uno::Reference<beans::XPropertySet> xPropertySet;
- m_xGraphicObject = createGraphicObject( aMediaProperties, xPropertySet );
+ uno::Reference<beans::XPropertySet> xPropertySet;
+ uno::Reference<graphic::XGraphicProvider> xGraphicProvider(graphic::GraphicProvider::create(m_xComponentContext));
+ uno::Reference<graphic::XGraphic> xGraphic = xGraphicProvider->queryGraphic(aMediaProperties);
+ m_xGraphicObject = createGraphicObject(xGraphic, xPropertySet);
}
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx
index f513632e966b..c0943ce1a4f4 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -73,7 +73,9 @@ class GraphicImport : public LoggedProperties, public LoggedTable
css::uno::Reference<css::drawing::XShape> m_xShape;
void ProcessShapeOptions(Value const & val);
- css::uno::Reference<css::text::XTextContent > createGraphicObject(const css::beans::PropertyValues& aMediaProperties, const css::uno::Reference<css::beans::XPropertySet>& xShapeProps);
+ css::uno::Reference<css::text::XTextContent>
+ createGraphicObject(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic,
+ css::uno::Reference<css::beans::XPropertySet> const & xShapeProps);
void putPropertyToFrameGrabBag( const OUString& sPropertyName, const css::uno::Any& aPropertyValue );