use more OUString literal

convert some functions which merely create an OUString on the fly
from a char literal to 'constexpr OUString' literals

Change-Id: I617490baf2d976291b324cc991b59cd18f4b242c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166392
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2024-04-21 21:39:13 +02:00
committed by Noel Grandin
parent 4b6e0f2c88
commit 6adef53aa9
7 changed files with 77 additions and 183 deletions

View File

@@ -43,30 +43,11 @@ using namespace ::osl;
using namespace connectivity; using namespace connectivity;
static OUString getConnectionPoolNodeName() constexpr OUString CONNECTIONPOOL_NODENAME = u"org.openoffice.Office.DataAccess/ConnectionPool"_ustr;
{ constexpr OUString ENABLE_POOLING = u"EnablePooling"_ustr;
return "org.openoffice.Office.DataAccess/ConnectionPool"; constexpr OUString DRIVER_NAME = u"DriverName"_ustr;
} constexpr OUString DRIVER_SETTINGS = u"DriverSettings"_ustr;
constexpr OUString ENABLE = u"Enable"_ustr;
static OUString getEnablePoolingNodeName()
{
return "EnablePooling";
}
static OUString getDriverNameNodeName()
{
return "DriverName";
}
static OUString getDriverSettingsNodeName()
{
return "DriverSettings";
}
static OUString getEnableNodeName()
{
return "Enable";
}
OPoolCollection::OPoolCollection(const Reference< XComponentContext >& _rxContext) OPoolCollection::OPoolCollection(const Reference< XComponentContext >& _rxContext)
@@ -78,7 +59,7 @@ OPoolCollection::OPoolCollection(const Reference< XComponentContext >& _rxContex
m_xProxyFactory = ProxyFactory::create( m_xContext ); m_xProxyFactory = ProxyFactory::create( m_xContext );
Reference<XPropertySet> xProp(getConfigPoolRoot(),UNO_QUERY); Reference<XPropertySet> xProp(getConfigPoolRoot(),UNO_QUERY);
if ( xProp.is() ) if ( xProp.is() )
xProp->addPropertyChangeListener(getEnablePoolingNodeName(),this); xProp->addPropertyChangeListener(ENABLE_POOLING,this);
// attach as desktop listener to know when we have to release our pools // attach as desktop listener to know when we have to release our pools
osl_atomic_increment( &m_refCount ); osl_atomic_increment( &m_refCount );
{ {
@@ -193,7 +174,7 @@ bool OPoolCollection::isDriverPoolingEnabled(std::u16string_view _sDriverImplNam
bool bEnabled = false; bool bEnabled = false;
Reference<XInterface> xConnectionPoolRoot = getConfigPoolRoot(); Reference<XInterface> xConnectionPoolRoot = getConfigPoolRoot();
// then look for which of them settings are stored in the configuration // then look for which of them settings are stored in the configuration
Reference< XNameAccess > xDirectAccess(openNode(getDriverSettingsNodeName(),xConnectionPoolRoot),UNO_QUERY); Reference< XNameAccess > xDirectAccess(openNode(DRIVER_SETTINGS,xConnectionPoolRoot),UNO_QUERY);
if(xDirectAccess.is()) if(xDirectAccess.is())
{ {
@@ -207,7 +188,7 @@ bool OPoolCollection::isDriverPoolingEnabled(std::u16string_view _sDriverImplNam
{ {
_rxDriverNode = openNode(*pDriverKeys,xDirectAccess); _rxDriverNode = openNode(*pDriverKeys,xDirectAccess);
if(_rxDriverNode.is()) if(_rxDriverNode.is())
getNodeValue(getEnableNodeName(),_rxDriverNode) >>= bEnabled; getNodeValue(ENABLE,_rxDriverNode) >>= bEnabled;
break; break;
} }
} }
@@ -223,7 +204,7 @@ bool OPoolCollection::isPoolingEnabled()
// the global "enabled" flag // the global "enabled" flag
bool bEnabled = false; bool bEnabled = false;
if(xConnectionPoolRoot.is()) if(xConnectionPoolRoot.is())
getNodeValue(getEnablePoolingNodeName(),xConnectionPoolRoot) >>= bEnabled; getNodeValue(ENABLE_POOLING,xConnectionPoolRoot) >>= bEnabled;
return bEnabled; return bEnabled;
} }
@@ -232,7 +213,7 @@ Reference<XInterface> const & OPoolCollection::getConfigPoolRoot()
if(!m_xConfigNode.is()) if(!m_xConfigNode.is())
m_xConfigNode = createWithProvider( m_xConfigNode = createWithProvider(
css::configuration::theDefaultProvider::get(m_xContext), css::configuration::theDefaultProvider::get(m_xContext),
getConnectionPoolNodeName()); CONNECTIONPOOL_NODENAME);
return m_xConfigNode; return m_xConfigNode;
} }
@@ -279,7 +260,7 @@ OConnectionPool* OPoolCollection::getConnectionPool(const OUString& _sImplName,
{ {
Reference<XPropertySet> xProp(_xDriverNode,UNO_QUERY); Reference<XPropertySet> xProp(_xDriverNode,UNO_QUERY);
if(xProp.is()) if(xProp.is())
xProp->addPropertyChangeListener(getEnableNodeName(),this); xProp->addPropertyChangeListener(ENABLE,this);
rtl::Reference<OConnectionPool> pConnectionPool = new OConnectionPool(_xDriver,_xDriverNode,m_xProxyFactory); rtl::Reference<OConnectionPool> pConnectionPool = new OConnectionPool(_xDriver,_xDriverNode,m_xProxyFactory);
m_aPools.emplace(_sImplName,pConnectionPool); m_aPools.emplace(_sImplName,pConnectionPool);
pRet = pConnectionPool.get(); pRet = pConnectionPool.get();
@@ -390,11 +371,11 @@ void SAL_CALL OPoolCollection::disposing( const EventObject& Source )
if(Source.Source == m_xConfigNode) if(Source.Source == m_xConfigNode)
{ {
if ( xProp.is() ) if ( xProp.is() )
xProp->removePropertyChangeListener(getEnablePoolingNodeName(),this); xProp->removePropertyChangeListener(ENABLE_POOLING,this);
m_xConfigNode.clear(); m_xConfigNode.clear();
} }
else if ( xProp.is() ) else if ( xProp.is() )
xProp->removePropertyChangeListener(getEnableNodeName(),this); xProp->removePropertyChangeListener(ENABLE,this);
} }
catch(const Exception&) catch(const Exception&)
{ {
@@ -428,7 +409,7 @@ void SAL_CALL OPoolCollection::propertyChange( const css::beans::PropertyChangeE
if(!bEnabled) if(!bEnabled)
{ {
OUString sThisDriverName; OUString sThisDriverName;
getNodeValue(getDriverNameNodeName(),evt.Source) >>= sThisDriverName; getNodeValue(DRIVER_NAME,evt.Source) >>= sThisDriverName;
// 1st release the driver // 1st release the driver
// look if we already have a proxy for this driver // look if we already have a proxy for this driver
MapDriver2DriverRef::iterator aLookup = m_aDriverProxies.begin(); MapDriver2DriverRef::iterator aLookup = m_aDriverProxies.begin();

View File

@@ -36,50 +36,21 @@ namespace offapp
using namespace ::utl; using namespace ::utl;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
constexpr OUString CONNECTIONPOOL_NODENAME = u"org.openoffice.Office.DataAccess/ConnectionPool"_ustr;
static OUString getConnectionPoolNodeName() constexpr OUString ENABLE_POOLING = u"EnablePooling"_ustr;
{ constexpr OUString DRIVER_SETTINGS = u"DriverSettings"_ustr;
return "org.openoffice.Office.DataAccess/ConnectionPool"; constexpr OUString DRIVER_NAME = u"DriverName"_ustr;
} constexpr OUString ENABLE = u"Enable"_ustr;
constexpr OUString TIMEOUT = u"Timeout"_ustr;
static OUString getEnablePoolingNodeName()
{
return "EnablePooling";
}
static OUString getDriverSettingsNodeName()
{
return "DriverSettings";
}
static OUString getDriverNameNodeName()
{
return "DriverName";
}
static OUString getEnableNodeName()
{
return "Enable";
}
static OUString getTimeoutNodeName()
{
return "Timeout";
}
void ConnectionPoolConfig::GetOptions(SfxItemSet& _rFillItems) void ConnectionPoolConfig::GetOptions(SfxItemSet& _rFillItems)
{ {
// the config node where all pooling relevant info are stored under // the config node where all pooling relevant info are stored under
OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithComponentContext( OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithComponentContext(
::comphelper::getProcessComponentContext(), getConnectionPoolNodeName(), -1, OConfigurationTreeRoot::CM_READONLY); ::comphelper::getProcessComponentContext(), CONNECTIONPOOL_NODENAME, -1, OConfigurationTreeRoot::CM_READONLY);
// the global "enabled" flag // the global "enabled" flag
Any aEnabled = aConnectionPoolRoot.getNodeValue(getEnablePoolingNodeName()); Any aEnabled = aConnectionPoolRoot.getNodeValue(ENABLE_POOLING);
bool bEnabled = true; bool bEnabled = true;
aEnabled >>= bEnabled; aEnabled >>= bEnabled;
_rFillItems.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, bEnabled)); _rFillItems.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, bEnabled));
@@ -94,7 +65,7 @@ namespace offapp
} }
// then look for which of them settings are stored in the configuration // then look for which of them settings are stored in the configuration
OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(getDriverSettingsNodeName()); OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(DRIVER_SETTINGS);
Sequence< OUString > aDriverKeys = aDriverSettings.getNodeNames(); Sequence< OUString > aDriverKeys = aDriverSettings.getNodeNames();
const OUString* pDriverKeys = aDriverKeys.getConstArray(); const OUString* pDriverKeys = aDriverKeys.getConstArray();
@@ -104,7 +75,7 @@ namespace offapp
// the name of the driver in this round // the name of the driver in this round
OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(*pDriverKeys); OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(*pDriverKeys);
OUString sThisDriverName; OUString sThisDriverName;
aThisDriverSettings.getNodeValue(getDriverNameNodeName()) >>= sThisDriverName; aThisDriverSettings.getNodeValue(DRIVER_NAME) >>= sThisDriverName;
// look if we (resp. the driver manager) know this driver // look if we (resp. the driver manager) know this driver
// doing O(n) search here, which is expensive, but this doesn't matter in this small case ... // doing O(n) search here, which is expensive, but this doesn't matter in this small case ...
@@ -126,8 +97,8 @@ namespace offapp
} }
// now fill this entry with the settings from the configuration // now fill this entry with the settings from the configuration
aThisDriverSettings.getNodeValue(getEnableNodeName()) >>= aLookup->bEnabled; aThisDriverSettings.getNodeValue(ENABLE) >>= aLookup->bEnabled;
aThisDriverSettings.getNodeValue(getTimeoutNodeName()) >>= aLookup->nTimeoutSeconds; aThisDriverSettings.getNodeValue(TIMEOUT) >>= aLookup->nTimeoutSeconds;
} }
_rFillItems.Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, aSettings)); _rFillItems.Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, aSettings));
@@ -138,7 +109,7 @@ namespace offapp
{ {
// the config node where all pooling relevant info are stored under // the config node where all pooling relevant info are stored under
OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithComponentContext( OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithComponentContext(
::comphelper::getProcessComponentContext(), getConnectionPoolNodeName()); ::comphelper::getProcessComponentContext(), CONNECTIONPOOL_NODENAME);
if (!aConnectionPoolRoot.isValid()) if (!aConnectionPoolRoot.isValid())
// already asserted by the OConfigurationTreeRoot // already asserted by the OConfigurationTreeRoot
@@ -151,7 +122,7 @@ namespace offapp
if (pEnabled) if (pEnabled)
{ {
bool bEnabled = pEnabled->GetValue(); bool bEnabled = pEnabled->GetValue();
aConnectionPoolRoot.setNodeValue(getEnablePoolingNodeName(), Any(bEnabled)); aConnectionPoolRoot.setNodeValue(ENABLE_POOLING, Any(bEnabled));
bNeedCommit = true; bNeedCommit = true;
} }
@@ -159,7 +130,7 @@ namespace offapp
const DriverPoolingSettingsItem* pDriverSettings = _rSourceItems.GetItem<DriverPoolingSettingsItem>(SID_SB_DRIVER_TIMEOUTS); const DriverPoolingSettingsItem* pDriverSettings = _rSourceItems.GetItem<DriverPoolingSettingsItem>(SID_SB_DRIVER_TIMEOUTS);
if (pDriverSettings) if (pDriverSettings)
{ {
OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(getDriverSettingsNodeName()); OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(DRIVER_SETTINGS);
if (!aDriverSettings.isValid()) if (!aDriverSettings.isValid())
return; return;
@@ -179,9 +150,9 @@ namespace offapp
aThisDriverSettings = aDriverSettings.createNode(newSetting.sName); aThisDriverSettings = aDriverSettings.createNode(newSetting.sName);
// set the values // set the values
aThisDriverSettings.setNodeValue(getDriverNameNodeName(), Any(sThisDriverName)); aThisDriverSettings.setNodeValue(DRIVER_NAME, Any(sThisDriverName));
aThisDriverSettings.setNodeValue(getEnableNodeName(), Any(newSetting.bEnabled)); aThisDriverSettings.setNodeValue(ENABLE, Any(newSetting.bEnabled));
aThisDriverSettings.setNodeValue(getTimeoutNodeName(), Any(newSetting.nTimeoutSeconds)); aThisDriverSettings.setNodeValue(TIMEOUT, Any(newSetting.nTimeoutSeconds));
} }
bNeedCommit = true; bNeedCommit = true;
} }

