summaryrefslogtreecommitdiff
path: root/comphelper/source
diff options
context:
space:
mode:
Diffstat (limited to 'comphelper/source')
-rw-r--r--comphelper/source/misc/backupfilehelper.cxx12
-rw-r--r--comphelper/source/officeinstdir/officeinstallationdirectories.cxx19
-rw-r--r--comphelper/source/officeinstdir/officeinstallationdirectories.hxx2
-rw-r--r--comphelper/source/xml/ofopxmlhelper.cxx78
4 files changed, 49 insertions, 62 deletions
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx
index d47c9904c696..7e5a76983e43 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -545,16 +545,16 @@ namespace
typedef std::vector< ExtensionInfoEntry > ExtensionInfoEntryVector;
+ static const OUStringLiteral gaRegPath { "/registry/com.sun.star.comp.deployment.bundle.PackageRegistryBackend/backenddb.xml" };
+
class ExtensionInfo
{
private:
ExtensionInfoEntryVector maEntries;
- OUString const maRegPath;
public:
ExtensionInfo()
- : maEntries(),
- maRegPath("/registry/com.sun.star.comp.deployment.bundle.PackageRegistryBackend/backenddb.xml")
+ : maEntries()
{
}
@@ -677,19 +677,19 @@ namespace
public:
void createUserExtensionRegistryEntriesFromXML(const OUString& rUserConfigWorkURL)
{
- const OUString aPath(rUserConfigWorkURL + "/uno_packages/cache" + maRegPath);
+ const OUString aPath(rUserConfigWorkURL + "/uno_packages/cache" + gaRegPath);
createExtensionRegistryEntriesFromXML(aPath);
}
void createSharedExtensionRegistryEntriesFromXML(const OUString& rUserConfigWorkURL)
{
- const OUString aPath(rUserConfigWorkURL + "/extensions/shared" + maRegPath);
+ const OUString aPath(rUserConfigWorkURL + "/extensions/shared" + gaRegPath);
createExtensionRegistryEntriesFromXML(aPath);
}
void createBundledExtensionRegistryEntriesFromXML(const OUString& rUserConfigWorkURL)
{
- const OUString aPath(rUserConfigWorkURL + "/extensions/bundled" + maRegPath);
+ const OUString aPath(rUserConfigWorkURL + "/extensions/bundled" + gaRegPath);
createExtensionRegistryEntriesFromXML(aPath);
}
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
index a1850d4b6fc8..1323f79a22de 100644
--- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
+++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
@@ -75,11 +75,12 @@ static bool makeCanonicalFileURL( OUString & rURL )
namespace comphelper {
+static OUString const g_aOfficeBrandDirMacro("$(brandbaseurl)");
+static OUString const g_aUserDirMacro("$(userdataurl)");
+
OfficeInstallationDirectories::OfficeInstallationDirectories(
const uno::Reference< uno::XComponentContext > & xCtx )
-: m_aOfficeBrandDirMacro( "$(brandbaseurl)" ),
- m_aUserDirMacro( "$(userdataurl)" ),
- m_xCtx( xCtx ),
+: m_xCtx( xCtx ),
m_pOfficeBrandDir( nullptr ),
m_pUserDir( nullptr )
{
@@ -131,7 +132,7 @@ OfficeInstallationDirectories::makeRelocatableURL( const OUString& URL )
return
aCanonicalURL.replaceAt( nIndex,
m_pOfficeBrandDir->getLength(),
- m_aOfficeBrandDirMacro );
+ g_aOfficeBrandDirMacro );
}
else
{
@@ -141,7 +142,7 @@ OfficeInstallationDirectories::makeRelocatableURL( const OUString& URL )
return
aCanonicalURL.replaceAt( nIndex,
m_pUserDir->getLength(),
- m_aUserDirMacro );
+ g_aUserDirMacro );
}
}
}
@@ -155,26 +156,26 @@ OfficeInstallationDirectories::makeAbsoluteURL( const OUString& URL )
{
if ( !URL.isEmpty() )
{
- sal_Int32 nIndex = URL.indexOf( m_aOfficeBrandDirMacro );
+ sal_Int32 nIndex = URL.indexOf( g_aOfficeBrandDirMacro );
if ( nIndex != -1 )
{
initDirs();
return
URL.replaceAt( nIndex,
- m_aOfficeBrandDirMacro.getLength(),
+ g_aOfficeBrandDirMacro.getLength(),
*m_pOfficeBrandDir );
}
else
{
- nIndex = URL.indexOf( m_aUserDirMacro );
+ nIndex = URL.indexOf( g_aUserDirMacro );
if ( nIndex != -1 )
{
initDirs();
return
URL.replaceAt( nIndex,
- m_aUserDirMacro.getLength(),
+ g_aUserDirMacro.getLength(),
*m_pUserDir );
}
}
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
index e2b04a7687fb..bfcde8d72876 100644
--- a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
+++ b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
@@ -69,8 +69,6 @@ public:
private:
void initDirs();
- OUString const m_aOfficeBrandDirMacro;
- OUString const m_aUserDirMacro;
css::uno::Reference< css::uno::XComponentContext > m_xCtx;
std::unique_ptr<OUString> m_pOfficeBrandDir;
std::unique_ptr<OUString> m_pUserDir;
diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx
index 62cd50aba2ca..4a2bf122b39e 100644
--- a/comphelper/source/xml/ofopxmlhelper.cxx
+++ b/comphelper/source/xml/ofopxmlhelper.cxx
@@ -47,22 +47,6 @@ class OFOPXMLHelper_Impl
{
sal_uInt16 const m_nFormat; // which format to parse
- // Relations info related strings
- OUString const m_aRelListElement;
- OUString const m_aRelElement;
- OUString const m_aIDAttr;
- OUString const m_aTypeAttr;
- OUString const m_aTargetModeAttr;
- OUString const m_aTargetAttr;
-
- // ContentType related strings
- OUString const m_aTypesElement;
- OUString const m_aDefaultElement;
- OUString const m_aOverrideElement;
- OUString const m_aExtensionAttr;
- OUString const m_aPartNameAttr;
- OUString const m_aContentTypeAttr;
-
css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > m_aResultSeq;
std::vector< OUString > m_aElementsSeq; // stack of elements being parsed
@@ -284,20 +268,24 @@ uno::Sequence< uno::Sequence< beans::StringPair > > ReadSequence_Impl(
} // namespace OFOPXMLHelper
+// Relations info related strings
+static OUString const g_aRelListElement("Relationships");
+static OUString const g_aRelElement( "Relationship" );
+static OUString const g_aIDAttr( "Id" );
+static OUString const g_aTypeAttr( "Type" );
+static OUString const g_aTargetModeAttr( "TargetMode" );
+static OUString const g_aTargetAttr( "Target" );
+
+// ContentType related strings
+static OUString const g_aTypesElement( "Types" );
+static OUString const g_aDefaultElement( "Default" );
+static OUString const g_aOverrideElement( "Override" );
+static OUString const g_aExtensionAttr( "Extension" );
+static OUString const g_aPartNameAttr( "PartName" );
+static OUString const g_aContentTypeAttr( "ContentType" );
+
OFOPXMLHelper_Impl::OFOPXMLHelper_Impl( sal_uInt16 nFormat )
: m_nFormat( nFormat )
-, m_aRelListElement( "Relationships" )
-, m_aRelElement( "Relationship" )
-, m_aIDAttr( "Id" )
-, m_aTypeAttr( "Type" )
-, m_aTargetModeAttr( "TargetMode" )
-, m_aTargetAttr( "Target" )
-, m_aTypesElement( "Types" )
-, m_aDefaultElement( "Default" )
-, m_aOverrideElement( "Override" )
-, m_aExtensionAttr( "Extension" )
-, m_aPartNameAttr( "PartName" )
-, m_aContentTypeAttr( "ContentType" )
{
}
@@ -324,7 +312,7 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
{
if ( m_nFormat == RELATIONINFO_FORMAT )
{
- if ( aName == m_aRelListElement )
+ if ( aName == g_aRelListElement )
{
sal_Int32 nNewLength = m_aElementsSeq.size() + 1;
@@ -335,7 +323,7 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
return; // nothing to do
}
- else if ( aName == m_aRelElement )
+ else if ( aName == g_aRelElement )
{
sal_Int32 nNewLength = m_aElementsSeq.size() + 1;
if ( nNewLength != 2 )
@@ -348,32 +336,32 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
sal_Int32 nAttrNum = 0;
m_aResultSeq[nNewEntryNum-1].realloc( 4 ); // the maximal expected number of arguments is 4
- OUString aIDValue = xAttribs->getValueByName( m_aIDAttr );
+ OUString aIDValue = xAttribs->getValueByName( g_aIDAttr );
if ( aIDValue.isEmpty() )
throw css::xml::sax::SAXException(); // TODO: the ID value must present
- OUString aTypeValue = xAttribs->getValueByName( m_aTypeAttr );
- OUString aTargetValue = xAttribs->getValueByName( m_aTargetAttr );
- OUString aTargetModeValue = xAttribs->getValueByName( m_aTargetModeAttr );
+ OUString aTypeValue = xAttribs->getValueByName( g_aTypeAttr );
+ OUString aTargetValue = xAttribs->getValueByName( g_aTargetAttr );
+ OUString aTargetModeValue = xAttribs->getValueByName( g_aTargetModeAttr );
- m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aIDAttr;
+ m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = g_aIDAttr;
m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aIDValue;
if ( !aTypeValue.isEmpty() )
{
- m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTypeAttr;
+ m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = g_aTypeAttr;
m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTypeValue;
}
if ( !aTargetValue.isEmpty() )
{
- m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTargetAttr;
+ m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = g_aTargetAttr;
m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTargetValue;
}
if ( !aTargetModeValue.isEmpty() )
{
- m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = m_aTargetModeAttr;
+ m_aResultSeq[nNewEntryNum-1][++nAttrNum - 1].First = g_aTargetModeAttr;
m_aResultSeq[nNewEntryNum-1][nAttrNum - 1].Second = aTargetModeValue;
}
@@ -384,7 +372,7 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
}
else if ( m_nFormat == CONTENTTYPE_FORMAT )
{
- if ( aName == m_aTypesElement )
+ if ( aName == g_aTypesElement )
{
sal_Int32 nNewLength = m_aElementsSeq.size() + 1;
@@ -398,7 +386,7 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
return; // nothing to do
}
- else if ( aName == m_aDefaultElement )
+ else if ( aName == g_aDefaultElement )
{
sal_Int32 nNewLength = m_aElementsSeq.size() + 1;
if ( nNewLength != 2 )
@@ -412,11 +400,11 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
if ( m_aResultSeq.getLength() != 2 )
throw uno::RuntimeException();
- const OUString aExtensionValue = xAttribs->getValueByName( m_aExtensionAttr );
+ const OUString aExtensionValue = xAttribs->getValueByName( g_aExtensionAttr );
if ( aExtensionValue.isEmpty() )
throw css::xml::sax::SAXException(); // TODO: the Extension value must present
- const OUString aContentTypeValue = xAttribs->getValueByName( m_aContentTypeAttr );
+ const OUString aContentTypeValue = xAttribs->getValueByName( g_aContentTypeAttr );
if ( aContentTypeValue.isEmpty() )
throw css::xml::sax::SAXException(); // TODO: the ContentType value must present
@@ -426,7 +414,7 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
m_aResultSeq[0][nNewResultLen-1].First = aExtensionValue;
m_aResultSeq[0][nNewResultLen-1].Second = aContentTypeValue;
}
- else if ( aName == m_aOverrideElement )
+ else if ( aName == g_aOverrideElement )
{
sal_Int32 nNewLength = m_aElementsSeq.size() + 1;
if ( nNewLength != 2 )
@@ -440,11 +428,11 @@ void SAL_CALL OFOPXMLHelper_Impl::startElement( const OUString& aName, const uno
if ( m_aResultSeq.getLength() != 2 )
throw uno::RuntimeException();
- OUString aPartNameValue = xAttribs->getValueByName( m_aPartNameAttr );
+ OUString aPartNameValue = xAttribs->getValueByName( g_aPartNameAttr );
if ( aPartNameValue.isEmpty() )
throw css::xml::sax::SAXException(); // TODO: the PartName value must present
- OUString aContentTypeValue = xAttribs->getValueByName( m_aContentTypeAttr );
+ OUString aContentTypeValue = xAttribs->getValueByName( g_aContentTypeAttr );
if ( aContentTypeValue.isEmpty() )
throw css::xml::sax::SAXException(); // TODO: the ContentType value must present