[Libreoffice-commits] .: writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Sat Apr 14 15:34:28 PDT 2012


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   37 ++++++++++---------------
 writerfilter/source/rtftok/rtfsdrimport.cxx    |   32 ++++++++++-----------
 2 files changed, 31 insertions(+), 38 deletions(-)

New commits:
commit 93b1c8b4a5a0f2d12b21fb6e8e8a01c63d43027d
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sun Apr 15 00:34:11 2012 +0200

    rtftok: RTL_CONSTASCII_USTRINGPARAM removals

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 729e569..cab7df7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -624,9 +624,8 @@ int RTFDocumentImpl::resolvePict(bool bInline)
 
     // Wrap it in an XShape.
     uno::Reference<drawing::XShape> xShape;
-    OUString aService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicObjectShape"));
     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<drawing::XDrawPageSupplier> xDrawSupplier( m_xDstDoc, uno::UNO_QUERY);
     if ( xDrawSupplier.is() )
@@ -639,15 +638,12 @@ int RTFDocumentImpl::resolvePict(bool bInline)
     {
         // Set bitmap
         beans::PropertyValues aMediaProperties(1);
-        aMediaProperties[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
+        aMediaProperties[0].Name = "URL";
         aMediaProperties[0].Value <<= aGraphicUrl;
-        uno::Reference<graphic::XGraphicProvider> xGraphicProvider(
-                m_xContext->getServiceManager()->createInstanceWithContext(
-                    OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")),
-                    m_xContext),
+        uno::Reference<graphic::XGraphicProvider> xGraphicProvider(m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.graphic.GraphicProvider", m_xContext),
                 uno::UNO_QUERY_THROW);
         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
         awt::Size aSize;
@@ -660,7 +656,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
         return 0;
     }
     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.
     RTFSprms aSprms;
@@ -1967,15 +1963,13 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
             {
                 if (!m_pCurrentBuffer)
                     m_pCurrentBuffer = &m_aSuperBuffer;
-                OUString aValue(RTL_CONSTASCII_USTRINGPARAM("superscript"));
-                RTFValue::Pointer_t pValue(new RTFValue(aValue));
+                RTFValue::Pointer_t pValue(new RTFValue("superscript"));
                 m_aStates.top().aCharacterSprms->push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue));
             }
             break;
         case RTF_SUB:
             {
-                OUString aValue(RTL_CONSTASCII_USTRINGPARAM("subscript"));
-                RTFValue::Pointer_t pValue(new RTFValue(aValue));
+                RTFValue::Pointer_t pValue(new RTFValue("subscript"));
                 m_aStates.top().aCharacterSprms->push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue));
             }
             break;
@@ -2047,7 +2041,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 
         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);
                     std::vector<beans::PropertyValue>& rPendingProperties = m_aStates.top().aDrawingObject.aPendingProperties;
                     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:
                 {
                     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;
                     m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
                 }
@@ -2067,7 +2061,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
         case RTF_DOBYPAGE:
                 {
                     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;
                     m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
                 }
@@ -2665,10 +2659,10 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
                 OUString aName;
                 switch (nKeyword)
                 {
-                    case RTF_NOFPAGES: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("PageCount")); nParam = 99; break;
-                    case RTF_NOFWORDS: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("WordCount")); break;
-                    case RTF_NOFCHARS: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("CharacterCount")); break;
-                    case RTF_NOFCHARSWS: aName = OUString(RTL_CONSTASCII_USTRINGPARAM("NonWhitespaceCharacterCount")); break;
+                    case RTF_NOFPAGES: aName = "PageCount"; nParam = 99; break;
+                    case RTF_NOFWORDS: aName = "WordCount"; break;
+                    case RTF_NOFCHARS: aName = "CharacterCount"; break;
+                    case RTF_NOFCHARSWS: aName = "NonWhitespaceCharacterCount"; break;
                     default: break;
                 }
                 if (!aName.isEmpty())
