[Libreoffice-commits] core.git: sd/source

Kohei Yoshida kohei.yoshida at collabora.com
Tue Sep 10 11:35:53 PDT 2013


 sd/source/core/sdpage.cxx |   41 +++++++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 16 deletions(-)

New commits:
commit 6eb71f711e84cd285fe997bebdb5896f7e16b33f
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Sep 10 14:36:13 2013 -0400

    We can use plain char array for these, only to avoid C++11 construct.
    
    Hopefully this will keep our tinderboxes happy.
    
    Change-Id: I3f7d398407fea2da858a1567c264f4c9bc35ff7b

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index bd806ee..6e21aef 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -850,16 +850,23 @@ void SdPage::CreateTitleAndLayout(sal_Bool bInit, sal_Bool bCreate )
     }
 }
 
-static const std::vector<rtl::OUString> PageKindVector = {"PK_STANDARD","PK_NOTES" , "PK_HANDOUT"};
-static const std::vector<rtl::OUString> PresObjKindVector = {"PRESOBJ_NONE", "PRESOBJ_TITLE", "PRESOBJ_OUTLINE",
-                                                             "PRESOBJ_TEXT" ,"PRESOBJ_GRAPHIC" , "PRESOBJ_OBJECT",
-                                                             "PRESOBJ_CHART", "PRESOBJ_ORGCHART", "PRESOBJ_TABLE",
-                                                             "PRESOBJ_IMAGE", "PRESOBJ_PAGE", "PRESOBJ_HANDOUT",
-                                                             "PRESOBJ_NOTES","PRESOBJ_HEADER", "PRESOBJ_FOOTER",
-                                                             "PRESOBJ_DATETIME", "PRESOBJ_SLIDENUMBER", "PRESOBJ_CALC",
-                                                             "PRESOBJ_MEDIA", "PRESOBJ_MAX" };
-
-void getPresObjProp( SdPage rPage, const rtl::OUString& sObjKind, const rtl::OUString& sPageKind, double presObjPropValue[])
+namespace {
+
+const char* PageKindVector[] = {
+    "PK_STANDARD","PK_NOTES" , "PK_HANDOUT"
+};
+
+const char* PresObjKindVector[] = {
+    "PRESOBJ_NONE", "PRESOBJ_TITLE", "PRESOBJ_OUTLINE",
+    "PRESOBJ_TEXT" ,"PRESOBJ_GRAPHIC" , "PRESOBJ_OBJECT",
+    "PRESOBJ_CHART", "PRESOBJ_ORGCHART", "PRESOBJ_TABLE",
+    "PRESOBJ_IMAGE", "PRESOBJ_PAGE", "PRESOBJ_HANDOUT",
+    "PRESOBJ_NOTES","PRESOBJ_HEADER", "PRESOBJ_FOOTER",
+    "PRESOBJ_DATETIME", "PRESOBJ_SLIDENUMBER", "PRESOBJ_CALC",
+    "PRESOBJ_MEDIA", "PRESOBJ_MAX"
+};
+
+void getPresObjProp( SdPage rPage, const char* sObjKind, const char* sPageKind, double presObjPropValue[] )
 {
     bool bNoObjectFound = true;  //used to break from outer loop
 
@@ -873,7 +880,7 @@ void getPresObjProp( SdPage rPage, const rtl::OUString& sObjKind, const rtl::OUS
             Reference<XNode> objectattr = objectattrlist->getNamedItem("type");
             rtl::OUString sObjType = objectattr->getNodeValue();
 
-            if(sObjType == sObjKind)
+            if (sObjType.equalsAscii(sObjKind))
             {
                 Reference<XNodeList> objectChildren = objectNode->getChildNodes();
                 const int objSize = objectChildren->getLength();
@@ -890,7 +897,7 @@ void getPresObjProp( SdPage rPage, const rtl::OUString& sObjKind, const rtl::OUS
                         Reference<XNode> ObjPageKind = ObjAttributes->getNamedItem("pagekind");
                         rtl::OUString sObjPageKind = ObjPageKind->getNodeValue();
 
-                        if(sObjPageKind == sPageKind)
+                        if (sObjPageKind.equalsAscii(sPageKind))
                         {
                             Reference<XNode> ObjSizeHeight = ObjAttributes->getNamedItem("relative-height");
                             rtl::OUString sValue = ObjSizeHeight->getNodeValue();
@@ -920,6 +927,8 @@ void getPresObjProp( SdPage rPage, const rtl::OUString& sObjKind, const rtl::OUS
     }
 }
 
+}
+
 SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
 {
     double propvalue[] = {0,0,0,0};
@@ -941,8 +950,8 @@ SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
     }
     else if( (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_DATETIME) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_HEADER ) )
     {
-        rtl::OUString sObjKind = PresObjKindVector[eObjKind];
-        rtl::OUString sPageKind = PageKindVector[mePageKind];
+        const char* sObjKind = PresObjKindVector[eObjKind];
+        const char* sPageKind = PageKindVector[mePageKind];
         // create footer objects for standard master page
         if( mePageKind == PK_STANDARD )
         {
@@ -1026,7 +1035,7 @@ Rectangle SdPage::GetTitleRect() const
         Size aTitleSize ( GetSize() );
         aTitleSize.Width()  -= GetLftBorder() + GetRgtBorder();
         aTitleSize.Height() -= GetUppBorder() + GetLwrBorder();
-        rtl::OUString sPageKind = PageKindVector[mePageKind];
+        const char* sPageKind = PageKindVector[mePageKind];
 
         if (mePageKind == PK_STANDARD)
          {
@@ -1107,7 +1116,7 @@ Rectangle SdPage::GetLayoutRect() const
         Size aLayoutSize ( GetSize() );
         aLayoutSize.Width()  -= GetLftBorder() + GetRgtBorder();
         aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder();
-        rtl::OUString sPageKind = PageKindVector[mePageKind];
+        const char* sPageKind = PageKindVector[mePageKind];
 
         if (mePageKind == PK_STANDARD)
         {


More information about the Libreoffice-commits mailing list