[Libreoffice-commits] core.git: sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sun Aug 9 13:49:17 UTC 2020
sc/source/ui/unoobj/TablePivotCharts.cxx | 98
sc/source/ui/unoobj/afmtuno.cxx | 182 -
sc/source/ui/unoobj/appluno.cxx | 52
sc/source/ui/unoobj/cellsuno.cxx | 3200 +++++++++++++++----------------
sc/source/ui/unoobj/cellvaluebinding.cxx | 66
sc/source/ui/unoobj/chart2uno.cxx | 106 -
sc/source/ui/unoobj/chartuno.cxx | 164 -
sc/source/ui/unoobj/cursuno.cxx | 144 -
sc/source/ui/unoobj/dapiuno.cxx | 605 ++---
sc/source/ui/unoobj/datauno.cxx | 342 +--
sc/source/ui/unoobj/dispuno.cxx | 110 -
sc/source/ui/unoobj/docuno.cxx | 562 ++---
sc/source/ui/unoobj/editsrc.cxx | 32
sc/source/ui/unoobj/fielduno.cxx | 40
sc/source/ui/unoobj/fmtuno.cxx | 64
sc/source/ui/unoobj/linkuno.cxx | 108 -
sc/source/ui/unoobj/nameuno.cxx | 124 -
sc/source/ui/unoobj/styleuno.cxx | 728 +++----
sc/source/ui/unoobj/viewuno.cxx | 444 ++--
19 files changed, 3588 insertions(+), 3583 deletions(-)
New commits:
commit 0e1264f44ce421f6b175598fff68a15ccc8b5449
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sun Aug 9 11:54:41 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Aug 9 15:48:32 2020 +0200
loplugin:flatten in sc/ui/unoobj
Change-Id: I9b03672387aa555eb11149763a1113e0768f3f37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100398
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx b/sc/source/ui/unoobj/TablePivotCharts.cxx
index 9c896e27fa97..0c85943854c4 100644
--- a/sc/source/ui/unoobj/TablePivotCharts.cxx
+++ b/sc/source/ui/unoobj/TablePivotCharts.cxx
@@ -97,70 +97,70 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName,
if (SvtModuleOptions().IsChart())
xObject = m_pDocShell->GetEmbeddedObjectContainer().CreateEmbeddedObject(SvGlobalName(SO3_SCH_CLASSID).GetByteSequence(), aName);
- if (xObject.is())
- {
- Point aRectPos(aRect.X, aRect.Y);
- bool bLayoutRTL = rDoc.IsLayoutRTL(m_nTab);
- if ((aRectPos.X() < 0 && !bLayoutRTL) || (aRectPos.X() > 0 && bLayoutRTL))
- aRectPos.setX( 0 );
+ if (!xObject.is())
+ return;
- if (aRectPos.Y() < 0)
- aRectPos.setY( 0 );
+ Point aRectPos(aRect.X, aRect.Y);
+ bool bLayoutRTL = rDoc.IsLayoutRTL(m_nTab);
+ if ((aRectPos.X() < 0 && !bLayoutRTL) || (aRectPos.X() > 0 && bLayoutRTL))
+ aRectPos.setX( 0 );
- Size aRectSize(aRect.Width, aRect.Height);
- if (aRectSize.Width() <= 0)
- aRectSize.setWidth( 5000 ); // default size
+ if (aRectPos.Y() < 0)
+ aRectPos.setY( 0 );
- if (aRectSize.Height() <= 0)
- aRectSize.setHeight( 5000 );
+ Size aRectSize(aRect.Width, aRect.Height);
+ if (aRectSize.Width() <= 0)
+ aRectSize.setWidth( 5000 ); // default size
- ::tools::Rectangle aInsRect(aRectPos, aRectSize);
+ if (aRectSize.Height() <= 0)
+ aRectSize.setHeight( 5000 );
- sal_Int64 nAspect(embed::Aspects::MSOLE_CONTENT);
- MapUnit aMapUnit(VCLUnoHelper::UnoEmbed2VCLMapUnit(xObject->getMapUnit(nAspect)));
- Size aSize(aInsRect.GetSize());
- aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(aMapUnit));
- awt::Size aAwtSize;
- aAwtSize.Width = aSize.Width();
- aAwtSize.Height = aSize.Height();
+ ::tools::Rectangle aInsRect(aRectPos, aRectSize);
- std::unique_ptr<sc::PivotTableDataProvider> pPivotTableDataProvider(new sc::PivotTableDataProvider(&rDoc));
- pPivotTableDataProvider->setPivotTableName(rDataPilotName);
+ sal_Int64 nAspect(embed::Aspects::MSOLE_CONTENT);
+ MapUnit aMapUnit(VCLUnoHelper::UnoEmbed2VCLMapUnit(xObject->getMapUnit(nAspect)));
+ Size aSize(aInsRect.GetSize());
+ aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(aMapUnit));
+ awt::Size aAwtSize;
+ aAwtSize.Width = aSize.Width();
+ aAwtSize.Height = aSize.Height();
- uno::Reference<chart2::data::XDataProvider> xDataProvider(pPivotTableDataProvider.release());
+ std::unique_ptr<sc::PivotTableDataProvider> pPivotTableDataProvider(new sc::PivotTableDataProvider(&rDoc));
+ pPivotTableDataProvider->setPivotTableName(rDataPilotName);
- uno::Reference<chart2::data::XDataReceiver> xReceiver;
+ uno::Reference<chart2::data::XDataProvider> xDataProvider(pPivotTableDataProvider.release());
- if (xObject.is())
- xReceiver.set(xObject->getComponent(), uno::UNO_QUERY);
+ uno::Reference<chart2::data::XDataReceiver> xReceiver;
+
+ if (xObject.is())
+ xReceiver.set(xObject->getComponent(), uno::UNO_QUERY);
- if (xReceiver.is())
- {
- xReceiver->attachDataProvider(xDataProvider);
+ if (xReceiver.is())
+ {
+ xReceiver->attachDataProvider(xDataProvider);
- uno::Reference<util::XNumberFormatsSupplier> xNumberFormatsSupplier(m_pDocShell->GetModel(), uno::UNO_QUERY);
- xReceiver->attachNumberFormatsSupplier(xNumberFormatsSupplier);
+ uno::Reference<util::XNumberFormatsSupplier> xNumberFormatsSupplier(m_pDocShell->GetModel(), uno::UNO_QUERY);
+ xReceiver->attachNumberFormatsSupplier(xNumberFormatsSupplier);
- uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
- { "CellRangeRepresentation", uno::makeAny(rDataPilotName) },
- { "HasCategories", uno::makeAny(true) },
- { "DataRowSource", uno::makeAny(chart::ChartDataRowSource_COLUMNS) }
- }));
- xReceiver->setArguments(aArgs);
- }
+ uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
+ { "CellRangeRepresentation", uno::makeAny(rDataPilotName) },
+ { "HasCategories", uno::makeAny(true) },
+ { "DataRowSource", uno::makeAny(chart::ChartDataRowSource_COLUMNS) }
+ }));
+ xReceiver->setArguments(aArgs);
+ }
- SdrOle2Obj* pObject = new SdrOle2Obj(
- *pModel,
- svt::EmbeddedObjectRef(xObject, embed::Aspects::MSOLE_CONTENT),
- aName,
- aInsRect);
+ SdrOle2Obj* pObject = new SdrOle2Obj(
+ *pModel,
+ svt::EmbeddedObjectRef(xObject, embed::Aspects::MSOLE_CONTENT),
+ aName,
+ aInsRect);
- if (xObject.is())
- xObject->setVisualAreaSize(nAspect, aAwtSize);
+ if (xObject.is())
+ xObject->setVisualAreaSize(nAspect, aAwtSize);
- pPage->InsertObject(pObject);
- pModel->AddUndo(std::make_unique<SdrUndoInsertObj>(*pObject));
- }
+ pPage->InsertObject(pObject);
+ pModel->AddUndo(std::make_unique<SdrUndoInsertObj>(*pObject));
}
void SAL_CALL TablePivotCharts::removeByName(const OUString& rName)
diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx
index 1c637d2cd480..490dcea259e8 100644
--- a/sc/source/ui/unoobj/afmtuno.cxx
+++ b/sc/source/ui/unoobj/afmtuno.cxx
@@ -480,30 +480,30 @@ void SAL_CALL ScAutoFormatObj::setPropertyValue(
{
SolarMutexGuard aGuard;
ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
- if (IsInserted() && nFormatIndex < pFormats->size())
- {
- ScAutoFormatData* pData = pFormats->findByIndex(nFormatIndex);
- OSL_ENSURE(pData,"AutoFormat data not available");
+ if (!(IsInserted() && nFormatIndex < pFormats->size()))
+ return;
- bool bBool;
- if (aPropertyName == SC_UNONAME_INCBACK && (aValue >>= bBool))
- pData->SetIncludeBackground( bBool );
- else if (aPropertyName == SC_UNONAME_INCBORD && (aValue >>= bBool))
- pData->SetIncludeFrame( bBool );
- else if (aPropertyName == SC_UNONAME_INCFONT && (aValue >>= bBool))
- pData->SetIncludeFont( bBool );
- else if (aPropertyName == SC_UNONAME_INCJUST && (aValue >>= bBool))
- pData->SetIncludeJustify( bBool );
- else if (aPropertyName == SC_UNONAME_INCNUM && (aValue >>= bBool))
- pData->SetIncludeValueFormat( bBool );
- else if (aPropertyName == SC_UNONAME_INCWIDTH && (aValue >>= bBool))
- pData->SetIncludeWidthHeight( bBool );
-
- // else error
+ ScAutoFormatData* pData = pFormats->findByIndex(nFormatIndex);
+ OSL_ENSURE(pData,"AutoFormat data not available");
- //! notify to other objects
- pFormats->SetSaveLater(true);
- }
+ bool bBool;
+ if (aPropertyName == SC_UNONAME_INCBACK && (aValue >>= bBool))
+ pData->SetIncludeBackground( bBool );
+ else if (aPropertyName == SC_UNONAME_INCBORD && (aValue >>= bBool))
+ pData->SetIncludeFrame( bBool );
+ else if (aPropertyName == SC_UNONAME_INCFONT && (aValue >>= bBool))
+ pData->SetIncludeFont( bBool );
+ else if (aPropertyName == SC_UNONAME_INCJUST && (aValue >>= bBool))
+ pData->SetIncludeJustify( bBool );
+ else if (aPropertyName == SC_UNONAME_INCNUM && (aValue >>= bBool))
+ pData->SetIncludeValueFormat( bBool );
+ else if (aPropertyName == SC_UNONAME_INCWIDTH && (aValue >>= bBool))
+ pData->SetIncludeWidthHeight( bBool );
+
+ // else error
+
+ //! notify to other objects
+ pFormats->SetSaveLater(true);
}
uno::Any SAL_CALL ScAutoFormatObj::getPropertyValue( const OUString& aPropertyName )
@@ -572,95 +572,95 @@ void SAL_CALL ScAutoFormatFieldObj::setPropertyValue(
const SfxItemPropertySimpleEntry* pEntry =
aPropSet.getPropertyMap().getByName( aPropertyName );
- if ( pEntry && pEntry->nWID && nFormatIndex < pFormats->size() )
- {
- ScAutoFormatData* pData = pFormats->findByIndex(nFormatIndex);
+ if ( !(pEntry && pEntry->nWID && nFormatIndex < pFormats->size()) )
+ return;
- if ( IsScItemWid( pEntry->nWID ) )
+ ScAutoFormatData* pData = pFormats->findByIndex(nFormatIndex);
+
+ if ( IsScItemWid( pEntry->nWID ) )
+ {
+ if( const SfxPoolItem* pItem = pData->GetItem( nFieldIndex, pEntry->nWID ) )
{
- if( const SfxPoolItem* pItem = pData->GetItem( nFieldIndex, pEntry->nWID ) )
- {
- bool bDone = false;
+ bool bDone = false;
- switch( pEntry->nWID )
+ switch( pEntry->nWID )
+ {
+ case ATTR_STACKED:
{
- case ATTR_STACKED:
+ table::CellOrientation eOrient;
+ if( aValue >>= eOrient )
{
- table::CellOrientation eOrient;
- if( aValue >>= eOrient )
+ switch( eOrient )
{
- switch( eOrient )
+ case table::CellOrientation_STANDARD:
+ pData->PutItem( nFieldIndex, ScVerticalStackCell( false ) );
+ break;
+ case table::CellOrientation_TOPBOTTOM:
+ pData->PutItem( nFieldIndex, ScVerticalStackCell( false ) );
+ pData->PutItem( nFieldIndex, ScRotateValueItem( 27000 ) );
+ break;
+ case table::CellOrientation_BOTTOMTOP:
+ pData->PutItem( nFieldIndex, ScVerticalStackCell( false ) );
+ pData->PutItem( nFieldIndex, ScRotateValueItem( 9000 ) );
+ break;
+ case table::CellOrientation_STACKED:
+ pData->PutItem( nFieldIndex, ScVerticalStackCell( true ) );
+ break;
+ default:
{
- case table::CellOrientation_STANDARD:
- pData->PutItem( nFieldIndex, ScVerticalStackCell( false ) );
- break;
- case table::CellOrientation_TOPBOTTOM:
- pData->PutItem( nFieldIndex, ScVerticalStackCell( false ) );
- pData->PutItem( nFieldIndex, ScRotateValueItem( 27000 ) );
- break;
- case table::CellOrientation_BOTTOMTOP:
- pData->PutItem( nFieldIndex, ScVerticalStackCell( false ) );
- pData->PutItem( nFieldIndex, ScRotateValueItem( 9000 ) );
- break;
- case table::CellOrientation_STACKED:
- pData->PutItem( nFieldIndex, ScVerticalStackCell( true ) );
- break;
- default:
- {
- // added to avoid warnings
- }
+ // added to avoid warnings
}
- bDone = true;
}
+ bDone = true;
}
- break;
- default:
- std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
- bDone = pNewItem->PutValue( aValue, pEntry->nMemberId );
- if (bDone)
- pData->PutItem( nFieldIndex, *pNewItem );
}
-
- if (bDone)
- //! Notify to other objects?
- pFormats->SetSaveLater(true);
+ break;
+ default:
+ std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
+ bDone = pNewItem->PutValue( aValue, pEntry->nMemberId );
+ if (bDone)
+ pData->PutItem( nFieldIndex, *pNewItem );
}
+
+ if (bDone)
+ //! Notify to other objects?
+ pFormats->SetSaveLater(true);
}
- else
+ }
+ else
+ {
+ switch (pEntry->nWID)
{
- switch (pEntry->nWID)
- {
- case SC_WID_UNO_TBLBORD:
+ case SC_WID_UNO_TBLBORD:
+ {
+ table::TableBorder aBorder;
+ if ( aValue >>= aBorder ) // empty = nothing to do
{
- table::TableBorder aBorder;
- if ( aValue >>= aBorder ) // empty = nothing to do
- {
- SvxBoxItem aOuter(ATTR_BORDER);
- SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
- ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
- pData->PutItem( nFieldIndex, aOuter );
+ SvxBoxItem aOuter(ATTR_BORDER);
+ SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
+ ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
+ pData->PutItem( nFieldIndex, aOuter );
- //! Notify for other objects?
- pFormats->SetSaveLater(true);
- }
+ //! Notify for other objects?
+ pFormats->SetSaveLater(true);
}
- break;
- case SC_WID_UNO_TBLBORD2:
+ }
+ break;
+ case SC_WID_UNO_TBLBORD2:
+ {
+ table::TableBorder2 aBorder2;
+ if ( aValue >>= aBorder2 ) // empty = nothing to do
{
- table::TableBorder2 aBorder2;
- if ( aValue >>= aBorder2 ) // empty = nothing to do
- {
- SvxBoxItem aOuter(ATTR_BORDER);
- SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
- ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder2 );
- pData->PutItem( nFieldIndex, aOuter );
+ SvxBoxItem aOuter(ATTR_BORDER);
+ SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
+ ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder2 );
+ pData->PutItem( nFieldIndex, aOuter );
- //! Notify for other objects?
- pFormats->SetSaveLater(true);
- }
+ //! Notify for other objects?
+ pFormats->SetSaveLater(true);
}
- break;
- }
+ }
+ break;
}
}
}
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index e13722131b42..c5a3137419e5 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -448,34 +448,34 @@ static void lcl_FillSequence( uno::Sequence<beans::PropertyValue>& rSequence, co
pArray[3].Value <<= *rDesc.mxFuncDesc;
pArray[4].Name = SC_UNONAME_ARGUMENTS;
- if (!rDesc.maDefArgNames.empty() && !rDesc.maDefArgDescs.empty() && rDesc.pDefArgFlags )
+ if (rDesc.maDefArgNames.empty() || rDesc.maDefArgDescs.empty() || !rDesc.pDefArgFlags)
+ return;
+
+ sal_uInt16 nCount = rDesc.nArgCount;
+ if (nCount >= PAIRED_VAR_ARGS)
+ nCount -= PAIRED_VAR_ARGS - 2;
+ else if (nCount >= VAR_ARGS)
+ nCount -= VAR_ARGS - 1;
+ sal_uInt16 nSeqCount = rDesc.GetSuppressedArgCount();
+ if (nSeqCount >= PAIRED_VAR_ARGS)
+ nSeqCount -= PAIRED_VAR_ARGS - 2;
+ else if (nSeqCount >= VAR_ARGS)
+ nSeqCount -= VAR_ARGS - 1;
+
+ if (!nSeqCount)
+ return;
+
+ uno::Sequence<sheet::FunctionArgument> aArgSeq(nSeqCount);
+ sheet::FunctionArgument* pArgAry = aArgSeq.getArray();
+ for (sal_uInt16 i=0, j=0; i<nCount; i++)
{
- sal_uInt16 nCount = rDesc.nArgCount;
- if (nCount >= PAIRED_VAR_ARGS)
- nCount -= PAIRED_VAR_ARGS - 2;
- else if (nCount >= VAR_ARGS)
- nCount -= VAR_ARGS - 1;
- sal_uInt16 nSeqCount = rDesc.GetSuppressedArgCount();
- if (nSeqCount >= PAIRED_VAR_ARGS)
- nSeqCount -= PAIRED_VAR_ARGS - 2;
- else if (nSeqCount >= VAR_ARGS)
- nSeqCount -= VAR_ARGS - 1;
-
- if (nSeqCount)
- {
- uno::Sequence<sheet::FunctionArgument> aArgSeq(nSeqCount);
- sheet::FunctionArgument* pArgAry = aArgSeq.getArray();
- for (sal_uInt16 i=0, j=0; i<nCount; i++)
- {
- sheet::FunctionArgument aArgument;
- aArgument.Name = rDesc.maDefArgNames[i];
- aArgument.Description = rDesc.maDefArgDescs[i];
- aArgument.IsOptional = rDesc.pDefArgFlags[i].bOptional;
- pArgAry[j++] = aArgument;
- }
- pArray[4].Value <<= aArgSeq;
- }
+ sheet::FunctionArgument aArgument;
+ aArgument.Name = rDesc.maDefArgNames[i];
+ aArgument.Description = rDesc.maDefArgDescs[i];
+ aArgument.IsOptional = rDesc.pDefArgFlags[i].bOptional;
+ pArgAry[j++] = aArgument;
}
+ pArray[4].Value <<= aArgSeq;
}
// XFunctionDescriptions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 2db272db63cc..969bd51dd49a 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1680,19 +1680,19 @@ ScDocument* ScCellRangesBase::GetDocument() const
void ScCellRangesBase::InitInsertRange(ScDocShell* pDocSh, const ScRange& rR)
{
- if ( !pDocShell && pDocSh )
- {
- pDocShell = pDocSh;
+ if ( !(!pDocShell && pDocSh) )
+ return;
- ScRange aCellRange(rR);
- aCellRange.PutInOrder();
- aRanges.RemoveAll();
- aRanges.push_back( aCellRange );
+ pDocShell = pDocSh;
- pDocShell->GetDocument().AddUnoObject(*this);
+ ScRange aCellRange(rR);
+ aCellRange.PutInOrder();
+ aRanges.RemoveAll();
+ aRanges.push_back( aCellRange );
- RefChanged(); // adjust range in range object
- }
+ pDocShell->GetDocument().AddUnoObject(*this);
+
+ RefChanged(); // adjust range in range object
}
void ScCellRangesBase::AddRange(const ScRange& rRange, const bool bMergeRanges)
@@ -1783,29 +1783,29 @@ static void lcl_GetPropertyWhich( const SfxItemPropertySimpleEntry* pEntry,
{
// Which-ID of the affected items also when the item can't handle
// the property by itself
- if ( pEntry )
- {
- if ( IsScItemWid( pEntry->nWID ) )
- rItemWhich = pEntry->nWID;
- else
- switch ( pEntry->nWID )
- {
- case SC_WID_UNO_TBLBORD:
- case SC_WID_UNO_TBLBORD2:
- rItemWhich = ATTR_BORDER;
- break;
- case SC_WID_UNO_CONDFMT:
- case SC_WID_UNO_CONDLOC:
- case SC_WID_UNO_CONDXML:
- rItemWhich = ATTR_CONDITIONAL;
- break;
- case SC_WID_UNO_VALIDAT:
- case SC_WID_UNO_VALILOC:
- case SC_WID_UNO_VALIXML:
- rItemWhich = ATTR_VALIDDATA;
- break;
- }
- }
+ if ( !pEntry )
+ return;
+
+ if ( IsScItemWid( pEntry->nWID ) )
+ rItemWhich = pEntry->nWID;
+ else
+ switch ( pEntry->nWID )
+ {
+ case SC_WID_UNO_TBLBORD:
+ case SC_WID_UNO_TBLBORD2:
+ rItemWhich = ATTR_BORDER;
+ break;
+ case SC_WID_UNO_CONDFMT:
+ case SC_WID_UNO_CONDLOC:
+ case SC_WID_UNO_CONDXML:
+ rItemWhich = ATTR_CONDITIONAL;
+ break;
+ case SC_WID_UNO_VALIDAT:
+ case SC_WID_UNO_VALILOC:
+ case SC_WID_UNO_VALIXML:
+ rItemWhich = ATTR_VALIDDATA;
+ break;
+ }
}
@@ -1891,43 +1891,43 @@ uno::Sequence<beans::PropertyState> SAL_CALL ScCellRangesBase::getPropertyStates
void SAL_CALL ScCellRangesBase::setPropertyToDefault( const OUString& aPropertyName )
{
SolarMutexGuard aGuard;
- if ( pDocShell )
+ if ( !pDocShell )
+ return;
+
+ const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
+ sal_uInt16 nItemWhich = 0;
+ const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName );
+ lcl_GetPropertyWhich( pEntry, nItemWhich );
+ if ( nItemWhich ) // item wid (from map or special case)
{
- const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
- sal_uInt16 nItemWhich = 0;
- const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName );
- lcl_GetPropertyWhich( pEntry, nItemWhich );
- if ( nItemWhich ) // item wid (from map or special case)
+ if ( !aRanges.empty() ) // empty = nothing to do
{
- if ( !aRanges.empty() ) // empty = nothing to do
- {
- //! for items that have multiple properties (e.g. background)
- //! too much will be reset
- //! for ATTR_ROTATE_VALUE, reset ATTR_ORIENTATION as well?
+ //! for items that have multiple properties (e.g. background)
+ //! too much will be reset
+ //! for ATTR_ROTATE_VALUE, reset ATTR_ORIENTATION as well?
- sal_uInt16 aWIDs[3];
- aWIDs[0] = nItemWhich;
- if ( nItemWhich == ATTR_VALUE_FORMAT )
- {
- aWIDs[1] = ATTR_LANGUAGE_FORMAT; // language for number formats
- aWIDs[2] = 0;
- }
- else
- aWIDs[1] = 0;
- pDocShell->GetDocFunc().ClearItems( *GetMarkData(), aWIDs, true );
+ sal_uInt16 aWIDs[3];
+ aWIDs[0] = nItemWhich;
+ if ( nItemWhich == ATTR_VALUE_FORMAT )
+ {
+ aWIDs[1] = ATTR_LANGUAGE_FORMAT; // language for number formats
+ aWIDs[2] = 0;
}
+ else
+ aWIDs[1] = 0;
+ pDocShell->GetDocFunc().ClearItems( *GetMarkData(), aWIDs, true );
}
- else if ( pEntry )
+ }
+ else if ( pEntry )
+ {
+ if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR )
+ bChartColAsHdr = false;
+ else if ( pEntry->nWID == SC_WID_UNO_CHROWHDR )
+ bChartRowAsHdr = false;
+ else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
{
- if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR )
- bChartColAsHdr = false;
- else if ( pEntry->nWID == SC_WID_UNO_CHROWHDR )
- bChartRowAsHdr = false;
- else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
- {
- OUString aStyleName( ScResId( STR_STYLENAME_STANDARD_CELL ) );
- pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aStyleName, true );
- }
+ OUString aStyleName( ScResId( STR_STYLENAME_STANDARD_CELL ) );
+ pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aStyleName, true );
}
}
}
@@ -2173,199 +2173,199 @@ void SAL_CALL ScCellRangesBase::setPropertyValue(
void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
{
- if ( pEntry )
+ if ( !pEntry )
+ return;
+
+ if ( IsScItemWid( pEntry->nWID ) )
{
- if ( IsScItemWid( pEntry->nWID ) )
+ if ( !aRanges.empty() ) // empty = nothing to do
{
- if ( !aRanges.empty() ) // empty = nothing to do
- {
- ScDocument& rDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- // For parts of compound items with multiple properties (e.g. background)
- // the old item has to be first fetched from the document.
- //! But we can't recognize this case here
- //! -> an extra flag in PropertyMap entry, or something like that???
- //! fetch the item directly from its position in the range?
- // ClearInvalidItems, so that in any case we have an item with the correct type
+ // For parts of compound items with multiple properties (e.g. background)
+ // the old item has to be first fetched from the document.
+ //! But we can't recognize this case here
+ //! -> an extra flag in PropertyMap entry, or something like that???
+ //! fetch the item directly from its position in the range?
+ // ClearInvalidItems, so that in any case we have an item with the correct type
- ScPatternAttr aPattern( *GetCurrentAttrsDeep() );
- SfxItemSet& rSet = aPattern.GetItemSet();
- rSet.ClearInvalidItems();
+ ScPatternAttr aPattern( *GetCurrentAttrsDeep() );
+ SfxItemSet& rSet = aPattern.GetItemSet();
+ rSet.ClearInvalidItems();
- sal_uInt16 nFirstItem, nSecondItem;
- lcl_SetCellProperty( *pEntry, aValue, aPattern, rDoc, nFirstItem, nSecondItem );
+ sal_uInt16 nFirstItem, nSecondItem;
+ lcl_SetCellProperty( *pEntry, aValue, aPattern, rDoc, nFirstItem, nSecondItem );
- for (sal_uInt16 nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; nWhich++)
- if ( nWhich != nFirstItem && nWhich != nSecondItem )
- rSet.ClearItem(nWhich);
+ for (sal_uInt16 nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; nWhich++)
+ if ( nWhich != nFirstItem && nWhich != nSecondItem )
+ rSet.ClearItem(nWhich);
- pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, true );
- }
+ pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, true );
}
- else // implemented here
- switch ( pEntry->nWID )
+ }
+ else // implemented here
+ switch ( pEntry->nWID )
+ {
+ case EE_CHAR_ESCAPEMENT: // Specifically for xlsx import
{
- case EE_CHAR_ESCAPEMENT: // Specifically for xlsx import
+ sal_Int32 nValue = 0;
+ aValue >>= nValue;
+ if (nValue)
{
- sal_Int32 nValue = 0;
- aValue >>= nValue;
- if (nValue)
+ for (size_t i = 0, n = aRanges.size(); i < n; ++i)
{
- for (size_t i = 0, n = aRanges.size(); i < n; ++i)
- {
- ScRange const & rRange = aRanges[i];
-
- /* TODO: Iterate through the range */
- ScAddress aAddr = rRange.aStart;
- ScDocument& rDoc = pDocShell->GetDocument();
- ScRefCellValue aCell(rDoc, aAddr);
-
- OUString aStr = aCell.getString(&rDoc);
- EditEngine aEngine( rDoc.GetEnginePool() );
- aEngine.SetEditTextObjectPool(rDoc.GetEditPool());
-
- /* EE_CHAR_ESCAPEMENT seems to be set on the cell _only_ when
- * there are no other attribs for the cell.
- * So, it is safe to overwrite the complete attribute set.
- * If there is a need - getting CellType and processing
- * the attributes could be considered.
- */
- SfxItemSet aAttr = aEngine.GetEmptyItemSet();
- aEngine.SetText(aStr);
- if( nValue < 0 ) // Subscript
- aAttr.Put( SvxEscapementItem( SvxEscapement::Subscript, EE_CHAR_ESCAPEMENT ) );
- else // Superscript
- aAttr.Put( SvxEscapementItem( SvxEscapement::Superscript, EE_CHAR_ESCAPEMENT ) );
- aEngine.QuickSetAttribs(aAttr, ESelection(0, 0, 0, aStr.getLength()));
-
- // The cell will own the text object instance.
- rDoc.SetEditText(aRanges[0].aStart, aEngine.CreateTextObject());
- }
+ ScRange const & rRange = aRanges[i];
+
+ /* TODO: Iterate through the range */
+ ScAddress aAddr = rRange.aStart;
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScRefCellValue aCell(rDoc, aAddr);
+
+ OUString aStr = aCell.getString(&rDoc);
+ EditEngine aEngine( rDoc.GetEnginePool() );
+ aEngine.SetEditTextObjectPool(rDoc.GetEditPool());
+
+ /* EE_CHAR_ESCAPEMENT seems to be set on the cell _only_ when
+ * there are no other attribs for the cell.
+ * So, it is safe to overwrite the complete attribute set.
+ * If there is a need - getting CellType and processing
+ * the attributes could be considered.
+ */
+ SfxItemSet aAttr = aEngine.GetEmptyItemSet();
+ aEngine.SetText(aStr);
+ if( nValue < 0 ) // Subscript
+ aAttr.Put( SvxEscapementItem( SvxEscapement::Subscript, EE_CHAR_ESCAPEMENT ) );
+ else // Superscript
+ aAttr.Put( SvxEscapementItem( SvxEscapement::Superscript, EE_CHAR_ESCAPEMENT ) );
+ aEngine.QuickSetAttribs(aAttr, ESelection(0, 0, 0, aStr.getLength()));
+
+ // The cell will own the text object instance.
+ rDoc.SetEditText(aRanges[0].aStart, aEngine.CreateTextObject());
}
}
+ }
+ break;
+ case SC_WID_UNO_CHCOLHDR:
+ // chart header flags are set for this object, not stored with document
+ bChartColAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
break;
- case SC_WID_UNO_CHCOLHDR:
- // chart header flags are set for this object, not stored with document
- bChartColAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- break;
- case SC_WID_UNO_CHROWHDR:
- bChartRowAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- break;
- case SC_WID_UNO_CELLSTYL:
- {
- OUString aStrVal;
- aValue >>= aStrVal;
- OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName(
- aStrVal, SfxStyleFamily::Para ));
- pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aString, true );
- }
- break;
- case SC_WID_UNO_TBLBORD:
+ case SC_WID_UNO_CHROWHDR:
+ bChartRowAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ break;
+ case SC_WID_UNO_CELLSTYL:
+ {
+ OUString aStrVal;
+ aValue >>= aStrVal;
+ OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName(
+ aStrVal, SfxStyleFamily::Para ));
+ pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aString, true );
+ }
+ break;
+ case SC_WID_UNO_TBLBORD:
+ {
+ table::TableBorder aBorder;
+ if ( !aRanges.empty() && ( aValue >>= aBorder ) ) // empty = nothing to do
{
- table::TableBorder aBorder;
- if ( !aRanges.empty() && ( aValue >>= aBorder ) ) // empty = nothing to do
- {
- SvxBoxItem aOuter(ATTR_BORDER);
- SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
- ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
+ SvxBoxItem aOuter(ATTR_BORDER);
+ SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
+ ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
- ScHelperFunctions::ApplyBorder( pDocShell, aRanges, aOuter, aInner ); //! docfunc
- }
+ ScHelperFunctions::ApplyBorder( pDocShell, aRanges, aOuter, aInner ); //! docfunc
}
- break;
- case SC_WID_UNO_TBLBORD2:
+ }
+ break;
+ case SC_WID_UNO_TBLBORD2:
+ {
+ table::TableBorder2 aBorder2;
+ if ( !aRanges.empty() && ( aValue >>= aBorder2 ) ) // empty = nothing to do
{
- table::TableBorder2 aBorder2;
- if ( !aRanges.empty() && ( aValue >>= aBorder2 ) ) // empty = nothing to do
- {
- SvxBoxItem aOuter(ATTR_BORDER);
- SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
- ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder2 );
+ SvxBoxItem aOuter(ATTR_BORDER);
+ SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
+ ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder2 );
- ScHelperFunctions::ApplyBorder( pDocShell, aRanges, aOuter, aInner ); //! docfunc
- }
+ ScHelperFunctions::ApplyBorder( pDocShell, aRanges, aOuter, aInner ); //! docfunc
}
- break;
- case SC_WID_UNO_CONDFMT:
- case SC_WID_UNO_CONDLOC:
- case SC_WID_UNO_CONDXML:
+ }
+ break;
+ case SC_WID_UNO_CONDFMT:
+ case SC_WID_UNO_CONDLOC:
+ case SC_WID_UNO_CONDXML:
+ {
+ uno::Reference<sheet::XSheetConditionalEntries> xInterface(aValue, uno::UNO_QUERY);
+ if ( !aRanges.empty() && xInterface.is() ) // empty = nothing to do
{
- uno::Reference<sheet::XSheetConditionalEntries> xInterface(aValue, uno::UNO_QUERY);
- if ( !aRanges.empty() && xInterface.is() ) // empty = nothing to do
+ ScTableConditionalFormat* pFormat =
+ comphelper::getUnoTunnelImplementation<ScTableConditionalFormat>( xInterface );
+ if (pFormat)
{
- ScTableConditionalFormat* pFormat =
- comphelper::getUnoTunnelImplementation<ScTableConditionalFormat>( xInterface );
- if (pFormat)
+ ScDocument& rDoc = pDocShell->GetDocument();
+ bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
+ bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
+ formula::FormulaGrammar::Grammar eGrammar = (bXML ?
+ formula::FormulaGrammar::GRAM_UNSPECIFIED :
+ formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
+
+ SCTAB nTab = aRanges.front().aStart.Tab();
+ // To remove conditional formats for all cells in aRanges we need to:
+ // Remove conditional format data from cells' attributes
+ rDoc.RemoveCondFormatData( aRanges, nTab, 0 );
+ // And also remove ranges from conditional formats list
+ for (size_t i = 0; i < aRanges.size(); ++i)
+ {
+ rDoc.GetCondFormList( aRanges[i].aStart.Tab() )->DeleteArea(
+ aRanges[i].aStart.Col(), aRanges[i].aStart.Row(),
+ aRanges[i].aEnd.Col(), aRanges[i].aEnd.Row() );
+ }
+
+ // Then we can apply new conditional format if there is one
+ if (pFormat->getCount())
{
- ScDocument& rDoc = pDocShell->GetDocument();
- bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
- bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
- formula::FormulaGrammar::Grammar eGrammar = (bXML ?
- formula::FormulaGrammar::GRAM_UNSPECIFIED :
- formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
-
- SCTAB nTab = aRanges.front().aStart.Tab();
- // To remove conditional formats for all cells in aRanges we need to:
- // Remove conditional format data from cells' attributes
- rDoc.RemoveCondFormatData( aRanges, nTab, 0 );
- // And also remove ranges from conditional formats list
- for (size_t i = 0; i < aRanges.size(); ++i)
- {
- rDoc.GetCondFormList( aRanges[i].aStart.Tab() )->DeleteArea(
- aRanges[i].aStart.Col(), aRanges[i].aStart.Row(),
- aRanges[i].aEnd.Col(), aRanges[i].aEnd.Row() );
- }
-
- // Then we can apply new conditional format if there is one
- if (pFormat->getCount())
- {
- auto pNew = std::make_unique<ScConditionalFormat>( 0, &rDoc ); // Index will be set on inserting
- pFormat->FillFormat( *pNew, &rDoc, eGrammar );
- pNew->SetRange( aRanges );
- pDocShell->GetDocFunc().ReplaceConditionalFormat( 0, std::move(pNew), nTab, aRanges );
- }
-
- // and repaint
- for (size_t i = 0; i < aRanges.size(); ++i)
- pDocShell->PostPaint(aRanges[i], PaintPartFlags::Grid);
- pDocShell->SetDocumentModified();
+ auto pNew = std::make_unique<ScConditionalFormat>( 0, &rDoc ); // Index will be set on inserting
+ pFormat->FillFormat( *pNew, &rDoc, eGrammar );
+ pNew->SetRange( aRanges );
+ pDocShell->GetDocFunc().ReplaceConditionalFormat( 0, std::move(pNew), nTab, aRanges );
}
+
+ // and repaint
+ for (size_t i = 0; i < aRanges.size(); ++i)
+ pDocShell->PostPaint(aRanges[i], PaintPartFlags::Grid);
+ pDocShell->SetDocumentModified();
}
}
- break;
- case SC_WID_UNO_VALIDAT:
- case SC_WID_UNO_VALILOC:
- case SC_WID_UNO_VALIXML:
+ }
+ break;
+ case SC_WID_UNO_VALIDAT:
+ case SC_WID_UNO_VALILOC:
+ case SC_WID_UNO_VALIXML:
+ {
+ uno::Reference<beans::XPropertySet> xInterface(aValue, uno::UNO_QUERY);
+ if ( !aRanges.empty() && xInterface.is() ) // empty = nothing to do
{
- uno::Reference<beans::XPropertySet> xInterface(aValue, uno::UNO_QUERY);
- if ( !aRanges.empty() && xInterface.is() ) // empty = nothing to do
+ ScTableValidationObj* pValidObj =
+ comphelper::getUnoTunnelImplementation<ScTableValidationObj>( xInterface );
+ if (pValidObj)
{
- ScTableValidationObj* pValidObj =
- comphelper::getUnoTunnelImplementation<ScTableValidationObj>( xInterface );
- if (pValidObj)
- {
- ScDocument& rDoc = pDocShell->GetDocument();
- bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
- bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
- formula::FormulaGrammar::Grammar eGrammar = (bXML ?
- formula::FormulaGrammar::GRAM_UNSPECIFIED :
- formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
-
- std::unique_ptr<ScValidationData> pNewData(
- pValidObj->CreateValidationData( &rDoc, eGrammar ));
- sal_uLong nIndex = rDoc.AddValidationEntry( *pNewData );
- pNewData.reset();
-
- ScPatternAttr aPattern( rDoc.GetPool() );
- aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nIndex ) );
- pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, true );
- }
+ ScDocument& rDoc = pDocShell->GetDocument();
+ bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
+ bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
+ formula::FormulaGrammar::Grammar eGrammar = (bXML ?
+ formula::FormulaGrammar::GRAM_UNSPECIFIED :
+ formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
+
+ std::unique_ptr<ScValidationData> pNewData(
+ pValidObj->CreateValidationData( &rDoc, eGrammar ));
+ sal_uLong nIndex = rDoc.AddValidationEntry( *pNewData );
+ pNewData.reset();
+
+ ScPatternAttr aPattern( rDoc.GetPool() );
+ aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nIndex ) );
+ pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, true );
}
}
- break;
- // SC_WID_UNO_NUMRULES is ignored...
- }
- }
+ }
+ break;
+ // SC_WID_UNO_NUMRULES is ignored...
+ }
}
uno::Any SAL_CALL ScCellRangesBase::getPropertyValue( const OUString& aPropertyName )
@@ -2387,150 +2387,150 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyValue( const OUString& aPropertyN
void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, uno::Any& rAny )
{
- if ( pEntry )
+ if ( !pEntry )
+ return;
+
+ if ( IsScItemWid( pEntry->nWID ) )
{
- if ( IsScItemWid( pEntry->nWID ) )
+ SfxItemSet* pDataSet = GetCurrentDataSet();
+ if ( pDataSet )
{
- SfxItemSet* pDataSet = GetCurrentDataSet();
- if ( pDataSet )
- {
- switch ( pEntry->nWID ) // for special handling of items
- {
- case ATTR_VALUE_FORMAT:
- {
- ScDocument& rDoc = pDocShell->GetDocument();
-
- sal_uLong nOldFormat =
- pDataSet->Get( ATTR_VALUE_FORMAT ).GetValue();
- LanguageType eOldLang =
- pDataSet->Get( ATTR_LANGUAGE_FORMAT ).GetLanguage();
- nOldFormat = rDoc.GetFormatTable()->
- GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
- rAny <<= static_cast<sal_Int32>(nOldFormat);
- }
- break;
- case ATTR_INDENT:
- rAny <<= static_cast<sal_Int16>( TwipsToHMM(static_cast<const ScIndentItem&>(
- pDataSet->Get(pEntry->nWID)).GetValue()) );
- break;
- case ATTR_STACKED:
- {
- sal_Int32 nRot = pDataSet->Get(ATTR_ROTATE_VALUE).GetValue();
- bool bStacked = static_cast<const ScVerticalStackCell&>(pDataSet->Get(pEntry->nWID)).GetValue();
- SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( rAny );
- }
- break;
- default:
- pPropSet->getPropertyValue(*pEntry, *pDataSet, rAny);
- }
- }
- }
- else // implemented here
- switch ( pEntry->nWID )
+ switch ( pEntry->nWID ) // for special handling of items
{
- case SC_WID_UNO_CHCOLHDR:
- rAny <<= bChartColAsHdr;
- break;
- case SC_WID_UNO_CHROWHDR:
- rAny <<= bChartRowAsHdr;
- break;
- case SC_WID_UNO_CELLSTYL:
+ case ATTR_VALUE_FORMAT:
{
- OUString aStyleName;
- const ScStyleSheet* pStyle = pDocShell->GetDocument().GetSelectionStyle(*GetMarkData());
- if (pStyle)
- aStyleName = pStyle->GetName();
- rAny <<= ScStyleNameConversion::DisplayToProgrammaticName(
- aStyleName, SfxStyleFamily::Para );
- }
- break;
- case SC_WID_UNO_TBLBORD:
- case SC_WID_UNO_TBLBORD2:
- {
- //! loop through all ranges
- if ( !aRanges.empty() )
- {
- const ScRange & rFirst = aRanges[ 0 ];
- SvxBoxItem aOuter(ATTR_BORDER);
- SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
-
- ScDocument& rDoc = pDocShell->GetDocument();
- ScMarkData aMark(rDoc.GetSheetLimits());
- aMark.SetMarkArea( rFirst );
- aMark.SelectTable( rFirst.aStart.Tab(), true );
- rDoc.GetSelectionFrame( aMark, aOuter, aInner );
-
- if (pEntry->nWID == SC_WID_UNO_TBLBORD2)
- ScHelperFunctions::AssignTableBorder2ToAny( rAny, aOuter, aInner);
- else
- ScHelperFunctions::AssignTableBorderToAny( rAny, aOuter, aInner);
- }
+ ScDocument& rDoc = pDocShell->GetDocument();
+
+ sal_uLong nOldFormat =
+ pDataSet->Get( ATTR_VALUE_FORMAT ).GetValue();
+ LanguageType eOldLang =
+ pDataSet->Get( ATTR_LANGUAGE_FORMAT ).GetLanguage();
+ nOldFormat = rDoc.GetFormatTable()->
+ GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
+ rAny <<= static_cast<sal_Int32>(nOldFormat);
}
break;
- case SC_WID_UNO_CONDFMT:
- case SC_WID_UNO_CONDLOC:
- case SC_WID_UNO_CONDXML:
- {
- const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
- if ( pPattern )
- {
- ScDocument& rDoc = pDocShell->GetDocument();
- bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
- bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
- formula::FormulaGrammar::Grammar eGrammar = (bXML ?
- rDoc.GetStorageGrammar() :
- formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
- const ScCondFormatIndexes& rIndex =
- pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
- sal_uLong nIndex = 0;
- if(!rIndex.empty())
- nIndex = rIndex[0];
- rAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
- new ScTableConditionalFormat( &rDoc, nIndex, aRanges.front().aStart.Tab(), eGrammar ));
- }
- }
+ case ATTR_INDENT:
+ rAny <<= static_cast<sal_Int16>( TwipsToHMM(static_cast<const ScIndentItem&>(
+ pDataSet->Get(pEntry->nWID)).GetValue()) );
break;
- case SC_WID_UNO_VALIDAT:
- case SC_WID_UNO_VALILOC:
- case SC_WID_UNO_VALIXML:
+ case ATTR_STACKED:
{
- const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
- if ( pPattern )
- {
- ScDocument& rDoc = pDocShell->GetDocument();
- bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
- bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
- formula::FormulaGrammar::Grammar eGrammar = (bXML ?
- rDoc.GetStorageGrammar() :
- formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
- sal_uLong nIndex =
- pPattern->GetItem(ATTR_VALIDDATA).GetValue();
- rAny <<= uno::Reference<beans::XPropertySet>(
- new ScTableValidationObj( &rDoc, nIndex, eGrammar ));
- }
+ sal_Int32 nRot = pDataSet->Get(ATTR_ROTATE_VALUE).GetValue();
+ bool bStacked = static_cast<const ScVerticalStackCell&>(pDataSet->Get(pEntry->nWID)).GetValue();
+ SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( rAny );
}
break;
- case SC_WID_UNO_NUMRULES:
+ default:
+ pPropSet->getPropertyValue(*pEntry, *pDataSet, rAny);
+ }
+ }
+ }
+ else // implemented here
+ switch ( pEntry->nWID )
+ {
+ case SC_WID_UNO_CHCOLHDR:
+ rAny <<= bChartColAsHdr;
+ break;
+ case SC_WID_UNO_CHROWHDR:
+ rAny <<= bChartRowAsHdr;
+ break;
+ case SC_WID_UNO_CELLSTYL:
+ {
+ OUString aStyleName;
+ const ScStyleSheet* pStyle = pDocShell->GetDocument().GetSelectionStyle(*GetMarkData());
+ if (pStyle)
+ aStyleName = pStyle->GetName();
+ rAny <<= ScStyleNameConversion::DisplayToProgrammaticName(
+ aStyleName, SfxStyleFamily::Para );
+ }
+ break;
+ case SC_WID_UNO_TBLBORD:
+ case SC_WID_UNO_TBLBORD2:
+ {
+ //! loop through all ranges
+ if ( !aRanges.empty() )
{
- // always return empty numbering rules object
- rAny <<= ScStyleObj::CreateEmptyNumberingRules();
+ const ScRange & rFirst = aRanges[ 0 ];
+ SvxBoxItem aOuter(ATTR_BORDER);
+ SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
+
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScMarkData aMark(rDoc.GetSheetLimits());
+ aMark.SetMarkArea( rFirst );
+ aMark.SelectTable( rFirst.aStart.Tab(), true );
+ rDoc.GetSelectionFrame( aMark, aOuter, aInner );
+
+ if (pEntry->nWID == SC_WID_UNO_TBLBORD2)
+ ScHelperFunctions::AssignTableBorder2ToAny( rAny, aOuter, aInner);
+ else
+ ScHelperFunctions::AssignTableBorderToAny( rAny, aOuter, aInner);
}
- break;
- case SC_WID_UNO_ABSNAME:
+ }
+ break;
+ case SC_WID_UNO_CONDFMT:
+ case SC_WID_UNO_CONDLOC:
+ case SC_WID_UNO_CONDXML:
+ {
+ const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
+ if ( pPattern )
{
- OUString sRet;
- aRanges.Format(sRet, ScRefFlags::RANGE_ABS_3D, pDocShell->GetDocument());
- rAny <<= sRet;
+ ScDocument& rDoc = pDocShell->GetDocument();
+ bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
+ bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
+ formula::FormulaGrammar::Grammar eGrammar = (bXML ?
+ rDoc.GetStorageGrammar() :
+ formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
+ const ScCondFormatIndexes& rIndex =
+ pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
+ sal_uLong nIndex = 0;
+ if(!rIndex.empty())
+ nIndex = rIndex[0];
+ rAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
+ new ScTableConditionalFormat( &rDoc, nIndex, aRanges.front().aStart.Tab(), eGrammar ));
}
+ }
break;
- case SC_WID_UNO_FORMATID:
+ case SC_WID_UNO_VALIDAT:
+ case SC_WID_UNO_VALILOC:
+ case SC_WID_UNO_VALIXML:
+ {
+ const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
+ if ( pPattern )
{
- const ScPatternAttr* pPattern = GetCurrentAttrsFlat();
- rAny <<= pPattern->GetKey();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
+ bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
+ formula::FormulaGrammar::Grammar eGrammar = (bXML ?
+ rDoc.GetStorageGrammar() :
+ formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
+ sal_uLong nIndex =
+ pPattern->GetItem(ATTR_VALIDDATA).GetValue();
+ rAny <<= uno::Reference<beans::XPropertySet>(
+ new ScTableValidationObj( &rDoc, nIndex, eGrammar ));
}
+ }
break;
- }
- }
+ case SC_WID_UNO_NUMRULES:
+ {
+ // always return empty numbering rules object
+ rAny <<= ScStyleObj::CreateEmptyNumberingRules();
+ }
+ break;
+ case SC_WID_UNO_ABSNAME:
+ {
+ OUString sRet;
+ aRanges.Format(sRet, ScRefFlags::RANGE_ABS_3D, pDocShell->GetDocument());
+ rAny <<= sRet;
+ }
+ break;
+ case SC_WID_UNO_FORMATID:
+ {
+ const ScPatternAttr* pPattern = GetCurrentAttrsFlat();
+ rAny <<= pPattern->GetKey();
+ }
+ break;
+ }
}
void SAL_CALL ScCellRangesBase::addPropertyChangeListener( const OUString& /* aPropertyName */,
@@ -2577,80 +2577,80 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< OUString
if (nCount != nValues)
throw lang::IllegalArgumentException();
- if ( pDocShell && nCount )
- {
- const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
- const OUString* pNames = aPropertyNames.getConstArray();
- const uno::Any* pValues = aValues.getConstArray();
+ if ( !(pDocShell && nCount) )
+ return;
- std::unique_ptr<const SfxItemPropertySimpleEntry*[]> pEntryArray(new const SfxItemPropertySimpleEntry*[nCount]);
+ const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
+ const OUString* pNames = aPropertyNames.getConstArray();
+ const uno::Any* pValues = aValues.getConstArray();
- sal_Int32 i;
- for(i = 0; i < nCount; i++)
- {
- // first loop: find all properties in map, but handle only CellStyle
- // (CellStyle must be set before any other cell properties)
+ std::unique_ptr<const SfxItemPropertySimpleEntry*[]> pEntryArray(new const SfxItemPropertySimpleEntry*[nCount]);
- const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( pNames[i] );
- pEntryArray[i] = pEntry;
- if (pEntry)
+ sal_Int32 i;
+ for(i = 0; i < nCount; i++)
+ {
+ // first loop: find all properties in map, but handle only CellStyle
+ // (CellStyle must be set before any other cell properties)
+
+ const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( pNames[i] );
+ pEntryArray[i] = pEntry;
+ if (pEntry)
+ {
+ if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
{
- if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
+ try
{
- try
- {
- SetOnePropertyValue( pEntry, pValues[i] );
- }
- catch ( lang::IllegalArgumentException& )
- {
- OSL_FAIL("exception when setting cell style"); // not supposed to happen
- }
+ SetOnePropertyValue( pEntry, pValues[i] );
+ }
+ catch ( lang::IllegalArgumentException& )
+ {
+ OSL_FAIL("exception when setting cell style"); // not supposed to happen
}
}
}
+ }
- ScDocument& rDoc = pDocShell->GetDocument();
- std::unique_ptr<ScPatternAttr> pOldPattern;
- std::unique_ptr<ScPatternAttr> pNewPattern;
+ ScDocument& rDoc = pDocShell->GetDocument();
+ std::unique_ptr<ScPatternAttr> pOldPattern;
+ std::unique_ptr<ScPatternAttr> pNewPattern;
- for(i = 0; i < nCount; i++)
- {
- // second loop: handle other properties
+ for(i = 0; i < nCount; i++)
+ {
+ // second loop: handle other properties
- const SfxItemPropertySimpleEntry* pEntry = pEntryArray[i];
- if ( pEntry )
+ const SfxItemPropertySimpleEntry* pEntry = pEntryArray[i];
+ if ( pEntry )
+ {
+ if ( IsScItemWid( pEntry->nWID ) ) // can be handled by SfxItemPropertySet
{
- if ( IsScItemWid( pEntry->nWID ) ) // can be handled by SfxItemPropertySet
+ if ( !pOldPattern )
{
- if ( !pOldPattern )
- {
- pOldPattern.reset(new ScPatternAttr( *GetCurrentAttrsDeep() ));
- pOldPattern->GetItemSet().ClearInvalidItems();
- pNewPattern.reset(new ScPatternAttr( rDoc.GetPool() ));
- }
+ pOldPattern.reset(new ScPatternAttr( *GetCurrentAttrsDeep() ));
+ pOldPattern->GetItemSet().ClearInvalidItems();
+ pNewPattern.reset(new ScPatternAttr( rDoc.GetPool() ));
+ }
- // collect items in pNewPattern, apply with one call after the loop
+ // collect items in pNewPattern, apply with one call after the loop
- sal_uInt16 nFirstItem, nSecondItem;
- lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, rDoc, nFirstItem, nSecondItem );
+ sal_uInt16 nFirstItem, nSecondItem;
+ lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, rDoc, nFirstItem, nSecondItem );
- // put only affected items into new set
- if ( nFirstItem )
- pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nFirstItem ) );
- if ( nSecondItem )
- pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nSecondItem ) );
- }
- else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
- {
- // call virtual method to set a single property
- SetOnePropertyValue( pEntry, pValues[i] );
- }
+ // put only affected items into new set
+ if ( nFirstItem )
+ pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nFirstItem ) );
+ if ( nSecondItem )
+ pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nSecondItem ) );
+ }
+ else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
+ {
+ // call virtual method to set a single property
+ SetOnePropertyValue( pEntry, pValues[i] );
}
}
-
- if ( pNewPattern && !aRanges.empty() )
- pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern, true );
}
+
+ if ( pNewPattern && !aRanges.empty() )
+ pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern, true );
}
uno::Sequence<uno::Any> SAL_CALL ScCellRangesBase::getPropertyValues(
@@ -3238,23 +3238,23 @@ void SAL_CALL ScCellRangesBase::addChartDataChangeEventListener( const uno::Refe
chart::XChartDataChangeEventListener >& aListener )
{
SolarMutexGuard aGuard;
- if ( pDocShell && !aRanges.empty() )
- {
- //! test for duplicates ?
+ if ( !(pDocShell && !aRanges.empty()) )
+ return;
- ScDocument& rDoc = pDocShell->GetDocument();
- ScRangeListRef aRangesRef( new ScRangeList(aRanges) );
- ScChartListenerCollection* pColl = rDoc.GetChartListenerCollection();
- OUString aName = pColl->getUniqueName("__Uno");
- if (aName.isEmpty())
- // failed to create unique name.
- return;
+ //! test for duplicates ?
- ScChartListener* pListener = new ScChartListener( aName, &rDoc, aRangesRef );
- pListener->SetUno( aListener, this );
- pColl->insert( pListener );
- pListener->StartListeningTo();
- }
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScRangeListRef aRangesRef( new ScRangeList(aRanges) );
+ ScChartListenerCollection* pColl = rDoc.GetChartListenerCollection();
+ OUString aName = pColl->getUniqueName("__Uno");
+ if (aName.isEmpty())
+ // failed to create unique name.
+ return;
+
+ ScChartListener* pListener = new ScChartListener( aName, &rDoc, aRangesRef );
+ pListener->SetUno( aListener, this );
+ pColl->insert( pListener );
+ pListener->StartListeningTo();
}
void SAL_CALL ScCellRangesBase::removeChartDataChangeEventListener( const uno::Reference<
@@ -4871,26 +4871,26 @@ void ScCellRangeObj::SetArrayFormula_Impl(const OUString& rFormula,
const formula::FormulaGrammar::Grammar eGrammar)
{
ScDocShell* pDocSh = GetDocShell();
- if (pDocSh)
- {
- if ( !rFormula.isEmpty() )
- {
- if ( comphelper::getUnoTunnelImplementation<ScTableSheetObj>( static_cast<cppu::OWeakObject*>(this) ) )
- {
- // don't set array formula for sheet object
- throw uno::RuntimeException();
- }
+ if (!pDocSh)
+ return;
- pDocSh->GetDocFunc().EnterMatrix( aRange, nullptr, nullptr, rFormula, true, true, OUString()/*rFormulaNmsp*/, eGrammar );
- }
- else
+ if ( !rFormula.isEmpty() )
+ {
+ if ( comphelper::getUnoTunnelImplementation<ScTableSheetObj>( static_cast<cppu::OWeakObject*>(this) ) )
{
- // empty string -> erase array formula
- ScMarkData aMark(GetDocument()->GetSheetLimits());
- aMark.SetMarkArea( aRange );
- aMark.SelectTable( aRange.aStart.Tab(), true );
- pDocSh->GetDocFunc().DeleteContents( aMark, InsertDeleteFlags::CONTENTS, true, true );
+ // don't set array formula for sheet object
+ throw uno::RuntimeException();
}
+
+ pDocSh->GetDocFunc().EnterMatrix( aRange, nullptr, nullptr, rFormula, true, true, OUString()/*rFormulaNmsp*/, eGrammar );
+ }
+ else
+ {
+ // empty string -> erase array formula
+ ScMarkData aMark(GetDocument()->GetSheetLimits());
+ aMark.SetMarkArea( aRange );
+ aMark.SelectTable( aRange.aStart.Tab(), true );
+ pDocSh->GetDocFunc().DeleteContents( aMark, InsertDeleteFlags::CONTENTS, true, true );
}
}
@@ -4940,32 +4940,32 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
+ if ( !pDocSh )
+ return;
+
+ if ( rTokens.hasElements() )
{
- if ( rTokens.hasElements() )
+ if ( comphelper::getUnoTunnelImplementation<ScTableSheetObj>( static_cast<cppu::OWeakObject*>(this) ) )
{
- if ( comphelper::getUnoTunnelImplementation<ScTableSheetObj>( static_cast<cppu::OWeakObject*>(this) ) )
- {
- throw uno::RuntimeException();
- }
+ throw uno::RuntimeException();
+ }
- ScDocument& rDoc = pDocSh->GetDocument();
- ScTokenArray aTokenArray(&rDoc);
- (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
+ ScDocument& rDoc = pDocSh->GetDocument();
+ ScTokenArray aTokenArray(&rDoc);
+ (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
- // Actually GRAM_API is a don't-care here because of the token
- // array being set, it fits with other API compatibility grammars
- // though.
- pDocSh->GetDocFunc().EnterMatrix( aRange, nullptr, &aTokenArray, EMPTY_OUSTRING, true, true, EMPTY_OUSTRING, formula::FormulaGrammar::GRAM_API );
- }
- else
- {
- // empty sequence -> erase array formula
- ScMarkData aMark(pDocSh->GetDocument().GetSheetLimits());
- aMark.SetMarkArea( aRange );
- aMark.SelectTable( aRange.aStart.Tab(), true );
- pDocSh->GetDocFunc().DeleteContents( aMark, InsertDeleteFlags::CONTENTS, true, true );
- }
+ // Actually GRAM_API is a don't-care here because of the token
+ // array being set, it fits with other API compatibility grammars
+ // though.
+ pDocSh->GetDocFunc().EnterMatrix( aRange, nullptr, &aTokenArray, EMPTY_OUSTRING, true, true, EMPTY_OUSTRING, formula::FormulaGrammar::GRAM_API );
+ }
+ else
+ {
+ // empty sequence -> erase array formula
+ ScMarkData aMark(pDocSh->GetDocument().GetSheetLimits());
+ aMark.SetMarkArea( aRange );
+ aMark.SelectTable( aRange.aStart.Tab(), true );
+ pDocSh->GetDocFunc().DeleteContents( aMark, InsertDeleteFlags::CONTENTS, true, true );
}
}
@@ -5084,37 +5084,37 @@ void SAL_CALL ScCellRangeObj::setTableOperation( const table::CellRangeAddress&
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if (pDocSh)
- {
- bool bError = false;
- ScTabOpParam aParam;
- aParam.aRefFormulaCell = ScRefAddress( static_cast<SCCOL>(aFormulaRange.StartColumn),
- static_cast<SCROW>(aFormulaRange.StartRow), aFormulaRange.Sheet );
- aParam.aRefFormulaEnd = ScRefAddress( static_cast<SCCOL>(aFormulaRange.EndColumn),
- static_cast<SCROW>(aFormulaRange.EndRow), aFormulaRange.Sheet );
- aParam.aRefRowCell = ScRefAddress( static_cast<SCCOL>(aRowCell.Column),
- static_cast<SCROW>(aRowCell.Row), aRowCell.Sheet );
- aParam.aRefColCell = ScRefAddress( static_cast<SCCOL>(aColumnCell.Column),
- static_cast<SCROW>(aColumnCell.Row), aColumnCell.Sheet );
-
- switch (nMode)
- {
- case sheet::TableOperationMode_COLUMN:
- aParam.meMode = ScTabOpParam::Column;
- break;
- case sheet::TableOperationMode_ROW:
- aParam.meMode = ScTabOpParam::Row;
- break;
- case sheet::TableOperationMode_BOTH:
- aParam.meMode = ScTabOpParam::Both;
- break;
- default:
- bError = true;
- }
+ if (!pDocSh)
+ return;
- if (!bError)
- pDocSh->GetDocFunc().TabOp( aRange, nullptr, aParam, true, true );
+ bool bError = false;
+ ScTabOpParam aParam;
+ aParam.aRefFormulaCell = ScRefAddress( static_cast<SCCOL>(aFormulaRange.StartColumn),
+ static_cast<SCROW>(aFormulaRange.StartRow), aFormulaRange.Sheet );
+ aParam.aRefFormulaEnd = ScRefAddress( static_cast<SCCOL>(aFormulaRange.EndColumn),
+ static_cast<SCROW>(aFormulaRange.EndRow), aFormulaRange.Sheet );
+ aParam.aRefRowCell = ScRefAddress( static_cast<SCCOL>(aRowCell.Column),
+ static_cast<SCROW>(aRowCell.Row), aRowCell.Sheet );
+ aParam.aRefColCell = ScRefAddress( static_cast<SCCOL>(aColumnCell.Column),
+ static_cast<SCROW>(aColumnCell.Row), aColumnCell.Sheet );
+
+ switch (nMode)
+ {
+ case sheet::TableOperationMode_COLUMN:
+ aParam.meMode = ScTabOpParam::Column;
+ break;
+ case sheet::TableOperationMode_ROW:
+ aParam.meMode = ScTabOpParam::Row;
+ break;
+ case sheet::TableOperationMode_BOTH:
+ aParam.meMode = ScTabOpParam::Both;
+ break;
+ default:
+ bError = true;
}
+
+ if (!bError)
+ pDocSh->GetDocFunc().TabOp( aRange, nullptr, aParam, true, true );
}
// XMergeable
@@ -5123,19 +5123,19 @@ void SAL_CALL ScCellRangeObj::merge( sal_Bool bMerge )
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- ScCellMergeOption aMergeOption(
- aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row(), false);
- aMergeOption.maTabs.insert(aRange.aStart.Tab());
- if ( bMerge )
- pDocSh->GetDocFunc().MergeCells( aMergeOption, false, true, true );
- else
- pDocSh->GetDocFunc().UnmergeCells( aMergeOption, true, nullptr );
+ if ( !pDocSh )
+ return;
- //! Catch error?
- }
+ ScCellMergeOption aMergeOption(
+ aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aEnd.Col(), aRange.aEnd.Row(), false);
+ aMergeOption.maTabs.insert(aRange.aStart.Tab());
+ if ( bMerge )
+ pDocSh->GetDocFunc().MergeCells( aMergeOption, false, true, true );
+ else
+ pDocSh->GetDocFunc().UnmergeCells( aMergeOption, true, nullptr );
+
+ //! Catch error?
}
sal_Bool SAL_CALL ScCellRangeObj::getIsMerged()
@@ -5153,74 +5153,74 @@ void SAL_CALL ScCellRangeObj::fillSeries( sheet::FillDirection nFillDirection,
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- bool bError = false;
+ if ( !pDocSh )
+ return;
- FillDir eDir = FILL_TO_BOTTOM;
- switch (nFillDirection)
- {
- case sheet::FillDirection_TO_BOTTOM:
- eDir = FILL_TO_BOTTOM;
- break;
- case sheet::FillDirection_TO_RIGHT:
- eDir = FILL_TO_RIGHT;
- break;
- case sheet::FillDirection_TO_TOP:
- eDir = FILL_TO_TOP;
- break;
- case sheet::FillDirection_TO_LEFT:
- eDir = FILL_TO_LEFT;
- break;
- default:
- bError = true;
- }
+ bool bError = false;
- FillCmd eCmd = FILL_SIMPLE;
- switch ( nFillMode )
- {
- case sheet::FillMode_SIMPLE:
- eCmd = FILL_SIMPLE;
- break;
- case sheet::FillMode_LINEAR:
- eCmd = FILL_LINEAR;
- break;
- case sheet::FillMode_GROWTH:
- eCmd = FILL_GROWTH;
- break;
- case sheet::FillMode_DATE:
- eCmd = FILL_DATE;
- break;
- case sheet::FillMode_AUTO:
- eCmd = FILL_AUTO;
- break;
- default:
- bError = true;
- }
+ FillDir eDir = FILL_TO_BOTTOM;
+ switch (nFillDirection)
+ {
+ case sheet::FillDirection_TO_BOTTOM:
+ eDir = FILL_TO_BOTTOM;
+ break;
+ case sheet::FillDirection_TO_RIGHT:
+ eDir = FILL_TO_RIGHT;
+ break;
+ case sheet::FillDirection_TO_TOP:
+ eDir = FILL_TO_TOP;
+ break;
+ case sheet::FillDirection_TO_LEFT:
+ eDir = FILL_TO_LEFT;
+ break;
+ default:
+ bError = true;
+ }
- FillDateCmd eDateCmd = FILL_DAY;
- switch ( nFillDateMode )
- {
- case sheet::FillDateMode_FILL_DATE_DAY:
- eDateCmd = FILL_DAY;
- break;
- case sheet::FillDateMode_FILL_DATE_WEEKDAY:
- eDateCmd = FILL_WEEKDAY;
- break;
- case sheet::FillDateMode_FILL_DATE_MONTH:
- eDateCmd = FILL_MONTH;
- break;
- case sheet::FillDateMode_FILL_DATE_YEAR:
- eDateCmd = FILL_YEAR;
- break;
- default:
- bError = true;
- }
+ FillCmd eCmd = FILL_SIMPLE;
+ switch ( nFillMode )
+ {
+ case sheet::FillMode_SIMPLE:
+ eCmd = FILL_SIMPLE;
+ break;
+ case sheet::FillMode_LINEAR:
+ eCmd = FILL_LINEAR;
+ break;
+ case sheet::FillMode_GROWTH:
+ eCmd = FILL_GROWTH;
+ break;
+ case sheet::FillMode_DATE:
+ eCmd = FILL_DATE;
+ break;
+ case sheet::FillMode_AUTO:
+ eCmd = FILL_AUTO;
+ break;
+ default:
+ bError = true;
+ }
- if (!bError)
- pDocSh->GetDocFunc().FillSeries( aRange, nullptr, eDir, eCmd, eDateCmd,
- MAXDOUBLE, fStep, fEndValue, true );
+ FillDateCmd eDateCmd = FILL_DAY;
+ switch ( nFillDateMode )
+ {
+ case sheet::FillDateMode_FILL_DATE_DAY:
+ eDateCmd = FILL_DAY;
+ break;
+ case sheet::FillDateMode_FILL_DATE_WEEKDAY:
+ eDateCmd = FILL_WEEKDAY;
+ break;
+ case sheet::FillDateMode_FILL_DATE_MONTH:
+ eDateCmd = FILL_MONTH;
+ break;
+ case sheet::FillDateMode_FILL_DATE_YEAR:
+ eDateCmd = FILL_YEAR;
+ break;
+ default:
+ bError = true;
}
+
+ if (!bError)
+ pDocSh->GetDocFunc().FillSeries( aRange, nullptr, eDir, eCmd, eDateCmd,
+ MAXDOUBLE, fStep, fEndValue, true );
}
void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
@@ -5228,44 +5228,44 @@ void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh && nSourceCount )
- {
- ScRange aSourceRange(aRange);
- SCCOLROW nCount = 0; // "Dest-Count"
- FillDir eDir = FILL_TO_BOTTOM;
- bool bError = false;
- switch (nFillDirection)
- {
- case sheet::FillDirection_TO_BOTTOM:
- aSourceRange.aEnd.SetRow( static_cast<SCROW>( aSourceRange.aStart.Row() + nSourceCount - 1 ) );
- nCount = aRange.aEnd.Row() - aSourceRange.aEnd.Row();
- eDir = FILL_TO_BOTTOM;
- break;
- case sheet::FillDirection_TO_RIGHT:
- aSourceRange.aEnd.SetCol( static_cast<SCCOL>( aSourceRange.aStart.Col() + nSourceCount - 1 ) );
- nCount = aRange.aEnd.Col() - aSourceRange.aEnd.Col();
- eDir = FILL_TO_RIGHT;
- break;
- case sheet::FillDirection_TO_TOP:
- aSourceRange.aStart.SetRow( static_cast<SCROW>( aSourceRange.aEnd.Row() - nSourceCount + 1 ) );
- nCount = aSourceRange.aStart.Row() - aRange.aStart.Row();
- eDir = FILL_TO_TOP;
- break;
- case sheet::FillDirection_TO_LEFT:
- aSourceRange.aStart.SetCol( static_cast<SCCOL>( aSourceRange.aEnd.Col() - nSourceCount + 1 ) );
- nCount = aSourceRange.aStart.Col() - aRange.aStart.Col();
- eDir = FILL_TO_LEFT;
- break;
- default:
- bError = true;
- }
- const ScDocument& rDoc = pDocSh->GetDocument();
- if (nCount < 0 || nCount > rDoc.MaxRow()) // overflow
- bError = true;
+ if ( !(pDocSh && nSourceCount) )
+ return;
- if (!bError)
- pDocSh->GetDocFunc().FillAuto( aSourceRange, nullptr, eDir, nCount, true );
+ ScRange aSourceRange(aRange);
+ SCCOLROW nCount = 0; // "Dest-Count"
+ FillDir eDir = FILL_TO_BOTTOM;
+ bool bError = false;
+ switch (nFillDirection)
+ {
+ case sheet::FillDirection_TO_BOTTOM:
+ aSourceRange.aEnd.SetRow( static_cast<SCROW>( aSourceRange.aStart.Row() + nSourceCount - 1 ) );
+ nCount = aRange.aEnd.Row() - aSourceRange.aEnd.Row();
+ eDir = FILL_TO_BOTTOM;
+ break;
+ case sheet::FillDirection_TO_RIGHT:
+ aSourceRange.aEnd.SetCol( static_cast<SCCOL>( aSourceRange.aStart.Col() + nSourceCount - 1 ) );
+ nCount = aRange.aEnd.Col() - aSourceRange.aEnd.Col();
+ eDir = FILL_TO_RIGHT;
+ break;
+ case sheet::FillDirection_TO_TOP:
+ aSourceRange.aStart.SetRow( static_cast<SCROW>( aSourceRange.aEnd.Row() - nSourceCount + 1 ) );
+ nCount = aSourceRange.aStart.Row() - aRange.aStart.Row();
+ eDir = FILL_TO_TOP;
+ break;
+ case sheet::FillDirection_TO_LEFT:
+ aSourceRange.aStart.SetCol( static_cast<SCCOL>( aSourceRange.aEnd.Col() - nSourceCount + 1 ) );
+ nCount = aSourceRange.aStart.Col() - aRange.aStart.Col();
+ eDir = FILL_TO_LEFT;
+ break;
+ default:
+ bError = true;
}
+ const ScDocument& rDoc = pDocSh->GetDocument();
+ if (nCount < 0 || nCount > rDoc.MaxRow()) // overflow
+ bError = true;
+
+ if (!bError)
+ pDocSh->GetDocFunc().FillAuto( aSourceRange, nullptr, eDir, nCount, true );
}
// XAutoFormattable
@@ -5324,52 +5324,52 @@ void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& a
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if (pDocSh)
- {
- sal_uInt16 i;
- ScSortParam aParam;
- ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
- if (pData)
- {
- // get old settings if not everything is set anew
- pData->GetSortParam(aParam);
- SCCOLROW nOldStart = aParam.bByRow ?
- static_cast<SCCOLROW>(aRange.aStart.Col()) :
- static_cast<SCCOLROW>(aRange.aStart.Row());
- for (i=0; i<aParam.GetSortKeyCount(); i++)
- if ( aParam.maKeyState[i].bDoSort && aParam.maKeyState[i].nField >= nOldStart )
- aParam.maKeyState[i].nField -= nOldStart;
- }
-
- ScSortDescriptor::FillSortParam( aParam, aDescriptor );
+ if (!pDocSh)
+ return;
- // SortDescriptor contains the counted fields inside the area
- // ByRow can be changed during execution of FillSortParam
- SCCOLROW nFieldStart = aParam.bByRow ?
+ sal_uInt16 i;
+ ScSortParam aParam;
+ ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
+ if (pData)
+ {
+ // get old settings if not everything is set anew
+ pData->GetSortParam(aParam);
+ SCCOLROW nOldStart = aParam.bByRow ?
static_cast<SCCOLROW>(aRange.aStart.Col()) :
static_cast<SCCOLROW>(aRange.aStart.Row());
- SCCOLROW nFieldEnd = aParam.bByRow ?
- static_cast<SCCOLROW>(aRange.aEnd.Col()) :
- static_cast<SCCOLROW>(aRange.aEnd.Row());
for (i=0; i<aParam.GetSortKeyCount(); i++)
- {
- aParam.maKeyState[i].nField += nFieldStart;
- // tdf#103632 - sanity check poorly behaved macros.
- if (aParam.maKeyState[i].nField > nFieldEnd)
- aParam.maKeyState[i].nField = nFieldEnd;
- }
-
- SCTAB nTab = aRange.aStart.Tab();
- aParam.nCol1 = aRange.aStart.Col();
- aParam.nRow1 = aRange.aStart.Row();
- aParam.nCol2 = aRange.aEnd.Col();
- aParam.nRow2 = aRange.aEnd.Row();
+ if ( aParam.maKeyState[i].bDoSort && aParam.maKeyState[i].nField >= nOldStart )
+ aParam.maKeyState[i].nField -= nOldStart;
+ }
- pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
+ ScSortDescriptor::FillSortParam( aParam, aDescriptor );
- ScDBDocFunc aFunc(*pDocSh); // area must be created
- (void)aFunc.Sort( nTab, aParam, true, true, true );
+ // SortDescriptor contains the counted fields inside the area
+ // ByRow can be changed during execution of FillSortParam
+ SCCOLROW nFieldStart = aParam.bByRow ?
+ static_cast<SCCOLROW>(aRange.aStart.Col()) :
+ static_cast<SCCOLROW>(aRange.aStart.Row());
+ SCCOLROW nFieldEnd = aParam.bByRow ?
+ static_cast<SCCOLROW>(aRange.aEnd.Col()) :
+ static_cast<SCCOLROW>(aRange.aEnd.Row());
+ for (i=0; i<aParam.GetSortKeyCount(); i++)
+ {
+ aParam.maKeyState[i].nField += nFieldStart;
+ // tdf#103632 - sanity check poorly behaved macros.
+ if (aParam.maKeyState[i].nField > nFieldEnd)
+ aParam.maKeyState[i].nField = nFieldEnd;
}
+
+ SCTAB nTab = aRange.aStart.Tab();
+ aParam.nCol1 = aRange.aStart.Col();
+ aParam.nRow1 = aRange.aStart.Row();
+ aParam.nCol2 = aRange.aEnd.Col();
+ aParam.nRow2 = aRange.aEnd.Row();
+
+ pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
+
+ ScDBDocFunc aFunc(*pDocSh); // area must be created
+ (void)aFunc.Sort( nTab, aParam, true, true, true );
}
// XFilterable
@@ -5435,48 +5435,48 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe
if (xPropSet.is())
lcl_CopyProperties(*xImpl, *xPropSet);
- if (pDocSh)
+ if (!pDocSh)
+ return;
+
+ ScQueryParam aParam = xImpl->GetParam();
+ // FilterDescriptor contains the counted fields inside the area
+ SCCOLROW nFieldStart = aParam.bByRow ?
+ static_cast<SCCOLROW>(aRange.aStart.Col()) :
+ static_cast<SCCOLROW>(aRange.aStart.Row());
+ SCSIZE nCount = aParam.GetEntryCount();
+ svl::SharedStringPool& rPool = pDocSh->GetDocument().GetSharedStringPool();
+ for (SCSIZE i=0; i<nCount; i++)
{
- ScQueryParam aParam = xImpl->GetParam();
- // FilterDescriptor contains the counted fields inside the area
- SCCOLROW nFieldStart = aParam.bByRow ?
- static_cast<SCCOLROW>(aRange.aStart.Col()) :
- static_cast<SCCOLROW>(aRange.aStart.Row());
- SCSIZE nCount = aParam.GetEntryCount();
- svl::SharedStringPool& rPool = pDocSh->GetDocument().GetSharedStringPool();
- for (SCSIZE i=0; i<nCount; i++)
- {
- ScQueryEntry& rEntry = aParam.GetEntry(i);
- if (rEntry.bDoQuery)
+ ScQueryEntry& rEntry = aParam.GetEntry(i);
+ if (rEntry.bDoQuery)
+ {
+ rEntry.nField += nFieldStart;
+ // dialog always shows the string -> must match the value
+ ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
+ rItems.resize(1);
+ ScQueryEntry::Item& rItem = rItems.front();
+ if (rItem.meType != ScQueryEntry::ByString)
{
- rEntry.nField += nFieldStart;
- // dialog always shows the string -> must match the value
- ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
- rItems.resize(1);
- ScQueryEntry::Item& rItem = rItems.front();
- if (rItem.meType != ScQueryEntry::ByString)
- {
- OUString aStr;
- pDocSh->GetDocument().GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr);
- rItem.maString = rPool.intern(aStr);
- }
+ OUString aStr;
+ pDocSh->GetDocument().GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr);
+ rItem.maString = rPool.intern(aStr);
}
}
+ }
- SCTAB nTab = aRange.aStart.Tab();
- aParam.nCol1 = aRange.aStart.Col();
- aParam.nRow1 = aRange.aStart.Row();
- aParam.nCol2 = aRange.aEnd.Col();
- aParam.nRow2 = aRange.aEnd.Row();
+ SCTAB nTab = aRange.aStart.Tab();
+ aParam.nCol1 = aRange.aStart.Col();
+ aParam.nRow1 = aRange.aStart.Row();
+ aParam.nCol2 = aRange.aEnd.Col();
+ aParam.nRow2 = aRange.aEnd.Row();
- pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
+ pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
- //! keep source range in filter descriptor
- //! if created by createFilterDescriptorByObject ???
+ //! keep source range in filter descriptor
+ //! if created by createFilterDescriptorByObject ???
- ScDBDocFunc aFunc(*pDocSh);
- aFunc.Query( nTab, aParam, nullptr, true, true ); // area must be created
- }
+ ScDBDocFunc aFunc(*pDocSh);
+ aFunc.Query( nTab, aParam, nullptr, true, true ); // area must be created
}
//! get/setAutoFilter as properties!!!
@@ -5583,36 +5583,36 @@ void SAL_CALL ScCellRangeObj::applySubTotals(
ScSubTotalDescriptorBase* pImp =
comphelper::getUnoTunnelImplementation<ScSubTotalDescriptorBase>( xDescriptor );
- if (pDocSh && pImp)
- {
- ScSubTotalParam aParam;
- pImp->GetData(aParam); // virtual method of base class
+ if (!(pDocSh && pImp))
+ return;
- // SubTotalDescriptor contains the counted fields inside the area
- SCCOL nFieldStart = aRange.aStart.Col();
- for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
+ ScSubTotalParam aParam;
+ pImp->GetData(aParam); // virtual method of base class
+
+ // SubTotalDescriptor contains the counted fields inside the area
+ SCCOL nFieldStart = aRange.aStart.Col();
+ for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
+ {
+ if ( aParam.bGroupActive[i] )
{
- if ( aParam.bGroupActive[i] )
- {
- aParam.nField[i] = sal::static_int_cast<SCCOL>( aParam.nField[i] + nFieldStart );
- for (SCCOL j=0; j<aParam.nSubTotals[i]; j++)
- aParam.pSubTotals[i][j] = sal::static_int_cast<SCCOL>( aParam.pSubTotals[i][j] + nFieldStart );
- }
+ aParam.nField[i] = sal::static_int_cast<SCCOL>( aParam.nField[i] + nFieldStart );
+ for (SCCOL j=0; j<aParam.nSubTotals[i]; j++)
+ aParam.pSubTotals[i][j] = sal::static_int_cast<SCCOL>( aParam.pSubTotals[i][j] + nFieldStart );
}
+ }
- aParam.bReplace = bReplace;
+ aParam.bReplace = bReplace;
- SCTAB nTab = aRange.aStart.Tab();
- aParam.nCol1 = aRange.aStart.Col();
- aParam.nRow1 = aRange.aStart.Row();
- aParam.nCol2 = aRange.aEnd.Col();
- aParam.nRow2 = aRange.aEnd.Row();
+ SCTAB nTab = aRange.aStart.Tab();
+ aParam.nCol1 = aRange.aStart.Col();
+ aParam.nRow1 = aRange.aStart.Row();
+ aParam.nCol2 = aRange.aEnd.Col();
+ aParam.nRow2 = aRange.aEnd.Row();
- pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
+ pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
- ScDBDocFunc aFunc(*pDocSh);
- aFunc.DoSubTotals( nTab, aParam, true, true ); // area must be created
- }
+ ScDBDocFunc aFunc(*pDocSh);
+ aFunc.DoSubTotals( nTab, aParam, true, true ); // area must be created
}
void SAL_CALL ScCellRangeObj::removeSubTotals()
@@ -5620,26 +5620,26 @@ void SAL_CALL ScCellRangeObj::removeSubTotals()
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if (pDocSh)
- {
- ScSubTotalParam aParam;
- ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, ScGetDBSelection::ForceMark );
- if (pData)
- pData->GetSubTotalParam(aParam); // also keep field entries during remove
+ if (!pDocSh)
+ return;
- aParam.bRemoveOnly = true;
+ ScSubTotalParam aParam;
+ ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, ScGetDBSelection::ForceMark );
+ if (pData)
+ pData->GetSubTotalParam(aParam); // also keep field entries during remove
- SCTAB nTab = aRange.aStart.Tab();
- aParam.nCol1 = aRange.aStart.Col();
- aParam.nRow1 = aRange.aStart.Row();
- aParam.nCol2 = aRange.aEnd.Col();
- aParam.nRow2 = aRange.aEnd.Row();
+ aParam.bRemoveOnly = true;
- pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
+ SCTAB nTab = aRange.aStart.Tab();
+ aParam.nCol1 = aRange.aStart.Col();
+ aParam.nRow1 = aRange.aStart.Row();
+ aParam.nCol2 = aRange.aEnd.Col();
+ aParam.nRow2 = aRange.aEnd.Row();
- ScDBDocFunc aFunc(*pDocSh);
- aFunc.DoSubTotals( nTab, aParam, true, true ); // are must be created
- }
+ pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
+
+ ScDBDocFunc aFunc(*pDocSh);
+ aFunc.DoSubTotals( nTab, aParam, true, true ); // are must be created
}
uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createImportDescriptor( sal_Bool bEmpty )
@@ -5664,24 +5664,24 @@ void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence<beans::PropertyValue
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if (pDocSh)
- {
- ScImportParam aParam;
- ScImportDescriptor::FillImportParam( aParam, aDescriptor );
+ if (!pDocSh)
+ return;
- SCTAB nTab = aRange.aStart.Tab();
- aParam.nCol1 = aRange.aStart.Col();
- aParam.nRow1 = aRange.aStart.Row();
- aParam.nCol2 = aRange.aEnd.Col();
- aParam.nRow2 = aRange.aEnd.Row();
+ ScImportParam aParam;
+ ScImportDescriptor::FillImportParam( aParam, aDescriptor );
- //! TODO: could we get passed a valid result set by any means?
+ SCTAB nTab = aRange.aStart.Tab();
+ aParam.nCol1 = aRange.aStart.Col();
+ aParam.nRow1 = aRange.aStart.Row();
+ aParam.nCol2 = aRange.aEnd.Col();
+ aParam.nRow2 = aRange.aEnd.Row();
- pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
+ //! TODO: could we get passed a valid result set by any means?
- ScDBDocFunc aFunc(*pDocSh); // are must be created
- aFunc.DoImport( nTab, aParam, nullptr ); //! Api-Flag as parameter
- }
+ pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
+
+ ScDBDocFunc aFunc(*pDocSh); // are must be created
+ aFunc.DoImport( nTab, aParam, nullptr ); //! Api-Flag as parameter
}
// XCellFormatRangesSupplier
@@ -5726,38 +5726,38 @@ void ScCellRangeObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEnt
void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, uno::Any& rAny )
{
- if ( pEntry )
+ if ( !pEntry )
+ return;
+
+ if ( pEntry->nWID == SC_WID_UNO_POS )
{
- if ( pEntry->nWID == SC_WID_UNO_POS )
+ ScDocShell* pDocSh = GetDocShell();
+ if (pDocSh)
{
- ScDocShell* pDocSh = GetDocShell();
- if (pDocSh)
- {
- // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
- tools::Rectangle aMMRect(pDocSh->GetDocument().GetMMRect(
- aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() ));
- awt::Point aPos( aMMRect.Left(), aMMRect.Top() );
- rAny <<= aPos;
- }
+ // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
+ tools::Rectangle aMMRect(pDocSh->GetDocument().GetMMRect(
+ aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() ));
+ awt::Point aPos( aMMRect.Left(), aMMRect.Top() );
+ rAny <<= aPos;
}
- else if ( pEntry->nWID == SC_WID_UNO_SIZE )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_SIZE )
+ {
+ ScDocShell* pDocSh = GetDocShell();
+ if (pDocSh)
{
- ScDocShell* pDocSh = GetDocShell();
- if (pDocSh)
- {
- // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
- tools::Rectangle aMMRect = pDocSh->GetDocument().GetMMRect(
- aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() );
- Size aSize(aMMRect.GetSize());
- awt::Size aAwtSize( aSize.Width(), aSize.Height() );
- rAny <<= aAwtSize;
- }
+ // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
+ tools::Rectangle aMMRect = pDocSh->GetDocument().GetMMRect(
+ aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() );
+ Size aSize(aMMRect.GetSize());
+ awt::Size aAwtSize( aSize.Width(), aSize.Height() );
+ rAny <<= aAwtSize;
}
- else
- ScCellRangesBase::GetOnePropertyValue( pEntry, rAny );
}
+ else
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list