@@ -3181,8 +3175,7 @@ int RTFDocumentImpl::popState()
     else if (m_aStates.top().nDestinationState == DESTINATION_OPERATOR
             || m_aStates.top().nDestinationState == DESTINATION_COMPANY)
     {
-        OUString aName = m_aStates.top().nDestinationState == DESTINATION_OPERATOR ?
-            OUString(RTL_CONSTASCII_USTRINGPARAM("Operator")) : OUString(RTL_CONSTASCII_USTRINGPARAM("Company"));
+        OUString aName = m_aStates.top().nDestinationState == DESTINATION_OPERATOR ? OUString("Operator") : OUString("Company");
         if (m_xDocumentProperties.is())
         {
             uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = m_xDocumentProperties->getUserDefinedProperties();
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index ca2c3cb..01b1d00 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -88,7 +88,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
     uno::Reference<drawing::XShape> xShape;
     uno::Reference<beans::XPropertySet> xPropertySet;
     // 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;
     beans::PropertyValue aPropertyValue;
     awt::Rectangle aViewBox;
@@ -103,7 +103,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
             switch (nType)
             {
                 case 20: // Line
-                    createShape(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.LineShape")), xShape, xPropertySet);
+                    createShape("com.sun.star.drawing.LineShape", xShape, xPropertySet);
                     break;
                 default:
                     bCustom = true;
@@ -113,7 +113,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
             // Defaults
             aAny <<= (sal_uInt32)0xffffff; // White in Word, kind of blue in Writer.
             if (xPropertySet.is())
-                xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), aAny);
+                xPropertySet->setPropertyValue("FillColor", aAny);
         }
         else if ( i->first == "wzName" )
         {
@@ -130,34 +130,34 @@ void RTFSdrImport::resolve(RTFShape& rShape)
             m_rImport.setDestinationText(i->second);
             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());
-            xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), aAny);
+            xPropertySet->setPropertyValue("FillColor", aAny);
         }
         else if ( i->first == "fillBackColor" )
             ; // 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());
-            xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("LineColor")), aAny);
+            xPropertySet->setPropertyValue("LineColor", aAny);
         }
         else if ( i->first == "lineBackColor" )
             ; // 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)
             {
                 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)
             {
                 aAny <<= drawing::LineStyle_NONE;
-                xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), aAny);
+                xPropertySet->setPropertyValue("LineStyle", aAny);
             }
         }
         else if ( i->first == "pVerticies" )
@@ -199,7 +199,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
                 }
             }
             while (nCharIndex >= 0);
-            aPropertyValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Coordinates"));
+            aPropertyValue.Name = "Coordinates";
             aPropertyValue.Value <<= aCoordinates;
             aPathPropVec.push_back(aPropertyValue);
         }
@@ -257,7 +257,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
                 }
             }
             while (nCharIndex >= 0);
-            aPropertyValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Segments"));
+            aPropertyValue.Name = "Segments";
             aPropertyValue.Value <<= aSegments;
             aPathPropVec.push_back(aPropertyValue);
         }
@@ -300,13 +300,13 @@ void RTFSdrImport::resolve(RTFShape& rShape)
     std::vector<beans::PropertyValue> aGeomPropVec;
     if (aViewBox.X || aViewBox.Y || aViewBox.Width || aViewBox.Height)
     {
-        aPropertyValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("ViewBox"));
+        aPropertyValue.Name = "ViewBox";
         aPropertyValue.Value <<= aViewBox;
         aGeomPropVec.push_back(aPropertyValue);
     }
     if (aPathPropSeq.getLength())
     {
-        aPropertyValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Path"));
+        aPropertyValue.Name = "Path";
         aPropertyValue.Value <<= aPathPropSeq;
         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)
         *pGeomValues++ = *i;
     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
     if (xShape.is())


More information about the Libreoffice-commits mailing list