View File

@@ -51,20 +51,9 @@ namespace dbaccess
using ::com::sun::star::sdb::DatabaseRegistrationEvent; using ::com::sun::star::sdb::DatabaseRegistrationEvent;
using ::com::sun::star::uno::XAggregation; using ::com::sun::star::uno::XAggregation;
static OUString getConfigurationRootPath() constexpr OUString CONF_ROOT_PATH = u"org.openoffice.Office.DataAccess/RegisteredNames"_ustr;
{ constexpr OUString LOCATION = u"Location"_ustr;
return "org.openoffice.Office.DataAccess/RegisteredNames"; constexpr OUString NAME = u"Name"_ustr;
}
static OUString getLocationNodeName()
{
return "Location";
}
static OUString getNameNodeName()
{
return "Name";
}
// DatabaseRegistrations - declaration // DatabaseRegistrations - declaration
typedef ::cppu::WeakImplHelper< XDatabaseRegistrations typedef ::cppu::WeakImplHelper< XDatabaseRegistrations
@@ -147,7 +136,7 @@ namespace dbaccess
,m_aRegistrationListeners( m_aMutex ) ,m_aRegistrationListeners( m_aMutex )
{ {
m_aConfigurationRoot = ::utl::OConfigurationTreeRoot::createWithComponentContext( m_aConfigurationRoot = ::utl::OConfigurationTreeRoot::createWithComponentContext(
m_aContext, getConfigurationRootPath() ); m_aContext, CONF_ROOT_PATH );
} }
DatabaseRegistrations::~DatabaseRegistrations() DatabaseRegistrations::~DatabaseRegistrations()
@@ -162,7 +151,7 @@ namespace dbaccess
::utl::OConfigurationNode aNodeForName = m_aConfigurationRoot.openNode( nodeName ); ::utl::OConfigurationNode aNodeForName = m_aConfigurationRoot.openNode( nodeName );
OUString sTestName; OUString sTestName;
OSL_VERIFY( aNodeForName.getNodeValue( getNameNodeName() ) >>= sTestName ); OSL_VERIFY( aNodeForName.getNodeValue( NAME ) >>= sTestName );
if ( sTestName == _rName ) if ( sTestName == _rName )
return aNodeForName; return aNodeForName;
} }
@@ -196,7 +185,7 @@ namespace dbaccess
} }
::utl::OConfigurationNode aNewNode( m_aConfigurationRoot.createNode( sNewNodeName ) ); ::utl::OConfigurationNode aNewNode( m_aConfigurationRoot.createNode( sNewNodeName ) );
aNewNode.setNodeValue( getNameNodeName(), Any( _rName ) ); aNewNode.setNodeValue( NAME, Any( _rName ) );
return aNewNode; return aNewNode;
} }
@@ -251,7 +240,7 @@ namespace dbaccess
for ( auto const & name : aProgrammaticNames ) for ( auto const & name : aProgrammaticNames )
{ {
::utl::OConfigurationNode aRegistrationNode = m_aConfigurationRoot.openNode( name ); ::utl::OConfigurationNode aRegistrationNode = m_aConfigurationRoot.openNode( name );
OSL_VERIFY( aRegistrationNode.getNodeValue( getNameNodeName() ) >>= *pDisplayName ); OSL_VERIFY( aRegistrationNode.getNodeValue( NAME ) >>= *pDisplayName );
++pDisplayName; ++pDisplayName;
} }
@@ -265,7 +254,7 @@ namespace dbaccess
::utl::OConfigurationNode aNodeForName = impl_checkValidName_throw_must_exist(Name); ::utl::OConfigurationNode aNodeForName = impl_checkValidName_throw_must_exist(Name);
OUString sLocation; OUString sLocation;
OSL_VERIFY( aNodeForName.getNodeValue( getLocationNodeName() ) >>= sLocation ); OSL_VERIFY( aNodeForName.getNodeValue( LOCATION ) >>= sLocation );
sLocation = SvtPathOptions().SubstituteVariable( sLocation ); sLocation = SvtPathOptions().SubstituteVariable( sLocation );
return sLocation; return sLocation;
@@ -280,7 +269,7 @@ namespace dbaccess
::utl::OConfigurationNode aDataSourceRegistration = impl_checkValidName_throw_must_not_exist(Name); ::utl::OConfigurationNode aDataSourceRegistration = impl_checkValidName_throw_must_not_exist(Name);
// register // register
aDataSourceRegistration.setNodeValue( getLocationNodeName(), Any( Location ) ); aDataSourceRegistration.setNodeValue( LOCATION, Any( Location ) );
m_aConfigurationRoot.commit(); m_aConfigurationRoot.commit();
// notify // notify
@@ -298,7 +287,7 @@ namespace dbaccess
// obtain properties for notification // obtain properties for notification
OUString sLocation; OUString sLocation;
OSL_VERIFY( aNodeForName.getNodeValue( getLocationNodeName() ) >>= sLocation ); OSL_VERIFY( aNodeForName.getNodeValue( LOCATION ) >>= sLocation );
// revoke // revoke
if ( aNodeForName.isReadonly() if ( aNodeForName.isReadonly()
@@ -327,10 +316,10 @@ namespace dbaccess
// obtain properties for notification // obtain properties for notification
OUString sOldLocation; OUString sOldLocation;
OSL_VERIFY( aDataSourceRegistration.getNodeValue( getLocationNodeName() ) >>= sOldLocation ); OSL_VERIFY( aDataSourceRegistration.getNodeValue( LOCATION ) >>= sOldLocation );
// change // change
aDataSourceRegistration.setNodeValue( getLocationNodeName(), Any( NewLocation ) ); aDataSourceRegistration.setNodeValue( LOCATION, Any( NewLocation ) );
m_aConfigurationRoot.commit(); m_aConfigurationRoot.commit();
// notify // notify

View File

@@ -70,50 +70,15 @@ namespace drawinglayer::geometry
uno::Sequence< beans::PropertyValue > mxExtendedInformation; uno::Sequence< beans::PropertyValue > mxExtendedInformation;
// the local UNO API strings // the local UNO API strings
static OUString getNamePropertyObjectTransformation() static constexpr OUString OBJECT_TRANSFORMATION = u"ObjectTransformation"_ustr;
{ static constexpr OUString ORIENTATION = u"Orientation"_ustr;
return "ObjectTransformation"; static constexpr OUString PROJECTION = u"Projection"_ustr;
} static constexpr OUString PROJECTION30 = u"Projection30"_ustr;
static constexpr OUString PROJECTION31 = u"Projection31"_ustr;
static OUString getNamePropertyOrientation() static constexpr OUString PROJECTION32 = u"Projection32"_ustr;
{ static constexpr OUString PROJECTION33 = u"Projection33"_ustr;
return "Orientation"; static constexpr OUString DEVICE_TO_VIEW = u"DeviceToView"_ustr;
} static constexpr OUString TIME = u"Time"_ustr;
static OUString getNamePropertyProjection()
{
return "Projection";
}
static OUString getNamePropertyProjection_30()
{
return "Projection30";
}
static OUString getNamePropertyProjection_31()
{
return "Projection31";
}
static OUString getNamePropertyProjection_32()
{
return "Projection32";
}
static OUString getNamePropertyProjection_33()
{
return "Projection33";
}
static OUString getNamePropertyDeviceToView()
{
return "DeviceToView";
}
static OUString getNamePropertyTime()
{
return "Time";
}
// a central PropertyValue parsing method to allow transportation of // a central PropertyValue parsing method to allow transportation of
// all ViewParameters using UNO API // all ViewParameters using UNO API
@@ -133,19 +98,19 @@ namespace drawinglayer::geometry
{ {
const beans::PropertyValue& rProp = rViewParameters[a]; const beans::PropertyValue& rProp = rViewParameters[a];
if(rProp.Name == getNamePropertyObjectTransformation()) if(rProp.Name == OBJECT_TRANSFORMATION)
{ {
css::geometry::AffineMatrix3D aAffineMatrix3D; css::geometry::AffineMatrix3D aAffineMatrix3D;
rProp.Value >>= aAffineMatrix3D; rProp.Value >>= aAffineMatrix3D;
maObjectTransformation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); maObjectTransformation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
} }
else if(rProp.Name == getNamePropertyOrientation()) else if(rProp.Name == ORIENTATION)
{ {
css::geometry::AffineMatrix3D aAffineMatrix3D; css::geometry::AffineMatrix3D aAffineMatrix3D;
rProp.Value >>= aAffineMatrix3D; rProp.Value >>= aAffineMatrix3D;
maOrientation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); maOrientation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
} }
else if(rProp.Name == getNamePropertyProjection()) else if(rProp.Name == PROJECTION)
{ {
// projection may be defined using a frustum in which case the last line of // projection may be defined using a frustum in which case the last line of
// the 4x4 matrix is not (0,0,0,1). Since AffineMatrix3D does not support that, // the 4x4 matrix is not (0,0,0,1). Since AffineMatrix3D does not support that,
@@ -164,37 +129,37 @@ namespace drawinglayer::geometry
maProjection.set(3, 2, f_32); maProjection.set(3, 2, f_32);
maProjection.set(3, 3, f_33); maProjection.set(3, 3, f_33);
} }
else if(rProp.Name == getNamePropertyProjection_30()) else if(rProp.Name == PROJECTION30)
{ {
double f_30(0.0); double f_30(0.0);
rProp.Value >>= f_30; rProp.Value >>= f_30;
maProjection.set(3, 0, f_30); maProjection.set(3, 0, f_30);
} }
else if(rProp.Name == getNamePropertyProjection_31()) else if(rProp.Name == PROJECTION31)
{ {
double f_31(0.0); double f_31(0.0);
rProp.Value >>= f_31; rProp.Value >>= f_31;
maProjection.set(3, 1, f_31); maProjection.set(3, 1, f_31);
} }
else if(rProp.Name == getNamePropertyProjection_32()) else if(rProp.Name == PROJECTION32)
{ {
double f_32(0.0); double f_32(0.0);
rProp.Value >>= f_32; rProp.Value >>= f_32;
maProjection.set(3, 2, f_32); maProjection.set(3, 2, f_32);
} }
else if(rProp.Name == getNamePropertyProjection_33()) else if(rProp.Name == PROJECTION33)
{ {
double f_33(1.0); double f_33(1.0);
rProp.Value >>= f_33; rProp.Value >>= f_33;
maProjection.set(3, 3, f_33); maProjection.set(3, 3, f_33);
} }
else if(rProp.Name == getNamePropertyDeviceToView()) else if(rProp.Name == DEVICE_TO_VIEW)
{ {
css::geometry::AffineMatrix3D aAffineMatrix3D; css::geometry::AffineMatrix3D aAffineMatrix3D;
rProp.Value >>= aAffineMatrix3D; rProp.Value >>= aAffineMatrix3D;
maDeviceToView = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); maDeviceToView = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
} }
else if(rProp.Name == getNamePropertyTime()) else if(rProp.Name == TIME)
{ {
rProp.Value >>= mfViewTime; rProp.Value >>= mfViewTime;
} }

View File

@@ -34,10 +34,7 @@ SaxAttrList::SaxAttrList( const std::unordered_map< OUString, OUString >& rMap )
} }
namespace { namespace {
OUString getCDATAString() constexpr OUString CDATA = u"CDATA"_ustr;
{
return "CDATA";
}
} }
sal_Int16 SAL_CALL SaxAttrList::getLength() sal_Int16 SAL_CALL SaxAttrList::getLength()
@@ -51,12 +48,12 @@ OUString SAL_CALL SaxAttrList::getNameByIndex( sal_Int16 i_nIndex )
OUString SAL_CALL SaxAttrList::getTypeByIndex( sal_Int16 i_nIndex) OUString SAL_CALL SaxAttrList::getTypeByIndex( sal_Int16 i_nIndex)
{ {
return (i_nIndex < sal_Int16(m_aAttributes.size())) ? getCDATAString() : OUString(); return (i_nIndex < sal_Int16(m_aAttributes.size())) ? CDATA : OUString();
} }
OUString SAL_CALL SaxAttrList::getTypeByName( const OUString& i_rName ) OUString SAL_CALL SaxAttrList::getTypeByName( const OUString& i_rName )
{ {
return (m_aIndexMap.find( i_rName ) != m_aIndexMap.end()) ? getCDATAString() : OUString(); return (m_aIndexMap.find( i_rName ) != m_aIndexMap.end()) ? CDATA : OUString();
} }
OUString SAL_CALL SaxAttrList::getValueByIndex( sal_Int16 i_nIndex ) OUString SAL_CALL SaxAttrList::getValueByIndex( sal_Int16 i_nIndex )

