summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-11-22 08:56:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-22 11:06:58 +0100
commit94ef4c13138c5d3b410c7ef5f285cc63c585e784 (patch)
tree1f06774dd547bbbf7ebd9521203b32840a1e5247 /svx
parent7b34fb18a4d60bfc4e32b7c382ac596cbc2e776f (diff)
improve function-local statics in svx
Change-Id: I636fcc8ba1012d774d98f6a880bf29eb4b233128 Reviewed-on: https://gerrit.libreoffice.org/63783 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/charmap.cxx12
-rw-r--r--svx/source/dialog/svxbmpnumvalueset.cxx19
-rw-r--r--svx/source/fmcomp/fmgridif.cxx25
-rw-r--r--svx/source/fmcomp/gridcols.cxx9
-rw-r--r--svx/source/form/dataaccessdescriptor.cxx27
-rw-r--r--svx/source/form/filtnav.cxx9
-rw-r--r--svx/source/form/fmexch.cxx27
-rw-r--r--svx/source/form/formcontroller.cxx20
-rw-r--r--svx/source/sidebar/nbdtmg.cxx19
-rw-r--r--svx/source/table/tabledesign.cxx27
-rw-r--r--svx/source/unodraw/unoprov.cxx76
-rw-r--r--svx/source/unodraw/unoshape.cxx267
12 files changed, 235 insertions, 302 deletions
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index eea119f0927e..ed525834a709 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -877,12 +877,9 @@ inline Subset::Subset(sal_UCS4 nMin, sal_UCS4 nMax, const OUString& rName)
void SubsetMap::InitList()
{
- static SubsetVec aAllSubsets;
- static bool bInit = true;
- if( bInit )
+ static SubsetVec s_aAllSubsets = [&]()
{
- bInit = false;
-
+ SubsetVec aAllSubsets;
//I wish icu had a way to give me the block ranges
for (int i = UBLOCK_BASIC_LATIN; i < UBLOCK_COUNT; ++i)
{
@@ -1797,9 +1794,10 @@ void SubsetMap::InitList()
}
std::stable_sort(aAllSubsets.begin(), aAllSubsets.end());
- }
+ return aAllSubsets;
+ }();
- maSubsets = aAllSubsets;
+ maSubsets = s_aAllSubsets;
}
void SubsetMap::ApplyCharMap( const FontCharMapRef& rxFontCharMap )
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx
index 11e494b6f6bc..5b6df74f9c68 100644
--- a/svx/source/dialog/svxbmpnumvalueset.cxx
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -78,17 +78,16 @@ static const sal_Unicode aBulletTypes[] =
static vcl::Font& lcl_GetDefaultBulletFont()
{
- static bool bInit = false;
- static vcl::Font aDefBulletFont("OpenSymbol", "", Size(0, 14));
- if(!bInit)
+ static vcl::Font aDefBulletFont = [&]()
{
- aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
- aDefBulletFont.SetFamily( FAMILY_DONTKNOW );
- aDefBulletFont.SetPitch( PITCH_DONTKNOW );
- aDefBulletFont.SetWeight( WEIGHT_DONTKNOW );
- aDefBulletFont.SetTransparent( true );
- bInit = true;
- }
+ static vcl::Font tmp("OpenSymbol", "", Size(0, 14));
+ tmp.SetCharSet( RTL_TEXTENCODING_SYMBOL );
+ tmp.SetFamily( FAMILY_DONTKNOW );
+ tmp.SetPitch( PITCH_DONTKNOW );
+ tmp.SetWeight( WEIGHT_DONTKNOW );
+ tmp.SetTransparent( true );
+ return tmp;
+ }();
return aDefBulletFont;
}
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 21e7f4a515e8..155eba15e46e 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -2374,14 +2374,11 @@ OUString FmXGridPeer::getMode()
css::uno::Sequence<OUString> FmXGridPeer::getSupportedModes()
{
- static css::uno::Sequence<OUString> aModes;
- if (!aModes.getLength())
+ static css::uno::Sequence<OUString> const aModes
{
- aModes.realloc(2);
- OUString* pModes = aModes.getArray();
- pModes[0] = "DataMode";
- pModes[1] = "FilterMode";
- }
+ "DataMode",
+ "FilterMode"
+ };
return aModes;
}
@@ -2660,8 +2657,7 @@ const std::vector<DbGridControlNavigationBarState>& FmXGridPeer::getSupportedGri
Sequence< css::util::URL>& FmXGridPeer::getSupportedURLs()
{
- static Sequence< css::util::URL> aSupported;
- if (aSupported.getLength() == 0)
+ static Sequence< css::util::URL> aSupported = [&]()
{
static const char* sSupported[] = {
FMURL_RECORD_MOVEFIRST,
@@ -2671,18 +2667,19 @@ Sequence< css::util::URL>& FmXGridPeer::getSupportedURLs()
FMURL_RECORD_MOVETONEW,
FMURL_RECORD_UNDO
};
- aSupported.realloc(SAL_N_ELEMENTS(sSupported));
- css::util::URL* pSupported = aSupported.getArray();
+ Sequence< css::util::URL> tmp(SAL_N_ELEMENTS(sSupported));
+ css::util::URL* pSupported = tmp.getArray();
- for ( sal_Int32 i = 0; i < aSupported.getLength(); ++i, ++pSupported)
+ for ( sal_Int32 i = 0; i < tmp.getLength(); ++i, ++pSupported)
pSupported->Complete = OUString::createFromAscii(sSupported[i]);
// let an css::util::URL-transformer normalize the URLs
Reference< css::util::XURLTransformer > xTransformer(
util::URLTransformer::create(::comphelper::getProcessComponentContext()) );
- for (css::util::URL & rURL : aSupported)
+ for (css::util::URL & rURL : tmp)
xTransformer->parseStrict(rURL);
- }
+ return tmp;
+ }();
return aSupported;
}
diff --git a/svx/source/fmcomp/gridcols.cxx b/svx/source/fmcomp/gridcols.cxx
index 732699ab8f8b..2aa53b8259e1 100644
--- a/svx/source/fmcomp/gridcols.cxx
+++ b/svx/source/fmcomp/gridcols.cxx
@@ -26,10 +26,10 @@ using namespace ::com::sun::star::uno;
static const css::uno::Sequence<OUString>& getColumnTypes()
{
- static css::uno::Sequence<OUString> aColumnTypes(10);
- if (aColumnTypes.getConstArray()[0].isEmpty())
+ static css::uno::Sequence<OUString> aColumnTypes = [&]()
{
- OUString* pNames = aColumnTypes.getArray();
+ css::uno::Sequence<OUString> tmp(10);
+ OUString* pNames = tmp.getArray();
pNames[TYPE_CHECKBOX] = FM_COL_CHECKBOX;
pNames[TYPE_COMBOBOX] = FM_COL_COMBOBOX;
pNames[TYPE_CURRENCYFIELD] = FM_COL_CURRENCYFIELD;
@@ -40,7 +40,8 @@ static const css::uno::Sequence<OUString>& getColumnTypes()
pNames[TYPE_PATTERNFIELD] = FM_COL_PATTERNFIELD;
pNames[TYPE_TEXTFIELD] = FM_COL_TEXTFIELD;
pNames[TYPE_TIMEFIELD] = FM_COL_TIMEFIELD;
- }
+ return tmp;
+ }();
return aColumnTypes;
}
diff --git a/svx/source/form/dataaccessdescriptor.cxx b/svx/source/form/dataaccessdescriptor.cxx
index 7d6cac0b4543..04c9976d61ee 100644
--- a/svx/source/form/dataaccessdescriptor.cxx
+++ b/svx/source/form/dataaccessdescriptor.cxx
@@ -32,11 +32,7 @@ namespace svx
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::ucb;
- struct PropertyMapEntry
- {
- OUString maName;
- DataAccessDescriptorProperty const mnHandle;
- };
+ typedef std::pair<OUString const, DataAccessDescriptorProperty> PropertyMapEntry;
class ODADescriptorImpl
{
@@ -50,7 +46,7 @@ namespace svx
Sequence< PropertyValue > m_aAsSequence;
Reference< XPropertySet > m_xAsSet;
- typedef ::std::map< OUString, PropertyMapEntry const * > MapString2PropertyEntry;
+ typedef ::std::map< OUString, DataAccessDescriptorProperty > MapString2PropertyEntry;
public:
ODADescriptorImpl();
@@ -109,7 +105,7 @@ namespace svx
MapString2PropertyEntry::const_iterator aPropPos = rProperties.find( pValues->Name );
if ( aPropPos != rProperties.end() )
{
- DataAccessDescriptorProperty eProperty = aPropPos->second->mnHandle;
+ DataAccessDescriptorProperty eProperty = aPropPos->second;
m_aValues[eProperty] = pValues->Value;
}
else
@@ -174,10 +170,7 @@ namespace svx
const ODADescriptorImpl::MapString2PropertyEntry& ODADescriptorImpl::getPropertyMap( )
{
// the properties we know
- static MapString2PropertyEntry s_aProperties;
- if ( s_aProperties.empty() )
- {
- static PropertyMapEntry const s_aDescriptorProperties[] =
+ static MapString2PropertyEntry s_aProperties
{
{ OUString("ActiveConnection"), DataAccessDescriptorProperty::Connection, },
{ OUString("BookmarkSelection"), DataAccessDescriptorProperty::BookmarkSelection, },
@@ -195,10 +188,6 @@ namespace svx
{ OUString("Selection"), DataAccessDescriptorProperty::Selection, }
};
- for (size_t i=0; i<SAL_N_ELEMENTS(s_aDescriptorProperties); ++i)
- s_aProperties[ s_aDescriptorProperties[i].maName ] = &s_aDescriptorProperties[i];
- }
-
return s_aProperties;
}
@@ -209,9 +198,9 @@ namespace svx
DataAccessDescriptorProperty nNeededHandle = _rPos->first;
auto loop = std::find_if(rProperties.begin(), rProperties.end(),
- [&nNeededHandle](const MapString2PropertyEntry::value_type& rProp) { return nNeededHandle == rProp.second->mnHandle; });
+ [&nNeededHandle](const MapString2PropertyEntry::value_type& rProp) { return nNeededHandle == rProp.second; });
if (loop != rProperties.end())
- return loop->second;
+ return &*loop;
throw RuntimeException();
}
@@ -222,8 +211,8 @@ namespace svx
// build the property value
PropertyValue aReturn;
- aReturn.Name = pProperty->maName;
- aReturn.Handle = static_cast<sal_Int32>(pProperty->mnHandle);
+ aReturn.Name = pProperty->first;
+ aReturn.Handle = static_cast<sal_Int32>(pProperty->second);
aReturn.Value = _rPos->second;
aReturn.State = PropertyState_DIRECT_VALUE;
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 744ce393f5c8..461f0fea6564 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -113,12 +113,9 @@ void OFilterItemExchange::AddSupportedFormats()
SotClipboardFormatId OFilterItemExchange::getFormatId()
{
- static SotClipboardFormatId s_nFormat = static_cast<SotClipboardFormatId>(-1);
- if (static_cast<SotClipboardFormatId>(-1) == s_nFormat)
- {
- s_nFormat = SotExchange::RegisterFormatName("application/x-openoffice;windows_formatname=\"form.FilterControlExchange\"");
- DBG_ASSERT(static_cast<SotClipboardFormatId>(-1) != s_nFormat, "OFilterExchangeHelper::getFormatId: bad exchange id!");
- }
+ static SotClipboardFormatId s_nFormat =
+ SotExchange::RegisterFormatName("application/x-openoffice;windows_formatname=\"form.FilterControlExchange\"");
+ DBG_ASSERT(static_cast<SotClipboardFormatId>(-1) != s_nFormat, "OFilterExchangeHelper::getFormatId: bad exchange id!");
return s_nFormat;
}
diff --git a/svx/source/form/fmexch.cxx b/svx/source/form/fmexch.cxx
index a4db6149c2e1..940f1f9c5dac 100644
--- a/svx/source/form/fmexch.cxx
+++ b/svx/source/form/fmexch.cxx
@@ -309,36 +309,27 @@ namespace svxform
SotClipboardFormatId OControlExchange::getControlPathFormatId()
{
- static SotClipboardFormatId s_nFormat = static_cast<SotClipboardFormatId>(-1);
- if (static_cast<SotClipboardFormatId>(-1) == s_nFormat)
- {
- s_nFormat = SotExchange::RegisterFormatName("application/x-openoffice;windows_formatname=\"svxform.ControlPathExchange\"");
- DBG_ASSERT(static_cast<SotClipboardFormatId>(-1) != s_nFormat, "OControlExchange::getControlPathFormatId: bad exchange id!");
- }
+ static SotClipboardFormatId s_nFormat =
+ SotExchange::RegisterFormatName("application/x-openoffice;windows_formatname=\"svxform.ControlPathExchange\"");
+ DBG_ASSERT(static_cast<SotClipboardFormatId>(-1) != s_nFormat, "OControlExchange::getControlPathFormatId: bad exchange id!");
return s_nFormat;
}
SotClipboardFormatId OControlExchange::getHiddenControlModelsFormatId()
{
- static SotClipboardFormatId s_nFormat = static_cast<SotClipboardFormatId>(-1);
- if (static_cast<SotClipboardFormatId>(-1) == s_nFormat)
- {
- s_nFormat = SotExchange::RegisterFormatName("application/x-openoffice;windows_formatname=\"svxform.HiddenControlModelsExchange\"");
- DBG_ASSERT(static_cast<SotClipboardFormatId>(-1) != s_nFormat, "OControlExchange::getHiddenControlModelsFormatId: bad exchange id!");
- }
+ static SotClipboardFormatId s_nFormat =
+ SotExchange::RegisterFormatName("application/x-openoffice;windows_formatname=\"svxform.HiddenControlModelsExchange\"");
+ DBG_ASSERT(static_cast<SotClipboardFormatId>(-1) != s_nFormat, "OControlExchange::getHiddenControlModelsFormatId: bad exchange id!");
return s_nFormat;
}
SotClipboardFormatId OControlExchange::getFieldExchangeFormatId()
{
- static SotClipboardFormatId s_nFormat = static_cast<SotClipboardFormatId>(-1);
- if (static_cast<SotClipboardFormatId>(-1) == s_nFormat)
- {
- s_nFormat = SotExchange::RegisterFormatName("application/x-openoffice;windows_formatname=\"svxform.FieldNameExchange\"");
- DBG_ASSERT(static_cast<SotClipboardFormatId>(-1) != s_nFormat, "OControlExchange::getFieldExchangeFormatId: bad exchange id!");
- }
+ static SotClipboardFormatId s_nFormat =
+ SotExchange::RegisterFormatName("application/x-openoffice;windows_formatname=\"svxform.FieldNameExchange\"");
+ DBG_ASSERT(static_cast<SotClipboardFormatId>(-1) != s_nFormat, "OControlExchange::getFieldExchangeFormatId: bad exchange id!");
return s_nFormat;
}
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index e4766576e452..d5c4edb22cec 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -676,13 +676,11 @@ void SAL_CALL FormController::resetted(const EventObject& rEvent)
Sequence< OUString> const & FormController::getSupportedServiceNames_Static()
{
- static Sequence< OUString> aServices;
- if (!aServices.getLength())
+ static Sequence< OUString> const aServices
{
- aServices.realloc(2);
- aServices.getArray()[0] = "com.sun.star.form.runtime.FormController";
- aServices.getArray()[1] = "com.sun.star.awt.control.TabController";
- }
+ "com.sun.star.form.runtime.FormController",
+ "com.sun.star.awt.control.TabController"
+ };
return aServices;
}
@@ -3467,13 +3465,11 @@ Sequence< OUString > SAL_CALL FormController::getSupportedModes()
::osl::MutexGuard aGuard( m_aMutex );
impl_checkDisposed_throw();
- static Sequence< OUString > aModes;
- if (!aModes.getLength())
+ static Sequence< OUString > const aModes
{
- aModes.realloc(2);
- aModes[0] = "DataMode";
- aModes[1] = "FilterMode";
- }
+ "DataMode",
+ "FilterMode"
+ };
return aModes;
}
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index ca1f29938304..256dcfd96252 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -67,17 +67,16 @@ namespace {
const vcl::Font& lcl_GetDefaultBulletFont()
{
- static bool bInit = false;
- static vcl::Font aDefBulletFont("OpenSymbol", "", Size(0, 14));
- if(!bInit)
+ static vcl::Font aDefBulletFont = [&]()
{
- aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
- aDefBulletFont.SetFamily( FAMILY_DONTKNOW );
- aDefBulletFont.SetPitch( PITCH_DONTKNOW );
- aDefBulletFont.SetWeight( WEIGHT_DONTKNOW );
- aDefBulletFont.SetTransparent( true );
- bInit = true;
- }
+ static vcl::Font tmp("OpenSymbol", "", Size(0, 14));
+ tmp.SetCharSet( RTL_TEXTENCODING_SYMBOL );
+ tmp.SetFamily( FAMILY_DONTKNOW );
+ tmp.SetPitch( PITCH_DONTKNOW );
+ tmp.SetWeight( WEIGHT_DONTKNOW );
+ tmp.SetTransparent( true );
+ return tmp;
+ }();
return aDefBulletFont;
}
diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx
index 770944c0dc28..ea8e82f8b22f 100644
--- a/svx/source/table/tabledesign.cxx
+++ b/svx/source/table/tabledesign.cxx
@@ -184,22 +184,19 @@ TableDesignStyle::TableDesignStyle()
const CellStyleNameMap& TableDesignStyle::getCellStyleNameMap()
{
- static CellStyleNameMap aMap;
- if( aMap.empty() )
+ static CellStyleNameMap const aMap
{
- CellStyleNameMap aNewMap;
- aNewMap[ OUString( "first-row" ) ] = first_row_style;
- aNewMap[ OUString( "last-row" ) ] = last_row_style;
- aNewMap[ OUString( "first-column" ) ] = first_column_style;
- aNewMap[ OUString( "last-column" ) ] = last_column_style;
- aNewMap[ OUString( "body" ) ] = body_style;
- aNewMap[ OUString( "even-rows" ) ] = even_rows_style;
- aNewMap[ OUString( "odd-rows" ) ] = odd_rows_style;
- aNewMap[ OUString( "even-columns" ) ] = even_columns_style;
- aNewMap[ OUString( "odd-columns" ) ] = odd_columns_style;
- aNewMap[ OUString( "background" ) ] = background_style;
- aMap.swap( aNewMap );
- }
+ { OUString( "first-row" ) , first_row_style },
+ { OUString( "last-row" ) , last_row_style },
+ { OUString( "first-column" ) , first_column_style },
+ { OUString( "last-column" ) , last_column_style },
+ { OUString( "body" ) , body_style },
+ { OUString( "even-rows" ) , even_rows_style },
+ { OUString( "odd-rows" ) , odd_rows_style },
+ { OUString( "even-columns" ) , even_columns_style },
+ { OUString( "odd-columns" ) , odd_columns_style },
+ { OUString( "background" ) , background_style },
+ };
return aMap;
}
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 2d4def595acb..934b8907cf38 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -779,49 +779,41 @@ namespace {
const UHashMapImpl& GetUHashImpl()
{
- static UHashMapImpl aImpl(63);
- static bool bInited = false;
- if (!bInited)
+ static UHashMapImpl const aImpl
{
- const struct { const char *name; sal_Int32 length; sal_uInt32 id; } aInit[] = {
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.RectangleShape"), OBJ_RECT },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.EllipseShape"), OBJ_CIRC },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ControlShape"), OBJ_UNO },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ConnectorShape"), OBJ_EDGE },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MeasureShape"), OBJ_MEASURE },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.LineShape"), OBJ_LINE },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyPolygonShape"), OBJ_POLY },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyLineShape"), OBJ_PLIN },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.OpenBezierShape"), OBJ_PATHLINE },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ClosedBezierShape"), OBJ_PATHFILL },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.OpenFreeHandShape"), OBJ_FREELINE },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ClosedFreeHandShape"), OBJ_FREEFILL },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyPolygonPathShape"), OBJ_PATHPOLY },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyLinePathShape"), OBJ_PATHPLIN },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GraphicObjectShape"), OBJ_GRAF },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GroupShape"), OBJ_GRUP },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TextShape"), OBJ_TEXT },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.OLE2Shape"), OBJ_OLE2 },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PageShape"), OBJ_PAGE },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.CaptionShape"), OBJ_CAPTION },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.FrameShape"), OBJ_FRAME },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PluginShape"), OBJ_OLE2_PLUGIN },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.AppletShape"), OBJ_OLE2_APPLET },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.CustomShape"), OBJ_CUSTOMSHAPE },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MediaShape"), OBJ_MEDIA },
-
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DSceneObject"), E3D_SCENE_ID | E3D_INVENTOR_FLAG },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DCubeObject"), E3D_CUBEOBJ_ID | E3D_INVENTOR_FLAG },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DSphereObject"), E3D_SPHEREOBJ_ID | E3D_INVENTOR_FLAG },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DLatheObject"), E3D_LATHEOBJ_ID | E3D_INVENTOR_FLAG },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DExtrudeObject"), E3D_EXTRUDEOBJ_ID | E3D_INVENTOR_FLAG },
- { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DPolygonObject"), E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG },
- };
-
- for (const auto& i : aInit)
- aImpl[OUString( i.name, i.length, RTL_TEXTENCODING_ASCII_US ) ] = i.id;
- bInited = true;
- }
+ { "com.sun.star.drawing.RectangleShape", OBJ_RECT },
+ { "com.sun.star.drawing.EllipseShape", OBJ_CIRC },
+ { "com.sun.star.drawing.ControlShape", OBJ_UNO },
+ { "com.sun.star.drawing.ConnectorShape", OBJ_EDGE },
+ { "com.sun.star.drawing.MeasureShape", OBJ_MEASURE },
+ { "com.sun.star.drawing.LineShape", OBJ_LINE },
+ { "com.sun.star.drawing.PolyPolygonShape", OBJ_POLY },
+ { "com.sun.star.drawing.PolyLineShape", OBJ_PLIN },
+ { "com.sun.star.drawing.OpenBezierShape", OBJ_PATHLINE },
+ { "com.sun.star.drawing.ClosedBezierShape", OBJ_PATHFILL },
+ { "com.sun.star.drawing.OpenFreeHandShape", OBJ_FREELINE },
+ { "com.sun.star.drawing.ClosedFreeHandShape", OBJ_FREEFILL },
+ { "com.sun.star.drawing.PolyPolygonPathShape", OBJ_PATHPOLY },
+ { "com.sun.star.drawing.PolyLinePathShape", OBJ_PATHPLIN },
+ { "com.sun.star.drawing.GraphicObjectShape", OBJ_GRAF },
+ { "com.sun.star.drawing.GroupShape", OBJ_GRUP },
+ { "com.sun.star.drawing.TextShape", OBJ_TEXT },
+ { "com.sun.star.drawing.OLE2Shape", OBJ_OLE2 },
+ { "com.sun.star.drawing.PageShape", OBJ_PAGE },
+ { "com.sun.star.drawing.CaptionShape", OBJ_CAPTION },
+ { "com.sun.star.drawing.FrameShape", OBJ_FRAME },
+ { "com.sun.star.drawing.PluginShape", OBJ_OLE2_PLUGIN },
+ { "com.sun.star.drawing.AppletShape", OBJ_OLE2_APPLET },
+ { "com.sun.star.drawing.CustomShape", OBJ_CUSTOMSHAPE },
+ { "com.sun.star.drawing.MediaShape", OBJ_MEDIA },
+
+ { "com.sun.star.drawing.Shape3DSceneObject", E3D_SCENE_ID | E3D_INVENTOR_FLAG },
+ { "com.sun.star.drawing.Shape3DCubeObject", E3D_CUBEOBJ_ID | E3D_INVENTOR_FLAG },
+ { "com.sun.star.drawing.Shape3DSphereObject", E3D_SPHEREOBJ_ID | E3D_INVENTOR_FLAG },
+ { "com.sun.star.drawing.Shape3DLatheObject", E3D_LATHEOBJ_ID | E3D_INVENTOR_FLAG },
+ { "com.sun.star.drawing.Shape3DExtrudeObject", E3D_EXTRUDEOBJ_ID | E3D_INVENTOR_FLAG },
+ { "com.sun.star.drawing.Shape3DPolygonObject", E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG },
+ };
return aImpl;
}
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 8d7f3e6f6271..21938249c7f5 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -3103,30 +3103,26 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
{
case OBJ_GRUP:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_GroupServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_GroupServices;
-
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_GroupServices,
+ uno::Sequence< OUString > tmp;
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_GroupShape,
sUNO_service_drawing_Shape} );
+ return tmp;
+ }();
- pSeq = &SvxShape_GroupServices;
- }
-
- return *pSeq;
+ return aSvxShape_GroupServices;
}
case OBJ_CUSTOMSHAPE:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_CustomShapeServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_CustomShapeServices;
+ uno::Sequence< OUString > tmp;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_CustomShapeServices,
- {sUNO_service_drawing_CustomShape,
- sUNO_service_drawing_Shape,
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
+ {sUNO_service_drawing_CustomShape,
+ sUNO_service_drawing_Shape,
sUNO_service_drawing_CustomShapeProperties,
sUNO_service_drawing_FillProperties,
sUNO_service_drawing_LineProperties,
@@ -3140,18 +3136,17 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_style_CharacterPropertiesAsian,
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_CustomShapeServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_CustomShapeServices;
}
case OBJ_LINE:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_LineServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_LineServices;
+ uno::Sequence< OUString > tmp;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_LineServices,
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_LineShape,
sUNO_service_drawing_Shape,
@@ -3169,20 +3164,18 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_PolyPolygonDescriptor,
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
-
- pSeq = &SvxShape_LineServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_LineServices;
}
case OBJ_RECT:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_RectServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_RectServices;
+ uno::Sequence< OUString > tmp;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_RectServices,
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_RectangleShape,
sUNO_service_drawing_Shape,
@@ -3199,9 +3192,9 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_RectServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_RectServices;
}
case OBJ_CIRC:
@@ -3209,12 +3202,11 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
case OBJ_CARC:
case OBJ_CCUT:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_CircServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_CircServices;
+ uno::Sequence< OUString > tmp;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_CircServices,
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_EllipseShape,
sUNO_service_drawing_Shape,
@@ -3233,20 +3225,19 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_CircServices;
- }
+ return tmp;
+ }();
- return *pSeq;
+ return aSvxShape_CircServices;
}
case OBJ_PATHPLIN:
case OBJ_PLIN:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_PathServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_PathServices;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_PathServices,
+ uno::Sequence< OUString > tmp;
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_PolyLineShape,
sUNO_service_drawing_Shape,
@@ -3265,19 +3256,18 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_PathServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_PathServices;
}
case OBJ_PATHPOLY:
case OBJ_POLY:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_PolyServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_PolyServices;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_PolyServices,
+ uno::Sequence< OUString > tmp;
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_PolyPolygonShape,
sUNO_service_drawing_Shape,
@@ -3298,20 +3288,19 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_PolyServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_PolyServices;
}
case OBJ_FREELINE:
case OBJ_PATHLINE:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_FreeLineServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_FreeLineServices;
+ uno::Sequence< OUString > tmp;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeLineServices,
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_OpenBezierShape,
sUNO_service_drawing_Shape,
@@ -3332,20 +3321,19 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_FreeLineServices;
- }
+ return tmp;
+ }();
- return *pSeq;
+ return aSvxShape_FreeLineServices;
}
case OBJ_FREEFILL:
case OBJ_PATHFILL:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_FreeFillServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_FreeFillServices;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeFillServices,
+ uno::Sequence< OUString > tmp;
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_ClosedBezierShape,
sUNO_service_drawing_Shape,
@@ -3366,20 +3354,19 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_FreeFillServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_FreeFillServices;
}
case OBJ_OUTLINETEXT:
case OBJ_TITLETEXT:
case OBJ_TEXT:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_TextServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_TextServices;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_TextServices,
+ uno::Sequence< OUString > tmp;
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_TextShape,
sUNO_service_drawing_Shape,
@@ -3398,18 +3385,17 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_TextServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_TextServices;
}
case OBJ_GRAF:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_GrafServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_GrafServices;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_GrafServices,
+ uno::Sequence< OUString > tmp;
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_GraphicObjectShape,
sUNO_service_drawing_Shape,
@@ -3426,19 +3412,18 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_GrafServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_GrafServices;
}
case OBJ_OLE2:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_Ole2Services = [&]()
{
- static uno::Sequence< OUString > SvxShape_Ole2Services;
+ uno::Sequence< OUString > tmp;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_Ole2Services,
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_OLE2Shape,
sUNO_service_drawing_Shape,
@@ -3455,19 +3440,18 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_Ole2Services;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_Ole2Services;
}
case OBJ_CAPTION:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_CaptionServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_CaptionServices;
+ uno::Sequence< OUString > tmp;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_CaptionServices,
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_CaptionShape,
sUNO_service_drawing_Shape,
@@ -3486,36 +3470,34 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_CaptionServices;
- }
+ return tmp;
+ }();
- return *pSeq;
+ return aSvxShape_CaptionServices;
}
case OBJ_PAGE:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_PageServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_PageServices;
+ uno::Sequence< OUString > tmp;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_PageServices,
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_PageShape,
sUNO_service_drawing_Shape} );
- pSeq = &SvxShape_PageServices;
- }
+ return tmp;
+ }();
- return *pSeq;
+ return aSvxShape_PageServices;
}
case OBJ_MEASURE:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_MeasureServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_MeasureServices;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_MeasureServices,
+ uno::Sequence< OUString > tmp;
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_MeasureShape,
sUNO_service_drawing_MeasureProperties,
@@ -3536,52 +3518,49 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_MeasureServices;
- }
+ return tmp;
+ }();
- return *pSeq;
+ return aSvxShape_MeasureServices;
}
case OBJ_FRAME:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_FrameServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_FrameServices;
+ uno::Sequence< OUString > tmp;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_FrameServices,
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_FrameShape,
sUNO_service_drawing_Shape} );
- pSeq = &SvxShape_FrameServices;
- }
+ return tmp;
+ }();
- return *pSeq;
+ return aSvxShape_FrameServices;
}
case OBJ_UNO:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_UnoServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_UnoServices;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices,
+ uno::Sequence< OUString > tmp;
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_ControlShape,
sUNO_service_drawing_Shape} );
- pSeq = &SvxShape_UnoServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_UnoServices;
}
case OBJ_EDGE:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_EdgeServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_EdgeServices;
+ uno::Sequence< OUString > tmp;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_EdgeServices,
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_ConnectorShape,
sUNO_service_drawing_ConnectorProperties,
@@ -3601,24 +3580,23 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
sUNO_service_drawing_ShadowProperties,
sUNO_service_drawing_RotationDescriptor});
- pSeq = &SvxShape_EdgeServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_EdgeServices;
}
case OBJ_MEDIA:
{
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_MediaServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_MediaServices;
+ uno::Sequence< OUString > tmp;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_MediaServices,
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_MediaShape,
sUNO_service_drawing_Shape});
- pSeq = &SvxShape_MediaServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_MediaServices;
}
}
}
@@ -3628,17 +3606,16 @@ uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
const sal_uInt16 nIdent = GetSdrObject()->GetObjIdentifier();
OSL_ENSURE( nIdent == OBJ_UNO, "SvxShape::_getSupportedServiceNames: SdrInventor::FmForm, but no UNO object?" );
#endif
- static uno::Sequence< OUString > *pSeq = nullptr;
- if( nullptr == pSeq )
+ static uno::Sequence< OUString > aSvxShape_UnoServices = [&]()
{
- static uno::Sequence< OUString > SvxShape_UnoServices;
- comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices,
+ uno::Sequence< OUString > tmp;
+ comphelper::ServiceInfoHelper::addToSequence( tmp,
{sUNO_service_drawing_ControlShape,
sUNO_service_drawing_Shape} );
- pSeq = &SvxShape_UnoServices;
- }
- return *pSeq;
+ return tmp;
+ }();
+ return aSvxShape_UnoServices;
}
OSL_FAIL( "SvxShape::_getSupportedServiceNames: could not determine object type!" );
uno::Sequence< OUString > aSeq;