diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-01-28 20:56:22 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-01-31 07:09:41 +0000 |
commit | 83b9c51803b3acef078892e4f233339e57dd53e7 (patch) | |
tree | aac70e9e1519463d82ef2a95876db7a36268fa12 | |
parent | 3187193a6142b4b1c974ae1e1de572fa74a3c8ee (diff) |
sequence->vector in PrinterOptionsHelper
Change-Id: I643519397a4e714e3407ec0c3a10d329654b9f7d
Reviewed-on: https://gerrit.libreoffice.org/21887
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | basctl/source/basicide/basicrenderable.cxx | 2 | ||||
-rw-r--r-- | include/vcl/print.hxx | 12 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/DocumentRenderer.cxx | 13 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/view/printdata.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 21 |
7 files changed, 26 insertions, 32 deletions
diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx index 93f1acd5990d..86afd2003fcf 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 f483ead2d50d..ded112ccc475 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 d250fbd8c2dd..4993f185d117 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 b30ddb7da52a..4686f3e1a320 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 c2b6eaf4eaf6..ecb74a617e96 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 14727d42e09a..7ed8ae31d016 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 2310eb2f88b3..279ac5d885cc 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"; |