diff options
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 24 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.hxx | 8 |
3 files changed, 20 insertions, 14 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index ed142bd9bbe5..f1268f546d50 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2561,7 +2561,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_DPTXBX: { m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY); - std::vector<beans::PropertyValue> aDefaults = m_pSdrImport->getTextFrameDefaults(); + std::vector<beans::PropertyValue> aDefaults = m_pSdrImport->getTextFrameDefaults(false); for (size_t i = 0; i < aDefaults.size(); ++i) m_aStates.top().aDrawingObject.aPendingProperties.push_back(aDefaults[i]); } diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index b0399f601225..9fbd3c21df78 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -75,7 +75,7 @@ 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> RTFSdrImport::getTextFrameDefaults(bool bNew) { std::vector<beans::PropertyValue> aRet; beans::PropertyValue aPropertyValue; @@ -86,20 +86,24 @@ std::vector<beans::PropertyValue> RTFSdrImport::getTextFrameDefaults() aPropertyValue.Name = "VertOrient"; aPropertyValue.Value <<= text::VertOrientation::NONE; aRet.push_back(aPropertyValue); - aPropertyValue.Name = "BackColorTransparency"; - aPropertyValue.Value <<= sal_Int32(100); - aRet.push_back(aPropertyValue); + if (!bNew) + { + aPropertyValue.Name = "BackColorTransparency"; + aPropertyValue.Value <<= sal_Int32(100); + aRet.push_back(aPropertyValue); + } + // See the spec, new-style frame default margins are specified in EMUs. aPropertyValue.Name = "LeftBorderDistance"; - aPropertyValue.Value <<= sal_Int32(0); + aPropertyValue.Value <<= sal_Int32(bNew ? (91440 / 360) : 0); aRet.push_back(aPropertyValue); aPropertyValue.Name = "RightBorderDistance"; - aPropertyValue.Value <<= sal_Int32(0); + aPropertyValue.Value <<= sal_Int32(bNew ? (91440 / 360) : 0); aRet.push_back(aPropertyValue); aPropertyValue.Name = "TopBorderDistance"; - aPropertyValue.Value <<= sal_Int32(0); + aPropertyValue.Value <<= sal_Int32(bNew ? (45720 / 360) : 0); aRet.push_back(aPropertyValue); aPropertyValue.Name = "BottomBorderDistance"; - aPropertyValue.Value <<= sal_Int32(0); + aPropertyValue.Value <<= sal_Int32(bNew ? (45720 / 360) : 0); aRet.push_back(aPropertyValue); aPropertyValue.Name = "SizeType"; aPropertyValue.Value <<= text::SizeType::FIX; @@ -161,7 +165,7 @@ void RTFSdrImport::resolve(RTFShape& rShape) { createShape("com.sun.star.text.TextFrame", xShape, xPropertySet); bTextFrame = true; - std::vector<beans::PropertyValue> aDefaults = getTextFrameDefaults(); + std::vector<beans::PropertyValue> aDefaults = getTextFrameDefaults(true); for (size_t j = 0; j < aDefaults.size(); ++j) xPropertySet->setPropertyValue(aDefaults[j].Name, aDefaults[j].Value); } @@ -205,8 +209,6 @@ void RTFSdrImport::resolve(RTFShape& rShape) // fillType will decide, possible it'll be the start color of a gradient. aFillModel.moColor.set(OUString("#") + OStringToOUString(msfilter::util::ConvertColor(aAny.get<sal_Int32>()), RTL_TEXTENCODING_UTF8)); - - xPropertySet->setPropertyValue("BackColorTransparency", uno::makeAny(sal_Int32(0))); } else if ( i->first == "fillBackColor" ) // fillType will decide, possible it'll be the end color of a gradient. diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index 6c39fbce8365..984f28790c58 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.hxx +++ b/writerfilter/source/rtftok/rtfsdrimport.hxx @@ -43,8 +43,12 @@ 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(); + /** + * These are the default in Word, but not in Writer. + * + * @param bNew if the frame is new-style or old-style. + */ + std::vector<beans::PropertyValue> getTextFrameDefaults(bool bNew); private: void createShape(OUString aService, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet); |