diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-08 10:47:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-08 10:44:29 +0100 |
commit | b8fe96f1da2c42c04a8094ca8c57d49763b7bded (patch) | |
tree | d2b1852c89f1776ef8ee25bbb99c6bd74a1ae984 | |
parent | 7960ccb41db49a7883afa036b820a7b7ffcb4a89 (diff) |
loplugin:constantparam in desktop..i18npool
Change-Id: Ie2e1004c1ccc03777a8da9cb1144e89eb28ff313
Reviewed-on: https://gerrit.libreoffice.org/50928
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | desktop/source/deployment/registry/dp_registry.cxx | 15 | ||||
-rw-r--r-- | drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx | 21 | ||||
-rw-r--r-- | editeng/inc/editdoc.hxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 7 | ||||
-rw-r--r-- | editeng/source/items/numitem.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/eformspropertyhandler.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.cxx | 20 | ||||
-rw-r--r-- | extensions/source/propctrlr/formgeometryhandler.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/handlerhelper.cxx | 14 | ||||
-rw-r--r-- | extensions/source/propctrlr/handlerhelper.hxx | 17 | ||||
-rw-r--r-- | extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx | 2 | ||||
-rw-r--r-- | framework/source/accelerators/acceleratorconfiguration.cxx | 8 | ||||
-rw-r--r-- | framework/source/accelerators/storageholder.cxx | 49 | ||||
-rw-r--r-- | framework/source/inc/accelerators/storageholder.hxx | 14 | ||||
-rw-r--r-- | i18npool/source/nativenumber/nativenumbersupplier.cxx | 36 |
15 files changed, 68 insertions, 143 deletions
diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index 83cd03179119..9d12da270d24 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -103,7 +103,7 @@ protected: public: static Reference<deployment::XPackageRegistry> create( OUString const & context, - OUString const & cachePath, bool readOnly, + OUString const & cachePath, Reference<XComponentContext> const & xComponentContext ); // XUpdatable @@ -273,7 +273,7 @@ void PackageRegistryImpl::insertBackend( Reference<deployment::XPackageRegistry> PackageRegistryImpl::create( OUString const & context, - OUString const & cachePath, bool readOnly, + OUString const & cachePath, Reference<XComponentContext> const & xComponentContext ) { PackageRegistryImpl * that = new PackageRegistryImpl; @@ -304,10 +304,9 @@ Reference<deployment::XPackageRegistry> PackageRegistryImpl::create( rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ) ) ); registryArgs[ 1 ] <<= registryCachePath; - registryArgs[ 2 ] <<= readOnly; - if (! readOnly) - create_folder( nullptr, registryCachePath, - Reference<XCommandEnvironment>() ); + registryArgs[ 2 ] <<= false; // readOnly; + create_folder( nullptr, registryCachePath, + Reference<XCommandEnvironment>() ); } Reference<deployment::XPackageRegistry> xBackend; @@ -342,7 +341,7 @@ Reference<deployment::XPackageRegistry> PackageRegistryImpl::create( // backends. Reference<deployment::XPackageRegistry> extensionBackend = ::dp_registry::backend::bundle::create( - that, context, cachePath, readOnly, xComponentContext); + that, context, cachePath, /*readOnly*/false, xComponentContext); that->insertBackend(extensionBackend); Reference<lang::XServiceInfo> xServiceInfo( @@ -525,7 +524,7 @@ Reference<deployment::XPackageRegistry> create( Reference<XComponentContext> const & xComponentContext ) { return PackageRegistryImpl::create( - context, cachePath, false/*readOnly*/, xComponentContext ); + context, cachePath, xComponentContext ); } } // namespace dp_registry diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx index 612dd4254802..9876cac985fb 100644 --- a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx @@ -204,8 +204,7 @@ namespace void impCreateInBetweenNormals( basegfx::B3DPolyPolygon& rPolA, - basegfx::B3DPolyPolygon& rPolB, - bool bSmoothHorizontalNormals) + basegfx::B3DPolyPolygon& rPolB) { OSL_ENSURE(rPolA.count() == rPolB.count(), "sdrExtrudePrimitive3D: unequally sized polygons (!)"); const sal_uInt32 nPolygonCount(std::min(rPolA.count(), rPolB.count())); @@ -249,7 +248,7 @@ namespace // create left normal const basegfx::B3DVector aNormalLeft(aDepth.getPerpendicular(aLeft)); - if(bSmoothHorizontalNormals) + // smooth horizontal normals { // vector to right (correct for non-closed lines) const bool bLastAndNotClosed(!bClosed && b + 1 == nPointCount); @@ -267,12 +266,6 @@ namespace aSubA.setNormal(b, aNewNormal); aSubB.setNormal(b, aNewNormal); } - else - { - // set aNormalLeft as new normal at polygons - aSubA.setNormal(b, aNormalLeft); - aSubB.setNormal(b, aNormalLeft); - } // prepare next step aPrevA = aCurrA; @@ -646,7 +639,7 @@ namespace drawinglayer { if(bCreateNormals) { - impCreateInBetweenNormals(aPolB, aPolA, true/*bSmoothHorizontalNormals*/); + impCreateInBetweenNormals(aPolB, aPolA); } { @@ -678,7 +671,7 @@ namespace drawinglayer if(bHasSlant) { - impCreateInBetweenNormals(aPolAA, aPrev, true/*bSmoothHorizontalNormals*/); + impCreateInBetweenNormals(aPolAA, aPrev); if(bSmoothNormals) { @@ -741,7 +734,7 @@ namespace drawinglayer { if(bCreateNormals && bSmoothNormals && (nIndPrev != a + 1)) { - impCreateInBetweenNormals(aPolAA, aPrev, true/*bSmoothHorizontalNormals*/); + impCreateInBetweenNormals(aPolAA, aPrev); impMixNormals(aPolA, aPolAA, 0.5); } } @@ -770,7 +763,7 @@ namespace drawinglayer if(bHasSlant) { - impCreateInBetweenNormals(aNext, aPolBB, true/*bSmoothHorizontalNormals*/); + impCreateInBetweenNormals(aNext, aPolBB); if(bSmoothNormals) { @@ -832,7 +825,7 @@ namespace drawinglayer { if(bCreateNormals && bSmoothNormals && (nIndNext != a)) { - impCreateInBetweenNormals(aNext, aPolBB, true/*bSmoothHorizontalNormals*/); + impCreateInBetweenNormals(aNext, aPolBB); impMixNormals(aPolB, aPolBB, 0.5); } } diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index e833d8b005ce..755e642e345d 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -289,7 +289,7 @@ public: /// return length including expanded fields sal_uLong GetExpandedLen() const; /// return content including expanded fields - OUString GetExpandedText(sal_Int32 nStartPos = 0, sal_Int32 nEndPos = -1, bool bResolveFields = true) const; + OUString GetExpandedText(sal_Int32 nStartPos = 0, sal_Int32 nEndPos = -1) const; /// re-write offsets in the expanded text to string offsets void UnExpandPositions( sal_Int32 &rStartPos, sal_Int32 &rEndPos ); diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 50e16d6ba63b..32b965d7cc6d 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1626,7 +1626,7 @@ sal_uLong ContentNode::GetExpandedLen() const return nLen; } -OUString ContentNode::GetExpandedText(sal_Int32 nStartPos, sal_Int32 nEndPos, bool bResolveFields) const +OUString ContentNode::GetExpandedText(sal_Int32 nStartPos, sal_Int32 nEndPos) const { if ( nEndPos < 0 || nEndPos > Len() ) nEndPos = Len(); @@ -1658,8 +1658,7 @@ OUString ContentNode::GetExpandedText(sal_Int32 nStartPos, sal_Int32 nEndPos, bo case EE_FEATURE_LINEBR: aStr += "\x0A"; break; case EE_FEATURE_FIELD: - if ( bResolveFields ) - aStr += static_cast<const EditCharAttribField*>(pNextFeature)->GetFieldValue(); + aStr += static_cast<const EditCharAttribField*>(pNextFeature)->GetFieldValue(); break; default: OSL_FAIL( "What feature?" ); } @@ -2163,7 +2162,7 @@ OUString EditDoc::GetParaAsString( sal_Int32 nNode ) const OUString EditDoc::GetParaAsString( const ContentNode* pNode, sal_Int32 nStartPos, sal_Int32 nEndPos) { - return pNode->GetExpandedText(nStartPos, nEndPos, true/*bResolveFields*/); + return pNode->GetExpandedText(nStartPos, nEndPos); } EditPaM EditDoc::GetStartPaM() const diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 6b8a322a704c..3eeb00ae3573 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -670,7 +670,7 @@ void SvxNumRule::Store( SvStream &rStream ) if(!pConverter) pConverter = CreateFontToSubsFontConverter(aFmts[i]->GetBulletFont()->GetFamilyName(), - FontToSubsFontFlags::EXPORT|FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS); + FontToSubsFontFlags::EXPORT); } aFmts[i]->Store(rStream, pConverter); } diff --git a/extensions/source/propctrlr/eformspropertyhandler.cxx b/extensions/source/propctrlr/eformspropertyhandler.cxx index 478d0674c930..99eb2076d118 100644 --- a/extensions/source/propctrlr/eformspropertyhandler.cxx +++ b/extensions/source/propctrlr/eformspropertyhandler.cxx @@ -451,7 +451,7 @@ namespace pcr aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, true ); break; case PropertyControlType::ComboBox: - aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, false, true ); + aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, true ); break; default: aDescriptor.Control = _rxControlFactory->createPropertyControl( nControlType, false ); diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index a24eb5cf1868..77123d2c3b51 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -1163,7 +1163,7 @@ namespace pcr Optional< double > aValueNotPresent( false, 0 ); aDescriptor.Control = PropertyHandlerHelper::createNumericControl( - _rxControlFactory, nDigits, aValueNotPresent, aValueNotPresent, false ); + _rxControlFactory, nDigits, aValueNotPresent, aValueNotPresent ); Reference< XNumericControl > xNumericControl( aDescriptor.Control, UNO_QUERY_THROW ); if ( nValueUnit != -1 ) @@ -1187,10 +1187,10 @@ namespace pcr || ( nPropId == PROPERTY_ID_SHOW_FILTERSORT ) ) { - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl(_rxControlFactory, RID_RSC_ENUM_SHOWHIDE, SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE), false, false); + aDescriptor.Control = PropertyHandlerHelper::createListBoxControl(_rxControlFactory, RID_RSC_ENUM_SHOWHIDE, SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE), false); } else - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl(_rxControlFactory, RID_RSC_ENUM_YESNO, SAL_N_ELEMENTS(RID_RSC_ENUM_YESNO), false, false); + aDescriptor.Control = PropertyHandlerHelper::createListBoxControl(_rxControlFactory, RID_RSC_ENUM_YESNO, SAL_N_ELEMENTS(RID_RSC_ENUM_YESNO), false); bNeedDefaultStringIfVoidAllowed = true; } @@ -1232,7 +1232,7 @@ namespace pcr // create the control if ( PROPERTY_ID_TARGET_FRAME == nPropId ) - aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, false, false ); + aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, false ); else { aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, false ); @@ -1272,7 +1272,7 @@ namespace pcr aMinValue.Value = 0; aDescriptor.Control = PropertyHandlerHelper::createNumericControl( - _rxControlFactory, 0, aMinValue, aMaxValue, false ); + _rxControlFactory, 0, aMinValue, aMaxValue ); } break; @@ -1282,7 +1282,7 @@ namespace pcr Optional< double > aMaxValue( true, 20 ); aDescriptor.Control = PropertyHandlerHelper::createNumericControl( - _rxControlFactory, 0, aMinValue, aMaxValue, false ); + _rxControlFactory, 0, aMinValue, aMaxValue ); } break; @@ -1299,7 +1299,7 @@ namespace pcr aListEntries.resize( aDatasources.getLength() ); std::copy( aDatasources.begin(), aDatasources.end(), aListEntries.begin() ); aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( - _rxControlFactory, aListEntries, false, true ); + _rxControlFactory, aListEntries, true ); } break; @@ -1308,7 +1308,7 @@ namespace pcr std::vector< OUString > aFieldNames; impl_initFieldList_nothrow( aFieldNames ); aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( - _rxControlFactory, aFieldNames, false, false ); + _rxControlFactory, aFieldNames, false ); } break; @@ -2406,7 +2406,7 @@ namespace pcr else impl_fillQueryNames_throw( aNames ); } - _out_rProperty.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aNames, false, true ); + _out_rProperty.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aNames, true ); } break; @@ -2516,7 +2516,7 @@ namespace pcr else impl_fillTableNames_throw( aListEntries ); } - _out_rDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, false, false ); + _out_rDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, false ); } break; case ListSourceType_SQL: diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx index 926f5aa12237..28097d3623a6 100644 --- a/extensions/source/propctrlr/formgeometryhandler.cxx +++ b/extensions/source/propctrlr/formgeometryhandler.cxx @@ -459,7 +459,7 @@ namespace pcr Optional< double > aZero( true, 0 ); Optional< double > aValueNotPresent( false, 0 ); aLineDesc.Control = PropertyHandlerHelper::createNumericControl( - _rxControlFactory, 2, bIsSize ? aZero : aValueNotPresent, aValueNotPresent, false ); + _rxControlFactory, 2, bIsSize ? aZero : aValueNotPresent, aValueNotPresent ); Reference< XNumericControl > xNumericControl( aLineDesc.Control, UNO_QUERY_THROW ); xNumericControl->setValueUnit( MeasureUnit::MM_100TH ); diff --git a/extensions/source/propctrlr/handlerhelper.cxx b/extensions/source/propctrlr/handlerhelper.cxx index e89612e75c70..ddebb7de3632 100644 --- a/extensions/source/propctrlr/handlerhelper.cxx +++ b/extensions/source/propctrlr/handlerhelper.cxx @@ -71,7 +71,7 @@ namespace pcr // special handling for booleans (this will become a list) if ( _rProperty.Type.getTypeClass() == TypeClass_BOOLEAN ) { - _out_rDescriptor.Control = createListBoxControl(_rxControlFactory, RID_RSC_ENUM_YESNO, SAL_N_ELEMENTS(RID_RSC_ENUM_YESNO), bReadOnlyControl, false); + _out_rDescriptor.Control = createListBoxControl(_rxControlFactory, RID_RSC_ENUM_YESNO, SAL_N_ELEMENTS(RID_RSC_ENUM_YESNO), bReadOnlyControl); return; } @@ -145,26 +145,26 @@ namespace pcr } Reference< XPropertyControl > PropertyHandlerHelper::createListBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const char** pTransIds, size_t nElements, bool _bReadOnlyControl, bool _bSorted ) + const char** pTransIds, size_t nElements, bool _bReadOnlyControl ) { std::vector<OUString> aInitialListEntries; for (size_t i = 0; i < nElements; ++i) aInitialListEntries.push_back(PcrRes(pTransIds[i])); - return lcl_implCreateListLikeControl(_rxControlFactory, aInitialListEntries, _bReadOnlyControl, _bSorted, true); + return lcl_implCreateListLikeControl(_rxControlFactory, aInitialListEntries, _bReadOnlyControl, /*_bSorted*/false, true); } Reference< XPropertyControl > PropertyHandlerHelper::createComboBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const std::vector< OUString >& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted ) + const std::vector< OUString >& _rInitialListEntries, bool _bSorted ) { - return lcl_implCreateListLikeControl( _rxControlFactory, _rInitialListEntries, _bReadOnlyControl, _bSorted, false ); + return lcl_implCreateListLikeControl( _rxControlFactory, _rInitialListEntries, /*_bReadOnlyControl*/false, _bSorted, false ); } Reference< XPropertyControl > PropertyHandlerHelper::createNumericControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - sal_Int16 _nDigits, const Optional< double >& _rMinValue, const Optional< double >& _rMaxValue, bool _bReadOnlyControl ) + sal_Int16 _nDigits, const Optional< double >& _rMinValue, const Optional< double >& _rMaxValue ) { Reference< XNumericControl > xNumericControl( - _rxControlFactory->createPropertyControl( PropertyControlType::NumericField, _bReadOnlyControl ), + _rxControlFactory->createPropertyControl( PropertyControlType::NumericField, /*_bReadOnlyControl*/false ), UNO_QUERY_THROW ); diff --git a/extensions/source/propctrlr/handlerhelper.hxx b/extensions/source/propctrlr/handlerhelper.hxx index eaf15afbbeb9..63904bf776de 100644 --- a/extensions/source/propctrlr/handlerhelper.hxx +++ b/extensions/source/propctrlr/handlerhelper.hxx @@ -98,7 +98,7 @@ namespace pcr ); /** creates an <member scope="css::inspection">PropertyControlType::ListBox</member>-type control - and fills it with initial values + and fills it with initial values. @param _rxControlFactory A control factory. Must not be <NULL/>. @@ -112,9 +112,6 @@ namespace pcr @param _bReadOnlyControl determines whether the control should be read-only - @param _bSorted - determines whether the list entries should be sorted - @return the newly created control */ @@ -122,8 +119,7 @@ namespace pcr createListBoxControl( const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory, const char** pTransIds, size_t nElements, - bool _bReadOnlyControl, - bool _bSorted + bool _bReadOnlyControl ); /** creates an <member scope="css::inspection">PropertyControlType::ComboBox</member>-type control @@ -135,9 +131,6 @@ namespace pcr @param _rInitialListEntries the initial values of the control - @param _bReadOnlyControl - determines whether the control should be read-only - @param _bSorted determines whether the list entries should be sorted @@ -148,7 +141,6 @@ namespace pcr createComboBoxControl( const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory, const std::vector< OUString >& _rInitialListEntries, - bool _bReadOnlyControl, bool _bSorted ); @@ -166,8 +158,6 @@ namespace pcr @param _rMaxValue maximum value which can be entered in the control (<member scope="css::inspection">XNumericControl::MaxValue</member>) - @param _bReadOnlyControl - determines whether the control should be read-only @return the newly created control @@ -177,8 +167,7 @@ namespace pcr const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory, sal_Int16 _nDigits, const css::beans::Optional< double >& _rMinValue, - const css::beans::Optional< double >& _rMaxValue, - bool _bReadOnlyControl + const css::beans::Optional< double >& _rMaxValue ); /** marks the document passed in our UNO context as modified diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx index 2f5d063ddc4d..ad398327b989 100644 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx +++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx @@ -403,7 +403,7 @@ namespace pcr aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, false ); break; case PropertyControlType::NumericField: - aDescriptor.Control = PropertyHandlerHelper::createNumericControl( _rxControlFactory, 0, aMinValue, aMaxValue, false ); + aDescriptor.Control = PropertyHandlerHelper::createNumericControl( _rxControlFactory, 0, aMinValue, aMaxValue ); break; default: aDescriptor.Control = _rxControlFactory->createPropertyControl( nControlType, false ); diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index 08aa8b548bf3..935d9f399fda 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -279,11 +279,9 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::store() void SAL_CALL XMLBasedAcceleratorConfiguration::storeToStorage(const css::uno::Reference< css::embed::XStorage >& xStorage) { - css::uno::Reference< css::io::XStream > xStream = StorageHolder::openSubStreamWithFallback( - xStorage, - TARGET_CURRENT, - css::embed::ElementModes::READWRITE, - false); // False => no fallback from read/write to readonly! + // no fallback from read/write to readonly! + css::uno::Reference< css::io::XStream > xStream = xStorage->openStreamElement(TARGET_CURRENT, css::embed::ElementModes::READWRITE); + css::uno::Reference< css::io::XOutputStream > xOut; if (xStream.is()) xOut = xStream->getOutputStream(); diff --git a/framework/source/accelerators/storageholder.cxx b/framework/source/accelerators/storageholder.cxx index 0b29d038d1b2..b444fa30da27 100644 --- a/framework/source/accelerators/storageholder.cxx +++ b/framework/source/accelerators/storageholder.cxx @@ -129,7 +129,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openPath(const OUStri try { - xChild = StorageHolder::openSubStorageWithFallback(xParent, sChild, nOpenMode, true); // TODO think about delegating fallback decision to our own caller! + xChild = StorageHolder::openSubStorageWithFallback(xParent, sChild, nOpenMode); // TODO think about delegating fallback decision to our own caller! } catch(const css::uno::RuntimeException&) { throw; } @@ -403,8 +403,7 @@ StorageHolder& StorageHolder::operator=(const StorageHolder& rCopy) css::uno::Reference< css::embed::XStorage > StorageHolder::openSubStorageWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage , const OUString& sSubStorage , - sal_Int32 eOpenMode , - bool bAllowFallback) + sal_Int32 eOpenMode) { // a) try it first with user specified open mode // ignore errors ... but save it for later use! @@ -421,10 +420,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openSubStorageWithFal { exResult = ex; } // b) readonly already tried? => forward last error! - if ( - (!bAllowFallback ) || // fallback allowed ? - ((eOpenMode & css::embed::ElementModes::WRITE) != css::embed::ElementModes::WRITE) // fallback possible ? - ) + if ((eOpenMode & css::embed::ElementModes::WRITE) != css::embed::ElementModes::WRITE) // fallback possible ? throw exResult; // c) try it readonly @@ -440,45 +436,6 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openSubStorageWithFal return css::uno::Reference< css::embed::XStorage >(); } -css::uno::Reference< css::io::XStream > StorageHolder::openSubStreamWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage , - const OUString& sSubStream , - sal_Int32 eOpenMode , - bool bAllowFallback) -{ - // a) try it first with user specified open mode - // ignore errors ... but save it for later use! - css::uno::Exception exResult; - try - { - css::uno::Reference< css::io::XStream > xSubStream = xBaseStorage->openStreamElement(sSubStream, eOpenMode); - if (xSubStream.is()) - return xSubStream; - } - catch(const css::uno::RuntimeException&) - { throw; } - catch(const css::uno::Exception& ex) - { exResult = ex; } - - // b) readonly already tried? => forward last error! - if ( - (!bAllowFallback ) || // fallback allowed ? - ((eOpenMode & css::embed::ElementModes::WRITE) != css::embed::ElementModes::WRITE) // fallback possible ? - ) - throw exResult; - - // c) try it readonly - // don't catch exception here! Outside code wish to know, if operation failed or not. - // Otherwise they work on NULL references ... - sal_Int32 eNewMode = (eOpenMode & ~css::embed::ElementModes::WRITE); - css::uno::Reference< css::io::XStream > xSubStream = xBaseStorage->openStreamElement(sSubStream, eNewMode); - if (xSubStream.is()) - return xSubStream; - - // d) no chance! - SAL_INFO("fwk", "openSubStreamWithFallbacks(): Unexpected situation! Got no exception for missing stream ..."); - return css::uno::Reference< css::io::XStream >(); -} - OUString StorageHolder::impl_st_normPath(const OUString& sPath) { // path must start without "/" but end with "/"! diff --git a/framework/source/inc/accelerators/storageholder.hxx b/framework/source/inc/accelerators/storageholder.hxx index 43d7e1ba75f8..5ccb443b18f0 100644 --- a/framework/source/inc/accelerators/storageholder.hxx +++ b/framework/source/inc/accelerators/storageholder.hxx @@ -141,6 +141,8 @@ class StorageHolder final StorageHolder& operator=(const StorageHolder& rCopy); /** @short opens a sub element of the specified base storage. + If eOpenMode contains an ELEMENT_WRITE flag remove it and try it with the rest of eOpenMode flags + again. @descr First this method try to open the requested sub element using the given open mode. If it failed there is second step, @@ -158,20 +160,10 @@ class StorageHolder final @param eOpenMode a flag field, which set the open mode for this operation. - @param bAllowFallback - if eOpenMode contains an ELEMENT_WRITE flag this parameter - allow to remove it and try it with the rest of eOpenMode flags - again. */ static css::uno::Reference< css::embed::XStorage > openSubStorageWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage , const OUString& sSubStorage , - sal_Int32 eOpenMode , - bool bAllowFallback); - - static css::uno::Reference< css::io::XStream > openSubStreamWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage , - const OUString& sSubStream , - sal_Int32 eOpenMode , - bool bAllowFallback); + sal_Int32 eOpenMode); // helper private: diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx index cd8bfa25c905..6dc7c792c931 100644 --- a/i18npool/source/nativenumber/nativenumbersupplier.cxx +++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx @@ -63,10 +63,10 @@ OUString getHebrewNativeNumberString(const OUString& aNumberString, bool useGere OUString getCyrillicNativeNumberString(const OUString& aNumberString); /// @throws RuntimeException -OUString AsciiToNativeChar( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, +OUString AsciiToNativeChar( const OUString& inStr, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset, sal_Int16 number ) { - const sal_Unicode *src = inStr.getStr() + startPos; + const sal_Unicode *src = inStr.getStr(); rtl_uString *newStr = rtl_uString_alloc(nCount); if (useOffset) offset.realloc(nCount); @@ -86,7 +86,7 @@ OUString AsciiToNativeChar( const OUString& inStr, sal_Int32 startPos, sal_Int32 else newStr->buffer[i] = ch; if (useOffset) - offset[i] = startPos + i; + offset[i] = i; } return OUString(newStr, SAL_NO_ACQUIRE); // take ownership } @@ -163,12 +163,12 @@ bool AsciiToNative_numberMaker(const sal_Unicode *str, sal_Int32 begin, sal_Int3 } /// @throws RuntimeException -OUString AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, +OUString AsciiToNative( const OUString& inStr, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset, const Number* number ) { OUString aRet; - sal_Int32 strLen = inStr.getLength() - startPos; + sal_Int32 strLen = inStr.getLength(); const sal_Unicode *numberChar = NumberChar[number->number]; if (nCount > strLen) @@ -176,7 +176,7 @@ OUString AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCo if (nCount > 0) { - const sal_Unicode *str = inStr.getStr() + startPos; + const sal_Unicode *str = inStr.getStr(); std::unique_ptr<sal_Unicode[]> newStr(new sal_Unicode[nCount * 2 + 1]); std::unique_ptr<sal_Unicode[]> srcStr(new sal_Unicode[nCount + 1]); // for keeping number without comma sal_Int32 i, len = 0, count = 0; @@ -191,7 +191,7 @@ OUString AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCo if (bDoDecimal) { newStr[count] = numberChar[str[i] - NUMBER_ZERO]; if (useOffset) - offset[count] = i + startPos; + offset[count] = i; count++; } else @@ -206,7 +206,7 @@ OUString AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCo if (end == 0) continue; sal_Int32 _count = count; bNotZero |= AsciiToNative_numberMaker(srcStr.get(), begin, end - begin, newStr.get(), count, - end == len ? -1 : 0, offset, useOffset, i - len + startPos, number, numberChar); + end == len ? -1 : 0, offset, useOffset, i - len, number, numberChar); if (count > 0 && number->multiplierExponent[number->exponentCount-1] == 1 && newStr[count-1] == numberChar[0]) count--; @@ -214,7 +214,7 @@ OUString AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCo if (end != len) { newStr[count] = number->multiplierChar[0]; if (useOffset) - offset[count] = i - len + startPos; + offset[count] = i - len; count++; } } @@ -222,7 +222,7 @@ OUString AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCo if (! bNotZero && ! (number->numberFlag & NUMBER_OMIT_ONLY_ZERO)) { newStr[count] = numberChar[0]; if (useOffset) - offset[count] = i - len + startPos; + offset[count] = i - len; count++; } len = 0; @@ -238,7 +238,7 @@ OUString AsciiToNative( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCo else newStr[count] = str[i]; if (useOffset) - offset[count] = i + startPos; + offset[count] = i; count++; } } @@ -301,17 +301,17 @@ static void NativeToAscii_numberMaker(sal_Int16 max, sal_Int16 prev, const sal_U /// @throws RuntimeException static OUString NativeToAscii(const OUString& inStr, - sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) + sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) { OUString aRet; - sal_Int32 strLen = inStr.getLength() - startPos; + sal_Int32 strLen = inStr.getLength(); if (nCount > strLen) nCount = strLen; if (nCount > 0) { - const sal_Unicode *str = inStr.getStr() + startPos; + const sal_Unicode *str = inStr.getStr(); std::unique_ptr<sal_Unicode[]> newStr(new sal_Unicode[nCount * MultiplierExponent_7_CJK[0] + 2]); if (useOffset) offset.realloc( nCount * MultiplierExponent_7_CJK[0] + 1 ); @@ -368,8 +368,6 @@ static OUString NativeToAscii(const OUString& inStr, if (useOffset) { offset.realloc(count); - for (i = 0; i < count; i++) - offset[i] += startPos; } aRet = OUString(newStr.get(), count); } @@ -539,7 +537,7 @@ OUString NativeNumberSupplierService::getNativeNumberString(const OUString& aNum switch (nNativeNumberMode) { case NativeNumberMode::NATNUM0: // Ascii - return NativeToAscii(aNumberString, 0, aNumberString.getLength(), offset, useOffset); + return NativeToAscii(aNumberString, aNumberString.getLength(), offset, useOffset); case NativeNumberMode::NATNUM1: // Char, Lower num = natnum1[langnum]; break; @@ -595,14 +593,14 @@ OUString NativeNumberSupplierService::getNativeNumberString(const OUString& aNum SeparatorChar[NumberChar_FullWidth]=SeparatorChar[NumberChar_HalfWidth]+0xFEE0; } if (number) - return AsciiToNative( aNumberString, 0, aNumberString.getLength(), offset, useOffset, number ); + return AsciiToNative( aNumberString, aNumberString.getLength(), offset, useOffset, number ); else if (num == NumberChar_he) return getHebrewNativeNumberString(aNumberString, nNativeNumberMode == NativeNumberMode::NATNUM2); else if (num == NumberChar_cu) return getCyrillicNativeNumberString(aNumberString); else - return AsciiToNativeChar(aNumberString, 0, aNumberString.getLength(), offset, useOffset, num); + return AsciiToNativeChar(aNumberString, aNumberString.getLength(), offset, useOffset, num); } else return aNumberString; |