View File

@@ -402,10 +402,7 @@ namespace sfx2
const sal_Unicode s_cWildcardSeparator( ';' ); const sal_Unicode s_cWildcardSeparator( ';' );
static OUString getSeparatorString() constexpr OUString SEPARATOR = u";"_ustr;
{
return ";";
}
namespace { namespace {
@@ -438,7 +435,7 @@ namespace sfx2
} }
if ( !_rToBeExtended.isEmpty() ) if ( !_rToBeExtended.isEmpty() )
_rToBeExtended += getSeparatorString(); _rToBeExtended += SEPARATOR;
_rToBeExtended += _rWC; _rToBeExtended += _rWC;
} }
}; };

View File

@@ -39,15 +39,9 @@ namespace xmloff
namespace namespace
{ {
OUString getParaAlignProperty() constexpr OUString PARA_ADJUST = u"ParaAdjust"_ustr;
{
return "ParaAdjust";
}
OUString getAlignProperty() constexpr OUString ALIGN = u"Align"_ustr;
{
return "Align";
}
sal_Int32 findStringElement( const Sequence< OUString >& _rNames, const OUString& _rName ) sal_Int32 findStringElement( const Sequence< OUString >& _rNames, const OUString& _rName )
{ {
@@ -149,15 +143,15 @@ namespace xmloff
sal_Int32 nOldLength = aProperties.getLength(); sal_Int32 nOldLength = aProperties.getLength();
aProperties.realloc( nOldLength + 1 ); aProperties.realloc( nOldLength + 1 );
aProperties.getArray()[ nOldLength ] = getPropertyByName( getParaAlignProperty() ); aProperties.getArray()[ nOldLength ] = getPropertyByName( PARA_ADJUST );
return aProperties; return aProperties;
} }
Property SAL_CALL OMergedPropertySetInfo::getPropertyByName( const OUString& aName ) Property SAL_CALL OMergedPropertySetInfo::getPropertyByName( const OUString& aName )
{ {
if ( aName == getParaAlignProperty() ) if ( aName == PARA_ADJUST )
return Property( getParaAlignProperty(), -1, return Property( PARA_ADJUST, -1,
::cppu::UnoType<ParagraphAdjust>::get(), 0 ); ::cppu::UnoType<ParagraphAdjust>::get(), 0 );
if ( !m_xMasterInfo.is() ) if ( !m_xMasterInfo.is() )
@@ -168,7 +162,7 @@ namespace xmloff
sal_Bool SAL_CALL OMergedPropertySetInfo::hasPropertyByName( const OUString& Name ) sal_Bool SAL_CALL OMergedPropertySetInfo::hasPropertyByName( const OUString& Name )
{ {
if ( Name == getParaAlignProperty() ) if ( Name == PARA_ADJUST )
return true; return true;
if ( !m_xMasterInfo.is() ) if ( !m_xMasterInfo.is() )
@@ -251,13 +245,13 @@ namespace xmloff
Sequence< OUString > aTranslatedNames( aPropertyNames ); Sequence< OUString > aTranslatedNames( aPropertyNames );
Sequence< Any > aTranslatedValues( aValues ); Sequence< Any > aTranslatedValues( aValues );
sal_Int32 nParaAlignPos = findStringElement( aTranslatedNames, getParaAlignProperty() ); sal_Int32 nParaAlignPos = findStringElement( aTranslatedNames, PARA_ADJUST );
if ( nParaAlignPos != -1 ) if ( nParaAlignPos != -1 )
{ {
if (aTranslatedNames.getLength() != aTranslatedValues.getLength()) if (aTranslatedNames.getLength() != aTranslatedValues.getLength())
throw css::lang::IllegalArgumentException( throw css::lang::IllegalArgumentException(
"lengths do not match", getXWeak(), -1); "lengths do not match", getXWeak(), -1);
aTranslatedNames.getArray()[ nParaAlignPos ] = getAlignProperty(); aTranslatedNames.getArray()[ nParaAlignPos ] = ALIGN;
valueParaAdjustToAlign( aTranslatedValues.getArray()[ nParaAlignPos ] ); valueParaAdjustToAlign( aTranslatedValues.getArray()[ nParaAlignPos ] );
} }
@@ -271,9 +265,9 @@ namespace xmloff
return aValues; return aValues;
Sequence< OUString > aTranslatedNames( aPropertyNames ); Sequence< OUString > aTranslatedNames( aPropertyNames );
sal_Int32 nAlignPos = findStringElement( aTranslatedNames, getParaAlignProperty() ); sal_Int32 nAlignPos = findStringElement( aTranslatedNames, PARA_ADJUST );
if ( nAlignPos != -1 ) if ( nAlignPos != -1 )
aTranslatedNames.getArray()[ nAlignPos ] = getAlignProperty(); aTranslatedNames.getArray()[ nAlignPos ] = ALIGN;
aValues = m_xGridColumn->getPropertyValues( aPropertyNames ); aValues = m_xGridColumn->getPropertyValues( aPropertyNames );
if ( nAlignPos != -1 ) if ( nAlignPos != -1 )