diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-17 14:45:27 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-22 14:02:02 -0500 |
commit | 8550b9331d28b5691f21d6d2bed7a784d199f81c (patch) | |
tree | e46329e7a7bd02304df62eb7edcbc4ef935e4676 /sc | |
parent | 1f4ce4ed9f8e9e47e866dc7a7a5d1ad292a4d78c (diff) |
Scope reduction.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 140 |
1 files changed, 71 insertions, 69 deletions
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index fb4c2eb40f5c..7696226bc1a9 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -1928,44 +1928,46 @@ bool ScDPObject::FillOldParam(ScPivotParam& rParam) const void lcl_FillLabelData( ScDPLabelData& rData, const uno::Reference< beans::XPropertySet >& xDimProp ) { uno::Reference<sheet::XHierarchiesSupplier> xDimSupp( xDimProp, uno::UNO_QUERY ); - if ( xDimProp.is() && xDimSupp.is() ) - { - uno::Reference<container::XIndexAccess> xHiers = new ScNameToIndexAccess( xDimSupp->getHierarchies() ); - long nHierarchy = ScUnoHelpFunctions::GetLongProperty( xDimProp, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_USEDHIERARCHY)) ); - if ( nHierarchy >= xHiers->getCount() ) - nHierarchy = 0; - rData.mnUsedHier = nHierarchy; + if (!xDimProp.is() || !xDimSupp.is()) + return; - uno::Reference<uno::XInterface> xHier = ScUnoHelpFunctions::AnyToInterface( - xHiers->getByIndex(nHierarchy) ); + uno::Reference<container::XIndexAccess> xHiers = new ScNameToIndexAccess( xDimSupp->getHierarchies() ); + long nHierarchy = ScUnoHelpFunctions::GetLongProperty( + xDimProp, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_USEDHIERARCHY))); + if ( nHierarchy >= xHiers->getCount() ) + nHierarchy = 0; + rData.mnUsedHier = nHierarchy; - uno::Reference<sheet::XLevelsSupplier> xHierSupp( xHier, uno::UNO_QUERY ); - if ( xHierSupp.is() ) - { - uno::Reference<container::XIndexAccess> xLevels = new ScNameToIndexAccess( xHierSupp->getLevels() ); - uno::Reference<uno::XInterface> xLevel = - ScUnoHelpFunctions::AnyToInterface( xLevels->getByIndex( 0 ) ); - uno::Reference<beans::XPropertySet> xLevProp( xLevel, uno::UNO_QUERY ); - if ( xLevProp.is() ) - { - rData.mbShowAll = ScUnoHelpFunctions::GetBoolProperty( xLevProp, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_SHOWEMPTY)) ); + uno::Reference<uno::XInterface> xHier = + ScUnoHelpFunctions::AnyToInterface(xHiers->getByIndex(nHierarchy)); - try - { - xLevProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_SORTING ) ) ) - >>= rData.maSortInfo; - xLevProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_LAYOUT ) ) ) - >>= rData.maLayoutInfo; - xLevProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_AUTOSHOW ) ) ) - >>= rData.maShowInfo; - } - catch(uno::Exception&) - { - } - } - } + uno::Reference<sheet::XLevelsSupplier> xHierSupp( xHier, uno::UNO_QUERY ); + if (!xHierSupp.is()) + return; + + uno::Reference<container::XIndexAccess> xLevels = + new ScNameToIndexAccess( xHierSupp->getLevels() ); + + uno::Reference<uno::XInterface> xLevel = + ScUnoHelpFunctions::AnyToInterface( xLevels->getByIndex(0) ); + uno::Reference<beans::XPropertySet> xLevProp( xLevel, uno::UNO_QUERY ); + if (!xLevProp.is()) + return; + + rData.mbShowAll = ScUnoHelpFunctions::GetBoolProperty( + xLevProp, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_SHOWEMPTY))); + + try + { + xLevProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_SORTING ) ) ) + >>= rData.maSortInfo; + xLevProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_LAYOUT ) ) ) + >>= rData.maLayoutInfo; + xLevProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_AUTOSHOW ) ) ) + >>= rData.maShowInfo; + } + catch(uno::Exception&) + { } } @@ -1993,44 +1995,44 @@ bool ScDPObject::FillLabelData(ScPivotParam& rParam) uno::Reference<container::XNamed> xDimName( xIntDim, uno::UNO_QUERY ); uno::Reference<beans::XPropertySet> xDimProp( xIntDim, uno::UNO_QUERY ); - if ( xDimName.is() && xDimProp.is() ) + if (!xDimName.is() || !xDimProp.is()) + continue; + + bool bDuplicated = false; + bool bData = ScUnoHelpFunctions::GetBoolProperty( xDimProp, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_ISDATALAYOUT)) ); + //! error checking -- is "IsDataLayoutDimension" property required?? + + try { - bool bDuplicated = false; - bool bData = ScUnoHelpFunctions::GetBoolProperty( xDimProp, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_ISDATALAYOUT)) ); - //! error checking -- is "IsDataLayoutDimension" property required?? + aFieldName = xDimName->getName(); + uno::Any aOrigAny = xDimProp->getPropertyValue( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_ORIGINAL)) ); + uno::Reference<uno::XInterface> xIntOrig; + if ( (aOrigAny >>= xIntOrig) && xIntOrig.is() ) + bDuplicated = true; + } + catch(uno::Exception&) + { + } - try - { - aFieldName = xDimName->getName(); - uno::Any aOrigAny = xDimProp->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_ORIGINAL)) ); - uno::Reference<uno::XInterface> xIntOrig; - if ( (aOrigAny >>= xIntOrig) && xIntOrig.is() ) - bDuplicated = true; - } - catch(uno::Exception&) - { - } + OUString aLayoutName = ScUnoHelpFunctions::GetStringProperty( + xDimProp, OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_LAYOUTNAME)), OUString()); - OUString aLayoutName = ScUnoHelpFunctions::GetStringProperty( - xDimProp, OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_LAYOUTNAME)), OUString()); + if (aFieldName.isEmpty() || bData) + continue; - if (!aFieldName.isEmpty() && !bData) - { - SCsCOL nCol = static_cast< SCsCOL >( nDim ); //! ??? - bool bIsValue = true; //! check - - std::auto_ptr<ScDPLabelData> pNewLabel(new ScDPLabelData(aFieldName, nCol, bIsValue)); - pNewLabel->maLayoutName = aLayoutName; - GetHierarchies(nDim, pNewLabel->maHiers); - GetMembers(nDim, GetUsedHierarchy(nDim), pNewLabel->maMembers); - lcl_FillLabelData(*pNewLabel, xDimProp); - pNewLabel->mnFlags = ScUnoHelpFunctions::GetLongProperty( xDimProp, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_FLAGS)), 0 ); - rParam.maLabelArray.push_back(pNewLabel); - } - } + SCsCOL nCol = static_cast< SCsCOL >( nDim ); //! ??? + bool bIsValue = true; //! check + + std::auto_ptr<ScDPLabelData> pNewLabel(new ScDPLabelData(aFieldName, nCol, bIsValue)); + pNewLabel->maLayoutName = aLayoutName; + GetHierarchies(nDim, pNewLabel->maHiers); + GetMembers(nDim, GetUsedHierarchy(nDim), pNewLabel->maMembers); + lcl_FillLabelData(*pNewLabel, xDimProp); + pNewLabel->mnFlags = ScUnoHelpFunctions::GetLongProperty( xDimProp, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_FLAGS)), 0 ); + rParam.maLabelArray.push_back(pNewLabel); } return true; |