[Libreoffice-commits] core.git: basctl/source include/vcl sc/source sd/source starmath/source sw/source vcl/source

Noel Grandin noelgrandin at gmail.com
Sat Jan 30 23:10:19 PST 2016


 basctl/source/basicide/basicrenderable.cxx |    2 +-
 include/vcl/print.hxx                      |   12 ++++++------
 sc/source/ui/unoobj/docuno.cxx             |    4 ++--
 sd/source/ui/view/DocumentRenderer.cxx     |   13 +++----------
 starmath/source/unomodel.cxx               |    2 +-
 sw/source/core/view/printdata.cxx          |    4 ++--
 vcl/source/gdi/print3.cxx                  |   21 +++++++++++----------
 7 files changed, 26 insertions(+), 32 deletions(-)

New commits:
commit 83b9c51803b3acef078892e4f233339e57dd53e7
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Thu Jan 28 20:56:22 2016 +0200

    sequence->vector in PrinterOptionsHelper
    
    Change-Id: I643519397a4e714e3407ec0c3a10d329654b9f7d
    Reviewed-on: https://gerrit.libreoffice.org/21887
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx
index 93f1acd..86afd20 100644
--- a/basctl/source/basicide/basicrenderable.cxx
+++ b/basctl/source/basicide/basicrenderable.cxx
@@ -42,7 +42,7 @@ Renderable::Renderable (BaseWindow* pWin)
     if( aStrings.Count() < 3 ) // bad resource ?
         return;
 
