Kaydet (Commit) e7e2b7da authored tarafından Miklos Vajna's avatar Miklos Vajna

RTFValue: extend to be able to store embed::XEmbeddedObject

Change-Id: I6218be1f4afe22665ab85f7d731e1c1567bb2c8e
üst 02e80d2e
...@@ -35,11 +35,12 @@ using rtl::OUString; ...@@ -35,11 +35,12 @@ using rtl::OUString;
RTFValue::RTFValue(int nValue, rtl::OUString sValue, RTFSprms rAttributes, RTFValue::RTFValue(int nValue, rtl::OUString sValue, RTFSprms rAttributes,
RTFSprms rSprms, uno::Reference<drawing::XShape> xShape, RTFSprms rSprms, uno::Reference<drawing::XShape> xShape,
uno::Reference<io::XInputStream> xStream, bool bForceString) uno::Reference<io::XInputStream> xStream, uno::Reference<embed::XEmbeddedObject> xObject, bool bForceString)
: m_nValue(nValue), : m_nValue(nValue),
m_sValue(sValue), m_sValue(sValue),
m_xShape(xShape), m_xShape(xShape),
m_xStream(xStream), m_xStream(xStream),
m_xObject(xObject),
m_bForceString(bForceString) m_bForceString(bForceString)
{ {
m_pAttributes.reset(new RTFSprms(rAttributes)); m_pAttributes.reset(new RTFSprms(rAttributes));
...@@ -51,6 +52,7 @@ RTFValue::RTFValue(int nValue) ...@@ -51,6 +52,7 @@ RTFValue::RTFValue(int nValue)
m_sValue(), m_sValue(),
m_xShape(), m_xShape(),
m_xStream(), m_xStream(),
m_xObject(),
m_bForceString(false) m_bForceString(false)
{ {
m_pAttributes.reset(new RTFSprms()); m_pAttributes.reset(new RTFSprms());
...@@ -62,6 +64,7 @@ RTFValue::RTFValue(OUString sValue, bool bForce) ...@@ -62,6 +64,7 @@ RTFValue::RTFValue(OUString sValue, bool bForce)
m_sValue(sValue), m_sValue(sValue),
m_xShape(), m_xShape(),
m_xStream(), m_xStream(),
m_xObject(),
m_bForceString(bForce) m_bForceString(bForce)
{ {
m_pAttributes.reset(new RTFSprms()); m_pAttributes.reset(new RTFSprms());
...@@ -73,6 +76,7 @@ RTFValue::RTFValue(RTFSprms rAttributes) ...@@ -73,6 +76,7 @@ RTFValue::RTFValue(RTFSprms rAttributes)
m_sValue(), m_sValue(),
m_xShape(), m_xShape(),
m_xStream(), m_xStream(),
m_xObject(),
m_bForceString(false) m_bForceString(false)
{ {
m_pAttributes.reset(new RTFSprms(rAttributes)); m_pAttributes.reset(new RTFSprms(rAttributes));
...@@ -84,6 +88,7 @@ RTFValue::RTFValue(RTFSprms rAttributes, RTFSprms rSprms) ...@@ -84,6 +88,7 @@ RTFValue::RTFValue(RTFSprms rAttributes, RTFSprms rSprms)
m_sValue(), m_sValue(),
m_xShape(), m_xShape(),
m_xStream(), m_xStream(),
m_xObject(),
m_bForceString(false) m_bForceString(false)
{ {
m_pAttributes.reset(new RTFSprms(rAttributes)); m_pAttributes.reset(new RTFSprms(rAttributes));
...@@ -95,6 +100,7 @@ RTFValue::RTFValue(uno::Reference<drawing::XShape> rShape) ...@@ -95,6 +100,7 @@ RTFValue::RTFValue(uno::Reference<drawing::XShape> rShape)
m_sValue(), m_sValue(),
m_xShape(rShape), m_xShape(rShape),
m_xStream(), m_xStream(),
m_xObject(),
m_bForceString(false) m_bForceString(false)
{ {
m_pAttributes.reset(new RTFSprms()); m_pAttributes.reset(new RTFSprms());
...@@ -106,6 +112,19 @@ RTFValue::RTFValue(uno::Reference<io::XInputStream> rStream) ...@@ -106,6 +112,19 @@ RTFValue::RTFValue(uno::Reference<io::XInputStream> rStream)
m_sValue(), m_sValue(),
m_xShape(), m_xShape(),
m_xStream(rStream), m_xStream(rStream),
m_xObject(),
m_bForceString(false)
{
m_pAttributes.reset(new RTFSprms());
m_pSprms.reset(new RTFSprms());
}
RTFValue::RTFValue(uno::Reference<embed::XEmbeddedObject> xObject)
: m_nValue(),
m_sValue(),
m_xShape(),
m_xStream(),
m_xObject(xObject),
m_bForceString(false) m_bForceString(false)
{ {
m_pAttributes.reset(new RTFSprms()); m_pAttributes.reset(new RTFSprms());
...@@ -143,6 +162,8 @@ uno::Any RTFValue::getAny() const ...@@ -143,6 +162,8 @@ uno::Any RTFValue::getAny() const
ret <<= m_xShape; ret <<= m_xShape;
else if (m_xStream.is()) else if (m_xStream.is())
ret <<= m_xStream; ret <<= m_xStream;
else if (m_xObject.is())
ret <<= m_xObject;
else else
ret <<= static_cast<sal_Int32>(m_nValue); ret <<= static_cast<sal_Int32>(m_nValue);
return ret; return ret;
...@@ -176,7 +197,7 @@ std::string RTFValue::toString() const ...@@ -176,7 +197,7 @@ std::string RTFValue::toString() const
RTFValue* RTFValue::Clone() RTFValue* RTFValue::Clone()
{ {
return new RTFValue(m_nValue, m_sValue, *m_pAttributes, *m_pSprms, m_xShape, m_xStream, m_bForceString); return new RTFValue(m_nValue, m_sValue, *m_pAttributes, *m_pSprms, m_xShape, m_xStream, m_xObject, m_bForceString);
} }
RTFSprms& RTFValue::getAttributes() RTFSprms& RTFValue::getAttributes()
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <resourcemodel/WW8ResourceModel.hxx> #include <resourcemodel/WW8ResourceModel.hxx>
#include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
namespace writerfilter { namespace writerfilter {
namespace rtftok { namespace rtftok {
...@@ -41,13 +42,14 @@ namespace writerfilter { ...@@ -41,13 +42,14 @@ namespace writerfilter {
public: public:
typedef boost::shared_ptr<RTFValue> Pointer_t; typedef boost::shared_ptr<RTFValue> Pointer_t;
RTFValue(int nValue, rtl::OUString sValue, RTFSprms rAttributes, RTFSprms rSprms, uno::Reference<drawing::XShape> rShape, RTFValue(int nValue, rtl::OUString sValue, RTFSprms rAttributes, RTFSprms rSprms, uno::Reference<drawing::XShape> rShape,
uno::Reference<io::XInputStream> rStream, bool bForceString); uno::Reference<io::XInputStream> rStream, uno::Reference<embed::XEmbeddedObject> rObject, bool bForceString);
RTFValue(int nValue); RTFValue(int nValue);
RTFValue(rtl::OUString sValue, bool bForce = false); RTFValue(rtl::OUString sValue, bool bForce = false);
RTFValue(RTFSprms rAttributes); RTFValue(RTFSprms rAttributes);
RTFValue(RTFSprms rAttributes, RTFSprms rSprms); RTFValue(RTFSprms rAttributes, RTFSprms rSprms);
RTFValue(uno::Reference<drawing::XShape> rShape); RTFValue(uno::Reference<drawing::XShape> rShape);
RTFValue(uno::Reference<io::XInputStream> rStream); RTFValue(uno::Reference<io::XInputStream> rStream);
RTFValue(uno::Reference<embed::XEmbeddedObject> rObject);
virtual ~RTFValue(); virtual ~RTFValue();
void setString(rtl::OUString sValue); void setString(rtl::OUString sValue);
virtual int getInt() const; virtual int getInt() const;
...@@ -68,6 +70,7 @@ namespace writerfilter { ...@@ -68,6 +70,7 @@ namespace writerfilter {
boost::shared_ptr<RTFSprms> m_pSprms; boost::shared_ptr<RTFSprms> m_pSprms;
uno::Reference<drawing::XShape> m_xShape; uno::Reference<drawing::XShape> m_xShape;
uno::Reference<io::XInputStream> m_xStream; uno::Reference<io::XInputStream> m_xStream;
uno::Reference<embed::XEmbeddedObject> m_xObject;
bool m_bForceString; bool m_bForceString;
}; };
} // namespace rtftok } // namespace rtftok
......
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