From 7d146140fed8fb46963c9d03a4b90a018a4a93b7 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 7 Jul 2011 12:35:36 +0200 Subject: [PATCH] introduce method to create shape instance easily --- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 12 ++++++++---- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index f9505a8e6061..45b0dcc4355a 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -2433,15 +2432,20 @@ int RTFDocumentImpl::popState() return 0; } +void RTFDocumentImpl::createShape(OUString aStr, uno::Reference& xShape, uno::Reference& xPropertySet) +{ + xShape.set(m_xModelFactory->createInstance(aStr), uno::UNO_QUERY); + xPropertySet.set(xShape, uno::UNO_QUERY); +} + void RTFDocumentImpl::resolveShapeProperties(std::vector< std::pair >& rShapeProperties) { int nType = -1; bool bPib = false; - OUString aService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape")); uno::Reference xShape; - xShape.set(m_xModelFactory->createInstance(aService), uno::UNO_QUERY); - uno::Reference xPropertySet(xShape, uno::UNO_QUERY); + uno::Reference xPropertySet; + createShape(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape")), xShape, xPropertySet); // Defaults uno::Any aAny; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 58434c3b0e56..b9133ed80065 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -249,6 +250,9 @@ namespace writerfilter { int resolveParse(); int resolveKeyword(); void resolveShapeProperties(std::vector< std::pair >& rShapeProperties); + void createShape(rtl::OUString aService, + com::sun::star::uno::Reference& xShape, + com::sun::star::uno::Reference& xPropertySet); int dispatchKeyword(rtl::OString& rKeyword, bool bParam, int nParam); int dispatchFlag(RTFKeyword nKeyword);