include/oox/drawingml/shape.hxx                  |    7 +-
 include/oox/ppt/pptshape.hxx                     |    2 
 oox/source/drawingml/shape.cxx                   |   54 +++++++++++++++++------
 oox/source/drawingml/shapepropertiescontext.cxx  |    2 
 oox/source/ppt/pptshape.cxx                      |    4 -
 oox/source/ppt/pptshapegroupcontext.cxx          |   10 ++--
 oox/source/ppt/presentationfragmenthandler.cxx   |   10 ++--
 oox/source/ppt/slidefragmenthandler.cxx          |    4 -
 oox/source/shape/LockedCanvasContext.cxx         |   17 ++++---
 oox/source/shape/WordprocessingCanvasContext.cxx |    9 ++-
 oox/source/shape/WpgContext.cxx                  |   19 ++++----
 oox/source/shape/WpsContext.cxx                  |    2 
 sc/source/filter/inc/drawingfragment.hxx         |    2 
 sc/source/filter/oox/drawingfragment.cxx         |   14 ++---
 14 files changed, 94 insertions(+), 62 deletions(-)

New commits:
commit 959b30841ae9c5cc1f43928f5e7780abaab4a087
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Mar 8 22:24:41 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Mar 9 18:41:49 2024 +0100

    tdf#158773 avoid some OUString construction
    
    Change-Id: I42c6b7a8c7b0c0af17a2806c908f5a336ef206d8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164599
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index b5dad22b64af..455e3f6de9c0 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -110,14 +110,15 @@ class OOX_DLLPUBLIC Shape
 {
 public:
 
-    explicit Shape( const char* pServiceType = nullptr, bool bDefaultHeight = 
true );
+    Shape();
+    explicit Shape( const OUString& rServiceType, bool bDefaultHeight = true );
     explicit Shape( const ShapePtr& pSourceShape );
     Shape(Shape const &) = default;
     virtual ~Shape();
     Shape & operator =(Shape const &) = default;
 
-    OUString&                  getServiceName(){ return msServiceName; }
-    void                            setServiceName( const char* pServiceName );
+    const OUString&            getServiceName() const { return msServiceName; }
+    void                       setServiceName( const OUString& rServiceName ) 
{ msServiceName = rServiceName; }
 
     const OUString& getDiagramDataModelID() const { return 
msDiagramDataModelID; }
     void setDiagramDataModelID( const OUString& rDiagramDataModelID ) { 
msDiagramDataModelID = rDiagramDataModelID; }
diff --git a/include/oox/ppt/pptshape.hxx b/include/oox/ppt/pptshape.hxx
index eb77b667dd74..02c60a69a759 100644
--- a/include/oox/ppt/pptshape.hxx
+++ b/include/oox/ppt/pptshape.hxx
@@ -58,7 +58,7 @@ class PPTShape final : public oox::drawingml::Shape
 public:
 
     PPTShape( const oox::ppt::ShapeLocation eShapeLocation,
-                const char* pServiceType );
+                const OUString& rServiceType );
     virtual ~PPTShape() override;
 
     using oox::drawingml::Shape::addShape;
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index eb43f0e6657c..99a8e72d0de2 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -126,7 +126,7 @@ using namespace ::com::sun::star::style;
 
 namespace oox::drawingml {
 
-Shape::Shape( const char* pServiceName, bool bDefaultHeight )
+Shape::Shape()
 : mpLinePropertiesPtr( std::make_shared<LineProperties>() )
 , mpShapeRefLinePropPtr( std::make_shared<LineProperties>() )
 , mpFillPropertiesPtr( std::make_shared<FillProperties>() )
@@ -155,8 +155,40 @@ Shape::Shape( const char* pServiceName, bool 
bDefaultHeight )
 , maDiagramDoms( 0 )
 , mpDiagramHelper( nullptr )
 {
-    if ( pServiceName )
-        msServiceName = OUString::createFromAscii( pServiceName );
+    setDefaults(/*bDefaultHeight*/true);
+}
+
+
+Shape::Shape( const OUString& rServiceName, bool bDefaultHeight )
+: mpLinePropertiesPtr( std::make_shared<LineProperties>() )
+, mpShapeRefLinePropPtr( std::make_shared<LineProperties>() )
+, mpFillPropertiesPtr( std::make_shared<FillProperties>() )
+, mpShapeRefFillPropPtr( std::make_shared<FillProperties>() )
+, mpGraphicPropertiesPtr( std::make_shared<GraphicProperties>() )
+, mpCustomShapePropertiesPtr( std::make_shared<CustomShapeProperties>() )
+, mp3DPropertiesPtr( std::make_shared<Shape3DProperties>() )
+, mpEffectPropertiesPtr( std::make_shared<EffectProperties>() )
+, mpShapeRefEffectPropPtr( std::make_shared<EffectProperties>() )
+, mpMasterTextListStyle( std::make_shared<TextListStyle>() )
+, mnSubType( 0 )
+, meFrameType( FRAMETYPE_GENERIC )
+, mnRotation( 0 )
+, mnDiagramRotation( 0 )
+, mbFlipH( false )
+, mbFlipV( false )
+, mbHidden( false )
+, mbHiddenMasterShape( false )
+, mbLocked( false )
+, mbWPGChild(false)
+, mbLockedCanvas( false )
+, mbWordprocessingCanvas(false)
+, mbWps( false )
+, mbTextBox( false )
+, mbHasLinkedTxbx( false )
+, maDiagramDoms( 0 )
+, mpDiagramHelper( nullptr )
+{
+    msServiceName = rServiceName;
     setDefaults(bDefaultHeight);
 }
 
@@ -313,9 +345,9 @@ ChartShapeInfo& Shape::setChartType( bool bEmbedShapes )
     OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setChartType - 
multiple frame types" );
     meFrameType = FRAMETYPE_CHART;
     if (mbWps)
-        msServiceName = "com.sun.star.drawing.temporaryForXMLImportOLE2Shape";
+        msServiceName = 
u"com.sun.star.drawing.temporaryForXMLImportOLE2Shape"_ustr;
     else
-        msServiceName = "com.sun.star.drawing.OLE2Shape";
+        msServiceName = u"com.sun.star.drawing.OLE2Shape"_ustr;
     mxChartShapeInfo = std::make_shared<ChartShapeInfo>( bEmbedShapes );
     return *mxChartShapeInfo;
 }
