diff options
240 files changed, 1642 insertions, 1821 deletions
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index e145b98459f7..2438f60faef6 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -462,9 +462,9 @@ namespace accessibility sal_uInt16 iTotleItemCount = pEntry->ItemCount(); while( iCount < iTotleItemCount ) { - const SvLBoxItem* pItem = pEntry->GetItem( iCount ); - if ( pItem->GetType() == SV_ITEM_ID_LBOXSTRING && - !static_cast<const SvLBoxString*>( pItem )->GetText().isEmpty() ) + const SvLBoxItem& rItem = pEntry->GetItem( iCount ); + if ( rItem.GetType() == SV_ITEM_ID_LBOXSTRING && + !static_cast<const SvLBoxString&>( rItem ).GetText().isEmpty() ) { iRealItemCount++; } diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 82189204bbaa..5f57528894ec 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -126,7 +126,7 @@ void LibLBoxString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::Rende { ScriptDocument aDocument(static_cast<LibUserData*>(rEntry.GetUserData())->GetDocument()); - OUString aLibName = static_cast<const SvLBoxString*>(rEntry.GetItem(1))->GetText(); + OUString aLibName = static_cast<const SvLBoxString&>(rEntry.GetItem(1)).GetText(); Reference<script::XLibraryContainer2> xModLibContainer(aDocument.getLibraryContainer(E_SCRIPTS), UNO_QUERY); Reference<script::XLibraryContainer2 > xDlgLibContainer(aDocument.getLibraryContainer(E_DIALOGS), UNO_QUERY); bReadOnly = (xModLibContainer.is() && xModLibContainer->hasByName(aLibName) && xModLibContainer->isLibraryReadOnly(aLibName)) @@ -251,8 +251,8 @@ void CheckBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rTxt, sal_uInt16 nCount = pEntry->ItemCount(); for ( sal_uInt16 nCol = 1; nCol < nCount; ++nCol ) { - SvLBoxString* pCol = static_cast<SvLBoxString*>(pEntry->GetItem( nCol )); - LibLBoxString* pStr = new LibLBoxString( pEntry, 0, pCol->GetText() ); + SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nCol )); + LibLBoxString* pStr = new LibLBoxString( pEntry, 0, rCol.GetText() ); pEntry->ReplaceItem( pStr, nCol ); } } diff --git a/compilerplugins/clang/returnbyref.cxx b/compilerplugins/clang/returnbyref.cxx index b3044f37f9a5..d5052d685312 100644 --- a/compilerplugins/clang/returnbyref.cxx +++ b/compilerplugins/clang/returnbyref.cxx @@ -34,6 +34,8 @@ public: virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } bool VisitCXXMethodDecl(const CXXMethodDecl * decl); +private: + std::string getFilename(SourceLocation loc); }; bool ReturnByRef::VisitCXXMethodDecl(const CXXMethodDecl * functionDecl) { @@ -64,13 +66,26 @@ bool ReturnByRef::VisitCXXMethodDecl(const CXXMethodDecl * functionDecl) { return true; } + std::string aFilename = getFilename(functionDecl->getCanonicalDecl()->getLocStart()); + if (aFilename == SRCDIR "/include/o3tl/cow_wrapper.hxx") + { + return true; + } + if ( functionDecl->getNameAsString() == "operator->") { + return true; + } + /* + std::string aParentName = functionDecl->getParent()->getQualifiedNameAsString(); + std::string fqn = aParentName + "::" + functionDecl->getNameAsString(); + if (aFilename == "TextCharAttribList::GetAttrib") { + return true; + }*/ + /* The AST here looks like: -CompoundStmt `-ReturnStmt `-UnaryOperator - `-MemberExpr - `-CXXThisExpr */ const CompoundStmt* compoundStmt = dyn_cast< CompoundStmt >( functionDecl->getBody() ); @@ -87,34 +102,33 @@ bool ReturnByRef::VisitCXXMethodDecl(const CXXMethodDecl * functionDecl) { if (unaryOperator == nullptr || unaryOperator->getOpcode() != UO_AddrOf) { return true; } - - nextStmt = dyn_cast<Expr>(*unaryOperator->child_begin())->IgnoreParens(); - const MemberExpr* memberExpr = dyn_cast<MemberExpr>(nextStmt); - if (memberExpr == nullptr) { - return true; - } - - nextStmt = dyn_cast<Expr>(*memberExpr->child_begin())->IgnoreParens(); - const CXXThisExpr* cXXThisExpr = dyn_cast<CXXThisExpr>(nextStmt); - if (cXXThisExpr == nullptr) { - return true; - } - +nextStmt->dump(); report( DiagnosticsEngine::Warning, - "rather return by reference", + "rather return by reference ", functionDecl->getSourceRange().getBegin()) << functionDecl->getSourceRange(); + // display the location of the class member declaration so I don't have to search for it by hand - report( - DiagnosticsEngine::Note, - "rather return by reference", - functionDecl->getCanonicalDecl()->getSourceRange().getBegin()) - << functionDecl->getCanonicalDecl()->getSourceRange(); + auto otherLoc = functionDecl->getCanonicalDecl()->getSourceRange().getBegin(); + if (otherLoc != functionDecl->getSourceRange().getBegin()) + { + report( + DiagnosticsEngine::Note, + "rather return by reference", + functionDecl->getCanonicalDecl()->getSourceRange().getBegin()) + << functionDecl->getCanonicalDecl()->getSourceRange(); + } return true; } +std::string ReturnByRef::getFilename(SourceLocation loc) +{ + SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(loc); + return compiler.getSourceManager().getFilename(spellingLocation); +} + loplugin::Plugin::Registration< ReturnByRef > X("returnbyref"); } diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index a57fb4b7ed9c..0e14b0fc2397 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -216,8 +216,7 @@ void _SvxMacroTabPage::EnableButtons() const SvTreeListEntry* pE = mpImpl->pEventLB->GetListBox().FirstSelected(); if ( pE ) { - const SvLBoxString* pEventMacro = static_cast<const SvLBoxString*>(pE->GetItem( LB_MACROS_ITEMPOS )); - mpImpl->pDeletePB->Enable( 0 != pEventMacro && !mpImpl->bReadOnly ); + mpImpl->pDeletePB->Enable( !mpImpl->bReadOnly ); mpImpl->pAssignPB->Enable( !mpImpl->bReadOnly ); if( mpImpl->pAssignComponentPB ) diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx index 95bedeef6d6a..f3888b6474bb 100644 --- a/cui/source/options/fontsubs.cxx +++ b/cui/source/options/fontsubs.cxx @@ -502,23 +502,22 @@ bool SvxFontSubstCheckListBox::IsChecked(SvTreeListEntry* pEntry, sal_uInt16 nCo void SvxFontSubstCheckListBox::SetCheckButtonState( SvTreeListEntry* pEntry, sal_uInt16 nCol, SvButtonState eState) { - SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem(nCol + 1)); + SvLBoxButton& rItem = static_cast<SvLBoxButton&>(pEntry->GetItem(nCol + 1)); - DBG_ASSERT(pItem,"SetCheckButton:Item not found"); - if (pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) + if (rItem.GetType() == SV_ITEM_ID_LBOXBUTTON) { switch( eState ) { case SV_BUTTON_CHECKED: - pItem->SetStateChecked(); + rItem.SetStateChecked(); break; case SV_BUTTON_UNCHECKED: - pItem->SetStateUnchecked(); + rItem.SetStateUnchecked(); break; case SV_BUTTON_TRISTATE: - pItem->SetStateTristate(); + rItem.SetStateTristate(); break; } InvalidateEntry( pEntry ); @@ -528,12 +527,11 @@ void SvxFontSubstCheckListBox::SetCheckButtonState( SvTreeListEntry* pEntry, sal SvButtonState SvxFontSubstCheckListBox::GetCheckButtonState( SvTreeListEntry* pEntry, sal_uInt16 nCol ) { SvButtonState eState = SV_BUTTON_UNCHECKED; - SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem(nCol + 1)); - DBG_ASSERT(pItem,"GetChButnState:Item not found"); + SvLBoxButton& rItem = static_cast<SvLBoxButton&>(pEntry->GetItem(nCol + 1)); - if (pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) + if (rItem.GetType() == SV_ITEM_ID_LBOXBUTTON) { - SvItemStateFlags nButtonFlags = pItem->GetButtonFlags(); + SvItemStateFlags nButtonFlags = rItem.GetButtonFlags(); eState = SvLBoxButtonData::ConvertToButtonState( nButtonFlags ); } diff --git a/cui/source/options/optHeaderTabListbox.cxx b/cui/source/options/optHeaderTabListbox.cxx index bba08c097ef6..09c8e7e17c16 100644 --- a/cui/source/options/optHeaderTabListbox.cxx +++ b/cui/source/options/optHeaderTabListbox.cxx @@ -70,8 +70,8 @@ void OptHeaderTabListBox::InitEntry( SvTreeListEntry* pEntry, const OUString& rT for ( sal_uInt16 nCol = 1; nCol < _nTabCount; ++nCol ) { // initialize all columns with own class (column 0 == Bitmap) - SvLBoxString* pCol = static_cast<SvLBoxString*>(pEntry->GetItem( nCol )); - OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, pCol->GetText() ); + SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nCol )); + OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, rCol.GetText() ); pEntry->ReplaceItem( pStr, nCol ); } } diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 3b846b8dda19..02acd7043583 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -747,8 +747,8 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl ) SvTreeListEntries::iterator it = std::find_if(m_prefBoxEntries.begin(), m_prefBoxEntries.end(), [&pUserData, &sPropertyName](SvTreeListEntry &entry) -> bool { - return static_cast< SvLBoxString* >( entry.GetItem(1) )->GetText().equals( pUserData->sPropertyPath ) && - static_cast< SvLBoxString* >( entry.GetItem(2) )->GetText().equals( sPropertyName ); + return static_cast< SvLBoxString& >( entry.GetItem(1) ).GetText().equals( pUserData->sPropertyPath ) && + static_cast< SvLBoxString& >( entry.GetItem(2) ).GetText().equals( sPropertyName ); } ); if (it != m_prefBoxEntries.end()) @@ -793,7 +793,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, SearchHdl_Impl) for(size_t i = 1; i < it->ItemCount(); ++i) { - OUString scrTxt = static_cast< SvLBoxString* >( it->GetItem(i) )->GetText(); + OUString scrTxt = static_cast< SvLBoxString& >( it->GetItem(i) ).GetText(); endPos = scrTxt.getLength(); if( textSearch.SearchForward( scrTxt, &startPos, &endPos ) ) { diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx index 0de47b4b3b7d..6ee34bf30f4b 100644 --- a/cui/source/options/optfltr.cxx +++ b/cui/source/options/optfltr.cxx @@ -237,10 +237,10 @@ bool OfaMSFilterTabPage2::FillItemSet( SfxItemSet* ) SvTreeListEntry* pEntry = GetEntry4Type( pArr->eType ); if( pEntry ) { - SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem( nCol )); - if (pItem && pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) + SvLBoxButton& rItem = static_cast<SvLBoxButton&>(pEntry->GetItem( nCol )); + if (rItem.GetType() == SV_ITEM_ID_LBOXBUTTON) { - SvItemStateFlags nButtonFlags = pItem->GetButtonFlags(); + SvItemStateFlags nButtonFlags = rItem.GetButtonFlags(); bCheck = SV_BUTTON_CHECKED == SvLBoxButtonData::ConvertToButtonState( nButtonFlags ); @@ -305,13 +305,13 @@ void OfaMSFilterTabPage2::Reset( const SfxItemSet* ) SvTreeListEntry* pEntry = GetEntry4Type( static_cast< sal_IntPtr >( pArr->eType ) ); if( pEntry ) { - SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem( nCol )); - if (pItem && pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) + SvLBoxButton& rItem = static_cast<SvLBoxButton&>(pEntry->GetItem( nCol )); + if (rItem.GetType() == SV_ITEM_ID_LBOXBUTTON) { if( (rOpt.*pArr->FnIs)() ) - pItem->SetStateChecked(); + rItem.SetStateChecked(); else - pItem->SetStateUnchecked(); + rItem.SetStateUnchecked(); m_pCheckLB->InvalidateEntry( pEntry ); } } @@ -391,23 +391,22 @@ void OfaMSFilterTabPage2::MSFltrSimpleTable::HBarClick() void OfaMSFilterTabPage2::MSFltrSimpleTable::SetCheckButtonState( SvTreeListEntry* pEntry, sal_uInt16 nCol, SvButtonState eState) { - SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem(nCol + 1)); + SvLBoxButton& rItem = static_cast<SvLBoxButton&>(pEntry->GetItem(nCol + 1)); - DBG_ASSERT(pItem,"SetCheckButton:Item not found"); - if (pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) + if (rItem.GetType() == SV_ITEM_ID_LBOXBUTTON) { switch( eState ) { case SV_BUTTON_CHECKED: - pItem->SetStateChecked(); + rItem.SetStateChecked(); break; case SV_BUTTON_UNCHECKED: - pItem->SetStateUnchecked(); + rItem.SetStateUnchecked(); break; case SV_BUTTON_TRISTATE: - pItem->SetStateTristate(); + rItem.SetStateTristate(); break; } InvalidateEntry( pEntry ); @@ -418,12 +417,11 @@ SvButtonState OfaMSFilterTabPage2::MSFltrSimpleTable::GetCheckButtonState( SvTreeListEntry* pEntry, sal_uInt16 nCol ) { SvButtonState eState = SV_BUTTON_UNCHECKED; - SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem(nCol + 1)); - DBG_ASSERT(pItem,"GetChButnState:Item not found"); + SvLBoxButton& rItem = static_cast<SvLBoxButton&>(pEntry->GetItem(nCol + 1)); - if (pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) + if (rItem.GetType() == SV_ITEM_ID_LBOXBUTTON) { - SvItemStateFlags nButtonFlags = pItem->GetButtonFlags(); + SvItemStateFlags nButtonFlags = rItem.GetButtonFlags(); eState = SvLBoxButtonData::ConvertToButtonState( nButtonFlags ); } diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 69f51472da7a..ca6f66834a74 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -795,23 +795,22 @@ bool OfaACorrCheckListBox::IsChecked(sal_uLong nPos, sal_uInt16 nCol) void OfaACorrCheckListBox::SetCheckButtonState( SvTreeListEntry* pEntry, sal_uInt16 nCol, SvButtonState eState) { - SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem(nCol + 1)); + SvLBoxButton& rItem = static_cast<SvLBoxButton&>(pEntry->GetItem(nCol + 1)); - DBG_ASSERT(pItem,"SetCheckButton:Item not found"); - if (pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) + if (rItem.GetType() == SV_ITEM_ID_LBOXBUTTON) { switch( eState ) { case SV_BUTTON_CHECKED: - pItem->SetStateChecked(); + rItem.SetStateChecked(); break; case SV_BUTTON_UNCHECKED: - pItem->SetStateUnchecked(); + rItem.SetStateUnchecked(); break; case SV_BUTTON_TRISTATE: - pItem->SetStateTristate(); + rItem.SetStateTristate(); break; } InvalidateEntry( pEntry ); @@ -821,12 +820,11 @@ void OfaACorrCheckListBox::SetCheckButtonState( SvTreeListEntry* pEntry, sal_uIn SvButtonState OfaACorrCheckListBox::GetCheckButtonState( SvTreeListEntry* pEntry, sal_uInt16 nCol ) { SvButtonState eState = SV_BUTTON_UNCHECKED; - SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem(nCol + 1)); - DBG_ASSERT(pItem,"GetChButnState:Item not found"); + SvLBoxButton& rItem = static_cast<SvLBoxButton&>(pEntry->GetItem(nCol + 1)); - if (pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) + if (rItem.GetType() == SV_ITEM_ID_LBOXBUTTON) { - SvItemStateFlags nButtonFlags = pItem->GetButtonFlags(); + SvItemStateFlags nButtonFlags = rItem.GetButtonFlags(); eState = SvLBoxButtonData::ConvertToButtonState( nButtonFlags ); } diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx index cb096cab7018..5bc3697056f6 100644 --- a/cui/source/tabpages/macroass.cxx +++ b/cui/source/tabpages/macroass.cxx @@ -126,7 +126,7 @@ void _SfxMacroTabPage::EnableButtons() const SvxMacro* pM = aTbl.Get( (sal_uInt16)reinterpret_cast<sal_uLong>(pE->GetUserData()) ); mpImpl->pDeletePB->Enable( 0 != pM && !mpImpl->bReadOnly ); - OUString sEventMacro = static_cast<const SvLBoxString*>(pE->GetItem( LB_MACROS_ITEMPOS ))->GetText(); + OUString sEventMacro = static_cast<const SvLBoxString&>(pE->GetItem( LB_MACROS_ITEMPOS )).GetText(); OUString sScriptURI = mpImpl->pMacroLB->GetSelectedScriptURI(); mpImpl->pAssignPB->Enable( !mpImpl->bReadOnly && !sScriptURI.equalsIgnoreAsciiCase( sEventMacro ) ); @@ -415,10 +415,10 @@ void _SfxMacroTabPage::FillEvents() SvTreeListEntry* pE = rListBox.GetEntry( n ); if( pE ) { - SvLBoxString* pLItem = static_cast<SvLBoxString*>( pE->GetItem( LB_MACROS_ITEMPOS ) ); - DBG_ASSERT( pLItem && SV_ITEM_ID_LBOXSTRING == pLItem->GetType(), "_SfxMacroTabPage::FillEvents(): no LBoxString" ); + SvLBoxString& rLItem = static_cast<SvLBoxString&>( pE->GetItem( LB_MACROS_ITEMPOS ) ); + DBG_ASSERT( SV_ITEM_ID_LBOXSTRING == rLItem.GetType(), "_SfxMacroTabPage::FillEvents(): no LBoxString" ); - OUString sOld( pLItem->GetText() ); + OUString sOld( rLItem.GetText() ); OUString sNew; sal_uInt16 nEventId = ( sal_uInt16 ) reinterpret_cast<sal_uLong>( pE->GetUserData() ); if( aTbl.IsKeyValid( nEventId ) ) diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx index 50d477d68625..85630214bb10 100644 --- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx +++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx @@ -231,14 +231,14 @@ void SbaTableQueryBrowser::notifyHiContrastChanged() sal_uInt16 nCount = pEntryLoop->ItemCount(); for (sal_uInt16 i=0;i<nCount;++i) { - SvLBoxItem* pItem = pEntryLoop->GetItem(i); - if (!pItem || pItem->GetType() != SV_ITEM_ID_LBOXCONTEXTBMP) + SvLBoxItem& rItem = pEntryLoop->GetItem(i); + if (rItem.GetType() != SV_ITEM_ID_LBOXCONTEXTBMP) continue; - SvLBoxContextBmp* pContextBitmapItem = static_cast< SvLBoxContextBmp* >( pItem ); + SvLBoxContextBmp& rContextBitmapItem = static_cast< SvLBoxContextBmp& >( rItem ); - pContextBitmapItem->SetBitmap1( aImage ); - pContextBitmapItem->SetBitmap2( aImage ); + rContextBitmapItem.SetBitmap1( aImage ); + rContextBitmapItem.SetBitmap2( aImage ); break; } diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx index ed0083b5b56b..352b85c945ba 100644 --- a/dbaccess/source/ui/control/tabletree.cxx +++ b/dbaccess/source/ui/control/tabletree.cxx @@ -112,10 +112,10 @@ void OTableTreeListBox::notifyHiContrastChanged() size_t nCount = pEntryLoop->ItemCount(); for (size_t i=0;i<nCount;++i) { - SvLBoxItem* pItem = pEntryLoop->GetItem(i); - if (pItem && pItem->GetType() == SV_ITEM_ID_LBOXCONTEXTBMP) + SvLBoxItem& rItem = pEntryLoop->GetItem(i); + if (rItem.GetType() == SV_ITEM_ID_LBOXCONTEXTBMP) { - SvLBoxContextBmp* pContextBitmapItem = static_cast< SvLBoxContextBmp* >( pItem ); + SvLBoxContextBmp& rContextBitmapItem = static_cast< SvLBoxContextBmp& >( rItem ); Image aImage; if ( isFolderEntry( pEntryLoop ) ) @@ -128,8 +128,8 @@ void OTableTreeListBox::notifyHiContrastChanged() m_xImageProvider->getImages( sCompleteName, DatabaseObject::TABLE, aImage ); } - pContextBitmapItem->SetBitmap1( aImage ); - pContextBitmapItem->SetBitmap2( aImage ); + rContextBitmapItem.SetBitmap1( aImage ); + rContextBitmapItem.SetBitmap2( aImage ); break; } } diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 34f7ddf3a180..a4cbb28cad31 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -385,17 +385,17 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox ) sal_Int32 n = 0; for ( z = 0; z < nTextPortions; z++ ) { - TextPortion* pPortion = pPPortion->GetTextPortions()[z]; + TextPortion& rPortion = pPPortion->GetTextPortions()[z]; aPortionStr.append(' '); - aPortionStr.append(static_cast<sal_Int32>(pPortion->GetLen())); + aPortionStr.append(static_cast<sal_Int32>(rPortion.GetLen())); aPortionStr.append('('); - aPortionStr.append(static_cast<sal_Int32>(pPortion->GetSize().Width())); + aPortionStr.append(static_cast<sal_Int32>(rPortion.GetSize().Width())); aPortionStr.append(')'); aPortionStr.append('['); - aPortionStr.append(static_cast<sal_Int32>(pPortion->GetKind())); + aPortionStr.append(static_cast<sal_Int32>(rPortion.GetKind())); aPortionStr.append(']'); aPortionStr.append(';'); - n += pPortion->GetLen(); + n += rPortion.GetLen(); } aPortionStr.append("\nA"); aPortionStr.append(static_cast<sal_Int32>(nPortion)); @@ -410,17 +410,17 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox ) sal_uInt16 nLine; for ( nLine = 0; nLine < pPPortion->GetLines().Count(); nLine++ ) { - EditLine* pLine = pPPortion->GetLines()[nLine]; + EditLine& rLine = pPPortion->GetLines()[nLine]; - OString aLine(OUStringToOString(pPPortion->GetNode()->Copy(pLine->GetStart(), pLine->GetEnd() - pLine->GetStart()), RTL_TEXTENCODING_ASCII_US)); + OString aLine(OUStringToOString(pPPortion->GetNode()->Copy(rLine.GetStart(), rLine.GetEnd() - rLine.GetStart()), RTL_TEXTENCODING_ASCII_US)); fprintf( fp, "\nLine %i\t>%s<", nLine, aLine.getStr() ); } // then the internal data ... for ( nLine = 0; nLine < pPPortion->GetLines().Count(); nLine++ ) { - EditLine* pLine = pPPortion->GetLines()[nLine]; - fprintf( fp, "\nZeile %i:\tStart: %" SAL_PRIdINT32 ",\tEnd: %" SAL_PRIdINT32, nLine, pLine->GetStart(), pLine->GetEnd() ); - fprintf( fp, "\t\tPortions: %" SAL_PRIdINT32 " - %" SAL_PRIdINT32 ".\tHight: %i, Ascent=%i", pLine->GetStartPortion(), pLine->GetEndPortion(), pLine->GetHeight(), pLine->GetMaxAscent() ); + EditLine& rLine = pPPortion->GetLines()[nLine]; + fprintf( fp, "\nZeile %i:\tStart: %" SAL_PRIdINT32 ",\tEnd: %" SAL_PRIdINT32, nLine, rLine.GetStart(), rLine.GetEnd() ); + fprintf( fp, "\t\tPortions: %" SAL_PRIdINT32 " - %" SAL_PRIdINT32 ".\tHight: %i, Ascent=%i", rLine.GetStartPortion(), rLine.GetEndPortion(), rLine.GetHeight(), rLine.GetMaxAscent() ); } fprintf( fp, "\n-----------------------------------------------------------------------------" ); @@ -494,7 +494,7 @@ bool ParaPortion::DbgCheckTextPortions(ParaPortion const& rPara) sal_uInt16 nXLen = 0; for (sal_Int32 nPortion = 0; nPortion < rPara.aTextPortionList.Count(); nPortion++) { - nXLen = nXLen + rPara.aTextPortionList[nPortion]->GetLen(); + nXLen = nXLen + rPara.aTextPortionList[nPortion].GetLen(); } return nXLen == rPara.pNode->Len(); } diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index d1211eea223e..3f1e34283164 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -439,14 +439,14 @@ sal_Int32 TextPortionList::Count() const return (sal_Int32)maPortions.size(); } -const TextPortion* TextPortionList::operator[](sal_Int32 nPos) const +const TextPortion& TextPortionList::operator[](sal_Int32 nPos) const { - return &maPortions[nPos]; + return maPortions[nPos]; } -TextPortion* TextPortionList::operator[](sal_Int32 nPos) +TextPortion& TextPortionList::operator[](sal_Int32 nPos) { - return &maPortions[nPos]; + return maPortions[nPos]; } void TextPortionList::Append(TextPortion* p) @@ -636,12 +636,12 @@ sal_Int32 ParaPortion::GetLineNumber( sal_Int32 nIndex ) const for ( sal_Int32 nLine = 0; nLine < aLineList.Count(); nLine++ ) { - if ( aLineList[nLine]->IsIn( nIndex ) ) + if ( aLineList[nLine].IsIn( nIndex ) ) return (sal_Int32)nLine; } // Then it should be at the end of the last line! - DBG_ASSERT( nIndex == aLineList[ aLineList.Count() - 1 ]->GetEnd(), "Index dead wrong!" ); + DBG_ASSERT( nIndex == aLineList[ aLineList.Count() - 1 ].GetEnd(), "Index dead wrong!" ); return (aLineList.Count()-1); } @@ -656,10 +656,10 @@ void ParaPortion::CorrectValuesBehindLastFormattedLine( sal_Int32 nLastFormatted DBG_ASSERT( nLines, "CorrectPortionNumbersFromLine: Empty Portion?" ); if ( nLastFormattedLine < ( nLines - 1 ) ) { - const EditLine* pLastFormatted = aLineList[ nLastFormattedLine ]; - const EditLine* pUnformatted = aLineList[ nLastFormattedLine+1 ]; - sal_Int32 nPortionDiff = pUnformatted->GetStartPortion() - pLastFormatted->GetEndPortion(); - sal_Int32 nTextDiff = pUnformatted->GetStart() - pLastFormatted->GetEnd(); + const EditLine& rLastFormatted = aLineList[ nLastFormattedLine ]; + const EditLine& rUnformatted = aLineList[ nLastFormattedLine+1 ]; + sal_Int32 nPortionDiff = rUnformatted.GetStartPortion() - rLastFormatted.GetEndPortion(); + sal_Int32 nTextDiff = rUnformatted.GetStart() - rLastFormatted.GetEnd(); nTextDiff++; // LastFormatted->GetEnd() was included => 1 deducted too much! // The first unformatted must begin exactly one Portion behind the last @@ -672,19 +672,19 @@ void ParaPortion::CorrectValuesBehindLastFormattedLine( sal_Int32 nLastFormatted { for ( sal_Int32 nL = nLastFormattedLine+1; nL < nLines; nL++ ) { - EditLine* pLine = aLineList[ nL ]; + EditLine& rLine = aLineList[ nL ]; - pLine->GetStartPortion() = pLine->GetStartPortion() + nPDiff; - pLine->GetEndPortion() = pLine->GetEndPortion() + nPDiff; + rLine.GetStartPortion() = rLine.GetStartPortion() + nPDiff; + rLine.GetEndPortion() = rLine.GetEndPortion() + nPDiff; - pLine->GetStart() = pLine->GetStart() + nTDiff; - pLine->GetEnd() = pLine->GetEnd() + nTDiff; + rLine.GetStart() = rLine.GetStart() + nTDiff; + rLine.GetEnd() = rLine.GetEnd() + nTDiff; - pLine->SetValid(); + rLine.SetValid(); } } } - DBG_ASSERT( aLineList[ aLineList.Count()-1 ]->GetEnd() == pNode->Len(), "CorrectLines: The end is not right!" ); + DBG_ASSERT( aLineList[ aLineList.Count()-1 ].GetEnd() == pNode->Len(), "CorrectLines: The end is not right!" ); } // Shared reverse lookup acceleration pieces ... @@ -1074,20 +1074,19 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion ) { Size aSz; Size aTmpSz; - TextPortion* pPortion; DBG_ASSERT( rParaPortion.GetTextPortions().Count(), "GetTextSize before CreatePortions !" ); for ( sal_Int32 n = nStartPortion; n <= nEndPortion; n++ ) { - pPortion = rParaPortion.GetTextPortions()[n]; - switch ( pPortion->GetKind() ) + TextPortion& rPortion = rParaPortion.GetTextPortions()[n]; + switch ( rPortion.GetKind() ) { case PortionKind::TEXT: case PortionKind::FIELD: case PortionKind::HYPHENATOR: { - aTmpSz = pPortion->GetSize(); + aTmpSz = rPortion.GetSize(); aSz.Width() += aTmpSz.Width(); if ( aSz.Height() < aTmpSz.Height() ) aSz.Height() = aTmpSz.Height(); @@ -1095,7 +1094,7 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion ) break; case PortionKind::TAB: { - aSz.Width() += pPortion->GetSize().Width(); + aSz.Width() += rPortion.GetSize().Width(); } break; case PortionKind::LINEBREAK: break; @@ -1150,14 +1149,14 @@ sal_Int32 EditLineList::Count() const return maLines.size(); } -const EditLine* EditLineList::operator[](sal_Int32 nPos) const +const EditLine& EditLineList::operator[](sal_Int32 nPos) const { - return &maLines[nPos]; + return maLines[nPos]; } -EditLine* EditLineList::operator[](sal_Int32 nPos) +EditLine& EditLineList::operator[](sal_Int32 nPos) { - return &maLines[nPos]; + return maLines[nPos]; } void EditLineList::Append(EditLine* p) diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 503b91a86b98..ce5e117e0b54 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -459,8 +459,8 @@ public: sal_Int32 GetStartPos(sal_Int32 nPortion); void DeleteFromPortion(sal_Int32 nDelFrom); sal_Int32 Count() const; - const TextPortion* operator[](sal_Int32 nPos) const; - TextPortion* operator[](sal_Int32 nPos); + const TextPortion& operator[](sal_Int32 nPos) const; + TextPortion& operator[](sal_Int32 nPos); void Append(TextPortion* p); void Insert(sal_Int32 nPos, TextPortion* p); @@ -574,8 +574,8 @@ public: void DeleteFromLine(sal_Int32 nDelFrom); sal_Int32 FindLine(sal_Int32 nChar, bool bInclEnd); sal_Int32 Count() const; - const EditLine* operator[](sal_Int32 nPos) const; - EditLine* operator[](sal_Int32 nPos); + const EditLine& operator[](sal_Int32 nPos) const; + EditLine& operator[](sal_Int32 nPos); void Append(EditLine* p); void Insert(sal_Int32 nPos, EditLine* p); @@ -633,7 +633,7 @@ public: void SetVisible( bool bVisible ); bool IsVisible() const { return bVisible; } - bool IsEmpty() { return GetTextPortions().Count() == 1 && GetTextPortions()[0]->GetLen() == 0; } + bool IsEmpty() { return GetTextPortions().Count() == 1 && GetTextPortions()[0].GetLen() == 0; } long GetHeight() const { return ( bVisible ? nHeight : 0 ); } sal_Int32 GetFirstLineOffset() const { return ( bVisible ? nFirstLineOffset : 0 ); } diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index b8aaa65e1bd9..e6c2fc091dc2 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1777,7 +1777,7 @@ void EditEngine::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) sal_Int32 nTextPortions = pParaPortion->GetTextPortions().Count(); for ( sal_Int32 n = 0; n < nTextPortions; n++ ) { - nEnd = nEnd + pParaPortion->GetTextPortions()[n]->GetLen(); + nEnd = nEnd + pParaPortion->GetTextPortions()[n].GetLen(); rList.push_back( nEnd ); } } @@ -1884,8 +1884,8 @@ long EditEngine::GetFirstLineStartX( sal_Int32 nParagraph ) DBG_ASSERT( pImpEditEngine->IsFormatted() || !pImpEditEngine->IsFormatting(), "GetFirstLineStartX: Doc not formatted - unable to format!" ); if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); - const EditLine* pFirstLine = pPPortion->GetLines()[0]; - nX = pFirstLine->GetStartPosX(); + const EditLine& rFirstLine = pPPortion->GetLines()[0]; + nX = rFirstLine.GetStartPosX(); } return nX; } @@ -1916,8 +1916,8 @@ Point EditEngine::GetDocPosTopLeft( sal_Int32 nParagraph ) if ( pPPortion->GetLines().Count() ) { // Correct it if large Bullet. - const EditLine* pFirstLine = pPPortion->GetLines()[0]; - aPoint.X() = pFirstLine->GetStartPosX(); + const EditLine& rFirstLine = pPPortion->GetLines()[0]; + aPoint.X() = rFirstLine.GetStartPosX(); } else { @@ -1968,8 +1968,8 @@ bool EditEngine::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder ) DBG_ASSERT( pParaPortion, "ParaPortion?" ); sal_Int32 nLine = pParaPortion->GetLineNumber( aPaM.GetIndex() ); - const EditLine* pLine = pParaPortion->GetLines()[nLine]; - Range aLineXPosStartEnd = pImpEditEngine->GetLineXPosStartEnd( pParaPortion, pLine ); + const EditLine& rLine = pParaPortion->GetLines()[nLine]; + Range aLineXPosStartEnd = pImpEditEngine->GetLineXPosStartEnd( pParaPortion, &rLine ); if ( ( aDocPos.X() >= aLineXPosStartEnd.Min() - nBorder ) && ( aDocPos.X() <= aLineXPosStartEnd.Max() + nBorder ) ) { @@ -2387,7 +2387,7 @@ ParagraphInfos EditEngine::GetParagraphInfos( sal_Int32 nPara ) { const ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions()[nPara]; const EditLine* pLine = (pParaPortion && pParaPortion->GetLines().Count()) ? - pParaPortion->GetLines()[0] : NULL; + &pParaPortion->GetLines()[0] : NULL; DBG_ASSERT( pParaPortion && pLine, "GetParagraphInfos - Paragraph out of range" ); if ( pParaPortion && pLine ) { diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 6037249bf076..2331196d67eb 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -251,12 +251,11 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou for ( sal_uInt16 nLine = nStartLine; nLine <= nEndLine; nLine++ ) { - const EditLine* pLine = pTmpPortion->GetLines()[nLine]; - DBG_ASSERT( pLine, "Line not found: DrawSelection()" ); + const EditLine& rLine = pTmpPortion->GetLines()[nLine]; bool bPartOfLine = false; - sal_Int32 nStartIndex = pLine->GetStart(); - sal_Int32 nEndIndex = pLine->GetEnd(); + sal_Int32 nStartIndex = rLine.GetStart(); + sal_Int32 nEndIndex = rLine.GetEnd(); if ( ( nPara == nStartPara ) && ( nLine == nStartLine ) && ( nStartIndex != aTmpSel.Min().GetIndex() ) ) { nStartIndex = aTmpSel.Min().GetIndex(); @@ -289,7 +288,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou // Now that we have Bidi, the first/last index doesn't have to be the 'most outside' position if ( !bPartOfLine ) { - Range aLineXPosStartEnd = pEditEngine->GetLineXPosStartEnd(pTmpPortion, pLine); + Range aLineXPosStartEnd = pEditEngine->GetLineXPosStartEnd(pTmpPortion, &rLine); aTopLeft.X() = aLineXPosStartEnd.Min(); aBottomRight.X() = aLineXPosStartEnd.Max(); ImplDrawHighlightRect( pTarget, aTopLeft, aBottomRight, pPolyPoly ); @@ -307,8 +306,8 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou DBG_ASSERT( nTmpEndIndex > nTmpStartIndex, "DrawSelection, Start >= End?" ); - long nX1 = pEditEngine->GetXPos(pTmpPortion, pLine, nTmpStartIndex, true); - long nX2 = pEditEngine->GetXPos(pTmpPortion, pLine, nTmpEndIndex); + long nX1 = pEditEngine->GetXPos(pTmpPortion, &rLine, nTmpStartIndex, true); + long nX2 = pEditEngine->GetXPos(pTmpPortion, &rLine, nTmpEndIndex); Point aPt1( std::min( nX1, nX2 ), aTopLeft.Y() ); Point aPt2( std::max( nX1, nX2 ), aBottomRight.Y() ); @@ -762,10 +761,10 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16 aEditCursor.Left() = aEditCursor.Right() = pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GETCRSR_TXTONLY|GETCRSR_PREFERPORTIONSTART ).Left(); sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, true ); - const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; - if ( pTextPortion->GetKind() == PortionKind::TAB ) + const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; + if ( rTextPortion.GetKind() == PortionKind::TAB ) { - aEditCursor.Right() += pTextPortion->GetSize().Width(); + aEditCursor.Right() += rTextPortion.GetSize().Width(); } else { @@ -946,8 +945,8 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16 if ( IsInsertMode() && !aEditSelection.HasRange() && ( pEditEngine->pImpEditEngine->HasDifferentRTLLevels( aPaM.GetNode() ) ) ) { sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, (nShowCursorFlags & GETCRSR_PREFERPORTIONSTART) != 0 ); - const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; - sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft(); + const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; + sal_uInt16 nRTLLevel = rTextPortion.GetRightToLeft(); if ( nRTLLevel%2 ) nCursorDir = CursorDirection::RTL; else diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 6d1321b12ecd..8795dc0ec3c6 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -486,9 +486,9 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( GetEditDoc().GetPos( aPaM.GetNode() ) ); sal_Int32 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), true ); - const EditLine* pLine = pParaPortion->GetLines()[nLine]; - if ( pLine && ( nInputEnd > pLine->GetEnd() ) ) - nInputEnd = pLine->GetEnd(); + const EditLine& rLine = pParaPortion->GetLines()[nLine]; + if ( nInputEnd > rLine.GetEnd() ) + nInputEnd = rLine.GetEnd(); Rectangle aR2 = PaMtoEditCursor( EditPaM( aPaM.GetNode(), nInputEnd ), GETCRSR_ENDOFLINE ); Rectangle aRect = pView->GetImpEditView()->GetWindowPos( aR1 ); pView->GetWindow()->SetCursorRect( &aRect, aR2.Left()-aR1.Right() ); @@ -544,20 +544,17 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( GetEditDoc().GetPos( aPaM.GetNode() ) ); sal_Int32 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), true ); - const EditLine* pLine = pParaPortion->GetLines()[nLine]; - if ( pLine ) + const EditLine& rLine = pParaPortion->GetLines()[nLine]; + std::unique_ptr<Rectangle[]> aRects(new Rectangle[ mpIMEInfos->nLen ]); + for (sal_Int32 i = 0; i < mpIMEInfos->nLen; ++i) { - std::unique_ptr<Rectangle[]> aRects(new Rectangle[ mpIMEInfos->nLen ]); - for (sal_Int32 i = 0; i < mpIMEInfos->nLen; ++i) - { - sal_Int32 nInputPos = mpIMEInfos->aPos.GetIndex() + i; - if ( nInputPos > pLine->GetEnd() ) - nInputPos = pLine->GetEnd(); - Rectangle aR2 = GetEditCursor( pParaPortion, nInputPos ); - aRects[ i ] = pView->GetImpEditView()->GetWindowPos( aR2 ); - } - pView->GetWindow()->SetCompositionCharRect( aRects.get(), mpIMEInfos->nLen ); + sal_Int32 nInputPos = mpIMEInfos->aPos.GetIndex() + i; + if ( nInputPos > rLine.GetEnd() ) + nInputPos = rLine.GetEnd(); + Rectangle aR2 = GetEditCursor( pParaPortion, nInputPos ); + aRects[ i ] = pView->GetImpEditView()->GetWindowPos( aR2 ); } + pView->GetWindow()->SetCompositionCharRect( aRects.get(), mpIMEInfos->nLen ); } } @@ -927,14 +924,14 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara ); sal_Int32 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), false ); - const EditLine* pLine = pParaPortion->GetLines()[nLine]; - bool bEmptyLine = pLine->GetStart() == pLine->GetEnd(); + const EditLine& rLine = pParaPortion->GetLines()[nLine]; + bool bEmptyLine = rLine.GetStart() == rLine.GetEnd(); pEditView->pImpEditView->nExtraCursorFlags = 0; if ( !bEmptyLine ) { - OUString aLine = aPaM.GetNode()->GetString().copy(pLine->GetStart(), pLine->GetEnd() - pLine->GetStart()); + OUString aLine = aPaM.GetNode()->GetString().copy(rLine.GetStart(), rLine.GetEnd() - rLine.GetStart()); const sal_Unicode* pLineString = aLine.getStr(); @@ -949,12 +946,12 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& ubidi_close( pBidi ); - aPaM.SetIndex( nLogPos + pLine->GetStart() ); + aPaM.SetIndex( nLogPos + rLine.GetStart() ); sal_Int32 nTmp; sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTmp, true ); - const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; - sal_Int32 nRTLLevel = pTextPortion->GetRightToLeft(); + const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; + sal_Int32 nRTLLevel = rTextPortion.GetRightToLeft(); bool bPortionRTL = (nRTLLevel%2) != 0; if ( bStart ) @@ -983,8 +980,8 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara ); sal_Int32 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), false ); - const EditLine* pLine = pParaPortion->GetLines()[nLine]; - bool bEmptyLine = pLine->GetStart() == pLine->GetEnd(); + const EditLine& rLine = pParaPortion->GetLines()[nLine]; + bool bEmptyLine = rLine.GetStart() == rLine.GetEnd(); pEditView->pImpEditView->nExtraCursorFlags = 0; @@ -1017,10 +1014,10 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM // Check if we are within a portion and don't have overwrite mode, then it's easy... sal_Int32 nPortionStart; sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, false ); - const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; + const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; - bool bPortionBoundary = ( aPaM.GetIndex() == nPortionStart ) || ( aPaM.GetIndex() == (nPortionStart+pTextPortion->GetLen()) ); - sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft(); + bool bPortionBoundary = ( aPaM.GetIndex() == nPortionStart ) || ( aPaM.GetIndex() == (nPortionStart+rTextPortion.GetLen()) ); + sal_uInt16 nRTLLevel = rTextPortion.GetRightToLeft(); // Portion boundary doesn't matter if both have same RTL level sal_Int32 nRTLLevelNextPortion = -1; @@ -1028,8 +1025,8 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM { sal_Int32 nTmp; sal_Int32 nNextTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex()+1, nTmp, !bLogicalBackward ); - const TextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[nNextTextPortion]; - nRTLLevelNextPortion = pNextTextPortion->GetRightToLeft(); + const TextPortion& rNextTextPortion = pParaPortion->GetTextPortions()[nNextTextPortion]; + nRTLLevelNextPortion = rNextTextPortion.GetRightToLeft(); } if ( !bPortionBoundary || ( nRTLLevel == nRTLLevelNextPortion ) ) @@ -1053,8 +1050,8 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM bool bGotoStartOfNextLine = false; bool bGotoEndOfPrevLine = false; - OUString aLine = aPaM.GetNode()->GetString().copy(pLine->GetStart(), pLine->GetEnd() - pLine->GetStart()); - const sal_Int32 nPosInLine = aPaM.GetIndex() - pLine->GetStart(); + OUString aLine = aPaM.GetNode()->GetString().copy(rLine.GetStart(), rLine.GetEnd() - rLine.GetStart()); + const sal_Int32 nPosInLine = aPaM.GetIndex() - rLine.GetStart(); const sal_Unicode* pLineString = aLine.getStr(); @@ -1083,7 +1080,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM if ( !bGotoEndOfPrevLine && !bGotoStartOfNextLine ) { - aPaM.SetIndex( pLine->GetStart() + ubidi_getLogicalIndex( pBidi, nVisPos, &nError ) ); + aPaM.SetIndex( rLine.GetStart() + ubidi_getLogicalIndex( pBidi, nVisPos, &nError ) ); pEditView->pImpEditView->SetCursorBidiLevel( 0 ); } } @@ -1096,8 +1093,8 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM sal_Int32 nPortionStart; sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, bBeforePortion ); - const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; - bool bRTLPortion = (pTextPortion->GetRightToLeft() % 2) != 0; + const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; + bool bRTLPortion = (rTextPortion.GetRightToLeft() % 2) != 0; // -1: We are 'behind' the character long nVisPos = (long)ubidi_getVisualIndex( pBidi, bWasBehind ? nPosInLine-1 : nPosInLine, &nError ); @@ -1117,16 +1114,16 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM if ( !bGotoEndOfPrevLine && !bGotoStartOfNextLine ) { - aPaM.SetIndex( pLine->GetStart() + ubidi_getLogicalIndex( pBidi, nVisPos, &nError ) ); + aPaM.SetIndex( rLine.GetStart() + ubidi_getLogicalIndex( pBidi, nVisPos, &nError ) ); // RTL portion, stay visually on the left side. sal_Int32 _nPortionStart; // sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, !bRTLPortion ); sal_Int32 _nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), _nPortionStart, true ); - const TextPortion* _pTextPortion = pParaPortion->GetTextPortions()[_nTextPortion]; - if ( bVisualToLeft && !bRTLPortion && ( _pTextPortion->GetRightToLeft() % 2 ) ) + const TextPortion& _rTextPortion = pParaPortion->GetTextPortions()[_nTextPortion]; + if ( bVisualToLeft && !bRTLPortion && ( _rTextPortion.GetRightToLeft() % 2 ) ) aPaM.SetIndex( aPaM.GetIndex()+1 ); - else if ( !bVisualToLeft && bRTLPortion && ( bWasBehind || !(_pTextPortion->GetRightToLeft() % 2 )) ) + else if ( !bVisualToLeft && bRTLPortion && ( bWasBehind || !(_rTextPortion.GetRightToLeft() % 2 )) ) aPaM.SetIndex( aPaM.GetIndex()+1 ); pEditView->pImpEditView->SetCursorBidiLevel( _nPortionStart ); @@ -1213,12 +1210,12 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView ) const ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() ); OSL_ENSURE( pPPortion, "No matching portion found: CursorUp "); sal_Int32 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); - const EditLine* pLine = pPPortion->GetLines()[nLine]; + const EditLine& rLine = pPPortion->GetLines()[nLine]; long nX; if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW ) { - nX = GetXPos( pPPortion, pLine, rPaM.GetIndex() ); + nX = GetXPos( pPPortion, &rLine, rPaM.GetIndex() ); pView->pImpEditView->nTravelXPos = nX+nOnePixelInRef; } else @@ -1227,13 +1224,13 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView ) EditPaM aNewPaM( rPaM ); if ( nLine ) // same paragraph { - const EditLine* pPrevLine = pPPortion->GetLines()[nLine-1]; - aNewPaM.SetIndex( GetChar( pPPortion, pPrevLine, nX ) ); + const EditLine& rPrevLine = pPPortion->GetLines()[nLine-1]; + aNewPaM.SetIndex( GetChar( pPPortion, &rPrevLine, nX ) ); // If a previous automatically wrapped line, and one has to be exactly // at the end of this line, the cursor lands on the current line at the // beginning. See Problem: Last character of an automatically wrapped // Row = cursor - if ( aNewPaM.GetIndex() && ( aNewPaM.GetIndex() == pLine->GetStart() ) ) + if ( aNewPaM.GetIndex() && ( aNewPaM.GetIndex() == rLine.GetStart() ) ) aNewPaM = CursorLeft( aNewPaM ); } else // previous paragraph @@ -1241,10 +1238,9 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView ) const ParaPortion* pPrevPortion = GetPrevVisPortion( pPPortion ); if ( pPrevPortion ) { - pLine = pPrevPortion->GetLines()[pPrevPortion->GetLines().Count()-1]; - OSL_ENSURE( pLine, "Line in front not found: CursorUp" ); + const EditLine& rLine2 = pPrevPortion->GetLines()[pPrevPortion->GetLines().Count()-1]; aNewPaM.SetNode( pPrevPortion->GetNode() ); - aNewPaM.SetIndex( GetChar( pPrevPortion, pLine, nX+nOnePixelInRef ) ); + aNewPaM.SetIndex( GetChar( pPrevPortion, &rLine2, nX+nOnePixelInRef ) ); } } @@ -1262,8 +1258,8 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView ) long nX; if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW ) { - const EditLine* pLine = pPPortion->GetLines()[nLine]; - nX = GetXPos( pPPortion, pLine, rPaM.GetIndex() ); + const EditLine& rLine = pPPortion->GetLines()[nLine]; + nX = GetXPos( pPPortion, &rLine, rPaM.GetIndex() ); pView->pImpEditView->nTravelXPos = nX+nOnePixelInRef; } else @@ -1272,10 +1268,10 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView ) EditPaM aNewPaM( rPaM ); if ( nLine < pPPortion->GetLines().Count()-1 ) { - const EditLine* pNextLine = pPPortion->GetLines()[nLine+1]; - aNewPaM.SetIndex( GetChar( pPPortion, pNextLine, nX ) ); + const EditLine& rNextLine = pPPortion->GetLines()[nLine+1]; + aNewPaM.SetIndex( GetChar( pPPortion, &rNextLine, nX ) ); // Special treatment, see CursorUp ... - if ( ( aNewPaM.GetIndex() == pNextLine->GetEnd() ) && ( aNewPaM.GetIndex() > pNextLine->GetStart() ) && ( aNewPaM.GetIndex() < pPPortion->GetNode()->Len() ) ) + if ( ( aNewPaM.GetIndex() == rNextLine.GetEnd() ) && ( aNewPaM.GetIndex() > rNextLine.GetStart() ) && ( aNewPaM.GetIndex() < pPPortion->GetNode()->Len() ) ) aNewPaM = CursorLeft( aNewPaM ); } else // next paragraph @@ -1283,13 +1279,12 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView ) const ParaPortion* pNextPortion = GetNextVisPortion( pPPortion ); if ( pNextPortion ) { - const EditLine* pLine = pNextPortion->GetLines()[0]; - OSL_ENSURE( pLine, "Line in front not found: CursorUp" ); + const EditLine& rLine = pNextPortion->GetLines()[0]; aNewPaM.SetNode( pNextPortion->GetNode() ); // Never at the very end when several lines, because then a line // below the cursor appears. - aNewPaM.SetIndex( GetChar( pNextPortion, pLine, nX+nOnePixelInRef ) ); - if ( ( aNewPaM.GetIndex() == pLine->GetEnd() ) && ( aNewPaM.GetIndex() > pLine->GetStart() ) && ( pNextPortion->GetLines().Count() > 1 ) ) + aNewPaM.SetIndex( GetChar( pNextPortion, &rLine, nX+nOnePixelInRef ) ); + if ( ( aNewPaM.GetIndex() == rLine.GetEnd() ) && ( aNewPaM.GetIndex() > rLine.GetStart() ) && ( pNextPortion->GetLines().Count() > 1 ) ) aNewPaM = CursorLeft( aNewPaM ); } } @@ -1302,11 +1297,10 @@ EditPaM ImpEditEngine::CursorStartOfLine( const EditPaM& rPaM ) const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() ); OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" ); sal_Int32 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); - const EditLine* pLine = pCurPortion->GetLines()[nLine]; - OSL_ENSURE( pLine, "Current line not found ?!" ); + const EditLine& rLine = pCurPortion->GetLines()[nLine]; EditPaM aNewPaM( rPaM ); - aNewPaM.SetIndex( pLine->GetStart() ); + aNewPaM.SetIndex( rLine.GetStart() ); return aNewPaM; } @@ -1315,12 +1309,11 @@ EditPaM ImpEditEngine::CursorEndOfLine( const EditPaM& rPaM ) const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() ); OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" ); sal_Int32 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); - const EditLine* pLine = pCurPortion->GetLines()[nLine]; - OSL_ENSURE( pLine, "Current line not found ?!" ); + const EditLine& rLine = pCurPortion->GetLines()[nLine]; EditPaM aNewPaM( rPaM ); - aNewPaM.SetIndex( pLine->GetEnd() ); - if ( pLine->GetEnd() > pLine->GetStart() ) + aNewPaM.SetIndex( rLine.GetEnd() ); + if ( rLine.GetEnd() > rLine.GetStart() ) { if ( aNewPaM.GetNode()->IsFeature( aNewPaM.GetIndex() - 1 ) ) { @@ -1970,8 +1963,8 @@ bool ImpEditEngine::HasDifferentRTLLevels( const ContentNode* pNode ) sal_uInt16 nRTLLevel = IsRightToLeft( nPara ) ? 1 : 0; for ( sal_Int32 n = 0; n < (sal_Int32)pParaPortion->GetTextPortions().Count(); n++ ) { - const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[n]; - if ( pTextPortion->GetRightToLeft() != nRTLLevel ) + const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[n]; + if ( rTextPortion.GetRightToLeft() != nRTLLevel ) { bHasDifferentRTLLevels = true; break; @@ -3059,8 +3052,6 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace ) if ( !IsFormatted() && !IsFormatting() ) FormatDoc(); - EditLine* pLine; - long nMaxWidth = 0; long nCurWidth = 0; @@ -3082,8 +3073,7 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace ) sal_Int32 nLines = (sal_Int32)pPortion->GetLines().Count(); for ( sal_Int32 nLine = 0; nLine < nLines; nLine++ ) { - pLine = pPortion->GetLines()[nLine]; - OSL_ENSURE( pLine, "NULL-Pointer in the line iterator in CalcWidth" ); + EditLine& rLine = pPortion->GetLines()[nLine]; // nCurWidth = pLine->GetStartPosX(); // For Center- or Right- alignment it depends on the paper // width, here not preferred. I general, it is best not leave it @@ -3102,7 +3092,7 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace ) } } nCurWidth += GetXValue( rLRItem.GetRight() ); - nCurWidth += CalcLineWidth( pPortion, pLine, bIgnoreExtraSpace ); + nCurWidth += CalcLineWidth( pPortion, &rLine, bIgnoreExtraSpace ); if ( nCurWidth > nMaxWidth ) { nMaxWidth = nCurWidth; @@ -3132,21 +3122,21 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, sal_Int32 nPos = pLine->GetStart(); for ( sal_Int32 nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ ) { - const TextPortion* pTextPortion = pPortion->GetTextPortions()[nTP]; - switch ( pTextPortion->GetKind() ) + const TextPortion& rTextPortion = pPortion->GetTextPortions()[nTP]; + switch ( rTextPortion.GetKind() ) { case PortionKind::FIELD: case PortionKind::HYPHENATOR: case PortionKind::TAB: { - nWidth += pTextPortion->GetSize().Width(); + nWidth += rTextPortion.GetSize().Width(); } break; case PortionKind::TEXT: { if ( ( eJustification != SVX_ADJUST_BLOCK ) || ( !bIgnoreExtraSpace ) ) { - nWidth += pTextPortion->GetSize().Width(); + nWidth += rTextPortion.GetSize().Width(); } else { @@ -3154,13 +3144,13 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, SeekCursor( pPortion->GetNode(), nPos+1, aTmpFont ); aTmpFont.SetPhysFont( GetRefDevice() ); ImplInitDigitMode(GetRefDevice(), aTmpFont.GetLanguage()); - nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), pPortion->GetNode()->GetString(), nPos, pTextPortion->GetLen(), NULL ).Width(); + nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), pPortion->GetNode()->GetString(), nPos, rTextPortion.GetLen(), NULL ).Width(); } } break; case PortionKind::LINEBREAK: break; } - nPos = nPos + pTextPortion->GetLen(); + nPos = nPos + rTextPortion.GetLen(); } GetRefDevice()->Pop(); @@ -3217,9 +3207,8 @@ sal_Int32 ImpEditEngine::GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) con OSL_ENSURE( pPPortion, "Paragraph not found: GetLineLen" ); if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) ) { - const EditLine* pLine = pPPortion->GetLines()[nLine]; - OSL_ENSURE( pLine, "Line not found: GetLineHeight" ); - return pLine->GetLen(); + const EditLine& rLine = pPPortion->GetLines()[nLine]; + return rLine.GetLen(); } return -1; @@ -3233,10 +3222,9 @@ void ImpEditEngine::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int3 rStart = rEnd = -1; // default values in case of error if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) ) { - const EditLine* pLine = pPPortion->GetLines()[nLine]; - assert(pLine && "Line not found: GetLineBoundaries"); - rStart = pLine->GetStart(); - rEnd = pLine->GetEnd(); + const EditLine& rLine = pPPortion->GetLines()[nLine]; + rStart = rLine.GetStart(); + rEnd = rLine.GetEnd(); } } @@ -3274,9 +3262,8 @@ sal_uInt16 ImpEditEngine::GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine ) OSL_ENSURE( pPPortion, "Paragraph not found: GetLineHeight" ); if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) ) { - const EditLine* pLine = pPPortion->GetLines()[nLine]; - OSL_ENSURE( pLine, "Paragraph not found: GetLineHeight" ); - return pLine->GetHeight(); + const EditLine& rLine = pPPortion->GetLines()[nLine]; + return rLine.GetHeight(); } return 0xFFFF; @@ -3565,15 +3552,15 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion ) sal_Int32 nLine; for ( nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) { - const EditLine* pL = pPortion->GetLines()[nLine]; - if ( pL->IsInvalid() ) + const EditLine& rL = pPortion->GetLines()[nLine]; + if ( rL.IsInvalid() ) { nFirstInvalid = nLine; break; } if ( nLine && !aStatus.IsOutliner() ) // not the first line aRange.Min() += nSBL; - aRange.Min() += pL->GetHeight(); + aRange.Min() += rL.GetHeight(); } OSL_ENSURE( nFirstInvalid != -1, "No invalid line found in GetInvalidYOffset(1)" ); @@ -3589,22 +3576,22 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion ) { for ( nLine = nFirstInvalid; nLine < pPortion->GetLines().Count(); nLine++ ) { - const EditLine* pL = pPortion->GetLines()[nLine]; - if ( pL->IsValid() ) + const EditLine& rL = pPortion->GetLines()[nLine]; + if ( rL.IsValid() ) { nLastInvalid = nLine; break; } if ( nLine && !aStatus.IsOutliner() ) aRange.Max() += nSBL; - aRange.Max() += pL->GetHeight(); + aRange.Max() += rL.GetHeight(); } if( ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) && rLSItem.GetPropLineSpace() && ( rLSItem.GetPropLineSpace() < 100 ) ) { - const EditLine* pL = pPortion->GetLines()[nFirstInvalid]; - long n = pL->GetTxtHeight() * ( 100L - rLSItem.GetPropLineSpace() ); + const EditLine& rL = pPortion->GetLines()[nFirstInvalid]; + long n = rL.GetTxtHeight() * ( 100L - rLSItem.GetPropLineSpace() ); n /= 100; aRange.Min() -= n; aRange.Max() += n; @@ -3637,17 +3624,17 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, bool bSmart const EditLine* pLine = NULL; for ( sal_Int32 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) { - const EditLine* pTmpLine = pPortion->GetLines()[nLine]; - nY += pTmpLine->GetHeight(); + const EditLine& rTmpLine = pPortion->GetLines()[nLine]; + nY += rTmpLine.GetHeight(); if ( !aStatus.IsOutliner() ) nY += nSBL; if ( nY > aDocPos.Y() ) { - pLine = pTmpLine; + pLine = &rTmpLine; break; // correct Y-position is not of interest } - nCurIndex = nCurIndex + pTmpLine->GetLen(); + nCurIndex = nCurIndex + rTmpLine.GetLen(); } if ( !pLine ) // may happen only in the range of SA! @@ -3665,7 +3652,7 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, bool bSmart aPaM.SetIndex( nCurIndex ); if ( nCurIndex && ( nCurIndex == pLine->GetEnd() ) && - ( pLine != pPortion->GetLines()[pPortion->GetLines().Count()-1] ) ) + ( pLine != &pPortion->GetLines()[pPortion->GetLines().Count()-1] ) ) { aPaM = CursorLeft( aPaM, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL ); } @@ -3685,9 +3672,9 @@ sal_Int32 ImpEditEngine::GetChar( // Search best matching portion with GetPortionXOffset() for ( sal_Int32 i = pLine->GetStartPortion(); i <= pLine->GetEndPortion(); i++ ) { - const TextPortion* pPortion = pParaPortion->GetTextPortions()[i]; + const TextPortion& rPortion = pParaPortion->GetTextPortions()[i]; long nXLeft = GetPortionXOffset( pParaPortion, pLine, i ); - long nXRight = nXLeft + pPortion->GetSize().Width(); + long nXRight = nXLeft + rPortion.GetSize().Width(); if ( ( nXLeft <= nXPos ) && ( nXRight >= nXPos ) ) { nChar = nCurIndex; @@ -3695,7 +3682,7 @@ sal_Int32 ImpEditEngine::GetChar( // Search within Portion... // Don't search within special portions... - if ( pPortion->GetKind() != PortionKind::TEXT ) + if ( rPortion.GetKind() != PortionKind::TEXT ) { // ...but check on which side if ( bSmart ) @@ -3708,12 +3695,12 @@ sal_Int32 ImpEditEngine::GetChar( } else { - sal_Int32 nMax = pPortion->GetLen(); + sal_Int32 nMax = rPortion.GetLen(); sal_Int32 nOffset = -1; sal_Int32 nTmpCurIndex = nChar - pLine->GetStart(); long nXInPortion = nXPos - nXLeft; - if ( pPortion->IsRightToLeft() ) + if ( rPortion.IsRightToLeft() ) nXInPortion = nXRight - nXPos; // Search in Array... @@ -3775,7 +3762,7 @@ sal_Int32 ImpEditEngine::GetChar( } } - nCurIndex = nCurIndex + pPortion->GetLen(); + nCurIndex = nCurIndex + rPortion.GetLen(); } if ( nChar == -1 ) @@ -3813,15 +3800,15 @@ long ImpEditEngine::GetPortionXOffset( for ( sal_Int32 i = pLine->GetStartPortion(); i < nTextPortion; i++ ) { - const TextPortion* pPortion = pParaPortion->GetTextPortions()[i]; - switch ( pPortion->GetKind() ) + const TextPortion& rPortion = pParaPortion->GetTextPortions()[i]; + switch ( rPortion.GetKind() ) { case PortionKind::FIELD: case PortionKind::TEXT: case PortionKind::HYPHENATOR: case PortionKind::TAB: { - nX += pPortion->GetSize().Width(); + nX += rPortion.GetSize().Width(); } break; case PortionKind::LINEBREAK: break; @@ -3831,18 +3818,18 @@ long ImpEditEngine::GetPortionXOffset( sal_Int32 nPara = GetEditDoc().GetPos( pParaPortion->GetNode() ); bool bR2LPara = IsRightToLeft( nPara ); - const TextPortion* pDestPortion = pParaPortion->GetTextPortions()[nTextPortion]; - if ( pDestPortion->GetKind() != PortionKind::TAB ) + const TextPortion& rDestPortion = pParaPortion->GetTextPortions()[nTextPortion]; + if ( rDestPortion.GetKind() != PortionKind::TAB ) { - if ( !bR2LPara && pDestPortion->GetRightToLeft() ) + if ( !bR2LPara && rDestPortion.GetRightToLeft() ) { // Portions behind must be added, visual before this portion sal_Int32 nTmpPortion = nTextPortion+1; while ( nTmpPortion <= pLine->GetEndPortion() ) { - const TextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[nTmpPortion]; - if ( pNextTextPortion->GetRightToLeft() && ( pNextTextPortion->GetKind() != PortionKind::TAB ) ) - nX += pNextTextPortion->GetSize().Width(); + const TextPortion& rNextTextPortion = pParaPortion->GetTextPortions()[nTmpPortion]; + if ( rNextTextPortion.GetRightToLeft() && ( rNextTextPortion.GetKind() != PortionKind::TAB ) ) + nX += rNextTextPortion.GetSize().Width(); else break; nTmpPortion++; @@ -3852,22 +3839,22 @@ long ImpEditEngine::GetPortionXOffset( while ( nTmpPortion > pLine->GetStartPortion() ) { --nTmpPortion; - const TextPortion* pPrevTextPortion = pParaPortion->GetTextPortions()[nTmpPortion]; - if ( pPrevTextPortion->GetRightToLeft() && ( pPrevTextPortion->GetKind() != PortionKind::TAB ) ) - nX -= pPrevTextPortion->GetSize().Width(); + const TextPortion& rPrevTextPortion = pParaPortion->GetTextPortions()[nTmpPortion]; + if ( rPrevTextPortion.GetRightToLeft() && ( rPrevTextPortion.GetKind() != PortionKind::TAB ) ) + nX -= rPrevTextPortion.GetSize().Width(); else break; } } - else if ( bR2LPara && !pDestPortion->IsRightToLeft() ) + else if ( bR2LPara && !rDestPortion.IsRightToLeft() ) { // Portions behind must be removed, visual behind this portion sal_Int32 nTmpPortion = nTextPortion+1; while ( nTmpPortion <= pLine->GetEndPortion() ) { - const TextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[nTmpPortion]; - if ( !pNextTextPortion->IsRightToLeft() && ( pNextTextPortion->GetKind() != PortionKind::TAB ) ) - nX += pNextTextPortion->GetSize().Width(); + const TextPortion& rNextTextPortion = pParaPortion->GetTextPortions()[nTmpPortion]; + if ( !rNextTextPortion.IsRightToLeft() && ( rNextTextPortion.GetKind() != PortionKind::TAB ) ) + nX += rNextTextPortion.GetSize().Width(); else break; nTmpPortion++; @@ -3877,9 +3864,9 @@ long ImpEditEngine::GetPortionXOffset( while ( nTmpPortion > pLine->GetStartPortion() ) { --nTmpPortion; - const TextPortion* pPrevTextPortion = pParaPortion->GetTextPortions()[nTmpPortion]; - if ( !pPrevTextPortion->IsRightToLeft() && ( pPrevTextPortion->GetKind() != PortionKind::TAB ) ) - nX -= pPrevTextPortion->GetSize().Width(); + const TextPortion& rPrevTextPortion = pParaPortion->GetTextPortions()[nTmpPortion]; + if ( !rPrevTextPortion.IsRightToLeft() && ( rPrevTextPortion.GetKind() != PortionKind::TAB ) ) + nX -= rPrevTextPortion.GetSize().Width(); else break; } @@ -3891,7 +3878,7 @@ long ImpEditEngine::GetPortionXOffset( OSL_ENSURE( GetTextRanger() || GetPaperSize().Width(), "GetPortionXOffset - paper size?!" ); OSL_ENSURE( GetTextRanger() || (nX <= GetPaperSize().Width()), "GetPortionXOffset - position out of paper size!" ); nX = GetPaperSize().Width() - nX; - nX -= pDestPortion->GetSize().Width(); + nX -= rDestPortion.GetSize().Width(); } return nX; @@ -3915,28 +3902,28 @@ long ImpEditEngine::GetXPos( OSL_ENSURE( ( nTextPortion >= pLine->GetStartPortion() ) && ( nTextPortion <= pLine->GetEndPortion() ), "GetXPos: Portion not in current line! " ); - const TextPortion* pPortion = pParaPortion->GetTextPortions()[nTextPortion]; + const TextPortion& rPortion = pParaPortion->GetTextPortions()[nTextPortion]; long nX = GetPortionXOffset( pParaPortion, pLine, nTextPortion ); // calc text width, portion size may include CJK/CTL spacing... // But the array might not be init yet, if using text ranger this method is called within CreateLines()... - long nPortionTextWidth = pPortion->GetSize().Width(); - if ( ( pPortion->GetKind() == PortionKind::TEXT ) && pPortion->GetLen() && !GetTextRanger() ) - nPortionTextWidth = pLine->GetCharPosArray()[nTextPortionStart + pPortion->GetLen() - 1 - pLine->GetStart()]; + long nPortionTextWidth = rPortion.GetSize().Width(); + if ( ( rPortion.GetKind() == PortionKind::TEXT ) && rPortion.GetLen() && !GetTextRanger() ) + nPortionTextWidth = pLine->GetCharPosArray()[nTextPortionStart + rPortion.GetLen() - 1 - pLine->GetStart()]; if ( nTextPortionStart != nIndex ) { // Search within portion... - if ( nIndex == ( nTextPortionStart + pPortion->GetLen() ) ) + if ( nIndex == ( nTextPortionStart + rPortion.GetLen() ) ) { // End of Portion - if ( pPortion->GetKind() == PortionKind::TAB ) + if ( rPortion.GetKind() == PortionKind::TAB ) { if ( nTextPortion+1 < pParaPortion->GetTextPortions().Count() ) { - const TextPortion* pNextPortion = pParaPortion->GetTextPortions()[nTextPortion+1]; - if ( pNextPortion->GetKind() != PortionKind::TAB ) + const TextPortion& rNextPortion = pParaPortion->GetTextPortions()[nTextPortion+1]; + if ( rNextPortion.GetKind() != PortionKind::TAB ) { if ( !bPreferPortionStart ) nX = GetXPos( pParaPortion, pLine, nIndex, true ); @@ -3949,12 +3936,12 @@ long ImpEditEngine::GetXPos( nX += nPortionTextWidth; } } - else if ( !pPortion->IsRightToLeft() ) + else if ( !rPortion.IsRightToLeft() ) { nX += nPortionTextWidth; } } - else if ( pPortion->GetKind() == PortionKind::TEXT ) + else if ( rPortion.GetKind() == PortionKind::TEXT ) { OSL_ENSURE( nIndex != pLine->GetStart(), "Strange behavior in new GetXPos()" ); OSL_ENSURE( pLine && pLine->GetCharPosArray().size(), "svx::ImpEditEngine::GetXPos(), portion in an empty line?" ); @@ -3971,7 +3958,7 @@ long ImpEditEngine::GetXPos( // old code restored see #i112788 (which leaves #i74188 unfixed again) long nPosInPortion = pLine->GetCharPosArray()[nPos]; - if ( !pPortion->IsRightToLeft() ) + if ( !rPortion.IsRightToLeft() ) { nX += nPosInPortion; } @@ -3980,28 +3967,28 @@ long ImpEditEngine::GetXPos( nX += nPortionTextWidth - nPosInPortion; } - if ( pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed ) + if ( rPortion.GetExtraInfos() && rPortion.GetExtraInfos()->bCompressed ) { - nX += pPortion->GetExtraInfos()->nPortionOffsetX; - if ( pPortion->GetExtraInfos()->nAsianCompressionTypes & CHAR_PUNCTUATIONRIGHT ) + nX += rPortion.GetExtraInfos()->nPortionOffsetX; + if ( rPortion.GetExtraInfos()->nAsianCompressionTypes & CHAR_PUNCTUATIONRIGHT ) { sal_uInt8 nType = GetCharTypeForCompression( pParaPortion->GetNode()->GetChar( nIndex ) ); if ( nType == CHAR_PUNCTUATIONRIGHT && !pLine->GetCharPosArray().empty() ) { sal_Int32 n = nIndex - nTextPortionStart; const long* pDXArray = &pLine->GetCharPosArray()[0]+( nTextPortionStart-pLine->GetStart() ); - sal_Int32 nCharWidth = ( ( (n+1) < pPortion->GetLen() ) ? pDXArray[n] : pPortion->GetSize().Width() ) + sal_Int32 nCharWidth = ( ( (n+1) < rPortion.GetLen() ) ? pDXArray[n] : rPortion.GetSize().Width() ) - ( n ? pDXArray[n-1] : 0 ); - if ( (n+1) < pPortion->GetLen() ) + if ( (n+1) < rPortion.GetLen() ) { // smaller, when char behind is CHAR_PUNCTUATIONRIGHT also nType = GetCharTypeForCompression( pParaPortion->GetNode()->GetChar( nIndex+1 ) ); if ( nType == CHAR_PUNCTUATIONRIGHT ) { - sal_Int32 nNextCharWidth = ( ( (n+2) < pPortion->GetLen() ) ? pDXArray[n+1] : pPortion->GetSize().Width() ) + sal_Int32 nNextCharWidth = ( ( (n+2) < rPortion.GetLen() ) ? pDXArray[n+1] : rPortion.GetSize().Width() ) - pDXArray[n]; sal_Int32 nCompressed = nNextCharWidth/2; - nCompressed *= pPortion->GetExtraInfos()->nMaxCompression100thPercent; + nCompressed *= rPortion.GetExtraInfos()->nMaxCompression100thPercent; nCompressed /= 10000; nCharWidth += nCompressed; } @@ -4019,7 +4006,7 @@ long ImpEditEngine::GetXPos( } else // if ( nIndex == pLine->GetStart() ) { - if ( pPortion->IsRightToLeft() ) + if ( rPortion.IsRightToLeft() ) { nX += nPortionTextWidth; } @@ -4037,7 +4024,7 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion ) { OSL_ENSURE( pPortion->GetLines().Count(), "Paragraph with no lines in ParaPortion::CalcHeight" ); for (sal_Int32 nLine = 0; nLine < pPortion->GetLines().Count(); ++nLine) - pPortion->nHeight += pPortion->GetLines()[nLine]->GetHeight(); + pPortion->nHeight += pPortion->GetLines()[nLine].GetHeight(); if ( !aStatus.IsOutliner() ) { @@ -4153,15 +4140,15 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_Int32 nIndex, bool bEOL = ( nFlags & GETCRSR_ENDOFLINE ) != 0; for (sal_Int32 nLine = 0; nLine < nLineCount; ++nLine) { - const EditLine* pTmpLine = pPortion->GetLines()[nLine]; - if ( ( pTmpLine->GetStart() == nIndex ) || ( pTmpLine->IsIn( nIndex, bEOL ) ) ) + const EditLine& rTmpLine = pPortion->GetLines()[nLine]; + if ( ( rTmpLine.GetStart() == nIndex ) || ( rTmpLine.IsIn( nIndex, bEOL ) ) ) { - pLine = pTmpLine; + pLine = &rTmpLine; break; } - nCurIndex = nCurIndex + pTmpLine->GetLen(); - nY += pTmpLine->GetHeight(); + nCurIndex = nCurIndex + rTmpLine.GetLen(); + nY += rTmpLine.GetHeight(); if ( !aStatus.IsOutliner() ) nY += nSBL; } @@ -4170,7 +4157,7 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_Int32 nIndex, // Cursor at the End of the paragraph. OSL_ENSURE( nIndex == nCurIndex, "Index dead wrong in GetEditCursor!" ); - pLine = pPortion->GetLines()[nLineCount-1]; + pLine = &pPortion->GetLines()[nLineCount-1]; nY -= pLine->GetHeight(); if ( !aStatus.IsOutliner() ) nY -= nSBL; diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 2cace763c8b4..7511b33e3c70 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -638,8 +638,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) for ( sal_Int32 nTP = 0; nTP < nPortions; nTP++ ) { // There must be no start / end in the deleted area. - TextPortion* const pTP = pParaPortion->GetTextPortions()[ nTP ]; - nPos = nPos + pTP->GetLen(); + const TextPortion& rTP = pParaPortion->GetTextPortions()[ nTP ]; + nPos = nPos + rTP.GetLen(); if ( ( nPos > nStart ) && ( nPos < nEnd ) ) { bQuickFormat = false; @@ -683,20 +683,20 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) sal_Int32 nLine = pParaPortion->GetLines().Count()-1; for ( sal_Int32 nL = 0; nL <= nLine; nL++ ) { - EditLine* pLine = pParaPortion->GetLines()[nL]; - if ( pLine->GetEnd() > nRealInvalidStart ) // not nInvalidStart! + EditLine& rLine = pParaPortion->GetLines()[nL]; + if ( rLine.GetEnd() > nRealInvalidStart ) // not nInvalidStart! { nLine = nL; break; } - pLine->SetValid(); + rLine.SetValid(); } // Begin one line before... // If it is typed at the end, the line in front cannot change. if ( nLine && ( !pParaPortion->IsSimpleInvalid() || ( nInvalidEnd < pNode->Len() ) || ( nInvalidDiff <= 0 ) ) ) nLine--; - EditLine* pLine = pParaPortion->GetLines()[nLine]; + EditLine* pLine = &pParaPortion->GetLines()[nLine]; static Rectangle aZeroArea = Rectangle( Point(), Point() ); Rectangle aBulletArea( aZeroArea ); @@ -868,7 +868,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) while ( ( nTmpWidth < nXWidth ) && !bEOL && ( nTmpPortion < pParaPortion->GetTextPortions().Count() ) ) { nPortionStart = nTmpPos; - pPortion = pParaPortion->GetTextPortions()[nTmpPortion]; + pPortion = &pParaPortion->GetTextPortions()[nTmpPortion]; if ( pPortion->GetKind() == PortionKind::HYPHENATOR ) { // Throw away a Portion, if necessary correct the one before, @@ -878,16 +878,16 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) if (nTmpPortion && nTmpLen) { nTmpPortion--; - TextPortion* pPrev = pParaPortion->GetTextPortions()[nTmpPortion]; - DBG_ASSERT( pPrev->GetKind() == PortionKind::TEXT, "Portion?!" ); - nTmpWidth -= pPrev->GetSize().Width(); - nTmpPos = nTmpPos - pPrev->GetLen(); - pPrev->SetLen(pPrev->GetLen() + nTmpLen); - pPrev->GetSize().Width() = (-1); + TextPortion& rPrev = pParaPortion->GetTextPortions()[nTmpPortion]; + DBG_ASSERT( rPrev.GetKind() == PortionKind::TEXT, "Portion?!" ); + nTmpWidth -= rPrev.GetSize().Width(); + nTmpPos = nTmpPos - rPrev.GetLen(); + rPrev.SetLen(rPrev.GetLen() + nTmpLen); + rPrev.GetSize().Width() = (-1); } DBG_ASSERT( nTmpPortion < pParaPortion->GetTextPortions().Count(), "No more Portions left!" ); - pPortion = pParaPortion->GetTextPortions()[nTmpPortion]; + pPortion = &pParaPortion->GetTextPortions()[nTmpPortion]; } DBG_ASSERT( pPortion->GetKind() != PortionKind::HYPHENATOR, "CreateLines: Hyphenator-Portion!" ); DBG_ASSERT( pPortion->GetLen() || bProcessingEmptyLine, "Empty Portion in CreateLines ?!" ); @@ -1101,8 +1101,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) long nWidthAfterTab = 0; for ( sal_Int32 n = aCurrentTab.nTabPortion+1; n <= nTmpPortion; n++ ) { - const TextPortion* pTP = pParaPortion->GetTextPortions()[n]; - nWidthAfterTab += pTP->GetSize().Width(); + const TextPortion& rTP = pParaPortion->GetTextPortions()[n]; + nWidthAfterTab += rTP.GetSize().Width(); } long nW = nWidthAfterTab; // Length before tab position if ( aCurrentTab.aTabStop.GetAdjustment() == SVX_TAB_ADJUST_RIGHT ) @@ -1119,7 +1119,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) sal_Int32 nDecPos = aText.indexOf( aCurrentTab.aTabStop.GetDecimal() ); if ( nDecPos != -1 ) { - nW -= pParaPortion->GetTextPortions()[nTmpPortion]->GetSize().Width(); + nW -= pParaPortion->GetTextPortions()[nTmpPortion].GetSize().Width(); nW += aTmpFont.QuickGetTextSize( GetRefDevice(), pParaPortion->GetNode()->GetString(), nTmpPos, nDecPos, NULL ).Width(); aCurrentTab.bValid = false; } @@ -1134,9 +1134,9 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) nW = nMaxW; aCurrentTab.bValid = false; } - TextPortion* const pTabPortion = pParaPortion->GetTextPortions()[aCurrentTab.nTabPortion]; - pTabPortion->GetSize().Width() = aCurrentTab.nTabPos - aCurrentTab.nStartPosX - nW - nStartX; - nTmpWidth = aCurrentTab.nStartPosX + pTabPortion->GetSize().Width() + nWidthAfterTab; + TextPortion& rTabPortion = pParaPortion->GetTextPortions()[aCurrentTab.nTabPortion]; + rTabPortion.GetSize().Width() = aCurrentTab.nTabPos - aCurrentTab.nStartPosX - nW - nStartX; + nTmpWidth = aCurrentTab.nStartPosX + rTabPortion.GetSize().Width() + nWidthAfterTab; } nTmpPos = nTmpPos + pPortion->GetLen(); @@ -1173,9 +1173,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) DBG_ASSERT( pPortion->GetKind() == PortionKind::TEXT, "Len>1, but no TextPortion?" ); nTmpWidth -= pPortion->GetSize().Width(); sal_Int32 nP = SplitTextPortion( pParaPortion, nTmpPos, pLine ); - const TextPortion* p = pParaPortion->GetTextPortions()[nP]; - DBG_ASSERT( p, "Portion ?!" ); - nTmpWidth += p->GetSize().Width(); + nTmpWidth += pParaPortion->GetTextPortions()[nP].GetSize().Width(); } } else if ( nTmpWidth >= nXWidth ) @@ -1283,16 +1281,16 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) sal_Int32 nTPos = pLine->GetStart(); for ( sal_Int32 nP = pLine->GetStartPortion(); nP <= pLine->GetEndPortion(); nP++ ) { - const TextPortion* pTP = pParaPortion->GetTextPortions()[nP]; + const TextPortion& rTP = pParaPortion->GetTextPortions()[nP]; // problem with hard font height attribute, when everything but the line break has this attribute - if ( pTP->GetKind() != PortionKind::LINEBREAK ) + if ( rTP.GetKind() != PortionKind::LINEBREAK ) { SeekCursor( pNode, nTPos+1, aTmpFont ); aTmpFont.SetPhysFont( GetRefDevice() ); ImplInitDigitMode(GetRefDevice(), aTmpFont.GetLanguage()); RecalcFormatterFontMetrics( aFormatterMetrics, aTmpFont ); } - nTPos = nTPos + pTP->GetLen(); + nTPos = nTPos + rTP.GetLen(); } sal_uInt16 nLineHeight = aFormatterMetrics.GetHeight(); if ( nLineHeight > pLine->GetHeight() ) @@ -1379,11 +1377,11 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) // Width from HangingPunctuation was set to 0 in ImpBreakLine, // check for rel width now, maybe create compression... long n = nMaxLineWidth - aTextSize.Width(); - TextPortion* const pTP = pParaPortion->GetTextPortions()[pLine->GetEndPortion()]; + TextPortion& rTP = pParaPortion->GetTextPortions()[pLine->GetEndPortion()]; sal_Int32 nPosInArray = pLine->GetEnd()-1-pLine->GetStart(); long nNewValue = ( nPosInArray ? pLine->GetCharPosArray()[ nPosInArray-1 ] : 0 ) + n; pLine->GetCharPosArray()[ nPosInArray ] = nNewValue; - pTP->GetSize().Width() += n; + rTP.GetSize().Width() += n; } pLine->SetTextWidth( aTextSize.Width() ); @@ -1507,7 +1505,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) // Next line or maybe a new line.... pLine = 0; if ( nLine < pParaPortion->GetLines().Count()-1 ) - pLine = pParaPortion->GetLines()[++nLine]; + pLine = &pParaPortion->GetLines()[++nLine]; if ( pLine && ( nIndex >= pNode->Len() ) ) { nDelFromLine = nLine; @@ -1696,9 +1694,8 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn { // -2: The new one is already inserted. #ifdef DBG_UTIL - EditLine* pLastLine = pParaPortion->GetLines()[pParaPortion->GetLines().Count()-2]; - DBG_ASSERT( pLastLine, "soft wrap no line?!" ); - DBG_ASSERT( pLastLine->GetEnd() == pParaPortion->GetNode()->Len(), "different anyway?" ); + EditLine& rLastLine = pParaPortion->GetLines()[pParaPortion->GetLines().Count()-2]; + DBG_ASSERT( rLastLine.GetEnd() == pParaPortion->GetNode()->Len(), "different anyway?" ); #endif sal_Int32 nPos = pParaPortion->GetTextPortions().Count() - 1 ; pTmpLine->SetStartPortion( nPos ); @@ -1943,12 +1940,12 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te if ( bCompressBlank || bHangingPunctuation ) { - TextPortion* const pTP = pParaPortion->GetTextPortions()[nEndPortion]; - DBG_ASSERT( pTP->GetKind() == PortionKind::TEXT, "BlankRubber: No TextPortion!" ); + TextPortion& rTP = pParaPortion->GetTextPortions()[nEndPortion]; + DBG_ASSERT( rTP.GetKind() == PortionKind::TEXT, "BlankRubber: No TextPortion!" ); DBG_ASSERT( nBreakPos > pLine->GetStart(), "SplitTextPortion at the beginning of the line?" ); sal_Int32 nPosInArray = nBreakPos - 1 - pLine->GetStart(); - pTP->GetSize().Width() = ( nPosInArray && ( pTP->GetLen() > 1 ) ) ? pLine->GetCharPosArray()[ nPosInArray-1 ] : 0; - pLine->GetCharPosArray()[ nPosInArray ] = pTP->GetSize().Width(); + rTP.GetSize().Width() = ( nPosInArray && ( rTP.GetLen() > 1 ) ) ? pLine->GetCharPosArray()[ nPosInArray-1 ] : 0; + pLine->GetCharPosArray()[ nPosInArray ] = rTP.GetSize().Width(); } else if ( bHyphenated ) { @@ -1958,13 +1955,13 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te OUString aHyphText(CH_HYPH); if ( (cAlternateReplChar || cAlternateExtraChar) && bAltFullRight ) // alternation after the break doesn't supported { - TextPortion* pPrev = pParaPortion->GetTextPortions()[nEndPortion]; - DBG_ASSERT( pPrev && pPrev->GetLen(), "Hyphenate: Prev portion?!" ); - pPrev->SetLen( pPrev->GetLen() - nAltDelChar ); + TextPortion& rPrev = pParaPortion->GetTextPortions()[nEndPortion]; + DBG_ASSERT( rPrev.GetLen(), "Hyphenate: Prev portion?!" ); + rPrev.SetLen( rPrev.GetLen() - nAltDelChar ); pHyphPortion->SetLen( nAltDelChar ); if (cAlternateReplChar && !bAltFullLeft) pHyphPortion->SetExtraValue( cAlternateReplChar ); // Correct width of the portion above: - pPrev->GetSize().Width() = + rPrev.GetSize().Width() = pLine->GetCharPosArray()[ nBreakPos-1 - pLine->GetStart() - nAltDelChar ]; } @@ -2043,18 +2040,18 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, aPositions.pop_back(); sal_Int32 nPortionStart, nPortion; nPortion = pParaPortion->GetTextPortions().FindPortion( nLastChar+1, nPortionStart ); - TextPortion* pLastPortion = pParaPortion->GetTextPortions()[ nPortion ]; + TextPortion& rLastPortion = pParaPortion->GetTextPortions()[ nPortion ]; long nRealWidth = pLine->GetCharPosArray()[nLastChar-nFirstChar]; long nBlankWidth = nRealWidth; if ( nLastChar > nPortionStart ) nBlankWidth -= pLine->GetCharPosArray()[nLastChar-nFirstChar-1]; // Possibly the blank has already been deducted in ImpBreakLine: - if ( nRealWidth == pLastPortion->GetSize().Width() ) + if ( nRealWidth == rLastPortion.GetSize().Width() ) { // For the last character the portion must stop behind the blank // => Simplify correction: - DBG_ASSERT( ( nPortionStart + pLastPortion->GetLen() ) == ( nLastChar+1 ), "Blank actually not at the end of the portion!?"); - pLastPortion->GetSize().Width() -= nBlankWidth; + DBG_ASSERT( ( nPortionStart + rLastPortion.GetLen() ) == ( nLastChar+1 ), "Blank actually not at the end of the portion!?"); + rLastPortion.GetSize().Width() -= nBlankWidth; nRemainingSpace += nBlankWidth; } pLine->GetCharPosArray()[nLastChar-nFirstChar] -= nBlankWidth; @@ -2076,16 +2073,16 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, { sal_Int32 nPortionStart, nPortion; nPortion = pParaPortion->GetTextPortions().FindPortion( nChar, nPortionStart, true ); - TextPortion* pLastPortion = pParaPortion->GetTextPortions()[ nPortion ]; + TextPortion& rLastPortion = pParaPortion->GetTextPortions()[ nPortion ]; // The width of the portion: - pLastPortion->GetSize().Width() += nMore4Everyone; + rLastPortion.GetSize().Width() += nMore4Everyone; if ( nSomeExtraSpace ) - pLastPortion->GetSize().Width()++; + rLastPortion.GetSize().Width()++; // Correct positions in array // Even for kashidas just change positions, VCL will then draw the kashida automatically - sal_Int32 nPortionEnd = nPortionStart + pLastPortion->GetLen(); + sal_Int32 nPortionEnd = nPortionStart + rLastPortion.GetLen(); for ( sal_Int32 _n = nChar; _n < nPortionEnd; _n++ ) { pLine->GetCharPosArray()[_n-nFirstChar] += nMore4Everyone; @@ -2233,15 +2230,15 @@ sal_Int32 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_Int32 nPos sal_Int32 nPortions = pPortion->GetTextPortions().Count(); for ( nSplitPortion = 0; nSplitPortion < nPortions; nSplitPortion++ ) { - TextPortion* pTP = pPortion->GetTextPortions()[nSplitPortion]; - nTmpPos = nTmpPos + pTP->GetLen(); + TextPortion& rTP = pPortion->GetTextPortions()[nSplitPortion]; + nTmpPos = nTmpPos + rTP.GetLen(); if ( nTmpPos >= nPos ) { if ( nTmpPos == nPos ) // then nothing needs to be split { return nSplitPortion; } - pTextPortion = pTP; + pTextPortion = &rTP; break; } } @@ -2339,24 +2336,24 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_Int32& rS sal_Int32 nP; for ( nP = 0; nP < (sal_Int32)pParaPortion->GetTextPortions().Count(); nP++ ) { - const TextPortion* pTmpPortion = pParaPortion->GetTextPortions()[nP]; - nPortionStart = nPortionStart + pTmpPortion->GetLen(); + const TextPortion& rTmpPortion = pParaPortion->GetTextPortions()[nP]; + nPortionStart = nPortionStart + rTmpPortion.GetLen(); if ( nPortionStart >= nStartPos ) { - nPortionStart = nPortionStart - pTmpPortion->GetLen(); + nPortionStart = nPortionStart - rTmpPortion.GetLen(); rStart = nPortionStart; nInvPortion = nP; break; } } DBG_ASSERT( nP < pParaPortion->GetTextPortions().Count() || !pParaPortion->GetTextPortions().Count(), "Nothing to delete: CreateTextPortions" ); - if ( nInvPortion && ( nPortionStart+pParaPortion->GetTextPortions()[nInvPortion]->GetLen() > nStartPos ) ) + if ( nInvPortion && ( nPortionStart+pParaPortion->GetTextPortions()[nInvPortion].GetLen() > nStartPos ) ) { // prefer one in front ... // But only if it was in the middle of the portion of, otherwise it // might be the only one in the row in front! nInvPortion--; - nPortionStart = nPortionStart - pParaPortion->GetTextPortions()[nInvPortion]->GetLen(); + nPortionStart = nPortionStart - pParaPortion->GetTextPortions()[nInvPortion].GetLen(); } pParaPortion->GetTextPortions().DeleteFromPortion( nInvPortion ); @@ -2399,11 +2396,11 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta // A blank portion may be here, if the paragraph was empty, // or if a line was created by a hard line break. if ( ( nNewPortionPos < (sal_Int32)pParaPortion->GetTextPortions().Count() ) && - !pParaPortion->GetTextPortions()[nNewPortionPos]->GetLen() ) + !pParaPortion->GetTextPortions()[nNewPortionPos].GetLen() ) { - TextPortion* const pTP = pParaPortion->GetTextPortions()[nNewPortionPos]; - DBG_ASSERT( pTP->GetKind() == PortionKind::TEXT, "the empty portion was no TextPortion!" ); - pTP->SetLen( pTP->GetLen() + nNewChars ); + TextPortion& rTP = pParaPortion->GetTextPortions()[nNewPortionPos]; + DBG_ASSERT( rTP.GetKind() == PortionKind::TEXT, "the empty portion was no TextPortion!" ); + rTP.SetLen( rTP.GetLen() + nNewChars ); } else { @@ -2416,10 +2413,9 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta sal_Int32 nPortionStart; const sal_Int32 nTP = pParaPortion->GetTextPortions(). FindPortion( nStartPos, nPortionStart ); - TextPortion* const pTP = pParaPortion->GetTextPortions()[ nTP ]; - DBG_ASSERT( pTP, "RecalcTextPortion: Portion not found" ); - pTP->SetLen( pTP->GetLen() + nNewChars ); - pTP->GetSize().Width() = (-1); + TextPortion& rTP = pParaPortion->GetTextPortions()[ nTP ]; + rTP.SetLen( rTP.GetLen() + nNewChars ); + rTP.GetSize().Width() = (-1); } } else @@ -2438,7 +2434,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta TextPortion* pTP = 0; for ( nPortion = 0; nPortion < nPortions; nPortion++ ) { - pTP = pParaPortion->GetTextPortions()[ nPortion ]; + pTP = &pParaPortion->GetTextPortions()[ nPortion ]; if ( ( nPos+pTP->GetLen() ) > nStartPos ) { DBG_ASSERT( nPos <= nStartPos, "Wrong Start!" ); @@ -2455,8 +2451,8 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta pParaPortion->GetTextPortions().Remove( nPortion ); if ( nType == PortionKind::LINEBREAK ) { - TextPortion* pNext = pParaPortion->GetTextPortions()[ nPortion ]; - if ( pNext && !pNext->GetLen() ) + TextPortion& rNext = pParaPortion->GetTextPortions()[ nPortion ]; + if ( !rNext.GetLen() ) { // Remove dummy portion pParaPortion->GetTextPortions().Remove( nPortion ); @@ -2475,17 +2471,17 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta { // No HYPHENATOR portion is allowed to get stuck right at the end... sal_Int32 nLastPortion = nPortionCount - 1; - pTP = pParaPortion->GetTextPortions()[nLastPortion]; + pTP = &pParaPortion->GetTextPortions()[nLastPortion]; if ( pTP->GetKind() == PortionKind::HYPHENATOR ) { // Discard portion; if possible, correct the ones before, // if the Hyphenator portion has swallowed one character... if ( nLastPortion && pTP->GetLen() ) { - TextPortion* pPrev = pParaPortion->GetTextPortions()[nLastPortion - 1]; - DBG_ASSERT( pPrev->GetKind() == PortionKind::TEXT, "Portion?!" ); - pPrev->SetLen( pPrev->GetLen() + pTP->GetLen() ); - pPrev->GetSize().Width() = (-1); + TextPortion& rPrev = pParaPortion->GetTextPortions()[nLastPortion - 1]; + DBG_ASSERT( rPrev.GetKind() == PortionKind::TEXT, "Portion?!" ); + rPrev.SetLen( rPrev.GetLen() + pTP->GetLen() ); + rPrev.GetSize().Width() = (-1); } pParaPortion->GetTextPortions().Remove( nLastPortion ); } @@ -2926,7 +2922,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt for ( sal_Int32 nLine = 0; nLine < nLines; nLine++ ) { - pLine = pPortion->GetLines()[nLine]; + pLine = &pPortion->GetLines()[nLine]; nIndex = pLine->GetStart(); DBG_ASSERT( pLine, "NULL-Pointer in the line iterator in UpdateViews" ); aTmpPos = aStartPos; @@ -2975,8 +2971,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt for ( sal_Int32 nPortion = pLine->GetStartPortion(); nPortion <= pLine->GetEndPortion(); nPortion++ ) { DBG_ASSERT( pPortion->GetTextPortions().Count(), "Line without Textportion in Paint!" ); - const TextPortion* pTextPortion = pPortion->GetTextPortions()[nPortion]; - DBG_ASSERT( pTextPortion, "NULL-Pointer in Portion iterator in UpdateViews" ); + const TextPortion& rTextPortion = pPortion->GetTextPortions()[nPortion]; long nPortionXOffset = GetPortionXOffset( pPortion, pLine, nPortion ); if ( !IsVertical() ) @@ -2992,7 +2987,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt break; // No further output in line necessary } - switch ( pTextPortion->GetKind() ) + switch ( rTextPortion.GetKind() ) { case PortionKind::TEXT: case PortionKind::FIELD: @@ -3002,7 +2997,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt bool bDrawFrame = false; - if ( ( pTextPortion->GetKind() == PortionKind::FIELD ) && !aTmpFont.IsTransparent() && + if ( ( rTextPortion.GetKind() == PortionKind::FIELD ) && !aTmpFont.IsTransparent() && ( GetBackgroundColor() != COL_AUTO ) && GetBackgroundColor().IsDark() && ( IsAutoColorEnabled() && ( pOutDev->GetOutDevType() != OUTDEV_PRINTER ) ) ) { @@ -3013,12 +3008,12 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt } #if OSL_DEBUG_LEVEL > 2 - if ( pTextPortion->GetKind() == PORTIONKIND_HYPHENATOR ) + if ( rTextPortion.GetKind() == PORTIONKIND_HYPHENATOR ) { aTmpFont.SetFillColor( COL_LIGHTGRAY ); aTmpFont.SetTransparent( sal_False ); } - if ( pTextPortion->GetRightToLeft() ) + if ( rTextPortion.GetRightToLeft() ) { aTmpFont.SetFillColor( COL_LIGHTGRAY ); aTmpFont.SetTransparent( sal_False ); @@ -3043,11 +3038,11 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt const long* pDXArray = 0; std::unique_ptr<long[]> pTmpDXArray; - if ( pTextPortion->GetKind() == PortionKind::TEXT ) + if ( rTextPortion.GetKind() == PortionKind::TEXT ) { aText = pPortion->GetNode()->GetString(); nTextStart = nIndex; - nTextLen = pTextPortion->GetLen(); + nTextLen = rTextPortion.GetLen(); if (!pLine->GetCharPosArray().empty()) pDXArray = &pLine->GetCharPosArray()[0]+( nIndex-pLine->GetStart() ); @@ -3055,7 +3050,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt if ( aStatus.MarkFields() ) { sal_Int32 nTmpIdx; - const sal_Int32 nTmpEnd = nTextStart + pTextPortion->GetLen(); + const sal_Int32 nTmpEnd = nTextStart + rTextPortion.GetLen(); for ( nTmpIdx = nTextStart; nTmpIdx <= nTmpEnd ; ++nTmpIdx ) { @@ -3069,7 +3064,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt long nHalfBlankWidth = aTmpFont.QuickGetTextSize( pOutDev, aBlank, 0, 1, 0 ).Width() / 2; const long nAdvanceX = ( nTmpIdx == nTmpEnd ? - pTextPortion->GetSize().Width() : + rTextPortion.GetSize().Width() : pDXArray[ nTmpIdx - nTextStart ] ) - nHalfBlankWidth; const long nAdvanceY = -pLine->GetMaxAscent(); @@ -3140,7 +3135,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt } } } - else if ( pTextPortion->GetKind() == PortionKind::FIELD ) + else if ( rTextPortion.GetKind() == PortionKind::FIELD ) { const EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex); DBG_ASSERT( pAttr, "Field not found"); @@ -3148,7 +3143,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt aText = static_cast<const EditCharAttribField*>(pAttr)->GetFieldValue(); nTextStart = 0; nTextLen = aText.getLength(); - ExtraPortionInfo *pExtraInfo = pTextPortion->GetExtraInfos(); + ExtraPortionInfo *pExtraInfo = rTextPortion.GetExtraInfos(); // Do not split the Fields into different lines while editing if( bStripOnly && !bParsingFields && pExtraInfo && pExtraInfo->lineBreaksList.size() ) { @@ -3206,10 +3201,10 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt } } - else if ( pTextPortion->GetKind() == PortionKind::HYPHENATOR ) + else if ( rTextPortion.GetKind() == PortionKind::HYPHENATOR ) { - if ( pTextPortion->GetExtraValue() ) - aText = OUString(pTextPortion->GetExtraValue()); + if ( rTextPortion.GetExtraValue() ) + aText = OUString(rTextPortion.GetExtraValue()); aText += OUStringLiteral1<CH_HYPH>(); nTextStart = 0; nTextLen = aText.getLength(); @@ -3224,20 +3219,20 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt GetRefDevice()->SetFont( _aOldFont ); } - long nTxtWidth = pTextPortion->GetSize().Width(); + long nTxtWidth = rTextPortion.GetSize().Width(); Point aOutPos( aTmpPos ); aRedLineTmpPos = aTmpPos; // In RTL portions spell markup pos should be at the start of the // first chara as well. That is on the right end of the portion - if (pTextPortion->IsRightToLeft()) - aRedLineTmpPos.X() += pTextPortion->GetSize().Width(); + if (rTextPortion.IsRightToLeft()) + aRedLineTmpPos.X() += rTextPortion.GetSize().Width(); if ( bStripOnly ) { EEngineData::WrongSpellVector aWrongSpellVector; - if(GetStatus().DoOnlineSpelling() && pTextPortion->GetLen()) + if(GetStatus().DoOnlineSpelling() && rTextPortion.GetLen()) { WrongList* pWrongs = pPortion->GetNode()->GetWrongList(); @@ -3245,7 +3240,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt { size_t nStart = nIndex, nEnd = 0; bool bWrong = pWrongs->NextWrong(nStart, nEnd); - const size_t nMaxEnd(nIndex + pTextPortion->GetLen()); + const size_t nMaxEnd(nIndex + rTextPortion.GetLen()); while(bWrong) { @@ -3284,7 +3279,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt const SvxFieldData* pFieldData = 0; - if(PortionKind::FIELD == pTextPortion->GetKind()) + if(PortionKind::FIELD == rTextPortion.GetKind()) { const EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex); const SvxFieldItem* pFieldItem = dynamic_cast<const SvxFieldItem*>(pAttr->GetItem()); @@ -3318,7 +3313,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt // StripPortions() data callback GetEditEnginePtr()->DrawingText( aOutPos, aText, nTextStart, nTextLen, pDXArray, - aTmpFont, n, nIndex, pTextPortion->GetRightToLeft(), + aTmpFont, n, nIndex, rTextPortion.GetRightToLeft(), aWrongSpellVector.size() ? &aWrongSpellVector : 0, pFieldData, bEndOfLine, bEndOfParagraph, false, // support for EOL/EOP TEXT comments @@ -3408,16 +3403,16 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt } } Point aRealOutPos( aOutPos ); - if ( ( pTextPortion->GetKind() == PortionKind::TEXT ) - && pTextPortion->GetExtraInfos() && pTextPortion->GetExtraInfos()->bCompressed - && pTextPortion->GetExtraInfos()->bFirstCharIsRightPunktuation ) + if ( ( rTextPortion.GetKind() == PortionKind::TEXT ) + && rTextPortion.GetExtraInfos() && rTextPortion.GetExtraInfos()->bCompressed + && rTextPortion.GetExtraInfos()->bFirstCharIsRightPunktuation ) { - aRealOutPos.X() += pTextPortion->GetExtraInfos()->nPortionOffsetX; + aRealOutPos.X() += rTextPortion.GetExtraInfos()->nPortionOffsetX; } // RTL portions with (#i37132#) // compressed blank should not paint this blank: - if ( pTextPortion->IsRightToLeft() && nTextLen >= 2 && + if ( rTextPortion.IsRightToLeft() && nTextLen >= 2 && pDXArray[ nTextLen - 1 ] == pDXArray[ nTextLen - 2 ] && ' ' == aText[nTextStart + nTextLen - 1] ) @@ -3432,14 +3427,14 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt aTopLeft.Y() -= pLine->GetMaxAscent(); if ( nOrientation ) aTopLeft = lcl_ImplCalcRotatedPos( aTopLeft, aOrigin, nSin, nCos ); - Rectangle aRect( aTopLeft, pTextPortion->GetSize() ); + Rectangle aRect( aTopLeft, rTextPortion.GetSize() ); pOutDev->DrawRect( aRect ); } // PDF export: if ( pPDFExtOutDevData ) { - if ( pTextPortion->GetKind() == PortionKind::FIELD ) + if ( rTextPortion.GetKind() == PortionKind::FIELD ) { const EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex); const SvxFieldItem* pFieldItem = dynamic_cast<const SvxFieldItem*>(pAttr->GetItem()); @@ -3451,7 +3446,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt Point aTopLeft( aTmpPos ); aTopLeft.Y() -= pLine->GetMaxAscent(); - Rectangle aRect( aTopLeft, pTextPortion->GetSize() ); + Rectangle aRect( aTopLeft, rTextPortion.GetSize() ); vcl::PDFExtOutDevBookmarkEntry aBookmark; aBookmark.nLinkId = pPDFExtOutDevData->CreateLink( aRect ); aBookmark.aBookmark = static_cast<const SvxURLField*>(pFieldData)->GetURL(); @@ -3464,7 +3459,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt } const WrongList* const pWrongList = pPortion->GetNode()->GetWrongList(); - if ( GetStatus().DoOnlineSpelling() && pWrongList && !pWrongList->empty() && pTextPortion->GetLen() ) + if ( GetStatus().DoOnlineSpelling() && pWrongList && !pWrongList->empty() && rTextPortion.GetLen() ) { {//#105750# adjust LinePos for superscript or subscript text short _nEsc = aTmpFont.GetEscapement(); @@ -3479,7 +3474,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt } Color aOldColor( pOutDev->GetLineColor() ); pOutDev->SetLineColor( Color( GetColorConfig().GetColorValue( svtools::SPELL ).nColor ) ); - lcl_DrawRedLines( pOutDev, aTmpFont.GetSize().Height(), aRedLineTmpPos, (size_t)nIndex, (size_t)nIndex + pTextPortion->GetLen(), pDXArray, pPortion->GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical(), pTextPortion->IsRightToLeft() ); + lcl_DrawRedLines( pOutDev, aTmpFont.GetSize().Height(), aRedLineTmpPos, (size_t)nIndex, (size_t)nIndex + rTextPortion.GetLen(), pDXArray, pPortion->GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical(), rTextPortion.IsRightToLeft() ); pOutDev->SetLineColor( aOldColor ); } } @@ -3488,7 +3483,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt pTmpDXArray.reset(); - if ( pTextPortion->GetKind() == PortionKind::FIELD ) + if ( rTextPortion.GetKind() == PortionKind::FIELD ) { const EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex); DBG_ASSERT( pAttr, "Field not found" ); @@ -3513,27 +3508,27 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt break; case PortionKind::TAB: { - if ( pTextPortion->GetExtraValue() && ( pTextPortion->GetExtraValue() != ' ' ) ) + if ( rTextPortion.GetExtraValue() && ( rTextPortion.GetExtraValue() != ' ' ) ) { SeekCursor( pPortion->GetNode(), nIndex+1, aTmpFont, pOutDev ); aTmpFont.SetTransparent( false ); aTmpFont.SetEscapement( 0 ); aTmpFont.SetPhysFont( pOutDev ); long nCharWidth = aTmpFont.QuickGetTextSize( pOutDev, - OUString(pTextPortion->GetExtraValue()), 0, 1, NULL ).Width(); + OUString(rTextPortion.GetExtraValue()), 0, 1, NULL ).Width(); sal_Int32 nChars = 2; if( nCharWidth ) - nChars = pTextPortion->GetSize().Width() / nCharWidth; + nChars = rTextPortion.GetSize().Width() / nCharWidth; if ( nChars < 2 ) nChars = 2; // is compressed by DrawStretchText. else if ( nChars == 2 ) nChars = 3; // looks better OUStringBuffer aBuf; - comphelper::string::padToLength(aBuf, nChars, pTextPortion->GetExtraValue()); + comphelper::string::padToLength(aBuf, nChars, rTextPortion.GetExtraValue()); OUString aText(aBuf.makeStringAndClear()); aTmpFont.QuickDrawText( pOutDev, aTmpPos, aText, 0, aText.getLength(), NULL ); - pOutDev->DrawStretchText( aTmpPos, pTextPortion->GetSize().Width(), aText ); + pOutDev->DrawStretchText( aTmpPos, rTextPortion.GetSize().Width(), aText ); if ( bStripOnly ) { @@ -3546,9 +3541,9 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt // StripPortions() data callback GetEditEnginePtr()->DrawingTab( aTmpPos, - pTextPortion->GetSize().Width(), - OUString(pTextPortion->GetExtraValue()), - aTmpFont, n, nIndex, pTextPortion->GetRightToLeft(), + rTextPortion.GetSize().Width(), + OUString(rTextPortion.GetExtraValue()), + aTmpFont, n, nIndex, rTextPortion.GetRightToLeft(), bEndOfLine, bEndOfParagraph, aOverlineColor, aTextLineColor); } @@ -3581,7 +3576,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt if( bParsingFields ) nPortion--; else - nIndex = nIndex + pTextPortion->GetLen(); + nIndex = nIndex + rTextPortion.GetLen(); } } @@ -4101,8 +4096,8 @@ long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const nTotalLineCount += nLineCount; for (sal_Int32 j = 0; j < nLineCount; ++j) { - const EditLine* pLine = rLines[j]; - nTotalOccupiedHeight += pLine->GetHeight(); + const EditLine& rLine = rLines[j]; + nTotalOccupiedHeight += rLine.GetHeight(); if (j < nLineCount-1) nTotalOccupiedHeight += nSBL; nTotalOccupiedHeight += nUL; @@ -4526,7 +4521,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* std::vector<TextPortion*> aCompressedPortions; sal_Int32 nPortion = pLine->GetEndPortion(); - TextPortion* pTP = pParaPortion->GetTextPortions()[ nPortion ]; + TextPortion* pTP = &pParaPortion->GetTextPortions()[ nPortion ]; while ( pTP && ( pTP->GetKind() == PortionKind::TEXT ) ) { if ( pTP->GetExtraInfos() && pTP->GetExtraInfos()->bCompressed ) @@ -4535,7 +4530,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* nCompressed += pTP->GetExtraInfos()->nOrgWidth - pTP->GetSize().Width(); aCompressedPortions.push_back(pTP); } - pTP = ( nPortion > pLine->GetStartPortion() ) ? pParaPortion->GetTextPortions()[ --nPortion ] : NULL; + pTP = ( nPortion > pLine->GetStartPortion() ) ? &pParaPortion->GetTextPortions()[ --nPortion ] : NULL; } if ( bFoundCompressedPortion ) diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index f1075792e052..1fbb791f5b14 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -626,10 +626,10 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) // start at 0, so the index is right ... for ( sal_Int32 n = 0; n <= nEndPortion; n++ ) { - const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[n]; + const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[n]; if ( n < nStartPortion ) { - nIndex = nIndex + pTextPortion->GetLen(); + nIndex = nIndex + rTextPortion.GetLen(); continue; } @@ -660,7 +660,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) rOutput.WriteChar( ' ' ); sal_Int32 nS = nIndex; - sal_Int32 nE = nIndex + pTextPortion->GetLen(); + sal_Int32 nE = nIndex + rTextPortion.GetLen(); if ( n == nStartPortion ) nS = nStartPos; if ( n == nEndPortion ) @@ -676,7 +676,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) bFinishPortion = false; } - nIndex = nIndex + pTextPortion->GetLen(); + nIndex = nIndex + rTextPortion.GetLen(); } rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_PAR ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_PARD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_PLAIN ); @@ -1133,8 +1133,8 @@ EditTextObject* ImpEditEngine::CreateTextObject( EditSelection aSel, SfxItemPool sal_uInt16 n; for ( n = 0; n < nCount; n++ ) { - const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[n]; - TextPortion* pNew = new TextPortion( *pTextPortion ); + const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[n]; + TextPortion* pNew = new TextPortion( rTextPortion ); pX->aTextPortions.Append(pNew); } @@ -1142,17 +1142,17 @@ EditTextObject* ImpEditEngine::CreateTextObject( EditSelection aSel, SfxItemPool nCount = pParaPortion->GetLines().Count(); for ( n = 0; n < nCount; n++ ) { - const EditLine* pLine = pParaPortion->GetLines()[n]; - EditLine* pNew = pLine->Clone(); + const EditLine& rLine = pParaPortion->GetLines()[n]; + EditLine* pNew = rLine.Clone(); pX->aLines.Append(pNew); } #ifdef DBG_UTIL sal_uInt16 nTest; int nTPLen = 0, nTxtLen = 0; for ( nTest = pParaPortion->GetTextPortions().Count(); nTest; ) - nTPLen += pParaPortion->GetTextPortions()[--nTest]->GetLen(); + nTPLen += pParaPortion->GetTextPortions()[--nTest].GetLen(); for ( nTest = pParaPortion->GetLines().Count(); nTest; ) - nTxtLen += pParaPortion->GetLines()[--nTest]->GetLen(); + nTxtLen += pParaPortion->GetLines()[--nTest].GetLen(); DBG_ASSERT( ( nTPLen == pParaPortion->GetNode()->Len() ) && ( nTxtLen == pParaPortion->GetNode()->Len() ), "CreateBinTextObject: ParaPortion not completely formatted!" ); #endif } @@ -1332,8 +1332,8 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject sal_uInt16 nCount = rXP.aTextPortions.Count(); for ( sal_uInt16 _n = 0; _n < nCount; _n++ ) { - const TextPortion* pTextPortion = rXP.aTextPortions[_n]; - TextPortion* pNew = new TextPortion( *pTextPortion ); + const TextPortion& rTextPortion = rXP.aTextPortions[_n]; + TextPortion* pNew = new TextPortion( rTextPortion ); pParaPortion->GetTextPortions().Insert(_n, pNew); } @@ -1342,8 +1342,8 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject nCount = rXP.aLines.Count(); for ( sal_uInt16 m = 0; m < nCount; m++ ) { - const EditLine* pLine = rXP.aLines[m]; - EditLine* pNew = pLine->Clone(); + const EditLine& rLine = rXP.aLines[m]; + EditLine* pNew = rLine.Clone(); pNew->SetInvalid(); // Paint again! pParaPortion->GetLines().Insert(m, pNew); } @@ -1351,9 +1351,9 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject sal_uInt16 nTest; int nTPLen = 0, nTxtLen = 0; for ( nTest = pParaPortion->GetTextPortions().Count(); nTest; ) - nTPLen += pParaPortion->GetTextPortions()[--nTest]->GetLen(); + nTPLen += pParaPortion->GetTextPortions()[--nTest].GetLen(); for ( nTest = pParaPortion->GetLines().Count(); nTest; ) - nTxtLen += pParaPortion->GetLines()[--nTest]->GetLen(); + nTxtLen += pParaPortion->GetLines()[--nTest].GetLen(); DBG_ASSERT( ( nTPLen == pParaPortion->GetNode()->Len() ) && ( nTxtLen == pParaPortion->GetNode()->Len() ), "InsertBinTextObject: ParaPortion not completely formatted!" ); #endif } diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx index 4a7effb53a1c..050f44ca8586 100644 --- a/idl/inc/database.hxx +++ b/idl/inc/database.hxx @@ -113,7 +113,7 @@ public: const OString& rErrorText, sal_uLong nRow = 0, sal_uLong nColumn = 0 ); void WriteError( SvTokenStream & rInStm ); - void SetError( const OString& rError, SvToken * pTok ); + void SetError( const OString& rError, SvToken& rTok ); void Push( SvMetaObject * pObj ); bool Pop( bool bOk, SvTokenStream & rInStm, sal_uInt32 nTokPos ) { diff --git a/idl/inc/lex.hxx b/idl/inc/lex.hxx index a11bd6183ea9..5f5b18908814 100644 --- a/idl/inc/lex.hxx +++ b/idl/inc/lex.hxx @@ -212,7 +212,7 @@ public: return GetToken_NextAll(); } - SvToken* GetToken() const { return &(*pCurToken); } + SvToken& GetToken() const { return *pCurToken; } bool Read( char cChar ) { diff --git a/idl/source/objects/bastype.cxx b/idl/source/objects/bastype.cxx index 5b1548526e19..ca84295c8eab 100644 --- a/idl/source/objects/bastype.cxx +++ b/idl/source/objects/bastype.cxx @@ -129,7 +129,7 @@ bool SvBOOL::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) bool bBraket = rInStm.Read( '(' ); if( bBraket || rInStm.Read( '=' ) ) { - pTok = rInStm.GetToken(); + pTok = &rInStm.GetToken(); if( pTok->IsBool() ) { *this = pTok->GetBool(); @@ -159,7 +159,7 @@ bool SvIdentifier::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm bool bBraket = rInStm.Read( '(' ); if( bBraket || rInStm.Read( '=' ) ) { - pTok = rInStm.GetToken(); + pTok = &rInStm.GetToken(); if( pTok->IsIdentifier() ) { setString(pTok->GetString()); @@ -236,7 +236,7 @@ bool SvString::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) bool bBraket = rInStm.Read( '(' ); if( bBraket || rInStm.Read( '=' ) ) { - pTok = rInStm.GetToken(); + pTok = &rInStm.GetToken(); if( pTok->IsString() ) { setString(pTok->GetString()); @@ -281,7 +281,7 @@ bool SvUUId::ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) bool bBraket = rInStm.Read( '(' ); if( bBraket || rInStm.Read( '=' ) ) { - pTok = rInStm.GetToken(); + pTok = &rInStm.GetToken(); if( pTok->IsString() ) { pTok = rInStm.GetToken_Next(); diff --git a/idl/source/objects/module.cxx b/idl/source/objects/module.cxx index 7246ca25a858..6bd316c73cc5 100644 --- a/idl/source/objects/module.cxx +++ b/idl/source/objects/module.cxx @@ -85,8 +85,8 @@ void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) { sal_uInt32 nTokPos = rInStm.Tell(); - if( rInStm.GetToken()->Is( SvHash_interface() ) - || rInStm.GetToken()->Is( SvHash_shell() ) ) + if( rInStm.GetToken().Is( SvHash_interface() ) + || rInStm.GetToken().Is( SvHash_shell() ) ) { SvMetaClassRef aClass = new SvMetaClass(); if( aClass->ReadSvIdl( rBase, rInStm ) ) @@ -96,7 +96,7 @@ void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, rBase.GetClassList().push_back( aClass ); } } - else if( rInStm.GetToken()->Is( SvHash_enum() ) ) + else if( rInStm.GetToken().Is( SvHash_enum() ) ) { SvMetaTypeEnumRef aEnum = new SvMetaTypeEnum(); @@ -108,9 +108,9 @@ void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, rBase.GetTypeList().push_back( aEnum ); } } - else if( rInStm.GetToken()->Is( SvHash_item() ) - || rInStm.GetToken()->Is( SvHash_struct() ) - || rInStm.GetToken()->Is( SvHash_typedef() ) ) + else if( rInStm.GetToken().Is( SvHash_item() ) + || rInStm.GetToken().Is( SvHash_struct() ) + || rInStm.GetToken().Is( SvHash_typedef() ) ) { SvMetaTypeRef xItem = new SvMetaType(); @@ -122,7 +122,7 @@ void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, rBase.GetTypeList().push_back( xItem ); } } - else if( rInStm.GetToken()->Is( SvHash_include() ) ) + else if( rInStm.GetToken().Is( SvHash_include() ) ) { bool bOk = false; rInStm.GetToken_Next(); @@ -153,7 +153,7 @@ void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, ReadContextSvIdl( rBase, aTokStm ); aTokStm.ReadDelemiter(); } - bOk = aTokStm.GetToken()->IsEof(); + bOk = aTokStm.GetToken().IsEof(); if( !bOk ) { rBase.WriteError( aTokStm ); @@ -165,14 +165,14 @@ void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, { OStringBuffer aStr("cannot open file: "); aStr.append(OUStringToOString(aFullName, RTL_TEXTENCODING_UTF8)); - rBase.SetError(aStr.makeStringAndClear(), pTok); + rBase.SetError(aStr.makeStringAndClear(), *pTok); } } else { OStringBuffer aStr("cannot find file:"); aStr.append(OUStringToOString(aFullName, RTL_TEXTENCODING_UTF8)); - rBase.SetError(aStr.makeStringAndClear(), pTok); + rBase.SetError(aStr.makeStringAndClear(), *pTok); } } if( !bOk ) diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index 635f9019f288..fe9117da1979 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -72,8 +72,7 @@ void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase, if( xAutomationInterface.Is() ) { // set error - rBase.SetError( "Automation already set", - rInStm.GetToken() ); + rBase.SetError( "Automation already set", rInStm.GetToken() ); rBase.WriteError( rInStm ); } xAutomationInterface = pClass; @@ -89,12 +88,11 @@ void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase, else { // set error - rBase.SetError( "only attribute Automation allowed", - rInStm.GetToken() ); + rBase.SetError( "only attribute Automation allowed", rInStm.GetToken() ); rBase.WriteError( rInStm ); } } - pTok = rInStm.GetToken(); + pTok = &rInStm.GetToken(); if( pTok->IsString() ) { xEle->SetPrefix( pTok->GetString() ); @@ -159,8 +157,7 @@ bool SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) if( !bOk ) { // set error - rBase.SetError( "unknown super class", - rInStm.GetToken() ); + rBase.SetError( "unknown super class", rInStm.GetToken() ); rBase.WriteError( rInStm ); } } diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index affaf4a04b32..8b1a2e1533d3 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -291,15 +291,15 @@ void SvMetaSlot::ReadAttributesSvIdl( SvIdlDataBase & rBase, { SvIdlDataBase::WriteError( "warning", OUStringToOString(rInStm.GetFileName(), RTL_TEXTENCODING_UTF8), "<Get> old style, use Readonly", - rInStm.GetToken()->GetLine(), - rInStm.GetToken()->GetColumn() ); + rInStm.GetToken().GetLine(), + rInStm.GetToken().GetColumn() ); } if( aSet.ReadSvIdl( SvHash_Set(), rInStm ) ) { SvIdlDataBase::WriteError( "warning", OUStringToOString(rInStm.GetFileName(), RTL_TEXTENCODING_UTF8), "<Set> old style, use method declaration", - rInStm.GetToken()->GetLine(), - rInStm.GetToken()->GetColumn() ); + rInStm.GetToken().GetLine(), + rInStm.GetToken().GetColumn() ); } if( aCachable.ReadSvIdl( SvHash_Cachable(), rInStm ) ) @@ -379,8 +379,8 @@ void SvMetaSlot::ReadAttributesSvIdl( SvIdlDataBase & rBase, } if( !aMethod.Is() ) { - SvToken * pTok = rInStm.GetToken(); - if( pTok->IsIdentifier() ) + SvToken& rTok = rInStm.GetToken(); + if( rTok.IsIdentifier() ) { aMethod = new SvMetaSlot(); sal_uInt32 nTokPos = rInStm.Tell(); diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx index f7821911b6a0..95a04f0e50e9 100644 --- a/idl/source/objects/types.cxx +++ b/idl/source/objects/types.cxx @@ -151,8 +151,8 @@ bool SvMetaAttribute::ReadSvIdl( SvIdlDataBase & rBase, aSlotId.ReadSvIdl( rBase, rInStm ); bOk = true; - SvToken * pTok = rInStm.GetToken(); - if( bOk && pTok->IsChar() && pTok->GetChar() == '(' ) + SvToken& rTok = rInStm.GetToken(); + if( bOk && rTok.IsChar() && rTok.GetChar() == '(' ) { SvMetaTypeRef xT = new SvMetaType(); xT->SetRef( GetType() ); @@ -164,11 +164,11 @@ bool SvMetaAttribute::ReadSvIdl( SvIdlDataBase & rBase, } else { - SvToken *pTok = rInStm.GetToken(); + SvToken& rTok = rInStm.GetToken(); rBase.SetError( "unknown type of token. Each new SID needs an " "item statement in an SDI file, eg. " - "SfxVoidItem FooItem " + pTok->GetTokenAsString() + - " ... which describes the slot more fully", pTok ); + "SfxVoidItem FooItem " + rTok.GetTokenAsString() + + " ... which describes the slot more fully", rTok ); } if( !bOk ) diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index 8cdf10d34213..865332f7b0d8 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -81,15 +81,15 @@ SvMetaModule * SvIdlDataBase::GetModule( const OString& rName ) return NULL; } -void SvIdlDataBase::SetError( const OString& rError, SvToken * pTok ) +void SvIdlDataBase::SetError( const OString& rError, SvToken& rTok ) { - if( pTok->GetLine() > 10000 ) + if( rTok.GetLine() > 10000 ) aError.SetText( "line count overflow" ); - if( aError.nLine < pTok->GetLine() - || (aError.nLine == pTok->GetLine() && aError.nColumn < pTok->GetColumn()) ) + if( aError.nLine < rTok.GetLine() + || (aError.nLine == rTok.GetLine() && aError.nColumn < rTok.GetColumn()) ) { - aError = SvIdlError( pTok->GetLine(), pTok->GetColumn() ); + aError = SvIdlError( rTok.GetLine(), rTok.GetColumn() ); aError.SetText( rError ); } } @@ -159,7 +159,7 @@ bool SvIdlDataBase::ReadIdFile( const OUString & rFileName ) { OString aStr("unexpected token after define"); // set error - SetError( aStr, pTok ); + SetError( aStr, *pTok ); WriteError( aTokStm ); return false; } @@ -191,7 +191,7 @@ bool SvIdlDataBase::ReadIdFile( const OUString & rFileName ) aStr.append(pTok->GetChar()); aStr.append("'in define"); // set error - SetError( aStr.makeStringAndClear(), pTok ); + SetError( aStr.makeStringAndClear(), *pTok ); WriteError( aTokStm ); return false; } @@ -214,7 +214,7 @@ bool SvIdlDataBase::ReadIdFile( const OUString & rFileName ) if( !InsertId( aDefName, nVal ) ) { OString aStr("hash table overflow: "); - SetError( aStr, pTok ); + SetError( aStr, *pTok ); WriteError( aTokStm ); return false; } @@ -239,7 +239,7 @@ bool SvIdlDataBase::ReadIdFile( const OUString & rFileName ) { OString aStr("unexpected eof in #include"); // set error - SetError(aStr, pTok); + SetError(aStr, *pTok); WriteError( aTokStm ); return false; } @@ -249,7 +249,7 @@ bool SvIdlDataBase::ReadIdFile( const OUString & rFileName ) { OStringBuffer aStr("cannot read file: "); aStr.append(aName.makeStringAndClear()); - SetError(aStr.makeStringAndClear(), pTok); + SetError(aStr.makeStringAndClear(), *pTok); WriteError( aTokStm ); return false; } @@ -337,7 +337,7 @@ SvMetaType * SvIdlDataBase::ReadKnownType( SvTokenStream & rInStm ) } if( pType ) { - pTok = rInStm.GetToken(); + pTok = &rInStm.GetToken(); if( pTok->IsChar() ) { if( pTok->GetChar() == '&' || pTok->GetChar() == '*' ) @@ -345,7 +345,7 @@ SvMetaType * SvIdlDataBase::ReadKnownType( SvTokenStream & rInStm ) nCall0 = (pTok->GetChar() == '&') ? CALL_REFERENCE : CALL_POINTER; rInStm.GetToken_Next(); - pTok = rInStm.GetToken(); + pTok = &rInStm.GetToken(); if( pTok->GetChar() == '&' || pTok->GetChar() == '*' ) { nCall1 = (pTok->GetChar() == '&') ? CALL_REFERENCE : @@ -480,7 +480,7 @@ void SvIdlDataBase::WriteError( SvTokenStream & rInStm ) sal_uLong nRow = 0, nColumn = 0; rInStm.SeekEnd(); - SvToken *pTok = rInStm.GetToken(); + SvToken *pTok = &rInStm.GetToken(); // error position nRow = pTok->GetLine(); @@ -527,7 +527,7 @@ void SvIdlDataBase::WriteError( SvTokenStream & rInStm ) if( !pTok->IsIdentifier() ) { rInStm.GetToken_PrevAll(); - pTok = rInStm.GetToken(); + pTok = &rInStm.GetToken(); } if( pTok && pTok->IsIdentifier() ) { @@ -545,7 +545,7 @@ bool SvIdlWorkingBase::ReadSvIdl( SvTokenStream & rInStm, bool bImported, const { aPath = rPath; // only valid for this iteration bool bOk = true; - SvToken * pTok = rInStm.GetToken(); + SvToken * pTok = &rInStm.GetToken(); // only one import at the very beginning if( pTok->Is( SvHash_import() ) ) { @@ -578,7 +578,7 @@ bool SvIdlWorkingBase::ReadSvIdl( SvTokenStream & rInStm, bool bImported, const while( bOk && nBeginPos != rInStm.Tell() ) { nBeginPos = rInStm.Tell(); - pTok = rInStm.GetToken(); + pTok = &rInStm.GetToken(); if( pTok->IsEof() ) return true; if( pTok->IsEmpty() ) diff --git a/include/svtools/treelistentry.hxx b/include/svtools/treelistentry.hxx index 6ffd1d45fa34..530dab1b8deb 100644 --- a/include/svtools/treelistentry.hxx +++ b/include/svtools/treelistentry.hxx @@ -93,8 +93,8 @@ public: // FOR THE ITEM! void AddItem( SvLBoxItem* pItem ); void ReplaceItem( SvLBoxItem* pNewItem, size_t nPos ); - const SvLBoxItem* GetItem( size_t nPos ) const; - SvLBoxItem* GetItem( size_t nPos ); + const SvLBoxItem& GetItem( size_t nPos ) const; + SvLBoxItem& GetItem( size_t nPos ); const SvLBoxItem* GetFirstItem( sal_uInt16 nId ) const; SvLBoxItem* GetFirstItem( sal_uInt16 nId ); size_t GetPos( const SvLBoxItem* pItem ) const; diff --git a/include/svtools/viewdataentry.hxx b/include/svtools/viewdataentry.hxx index 8d39022b16ad..18c4fe16d1b4 100644 --- a/include/svtools/viewdataentry.hxx +++ b/include/svtools/viewdataentry.hxx @@ -73,8 +73,8 @@ public: void Init(size_t nSize); - const SvViewDataItem* GetItem(size_t nPos) const; - SvViewDataItem* GetItem(size_t nPos); + const SvViewDataItem& GetItem(size_t nPos) const; + SvViewDataItem& GetItem(size_t nPos); void SetPaintRectangle(Rectangle aRectangle); Rectangle GetPaintRectangle() const; diff --git a/oox/inc/drawingml/chart/converterbase.hxx b/oox/inc/drawingml/chart/converterbase.hxx index bf3f7b5a303e..52a7072e2ad1 100644 --- a/oox/inc/drawingml/chart/converterbase.hxx +++ b/oox/inc/drawingml/chart/converterbase.hxx @@ -76,7 +76,7 @@ protected: /** Returns the filter object of the imported/exported document. */ ::oox::core::XmlFilterBase& getFilter() const; /** Returns the chart converter. */ - ChartConverter* getChartConverter() const; + ChartConverter& getChartConverter() const; /** Returns the API chart document model. */ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > getChartDocument() const; diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index b841954513db..758ad647751d 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -67,12 +67,9 @@ ChartSpaceConverter::~ChartSpaceConverter() void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExternalPage, const awt::Point& rChartPos ) { - if( !getChartConverter() ) - return; - /* create data provider (virtual function in the ChartConverter class, derived converters may create an external data provider) */ - getChartConverter()->createDataProvider( getChartDocument() ); + getChartConverter().createDataProvider( getChartDocument() ); // formatting of the chart background. The default fill style varies with applications. PropertySet aBackPropSet( getChartDocument()->getPageBackground() ); diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx index 022d8675499d..73fd81865665 100644 --- a/oox/source/drawingml/chart/converterbase.cxx +++ b/oox/source/drawingml/chart/converterbase.cxx @@ -239,9 +239,9 @@ XmlFilterBase& ConverterRoot::getFilter() const return mxData->mrFilter; } -ChartConverter* ConverterRoot::getChartConverter() const +ChartConverter& ConverterRoot::getChartConverter() const { - return &mxData->mrConverter; + return mxData->mrConverter; } Reference< XChartDocument > ConverterRoot::getChartDocument() const diff --git a/oox/source/drawingml/chart/datasourceconverter.cxx b/oox/source/drawingml/chart/datasourceconverter.cxx index 8b1725f4dea5..2c3dbcf7b1fb 100644 --- a/oox/source/drawingml/chart/datasourceconverter.cxx +++ b/oox/source/drawingml/chart/datasourceconverter.cxx @@ -44,42 +44,39 @@ Reference< XDataSequence > DataSequenceConverter::createDataSequence( const OUSt { // create data sequence from data source model (virtual call at chart converter) Reference< XDataSequence > xDataSeq; - if( getChartConverter() ) + // the internal data table does not support complex labels + // this is only supported in Calc!!! + // merge the labels into a single one + if(rRole == "label") { - // the internal data table does not support complex labels - // this is only supported in Calc!!! - // merge the labels into a single one - if(rRole == "label") + mrModel.mnPointCount = std::min<sal_Int32>(mrModel.mnPointCount, 1); + OUStringBuffer aTitle; + bool bFirst = true; + for(DataSequenceModel::AnyMap::const_iterator itr = mrModel.maData.begin(), + itrEnd = mrModel.maData.end(); itr != itrEnd; ++itr) { - mrModel.mnPointCount = std::min<sal_Int32>(mrModel.mnPointCount, 1); - OUStringBuffer aTitle; - bool bFirst = true; - for(DataSequenceModel::AnyMap::const_iterator itr = mrModel.maData.begin(), - itrEnd = mrModel.maData.end(); itr != itrEnd; ++itr) + Any aAny = itr->second; + if(aAny.has<OUString>()) { - Any aAny = itr->second; - if(aAny.has<OUString>()) - { - if(!bFirst) - aTitle.append(" "); + if(!bFirst) + aTitle.append(" "); - aTitle.append(aAny.get<OUString>()); - bFirst = false; - } - } - - if(!bFirst) - { - mrModel.maData.clear(); - mrModel.maData.insert(std::make_pair<sal_Int32, Any>(1, Any(aTitle.makeStringAndClear()))); + aTitle.append(aAny.get<OUString>()); + bFirst = false; } } - xDataSeq = getChartConverter()->createDataSequence(getChartDocument()->getDataProvider(), mrModel, rRole); - // set sequence role - PropertySet aSeqProp( xDataSeq ); - aSeqProp.setProperty( PROP_Role, rRole ); + if(!bFirst) + { + mrModel.maData.clear(); + mrModel.maData.insert(std::make_pair<sal_Int32, Any>(1, Any(aTitle.makeStringAndClear()))); + } } + xDataSeq = getChartConverter().createDataSequence(getChartDocument()->getDataProvider(), mrModel, rRole); + + // set sequence role + PropertySet aSeqProp( xDataSeq ); + aSeqProp.setProperty( PROP_Role, rRole ); return xDataSeq; } diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 9a1ac59b9a86..9d073ef0f4bc 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -429,7 +429,7 @@ public: void PreprocessDBDataUpdate( sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt ); - const SfxPoolItem* GetAttr( SCROW nRow, sal_uInt16 nWhich ) const; + const SfxPoolItem& GetAttr( SCROW nRow, sal_uInt16 nWhich ) const; const ScPatternAttr* GetPattern( SCROW nRow ) const; const ScPatternAttr* GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const; diff --git a/sc/inc/detdata.hxx b/sc/inc/detdata.hxx index e222cdd36713..110f4a11e316 100644 --- a/sc/inc/detdata.hxx +++ b/sc/inc/detdata.hxx @@ -76,7 +76,7 @@ public: void Append( ScDetOpData* pData ); ScDetOpDataVector& GetDataVector() { return aDetOpDataVector; } - const ScDetOpData* GetObject( size_t nPos ) const; + const ScDetOpData& GetObject( size_t nPos ) const; bool HasAddError() const { return bHasAddError; } size_t Count() const { return aDetOpDataVector.size(); } diff --git a/sc/inc/dpdimsave.hxx b/sc/inc/dpdimsave.hxx index 49c400cbabea..3c410643336d 100644 --- a/sc/inc/dpdimsave.hxx +++ b/sc/inc/dpdimsave.hxx @@ -111,8 +111,8 @@ public: bool HasOnlyHidden(const ScDPUniqueStringSet& rVisible); long GetGroupCount() const; - const ScDPSaveGroupItem* GetGroupByIndex( long nIndex ) const; - ScDPSaveGroupItem* GetGroupAccByIndex( long nIndex ); + const ScDPSaveGroupItem& GetGroupByIndex( long nIndex ) const; + ScDPSaveGroupItem& GetGroupAccByIndex( long nIndex ); void Rename( const OUString& rNewName ); diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 9004151b6d8a..a167194683a2 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -373,8 +373,8 @@ public: bool ReloadGroupsInCache(ScDPObject* pDPObj, std::set<ScDPObject*>& rRefs); SC_DLLPUBLIC size_t GetCount() const; - SC_DLLPUBLIC ScDPObject* operator[](size_t nIndex); - SC_DLLPUBLIC const ScDPObject* operator[](size_t nIndex) const; + SC_DLLPUBLIC ScDPObject& operator[](size_t nIndex); + SC_DLLPUBLIC const ScDPObject& operator[](size_t nIndex) const; const ScDPObject* GetByName(const OUString& rName) const; diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx index 8cba99245fb3..d47e795a0bb1 100644 --- a/sc/inc/userlist.hxx +++ b/sc/inc/userlist.hxx @@ -76,8 +76,8 @@ public: /// If the list in rStr is already inserted bool HasEntry( const OUString& rStr ) const; - const ScUserListData* operator[](size_t nIndex) const; - ScUserListData* operator[](size_t nIndex); + const ScUserListData& operator[](size_t nIndex) const; + ScUserListData& operator[](size_t nIndex); ScUserList& operator= ( const ScUserList& r ); bool operator==( const ScUserList& r ) const; bool operator!=( const ScUserList& r ) const; diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 33431cafc753..f9b35fa391dd 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1738,7 +1738,7 @@ void ScFiltersTest::testPivotTableBasicODS() "There should be exactly one pivot table instance.", size_t(1), pDPs->GetCount()); - const ScDPObject* pDPObj = (*pDPs)[0]; + const ScDPObject* pDPObj = &(*pDPs)[0]; CPPUNIT_ASSERT_MESSAGE("Failed to get an pivot table object.", pDPObj); const ScDPSaveData* pSaveData = pDPObj->GetSaveData(); CPPUNIT_ASSERT_MESSAGE("Failed to get ScDPSaveData instance.", pSaveData); @@ -1795,7 +1795,7 @@ void ScFiltersTest::testPivotTableNamedRangeSourceODS() ScDPCollection* pDPs = rDoc.GetDPCollection(); CPPUNIT_ASSERT(pDPs->GetCount() == 1); - ScDPObject* pDP = (*pDPs)[0]; + ScDPObject* pDP = &(*pDPs)[0]; CPPUNIT_ASSERT(pDP); // Make sure this pivot table is based on a named range source. diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx index 932efd66ddea..9effa0869214 100644 --- a/sc/qa/unit/ucalc_pivottable.cxx +++ b/sc/qa/unit/ucalc_pivottable.cxx @@ -2039,8 +2039,7 @@ void Test::testPivotTableDocFunc() ScDPCollection* pDPs = m_pDoc->GetDPCollection(); CPPUNIT_ASSERT_MESSAGE("Failed to get pivot table collection.", pDPs); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount()); - pDPObj = (*pDPs)[0]; - CPPUNIT_ASSERT_MESSAGE("Failed to retrieve pivot table object from the collection", pDPObj); + pDPObj = &(*pDPs)[0]; ScRange aOutRange = pDPObj->GetOutRange(); { // Expected output table content. 0 = empty cell diff --git a/sc/source/core/data/clipcontext.cxx b/sc/source/core/data/clipcontext.cxx index 9988a483c3fe..ac78dbd6941b 100644 --- a/sc/source/core/data/clipcontext.cxx +++ b/sc/source/core/data/clipcontext.cxx @@ -321,7 +321,7 @@ bool CopyFromClipContext::isCloneNotes() const bool CopyFromClipContext::isDateCell( const ScColumn& rCol, SCROW nRow ) const { - sal_uLong nNumIndex = static_cast<const SfxUInt32Item*>(rCol.GetAttr(nRow, ATTR_VALUE_FORMAT))->GetValue(); + sal_uLong nNumIndex = static_cast<const SfxUInt32Item&>(rCol.GetAttr(nRow, ATTR_VALUE_FORMAT)).GetValue(); short nType = mpClipDoc->GetFormatTable()->GetType(nNumIndex); return (nType == css::util::NumberFormat::DATE) || (nType == css::util::NumberFormat::TIME) || (nType == css::util::NumberFormat::DATETIME); } diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index e2d2f00c75fa..846a52f10072 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -372,9 +372,9 @@ const ScPatternAttr* ScColumn::GetPattern( SCROW nRow ) const return pAttrArray->GetPattern( nRow ); } -const SfxPoolItem* ScColumn::GetAttr( SCROW nRow, sal_uInt16 nWhich ) const +const SfxPoolItem& ScColumn::GetAttr( SCROW nRow, sal_uInt16 nWhich ) const { - return &pAttrArray->GetPattern( nRow )->GetItemSet().Get(nWhich); + return pAttrArray->GetPattern( nRow )->GetItemSet().Get(nWhich); } const ScPatternAttr* ScColumn::GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 6c9922605a4f..521ccb389fe2 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2683,7 +2683,7 @@ class MaxStringLenHandler { Color* pColor; OUString aString; - sal_uInt32 nFormat = static_cast<const SfxUInt32Item*>(mrColumn.GetAttr(nRow, ATTR_VALUE_FORMAT))->GetValue(); + sal_uInt32 nFormat = static_cast<const SfxUInt32Item&>(mrColumn.GetAttr(nRow, ATTR_VALUE_FORMAT)).GetValue(); ScCellFormat::GetString(rCell, nFormat, aString, &pColor, *mpFormatter, &mrColumn.GetDoc()); sal_Int32 nLen = 0; if (mbOctetEncoding) @@ -2789,8 +2789,8 @@ class MaxNumStringLenHandler OUString aString; OUString aSep; sal_uInt16 nPrec; - sal_uInt32 nFormat = static_cast<const SfxUInt32Item*>( - mrColumn.GetAttr(nRow, ATTR_VALUE_FORMAT))->GetValue(); + sal_uInt32 nFormat = static_cast<const SfxUInt32Item&>( + mrColumn.GetAttr(nRow, ATTR_VALUE_FORMAT)).GetValue(); if (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) { aSep = mpFormatter->GetFormatDecimalSep(nFormat); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index da216f2a3379..5e3df16ef625 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -338,8 +338,8 @@ ScDPObject* ScDocument::GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const sal_uInt16 nCount = pDPCollection->GetCount(); ScAddress aPos( nCol, nRow, nTab ); for (sal_uInt16 i=0; i<nCount; i++) - if ( (*pDPCollection)[i]->GetOutRange().In( aPos ) ) - return (*pDPCollection)[i]; + if ( (*pDPCollection)[i].GetOutRange().In( aPos ) ) + return &(*pDPCollection)[i]; return NULL; } @@ -353,8 +353,8 @@ ScDPObject* ScDocument::GetDPAtBlock( const ScRange & rBlock ) const * approximation of MS Excels 'most recent' effect. */ sal_uInt16 i = pDPCollection->GetCount(); while ( i-- > 0 ) - if ( (*pDPCollection)[i]->GetOutRange().In( rBlock ) ) - return (*pDPCollection)[i]; + if ( (*pDPCollection)[i].GetOutRange().In( rBlock ) ) + return &(*pDPCollection)[i]; return NULL; } diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx index ef27c121df93..629c1a544dd9 100644 --- a/sc/source/core/data/dpdimsave.cxx +++ b/sc/source/core/data/dpdimsave.cxx @@ -207,14 +207,14 @@ long ScDPSaveGroupDimension::GetGroupCount() const return aGroups.size(); } -const ScDPSaveGroupItem* ScDPSaveGroupDimension::GetGroupByIndex( long nIndex ) const +const ScDPSaveGroupItem& ScDPSaveGroupDimension::GetGroupByIndex( long nIndex ) const { - return const_cast< ScDPSaveGroupDimension* >( this )->GetGroupAccByIndex( nIndex ); + return aGroups[nIndex]; } -ScDPSaveGroupItem* ScDPSaveGroupDimension::GetGroupAccByIndex( long nIndex ) +ScDPSaveGroupItem& ScDPSaveGroupDimension::GetGroupAccByIndex( long nIndex ) { - return &aGroups[nIndex]; + return aGroups[nIndex]; } void ScDPSaveGroupDimension::RemoveFromGroups( const OUString& rItemName ) diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index ab982c4ef6c8..009c60dcd24f 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -3570,14 +3570,14 @@ size_t ScDPCollection::GetCount() const return maTables.size(); } -ScDPObject* ScDPCollection::operator [](size_t nIndex) +ScDPObject& ScDPCollection::operator [](size_t nIndex) { - return &maTables[nIndex]; + return maTables[nIndex]; } -const ScDPObject* ScDPCollection::operator [](size_t nIndex) const +const ScDPObject& ScDPCollection::operator [](size_t nIndex) const { - return &maTables[nIndex]; + return maTables[nIndex]; } const ScDPObject* ScDPCollection::GetByName(const OUString& rName) const diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 4659d287bdfa..92ad6231282d 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1825,7 +1825,7 @@ void ScTable::ResetChanged( const ScRange& rRange ) const SfxPoolItem* ScTable::GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const { if (ValidColRow(nCol,nRow)) - return aCol[nCol].GetAttr( nRow, nWhich ); + return &aCol[nCol].GetAttr( nRow, nWhich ); else return NULL; } diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 1be0c8f1d92a..896b59b6dd6f 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1500,22 +1500,17 @@ short ScTable::CompareCell( if (bUserDef) { ScUserList* pList = ScGlobal::GetUserList(); - const ScUserListData* pData = (*pList)[aSortParam.nUserIndex]; + const ScUserListData& rData = (*pList)[aSortParam.nUserIndex]; - if (pData) + if ( bNaturalSort ) + nRes = naturalsort::Compare( aStr1, aStr2, bCaseSens, &rData, pSortCollator ); + else { - if ( bNaturalSort ) - nRes = naturalsort::Compare( aStr1, aStr2, bCaseSens, pData, pSortCollator ); + if ( bCaseSens ) + nRes = sal::static_int_cast<short>( rData.Compare(aStr1, aStr2) ); else - { - if ( bCaseSens ) - nRes = sal::static_int_cast<short>( pData->Compare(aStr1, aStr2) ); - else - nRes = sal::static_int_cast<short>( pData->ICompare(aStr1, aStr2) ); - } + nRes = sal::static_int_cast<short>( rData.ICompare(aStr1, aStr2) ); } - else - bUserDef = false; } if (!bUserDef) diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx index b1015806bd62..8b8a6f161857 100644 --- a/sc/source/core/tool/appoptio.cxx +++ b/sc/source/core/tool/appoptio.cxx @@ -201,7 +201,7 @@ static void lcl_GetSortList( Any& rDest ) Sequence<OUString> aSeq( nCount ); OUString* pArray = aSeq.getArray(); for (size_t i=0; i<nCount; ++i) - pArray[i] = (*pUserList)[sal::static_int_cast<sal_uInt16>(i)]->GetString(); + pArray[i] = (*pUserList)[sal::static_int_cast<sal_uInt16>(i)].GetString(); rDest <<= aSeq; } else diff --git a/sc/source/core/tool/detdata.cxx b/sc/source/core/tool/detdata.cxx index e7fb6c43287a..3cdd04370958 100644 --- a/sc/source/core/tool/detdata.cxx +++ b/sc/source/core/tool/detdata.cxx @@ -86,9 +86,9 @@ bool ScDetOpList::operator==( const ScDetOpList& r ) const return bEqual; } -const ScDetOpData* ScDetOpList::GetObject( size_t nPos ) const +const ScDetOpData& ScDetOpList::GetObject( size_t nPos ) const { - return &aDetOpDataVector[nPos]; + return aDetOpDataVector[nPos]; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx index 411a2fdf5c8c..a140fa9ee19b 100644 --- a/sc/source/core/tool/userlist.cxx +++ b/sc/source/core/tool/userlist.cxx @@ -279,14 +279,14 @@ const ScUserListData* ScUserList::GetData(const OUString& rSubStr) const return NULL; } -const ScUserListData* ScUserList::operator[](size_t nIndex) const +const ScUserListData& ScUserList::operator[](size_t nIndex) const { - return &maData[nIndex]; + return maData[nIndex]; } -ScUserListData* ScUserList::operator[](size_t nIndex) +ScUserListData& ScUserList::operator[](size_t nIndex) { - return &maData[nIndex]; + return maData[nIndex]; } ScUserList& ScUserList::operator=( const ScUserList& r ) diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index ed8981afe66e..ce349fe1af4c 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -812,7 +812,7 @@ void XclImpAutoFilterData::CreateScDBData() // or if we need to create the Advanced Filter. if( bActive || bCriteria) { - ScDocument* pDoc = pExcRoot->pIR->GetDocPtr(); + ScDocument& rDoc = pExcRoot->pIR->GetDocRef(); OUString aNewName(STR_DB_LOCAL_NONAME); pCurrDBData = new ScDBData(aNewName , Tab(), StartCol(),StartRow(), EndCol(),EndRow() ); @@ -825,7 +825,7 @@ void XclImpAutoFilterData::CreateScDBData() } else pCurrDBData->SetAdvancedQuerySource(NULL); - pDoc->SetAnonymousDBData(Tab(), pCurrDBData); + rDoc.SetAnonymousDBData(Tab(), pCurrDBData); } } diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index c33de19331a0..c981c3d2a716 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -896,8 +896,8 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > x // Compile the range representation string into token array. Note that the // source range text depends on the current grammar. OUString aRangeRepr = xDataSeq->getSourceRangeRepresentation(); - ScCompiler aComp( GetDocPtr(), ScAddress() ); - aComp.SetGrammar( GetDocPtr()->GetGrammar() ); + ScCompiler aComp( &GetDocRef(), ScAddress() ); + aComp.SetGrammar( GetDocRef().GetGrammar() ); boost::scoped_ptr<ScTokenArray> pArray(aComp.CompileString(aRangeRepr)); if( !pArray ) return nDefCount; diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index c0d1cf0583ed..6c2601fe31ac 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -166,7 +166,7 @@ static void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_ while(true) { - Rectangle r = rRoot.GetDocPtr()->GetMMRect( nCol,nRow,nCol,nRow,nTab ); + Rectangle r = rRoot.GetDocRef().GetMMRect( nCol,nRow,nCol,nRow,nTab ); if( !bTo ) { if( r.Left() <= aRect.Left() ) diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 5fcfbe443e96..2f1c6222415b 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -594,7 +594,7 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA { // clone the passed token array, convert references relative to current cell position mxData->mxOwnScTokArr.reset( rScTokArr.Clone() ); - ScCompiler::MoveRelWrap( *mxData->mxOwnScTokArr, GetDocPtr(), *pScBasePos, MAXCOL, MAXROW ); + ScCompiler::MoveRelWrap( *mxData->mxOwnScTokArr, &GetDocRef(), *pScBasePos, MAXCOL, MAXROW ); // don't remember pScBasePos in mxData->mpScBasePos, shared formulas use real relative refs } break; diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 4466a1e12584..d6347bc98fe2 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -369,7 +369,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, XclTo XclExpNameRef xName( new XclExpName( GetRoot(), cBuiltIn ) ); xName->SetTokenArray( xTokArr ); xName->SetLocalTab( aRange.aStart.Tab() ); - OUString sSymbol(aRange.Format(SCR_ABS_3D, GetDocPtr(), ScAddress::Details( ::formula::FormulaGrammar::CONV_XL_A1))); + OUString sSymbol(aRange.Format(SCR_ABS_3D, &GetDocRef(), ScAddress::Details( ::formula::FormulaGrammar::CONV_XL_A1))); xName->SetSymbol( sSymbol ); return Append( xName ); } @@ -380,7 +380,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, XclTo xName->SetTokenArray( xTokArr ); xName->SetLocalTab( nScTab ); OUString sSymbol; - rRangeList.Format( sSymbol, SCR_ABS_3D, GetDocPtr(), ::formula::FormulaGrammar::CONV_XL_A1 ); + rRangeList.Format( sSymbol, SCR_ABS_3D, &GetDocRef(), ::formula::FormulaGrammar::CONV_XL_A1 ); xName->SetSymbol( sSymbol ); return Append( xName ); } diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 71ca74523386..78b4b32b6b1b 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -368,24 +368,22 @@ void XclExpPCField::InitStdGroupField( const XclExpPCField& rBaseField, const Sc // loop over all groups of this field for( long nGroupIdx = 0, nGroupCount = rGroupDim.GetGroupCount(); nGroupIdx < nGroupCount; ++nGroupIdx ) { - if( const ScDPSaveGroupItem* pGroupItem = rGroupDim.GetGroupByIndex( nGroupIdx ) ) + const ScDPSaveGroupItem& rGroupItem = rGroupDim.GetGroupByIndex( nGroupIdx ); + // the index of the new item containing the grouping name + sal_uInt16 nGroupItemIdx = EXC_PC_NOITEM; + // loop over all elements of one group + for( size_t nElemIdx = 0, nElemCount = rGroupItem.GetElementCount(); nElemIdx < nElemCount; ++nElemIdx ) { - // the index of the new item containing the grouping name - sal_uInt16 nGroupItemIdx = EXC_PC_NOITEM; - // loop over all elements of one group - for( size_t nElemIdx = 0, nElemCount = pGroupItem->GetElementCount(); nElemIdx < nElemCount; ++nElemIdx ) + if (const OUString* pElemName = rGroupItem.GetElementByIndex(nElemIdx)) { - if (const OUString* pElemName = pGroupItem->GetElementByIndex(nElemIdx)) + // try to find the item that is part of the group in the base field + sal_uInt16 nBaseItemIdx = rBaseField.GetItemIndex( *pElemName ); + if( nBaseItemIdx < maFieldInfo.mnBaseItems ) { - // try to find the item that is part of the group in the base field - sal_uInt16 nBaseItemIdx = rBaseField.GetItemIndex( *pElemName ); - if( nBaseItemIdx < maFieldInfo.mnBaseItems ) - { - // add group name item only if there are any valid base items - if( nGroupItemIdx == EXC_PC_NOITEM ) - nGroupItemIdx = InsertGroupItem( new XclExpPCItem( pGroupItem->GetGroupName() ) ); - maGroupOrder[ nBaseItemIdx ] = nGroupItemIdx; - } + // add group name item only if there are any valid base items + if( nGroupItemIdx == EXC_PC_NOITEM ) + nGroupItemIdx = InsertGroupItem( new XclExpPCItem( rGroupItem.GetGroupName() ) ); + maGroupOrder[ nBaseItemIdx ] = nGroupItemIdx; } } } @@ -522,7 +520,7 @@ void XclExpPCField::InsertNumDateGroupItems( const ScDPObject& rDPObj, const ScD if (!pCache) return; - ScSheetDPData aDPData(GetDocPtr(), *pSrcDesc, *pCache); + ScSheetDPData aDPData(&GetDocRef(), *pSrcDesc, *pCache); long nDim = GetFieldIndex(); // get the string collection with generated grouping elements ScDPNumGroupDimension aTmpDim( rNumInfo ); @@ -1634,9 +1632,11 @@ void XclExpPivotTableManager::CreatePivotTables() { if( ScDPCollection* pDPColl = GetDoc().GetDPCollection() ) for( size_t nDPObj = 0, nCount = pDPColl->GetCount(); nDPObj < nCount; ++nDPObj ) - if( ScDPObject* pDPObj = (*pDPColl)[ nDPObj ] ) - if( const XclExpPivotCache* pPCache = CreatePivotCache( *pDPObj ) ) - maPTableList.AppendNewRecord( new XclExpPivotTable( GetRoot(), *pDPObj, *pPCache, nDPObj ) ); + { + ScDPObject& rDPObj = (*pDPColl)[ nDPObj ]; + if( const XclExpPivotCache* pPCache = CreatePivotCache( rDPObj ) ) + maPTableList.AppendNewRecord( new XclExpPivotTable( GetRoot(), rDPObj, *pPCache, nDPObj ) ); + } } XclExpRecordRef XclExpPivotTableManager::CreatePivotCachesRecord() diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index fa04e1f2558b..52de28cd6a82 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -318,17 +318,16 @@ void XclExpXmlPivotTableManager::Initialize() for (size_t i = 0, n = pDPColl->GetCount(); i < n; ++i) { - const ScDPObject* pDPObj = (*pDPColl)[i]; - assert(pDPObj); // We don't store NULL here. + const ScDPObject& rDPObj = (*pDPColl)[i]; // Get the cache ID for this pivot table. - CacheIdMapType::iterator itCache = maCacheIdMap.find(pDPObj); + CacheIdMapType::iterator itCache = maCacheIdMap.find(&rDPObj); if (itCache == maCacheIdMap.end()) // No cache ID found. Something is wrong here.... continue; sal_Int32 nCacheId = itCache->second; - SCTAB nTab = pDPObj->GetOutRange().aStart.Tab(); + SCTAB nTab = rDPObj.GetOutRange().aStart.Tab(); TablesType::iterator it = maTables.find(nTab); if (it == maTables.end()) @@ -340,7 +339,7 @@ void XclExpXmlPivotTableManager::Initialize() } XclExpXmlPivotTables* p = it->second; - p->AppendTable(pDPObj, nCacheId, i+1); + p->AppendTable(&rDPObj, nCacheId, i+1); } maCaches.SetCaches(aCaches); diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 6449ae2a6b8c..1908a0ea0d00 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -834,7 +834,7 @@ Reference< XDataSequence > XclImpChSourceLink::CreateDataSequence( const OUStrin { if ( mxTokenArray ) { - ScCompiler aComp( GetDocPtr(), ScAddress(), *mxTokenArray ); + ScCompiler aComp( &GetDocRef(), ScAddress(), *mxTokenArray ); aComp.SetGrammar(GetDoc().GetGrammar()); OUStringBuffer aRangeRep; aComp.CreateStringFromTokenArray( aRangeRep ); diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 3b10649baf60..d821a8ad5266 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -654,13 +654,13 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) if( !mxScCondFmt.get() ) { sal_uLong nKey = 0; - mxScCondFmt.reset( new ScConditionalFormat( nKey, GetDocPtr() ) ); + mxScCondFmt.reset( new ScConditionalFormat( nKey, &GetDocRef() ) ); if(maRanges.size() > 1) maRanges.Join(*maRanges[0], true); mxScCondFmt->SetRange(maRanges); } - ScCondFormatEntry* pEntry = new ScCondFormatEntry( eMode, xTokArr1.get(), pTokArr2.get(), GetDocPtr(), rPos, aStyleName ); + ScCondFormatEntry* pEntry = new ScCondFormatEntry( eMode, xTokArr1.get(), pTokArr2.get(), &GetDocRef(), rPos, aStyleName ); mxScCondFmt->AddEntry( pEntry ); ++mnCondIndex; } diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx index c1bee5af50f6..bb93e8865904 100644 --- a/sc/source/filter/excel/xiname.cxx +++ b/sc/source/filter/excel/xiname.cxx @@ -236,7 +236,7 @@ void XclImpName::ConvertTokens() void XclImpName::InsertName(const ScTokenArray* pArray) { // create the Calc name data - ScRangeData* pData = new ScRangeData(GetDocPtr(), maScName, *pArray, ScAddress(), meNameType); + ScRangeData* pData = new ScRangeData(&GetDocRef(), maScName, *pArray, ScAddress(), meNameType); pData->GuessPosition(); // calculate base position for relative refs pData->SetIndex( mnNameIndex ); // used as unique identifier in formulas if (mnXclTab == EXC_NAME_GLOBAL) diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx index 48fe3b30cd0e..aa8c7de34ca1 100644 --- a/sc/source/filter/excel/xipivot.cxx +++ b/sc/source/filter/excel/xipivot.cxx @@ -1399,7 +1399,7 @@ void XclImpPivotTable::Convert() // *** insert into Calc document *** // create source descriptor - ScSheetSourceDesc aDesc(GetDocPtr()); + ScSheetSourceDesc aDesc(&GetDocRef()); const OUString& rSrcName = mxPCache->GetSourceRangeName(); if (!rSrcName.isEmpty()) // Range name is the data source. @@ -1417,7 +1417,7 @@ void XclImpPivotTable::Convert() } // create the DataPilot - ScDPObject* pDPObj = new ScDPObject( GetDocPtr() ); + ScDPObject* pDPObj = new ScDPObject( &GetDocRef() ); pDPObj->SetName( maPTInfo.maTableName ); if (!maPTInfo.maDataName.isEmpty()) aSaveData.GetDataLayoutDimension()->SetLayoutName(maPTInfo.maDataName); diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index df3f4d69d199..551e035d80c8 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -271,9 +271,9 @@ ScDocument& XclRoot::GetDoc() const return mrData.mrDoc; } -ScDocument* XclRoot::GetDocPtr() const +ScDocument& XclRoot::GetDocRef() const { - return &mrData.mrDoc; + return mrData.mrDoc; } SfxObjectShell* XclRoot::GetDocShell() const diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx index d65ccf08bd42..7e98ed86c653 100644 --- a/sc/source/filter/inc/xlroot.hxx +++ b/sc/source/filter/inc/xlroot.hxx @@ -206,7 +206,7 @@ public: /** Returns the destination document (import) or source document (export). */ ScDocument& GetDoc() const; /** Returns pointer to the destination document (import) or source document (export). */ - ScDocument* GetDocPtr() const; + ScDocument& GetDocRef() const; /** Returns the object shell of the Calc document. May be 0 (i.e. import from clipboard). */ SfxObjectShell* GetDocShell() const; diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx index 417aa3f80720..0dd38ebeb36c 100644 --- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx @@ -58,7 +58,7 @@ XclImpChangeTrack::XclImpChangeTrack( const XclImpRoot& rRoot, const XclImpStrea xInStrm->Seek( STREAM_SEEK_TO_BEGIN ); pStrm = new XclImpStream( *xInStrm, GetRoot() ); pStrm->CopyDecrypterFrom( rBookStrm ); - pChangeTrack = new ScChangeTrack( GetDocPtr() ); + pChangeTrack = new ScChangeTrack( &GetDocRef() ); sOldUsername = pChangeTrack->GetUser(); pChangeTrack->SetUseFixDateTime( true ); @@ -273,7 +273,7 @@ void XclImpChangeTrack::ReadCell( if( pStrm->IsValid() && pTokenArray ) { rCell.meType = CELLTYPE_FORMULA; - rCell.mpFormula = new ScFormulaCell(GetDocPtr(), rPosition, *pTokenArray); + rCell.mpFormula = new ScFormulaCell(&GetDocRef(), rPosition, *pTokenArray); } delete pTokenArray; } diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx index a17ac85c290b..69195c54a67e 100644 --- a/sc/source/filter/xcl97/xcl97esc.cxx +++ b/sc/source/filter/xcl97/xcl97esc.cxx @@ -206,7 +206,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape //added for exporting OCX control sal_Int16 nMsCtlType = 0; if ( !pObj ) - pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, GetDocPtr() ); // just what is it?!? + pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDocRef() ); // just what is it?!? else { pCurrXclObj = NULL; @@ -231,10 +231,10 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape pCurrXclObj = new XclObjOle( mrObjMgr, *pObj ); } else // just a metafile - pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, GetDocPtr() ); + pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDocRef() ); } else - pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, GetDocPtr() ); + pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDocRef() ); } else if( nObjType == OBJ_UNO ) { @@ -255,13 +255,13 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape else //TBX Form Control pCurrXclObj = CreateTBXCtrlObj( rxShape, pChildAnchor ); if( !pCurrXclObj ) - pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, GetDocPtr() ); // just a metafile + pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDocRef() ); // just a metafile } else if( !ScDrawLayer::IsNoteCaption( pObj ) ) { // ignore permanent note shapes // #i12190# do not ignore callouts (do not filter by object type ID) - pCurrXclObj = ShapeInteractionHelper::CreateShapeObj( mrObjMgr, rxShape, GetDocPtr() ); + pCurrXclObj = ShapeInteractionHelper::CreateShapeObj( mrObjMgr, rxShape, &GetDocRef() ); ShapeInteractionHelper::PopulateShapeInteractionInfo( mrObjMgr, rxShape, *pCurrAppData ); } } diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx index 6ca6cf06699a..7a605a4f3bfc 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -653,20 +653,17 @@ void ScXMLExportDataPilot::WriteGroupDimElements(ScDPSaveDimension* pDim, const sal_Int32 nCount = pGroupDim->GetGroupCount(); for (sal_Int32 i = 0; i < nCount; ++i) { - const ScDPSaveGroupItem* pGroup = pGroupDim->GetGroupByIndex( i ); - if (pGroup) + const ScDPSaveGroupItem& rGroup = pGroupDim->GetGroupByIndex( i ); + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, rGroup.GetGroupName()); + SvXMLElementExport aElemDPG(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP, true, true); + sal_Int32 nElemCount = rGroup.GetElementCount(); + for(sal_Int32 j = 0; j < nElemCount; ++j) { - rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, pGroup->GetGroupName()); - SvXMLElementExport aElemDPG(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP, true, true); - sal_Int32 nElemCount = pGroup->GetElementCount(); - for(sal_Int32 j = 0; j < nElemCount; ++j) + const OUString* pElem = rGroup.GetElementByIndex(j); + if (pElem) { - const OUString* pElem = pGroup->GetElementByIndex(j); - if (pElem) - { - rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, *pElem); - SvXMLElementExport aElemDPM(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP_MEMBER, true, true); - } + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, *pElem); + SvXMLElementExport aElemDPM(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP_MEMBER, true, true); } } } @@ -757,11 +754,11 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads rExport.CheckAttrList(); for (size_t i = 0; i < nDPCount; ++i) { - ScDPSaveData* pDPSave = (*pDPs)[i]->GetSaveData(); + ScDPSaveData* pDPSave = (*pDPs)[i].GetSaveData(); if (!pDPSave) continue; - ScRange aOutRange((*pDPs)[i]->GetOutRange()); + ScRange aOutRange((*pDPs)[i].GetOutRange()); OUString sTargetRangeAddress; ScRangeStringConverter::GetStringFromRange( sTargetRangeAddress, aOutRange, pDoc, ::formula::FormulaGrammar::CONV_OOO ); ScDocAttrIterator aAttrItr(pDoc, aOutRange.aStart.Tab(), @@ -785,8 +782,8 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads } pAttr = aAttrItr.GetNext(nCol, nRow1, nRow2); } - OUString sName((*pDPs)[i]->GetName()); - OUString sApplicationData((*pDPs)[i]->GetTag()); + OUString sName((*pDPs)[i].GetName()); + OUString sApplicationData((*pDPs)[i].GetTag()); bool bRowGrand = pDPSave->GetRowGrand(); bool bColumnGrand = pDPSave->GetColumnGrand(); rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, sName); @@ -810,7 +807,7 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SHOW_FILTER_BUTTON, XML_FALSE); if (!pDPSave->GetDrillDown()) rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DRILL_DOWN_ON_DOUBLE_CLICK, XML_FALSE); - if ((*pDPs)[i]->GetHeaderLayout()) + if ((*pDPs)[i].GetHeaderLayout()) rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_HEADER_GRID_LAYOUT, XML_TRUE); SvXMLElementExport aElemDP(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_TABLE, true, true); @@ -833,9 +830,9 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads } rExport.CheckAttrList(); - if ((*pDPs)[i]->IsSheetData()) + if ((*pDPs)[i].IsSheetData()) { - const ScSheetSourceDesc* pSheetSource = (*pDPs)[i]->GetSheetDesc(); + const ScSheetSourceDesc* pSheetSource = (*pDPs)[i].GetSheetDesc(); if (rExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012) { @@ -854,9 +851,9 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads rExport.CheckAttrList(); WriteDPFilter(pSheetSource->GetQueryParam()); } - else if ((*pDPs)[i]->IsImportData()) + else if ((*pDPs)[i].IsImportData()) { - const ScImportSourceDesc* pImpSource = (*pDPs)[i]->GetImportSourceDesc(); + const ScImportSourceDesc* pImpSource = (*pDPs)[i].GetImportSourceDesc(); switch (pImpSource->nType) { case sheet::DataImportMode_NONE : break; @@ -888,9 +885,9 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads break; } } - else if ((*pDPs)[i]->IsServiceData()) + else if ((*pDPs)[i].IsServiceData()) { - const ScDPServiceDesc* pServSource = (*pDPs)[i]->GetDPServiceDesc(); + const ScDPServiceDesc* pServSource = (*pDPs)[i].GetDPServiceDesc(); rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, pServSource->aServiceName); rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SOURCE_NAME, pServSource->aParSource); rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_OBJECT_NAME, pServSource->aParName); diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 652823a10e5d..969df4af1780 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -734,19 +734,16 @@ void ScXMLExport::GetDetectiveOpList( ScMyDetectiveOpContainer& rDetOp ) size_t nCount = pOpList->Count(); for (size_t nIndex = 0; nIndex < nCount; ++nIndex ) { - const ScDetOpData* pDetData = pOpList->GetObject( nIndex); - if( pDetData ) + const ScDetOpData& rDetData = pOpList->GetObject( nIndex); + const ScAddress& rDetPos = rDetData.GetPos(); + SCTAB nTab = rDetPos.Tab(); + if ( nTab < pDoc->GetTableCount() ) { - const ScAddress& rDetPos = pDetData->GetPos(); - SCTAB nTab = rDetPos.Tab(); - if ( nTab < pDoc->GetTableCount() ) - { - rDetOp.AddOperation( pDetData->GetOperation(), rDetPos, static_cast<sal_uInt32>( nIndex) ); + rDetOp.AddOperation( rDetData.GetOperation(), rDetPos, static_cast<sal_uInt32>( nIndex) ); - // cells with detective operations are written even if empty - pSharedData->SetLastColumn( nTab, rDetPos.Col() ); - pSharedData->SetLastRow( nTab, rDetPos.Row() ); - } + // cells with detective operations are written even if empty + pSharedData->SetLastColumn( nTab, rDetPos.Col() ); + pSharedData->SetLastRow( nTab, rDetPos.Row() ); } } rDetOp.Sort(); diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 2b6be65a197a..e2a7bc0d9453 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -333,16 +333,16 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) ScTabViewShell* pDocView = pRefViewSh ? pRefViewSh : pActiveViewSh; if ( pDocView && pRangeFindList && nIndex < pRangeFindList->Count() ) { - ScRangeFindData* pData = pRangeFindList->GetObject( nIndex ); - sal_Int32 nOldStart = pData->nSelStart; - sal_Int32 nOldEnd = pData->nSelEnd; + ScRangeFindData& rData = pRangeFindList->GetObject( nIndex ); + sal_Int32 nOldStart = rData.nSelStart; + sal_Int32 nOldEnd = rData.nSelEnd; ColorData nNewColor = pRangeFindList->FindColor( rNew, nIndex ); ScRange aJustified = rNew; aJustified.Justify(); // Always display Ref in the Formula the right way ScDocument* pDoc = pDocView->GetViewData().GetDocument(); const ScAddress::Details aAddrDetails( pDoc, aCursorPos ); - OUString aNewStr(aJustified.Format(pData->nFlags, pDoc, aAddrDetails)); + OUString aNewStr(aJustified.Format(rData.nFlags, pDoc, aAddrDetails)); ESelection aOldSel( 0, nOldStart, 0, nOldEnd ); SfxItemSet aSet( pEngine->GetEmptyItemSet() ); @@ -359,16 +359,16 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) long nDiff = aNewStr.getLength() - (long)(nOldEnd-nOldStart); - pData->aRef = rNew; - pData->nSelEnd = pData->nSelEnd + nDiff; - pData->nColorData = nNewColor; + rData.aRef = rNew; + rData.nSelEnd = rData.nSelEnd + nDiff; + rData.nColorData = nNewColor; sal_uInt16 nCount = (sal_uInt16) pRangeFindList->Count(); for (sal_uInt16 i=nIndex+1; i<nCount; i++) { - ScRangeFindData* pNext = pRangeFindList->GetObject( i ); - pNext->nSelStart = pNext->nSelStart + nDiff; - pNext->nSelEnd = pNext->nSelEnd + nDiff; + ScRangeFindData& rNext = pRangeFindList->GetObject( i ); + rNext.nSelStart = rNext.nSelStart + nDiff; + rNext.nSelEnd = rNext.nSelEnd + nDiff; } EditView* pActiveView = pTopView ? pTopView : pTableView; diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx index 83fdfdf91e5f..812a786c6dd5 100644 --- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx +++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx @@ -629,9 +629,9 @@ bool ScPivotLayoutDialog::IsDataElement(SCCOL nColumn) return mpListBoxField->IsDataElement(nColumn); } -ScDPLabelData* ScPivotLayoutDialog::GetLabelData(SCCOL nColumn) +ScDPLabelData& ScPivotLayoutDialog::GetLabelData(SCCOL nColumn) { - return &maPivotParameters.maLabelArray[nColumn]; + return maPivotParameters.maLabelArray[nColumn]; } void ScPivotLayoutDialog::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames) diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx index b217aece02c3..30c42c5c65b8 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx @@ -49,9 +49,7 @@ bool ScPivotLayoutTreeList::DoubleClickHdl() return false; SCCOL nCurrentColumn = rCurrentFunctionData.mnCol; - ScDPLabelData* pCurrentLabelData = mpParent->GetLabelData(nCurrentColumn); - if (!pCurrentLabelData) - return false; + ScDPLabelData& rCurrentLabelData = mpParent->GetLabelData(nCurrentColumn); ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create(); @@ -59,11 +57,11 @@ bool ScPivotLayoutTreeList::DoubleClickHdl() mpParent->PushDataFieldNames(aDataFieldNames); boost::scoped_ptr<AbstractScDPSubtotalDlg> pDialog( - pFactory->CreateScDPSubtotalDlg(this, mpParent->maPivotTableObject, *pCurrentLabelData, rCurrentFunctionData, aDataFieldNames, true)); + pFactory->CreateScDPSubtotalDlg(this, mpParent->maPivotTableObject, rCurrentLabelData, rCurrentFunctionData, aDataFieldNames, true)); if (pDialog->Execute() == RET_OK) { - pDialog->FillLabelData(*pCurrentLabelData); + pDialog->FillLabelData(rCurrentLabelData); rCurrentFunctionData.mnFuncMask = pDialog->GetFuncMask(); } diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx index 360c62efd44e..a45b650135ef 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx @@ -77,29 +77,27 @@ bool ScPivotLayoutTreeListData::DoubleClickHdl() ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData; SCCOL nCurrentColumn = rCurrentFunctionData.mnCol; - ScDPLabelData* pCurrentLabelData = mpParent->GetLabelData(nCurrentColumn); - if (!pCurrentLabelData) - return false; + ScDPLabelData& rCurrentLabelData = mpParent->GetLabelData(nCurrentColumn); ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create(); boost::scoped_ptr<AbstractScDPFunctionDlg> pDialog( - pFactory->CreateScDPFunctionDlg(this, mpParent->GetLabelDataVector(), *pCurrentLabelData, rCurrentFunctionData)); + pFactory->CreateScDPFunctionDlg(this, mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData)); if (pDialog->Execute() == RET_OK) { rCurrentFunctionData.mnFuncMask = pDialog->GetFuncMask(); - pCurrentLabelData->mnFuncMask = pDialog->GetFuncMask(); + rCurrentLabelData.mnFuncMask = pDialog->GetFuncMask(); rCurrentFunctionData.maFieldRef = pDialog->GetFieldRef(); - ScDPLabelData* pDFData = mpParent->GetLabelData(rCurrentFunctionData.mnCol); + ScDPLabelData& rDFData = mpParent->GetLabelData(rCurrentFunctionData.mnCol); AdjustDuplicateCount(pCurrentItemValue); OUString sDataItemName = lclCreateDataItemName( rCurrentFunctionData.mnFuncMask, - pDFData->maName, + rDFData.maName, rCurrentFunctionData.mnDupCount); SetEntryText(GetCurEntry(), sDataItemName); @@ -152,12 +150,12 @@ void ScPivotLayoutTreeListData::PushDataFieldNames(vector<ScDPName>& rDataFieldN ScItemValue* pEachItemValue = static_cast<ScItemValue*>(pLoopEntry->GetUserData()); SCCOL nColumn = pEachItemValue->maFunctionData.mnCol; - ScDPLabelData* pLabelData = mpParent->GetLabelData(nColumn); + ScDPLabelData& rLabelData = mpParent->GetLabelData(nColumn); - if (pLabelData == NULL || pLabelData->maName.isEmpty()) + if (rLabelData.maName.isEmpty()) continue; - OUString sLayoutName = pLabelData->maLayoutName; + OUString sLayoutName = rLabelData.maLayoutName; if (sLayoutName.isEmpty()) { sLayoutName = lclCreateDataItemName( @@ -166,7 +164,7 @@ void ScPivotLayoutTreeListData::PushDataFieldNames(vector<ScDPName>& rDataFieldN pEachItemValue->maFunctionData.mnDupCount); } - rDataFieldNames.push_back(ScDPName(pLabelData->maName, sLayoutName, pLabelData->mnDupCount)); + rDataFieldNames.push_back(ScDPName(rLabelData.maName, sLayoutName, rLabelData.mnDupCount)); } } diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index 85661d1067a2..296c53fe08ae 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -841,7 +841,7 @@ void ScTabPageSortOptions::FillUserSortListBox() size_t nCount = pUserLists->size(); if ( nCount > 0 ) for ( size_t i=0; i<nCount; ++i ) - m_pLbSortUser->InsertEntry( (*pUserLists)[i]->GetString() ); + m_pLbSortUser->InsertEntry( (*pUserLists)[i].GetString() ); } } diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index 2b2ba2162a55..923e6fb2d7f5 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -558,7 +558,7 @@ void ScTpSubTotalOptions::FillUserSortListBox() { size_t nCount = pUserLists->size(); for ( size_t i=0; i<nCount; ++i ) - pLbUserDef->InsertEntry( (*pUserLists)[i]->GetString() ); + pLbUserDef->InsertEntry( (*pUserLists)[i].GetString() ); } } diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index ff9f8c2713dd..3e8752b4954b 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -471,33 +471,30 @@ bool ScDocFunc::DetectiveRefresh( bool bAutomatic ) size_t nCount = pList->Count(); for (size_t i=0; i < nCount; ++i) { - const ScDetOpData* pData = pList->GetObject(i); - if (pData) + const ScDetOpData& rData = pList->GetObject(i); + ScAddress aPos = rData.GetPos(); + ScDetectiveFunc aFunc( &rDoc, aPos.Tab() ); + SCCOL nCol = aPos.Col(); + SCROW nRow = aPos.Row(); + switch (rData.GetOperation()) { - ScAddress aPos = pData->GetPos(); - ScDetectiveFunc aFunc( &rDoc, aPos.Tab() ); - SCCOL nCol = aPos.Col(); - SCROW nRow = aPos.Row(); - switch (pData->GetOperation()) - { - case SCDETOP_ADDSUCC: - aFunc.ShowSucc( nCol, nRow ); - break; - case SCDETOP_DELSUCC: - aFunc.DeleteSucc( nCol, nRow ); - break; - case SCDETOP_ADDPRED: - aFunc.ShowPred( nCol, nRow ); - break; - case SCDETOP_DELPRED: - aFunc.DeletePred( nCol, nRow ); - break; - case SCDETOP_ADDERROR: - aFunc.ShowError( nCol, nRow ); - break; - default: - OSL_FAIL("falsche Op bei DetectiveRefresh"); - } + case SCDETOP_ADDSUCC: + aFunc.ShowSucc( nCol, nRow ); + break; + case SCDETOP_DELSUCC: + aFunc.DeleteSucc( nCol, nRow ); + break; + case SCDETOP_ADDPRED: + aFunc.ShowPred( nCol, nRow ); + break; + case SCDETOP_DELPRED: + aFunc.DeletePred( nCol, nRow ); + break; + case SCDETOP_ADDERROR: + aFunc.ShowError( nCol, nRow ); + break; + default: + OSL_FAIL("falsche Op bei DetectiveRefresh"); } } diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 93a1bd240409..f0b5d3a41241 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -345,9 +345,9 @@ void ScDocShell::AfterXMLLoading(bool bRet) size_t nDPCount = pDPCollection->GetCount(); for (size_t nDP=0; nDP<nDPCount; ++nDP) { - ScDPObject* pDPObj = (*pDPCollection)[nDP]; - if (pDPObj->GetName().isEmpty()) - pDPObj->SetName( pDPCollection->CreateNewName() ); + ScDPObject& rDPObj = (*pDPCollection)[nDP]; + if (rDPObj.GetName().isEmpty()) + rDPObj.SetName( pDPCollection->CreateNewName() ); } } } diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 8ef2a76112f9..9e245b6723be 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -437,13 +437,11 @@ void ScDocShell::RefreshPivotTables( const ScRange& rSource ) ScDBDocFunc aFunc(*this); for (size_t i = 0, n = pColl->GetCount(); i < n; ++i) { - ScDPObject* pOld = (*pColl)[i]; - if (!pOld) - continue; + ScDPObject& rOld = (*pColl)[i]; - const ScSheetSourceDesc* pSheetDesc = pOld->GetSheetDesc(); + const ScSheetSourceDesc* pSheetDesc = rOld.GetSheetDesc(); if (pSheetDesc && pSheetDesc->GetSourceRange().Intersects(rSource)) - aFunc.UpdatePivotTable(*pOld, true, false); + aFunc.UpdatePivotTable(rOld, true, false); } } diff --git a/sc/source/ui/inc/PivotLayoutDialog.hxx b/sc/source/ui/inc/PivotLayoutDialog.hxx index 765990615a98..2449d65b1047 100644 --- a/sc/source/ui/inc/PivotLayoutDialog.hxx +++ b/sc/source/ui/inc/PivotLayoutDialog.hxx @@ -128,7 +128,7 @@ public: ScItemValue* GetItem(SCCOL nColumn); bool IsDataElement(SCCOL nColumn); - ScDPLabelData* GetLabelData(SCCOL nColumn); + ScDPLabelData& GetLabelData(SCCOL nColumn); ScDPLabelDataVector& GetLabelDataVector() { return maPivotParameters.maLabelArray;} void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames); }; diff --git a/sc/source/ui/inc/areasave.hxx b/sc/source/ui/inc/areasave.hxx index 7448b7aa6560..6ea8b390a69a 100644 --- a/sc/source/ui/inc/areasave.hxx +++ b/sc/source/ui/inc/areasave.hxx @@ -64,8 +64,8 @@ public: // returns NULL if empty static ScAreaLinkSaveCollection* CreateFromDoc( const ScDocument* pDoc ); - ScAreaLinkSaver* operator[](size_t nIndex); - const ScAreaLinkSaver* operator[](size_t nIndex) const; + ScAreaLinkSaver& operator[](size_t nIndex); + const ScAreaLinkSaver& operator[](size_t nIndex) const; size_t size() const; void push_back(ScAreaLinkSaver* p); }; diff --git a/sc/source/ui/inc/rfindlst.hxx b/sc/source/ui/inc/rfindlst.hxx index 80aaecfbd4ee..1db0c3a51d0e 100644 --- a/sc/source/ui/inc/rfindlst.hxx +++ b/sc/source/ui/inc/rfindlst.hxx @@ -44,20 +44,20 @@ class ScRangeFindList sal_uInt16 nIndexColor; public: - ScRangeFindList(const OUString& rName); + ScRangeFindList(const OUString& rName); - sal_uLong Count() const { return maEntries.size(); } - ColorData Insert( const ScRangeFindData &rNew ); + sal_uLong Count() const { return maEntries.size(); } + ColorData Insert( const ScRangeFindData &rNew ); - ScRangeFindData* GetObject( sal_uLong nIndex ) { return &(maEntries[nIndex]); } + ScRangeFindData& GetObject( sal_uLong nIndex ) { return maEntries[nIndex]; } - void SetHidden( bool bSet ) { bHidden = bSet; } + void SetHidden( bool bSet ) { bHidden = bSet; } - const OUString& GetDocName() const { return aDocName; } - bool IsHidden() const { return bHidden; } + const OUString& GetDocName() const { return aDocName; } + bool IsHidden() const { return bHidden; } static ColorData GetColorName(const size_t nIndex); - ColorData FindColor(const ScRange& rRef, const size_t nIndex); + ColorData FindColor(const ScRange& rRef, const size_t nIndex); }; #endif diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 4c38e68a9948..579c08c6055a 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -190,8 +190,8 @@ const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties( sal_uInt16 nItemCount = pEntry->ItemCount(); for (sal_uInt16 nItemPos=0; nItemPos<nItemCount && !bHasData; ++nItemPos) { - SvLBoxItem* pItem = pEntry->GetItem( nItemPos ); - ScSolverOptionsString* pStringItem = dynamic_cast<ScSolverOptionsString*>(pItem); + SvLBoxItem& rItem = pEntry->GetItem( nItemPos ); + ScSolverOptionsString* pStringItem = dynamic_cast<ScSolverOptionsString*>(&rItem); if ( pStringItem ) { if ( pStringItem->IsDouble() ) @@ -313,8 +313,8 @@ void ScSolverOptionsDialog::EditOption() sal_uInt16 nItemCount = pEntry->ItemCount(); for (sal_uInt16 nPos=0; nPos<nItemCount; ++nPos) { - SvLBoxItem* pItem = pEntry->GetItem( nPos ); - ScSolverOptionsString* pStringItem = dynamic_cast<ScSolverOptionsString*>(pItem); + SvLBoxItem& rItem = pEntry->GetItem( nPos ); + ScSolverOptionsString* pStringItem = dynamic_cast<ScSolverOptionsString*>(&rItem); if ( pStringItem ) { if ( pStringItem->IsDouble() ) diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 571dfd63a8bb..c8d8a0fa184f 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -1680,8 +1680,8 @@ void ScContentTree::InitEntry(SvTreeListEntry* pEntry, { sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2" SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); - SvLBoxString* pCol = static_cast<SvLBoxString*>(pEntry->GetItem( nColToHilite )); - SvLBoxString* pStr = new SvLBoxString( pEntry, 0, pCol->GetText() ); + SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite )); + SvLBoxString* pStr = new SvLBoxString( pEntry, 0, rCol.GetText() ); pEntry->ReplaceItem( pStr, nColToHilite ); } diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index 2b82a92bb0d8..0a4b8af15792 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -161,11 +161,9 @@ void ScCalcOptionsDialog::SelectedDeviceChanged() mpFtMemory->SetText(OUString()); } - SvLBoxString* pBoxEntry = dynamic_cast<SvLBoxString*>(pEntry->GetItem(1)); - if (!pBoxEntry) - return; + SvLBoxString& rBoxEntry = dynamic_cast<SvLBoxString&>(pEntry->GetItem(1)); - OUString aDevice = pBoxEntry->GetText(); + OUString aDevice = rBoxEntry.GetText(); // use english string for configuration if(aDevice == maSoftware) aDevice = OPENCL_SOFTWARE_DEVICE_CONFIG_NAME; diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index d172fb911854..c2668e43cfa1 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -266,7 +266,7 @@ size_t ScTpUserLists::UpdateUserListBox() for ( size_t i=0; i<nCount; ++i ) { - aEntry = (*pUserLists)[i]->GetString(); + aEntry = (*pUserLists)[i].GetString(); OSL_ENSURE( !aEntry.isEmpty(), "Empty UserList-entry :-/" ); mpLbLists->InsertEntry( aEntry ); } @@ -280,15 +280,15 @@ void ScTpUserLists::UpdateEntries( size_t nList ) if ( nList < pUserLists->size() ) { - const ScUserListData* pList = (*pUserLists)[nList]; - std::size_t nSubCount = pList->GetSubCount(); + const ScUserListData& rList = (*pUserLists)[nList]; + std::size_t nSubCount = rList.GetSubCount(); OUString aEntryListStr; for ( size_t i=0; i<nSubCount; i++ ) { if ( i!=0 ) aEntryListStr += OUStringLiteral1<CR>(); - aEntryListStr += pList->GetSubStr(i); + aEntryListStr += rList.GetSubStr(i); } mpEdEntries->SetText(convertLineEnd(aEntryListStr, GetSystemLineEnd())); @@ -442,7 +442,7 @@ void ScTpUserLists::ModifyList( size_t nSelList, MakeListStr( theEntriesStr ); - (*pUserLists)[nSelList]->SetString( theEntriesStr ); + (*pUserLists)[nSelList].SetString( theEntriesStr ); } void ScTpUserLists::RemoveList( size_t nList ) diff --git a/sc/source/ui/undo/areasave.cxx b/sc/source/ui/undo/areasave.cxx index 23f5881e4228..1fba078c212b 100644 --- a/sc/source/ui/undo/areasave.cxx +++ b/sc/source/ui/undo/areasave.cxx @@ -109,7 +109,7 @@ bool ScAreaLinkSaveCollection::IsEqual( const ScDocument* pDoc ) const ::sfx2::SvBaseLink* pBase = *rLinks[i]; if (pBase->ISA(ScAreaLink)) { - if ( nPos >= size() || !(*this)[nPos]->IsEqual( *static_cast<ScAreaLink*>(pBase) ) ) + if ( nPos >= size() || !(*this)[nPos].IsEqual( *static_cast<ScAreaLink*>(pBase) ) ) return false; ++nPos; @@ -151,12 +151,12 @@ void ScAreaLinkSaveCollection::Restore( ScDocument* pDoc ) size_t nSaveCount = size(); for (size_t nPos=0; nPos<nSaveCount; ++nPos) { - ScAreaLinkSaver* pSaver = (*this)[nPos]; - ScAreaLink* pLink = lcl_FindLink( rLinks, *pSaver ); + ScAreaLinkSaver& rSaver = (*this)[nPos]; + ScAreaLink* pLink = lcl_FindLink( rLinks, rSaver ); if ( pLink ) - pSaver->WriteToLink( *pLink ); // restore output position + rSaver.WriteToLink( *pLink ); // restore output position else - pSaver->InsertNewLink( pDoc ); // re-insert deleted link + rSaver.InsertNewLink( pDoc ); // re-insert deleted link } } } @@ -187,14 +187,14 @@ ScAreaLinkSaveCollection* ScAreaLinkSaveCollection::CreateFromDoc( const ScDocum return pColl; } -ScAreaLinkSaver* ScAreaLinkSaveCollection::operator [](size_t nIndex) +ScAreaLinkSaver& ScAreaLinkSaveCollection::operator [](size_t nIndex) { - return &maData[nIndex]; + return maData[nIndex]; } -const ScAreaLinkSaver* ScAreaLinkSaveCollection::operator [](size_t nIndex) const +const ScAreaLinkSaver& ScAreaLinkSaveCollection::operator [](size_t nIndex) const { - return &maData[nIndex]; + return maData[nIndex]; } size_t ScAreaLinkSaveCollection::size() const diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx index bc4463e300e5..417a96e9f7d0 100644 --- a/sc/source/ui/unoobj/appluno.cxx +++ b/sc/source/ui/unoobj/appluno.cxx @@ -441,7 +441,7 @@ uno::Any SAL_CALL ScSpreadsheetSettings::getPropertyValue( const OUString& aProp OUString* pAry = aSeq.getArray(); for (size_t i=0; i<nCount; ++i) { - OUString aEntry((*pUserList)[i]->GetString()); + OUString aEntry((*pUserList)[i].GetString()); pAry[i] = aEntry; } aRet <<= aSeq; diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 44cb4d0bb51d..715cec1cacd5 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -241,10 +241,10 @@ static ScDPObject* lcl_GetDPObject( ScDocShell* pDocShell, SCTAB nTab, const OUS size_t nCount = pColl->GetCount(); for (size_t i=0; i<nCount; ++i) { - ScDPObject* pDPObj = (*pColl)[i]; - if ( pDPObj->GetOutRange().aStart.Tab() == nTab && - pDPObj->GetName() == rName ) - return pDPObj; + ScDPObject& rDPObj = (*pColl)[i]; + if ( rDPObj.GetOutRange().aStart.Tab() == nTab && + rDPObj.GetName() == rName ) + return &rDPObj; } } } @@ -321,12 +321,12 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nInd size_t nCount = pColl->GetCount(); for (size_t i=0; i<nCount; ++i) { - ScDPObject* pDPObj = (*pColl)[i]; - if ( pDPObj->GetOutRange().aStart.Tab() == nTab ) + ScDPObject& rDPObj = (*pColl)[i]; + if ( rDPObj.GetOutRange().aStart.Tab() == nTab ) { if ( nFound == nIndex ) { - OUString aName = pDPObj->GetName(); + OUString aName = rDPObj.GetName(); return new ScDataPilotTableObj( pDocShell, nTab, aName ); } ++nFound; @@ -471,8 +471,8 @@ sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(RuntimeException, std: size_t nCount = pColl->GetCount(); for (size_t i=0; i<nCount; ++i) { - ScDPObject* pDPObj = (*pColl)[i]; - if ( pDPObj->GetOutRange().aStart.Tab() == nTab ) + ScDPObject& rDPObj = (*pColl)[i]; + if ( rDPObj.GetOutRange().aStart.Tab() == nTab ) ++nFound; } return nFound; @@ -533,8 +533,8 @@ Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames() size_t i; for (i=0; i<nCount; ++i) { - ScDPObject* pDPObj = (*pColl)[i]; - if ( pDPObj->GetOutRange().aStart.Tab() == nTab ) + ScDPObject& rDPObj = (*pColl)[i]; + if ( rDPObj.GetOutRange().aStart.Tab() == nTab ) ++nFound; } @@ -543,9 +543,9 @@ Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames() OUString* pAry = aSeq.getArray(); for (i=0; i<nCount; ++i) { - ScDPObject* pDPObj = (*pColl)[i]; - if ( pDPObj->GetOutRange().aStart.Tab() == nTab ) - pAry[nPos++] = pDPObj->GetName(); + ScDPObject& rDPObj = (*pColl)[i]; + if ( rDPObj.GetOutRange().aStart.Tab() == nTab ) + pAry[nPos++] = rDPObj.GetName(); } return aSeq; @@ -567,9 +567,9 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName ) size_t nCount = pColl->GetCount(); for (size_t i=0; i<nCount; ++i) { - ScDPObject* pDPObj = (*pColl)[i]; - if ( pDPObj->GetOutRange().aStart.Tab() == nTab && - pDPObj->GetName() == aName ) + ScDPObject& rDPObj = (*pColl)[i]; + if ( rDPObj.GetOutRange().aStart.Tab() == nTab && + rDPObj.GetName() == aName ) return true; } } @@ -2395,15 +2395,13 @@ DataPilotFieldGroupInfo ScDataPilotFieldObj::getGroupInfo() ScFieldGroups aGroups; for( sal_Int32 nIdx = 0, nCount = pGroupDim->GetGroupCount(); nIdx < nCount; ++nIdx ) { - if( const ScDPSaveGroupItem* pGroup = pGroupDim->GetGroupByIndex( nIdx ) ) - { - ScFieldGroup aGroup; - aGroup.maName = pGroup->GetGroupName(); - for( sal_Int32 nMemIdx = 0, nMemCount = pGroup->GetElementCount(); nMemIdx < nMemCount; ++nMemIdx ) - if (const OUString* pMem = pGroup->GetElementByIndex(nMemIdx)) - aGroup.maMembers.push_back( *pMem ); - aGroups.push_back( aGroup ); - } + const ScDPSaveGroupItem& rGroup = pGroupDim->GetGroupByIndex( nIdx ); + ScFieldGroup aGroup; + aGroup.maName = rGroup.GetGroupName(); + for( sal_Int32 nMemIdx = 0, nMemCount = rGroup.GetElementCount(); nMemIdx < nMemCount; ++nMemIdx ) + if (const OUString* pMem = rGroup.GetElementByIndex(nMemIdx)) + aGroup.maMembers.push_back( *pMem ); + aGroups.push_back( aGroup ); } aInfo.Groups = new ScDataPilotFieldGroupsObj( aGroups ); } @@ -2611,13 +2609,13 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons long nGroupCount = pBaseGroupDim->GetGroupCount(); for ( long nGroup = 0; nGroup < nGroupCount; nGroup++ ) { - const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup ); + const ScDPSaveGroupItem& rBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup ); - if (!HasString(rItems, pBaseGroup->GetGroupName())) //! ignore case? + if (!HasString(rItems, rBaseGroup.GetGroupName())) //! ignore case? { // add an additional group for each item that is not in the selection - ScDPSaveGroupItem aGroup( pBaseGroup->GetGroupName() ); - aGroup.AddElementsFromGroup( *pBaseGroup ); + ScDPSaveGroupItem aGroup( rBaseGroup.GetGroupName() ); + aGroup.AddElementsFromGroup( rBaseGroup ); pGroupDimension->AddGroupItem( aGroup ); } } diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index bcb4c3546b0b..e80cdc9d611a 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -1133,13 +1133,13 @@ void ScDBFunc::GroupDataPilot() long nGroupCount = pBaseGroupDim->GetGroupCount(); for ( long nGroup = 0; nGroup < nGroupCount; nGroup++ ) { - const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup ); + const ScDPSaveGroupItem& rBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup ); - if (!aEntries.count(pBaseGroup->GetGroupName())) + if (!aEntries.count(rBaseGroup.GetGroupName())) { // add an additional group for each item that is not in the selection - ScDPSaveGroupItem aGroup( pBaseGroup->GetGroupName() ); - aGroup.AddElementsFromGroup( *pBaseGroup ); + ScDPSaveGroupItem aGroup( rBaseGroup.GetGroupName() ); + aGroup.AddElementsFromGroup( rBaseGroup ); pGroupDimension->AddGroupItem( aGroup ); } } @@ -1677,19 +1677,16 @@ bool ScDBFunc::DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16 return false; } - const ScUserListData* pData = (*pUserList)[*pUserListId]; - if (pData) + const ScUserListData& rData = (*pUserList)[*pUserListId]; + sal_uInt16 n = rData.GetSubCount(); + for (sal_uInt16 i = 0; i < n; ++i) { - sal_uInt16 n = pData->GetSubCount(); - for (sal_uInt16 i = 0; i < n; ++i) - { - OUString aSub = pData->GetSubStr(i); - if (!aMemberSet.count(aSub)) - // This string doesn't exist in the member name set. Don't add this. - continue; + OUString aSub = rData.GetSubStr(i); + if (!aMemberSet.count(aSub)) + // This string doesn't exist in the member name set. Don't add this. + continue; - aSubStrs.insert(UserSortMap::value_type(aSub, nSubCount++)); - } + aSubStrs.insert(UserSortMap::value_type(aSub, nSubCount++)); } } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 38dc2951b059..5acc912fa2af 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4952,22 +4952,22 @@ bool ScGridWindow::HitRangeFinder( const Point& rMouse, RfCorner& rCorner, { // search backwards so that the last repainted frame is found --i; - ScRangeFindData* pData = pRangeFinder->GetObject(i); - if ( pData->aRef.In(aAddr) ) + ScRangeFindData& rData = pRangeFinder->GetObject(i); + if ( rData.aRef.In(aAddr) ) { if (pIndex) *pIndex = i; if (pAddX) - *pAddX = nPosX - pData->aRef.aStart.Col(); + *pAddX = nPosX - rData.aRef.aStart.Col(); if (pAddY) - *pAddY = nPosY - pData->aRef.aStart.Row(); + *pAddY = nPosY - rData.aRef.aStart.Row(); bFound = true; rCorner = NONE; - ScAddress aEnd = pData->aRef.aEnd; - ScAddress aStart = pData->aRef.aStart; + ScAddress aEnd = rData.aRef.aEnd; + ScAddress aStart = rData.aRef.aStart; if ( bCornerHorizontalLeft && bCornerVerticalUp && aAddr == aStart) @@ -5145,7 +5145,7 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp ) ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList(); if (!pRangeFinder || nRFIndex >= pRangeFinder->Count()) return; - ScRangeFindData* pData = pRangeFinder->GetObject( nRFIndex ); + ScRangeFindData& rData = pRangeFinder->GetObject( nRFIndex ); // Mauszeiger @@ -5203,7 +5203,7 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp ) SCsROW nPosY; pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); - ScRange aOld = pData->aRef; + ScRange aOld = rData.aRef; ScRange aNew = aOld; if ( bRFSize ) { diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index cd7d66d88830..18b04a60635c 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -487,8 +487,8 @@ void ScGridWindow::DPLaunchFieldPopupMenu( aUserSortNames.reserve(n); for (size_t i = 0; i < n; ++i) { - const ScUserListData* pData = (*pUserList)[i]; - aUserSortNames.push_back(pData->GetString()); + const ScUserListData& rData = (*pUserList)[i]; + aUserSortNames.push_back(rData.GetString()); } } diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 3523a620a56b..4357f52c46df 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -852,14 +852,14 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count(); for (sal_uInt16 i=0; i<nCount; i++) { - ScRangeFindData* pData = pRangeFinder->GetObject(i); + ScRangeFindData& rData = pRangeFinder->GetObject(i); - ScRange aRef = pData->aRef; + ScRange aRef = rData.aRef; aRef.Justify(); if ( aRef.aStart.Tab() >= nTab && aRef.aEnd.Tab() <= nTab ) aOutputData.DrawRefMark( aRef.aStart.Col(), aRef.aStart.Row(), aRef.aEnd.Col(), aRef.aEnd.Row(), - Color( pData->nColorData ), + Color( rData.nColorData ), true ); } } diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index ee300f42671f..3229f08d8446 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2100,13 +2100,13 @@ void ScTabView::PaintRangeFinder( long nNumber ) if (nNumber < 0) { for (sal_uInt16 i=0; i<nCount; i++) - PaintRangeFinderEntry(pRangeFinder->GetObject(i),nTab); + PaintRangeFinderEntry(&pRangeFinder->GetObject(i),nTab); } else { sal_uInt16 idx = nNumber; if (idx < nCount) - PaintRangeFinderEntry(pRangeFinder->GetObject(idx),nTab); + PaintRangeFinderEntry(&pRangeFinder->GetObject(idx),nTab); } } } diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 59b9d0f45df8..46493a4e7201 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -373,8 +373,8 @@ void SdPageObjsTLB::InitEntry(SvTreeListEntry* pEntry, { sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2" SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); - SvLBoxString* pCol = static_cast<SvLBoxString*>(pEntry->GetItem( nColToHilite )); - SvLBoxString* pStr = new SvLBoxString( pEntry, 0, pCol->GetText() ); + SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite )); + SvLBoxString* pStr = new SvLBoxString( pEntry, 0, rCol.GetText() ); pEntry->ReplaceItem( pStr, nColToHilite ); } diff --git a/svtools/source/contnr/simptabl.cxx b/svtools/source/contnr/simptabl.cxx index bdbac957da3e..dccfb017a79b 100644 --- a/svtools/source/contnr/simptabl.cxx +++ b/svtools/source/contnr/simptabl.cxx @@ -454,7 +454,7 @@ SvLBoxItem* SvSimpleTable::GetEntryAtPos( SvTreeListEntry* pEntry, sal_uInt16 nP if( nPos < nCount ) { - pItem = pEntry->GetItem( nPos); + pItem = &pEntry->GetItem( nPos); } } return pItem; diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index f4a1deebd2e2..f6aa81e1a842 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -225,13 +225,13 @@ void SvImpLBox::CalcCellFocusRect( SvTreeListEntry* pEntry, Rectangle& rRect ) { if ( nCurTabPos > FIRST_ENTRY_TAB ) { - SvLBoxItem* pItem = pCursor->GetItem( nCurTabPos ); - rRect.Left() = pView->GetTab( pCursor, pItem )->GetPos(); + SvLBoxItem& rItem = pCursor->GetItem( nCurTabPos ); + rRect.Left() = pView->GetTab( pCursor, &rItem )->GetPos(); } if (pCursor->ItemCount() > static_cast<size_t>(nCurTabPos+1)) { - SvLBoxItem* pNextItem = pCursor->GetItem( nCurTabPos + 1 ); - long nRight = pView->GetTab( pCursor, pNextItem )->GetPos() - 1; + SvLBoxItem& rNextItem = pCursor->GetItem( nCurTabPos + 1 ); + long nRight = pView->GetTab( pCursor, &rNextItem )->GetPos() - 1; if ( nRight < rRect.Right() ) rRect.Right() = nRight; } @@ -3259,7 +3259,7 @@ bool SvImpLBox::SetMostRight( SvTreeListEntry* pEntry ) nLastTab = nLastItem; SvLBoxTab* pTab = pView->aTabs[ nLastTab ]; - SvLBoxItem* pItem = pEntry->GetItem( nLastTab ); + SvLBoxItem& rItem = pEntry->GetItem( nLastTab ); long nTabPos = pView->GetTabPos( pEntry, pTab ); @@ -3270,7 +3270,7 @@ bool SvImpLBox::SetMostRight( SvTreeListEntry* pEntry ) long nNextTab = nTabPos < nMaxRight ? nMaxRight : nMaxRight + 50; long nTabWidth = nNextTab - nTabPos + 1; - long nItemSize = pItem->GetSize(pView,pEntry).Width(); + long nItemSize = rItem.GetSize(pView,pEntry).Width(); long nOffset = pTab->CalcOffset( nItemSize, nTabWidth ); long nRight = nTabPos + nOffset + nItemSize; diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index 562cf20258fc..034eb57be27a 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -263,19 +263,19 @@ OUString SvTabListBox::GetEntryText( SvTreeListEntry* pEntry, sal_uInt16 nCol ) sal_uInt16 nCur = 0; while( nCur < nCount ) { - const SvLBoxItem* pStr = pEntry->GetItem( nCur ); - if (pStr->GetType() == SV_ITEM_ID_LBOXSTRING) + const SvLBoxItem& rStr = pEntry->GetItem( nCur ); + if (rStr.GetType() == SV_ITEM_ID_LBOXSTRING) { if( nCol == 0xffff ) { if (!aResult.isEmpty()) aResult += "\t"; - aResult += static_cast<const SvLBoxString*>(pStr)->GetText(); + aResult += static_cast<const SvLBoxString&>(rStr).GetText(); } else { if( nCol == 0 ) - return static_cast<const SvLBoxString*>(pStr)->GetText(); + return static_cast<const SvLBoxString&>(rStr).GetText(); nCol--; } } @@ -312,13 +312,13 @@ void SvTabListBox::SetEntryText(const OUString& rStr, SvTreeListEntry* pEntry, s const sal_uInt16 nCount = pEntry->ItemCount(); for (sal_uInt16 nCur = 0; nCur < nCount; ++nCur) { - SvLBoxItem* pStr = pEntry->GetItem( nCur ); - if (pStr && pStr->GetType() == SV_ITEM_ID_LBOXSTRING) + SvLBoxItem& rBoxItem = pEntry->GetItem( nCur ); + if (rBoxItem.GetType() == SV_ITEM_ID_LBOXSTRING) { if (!nCol || nCol==0xFFFF) { const OUString aTemp(GetToken(rStr, nIndex)); - static_cast<SvLBoxString*>(pStr)->SetText( aTemp ); + static_cast<SvLBoxString&>(rBoxItem).SetText( aTemp ); if (!nCol && nIndex<0) break; } @@ -342,9 +342,9 @@ OUString SvTabListBox::GetCellText( sal_uLong nPos, sal_uInt16 nCol ) const OUString aResult; if (pEntry && pEntry->ItemCount() > static_cast<size_t>(nCol+1)) { - const SvLBoxItem* pStr = pEntry->GetItem( nCol + 1 ); - if (pStr && pStr->GetType() == SV_ITEM_ID_LBOXSTRING) - aResult = static_cast<const SvLBoxString*>(pStr)->GetText(); + const SvLBoxItem& rStr = pEntry->GetItem( nCol + 1 ); + if (rStr.GetType() == SV_ITEM_ID_LBOXSTRING) + aResult = static_cast<const SvLBoxString&>(rStr).GetText(); } return aResult; } @@ -400,20 +400,20 @@ OUString SvTabListBox::GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const sal_uInt16 nCur = ( 0 == nCol && IsCellFocusEnabled() ) ? GetCurrentTabPos() : 0; while( nCur < nCount ) { - const SvLBoxItem* pStr = pEntry->GetItem( nCur ); - if (pStr->GetType() == SV_ITEM_ID_LBOXSTRING) + const SvLBoxItem& rBoxItem = pEntry->GetItem( nCur ); + if (rBoxItem.GetType() == SV_ITEM_ID_LBOXSTRING) { if ( nCol == 0xffff ) { if (!aResult.isEmpty()) aResult += "\t"; - aResult += static_cast<const SvLBoxString*>(pStr)->GetText(); + aResult += static_cast<const SvLBoxString&>(rBoxItem).GetText(); } else { if ( nCol == 0 ) { - OUString sRet = static_cast<const SvLBoxString*>(pStr)->GetText(); + OUString sRet = static_cast<const SvLBoxString&>(rBoxItem).GetText(); if ( sRet.isEmpty() ) sRet = SVT_RESSTR( STR_SVT_ACC_EMPTY_FIELD ); return sRet; @@ -545,11 +545,11 @@ void SvHeaderTabListBox::InitHeaderBar( HeaderBar* pHeaderBar ) bool SvHeaderTabListBox::IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol ) { SvButtonState eState = SV_BUTTON_UNCHECKED; - SvLBoxButton* pItem = static_cast<SvLBoxButton*>( pEntry->GetItem( nCol + 1 ) ); + SvLBoxButton& rItem = static_cast<SvLBoxButton&>( pEntry->GetItem( nCol + 1 ) ); - if (pItem && pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) + if (rItem.GetType() == SV_ITEM_ID_LBOXBUTTON) { - SvItemStateFlags nButtonFlags = pItem->GetButtonFlags(); + SvItemStateFlags nButtonFlags = rItem.GetButtonFlags(); eState = SvLBoxButtonData::ConvertToButtonState( nButtonFlags ); } @@ -655,11 +655,11 @@ bool SvHeaderTabListBox::IsCellCheckBox( long _nRow, sal_uInt16 _nColumn, TriSta sal_uInt16 nItemCount = pEntry->ItemCount(); if ( nItemCount > ( _nColumn + 1 ) ) { - SvLBoxItem* pItem = pEntry->GetItem( _nColumn + 1 ); - if (pItem && pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) + SvLBoxItem& rItem = pEntry->GetItem( _nColumn + 1 ); + if (rItem.GetType() == SV_ITEM_ID_LBOXBUTTON) { bRet = true; - _rState = ( ( static_cast<SvLBoxButton*>(pItem)->GetButtonFlags() & SvItemStateFlags::UNCHECKED ) == SvItemStateFlags::NONE ) + _rState = ( ( static_cast<SvLBoxButton&>(rItem).GetButtonFlags() & SvItemStateFlags::UNCHECKED ) == SvItemStateFlags::NONE ) ? TRISTATE_TRUE : TRISTATE_FALSE; } } diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 6114df96723e..c3d531a6550e 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -349,8 +349,8 @@ const Size& SvLBoxItem::GetSize(const SvTreeListBox* pView, const SvTreeListEntr const Size& SvLBoxItem::GetSize(const SvViewDataEntry* pData, sal_uInt16 nItemPos) { - const SvViewDataItem* pIData = pData->GetItem(nItemPos); - return pIData->maSize; + const SvViewDataItem& rIData = pData->GetItem(nItemPos); + return rIData.maSize; } struct SvTreeListBoxImpl @@ -800,8 +800,8 @@ void SvTreeListBox::RecalcViewData() sal_uInt16 nCurPos = 0; while ( nCurPos < nCount ) { - SvLBoxItem* pItem = pEntry->GetItem( nCurPos ); - pItem->InitViewData( this, pEntry ); + SvLBoxItem& rItem = pEntry->GetItem( nCurPos ); + rItem.InitViewData( this, pEntry ); nCurPos++; } pEntry = Next( pEntry ); @@ -934,7 +934,7 @@ const SvViewDataItem* SvTreeListBox::GetViewDataItem(const SvTreeListEntry* pEnt const SvViewDataEntry* pEntryData = SvListView::GetViewData(pEntry); DBG_ASSERT(pEntryData,"Entry not in View"); sal_uInt16 nItemPos = pEntry->GetPos(pItem); - return pEntryData->GetItem(nItemPos); + return &pEntryData->GetItem(nItemPos); } SvViewDataEntry* SvTreeListBox::CreateViewData( SvTreeListEntry* ) @@ -953,10 +953,9 @@ void SvTreeListBox::InitViewData( SvViewDataEntry* pData, SvTreeListEntry* pEntr sal_uInt16 nCurPos = 0; while( nCurPos < nCount ) { - SvLBoxItem* pItem = pInhEntry->GetItem( nCurPos ); - SvViewDataItem* pItemData = pEntryData->GetItem(nCurPos); - pItem->InitViewData( this, pInhEntry, pItemData ); - pItemData++; + SvLBoxItem& rItem = pInhEntry->GetItem( nCurPos ); + SvViewDataItem& rItemData = pEntryData->GetItem(nCurPos); + rItem.InitViewData( this, pInhEntry, &rItemData ); nCurPos++; } } @@ -1479,9 +1478,9 @@ OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry ) while( nCur < nCount ) { // MT: SV_ITEM_ID_EXTENDRLBOXSTRING / GetExtendText() was in use in IA2 cws, but only used in sc: ScSolverOptionsString. Needed? - SvLBoxItem* pItem = pEntry->GetItem( nCur ); - if ( (pItem->GetType() == SV_ITEM_ID_LBOXSTRING ) && - !static_cast<SvLBoxString*>( pItem )->GetText().isEmpty() ) + SvLBoxItem& rItem = pEntry->GetItem( nCur ); + if ( (rItem.GetType() == SV_ITEM_ID_LBOXSTRING ) && + !static_cast<SvLBoxString&>( rItem ).GetText().isEmpty() ) { //want the column header if (!headString.isEmpty()) @@ -1513,11 +1512,11 @@ OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry ) } nHeaderCur++; } - sRet += static_cast<SvLBoxString*>( pItem )->GetText(); + sRet += static_cast<SvLBoxString&>( rItem ).GetText(); } else { - sRet += static_cast<SvLBoxString*>( pItem )->GetText(); + sRet += static_cast<SvLBoxString&>( rItem ).GetText(); sRet += ","; } //end want to the column header @@ -2658,8 +2657,8 @@ void SvTreeListBox::ModelHasEntryInvalidated( SvTreeListEntry* pEntry ) sal_uInt16 nCount = pEntry->ItemCount(); for( sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++ ) { - SvLBoxItem* pItem = pEntry->GetItem( nIdx ); - pItem->InitViewData( this, pEntry, 0 ); + SvLBoxItem& rItem = pEntry->GetItem( nIdx ); + rItem.InitViewData( this, pEntry, 0 ); } // repaint @@ -2725,16 +2724,16 @@ void SvTreeListBox::ImplEditEntry( SvTreeListEntry* pEntry ) long nTabPos, nNextTabPos = 0; for( sal_uInt16 i = 0 ; i < nCount ; i++ ) { - SvLBoxItem* pTmpItem = pEntry->GetItem( i ); - if (pTmpItem->GetType() != SV_ITEM_ID_LBOXSTRING) + SvLBoxItem& rTmpItem = pEntry->GetItem( i ); + if (rTmpItem.GetType() != SV_ITEM_ID_LBOXSTRING) continue; - SvLBoxTab* pTab = GetTab( pEntry, pTmpItem ); + SvLBoxTab* pTab = GetTab( pEntry, &rTmpItem ); nNextTabPos = -1; if( i < nCount - 1 ) { - SvLBoxItem* pNextItem = pEntry->GetItem( i + 1 ); - SvLBoxTab* pNextTab = GetTab( pEntry, pNextItem ); + SvLBoxItem& rNextItem = pEntry->GetItem( i + 1 ); + SvLBoxTab* pNextTab = GetTab( pEntry, &rNextItem ); nNextTabPos = pNextTab->GetPos(); } @@ -2743,7 +2742,7 @@ void SvTreeListBox::ImplEditEntry( SvTreeListEntry* pEntry ) nTabPos = pTab->GetPos(); if( !bIsMouseTriggered || (nClickX > nTabPos && (nNextTabPos == -1 || nClickX < nNextTabPos ) ) ) { - pItem = static_cast<SvLBoxString*>( pTmpItem ); + pItem = &static_cast<SvLBoxString&>( rTmpItem ); break; } } @@ -2924,7 +2923,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, long nLine, vcl::Render SvLBoxTab* pTab = aTabs[nCurTab]; sal_uInt16 nNextTab = nCurTab + 1; SvLBoxTab* pNextTab = nNextTab < nTabCount ? aTabs[nNextTab] : 0; - SvLBoxItem* pItem = nCurItem < nItemCount ? rEntry.GetItem(nCurItem) : 0; + SvLBoxItem* pItem = nCurItem < nItemCount ? &rEntry.GetItem(nCurItem) : 0; SvLBoxTabFlags nFlags = pTab->nFlags; Size aSize(SvLBoxItem::GetSize(pViewDataEntry, nCurItem)); @@ -3223,8 +3222,8 @@ Rectangle SvTreeListBox::GetFocusRect( SvTreeListEntry* pEntry, long nLine ) { if( pTab && nCurTab < pEntry->ItemCount() ) { - SvLBoxItem* pItem = pEntry->GetItem( nCurTab ); - aSize.Width() = pItem->GetSize( this, pEntry ).Width(); + SvLBoxItem& rItem = pEntry->GetItem( nCurTab ); + aSize.Width() = rItem.GetSize( this, pEntry ).Width(); if( !aSize.Width() ) aSize.Width() = 15; long nX = nTabPos; //GetTabPos( pEntry, pTab ); @@ -3305,7 +3304,7 @@ SvLBoxItem* SvTreeListBox::GetItem_Impl( SvTreeListEntry* pEntry, long nX, sal_uInt16 nTabCount = aTabs.size(); sal_uInt16 nItemCount = pEntry->ItemCount(); SvLBoxTab* pTab = aTabs.front(); - SvLBoxItem* pItem = pEntry->GetItem(0); + SvLBoxItem& rItem = pEntry->GetItem(0); sal_uInt16 nNextItem = 1; nX -= GetMapMode().GetOrigin().X(); long nRealWidth = pImp->GetOutputSize().Width(); @@ -3326,7 +3325,7 @@ SvLBoxItem* SvTreeListBox::GetItem_Impl( SvTreeListEntry* pEntry, long nX, nNextTabPos += 50; } - Size aItemSize( pItem->GetSize(this, pEntry)); + Size aItemSize( rItem.GetSize(this, pEntry)); nStart += pTab->CalcOffset( aItemSize.Width(), nNextTabPos - nStart ); long nLen = aItemSize.Width(); if( pNextTab ) @@ -3341,7 +3340,7 @@ SvLBoxItem* SvTreeListBox::GetItem_Impl( SvTreeListEntry* pEntry, long nX, if( nX >= nStart && nX < (nStart+nLen ) ) { - pItemClicked = pItem; + pItemClicked = &rItem; if( ppTab ) { *ppTab = pTab; @@ -3351,7 +3350,7 @@ SvLBoxItem* SvTreeListBox::GetItem_Impl( SvTreeListEntry* pEntry, long nX, if( nNextItem >= nItemCount || nNextItem >= nTabCount) break; pTab = aTabs[ nNextItem ]; - pItem = pEntry->GetItem( nNextItem ); + rItem = pEntry->GetItem( nNextItem ); nNextItem++; } return pItemClicked; @@ -3370,8 +3369,8 @@ long SvTreeListBox::getPreferredDimensions(std::vector<long> &rWidths) const rWidths.resize(nCount); while (nCurPos < nCount) { - SvLBoxItem* pItem = pEntry->GetItem( nCurPos ); - long nWidth = pItem->GetSize(this, pEntry).Width(); + SvLBoxItem& rItem = pEntry->GetItem( nCurPos ); + long nWidth = rItem.GetSize(this, pEntry).Width(); if (nWidth) { nWidth += SV_TAB_BORDER * 2; diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx index a80752cdd1ed..a78b3632f455 100644 --- a/svtools/source/contnr/treelistentry.cxx +++ b/svtools/source/contnr/treelistentry.cxx @@ -158,14 +158,14 @@ void SvTreeListEntry::ReplaceItem( SvLBoxItem* pNewItem, size_t nPos ) maItems.insert(maItems.begin()+nPos, pNewItem); } -const SvLBoxItem* SvTreeListEntry::GetItem( size_t nPos ) const +const SvLBoxItem& SvTreeListEntry::GetItem( size_t nPos ) const { - return &maItems[nPos]; + return maItems[nPos]; } -SvLBoxItem* SvTreeListEntry::GetItem( size_t nPos ) +SvLBoxItem& SvTreeListEntry::GetItem( size_t nPos ) { - return &maItems[nPos]; + return maItems[nPos]; } namespace { diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx index 98c0035b982f..f7fe1e1abff4 100644 --- a/svtools/source/contnr/viewdataentry.cxx +++ b/svtools/source/contnr/viewdataentry.cxx @@ -81,14 +81,14 @@ void SvViewDataEntry::Init(size_t nSize) maItems.resize(nSize); } -const SvViewDataItem* SvViewDataEntry::GetItem(size_t nPos) const +const SvViewDataItem& SvViewDataEntry::GetItem(size_t nPos) const { - return &maItems[nPos]; + return maItems[nPos]; } -SvViewDataItem* SvViewDataEntry::GetItem(size_t nPos) +SvViewDataItem& SvViewDataEntry::GetItem(size_t nPos) { - return &maItems[nPos]; + return maItems[nPos]; } void SvViewDataEntry::SetPaintRectangle(Rectangle aRectangle) diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index 864cc56f5469..6ec90e45713a 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -275,7 +275,7 @@ bool TreeControlPeer::updateEntry( UnoTreeListEntry* pEntry ) if( pEntry && pEntry->mxNode.is() && mpTreeImpl ) { const OUString aValue( getEntryString( pEntry->mxNode->getDisplayValue() ) ); - UnoTreeListItem* pUnoItem = dynamic_cast< UnoTreeListItem* >( pEntry->GetItem( 1 ) ); + UnoTreeListItem* pUnoItem = dynamic_cast< UnoTreeListItem* >( &pEntry->GetItem( 1 ) ); if( pUnoItem ) { if( aValue != pUnoItem->GetText() ) @@ -303,7 +303,7 @@ bool TreeControlPeer::updateEntry( UnoTreeListEntry* pEntry ) bChanged = true; } - ImplContextGraphicItem* pContextGraphicItem = dynamic_cast< ImplContextGraphicItem* >( pEntry->GetItem( 0 ) ); + ImplContextGraphicItem* pContextGraphicItem = dynamic_cast< ImplContextGraphicItem* >( &pEntry->GetItem( 0 ) ); if( pContextGraphicItem ) { if( pContextGraphicItem->msExpandedGraphicURL != pEntry->mxNode->getExpandedGraphicURL() ) @@ -719,7 +719,7 @@ void SAL_CALL TreeControlPeer::setDefaultExpandedGraphicURL( const OUString& sDe SvTreeListEntry* pEntry = rTree.First(); while( pEntry ) { - ImplContextGraphicItem* pContextGraphicItem = dynamic_cast< ImplContextGraphicItem* >( pEntry->GetItem( 0 ) ); + ImplContextGraphicItem* pContextGraphicItem = dynamic_cast< ImplContextGraphicItem* >( &pEntry->GetItem( 0 ) ); if( pContextGraphicItem ) { if( pContextGraphicItem->msExpandedGraphicURL.isEmpty() ) @@ -757,7 +757,7 @@ void SAL_CALL TreeControlPeer::setDefaultCollapsedGraphicURL( const OUString& sD SvTreeListEntry* pEntry = rTree.First(); while( pEntry ) { - ImplContextGraphicItem* pContextGraphicItem = dynamic_cast< ImplContextGraphicItem* >( pEntry->GetItem( 0 ) ); + ImplContextGraphicItem* pContextGraphicItem = dynamic_cast< ImplContextGraphicItem* >( &pEntry->GetItem( 0 ) ); if( pContextGraphicItem ) { if( pContextGraphicItem->msCollapsedGraphicURL.isEmpty() ) diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index ab68137adf47..7b9d2fea288a 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -847,8 +847,8 @@ void RecovDocList::InitEntry(SvTreeListEntry* pEntry, SvTabListBox::InitEntry(pEntry, rText, rImage1, rImage2, eButtonKind); DBG_ASSERT( TabCount() == 2, "*RecovDocList::InitEntry(): structure missmatch" ); - SvLBoxString* pCol = static_cast<SvLBoxString*>(pEntry->GetItem(2)); - RecovDocListEntry* p = new RecovDocListEntry(pEntry, 0, pCol->GetText()); + SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem(2)); + RecovDocListEntry* p = new RecovDocListEntry(pEntry, 0, rCol.GetText()); pEntry->ReplaceItem(p, 2); } diff --git a/svx/source/inc/svdobjuserdatalist.hxx b/svx/source/inc/svdobjuserdatalist.hxx index b13b640fa310..e40e4b9908e5 100644 --- a/svx/source/inc/svdobjuserdatalist.hxx +++ b/svx/source/inc/svdobjuserdatalist.hxx @@ -26,7 +26,7 @@ public: ~SdrObjUserDataList(); size_t GetUserDataCount() const; - SdrObjUserData* GetUserData(size_t nNum); + SdrObjUserData& GetUserData(size_t nNum); void AppendUserData(SdrObjUserData* pData); void DeleteUserData(size_t nNum); }; diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 9bf94f7fe8eb..d00a5036a457 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -2765,7 +2765,7 @@ sal_uInt16 SdrObject::GetUserDataCount() const SdrObjUserData* SdrObject::GetUserData(sal_uInt16 nNum) const { if (pPlusData==NULL || pPlusData->pUserDataList==NULL) return NULL; - return pPlusData->pUserDataList->GetUserData(nNum); + return &pPlusData->pUserDataList->GetUserData(nNum); } void SdrObject::AppendUserData(SdrObjUserData* pData) diff --git a/svx/source/svdraw/svdobjplusdata.cxx b/svx/source/svdraw/svdobjplusdata.cxx index e9d069600aee..6fbc5cf8ec22 100644 --- a/svx/source/svdraw/svdobjplusdata.cxx +++ b/svx/source/svdraw/svdobjplusdata.cxx @@ -36,7 +36,7 @@ SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const if (nCount!=0) { pNeuPlusData->pUserDataList=new SdrObjUserDataList; for (sal_uInt16 i=0; i<nCount; i++) { - SdrObjUserData* pNeuUserData=pUserDataList->GetUserData(i)->Clone(pObj1); + SdrObjUserData* pNeuUserData=pUserDataList->GetUserData(i).Clone(pObj1); if (pNeuUserData!=NULL) { pNeuPlusData->pUserDataList->AppendUserData(pNeuUserData); } else { diff --git a/svx/source/svdraw/svdobjuserdatalist.cxx b/svx/source/svdraw/svdobjuserdatalist.cxx index c7d24ddb8a58..59d727fef4c1 100644 --- a/svx/source/svdraw/svdobjuserdatalist.cxx +++ b/svx/source/svdraw/svdobjuserdatalist.cxx @@ -17,9 +17,9 @@ size_t SdrObjUserDataList::GetUserDataCount() const return maList.size(); } -SdrObjUserData* SdrObjUserDataList::GetUserData(size_t nNum) +SdrObjUserData& SdrObjUserDataList::GetUserData(size_t nNum) { - return &maList.at(nNum); + return maList.at(nNum); } void SdrObjUserDataList::AppendUserData(SdrObjUserData* pData) diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx index 6993716536d7..38b007fa8dc0 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx @@ -334,7 +334,7 @@ SvLBoxItem* DictionaryList::getItemAtColumn( SvTreeListEntry* pEntry, sal_uInt16 if( nTreeFlags & SvTreeFlags::CHKBTN ) nColumn++; if( nColumn < nCount ) - pItem = pEntry->GetItem( nColumn ); + pItem = &pEntry->GetItem( nColumn ); } return pItem; } diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx index e438ed0a76a7..21d7dc754d7d 100644 --- a/sw/inc/SidebarWin.hxx +++ b/sw/inc/SidebarWin.hxx @@ -80,7 +80,7 @@ class SwSidebarWin : public vcl::Window void CheckMetaText(); inline Point GetAnchorPos() { return mAnchorRect.Pos(); } - SwEditWin* EditWin(); + SwEditWin& EditWin(); inline OutlinerView* GetOutlinerView() { return mpOutlinerView;} bool HasScrollbar() const; diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index d76c0cc26664..963b8b917962 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -204,9 +204,9 @@ public: /// returns Doc. But be careful! inline SwDoc* GetDoc() { return m_pDoc; } inline const SwDoc* GetDoc() const { return m_pDoc; } - IDocumentDeviceAccess* getIDocumentDeviceAccess(); - const IDocumentSettingAccess* getIDocumentSettingAccess() const; - IDocumentChartDataProviderAccess* getIDocumentChartDataProviderAccess(); + IDocumentDeviceAccess& getIDocumentDeviceAccess(); + const IDocumentSettingAccess& getIDocumentSettingAccess() const; + IDocumentChartDataProviderAccess& getIDocumentChartDataProviderAccess(); void UpdateFontList(); void UpdateChildWindows(); diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index 83bdf16b8932..68a01bd1e281 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -126,24 +126,24 @@ public: SwDoc *GetDoc() { return m_aSet.GetDoc(); } /// Provides access to the document settings interface. - const IDocumentSettingAccess* getIDocumentSettingAccess() const; + const IDocumentSettingAccess& getIDocumentSettingAccess() const; /// Provides access to the document draw model interface. - const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const; - IDocumentDrawModelAccess* getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& getIDocumentDrawModelAccess() const; + IDocumentDrawModelAccess& getIDocumentDrawModelAccess(); /// Provides access to the document layout interface. - const IDocumentLayoutAccess* getIDocumentLayoutAccess() const; - IDocumentLayoutAccess* getIDocumentLayoutAccess(); + const IDocumentLayoutAccess& getIDocumentLayoutAccess() const; + IDocumentLayoutAccess& getIDocumentLayoutAccess(); /// Provides access to the document idle timer interface. - IDocumentTimerAccess* getIDocumentTimerAccess(); + IDocumentTimerAccess& getIDocumentTimerAccess(); /// Provides access to the document idle timer interface. - IDocumentFieldsAccess* getIDocumentFieldsAccess(); + IDocumentFieldsAccess& getIDocumentFieldsAccess(); /// Gives access to the chart data-provider. - IDocumentChartDataProviderAccess* getIDocumentChartDataProviderAccess(); + IDocumentChartDataProviderAccess& getIDocumentChartDataProviderAccess(); /// Get and set Pool style IDs. sal_uInt16 GetPoolFormatId() const { return m_nPoolFormatId; } diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index bc8f8d090a31..415483558a8d 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -210,7 +210,7 @@ public: /** Provides access to the document device interface */ - const IDocumentDeviceAccess* getIDocumentDeviceAccess() const; + const IDocumentDeviceAccess& getIDocumentDeviceAccess() const; /** Provides access to the document bookmark interface */ @@ -218,34 +218,34 @@ public: /** Provides access to the document redline interface */ - const IDocumentRedlineAccess* getIDocumentRedlineAccess() const; + const IDocumentRedlineAccess& getIDocumentRedlineAccess() const; /** Provides access to the document style pool interface */ - const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const; + const IDocumentStylePoolAccess& getIDocumentStylePoolAccess() const; /** Provides access to the document draw model interface */ - const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const; + const IDocumentDrawModelAccess& getIDocumentDrawModelAccess() const; /** Provides access to the document layout interface */ - const IDocumentLayoutAccess* getIDocumentLayoutAccess() const; - IDocumentLayoutAccess* getIDocumentLayoutAccess(); + const IDocumentLayoutAccess& getIDocumentLayoutAccess() const; + IDocumentLayoutAccess& getIDocumentLayoutAccess(); /** Provides access to the document links administration interface */ - const IDocumentLinksAdministration* getIDocumentLinksAdministration() const; - IDocumentLinksAdministration* getIDocumentLinksAdministration(); + const IDocumentLinksAdministration& getIDocumentLinksAdministration() const; + IDocumentLinksAdministration& getIDocumentLinksAdministration(); /** Provides access to the document fields administration interface */ - const IDocumentFieldsAccess* getIDocumentFieldsAccess() const; - IDocumentFieldsAccess* getIDocumentFieldsAccess(); + const IDocumentFieldsAccess& getIDocumentFieldsAccess() const; + IDocumentFieldsAccess& getIDocumentFieldsAccess(); /** Provides access to the document content operations interface */ - IDocumentContentOperations* getIDocumentContentOperations(); + IDocumentContentOperations& getIDocumentContentOperations(); /** Provides access to the document automatic styles interface */ diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index da2622d60241..d267b95a6698 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -387,11 +387,11 @@ protected: virtual sal_uLong WriteStream() = 0; void SetBaseURL( const OUString& rURL ) { sBaseURL = rURL; } - IDocumentSettingAccess* getIDocumentSettingAccess(); - const IDocumentSettingAccess* getIDocumentSettingAccess() const; + IDocumentSettingAccess& getIDocumentSettingAccess(); + const IDocumentSettingAccess& getIDocumentSettingAccess() const; - IDocumentStylePoolAccess* getIDocumentStylePoolAccess(); - const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const; + IDocumentStylePoolAccess& getIDocumentStylePoolAccess(); + const IDocumentStylePoolAccess& getIDocumentStylePoolAccess() const; public: SwDoc* pDoc; diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx index 810be4dce8a1..8b600dc9270a 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -273,8 +273,8 @@ public: virtual const SwDoc* GetDoc() const SAL_OVERRIDE; virtual SwDoc* GetDoc() SAL_OVERRIDE; - const SwUnoCrsr* GetCrsr() const; - SwUnoCrsr* GetCrsr(); + const SwUnoCrsr& GetCrsr() const; + SwUnoCrsr& GetCrsr(); sw::UnoCursorPointer m_pUnoCrsr; SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); } virtual ~SwXTextTableCursor() { }; diff --git a/sw/inc/unotextcursor.hxx b/sw/inc/unotextcursor.hxx index b54bca4cecd4..ef20abd046c6 100644 --- a/sw/inc/unotextcursor.hxx +++ b/sw/inc/unotextcursor.hxx @@ -91,7 +91,7 @@ public: SwPaM const& rSourceCursor, const enum CursorType eType = CURSOR_ALL); - SwUnoCrsr* GetCursor(); + SwUnoCrsr& GetCursor(); bool IsAtEndOfMeta() const; void DeleteAndInsert(OUString const& rText, diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx index 19f6ae3beeb7..552ac6b14806 100644 --- a/sw/inc/unotextrange.hxx +++ b/sw/inc/unotextrange.hxx @@ -116,8 +116,8 @@ public: // only for RANGE_IS_TABLE SwXTextRange(SwFrameFormat& rTableFormat); - const SwDoc* GetDoc() const; - SwDoc* GetDoc(); + const SwDoc& GetDoc() const; + SwDoc& GetDoc(); bool GetPositions(SwPaM & rToFill) const; static ::com::sun::star::uno::Reference< diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 9e77272d5a0e..b17c3a9fd685 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -294,13 +294,13 @@ public: /** Provides access to the document setting interface */ - const IDocumentSettingAccess* getIDocumentSettingAccess() const; - IDocumentSettingAccess* getIDocumentSettingAccess(); + const IDocumentSettingAccess& getIDocumentSettingAccess() const; + IDocumentSettingAccess& getIDocumentSettingAccess(); /** Provides access to the document device interface */ - const IDocumentDeviceAccess* getIDocumentDeviceAccess() const; - IDocumentDeviceAccess* getIDocumentDeviceAccess(); + const IDocumentDeviceAccess& getIDocumentDeviceAccess() const; + IDocumentDeviceAccess& getIDocumentDeviceAccess(); /** Provides access to the document bookmark interface */ @@ -309,30 +309,30 @@ public: /** Provides access to the document draw model interface */ - const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const; - IDocumentDrawModelAccess* getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& getIDocumentDrawModelAccess() const; + IDocumentDrawModelAccess& getIDocumentDrawModelAccess(); /** Provides access to the document redline interface */ - const IDocumentRedlineAccess* getIDocumentRedlineAccess() const; - IDocumentRedlineAccess* getIDocumentRedlineAccess(); + const IDocumentRedlineAccess& getIDocumentRedlineAccess() const; + IDocumentRedlineAccess& getIDocumentRedlineAccess(); /** Provides access to the document layout interface */ - const IDocumentLayoutAccess* getIDocumentLayoutAccess() const; - IDocumentLayoutAccess* getIDocumentLayoutAccess(); + const IDocumentLayoutAccess& getIDocumentLayoutAccess() const; + IDocumentLayoutAccess& getIDocumentLayoutAccess(); /** Provides access to the content operations interface */ - IDocumentContentOperations* getIDocumentContentOperations(); + IDocumentContentOperations& getIDocumentContentOperations(); /** Provides access to the document style pool interface */ - IDocumentStylePoolAccess* getIDocumentStylePoolAccess(); + IDocumentStylePoolAccess& getIDocumentStylePoolAccess(); /** Provides access to the document statistics interface */ - const IDocumentStatistics* getIDocumentStatistics() const; + const IDocumentStatistics& getIDocumentStatistics() const; /** Provides access to the document undo/redo interface */ diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index c92cb80d5d4e..e6822921648e 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -243,7 +243,7 @@ public: maInfo.SetViewForwarder( pMap ); uno::Reference < document::XEventBroadcaster > xModelBroadcaster = new SwDrawModellListener_Impl( - pMap->GetShell()->getIDocumentDrawModelAccess()->GetOrCreateDrawModel() ); + pMap->GetShell()->getIDocumentDrawModelAccess().GetOrCreateDrawModel() ); maInfo.SetModelBroadcaster( xModelBroadcaster ); } diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx index 405f4228f327..cbe8d70160ab 100644 --- a/sw/source/core/access/parachangetrackinginfo.cxx +++ b/sw/source/core/access/parachangetrackinginfo.cxx @@ -47,22 +47,17 @@ namespace { } const SwTextNode& rTextNode( *(rTextFrm.GetTextNode()) ); - const IDocumentRedlineAccess* pIDocChangeTrack( rTextNode.getIDocumentRedlineAccess() ); - if ( !pIDocChangeTrack ) - { - OSL_FAIL( "<initChangeTrackTextMarkupLists(..) - missing <IDocumentRedlineAccess> instance!" ); - return; - } + const IDocumentRedlineAccess& rIDocChangeTrack( rTextNode.getIDocumentRedlineAccess() ); - if ( !IDocumentRedlineAccess::IsShowChanges( pIDocChangeTrack->GetRedlineMode() ) || - pIDocChangeTrack->GetRedlineTable().empty() ) + if ( !IDocumentRedlineAccess::IsShowChanges( rIDocChangeTrack.GetRedlineMode() ) || + rIDocChangeTrack.GetRedlineTable().empty() ) { // nothing to do --> empty change track text markup lists. return; } const sal_uInt16 nIdxOfFirstRedlineForTextNode = - pIDocChangeTrack->GetRedlinePos( rTextNode, USHRT_MAX ); + rIDocChangeTrack.GetRedlinePos( rTextNode, USHRT_MAX ); if ( nIdxOfFirstRedlineForTextNode == USHRT_MAX ) { // nothing to do --> empty change track text markup lists. @@ -77,7 +72,7 @@ namespace { : rTextFrm.GetText().getLength(); // iteration over the redlines which overlap with the text node. - const SwRedlineTable& rRedlineTable = pIDocChangeTrack->GetRedlineTable(); + const SwRedlineTable& rRedlineTable = rIDocChangeTrack.GetRedlineTable(); const sal_uInt16 nRedlineCount( rRedlineTable.size() ); for ( sal_uInt16 nActRedline = nIdxOfFirstRedlineForTextNode; nActRedline < nRedlineCount; diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 934045bba438..ab6a5a5d5103 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -780,14 +780,14 @@ bool SwFormat::IsBackgroundTransparent() const /* * Document Interface Access */ -const IDocumentSettingAccess* SwFormat::getIDocumentSettingAccess() const { return & GetDoc()->GetDocumentSettingManager(); } -const IDocumentDrawModelAccess* SwFormat::getIDocumentDrawModelAccess() const { return & GetDoc()->getIDocumentDrawModelAccess(); } -IDocumentDrawModelAccess* SwFormat::getIDocumentDrawModelAccess() { return & GetDoc()->getIDocumentDrawModelAccess(); } -const IDocumentLayoutAccess* SwFormat::getIDocumentLayoutAccess() const { return &GetDoc()->getIDocumentLayoutAccess(); } -IDocumentLayoutAccess* SwFormat::getIDocumentLayoutAccess() { return &GetDoc()->getIDocumentLayoutAccess(); } -IDocumentTimerAccess* SwFormat::getIDocumentTimerAccess() { return & GetDoc()->getIDocumentTimerAccess(); } -IDocumentFieldsAccess* SwFormat::getIDocumentFieldsAccess() { return &GetDoc()->getIDocumentFieldsAccess(); } -IDocumentChartDataProviderAccess* SwFormat::getIDocumentChartDataProviderAccess() { return & GetDoc()->getIDocumentChartDataProviderAccess(); } +const IDocumentSettingAccess& SwFormat::getIDocumentSettingAccess() const { return GetDoc()->GetDocumentSettingManager(); } +const IDocumentDrawModelAccess& SwFormat::getIDocumentDrawModelAccess() const { return GetDoc()->getIDocumentDrawModelAccess(); } +IDocumentDrawModelAccess& SwFormat::getIDocumentDrawModelAccess() { return GetDoc()->getIDocumentDrawModelAccess(); } +const IDocumentLayoutAccess& SwFormat::getIDocumentLayoutAccess() const { return GetDoc()->getIDocumentLayoutAccess(); } +IDocumentLayoutAccess& SwFormat::getIDocumentLayoutAccess() { return GetDoc()->getIDocumentLayoutAccess(); } +IDocumentTimerAccess& SwFormat::getIDocumentTimerAccess() { return GetDoc()->getIDocumentTimerAccess(); } +IDocumentFieldsAccess& SwFormat::getIDocumentFieldsAccess() { return GetDoc()->getIDocumentFieldsAccess(); } +IDocumentChartDataProviderAccess& SwFormat::getIDocumentChartDataProviderAccess() { return GetDoc()->getIDocumentChartDataProviderAccess(); } void SwFormat::GetGrabBagItem(uno::Any& rVal) const { diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index 0fa19ecea2b0..3fa891436a16 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -130,7 +130,7 @@ bool SwCrsrShell::GotoMark(const ::sw::mark::IMark* const pMark) bool SwCrsrShell::GoNextBookmark() { - IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess(); + IDocumentMarkAccess* pMarkAccess = getIDocumentMarkAccess(); IDocumentMarkAccess::container_t vCandidates; remove_copy_if( upper_bound( // finds the first that is starting after @@ -163,7 +163,7 @@ bool SwCrsrShell::GoNextBookmark() bool SwCrsrShell::GoPrevBookmark() { - IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess(); + IDocumentMarkAccess* pMarkAccess = getIDocumentMarkAccess(); // candidates from which to choose the mark before // no need to consider marks starting after rPos IDocumentMarkAccess::container_t vCandidates; @@ -208,7 +208,7 @@ bool SwCrsrShell::GoPrevBookmark() bool SwCrsrShell::IsFormProtected() { - return getIDocumentSettingAccess()->get(DocumentSettingId::PROTECT_FORM); + return getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM); } ::sw::mark::IFieldmark* SwCrsrShell::GetCurrentFieldmark() diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 3e92ce5ef4e5..44805c67e402 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -733,7 +733,7 @@ void SwShellTableCrsr::FillRects() bool bStart = true; SwRegionRects aReg( GetShell()->VisArea() ); if (GetShell()->isTiledRendering()) - aReg = GetShell()->getIDocumentLayoutAccess()->GetCurrentLayout()->Frm(); + aReg = GetShell()->getIDocumentLayoutAccess().GetCurrentLayout()->Frm(); SwNodes& rNds = GetDoc()->GetNodes(); SwFrm* pEndFrm = 0; for (size_t n = 0; n < m_SelectedBoxes.size(); ++n) diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 85dd7b2d102f..deb4e747cf97 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -488,7 +488,7 @@ _ZSortFly::_ZSortFly( const SwFrameFormat* pFrameFormat, const SwFormatAnchor* p // FlyFrames an alternative method is used now in that case. if( RES_FLYFRMFMT == pFormat->Which() ) { - if( pFormat->getIDocumentLayoutAccess()->GetCurrentViewShell() ) + if( pFormat->getIDocumentLayoutAccess().GetCurrentViewShell() ) { // See if there is an SdrObject for it SwFlyFrm* pFly = SwIterator<SwFlyFrm,SwFormat>( *pFrameFormat ).First(); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index f3ff0cd14071..1b5381bd61f3 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -839,7 +839,7 @@ void SwNoTextFrm::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfArea SwGrfNode* pGrfNd = rNoTNd.GetGrfNode(); SwOLENode* pOLENd = rNoTNd.GetOLENode(); - const bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) || + const bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess().getPrinter( false ) || pOut->GetConnectMetaFile(); const bool bIsChart = pOLENd && pOLENd->GetOLEObj().GetObject().IsChart(); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 089890d63479..4d938a90e4ca 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -3426,7 +3426,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, bool bChgLRSpace = true; if( bBigger ) { - if( GetFrameFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) && + if( GetFrameFormat()->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) && !rSz.GetWidthPercent() ) { bRet = rSz.GetWidth() < USHRT_MAX - nRelDiff; @@ -3537,7 +3537,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, // If the Table happens to contain relative values (USHORT_MAX), // we need to convert them to absolute ones now. // Bug 61494 - if( GetFrameFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) && + if( GetFrameFormat()->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) && !rSz.GetWidthPercent() ) { SwTabFrm* pTabFrm = SwIterator<SwTabFrm,SwFormat>( *GetFrameFormat() ).First(); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 863295462531..2ec5f3dc12e8 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -117,7 +117,7 @@ static void lcl_SetDfltBoxAttr( SwFrameFormat& rFormat, sal_uInt8 nId ) case 3: bBottom = bLeft = bRight = true; break; } - const bool bHTML = rFormat.getIDocumentSettingAccess()->get(DocumentSettingId::HTML_MODE); + const bool bHTML = rFormat.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE); Color aCol( bHTML ? COL_GRAY : COL_BLACK ); SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 ); if ( bHTML ) @@ -3421,7 +3421,7 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, bool bAfter, /* From the back (bottom right) to the front (top left) deregister all Boxes from the Chart Data Provider. The Modify event is triggered in the calling function. TL_CHART2: */ - SwChartDataProvider *pPCD = rTable.GetFrameFormat()->getIDocumentChartDataProviderAccess()->GetChartDataProvider(); + SwChartDataProvider *pPCD = rTable.GetFrameFormat()->getIDocumentChartDataProviderAccess().GetChartDataProvider(); if( pPCD ) { for (SwTableLines::size_type k = nLinePos; k < rTable.GetTabLines().size(); ++k) diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index c7765128011b..b8382bbf319b 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -2002,17 +2002,17 @@ drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwContentNode::getSdrAllF * Document Interface Access */ const IDocumentSettingAccess* SwNode::getIDocumentSettingAccess() const { return &GetDoc()->GetDocumentSettingManager(); } -const IDocumentDeviceAccess* SwNode::getIDocumentDeviceAccess() const { return &GetDoc()->getIDocumentDeviceAccess(); } -const IDocumentRedlineAccess* SwNode::getIDocumentRedlineAccess() const { return &GetDoc()->getIDocumentRedlineAccess(); } -const IDocumentStylePoolAccess* SwNode::getIDocumentStylePoolAccess() const { return &GetDoc()->getIDocumentStylePoolAccess(); } -const IDocumentDrawModelAccess* SwNode::getIDocumentDrawModelAccess() const { return & GetDoc()->getIDocumentDrawModelAccess(); } -const IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() const { return &GetDoc()->getIDocumentLayoutAccess(); } -IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() { return &GetDoc()->getIDocumentLayoutAccess(); } -const IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() const { return &GetDoc()->getIDocumentLinksAdministration(); } -IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() { return &GetDoc()->getIDocumentLinksAdministration(); } -const IDocumentFieldsAccess* SwNode::getIDocumentFieldsAccess() const { return &GetDoc()->getIDocumentFieldsAccess(); } -IDocumentFieldsAccess* SwNode::getIDocumentFieldsAccess() { return &GetDoc()->getIDocumentFieldsAccess(); } -IDocumentContentOperations* SwNode::getIDocumentContentOperations() { return &GetDoc()->getIDocumentContentOperations(); } +const IDocumentDeviceAccess& SwNode::getIDocumentDeviceAccess() const { return GetDoc()->getIDocumentDeviceAccess(); } +const IDocumentRedlineAccess& SwNode::getIDocumentRedlineAccess() const { return GetDoc()->getIDocumentRedlineAccess(); } +const IDocumentStylePoolAccess& SwNode::getIDocumentStylePoolAccess() const { return GetDoc()->getIDocumentStylePoolAccess(); } +const IDocumentDrawModelAccess& SwNode::getIDocumentDrawModelAccess() const { return GetDoc()->getIDocumentDrawModelAccess(); } +const IDocumentLayoutAccess& SwNode::getIDocumentLayoutAccess() const { return GetDoc()->getIDocumentLayoutAccess(); } +IDocumentLayoutAccess& SwNode::getIDocumentLayoutAccess() { return GetDoc()->getIDocumentLayoutAccess(); } +const IDocumentLinksAdministration& SwNode::getIDocumentLinksAdministration() const { return GetDoc()->getIDocumentLinksAdministration(); } +IDocumentLinksAdministration& SwNode::getIDocumentLinksAdministration() { return GetDoc()->getIDocumentLinksAdministration(); } +const IDocumentFieldsAccess& SwNode::getIDocumentFieldsAccess() const { return GetDoc()->getIDocumentFieldsAccess(); } +IDocumentFieldsAccess& SwNode::getIDocumentFieldsAccess() { return GetDoc()->getIDocumentFieldsAccess(); } +IDocumentContentOperations& SwNode::getIDocumentContentOperations() { return GetDoc()->getIDocumentContentOperations(); } IDocumentListItems& SwNode::getIDocumentListItems() { return GetDoc()->getIDocumentListItems(); } // #i83479# const IDocumentMarkAccess* SwNode::getIDocumentMarkAccess() const { return GetDoc()->getIDocumentMarkAccess(); } diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index f25c278b9b37..4d582bf94bfd 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -190,7 +190,7 @@ void SwContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj ) { // #i46297# - notify background about the arriving of // the object and invalidate its position. - const bool bNotify( !GetFormat()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) ); + const bool bNotify( !GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) ); _MoveObjToLayer( true, _pDrawObj ); @@ -220,7 +220,7 @@ void SwContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj ) void SwContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj ) { // #i46297# - notify background about the leaving of the object. - const bool bNotify( GetFormat()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) ); + const bool bNotify( GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) ); _MoveObjToLayer( false, _pDrawObj ); @@ -260,25 +260,20 @@ void SwContact::_MoveObjToLayer( const bool _bToVisible, return; } - const IDocumentDrawModelAccess* pIDDMA = static_cast<SwFrameFormat*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess(); - if ( !pIDDMA ) - { - OSL_FAIL( "SwDrawContact::_MoveObjToLayer(..) - no writer document!" ); - return; - } + const IDocumentDrawModelAccess& rIDDMA = static_cast<SwFrameFormat*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess(); SdrLayerID nToHellLayerId = - _bToVisible ? pIDDMA->GetHellId() : pIDDMA->GetInvisibleHellId(); + _bToVisible ? rIDDMA.GetHellId() : rIDDMA.GetInvisibleHellId(); SdrLayerID nToHeavenLayerId = - _bToVisible ? pIDDMA->GetHeavenId() : pIDDMA->GetInvisibleHeavenId(); + _bToVisible ? rIDDMA.GetHeavenId() : rIDDMA.GetInvisibleHeavenId(); SdrLayerID nToControlLayerId = - _bToVisible ? pIDDMA->GetControlsId() : pIDDMA->GetInvisibleControlsId(); + _bToVisible ? rIDDMA.GetControlsId() : rIDDMA.GetInvisibleControlsId(); SdrLayerID nFromHellLayerId = - _bToVisible ? pIDDMA->GetInvisibleHellId() : pIDDMA->GetHellId(); + _bToVisible ? rIDDMA.GetInvisibleHellId() : rIDDMA.GetHellId(); SdrLayerID nFromHeavenLayerId = - _bToVisible ? pIDDMA->GetInvisibleHeavenId() : pIDDMA->GetHeavenId(); + _bToVisible ? rIDDMA.GetInvisibleHeavenId() : rIDDMA.GetHeavenId(); SdrLayerID nFromControlLayerId = - _bToVisible ? pIDDMA->GetInvisibleControlsId() : pIDDMA->GetControlsId(); + _bToVisible ? rIDDMA.GetInvisibleControlsId() : rIDDMA.GetControlsId(); if ( _pDrawObj->ISA( SdrObjGroup ) ) { @@ -292,8 +287,8 @@ void SwContact::_MoveObjToLayer( const bool _bToVisible, // is a control nNewLayerId = nToControlLayerId; } - else if ( _pDrawObj->GetLayer() == pIDDMA->GetHeavenId() || - _pDrawObj->GetLayer() == pIDDMA->GetInvisibleHeavenId() ) + else if ( _pDrawObj->GetLayer() == rIDDMA.GetHeavenId() || + _pDrawObj->GetLayer() == rIDDMA.GetInvisibleHeavenId() ) { // it has to be the heaven layer, if method <GetLayer()> reveals // a heaven layer @@ -481,7 +476,7 @@ void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj ) OSL_ENSURE( _pDrawObj->ISA(SwVirtFlyDrawObj), "<SwFlyDrawContact::MoveObjToVisibleLayer(..)> - wrong SdrObject type -> crash" ); - if ( GetFormat()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) ) + if ( GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) ) { // nothing to do return; @@ -522,7 +517,7 @@ void SwFlyDrawContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj ) OSL_ENSURE( _pDrawObj->ISA(SwVirtFlyDrawObj), "<SwFlyDrawContact::MoveObjToInvisibleLayer(..)> - wrong SdrObject type -> crash" ); - if ( !GetFormat()->getIDocumentDrawModelAccess()->IsVisibleLayerId( _pDrawObj->GetLayer() ) ) + if ( !GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) ) { // nothing to do return; @@ -592,7 +587,7 @@ SwDrawContact::SwDrawContact( SwFrameFormat* pToRegisterIn, SdrObject* pObj ) : // in the drawing page. if ( !pObj->IsInserted() ) { - pToRegisterIn->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)-> + pToRegisterIn->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)-> InsertObject( pObj, pObj->GetOrdNumDirect() ); } @@ -601,7 +596,7 @@ SwDrawContact::SwDrawContact( SwFrameFormat* pToRegisterIn, SdrObject* pObj ) : if ( ::CheckControlLayer( pObj ) ) { // set layer of object to corresponding invisible layer. - pObj->SetLayer( pToRegisterIn->getIDocumentDrawModelAccess()->GetInvisibleControlsId() ); + pObj->SetLayer( pToRegisterIn->getIDocumentDrawModelAccess().GetInvisibleControlsId() ); } // #i26791# @@ -1243,15 +1238,15 @@ void SwDrawContact::_Changed( const SdrObject& rObj, { if(::CheckControlLayer(maAnchoredDrawObj.DrawObj())) { - const IDocumentDrawModelAccess* pIDDMA = static_cast<SwFrameFormat*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = static_cast<SwFrameFormat*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess(); const SdrLayerID aCurrentLayer(maAnchoredDrawObj.DrawObj()->GetLayer()); - const SdrLayerID aControlLayerID(pIDDMA->GetControlsId()); - const SdrLayerID aInvisibleControlLayerID(pIDDMA->GetInvisibleControlsId()); + const SdrLayerID aControlLayerID(rIDDMA.GetControlsId()); + const SdrLayerID aInvisibleControlLayerID(rIDDMA.GetInvisibleControlsId()); if(aCurrentLayer != aControlLayerID && aCurrentLayer != aInvisibleControlLayerID) { - if ( aCurrentLayer == pIDDMA->GetInvisibleHellId() || - aCurrentLayer == pIDDMA->GetInvisibleHeavenId() ) + if ( aCurrentLayer == rIDDMA.GetInvisibleHellId() || + aCurrentLayer == rIDDMA.GetInvisibleHeavenId() ) { maAnchoredDrawObj.DrawObj()->SetLayer(aInvisibleControlLayerID); } @@ -1652,7 +1647,7 @@ void SwDrawContact::RemoveMasterFromDrawPage() GetMaster()->SetUserCall( 0 ); if ( GetMaster()->IsInserted() ) { - static_cast<SwFrameFormat*>(GetRegisteredIn())->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)-> + static_cast<SwFrameFormat*>(GetRegisteredIn())->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)-> RemoveObject( GetMaster()->GetOrdNum() ); } } @@ -1734,7 +1729,7 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) SwFrameFormat* pDrawFrameFormat = static_cast<SwFrameFormat*>(GetRegisteredIn()); - if( !pDrawFrameFormat->getIDocumentLayoutAccess()->GetCurrentViewShell() ) + if( !pDrawFrameFormat->getIDocumentLayoutAccess().GetCurrentViewShell() ) return; // remove 'virtual' drawing objects from writer @@ -1752,7 +1747,7 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) case FLY_AT_PAGE: { sal_uInt16 nPgNum = pAnch->GetPageNum(); - SwViewShell *pShell = pDrawFrameFormat->getIDocumentLayoutAccess()->GetCurrentViewShell(); + SwViewShell *pShell = pDrawFrameFormat->getIDocumentLayoutAccess().GetCurrentViewShell(); if( !pShell ) break; SwRootFrm* pRoot = pShell->GetLayout(); @@ -1902,7 +1897,7 @@ void SwDrawContact::InsertMasterIntoDrawPage() { if ( !GetMaster()->IsInserted() ) { - GetFormat()->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0) + GetFormat()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0) ->InsertObject( GetMaster(), GetMaster()->GetOrdNumDirect() ); } GetMaster()->SetUserCall( this ); diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index 73cc853b1d60..4a5e60c2dae3 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -405,12 +405,12 @@ void SwEditShell::UnlockExpFields() void SwEditShell::SetFieldUpdateFlags( SwFieldUpdateFlags eFlags ) { - getIDocumentSettingAccess()->setFieldUpdateFlags( eFlags ); + getIDocumentSettingAccess().setFieldUpdateFlags( eFlags ); } SwFieldUpdateFlags SwEditShell::GetFieldUpdateFlags(bool bDocSettings) const { - return getIDocumentSettingAccess()->getFieldUpdateFlags( !bDocSettings ); + return getIDocumentSettingAccess().getFieldUpdateFlags( !bDocSettings ); } void SwEditShell::SetLabelDoc( bool bFlag ) @@ -420,7 +420,7 @@ void SwEditShell::SetLabelDoc( bool bFlag ) bool SwEditShell::IsLabelDoc() const { - return getIDocumentSettingAccess()->get(DocumentSettingId::LABEL_DOCUMENT); + return getIDocumentSettingAccess().get(DocumentSettingId::LABEL_DOCUMENT); } void SwEditShell::ChangeAuthorityData(const SwAuthEntry* pNewData) diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index a5311bd8bce8..a72240b29a46 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -33,12 +33,12 @@ bool SwEditShell::IsGlobalDoc() const { - return getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT); + return getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT); } void SwEditShell::SetGlblDocSaveLinks( bool bFlag ) { - getIDocumentSettingAccess()->set(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS, bFlag); + getIDocumentSettingAccess().set(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS, bFlag); if( !GetDoc()->getIDocumentState().IsModified() ) // Bug 57028 { GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); @@ -48,14 +48,14 @@ void SwEditShell::SetGlblDocSaveLinks( bool bFlag ) bool SwEditShell::IsGlblDocSaveLinks() const { - return getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS); + return getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS); } void SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const { rArr.DeleteAndDestroyAll(); - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return; // then all linked areas on the topmost level @@ -136,7 +136,7 @@ void SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, SwSectionData & rNew) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return false; SET_CURR_SHELL( this ); @@ -177,7 +177,7 @@ bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, const SwTOXBase& rTOX ) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return false; SET_CURR_SHELL( this ); @@ -217,7 +217,7 @@ bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos ) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return false; SET_CURR_SHELL( this ); @@ -240,7 +240,7 @@ bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos ) bool SwEditShell::DeleteGlobalDocContent( const SwGlblDocContents& rArr , size_t nDelPos ) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return false; SET_CURR_SHELL( this ); @@ -306,7 +306,7 @@ bool SwEditShell::MoveGlobalDocContent( const SwGlblDocContents& rArr , size_t nFromPos, size_t nToPos, size_t nInsPos ) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) || + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) || nFromPos >= rArr.size() || nToPos > rArr.size() || nInsPos > rArr.size() || nFromPos >= nToPos || ( nFromPos <= nInsPos && nInsPos <= nToPos ) ) @@ -341,7 +341,7 @@ bool SwEditShell::MoveGlobalDocContent( const SwGlblDocContents& rArr , bool SwEditShell::GotoGlobalDocContent( const SwGlblDocContent& rPos ) { - if( !getIDocumentSettingAccess()->get(DocumentSettingId::GLOBAL_DOCUMENT) ) + if( !getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT) ) return false; SET_CURR_SHELL( this ); diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index f498f753912c..ba39bce73619 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -929,12 +929,12 @@ void SwEditShell::SetLineNumberInfo(const SwLineNumberInfo& rInfo) sal_uInt16 SwEditShell::GetLinkUpdMode(bool bDocSettings) const { - return getIDocumentSettingAccess()->getLinkUpdateMode( !bDocSettings ); + return getIDocumentSettingAccess().getLinkUpdateMode( !bDocSettings ); } void SwEditShell::SetLinkUpdMode( sal_uInt16 nMode ) { - getIDocumentSettingAccess()->setLinkUpdateMode( nMode ); + getIDocumentSettingAccess().setLinkUpdateMode( nMode ); } // Interface for TextInputData - (for text input of japanese/chinese characters) diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index 9f6a74d2fcd6..2edec00f8169 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -135,9 +135,9 @@ void SwDDETable::ChangeContent() } } - const IDocumentSettingAccess* pIDSA = GetFrameFormat()->getIDocumentSettingAccess(); + const IDocumentSettingAccess& rIDSA = GetFrameFormat()->getIDocumentSettingAccess(); SwDoc* pDoc = GetFrameFormat()->GetDoc(); - if( AUTOUPD_FIELD_AND_CHARTS == pIDSA->getFieldUpdateFlags(true) ) + if( AUTOUPD_FIELD_AND_CHARTS == rIDSA.getFieldUpdateFlags(true) ) pDoc->getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); } diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx index 618acb04509e..f5d8514732b2 100644 --- a/sw/source/core/fields/postithelper.cxx +++ b/sw/source/core/fields/postithelper.cxx @@ -78,10 +78,10 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( o_rInfo.meSidebarPosition = pPage->SidebarPosition(); o_rInfo.mRedlineAuthor = 0; - const IDocumentRedlineAccess* pIDRA = pTextNode->getIDocumentRedlineAccess(); - if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) ) + const IDocumentRedlineAccess& rIDRA = pTextNode->getIDocumentRedlineAccess(); + if( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) { - const SwRangeRedline* pRedline = pIDRA->GetRedline( rAnchorPos, 0 ); + const SwRangeRedline* pRedline = rIDRA.GetRedline( rAnchorPos, 0 ); if( pRedline ) { if( nsRedlineType_t::REDLINE_INSERT == pRedline->GetType() ) diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 7a73af074341..194bff89c765 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -865,7 +865,7 @@ void SwFEShell::InsertDrawObj( SdrObject& rDrawObj, rFlyAttrSet.Put( SwFormatAnchor( FLY_AT_PARA )); // #i89920# rFlyAttrSet.Put( SwFormatSurround( SURROUND_THROUGHT ) ); - rDrawObj.SetLayer( getIDocumentDrawModelAccess()->GetHeavenId() ); + rDrawObj.SetLayer( getIDocumentDrawModelAccess().GetHeavenId() ); // find anchor position SwPaM aPam( mpDoc->GetNodes() ); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index b72bead59631..79331de8f5b4 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -922,7 +922,7 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId ) if ( Imp()->HasDrawView() ) { const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList(); - const IDocumentDrawModelAccess* pIDDMA = getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess(); // correct type of <nControls> for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i ) { @@ -945,7 +945,7 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId ) { SwFormat *pFormat = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm()->GetFormat(); SvxOpaqueItem aOpa( pFormat->GetOpaque() ); - aOpa.SetValue( nLayerId == pIDDMA->GetHellId() ); + aOpa.SetValue( nLayerId == rIDDMA.GetHellId() ); pFormat->SetFormatAttr( aOpa ); } } @@ -956,12 +956,12 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId ) void SwFEShell::SelectionToHeaven() { - ChangeOpaque( getIDocumentDrawModelAccess()->GetHeavenId() ); + ChangeOpaque( getIDocumentDrawModelAccess().GetHeavenId() ); } void SwFEShell::SelectionToHell() { - ChangeOpaque( getIDocumentDrawModelAccess()->GetHellId() ); + ChangeOpaque( getIDocumentDrawModelAccess().GetHellId() ); } size_t SwFEShell::IsObjSelected() const @@ -1125,13 +1125,13 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) if ( bRet && pObj ) { - const IDocumentDrawModelAccess* pIDDMA = getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess(); // #i89920# // Do not select object in background which is overlapping this text // at the given position. bool bObjInBackground( false ); { - if ( pObj->GetLayer() == pIDDMA->GetHellId() ) + if ( pObj->GetLayer() == rIDDMA.GetHellId() ) { const SwAnchoredObject* pAnchoredObj = ::GetUserCall( pObj )->GetAnchoredObj( pObj ); const SwFrameFormat& rFormat = pAnchoredObj->GetFrameFormat(); @@ -1198,7 +1198,7 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) if ( bRet ) { - const SdrPage* pPage = pIDDMA->GetDrawModel()->GetPage(0); + const SdrPage* pPage = rIDDMA.GetDrawModel()->GetPage(0); for(size_t a = pObj->GetOrdNum()+1; bRet && a < pPage->GetObjCount(); ++a) { SdrObject *pCandidate = pPage->GetObj(a); @@ -1319,7 +1319,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool // Here we are if // A No object has been selected and no group has been entered or // B An object has been selected and it is not inside a group - pList = getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 ); + pList = getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 ); } OSL_ENSURE( pList, "No object list to iterate" ); @@ -1758,10 +1758,10 @@ bool SwFEShell::ImpEndCreate() // via the available SS be generated. GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(false); // see above // #i52858# - method name changed - SdrPage *pPg = getIDocumentDrawModelAccess()->GetOrCreateDrawModel()->GetPage( 0 ); + SdrPage *pPg = getIDocumentDrawModelAccess().GetOrCreateDrawModel()->GetPage( 0 ); if( !pPg ) { - SdrModel* pTmpSdrModel = getIDocumentDrawModelAccess()->GetDrawModel(); + SdrModel* pTmpSdrModel = getIDocumentDrawModelAccess().GetDrawModel(); pPg = pTmpSdrModel->AllocPage( false ); pTmpSdrModel->InsertPage( pPg ); } @@ -1827,7 +1827,7 @@ bool SwFEShell::ImpEndCreate() } SwFormatVertOrient aVert( nYOffset, text::VertOrientation::NONE, text::RelOrientation::FRAME ); aSet.Put( aVert ); - SwDrawFrameFormat* pFormat = static_cast<SwDrawFrameFormat*>(getIDocumentLayoutAccess()->MakeLayoutFormat( RND_DRAW_OBJECT, &aSet )); + SwDrawFrameFormat* pFormat = static_cast<SwDrawFrameFormat*>(getIDocumentLayoutAccess().MakeLayoutFormat( RND_DRAW_OBJECT, &aSet )); // #i36010# - set layout direction of the position pFormat->SetPositionLayoutDir( text::PositionLayoutDir::PositionInLayoutDirOfAnchor ); @@ -2531,7 +2531,7 @@ void SwFEShell::CheckUnboundObjects() aSet.Put( aAnch ); aSet.Put( SwFormatSurround( SURROUND_THROUGHT ) ); - SwFrameFormat* pFormat = getIDocumentLayoutAccess()->MakeLayoutFormat( RND_DRAW_OBJECT, &aSet ); + SwFrameFormat* pFormat = getIDocumentLayoutAccess().MakeLayoutFormat( RND_DRAW_OBJECT, &aSet ); SwDrawContact *pContact = new SwDrawContact( static_cast<SwDrawFrameFormat*>(pFormat), pObj ); diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 94ffa386e0bb..7f9f7c6cf130 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -686,10 +686,10 @@ bool SwGrfNode::RestorePersistentData() { if( refLink.Is() ) { - IDocumentLinksAdministration* pIDLA = getIDocumentLinksAdministration(); - refLink->SetVisible( pIDLA->IsVisibleLinks() ); - pIDLA->GetLinkManager().InsertDDELink( refLink ); - if( getIDocumentLayoutAccess()->GetCurrentLayout() ) + IDocumentLinksAdministration& rIDLA = getIDocumentLinksAdministration(); + refLink->SetVisible( rIDLA.IsVisibleLinks() ); + rIDLA.GetLinkManager().InsertDDELink( refLink ); + if( getIDocumentLayoutAccess().GetCurrentLayout() ) refLink->Update(); } return true; @@ -699,10 +699,10 @@ void SwGrfNode::InsertLink( const OUString& rGrfName, const OUString& rFltName ) { refLink = new SwBaseLink( SfxLinkUpdateMode::ONCALL, SotClipboardFormatId::GDIMETAFILE, this ); - IDocumentLinksAdministration* pIDLA = getIDocumentLinksAdministration(); + IDocumentLinksAdministration& rIDLA = getIDocumentLinksAdministration(); if( GetNodes().IsDocNodes() ) { - refLink->SetVisible( pIDLA->IsVisibleLinks() ); + refLink->SetVisible( rIDLA.IsVisibleLinks() ); if( rFltName == "DDE" ) { sal_Int32 nTmp = 0; @@ -710,7 +710,7 @@ void SwGrfNode::InsertLink( const OUString& rGrfName, const OUString& rFltName ) sApp = rGrfName.getToken( 0, sfx2::cTokenSeparator, nTmp ); sTopic = rGrfName.getToken( 0, sfx2::cTokenSeparator, nTmp ); sItem = rGrfName.copy( nTmp ); - pIDLA->GetLinkManager().InsertDDELink( refLink, + rIDLA.GetLinkManager().InsertDDELink( refLink, sApp, sTopic, sItem ); } else @@ -719,7 +719,7 @@ void SwGrfNode::InsertLink( const OUString& rGrfName, const OUString& rFltName ) refLink->SetSynchron( bSync ); refLink->SetContentType( SotClipboardFormatId::SVXB ); - pIDLA->GetLinkManager().InsertFileLink( *refLink, + rIDLA.GetLinkManager().InsertFileLink( *refLink, OBJECT_CLIENT_GRF, rGrfName, (!bSync && !rFltName.isEmpty() ? &rFltName : 0) ); } @@ -742,7 +742,7 @@ void SwGrfNode::ReleaseLink() bInSwapIn = false; } - getIDocumentLinksAdministration()->GetLinkManager().Remove( refLink ); + getIDocumentLinksAdministration().GetLinkManager().Remove( refLink ); refLink.Clear(); maGrfObj.SetLink(); diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index 5f4dc2f37149..d1c3af05da4b 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -152,7 +152,7 @@ protected: virtual const SwRect GetObjBoundRect() const SAL_OVERRIDE; virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE; - virtual const IDocumentDrawModelAccess* getIDocumentDrawModelAccess( ) SAL_OVERRIDE; + virtual const IDocumentDrawModelAccess& getIDocumentDrawModelAccess( ) SAL_OVERRIDE; SwTwips CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips nMinHeight, const SwTwips nUL); diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 11bf2b1c6ca5..6e8dd25a8b43 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -418,7 +418,7 @@ protected: void PaintShadow( const SwRect&, SwRect&, const SwBorderAttrs& ) const; virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE; - virtual const IDocumentDrawModelAccess* getIDocumentDrawModelAccess( ); + virtual const IDocumentDrawModelAccess& getIDocumentDrawModelAccess( ); public: virtual css::uno::Sequence< css::style::TabStop > GetTabStopInfo( SwTwips ) diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx index b644aea996f6..53c4e02814dd 100644 --- a/sw/source/core/inc/unoport.hxx +++ b/sw/source/core/inc/unoport.hxx @@ -239,8 +239,8 @@ public: SwTextPortionType GetTextPortionType() const { return m_ePortionType; } - SwUnoCrsr* GetCursor() const - { return &(*m_pUnoCursor); } + SwUnoCrsr& GetCursor() const + { return *m_pUnoCursor; } }; class SwXTextPortionEnumeration @@ -253,8 +253,8 @@ class SwXTextPortionEnumeration TextRangeList_t m_Portions; // contains all portions, filled by ctor sw::UnoCursorPointer m_pUnoCrsr; - SwUnoCrsr* GetCursor() const - {return &(*m_pUnoCrsr);} + SwUnoCrsr& GetCursor() const + {return *m_pUnoCrsr;} protected: virtual ~SwXTextPortionEnumeration(); diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index e446d24c3ea8..c8c348824146 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -435,7 +435,7 @@ bool SwAnchoredObject::ConsiderObjWrapInfluenceOnObjPos() const { bRet = true; } - else if ( rObjFormat.getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + else if ( rObjFormat.getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { const SwFormatAnchor& rAnchor = rObjFormat.GetAnchor(); if ( ((rAnchor.GetAnchorId() == FLY_AT_CHAR) || @@ -632,7 +632,7 @@ void SwAnchoredObject::UpdateObjInSortedList() { if ( GetAnchorFrm() ) { - if ( GetFrameFormat().getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + if ( GetFrameFormat().getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { // invalidate position of all anchored objects at anchor frame if ( GetAnchorFrm()->GetDrawObjs() ) diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index a66cd336d614..6bb30287662a 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -102,7 +102,7 @@ bool SwContentFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, bool, bool & ) // if <nMoveAnyway> equals 3 and no space is left in new upper. nMoveAnyway |= BwdMoveNecessary( pOldPage, Frm() ); { - const IDocumentSettingAccess* pIDSA = pNewPage->GetFormat()->getIDocumentSettingAccess(); + const IDocumentSettingAccess& rIDSA = pNewPage->GetFormat()->getIDocumentSettingAccess(); SwTwips nSpace = 0; SwRect aRect( pNewUpper->Prt() ); aRect.Pos() += pNewUpper->Frm().Pos(); @@ -116,7 +116,7 @@ bool SwContentFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, bool, bool & ) // check, if last frame is inside table and if it includes // its lower spacing. if ( !pPrevFrm->GetNext() && pPrevFrm->IsInTab() && - pIDSA->get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) + rIDSA.get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) { const SwFrm* pLastFrm = pPrevFrm; // if last frame is a section, take its last content @@ -1907,7 +1907,7 @@ bool SwContentFrm::_WouldFit( SwTwips nSpace, // OD 2004-03-01 #106629# - also consider lower spacing in table cells if ( bRet && IsInTab() && - pNewUpper->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) + pNewUpper->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) { nSpace -= rAttrs.GetULSpace().GetLower(); if ( nSpace < 0 ) diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 26c5fe86a7bc..c412a3a93d20 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1370,8 +1370,8 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs, SwTwips nUpper = 0; // OD 06.01.2004 #i11859# { - const IDocumentSettingAccess* pIDSA = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess(); - const bool bUseFormerLineSpacing = pIDSA->get(DocumentSettingId::OLD_LINE_SPACING); + const IDocumentSettingAccess& rIDSA = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess(); + const bool bUseFormerLineSpacing = rIDSA.get(DocumentSettingId::OLD_LINE_SPACING); if( pPrevFrm ) { // OD 2004-03-10 #i11860# - use new method to determine needed spacing @@ -1383,7 +1383,7 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs, GetSpacingValuesOfFrm( (*pPrevFrm), nPrevLowerSpace, nPrevLineSpacing, bPrevLineSpacingPorportional ); - if( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX) ) + if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) ) { nUpper = nPrevLowerSpace + pAttrs->GetULSpace().GetUpper(); SwTwips nAdd = nPrevLineSpacing; @@ -1473,7 +1473,7 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs, } } } - else if ( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) && + else if ( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) && CastFlowFrm( pOwn )->HasParaSpaceAtPages( m_rThis.IsSctFrm() ) ) { nUpper = pAttrs->GetULSpace().GetUpper(); @@ -1580,9 +1580,9 @@ SwTwips SwFlowFrm::_GetUpperSpaceAmountConsideredForPrevFrm() const GetSpacingValuesOfFrm( (*pPrevFrm), nPrevLowerSpace, nPrevLineSpacing, bDummy ); if ( nPrevLowerSpace > 0 || nPrevLineSpacing > 0 ) { - const IDocumentSettingAccess* pIDSA = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX) || - !pIDSA->get(DocumentSettingId::OLD_LINE_SPACING) ) + const IDocumentSettingAccess& rIDSA = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) || + !rIDSA.get(DocumentSettingId::OLD_LINE_SPACING) ) { nUpperSpaceAmountOfPrevFrm = nPrevLowerSpace + nPrevLineSpacing; } @@ -1606,7 +1606,7 @@ SwTwips SwFlowFrm::GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid() const { SwTwips nUpperSpaceAmountConsideredForPrevFrmAndPageGrid = 0; - if ( !m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::USE_FORMER_OBJECT_POS) ) + if ( !m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_OBJECT_POS) ) { nUpperSpaceAmountConsideredForPrevFrmAndPageGrid = _GetUpperSpaceAmountConsideredForPrevFrm() + @@ -1669,7 +1669,7 @@ SwTwips SwFlowFrm::CalcAddLowerSpaceAsLastInTableCell( { SwTwips nAdditionalLowerSpace = 0; - if ( m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) + if ( m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) ) { const SwFrm* pFrm = &m_rThis; if ( pFrm->IsSctFrm() ) diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 0d926b1a3523..b2f98f11a927 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -276,7 +276,7 @@ SwFlyFrm::~SwFlyFrm() { } -const IDocumentDrawModelAccess* SwFlyFrm::getIDocumentDrawModelAccess() +const IDocumentDrawModelAccess& SwFlyFrm::getIDocumentDrawModelAccess() { return GetFormat()->getIDocumentDrawModelAccess(); } @@ -389,7 +389,7 @@ SwVirtFlyDrawObj* SwFlyFrm::CreateNewRef( SwFlyDrawContact *pContact ) // into drawing page with correct order number else { - pContact->GetFormat()->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 )-> + pContact->GetFormat()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )-> InsertObject( pDrawObj, _GetOrdNumForNewRef( pContact ) ); } // #i38889# - assure, that new <SwVirtFlyDrawObj> instance @@ -403,13 +403,13 @@ void SwFlyFrm::InitDrawObj( bool bNotify ) // Find ContactObject from the Format. If there's already one, we just // need to create a new Ref, else we create the Contact now. - IDocumentDrawModelAccess* pIDDMA = GetFormat()->getIDocumentDrawModelAccess(); + IDocumentDrawModelAccess& rIDDMA = GetFormat()->getIDocumentDrawModelAccess(); SwFlyDrawContact *pContact = SwIterator<SwFlyDrawContact,SwFormat>( *GetFormat() ).First(); if ( !pContact ) { // #i52858# - method name changed pContact = new SwFlyDrawContact( GetFormat(), - pIDDMA->GetOrCreateDrawModel() ); + rIDDMA.GetOrCreateDrawModel() ); } OSL_ENSURE( pContact, "InitDrawObj failed" ); // OD 2004-03-22 #i26791# @@ -417,8 +417,8 @@ void SwFlyFrm::InitDrawObj( bool bNotify ) // Set the right Layer // OD 2004-01-19 #110582# - SdrLayerID nHeavenId = pIDDMA->GetHeavenId(); - SdrLayerID nHellId = pIDDMA->GetHellId(); + SdrLayerID nHeavenId = rIDDMA.GetHeavenId(); + SdrLayerID nHellId = rIDDMA.GetHellId(); // OD 2004-03-22 #i26791# GetVirtDrawObj()->SetLayer( GetFormat()->GetOpaque().GetValue() ? nHeavenId @@ -895,10 +895,10 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, if ( pSh ) pSh->InvalidateWindows( Frm() ); - const IDocumentDrawModelAccess* pIDDMA = GetFormat()->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = GetFormat()->getIDocumentDrawModelAccess(); const sal_uInt8 nId = GetFormat()->GetOpaque().GetValue() ? - pIDDMA->GetHeavenId() : - pIDDMA->GetHellId(); + rIDDMA.GetHeavenId() : + rIDDMA.GetHellId(); GetVirtDrawObj()->SetLayer( nId ); if ( Lower() ) @@ -976,10 +976,10 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, if ( pSh ) pSh->InvalidateWindows( Frm() ); - const IDocumentDrawModelAccess* pIDDMA = GetFormat()->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = GetFormat()->getIDocumentDrawModelAccess(); const sal_uInt8 nId = static_cast<const SvxOpaqueItem*>(pNew)->GetValue() ? - pIDDMA->GetHeavenId() : - pIDDMA->GetHellId(); + rIDDMA.GetHeavenId() : + rIDDMA.GetHellId(); GetVirtDrawObj()->SetLayer( nId ); if( pSh ) { @@ -1595,7 +1595,7 @@ void CalcContent( SwLayoutFrm *pLay, // OD 2004-05-17 #i28701# - format anchor frame after its objects // are formatted, if the wrapping style influence has to be considered. - if ( pLay->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + if ( pLay->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { pFrm->Calc(pRenderContext); } @@ -2116,15 +2116,15 @@ void SwFrm::AppendDrawObj( SwAnchoredObject& _rNewObj ) // Assure the control objects and group objects containing controls are on the control layer if ( ::CheckControlLayer( _rNewObj.DrawObj() ) ) { - const IDocumentDrawModelAccess* pIDDMA = getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess(); const SdrLayerID aCurrentLayer(_rNewObj.DrawObj()->GetLayer()); - const SdrLayerID aControlLayerID(pIDDMA->GetControlsId()); - const SdrLayerID aInvisibleControlLayerID(pIDDMA->GetInvisibleControlsId()); + const SdrLayerID aControlLayerID(rIDDMA.GetControlsId()); + const SdrLayerID aInvisibleControlLayerID(rIDDMA.GetInvisibleControlsId()); if(aCurrentLayer != aControlLayerID && aCurrentLayer != aInvisibleControlLayerID) { - if ( aCurrentLayer == pIDDMA->GetInvisibleHellId() || - aCurrentLayer == pIDDMA->GetInvisibleHeavenId() ) + if ( aCurrentLayer == rIDDMA.GetInvisibleHellId() || + aCurrentLayer == rIDDMA.GetInvisibleHeavenId() ) { _rNewObj.DrawObj()->SetLayer(aInvisibleControlLayerID); } diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 36e7478043e0..f630bb0c253c 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -1321,7 +1321,7 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) GetFormat()->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); if( pCnt != GetAnchorFrm() || ( IsAutoPos() && pCnt->IsTextFrm() && - GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::HTML_MODE)) ) + GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE)) ) { //Set the anchor attribute according to the new Cnt. SwFormatAnchor aAnch( pFormat->GetAnchor() ); diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index 882ae50ad2d0..66b664365cc2 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -254,7 +254,7 @@ void SwFlyInCntFrm::MakeAll(vcl::RenderContext* /*pRenderContext*/) // re-activate clipping of as-character anchored Writer fly frames // depending on compatibility option <ClipAsCharacterAnchoredWriterFlyFrames> if ( mbValidPos && mbValidSize && - GetFormat()->getIDocumentSettingAccess()->get( DocumentSettingId::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME ) ) + GetFormat()->getIDocumentSettingAccess().get( DocumentSettingId::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME ) ) { SwFrm* pFrm = AnchorFrm(); if ( Frm().Left() == (pFrm->Frm().Left()+pFrm->Prt().Left()) && diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index fe9bb3d4750f..fa0a15595b07 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -916,7 +916,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) const bool bFollowTextFlow = pFly->GetFormat()->GetFollowTextFlow().GetValue(); // #i28701# const bool bConsiderWrapOnObjPos = - pFly->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION); + pFly->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION); const SwFormatVertOrient &rV = pFly->GetFormat()->GetVertOrient(); if( pFly->IsFlyLayFrm() ) { diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index aa1e2dbc3cee..9a56a1ad5859 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1058,7 +1058,7 @@ void AppendObjs( const SwFrameFormats *pTable, sal_uLong nIndex, { if ( !pSdrObj->GetPage() ) { - pFormat->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)-> + pFormat->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)-> InsertObject(pSdrObj, pSdrObj->GetOrdNumDirect()); } diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 27dc66b2c5ec..c87def2fae8d 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -85,7 +85,7 @@ static void BreakPoint() { if ( IsAgain() ) \ { \ if( bNoLoop ) \ - pLayoutAccess->GetLayouter()->EndLoopControl(); \ + rLayoutAccess.GetLayouter()->EndLoopControl(); \ return; \ } \ } @@ -141,8 +141,8 @@ bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwContentFrm *pCn continue; // OD 2004-01-15 #110582# - do not consider invisible objects - const IDocumentDrawModelAccess* pIDDMA = pPage->GetFormat()->getIDocumentDrawModelAccess(); - if ( !pIDDMA->IsVisibleLayerId( pO->GetLayer() ) ) + const IDocumentDrawModelAccess& rIDDMA = pPage->GetFormat()->getIDocumentDrawModelAccess(); + if ( !rIDDMA.IsVisibleLayerId( pO->GetLayer() ) ) { continue; } @@ -155,7 +155,7 @@ bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwContentFrm *pCn if ( pSelfFly && pSelfFly->IsLowerOf( pFly ) ) continue; - if ( pFly->GetVirtDrawObj()->GetLayer() == pIDDMA->GetHellId() ) + if ( pFly->GetVirtDrawObj()->GetLayer() == rIDDMA.GetHellId() ) continue; if ( pSelfFly ) @@ -467,7 +467,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) while ( pPage && !pPage->IsInvalid() && !pPage->IsInvalidFly() ) pPage = static_cast<SwPageFrm*>(pPage->GetNext()); - IDocumentLayoutAccess *pLayoutAccess = pRoot->GetFormat()->getIDocumentLayoutAccess(); + IDocumentLayoutAccess& rLayoutAccess = pRoot->GetFormat()->getIDocumentLayoutAccess(); bool bNoLoop = pPage && SwLayouter::StartLoopControl( pRoot->GetFormat()->GetDoc(), pPage ); sal_uInt16 nPercentPageNum = 0; while ( (pPage && !IsInterrupt()) || nCheckPageNum != USHRT_MAX ) @@ -519,7 +519,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) if ( IsAgain() ) { if( bNoLoop ) - pLayoutAccess->GetLayouter()->EndLoopControl(); + rLayoutAccess.GetLayouter()->EndLoopControl(); return; } pPage = static_cast<SwPageFrm*>(pRoot->Lower()); @@ -598,7 +598,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) } } if( bNoLoop ) - pLayoutAccess->GetLayouter()->LoopControl( pPage, LOOP_PAGE ); + rLayoutAccess.GetLayouter()->LoopControl( pPage, LOOP_PAGE ); } unlockPositionOfObjects( pPage ); @@ -651,7 +651,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) pPage = static_cast<SwPageFrm*>(pPage->GetNext()); } if( bNoLoop ) - pLayoutAccess->GetLayouter()->LoopControl( pPage, LOOP_PAGE ); + rLayoutAccess.GetLayouter()->LoopControl( pPage, LOOP_PAGE ); } CheckIdleEnd(); } @@ -669,7 +669,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) if ( IsAgain() ) { if( bNoLoop ) - pLayoutAccess->GetLayouter()->EndLoopControl(); + rLayoutAccess.GetLayouter()->EndLoopControl(); return; } pPage = static_cast<SwPageFrm*>(pRoot->Lower()); @@ -801,7 +801,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) } pOptTab = 0; if( bNoLoop ) - pLayoutAccess->GetLayouter()->EndLoopControl(); + rLayoutAccess.GetLayouter()->EndLoopControl(); } bool SwLayAction::_TurboAction( const SwContentFrm *pCnt ) @@ -1486,8 +1486,8 @@ bool SwLayAction::FormatLayoutTab( SwTabFrm *pTab, bool bAddRect ) return false; vcl::RenderContext* pRenderContext = pImp->GetShell()->GetOut(); - IDocumentTimerAccess *pTimerAccess = pRoot->GetFormat()->getIDocumentTimerAccess(); - pTimerAccess->BlockIdling(); + IDocumentTimerAccess& rTimerAccess = pRoot->GetFormat()->getIDocumentTimerAccess(); + rTimerAccess.BlockIdling(); bool bChanged = false; bool bPainted = false; @@ -1596,7 +1596,7 @@ bool SwLayAction::FormatLayoutTab( SwTabFrm *pTab, bool bAddRect ) CheckWaitCrsr(); - pTimerAccess->UnblockIdling(); + rTimerAccess.UnblockIdling(); // Ugly shortcut! if ( pTab->IsLowersFormatted() && @@ -2027,7 +2027,7 @@ bool SwLayIdle::DoIdleJob( IdleJobType eJob, bool bVisAreaOnly ) return false; break; case WORD_COUNT : - if ( !pViewShell->getIDocumentStatistics()->GetDocStat().bModified ) + if ( !pViewShell->getIDocumentStatistics().GetDocStat().bModified ) return false; break; case SMART_TAGS : @@ -2274,7 +2274,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewShellImp *pI ) : // See conditions in DoIdleJob() const bool bSpell = rVOpt.IsOnlineSpell(); const bool bACmplWrd = SwViewOption::IsAutoCompleteWords(); - const bool bWordCount = pViewShell->getIDocumentStatistics()->GetDocStat().bModified; + const bool bWordCount = pViewShell->getIDocumentStatistics().GetDocStat().bModified; const bool bSmartTags = !pViewShell->GetDoc()->GetDocShell()->IsHelpDocument() && !pViewShell->GetDoc()->isXForms() && SwSmartTagMgr::Get().IsSmartTagsEnabled(); diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index e71ea11ee688..8eee3606a721 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -487,16 +487,16 @@ void SwRootFrm::Init( SwFrameFormat* pFormat ) { InitCurrShells( this ); - IDocumentTimerAccess *pTimerAccess = pFormat->getIDocumentTimerAccess(); - IDocumentLayoutAccess *pLayoutAccess = pFormat->getIDocumentLayoutAccess(); - IDocumentFieldsAccess *pFieldsAccess = pFormat->getIDocumentFieldsAccess(); - const IDocumentSettingAccess *pSettingAccess = pFormat->getIDocumentSettingAccess(); - pTimerAccess->StopIdling(); + IDocumentTimerAccess& rTimerAccess = pFormat->getIDocumentTimerAccess(); + IDocumentLayoutAccess& rLayoutAccess = pFormat->getIDocumentLayoutAccess(); + IDocumentFieldsAccess& rFieldsAccess = pFormat->getIDocumentFieldsAccess(); + const IDocumentSettingAccess& rSettingAccess = pFormat->getIDocumentSettingAccess(); + rTimerAccess.StopIdling(); // For creating the Flys by MakeFrms() - pLayoutAccess->SetCurrentViewShell( this->GetCurrShell() ); + rLayoutAccess.SetCurrentViewShell( this->GetCurrShell() ); mbCallbackActionEnabled = false; // needs to be set to true before leaving! - SwDrawModel* pMd = pFormat->getIDocumentDrawModelAccess()->GetDrawModel(); + SwDrawModel* pMd = pFormat->getIDocumentDrawModelAccess().GetDrawModel(); if ( pMd ) { // Disable "multiple layout" @@ -556,16 +556,16 @@ void SwRootFrm::Init( SwFrameFormat* pFormat ) ::_InsertCnt( pLay, pDoc, aTmp.GetIndex(), true ); //Remove masters that haven't been replaced yet from the list. RemoveMasterObjs( mpDrawPage ); - if( pSettingAccess->get(DocumentSettingId::GLOBAL_DOCUMENT) ) - pFieldsAccess->UpdateRefFields( NULL ); + if( rSettingAccess.get(DocumentSettingId::GLOBAL_DOCUMENT) ) + rFieldsAccess.UpdateRefFields( NULL ); //b6433357: Update page fields after loading if ( !mpCurrShell || !mpCurrShell->Imp()->IsUpdateExpFields() ) { SwDocPosUpdate aMsgHint( pPage->Frm().Top() ); - pFieldsAccess->UpdatePageFields( &aMsgHint ); + rFieldsAccess.UpdatePageFields( &aMsgHint ); } - pTimerAccess->StartIdling(); + rTimerAccess.StartIdling(); mbCallbackActionEnabled = true; SwViewShell *pViewSh = GetCurrShell(); diff --git a/sw/source/core/layout/objectformatter.cxx b/sw/source/core/layout/objectformatter.cxx index b49f9a72e694..a2d2fdeb880c 100644 --- a/sw/source/core/layout/objectformatter.cxx +++ b/sw/source/core/layout/objectformatter.cxx @@ -137,7 +137,7 @@ SwObjectFormatter::SwObjectFormatter( const SwPageFrm& _rPageFrm, const bool _bCollectPgNumOfAnchors ) : mrPageFrm( _rPageFrm ), mbFormatOnlyAsCharAnchored( false ), - mbConsiderWrapOnObjPos( _rPageFrm.GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ), + mbConsiderWrapOnObjPos( _rPageFrm.GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ), mpLayAction( _pLayAction ), // --> #i26945# mpPgNumAndTypeOfAnchors( _bCollectPgNumOfAnchors ? new SwPageNumAndTypeOfAnchors() : 0L ) diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 3c755e1d90f1..2bf79201f05f 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1907,7 +1907,7 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi mbSidebarChanged = false; } - if( GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE ) ) + if( GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE ) ) { mnColumns = 1; mbBookMode = false; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 4f27f02e8d4c..b22259a0a640 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1628,8 +1628,8 @@ static void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage, //If the content of the Fly is transparent, we subtract it only if it's //contained in the hell layer. - const IDocumentDrawModelAccess* pIDDMA = pFly->GetFormat()->getIDocumentDrawModelAccess(); - bool bHell = pSdrObj->GetLayer() == pIDDMA->GetHellId(); + const IDocumentDrawModelAccess& rIDDMA = pFly->GetFormat()->getIDocumentDrawModelAccess(); + bool bHell = pSdrObj->GetLayer() == rIDDMA.GetHellId(); if ( (bStopOnHell && bHell) || /// Change internal order of condition /// first check "!bHell", then "..->Lower()" and "..->IsNoTextFrm()" @@ -3367,8 +3367,8 @@ void SwRootFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, S if ( pSh->Imp()->HasDrawView() ) { gProp.pSLines->LockLines( true ); - const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); - pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), + const IDocumentDrawModelAccess& rIDDMA = pSh->getIDocumentDrawModelAccess(); + pSh->Imp()->PaintLayer( rIDDMA.GetHellId(), pPrintData, pPage->Frm(), &aPageBackgrdColor, @@ -4057,7 +4057,7 @@ bool SwFlyFrm::IsPaint( SdrObject *pObj, const SwViewShell *pSh ) { if ( !pAnch->GetValidPosFlag() ) pAnch = 0; - else if ( sal_IntPtr(pSh->GetOut()) == sal_IntPtr(pSh->getIDocumentDeviceAccess()->getPrinter( false ))) + else if ( sal_IntPtr(pSh->GetOut()) == sal_IntPtr(pSh->getIDocumentDeviceAccess().getPrinter( false ))) { //HACK: we have to omit some of the objects for printing, //otherwise they would be printed twice. @@ -4210,16 +4210,16 @@ void SwFlyFrm::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, Sw // for transparent graphics in layer Hell, if parent fly frame isn't // in layer Hell. It's only painted the intersection between the // parent fly frame area and the paint area <aRect> - const IDocumentDrawModelAccess* pIDDMA = GetFormat()->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = GetFormat()->getIDocumentDrawModelAccess(); if (bIsGraphicTransparent && GetFormat()->GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS) && - GetVirtDrawObj()->GetLayer() == pIDDMA->GetHellId() && + GetVirtDrawObj()->GetLayer() == rIDDMA.GetHellId() && GetAnchorFrm()->FindFlyFrm() ) { const SwFlyFrm* pParentFlyFrm = GetAnchorFrm()->FindFlyFrm(); if ( pParentFlyFrm->GetDrawObj()->GetLayer() != - pIDDMA->GetHellId() ) + rIDDMA.GetHellId() ) { SwFlyFrm* pOldRet = gProp.pSRetoucheFly2; gProp.pSRetoucheFly2 = const_cast<SwFlyFrm*>(this); @@ -7414,16 +7414,16 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const if ( aRetouchePart.HasArea() ) { const Color aPageBackgrdColor(pPage->GetDrawBackgrdColor()); - const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = pSh->getIDocumentDrawModelAccess(); // --> OD #i76669# SwViewObjectContactRedirector aSwRedirector( *pSh ); // <-- - pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), 0, + pSh->Imp()->PaintLayer( rIDDMA.GetHellId(), 0, aRetouchePart, &aPageBackgrdColor, pPage->IsRightToLeft(), &aSwRedirector ); - pSh->Imp()->PaintLayer( pIDDMA->GetHeavenId(), 0, + pSh->Imp()->PaintLayer( rIDDMA.GetHeavenId(), 0, aRetouchePart, &aPageBackgrdColor, pPage->IsRightToLeft(), &aSwRedirector ); @@ -7703,11 +7703,11 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap ) // OD 09.12.2002 #103045# - determine page, fly frame is on const SwPageFrm* pFlyPage = pFly->FindPageFrm(); const Color aPageBackgrdColor(pFlyPage->GetDrawBackgrdColor()); - const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = pSh->getIDocumentDrawModelAccess(); // --> OD #i76669# SwViewObjectContactRedirector aSwRedirector( *pSh ); // <-- - pImp->PaintLayer( pIDDMA->GetHellId(), 0, aOut, &aPageBackgrdColor, + pImp->PaintLayer( rIDDMA.GetHellId(), 0, aOut, &aPageBackgrdColor, pFlyPage->IsRightToLeft(), &aSwRedirector ); gProp.pSLines->PaintLines( pDev, gProp ); @@ -7715,7 +7715,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap ) pFly->Paint( *pDev, aOut ); gProp.pSLines->PaintLines( pDev, gProp ); // OD 30.08.2002 #102450# - add 3rd parameter - pImp->PaintLayer( pIDDMA->GetHeavenId(), 0, aOut, &aPageBackgrdColor, + pImp->PaintLayer( rIDDMA.GetHeavenId(), 0, aOut, &aPageBackgrdColor, pFlyPage->IsRightToLeft(), &aSwRedirector ); gProp.pSLines->PaintLines( pDev, gProp ); @@ -7748,7 +7748,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap ) Graphic SwDrawFrameFormat::MakeGraphic( ImageMap* ) { Graphic aRet; - SwDrawModel* pMod = getIDocumentDrawModelAccess()->GetDrawModel(); + SwDrawModel* pMod = getIDocumentDrawModelAccess().GetDrawModel(); if ( pMod ) { SdrObject *pObj = FindSdrObject(); diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index ef889db091aa..f5fe4fe3e09a 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -1263,7 +1263,7 @@ void SwSectionFrm::Format( vcl::RenderContext* pRenderContext, const SwBorderAtt // and releases this position lock keeping on destruction. ExtraFormatToPositionObjs aExtraFormatToPosObjs( *this ); if ( !bMaximize && - GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) && + GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) && !GetFormat()->GetBalancedColumns().GetValue() ) { aExtraFormatToPosObjs.FormatSectionToPositionObjs(); @@ -1964,7 +1964,7 @@ SwTwips SwSectionFrm::_Grow( SwTwips nDist, bool bTst ) // was moved forward due to the positioning of its objects ). // Thus, invalivate this next frame, if document compatibility // option 'Consider wrapping style influence on object positioning' is ON. - else if ( GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + else if ( GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { InvalidateNextPos(); } diff --git a/sw/source/core/layout/sortedobjs.cxx b/sw/source/core/layout/sortedobjs.cxx index ea26372c06f3..2a6dfb1180f9 100644 --- a/sw/source/core/layout/sortedobjs.cxx +++ b/sw/source/core/layout/sortedobjs.cxx @@ -156,9 +156,9 @@ struct ObjAnchorOrder // objects anchored at the same content and at the same content anchor // node position with the same anchor type // Thus, compare its wrapping style including its layer - const IDocumentDrawModelAccess* pIDDMA = rFormatListed.getIDocumentDrawModelAccess(); - const SdrLayerID nHellId = pIDDMA->GetHellId(); - const SdrLayerID nInvisibleHellId = pIDDMA->GetInvisibleHellId(); + const IDocumentDrawModelAccess& rIDDMA = rFormatListed.getIDocumentDrawModelAccess(); + const SdrLayerID nHellId = rIDDMA.GetHellId(); + const SdrLayerID nInvisibleHellId = rIDDMA.GetInvisibleHellId(); const bool bWrapThroughOrHellListed = rFormatListed.GetSurround().GetSurround() == SURROUND_THROUGHT || _pListedAnchoredObj->GetDrawObj()->GetLayer() == nHellId || diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index bd2b6315cba4..8bb796a1f2da 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2537,14 +2537,14 @@ bool SwTabFrm::CalcFlyOffsets( SwTwips& rUpper, // --> #108724# Page header/footer content doesn't have to wrap around // floating screen objects - const IDocumentSettingAccess* pIDSA = GetFormat()->getIDocumentSettingAccess(); - const bool bWrapAllowed = pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) || + const IDocumentSettingAccess& rIDSA = GetFormat()->getIDocumentSettingAccess(); + const bool bWrapAllowed = rIDSA.get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) || ( !IsInFootnote() && 0 == FindFooterOrHeader() ); if ( pPage->GetSortedObjs() && bWrapAllowed ) { SWRECTFN( this ) - const bool bConsiderWrapOnObjPos = pIDSA->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION); + const bool bConsiderWrapOnObjPos = rIDSA.get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION); long nPrtPos = (Frm().*fnRect->fnGetTop)(); nPrtPos = (*fnRect->fnYInc)( nPrtPos, rUpper ); SwRect aRect( Frm() ); @@ -2865,7 +2865,7 @@ void SwTabFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAtt // #i26250# - extend bottom printing area, if table // is last content inside a table cell. - if ( GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) && + if ( GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) && GetUpper()->IsInTab() && !GetIndNext() ) { nLower += pAttrs->GetULSpace().GetLower(); @@ -2980,7 +2980,7 @@ SwTwips SwTabFrm::GrowFrm( SwTwips nDist, bool bTst, bool bInfo ) // forward due to the positioning of its objects ). Thus, invalivate this // next frame, if document compatibility option 'Consider wrapping style // influence on object positioning' is ON. - else if ( GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + else if ( GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { InvalidateNextPos(); } @@ -4843,7 +4843,7 @@ void SwCellFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAt // #i43913# - no vertical alignment, if wrapping // style influence is considered on object positioning and // an object is anchored inside the cell. - const bool bConsiderWrapOnObjPos( GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ); + const bool bConsiderWrapOnObjPos( GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ); //No alignment if border with flow overlaps the cell. if ( pPg->GetSortedObjs() ) { diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 9ab790c357fa..1548af234669 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -81,7 +81,7 @@ SwFrm::SwFrm( SwModify *pMod, SwFrm* pSib ) : mbForbidDelete = false; } -const IDocumentDrawModelAccess* SwFrm::getIDocumentDrawModelAccess() +const IDocumentDrawModelAccess& SwFrm::getIDocumentDrawModelAccess() { return GetUpper()->GetFormat()->getIDocumentDrawModelAccess(); } @@ -1732,7 +1732,7 @@ SwTwips SwContentFrm::GrowFrm( SwTwips nDist, bool bTst, bool bInfo ) // due to the positioning of its objects ). Thus, invalivate this next frame, // if document compatibility option 'Consider wrapping style influence on // object positioning' is ON. - else if ( GetUpper()->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + else if ( GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { InvalidateNextPos(); } @@ -1798,7 +1798,7 @@ SwTwips SwContentFrm::GrowFrm( SwTwips nDist, bool bTst, bool bInfo ) { GetNext()->InvalidatePos(); } - else if ( GetUpper()->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) + else if ( GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) ) { InvalidateNextPos(); } @@ -2046,7 +2046,7 @@ void SwContentFrm::_UpdateAttr( const SfxPoolItem* pOld, const SfxPoolItem* pNew } // OD 2004-03-17 #i11860# if ( GetIndNext() && - !GetUpper()->GetFormat()->getIDocumentSettingAccess()->get(DocumentSettingId::USE_FORMER_OBJECT_POS) ) + !GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_OBJECT_POS) ) { // OD 2004-07-01 #i28701# - use new method <InvalidateObjs(..)> GetIndNext()->InvalidateObjs( true ); @@ -2066,9 +2066,9 @@ void SwContentFrm::_UpdateAttr( const SfxPoolItem* pOld, const SfxPoolItem* pNew case RES_BREAK: { rInvFlags |= 0x42; - const IDocumentSettingAccess* pIDSA = GetUpper()->GetFormat()->getIDocumentSettingAccess(); - if( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX) || - pIDSA->get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) ) + const IDocumentSettingAccess& rIDSA = GetUpper()->GetFormat()->getIDocumentSettingAccess(); + if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) || + rIDSA.get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) ) { rInvFlags |= 0x1; SwFrm* pNxt = FindNext(); diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index b4e63e36d8ae..4d5373084e59 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -121,7 +121,7 @@ void SwAnchoredObjectPosition::_GetInfoAboutObj() // - it doesn't follow the text flow { mbDoNotCaptureAnchoredObj = !mbIsObjFly && !mbFollowTextFlow && - mpFrameFormat->getIDocumentSettingAccess()->get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE); + mpFrameFormat->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE); } } @@ -411,7 +411,7 @@ SwTwips SwAnchoredObjectPosition::_ImplAdjustVertRelPos( const SwTwips nTopOfAnc { // #i26945# - no extension of restricted area, if // object's attribute follow text flow is set and its inside a table - if ( GetFrameFormat().getIDocumentSettingAccess()->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) && + if ( GetFrameFormat().getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) && ( !bFollowTextFlow || !GetAnchoredObj().GetAnchorFrm()->IsInTab() ) ) { diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 2a679f443b0a..41afd1586320 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -207,7 +207,7 @@ void* lcl_GetKeyFromFrame( const SwFrm& rFrm ) void* pKey = 0; if ( rFrm.IsPageFrm() ) - pKey = const_cast<void*>(static_cast<void const *>((static_cast<const SwPageFrm&>(rFrm).GetFormat()->getIDocumentSettingAccess()))); + pKey = const_cast<void*>(static_cast<void const *>(&(static_cast<const SwPageFrm&>(rFrm).GetFormat()->getIDocumentSettingAccess()))); else if ( rFrm.IsTextFrm() ) pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwTextFrm&>(rFrm).GetTextNode())); else if ( rFrm.IsSctFrm() ) diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 86d173fd1d4f..d5ee4eec2121 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -1378,7 +1378,7 @@ void SwTextFrm::FillCrsrPos( SwFillData& rFill ) const } OutputDevice* pOut = pSh->GetOut(); if( !pSh->GetViewOptions()->getBrowseMode() || pSh->GetViewOptions()->IsPrtFormat() ) - pOut = GetTextNode()->getIDocumentDeviceAccess()->getReferenceDevice( true ); + pOut = GetTextNode()->getIDocumentDeviceAccess().getReferenceDevice( true ); pFnt->SetFntChg( true ); pFnt->ChgPhysFnt( pSh, *pOut ); diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 2381383b36d1..03bce1496595 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -122,7 +122,7 @@ SwExtraPainter::SwExtraPainter( const SwTextFrm *pFrm, SwViewShell *pVwSh, */ nDivider = !rLineInf.GetDivider().isEmpty() ? rLineInf.GetDividerCountBy() : 0; nX = pFrm->Frm().Left(); - SwCharFormat* pFormat = rLineInf.GetCharFormat( const_cast<IDocumentStylePoolAccess&>(*pFrm->GetNode()->getIDocumentStylePoolAccess()) ); + SwCharFormat* pFormat = rLineInf.GetCharFormat( const_cast<IDocumentStylePoolAccess&>(pFrm->GetNode()->getIDocumentStylePoolAccess()) ); OSL_ENSURE( pFormat, "PaintExtraData without CharFormat" ); pFnt = new SwFont( &pFormat->GetAttrSet(), pFrm->GetTextNode()->getIDocumentSettingAccess() ); pFnt->Invalidate(); @@ -285,13 +285,13 @@ void SwTextFrm::PaintExtraData( const SwRect &rRect ) const return; const SwTextNode& rTextNode = *GetTextNode(); - const IDocumentRedlineAccess* pIDRA = rTextNode.getIDocumentRedlineAccess(); + const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess(); const SwLineNumberInfo &rLineInf = rTextNode.GetDoc()->GetLineNumberInfo(); const SwFormatLineNumber &rLineNum = GetAttrSet()->GetLineNumber(); bool bLineNum = !IsInTab() && rLineInf.IsPaintLineNumbers() && ( !IsInFly() || rLineInf.IsCountInFlys() ) && rLineNum.IsCount(); sal_Int16 eHor = (sal_Int16)SW_MOD()->GetRedlineMarkPos(); - if( eHor != text::HoriOrientation::NONE && !IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) ) + if( eHor != text::HoriOrientation::NONE && !IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) eHor = text::HoriOrientation::NONE; bool bRedLine = eHor != text::HoriOrientation::NONE; if ( bLineNum || bRedLine ) @@ -384,7 +384,7 @@ void SwTextFrm::PaintExtraData( const SwRect &rRect ) const } else { - if ( USHRT_MAX == pIDRA->GetRedlinePos(rTextNode, USHRT_MAX) ) + if ( USHRT_MAX == rIDRA.GetRedlinePos(rTextNode, USHRT_MAX) ) bRedLine = false; if( bLineNum && rLineInf.IsCountBlankLines() && @@ -478,10 +478,10 @@ bool SwTextFrm::PaintEmpty( const SwRect &rRect, bool bCheck ) const pFnt = new SwFont( aFontAccess.Get()->GetFont() ); } - const IDocumentRedlineAccess* pIDRA = rTextNode.getIDocumentRedlineAccess(); - if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) ) + const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess(); + if( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) { - const sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTextNode, USHRT_MAX ); + const sal_uInt16 nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); if( USHRT_MAX != nRedlPos ) { SwAttrHandler aAttrHandler; diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 3a38002ecd67..089318b71eff 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -277,7 +277,7 @@ void SwTextSizeInfo::CtorInitTextSizeInfo( OutputDevice* pRenderContext, SwTextF m_pOut = Application::GetDefaultDevice(); } else - m_pOut = pNd->getIDocumentDeviceAccess()->getPrinter( false ); + m_pOut = pNd->getIDocumentDeviceAccess().getPrinter( false ); m_pRef = m_pOut; } diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 3315f8bfd65b..d4347bd2efe3 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -414,7 +414,7 @@ bool SwTextNode::IsSymbol( const sal_Int32 nBegin ) const SwAttrIter aIter( *const_cast<SwTextNode*>(this), aScriptInfo ); aIter.Seek( nBegin ); return aIter.GetFnt()->IsSymbol( - const_cast<SwViewShell *>(getIDocumentLayoutAccess()->GetCurrentViewShell()) ); + const_cast<SwViewShell *>(getIDocumentLayoutAccess().GetCurrentViewShell()) ); } class SwMinMaxNodeArgs @@ -665,7 +665,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM case CHAR_HARDHYPHEN: { OUString sTmp( cChar ); - SwDrawTextInfo aDrawInf( getIDocumentLayoutAccess()->GetCurrentViewShell(), + SwDrawTextInfo aDrawInf( getIDocumentLayoutAccess().GetCurrentViewShell(), *pOut, 0, sTmp, 0, 1, 0, false ); nAktWidth = aIter.GetFnt()->_GetTextSize( aDrawInf ).Width(); aArg.nWordWidth += nAktWidth; @@ -799,7 +799,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd if ( getIDocumentSettingAccess()->get(DocumentSettingId::HTML_MODE) ) pOut = Application::GetDefaultDevice(); else - pOut = getIDocumentDeviceAccess()->getReferenceDevice( true ); + pOut = getIDocumentDeviceAccess().getReferenceDevice( true ); } OSL_ENSURE( pOut, "GetScalingOfSelectedText without outdev" ); diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 894c033ca1fb..93d4162d507e 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -1334,7 +1334,7 @@ void SwScriptInfo::DeleteHiddenRanges( SwTextNode& rNode ) nHiddenStart = *(rFirst++); SwPaM aPam( rNode, nHiddenStart, rNode, nHiddenEnd ); - rNode.getIDocumentContentOperations()->DeleteRange( aPam ); + rNode.getIDocumentContentOperations().DeleteRange( aPam ); } } @@ -2091,7 +2091,7 @@ void SwScriptInfo::selectRedLineDeleted(const SwTextNode& rNode, MultiSelection assert((rNode.GetText().isEmpty() && rHiddenMulti.GetTotalRange().Len() == 1) || (rNode.GetText().getLength() == rHiddenMulti.GetTotalRange().Len())); - const IDocumentRedlineAccess& rIDRA = *rNode.getIDocumentRedlineAccess(); + const IDocumentRedlineAccess& rIDRA = rNode.getIDocumentRedlineAccess(); if ( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) { sal_uInt16 nAct = rIDRA.GetRedlinePos( rNode, USHRT_MAX ); diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 5e78961844a9..c2b029ebc37a 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -244,13 +244,13 @@ SwTwips SwTextFrm::EmptyHeight() const if ( !pOut || !pSh->GetViewOptions()->getBrowseMode() || pSh->GetViewOptions()->IsPrtFormat() ) { - pOut = rTextNode.getIDocumentDeviceAccess()->getReferenceDevice(true); + pOut = rTextNode.getIDocumentDeviceAccess().getReferenceDevice(true); } - const IDocumentRedlineAccess* pIDRA = rTextNode.getIDocumentRedlineAccess(); - if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) ) + const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess(); + if( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) { - const sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTextNode, USHRT_MAX ); + const sal_uInt16 nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); if( USHRT_MAX != nRedlPos ) { SwAttrHandler aAttrHandler; @@ -384,7 +384,7 @@ bool SwTextFrm::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff ) OutputDevice *pOut = 0; if( !pSh || !pSh->GetViewOptions()->getBrowseMode() || pSh->GetViewOptions()->IsPrtFormat() ) - pOut = GetTextNode()->getIDocumentDeviceAccess()->getReferenceDevice( true ); + pOut = GetTextNode()->getIDocumentDeviceAccess().getReferenceDevice( true ); if( pSh && !pOut ) pOut = pSh->GetWin(); diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 9edc033e5eae..b9ce387cb16e 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -46,7 +46,7 @@ using namespace ::com::sun::star; void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf, SwTextFrm* pFrm ) { // during HTML-Import it can happen, that no layout exists - SwRootFrm* pRootFrm = rTextNode.getIDocumentLayoutAccess()->GetCurrentLayout(); + SwRootFrm* pRootFrm = rTextNode.getIDocumentLayoutAccess().GetCurrentLayout(); pShell = pRootFrm ? pRootFrm->GetCurrShell() : 0; pScriptInfo = &rScrInf; @@ -126,13 +126,13 @@ void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf, nStartIndex = nEndIndex = nPos = nChgCnt = 0; nPropFont = 0; SwDoc* pDoc = rTextNode.GetDoc(); - const IDocumentRedlineAccess* pIDRA = rTextNode.getIDocumentRedlineAccess(); + const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess(); const SwExtTextInput* pExtInp = pDoc->GetExtTextInput( rTextNode ); - const bool bShow = IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ); + const bool bShow = IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ); if( pExtInp || bShow ) { - const sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTextNode, USHRT_MAX ); + const sal_uInt16 nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); if( pExtInp || USHRT_MAX != nRedlPos ) { const std::vector<sal_uInt16> *pArr = 0; diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 1f79bba70d0b..a959e71ed576 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -501,7 +501,7 @@ bool SwTextFly::DrawTextOpaque( SwDrawTextInfo &rInf ) SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 ); if ( bOn && nCount > 0 ) { - const sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess()->GetHellId(); + const sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess().GetHellId(); for( SwAnchoredObjList::size_type i = 0; i < nCount; ++i ) { // #i68520# @@ -589,7 +589,7 @@ void SwTextFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect, SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 ); if ( bOn && nCount > 0 ) { - const sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess()->GetHellId(); + const sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess().GetHellId(); for( SwAnchoredObjList::size_type i = 0; i < nCount; ++i ) { // #i68520# @@ -899,7 +899,7 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList() const long nLeft = (aRect.*fnRect->fnGetLeft)() + 1; const bool bR2L = pCurrFrm->IsRightToLeft(); - const IDocumentDrawModelAccess* pIDDMA = pCurrFrm->GetTextNode()->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess& rIDDMA = pCurrFrm->GetTextNode()->getIDocumentDrawModelAccess(); for( size_t i = 0; i < nCount; ++i ) { @@ -914,7 +914,7 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList() SwAnchoredObject* pAnchoredObj = (*pSorted)[ i ]; assert(pAnchoredObj); if ( !pAnchoredObj || - !pIDDMA->IsVisibleLayerId( pAnchoredObj->GetDrawObj()->GetLayer() ) || + !rIDDMA.IsVisibleLayerId( pAnchoredObj->GetDrawObj()->GetLayer() ) || !pAnchoredObj->ConsiderForTextWrap() || ( mbIgnoreObjsInHeaderFooter && !bFooterHeader && pAnchoredObj->GetAnchorFrm()->FindFooterOrHeader() ) ) diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 9ed3750e0772..397996b031ed 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1334,7 +1334,7 @@ void SwTextFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) } // switch if( bSetFieldsDirty ) - GetNode()->getIDocumentFieldsAccess()->SetFieldsDirty( true, GetNode(), 1 ); + GetNode()->getIDocumentFieldsAccess().SetFieldsDirty( true, GetNode(), 1 ); if ( bRecalcFootnoteFlag ) CalcFootnoteFlag(); @@ -2244,7 +2244,7 @@ void SwTextFrm::_CalcHeightOfLastLine( const bool _bUseFont ) if ( !pVsh->GetViewOptions()->getBrowseMode() || pVsh->GetViewOptions()->IsPrtFormat() ) { - pOut = GetTextNode()->getIDocumentDeviceAccess()->getReferenceDevice( true ); + pOut = GetTextNode()->getIDocumentDeviceAccess().getReferenceDevice( true ); } OSL_ENSURE( pOut, "<SwTextFrm::_GetHeightOfLastLineForPropLineSpacing()> - no OutputDevice" ); // #i78921# - make code robust, according to provided patch diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index dc1a2f71899d..0b965860a705 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -643,7 +643,7 @@ void SwTextFrm::ConnectFootnote( SwTextFootnote *pFootnote, const SwTwips nDeadL SwFootnoteFrm *pNew = new SwFootnoteFrm(pDoc->GetDfltFrameFormat(),this,this,pFootnote); SwNodeIndex aIdx( *pFootnote->GetStartNode(), 1 ); ::_InsertCnt( pNew, pDoc, aIdx.GetIndex() ); - GetNode()->getIDocumentLayoutAccess()->GetLayouter()->CollectEndnote( pNew ); + GetNode()->getIDocumentLayoutAccess().GetLayouter()->CollectEndnote( pNew ); } else if( pSrcFrm != this ) SwFootnoteBossFrm::ChangeFootnoteRef( pSrcFrm, pFootnote, this ); diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 0a25e5921637..4445da495c54 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -402,8 +402,8 @@ void SwTextField::CopyTextField( SwTextField *pDest ) const OSL_ENSURE( m_pTextNode, "SwTextField: where is my TextNode?" ); OSL_ENSURE( pDest->m_pTextNode, "SwTextField: where is pDest's TextNode?" ); - IDocumentFieldsAccess* pIDFA = m_pTextNode->getIDocumentFieldsAccess(); - IDocumentFieldsAccess* pDestIDFA = pDest->m_pTextNode->getIDocumentFieldsAccess(); + IDocumentFieldsAccess* pIDFA = &m_pTextNode->getIDocumentFieldsAccess(); + IDocumentFieldsAccess* pDestIDFA = &pDest->m_pTextNode->getIDocumentFieldsAccess(); SwFormatField& rDestFormatField = (SwFormatField&)pDest->GetFormatField(); const sal_uInt16 nFieldWhich = rDestFormatField.GetField()->GetTyp()->Which(); diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 4f458bde1653..a106cbdf1172 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -379,7 +379,7 @@ sal_uInt16 SwFntObj::GetFontLeading( const SwViewShell *pSh, const OutputDevice& nExtLeading = 0; } - const IDocumentSettingAccess& rIDSA = *pSh->getIDocumentSettingAccess(); + const IDocumentSettingAccess& rIDSA = pSh->getIDocumentSettingAccess(); const bool bBrowse = ( pSh->GetWin() && pSh->GetViewOptions()->getBrowseMode() && !pSh->GetViewOptions()->IsPrtFormat() ); diff --git a/sw/source/core/txtnode/swfntcch.cxx b/sw/source/core/txtnode/swfntcch.cxx index e867b1dcd7ac..a21ca2414b38 100644 --- a/sw/source/core/txtnode/swfntcch.cxx +++ b/sw/source/core/txtnode/swfntcch.cxx @@ -31,7 +31,7 @@ SwFontCache *pSwFontCache = NULL; SwFontObj::SwFontObj( const void *pOwn, SwViewShell *pSh ) : SwCacheObj( pOwn ), - aSwFont( &static_cast<SwTextFormatColl const *>(pOwn)->GetAttrSet(), pSh ? pSh->getIDocumentSettingAccess() : 0 ) + aSwFont( &static_cast<SwTextFormatColl const *>(pOwn)->GetAttrSet(), pSh ? &pSh->getIDocumentSettingAccess() : 0 ) { aSwFont.GoMagic( pSh, aSwFont.GetActual() ); const SwAttrSet& rAttrSet = static_cast<SwTextFormatColl const *>(pOwn)->GetAttrSet(); diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index e6bc9af235e6..bd54dde1f043 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -216,7 +216,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) } SwDoc *const pDoc = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pDoc) { throw lang::IllegalArgumentException(); diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index d1b01a48f8cd..251fa0a726ba 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -2107,14 +2107,14 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange) sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXParagraph::getUnoTunnelId( ) ) ) ); if (pRange) - pDoc = pRange->GetDoc(); + pDoc = &pRange->GetDoc(); else if (!pDoc && pText) pDoc = pText->GetDoc(); else if (!pDoc && pCursor) pDoc = pCursor->GetDoc(); - else if ( !pDoc && pPortion && pPortion->GetCursor() ) + else if ( !pDoc && pPortion ) { - pDoc = pPortion->GetCursor()->GetDoc(); + pDoc = pPortion->GetCursor().GetDoc(); } else if ( !pDoc && pParagraph && pParagraph->GetTextNode( ) ) { diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index bf114b3c7875..507a6ce80509 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1343,7 +1343,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) )); } - SwDoc* pDoc = pRange ? pRange->GetDoc() : pCursor ? pCursor->GetDoc() : 0; + SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor ? pCursor->GetDoc() : 0; // if a FieldMaster was attached, then the document is already fixed! // NOTE: sw.SwXAutoTextEntry unoapi test depends on m_pDoc = 0 being valid if (!pDoc || (m_pImpl->m_pDoc && m_pImpl->m_pDoc != pDoc)) diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 22fe58a24212..7922c37e8b9f 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -284,8 +284,8 @@ void SAL_CALL SwXFlatParagraph::changeText(::sal_Int32 nPos, ::sal_Int32 nLen, c xPropSet->setPropertyValue( aAttributes[i].Name, aAttributes[i].Value ); } - IDocumentContentOperations* pIDCO = pOldTextNode->getIDocumentContentOperations(); - pIDCO->ReplaceRange( aPaM, aNewText, false ); + IDocumentContentOperations& rIDCO = pOldTextNode->getIDocumentContentOperations(); + rIDCO.ReplaceRange( aPaM, aNewText, false ); ClearTextNode(); // TODO: is this really needed? } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index c39ccd302c58..19c702f95ae7 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2707,7 +2707,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) )); } - SwDoc* pDoc = pRange ? pRange->GetDoc() : pCursor ? pCursor->GetDoc() : 0; + SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor ? pCursor->GetDoc() : 0; if(pDoc) { SwUnoInternalPaM aIntPam(*pDoc); diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index 6ef75b28422f..004c30a0ff27 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -300,7 +300,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) OTextCursorHelper *const pCursor = ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); SwDoc *const pNewDoc = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pNewDoc) { throw lang::IllegalArgumentException(); @@ -431,8 +431,8 @@ SwXFootnote::createTextCursor() throw (uno::RuntimeException, std::exception) SwPosition aPos( *pTextFootnote->GetStartNode() ); SwXTextCursor *const pXCursor = new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE, aPos); - auto pUnoCrsr(pXCursor->GetCursor()); - pUnoCrsr->Move(fnMoveForward, fnGoNode); + auto& rUnoCrsr(pXCursor->GetCursor()); + rUnoCrsr.Move(fnMoveForward, fnGoNode); const uno::Reference< text::XTextCursor > xRet = static_cast<text::XWordCursor*>(pXCursor); return xRet; diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 2c96470f1389..b8f6d0aeb513 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -1345,7 +1345,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); SwDoc *const pDoc = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pDoc) { throw lang::IllegalArgumentException(); @@ -1839,7 +1839,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) OTextCursorHelper *const pCursor = ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); SwDoc *const pDoc = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pDoc) { throw lang::IllegalArgumentException(); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index dc0c45c8171c..cd4cd0a16216 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -686,8 +686,8 @@ public: } }; -SwUnoCrsr*SwXTextCursor::GetCursor() - { return &(*m_pImpl->m_pUnoCursor); } +SwUnoCrsr& SwXTextCursor::GetCursor() + { return *m_pImpl->m_pUnoCursor; } SwPaM const* SwXTextCursor::GetPaM() const { return &(*m_pImpl->m_pUnoCursor); } diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 0bab22047f18..e1bdf2e79c5f 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -481,7 +481,7 @@ struct SwXParagraphEnumerationImpl SAL_FINAL : public SwXParagraphEnumeration if ((CURSOR_SELECTION == m_eCursorType) || (CURSOR_SELECTION_IN_TABLE == m_eCursorType)) { - SwUnoCrsr & rCursor = *GetCursor(); + SwUnoCrsr & rCursor = GetCursor(); rCursor.Normalize(); m_nFirstParaStart = rCursor.GetPoint()->nContent.GetIndex(); m_nLastParaEnd = rCursor.GetMark()->nContent.GetIndex(); @@ -509,8 +509,8 @@ struct SwXParagraphEnumerationImpl SAL_FINAL : public SwXParagraphEnumeration virtual sal_Bool SAL_CALL hasMoreElements() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual ::com::sun::star::uno::Any SAL_CALL nextElement() throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - SwUnoCrsr* GetCursor() - { return &(*m_pCrsr); } + SwUnoCrsr& GetCursor() + { return *m_pCrsr; } uno::Reference< text::XTextContent > NextElement_Impl() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); }; @@ -569,19 +569,15 @@ lcl_CursorIsInSection( uno::Reference< text::XTextContent > SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - SwUnoCrsr *const pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - { - throw uno::RuntimeException(); - } + SwUnoCrsr& rUnoCrsr = GetCursor(); // check for exceeding selections if (!m_bFirstParagraph && ((CURSOR_SELECTION == m_eCursorType) || (CURSOR_SELECTION_IN_TABLE == m_eCursorType))) { - SwPosition* pStart = pUnoCrsr->Start(); - auto aNewCrsr(pUnoCrsr->GetDoc()->CreateUnoCrsr(*pStart, false)); + SwPosition* pStart = rUnoCrsr.Start(); + auto aNewCrsr(rUnoCrsr.GetDoc()->CreateUnoCrsr(*pStart, false)); // one may also go into tables here if ((CURSOR_TBLTEXT != m_eCursorType) && (CURSOR_SELECTION_IN_TABLE != m_eCursorType)) @@ -611,15 +607,15 @@ SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementE bool bInTable = false; if (!m_bFirstParagraph) { - pUnoCrsr->SetRemainInSection( false ); + rUnoCrsr.SetRemainInSection( false ); // what to do if already in a table? - SwTableNode * pTableNode = pUnoCrsr->GetNode().FindTableNode(); + SwTableNode * pTableNode = rUnoCrsr.GetNode().FindTableNode(); pTableNode = lcl_FindTopLevelTable( pTableNode, m_pOwnTable ); if (pTableNode && (&pTableNode->GetTable() != m_pOwnTable)) { // this is a foreign table: go to end - pUnoCrsr->GetPoint()->nNode = pTableNode->EndOfSectionIndex(); - if (!pUnoCrsr->Move(fnMoveForward, fnGoNode)) + rUnoCrsr.GetPoint()->nNode = pTableNode->EndOfSectionIndex(); + if (!rUnoCrsr.Move(fnMoveForward, fnGoNode)) { return 0; } @@ -630,19 +626,19 @@ SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementE uno::Reference< text::XTextContent > xRef; // the cursor must remain in the current section or a subsection // before AND after the movement... - if (lcl_CursorIsInSection( pUnoCrsr, m_pOwnStartNode ) && + if (lcl_CursorIsInSection( &rUnoCrsr, m_pOwnStartNode ) && (m_bFirstParagraph || bInTable || - (pUnoCrsr->MovePara(fnParaNext, fnParaStart) && - lcl_CursorIsInSection( pUnoCrsr, m_pOwnStartNode )))) + (rUnoCrsr.MovePara(fnParaNext, fnParaStart) && + lcl_CursorIsInSection( &rUnoCrsr, m_pOwnStartNode )))) { - SwPosition* pStart = pUnoCrsr->Start(); + SwPosition* pStart = rUnoCrsr.Start(); const sal_Int32 nFirstContent = (m_bFirstParagraph) ? m_nFirstParaStart : -1; const sal_Int32 nLastContent = (m_nEndIndex == pStart->nNode.GetIndex()) ? m_nLastParaEnd : -1; // position in a table, or in a simple paragraph? - SwTableNode * pTableNode = pUnoCrsr->GetNode().FindTableNode(); + SwTableNode * pTableNode = rUnoCrsr.GetNode().FindTableNode(); pTableNode = lcl_FindTopLevelTable( pTableNode, m_pOwnTable ); if (/*CURSOR_TBLTEXT != eCursorType && CURSOR_SELECTION_IN_TABLE != eCursorType && */ pTableNode && (&pTableNode->GetTable() != m_pOwnTable)) @@ -655,7 +651,7 @@ SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementE else { text::XText *const pText = m_xParentText.get(); - xRef = SwXParagraph::CreateXParagraph(*pUnoCrsr->GetDoc(), + xRef = SwXParagraph::CreateXParagraph(*rUnoCrsr.GetDoc(), pStart->nNode.GetNode().GetTextNode(), static_cast<SwXText*>(pText), nFirstContent, nLastContent); } @@ -781,14 +777,14 @@ SwXTextRange::~SwXTextRange() { } -const SwDoc * SwXTextRange::GetDoc() const +const SwDoc& SwXTextRange::GetDoc() const { - return & m_pImpl->m_rDoc; + return m_pImpl->m_rDoc; } -SwDoc * SwXTextRange::GetDoc() +SwDoc& SwXTextRange::GetDoc() { - return & m_pImpl->m_rDoc; + return m_pImpl->m_rDoc; } void SwXTextRange::Invalidate() @@ -815,7 +811,7 @@ throw (uno::RuntimeException) throw uno::RuntimeException(); } - const SwPosition aPos(GetDoc()->GetNodes().GetEndOfContent()); + const SwPosition aPos(GetDoc().GetNodes().GetEndOfContent()); SwCursor aCursor(aPos, 0, false); if (GetPositions(aCursor)) { @@ -976,7 +972,7 @@ OUString SAL_CALL SwXTextRange::getString() throw (uno::RuntimeException, std::e OUString sRet; // for tables there is no bookmark, thus also no text // one could export the table as ASCII here maybe? - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); if (GetPositions(aPaM) && aPaM.HasMark()) { SwUnoCursorHelper::GetTextFromPam(aPaM, sRet); @@ -1049,7 +1045,7 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill, pCursor = ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xCrsrTunnel); } - if(pRange && pRange->GetDoc() == rToFill.GetDoc()) + if(pRange && &pRange->GetDoc() == rToFill.GetDoc()) { bRet = pRange->GetPositions(rToFill); } @@ -1062,9 +1058,9 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill, else { SwDoc* const pDoc = (pCursor) ? pCursor->GetDoc() - : ((pPortion) ? pPortion->GetCursor()->GetDoc() : 0); + : ((pPortion) ? pPortion->GetCursor().GetDoc() : 0); const SwPaM* const pUnoCrsr = (pCursor) ? pCursor->GetPaM() - : ((pPortion) ? pPortion->GetCursor() : 0); + : ((pPortion) ? &pPortion->GetCursor() : 0); if (pUnoCrsr && pDoc == rToFill.GetDoc()) { OSL_ENSURE(!pUnoCrsr->IsMultiSelection(), @@ -1252,11 +1248,11 @@ throw (uno::RuntimeException, std::exception) throw uno::RuntimeException(); } - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - const SwPosition aPos(GetDoc()->GetNodes().GetEndOfContent()); + const SwPosition aPos(GetDoc().GetNodes().GetEndOfContent()); const auto pNewCrsr(m_pImpl->m_rDoc.CreateUnoCrsr(aPos, false)); if (!GetPositions(*pNewCrsr)) { @@ -1271,11 +1267,11 @@ SwXTextRange::createEnumeration() throw (uno::RuntimeException, std::exception) { SolarMutexGuard g; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - const SwPosition aPos(GetDoc()->GetNodes().GetEndOfContent()); + const SwPosition aPos(GetDoc().GetNodes().GetEndOfContent()); auto pNewCrsr(m_pImpl->m_rDoc.CreateUnoCrsr(aPos, false)); if (!GetPositions(*pNewCrsr)) { @@ -1329,11 +1325,11 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); SwUnoCursorHelper::SetPropertyValue(aPaM, m_pImpl->m_rPropSet, rPropertyName, rValue); @@ -1346,11 +1342,11 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); return SwUnoCursorHelper::GetPropertyValue(aPaM, m_pImpl->m_rPropSet, rPropertyName); @@ -1402,11 +1398,11 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); return SwUnoCursorHelper::GetPropertyState(aPaM, m_pImpl->m_rPropSet, rPropertyName); @@ -1418,11 +1414,11 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { SolarMutexGuard g; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); return SwUnoCursorHelper::GetPropertyStates(aPaM, m_pImpl->m_rPropSet, rPropertyName); @@ -1433,11 +1429,11 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); SwUnoCursorHelper::SetPropertyToDefault(aPaM, m_pImpl->m_rPropSet, rPropertyName); @@ -1450,11 +1446,11 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); GetPositions(aPaM); return SwUnoCursorHelper::GetPropertyDefault(aPaM, m_pImpl->m_rPropSet, rPropertyName); @@ -1468,11 +1464,11 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - if (!GetDoc() || !m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark()) { throw uno::RuntimeException(); } - SwPaM aPaM(GetDoc()->GetNodes()); + SwPaM aPaM(GetDoc().GetNodes()); SwXTextRange::GetPositions(aPaM); SwUnoCursorHelper::makeRedline( aPaM, rRedlineType, rRedlineProperties ); } @@ -1622,8 +1618,8 @@ struct SwXParaFrameEnumerationImpl SAL_FINAL : public SwXParaFrameEnumeration SolarMutexGuard g; OWeakObject::release(); } - SwUnoCrsr* GetCursor() - { return &(*m_pUnoCursor); } + SwUnoCrsr& GetCursor() + { return *m_pUnoCursor; } void PurgeFrameClients() { if(!m_pUnoCursor) @@ -1658,8 +1654,8 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl( { if (rPaM.HasMark()) { - GetCursor()->SetMark(); - *GetCursor()->GetMark() = *rPaM.GetMark(); + GetCursor().SetMark(); + *GetCursor().GetMark() = *rPaM.GetMark(); } if (PARAFRAME_PORTION_PARAGRAPH == eParaFrameMode) { @@ -1679,7 +1675,7 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl( if (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode) { //get all frames that are bound at paragraph or at character - for(const auto& pFlyFrm : rPaM.GetDoc()->GetAllFlyFormats(GetCursor(), false, true)) + for(const auto& pFlyFrm : rPaM.GetDoc()->GetAllFlyFormats(&GetCursor(), false, true)) { const auto pFrameFormat = const_cast<SwFrameFormat*>(&pFlyFrm->GetFormat()); m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat))); @@ -1754,8 +1750,6 @@ sal_Bool SAL_CALL SwXParaFrameEnumerationImpl::hasMoreElements() throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - if (!GetCursor()) - throw uno::RuntimeException(); PurgeFrameClients(); return m_xNextObject.is() || CreateNextObject(); } @@ -1765,8 +1759,6 @@ throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - if (!GetCursor()) - throw uno::RuntimeException(); PurgeFrameClients(); if (!m_xNextObject.is() && !m_vFrames.empty()) CreateNextObject(); diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index 06080e3d05fb..e4da5c4b07e4 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -150,11 +150,9 @@ throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; uno::Reference< text::XTextRange > xRet; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - SwPaM aPam(*pUnoCrsr->Start()); + SwPaM aPam(*rUnoCrsr.Start()); uno::Reference< text::XText > xParent = getText(); xRet = new SwXTextRange(aPam, xParent); return xRet; @@ -165,11 +163,9 @@ throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; uno::Reference< text::XTextRange > xRet; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - SwPaM aPam(*pUnoCrsr->End()); + SwPaM aPam(*rUnoCrsr.End()); uno::Reference< text::XText > xParent = getText(); xRet = new SwXTextRange(aPam, xParent); return xRet; @@ -180,17 +176,15 @@ throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; OUString aText; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); // TextPortions are always within a paragraph - SwTextNode* pTextNd = pUnoCrsr->GetNode().GetTextNode(); + SwTextNode* pTextNd = rUnoCrsr.GetNode().GetTextNode(); if ( pTextNd ) { - const sal_Int32 nStt = pUnoCrsr->Start()->nContent.GetIndex(); + const sal_Int32 nStt = rUnoCrsr.Start()->nContent.GetIndex(); aText = pTextNd->GetExpandText( nStt, - pUnoCrsr->End()->nContent.GetIndex() - nStt ); + rUnoCrsr.End()->nContent.GetIndex() - nStt ); } return aText; } @@ -198,11 +192,9 @@ throw( uno::RuntimeException, std::exception ) void SwXTextPortion::setString(const OUString& aString) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - SwUnoCursorHelper::SetString(*pUnoCrsr, aString); + SwUnoCursorHelper::SetString(rUnoCrsr, aString); } uno::Reference< beans::XPropertySetInfo > SwXTextPortion::getPropertySetInfo() @@ -228,11 +220,9 @@ void SwXTextPortion::setPropertyValue(const OUString& rPropertyName, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - SwUnoCursorHelper::SetPropertyValue(*pUnoCrsr, *m_pPropSet, + SwUnoCursorHelper::SetPropertyValue(rUnoCrsr, *m_pPropSet, rPropertyName, aValue); } @@ -403,9 +393,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXTextPortion::GetPropertyValues_Impl( const OUString *pPropertyNames = rPropertyNames.getConstArray(); uno::Sequence< uno::Any > aValues(rPropertyNames.getLength()); uno::Any *pValues = aValues.getArray(); - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); { SfxItemSet *pSet = 0; @@ -417,7 +405,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXTextPortion::GetPropertyValues_Impl( const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(pPropertyNames[nProp]); if(pEntry) { - GetPropertyValue( pValues[nProp], *pEntry, pUnoCrsr, pSet ); + GetPropertyValue( pValues[nProp], *pEntry, &rUnoCrsr, pSet ); } else throw beans::UnknownPropertyException( "Unknown property: " + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); @@ -443,9 +431,7 @@ void SAL_CALL SwXTextPortion::SetPropertyValues_Impl( throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); { const OUString* pPropertyNames = rPropertyNames.getConstArray(); @@ -463,7 +449,7 @@ void SAL_CALL SwXTextPortion::SetPropertyValues_Impl( aValues[nProp].Name = pPropertyNames[nProp]; aValues[nProp].Value = pValues[nProp]; } - SwUnoCursorHelper::SetPropertyValues( *pUnoCrsr, *m_pPropSet, aValues ); + SwUnoCursorHelper::SetPropertyValues( rUnoCrsr, *m_pPropSet, aValues ); } } @@ -524,9 +510,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPr if (rPropertyNames.getLength() != rValues.getLength()) throw lang::IllegalArgumentException(); - SwUnoCrsr* pUnoCrsr = this->GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = this->GetCursor(); sal_Int32 nProps = rPropertyNames.getLength(); const OUString *pProp = rPropertyNames.getConstArray(); @@ -558,7 +542,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPr else { SwUnoCursorHelper::SetPropertyValue( - *pUnoCrsr, *m_pPropSet, pProp[i], pValue[i] ); + rUnoCrsr, *m_pPropSet, pProp[i], pValue[i] ); } } } @@ -620,9 +604,7 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion: { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = this->GetCursor(); - if(!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = this->GetCursor(); std::vector< beans::GetDirectPropertyTolerantResult > aResultVector; @@ -638,7 +620,7 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion: uno::Sequence< beans::PropertyState > aPropertyStates = SwUnoCursorHelper::GetPropertyStates( - *pUnoCrsr, *m_pPropSet, + rUnoCrsr, *m_pPropSet, rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT ); const beans::PropertyState* pPropertyStates = aPropertyStates.getConstArray(); @@ -674,7 +656,7 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion: { // get property value // (compare to SwXTextPortion::getPropertyValue(s)) - GetPropertyValue( aResult.Value, *pEntry, pUnoCrsr, pSet ); + GetPropertyValue( aResult.Value, *pEntry, &rUnoCrsr, pSet ); aResult.Result = beans::TolerantPropertySetResultType::SUCCESS; aResultVector.push_back( aResult ); } @@ -770,9 +752,7 @@ beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyN { SolarMutexGuard aGuard; beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); if (GetTextPortionType() == PORTION_RUBY_START && rPropertyName.startsWith("Ruby")) @@ -781,7 +761,7 @@ beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyN } else { - eRet = SwUnoCursorHelper::GetPropertyState(*pUnoCrsr, *m_pPropSet, + eRet = SwUnoCursorHelper::GetPropertyState(rUnoCrsr, *m_pPropSet, rPropertyName); } return eRet; @@ -792,12 +772,10 @@ uno::Sequence< beans::PropertyState > SwXTextPortion::getPropertyStates( throw( beans::UnknownPropertyException, uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if(!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); uno::Sequence< beans::PropertyState > aRet = - SwUnoCursorHelper::GetPropertyStates(*pUnoCrsr, *m_pPropSet, + SwUnoCursorHelper::GetPropertyStates(rUnoCrsr, *m_pPropSet, rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION); if(GetTextPortionType() == PORTION_RUBY_START) @@ -817,12 +795,10 @@ void SwXTextPortion::setPropertyToDefault(const OUString& rPropertyName) throw( beans::UnknownPropertyException, uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); SwUnoCursorHelper::SetPropertyToDefault( - *pUnoCrsr, *m_pPropSet, rPropertyName); + rUnoCrsr, *m_pPropSet, rPropertyName); } uno::Any SwXTextPortion::getPropertyDefault(const OUString& rPropertyName) @@ -830,11 +806,9 @@ uno::Any SwXTextPortion::getPropertyDefault(const OUString& rPropertyName) { SolarMutexGuard aGuard; uno::Any aRet; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - aRet = SwUnoCursorHelper::GetPropertyDefault(*pUnoCrsr, *m_pPropSet, + aRet = SwUnoCursorHelper::GetPropertyDefault(rUnoCrsr, *m_pPropSet, rPropertyName); return aRet; } @@ -843,11 +817,9 @@ uno::Reference< container::XEnumeration > SwXTextPortion::createContentEnumerat throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if(!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); - return SwXParaFrameEnumeration::Create(*pUnoCrsr, PARAFRAME_PORTION_CHAR, m_pFrameFormat); + return SwXParaFrameEnumeration::Create(rUnoCrsr, PARAFRAME_PORTION_CHAR, m_pFrameFormat); } namespace @@ -896,11 +868,6 @@ sal_Bool SwXTextPortion::supportsService(const OUString& rServiceName) throw( un uno::Sequence< OUString > SwXTextPortion::getSupportedServiceNames() throw( uno::RuntimeException, std::exception ) { - SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCursor(); - if (!pUnoCrsr) - throw uno::RuntimeException(); - uno::Sequence< OUString > aRet(7); OUString* pArray = aRet.getArray(); pArray[0] = "com.sun.star.text.TextPortion"; diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index c3cc87864e22..12f91b8a5c83 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -372,7 +372,7 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration( // find all frames, graphics and OLEs that are bound AT character in para FrameClientSortList_t frames; ::CollectFrameAtNode(m_pUnoCrsr->GetPoint()->nNode, frames, true); - lcl_CreatePortions(m_Portions, xParentText, GetCursor(), frames, nStart, nEnd); + lcl_CreatePortions(m_Portions, xParentText, &GetCursor(), frames, nStart, nEnd); } SwXTextPortionEnumeration::SwXTextPortionEnumeration( diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index 23954447767f..1443e42b1913 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -110,26 +110,26 @@ uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursor() SwPosition aPos(aNodeIndex); SwXTextCursor *const pXCursor = new SwXTextCursor(*GetDoc(), this, CURSOR_REDLINE, aPos); - auto pUnoCursor(pXCursor->GetCursor()); - pUnoCursor->Move(fnMoveForward, fnGoNode); + auto& rUnoCursor(pXCursor->GetCursor()); + rUnoCursor.Move(fnMoveForward, fnGoNode); // #101929# prevent a newly created text cursor from running inside a table // because table cells have their own XText. // Patterned after SwXTextFrame::createTextCursor(). // skip all tables at the beginning - SwTableNode* pTableNode = pUnoCursor->GetNode().FindTableNode(); + SwTableNode* pTableNode = rUnoCursor.GetNode().FindTableNode(); SwContentNode* pContentNode = NULL; bool bTable = pTableNode != NULL; while( pTableNode != NULL ) { - pUnoCursor->GetPoint()->nNode = *(pTableNode->EndOfSectionNode()); - pContentNode = GetDoc()->GetNodes().GoNext(&pUnoCursor->GetPoint()->nNode); + rUnoCursor.GetPoint()->nNode = *(pTableNode->EndOfSectionNode()); + pContentNode = GetDoc()->GetNodes().GoNext(&rUnoCursor.GetPoint()->nNode); pTableNode = pContentNode->FindTableNode(); } if( pContentNode != NULL ) - pUnoCursor->GetPoint()->nContent.Assign( pContentNode, 0 ); - if( bTable && pUnoCursor->GetNode().FindSttNodeByType( SwNormalStartNode ) + rUnoCursor.GetPoint()->nContent.Assign( pContentNode, 0 ); + if( bTable && rUnoCursor.GetNode().FindSttNodeByType( SwNormalStartNode ) != GetStartNode() ) { // We have gone too far and have left our own redline. This means that @@ -239,8 +239,8 @@ uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName ) { if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) ) { - SwUnoCrsr* pUnoCrsr = GetCursor(); - uno::Reference<text::XText> xRet = new SwXRedlineText(pUnoCrsr->GetDoc(), *pNodeIdx); + SwUnoCrsr& rUnoCrsr = GetCursor(); + uno::Reference<text::XText> xRet = new SwXRedlineText(rUnoCrsr.GetDoc(), *pNodeIdx); aRet <<= xRet; } else { @@ -260,11 +260,9 @@ uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName ) void SwXRedlinePortion::Validate() throw( uno::RuntimeException ) { - SwUnoCrsr* pUnoCrsr = GetCursor(); - if(!pUnoCrsr) - throw uno::RuntimeException(); + SwUnoCrsr& rUnoCrsr = GetCursor(); //search for the redline - SwDoc* pDoc = pUnoCrsr->GetDoc(); + SwDoc* pDoc = rUnoCrsr.GetDoc(); const SwRedlineTable& rRedTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); bool bFound = false; for(size_t nRed = 0; nRed < rRedTable.size() && !bFound; nRed++) @@ -567,20 +565,20 @@ uno::Reference< text::XTextCursor > SwXRedline::createTextCursor() throw( uno:: SwPosition aPos(*pNodeIndex); SwXTextCursor *const pXCursor = new SwXTextCursor(*pDoc, this, CURSOR_REDLINE, aPos); - auto pUnoCrsr(pXCursor->GetCursor()); - pUnoCrsr->Move(fnMoveForward, fnGoNode); + auto& rUnoCrsr(pXCursor->GetCursor()); + rUnoCrsr.Move(fnMoveForward, fnGoNode); // is here a table? - SwTableNode* pTableNode = pUnoCrsr->GetNode().FindTableNode(); + SwTableNode* pTableNode = rUnoCrsr.GetNode().FindTableNode(); SwContentNode* pCont = 0; while( pTableNode ) { - pUnoCrsr->GetPoint()->nNode = *pTableNode->EndOfSectionNode(); - pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode); + rUnoCrsr.GetPoint()->nNode = *pTableNode->EndOfSectionNode(); + pCont = GetDoc()->GetNodes().GoNext(&rUnoCrsr.GetPoint()->nNode); pTableNode = pCont->FindTableNode(); } if(pCont) - pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0); + rUnoCrsr.GetPoint()->nContent.Assign(pCont, 0); xRet = static_cast<text::XWordCursor*>(pXCursor); } else diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx index c0ce5748a7c5..4b8ba9656142 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -286,7 +286,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); } SwDoc *const pDocument = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pDocument) { throw lang::IllegalArgumentException(); @@ -1013,7 +1013,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) } SwDoc * const pDoc( - pRange ? pRange->GetDoc() : pCursor->GetDoc()); + pRange ? &pRange->GetDoc() : pCursor->GetDoc()); if (!pDoc) { throw lang::IllegalArgumentException( diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index a54e79415494..e1eaa861e2a4 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -285,7 +285,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) } SwDoc *const pDoc = - (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); + (pRange) ? &pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); if (!pDoc) { throw lang::IllegalArgumentException(); diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 18fcc766114a..e55465aa1b4e 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -944,8 +944,8 @@ uno::Reference<text::XTextCursor> SwXCell::createTextCursor() throw( uno::Runtim SwPosition aPos(*pSttNd); SwXTextCursor* const pXCursor = new SwXTextCursor(*GetDoc(), this, CURSOR_TBLTEXT, aPos); - auto pUnoCrsr(pXCursor->GetCursor()); - pUnoCrsr->Move(fnMoveForward, fnGoNode); + auto& rUnoCrsr(pXCursor->GetCursor()); + rUnoCrsr.Move(fnMoveForward, fnGoNode); return static_cast<text::XWordCursor*>(pXCursor); } @@ -1427,12 +1427,12 @@ sal_Bool SwXTextTableCursor::supportsService(const OUString& rServiceName) throw { return cppu::supportsService(this, rServiceName); } IMPLEMENT_FORWARD_XINTERFACE2(SwXTextTableCursor,SwXTextTableCursor_Base,OTextCursorHelper) -const SwPaM* SwXTextTableCursor::GetPaM() const { return GetCrsr(); } -SwPaM* SwXTextTableCursor::GetPaM() { return GetCrsr(); } +const SwPaM* SwXTextTableCursor::GetPaM() const { return &GetCrsr(); } +SwPaM* SwXTextTableCursor::GetPaM() { return &GetCrsr(); } const SwDoc* SwXTextTableCursor::GetDoc() const { return GetFrameFormat()->GetDoc(); } SwDoc* SwXTextTableCursor::GetDoc() { return GetFrameFormat()->GetDoc(); } -const SwUnoCrsr* SwXTextTableCursor::GetCrsr() const { return &(*m_pUnoCrsr); } -SwUnoCrsr* SwXTextTableCursor::GetCrsr() { return &(*m_pUnoCrsr); } +const SwUnoCrsr& SwXTextTableCursor::GetCrsr() const { return *m_pUnoCrsr; } +SwUnoCrsr& SwXTextTableCursor::GetCrsr() { return *m_pUnoCrsr; } uno::Sequence<OUString> SwXTextTableCursor::getSupportedServiceNames() throw( uno::RuntimeException, std::exception ) { return {"com.sun.star.text.TextTableCursor"}; } @@ -1471,8 +1471,8 @@ OUString SwXTextTableCursor::getRangeName() throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - SwUnoTableCrsr* pTableCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr* pTableCrsr = dynamic_cast<SwUnoTableCrsr*>(&rUnoCrsr); //!! see also SwChartDataSequence::getSourceRangeRepresentation if(!pTableCrsr) return OUString(); @@ -1499,10 +1499,8 @@ sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& sCellName, sal_Bool throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - auto& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + auto& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); return rTableCrsr.GotoTableBox(sCellName); } @@ -1510,10 +1508,8 @@ sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& sCellName, sal_Bool sal_Bool SwXTextTableCursor::goLeft(sal_Int16 Count, sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); return rTableCrsr.Left(Count, CRSR_SKIP_CHARS, false, false); } @@ -1521,10 +1517,8 @@ sal_Bool SwXTextTableCursor::goLeft(sal_Int16 Count, sal_Bool bExpand) throw( un sal_Bool SwXTextTableCursor::goRight(sal_Int16 Count, sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); return rTableCrsr.Right(Count, CRSR_SKIP_CHARS, false, false); } @@ -1532,10 +1526,8 @@ sal_Bool SwXTextTableCursor::goRight(sal_Int16 Count, sal_Bool bExpand) throw( u sal_Bool SwXTextTableCursor::goUp(sal_Int16 Count, sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); return rTableCrsr.UpDown(true, Count, 0, 0); } @@ -1543,10 +1535,8 @@ sal_Bool SwXTextTableCursor::goUp(sal_Int16 Count, sal_Bool bExpand) throw( uno: sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); return rTableCrsr.UpDown(false, Count, 0, 0); } @@ -1554,10 +1544,8 @@ sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool bExpand) throw( un void SwXTextTableCursor::gotoStart(sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); rTableCrsr.MoveTable(fnTableCurr, fnTableStart); } @@ -1565,10 +1553,8 @@ void SwXTextTableCursor::gotoStart(sal_Bool bExpand) throw( uno::RuntimeExceptio void SwXTextTableCursor::gotoEnd(sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); lcl_CrsrSelect(rTableCrsr, bExpand); rTableCrsr.MoveTable(fnTableCurr, fnTableEnd); } @@ -1577,11 +1563,9 @@ sal_Bool SwXTextTableCursor::mergeRange() throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; + SwUnoCrsr& rUnoCrsr = GetCrsr(); - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); { // HACK: remove pending actions for selecting old style tables UnoActionRemoveContext aRemoveContext(rTableCrsr); @@ -1589,7 +1573,7 @@ sal_Bool SwXTextTableCursor::mergeRange() rTableCrsr.MakeBoxSels(); bool bResult; { - UnoActionContext aContext(pUnoCrsr->GetDoc()); + UnoActionContext aContext(rUnoCrsr.GetDoc()); bResult = TBLMERGE_OK == rTableCrsr.GetDoc()->MergeTable(rTableCrsr); } if(bResult) @@ -1608,10 +1592,8 @@ sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal) SolarMutexGuard aGuard; if (Count <= 0) throw uno::RuntimeException("Illegal first argument: needs to be > 0", static_cast<cppu::OWeakObject*>(this)); - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return false; - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoCrsr& rUnoCrsr = GetCrsr(); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); { // HACK: remove pending actions for selecting old style tables UnoActionRemoveContext aRemoveContext(rTableCrsr); @@ -1619,7 +1601,7 @@ sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal) rTableCrsr.MakeBoxSels(); bool bResult; { - UnoActionContext aContext(pUnoCrsr->GetDoc()); + UnoActionContext aContext(rUnoCrsr.GetDoc()); bResult = rTableCrsr.GetDoc()->SplitTable(rTableCrsr.GetSelectedBoxes(), !Horizontal, Count); } rTableCrsr.MakeBoxSels(); @@ -1641,30 +1623,28 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u std::exception) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return; + SwUnoCrsr& rUnoCrsr = GetCrsr(); auto pEntry(m_pPropSet->getPropertyMap().getByName(rPropertyName)); if(!pEntry) throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this)); if(pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast<cppu::OWeakObject*>(this)); { - auto pSttNode = pUnoCrsr->GetNode().StartOfSectionNode(); + auto pSttNode = rUnoCrsr.GetNode().StartOfSectionNode(); const SwTableNode* pTableNode = pSttNode->FindTableNode(); lcl_FormatTable(pTableNode->GetTable().GetFrameFormat()); } - auto& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + auto& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); rTableCrsr.MakeBoxSels(); - SwDoc* pDoc = pUnoCrsr->GetDoc(); + SwDoc* pDoc = rUnoCrsr.GetDoc(); switch(pEntry->nWID) { case FN_UNO_TABLE_CELL_BACKGROUND: { SvxBrushItem aBrush(RES_BACKGROUND); - SwDoc::GetBoxAttr(*pUnoCrsr, aBrush); + SwDoc::GetBoxAttr(rUnoCrsr, aBrush); aBrush.PutValue(aValue, pEntry->nMemberId); - pDoc->SetBoxAttr(*pUnoCrsr, aBrush); + pDoc->SetBoxAttr(rUnoCrsr, aBrush); } break; @@ -1672,11 +1652,11 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u { SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT); aNumberFormat.PutValue(aValue, 0); - pDoc->SetBoxAttr(*pUnoCrsr, aNumberFormat); + pDoc->SetBoxAttr(rUnoCrsr, aNumberFormat); } break; case FN_UNO_PARA_STYLE: - SwUnoCursorHelper::SetTextFormatColl(aValue, *pUnoCrsr); + SwUnoCursorHelper::SetTextFormatColl(aValue, rUnoCrsr); break; default: { @@ -1702,15 +1682,13 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName) std::exception) { SolarMutexGuard aGuard; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(!pUnoCrsr) - return uno::Any(); + SwUnoCrsr& rUnoCrsr = GetCrsr(); { - auto pSttNode = pUnoCrsr->GetNode().StartOfSectionNode(); + auto pSttNode = rUnoCrsr.GetNode().StartOfSectionNode(); const SwTableNode* pTableNode = pSttNode->FindTableNode(); lcl_FormatTable(pTableNode->GetTable().GetFrameFormat()); } - SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr); + SwUnoTableCrsr& rTableCrsr = dynamic_cast<SwUnoTableCrsr&>(rUnoCrsr); auto pEntry(m_pPropSet->getPropertyMap().getByName(rPropertyName)); if(!pEntry) throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this)); @@ -1721,7 +1699,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName) case FN_UNO_TABLE_CELL_BACKGROUND: { SvxBrushItem aBrush(RES_BACKGROUND); - if (SwDoc::GetBoxAttr(*pUnoCrsr, aBrush)) + if (SwDoc::GetBoxAttr(rUnoCrsr, aBrush)) aBrush.QueryValue(aResult, pEntry->nMemberId); } break; @@ -1731,7 +1709,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName) break; case FN_UNO_PARA_STYLE: { - auto pFormat(SwUnoCursorHelper::GetCurTextFormatColl(*pUnoCrsr, false)); + auto pFormat(SwUnoCursorHelper::GetCurTextFormatColl(rUnoCrsr, false)); if(pFormat) aResult = uno::makeAny(pFormat->GetName()); } @@ -2090,7 +2068,7 @@ void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTex pCursor = reinterpret_cast<OTextCursorHelper*>( sal::static_int_cast<sal_IntPtr>(xRangeTunnel->getSomething(OTextCursorHelper::getUnoTunnelId()))); } - SwDoc* pDoc = pRange ? pRange->GetDoc() : pCursor ? pCursor->GetDoc() : nullptr; + SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor ? pCursor->GetDoc() : nullptr; if(!pDoc || !nRows || !nColumns) throw lang::IllegalArgumentException(); SwUnoInternalPaM aPam(*pDoc); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index f0126282daa1..a72c9f8a5f65 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -299,7 +299,7 @@ throw (uno::RuntimeException, std::exception) ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel); OTextCursorHelper *const pCursor = ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); - if ((!pRange || pRange ->GetDoc() != GetDoc()) && + if ((!pRange || &pRange ->GetDoc() != GetDoc()) && (!pCursor || pCursor->GetDoc() != GetDoc())) { throw uno::RuntimeException(); @@ -1382,23 +1382,23 @@ SwXText::insertTextPortion( OUString sMessage; m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL); - auto pCursor(pTextCursor->GetCursor()); - m_pImpl->m_pDoc->DontExpandFormat( *pCursor->Start() ); + auto& rCursor(pTextCursor->GetCursor()); + m_pImpl->m_pDoc->DontExpandFormat( *rCursor.Start() ); if (!rText.isEmpty()) { - const sal_Int32 nContentPos = pCursor->GetPoint()->nContent.GetIndex(); + const sal_Int32 nContentPos = rCursor.GetPoint()->nContent.GetIndex(); SwUnoCursorHelper::DocInsertStringSplitCR( - *m_pImpl->m_pDoc, *pCursor, rText, false); - SwUnoCursorHelper::SelectPam(*pCursor, true); - pCursor->GetPoint()->nContent = nContentPos; + *m_pImpl->m_pDoc, rCursor, rText, false); + SwUnoCursorHelper::SelectPam(rCursor, true); + rCursor.GetPoint()->nContent = nContentPos; } try { SfxItemPropertySet const*const pCursorPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR); - SwUnoCursorHelper::SetPropertyValues(*pCursor, *pCursorPropSet, + SwUnoCursorHelper::SetPropertyValues(rCursor, *pCursorPropSet, rCharacterAndParagraphProperties, SetAttrMode::NOFORMATATTR); } @@ -1429,7 +1429,7 @@ SwXText::insertTextPortion( throw aEx; } } - xRet = new SwXTextRange(*pCursor, this); + xRet = new SwXTextRange(rCursor, this); return xRet; } @@ -2745,28 +2745,28 @@ SwXHeadFootText::createTextCursor() throw (uno::RuntimeException, std::exception SwPosition aPos(rNode); SwXTextCursor *const pXCursor = new SwXTextCursor(*GetDoc(), this, (m_pImpl->m_bIsHeader) ? CURSOR_HEADER : CURSOR_FOOTER, aPos); - auto pUnoCrsr(pXCursor->GetCursor()); - pUnoCrsr->Move(fnMoveForward, fnGoNode); + auto& rUnoCrsr(pXCursor->GetCursor()); + rUnoCrsr.Move(fnMoveForward, fnGoNode); // save current start node to be able to check if there is content // after the table - otherwise the cursor would be in the body text! SwStartNode const*const pOwnStartNode = rNode.FindSttNodeByType( (m_pImpl->m_bIsHeader) ? SwHeaderStartNode : SwFooterStartNode); // is there a table here? - SwTableNode* pTableNode = pUnoCrsr->GetNode().FindTableNode(); + SwTableNode* pTableNode = rUnoCrsr.GetNode().FindTableNode(); SwContentNode* pCont = 0; while (pTableNode) { - pUnoCrsr->GetPoint()->nNode = *pTableNode->EndOfSectionNode(); - pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode); + rUnoCrsr.GetPoint()->nNode = *pTableNode->EndOfSectionNode(); + pCont = GetDoc()->GetNodes().GoNext(&rUnoCrsr.GetPoint()->nNode); pTableNode = pCont->FindTableNode(); } if (pCont) { - pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0); + rUnoCrsr.GetPoint()->nContent.Assign(pCont, 0); } SwStartNode const*const pNewStartNode = - pUnoCrsr->GetNode().FindSttNodeByType( + rUnoCrsr.GetNode().FindSttNodeByType( (m_pImpl->m_bIsHeader) ? SwHeaderStartNode : SwFooterStartNode); if (!pNewStartNode || (pNewStartNode != pOwnStartNode)) { diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx index 0354e6ac199d..6c28f833d6bd 100644 --- a/sw/source/core/unocore/unotextmarkup.cxx +++ b/sw/source/core/unocore/unotextmarkup.cxx @@ -110,11 +110,9 @@ void SAL_CALL SwXTextMarkup::commitTextRangeMarkup(::sal_Int32 nType, const OUSt if (pRange) { - SwDoc* pDoc = reinterpret_cast<SwDoc*>(pRange->GetDoc()); + SwDoc& rDoc = pRange->GetDoc(); - if (!pDoc) return; - - SwUnoInternalPaM aPam(*pDoc); + SwUnoInternalPaM aPam(rDoc); ::sw::XTextRangeToSwPaM(aPam, xRange); diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index 5f13e3cee827..a24a5ed9c884 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -56,7 +56,7 @@ SwPagePreviewLayout::SwPagePreviewLayout( SwViewShell& _rParentViewShell, mbBookPreview = false; mbBookPreviewModeToggled = false; - mbPrintEmptyPages = mrParentViewShell.getIDocumentDeviceAccess()->getPrintData().IsPrintEmptyPages(); + mbPrintEmptyPages = mrParentViewShell.getIDocumentDeviceAccess().getPrintData().IsPrintEmptyPages(); } void SwPagePreviewLayout::_Clear() diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx index 5c160b84caa4..611d6e29af2d 100644 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -110,9 +110,9 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID, // set default horizontal text direction on painting <hell> or // <heaven>. EEHorizontalTextDirection aOldEEHoriTextDir = EE_HTEXTDIR_L2R; - const IDocumentDrawModelAccess* pIDDMA = GetShell()->getIDocumentDrawModelAccess(); - if ( (_nLayerID == pIDDMA->GetHellId()) || - (_nLayerID == pIDDMA->GetHeavenId()) ) + const IDocumentDrawModelAccess& rIDDMA = GetShell()->getIDocumentDrawModelAccess(); + if ( (_nLayerID == rIDDMA.GetHellId()) || + (_nLayerID == rIDDMA.GetHeavenId()) ) { OSL_ENSURE( _pPageBackgrdColor, "incorrect usage of SwViewShellImp::PaintLayer: pPageBackgrdColor have to be set for painting layer <hell> or <heaven>"); @@ -141,8 +141,8 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID, pOutDev->Pop(); // reset background color of the outliner & default horiz. text dir. - if ( (_nLayerID == pIDDMA->GetHellId()) || - (_nLayerID == pIDDMA->GetHeavenId()) ) + if ( (_nLayerID == rIDDMA.GetHellId()) || + (_nLayerID == rIDDMA.GetHeavenId()) ) { GetDrawView()->GetModel()->GetDrawOutliner().SetBackgroundColor( aOldOutlinerBackgrdColor ); GetDrawView()->GetModel()->GetDrawOutliner().SetDefaultHorizontalTextDirection( aOldEEHoriTextDir ); @@ -204,8 +204,8 @@ void SwViewShellImp::NotifySizeChg( const Size &rNewSz ) if ( !bCheckDrawObjs ) return; - OSL_ENSURE( pSh->getIDocumentDrawModelAccess()->GetDrawModel(), "NotifySizeChg without DrawModel" ); - SdrPage* pPage = pSh->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 ); + OSL_ENSURE( pSh->getIDocumentDrawModelAccess().GetDrawModel(), "NotifySizeChg without DrawModel" ); + SdrPage* pPage = pSh->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 ); const size_t nObjs = pPage->GetObjCount(); for( size_t nObj = 0; nObj < nObjs; ++nObj ) { diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index b3957c4ccd2e..586db03542a2 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -48,9 +48,9 @@ void SwViewShellImp::Init( const SwViewOption *pNewOpt ) SwRootFrm *pRoot = pSh->GetLayout(); if ( !pSdrPageView ) { - IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess(); + IDocumentDrawModelAccess& rIDDMA = pSh->getIDocumentDrawModelAccess(); if ( !pRoot->GetDrawPage() ) - pRoot->SetDrawPage( pIDDMA->GetDrawModel()->GetPage( 0 ) ); + pRoot->SetDrawPage( rIDDMA.GetDrawModel()->GetPage( 0 ) ); if ( pRoot->GetDrawPage()->GetSize() != pRoot->Frm().SSize() ) pRoot->GetDrawPage()->SetSize( pRoot->Frm().SSize() ); @@ -58,7 +58,7 @@ void SwViewShellImp::Init( const SwViewOption *pNewOpt ) pSdrPageView = pDrawView->ShowSdrPage( pRoot->GetDrawPage()); // OD 26.06.2003 #108784# - notify drawing page view about invisible // layers. - pIDDMA->NotifyInvisibleLayers( *pSdrPageView ); + rIDDMA.NotifyInvisibleLayers( *pSdrPageView ); } pDrawView->SetDragStripes( pNewOpt->IsCrossHair() ); pDrawView->SetGridSnap( pNewOpt->IsSnap() ); @@ -208,13 +208,13 @@ void SwViewShellImp::SetFirstVisPage(OutputDevice* pRenderContext) void SwViewShellImp::MakeDrawView() { - IDocumentDrawModelAccess* pIDDMA = GetShell()->getIDocumentDrawModelAccess(); + IDocumentDrawModelAccess& rIDDMA = GetShell()->getIDocumentDrawModelAccess(); // the else here is not an error, _MakeDrawModel() calls this method again // after the DrawModel is created to create DrawViews for all shells... - if( !pIDDMA->GetDrawModel() ) + if( !rIDDMA.GetDrawModel() ) { - pIDDMA->_MakeDrawModel(); + rIDDMA._MakeDrawModel(); } else { @@ -233,7 +233,7 @@ void SwViewShellImp::MakeDrawView() pOutDevForDrawView = GetShell()->GetOut(); } - pDrawView = new SwDrawView( *this, pIDDMA->GetDrawModel(), pOutDevForDrawView); + pDrawView = new SwDrawView( *this, rIDDMA.GetDrawModel(), pOutDevForDrawView); } GetDrawView()->SetActiveLayer("Heaven"); @@ -295,12 +295,12 @@ void SwViewShellImp::InitPagePreviewLayout() void SwViewShellImp::UpdateAccessible() { // We require a layout and an XModel to be accessible. - IDocumentLayoutAccess* pIDLA = GetShell()->getIDocumentLayoutAccess(); + IDocumentLayoutAccess& rIDLA = GetShell()->getIDocumentLayoutAccess(); vcl::Window *pWin = GetShell()->GetWin(); OSL_ENSURE( GetShell()->GetLayout(), "no layout, no access" ); OSL_ENSURE( pWin, "no window, no access" ); - if( IsAccessible() && pIDLA->GetCurrentViewShell() && pWin ) + if( IsAccessible() && rIDLA.GetCurrentViewShell() && pWin ) GetAccessibleMap().GetDocumentView(); } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 9462b8f1fd51..b8ed7138e613 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -119,7 +119,7 @@ void SwViewShell::ToggleHeaderFooterEdit() void SwViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) { - getIDocumentDrawModelAccess()->GetDrawModel()->registerLibreOfficeKitCallback(pCallback, pData); + getIDocumentDrawModelAccess().GetDrawModel()->registerLibreOfficeKitCallback(pCallback, pData); } void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const @@ -127,17 +127,17 @@ void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const if (mbInLibreOfficeKitCallback) return; - getIDocumentDrawModelAccess()->GetDrawModel()->libreOfficeKitCallback(nType, pPayload); + getIDocumentDrawModelAccess().GetDrawModel()->libreOfficeKitCallback(nType, pPayload); } void SwViewShell::setTiledRendering(bool bTiledRendering) { - getIDocumentDrawModelAccess()->GetDrawModel()->setTiledRendering(bTiledRendering); + getIDocumentDrawModelAccess().GetDrawModel()->setTiledRendering(bTiledRendering); } bool SwViewShell::isTiledRendering() const { - return getIDocumentDrawModelAccess()->GetDrawModel()->isTiledRendering(); + return getIDocumentDrawModelAccess().GetDrawModel()->isTiledRendering(); } void SwViewShell::setOutputToWindow(bool bOutputToWindow) @@ -736,11 +736,11 @@ static void lcl_InvalidateAllObjPos( SwViewShell &_rSh ) void SwViewShell::SetParaSpaceMax( bool bNew ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX) != bNew ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) != bNew ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::PARA_SPACE_MAX, bNew ); + rIDSA.set(DocumentSettingId::PARA_SPACE_MAX, bNew ); const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION; lcl_InvalidateAllContent( *this, nInv ); } @@ -748,11 +748,11 @@ void SwViewShell::SetParaSpaceMax( bool bNew ) void SwViewShell::SetParaSpaceMaxAtPages( bool bNew ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if( pIDSA->get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) != bNew ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES) != bNew ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES, bNew ); + rIDSA.set(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES, bNew ); const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION; lcl_InvalidateAllContent( *this, nInv ); } @@ -760,11 +760,11 @@ void SwViewShell::SetParaSpaceMaxAtPages( bool bNew ) void SwViewShell::SetTabCompat( bool bNew ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if( pIDSA->get(DocumentSettingId::TAB_COMPAT) != bNew ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if( rIDSA.get(DocumentSettingId::TAB_COMPAT) != bNew ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::TAB_COMPAT, bNew ); + rIDSA.set(DocumentSettingId::TAB_COMPAT, bNew ); const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION; lcl_InvalidateAllContent( *this, nInv ); } @@ -772,12 +772,12 @@ void SwViewShell::SetTabCompat( bool bNew ) void SwViewShell::SetAddExtLeading( bool bNew ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::ADD_EXT_LEADING) != bNew ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::ADD_EXT_LEADING) != bNew ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::ADD_EXT_LEADING, bNew ); - SwDrawModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel(); + rIDSA.set(DocumentSettingId::ADD_EXT_LEADING, bNew ); + SwDrawModel* pTmpDrawModel = getIDocumentDrawModelAccess().GetDrawModel(); if ( pTmpDrawModel ) pTmpDrawModel->SetAddExtLeading( bNew ); const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION; @@ -787,13 +787,13 @@ void SwViewShell::SetAddExtLeading( bool bNew ) void SwViewShell::SetUseVirDev( bool bNewVirtual ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::USE_VIRTUAL_DEVICE) != bNewVirtual ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::USE_VIRTUAL_DEVICE) != bNewVirtual ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); // this sets the flag at the document and calls PrtDataChanged - IDocumentDeviceAccess* pIDDA = getIDocumentDeviceAccess(); - pIDDA->setReferenceDeviceType( bNewVirtual, true ); + IDocumentDeviceAccess& rIDDA = getIDocumentDeviceAccess(); + rIDDA.setReferenceDeviceType( bNewVirtual, true ); } } @@ -803,11 +803,11 @@ void SwViewShell::SetUseVirDev( bool bNewVirtual ) */ void SwViewShell::SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCells ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells ); + rIDSA.set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells ); const sal_uInt8 nInv = INV_PRTAREA; lcl_InvalidateAllContent( *this, nInv ); } @@ -820,11 +820,11 @@ void SwViewShell::SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCel */ void SwViewShell::SetUseFormerLineSpacing( bool _bUseFormerLineSpacing ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::OLD_LINE_SPACING) != _bUseFormerLineSpacing ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::OLD_LINE_SPACING) != _bUseFormerLineSpacing ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::OLD_LINE_SPACING, _bUseFormerLineSpacing ); + rIDSA.set(DocumentSettingId::OLD_LINE_SPACING, _bUseFormerLineSpacing ); const sal_uInt8 nInv = INV_PRTAREA; lcl_InvalidateAllContent( *this, nInv ); } @@ -837,11 +837,11 @@ void SwViewShell::SetUseFormerLineSpacing( bool _bUseFormerLineSpacing ) */ void SwViewShell::SetUseFormerObjectPositioning( bool _bUseFormerObjPos ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::USE_FORMER_OBJECT_POS) != _bUseFormerObjPos ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::USE_FORMER_OBJECT_POS) != _bUseFormerObjPos ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::USE_FORMER_OBJECT_POS, _bUseFormerObjPos ); + rIDSA.set(DocumentSettingId::USE_FORMER_OBJECT_POS, _bUseFormerObjPos ); lcl_InvalidateAllObjPos( *this ); } } @@ -849,22 +849,22 @@ void SwViewShell::SetUseFormerObjectPositioning( bool _bUseFormerObjPos ) // #i28701# void SwViewShell::SetConsiderWrapOnObjPos( bool _bConsiderWrapOnObjPos ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) != _bConsiderWrapOnObjPos ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) != _bConsiderWrapOnObjPos ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION, _bConsiderWrapOnObjPos ); + rIDSA.set(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION, _bConsiderWrapOnObjPos ); lcl_InvalidateAllObjPos( *this ); } } void SwViewShell::SetUseFormerTextWrapping( bool _bUseFormerTextWrapping ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) != _bUseFormerTextWrapping ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) != _bUseFormerTextWrapping ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, _bUseFormerTextWrapping ); + rIDSA.set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, _bUseFormerTextWrapping ); const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION; lcl_InvalidateAllContent( *this, nInv ); } @@ -873,11 +873,11 @@ void SwViewShell::SetUseFormerTextWrapping( bool _bUseFormerTextWrapping ) // #i45491# void SwViewShell::SetDoNotJustifyLinesWithManualBreak( bool _bDoNotJustifyLinesWithManualBreak ) { - IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); - if ( pIDSA->get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != _bDoNotJustifyLinesWithManualBreak ) + IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); + if ( rIDSA.get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != _bDoNotJustifyLinesWithManualBreak ) { SwWait aWait( *GetDoc()->GetDocShell(), true ); - pIDSA->set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, _bDoNotJustifyLinesWithManualBreak ); + rIDSA.set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, _bDoNotJustifyLinesWithManualBreak ); const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION; lcl_InvalidateAllContent( *this, nInv ); } @@ -903,7 +903,7 @@ void SwViewShell::Reformat() void SwViewShell::ChgNumberDigits() { - SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel(); + SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess().GetDrawModel(); if ( pTmpDrawModel ) pTmpDrawModel->ReformatAllTextObjects(); Reformat(); @@ -2481,21 +2481,21 @@ SwPostItMgr* SwViewShell::GetPostItMgr() /* * Document Interface Access */ -const IDocumentSettingAccess* SwViewShell::getIDocumentSettingAccess() const { return &mpDoc->GetDocumentSettingManager(); } -IDocumentSettingAccess* SwViewShell::getIDocumentSettingAccess() { return &mpDoc->GetDocumentSettingManager(); } -const IDocumentDeviceAccess* SwViewShell::getIDocumentDeviceAccess() const { return &mpDoc->getIDocumentDeviceAccess(); } -IDocumentDeviceAccess* SwViewShell::getIDocumentDeviceAccess() { return &mpDoc->getIDocumentDeviceAccess(); } +const IDocumentSettingAccess& SwViewShell::getIDocumentSettingAccess() const { return mpDoc->GetDocumentSettingManager(); } +IDocumentSettingAccess& SwViewShell::getIDocumentSettingAccess() { return mpDoc->GetDocumentSettingManager(); } +const IDocumentDeviceAccess& SwViewShell::getIDocumentDeviceAccess() const { return mpDoc->getIDocumentDeviceAccess(); } +IDocumentDeviceAccess& SwViewShell::getIDocumentDeviceAccess() { return mpDoc->getIDocumentDeviceAccess(); } const IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() const { return mpDoc->getIDocumentMarkAccess(); } IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() { return mpDoc->getIDocumentMarkAccess(); } -const IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() const { return & mpDoc->getIDocumentDrawModelAccess(); } -IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() { return & mpDoc->getIDocumentDrawModelAccess(); } -const IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() const { return &mpDoc->getIDocumentRedlineAccess(); } -IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() { return &mpDoc->getIDocumentRedlineAccess(); } -const IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() const { return &mpDoc->getIDocumentLayoutAccess(); } -IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() { return &mpDoc->getIDocumentLayoutAccess(); } -IDocumentContentOperations* SwViewShell::getIDocumentContentOperations() { return &mpDoc->getIDocumentContentOperations(); } -IDocumentStylePoolAccess* SwViewShell::getIDocumentStylePoolAccess() { return &mpDoc->getIDocumentStylePoolAccess(); } -const IDocumentStatistics* SwViewShell::getIDocumentStatistics() const { return &mpDoc->getIDocumentStatistics(); } +const IDocumentDrawModelAccess& SwViewShell::getIDocumentDrawModelAccess() const { return mpDoc->getIDocumentDrawModelAccess(); } +IDocumentDrawModelAccess& SwViewShell::getIDocumentDrawModelAccess() { return mpDoc->getIDocumentDrawModelAccess(); } +const IDocumentRedlineAccess& SwViewShell::getIDocumentRedlineAccess() const { return mpDoc->getIDocumentRedlineAccess(); } +IDocumentRedlineAccess& SwViewShell::getIDocumentRedlineAccess() { return mpDoc->getIDocumentRedlineAccess(); } +const IDocumentLayoutAccess& SwViewShell::getIDocumentLayoutAccess() const { return mpDoc->getIDocumentLayoutAccess(); } +IDocumentLayoutAccess& SwViewShell::getIDocumentLayoutAccess() { return mpDoc->getIDocumentLayoutAccess(); } +IDocumentContentOperations& SwViewShell::getIDocumentContentOperations() { return mpDoc->getIDocumentContentOperations(); } +IDocumentStylePoolAccess& SwViewShell::getIDocumentStylePoolAccess() { return mpDoc->getIDocumentStylePoolAccess(); } +const IDocumentStatistics& SwViewShell::getIDocumentStatistics() const { return mpDoc->getIDocumentStatistics(); } IDocumentUndoRedo & SwViewShell::GetIDocumentUndoRedo() { return mpDoc->GetIDocumentUndoRedo(); } diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 2e8ed74a01ec..4533b13212f4 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -216,7 +216,7 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window *pWindow, // extend format cache. if ( SwTextFrm::GetTextCache()->GetCurMax() < 2550 ) SwTextFrm::GetTextCache()->IncreaseMax( 100 ); - if( mpOpt->IsGridVisible() || getIDocumentDrawModelAccess()->GetDrawModel() ) + if( mpOpt->IsGridVisible() || getIDocumentDrawModelAccess().GetDrawModel() ) Imp()->MakeDrawView(); // OD 2004-06-01 #i26791# @@ -288,7 +288,7 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow, // extend format cache. if ( SwTextFrm::GetTextCache()->GetCurMax() < 2550 ) SwTextFrm::GetTextCache()->IncreaseMax( 100 ); - if( mpOpt->IsGridVisible() || getIDocumentDrawModelAccess()->GetDrawModel() ) + if( mpOpt->IsGridVisible() || getIDocumentDrawModelAccess().GetDrawModel() ) Imp()->MakeDrawView(); // OD 2004-06-01 #i26791# diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 574b4b234c05..3e289ca40587 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -563,7 +563,7 @@ void SwHTMLWriter::OutStyleSheet( const SwPageDesc& rPageDesc, bool bUsed ) pFollow = pPageDesc->GetFollow(); } - IDocumentStylePoolAccess* pStylePoolAccess = getIDocumentStylePoolAccess(); + IDocumentStylePoolAccess* pStylePoolAccess = &getIDocumentStylePoolAccess(); if( pPageDesc == pFollow ) { // The document is one-sided; no matter what page, we do not create a 2-sided doc. @@ -596,7 +596,7 @@ void SwHTMLWriter::OutStyleSheet( const SwPageDesc& rPageDesc, bool bUsed ) // The text body style has to be exported always (if it is changed compared // to the template), because it is used as reference for any style // that maps to <P>, and that's especially the standard style - getIDocumentStylePoolAccess()->GetTextCollFromPool( RES_POOLCOLL_TEXT, false ); + getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TEXT, false ); // the Default-TextStyle is not also exported !! // 0-Style is the Default; is never exported !! diff --git a/sw/source/filter/html/svxcss1.hxx b/sw/source/filter/html/svxcss1.hxx index 8b4099003cf8..626d7328ac17 100644 --- a/sw/source/filter/html/svxcss1.hxx +++ b/sw/source/filter/html/svxcss1.hxx @@ -290,7 +290,7 @@ public: virtual const FontList *GetFontList() const; - const sal_uInt16 *GetWhichMap() const { return &aWhichMap[0]; } + const sal_uInt16 *GetWhichMap() const { return aWhichMap.data(); } static void InsertMapEntry( const OUString& rKey, const SfxItemSet& rItemSet, const SvxCSS1PropertyInfo& rProp, CSS1Map& rMap ); diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index c84dfabde3cf..0274d5b35959 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -135,10 +135,10 @@ Writer::~Writer() /* * Document Interface Access */ -IDocumentSettingAccess* Writer::getIDocumentSettingAccess() { return &pDoc->getIDocumentSettingAccess(); } -const IDocumentSettingAccess* Writer::getIDocumentSettingAccess() const { return &pDoc->getIDocumentSettingAccess(); } -IDocumentStylePoolAccess* Writer::getIDocumentStylePoolAccess() { return &pDoc->getIDocumentStylePoolAccess(); } -const IDocumentStylePoolAccess* Writer::getIDocumentStylePoolAccess() const { return &pDoc->getIDocumentStylePoolAccess(); } +IDocumentSettingAccess& Writer::getIDocumentSettingAccess() { return pDoc->getIDocumentSettingAccess(); } +const IDocumentSettingAccess& Writer::getIDocumentSettingAccess() const { return pDoc->getIDocumentSettingAccess(); } +IDocumentStylePoolAccess& Writer::getIDocumentStylePoolAccess() { return pDoc->getIDocumentStylePoolAccess(); } +const IDocumentStylePoolAccess& Writer::getIDocumentStylePoolAccess() const { return pDoc->getIDocumentStylePoolAccess(); } void Writer::ResetWriter() { diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index b7c610604d67..cfd231058376 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2903,7 +2903,7 @@ sal_Int32 SwEscherEx::WriteFlyFrm(const DrawObj &rObj, sal_uInt32 &rShapeId, //In browse mode the sdr object doesn't always exist. For example, the //object is in the hidden header/footer. We save the fmt directly //in such cases; we copy most of the logic from the block above - const bool bBrowseMode = (rFormat.getIDocumentSettingAccess())->get(DocumentSettingId::BROWSE_MODE); + const bool bBrowseMode = rFormat.getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE); if( bBrowseMode && rFormat.GetDoc()) { if( !rFormat.GetChain().GetPrev() )//obj in header/footer? diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index c95e1abbafa6..4d1d370228b5 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -633,9 +633,9 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo) (rTypo.cchLeadingPunct+1)*2); } - const IDocumentSettingAccess* pIDocumentSettingAccess = GetWriter().getIDocumentSettingAccess(); + const IDocumentSettingAccess& rIDocumentSettingAccess = GetWriter().getIDocumentSettingAccess(); - rTypo.fKerningPunct = sal_uInt16(pIDocumentSettingAccess->get(DocumentSettingId::KERN_ASIAN_PUNCTUATION)); + rTypo.fKerningPunct = sal_uInt16(rIDocumentSettingAccess.get(DocumentSettingId::KERN_ASIAN_PUNCTUATION)); rTypo.iJustification = m_pDoc->getIDocumentSettingAccess().getCharacterCompressionType(); } diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index b864bf936379..15d522b8467d 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -66,7 +66,7 @@ static SwDoc* lcl_GetDocViaTunnel( Reference<XTextRange> & rRange ) ::sw::UnoTunnelGetImplementation<SwXTextRange>(xTunnel); // #i115174#: this may be a SvxUnoTextRange // OSL_ENSURE( pXRange, "SwXTextRange missing" ); - return (pXRange) ? pXRange->GetDoc() : 0; + return (pXRange) ? &pXRange->GetDoc() : 0; } // XTextRangeOrNodeIndexPosition: store a position into the text @@ -486,7 +486,7 @@ Reference<XTextCursor> XMLRedlineImportHelper::CreateRedlineTextSection( SwPosition aPos(*pRedlineNode); SwXTextCursor *const pXCursor = new SwXTextCursor(*pDoc, pXText, CURSOR_REDLINE, aPos); - pXCursor->GetCursor()->Move(fnMoveForward, fnGoNode); + pXCursor->GetCursor().Move(fnMoveForward, fnGoNode); // cast to avoid ambiguity xReturn = static_cast<text::XWordCursor*>(pXCursor); } diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx index af971b8e412b..f1a9a2ce56d4 100644 --- a/sw/source/filter/xml/xmlexpit.cxx +++ b/sw/source/filter/xml/xmlexpit.cxx @@ -72,17 +72,17 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport, while( nIndex < nCount ) { - SvXMLItemMapEntry* pEntry = mrMapEntries->getByIndex( nIndex ); + SvXMLItemMapEntry& rEntry = mrMapEntries->getByIndex( nIndex ); // we have a valid map entry here, so lets use it... - if( 0 == (pEntry->nMemberId & MID_SW_FLAG_NO_ITEM_EXPORT) ) + if( 0 == (rEntry.nMemberId & MID_SW_FLAG_NO_ITEM_EXPORT) ) { - const SfxPoolItem* pItem = GetItem( rSet, pEntry->nWhichId, + const SfxPoolItem* pItem = GetItem( rSet, rEntry.nWhichId, nFlags ); // do we have an item? if(pItem) { - if( 0 != (pEntry->nMemberId & MID_SW_FLAG_ELEMENT_ITEM_EXPORT) ) + if( 0 != (rEntry.nMemberId & MID_SW_FLAG_ELEMENT_ITEM_EXPORT) ) { // element items do not add any properties, // we export it later @@ -92,14 +92,14 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport, } else { - exportXML( rExport, rAttrList, *pItem, *pEntry, rUnitConverter, + exportXML( rExport, rAttrList, *pItem, rEntry, rUnitConverter, rNamespaceMap, nFlags, &rSet ); } } } else { - handleNoItem( rAttrList, *pEntry, rUnitConverter, rNamespaceMap, + handleNoItem( rAttrList, rEntry, rUnitConverter, rNamespaceMap, rSet ); } nIndex++; @@ -228,16 +228,16 @@ void SvXMLExportItemMapper::exportElementItems( for( size_t nIndex = 0; nIndex < nCount; ++nIndex ) { const sal_uInt16 nElement = rIndexArray[ nIndex ]; - SvXMLItemMapEntry* pEntry = mrMapEntries->getByIndex( nElement ); - OSL_ENSURE( 0 != (pEntry->nMemberId & MID_SW_FLAG_ELEMENT_ITEM_EXPORT), + SvXMLItemMapEntry& rEntry = mrMapEntries->getByIndex( nElement ); + OSL_ENSURE( 0 != (rEntry.nMemberId & MID_SW_FLAG_ELEMENT_ITEM_EXPORT), "wrong mid flag!" ); - const SfxPoolItem* pItem = GetItem( rSet, pEntry->nWhichId, nFlags ); + const SfxPoolItem* pItem = GetItem( rSet, rEntry.nWhichId, nFlags ); // do we have an item? if(pItem) { rExport.IgnorableWhitespace(); - handleElementItem( rExport, *pEntry, *pItem, rUnitConverter, + handleElementItem( rExport, rEntry, *pItem, rUnitConverter, rSet, nFlags); bItemsExported = true; } diff --git a/sw/source/filter/xml/xmlitmap.hxx b/sw/source/filter/xml/xmlitmap.hxx index 75deb2c67b7c..d9738a83c7c3 100644 --- a/sw/source/filter/xml/xmlitmap.hxx +++ b/sw/source/filter/xml/xmlitmap.hxx @@ -67,7 +67,7 @@ public: SvXMLItemMapEntry* getByName( sal_uInt16 nNameSpace, const OUString& rString, SvXMLItemMapEntry* pStartAt = NULL ) const; - SvXMLItemMapEntry* getByIndex( sal_uInt16 nIndex ) const; + SvXMLItemMapEntry& getByIndex( sal_uInt16 nIndex ) const; sal_uInt16 getCount() const; }; diff --git a/sw/source/filter/xml/xmlitmpr.cxx b/sw/source/filter/xml/xmlitmpr.cxx index e19630af2c48..7a119e7d0885 100644 --- a/sw/source/filter/xml/xmlitmpr.cxx +++ b/sw/source/filter/xml/xmlitmpr.cxx @@ -67,9 +67,9 @@ SvXMLItemMapEntry* SvXMLItemMapEntries::getByName( sal_uInt16 nNameSpace, return (pMap && (pMap->eLocalName != XML_TOKEN_INVALID)) ? pMap : NULL; } -SvXMLItemMapEntry* SvXMLItemMapEntries::getByIndex( sal_uInt16 nIndex ) const +SvXMLItemMapEntry& SvXMLItemMapEntries::getByIndex( sal_uInt16 nIndex ) const { - return &mpImpl->mpEntries[nIndex]; + return mpImpl->mpEntries[nIndex]; } sal_uInt16 SvXMLItemMapEntries::getCount() const diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index d479d583b2fa..4a8998a10821 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -379,7 +379,7 @@ sal_uLong SwCompatibilityOptPage::GetDocumentOptions() const sal_uLong nRet = 0; if ( m_pWrtShell ) { - const IDocumentSettingAccess& rIDocumentSettingAccess = *m_pWrtShell->getIDocumentSettingAccess(); + const IDocumentSettingAccess& rIDocumentSettingAccess = m_pWrtShell->getIDocumentSettingAccess(); nRet = convertBools2Ulong_Impl( !rIDocumentSettingAccess.get(DocumentSettingId::USE_VIRTUAL_DEVICE), rIDocumentSettingAccess.get(DocumentSettingId::PARA_SPACE_MAX), diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index fc06390b5845..2ae97be648ed 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -742,7 +742,7 @@ bool SwStdFontTabPage::FillItemSet( SfxItemSet* ) if(pWrtShell) { pWrtShell->StartAllAction(); - SfxPrinter* pPrinter = pWrtShell->getIDocumentDeviceAccess()->getPrinter( false ); + SfxPrinter* pPrinter = pWrtShell->getIDocumentDeviceAccess().getPrinter( false ); bool bMod = false; const sal_uInt16 nFontWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >( nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONT : diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 7bbe913a0a28..d827c05e2879 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -366,7 +366,7 @@ void SwMailMergeOutputPage::ActivatePage() OSL_ENSURE(pTargetView, "no target view exists"); if(pTargetView) { - SfxPrinter* pPrinter = pTargetView->GetWrtShell().getIDocumentDeviceAccess()->getPrinter( true ); + SfxPrinter* pPrinter = pTargetView->GetWrtShell().getIDocumentDeviceAccess().getPrinter( true ); m_pPrinterLB->SelectEntry( pPrinter->GetName() ); m_pToNF->SetValue( rConfigItem.GetMergedDocumentCount() ); m_pToNF->SetMax( rConfigItem.GetMergedDocumentCount() ); @@ -826,7 +826,7 @@ IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox) { SwView *const pTargetView = m_pWizard->GetConfigItem().GetTargetView(); SfxPrinter *const pDocumentPrinter = pTargetView->GetWrtShell() - .getIDocumentDeviceAccess()->getPrinter(true); + .getIDocumentDeviceAccess().getPrinter(true); if (pDocumentPrinter && pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) { const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->GetSelectEntry(), false ); @@ -897,7 +897,7 @@ IMPL_LINK_NOARG(SwMailMergeOutputPage, PrintHdl_Impl) if(m_pTempPrinter) { SfxPrinter *const pDocumentPrinter = pTargetView->GetWrtShell() - .getIDocumentDeviceAccess()->getPrinter(true); + .getIDocumentDeviceAccess().getPrinter(true); pDocumentPrinter->SetPrinterProps(m_pTempPrinter); // this should be able to handle setting its own printer pTargetView->SetPrinter(pDocumentPrinter); diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 89d467374e04..10317ad739cd 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -76,17 +76,16 @@ using namespace ::com::sun::star::form; using namespace ::com::sun::star::view; using namespace ::com::sun::star::ui::dialogs; -struct SwMailMergeDlg_Impl -{ +struct SwMailMergeDlg_Impl { uno::Reference<runtime::XFormController> xFController; uno::Reference<XSelectionChangeListener> xChgLstnr; uno::Reference<XSelectionSupplier> xSelSupp; }; class SwXSelChgLstnr_Impl : public cppu::WeakImplHelper -< + < view::XSelectionChangeListener -> + > { SwMailMergeDlg& rParent; public: @@ -115,8 +114,7 @@ void SwXSelChgLstnr_Impl::selectionChanged( const EventObject& ) throw (Runtime rParent.m_pMarkedRB->Enable(bEnable); if(bEnable) rParent.m_pMarkedRB->Check(); - else if(rParent.m_pMarkedRB->IsChecked()) - { + else if(rParent.m_pMarkedRB->IsChecked()) { rParent.m_pAllRB->Check(); rParent.m_aSelection.realloc(0); } @@ -128,11 +126,11 @@ void SwXSelChgLstnr_Impl::disposing( const EventObject& ) throw (RuntimeExcepti } SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, - const OUString& rSourceName, - const OUString& rTableName, - sal_Int32 nCommandType, - const uno::Reference< XConnection>& _xConnection, - Sequence< Any >* pSelection) : + const OUString& rSourceName, + const OUString& rTableName, + sal_Int32 nCommandType, + const uno::Reference< XConnection>& _xConnection, + Sequence< Any >* pSelection) : SvxStandardDialog(pParent, "MailmergeDialog", "modules/swriter/ui/mailmerge.ui"), @@ -201,33 +199,25 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, aFilePos.X() -= (aFilePos.X() - aMailPos.X()) /2; m_pFileRB->SetPosPixel(aFilePos); uno::Reference< lang::XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory(); - if(pSelection) - { + if(pSelection) { m_aSelection = *pSelection; m_pBeamerWin->Show(false); - } - else - { - try - { + } else { + try { // create a frame wrapper for myself m_xFrame = frame::Frame::create( comphelper::getProcessComponentContext() ); m_pUIBuilder->drop_ownership(m_pBeamerWin); m_xFrame->initialize( VCLUnoHelper::GetInterface ( m_pBeamerWin ) ); - } - catch (const Exception&) - { + } catch (const Exception&) { m_xFrame.clear(); } - if(m_xFrame.is()) - { + if(m_xFrame.is()) { URL aURL; aURL.Complete = ".component:DB/DataSourceBrowser"; uno::Reference<XDispatch> xD = m_xFrame->queryDispatch(aURL, - "", - 0x0C); - if(xD.is()) - { + "", + 0x0C); + if(xD.is()) { Sequence<PropertyValue> aProperties(3); PropertyValue* pProperties = aProperties.getArray(); pProperties[0].Name = "DataSourceName"; @@ -241,12 +231,10 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, } uno::Reference<XController> xController = m_xFrame->getController(); pImpl->xFController = uno::Reference<runtime::XFormController>(xController, UNO_QUERY); - if(pImpl->xFController.is()) - { + if(pImpl->xFController.is()) { uno::Reference< awt::XControl > xCtrl = pImpl->xFController->getCurrentControl( ); pImpl->xSelSupp = uno::Reference<XSelectionSupplier>(xCtrl, UNO_QUERY); - if(pImpl->xSelSupp.is()) - { + if(pImpl->xSelSupp.is()) { pImpl->xChgLstnr = new SwXSelChgLstnr_Impl(*this); pImpl->xSelSupp->addSelectionChangeListener( pImpl->xChgLstnr ); } @@ -308,8 +296,7 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, m_pAddressFieldLB->SelectEntry("EMAIL"); OUString sPath(pModOpt->GetMailingPath()); - if(sPath.isEmpty()) - { + if(sPath.isEmpty()) { SvtPathOptions aPathOpt; sPath = aPathOpt.GetWorkPath(); } @@ -319,11 +306,9 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, else m_pPathED->SetText(aURL.GetFull()); - if (!bColumn ) - { + if (!bColumn ) { m_pColumnLB->SelectEntry("NAME"); - } - else + } else m_pColumnLB->SelectEntry(pModOpt->GetNameFromColumn()); if (m_pAddressFieldLB->GetSelectEntryCount() == 0) @@ -335,27 +320,24 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, m_pMarkedRB->Enable(bEnable); if (bEnable) m_pMarkedRB->Check(); - else - { + else { m_pAllRB->Check(); m_pMarkedRB->Enable(false); } SetMinOutputSizePixel(m_aDialogSize); - try - { + try { uno::Reference< container::XNameContainer> xFilterFactory( - xMSF->createInstance("com.sun.star.document.FilterFactory"), UNO_QUERY_THROW); + xMSF->createInstance("com.sun.star.document.FilterFactory"), UNO_QUERY_THROW); uno::Reference< container::XContainerQuery > xQuery(xFilterFactory, UNO_QUERY_THROW); const OUString sCommand("matchByDocumentService=com.sun.star.text.TextDocument:iflags=" - + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::EXPORT)) - + ":eflags=" - + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::NOTINFILEDLG)) - + ":default_first"); + + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::EXPORT)) + + ":eflags=" + + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::NOTINFILEDLG)) + + ":default_first"); uno::Reference< container::XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand); const OUString sName("Name"); sal_Int32 nODT = -1; - while(xList->hasMoreElements()) - { + while(xList->hasMoreElements()) { comphelper::SequenceAsHashMap aFilter(xList->nextElement()); const OUString sFilter = aFilter.getUnpackedValueOrDefault(sName, OUString()); @@ -364,16 +346,13 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, aProps >>= aFilterProperties; OUString sUIName2; const beans::PropertyValue* pFilterProperties = aFilterProperties.getConstArray(); - for(sal_Int32 nProp = 0; nProp < aFilterProperties.getLength(); ++nProp) - { - if(pFilterProperties[nProp].Name == "UIName") - { + for(sal_Int32 nProp = 0; nProp < aFilterProperties.getLength(); ++nProp) { + if(pFilterProperties[nProp].Name == "UIName") { pFilterProperties[nProp].Value >>= sUIName2; break; } } - if( !sUIName2.isEmpty() ) - { + if( !sUIName2.isEmpty() ) { const sal_Int32 nFilter = m_pFilterLB->InsertEntry( sUIName2 ); if( sFilter == "writer8" ) nODT = nFilter; @@ -381,9 +360,7 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, } } m_pFilterLB->SelectEntryPos( nODT ); - } - catch (const uno::Exception&) - { + } catch (const uno::Exception&) { } } @@ -394,14 +371,12 @@ SwMailMergeDlg::~SwMailMergeDlg() void SwMailMergeDlg::dispose() { - if(m_xFrame.is()) - { + if(m_xFrame.is()) { m_xFrame->setComponent(NULL, NULL); m_xFrame->dispose(); } - for( sal_Int32 nFilter = 0; nFilter < m_pFilterLB->GetEntryCount(); ++nFilter ) - { + for( sal_Int32 nFilter = 0; nFilter < m_pFilterLB->GetEntryCount(); ++nFilter ) { OUString* pData = static_cast< OUString* >( m_pFilterLB->GetEntryData(nFilter) ); delete pData; } @@ -447,8 +422,7 @@ void SwMailMergeDlg::Apply() IMPL_LINK( SwMailMergeDlg, ButtonHdl, Button *, pBtn ) { - if (pBtn == m_pOkBTN) - { + if (pBtn == m_pOkBTN) { if( ExecQryShell() ) EndDialog(RET_OK); } @@ -464,12 +438,9 @@ IMPL_LINK( SwMailMergeDlg, OutputTypeHdl, RadioButton *, pBtn ) m_pSaveSingleDocRB->Enable( !bPrint ); m_pSaveIndividualRB->Enable( !bPrint ); - if( !bPrint ) - { + if( !bPrint ) { SaveTypeHdl( m_pSaveSingleDocRB->IsChecked() ? m_pSaveSingleDocRB : m_pSaveIndividualRB ); - } - else - { + } else { m_pPathFT->Enable(false); m_pPathED->Enable(false); m_pPathPB->Enable(false); @@ -488,12 +459,9 @@ IMPL_LINK( SwMailMergeDlg, SaveTypeHdl, RadioButton*, pBtn ) bool bIndividual = pBtn == m_pSaveIndividualRB; m_pGenerateFromDataBaseCB->Enable( bIndividual ); - if( bIndividual ) - { + if( bIndividual ) { FilenameHdl( m_pGenerateFromDataBaseCB ); - } - else - { + } else { m_pColumnFT->Enable(false); m_pColumnLB->Enable(false); m_pPathFT->Enable( false ); @@ -515,7 +483,7 @@ IMPL_LINK( SwMailMergeDlg, FilenameHdl, CheckBox*, pBox ) m_pPathPB->Enable( bEnable ); m_pFilterFT->Enable( bEnable ); m_pFilterLB->Enable( bEnable ); - return 0; + return 0; } IMPL_LINK_NOARG(SwMailMergeDlg, ModifyHdl) @@ -526,16 +494,14 @@ IMPL_LINK_NOARG(SwMailMergeDlg, ModifyHdl) bool SwMailMergeDlg::ExecQryShell() { - if(pImpl->xSelSupp.is()) - { + if(pImpl->xSelSupp.is()) { pImpl->xSelSupp->removeSelectionChangeListener( pImpl->xChgLstnr ); } SwDBManager* pMgr = rSh.GetDBManager(); if (m_pPrinterRB->IsChecked()) nMergeType = DBMGR_MERGE_PRINTER; - else - { + else { nMergeType = DBMGR_MERGE_FILE; SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium(); INetURLObject aAbs; @@ -551,15 +517,12 @@ bool SwMailMergeDlg::ExecQryShell() pModOpt->SetIsNameFromColumn(m_pGenerateFromDataBaseCB->IsChecked()); - if (m_pGenerateFromDataBaseCB->IsEnabled() && m_pGenerateFromDataBaseCB->IsChecked()) - { + if (m_pGenerateFromDataBaseCB->IsEnabled() && m_pGenerateFromDataBaseCB->IsChecked()) { pMgr->SetEMailColumn(m_pColumnLB->GetSelectEntry()); pModOpt->SetNameFromColumn(m_pColumnLB->GetSelectEntry()); if( m_pFilterLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) m_sSaveFilter = *static_cast<const OUString*>(m_pFilterLB->GetSelectEntryData()); - } - else - { + } else { //#i97667# reset column name - otherwise it's remembered from the last run pMgr->SetEMailColumn(OUString()); //start save as dialog @@ -573,8 +536,7 @@ bool SwMailMergeDlg::ExecQryShell() pMgr->SetSubject(sPath); } - if (m_pFromRB->IsChecked()) // Insert list - { + if (m_pFromRB->IsChecked()) { // Insert list // Safe: the maximal value of the fields is limited sal_Int32 nStart = sal::static_int_cast<sal_Int32>(m_pFromNF->GetValue()); sal_Int32 nEnd = sal::static_int_cast<sal_Int32>(m_pToNF->GetValue()); @@ -586,33 +548,28 @@ bool SwMailMergeDlg::ExecQryShell() Any* pSelection = m_aSelection.getArray(); for (sal_Int32 i = nStart; i <= nEnd; ++i, ++pSelection) *pSelection <<= i; - } - else if (m_pAllRB->IsChecked() ) + } else if (m_pAllRB->IsChecked() ) m_aSelection.realloc(0); // Empty selection = insert all - else - { - if(pImpl->xSelSupp.is()) - { + else { + if(pImpl->xSelSupp.is()) { //update selection uno::Reference< XRowLocate > xRowLocate(GetResultSet(),UNO_QUERY); uno::Reference< XResultSet > xRes(xRowLocate,UNO_QUERY); pImpl->xSelSupp->getSelection() >>= m_aSelection; - if ( xRowLocate.is() ) - { + if ( xRowLocate.is() ) { Any* pBegin = m_aSelection.getArray(); Any* pEnd = pBegin + m_aSelection.getLength(); - for (;pBegin != pEnd ; ++pBegin) - { + for (; pBegin != pEnd ; ++pBegin) { if ( xRowLocate->moveToBookmark(*pBegin) ) *pBegin <<= xRes->getRow(); } } } } - IDocumentDeviceAccess* pIDDA = rSh.getIDocumentDeviceAccess(); - SwPrintData aPrtData( pIDDA->getPrintData() ); + IDocumentDeviceAccess& rIDDA = rSh.getIDocumentDeviceAccess(); + SwPrintData aPrtData( rIDDA.getPrintData() ); aPrtData.SetPrintSingleJobs(m_pSingleJobsCB->IsChecked()); - pIDDA->setPrintData(aPrtData); + rIDDA.setPrintData(aPrtData); pModOpt->SetSinglePrintJob(m_pSingleJobsCB->IsChecked()); @@ -631,8 +588,7 @@ bool SwMailMergeDlg::ExecQryShell() IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl) { OUString sPath( m_pPathED->GetText() ); - if( sPath.isEmpty() ) - { + if( sPath.isEmpty() ) { SvtPathOptions aPathOpt; sPath = aPathOpt.GetWorkPath(); } @@ -640,8 +596,7 @@ IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl) uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < XFolderPicker2 > xFP = FolderPicker::create(xContext); xFP->setDisplayDirectory(sPath); - if( xFP->execute() == RET_OK ) - { + if( xFP->execute() == RET_OK ) { INetURLObject aURL(xFP->getDirectory()); if(aURL.GetProtocol() == INetProtocol::File) m_pPathED->SetText(aURL.PathToFileName()); @@ -654,8 +609,7 @@ IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl) uno::Reference<XResultSet> SwMailMergeDlg::GetResultSet() const { uno::Reference< XResultSet > xResSetClone; - if ( pImpl->xFController.is() ) - { + if ( pImpl->xFController.is() ) { // we create a clone to do the task uno::Reference< XResultSetAccess > xResultSetAccess( pImpl->xFController->getModel(),UNO_QUERY); if ( xResultSetAccess.is() ) @@ -666,7 +620,7 @@ uno::Reference<XResultSet> SwMailMergeDlg::GetResultSet() const SwMailMergeCreateFromDlg::SwMailMergeCreateFromDlg(vcl::Window* pParent) : ModalDialog(pParent, "MailMergeDialog", - "modules/swriter/ui/mailmergedialog.ui") + "modules/swriter/ui/mailmergedialog.ui") { get(m_pThisDocRB, "document"); } @@ -684,7 +638,7 @@ void SwMailMergeCreateFromDlg::dispose() SwMailMergeFieldConnectionsDlg::SwMailMergeFieldConnectionsDlg(vcl::Window* pParent) : ModalDialog(pParent, "MergeConnectDialog", - "modules/swriter/ui/mergeconnectdialog.ui") + "modules/swriter/ui/mergeconnectdialog.ui") { get(m_pUseExistingRB, "existing"); } diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx index 7523cac8d503..7af4e717e339 100644 --- a/sw/source/ui/misc/linenum.cxx +++ b/sw/source/ui/misc/linenum.cxx @@ -99,9 +99,9 @@ SwLineNumberingDlg::SwLineNumberingDlg(SwView *pVw) ::FillCharStyleListBox(*m_pCharStyleLB, pSh->GetView().GetDocShell()); const SwLineNumberInfo &rInf = pSh->GetLineNumberInfo(); - IDocumentStylePoolAccess* pIDSPA = pSh->getIDocumentStylePoolAccess(); + IDocumentStylePoolAccess& rIDSPA = pSh->getIDocumentStylePoolAccess(); - OUString sStyleName(rInf.GetCharFormat( *pIDSPA )->GetName()); + OUString sStyleName(rInf.GetCharFormat( rIDSPA )->GetName()); const sal_Int32 nPos = m_pCharStyleLB->GetEntryPos(sStyleName); if (nPos != LISTBOX_ENTRY_NOTFOUND) diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx index 1820d88a46e0..f4fcb423ff86 100644 --- a/sw/source/uibase/app/appenv.cxx +++ b/sw/source/uibase/app/appenv.cxx @@ -186,7 +186,7 @@ void SwModule::InsertEnv( SfxRequest& rReq ) SfxItemSet aSet(GetPool(), FN_ENVELOP, FN_ENVELOP, 0); aSet.Put(aEnvCfg.GetItem()); - SfxPrinter* pTempPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); + SfxPrinter* pTempPrinter = pSh->getIDocumentDeviceAccess().getPrinter( true ); if(pOldSh ) { const SwPageDesc& rCurPageDesc = pOldSh->GetPageDesc(pOldSh->GetCurPageDesc()); @@ -194,13 +194,13 @@ void SwModule::InsertEnv( SfxRequest& rReq ) SwStyleNameMapper::FillUIName( RES_POOLPAGE_JAKET, sJacket ); bEnvChange = rCurPageDesc.GetName() == sJacket; - IDocumentDeviceAccess* pIDDA_old = pOldSh->getIDocumentDeviceAccess(); - if( pIDDA_old->getPrinter( false ) ) + IDocumentDeviceAccess& rIDDA_old = pOldSh->getIDocumentDeviceAccess(); + if( rIDDA_old.getPrinter( false ) ) { - IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess(); - pIDDA->setJobsetup( *pIDDA_old->getJobsetup() ); + IDocumentDeviceAccess& rIDDA = pSh->getIDocumentDeviceAccess(); + rIDDA.setJobsetup( *rIDDA_old.getJobsetup() ); //#69563# if it isn't the same printer then the pointer has been invalidated! - pTempPrinter = pIDDA->getPrinter( true ); + pTempPrinter = rIDDA.getPrinter( true ); } pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue()); @@ -244,7 +244,7 @@ void SwModule::InsertEnv( SfxRequest& rReq ) { OSL_ENSURE(pOldSh, "No document - wasn't 'Insert' disabled???"); SvxPaperBinItem aItem( RES_PAPER_BIN ); - aItem.SetValue((sal_uInt8)pSh->getIDocumentDeviceAccess()->getPrinter(true)->GetPaperBin()); + aItem.SetValue((sal_uInt8)pSh->getIDocumentDeviceAccess().getPrinter(true)->GetPaperBin()); pOldSh->GetPageDescFromPool(RES_POOLPAGE_JAKET)->GetMaster().SetFormatAttr(aItem); } @@ -338,7 +338,7 @@ void SwModule::InsertEnv( SfxRequest& rReq ) SwPageDesc* pDesc = pSh->GetPageDescFromPool(RES_POOLPAGE_JAKET); SwFrameFormat& rFormat = pDesc->GetMaster(); - Printer *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true ); + Printer *pPrt = pSh->getIDocumentDeviceAccess().getPrinter( true ); // Borders (are put together by Shift-Offset and alignment) Size aPaperSize = pPrt->PixelToLogic( pPrt->GetPaperSizePixel(), diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx index 4858f898f19b..f7778b3fb6f4 100644 --- a/sw/source/uibase/app/applab.cxx +++ b/sw/source/uibase/app/applab.cxx @@ -198,7 +198,7 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel) if (pPrt) { SwDocShell *pDocSh = static_cast<SwDocShell*>(&*xDocSh); - pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup()); + pDocSh->getIDocumentDeviceAccess().setJobsetup(pPrt->GetJobSetup()); } SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq ); @@ -272,7 +272,7 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel) const SwPageDesc &rFollow = pSh->GetPageDesc( pSh->GetCurPageDesc() ); aDesc.SetFollow( &rFollow ); - pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true ); + pPrt = pSh->getIDocumentDeviceAccess().getPrinter( true ); SvxPaperBinItem aItem( RES_PAPER_BIN ); aItem.SetValue((sal_Int8)pPrt->GetPaperBin()); rFormat.SetFormatAttr(aItem); diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 00b93f30e036..d0453e4f80ee 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -131,7 +131,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId ) { SwWrtShell& rWrtShell = pAppView->GetWrtShell(); - SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess()->getPrinter( false ); + SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess().getPrinter( false ); if( pPrt ) pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt)); pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell)); @@ -218,7 +218,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId ) // Options for PrintTabPage const SwPrintData* pOpt = pAppView ? - &pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() : + &pAppView->GetWrtShell().getIDocumentDeviceAccess().getPrintData() : 0; if(!pOpt) @@ -383,7 +383,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) *pOpt = *pAddPrinterAttr; if(pAppView) - pAppView->GetWrtShell().getIDocumentDeviceAccess()->setPrintData( *pOpt ); + pAppView->GetWrtShell().getIDocumentDeviceAccess().setPrintData( *pOpt ); } } diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 32cc3039accd..2530fa2608e6 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -1270,7 +1270,7 @@ bool SwDocShell::HasChangeRecordProtection() const { if (!m_pWrtShell) return false; - return m_pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength() > 0; + return m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().getLength() > 0; } void SwDocShell::SetChangeRecording( bool bActivate ) @@ -1286,8 +1286,8 @@ bool SwDocShell::SetProtectionPassword( const OUString &rNewPassword ) const SfxItemSet* pArgs = &aSet; const SfxPoolItem* pItem = NULL; - IDocumentRedlineAccess* pIDRA = m_pWrtShell->getIDocumentRedlineAccess(); - Sequence< sal_Int8 > aPasswd = pIDRA->GetRedlinePassword(); + IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); + Sequence< sal_Int8 > aPasswd = rIDRA.GetRedlinePassword(); if (pArgs && SfxItemState::SET == pArgs->GetItemState( FN_REDLINE_PROTECT, false, &pItem ) && static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswd.getLength() > 0)) return false; @@ -1301,12 +1301,12 @@ bool SwDocShell::SetProtectionPassword( const OUString &rNewPassword ) Sequence< sal_Int8 > aNewPasswd; SvPasswordHelper::GetHashPassword( aNewPasswd, rNewPassword ); - pIDRA->SetRedlinePassword( aNewPasswd ); + rIDRA.SetRedlinePassword( aNewPasswd ); bRes = true; } else { - pIDRA->SetRedlinePassword( Sequence< sal_Int8 >() ); + rIDRA.SetRedlinePassword( Sequence< sal_Int8 >() ); bRes = true; } @@ -1321,8 +1321,8 @@ bool SwDocShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal const SfxItemSet* pArgs = &aSet; const SfxPoolItem* pItem = NULL; - IDocumentRedlineAccess* pIDRA = m_pWrtShell->getIDocumentRedlineAccess(); - Sequence< sal_Int8 > aPasswdHash( pIDRA->GetRedlinePassword() ); + IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); + Sequence< sal_Int8 > aPasswdHash( rIDRA.GetRedlinePassword() ); if (pArgs && SfxItemState::SET == pArgs->GetItemState( FN_REDLINE_PROTECT, false, &pItem ) && static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswdHash.getLength() != 0)) return false; diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index a774e66b11e5..73ef5c352318 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -691,8 +691,8 @@ void SwDocShell::SubInitNew() /* * Document Interface Access */ -IDocumentDeviceAccess* SwDocShell::getIDocumentDeviceAccess() { return &m_pDoc->getIDocumentDeviceAccess(); } -const IDocumentSettingAccess* SwDocShell::getIDocumentSettingAccess() const { return &m_pDoc->getIDocumentSettingAccess(); } -IDocumentChartDataProviderAccess* SwDocShell::getIDocumentChartDataProviderAccess() { return &m_pDoc->getIDocumentChartDataProviderAccess(); } +IDocumentDeviceAccess& SwDocShell::getIDocumentDeviceAccess() { return m_pDoc->getIDocumentDeviceAccess(); } +const IDocumentSettingAccess& SwDocShell::getIDocumentSettingAccess() const { return m_pDoc->getIDocumentSettingAccess(); } +IDocumentChartDataProviderAccess& SwDocShell::getIDocumentChartDataProviderAccess() { return m_pDoc->getIDocumentChartDataProviderAccess(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 3c76f2564644..a81e1f5e006c 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -782,8 +782,8 @@ sal_uInt16 SwDocShell::Edit( // get one here. SwWrtShell* pCurrShell = (pActShell) ? pActShell : m_pWrtShell; if( ( HTMLMODE_ON & nHtmlMode ) && - !pCurrShell->getIDocumentDeviceAccess()->getPrinter( false ) ) - pCurrShell->InitPrt( pCurrShell->getIDocumentDeviceAccess()->getPrinter( true ) ); + !pCurrShell->getIDocumentDeviceAccess().getPrinter( false ) ) + pCurrShell->InitPrt( pCurrShell->getIDocumentDeviceAccess().getPrinter( true ) ); PutItem(SfxUInt16Item(SID_HTML_MODE, nHtmlMode)); FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode)); diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 84f6fddc86bb..e29cb22166c7 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -780,7 +780,7 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh) aTmpOutliner.SetSpeller( xSpell ); OutlinerView* pOutlView = new OutlinerView( &aTmpOutliner, &(rView.GetEditWin()) ); - pOutlView->GetOutliner()->SetRefDevice( rSh.getIDocumentDeviceAccess()->getPrinter( false ) ); + pOutlView->GetOutliner()->SetRefDevice( rSh.getIDocumentDeviceAccess().getPrinter( false ) ); aTmpOutliner.InsertView( pOutlView ); Point aPt; Size aSize(1,1); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 44185b4884fb..c6b6b817cd84 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -527,7 +527,7 @@ bool SwPostItMgr::CalcRects() mPages[aPageNum-1]->eSidebarPosition = pItem->maLayoutInfo.meSidebarPosition; } - if (!bChange && mpWrtShell->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE)) + if (!bChange && mpWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE)) { long nLayoutHeight = SwPostItHelper::getLayoutHeight( mpWrtShell->GetLayout() ); if( nLayoutHeight > mbLayoutHeight ) @@ -622,7 +622,7 @@ void SwPostItMgr::LayoutPostIts() mlPageBorder = mpEditWin->LogicToPixel( Point( mPages[n]->mPageRect.Left(), 0)).X() - GetSidebarWidth(true);// - GetSidebarBorderWidth(true); //bending point mlPageEnd = - mpWrtShell->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) + mpWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) ? pItem->maLayoutInfo.mPagePrtArea.Left() : mPages[n]->mPageRect.Left() + 350; } @@ -632,7 +632,7 @@ void SwPostItMgr::LayoutPostIts() mlPageBorder = mpEditWin->LogicToPixel( Point(mPages[n]->mPageRect.Right(), 0)).X() + GetSidebarBorderWidth(true); //bending point mlPageEnd = - mpWrtShell->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) + mpWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) ? pItem->maLayoutInfo.mPagePrtArea.Right() : mPages[n]->mPageRect.Right() - 350; } @@ -1631,7 +1631,7 @@ void SwPostItMgr::PrepareView(bool bIgnoreCount) SwRootFrm* pLayout = mpWrtShell->GetLayout(); if ( pLayout ) SwPostItHelper::setSidebarChanged( pLayout, - mpWrtShell->getIDocumentSettingAccess()->get( DocumentSettingId::BROWSE_MODE ) ); + mpWrtShell->getIDocumentSettingAccess().get( DocumentSettingId::BROWSE_MODE ) ); mpWrtShell->EndAllAction(); } } diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index 8bf1c98a1dc7..e10179963aac 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -545,14 +545,14 @@ void SwSidebarWin::SetPosAndSize() { case sw::sidebarwindows::SidebarPosition::LEFT: { - aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) ); - aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) ); + aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) ); + aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) ); } break; case sw::sidebarwindows::SidebarPosition::RIGHT: { - aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) ); - aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) ); + aLineStart = EditWin().PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) ); + aLineEnd = EditWin().PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) ); } break; default: @@ -609,8 +609,8 @@ void SwSidebarWin::SetPosAndSize() if (bChange) { - Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height())); - Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height())); + Point aStart = EditWin().PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height())); + Point aEnd = EditWin().PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height())); mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y())); } @@ -818,8 +818,8 @@ void SwSidebarWin::SetSizePixel( const Size& rNewSize ) if (mpShadow) { - Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height())); - Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height())); + Point aStart = EditWin().PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height())); + Point aEnd = EditWin().PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height())); mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y())); } } @@ -1096,9 +1096,9 @@ void SwSidebarWin::ExecuteCommand(sal_uInt16 nSlot) } } -SwEditWin* SwSidebarWin::EditWin() +SwEditWin& SwSidebarWin::EditWin() { - return &mrView.GetEditWin(); + return mrView.GetEditWin(); } long SwSidebarWin::GetPostItTextHeight() diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx index 4f06e6fd2e10..c527e1244eea 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -188,8 +188,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) // special handling if target is a cross-reference bookmark { OUString sTmpSearchStr = sText.copy( 1 ); - IDocumentMarkAccess* const pMarkAccess = - rSh.getIDocumentMarkAccess(); + IDocumentMarkAccess* pMarkAccess = rSh.getIDocumentMarkAccess(); IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findBookmark( sTmpSearchStr ); if ( ppBkmk != pMarkAccess->getBookmarksEnd() && diff --git a/sw/source/uibase/lingu/sdrhhcwrap.cxx b/sw/source/uibase/lingu/sdrhhcwrap.cxx index 5d8e364e5918..956e7a576180 100644 --- a/sw/source/uibase/lingu/sdrhhcwrap.cxx +++ b/sw/source/uibase/lingu/sdrhhcwrap.cxx @@ -74,7 +74,7 @@ SdrHHCWrapper::SdrHHCWrapper( SwView* pVw, SetPaperSize( aSize ); pOutlView = new OutlinerView( this, &(pView->GetEditWin()) ); - pOutlView->GetOutliner()->SetRefDevice(pView->GetWrtShell().getIDocumentDeviceAccess()->getPrinter( false )); + pOutlView->GetOutliner()->SetRefDevice(pView->GetWrtShell().getIDocumentDeviceAccess().getPrinter( false )); // Hack: all SdrTextObj attributes should be transferred to EditEngine pOutlView->SetBackgroundColor( Color( COL_WHITE ) ); diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 39ac83783291..dd2f23f46ae3 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -295,7 +295,7 @@ void SwRedlineAcceptDlg::InitAuthors() if (pFilterPage->SelectAuthor(sOldAuthor) == LISTBOX_ENTRY_NOTFOUND && !aStrings.empty()) pFilterPage->SelectAuthor(aStrings[0]); - bool bEnable = pTable->GetEntryCount() != 0 && !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength(); + bool bEnable = pTable->GetEntryCount() != 0 && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().getLength(); bool bSel = pTable->FirstSelected() != 0; SvTreeListEntry* pSelEntry = pTable->FirstSelected(); @@ -1014,7 +1014,7 @@ IMPL_LINK_NOARG_TYPED(SwRedlineAcceptDlg, GotoHdl, Timer *, void) pSh->EndAction(); SwViewShell::SetCareWin(NULL); } - bool bEnable = !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength(); + bool bEnable = !pSh->getIDocumentRedlineAccess().GetRedlinePassword().getLength(); pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ ); pTPView->EnableReject( bEnable && bSel && bIsNotFormated /*&& !bReadonlySel*/ ); pTPView->EnableRejectAll( bEnable && !bOnlyFormatedRedlines && !bHasReadonlySel ); diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index 2eed3b425667..7415b8b17aa2 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -448,9 +448,9 @@ IMPL_LINK( SwInputWindow, SelTableCellsNotify, SwWrtShell *, pCaller ) aPam.SetMark(); aPam.Move( fnMoveForward, fnGoSection ); - IDocumentContentOperations* pIDCO = pWrtShell->getIDocumentContentOperations(); - pIDCO->DeleteRange( aPam ); - pIDCO->InsertString( aPam, sNew ); + IDocumentContentOperations& rIDCO = pWrtShell->getIDocumentContentOperations(); + rIDCO.DeleteRange( aPam ); + rIDCO.InsertString( aPam, sNew ); pWrtShell->EndAllAction(); sOldFormula = sNew; } diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index 4e8637e7b889..ce7a272302c7 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -606,7 +606,7 @@ IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl, AbstractSvxNameDialog*, pNam else { nRet = 1; - SwDrawModel* pModel = rSh.getIDocumentDrawModelAccess()->GetDrawModel(); + SwDrawModel* pModel = rSh.getIDocumentDrawModelAccess().GetDrawModel(); SdrObjListIter aIter( *(pModel->GetPage(0)), IM_DEEPWITHGROUPS ); while( aIter.IsMore() ) { diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 9bab3ad99e38..cde79a064a83 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -439,7 +439,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) + GetShell().GetBoxNms(); // get table data provider - xDataProvider.set( GetView().GetDocShell()->getIDocumentChartDataProviderAccess()->GetChartDataProvider() ); + xDataProvider.set( GetView().GetDocShell()->getIDocumentChartDataProviderAccess().GetChartDataProvider() ); } else bFillWithData = false; // will create chart with only it's default image diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index a210d2613909..8dcff4199011 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -938,7 +938,7 @@ void SwTextShell::Execute(SfxRequest &rReq) // Left border as offset //#i24363# tab stops relative to indent - const long nOff = rWrtSh.getIDocumentSettingAccess()->get(DocumentSettingId::TABS_RELATIVE_TO_INDENT) ? + const long nOff = rWrtSh.getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT) ? static_cast<const SvxLRSpaceItem&>(aCoreSet.Get( RES_LR_SPACE )).GetTextLeft() : 0; SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff ); aCoreSet.Put( aOff ); diff --git a/sw/source/uibase/table/chartins.cxx b/sw/source/uibase/table/chartins.cxx index 6da2f8455932..1515a85c53ab 100644 --- a/sw/source/uibase/table/chartins.cxx +++ b/sw/source/uibase/table/chartins.cxx @@ -158,7 +158,7 @@ void SwInsertChart(vcl::Window* pParent, SfxBindings* pBindings ) aRangeString = pTableFormat->GetName() + "." + rWrtShell.GetBoxNms(); // get table data provider - xDataProvider.set( pView->GetDocShell()->getIDocumentChartDataProviderAccess()->GetChartDataProvider( true ) ); + xDataProvider.set( pView->GetDocShell()->getIDocumentChartDataProviderAccess().GetChartDataProvider( true ) ); } } diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 5d1ad3befe8d..1b8993604bfc 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -1647,25 +1647,25 @@ void SwPagePreview::ScrollDocSzChg() // All about printing SfxPrinter* SwPagePreview::GetPrinter( bool bCreate ) { - return pViewWin->GetViewShell()->getIDocumentDeviceAccess()->getPrinter( bCreate ); + return pViewWin->GetViewShell()->getIDocumentDeviceAccess().getPrinter( bCreate ); } sal_uInt16 SwPagePreview::SetPrinter( SfxPrinter *pNew, SfxPrinterChangeFlags nDiffFlags, bool ) { SwViewShell &rSh = *GetViewShell(); - SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false ); + SfxPrinter* pOld = rSh.getIDocumentDeviceAccess().getPrinter( false ); if ( pOld && pOld->IsPrinting() ) return SFX_PRINTERROR_BUSY; SwEditShell &rESh = static_cast<SwEditShell&>(rSh); //Buh... if( ( SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP ) & nDiffFlags ) { - rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true ); + rSh.getIDocumentDeviceAccess().setPrinter( pNew, true, true ); if( nDiffFlags & SfxPrinterChangeFlags::PRINTER ) rESh.SetModified(); } if ( ( nDiffFlags & SfxPrinterChangeFlags::OPTIONS ) == SfxPrinterChangeFlags::OPTIONS ) - ::SetPrinter( rSh.getIDocumentDeviceAccess(), pNew, false ); + ::SetPrinter( &rSh.getIDocumentDeviceAccess(), pNew, false ); const bool bChgOri = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_ORIENTATION); const bool bChgSize = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_SIZE); diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index db8aeba32fd3..69df7cbb1934 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -672,7 +672,7 @@ sal_uInt16 SwSrcView::SetPrinter(SfxPrinter* pNew, SfxPrinterChangeFlags nDiffFl pDocSh->SetModified(); } if ( nDiffFlags & SfxPrinterChangeFlags::OPTIONS ) - ::SetPrinter( pDocSh->getIDocumentDeviceAccess(), pNew, true ); + ::SetPrinter( &pDocSh->getIDocumentDeviceAccess(), pNew, true ); const bool bChgOri = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_ORIENTATION); const bool bChgSize = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_SIZE); diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index bd38b880477c..edd0b4211c93 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -243,7 +243,6 @@ void SwView::StateViewOptions(SfxItemSet &rSet) sal_uInt16 nWhich = aIter.FirstWhich(); SfxBoolItem aBool; const SwViewOption* pOpt = GetWrtShell().GetViewOptions(); - const IDocumentSettingAccess* pIDSA = GetDocShell()->getIDocumentSettingAccess(); while(nWhich) { @@ -327,7 +326,7 @@ void SwView::StateViewOptions(SfxItemSet &rSet) aBool.SetValue( pOpt->IsOnlineSpell() ); break; case FN_SHADOWCURSOR: - if (pIDSA == 0 || pOpt->getBrowseMode() ) + if ( pOpt->getBrowseMode() ) { rSet.DisableItem( nWhich ); nWhich = 0; diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 498a2627b1e4..a65b79af64ff 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -532,7 +532,7 @@ void SwView::Execute(SfxRequest &rReq) switch( nSlot ) { case SID_CREATE_SW_DRAWVIEW: - m_pWrtShell->getIDocumentDrawModelAccess()->GetOrCreateDrawModel(); + m_pWrtShell->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); break; case FN_LINE_NUMBERING_DLG: @@ -573,8 +573,8 @@ void SwView::Execute(SfxRequest &rReq) if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem )) { - IDocumentRedlineAccess* pIDRA = m_pWrtShell->getIDocumentRedlineAccess(); - Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword(); + IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); + Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword(); if( aPasswd.getLength() ) { OSL_ENSURE( !static_cast<const SfxBoolItem*>(pItem)->GetValue(), "SwView::Execute(): password set an redlining off doesn't match!" ); @@ -590,10 +590,10 @@ void SwView::Execute(SfxRequest &rReq) //#i69751# the result of Execute() can be ignored (void)aPasswdDlg->Execute(); OUString sNewPasswd( aPasswdDlg->GetPassword() ); - Sequence <sal_Int8> aNewPasswd = pIDRA->GetRedlinePassword(); + Sequence <sal_Int8> aNewPasswd = rIDRA.GetRedlinePassword(); SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd)) - pIDRA->SetRedlinePassword(Sequence <sal_Int8> ()); + rIDRA.SetRedlinePassword(Sequence <sal_Int8> ()); else { // xmlsec05: message box for wrong password break; @@ -609,8 +609,8 @@ void SwView::Execute(SfxRequest &rReq) break; case FN_REDLINE_PROTECT : { - IDocumentRedlineAccess* pIDRA = m_pWrtShell->getIDocumentRedlineAccess(); - Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword(); + IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); + Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword(); if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ) && static_cast<const SfxBoolItem*>(pItem)->GetValue() == ( aPasswd.getLength() != 0 ) ) break; @@ -632,18 +632,18 @@ void SwView::Execute(SfxRequest &rReq) sal_uInt16 nOn = nsRedlineMode_t::REDLINE_ON; OUString sNewPasswd( aPasswdDlg->GetPassword() ); Sequence <sal_Int8> aNewPasswd = - pIDRA->GetRedlinePassword(); + rIDRA.GetRedlinePassword(); SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); if(!aPasswd.getLength()) { - pIDRA->SetRedlinePassword(aNewPasswd); + rIDRA.SetRedlinePassword(aNewPasswd); } else if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd)) { - pIDRA->SetRedlinePassword(Sequence <sal_Int8> ()); + rIDRA.SetRedlinePassword(Sequence <sal_Int8> ()); nOn = 0; } - const sal_uInt16 nMode = pIDRA->GetRedlineMode(); + const sal_uInt16 nMode = rIDRA.GetRedlineMode(); m_pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn); rReq.AppendItem( SfxBoolItem( FN_REDLINE_PROTECT, ((nMode&nsRedlineMode_t::REDLINE_ON)==0) ) ); } @@ -1438,7 +1438,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM ); aZoomSliderItem.AddSnappingPoint( 100 ); - if ( !m_pWrtShell->getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) ) + if ( !m_pWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) ) { const sal_uInt16 nColumns = pVOpt->GetViewLayoutColumns(); const bool bAutomaticViewLayout = 0 == nColumns; @@ -1761,7 +1761,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) case SID_ATTR_VIEWLAYOUT: { - if ( pArgs && !rSh.getIDocumentSettingAccess()->get(DocumentSettingId::BROWSE_MODE) && + if ( pArgs && !rSh.getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) && ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) ) { if ( SfxItemState::SET == pArgs->GetItemState(SID_ATTR_VIEWLAYOUT, true, &pItem )) diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 7540776fb21c..b81cf88835d9 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -522,7 +522,7 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin, uno::Reference< linguistic2::XSpellChecker1 > xSpell( ::GetSpellChecker() ); if (pOutliner) { - pOutliner->SetRefDevice(pSh->getIDocumentDeviceAccess()->getReferenceDevice(false)); + pOutliner->SetRefDevice(pSh->getIDocumentDeviceAccess().getReferenceDevice(false)); pOutliner->SetSpeller(xSpell); uno::Reference<linguistic2::XHyphenator> xHyphenator( ::GetHyphenator() ); pOutliner->SetHyphenator( xHyphenator ); diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index 281567a2fa5d..64c371ec705b 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -71,9 +71,9 @@ using namespace ::com::sun::star; SfxPrinter* SwView::GetPrinter( bool bCreate ) { - const IDocumentDeviceAccess* pIDDA = GetWrtShell().getIDocumentDeviceAccess(); - SfxPrinter *pOld = pIDDA->getPrinter( false ); - SfxPrinter *pPrt = pIDDA->getPrinter( bCreate ); + const IDocumentDeviceAccess& rIDDA = GetWrtShell().getIDocumentDeviceAccess(); + SfxPrinter *pOld = rIDDA.getPrinter( false ); + SfxPrinter *pPrt = rIDDA.getPrinter( bCreate ); if ( pOld != pPrt ) { bool bWeb = 0 != dynamic_cast<SwWebView*>(this); @@ -107,19 +107,19 @@ void SetPrinter( IDocumentDeviceAccess* pIDDA, SfxPrinter* pNew, bool bWeb ) sal_uInt16 SwView::SetPrinter(SfxPrinter* pNew, SfxPrinterChangeFlags nDiffFlags, bool ) { SwWrtShell &rSh = GetWrtShell(); - SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false ); + SfxPrinter* pOld = rSh.getIDocumentDeviceAccess().getPrinter( false ); if ( pOld && pOld->IsPrinting() ) return SFX_PRINTERROR_BUSY; if ( (SfxPrinterChangeFlags::JOBSETUP | SfxPrinterChangeFlags::PRINTER) & nDiffFlags ) { - rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true ); + rSh.getIDocumentDeviceAccess().setPrinter( pNew, true, true ); if ( nDiffFlags & SfxPrinterChangeFlags::PRINTER ) rSh.SetModified(); } bool bWeb = this->ISA(SwWebView); if ( nDiffFlags & SfxPrinterChangeFlags::OPTIONS ) - ::SetPrinter( rSh.getIDocumentDeviceAccess(), pNew, bWeb ); + ::SetPrinter( &rSh.getIDocumentDeviceAccess(), pNew, bWeb ); const bool bChgOri = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_ORIENTATION); const bool bChgSize = bool(nDiffFlags & SfxPrinterChangeFlags::CHG_SIZE); @@ -273,10 +273,10 @@ VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent, void SetAppPrintOptions( SwViewShell* pSh, bool bWeb ) { - const IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess(); - SwPrintData aPrtData = pIDDA->getPrintData(); + const IDocumentDeviceAccess& rIDDA = pSh->getIDocumentDeviceAccess(); + SwPrintData aPrtData = rIDDA.getPrintData(); - if( pIDDA->getPrinter( false ) ) + if( rIDDA.getPrinter( false ) ) { // Close application own printing options in SfxPrinter. SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, aPrtData); @@ -299,7 +299,7 @@ void SetAppPrintOptions( SwViewShell* pSh, bool bWeb ) static_cast<int>(aMisc.IsPaperSizeWarning() ? SfxPrinterChangeFlags::CHG_SIZE : SfxPrinterChangeFlags::NONE) | static_cast<int>(aMisc.IsPaperOrientationWarning() ? SfxPrinterChangeFlags::CHG_ORIENTATION : SfxPrinterChangeFlags::NONE ))); - pIDDA->getPrinter( true )->SetOptions( aSet ); + rIDDA.getPrinter( true )->SetOptions( aSet ); } } diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index 1315f6867c94..cfc2f0210a40 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -391,7 +391,7 @@ void SwView::GetState(SfxItemSet &rSet) case SID_DOCUMENT_COMPARE: case SID_DOCUMENT_MERGE: if( GetDocShell()->IsA( SwGlobalDocShell::StaticType() ) || - (SID_DOCUMENT_MERGE == nWhich && m_pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength())) + (SID_DOCUMENT_MERGE == nWhich && m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().getLength())) rSet.DisableItem(nWhich); break; case SID_VIEW_DATA_SOURCE_BROWSER: diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 5245344ddb3f..23c9b59ab92b 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -1022,7 +1022,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) m_pVRuler->SetStyle(bVerticalWriting ? nRulerStyle|WB_EXTRAFIELD : nRulerStyle); //#i24363# tab stops relative to indent - bool bRelative = rSh.getIDocumentSettingAccess()->get(DocumentSettingId::TABS_RELATIVE_TO_INDENT); + bool bRelative = rSh.getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT); m_pHRuler->SetTabsRelativeToIndent( bRelative ); m_pVRuler->SetTabsRelativeToIndent( bRelative ); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 26e29830af18..15d6f2619509 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -312,7 +312,7 @@ static bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTe bool bRet = false; pInsDoc->getIDocumentFieldsAccess().LockExpFields(); { - SwDoc *const pDoc((pxCursor) ? pxCursor->GetDoc() : pxRange->GetDoc()); + SwDoc *const pDoc((pxCursor) ? pxCursor->GetDoc() : &pxRange->GetDoc()); SwPaM aPam(pDoc->GetNodes()); SwPaM * pPam(0); if(pxCursor) @@ -923,7 +923,7 @@ void SwXAutoTextEntry::applyTo(const uno::Reference< text::XTextRange > & xTextR SwDoc* pDoc = 0; if (pRange) - pDoc = pRange->GetDoc(); + pDoc = &pRange->GetDoc(); else if ( pCursor ) pDoc = pCursor->GetDoc(); else if ( pText && pText->GetDoc() ) diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index b2a954f82488..f5cc22988cf9 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -684,10 +684,10 @@ uno::Any SAL_CALL SwXMailMerge::execute( { case MailMergeType::PRINTER: { - IDocumentDeviceAccess* pIDDA = rSh.getIDocumentDeviceAccess(); - SwPrintData aPrtData( pIDDA->getPrintData() ); + IDocumentDeviceAccess& rIDDA = rSh.getIDocumentDeviceAccess(); + SwPrintData aPrtData( rIDDA.getPrintData() ); aPrtData.SetPrintSingleJobs( bCurSinglePrintJobs ); - pIDDA->setPrintData( aPrtData ); + rIDDA.setPrintData( aPrtData ); // #i25686# printing should not be done asynchronously to prevent dangling offices // when mail merge is called as command line macro aMergeDesc.bPrintAsync = false; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index fa53d49e8622..9a31a3b017da 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -721,9 +721,9 @@ SwUnoCrsr* SwXTextDocument::CreateCursorForSearch(Reference< XTextCursor > & xCr SwXTextCursor *const pXTextCursor = pBText->CreateTextCursor(true); xCrsr.set( static_cast<text::XWordCursor*>(pXTextCursor) ); - auto pUnoCrsr(pXTextCursor->GetCursor()); - pUnoCrsr->SetRemainInSection(false); - return pUnoCrsr; + auto& rUnoCrsr(pXTextCursor->GetCursor()); + rUnoCrsr.SetRemainInSection(false); + return &rUnoCrsr; } sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > & xDesc) @@ -1688,7 +1688,7 @@ css::uno::Reference<css::uno::XInterface> SwXTextDocument::create( { return Reference<XInterface>( dynamic_cast<chart2::data::XDataProvider *>( - pDocShell->getIDocumentChartDataProviderAccess()-> + pDocShell->getIDocumentChartDataProviderAccess(). GetChartDataProvider())); } if (!rServiceName.startsWith("com.sun.star.") diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 631e6efe23a0..684c95ea9b90 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -642,7 +642,7 @@ void SAL_CALL SwXTextView::setRubyList( SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc() { SwWrtShell& rOldSh = m_pView->GetWrtShell(); - SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess()->getPrinter( false ); + SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess().getPrinter( false ); SwDocShell* pDocSh; SfxObjectShellLock xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SfxObjectCreateMode::STANDARD ) ); xDocSh->DoInitNew( 0 ); @@ -655,18 +655,18 @@ SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc() pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//So that SelectShell is called. SwWrtShell* pSh = pDocView->GetWrtShellPtr(); - IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess(); - SfxPrinter* pTempPrinter = pIDDA->getPrinter( true ); + IDocumentDeviceAccess& rIDDA = pSh->getIDocumentDeviceAccess(); + SfxPrinter* pTempPrinter = rIDDA.getPrinter( true ); const SwPageDesc& rCurPageDesc = rOldSh.GetPageDesc(rOldSh.GetCurPageDesc()); - IDocumentDeviceAccess* pIDDA_old = rOldSh.getIDocumentDeviceAccess(); + IDocumentDeviceAccess& rIDDA_old = rOldSh.getIDocumentDeviceAccess(); - if( pIDDA_old->getPrinter( false ) ) + if( rIDDA_old.getPrinter( false ) ) { - pIDDA->setJobsetup( *pIDDA_old->getJobsetup() ); + rIDDA.setJobsetup( *rIDDA_old.getJobsetup() ); //#69563# if it isn't the same printer then the pointer has been invalidated! - pTempPrinter = pIDDA->getPrinter( true ); + pTempPrinter = rIDDA.getPrinter( true ); } pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue()); @@ -1107,7 +1107,7 @@ void SwXTextViewCursor::gotoRange( } else if (pRange) { - SwPaM aPam(pRange->GetDoc()->GetNodes()); + SwPaM aPam(pRange->GetDoc().GetNodes()); if (pRange->GetPositions(aPam)) { pSrcNode = &aPam.GetNode(); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index b81bc63c777f..388b8101bd35 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -427,7 +427,7 @@ void SwContentType::Init(bool* pbInvalidateWindow) { sTypeToken.clear(); nMemberCount = 0; - SwDrawModel* pModel = pWrtShell->getIDocumentDrawModelAccess()->GetDrawModel(); + SwDrawModel* pModel = pWrtShell->getIDocumentDrawModelAccess().GetDrawModel(); if(pModel) { SdrPage* pPage = pModel->GetPage(0); @@ -736,8 +736,8 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) else if(!pMember->empty()) pMember->DeleteAndDestroyAll(); - IDocumentDrawModelAccess* pIDDMA = pWrtShell->getIDocumentDrawModelAccess(); - SwDrawModel* pModel = pIDDMA->GetDrawModel(); + IDocumentDrawModelAccess& rIDDMA = pWrtShell->getIDocumentDrawModelAccess(); + SwDrawModel* pModel = rIDDMA.GetDrawModel(); if(pModel) { SdrPage* pPage = pModel->GetPage(0); @@ -757,7 +757,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) this, pTemp->GetName(), nYPos); - if(!pIDDMA->IsVisibleLayerId(pTemp->GetLayer())) + if(!rIDDMA.IsVisibleLayerId(pTemp->GetLayer())) pCnt->SetInvisible(); pMember->insert(pCnt); nMemberCount++; @@ -3367,7 +3367,7 @@ void SwContentTree::GotoContent(SwContent* pCnt) { pDrawView->SdrEndTextEdit(); pDrawView->UnmarkAll(); - SwDrawModel* _pModel = pActiveShell->getIDocumentDrawModelAccess()->GetDrawModel(); + SwDrawModel* _pModel = pActiveShell->getIDocumentDrawModelAccess().GetDrawModel(); SdrPage* pPage = _pModel->GetPage(0); const size_t nCount = pPage->GetObjCount(); for( size_t i=0; i<nCount; ++i ) @@ -3460,8 +3460,8 @@ void SwContentTree::InitEntry(SvTreeListEntry* pEntry, { const size_t nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2" SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); - SvLBoxString* pCol = static_cast<SvLBoxString*>(pEntry->GetItem( nColToHilite )); - SwContentLBoxString* pStr = new SwContentLBoxString( pEntry, 0, pCol->GetText() ); + SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite )); + SwContentLBoxString* pStr = new SwContentLBoxString( pEntry, 0, rCol.GetText() ); pEntry->ReplaceItem( pStr, nColToHilite ); } diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 42131fa4279d..8b2c4d39ec99 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -1232,8 +1232,8 @@ void SwGlobalTree::InitEntry(SvTreeListEntry* pEntry, { const size_t nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2" SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); - SvLBoxString* pCol = static_cast<SvLBoxString*>(pEntry->GetItem( nColToHilite )); - SwLBoxString* pStr = new SwLBoxString( pEntry, 0, pCol->GetText() ); + SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite )); + SwLBoxString* pStr = new SwLBoxString( pEntry, 0, rCol.GetText() ); pEntry->ReplaceItem( pStr, nColToHilite ); } diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx index 2faa0e12a53b..3d3028a9312e 100644 --- a/vcl/source/edit/textdoc.cxx +++ b/vcl/source/edit/textdoc.cxx @@ -172,55 +172,55 @@ void TextNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew ) sal_uInt16 nAttribs = maCharAttribs.Count(); for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ ) { - TextCharAttrib* pAttrib = maCharAttribs.GetAttrib( nAttr ); - if ( pAttrib->GetEnd() >= nIndex ) + TextCharAttrib& rAttrib = maCharAttribs.GetAttrib( nAttr ); + if ( rAttrib.GetEnd() >= nIndex ) { // move all attributes that are behind the cursor - if ( pAttrib->GetStart() > nIndex ) + if ( rAttrib.GetStart() > nIndex ) { - pAttrib->MoveForward( nNew ); + rAttrib.MoveForward( nNew ); } // 0: expand empty attribute, if at cursor - else if ( pAttrib->IsEmpty() ) + else if ( rAttrib.IsEmpty() ) { // Do not check the index; empty one may only be here. // If checking later anyway, special case: // Start == 0; AbsLen == 1, nNew = 1 => Expand due to new paragraph! // Start <= nIndex, End >= nIndex => Start=End=nIndex! - pAttrib->Expand( nNew ); + rAttrib.Expand( nNew ); } // 1: attribute starts before and reaches up to index - else if ( pAttrib->GetEnd() == nIndex ) // start must be before + else if ( rAttrib.GetEnd() == nIndex ) // start must be before { // Only expand if no feature and not in Exclude list! // Otherwise e.g. an UL would go until the new ULDB, thus expand both. - if ( !maCharAttribs.FindEmptyAttrib( pAttrib->Which(), nIndex ) ) + if ( !maCharAttribs.FindEmptyAttrib( rAttrib.Which(), nIndex ) ) { - pAttrib->Expand( nNew ); + rAttrib.Expand( nNew ); } else bResort = true; } // 2: attribute starts before and reaches past the index - else if ( ( pAttrib->GetStart() < nIndex ) && ( pAttrib->GetEnd() > nIndex ) ) + else if ( ( rAttrib.GetStart() < nIndex ) && ( rAttrib.GetEnd() > nIndex ) ) { - pAttrib->Expand( nNew ); + rAttrib.Expand( nNew ); } // 3: attribute starts at Index - else if ( pAttrib->GetStart() == nIndex ) + else if ( rAttrib.GetStart() == nIndex ) { if ( nIndex == 0 ) { - pAttrib->Expand( nNew ); + rAttrib.Expand( nNew ); } else - pAttrib->MoveForward( nNew ); + rAttrib.MoveForward( nNew ); } } - DBG_ASSERT( pAttrib->GetStart() <= pAttrib->GetEnd(), "Expand: Attribut verdreht!" ); - DBG_ASSERT( ( pAttrib->GetEnd() <= maText.getLength() ), "Expand: Attrib groesser als Absatz!" ); - DBG_ASSERT( !pAttrib->IsEmpty(), "Leeres Attribut nach ExpandAttribs?" ); + DBG_ASSERT( rAttrib.GetStart() <= rAttrib.GetEnd(), "Expand: Attribut verdreht!" ); + DBG_ASSERT( ( rAttrib.GetEnd() <= maText.getLength() ), "Expand: Attrib groesser als Absatz!" ); + DBG_ASSERT( !rAttrib.IsEmpty(), "Leeres Attribut nach ExpandAttribs?" ); } if ( bResort ) @@ -237,52 +237,51 @@ void TextNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted ) for ( sal_uInt16 nAttr = 0; nAttr < maCharAttribs.Count(); nAttr++ ) { - TextCharAttrib* pAttrib = maCharAttribs.GetAttrib( nAttr ); + TextCharAttrib& rAttrib = maCharAttribs.GetAttrib( nAttr ); bool bDelAttr = false; - if ( pAttrib->GetEnd() >= nIndex ) + if ( rAttrib.GetEnd() >= nIndex ) { // move all attributes that are behind the cursor - if ( pAttrib->GetStart() >= nEndChanges ) + if ( rAttrib.GetStart() >= nEndChanges ) { - pAttrib->MoveBackward( nDeleted ); + rAttrib.MoveBackward( nDeleted ); } // 1. delete inner attributes - else if ( ( pAttrib->GetStart() >= nIndex ) && ( pAttrib->GetEnd() <= nEndChanges ) ) + else if ( ( rAttrib.GetStart() >= nIndex ) && ( rAttrib.GetEnd() <= nEndChanges ) ) { // special case: attribute covers the region exactly // => keep as an empty attribute - if ( ( pAttrib->GetStart() == nIndex ) && ( pAttrib->GetEnd() == nEndChanges ) ) - pAttrib->GetEnd() = nIndex; // empty + if ( ( rAttrib.GetStart() == nIndex ) && ( rAttrib.GetEnd() == nEndChanges ) ) + rAttrib.GetEnd() = nIndex; // empty else bDelAttr = true; } // 2. attribute starts before, ends inside or after - else if ( ( pAttrib->GetStart() <= nIndex ) && ( pAttrib->GetEnd() > nIndex ) ) + else if ( ( rAttrib.GetStart() <= nIndex ) && ( rAttrib.GetEnd() > nIndex ) ) { - if ( pAttrib->GetEnd() <= nEndChanges ) // ends inside - pAttrib->GetEnd() = nIndex; + if ( rAttrib.GetEnd() <= nEndChanges ) // ends inside + rAttrib.GetEnd() = nIndex; else - pAttrib->Collaps( nDeleted ); // ends after + rAttrib.Collaps( nDeleted ); // ends after } // 3. attribute starts inside, ends after - else if ( ( pAttrib->GetStart() >= nIndex ) && ( pAttrib->GetEnd() > nEndChanges ) ) + else if ( ( rAttrib.GetStart() >= nIndex ) && ( rAttrib.GetEnd() > nEndChanges ) ) { // features are not allowed to expand! - pAttrib->GetStart() = nEndChanges; - pAttrib->MoveBackward( nDeleted ); + rAttrib.GetStart() = nEndChanges; + rAttrib.MoveBackward( nDeleted ); } } - DBG_ASSERT( pAttrib->GetStart() <= pAttrib->GetEnd(), "Collaps: Attribut verdreht!" ); - DBG_ASSERT( ( pAttrib->GetEnd() <= maText.getLength()) || bDelAttr, "Collaps: Attrib groesser als Absatz!" ); - if ( bDelAttr /* || pAttrib->IsEmpty() */ ) + DBG_ASSERT( rAttrib.GetStart() <= rAttrib.GetEnd(), "Collaps: Attribut verdreht!" ); + DBG_ASSERT( ( rAttrib.GetEnd() <= maText.getLength()) || bDelAttr, "Collaps: Attrib groesser als Absatz!" ); + if ( bDelAttr /* || rAttrib.IsEmpty() */ ) { bResort = true; maCharAttribs.RemoveAttrib( nAttr ); - delete pAttrib; nAttr--; } - else if ( pAttrib->IsEmpty() ) + else if ( rAttrib.IsEmpty() ) maCharAttribs.HasEmptyAttribs() = true; } @@ -320,44 +319,44 @@ TextNode* TextNode::Split( sal_uInt16 nPos, bool bKeepEndingAttribs ) for ( sal_uInt16 nAttr = 0; nAttr < maCharAttribs.Count(); nAttr++ ) { - TextCharAttrib* pAttrib = maCharAttribs.GetAttrib( nAttr ); - if ( pAttrib->GetEnd() < nPos ) + TextCharAttrib& rAttrib = maCharAttribs.GetAttrib( nAttr ); + if ( rAttrib.GetEnd() < nPos ) { // no change ; } - else if ( pAttrib->GetEnd() == nPos ) + else if ( rAttrib.GetEnd() == nPos ) { // must be copied as an empty attribute // !FindAttrib only sensible if traversing backwards through the list! - if ( bKeepEndingAttribs && !pNew->maCharAttribs.FindAttrib( pAttrib->Which(), 0 ) ) + if ( bKeepEndingAttribs && !pNew->maCharAttribs.FindAttrib( rAttrib.Which(), 0 ) ) { - TextCharAttrib* pNewAttrib = new TextCharAttrib( *pAttrib ); + TextCharAttrib* pNewAttrib = new TextCharAttrib( rAttrib ); pNewAttrib->GetStart() = 0; pNewAttrib->GetEnd() = 0; pNew->maCharAttribs.InsertAttrib( pNewAttrib ); } } - else if ( pAttrib->IsInside( nPos ) || ( !nPos && !pAttrib->GetStart() ) ) + else if ( rAttrib.IsInside( nPos ) || ( !nPos && !rAttrib.GetStart() ) ) { // If cutting at the very beginning, the attribute has to be // copied and changed - TextCharAttrib* pNewAttrib = new TextCharAttrib( *pAttrib ); + TextCharAttrib* pNewAttrib = new TextCharAttrib( rAttrib ); pNewAttrib->GetStart() = 0; - pNewAttrib->GetEnd() = pAttrib->GetEnd()-nPos; + pNewAttrib->GetEnd() = rAttrib.GetEnd()-nPos; pNew->maCharAttribs.InsertAttrib( pNewAttrib ); // trim - pAttrib->GetEnd() = nPos; + rAttrib.GetEnd() = nPos; } else { - DBG_ASSERT( pAttrib->GetStart() >= nPos, "Start < nPos!" ); - DBG_ASSERT( pAttrib->GetEnd() >= nPos, "End < nPos!" ); + DBG_ASSERT( rAttrib.GetStart() >= nPos, "Start < nPos!" ); + DBG_ASSERT( rAttrib.GetEnd() >= nPos, "End < nPos!" ); // move all into the new node (this) maCharAttribs.RemoveAttrib( nAttr ); - pNew->maCharAttribs.InsertAttrib( pAttrib ); - pAttrib->GetStart() = pAttrib->GetStart() - nPos; - pAttrib->GetEnd() = pAttrib->GetEnd() - nPos; + pNew->maCharAttribs.InsertAttrib( &rAttrib ); + rAttrib.GetStart() = rAttrib.GetStart() - nPos; + rAttrib.GetEnd() = rAttrib.GetEnd() - nPos; nAttr--; } } @@ -381,15 +380,14 @@ void TextNode::Append( const TextNode& rNode ) sal_uInt16 nTmpAttribs = maCharAttribs.Count(); for ( sal_uInt16 nTmpAttr = 0; nTmpAttr < nTmpAttribs; nTmpAttr++ ) { - TextCharAttrib* pTmpAttrib = maCharAttribs.GetAttrib( nTmpAttr ); + TextCharAttrib& rTmpAttrib = maCharAttribs.GetAttrib( nTmpAttr ); - if ( pTmpAttrib->GetEnd() == nOldLen ) + if ( rTmpAttrib.GetEnd() == nOldLen ) { - if ( ( pTmpAttrib->Which() == rAttrib.Which() ) && - ( pTmpAttrib->GetAttr() == rAttrib.GetAttr() ) ) + if ( ( rTmpAttrib.Which() == rAttrib.Which() ) && + ( rTmpAttrib.GetAttr() == rAttrib.GetAttr() ) ) { - pTmpAttrib->GetEnd() = - pTmpAttrib->GetEnd() + rAttrib.GetLen(); + rTmpAttrib.GetEnd() = rTmpAttrib.GetEnd() + rAttrib.GetLen(); bMelted = true; break; // there can be only one of this type at this position } diff --git a/vcl/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx index 80dd97cf80b5..f317cb711dad 100644 --- a/vcl/source/edit/textdoc.hxx +++ b/vcl/source/edit/textdoc.hxx @@ -43,7 +43,7 @@ public: sal_uInt16 Count() const { return maAttribs.size(); } const TextCharAttrib& GetAttrib( sal_uInt16 n ) const { return maAttribs[n]; } - TextCharAttrib* GetAttrib( sal_uInt16 n ) { return &maAttribs[n]; } + TextCharAttrib& GetAttrib( sal_uInt16 n ) { return maAttribs[n]; } void RemoveAttrib( sal_uInt16 n ) { maAttribs.release( maAttribs.begin() + n ).release(); } void InsertAttrib( TextCharAttrib* pAttrib ); diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 7fd5843ab168..8355b91aa9d2 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -494,8 +494,8 @@ void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_uInt16 nChars, SfxUndo sal_uInt16 nEnd = nStart + nChars; for ( sal_uInt16 nAttr = pNode->GetCharAttribs().Count(); nAttr; ) { - TextCharAttrib* pAttr = pNode->GetCharAttribs().GetAttrib( --nAttr ); - if ( ( pAttr->GetEnd() >= nStart ) && ( pAttr->GetStart() < nEnd ) ) + TextCharAttrib& rAttr = pNode->GetCharAttribs().GetAttrib( --nAttr ); + if ( ( rAttr.GetEnd() >= nStart ) && ( rAttr.GetStart() < nEnd ) ) { break; // for } @@ -1395,25 +1395,25 @@ void TextEngine::SeekCursor( sal_uLong nPara, sal_uInt16 nPos, vcl::Font& rFont, sal_uInt16 nAttribs = pNode->GetCharAttribs().Count(); for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ ) { - TextCharAttrib* pAttrib = pNode->GetCharAttribs().GetAttrib( nAttr ); - if ( pAttrib->GetStart() > nPos ) + TextCharAttrib& rAttrib = pNode->GetCharAttribs().GetAttrib( nAttr ); + if ( rAttrib.GetStart() > nPos ) break; // When seeking don't use Attr that start there! // Do not use empty attributes: // - If just being setup and empty => no effect on Font // - Characters that are setup in an empty paragraph become visible right away. - if ( ( ( pAttrib->GetStart() < nPos ) && ( pAttrib->GetEnd() >= nPos ) ) + if ( ( ( rAttrib.GetStart() < nPos ) && ( rAttrib.GetEnd() >= nPos ) ) || pNode->GetText().isEmpty() ) { - if ( pAttrib->Which() != TEXTATTR_FONTCOLOR ) + if ( rAttrib.Which() != TEXTATTR_FONTCOLOR ) { - pAttrib->GetAttr().SetFont(rFont); + rAttrib.GetAttr().SetFont(rFont); } else { if ( pOutDev ) - pOutDev->SetTextColor( static_cast<const TextAttribFontColor&>(pAttrib->GetAttr()).GetColor() ); + pOutDev->SetTextColor( static_cast<const TextAttribFontColor&>(rAttrib.GetAttr()).GetColor() ); } } } @@ -1755,10 +1755,10 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos ) sal_uInt16 nAttribs = pNode->GetCharAttribs().Count(); for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ ) { - TextCharAttrib* pAttrib = pNode->GetCharAttribs().GetAttrib( nAttr ); + TextCharAttrib& rAttrib = pNode->GetCharAttribs().GetAttrib( nAttr ); - aPositions.insert( pAttrib->GetStart() ); - aPositions.insert( pAttrib->GetEnd() ); + aPositions.insert( rAttrib.GetStart() ); + aPositions.insert( rAttrib.GetEnd() ); } aPositions.insert( pNode->GetText().getLength() ); @@ -2640,7 +2640,7 @@ void TextEngine::RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFo sal_uInt16 nAttrCount = rAttribs.Count(); for(sal_uInt16 nAttr = nAttrCount; nAttr; --nAttr) { - if(rAttribs.GetAttrib( nAttr - 1 )->Which() == nWhich) + if(rAttribs.GetAttrib( nAttr - 1 ).Which() == nWhich) rAttribs.RemoveAttrib( nAttr -1 ); } TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); @@ -2664,7 +2664,7 @@ void TextEngine::RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib ) sal_uInt16 nAttrCount = rAttribs.Count(); for(sal_uInt16 nAttr = nAttrCount; nAttr; --nAttr) { - if(rAttribs.GetAttrib( nAttr - 1 ) == &rAttrib) + if(&(rAttribs.GetAttrib( nAttr - 1 )) == &rAttrib) { rAttribs.RemoveAttrib( nAttr -1 ); break; |