Kaydet (Commit) fb29e6ee authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

svx: removing GraphicURL and OWN_ATTR_GRAFURL, fix writerfilter

Change-Id: I5b84788a324cc68e3c4561e9a7376fcb1cfeeb67
Reviewed-on: https://gerrit.libreoffice.org/50933Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst d4347f5d
......@@ -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:"
......
......@@ -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}, \
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment