[Libreoffice-commits] .: 2 commits - oox/source sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 7 07:58:11 PST 2012


 oox/source/drawingml/customshapeproperties.cxx  |    7 +++----
 oox/source/drawingml/shapepropertiescontext.cxx |    6 ++----
 oox/source/drawingml/table/tablecell.cxx        |   16 +++++-----------
 oox/source/drawingml/table/tableproperties.cxx  |    4 ++--
 oox/source/ppt/presentationfragmenthandler.cxx  |   19 ++++++-------------
 oox/source/vml/vmlformatting.cxx                |    3 +--
 sw/source/core/doc/poolfmt.cxx                  |    8 +++++---
 7 files changed, 24 insertions(+), 39 deletions(-)

New commits:
commit 8f45d08f5b918598f1dbeba41ad185edfc446968
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 7 15:56:17 2012 +0000

    fix bogus warning about invalid pool ids
    
    Basically theres a missing else.
    
    make it tell me what it's complaining about while I'm at it
    
    Change-Id: I4f32f483e3826066aed4c31a3355c193525f3c5c

diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 2820663..5321944 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -1367,11 +1367,11 @@ bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId ) const
     sal_uInt16 nArrCnt = 1;
     bool bFnd = true;
 
-    if( RES_POOLCHR_BEGIN <= nId && nId < RES_POOLCHR_END )
+    if (RES_POOLCHR_BEGIN <= nId && nId < RES_POOLCHR_END)
     {
         pArray[0] = pCharFmtTbl;
     }
-    if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
+    else if (RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END)
     {
         pArray[0] = pFrmFmtTbl;
         pArray[1] = pSpzFrmFmtTbl;
@@ -1379,7 +1379,9 @@ bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId ) const
     }
     else
     {
-        OSL_FAIL( "invalid Id" );
+        SAL_WARN("sw.core", "Invalid Pool Id: " << nId << " should be within " <<
+            "[" << int(RES_POOLCHR_BEGIN) << "," << int(RES_POOLCHR_END) << ") or " <<
+            "[" << int(RES_POOLFRM_BEGIN) << "," << int(RES_POOLFRM_END) << ")");
         bFnd = false;
     }
 
commit 74ca0e86063f698c8d36d935cd2b791c6b2874b4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 7 13:27:42 2012 +0000

    drop some static OUStrings
    
    Change-Id: I41d5df892d8b710b82ed886b2390b53535b8a67b

diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index 8f313a0..ea5dc1f 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -98,10 +98,9 @@ static OUString GetConnectorShapeType( sal_Int32 nType )
     OUString sType;
     switch( nType )
     {
-        case XML_straightConnector1: {
-            static const OUString sStraightConnector1 = CREATE_OUSTRING( "mso-spt32" );
-            sType = sStraightConnector1;
-            } break;
+        case XML_straightConnector1:
+            sType = "mso-spt32";
+            break;
         default:
             break;
     }