@@ -324,7 +356,7 @@ void Shape::setDiagramType()
 {
     OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setDiagramType - 
multiple frame types" );
     meFrameType = FRAMETYPE_DIAGRAM;
-    msServiceName = "com.sun.star.drawing.GroupShape";
+    msServiceName = u"com.sun.star.drawing.GroupShape"_ustr;
     mnSubType = 0;
 }
 
@@ -332,16 +364,10 @@ void Shape::setTableType()
 {
     OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setTableType - 
multiple frame types" );
     meFrameType = FRAMETYPE_TABLE;
-    msServiceName = "com.sun.star.drawing.TableShape";
+    msServiceName = u"com.sun.star.drawing.TableShape"_ustr;
     mnSubType = 0;
 }
 
-void Shape::setServiceName( const char* pServiceName )
-{
-    if ( pServiceName )
-        msServiceName = OUString::createFromAscii( pServiceName );
-}
-
 const ShapeStyleRef* Shape::getShapeStyleRef( sal_Int32 nRefType ) const
 {
     ShapeStyleRefMap::const_iterator aIt = maShapeStyleRefs.find( nRefType );
@@ -926,7 +952,7 @@ Reference< XShape > const & Shape::createAndInsert(
     if (pMathXml)
     {
         // convert this shape to OLE
-        aServiceName = "com.sun.star.drawing.OLE2Shape";
+        aServiceName = u"com.sun.star.drawing.OLE2Shape"_ustr;
         msServiceName = aServiceName;
         meFrameType = FRAMETYPE_GENERIC; // not OLEOBJECT, no stream in package
         mnSubType = 0;
diff --git a/oox/source/drawingml/shapepropertiescontext.cxx 
b/oox/source/drawingml/shapepropertiescontext.cxx
index a637f011d501..228d70351756 100644
--- a/oox/source/drawingml/shapepropertiescontext.cxx
+++ b/oox/source/drawingml/shapepropertiescontext.cxx
@@ -64,7 +64,7 @@ ContextHandlerRef ShapePropertiesContext::onCreateContext( 
sal_Int32 aElementTok
             // TODO: Move the following checks to a separate place or as a 
separate function
             if (nToken == XML_line && !mrShape.isConnectorShape())
             {
-                mrShape.getServiceName() = "com.sun.star.drawing.LineShape";
+                mrShape.setServiceName(u"com.sun.star.drawing.LineShape"_ustr);
             }
 
             // We got a preset geometry, forget the geometry inherited from 
the placeholder shape.
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 733aa2a73aed..5d0152f2d6a8 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -58,8 +58,8 @@ using namespace ::com::sun::star::presentation;
 
 namespace oox::ppt {
 
-PPTShape::PPTShape( const oox::ppt::ShapeLocation eShapeLocation, const char* 
pServiceName )
-: Shape( pServiceName )
+PPTShape::PPTShape( const oox::ppt::ShapeLocation eShapeLocation, const 
OUString& rServiceName )
+: Shape( rServiceName )
 , meShapeLocation( eShapeLocation )
 , mbReferenced( false )
 , mbHasNoninheritedShapeProperties( false )
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx 
b/oox/source/ppt/pptshapegroupcontext.cxx
index 49a5f5ce4ba6..b29aa95cf0e2 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -100,15 +100,15 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( 
sal_Int32 aElementToken
 */
     case PPT_TOKEN( cxnSp ):        // connector shape
     {
-        auto pShape = std::make_shared<PPTShape>(meShapeLocation, 
"com.sun.star.drawing.ConnectorShape");
+        auto pShape = std::make_shared<PPTShape>(meShapeLocation, 
u"com.sun.star.drawing.ConnectorShape"_ustr);
         return new oox::drawingml::ConnectorShapeContext(*this, 
mpGroupShapePtr, pShape,
                                                          
pShape->getConnectorShapeProperties());
     }
     case PPT_TOKEN( grpSp ):        // group shape
-        return new PPTShapeGroupContext( *this, mpSlidePersistPtr, 
meShapeLocation, mpGroupShapePtr, std::make_shared<PPTShape>( meShapeLocation, 
"com.sun.star.drawing.GroupShape" ) );
+        return new PPTShapeGroupContext( *this, mpSlidePersistPtr, 
meShapeLocation, mpGroupShapePtr, std::make_shared<PPTShape>( meShapeLocation, 
u"com.sun.star.drawing.GroupShape"_ustr ) );
     case PPT_TOKEN( sp ):           // Shape
         {
-            auto pShape = std::make_shared<PPTShape>( meShapeLocation, 
"com.sun.star.drawing.CustomShape" );
+            auto pShape = std::make_shared<PPTShape>( meShapeLocation, 
u"com.sun.star.drawing.CustomShape"_ustr );
             bool bUseBgFill = rAttribs.getBool(XML_useBgFill, false);
             if (bUseBgFill)
             {
@@ -119,10 +119,10 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( 
sal_Int32 aElementToken
             return new PPTShapeContext( *this, mpSlidePersistPtr, 
mpGroupShapePtr, pShape );
         }
     case PPT_TOKEN( pic ):          // CT_Picture
-        return new PPTGraphicShapeContext( *this, mpSlidePersistPtr, 
mpGroupShapePtr,  std::make_shared<PPTShape>( meShapeLocation, 
"com.sun.star.drawing.GraphicObjectShape" ) );
+        return new PPTGraphicShapeContext( *this, mpSlidePersistPtr, 
mpGroupShapePtr,  std::make_shared<PPTShape>( meShapeLocation, 
u"com.sun.star.drawing.GraphicObjectShape"_ustr ) );
     case PPT_TOKEN( graphicFrame ): // CT_GraphicalObjectFrame
         {
-            pGraphicShape = std::make_shared<PPTShape>( meShapeLocation, 
"com.sun.star.drawing.OLE2Shape" );
+            pGraphicShape = std::make_shared<PPTShape>( meShapeLocation, 
u"com.sun.star.drawing.OLE2Shape"_ustr );
             return new oox::drawingml::GraphicalObjectFrameContext( *this, 
mpGroupShapePtr, pGraphicShape, true );
         }
     }
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index 2e0f48bbae98..955f4e246de1 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -246,7 +246,7 @@ void PresentationFragmentHandler::importMasterSlide(const 
Reference<frame::XMode
         }
 
         pMasterPersistPtr = std::make_shared<SlidePersist>( rFilter, true, 
false, xMasterPage,
-                                                            
std::make_shared<PPTShape>( Master, "com.sun.star.drawing.GroupShape" ), 
mpTextListStyle );
+                                                            
std::make_shared<PPTShape>( Master, u"com.sun.star.drawing.GroupShape"_ustr ), 
mpTextListStyle );
         pMasterPersistPtr->setLayoutPath( aLayoutFragmentPath );
         rFilter.getMasterPages().push_back( pMasterPersistPtr );
         rFilter.setActualSlidePersist( pMasterPersistPtr );
@@ -404,7 +404,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 
nSlide, bool bFirstPage
         {
             SlidePersistPtr pMasterPersistPtr;
             SlidePersistPtr pSlidePersistPtr = std::make_shared<SlidePersist>( 
rFilter, false, false, xSlide,
-                                std::make_shared<PPTShape>( Slide, 
"com.sun.star.drawing.GroupShape" ), mpTextListStyle );
+                                std::make_shared<PPTShape>( Slide, 
u"com.sun.star.drawing.GroupShape"_ustr ), mpTextListStyle );
 
             FragmentHandlerRef xSlideFragmentHandler( new 
SlideFragmentHandler( rFilter, aSlideFragmentPath, pSlidePersistPtr, Slide ) );
 
@@ -458,7 +458,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 
nSlide, bool bFirstPage
                         if ( xNotesPage.is() )
                         {
                             SlidePersistPtr pNotesPersistPtr = 
std::make_shared<SlidePersist>( rFilter, false, true, xNotesPage,
-                                std::make_shared<PPTShape>( Slide, 
"com.sun.star.drawing.GroupShape" ), mpTextListStyle );
+                                std::make_shared<PPTShape>( Slide, 
u"com.sun.star.drawing.GroupShape"_ustr ), mpTextListStyle );
                             FragmentHandlerRef xNotesFragmentHandler( new 
SlideFragmentHandler( getFilter(), aNotesFragmentPath, pNotesPersistPtr, Slide 
) );
                             rFilter.getNotesPages().push_back( 
pNotesPersistPtr );
                             rFilter.setActualSlidePersist( pNotesPersistPtr );
@@ -479,7 +479,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 
nSlide, bool bFirstPage
                 SlidePersistPtr pCommentAuthorsPersistPtr =
                     std::make_shared<SlidePersist>( rFilter, false, true, 
xCommentAuthorsPage,
                                       std::make_shared<PPTShape>(
-                                              Slide, 
"com.sun.star.drawing.GroupShape" ),
+                                              Slide, 
u"com.sun.star.drawing.GroupShape"_ustr ),
                                       mpTextListStyle );
                 FragmentHandlerRef xCommentAuthorsFragmentHandler(
                     new SlideFragmentHandler( getFilter(),
@@ -498,7 +498,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 
nSlide, bool bFirstPage
                     std::make_shared<SlidePersist>(
                         rFilter, false, true, xCommentsPage,
                         std::make_shared<PPTShape>(
-                                Slide, "com.sun.star.drawing.GroupShape" ),
+                                Slide, u"com.sun.star.drawing.GroupShape"_ustr 
),
                         mpTextListStyle );
 
                 FragmentHandlerRef xCommentsFragmentHandler(
diff --git a/oox/source/ppt/slidefragmenthandler.cxx 
b/oox/source/ppt/slidefragmenthandler.cxx
index 87fc980b0757..491b7c90ed64 100644
--- a/oox/source/ppt/slidefragmenthandler.cxx
+++ b/oox/source/ppt/slidefragmenthandler.cxx
@@ -112,7 +112,7 @@ SlideFragmentHandler::~SlideFragmentHandler()
         if( !bNotesFragmentPathFound && !mpSlidePersistPtr->getMasterPersist() 
)
         {
             SlidePersistPtr pMasterPersistPtr = 
std::make_shared<SlidePersist>( rFilter, true, true, 
mpSlidePersistPtr->getPage(),
-                                std::make_shared<PPTShape>( Master, 
"com.sun.star.drawing.GroupShape" ), mpSlidePersistPtr->getNotesTextStyle() );
+                                std::make_shared<PPTShape>( Master, 
u"com.sun.star.drawing.GroupShape"_ustr ), 
mpSlidePersistPtr->getNotesTextStyle() );
             pMasterPersistPtr->setPath( aNotesFragmentPath );
             rFilter.getMasterPages().push_back( pMasterPersistPtr );
             FragmentHandlerRef xMasterFragmentHandler( new 
SlideFragmentHandler( rFilter, aNotesFragmentPath, pMasterPersistPtr, Master ) 
);
@@ -131,7 +131,7 @@ SlideFragmentHandler::~SlideFragmentHandler()
         {
             return new PPTShapeGroupContext(
                 *this, mpSlidePersistPtr, meShapeLocation, 
mpSlidePersistPtr->getShapes(),
-                std::make_shared<PPTShape>( meShapeLocation, 
"com.sun.star.drawing.GroupShape" ) );
+                std::make_shared<PPTShape>( meShapeLocation, 
u"com.sun.star.drawing.GroupShape"_ustr ) );
         }
         break;
 
diff --git a/oox/source/shape/LockedCanvasContext.cxx 
b/oox/source/shape/LockedCanvasContext.cxx
index ab745158275a..31f04a991a83 100644
--- a/oox/source/shape/LockedCanvasContext.cxx
+++ b/oox/source/shape/LockedCanvasContext.cxx
@@ -26,7 +26,7 @@ namespace oox::shape
 LockedCanvasContext::LockedCanvasContext(FragmentHandler2 const& rParent)
     : FragmentHandler2(rParent)
 {
-    mpShapePtr = 
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape");
+    mpShapePtr = 
std::make_shared<oox::drawingml::Shape>(u"com.sun.star.drawing.GroupShape"_ustr);
     mpShapePtr->setLockedCanvas(true); // will be "LockedCanvas" in 
InteropGrabBag
 }
 
@@ -47,12 +47,13 @@ LockedCanvasContext::onCreateContext(sal_Int32 
nElementToken, const ::oox::Attri
         {
             return new oox::drawingml::ShapeContext(
                 *this, mpShapePtr,
-                
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.CustomShape", 
true));
+                
std::make_shared<oox::drawingml::Shape>(u"com.sun.star.drawing.CustomShape"_ustr,
+                                                        true));
         }
         case XML_cxnSp: // CT_GvmlConnector
         {
-            oox::drawingml::ShapePtr pShape
-                = 
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.ConnectorShape");
+            oox::drawingml::ShapePtr pShape = 
std::make_shared<oox::drawingml::Shape>(
+                u"com.sun.star.drawing.ConnectorShape"_ustr);
             return new oox::drawingml::ConnectorShapeContext(*this, 
mpShapePtr, pShape,
                                                              
pShape->getConnectorShapeProperties());
         }
@@ -60,20 +61,22 @@ LockedCanvasContext::onCreateContext(sal_Int32 
nElementToken, const ::oox::Attri
         {
             return new oox::drawingml::GraphicShapeContext(
                 *this, mpShapePtr,
-                
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape"));
+                std::make_shared<oox::drawingml::Shape>(
+                    u"com.sun.star.drawing.GraphicObjectShape"_ustr));
         }
         case XML_graphicFrame: // CT_GvmlGraphicObjectFrame
         {
             return new oox::drawingml::GraphicalObjectFrameContext(
                 *this, mpShapePtr,
-                
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape"),
+                std::make_shared<oox::drawingml::Shape>(
+                    u"com.sun.star.drawing.GraphicObjectShape"_ustr),
                 true);
         }
         case XML_grpSp: // CT_GvmlGroupShape
         {
             return new oox::drawingml::ShapeGroupContext(
                 *this, mpShapePtr,
-                
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape"));
+                
std::make_shared<oox::drawingml::Shape>(u"com.sun.star.drawing.GroupShape"_ustr));
         }
         // mandatory child elements of CT_GvmlGroupShapeNonVisual
         case XML_cNvPr: // CT_NonVisualDrawingProps
diff --git a/oox/source/shape/WordprocessingCanvasContext.cxx 
b/oox/source/shape/WordprocessingCanvasContext.cxx
index 9365e387f5e3..b03886441d6a 100644
--- a/oox/source/shape/WordprocessingCanvasContext.cxx
+++ b/oox/source/shape/WordprocessingCanvasContext.cxx
@@ -36,12 +36,12 @@ 
WordprocessingCanvasContext::WordprocessingCanvasContext(FragmentHandler2 const&
     : FragmentHandler2(rParent)
     , m_bFullWPGSupport(true)
 {
-    mpShapePtr = 
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape");
+    mpShapePtr = 
std::make_shared<oox::drawingml::Shape>(u"com.sun.star.drawing.GroupShape"_ustr);
     mpShapePtr->setSize(rSize);
     mpShapePtr->setWordprocessingCanvas(true); // will be 
"WordprocessingCanvas" in InteropGrabBag
     mpShapePtr->setWps(true);
     oox::drawingml::ShapePtr pBackground
-        = 
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.CustomShape");
+        = 
std::make_shared<oox::drawingml::Shape>(u"com.sun.star.drawing.CustomShape"_ustr);
     pBackground->getCustomShapeProperties()->setShapePresetType(XML_rect);
     pBackground->setSize(rSize);
     pBackground->setWordprocessingCanvas(true);
@@ -73,14 +73,15 @@ WordprocessingCanvasContext::onCreateContext(sal_Int32 
nElementToken,
         case XML_wsp: // CT_WordprocessingShape
         {
             oox::drawingml::ShapePtr pShape = 
std::make_shared<oox::drawingml::Shape>(
-                "com.sun.star.drawing.CustomShape", /*bDefaultHeight=*/false);
+                u"com.sun.star.drawing.CustomShape"_ustr, 
/*bDefaultHeight=*/false);
             return new oox::shape::WpsContext(*this, 
uno::Reference<drawing::XShape>(), mpShapePtr,
                                               pShape);
         }
         case XML_pic: // CT_Picture
             return new oox::drawingml::GraphicShapeContext(
                 *this, mpShapePtr,
-                
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape"));
+                std::make_shared<oox::drawingml::Shape>(
+                    u"com.sun.star.drawing.GraphicObjectShape"_ustr));
             break;
         case XML_graphicFrame: // CT_GraphicFrame
             SAL_INFO("oox",
diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx
index ee9e58b7c18e..3d0e2a58b819 100644
--- a/oox/source/shape/WpgContext.cxx
+++ b/oox/source/shape/WpgContext.cxx
@@ -24,7 +24,7 @@ WpgContext::WpgContext(FragmentHandler2 const& rParent, const 
oox::drawingml::Sh
     : FragmentHandler2(rParent)
     , m_bFullWPGSupport(false)
 {
-    mpShape = 
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape");
+    mpShape = 
std::make_shared<oox::drawingml::Shape>(u"com.sun.star.drawing.GroupShape"_ustr);
     mpShape->setWps(true);
     if (pMaster)
         pMaster->addChild(mpShape);
@@ -45,10 +45,10 @@ oox::core::ContextHandlerRef 
WpgContext::onCreateContext(sal_Int32 nElementToken
         {
             if (m_bFullWPGSupport)
             {
-                return new oox::shape::WpsContext(
-                    *this, uno::Reference<drawing::XShape>(), mpShape,
-                    
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.CustomShape",
-                                                            
/*bDefaultHeight=*/false));
+                return new oox::shape::WpsContext(*this, 
uno::Reference<drawing::XShape>(), mpShape,
+                                                  
std::make_shared<oox::drawingml::Shape>(
+                                                      
u"com.sun.star.drawing.CustomShape"_ustr,
+                                                      
/*bDefaultHeight=*/false));
             }
 
             // Don't set default character height, Writer has its own way to 
set
@@ -56,13 +56,14 @@ oox::core::ContextHandlerRef 
WpgContext::onCreateContext(sal_Int32 nElementToken
             // it.
             return new oox::drawingml::ShapeContext(
                 *this, mpShape,
-                
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.CustomShape",
+                
std::make_shared<oox::drawingml::Shape>(u"com.sun.star.drawing.CustomShape"_ustr,
                                                         
/*bDefaultHeight=*/false));
         }
         case XML_pic:
             return new oox::drawingml::GraphicShapeContext(
                 *this, mpShape,
-                
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape"));
+                std::make_shared<oox::drawingml::Shape>(
+                    u"com.sun.star.drawing.GraphicObjectShape"_ustr));
         case XML_grpSp:
         {
             if (m_bFullWPGSupport)
@@ -74,12 +75,12 @@ oox::core::ContextHandlerRef 
WpgContext::onCreateContext(sal_Int32 nElementToken
 
             return new oox::drawingml::ShapeGroupContext(
                 *this, mpShape,
-                
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape"));
+                
std::make_shared<oox::drawingml::Shape>(u"com.sun.star.drawing.GroupShape"_ustr));
         }
         case XML_graphicFrame:
         {
             auto pShape = std::make_shared<oox::drawingml::Shape>(
-                "com.sun.star.drawing.GraphicObjectShape");
+                u"com.sun.star.drawing.GraphicObjectShape"_ustr);
             pShape->setWps(true);
             return new oox::drawingml::GraphicalObjectFrameContext(*this, 
mpShape, pShape,
                                                                    
/*bEmbedShapesInChart=*/true);
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index f0d5ed8133cf..6d7b3d117fc4 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -584,7 +584,7 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
                 break;
             // Generate new shape
             oox::drawingml::ShapePtr pShape = 
std::make_shared<oox::drawingml::Shape>(
-                "com.sun.star.drawing.ConnectorShape", false);
+                u"com.sun.star.drawing.ConnectorShape"_ustr, false);
             pShape->setConnectorShape(true);
             pShape->setWps(true);
             pShape->setWordprocessingCanvas(true);
diff --git a/sc/source/filter/inc/drawingfragment.hxx 
b/sc/source/filter/inc/drawingfragment.hxx
index 0ba281db09a6..820983a80262 100644
--- a/sc/source/filter/inc/drawingfragment.hxx
+++ b/sc/source/filter/inc/drawingfragment.hxx
@@ -58,7 +58,7 @@ public:
     explicit            Shape(
                             const WorksheetHelper& rHelper,
                             const AttributeList& rAttribs,
-                            const char* pcServiceName );
+                            const OUString& rServiceName );
 
 private:
     virtual void        finalizeXShape(
diff --git a/sc/source/filter/oox/drawingfragment.cxx 
b/sc/source/filter/oox/drawingfragment.cxx
index 2d5416b37756..efb6f728ec9f 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -91,8 +91,8 @@ void ShapeMacroAttacher::attachMacro( const OUString& 
rMacroUrl )
     }
 }
 
-Shape::Shape( const WorksheetHelper& rHelper, const AttributeList& rAttribs, 
const char* pcServiceName ) :
-    ::oox::drawingml::Shape( pcServiceName ),
+Shape::Shape( const WorksheetHelper& rHelper, const AttributeList& rAttribs, 
const OUString& rServiceName ) :
+    ::oox::drawingml::Shape( rServiceName ),
     WorksheetHelper( rHelper )
 {
     OUString aMacro = rAttribs.getXString( XML_macro, OUString() );
@@ -134,32 +134,32 @@ GroupShapeContext::GroupShapeContext( const 
FragmentHandler2& rParent,
     {
         case XDR_TOKEN( sp ):
         {
-            ShapePtr xShape = std::make_shared<Shape>( rHelper, rAttribs, 
"com.sun.star.drawing.CustomShape" );
+            ShapePtr xShape = std::make_shared<Shape>( rHelper, rAttribs, 
u"com.sun.star.drawing.CustomShape"_ustr );
             if( pxShape ) *pxShape = xShape;
             return new ShapeContext( rParent, rxParentShape, xShape );
         }
         case XDR_TOKEN( cxnSp ):
         {
-            ShapePtr xShape = std::make_shared<Shape>( rHelper, rAttribs, 
"com.sun.star.drawing.ConnectorShape" );
+            ShapePtr xShape = std::make_shared<Shape>( rHelper, rAttribs, 
u"com.sun.star.drawing.ConnectorShape"_ustr );
             if( pxShape ) *pxShape = xShape;
             return new ConnectorShapeContext(rParent, rxParentShape, xShape,
                                              
xShape->getConnectorShapeProperties());
         }
         case XDR_TOKEN( pic ):
         {
-            ShapePtr xShape = std::make_shared<Shape>( rHelper, rAttribs, 
"com.sun.star.drawing.GraphicObjectShape" );
+            ShapePtr xShape = std::make_shared<Shape>( rHelper, rAttribs, 
u"com.sun.star.drawing.GraphicObjectShape"_ustr );
             if( pxShape ) *pxShape = xShape;
             return new GraphicShapeContext( rParent, rxParentShape, xShape );
         }
         case XDR_TOKEN( graphicFrame ):
         {
-            ShapePtr xShape = std::make_shared<Shape>( rHelper, rAttribs, 
"com.sun.star.drawing.GraphicObjectShape" );
+            ShapePtr xShape = std::make_shared<Shape>( rHelper, rAttribs, 
u"com.sun.star.drawing.GraphicObjectShape"_ustr );
             if( pxShape ) *pxShape = xShape;
             return new GraphicalObjectFrameContext( rParent, rxParentShape, 
xShape, rHelper.getSheetType() != WorksheetType::Chart );
         }
         case XDR_TOKEN( grpSp ):
         {
-            ShapePtr xShape = std::make_shared<Shape>( rHelper, rAttribs, 
"com.sun.star.drawing.GroupShape" );
+            ShapePtr xShape = std::make_shared<Shape>( rHelper, rAttribs, 
u"com.sun.star.drawing.GroupShape"_ustr );
             if( pxShape ) *pxShape = xShape;
             return new GroupShapeContext( rParent, rHelper, rxParentShape, 
xShape );
         }

Reply via email to