diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-04-09 16:07:05 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-04-10 07:32:16 +0200 |
commit | 7c50826d9a233499277da83fd57bafd834262ec6 (patch) | |
tree | 1b7267b85a24bf2e58324be57ba0cacc628d7158 /writerfilter | |
parent | RTF import of new-style frames: avoid fake empty paragraph at the end (diff) | |
download | core-7c50826d9a233499277da83fd57bafd834262ec6.tar.gz core-7c50826d9a233499277da83fd57bafd834262ec6.zip |
RTF import of new-style frames: fix defaults
Change-Id: I0b674f770f467a32dc2fa5bb7227f038addae4a8
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 26 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 40 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.hxx | 2 |
3 files changed, 43 insertions, 25 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 231ccefb1622..b458bffa651c 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2551,29 +2551,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_DPTXBX: { m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY); - // These are the default in Word, but not in Writer - beans::PropertyValue aPropertyValue; - aPropertyValue.Name = "HoriOrient"; - aPropertyValue.Value <<= text::HoriOrientation::NONE; - m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); - aPropertyValue.Name = "VertOrient"; - aPropertyValue.Value <<= text::VertOrientation::NONE; - m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); - aPropertyValue.Name = "BackColorTransparency"; - aPropertyValue.Value <<= sal_Int32(100); - m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); - aPropertyValue.Name = "LeftBorderDistance"; - aPropertyValue.Value <<= sal_Int32(0); - m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); - aPropertyValue.Name = "RightBorderDistance"; - aPropertyValue.Value <<= sal_Int32(0); - m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); - aPropertyValue.Name = "TopBorderDistance"; - aPropertyValue.Value <<= sal_Int32(0); - m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); - aPropertyValue.Name = "BottomBorderDistance"; - aPropertyValue.Value <<= sal_Int32(0); - m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); + std::vector<beans::PropertyValue> aDefaults = m_pSdrImport->getTextFrameDefaults(); + for (size_t i = 0; i < aDefaults.size(); ++i) + m_aStates.top().aDrawingObject.aPendingProperties.push_back(aDefaults[i]); } break; default: diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 0363f73c27f7..5fdfeb4c769a 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -32,6 +32,8 @@ #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp> +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/WrapTextMode.hpp> #include <com/sun/star/text/WritingMode.hpp> @@ -67,6 +69,35 @@ void RTFSdrImport::createShape(OUString aStr, uno::Reference<drawing::XShape>& x xPropertySet.set(xShape, uno::UNO_QUERY); } +std::vector<beans::PropertyValue> RTFSdrImport::getTextFrameDefaults() +{ + std::vector<beans::PropertyValue> aRet; + beans::PropertyValue aPropertyValue; + + aPropertyValue.Name = "HoriOrient"; + aPropertyValue.Value <<= text::HoriOrientation::NONE; + aRet.push_back(aPropertyValue); + aPropertyValue.Name = "VertOrient"; + aPropertyValue.Value <<= text::VertOrientation::NONE; + aRet.push_back(aPropertyValue); + aPropertyValue.Name = "BackColorTransparency"; + aPropertyValue.Value <<= sal_Int32(100); + aRet.push_back(aPropertyValue); + aPropertyValue.Name = "LeftBorderDistance"; + aPropertyValue.Value <<= sal_Int32(0); + aRet.push_back(aPropertyValue); + aPropertyValue.Name = "RightBorderDistance"; + aPropertyValue.Value <<= sal_Int32(0); + aRet.push_back(aPropertyValue); + aPropertyValue.Name = "TopBorderDistance"; + aPropertyValue.Value <<= sal_Int32(0); + aRet.push_back(aPropertyValue); + aPropertyValue.Name = "BottomBorderDistance"; + aPropertyValue.Value <<= sal_Int32(0); + aRet.push_back(aPropertyValue); + return aRet; +} + void RTFSdrImport::resolveDhgt(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nZOrder) { writerfilter::dmapper::DomainMapper& rMapper = (writerfilter::dmapper::DomainMapper&)m_rImport.Mapper(); @@ -113,8 +144,13 @@ void RTFSdrImport::resolve(RTFShape& rShape) createShape("com.sun.star.drawing.LineShape", xShape, xPropertySet); break; case ESCHER_ShpInst_TextBox: - createShape("com.sun.star.text.TextFrame", xShape, xPropertySet); - bTextFrame = true; + { + createShape("com.sun.star.text.TextFrame", xShape, xPropertySet); + bTextFrame = true; + std::vector<beans::PropertyValue> aDefaults = getTextFrameDefaults(); + for (size_t j = 0; j < aDefaults.size(); ++j) + xPropertySet->setPropertyValue(aDefaults[j].Name, aDefaults[j].Value); + } break; default: bCustom = true; diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index a508f7752687..6c39fbce8365 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.hxx +++ b/writerfilter/source/rtftok/rtfsdrimport.hxx @@ -43,6 +43,8 @@ namespace writerfilter { void resolve(RTFShape& rShape); void resolveDhgt(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nZOrder); void resolveFLine(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nFLine); + /// These are the default in Word, but not in Writer. + std::vector<beans::PropertyValue> getTextFrameDefaults(); private: void createShape(OUString aService, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet); |