-    m_aUIProperties.realloc( 3 );
+    m_aUIProperties.resize( 3 );
 
     // show Subgroup for print range
     vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index f483ead..ded112c 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -596,17 +596,17 @@ public:
 
 class VCL_DLLPUBLIC PrinterOptionsHelper
 {
-    protected:
+protected:
     std::unordered_map< OUString, css::uno::Any, OUStringHash >
                          m_aPropertyMap;
-    css::uno::Sequence< css::beans::PropertyValue >
+    std::vector< css::beans::PropertyValue >
                          m_aUIProperties;
 
-    public:
+public:
 
                          /// Create without ui properties
                          PrinterOptionsHelper() {}
-                         PrinterOptionsHelper( const css::uno::Sequence< css::beans::PropertyValue >& i_rUIProperties )
+                         PrinterOptionsHelper( const std::vector< css::beans::PropertyValue >& i_rUIProperties )
                              : m_aUIProperties( i_rUIProperties )  {}
                          ~PrinterOptionsHelper() {}
 
@@ -618,7 +618,7 @@ class VCL_DLLPUBLIC PrinterOptionsHelper
     bool                 processProperties( const css::uno::Sequence< css::beans::PropertyValue >& i_rNewProp,
                              std::set< OUString >* o_pChangeProp = nullptr );
 
-    /** Append  to a sequence of property values the ui property sequence passed at creation
+    /** Append to a sequence of property values the ui property sequence passed at creation
 
         as the "ExtraPrintUIOptions" property. if that sequence was empty, no "ExtraPrintUIOptions" property
         will be appended.
@@ -652,7 +652,7 @@ class VCL_DLLPUBLIC PrinterOptionsHelper
         OUString         maGroupHint;
         bool             mbInternalOnly;
         bool             mbEnabled;
-        css::uno::Sequence< css::beans::PropertyValue >
+        std::vector< css::beans::PropertyValue >
                          maAddProps;
 
                          UIControlOptions( const OUString& i_rDependsOnName = OUString(),
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index d250fbd..4993f18 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -244,7 +244,7 @@ ScPrintUIOptions::ScPrintUIOptions()
 
     sal_Int32 nNumProps= 9, nIdx = 0;
 
-    m_aUIProperties.realloc(nNumProps);
+    m_aUIProperties.resize(nNumProps);
 
     // load the writer PrinterOptions into the custom tab
     m_aUIProperties[nIdx].Name = "OptionsUIFile";
@@ -326,7 +326,7 @@ void ScPrintUIOptions::SetDefaults()
     sal_Int32 nContent = rPrintOpt.GetAllSheets() ? 0 : 1;
     bool bSuppress = rPrintOpt.GetSkipEmpty();
 
-    for (sal_Int32 nUIPos=0; nUIPos<m_aUIProperties.getLength(); ++nUIPos)
+    for (size_t nUIPos=0; nUIPos<m_aUIProperties.size(); ++nUIPos)
     {
         uno::Sequence<beans::PropertyValue> aUIProp;
         if ( m_aUIProperties[nUIPos].Value >>= aUIProp )
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index b30ddb7..4686f3e 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -344,16 +344,9 @@ namespace {
             ProcessResource();
         }
 
-        Sequence< beans::PropertyValue > GetDialogControls() const
+        const std::vector< beans::PropertyValue >& GetDialogControls() const
         {
-            if (maProperties.empty())
-                return Sequence< beans::PropertyValue >();
-            else
-            {
-                return Sequence<beans::PropertyValue>(
-                        &maProperties.front(),
-                        maProperties.size());
-            }
+            return maProperties;
         }
 
         std::vector<sal_Int32> GetSlidesPerPage() const
@@ -1258,7 +1251,7 @@ public:
         css::uno::Sequence<css::beans::PropertyValue> aProperties (3);
 
         aProperties[0].Name = "ExtraPrintUIOptions";
-        aProperties[0].Value <<= m_aUIProperties;
+        aProperties[0].Value <<= comphelper::containerToSequence(m_aUIProperties);
 
         aProperties[1].Name = "PageSize";
         aProperties[1].Value <<= maPrintSize;
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index c2b6eaf..ecb74a6 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -75,7 +75,7 @@ SmPrintUIOptions::SmPrintUIOptions()
 
     // create sequence of print UI options
     // (Actually IsIgnoreSpacesRight is a parser option. Without it we need only 8 properties here.)
-    m_aUIProperties.realloc( nNumProps );
+    m_aUIProperties.resize( nNumProps );
 
     // load the math PrinterOptions into the custom tab
     m_aUIProperties[nIdx].Name = "OptionsUIFile";
diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx
index 14727d4..7ed8ae3 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -163,7 +163,7 @@ SwPrintUIOptions::SwPrintUIOptions(
     // Its just the source code that gets printed ...
     if (bSwSrcView)
     {
-        m_aUIProperties.realloc( 0 );
+        m_aUIProperties.clear();
         return;
     }
 
@@ -175,7 +175,7 @@ SwPrintUIOptions::SwPrintUIOptions(
     // (5 options are not available for Writer-Web)
     const int nCTLOpts = bCTL ? 1 : 0;
     const int nNumProps = nCTLOpts + (bWeb ? 15 : 21);
-    m_aUIProperties.realloc( nNumProps );
+    m_aUIProperties.resize( nNumProps );
     int nIdx = 0;
 
     // load the writer PrinterOptions into the custom tab
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 2310eb2..279ac5d 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -25,6 +25,7 @@
 #include <vcl/unohelp.hxx>
 #include <tools/urlobj.hxx>
 #include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
 #include <sal/types.h>
 
 #include "printdlg.hxx"
@@ -1824,13 +1825,13 @@ bool PrinterOptionsHelper::processProperties( const css::uno::Sequence< css::bea
 
 void PrinterOptionsHelper::appendPrintUIOptions( css::uno::Sequence< css::beans::PropertyValue >& io_rProps ) const
 {
-    if( m_aUIProperties.getLength() > 0 )
+    if( !m_aUIProperties.empty() )
     {
         sal_Int32 nIndex = io_rProps.getLength();
         io_rProps.realloc( nIndex+1 );
         css::beans::PropertyValue aVal;
         aVal.Name = "ExtraPrintUIOptions";
-        aVal.Value = css::uno::makeAny( m_aUIProperties );
+        aVal.Value = css::uno::makeAny( comphelper::containerToSequence(m_aUIProperties) );
         io_rProps[ nIndex ] = aVal;
     }
 }
@@ -1847,7 +1848,7 @@ css::uno::Any PrinterOptionsHelper::setUIControlOpt(const css::uno::Sequence< OU
         + (i_rTitle.isEmpty() ? 0 : 1)                                // Text
         + (i_rHelpIds.getLength() ? 1 : 0)                            // HelpId
         + (i_pVal ? 1 : 0)                                            // Property
-        + i_rControlOptions.maAddProps.getLength()                    // additional props
+        + i_rControlOptions.maAddProps.size()                         // additional props
         + (i_rControlOptions.maGroupHint.isEmpty() ? 0 : 1)           // grouping
         + (i_rControlOptions.mbInternalOnly ? 1 : 0)                  // internal hint
         + (i_rControlOptions.mbEnabled ? 0 : 1)                       // enabled
@@ -1913,7 +1914,7 @@ css::uno::Any PrinterOptionsHelper::setUIControlOpt(const css::uno::Sequence< OU
         aCtrl[nUsed++].Value <<= sal_False;
     }
 
-    sal_Int32 nAddProps = i_rControlOptions.maAddProps.getLength();
+    sal_Int32 nAddProps = i_rControlOptions.maAddProps.size();
     for( sal_Int32 i = 0; i < nAddProps; i++ )
         aCtrl[ nUsed++ ] = i_rControlOptions.maAddProps[i];
 
@@ -1981,8 +1982,8 @@ css::uno::Any PrinterOptionsHelper::setChoiceRadiosControlOpt(const css::uno::Se
                                               const PrinterOptionsHelper::UIControlOptions& i_rControlOptions)
 {
     UIControlOptions aOpt( i_rControlOptions );
-    sal_Int32 nUsed = aOpt.maAddProps.getLength();
-    aOpt.maAddProps.realloc( nUsed + 1 + (i_rDisabledChoices.getLength() ? 1 : 0) );
+    sal_Int32 nUsed = aOpt.maAddProps.size();
+    aOpt.maAddProps.resize( nUsed + 1 + (i_rDisabledChoices.getLength() ? 1 : 0) );
     aOpt.maAddProps[nUsed].Name = "Choices";
     aOpt.maAddProps[nUsed].Value = css::uno::makeAny( i_rChoices );
     if( i_rDisabledChoices.getLength() )
@@ -2007,8 +2008,8 @@ css::uno::Any PrinterOptionsHelper::setChoiceListControlOpt(const OUString& i_rI
                                               const PrinterOptionsHelper::UIControlOptions& i_rControlOptions)
 {
     UIControlOptions aOpt( i_rControlOptions );
-    sal_Int32 nUsed = aOpt.maAddProps.getLength();
-    aOpt.maAddProps.realloc( nUsed + 1 + (i_rDisabledChoices.getLength() ? 1 : 0) );
+    sal_Int32 nUsed = aOpt.maAddProps.size();
+    aOpt.maAddProps.resize( nUsed + 1 + (i_rDisabledChoices.getLength() ? 1 : 0) );
     aOpt.maAddProps[nUsed].Name = "Choices";
     aOpt.maAddProps[nUsed].Value = css::uno::makeAny( i_rChoices );
     if( i_rDisabledChoices.getLength() )
@@ -2036,8 +2037,8 @@ css::uno::Any PrinterOptionsHelper::setRangeControlOpt(const OUString& i_rID,
     UIControlOptions aOpt( i_rControlOptions );
     if( i_nMaxValue >= i_nMinValue )
     {
-        sal_Int32 nUsed = aOpt.maAddProps.getLength();
-        aOpt.maAddProps.realloc( nUsed + 2 );
+        sal_Int32 nUsed = aOpt.maAddProps.size();
+        aOpt.maAddProps.resize( nUsed + 2 );
         aOpt.maAddProps[nUsed  ].Name  = "MinValue";
         aOpt.maAddProps[nUsed++].Value = css::uno::makeAny( i_nMinValue );
         aOpt.maAddProps[nUsed  ].Name  = "MaxValue";


More information about the Libreoffice-commits mailing list