LCOV - code coverage report
Current view: top level - sw/source/ui/misc - redlndlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 630 0.2 %
Date: 2012-08-25 Functions: 2 50 4.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 1214 0.1 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <redline.hxx>
      30                 :            : #include <tools/datetime.hxx>
      31                 :            : #include <vcl/msgbox.hxx>
      32                 :            : #include <svl/eitem.hxx>
      33                 :            : #include <sfx2/viewfrm.hxx>
      34                 :            : #include <sfx2/dispatch.hxx>
      35                 :            : #include <svx/ctredlin.hxx>
      36                 :            : #include <svx/postattr.hxx>
      37                 :            : #include <swtypes.hxx>
      38                 :            : #include <wrtsh.hxx>
      39                 :            : #include <view.hxx>
      40                 :            : #include <swmodule.hxx>
      41                 :            : #include <redlndlg.hxx>
      42                 :            : #include <swwait.hxx>
      43                 :            : #include <uitool.hxx>
      44                 :            : 
      45                 :            : #include <helpid.h>
      46                 :            : #include <cmdid.h>
      47                 :            : #include <misc.hrc>
      48                 :            : #include <redlndlg.hrc>
      49                 :            : #include <shells.hrc>
      50                 :            : 
      51                 :            : // -> #111827#
      52                 :            : #include <comcore.hrc>
      53                 :            : #include <swundo.hxx>
      54                 :            : #include <SwRewriter.hxx>
      55                 :            : // <- #111827#
      56                 :            : 
      57                 :            : #include <vector>
      58                 :            : #include <svx/svxdlg.hxx>
      59                 :            : #include <svx/dialogs.hrc>
      60                 :            : 
      61                 :            : #include <unomid.h>
      62                 :            : 
      63                 :            : #include <docsh.hxx>
      64                 :            : 
      65                 :            : #include <IDocumentRedlineAccess.hxx>
      66                 :            : 
      67 [ #  # ][ +  - ]:      32289 : SFX_IMPL_MODELESSDIALOG_WITHID( SwRedlineAcceptChild, FN_REDLINE_ACCEPT )
                 [ #  # ]
      68                 :            : 
      69                 :            : static sal_uInt16 nSortMode = 0xffff;
      70                 :            : static sal_Bool   bSortDir = sal_True;
      71                 :            : 
      72                 :          0 : SwRedlineAcceptChild::SwRedlineAcceptChild( Window* _pParent,
      73                 :            :                                             sal_uInt16 nId,
      74                 :            :                                             SfxBindings* pBindings,
      75                 :            :                                             SfxChildWinInfo* pInfo ) :
      76                 :          0 :     SwChildWinWrapper( _pParent, nId )
      77                 :            : {
      78 [ #  # ][ #  # ]:          0 :     pWindow = new SwModelessRedlineAcceptDlg( pBindings, this, _pParent);
      79                 :            : 
      80         [ #  # ]:          0 :     ((SwModelessRedlineAcceptDlg *)pWindow)->Initialize(pInfo);
      81                 :          0 : }
      82                 :            : 
      83                 :            : /*--------------------------------------------------------------------
      84                 :            :     Description: newly initialise dialog after document switch
      85                 :            :  --------------------------------------------------------------------*/
      86                 :          0 : sal_Bool SwRedlineAcceptChild::ReInitDlg(SwDocShell *pDocSh)
      87                 :            : {
      88                 :            :     sal_Bool bRet;
      89                 :            : 
      90         [ #  # ]:          0 :     if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == sal_True)  // update immediately, doc switch!
      91                 :          0 :         ((SwModelessRedlineAcceptDlg*)GetWindow())->Activate();
      92                 :            : 
      93                 :          0 :     return bRet;
      94                 :            : }
      95                 :            : 
      96                 :          0 : SwModelessRedlineAcceptDlg::SwModelessRedlineAcceptDlg( SfxBindings* _pBindings,
      97                 :            :                                                         SwChildWinWrapper* pChild,
      98                 :            :                                                         Window *_pParent) :
      99                 :            :     SfxModelessDialog(_pBindings, pChild, _pParent, SW_RES(DLG_REDLINE_ACCEPT)),
     100         [ #  # ]:          0 :     pChildWin       (pChild)
     101                 :            : {
     102 [ #  # ][ #  # ]:          0 :     pImplDlg = new SwRedlineAcceptDlg(this);
     103                 :            : 
     104         [ #  # ]:          0 :     FreeResource();
     105                 :          0 : }
     106                 :            : 
     107                 :          0 : void SwModelessRedlineAcceptDlg::Activate()
     108                 :            : {
     109                 :          0 :     SwView *pView = ::GetActiveView();
     110                 :            : 
     111         [ #  # ]:          0 :     if (!pView) // can happen when switching to another app, when a Listbox in dialog
     112                 :          0 :         return; // had the focus previously (actually THs Bug)
     113                 :            : 
     114                 :          0 :     SwDocShell *pDocSh = pView->GetDocShell();
     115                 :            : 
     116         [ #  # ]:          0 :     if (pChildWin->GetOldDocShell() != pDocSh)
     117                 :            :     {   // doc-switch
     118         [ #  # ]:          0 :         SwWait aWait( *pDocSh, sal_False );
     119                 :          0 :         SwWrtShell* pSh = pView->GetWrtShellPtr();
     120                 :            : 
     121                 :          0 :         pChildWin->SetOldDocShell(pDocSh);  // avoid recursion (using modified-Hdl)
     122                 :            : 
     123         [ #  # ]:          0 :         sal_Bool bMod = pSh->IsModified();
     124         [ #  # ]:          0 :         SfxBoolItem aShow(FN_REDLINE_SHOW, sal_True);
     125                 :          0 :         pSh->GetView().GetViewFrame()->GetDispatcher()->Execute(
     126         [ #  # ]:          0 :             FN_REDLINE_SHOW, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aShow, 0L);
     127         [ #  # ]:          0 :         if (!bMod)
     128         [ #  # ]:          0 :             pSh->ResetModified();
     129         [ #  # ]:          0 :         pImplDlg->Init();
     130                 :            : 
     131 [ #  # ][ #  # ]:          0 :         return;
     132                 :            :     }
     133                 :            : 
     134                 :          0 :     pImplDlg->Activate();
     135                 :            : }
     136                 :            : 
     137                 :          0 : void SwModelessRedlineAcceptDlg::Initialize(SfxChildWinInfo *pInfo)
     138                 :            : {
     139         [ #  # ]:          0 :     String aStr;
     140         [ #  # ]:          0 :     if (pInfo != NULL)
     141         [ #  # ]:          0 :         pImplDlg->Initialize(pInfo->aExtraString);
     142                 :            : 
     143 [ #  # ][ #  # ]:          0 :     SfxModelessDialog::Initialize(pInfo);
     144                 :          0 : }
     145                 :            : 
     146                 :          0 : void SwModelessRedlineAcceptDlg::FillInfo(SfxChildWinInfo& rInfo) const
     147                 :            : {
     148                 :          0 :     SfxModelessDialog::FillInfo(rInfo);
     149                 :          0 :     pImplDlg->FillInfo(rInfo.aExtraString);
     150                 :          0 : }
     151                 :            : 
     152                 :          0 : void SwModelessRedlineAcceptDlg::Resize()
     153                 :            : {
     154                 :          0 :     pImplDlg->Resize();
     155                 :          0 :     SfxModelessDialog::Resize();
     156                 :          0 : }
     157                 :            : 
     158                 :          0 : SwModelessRedlineAcceptDlg::~SwModelessRedlineAcceptDlg()
     159                 :            : {
     160 [ #  # ][ #  # ]:          0 :     delete pImplDlg;
     161         [ #  # ]:          0 : }
     162                 :            : 
     163                 :          0 : SwRedlineAcceptDlg::SwRedlineAcceptDlg(Dialog *pParent, sal_Bool bAutoFmt) :
     164                 :            :     pParentDlg      (pParent),
     165                 :            :     aTabPagesCTRL   (pParent, SW_RES(CTRL_TABPAGES)),
     166                 :            :     aPopup          (SW_RES(MN_REDLINE_POPUP)),
     167                 :            :     sInserted       (SW_RES(STR_REDLINE_INSERTED)),
     168                 :            :     sDeleted        (SW_RES(STR_REDLINE_DELETED)),
     169                 :            :     sFormated       (SW_RES(STR_REDLINE_FORMATED)),
     170                 :            :     sTableChgd      (SW_RES(STR_REDLINE_TABLECHG)),
     171                 :            :     sFmtCollSet     (SW_RES(STR_REDLINE_FMTCOLLSET)),
     172                 :            :     sAutoFormat     (SW_RES(STR_REDLINE_AUTOFMT)),
     173                 :            :     bOnlyFormatedRedlines( sal_False ),
     174                 :            :     bHasReadonlySel ( sal_False ),
     175                 :            :     bRedlnAutoFmt   (bAutoFmt),
     176 [ #  # ][ #  # ]:          0 :     bInhibitActivate( false )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     177                 :            : {
     178         [ #  # ]:          0 :     aTabPagesCTRL.SetHelpId(HID_REDLINE_CTRL);
     179         [ #  # ]:          0 :     pTPView = aTabPagesCTRL.GetViewPage();
     180         [ #  # ]:          0 :     pTable = pTPView->GetTableControl();
     181                 :            : 
     182         [ #  # ]:          0 :     pTPView->InsertWriterHeader();
     183         [ #  # ]:          0 :     pTPView->SetAcceptClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptHdl));
     184         [ #  # ]:          0 :     pTPView->SetAcceptAllClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptAllHdl));
     185         [ #  # ]:          0 :     pTPView->SetRejectClickHdl(LINK(this, SwRedlineAcceptDlg, RejectHdl));
     186         [ #  # ]:          0 :     pTPView->SetRejectAllClickHdl(LINK(this, SwRedlineAcceptDlg, RejectAllHdl));
     187         [ #  # ]:          0 :     pTPView->SetUndoClickHdl(LINK(this, SwRedlineAcceptDlg, UndoHdl));
     188                 :            : 
     189 [ #  # ][ #  # ]:          0 :     aTabPagesCTRL.GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl));
     190                 :            : 
     191 [ #  # ][ #  # ]:          0 :     ListBox *pActLB = aTabPagesCTRL.GetFilterPage()->GetLbAction();
     192         [ #  # ]:          0 :     pActLB->InsertEntry(sInserted);
     193         [ #  # ]:          0 :     pActLB->InsertEntry(sDeleted);
     194         [ #  # ]:          0 :     pActLB->InsertEntry(sFormated);
     195         [ #  # ]:          0 :     pActLB->InsertEntry(sTableChgd);
     196                 :            : 
     197         [ #  # ]:          0 :     if (HasRedlineAutoFmt())
     198                 :            :     {
     199         [ #  # ]:          0 :         pActLB->InsertEntry(sFmtCollSet);
     200         [ #  # ]:          0 :         pActLB->InsertEntry(sAutoFormat);
     201         [ #  # ]:          0 :         pTPView->ShowUndo(sal_True);
     202         [ #  # ]:          0 :         pTPView->DisableUndo();     // no UNDO events yet
     203                 :            :     }
     204                 :            : 
     205         [ #  # ]:          0 :     pActLB->SelectEntryPos(0);
     206                 :            : 
     207 [ #  # ][ #  # ]:          0 :     pTable->SetStyle(pTable->GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
     208         [ #  # ]:          0 :     pTable->SetNodeDefaultImages();
     209         [ #  # ]:          0 :     pTable->SetSelectionMode(MULTIPLE_SELECTION);
     210         [ #  # ]:          0 :     pTable->SetHighlightRange(1);
     211                 :            : 
     212                 :            :     static long aStaticTabs[]=
     213                 :            :     {
     214                 :            :         4,10,70,120,170
     215                 :            :     };
     216                 :            : 
     217         [ #  # ]:          0 :     pTable->SetTabs(aStaticTabs);
     218                 :            : 
     219                 :            :     // set minimum size
     220         [ #  # ]:          0 :     Size aMinSz(aTabPagesCTRL.GetMinSizePixel());
     221         [ #  # ]:          0 :     Point aPos(aTabPagesCTRL.GetPosPixel());
     222                 :            : 
     223                 :          0 :     aMinSz.Width() += (aPos.X() * 2 - 1);
     224                 :          0 :     aMinSz.Height() += (aPos.Y() * 2 - 1);
     225         [ #  # ]:          0 :     pParentDlg->SetMinOutputSizePixel(aMinSz);
     226                 :            : 
     227         [ #  # ]:          0 :     if (pParentDlg->GetOutputSizePixel().Width() < aMinSz.Width())
     228         [ #  # ]:          0 :         pParentDlg->SetOutputSizePixel(Size(aMinSz.Width(), pParentDlg->GetOutputSizePixel().Height()));
     229         [ #  # ]:          0 :     if (pParentDlg->GetOutputSizePixel().Height() < aMinSz.Height())
     230         [ #  # ]:          0 :         pParentDlg->SetOutputSizePixel(Size(pParentDlg->GetOutputSizePixel().Width(), aMinSz.Height()));
     231                 :            : 
     232         [ #  # ]:          0 :     pTable->SortByCol(nSortMode, bSortDir);
     233                 :            : 
     234                 :          0 :     aOldSelectHdl = pTable->GetSelectHdl();
     235                 :          0 :     aOldDeselectHdl = pTable->GetDeselectHdl();
     236         [ #  # ]:          0 :     pTable->SetSelectHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl));
     237         [ #  # ]:          0 :     pTable->SetDeselectHdl(LINK(this, SwRedlineAcceptDlg, DeselectHdl));
     238         [ #  # ]:          0 :     pTable->SetCommandHdl(LINK(this, SwRedlineAcceptDlg, CommandHdl));
     239                 :            : 
     240                 :            :     // avoid flickering of buttons:
     241         [ #  # ]:          0 :     aDeselectTimer.SetTimeout(100);
     242         [ #  # ]:          0 :     aDeselectTimer.SetTimeoutHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl));
     243                 :            : 
     244                 :            :     // avoid multiple selection of the same texts:
     245         [ #  # ]:          0 :     aSelectTimer.SetTimeout(100);
     246         [ #  # ]:          0 :     aSelectTimer.SetTimeoutHdl(LINK(this, SwRedlineAcceptDlg, GotoHdl));
     247                 :          0 : }
     248                 :            : 
     249 [ #  # ][ #  # ]:          0 : SwRedlineAcceptDlg::~SwRedlineAcceptDlg()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     250                 :            : {
     251         [ #  # ]:          0 : }
     252                 :            : 
     253                 :          0 : void SwRedlineAcceptDlg::Init(sal_uInt16 nStart)
     254                 :            : {
     255 [ #  # ][ #  # ]:          0 :     SwWait aWait( *::GetActiveView()->GetDocShell(), sal_False );
                 [ #  # ]
     256         [ #  # ]:          0 :     pTable->SetUpdateMode(sal_False);
     257                 :          0 :     aUsedSeqNo.clear();
     258                 :            : 
     259         [ #  # ]:          0 :     if (nStart)
     260         [ #  # ]:          0 :         RemoveParents(nStart, aRedlineParents.size() - 1);
     261                 :            :     else
     262                 :            :     {
     263         [ #  # ]:          0 :         pTable->Clear();
     264         [ #  # ]:          0 :         aRedlineChildren.clear();
     265 [ #  # ][ #  # ]:          0 :         aRedlineParents.erase(aRedlineParents.begin() + nStart, aRedlineParents.end());
         [ #  # ][ #  # ]
     266                 :            :     }
     267                 :            : 
     268                 :            :     // insert parents
     269         [ #  # ]:          0 :     InsertParents(nStart);
     270         [ #  # ]:          0 :     InitAuthors();
     271                 :            : 
     272         [ #  # ]:          0 :     pTable->SetUpdateMode(sal_True);
     273                 :            :     // #i69618# this moves the list box to the right position, visually
     274         [ #  # ]:          0 :     SvLBoxEntry* pSelEntry = pTable->FirstSelected();
     275         [ #  # ]:          0 :     if( pSelEntry )
     276 [ #  # ][ #  # ]:          0 :         pTable->MakeVisible( pSelEntry, sal_True ); //#i70937#, force the scroll
     277                 :          0 : }
     278                 :            : 
     279                 :          0 : void SwRedlineAcceptDlg::InitAuthors()
     280                 :            : {
     281         [ #  # ]:          0 :     SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
     282                 :            : 
     283         [ #  # ]:          0 :     SvxTPFilter *pFilterPage = aTabPagesCTRL.GetFilterPage();
     284                 :            : 
     285         [ #  # ]:          0 :     String sAuthor;
     286         [ #  # ]:          0 :     std::vector<String> aStrings;
     287         [ #  # ]:          0 :     String sOldAuthor(pFilterPage->GetSelectedAuthor());
     288         [ #  # ]:          0 :     pFilterPage->ClearAuthors();
     289                 :            : 
     290         [ #  # ]:          0 :     String sParent;
     291         [ #  # ]:          0 :     sal_uInt16 nCount = pSh->GetRedlineCount();
     292                 :            : 
     293                 :          0 :     bOnlyFormatedRedlines = sal_True;
     294                 :          0 :     bHasReadonlySel = sal_False;
     295                 :          0 :     sal_Bool bIsNotFormated = sal_False;
     296                 :            :     sal_uInt16 i;
     297                 :            : 
     298                 :            :     // determine authors
     299         [ #  # ]:          0 :     for ( i = 0; i < nCount; i++)
     300                 :            :     {
     301         [ #  # ]:          0 :         const SwRedline& rRedln = pSh->GetRedline(i);
     302                 :            : 
     303 [ #  # ][ #  # ]:          0 :         if( bOnlyFormatedRedlines && nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType() )
         [ #  # ][ #  # ]
     304                 :          0 :             bOnlyFormatedRedlines = sal_False;
     305                 :            : 
     306 [ #  # ][ #  # ]:          0 :         aStrings.push_back(rRedln.GetAuthorString());
     307                 :            : 
     308 [ #  # ][ #  # ]:          0 :         for (sal_uInt16 nStack = 1; nStack < rRedln.GetStackCount(); nStack++)
     309                 :            :         {
     310 [ #  # ][ #  # ]:          0 :             aStrings.push_back(rRedln.GetAuthorString(nStack));
     311                 :            :         }
     312                 :            :     }
     313                 :            : 
     314         [ #  # ]:          0 :     std::sort(aStrings.begin(), aStrings.end());
     315 [ #  # ][ #  # ]:          0 :     aStrings.erase(std::unique(aStrings.begin(), aStrings.end()), aStrings.end());
     316                 :            : 
     317         [ #  # ]:          0 :     for (i = 0; i < aStrings.size(); i++)
     318 [ #  # ][ #  # ]:          0 :         pFilterPage->InsertAuthor(aStrings[i]);
     319                 :            : 
     320 [ #  # ][ #  # ]:          0 :     if (pFilterPage->SelectAuthor(sOldAuthor) == LISTBOX_ENTRY_NOTFOUND && !aStrings.empty())
         [ #  # ][ #  # ]
     321 [ #  # ][ #  # ]:          0 :         pFilterPage->SelectAuthor(aStrings[0]);
     322                 :            : 
     323 [ #  # ][ #  # ]:          0 :     sal_Bool bEnable = pTable->GetEntryCount() != 0 && !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength();
         [ #  # ][ #  # ]
     324         [ #  # ]:          0 :     sal_Bool bSel = pTable->FirstSelected() != 0;
     325                 :            : 
     326         [ #  # ]:          0 :     SvLBoxEntry* pSelEntry = pTable->FirstSelected();
     327         [ #  # ]:          0 :     while (pSelEntry)
     328                 :            :     {
     329         [ #  # ]:          0 :         sal_uInt16 nPos = GetRedlinePos(*pSelEntry);
     330         [ #  # ]:          0 :         const SwRedline& rRedln = pSh->GetRedline( nPos );
     331                 :            : 
     332         [ #  # ]:          0 :         bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType();
     333         [ #  # ]:          0 :         pSelEntry = pTable->NextSelected(pSelEntry);
     334                 :            :     }
     335                 :            : 
     336 [ #  # ][ #  # ]:          0 :     pTPView->EnableAccept( bEnable && bSel );
                 [ #  # ]
     337 [ #  # ][ #  # ]:          0 :     pTPView->EnableReject( bEnable && bIsNotFormated && bSel );
         [ #  # ][ #  # ]
     338 [ #  # ][ #  # ]:          0 :     pTPView->EnableAcceptAll( bEnable && !bHasReadonlySel );
                 [ #  # ]
     339                 :          0 :     pTPView->EnableRejectAll( bEnable && !bHasReadonlySel &&
     340 [ #  # ][ #  # ]:          0 :                                 !bOnlyFormatedRedlines );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     341                 :          0 : }
     342                 :            : 
     343                 :          0 : String SwRedlineAcceptDlg::GetRedlineText( const SwRedline& rRedln,
     344                 :            :                                         DateTime &rDateTime, sal_uInt16 nStack)
     345                 :            : {
     346                 :          0 :     String sEntry(GetActionText(rRedln, nStack));
     347         [ #  # ]:          0 :     sEntry += '\t';
     348 [ #  # ][ #  # ]:          0 :     sEntry += rRedln.GetAuthorString(nStack);
     349         [ #  # ]:          0 :     sEntry += '\t';
     350                 :            : 
     351         [ #  # ]:          0 :     const DateTime &rDT = rRedln.GetTimeStamp(nStack);
     352         [ #  # ]:          0 :     rDateTime = rDT;
     353                 :            : 
     354 [ #  # ][ #  # ]:          0 :     sEntry += GetAppLangDateTimeString( rDT );
                 [ #  # ]
     355         [ #  # ]:          0 :     sEntry += '\t';
     356                 :            : 
     357 [ #  # ][ #  # ]:          0 :     sEntry += rRedln.GetComment(nStack);
     358                 :            : 
     359                 :          0 :     return sEntry;
     360                 :            : }
     361                 :            : 
     362                 :          0 : const String &SwRedlineAcceptDlg::GetActionText(const SwRedline& rRedln, sal_uInt16 nStack)
     363                 :            : {
     364   [ #  #  #  #  :          0 :     switch( rRedln.GetType(nStack) )
                   #  # ]
     365                 :            :     {
     366                 :          0 :         case nsRedlineType_t::REDLINE_INSERT:   return sInserted;
     367                 :          0 :         case nsRedlineType_t::REDLINE_DELETE:   return sDeleted;
     368                 :          0 :         case nsRedlineType_t::REDLINE_FORMAT:   return sFormated;
     369                 :          0 :         case nsRedlineType_t::REDLINE_TABLE:    return sTableChgd;
     370                 :          0 :         case nsRedlineType_t::REDLINE_FMTCOLL:  return sFmtCollSet;
     371                 :            :         default:;//prevent warning
     372                 :            :     }
     373                 :            : 
     374                 :          0 :     return aEmptyStr;
     375                 :            : }
     376                 :            : 
     377                 :          0 : void SwRedlineAcceptDlg::Resize()
     378                 :            : {
     379                 :          0 :     Size aSz(pParentDlg->GetOutputSizePixel());
     380                 :            : 
     381         [ #  # ]:          0 :     Point aPos(aTabPagesCTRL.GetPosPixel());
     382                 :            : 
     383                 :          0 :     aSz.Width() -= (aPos.X() * 2 - 1);
     384                 :          0 :     aSz.Height() -= (aPos.Y() * 2 - 1);
     385                 :            : 
     386         [ #  # ]:          0 :     aTabPagesCTRL.SetOutputSizePixel(aSz);
     387                 :          0 : }
     388                 :            : 
     389                 :            : /*--------------------------------------------------------------------
     390                 :            :     Description: newly initialise after activation
     391                 :            :  --------------------------------------------------------------------*/
     392                 :          0 : void SwRedlineAcceptDlg::Activate()
     393                 :            : {
     394                 :            :     // prevent update if flag is set (#102547#)
     395         [ #  # ]:          0 :     if( bInhibitActivate )
     396                 :            :         return;
     397                 :            : 
     398         [ #  # ]:          0 :     SwView *pView = ::GetActiveView();
     399                 :            : 
     400         [ #  # ]:          0 :     if (!pView) // can happen when switching to another app, when a Listbox in the dialog
     401                 :            :         return; // had the focus previously (actually THs Bug)
     402                 :            : 
     403 [ #  # ][ #  # ]:          0 :     SwWait aWait( *pView->GetDocShell(), sal_False );
     404                 :            : 
     405                 :          0 :     aUsedSeqNo.clear();
     406                 :            : 
     407                 :            :     // did something change?
     408                 :          0 :     SwWrtShell* pSh = pView->GetWrtShellPtr();
     409         [ #  # ]:          0 :     sal_uInt16 nCount = pSh->GetRedlineCount();
     410                 :            : 
     411                 :            :     // check the number of pointers
     412                 :          0 :     SwRedlineDataParent *pParent = 0;
     413                 :            :     sal_uInt16 i;
     414                 :            : 
     415         [ #  # ]:          0 :     for ( i = 0; i < nCount; i++)
     416                 :            :     {
     417         [ #  # ]:          0 :         const SwRedline& rRedln = pSh->GetRedline(i);
     418                 :            : 
     419         [ #  # ]:          0 :         if (i >= aRedlineParents.size())
     420                 :            :         {
     421                 :            :             // new entries have been appended
     422         [ #  # ]:          0 :             Init(i);
     423                 :            :             return;
     424                 :            :         }
     425                 :            : 
     426         [ #  # ]:          0 :         pParent = &aRedlineParents[i];
     427 [ #  # ][ #  # ]:          0 :         if (&rRedln.GetRedlineData() != pParent->pData)
     428                 :            :         {
     429                 :            :             // Redline-Parents were inserted, changed or deleted
     430 [ #  # ][ #  # ]:          0 :             if ((i = CalcDiff(i, sal_False)) == USHRT_MAX)
     431                 :            :                 return;
     432                 :          0 :             continue;
     433                 :            :         }
     434                 :            : 
     435         [ #  # ]:          0 :         const SwRedlineData *pRedlineData = rRedln.GetRedlineData().Next();
     436                 :          0 :         const SwRedlineDataChild *pBackupData = pParent->pNext;
     437                 :            : 
     438 [ #  # ][ #  # ]:          0 :         if (!pRedlineData && pBackupData)
     439                 :            :         {
     440                 :            :             // Redline-Children were deleted
     441 [ #  # ][ #  # ]:          0 :             if ((i = CalcDiff(i, sal_True)) == USHRT_MAX)
     442                 :            :                 return;
     443                 :          0 :             continue;
     444                 :            :         }
     445                 :            :         else
     446                 :            :         {
     447         [ #  # ]:          0 :             while (pRedlineData)
     448                 :            :             {
     449         [ #  # ]:          0 :                 if (pRedlineData != pBackupData->pChild)
     450                 :            :                 {
     451                 :            :                     // Redline-Children were inserted, changed or deleted
     452 [ #  # ][ #  # ]:          0 :                     if ((i = CalcDiff(i, sal_True)) == USHRT_MAX)
     453                 :            :                         return;
     454                 :          0 :                     continue;
     455                 :            :                 }
     456         [ #  # ]:          0 :                 if (pBackupData)
     457                 :          0 :                     pBackupData = pBackupData->pNext;
     458                 :          0 :                 pRedlineData = pRedlineData->Next();
     459                 :            :             }
     460                 :            :         }
     461                 :            :     }
     462                 :            : 
     463         [ #  # ]:          0 :     if (nCount != aRedlineParents.size())
     464                 :            :     {
     465                 :            :         // Redlines were deleted at the end
     466         [ #  # ]:          0 :         Init(nCount);
     467                 :            :         return;
     468                 :            :     }
     469                 :            : 
     470                 :            :     // check comment
     471         [ #  # ]:          0 :     for (i = 0; i < nCount; i++)
     472                 :            :     {
     473         [ #  # ]:          0 :         const SwRedline& rRedln = pSh->GetRedline(i);
     474         [ #  # ]:          0 :         pParent = &aRedlineParents[i];
     475                 :            : 
     476 [ #  # ][ #  # ]:          0 :         if(!rRedln.GetComment().Equals(pParent->sComment))
                 [ #  # ]
     477                 :            :         {
     478         [ #  # ]:          0 :             if (pParent->pTLBParent)
     479                 :            :             {
     480                 :            :                 // update only comment
     481 [ #  # ][ #  # ]:          0 :                 String sComment(rRedln.GetComment());
     482         [ #  # ]:          0 :                 sComment.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' ');
     483 [ #  # ][ #  # ]:          0 :                 pTable->SetEntryText(sComment, pParent->pTLBParent, 3);
     484                 :            :             }
     485 [ #  # ][ #  # ]:          0 :             pParent->sComment = rRedln.GetComment();
     486                 :            :         }
     487                 :            :     }
     488                 :            : 
     489 [ #  # ][ #  # ]:          0 :     InitAuthors();
                 [ #  # ]
     490                 :            : }
     491                 :            : 
     492                 :          0 : sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, sal_Bool bChild)
     493                 :            : {
     494         [ #  # ]:          0 :     if (!nStart)
     495                 :            :     {
     496                 :          0 :         Init();
     497                 :          0 :         return USHRT_MAX;
     498                 :            :     }
     499                 :            : 
     500                 :          0 :     pTable->SetUpdateMode(sal_False);
     501                 :          0 :     SwView *pView   = ::GetActiveView();
     502                 :          0 :     SwWrtShell* pSh = pView->GetWrtShellPtr();
     503         [ #  # ]:          0 :     sal_uInt16 nAutoFmt = HasRedlineAutoFmt() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0;
     504                 :          0 :     SwRedlineDataParent *pParent = &aRedlineParents[nStart];
     505                 :          0 :     const SwRedline& rRedln = pSh->GetRedline(nStart);
     506                 :            : 
     507         [ #  # ]:          0 :     if (bChild)     // should actually never happen, but just in case...
     508                 :            :     {
     509                 :            :         // throw away all entry's children and initialise newly
     510                 :          0 :         SwRedlineDataChild* pBackupData = (SwRedlineDataChild*)pParent->pNext;
     511                 :            :         SwRedlineDataChild* pNext;
     512                 :            : 
     513         [ #  # ]:          0 :         while (pBackupData)
     514                 :            :         {
     515                 :          0 :             pNext = (SwRedlineDataChild*)pBackupData->pNext;
     516         [ #  # ]:          0 :             if (pBackupData->pTLBChild)
     517                 :          0 :                 pTable->RemoveEntry(pBackupData->pTLBChild);
     518                 :            : 
     519 [ #  # ][ #  # ]:          0 :             for( SwRedlineDataChildArr::iterator it = aRedlineChildren.begin();
         [ #  # ][ #  # ]
     520         [ #  # ]:          0 :                  it != aRedlineChildren.end(); ++it)
     521 [ #  # ][ #  # ]:          0 :                 if (&*it == pBackupData)
     522                 :            :                 {
     523         [ #  # ]:          0 :                     aRedlineChildren.erase(it);
     524                 :          0 :                     break;
     525                 :            :                 }
     526                 :          0 :             pBackupData = pNext;
     527                 :            :         }
     528                 :          0 :         pParent->pNext = 0;
     529                 :            : 
     530                 :            :         // insert new children
     531                 :          0 :         InsertChildren(pParent, rRedln, nAutoFmt);
     532                 :            : 
     533                 :          0 :         pTable->SetUpdateMode(sal_True);
     534                 :          0 :         return nStart;
     535                 :            :     }
     536                 :            : 
     537                 :            :     // have entries been deleted?
     538                 :          0 :     const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
     539                 :            :     sal_uInt16 i;
     540         [ #  # ]:          0 :     for ( i = nStart + 1; i < aRedlineParents.size(); i++)
     541                 :            :     {
     542         [ #  # ]:          0 :         if (aRedlineParents[i].pData == pRedlineData)
     543                 :            :         {
     544                 :            :             // remove entries from nStart to i-1
     545                 :          0 :             RemoveParents(nStart, i - 1);
     546                 :          0 :             pTable->SetUpdateMode(sal_True);
     547                 :          0 :             return nStart - 1;
     548                 :            :         }
     549                 :            :     }
     550                 :            : 
     551                 :            :     // entries been inserted?
     552                 :          0 :     sal_uInt16 nCount = pSh->GetRedlineCount();
     553                 :          0 :     pRedlineData = aRedlineParents[nStart].pData;
     554                 :            : 
     555         [ #  # ]:          0 :     for (i = nStart + 1; i < nCount; i++)
     556                 :            :     {
     557         [ #  # ]:          0 :         if (&pSh->GetRedline(i).GetRedlineData() == pRedlineData)
     558                 :            :         {
     559                 :            :             // insert entries from nStart to i-1
     560                 :          0 :             InsertParents(nStart, i - 1);
     561                 :          0 :             pTable->SetUpdateMode(sal_True);
     562                 :          0 :             return nStart - 1;
     563                 :            :         }
     564                 :            :     }
     565                 :            : 
     566                 :          0 :     pTable->SetUpdateMode(sal_True);
     567                 :          0 :     Init(nStart);   // adjust all entries until the end
     568                 :          0 :     return USHRT_MAX;
     569                 :            : }
     570                 :            : 
     571                 :          0 : void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRedline& rRedln, const sal_uInt16 nAutoFmt)
     572                 :            : {
     573         [ #  # ]:          0 :     String sChild;
     574                 :          0 :     SwRedlineDataChild *pLastRedlineChild = 0;
     575         [ #  # ]:          0 :     const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
     576         [ #  # ]:          0 :     sal_Bool bAutoFmt = (rRedln.GetRealType() & nAutoFmt) != 0;
     577                 :            : 
     578         [ #  # ]:          0 :     const String *pAction = &GetActionText(rRedln);
     579 [ #  # ][ #  # ]:          0 :     sal_Bool bValidParent = !sFilterAction.Len() || sFilterAction == *pAction;
                 [ #  # ]
     580 [ #  # ][ #  # ]:          0 :     bValidParent = bValidParent && pTable->IsValidEntry(&rRedln.GetAuthorString(), &rRedln.GetTimeStamp(), &rRedln.GetComment());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     581         [ #  # ]:          0 :     if (nAutoFmt)
     582                 :            :     {
     583                 :            : 
     584         [ #  # ]:          0 :         if (pParent->pData->GetSeqNo())
     585                 :            :         {
     586                 :            :             std::pair<SwRedlineDataParentSortArr::const_iterator,bool> const ret
     587         [ #  # ]:          0 :                 = aUsedSeqNo.insert(pParent);
     588         [ #  # ]:          0 :             if (ret.second) // already there
     589                 :            :             {
     590         [ #  # ]:          0 :                 if (pParent->pTLBParent)
     591                 :            :                 {
     592                 :            :                     pTable->SetEntryText(
     593         [ #  # ]:          0 :                             sAutoFormat, (*ret.first)->pTLBParent, 0);
     594         [ #  # ]:          0 :                     pTable->RemoveEntry(pParent->pTLBParent);
     595                 :          0 :                     pParent->pTLBParent = 0;
     596                 :            :                 }
     597                 :          0 :                 return;
     598                 :            :             }
     599                 :            :         }
     600 [ #  # ][ #  # ]:          0 :         bValidParent = bValidParent && bAutoFmt;
     601                 :            :     }
     602                 :          0 :     sal_Bool bValidTree = bValidParent;
     603                 :            : 
     604 [ #  # ][ #  # ]:          0 :     for (sal_uInt16 nStack = 1; nStack < rRedln.GetStackCount(); nStack++)
     605                 :            :     {
     606                 :          0 :         pRedlineData = pRedlineData->Next();
     607                 :            : 
     608         [ #  # ]:          0 :         SwRedlineDataChildPtr pRedlineChild = new SwRedlineDataChild;
     609                 :          0 :         pRedlineChild->pChild = pRedlineData;
     610         [ #  # ]:          0 :         aRedlineChildren.push_back(pRedlineChild);
     611                 :            : 
     612         [ #  # ]:          0 :         if ( pLastRedlineChild )
     613                 :          0 :             pLastRedlineChild->pNext = pRedlineChild;
     614                 :            :         else
     615                 :          0 :             pParent->pNext = pRedlineChild;
     616                 :            : 
     617         [ #  # ]:          0 :         pAction = &GetActionText(rRedln, nStack);
     618 [ #  # ][ #  # ]:          0 :         sal_Bool bValidChild = !sFilterAction.Len() || sFilterAction == *pAction;
                 [ #  # ]
     619 [ #  # ][ #  # ]:          0 :         bValidChild = bValidChild && pTable->IsValidEntry(&rRedln.GetAuthorString(nStack), &rRedln.GetTimeStamp(nStack), &rRedln.GetComment());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     620         [ #  # ]:          0 :         if (nAutoFmt)
     621 [ #  # ][ #  # ]:          0 :             bValidChild = bValidChild && bAutoFmt;
     622                 :          0 :         bValidTree |= bValidChild;
     623                 :            : 
     624         [ #  # ]:          0 :         if (bValidChild)
     625                 :            :         {
     626 [ #  # ][ #  # ]:          0 :             RedlinData *pData = new RedlinData;
     627                 :          0 :             pData->pData = pRedlineChild;
     628                 :          0 :             pData->bDisabled = sal_True;
     629 [ #  # ][ #  # ]:          0 :             sChild = GetRedlineText(rRedln, pData->aDateTime, nStack);
                 [ #  # ]
     630                 :            : 
     631         [ #  # ]:          0 :             SvLBoxEntry* pChild = pTable->InsertEntry(sChild, pData, pParent->pTLBParent);
     632                 :            : 
     633                 :          0 :             pRedlineChild->pTLBChild = pChild;
     634         [ #  # ]:          0 :             if (!bValidParent)
     635         [ #  # ]:          0 :                 pTable->Expand(pParent->pTLBParent);
     636                 :            :         }
     637                 :            :         else
     638                 :          0 :             pRedlineChild->pTLBChild = 0;
     639                 :            : 
     640                 :          0 :         pLastRedlineChild = pRedlineChild;
     641                 :            :     }
     642                 :            : 
     643         [ #  # ]:          0 :     if (pLastRedlineChild)
     644                 :          0 :         pLastRedlineChild->pNext = 0;
     645                 :            : 
     646 [ #  # ][ #  # ]:          0 :     if (!bValidTree && pParent->pTLBParent)
     647                 :            :     {
     648         [ #  # ]:          0 :         pTable->RemoveEntry(pParent->pTLBParent);
     649                 :          0 :         pParent->pTLBParent = 0;
     650         [ #  # ]:          0 :         if (nAutoFmt)
     651         [ #  # ]:          0 :             aUsedSeqNo.erase(pParent);
     652 [ #  # ][ #  # ]:          0 :     }
     653                 :            : }
     654                 :            : 
     655                 :          0 : void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd)
     656                 :            : {
     657         [ #  # ]:          0 :     SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
     658         [ #  # ]:          0 :     sal_uInt16 nCount = pSh->GetRedlineCount();
     659                 :            : 
     660         [ #  # ]:          0 :     SvLBoxEntryArr aLBoxArr;
     661                 :            : 
     662                 :            :     // because of Bug of TLB that ALWAYS calls the SelectHandler at Remove:
     663                 :          0 :     pTable->SetSelectHdl(aOldSelectHdl);
     664                 :          0 :     pTable->SetDeselectHdl(aOldDeselectHdl);
     665                 :          0 :     sal_Bool bChildrenRemoved = sal_False;
     666         [ #  # ]:          0 :     pTable->SelectAll(sal_False);
     667                 :            : 
     668                 :            :     // set the cursor after the last entry because otherwise performance problem in TLB.
     669                 :            :     // TLB would otherwise reset the cursor at every Remove (expensive)
     670                 :          0 :     sal_uInt16 nPos = Min((sal_uInt16)nCount, (sal_uInt16)aRedlineParents.size());
     671                 :          0 :     SvLBoxEntry *pCurEntry = NULL;
     672 [ #  # ][ #  # ]:          0 :     while( ( pCurEntry == NULL ) && ( nPos > 0 ) )
                 [ #  # ]
     673                 :            :     {
     674                 :          0 :         --nPos;
     675         [ #  # ]:          0 :         pCurEntry = aRedlineParents[nPos].pTLBParent;
     676                 :            :     }
     677                 :            : 
     678         [ #  # ]:          0 :     if (pCurEntry)
     679         [ #  # ]:          0 :         pTable->SetCurEntry(pCurEntry);
     680                 :            : 
     681                 :          0 :     SvLBoxTreeList* pModel = pTable->GetModel();
     682                 :            : 
     683         [ #  # ]:          0 :     for (sal_uInt16 i = nStart; i <= nEnd; i++)
     684                 :            :     {
     685 [ #  # ][ #  # ]:          0 :         if (!bChildrenRemoved && aRedlineParents[i].pNext)
         [ #  # ][ #  # ]
     686                 :            :         {
     687         [ #  # ]:          0 :             SwRedlineDataChildPtr pChildPtr = (SwRedlineDataChildPtr)aRedlineParents[i].pNext;
     688 [ #  # ][ #  # ]:          0 :             for( SwRedlineDataChildArr::iterator it = aRedlineChildren.begin();
         [ #  # ][ #  # ]
     689         [ #  # ]:          0 :                  it != aRedlineChildren.end(); ++it)
     690 [ #  # ][ #  # ]:          0 :                 if (&*it == pChildPtr)
     691                 :            :                 {
     692                 :          0 :                     sal_uInt16 nChildren = 0;
     693         [ #  # ]:          0 :                     while (pChildPtr)
     694                 :            :                     {
     695                 :          0 :                         pChildPtr = (SwRedlineDataChildPtr)pChildPtr->pNext;
     696                 :          0 :                         nChildren++;
     697                 :            :                     }
     698                 :            : 
     699 [ #  # ][ #  # ]:          0 :                     aRedlineChildren.erase(it, it + nChildren);
     700                 :          0 :                     bChildrenRemoved = sal_True;
     701                 :          0 :                     break;
     702                 :            :                 }
     703                 :            :         }
     704         [ #  # ]:          0 :         SvLBoxEntry *pEntry = aRedlineParents[i].pTLBParent;
     705         [ #  # ]:          0 :         if (pEntry)
     706                 :            :         {
     707                 :          0 :             long nIdx = aLBoxArr.size() - 1L;
     708         [ #  # ]:          0 :             sal_uLong nAbsPos = pModel->GetAbsPos(pEntry);
     709 [ #  # ][ #  # ]:          0 :             while (nIdx >= 0 &&
                 [ #  # ]
     710 [ #  # ][ #  # ]:          0 :                     pModel->GetAbsPos(aLBoxArr[ static_cast< sal_uInt16 >(nIdx) ]) > nAbsPos)
     711                 :          0 :                 nIdx--;
     712 [ #  # ][ #  # ]:          0 :             aLBoxArr.insert( aLBoxArr.begin() + static_cast< sal_uInt16 >(++nIdx) , pEntry);
     713                 :            :         }
     714                 :            :     }
     715                 :            : 
     716                 :            :     // clear TLB from behind
     717                 :          0 :     long nIdx = (long)aLBoxArr.size() - 1L;
     718         [ #  # ]:          0 :     while (nIdx >= 0)
     719 [ #  # ][ #  # ]:          0 :         pTable->RemoveEntry(aLBoxArr[ static_cast< sal_uInt16 >(nIdx--) ]);
     720                 :            : 
     721         [ #  # ]:          0 :     pTable->SetSelectHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl));
     722         [ #  # ]:          0 :     pTable->SetDeselectHdl(LINK(this, SwRedlineAcceptDlg, DeselectHdl));
     723                 :            :     // unfortunately by Remove it was selected from the TLB always again ...
     724         [ #  # ]:          0 :     pTable->SelectAll(sal_False);
     725                 :            : 
     726 [ #  # ][ #  # ]:          0 :     aRedlineParents.erase( aRedlineParents.begin() + nStart, aRedlineParents.begin() + nEnd + 1);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     727                 :          0 : }
     728                 :            : 
     729                 :          0 : void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd)
     730                 :            : {
     731         [ #  # ]:          0 :     SwView *pView   = ::GetActiveView();
     732                 :          0 :     SwWrtShell* pSh = pView->GetWrtShellPtr();
     733         [ #  # ]:          0 :     sal_uInt16 nAutoFmt = HasRedlineAutoFmt() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0;
     734                 :            : 
     735         [ #  # ]:          0 :     String sParent;
     736         [ #  # ]:          0 :     sal_uInt16 nCount = pSh->GetRedlineCount();
     737                 :          0 :     nEnd = Min((sal_uInt16)nEnd, (sal_uInt16)(nCount - 1)); // also treats nEnd=USHRT_MAX (until the end)
     738                 :            : 
     739         [ #  # ]:          0 :     if (nEnd == USHRT_MAX)
     740                 :          0 :         return;     // no redlines in the document
     741                 :            : 
     742                 :            :     RedlinData *pData;
     743                 :            :     SvLBoxEntry *pParent;
     744                 :            :     SwRedlineDataParent* pRedlineParent;
     745                 :            :     const SwRedline* pCurrRedline;
     746 [ #  # ][ #  # ]:          0 :     if( !nStart && !pTable->FirstSelected() )
         [ #  # ][ #  # ]
     747                 :            :     {
     748         [ #  # ]:          0 :         pCurrRedline = pSh->GetCurrRedline();
     749         [ #  # ]:          0 :         if( !pCurrRedline )
     750                 :            :         {
     751         [ #  # ]:          0 :             pSh->SwCrsrShell::Push();
     752 [ #  # ][ #  # ]:          0 :             if( 0 == (pCurrRedline = pSh->SelNextRedline()))
     753         [ #  # ]:          0 :                 pCurrRedline = pSh->SelPrevRedline();
     754         [ #  # ]:          0 :             pSh->SwCrsrShell::Pop( sal_False );
     755                 :            :         }
     756                 :            :     }
     757                 :            :     else
     758                 :          0 :         pCurrRedline = 0;
     759                 :            : 
     760         [ #  # ]:          0 :     for (sal_uInt16 i = nStart; i <= nEnd; i++)
     761                 :            :     {
     762         [ #  # ]:          0 :         const SwRedline& rRedln = pSh->GetRedline(i);
     763         [ #  # ]:          0 :         const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
     764                 :            : 
     765 [ #  # ][ #  # ]:          0 :         pRedlineParent = new SwRedlineDataParent;
     766                 :          0 :         pRedlineParent->pData    = pRedlineData;
     767                 :          0 :         pRedlineParent->pNext    = 0;
     768 [ #  # ][ #  # ]:          0 :         String sComment(rRedln.GetComment());
     769         [ #  # ]:          0 :         sComment.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' ');
     770         [ #  # ]:          0 :         pRedlineParent->sComment = sComment;
     771 [ #  # ][ #  # ]:          0 :         aRedlineParents.insert(aRedlineParents.begin() + i, pRedlineParent);
                 [ #  # ]
     772                 :            : 
     773 [ #  # ][ #  # ]:          0 :         pData = new RedlinData;
     774                 :          0 :         pData->pData = pRedlineParent;
     775                 :          0 :         pData->bDisabled = sal_False;
     776                 :            : 
     777 [ #  # ][ #  # ]:          0 :         sParent = GetRedlineText(rRedln, pData->aDateTime);
                 [ #  # ]
     778         [ #  # ]:          0 :         pParent = pTable->InsertEntry(sParent, pData, 0, i);
     779         [ #  # ]:          0 :         if( pCurrRedline == &rRedln )
     780                 :            :         {
     781         [ #  # ]:          0 :             pTable->SetCurEntry( pParent );
     782         [ #  # ]:          0 :             pTable->Select( pParent );
     783         [ #  # ]:          0 :             pTable->MakeVisible( pParent );
     784                 :            :         }
     785                 :            : 
     786                 :          0 :         pRedlineParent->pTLBParent = pParent;
     787                 :            : 
     788         [ #  # ]:          0 :         InsertChildren(pRedlineParent, rRedln, nAutoFmt);
     789 [ #  # ][ #  # ]:          0 :     }
                 [ #  # ]
     790                 :            : }
     791                 :            : 
     792                 :          0 : void SwRedlineAcceptDlg::CallAcceptReject( sal_Bool bSelect, sal_Bool bAccept )
     793                 :            : {
     794         [ #  # ]:          0 :     SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
     795 [ #  # ][ #  # ]:          0 :     SvLBoxEntry* pEntry = bSelect ? pTable->FirstSelected() : pTable->First();
                 [ #  # ]
     796                 :          0 :     sal_uLong nPos = LONG_MAX;
     797                 :            : 
     798                 :            :     typedef std::vector<SvLBoxEntry*> ListBoxEntries_t;
     799         [ #  # ]:          0 :     ListBoxEntries_t aRedlines;
     800                 :            : 
     801                 :            :     // don't activate
     802                 :            :     OSL_ENSURE( bInhibitActivate == false,
     803                 :            :                 "recursive call of CallAcceptReject?");
     804                 :          0 :     bInhibitActivate = true;
     805                 :            : 
     806                 :            :     // collect redlines-to-be-accepted/rejected in aRedlines vector
     807         [ #  # ]:          0 :     while( pEntry )
     808                 :            :     {
     809 [ #  # ][ #  # ]:          0 :         if( !pTable->GetParent( pEntry ) )
     810                 :            :         {
     811 [ #  # ][ #  # ]:          0 :             if( bSelect && LONG_MAX == nPos )
     812         [ #  # ]:          0 :                 nPos = pTable->GetModel()->GetAbsPos( pEntry );
     813                 :            : 
     814                 :          0 :             RedlinData *pData = (RedlinData *)pEntry->GetUserData();
     815                 :            : 
     816         [ #  # ]:          0 :             if( !pData->bDisabled )
     817         [ #  # ]:          0 :                 aRedlines.push_back( pEntry );
     818                 :            :         }
     819                 :            : 
     820 [ #  # ][ #  # ]:          0 :         pEntry = bSelect ? pTable->NextSelected(pEntry) : pTable->Next(pEntry);
                 [ #  # ]
     821                 :            :     }
     822                 :            : 
     823                 :          0 :     sal_Bool (SwEditShell:: *FnAccRej)( sal_uInt16 ) = &SwEditShell::AcceptRedline;
     824         [ #  # ]:          0 :     if( !bAccept )
     825                 :          0 :         FnAccRej = &SwEditShell::RejectRedline;
     826                 :            : 
     827 [ #  # ][ #  # ]:          0 :     SwWait aWait( *pSh->GetView().GetDocShell(), sal_True );
     828         [ #  # ]:          0 :     pSh->StartAction();
     829                 :            : 
     830                 :            :     // #111827#
     831         [ #  # ]:          0 :     if (aRedlines.size() > 1)
     832                 :            :     {
     833         [ #  # ]:          0 :         String aTmpStr;
     834                 :            :         {
     835         [ #  # ]:          0 :             SwRewriter aRewriter;
     836                 :            :             aRewriter.AddRule(UndoArg1,
     837 [ #  # ][ #  # ]:          0 :                               String::CreateFromInt32(aRedlines.size()));
                 [ #  # ]
     838 [ #  # ][ #  # ]:          0 :             aTmpStr = aRewriter.Apply(String(SW_RES(STR_N_REDLINES)));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     839                 :            :         }
     840                 :            : 
     841         [ #  # ]:          0 :         SwRewriter aRewriter;
     842         [ #  # ]:          0 :         aRewriter.AddRule(UndoArg1, aTmpStr);
     843                 :            : 
     844                 :            :         pSh->StartUndo(bAccept? UNDO_ACCEPT_REDLINE : UNDO_REJECT_REDLINE,
     845 [ #  # ][ #  # ]:          0 :                        &aRewriter);
         [ #  # ][ #  # ]
     846                 :            :     }
     847                 :            : 
     848                 :            :     // accept/reject the the redlines in aRedlines. The absolute
     849                 :            :     // position may change during the process (e.g. when two redlines
     850                 :            :     // are merged in result of another one being deleted), so the
     851                 :            :     // position must be resolved late and checked before using it.
     852                 :            :     // (cf #102547#)
     853                 :          0 :     ListBoxEntries_t::iterator aEnd = aRedlines.end();
     854 [ #  # ][ #  # ]:          0 :     for( ListBoxEntries_t::iterator aIter = aRedlines.begin();
                 [ #  # ]
     855                 :            :          aIter != aEnd;
     856                 :            :          ++aIter )
     857                 :            :     {
     858 [ #  # ][ #  # ]:          0 :         sal_uInt16 nPosition = GetRedlinePos( **aIter );
     859         [ #  # ]:          0 :         if( nPosition != USHRT_MAX )
     860 [ #  # ][ #  # ]:          0 :             (pSh->*FnAccRej)( nPosition );
     861                 :            :     }
     862                 :            : 
     863                 :            :     // #111827#
     864         [ #  # ]:          0 :     if (aRedlines.size() > 1)
     865                 :            :     {
     866         [ #  # ]:          0 :         pSh->EndUndo();
     867                 :            :     }
     868                 :            : 
     869         [ #  # ]:          0 :     pSh->EndAction();
     870                 :            : 
     871                 :          0 :     bInhibitActivate = false;
     872         [ #  # ]:          0 :     Activate();
     873                 :            : 
     874 [ #  # ][ #  # ]:          0 :     if( ULONG_MAX != nPos && pTable->GetEntryCount() )
                 [ #  # ]
     875                 :            :     {
     876         [ #  # ]:          0 :         if( nPos >= pTable->GetEntryCount() )
     877                 :          0 :             nPos = pTable->GetEntryCount() - 1;
     878         [ #  # ]:          0 :         pEntry = pTable->GetEntry( nPos );
     879 [ #  # ][ #  # ]:          0 :         if( !pEntry && nPos-- )
                 [ #  # ]
     880         [ #  # ]:          0 :             pEntry = pTable->GetEntry( nPos );
     881         [ #  # ]:          0 :         if( pEntry )
     882                 :            :         {
     883         [ #  # ]:          0 :             pTable->Select( pEntry );
     884         [ #  # ]:          0 :             pTable->MakeVisible( pEntry );
     885         [ #  # ]:          0 :             pTable->SetCurEntry(pEntry);
     886                 :            :         }
     887                 :            :     }
     888 [ #  # ][ #  # ]:          0 :     pTPView->EnableUndo();
     889                 :          0 : }
     890                 :            : 
     891                 :          0 : sal_uInt16 SwRedlineAcceptDlg::GetRedlinePos( const SvLBoxEntry& rEntry ) const
     892                 :            : {
     893                 :          0 :     SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
     894                 :            :     return pSh->FindRedlineOfData( *((SwRedlineDataParent*)((RedlinData *)
     895                 :          0 :                                     rEntry.GetUserData())->pData)->pData );
     896                 :            : }
     897                 :            : 
     898                 :          0 : IMPL_LINK_NOARG(SwRedlineAcceptDlg, AcceptHdl)
     899                 :            : {
     900                 :          0 :     CallAcceptReject( sal_True, sal_True );
     901                 :          0 :     return 0;
     902                 :            : }
     903                 :            : 
     904                 :          0 : IMPL_LINK_NOARG(SwRedlineAcceptDlg, AcceptAllHdl)
     905                 :            : {
     906                 :          0 :     CallAcceptReject( sal_False, sal_True );
     907                 :          0 :     return 0;
     908                 :            : }
     909                 :            : 
     910                 :          0 : IMPL_LINK_NOARG(SwRedlineAcceptDlg, RejectHdl)
     911                 :            : {
     912                 :          0 :     CallAcceptReject( sal_True, sal_False );
     913                 :          0 :     return 0;
     914                 :            : }
     915                 :            : 
     916                 :          0 : IMPL_LINK_NOARG(SwRedlineAcceptDlg, RejectAllHdl)
     917                 :            : {
     918                 :          0 :     CallAcceptReject( sal_False, sal_False );
     919                 :          0 :     return 0;
     920                 :            : }
     921                 :            : 
     922                 :          0 : IMPL_LINK_NOARG(SwRedlineAcceptDlg, UndoHdl)
     923                 :            : {
     924                 :          0 :     SwView * pView = ::GetActiveView();
     925                 :            :     pView->GetViewFrame()->GetDispatcher()->
     926                 :          0 :                 Execute(SID_UNDO, SFX_CALLMODE_SYNCHRON);
     927                 :          0 :     pTPView->EnableUndo(pView->GetSlotState(SID_UNDO) != 0);
     928                 :            : 
     929                 :          0 :     Activate();
     930                 :            : 
     931                 :          0 :     return 0;
     932                 :            : }
     933                 :            : 
     934                 :          0 : IMPL_LINK_NOARG(SwRedlineAcceptDlg, FilterChangedHdl)
     935                 :            : {
     936                 :          0 :     SvxTPFilter *pFilterTP = aTabPagesCTRL.GetFilterPage();
     937                 :            : 
     938         [ #  # ]:          0 :     if (pFilterTP->IsAction())
     939         [ #  # ]:          0 :         sFilterAction = pFilterTP->GetLbAction()->GetSelectEntry();
     940                 :            :     else
     941                 :          0 :         sFilterAction = aEmptyStr;
     942                 :            : 
     943                 :          0 :     Init();
     944                 :            : 
     945                 :          0 :     return 0;
     946                 :            : }
     947                 :            : 
     948                 :          0 : IMPL_LINK_NOARG(SwRedlineAcceptDlg, DeselectHdl)
     949                 :            : {
     950                 :            :     // avoid flickering of buttons:
     951                 :          0 :     aDeselectTimer.Start();
     952                 :            : 
     953                 :          0 :     return 0;
     954                 :            : }
     955                 :            : 
     956                 :          0 : IMPL_LINK_NOARG(SwRedlineAcceptDlg, SelectHdl)
     957                 :            : {
     958                 :          0 :     aDeselectTimer.Stop();
     959                 :          0 :     aSelectTimer.Start();
     960                 :            : 
     961                 :          0 :     return 0;
     962                 :            : }
     963                 :            : 
     964                 :          0 : IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl)
     965                 :            : {
     966                 :          0 :     SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
     967                 :          0 :     aSelectTimer.Stop();
     968                 :            : 
     969                 :          0 :     sal_Bool bIsNotFormated = sal_False;
     970                 :          0 :     sal_Bool bSel = sal_False;
     971                 :            : 
     972                 :            :     //#98883# don't select redlines while the dialog is not focussed
     973                 :            :     //#107938# But not only ask pTable if it has the focus. To move
     974                 :            :     //         the selection to the selected redline any child of pParentDlg
     975                 :            :     //         may the focus.
     976                 :          0 :     SvLBoxEntry* pSelEntry = 0;
     977                 :            : 
     978         [ #  # ]:          0 :     if (pParentDlg->HasChildPathFocus())
     979                 :          0 :         pSelEntry = pTable->FirstSelected();
     980                 :            : 
     981         [ #  # ]:          0 :     if( pSelEntry )
     982                 :            :     {
     983                 :          0 :         SvLBoxEntry* pActEntry = pSelEntry;
     984                 :          0 :         pSh->StartAction();
     985                 :          0 :         pSh->EnterStdMode();
     986                 :          0 :         pSh->SetCareWin(pParentDlg);
     987                 :            : 
     988         [ #  # ]:          0 :         while (pSelEntry)
     989                 :            :         {
     990         [ #  # ]:          0 :             if (pTable->GetParent(pSelEntry))
     991                 :            :             {
     992                 :          0 :                 pActEntry = pTable->GetParent(pSelEntry);
     993                 :            : 
     994         [ #  # ]:          0 :                 if (pTable->IsSelected(pActEntry))
     995                 :            :                 {
     996                 :          0 :                     pSelEntry = pActEntry = pTable->NextSelected(pSelEntry);
     997                 :          0 :                     continue;   // don't select twice
     998                 :            :                 }
     999                 :            :             }
    1000                 :            :             else
    1001                 :          0 :                 bSel = sal_True;
    1002                 :            : 
    1003                 :            :             // #98864# find the selected redline (ignore, if the redline is already gone)
    1004                 :          0 :             sal_uInt16 nPos = GetRedlinePos(*pActEntry);
    1005         [ #  # ]:          0 :             if( nPos != USHRT_MAX )
    1006                 :            :             {
    1007                 :            : 
    1008                 :          0 :                 const SwRedline& rRedln = pSh->GetRedline( nPos );
    1009                 :          0 :                 bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType();
    1010                 :            : 
    1011         [ #  # ]:          0 :                 if (pSh->GotoRedline(nPos, sal_True))
    1012                 :            :                 {
    1013                 :          0 :                     pSh->SetInSelect();
    1014                 :          0 :                     pSh->EnterAddMode();
    1015                 :            :                 }
    1016                 :            :             }
    1017                 :            : 
    1018                 :          0 :             pSelEntry = pActEntry = pTable->NextSelected(pSelEntry);
    1019                 :            :         }
    1020                 :            : 
    1021                 :          0 :         pSh->LeaveAddMode();
    1022                 :          0 :         pSh->EndAction();
    1023                 :          0 :         pSh->SetCareWin(NULL);
    1024                 :            :     }
    1025                 :          0 :     sal_Bool bEnable = !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength();
    1026 [ #  # ][ #  # ]:          0 :     pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ );
    1027 [ #  # ][ #  # ]:          0 :     pTPView->EnableReject( bEnable && bSel && bIsNotFormated /*&& !bReadonlySel*/ );
                 [ #  # ]
    1028 [ #  # ][ #  # ]:          0 :     pTPView->EnableRejectAll( bEnable && !bOnlyFormatedRedlines && !bHasReadonlySel );
                 [ #  # ]
    1029                 :            : 
    1030                 :          0 :     return 0;
    1031                 :            : }
    1032                 :            : 
    1033                 :          0 : IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl)
    1034                 :            : {
    1035         [ #  # ]:          0 :     const CommandEvent aCEvt(pTable->GetCommandEvent());
    1036                 :            : 
    1037         [ #  # ]:          0 :     switch ( aCEvt.GetCommand() )
    1038                 :            :     {
    1039                 :            :         case COMMAND_CONTEXTMENU:
    1040                 :            :         {
    1041         [ #  # ]:          0 :             SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
    1042         [ #  # ]:          0 :             SvLBoxEntry* pEntry = pTable->FirstSelected();
    1043                 :          0 :             const SwRedline *pRed = 0;
    1044                 :            : 
    1045         [ #  # ]:          0 :             if (pEntry)
    1046                 :            :             {
    1047                 :          0 :                 SvLBoxEntry* pTopEntry = pEntry;
    1048                 :            : 
    1049 [ #  # ][ #  # ]:          0 :                 if (pTable->GetParent(pEntry))
    1050         [ #  # ]:          0 :                     pTopEntry = pTable->GetParent(pEntry);
    1051                 :            : 
    1052         [ #  # ]:          0 :                 sal_uInt16 nPos = GetRedlinePos(*pTopEntry);
    1053                 :            : 
    1054                 :            :                 // disable commenting for protected areas
    1055 [ #  # ][ #  # ]:          0 :                 if ((pRed = pSh->GotoRedline(nPos, sal_True)) != 0)
    1056                 :            :                 {
    1057 [ #  # ][ #  # ]:          0 :                     if( pSh->IsCrsrPtAtEnd() )
    1058         [ #  # ]:          0 :                         pSh->SwapPam();
    1059                 :          0 :                     pSh->SetInSelect();
    1060                 :            :                 }
    1061                 :            :             }
    1062                 :            : 
    1063                 :            :             aPopup.EnableItem( MN_EDIT_COMMENT, pEntry && pRed &&
    1064         [ #  # ]:          0 :                                             !pTable->GetParent(pEntry) &&
    1065         [ #  # ]:          0 :                                             !pTable->NextSelected(pEntry)
    1066                 :            : //JP 27.9.2001: make no sense if we handle readonly sections
    1067                 :            : //                                          && pRed->HasReadonlySel()
    1068 [ #  # ][ #  # ]:          0 :                                             );
         [ #  # ][ #  # ]
                 [ #  # ]
    1069                 :            : 
    1070 [ #  # ][ #  # ]:          0 :             aPopup.EnableItem( MN_SUB_SORT, pTable->First() != 0 );
    1071                 :          0 :             sal_uInt16 nColumn = pTable->GetSortedCol();
    1072         [ #  # ]:          0 :             if (nColumn == 0xffff)
    1073                 :          0 :                 nColumn = 4;
    1074                 :            : 
    1075         [ #  # ]:          0 :             PopupMenu *pSubMenu = aPopup.GetPopupMenu(MN_SUB_SORT);
    1076         [ #  # ]:          0 :             if (pSubMenu)
    1077                 :            :             {
    1078         [ #  # ]:          0 :                 for (sal_uInt16 i = MN_SORT_ACTION; i < MN_SORT_ACTION + 5; i++)
    1079         [ #  # ]:          0 :                     pSubMenu->CheckItem(i, sal_False);
    1080                 :            : 
    1081         [ #  # ]:          0 :                 pSubMenu->CheckItem(nColumn + MN_SORT_ACTION);
    1082                 :            :             }
    1083                 :            : 
    1084         [ #  # ]:          0 :             sal_uInt16 nRet = aPopup.Execute(pTable, aCEvt.GetMousePosPixel());
    1085                 :            : 
    1086      [ #  #  # ]:          0 :             switch( nRet )
    1087                 :            :             {
    1088                 :            :                 case MN_EDIT_COMMENT:
    1089                 :            :                 {
    1090         [ #  # ]:          0 :                     if (pEntry)
    1091                 :            :                     {
    1092 [ #  # ][ #  # ]:          0 :                         if (pTable->GetParent(pEntry))
    1093         [ #  # ]:          0 :                             pEntry = pTable->GetParent(pEntry);
    1094                 :            : 
    1095         [ #  # ]:          0 :                         sal_uInt16 nPos = GetRedlinePos(*pEntry);
    1096         [ #  # ]:          0 :                         const SwRedline &rRedline = pSh->GetRedline(nPos);
    1097                 :            : 
    1098                 :            : 
    1099                 :            :                         /* enable again once we have redline comments in the margin
    1100                 :            :                         sComment = rRedline.GetComment();
    1101                 :            :                         if ( !sComment.Len() )
    1102                 :            :                             GetActiveView()->GetDocShell()->Broadcast(SwRedlineHint(&rRedline,SWREDLINE_INSERTED));
    1103                 :            :                         const_cast<SwRedline&>(rRedline).Broadcast(SwRedlineHint(&rRedline,SWREDLINE_FOCUS));
    1104                 :            :                         */
    1105                 :            : 
    1106 [ #  # ][ #  # ]:          0 :                         rtl::OUString sComment = convertLineEnd(rRedline.GetComment(), GetSystemLineEnd());
                 [ #  # ]
    1107         [ #  # ]:          0 :                         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
    1108                 :            :                         OSL_ENSURE(pFact, "Dialogdiet fail!");
    1109         [ #  # ]:          0 :                         ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc( RID_SVXDLG_POSTIT );
    1110                 :            :                         OSL_ENSURE(fnGetRange, "Dialogdiet fail! GetRanges()");
    1111 [ #  # ][ #  # ]:          0 :                         SfxItemSet aSet( pSh->GetAttrPool(), fnGetRange() );
                 [ #  # ]
    1112                 :            : 
    1113 [ #  # ][ #  # ]:          0 :                         aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
         [ #  # ][ #  # ]
                 [ #  # ]
    1114 [ #  # ][ #  # ]:          0 :                         aSet.Put(SvxPostItAuthorItem(rRedline.GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
         [ #  # ][ #  # ]
    1115                 :            : 
    1116                 :            :                         aSet.Put(SvxPostItDateItem( GetAppLangDateTimeString(
    1117         [ #  # ]:          0 :                                     rRedline.GetRedlineData().GetTimeStamp() ),
    1118 [ #  # ][ #  # ]:          0 :                                     SID_ATTR_POSTIT_DATE ));
         [ #  # ][ #  # ]
                 [ #  # ]
    1119                 :            : 
    1120         [ #  # ]:          0 :                         AbstractSvxPostItDialog* pDlg = pFact->CreateSvxPostItDialog( pParentDlg, aSet, sal_False );
    1121                 :            :                         OSL_ENSURE(pDlg, "Dialogdiet fail!");
    1122                 :            : 
    1123         [ #  # ]:          0 :                         pDlg->HideAuthor();
    1124                 :            : 
    1125                 :          0 :                         sal_uInt16 nResId = 0;
    1126 [ #  # ][ #  #  :          0 :                         switch( rRedline.GetType() )
                #  #  # ]
    1127                 :            :                         {
    1128                 :            :                         case nsRedlineType_t::REDLINE_INSERT:
    1129                 :          0 :                             nResId = STR_REDLINE_INSERTED;
    1130                 :          0 :                             break;
    1131                 :            :                         case nsRedlineType_t::REDLINE_DELETE:
    1132                 :          0 :                             nResId = STR_REDLINE_DELETED;
    1133                 :          0 :                             break;
    1134                 :            :                         case nsRedlineType_t::REDLINE_FORMAT:
    1135                 :          0 :                             nResId = STR_REDLINE_FORMATED;
    1136                 :          0 :                             break;
    1137                 :            :                         case nsRedlineType_t::REDLINE_TABLE:
    1138                 :          0 :                             nResId = STR_REDLINE_TABLECHG;
    1139                 :          0 :                             break;
    1140                 :            :                         default:;//prevent warning
    1141                 :            :                         }
    1142         [ #  # ]:          0 :                         String sTitle(SW_RES(STR_REDLINE_COMMENT));
    1143         [ #  # ]:          0 :                         if( nResId )
    1144 [ #  # ][ #  # ]:          0 :                             sTitle += SW_RESSTR( nResId );
    1145         [ #  # ]:          0 :                         pDlg->SetText(sTitle);
    1146                 :            : 
    1147 [ #  # ][ #  # ]:          0 :                         pSh->SetCareWin(pDlg->GetWindow());
    1148                 :            : 
    1149 [ #  # ][ #  # ]:          0 :                         if ( pDlg->Execute() == RET_OK )
    1150                 :            :                         {
    1151         [ #  # ]:          0 :                             const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
    1152 [ #  # ][ #  # ]:          0 :                             String sMsg(((const SvxPostItTextItem&)pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue());
    1153                 :            : 
    1154                 :            :                             // insert / change comment
    1155         [ #  # ]:          0 :                             pSh->SetRedlineComment(sMsg);
    1156         [ #  # ]:          0 :                             sMsg.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' ');
    1157 [ #  # ][ #  # ]:          0 :                             pTable->SetEntryText(sMsg, pEntry, 3);
    1158                 :            :                         }
    1159                 :            : 
    1160 [ #  # ][ #  # ]:          0 :                         delete pDlg;
    1161 [ #  # ][ #  # ]:          0 :                         pSh->SetCareWin(NULL);
                 [ #  # ]
    1162                 :            :                     }
    1163                 :            : 
    1164                 :            :                 }
    1165                 :          0 :                 break;
    1166                 :            : 
    1167                 :            :             case MN_SORT_ACTION:
    1168                 :            :             case MN_SORT_AUTHOR:
    1169                 :            :             case MN_SORT_DATE:
    1170                 :            :             case MN_SORT_COMMENT:
    1171                 :            :             case MN_SORT_POSITION:
    1172                 :            :                 {
    1173                 :          0 :                     bSortDir = sal_True;
    1174 [ #  # ][ #  # ]:          0 :                     if (nRet - MN_SORT_ACTION == 4 && pTable->GetSortedCol() == 0xffff)
                 [ #  # ]
    1175                 :            :                         break;  // we already have it
    1176                 :            : 
    1177                 :          0 :                     nSortMode = nRet - MN_SORT_ACTION;
    1178         [ #  # ]:          0 :                     if (nSortMode == 4)
    1179                 :          0 :                         nSortMode = 0xffff; // unsorted / sorted by position
    1180                 :            : 
    1181         [ #  # ]:          0 :                     if (pTable->GetSortedCol() == nSortMode)
    1182                 :          0 :                         bSortDir = !pTable->GetSortDirection();
    1183                 :            : 
    1184 [ #  # ][ #  # ]:          0 :                     SwWait aWait( *::GetActiveView()->GetDocShell(), sal_False );
                 [ #  # ]
    1185         [ #  # ]:          0 :                     pTable->SortByCol(nSortMode, bSortDir);
    1186         [ #  # ]:          0 :                     if (nSortMode == 0xffff)
    1187 [ #  # ][ #  # ]:          0 :                         Init();             // newly fill everything
    1188                 :            :                 }
    1189                 :          0 :                 break;
    1190                 :            :             }
    1191                 :            :         }
    1192                 :          0 :         break;
    1193                 :            :     }
    1194                 :            : 
    1195                 :          0 :     return 0;
    1196                 :            : }
    1197                 :            : 
    1198                 :          0 : void SwRedlineAcceptDlg::Initialize(const String& rExtraData)
    1199                 :            : {
    1200         [ #  # ]:          0 :     if (rExtraData.Len())
    1201                 :            :     {
    1202 [ #  # ][ #  # ]:          0 :         sal_uInt16 nPos = rExtraData.Search(rtl::OUString("AcceptChgDat:"));
                 [ #  # ]
    1203                 :            : 
    1204                 :            :         // try to read the alignment string "ALIGN:(...)"; if none existing,
    1205                 :            :         // it's an old version
    1206         [ #  # ]:          0 :         if (nPos != STRING_NOTFOUND)
    1207                 :            :         {
    1208                 :          0 :             sal_uInt16 n1 = rExtraData.Search('(', nPos);
    1209         [ #  # ]:          0 :             if (n1 != STRING_NOTFOUND)
    1210                 :            :             {
    1211                 :          0 :                 sal_uInt16 n2 = rExtraData.Search(')', n1);
    1212         [ #  # ]:          0 :                 if (n2 != STRING_NOTFOUND)
    1213                 :            :                 {
    1214                 :            :                     // cut out the alignment string
    1215         [ #  # ]:          0 :                     String aStr = rExtraData.Copy(nPos, n2 - nPos + 1);
    1216         [ #  # ]:          0 :                     aStr.Erase(0, n1 - nPos + 1);
    1217                 :            : 
    1218         [ #  # ]:          0 :                     if (aStr.Len())
    1219                 :            :                     {
    1220         [ #  # ]:          0 :                         sal_uInt16 nCount = static_cast< sal_uInt16 >(aStr.ToInt32());
    1221                 :            : 
    1222         [ #  # ]:          0 :                         for (sal_uInt16 i = 0; i < nCount; i++)
    1223                 :            :                         {
    1224         [ #  # ]:          0 :                             sal_uInt16 n3 = aStr.Search(';');
    1225         [ #  # ]:          0 :                             aStr.Erase(0, n3 + 1);
    1226 [ #  # ][ #  # ]:          0 :                             pTable->SetTab(i, aStr.ToInt32(), MAP_PIXEL);
    1227                 :            :                         }
    1228         [ #  # ]:          0 :                     }
    1229                 :            :                 }
    1230                 :            :             }
    1231                 :            :         }
    1232                 :            :     }
    1233                 :          0 : }
    1234                 :            : 
    1235                 :          0 : void SwRedlineAcceptDlg::FillInfo(String &rExtraData) const
    1236                 :            : {
    1237                 :          0 :     rExtraData.AppendAscii("AcceptChgDat:(");
    1238                 :            : 
    1239                 :          0 :     sal_uInt16  nCount = pTable->TabCount();
    1240                 :            : 
    1241         [ #  # ]:          0 :     rExtraData += String::CreateFromInt32(nCount);
    1242                 :          0 :     rExtraData += ';';
    1243         [ #  # ]:          0 :     for(sal_uInt16 i = 0; i < nCount; i++)
    1244                 :            :     {
    1245         [ #  # ]:          0 :         rExtraData += String::CreateFromInt32( pTable->GetTab(i) );
    1246                 :          0 :         rExtraData += ';';
    1247                 :            :     }
    1248                 :          0 :     rExtraData += ')';
    1249                 :          0 : }
    1250                 :            : 
    1251                 :            : 
    1252                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10