rtftok: RTL_CONSTASCII_USTRINGPARAM removals

This commit is contained in:
Miklos Vajna
2012-04-15 00:34:11 +02:00
parent b32ae7fbaa
commit 93b1c8b4a5
2 changed files with 31 additions and 38 deletions

View File

@@ -624,9 +624,8 @@ int RTFDocumentImpl::resolvePict(bool bInline)
// Wrap it in an XShape. // Wrap it in an XShape.
uno::Reference<drawing::XShape> xShape; uno::Reference<drawing::XShape> xShape;
OUString aService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicObjectShape"));
if (m_xModelFactory.is()) if (m_xModelFactory.is())
xShape.set(m_xModelFactory->createInstance(aService), uno::UNO_QUERY); xShape.set(m_xModelFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier( m_xDstDoc, uno::UNO_QUERY); uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier( m_xDstDoc, uno::UNO_QUERY);
if ( xDrawSupplier.is() ) if ( xDrawSupplier.is() )
@@ -639,15 +638,12 @@ int RTFDocumentImpl::resolvePict(bool bInline)
{ {
// Set bitmap // Set bitmap
beans::PropertyValues aMediaProperties(1); beans::PropertyValues aMediaProperties(1);
aMediaProperties[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("URL")); aMediaProperties[0].Name = "URL";
aMediaProperties[0].Value <<= aGraphicUrl; aMediaProperties[0].Value <<= aGraphicUrl;
uno::Reference<graphic::XGraphicProvider> xGraphicProvider( uno::Reference<graphic::XGraphicProvider> xGraphicProvider(m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.graphic.GraphicProvider", m_xContext),
m_xContext->getServiceManager()->createInstanceWithContext(
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")),
m_xContext),
uno::UNO_QUERY_THROW); uno::UNO_QUERY_THROW);
uno::Reference<graphic::XGraphic> xGraphic = xGraphicProvider->queryGraphic(aMediaProperties); uno::Reference<graphic::XGraphic> xGraphic = xGraphicProvider->queryGraphic(aMediaProperties);
xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Graphic")), uno::Any(xGraphic)); xPropertySet->setPropertyValue("Graphic", uno::Any(xGraphic));
// Set the object size // Set the object size
awt::Size aSize; awt::Size aSize;
@@ -660,7 +656,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
return 0; return 0;
} }
if (xPropertySet.is()) if (xPropertySet.is())
xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL")), uno::Any(aGraphicUrl)); xPropertySet->setPropertyValue("GraphicURL", uno::Any(aGraphicUrl));
// Send it to the dmapper. // Send it to the dmapper.
RTFSprms aSprms; RTFSprms aSprms;
@@ -1967,15 +1963,13 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
{ {
if (!m_pCurrentBuffer) if (!m_pCurrentBuffer)
m_pCurrentBuffer = &m_aSuperBuffer; m_pCurrentBuffer = &m_aSuperBuffer;
OUString aValue(RTL_CONSTASCII_USTRINGPARAM("superscript")); RTFValue::Pointer_t pValue(new RTFValue("superscript"));
RTFValue::Pointer_t pValue(new RTFValue(aValue));
m_aStates.top().aCharacterSprms->push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue)); m_aStates.top().aCharacterSprms->push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue));
} }
break; break;
case RTF_SUB: case RTF_SUB:
{ {
OUString aValue(RTL_CONSTASCII_USTRINGPARAM("subscript")); RTFValue::Pointer_t pValue(new RTFValue("subscript"));
RTFValue::Pointer_t pValue(new RTFValue(aValue));
m_aStates.top().aCharacterSprms->push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue)); m_aStates.top().aCharacterSprms->push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue));
} }
break; break;
@@ -2047,7 +2041,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_DPLINE: case RTF_DPLINE:
{ {
m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.LineShape"))), uno::UNO_QUERY); m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.LineShape"), uno::UNO_QUERY);
m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY); m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY);
std::vector<beans::PropertyValue>& rPendingProperties = m_aStates.top().aDrawingObject.aPendingProperties; std::vector<beans::PropertyValue>& rPendingProperties = m_aStates.top().aDrawingObject.aPendingProperties;
for (std::vector<beans::PropertyValue>::iterator i = rPendingProperties.begin(); i != rPendingProperties.end(); ++i) for (std::vector<beans::PropertyValue>::iterator i = rPendingProperties.begin(); i != rPendingProperties.end(); ++i)
@@ -2058,7 +2052,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_DOBYMARGIN: case RTF_DOBYMARGIN:
{ {
beans::PropertyValue aPropertyValue; beans::PropertyValue aPropertyValue;
aPropertyValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM((nKeyword == RTF_DOBXMARGIN ? "HoriOrientRelation" : "VertOrientRelation"))); aPropertyValue.Name = (nKeyword == RTF_DOBXMARGIN ? "HoriOrientRelation" : "VertOrientRelation");
aPropertyValue.Value <<= text::RelOrientation::PAGE_PRINT_AREA; aPropertyValue.Value <<= text::RelOrientation::PAGE_PRINT_AREA;
m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
} }
@@ -2067,7 +2061,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_DOBYPAGE: case RTF_DOBYPAGE:
{ {
beans::PropertyValue aPropertyValue; beans::PropertyValue aPropertyValue;
aPropertyValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM((nKeyword == RTF_DOBXPAGE ? "HoriOrientRelation" : "VertOrientRelation"))); aPropertyValue.Name = (nKeyword == RTF_DOBXPAGE ? "HoriOrientRelation" : "VertOrientRelation");
aPropertyValue.Value <<= text::RelOrientation::PAGE_FRAME; aPropertyValue.Value <<= text::RelOrientation::PAGE_FRAME;
m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue); m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
} }
@@ -2665,10 +2659,10 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
OUString aName; OUString aName;
switch (nKeyword) switch (nKeyword)
{ {
case RTF_NOFPAGES: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("PageCount")); nParam = 99; break; case RTF_NOFPAGES: aName = "PageCount"; nParam = 99; break;
case RTF_NOFWORDS: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("WordCount")); break; case RTF_NOFWORDS: aName = "WordCount"; break;
case RTF_NOFCHARS: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("CharacterCount")); break; case RTF_NOFCHARS: aName = "CharacterCount"; break;
case RTF_NOFCHARSWS: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("NonWhitespaceCharacterCount")); break; case RTF_NOFCHARSWS: aName = "NonWhitespaceCharacterCount"; break;
default: break; default: break;
} }
if (!aName.isEmpty()) if (!aName.isEmpty())
@@ -3181,8 +3175,7 @@ int RTFDocumentImpl::popState()
else if (m_aStates.top().nDestinationState == DESTINATION_OPERATOR else if (m_aStates.top().nDestinationState == DESTINATION_OPERATOR
|| m_aStates.top().nDestinationState == DESTINATION_COMPANY) || m_aStates.top().nDestinationState == DESTINATION_COMPANY)
{ {
OUString aName = m_aStates.top().nDestinationState == DESTINATION_OPERATOR ? OUString aName = m_aStates.top().nDestinationState == DESTINATION_OPERATOR ? OUString("Operator") : OUString("Company");
OUString(RTL_CONSTASCII_USTRINGPARAM("Operator")) : OUString(RTL_CONSTASCII_USTRINGPARAM("Company"));
if (m_xDocumentProperties.is()) if (m_xDocumentProperties.is())
{ {
uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = m_xDocumentProperties->getUserDefinedProperties(); uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = m_xDocumentProperties->getUserDefinedProperties();

View File

@@ -88,7 +88,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
uno::Reference<drawing::XShape> xShape; uno::Reference<drawing::XShape> xShape;
uno::Reference<beans::XPropertySet> xPropertySet; uno::Reference<beans::XPropertySet> xPropertySet;
// Create this early, as custom shapes may have properties before the type arrives. // Create this early, as custom shapes may have properties before the type arrives.
createShape(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape")), xShape, xPropertySet); createShape("com.sun.star.drawing.CustomShape", xShape, xPropertySet);
uno::Any aAny; uno::Any aAny;
beans::PropertyValue aPropertyValue; beans::PropertyValue aPropertyValue;
awt::Rectangle aViewBox; awt::Rectangle aViewBox;
@@ -103,7 +103,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
switch (nType) switch (nType)
{ {
case 20: // Line case 20: // Line
createShape(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.LineShape")), xShape, xPropertySet); createShape("com.sun.star.drawing.LineShape", xShape, xPropertySet);
break; break;
default: default:
bCustom = true; bCustom = true;
@@ -113,7 +113,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
// Defaults // Defaults
aAny <<= (sal_uInt32)0xffffff; // White in Word, kind of blue in Writer. aAny <<= (sal_uInt32)0xffffff; // White in Word, kind of blue in Writer.
if (xPropertySet.is()) if (xPropertySet.is())
xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), aAny); xPropertySet->setPropertyValue("FillColor", aAny);
} }
else if ( i->first == "wzName" ) else if ( i->first == "wzName" )
{ {
@@ -130,34 +130,34 @@ void RTFSdrImport::resolve(RTFShape& rShape)
m_rImport.setDestinationText(i->second); m_rImport.setDestinationText(i->second);
bPib = true; bPib = true;
} }
else if (i->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("fillColor")) && xPropertySet.is()) else if (i->first == "fillColor" && xPropertySet.is())
{ {
aAny <<= lcl_BGRToRGB(i->second.toInt32()); aAny <<= lcl_BGRToRGB(i->second.toInt32());
xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), aAny); xPropertySet->setPropertyValue("FillColor", aAny);
} }
else if ( i->first == "fillBackColor" ) else if ( i->first == "fillBackColor" )
; // Ignore: complementer of fillColor ; // Ignore: complementer of fillColor
else if (i->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("lineColor")) && xPropertySet.is()) else if (i->first == "lineColor" && xPropertySet.is())
{ {
aAny <<= lcl_BGRToRGB(i->second.toInt32()); aAny <<= lcl_BGRToRGB(i->second.toInt32());
xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("LineColor")), aAny); xPropertySet->setPropertyValue("LineColor", aAny);
} }
else if ( i->first == "lineBackColor" ) else if ( i->first == "lineBackColor" )
; // Ignore: complementer of lineColor ; // Ignore: complementer of lineColor
else if (i->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("txflTextFlow")) && xPropertySet.is()) else if (i->first == "txflTextFlow" && xPropertySet.is())
{ {
if (i->second.toInt32() == 1) if (i->second.toInt32() == 1)
{ {
aAny <<= text::WritingMode_TB_RL; aAny <<= text::WritingMode_TB_RL;
xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("TextWritingMode")), aAny); xPropertySet->setPropertyValue("TextWritingMode", aAny);
} }
} }
else if (i->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("fLine")) && xPropertySet.is()) else if (i->first == "fLine" && xPropertySet.is())
{ {
if (i->second.toInt32() == 0) if (i->second.toInt32() == 0)
{ {
aAny <<= drawing::LineStyle_NONE; aAny <<= drawing::LineStyle_NONE;
xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), aAny); xPropertySet->setPropertyValue("LineStyle", aAny);
} }
} }
else if ( i->first == "pVerticies" ) else if ( i->first == "pVerticies" )
@@ -199,7 +199,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
} }
} }
while (nCharIndex >= 0); while (nCharIndex >= 0);
aPropertyValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Coordinates")); aPropertyValue.Name = "Coordinates";
aPropertyValue.Value <<= aCoordinates; aPropertyValue.Value <<= aCoordinates;
aPathPropVec.push_back(aPropertyValue); aPathPropVec.push_back(aPropertyValue);
} }
@@ -257,7 +257,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
} }
} }
while (nCharIndex >= 0); while (nCharIndex >= 0);
aPropertyValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Segments")); aPropertyValue.Name = "Segments";
aPropertyValue.Value <<= aSegments; aPropertyValue.Value <<= aSegments;
aPathPropVec.push_back(aPropertyValue); aPathPropVec.push_back(aPropertyValue);
} }
@@ -300,13 +300,13 @@ void RTFSdrImport::resolve(RTFShape& rShape)
std::vector<beans::PropertyValue> aGeomPropVec; std::vector<beans::PropertyValue> aGeomPropVec;
if (aViewBox.X || aViewBox.Y || aViewBox.Width || aViewBox.Height) if (aViewBox.X || aViewBox.Y || aViewBox.Width || aViewBox.Height)
{ {
aPropertyValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("ViewBox")); aPropertyValue.Name = "ViewBox";
aPropertyValue.Value <<= aViewBox; aPropertyValue.Value <<= aViewBox;
aGeomPropVec.push_back(aPropertyValue); aGeomPropVec.push_back(aPropertyValue);
} }
if (aPathPropSeq.getLength()) if (aPathPropSeq.getLength())
{ {
aPropertyValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Path")); aPropertyValue.Name = "Path";
aPropertyValue.Value <<= aPathPropSeq; aPropertyValue.Value <<= aPathPropSeq;
aGeomPropVec.push_back(aPropertyValue); aGeomPropVec.push_back(aPropertyValue);
} }
@@ -315,7 +315,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
for (std::vector<beans::PropertyValue>::iterator i = aGeomPropVec.begin(); i != aGeomPropVec.end(); ++i) for (std::vector<beans::PropertyValue>::iterator i = aGeomPropVec.begin(); i != aGeomPropVec.end(); ++i)
*pGeomValues++ = *i; *pGeomValues++ = *i;
if (aGeomPropSeq.getLength() && xPropertySet.is()) if (aGeomPropSeq.getLength() && xPropertySet.is())
xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CustomShapeGeometry")), uno::Any(aGeomPropSeq)); xPropertySet->setPropertyValue("CustomShapeGeometry", uno::Any(aGeomPropSeq));
// Set position and size // Set position and size
if (xShape.is()) if (xShape.is())