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

fix new-style RTF frame default internal margin values

Change-Id: I1a4819905f0fc2e8dbbcf7d9570785ad4384dc39
üst 55131d40
...@@ -2561,7 +2561,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -2561,7 +2561,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_DPTXBX: case RTF_DPTXBX:
{ {
m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY); 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) for (size_t i = 0; i < aDefaults.size(); ++i)
m_aStates.top().aDrawingObject.aPendingProperties.push_back(aDefaults[i]); m_aStates.top().aDrawingObject.aPendingProperties.push_back(aDefaults[i]);
} }
......
...@@ -75,7 +75,7 @@ void RTFSdrImport::createShape(OUString aStr, uno::Reference<drawing::XShape>& x ...@@ -75,7 +75,7 @@ void RTFSdrImport::createShape(OUString aStr, uno::Reference<drawing::XShape>& x
xPropertySet.set(xShape, uno::UNO_QUERY); 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; std::vector<beans::PropertyValue> aRet;
beans::PropertyValue aPropertyValue; beans::PropertyValue aPropertyValue;
...@@ -86,20 +86,24 @@ std::vector<beans::PropertyValue> RTFSdrImport::getTextFrameDefaults() ...@@ -86,20 +86,24 @@ std::vector<beans::PropertyValue> RTFSdrImport::getTextFrameDefaults()
aPropertyValue.Name = "VertOrient"; aPropertyValue.Name = "VertOrient";
aPropertyValue.Value <<= text::VertOrientation::NONE; aPropertyValue.Value <<= text::VertOrientation::NONE;
aRet.push_back(aPropertyValue); aRet.push_back(aPropertyValue);
aPropertyValue.Name = "BackColorTransparency"; if (!bNew)
aPropertyValue.Value <<= sal_Int32(100); {
aRet.push_back(aPropertyValue); 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.Name = "LeftBorderDistance";
aPropertyValue.Value <<= sal_Int32(0); aPropertyValue.Value <<= sal_Int32(bNew ? (91440 / 360) : 0);
aRet.push_back(aPropertyValue); aRet.push_back(aPropertyValue);
aPropertyValue.Name = "RightBorderDistance"; aPropertyValue.Name = "RightBorderDistance";
aPropertyValue.Value <<= sal_Int32(0); aPropertyValue.Value <<= sal_Int32(bNew ? (91440 / 360) : 0);
aRet.push_back(aPropertyValue); aRet.push_back(aPropertyValue);
aPropertyValue.Name = "TopBorderDistance"; aPropertyValue.Name = "TopBorderDistance";
aPropertyValue.Value <<= sal_Int32(0); aPropertyValue.Value <<= sal_Int32(bNew ? (45720 / 360) : 0);
aRet.push_back(aPropertyValue); aRet.push_back(aPropertyValue);
aPropertyValue.Name = "BottomBorderDistance"; aPropertyValue.Name = "BottomBorderDistance";
aPropertyValue.Value <<= sal_Int32(0); aPropertyValue.Value <<= sal_Int32(bNew ? (45720 / 360) : 0);
aRet.push_back(aPropertyValue); aRet.push_back(aPropertyValue);
aPropertyValue.Name = "SizeType"; aPropertyValue.Name = "SizeType";
aPropertyValue.Value <<= text::SizeType::FIX; aPropertyValue.Value <<= text::SizeType::FIX;
...@@ -161,7 +165,7 @@ void RTFSdrImport::resolve(RTFShape& rShape) ...@@ -161,7 +165,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
{ {
createShape("com.sun.star.text.TextFrame", xShape, xPropertySet); createShape("com.sun.star.text.TextFrame", xShape, xPropertySet);
bTextFrame = true; bTextFrame = true;
std::vector<beans::PropertyValue> aDefaults = getTextFrameDefaults(); std::vector<beans::PropertyValue> aDefaults = getTextFrameDefaults(true);
for (size_t j = 0; j < aDefaults.size(); ++j) for (size_t j = 0; j < aDefaults.size(); ++j)
xPropertySet->setPropertyValue(aDefaults[j].Name, aDefaults[j].Value); xPropertySet->setPropertyValue(aDefaults[j].Name, aDefaults[j].Value);
} }
...@@ -205,8 +209,6 @@ void RTFSdrImport::resolve(RTFShape& rShape) ...@@ -205,8 +209,6 @@ void RTFSdrImport::resolve(RTFShape& rShape)
// fillType will decide, possible it'll be the start color of a gradient. // 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)); 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" ) else if ( i->first == "fillBackColor" )
// fillType will decide, possible it'll be the end color of a gradient. // fillType will decide, possible it'll be the end color of a gradient.
......
...@@ -43,8 +43,12 @@ namespace writerfilter { ...@@ -43,8 +43,12 @@ namespace writerfilter {
void resolve(RTFShape& rShape); void resolve(RTFShape& rShape);
void resolveDhgt(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nZOrder); void resolveDhgt(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nZOrder);
void resolveFLine(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nFLine); 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: private:
void createShape(OUString aService, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet); void createShape(OUString aService, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet);
......
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