diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-12-28 14:08:33 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-01-05 09:18:15 +0000 |
commit | f80d46233150d36183ec3e03708f9f6290c8c339 (patch) | |
tree | 6711eae57d7fe77f005c6be2987b4457f4598872 /writerfilter | |
parent | catch by const ref (diff) | |
download | core-f80d46233150d36183ec3e03708f9f6290c8c339.tar.gz core-f80d46233150d36183ec3e03708f9f6290c8c339.zip |
callcatcher: drop some unused methods
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/inc/resourcemodel/util.hxx | 3 | ||||
-rw-r--r-- | writerfilter/source/resourcemodel/util.cxx | 346 |
2 files changed, 21 insertions, 328 deletions
diff --git a/writerfilter/inc/resourcemodel/util.hxx b/writerfilter/inc/resourcemodel/util.hxx index 45746b6f10f9..444c2f936ead 100644 --- a/writerfilter/inc/resourcemodel/util.hxx +++ b/writerfilter/inc/resourcemodel/util.hxx @@ -41,9 +41,6 @@ namespace writerfilter string WRITERFILTER_RESOURCEMODEL_DLLPUBLIC xmlify(const string & str); #if OSL_DEBUG_LEVEL > 1 - string WRITERFILTER_RESOURCEMODEL_DLLPUBLIC propertysetToString - (uno::Reference<beans::XPropertySet> const & rProps); - string WRITERFILTER_RESOURCEMODEL_DLLPUBLIC toString(uno::Reference< text::XTextRange > textRange); string WRITERFILTER_RESOURCEMODEL_DLLPUBLIC toString(const string & rString); #endif diff --git a/writerfilter/source/resourcemodel/util.cxx b/writerfilter/source/resourcemodel/util.cxx index f36a5797920c..a71a74b6ef66 100644 --- a/writerfilter/source/resourcemodel/util.cxx +++ b/writerfilter/source/resourcemodel/util.cxx @@ -65,342 +65,38 @@ void logger(string prefix, string message) logger_stream().flush(); } - string xmlify(const string & str) - { - string result = ""; - char sBuffer[16]; - - for (string::const_iterator aIt = str.begin(); aIt != str.end(); ++aIt) - { - char c = *aIt; - - if (isprint(c) && c != '\"') - { - if (c == '<') - result += "<"; - else if (c == '>') - result += ">"; - else if (c == '&') - result += "&"; - else - result += c; - } - else - { - snprintf(sBuffer, sizeof(sBuffer), "\\%03d", c); - result += sBuffer; - } - } - - return result; - } - -#if OSL_DEBUG_LEVEL > 1 -string propertysetToString(uno::Reference<beans::XPropertySet> const & xPropSet) +string xmlify(const string & str) { - string sResult; - - static int nAttribNames = 9; - static string sPropertyAttribNames[9] = - { - "MAYBEVOID", - "BOUND", - "CONSTRAINED", - "TRANSIENT", - "READONLY", - "MAYBEAMBIGUOUS", - "MAYBEDEFAULT", - "REMOVEABLE", - "OPTIONAL" - }; - - static const ::rtl::OUString sMetaFile(RTL_CONSTASCII_USTRINGPARAM("MetaFile")); - - uno::Reference<beans::XPropertySetInfo> xPropSetInfo - (xPropSet->getPropertySetInfo()); + string result = ""; + char sBuffer[16]; - if (xPropSetInfo.is()) + for (string::const_iterator aIt = str.begin(); aIt != str.end(); ++aIt) { - uno::Sequence<beans::Property> aProps(xPropSetInfo->getProperties()); + char c = *aIt; - sResult +="<propertyset>"; - - for (sal_Int32 n = 0; n < aProps.getLength(); n++) + if (isprint(c) && c != '\"') { - ::rtl::OUString sPropName(aProps[n].Name); - - if (xPropSetInfo->hasPropertyByName(sPropName)) - { - bool bPropertyFound = true; - uno::Any aAny; - try - { - if (sPropName == sMetaFile) - bPropertyFound = false; - else - xPropSet->getPropertyValue(sPropName) >>= aAny; - } - catch (beans::UnknownPropertyException) - { - bPropertyFound = false; - } - - if (bPropertyFound) - { - sResult += "<property name=\""; - sResult += OUStringToOString - (sPropName, RTL_TEXTENCODING_ASCII_US).getStr(); - sResult +="\" type=\""; - - ::rtl::OUString sPropType(aProps[n].Type.getTypeName()); - sResult += OUStringToOString - (sPropType, RTL_TEXTENCODING_ASCII_US).getStr(); - - sResult += "\" attribs=\""; - - sal_uInt16 nMask = 1; - bool bFirstAttrib = true; - sal_uInt16 nAttribs = aProps[n].Attributes; - for (int i = 0; i < nAttribNames; i++) - { - if ((nAttribs & nMask) != 0) - { - if (bFirstAttrib) - bFirstAttrib = false; - else - sResult += "|"; - - sResult += sPropertyAttribNames[i]; - } - - nMask <<= 1; - } - - sResult += "\">"; - - char buffer[256]; - if (sPropType == - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM - ("byte"))) - { - sal_Int8 nValue = 0; - aAny >>= nValue; - - snprintf(buffer, sizeof(buffer), "%d", nValue); - sResult += buffer; - } - if (sPropType == - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM - ("short"))) - { - sal_Int16 nValue = 0; - aAny >>= nValue; - - snprintf(buffer, sizeof(buffer), "%d", nValue); - sResult += buffer; - } - else if (sPropType == - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM - ("long"))) - { - sal_Int32 nValue = 0; - aAny >>= nValue; - - snprintf(buffer, sizeof(buffer), "%" SAL_PRIdINT32, nValue); - sResult += buffer; - } - else if (sPropType == - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM - ("float"))) - { - float nValue = 0.0; - aAny >>= nValue; - - snprintf(buffer, sizeof(buffer), "%f", nValue); - sResult += buffer; - } - else if (sPropType == - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM - ("double"))) - { - double nValue = 0.0; - aAny >>= nValue; - - snprintf(buffer, sizeof(buffer), "%lf", nValue); - sResult += buffer; - } - else if (sPropType == - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM - ("boolean"))) - { - sal_Bool nValue = sal_False; - aAny >>= nValue; - - if (nValue) - sResult += "true"; - else - sResult += "false"; - } - else if (sPropType == - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM - ("string"))) - { - ::rtl::OUString sValue; - aAny >>= sValue; - - sResult += OUStringToOString - (sValue, RTL_TEXTENCODING_ASCII_US).getStr(); - } - else if (sPropType == - ::rtl::OUString - (RTL_CONSTASCII_USTRINGPARAM - ("com.sun.star.text.TextContentAnchorType"))) - { - text::TextContentAnchorType nValue; - aAny >>= nValue; - - switch (nValue) - { - case text::TextContentAnchorType_AT_PARAGRAPH: - sResult += "AT_PARAGRAPH"; - break; - case text::TextContentAnchorType_AS_CHARACTER: - sResult += "AS_CHARACTER"; - break; - case text::TextContentAnchorType_AT_PAGE: - sResult += "AT_PAGE"; - break; - case text::TextContentAnchorType_AT_FRAME: - sResult += "AT_FRAME"; - break; - case text::TextContentAnchorType_AT_CHARACTER: - sResult += "AT_CHARACTER"; - break; - case text::TextContentAnchorType_MAKE_FIXED_SIZE: - sResult += "MAKE_FIXED_SIZE"; - break; - default: - break; - } - } - else if (sPropType == - ::rtl::OUString - (RTL_CONSTASCII_USTRINGPARAM - ("com.sun.star.awt.Point"))) - { - awt::Point aPoint; - aAny >>= aPoint; - - snprintf(buffer, sizeof(buffer), "(%" SAL_PRIdINT32 ", %" SAL_PRIdINT32 ")", aPoint.X, - aPoint.Y); - - sResult += buffer; - } - else if (sPropType == - ::rtl::OUString - (RTL_CONSTASCII_USTRINGPARAM - ("com.sun.star.awt.Rectangle"))) - { - awt::Rectangle aRect; - aAny >>= aRect; - - snprintf(buffer, sizeof(buffer), "(%" SAL_PRIdINT32 ", %" SAL_PRIdINT32 ", %" SAL_PRIdINT32 ", %" SAL_PRIdINT32 ")", - aRect.X, aRect.Y, aRect.Width, aRect.Height); - sResult += buffer; - } - else if (sPropType == - ::rtl::OUString - (RTL_CONSTASCII_USTRINGPARAM - ("com.sun.star.drawing.FillStyle"))) - { - drawing::FillStyle nValue; - aAny >>= nValue; - - switch (nValue) - { - case drawing::FillStyle_NONE: - sResult += "NONE"; - break; - case drawing::FillStyle_SOLID: - sResult += "SOLID"; - break; - case drawing::FillStyle_GRADIENT: - sResult += "GRADIENT"; - break; - case drawing::FillStyle_HATCH: - sResult += "HATCH"; - break; - case drawing::FillStyle_BITMAP: - sResult += "BITMAP"; - break; - case drawing::FillStyle_MAKE_FIXED_SIZE: - sResult += "MAKE_FIXED_SIZE"; - break; - } - } - else if (sPropType == - ::rtl::OUString - (RTL_CONSTASCII_USTRINGPARAM - ("com.sun.star.drawing.BitmapMode"))) - { - drawing::BitmapMode nValue; - aAny >>= nValue; - - switch (nValue) - { - case drawing::BitmapMode_REPEAT: - sResult += "REPEAT"; - break; - case drawing::BitmapMode_STRETCH: - sResult += "STRETCH"; - break; - case drawing::BitmapMode_NO_REPEAT: - sResult += "NO_REPEAT"; - break; - case drawing::BitmapMode_MAKE_FIXED_SIZE: - sResult += "MAKE_FIXED_SIZE"; - break; - } - } - else if (sPropType == - ::rtl::OUString - (RTL_CONSTASCII_USTRINGPARAM - ("com.sun.star.drawing.HomogenMatrix3"))) - { - drawing::HomogenMatrix3 aMatrix; - aAny >>= aMatrix; - - snprintf(buffer, sizeof(buffer), - "((%f %f %f)(%f %f %f)(%f %f %f))", - aMatrix.Line1.Column1, - aMatrix.Line1.Column2, - aMatrix.Line1.Column3, - aMatrix.Line2.Column1, - aMatrix.Line2.Column2, - aMatrix.Line2.Column3, - aMatrix.Line3.Column1, - aMatrix.Line3.Column2, - aMatrix.Line3.Column3); - sResult += buffer; - } - - sResult += "</property>"; - } - } + if (c == '<') + result += "<"; + else if (c == '>') + result += ">"; + else if (c == '&') + result += "&"; else - { - sResult += "<unknown-property>"; - sResult += OUStringToOString - (sPropName, RTL_TEXTENCODING_ASCII_US).getStr(); - sResult += "</unknown-property>"; - } + result += c; + } + else + { + snprintf(sBuffer, sizeof(sBuffer), "\\%03d", c); + result += sBuffer; } - sResult += "</propertyset>"; } - return sResult; + return result; } +#if OSL_DEBUG_LEVEL > 1 + string toString(uno::Reference< text::XTextRange > textRange) { string result; |