Kaydet (Commit) 1a8ac8b2 authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

String and OUString cleaning in xmloff

Change-Id: I85d7fd7733814c60a048a7f87d43fbcbb83b0eb0
üst 739146b7
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#define _SW_XMLBLOCKIMPORT_HXX #define _SW_XMLBLOCKIMPORT_HXX
#include <xmloff/xmlimp.hxx> #include <xmloff/xmlimp.hxx>
#include <tools/string.hxx>
class SwXMLTextBlocks; class SwXMLTextBlocks;
class SwXMLBlockListImport : public SvXMLImport class SwXMLBlockListImport : public SvXMLImport
......
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
* *
************************************************************************/ ************************************************************************/
#include <tools/string.hxx>
#include <SwXMLSectionList.hxx> #include <SwXMLSectionList.hxx>
#include <xmloff/nmspmap.hxx> #include <xmloff/nmspmap.hxx>
#include <xmloff/xmlnmspe.hxx> #include <xmloff/xmlnmspe.hxx>
#include <tools/string.hxx>
#include <vector> #include <vector>
using namespace ::com::sun::star; using namespace ::com::sun::star;
......
This diff is collapsed.
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
*/ */
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <tools/string.hxx>
#include <xmloff/nmspmap.hxx> #include <xmloff/nmspmap.hxx>
#include "xmloff/xmlnmspe.hxx" #include "xmloff/xmlnmspe.hxx"
#include <xmloff/xmltoken.hxx> #include <xmloff/xmltoken.hxx>
...@@ -42,9 +41,6 @@ ...@@ -42,9 +41,6 @@
#include <set> #include <set>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::style; using namespace ::com::sun::star::style;
...@@ -57,7 +53,7 @@ using ::com::sun::star::document::XEventsSupplier; ...@@ -57,7 +53,7 @@ using ::com::sun::star::document::XEventsSupplier;
XMLStyleExport::XMLStyleExport( XMLStyleExport::XMLStyleExport(
SvXMLExport& rExp, SvXMLExport& rExp,
const ::rtl::OUString& rPoolStyleName, const OUString& rPoolStyleName,
SvXMLAutoStylePoolP *pAutoStyleP ) : SvXMLAutoStylePoolP *pAutoStyleP ) :
rExport( rExp ), rExport( rExp ),
sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ), sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
...@@ -84,7 +80,7 @@ void XMLStyleExport::exportStyleContent( const Reference< XStyle >& ) ...@@ -84,7 +80,7 @@ void XMLStyleExport::exportStyleContent( const Reference< XStyle >& )
sal_Bool XMLStyleExport::exportStyle( sal_Bool XMLStyleExport::exportStyle(
const Reference< XStyle >& rStyle, const Reference< XStyle >& rStyle,
const OUString& rXMLFamily, const OUString& rXMLFamily,
const UniReference < SvXMLExportPropertyMapper >& rPropMapper, const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
const Reference< XNameAccess >& xStyles, const Reference< XNameAccess >& xStyles,
const OUString* pPrefix ) const OUString* pPrefix )
...@@ -396,12 +392,12 @@ void XMLStyleExport::exportStyleFamily( ...@@ -396,12 +392,12 @@ void XMLStyleExport::exportStyleFamily(
// If next styles are supported and used styles should be exported only, // If next styles are supported and used styles should be exported only,
// the next style may be unused but has to be exported, too. In this case // the next style may be unused but has to be exported, too. In this case
// the names of all exported styles are remembered. // the names of all exported styles are remembered.
boost::scoped_ptr<std::set<String> > pExportedStyles(0); boost::scoped_ptr<std::set<OUString> > pExportedStyles(0);
sal_Bool bFirstStyle = sal_True; sal_Bool bFirstStyle = sal_True;
const uno::Sequence< ::rtl::OUString> aSeq = xStyles->getElementNames(); const uno::Sequence< OUString> aSeq = xStyles->getElementNames();
const ::rtl::OUString* pIter = aSeq.getConstArray(); const OUString* pIter = aSeq.getConstArray();
const ::rtl::OUString* pEnd = pIter + aSeq.getLength(); const OUString* pEnd = pIter + aSeq.getLength();
for(;pIter != pEnd;++pIter) for(;pIter != pEnd;++pIter)
{ {
Reference< XStyle > xStyle; Reference< XStyle > xStyle;
...@@ -434,7 +430,7 @@ void XMLStyleExport::exportStyleFamily( ...@@ -434,7 +430,7 @@ void XMLStyleExport::exportStyleFamily(
xPropSet->getPropertySetInfo(); xPropSet->getPropertySetInfo();
if( xPropSetInfo->hasPropertyByName( sFollowStyle ) ) if( xPropSetInfo->hasPropertyByName( sFollowStyle ) )
pExportedStyles.reset(new std::set<String>()); pExportedStyles.reset(new std::set<OUString>());
bFirstStyle = sal_False; bFirstStyle = sal_False;
} }
...@@ -487,7 +483,7 @@ void XMLStyleExport::exportStyleFamily( ...@@ -487,7 +483,7 @@ void XMLStyleExport::exportStyleFamily(
OUString sNextName; OUString sNextName;
xPropSet->getPropertyValue( sFollowStyle ) >>= sNextName; xPropSet->getPropertyValue( sFollowStyle ) >>= sNextName;
String sTmp( sNextName ); OUString sTmp( sNextName );
// if the next style hasn't been exported by now, export it now // if the next style hasn't been exported by now, export it now
// and remember its name. // and remember its name.
if( xStyle->getName() != sNextName && if( xStyle->getName() != sNextName &&
......
...@@ -1795,7 +1795,7 @@ sal_uInt32 SvXMLNumFmtExport::ForceSystemLanguage( sal_uInt32 nKey ) ...@@ -1795,7 +1795,7 @@ sal_uInt32 SvXMLNumFmtExport::ForceSystemLanguage( sal_uInt32 nKey )
{ {
DBG_ASSERT( pFormatter != NULL, "format without formatter?" ); DBG_ASSERT( pFormatter != NULL, "format without formatter?" );
xub_StrLen nErrorPos; sal_Int32 nErrorPos;
short nType = pFormat->GetType(); short nType = pFormat->GetType();
sal_uInt32 nNewKey = pFormatter->GetFormatForLanguageIfBuiltIn( sal_uInt32 nNewKey = pFormatter->GetFormatForLanguageIfBuiltIn(
...@@ -1807,7 +1807,7 @@ sal_uInt32 SvXMLNumFmtExport::ForceSystemLanguage( sal_uInt32 nKey ) ...@@ -1807,7 +1807,7 @@ sal_uInt32 SvXMLNumFmtExport::ForceSystemLanguage( sal_uInt32 nKey )
} }
else else
{ {
String aFormatString( pFormat->GetFormatstring() ); OUString aFormatString( pFormat->GetFormatstring() );
pFormatter->PutandConvertEntry( pFormatter->PutandConvertEntry(
aFormatString, aFormatString,
nErrorPos, nType, nNewKey, nErrorPos, nType, nNewKey,
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <tools/fontenum.hxx> #include <tools/fontenum.hxx>
#include <tools/string.hxx>
#include <sax/tools/converter.hxx> #include <sax/tools/converter.hxx>
...@@ -55,9 +54,6 @@ ...@@ -55,9 +54,6 @@
#include <xmloff/xmlnumi.hxx> #include <xmloff/xmlnumi.hxx>
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::style; using namespace ::com::sun::star::style;
...@@ -69,9 +65,6 @@ using namespace ::com::sun::star::frame; ...@@ -69,9 +65,6 @@ using namespace ::com::sun::star::frame;
using namespace ::xmloff::token; using namespace ::xmloff::token;
using namespace ::com::sun::star::io; using namespace ::com::sun::star::io;
using rtl::OUString;
using rtl::OUStringBuffer;
static sal_Char const XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] = static sal_Char const XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] =
"SymbolTextDistance"; "SymbolTextDistance";
static sal_Char const XML_UNO_NAME_NRULE_PARENT_NUMBERING[] = static sal_Char const XML_UNO_NAME_NRULE_PARENT_NUMBERING[] =
...@@ -491,7 +484,7 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties( ...@@ -491,7 +484,7 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties(
|| ((300 == nUPD) && (nBuildId <= 9573)))) || ((300 == nUPD) && (nBuildId <= 9573))))
{ {
// #i93908# OOo < 3.4 wrote a bogus suffix for bullet chars // #i93908# OOo < 3.4 wrote a bogus suffix for bullet chars
sSuffix = ::rtl::OUString(); // clear it sSuffix = OUString(); // clear it
} }
} }
......
...@@ -56,8 +56,6 @@ ...@@ -56,8 +56,6 @@
#include <set> #include <set>
#include <vector> #include <vector>
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using ::std::vector; using ::std::vector;
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -101,7 +99,7 @@ const SvXMLTokenMap& SvXMLStylesContext::GetStyleStylesElemTokenMap() ...@@ -101,7 +99,7 @@ const SvXMLTokenMap& SvXMLStylesContext::GetStyleStylesElemTokenMap()
void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey, void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
const OUString& rLocalName, const OUString& rLocalName,
const OUString& rValue ) const OUString& rValue )
{ {
// TODO: use a map here // TODO: use a map here
if( XML_NAMESPACE_STYLE == nPrefixKey ) if( XML_NAMESPACE_STYLE == nPrefixKey )
...@@ -164,8 +162,8 @@ SvXMLStyleContext::~SvXMLStyleContext() ...@@ -164,8 +162,8 @@ SvXMLStyleContext::~SvXMLStyleContext()
} }
SvXMLImportContext *SvXMLStyleContext::CreateChildContext( sal_uInt16 nPrefix, SvXMLImportContext *SvXMLStyleContext::CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName, const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList > & ) const uno::Reference< xml::sax::XAttributeList > & )
{ {
return new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
} }
...@@ -290,7 +288,8 @@ public: ...@@ -290,7 +288,8 @@ public:
void Clear(); void Clear();
const SvXMLStyleContext *FindStyleChildContext( sal_uInt16 nFamily, const SvXMLStyleContext *FindStyleChildContext( sal_uInt16 nFamily,
const OUString& rName, sal_Bool bCreateIndex ) const; const OUString& rName,
sal_Bool bCreateIndex ) const;
sal_Bool IsAutomaticStyle() const { return bAutomaticStyle; } sal_Bool IsAutomaticStyle() const { return bAutomaticStyle; }
}; };
...@@ -334,10 +333,9 @@ void SvXMLStylesContext_Impl::Clear() ...@@ -334,10 +333,9 @@ void SvXMLStylesContext_Impl::Clear()
aStyles.clear(); aStyles.clear();
} }
const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( sal_uInt16 nFamily,
sal_uInt16 nFamily, const OUString& rName,
const OUString& rName, sal_Bool bCreateIndex ) const
sal_Bool bCreateIndex ) const
{ {
const SvXMLStyleContext *pStyle = 0; const SvXMLStyleContext *pStyle = 0;
...@@ -399,10 +397,9 @@ sal_Bool SvXMLStylesContext::IsAutomaticStyle() const ...@@ -399,10 +397,9 @@ sal_Bool SvXMLStylesContext::IsAutomaticStyle() const
return mpImpl->IsAutomaticStyle(); return mpImpl->IsAutomaticStyle();
} }
SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext( SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext( sal_uInt16 p_nPrefix,
sal_uInt16 p_nPrefix, const OUString& rLocalName,
const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > & xAttrList )
const uno::Reference< xml::sax::XAttributeList > & xAttrList )
{ {
SvXMLStyleContext *pStyle = NULL; SvXMLStyleContext *pStyle = NULL;
...@@ -566,8 +563,7 @@ sal_Bool SvXMLStylesContext::InsertStyleFamily( sal_uInt16 ) const ...@@ -566,8 +563,7 @@ sal_Bool SvXMLStylesContext::InsertStyleFamily( sal_uInt16 ) const
return sal_True; return sal_True;
} }
sal_uInt16 SvXMLStylesContext::GetFamily( sal_uInt16 SvXMLStylesContext::GetFamily( const OUString& rValue ) const
const ::rtl::OUString& rValue ) const
{ {
sal_uInt16 nFamily = 0U; sal_uInt16 nFamily = 0U;
if( IsXMLToken( rValue, XML_PARAGRAPH ) ) if( IsXMLToken( rValue, XML_PARAGRAPH ) )
...@@ -716,9 +712,7 @@ Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( sal_uInt16 nFa ...@@ -716,9 +712,7 @@ Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( sal_uInt16 nFa
xAutoStyles = mxParaAutoStyles; xAutoStyles = mxParaAutoStyles;
else else
{ {
sName = bPara ? sName = bPara ? OUString( "ParagraphStyles" ): OUString( "CharacterStyles" );
OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) ):
OUString( RTL_CONSTASCII_USTRINGPARAM( "CharacterStyles" ) );
Reference< XAutoStylesSupplier > xAutoStylesSupp( GetImport().GetModel(), UNO_QUERY ); Reference< XAutoStylesSupplier > xAutoStylesSupp( GetImport().GetModel(), UNO_QUERY );
Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles(); Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
if (xAutoStyleFamilies->hasByName(sName)) if (xAutoStyleFamilies->hasByName(sName))
...@@ -746,16 +740,14 @@ Reference < XNameContainer > SvXMLStylesContext::GetStylesContainer( ...@@ -746,16 +740,14 @@ Reference < XNameContainer > SvXMLStylesContext::GetStylesContainer(
if( mxParaStyles.is() ) if( mxParaStyles.is() )
xStyles = mxParaStyles; xStyles = mxParaStyles;
else else
sName = sName = "ParagraphStyles";
OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) );
break; break;
case XML_STYLE_FAMILY_TEXT_TEXT: case XML_STYLE_FAMILY_TEXT_TEXT:
if( mxTextStyles.is() ) if( mxTextStyles.is() )
xStyles = mxTextStyles; xStyles = mxTextStyles;
else else
sName = sName = "CharacterStyles";
OUString( RTL_CONSTASCII_USTRINGPARAM( "CharacterStyles" ) );
break; break;
} }
if( !xStyles.is() && !sName.isEmpty() ) if( !xStyles.is() && !sName.isEmpty() )
...@@ -788,7 +780,7 @@ Reference < XNameContainer > SvXMLStylesContext::GetStylesContainer( ...@@ -788,7 +780,7 @@ Reference < XNameContainer > SvXMLStylesContext::GetStylesContainer(
OUString SvXMLStylesContext::GetServiceName( sal_uInt16 nFamily ) const OUString SvXMLStylesContext::GetServiceName( sal_uInt16 nFamily ) const
{ {
String sServiceName; OUString sServiceName;
switch( nFamily ) switch( nFamily )
{ {
case XML_STYLE_FAMILY_TEXT_PARAGRAPH: case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
...@@ -822,8 +814,8 @@ SvXMLStylesContext::~SvXMLStylesContext() ...@@ -822,8 +814,8 @@ SvXMLStylesContext::~SvXMLStylesContext()
} }
SvXMLImportContext *SvXMLStylesContext::CreateChildContext( sal_uInt16 nPrefix, SvXMLImportContext *SvXMLStylesContext::CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName, const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList > & xAttrList ) const uno::Reference< xml::sax::XAttributeList > & xAttrList )
{ {
SvXMLImportContext *pContext = 0; SvXMLImportContext *pContext = 0;
......
This diff is collapsed.
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