LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/source/ui/docshell - arealink.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 159 235 67.7 %
Date: 2013-07-09 Functions: 12 23 52.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <comphelper/string.hxx>
      21             : #include <sfx2/app.hxx>
      22             : #include <sfx2/docfile.hxx>
      23             : #include <sfx2/fcontnr.hxx>
      24             : #include <sfx2/linkmgr.hxx>
      25             : #include <svl/stritem.hxx>
      26             : #include <vcl/msgbox.hxx>
      27             : 
      28             : #include "arealink.hxx"
      29             : 
      30             : #include "tablink.hxx"
      31             : #include "document.hxx"
      32             : #include "docsh.hxx"
      33             : #include "rangenam.hxx"
      34             : #include "dbdata.hxx"
      35             : #include "undoblk.hxx"
      36             : #include "globstr.hrc"
      37             : #include "markdata.hxx"
      38             : #include "hints.hxx"
      39             : #include "filter.hxx"
      40             : 
      41             : #include "attrib.hxx"           // raus, wenn ResetAttrib am Dokument
      42             : #include "patattr.hxx"          // raus, wenn ResetAttrib am Dokument
      43             : #include "docpool.hxx"          // raus, wenn ResetAttrib am Dokument
      44             : 
      45             : #include "sc.hrc"
      46             : #include "scabstdlg.hxx"
      47             : #include "clipparam.hxx"
      48             : 
      49             : struct AreaLink_Impl
      50             : {
      51             :     ScDocShell* m_pDocSh;
      52             :     AbstractScLinkedAreaDlg* m_pDialog;
      53             : 
      54          16 :     AreaLink_Impl() : m_pDocSh( NULL ), m_pDialog( NULL ) {}
      55             : };
      56             : 
      57         312 : TYPEINIT1(ScAreaLink,::sfx2::SvBaseLink);
      58             : 
      59             : //------------------------------------------------------------------------
      60             : 
      61          16 : ScAreaLink::ScAreaLink( SfxObjectShell* pShell, const String& rFile,
      62             :                         const String& rFilter, const String& rOpt,
      63             :                         const String& rArea, const ScRange& rDest,
      64             :                         sal_uLong nRefresh ) :
      65             :     ::sfx2::SvBaseLink(sfx2::LINKUPDATE_ONCALL,FORMAT_FILE),
      66             :     ScRefreshTimer  ( nRefresh ),
      67             :     pImpl           ( new AreaLink_Impl() ),
      68             :     aFileName       (rFile),
      69             :     aFilterName     (rFilter),
      70             :     aOptions        (rOpt),
      71             :     aSourceArea     (rArea),
      72             :     aDestArea       (rDest),
      73             :     bAddUndo        (true),
      74             :     bInCreate       (false),
      75          16 :     bDoInsert       (true)
      76             : {
      77             :     OSL_ENSURE(pShell->ISA(ScDocShell), "ScAreaLink mit falscher ObjectShell");
      78          16 :     pImpl->m_pDocSh = static_cast< ScDocShell* >( pShell );
      79          16 :     SetRefreshHandler( LINK( this, ScAreaLink, RefreshHdl ) );
      80          16 :     SetRefreshControl( pImpl->m_pDocSh->GetDocument()->GetRefreshTimerControlAddress() );
      81          16 : }
      82             : 
      83          48 : ScAreaLink::~ScAreaLink()
      84             : {
      85          16 :     StopRefreshTimer();
      86          16 :     delete pImpl;
      87          32 : }
      88             : 
      89           0 : void ScAreaLink::Edit(Window* pParent, const Link& /* rEndEditHdl */ )
      90             : {
      91             :     //  use own dialog instead of SvBaseLink::Edit...
      92             :     //  DefModalDialogParent setzen, weil evtl. aus der DocShell beim ConvertFrom
      93             :     //  ein Optionen-Dialog kommt...
      94             : 
      95           0 :     ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
      96             :     OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
      97             : 
      98           0 :     AbstractScLinkedAreaDlg* pDlg = pFact->CreateScLinkedAreaDlg(pParent);
      99             :     OSL_ENSURE(pDlg, "Dialog create fail!");
     100           0 :     pDlg->InitFromOldLink( aFileName, aFilterName, aOptions, aSourceArea, GetRefreshDelay() );
     101           0 :     pImpl->m_pDialog = pDlg;
     102           0 :     pDlg->StartExecuteModal( LINK( this, ScAreaLink, AreaEndEditHdl ) );
     103           0 : }
     104             : 
     105          16 : ::sfx2::SvBaseLink::UpdateResult ScAreaLink::DataChanged(
     106             :     const String&, const ::com::sun::star::uno::Any& )
     107             : {
     108             :     //  bei bInCreate nichts tun, damit Update gerufen werden kann, um den Status im
     109             :     //  LinkManager zu setzen, ohne die Daten im Dokument zu aendern
     110             : 
     111          16 :     if (bInCreate)
     112           0 :         return SUCCESS;
     113             : 
     114          16 :     sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument()->GetLinkManager();
     115          16 :     if (pLinkManager!=NULL)
     116             :     {
     117          32 :         OUString aFile, aArea, aFilter;
     118          16 :         pLinkManager->GetDisplayNames(this, NULL, &aFile, &aArea, &aFilter);
     119             : 
     120             :         //  the file dialog returns the filter name with the application prefix
     121             :         //  -> remove prefix
     122          16 :         ScDocumentLoader::RemoveAppPrefix( aFilter );
     123             : 
     124             :         // dialog doesn't set area, so keep old one
     125          16 :         if (aArea.isEmpty())
     126             :         {
     127           0 :             aArea = aSourceArea;
     128             : 
     129             :             // adjust in dialog:
     130           0 :             String aNewLinkName;
     131           0 :             String aTmp = aFilter;
     132           0 :             sfx2::MakeLnkName(aNewLinkName, NULL, aFile, aArea, &aTmp);
     133           0 :             aFilter = aTmp;
     134           0 :             SetName( aNewLinkName );
     135             :         }
     136             : 
     137          32 :         sfx2::SvBaseLinkRef const xThis(this); // keep yourself alive
     138          32 :         Refresh( aFile, aFilter, aArea, GetRefreshDelay() );
     139             :     }
     140             : 
     141          16 :     return SUCCESS;
     142             : }
     143             : 
     144           0 : void ScAreaLink::Closed()
     145             : {
     146             :     // Verknuepfung loeschen: Undo
     147             : 
     148           0 :     ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
     149           0 :     sal_Bool bUndo (pDoc->IsUndoEnabled());
     150           0 :     if (bAddUndo && bUndo)
     151             :     {
     152           0 :         pImpl->m_pDocSh->GetUndoManager()->AddUndoAction( new ScUndoRemoveAreaLink( pImpl->m_pDocSh,
     153             :                                                         aFileName, aFilterName, aOptions,
     154           0 :                                                         aSourceArea, aDestArea, GetRefreshDelay() ) );
     155             : 
     156           0 :         bAddUndo = false;   // nur einmal
     157             :     }
     158             : 
     159           0 :     SCTAB nDestTab = aDestArea.aStart.Tab();
     160           0 :     if (pDoc->IsStreamValid(nDestTab))
     161           0 :         pDoc->SetStreamValid(nDestTab, false);
     162             : 
     163           0 :     SvBaseLink::Closed();
     164           0 : }
     165             : 
     166           0 : void ScAreaLink::SetDestArea(const ScRange& rNew)
     167             : {
     168           0 :     aDestArea = rNew;           // fuer Undo
     169           0 : }
     170             : 
     171           0 : void ScAreaLink::SetSource(const String& rDoc, const String& rFlt, const String& rOpt,
     172             :                                 const String& rArea)
     173             : {
     174           0 :     aFileName   = rDoc;
     175           0 :     aFilterName = rFlt;
     176           0 :     aOptions    = rOpt;
     177           0 :     aSourceArea = rArea;
     178             : 
     179             :     //  also update link name for dialog
     180           0 :     String aNewLinkName;
     181           0 :     sfx2::MakeLnkName( aNewLinkName, NULL, aFileName, aSourceArea, &aFilterName );
     182           0 :     SetName( aNewLinkName );
     183           0 : }
     184             : 
     185           0 : bool ScAreaLink::IsEqual( const String& rFile, const String& rFilter, const String& rOpt,
     186             :                             const String& rSource, const ScRange& rDest ) const
     187             : {
     188           0 :     return aFileName == rFile && aFilterName == rFilter && aOptions == rOpt &&
     189           0 :             aSourceArea == rSource && aDestArea.aStart == rDest.aStart;
     190             : }
     191             : 
     192             : // find a range with name >rAreaName< in >pSrcDoc<, return it in >rRange<
     193           8 : bool ScAreaLink::FindExtRange( ScRange& rRange, ScDocument* pSrcDoc, const OUString& rAreaName )
     194             : {
     195           8 :     bool bFound = false;
     196           8 :     OUString aUpperName = ScGlobal::pCharClass->uppercase(rAreaName);
     197           8 :     ScRangeName* pNames = pSrcDoc->GetRangeName();
     198           8 :     if (pNames)         // benannte Bereiche
     199             :     {
     200           8 :         const ScRangeData* p = pNames->findByUpperName(aUpperName);
     201           8 :         if (p && p->IsValidReference(rRange))
     202           0 :             bFound = true;
     203             :     }
     204           8 :     if (!bFound)        // Datenbankbereiche
     205             :     {
     206           8 :         ScDBCollection* pDBColl = pSrcDoc->GetDBCollection();
     207           8 :         if (pDBColl)
     208             :         {
     209           8 :             const ScDBData* pDB = pDBColl->getNamedDBs().findByUpperName(aUpperName);
     210           8 :             if (pDB)
     211             :             {
     212             :                 SCTAB nTab;
     213             :                 SCCOL nCol1, nCol2;
     214             :                 SCROW nRow1, nRow2;
     215           0 :                 pDB->GetArea(nTab,nCol1,nRow1,nCol2,nRow2);
     216           0 :                 rRange = ScRange( nCol1,nRow1,nTab, nCol2,nRow2,nTab );
     217           0 :                 bFound = true;
     218             :             }
     219             :         }
     220             :     }
     221           8 :     if (!bFound)        // direct reference (range or cell)
     222             :     {
     223           8 :         ScAddress::Details aDetails(pSrcDoc->GetAddressConvention(), 0, 0);
     224           8 :         if ( rRange.ParseAny( rAreaName, pSrcDoc, aDetails ) & SCA_VALID )
     225           8 :             bFound = true;
     226             :     }
     227           8 :     return bFound;
     228             : }
     229             : 
     230             : //  ausfuehren:
     231             : 
     232          16 : sal_Bool ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
     233             :                             const String& rNewArea, sal_uLong nNewRefresh )
     234             : {
     235             :     //  Dokument laden - wie TabLink
     236             : 
     237          16 :     if (!rNewFile.Len() || !rNewFilter.Len())
     238           0 :         return false;
     239             : 
     240          16 :     String aNewUrl( ScGlobal::GetAbsDocName( rNewFile, pImpl->m_pDocSh ) );
     241          16 :     sal_Bool bNewUrlName = (aNewUrl != aFileName);
     242             : 
     243          16 :     const SfxFilter* pFilter = pImpl->m_pDocSh->GetFactory().GetFilterContainer()->GetFilter4FilterName(rNewFilter);
     244          16 :     if (!pFilter)
     245          12 :         return false;
     246             : 
     247           4 :     ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
     248             : 
     249           4 :     sal_Bool bUndo (pDoc->IsUndoEnabled());
     250           4 :     pDoc->SetInLinkUpdate( sal_True );
     251             : 
     252             :     //  wenn neuer Filter ausgewaehlt wurde, Optionen vergessen
     253           4 :     if ( rNewFilter != aFilterName )
     254           0 :         aOptions.Erase();
     255             : 
     256           4 :     SfxMedium* pMed = new SfxMedium(aNewUrl, STREAM_STD_READ, pFilter);
     257             : 
     258             :     // aRef->DoClose() will be closed explicitly, but it is still more safe to use SfxObjectShellLock here
     259           4 :     ScDocShell* pSrcShell = new ScDocShell(SFX_CREATE_MODE_INTERNAL);
     260           8 :     SfxObjectShellLock aRef = pSrcShell;
     261           4 :     pSrcShell->DoLoad(pMed);
     262             : 
     263           4 :     ScDocument* pSrcDoc = pSrcShell->GetDocument();
     264             : 
     265             :     // Optionen koennten gesetzt worden sein
     266           8 :     String aNewOpt = ScDocumentLoader::GetOptions(*pMed);
     267           4 :     if (!aNewOpt.Len())
     268           4 :         aNewOpt = aOptions;
     269             : 
     270             :     // correct source range name list for web query import
     271           8 :     String aTempArea;
     272             : 
     273           4 :     if( rNewFilter == ScDocShell::GetWebQueryFilterName() )
     274           0 :         aTempArea = ScFormatFilter::Get().GetHTMLRangeNameList( pSrcDoc, rNewArea );
     275             :     else
     276           4 :         aTempArea = rNewArea;
     277             : 
     278             :     // find total size of source area
     279           4 :     SCCOL nWidth = 0;
     280           4 :     SCROW nHeight = 0;
     281           4 :     xub_StrLen nTokenCnt = comphelper::string::getTokenCount(aTempArea, ';');
     282           4 :     sal_Int32 nStringIx = 0;
     283             :     xub_StrLen nToken;
     284             : 
     285           8 :     for( nToken = 0; nToken < nTokenCnt; nToken++ )
     286             :     {
     287           4 :         String aToken( aTempArea.GetToken( 0, ';', nStringIx ) );
     288           4 :         ScRange aTokenRange;
     289           4 :         if( FindExtRange( aTokenRange, pSrcDoc, aToken ) )
     290             :         {
     291             :             // columns: find maximum
     292           4 :             nWidth = std::max( nWidth, (SCCOL)(aTokenRange.aEnd.Col() - aTokenRange.aStart.Col() + 1) );
     293             :             // rows: add row range + 1 empty row
     294           4 :             nHeight += aTokenRange.aEnd.Row() - aTokenRange.aStart.Row() + 2;
     295             :         }
     296           4 :     }
     297             :     // remove the last empty row
     298           4 :     if( nHeight > 0 )
     299           4 :         nHeight--;
     300             : 
     301             :     //  alte Daten loeschen / neue kopieren
     302             : 
     303           4 :     ScAddress aDestPos = aDestArea.aStart;
     304           4 :     SCTAB nDestTab = aDestPos.Tab();
     305           4 :     ScRange aOldRange = aDestArea;
     306           4 :     ScRange aNewRange = aDestArea;          // alter Bereich, wenn Datei nicht gefunden o.ae.
     307           4 :     if (nWidth > 0 && nHeight > 0)
     308             :     {
     309           4 :         aNewRange.aEnd.SetCol( aNewRange.aStart.Col() + nWidth - 1 );
     310           4 :         aNewRange.aEnd.SetRow( aNewRange.aStart.Row() + nHeight - 1 );
     311             :     }
     312             : 
     313             :     //! check CanFitBlock only if bDoInsert is set?
     314           8 :     sal_Bool bCanDo = ValidColRow( aNewRange.aEnd.Col(), aNewRange.aEnd.Row() ) &&
     315           8 :                   pDoc->CanFitBlock( aOldRange, aNewRange );
     316           4 :     if (bCanDo)
     317             :     {
     318           4 :         ScDocShellModificator aModificator( *pImpl->m_pDocSh );
     319             : 
     320           4 :         SCCOL nOldEndX = aOldRange.aEnd.Col();
     321           4 :         SCROW nOldEndY = aOldRange.aEnd.Row();
     322           4 :         SCCOL nNewEndX = aNewRange.aEnd.Col();
     323           4 :         SCROW nNewEndY = aNewRange.aEnd.Row();
     324             :         ScRange aMaxRange( aDestPos,
     325           4 :                     ScAddress(std::max(nOldEndX,nNewEndX), std::max(nOldEndY,nNewEndY), nDestTab) );
     326             : 
     327             :         //  Undo initialisieren
     328             : 
     329           4 :         ScDocument* pUndoDoc = NULL;
     330           4 :         if ( bAddUndo && bUndo )
     331             :         {
     332           4 :             pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
     333           4 :             if ( bDoInsert )
     334             :             {
     335           1 :                 if ( nNewEndX != nOldEndX || nNewEndY != nOldEndY )             // Bereich veraendert?
     336             :                 {
     337           0 :                     pUndoDoc->InitUndo( pDoc, 0, pDoc->GetTableCount()-1 );
     338             :                     pDoc->CopyToDocument( 0,0,0,MAXCOL,MAXROW,MAXTAB,
     339           0 :                                             IDF_FORMULA, false, pUndoDoc );     // alle Formeln
     340             :                 }
     341             :                 else
     342           1 :                     pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab );             // nur Zieltabelle
     343           1 :                 pDoc->CopyToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
     344             :             }
     345             :             else        // ohne Einfuegen
     346             :             {
     347           3 :                 pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab );             // nur Zieltabelle
     348           3 :                 pDoc->CopyToDocument( aMaxRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
     349             :             }
     350             :         }
     351             : 
     352             :         //  Zellen einfuegen / loeschen
     353             :         //  DeleteAreaTab loescht auch MERGE_FLAG Attribute
     354             : 
     355           4 :         if (bDoInsert)
     356           1 :             pDoc->FitBlock( aOldRange, aNewRange );         // incl. loeschen
     357             :         else
     358           3 :             pDoc->DeleteAreaTab( aMaxRange, IDF_ALL & ~IDF_NOTE );
     359             : 
     360             :         //  Daten kopieren
     361             : 
     362           4 :         if (nWidth > 0 && nHeight > 0)
     363             :         {
     364           4 :             ScDocument aClipDoc( SCDOCMODE_CLIP );
     365           4 :             ScRange aNewTokenRange( aNewRange.aStart );
     366           4 :             nStringIx = 0;
     367           8 :             for( nToken = 0; nToken < nTokenCnt; nToken++ )
     368             :             {
     369           4 :                 String aToken( aTempArea.GetToken( 0, ';', nStringIx ) );
     370           4 :                 ScRange aTokenRange;
     371           4 :                 if( FindExtRange( aTokenRange, pSrcDoc, aToken ) )
     372             :                 {
     373           4 :                     SCTAB nSrcTab = aTokenRange.aStart.Tab();
     374           4 :                     ScMarkData aSourceMark;
     375           4 :                     aSourceMark.SelectOneTable( nSrcTab );      // selektieren fuer CopyToClip
     376           4 :                     aSourceMark.SetMarkArea( aTokenRange );
     377             : 
     378           8 :                     ScClipParam aClipParam(aTokenRange, false);
     379           4 :                     pSrcDoc->CopyToClip(aClipParam, &aClipDoc, &aSourceMark);
     380             : 
     381           4 :                     if ( aClipDoc.HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab,
     382           4 :                                             HASATTR_MERGED | HASATTR_OVERLAPPED ) )
     383             :                     {
     384             :                         //! ResetAttrib am Dokument !!!
     385             : 
     386           0 :                         ScPatternAttr aPattern( pSrcDoc->GetPool() );
     387           0 :                         aPattern.GetItemSet().Put( ScMergeAttr() );             // Defaults
     388           0 :                         aPattern.GetItemSet().Put( ScMergeFlagAttr() );
     389           0 :                         aClipDoc.ApplyPatternAreaTab( 0,0, MAXCOL,MAXROW, nSrcTab, aPattern );
     390             :                     }
     391             : 
     392           4 :                     aNewTokenRange.aEnd.SetCol( aNewTokenRange.aStart.Col() + (aTokenRange.aEnd.Col() - aTokenRange.aStart.Col()) );
     393           4 :                     aNewTokenRange.aEnd.SetRow( aNewTokenRange.aStart.Row() + (aTokenRange.aEnd.Row() - aTokenRange.aStart.Row()) );
     394           8 :                     ScMarkData aDestMark;
     395           4 :                     aDestMark.SelectOneTable( nDestTab );
     396           4 :                     aDestMark.SetMarkArea( aNewTokenRange );
     397           4 :                     pDoc->CopyFromClip( aNewTokenRange, aDestMark, IDF_ALL, NULL, &aClipDoc, false );
     398           8 :                     aNewTokenRange.aStart.SetRow( aNewTokenRange.aEnd.Row() + 2 );
     399             :                 }
     400           8 :             }
     401             :         }
     402             :         else
     403             :         {
     404           0 :             String aErr = ScGlobal::GetRscString(STR_LINKERROR);
     405           0 :             pDoc->SetString( aDestPos.Col(), aDestPos.Row(), aDestPos.Tab(), aErr );
     406             :         }
     407             : 
     408             :         //  Undo eintragen
     409             : 
     410           4 :         if ( bAddUndo && bUndo)
     411             :         {
     412           4 :             ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
     413           4 :             pRedoDoc->InitUndo( pDoc, nDestTab, nDestTab );
     414           4 :             pDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, false, pRedoDoc );
     415             : 
     416           4 :             pImpl->m_pDocSh->GetUndoManager()->AddUndoAction(
     417             :                 new ScUndoUpdateAreaLink( pImpl->m_pDocSh,
     418             :                                             aFileName, aFilterName, aOptions,
     419           4 :                                             aSourceArea, aOldRange, GetRefreshDelay(),
     420             :                                             aNewUrl, rNewFilter, aNewOpt,
     421             :                                             rNewArea, aNewRange, nNewRefresh,
     422           8 :                                             pUndoDoc, pRedoDoc, bDoInsert ) );
     423             :         }
     424             : 
     425             :         //  neue Einstellungen merken
     426             : 
     427           4 :         if ( bNewUrlName )
     428           0 :             aFileName = aNewUrl;
     429           4 :         if ( rNewFilter != aFilterName )
     430           0 :             aFilterName = rNewFilter;
     431           4 :         if ( rNewArea != aSourceArea )
     432           0 :             aSourceArea = rNewArea;
     433           4 :         if ( aNewOpt != aOptions )
     434           0 :             aOptions = aNewOpt;
     435             : 
     436           4 :         if ( aNewRange != aDestArea )
     437           3 :             aDestArea = aNewRange;
     438             : 
     439           4 :         if ( nNewRefresh != GetRefreshDelay() )
     440           0 :             SetRefreshDelay( nNewRefresh );
     441             : 
     442           4 :         SCCOL nPaintEndX = std::max( aOldRange.aEnd.Col(), aNewRange.aEnd.Col() );
     443           4 :         SCROW nPaintEndY = std::max( aOldRange.aEnd.Row(), aNewRange.aEnd.Row() );
     444             : 
     445           4 :         if ( aOldRange.aEnd.Col() != aNewRange.aEnd.Col() )
     446           3 :             nPaintEndX = MAXCOL;
     447           4 :         if ( aOldRange.aEnd.Row() != aNewRange.aEnd.Row() )
     448           3 :             nPaintEndY = MAXROW;
     449             : 
     450           4 :         if ( !pImpl->m_pDocSh->AdjustRowHeight( aDestPos.Row(), nPaintEndY, nDestTab ) )
     451             :             pImpl->m_pDocSh->PostPaint(
     452           4 :                 ScRange(aDestPos.Col(), aDestPos.Row(), nDestTab, nPaintEndX, nPaintEndY, nDestTab),
     453           8 :                 PAINT_GRID);
     454           4 :         aModificator.SetDocumentModified();
     455             :     }
     456             :     else
     457             :     {
     458             :         //  CanFitBlock sal_False -> Probleme mit zusammengefassten Zellen
     459             :         //                       oder Tabellengrenze erreicht!
     460             :         //! Zellschutz ???
     461             : 
     462             :         //! Link-Dialog muss Default-Parent setzen
     463             :         //  "kann keine Zeilen einfuegen"
     464             :         InfoBox aBox( Application::GetDefDialogParent(),
     465           0 :                         ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_2 ) );
     466           0 :         aBox.Execute();
     467             :     }
     468             : 
     469             :     //  aufraeumen
     470             : 
     471           4 :     aRef->DoClose();
     472             : 
     473           4 :     pDoc->SetInLinkUpdate( false );
     474             : 
     475           4 :     if (bCanDo)
     476             :     {
     477             :         //  notify Uno objects (for XRefreshListener)
     478             :         //! also notify Uno objects if file name was changed!
     479           4 :         ScLinkRefreshedHint aHint;
     480           4 :         aHint.SetAreaLink( aDestPos );
     481           4 :         pDoc->BroadcastUno( aHint );
     482             :     }
     483             : 
     484          20 :     return bCanDo;
     485             : }
     486             : 
     487             : 
     488           0 : IMPL_LINK_NOARG(ScAreaLink, RefreshHdl)
     489             : {
     490             :     long nRes = Refresh( aFileName, aFilterName, aSourceArea,
     491           0 :         GetRefreshDelay() ) != 0;
     492           0 :     return nRes;
     493             : }
     494             : 
     495           0 : IMPL_LINK_NOARG(ScAreaLink, AreaEndEditHdl)
     496             : {
     497             :     //  #i76514# can't use link argument to access the dialog,
     498             :     //  because it's the ScLinkedAreaDlg, not AbstractScLinkedAreaDlg
     499             : 
     500           0 :     if ( pImpl->m_pDialog && pImpl->m_pDialog->GetResult() == RET_OK )
     501             :     {
     502           0 :         aOptions = pImpl->m_pDialog->GetOptions();
     503           0 :         Refresh( pImpl->m_pDialog->GetURL(), pImpl->m_pDialog->GetFilter(),
     504           0 :                  pImpl->m_pDialog->GetSource(), pImpl->m_pDialog->GetRefresh() );
     505             : 
     506             :         //  copy source data from members (set in Refresh) into link name for dialog
     507           0 :         String aNewLinkName;
     508           0 :         sfx2::MakeLnkName( aNewLinkName, NULL, aFileName, aSourceArea, &aFilterName );
     509           0 :         SetName( aNewLinkName );
     510             :     }
     511           0 :     pImpl->m_pDialog = NULL;    // dialog is deleted with parent
     512             : 
     513           0 :     return 0;
     514          93 : }
     515             : 
     516             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10