diff --git a/oox/source/drawingml/shapepropertiescontext.cxx b/oox/source/drawingml/shapepropertiescontext.cxx
index a10b8ea..e0fe19f 100644
--- a/oox/source/drawingml/shapepropertiescontext.cxx
+++ b/oox/source/drawingml/shapepropertiescontext.cxx
@@ -75,15 +75,13 @@ Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext(
             // TODO: Move the following checks to a separate place or as a separate function
             if ( nToken == XML_line )
             {
-                static const OUString sLineShape( "com.sun.star.drawing.LineShape" );
-                mrShape.getServiceName() = sLineShape;
+                mrShape.getServiceName() = "com.sun.star.drawing.LineShape";
             }
             if( ( nToken >= XML_bentConnector2 && nToken <= XML_bentConnector5 ) ||
                 ( nToken >= XML_curvedConnector2 && nToken <= XML_curvedConnector5 ) ||
                   nToken == XML_straightConnector1 )
             {
-                static const OUString sCustomShape( "com.sun.star.drawing.CustomShape" );
-                mrShape.getServiceName() = sCustomShape;
+                mrShape.getServiceName() = "com.sun.star.drawing.CustomShape";
             }
             xRet.set( new PresetShapeGeometryContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) );
         }
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index 7394acb..d81f350 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -123,17 +123,11 @@ void applyTableStylePart( oox::drawingml::FillProperties& rFillProperties,
 
 void applyTableCellProperties( const Reference < ::com::sun::star::table::XCell >& rxCell, const TableCell& rTableCell )
 {
-    static const OUString  sTopBorder( RTL_CONSTASCII_USTRINGPARAM( "TextUpperDistance" ) );
-    static const OUString  sBottomBorder( RTL_CONSTASCII_USTRINGPARAM( "TextLowerDistance" ) );
-    static const OUString  sLeftBorder( RTL_CONSTASCII_USTRINGPARAM( "TextLeftDistance" ) );
-    static const OUString  sRightBorder( RTL_CONSTASCII_USTRINGPARAM( "TextRightDistance" ) );
-    static const OUString  sVerticalAdjust( RTL_CONSTASCII_USTRINGPARAM( "TextVerticalAdjust" ) );
-
     Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW );
-    xPropSet->setPropertyValue( sTopBorder, Any( static_cast< sal_Int32 >( rTableCell.getTopMargin() / 360 ) ) );
-    xPropSet->setPropertyValue( sRightBorder, Any( static_cast< sal_Int32 >( rTableCell.getRightMargin() / 360 ) ) );
-    xPropSet->setPropertyValue( sLeftBorder, Any( static_cast< sal_Int32 >( rTableCell.getLeftMargin() / 360 ) ) );
-    xPropSet->setPropertyValue( sBottomBorder, Any( static_cast< sal_Int32 >( rTableCell.getBottomMargin() / 360 ) ) );
+    xPropSet->setPropertyValue( "TextUpperDistance", Any( static_cast< sal_Int32 >( rTableCell.getTopMargin() / 360 ) ) );
+    xPropSet->setPropertyValue( "TextRightDistance", Any( static_cast< sal_Int32 >( rTableCell.getRightMargin() / 360 ) ) );
+    xPropSet->setPropertyValue( "TextLeftDistance", Any( static_cast< sal_Int32 >( rTableCell.getLeftMargin() / 360 ) ) );
+    xPropSet->setPropertyValue( "TextLowerDistance", Any( static_cast< sal_Int32 >( rTableCell.getBottomMargin() / 360 ) ) );
 
     drawing::TextVerticalAdjust eVA;
     switch( rTableCell.getAnchorToken() )
@@ -145,7 +139,7 @@ void applyTableCellProperties( const Reference < ::com::sun::star::table::XCell
         default:
         case XML_t:     eVA = drawing::TextVerticalAdjust_TOP; break;
     }
-    xPropSet->setPropertyValue( sVerticalAdjust, Any( eVA ) );
+    xPropSet->setPropertyValue( "TextVerticalAdjust", Any( eVA ) );
 }
 
 void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oox::drawingml::TextListStylePtr pMasterTextListStyle,
diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index d480cc6..e9d7e5e 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -58,9 +58,9 @@ void CreateTableRows( uno::Reference< XTableRows > xTableRows, const std::vector
         xTableRows->insertByIndex( 0, rvTableRows.size() - 1 );
     std::vector< TableRow >::const_iterator aTableRowIter( rvTableRows.begin() );
     uno::Reference< container::XIndexAccess > xIndexAccess( xTableRows, UNO_QUERY_THROW );
+    const OUString sHeight("Height");
     for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ )
     {
-        static const OUString  sHeight("Height");
         Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW );
         xPropSet->setPropertyValue( sHeight, Any( static_cast< sal_Int32 >( aTableRowIter->getHeight() / 360 ) ) );
         ++aTableRowIter;
@@ -73,9 +73,9 @@ void CreateTableColumns( Reference< XTableColumns > xTableColumns, const std::ve
         xTableColumns->insertByIndex( 0, rvTableGrid.size() - 1 );
     std::vector< sal_Int32 >::const_iterator aTableGridIter( rvTableGrid.begin() );
     uno::Reference< container::XIndexAccess > xIndexAccess( xTableColumns, UNO_QUERY_THROW );
+    const OUString sWidth("Width");
     for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ )
     {
-        static const OUString  sWidth("Width");
         Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW );
         xPropSet->setPropertyValue( sWidth, Any( static_cast< sal_Int32 >( *aTableGridIter++ / 360 ) ) );
     }
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index 4ae067c..c92cdad 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -353,27 +353,20 @@ bool PresentationFragmentHandler::importSlide( const FragmentHandlerRef& rxSlide
     Reference< XPropertySet > xPropertySet( xSlide, UNO_QUERY );
     if ( xPropertySet.is() )
     {
-        static const OUString sWidth = CREATE_OUSTRING( "Width" );
-        static const OUString sHeight = CREATE_OUSTRING( "Height" );
         awt::Size& rPageSize( pSlidePersistPtr->isNotesPage() ? maNotesSize : maSlideSize );
-        xPropertySet->setPropertyValue( sWidth, Any( rPageSize.Width ) );
-        xPropertySet->setPropertyValue( sHeight, Any( rPageSize.Height ) );
+        xPropertySet->setPropertyValue( "Width", Any( rPageSize.Width ) );
+        xPropertySet->setPropertyValue( "Height", Any( rPageSize.Height ) );
 
         oox::ppt::HeaderFooter aHeaderFooter( pSlidePersistPtr->getHeaderFooter() );
         if ( !pSlidePersistPtr->isMasterPage() )
             aHeaderFooter.mbSlideNumber = aHeaderFooter.mbHeader = aHeaderFooter.mbFooter = aHeaderFooter.mbDateTime = sal_False;
         try
         {
-            static const OUString sIsHeaderVisible = CREATE_OUSTRING( "IsHeaderVisible" );
-            static const OUString sIsFooterVisible = CREATE_OUSTRING( "IsFooterVisible" );
-            static const OUString sIsDateTimeVisible = CREATE_OUSTRING( "IsDateTimeVisible" );
-            static const OUString sIsPageNumberVisible = CREATE_OUSTRING( "IsPageNumberVisible" );
-
             if ( pSlidePersistPtr->isNotesPage() )
-                xPropertySet->setPropertyValue( sIsHeaderVisible, Any( aHeaderFooter.mbHeader ) );
-            xPropertySet->setPropertyValue( sIsFooterVisible, Any( aHeaderFooter.mbFooter ) );
-            xPropertySet->setPropertyValue( sIsDateTimeVisible, Any( aHeaderFooter.mbDateTime ) );
-            xPropertySet->setPropertyValue( sIsPageNumberVisible, Any( aHeaderFooter.mbSlideNumber ) );
+                xPropertySet->setPropertyValue( "sIsHeaderVisible", Any( aHeaderFooter.mbHeader ) );
+            xPropertySet->setPropertyValue( "IsFooterVisible", Any( aHeaderFooter.mbFooter ) );
+            xPropertySet->setPropertyValue( "IsDateTimeVisible", Any( aHeaderFooter.mbDateTime ) );
+            xPropertySet->setPropertyValue( "IsPageNumberVisible", Any( aHeaderFooter.mbSlideNumber ) );
         }
         catch( uno::Exception& )
         {
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index ed6355b..528cc06 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -129,12 +129,11 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r
         return 0;
 
     // process trailing unit, convert to EMU
-    static const OUString saPx = CREATE_OUSTRING( "px" );
     OUString aUnit;
     if( (0 < nEndPos) && (nEndPos < rValue.getLength()) )
         aUnit = rValue.copy( nEndPos );
     else if( bDefaultAsPixel )
-        aUnit = saPx;
+        aUnit = "px";
     // else default is EMU
 
     if( aUnit.getLength() == 2 )


More information about the Libreoffice-commits mailing list