summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-09 11:54:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-09 15:48:32 +0200
commit0e1264f44ce421f6b175598fff68a15ccc8b5449 (patch)
tree205188c2842de6f539d7fef504b5520c58996950 /sc
parentf97077c5fe41195bf2054892ae08e3307983e6dc (diff)
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@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/unoobj/TablePivotCharts.cxx98
-rw-r--r--sc/source/ui/unoobj/afmtuno.cxx182
-rw-r--r--sc/source/ui/unoobj/appluno.cxx52
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx3200
-rw-r--r--sc/source/ui/unoobj/cellvaluebinding.cxx66
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx106
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx164
-rw-r--r--sc/source/ui/unoobj/cursuno.cxx144
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx605
-rw-r--r--sc/source/ui/unoobj/datauno.cxx342
-rw-r--r--sc/source/ui/unoobj/dispuno.cxx110
-rw-r--r--sc/source/ui/unoobj/docuno.cxx562
-rw-r--r--sc/source/ui/unoobj/editsrc.cxx32
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx40
-rw-r--r--sc/source/ui/unoobj/fmtuno.cxx64
-rw-r--r--sc/source/ui/unoobj/linkuno.cxx108
-rw-r--r--sc/source/ui/unoobj/nameuno.cxx124
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx728
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx444
19 files changed, 3588 insertions, 3583 deletions
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)
{
- 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();
+ 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();
}
}
- 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:
- {
- 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:
+ case ATTR_VALUE_FORMAT:
{
- //! 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
+ ScCellRangesBase::GetOnePropertyValue( pEntry, rAny );
}
const SfxItemPropertyMap& ScCellRangeObj::GetItemPropertyMap()
@@ -6417,47 +6417,47 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellObj::getPropertySetInfo()
void ScCellObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
{
- if ( pEntry )
+ if ( !pEntry )
+ return;
+
+ if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
{
- if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
- {
- OUString aStrVal;
- aValue >>= aStrVal;
- SetString_Impl(aStrVal, true, false); // interpret locally
- }
- else if ( pEntry->nWID == SC_WID_UNO_FORMRT || pEntry->nWID == SC_WID_UNO_FORMRT2
- || pEntry->nWID == SC_WID_UNO_CELLCONTENTTYPE )
- {
- // Read-Only
- //! Exception or so...
- }
- else
- ScCellRangeObj::SetOnePropertyValue( pEntry, aValue );
+ OUString aStrVal;
+ aValue >>= aStrVal;
+ SetString_Impl(aStrVal, true, false); // interpret locally
}
+ else if ( pEntry->nWID == SC_WID_UNO_FORMRT || pEntry->nWID == SC_WID_UNO_FORMRT2
+ || pEntry->nWID == SC_WID_UNO_CELLCONTENTTYPE )
+ {
+ // Read-Only
+ //! Exception or so...
+ }
+ else
+ ScCellRangeObj::SetOnePropertyValue( pEntry, aValue );
}
void ScCellObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, uno::Any& rAny )
{
- if ( pEntry )
+ if ( !pEntry )
+ return;
+
+ if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
{
- if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
- {
- // sal_False = local
- rAny <<= GetInputString_Impl(false);
- }
- else if ( pEntry->nWID == SC_WID_UNO_FORMRT2 )
- {
- sal_Int32 eType = GetResultType_Impl();
- rAny <<= eType;
- }
- else if ( pEntry->nWID == SC_WID_UNO_CELLCONTENTTYPE || pEntry->nWID == SC_WID_UNO_FORMRT )
- {
- table::CellContentType eType = GetContentType_Impl();
- rAny <<= eType;
- }
- else
- ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
+ // sal_False = local
+ rAny <<= GetInputString_Impl(false);
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_FORMRT2 )
+ {
+ sal_Int32 eType = GetResultType_Impl();
+ rAny <<= eType;
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_CELLCONTENTTYPE || pEntry->nWID == SC_WID_UNO_FORMRT )
+ {
+ table::CellContentType eType = GetContentType_Impl();
+ rAny <<= eType;
}
+ else
+ ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
}
const SfxItemPropertyMap& ScCellObj::GetItemPropertyMap()
@@ -6515,22 +6515,22 @@ void SAL_CALL ScCellObj::addActionLock()
void SAL_CALL ScCellObj::removeActionLock()
{
SolarMutexGuard aGuard;
- if (nActionLockCount > 0)
+ if (nActionLockCount <= 0)
+ return;
+
+ nActionLockCount--;
+ if (nActionLockCount)
+ return;
+
+ if (mxUnoText.is())
{
- nActionLockCount--;
- if (!nActionLockCount)
+ ScCellEditSource* pEditSource =
+ static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
+ if (pEditSource)
{
- if (mxUnoText.is())
- {
- ScCellEditSource* pEditSource =
- static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
- if (pEditSource)
- {
- pEditSource->SetDoUpdateData(true);
- if (pEditSource->IsDirty())
- pEditSource->UpdateData();
- }
- }
+ pEditSource->SetDoUpdateData(true);
+ if (pEditSource->IsDirty())
+ pEditSource->UpdateData();
}
}
}
@@ -6868,30 +6868,30 @@ void SAL_CALL ScTableSheetObj::removeAllManualPageBreaks()
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- //! DocFunc function, also for ScViewFunc::RemoveManualBreaks
-
- ScDocument& rDoc = pDocSh->GetDocument();
- bool bUndo (rDoc.IsUndoEnabled());
- SCTAB nTab = GetTab_Impl();
+ if ( !pDocSh )
+ return;
- if (bUndo)
- {
- ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
- rDoc.CopyToDocument(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
- pDocSh->GetUndoManager()->AddUndoAction(
- std::make_unique<ScUndoRemoveBreaks>( pDocSh, nTab, std::move(pUndoDoc) ) );
- }
+ //! DocFunc function, also for ScViewFunc::RemoveManualBreaks
- rDoc.RemoveManualBreaks(nTab);
- rDoc.UpdatePageBreaks(nTab);
+ ScDocument& rDoc = pDocSh->GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
+ SCTAB nTab = GetTab_Impl();
- //? UpdatePageBreakData( sal_True );
- pDocSh->SetDocumentModified();
- pDocSh->PostPaint(ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab), PaintPartFlags::Grid);
+ if (bUndo)
+ {
+ ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ rDoc.CopyToDocument(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
+ pDocSh->GetUndoManager()->AddUndoAction(
+ std::make_unique<ScUndoRemoveBreaks>( pDocSh, nTab, std::move(pUndoDoc) ) );
}
+
+ rDoc.RemoveManualBreaks(nTab);
+ rDoc.UpdatePageBreaks(nTab);
+
+ //? UpdatePageBreakData( sal_True );
+ pDocSh->SetDocumentModified();
+ pDocSh->PostPaint(ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab), PaintPartFlags::Grid);
}
// XNamed
@@ -6946,29 +6946,29 @@ void SAL_CALL ScTableSheetObj::insertCells( const table::CellRangeAddress& rRang
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
+ if ( !pDocSh )
+ return;
+
+ bool bDo = true;
+ InsCellCmd eCmd = INS_NONE;
+ switch (nMode)
{
- bool bDo = true;
- InsCellCmd eCmd = INS_NONE;
- switch (nMode)
- {
- case sheet::CellInsertMode_NONE: bDo = false; break;
- case sheet::CellInsertMode_DOWN: eCmd = INS_CELLSDOWN; break;
- case sheet::CellInsertMode_RIGHT: eCmd = INS_CELLSRIGHT; break;
- case sheet::CellInsertMode_ROWS: eCmd = INS_INSROWS_BEFORE; break;
- case sheet::CellInsertMode_COLUMNS: eCmd = INS_INSCOLS_BEFORE; break;
- default:
- OSL_FAIL("insertCells: wrong mode");
- bDo = false;
- }
+ case sheet::CellInsertMode_NONE: bDo = false; break;
+ case sheet::CellInsertMode_DOWN: eCmd = INS_CELLSDOWN; break;
+ case sheet::CellInsertMode_RIGHT: eCmd = INS_CELLSRIGHT; break;
+ case sheet::CellInsertMode_ROWS: eCmd = INS_INSROWS_BEFORE; break;
+ case sheet::CellInsertMode_COLUMNS: eCmd = INS_INSCOLS_BEFORE; break;
+ default:
+ OSL_FAIL("insertCells: wrong mode");
+ bDo = false;
+ }
- if (bDo)
- {
- OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "wrong table in CellRangeAddress" );
- ScRange aScRange;
- ScUnoConversion::FillScRange( aScRange, rRangeAddress );
- (void)pDocSh->GetDocFunc().InsertCells( aScRange, nullptr, eCmd, true, true );
- }
+ if (bDo)
+ {
+ OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "wrong table in CellRangeAddress" );
+ ScRange aScRange;
+ ScUnoConversion::FillScRange( aScRange, rRangeAddress );
+ (void)pDocSh->GetDocFunc().InsertCells( aScRange, nullptr, eCmd, true, true );
}
}
@@ -6977,29 +6977,29 @@ void SAL_CALL ScTableSheetObj::removeRange( const table::CellRangeAddress& rRang
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
+ if ( !pDocSh )
+ return;
+
+ bool bDo = true;
+ DelCellCmd eCmd = DelCellCmd::NONE;
+ switch (nMode)
{
- bool bDo = true;
- DelCellCmd eCmd = DelCellCmd::NONE;
- switch (nMode)
- {
- case sheet::CellDeleteMode_NONE: bDo = false; break;
- case sheet::CellDeleteMode_UP: eCmd = DelCellCmd::CellsUp; break;
- case sheet::CellDeleteMode_LEFT: eCmd = DelCellCmd::CellsLeft; break;
- case sheet::CellDeleteMode_ROWS: eCmd = DelCellCmd::Rows; break;
- case sheet::CellDeleteMode_COLUMNS: eCmd = DelCellCmd::Cols; break;
- default:
- OSL_FAIL("deleteCells: wrong mode");
- bDo = false;
- }
+ case sheet::CellDeleteMode_NONE: bDo = false; break;
+ case sheet::CellDeleteMode_UP: eCmd = DelCellCmd::CellsUp; break;
+ case sheet::CellDeleteMode_LEFT: eCmd = DelCellCmd::CellsLeft; break;
+ case sheet::CellDeleteMode_ROWS: eCmd = DelCellCmd::Rows; break;
+ case sheet::CellDeleteMode_COLUMNS: eCmd = DelCellCmd::Cols; break;
+ default:
+ OSL_FAIL("deleteCells: wrong mode");
+ bDo = false;
+ }
- if (bDo)
- {
- OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "wrong table in CellRangeAddress" );
- ScRange aScRange;
- ScUnoConversion::FillScRange( aScRange, rRangeAddress );
- (void)pDocSh->GetDocFunc().DeleteCells( aScRange, nullptr, eCmd, true );
- }
+ if (bDo)
+ {
+ OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "wrong table in CellRangeAddress" );
+ ScRange aScRange;
+ ScUnoConversion::FillScRange( aScRange, rRangeAddress );
+ (void)pDocSh->GetDocFunc().DeleteCells( aScRange, nullptr, eCmd, true );
}
}
@@ -7040,32 +7040,32 @@ void ScTableSheetObj::PrintAreaUndo_Impl( std::unique_ptr<ScPrintRangeSaver> pOl
// page break and undo
ScDocShell* pDocSh = GetDocShell();
- if(pDocSh)
- {
- ScDocument& rDoc = pDocSh->GetDocument();
- const bool bUndo(rDoc.IsUndoEnabled());
- const SCTAB nTab(GetTab_Impl());
+ if(!pDocSh)
+ return;
- if(bUndo)
- {
- pDocSh->GetUndoManager()->AddUndoAction(
- std::make_unique<ScUndoPrintRange>(
- pDocSh,
- nTab,
- std::move(pOldRanges),
- rDoc.CreatePrintRangeSaver())); // create new ranges
- }
+ ScDocument& rDoc = pDocSh->GetDocument();
+ const bool bUndo(rDoc.IsUndoEnabled());
+ const SCTAB nTab(GetTab_Impl());
- ScPrintFunc(pDocSh, pDocSh->GetPrinter(), nTab).UpdatePages();
- SfxBindings* pBindings = pDocSh->GetViewBindings();
+ if(bUndo)
+ {
+ pDocSh->GetUndoManager()->AddUndoAction(
+ std::make_unique<ScUndoPrintRange>(
+ pDocSh,
+ nTab,
+ std::move(pOldRanges),
+ rDoc.CreatePrintRangeSaver())); // create new ranges
+ }
- if(pBindings)
- {
- pBindings->Invalidate(SID_DELETE_PRINTAREA);
- }
+ ScPrintFunc(pDocSh, pDocSh->GetPrinter(), nTab).UpdatePages();
+ SfxBindings* pBindings = pDocSh->GetViewBindings();
- pDocSh->SetDocumentModified();
+ if(pBindings)
+ {
+ pBindings->Invalidate(SID_DELETE_PRINTAREA);
}
+
+ pDocSh->SetDocumentModified();
}
uno::Sequence<table::CellRangeAddress> SAL_CALL ScTableSheetObj::getPrintAreas()
@@ -7102,30 +7102,30 @@ void SAL_CALL ScTableSheetObj::setPrintAreas(
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- std::unique_ptr<ScPrintRangeSaver> pOldRanges;
- ScDocument& rDoc = pDocSh->GetDocument();
- SCTAB nTab = GetTab_Impl();
+ if ( !pDocSh )
+ return;
- if ( rDoc.IsUndoEnabled() )
- pOldRanges = rDoc.CreatePrintRangeSaver();
+ std::unique_ptr<ScPrintRangeSaver> pOldRanges;
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = GetTab_Impl();
- sal_uInt16 nCount = static_cast<sal_uInt16>(aPrintAreas.getLength());
- rDoc.ClearPrintRanges( nTab );
- if (nCount)
+ if ( rDoc.IsUndoEnabled() )
+ pOldRanges = rDoc.CreatePrintRangeSaver();
+
+ sal_uInt16 nCount = static_cast<sal_uInt16>(aPrintAreas.getLength());
+ rDoc.ClearPrintRanges( nTab );
+ if (nCount)
+ {
+ ScRange aPrintRange;
+ for (const table::CellRangeAddress& rPrintArea : aPrintAreas)
{
- ScRange aPrintRange;
- for (const table::CellRangeAddress& rPrintArea : aPrintAreas)
- {
- ScUnoConversion::FillScRange( aPrintRange, rPrintArea );
- rDoc.AddPrintRange( nTab, aPrintRange );
- }
+ ScUnoConversion::FillScRange( aPrintRange, rPrintArea );
+ rDoc.AddPrintRange( nTab, aPrintRange );
}
-
- if ( rDoc.IsUndoEnabled() )
- PrintAreaUndo_Impl( std::move(pOldRanges) ); // Undo, Page Breaks, Modified etc.
}
+
+ if ( rDoc.IsUndoEnabled() )
+ PrintAreaUndo_Impl( std::move(pOldRanges) ); // Undo, Page Breaks, Modified etc.
}
sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleColumns()
@@ -7145,27 +7145,27 @@ void SAL_CALL ScTableSheetObj::setPrintTitleColumns( sal_Bool bPrintTitleColumns
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- ScDocument& rDoc = pDocSh->GetDocument();
- SCTAB nTab = GetTab_Impl();
+ if ( !pDocSh )
+ return;
- std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = GetTab_Impl();
- if ( bPrintTitleColumns )
+ std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
+
+ if ( bPrintTitleColumns )
+ {
+ if ( !rDoc.GetRepeatColRange( nTab ) ) // do not change existing area
{
- if ( !rDoc.GetRepeatColRange( nTab ) ) // do not change existing area
- {
- rDoc.SetRepeatColRange( nTab, std::unique_ptr<ScRange>(new ScRange( 0, 0, nTab, 0, 0, nTab )) ); // enable
- }
+ rDoc.SetRepeatColRange( nTab, std::unique_ptr<ScRange>(new ScRange( 0, 0, nTab, 0, 0, nTab )) ); // enable
}
- else
- rDoc.SetRepeatColRange( nTab, nullptr ); // disable
+ }
+ else
+ rDoc.SetRepeatColRange( nTab, nullptr ); // disable
- PrintAreaUndo_Impl( std::move(pOldRanges) ); // undo, page break, modified etc.
+ PrintAreaUndo_Impl( std::move(pOldRanges) ); // undo, page break, modified etc.
- //! save last set area during switch off and recreate during switch on ???
- }
+ //! save last set area during switch off and recreate during switch on ???
}
table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleColumns()
@@ -7191,19 +7191,19 @@ void SAL_CALL ScTableSheetObj::setTitleColumns( const table::CellRangeAddress& a
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- ScDocument& rDoc = pDocSh->GetDocument();
- SCTAB nTab = GetTab_Impl();
+ if ( !pDocSh )
+ return;
- std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = GetTab_Impl();
- std::unique_ptr<ScRange> pNew(new ScRange);
- ScUnoConversion::FillScRange( *pNew, aTitleColumns );
- rDoc.SetRepeatColRange( nTab, std::move(pNew) ); // also always enable
+ std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
- PrintAreaUndo_Impl( std::move(pOldRanges) ); // undo, page breaks, modified etc.
- }
+ std::unique_ptr<ScRange> pNew(new ScRange);
+ ScUnoConversion::FillScRange( *pNew, aTitleColumns );
+ rDoc.SetRepeatColRange( nTab, std::move(pNew) ); // also always enable
+
+ PrintAreaUndo_Impl( std::move(pOldRanges) ); // undo, page breaks, modified etc.
}
sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleRows()
@@ -7223,28 +7223,28 @@ void SAL_CALL ScTableSheetObj::setPrintTitleRows( sal_Bool bPrintTitleRows )
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- ScDocument& rDoc = pDocSh->GetDocument();
- SCTAB nTab = GetTab_Impl();
+ if ( !pDocSh )
+ return;
+
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = GetTab_Impl();
- std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
+ std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
- if ( bPrintTitleRows )
+ if ( bPrintTitleRows )
+ {
+ if ( !rDoc.GetRepeatRowRange( nTab ) ) // do not change existing area
{
- if ( !rDoc.GetRepeatRowRange( nTab ) ) // do not change existing area
- {
- std::unique_ptr<ScRange> pNew( new ScRange(0, 0, nTab, 0, 0, nTab) );
- rDoc.SetRepeatRowRange( nTab, std::move(pNew) ); // enable
- }
+ std::unique_ptr<ScRange> pNew( new ScRange(0, 0, nTab, 0, 0, nTab) );
+ rDoc.SetRepeatRowRange( nTab, std::move(pNew) ); // enable
}
- else
- rDoc.SetRepeatRowRange( nTab, nullptr ); // disable
+ }
+ else
+ rDoc.SetRepeatRowRange( nTab, nullptr ); // disable
- PrintAreaUndo_Impl( std::move(pOldRanges) ); // undo, page breaks, modified etc.
+ PrintAreaUndo_Impl( std::move(pOldRanges) ); // undo, page breaks, modified etc.
- //! save last set area during switch off and recreate during switch on ???
- }
+ //! save last set area during switch off and recreate during switch on ???
}
table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleRows()
@@ -7270,19 +7270,19 @@ void SAL_CALL ScTableSheetObj::setTitleRows( const table::CellRangeAddress& aTit
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- ScDocument& rDoc = pDocSh->GetDocument();
- SCTAB nTab = GetTab_Impl();
+ if ( !pDocSh )
+ return;
- std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = GetTab_Impl();
- std::unique_ptr<ScRange> pNew(new ScRange);
- ScUnoConversion::FillScRange( *pNew, aTitleRows );
- rDoc.SetRepeatRowRange( nTab, std::move(pNew) ); // also always enable
+ std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
- PrintAreaUndo_Impl( std::move(pOldRanges) ); // Undo, page breaks, modified etc.
- }
+ std::unique_ptr<ScRange> pNew(new ScRange);
+ ScUnoConversion::FillScRange( *pNew, aTitleRows );
+ rDoc.SetRepeatRowRange( nTab, std::move(pNew) ); // also always enable
+
+ PrintAreaUndo_Impl( std::move(pOldRanges) ); // Undo, page breaks, modified etc.
}
// XSheetLinkable
@@ -7365,61 +7365,61 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- ScDocument& rDoc = pDocSh->GetDocument();
- SCTAB nTab = GetTab_Impl();
+ if ( !pDocSh )
+ return;
- OUString aFileString = aUrl;
- OUString aFilterString = aFilterName;
- OUString aOptString = aFilterOptions;
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = GetTab_Impl();
- aFileString = ScGlobal::GetAbsDocName( aFileString, pDocSh );
- if (aFilterString.isEmpty())
- ScDocumentLoader::GetFilterName( aFileString, aFilterString, aOptString, true, false );
+ OUString aFileString = aUrl;
+ OUString aFilterString = aFilterName;
+ OUString aOptString = aFilterOptions;
- // remove application prefix from filter name here, so the filter options
- // aren't reset when the filter name is changed in ScTableLink::DataChanged
- ScDocumentLoader::RemoveAppPrefix( aFilterString );
+ aFileString = ScGlobal::GetAbsDocName( aFileString, pDocSh );
+ if (aFilterString.isEmpty())
+ ScDocumentLoader::GetFilterName( aFileString, aFilterString, aOptString, true, false );
- ScLinkMode nLinkMode = ScLinkMode::NONE;
- if ( nMode == sheet::SheetLinkMode_NORMAL )
- nLinkMode = ScLinkMode::NORMAL;
- else if ( nMode == sheet::SheetLinkMode_VALUE )
- nLinkMode = ScLinkMode::VALUE;
+ // remove application prefix from filter name here, so the filter options
+ // aren't reset when the filter name is changed in ScTableLink::DataChanged
+ ScDocumentLoader::RemoveAppPrefix( aFilterString );
- rDoc.SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetName, 0/*nRefresh*/ );
+ ScLinkMode nLinkMode = ScLinkMode::NONE;
+ if ( nMode == sheet::SheetLinkMode_NORMAL )
+ nLinkMode = ScLinkMode::NORMAL;
+ else if ( nMode == sheet::SheetLinkMode_VALUE )
+ nLinkMode = ScLinkMode::VALUE;
- pDocSh->UpdateLinks(); // if needed add or delete link
- SfxBindings* pBindings = pDocSh->GetViewBindings();
- if (pBindings)
- pBindings->Invalidate(SID_LINKS);
+ rDoc.SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetName, 0/*nRefresh*/ );
- //! undo of link data on the table
+ pDocSh->UpdateLinks(); // if needed add or delete link
+ SfxBindings* pBindings = pDocSh->GetViewBindings();
+ if (pBindings)
+ pBindings->Invalidate(SID_LINKS);
- if ( nLinkMode != ScLinkMode::NONE && rDoc.IsExecuteLinkEnabled() ) // update link
- {
- // Always update link also if already exists
- //! update only on the affected table???
+ //! undo of link data on the table
- sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
- sal_uInt16 nCount = pLinkManager->GetLinks().size();
- for ( sal_uInt16 i=0; i<nCount; i++ )
- {
- ::sfx2::SvBaseLink* pBase = pLinkManager->GetLinks()[i].get();
- if (dynamic_cast<const ScTableLink*>( pBase) != nullptr)
- {
- ScTableLink* pTabLink = static_cast<ScTableLink*>(pBase);
- if ( aFileString == pTabLink->GetFileName() )
- pTabLink->Update(); // include Paint&Undo
+ if ( !(nLinkMode != ScLinkMode::NONE && rDoc.IsExecuteLinkEnabled()) ) // update link
+ return;
- //! The file name should only exists once (?)
- }
- }
- }
+ // Always update link also if already exists
+ //! update only on the affected table???
+
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
+ sal_uInt16 nCount = pLinkManager->GetLinks().size();
+ for ( sal_uInt16 i=0; i<nCount; i++ )
+ {
+ ::sfx2::SvBaseLink* pBase = pLinkManager->GetLinks()[i].get();
+ if (dynamic_cast<const ScTableLink*>( pBase) != nullptr)
+ {
+ ScTableLink* pTabLink = static_cast<ScTableLink*>(pBase);
+ if ( aFileString == pTabLink->GetFileName() )
+ pTabLink->Update(); // include Paint&Undo
- //! notify ScSheetLinkObj objects!!!
+ //! The file name should only exists once (?)
+ }
}
+
+ //! notify ScSheetLinkObj objects!!!
}
// XSheetAuditing
@@ -7674,76 +7674,76 @@ void SAL_CALL ScTableSheetObj::setScenarioComment( const OUString& aScenarioComm
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- ScDocument& rDoc = pDocSh->GetDocument();
- SCTAB nTab = GetTab_Impl();
+ if ( !pDocSh )
+ return;
- OUString aName;
- OUString aComment;
- Color aColor;
- ScScenarioFlags nFlags;
- rDoc.GetName( nTab, aName );
- rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = GetTab_Impl();
- aComment = aScenarioComment;
+ OUString aName;
+ OUString aComment;
+ Color aColor;
+ ScScenarioFlags nFlags;
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
- pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
- }
+ aComment = aScenarioComment;
+
+ pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAddress>& rScenRanges )
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- ScDocument& rDoc = pDocSh->GetDocument();
- SCTAB nTab = GetTab_Impl();
+ if ( !pDocSh )
+ return;
- if (rDoc.IsScenario(nTab))
- {
- ScMarkData aMarkData(rDoc.GetSheetLimits());
- aMarkData.SelectTable( nTab, true );
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = GetTab_Impl();
- for (const table::CellRangeAddress& rRange : rScenRanges)
- {
- OSL_ENSURE( rRange.Sheet == nTab, "addRanges with wrong Tab" );
- ScRange aOneRange( static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), nTab,
- static_cast<SCCOL>(rRange.EndColumn), static_cast<SCROW>(rRange.EndRow), nTab );
+ if (!rDoc.IsScenario(nTab))
+ return;
- aMarkData.SetMultiMarkArea( aOneRange );
- }
+ ScMarkData aMarkData(rDoc.GetSheetLimits());
+ aMarkData.SelectTable( nTab, true );
- // Scenario ranges are tagged with attribute
- ScPatternAttr aPattern( rDoc.GetPool() );
- aPattern.GetItemSet().Put( ScMergeFlagAttr( ScMF::Scenario ) );
- aPattern.GetItemSet().Put( ScProtectionAttr( true ) );
- pDocSh->GetDocFunc().ApplyAttributes( aMarkData, aPattern, true );
- }
+ for (const table::CellRangeAddress& rRange : rScenRanges)
+ {
+ OSL_ENSURE( rRange.Sheet == nTab, "addRanges with wrong Tab" );
+ ScRange aOneRange( static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), nTab,
+ static_cast<SCCOL>(rRange.EndColumn), static_cast<SCROW>(rRange.EndRow), nTab );
+
+ aMarkData.SetMultiMarkArea( aOneRange );
}
+
+ // Scenario ranges are tagged with attribute
+ ScPatternAttr aPattern( rDoc.GetPool() );
+ aPattern.GetItemSet().Put( ScMergeFlagAttr( ScMF::Scenario ) );
+ aPattern.GetItemSet().Put( ScProtectionAttr( true ) );
+ pDocSh->GetDocFunc().ApplyAttributes( aMarkData, aPattern, true );
}
void SAL_CALL ScTableSheetObj::apply()
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- ScDocument& rDoc = pDocSh->GetDocument();
- SCTAB nTab = GetTab_Impl();
- OUString aName;
- rDoc.GetName( nTab, aName ); // scenario name
+ if ( !pDocSh )
+ return;
- SCTAB nDestTab = nTab;
- while ( nDestTab > 0 && rDoc.IsScenario(nDestTab) )
- --nDestTab;
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = GetTab_Impl();
+ OUString aName;
+ rDoc.GetName( nTab, aName ); // scenario name
- if ( !rDoc.IsScenario(nDestTab) )
- pDocSh->UseScenario( nDestTab, aName );
+ SCTAB nDestTab = nTab;
+ while ( nDestTab > 0 && rDoc.IsScenario(nDestTab) )
+ --nDestTab;
- //! otherwise error or so
- }
+ if ( !rDoc.IsScenario(nDestTab) )
+ pDocSh->UseScenario( nDestTab, aName );
+
+ //! otherwise error or so
}
// XScenarioEnhanced
@@ -7821,86 +7821,70 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableSheetObj::getPropertySet
void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
{
- if ( pEntry )
+ if ( !pEntry )
+ return;
+
+ if ( IsScItemWid( pEntry->nWID ) )
{
- if ( IsScItemWid( pEntry->nWID ) )
- {
- // for Item WIDs, call ScCellRangesBase directly
- ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
- return;
- }
+ // for Item WIDs, call ScCellRangesBase directly
+ ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
+ return;
+ }
- // own properties
+ // own properties
- ScDocShell* pDocSh = GetDocShell();
- if (!pDocSh)
- return; //! Exception or so?
- ScDocument& rDoc = pDocSh->GetDocument();
- SCTAB nTab = GetTab_Impl();
- ScDocFunc &rFunc = pDocSh->GetDocFunc();
-
- if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
- {
- OUString aStrVal;
- aValue >>= aStrVal;
- OUString aNewStr(ScStyleNameConversion::ProgrammaticToDisplayName(
- aStrVal, SfxStyleFamily::Page ));
+ ScDocShell* pDocSh = GetDocShell();
+ if (!pDocSh)
+ return; //! Exception or so?
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = GetTab_Impl();
+ ScDocFunc &rFunc = pDocSh->GetDocFunc();
- //! Undo? (also if SID_STYLE_APPLY on View)
+ if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
+ {
+ OUString aStrVal;
+ aValue >>= aStrVal;
+ OUString aNewStr(ScStyleNameConversion::ProgrammaticToDisplayName(
+ aStrVal, SfxStyleFamily::Page ));
- if ( rDoc.GetPageStyle( nTab ) != aNewStr )
- {
- rDoc.SetPageStyle( nTab, aNewStr );
- if (!rDoc.IsImportingXML())
- {
- ScPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab ).UpdatePages();
+ //! Undo? (also if SID_STYLE_APPLY on View)
- SfxBindings* pBindings = pDocSh->GetViewBindings();
- if (pBindings)
- {
- pBindings->Invalidate( SID_STYLE_FAMILY4 );
- pBindings->Invalidate( SID_STATUS_PAGESTYLE );
- pBindings->Invalidate( FID_RESET_PRINTZOOM );
- pBindings->Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
- pBindings->Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
- }
- }
- pDocSh->SetDocumentModified();
- }
- }
- else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
+ if ( rDoc.GetPageStyle( nTab ) != aNewStr )
{
- bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- rFunc.SetTableVisible( nTab, bVis, true );
- }
- else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
- {
- if (rDoc.IsScenario(nTab))
- rDoc.SetActiveScenario( nTab, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- }
- else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
- {
- if (rDoc.IsScenario(nTab))
+ rDoc.SetPageStyle( nTab, aNewStr );
+ if (!rDoc.IsImportingXML())
{
- sal_Int32 nNewColor = 0;
- if (aValue >>= nNewColor)
- {
- OUString aName;
- OUString aComment;
- Color aColor;
- ScScenarioFlags nFlags;
- rDoc.GetName( nTab, aName );
- rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
+ ScPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab ).UpdatePages();
- aColor = Color(static_cast<sal_uInt32>(nNewColor));
-
- pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
+ SfxBindings* pBindings = pDocSh->GetViewBindings();
+ if (pBindings)
+ {
+ pBindings->Invalidate( SID_STYLE_FAMILY4 );
+ pBindings->Invalidate( SID_STATUS_PAGESTYLE );
+ pBindings->Invalidate( FID_RESET_PRINTZOOM );
+ pBindings->Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
+ pBindings->Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
}
}
+ pDocSh->SetDocumentModified();
}
- else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
+ {
+ bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ rFunc.SetTableVisible( nTab, bVis, true );
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
+ {
+ if (rDoc.IsScenario(nTab))
+ rDoc.SetActiveScenario( nTab, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
+ sal_Int32 nNewColor = 0;
+ if (aValue >>= nNewColor)
{
OUString aName;
OUString aComment;
@@ -7908,387 +7892,403 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
ScScenarioFlags nFlags;
rDoc.GetName( nTab, aName );
rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
- bool bModify(false);
- if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
- {
- if (!(nFlags & ScScenarioFlags::Protected))
- {
- nFlags |= ScScenarioFlags::Protected;
- bModify = true;
- }
- }
- else
- {
- if (nFlags & ScScenarioFlags::Protected)
- {
- nFlags &= ~ScScenarioFlags::Protected;
- bModify = true;
- }
- }
+ aColor = Color(static_cast<sal_uInt32>(nNewColor));
- if (bModify)
- pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
+ pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
}
- else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
- {
- OUString aName;
- OUString aComment;
- Color aColor;
- ScScenarioFlags nFlags;
- rDoc.GetName( nTab, aName );
- rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
- bool bModify(false);
+ OUString aName;
+ OUString aComment;
+ Color aColor;
+ ScScenarioFlags nFlags;
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
+ bool bModify(false);
- if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
+ if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
+ {
+ if (!(nFlags & ScScenarioFlags::Protected))
{
- if (!(nFlags & ScScenarioFlags::ShowFrame))
- {
- nFlags |= ScScenarioFlags::ShowFrame;
- bModify = true;
- }
+ nFlags |= ScScenarioFlags::Protected;
+ bModify = true;
}
- else
+ }
+ else
+ {
+ if (nFlags & ScScenarioFlags::Protected)
{
- if (nFlags & ScScenarioFlags::ShowFrame)
- {
- nFlags &= ~ScScenarioFlags::ShowFrame;
- bModify = true;
- }
+ nFlags &= ~ScScenarioFlags::Protected;
+ bModify = true;
}
-
- if (bModify)
- pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
+
+ if (bModify)
+ pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
- else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
- {
- OUString aName;
- OUString aComment;
- Color aColor;
- ScScenarioFlags nFlags;
- rDoc.GetName( nTab, aName );
- rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
- bool bModify(false);
+ OUString aName;
+ OUString aComment;
+ Color aColor;
+ ScScenarioFlags nFlags;
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
+ bool bModify(false);
- if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
+ if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
+ {
+ if (!(nFlags & ScScenarioFlags::ShowFrame))
{
- if (!(nFlags & ScScenarioFlags::PrintFrame))
- {
- nFlags |= ScScenarioFlags::PrintFrame;
- bModify = true;
- }
+ nFlags |= ScScenarioFlags::ShowFrame;
+ bModify = true;
}
- else
+ }
+ else
+ {
+ if (nFlags & ScScenarioFlags::ShowFrame)
{
- if (nFlags & ScScenarioFlags::PrintFrame)
- {
- nFlags &= ~ScScenarioFlags::PrintFrame;
- bModify = true;
- }
+ nFlags &= ~ScScenarioFlags::ShowFrame;
+ bModify = true;
}
-
- if (bModify)
- pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
+
+ if (bModify)
+ pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
- else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
- {
- OUString aName;
- OUString aComment;
- Color aColor;
- ScScenarioFlags nFlags;
- rDoc.GetName( nTab, aName );
- rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
- bool bModify(false);
+ OUString aName;
+ OUString aComment;
+ Color aColor;
+ ScScenarioFlags nFlags;
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
+ bool bModify(false);
- if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
+ if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
+ {
+ if (!(nFlags & ScScenarioFlags::PrintFrame))
{
- if (!(nFlags & ScScenarioFlags::TwoWay))
- {
- nFlags |= ScScenarioFlags::TwoWay;
- bModify = true;
- }
+ nFlags |= ScScenarioFlags::PrintFrame;
+ bModify = true;
}
- else
+ }
+ else
+ {
+ if (nFlags & ScScenarioFlags::PrintFrame)
{
- if (nFlags & ScScenarioFlags::TwoWay)
- {
- nFlags &= ~ScScenarioFlags::TwoWay;
- bModify = true;
- }
+ nFlags &= ~ScScenarioFlags::PrintFrame;
+ bModify = true;
}
-
- if (bModify)
- pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
+
+ if (bModify)
+ pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
- else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
- {
- OUString aName;
- OUString aComment;
- Color aColor;
- ScScenarioFlags nFlags;
- rDoc.GetName( nTab, aName );
- rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
- bool bModify(false);
+ OUString aName;
+ OUString aComment;
+ Color aColor;
+ ScScenarioFlags nFlags;
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
+ bool bModify(false);
- if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
+ if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
+ {
+ if (!(nFlags & ScScenarioFlags::TwoWay))
{
- if (!(nFlags & ScScenarioFlags::Attrib))
- {
- nFlags |= ScScenarioFlags::Attrib;
- bModify = true;
- }
+ nFlags |= ScScenarioFlags::TwoWay;
+ bModify = true;
}
- else
+ }
+ else
+ {
+ if (nFlags & ScScenarioFlags::TwoWay)
{
- if (nFlags & ScScenarioFlags::Attrib)
- {
- nFlags &= ~ScScenarioFlags::Attrib;
- bModify = true;
- }
+ nFlags &= ~ScScenarioFlags::TwoWay;
+ bModify = true;
}
-
- if (bModify)
- pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
+
+ if (bModify)
+ pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
- else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
- {
- OUString aName;
- OUString aComment;
- Color aColor;
- ScScenarioFlags nFlags;
- rDoc.GetName( nTab, aName );
- rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
- bool bModify(false);
+ OUString aName;
+ OUString aComment;
+ Color aColor;
+ ScScenarioFlags nFlags;
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
+ bool bModify(false);
- if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
+ if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
+ {
+ if (!(nFlags & ScScenarioFlags::Attrib))
{
- if (nFlags & ScScenarioFlags::Value)
- {
- nFlags &= ~ScScenarioFlags::Value;
- bModify = true;
- }
+ nFlags |= ScScenarioFlags::Attrib;
+ bModify = true;
}
- else
+ }
+ else
+ {
+ if (nFlags & ScScenarioFlags::Attrib)
{
- if (!(nFlags & ScScenarioFlags::Value))
- {
- nFlags |= ScScenarioFlags::Value;
- bModify = true;
- }
+ nFlags &= ~ScScenarioFlags::Attrib;
+ bModify = true;
}
-
- if (bModify)
- pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
+
+ if (bModify)
+ pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
- else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
+ {
+ if (rDoc.IsScenario(nTab))
{
- sal_Int16 nValue = 0;
- if (aValue >>= nValue)
+ OUString aName;
+ OUString aComment;
+ Color aColor;
+ ScScenarioFlags nFlags;
+ rDoc.GetName( nTab, aName );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
+ bool bModify(false);
+
+ if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
{
- if (nValue == css::text::WritingMode2::RL_TB)
- rFunc.SetLayoutRTL(nTab, true);
- else
- rFunc.SetLayoutRTL(nTab, false);
+ if (nFlags & ScScenarioFlags::Value)
+ {
+ nFlags &= ~ScScenarioFlags::Value;
+ bModify = true;
+ }
}
- }
- else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
- {
- bool bAutoPrint = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- if (bAutoPrint)
- rDoc.SetPrintEntireSheet( nTab ); // clears all print ranges
else
{
- if (rDoc.IsPrintEntireSheet( nTab ))
- rDoc.ClearPrintRanges( nTab ); // if this flag is true, there are no PrintRanges, so Clear clears only the flag.
+ if (!(nFlags & ScScenarioFlags::Value))
+ {
+ nFlags |= ScScenarioFlags::Value;
+ bModify = true;
+ }
}
+
+ if (bModify)
+ pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
- else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
+ {
+ sal_Int16 nValue = 0;
+ if (aValue >>= nValue)
{
- Color aColor = COL_AUTO;
- if ( aValue >>= aColor )
- {
- if ( rDoc.GetTabBgColor( nTab ) != aColor )
- rFunc.SetTabBgColor( nTab, aColor, true, true );
- }
+ if (nValue == css::text::WritingMode2::RL_TB)
+ rFunc.SetLayoutRTL(nTab, true);
+ else
+ rFunc.SetLayoutRTL(nTab, false);
}
- else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
+ {
+ bool bAutoPrint = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ if (bAutoPrint)
+ rDoc.SetPrintEntireSheet( nTab ); // clears all print ranges
+ else
{
- OUString aCodeName;
- if (aValue >>= aCodeName)
- {
- pDocSh->GetDocument().SetCodeName( GetTab_Impl(), aCodeName );
- }
+ if (rDoc.IsPrintEntireSheet( nTab ))
+ rDoc.ClearPrintRanges( nTab ); // if this flag is true, there are no PrintRanges, so Clear clears only the flag.
}
- else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT)
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
+ {
+ Color aColor = COL_AUTO;
+ if ( aValue >>= aColor )
{
- uno::Reference<sheet::XConditionalFormats> xCondFormat;
- if (aValue >>= xCondFormat)
- {
- // how to set the format correctly
- }
+ if ( rDoc.GetTabBgColor( nTab ) != aColor )
+ rFunc.SetTabBgColor( nTab, aColor, true, true );
+ }
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
+ {
+ OUString aCodeName;
+ if (aValue >>= aCodeName)
+ {
+ pDocSh->GetDocument().SetCodeName( GetTab_Impl(), aCodeName );
}
- else
- ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
}
+ else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT)
+ {
+ uno::Reference<sheet::XConditionalFormats> xCondFormat;
+ if (aValue >>= xCondFormat)
+ {
+ // how to set the format correctly
+ }
+ }
+ else
+ ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
}
void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
uno::Any& rAny )
{
- if ( pEntry )
- {
- ScDocShell* pDocSh = GetDocShell();
- if (!pDocSh)
- throw uno::RuntimeException();
- ScDocument& rDoc = pDocSh->GetDocument();
- SCTAB nTab = GetTab_Impl();
+ if ( !pEntry )
+ return;
- if ( pEntry->nWID == SC_WID_UNO_NAMES )
- {
- rAny <<= uno::Reference<sheet::XNamedRanges>(new ScLocalNamedRangesObj(pDocSh, this));
- }
- else if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
- {
- rAny <<= ScStyleNameConversion::DisplayToProgrammaticName(
- rDoc.GetPageStyle( nTab ), SfxStyleFamily::Page );
- }
- else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
- {
- bool bVis = rDoc.IsVisible( nTab );
- rAny <<= bVis;
- }
- else if ( pEntry->nWID == SC_WID_UNO_LINKDISPBIT )
- {
- // no target bitmaps for individual entries (would be all equal)
- // ScLinkTargetTypeObj::SetLinkTargetBitmap( aAny, SC_LINKTARGETTYPE_SHEET );
- }
- else if ( pEntry->nWID == SC_WID_UNO_LINKDISPNAME )
- {
- // LinkDisplayName for hyperlink dialog
- rAny <<= getName(); // sheet name
- }
- else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
- {
- if (rDoc.IsScenario(nTab))
- rAny <<= rDoc.IsActiveScenario( nTab );
- }
- else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
- {
- if (rDoc.IsScenario(nTab))
- {
- OUString aComment;
- Color aColor;
- ScScenarioFlags nFlags;
- rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
+ ScDocShell* pDocSh = GetDocShell();
+ if (!pDocSh)
+ throw uno::RuntimeException();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ SCTAB nTab = GetTab_Impl();
- rAny <<= aColor;
- }
- }
- else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
+ if ( pEntry->nWID == SC_WID_UNO_NAMES )
+ {
+ rAny <<= uno::Reference<sheet::XNamedRanges>(new ScLocalNamedRangesObj(pDocSh, this));
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
+ {
+ rAny <<= ScStyleNameConversion::DisplayToProgrammaticName(
+ rDoc.GetPageStyle( nTab ), SfxStyleFamily::Page );
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
+ {
+ bool bVis = rDoc.IsVisible( nTab );
+ rAny <<= bVis;
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_LINKDISPBIT )
+ {
+ // no target bitmaps for individual entries (would be all equal)
+ // ScLinkTargetTypeObj::SetLinkTargetBitmap( aAny, SC_LINKTARGETTYPE_SHEET );
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_LINKDISPNAME )
+ {
+ // LinkDisplayName for hyperlink dialog
+ rAny <<= getName(); // sheet name
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
+ {
+ if (rDoc.IsScenario(nTab))
+ rAny <<= rDoc.IsActiveScenario( nTab );
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
- {
- ScScenarioFlags nFlags;
- rDoc.GetScenarioFlags(nTab, nFlags);
+ OUString aComment;
+ Color aColor;
+ ScScenarioFlags nFlags;
+ rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
- rAny <<= ((nFlags & ScScenarioFlags::Protected) != ScScenarioFlags::NONE);
- }
+ rAny <<= aColor;
}
- else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
- {
- ScScenarioFlags nFlags;
- rDoc.GetScenarioFlags(nTab, nFlags);
+ ScScenarioFlags nFlags;
+ rDoc.GetScenarioFlags(nTab, nFlags);
- rAny <<= ((nFlags & ScScenarioFlags::ShowFrame) != ScScenarioFlags::NONE);
- }
+ rAny <<= ((nFlags & ScScenarioFlags::Protected) != ScScenarioFlags::NONE);
}
- else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
- {
- ScScenarioFlags nFlags;
- rDoc.GetScenarioFlags(nTab, nFlags);
+ ScScenarioFlags nFlags;
+ rDoc.GetScenarioFlags(nTab, nFlags);
- rAny <<= ((nFlags & ScScenarioFlags::PrintFrame) != ScScenarioFlags::NONE);
- }
+ rAny <<= ((nFlags & ScScenarioFlags::ShowFrame) != ScScenarioFlags::NONE);
}
- else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
- {
- ScScenarioFlags nFlags;
- rDoc.GetScenarioFlags(nTab, nFlags);
+ ScScenarioFlags nFlags;
+ rDoc.GetScenarioFlags(nTab, nFlags);
- rAny <<= ((nFlags & ScScenarioFlags::TwoWay) != ScScenarioFlags::NONE);
- }
+ rAny <<= ((nFlags & ScScenarioFlags::PrintFrame) != ScScenarioFlags::NONE);
}
- else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
- {
- ScScenarioFlags nFlags;
- rDoc.GetScenarioFlags(nTab, nFlags);
+ ScScenarioFlags nFlags;
+ rDoc.GetScenarioFlags(nTab, nFlags);
- rAny <<= ((nFlags & ScScenarioFlags::Attrib) != ScScenarioFlags::NONE);
- }
+ rAny <<= ((nFlags & ScScenarioFlags::TwoWay) != ScScenarioFlags::NONE);
}
- else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
+ {
+ if (rDoc.IsScenario(nTab))
{
- if (rDoc.IsScenario(nTab))
- {
- ScScenarioFlags nFlags;
- rDoc.GetScenarioFlags(nTab, nFlags);
+ ScScenarioFlags nFlags;
+ rDoc.GetScenarioFlags(nTab, nFlags);
- rAny <<= !(nFlags & ScScenarioFlags::Value);
- }
- }
- else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
- {
- if (rDoc.IsLayoutRTL(nTab))
- rAny <<= sal_Int16(css::text::WritingMode2::RL_TB);
- else
- rAny <<= sal_Int16(css::text::WritingMode2::LR_TB);
- }
- else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
- {
- bool bAutoPrint = rDoc.IsPrintEntireSheet( nTab );
- rAny <<= bAutoPrint;
- }
- else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
- {
- rAny <<= rDoc.GetTabBgColor(nTab);
- }
- else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
- {
- OUString aCodeName;
- pDocSh->GetDocument().GetCodeName(GetTab_Impl(), aCodeName);
- rAny <<= aCodeName;
+ rAny <<= ((nFlags & ScScenarioFlags::Attrib) != ScScenarioFlags::NONE);
}
- else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT)
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
+ {
+ if (rDoc.IsScenario(nTab))
{
- rAny <<= uno::Reference<sheet::XConditionalFormats>(new ScCondFormatsObj(pDocSh, nTab));
+ ScScenarioFlags nFlags;
+ rDoc.GetScenarioFlags(nTab, nFlags);
+
+ rAny <<= !(nFlags & ScScenarioFlags::Value);
}
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
+ {
+ if (rDoc.IsLayoutRTL(nTab))
+ rAny <<= sal_Int16(css::text::WritingMode2::RL_TB);
else
- ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
+ rAny <<= sal_Int16(css::text::WritingMode2::LR_TB);
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
+ {
+ bool bAutoPrint = rDoc.IsPrintEntireSheet( nTab );
+ rAny <<= bAutoPrint;
}
+ else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
+ {
+ rAny <<= rDoc.GetTabBgColor(nTab);
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
+ {
+ OUString aCodeName;
+ pDocSh->GetDocument().GetCodeName(GetTab_Impl(), aCodeName);
+ rAny <<= aCodeName;
+ }
+ else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT)
+ {
+ rAny <<= uno::Reference<sheet::XConditionalFormats>(new ScCondFormatsObj(pDocSh, nTab));
+ }
+ else
+ ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
}
const SfxItemPropertyMap& ScTableSheetObj::GetItemPropertyMap()
@@ -8393,113 +8393,113 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableColumnObj::getPropertySe
void ScTableColumnObj::SetOnePropertyValue(const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue)
{
- if ( pEntry )
+ if ( !pEntry )
+ return;
+
+ if ( IsScItemWid( pEntry->nWID ) )
{
- if ( IsScItemWid( pEntry->nWID ) )
- {
- // for Item WIDs, call ScCellRangesBase directly
- ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
- return;
- }
+ // for Item WIDs, call ScCellRangesBase directly
+ ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
+ return;
+ }
- // own properties
+ // own properties
- ScDocShell* pDocSh = GetDocShell();
- if (!pDocSh)
- return; //! Exception or so?
- const ScRange& rRange = GetRange();
- OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "Too many columns");
- SCCOL nCol = rRange.aStart.Col();
- SCTAB nTab = rRange.aStart.Tab();
- ScDocFunc &rFunc = pDocSh->GetDocFunc();
+ ScDocShell* pDocSh = GetDocShell();
+ if (!pDocSh)
+ return; //! Exception or so?
+ const ScRange& rRange = GetRange();
+ OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "Too many columns");
+ SCCOL nCol = rRange.aStart.Col();
+ SCTAB nTab = rRange.aStart.Tab();
+ ScDocFunc &rFunc = pDocSh->GetDocFunc();
- std::vector<sc::ColRowSpan> aColArr(1, sc::ColRowSpan(nCol,nCol));
+ std::vector<sc::ColRowSpan> aColArr(1, sc::ColRowSpan(nCol,nCol));
- if ( pEntry->nWID == SC_WID_UNO_CELLWID )
- {
- sal_Int32 nNewWidth = 0;
- if ( aValue >>= nNewWidth )
- {
- // property is 1/100mm, column width is twips
- nNewWidth = HMMToTwips(nNewWidth);
- rFunc.SetWidthOrHeight(
- true, aColArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(nNewWidth), true, true);
- }
- }
- else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
- {
- bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
- rFunc.SetWidthOrHeight(true, aColArr, nTab, eMode, 0, true, true);
- // SC_SIZE_DIRECT with size 0 will hide
- }
- else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
- {
- bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- if (bOpt)
- rFunc.SetWidthOrHeight(
- true, aColArr, nTab, SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH, true, true);
- // sal_False on columns currently without effect
- }
- else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
+ if ( pEntry->nWID == SC_WID_UNO_CELLWID )
+ {
+ sal_Int32 nNewWidth = 0;
+ if ( aValue >>= nNewWidth )
{
- bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- if (bSet)
- rFunc.InsertPageBreak( true, rRange.aStart, true, true );
- else
- rFunc.RemovePageBreak( true, rRange.aStart, true, true );
+ // property is 1/100mm, column width is twips
+ nNewWidth = HMMToTwips(nNewWidth);
+ rFunc.SetWidthOrHeight(
+ true, aColArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(nNewWidth), true, true);
}
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
+ {
+ bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
+ rFunc.SetWidthOrHeight(true, aColArr, nTab, eMode, 0, true, true);
+ // SC_SIZE_DIRECT with size 0 will hide
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
+ {
+ bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ if (bOpt)
+ rFunc.SetWidthOrHeight(
+ true, aColArr, nTab, SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH, true, true);
+ // sal_False on columns currently without effect
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
+ {
+ bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ if (bSet)
+ rFunc.InsertPageBreak( true, rRange.aStart, true, true );
else
- ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
+ rFunc.RemovePageBreak( true, rRange.aStart, true, true );
}
+ else
+ ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
}
void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, uno::Any& rAny )
{
- if ( pEntry )
- {
- ScDocShell* pDocSh = GetDocShell();
- if (!pDocSh)
- throw uno::RuntimeException();
+ if ( !pEntry )
+ return;
- ScDocument& rDoc = pDocSh->GetDocument();
- const ScRange& rRange = GetRange();
- OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "too many columns");
- SCCOL nCol = rRange.aStart.Col();
- SCTAB nTab = rRange.aStart.Tab();
+ ScDocShell* pDocSh = GetDocShell();
+ if (!pDocSh)
+ throw uno::RuntimeException();
- if ( pEntry->nWID == SC_WID_UNO_CELLWID )
- {
- // for hidden column, return original height
- sal_uInt16 nWidth = rDoc.GetOriginalWidth( nCol, nTab );
- // property is 1/100mm, column width is twips
- nWidth = static_cast<sal_uInt16>(TwipsToHMM(nWidth));
- rAny <<= static_cast<sal_Int32>(nWidth);
- }
- else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
- {
- bool bHidden = rDoc.ColHidden(nCol, nTab);
- rAny <<= !bHidden;
- }
- else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
- {
- //! at the moment always set ??!?!
- bool bOpt = !(rDoc.GetColFlags( nCol, nTab ) & CRFlags::ManualSize);
- rAny <<= bOpt;
- }
- else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
- {
- ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab);
- rAny <<= nBreak != ScBreakType::NONE;
- }
- else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
- {
- ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab);
- rAny <<= bool(nBreak & ScBreakType::Manual);
- }
- else
- ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
+ ScDocument& rDoc = pDocSh->GetDocument();
+ const ScRange& rRange = GetRange();
+ OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "too many columns");
+ SCCOL nCol = rRange.aStart.Col();
+ SCTAB nTab = rRange.aStart.Tab();
+
+ if ( pEntry->nWID == SC_WID_UNO_CELLWID )
+ {
+ // for hidden column, return original height
+ sal_uInt16 nWidth = rDoc.GetOriginalWidth( nCol, nTab );
+ // property is 1/100mm, column width is twips
+ nWidth = static_cast<sal_uInt16>(TwipsToHMM(nWidth));
+ rAny <<= static_cast<sal_Int32>(nWidth);
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
+ {
+ bool bHidden = rDoc.ColHidden(nCol, nTab);
+ rAny <<= !bHidden;
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
+ {
+ //! at the moment always set ??!?!
+ bool bOpt = !(rDoc.GetColFlags( nCol, nTab ) & CRFlags::ManualSize);
+ rAny <<= bOpt;
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
+ {
+ ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab);
+ rAny <<= nBreak != ScBreakType::NONE;
}
+ else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
+ {
+ ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab);
+ rAny <<= bool(nBreak & ScBreakType::Manual);
+ }
+ else
+ ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
}
const SfxItemPropertyMap& ScTableColumnObj::GetItemPropertyMap()
@@ -8529,127 +8529,127 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableRowObj::getPropertySetIn
void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
{
- if ( pEntry )
+ if ( !pEntry )
+ return;
+
+ if ( IsScItemWid( pEntry->nWID ) )
{
- if ( IsScItemWid( pEntry->nWID ) )
- {
- // for Item WIDs, call ScCellRangesBase directly
- ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
- return;
- }
+ // for Item WIDs, call ScCellRangesBase directly
+ ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
+ return;
+ }
- // own properties
+ // own properties
- ScDocShell* pDocSh = GetDocShell();
- if (!pDocSh)
- return; //! Exception or so?
- ScDocument& rDoc = pDocSh->GetDocument();
- const ScRange& rRange = GetRange();
- OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "too many rows");
- SCROW nRow = rRange.aStart.Row();
- SCTAB nTab = rRange.aStart.Tab();
- ScDocFunc &rFunc = pDocSh->GetDocFunc();
+ ScDocShell* pDocSh = GetDocShell();
+ if (!pDocSh)
+ return; //! Exception or so?
+ ScDocument& rDoc = pDocSh->GetDocument();
+ const ScRange& rRange = GetRange();
+ OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "too many rows");
+ SCROW nRow = rRange.aStart.Row();
+ SCTAB nTab = rRange.aStart.Tab();
+ ScDocFunc &rFunc = pDocSh->GetDocFunc();
- std::vector<sc::ColRowSpan> aRowArr(1, sc::ColRowSpan(nRow,nRow));
+ std::vector<sc::ColRowSpan> aRowArr(1, sc::ColRowSpan(nRow,nRow));
- if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
- {
- sal_Int32 nNewHeight = 0;
- if ( aValue >>= nNewHeight )
- {
- // property is 1/100mm, row height is twips
- nNewHeight = HMMToTwips(nNewHeight);
- rFunc.SetWidthOrHeight(
- false, aRowArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(nNewHeight), true, true);
- }
- }
- else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
- {
- bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
- rFunc.SetWidthOrHeight(false, aRowArr, nTab, eMode, 0, true, true);
- // SC_SIZE_DIRECT with size zero will hide
- }
- else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
- {
- bool bFil = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- // SC_SIZE_DIRECT with size zero will hide
- rDoc.SetRowFiltered(nRow, nRow, nTab, bFil);
- }
- else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
+ if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
+ {
+ sal_Int32 nNewHeight = 0;
+ if ( aValue >>= nNewHeight )
{
- bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- if (bOpt)
- rFunc.SetWidthOrHeight(false, aRowArr, nTab, SC_SIZE_OPTIMAL, 0, true, true);
- else
- {
- // set current height again manually
- sal_uInt16 nHeight = rDoc.GetOriginalHeight( nRow, nTab );
- rFunc.SetWidthOrHeight(false, aRowArr, nTab, SC_SIZE_ORIGINAL, nHeight, true, true);
- }
+ // property is 1/100mm, row height is twips
+ nNewHeight = HMMToTwips(nNewHeight);
+ rFunc.SetWidthOrHeight(
+ false, aRowArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(nNewHeight), true, true);
}
- else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
+ {
+ bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
+ rFunc.SetWidthOrHeight(false, aRowArr, nTab, eMode, 0, true, true);
+ // SC_SIZE_DIRECT with size zero will hide
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
+ {
+ bool bFil = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ // SC_SIZE_DIRECT with size zero will hide
+ rDoc.SetRowFiltered(nRow, nRow, nTab, bFil);
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
+ {
+ bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ if (bOpt)
+ rFunc.SetWidthOrHeight(false, aRowArr, nTab, SC_SIZE_OPTIMAL, 0, true, true);
+ else
{
- bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- if (bSet)
- rFunc.InsertPageBreak( false, rRange.aStart, true, true );
- else
- rFunc.RemovePageBreak( false, rRange.aStart, true, true );
+ // set current height again manually
+ sal_uInt16 nHeight = rDoc.GetOriginalHeight( nRow, nTab );
+ rFunc.SetWidthOrHeight(false, aRowArr, nTab, SC_SIZE_ORIGINAL, nHeight, true, true);
}
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
+ {
+ bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ if (bSet)
+ rFunc.InsertPageBreak( false, rRange.aStart, true, true );
else
- ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
+ rFunc.RemovePageBreak( false, rRange.aStart, true, true );
}
+ else
+ ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
}
void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, uno::Any& rAny )
{
- if ( pEntry )
- {
- ScDocShell* pDocSh = GetDocShell();
- if (!pDocSh)
- throw uno::RuntimeException();
- ScDocument& rDoc = pDocSh->GetDocument();
- const ScRange& rRange = GetRange();
- OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "too many rows");
- SCROW nRow = rRange.aStart.Row();
- SCTAB nTab = rRange.aStart.Tab();
+ if ( !pEntry )
+ return;
- if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
- {
- // for hidden row, return original height
- sal_uInt16 nHeight = rDoc.GetOriginalHeight( nRow, nTab );
- // property is 1/100mm, row height is twips
- nHeight = static_cast<sal_uInt16>(TwipsToHMM(nHeight));
- rAny <<= static_cast<sal_Int32>(nHeight);
- }
- else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
- {
- bool bHidden = rDoc.RowHidden(nRow, nTab);
- rAny <<= !bHidden;
- }
- else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
- {
- bool bVis = rDoc.RowFiltered(nRow, nTab);
- rAny <<= bVis;
- }
- else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
- {
- bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & CRFlags::ManualSize);
- rAny <<= bOpt;
- }
- else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
- {
- ScBreakType nBreak = rDoc.HasRowBreak(nRow, nTab);
- rAny <<= (nBreak != ScBreakType::NONE);
- }
- else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
- {
- bool bBreak(rDoc.HasRowBreak(nRow, nTab) & ScBreakType::Manual);
- rAny <<= bBreak;
- }
- else
- ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
+ ScDocShell* pDocSh = GetDocShell();
+ if (!pDocSh)
+ throw uno::RuntimeException();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ const ScRange& rRange = GetRange();
+ OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "too many rows");
+ SCROW nRow = rRange.aStart.Row();
+ SCTAB nTab = rRange.aStart.Tab();
+
+ if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
+ {
+ // for hidden row, return original height
+ sal_uInt16 nHeight = rDoc.GetOriginalHeight( nRow, nTab );
+ // property is 1/100mm, row height is twips
+ nHeight = static_cast<sal_uInt16>(TwipsToHMM(nHeight));
+ rAny <<= static_cast<sal_Int32>(nHeight);
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
+ {
+ bool bHidden = rDoc.RowHidden(nRow, nTab);
+ rAny <<= !bHidden;
}
+ else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
+ {
+ bool bVis = rDoc.RowFiltered(nRow, nTab);
+ rAny <<= bVis;
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
+ {
+ bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & CRFlags::ManualSize);
+ rAny <<= bOpt;
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
+ {
+ ScBreakType nBreak = rDoc.HasRowBreak(nRow, nTab);
+ rAny <<= (nBreak != ScBreakType::NONE);
+ }
+ else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
+ {
+ bool bBreak(rDoc.HasRowBreak(nRow, nTab) & ScBreakType::Manual);
+ rAny <<= bBreak;
+ }
+ else
+ ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
}
const SfxItemPropertyMap& ScTableRowObj::GetItemPropertyMap()
diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx b/sc/source/ui/unoobj/cellvaluebinding.cxx
index a5d43ab012e2..242ba364137c 100644
--- a/sc/source/ui/unoobj/cellvaluebinding.cxx
+++ b/sc/source/ui/unoobj/cellvaluebinding.cxx
@@ -348,42 +348,42 @@ namespace calc
OUString sPropName( "NumberFormat" );
Reference<XPropertySet> xCellProp( m_xCell, UNO_QUERY );
Reference<XNumberFormatsSupplier> xSupplier( m_xDocument, UNO_QUERY );
- if ( xSupplier.is() && xCellProp.is() )
- {
- Reference<XNumberFormats> xFormats(xSupplier->getNumberFormats());
- Reference<XNumberFormatTypes> xTypes( xFormats, UNO_QUERY );
- if ( xTypes.is() )
- {
- lang::Locale aLocale;
- bool bWasBoolean = false;
+ if ( !(xSupplier.is() && xCellProp.is()) )
+ return;
- sal_Int32 nOldIndex = ::comphelper::getINT32( xCellProp->getPropertyValue( sPropName ) );
- Reference<XPropertySet> xOldFormat;
- try
- {
- xOldFormat.set(xFormats->getByKey( nOldIndex ));
- }
- catch ( Exception& )
- {
- // non-existing format - can happen, use defaults
- }
- if ( xOldFormat.is() )
- {
- // use the locale of the existing format
- xOldFormat->getPropertyValue("Locale") >>= aLocale;
+ Reference<XNumberFormats> xFormats(xSupplier->getNumberFormats());
+ Reference<XNumberFormatTypes> xTypes( xFormats, UNO_QUERY );
+ if ( !xTypes.is() )
+ return;
- sal_Int16 nOldType = ::comphelper::getINT16(
- xOldFormat->getPropertyValue("Type") );
- if ( nOldType & NumberFormat::LOGICAL )
- bWasBoolean = true;
- }
+ lang::Locale aLocale;
+ bool bWasBoolean = false;
- if ( !bWasBoolean )
- {
- sal_Int32 nNewIndex = xTypes->getStandardFormat( NumberFormat::LOGICAL, aLocale );
- xCellProp->setPropertyValue( sPropName, makeAny( nNewIndex ) );
- }
- }
+ sal_Int32 nOldIndex = ::comphelper::getINT32( xCellProp->getPropertyValue( sPropName ) );
+ Reference<XPropertySet> xOldFormat;
+ try
+ {
+ xOldFormat.set(xFormats->getByKey( nOldIndex ));
+ }
+ catch ( Exception& )
+ {
+ // non-existing format - can happen, use defaults
+ }
+ if ( xOldFormat.is() )
+ {
+ // use the locale of the existing format
+ xOldFormat->getPropertyValue("Locale") >>= aLocale;
+
+ sal_Int16 nOldType = ::comphelper::getINT16(
+ xOldFormat->getPropertyValue("Type") );
+ if ( nOldType & NumberFormat::LOGICAL )
+ bWasBoolean = true;
+ }
+
+ if ( !bWasBoolean )
+ {
+ sal_Int32 nNewIndex = xTypes->getStandardFormat( NumberFormat::LOGICAL, aLocale );
+ xCellProp->setPropertyValue( sPropName, makeAny( nNewIndex ) );
}
}
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index cdb8303adc7c..624258a59e09 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2395,31 +2395,31 @@ ScChart2DataSequence::~ScChart2DataSequence()
void ScChart2DataSequence::RefChanged()
{
- if( m_pValueListener && !m_aValueListeners.empty() )
- {
- m_pValueListener->EndListeningAll();
+ if( !m_pValueListener || m_aValueListeners.empty() )
+ return;
- if( m_pDocument )
- {
- ScChartListenerCollection* pCLC = nullptr;
- if (m_pHiddenListener)
- {
- pCLC = m_pDocument->GetChartListenerCollection();
- if (pCLC)
- pCLC->EndListeningHiddenRange(m_pHiddenListener.get());
- }
+ m_pValueListener->EndListeningAll();
- for (const auto& rxToken : m_aTokens)
- {
- ScRange aRange;
- if (!ScRefTokenHelper::getRangeFromToken(m_pDocument, aRange, rxToken, ScAddress()))
- continue;
+ if( !m_pDocument )
+ return;
- m_pDocument->StartListeningArea(aRange, false, m_pValueListener.get());
- if (pCLC)
- pCLC->StartListeningHiddenRange(aRange, m_pHiddenListener.get());
- }
- }
+ ScChartListenerCollection* pCLC = nullptr;
+ if (m_pHiddenListener)
+ {
+ pCLC = m_pDocument->GetChartListenerCollection();
+ if (pCLC)
+ pCLC->EndListeningHiddenRange(m_pHiddenListener.get());
+ }
+
+ for (const auto& rxToken : m_aTokens)
+ {
+ ScRange aRange;
+ if (!ScRefTokenHelper::getRangeFromToken(m_pDocument, aRange, rxToken, ScAddress()))
+ continue;
+
+ m_pDocument->StartListeningArea(aRange, false, m_pValueListener.get());
+ if (pCLC)
+ pCLC->StartListeningHiddenRange(aRange, m_pHiddenListener.get());
}
}
@@ -2676,19 +2676,19 @@ void ScChart2DataSequence::CopyData(const ScChart2DataSequence& r)
if (r.m_pRangeIndices)
m_pRangeIndices.reset(new vector<sal_uInt32>(*r.m_pRangeIndices));
- if (r.m_pExtRefListener)
- {
- // Re-register all external files that the old instance was
- // listening to.
+ if (!r.m_pExtRefListener)
+ return;
- ScExternalRefManager* pRefMgr = m_pDocument->GetExternalRefManager();
- m_pExtRefListener.reset(new ExternalRefListener(*this, m_pDocument));
- const std::unordered_set<sal_uInt16>& rFileIds = r.m_pExtRefListener->getAllFileIds();
- for (const auto& rFileId : rFileIds)
- {
- pRefMgr->addLinkListener(rFileId, m_pExtRefListener.get());
- m_pExtRefListener->addFileId(rFileId);
- }
+ // Re-register all external files that the old instance was
+ // listening to.
+
+ ScExternalRefManager* pRefMgr = m_pDocument->GetExternalRefManager();
+ m_pExtRefListener.reset(new ExternalRefListener(*this, m_pDocument));
+ const std::unordered_set<sal_uInt16>& rFileIds = r.m_pExtRefListener->getAllFileIds();
+ for (const auto& rFileId : rFileIds)
+ {
+ pRefMgr->addLinkListener(rFileId, m_pExtRefListener.get());
+ m_pExtRefListener->addFileId(rFileId);
}
}
@@ -3177,31 +3177,31 @@ void SAL_CALL ScChart2DataSequence::addModifyListener( const uno::Reference< uti
ScRefTokenHelper::getRangeListFromTokens(m_pDocument, aRanges, m_aTokens, ScAddress());
m_aValueListeners.emplace_back( aListener );
- if ( m_aValueListeners.size() == 1 )
- {
- if (!m_pValueListener)
- m_pValueListener.reset(new ScLinkListener( LINK( this, ScChart2DataSequence, ValueListenerHdl ) ));
+ if ( m_aValueListeners.size() != 1 )
+ return;
+
+ if (!m_pValueListener)
+ m_pValueListener.reset(new ScLinkListener( LINK( this, ScChart2DataSequence, ValueListenerHdl ) ));
- if (!m_pHiddenListener)
- m_pHiddenListener.reset(new HiddenRangeListener(*this));
+ if (!m_pHiddenListener)
+ m_pHiddenListener.reset(new HiddenRangeListener(*this));
- if( m_pDocument )
+ if( m_pDocument )
+ {
+ ScChartListenerCollection* pCLC = m_pDocument->GetChartListenerCollection();
+ for (const auto& rxToken : m_aTokens)
{
- ScChartListenerCollection* pCLC = m_pDocument->GetChartListenerCollection();
- for (const auto& rxToken : m_aTokens)
- {
- ScRange aRange;
- if (!ScRefTokenHelper::getRangeFromToken(m_pDocument, aRange, rxToken, ScAddress()))
- continue;
+ ScRange aRange;
+ if (!ScRefTokenHelper::getRangeFromToken(m_pDocument, aRange, rxToken, ScAddress()))
+ continue;
- m_pDocument->StartListeningArea( aRange, false, m_pValueListener.get() );
- if (pCLC)
- pCLC->StartListeningHiddenRange(aRange, m_pHiddenListener.get());
- }
+ m_pDocument->StartListeningArea( aRange, false, m_pValueListener.get() );
+ if (pCLC)
+ pCLC->StartListeningHiddenRange(aRange, m_pHiddenListener.get());
}
-
- acquire(); // don't lose this object (one ref for all listeners)
}
+
+ acquire(); // don't lose this object (one ref for all listeners)
}
void SAL_CALL ScChart2DataSequence::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index b17c64801399..1df6f56dc0b7 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -169,94 +169,94 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
uno::Reference < embed::XEmbeddedObject > xObj;
if ( SvtModuleOptions().IsChart() )
xObj = pDocShell->GetEmbeddedObjectContainer().CreateEmbeddedObject( SvGlobalName( SO3_SCH_CLASSID ).GetByteSequence(), aName );
- if ( xObj.is() )
+ if ( !xObj.is() )
+ return;
+
+ // adjust rectangle
+ //! error/exception, if empty/invalid ???
+ Point aRectPos( aRect.X, aRect.Y );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
+ if ( ( aRectPos.X() < 0 && !bLayoutRTL ) || ( aRectPos.X() > 0 && bLayoutRTL ) )
+ aRectPos.setX( 0 );
+
+ if (aRectPos.Y() < 0)
+ aRectPos.setY( 0 );
+
+ Size aRectSize( aRect.Width, aRect.Height );
+ if (aRectSize.Width() <= 0)
+ aRectSize.setWidth( 5000 ); // default size
+
+ if (aRectSize.Height() <= 0)
+ aRectSize.setHeight( 5000 );
+ tools::Rectangle aInsRect( aRectPos, aRectSize );
+
+ sal_Int64 nAspect(embed::Aspects::MSOLE_CONTENT);
+ MapUnit aMapUnit(VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) ));
+ Size aSize(aInsRect.GetSize());
+ aSize = OutputDevice::LogicToLogic( aSize, MapMode( MapUnit::Map100thMM ), MapMode( aMapUnit ) );
+ awt::Size aSz;
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+
+ // Calc -> DataProvider
+ uno::Reference< chart2::data::XDataProvider > xDataProvider = new
+ ScChart2DataProvider( &rDoc );
+ // Chart -> DataReceiver
+ uno::Reference< chart2::data::XDataReceiver > xReceiver;
+ if( xObj.is())
+ xReceiver.set( xObj->getComponent(), uno::UNO_QUERY );
+ if( xReceiver.is())
{
- // adjust rectangle
- //! error/exception, if empty/invalid ???
- Point aRectPos( aRect.X, aRect.Y );
- bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
- if ( ( aRectPos.X() < 0 && !bLayoutRTL ) || ( aRectPos.X() > 0 && bLayoutRTL ) )
- aRectPos.setX( 0 );
-
- if (aRectPos.Y() < 0)
- aRectPos.setY( 0 );
-
- Size aRectSize( aRect.Width, aRect.Height );
- if (aRectSize.Width() <= 0)
- aRectSize.setWidth( 5000 ); // default size
-
- if (aRectSize.Height() <= 0)
- aRectSize.setHeight( 5000 );
- tools::Rectangle aInsRect( aRectPos, aRectSize );
-
- sal_Int64 nAspect(embed::Aspects::MSOLE_CONTENT);
- MapUnit aMapUnit(VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) ));
- Size aSize(aInsRect.GetSize());
- aSize = OutputDevice::LogicToLogic( aSize, MapMode( MapUnit::Map100thMM ), MapMode( aMapUnit ) );
- awt::Size aSz;
- aSz.Width = aSize.Width();
- aSz.Height = aSize.Height();
-
- // Calc -> DataProvider
- uno::Reference< chart2::data::XDataProvider > xDataProvider = new
- ScChart2DataProvider( &rDoc );
- // Chart -> DataReceiver
- uno::Reference< chart2::data::XDataReceiver > xReceiver;
- if( xObj.is())
- xReceiver.set( xObj->getComponent(), uno::UNO_QUERY );
- if( xReceiver.is())
- {
- OUString sRangeStr;
- xNewRanges->Format(sRangeStr, ScRefFlags::RANGE_ABS_3D, rDoc);
-
- // connect
- if( !sRangeStr.isEmpty() )
- xReceiver->attachDataProvider( xDataProvider );
- else
- sRangeStr = "all";
-
- uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( pDocShell->GetModel(), uno::UNO_QUERY );
- xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier );
-
- // set arguments
- uno::Sequence< beans::PropertyValue > aArgs( 4 );
- aArgs[0] = beans::PropertyValue(
- "CellRangeRepresentation", -1,
- uno::makeAny( sRangeStr ), beans::PropertyState_DIRECT_VALUE );
- aArgs[1] = beans::PropertyValue(
- "HasCategories", -1,
- uno::makeAny( bRowHeaders ), beans::PropertyState_DIRECT_VALUE );
- aArgs[2] = beans::PropertyValue(
- "FirstCellAsLabel", -1,
- uno::makeAny( bColumnHeaders ), beans::PropertyState_DIRECT_VALUE );
- aArgs[3] = beans::PropertyValue(
- "DataRowSource", -1,
- uno::makeAny( chart::ChartDataRowSource_COLUMNS ), beans::PropertyState_DIRECT_VALUE );
- xReceiver->setArguments( aArgs );
- }
+ OUString sRangeStr;
+ xNewRanges->Format(sRangeStr, ScRefFlags::RANGE_ABS_3D, rDoc);
+
+ // connect
+ if( !sRangeStr.isEmpty() )
+ xReceiver->attachDataProvider( xDataProvider );
+ else
+ sRangeStr = "all";
+
+ uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( pDocShell->GetModel(), uno::UNO_QUERY );
+ xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier );
+
+ // set arguments
+ uno::Sequence< beans::PropertyValue > aArgs( 4 );
+ aArgs[0] = beans::PropertyValue(
+ "CellRangeRepresentation", -1,
+ uno::makeAny( sRangeStr ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[1] = beans::PropertyValue(
+ "HasCategories", -1,
+ uno::makeAny( bRowHeaders ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[2] = beans::PropertyValue(
+ "FirstCellAsLabel", -1,
+ uno::makeAny( bColumnHeaders ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[3] = beans::PropertyValue(
+ "DataRowSource", -1,
+ uno::makeAny( chart::ChartDataRowSource_COLUMNS ), beans::PropertyState_DIRECT_VALUE );
+ xReceiver->setArguments( aArgs );
+ }
- ScChartListener* pChartListener =
- new ScChartListener( aName, &rDoc, xNewRanges );
- rDoc.GetChartListenerCollection()->insert( pChartListener );
- pChartListener->StartListeningTo();
+ ScChartListener* pChartListener =
+ new ScChartListener( aName, &rDoc, xNewRanges );
+ rDoc.GetChartListenerCollection()->insert( pChartListener );
+ pChartListener->StartListeningTo();
- SdrOle2Obj* pObj = new SdrOle2Obj(
- *pModel,
- ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT),
- aName,
- aInsRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ *pModel,
+ ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT),
+ aName,
+ aInsRect);
- // set VisArea
- if( xObj.is())
- xObj->setVisualAreaSize( nAspect, aSz );
+ // set VisArea
+ if( xObj.is())
+ xObj->setVisualAreaSize( nAspect, aSz );
- // #i121334# This call will change the chart's default background fill from white to transparent.
- // Add here again if this is wanted (see task description for details)
- // ChartHelper::AdaptDefaultsForChart( xObj );
+ // #i121334# This call will change the chart's default background fill from white to transparent.
+ // Add here again if this is wanted (see task description for details)
+ // ChartHelper::AdaptDefaultsForChart( xObj );
- pPage->InsertObject( pObj );
- pModel->AddUndo( std::make_unique<SdrUndoInsertObj>( *pObj ) );
- }
+ pPage->InsertObject( pObj );
+ pModel->AddUndo( std::make_unique<SdrUndoInsertObj>( *pObj ) );
}
void SAL_CALL ScChartsObj::removeByName( const OUString& aName )
diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx
index b9b7bcb310b6..c94d9772a203 100644
--- a/sc/source/ui/unoobj/cursuno.cxx
+++ b/sc/source/ui/unoobj/cursuno.cxx
@@ -88,20 +88,20 @@ void SAL_CALL ScCellCursorObj::collapseToCurrentRegion()
aOneRange.PutInOrder();
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- SCCOL nStartCol = aOneRange.aStart.Col();
- SCROW nStartRow = aOneRange.aStart.Row();
- SCCOL nEndCol = aOneRange.aEnd.Col();
- SCROW nEndRow = aOneRange.aEnd.Row();
- SCTAB nTab = aOneRange.aStart.Tab();
+ if ( !pDocSh )
+ return;
- pDocSh->GetDocument().GetDataArea(
- nTab, nStartCol, nStartRow, nEndCol, nEndRow, true, false );
+ SCCOL nStartCol = aOneRange.aStart.Col();
+ SCROW nStartRow = aOneRange.aStart.Row();
+ SCCOL nEndCol = aOneRange.aEnd.Col();
+ SCROW nEndRow = aOneRange.aEnd.Row();
+ SCTAB nTab = aOneRange.aStart.Tab();
- ScRange aNew( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab );
- SetNewRange( aNew );
- }
+ pDocSh->GetDocument().GetDataArea(
+ nTab, nStartCol, nStartRow, nEndCol, nEndRow, true, false );
+
+ ScRange aNew( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab );
+ SetNewRange( aNew );
}
void SAL_CALL ScCellCursorObj::collapseToCurrentArray()
@@ -220,54 +220,54 @@ void SAL_CALL ScCellCursorObj::gotoStartOfUsedArea(sal_Bool bExpand)
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- const ScRangeList& rRanges = GetRangeList();
- OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
- ScRange aNewRange( rRanges[0] );
- SCTAB nTab = aNewRange.aStart.Tab();
+ if ( !pDocSh )
+ return;
- SCCOL nUsedX = 0; // fetch the beginning
- SCROW nUsedY = 0;
- if (!pDocSh->GetDocument().GetDataStart( nTab, nUsedX, nUsedY ))
- {
- nUsedX = 0;
- nUsedY = 0;
- }
+ const ScRangeList& rRanges = GetRangeList();
+ OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
+ ScRange aNewRange( rRanges[0] );
+ SCTAB nTab = aNewRange.aStart.Tab();
- aNewRange.aStart.SetCol( nUsedX );
- aNewRange.aStart.SetRow( nUsedY );
- if (!bExpand)
- aNewRange.aEnd = aNewRange.aStart;
- SetNewRange( aNewRange );
+ SCCOL nUsedX = 0; // fetch the beginning
+ SCROW nUsedY = 0;
+ if (!pDocSh->GetDocument().GetDataStart( nTab, nUsedX, nUsedY ))
+ {
+ nUsedX = 0;
+ nUsedY = 0;
}
+
+ aNewRange.aStart.SetCol( nUsedX );
+ aNewRange.aStart.SetRow( nUsedY );
+ if (!bExpand)
+ aNewRange.aEnd = aNewRange.aStart;
+ SetNewRange( aNewRange );
}
void SAL_CALL ScCellCursorObj::gotoEndOfUsedArea( sal_Bool bExpand )
{
SolarMutexGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- const ScRangeList& rRanges = GetRangeList();
- OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
- ScRange aNewRange( rRanges[ 0 ]);
- SCTAB nTab = aNewRange.aStart.Tab();
+ if ( !pDocSh )
+ return;
- SCCOL nUsedX = 0; // fetch the end
- SCROW nUsedY = 0;
- if (!pDocSh->GetDocument().GetTableArea( nTab, nUsedX, nUsedY ))
- {
- nUsedX = 0;
- nUsedY = 0;
- }
+ const ScRangeList& rRanges = GetRangeList();
+ OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
+ ScRange aNewRange( rRanges[ 0 ]);
+ SCTAB nTab = aNewRange.aStart.Tab();
- aNewRange.aEnd.SetCol( nUsedX );
- aNewRange.aEnd.SetRow( nUsedY );
- if (!bExpand)
- aNewRange.aStart = aNewRange.aEnd;
- SetNewRange( aNewRange );
+ SCCOL nUsedX = 0; // fetch the end
+ SCROW nUsedY = 0;
+ if (!pDocSh->GetDocument().GetTableArea( nTab, nUsedX, nUsedY ))
+ {
+ nUsedX = 0;
+ nUsedY = 0;
}
+
+ aNewRange.aEnd.SetCol( nUsedX );
+ aNewRange.aEnd.SetRow( nUsedY );
+ if (!bExpand)
+ aNewRange.aStart = aNewRange.aEnd;
+ SetNewRange( aNewRange );
}
// XCellCursor
@@ -284,20 +284,20 @@ void SAL_CALL ScCellCursorObj::gotoStart()
aOneRange.PutInOrder();
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- SCCOL nStartCol = aOneRange.aStart.Col();
- SCROW nStartRow = aOneRange.aStart.Row();
- SCCOL nEndCol = aOneRange.aEnd.Col();
- SCROW nEndRow = aOneRange.aEnd.Row();
- SCTAB nTab = aOneRange.aStart.Tab();
+ if ( !pDocSh )
+ return;
- pDocSh->GetDocument().GetDataArea(
- nTab, nStartCol, nStartRow, nEndCol, nEndRow, false, false );
+ SCCOL nStartCol = aOneRange.aStart.Col();
+ SCROW nStartRow = aOneRange.aStart.Row();
+ SCCOL nEndCol = aOneRange.aEnd.Col();
+ SCROW nEndRow = aOneRange.aEnd.Row();
+ SCTAB nTab = aOneRange.aStart.Tab();
- ScRange aNew( nStartCol, nStartRow, nTab );
- SetNewRange( aNew );
- }
+ pDocSh->GetDocument().GetDataArea(
+ nTab, nStartCol, nStartRow, nEndCol, nEndRow, false, false );
+
+ ScRange aNew( nStartCol, nStartRow, nTab );
+ SetNewRange( aNew );
}
void SAL_CALL ScCellCursorObj::gotoEnd()
@@ -312,20 +312,20 @@ void SAL_CALL ScCellCursorObj::gotoEnd()
aOneRange.PutInOrder();
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
- {
- SCCOL nStartCol = aOneRange.aStart.Col();
- SCROW nStartRow = aOneRange.aStart.Row();
- SCCOL nEndCol = aOneRange.aEnd.Col();
- SCROW nEndRow = aOneRange.aEnd.Row();
- SCTAB nTab = aOneRange.aStart.Tab();
+ if ( !pDocSh )
+ return;
- pDocSh->GetDocument().GetDataArea(
- nTab, nStartCol, nStartRow, nEndCol, nEndRow, false, false );
+ SCCOL nStartCol = aOneRange.aStart.Col();
+ SCROW nStartRow = aOneRange.aStart.Row();
+ SCCOL nEndCol = aOneRange.aEnd.Col();
+ SCROW nEndRow = aOneRange.aEnd.Row();
+ SCTAB nTab = aOneRange.aStart.Tab();
- ScRange aNew( nEndCol, nEndRow, nTab );
- SetNewRange( aNew );
- }
+ pDocSh->GetDocument().GetDataArea(
+ nTab, nStartCol, nStartRow, nEndCol, nEndRow, false, false );
+
+ ScRange aNew( nEndCol, nEndRow, nTab );
+ SetNewRange( aNew );
}
void SAL_CALL ScCellCursorObj::gotoNext()
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index cf09945119f2..6a4b76c49c0a 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -694,141 +694,141 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aProp
{
SolarMutexGuard aGuard;
ScDPObject* pDPObject = GetDPObject();
- if (pDPObject)
+ if (!pDPObject)
+ return;
+
+ ScDPSaveData* pOldData = pDPObject->GetSaveData();
+ OSL_ENSURE(pOldData, "Here should be a SaveData");
+ if ( pOldData )
{
- ScDPSaveData* pOldData = pDPObject->GetSaveData();
- OSL_ENSURE(pOldData, "Here should be a SaveData");
- if ( pOldData )
- {
- ScDPSaveData aNewData( *pOldData );
+ ScDPSaveData aNewData( *pOldData );
- if ( aPropertyName == SC_UNO_DP_COLGRAND )
- {
- aNewData.SetColumnGrand(::cppu::any2bool( aValue ));
- }
- else if ( aPropertyName == SC_UNO_DP_IGNORE_EMPTYROWS )
- {
- aNewData.SetIgnoreEmptyRows(::cppu::any2bool( aValue ));
- }
- else if ( aPropertyName == SC_UNO_DP_REPEATEMPTY )
- {
- aNewData.SetRepeatIfEmpty(::cppu::any2bool( aValue ));
- }
- else if ( aPropertyName == SC_UNO_DP_ROWGRAND )
- {
- aNewData.SetRowGrand(::cppu::any2bool( aValue ));
- }
- else if ( aPropertyName == SC_UNO_DP_SHOWFILTER )
- {
- aNewData.SetFilterButton(::cppu::any2bool( aValue ));
- }
- else if ( aPropertyName == SC_UNO_DP_DRILLDOWN )
- {
- aNewData.SetDrillDown(::cppu::any2bool( aValue ));
- }
- else if ( aPropertyName == SC_UNO_DP_GRANDTOTAL_NAME )
- {
- OUString aStrVal;
- if ( aValue >>= aStrVal )
- aNewData.SetGrandTotalName(aStrVal);
- }
- else if ( aPropertyName == SC_UNO_DP_IMPORTDESC )
+ if ( aPropertyName == SC_UNO_DP_COLGRAND )
+ {
+ aNewData.SetColumnGrand(::cppu::any2bool( aValue ));
+ }
+ else if ( aPropertyName == SC_UNO_DP_IGNORE_EMPTYROWS )
+ {
+ aNewData.SetIgnoreEmptyRows(::cppu::any2bool( aValue ));
+ }
+ else if ( aPropertyName == SC_UNO_DP_REPEATEMPTY )
+ {
+ aNewData.SetRepeatIfEmpty(::cppu::any2bool( aValue ));
+ }
+ else if ( aPropertyName == SC_UNO_DP_ROWGRAND )
+ {
+ aNewData.SetRowGrand(::cppu::any2bool( aValue ));
+ }
+ else if ( aPropertyName == SC_UNO_DP_SHOWFILTER )
+ {
+ aNewData.SetFilterButton(::cppu::any2bool( aValue ));
+ }
+ else if ( aPropertyName == SC_UNO_DP_DRILLDOWN )
+ {
+ aNewData.SetDrillDown(::cppu::any2bool( aValue ));
+ }
+ else if ( aPropertyName == SC_UNO_DP_GRANDTOTAL_NAME )
+ {
+ OUString aStrVal;
+ if ( aValue >>= aStrVal )
+ aNewData.SetGrandTotalName(aStrVal);
+ }
+ else if ( aPropertyName == SC_UNO_DP_IMPORTDESC )
+ {
+ uno::Sequence<beans::PropertyValue> aArgSeq;
+ if ( aValue >>= aArgSeq )
{
- uno::Sequence<beans::PropertyValue> aArgSeq;
- if ( aValue >>= aArgSeq )
- {
- ScImportSourceDesc aImportDesc(&pDocShell->GetDocument());
+ ScImportSourceDesc aImportDesc(&pDocShell->GetDocument());
- const ScImportSourceDesc* pOldDesc = pDPObject->GetImportSourceDesc();
- if (pOldDesc)
- aImportDesc = *pOldDesc;
+ const ScImportSourceDesc* pOldDesc = pDPObject->GetImportSourceDesc();
+ if (pOldDesc)
+ aImportDesc = *pOldDesc;
- ScImportParam aParam;
- ScImportDescriptor::FillImportParam( aParam, aArgSeq );
+ ScImportParam aParam;
+ ScImportDescriptor::FillImportParam( aParam, aArgSeq );
- sheet::DataImportMode nNewType = sheet::DataImportMode_NONE;
- if ( aParam.bImport )
- {
- if ( aParam.bSql )
- nNewType = sheet::DataImportMode_SQL;
- else if ( aParam.nType == ScDbQuery )
- nNewType = sheet::DataImportMode_QUERY;
- else
- nNewType = sheet::DataImportMode_TABLE;
- }
- aImportDesc.nType = nNewType;
- aImportDesc.aDBName = aParam.aDBName;
- aImportDesc.aObject = aParam.aStatement;
- aImportDesc.bNative = aParam.bNative;
-
- pDPObject->SetImportDesc( aImportDesc );
+ sheet::DataImportMode nNewType = sheet::DataImportMode_NONE;
+ if ( aParam.bImport )
+ {
+ if ( aParam.bSql )
+ nNewType = sheet::DataImportMode_SQL;
+ else if ( aParam.nType == ScDbQuery )
+ nNewType = sheet::DataImportMode_QUERY;
+ else
+ nNewType = sheet::DataImportMode_TABLE;
}
+ aImportDesc.nType = nNewType;
+ aImportDesc.aDBName = aParam.aDBName;
+ aImportDesc.aObject = aParam.aStatement;
+ aImportDesc.bNative = aParam.bNative;
+
+ pDPObject->SetImportDesc( aImportDesc );
}
- else if ( aPropertyName == SC_UNO_DP_SOURCESERVICE )
+ }
+ else if ( aPropertyName == SC_UNO_DP_SOURCESERVICE )
+ {
+ OUString aStrVal;
+ if ( aValue >>= aStrVal )
{
- OUString aStrVal;
- if ( aValue >>= aStrVal )
- {
- ScDPServiceDesc aServiceDesc("", "", "", "", "");
+ ScDPServiceDesc aServiceDesc("", "", "", "", "");
- const ScDPServiceDesc* pOldDesc = pDPObject->GetDPServiceDesc();
- if (pOldDesc)
- aServiceDesc = *pOldDesc;
+ const ScDPServiceDesc* pOldDesc = pDPObject->GetDPServiceDesc();
+ if (pOldDesc)
+ aServiceDesc = *pOldDesc;
- aServiceDesc.aServiceName = aStrVal;
+ aServiceDesc.aServiceName = aStrVal;
- pDPObject->SetServiceData( aServiceDesc );
- }
+ pDPObject->SetServiceData( aServiceDesc );
}
- else if ( aPropertyName == SC_UNO_DP_SERVICEARG )
+ }
+ else if ( aPropertyName == SC_UNO_DP_SERVICEARG )
+ {
+ uno::Sequence<beans::PropertyValue> aArgSeq;
+ if ( aValue >>= aArgSeq )
{
- uno::Sequence<beans::PropertyValue> aArgSeq;
- if ( aValue >>= aArgSeq )
- {
- ScDPServiceDesc aServiceDesc("", "", "", "", "");
+ ScDPServiceDesc aServiceDesc("", "", "", "", "");
- const ScDPServiceDesc* pOldDesc = pDPObject->GetDPServiceDesc();
- if (pOldDesc)
- aServiceDesc = *pOldDesc;
+ const ScDPServiceDesc* pOldDesc = pDPObject->GetDPServiceDesc();
+ if (pOldDesc)
+ aServiceDesc = *pOldDesc;
- OUString aStrVal;
- for (const beans::PropertyValue& rProp : std::as_const(aArgSeq))
- {
- OUString aPropName(rProp.Name);
+ OUString aStrVal;
+ for (const beans::PropertyValue& rProp : std::as_const(aArgSeq))
+ {
+ OUString aPropName(rProp.Name);
- if (aPropName == SC_UNO_DP_SOURCENAME)
- {
- if ( rProp.Value >>= aStrVal )
- aServiceDesc.aParSource = aStrVal;
- }
- else if (aPropName == SC_UNO_DP_OBJECTNAME)
- {
- if ( rProp.Value >>= aStrVal )
- aServiceDesc.aParName = aStrVal;
- }
- else if (aPropName == SC_UNO_DP_USERNAME)
- {
- if ( rProp.Value >>= aStrVal )
- aServiceDesc.aParUser = aStrVal;
- }
- else if (aPropName == SC_UNO_DP_PASSWORD)
- {
- if ( rProp.Value >>= aStrVal )
- aServiceDesc.aParPass = aStrVal;
- }
+ if (aPropName == SC_UNO_DP_SOURCENAME)
+ {
+ if ( rProp.Value >>= aStrVal )
+ aServiceDesc.aParSource = aStrVal;
+ }
+ else if (aPropName == SC_UNO_DP_OBJECTNAME)
+ {
+ if ( rProp.Value >>= aStrVal )
+ aServiceDesc.aParName = aStrVal;
+ }
+ else if (aPropName == SC_UNO_DP_USERNAME)
+ {
+ if ( rProp.Value >>= aStrVal )
+ aServiceDesc.aParUser = aStrVal;
+ }
+ else if (aPropName == SC_UNO_DP_PASSWORD)
+ {
+ if ( rProp.Value >>= aStrVal )
+ aServiceDesc.aParPass = aStrVal;
}
-
- pDPObject->SetServiceData( aServiceDesc );
}
- }
- else
- throw UnknownPropertyException(aPropertyName);
- pDPObject->SetSaveData( aNewData );
+ pDPObject->SetServiceData( aServiceDesc );
+ }
}
+ else
+ throw UnknownPropertyException(aPropertyName);
- SetDPObject(pDPObject);
+ pDPObject->SetSaveData( aNewData );
}
+
+ SetDPObject(pDPObject);
}
Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPropertyName )
@@ -1945,54 +1945,55 @@ void ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew)
return;
ScDPObject* pDPObj = nullptr;
- if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
- {
- ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+ ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
+ if(!pDim)
+ return;
- /* If the field was taken from getDataPilotFields(), don't reset the
- orientation for an existing use, but create a duplicated field
- instead (for "Data" orientation only). */
- if ( !maOrient.hasValue() && !maFieldId.mbDataLayout &&
- (pDim->GetOrientation() != DataPilotFieldOrientation_HIDDEN) &&
- (eNew == DataPilotFieldOrientation_DATA) )
- {
+ ScDPSaveData* pSaveData = pDPObj->GetSaveData();
- ScDPSaveDimension* pNewDim = nullptr;
+ /* If the field was taken from getDataPilotFields(), don't reset the
+ orientation for an existing use, but create a duplicated field
+ instead (for "Data" orientation only). */
+ if ( !maOrient.hasValue() && !maFieldId.mbDataLayout &&
+ (pDim->GetOrientation() != DataPilotFieldOrientation_HIDDEN) &&
+ (eNew == DataPilotFieldOrientation_DATA) )
+ {
- // look for existing duplicate with orientation "hidden"
+ ScDPSaveDimension* pNewDim = nullptr;
- sal_Int32 nFound = 0;
- const ScDPSaveData::DimsType& rDimensions = pSaveData->GetDimensions();
- for (auto const& it : rDimensions)
+ // look for existing duplicate with orientation "hidden"
+
+ sal_Int32 nFound = 0;
+ const ScDPSaveData::DimsType& rDimensions = pSaveData->GetDimensions();
+ for (auto const& it : rDimensions)
+ {
+ if ( !it->IsDataLayout() && (it->GetName() == maFieldId.maFieldName) )
{
- if ( !it->IsDataLayout() && (it->GetName() == maFieldId.maFieldName) )
+ if ( it->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
{
- if ( it->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
- {
- pNewDim = it.get(); // use this one
- break;
- }
- else
- ++nFound; // count existing non-hidden occurrences
+ pNewDim = it.get(); // use this one
+ break;
}
+ else
+ ++nFound; // count existing non-hidden occurrences
}
+ }
- if ( !pNewDim ) // if none found, create a new duplicated dimension
- pNewDim = &pSaveData->DuplicateDimension( *pDim );
+ if ( !pNewDim ) // if none found, create a new duplicated dimension
+ pNewDim = &pSaveData->DuplicateDimension( *pDim );
- maFieldId.mnFieldIdx = nFound; // keep accessing the new one
- pDim = pNewDim;
- }
+ maFieldId.mnFieldIdx = nFound; // keep accessing the new one
+ pDim = pNewDim;
+ }
- pDim->SetOrientation(eNew);
+ pDim->SetOrientation(eNew);
- // move changed field behind all other fields (make it the last field in dimension)
- pSaveData->SetPosition( pDim, pSaveData->GetDimensions().size() );
+ // move changed field behind all other fields (make it the last field in dimension)
+ pSaveData->SetPosition( pDim, pSaveData->GetDimensions().size() );
- SetDPObject( pDPObj );
+ SetDPObject( pDPObj );
- maOrient <<= eNew; // modifying the same object's orientation again doesn't create another duplicate
- }
+ maOrient <<= eNew; // modifying the same object's orientation again doesn't create another duplicate
}
sal_Int16 ScDataPilotFieldObj::getFunction() const
@@ -2019,22 +2020,23 @@ void ScDataPilotFieldObj::setFunction(ScGeneralFunction eNewFunc)
{
SolarMutexGuard aGuard;
ScDPObject* pDPObj = nullptr;
- if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
+ ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
+ if(!pDim)
+ return;
+
+ if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
{
- if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
+ // for non-data fields, property Function is the subtotals
+ std::vector<ScGeneralFunction> nSubTotalFuncs;
+ if ( eNewFunc != ScGeneralFunction::NONE )
{
- // for non-data fields, property Function is the subtotals
- std::vector<ScGeneralFunction> nSubTotalFuncs;
- if ( eNewFunc != ScGeneralFunction::NONE )
- {
- nSubTotalFuncs.push_back( eNewFunc );
- }
- pDim->SetSubTotals( nSubTotalFuncs );
+ nSubTotalFuncs.push_back( eNewFunc );
}
- else
- pDim->SetFunction( eNewFunc );
- SetDPObject( pDPObj );
+ pDim->SetSubTotals( nSubTotalFuncs );
}
+ else
+ pDim->SetFunction( eNewFunc );
+ SetDPObject( pDPObj );
}
Sequence< sal_Int16 > ScDataPilotFieldObj::getSubtotals() const
@@ -2062,41 +2064,42 @@ void ScDataPilotFieldObj::setSubtotals( const std::vector< ScGeneralFunction >&
{
SolarMutexGuard aGuard;
ScDPObject* pDPObj = nullptr;
- if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
+ ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
+ if(!pDim)
+ return;
+
+ if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
{
- if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
+ sal_Int32 nCount = rSubtotals.size();
+ if( nCount == 1 )
{
- sal_Int32 nCount = rSubtotals.size();
- if( nCount == 1 )
+ // count 1: all values are allowed (including NONE and AUTO)
+ std::vector<ScGeneralFunction> nTmpFuncs;
+ if( rSubtotals[ 0 ] != ScGeneralFunction::NONE )
{
- // count 1: all values are allowed (including NONE and AUTO)
- std::vector<ScGeneralFunction> nTmpFuncs;
- if( rSubtotals[ 0 ] != ScGeneralFunction::NONE )
- {
- nTmpFuncs.push_back( rSubtotals[ 0 ] );
- }
- pDim->SetSubTotals( nTmpFuncs );
+ nTmpFuncs.push_back( rSubtotals[ 0 ] );
}
- else if( nCount > 1 )
+ pDim->SetSubTotals( nTmpFuncs );
+ }
+ else if( nCount > 1 )
+ {
+ // set multiple functions, ignore NONE and AUTO in this case
+ ::std::vector< ScGeneralFunction > aSubt;
+ for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
{
- // set multiple functions, ignore NONE and AUTO in this case
- ::std::vector< ScGeneralFunction > aSubt;
- for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
+ ScGeneralFunction eFunc = rSubtotals[ nIdx ];
+ if( (eFunc != ScGeneralFunction::NONE) && (eFunc != ScGeneralFunction::AUTO) )
{
- ScGeneralFunction eFunc = rSubtotals[ nIdx ];
- if( (eFunc != ScGeneralFunction::NONE) && (eFunc != ScGeneralFunction::AUTO) )
- {
- // do not insert functions twice
- if( ::std::find( aSubt.begin(), aSubt.end(), eFunc ) == aSubt.end() )
- aSubt.push_back( eFunc );
- }
+ // do not insert functions twice
+ if( ::std::find( aSubt.begin(), aSubt.end(), eFunc ) == aSubt.end() )
+ aSubt.push_back( eFunc );
}
- // set values from vector to ScDPSaveDimension
- pDim->SetSubTotals( aSubt );
}
+ // set values from vector to ScDPSaveDimension
+ pDim->SetSubTotals( aSubt );
}
- SetDPObject( pDPObj );
}
+ SetDPObject( pDPObj );
}
void ScDataPilotFieldObj::setCurrentPage( const OUString& rPage )
@@ -2114,19 +2117,20 @@ void ScDataPilotFieldObj::setUseCurrentPage( bool bUse )
{
SolarMutexGuard aGuard;
ScDPObject* pDPObj = nullptr;
- if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
+ ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
+ if(!pDim)
+ return;
+
+ if( bUse )
{
- if( bUse )
- {
- /* It is somehow useless to set the property "HasSelectedPage" to
- true, because it is still needed to set an explicit page name. */
- const OUString aPage;
- pDim->SetCurrentPage( &aPage );
- }
- else
- pDim->SetCurrentPage( nullptr );
- SetDPObject( pDPObj );
+ /* It is somehow useless to set the property "HasSelectedPage" to
+ true, because it is still needed to set an explicit page name. */
+ const OUString aPage;
+ pDim->SetCurrentPage( &aPage );
}
+ else
+ pDim->SetCurrentPage( nullptr );
+ SetDPObject( pDPObj );
}
const DataPilotFieldAutoShowInfo* ScDataPilotFieldObj::getAutoShowInfo() const
@@ -2310,92 +2314,92 @@ void ScDataPilotFieldObj::setGroupInfo( const DataPilotFieldGroupInfo* pInfo )
{
SolarMutexGuard aGuard;
ScDPObject* pDPObj = nullptr;
- if( /*ScDPSaveDimension* pDim =*/ GetDPDimension( &pDPObj ) )
+ if( /*ScDPSaveDimension* pDim =*/ !GetDPDimension( &pDPObj ) )
+ return;
+
+ ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+ if( pInfo && lclCheckMinMaxStep( *pInfo ) )
{
- ScDPSaveData* pSaveData = pDPObj->GetSaveData();
- if( pInfo && lclCheckMinMaxStep( *pInfo ) )
+ ScDPNumGroupInfo aInfo;
+ aInfo.mbEnable = true;
+ aInfo.mbDateValues = pInfo->HasDateValues;
+ aInfo.mbAutoStart = pInfo->HasAutoStart;
+ aInfo.mbAutoEnd = pInfo->HasAutoEnd;
+ aInfo.mfStart = pInfo->Start;
+ aInfo.mfEnd = pInfo->End;
+ aInfo.mfStep = pInfo->Step;
+ Reference< XNamed > xNamed( pInfo->SourceField, UNO_QUERY );
+ if( xNamed.is() )
{
- ScDPNumGroupInfo aInfo;
- aInfo.mbEnable = true;
- aInfo.mbDateValues = pInfo->HasDateValues;
- aInfo.mbAutoStart = pInfo->HasAutoStart;
- aInfo.mbAutoEnd = pInfo->HasAutoEnd;
- aInfo.mfStart = pInfo->Start;
- aInfo.mfEnd = pInfo->End;
- aInfo.mfStep = pInfo->Step;
- Reference< XNamed > xNamed( pInfo->SourceField, UNO_QUERY );
- if( xNamed.is() )
+ ScDPSaveGroupDimension aGroupDim( xNamed->getName(), getName() );
+ if( pInfo->GroupBy )
+ aGroupDim.SetDateInfo(aInfo, pInfo->GroupBy);
+ else
{
- ScDPSaveGroupDimension aGroupDim( xNamed->getName(), getName() );
- if( pInfo->GroupBy )
- aGroupDim.SetDateInfo(aInfo, pInfo->GroupBy);
- else
+ Reference<XIndexAccess> xIndex(pInfo->Groups, UNO_QUERY);
+ if (xIndex.is())
{
- Reference<XIndexAccess> xIndex(pInfo->Groups, UNO_QUERY);
- if (xIndex.is())
+ sal_Int32 nCount(xIndex->getCount());
+ for(sal_Int32 i = 0; i < nCount; i++)
{
- sal_Int32 nCount(xIndex->getCount());
- for(sal_Int32 i = 0; i < nCount; i++)
+ Reference<XNamed> xGroupNamed(xIndex->getByIndex(i), UNO_QUERY);
+ if (xGroupNamed.is())
{
- Reference<XNamed> xGroupNamed(xIndex->getByIndex(i), UNO_QUERY);
- if (xGroupNamed.is())
+ ScDPSaveGroupItem aItem(xGroupNamed->getName());
+ Reference<XIndexAccess> xGroupIndex(xGroupNamed, UNO_QUERY);
+ if (xGroupIndex.is())
{
- ScDPSaveGroupItem aItem(xGroupNamed->getName());
- Reference<XIndexAccess> xGroupIndex(xGroupNamed, UNO_QUERY);
- if (xGroupIndex.is())
+ sal_Int32 nItemCount(xGroupIndex->getCount());
+ for (sal_Int32 j = 0; j < nItemCount; ++j)
{
- sal_Int32 nItemCount(xGroupIndex->getCount());
- for (sal_Int32 j = 0; j < nItemCount; ++j)
- {
- Reference<XNamed> xItemNamed(xGroupIndex->getByIndex(j), UNO_QUERY);
- if (xItemNamed.is())
- aItem.AddElement(xItemNamed->getName());
- }
+ Reference<XNamed> xItemNamed(xGroupIndex->getByIndex(j), UNO_QUERY);
+ if (xItemNamed.is())
+ aItem.AddElement(xItemNamed->getName());
}
- aGroupDim.AddGroupItem(aItem);
}
+ aGroupDim.AddGroupItem(aItem);
}
}
}
-
- // get dimension savedata or create new if none
- ScDPDimensionSaveData& rDimSaveData = *pSaveData->GetDimensionData();
- rDimSaveData.ReplaceGroupDimension( aGroupDim );
}
- else // no source field in group info -> numeric group
- {
- ScDPDimensionSaveData* pDimData = pSaveData->GetDimensionData(); // created if not there
- ScDPSaveNumGroupDimension* pExisting = pDimData->GetNumGroupDimAcc( getName() );
- if ( pExisting )
- {
- if (pInfo->GroupBy)
- pExisting->SetDateInfo(aInfo, pInfo->GroupBy);
- // modify existing group dimension
- pExisting->SetGroupInfo( aInfo );
- }
- else if (pInfo->GroupBy)
- {
- // create new group dimension
- ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo, pInfo->GroupBy );
- pDimData->AddNumGroupDimension( aNumGroupDim );
- }
- else
- {
- // create new group dimension
- ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo );
- pDimData->AddNumGroupDimension( aNumGroupDim );
- }
- }
+ // get dimension savedata or create new if none
+ ScDPDimensionSaveData& rDimSaveData = *pSaveData->GetDimensionData();
+ rDimSaveData.ReplaceGroupDimension( aGroupDim );
}
- else // null passed as argument
+ else // no source field in group info -> numeric group
{
- pSaveData->SetDimensionData( nullptr );
- }
+ ScDPDimensionSaveData* pDimData = pSaveData->GetDimensionData(); // created if not there
- pDPObj->SetSaveData( *pSaveData );
- SetDPObject( pDPObj );
+ ScDPSaveNumGroupDimension* pExisting = pDimData->GetNumGroupDimAcc( getName() );
+ if ( pExisting )
+ {
+ if (pInfo->GroupBy)
+ pExisting->SetDateInfo(aInfo, pInfo->GroupBy);
+ // modify existing group dimension
+ pExisting->SetGroupInfo( aInfo );
+ }
+ else if (pInfo->GroupBy)
+ {
+ // create new group dimension
+ ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo, pInfo->GroupBy );
+ pDimData->AddNumGroupDimension( aNumGroupDim );
+ }
+ else
+ {
+ // create new group dimension
+ ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo );
+ pDimData->AddNumGroupDimension( aNumGroupDim );
+ }
+ }
}
+ else // null passed as argument
+ {
+ pSaveData->SetDimensionData( nullptr );
+ }
+
+ pDPObj->SetSaveData( *pSaveData );
+ SetDPObject( pDPObj );
}
// XDataPilotFieldGrouping
@@ -3238,49 +3242,50 @@ void SAL_CALL ScDataPilotItemObj::setPropertyValue( const OUString& aPropertyNam
{
SolarMutexGuard aGuard;
ScDPObject* pDPObj = nullptr;
- if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
+ ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
+ if(!pDim)
+ return;
+
+ Reference<XNameAccess> xMembers = GetMembers();
+ if( !xMembers.is() )
+ return;
+
+ Reference<XIndexAccess> xMembersIndex( new ScNameToIndexAccess( xMembers ) );
+ sal_Int32 nCount = xMembersIndex->getCount();
+ if( mnIndex >= nCount )
+ return;
+
+ Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY);
+ OUString sName(xMember->getName());
+ ScDPSaveMember* pMember = pDim->GetMemberByName(sName);
+ if (!pMember)
+ return;
+
+ bool bGetNewIndex = false;
+ if ( aPropertyName == SC_UNONAME_SHOWDETAIL )
+ pMember->SetShowDetails(cppu::any2bool(aValue));
+ else if ( aPropertyName == SC_UNONAME_ISHIDDEN )
+ pMember->SetIsVisible(!cppu::any2bool(aValue));
+ else if ( aPropertyName == SC_UNONAME_POS )
{
- Reference<XNameAccess> xMembers = GetMembers();
- if( xMembers.is() )
- {
- Reference<XIndexAccess> xMembersIndex( new ScNameToIndexAccess( xMembers ) );
- sal_Int32 nCount = xMembersIndex->getCount();
- if( mnIndex < nCount )
- {
- Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY);
- OUString sName(xMember->getName());
- ScDPSaveMember* pMember = pDim->GetMemberByName(sName);
- if (pMember)
- {
- bool bGetNewIndex = false;
- if ( aPropertyName == SC_UNONAME_SHOWDETAIL )
- pMember->SetShowDetails(cppu::any2bool(aValue));
- else if ( aPropertyName == SC_UNONAME_ISHIDDEN )
- pMember->SetIsVisible(!cppu::any2bool(aValue));
- else if ( aPropertyName == SC_UNONAME_POS )
- {
- sal_Int32 nNewPos = 0;
- if ( !( aValue >>= nNewPos ) || nNewPos < 0 || nNewPos >= nCount )
- throw IllegalArgumentException();
+ sal_Int32 nNewPos = 0;
+ if ( !( aValue >>= nNewPos ) || nNewPos < 0 || nNewPos >= nCount )
+ throw IllegalArgumentException();
- pDim->SetMemberPosition( sName, nNewPos );
- // get new effective index (depends on sorting mode, which isn't modified)
- bGetNewIndex = true;
+ pDim->SetMemberPosition( sName, nNewPos );
+ // get new effective index (depends on sorting mode, which isn't modified)
+ bGetNewIndex = true;
- }
- SetDPObject( pDPObj );
+ }
+ SetDPObject( pDPObj );
- if ( bGetNewIndex ) // after SetDPObject, get the new index
- {
- Sequence< OUString > aItemNames = xMembers->getElementNames();
- sal_Int32 nItemCount = aItemNames.getLength();
- for (sal_Int32 nItem=0; nItem<nItemCount; ++nItem)
- if (aItemNames[nItem] == sName)
- mnIndex = nItem;
- }
- }
- }
- }
+ if ( bGetNewIndex ) // after SetDPObject, get the new index
+ {
+ Sequence< OUString > aItemNames = xMembers->getElementNames();
+ sal_Int32 nItemCount = aItemNames.getLength();
+ for (sal_Int32 nItem=0; nItem<nItemCount; ++nItem)
+ if (aItemNames[nItem] == sName)
+ mnIndex = nItem;
}
}
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 056b3c281a0c..40f212c33950 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -1506,18 +1506,18 @@ void ScDataPilotFilterDescriptor::GetData( ScQueryParam& rParam ) const
void ScDataPilotFilterDescriptor::PutData( const ScQueryParam& rParam )
{
- if (mxParent.is())
+ if (!mxParent.is())
+ return;
+
+ ScDPObject* pDPObj = mxParent->GetDPObject();
+ if (pDPObj)
{
- ScDPObject* pDPObj = mxParent->GetDPObject();
- if (pDPObj)
- {
- ScSheetSourceDesc aSheetDesc(&mxParent->GetDocShell()->GetDocument());
- if (pDPObj->IsSheetData())
- aSheetDesc = *pDPObj->GetSheetDesc();
- aSheetDesc.SetQueryParam(rParam);
- pDPObj->SetSheetDesc(aSheetDesc);
- mxParent->SetDPObject(pDPObj);
- }
+ ScSheetSourceDesc aSheetDesc(&mxParent->GetDocShell()->GetDocument());
+ if (pDPObj->IsSheetData())
+ aSheetDesc = *pDPObj->GetSheetDesc();
+ aSheetDesc.SetQueryParam(rParam);
+ pDPObj->SetSheetDesc(aSheetDesc);
+ mxParent->SetDPObject(pDPObj);
}
}
@@ -1671,49 +1671,49 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScDatabaseRangeObj::getSortDescript
void ScDatabaseRangeObj::GetQueryParam(ScQueryParam& rQueryParam) const
{
const ScDBData* pData = GetDBData_Impl();
- if (pData)
- {
- pData->GetQueryParam(rQueryParam);
+ if (!pData)
+ return;
- // FilterDescriptor contains the counted fields inside the area
- ScRange aDBRange;
- pData->GetArea(aDBRange);
- SCCOLROW nFieldStart = rQueryParam.bByRow ? static_cast<SCCOLROW>(aDBRange.aStart.Col()) : static_cast<SCCOLROW>(aDBRange.aStart.Row());
- SCSIZE nCount = rQueryParam.GetEntryCount();
- for (SCSIZE i=0; i<nCount; i++)
- {
- ScQueryEntry& rEntry = rQueryParam.GetEntry(i);
- if (rEntry.bDoQuery && rEntry.nField >= nFieldStart)
- rEntry.nField -= nFieldStart;
- }
+ pData->GetQueryParam(rQueryParam);
+
+ // FilterDescriptor contains the counted fields inside the area
+ ScRange aDBRange;
+ pData->GetArea(aDBRange);
+ SCCOLROW nFieldStart = rQueryParam.bByRow ? static_cast<SCCOLROW>(aDBRange.aStart.Col()) : static_cast<SCCOLROW>(aDBRange.aStart.Row());
+ SCSIZE nCount = rQueryParam.GetEntryCount();
+ for (SCSIZE i=0; i<nCount; i++)
+ {
+ ScQueryEntry& rEntry = rQueryParam.GetEntry(i);
+ if (rEntry.bDoQuery && rEntry.nField >= nFieldStart)
+ rEntry.nField -= nFieldStart;
}
}
void ScDatabaseRangeObj::SetQueryParam(const ScQueryParam& rQueryParam)
{
const ScDBData* pData = GetDBData_Impl();
- if (pData)
- {
- // FilterDescriptor contains the counted fields inside the area
- ScQueryParam aParam(rQueryParam);
- ScRange aDBRange;
- pData->GetArea(aDBRange);
- SCCOLROW nFieldStart = aParam.bByRow ? static_cast<SCCOLROW>(aDBRange.aStart.Col()) : static_cast<SCCOLROW>(aDBRange.aStart.Row());
+ if (!pData)
+ return;
- SCSIZE nCount = aParam.GetEntryCount();
- for (SCSIZE i=0; i<nCount; i++)
- {
- ScQueryEntry& rEntry = aParam.GetEntry(i);
- if (rEntry.bDoQuery)
- rEntry.nField += nFieldStart;
- }
+ // FilterDescriptor contains the counted fields inside the area
+ ScQueryParam aParam(rQueryParam);
+ ScRange aDBRange;
+ pData->GetArea(aDBRange);
+ SCCOLROW nFieldStart = aParam.bByRow ? static_cast<SCCOLROW>(aDBRange.aStart.Col()) : static_cast<SCCOLROW>(aDBRange.aStart.Row());
- ScDBData aNewData( *pData );
- aNewData.SetQueryParam(aParam);
- aNewData.SetHeader(aParam.bHasHeader); // not in ScDBData::SetQueryParam
- ScDBDocFunc aFunc(*pDocShell);
- aFunc.ModifyDBData(aNewData);
+ SCSIZE nCount = aParam.GetEntryCount();
+ for (SCSIZE i=0; i<nCount; i++)
+ {
+ ScQueryEntry& rEntry = aParam.GetEntry(i);
+ if (rEntry.bDoQuery)
+ rEntry.nField += nFieldStart;
}
+
+ ScDBData aNewData( *pData );
+ aNewData.SetQueryParam(aParam);
+ aNewData.SetHeader(aParam.bHasHeader); // not in ScDBData::SetQueryParam
+ ScDBDocFunc aFunc(*pDocShell);
+ aFunc.ModifyDBData(aNewData);
}
uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScDatabaseRangeObj::getFilterDescriptor()
@@ -1725,25 +1725,25 @@ uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScDatabaseRangeObj::getFi
void ScDatabaseRangeObj::GetSubTotalParam(ScSubTotalParam& rSubTotalParam) const
{
const ScDBData* pData = GetDBData_Impl();
- if (pData)
- {
- pData->GetSubTotalParam(rSubTotalParam);
+ if (!pData)
+ return;
- // FilterDescriptor contains the counted fields inside the area
- ScRange aDBRange;
- pData->GetArea(aDBRange);
- SCCOL nFieldStart = aDBRange.aStart.Col();
- for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
+ pData->GetSubTotalParam(rSubTotalParam);
+
+ // FilterDescriptor contains the counted fields inside the area
+ ScRange aDBRange;
+ pData->GetArea(aDBRange);
+ SCCOL nFieldStart = aDBRange.aStart.Col();
+ for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
+ {
+ if ( rSubTotalParam.bGroupActive[i] )
{
- if ( rSubTotalParam.bGroupActive[i] )
- {
- if ( rSubTotalParam.nField[i] >= nFieldStart )
- rSubTotalParam.nField[i] = sal::static_int_cast<SCCOL>( rSubTotalParam.nField[i] - nFieldStart );
- for (SCCOL j=0; j<rSubTotalParam.nSubTotals[i]; j++)
- if ( rSubTotalParam.pSubTotals[i][j] >= nFieldStart )
- rSubTotalParam.pSubTotals[i][j] =
- sal::static_int_cast<SCCOL>( rSubTotalParam.pSubTotals[i][j] - nFieldStart );
- }
+ if ( rSubTotalParam.nField[i] >= nFieldStart )
+ rSubTotalParam.nField[i] = sal::static_int_cast<SCCOL>( rSubTotalParam.nField[i] - nFieldStart );
+ for (SCCOL j=0; j<rSubTotalParam.nSubTotals[i]; j++)
+ if ( rSubTotalParam.pSubTotals[i][j] >= nFieldStart )
+ rSubTotalParam.pSubTotals[i][j] =
+ sal::static_int_cast<SCCOL>( rSubTotalParam.pSubTotals[i][j] - nFieldStart );
}
}
}
@@ -1751,28 +1751,28 @@ void ScDatabaseRangeObj::GetSubTotalParam(ScSubTotalParam& rSubTotalParam) const
void ScDatabaseRangeObj::SetSubTotalParam(const ScSubTotalParam& rSubTotalParam)
{
const ScDBData* pData = GetDBData_Impl();
- if (pData)
+ if (!pData)
+ return;
+
+ // FilterDescriptor contains the counted fields inside the area
+ ScSubTotalParam aParam(rSubTotalParam);
+ ScRange aDBRange;
+ pData->GetArea(aDBRange);
+ SCCOL nFieldStart = aDBRange.aStart.Col();
+ for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
{
- // FilterDescriptor contains the counted fields inside the area
- ScSubTotalParam aParam(rSubTotalParam);
- ScRange aDBRange;
- pData->GetArea(aDBRange);
- SCCOL nFieldStart = aDBRange.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 );
}
-
- ScDBData aNewData( *pData );
- aNewData.SetSubTotalParam(aParam);
- ScDBDocFunc aFunc(*pDocShell);
- aFunc.ModifyDBData(aNewData);
}
+
+ ScDBData aNewData( *pData );
+ aNewData.SetSubTotalParam(aParam);
+ ScDBDocFunc aFunc(*pDocShell);
+ aFunc.ModifyDBData(aNewData);
}
uno::Reference<sheet::XSubTotalDescriptor> SAL_CALL ScDatabaseRangeObj::getSubTotalDescriptor()
@@ -1800,27 +1800,27 @@ void SAL_CALL ScDatabaseRangeObj::refresh()
{
SolarMutexGuard aGuard;
ScDBData* pData = GetDBData_Impl();
- if ( pDocShell && pData )
- {
- ScDBDocFunc aFunc(*pDocShell);
+ if ( !(pDocShell && pData) )
+ return;
- // repeat import?
- bool bContinue = true;
- ScImportParam aImportParam;
- pData->GetImportParam( aImportParam );
- if (aImportParam.bImport && !pData->HasImportSelection())
- {
- SCTAB nTab;
- SCCOL nDummyCol;
- SCROW nDummyRow;
- pData->GetArea( nTab, nDummyCol,nDummyRow,nDummyCol,nDummyRow );
- bContinue = aFunc.DoImport( nTab, aImportParam, nullptr ); //! Api-Flag as parameter
- }
+ ScDBDocFunc aFunc(*pDocShell);
- // if no error then internal operations (sort, query, subtotal)
- if (bContinue)
- aFunc.RepeatDB( pData->GetName(), true, bIsUnnamed, aTab );
+ // repeat import?
+ bool bContinue = true;
+ ScImportParam aImportParam;
+ pData->GetImportParam( aImportParam );
+ if (aImportParam.bImport && !pData->HasImportSelection())
+ {
+ SCTAB nTab;
+ SCCOL nDummyCol;
+ SCROW nDummyRow;
+ pData->GetArea( nTab, nDummyCol,nDummyRow,nDummyCol,nDummyRow );
+ bContinue = aFunc.DoImport( nTab, aImportParam, nullptr ); //! Api-Flag as parameter
}
+
+ // if no error then internal operations (sort, query, subtotal)
+ if (bContinue)
+ aFunc.RepeatDB( pData->GetName(), true, bIsUnnamed, aTab );
}
void SAL_CALL ScDatabaseRangeObj::addRefreshListener(
@@ -1895,92 +1895,92 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue(
{
SolarMutexGuard aGuard;
ScDBData* pData = GetDBData_Impl();
- if ( pDocShell && pData )
+ if ( !(pDocShell && pData) )
+ return;
+
+ ScDBData aNewData( *pData );
+ bool bDo = true;
+
+ if ( aPropertyName == SC_UNONAME_KEEPFORM )
+ aNewData.SetKeepFmt( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNONAME_MOVCELLS )
+ aNewData.SetDoSize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNONAME_STRIPDAT )
+ aNewData.SetStripData( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if (aPropertyName == SC_UNONAME_AUTOFLT )
{
- ScDBData aNewData( *pData );
- bool bDo = true;
-
- if ( aPropertyName == SC_UNONAME_KEEPFORM )
- aNewData.SetKeepFmt( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNONAME_MOVCELLS )
- aNewData.SetDoSize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNONAME_STRIPDAT )
- aNewData.SetStripData( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if (aPropertyName == SC_UNONAME_AUTOFLT )
+ bool bAutoFilter(ScUnoHelpFunctions::GetBoolFromAny( aValue ));
+ aNewData.SetAutoFilter(bAutoFilter);
+ ScRange aRange;
+ aNewData.GetArea(aRange);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if (bAutoFilter)
+ rDoc.ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aEnd.Col(), aRange.aStart.Row(),
+ aRange.aStart.Tab(), ScMF::Auto );
+ else if (!bAutoFilter)
+ rDoc.RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aEnd.Col(), aRange.aStart.Row(),
+ aRange.aStart.Tab(), ScMF::Auto );
+ ScRange aPaintRange(aRange.aStart, aRange.aEnd);
+ aPaintRange.aEnd.SetRow(aPaintRange.aStart.Row());
+ pDocShell->PostPaint(aPaintRange, PaintPartFlags::Grid);
+ }
+ else if (aPropertyName == SC_UNONAME_USEFLTCRT )
+ {
+ if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
{
- bool bAutoFilter(ScUnoHelpFunctions::GetBoolFromAny( aValue ));
- aNewData.SetAutoFilter(bAutoFilter);
+ // only here to set bIsAdvanced in ScDBData
ScRange aRange;
- aNewData.GetArea(aRange);
- ScDocument& rDoc = pDocShell->GetDocument();
- if (bAutoFilter)
- rDoc.ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aStart.Row(),
- aRange.aStart.Tab(), ScMF::Auto );
- else if (!bAutoFilter)
- rDoc.RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aStart.Row(),
- aRange.aStart.Tab(), ScMF::Auto );
- ScRange aPaintRange(aRange.aStart, aRange.aEnd);
- aPaintRange.aEnd.SetRow(aPaintRange.aStart.Row());
- pDocShell->PostPaint(aPaintRange, PaintPartFlags::Grid);
+ (void)aNewData.GetAdvancedQuerySource(aRange);
+ aNewData.SetAdvancedQuerySource(&aRange);
}
- else if (aPropertyName == SC_UNONAME_USEFLTCRT )
- {
- if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
- {
- // only here to set bIsAdvanced in ScDBData
- ScRange aRange;
- (void)aNewData.GetAdvancedQuerySource(aRange);
- aNewData.SetAdvancedQuerySource(&aRange);
- }
- else
- aNewData.SetAdvancedQuerySource(nullptr);
- }
- else if (aPropertyName == SC_UNONAME_FLTCRT )
+ else
+ aNewData.SetAdvancedQuerySource(nullptr);
+ }
+ else if (aPropertyName == SC_UNONAME_FLTCRT )
+ {
+ table::CellRangeAddress aRange;
+ if (aValue >>= aRange)
{
- table::CellRangeAddress aRange;
- if (aValue >>= aRange)
- {
- ScRange aCoreRange;
- ScUnoConversion::FillScRange(aCoreRange, aRange);
+ ScRange aCoreRange;
+ ScUnoConversion::FillScRange(aCoreRange, aRange);
- aNewData.SetAdvancedQuerySource(&aCoreRange);
- }
- }
- else if (aPropertyName == SC_UNONAME_FROMSELECT )
- {
- aNewData.SetImportSelection(::cppu::any2bool(aValue));
+ aNewData.SetAdvancedQuerySource(&aCoreRange);
}
- else if (aPropertyName == SC_UNONAME_REFPERIOD )
+ }
+ else if (aPropertyName == SC_UNONAME_FROMSELECT )
+ {
+ aNewData.SetImportSelection(::cppu::any2bool(aValue));
+ }
+ else if (aPropertyName == SC_UNONAME_REFPERIOD )
+ {
+ sal_Int32 nRefresh = 0;
+ if (aValue >>= nRefresh)
{
- sal_Int32 nRefresh = 0;
- if (aValue >>= nRefresh)
+ ScDocument& rDoc = pDocShell->GetDocument();
+ aNewData.SetRefreshDelay(nRefresh);
+ if (rDoc.GetDBCollection())
{
- ScDocument& rDoc = pDocShell->GetDocument();
- aNewData.SetRefreshDelay(nRefresh);
- if (rDoc.GetDBCollection())
- {
- aNewData.SetRefreshHandler( rDoc.GetDBCollection()->GetRefreshHandler() );
- aNewData.SetRefreshControl( &rDoc.GetRefreshTimerControlAddress() );
- }
+ aNewData.SetRefreshHandler( rDoc.GetDBCollection()->GetRefreshHandler() );
+ aNewData.SetRefreshControl( &rDoc.GetRefreshTimerControlAddress() );
}
}
- else if (aPropertyName == SC_UNONAME_CONRES )
- {
- }
- else if ( aPropertyName == SC_UNONAME_TOTALSROW )
- aNewData.SetTotals( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNONAME_CONTHDR )
- aNewData.SetHeader( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else
- bDo = false;
+ }
+ else if (aPropertyName == SC_UNONAME_CONRES )
+ {
+ }
+ else if ( aPropertyName == SC_UNONAME_TOTALSROW )
+ aNewData.SetTotals( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNONAME_CONTHDR )
+ aNewData.SetHeader( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else
+ bDo = false;
- if (bDo)
- {
- ScDBDocFunc aFunc(*pDocShell);
- aFunc.ModifyDBData(aNewData);
- }
+ if (bDo)
+ {
+ ScDBDocFunc aFunc(*pDocShell);
+ aFunc.ModifyDBData(aNewData);
}
}
diff --git a/sc/source/ui/unoobj/dispuno.cxx b/sc/source/ui/unoobj/dispuno.cxx
index 74e3ba29a493..533bcd8024ba 100644
--- a/sc/source/ui/unoobj/dispuno.cxx
+++ b/sc/source/ui/unoobj/dispuno.cxx
@@ -52,26 +52,26 @@ static uno::Reference<view::XSelectionSupplier> lcl_GetSelectionSupplier( const
ScDispatchProviderInterceptor::ScDispatchProviderInterceptor(ScTabViewShell* pViewSh) :
pViewShell( pViewSh )
{
- if ( pViewShell )
- {
- m_xIntercepted.set(uno::Reference<frame::XDispatchProviderInterception>(pViewShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY));
- if (m_xIntercepted.is())
- {
- osl_atomic_increment( &m_refCount );
+ if ( !pViewShell )
+ return;
- m_xIntercepted->registerDispatchProviderInterceptor(
- static_cast<frame::XDispatchProviderInterceptor*>(this));
- // this should make us the top-level dispatch-provider for the component, via a call to our
- // setDispatchProvider we should have got a fallback for requests we (i.e. our master) cannot fulfill
- uno::Reference<lang::XComponent> xInterceptedComponent(m_xIntercepted, uno::UNO_QUERY);
- if (xInterceptedComponent.is())
- xInterceptedComponent->addEventListener(static_cast<lang::XEventListener*>(this));
+ m_xIntercepted.set(uno::Reference<frame::XDispatchProviderInterception>(pViewShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY));
+ if (m_xIntercepted.is())
+ {
+ osl_atomic_increment( &m_refCount );
- osl_atomic_decrement( &m_refCount );
- }
+ m_xIntercepted->registerDispatchProviderInterceptor(
+ static_cast<frame::XDispatchProviderInterceptor*>(this));
+ // this should make us the top-level dispatch-provider for the component, via a call to our
+ // setDispatchProvider we should have got a fallback for requests we (i.e. our master) cannot fulfill
+ uno::Reference<lang::XComponent> xInterceptedComponent(m_xIntercepted, uno::UNO_QUERY);
+ if (xInterceptedComponent.is())
+ xInterceptedComponent->addEventListener(static_cast<lang::XEventListener*>(this));
- StartListening(*pViewShell);
+ osl_atomic_decrement( &m_refCount );
}
+
+ StartListening(*pViewShell);
}
ScDispatchProviderInterceptor::~ScDispatchProviderInterceptor()
@@ -293,26 +293,26 @@ void SAL_CALL ScDispatch::removeStatusListener(
{
SolarMutexGuard aGuard;
- if ( aURL.Complete == cURLDocDataSource )
+ if ( aURL.Complete != cURLDocDataSource )
+ return;
+
+ sal_uInt16 nCount = aDataSourceListeners.size();
+ for ( sal_uInt16 n=nCount; n--; )
{
- sal_uInt16 nCount = aDataSourceListeners.size();
- for ( sal_uInt16 n=nCount; n--; )
+ uno::Reference<frame::XStatusListener>& rObj = aDataSourceListeners[n];
+ if ( rObj == xListener )
{
- uno::Reference<frame::XStatusListener>& rObj = aDataSourceListeners[n];
- if ( rObj == xListener )
- {
- aDataSourceListeners.erase( aDataSourceListeners.begin() + n );
- break;
- }
+ aDataSourceListeners.erase( aDataSourceListeners.begin() + n );
+ break;
}
+ }
- if ( aDataSourceListeners.empty() && pViewShell )
- {
- uno::Reference<view::XSelectionSupplier> xSupplier(lcl_GetSelectionSupplier( pViewShell ));
- if ( xSupplier.is() )
- xSupplier->removeSelectionChangeListener(this);
- bListeningToView = false;
- }
+ if ( aDataSourceListeners.empty() && pViewShell )
+ {
+ uno::Reference<view::XSelectionSupplier> xSupplier(lcl_GetSelectionSupplier( pViewShell ));
+ if ( xSupplier.is() )
+ xSupplier->removeSelectionChangeListener(this);
+ bListeningToView = false;
}
}
@@ -322,32 +322,32 @@ void SAL_CALL ScDispatch::selectionChanged( const css::lang::EventObject& /* aEv
{
// currently only called for URL cURLDocDataSource
- if ( pViewShell )
- {
- ScImportParam aNewImport;
- ScDBData* pDBData = pViewShell->GetDBData(false,SC_DB_OLD);
- if ( pDBData )
- pDBData->GetImportParam( aNewImport );
-
- // notify listeners only if data source has changed
- if ( aNewImport.bImport != aLastImport.bImport ||
- aNewImport.aDBName != aLastImport.aDBName ||
- aNewImport.aStatement != aLastImport.aStatement ||
- aNewImport.bSql != aLastImport.bSql ||
- aNewImport.nType != aLastImport.nType )
- {
- frame::FeatureStateEvent aEvent;
- aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
- aEvent.FeatureURL.Complete = cURLDocDataSource;
+ if ( !pViewShell )
+ return;
- lcl_FillDataSource( aEvent, aNewImport ); // modifies State, IsEnabled
+ ScImportParam aNewImport;
+ ScDBData* pDBData = pViewShell->GetDBData(false,SC_DB_OLD);
+ if ( pDBData )
+ pDBData->GetImportParam( aNewImport );
- for (uno::Reference<frame::XStatusListener> & xDataSourceListener : aDataSourceListeners)
- xDataSourceListener->statusChanged( aEvent );
+ // notify listeners only if data source has changed
+ if ( !(aNewImport.bImport != aLastImport.bImport ||
+ aNewImport.aDBName != aLastImport.aDBName ||
+ aNewImport.aStatement != aLastImport.aStatement ||
+ aNewImport.bSql != aLastImport.bSql ||
+ aNewImport.nType != aLastImport.nType) )
+ return;
- aLastImport = aNewImport;
- }
- }
+ frame::FeatureStateEvent aEvent;
+ aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
+ aEvent.FeatureURL.Complete = cURLDocDataSource;
+
+ lcl_FillDataSource( aEvent, aNewImport ); // modifies State, IsEnabled
+
+ for (uno::Reference<frame::XStatusListener> & xDataSourceListener : aDataSourceListeners)
+ xDataSourceListener->statusChanged( aEvent );
+
+ aLastImport = aNewImport;
}
// XEventListener
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 4f38c1b64bfb..6fc8291a55c8 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2207,89 +2207,89 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
// resolve the hyperlinks for PDF export
- if ( pPDFData && !pPDFData->GetBookmarks().empty() )
- {
- // iterate over the hyperlinks that were output for this page
+ if ( !pPDFData || pPDFData->GetBookmarks().empty() )
+ return;
+
+ // iterate over the hyperlinks that were output for this page
- std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFData->GetBookmarks();
- for ( const auto& rBookmark : rBookmarks )
+ std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFData->GetBookmarks();
+ for ( const auto& rBookmark : rBookmarks )
+ {
+ OUString aBookmark = rBookmark.aBookmark;
+ if ( aBookmark.toChar() == '#' )
{
- OUString aBookmark = rBookmark.aBookmark;
- if ( aBookmark.toChar() == '#' )
- {
- // try to resolve internal link
+ // try to resolve internal link
- OUString aTarget( aBookmark.copy( 1 ) );
+ OUString aTarget( aBookmark.copy( 1 ) );
- ScRange aTargetRange;
- tools::Rectangle aTargetRect; // 1/100th mm
- bool bIsSheet = false;
- bool bValid = lcl_ParseTarget( aTarget, aTargetRange, aTargetRect, bIsSheet, &rDoc, nTab );
+ ScRange aTargetRange;
+ tools::Rectangle aTargetRect; // 1/100th mm
+ bool bIsSheet = false;
+ bool bValid = lcl_ParseTarget( aTarget, aTargetRange, aTargetRect, bIsSheet, &rDoc, nTab );
- if ( bValid )
+ if ( bValid )
+ {
+ sal_Int32 nPage = -1;
+ tools::Rectangle aArea;
+ if ( bIsSheet )
{
- sal_Int32 nPage = -1;
- tools::Rectangle aArea;
- if ( bIsSheet )
- {
- // Get first page for sheet (if nothing from that sheet is printed,
- // this page can show a different sheet)
- nPage = pPrintFuncCache->GetTabStart( aTargetRange.aStart.Tab() );
- aArea = pDev->PixelToLogic( tools::Rectangle( 0,0,0,0 ) );
- }
- else
- {
- pPrintFuncCache->InitLocations( aMark, pDev ); // does nothing if already initialized
+ // Get first page for sheet (if nothing from that sheet is printed,
+ // this page can show a different sheet)
+ nPage = pPrintFuncCache->GetTabStart( aTargetRange.aStart.Tab() );
+ aArea = pDev->PixelToLogic( tools::Rectangle( 0,0,0,0 ) );
+ }
+ else
+ {
+ pPrintFuncCache->InitLocations( aMark, pDev ); // does nothing if already initialized
- ScPrintPageLocation aLocation;
- if ( pPrintFuncCache->FindLocation( aTargetRange.aStart, aLocation ) )
- {
- nPage = aLocation.nPage;
-
- // get the rectangle of the page's cell range in 1/100th mm
- ScRange aLocRange = aLocation.aCellRange;
- tools::Rectangle aLocationMM = rDoc.GetMMRect(
- aLocRange.aStart.Col(), aLocRange.aStart.Row(),
- aLocRange.aEnd.Col(), aLocRange.aEnd.Row(),
- aLocRange.aStart.Tab() );
- tools::Rectangle aLocationPixel = aLocation.aRectangle;
-
- // Scale and move the target rectangle from aLocationMM to aLocationPixel,
- // to get the target rectangle in pixels.
- assert(aLocationPixel.GetWidth() != 0 && aLocationPixel.GetHeight() != 0);
-
- Fraction aScaleX( aLocationPixel.GetWidth(), aLocationMM.GetWidth() );
- Fraction aScaleY( aLocationPixel.GetHeight(), aLocationMM.GetHeight() );
-
- long nX1 = aLocationPixel.Left() + static_cast<long>( Fraction( aTargetRect.Left() - aLocationMM.Left(), 1 ) * aScaleX );
- long nX2 = aLocationPixel.Left() + static_cast<long>( Fraction( aTargetRect.Right() - aLocationMM.Left(), 1 ) * aScaleX );
- long nY1 = aLocationPixel.Top() + static_cast<long>( Fraction( aTargetRect.Top() - aLocationMM.Top(), 1 ) * aScaleY );
- long nY2 = aLocationPixel.Top() + static_cast<long>( Fraction( aTargetRect.Bottom() - aLocationMM.Top(), 1 ) * aScaleY );
-
- if ( nX1 > aLocationPixel.Right() ) nX1 = aLocationPixel.Right();
- if ( nX2 > aLocationPixel.Right() ) nX2 = aLocationPixel.Right();
- if ( nY1 > aLocationPixel.Bottom() ) nY1 = aLocationPixel.Bottom();
- if ( nY2 > aLocationPixel.Bottom() ) nY2 = aLocationPixel.Bottom();
-
- // The link target area is interpreted using the device's MapMode at
- // the time of the CreateDest call, so PixelToLogic can be used here,
- // regardless of the MapMode that is actually selected.
- aArea = pDev->PixelToLogic( tools::Rectangle( nX1, nY1, nX2, nY2 ) );
- }
+ ScPrintPageLocation aLocation;
+ if ( pPrintFuncCache->FindLocation( aTargetRange.aStart, aLocation ) )
+ {
+ nPage = aLocation.nPage;
+
+ // get the rectangle of the page's cell range in 1/100th mm
+ ScRange aLocRange = aLocation.aCellRange;
+ tools::Rectangle aLocationMM = rDoc.GetMMRect(
+ aLocRange.aStart.Col(), aLocRange.aStart.Row(),
+ aLocRange.aEnd.Col(), aLocRange.aEnd.Row(),
+ aLocRange.aStart.Tab() );
+ tools::Rectangle aLocationPixel = aLocation.aRectangle;
+
+ // Scale and move the target rectangle from aLocationMM to aLocationPixel,
+ // to get the target rectangle in pixels.
+ assert(aLocationPixel.GetWidth() != 0 && aLocationPixel.GetHeight() != 0);
+
+ Fraction aScaleX( aLocationPixel.GetWidth(), aLocationMM.GetWidth() );
+ Fraction aScaleY( aLocationPixel.GetHeight(), aLocationMM.GetHeight() );
+
+ long nX1 = aLocationPixel.Left() + static_cast<long>( Fraction( aTargetRect.Left() - aLocationMM.Left(), 1 ) * aScaleX );
+ long nX2 = aLocationPixel.Left() + static_cast<long>( Fraction( aTargetRect.Right() - aLocationMM.Left(), 1 ) * aScaleX );
+ long nY1 = aLocationPixel.Top() + static_cast<long>( Fraction( aTargetRect.Top() - aLocationMM.Top(), 1 ) * aScaleY );
+ long nY2 = aLocationPixel.Top() + static_cast<long>( Fraction( aTargetRect.Bottom() - aLocationMM.Top(), 1 ) * aScaleY );
+
+ if ( nX1 > aLocationPixel.Right() ) nX1 = aLocationPixel.Right();
+ if ( nX2 > aLocationPixel.Right() ) nX2 = aLocationPixel.Right();
+ if ( nY1 > aLocationPixel.Bottom() ) nY1 = aLocationPixel.Bottom();
+ if ( nY2 > aLocationPixel.Bottom() ) nY2 = aLocationPixel.Bottom();
+
+ // The link target area is interpreted using the device's MapMode at
+ // the time of the CreateDest call, so PixelToLogic can be used here,
+ // regardless of the MapMode that is actually selected.
+ aArea = pDev->PixelToLogic( tools::Rectangle( nX1, nY1, nX2, nY2 ) );
}
-
- if ( nPage >= 0 )
- pPDFData->SetLinkDest( rBookmark.nLinkId, pPDFData->CreateDest( aArea, nPage ) );
}
- }
- else
- {
- // external link, use as-is
- pPDFData->SetLinkURL( rBookmark.nLinkId, aBookmark );
+
+ if ( nPage >= 0 )
+ pPDFData->SetLinkDest( rBookmark.nLinkId, pPDFData->CreateDest( aArea, nPage ) );
}
}
- rBookmarks.clear();
+ else
+ {
+ // external link, use as-is
+ pPDFData->SetLinkURL( rBookmark.nLinkId, aBookmark );
+ }
}
+ rBookmarks.clear();
}
// XLinkTargetSupplier
@@ -2595,146 +2595,146 @@ void SAL_CALL ScModelObj::setPropertyValue(
{
SolarMutexGuard aGuard;
- if (pDocShell)
- {
- ScDocument& rDoc = pDocShell->GetDocument();
- const ScDocOptions& rOldOpt = rDoc.GetDocOptions();
- ScDocOptions aNewOpt = rOldOpt;
- // Don't recalculate while loading XML, when the formula text is stored
- // Recalculation after loading is handled separately.
- bool bHardRecalc = !rDoc.IsImportingXML();
+ if (!pDocShell)
+ return;
- bool bOpt = ScDocOptionsHelper::setPropertyValue( aNewOpt, aPropSet.getPropertyMap(), aPropertyName, aValue );
- if (bOpt)
- {
- // done...
- if ( aPropertyName == SC_UNO_IGNORECASE ||
- aPropertyName == SC_UNONAME_REGEXP ||
- aPropertyName == SC_UNONAME_WILDCARDS ||
- aPropertyName == SC_UNO_LOOKUPLABELS )
- bHardRecalc = false;
- }
- else if ( aPropertyName == SC_UNONAME_CLOCAL )
- {
- lang::Locale aLocale;
- if ( aValue >>= aLocale )
- {
- LanguageType eLatin, eCjk, eCtl;
- rDoc.GetLanguage( eLatin, eCjk, eCtl );
- eLatin = ScUnoConversion::GetLanguage(aLocale);
- rDoc.SetLanguage( eLatin, eCjk, eCtl );
- }
- }
- else if ( aPropertyName == SC_UNO_CODENAME )
+ ScDocument& rDoc = pDocShell->GetDocument();
+ const ScDocOptions& rOldOpt = rDoc.GetDocOptions();
+ ScDocOptions aNewOpt = rOldOpt;
+ // Don't recalculate while loading XML, when the formula text is stored
+ // Recalculation after loading is handled separately.
+ bool bHardRecalc = !rDoc.IsImportingXML();
+
+ bool bOpt = ScDocOptionsHelper::setPropertyValue( aNewOpt, aPropSet.getPropertyMap(), aPropertyName, aValue );
+ if (bOpt)
+ {
+ // done...
+ if ( aPropertyName == SC_UNO_IGNORECASE ||
+ aPropertyName == SC_UNONAME_REGEXP ||
+ aPropertyName == SC_UNONAME_WILDCARDS ||
+ aPropertyName == SC_UNO_LOOKUPLABELS )
+ bHardRecalc = false;
+ }
+ else if ( aPropertyName == SC_UNONAME_CLOCAL )
+ {
+ lang::Locale aLocale;
+ if ( aValue >>= aLocale )
{
- OUString sCodeName;
- if ( aValue >>= sCodeName )
- rDoc.SetCodeName( sCodeName );
+ LanguageType eLatin, eCjk, eCtl;
+ rDoc.GetLanguage( eLatin, eCjk, eCtl );
+ eLatin = ScUnoConversion::GetLanguage(aLocale);
+ rDoc.SetLanguage( eLatin, eCjk, eCtl );
}
- else if ( aPropertyName == SC_UNO_CJK_CLOCAL )
+ }
+ else if ( aPropertyName == SC_UNO_CODENAME )
+ {
+ OUString sCodeName;
+ if ( aValue >>= sCodeName )
+ rDoc.SetCodeName( sCodeName );
+ }
+ else if ( aPropertyName == SC_UNO_CJK_CLOCAL )
+ {
+ lang::Locale aLocale;
+ if ( aValue >>= aLocale )
{
- lang::Locale aLocale;
- if ( aValue >>= aLocale )
- {
- LanguageType eLatin, eCjk, eCtl;
- rDoc.GetLanguage( eLatin, eCjk, eCtl );
- eCjk = ScUnoConversion::GetLanguage(aLocale);
- rDoc.SetLanguage( eLatin, eCjk, eCtl );
- }
+ LanguageType eLatin, eCjk, eCtl;
+ rDoc.GetLanguage( eLatin, eCjk, eCtl );
+ eCjk = ScUnoConversion::GetLanguage(aLocale);
+ rDoc.SetLanguage( eLatin, eCjk, eCtl );
}
- else if ( aPropertyName == SC_UNO_CTL_CLOCAL )
+ }
+ else if ( aPropertyName == SC_UNO_CTL_CLOCAL )
+ {
+ lang::Locale aLocale;
+ if ( aValue >>= aLocale )
{
- lang::Locale aLocale;
- if ( aValue >>= aLocale )
- {
- LanguageType eLatin, eCjk, eCtl;
- rDoc.GetLanguage( eLatin, eCjk, eCtl );
- eCtl = ScUnoConversion::GetLanguage(aLocale);
- rDoc.SetLanguage( eLatin, eCjk, eCtl );
- }
+ LanguageType eLatin, eCjk, eCtl;
+ rDoc.GetLanguage( eLatin, eCjk, eCtl );
+ eCtl = ScUnoConversion::GetLanguage(aLocale);
+ rDoc.SetLanguage( eLatin, eCjk, eCtl );
}
- else if ( aPropertyName == SC_UNO_APPLYFMDES )
- {
- // model is created if not there
- ScDrawLayer* pModel = pDocShell->MakeDrawLayer();
- pModel->SetOpenInDesignMode( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ }
+ else if ( aPropertyName == SC_UNO_APPLYFMDES )
+ {
+ // model is created if not there
+ ScDrawLayer* pModel = pDocShell->MakeDrawLayer();
+ pModel->SetOpenInDesignMode( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- SfxBindings* pBindings = pDocShell->GetViewBindings();
- if (pBindings)
- pBindings->Invalidate( SID_FM_OPEN_READONLY );
- }
- else if ( aPropertyName == SC_UNO_AUTOCONTFOC )
- {
- // model is created if not there
- ScDrawLayer* pModel = pDocShell->MakeDrawLayer();
- pModel->SetAutoControlFocus( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ SfxBindings* pBindings = pDocShell->GetViewBindings();
+ if (pBindings)
+ pBindings->Invalidate( SID_FM_OPEN_READONLY );
+ }
+ else if ( aPropertyName == SC_UNO_AUTOCONTFOC )
+ {
+ // model is created if not there
+ ScDrawLayer* pModel = pDocShell->MakeDrawLayer();
+ pModel->SetAutoControlFocus( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- SfxBindings* pBindings = pDocShell->GetViewBindings();
- if (pBindings)
- pBindings->Invalidate( SID_FM_AUTOCONTROLFOCUS );
- }
- else if ( aPropertyName == SC_UNO_ISLOADED )
- {
- pDocShell->SetEmpty( !ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- }
- else if ( aPropertyName == SC_UNO_ISUNDOENABLED )
- {
- bool bUndoEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- rDoc.EnableUndo( bUndoEnabled );
- pDocShell->GetUndoManager()->SetMaxUndoActionCount(
- bUndoEnabled
- ? officecfg::Office::Common::Undo::Steps::get() : 0);
- }
- else if ( aPropertyName == SC_UNO_RECORDCHANGES )
- {
- bool bRecordChangesEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ SfxBindings* pBindings = pDocShell->GetViewBindings();
+ if (pBindings)
+ pBindings->Invalidate( SID_FM_AUTOCONTROLFOCUS );
+ }
+ else if ( aPropertyName == SC_UNO_ISLOADED )
+ {
+ pDocShell->SetEmpty( !ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ }
+ else if ( aPropertyName == SC_UNO_ISUNDOENABLED )
+ {
+ bool bUndoEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ rDoc.EnableUndo( bUndoEnabled );
+ pDocShell->GetUndoManager()->SetMaxUndoActionCount(
+ bUndoEnabled
+ ? officecfg::Office::Common::Undo::Steps::get() : 0);
+ }
+ else if ( aPropertyName == SC_UNO_RECORDCHANGES )
+ {
+ bool bRecordChangesEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- bool bChangeAllowed = true;
- if (!bRecordChangesEnabled)
- bChangeAllowed = !pDocShell->HasChangeRecordProtection();
+ bool bChangeAllowed = true;
+ if (!bRecordChangesEnabled)
+ bChangeAllowed = !pDocShell->HasChangeRecordProtection();
- if (bChangeAllowed)
- pDocShell->SetChangeRecording(bRecordChangesEnabled);
- }
- else if ( aPropertyName == SC_UNO_ISADJUSTHEIGHTENABLED )
- {
- if( ScUnoHelpFunctions::GetBoolFromAny( aValue ) )
- rDoc.UnlockAdjustHeight();
- else
- rDoc.LockAdjustHeight();
- }
- else if ( aPropertyName == SC_UNO_ISEXECUTELINKENABLED )
- {
- rDoc.EnableExecuteLink( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- }
- else if ( aPropertyName == SC_UNO_ISCHANGEREADONLYENABLED )
- {
- rDoc.EnableChangeReadOnly( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- }
- else if ( aPropertyName == "BuildId" )
- {
- aValue >>= maBuildId;
- }
- else if ( aPropertyName == "SavedObject" ) // set from chart after saving
- {
- OUString aObjName;
- aValue >>= aObjName;
- if ( !aObjName.isEmpty() )
- rDoc.RestoreChartListener( aObjName );
- }
- else if ( aPropertyName == SC_UNO_INTEROPGRABBAG )
- {
- setGrabBagItem(aValue);
- }
+ if (bChangeAllowed)
+ pDocShell->SetChangeRecording(bRecordChangesEnabled);
+ }
+ else if ( aPropertyName == SC_UNO_ISADJUSTHEIGHTENABLED )
+ {
+ if( ScUnoHelpFunctions::GetBoolFromAny( aValue ) )
+ rDoc.UnlockAdjustHeight();
+ else
+ rDoc.LockAdjustHeight();
+ }
+ else if ( aPropertyName == SC_UNO_ISEXECUTELINKENABLED )
+ {
+ rDoc.EnableExecuteLink( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ }
+ else if ( aPropertyName == SC_UNO_ISCHANGEREADONLYENABLED )
+ {
+ rDoc.EnableChangeReadOnly( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ }
+ else if ( aPropertyName == "BuildId" )
+ {
+ aValue >>= maBuildId;
+ }
+ else if ( aPropertyName == "SavedObject" ) // set from chart after saving
+ {
+ OUString aObjName;
+ aValue >>= aObjName;
+ if ( !aObjName.isEmpty() )
+ rDoc.RestoreChartListener( aObjName );
+ }
+ else if ( aPropertyName == SC_UNO_INTEROPGRABBAG )
+ {
+ setGrabBagItem(aValue);
+ }
- if ( aNewOpt != rOldOpt )
- {
- rDoc.SetDocOptions( aNewOpt );
- //! Recalc only for options that need it?
- if ( bHardRecalc )
- pDocShell->DoHardRecalc();
- pDocShell->SetDocumentModified();
- }
+ if ( aNewOpt != rOldOpt )
+ {
+ rDoc.SetDocOptions( aNewOpt );
+ //! Recalc only for options that need it?
+ if ( bHardRecalc )
+ pDocShell->DoHardRecalc();
+ pDocShell->SetDocumentModified();
}
}
@@ -3176,54 +3176,54 @@ void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& r
// handle sheet events
//! separate method with ScMarkData? Then change HasChangesListeners back.
- if ( rOperation == "cell-change" && pDocShell )
+ if ( !(rOperation == "cell-change" && pDocShell) )
+ return;
+
+ ScMarkData aMarkData(pDocShell->GetDocument().GetSheetLimits());
+ aMarkData.MarkFromRangeList( rRanges, false );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
+ for (const SCTAB& nTab : aMarkData)
{
- ScMarkData aMarkData(pDocShell->GetDocument().GetSheetLimits());
- aMarkData.MarkFromRangeList( rRanges, false );
- ScDocument& rDoc = pDocShell->GetDocument();
- SCTAB nTabCount = rDoc.GetTableCount();
- for (const SCTAB& nTab : aMarkData)
+ if (nTab >= nTabCount)
+ break;
+ const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab);
+ if (pEvents)
{
- if (nTab >= nTabCount)
- break;
- const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab);
- if (pEvents)
+ const OUString* pScript = pEvents->GetScript(ScSheetEventId::CHANGE);
+ if (pScript)
{
- const OUString* pScript = pEvents->GetScript(ScSheetEventId::CHANGE);
- if (pScript)
+ ScRangeList aTabRanges; // collect ranges on this sheet
+ size_t nRangeCount = rRanges.size();
+ for ( size_t nIndex = 0; nIndex < nRangeCount; ++nIndex )
{
- ScRangeList aTabRanges; // collect ranges on this sheet
- size_t nRangeCount = rRanges.size();
- for ( size_t nIndex = 0; nIndex < nRangeCount; ++nIndex )
- {
- ScRange const & rRange = rRanges[ nIndex ];
- if ( rRange.aStart.Tab() == nTab )
- aTabRanges.push_back( rRange );
- }
- size_t nTabRangeCount = aTabRanges.size();
- if ( nTabRangeCount > 0 )
+ ScRange const & rRange = rRanges[ nIndex ];
+ if ( rRange.aStart.Tab() == nTab )
+ aTabRanges.push_back( rRange );
+ }
+ size_t nTabRangeCount = aTabRanges.size();
+ if ( nTabRangeCount > 0 )
+ {
+ uno::Reference<uno::XInterface> xTarget;
+ if ( nTabRangeCount == 1 )
{
- uno::Reference<uno::XInterface> xTarget;
- if ( nTabRangeCount == 1 )
- {
- ScRange const & rRange = aTabRanges[ 0 ];
- if ( rRange.aStart == rRange.aEnd )
- xTarget.set( static_cast<cppu::OWeakObject*>( new ScCellObj( pDocShell, rRange.aStart ) ) );
- else
- xTarget.set( static_cast<cppu::OWeakObject*>( new ScCellRangeObj( pDocShell, rRange ) ) );
- }
+ ScRange const & rRange = aTabRanges[ 0 ];
+ if ( rRange.aStart == rRange.aEnd )
+ xTarget.set( static_cast<cppu::OWeakObject*>( new ScCellObj( pDocShell, rRange.aStart ) ) );
else
- xTarget.set( static_cast<cppu::OWeakObject*>( new ScCellRangesObj( pDocShell, aTabRanges ) ) );
+ xTarget.set( static_cast<cppu::OWeakObject*>( new ScCellRangeObj( pDocShell, rRange ) ) );
+ }
+ else
+ xTarget.set( static_cast<cppu::OWeakObject*>( new ScCellRangesObj( pDocShell, aTabRanges ) ) );
- uno::Sequence<uno::Any> aParams(1);
- aParams[0] <<= xTarget;
+ uno::Sequence<uno::Any> aParams(1);
+ aParams[0] <<= xTarget;
- uno::Any aRet;
- uno::Sequence<sal_Int16> aOutArgsIndex;
- uno::Sequence<uno::Any> aOutArgs;
+ uno::Any aRet;
+ uno::Sequence<sal_Int16> aOutArgsIndex;
+ uno::Sequence<uno::Any> aOutArgs;
- /*ErrCode eRet =*/ pDocShell->CallXScript( *pScript, aParams, aRet, aOutArgsIndex, aOutArgs );
- }
+ /*ErrCode eRet =*/ pDocShell->CallXScript( *pScript, aParams, aRet, aOutArgsIndex, aOutArgs );
}
}
}
@@ -3232,45 +3232,45 @@ void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& r
void ScModelObj::HandleCalculateEvents()
{
- if (pDocShell)
+ if (!pDocShell)
+ return;
+
+ ScDocument& rDoc = pDocShell->GetDocument();
+ // don't call events before the document is visible
+ // (might also set a flag on SfxEventHintId::LoadFinished and only disable while loading)
+ if ( rDoc.IsDocVisible() )
{
- ScDocument& rDoc = pDocShell->GetDocument();
- // don't call events before the document is visible
- // (might also set a flag on SfxEventHintId::LoadFinished and only disable while loading)
- if ( rDoc.IsDocVisible() )
+ SCTAB nTabCount = rDoc.GetTableCount();
+ for (SCTAB nTab = 0; nTab < nTabCount; nTab++)
{
- SCTAB nTabCount = rDoc.GetTableCount();
- for (SCTAB nTab = 0; nTab < nTabCount; nTab++)
+ if (rDoc.HasCalcNotification(nTab))
{
- if (rDoc.HasCalcNotification(nTab))
+ if (const ScSheetEvents* pEvents = rDoc.GetSheetEvents( nTab ))
{
- if (const ScSheetEvents* pEvents = rDoc.GetSheetEvents( nTab ))
+ if (const OUString* pScript = pEvents->GetScript(ScSheetEventId::CALCULATE))
{
- if (const OUString* pScript = pEvents->GetScript(ScSheetEventId::CALCULATE))
- {
- uno::Any aRet;
- uno::Sequence<uno::Any> aParams;
- uno::Sequence<sal_Int16> aOutArgsIndex;
- uno::Sequence<uno::Any> aOutArgs;
- pDocShell->CallXScript( *pScript, aParams, aRet, aOutArgsIndex, aOutArgs );
- }
+ uno::Any aRet;
+ uno::Sequence<uno::Any> aParams;
+ uno::Sequence<sal_Int16> aOutArgsIndex;
+ uno::Sequence<uno::Any> aOutArgs;
+ pDocShell->CallXScript( *pScript, aParams, aRet, aOutArgsIndex, aOutArgs );
}
+ }
- try
- {
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= nTab;
- xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( ScSheetEventId::CALCULATE ), aArgs );
- }
- catch( uno::Exception& )
- {
- }
+ try
+ {
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[ 0 ] <<= nTab;
+ xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( ScSheetEventId::CALCULATE ), aArgs );
+ }
+ catch( uno::Exception& )
+ {
}
}
}
- rDoc.ResetCalcNotifications();
}
+ rDoc.ResetCalcNotifications();
}
// XOpenCLSelection
@@ -4675,25 +4675,25 @@ void SAL_CALL ScScenariosObj::addNewByName( const OUString& aName,
const OUString& aComment )
{
SolarMutexGuard aGuard;
- if ( pDocShell )
- {
- ScMarkData aMarkData(pDocShell->GetDocument().GetSheetLimits());
- aMarkData.SelectTable( nTab, true );
-
- for (const table::CellRangeAddress& rRange : aRanges)
- {
- OSL_ENSURE( rRange.Sheet == nTab, "addScenario with a wrong Tab" );
- ScRange aRange( static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), nTab,
- static_cast<SCCOL>(rRange.EndColumn), static_cast<SCROW>(rRange.EndRow), nTab );
+ if ( !pDocShell )
+ return;
- aMarkData.SetMultiMarkArea( aRange );
- }
+ ScMarkData aMarkData(pDocShell->GetDocument().GetSheetLimits());
+ aMarkData.SelectTable( nTab, true );
- ScScenarioFlags const nFlags = ScScenarioFlags::ShowFrame | ScScenarioFlags::PrintFrame
- | ScScenarioFlags::TwoWay | ScScenarioFlags::Protected;
+ for (const table::CellRangeAddress& rRange : aRanges)
+ {
+ OSL_ENSURE( rRange.Sheet == nTab, "addScenario with a wrong Tab" );
+ ScRange aRange( static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), nTab,
+ static_cast<SCCOL>(rRange.EndColumn), static_cast<SCROW>(rRange.EndRow), nTab );
- pDocShell->MakeScenario( nTab, aName, aComment, COL_LIGHTGRAY, nFlags, aMarkData );
+ aMarkData.SetMultiMarkArea( aRange );
}
+
+ ScScenarioFlags const nFlags = ScScenarioFlags::ShowFrame | ScScenarioFlags::PrintFrame
+ | ScScenarioFlags::TwoWay | ScScenarioFlags::Protected;
+
+ pDocShell->MakeScenario( nTab, aName, aComment, COL_LIGHTGRAY, nFlags, aMarkData );
}
void SAL_CALL ScScenariosObj::removeByName( const OUString& aName )
diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx
index 4c0969130b95..a54ff4f0e6ee 100644
--- a/sc/source/ui/unoobj/editsrc.cxx
+++ b/sc/source/ui/unoobj/editsrc.cxx
@@ -162,26 +162,26 @@ SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder()
void ScAnnotationEditSource::UpdateData()
{
- if ( pDocShell && pEditEngine )
- {
- ScDocShellModificator aModificator( *pDocShell );
+ if ( !(pDocShell && pEditEngine) )
+ return;
- if( SdrObject* pObj = GetCaptionObj() )
- {
- std::unique_ptr<EditTextObject> pEditObj = pEditEngine->CreateTextObject();
- std::unique_ptr<OutlinerParaObject> pOPO( new OutlinerParaObject( *pEditObj ) );
- pEditObj.reset();
- pOPO->SetOutlinerMode( OutlinerMode::TextObject );
- pObj->NbcSetOutlinerParaObject( std::move(pOPO) );
- pObj->ActionChanged();
- }
+ ScDocShellModificator aModificator( *pDocShell );
- //! Undo !!!
+ if( SdrObject* pObj = GetCaptionObj() )
+ {
+ std::unique_ptr<EditTextObject> pEditObj = pEditEngine->CreateTextObject();
+ std::unique_ptr<OutlinerParaObject> pOPO( new OutlinerParaObject( *pEditObj ) );
+ pEditObj.reset();
+ pOPO->SetOutlinerMode( OutlinerMode::TextObject );
+ pObj->NbcSetOutlinerParaObject( std::move(pOPO) );
+ pObj->ActionChanged();
+ }
- aModificator.SetDocumentModified();
+ //! Undo !!!
- // SetDocumentModified will reset bDataValid
- }
+ aModificator.SetDocumentModified();
+
+ // SetDocumentModified will reset bDataValid
}
void ScAnnotationEditSource::Notify( SfxBroadcaster&, const SfxHint& rHint )
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 5cf63e574936..8a3e65fe996b 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -740,30 +740,30 @@ void ScEditFieldObj::setPropertyValueFile(const OUString& rName, const uno::Any&
throw beans::UnknownPropertyException(rName);
sal_Int16 nIntVal = 0;
- if (rVal >>= nIntVal)
+ if (!(rVal >>= nIntVal))
+ return;
+
+ SvxFileFormat eFormat = lcl_UnoToSvxFileFormat(nIntVal);
+ if (mpEditSource)
{
- SvxFileFormat eFormat = lcl_UnoToSvxFileFormat(nIntVal);
- if (mpEditSource)
- {
- ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
- ScUnoEditEngine aTempEngine(pEditEngine);
- SvxFieldData* pField = aTempEngine.FindByPos(
- aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::EXTENDED_FILE);
- OSL_ENSURE(pField, "setPropertyValueFile: Field not found");
- if (pField)
- {
- SvxExtFileField* pExtFile = static_cast<SvxExtFileField*>(pField); // local to the ScUnoEditEngine
- pExtFile->SetFormat(eFormat);
- pEditEngine->QuickInsertField(SvxFieldItem(*pField, EE_FEATURE_FIELD), aSelection);
- mpEditSource->UpdateData();
- }
- }
- else
+ ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
+ ScUnoEditEngine aTempEngine(pEditEngine);
+ SvxFieldData* pField = aTempEngine.FindByPos(
+ aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::EXTENDED_FILE);
+ OSL_ENSURE(pField, "setPropertyValueFile: Field not found");
+ if (pField)
{
- SvxExtFileField& rExtFile = static_cast<SvxExtFileField&>(getData());
- rExtFile.SetFormat(eFormat);
+ SvxExtFileField* pExtFile = static_cast<SvxExtFileField*>(pField); // local to the ScUnoEditEngine
+ pExtFile->SetFormat(eFormat);
+ pEditEngine->QuickInsertField(SvxFieldItem(*pField, EE_FEATURE_FIELD), aSelection);
+ mpEditSource->UpdateData();
}
}
+ else
+ {
+ SvxExtFileField& rExtFile = static_cast<SvxExtFileField&>(getData());
+ rExtFile.SetFormat(eFormat);
+ }
}
diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx
index 040de3b19e99..11d17cc9f021 100644
--- a/sc/source/ui/unoobj/fmtuno.cxx
+++ b/sc/source/ui/unoobj/fmtuno.cxx
@@ -144,39 +144,39 @@ ScTableConditionalFormat::ScTableConditionalFormat(
{
// read the entry from the document...
- if ( pDoc && nKey )
+ if ( !(pDoc && nKey) )
+ return;
+
+ ScConditionalFormatList* pList = pDoc->GetCondFormList(nTab);
+ if (!pList)
+ return;
+
+ const ScConditionalFormat* pFormat = pList->GetFormat( nKey );
+ if (!pFormat)
+ return;
+
+ // During save to XML.
+ if (pDoc->IsInExternalReferenceMarking())
+ pFormat->MarkUsedExternalReferences();
+
+ size_t nEntryCount = pFormat->size();
+ for (size_t i=0; i<nEntryCount; i++)
{
- ScConditionalFormatList* pList = pDoc->GetCondFormList(nTab);
- if (pList)
- {
- const ScConditionalFormat* pFormat = pList->GetFormat( nKey );
- if (pFormat)
- {
- // During save to XML.
- if (pDoc->IsInExternalReferenceMarking())
- pFormat->MarkUsedExternalReferences();
-
- size_t nEntryCount = pFormat->size();
- for (size_t i=0; i<nEntryCount; i++)
- {
- ScCondFormatEntryItem aItem;
- const ScFormatEntry* pFrmtEntry = pFormat->GetEntry(i);
- if(pFrmtEntry->GetType() != ScFormatEntry::Type::Condition &&
- pFrmtEntry->GetType() != ScFormatEntry::Type::ExtCondition)
- continue;
-
- const ScCondFormatEntry* pFormatEntry = static_cast<const ScCondFormatEntry*>(pFrmtEntry);
- aItem.meMode = pFormatEntry->GetOperation();
- aItem.maPos = pFormatEntry->GetValidSrcPos();
- aItem.maExpr1 = pFormatEntry->GetExpression(aItem.maPos, 0, 0, eGrammar);
- aItem.maExpr2 = pFormatEntry->GetExpression(aItem.maPos, 1, 0, eGrammar);
- aItem.meGrammar1 = aItem.meGrammar2 = eGrammar;
- aItem.maStyle = pFormatEntry->GetStyle();
-
- AddEntry_Impl(aItem);
- }
- }
- }
+ ScCondFormatEntryItem aItem;
+ const ScFormatEntry* pFrmtEntry = pFormat->GetEntry(i);
+ if(pFrmtEntry->GetType() != ScFormatEntry::Type::Condition &&
+ pFrmtEntry->GetType() != ScFormatEntry::Type::ExtCondition)
+ continue;
+
+ const ScCondFormatEntry* pFormatEntry = static_cast<const ScCondFormatEntry*>(pFrmtEntry);
+ aItem.meMode = pFormatEntry->GetOperation();
+ aItem.maPos = pFormatEntry->GetValidSrcPos();
+ aItem.maExpr1 = pFormatEntry->GetExpression(aItem.maPos, 0, 0, eGrammar);
+ aItem.maExpr2 = pFormatEntry->GetExpression(aItem.maPos, 1, 0, eGrammar);
+ aItem.meGrammar1 = aItem.meGrammar2 = eGrammar;
+ aItem.maStyle = pFormatEntry->GetStyle();
+
+ AddEntry_Impl(aItem);
}
}
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index b9d556c783a9..adc8b8a89ae5 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -269,36 +269,36 @@ void ScSheetLinkObj::setFileName(const OUString& rNewName)
{
SolarMutexGuard aGuard;
ScTableLink* pLink = GetLink_Impl();
- if (pLink)
- {
- // pLink->Refresh with a new file name confuses sfx2::LinkManager
- // therefore we transplant the sheets manually and create new links with UpdateLinks
+ if (!pLink)
+ return;
- OUString aNewStr(ScGlobal::GetAbsDocName( rNewName, pDocShell ));
+ // pLink->Refresh with a new file name confuses sfx2::LinkManager
+ // therefore we transplant the sheets manually and create new links with UpdateLinks
- // first transplant the sheets
+ OUString aNewStr(ScGlobal::GetAbsDocName( rNewName, pDocShell ));
- ScDocument& rDoc = pDocShell->GetDocument();
- SCTAB nTabCount = rDoc.GetTableCount();
- for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- if ( rDoc.IsLinked(nTab) && rDoc.GetLinkDoc(nTab) == aFileName ) // old file
- rDoc.SetLink( nTab, rDoc.GetLinkMode(nTab), aNewStr,
- rDoc.GetLinkFlt(nTab), rDoc.GetLinkOpt(nTab),
- rDoc.GetLinkTab(nTab),
- rDoc.GetLinkRefreshDelay(nTab) ); // only change the file
+ // first transplant the sheets
- // update links
- //! Undo !!!
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+ if ( rDoc.IsLinked(nTab) && rDoc.GetLinkDoc(nTab) == aFileName ) // old file
+ rDoc.SetLink( nTab, rDoc.GetLinkMode(nTab), aNewStr,
+ rDoc.GetLinkFlt(nTab), rDoc.GetLinkOpt(nTab),
+ rDoc.GetLinkTab(nTab),
+ rDoc.GetLinkRefreshDelay(nTab) ); // only change the file
- pDocShell->UpdateLinks(); // remove old links, possibly set up new ones
+ // update links
+ //! Undo !!!
- // copy data
+ pDocShell->UpdateLinks(); // remove old links, possibly set up new ones
- aFileName = aNewStr;
- pLink = GetLink_Impl(); // new link with new name
- if (pLink)
- pLink->Update(); // incl. paint & undo for data
- }
+ // copy data
+
+ aFileName = aNewStr;
+ pLink = GetLink_Impl(); // new link with new name
+ if (pLink)
+ pLink->Update(); // incl. paint & undo for data
}
OUString ScSheetLinkObj::getFilter() const
@@ -617,41 +617,41 @@ void ScAreaLinkObj::Modify_Impl( const OUString* pNewFile, const OUString* pNewF
const table::CellRangeAddress* pNewDest )
{
ScAreaLink* pLink = lcl_GetAreaLink(pDocShell, nPos);
- if (pLink)
- {
- OUString aFile (pLink->GetFile());
- OUString aFilter (pLink->GetFilter());
- OUString aOptions (pLink->GetOptions());
- OUString aSource (pLink->GetSource());
- ScRange aDest (pLink->GetDestArea());
- sal_uLong nRefresh = pLink->GetRefreshDelay();
+ if (!pLink)
+ return;
- //! Undo delete
- //! Undo merge
+ OUString aFile (pLink->GetFile());
+ OUString aFilter (pLink->GetFilter());
+ OUString aOptions (pLink->GetOptions());
+ OUString aSource (pLink->GetSource());
+ ScRange aDest (pLink->GetDestArea());
+ sal_uLong nRefresh = pLink->GetRefreshDelay();
- sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager();
- pLinkManager->Remove( pLink );
- pLink = nullptr; // deleted along with remove
+ //! Undo delete
+ //! Undo merge
- bool bFitBlock = true; // move, if the size changes with update
- if (pNewFile)
- {
- aFile = ScGlobal::GetAbsDocName( *pNewFile, pDocShell ); //! in InsertAreaLink?
- }
- if (pNewFilter)
- aFilter = *pNewFilter;
- if (pNewOptions)
- aOptions = *pNewOptions;
- if (pNewSource)
- aSource = *pNewSource;
- if (pNewDest)
- {
- ScUnoConversion::FillScRange( aDest, *pNewDest );
- bFitBlock = false; // new range was specified -> do not move the content
- }
- pDocShell->GetDocFunc().InsertAreaLink( aFile, aFilter, aOptions, aSource,
- aDest, nRefresh, bFitBlock, true );
+ sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager();
+ pLinkManager->Remove( pLink );
+ pLink = nullptr; // deleted along with remove
+
+ bool bFitBlock = true; // move, if the size changes with update
+ if (pNewFile)
+ {
+ aFile = ScGlobal::GetAbsDocName( *pNewFile, pDocShell ); //! in InsertAreaLink?
+ }
+ if (pNewFilter)
+ aFilter = *pNewFilter;
+ if (pNewOptions)
+ aOptions = *pNewOptions;
+ if (pNewSource)
+ aSource = *pNewSource;
+ if (pNewDest)
+ {
+ ScUnoConversion::FillScRange( aDest, *pNewDest );
+ bFitBlock = false; // new range was specified -> do not move the content
}
+ pDocShell->GetDocFunc().InsertAreaLink( aFile, aFilter, aOptions, aSource,
+ aDest, nRefresh, bFitBlock, true );
}
void ScAreaLinkObj::ModifyRefreshDelay_Impl( sal_Int32 nRefresh )
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index de209a3e745d..82ba1d88ffff 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -745,20 +745,20 @@ void ScNamedRangesObj::removeActionLock()
void ScNamedRangesObj::setActionLocks( sal_Int16 nLock )
{
SolarMutexGuard aGuard;
- if ( nLock >= 0 )
+ if ( nLock < 0 )
+ return;
+
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
+ if ( nLock == 0 && nLockCount > 0 )
{
- ScDocument& rDoc = pDocShell->GetDocument();
- sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount();
- if ( nLock == 0 && nLockCount > 0 )
- {
- unlock();
- }
- if ( nLock > 0 && nLockCount == 0 )
- {
- lock();
- }
- rDoc.SetNamedRangesLockCount( nLock );
+ unlock();
}
+ if ( nLock > 0 && nLockCount == 0 )
+ {
+ lock();
+ }
+ rDoc.SetNamedRangesLockCount( nLock );
}
sal_Int16 ScNamedRangesObj::resetActionLocks()
@@ -926,39 +926,39 @@ ScRangePair* ScLabelRangeObj::GetData_Impl()
void ScLabelRangeObj::Modify_Impl( const ScRange* pLabel, const ScRange* pData )
{
- if (pDocShell)
- {
- ScDocument& rDoc = pDocShell->GetDocument();
- ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
- if (pOldList)
- {
- ScRangePairListRef xNewList(pOldList->Clone());
- ScRangePair* pEntry = xNewList->Find( aRange );
- if (pEntry)
- {
- if ( pLabel )
- pEntry->GetRange(0) = *pLabel;
- if ( pData )
- pEntry->GetRange(1) = *pData;
+ if (!pDocShell)
+ return;
- xNewList->Join( *pEntry, true );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
+ if (!pOldList)
+ return;
- if (bColumn)
- rDoc.GetColNameRangesRef() = xNewList;
- else
- rDoc.GetRowNameRangesRef() = xNewList;
+ ScRangePairListRef xNewList(pOldList->Clone());
+ ScRangePair* pEntry = xNewList->Find( aRange );
+ if (!pEntry)
+ return;
- rDoc.CompileColRowNameFormula();
- pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
- pDocShell->SetDocumentModified();
+ if ( pLabel )
+ pEntry->GetRange(0) = *pLabel;
+ if ( pData )
+ pEntry->GetRange(1) = *pData;
- //! Undo ?!?! (here and from dialog)
+ xNewList->Join( *pEntry, true );
- if ( pLabel )
- aRange = *pLabel; // adapt object to find range again
- }
- }
- }
+ if (bColumn)
+ rDoc.GetColNameRangesRef() = xNewList;
+ else
+ rDoc.GetRowNameRangesRef() = xNewList;
+
+ rDoc.CompileColRowNameFormula();
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
+ pDocShell->SetDocumentModified();
+
+ //! Undo ?!?! (here and from dialog)
+
+ if ( pLabel )
+ aRange = *pLabel; // adapt object to find range again
}
// sheet::XLabelRange
@@ -1045,32 +1045,32 @@ void SAL_CALL ScLabelRangesObj::addNew( const table::CellRangeAddress& aLabelAre
const table::CellRangeAddress& aDataArea )
{
SolarMutexGuard aGuard;
- if (pDocShell)
- {
- ScDocument& rDoc = pDocShell->GetDocument();
- ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
- if (pOldList)
- {
- ScRangePairListRef xNewList(pOldList->Clone());
+ if (!pDocShell)
+ return;
- ScRange aLabelRange;
- ScRange aDataRange;
- ScUnoConversion::FillScRange( aLabelRange, aLabelArea );
- ScUnoConversion::FillScRange( aDataRange, aDataArea );
- xNewList->Join( ScRangePair( aLabelRange, aDataRange ) );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
+ if (!pOldList)
+ return;
- if (bColumn)
- rDoc.GetColNameRangesRef() = xNewList;
- else
- rDoc.GetRowNameRangesRef() = xNewList;
+ ScRangePairListRef xNewList(pOldList->Clone());
- rDoc.CompileColRowNameFormula();
- pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
- pDocShell->SetDocumentModified();
+ ScRange aLabelRange;
+ ScRange aDataRange;
+ ScUnoConversion::FillScRange( aLabelRange, aLabelArea );
+ ScUnoConversion::FillScRange( aDataRange, aDataArea );
+ xNewList->Join( ScRangePair( aLabelRange, aDataRange ) );
- //! Undo ?!?! (here and from dialog)
- }
- }
+ if (bColumn)
+ rDoc.GetColNameRangesRef() = xNewList;
+ else
+ rDoc.GetRowNameRangesRef() = xNewList;
+
+ rDoc.CompileColRowNameFormula();
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid );
+ pDocShell->SetDocumentModified();
+
+ //! Undo ?!?! (here and from dialog)
}
void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex )
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 2a8f17da4d95..b08c73fb6e68 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -586,29 +586,29 @@ void ScStyleFamiliesObj::loadStylesFromDocShell( ScDocShell* pSource,
const uno::Sequence<beans::PropertyValue>& aOptions )
{
- if ( pSource && pDocShell )
- {
- // collect options
+ if ( !(pSource && pDocShell) )
+ return;
- bool bLoadReplace = true; // defaults
- bool bLoadCellStyles = true;
- bool bLoadPageStyles = true;
+ // collect options
- for (const beans::PropertyValue& rProp : aOptions)
- {
- OUString aPropName(rProp.Name);
-
- if (aPropName == SC_UNONAME_OVERWSTL)
- bLoadReplace = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
- else if (aPropName == SC_UNONAME_LOADCELL)
- bLoadCellStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
- else if (aPropName == SC_UNONAME_LOADPAGE)
- bLoadPageStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
- }
+ bool bLoadReplace = true; // defaults
+ bool bLoadCellStyles = true;
+ bool bLoadPageStyles = true;
- pDocShell->LoadStylesArgs( *pSource, bLoadReplace, bLoadCellStyles, bLoadPageStyles );
- pDocShell->SetDocumentModified(); // paint is inside LoadStyles
+ for (const beans::PropertyValue& rProp : aOptions)
+ {
+ OUString aPropName(rProp.Name);
+
+ if (aPropName == SC_UNONAME_OVERWSTL)
+ bLoadReplace = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
+ else if (aPropName == SC_UNONAME_LOADCELL)
+ bLoadCellStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
+ else if (aPropName == SC_UNONAME_LOADPAGE)
+ bLoadPageStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
}
+
+ pDocShell->LoadStylesArgs( *pSource, bLoadReplace, bLoadCellStyles, bLoadPageStyles );
+ pDocShell->SetDocumentModified(); // paint is inside LoadStyles
}
ScStyleFamilyObj::ScStyleFamilyObj(ScDocShell* pDocSh, SfxStyleFamily eFam) :
@@ -1026,47 +1026,47 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle )
{
SolarMutexGuard aGuard;
SfxStyleSheetBase* pStyle = GetStyle_Impl();
- if (pStyle)
- {
- // cell styles cannot be modified if any sheet is protected
- if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
- return; //! exception?
+ if (!pStyle)
+ return;
- //! DocFunc function??
- //! Undo ?????????????
+ // cell styles cannot be modified if any sheet is protected
+ if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
+ return; //! exception?
- OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( rParentStyle, eFamily ));
- bool bOk = pStyle->SetParent( aString );
- if (bOk)
- {
- // as by setPropertyValue
+ //! DocFunc function??
+ //! Undo ?????????????
- ScDocument& rDoc = pDocShell->GetDocument();
- if ( eFamily == SfxStyleFamily::Para )
- {
- // update line height
+ OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( rParentStyle, eFamily ));
+ bool bOk = pStyle->SetParent( aString );
+ if (!bOk)
+ return;
- ScopedVclPtrInstance< VirtualDevice > pVDev;
- Point aLogic = pVDev->LogicToPixel( Point(1000,1000), MapMode(MapUnit::MapTwip));
- double nPPTX = aLogic.X() / 1000.0;
- double nPPTY = aLogic.Y() / 1000.0;
- Fraction aZoom(1,1);
- rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
+ // as by setPropertyValue
- if (!rDoc.IsImportingXML())
- {
- pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
- pDocShell->SetDocumentModified();
- }
- }
- else
- {
- //! ModifyStyleSheet on document (save old values)
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if ( eFamily == SfxStyleFamily::Para )
+ {
+ // update line height
- pDocShell->PageStyleModified( aStyleName, true );
- }
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ Point aLogic = pVDev->LogicToPixel( Point(1000,1000), MapMode(MapUnit::MapTwip));
+ double nPPTX = aLogic.X() / 1000.0;
+ double nPPTY = aLogic.Y() / 1000.0;
+ Fraction aZoom(1,1);
+ rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
+
+ if (!rDoc.IsImportingXML())
+ {
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
+ pDocShell->SetDocumentModified();
}
}
+ else
+ {
+ //! ModifyStyleSheet on document (save old values)
+
+ pDocShell->PageStyleModified( aStyleName, true );
+ }
}
// container::XNamed
@@ -1084,34 +1084,34 @@ void SAL_CALL ScStyleObj::setName( const OUString& aNewName )
{
SolarMutexGuard aGuard;
SfxStyleSheetBase* pStyle = GetStyle_Impl();
- if (pStyle)
- {
- // cell styles cannot be renamed if any sheet is protected
- if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
- return; //! exception?
+ if (!pStyle)
+ return;
- //! DocFunc function??
- //! Undo ?????????????
+ // cell styles cannot be renamed if any sheet is protected
+ if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
+ return; //! exception?
- bool bOk = pStyle->SetName( aNewName );
- if (bOk)
- {
- aStyleName = aNewName; //! notify other objects for this style?
+ //! DocFunc function??
+ //! Undo ?????????????
- ScDocument& rDoc = pDocShell->GetDocument();
- if ( eFamily == SfxStyleFamily::Para && !rDoc.IsImportingXML() )
- rDoc.GetPool()->CellStyleCreated( aNewName, &rDoc );
+ bool bOk = pStyle->SetName( aNewName );
+ if (!bOk)
+ return;
- // cell styles = 2, page styles = 4
- sal_uInt16 nId = ( eFamily == SfxStyleFamily::Para ) ?
- SID_STYLE_FAMILY2 : SID_STYLE_FAMILY4;
- SfxBindings* pBindings = pDocShell->GetViewBindings();
- if (pBindings)
- {
- pBindings->Invalidate( nId );
- pBindings->Invalidate( SID_STYLE_APPLY );
- }
- }
+ aStyleName = aNewName; //! notify other objects for this style?
+
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if ( eFamily == SfxStyleFamily::Para && !rDoc.IsImportingXML() )
+ rDoc.GetPool()->CellStyleCreated( aNewName, &rDoc );
+
+ // cell styles = 2, page styles = 4
+ sal_uInt16 nId = ( eFamily == SfxStyleFamily::Para ) ?
+ SID_STYLE_FAMILY2 : SID_STYLE_FAMILY4;
+ SfxBindings* pBindings = pDocShell->GetViewBindings();
+ if (pBindings)
+ {
+ pBindings->Invalidate( nId );
+ pBindings->Invalidate( SID_STYLE_APPLY );
}
}
@@ -1386,48 +1386,48 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault()
SolarMutexGuard aGuard;
SfxStyleSheetBase* pStyle = GetStyle_Impl();
- if ( pStyle )
- {
- // cell styles cannot be modified if any sheet is protected
- if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
- throw uno::RuntimeException();
+ if ( !pStyle )
+ return;
- SfxItemSet& rSet = pStyle->GetItemSet();
- rSet.ClearItem(); // set all items to default
+ // cell styles cannot be modified if any sheet is protected
+ if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
+ throw uno::RuntimeException();
- //! merge with SetOneProperty
+ SfxItemSet& rSet = pStyle->GetItemSet();
+ rSet.ClearItem(); // set all items to default
- ScDocument& rDoc = pDocShell->GetDocument();
- if ( eFamily == SfxStyleFamily::Para )
- {
- // row heights
+ //! merge with SetOneProperty
- ScopedVclPtrInstance< VirtualDevice > pVDev;
- Point aLogic = pVDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip));
- double nPPTX = aLogic.X() / 1000.0;
- double nPPTY = aLogic.Y() / 1000.0;
- Fraction aZoom(1,1);
- rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if ( eFamily == SfxStyleFamily::Para )
+ {
+ // row heights
- if (!rDoc.IsImportingXML())
- {
- pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
- pDocShell->SetDocumentModified();
- }
- }
- else
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ Point aLogic = pVDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip));
+ double nPPTX = aLogic.X() / 1000.0;
+ double nPPTY = aLogic.Y() / 1000.0;
+ Fraction aZoom(1,1);
+ rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
+
+ if (!rDoc.IsImportingXML())
{
- // #i22448# apply the default BoxInfoItem for page styles again
- // (same content as in ScStyleSheet::GetItemSet, to control the dialog)
- SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER );
- aBoxInfoItem.SetTable( false );
- aBoxInfoItem.SetDist( true );
- aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::DISTANCE );
- rSet.Put( aBoxInfoItem );
-
- pDocShell->PageStyleModified( aStyleName, true );
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
+ pDocShell->SetDocumentModified();
}
}
+ else
+ {
+ // #i22448# apply the default BoxInfoItem for page styles again
+ // (same content as in ScStyleSheet::GetItemSet, to control the dialog)
+ SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER );
+ aBoxInfoItem.SetTable( false );
+ aBoxInfoItem.SetDist( true );
+ aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::DISTANCE );
+ rSet.Put( aBoxInfoItem );
+
+ pDocShell->PageStyleModified( aStyleName, true );
+ }
}
void SAL_CALL ScStyleObj::setPropertiesToDefault( const uno::Sequence<OUString>& aPropertyNames )
@@ -1466,308 +1466,308 @@ void SAL_CALL ScStyleObj::setPropertyValue( const OUString& aPropertyName, const
void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const SfxItemPropertySimpleEntry* pEntry, const uno::Any* pValue )
{
SfxStyleSheetBase* pStyle = GetStyle_Impl( true );
- if ( pStyle && pEntry )
- {
- // cell styles cannot be modified if any sheet is protected
- if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
- throw uno::RuntimeException();
+ if ( !(pStyle && pEntry) )
+ return;
- SfxItemSet& rSet = pStyle->GetItemSet(); // change directly in active Style
- bool bDone = false;
- if ( eFamily == SfxStyleFamily::Page )
+ // cell styles cannot be modified if any sheet is protected
+ if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
+ throw uno::RuntimeException();
+
+ SfxItemSet& rSet = pStyle->GetItemSet(); // change directly in active Style
+ bool bDone = false;
+ if ( eFamily == SfxStyleFamily::Page )
+ {
+ if(pEntry->nWID == SC_WID_UNO_HEADERSET)
{
- if(pEntry->nWID == SC_WID_UNO_HEADERSET)
+ const SfxItemPropertySimpleEntry* pHeaderEntry = lcl_GetHeaderStyleMap()->getByName( rPropertyName );
+ if ( pHeaderEntry ) // only item-WIDs in header/footer map
{
- const SfxItemPropertySimpleEntry* pHeaderEntry = lcl_GetHeaderStyleMap()->getByName( rPropertyName );
- if ( pHeaderEntry ) // only item-WIDs in header/footer map
- {
- SvxSetItem aNewHeader( rSet.Get(ATTR_PAGE_HEADERSET) );
- if (pValue)
- pPropSet->setPropertyValue( *pHeaderEntry, *pValue, aNewHeader.GetItemSet() );
- else
- aNewHeader.GetItemSet().ClearItem( pHeaderEntry->nWID );
- rSet.Put( aNewHeader );
- bDone = true;
- }
+ SvxSetItem aNewHeader( rSet.Get(ATTR_PAGE_HEADERSET) );
+ if (pValue)
+ pPropSet->setPropertyValue( *pHeaderEntry, *pValue, aNewHeader.GetItemSet() );
+ else
+ aNewHeader.GetItemSet().ClearItem( pHeaderEntry->nWID );
+ rSet.Put( aNewHeader );
+ bDone = true;
}
- else if(pEntry->nWID == SC_WID_UNO_FOOTERSET)
+ }
+ else if(pEntry->nWID == SC_WID_UNO_FOOTERSET)
+ {
+ const SfxItemPropertySimpleEntry* pFooterEntry = lcl_GetFooterStyleMap()->getByName( rPropertyName );
+ if ( pFooterEntry ) // only item-WIDs in header/footer map
{
- const SfxItemPropertySimpleEntry* pFooterEntry = lcl_GetFooterStyleMap()->getByName( rPropertyName );
- if ( pFooterEntry ) // only item-WIDs in header/footer map
- {
- SvxSetItem aNewFooter( rSet.Get(ATTR_PAGE_FOOTERSET) );
- if (pValue)
- pPropSet->setPropertyValue( *pFooterEntry, *pValue, aNewFooter.GetItemSet() );
- else
- aNewFooter.GetItemSet().ClearItem( pFooterEntry->nWID );
- rSet.Put( aNewFooter );
- bDone = true;
- }
+ SvxSetItem aNewFooter( rSet.Get(ATTR_PAGE_FOOTERSET) );
+ if (pValue)
+ pPropSet->setPropertyValue( *pFooterEntry, *pValue, aNewFooter.GetItemSet() );
+ else
+ aNewFooter.GetItemSet().ClearItem( pFooterEntry->nWID );
+ rSet.Put( aNewFooter );
+ bDone = true;
}
}
- if (!bDone)
+ }
+ if (!bDone)
+ {
+ if (IsScItemWid(pEntry->nWID))
{
- if (IsScItemWid(pEntry->nWID))
+ if (pValue)
{
- if (pValue)
+ switch (pEntry->nWID) // special item handling
{
- switch (pEntry->nWID) // special item handling
- {
- case ATTR_VALUE_FORMAT:
- {
- // language for number formats
- SvNumberFormatter* pFormatter
- = pDocShell->GetDocument().GetFormatTable();
- sal_uInt32 nOldFormat = rSet.Get(ATTR_VALUE_FORMAT).GetValue();
- LanguageType eOldLang
- = rSet.Get(ATTR_LANGUAGE_FORMAT).GetLanguage();
- pFormatter->GetFormatForLanguageIfBuiltIn(nOldFormat, eOldLang);
-
- sal_uInt32 nNewFormat = 0;
- *pValue >>= nNewFormat;
- rSet.Put(SfxUInt32Item(ATTR_VALUE_FORMAT, nNewFormat));
-
- const SvNumberformat* pNewEntry = pFormatter->GetEntry(nNewFormat);
- LanguageType eNewLang
- = pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
- if (eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW)
- rSet.Put(SvxLanguageItem(eNewLang, ATTR_LANGUAGE_FORMAT));
-
- //! keep default state of number format if only language changed?
- }
- break;
- case ATTR_INDENT:
- {
- sal_Int16 nVal = 0;
- *pValue >>= nVal;
- rSet.Put(ScIndentItem(static_cast<sal_uInt16>(HMMToTwips(nVal))));
- }
- break;
- case ATTR_ROTATE_VALUE:
+ case ATTR_VALUE_FORMAT:
+ {
+ // language for number formats
+ SvNumberFormatter* pFormatter
+ = pDocShell->GetDocument().GetFormatTable();
+ sal_uInt32 nOldFormat = rSet.Get(ATTR_VALUE_FORMAT).GetValue();
+ LanguageType eOldLang
+ = rSet.Get(ATTR_LANGUAGE_FORMAT).GetLanguage();
+ pFormatter->GetFormatForLanguageIfBuiltIn(nOldFormat, eOldLang);
+
+ sal_uInt32 nNewFormat = 0;
+ *pValue >>= nNewFormat;
+ rSet.Put(SfxUInt32Item(ATTR_VALUE_FORMAT, nNewFormat));
+
+ const SvNumberformat* pNewEntry = pFormatter->GetEntry(nNewFormat);
+ LanguageType eNewLang
+ = pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
+ if (eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW)
+ rSet.Put(SvxLanguageItem(eNewLang, ATTR_LANGUAGE_FORMAT));
+
+ //! keep default state of number format if only language changed?
+ }
+ break;
+ case ATTR_INDENT:
+ {
+ sal_Int16 nVal = 0;
+ *pValue >>= nVal;
+ rSet.Put(ScIndentItem(static_cast<sal_uInt16>(HMMToTwips(nVal))));
+ }
+ break;
+ case ATTR_ROTATE_VALUE:
+ {
+ sal_Int32 nRotVal = 0;
+ if (*pValue >>= nRotVal)
{
- sal_Int32 nRotVal = 0;
- if (*pValue >>= nRotVal)
- {
- // stored value is always between 0 and 360 deg.
- nRotVal %= 36000;
- if (nRotVal < 0)
- nRotVal += 36000;
- rSet.Put(ScRotateValueItem(nRotVal));
- }
+ // stored value is always between 0 and 360 deg.
+ nRotVal %= 36000;
+ if (nRotVal < 0)
+ nRotVal += 36000;
+ rSet.Put(ScRotateValueItem(nRotVal));
}
- break;
- case ATTR_STACKED:
+ }
+ break;
+ case ATTR_STACKED:
+ {
+ table::CellOrientation eOrient;
+ if (*pValue >>= eOrient)
{
- table::CellOrientation eOrient;
- if (*pValue >>= eOrient)
+ switch (eOrient)
{
- switch (eOrient)
+ case table::CellOrientation_STANDARD:
+ rSet.Put(ScVerticalStackCell(false));
+ break;
+ case table::CellOrientation_TOPBOTTOM:
+ rSet.Put(ScVerticalStackCell(false));
+ rSet.Put(ScRotateValueItem(27000));
+ break;
+ case table::CellOrientation_BOTTOMTOP:
+ rSet.Put(ScVerticalStackCell(false));
+ rSet.Put(ScRotateValueItem(9000));
+ break;
+ case table::CellOrientation_STACKED:
+ rSet.Put(ScVerticalStackCell(true));
+ break;
+ default:
{
- case table::CellOrientation_STANDARD:
- rSet.Put(ScVerticalStackCell(false));
- break;
- case table::CellOrientation_TOPBOTTOM:
- rSet.Put(ScVerticalStackCell(false));
- rSet.Put(ScRotateValueItem(27000));
- break;
- case table::CellOrientation_BOTTOMTOP:
- rSet.Put(ScVerticalStackCell(false));
- rSet.Put(ScRotateValueItem(9000));
- break;
- case table::CellOrientation_STACKED:
- rSet.Put(ScVerticalStackCell(true));
- break;
- default:
- {
- // added to avoid warnings
- }
+ // added to avoid warnings
}
}
}
- break;
- case ATTR_PAGE_SCALE:
- case ATTR_PAGE_SCALETOPAGES:
- {
- rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
- rSet.ClearItem(ATTR_PAGE_SCALE);
- rSet.ClearItem(ATTR_PAGE_SCALETO);
- sal_Int16 nVal = 0;
- *pValue >>= nVal;
- rSet.Put(SfxUInt16Item(pEntry->nWID, nVal));
- }
- break;
- case ATTR_PAGE_FIRSTPAGENO:
- {
- sal_Int16 nVal = 0;
- *pValue >>= nVal;
- rSet.Put(SfxUInt16Item(ATTR_PAGE_FIRSTPAGENO, nVal));
- }
- break;
- case ATTR_PAGE_CHARTS:
- case ATTR_PAGE_OBJECTS:
- case ATTR_PAGE_DRAWINGS:
- {
- bool bBool = false;
- *pValue >>= bBool;
- //! need to define sal_Bool-MID for ScViewObjectModeItem?
- rSet.Put(ScViewObjectModeItem(
- pEntry->nWID, bBool ? VOBJ_MODE_SHOW : VOBJ_MODE_HIDE));
- }
- break;
- case ATTR_PAGE_PAPERBIN:
- {
- sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS;
- bool bFound = false;
+ }
+ break;
+ case ATTR_PAGE_SCALE:
+ case ATTR_PAGE_SCALETOPAGES:
+ {
+ rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
+ rSet.ClearItem(ATTR_PAGE_SCALE);
+ rSet.ClearItem(ATTR_PAGE_SCALETO);
+ sal_Int16 nVal = 0;
+ *pValue >>= nVal;
+ rSet.Put(SfxUInt16Item(pEntry->nWID, nVal));
+ }
+ break;
+ case ATTR_PAGE_FIRSTPAGENO:
+ {
+ sal_Int16 nVal = 0;
+ *pValue >>= nVal;
+ rSet.Put(SfxUInt16Item(ATTR_PAGE_FIRSTPAGENO, nVal));
+ }
+ break;
+ case ATTR_PAGE_CHARTS:
+ case ATTR_PAGE_OBJECTS:
+ case ATTR_PAGE_DRAWINGS:
+ {
+ bool bBool = false;
+ *pValue >>= bBool;
+ //! need to define sal_Bool-MID for ScViewObjectModeItem?
+ rSet.Put(ScViewObjectModeItem(
+ pEntry->nWID, bBool ? VOBJ_MODE_SHOW : VOBJ_MODE_HIDE));
+ }
+ break;
+ case ATTR_PAGE_PAPERBIN:
+ {
+ sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS;
+ bool bFound = false;
- OUString aName;
- if (*pValue >>= aName)
+ OUString aName;
+ if (*pValue >>= aName)
+ {
+ if (aName == SC_PAPERBIN_DEFAULTNAME)
+ bFound = true;
+ else
{
- if (aName == SC_PAPERBIN_DEFAULTNAME)
- bFound = true;
- else
+ Printer* pPrinter = pDocShell->GetPrinter();
+ if (pPrinter)
{
- Printer* pPrinter = pDocShell->GetPrinter();
- if (pPrinter)
- {
- const sal_uInt16 nCount = pPrinter->GetPaperBinCount();
- for (sal_uInt16 i = 0; i < nCount; i++)
- if (aName == pPrinter->GetPaperBinName(i))
- {
- nTray = static_cast<sal_uInt8>(i);
- bFound = true;
- break;
- }
- }
+ const sal_uInt16 nCount = pPrinter->GetPaperBinCount();
+ for (sal_uInt16 i = 0; i < nCount; i++)
+ if (aName == pPrinter->GetPaperBinName(i))
+ {
+ nTray = static_cast<sal_uInt8>(i);
+ bFound = true;
+ break;
+ }
}
}
- if (!bFound)
- throw lang::IllegalArgumentException();
+ }
+ if (!bFound)
+ throw lang::IllegalArgumentException();
- rSet.Put(SvxPaperBinItem(ATTR_PAGE_PAPERBIN, nTray));
+ rSet.Put(SvxPaperBinItem(ATTR_PAGE_PAPERBIN, nTray));
- }
- break;
- case ATTR_PAGE_SCALETO:
- {
- sal_Int16 nPages = 0;
- if (*pValue >>= nPages)
- {
- ScPageScaleToItem aItem = rSet.Get(ATTR_PAGE_SCALETO);
- if (rPropertyName == SC_UNO_PAGE_SCALETOX)
- aItem.SetWidth(static_cast<sal_uInt16>(nPages));
- else
- aItem.SetHeight(static_cast<sal_uInt16>(nPages));
- rSet.Put(aItem);
- rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
- rSet.ClearItem(ATTR_PAGE_SCALE);
- }
- }
- break;
- case ATTR_HIDDEN:
- {
- bool bHidden = false;
- if (*pValue >>= bHidden)
- pStyle->SetHidden(bHidden);
- }
- break;
- default:
- // default items with wrong Slot-ID are not working in SfxItemPropertySet3
- //! change Slot-IDs...
- if (rSet.GetPool()->GetSlotId(pEntry->nWID) == pEntry->nWID
- && rSet.GetItemState(pEntry->nWID, false) == SfxItemState::DEFAULT)
+ }
+ break;
+ case ATTR_PAGE_SCALETO:
+ {
+ sal_Int16 nPages = 0;
+ if (*pValue >>= nPages)
{
- rSet.Put(rSet.Get(pEntry->nWID));
+ ScPageScaleToItem aItem = rSet.Get(ATTR_PAGE_SCALETO);
+ if (rPropertyName == SC_UNO_PAGE_SCALETOX)
+ aItem.SetWidth(static_cast<sal_uInt16>(nPages));
+ else
+ aItem.SetHeight(static_cast<sal_uInt16>(nPages));
+ rSet.Put(aItem);
+ rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
+ rSet.ClearItem(ATTR_PAGE_SCALE);
}
- pPropSet->setPropertyValue(*pEntry, *pValue, rSet);
- }
+ }
+ break;
+ case ATTR_HIDDEN:
+ {
+ bool bHidden = false;
+ if (*pValue >>= bHidden)
+ pStyle->SetHidden(bHidden);
+ }
+ break;
+ default:
+ // default items with wrong Slot-ID are not working in SfxItemPropertySet3
+ //! change Slot-IDs...
+ if (rSet.GetPool()->GetSlotId(pEntry->nWID) == pEntry->nWID
+ && rSet.GetItemState(pEntry->nWID, false) == SfxItemState::DEFAULT)
+ {
+ rSet.Put(rSet.Get(pEntry->nWID));
+ }
+ pPropSet->setPropertyValue(*pEntry, *pValue, rSet);
}
- else
- {
- rSet.ClearItem(pEntry->nWID);
- // language for number formats
- if (pEntry->nWID == ATTR_VALUE_FORMAT)
- rSet.ClearItem(ATTR_LANGUAGE_FORMAT);
+ }
+ else
+ {
+ rSet.ClearItem(pEntry->nWID);
+ // language for number formats
+ if (pEntry->nWID == ATTR_VALUE_FORMAT)
+ rSet.ClearItem(ATTR_LANGUAGE_FORMAT);
- //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
- }
+ //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
}
- else if (IsScUnoWid(pEntry->nWID))
+ }
+ else if (IsScUnoWid(pEntry->nWID))
+ {
+ switch (pEntry->nWID)
{
- switch (pEntry->nWID)
- {
- case SC_WID_UNO_TBLBORD:
+ case SC_WID_UNO_TBLBORD:
+ {
+ if (pValue)
{
- if (pValue)
- {
- table::TableBorder aBorder;
- if (*pValue >>= aBorder)
- {
- SvxBoxItem aOuter(ATTR_BORDER);
- SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
- ScHelperFunctions::FillBoxItems(aOuter, aInner, aBorder);
- rSet.Put(aOuter);
- }
- }
- else
+ table::TableBorder aBorder;
+ if (*pValue >>= aBorder)
{
- rSet.ClearItem(ATTR_BORDER);
+ SvxBoxItem aOuter(ATTR_BORDER);
+ SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
+ ScHelperFunctions::FillBoxItems(aOuter, aInner, aBorder);
+ rSet.Put(aOuter);
}
}
- break;
- case SC_WID_UNO_TBLBORD2:
+ else
{
- if (pValue)
- {
- table::TableBorder2 aBorder2;
- if (*pValue >>= aBorder2)
- {
- SvxBoxItem aOuter(ATTR_BORDER);
- SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
- ScHelperFunctions::FillBoxItems(aOuter, aInner, aBorder2);
- rSet.Put(aOuter);
- }
- }
- else
+ rSet.ClearItem(ATTR_BORDER);
+ }
+ }
+ break;
+ case SC_WID_UNO_TBLBORD2:
+ {
+ if (pValue)
+ {
+ table::TableBorder2 aBorder2;
+ if (*pValue >>= aBorder2)
{
- rSet.ClearItem(ATTR_BORDER);
+ SvxBoxItem aOuter(ATTR_BORDER);
+ SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
+ ScHelperFunctions::FillBoxItems(aOuter, aInner, aBorder2);
+ rSet.Put(aOuter);
}
}
- break;
- }
+ else
+ {
+ rSet.ClearItem(ATTR_BORDER);
+ }
+ }
+ break;
}
}
+ }
- //! DocFunc-??
- //! Undo ??
+ //! DocFunc-??
+ //! Undo ??
- ScDocument& rDoc = pDocShell->GetDocument();
- if ( eFamily == SfxStyleFamily::Para )
+ ScDocument& rDoc = pDocShell->GetDocument();
+ if ( eFamily == SfxStyleFamily::Para )
+ {
+ // If we are loading, we can delay line height calculcation, because we are going to re-calc all of those
+ // after load.
+ if (pDocShell && !pDocShell->IsLoading())
{
- // If we are loading, we can delay line height calculcation, because we are going to re-calc all of those
- // after load.
- if (pDocShell && !pDocShell->IsLoading())
- {
- // update line height
- ScopedVclPtrInstance< VirtualDevice > pVDev;
- Point aLogic = pVDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip));
- double nPPTX = aLogic.X() / 1000.0;
- double nPPTY = aLogic.Y() / 1000.0;
- Fraction aZoom(1,1);
- rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
+ // update line height
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ Point aLogic = pVDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip));
+ double nPPTX = aLogic.X() / 1000.0;
+ double nPPTY = aLogic.Y() / 1000.0;
+ Fraction aZoom(1,1);
+ rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
- if (!rDoc.IsImportingXML())
- {
- pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
- pDocShell->SetDocumentModified();
- }
+ if (!rDoc.IsImportingXML())
+ {
+ pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
+ pDocShell->SetDocumentModified();
}
}
- else
- {
- //! ModifyStyleSheet on document (save old values)
+ }
+ else
+ {
+ //! ModifyStyleSheet on document (save old values)
- pDocShell->PageStyleModified( aStyleName, true );
- }
+ pDocShell->PageStyleModified( aStyleName, true );
}
}
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 1178d5ee59a5..3fa442739d2f 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -1050,20 +1050,20 @@ void SAL_CALL ScTabViewObj::setActiveSheet( const uno::Reference<sheet::XSpreads
comphelper::ProfileZone aZone("setActiveSheet");
ScTabViewShell* pViewSh = GetViewShell();
- if ( pViewSh && xActiveSheet.is() )
- {
- // XSpreadsheet and ScCellRangesBase -> has to be the same sheet
+ if ( !(pViewSh && xActiveSheet.is()) )
+ return;
- ScCellRangesBase* pRangesImp = comphelper::getUnoTunnelImplementation<ScCellRangesBase>( xActiveSheet );
- if ( pRangesImp && pViewSh->GetViewData().GetDocShell() == pRangesImp->GetDocShell() )
+ // XSpreadsheet and ScCellRangesBase -> has to be the same sheet
+
+ ScCellRangesBase* pRangesImp = comphelper::getUnoTunnelImplementation<ScCellRangesBase>( xActiveSheet );
+ if ( pRangesImp && pViewSh->GetViewData().GetDocShell() == pRangesImp->GetDocShell() )
+ {
+ const ScRangeList& rRanges = pRangesImp->GetRangeList();
+ if ( rRanges.size() == 1 )
{
- const ScRangeList& rRanges = pRangesImp->GetRangeList();
- if ( rRanges.size() == 1 )
- {
- SCTAB nNewTab = rRanges[ 0 ].aStart.Tab();
- if ( pViewSh->GetViewData().GetDocument()->HasTable(nNewTab) )
- pViewSh->SetTabNo( nNewTab );
- }
+ SCTAB nNewTab = rRanges[ 0 ].aStart.Tab();
+ if ( pViewSh->GetViewData().GetDocument()->HasTable(nNewTab) )
+ pViewSh->SetTabNo( nNewTab );
}
}
}
@@ -1377,27 +1377,27 @@ sal_Int16 ScTabViewObj::GetZoom() const
void ScTabViewObj::SetZoom(sal_Int16 nZoom)
{
ScTabViewShell* pViewSh = GetViewShell();
- if (pViewSh)
+ if (!pViewSh)
+ return;
+
+ if ( nZoom != GetZoom() && nZoom != 0 )
{
- if ( nZoom != GetZoom() && nZoom != 0 )
+ if (!pViewSh->GetViewData().IsPagebreakMode())
{
- if (!pViewSh->GetViewData().IsPagebreakMode())
- {
- ScModule* pScMod = SC_MOD();
- ScAppOptions aNewOpt(pScMod->GetAppOptions());
- aNewOpt.SetZoom( nZoom );
- aNewOpt.SetZoomType( pViewSh->GetViewData().GetView()->GetZoomType() );
- pScMod->SetAppOptions( aNewOpt );
- }
+ ScModule* pScMod = SC_MOD();
+ ScAppOptions aNewOpt(pScMod->GetAppOptions());
+ aNewOpt.SetZoom( nZoom );
+ aNewOpt.SetZoomType( pViewSh->GetViewData().GetView()->GetZoomType() );
+ pScMod->SetAppOptions( aNewOpt );
}
- Fraction aFract( nZoom, 100 );
- pViewSh->SetZoom( aFract, aFract, true );
- pViewSh->PaintGrid();
- pViewSh->PaintTop();
- pViewSh->PaintLeft();
- pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
- pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
}
+ Fraction aFract( nZoom, 100 );
+ pViewSh->SetZoom( aFract, aFract, true );
+ pViewSh->PaintGrid();
+ pViewSh->PaintTop();
+ pViewSh->PaintLeft();
+ pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
+ pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
}
sal_Int16 ScTabViewObj::GetZoomType() const
@@ -1432,55 +1432,55 @@ sal_Int16 ScTabViewObj::GetZoomType() const
void ScTabViewObj::SetZoomType(sal_Int16 aZoomType)
{
ScTabViewShell* pViewSh = GetViewShell();
- if (pViewSh)
+ if (!pViewSh)
+ return;
+
+ ScDBFunc* pView = pViewSh->GetViewData().GetView();
+ if (!pView)
+ return;
+
+ SvxZoomType eZoomType;
+ switch (aZoomType)
{
- ScDBFunc* pView = pViewSh->GetViewData().GetView();
- if (pView)
- {
- SvxZoomType eZoomType;
- switch (aZoomType)
- {
- case view::DocumentZoomType::BY_VALUE:
- eZoomType = SvxZoomType::PERCENT;
- break;
- case view::DocumentZoomType::OPTIMAL:
- eZoomType = SvxZoomType::OPTIMAL;
- break;
- case view::DocumentZoomType::ENTIRE_PAGE:
- eZoomType = SvxZoomType::WHOLEPAGE;
- break;
- case view::DocumentZoomType::PAGE_WIDTH:
- eZoomType = SvxZoomType::PAGEWIDTH;
- break;
- case view::DocumentZoomType::PAGE_WIDTH_EXACT:
- eZoomType = SvxZoomType::PAGEWIDTH_NOBORDER;
- break;
- default:
- eZoomType = SvxZoomType::OPTIMAL;
- }
- sal_Int16 nZoom(GetZoom());
- sal_Int16 nOldZoom(nZoom);
- if ( eZoomType == SvxZoomType::PERCENT )
- {
- if ( nZoom < MINZOOM ) nZoom = MINZOOM;
- if ( nZoom > MAXZOOM ) nZoom = MAXZOOM;
- }
- else
- nZoom = pView->CalcZoom( eZoomType, nOldZoom );
+ case view::DocumentZoomType::BY_VALUE:
+ eZoomType = SvxZoomType::PERCENT;
+ break;
+ case view::DocumentZoomType::OPTIMAL:
+ eZoomType = SvxZoomType::OPTIMAL;
+ break;
+ case view::DocumentZoomType::ENTIRE_PAGE:
+ eZoomType = SvxZoomType::WHOLEPAGE;
+ break;
+ case view::DocumentZoomType::PAGE_WIDTH:
+ eZoomType = SvxZoomType::PAGEWIDTH;
+ break;
+ case view::DocumentZoomType::PAGE_WIDTH_EXACT:
+ eZoomType = SvxZoomType::PAGEWIDTH_NOBORDER;
+ break;
+ default:
+ eZoomType = SvxZoomType::OPTIMAL;
+ }
+ sal_Int16 nZoom(GetZoom());
+ sal_Int16 nOldZoom(nZoom);
+ if ( eZoomType == SvxZoomType::PERCENT )
+ {
+ if ( nZoom < MINZOOM ) nZoom = MINZOOM;
+ if ( nZoom > MAXZOOM ) nZoom = MAXZOOM;
+ }
+ else
+ nZoom = pView->CalcZoom( eZoomType, nOldZoom );
- switch ( eZoomType )
- {
- case SvxZoomType::WHOLEPAGE:
- case SvxZoomType::PAGEWIDTH:
- pView->SetZoomType( eZoomType, true );
- break;
+ switch ( eZoomType )
+ {
+ case SvxZoomType::WHOLEPAGE:
+ case SvxZoomType::PAGEWIDTH:
+ pView->SetZoomType( eZoomType, true );
+ break;
- default:
- pView->SetZoomType( SvxZoomType::PERCENT, true );
- }
- SetZoom( nZoom );
- }
+ default:
+ pView->SetZoomType( SvxZoomType::PERCENT, true );
}
+ SetZoom( nZoom );
}
sal_Bool SAL_CALL ScTabViewObj::getIsWindowSplit()
@@ -1604,25 +1604,25 @@ void SAL_CALL ScTabViewObj::freezeAtPosition( sal_Int32 nColumns, sal_Int32 nRow
{
SolarMutexGuard aGuard;
ScTabViewShell* pViewSh = GetViewShell();
- if (pViewSh)
- {
- // first, remove them all -> no stress with scrolling in the meantime
+ if (!pViewSh)
+ return;
- pViewSh->RemoveSplit();
+ // first, remove them all -> no stress with scrolling in the meantime
- Point aWinStart;
- vcl::Window* pWin = pViewSh->GetWindowByPos( SC_SPLIT_BOTTOMLEFT );
- if (pWin)
- aWinStart = pWin->GetPosPixel();
+ pViewSh->RemoveSplit();
- ScViewData& rViewData = pViewSh->GetViewData();
- Point aSplit(rViewData.GetScrPos( static_cast<SCCOL>(nColumns), static_cast<SCROW>(nRows), SC_SPLIT_BOTTOMLEFT, true ));
- aSplit += aWinStart;
+ Point aWinStart;
+ vcl::Window* pWin = pViewSh->GetWindowByPos( SC_SPLIT_BOTTOMLEFT );
+ if (pWin)
+ aWinStart = pWin->GetPosPixel();
- pViewSh->SplitAtPixel( aSplit );
- pViewSh->FreezeSplitters( true );
- pViewSh->InvalidateSplit();
- }
+ ScViewData& rViewData = pViewSh->GetViewData();
+ Point aSplit(rViewData.GetScrPos( static_cast<SCCOL>(nColumns), static_cast<SCROW>(nRows), SC_SPLIT_BOTTOMLEFT, true ));
+ aSplit += aWinStart;
+
+ pViewSh->SplitAtPixel( aSplit );
+ pViewSh->FreezeSplitters( true );
+ pViewSh->InvalidateSplit();
}
void SAL_CALL ScTabViewObj::addSelectionChangeListener(
@@ -1680,18 +1680,18 @@ void ScTabViewObj::SelectionChanged()
SfxApplication::Get()->Broadcast( SfxHint( SfxHintId::ScSelectionChanged ) );
- if ( !mbLeftMousePressed ) // selection still in progress
+ if ( mbLeftMousePressed ) // selection still in progress
+ return;
+
+ try
+ {
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[ 0 ] = getSelection();
+ xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( ScSheetEventId::SELECT ), aArgs );
+ }
+ catch( uno::Exception& )
{
- try
- {
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] = getSelection();
- xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( ScSheetEventId::SELECT ), aArgs );
- }
- catch( uno::Exception& )
- {
- }
}
}
@@ -1718,113 +1718,113 @@ void SAL_CALL ScTabViewObj::setPropertyValue(
}
ScTabViewShell* pViewSh = GetViewShell();
- if (pViewSh)
- {
- ScViewData& rViewData = pViewSh->GetViewData();
- const ScViewOptions& rOldOpt = pViewSh->GetViewData().GetOptions();
- ScViewOptions aNewOpt(rOldOpt);
+ if (!pViewSh)
+ return;
- if ( aPropertyName == SC_UNO_COLROWHDR || aPropertyName == OLD_UNO_COLROWHDR )
- aNewOpt.SetOption( VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_HORSCROLL || aPropertyName == OLD_UNO_HORSCROLL )
- aNewOpt.SetOption( VOPT_HSCROLL, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_OUTLSYMB || aPropertyName == OLD_UNO_OUTLSYMB )
- aNewOpt.SetOption( VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_SHEETTABS || aPropertyName == OLD_UNO_SHEETTABS )
- aNewOpt.SetOption( VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_SHOWANCHOR )
- aNewOpt.SetOption( VOPT_ANCHOR, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_SHOWFORM )
- aNewOpt.SetOption( VOPT_FORMULAS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_SHOWGRID )
- aNewOpt.SetOption( VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_SHOWHELP )
- aNewOpt.SetOption( VOPT_HELPLINES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_SHOWNOTES )
- aNewOpt.SetOption( VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_SHOWPAGEBR )
- aNewOpt.SetOption( VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_SHOWZERO )
- aNewOpt.SetOption( VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_VALUEHIGH || aPropertyName == OLD_UNO_VALUEHIGH )
- aNewOpt.SetOption( VOPT_SYNTAX, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_VERTSCROLL || aPropertyName == OLD_UNO_VERTSCROLL )
- aNewOpt.SetOption( VOPT_VSCROLL, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aPropertyName == SC_UNO_SHOWOBJ )
+ ScViewData& rViewData = pViewSh->GetViewData();
+ const ScViewOptions& rOldOpt = pViewSh->GetViewData().GetOptions();
+ ScViewOptions aNewOpt(rOldOpt);
+
+ if ( aPropertyName == SC_UNO_COLROWHDR || aPropertyName == OLD_UNO_COLROWHDR )
+ aNewOpt.SetOption( VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_HORSCROLL || aPropertyName == OLD_UNO_HORSCROLL )
+ aNewOpt.SetOption( VOPT_HSCROLL, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_OUTLSYMB || aPropertyName == OLD_UNO_OUTLSYMB )
+ aNewOpt.SetOption( VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_SHEETTABS || aPropertyName == OLD_UNO_SHEETTABS )
+ aNewOpt.SetOption( VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_SHOWANCHOR )
+ aNewOpt.SetOption( VOPT_ANCHOR, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_SHOWFORM )
+ aNewOpt.SetOption( VOPT_FORMULAS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_SHOWGRID )
+ aNewOpt.SetOption( VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_SHOWHELP )
+ aNewOpt.SetOption( VOPT_HELPLINES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_SHOWNOTES )
+ aNewOpt.SetOption( VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_SHOWPAGEBR )
+ aNewOpt.SetOption( VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_SHOWZERO )
+ aNewOpt.SetOption( VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_VALUEHIGH || aPropertyName == OLD_UNO_VALUEHIGH )
+ aNewOpt.SetOption( VOPT_SYNTAX, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_VERTSCROLL || aPropertyName == OLD_UNO_VERTSCROLL )
+ aNewOpt.SetOption( VOPT_VSCROLL, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if ( aPropertyName == SC_UNO_SHOWOBJ )
+ {
+ sal_Int16 nIntVal = 0;
+ if ( aValue >>= nIntVal )
{
- sal_Int16 nIntVal = 0;
- if ( aValue >>= nIntVal )
- {
- //#i80528# adapt to new range eventually
- if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW);
+ //#i80528# adapt to new range eventually
+ if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW);
- aNewOpt.SetObjMode( VOBJ_TYPE_OLE, static_cast<ScVObjMode>(nIntVal));
- }
+ aNewOpt.SetObjMode( VOBJ_TYPE_OLE, static_cast<ScVObjMode>(nIntVal));
}
- else if ( aPropertyName == SC_UNO_SHOWCHARTS )
+ }
+ else if ( aPropertyName == SC_UNO_SHOWCHARTS )
+ {
+ sal_Int16 nIntVal = 0;
+ if ( aValue >>= nIntVal )
{
- sal_Int16 nIntVal = 0;
- if ( aValue >>= nIntVal )
- {
- //#i80528# adapt to new range eventually
- if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW);
+ //#i80528# adapt to new range eventually
+ if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW);
- aNewOpt.SetObjMode( VOBJ_TYPE_CHART, static_cast<ScVObjMode>(nIntVal));
- }
+ aNewOpt.SetObjMode( VOBJ_TYPE_CHART, static_cast<ScVObjMode>(nIntVal));
}
- else if ( aPropertyName == SC_UNO_SHOWDRAW )
+ }
+ else if ( aPropertyName == SC_UNO_SHOWDRAW )
+ {
+ sal_Int16 nIntVal = 0;
+ if ( aValue >>= nIntVal )
{
- sal_Int16 nIntVal = 0;
- if ( aValue >>= nIntVal )
- {
- //#i80528# adapt to new range eventually
- if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW);
+ //#i80528# adapt to new range eventually
+ if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW);
- aNewOpt.SetObjMode( VOBJ_TYPE_DRAW, static_cast<ScVObjMode>(nIntVal));
- }
- }
- else if ( aPropertyName == SC_UNO_GRIDCOLOR )
- {
- Color nIntVal;
- if ( aValue >>= nIntVal )
- aNewOpt.SetGridColor( nIntVal, OUString() );
- }
- else if ( aPropertyName == SC_UNO_ZOOMTYPE )
- {
- sal_Int16 nIntVal = 0;
- if ( aValue >>= nIntVal )
- SetZoomType(nIntVal);
- }
- else if ( aPropertyName == SC_UNO_ZOOMVALUE )
- {
- sal_Int16 nIntVal = 0;
- if ( aValue >>= nIntVal )
- SetZoom(nIntVal);
+ aNewOpt.SetObjMode( VOBJ_TYPE_DRAW, static_cast<ScVObjMode>(nIntVal));
}
+ }
+ else if ( aPropertyName == SC_UNO_GRIDCOLOR )
+ {
+ Color nIntVal;
+ if ( aValue >>= nIntVal )
+ aNewOpt.SetGridColor( nIntVal, OUString() );
+ }
+ else if ( aPropertyName == SC_UNO_ZOOMTYPE )
+ {
+ sal_Int16 nIntVal = 0;
+ if ( aValue >>= nIntVal )
+ SetZoomType(nIntVal);
+ }
+ else if ( aPropertyName == SC_UNO_ZOOMVALUE )
+ {
+ sal_Int16 nIntVal = 0;
+ if ( aValue >>= nIntVal )
+ SetZoom(nIntVal);
+ }
- // Options are set on the view and document (for new views),
- // so that they remain during saving.
- //! In the app (module) we need an extra options to tune that
- //! (for new documents)
+ // Options are set on the view and document (for new views),
+ // so that they remain during saving.
+ //! In the app (module) we need an extra options to tune that
+ //! (for new documents)
- if ( aNewOpt != rOldOpt )
- {
- rViewData.SetOptions( aNewOpt );
- rViewData.GetDocument()->SetViewOptions( aNewOpt );
- rViewData.GetDocShell()->SetDocumentModified(); //! really?
-
- pViewSh->UpdateFixPos();
- pViewSh->PaintGrid();
- pViewSh->PaintTop();
- pViewSh->PaintLeft();
- pViewSh->PaintExtras();
- pViewSh->InvalidateBorder();
-
- SfxBindings& rBindings = pViewSh->GetViewFrame()->GetBindings();
- rBindings.Invalidate( FID_TOGGLEHEADERS ); // -> check in menu
- rBindings.Invalidate( FID_TOGGLESYNTAX );
- }
- }
+ if ( aNewOpt == rOldOpt )
+ return;
+
+ rViewData.SetOptions( aNewOpt );
+ rViewData.GetDocument()->SetViewOptions( aNewOpt );
+ rViewData.GetDocShell()->SetDocumentModified(); //! really?
+
+ pViewSh->UpdateFixPos();
+ pViewSh->PaintGrid();
+ pViewSh->PaintTop();
+ pViewSh->PaintLeft();
+ pViewSh->PaintExtras();
+ pViewSh->InvalidateBorder();
+
+ SfxBindings& rBindings = pViewSh->GetViewFrame()->GetBindings();
+ rBindings.Invalidate( FID_TOGGLEHEADERS ); // -> check in menu
+ rBindings.Invalidate( FID_TOGGLESYNTAX );
}
uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const OUString& aPropertyName )
@@ -1925,38 +1925,38 @@ void SAL_CALL ScTabViewObj::startRangeSelection(
{
SolarMutexGuard aGuard;
ScTabViewShell* pViewSh = GetViewShell();
- if (pViewSh)
+ if (!pViewSh)
+ return;
+
+ OUString aInitVal, aTitle;
+ bool bCloseOnButtonUp = false;
+ bool bSingleCell = false;
+ bool bMultiSelection = false;
+
+ OUString aStrVal;
+ for (const beans::PropertyValue& rProp : aArguments)
{
- OUString aInitVal, aTitle;
- bool bCloseOnButtonUp = false;
- bool bSingleCell = false;
- bool bMultiSelection = false;
+ OUString aPropName(rProp.Name);
- OUString aStrVal;
- for (const beans::PropertyValue& rProp : aArguments)
+ if (aPropName == SC_UNONAME_CLOSEONUP )
+ bCloseOnButtonUp = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
+ else if (aPropName == SC_UNONAME_TITLE )
{
- OUString aPropName(rProp.Name);
-
- if (aPropName == SC_UNONAME_CLOSEONUP )
- bCloseOnButtonUp = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
- else if (aPropName == SC_UNONAME_TITLE )
- {
- if ( rProp.Value >>= aStrVal )
- aTitle = aStrVal;
- }
- else if (aPropName == SC_UNONAME_INITVAL )
- {
- if ( rProp.Value >>= aStrVal )
- aInitVal = aStrVal;
- }
- else if (aPropName == SC_UNONAME_SINGLECELL )
- bSingleCell = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
- else if (aPropName == SC_UNONAME_MULTISEL )
- bMultiSelection = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
+ if ( rProp.Value >>= aStrVal )
+ aTitle = aStrVal;
}
-
- pViewSh->StartSimpleRefDialog( aTitle, aInitVal, bCloseOnButtonUp, bSingleCell, bMultiSelection );
+ else if (aPropName == SC_UNONAME_INITVAL )
+ {
+ if ( rProp.Value >>= aStrVal )
+ aInitVal = aStrVal;
+ }
+ else if (aPropName == SC_UNONAME_SINGLECELL )
+ bSingleCell = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
+ else if (aPropName == SC_UNONAME_MULTISEL )
+ bMultiSelection = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
}
+
+ pViewSh->StartSimpleRefDialog( aTitle, aInitVal, bCloseOnButtonUp, bSingleCell, bMultiSelection );
}
void SAL_CALL ScTabViewObj::abortRangeSelection()