diff options
author | Noel Grandin <noel@peralex.com> | 2014-06-18 12:14:29 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-06-24 11:34:21 +0200 |
commit | e2080e70fe8b085f18e868e46340454720fa94ca (patch) | |
tree | 4038d1d57b41b68a47d5ebbbe6ad390648ec6303 /sc/source/ui/unoobj | |
parent | Translated German comments - correction (diff) | |
download | core-e2080e70fe8b085f18e868e46340454720fa94ca.tar.gz core-e2080e70fe8b085f18e868e46340454720fa94ca.zip |
new compilerplugin returnbyref
Find places where we are returning a pointer to something, where we can
be returning a reference.
e.g.
class A {
struct X x;
public X* getX() { return &x; }
}
which can be:
public X& getX() { return x; }
Change-Id: I796fd23fd36a18aedf6e36bc28f8fab4f518c6c7
Diffstat (limited to 'sc/source/ui/unoobj')
24 files changed, 1366 insertions, 1419 deletions
diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx index 82f540905501..d7a273c240da 100644 --- a/sc/source/ui/unoobj/addruno.cxx +++ b/sc/source/ui/unoobj/addruno.cxx @@ -37,13 +37,13 @@ ScAddressConversionObj::ScAddressConversionObj(ScDocShell* pDocSh, bool _bIsRang nRefSheet( 0 ), bIsRange( _bIsRange ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScAddressConversionObj::~ScAddressConversionObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScAddressConversionObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -60,11 +60,11 @@ bool ScAddressConversionObj::ParseUIString( const OUString& rUIString, ::formula if (!pDocShell) return false; - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); bool bSuccess = false; if ( bIsRange ) { - sal_uInt16 nResult = aRange.ParseAny( rUIString, pDoc, eConv ); + sal_uInt16 nResult = aRange.ParseAny( rUIString, &rDoc, eConv ); if ( nResult & SCA_VALID ) { if ( ( nResult & SCA_TAB_3D ) == 0 ) @@ -78,7 +78,7 @@ bool ScAddressConversionObj::ParseUIString( const OUString& rUIString, ::formula } else { - sal_uInt16 nResult = aRange.aStart.Parse( rUIString, pDoc, eConv ); + sal_uInt16 nResult = aRange.aStart.Parse( rUIString, &rDoc, eConv ); if ( nResult & SCA_VALID ) { if ( ( nResult & SCA_TAB_3D ) == 0 ) @@ -222,7 +222,7 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro if ( !pDocShell ) throw uno::RuntimeException(); - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); uno::Any aRet; OUString aNameStr(aPropertyName); @@ -253,9 +253,9 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro if ( aRange.aStart.Tab() != nRefSheet ) nFlags |= SCA_TAB_3D; if ( bIsRange ) - aFormatStr = aRange.Format(nFlags, pDoc); + aFormatStr = aRange.Format(nFlags, &rDoc); else - aFormatStr = aRange.aStart.Format(nFlags, pDoc); + aFormatStr = aRange.aStart.Format(nFlags, &rDoc); aRet <<= aFormatStr; } else if ( aNameStr.equalsAscii( SC_UNONAME_PERSREPR ) || aNameStr.equalsAscii( SC_UNONAME_XLA1REPR ) ) @@ -264,7 +264,7 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro ::formula::FormulaGrammar::CONV_XL_A1 : ::formula::FormulaGrammar::CONV_OOO; // generate file format string - always include sheet - OUString aFormatStr(aRange.aStart.Format(SCA_VALID | SCA_TAB_3D, pDoc, eConv)); + OUString aFormatStr(aRange.aStart.Format(SCA_VALID | SCA_TAB_3D, &rDoc, eConv)); if ( bIsRange ) { // manually concatenate range so both parts always have the sheet name @@ -272,7 +272,7 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro sal_uInt16 nFlags = SCA_VALID; if( eConv != ::formula::FormulaGrammar::CONV_XL_A1 ) nFlags |= SCA_TAB_3D; - OUString aSecond(aRange.aEnd.Format(nFlags, pDoc, eConv)); + OUString aSecond(aRange.aEnd.Format(nFlags, &rDoc, eConv)); aFormatStr += aSecond ; } aRet <<= OUString( aFormatStr ); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 276a2fec54d8..77321977bf36 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1045,8 +1045,8 @@ void ScHelperFunctions::AssignTableBorder2ToAny( uno::Any& rAny, void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& rRanges, const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner ) { - ScDocument* pDoc = pDocShell->GetDocument(); - bool bUndo(pDoc->IsUndoEnabled()); + ScDocument& rDoc = pDocShell->GetDocument(); + bool bUndo(rDoc.IsUndoEnabled()); ScDocument* pUndoDoc = NULL; if (bUndo) pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); @@ -1059,17 +1059,17 @@ void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& r if (bUndo) { if ( i==0 ) - pUndoDoc->InitUndo( pDoc, nTab, nTab ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab ); else pUndoDoc->AddUndoTab( nTab, nTab ); - pDoc->CopyToDocument( aRange, IDF_ATTRIB, false, pUndoDoc ); + rDoc.CopyToDocument( aRange, IDF_ATTRIB, false, pUndoDoc ); } ScMarkData aMark; aMark.SetMarkArea( aRange ); aMark.SelectTable( nTab, true ); - pDoc->ApplySelectionFrame( aMark, &rOuter, &rInner ); + rDoc.ApplySelectionFrame( aMark, &rOuter, &rInner ); // RowHeight bei Umrandung alleine nicht noetig } @@ -1091,15 +1091,15 @@ void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& r static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, const uno::Sequence< uno::Sequence<uno::Any> >& aData ) { - ScDocument* pDoc = rDocShell.GetDocument(); + ScDocument& rDoc = rDocShell.GetDocument(); SCTAB nTab = rRange.aStart.Tab(); SCCOL nStartCol = rRange.aStart.Col(); SCROW nStartRow = rRange.aStart.Row(); SCCOL nEndCol = rRange.aEnd.Col(); SCROW nEndRow = rRange.aEnd.Row(); - bool bUndo(pDoc->IsUndoEnabled()); + bool bUndo(rDoc.IsUndoEnabled()); - if ( !pDoc->IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) ) + if ( !rDoc.IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) ) { //! error message return false; @@ -1121,11 +1121,11 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, if ( bUndo ) { pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nTab, nTab ); - pDoc->CopyToDocument( rRange, IDF_CONTENTS|IDF_NOCAPTIONS, false, pUndoDoc ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab ); + rDoc.CopyToDocument( rRange, IDF_CONTENTS|IDF_NOCAPTIONS, false, pUndoDoc ); } - pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS ); + rDoc.DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS ); bool bError = false; SCROW nDocRow = nStartRow; @@ -1146,7 +1146,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, case uno::TypeClass_VOID: { // void = "no value" - pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE ); + rDoc.SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE ); } break; @@ -1162,7 +1162,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, { double fVal(0.0); rElement >>= fVal; - pDoc->SetValue(aPos, fVal); + rDoc.SetValue(aPos, fVal); } break; @@ -1174,7 +1174,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, { ScSetStringParam aParam; aParam.setTextInput(); - pDoc->SetString(aPos, aUStr, &aParam); + rDoc.SetString(aPos, aUStr, &aParam); } } break; @@ -1186,8 +1186,8 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, if ( rElement >>= aTokens ) { ScTokenArray aTokenArray; - ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, aTokens ); - pDoc->SetFormula(aPos, aTokenArray); + ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, aTokens ); + rDoc.SetFormula(aPos, aTokenArray); } else bError = true; @@ -1230,15 +1230,15 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange, const uno::Sequence< uno::Sequence<OUString> >& aData, const formula::FormulaGrammar::Grammar eGrammar ) { - ScDocument* pDoc = rDocShell.GetDocument(); + ScDocument& rDoc = rDocShell.GetDocument(); SCTAB nTab = rRange.aStart.Tab(); SCCOL nStartCol = rRange.aStart.Col(); SCROW nStartRow = rRange.aStart.Row(); SCCOL nEndCol = rRange.aEnd.Col(); SCROW nEndRow = rRange.aEnd.Row(); - bool bUndo(pDoc->IsUndoEnabled()); + bool bUndo(rDoc.IsUndoEnabled()); - if ( !pDoc->IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) ) + if ( !rDoc.IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) ) { //! error message return false; @@ -1260,11 +1260,11 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange, if ( bUndo ) { pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nTab, nTab ); - pDoc->CopyToDocument( rRange, IDF_CONTENTS, false, pUndoDoc ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab ); + rDoc.CopyToDocument( rRange, IDF_CONTENTS, false, pUndoDoc ); } - pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS ); + rDoc.DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS ); bool bError = false; SCROW nDocRow = nStartRow; @@ -1282,17 +1282,17 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange, ScInputStringType aRes = ScStringUtil::parseInputString( - *pDoc->GetFormatTable(), aText, LANGUAGE_ENGLISH_US); + *rDoc.GetFormatTable(), aText, LANGUAGE_ENGLISH_US); switch (aRes.meType) { case ScInputStringType::Formula: - pDoc->SetFormula(aPos, aRes.maText, eGrammar); + rDoc.SetFormula(aPos, aRes.maText, eGrammar); break; case ScInputStringType::Number: - pDoc->SetValue(aPos, aRes.mfValue); + rDoc.SetValue(aPos, aRes.mfValue); break; case ScInputStringType::Text: - pDoc->SetTextCell(aPos, aRes.maText); + rDoc.SetTextCell(aPos, aRes.maText); break; default: ; @@ -1328,13 +1328,10 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange, } // used in ScCellRangeObj::getFormulaArray and ScCellObj::GetInputString_Impl -static OUString lcl_GetInputString( ScDocument* pDoc, const ScAddress& rPos, bool bEnglish ) +static OUString lcl_GetInputString( ScDocument& rDoc, const ScAddress& rPos, bool bEnglish ) { - if (!pDoc) - return EMPTY_OUSTRING; - ScRefCellValue aCell; - aCell.assign(*pDoc, rPos); + aCell.assign(rDoc, rPos); if (aCell.isEmpty()) return EMPTY_OUSTRING; @@ -1349,11 +1346,11 @@ static OUString lcl_GetInputString( ScDocument* pDoc, const ScAddress& rPos, boo } SvNumberFormatter* pFormatter = bEnglish ? ScGlobal::GetEnglishFormatter() : - pDoc->GetFormatTable(); + rDoc.GetFormatTable(); // Since the English formatter was constructed with // LANGUAGE_ENGLISH_US the "General" format has index key 0, // we don't have to query. - sal_uInt32 nNumFmt = bEnglish ? 0 : pDoc->GetNumberFormat(rPos); + sal_uInt32 nNumFmt = bEnglish ? 0 : rDoc.GetNumberFormat(rPos); if (eType == CELLTYPE_EDIT) { @@ -1362,13 +1359,13 @@ static OUString lcl_GetInputString( ScDocument* pDoc, const ScAddress& rPos, boo const EditTextObject* pData = aCell.mpEditText; if (pData) { - EditEngine& rEngine = pDoc->GetEditEngine(); + EditEngine& rEngine = rDoc.GetEditEngine(); rEngine.SetText(*pData); aVal = rEngine.GetText(LINEEND_LF); } } else - ScCellFormat::GetInputString(aCell, nNumFmt, aVal, *pFormatter, pDoc); + ScCellFormat::GetInputString(aCell, nNumFmt, aVal, *pFormatter, &rDoc); // ggf. ein ' davorhaengen wie in ScTabViewShell::UpdateInputHandler if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT ) @@ -1412,9 +1409,9 @@ ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR) : if (pDocShell) // Null if created with createInstance { - ScDocument* pDoc = pDocShell->GetDocument(); - pDoc->AddUnoObject(*this); - nObjectId = pDoc->GetNewUnoId(); + ScDocument& rDoc = pDocShell->GetDocument(); + rDoc.AddUnoObject(*this); + nObjectId = rDoc.GetNewUnoId(); } } @@ -1437,9 +1434,9 @@ ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR) : { if (pDocShell) // Null if created with createInstance { - ScDocument* pDoc = pDocShell->GetDocument(); - pDoc->AddUnoObject(*this); - nObjectId = pDoc->GetNewUnoId(); + ScDocument& rDoc = pDocShell->GetDocument(); + rDoc.AddUnoObject(*this); + nObjectId = rDoc.GetNewUnoId(); } } @@ -1449,7 +1446,7 @@ ScCellRangesBase::~ScCellRangesBase() // during ForgetCurrentAttrs if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); ForgetCurrentAttrs(); ForgetMarkData(); @@ -1486,8 +1483,8 @@ const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsFlat() if ( !pCurrentFlat && pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - pCurrentFlat = pDoc->CreateSelectionPattern( *GetMarkData(), false ); + ScDocument& rDoc = pDocShell->GetDocument(); + pCurrentFlat = rDoc.CreateSelectionPattern( *GetMarkData(), false ); } return pCurrentFlat; } @@ -1498,8 +1495,8 @@ const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsDeep() if ( !pCurrentDeep && pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - pCurrentDeep = pDoc->CreateSelectionPattern( *GetMarkData(), true ); + ScDocument& rDoc = pDocShell->GetDocument(); + pCurrentDeep = rDoc.CreateSelectionPattern( *GetMarkData(), true ); } return pCurrentDeep; } @@ -1536,12 +1533,12 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) { const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint; - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); boost::scoped_ptr<ScRangeList> pUndoRanges; - if ( pDoc->HasUnoRefUndo() ) + if ( rDoc.HasUnoRefUndo() ) pUndoRanges.reset(new ScRangeList( aRanges )); - if ( aRanges.UpdateReference( rRef.GetMode(), pDoc, rRef.GetRange(), + if ( aRanges.UpdateReference( rRef.GetMode(), &rDoc, rRef.GetRange(), rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ) ) { // i#90076; the object "this" was destroyed after calling ScTableSheetObj::getImplementation @@ -1569,7 +1566,7 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) bGotDataChangedHint = true; if ( pUndoRanges ) - pDoc->AddUnoRefChange( nObjectId, *pUndoRanges ); + rDoc.AddUnoRefChange( nObjectId, *pUndoRanges ); } } else if ( rHint.ISA( SfxSimpleHint ) ) @@ -1615,9 +1612,9 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) // the EventObject holds a Ref to this object until after the listener calls - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); for ( sal_uInt16 n=0; n<aValueListeners.size(); n++ ) - pDoc->AddUnoListenerCall( aValueListeners[n], aEvent ); + rDoc.AddUnoListenerCall( aValueListeners[n], aEvent ); bGotDataChangedHint = false; } @@ -1655,9 +1652,9 @@ void ScCellRangesBase::RefChanged() { pValueListener->EndListeningAll(); - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i ) - pDoc->StartListeningArea( *aRanges[ i ], pValueListener ); + rDoc.StartListeningArea( *aRanges[ i ], pValueListener ); } ForgetCurrentAttrs(); @@ -1667,7 +1664,7 @@ void ScCellRangesBase::RefChanged() ScDocument* ScCellRangesBase::GetDocument() const { if (pDocShell) - return pDocShell->GetDocument(); + return &pDocShell->GetDocument(); else return NULL; } @@ -1683,7 +1680,7 @@ void ScCellRangesBase::InitInsertRange(ScDocShell* pDocSh, const ScRange& rR) aRanges.RemoveAll(); aRanges.Append( aCellRange ); - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); RefChanged(); // Range im Range-Objekt anpassen } @@ -1805,8 +1802,8 @@ double SAL_CALL ScCellRangesBase::computeFunction( sheet::GeneralFunction nFunct ScAddress aDummy; // wenn nicht Marked, ignoriert wegen Negative double fVal; ScSubTotalFunc eFunc = ScDPUtil::toSubTotalFunc(nFunction); - ScDocument* pDoc = pDocShell->GetDocument(); - if ( !pDoc->GetSelectionFunction( eFunc, aDummy, aMark, fVal ) ) + ScDocument& rDoc = pDocShell->GetDocument(); + if ( !rDoc.GetSelectionFunction( eFunc, aDummy, aMark, fVal ) ) { throw uno::RuntimeException(); //! own exception? } @@ -1903,7 +1900,7 @@ beans::PropertyState ScCellRangesBase::GetOnePropertyState( sal_uInt16 nItemWhic else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL ) { // a style is always set, there's no default state - const ScStyleSheet* pStyle = pDocShell->GetDocument()->GetSelectionStyle(*GetMarkData()); + const ScStyleSheet* pStyle = pDocShell->GetDocument().GetSelectionStyle(*GetMarkData()); if (pStyle) eRet = beans::PropertyState_DIRECT_VALUE; else @@ -2005,14 +2002,14 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropert if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); if ( pEntry ) { if ( IsScItemWid( pEntry->nWID ) ) { - const ScPatternAttr* pPattern = pDoc->GetDefPattern(); + const ScPatternAttr* pPattern = rDoc.GetDefPattern(); if ( pPattern ) { const SfxItemSet& rSet = pPattern->GetItemSet(); @@ -2046,7 +2043,7 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropert case SC_WID_UNO_TBLBORD: case SC_WID_UNO_TBLBORD2: { - const ScPatternAttr* pPattern = pDoc->GetDefPattern(); + const ScPatternAttr* pPattern = rDoc.GetDefPattern(); if ( pPattern ) { if (pEntry->nWID == SC_WID_UNO_TBLBORD2) @@ -2067,11 +2064,11 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropert bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC ); bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML ); formula::FormulaGrammar::Grammar eGrammar = (bXML ? - pDoc->GetStorageGrammar() : + rDoc.GetStorageGrammar() : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML)); aAny <<= uno::Reference<sheet::XSheetConditionalEntries>( - new ScTableConditionalFormat( pDoc, 0, aRanges[0]->aStart.Tab(), eGrammar )); + new ScTableConditionalFormat( &rDoc, 0, aRanges[0]->aStart.Tab(), eGrammar )); } break; case SC_WID_UNO_VALIDAT: @@ -2081,11 +2078,11 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropert bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC ); bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML ); formula::FormulaGrammar::Grammar eGrammar = (bXML ? - pDoc->GetStorageGrammar() : + rDoc.GetStorageGrammar() : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML)); aAny <<= uno::Reference<beans::XPropertySet>( - new ScTableValidationObj( pDoc, 0, eGrammar )); + new ScTableValidationObj( &rDoc, 0, eGrammar )); } break; case SC_WID_UNO_NUMRULES: @@ -2112,7 +2109,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangesBase::getPropertySe } static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rValue, - ScPatternAttr& rPattern, ScDocument* pDoc, + ScPatternAttr& rPattern, ScDocument &rDoc, sal_uInt16& rFirstItemId, sal_uInt16& rSecondItemId ) { rFirstItemId = rEntry.nWID; @@ -2124,7 +2121,7 @@ static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const case ATTR_VALUE_FORMAT: { // language for number formats - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); sal_uLong nOldFormat = ((const SfxUInt32Item&)rSet.Get( ATTR_VALUE_FORMAT )).GetValue(); LanguageType eOldLang = ((const SvxLanguageItem&)rSet.Get( ATTR_LANGUAGE_FORMAT )).GetLanguage(); nOldFormat = pFormatter->GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang ); @@ -2249,7 +2246,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE { if ( !aRanges.empty() ) // leer = nichts zu tun { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); // Fuer Teile von zusammengesetzten Items mit mehreren Properties (z.B. Hintergrund) // muss vorher das alte Item aus dem Dokument geholt werden @@ -2263,7 +2260,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE rSet.ClearInvalidItems(); sal_uInt16 nFirstItem, nSecondItem; - lcl_SetCellProperty( *pEntry, aValue, aPattern, pDoc, 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 ) @@ -2287,13 +2284,13 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE /* TODO: Iterate through the range */ ScAddress aAddr = aRange.aStart; - ScDocument *pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScRefCellValue aCell; - aCell.assign(*pDoc, aAddr); + aCell.assign(rDoc, aAddr); - OUString aStr = aCell.getString(pDoc); - EditEngine aEngine( pDoc->GetEnginePool() ); - aEngine.SetEditTextObjectPool(pDoc->GetEditPool()); + 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. @@ -2310,7 +2307,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE aEngine.QuickSetAttribs(aAttr, ESelection(0, 0, 0, aStr.getLength())); // The cell will own the text object instance. - pDoc->SetEditText(aRanges[0]->aStart, aEngine.CreateTextObject()); + rDoc.SetEditText(aRanges[0]->aStart, aEngine.CreateTextObject()); } } } @@ -2368,15 +2365,15 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE ScTableConditionalFormat::getImplementation( xInterface ); if (pFormat) { - ScDocument* pDoc = pDocShell->GetDocument(); + 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)); - ScConditionalFormat* pNew = new ScConditionalFormat( 0, pDoc ); // Index wird beim Einfuegen gesetzt - pFormat->FillFormat( *pNew, pDoc, eGrammar ); + ScConditionalFormat* pNew = new ScConditionalFormat( 0, &rDoc ); // Index wird beim Einfuegen gesetzt + pFormat->FillFormat( *pNew, &rDoc, eGrammar ); pNew->AddRange( aRanges ); SCTAB nTab = aRanges.front()->aStart.Tab(); pDocShell->GetDocFunc().ReplaceConditionalFormat( 0, pNew, nTab, aRanges ); @@ -2395,7 +2392,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE ScTableValidationObj::getImplementation( xInterface ); if (pValidObj) { - ScDocument* pDoc = pDocShell->GetDocument(); + 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 ? @@ -2403,11 +2400,11 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML)); boost::scoped_ptr<ScValidationData> pNewData( - pValidObj->CreateValidationData( pDoc, eGrammar )); - sal_uLong nIndex = pDoc->AddValidationEntry( *pNewData ); + pValidObj->CreateValidationData( &rDoc, eGrammar )); + sal_uLong nIndex = rDoc.AddValidationEntry( *pNewData ); pNewData.reset(); - ScPatternAttr aPattern( pDoc->GetPool() ); + ScPatternAttr aPattern( rDoc.GetPool() ); aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nIndex ) ); pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, true, true ); } @@ -2452,13 +2449,13 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE { case ATTR_VALUE_FORMAT: { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); sal_uLong nOldFormat = ((const SfxUInt32Item&) pDataSet->Get( ATTR_VALUE_FORMAT )).GetValue(); LanguageType eOldLang = ((const SvxLanguageItem&) pDataSet->Get( ATTR_LANGUAGE_FORMAT )).GetLanguage(); - nOldFormat = pDoc->GetFormatTable()-> + nOldFormat = rDoc.GetFormatTable()-> GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang ); rAny <<= (sal_Int32)( nOldFormat ); } @@ -2491,7 +2488,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE case SC_WID_UNO_CELLSTYL: { OUString aStyleName; - const ScStyleSheet* pStyle = pDocShell->GetDocument()->GetSelectionStyle(*GetMarkData()); + const ScStyleSheet* pStyle = pDocShell->GetDocument().GetSelectionStyle(*GetMarkData()); if (pStyle) aStyleName = pStyle->GetName(); rAny <<= OUString( ScStyleNameConversion::DisplayToProgrammaticName( @@ -2508,11 +2505,11 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE SvxBoxItem aOuter(ATTR_BORDER); SvxBoxInfoItem aInner(ATTR_BORDER_INNER); - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScMarkData aMark; aMark.SetMarkArea( *pFirst ); aMark.SelectTable( pFirst->aStart.Tab(), true ); - pDoc->GetSelectionFrame( aMark, aOuter, aInner ); + rDoc.GetSelectionFrame( aMark, aOuter, aInner ); if (pEntry->nWID == SC_WID_UNO_TBLBORD2) ScHelperFunctions::AssignTableBorder2ToAny( rAny, aOuter, aInner); @@ -2528,11 +2525,11 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE const ScPatternAttr* pPattern = GetCurrentAttrsDeep(); if ( pPattern ) { - ScDocument* pDoc = pDocShell->GetDocument(); + 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 ? - pDoc->GetStorageGrammar() : + rDoc.GetStorageGrammar() : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML)); const std::vector<sal_uInt32>& rIndex = ((const ScCondFormatItem&) pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData(); @@ -2540,7 +2537,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE if(!rIndex.empty()) nIndex = rIndex[0]; rAny <<= uno::Reference<sheet::XSheetConditionalEntries>( - new ScTableConditionalFormat( pDoc, nIndex, aRanges.front()->aStart.Tab(), eGrammar )); + new ScTableConditionalFormat( &rDoc, nIndex, aRanges.front()->aStart.Tab(), eGrammar )); } } break; @@ -2551,16 +2548,16 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE const ScPatternAttr* pPattern = GetCurrentAttrsDeep(); if ( pPattern ) { - ScDocument* pDoc = pDocShell->GetDocument(); + 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 ? - pDoc->GetStorageGrammar() : + rDoc.GetStorageGrammar() : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML)); sal_uLong nIndex = ((const SfxUInt32Item&) pPattern->GetItem(ATTR_VALIDDATA)).GetValue(); rAny <<= uno::Reference<beans::XPropertySet>( - new ScTableValidationObj( pDoc, nIndex, eGrammar )); + new ScTableValidationObj( &rDoc, nIndex, eGrammar )); } } break; @@ -2573,7 +2570,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE case SC_WID_UNO_ABSNAME: { OUString sRet; - aRanges.Format(sRet, SCR_ABS_3D, pDocShell->GetDocument()); + aRanges.Format(sRet, SCR_ABS_3D, &pDocShell->GetDocument()); rAny <<= sRet; } } @@ -2668,7 +2665,7 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< OUString } } - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); boost::scoped_ptr<ScPatternAttr> pOldPattern; boost::scoped_ptr<ScPatternAttr> pNewPattern; @@ -2685,13 +2682,13 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< OUString { pOldPattern.reset(new ScPatternAttr( *GetCurrentAttrsDeep() )); pOldPattern->GetItemSet().ClearInvalidItems(); - pNewPattern.reset(new ScPatternAttr( pDoc->GetPool() )); + pNewPattern.reset(new ScPatternAttr( rDoc.GetPool() )); } // collect items in pNewPattern, apply with one call after the loop sal_uInt16 nFirstItem, nSecondItem; - lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem ); + lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, rDoc, nFirstItem, nSecondItem ); // put only affected items into new set if ( nFirstItem ) @@ -2811,7 +2808,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set } } - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); boost::scoped_ptr<ScPatternAttr> pOldPattern; boost::scoped_ptr<ScPatternAttr> pNewPattern; @@ -2829,7 +2826,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set { pOldPattern.reset(new ScPatternAttr( *GetCurrentAttrsDeep() )); pOldPattern->GetItemSet().ClearInvalidItems(); - pNewPattern.reset(new ScPatternAttr( pDoc->GetPool() )); + pNewPattern.reset(new ScPatternAttr( rDoc.GetPool() )); } // collect items in pNewPattern, apply with one call after the loop @@ -2837,7 +2834,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set sal_uInt16 nFirstItem, nSecondItem; try { - lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem ); + lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, rDoc, nFirstItem, nSecondItem ); // put only affected items into new set if ( nFirstItem ) @@ -3000,7 +2997,7 @@ ScMemChart* ScCellRangesBase::CreateMemChart_Impl() const SCCOL nStartX; SCROW nStartY; // Anfang holen - if (!pDocShell->GetDocument()->GetDataStart( nTab, nStartX, nStartY )) + if (!pDocShell->GetDocument().GetDataStart( nTab, nStartX, nStartY )) { nStartX = 0; nStartY = 0; @@ -3008,7 +3005,7 @@ ScMemChart* ScCellRangesBase::CreateMemChart_Impl() const SCCOL nEndX; SCROW nEndY; // Ende holen - if (!pDocShell->GetDocument()->GetTableArea( nTab, nEndX, nEndY )) + if (!pDocShell->GetDocument().GetTableArea( nTab, nEndX, nEndY )) { nEndX = 0; nEndY = 0; @@ -3020,7 +3017,7 @@ ScMemChart* ScCellRangesBase::CreateMemChart_Impl() const } if (!xChartRanges.Is()) // sonst Ranges direkt uebernehmen xChartRanges = new ScRangeList(aRanges); - ScChartArray aArr( pDocShell->GetDocument(), xChartRanges, OUString() ); + ScChartArray aArr( &pDocShell->GetDocument(), xChartRanges, OUString() ); // RowAsHdr = ColHeaders und umgekehrt aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); @@ -3101,8 +3098,8 @@ void SAL_CALL ScCellRangesBase::setData( const uno::Sequence< uno::Sequence<doub ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, nRowCount ); if ( pDocShell && xChartRanges.Is() ) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScChartArray aArr( pDoc, xChartRanges, OUString() ); + ScDocument& rDoc = pDocShell->GetDocument(); + ScChartArray aArr( &rDoc, xChartRanges, OUString() ); aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders const ScChartPositionMap* pPosMap = aArr.GetPositionMap(); if (pPosMap) @@ -3124,9 +3121,9 @@ void SAL_CALL ScCellRangesBase::setData( const uno::Sequence< uno::Sequence<doub { double fVal = pArray[nCol]; if ( fVal == DBL_MIN ) - pDoc->SetEmptyCell(*pPos); + rDoc.SetEmptyCell(*pPos); else - pDoc->SetValue(*pPos, pArray[nCol]); + rDoc.SetValue(*pPos, pArray[nCol]); } } } @@ -3174,8 +3171,8 @@ void SAL_CALL ScCellRangesBase::setRowDescriptions( ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( 1, nRowCount ); if ( pDocShell && xChartRanges.Is() ) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScChartArray aArr( pDoc, xChartRanges, OUString() ); + ScDocument& rDoc = pDocShell->GetDocument(); + ScChartArray aArr( &rDoc, xChartRanges, OUString() ); aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders const ScChartPositionMap* pPosMap = aArr.GetPositionMap(); if (pPosMap) @@ -3191,12 +3188,12 @@ void SAL_CALL ScCellRangesBase::setRowDescriptions( { const OUString& aStr = pArray[nRow]; if (aStr.isEmpty()) - pDoc->SetEmptyCell(*pPos); + rDoc.SetEmptyCell(*pPos); else { ScSetStringParam aParam; aParam.setTextInput(); - pDoc->SetString(*pPos, aStr, &aParam); + rDoc.SetString(*pPos, aStr, &aParam); } } } @@ -3245,8 +3242,8 @@ void SAL_CALL ScCellRangesBase::setColumnDescriptions( ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, 1 ); if ( pDocShell && xChartRanges.Is() ) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScChartArray aArr( pDoc, xChartRanges, OUString() ); + ScDocument& rDoc = pDocShell->GetDocument(); + ScChartArray aArr( &rDoc, xChartRanges, OUString() ); aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders const ScChartPositionMap* pPosMap = aArr.GetPositionMap(); if (pPosMap) @@ -3262,12 +3259,12 @@ void SAL_CALL ScCellRangesBase::setColumnDescriptions( { const OUString& aStr = pArray[nCol]; if (aStr.isEmpty()) - pDoc->SetEmptyCell(*pPos); + rDoc.SetEmptyCell(*pPos); else { ScSetStringParam aParam; aParam.setTextInput(); - pDoc->SetString(*pPos, aStr, &aParam); + rDoc.SetString(*pPos, aStr, &aParam); } } } @@ -3294,7 +3291,7 @@ void ScCellRangesBase::ForceChartListener_Impl() if (!pDocShell) return; - ScChartListenerCollection* pColl = pDocShell->GetDocument()->GetChartListenerCollection(); + ScChartListenerCollection* pColl = pDocShell->GetDocument().GetChartListenerCollection(); if (!pColl) return; @@ -3318,15 +3315,15 @@ void SAL_CALL ScCellRangesBase::addChartDataChangeEventListener( const uno::Refe { //! auf doppelte testen? - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScRangeListRef aRangesRef( new ScRangeList(aRanges) ); - ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection(); + ScChartListenerCollection* pColl = rDoc.GetChartListenerCollection(); OUString aName = pColl->getUniqueName(OUString("__Uno")); if (aName.isEmpty()) // failed to create unique name. return; - ScChartListener* pListener = new ScChartListener( aName, pDoc, aRangesRef ); + ScChartListener* pListener = new ScChartListener( aName, &rDoc, aRangesRef ); pListener->SetUno( aListener, this ); pColl->insert( pListener ); pListener->StartListeningTo(); @@ -3340,8 +3337,8 @@ void SAL_CALL ScCellRangesBase::removeChartDataChangeEventListener( const uno::R SolarMutexGuard aGuard; if ( pDocShell && !aRanges.empty() ) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScChartListenerCollection* pColl = rDoc.GetChartListenerCollection(); pColl->FreeUno( aListener, this ); } } @@ -3376,9 +3373,9 @@ void SAL_CALL ScCellRangesBase::addModifyListener(const uno::Reference<util::XMo if (!pValueListener) pValueListener = new ScLinkListener( LINK( this, ScCellRangesBase, ValueListenerHdl ) ); - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); for ( size_t i = 0, nCount = aRanges.size(); i < nCount; i++) - pDoc->StartListeningArea( *aRanges[ i ], pValueListener ); + rDoc.StartListeningArea( *aRanges[ i ], pValueListener ); acquire(); // don't lose this object (one ref for all listeners) } @@ -3430,11 +3427,11 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryVisibleC ScMarkData aMarkData(*GetMarkData()); - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); SCCOL nCol = 0, nLastCol; while (nCol <= MAXCOL) { - if (pDoc->ColHidden(nCol, nTab, NULL, &nLastCol)) + if (rDoc.ColHidden(nCol, nTab, NULL, &nLastCol)) // hidden columns. Unselect them. aMarkData.SetMultiMarkArea(ScRange(nCol, 0, nTab, nLastCol, MAXROW, nTab), false); @@ -3444,7 +3441,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryVisibleC SCROW nRow = 0, nLastRow; while (nRow <= MAXROW) { - if (pDoc->RowHidden(nRow, nTab, NULL, &nLastRow)) + if (rDoc.RowHidden(nRow, nTab, NULL, &nLastRow)) // These rows are hidden. Unselect them. aMarkData.SetMultiMarkArea(ScRange(0, nRow, nTab, MAXCOL, nLastRow, nTab), false); @@ -3465,7 +3462,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryEmptyCel SolarMutexGuard aGuard; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScMarkData aMarkData(*GetMarkData()); @@ -3474,7 +3471,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryEmptyCel { ScRange aRange = *aRanges[ i ]; - ScCellIterator aIter( pDoc, aRange ); + ScCellIterator aIter( &rDoc, aRange ); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { // Notizen zaehlen als nicht-leer @@ -3501,7 +3498,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC SolarMutexGuard aGuard; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScMarkData aMarkData; @@ -3510,7 +3507,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC { ScRange aRange = *aRanges[ i ]; - ScCellIterator aIter( pDoc, aRange ); + ScCellIterator aIter( &rDoc, aRange ); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { bool bAdd = false; @@ -3536,9 +3533,9 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC { // Date/Time Erkennung - sal_uLong nIndex = (sal_uLong)((SfxUInt32Item*)pDoc->GetAttr( + sal_uLong nIndex = (sal_uLong)((SfxUInt32Item*)rDoc.GetAttr( aIter.GetPos(), ATTR_VALUE_FORMAT))->GetValue(); - short nTyp = pDoc->GetFormatTable()->GetType(nIndex); + short nTyp = rDoc.GetFormatTable()->GetType(nIndex); if ((nTyp == NUMBERFORMAT_DATE) || (nTyp == NUMBERFORMAT_TIME) || (nTyp == NUMBERFORMAT_DATETIME)) { @@ -3581,7 +3578,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryFormulaC SolarMutexGuard aGuard; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScMarkData aMarkData; @@ -3590,7 +3587,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryFormulaC { ScRange aRange = *aRanges[ i ]; - ScCellIterator aIter( pDoc, aRange ); + ScCellIterator aIter( &rDoc, aRange ); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { if (aIter.getType() == CELLTYPE_FORMULA) @@ -3636,7 +3633,7 @@ uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl( { size_t nRangeCount = aRanges.size(); size_t i; - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScMarkData aMarkData; SCCOLROW nCmpPos = bColumnDiff ? (SCCOLROW)aCompare.Row : (SCCOLROW)aCompare.Column; @@ -3650,7 +3647,7 @@ uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl( aCmpRange = ScRange( 0,nCmpPos,nTab, MAXCOL,nCmpPos,nTab ); else aCmpRange = ScRange( static_cast<SCCOL>(nCmpPos),0,nTab, static_cast<SCCOL>(nCmpPos),MAXROW,nTab ); - ScCellIterator aCmpIter( pDoc, aCmpRange ); + ScCellIterator aCmpIter( &rDoc, aCmpRange ); for (bool bHasCell = aCmpIter.first(); bHasCell; bHasCell = aCmpIter.next()) { SCCOLROW nCellPos = bColumnDiff ? static_cast<SCCOLROW>(aCmpIter.GetPos().Col()) : static_cast<SCCOLROW>(aCmpIter.GetPos().Row()); @@ -3688,7 +3685,7 @@ uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl( { ScRange aRange( *aRanges[ i ] ); - ScCellIterator aIter( pDoc, aRange ); + ScCellIterator aIter( &rDoc, aRange ); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { if (bColumnDiff) @@ -3758,7 +3755,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryPreceden SolarMutexGuard aGuard; if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScRangeList aNewRanges(aRanges); bool bFound; @@ -3774,7 +3771,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryPreceden for (size_t nR = 0, nCount = aNewRanges.size(); nR<nCount; ++nR) { ScRange aRange( *aNewRanges[ nR] ); - ScCellIterator aIter( pDoc, aRange ); + ScCellIterator aIter( &rDoc, aRange ); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) @@ -3807,7 +3804,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependen SolarMutexGuard aGuard; if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScRangeList aNewRanges(aRanges); bool bFound; @@ -3822,7 +3819,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependen SCTAB nTab = lcl_FirstTab(aNewRanges); //! alle Tabellen - ScCellIterator aCellIter( pDoc, ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab) ); + ScCellIterator aCellIter( &rDoc, ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab) ); for (bool bHasCell = aCellIter.first(); bHasCell; bHasCell = aCellIter.next()) { if (aCellIter.getType() != CELLTYPE_FORMULA) @@ -3885,7 +3882,7 @@ uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll( SvxSearchItem* pSearchItem = pSearch->GetSearchItem(); if (pSearchItem) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL ); // immer nur innerhalb dieses Objekts pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) ); @@ -3897,7 +3894,7 @@ uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll( SCCOL nCol = 0; SCROW nRow = 0; SCTAB nTab = 0; - bool bFound = pDoc->SearchAndReplace( + bool bFound = rDoc.SearchAndReplace( *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aDummyUndo, NULL); if (bFound) { @@ -3923,7 +3920,7 @@ uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl( SvxSearchItem* pSearchItem = pSearch->GetSearchItem(); if (pSearchItem) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); pSearchItem->SetCommand( SVX_SEARCHCMD_FIND ); // immer nur innerhalb dieses Objekts pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) ); @@ -3943,7 +3940,7 @@ uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl( OUString aDummyUndo; ScRangeList aMatchedRanges; - bool bFound = pDoc->SearchAndReplace( + bool bFound = rDoc.SearchAndReplace( *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aDummyUndo, NULL); if (bFound) { @@ -4009,19 +4006,19 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea SvxSearchItem* pSearchItem = pSearch->GetSearchItem(); if (pSearchItem) { - ScDocument* pDoc = pDocShell->GetDocument(); - bool bUndo(pDoc->IsUndoEnabled()); + ScDocument& rDoc = pDocShell->GetDocument(); + bool bUndo(rDoc.IsUndoEnabled()); pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL ); // immer nur innerhalb dieses Objekts pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) ); ScMarkData aMark(*GetMarkData()); - SCTAB nTabCount = pDoc->GetTableCount(); + SCTAB nTabCount = rDoc.GetTableCount(); bool bProtected = !pDocShell->IsEditable(); ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end(); for (; itr != itrEnd && *itr < nTabCount; ++itr) - if ( pDoc->IsTabProtected(*itr) ) + if ( rDoc.IsTabProtected(*itr) ) bProtected = true; if (bProtected) { @@ -4038,7 +4035,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea if (bUndo) { pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nTab, nTab ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab ); } itr = aMark.begin(); for (; itr != itrEnd && *itr < nTabCount; ++itr) @@ -4052,7 +4049,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea if (bUndo) { ScRangeList aMatchedRanges; - bFound = pDoc->SearchAndReplace( + bFound = rDoc.SearchAndReplace( *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aUndoStr, pUndoDoc ); } if (bFound) @@ -4253,7 +4250,7 @@ OUString SAL_CALL ScCellRangesObj::getRangeAddressesAsString() ScDocShell* pDocSh = GetDocShell(); const ScRangeList& rRanges = GetRangeList(); if (pDocSh) - rRanges.Format( aString, SCA_VALID | SCA_TAB_3D, pDocSh->GetDocument() ); + rRanges.Format( aString, SCA_VALID | SCA_TAB_3D, &pDocSh->GetDocument() ); return aString; } @@ -4440,10 +4437,10 @@ static bool lcl_FindRangeByName( const ScRangeList& rRanges, ScDocShell* pDocSh, if (pDocSh) { OUString aRangeStr; - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ ) { - aRangeStr = rRanges[ i ]->Format(SCA_VALID | SCA_TAB_3D, pDoc); + aRangeStr = rRanges[ i ]->Format(SCA_VALID | SCA_TAB_3D, &rDoc); if ( aRangeStr == rName ) { rIndex = i; @@ -4470,7 +4467,7 @@ static bool lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl& rNamedEntries, // range contained in selection? (sheet must be specified) ScRange aCellRange; - sal_uInt16 nParse = aCellRange.ParseAny( rName, pDocSh->GetDocument() ); + sal_uInt16 nParse = aCellRange.ParseAny( rName, &pDocSh->GetDocument() ); if ( ( nParse & ( SCA_VALID | SCA_TAB_3D ) ) == ( SCA_VALID | SCA_TAB_3D ) ) { ScMarkData aMarkData; @@ -4531,7 +4528,7 @@ void SAL_CALL ScCellRangesObj::removeByName( const OUString& aName ) { // deselect any ranges (parsed or named entry) ScRangeList aDiff; - bool bValid = ( aDiff.Parse( aNameStr, pDocSh->GetDocument() ) & SCA_VALID ) != 0; + bool bValid = ( aDiff.Parse( aNameStr, &pDocSh->GetDocument() ) & SCA_VALID ) != 0; if (!bValid && !m_pImpl->m_aNamedEntries.empty()) { sal_uInt16 nCount = m_pImpl->m_aNamedEntries.size(); @@ -4633,7 +4630,7 @@ uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getElementNames() if (pDocSh) { OUString aRangeStr; - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); size_t nCount = rRanges.size(); uno::Sequence<OUString> aSeq(nCount); @@ -4645,7 +4642,7 @@ uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getElementNames() if (m_pImpl->m_aNamedEntries.empty() || !lcl_FindEntryName(m_pImpl->m_aNamedEntries, aRange, aRangeStr)) { - aRangeStr = aRange.Format(SCA_VALID | SCA_TAB_3D, pDoc); + aRangeStr = aRange.Format(SCA_VALID | SCA_TAB_3D, &rDoc); } pAry[i] = aRangeStr; } @@ -4926,13 +4923,13 @@ uno::Reference<table::XCellRange> ScCellRangeObj::getCellRangeByName( ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = aRange.aStart.Tab(); ScRange aCellRange; bool bFound = false; OUString aString(aName); - sal_uInt16 nParse = aCellRange.ParseAny( aString, pDoc, rDetails ); + sal_uInt16 nParse = aCellRange.ParseAny( aString, &rDoc, rDetails ); if ( nParse & SCA_VALID ) { if ( !(nParse & SCA_TAB_3D) ) // keine Tabelle angegeben -> auf dieser Tabelle @@ -4945,8 +4942,8 @@ uno::Reference<table::XCellRange> ScCellRangeObj::getCellRangeByName( else { ScRangeUtil aRangeUtil; - if ( aRangeUtil.MakeRangeFromName( aString, pDoc, nTab, aCellRange, RUTL_NAMES ) || - aRangeUtil.MakeRangeFromName( aString, pDoc, nTab, aCellRange, RUTL_DBASE ) ) + if ( aRangeUtil.MakeRangeFromName( aString, &rDoc, nTab, aCellRange, RUTL_NAMES ) || + aRangeUtil.MakeRangeFromName( aString, &rDoc, nTab, aCellRange, RUTL_DBASE ) ) bFound = true; } @@ -5034,11 +5031,11 @@ OUString SAL_CALL ScCellRangeObj::getArrayFormula() throw(uno::RuntimeException, OUString aFormula; - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); ScRefCellValue aCell1; ScRefCellValue aCell2; - aCell1.assign(*pDoc, aRange.aStart); - aCell2.assign(*pDoc, aRange.aEnd); + aCell1.assign(rDoc, aRange.aStart); + aCell2.assign(rDoc, aRange.aEnd); if (aCell1.meType == CELLTYPE_FORMULA && aCell2.meType == CELLTYPE_FORMULA) { const ScFormulaCell* pFCell1 = aCell1.mpFormula; @@ -5112,11 +5109,11 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens() if (!pDocSh) return aSequence; - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); ScRefCellValue aCell1; ScRefCellValue aCell2; - aCell1.assign(*pDoc, aRange.aStart); - aCell2.assign(*pDoc, aRange.aEnd); + aCell1.assign(rDoc, aRange.aStart); + aCell2.assign(rDoc, aRange.aEnd); if (aCell1.meType == CELLTYPE_FORMULA && aCell2.meType == CELLTYPE_FORMULA) { const ScFormulaCell* pFCell1 = aCell1.mpFormula; @@ -5129,7 +5126,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens() { const ScTokenArray* pTokenArray = pFCell1->GetCode(); if (pTokenArray) - (void)ScTokenConversion::ConvertToTokenSequence(*pDoc, aSequence, *pTokenArray); + (void)ScTokenConversion::ConvertToTokenSequence(rDoc, aSequence, *pTokenArray); } } } @@ -5150,9 +5147,9 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula throw uno::RuntimeException(); } - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); ScTokenArray aTokenArray; - (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens ); + (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens ); // Actually GRAM_PODF_A1 is a don't-care here because of the token // array being set, it fits with other API compatibility grammars @@ -5188,7 +5185,7 @@ uno::Sequence< uno::Sequence<uno::Any> > SAL_CALL ScCellRangeObj::getDataArray() { uno::Any aAny; // bAllowNV = TRUE: errors as void - if ( ScRangeToSequence::FillMixedArray( aAny, pDocSh->GetDocument(), aRange, true ) ) + if ( ScRangeToSequence::FillMixedArray( aAny, &pDocSh->GetDocument(), aRange, true ) ) { uno::Sequence< uno::Sequence<uno::Any> > aSeq; if ( aAny >>= aSeq ) @@ -5270,7 +5267,7 @@ void SAL_CALL ScCellRangeObj::setFormulaArray( ScDocShell* pDocSh = GetDocShell(); if (pDocSh) { - ScExternalRefManager::ApiGuard aExtRefGuard(pDocSh->GetDocument()); + ScExternalRefManager::ApiGuard aExtRefGuard(&pDocSh->GetDocument()); // GRAM_PODF_A1 for API compatibility. bDone = lcl_PutFormulaArray( *pDocSh, aRange, aArray, formula::FormulaGrammar::GRAM_PODF_A1 ); @@ -5352,7 +5349,7 @@ sal_Bool SAL_CALL ScCellRangeObj::getIsMerged() throw(uno::RuntimeException, std { SolarMutexGuard aGuard; ScDocShell* pDocSh = GetDocShell(); - return pDocSh && pDocSh->GetDocument()->HasAttrib( aRange, HASATTR_MERGED ); + return pDocSh && pDocSh->GetDocument().HasAttrib( aRange, HASATTR_MERGED ); } // XCellSeries @@ -5651,7 +5648,7 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe static_cast<SCCOLROW>(aRange.aStart.Col()) : static_cast<SCCOLROW>(aRange.aStart.Row()); SCSIZE nCount = aParam.GetEntryCount(); - svl::SharedStringPool& rPool = pDocSh->GetDocument()->GetSharedStringPool(); + svl::SharedStringPool& rPool = pDocSh->GetDocument().GetSharedStringPool(); for (SCSIZE i=0; i<nCount; i++) { ScQueryEntry& rEntry = aParam.GetEntry(i); @@ -5665,7 +5662,7 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe if (rItem.meType != ScQueryEntry::ByString) { OUString aStr; - pDocSh->GetDocument()->GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr); + pDocSh->GetDocument().GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr); rItem.maString = rPool.intern(aStr); } } @@ -5719,8 +5716,8 @@ uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFil aParam.nRow2 = (SCROW)aDataAddress.EndRow; aParam.nTab = aDataAddress.Sheet; - ScDocument* pDoc = pDocSh->GetDocument(); - bool bOk = pDoc->CreateQueryParam( + ScDocument& rDoc = pDocSh->GetDocument(); + bool bOk = rDoc.CreateQueryParam( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab(), aParam ); @@ -5960,7 +5957,7 @@ void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEnt if (pDocSh) { // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer - Rectangle aMMRect(pDocSh->GetDocument()->GetMMRect( + 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() ); @@ -5973,7 +5970,7 @@ void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEnt if (pDocSh) { // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer - Rectangle aMMRect = pDocSh->GetDocument()->GetMMRect( + Rectangle aMMRect = pDocSh->GetDocument().GetMMRect( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() ); Size aSize(aMMRect.GetSize()); @@ -6145,11 +6142,11 @@ OUString ScCellObj::GetOutputString_Impl() const OUString aVal; if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); ScRefCellValue aCell; - aCell.assign(*pDoc, aCellPos); + aCell.assign(rDoc, aCellPos); - aVal = ScCellFormat::GetOutputString(*pDoc, aCellPos, aCell); + aVal = ScCellFormat::GetOutputString(rDoc, aCellPos, aCell); } return aVal; } @@ -6169,7 +6166,7 @@ double ScCellObj::GetValue_Impl() const { ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) - return pDocSh->GetDocument()->GetValue( aCellPos ); + return pDocSh->GetDocument().GetValue( aCellPos ); return 0.0; } @@ -6194,9 +6191,9 @@ void ScCellObj::InputEnglishString( const OUString& rText ) return; OUString aString(rText); - ScDocument* pDoc = pDocSh->GetDocument(); - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); - sal_uInt32 nOldFormat = pDoc->GetNumberFormat( aCellPos ); + ScDocument& rDoc = pDocSh->GetDocument(); + SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); + sal_uInt32 nOldFormat = rDoc.GetNumberFormat( aCellPos ); if (pFormatter->GetType(nOldFormat) == NUMBERFORMAT_TEXT) { SetString_Impl(aString, false, false); // text cell @@ -6216,7 +6213,7 @@ void ScCellObj::InputEnglishString( const OUString& rText ) sal_uInt32 nNewFormat = ScGlobal::GetStandardFormat(*pFormatter, nOldFormat, aRes.mnFormatType); if (nNewFormat != nOldFormat) { - ScPatternAttr aPattern( pDoc->GetPool() ); + ScPatternAttr aPattern( rDoc.GetPool() ); aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) ); // ATTR_LANGUAGE_FORMAT remains unchanged rFunc.ApplyAttributes( *GetMarkData(), aPattern, true, true ); @@ -6228,7 +6225,7 @@ void ScCellObj::InputEnglishString( const OUString& rText ) case ScInputStringType::Formula: rFunc.SetFormulaCell( aCellPos, - new ScFormulaCell(pDoc, aCellPos, aRes.maText, formula::FormulaGrammar::GRAM_PODF_A1), + new ScFormulaCell(&rDoc, aCellPos, aRes.maText, formula::FormulaGrammar::GRAM_PODF_A1), false); break; case ScInputStringType::Number: @@ -6451,7 +6448,7 @@ void SAL_CALL ScCellObj::setFormulaString( const OUString& aFormula) throw(uno:: ScDocShell *pDocSh = GetDocShell(); if( pDocSh ) { - ScFormulaCell* pCell = new ScFormulaCell( pDocSh->GetDocument(), aCellPos ); + ScFormulaCell* pCell = new ScFormulaCell( &pDocSh->GetDocument(), aCellPos ); pCell->SetHybridFormula( aFormula, formula::FormulaGrammar::GRAM_NATIVE ); pDocSh->GetDocFunc().SetFormulaCell(aCellPos, pCell, false); } @@ -6460,9 +6457,9 @@ void SAL_CALL ScCellObj::setFormulaResult( double nValue ) throw(uno::RuntimeExc { SolarMutexGuard aGuard; ScDocShell* pDocSh = GetDocShell(); - if ( pDocSh && pDocSh->GetDocument()->GetCellType( aCellPos ) == CELLTYPE_FORMULA ) + if ( pDocSh && pDocSh->GetDocument().GetCellType( aCellPos ) == CELLTYPE_FORMULA ) { - ScFormulaCell* pCell = pDocSh->GetDocument()->GetFormulaCell(aCellPos); + ScFormulaCell* pCell = pDocSh->GetDocument().GetFormulaCell(aCellPos); if (!pCell) return; pCell->SetHybridDouble( nValue ); @@ -6478,7 +6475,7 @@ table::CellContentType SAL_CALL ScCellObj::getType() throw(uno::RuntimeException ScDocShell* pDocSh = GetDocShell(); if (pDocSh) { - CellType eCalcType = pDocSh->GetDocument()->GetCellType( aCellPos ); + CellType eCalcType = pDocSh->GetDocument().GetCellType( aCellPos ); switch (eCalcType) { case CELLTYPE_VALUE: @@ -6509,7 +6506,7 @@ table::CellContentType ScCellObj::GetResultType_Impl() if ( pDocSh ) { ScRefCellValue aCell; - aCell.assign(*pDocSh->GetDocument(), aCellPos); + aCell.assign(pDocSh->GetDocument(), aCellPos); if (aCell.meType == CELLTYPE_FORMULA) { bool bValue = aCell.mpFormula->IsValue(); @@ -6531,7 +6528,7 @@ sal_Int32 SAL_CALL ScCellObj::getError() throw(uno::RuntimeException, std::excep sal_uInt16 nError = 0; ScRefCellValue aCell; - aCell.assign(*pDocSh->GetDocument(), aCellPos); + aCell.assign(pDocSh->GetDocument(), aCellPos); if (aCell.meType == CELLTYPE_FORMULA) nError = aCell.mpFormula->GetErrCode(); @@ -6549,14 +6546,14 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellObj::getTokens() if (!pDocSh) return aSequence; - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); ScRefCellValue aCell; - aCell.assign(*pDoc, aCellPos); + aCell.assign(rDoc, aCellPos); if (aCell.meType == CELLTYPE_FORMULA) { ScTokenArray* pTokenArray = aCell.mpFormula->GetCode(); if (pTokenArray) - ScTokenConversion::ConvertToTokenSequence(*pDoc, aSequence, *pTokenArray); + ScTokenConversion::ConvertToTokenSequence(rDoc, aSequence, *pTokenArray); } return aSequence; } @@ -6567,11 +6564,11 @@ void SAL_CALL ScCellObj::setTokens( const uno::Sequence<sheet::FormulaToken>& rT ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); ScTokenArray aTokenArray; - (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens ); + (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens ); - ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, aCellPos, aTokenArray); + ScFormulaCell* pNewCell = new ScFormulaCell(&rDoc, aCellPos, aTokenArray); (void)pDocSh->GetDocFunc().SetFormulaCell(aCellPos, pNewCell, false); } } @@ -7022,12 +7019,12 @@ uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPage ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - Size aSize(pDoc->GetPageSize( nTab )); + Size aSize(rDoc.GetPageSize( nTab )); if (aSize.Width() && aSize.Height()) // effektive Groesse schon gesetzt? - pDoc->UpdatePageBreaks( nTab ); + rDoc.UpdatePageBreaks( nTab ); else { // Umbrueche updaten wie in ScDocShell::PageStyleModified: @@ -7038,7 +7035,7 @@ uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPage SCCOL nCount = 0; SCCOL nCol; for (nCol=0; nCol<=MAXCOL; nCol++) - if (pDoc->HasColBreak(nCol, nTab)) + if (rDoc.HasColBreak(nCol, nTab)) ++nCount; sheet::TablePageBreakData aData; @@ -7047,7 +7044,7 @@ uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPage sal_uInt16 nPos = 0; for (nCol=0; nCol<=MAXCOL; nCol++) { - ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab); + ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab); if (nBreak) { aData.Position = nCol; @@ -7068,19 +7065,19 @@ uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getRowPageBre ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - Size aSize(pDoc->GetPageSize( nTab )); + Size aSize(rDoc.GetPageSize( nTab )); if (aSize.Width() && aSize.Height()) // effektive Groesse schon gesetzt? - pDoc->UpdatePageBreaks( nTab ); + rDoc.UpdatePageBreaks( nTab ); else { // Umbrueche updaten wie in ScDocShell::PageStyleModified: ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab ); aPrintFunc.UpdatePages(); } - return pDoc->GetRowBreakData(nTab); + return rDoc.GetRowBreakData(nTab); } return uno::Sequence<sheet::TablePageBreakData>(0); } @@ -7093,21 +7090,21 @@ void SAL_CALL ScTableSheetObj::removeAllManualPageBreaks() throw(uno::RuntimeExc { //! docfunc Funktion, auch fuer ScViewFunc::RemoveManualBreaks - ScDocument* pDoc = pDocSh->GetDocument(); - bool bUndo (pDoc->IsUndoEnabled()); + ScDocument& rDoc = pDocSh->GetDocument(); + bool bUndo (rDoc.IsUndoEnabled()); SCTAB nTab = GetTab_Impl(); if (bUndo) { ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true ); - pDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, pUndoDoc ); + pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); + rDoc.CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, pUndoDoc ); pDocSh->GetUndoManager()->AddUndoAction( new ScUndoRemoveBreaks( pDocSh, nTab, pUndoDoc ) ); } - pDoc->RemoveManualBreaks(nTab); - pDoc->UpdatePageBreaks(nTab); + rDoc.RemoveManualBreaks(nTab); + rDoc.UpdatePageBreaks(nTab); //? UpdatePageBreakData( sal_True ); pDocSh->SetDocumentModified(); @@ -7123,7 +7120,7 @@ OUString SAL_CALL ScTableSheetObj::getName() throw(uno::RuntimeException, std::e OUString aName; ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) - pDocSh->GetDocument()->GetName( GetTab_Impl(), aName ); + pDocSh->GetDocument().GetName( GetTab_Impl(), aName ); return aName; } @@ -7265,11 +7262,11 @@ void ScTableSheetObj::PrintAreaUndo_Impl( ScPrintRangeSaver* pOldRanges ) { // Umbrueche und Undo ScDocShell* pDocSh = GetDocShell(); - ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : 0; - if(pDocSh && pDoc) + if(pDocSh) { - const bool bUndo(pDoc->IsUndoEnabled()); + ScDocument& rDoc = pDocSh->GetDocument(); + const bool bUndo(rDoc.IsUndoEnabled()); const SCTAB nTab(GetTab_Impl()); if(bUndo) @@ -7279,7 +7276,7 @@ void ScTableSheetObj::PrintAreaUndo_Impl( ScPrintRangeSaver* pOldRanges ) pDocSh, nTab, pOldRanges, - pDoc->CreatePrintRangeSaver())); // create new ranges + rDoc.CreatePrintRangeSaver())); // create new ranges // #i120105# ownership of old ranges has changed, mark as consumed pOldRanges = 0; @@ -7307,16 +7304,16 @@ uno::Sequence<table::CellRangeAddress> SAL_CALL ScTableSheetObj::getPrintAreas() ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - sal_uInt16 nCount = pDoc->GetPrintRangeCount( nTab ); + sal_uInt16 nCount = rDoc.GetPrintRangeCount( nTab ); table::CellRangeAddress aRangeAddress; uno::Sequence<table::CellRangeAddress> aSeq(nCount); table::CellRangeAddress* pAry = aSeq.getArray(); for (sal_uInt16 i=0; i<nCount; i++) { - const ScRange* pRange = pDoc->GetPrintRange( nTab, i ); + const ScRange* pRange = rDoc.GetPrintRange( nTab, i ); OSL_ENSURE(pRange,"wo ist der Druckbereich"); if (pRange) { @@ -7339,14 +7336,14 @@ void SAL_CALL ScTableSheetObj::setPrintAreas( ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - if ( pDoc->IsUndoEnabled() ) - pOldRanges = pDoc->CreatePrintRangeSaver(); + if ( rDoc.IsUndoEnabled() ) + pOldRanges = rDoc.CreatePrintRangeSaver(); sal_uInt16 nCount = (sal_uInt16) aPrintAreas.getLength(); - pDoc->ClearPrintRanges( nTab ); + rDoc.ClearPrintRanges( nTab ); if (nCount) { ScRange aPrintRange; @@ -7354,11 +7351,11 @@ void SAL_CALL ScTableSheetObj::setPrintAreas( for (sal_uInt16 i=0; i<nCount; i++) { ScUnoConversion::FillScRange( aPrintRange, pAry[i] ); - pDoc->AddPrintRange( nTab, aPrintRange ); + rDoc.AddPrintRange( nTab, aPrintRange ); } } - if ( pDoc->IsUndoEnabled() ) + if ( rDoc.IsUndoEnabled() ) PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc. } } @@ -7369,9 +7366,9 @@ sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleColumns() throw(uno::RuntimeExce ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - return ( pDoc->GetRepeatColRange(nTab) != NULL ); + return ( rDoc.GetRepeatColRange(nTab) != NULL ); } return false; } @@ -7383,21 +7380,21 @@ void SAL_CALL ScTableSheetObj::setPrintTitleColumns( sal_Bool bPrintTitleColumns ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver(); + ScPrintRangeSaver* pOldRanges = rDoc.CreatePrintRangeSaver(); if ( bPrintTitleColumns ) { - if ( !pDoc->GetRepeatColRange( nTab ) ) // keinen bestehenden Bereich veraendern + if ( !rDoc.GetRepeatColRange( nTab ) ) // keinen bestehenden Bereich veraendern { ScRange aNew( 0, 0, nTab, 0, 0, nTab ); // Default - pDoc->SetRepeatColRange( nTab, &aNew ); // einschalten + rDoc.SetRepeatColRange( nTab, &aNew ); // einschalten } } else - pDoc->SetRepeatColRange( nTab, NULL ); // abschalten + rDoc.SetRepeatColRange( nTab, NULL ); // abschalten PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc. @@ -7412,9 +7409,9 @@ table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleColumns() throw(uno::R ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - const ScRange* pRange = pDoc->GetRepeatColRange(nTab); + const ScRange* pRange = rDoc.GetRepeatColRange(nTab); if (pRange) { ScUnoConversion::FillApiRange( aRet, *pRange ); @@ -7431,14 +7428,14 @@ void SAL_CALL ScTableSheetObj::setTitleColumns( const table::CellRangeAddress& a ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver(); + ScPrintRangeSaver* pOldRanges = rDoc.CreatePrintRangeSaver(); ScRange aNew; ScUnoConversion::FillScRange( aNew, aTitleColumns ); - pDoc->SetRepeatColRange( nTab, &aNew ); // immer auch einschalten + rDoc.SetRepeatColRange( nTab, &aNew ); // immer auch einschalten PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc. } @@ -7450,9 +7447,9 @@ sal_Bool SAL_CALL ScTableSheetObj::getPrintTitleRows() throw(uno::RuntimeExcepti ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - return ( pDoc->GetRepeatRowRange(nTab) != NULL ); + return ( rDoc.GetRepeatRowRange(nTab) != NULL ); } return false; } @@ -7464,21 +7461,21 @@ void SAL_CALL ScTableSheetObj::setPrintTitleRows( sal_Bool bPrintTitleRows ) ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver(); + ScPrintRangeSaver* pOldRanges = rDoc.CreatePrintRangeSaver(); if ( bPrintTitleRows ) { - if ( !pDoc->GetRepeatRowRange( nTab ) ) // keinen bestehenden Bereich veraendern + if ( !rDoc.GetRepeatRowRange( nTab ) ) // keinen bestehenden Bereich veraendern { ScRange aNew( 0, 0, nTab, 0, 0, nTab ); // Default - pDoc->SetRepeatRowRange( nTab, &aNew ); // einschalten + rDoc.SetRepeatRowRange( nTab, &aNew ); // einschalten } } else - pDoc->SetRepeatRowRange( nTab, NULL ); // abschalten + rDoc.SetRepeatRowRange( nTab, NULL ); // abschalten PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc. @@ -7493,9 +7490,9 @@ table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleRows() throw(uno::Runt ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - const ScRange* pRange = pDoc->GetRepeatRowRange(nTab); + const ScRange* pRange = rDoc.GetRepeatRowRange(nTab); if (pRange) { ScUnoConversion::FillApiRange( aRet, *pRange ); @@ -7512,14 +7509,14 @@ void SAL_CALL ScTableSheetObj::setTitleRows( const table::CellRangeAddress& aTit ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver(); + ScPrintRangeSaver* pOldRanges = rDoc.CreatePrintRangeSaver(); ScRange aNew; ScUnoConversion::FillScRange( aNew, aTitleRows ); - pDoc->SetRepeatRowRange( nTab, &aNew ); // immer auch einschalten + rDoc.SetRepeatRowRange( nTab, &aNew ); // immer auch einschalten PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc. } @@ -7534,7 +7531,7 @@ sheet::SheetLinkMode SAL_CALL ScTableSheetObj::getLinkMode() throw(uno::RuntimeE ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - sal_uInt8 nMode = pDocSh->GetDocument()->GetLinkMode( GetTab_Impl() ); + sal_uInt8 nMode = pDocSh->GetDocument().GetLinkMode( GetTab_Impl() ); if ( nMode == SC_LINK_NORMAL ) eRet = sheet::SheetLinkMode_NORMAL; else if ( nMode == SC_LINK_VALUE ) @@ -7563,7 +7560,7 @@ OUString SAL_CALL ScTableSheetObj::getLinkUrl() throw(uno::RuntimeException, std OUString aFile; ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) - aFile = pDocSh->GetDocument()->GetLinkDoc( GetTab_Impl() ); + aFile = pDocSh->GetDocument().GetLinkDoc( GetTab_Impl() ); return aFile; } @@ -7587,7 +7584,7 @@ OUString SAL_CALL ScTableSheetObj::getLinkSheetName() throw(uno::RuntimeExceptio OUString aSheet; ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) - aSheet = pDocSh->GetDocument()->GetLinkTab( GetTab_Impl() ); + aSheet = pDocSh->GetDocument().GetLinkTab( GetTab_Impl() ); return aSheet; } @@ -7613,7 +7610,7 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); OUString aFileString = aUrl; @@ -7636,7 +7633,7 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee nLinkMode = SC_LINK_VALUE; sal_uLong nRefresh = 0; - pDoc->SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetString, nRefresh ); + rDoc.SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetString, nRefresh ); pDocSh->UpdateLinks(); // ggf. Link eintragen oder loeschen SfxBindings* pBindings = pDocSh->GetViewBindings(); @@ -7645,12 +7642,12 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee //! Undo fuer Link-Daten an der Table - if ( nLinkMode != SC_LINK_NONE && pDoc->IsExecuteLinkEnabled() ) // Link updaten + if ( nLinkMode != SC_LINK_NONE && rDoc.IsExecuteLinkEnabled() ) // Link updaten { // Update immer, auch wenn der Link schon da war //! Update nur fuer die betroffene Tabelle??? - sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager(); + sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager(); sal_uInt16 nCount = pLinkManager->GetLinks().size(); for ( sal_uInt16 i=0; i<nCount; i++ ) { @@ -7877,7 +7874,7 @@ void SAL_CALL ScTableSheetObj::protect( const OUString& aPassword ) SolarMutexGuard aGuard; ScDocShell* pDocSh = GetDocShell(); // #i108245# if already protected, don't change anything - if ( pDocSh && !pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() ) ) + if ( pDocSh && !pDocSh->GetDocument().IsTabProtected( GetTab_Impl() ) ) { OUString aString(aPassword); pDocSh->GetDocFunc().Protect( GetTab_Impl(), aString, true ); @@ -7903,7 +7900,7 @@ sal_Bool SAL_CALL ScTableSheetObj::isProtected() throw(uno::RuntimeException, st SolarMutexGuard aGuard; ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) - return pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() ); + return pDocSh->GetDocument().IsTabProtected( GetTab_Impl() ); OSL_FAIL("keine DocShell"); //! Exception oder so? return false; @@ -7916,7 +7913,7 @@ sal_Bool SAL_CALL ScTableSheetObj::getIsScenario() throw(uno::RuntimeException, SolarMutexGuard aGuard; ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) - return pDocSh->GetDocument()->IsScenario( GetTab_Impl() ); + return pDocSh->GetDocument().IsScenario( GetTab_Impl() ); return false; } @@ -7930,7 +7927,7 @@ OUString SAL_CALL ScTableSheetObj::getScenarioComment() throw(uno::RuntimeExcept OUString aComment; Color aColor; sal_uInt16 nFlags; - pDocSh->GetDocument()->GetScenarioData( GetTab_Impl(), aComment, aColor, nFlags ); + pDocSh->GetDocument().GetScenarioData( GetTab_Impl(), aComment, aColor, nFlags ); return aComment; } return OUString(); @@ -7943,15 +7940,15 @@ void SAL_CALL ScTableSheetObj::setScenarioComment( const OUString& aScenarioComm ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); OUString aName; OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetName( nTab, aName ); - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetName( nTab, aName ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); aComment = aScenarioComment; @@ -7966,10 +7963,10 @@ void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAd ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { ScMarkData aMarkData; aMarkData.SelectTable( nTab, true ); @@ -7989,7 +7986,7 @@ void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAd } // Szenario-Ranges sind durch Attribut gekennzeichnet - ScPatternAttr aPattern( pDoc->GetPool() ); + ScPatternAttr aPattern( rDoc.GetPool() ); aPattern.GetItemSet().Put( ScMergeFlagAttr( SC_MF_SCENARIO ) ); aPattern.GetItemSet().Put( ScProtectionAttr( true ) ); pDocSh->GetDocFunc().ApplyAttributes( aMarkData, aPattern, true, true ); @@ -8003,16 +8000,16 @@ void SAL_CALL ScTableSheetObj::apply() throw(uno::RuntimeException, std::excepti ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); OUString aName; - pDoc->GetName( nTab, aName ); // Name dieses Szenarios + rDoc.GetName( nTab, aName ); // Name dieses Szenarios SCTAB nDestTab = nTab; - while ( nDestTab > 0 && pDoc->IsScenario(nDestTab) ) + while ( nDestTab > 0 && rDoc.IsScenario(nDestTab) ) --nDestTab; - if ( !pDoc->IsScenario(nDestTab) ) + if ( !rDoc.IsScenario(nDestTab) ) pDocSh->UseScenario( nDestTab, aName ); //! sonst Fehler oder so @@ -8028,9 +8025,9 @@ uno::Sequence< table::CellRangeAddress > SAL_CALL ScTableSheetObj::getRanges( ) ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - const ScRangeList* pRangeList = pDoc->GetScenarioRanges(nTab); + const ScRangeList* pRangeList = rDoc.GetScenarioRanges(nTab); if (pRangeList) { size_t nCount = pRangeList->size(); @@ -8061,16 +8058,13 @@ void ScTableSheetObj::setExternalName( const OUString& aUrl, const OUString& aSh ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); - if ( pDoc ) + ScDocument& rDoc = pDocSh->GetDocument(); + const SCTAB nTab = GetTab_Impl(); + const OUString aAbsDocName( ScGlobal::GetAbsDocName( aUrl, pDocSh ) ); + const OUString aDocTabName( ScGlobal::GetDocTabName( aAbsDocName, aSheetName ) ); + if ( !rDoc.RenameTab( nTab, aDocTabName, false /*bUpdateRef*/, true /*bExternalDocument*/ ) ) { - const SCTAB nTab = GetTab_Impl(); - const OUString aAbsDocName( ScGlobal::GetAbsDocName( aUrl, pDocSh ) ); - const OUString aDocTabName( ScGlobal::GetDocTabName( aAbsDocName, aSheetName ) ); - if ( !pDoc->RenameTab( nTab, aDocTabName, false /*bUpdateRef*/, true /*bExternalDocument*/ ) ) - { - throw container::ElementExistException( OUString(), *this ); - } + throw container::ElementExistException( OUString(), *this ); } } } @@ -8116,7 +8110,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn ScDocShell* pDocSh = GetDocShell(); if (!pDocSh) return; //! Exception oder so? - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); ScDocFunc &rFunc = pDocSh->GetDocFunc(); @@ -8129,10 +8123,10 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn //! Undo? (auch bei SID_STYLE_APPLY an der View) - if ( pDoc->GetPageStyle( nTab ) != aNewStr ) + if ( rDoc.GetPageStyle( nTab ) != aNewStr ) { - pDoc->SetPageStyle( nTab, aNewStr ); - if (!pDoc->IsImportingXML()) + rDoc.SetPageStyle( nTab, aNewStr ); + if (!rDoc.IsImportingXML()) { ScPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab ).UpdatePages(); @@ -8156,12 +8150,12 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn } else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE ) { - if (pDoc->IsScenario(nTab)) - pDoc->SetActiveScenario( nTab, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + if (rDoc.IsScenario(nTab)) + rDoc.SetActiveScenario( nTab, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); } else if ( pEntry->nWID == SC_WID_UNO_BORDCOL ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { sal_Int32 nNewColor = 0; if (aValue >>= nNewColor) @@ -8170,8 +8164,8 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetName( nTab, aName ); - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetName( nTab, aName ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); aColor = Color(static_cast<sal_uInt32>(nNewColor)); @@ -8181,14 +8175,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn } else if ( pEntry->nWID == SC_WID_UNO_PROTECT ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aName; OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetName( nTab, aName ); - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetName( nTab, aName ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); bool bModify(false); if (ScUnoHelpFunctions::GetBoolFromAny( aValue )) @@ -8214,14 +8208,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn } else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aName; OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetName( nTab, aName ); - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetName( nTab, aName ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); bool bModify(false); if (ScUnoHelpFunctions::GetBoolFromAny( aValue )) @@ -8247,14 +8241,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn } else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aName; OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetName( nTab, aName ); - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetName( nTab, aName ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); bool bModify(false); if (ScUnoHelpFunctions::GetBoolFromAny( aValue )) @@ -8280,14 +8274,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn } else if ( pEntry->nWID == SC_WID_UNO_COPYBACK ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aName; OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetName( nTab, aName ); - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetName( nTab, aName ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); bool bModify(false); if (ScUnoHelpFunctions::GetBoolFromAny( aValue )) @@ -8313,14 +8307,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn } else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aName; OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetName( nTab, aName ); - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetName( nTab, aName ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); bool bModify(false); if (ScUnoHelpFunctions::GetBoolFromAny( aValue )) @@ -8346,14 +8340,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn } else if ( pEntry->nWID == SC_WID_UNO_COPYFORM ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aName; OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetName( nTab, aName ); - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetName( nTab, aName ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); bool bModify(false); if (ScUnoHelpFunctions::GetBoolFromAny( aValue )) @@ -8392,11 +8386,11 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn { bool bAutoPrint = ScUnoHelpFunctions::GetBoolFromAny( aValue ); if (bAutoPrint) - pDoc->SetPrintEntireSheet( nTab ); // clears all print ranges + rDoc.SetPrintEntireSheet( nTab ); // clears all print ranges else { - if (pDoc->IsPrintEntireSheet( nTab )) - pDoc->ClearPrintRanges( nTab ); // if this flag is true, there are no PrintRanges, so Clear clears only the flag. + 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_TABCOLOR ) @@ -8405,7 +8399,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn if ( aValue >>= nColor ) { const Color aColor( static_cast< ColorData >( nColor ) ); - if ( pDoc->GetTabBgColor( nTab ) != aColor ) + if ( rDoc.GetTabBgColor( nTab ) != aColor ) rFunc.SetTabBgColor( nTab, aColor, true, true ); } } @@ -8414,7 +8408,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn OUString aCodeName; if ( pDocSh && ( aValue >>= aCodeName ) ) { - pDocSh->GetDocument()->SetCodeName( GetTab_Impl(), aCodeName ); + pDocSh->GetDocument().SetCodeName( GetTab_Impl(), aCodeName ); } } else @@ -8432,7 +8426,7 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn ScDocShell* pDocSh = GetDocShell(); if (!pDocSh) throw uno::RuntimeException(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); if ( pEntry->nWID == SC_WID_UNO_NAMES ) @@ -8442,11 +8436,11 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn else if ( pEntry->nWID == SC_WID_UNO_PAGESTL ) { rAny <<= OUString( ScStyleNameConversion::DisplayToProgrammaticName( - pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ) ); + rDoc.GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ) ); } else if ( pEntry->nWID == SC_WID_UNO_CELLVIS ) { - bool bVis = pDoc->IsVisible( nTab ); + bool bVis = rDoc.IsVisible( nTab ); ScUnoHelpFunctions::SetBoolInAny( rAny, bVis ); } else if ( pEntry->nWID == SC_WID_UNO_LINKDISPBIT ) @@ -8461,114 +8455,114 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn } else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE ) { - if (pDoc->IsScenario(nTab)) - ScUnoHelpFunctions::SetBoolInAny( rAny, pDoc->IsActiveScenario( nTab )); + if (rDoc.IsScenario(nTab)) + ScUnoHelpFunctions::SetBoolInAny( rAny, rDoc.IsActiveScenario( nTab )); } else if ( pEntry->nWID == SC_WID_UNO_BORDCOL ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); rAny <<= static_cast<sal_Int32>(aColor.GetColor()); } } else if ( pEntry->nWID == SC_WID_UNO_PROTECT ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PROTECT) != 0 ); } } else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_SHOWFRAME) != 0 ); } } else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PRINTFRAME) != 0 ); } } else if ( pEntry->nWID == SC_WID_UNO_COPYBACK ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_TWOWAY) != 0 ); } } else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_ATTRIB) != 0 ); } } else if ( pEntry->nWID == SC_WID_UNO_COPYFORM ) { - if (pDoc->IsScenario(nTab)) + if (rDoc.IsScenario(nTab)) { OUString aComment; Color aColor; sal_uInt16 nFlags; - pDoc->GetScenarioData( nTab, aComment, aColor, nFlags ); + rDoc.GetScenarioData( nTab, aComment, aColor, nFlags ); ScUnoHelpFunctions::SetBoolInAny( rAny, !(nFlags & SC_SCENARIO_VALUE)); } } else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT ) { - if (pDoc->IsLayoutRTL(nTab)) + if (rDoc.IsLayoutRTL(nTab)) rAny <<= sal_Int16(com::sun::star::text::WritingMode2::RL_TB); else rAny <<= sal_Int16(com::sun::star::text::WritingMode2::LR_TB); } else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT ) { - bool bAutoPrint = pDoc->IsPrintEntireSheet( nTab ); + bool bAutoPrint = rDoc.IsPrintEntireSheet( nTab ); ScUnoHelpFunctions::SetBoolInAny( rAny, bAutoPrint ); } else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR ) { - rAny <<= sal_Int32(pDoc->GetTabBgColor(nTab).GetColor()); + rAny <<= sal_Int32(rDoc.GetTabBgColor(nTab).GetColor()); } else if ( pEntry->nWID == SC_WID_UNO_CODENAME ) { OUString aCodeName; if ( pDocSh ) - pDocSh->GetDocument()->GetCodeName( GetTab_Impl(), aCodeName ); + pDocSh->GetDocument().GetCodeName( GetTab_Impl(), aCodeName ); rAny <<= OUString( aCodeName ); } else @@ -8799,7 +8793,7 @@ void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE if (!pDocSh) throw uno::RuntimeException(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); const ScRange& rRange = GetRange(); OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "zuviele Spalten"); SCCOL nCol = rRange.aStart.Col(); @@ -8808,30 +8802,30 @@ void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE if ( pEntry->nWID == SC_WID_UNO_CELLWID ) { // for hidden column, return original height - sal_uInt16 nWidth = pDoc->GetOriginalWidth( nCol, nTab ); + sal_uInt16 nWidth = rDoc.GetOriginalWidth( nCol, nTab ); // property is 1/100mm, column width is twips nWidth = (sal_uInt16) TwipsToHMM(nWidth); rAny <<= (sal_Int32)( nWidth ); } else if ( pEntry->nWID == SC_WID_UNO_CELLVIS ) { - bool bHidden = pDoc->ColHidden(nCol, nTab); + bool bHidden = rDoc.ColHidden(nCol, nTab); ScUnoHelpFunctions::SetBoolInAny( rAny, !bHidden ); } else if ( pEntry->nWID == SC_WID_UNO_OWIDTH ) { //! momentan immer gesetzt ??!?! - bool bOpt = !(pDoc->GetColFlags( nCol, nTab ) & CR_MANUALSIZE); + bool bOpt = !(rDoc.GetColFlags( nCol, nTab ) & CR_MANUALSIZE); ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt ); } else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE ) { - ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab); + ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab); ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak ); } else if ( pEntry->nWID == SC_WID_UNO_MANPAGE ) { - ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab); + ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab); ScUnoHelpFunctions::SetBoolInAny(rAny, (nBreak & BREAK_MANUAL) != 0); } else @@ -8882,7 +8876,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr ScDocShell* pDocSh = GetDocShell(); if (!pDocSh) return; //! Exception oder so? - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); const ScRange& rRange = GetRange(); OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "zuviele Zeilen"); SCROW nRow = rRange.aStart.Row(); @@ -8913,7 +8907,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr { bool bFil = ScUnoHelpFunctions::GetBoolFromAny( aValue ); // SC_SIZE_DIRECT mit Groesse 0 blendet aus - pDoc->SetRowFiltered(nRow, nRow, nTab, bFil); + rDoc.SetRowFiltered(nRow, nRow, nTab, bFil); } else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT ) { @@ -8923,7 +8917,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr else { // set current height again manually - sal_uInt16 nHeight = pDoc->GetOriginalHeight( nRow, nTab ); + sal_uInt16 nHeight = rDoc.GetOriginalHeight( nRow, nTab ); rFunc.SetWidthOrHeight(false, aRowArr, nTab, SC_SIZE_ORIGINAL, nHeight, true, true); } } @@ -8948,7 +8942,7 @@ void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr ScDocShell* pDocSh = GetDocShell(); if (!pDocSh) throw uno::RuntimeException(); - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); const ScRange& rRange = GetRange(); OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "zuviele Zeilen"); SCROW nRow = rRange.aStart.Row(); @@ -8957,34 +8951,34 @@ void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr if ( pEntry->nWID == SC_WID_UNO_CELLHGT ) { // for hidden row, return original height - sal_uInt16 nHeight = pDoc->GetOriginalHeight( nRow, nTab ); + sal_uInt16 nHeight = rDoc.GetOriginalHeight( nRow, nTab ); // property is 1/100mm, row height is twips nHeight = (sal_uInt16) TwipsToHMM(nHeight); rAny <<= (sal_Int32)( nHeight ); } else if ( pEntry->nWID == SC_WID_UNO_CELLVIS ) { - bool bHidden = pDoc->RowHidden(nRow, nTab); + bool bHidden = rDoc.RowHidden(nRow, nTab); ScUnoHelpFunctions::SetBoolInAny( rAny, !bHidden ); } else if ( pEntry->nWID == SC_WID_UNO_CELLFILT ) { - bool bVis = pDoc->RowFiltered(nRow, nTab); + bool bVis = rDoc.RowFiltered(nRow, nTab); ScUnoHelpFunctions::SetBoolInAny( rAny, bVis ); } else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT ) { - bool bOpt = !(pDoc->GetRowFlags( nRow, nTab ) & CR_MANUALSIZE); + bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & CR_MANUALSIZE); ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt ); } else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE ) { - ScBreakType nBreak = pDoc->HasRowBreak(nRow, nTab); + ScBreakType nBreak = rDoc.HasRowBreak(nRow, nTab); ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak ); } else if ( pEntry->nWID == SC_WID_UNO_MANPAGE ) { - ScBreakType nBreak = (pDoc->HasRowBreak(nRow, nTab) & BREAK_MANUAL); + ScBreakType nBreak = (rDoc.HasRowBreak(nRow, nTab) & BREAK_MANUAL); ScUnoHelpFunctions::SetBoolInAny( rAny, nBreak ); } else @@ -9001,13 +8995,13 @@ ScCellsObj::ScCellsObj(ScDocShell* pDocSh, const ScRangeList& rR) : pDocShell( pDocSh ), aRanges( rR ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScCellsObj::~ScCellsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScCellsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -9015,7 +9009,7 @@ void ScCellsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) if ( rHint.ISA( ScUpdateRefHint ) ) { const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint; - aRanges.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(), + aRanges.UpdateReference( rRef.GetMode(), &pDocShell->GetDocument(), rRef.GetRange(), rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ); } else if ( rHint.ISA( SfxSimpleHint ) && @@ -9062,8 +9056,8 @@ ScCellsEnumeration::ScCellsEnumeration(ScDocShell* pDocSh, const ScRangeList& rR pMark( NULL ), bAtEnd( false ) { - ScDocument* pDoc = pDocShell->GetDocument(); - pDoc->AddUnoObject(*this); + ScDocument& rDoc = pDocShell->GetDocument(); + rDoc.AddUnoObject(*this); if ( aRanges.empty() ) bAtEnd = true; @@ -9084,9 +9078,9 @@ void ScCellsEnumeration::CheckPos_Impl() return; bool bFound = false; - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScRefCellValue aCell; - aCell.assign(*pDoc, aPos); + aCell.assign(rDoc, aPos); if (!aCell.isEmpty()) { if (!pMark) @@ -9104,7 +9098,7 @@ void ScCellsEnumeration::CheckPos_Impl() ScCellsEnumeration::~ScCellsEnumeration() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); delete pMark; } @@ -9121,7 +9115,7 @@ void ScCellsEnumeration::Advance_Impl() SCCOL nCol = aPos.Col(); SCROW nRow = aPos.Row(); SCTAB nTab = aPos.Tab(); - bool bFound = pDocShell->GetDocument()->GetNextMarkedCell( nCol, nRow, nTab, *pMark ); + bool bFound = pDocShell->GetDocument().GetNextMarkedCell( nCol, nRow, nTab, *pMark ); if (bFound) aPos.Set( nCol, nRow, nTab ); else @@ -9135,7 +9129,7 @@ void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint ) if (pDocShell) { const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint; - aRanges.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(), + aRanges.UpdateReference( rRef.GetMode(), &pDocShell->GetDocument(), rRef.GetRange(), rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ); delete pMark; // aus verschobenen Bereichen neu erzeugen @@ -9145,7 +9139,7 @@ void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint ) { ScRangeList aNew; aNew.Append(ScRange(aPos)); - aNew.UpdateReference( rRef.GetMode(), pDocShell->GetDocument(), rRef.GetRange(), + aNew.UpdateReference( rRef.GetMode(), &pDocShell->GetDocument(), rRef.GetRange(), rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ); if (aNew.size()==1) { @@ -9190,8 +9184,8 @@ ScCellFormatsObj::ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) : pDocShell( pDocSh ), aTotalRange( rRange ) { - ScDocument* pDoc = pDocShell->GetDocument(); - pDoc->AddUnoObject(*this); + ScDocument& rDoc = pDocShell->GetDocument(); + rDoc.AddUnoObject(*this); OSL_ENSURE( aTotalRange.aStart.Tab() == aTotalRange.aEnd.Tab(), "unterschiedliche Tabellen" ); } @@ -9199,7 +9193,7 @@ ScCellFormatsObj::ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) : ScCellFormatsObj::~ScCellFormatsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -9222,9 +9216,9 @@ ScCellRangeObj* ScCellFormatsObj::GetObjectByIndex_Impl(long nIndex) const ScCellRangeObj* pRet = NULL; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); long nPos = 0; - ScAttrRectIterator aIter( pDoc, aTotalRange.aStart.Tab(), + ScAttrRectIterator aIter( &rDoc, aTotalRange.aStart.Tab(), aTotalRange.aStart.Col(), aTotalRange.aStart.Row(), aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() ); SCCOL nCol1, nCol2; @@ -9258,8 +9252,8 @@ sal_Int32 SAL_CALL ScCellFormatsObj::getCount() throw(uno::RuntimeException, std long nCount = 0; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScAttrRectIterator aIter( pDoc, aTotalRange.aStart.Tab(), + ScDocument& rDoc = pDocShell->GetDocument(); + ScAttrRectIterator aIter( &rDoc, aTotalRange.aStart.Tab(), aTotalRange.aStart.Col(), aTotalRange.aStart.Row(), aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() ); SCCOL nCol1, nCol2; @@ -9313,13 +9307,13 @@ ScCellFormatsEnumeration::ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScR bAtEnd( false ), bDirty( false ) { - ScDocument* pDoc = pDocShell->GetDocument(); - pDoc->AddUnoObject(*this); + ScDocument& rDoc = pDocShell->GetDocument(); + rDoc.AddUnoObject(*this); OSL_ENSURE( rRange.aStart.Tab() == rRange.aEnd.Tab(), "CellFormatsEnumeration: unterschiedliche Tabellen" ); - pIter = new ScAttrRectIterator( pDoc, nTab, + pIter = new ScAttrRectIterator( &rDoc, nTab, rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row() ); Advance_Impl(); @@ -9328,7 +9322,7 @@ ScCellFormatsEnumeration::ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScR ScCellFormatsEnumeration::~ScCellFormatsEnumeration() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); delete pIter; } @@ -9417,7 +9411,7 @@ ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange aTotalRange( rRange ), aRangeLists() { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); OSL_ENSURE( aTotalRange.aStart.Tab() == aTotalRange.aEnd.Tab(), "unterschiedliche Tabellen" ); @@ -9427,7 +9421,7 @@ ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange ScUniqueCellFormatsObj::~ScUniqueCellFormatsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScUniqueCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -9590,9 +9584,9 @@ void ScUniqueCellFormatsObj::GetObjects_Impl() { if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nTab = aTotalRange.aStart.Tab(); - ScAttrRectIterator aIter( pDoc, nTab, + ScAttrRectIterator aIter( &rDoc, nTab, aTotalRange.aStart.Col(), aTotalRange.aStart.Row(), aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() ); SCCOL nCol1, nCol2; @@ -9604,7 +9598,7 @@ void ScUniqueCellFormatsObj::GetObjects_Impl() while (aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) ) { ScRange aRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab ); - const ScPatternAttr* pPattern = pDoc->GetPattern(nCol1, nRow1, nTab); + const ScPatternAttr* pPattern = rDoc.GetPattern(nCol1, nRow1, nTab); aHashMap[pPattern].Join( aRange ); } @@ -9679,13 +9673,13 @@ ScUniqueCellFormatsEnumeration::ScUniqueCellFormatsEnumeration(ScDocShell* pDocS pDocShell( pDocSh ), nCurrentPosition(0) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScUniqueCellFormatsEnumeration::~ScUniqueCellFormatsEnumeration() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScUniqueCellFormatsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint ) diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index c94e4d9f5507..a0c70540f14d 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -56,8 +56,8 @@ static SdrOle2Obj* lcl_FindChartObj( ScDocShell* pDocShell, SCTAB nTab, const OU { if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); if (pDrawLayer) { SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); @@ -68,7 +68,7 @@ static SdrOle2Obj* lcl_FindChartObj( ScDocShell* pDocShell, SCTAB nTab, const OU SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && pDoc->IsChart(pObject) ) + if ( pObject->GetObjIdentifier() == OBJ_OLE2 && rDoc.IsChart(pObject) ) { uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)pObject)->GetObjRef(); if ( xObj.is() ) @@ -90,13 +90,13 @@ ScChartsObj::ScChartsObj(ScDocShell* pDocSh, SCTAB nT) : pDocShell( pDocSh ), nTab( nT ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScChartsObj::~ScChartsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScChartsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -115,8 +115,8 @@ ScChartObj* ScChartsObj::GetObjectByIndex_Impl(long nIndex) const OUString aName; if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); if (pDrawLayer) { SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); @@ -128,7 +128,7 @@ ScChartObj* ScChartsObj::GetObjectByIndex_Impl(long nIndex) const SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && pDoc->IsChart(pObject) ) + if ( pObject->GetObjIdentifier() == OBJ_OLE2 && rDoc.IsChart(pObject) ) { if ( nPos == nIndex ) { @@ -170,11 +170,11 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName, if (!pDocShell) return; - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScDrawLayer* pModel = pDocShell->MakeDrawLayer(); SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab)); OSL_ENSURE(pPage,"addChart: keine Page"); - if (!pPage || !pDoc) + if (!pPage) return; // chart can't be inserted if any ole object with that name exists on any table @@ -210,7 +210,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName, // Rechteck anpassen //! Fehler/Exception, wenn leer/ungueltig ??? Point aRectPos( aRect.X, aRect.Y ); - bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); if ( ( aRectPos.X() < 0 && !bLayoutRTL ) || ( aRectPos.X() > 0 && bLayoutRTL ) ) aRectPos.X() = 0; @@ -235,7 +235,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName, // Calc -> DataProvider uno::Reference< chart2::data::XDataProvider > xDataProvider = new - ScChart2DataProvider( pDoc ); + ScChart2DataProvider( &rDoc ); // Chart -> DataReceiver uno::Reference< chart2::data::XDataReceiver > xReceiver; uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY ); @@ -244,7 +244,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName, if( xReceiver.is()) { OUString sRangeStr; - xNewRanges->Format(sRangeStr, SCR_ABS_3D, pDoc); + xNewRanges->Format(sRangeStr, SCR_ABS_3D, &rDoc); // connect if( !sRangeStr.isEmpty() ) @@ -273,8 +273,8 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName, } ScChartListener* pChartListener = - new ScChartListener( aName, pDoc, xNewRanges ); - pDoc->GetChartListenerCollection()->insert( pChartListener ); + new ScChartListener( aName, &rDoc, xNewRanges ); + rDoc.GetChartListenerCollection()->insert( pChartListener ); pChartListener->StartListeningTo(); SdrOle2Obj* pObj = new SdrOle2Obj( ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), aName, aInsRect ); @@ -299,9 +299,9 @@ void SAL_CALL ScChartsObj::removeByName( const OUString& aName ) SdrOle2Obj* pObj = lcl_FindChartObj( pDocShell, nTab, aName ); if (pObj) { - ScDocument* pDoc = pDocShell->GetDocument(); - pDoc->GetChartListenerCollection()->removeByName(aName); - ScDrawLayer* pModel = pDoc->GetDrawLayer(); // ist nicht 0 + ScDocument& rDoc = pDocShell->GetDocument(); + rDoc.GetChartListenerCollection()->removeByName(aName); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); // ist nicht 0 SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab)); // ist nicht 0 pModel->AddUndo( new SdrUndoDelObj( *pObj ) ); @@ -328,8 +328,8 @@ sal_Int32 SAL_CALL ScChartsObj::getCount() throw(uno::RuntimeException, std::exc sal_Int32 nCount = 0; if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); if (pDrawLayer) { SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); @@ -340,7 +340,7 @@ sal_Int32 SAL_CALL ScChartsObj::getCount() throw(uno::RuntimeException, std::exc SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && pDoc->IsChart(pObject) ) + if ( pObject->GetObjIdentifier() == OBJ_OLE2 && rDoc.IsChart(pObject) ) ++nCount; pObject = aIter.Next(); } @@ -391,14 +391,14 @@ uno::Sequence<OUString> SAL_CALL ScChartsObj::getElementNames() throw(uno::Runti SolarMutexGuard aGuard; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); long nCount = getCount(); uno::Sequence<OUString> aSeq(nCount); OUString* pAry = aSeq.getArray(); long nPos = 0; - ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); if (pDrawLayer) { SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); @@ -409,7 +409,7 @@ uno::Sequence<OUString> SAL_CALL ScChartsObj::getElementNames() throw(uno::Runti SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && pDoc->IsChart(pObject) ) + if ( pObject->GetObjIdentifier() == OBJ_OLE2 && rDoc.IsChart(pObject) ) { OUString aName; uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)pObject)->GetObjRef(); @@ -444,7 +444,7 @@ ScChartObj::ScChartObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN) ,nTab( nT ) ,aChartName( rN ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); uno::Sequence< table::CellRangeAddress > aInitialPropValue; registerPropertyNoMember( OUString( "RelatedCellRanges" ), @@ -455,7 +455,7 @@ ScChartObj::ScChartObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN) ScChartObj::~ScChartObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScChartObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -472,11 +472,11 @@ void ScChartObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) void ScChartObj::GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rRowHeaders ) const { bool bFound = false; - ScDocument* pDoc = (pDocShell? pDocShell->GetDocument(): 0); - if( pDoc ) + if( pDocShell ) { - uno::Reference< chart2::XChartDocument > xChartDoc( pDoc->GetChartByName( aChartName ) ); + ScDocument& rDoc = pDocShell->GetDocument(); + uno::Reference< chart2::XChartDocument > xChartDoc( rDoc.GetChartByName( aChartName ) ); if( xChartDoc.is() ) { uno::Reference< chart2::data::XDataReceiver > xReceiver( xChartDoc, uno::UNO_QUERY ); @@ -516,7 +516,7 @@ void ScChartObj::GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rColHeaders=bHasCategories; rRowHeaders=bFirstCellAsLabel; } - rRanges->Parse( aRanges, pDoc); + rRanges->Parse( aRanges, &rDoc); } bFound = true; } @@ -533,15 +533,15 @@ void ScChartObj::Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, b { if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - bool bUndo(pDoc->IsUndoEnabled()); + ScDocument& rDoc = pDocShell->GetDocument(); + bool bUndo(rDoc.IsUndoEnabled()); if (bUndo) { pDocShell->GetUndoManager()->AddUndoAction( new ScUndoChartData( pDocShell, aChartName, rRanges, bColHeaders, bRowHeaders, false ) ); } - pDoc->UpdateChartArea( aChartName, rRanges, bColHeaders, bRowHeaders, false ); + rDoc.UpdateChartArea( aChartName, rRanges, bColHeaders, bRowHeaders, false ); } } @@ -572,11 +572,13 @@ void ScChartObj::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno: ScUnoConversion::FillScRange( aRange, aCellRange ); rRangeList->Append( aRange ); } - ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL ); - ScChartListenerCollection* pCollection = ( pDoc ? pDoc->GetChartListenerCollection() : NULL ); - if ( pCollection ) + if ( pDocShell ) { - pCollection->ChangeListening( aChartName, rRangeList ); + ScChartListenerCollection* pCollection = pDocShell->GetDocument().GetChartListenerCollection(); + if ( pCollection ) + { + pCollection->ChangeListening( aChartName, rRangeList ); + } } } } @@ -592,11 +594,11 @@ void ScChartObj::getFastPropertyValue( uno::Any& rValue, sal_Int32 nHandle ) con { case PROP_HANDLE_RELATED_CELLRANGES: { - ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL ); - if (!pDoc) + if (!pDocShell) break; + ScDocument& rDoc = pDocShell->GetDocument(); - ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection(); + ScChartListenerCollection* pCollection = rDoc.GetChartListenerCollection(); if (!pCollection) break; diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index 1f2637257801..4f849aec5df3 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -85,13 +85,13 @@ ScDocumentConfiguration::ScDocumentConfiguration(ScDocShell* pDocSh) : pDocShell(pDocSh) , aPropSet ( lcl_GetConfigPropertyMap() ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScDocumentConfiguration::~ScDocumentConfiguration() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScDocumentConfiguration::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -126,201 +126,196 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( if(pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - if (pDoc) + ScDocument& rDoc = pDocShell->GetDocument(); + bool bUpdateHeights = false; + + ScViewOptions aViewOpt(rDoc.GetViewOptions()); + + /*Stampit enable/disable print cancel */ + if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) ) + pDocShell->Stamp_SetPrintCancelState( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + /*Stampit enable/disable print cancel */ + + else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) ) + aViewOpt.SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) ) + aViewOpt.SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) ) + aViewOpt.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) ) { - bool bUpdateHeights = false; - - ScViewOptions aViewOpt(pDoc->GetViewOptions()); - - /*Stampit enable/disable print cancel */ - if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) ) - pDocShell->Stamp_SetPrintCancelState( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - /*Stampit enable/disable print cancel */ - - else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) ) - aViewOpt.SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) ) - aViewOpt.SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) ) - aViewOpt.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) ) + sal_Int64 nColor = 0; + if (aValue >>= nColor) { - sal_Int64 nColor = 0; - if (aValue >>= nColor) - { - OUString aColorName; - Color aColor(static_cast<sal_uInt32>(nColor)); - aViewOpt.SetGridColor(aColor, aColorName); - } + OUString aColorName; + Color aColor(static_cast<sal_uInt32>(nColor)); + aViewOpt.SetGridColor(aColor, aColorName); } - else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) ) - aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) ) - pDoc->SetLinkMode( static_cast<ScLkUpdMode> ( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) ) - aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) ) - aViewOpt.SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) ) - aViewOpt.SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) ) - pDoc->SetAutoCalc( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) ) + } + else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) ) + aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) ) + rDoc.SetLinkMode( static_cast<ScLkUpdMode> ( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) ) + aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) ) + aViewOpt.SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) ) + aViewOpt.SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) ) + rDoc.SetAutoCalc( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) ) + { + OUString sPrinterName; + if ( aValue >>= sPrinterName ) { - OUString sPrinterName; - if ( aValue >>= sPrinterName ) + // #i75610# if the name is empty, do nothing (don't create any printer) + if ( !sPrinterName.isEmpty() && pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) { - // #i75610# if the name is empty, do nothing (don't create any printer) - if ( !sPrinterName.isEmpty() && pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + SfxPrinter* pPrinter = pDocShell->GetPrinter(); + if (pPrinter) { - SfxPrinter* pPrinter = pDocShell->GetPrinter(); - if (pPrinter) + if (pPrinter->GetName() != sPrinterName) { - if (pPrinter->GetName() != sPrinterName) - { - SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), sPrinterName ); - if (pNewPrinter->IsKnown()) - pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER ); - else - delete pNewPrinter; - } + SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), sPrinterName ); + if (pNewPrinter->IsKnown()) + pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER ); + else + delete pNewPrinter; } - else - throw uno::RuntimeException(); } + else + throw uno::RuntimeException(); } - else - throw lang::IllegalArgumentException(); } - else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) ) + else + throw lang::IllegalArgumentException(); + } + else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) ) + { + uno::Sequence<sal_Int8> aSequence; + if ( aValue >>= aSequence ) { - uno::Sequence<sal_Int8> aSequence; - if ( aValue >>= aSequence ) + sal_uInt32 nSize = aSequence.getLength(); + // #i75610# if the sequence is empty, do nothing (don't create any printer) + if ( nSize != 0 ) { - sal_uInt32 nSize = aSequence.getLength(); - // #i75610# if the sequence is empty, do nothing (don't create any printer) - if ( nSize != 0 ) - { - SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ ); - aStream.Seek ( STREAM_SEEK_TO_BEGIN ); - SfxItemSet* pSet = new SfxItemSet( *pDoc->GetPool(), - SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, - SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, - SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET, - SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS, - NULL ); - pDocShell->SetPrinter( SfxPrinter::Create( aStream, pSet ) ); - } + SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ ); + aStream.Seek ( STREAM_SEEK_TO_BEGIN ); + SfxItemSet* pSet = new SfxItemSet( *rDoc.GetPool(), + SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, + SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, + SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET, + SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS, + NULL ); + pDocShell->SetPrinter( SfxPrinter::Create( aStream, pSet ) ); } } - else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) ) - { - bool bTmp=true; - if ( aValue >>= bTmp ) - pDocShell->SetUseUserData( bTmp ); - } - else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) ) - { - // read-only - should not be set - } - else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) ) - { - // Int16 contains CharacterCompressionType values - sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue ); - pDoc->SetAsianCompression( (sal_uInt8) nUno ); - bUpdateHeights = true; - } - else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) ) - { - pDoc->SetAsianKerning( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - bUpdateHeights = true; - } - else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) ) - { - bool bTmp=false; - if ( aValue >>= bTmp ) - pDocShell->SetSaveVersionOnClose( bTmp ); - } - else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) ) - { - bool bTmp=true; - if ( aValue >>= bTmp ) - pDocShell->SetQueryLoadTemplate( bTmp ); - } - else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) ) - { - bool bTmp=false; - if ( aValue >>= bTmp ) - pDocShell->SetLoadReadonly( bTmp ); - } - else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) ) - { + } + else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) ) + { + bool bTmp=true; + if ( aValue >>= bTmp ) + pDocShell->SetUseUserData( bTmp ); + } + else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) ) + { + // read-only - should not be set + } + else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) ) + { + // Int16 contains CharacterCompressionType values + sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue ); + rDoc.SetAsianCompression( (sal_uInt8) nUno ); + bUpdateHeights = true; + } + else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) ) + { + rDoc.SetAsianKerning( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + bUpdateHeights = true; + } + else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) ) + { + bool bTmp=false; + if ( aValue >>= bTmp ) + pDocShell->SetSaveVersionOnClose( bTmp ); + } + else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) ) + { + bool bTmp=true; + if ( aValue >>= bTmp ) + pDocShell->SetQueryLoadTemplate( bTmp ); + } + else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) ) + { + bool bTmp=false; + if ( aValue >>= bTmp ) + pDocShell->SetLoadReadonly( bTmp ); + } + else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) ) + { #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT - bool bDocShared = false; - if ( aValue >>= bDocShared ) - { - pDocShell->SetSharedXMLFlag( bDocShared ); - } -#endif - } - else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) ) + bool bDocShared = false; + if ( aValue >>= bDocShared ) { - uno::Sequence< beans::PropertyValue > aInfo; - if ( !( aValue >>= aInfo ) ) - throw lang::IllegalArgumentException( - OUString( "Value of type Sequence<PropertyValue> expected!" ), - uno::Reference< uno::XInterface >(), - 2 ); - - if ( !pDocShell->SetModifyPasswordInfo( aInfo ) ) - throw beans::PropertyVetoException( - "The hash is not allowed to be changed now!" ); + pDocShell->SetSharedXMLFlag( bDocShared ); } - else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) ) +#endif + } + else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) ) + { + uno::Sequence< beans::PropertyValue > aInfo; + if ( !( aValue >>= aInfo ) ) + throw lang::IllegalArgumentException( + OUString( "Value of type Sequence<PropertyValue> expected!" ), + uno::Reference< uno::XInterface >(), + 2 ); + + if ( !pDocShell->SetModifyPasswordInfo( aInfo ) ) + throw beans::PropertyVetoException( + "The hash is not allowed to be changed now!" ); + } + else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) ) + { + bool bVal = false; + if ( aValue >>=bVal ) { - bool bVal = false; - if ( aValue >>=bVal ) - { - pDoc->SetIsUsingEmbededFonts(bVal); - } + rDoc.SetIsUsingEmbededFonts(bVal); } + } + else + { + ScGridOptions aGridOpt(aViewOpt.GetGridOptions()); + if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) ) + aGridOpt.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) ) + aGridOpt.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) ) + aGridOpt.SetFldDrawX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) ) + aGridOpt.SetFldDrawY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) ) + aGridOpt.SetFldDivisionX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) ) + aGridOpt.SetFldDivisionY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) ) + aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); else - { - ScGridOptions aGridOpt(aViewOpt.GetGridOptions()); - if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) ) - aGridOpt.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) ) - aGridOpt.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) ) - aGridOpt.SetFldDrawX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) ) - aGridOpt.SetFldDrawY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) ) - aGridOpt.SetFldDivisionX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) ) - aGridOpt.SetFldDivisionY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) ) - aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else - throw beans::UnknownPropertyException(); - aViewOpt.SetGridOptions(aGridOpt); - } - pDoc->SetViewOptions(aViewOpt); + throw beans::UnknownPropertyException(); + aViewOpt.SetGridOptions(aGridOpt); + } + rDoc.SetViewOptions(aViewOpt); - if ( bUpdateHeights && !pDoc->IsImportingXML() ) - { - // update automatic row heights and repaint - SCTAB nTabCount = pDoc->GetTableCount(); - for (SCTAB nTab=0; nTab<nTabCount; nTab++) - if ( !pDocShell->AdjustRowHeight( 0, MAXROW, nTab ) ) - pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID); - pDocShell->SetDocumentModified(); - } + if ( bUpdateHeights && !rDoc.IsImportingXML() ) + { + // update automatic row heights and repaint + SCTAB nTabCount = rDoc.GetTableCount(); + for (SCTAB nTab=0; nTab<nTabCount; nTab++) + if ( !pDocShell->AdjustRowHeight( 0, MAXROW, nTab ) ) + pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID); + pDocShell->SetDocumentModified(); } - else - throw uno::RuntimeException(); } else throw uno::RuntimeException(); @@ -335,121 +330,116 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr if(pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - if (pDoc) + ScDocument& rDoc = pDocShell->GetDocument(); + const ScViewOptions& aViewOpt = rDoc.GetViewOptions(); + + /*Stampit enable/disable print cancel */ + if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->Stamp_GetPrintCancelState() ); + /*Stampit enable/disable print cancel */ + + else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NULLVALS ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NOTES ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_GRID ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) ) { - const ScViewOptions& aViewOpt = pDoc->GetViewOptions(); - - /*Stampit enable/disable print cancel */ - if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->Stamp_GetPrintCancelState() ); - /*Stampit enable/disable print cancel */ - - else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NULLVALS ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NOTES ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_GRID ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) ) - { - OUString aColorName; - Color aColor = aViewOpt.GetGridColor(&aColorName); - aRet <<= static_cast<sal_Int64>(aColor.GetColor()); - } - else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_PAGEBREAKS ) ); - else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) ) - aRet <<= static_cast<sal_Int16> ( pDoc->GetLinkMode() ); - else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_HEADER ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_TABCONTROLS ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_OUTLINER ) ); - else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->GetAutoCalc() ); - else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) ) - { - // #i75610# don't create the printer, return empty string if no printer created yet - // (as in SwXDocumentSettings) - SfxPrinter* pPrinter = pDoc->GetPrinter( false ); - if (pPrinter) - aRet <<= OUString ( pPrinter->GetName()); - else - aRet <<= OUString(); - } - else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) ) - { - // #i75610# don't create the printer, return empty sequence if no printer created yet - // (as in SwXDocumentSettings) - SfxPrinter* pPrinter = pDoc->GetPrinter( false ); - if (pPrinter) - { - SvMemoryStream aStream; - pPrinter->Store( aStream ); - aStream.Seek ( STREAM_SEEK_TO_END ); - sal_uInt32 nSize = aStream.Tell(); - aStream.Seek ( STREAM_SEEK_TO_BEGIN ); - uno::Sequence < sal_Int8 > aSequence( nSize ); - aStream.Read ( aSequence.getArray(), nSize ); - aRet <<= aSequence; - } - else - aRet <<= uno::Sequence<sal_Int8>(); - } - else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) ) - aRet <<= pDocShell->IsUseUserData(); - else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) ) + OUString aColorName; + Color aColor = aViewOpt.GetGridColor(&aColorName); + aRet <<= static_cast<sal_Int64>(aColor.GetColor()); + } + else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_PAGEBREAKS ) ); + else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) ) + aRet <<= static_cast<sal_Int16> ( rDoc.GetLinkMode() ); + else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_HEADER ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_TABCONTROLS ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_OUTLINER ) ); + else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.GetAutoCalc() ); + else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) ) + { + // #i75610# don't create the printer, return empty string if no printer created yet + // (as in SwXDocumentSettings) + SfxPrinter* pPrinter = rDoc.GetPrinter( false ); + if (pPrinter) + aRet <<= OUString ( pPrinter->GetName()); + else + aRet <<= OUString(); + } + else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) ) + { + // #i75610# don't create the printer, return empty sequence if no printer created yet + // (as in SwXDocumentSettings) + SfxPrinter* pPrinter = rDoc.GetPrinter( false ); + if (pPrinter) { - aRet <<= uno::Reference<i18n::XForbiddenCharacters>(new ScForbiddenCharsObj( pDocShell )); + SvMemoryStream aStream; + pPrinter->Store( aStream ); + aStream.Seek ( STREAM_SEEK_TO_END ); + sal_uInt32 nSize = aStream.Tell(); + aStream.Seek ( STREAM_SEEK_TO_BEGIN ); + uno::Sequence < sal_Int8 > aSequence( nSize ); + aStream.Read ( aSequence.getArray(), nSize ); + aRet <<= aSequence; } - else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) ) - aRet <<= static_cast<sal_Int16> ( pDoc->GetAsianCompression() ); - else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->GetAsianKerning() ); - else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) ) - aRet <<= pDocShell->IsSaveVersionOnClose(); - else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) ) - aRet <<= pDocShell->IsQueryLoadTemplate(); - else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) ) - aRet <<= pDocShell->IsLoadReadonly(); - else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) ) - { + else + aRet <<= uno::Sequence<sal_Int8>(); + } + else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) ) + aRet <<= pDocShell->IsUseUserData(); + else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) ) + { + aRet <<= uno::Reference<i18n::XForbiddenCharacters>(new ScForbiddenCharsObj( pDocShell )); + } + else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) ) + aRet <<= static_cast<sal_Int16> ( rDoc.GetAsianCompression() ); + else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.GetAsianKerning() ); + else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) ) + aRet <<= pDocShell->IsSaveVersionOnClose(); + else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) ) + aRet <<= pDocShell->IsQueryLoadTemplate(); + else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) ) + aRet <<= pDocShell->IsLoadReadonly(); + else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) ) + { #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT - ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->HasSharedXMLFlagSet() ); + ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->HasSharedXMLFlagSet() ); #endif - } - else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) ) - aRet <<= pDocShell->GetModifyPasswordInfo(); - else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) ) - { - aRet <<= pDoc->IsUsingEmbededFonts(); - } + } + else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) ) + aRet <<= pDocShell->GetModifyPasswordInfo(); + else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) ) + { + aRet <<= rDoc.IsUsingEmbededFonts(); + } + else + { + const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions(); + if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetUseGridSnap() ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetGridVisible() ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) ) + aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawX() ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) ) + aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawY() ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) ) + aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionX() ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) ) + aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionY() ); + else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) ) + ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetSynchronize() ); else - { - const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions(); - if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetUseGridSnap() ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetGridVisible() ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) ) - aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawX() ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) ) - aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawY() ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) ) - aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionX() ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) ) - aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionY() ); - else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) ) - ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetSynchronize() ); - else - throw beans::UnknownPropertyException(); - } + throw beans::UnknownPropertyException(); } - else - throw uno::RuntimeException(); } else throw uno::RuntimeException(); diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx index a50792d8cb49..bd203db8ecf9 100644 --- a/sc/source/ui/unoobj/cursuno.cxx +++ b/sc/source/ui/unoobj/cursuno.cxx @@ -110,7 +110,7 @@ void SAL_CALL ScCellCursorObj::collapseToCurrentRegion() throw(uno::RuntimeExcep SCROW nEndRow = aOneRange.aEnd.Row(); SCTAB nTab = aOneRange.aStart.Tab(); - pDocSh->GetDocument()->GetDataArea( + pDocSh->GetDocument().GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, true, false ); ScRange aNew( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab ); @@ -132,11 +132,11 @@ void SAL_CALL ScCellCursorObj::collapseToCurrentArray() ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); ScRange aMatrix; // finding the matrix range is now in GetMatrixFormulaRange in the document - if ( pDoc->GetMatrixFormulaRange( aCursor, aMatrix ) ) + if ( rDoc.GetMatrixFormulaRange( aCursor, aMatrix ) ) { SetNewRange( aMatrix ); } @@ -161,9 +161,9 @@ void SAL_CALL ScCellCursorObj::collapseToMergedArea() throw(uno::RuntimeExceptio OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" ); ScRange aNewRange( *rRanges[ 0 ] ); - ScDocument* pDoc = pDocSh->GetDocument(); - pDoc->ExtendOverlapped( aNewRange ); - pDoc->ExtendMerge( aNewRange ); // after ExtendOverlapped! + ScDocument& rDoc = pDocSh->GetDocument(); + rDoc.ExtendOverlapped( aNewRange ); + rDoc.ExtendMerge( aNewRange ); // after ExtendOverlapped! SetNewRange( aNewRange ); } @@ -245,7 +245,7 @@ void SAL_CALL ScCellCursorObj::gotoStartOfUsedArea(sal_Bool bExpand) SCCOL nUsedX = 0; // Anfang holen SCROW nUsedY = 0; - if (!pDocSh->GetDocument()->GetDataStart( nTab, nUsedX, nUsedY )) + if (!pDocSh->GetDocument().GetDataStart( nTab, nUsedX, nUsedY )) { nUsedX = 0; nUsedY = 0; @@ -273,7 +273,7 @@ void SAL_CALL ScCellCursorObj::gotoEndOfUsedArea( sal_Bool bExpand ) SCCOL nUsedX = 0; // Ende holen SCROW nUsedY = 0; - if (!pDocSh->GetDocument()->GetTableArea( nTab, nUsedX, nUsedY )) + if (!pDocSh->GetDocument().GetTableArea( nTab, nUsedX, nUsedY )) { nUsedX = 0; nUsedY = 0; @@ -309,7 +309,7 @@ void SAL_CALL ScCellCursorObj::gotoStart() throw(uno::RuntimeException, std::exc SCROW nEndRow = aOneRange.aEnd.Row(); SCTAB nTab = aOneRange.aStart.Tab(); - pDocSh->GetDocument()->GetDataArea( + pDocSh->GetDocument().GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, false, false ); ScRange aNew( nStartCol, nStartRow, nTab ); @@ -337,7 +337,7 @@ void SAL_CALL ScCellCursorObj::gotoEnd() throw(uno::RuntimeException, std::excep SCROW nEndRow = aOneRange.aEnd.Row(); SCTAB nTab = aOneRange.aStart.Tab(); - pDocSh->GetDocument()->GetDataArea( + pDocSh->GetDocument().GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, false, false ); ScRange aNew( nEndCol, nEndRow, nTab ); @@ -361,7 +361,7 @@ void SAL_CALL ScCellCursorObj::gotoNext() throw(uno::RuntimeException, std::exce SCTAB nTab = aCursor.Tab(); ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) - pDocSh->GetDocument()->GetNextPos( nNewX,nNewY, nTab, 1,0, false,true, aMark ); + pDocSh->GetDocument().GetNextPos( nNewX,nNewY, nTab, 1,0, false,true, aMark ); //! sonst Exception oder so SetNewRange( ScRange( nNewX, nNewY, nTab ) ); @@ -383,7 +383,7 @@ void SAL_CALL ScCellCursorObj::gotoPrevious() throw(uno::RuntimeException, std:: SCTAB nTab = aCursor.Tab(); ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) - pDocSh->GetDocument()->GetNextPos( nNewX,nNewY, nTab, -1,0, false,true, aMark ); + pDocSh->GetDocument().GetNextPos( nNewX,nNewY, nTab, -1,0, false,true, aMark ); //! sonst Exception oder so SetNewRange( ScRange( nNewX, nNewY, nTab ) ); diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 3ace2c48bd14..ff3d54b1f3e2 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -234,8 +234,8 @@ static ScDPObject* lcl_GetDPObject( ScDocShell* pDocShell, SCTAB nTab, const OUS { if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScDPCollection* pColl = pDoc->GetDPCollection(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScDPCollection* pColl = rDoc.GetDPCollection(); if ( pColl ) { size_t nCount = pColl->GetCount(); @@ -255,8 +255,8 @@ static OUString lcl_CreatePivotName( ScDocShell* pDocShell ) { if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScDPCollection* pColl = pDoc->GetDPCollection(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScDPCollection* pColl = rDoc.GetDPCollection(); if ( pColl ) return pColl->CreateNewName(); } @@ -284,13 +284,13 @@ ScDataPilotTablesObj::ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT) : pDocShell( pDocSh ), nTab( nT ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScDataPilotTablesObj::~ScDataPilotTablesObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScDataPilotTablesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -310,8 +310,8 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nInd { if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScDPCollection* pColl = pDoc->GetDPCollection(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScDPCollection* pColl = rDoc.GetDPCollection(); if ( pColl ) { // count tables on this sheet @@ -459,8 +459,8 @@ sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(RuntimeException, std: SolarMutexGuard aGuard; if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScDPCollection* pColl = pDoc->GetDPCollection(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScDPCollection* pColl = rDoc.GetDPCollection(); if ( pColl ) { // count tables on this sheet @@ -520,8 +520,8 @@ Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames() SolarMutexGuard aGuard; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScDPCollection* pColl = pDoc->GetDPCollection(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScDPCollection* pColl = rDoc.GetDPCollection(); if ( pColl ) { // count tables on this sheet @@ -558,8 +558,8 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName ) SolarMutexGuard aGuard; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScDPCollection* pColl = pDoc->GetDPCollection(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScDPCollection* pColl = rDoc.GetDPCollection(); if ( pColl ) { size_t nCount = pColl->GetCount(); @@ -579,13 +579,13 @@ ScDataPilotDescriptorBase::ScDataPilotDescriptorBase(ScDocShell* pDocSh) : maPropSet( lcl_GetDataPilotDescriptorBaseMap() ), pDocShell( pDocSh ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScDataPilotDescriptorBase::~ScDataPilotDescriptorBase() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } Any SAL_CALL ScDataPilotDescriptorBase::queryInterface( const uno::Type& rType ) @@ -672,7 +672,7 @@ void SAL_CALL ScDataPilotDescriptorBase::setSourceRange( const CellRangeAddress& if (!pDPObject) throw RuntimeException(); - ScSheetSourceDesc aSheetDesc(pDocShell->GetDocument()); + ScSheetSourceDesc aSheetDesc(&pDocShell->GetDocument()); if (pDPObject->IsSheetData()) aSheetDesc = *pDPObject->GetSheetDesc(); @@ -792,7 +792,7 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aProp uno::Sequence<beans::PropertyValue> aArgSeq; if ( aValue >>= aArgSeq ) { - ScImportSourceDesc aImportDesc(pDocShell->GetDocument()); + ScImportSourceDesc aImportDesc(&pDocShell->GetDocument()); const ScImportSourceDesc* pOldDesc = pDPObject->GetImportSourceDesc(); if (pOldDesc) @@ -1351,7 +1351,7 @@ void ScDataPilotTableObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) ScRangeList aRanges; aRanges.Append( aRange ); const ScUpdateRefHint& rRef = static_cast< const ScUpdateRefHint& >( rHint ); - if ( aRanges.UpdateReference( rRef.GetMode(), GetDocShell()->GetDocument(), rRef.GetRange(), + if ( aRanges.UpdateReference( rRef.GetMode(), &GetDocShell()->GetDocument(), rRef.GetRange(), rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ) && aRanges.size() == 1 ) { @@ -1373,14 +1373,14 @@ void ScDataPilotTableObj::Refreshed_Impl() // the EventObject holds a Ref to this object until after the listener calls - ScDocument* pDoc = GetDocShell()->GetDocument(); + ScDocument& rDoc = GetDocShell()->GetDocument(); for ( sal_uInt16 n=0; n<aModifyListeners.size(); n++ ) - pDoc->AddUnoListenerCall( aModifyListeners[n], aEvent ); + rDoc.AddUnoListenerCall( aModifyListeners[n], aEvent ); } ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) : ScDataPilotDescriptorBase( pDocSh ), - mpDPObject(new ScDPObject(pDocSh ? pDocSh->GetDocument() : NULL) ) + mpDPObject(new ScDPObject(pDocSh ? &pDocSh->GetDocument() : NULL) ) { ScDPSaveData aSaveData; // set defaults like in ScPivotParam constructor @@ -1389,7 +1389,7 @@ ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) : aSaveData.SetIgnoreEmptyRows( false ); aSaveData.SetRepeatIfEmpty( false ); mpDPObject->SetSaveData(aSaveData); - ScSheetSourceDesc aSheetDesc(pDocSh ? pDocSh->GetDocument() : NULL); + ScSheetSourceDesc aSheetDesc(pDocSh ? &pDocSh->GetDocument() : NULL); mpDPObject->SetSheetDesc(aSheetDesc); mpDPObject->GetSource(); } diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 09762b1f1402..d1afe899dd3c 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -994,13 +994,13 @@ ScFilterDescriptorBase::ScFilterDescriptorBase(ScDocShell* pDocShell) : pDocSh(pDocShell) { if (pDocSh) - pDocSh->GetDocument()->AddUnoObject(*this); + pDocSh->GetDocument().AddUnoObject(*this); } ScFilterDescriptorBase::~ScFilterDescriptorBase() { if (pDocSh) - pDocSh->GetDocument()->RemoveUnoObject(*this); + pDocSh->GetDocument().RemoveUnoObject(*this); } void ScFilterDescriptorBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -1356,8 +1356,8 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields( SCSIZE nCount = static_cast<SCSIZE>(aFilterFields.getLength()); aParam.Resize( nCount ); - ScDocument* pDoc = pDocSh->GetDocument(); - svl::SharedStringPool& rPool = pDoc->GetSharedStringPool(); + ScDocument& rDoc = pDocSh->GetDocument(); + svl::SharedStringPool& rPool = rDoc.GetSharedStringPool(); const sheet::TableFilterField* pAry = aFilterFields.getConstArray(); SCSIZE i; for (i=0; i<nCount; i++) @@ -1376,7 +1376,7 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields( if (rItem.meType != ScQueryEntry::ByString) { OUString aStr; - pDoc->GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr); + rDoc.GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr); rItem.maString = rPool.intern(aStr); } @@ -1418,7 +1418,7 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields2( SolarMutexGuard aGuard; ScQueryParam aParam; GetData(aParam); - fillQueryParam(aParam, pDocSh->GetDocument(), aFilterFields); + fillQueryParam(aParam, &pDocSh->GetDocument(), aFilterFields); PutData(aParam); } @@ -1429,7 +1429,7 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields3( SolarMutexGuard aGuard; ScQueryParam aParam; GetData(aParam); - fillQueryParam(aParam, pDocSh->GetDocument(), aFilterFields); + fillQueryParam(aParam, &pDocSh->GetDocument(), aFilterFields); PutData(aParam); } @@ -1621,7 +1621,7 @@ void ScDataPilotFilterDescriptor::PutData( const ScQueryParam& rParam ) ScDPObject* pDPObj = pParent->GetDPObject(); if (pDPObj) { - ScSheetSourceDesc aSheetDesc(pParent->GetDocShell()->GetDocument()); + ScSheetSourceDesc aSheetDesc(&pParent->GetDocShell()->GetDocument()); if (pDPObj->IsSheetData()) aSheetDesc = *pDPObj->GetSheetDesc(); aSheetDesc.SetQueryParam(rParam); @@ -1638,7 +1638,7 @@ ScDatabaseRangeObj::ScDatabaseRangeObj(ScDocShell* pDocSh, const OUString& rNm) bIsUnnamed(false), aTab( 0 ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScDatabaseRangeObj::ScDatabaseRangeObj(ScDocShell* pDocSh, const SCTAB nTab) : @@ -1648,13 +1648,13 @@ ScDatabaseRangeObj::ScDatabaseRangeObj(ScDocShell* pDocSh, const SCTAB nTab) : bIsUnnamed(true), aTab( nTab ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScDatabaseRangeObj::~ScDatabaseRangeObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScDatabaseRangeObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -1682,11 +1682,11 @@ ScDBData* ScDatabaseRangeObj::GetDBData_Impl() const { if (bIsUnnamed) { - pRet = pDocShell->GetDocument()->GetAnonymousDBData(aTab); + pRet = pDocShell->GetDocument().GetAnonymousDBData(aTab); } else { - ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection(); + ScDBCollection* pNames = pDocShell->GetDocument().GetDBCollection(); if (pNames) { ScDBData* p = pNames->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(aName)); @@ -2037,13 +2037,13 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue( aNewData.SetAutoFilter(bAutoFilter); ScRange aRange; aNewData.GetArea(aRange); - ScDocument* pDoc = pDocShell->GetDocument(); - if (bAutoFilter && pDoc) - pDoc->ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(), + ScDocument& rDoc = pDocShell->GetDocument(); + if (bAutoFilter) + rDoc.ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aStart.Row(), aRange.aStart.Tab(), SC_MF_AUTO ); - else if (!bAutoFilter && pDoc) - pDoc->RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(), + else if (!bAutoFilter) + rDoc.RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aStart.Row(), aRange.aStart.Tab(), SC_MF_AUTO ); ScRange aPaintRange(aRange.aStart, aRange.aEnd); @@ -2081,12 +2081,12 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue( sal_Int32 nRefresh = 0; if (aValue >>= nRefresh) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); aNewData.SetRefreshDelay(nRefresh); - if (pDoc && pDoc->GetDBCollection()) + if (rDoc.GetDBCollection()) { - aNewData.SetRefreshHandler( pDoc->GetDBCollection()->GetRefreshHandler() ); - aNewData.SetRefreshControl( pDoc->GetRefreshTimerControlAddress() ); + aNewData.SetRefreshHandler( rDoc.GetDBCollection()->GetRefreshHandler() ); + aNewData.SetRefreshControl( &rDoc.GetRefreshTimerControlAddress() ); } } } @@ -2203,13 +2203,13 @@ uno::Sequence<OUString> SAL_CALL ScDatabaseRangeObj::getSupportedServiceNames() ScDatabaseRangesObj::ScDatabaseRangesObj(ScDocShell* pDocSh) : pDocShell( pDocSh ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScDatabaseRangesObj::~ScDatabaseRangesObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScDatabaseRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -2230,7 +2230,7 @@ ScDatabaseRangeObj* ScDatabaseRangesObj::GetObjectByIndex_Impl(size_t nIndex) if (!pDocShell) return NULL; - ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection(); + ScDBCollection* pNames = pDocShell->GetDocument().GetDBCollection(); if (!pNames) return NULL; @@ -2307,7 +2307,7 @@ sal_Int32 SAL_CALL ScDatabaseRangesObj::getCount() throw(uno::RuntimeException, if (pDocShell) { - ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection(); + ScDBCollection* pNames = pDocShell->GetDocument().GetDBCollection(); if (pNames) return static_cast<sal_Int32>(pNames->getNamedDBs().size()); } @@ -2365,7 +2365,7 @@ uno::Sequence<OUString> SAL_CALL ScDatabaseRangesObj::getElementNames() if (pDocShell) { - ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection(); + ScDBCollection* pNames = pDocShell->GetDocument().GetDBCollection(); if (pNames) { const ScDBCollection::NamedDBs& rDBs = pNames->getNamedDBs(); @@ -2389,7 +2389,7 @@ sal_Bool SAL_CALL ScDatabaseRangesObj::hasByName( const OUString& aName ) if (pDocShell) { - ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection(); + ScDBCollection* pNames = pDocShell->GetDocument().GetDBCollection(); if (pNames) return pNames->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(aName)) != NULL; } @@ -2399,13 +2399,13 @@ sal_Bool SAL_CALL ScDatabaseRangesObj::hasByName( const OUString& aName ) ScUnnamedDatabaseRangesObj::ScUnnamedDatabaseRangesObj(ScDocShell* pDocSh) : pDocShell( pDocSh ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScUnnamedDatabaseRangesObj::~ScUnnamedDatabaseRangesObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScUnnamedDatabaseRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -2429,7 +2429,7 @@ void ScUnnamedDatabaseRangesObj::setByTable( const table::CellRangeAddress& aRan bool bDone = false; if (pDocShell) { - if ( pDocShell->GetDocument()->GetTableCount() <= aRange.Sheet ) + if ( pDocShell->GetDocument().GetTableCount() <= aRange.Sheet ) throw lang::IndexOutOfBoundsException(); ScDBDocFunc aFunc(*pDocShell); @@ -2450,7 +2450,7 @@ uno::Any ScUnnamedDatabaseRangesObj::getByTable( sal_Int32 nTab ) SolarMutexGuard aGuard; if (pDocShell) { - if ( pDocShell->GetDocument()->GetTableCount() <= nTab ) + if ( pDocShell->GetDocument().GetTableCount() <= nTab ) throw lang::IndexOutOfBoundsException(); uno::Reference<sheet::XDatabaseRange> xRange( new ScDatabaseRangeObj(pDocShell, static_cast<SCTAB>(nTab))); @@ -2470,9 +2470,9 @@ sal_Bool ScUnnamedDatabaseRangesObj::hasByTable( sal_Int32 nTab ) SolarMutexGuard aGuard; if (pDocShell) { - if (pDocShell->GetDocument()->GetTableCount() <= nTab) + if (pDocShell->GetDocument().GetTableCount() <= nTab) throw lang::IndexOutOfBoundsException(); - if (pDocShell->GetDocument()->GetAnonymousDBData((SCTAB) nTab)) + if (pDocShell->GetDocument().GetAnonymousDBData((SCTAB) nTab)) return true; return false; } diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx index eebb8c72bfc2..1a2527d6b5ea 100644 --- a/sc/source/ui/unoobj/defltuno.cxx +++ b/sc/source/ui/unoobj/defltuno.cxx @@ -77,13 +77,13 @@ ScDocDefaultsObj::ScDocDefaultsObj(ScDocShell* pDocSh) : pDocShell( pDocSh ), aPropertyMap(lcl_GetDocDefaultsMap()) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScDocDefaultsObj::~ScDocDefaultsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScDocDefaultsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -134,35 +134,25 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue( { if(aPropertyName.equalsAscii(SC_UNO_STANDARDDEC) ) { - ScDocument* pDoc = pDocShell->GetDocument(); - if (pDoc) + ScDocument& rDoc = pDocShell->GetDocument(); + ScDocOptions aDocOpt(rDoc.GetDocOptions()); + sal_Int16 nValue = 0; + if (aValue >>= nValue) { - ScDocOptions aDocOpt(pDoc->GetDocOptions()); - sal_Int16 nValue = 0; - if (aValue >>= nValue) - { - aDocOpt.SetStdPrecision(static_cast<sal_uInt16> (nValue)); - pDoc->SetDocOptions(aDocOpt); - } + aDocOpt.SetStdPrecision(static_cast<sal_uInt16> (nValue)); + rDoc.SetDocOptions(aDocOpt); } - else - throw uno::RuntimeException(); } else if (aPropertyName.equalsAscii(SC_UNO_TABSTOPDIS) ) { - ScDocument* pDoc = pDocShell->GetDocument(); - if (pDoc) + ScDocument& rDoc = pDocShell->GetDocument(); + ScDocOptions aDocOpt(rDoc.GetDocOptions()); + sal_Int32 nValue = 0; + if (aValue >>= nValue) { - ScDocOptions aDocOpt(pDoc->GetDocOptions()); - sal_Int32 nValue = 0; - if (aValue >>= nValue) - { - aDocOpt.SetTabDistance(static_cast<sal_uInt16>(HMMToTwips(nValue))); - pDoc->SetDocOptions(aDocOpt); - } + aDocOpt.SetTabDistance(static_cast<sal_uInt16>(HMMToTwips(nValue))); + rDoc.SetDocOptions(aDocOpt); } - else - throw uno::RuntimeException(); } } else if ( pEntry->nWID == ATTR_FONT_LANGUAGE || @@ -181,9 +171,9 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue( else eNew = LANGUAGE_NONE; - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); LanguageType eLatin, eCjk, eCtl; - pDoc->GetLanguage( eLatin, eCjk, eCtl ); + rDoc.GetLanguage( eLatin, eCjk, eCtl ); if ( pEntry->nWID == ATTR_CJK_FONT_LANGUAGE ) eCjk = eNew; @@ -192,12 +182,12 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue( else eLatin = eNew; - pDoc->SetLanguage( eLatin, eCjk, eCtl ); + rDoc.SetLanguage( eLatin, eCjk, eCtl ); } } else { - ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool(); + ScDocumentPool* pPool = pDocShell->GetDocument().GetPool(); SfxPoolItem* pNewItem = pPool->GetDefaultItem(pEntry->nWID).Clone(); if( !pNewItem->PutValue( aValue, pEntry->nMemberId ) ) @@ -230,36 +220,26 @@ uno::Any SAL_CALL ScDocDefaultsObj::getPropertyValue( const OUString& aPropertyN { if(aPropertyName.equalsAscii(SC_UNO_STANDARDDEC) ) { - ScDocument* pDoc = pDocShell->GetDocument(); - if (pDoc) - { - const ScDocOptions& aDocOpt = pDoc->GetDocOptions(); - sal_uInt16 nPrec = aDocOpt.GetStdPrecision(); - // the max value of unsigned 16-bit integer is used as the flag - // value for unlimited precision, c.f. - // SvNumberFormatter::UNLIMITED_PRECISION. - if (nPrec <= ::std::numeric_limits<sal_Int16>::max()) - aRet <<= static_cast<sal_Int16> (nPrec); - } - else - throw uno::RuntimeException(); + ScDocument& rDoc = pDocShell->GetDocument(); + const ScDocOptions& aDocOpt = rDoc.GetDocOptions(); + sal_uInt16 nPrec = aDocOpt.GetStdPrecision(); + // the max value of unsigned 16-bit integer is used as the flag + // value for unlimited precision, c.f. + // SvNumberFormatter::UNLIMITED_PRECISION. + if (nPrec <= ::std::numeric_limits<sal_Int16>::max()) + aRet <<= static_cast<sal_Int16> (nPrec); } else if (aPropertyName.equalsAscii(SC_UNO_TABSTOPDIS) ) { - ScDocument* pDoc = pDocShell->GetDocument(); - if (pDoc) - { - const ScDocOptions& aDocOpt = pDoc->GetDocOptions(); - sal_Int32 nValue (TwipsToEvenHMM(aDocOpt.GetTabDistance())); - aRet <<= nValue; - } - else - throw uno::RuntimeException(); + ScDocument& rDoc = pDocShell->GetDocument(); + const ScDocOptions& aDocOpt = rDoc.GetDocOptions(); + sal_Int32 nValue (TwipsToEvenHMM(aDocOpt.GetTabDistance())); + aRet <<= nValue; } } else { - ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool(); + ScDocumentPool* pPool = pDocShell->GetDocument().GetPool(); const SfxPoolItem& rItem = pPool->GetDefaultItem( pEntry->nWID ); rItem.QueryValue( aRet, pEntry->nMemberId ); } @@ -296,7 +276,7 @@ beans::PropertyState SAL_CALL ScDocDefaultsObj::getPropertyState( const OUString { // check if pool default is set - ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool(); + ScDocumentPool* pPool = pDocShell->GetDocument().GetPool(); if ( pPool->GetPoolDefaultItem( nWID ) != NULL ) eRet = beans::PropertyState_DIRECT_VALUE; } @@ -333,7 +313,7 @@ void SAL_CALL ScDocDefaultsObj::setPropertyToDefault( const OUString& aPropertyN if (pEntry->nWID) { - ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool(); + ScDocumentPool* pPool = pDocShell->GetDocument().GetPool(); pPool->ResetPoolDefaultItem( pEntry->nWID ); ItemsChanged(); @@ -358,7 +338,7 @@ uno::Any SAL_CALL ScDocDefaultsObj::getPropertyDefault( const OUString& aPropert uno::Any aRet; if (pEntry->nWID) { - ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool(); + ScDocumentPool* pPool = pDocShell->GetDocument().GetPool(); const SfxPoolItem* pItem = pPool->GetItem2( pEntry->nWID, SFX_ITEMS_DEFAULT ); if (pItem) pItem->QueryValue( aRet, pEntry->nMemberId ); diff --git a/sc/source/ui/unoobj/dispuno.cxx b/sc/source/ui/unoobj/dispuno.cxx index 0b29ddda4c35..b87ad9be3358 100644 --- a/sc/source/ui/unoobj/dispuno.cxx +++ b/sc/source/ui/unoobj/dispuno.cxx @@ -227,10 +227,10 @@ void SAL_CALL ScDispatch::dispatch( const util::URL& aURL, bool bDone = false; if ( pViewShell && aURL.Complete.equalsAscii(cURLInsertColumns) ) { - ScViewData* pViewData = pViewShell->GetViewData(); - ScAddress aPos( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() ); + ScViewData& rViewData = pViewShell->GetViewData(); + ScAddress aPos( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() ); - ScDBDocFunc aFunc( *pViewData->GetDocShell() ); + ScDBDocFunc aFunc( *rViewData.GetDocShell() ); bDone = aFunc.DoImportUno( aPos, aArgs ); } // cURLDocDataSource is never dispatched diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 75cabca93aee..131f9b7db07d 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -355,14 +355,14 @@ ScModelObj::ScModelObj( ScDocShell* pDocSh ) : // pDocShell may be NULL if this is the base of a ScDocOptionsObj if ( pDocShell ) { - pDocShell->GetDocument()->AddUnoObject(*this); // SfxModel is derived from SfxListener + pDocShell->GetDocument().AddUnoObject(*this); // SfxModel is derived from SfxListener } } ScModelObj::~ScModelObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); if (xNumberAgg.is()) xNumberAgg->setDelegator(uno::Reference<uno::XInterface>()); @@ -381,7 +381,7 @@ uno::Reference< uno::XAggregation> ScModelObj::GetFormatter() comphelper::increment( m_refCount ); // waehrend des queryInterface braucht man ein Ref auf das // SvNumberFormatsSupplierObj, sonst wird es geloescht. - uno::Reference<util::XNumberFormatsSupplier> xFormatter(new SvNumberFormatsSupplierObj(pDocShell->GetDocument()->GetFormatTable() )); + uno::Reference<util::XNumberFormatsSupplier> xFormatter(new SvNumberFormatsSupplierObj(pDocShell->GetDocument().GetFormatTable() )); { xNumberAgg.set(uno::Reference<uno::XAggregation>( xFormatter, uno::UNO_QUERY )); // extra block to force deletion of the temporary before setDelegator @@ -400,7 +400,7 @@ uno::Reference< uno::XAggregation> ScModelObj::GetFormatter() ScDocument* ScModelObj::GetDocument() const { if (pDocShell) - return pDocShell->GetDocument(); + return &pDocShell->GetDocument(); return NULL; } @@ -584,16 +584,16 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // handle "OnCalculate" sheet events (search also for VBA event handlers) if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - if ( pDoc->GetVbaEventProcessor().is() ) + ScDocument& rDoc = pDocShell->GetDocument(); + if ( rDoc.GetVbaEventProcessor().is() ) { // If the VBA event processor is set, HasAnyCalcNotification is much faster than HasAnySheetEventScript - if ( pDoc->HasAnyCalcNotification() && pDoc->HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE, true ) ) + if ( rDoc.HasAnyCalcNotification() && rDoc.HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE, true ) ) HandleCalculateEvents(); } else { - if ( pDoc->HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE ) ) + if ( rDoc.HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE ) ) HandleCalculateEvents(); } } @@ -612,7 +612,7 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SvNumberFormatsSupplierObj::getImplementation( uno::Reference<util::XNumberFormatsSupplier>(xNumberAgg, uno::UNO_QUERY) ); if ( pNumFmt && pDocShell ) - pNumFmt->SetNumberFormatter( pDocShell->GetDocument()->GetFormatTable() ); + pNumFmt->SetNumberFormatter( pDocShell->GetDocument().GetFormatTable() ); } } } @@ -861,12 +861,12 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection, SdrObject *pSdrObj = pShape->GetSdrObject(); if( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - if( pDoc && pSdrObj ) + ScDocument& rDoc = pDocShell->GetDocument(); + if( pSdrObj ) { Rectangle aObjRect = pSdrObj->GetCurrentBoundRect(); SCTAB nCurrentTab = ScDocShell::GetCurTab(); - ScRange aRange = pDoc->GetRange( nCurrentTab, aObjRect ); + ScRange aRange = rDoc.GetRange( nCurrentTab, aObjRect ); rMark.SetMarkArea( aRange ); if( rMark.IsMarked() && !rMark.IsMultiMarked() ) @@ -884,7 +884,7 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection, // render the whole document // -> no selection, all sheets - SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount(); + SCTAB nTabCount = pDocShell->GetDocument().GetTableCount(); for (SCTAB nTab = 0; nTab < nTabCount; nTab++) rMark.SelectTable( nTab, true ); rStatus.SetMode( SC_PRINTSEL_DOCUMENT ); @@ -899,7 +899,7 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection, { uno::Sequence<sal_Int32> aSelected = xSelectedSheets->getSelectedSheets(); ScMarkData::MarkedTabsType aSelectedTabs; - SCTAB nMaxTab = pDocShell->GetDocument()->GetTableCount() -1; + SCTAB nMaxTab = pDocShell->GetDocument().GetTableCount() -1; for (sal_Int32 i = 0, n = aSelected.getLength(); i < n; ++i) { SCTAB nSelected = static_cast<SCTAB>(aSelected[i]); @@ -1119,12 +1119,12 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec throw lang::IllegalArgumentException(); SCTAB nTab = pPrintFuncCache->GetTabForPage( nRenderer ); - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); FmFormView* pDrawView = NULL; // #114135# - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if( pModel ) { @@ -1169,7 +1169,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec Rectangle aArea( pDev->PixelToLogic( Rectangle( 0,0,0,0 ) ) ); sal_Int32 nDestID = pPDFData->CreateDest( aArea ); OUString aTabName; - pDoc->GetName( nTab, aTabName ); + rDoc.GetName( nTab, aTabName ); sal_Int32 nParent = -1; // top-level pPDFData->CreateOutlineItem( nParent, aTabName, nDestID ); } @@ -1178,7 +1178,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec { Rectangle aArea( pDev->PixelToLogic( Rectangle( 0,0,0,0 ) ) ); OUString aTabName; - pDoc->GetName( nTab, aTabName ); + rDoc.GetName( nTab, aTabName ); //need the PDF page number here pPDFData->CreateNamedDest( aTabName, aArea ); } @@ -1207,7 +1207,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec ScRange aTargetRange; Rectangle aTargetRect; // 1/100th mm bool bIsSheet = false; - bool bValid = lcl_ParseTarget( aTarget, aTargetRange, aTargetRect, bIsSheet, pDoc, nTab ); + bool bValid = lcl_ParseTarget( aTarget, aTargetRange, aTargetRect, bIsSheet, &rDoc, nTab ); if ( bValid ) { @@ -1231,7 +1231,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec // get the rectangle of the page's cell range in 1/100th mm ScRange aLocRange = aLocation.aCellRange; - Rectangle aLocationMM = pDoc->GetMMRect( + Rectangle aLocationMM = rDoc.GetMMRect( aLocRange.aStart.Col(), aLocRange.aStart.Row(), aLocRange.aEnd.Col(), aLocRange.aEnd.Row(), aLocRange.aStart.Tab() ); @@ -1385,7 +1385,7 @@ sal_Bool SAL_CALL ScModelObj::isAutomaticCalculationEnabled() throw(uno::Runtime { SolarMutexGuard aGuard; if (pDocShell) - return pDocShell->GetDocument()->GetAutoCalc(); + return pDocShell->GetDocument().GetAutoCalc(); OSL_FAIL("keine DocShell"); //! Exception oder so? return false; @@ -1398,10 +1398,10 @@ void SAL_CALL ScModelObj::enableAutomaticCalculation( sal_Bool bEnabledIn ) SolarMutexGuard aGuard; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - if ( pDoc->GetAutoCalc() != bEnabled ) + ScDocument& rDoc = pDocShell->GetDocument(); + if ( rDoc.GetAutoCalc() != bEnabled ) { - pDoc->SetAutoCalc( bEnabled ); + rDoc.SetAutoCalc( bEnabled ); pDocShell->SetDocumentModified(); } } @@ -1417,7 +1417,7 @@ void SAL_CALL ScModelObj::protect( const OUString& aPassword ) throw(uno::Runtim { SolarMutexGuard aGuard; // #i108245# if already protected, don't change anything - if ( pDocShell && !pDocShell->GetDocument()->IsDocProtected() ) + if ( pDocShell && !pDocShell->GetDocument().IsDocProtected() ) { OUString aString(aPassword); pDocShell->GetDocFunc().Protect( TABLEID_DOC, aString, true ); @@ -1441,7 +1441,7 @@ sal_Bool SAL_CALL ScModelObj::isProtected() throw(uno::RuntimeException, std::ex { SolarMutexGuard aGuard; if (pDocShell) - return pDocShell->GetDocument()->IsDocProtected(); + return pDocShell->GetDocument().IsDocProtected(); OSL_FAIL("keine DocShell"); //! Exception oder so? return false; @@ -1475,9 +1475,9 @@ sheet::GoalResult SAL_CALL ScModelObj::seekGoal( { WaitObject aWait( pDocShell->GetActiveDialogParent() ); OUString aGoalString(aGoalValue); - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); double fValue = 0.0; - bool bFound = pDoc->Solver( + bool bFound = rDoc.Solver( (SCCOL)aFormulaPosition.Column, (SCROW)aFormulaPosition.Row, aFormulaPosition.Sheet, (SCCOL)aVariablePosition.Column, (SCROW)aVariablePosition.Row, aVariablePosition.Sheet, aGoalString, fValue ); @@ -1497,8 +1497,8 @@ uno::Reference<sheet::XConsolidationDescriptor> SAL_CALL ScModelObj::createConso ScConsolidationDescriptor* pNew = new ScConsolidationDescriptor; if ( pDocShell && !bEmpty ) { - ScDocument* pDoc = pDocShell->GetDocument(); - const ScConsolidateParam* pParam = pDoc->GetConsolidateDlgData(); + ScDocument& rDoc = pDocShell->GetDocument(); + const ScConsolidateParam* pParam = rDoc.GetConsolidateDlgData(); if (pParam) pNew->SetParam( *pParam ); } @@ -1527,7 +1527,7 @@ void SAL_CALL ScModelObj::consolidate( { const ScConsolidateParam& rParam = aImpl.GetParam(); pDocShell->DoConsolidate( rParam, true ); - pDocShell->GetDocument()->SetConsolidateDlgData( &rParam ); + pDocShell->GetDocument().SetConsolidateDlgData( &rParam ); } } @@ -1557,7 +1557,7 @@ uno::Reference< container::XIndexAccess > SAL_CALL ScModelObj::getViewData( ) uno::Sequence< beans::PropertyValue > aSeq; aSeq.realloc(1); OUString sName; - pDocShell->GetDocument()->GetName( pDocShell->GetDocument()->GetVisibleTab(), sName ); + pDocShell->GetDocument().GetName( pDocShell->GetDocument().GetVisibleTab(), sName ); OUString sOUName(sName); aSeq[0].Name = SC_ACTIVETABLE; aSeq[0].Value <<= sOUName; @@ -1591,12 +1591,12 @@ void SAL_CALL ScModelObj::setPropertyValue( if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - const ScDocOptions& rOldOpt = pDoc->GetDocOptions(); + 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 = !pDoc->IsImportingXML(); + bool bHardRecalc = !rDoc.IsImportingXML(); bool bOpt = ScDocOptionsHelper::setPropertyValue( aNewOpt, aPropSet.getPropertyMap(), aPropertyName, aValue ); if (bOpt) @@ -1613,16 +1613,16 @@ void SAL_CALL ScModelObj::setPropertyValue( if ( aValue >>= aLocale ) { LanguageType eLatin, eCjk, eCtl; - pDoc->GetLanguage( eLatin, eCjk, eCtl ); + rDoc.GetLanguage( eLatin, eCjk, eCtl ); eLatin = ScUnoConversion::GetLanguage(aLocale); - pDoc->SetLanguage( eLatin, eCjk, eCtl ); + rDoc.SetLanguage( eLatin, eCjk, eCtl ); } } else if ( aString.equalsAscii( SC_UNO_CODENAME ) ) { OUString sCodeName; if ( aValue >>= sCodeName ) - pDoc->SetCodeName( sCodeName ); + rDoc.SetCodeName( sCodeName ); } else if ( aString.equalsAscii( SC_UNO_CJK_CLOCAL ) ) { @@ -1630,9 +1630,9 @@ void SAL_CALL ScModelObj::setPropertyValue( if ( aValue >>= aLocale ) { LanguageType eLatin, eCjk, eCtl; - pDoc->GetLanguage( eLatin, eCjk, eCtl ); + rDoc.GetLanguage( eLatin, eCjk, eCtl ); eCjk = ScUnoConversion::GetLanguage(aLocale); - pDoc->SetLanguage( eLatin, eCjk, eCtl ); + rDoc.SetLanguage( eLatin, eCjk, eCtl ); } } else if ( aString.equalsAscii( SC_UNO_CTL_CLOCAL ) ) @@ -1641,9 +1641,9 @@ void SAL_CALL ScModelObj::setPropertyValue( if ( aValue >>= aLocale ) { LanguageType eLatin, eCjk, eCtl; - pDoc->GetLanguage( eLatin, eCjk, eCtl ); + rDoc.GetLanguage( eLatin, eCjk, eCtl ); eCtl = ScUnoConversion::GetLanguage(aLocale); - pDoc->SetLanguage( eLatin, eCjk, eCtl ); + rDoc.SetLanguage( eLatin, eCjk, eCtl ); } } else if ( aString.equalsAscii( SC_UNO_APPLYFMDES ) ) @@ -1673,25 +1673,25 @@ void SAL_CALL ScModelObj::setPropertyValue( else if ( aString.equalsAscii( SC_UNO_ISUNDOENABLED ) ) { bool bUndoEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue ); - pDoc->EnableUndo( bUndoEnabled ); + rDoc.EnableUndo( bUndoEnabled ); pDocShell->GetUndoManager()->SetMaxUndoActionCount( bUndoEnabled ? officecfg::Office::Common::Undo::Steps::get() : 0); } else if ( aString.equalsAscii( SC_UNO_ISADJUSTHEIGHTENABLED ) ) { - bool bOldAdjustHeightEnabled = pDoc->IsAdjustHeightEnabled(); + bool bOldAdjustHeightEnabled = rDoc.IsAdjustHeightEnabled(); bool bAdjustHeightEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue ); if( bOldAdjustHeightEnabled != bAdjustHeightEnabled ) - pDoc->EnableAdjustHeight( bAdjustHeightEnabled ); + rDoc.EnableAdjustHeight( bAdjustHeightEnabled ); } else if ( aString.equalsAscii( SC_UNO_ISEXECUTELINKENABLED ) ) { - pDoc->EnableExecuteLink( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + rDoc.EnableExecuteLink( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); } else if ( aString.equalsAscii( SC_UNO_ISCHANGEREADONLYENABLED ) ) { - pDoc->EnableChangeReadOnly( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + rDoc.EnableChangeReadOnly( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); } else if ( aString.equalsAscii( "BuildId" ) ) { @@ -1702,7 +1702,7 @@ void SAL_CALL ScModelObj::setPropertyValue( OUString aObjName; aValue >>= aObjName; if ( !aObjName.isEmpty() ) - pDoc->RestoreChartListener( aObjName ); + rDoc.RestoreChartListener( aObjName ); } else if ( aString.equalsAscii( SC_UNO_INTEROPGRABBAG ) ) { @@ -1711,7 +1711,7 @@ void SAL_CALL ScModelObj::setPropertyValue( if ( aNewOpt != rOldOpt ) { - pDoc->SetDocOptions( aNewOpt ); + rDoc.SetDocOptions( aNewOpt ); //! Recalc only for options that need it? if ( bHardRecalc ) pDocShell->DoHardRecalc( true ); @@ -1730,8 +1730,8 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - const ScDocOptions& rOpt = pDoc->GetDocOptions(); + ScDocument& rDoc = pDocShell->GetDocument(); + const ScDocOptions& rOpt = rDoc.GetDocOptions(); aRet = ScDocOptionsHelper::getPropertyValue( rOpt, aPropSet.getPropertyMap(), aPropertyName ); if ( aRet.hasValue() ) { @@ -1740,7 +1740,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) else if ( aString.equalsAscii( SC_UNONAME_CLOCAL ) ) { LanguageType eLatin, eCjk, eCtl; - pDoc->GetLanguage( eLatin, eCjk, eCtl ); + rDoc.GetLanguage( eLatin, eCjk, eCtl ); lang::Locale aLocale; ScUnoConversion::FillLocale( aLocale, eLatin ); @@ -1748,14 +1748,14 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) } else if ( aString.equalsAscii( SC_UNO_CODENAME ) ) { - OUString sCodeName = pDoc->GetCodeName(); + OUString sCodeName = rDoc.GetCodeName(); aRet <<= sCodeName; } else if ( aString.equalsAscii( SC_UNO_CJK_CLOCAL ) ) { LanguageType eLatin, eCjk, eCtl; - pDoc->GetLanguage( eLatin, eCjk, eCtl ); + rDoc.GetLanguage( eLatin, eCjk, eCtl ); lang::Locale aLocale; ScUnoConversion::FillLocale( aLocale, eCjk ); @@ -1764,7 +1764,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) else if ( aString.equalsAscii( SC_UNO_CTL_CLOCAL ) ) { LanguageType eLatin, eCjk, eCtl; - pDoc->GetLanguage( eLatin, eCjk, eCtl ); + rDoc.GetLanguage( eLatin, eCjk, eCtl ); lang::Locale aLocale; ScUnoConversion::FillLocale( aLocale, eCtl ); @@ -1809,14 +1809,14 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) else if ( aString.equalsAscii( SC_UNO_APPLYFMDES ) ) { // default for no model is TRUE - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); bool bOpenInDesign = pModel ? pModel->GetOpenInDesignMode() : sal_True; ScUnoHelpFunctions::SetBoolInAny( aRet, bOpenInDesign ); } else if ( aString.equalsAscii( SC_UNO_AUTOCONTFOC ) ) { // default for no model is FALSE - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); bool bAutoControlFocus = pModel && pModel->GetAutoControlFocus(); ScUnoHelpFunctions::SetBoolInAny( aRet, bAutoControlFocus ); } @@ -1826,7 +1826,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) } else if ( aString.equalsAscii( SC_UNO_HASDRAWPAGES ) ) { - ScUnoHelpFunctions::SetBoolInAny( aRet, (pDocShell->GetDocument()->GetDrawLayer() != 0) ); + ScUnoHelpFunctions::SetBoolInAny( aRet, (pDocShell->GetDocument().GetDrawLayer() != 0) ); } else if ( aString.equalsAscii( SC_UNO_BASICLIBRARIES ) ) { @@ -1859,24 +1859,24 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) } else if ( aString.equalsAscii( SC_UNO_ISUNDOENABLED ) ) { - ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->IsUndoEnabled() ); + ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsUndoEnabled() ); } else if ( aString.equalsAscii( SC_UNO_ISADJUSTHEIGHTENABLED ) ) { - ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->IsAdjustHeightEnabled() ); + ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsAdjustHeightEnabled() ); } else if ( aString.equalsAscii( SC_UNO_ISEXECUTELINKENABLED ) ) { - ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->IsExecuteLinkEnabled() ); + ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsExecuteLinkEnabled() ); } else if ( aString.equalsAscii( SC_UNO_ISCHANGEREADONLYENABLED ) ) { - ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->IsChangeReadOnlyEnabled() ); + ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsChangeReadOnlyEnabled() ); } else if ( aString.equalsAscii( SC_UNO_REFERENCEDEVICE ) ) { VCLXDevice* pXDev = new VCLXDevice(); - pXDev->SetOutputDevice( pDoc->GetRefDevice() ); + pXDev->SetOutputDevice( rDoc.GetRefDevice() ); aRet <<= uno::Reference< awt::XDevice >( pXDev ); } else if ( aString.equalsAscii( "BuildId" ) ) @@ -2130,7 +2130,7 @@ bool ScModelObj::HasChangesListeners() const return true; // "change" event set in any sheet? - return pDocShell && pDocShell->GetDocument()->HasAnySheetEventScript(SC_SHEETEVENT_CHANGE); + return pDocShell && pDocShell->GetDocument().HasAnySheetEventScript(SC_SHEETEVENT_CHANGE); } void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& rRanges, @@ -2183,13 +2183,13 @@ void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& r { ScMarkData aMarkData; aMarkData.MarkFromRangeList( rRanges, false ); - ScDocument* pDoc = pDocShell->GetDocument(); - SCTAB nTabCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + SCTAB nTabCount = rDoc.GetTableCount(); ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end(); for (; itr != itrEnd && *itr < nTabCount; ++itr) { SCTAB nTab = *itr; - const ScSheetEvents* pEvents = pDoc->GetSheetEvents(nTab); + const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab); if (pEvents) { const OUString* pScript = pEvents->GetScript(SC_SHEETEVENT_CHANGE); @@ -2237,17 +2237,17 @@ void ScModelObj::HandleCalculateEvents() { if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); // don't call events before the document is visible // (might also set a flag on SFX_EVENT_LOADFINISHED and only disable while loading) - if ( pDoc->IsDocVisible() ) + if ( rDoc.IsDocVisible() ) { - SCTAB nTabCount = pDoc->GetTableCount(); + SCTAB nTabCount = rDoc.GetTableCount(); for (SCTAB nTab = 0; nTab < nTabCount; nTab++) { - if (pDoc->HasCalcNotification(nTab)) + if (rDoc.HasCalcNotification(nTab)) { - if (const ScSheetEvents* pEvents = pDoc->GetSheetEvents( nTab )) + if (const ScSheetEvents* pEvents = rDoc.GetSheetEvents( nTab )) { if (const OUString* pScript = pEvents->GetScript(SC_SHEETEVENT_CALCULATE)) { @@ -2261,7 +2261,7 @@ void ScModelObj::HandleCalculateEvents() try { - uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW ); + 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( SC_SHEETEVENT_CALCULATE ), aArgs ); @@ -2272,7 +2272,7 @@ void ScModelObj::HandleCalculateEvents() } } } - pDoc->ResetCalcNotifications(); + rDoc.ResetCalcNotifications(); } } @@ -2380,13 +2380,13 @@ uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms() ScDrawPagesObj::ScDrawPagesObj(ScDocShell* pDocSh) : pDocShell( pDocSh ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScDrawPagesObj::~ScDrawPagesObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScDrawPagesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -2406,7 +2406,7 @@ uno::Reference<drawing::XDrawPage> ScDrawPagesObj::GetObjectByIndex_Impl(sal_Int { ScDrawLayer* pDrawLayer = pDocShell->MakeDrawLayer(); OSL_ENSURE(pDrawLayer,"kann Draw-Layer nicht anlegen"); - if ( pDrawLayer && nIndex >= 0 && nIndex < pDocShell->GetDocument()->GetTableCount() ) + if ( pDrawLayer && nIndex >= 0 && nIndex < pDocShell->GetDocument().GetTableCount() ) { SdrPage* pPage = pDrawLayer->GetPage((sal_uInt16)nIndex); OSL_ENSURE(pPage,"Draw-Page nicht gefunden"); @@ -2429,7 +2429,7 @@ uno::Reference<drawing::XDrawPage> SAL_CALL ScDrawPagesObj::insertNewByIndex( sa if (pDocShell) { OUString aNewName; - pDocShell->GetDocument()->CreateValidTabName(aNewName); + pDocShell->GetDocument().CreateValidTabName(aNewName); if ( pDocShell->GetDocFunc().InsertTable( static_cast<SCTAB>(nPos), aNewName, true, true ) ) xRet.set(GetObjectByIndex_Impl( nPos )); @@ -2459,7 +2459,7 @@ sal_Int32 SAL_CALL ScDrawPagesObj::getCount() throw(uno::RuntimeException, std:: { SolarMutexGuard aGuard; if (pDocShell) - return pDocShell->GetDocument()->GetTableCount(); + return pDocShell->GetDocument().GetTableCount(); return 0; } @@ -2490,13 +2490,13 @@ sal_Bool SAL_CALL ScDrawPagesObj::hasElements() throw(uno::RuntimeException, std ScTableSheetsObj::ScTableSheetsObj(ScDocShell* pDocSh) : pDocShell( pDocSh ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScTableSheetsObj::~ScTableSheetsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScTableSheetsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -2514,7 +2514,7 @@ void ScTableSheetsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) ScTableSheetObj* ScTableSheetsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const { - if ( pDocShell && nIndex >= 0 && nIndex < pDocShell->GetDocument()->GetTableCount() ) + if ( pDocShell && nIndex >= 0 && nIndex < pDocShell->GetDocument().GetTableCount() ) return new ScTableSheetObj( pDocShell, static_cast<SCTAB>(nIndex) ); return NULL; @@ -2525,7 +2525,7 @@ ScTableSheetObj* ScTableSheetsObj::GetObjectByName_Impl(const OUString& aName) c if (pDocShell) { SCTAB nIndex; - if ( pDocShell->GetDocument()->GetTable( aName, nIndex ) ) + if ( pDocShell->GetDocument().GetTable( aName, nIndex ) ) return new ScTableSheetObj( pDocShell, nIndex ); } return NULL; @@ -2553,7 +2553,7 @@ void SAL_CALL ScTableSheetsObj::moveByName( const OUString& aName, sal_Int16 nDe if (pDocShell) { SCTAB nSource; - if ( pDocShell->GetDocument()->GetTable( aName, nSource ) ) + if ( pDocShell->GetDocument().GetTable( aName, nSource ) ) bDone = pDocShell->MoveTable( nSource, nDestination, false, true ); } if (!bDone) @@ -2570,14 +2570,14 @@ void SAL_CALL ScTableSheetsObj::copyByName( const OUString& aName, { OUString aNewStr(aCopy); SCTAB nSource; - if ( pDocShell->GetDocument()->GetTable( aName, nSource ) ) + if ( pDocShell->GetDocument().GetTable( aName, nSource ) ) { bDone = pDocShell->MoveTable( nSource, nDestination, true, true ); if (bDone) { // #i92477# any index past the last sheet means "append" in MoveTable SCTAB nResultTab = static_cast<SCTAB>(nDestination); - SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount(); // count after copying + SCTAB nTabCount = pDocShell->GetDocument().GetTableCount(); // count after copying if (nResultTab >= nTabCount) nResultTab = nTabCount - 1; @@ -2608,17 +2608,17 @@ void SAL_CALL ScTableSheetsObj::insertByName( const OUString& aName, const uno:: ScTableSheetObj* pSheetObj = ScTableSheetObj::getImplementation( xInterface ); if ( pSheetObj && !pSheetObj->GetDocShell() ) // noch nicht eingefuegt? { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); OUString aNamStr(aName); SCTAB nDummy; - if ( pDoc->GetTable( aNamStr, nDummy ) ) + if ( rDoc.GetTable( aNamStr, nDummy ) ) { // name already exists throw container::ElementExistException(); } else { - SCTAB nPosition = pDoc->GetTableCount(); + SCTAB nPosition = rDoc.GetTableCount(); bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aNamStr, true, true ); if (bDone) @@ -2661,7 +2661,7 @@ void SAL_CALL ScTableSheetsObj::replaceByName( const OUString& aName, const uno: if ( pSheetObj && !pSheetObj->GetDocShell() ) // noch nicht eingefuegt? { SCTAB nPosition; - if ( pDocShell->GetDocument()->GetTable( aName, nPosition ) ) + if ( pDocShell->GetDocument().GetTable( aName, nPosition ) ) { if ( pDocShell->GetDocFunc().DeleteTable( nPosition, true, true ) ) { @@ -2703,7 +2703,7 @@ void SAL_CALL ScTableSheetsObj::removeByName( const OUString& aName ) if (pDocShell) { SCTAB nIndex; - if ( pDocShell->GetDocument()->GetTable( aName, nIndex ) ) + if ( pDocShell->GetDocument().GetTable( aName, nIndex ) ) bDone = pDocShell->GetDocFunc().DeleteTable( nIndex, true, true ); else // not found throw container::NoSuchElementException(); @@ -2719,7 +2719,7 @@ sal_Int32 ScTableSheetsObj::importSheet( throw( lang::IllegalArgumentException, lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception ) { //pDocShell is the destination - ScDocument* pDocDest = pDocShell->GetDocument(); + ScDocument& rDocDest = pDocShell->GetDocument(); // Source document docShell if ( !xDocSrc.is() ) @@ -2729,11 +2729,11 @@ sal_Int32 ScTableSheetsObj::importSheet( // SourceSheet Position and does srcName exists ? SCTAB nIndexSrc; - if ( !pDocShellSrc->GetDocument()->GetTable( srcName, nIndexSrc ) ) + if ( !pDocShellSrc->GetDocument().GetTable( srcName, nIndexSrc ) ) throw lang::IllegalArgumentException(); // Check the validity of destination index. - SCTAB nCount = pDocDest->GetTableCount(); + SCTAB nCount = rDocDest.GetTableCount(); SCTAB nIndexDest = static_cast<SCTAB>(nDestPosition); if (nIndexDest > nCount || nIndexDest < 0) throw lang::IndexOutOfBoundsException(); @@ -2778,8 +2778,8 @@ uno::Sequence < uno::Reference< table::XCellRange > > SAL_CALL ScTableSheetsObj: uno::Sequence < uno::Reference < table::XCellRange > > xRet; ScRangeList aRangeList; - ScDocument* pDoc = pDocShell->GetDocument(); - if (ScRangeStringConverter::GetRangeListFromString( aRangeList, aRange, pDoc, ::formula::FormulaGrammar::CONV_OOO, ';' )) + ScDocument& rDoc = pDocShell->GetDocument(); + if (ScRangeStringConverter::GetRangeListFromString( aRangeList, aRange, &rDoc, ::formula::FormulaGrammar::CONV_OOO, ';' )) { size_t nCount = aRangeList.size(); if (nCount) @@ -2815,7 +2815,7 @@ sal_Int32 SAL_CALL ScTableSheetsObj::getCount() throw(uno::RuntimeException, std { SolarMutexGuard aGuard; if (pDocShell) - return pDocShell->GetDocument()->GetTableCount(); + return pDocShell->GetDocument().GetTableCount(); return 0; } @@ -2864,14 +2864,14 @@ uno::Sequence<OUString> SAL_CALL ScTableSheetsObj::getElementNames() SolarMutexGuard aGuard; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - SCTAB nCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + SCTAB nCount = rDoc.GetTableCount(); OUString aName; uno::Sequence<OUString> aSeq(nCount); OUString* pAry = aSeq.getArray(); for (SCTAB i=0; i<nCount; i++) { - pDoc->GetName( i, aName ); + rDoc.GetName( i, aName ); pAry[i] = aName; } return aSeq; @@ -2886,7 +2886,7 @@ sal_Bool SAL_CALL ScTableSheetsObj::hasByName( const OUString& aName ) if (pDocShell) { SCTAB nIndex; - if ( pDocShell->GetDocument()->GetTable( aName, nIndex ) ) + if ( pDocShell->GetDocument().GetTable( aName, nIndex ) ) return sal_True; } return false; @@ -2898,13 +2898,13 @@ ScTableColumnsObj::ScTableColumnsObj(ScDocShell* pDocSh, SCTAB nT, SCCOL nSC, SC nStartCol( nSC ), nEndCol ( nEC ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScTableColumnsObj::~ScTableColumnsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScTableColumnsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -3120,7 +3120,7 @@ uno::Any SAL_CALL ScTableColumnsObj::getPropertyValue( const OUString& aProperty if (!pDocShell) throw uno::RuntimeException(); - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); OUString aNameString(aPropertyName); uno::Any aAny; @@ -3129,27 +3129,27 @@ uno::Any SAL_CALL ScTableColumnsObj::getPropertyValue( const OUString& aProperty if ( aNameString.equalsAscii( SC_UNONAME_CELLWID ) ) { // for hidden column, return original height - sal_uInt16 nWidth = pDoc->GetOriginalWidth( nStartCol, nTab ); + sal_uInt16 nWidth = rDoc.GetOriginalWidth( nStartCol, nTab ); aAny <<= (sal_Int32)TwipsToHMM(nWidth); } else if ( aNameString.equalsAscii( SC_UNONAME_CELLVIS ) ) { - bool bVis = !pDoc->ColHidden(nStartCol, nTab); + bool bVis = !rDoc.ColHidden(nStartCol, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, bVis ); } else if ( aNameString.equalsAscii( SC_UNONAME_OWIDTH ) ) { - bool bOpt = !(pDoc->GetColFlags( nStartCol, nTab ) & CR_MANUALSIZE); + bool bOpt = !(rDoc.GetColFlags( nStartCol, nTab ) & CR_MANUALSIZE); ScUnoHelpFunctions::SetBoolInAny( aAny, bOpt ); } else if ( aNameString.equalsAscii( SC_UNONAME_NEWPAGE ) ) { - ScBreakType nBreak = pDoc->HasColBreak(nStartCol, nTab); + ScBreakType nBreak = rDoc.HasColBreak(nStartCol, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, nBreak ); } else if ( aNameString.equalsAscii( SC_UNONAME_MANPAGE ) ) { - ScBreakType nBreak = pDoc->HasColBreak(nStartCol, nTab); + ScBreakType nBreak = rDoc.HasColBreak(nStartCol, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, (nBreak & BREAK_MANUAL) != 0 ); } @@ -3164,13 +3164,13 @@ ScTableRowsObj::ScTableRowsObj(ScDocShell* pDocSh, SCTAB nT, SCROW nSR, SCROW nE nStartRow( nSR ), nEndRow ( nER ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScTableRowsObj::~ScTableRowsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScTableRowsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -3292,20 +3292,20 @@ void SAL_CALL ScTableRowsObj::setPropertyValue( throw uno::RuntimeException(); ScDocFunc& rFunc = pDocShell->GetDocFunc(); - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); std::vector<sc::ColRowSpan> aRowArr(1, sc::ColRowSpan(nStartRow,nEndRow)); OUString aNameString(aPropertyName); if ( aNameString.equalsAscii( SC_UNONAME_OHEIGHT ) ) { sal_Int32 nNewHeight = 0; - if ( pDoc->IsImportingXML() && ( aValue >>= nNewHeight ) ) + if ( rDoc.IsImportingXML() && ( aValue >>= nNewHeight ) ) { // used to set the stored row height for rows with optimal height when loading. // TODO: It's probably cleaner to use a different property name // for this. - pDoc->SetRowHeightOnly( nStartRow, nEndRow, nTab, (sal_uInt16)HMMToTwips(nNewHeight) ); + rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, (sal_uInt16)HMMToTwips(nNewHeight) ); } else { @@ -3323,13 +3323,13 @@ void SAL_CALL ScTableRowsObj::setPropertyValue( sal_Int32 nNewHeight = 0; if ( aValue >>= nNewHeight ) { - if (pDoc->IsImportingXML()) + if (rDoc.IsImportingXML()) { // TODO: This is a band-aid fix. Eventually we need to // re-work ods' style import to get it to set styles to // ScDocument directly. - pDoc->SetRowHeightOnly( nStartRow, nEndRow, nTab, (sal_uInt16)HMMToTwips(nNewHeight) ); - pDoc->SetManualHeight( nStartRow, nEndRow, nTab, true ); + rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, (sal_uInt16)HMMToTwips(nNewHeight) ); + rDoc.SetManualHeight( nStartRow, nEndRow, nTab, true ); } else rFunc.SetWidthOrHeight( @@ -3347,15 +3347,15 @@ void SAL_CALL ScTableRowsObj::setPropertyValue( { // #i116460# Shortcut to only set the flag, without drawing layer update etc. // Should only be used from import filters. - pDoc->SetRowHidden(nStartRow, nEndRow, nTab, !ScUnoHelpFunctions::GetBoolFromAny( aValue )); + rDoc.SetRowHidden(nStartRow, nEndRow, nTab, !ScUnoHelpFunctions::GetBoolFromAny( aValue )); } else if ( aNameString.equalsAscii( SC_UNONAME_CELLFILT ) ) { //! undo etc. if (ScUnoHelpFunctions::GetBoolFromAny( aValue )) - pDoc->SetRowFiltered(nStartRow, nEndRow, nTab, true); + rDoc.SetRowFiltered(nStartRow, nEndRow, nTab, true); else - pDoc->SetRowFiltered(nStartRow, nEndRow, nTab, false); + rDoc.SetRowFiltered(nStartRow, nEndRow, nTab, false); } else if ( aNameString.equalsAscii( SC_UNONAME_NEWPAGE) || aNameString.equalsAscii( SC_UNONAME_MANPAGE) ) { @@ -3389,7 +3389,7 @@ uno::Any SAL_CALL ScTableRowsObj::getPropertyValue( const OUString& aPropertyNam if (!pDocShell) throw uno::RuntimeException(); - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); OUString aNameString(aPropertyName); uno::Any aAny; @@ -3398,33 +3398,33 @@ uno::Any SAL_CALL ScTableRowsObj::getPropertyValue( const OUString& aPropertyNam if ( aNameString.equalsAscii( SC_UNONAME_CELLHGT ) ) { // for hidden row, return original height - sal_uInt16 nHeight = pDoc->GetOriginalHeight( nStartRow, nTab ); + sal_uInt16 nHeight = rDoc.GetOriginalHeight( nStartRow, nTab ); aAny <<= (sal_Int32)TwipsToHMM(nHeight); } else if ( aNameString.equalsAscii( SC_UNONAME_CELLVIS ) ) { SCROW nLastRow; - bool bVis = !pDoc->RowHidden(nStartRow, nTab, NULL, &nLastRow); + bool bVis = !rDoc.RowHidden(nStartRow, nTab, NULL, &nLastRow); ScUnoHelpFunctions::SetBoolInAny( aAny, bVis ); } else if ( aNameString.equalsAscii( SC_UNONAME_CELLFILT ) ) { - bool bVis = pDoc->RowFiltered(nStartRow, nTab); + bool bVis = rDoc.RowFiltered(nStartRow, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, bVis ); } else if ( aNameString.equalsAscii( SC_UNONAME_OHEIGHT ) ) { - bool bOpt = !(pDoc->GetRowFlags( nStartRow, nTab ) & CR_MANUALSIZE); + bool bOpt = !(rDoc.GetRowFlags( nStartRow, nTab ) & CR_MANUALSIZE); ScUnoHelpFunctions::SetBoolInAny( aAny, bOpt ); } else if ( aNameString.equalsAscii( SC_UNONAME_NEWPAGE ) ) { - ScBreakType nBreak = pDoc->HasRowBreak(nStartRow, nTab); + ScBreakType nBreak = rDoc.HasRowBreak(nStartRow, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, nBreak ); } else if ( aNameString.equalsAscii( SC_UNONAME_MANPAGE ) ) { - ScBreakType nBreak = pDoc->HasRowBreak(nStartRow, nTab); + ScBreakType nBreak = rDoc.HasRowBreak(nStartRow, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, (nBreak & BREAK_MANUAL) != 0 ); } else if ( aNameString.equalsAscii( SC_UNONAME_CELLBACK ) || aNameString.equalsAscii( SC_UNONAME_CELLTRAN ) ) @@ -3445,7 +3445,7 @@ SC_IMPL_DUMMY_PROPERTY_LISTENER( ScTableRowsObj ) ScSpreadsheetSettingsObj::~ScSpreadsheetSettingsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScSpreadsheetSettingsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -3491,13 +3491,13 @@ ScAnnotationsObj::ScAnnotationsObj(ScDocShell* pDocSh, SCTAB nT) : pDocShell( pDocSh ), nTab( nT ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScAnnotationsObj::~ScAnnotationsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScAnnotationsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -3516,8 +3516,8 @@ bool ScAnnotationsObj::GetAddressByIndex_Impl( sal_Int32 nIndex, ScAddress& rPos if (!pDocShell) return false; - ScDocument* pDoc = pDocShell->GetDocument(); - rPos = pDoc->GetNotePosition(nIndex); + ScDocument& rDoc = pDocShell->GetDocument(); + rPos = rDoc.GetNotePosition(nIndex); return rPos.IsValid(); } @@ -3584,10 +3584,10 @@ sal_Int32 SAL_CALL ScAnnotationsObj::getCount() sal_Int32 nCount = 0; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); const ScRangeList aRangeList( ScRange( 0, 0, nTab, MAXCOL, MAXROW, nTab) ); std::vector<sc::NoteEntry> rNotes; - pDoc->GetNotesInRange(aRangeList, rNotes); + rDoc.GetNotesInRange(aRangeList, rNotes); nCount = rNotes.size(); } return nCount; @@ -3621,13 +3621,13 @@ ScScenariosObj::ScScenariosObj(ScDocShell* pDocSh, SCTAB nT) : pDocShell( pDocSh ), nTab ( nT ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScScenariosObj::~ScScenariosObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScScenariosObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -3652,10 +3652,10 @@ bool ScScenariosObj::GetScenarioIndex_Impl( const OUString& rName, SCTAB& rIndex if ( pDocShell ) { OUString aTabName; - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nCount = (SCTAB)getCount(); for (SCTAB i=0; i<nCount; i++) - if (pDoc->GetName( nTab+i+1, aTabName )) + if (rDoc.GetName( nTab+i+1, aTabName )) if (aTabName.equals(rName)) { rIndex = i; @@ -3745,12 +3745,12 @@ sal_Int32 SAL_CALL ScScenariosObj::getCount() throw(uno::RuntimeException, std:: SCTAB nCount = 0; if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - if (!pDoc->IsScenario(nTab)) + ScDocument& rDoc = pDocShell->GetDocument(); + if (!rDoc.IsScenario(nTab)) { - SCTAB nTabCount = pDoc->GetTableCount(); + SCTAB nTabCount = rDoc.GetTableCount(); SCTAB nNext = nTab + 1; - while (nNext < nTabCount && pDoc->IsScenario(nNext)) + while (nNext < nTabCount && rDoc.IsScenario(nNext)) { ++nCount; ++nNext; @@ -3806,10 +3806,10 @@ uno::Sequence<OUString> SAL_CALL ScScenariosObj::getElementNames() if ( pDocShell ) // sonst ist auch Count = 0 { OUString aTabName; - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); OUString* pAry = aSeq.getArray(); for (SCTAB i=0; i<nCount; i++) - if (pDoc->GetName( nTab+i+1, aTabName )) + if (rDoc.GetName( nTab+i+1, aTabName )) pAry[i] = aTabName; } diff --git a/sc/source/ui/unoobj/drdefuno.cxx b/sc/source/ui/unoobj/drdefuno.cxx index 8aa8fda0ed5f..b382b17da612 100644 --- a/sc/source/ui/unoobj/drdefuno.cxx +++ b/sc/source/ui/unoobj/drdefuno.cxx @@ -30,13 +30,13 @@ ScDrawDefaultsObj::ScDrawDefaultsObj(ScDocShell* pDocSh) : // SvxUnoDrawPool is initialized without model, // draw layer is created on demand in getModelPool - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScDrawDefaultsObj::~ScDrawDefaultsObj() throw () { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScDrawDefaultsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -57,7 +57,7 @@ SfxItemPool* ScDrawDefaultsObj::getModelPool( bool bReadOnly ) throw() if ( pDocShell ) { ScDrawLayer* pModel = bReadOnly ? - pDocShell->GetDocument()->GetDrawLayer() : + pDocShell->GetDocument().GetDrawLayer() : pDocShell->MakeDrawLayer(); if ( pModel ) pRet = &pModel->GetItemPool(); diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx index ff1fa5e33c2b..85ab77eb3e02 100644 --- a/sc/source/ui/unoobj/editsrc.cxx +++ b/sc/source/ui/unoobj/editsrc.cxx @@ -112,7 +112,7 @@ ScAnnotationEditSource::ScAnnotationEditSource(ScDocShell* pDocSh, const ScAddre bDataValid( false ) { if (pDocShell) - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScAnnotationEditSource::~ScAnnotationEditSource() @@ -120,7 +120,7 @@ ScAnnotationEditSource::~ScAnnotationEditSource() SolarMutexGuard aGuard; // needed for EditEngine dtor if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); delete pForwarder; delete pEditEngine; @@ -133,7 +133,7 @@ SvxEditSource* ScAnnotationEditSource::Clone() const SdrObject* ScAnnotationEditSource::GetCaptionObj() { - ScPostIt* pNote = pDocShell->GetDocument()->GetNote(aCellPos); + ScPostIt* pNote = pDocShell->GetDocument().GetNote(aCellPos); return pNote ? pNote->GetOrCreateCaption( aCellPos ) : 0; } @@ -144,7 +144,7 @@ SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder() // Notizen haben keine Felder if ( pDocShell ) { - pEditEngine = new ScNoteEditEngine( pDocShell->GetDocument()->GetNoteEngine() ); + pEditEngine = new ScNoteEditEngine( pDocShell->GetDocument().GetNoteEngine() ); } else { @@ -159,7 +159,7 @@ SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder() return pForwarder; if ( pDocShell ) - if ( ScPostIt* pNote = pDocShell->GetDocument()->GetNote(aCellPos) ) + if ( ScPostIt* pNote = pDocShell->GetDocument().GetNote(aCellPos) ) if ( const EditTextObject* pEditObj = pNote->GetEditTextObject() ) pEditEngine->SetText( *pEditObj ); // incl. Umbrueche diff --git a/sc/source/ui/unoobj/eventuno.cxx b/sc/source/ui/unoobj/eventuno.cxx index e72d8062324b..14a7af9eaf8e 100644 --- a/sc/source/ui/unoobj/eventuno.cxx +++ b/sc/source/ui/unoobj/eventuno.cxx @@ -33,13 +33,13 @@ ScSheetEventsObj::ScSheetEventsObj(ScDocShell* pDocSh, SCTAB nT) : mpDocShell( pDocSh ), mnTab( nT ) { - mpDocShell->GetDocument()->AddUnoObject(*this); + mpDocShell->GetDocument().AddUnoObject(*this); } ScSheetEventsObj::~ScSheetEventsObj() { if (mpDocShell) - mpDocShell->GetDocument()->RemoveUnoObject(*this); + mpDocShell->GetDocument().RemoveUnoObject(*this); } void ScSheetEventsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -76,7 +76,7 @@ void SAL_CALL ScSheetEventsObj::replaceByName( const OUString& aName, const uno: throw container::NoSuchElementException(); ScSheetEvents aNewEvents; - const ScSheetEvents* pOldEvents = mpDocShell->GetDocument()->GetSheetEvents(mnTab); + const ScSheetEvents* pOldEvents = mpDocShell->GetDocument().GetSheetEvents(mnTab); if (pOldEvents) aNewEvents = *pOldEvents; @@ -110,7 +110,7 @@ void SAL_CALL ScSheetEventsObj::replaceByName( const OUString& aName, const uno: else aNewEvents.SetScript( nEvent, NULL ); // reset - mpDocShell->GetDocument()->SetSheetEvents( mnTab, &aNewEvents ); + mpDocShell->GetDocument().SetSheetEvents( mnTab, &aNewEvents ); mpDocShell->SetDocumentModified(); } @@ -127,7 +127,7 @@ uno::Any SAL_CALL ScSheetEventsObj::getByName( const OUString& aName ) const OUString* pScript = NULL; if (mpDocShell) { - const ScSheetEvents* pEvents = mpDocShell->GetDocument()->GetSheetEvents(mnTab); + const ScSheetEvents* pEvents = mpDocShell->GetDocument().GetSheetEvents(mnTab); if (pEvents) pScript = pEvents->GetScript(nEvent); } diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 8021562df8a0..a43e5448e7e1 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -284,7 +284,7 @@ ScCellFieldsObj::ScCellFieldsObj( aCellPos( rPos ), mpRefreshListeners( NULL ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); mpEditSource = new ScCellEditSource( pDocShell, aCellPos ); } @@ -292,7 +292,7 @@ ScCellFieldsObj::ScCellFieldsObj( ScCellFieldsObj::~ScCellFieldsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); delete mpEditSource; diff --git a/sc/source/ui/unoobj/forbiuno.cxx b/sc/source/ui/unoobj/forbiuno.cxx index e6843c0f94e0..bfaa5a2196b9 100644 --- a/sc/source/ui/unoobj/forbiuno.cxx +++ b/sc/source/ui/unoobj/forbiuno.cxx @@ -29,15 +29,15 @@ static rtl::Reference<SvxForbiddenCharactersTable> lcl_GetForbidden( ScDocShell* rtl::Reference<SvxForbiddenCharactersTable> xRet; if ( pDocSh ) { - ScDocument* pDoc = pDocSh->GetDocument(); - xRet = pDoc->GetForbiddenCharacters(); + ScDocument& rDoc = pDocSh->GetDocument(); + xRet = rDoc.GetForbiddenCharacters(); if ( !xRet.is() ) { // create an empty SvxForbiddenCharactersTable for SvxUnoForbiddenCharsTable, // so changes can be stored. xRet = new SvxForbiddenCharactersTable( comphelper::getProcessComponentContext() ); - pDoc->SetForbiddenCharacters( xRet ); + rDoc.SetForbiddenCharacters( xRet ); } } return xRet; @@ -48,13 +48,13 @@ ScForbiddenCharsObj::ScForbiddenCharsObj( ScDocShell* pDocSh ) : pDocShell( pDocSh ) { if (pDocShell) - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScForbiddenCharsObj::~ScForbiddenCharsObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScForbiddenCharsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -70,7 +70,7 @@ void ScForbiddenCharsObj::onChange() { if (pDocShell) { - pDocShell->GetDocument()->SetForbiddenCharacters( mxForbiddenChars ); + pDocShell->GetDocument().SetForbiddenCharacters( mxForbiddenChars ); pDocShell->PostPaintGridAll(); pDocShell->SetDocumentModified(); } diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx index 24769484d77d..18a4a2c4f1b1 100644 --- a/sc/source/ui/unoobj/linkuno.cxx +++ b/sc/source/ui/unoobj/linkuno.cxx @@ -77,13 +77,13 @@ ScSheetLinkObj::ScSheetLinkObj(ScDocShell* pDocSh, const OUString& rName) : pDocShell( pDocSh ), aFileName( rName ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScSheetLinkObj::~ScSheetLinkObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScSheetLinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -108,7 +108,7 @@ ScTableLink* ScSheetLinkObj::GetLink_Impl() const { if (pDocShell) { - sfx2::LinkManager* pLinkManager = pDocShell->GetDocument()->GetLinkManager(); + sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager(); size_t nCount = pLinkManager->GetLinks().size(); for (size_t i=0; i<nCount; i++) { @@ -289,14 +289,14 @@ void ScSheetLinkObj::setFileName(const OUString& rNewName) // zuerst Tabellen umsetzen - ScDocument* pDoc = pDocShell->GetDocument(); - SCTAB nTabCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + SCTAB nTabCount = rDoc.GetTableCount(); for (SCTAB nTab=0; nTab<nTabCount; nTab++) - if ( pDoc->IsLinked(nTab) && pDoc->GetLinkDoc(nTab) == aFileName ) // alte Datei - pDoc->SetLink( nTab, pDoc->GetLinkMode(nTab), aNewStr, - pDoc->GetLinkFlt(nTab), pDoc->GetLinkOpt(nTab), - pDoc->GetLinkTab(nTab), - pDoc->GetLinkRefreshDelay(nTab) ); // nur Datei aendern + if ( rDoc.IsLinked(nTab) && rDoc.GetLinkDoc(nTab) == aFileName ) // alte Datei + rDoc.SetLink( nTab, rDoc.GetLinkMode(nTab), aNewStr, + rDoc.GetLinkFlt(nTab), rDoc.GetLinkOpt(nTab), + rDoc.GetLinkTab(nTab), + rDoc.GetLinkRefreshDelay(nTab) ); // nur Datei aendern // Links updaten //! Undo !!! @@ -374,13 +374,13 @@ void ScSheetLinkObj::setRefreshDelay(sal_Int32 nRefreshDelay) ScSheetLinksObj::ScSheetLinksObj(ScDocShell* pDocSh) : pDocShell( pDocSh ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScSheetLinksObj::~ScSheetLinksObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScSheetLinksObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -403,15 +403,15 @@ ScSheetLinkObj* ScSheetLinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex) typedef boost::unordered_set<OUString, OUStringHash> StrSetType; StrSetType aNames; - ScDocument* pDoc = pDocShell->GetDocument(); - SCTAB nTabCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + SCTAB nTabCount = rDoc.GetTableCount(); sal_Int32 nCount = 0; for (SCTAB nTab = 0; nTab < nTabCount; ++nTab) { - if (!pDoc->IsLinked(nTab)) + if (!rDoc.IsLinked(nTab)) continue; - OUString aLinkDoc = pDoc->GetLinkDoc(nTab); + OUString aLinkDoc = rDoc.GetLinkDoc(nTab); if (aNames.insert(aLinkDoc).second) { // unique document name. @@ -432,13 +432,13 @@ ScSheetLinkObj* ScSheetLinksObj::GetObjectByName_Impl(const OUString& aName) { OUString aNameStr(aName); - ScDocument* pDoc = pDocShell->GetDocument(); - SCTAB nTabCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + SCTAB nTabCount = rDoc.GetTableCount(); for (SCTAB nTab=0; nTab<nTabCount; nTab++) - if (pDoc->IsLinked(nTab)) + if (rDoc.IsLinked(nTab)) { - //! case-insensitiv ??? - OUString aLinkDoc = pDoc->GetLinkDoc( nTab ); + //! case-insensitive ??? + OUString aLinkDoc = rDoc.GetLinkDoc( nTab ); if ( aLinkDoc == aNameStr ) return new ScSheetLinkObj( pDocShell, aNameStr ); } @@ -469,14 +469,14 @@ sal_Int32 SAL_CALL ScSheetLinksObj::getCount() throw(uno::RuntimeException, std: sal_Int32 nCount = 0; StrSetType aNames; - ScDocument* pDoc = pDocShell->GetDocument(); - SCTAB nTabCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + SCTAB nTabCount = rDoc.GetTableCount(); for (SCTAB nTab = 0; nTab < nTabCount; ++nTab) { - if (!pDoc->IsLinked(nTab)) + if (!rDoc.IsLinked(nTab)) continue; - OUString aLinkDoc = pDoc->GetLinkDoc(nTab); + OUString aLinkDoc = rDoc.GetLinkDoc(nTab); if (aNames.insert(aLinkDoc).second) ++nCount; } @@ -530,13 +530,13 @@ sal_Bool SAL_CALL ScSheetLinksObj::hasByName( const OUString& aName ) { OUString aNameStr(aName); - ScDocument* pDoc = pDocShell->GetDocument(); - SCTAB nTabCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + SCTAB nTabCount = rDoc.GetTableCount(); for (SCTAB nTab=0; nTab<nTabCount; nTab++) - if (pDoc->IsLinked(nTab)) + if (rDoc.IsLinked(nTab)) { //! case-insensitiv ??? - OUString aLinkDoc(pDoc->GetLinkDoc( nTab )); + OUString aLinkDoc(rDoc.GetLinkDoc( nTab )); if ( aLinkDoc == aNameStr ) return sal_True; } @@ -555,8 +555,8 @@ uno::Sequence<OUString> SAL_CALL ScSheetLinksObj::getElementNames() throw(uno::R return uno::Sequence<OUString>(); StrSetType aNames; - ScDocument* pDoc = pDocShell->GetDocument(); - SCTAB nTabCount = pDoc->GetTableCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + SCTAB nTabCount = rDoc.GetTableCount(); sal_Int32 nLinkCount = getCount(); uno::Sequence<OUString> aSeq(nLinkCount); @@ -564,10 +564,10 @@ uno::Sequence<OUString> SAL_CALL ScSheetLinksObj::getElementNames() throw(uno::R size_t nPos = 0; for (SCTAB nTab = 0; nTab < nTabCount; ++nTab) { - if (!pDoc->IsLinked(nTab)) + if (!rDoc.IsLinked(nTab)) continue; - OUString aLinkDoc = pDoc->GetLinkDoc(nTab); + OUString aLinkDoc = rDoc.GetLinkDoc(nTab); if (aNames.insert(aLinkDoc).second) pAry[nPos++] = aLinkDoc; } @@ -579,7 +579,7 @@ static ScAreaLink* lcl_GetAreaLink( ScDocShell* pDocShell, size_t nPos ) { if (pDocShell) { - sfx2::LinkManager* pLinkManager = pDocShell->GetDocument()->GetLinkManager(); + sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager(); size_t nTotalCount = pLinkManager->GetLinks().size(); size_t nAreaCount = 0; for (size_t i=0; i<nTotalCount; i++) @@ -601,13 +601,13 @@ ScAreaLinkObj::ScAreaLinkObj(ScDocShell* pDocSh, size_t nP) : pDocShell( pDocSh ), nPos( nP ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScAreaLinkObj::~ScAreaLinkObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScAreaLinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -652,7 +652,7 @@ void ScAreaLinkObj::Modify_Impl( const OUString* pNewFile, const OUString* pNewF //! Undo fuer Loeschen //! Undo zusammenfassen - sfx2::LinkManager* pLinkManager = pDocShell->GetDocument()->GetLinkManager(); + sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager(); pLinkManager->Remove( pLink ); pLink = NULL; // bei Remove geloescht @@ -916,13 +916,13 @@ void SAL_CALL ScAreaLinkObj::setDestArea( const table::CellRangeAddress& aDestAr ScAreaLinksObj::ScAreaLinksObj(ScDocShell* pDocSh) : pDocShell( pDocSh ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScAreaLinksObj::~ScAreaLinksObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScAreaLinksObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -977,7 +977,7 @@ void SAL_CALL ScAreaLinksObj::removeByIndex( sal_Int32 nIndex ) throw(uno::Runti { //! SetAddUndo oder so - sfx2::LinkManager* pLinkManager = pDocShell->GetDocument()->GetLinkManager(); + sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager(); pLinkManager->Remove( pLink ); } } @@ -999,7 +999,7 @@ sal_Int32 SAL_CALL ScAreaLinksObj::getCount() throw(uno::RuntimeException, std:: sal_Int32 nAreaCount = 0; if (pDocShell) { - sfx2::LinkManager* pLinkManager = pDocShell->GetDocument()->GetLinkManager(); + sfx2::LinkManager* pLinkManager = pDocShell->GetDocument().GetLinkManager(); size_t nTotalCount = pLinkManager->GetLinks().size(); for (size_t i=0; i<nTotalCount; i++) { @@ -1042,13 +1042,13 @@ ScDDELinkObj::ScDDELinkObj(ScDocShell* pDocSh, const OUString& rA, aTopic( rT ), aItem( rI ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScDDELinkObj::~ScDDELinkObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScDDELinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -1126,7 +1126,7 @@ void SAL_CALL ScDDELinkObj::refresh() throw(uno::RuntimeException, std::exceptio SolarMutexGuard aGuard; if (pDocShell) { - sc::DocumentLinkManager& rMgr = pDocShell->GetDocument()->GetDocLinkManager(); + sc::DocumentLinkManager& rMgr = pDocShell->GetDocument().GetDocLinkManager(); rMgr.updateDdeLink(aAppl, aTopic, aItem); } } @@ -1175,23 +1175,20 @@ uno::Sequence< uno::Sequence< uno::Any > > ScDDELinkObj::getResults( ) if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - if ( pDoc ) + ScDocument& rDoc = pDocShell->GetDocument(); + size_t nPos = 0; + if ( rDoc.FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) ) { - size_t nPos = 0; - if ( pDoc->FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) ) + const ScMatrix* pMatrix = rDoc.GetDdeLinkResultMatrix( nPos ); + if ( pMatrix ) { - const ScMatrix* pMatrix = pDoc->GetDdeLinkResultMatrix( nPos ); - if ( pMatrix ) + uno::Any aAny; + if ( ScRangeToSequence::FillMixedArray( aAny, pMatrix, true ) ) { - uno::Any aAny; - if ( ScRangeToSequence::FillMixedArray( aAny, pMatrix, true ) ) - { - aAny >>= aReturn; - } + aAny >>= aReturn; } - bSuccess = true; } + bSuccess = true; } } @@ -1212,17 +1209,14 @@ void ScDDELinkObj::setResults( const uno::Sequence< uno::Sequence< uno::Any > >& if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - if ( pDoc ) + ScDocument& rDoc = pDocShell->GetDocument(); + size_t nPos = 0; + if ( rDoc.FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) ) { - size_t nPos = 0; - if ( pDoc->FindDdeLink( aAppl, aTopic, aItem, SC_DDE_IGNOREMODE, nPos ) ) - { - uno::Any aAny; - aAny <<= aResults; - ScMatrixRef xMatrix = ScSequenceToMatrix::CreateMixedMatrix( aAny ); - bSuccess = pDoc->SetDdeLinkResultMatrix( nPos, xMatrix ); - } + uno::Any aAny; + aAny <<= aResults; + ScMatrixRef xMatrix = ScSequenceToMatrix::CreateMixedMatrix( aAny ); + bSuccess = rDoc.SetDdeLinkResultMatrix( nPos, xMatrix ); } } @@ -1244,13 +1238,13 @@ void ScDDELinkObj::Refreshed_Impl() ScDDELinksObj::ScDDELinksObj(ScDocShell* pDocSh) : pDocShell( pDocSh ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScDDELinksObj::~ScDDELinksObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScDDELinksObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -1271,7 +1265,7 @@ ScDDELinkObj* ScDDELinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex) if (pDocShell) { OUString aAppl, aTopic, aItem; - if ( pDocShell->GetDocument()->GetDdeLinkData( (size_t)nIndex, aAppl, aTopic, aItem ) ) + if ( pDocShell->GetDocument().GetDdeLinkData( (size_t)nIndex, aAppl, aTopic, aItem ) ) return new ScDDELinkObj( pDocShell, aAppl, aTopic, aItem ); } return NULL; @@ -1284,11 +1278,11 @@ ScDDELinkObj* ScDDELinksObj::GetObjectByName_Impl(const OUString& aName) OUString aNamStr(aName); OUString aAppl, aTopic, aItem; - ScDocument* pDoc = pDocShell->GetDocument(); - size_t nCount = pDoc->GetDocLinkManager().getDdeLinkCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + size_t nCount = rDoc.GetDocLinkManager().getDdeLinkCount(); for (size_t i=0; i<nCount; i++) { - pDoc->GetDdeLinkData( i, aAppl, aTopic, aItem ); + rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem ); if ( lcl_BuildDDEName(aAppl, aTopic, aItem) == aNamStr ) return new ScDDELinkObj( pDocShell, aAppl, aTopic, aItem ); } @@ -1312,7 +1306,7 @@ sal_Int32 SAL_CALL ScDDELinksObj::getCount() throw(uno::RuntimeException, std::e SolarMutexGuard aGuard; sal_Int32 nAreaCount = 0; if (pDocShell) - nAreaCount = pDocShell->GetDocument()->GetDocLinkManager().getDdeLinkCount(); + nAreaCount = pDocShell->GetDocument().GetDocLinkManager().getDdeLinkCount(); return nAreaCount; } @@ -1359,14 +1353,14 @@ uno::Sequence<OUString> SAL_CALL ScDDELinksObj::getElementNames() throw(uno::Run { OUString aAppl, aTopic, aItem; - ScDocument* pDoc = pDocShell->GetDocument(); - size_t nCount = pDocShell->GetDocument()->GetDocLinkManager().getDdeLinkCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + size_t nCount = pDocShell->GetDocument().GetDocLinkManager().getDdeLinkCount(); uno::Sequence<OUString> aSeq(nCount); OUString* pAry = aSeq.getArray(); for (size_t i=0; i<nCount; i++) { - pDoc->GetDdeLinkData( i, aAppl, aTopic, aItem ); + rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem ); pAry[i] = lcl_BuildDDEName(aAppl, aTopic, aItem); } return aSeq; @@ -1383,11 +1377,11 @@ sal_Bool SAL_CALL ScDDELinksObj::hasByName( const OUString& aName ) OUString aNamStr(aName); OUString aAppl, aTopic, aItem; - ScDocument* pDoc = pDocShell->GetDocument(); - size_t nCount = pDocShell->GetDocument()->GetDocLinkManager().getDdeLinkCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + size_t nCount = pDocShell->GetDocument().GetDocLinkManager().getDdeLinkCount(); for (size_t i=0; i<nCount; i++) { - pDoc->GetDdeLinkData( i, aAppl, aTopic, aItem ); + rDoc.GetDdeLinkData( i, aAppl, aTopic, aItem ); if ( lcl_BuildDDEName(aAppl, aTopic, aItem) == aNamStr ) return sal_True; } @@ -1407,38 +1401,35 @@ uno::Reference< sheet::XDDELink > ScDDELinksObj::addDDELink( if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - if ( pDoc ) + ScDocument& rDoc = pDocShell->GetDocument(); + sal_uInt8 nMod = SC_DDE_DEFAULT; + switch ( nMode ) { - sal_uInt8 nMod = SC_DDE_DEFAULT; - switch ( nMode ) - { - case sheet::DDELinkMode_DEFAULT: - { - nMod = SC_DDE_DEFAULT; - } - break; - case sheet::DDELinkMode_ENGLISH: - { - nMod = SC_DDE_ENGLISH; - } - break; - case sheet::DDELinkMode_TEXT: - { - nMod = SC_DDE_TEXT; - } - break; - default: - { - } - break; - } + case sheet::DDELinkMode_DEFAULT: + { + nMod = SC_DDE_DEFAULT; + } + break; + case sheet::DDELinkMode_ENGLISH: + { + nMod = SC_DDE_ENGLISH; + } + break; + case sheet::DDELinkMode_TEXT: + { + nMod = SC_DDE_TEXT; + } + break; + default: + { + } + break; + } - if ( pDoc->CreateDdeLink( aApplication, aTopic, aItem, nMod, ScMatrixRef() ) ) - { - const OUString aName( lcl_BuildDDEName( aApplication, aTopic, aItem ) ); - xLink.set( GetObjectByName_Impl( aName ) ); - } + if ( rDoc.CreateDdeLink( aApplication, aTopic, aItem, nMod, ScMatrixRef() ) ) + { + const OUString aName( lcl_BuildDDEName( aApplication, aTopic, aItem ) ); + xLink.set( GetObjectByName_Impl( aName ) ); } } @@ -1476,7 +1467,7 @@ void SAL_CALL ScExternalSheetCacheObj::setCellValue(sal_Int32 nCol, sal_Int32 nR pToken.reset(new FormulaDoubleToken(fVal)); else if (rValue >>= aVal) { - svl::SharedStringPool& rPool = mpDocShell->GetDocument()->GetSharedStringPool(); + svl::SharedStringPool& rPool = mpDocShell->GetDocument().GetSharedStringPool(); svl::SharedString aSS = rPool.intern(aVal); pToken.reset(new FormulaStringToken(aSS)); } @@ -1692,7 +1683,7 @@ sal_Int32 SAL_CALL ScExternalDocLinkObj::getTokenIndex() ScExternalDocLinksObj::ScExternalDocLinksObj(ScDocShell* pDocShell) : mpDocShell(pDocShell), - mpRefMgr(pDocShell->GetDocument()->GetExternalRefManager()) + mpRefMgr(pDocShell->GetDocument().GetExternalRefManager()) { } diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx index 6d4107401305..edceecf35013 100644 --- a/sc/source/ui/unoobj/nameuno.cxx +++ b/sc/source/ui/unoobj/nameuno.cxx @@ -88,13 +88,13 @@ ScNamedRangeObj::ScNamedRangeObj( rtl::Reference< ScNamedRangesObj > xParent, Sc aName( rNm ), mxSheet( xSheet ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScNamedRangeObj::~ScNamedRangeObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScNamedRangeObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -115,9 +115,9 @@ ScRangeData* ScNamedRangeObj::GetRangeData_Impl() ScRangeName* pNames; SCTAB nTab = GetTab_Impl(); if (nTab >= 0) - pNames = pDocShell->GetDocument()->GetRangeName(nTab); + pNames = pDocShell->GetDocument().GetRangeName(nTab); else - pNames = pDocShell->GetDocument()->GetRangeName(); + pNames = pDocShell->GetDocument().GetRangeName(); if (pNames) { pRet = pNames->findByUpperName(ScGlobal::pCharClass->uppercase(aName)); @@ -134,10 +134,10 @@ SCTAB ScNamedRangeObj::GetTab_Impl() { if (!pDocShell) return -2; - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nTab; OUString sName = mxSheet->getName(); - pDoc->GetTable(sName, nTab); + rDoc.GetTable(sName, nTab); return nTab; } else @@ -153,13 +153,13 @@ void ScNamedRangeObj::Modify_Impl( const OUString* pNewName, const ScTokenArray* if (!pDocShell) return; - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScRangeName* pNames; SCTAB nTab = GetTab_Impl(); if (nTab >= 0) - pNames = pDoc->GetRangeName(nTab); + pNames = rDoc.GetRangeName(nTab); else - pNames = pDoc->GetRangeName(); + pNames = rDoc.GetRangeName(); if (!pNames) return; @@ -188,9 +188,9 @@ void ScNamedRangeObj::Modify_Impl( const OUString* pNewName, const ScTokenArray* ScRangeData* pNew = NULL; if (pNewTokens) - pNew = new ScRangeData( pDoc, aInsName, *pNewTokens, aPos, nType ); + pNew = new ScRangeData( &rDoc, aInsName, *pNewTokens, aPos, nType ); else - pNew = new ScRangeData( pDoc, aInsName, aContent, aPos, nType, eGrammar ); + pNew = new ScRangeData( &rDoc, aInsName, aContent, aPos, nType, eGrammar ); pNew->SetIndex( pOld->GetIndex() ); @@ -263,7 +263,7 @@ table::CellAddress SAL_CALL ScNamedRangeObj::getReferencePosition() aAddress.Sheet = aPos.Tab(); if (pDocShell) { - SCTAB nDocTabs = pDocShell->GetDocument()->GetTableCount(); + SCTAB nDocTabs = pDocShell->GetDocument().GetTableCount(); if ( aAddress.Sheet >= nDocTabs && nDocTabs > 0 ) { // Even after ValidateTabRefs, the position can be invalid if @@ -328,7 +328,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScNamedRangeObj::getTokens() { ScTokenArray* pTokenArray = pData->GetCode(); if ( pTokenArray ) - (void)ScTokenConversion::ConvertToTokenSequence( *pDocShell->GetDocument(), aSequence, *pTokenArray ); + (void)ScTokenConversion::ConvertToTokenSequence( pDocShell->GetDocument(), aSequence, *pTokenArray ); } return aSequence; } @@ -340,7 +340,7 @@ void SAL_CALL ScNamedRangeObj::setTokens( const uno::Sequence<sheet::FormulaToke if( pDocShell ) { ScTokenArray aTokenArray; - (void)ScTokenConversion::ConvertToTokenArray( *pDocShell->GetDocument(), aTokenArray, rTokens ); + (void)ScTokenConversion::ConvertToTokenArray( pDocShell->GetDocument(), aTokenArray, rTokens ); // GRAM_PODF_A1 for API compatibility. Modify_Impl( NULL, &aTokenArray, NULL, NULL, NULL, formula::FormulaGrammar::GRAM_PODF_A1 ); } @@ -471,13 +471,13 @@ ScNamedRangesObj::ScNamedRangesObj(ScDocShell* pDocSh) : mbModifyAndBroadcast(true), pDocShell( pDocSh ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScNamedRangesObj::~ScNamedRangesObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScNamedRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -511,13 +511,13 @@ void SAL_CALL ScNamedRangesObj::addNewByName( const OUString& aName, bool bDone = false; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScRangeName* pNames = GetRangeName_Impl(); if (pNames && !pNames->findByUpperName(ScGlobal::pCharClass->uppercase(aName))) { ScRangeName* pNewRanges = new ScRangeName( *pNames ); // GRAM_PODF_A1 for API compatibility. - ScRangeData* pNew = new ScRangeData( pDoc, aName, aContent, + ScRangeData* pNew = new ScRangeData( &rDoc, aName, aContent, aPos, nNewType,formula::FormulaGrammar::GRAM_PODF_A1 ); if ( pNewRanges->insert(pNew) ) { @@ -739,13 +739,13 @@ sal_Bool SAL_CALL ScNamedRangesObj::hasByName( const OUString& aName ) /** called from the XActionLockable interface methods on initial locking */ void ScNamedRangesObj::lock() { - pDocShell->GetDocument()->PreprocessRangeNameUpdate(); + pDocShell->GetDocument().PreprocessRangeNameUpdate(); } /** called from the XActionLockable interface methods on final unlock */ void ScNamedRangesObj::unlock() { - pDocShell->GetDocument()->PostprocessRangeNameUpdate(); + pDocShell->GetDocument().PostprocessRangeNameUpdate(); } // document::XActionLockable @@ -753,27 +753,27 @@ void ScNamedRangesObj::unlock() sal_Bool ScNamedRangesObj::isActionLocked() throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - return pDocShell->GetDocument()->GetNamedRangesLockCount() != 0; + return pDocShell->GetDocument().GetNamedRangesLockCount() != 0; } void ScNamedRangesObj::addActionLock() throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - ScDocument* pDoc = pDocShell->GetDocument(); - sal_Int16 nLockCount = pDoc->GetNamedRangesLockCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount(); ++nLockCount; if ( nLockCount == 1 ) { lock(); } - pDoc->SetNamedRangesLockCount( nLockCount ); + rDoc.SetNamedRangesLockCount( nLockCount ); } void ScNamedRangesObj::removeActionLock() throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - ScDocument* pDoc = pDocShell->GetDocument(); - sal_Int16 nLockCount = pDoc->GetNamedRangesLockCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount(); if ( nLockCount > 0 ) { --nLockCount; @@ -781,7 +781,7 @@ void ScNamedRangesObj::removeActionLock() throw(uno::RuntimeException, std::exce { unlock(); } - pDoc->SetNamedRangesLockCount( nLockCount ); + rDoc.SetNamedRangesLockCount( nLockCount ); } } @@ -790,8 +790,8 @@ void ScNamedRangesObj::setActionLocks( sal_Int16 nLock ) throw(uno::RuntimeExcep SolarMutexGuard aGuard; if ( nLock >= 0 ) { - ScDocument* pDoc = pDocShell->GetDocument(); - sal_Int16 nLockCount = pDoc->GetNamedRangesLockCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount(); if ( nLock == 0 && nLockCount > 0 ) { unlock(); @@ -800,20 +800,20 @@ void ScNamedRangesObj::setActionLocks( sal_Int16 nLock ) throw(uno::RuntimeExcep { lock(); } - pDoc->SetNamedRangesLockCount( nLock ); + rDoc.SetNamedRangesLockCount( nLock ); } } sal_Int16 ScNamedRangesObj::resetActionLocks() throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - ScDocument* pDoc = pDocShell->GetDocument(); - sal_Int16 nLockCount = pDoc->GetNamedRangesLockCount(); + ScDocument& rDoc = pDocShell->GetDocument(); + sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount(); if ( nLockCount > 0 ) { unlock(); } - pDoc->SetNamedRangesLockCount( 0 ); + rDoc.SetNamedRangesLockCount( 0 ); return nLockCount; } @@ -833,7 +833,7 @@ ScNamedRangeObj* ScGlobalNamedRangesObj::GetObjectByIndex_Impl(sal_uInt16 nIndex if (!pDocShell) return NULL; - ScRangeName* pNames = pDocShell->GetDocument()->GetRangeName(); + ScRangeName* pNames = pDocShell->GetDocument().GetRangeName(); if (!pNames) return NULL; @@ -860,7 +860,7 @@ ScNamedRangeObj* ScGlobalNamedRangesObj::GetObjectByName_Impl(const OUString& aN ScRangeName* ScGlobalNamedRangesObj::GetRangeName_Impl() { - return pDocShell->GetDocument()->GetRangeName(); + return pDocShell->GetDocument().GetRangeName(); } SCTAB ScGlobalNamedRangesObj::GetTab_Impl() @@ -894,11 +894,11 @@ ScNamedRangeObj* ScLocalNamedRangesObj::GetObjectByIndex_Impl( sal_uInt16 nIndex return NULL; OUString aName = mxSheet->getName(); - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nTab; - pDoc->GetTable( aName, nTab ); + rDoc.GetTable( aName, nTab ); - ScRangeName* pNames = pDoc->GetRangeName( nTab ); + ScRangeName* pNames = rDoc.GetRangeName( nTab ); if (!pNames) return NULL; @@ -919,13 +919,13 @@ ScNamedRangeObj* ScLocalNamedRangesObj::GetObjectByIndex_Impl( sal_uInt16 nIndex ScRangeName* ScLocalNamedRangesObj::GetRangeName_Impl() { SCTAB nTab = GetTab_Impl(); - return pDocShell->GetDocument()->GetRangeName( nTab ); + return pDocShell->GetDocument().GetRangeName( nTab ); } SCTAB ScLocalNamedRangesObj::GetTab_Impl() { SCTAB nTab; - pDocShell->GetDocument()->GetTable(mxSheet->getName(), nTab); + pDocShell->GetDocument().GetTable(mxSheet->getName(), nTab); return nTab; } @@ -934,13 +934,13 @@ ScLabelRangeObj::ScLabelRangeObj(ScDocShell* pDocSh, bool bCol, const ScRange& r bColumn( bCol ), aRange( rR ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScLabelRangeObj::~ScLabelRangeObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScLabelRangeObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -958,8 +958,8 @@ ScRangePair* ScLabelRangeObj::GetData_Impl() ScRangePair* pRet = NULL; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScRangePairList* pList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges(); if (pList) pRet = pList->Find( aRange ); } @@ -970,8 +970,8 @@ void ScLabelRangeObj::Modify_Impl( const ScRange* pLabel, const ScRange* pData ) { if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScRangePairList* pOldList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges(); if (pOldList) { ScRangePairListRef xNewList(pOldList->Clone()); @@ -989,11 +989,11 @@ void ScLabelRangeObj::Modify_Impl( const ScRange* pLabel, const ScRange* pData ) delete pEntry; if (bColumn) - pDoc->GetColNameRangesRef() = xNewList; + rDoc.GetColNameRangesRef() = xNewList; else - pDoc->GetRowNameRangesRef() = xNewList; + rDoc.GetRowNameRangesRef() = xNewList; - pDoc->CompileColRowNameFormula(); + rDoc.CompileColRowNameFormula(); pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID ); pDocShell->SetDocumentModified(); @@ -1052,13 +1052,13 @@ ScLabelRangesObj::ScLabelRangesObj(ScDocShell* pDocSh, bool bCol) : pDocShell( pDocSh ), bColumn( bCol ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScLabelRangesObj::~ScLabelRangesObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScLabelRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -1078,8 +1078,8 @@ ScLabelRangeObj* ScLabelRangesObj::GetObjectByIndex_Impl(size_t nIndex) { if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScRangePairList* pList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges(); if ( pList && nIndex < pList->size() ) { ScRangePair* pData = (*pList)[nIndex]; @@ -1097,8 +1097,8 @@ void SAL_CALL ScLabelRangesObj::addNew( const table::CellRangeAddress& aLabelAre SolarMutexGuard aGuard; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScRangePairList* pOldList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges(); if (pOldList) { ScRangePairListRef xNewList(pOldList->Clone()); @@ -1110,11 +1110,11 @@ void SAL_CALL ScLabelRangesObj::addNew( const table::CellRangeAddress& aLabelAre xNewList->Join( ScRangePair( aLabelRange, aDataRange ) ); if (bColumn) - pDoc->GetColNameRangesRef() = xNewList; + rDoc.GetColNameRangesRef() = xNewList; else - pDoc->GetRowNameRangesRef() = xNewList; + rDoc.GetRowNameRangesRef() = xNewList; - pDoc->CompileColRowNameFormula(); + rDoc.CompileColRowNameFormula(); pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID ); pDocShell->SetDocumentModified(); @@ -1130,8 +1130,8 @@ void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex ) bool bDone = false; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScRangePairList* pOldList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges(); if ( pOldList && nIndex >= 0 && nIndex < (sal_Int32)pOldList->size() ) { @@ -1144,11 +1144,11 @@ void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex ) delete pEntry; if (bColumn) - pDoc->GetColNameRangesRef() = xNewList; + rDoc.GetColNameRangesRef() = xNewList; else - pDoc->GetRowNameRangesRef() = xNewList; + rDoc.GetRowNameRangesRef() = xNewList; - pDoc->CompileColRowNameFormula(); + rDoc.CompileColRowNameFormula(); pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID ); pDocShell->SetDocumentModified(); bDone = true; @@ -1177,8 +1177,8 @@ sal_Int32 SAL_CALL ScLabelRangesObj::getCount() throw(uno::RuntimeException, std SolarMutexGuard aGuard; if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScRangePairList* pList = bColumn ? pDoc->GetColNameRanges() : pDoc->GetRowNameRanges(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges(); if (pList) return pList->size(); } diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx index c0bcef6d3fcc..d8dcbcec9679 100644 --- a/sc/source/ui/unoobj/notesuno.cxx +++ b/sc/source/ui/unoobj/notesuno.cxx @@ -60,7 +60,7 @@ ScAnnotationObj::ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos) : aCellPos( rPos ), pUnoText( NULL ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); // pUnoText is allocated on demand (GetUnoText) // can't be aggregated because getString/setString is handled here @@ -69,7 +69,7 @@ ScAnnotationObj::ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos) : ScAnnotationObj::~ScAnnotationObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); if (pUnoText) pUnoText->release(); @@ -248,6 +248,6 @@ SvxUnoText& ScAnnotationObj::GetUnoText() const ScPostIt* ScAnnotationObj::ImplGetNote() const { - return pDocShell ? pDocShell->GetDocument()->GetNote(aCellPos) : 0; + return pDocShell ? pDocShell->GetDocument().GetNote(aCellPos) : 0; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index 7227f056fc95..e9bf1d5d158b 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -83,10 +83,6 @@ class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container public: ScVbaObjectForCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell ) { - ScDocument* pDoc = mpDocShell->GetDocument(); - if ( !pDoc ) - throw uno::RuntimeException(); - uno::Sequence< uno::Any > aArgs(2); // access the application object ( parent for workbook ) aArgs[0] = uno::Any( ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.Application", uno::Sequence< uno::Any >() ) ); @@ -99,26 +95,24 @@ public: SolarMutexGuard aGuard; maCachedObject = uno::Any(); // clear cached object - ScDocument* pDoc = mpDocShell->GetDocument(); - if ( !pDoc ) - throw uno::RuntimeException(); + ScDocument& rDoc = mpDocShell->GetDocument(); // aName is generated from the stream name which can be different ( case-wise ) // from the code name - if( aName.equalsIgnoreAsciiCase( pDoc->GetCodeName() ) ) + if( aName.equalsIgnoreAsciiCase( rDoc.GetCodeName() ) ) maCachedObject = maWorkbook; else { OUString sCodeName; - SCTAB nCount = pDoc->GetTableCount(); + SCTAB nCount = rDoc.GetTableCount(); for( SCTAB i = 0; i < nCount; i++ ) { - pDoc->GetCodeName( i, sCodeName ); + rDoc.GetCodeName( i, sCodeName ); // aName is generated from the stream name which can be different ( case-wise ) // from the code name if( sCodeName.equalsIgnoreAsciiCase( aName ) ) { OUString sSheetName; - if( pDoc->GetName( i, sSheetName ) ) + if( rDoc.GetName( i, sSheetName ) ) { uno::Reference< frame::XModel > xModel( mpDocShell->GetModel() ); uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW ); @@ -151,19 +145,17 @@ public: virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { SolarMutexGuard aGuard; - ScDocument* pDoc = mpDocShell->GetDocument(); - if ( !pDoc ) - throw uno::RuntimeException(); - SCTAB nCount = pDoc->GetTableCount(); + ScDocument& rDoc = mpDocShell->GetDocument(); + SCTAB nCount = rDoc.GetTableCount(); uno::Sequence< OUString > aNames( nCount + 1 ); SCTAB index = 0; OUString sCodeName; for( ; index < nCount; ++index ) { - pDoc->GetCodeName( index, sCodeName ); + rDoc.GetCodeName( index, sCodeName ); aNames[ index ] = sCodeName; } - aNames[ index ] = pDoc->GetCodeName(); + aNames[ index ] = rDoc.GetCodeName(); return aNames; } // XElemenAccess @@ -204,7 +196,7 @@ public: if ( bMatched ) { OUString sName; - mrDocShell.GetDocument()->GetCodeName( static_cast<SCTAB>( index ), sName ); + mrDocShell.GetDocument().GetCodeName( static_cast<SCTAB>( index ), sName ); sCodeName = sName; } } @@ -235,7 +227,7 @@ public: if (xFormControls == xContainer) { OUString aName; - if (mrDocShell.GetDocument()->GetCodeName(static_cast<SCTAB>(i), aName)) + if (mrDocShell.GetDocument().GetCodeName(static_cast<SCTAB>(i), aName)) return aName; } } @@ -583,8 +575,8 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance( break; case SC_SERVICE_CHDATAPROV: - if (pDocShell && pDocShell->GetDocument()) - xRet = *new ScChart2DataProvider( pDocShell->GetDocument() ); + if (pDocShell) + xRet = *new ScChart2DataProvider( &pDocShell->GetDocument() ); break; case SC_SERVICE_FORMULAPARS: @@ -595,10 +587,10 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance( case SC_SERVICE_OPCODEMAPPER: if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); ScAddress aAddress; - ScCompiler* pComp = new ScCompiler(pDoc,aAddress); - pComp->SetGrammar( pDoc->GetGrammar() ); + ScCompiler* pComp = new ScCompiler(&rDoc,aAddress); + pComp->SetGrammar( rDoc.GetGrammar() ); SAL_WNODEPRECATED_DECLARATIONS_PUSH xRet.set(static_cast<sheet::XFormulaOpCodeMapper*>(new ScFormulaOpCodeMapperObj(::std::auto_ptr<formula::FormulaCompiler> (pComp)))); SAL_WNODEPRECATED_DECLARATIONS_POP @@ -606,7 +598,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance( } #ifndef DISABLE_SCRIPTING case SC_SERVICE_VBAOBJECTPROVIDER: - if (pDocShell && pDocShell->GetDocument()->IsInVBAMode()) + if (pDocShell && pDocShell->GetDocument().IsInVBAMode()) { OSL_TRACE("**** creating VBA Object mapper"); xRet.set(static_cast<container::XNameAccess*>(new ScVbaObjectForCodeNameProvider( pDocShell ))); @@ -636,7 +628,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance( // create the VBA document event processor uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( ::ooo::vba::createVBAUnoAPIServiceWithArgs( pDocShell, "com.sun.star.script.vba.VBASpreadsheetEventProcessor", aArgs ), uno::UNO_QUERY ); - pDocShell->GetDocument()->SetVbaEventProcessor( xVbaEvents ); + pDocShell->GetDocument().SetVbaEventProcessor( xVbaEvents ); } } break; diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 8d0050fd8146..357d06dbf51e 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -399,13 +399,13 @@ static bool lcl_AnyTabProtected( ScDocument& rDoc ) ScStyleFamiliesObj::ScStyleFamiliesObj(ScDocShell* pDocSh) : pDocShell( pDocSh ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScStyleFamiliesObj::~ScStyleFamiliesObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScStyleFamiliesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -588,13 +588,13 @@ ScStyleFamilyObj::ScStyleFamilyObj(ScDocShell* pDocSh, SfxStyleFamily eFam) : pDocShell( pDocSh ), eFamily( eFam ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScStyleFamilyObj::~ScStyleFamilyObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScStyleFamilyObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -614,8 +614,8 @@ ScStyleObj* ScStyleFamilyObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) { if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); SfxStyleSheetIterator aIter( pStylePool, eFamily ); if ( nIndex < aIter.Count() ) @@ -636,8 +636,8 @@ ScStyleObj* ScStyleFamilyObj::GetObjectByName_Impl(const OUString& aName) { OUString aString(aName); - ScDocument* pDoc = pDocShell->GetDocument(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); if ( pStylePool->Find( aString, eFamily ) ) return new ScStyleObj( pDocShell, eFamily, aString ); } @@ -660,8 +660,8 @@ void SAL_CALL ScStyleFamilyObj::insertByName( const OUString& aName, const uno:: { OUString aNameStr(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<sal_uInt16>(eFamily) )); - ScDocument* pDoc = pDocShell->GetDocument(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); //! DocFunc-Funktion?? //! Undo ????????????? @@ -670,8 +670,8 @@ void SAL_CALL ScStyleFamilyObj::insertByName( const OUString& aName, const uno:: { (void)pStylePool->Make( aNameStr, eFamily, SFXSTYLEBIT_USERDEF ); - if ( eFamily == SFX_STYLE_FAMILY_PARA && !pDoc->IsImportingXML() ) - pDoc->GetPool()->CellStyleCreated( aNameStr ); + if ( eFamily == SFX_STYLE_FAMILY_PARA && !rDoc.IsImportingXML() ) + rDoc.GetPool()->CellStyleCreated( aNameStr ); pStyleObj->InitDoc( pDocShell, aNameStr ); // Objekt kann benutzt werden @@ -712,8 +712,8 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName ) { OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<sal_uInt16>(eFamily) )); - ScDocument* pDoc = pDocShell->GetDocument(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); //! DocFunc-Funktion?? //! Undo ????????????? @@ -730,7 +730,7 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName ) double nPPTX = aLogic.X() / 1000.0; double nPPTY = aLogic.Y() / 1000.0; Fraction aZoom(1,1); - pDoc->StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); + rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT ); pDocShell->SetDocumentModified(); @@ -740,7 +740,7 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName ) } else { - if ( pDoc->RemovePageStyleInUse( aString ) ) + if ( rDoc.RemovePageStyleInUse( aString ) ) pDocShell->PageStyleModified( ScGlobal::GetRscString(STR_STYLENAME_STANDARD), true ); pStylePool->Remove( pStyle ); @@ -764,8 +764,8 @@ sal_Int32 SAL_CALL ScStyleFamilyObj::getCount() throw(uno::RuntimeException, std SolarMutexGuard aGuard; if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); SfxStyleSheetIterator aIter( pStylePool, eFamily ); return aIter.Count(); @@ -820,8 +820,8 @@ uno::Sequence<OUString> SAL_CALL ScStyleFamilyObj::getElementNames() SolarMutexGuard aGuard; if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); SfxStyleSheetIterator aIter( pStylePool, eFamily ); sal_uInt16 nCount = aIter.Count(); @@ -851,8 +851,8 @@ sal_Bool SAL_CALL ScStyleFamilyObj::hasByName( const OUString& aName ) { OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<sal_uInt16>(eFamily) )); - ScDocument* pDoc = pDocShell->GetDocument(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); if ( pStylePool->Find( aString, eFamily ) ) return sal_True; } @@ -934,7 +934,7 @@ ScStyleObj::ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, const OUString& // pDocShell ist Null, wenn per ServiceProvider erzeugt if (pDocShell) - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } void ScStyleObj::InitDoc( ScDocShell* pNewDocSh, const OUString& rNewName ) @@ -943,14 +943,14 @@ void ScStyleObj::InitDoc( ScDocShell* pNewDocSh, const OUString& rNewName ) { aStyleName = rNewName; pDocShell = pNewDocSh; - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } } ScStyleObj::~ScStyleObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } // XUnoTunnel @@ -1002,8 +1002,8 @@ SfxStyleSheetBase* ScStyleObj::GetStyle_Impl() { if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); return pStylePool->Find( aStyleName, eFamily ); } return NULL; @@ -1048,7 +1048,7 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle ) if (pStyle) { // cell styles cannot be modified if any sheet is protected - if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) ) + if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( pDocShell->GetDocument() ) ) return; //! exception? //! DocFunc-Funktion?? @@ -1060,7 +1060,7 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle ) { // wie bei setPropertyValue - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); if ( eFamily == SFX_STYLE_FAMILY_PARA ) { // Zeilenhoehen anpassen... @@ -1070,7 +1070,7 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle ) double nPPTX = aLogic.X() / 1000.0; double nPPTY = aLogic.Y() / 1000.0; Fraction aZoom(1,1); - pDoc->StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); + rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT ); pDocShell->SetDocumentModified(); @@ -1104,7 +1104,7 @@ void SAL_CALL ScStyleObj::setName( const OUString& aNewName ) if (pStyle) { // cell styles cannot be renamed if any sheet is protected - if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) ) + if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( pDocShell->GetDocument() ) ) return; //! exception? //! DocFunc-Funktion?? @@ -1116,9 +1116,9 @@ void SAL_CALL ScStyleObj::setName( const OUString& aNewName ) { aStyleName = aString; //! notify other objects for this style? - ScDocument* pDoc = pDocShell->GetDocument(); - if ( eFamily == SFX_STYLE_FAMILY_PARA && !pDoc->IsImportingXML() ) - pDoc->GetPool()->CellStyleCreated( aString ); + ScDocument& rDoc = pDocShell->GetDocument(); + if ( eFamily == SFX_STYLE_FAMILY_PARA && !rDoc.IsImportingXML() ) + rDoc.GetPool()->CellStyleCreated( aString ); // Zellvorlagen = 2, Seitenvorlagen = 4 sal_uInt16 nId = ( eFamily == SFX_STYLE_FAMILY_PARA ) ? @@ -1416,7 +1416,7 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault() if ( pStyle ) { // cell styles cannot be modified if any sheet is protected - if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) ) + if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( pDocShell->GetDocument() ) ) throw uno::RuntimeException(); SfxItemSet& rSet = pStyle->GetItemSet(); @@ -1424,7 +1424,7 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault() //! merge with SetOneProperty - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); if ( eFamily == SFX_STYLE_FAMILY_PARA ) { // row heights @@ -1434,7 +1434,7 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault() double nPPTX = aLogic.X() / 1000.0; double nPPTY = aLogic.Y() / 1000.0; Fraction aZoom(1,1); - pDoc->StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); + rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT ); pDocShell->SetDocumentModified(); @@ -1527,7 +1527,7 @@ void ScStyleObj::SetOnePropertyValue( const OUString& rPropertyName, const SfxIt if ( pStyle && pEntry ) { // cell styles cannot be modified if any sheet is protected - if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) ) + if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( pDocShell->GetDocument() ) ) throw uno::RuntimeException(); SfxItemSet& rSet = pStyle->GetItemSet(); // direkt im lebenden Style aendern... @@ -1577,7 +1577,7 @@ void ScStyleObj::SetOnePropertyValue( const OUString& rPropertyName, const SfxIt { // language for number formats SvNumberFormatter* pFormatter = - pDocShell->GetDocument()->GetFormatTable(); + pDocShell->GetDocument().GetFormatTable(); sal_uInt32 nOldFormat = ((const SfxUInt32Item&) rSet.Get( ATTR_VALUE_FORMAT )).GetValue(); LanguageType eOldLang = ((const SvxLanguageItem&) @@ -1803,7 +1803,7 @@ void ScStyleObj::SetOnePropertyValue( const OUString& rPropertyName, const SfxIt //! DocFunc-Funktion?? //! Undo ????????????? - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); if ( eFamily == SFX_STYLE_FAMILY_PARA ) { // Zeilenhoehen anpassen... @@ -1813,7 +1813,7 @@ void ScStyleObj::SetOnePropertyValue( const OUString& rPropertyName, const SfxIt double nPPTX = aLogic.X() / 1000.0; double nPPTY = aLogic.Y() / 1000.0; Fraction aZoom(1,1); - pDoc->StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); + rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT ); pDocShell->SetDocumentModified(); @@ -1861,7 +1861,7 @@ uno::Any SAL_CALL ScStyleObj::getPropertyValue( const OUString& aPropertyName ) pItemSet->Get( ATTR_VALUE_FORMAT )).GetValue(); LanguageType eOldLang = ((const SvxLanguageItem&) pItemSet->Get( ATTR_LANGUAGE_FORMAT )).GetLanguage(); - nOldFormat = pDocShell->GetDocument()->GetFormatTable()-> + nOldFormat = pDocShell->GetDocument().GetFormatTable()-> GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang ); aAny <<= nOldFormat; } diff --git a/sc/source/ui/unoobj/targuno.cxx b/sc/source/ui/unoobj/targuno.cxx index df1b80de2ee5..84beb009ede8 100644 --- a/sc/source/ui/unoobj/targuno.cxx +++ b/sc/source/ui/unoobj/targuno.cxx @@ -67,7 +67,7 @@ SC_SIMPLE_SERVICE_INFO( ScLinkTargetsObj, "ScLinkTargetsObj", "com.sun.s ScLinkTargetTypesObj::ScLinkTargetTypesObj(ScDocShell* pDocSh) : pDocShell( pDocSh ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); for (sal_uInt16 i=0; i<SC_LINKTARGETTYPE_COUNT; i++) aNames[i] = ScResId( nTypeResIds[i] ); @@ -76,7 +76,7 @@ ScLinkTargetTypesObj::ScLinkTargetTypesObj(ScDocShell* pDocSh) : ScLinkTargetTypesObj::~ScLinkTargetTypesObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScLinkTargetTypesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -135,14 +135,14 @@ ScLinkTargetTypeObj::ScLinkTargetTypeObj(ScDocShell* pDocSh, sal_uInt16 nT) : pDocShell( pDocSh ), nType( nT ) { - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); aName = ScResId( nTypeResIds[nType] ); //! on demand? } ScLinkTargetTypeObj::~ScLinkTargetTypeObj() { if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); + pDocShell->GetDocument().RemoveUnoObject(*this); } void ScLinkTargetTypeObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 5b5dd354961d..48238e41bd5d 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -901,7 +901,7 @@ ScCellTextData::ScCellTextData(ScDocShell* pDocSh, const ScAddress& rP) : bDoUpdate( true ) { if (pDocShell) - pDocShell->GetDocument()->AddUnoObject(*this); + pDocShell->GetDocument().AddUnoObject(*this); } ScCellTextData::~ScCellTextData() @@ -910,8 +910,8 @@ ScCellTextData::~ScCellTextData() if (pDocShell) { - pDocShell->GetDocument()->RemoveUnoObject(*this); - pDocShell->GetDocument()->DisposeFieldEditEngine(pEditEngine); + pDocShell->GetDocument().RemoveUnoObject(*this); + pDocShell->GetDocument().DisposeFieldEditEngine(pEditEngine); } else delete pEditEngine; @@ -932,8 +932,8 @@ void ScCellTextData::GetCellText(const ScAddress& rCellPos, OUString& rText) { if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); - pDoc->GetInputString( rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText ); + ScDocument& rDoc = pDocShell->GetDocument(); + rDoc.GetInputString( rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText ); } } @@ -943,8 +943,8 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder() { if ( pDocShell ) { - ScDocument* pDoc = pDocShell->GetDocument(); - pEditEngine = pDoc->CreateFieldEditEngine(); + ScDocument& rDoc = pDocShell->GetDocument(); + pEditEngine = rDoc.CreateFieldEditEngine(); } else { @@ -970,19 +970,19 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder() if (pDocShell) { - ScDocument* pDoc = pDocShell->GetDocument(); + ScDocument& rDoc = pDocShell->GetDocument(); SfxItemSet aDefaults( pEditEngine->GetEmptyItemSet() ); if( const ScPatternAttr* pPattern = - pDoc->GetPattern( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) ) + rDoc.GetPattern( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) ) { pPattern->FillEditItemSet( &aDefaults ); pPattern->FillEditParaItems( &aDefaults ); // including alignment etc. (for reading) } - if (pDoc->GetCellType(aCellPos) == CELLTYPE_EDIT) + if (rDoc.GetCellType(aCellPos) == CELLTYPE_EDIT) { - const EditTextObject* pObj = pDoc->GetEditText(aCellPos); + const EditTextObject* pObj = rDoc.GetEditText(aCellPos); if (pObj) pEditEngine->SetTextNewDefaults(*pObj, aDefaults); } diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index 2b7b884e0e11..738d33d8a5be 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -68,13 +68,13 @@ ScFormulaParserObj::ScFormulaParserObj(ScDocShell* pDocSh) : mbIgnoreSpaces( true ), mbCompileFAP( false ) { - mpDocShell->GetDocument()->AddUnoObject(*this); + mpDocShell->GetDocument().AddUnoObject(*this); } ScFormulaParserObj::~ScFormulaParserObj() { if (mpDocShell) - mpDocShell->GetDocument()->RemoveUnoObject(*this); + mpDocShell->GetDocument().RemoveUnoObject(*this); } void ScFormulaParserObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -129,17 +129,17 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula( if (mpDocShell) { - ScDocument* pDoc = mpDocShell->GetDocument(); - ScExternalRefManager::ApiGuard aExtRefGuard(pDoc); + ScDocument& rDoc = mpDocShell->GetDocument(); + ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc); ScAddress aRefPos( ScAddress::UNINITIALIZED ); ScUnoConversion::FillScAddress( aRefPos, rReferencePos ); - ScCompiler aCompiler( pDoc, aRefPos); - aCompiler.SetGrammar(pDoc->GetGrammar()); + ScCompiler aCompiler( &rDoc, aRefPos); + aCompiler.SetGrammar(rDoc.GetGrammar()); SetCompilerFlags( aCompiler ); ScTokenArray* pCode = aCompiler.CompileString( aFormula ); - (void)ScTokenConversion::ConvertToTokenSequence( *pDoc, aRet, *pCode ); + (void)ScTokenConversion::ConvertToTokenSequence( rDoc, aRet, *pCode ); delete pCode; } @@ -155,13 +155,13 @@ OUString SAL_CALL ScFormulaParserObj::printFormula( if (mpDocShell) { - ScDocument* pDoc = mpDocShell->GetDocument(); + ScDocument& rDoc = mpDocShell->GetDocument(); ScTokenArray aCode; - (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aCode, aTokens ); + (void)ScTokenConversion::ConvertToTokenArray( rDoc, aCode, aTokens ); ScAddress aRefPos( ScAddress::UNINITIALIZED ); ScUnoConversion::FillScAddress( aRefPos, rReferencePos ); - ScCompiler aCompiler( pDoc, aRefPos, aCode); - aCompiler.SetGrammar(pDoc->GetGrammar()); + ScCompiler aCompiler( &rDoc, aRefPos, aCode); + aCompiler.SetGrammar(rDoc.GetGrammar()); SetCompilerFlags( aCompiler ); OUStringBuffer aBuffer; @@ -204,9 +204,9 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue( // CompileEnglish _before_ OpCodeMap! if (mxOpCodeMap.get() && mbEnglish != bOldEnglish) { - ScDocument* pDoc = mpDocShell->GetDocument(); - ScCompiler aCompiler( pDoc, ScAddress()); - aCompiler.SetGrammar(pDoc->GetGrammar()); + ScDocument& rDoc = mpDocShell->GetDocument(); + ScCompiler aCompiler( &rDoc, ScAddress()); + aCompiler.SetGrammar(rDoc.GetGrammar()); mxOpCodeMap = aCompiler.CreateOpCodeMap( maOpCodeMapping, mbEnglish); } } @@ -225,9 +225,9 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue( { if (aValue >>= maOpCodeMapping) { - ScDocument* pDoc = mpDocShell->GetDocument(); - ScCompiler aCompiler( pDoc, ScAddress()); - aCompiler.SetGrammar(pDoc->GetGrammar()); + ScDocument& rDoc = mpDocShell->GetDocument(); + ScCompiler aCompiler( &rDoc, ScAddress()); + aCompiler.SetGrammar(rDoc.GetGrammar()); mxOpCodeMap = aCompiler.CreateOpCodeMap( maOpCodeMapping, mbEnglish); } else diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 4c40d4a39284..65dcffabfedc 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -183,13 +183,13 @@ sal_Int32 SAL_CALL ScViewPaneBase::getFirstVisibleColumn() throw(uno::RuntimeExc SolarMutexGuard aGuard; if (pViewShell) { - ScViewData* pViewData = pViewShell->GetViewData(); + ScViewData& rViewData = pViewShell->GetViewData(); ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? - pViewData->GetActivePart() : + rViewData.GetActivePart() : (ScSplitPos) nPane; ScHSplitPos eWhichH = WhichH( eWhich ); - return pViewData->GetPosX( eWhichH ); + return rViewData.GetPosX( eWhichH ); } OSL_FAIL("keine View ?!?"); //! Exception? return 0; @@ -201,13 +201,13 @@ void SAL_CALL ScViewPaneBase::setFirstVisibleColumn(sal_Int32 nFirstVisibleColum SolarMutexGuard aGuard; if (pViewShell) { - ScViewData* pViewData = pViewShell->GetViewData(); + ScViewData& rViewData = pViewShell->GetViewData(); ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? - pViewData->GetActivePart() : + rViewData.GetActivePart() : (ScSplitPos) nPane; ScHSplitPos eWhichH = WhichH( eWhich ); - long nDeltaX = ((long)nFirstVisibleColumn) - pViewData->GetPosX( eWhichH ); + long nDeltaX = ((long)nFirstVisibleColumn) - rViewData.GetPosX( eWhichH ); pViewShell->ScrollX( nDeltaX, eWhichH ); } } @@ -217,13 +217,13 @@ sal_Int32 SAL_CALL ScViewPaneBase::getFirstVisibleRow() throw(uno::RuntimeExcept SolarMutexGuard aGuard; if (pViewShell) { - ScViewData* pViewData = pViewShell->GetViewData(); + ScViewData& rViewData = pViewShell->GetViewData(); ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? - pViewData->GetActivePart() : + rViewData.GetActivePart() : (ScSplitPos) nPane; ScVSplitPos eWhichV = WhichV( eWhich ); - return pViewData->GetPosY( eWhichV ); + return rViewData.GetPosY( eWhichV ); } OSL_FAIL("keine View ?!?"); //! Exception? return 0; @@ -235,13 +235,13 @@ void SAL_CALL ScViewPaneBase::setFirstVisibleRow( sal_Int32 nFirstVisibleRow ) SolarMutexGuard aGuard; if (pViewShell) { - ScViewData* pViewData = pViewShell->GetViewData(); + ScViewData& rViewData = pViewShell->GetViewData(); ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? - pViewData->GetActivePart() : + rViewData.GetActivePart() : (ScSplitPos) nPane; ScVSplitPos eWhichV = WhichV( eWhich ); - long nDeltaY = ((long)nFirstVisibleRow) - pViewData->GetPosY( eWhichV ); + long nDeltaY = ((long)nFirstVisibleRow) - rViewData.GetPosY( eWhichV ); pViewShell->ScrollY( nDeltaY, eWhichV ); } } @@ -253,9 +253,9 @@ table::CellRangeAddress SAL_CALL ScViewPaneBase::getVisibleRange() table::CellRangeAddress aAdr; if (pViewShell) { - ScViewData* pViewData = pViewShell->GetViewData(); + ScViewData& rViewData = pViewShell->GetViewData(); ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? - pViewData->GetActivePart() : + rViewData.GetActivePart() : (ScSplitPos) nPane; ScHSplitPos eWhichH = WhichH( eWhich ); ScVSplitPos eWhichV = WhichV( eWhich ); @@ -264,13 +264,13 @@ table::CellRangeAddress SAL_CALL ScViewPaneBase::getVisibleRange() // VisibleRange in Excel auch teilweise sichtbare. //! anpassen ??? - SCCOL nVisX = pViewData->VisibleCellsX( eWhichH ); - SCROW nVisY = pViewData->VisibleCellsY( eWhichV ); + SCCOL nVisX = rViewData.VisibleCellsX( eWhichH ); + SCROW nVisY = rViewData.VisibleCellsY( eWhichV ); if (!nVisX) nVisX = 1; // irgendwas muss ja im Range sein if (!nVisY) nVisY = 1; - aAdr.Sheet = pViewData->GetTabNo(); - aAdr.StartColumn = pViewData->GetPosX( eWhichH ); - aAdr.StartRow = pViewData->GetPosY( eWhichV ); + aAdr.Sheet = rViewData.GetTabNo(); + aAdr.StartColumn = rViewData.GetPosX( eWhichH ); + aAdr.StartRow = rViewData.GetPosY( eWhichV ); aAdr.EndColumn = aAdr.StartColumn + nVisX - 1; aAdr.EndRow = aAdr.StartRow + nVisY - 1; } @@ -285,7 +285,7 @@ uno::Reference<table::XCellRange> SAL_CALL ScViewPaneBase::getReferredCells() SolarMutexGuard aGuard; if (pViewShell) { - ScDocShell* pDocSh = pViewShell->GetViewData()->GetDocShell(); + ScDocShell* pDocSh = pViewShell->GetViewData().GetDocShell(); table::CellRangeAddress aAdr(getVisibleRange()); //! Hilfsfunktion mit ScRange? ScRange aRange( (SCCOL)aAdr.StartColumn, (SCROW)aAdr.StartRow, aAdr.Sheet, @@ -306,9 +306,9 @@ namespace if ( !_pViewShell ) return false; - ScViewData* pViewData = _pViewShell->GetViewData(); + ScViewData& rViewData = _pViewShell->GetViewData(); ScSplitPos eWhich = ( _nPane == SC_VIEWPANE_ACTIVE ) ? - pViewData->GetActivePart() : + rViewData.GetActivePart() : (ScSplitPos) _nPane; _rpWindow = _pViewShell->GetWindowByPos( eWhich ); _rpSdrView = _pViewShell->GetSdrView(); @@ -385,19 +385,19 @@ awt::Rectangle ScViewPaneBase::GetVisArea() const if (pViewShell) { ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? - pViewShell->GetViewData()->GetActivePart() : + pViewShell->GetViewData().GetActivePart() : (ScSplitPos) nPane; ScGridWindow* pWindow = (ScGridWindow*)pViewShell->GetWindowByPos(eWhich); - ScDocument* pDoc = pViewShell->GetViewData()->GetDocument(); + ScDocument* pDoc = pViewShell->GetViewData().GetDocument(); if (pWindow && pDoc) { ScHSplitPos eWhichH = ((eWhich == SC_SPLIT_TOPLEFT) || (eWhich == SC_SPLIT_BOTTOMLEFT)) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT; ScVSplitPos eWhichV = ((eWhich == SC_SPLIT_TOPLEFT) || (eWhich == SC_SPLIT_TOPRIGHT)) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM; - ScAddress aCell(pViewShell->GetViewData()->GetPosX(eWhichH), - pViewShell->GetViewData()->GetPosY(eWhichV), - pViewShell->GetViewData()->GetTabNo()); + ScAddress aCell(pViewShell->GetViewData().GetPosX(eWhichH), + pViewShell->GetViewData().GetPosY(eWhichV), + pViewShell->GetViewData().GetTabNo()); Rectangle aCellRect( pDoc->GetMMRect( aCell.Col(), aCell.Row(), aCell.Col(), aCell.Row(), aCell.Tab() ) ); Size aVisSize( pWindow->PixelToLogic( pWindow->GetSizePixel(), pWindow->GetDrawMapMode( true ) ) ); Point aVisPos( aCellRect.TopLeft() ); @@ -458,7 +458,7 @@ ScTabViewObj::ScTabViewObj( ScTabViewShell* pViewSh ) : mbPendingSelectionChanged(false) { if (pViewSh) - nPreviousTab = pViewSh->GetViewData()->GetTabNo(); + nPreviousTab = pViewSh->GetViewData().GetTabNo(); } ScTabViewObj::~ScTabViewObj() @@ -512,13 +512,13 @@ void SAL_CALL ScTabViewObj::release() throw() static void lcl_CallActivate( ScDocShell* pDocSh, SCTAB nTab, sal_Int32 nEvent ) { - ScDocument* pDoc = pDocSh->GetDocument(); + ScDocument& rDoc = pDocSh->GetDocument(); // when deleting a sheet, nPreviousTab can be invalid // (could be handled with reference updates) - if (!pDoc->HasTable(nTab)) + if (!rDoc.HasTable(nTab)) return; - const ScSheetEvents* pEvents = pDoc->GetSheetEvents(nTab); + const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab); if (pEvents) { const OUString* pScript = pEvents->GetScript(nEvent); @@ -535,7 +535,7 @@ static void lcl_CallActivate( ScDocShell* pDocSh, SCTAB nTab, sal_Int32 nEvent ) // execute VBA event handlers try { - uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW ); + uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW ); // the parameter is the clicked object, as in the mousePressed call above uno::Sequence< uno::Any > aArgs( 1 ); aArgs[ 0 ] <<= nTab; @@ -551,15 +551,15 @@ void ScTabViewObj::SheetChanged( bool bSameTabButMoved ) if ( !GetViewShell() ) return; - ScViewData* pViewData = GetViewShell()->GetViewData(); - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScViewData& rViewData = GetViewShell()->GetViewData(); + ScDocShell* pDocSh = rViewData.GetDocShell(); if (!aActivationListeners.empty()) { sheet::ActivationEvent aEvent; uno::Reference< sheet::XSpreadsheetView > xView(this); uno::Reference< uno::XInterface > xSource(xView, uno::UNO_QUERY); aEvent.Source = xSource; - aEvent.ActiveSheet = new ScTableSheetObj(pDocSh, pViewData->GetTabNo()); + aEvent.ActiveSheet = new ScTableSheetObj(pDocSh, rViewData.GetTabNo()); for (XActivationEventListenerVector::iterator it = aActivationListeners.begin(); it != aActivationListeners.end(); ) { try @@ -576,7 +576,7 @@ void ScTabViewObj::SheetChanged( bool bSameTabButMoved ) /* Handle sheet events, but do not trigger event handlers, if the old active sheet gets re-activated after inserting/deleting/moving a sheet. */ - SCTAB nNewTab = pViewData->GetTabNo(); + SCTAB nNewTab = rViewData.GetTabNo(); if ( !bSameTabButMoved && (nNewTab != nPreviousTab) ) { lcl_CallActivate( pDocSh, nPreviousTab, SC_SHEETEVENT_UNFOCUS ); @@ -721,8 +721,8 @@ sal_Bool SAL_CALL ScTabViewObj::select( const uno::Any& aSelection ) if (pRangesImp) // Zell-Ranges { - ScViewData* pViewData = pViewSh->GetViewData(); - if ( pViewData->GetDocShell() == pRangesImp->GetDocShell() ) + ScViewData& rViewData = pViewSh->GetViewData(); + if ( rViewData.GetDocShell() == pRangesImp->GetDocShell() ) { // Zuerst evtl. Drawing-Selektion aufheben // (MarkListHasChanged hebt Tabellen-Selektion auf) @@ -758,13 +758,13 @@ sal_Bool SAL_CALL ScTabViewObj::select( const uno::Any& aSelection ) // Mehrfachselektion const ScRange* pFirst = rRanges[ 0 ]; - if ( pFirst && !lcl_TabInRanges( pViewData->GetTabNo(), rRanges ) ) + if ( pFirst && !lcl_TabInRanges( rViewData.GetTabNo(), rRanges ) ) pViewSh->SetTabNo( pFirst->aStart.Tab() ); pViewSh->DoneBlockMode(); pViewSh->InitOwnBlockMode(); - pViewData->GetMarkData().MarkFromRangeList( rRanges, true ); + rViewData.GetMarkData().MarkFromRangeList( rRanges, true ); pViewSh->MarkDataChanged(); - pViewData->GetDocShell()->PostPaintGridAll(); // Markierung (alt&neu) + rViewData.GetDocShell()->PostPaintGridAll(); // Markierung (alt&neu) if ( pFirst ) { pViewSh->AlignToCursor( pFirst->aStart.Col(), pFirst->aStart.Row(), @@ -902,14 +902,14 @@ uno::Any SAL_CALL ScTabViewObj::getSelection() // sonst Tabellen-(Zellen-)Selektion - ScViewData* pViewData = pViewSh->GetViewData(); - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScViewData& rViewData = pViewSh->GetViewData(); + ScDocShell* pDocSh = rViewData.GetDocShell(); - const ScMarkData& rMark = pViewData->GetMarkData(); + const ScMarkData& rMark = rViewData.GetMarkData(); SCTAB nTabs = rMark.GetSelectCount(); ScRange aRange; - ScMarkType eMarkType = pViewData->GetSimpleArea(aRange); + ScMarkType eMarkType = rViewData.GetSimpleArea(aRange); if ( nTabs == 1 && (eMarkType == SC_MARK_SIMPLE) ) { if (aRange.aStart == aRange.aEnd) @@ -920,7 +920,7 @@ uno::Any SAL_CALL ScTabViewObj::getSelection() else if ( nTabs == 1 && (eMarkType == SC_MARK_SIMPLE_FILTERED) ) { ScMarkData aFilteredMark( rMark ); - ScViewUtil::UnmarkFiltered( aFilteredMark, pDocSh->GetDocument()); + ScViewUtil::UnmarkFiltered( aFilteredMark, &pDocSh->GetDocument()); ScRangeList aRangeList; aFilteredMark.FillRangeListWithMarks( &aRangeList, false); // Theoretically a selection may start and end on a filtered row. @@ -947,7 +947,7 @@ uno::Any SAL_CALL ScTabViewObj::getSelection() else // Mehrfachselektion { ScRangeListRef xRanges; - pViewData->GetMultiArea( xRanges ); + rViewData.GetMultiArea( xRanges ); // bei mehreren Tabellen Ranges kopieren //! sollte eigentlich schon in ScMarkData::FillRangeListWithMarks passieren? @@ -988,10 +988,10 @@ sal_Int32 SAL_CALL ScTabViewObj::getCount() throw(uno::RuntimeException, std::ex if (pViewSh) { nPanes = 1; - ScViewData* pViewData = pViewSh->GetViewData(); - if ( pViewData->GetHSplitMode() != SC_SPLIT_NONE ) + ScViewData& rViewData = pViewSh->GetViewData(); + if ( rViewData.GetHSplitMode() != SC_SPLIT_NONE ) nPanes *= 2; - if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE ) + if ( rViewData.GetVSplitMode() != SC_SPLIT_NONE ) nPanes *= 2; } return nPanes; @@ -1034,9 +1034,9 @@ ScViewPaneObj* ScTabViewObj::GetObjectByIndex_Impl(sal_uInt16 nIndex) const { ScSplitPos eWhich = SC_SPLIT_BOTTOMLEFT; // default Position bool bError = false; - ScViewData* pViewData = pViewSh->GetViewData(); - bool bHor = ( pViewData->GetHSplitMode() != SC_SPLIT_NONE ); - bool bVer = ( pViewData->GetVSplitMode() != SC_SPLIT_NONE ); + ScViewData& rViewData = pViewSh->GetViewData(); + bool bHor = ( rViewData.GetHSplitMode() != SC_SPLIT_NONE ); + bool bVer = ( rViewData.GetVSplitMode() != SC_SPLIT_NONE ); if ( bHor && bVer ) { // links oben, links unten, rechts oben, rechts unten - wie in Excel @@ -1078,9 +1078,9 @@ uno::Reference<sheet::XSpreadsheet> SAL_CALL ScTabViewObj::getActiveSheet() ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - ScViewData* pData = pViewSh->GetViewData(); - SCTAB nTab = pData->GetTabNo(); - return new ScTableSheetObj( pData->GetDocShell(), nTab ); + ScViewData& rViewData = pViewSh->GetViewData(); + SCTAB nTab = rViewData.GetTabNo(); + return new ScTableSheetObj( rViewData.GetDocShell(), nTab ); } return NULL; } @@ -1097,13 +1097,13 @@ void SAL_CALL ScTabViewObj::setActiveSheet( const uno::Reference<sheet::XSpreads // XSpreadsheet und ScCellRangesBase -> muss ein Sheet sein ScCellRangesBase* pRangesImp = ScCellRangesBase::getImplementation( xActiveSheet ); - if ( pRangesImp && pViewSh->GetViewData()->GetDocShell() == pRangesImp->GetDocShell() ) + if ( pRangesImp && pViewSh->GetViewData().GetDocShell() == pRangesImp->GetDocShell() ) { const ScRangeList& rRanges = pRangesImp->GetRangeList(); if ( rRanges.size() == 1 ) { SCTAB nNewTab = rRanges[ 0 ]->aStart.Tab(); - if ( pViewSh->GetViewData()->GetDocument()->HasTable(nNewTab) ) + if ( pViewSh->GetViewData().GetDocument()->HasTable(nNewTab) ) pViewSh->SetTabNo( nNewTab ); } } @@ -1117,17 +1117,17 @@ uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rP { SCsCOL nX; SCsROW nY; - ScViewData* pData = GetViewShell()->GetViewData(); - ScSplitPos eSplitMode = pData->GetActivePart(); - SCTAB nTab(pData->GetTabNo()); - pData->GetPosFromPixel( rPoint.X(), rPoint.Y(), eSplitMode, nX, nY); + ScViewData& rData = GetViewShell()->GetViewData(); + ScSplitPos eSplitMode = rData.GetActivePart(); + SCTAB nTab(rData.GetTabNo()); + rData.GetPosFromPixel( rPoint.X(), rPoint.Y(), eSplitMode, nX, nY); ScAddress aCellPos (nX, nY, nTab); - ScCellObj* pCellObj = new ScCellObj(pData->GetDocShell(), aCellPos); + ScCellObj* pCellObj = new ScCellObj(rData.GetDocShell(), aCellPos); xTarget.set(uno::Reference<table::XCell>(pCellObj), uno::UNO_QUERY); - ScDocument* pDoc = pData->GetDocument(); + ScDocument* pDoc = rData.GetDocument(); if (pDoc && pDoc->GetDrawLayer()) { SdrPage* pDrawPage = NULL; @@ -1139,7 +1139,7 @@ uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rP if (pDrawPage && pDrawView && pDrawView->GetSdrPageView()) { - Window* pActiveWin = pData->GetActiveWin(); + Window* pActiveWin = rData.GetActiveWin(); Point aPos = pActiveWin->PixelToLogic(rPoint); sal_uInt16 nHitLog = (sal_uInt16) pActiveWin->PixelToLogic( @@ -1170,9 +1170,9 @@ bool ScTabViewObj::IsMouseListening() const return true; // also include sheet events, because MousePressed must be called for them - ScViewData* pViewData = GetViewShell()->GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScViewData& rViewData = GetViewShell()->GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); + SCTAB nTab = rViewData.GetTabNo(); return pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_RIGHTCLICK, true ) || pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_DOUBLECLICK, true ) || @@ -1223,11 +1223,11 @@ bool ScTabViewObj::MousePressed( const awt::MouseEvent& e ) sal_Int32 nEvent = bDoubleClick ? SC_SHEETEVENT_DOUBLECLICK : SC_SHEETEVENT_RIGHTCLICK; ScTabViewShell* pViewSh = GetViewShell(); - ScViewData* pViewData = pViewSh->GetViewData(); - ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); - const ScSheetEvents* pEvents = pDoc->GetSheetEvents(nTab); + ScViewData& rViewData = pViewSh->GetViewData(); + ScDocShell* pDocSh = rViewData.GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + SCTAB nTab = rViewData.GetTabNo(); + const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab); if (pEvents) { const OUString* pScript = pEvents->GetScript(nEvent); @@ -1256,7 +1256,7 @@ bool ScTabViewObj::MousePressed( const awt::MouseEvent& e ) // execute VBA event handler if (!bReturn && xTarget.is()) try { - uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW ); + uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW ); // the parameter is the clicked object, as in the mousePressed call above uno::Sequence< uno::Any > aArgs( 1 ); aArgs[ 0 ] <<= xTarget; @@ -1283,10 +1283,10 @@ bool ScTabViewObj::MouseReleased( const awt::MouseEvent& e ) { mbPendingSelectionChanged = false; ScTabViewShell* pViewSh = GetViewShell(); - ScViewData* pViewData = pViewSh->GetViewData(); - ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW ); + ScViewData& rViewData = pViewSh->GetViewData(); + ScDocShell* pDocSh = rViewData.GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + 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( SC_SHEETEVENT_SELECT ), aArgs ); @@ -1450,7 +1450,7 @@ sal_Int16 ScTabViewObj::GetZoom(void) const ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - const Fraction& rZoomY = pViewSh->GetViewData()->GetZoomY(); // Y wird angezeigt + const Fraction& rZoomY = pViewSh->GetViewData().GetZoomY(); // Y wird angezeigt return (sal_Int16)(( rZoomY.GetNumerator() * 100 ) / rZoomY.GetDenominator()); } return 0; @@ -1463,12 +1463,12 @@ void ScTabViewObj::SetZoom(sal_Int16 nZoom) { 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() ); + aNewOpt.SetZoomType( pViewSh->GetViewData().GetView()->GetZoomType() ); pScMod->SetAppOptions( aNewOpt ); } } @@ -1488,7 +1488,7 @@ sal_Int16 ScTabViewObj::GetZoomType(void) const ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - SvxZoomType eZoomType = pViewSh->GetViewData()->GetView()->GetZoomType(); + SvxZoomType eZoomType = pViewSh->GetViewData().GetView()->GetZoomType(); switch (eZoomType) { case SVX_ZOOM_PERCENT: @@ -1516,7 +1516,7 @@ void ScTabViewObj::SetZoomType(sal_Int16 aZoomType) ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - ScDBFunc* pView = pViewSh->GetViewData()->GetView(); + ScDBFunc* pView = pViewSh->GetViewData().GetView(); if (pView) { SvxZoomType eZoomType; @@ -1573,9 +1573,9 @@ sal_Bool SAL_CALL ScTabViewObj::getIsWindowSplit() throw(uno::RuntimeException, ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - ScViewData* pViewData = pViewSh->GetViewData(); - return ( pViewData->GetHSplitMode() == SC_SPLIT_NORMAL || - pViewData->GetVSplitMode() == SC_SPLIT_NORMAL ); + ScViewData& rViewData = pViewSh->GetViewData(); + return ( rViewData.GetHSplitMode() == SC_SPLIT_NORMAL || + rViewData.GetVSplitMode() == SC_SPLIT_NORMAL ); } return false; @@ -1589,9 +1589,9 @@ sal_Bool SAL_CALL ScTabViewObj::hasFrozenPanes() throw(uno::RuntimeException, st ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - ScViewData* pViewData = pViewSh->GetViewData(); - return ( pViewData->GetHSplitMode() == SC_SPLIT_FIX || - pViewData->GetVSplitMode() == SC_SPLIT_FIX ); + ScViewData& rViewData = pViewSh->GetViewData(); + return ( rViewData.GetHSplitMode() == SC_SPLIT_FIX || + rViewData.GetVSplitMode() == SC_SPLIT_FIX ); } return false; @@ -1603,9 +1603,9 @@ sal_Int32 SAL_CALL ScTabViewObj::getSplitHorizontal() throw(uno::RuntimeExceptio ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - ScViewData* pViewData = pViewSh->GetViewData(); - if ( pViewData->GetHSplitMode() != SC_SPLIT_NONE ) - return pViewData->GetHSplitPos(); + ScViewData& rViewData = pViewSh->GetViewData(); + if ( rViewData.GetHSplitMode() != SC_SPLIT_NONE ) + return rViewData.GetHSplitPos(); } return 0; } @@ -1616,9 +1616,9 @@ sal_Int32 SAL_CALL ScTabViewObj::getSplitVertical() throw(uno::RuntimeException, ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - ScViewData* pViewData = pViewSh->GetViewData(); - if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE ) - return pViewData->GetVSplitPos(); + ScViewData& rViewData = pViewSh->GetViewData(); + if ( rViewData.GetVSplitMode() != SC_SPLIT_NONE ) + return rViewData.GetVSplitPos(); } return 0; } @@ -1630,18 +1630,18 @@ sal_Int32 SAL_CALL ScTabViewObj::getSplitColumn() ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - ScViewData* pViewData = pViewSh->GetViewData(); - if ( pViewData->GetHSplitMode() != SC_SPLIT_NONE ) + ScViewData& rViewData = pViewSh->GetViewData(); + if ( rViewData.GetHSplitMode() != SC_SPLIT_NONE ) { - long nSplit = pViewData->GetHSplitPos(); + long nSplit = rViewData.GetHSplitPos(); ScSplitPos ePos = SC_SPLIT_BOTTOMLEFT; - if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE ) + if ( rViewData.GetVSplitMode() != SC_SPLIT_NONE ) ePos = SC_SPLIT_TOPLEFT; SCsCOL nCol; SCsROW nRow; - pViewData->GetPosFromPixel( nSplit, 0, ePos, nCol, nRow, false ); + rViewData.GetPosFromPixel( nSplit, 0, ePos, nCol, nRow, false ); if ( nCol > 0 ) return nCol; } @@ -1655,15 +1655,15 @@ sal_Int32 SAL_CALL ScTabViewObj::getSplitRow() throw(uno::RuntimeException, std: ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - ScViewData* pViewData = pViewSh->GetViewData(); - if ( pViewData->GetVSplitMode() != SC_SPLIT_NONE ) + ScViewData& rViewData = pViewSh->GetViewData(); + if ( rViewData.GetVSplitMode() != SC_SPLIT_NONE ) { - long nSplit = pViewData->GetVSplitPos(); + long nSplit = rViewData.GetVSplitPos(); ScSplitPos ePos = SC_SPLIT_TOPLEFT; // es ist vertikal geteilt SCsCOL nCol; SCsROW nRow; - pViewData->GetPosFromPixel( 0, nSplit, ePos, nCol, nRow, false ); + rViewData.GetPosFromPixel( 0, nSplit, ePos, nCol, nRow, false ); if ( nRow > 0 ) return nRow; } @@ -1700,8 +1700,8 @@ void SAL_CALL ScTabViewObj::freezeAtPosition( sal_Int32 nColumns, sal_Int32 nRow if (pWin) aWinStart = pWin->GetPosPixel(); - ScViewData* pViewData = pViewSh->GetViewData(); - Point aSplit(pViewData->GetScrPos( (SCCOL)nColumns, (SCROW)nRows, SC_SPLIT_BOTTOMLEFT, true )); + ScViewData& rViewData = pViewSh->GetViewData(); + Point aSplit(rViewData.GetScrPos( (SCCOL)nColumns, (SCROW)nRows, SC_SPLIT_BOTTOMLEFT, true )); aSplit += aWinStart; pViewSh->SplitAtPixel( aSplit, true, true ); @@ -1742,7 +1742,7 @@ void ScTabViewObj::SelectionChanged() // Note: executing this slot through the dispatcher // will cause the style dialog to be raised so we go // direct here - ScFormatShell aShell( GetViewShell()->GetViewData() ); + ScFormatShell aShell( &GetViewShell()->GetViewData() ); SfxAllItemSet reqList( SFX_APP()->GetPool() ); SfxRequest aReq( SID_STYLE_END_PREVIEW, 0, reqList ); aShell.ExecuteStyle( aReq ); @@ -1753,11 +1753,11 @@ void ScTabViewObj::SelectionChanged() // handle sheet events ScTabViewShell* pViewSh = GetViewShell(); - ScViewData* pViewData = pViewSh->GetViewData(); - ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument* pDoc = pDocSh->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); - const ScSheetEvents* pEvents = pDoc->GetSheetEvents(nTab); + ScViewData& rViewData = pViewSh->GetViewData(); + ScDocShell* pDocSh = rViewData.GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + SCTAB nTab = rViewData.GetTabNo(); + const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab); if (pEvents) { const OUString* pScript = pEvents->GetScript(SC_SHEETEVENT_SELECT); @@ -1777,7 +1777,7 @@ void ScTabViewObj::SelectionChanged() mbPendingSelectionChanged = false; try { - uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW ); + 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( SC_SHEETEVENT_SELECT ), aArgs ); @@ -1823,8 +1823,8 @@ void SAL_CALL ScTabViewObj::setPropertyValue( ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - ScViewData* pViewData = pViewSh->GetViewData(); - const ScViewOptions& rOldOpt = pViewSh->GetViewData()->GetOptions(); + ScViewData& rViewData = pViewSh->GetViewData(); + const ScViewOptions& rOldOpt = pViewSh->GetViewData().GetOptions(); ScViewOptions aNewOpt(rOldOpt); if ( aString.equalsAscii( SC_UNO_COLROWHDR ) || aString.equalsAscii( OLD_UNO_COLROWHDR ) ) @@ -1912,9 +1912,9 @@ void SAL_CALL ScTabViewObj::setPropertyValue( if ( aNewOpt != rOldOpt ) { - pViewData->SetOptions( aNewOpt ); - pViewData->GetDocument()->SetViewOptions( aNewOpt ); - pViewData->GetDocShell()->SetDocumentModified(); //! wirklich? + rViewData.SetOptions( aNewOpt ); + rViewData.GetDocument()->SetViewOptions( aNewOpt ); + rViewData.GetDocShell()->SetDocumentModified(); //! wirklich? pViewSh->UpdateFixPos(); pViewSh->PaintGrid(); @@ -1947,7 +1947,7 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const OUString& aPropertyName ScTabViewShell* pViewSh = GetViewShell(); if (pViewSh) { - const ScViewOptions& rOpt = pViewSh->GetViewData()->GetOptions(); + const ScViewOptions& rOpt = pViewSh->GetViewData().GetOptions(); if ( aString.equalsAscii( SC_UNO_COLROWHDR ) || aString.equalsAscii( OLD_UNO_COLROWHDR ) ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_HEADER ) ); @@ -1977,8 +1977,8 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const OUString& aPropertyName else if ( aString.equalsAscii( SC_UNO_ZOOMVALUE ) ) aRet <<= GetZoom(); else if ( aString.equalsAscii( SC_UNO_VISAREASCREEN ) ) { - ScViewData* pViewData = pViewSh->GetViewData(); - Window* pActiveWin = ( pViewData ? pViewData->GetActiveWin() : NULL ); + ScViewData& rViewData = pViewSh->GetViewData(); + Window* pActiveWin = rViewData.GetActiveWin(); if ( pActiveWin ) { Rectangle aRect = pActiveWin->GetWindowExtentsRelative( NULL ); @@ -2256,8 +2256,8 @@ ScTabViewObj* ScTabViewObj::getImplementation( const uno::Reference<uno::XInterf ScDrawTextObjectBar* pTextShell = PTR_CAST( ScDrawTextObjectBar, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); if (pTextShell) { - ScViewData* pViewData = GetViewShell()->GetViewData(); - ScDrawView* pView = pViewData->GetScDrawView(); + ScViewData& rViewData = GetViewShell()->GetViewData(); + ScDrawView* pView = rViewData.GetScDrawView(); OutlinerView* pOutView = pView->GetTextEditOutlinerView(); if (pOutView) return pOutView->GetEditView().GetTransferable(); @@ -2286,8 +2286,8 @@ void SAL_CALL ScTabViewObj::insertTransferable( const ::com::sun::star::uno::Ref ScDrawTextObjectBar* pTextShell = PTR_CAST( ScDrawTextObjectBar, GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ); if (pTextShell) { - ScViewData* pViewData = GetViewShell()->GetViewData(); - ScDrawView* pView = pViewData->GetScDrawView(); + ScViewData& rViewData = GetViewShell()->GetViewData(); + ScDrawView* pView = rViewData.GetScDrawView(); OutlinerView* pOutView = pView->GetTextEditOutlinerView(); if ( pOutView ) { @@ -2321,21 +2321,19 @@ uno::Sequence<sal_Int32> ScTabViewObj::getSelectedSheets() if (!pViewSh) return uno::Sequence<sal_Int32>(); - ScViewData* pViewData = pViewSh->GetViewData(); - if (!pViewData) - return uno::Sequence<sal_Int32>(); + ScViewData& rViewData = pViewSh->GetViewData(); // #i95280# when printing from the shell, the view is never activated, // so Excel view settings must also be evaluated here. - ScExtDocOptions* pExtOpt = pViewData->GetDocument()->GetExtDocOptions(); + ScExtDocOptions* pExtOpt = rViewData.GetDocument()->GetExtDocOptions(); if (pExtOpt && pExtOpt->IsChanged()) { - pViewSh->GetViewData()->ReadExtOptions(*pExtOpt); // Excel view settings - pViewSh->SetTabNo(pViewSh->GetViewData()->GetTabNo(), true); + pViewSh->GetViewData().ReadExtOptions(*pExtOpt); // Excel view settings + pViewSh->SetTabNo(pViewSh->GetViewData().GetTabNo(), true); pExtOpt->SetChanged(false); } - return toSequence(pViewData->GetMarkData().GetSelectedTabs()); + return toSequence(rViewData.GetMarkData().GetSelectedTabs()); } ScPreviewObj::ScPreviewObj(ScPreviewShell* pViewSh) : |