introduce method to create shape instance easily

This commit is contained in:
Miklos Vajna 2011-07-07 12:35:36 +02:00
parent f9e0f09696
commit 7d146140fe
2 changed files with 12 additions and 4 deletions

View file

@ -43,7 +43,6 @@
#include <editeng/borderline.hxx> #include <editeng/borderline.hxx>
#include <unotools/streamwrap.hxx> #include <unotools/streamwrap.hxx>
#include <svx/msdffdef.hxx> #include <svx/msdffdef.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp> #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/drawing/LineStyle.hpp>
@ -2433,15 +2432,20 @@ int RTFDocumentImpl::popState()
return 0; return 0;
} }
void RTFDocumentImpl::createShape(OUString aStr, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet)
{
xShape.set(m_xModelFactory->createInstance(aStr), uno::UNO_QUERY);
xPropertySet.set(xShape, uno::UNO_QUERY);
}
void RTFDocumentImpl::resolveShapeProperties(std::vector< std::pair<rtl::OUString, rtl::OUString> >& rShapeProperties) void RTFDocumentImpl::resolveShapeProperties(std::vector< std::pair<rtl::OUString, rtl::OUString> >& rShapeProperties)
{ {
int nType = -1; int nType = -1;
bool bPib = false; bool bPib = false;
OUString aService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape"));
uno::Reference<drawing::XShape> xShape; uno::Reference<drawing::XShape> xShape;
xShape.set(m_xModelFactory->createInstance(aService), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropertySet;
uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); createShape(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape")), xShape, xPropertySet);
// Defaults // Defaults
uno::Any aAny; uno::Any aAny;

View file

@ -38,6 +38,7 @@
#include <oox/helper/storagebase.hxx> #include <oox/helper/storagebase.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <resourcemodel/WW8ResourceModel.hxx> #include <resourcemodel/WW8ResourceModel.hxx>
#include <rtftok/RTFDocument.hxx> #include <rtftok/RTFDocument.hxx>
@ -249,6 +250,9 @@ namespace writerfilter {
int resolveParse(); int resolveParse();
int resolveKeyword(); int resolveKeyword();
void resolveShapeProperties(std::vector< std::pair<rtl::OUString, rtl::OUString> >& rShapeProperties); void resolveShapeProperties(std::vector< std::pair<rtl::OUString, rtl::OUString> >& rShapeProperties);
void createShape(rtl::OUString aService,
com::sun::star::uno::Reference<drawing::XShape>& xShape,
com::sun::star::uno::Reference<beans::XPropertySet>& xPropertySet);
int dispatchKeyword(rtl::OString& rKeyword, bool bParam, int nParam); int dispatchKeyword(rtl::OString& rKeyword, bool bParam, int nParam);
int dispatchFlag(RTFKeyword nKeyword); int dispatchFlag(RTFKeyword nKeyword);