LCOV - code coverage report
Current view: top level - sw/source/ui/docvw - edtwin.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 111 2937 3.8 %
Date: 2012-08-25 Functions: 15 74 20.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 112 5836 1.9 %

           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                 :            : 
      30                 :            : #include <swtypes.hxx>
      31                 :            : #include <hintids.hxx>
      32                 :            : #include <com/sun/star/accessibility/XAccessible.hpp>
      33                 :            : #include <comphelper/processfactory.hxx>
      34                 :            : #include <com/sun/star/i18n/XBreakIterator.hpp>
      35                 :            : #include <com/sun/star/i18n/ScriptType.hpp>
      36                 :            : #include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
      37                 :            : 
      38                 :            : #include <com/sun/star/i18n/UnicodeScript.hpp>
      39                 :            : 
      40                 :            : #include <vcl/help.hxx>
      41                 :            : #include <vcl/graph.hxx>
      42                 :            : #include <vcl/msgbox.hxx>
      43                 :            : #include <vcl/cmdevt.h>
      44                 :            : #include <sot/storage.hxx>
      45                 :            : #include <svl/macitem.hxx>
      46                 :            : #include <unotools/securityoptions.hxx>
      47                 :            : #include <basic/sbxvar.hxx>
      48                 :            : #include <svl/ctloptions.hxx>
      49                 :            : #include <basic/sbx.hxx>
      50                 :            : #include <svl/eitem.hxx>
      51                 :            : #include <svl/stritem.hxx>
      52                 :            : #include <sfx2/ipclient.hxx>
      53                 :            : #include <sfx2/viewfrm.hxx>
      54                 :            : #include <sfx2/request.hxx>
      55                 :            : #include <sfx2/bindings.hxx>
      56                 :            : #include <sfx2/dispatch.hxx>
      57                 :            : #include <svl/ptitem.hxx>
      58                 :            : #include <editeng/sizeitem.hxx>
      59                 :            : #include <editeng/langitem.hxx>
      60                 :            : #include <svx/htmlmode.hxx>
      61                 :            : #include <svx/svdview.hxx>
      62                 :            : #include <svx/svdhdl.hxx>
      63                 :            : #include <svx/svdoutl.hxx>
      64                 :            : #include <editeng/editeng.hxx>
      65                 :            : #include <editeng/svxacorr.hxx>
      66                 :            : #include <editeng/scripttypeitem.hxx>
      67                 :            : #include <editeng/flditem.hxx>
      68                 :            : #include <editeng/colritem.hxx>
      69                 :            : #include <editeng/brshitem.hxx>
      70                 :            : #include <editeng/wghtitem.hxx>
      71                 :            : #include <editeng/udlnitem.hxx>
      72                 :            : #include <editeng/postitem.hxx>
      73                 :            : #include <editeng/protitem.hxx>
      74                 :            : #include <unotools/charclass.hxx>
      75                 :            : #include <basegfx/color/bcolortools.hxx>
      76                 :            : #include <basegfx/polygon/b2dpolygon.hxx>
      77                 :            : 
      78                 :            : #include <editeng/acorrcfg.hxx>
      79                 :            : #include <SwSmartTagMgr.hxx>
      80                 :            : #include <edtwin.hxx>
      81                 :            : #include <view.hxx>
      82                 :            : #include <wrtsh.hxx>
      83                 :            : #include <IDocumentSettingAccess.hxx>
      84                 :            : #include <fldbas.hxx>
      85                 :            : #include <swmodule.hxx>
      86                 :            : #include <docsh.hxx>
      87                 :            : #include <viewopt.hxx>
      88                 :            : #include <drawbase.hxx>
      89                 :            : #include <dselect.hxx>
      90                 :            : #include <textsh.hxx>
      91                 :            : #include <shdwcrsr.hxx>
      92                 :            : #include <fmtanchr.hxx>
      93                 :            : #include <fmtornt.hxx>
      94                 :            : #include <fmtfsize.hxx>
      95                 :            : #include <fmtclds.hxx>
      96                 :            : #include <fmthdft.hxx>
      97                 :            : #include <frmfmt.hxx>
      98                 :            : #include <modcfg.hxx>
      99                 :            : #include <fmtcol.hxx>
     100                 :            : #include <wview.hxx>
     101                 :            : #include <listsh.hxx>
     102                 :            : #include <gloslst.hxx>
     103                 :            : #include <inputwin.hxx>
     104                 :            : #include <gloshdl.hxx>
     105                 :            : #include <swundo.hxx>
     106                 :            : #include <drwtxtsh.hxx>
     107                 :            : #include <fchrfmt.hxx>
     108                 :            : #include <fmturl.hxx>
     109                 :            : #include <romenu.hxx>
     110                 :            : #include <initui.hxx>
     111                 :            : #include <frmatr.hxx>
     112                 :            : #include <extinput.hxx>
     113                 :            : #include <acmplwrd.hxx>
     114                 :            : #include <swcalwrp.hxx>
     115                 :            : #include <swdtflvr.hxx>
     116                 :            : #include <wdocsh.hxx>
     117                 :            : #include <crsskip.hxx>
     118                 :            : #include <breakit.hxx>
     119                 :            : #include <checkit.hxx>
     120                 :            : #include <pagefrm.hxx>
     121                 :            : #include <HeaderFooterWin.hxx>
     122                 :            : 
     123                 :            : #include <helpid.h>
     124                 :            : #include <cmdid.h>
     125                 :            : #include <docvw.hrc>
     126                 :            : #include <uitool.hxx>
     127                 :            : #include <fmtfollowtextflow.hxx>
     128                 :            : #include <toolkit/helper/vclunohelper.hxx>
     129                 :            : #include <charfmt.hxx>
     130                 :            : #include <numrule.hxx>
     131                 :            : #include <pagedesc.hxx>
     132                 :            : #include <svtools/ruler.hxx>
     133                 :            : #include "formatclipboard.hxx"
     134                 :            : #include <osl/mutex.hxx>
     135                 :            : #include <vcl/svapp.hxx>
     136                 :            : #include <docstat.hxx>
     137                 :            : #include <wordcountdialog.hxx>
     138                 :            : #include <swwait.hxx>
     139                 :            : 
     140                 :            : #include <IMark.hxx>
     141                 :            : #include <doc.hxx>
     142                 :            : #include <xmloff/odffields.hxx>
     143                 :            : 
     144                 :            : #include <PostItMgr.hxx>
     145                 :            : 
     146                 :            : #include <algorithm>
     147                 :            : #include <vector>
     148                 :            : 
     149                 :            : #include "../../core/inc/rootfrm.hxx"
     150                 :            : 
     151                 :            : using namespace sw::mark;
     152                 :            : using namespace ::com::sun::star;
     153                 :            : 
     154                 :            : /*--------------------------------------------------------------------
     155                 :            :     Description:   Globals
     156                 :            :  --------------------------------------------------------------------*/
     157                 :            : 
     158                 :            : static bool bInputLanguageSwitched = false;
     159                 :            : extern sal_Bool bNoInterrupt;       // in mainwn.cxx
     160                 :            : 
     161                 :            : // Usually in MouseButtonUp a selection is revoked when the selection is
     162                 :            : // not currently being pulled open. Unfortunately in MouseButtonDown there
     163                 :            : // is being selected at double/triple click. That selection is completely
     164                 :            : // finished in the Handler and thus can't be distinguished in the Up.
     165                 :            : // To resolve this bHoldSelection is set in Down at evaluated in Up.
     166                 :            : static sal_Bool bHoldSelection      = sal_False;
     167                 :            : 
     168                 :            : sal_Bool bFrmDrag                   = sal_False;
     169                 :            : sal_Bool bValidCrsrPos              = sal_False;
     170                 :            : sal_Bool bModePushed                = sal_False;
     171                 :            : sal_Bool bDDTimerStarted            = sal_False;
     172                 :            : sal_Bool bFlushCharBuffer           = sal_False;
     173                 :            : sal_Bool SwEditWin::bReplaceQuote   = sal_False;
     174                 :            : sal_Bool bDDINetAttr                = sal_False;
     175                 :            : SdrHdlKind eSdrMoveHdl          = HDL_USER;
     176                 :            : 
     177                 :            : QuickHelpData* SwEditWin::pQuickHlpData = 0;
     178                 :            : 
     179                 :            : long    SwEditWin::nDDStartPosY = 0;
     180                 :            : long    SwEditWin::nDDStartPosX = 0;
     181                 :            : /* Note:
     182                 :            :    The initial color shown on the button is set in /core/svx/source/tbxctrls/tbxcolorupdate.cxx
     183                 :            :    (ToolboxButtonColorUpdater::ToolboxButtonColorUpdater()) .
     184                 :            :    The initial color used by the button is set in /core/svx/source/tbxcntrls/tbcontrl.cxx
     185                 :            :    (SvxColorExtToolBoxControl::SvxColorExtToolBoxControl())
     186                 :            :    and in case of writer for text(background)color also in /core/sw/source/ui/docvw/edtwin.cxx
     187                 :            :    (SwEditWin::aTextBackColor and SwEditWin::aTextBackColor)
     188                 :            :  */
     189                 :         73 : Color   SwEditWin::aTextBackColor(COL_YELLOW);
     190                 :         73 : Color   SwEditWin::aTextColor(COL_RED);
     191                 :            : sal_Bool SwEditWin::bTransparentBackColor = sal_False; // background not transparent
     192                 :            : 
     193                 :            : extern sal_Bool     bExecuteDrag;
     194                 :            : 
     195                 :            : SfxShell* lcl_GetShellFromDispatcher( SwView& rView, TypeId nType );
     196                 :            : 
     197                 :            : DBG_NAME(edithdl)
     198                 :            : 
     199                 :            : namespace
     200                 :            : {
     201                 :          0 :     static bool lcl_CheckHeaderFooterClick( SwWrtShell& rSh, const Point &rDocPos, sal_uInt16 nClicks )
     202                 :            :     {
     203                 :          0 :         bool bRet = false;
     204                 :            : 
     205                 :          0 :         sal_Bool bOverHdrFtr = rSh.IsOverHeaderFooterPos( rDocPos );
     206   [ #  #  #  # ]:          0 :         if ( ( rSh.IsHeaderFooterEdit( ) && !bOverHdrFtr ) ||
         [ #  # ][ #  # ]
                 [ #  # ]
     207                 :          0 :              ( !rSh.IsHeaderFooterEdit() && bOverHdrFtr ) )
     208                 :            :         {
     209                 :          0 :             bRet = true;
     210                 :            :             // Check if there we are in a FlyFrm
     211                 :          0 :             Point aPt( rDocPos );
     212 [ #  # ][ #  # ]:          0 :             SwPaM aPam( *rSh.GetCurrentShellCursor().GetPoint() );
     213 [ #  # ][ #  # ]:          0 :             rSh.GetLayout()->GetCrsrOfst( aPam.GetPoint(), aPt );
     214                 :            : 
     215         [ #  # ]:          0 :             const SwStartNode* pStartFly = aPam.GetPoint()->nNode.GetNode().FindFlyStartNode();
     216                 :          0 :             int nNbClicks = 1;
     217 [ #  # ][ #  # ]:          0 :             if ( pStartFly && !rSh.IsHeaderFooterEdit() )
                 [ #  # ]
     218                 :          0 :                 nNbClicks = 2;
     219                 :            : 
     220         [ #  # ]:          0 :             if ( nClicks == nNbClicks )
     221                 :            :             {
     222         [ #  # ]:          0 :                 rSh.SwCrsrShell::SetCrsr( rDocPos );
     223                 :          0 :                 bRet = false;
     224         [ #  # ]:          0 :             }
     225                 :            :         }
     226                 :          0 :         return bRet;
     227                 :            :     }
     228                 :            : }
     229                 :            : 
     230                 :            : class SwAnchorMarker
     231                 :            : {
     232                 :            :     SdrHdl* pHdl;
     233                 :            :     Point aHdlPos;
     234                 :            :     Point aLastPos;
     235                 :            :     bool bTopRightHandle;
     236                 :            : public:
     237                 :          0 :     SwAnchorMarker( SdrHdl* pH )
     238                 :            :         : pHdl( pH )
     239                 :          0 :         , aHdlPos( pH->GetPos() )
     240                 :          0 :         , aLastPos( pH->GetPos() )
     241                 :          0 :         , bTopRightHandle( pH->GetKind() == HDL_ANCHOR_TR )
     242                 :          0 :     {}
     243                 :          0 :     const Point& GetLastPos() const { return aLastPos; }
     244                 :          0 :     void SetLastPos( const Point& rNew ) { aLastPos = rNew; }
     245                 :          0 :     void SetPos( const Point& rNew ) { pHdl->SetPos( rNew ); }
     246                 :          0 :     const Point& GetPos() { return pHdl->GetPos(); }
     247                 :          0 :     const Point& GetHdlPos() { return aHdlPos; }
     248                 :          0 :     void ChgHdl( SdrHdl* pNew )
     249                 :            :     {
     250                 :          0 :         pHdl = pNew;
     251         [ #  # ]:          0 :         if ( pHdl )
     252                 :            :         {
     253                 :          0 :             bTopRightHandle = (pHdl->GetKind() == HDL_ANCHOR_TR);
     254                 :            :         }
     255                 :          0 :     }
     256                 :          0 :     const Point GetPosForHitTest( const OutputDevice& rOut )
     257                 :            :     {
     258                 :          0 :         Point aHitTestPos( GetPos() );
     259                 :          0 :         aHitTestPos = rOut.LogicToPixel( aHitTestPos );
     260         [ #  # ]:          0 :         if ( bTopRightHandle )
     261                 :            :         {
     262                 :          0 :             aHitTestPos += Point( -1, 1 );
     263                 :            :         }
     264                 :            :         else
     265                 :            :         {
     266                 :          0 :             aHitTestPos += Point( 1, 1 );
     267                 :            :         }
     268                 :          0 :         aHitTestPos = rOut.PixelToLogic( aHitTestPos );
     269                 :            : 
     270                 :          0 :         return aHitTestPos;
     271                 :            :     }
     272                 :            : };
     273                 :            : 
     274                 :            : /// Assists with auto-completion of AutoComplete words and AutoText names.
     275                 :         73 : struct QuickHelpData
     276                 :            : {
     277                 :            :     /// Strings that at least partially match an input word.
     278                 :            :     std::vector<String> m_aHelpStrings;
     279                 :            :     /// Index of the current help string.
     280                 :            :     sal_uInt16 nCurArrPos;
     281                 :            :     /// Length of the input word associated with the help data.
     282                 :            :     sal_uInt16 nLen;
     283                 :            : 
     284                 :            :     /// Help data stores AutoText names rather than AutoComplete words.
     285                 :            :     bool m_bIsAutoText;
     286                 :            :     /// Display help string as a tip rather than inline.
     287                 :            :     bool m_bIsTip;
     288                 :            :     /// Tip ID when a help string is displayed as a tip.
     289                 :            :     sal_uLong nTipId;
     290                 :            :     /// Append a space character to the displayed help string (if appropriate).
     291                 :            :     bool m_bAppendSpace;
     292                 :            : 
     293                 :            :     /// Help string is currently displayed.
     294                 :            :     bool m_bIsDisplayed;
     295                 :            : 
     296                 :         73 :     QuickHelpData() { ClearCntnt(); }
     297                 :            : 
     298                 :            :     void Move( QuickHelpData& rCpy );
     299                 :            :     void ClearCntnt();
     300                 :            :     void Start( SwWrtShell& rSh, sal_uInt16 nWrdLen );
     301                 :            :     void Stop( SwWrtShell& rSh );
     302                 :            : 
     303 [ #  # ][ #  # ]:          0 :     sal_Bool HasCntnt() const { return !m_aHelpStrings.empty() && 0 != nLen; }
     304                 :            : 
     305                 :            :     /// Next help string.
     306                 :          0 :     void Next( sal_Bool bEndLess )
     307                 :            :     {
     308         [ #  # ]:          0 :         if( ++nCurArrPos >= m_aHelpStrings.size() )
     309 [ #  # ][ #  # ]:          0 :             nCurArrPos = (bEndLess && !m_bIsAutoText ) ? 0 : nCurArrPos-1;
     310                 :          0 :     }
     311                 :            :     /// Previous help string.
     312                 :          0 :     void Previous( sal_Bool bEndLess )
     313                 :            :     {
     314         [ #  # ]:          0 :         if( 0 == nCurArrPos-- )
     315 [ #  # ][ #  # ]:          0 :             nCurArrPos = (bEndLess && !m_bIsAutoText ) ? m_aHelpStrings.size()-1 : 0;
     316                 :          0 :     }
     317                 :            :     void FillStrArr( SwWrtShell& rSh, const String& rWord );
     318                 :            :     void SortAndFilter();
     319                 :            : };
     320                 :            : 
     321                 :            : /*--------------------------------------------------------------------
     322                 :            :     Description:   avoid minimal movement shiver
     323                 :            :  --------------------------------------------------------------------*/
     324                 :            : 
     325                 :            : #define HIT_PIX  2 /* hit tolerance in pixel  */
     326                 :            : #define MIN_MOVE 4
     327                 :            : 
     328                 :          0 : inline sal_Bool IsMinMove(const Point &rStartPos, const Point &rLPt)
     329                 :            : {
     330                 :          0 :     return Abs(rStartPos.X() - rLPt.X()) > MIN_MOVE ||
     331 [ #  # ][ #  # ]:          0 :            Abs(rStartPos.Y() - rLPt.Y()) > MIN_MOVE;
     332                 :            : }
     333                 :            : 
     334                 :            : /*--------------------------------------------------------------------
     335                 :            :                 for MouseButtonDown - determine whether a DrawObject
     336                 :            :                 an NO SwgFrame was hit! Shift/Ctrl should only result
     337                 :            :                 in selecting, with DrawObjects; at SwgFlys to trigger
     338                 :            :                 hyperlinks if applicable (DownLoad/NewWindow!)
     339                 :            :  --------------------------------------------------------------------*/
     340                 :          0 : inline sal_Bool IsDrawObjSelectable( const SwWrtShell& rSh, const Point& rPt )
     341                 :            : {
     342                 :          0 :     sal_Bool bRet = sal_True;
     343                 :            :     SdrObject* pObj;
     344 [ #  # ][ #  # ]:          0 :     switch( rSh.GetObjCntType( rPt, pObj ))
     345                 :            :     {
     346                 :            :     case OBJCNT_NONE:
     347                 :            :     case OBJCNT_FLY:
     348                 :            :     case OBJCNT_GRF:
     349                 :            :     case OBJCNT_OLE:
     350                 :          0 :         bRet = sal_False;
     351                 :          0 :         break;
     352                 :            :     default:; //prevent warning
     353                 :            :     }
     354                 :          0 :     return bRet;
     355                 :            : }
     356                 :            : 
     357                 :            : /*--------------------------------------------------------------------
     358                 :            :     Description:   switch pointer
     359                 :            :  --------------------------------------------------------------------*/
     360                 :            : 
     361                 :       1314 : void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
     362                 :            : {
     363                 :       1314 :     SwWrtShell &rSh = rView.GetWrtShell();
     364         [ -  + ]:       1314 :     if( pApplyTempl )
     365                 :            :     {
     366                 :          0 :         PointerStyle eStyle = POINTER_FILL;
     367 [ #  # ][ #  # ]:          0 :         if( rSh.IsOverReadOnlyPos( rLPt ))
     368                 :            :         {
     369 [ #  # ][ #  # ]:          0 :             delete pUserMarker;
     370                 :          0 :             pUserMarker = 0L;
     371                 :            : 
     372                 :          0 :             eStyle = POINTER_NOTALLOWED;
     373                 :            :         }
     374                 :            :         else
     375                 :            :         {
     376                 :          0 :             SwRect aRect;
     377                 :          0 :             SwRect* pRect = &aRect;
     378                 :          0 :             const SwFrmFmt* pFmt = 0;
     379                 :            : 
     380                 :          0 :             bool bFrameIsValidTarget = false;
     381         [ #  # ]:          0 :             if( pApplyTempl->pFormatClipboard )
     382         [ #  # ]:          0 :                 bFrameIsValidTarget = pApplyTempl->pFormatClipboard->HasContentForThisType( nsSelectionType::SEL_FRM );
     383         [ #  # ]:          0 :             else if( !pApplyTempl->nColor )
     384                 :          0 :                 bFrameIsValidTarget = ( pApplyTempl->eType == SFX_STYLE_FAMILY_FRAME );
     385                 :            : 
     386 [ #  # ][ #  # ]:          0 :             if( bFrameIsValidTarget &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     387                 :          0 :                         0 !=(pFmt = rSh.GetFmtFromObj( rLPt, &pRect )) &&
     388 [ #  # ][ #  # ]:          0 :                         PTR_CAST(SwFlyFrmFmt, pFmt))
                 [ #  # ]
     389                 :            :             {
     390                 :            :                 //turn on highlight for frame
     391         [ #  # ]:          0 :                 Rectangle aTmp( pRect->SVRect() );
     392                 :            : 
     393         [ #  # ]:          0 :                 if ( !pUserMarker )
     394                 :            :                 {
     395 [ #  # ][ #  # ]:          0 :                     pUserMarker = new SdrDropMarkerOverlay( *rSh.GetDrawView(), aTmp );
                 [ #  # ]
     396                 :            :                 }
     397                 :            :             }
     398                 :            :             else
     399                 :            :             {
     400 [ #  # ][ #  # ]:          0 :                 delete pUserMarker;
     401                 :          0 :                 pUserMarker = 0L;
     402                 :            :             }
     403                 :            : 
     404         [ #  # ]:          0 :             rSh.SwCrsrShell::SetVisCrsr( rLPt );
     405                 :            :         }
     406         [ #  # ]:          0 :         SetPointer( eStyle );
     407                 :            :         return;
     408                 :            :     }
     409                 :            : 
     410         [ +  + ]:       1314 :     if( !rSh.VisArea().Width() )
     411                 :            :         return;
     412                 :            : 
     413         [ +  - ]:        369 :     SET_CURR_SHELL(&rSh);
     414                 :            : 
     415         [ -  + ]:        369 :     if ( IsChainMode() )
     416                 :            :     {
     417                 :          0 :         SwRect aRect;
     418 [ #  # ][ #  # ]:          0 :         int nChainable = rSh.Chainable( aRect, *rSh.GetFlyFrmFmt(), rLPt );
     419                 :            :         PointerStyle eStyle = nChainable
     420         [ #  # ]:          0 :                 ? POINTER_CHAIN_NOTALLOWED : POINTER_CHAIN;
     421         [ #  # ]:          0 :         if ( !nChainable )
     422                 :            :         {
     423         [ #  # ]:          0 :             Rectangle aTmp( aRect.SVRect() );
     424                 :            : 
     425         [ #  # ]:          0 :             if ( !pUserMarker )
     426                 :            :             {
     427 [ #  # ][ #  # ]:          0 :                 pUserMarker = new SdrDropMarkerOverlay( *rSh.GetDrawView(), aTmp );
                 [ #  # ]
     428                 :            :             }
     429                 :            :         }
     430                 :            :         else
     431                 :            :         {
     432 [ #  # ][ #  # ]:          0 :             delete pUserMarker;
     433                 :          0 :             pUserMarker = 0L;
     434                 :            :         }
     435                 :            : 
     436         [ #  # ]:          0 :         SetPointer( eStyle );
     437                 :            :         return;
     438                 :            :     }
     439                 :            : 
     440 [ +  - ][ +  - ]:        369 :     sal_Bool bExecHyperlinks = rView.GetDocShell()->IsReadOnly();
     441         [ +  + ]:        369 :     if ( !bExecHyperlinks )
     442                 :            :     {
     443         [ +  - ]:        367 :         SvtSecurityOptions aSecOpts;
     444         [ +  - ]:        367 :         const sal_Bool bSecureOption = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
     445 [ +  - ][ +  - ]:        367 :         if ( (  bSecureOption && nModifier == KEY_MOD1 ) ||
         [ -  + ][ #  # ]
     446                 :            :              ( !bSecureOption && nModifier != KEY_MOD1 ) )
     447         [ +  - ]:        367 :             bExecHyperlinks = sal_True;
     448                 :            :     }
     449                 :            : 
     450                 :        369 :     const sal_Bool bExecSmarttags  = nModifier == KEY_MOD1;
     451                 :            : 
     452         [ +  - ]:        369 :     SdrView *pSdrView = rSh.GetDrawView();
     453                 :        369 :     sal_Bool bPrefSdrPointer = sal_False;
     454                 :        369 :     sal_Bool bHitHandle = sal_False;
     455                 :        369 :     sal_Bool bCntAtPos = sal_False;
     456 [ +  - ][ +  - ]:        369 :     sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
     457 [ +  + ][ +  - ]:        369 :                           rSh.IsCrsrReadonly();
                 [ +  - ]
     458                 :        369 :     aActHitType = SDRHIT_NONE;
     459                 :        369 :     PointerStyle eStyle = POINTER_TEXT;
     460         [ -  + ]:        369 :     if ( !pSdrView )
     461                 :          0 :         bCntAtPos = sal_True;
     462 [ +  - ][ -  + ]:        369 :     else if ( sal_True == (bHitHandle = pSdrView->PickHandle( rLPt ) != 0) )
     463                 :            :     {
     464                 :          0 :         aActHitType = SDRHIT_OBJECT;
     465                 :          0 :         bPrefSdrPointer = sal_True;
     466                 :            :     }
     467                 :            :     else
     468                 :            :     {
     469         [ +  - ]:        369 :         const sal_Bool bNotInSelObj = !rSh.IsInsideSelectedObj( rLPt );
     470 [ -  + ][ #  # ]:        369 :         if ( rView.GetDrawFuncPtr() && !bInsDraw && bNotInSelObj )
         [ #  # ][ -  + ]
     471                 :            :         {
     472                 :          0 :             aActHitType = SDRHIT_OBJECT;
     473         [ #  # ]:          0 :             if (IsObjectSelect())
     474                 :          0 :                 eStyle = POINTER_ARROW;
     475                 :            :             else
     476                 :          0 :                 bPrefSdrPointer = sal_True;
     477                 :            :         }
     478                 :            :         else
     479                 :            :         {
     480                 :            :             SdrObject* pObj; SdrPageView* pPV;
     481         [ +  - ]:        369 :             pSdrView->SetHitTolerancePixel( HIT_PIX );
     482 [ +  - ][ +  + ]:        371 :             if ( bNotInSelObj && bExecHyperlinks &&
         [ -  + ][ -  + ]
     483         [ +  - ]:          2 :                  pSdrView->PickObj( rLPt, pSdrView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO ))
     484                 :            :             {
     485         [ #  # ]:          0 :                 SdrObjMacroHitRec aTmp;
     486                 :          0 :                 aTmp.aPos = rLPt;
     487                 :          0 :                 aTmp.pPageView = pPV;
     488 [ #  # ][ #  # ]:          0 :                 SetPointer( pObj->GetMacroPointer( aTmp ) );
     489                 :            :                 return;
     490                 :            :             }
     491                 :            :             else
     492                 :            :             {
     493                 :            :                 // dvo: IsObjSelectable() eventually calls SdrView::PickObj, so
     494                 :            :                 // apparently this is used to determine whether this is a
     495                 :            :                 // drawling layer object or not.
     496 [ +  - ][ -  + ]:        369 :                 if ( rSh.IsObjSelectable( rLPt ) )
     497                 :            :                 {
     498 [ #  # ][ #  # ]:          0 :                     if (pSdrView->IsTextEdit())
     499                 :            :                     {
     500                 :          0 :                         aActHitType = SDRHIT_NONE;
     501                 :          0 :                         bPrefSdrPointer = sal_True;
     502                 :            :                     }
     503                 :            :                     else
     504                 :            :                     {
     505         [ #  # ]:          0 :                         SdrViewEvent aVEvt;
     506         [ #  # ]:          0 :                         SdrHitKind eHit = pSdrView->PickAnything(rLPt, aVEvt);
     507                 :            : 
     508 [ #  # ][ #  # ]:          0 :                         if (eHit == SDRHIT_URLFIELD && bExecHyperlinks)
     509                 :            :                         {
     510                 :          0 :                             aActHitType = SDRHIT_OBJECT;
     511                 :          0 :                             bPrefSdrPointer = sal_True;
     512                 :            :                         }
     513                 :            :                         else
     514                 :            :                         {
     515                 :            :                             // if we're over a selected object, we show an
     516                 :            :                             // ARROW by default. We only show a MOVE if 1) the
     517                 :            :                             // object is selected, and 2) it may be moved
     518                 :            :                             // (i.e., position is not protected).
     519                 :            :                             bool bMovable =
     520                 :            :                                 (!bNotInSelObj) &&
     521 [ #  # ][ #  # ]:          0 :                                 (rSh.IsObjSelected() || rSh.IsFrmSelected()) &&
     522 [ #  # ][ #  # ]:          0 :                                 (!rSh.IsSelObjProtected(FLYPROTECT_POS));
         [ #  # ][ #  # ]
                 [ #  # ]
     523                 :            : 
     524         [ #  # ]:          0 :                             eStyle = bMovable ? POINTER_MOVE : POINTER_ARROW;
     525                 :          0 :                             aActHitType = SDRHIT_OBJECT;
     526         [ #  # ]:          0 :                         }
     527                 :            :                     }
     528                 :            :                 }
     529                 :            :                 else
     530                 :            :                 {
     531 [ +  - ][ -  + ]:        369 :                     if ( rSh.IsFrmSelected() && !bNotInSelObj )
         [ #  # ][ -  + ]
     532                 :            :                     {
     533                 :            :                         // dvo: this branch appears to be dead and should be
     534                 :            :                         // removed in a future version. Reason: The condition
     535                 :            :                         // !bNotInSelObj means that this branch will only be
     536                 :            :                         // executed in the cursor points inside a selected
     537                 :            :                         // object. However, if this is the case, the previous
     538                 :            :                         // if( rSh.IsObjSelectable(rLPt) ) must always be true:
     539                 :            :                         // rLPt is inside a selected object, then obviously
     540                 :            :                         // rLPt is over a selectable object.
     541 [ #  # ][ #  # ]:          0 :                         if (rSh.IsSelObjProtected(FLYPROTECT_SIZE))
     542                 :          0 :                             eStyle = POINTER_NOTALLOWED;
     543                 :            :                         else
     544                 :          0 :                             eStyle = POINTER_MOVE;
     545                 :          0 :                         aActHitType = SDRHIT_OBJECT;
     546                 :            :                     }
     547                 :            :                     else
     548                 :            :                     {
     549         [ -  + ]:        369 :                         if ( rView.GetDrawFuncPtr() )
     550                 :          0 :                             bPrefSdrPointer = sal_True;
     551                 :            :                         else
     552                 :        369 :                             bCntAtPos = sal_True;
     553                 :            :                     }
     554                 :            :                 }
     555                 :            :             }
     556                 :            :         }
     557                 :            :     }
     558         [ -  + ]:        369 :     if ( bPrefSdrPointer )
     559                 :            :     {
     560 [ #  # ][ #  # ]:          0 :         if (bIsDocReadOnly || (rSh.IsObjSelected() && rSh.IsSelObjProtected(FLYPROTECT_CONTENT)))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     561         [ #  # ]:          0 :             SetPointer( POINTER_NOTALLOWED );
     562                 :            :         else
     563                 :            :         {
     564 [ #  # ][ #  # ]:          0 :             if (rView.GetDrawFuncPtr() && rView.GetDrawFuncPtr()->IsInsertForm() && !bHitHandle)
         [ #  # ][ #  # ]
     565         [ #  # ]:          0 :                 SetPointer( POINTER_DRAW_RECT );
     566                 :            :             else
     567 [ #  # ][ #  # ]:          0 :                 SetPointer( pSdrView->GetPreferedPointer( rLPt, rSh.GetOut() ) );
     568                 :            :         }
     569                 :            :     }
     570                 :            :     else
     571                 :            :     {
     572 [ +  - ][ -  + ]:        369 :         if( !rSh.IsPageAtPos( rLPt ) || pAnchorMarker )
         [ #  # ][ +  - ]
     573                 :        369 :             eStyle = POINTER_ARROW;
     574                 :            :         else
     575                 :            :         {
     576         [ #  # ]:          0 :             if( bCntAtPos )
     577                 :            :             {
     578                 :            :                 SwContentAtPos aSwContentAtPos(
     579                 :            :                     SwContentAtPos::SW_CLICKFIELD|
     580                 :            :                     SwContentAtPos::SW_INETATTR|
     581                 :            :                     SwContentAtPos::SW_FTN |
     582         [ #  # ]:          0 :                     SwContentAtPos::SW_SMARTTAG );
     583 [ #  # ][ #  # ]:          0 :                 if( rSh.GetContentAtPos( rLPt, aSwContentAtPos) )
     584                 :            :                 {
     585                 :            :                     const bool bClickToFollow = SwContentAtPos::SW_INETATTR == aSwContentAtPos.eCntntAtPos ||
     586 [ #  # ][ #  # ]:          0 :                                                 SwContentAtPos::SW_SMARTTAG == aSwContentAtPos.eCntntAtPos;
     587                 :            : 
     588 [ #  # ][ #  # ]:          0 :                      if( !bClickToFollow ||
         [ #  # ][ #  # ]
                 [ #  # ]
     589                 :            :                          (SwContentAtPos::SW_INETATTR == aSwContentAtPos.eCntntAtPos && bExecHyperlinks) ||
     590                 :            :                          (SwContentAtPos::SW_SMARTTAG == aSwContentAtPos.eCntntAtPos && bExecSmarttags) )
     591                 :          0 :                         eStyle = POINTER_REFHAND;
     592         [ #  # ]:          0 :                 }
     593                 :            :             }
     594                 :            :         }
     595                 :            : 
     596                 :            :         // which kind of text pointer have we to show - horz / vert - ?
     597 [ -  + ][ #  # ]:        369 :         if( POINTER_TEXT == eStyle && rSh.IsInVerticalText( &rLPt ))
         [ #  # ][ -  + ]
     598                 :          0 :             eStyle = POINTER_TEXT_VERTICAL;
     599                 :            : 
     600         [ +  - ]:        369 :         SetPointer( eStyle );
     601 [ +  - ][ +  - ]:       1314 :     }
     602                 :            : }
     603                 :            : 
     604                 :            : /*--------------------------------------------------------------------
     605                 :            :     Description: increase timer for selection
     606                 :            :  --------------------------------------------------------------------*/
     607                 :            : 
     608                 :          0 : IMPL_LINK_NOARG(SwEditWin, TimerHandler)
     609                 :            : {
     610                 :            :     DBG_PROFSTART(edithdl);
     611                 :            : 
     612                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
     613                 :          0 :     Point aModPt( aMovePos );
     614                 :          0 :     const SwRect aOldVis( rSh.VisArea() );
     615                 :          0 :     sal_Bool bDone = sal_False;
     616                 :            : 
     617 [ #  # ][ #  # ]:          0 :     if ( !rSh.VisArea().IsInside( aModPt ) )
     618                 :            :     {
     619         [ #  # ]:          0 :         if ( bInsDraw )
     620                 :            :         {
     621                 :          0 :             const int nMaxScroll = 40;
     622 [ #  # ][ #  # ]:          0 :             rView.Scroll( Rectangle(aModPt,Size(1,1)), nMaxScroll, nMaxScroll);
     623                 :          0 :             bDone = sal_True;
     624                 :            :         }
     625         [ #  # ]:          0 :         else if ( bFrmDrag )
     626                 :            :         {
     627         [ #  # ]:          0 :             rSh.Drag(&aModPt, false);
     628                 :          0 :             bDone = sal_True;
     629                 :            :         }
     630         [ #  # ]:          0 :         if ( !bDone )
     631         [ #  # ]:          0 :             aModPt = rSh.GetCntntPos( aModPt,aModPt.Y() > rSh.VisArea().Bottom() );
     632                 :            :     }
     633 [ #  # ][ #  # ]:          0 :     if ( !bDone && !(bFrmDrag || bInsDraw) )
                 [ #  # ]
     634                 :            :     {
     635         [ #  # ]:          0 :         if ( pRowColumnSelectionStart )
     636                 :            :         {
     637                 :          0 :             Point aPos( aModPt );
     638         [ #  # ]:          0 :             rSh.SelectTableRowCol( *pRowColumnSelectionStart, &aPos, bIsRowDrag );
     639                 :            :         }
     640                 :            :         else
     641         [ #  # ]:          0 :             rSh.SetCursor( &aModPt, false );
     642                 :            : 
     643                 :            :         // It can be that a "jump" over a table cannot be accomplished like
     644                 :            :         // that. So we jump over the table by Up/Down here.
     645                 :          0 :         const SwRect& rVisArea = rSh.VisArea();
     646 [ #  # ][ #  # ]:          0 :         if( aOldVis == rVisArea && !rSh.IsStartOfDoc() && !rSh.IsEndOfDoc() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     647                 :            :         {
     648                 :            :             // take the center point of VisArea to
     649                 :            :             // decide in which direction the user want.
     650         [ #  # ]:          0 :             if( aModPt.Y() < ( rVisArea.Top() + rVisArea.Height() / 2 ) )
     651         [ #  # ]:          0 :                 rSh.Up( sal_True, 1 );
     652                 :            :             else
     653         [ #  # ]:          0 :                 rSh.Down( sal_True, 1 );
     654                 :            :         }
     655                 :            :     }
     656                 :            : 
     657                 :          0 :     aMovePos += rSh.VisArea().Pos() - aOldVis.Pos();
     658         [ #  # ]:          0 :     JustifyAreaTimer();
     659                 :            :     DBG_PROFSTOP(edithdl);
     660                 :          0 :     return 0;
     661                 :            : }
     662                 :            : 
     663                 :          0 : void SwEditWin::JustifyAreaTimer()
     664                 :            : {
     665                 :          0 :     const Rectangle &rVisArea = GetView().GetVisArea();
     666                 :            : #ifdef UNX
     667                 :          0 :     const long coMinLen = 100;
     668                 :            : #else
     669                 :            :     const long coMinLen = 50;
     670                 :            : #endif
     671                 :          0 :     long nTimeout = 800,
     672                 :            :          nDiff = Max(
     673                 :          0 :          Max( aMovePos.Y() - rVisArea.Bottom(), rVisArea.Top() - aMovePos.Y() ),
     674                 :          0 :          Max( aMovePos.X() - rVisArea.Right(),  rVisArea.Left() - aMovePos.X()));
     675                 :          0 :     aTimer.SetTimeout( Max( coMinLen, nTimeout - nDiff*2L) );
     676                 :          0 : }
     677                 :            : 
     678                 :          0 : void SwEditWin::LeaveArea(const Point &rPos)
     679                 :            : {
     680                 :          0 :     aMovePos = rPos;
     681                 :          0 :     JustifyAreaTimer();
     682         [ #  # ]:          0 :     if( !aTimer.IsActive() )
     683                 :          0 :         aTimer.Start();
     684         [ #  # ]:          0 :     delete pShadCrsr, pShadCrsr = 0;
     685                 :          0 : }
     686                 :            : 
     687                 :          0 : inline void SwEditWin::EnterArea()
     688                 :            : {
     689                 :          0 :     aTimer.Stop();
     690                 :          0 : }
     691                 :            : 
     692                 :            : /*------------------------------------------------------------------------
     693                 :            :  Description:  insert mode for frames
     694                 :            : ------------------------------------------------------------------------*/
     695                 :            : 
     696                 :          0 : void SwEditWin::InsFrm(sal_uInt16 nCols)
     697                 :            : {
     698                 :          0 :     StdDrawMode( OBJ_NONE, sal_False );
     699                 :          0 :     bInsFrm = sal_True;
     700                 :          0 :     nInsFrmColCount = nCols;
     701                 :          0 : }
     702                 :            : 
     703                 :          0 : void SwEditWin::StdDrawMode( SdrObjKind eSdrObjectKind, sal_Bool bObjSelect )
     704                 :            : {
     705                 :          0 :     SetSdrDrawMode( eSdrObjectKind );
     706                 :            : 
     707         [ #  # ]:          0 :     if (bObjSelect)
     708         [ #  # ]:          0 :         rView.SetDrawFuncPtr(new DrawSelection( &rView.GetWrtShell(), this, &rView ));
     709                 :            :     else
     710         [ #  # ]:          0 :         rView.SetDrawFuncPtr(new SwDrawBase( &rView.GetWrtShell(), this, &rView ));
     711                 :            : 
     712                 :          0 :     rView.SetSelDrawSlot();
     713                 :          0 :     SetSdrDrawMode( eSdrObjectKind );
     714         [ #  # ]:          0 :     if (bObjSelect)
     715                 :          0 :         rView.GetDrawFuncPtr()->Activate( SID_OBJECT_SELECT );
     716                 :            :     else
     717                 :          0 :         rView.GetDrawFuncPtr()->Activate( sal::static_int_cast< sal_uInt16 >(eSdrObjectKind) );
     718                 :          0 :     bInsFrm = sal_False;
     719                 :          0 :     nInsFrmColCount = 1;
     720                 :          0 : }
     721                 :            : 
     722                 :          0 : void SwEditWin::StopInsFrm()
     723                 :            : {
     724         [ #  # ]:          0 :     if (rView.GetDrawFuncPtr())
     725                 :            :     {
     726                 :          0 :         rView.GetDrawFuncPtr()->Deactivate();
     727                 :          0 :         rView.SetDrawFuncPtr(NULL);
     728                 :            :     }
     729                 :          0 :     rView.LeaveDrawCreate();    // leave construction mode
     730                 :          0 :     bInsFrm = sal_False;
     731                 :          0 :     nInsFrmColCount = 1;
     732                 :          0 : }
     733                 :            : 
     734                 :            : 
     735                 :            : 
     736                 :          0 : sal_Bool SwEditWin::IsInputSequenceCheckingRequired( const String &rText, const SwPaM& rCrsr ) const
     737                 :            : {
     738 [ #  # ][ #  # ]:          0 :     const SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
     739 [ #  # ][ #  # ]:          0 :     if ( !rCTLOptions.IsCTLFontEnabled() ||
         [ #  # ][ #  # ]
     740         [ #  # ]:          0 :          !rCTLOptions.IsCTLSequenceChecking() )
     741                 :          0 :          return sal_False;
     742                 :            : 
     743         [ #  # ]:          0 :     const xub_StrLen nFirstPos = rCrsr.Start()->nContent.GetIndex();
     744         [ #  # ]:          0 :     if ( 0 == nFirstPos ) /* first char needs not to be checked */
     745                 :          0 :         return sal_False;
     746                 :            : 
     747         [ #  # ]:          0 :     SwBreakIt *pBreakIter = SwBreakIt::Get();
     748         [ #  # ]:          0 :     uno::Reference < i18n::XBreakIterator > xBI = pBreakIter->GetBreakIter();
     749                 :          0 :     long nCTLScriptPos = -1;
     750                 :            : 
     751         [ #  # ]:          0 :     if (xBI.is())
     752                 :            :     {
     753 [ #  # ][ #  # ]:          0 :         if (xBI->getScriptType( rText, 0 ) == i18n::ScriptType::COMPLEX)
         [ #  # ][ #  # ]
     754                 :          0 :             nCTLScriptPos = 0;
     755                 :            :         else
     756 [ #  # ][ #  # ]:          0 :             nCTLScriptPos = xBI->nextScript( rText, 0, i18n::ScriptType::COMPLEX );
                 [ #  # ]
     757                 :            :     }
     758                 :            : 
     759 [ #  # ][ #  # ]:          0 :     return (0 <= nCTLScriptPos && nCTLScriptPos <= rText.Len());
     760                 :            : }
     761                 :            : 
     762                 :            : //return INVALID_HINT if language should not be explictly overridden, the correct
     763                 :            : //HintId to use for the eBufferLanguage otherwise
     764                 :          0 : sal_uInt16 lcl_isNonDefaultLanguage(LanguageType eBufferLanguage, SwView& rView,
     765                 :            :     const String &rInBuffer)
     766                 :            : {
     767                 :          0 :     sal_uInt16 nWhich = INVALID_HINT;
     768                 :          0 :     bool bLang = true;
     769         [ #  # ]:          0 :     if(eBufferLanguage != LANGUAGE_DONTKNOW)
     770                 :            :     {
     771   [ #  #  #  # ]:          0 :         switch( GetI18NScriptTypeOfLanguage( eBufferLanguage ))
     772                 :            :         {
     773                 :          0 :             case  i18n::ScriptType::ASIAN:     nWhich = RES_CHRATR_CJK_LANGUAGE; break;
     774                 :          0 :             case  i18n::ScriptType::COMPLEX:   nWhich = RES_CHRATR_CTL_LANGUAGE; break;
     775                 :          0 :             case  i18n::ScriptType::LATIN:     nWhich = RES_CHRATR_LANGUAGE; break;
     776                 :          0 :             default: bLang = false;
     777                 :            :         }
     778         [ #  # ]:          0 :         if(bLang)
     779                 :            :         {
     780         [ #  # ]:          0 :             SfxItemSet aLangSet(rView.GetPool(), nWhich, nWhich);
     781                 :          0 :             SwWrtShell& rSh = rView.GetWrtShell();
     782         [ #  # ]:          0 :             rSh.GetCurAttr(aLangSet);
     783 [ #  # ][ #  # ]:          0 :             if(SFX_ITEM_DEFAULT <= aLangSet.GetItemState(nWhich, sal_True))
     784                 :            :             {
     785         [ #  # ]:          0 :                 LanguageType eLang = static_cast<const SvxLanguageItem&>(aLangSet.Get(nWhich)).GetLanguage();
     786         [ #  # ]:          0 :                 if ( eLang == eBufferLanguage )
     787                 :            :                 {
     788                 :            :                     // current language attribute equal to language reported from system
     789                 :          0 :                     bLang = false;
     790                 :            :                 }
     791 [ #  # ][ #  # ]:          0 :                 else if ( !bInputLanguageSwitched && RES_CHRATR_LANGUAGE == nWhich )
     792                 :            :                 {
     793                 :            :                     // special case: switching between two "LATIN" languages
     794                 :            :                     // In case the current keyboard setting might be suitable
     795                 :            :                     // for both languages we can't safely assume that the user
     796                 :            :                     // wants to use the language reported from the system,
     797                 :            :                     // except if we knew that it was explicitly switched (thus
     798                 :            :                     // the check for "bInputLangeSwitched").
     799                 :            :                     //
     800                 :            :                     // The language reported by the system could be just the
     801                 :            :                     // system default language that the user is not even aware
     802                 :            :                     // of, because no language selection tool is installed at
     803                 :            :                     // all. In this case the OOo language should get preference
     804                 :            :                     // as it might have been selected by the user explicitly.
     805                 :            :                     //
     806                 :            :                     // Usually this case happens if the OOo language is
     807                 :            :                     // different to the system language but the system keyboard
     808                 :            :                     // is still suitable for the OOo language (e.g. writing
     809                 :            :                     // English texts with a German keyboard).
     810                 :            :                     //
     811                 :            :                     // For non-latin keyboards overwriting the attribute is
     812                 :            :                     // still valid. We do this for kyrillic and greek ATM.  In
     813                 :            :                     // future versions of OOo this should be replaced by a
     814                 :            :                     // configuration switch that allows to give the preference
     815                 :            :                     // to the OOo setting or the system setting explicitly
     816                 :            :                     // and/or a better handling of the script type.
     817                 :          0 :                     i18n::UnicodeScript eType = rInBuffer.Len() ?
     818 [ #  # ][ #  # ]:          0 :                         (i18n::UnicodeScript)GetAppCharClass().getScript( rInBuffer, 0 ) :
     819         [ #  # ]:          0 :                         i18n::UnicodeScript_kScriptCount;
     820                 :            : 
     821                 :          0 :                     bool bSystemIsNonLatin = false, bOOoLangIsNonLatin = false;
     822         [ #  # ]:          0 :                     switch ( eType )
     823                 :            :                     {
     824                 :            :                         case i18n::UnicodeScript_kGreek:
     825                 :            :                         case i18n::UnicodeScript_kCyrillic:
     826                 :            :                             // in case other UnicodeScripts require special
     827                 :            :                             // keyboards they can be added here
     828                 :          0 :                             bSystemIsNonLatin = true;
     829                 :          0 :                             break;
     830                 :            :                         default:
     831                 :          0 :                             break;
     832                 :            :                     }
     833                 :            : 
     834         [ #  # ]:          0 :                     switch ( eLang )
     835                 :            :                     {
     836                 :            :                         case LANGUAGE_AZERI_CYRILLIC:
     837                 :            :                         case LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA:
     838                 :            :                         case LANGUAGE_BULGARIAN:
     839                 :            :                         case LANGUAGE_GREEK:
     840                 :            :                         case LANGUAGE_RUSSIAN:
     841                 :            :                         case LANGUAGE_RUSSIAN_MOLDOVA:
     842                 :            :                         case LANGUAGE_SERBIAN_CYRILLIC:
     843                 :            :                         case LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA:
     844                 :            :                         case LANGUAGE_UZBEK_CYRILLIC:
     845                 :            :                         case LANGUAGE_UKRAINIAN:
     846                 :            :                         case LANGUAGE_BELARUSIAN:
     847                 :          0 :                             bOOoLangIsNonLatin = true;
     848                 :          0 :                             break;
     849                 :            :                         default:
     850                 :          0 :                             break;
     851                 :            :                     }
     852                 :            : 
     853                 :          0 :                     bLang = (bSystemIsNonLatin != bOOoLangIsNonLatin);
     854                 :            :                 }
     855         [ #  # ]:          0 :             }
     856                 :            :         }
     857                 :            :     }
     858         [ #  # ]:          0 :     return bLang ? nWhich : INVALID_HINT;
     859                 :            : }
     860                 :            : 
     861                 :            : /*--------------------------------------------------------------------
     862                 :            :      Description:  character buffer is inserted into the document
     863                 :            :  --------------------------------------------------------------------*/
     864                 :            : 
     865                 :          0 : void SwEditWin::FlushInBuffer()
     866                 :            : {
     867         [ #  # ]:          0 :     if ( aInBuffer.Len() )
     868                 :            :     {
     869                 :          0 :         SwWrtShell& rSh = rView.GetWrtShell();
     870                 :            : 
     871                 :            :         // generate new sequence input checker if not already done
     872         [ #  # ]:          0 :         if ( !pCheckIt )
     873 [ #  # ][ #  # ]:          0 :             pCheckIt = new SwCheckIt;
     874                 :            : 
     875                 :          0 :         uno::Reference < i18n::XExtendedInputSequenceChecker > xISC = pCheckIt->xCheck;
     876 [ #  # ][ #  # ]:          0 :         if ( xISC.is() && IsInputSequenceCheckingRequired( aInBuffer, *rSh.GetCrsr() ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     877                 :            :         {
     878                 :            :             //
     879                 :            :             // apply (Thai) input sequence checking/correction
     880                 :            :             //
     881                 :            : 
     882         [ #  # ]:          0 :             rSh.Push(); // push current cursor to stack
     883                 :            : 
     884                 :            :             // get text from the beginning (i.e left side) of current selection
     885                 :            :             // to the start of the paragraph
     886         [ #  # ]:          0 :             rSh.NormalizePam();     // make point be the first (left) one
     887 [ #  # ][ #  # ]:          0 :             if (!rSh.GetCrsr()->HasMark())
     888 [ #  # ][ #  # ]:          0 :                 rSh.GetCrsr()->SetMark();
     889 [ #  # ][ #  # ]:          0 :             rSh.GetCrsr()->GetMark()->nContent = 0;
     890 [ #  # ][ #  # ]:          0 :             String aLeftText( rSh.GetCrsr()->GetTxt() );
     891                 :            : 
     892 [ #  # ][ #  # ]:          0 :             SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
     893                 :            : 
     894                 :          0 :             xub_StrLen nExpandSelection = 0;
     895         [ #  # ]:          0 :             if (aLeftText.Len() > 0)
     896                 :            :             {
     897                 :          0 :                 sal_Unicode cChar = '\0';
     898                 :            : 
     899                 :          0 :                 xub_StrLen nTmpPos = aLeftText.Len();
     900         [ #  # ]:          0 :                 sal_Int16 nCheckMode = rCTLOptions.IsCTLSequenceCheckingRestricted() ?
     901         [ #  # ]:          0 :                         i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
     902                 :            : 
     903         [ #  # ]:          0 :                 rtl::OUString aOldText( aLeftText );
     904                 :          0 :                 rtl::OUString aNewText( aOldText );
     905 [ #  # ][ #  # ]:          0 :                 if (rCTLOptions.IsCTLSequenceCheckingTypeAndReplace())
     906                 :            :                 {
     907         [ #  # ]:          0 :                     for (xub_StrLen k = 0;  k < aInBuffer.Len();  ++k)
     908                 :            :                     {
     909                 :          0 :                         cChar = aInBuffer.GetChar(k);
     910 [ #  # ][ #  # ]:          0 :                         const xub_StrLen nPrevPos = static_cast<xub_StrLen>(xISC->correctInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode ));
     911                 :            : 
     912                 :            :                         // valid sequence or sequence could be corrected:
     913         [ #  # ]:          0 :                         if (nPrevPos != aNewText.getLength())
     914                 :          0 :                             nTmpPos = nPrevPos + 1;
     915                 :            :                     }
     916                 :            : 
     917                 :            :                     // find position of first character that has changed
     918                 :          0 :                     sal_Int32 nOldLen = aOldText.getLength();
     919                 :          0 :                     sal_Int32 nNewLen = aNewText.getLength();
     920                 :          0 :                     const sal_Unicode *pOldTxt = aOldText.getStr();
     921                 :          0 :                     const sal_Unicode *pNewTxt = aNewText.getStr();
     922                 :          0 :                     sal_Int32 nChgPos = 0;
     923 [ #  # ][ #  # ]:          0 :                     while ( nChgPos < nOldLen && nChgPos < nNewLen &&
         [ #  # ][ #  # ]
     924                 :          0 :                             pOldTxt[nChgPos] == pNewTxt[nChgPos] )
     925                 :          0 :                         ++nChgPos;
     926                 :            : 
     927                 :          0 :                     xub_StrLen nChgLen = static_cast< xub_StrLen >(nNewLen - nChgPos);
     928         [ #  # ]:          0 :                     String aChgText( aNewText.copy( static_cast< xub_StrLen >(nChgPos), nChgLen ) );
     929                 :            : 
     930         [ #  # ]:          0 :                     if (aChgText.Len())
     931                 :            :                     {
     932         [ #  # ]:          0 :                         aInBuffer = aChgText;
     933                 :          0 :                         nExpandSelection = aLeftText.Len() - static_cast< xub_StrLen >(nChgPos);
     934                 :            :                     }
     935                 :            :                     else
     936 [ #  # ][ #  # ]:          0 :                         aInBuffer.Erase();
     937                 :            :                 }
     938                 :            :                 else
     939                 :            :                 {
     940         [ #  # ]:          0 :                     for (xub_StrLen k = 0;  k < aInBuffer.Len();  ++k)
     941                 :            :                     {
     942                 :          0 :                         cChar = aInBuffer.GetChar(k);
     943 [ #  # ][ #  # ]:          0 :                         if (xISC->checkInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode ))
                 [ #  # ]
     944                 :            :                         {
     945                 :            :                             // character can be inserted:
     946                 :          0 :                             aNewText += rtl::OUString( (sal_Unicode) cChar );
     947                 :          0 :                             ++nTmpPos;
     948                 :            :                         }
     949                 :            :                     }
     950         [ #  # ]:          0 :                     aInBuffer = aNewText.copy( aOldText.getLength() );  // copy new text to be inserted to buffer
     951                 :          0 :                 }
     952                 :            :             }
     953                 :            : 
     954                 :            :             // at this point now we will insert the buffer text 'normally' some lines below...
     955                 :            : 
     956         [ #  # ]:          0 :             rSh.Pop( sal_False );  // pop old cursor from stack
     957                 :            : 
     958         [ #  # ]:          0 :             if (!aInBuffer.Len())
     959                 :          0 :                 return;
     960                 :            : 
     961                 :            :             // if text prior to the original selection needs to be changed
     962                 :            :             // as well, we now expand the selection accordingly.
     963         [ #  # ]:          0 :             SwPaM &rCrsr = *rSh.GetCrsr();
     964         [ #  # ]:          0 :             xub_StrLen nCrsrStartPos = rCrsr.Start()->nContent.GetIndex();
     965                 :            :             OSL_ENSURE( nCrsrStartPos >= nExpandSelection, "cannot expand selection as specified!!" );
     966 [ #  # ][ #  # ]:          0 :             if (nExpandSelection && nCrsrStartPos >= nExpandSelection)
     967                 :            :             {
     968         [ #  # ]:          0 :                 if (!rCrsr.HasMark())
     969         [ #  # ]:          0 :                     rCrsr.SetMark();
     970 [ #  # ][ #  # ]:          0 :                 rCrsr.Start()->nContent -= nExpandSelection;
     971 [ #  # ][ #  # ]:          0 :             }
     972                 :            :         }
     973                 :            : 
     974                 :            :         uno::Reference< frame::XDispatchRecorder > xRecorder =
     975         [ #  # ]:          0 :                 rView.GetViewFrame()->GetBindings().GetRecorder();
     976         [ #  # ]:          0 :         if ( xRecorder.is() )
     977                 :            :         {
     978                 :            :             // determine shell
     979 [ #  # ][ #  # ]:          0 :             SfxShell *pSfxShell = lcl_GetShellFromDispatcher( rView, TYPE(SwTextShell) );
     980                 :            :             // generate request and record
     981         [ #  # ]:          0 :             if (pSfxShell)
     982                 :            :             {
     983         [ #  # ]:          0 :                 SfxRequest aReq( rView.GetViewFrame(), FN_INSERT_STRING );
     984 [ #  # ][ #  # ]:          0 :                 aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, aInBuffer ) );
                 [ #  # ]
     985 [ #  # ][ #  # ]:          0 :                 aReq.Done();
     986                 :            :             }
     987                 :            :         }
     988                 :            : 
     989         [ #  # ]:          0 :         sal_uInt16 nWhich = lcl_isNonDefaultLanguage(eBufferLanguage, rView, aInBuffer);
     990         [ #  # ]:          0 :         if (nWhich != INVALID_HINT )
     991                 :            :         {
     992         [ #  # ]:          0 :             SvxLanguageItem aLangItem( eBufferLanguage, nWhich );
     993 [ #  # ][ #  # ]:          0 :             rSh.SetAttr( aLangItem );
     994                 :            :         }
     995                 :            : 
     996         [ #  # ]:          0 :         rSh.Insert( aInBuffer );
     997                 :          0 :         eBufferLanguage = LANGUAGE_DONTKNOW;
     998         [ #  # ]:          0 :         aInBuffer.Erase();
     999         [ #  # ]:          0 :         bFlushCharBuffer = sal_False;
    1000                 :            :     }
    1001                 :            : }
    1002                 :            : 
    1003                 :            : #define MOVE_LEFT_SMALL     0
    1004                 :            : #define MOVE_UP_SMALL       1
    1005                 :            : #define MOVE_RIGHT_BIG      2
    1006                 :            : #define MOVE_DOWN_BIG       3
    1007                 :            : #define MOVE_LEFT_BIG       4
    1008                 :            : #define MOVE_UP_BIG         5
    1009                 :            : #define MOVE_RIGHT_SMALL    6
    1010                 :            : #define MOVE_DOWN_SMALL     7
    1011                 :            : 
    1012                 :          0 : void SwEditWin::ChangeFly( sal_uInt8 nDir, sal_Bool bWeb )
    1013                 :            : {
    1014                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
    1015         [ #  # ]:          0 :     SwRect aTmp = rSh.GetFlyRect();
    1016 [ #  # ][ #  # ]:          0 :     if( aTmp.HasArea() &&
         [ #  # ][ #  # ]
    1017                 :            :         // IsSelObjProtected() seems to be the correct condition, not
    1018                 :            :         // !HasReadonlySel(), otherwise frame is not moveable if content is
    1019                 :            :         // protected.
    1020         [ #  # ]:          0 :         !rSh.IsSelObjProtected( FLYPROTECT_POS|FLYPROTECT_SIZE ) )
    1021                 :            :     {
    1022         [ #  # ]:          0 :         SfxItemSet aSet(rSh.GetAttrPool(),
    1023                 :            :                         RES_FRM_SIZE, RES_FRM_SIZE,
    1024                 :            :                         RES_VERT_ORIENT, RES_ANCHOR,
    1025                 :            :                         RES_COL, RES_COL,
    1026                 :            :                         RES_PROTECT, RES_PROTECT,
    1027         [ #  # ]:          0 :                         RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW, 0);
    1028         [ #  # ]:          0 :         rSh.GetFlyFrmAttr( aSet );
    1029         [ #  # ]:          0 :         RndStdIds eAnchorId = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
    1030                 :          0 :         Size aSnap;
    1031 [ #  # ][ #  # ]:          0 :         if(MOVE_LEFT_SMALL == nDir ||
         [ #  # ][ #  # ]
    1032                 :            :             MOVE_UP_SMALL == nDir ||
    1033                 :            :             MOVE_RIGHT_SMALL == nDir ||
    1034                 :            :             MOVE_DOWN_SMALL == nDir )
    1035         [ #  # ]:          0 :             aSnap = PixelToLogic(Size(1,1));
    1036                 :            :         else
    1037                 :            :         {
    1038                 :          0 :             aSnap = rSh.GetViewOptions()->GetSnapSize();
    1039                 :          0 :             short nDiv = rSh.GetViewOptions()->GetDivisionX();
    1040         [ #  # ]:          0 :             if ( nDiv > 0 )
    1041                 :          0 :                 aSnap.Width() = Max( (sal_uLong)1, (sal_uLong)aSnap.Width() / nDiv );
    1042                 :          0 :             nDiv = rSh.GetViewOptions()->GetDivisionY();
    1043         [ #  # ]:          0 :             if ( nDiv > 0 )
    1044                 :          0 :                 aSnap.Height() = Max( (sal_uLong)1, (sal_uLong)aSnap.Height() / nDiv );
    1045                 :            :         }
    1046                 :            : 
    1047                 :          0 :         SwRect aBoundRect;
    1048                 :          0 :         Point aRefPoint;
    1049                 :            :         // adjustment for allowing vertical position
    1050                 :            :         // aligned to page for fly frame anchored to paragraph or to character.
    1051                 :            :         {
    1052 [ #  # ][ #  # ]:          0 :             SwFmtVertOrient aVert( (SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT) );
    1053                 :            :             const bool bFollowTextFlow =
    1054         [ #  # ]:          0 :                     static_cast<const SwFmtFollowTextFlow&>(aSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue();
    1055 [ #  # ][ #  # ]:          0 :             const SwPosition* pToCharCntntPos = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetCntntAnchor();
    1056                 :            :             rSh.CalcBoundRect( aBoundRect, eAnchorId,
    1057                 :          0 :                                text::RelOrientation::FRAME, aVert.GetRelationOrient(),
    1058                 :            :                                pToCharCntntPos, bFollowTextFlow,
    1059 [ #  # ][ #  # ]:          0 :                                false, &aRefPoint );
    1060                 :            :         }
    1061                 :          0 :         long nLeft = Min( aTmp.Left() - aBoundRect.Left(), aSnap.Width() );
    1062                 :          0 :         long nRight = Min( aBoundRect.Right() - aTmp.Right(), aSnap.Width() );
    1063                 :          0 :         long nUp = Min( aTmp.Top() - aBoundRect.Top(), aSnap.Height() );
    1064                 :          0 :         long nDown = Min( aBoundRect.Bottom() - aTmp.Bottom(), aSnap.Height() );
    1065                 :            : 
    1066   [ #  #  #  #  :          0 :         switch ( nDir )
                #  #  # ]
    1067                 :            :         {
    1068                 :            :             case MOVE_LEFT_BIG:
    1069                 :          0 :             case MOVE_LEFT_SMALL: aTmp.Left( aTmp.Left() - nLeft ); break;
    1070                 :            :             case MOVE_UP_BIG:
    1071                 :          0 :             case MOVE_UP_SMALL: aTmp.Top( aTmp.Top() - nUp ); break;
    1072         [ #  # ]:          0 :             case MOVE_RIGHT_SMALL: if( aTmp.Width() < aSnap.Width() + MINFLY ) break;
    1073                 :          0 :                     nRight = aSnap.Width(); // no break
    1074                 :          0 :             case MOVE_RIGHT_BIG: aTmp.Left( aTmp.Left() + nRight ); break;
    1075         [ #  # ]:          0 :             case MOVE_DOWN_SMALL: if( aTmp.Height() < aSnap.Height() + MINFLY ) break;
    1076                 :          0 :                     nDown = aSnap.Height(); // no break
    1077                 :          0 :             case MOVE_DOWN_BIG: aTmp.Top( aTmp.Top() + nDown ); break;
    1078                 :            :             default: OSL_ENSURE(true, "ChangeFly: Unknown direction." );
    1079                 :            :         }
    1080                 :          0 :         sal_Bool bSet = sal_False;
    1081 [ #  # ][ #  # ]:          0 :         if ((FLY_AS_CHAR == eAnchorId) && ( nDir % 2 ))
    1082                 :            :         {
    1083                 :          0 :             long aDiff = aTmp.Top() - aRefPoint.Y();
    1084         [ #  # ]:          0 :             if( aDiff > 0 )
    1085                 :          0 :                 aDiff = 0;
    1086         [ #  # ]:          0 :             else if ( aDiff < -aTmp.Height() )
    1087                 :          0 :                 aDiff = -aTmp.Height();
    1088 [ #  # ][ #  # ]:          0 :             SwFmtVertOrient aVert( (SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT) );
    1089                 :            :             sal_Int16 eNew;
    1090         [ #  # ]:          0 :             if( bWeb )
    1091                 :            :             {
    1092                 :          0 :                 eNew = aVert.GetVertOrient();
    1093                 :          0 :                 sal_Bool bDown = 0 != ( nDir & 0x02 );
    1094   [ #  #  #  #  :          0 :                 switch( eNew )
                #  #  # ]
    1095                 :            :                 {
    1096                 :            :                     case text::VertOrientation::CHAR_TOP:
    1097         [ #  # ]:          0 :                         if( bDown ) eNew = text::VertOrientation::CENTER;
    1098                 :          0 :                     break;
    1099                 :            :                     case text::VertOrientation::CENTER:
    1100         [ #  # ]:          0 :                         eNew = bDown ? text::VertOrientation::TOP : text::VertOrientation::CHAR_TOP;
    1101                 :          0 :                     break;
    1102                 :            :                     case text::VertOrientation::TOP:
    1103         [ #  # ]:          0 :                         if( !bDown ) eNew = text::VertOrientation::CENTER;
    1104                 :          0 :                     break;
    1105                 :            :                     case text::VertOrientation::LINE_TOP:
    1106         [ #  # ]:          0 :                         if( bDown ) eNew = text::VertOrientation::LINE_CENTER;
    1107                 :          0 :                     break;
    1108                 :            :                     case text::VertOrientation::LINE_CENTER:
    1109         [ #  # ]:          0 :                         eNew = bDown ? text::VertOrientation::LINE_BOTTOM : text::VertOrientation::LINE_TOP;
    1110                 :          0 :                     break;
    1111                 :            :                     case text::VertOrientation::LINE_BOTTOM:
    1112         [ #  # ]:          0 :                         if( !bDown ) eNew = text::VertOrientation::LINE_CENTER;
    1113                 :          0 :                     break;
    1114                 :            :                     default:; //prevent warning
    1115                 :            :                 }
    1116                 :            :             }
    1117                 :            :             else
    1118                 :            :             {
    1119                 :          0 :                 aVert.SetPos( aDiff );
    1120                 :          0 :                 eNew = text::VertOrientation::NONE;
    1121                 :            :             }
    1122                 :          0 :             aVert.SetVertOrient( eNew );
    1123         [ #  # ]:          0 :             aSet.Put( aVert );
    1124         [ #  # ]:          0 :             bSet = sal_True;
    1125                 :            :         }
    1126 [ #  # ][ #  # ]:          0 :         if (bWeb && (FLY_AT_PARA == eAnchorId)
         [ #  # ][ #  # ]
    1127                 :            :             && ( nDir==MOVE_LEFT_SMALL || nDir==MOVE_RIGHT_BIG ))
    1128                 :            :         {
    1129 [ #  # ][ #  # ]:          0 :             SwFmtHoriOrient aHori( (SwFmtHoriOrient&)aSet.Get(RES_HORI_ORIENT) );
    1130                 :            :             sal_Int16 eNew;
    1131                 :          0 :             eNew = aHori.GetHoriOrient();
    1132      [ #  #  # ]:          0 :             switch( eNew )
    1133                 :            :             {
    1134                 :            :                 case text::HoriOrientation::RIGHT:
    1135         [ #  # ]:          0 :                     if( nDir==MOVE_LEFT_SMALL )
    1136                 :          0 :                         eNew = text::HoriOrientation::LEFT;
    1137                 :          0 :                 break;
    1138                 :            :                 case text::HoriOrientation::LEFT:
    1139         [ #  # ]:          0 :                     if( nDir==MOVE_RIGHT_BIG )
    1140                 :          0 :                         eNew = text::HoriOrientation::RIGHT;
    1141                 :          0 :                 break;
    1142                 :            :                 default:; //prevent warning
    1143                 :            :             }
    1144         [ #  # ]:          0 :             if( eNew != aHori.GetHoriOrient() )
    1145                 :            :             {
    1146                 :          0 :                 aHori.SetHoriOrient( eNew );
    1147         [ #  # ]:          0 :                 aSet.Put( aHori );
    1148                 :          0 :                 bSet = sal_True;
    1149         [ #  # ]:          0 :             }
    1150                 :            :         }
    1151         [ #  # ]:          0 :         rSh.StartAllAction();
    1152         [ #  # ]:          0 :         if( bSet )
    1153         [ #  # ]:          0 :             rSh.SetFlyFrmAttr( aSet );
    1154                 :          0 :         sal_Bool bSetPos = (FLY_AS_CHAR != eAnchorId);
    1155 [ #  # ][ #  # ]:          0 :         if(bSetPos && bWeb)
    1156                 :            :         {
    1157         [ #  # ]:          0 :             if (FLY_AT_PAGE != eAnchorId)
    1158                 :            :             {
    1159                 :          0 :                 bSetPos = sal_False;
    1160                 :            :             }
    1161                 :            :             else
    1162                 :            :             {
    1163 [ #  # ][ #  # ]:          0 :                 bSetPos = (::GetHtmlMode(rView.GetDocShell()) & HTMLMODE_SOME_ABS_POS) ?
    1164         [ #  # ]:          0 :                     sal_True : sal_False;
    1165                 :            :             }
    1166                 :            :         }
    1167         [ #  # ]:          0 :         if( bSetPos )
    1168         [ #  # ]:          0 :             rSh.SetFlyPos( aTmp.Pos() );
    1169 [ #  # ][ #  # ]:          0 :         rSh.EndAllAction();
    1170                 :            :     }
    1171                 :          0 : }
    1172                 :            : 
    1173                 :          0 : void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
    1174                 :            : {
    1175                 :            :     // start undo action in order to get only one
    1176                 :            :     // undo action for this change.
    1177                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
    1178                 :          0 :     rSh.StartUndo();
    1179                 :            : 
    1180                 :          0 :     long nX = 0;
    1181                 :          0 :     long nY = 0;
    1182                 :          0 :     sal_Bool bOnePixel = sal_False;
    1183                 :          0 :     sal_uInt16 nAnchorDir = SW_MOVE_UP;
    1184   [ #  #  #  #  :          0 :     switch(nDir)
             #  #  #  #  
                      # ]
    1185                 :            :     {
    1186                 :            :         case MOVE_LEFT_SMALL:
    1187                 :          0 :             bOnePixel = sal_True;
    1188                 :            :             //no break;
    1189                 :            :         case MOVE_LEFT_BIG:
    1190                 :          0 :             nX = -1;
    1191                 :          0 :             nAnchorDir = SW_MOVE_LEFT;
    1192                 :          0 :         break;
    1193                 :            :         case MOVE_UP_SMALL:
    1194                 :          0 :             bOnePixel = sal_True;
    1195                 :            :             //no break;
    1196                 :            :         case MOVE_UP_BIG:
    1197                 :          0 :             nY = -1;
    1198                 :          0 :         break;
    1199                 :            :         case MOVE_RIGHT_SMALL:
    1200                 :          0 :             bOnePixel = sal_True;
    1201                 :            :             //no break;
    1202                 :            :         case MOVE_RIGHT_BIG:
    1203                 :          0 :             nX = +1;
    1204                 :          0 :             nAnchorDir = SW_MOVE_RIGHT;
    1205                 :          0 :         break;
    1206                 :            :         case MOVE_DOWN_SMALL:
    1207                 :          0 :             bOnePixel = sal_True;
    1208                 :            :             //no break;
    1209                 :            :         case MOVE_DOWN_BIG:
    1210                 :          0 :             nY = +1;
    1211                 :          0 :             nAnchorDir = SW_MOVE_DOWN;
    1212                 :          0 :         break;
    1213                 :            :     }
    1214                 :            : 
    1215 [ #  # ][ #  # ]:          0 :     if(0 != nX || 0 != nY)
    1216                 :            :     {
    1217         [ #  # ]:          0 :         sal_uInt8 nProtect = rSh.IsSelObjProtected( FLYPROTECT_POS|FLYPROTECT_SIZE );
    1218                 :          0 :         Size aSnap( rSh.GetViewOptions()->GetSnapSize() );
    1219                 :          0 :         short nDiv = rSh.GetViewOptions()->GetDivisionX();
    1220         [ #  # ]:          0 :         if ( nDiv > 0 )
    1221                 :          0 :             aSnap.Width() = Max( (sal_uLong)1, (sal_uLong)aSnap.Width() / nDiv );
    1222                 :          0 :         nDiv = rSh.GetViewOptions()->GetDivisionY();
    1223         [ #  # ]:          0 :         if ( nDiv > 0 )
    1224                 :          0 :             aSnap.Height() = Max( (sal_uLong)1, (sal_uLong)aSnap.Height() / nDiv );
    1225                 :            : 
    1226         [ #  # ]:          0 :         if(bOnePixel)
    1227         [ #  # ]:          0 :             aSnap = PixelToLogic(Size(1,1));
    1228                 :            : 
    1229                 :          0 :         nX *= aSnap.Width();
    1230                 :          0 :         nY *= aSnap.Height();
    1231                 :            : 
    1232         [ #  # ]:          0 :         SdrView *pSdrView = rSh.GetDrawView();
    1233                 :          0 :         const SdrHdlList& rHdlList = pSdrView->GetHdlList();
    1234         [ #  # ]:          0 :         SdrHdl* pHdl = rHdlList.GetFocusHdl();
    1235         [ #  # ]:          0 :         rSh.StartAllAction();
    1236         [ #  # ]:          0 :         if(0L == pHdl)
    1237                 :            :         {
    1238                 :            :             // now move the selected draw objects
    1239                 :            :             // if the object's position is not protected
    1240         [ #  # ]:          0 :             if(0 == (nProtect&FLYPROTECT_POS))
    1241                 :            :             {
    1242                 :            :                 // Check if object is anchored as character and move direction
    1243                 :            :                 sal_Bool bDummy1, bDummy2;
    1244         [ #  # ]:          0 :                 const bool bVertAnchor = rSh.IsFrmVertical( sal_True, bDummy1, bDummy2 );
    1245                 :          0 :                 bool bHoriMove = !bVertAnchor == !( nDir % 2 );
    1246                 :            :                 bool bMoveAllowed =
    1247 [ #  # ][ #  # ]:          0 :                     !bHoriMove || (rSh.GetAnchorId() != FLY_AS_CHAR);
                 [ #  # ]
    1248         [ #  # ]:          0 :                 if ( bMoveAllowed )
    1249                 :            :                 {
    1250         [ #  # ]:          0 :                     pSdrView->MoveAllMarked(Size(nX, nY));
    1251         [ #  # ]:          0 :                     rSh.SetModified();
    1252                 :            :                 }
    1253                 :            :             }
    1254                 :            :         }
    1255                 :            :         else
    1256                 :            :         {
    1257                 :            :             // move handle with index nHandleIndex
    1258 [ #  # ][ #  # ]:          0 :             if(pHdl && (nX || nY))
                 [ #  # ]
    1259                 :            :             {
    1260   [ #  #  #  # ]:          0 :                 if( HDL_ANCHOR == pHdl->GetKind() ||
                 [ #  # ]
    1261                 :          0 :                     HDL_ANCHOR_TR == pHdl->GetKind() )
    1262                 :            :                 {
    1263                 :            :                     // anchor move cannot be allowed when position is protected
    1264         [ #  # ]:          0 :                     if(0 == (nProtect&FLYPROTECT_POS))
    1265         [ #  # ]:          0 :                         rSh.MoveAnchor( nAnchorDir );
    1266                 :            :                 }
    1267                 :            :                 //now resize if size is protected
    1268         [ #  # ]:          0 :                 else if(0 == (nProtect&FLYPROTECT_SIZE))
    1269                 :            :                 {
    1270                 :            :                     // now move the Handle (nX, nY)
    1271                 :          0 :                     Point aStartPoint(pHdl->GetPos());
    1272                 :          0 :                     Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
    1273                 :          0 :                     const SdrDragStat& rDragStat = pSdrView->GetDragStat();
    1274                 :            : 
    1275                 :            :                     // start dragging
    1276         [ #  # ]:          0 :                     pSdrView->BegDragObj(aStartPoint, 0, pHdl, 0);
    1277                 :            : 
    1278         [ #  # ]:          0 :                     if(pSdrView->IsDragObj())
    1279                 :            :                     {
    1280                 :          0 :                         sal_Bool bWasNoSnap = static_cast< sal_Bool >(rDragStat.IsNoSnap());
    1281                 :          0 :                         sal_Bool bWasSnapEnabled = pSdrView->IsSnapEnabled();
    1282                 :            : 
    1283                 :            :                         // switch snapping off
    1284         [ #  # ]:          0 :                         if(!bWasNoSnap)
    1285                 :          0 :                             ((SdrDragStat&)rDragStat).SetNoSnap(sal_True);
    1286         [ #  # ]:          0 :                         if(bWasSnapEnabled)
    1287                 :          0 :                             pSdrView->SetSnapEnabled(sal_False);
    1288                 :            : 
    1289         [ #  # ]:          0 :                         pSdrView->MovAction(aEndPoint);
    1290         [ #  # ]:          0 :                         pSdrView->EndDragObj();
    1291         [ #  # ]:          0 :                         rSh.SetModified();
    1292                 :            : 
    1293                 :            :                         // restore snap
    1294         [ #  # ]:          0 :                         if(!bWasNoSnap)
    1295                 :          0 :                             ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
    1296         [ #  # ]:          0 :                         if(bWasSnapEnabled)
    1297                 :          0 :                             pSdrView->SetSnapEnabled(bWasSnapEnabled);
    1298                 :            :                     }
    1299                 :            :                 }
    1300                 :            :             }
    1301                 :            :         }
    1302         [ #  # ]:          0 :         rSh.EndAllAction();
    1303                 :            :     }
    1304                 :            : 
    1305                 :          0 :     rSh.EndUndo();
    1306                 :          0 : }
    1307                 :            : 
    1308                 :            : /*--------------------------------------------------------------------
    1309                 :            :     Description:   KeyEvents
    1310                 :            :  --------------------------------------------------------------------*/
    1311                 :            : 
    1312                 :          0 : void SwEditWin::KeyInput(const KeyEvent &rKEvt)
    1313                 :            : {
    1314                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
    1315                 :            : 
    1316 [ #  # ][ #  # ]:          0 :     if( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
         [ #  # ][ #  # ]
    1317                 :            :         pApplyTempl && pApplyTempl->pFormatClipboard )
    1318                 :            :     {
    1319         [ #  # ]:          0 :         pApplyTempl->pFormatClipboard->Erase();
    1320         [ #  # ]:          0 :         SetApplyTemplate(SwApplyTemplate());
    1321         [ #  # ]:          0 :         rView.GetViewFrame()->GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
    1322                 :            :     }
    1323   [ #  #  #  # ]:          0 :     else if ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
                 [ #  # ]
    1324                 :          0 :             rSh.IsHeaderFooterEdit( ) )
    1325                 :            :     {
    1326         [ #  # ]:          0 :         bool bHeader = FRMTYPE_HEADER & rSh.GetFrmType(0,sal_False);
    1327                 :            : 
    1328                 :            :         // Remove the temporary header/footer
    1329         [ #  # ]:          0 :         if ( !m_sTmpHFPageStyle.isEmpty() )
    1330                 :            :         {
    1331 [ #  # ][ #  # ]:          0 :             rSh.ChangeHeaderOrFooter( m_sTmpHFPageStyle, m_bTmpHFIsHeader, false, false );
                 [ #  # ]
    1332                 :            :         }
    1333                 :            : 
    1334         [ #  # ]:          0 :         if ( bHeader )
    1335         [ #  # ]:          0 :             rSh.SttPg();
    1336                 :            :         else
    1337         [ #  # ]:          0 :             rSh.EndPg();
    1338         [ #  # ]:          0 :         rSh.ToggleHeaderFooterEdit();
    1339                 :            :     }
    1340                 :            : 
    1341                 :            :     // If we are inputing a key in a temporary header/footer, then make it definitive
    1342         [ #  # ]:          0 :     if ( !m_sTmpHFPageStyle.isEmpty( ) )
    1343                 :          0 :         m_sTmpHFPageStyle = rtl::OUString( );
    1344                 :            : 
    1345         [ #  # ]:          0 :     SfxObjectShell *pObjSh = (SfxObjectShell*)rView.GetViewFrame()->GetObjectShell();
    1346 [ #  # ][ #  # ]:          0 :     if ( bLockInput || (pObjSh && pObjSh->GetProgress()) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1347                 :            :         // When the progress bar is active or a progress is
    1348                 :            :         // running on a document, no order is being taken
    1349                 :            :         return;
    1350                 :            : 
    1351 [ #  # ][ #  # ]:          0 :     delete pShadCrsr, pShadCrsr = 0;
    1352         [ #  # ]:          0 :     aKeyInputFlushTimer.Stop();
    1353                 :            : 
    1354 [ #  # ][ #  # ]:          0 :     sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
    1355 [ #  # ][ #  # ]:          0 :                           rSh.IsCrsrReadonly();
                 [ #  # ]
    1356                 :            : 
    1357                 :            :     //if the language changes the buffer must be flushed
    1358         [ #  # ]:          0 :     LanguageType eNewLanguage = GetInputLanguage();
    1359 [ #  # ][ #  # ]:          0 :     if(!bIsDocReadOnly && eBufferLanguage != eNewLanguage && aInBuffer.Len())
         [ #  # ][ #  # ]
    1360                 :            :     {
    1361         [ #  # ]:          0 :         FlushInBuffer();
    1362                 :            :     }
    1363                 :          0 :     eBufferLanguage = eNewLanguage;
    1364                 :            : 
    1365         [ #  # ]:          0 :     QuickHelpData aTmpQHD;
    1366         [ #  # ]:          0 :     if( pQuickHlpData->m_bIsDisplayed )
    1367                 :            :     {
    1368                 :          0 :         aTmpQHD.Move( *pQuickHlpData );
    1369         [ #  # ]:          0 :         pQuickHlpData->Stop( rSh );
    1370                 :            :     }
    1371                 :            : 
    1372                 :            :     // OS:the DrawView also needs a readonly-Flag as well
    1373 [ #  # ][ #  # ]:          0 :     if ( !bIsDocReadOnly && rSh.GetDrawView() && rSh.GetDrawView()->KeyInput( rKEvt, this ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1374                 :            :     {
    1375         [ #  # ]:          0 :         rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll( sal_False );
    1376         [ #  # ]:          0 :         rSh.SetModified();
    1377                 :            :         return; // Event evaluated by SdrView
    1378                 :            :     }
    1379                 :            : 
    1380 [ #  # ][ #  # ]:          0 :     if ( rView.GetDrawFuncPtr() && bInsFrm )
                 [ #  # ]
    1381                 :            :     {
    1382         [ #  # ]:          0 :         StopInsFrm();
    1383         [ #  # ]:          0 :         rSh.Edit();
    1384                 :            :     }
    1385                 :            : 
    1386                 :          0 :     sal_Bool bFlushBuffer = sal_False;
    1387                 :          0 :     sal_Bool bNormalChar = sal_False;
    1388                 :          0 :     bool bAppendSpace = pQuickHlpData->m_bAppendSpace;
    1389                 :          0 :     pQuickHlpData->m_bAppendSpace = false;
    1390                 :            : 
    1391 [ #  # ][ #  # ]:          0 :     if ( getenv("SW_DEBUG") && rKEvt.GetKeyCode().GetCode() == KEY_F12 )
                 [ #  # ]
    1392                 :            :     {
    1393         [ #  # ]:          0 :         if( rKEvt.GetKeyCode().IsShift())
    1394                 :            :         {
    1395 [ #  # ][ #  # ]:          0 :             GetView().GetDocShell()->GetDoc()->dumpAsXml();
    1396                 :            :             return;
    1397                 :            :         }
    1398                 :            :         else
    1399                 :            :         {
    1400 [ #  # ][ #  # ]:          0 :             SwRootFrm* pLayout = GetView().GetDocShell()->GetWrtShell()->GetLayout();
    1401         [ #  # ]:          0 :             pLayout->dumpAsXml( );
    1402                 :            :             return;
    1403                 :            :         }
    1404                 :            :     }
    1405                 :            : 
    1406         [ #  # ]:          0 :     KeyEvent aKeyEvent( rKEvt );
    1407                 :            :     // look for vertical mappings
    1408 [ #  # ][ #  # ]:          0 :     if( !bIsDocReadOnly && !rSh.IsSelFrmMode() && !rSh.IsObjSelected() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1409                 :            :     {
    1410                 :            :         // must changed from switch to if, because the Linux
    1411                 :            :         // compiler has problem with the code. Has to remove if the new general
    1412                 :            :         // handler exist.
    1413                 :          0 :         sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
    1414                 :            : 
    1415 [ #  # ][ #  # ]:          0 :         if( KEY_UP == nKey || KEY_DOWN == nKey ||
         [ #  # ][ #  # ]
    1416                 :            :             KEY_LEFT == nKey || KEY_RIGHT == nKey )
    1417                 :            :         {
    1418                 :            :             // In general, we want to map the direction keys if we are inside
    1419                 :            :             // some vertical formatted text.
    1420                 :            :             // 1. Exception: For a table cursor in a horizontal table, the
    1421                 :            :             //               directions should never be mapped.
    1422                 :            :             // 2. Exception: For a table cursor in a vertical table, the
    1423                 :            :             //               directions should always be mapped.
    1424         [ #  # ]:          0 :             const bool bVertText = rSh.IsInVerticalText();
    1425                 :          0 :             const bool bTblCrsr = rSh.GetTableCrsr();
    1426         [ #  # ]:          0 :             const bool bVertTable = rSh.IsTableVertical();
    1427 [ #  # ][ #  # ]:          0 :             if( ( bVertText && ( !bTblCrsr || bVertTable ) ) ||
         [ #  # ][ #  # ]
                 [ #  # ]
    1428                 :            :                 ( bTblCrsr && bVertTable ) )
    1429                 :            :             {
    1430                 :            :                 // Attempt to integrate cursor travelling for mongolian layout does not work.
    1431                 :            :                 // Thus, back to previous mapping of cursor keys to direction keys.
    1432         [ #  # ]:          0 :                 if( KEY_UP == nKey ) nKey = KEY_LEFT;
    1433         [ #  # ]:          0 :                 else if( KEY_DOWN == nKey ) nKey = KEY_RIGHT;
    1434         [ #  # ]:          0 :                 else if( KEY_LEFT == nKey ) nKey = KEY_DOWN;
    1435         [ #  # ]:          0 :                 else if( KEY_RIGHT == nKey ) nKey = KEY_UP;
    1436                 :            :             }
    1437                 :            : 
    1438 [ #  # ][ #  # ]:          0 :             if ( rSh.IsInRightToLeftText() )
    1439                 :            :             {
    1440         [ #  # ]:          0 :                 if( KEY_LEFT == nKey ) nKey = KEY_RIGHT;
    1441         [ #  # ]:          0 :                 else if( KEY_RIGHT == nKey ) nKey = KEY_LEFT;
    1442                 :            :             }
    1443                 :            : 
    1444                 :          0 :             aKeyEvent = KeyEvent( rKEvt.GetCharCode(),
    1445                 :          0 :                                   KeyCode( nKey, rKEvt.GetKeyCode().GetModifier() ),
    1446 [ #  # ][ #  # ]:          0 :                                   rKEvt.GetRepeat() );
    1447                 :            :         }
    1448                 :            :     }
    1449                 :            : 
    1450                 :          0 :     const KeyCode& rKeyCode = aKeyEvent.GetKeyCode();
    1451                 :          0 :     sal_Unicode aCh = aKeyEvent.GetCharCode();
    1452                 :            : 
    1453                 :            :     // enable switching to notes ankor with Ctrl - Alt - Page Up/Down
    1454                 :            :     // pressing this inside a note will switch to next/previous note
    1455 [ #  # ][ #  # ]:          0 :     if ((rKeyCode.IsMod1() && rKeyCode.IsMod2()) && ((rKeyCode.GetCode() == KEY_PAGEUP) || (rKeyCode.GetCode() == KEY_PAGEDOWN)))
         [ #  # ][ #  # ]
                 [ #  # ]
    1456                 :            :     {
    1457                 :          0 :         bool bNext = rKeyCode.GetCode()==KEY_PAGEDOWN ? true : false;
    1458         [ #  # ]:          0 :         SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD);
    1459         [ #  # ]:          0 :         rSh.MoveFldType( pFldType, bNext );
    1460                 :            :         return;
    1461                 :            :     }
    1462                 :            : 
    1463         [ #  # ]:          0 :     const SwFrmFmt* pFlyFmt = rSh.GetFlyFrmFmt();
    1464         [ #  # ]:          0 :     if( pFlyFmt )
    1465                 :            :     {
    1466                 :            :         sal_uInt16 nEvent;
    1467                 :            : 
    1468   [ #  #  #  # ]:          0 :         if( 32 <= aCh &&
                 [ #  # ]
    1469                 :          0 :             0 == (( KEY_MOD1 | KEY_MOD2 ) & rKeyCode.GetModifier() ))
    1470                 :          0 :             nEvent = SW_EVENT_FRM_KEYINPUT_ALPHA;
    1471                 :            :         else
    1472                 :          0 :             nEvent = SW_EVENT_FRM_KEYINPUT_NOALPHA;
    1473                 :            : 
    1474 [ #  # ][ #  # ]:          0 :         const SvxMacro* pMacro = pFlyFmt->GetMacro().GetMacroTable().Get( nEvent );
    1475         [ #  # ]:          0 :         if( pMacro )
    1476                 :            :         {
    1477         [ #  # ]:          0 :             String sRet;
    1478 [ #  # ][ #  # ]:          0 :             SbxArrayRef xArgs = new SbxArray;
    1479 [ #  # ][ #  # ]:          0 :             SbxVariableRef xVar = new SbxVariable;
    1480 [ #  # ][ #  # ]:          0 :             xVar->PutString( pFlyFmt->GetName() );
    1481         [ #  # ]:          0 :             xArgs->Put( &xVar, 1 );
    1482                 :            : 
    1483 [ #  # ][ #  # ]:          0 :             xVar = new SbxVariable;
                 [ #  # ]
    1484         [ #  # ]:          0 :             if( SW_EVENT_FRM_KEYINPUT_ALPHA == nEvent )
    1485         [ #  # ]:          0 :                 xVar->PutChar( aCh );
    1486                 :            :             else
    1487         [ #  # ]:          0 :                 xVar->PutUShort( rKeyCode.GetModifier() | rKeyCode.GetCode() );
    1488         [ #  # ]:          0 :             xArgs->Put( &xVar, 2 );
    1489                 :            : 
    1490         [ #  # ]:          0 :             rSh.ExecMacro( *pMacro, &sRet, &xArgs );
    1491 [ #  # ][ #  # ]:          0 :             if( sRet.Len() && 0 != sRet.ToInt32() )
         [ #  # ][ #  # ]
    1492 [ #  # ][ #  # ]:          0 :                 return ;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1493                 :            :         }
    1494                 :            :     }
    1495                 :            :     int nLclSelectionType;
    1496                 :            :     //A is converted to 1
    1497 [ #  # ][ #  # ]:          0 :     if( rKeyCode.GetFullCode() == (KEY_A | KEY_MOD1 |KEY_SHIFT)
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
    1498         [ #  # ]:          0 :         && rSh.HasDrawView() &&
    1499                 :            :         (0 != (nLclSelectionType = rSh.GetSelectionType()) &&
    1500                 :            :         ((nLclSelectionType & (nsSelectionType::SEL_FRM|nsSelectionType::SEL_GRF)) ||
    1501                 :            :         ((nLclSelectionType & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM)) &&
    1502         [ #  # ]:          0 :                 rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1))))
    1503                 :            :     {
    1504         [ #  # ]:          0 :         SdrHdlList& rHdlList = (SdrHdlList&)rSh.GetDrawView()->GetHdlList();
    1505         [ #  # ]:          0 :         SdrHdl* pAnchor = rHdlList.GetHdl(HDL_ANCHOR);
    1506         [ #  # ]:          0 :         if ( ! pAnchor )
    1507         [ #  # ]:          0 :             pAnchor = rHdlList.GetHdl(HDL_ANCHOR_TR);
    1508         [ #  # ]:          0 :         if(pAnchor)
    1509         [ #  # ]:          0 :             rHdlList.SetFocusHdl(pAnchor);
    1510                 :            :         return;
    1511                 :            :     }
    1512                 :            : 
    1513                 :          0 :     SvxAutoCorrCfg* pACfg = 0;
    1514                 :          0 :     SvxAutoCorrect* pACorr = 0;
    1515                 :            : 
    1516                 :            :     uno::Reference< frame::XDispatchRecorder > xRecorder =
    1517         [ #  # ]:          0 :             rView.GetViewFrame()->GetBindings().GetRecorder();
    1518         [ #  # ]:          0 :     if ( !xRecorder.is() )
    1519                 :            :     {
    1520         [ #  # ]:          0 :         pACfg = &SvxAutoCorrCfg::Get();
    1521                 :          0 :         pACorr = pACfg->GetAutoCorrect();
    1522                 :            :     }
    1523                 :            : 
    1524         [ #  # ]:          0 :     SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
    1525                 :            : 
    1526                 :          0 :     TblChgWidthHeightType eTblChgMode = nsTblChgWidthHeightType::WH_COL_LEFT;    // initialization just for warning-free code
    1527                 :          0 :     sal_uInt16 nTblChgSize = 0;
    1528                 :          0 :     sal_Bool bStopKeyInputTimer = sal_True;
    1529         [ #  # ]:          0 :     String sFmlEntry;
    1530                 :            : 
    1531                 :            :     enum SW_KeyState { KS_Start,
    1532                 :            :                        KS_CheckKey, KS_InsChar, KS_InsTab,
    1533                 :            :                        KS_NoNum, KS_NumOff, KS_NumOrNoNum, KS_NumDown, KS_NumUp,
    1534                 :            :                        KS_NumIndentInc, KS_NumIndentDec,
    1535                 :            : 
    1536                 :            :                        KS_OutlineLvOff,
    1537                 :            :                        KS_NextCell, KS_PrevCell, KS_OutlineUp, KS_OutlineDown,
    1538                 :            :                        KS_GlossaryExpand, KS_NextPrevGlossary,
    1539                 :            :                        KS_AutoFmtByInput,
    1540                 :            :                        KS_NextObject, KS_PrevObject,
    1541                 :            :                        KS_KeyToView,
    1542                 :            :                        KS_LaunchOLEObject, KS_GoIntoFly, KS_GoIntoDrawing,
    1543                 :            :                        KS_EnterDrawHandleMode,
    1544                 :            :                        KS_CheckDocReadOnlyKeys,
    1545                 :            :                        KS_CheckAutoCorrect, KS_EditFormula,
    1546                 :            :                        KS_ColLeftBig, KS_ColRightBig,
    1547                 :            :                        KS_ColLeftSmall, KS_ColRightSmall,
    1548                 :            :                        KS_ColTopBig, KS_ColBottomBig,
    1549                 :            :                        KS_ColTopSmall, KS_ColBottomSmall,
    1550                 :            :                        KS_CellLeftBig, KS_CellRightBig,
    1551                 :            :                        KS_CellLeftSmall, KS_CellRightSmall,
    1552                 :            :                        KS_CellTopBig, KS_CellBottomBig,
    1553                 :            :                        KS_CellTopSmall, KS_CellBottomSmall,
    1554                 :            : 
    1555                 :            :                        KS_InsDel_ColLeftBig, KS_InsDel_ColRightBig,
    1556                 :            :                        KS_InsDel_ColLeftSmall, KS_InsDel_ColRightSmall,
    1557                 :            :                        KS_InsDel_ColTopBig, KS_InsDel_ColBottomBig,
    1558                 :            :                        KS_InsDel_ColTopSmall, KS_InsDel_ColBottomSmall,
    1559                 :            :                        KS_InsDel_CellLeftBig, KS_InsDel_CellRightBig,
    1560                 :            :                        KS_InsDel_CellLeftSmall, KS_InsDel_CellRightSmall,
    1561                 :            :                        KS_InsDel_CellTopBig, KS_InsDel_CellBottomBig,
    1562                 :            :                        KS_InsDel_CellTopSmall, KS_InsDel_CellBottomSmall,
    1563                 :            :                        KS_TblColCellInsDel,
    1564                 :            : 
    1565                 :            :                        KS_Fly_Change, KS_Draw_Change,
    1566                 :            :                        KS_SpecialInsert,
    1567                 :            :                        KS_EnterCharCell,
    1568                 :            :                        KS_GotoNextFieldMark,
    1569                 :            :                        KS_GotoPrevFieldMark,
    1570                 :            :                        KS_Ende };
    1571                 :            : 
    1572                 :            :     SW_KeyState eKeyState = bIsDocReadOnly ? KS_CheckDocReadOnlyKeys
    1573         [ #  # ]:          0 :                                            : KS_CheckKey,
    1574                 :          0 :                 eNextKeyState = KS_Ende;
    1575                 :          0 :     sal_uInt8 nDir = 0;
    1576                 :            : 
    1577         [ #  # ]:          0 :     if (nKS_NUMDOWN_Count > 0)
    1578                 :          0 :         nKS_NUMDOWN_Count--;
    1579                 :            : 
    1580         [ #  # ]:          0 :     if (nKS_NUMINDENTINC_Count > 0)
    1581                 :          0 :         nKS_NUMINDENTINC_Count--;
    1582                 :            : 
    1583         [ #  # ]:          0 :     while( KS_Ende != eKeyState )
    1584                 :            :     {
    1585                 :          0 :         SW_KeyState eFlyState = KS_KeyToView;
    1586                 :            : 
    1587   [ #  #  #  #  :          0 :         switch( eKeyState )
          #  #  #  #  #  
                #  #  # ]
    1588                 :            :         {
    1589                 :            :         case KS_CheckKey:
    1590                 :          0 :             eKeyState = KS_KeyToView;       // default forward to View
    1591                 :            : 
    1592                 :            : #if OSL_DEBUG_LEVEL > 1
    1593                 :            : //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1594                 :            :             // for switching curor behaviour in ReadOnly regions
    1595                 :            :             if( 0x7210 == rKeyCode.GetFullCode() )
    1596                 :            :                 rSh.SetReadOnlyAvailable( !rSh.IsReadOnlyAvailable() );
    1597                 :            :             else
    1598                 :            : //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1599                 :            : #endif
    1600                 :            : 
    1601         [ #  # ]:          0 :             if( !rKeyCode.IsMod2() && '=' == aCh &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1602         [ #  # ]:          0 :                 !rSh.IsTableMode() && rSh.GetTableFmt() &&
    1603         [ #  # ]:          0 :                 rSh.IsSttPara() &&
    1604         [ #  # ]:          0 :                 !rSh.HasReadonlySel() )
    1605                 :            :             {
    1606                 :            :                 // at the beginning of the table's cell a '=' ->
    1607                 :            :                 // call EditRow (F2-functionality)
    1608         [ #  # ]:          0 :                 rSh.Push();
    1609 [ #  # ][ #  # ]:          0 :                 if( !rSh.MoveSection( fnSectionCurr, fnSectionStart) &&
         [ #  # ][ #  # ]
    1610         [ #  # ]:          0 :                     !rSh.IsTableBoxTextFormat() )
    1611                 :            :                 {
    1612                 :            :                     // is at the beginning of the box
    1613                 :          0 :                     eKeyState = KS_EditFormula;
    1614         [ #  # ]:          0 :                     if( rSh.HasMark() )
    1615         [ #  # ]:          0 :                         rSh.SwapPam();
    1616                 :            :                     else
    1617         [ #  # ]:          0 :                         rSh.SttSelect();
    1618         [ #  # ]:          0 :                     rSh.MoveSection( fnSectionCurr, fnSectionEnd );
    1619         [ #  # ]:          0 :                     rSh.Pop( sal_True );
    1620         [ #  # ]:          0 :                     rSh.EndSelect();
    1621         [ #  # ]:          0 :                     sFmlEntry = '=';
    1622                 :            :                 }
    1623                 :            :                 else
    1624         [ #  # ]:          0 :                     rSh.Pop( sal_False );
    1625                 :            :             }
    1626                 :            :             else
    1627                 :            :             {
    1628 [ #  # ][ #  # ]:          0 :                 if( pACorr && aTmpQHD.HasCntnt() && !rSh.HasSelection() &&
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
    1629         [ #  # ]:          0 :                     !rSh.HasReadonlySel() && !aTmpQHD.m_bIsAutoText &&
    1630                 :          0 :                     pACorr->GetSwFlags().nAutoCmpltExpandKey ==
    1631                 :          0 :                     (rKeyCode.GetModifier() | rKeyCode.GetCode()) )
    1632                 :            :                 {
    1633                 :          0 :                     eKeyState = KS_GlossaryExpand;
    1634                 :          0 :                     break;
    1635                 :            :                 }
    1636                 :            : 
    1637   [ #  #  #  #  :          0 :                 switch( rKeyCode.GetModifier() | rKeyCode.GetCode() )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
    1638                 :            :                 {
    1639                 :            :                 case KEY_RIGHT | KEY_MOD2:
    1640                 :          0 :                     eKeyState = KS_ColRightBig;
    1641                 :          0 :                     eFlyState = KS_Fly_Change;
    1642                 :          0 :                     nDir = MOVE_RIGHT_SMALL;
    1643                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1644                 :            : 
    1645                 :            :                 case KEY_LEFT | KEY_MOD2:
    1646                 :          0 :                     eKeyState = KS_ColRightSmall;
    1647                 :          0 :                     eFlyState = KS_Fly_Change;
    1648                 :          0 :                     nDir = MOVE_LEFT_SMALL;
    1649                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1650                 :            :                 case KEY_RIGHT | KEY_MOD2 | KEY_SHIFT:
    1651                 :          0 :                     eKeyState = KS_ColLeftSmall;
    1652                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1653                 :            :                 case KEY_LEFT | KEY_MOD2 | KEY_SHIFT:
    1654                 :          0 :                     eKeyState = KS_ColLeftBig;
    1655                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1656                 :            : 
    1657                 :            :                 case KEY_RIGHT | KEY_MOD2 | KEY_MOD1:
    1658                 :          0 :                     eKeyState = KS_CellRightBig;
    1659                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1660                 :            :                 case KEY_LEFT | KEY_MOD2 | KEY_MOD1:
    1661                 :          0 :                     eKeyState = KS_CellRightSmall;
    1662                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1663                 :            :                 case KEY_RIGHT | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
    1664                 :          0 :                     eKeyState = KS_CellLeftSmall;
    1665                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1666                 :            :                 case KEY_LEFT | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
    1667                 :          0 :                     eKeyState = KS_CellLeftBig;
    1668                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1669                 :            : 
    1670                 :            :                 case KEY_UP | KEY_MOD2:
    1671                 :          0 :                     eKeyState = KS_ColBottomSmall;
    1672                 :          0 :                     eFlyState = KS_Fly_Change;
    1673                 :          0 :                     nDir = MOVE_UP_SMALL;
    1674                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1675                 :            :                 case KEY_DOWN | KEY_MOD2:
    1676                 :          0 :                     eKeyState = KS_ColBottomBig;
    1677                 :          0 :                     eFlyState = KS_Fly_Change;
    1678                 :          0 :                     nDir = MOVE_DOWN_SMALL;
    1679                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1680                 :            : 
    1681                 :            :                 case KEY_UP | KEY_MOD2 | KEY_MOD1:
    1682                 :          0 :                     eKeyState = KS_CellBottomSmall;
    1683                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1684                 :            :                 case KEY_DOWN | KEY_MOD2 | KEY_MOD1:
    1685                 :          0 :                     eKeyState = KS_CellBottomBig;
    1686                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1687                 :            :                 case KEY_UP | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
    1688                 :          0 :                     eKeyState = KS_CellTopBig;
    1689                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1690                 :            :                 case KEY_DOWN | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
    1691                 :          0 :                     eKeyState = KS_CellTopSmall;
    1692                 :          0 :                     goto KEYINPUT_CHECKTABLE;
    1693                 :            : 
    1694                 :            : KEYINPUT_CHECKTABLE:
    1695 [ #  # ][ #  # ]:          0 :                     if( rSh.IsTableMode() || !rSh.GetTableFmt() )
         [ #  # ][ #  # ]
    1696                 :            :                     {
    1697         [ #  # ]:          0 :                         if(KS_KeyToView != eFlyState)
    1698                 :            :                         {
    1699 [ #  # ][ #  # ]:          0 :                             if(!pFlyFmt && KS_KeyToView != eFlyState &&
           [ #  #  #  # ]
                 [ #  # ]
    1700         [ #  # ]:          0 :                                 (rSh.GetSelectionType() & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM))  &&
    1701         [ #  # ]:          0 :                                     rSh.GetDrawView()->AreObjectsMarked())
    1702                 :          0 :                                 eKeyState = KS_Draw_Change;
    1703                 :            :                         }
    1704                 :            : 
    1705         [ #  # ]:          0 :                         if( pFlyFmt )
    1706                 :          0 :                             eKeyState = eFlyState;
    1707         [ #  # ]:          0 :                         else if( KS_Draw_Change != eKeyState)
    1708                 :          0 :                             eKeyState = KS_EnterCharCell;
    1709                 :            :                     }
    1710                 :          0 :                     break;
    1711                 :            : 
    1712                 :            : //-------
    1713                 :            : // Insert/Delete
    1714                 :            :                 case KEY_LEFT:
    1715                 :            :                 case KEY_LEFT | KEY_MOD1:
    1716                 :            :                 {
    1717                 :          0 :                     sal_Bool bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1);
    1718         [ #  # ]:          0 :                     if(!bMod1)
    1719                 :            :                     {
    1720                 :          0 :                         eFlyState = KS_Fly_Change;
    1721                 :          0 :                         nDir = MOVE_LEFT_BIG;
    1722                 :            :                     }
    1723                 :            :                     eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL |
    1724                 :            :                             ( bMod1
    1725                 :            :                                 ? nsTblChgWidthHeightType::WH_CELL_LEFT
    1726         [ #  # ]:          0 :                                 : nsTblChgWidthHeightType::WH_COL_LEFT );
    1727                 :          0 :                     nTblChgSize = pModOpt->GetTblVInsert();
    1728                 :            :                 }
    1729                 :          0 :                     goto KEYINPUT_CHECKTABLE_INSDEL;
    1730                 :            :                 case KEY_RIGHT | KEY_MOD1:
    1731                 :            :                 {
    1732                 :          0 :                     eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL | nsTblChgWidthHeightType::WH_CELL_RIGHT;
    1733                 :          0 :                     nTblChgSize = pModOpt->GetTblVInsert();
    1734                 :            :                 }
    1735                 :          0 :                     goto KEYINPUT_CHECKTABLE_INSDEL;
    1736                 :            :                 case KEY_UP:
    1737                 :            :                 case KEY_UP | KEY_MOD1:
    1738                 :            :                 {
    1739                 :          0 :                     sal_Bool bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1);
    1740         [ #  # ]:          0 :                     if(!bMod1)
    1741                 :            :                     {
    1742                 :          0 :                         eFlyState = KS_Fly_Change;
    1743                 :          0 :                         nDir = MOVE_UP_BIG;
    1744                 :            :                     }
    1745                 :            :                     eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL |
    1746                 :            :                             ( bMod1
    1747                 :            :                                 ? nsTblChgWidthHeightType::WH_CELL_TOP
    1748         [ #  # ]:          0 :                                 : nsTblChgWidthHeightType::WH_ROW_TOP );
    1749                 :          0 :                     nTblChgSize = pModOpt->GetTblHInsert();
    1750                 :            :                 }
    1751                 :          0 :                     goto KEYINPUT_CHECKTABLE_INSDEL;
    1752                 :            :                 case KEY_DOWN:
    1753                 :            :                 case KEY_DOWN | KEY_MOD1:
    1754                 :            :                 {
    1755                 :          0 :                     sal_Bool bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1);
    1756         [ #  # ]:          0 :                     if(!bMod1)
    1757                 :            :                     {
    1758                 :          0 :                         eFlyState = KS_Fly_Change;
    1759                 :          0 :                         nDir = MOVE_DOWN_BIG;
    1760                 :            :                     }
    1761                 :            :                     eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL |
    1762                 :            :                             ( bMod1
    1763                 :            :                                 ? nsTblChgWidthHeightType::WH_CELL_BOTTOM
    1764         [ #  # ]:          0 :                                 : nsTblChgWidthHeightType::WH_ROW_BOTTOM );
    1765                 :          0 :                     nTblChgSize = pModOpt->GetTblHInsert();
    1766                 :            :                 }
    1767                 :          0 :                     goto KEYINPUT_CHECKTABLE_INSDEL;
    1768                 :            : 
    1769                 :            : KEYINPUT_CHECKTABLE_INSDEL:
    1770 [ #  # ][ #  # ]:          0 :                     if( rSh.IsTableMode() || !rSh.GetTableFmt() ||
         [ #  # ][ #  # ]
                 [ #  # ]
    1771                 :          0 :                         !bTblInsDelMode ||
    1772                 :            :                         sal_False /* table protected */
    1773                 :            :                             )
    1774                 :            :                     {
    1775         [ #  # ]:          0 :                         const int nSelectionType = rSh.GetSelectionType();
    1776                 :            : 
    1777                 :          0 :                         eKeyState = KS_KeyToView;
    1778         [ #  # ]:          0 :                         if(KS_KeyToView != eFlyState)
    1779                 :            :                         {
    1780   [ #  #  #  # ]:          0 :                             if((nSelectionType & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM))  &&
                 [ #  # ]
    1781         [ #  # ]:          0 :                                     rSh.GetDrawView()->AreObjectsMarked())
    1782                 :          0 :                                 eKeyState = KS_Draw_Change;
    1783         [ #  # ]:          0 :                             else if(nSelectionType & (nsSelectionType::SEL_FRM|nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF))
    1784                 :          0 :                                 eKeyState = KS_Fly_Change;
    1785                 :            :                         }
    1786                 :            :                     }
    1787                 :            :                     else
    1788                 :            :                     {
    1789         [ #  # ]:          0 :                         if( !bTblIsInsMode )
    1790                 :          0 :                             eTblChgMode = eTblChgMode | nsTblChgWidthHeightType::WH_FLAG_BIGGER;
    1791                 :          0 :                         eKeyState = KS_TblColCellInsDel;
    1792                 :            :                     }
    1793                 :          0 :                     break;
    1794                 :            : 
    1795                 :            :                 case KEY_DELETE:
    1796 [ #  # ][ #  # ]:          0 :                     if ( !rSh.HasReadonlySel() )
    1797                 :            :                     {
    1798 [ #  # ][ #  # ]:          0 :                         if (rSh.IsInFrontOfLabel() &&
         [ #  # ][ #  # ]
    1799         [ #  # ]:          0 :                             rSh.NumOrNoNum(sal_False))
    1800                 :          0 :                             eKeyState = KS_NumOrNoNum;
    1801                 :            :                     }
    1802                 :            :                     else
    1803                 :            :                     {
    1804 [ #  # ][ #  # ]:          0 :                         InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
                 [ #  # ]
    1805                 :          0 :                         eKeyState = KS_Ende;
    1806                 :            :                     }
    1807                 :          0 :                     break;
    1808                 :            : 
    1809                 :            :                 case KEY_DELETE | KEY_MOD2:
    1810 [ #  # ][ #  # ]:          0 :                     if( !rSh.IsTableMode() && rSh.GetTableFmt() )
         [ #  # ][ #  # ]
    1811                 :            :                     {
    1812                 :          0 :                         eKeyState = KS_Ende;
    1813                 :          0 :                         bTblInsDelMode = sal_True;
    1814                 :          0 :                         bTblIsInsMode = sal_False;
    1815                 :          0 :                         bTblIsColMode = sal_True;
    1816         [ #  # ]:          0 :                         aKeyInputTimer.Start();
    1817                 :          0 :                         bStopKeyInputTimer = sal_False;
    1818                 :            :                     }
    1819                 :          0 :                     break;
    1820                 :            :                 case KEY_INSERT | KEY_MOD2:
    1821 [ #  # ][ #  # ]:          0 :                     if( !rSh.IsTableMode() && rSh.GetTableFmt() )
         [ #  # ][ #  # ]
    1822                 :            :                     {
    1823                 :          0 :                         eKeyState = KS_Ende;
    1824                 :          0 :                         bTblInsDelMode = sal_True;
    1825                 :          0 :                         bTblIsInsMode = sal_True;
    1826                 :          0 :                         bTblIsColMode = sal_True;
    1827         [ #  # ]:          0 :                         aKeyInputTimer.Start();
    1828                 :          0 :                         bStopKeyInputTimer = sal_False;
    1829                 :            :                     }
    1830                 :          0 :                     break;
    1831                 :            : 
    1832                 :            :                 case KEY_RETURN:                // Return
    1833 [ #  # ][ #  # ]:          0 :                     if( !rSh.HasReadonlySel() )
    1834                 :            :                     {
    1835         [ #  # ]:          0 :                         const int nSelectionType = rSh.GetSelectionType();
    1836         [ #  # ]:          0 :                         if(nSelectionType & nsSelectionType::SEL_OLE)
    1837                 :          0 :                             eKeyState = KS_LaunchOLEObject;
    1838         [ #  # ]:          0 :                         else if(nSelectionType & nsSelectionType::SEL_FRM)
    1839                 :          0 :                             eKeyState = KS_GoIntoFly;
    1840         [ #  # ]:          0 :                         else if((nSelectionType & nsSelectionType::SEL_DRW) &&
           [ #  #  #  # ]
                 [ #  # ]
    1841                 :            :                                 0 == (nSelectionType & nsSelectionType::SEL_DRW_TXT) &&
    1842         [ #  # ]:          0 :                                 rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1)
    1843                 :          0 :                             eKeyState = KS_GoIntoDrawing;
    1844 [ #  # ][ #  # ]:          0 :                         else if( aTmpQHD.HasCntnt() && !rSh.HasSelection() &&
         [ #  # ][ #  # ]
                 [ #  # ]
    1845                 :            :                             aTmpQHD.m_bIsAutoText )
    1846                 :          0 :                             eKeyState = KS_GlossaryExpand;
    1847                 :            : 
    1848                 :            :                         //RETURN and empty paragraph in numbering -> end numbering
    1849         [ #  # ]:          0 :                         else if( !aInBuffer.Len() &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1850         [ #  # ]:          0 :                                  rSh.GetCurNumRule() &&
    1851         [ #  # ]:          0 :                                  !rSh.GetCurNumRule()->IsOutlineRule() &&
    1852         [ #  # ]:          0 :                                  !rSh.HasSelection() &&
    1853 [ #  # ][ #  # ]:          0 :                                 rSh.IsSttPara() && rSh.IsEndPara() )
    1854                 :          0 :                             eKeyState = KS_NumOff, eNextKeyState = KS_OutlineLvOff;
    1855                 :            : 
    1856                 :            :                         //RETURN for new paragraph with AutoFormating
    1857 [ #  # ][ #  # ]:          0 :                         else if( pACfg && pACfg->IsAutoFmtByInput() &&
         [ #  # ][ #  # ]
    1858                 :            :                                 !(nSelectionType & (nsSelectionType::SEL_GRF |
    1859                 :            :                                     nsSelectionType::SEL_OLE | nsSelectionType::SEL_FRM |
    1860                 :            :                                     nsSelectionType::SEL_TBL_CELLS | nsSelectionType::SEL_DRW |
    1861                 :          0 :                                     nsSelectionType::SEL_DRW_TXT)) )
    1862                 :          0 :                             eKeyState = KS_CheckAutoCorrect, eNextKeyState = KS_AutoFmtByInput;
    1863                 :            :                         else
    1864                 :          0 :                             eNextKeyState = eKeyState, eKeyState = KS_CheckAutoCorrect;
    1865                 :            :                     }
    1866                 :          0 :                     break;
    1867                 :            : 
    1868                 :            :                 case KEY_RETURN | KEY_MOD2:     // ALT-Return
    1869 [ #  # ][ #  # ]:          0 :                     if( !rSh.HasReadonlySel() && !rSh.IsSttPara() && rSh.GetCurNumRule() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1870                 :          0 :                         eKeyState = KS_NoNum;
    1871 [ #  # ][ #  # ]:          0 :                     else if( rSh.CanSpecialInsert() )
    1872                 :          0 :                         eKeyState = KS_SpecialInsert;
    1873                 :          0 :                     break;
    1874                 :            : 
    1875                 :            :                 case KEY_BACKSPACE:
    1876                 :            :                 case KEY_BACKSPACE | KEY_SHIFT:
    1877 [ #  # ][ #  # ]:          0 :                     if( !rSh.HasReadonlySel() )
    1878                 :            :                     {
    1879                 :          0 :                         sal_Bool bDone = sal_False;
    1880                 :            :                         // try to add comment for code snip:
    1881                 :            :                         // Remove the paragraph indent, if the cursor is at the
    1882                 :            :                         // beginning of a paragraph, there is no selection
    1883                 :            :                         // and no numbering rule found at the current paragraph
    1884                 :            :                         // Also try to remove indent, if current paragraph
    1885                 :            :                         // has numbering rule, but isn't counted and only
    1886                 :            :                         // key <backspace> is hit.
    1887                 :            :                         const bool bOnlyBackspaceKey(
    1888                 :          0 :                                     KEY_BACKSPACE == rKeyCode.GetFullCode() );
    1889 [ #  # ][ #  # ]:          0 :                         if ( rSh.IsSttPara() &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1890         [ #  # ]:          0 :                              !rSh.HasSelection() &&
    1891         [ #  # ]:          0 :                              ( NULL == rSh.GetCurNumRule() ||
    1892         [ #  # ]:          0 :                                ( rSh.IsNoNum() && bOnlyBackspaceKey ) ) )
    1893                 :            :                         {
    1894         [ #  # ]:          0 :                             bDone = rSh.TryRemoveIndent();
    1895                 :            :                         }
    1896                 :            : 
    1897         [ #  # ]:          0 :                         if (bDone)
    1898                 :          0 :                             eKeyState = KS_Ende;
    1899                 :            :                         else
    1900                 :            :                         {
    1901 [ #  # ][ #  # ]:          0 :                             if (rSh.IsSttPara() &&
         [ #  # ][ #  # ]
    1902         [ #  # ]:          0 :                                 ! rSh.IsNoNum())
    1903                 :            :                             {
    1904 [ #  # ][ #  # ]:          0 :                                 if (nKS_NUMDOWN_Count > 0 &&
                 [ #  # ]
    1905         [ #  # ]:          0 :                                     0 < rSh.GetNumLevel())
    1906                 :            :                                 {
    1907                 :          0 :                                     eKeyState = KS_NumUp;
    1908                 :          0 :                                     nKS_NUMDOWN_Count = 2;
    1909                 :          0 :                                     bDone = sal_True;
    1910                 :            :                                 }
    1911         [ #  # ]:          0 :                                 else if (nKS_NUMINDENTINC_Count > 0)
    1912                 :            :                                 {
    1913                 :          0 :                                     eKeyState = KS_NumIndentDec;
    1914                 :          0 :                                     nKS_NUMINDENTINC_Count = 2;
    1915                 :          0 :                                     bDone = sal_True;
    1916                 :            :                                 }
    1917                 :            :                             }
    1918                 :            : 
    1919                 :            :                             // If the cursor is in an empty paragraph, which has
    1920                 :            :                             // a numbering, but not the oultine numbering, and
    1921                 :            :                             // there is no selection, the numbering has to be
    1922                 :            :                             // deleted on key <Backspace>.
    1923                 :            :                             // Otherwise method <SwEditShell::NumOrNoNum(..)>
    1924                 :            :                             // should only change the <IsCounted()> state of
    1925                 :            :                             // the current paragraph depending of the key.
    1926                 :            :                             // On <backspace> it is set to <false>,
    1927                 :            :                             // on <shift-backspace> it is set to <true>.
    1928                 :            :                             // Thus, assure that method <SwEditShell::NumOrNum(..)>
    1929                 :            :                             // is only called for the intended purpose.
    1930                 :          0 :                             bool bCallNumOrNoNum( false );
    1931                 :            :                             {
    1932         [ #  # ]:          0 :                                 if ( !bDone )
    1933                 :            :                                 {
    1934 [ #  # ][ #  # ]:          0 :                                     if ( bOnlyBackspaceKey && !rSh.IsNoNum() )
         [ #  # ][ #  # ]
    1935                 :            :                                     {
    1936                 :          0 :                                         bCallNumOrNoNum = true;
    1937                 :            :                                     }
    1938 [ #  # ][ #  # ]:          0 :                                     else if ( !bOnlyBackspaceKey && rSh.IsNoNum() )
         [ #  # ][ #  # ]
    1939                 :            :                                     {
    1940                 :          0 :                                         bCallNumOrNoNum = true;
    1941                 :            :                                     }
    1942 [ #  # ][ #  # ]:          0 :                                     else if ( bOnlyBackspaceKey &&
         [ #  # ][ #  # ]
                 [ #  # ]
    1943 [ #  # ][ #  # ]:          0 :                                               rSh.IsSttPara() && rSh.IsEndPara() &&
    1944         [ #  # ]:          0 :                                               !rSh.HasSelection() )
    1945                 :            :                                     {
    1946         [ #  # ]:          0 :                                         const SwNumRule* pCurrNumRule( rSh.GetCurNumRule() );
    1947 [ #  # ][ #  # ]:          0 :                                         if ( pCurrNumRule &&
                 [ #  # ]
    1948         [ #  # ]:          0 :                                              pCurrNumRule != rSh.GetOutlineNumRule() )
    1949                 :            :                                         {
    1950                 :          0 :                                             bCallNumOrNoNum = true;
    1951                 :            :                                         }
    1952                 :            :                                     }
    1953                 :            :                                 }
    1954                 :            :                             }
    1955 [ #  # ][ #  # ]:          0 :                             if ( bCallNumOrNoNum &&
                 [ #  # ]
    1956         [ #  # ]:          0 :                                  rSh.NumOrNoNum( !bOnlyBackspaceKey, sal_True ) )
    1957                 :            :                             {
    1958                 :          0 :                                 eKeyState = KS_NumOrNoNum;
    1959                 :            :                             }
    1960                 :            :                         }
    1961                 :            :                     }
    1962                 :            :                     else
    1963                 :            :                     {
    1964 [ #  # ][ #  # ]:          0 :                         InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
                 [ #  # ]
    1965                 :          0 :                         eKeyState = KS_Ende;
    1966                 :            :                     }
    1967                 :          0 :                     break;
    1968                 :            : 
    1969                 :            :                 case KEY_RIGHT:
    1970                 :            :                     {
    1971                 :          0 :                         eFlyState = KS_Fly_Change;
    1972                 :          0 :                         nDir = MOVE_RIGHT_BIG;
    1973                 :          0 :                         eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL | nsTblChgWidthHeightType::WH_COL_RIGHT;
    1974                 :          0 :                         nTblChgSize = pModOpt->GetTblVInsert();
    1975                 :          0 :                         goto KEYINPUT_CHECKTABLE_INSDEL;
    1976                 :            :                     }
    1977                 :            :                 case KEY_TAB:
    1978                 :            :                 {
    1979                 :            : 
    1980                 :            : #ifdef SW_CRSR_TIMER
    1981                 :            :                     sal_Bool bOld = rSh.ChgCrsrTimerFlag( sal_False );
    1982                 :            : #endif
    1983 [ #  # ][ #  # ]:          0 :                     if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark() || rSh.GetChar(sal_False)==CH_TXT_ATR_FORMELEMENT)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1984                 :            :                     {
    1985                 :          0 :                         eKeyState=KS_GotoNextFieldMark;
    1986                 :            :                     }
    1987                 :            :                     else
    1988 [ #  # ][ #  # ]:          0 :                     if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1989         [ #  # ]:          0 :                         !rSh.HasReadonlySel() )
    1990                 :            :                     {
    1991 [ #  # ][ #  # ]:          0 :                         if ( rSh.IsFirstOfNumRule() &&
         [ #  # ][ #  # ]
    1992         [ #  # ]:          0 :                              numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() )
    1993                 :          0 :                             eKeyState = KS_NumIndentInc;
    1994                 :            :                         else
    1995                 :          0 :                             eKeyState = KS_NumDown;
    1996                 :            :                     }
    1997 [ #  # ][ #  # ]:          0 :                     else if ( rSh.GetTableFmt() )
    1998                 :            :                     {
    1999 [ #  # ][ #  # ]:          0 :                         if( rSh.HasSelection() || rSh.HasReadonlySel() )
         [ #  # ][ #  # ]
                 [ #  # ]
    2000                 :          0 :                             eKeyState = KS_NextCell;
    2001                 :            :                         else
    2002                 :          0 :                             eKeyState = KS_CheckAutoCorrect, eNextKeyState = KS_NextCell;
    2003                 :            :                     }
    2004 [ #  # ][ #  # ]:          0 :                     else if ( rSh.GetSelectionType() &
    2005                 :            :                                 (nsSelectionType::SEL_GRF |
    2006                 :            :                                     nsSelectionType::SEL_FRM |
    2007                 :            :                                     nsSelectionType::SEL_OLE |
    2008                 :            :                                     nsSelectionType::SEL_DRW |
    2009                 :            :                                     nsSelectionType::SEL_DRW_FORM))
    2010                 :            : 
    2011                 :          0 :                             eKeyState = KS_NextObject;
    2012                 :            :                     else
    2013                 :            :                     {
    2014                 :          0 :                         eKeyState = KS_InsTab;
    2015 [ #  # ][ #  # ]:          0 :                         if( rSh.IsSttOfPara() && !rSh.HasReadonlySel() )
         [ #  # ][ #  # ]
                 [ #  # ]
    2016                 :            :                         {
    2017         [ #  # ]:          0 :                             SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
    2018   [ #  #  #  # ]:          0 :                             if( pColl &&
         [ #  # ][ #  # ]
    2019                 :            : 
    2020                 :          0 :                                 pColl->IsAssignedToListLevelOfOutlineStyle()
    2021         [ #  # ]:          0 :                                 && MAXLEVEL-1 > pColl->GetAssignedOutlineStyleLevel() )
    2022                 :          0 :                                 eKeyState = KS_OutlineDown;
    2023                 :            :                         }
    2024                 :            :                     }
    2025                 :            : #ifdef SW_CRSR_TIMER
    2026                 :            :                     rSh.ChgCrsrTimerFlag( bOld );
    2027                 :            : #endif
    2028                 :            :                 }
    2029                 :          0 :                 break;
    2030                 :            :                 case KEY_TAB | KEY_SHIFT:
    2031                 :            :                 {
    2032                 :            : #ifdef SW_CRSR_TIMER
    2033                 :            :                     sal_Bool bOld = rSh.ChgCrsrTimerFlag( sal_False );
    2034                 :            :                     sal_Bool bOld = rSh.ChgCrsrTimerFlag( sal_False );
    2035                 :            : #endif
    2036 [ #  # ][ #  # ]:          0 :                     if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark()|| rSh.GetChar(sal_False)==CH_TXT_ATR_FORMELEMENT) {
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2037                 :          0 :                         eKeyState=KS_GotoPrevFieldMark;
    2038                 :            :                     }
    2039 [ #  # ][ #  # ]:          0 :                     else if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2040         [ #  # ]:          0 :                          !rSh.HasReadonlySel() )
    2041                 :            :                     {
    2042                 :            : 
    2043 [ #  # ][ #  # ]:          0 :                         if ( rSh.IsFirstOfNumRule() &&
         [ #  # ][ #  # ]
    2044         [ #  # ]:          0 :                              numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() )
    2045                 :          0 :                             eKeyState = KS_NumIndentDec;
    2046                 :            :                         else
    2047                 :          0 :                             eKeyState = KS_NumUp;
    2048                 :            :                     }
    2049 [ #  # ][ #  # ]:          0 :                     else if ( rSh.GetTableFmt() )
    2050                 :            :                     {
    2051 [ #  # ][ #  # ]:          0 :                         if( rSh.HasSelection() || rSh.HasReadonlySel() )
         [ #  # ][ #  # ]
                 [ #  # ]
    2052                 :          0 :                             eKeyState = KS_PrevCell;
    2053                 :            :                         else
    2054                 :          0 :                             eKeyState = KS_CheckAutoCorrect, eNextKeyState = KS_PrevCell;
    2055                 :            :                     }
    2056 [ #  # ][ #  # ]:          0 :                     else if ( rSh.GetSelectionType() &
    2057                 :            :                                 (nsSelectionType::SEL_GRF |
    2058                 :            :                                     nsSelectionType::SEL_FRM |
    2059                 :            :                                     nsSelectionType::SEL_OLE |
    2060                 :            :                                     nsSelectionType::SEL_DRW |
    2061                 :            :                                     nsSelectionType::SEL_DRW_FORM))
    2062                 :            : 
    2063                 :          0 :                             eKeyState = KS_PrevObject;
    2064                 :            :                     else
    2065                 :            :                     {
    2066                 :          0 :                         eKeyState = KS_Ende;
    2067 [ #  # ][ #  # ]:          0 :                         if( rSh.IsSttOfPara() && !rSh.HasReadonlySel() )
         [ #  # ][ #  # ]
                 [ #  # ]
    2068                 :            :                         {
    2069         [ #  # ]:          0 :                             SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
    2070   [ #  #  #  # ]:          0 :                             if( pColl &&
         [ #  # ][ #  # ]
    2071                 :          0 :                                 pColl->IsAssignedToListLevelOfOutlineStyle() &&
    2072         [ #  # ]:          0 :                                 0 < pColl->GetAssignedOutlineStyleLevel())
    2073                 :          0 :                                 eKeyState = KS_OutlineUp;
    2074                 :            :                         }
    2075                 :            :                     }
    2076                 :            : #ifdef SW_CRSR_TIMER
    2077                 :            :                     rSh.ChgCrsrTimerFlag( bOld );
    2078                 :            : #endif
    2079                 :            :                 }
    2080                 :          0 :                 break;
    2081                 :            :                 case KEY_TAB | KEY_MOD1:
    2082                 :            :                 case KEY_TAB | KEY_MOD2:
    2083 [ #  # ][ #  # ]:          0 :                     if( !rSh.HasReadonlySel() )
    2084                 :            :                     {
    2085 [ #  # ][ #  # ]:          0 :                         if( aTmpQHD.HasCntnt() && !rSh.HasSelection() )
         [ #  # ][ #  # ]
    2086                 :            :                         {
    2087                 :            :                             // Next auto-complete suggestion
    2088                 :            :                             aTmpQHD.Next( pACorr &&
    2089 [ #  # ][ #  # ]:          0 :                                           pACorr->GetSwFlags().bAutoCmpltEndless );
    2090                 :          0 :                             eKeyState = KS_NextPrevGlossary;
    2091                 :            :                         }
    2092 [ #  # ][ #  # ]:          0 :                         else if( rSh.GetTableFmt() )
    2093                 :          0 :                             eKeyState = KS_InsTab;
    2094         [ #  # ]:          0 :                         else if((rSh.GetSelectionType() &
           [ #  #  #  # ]
                 [ #  # ]
    2095                 :            :                                     (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM|
    2096                 :            :                                         nsSelectionType::SEL_FRM|nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF))  &&
    2097         [ #  # ]:          0 :                                 rSh.GetDrawView()->AreObjectsMarked())
    2098                 :          0 :                             eKeyState = KS_EnterDrawHandleMode;
    2099                 :            :                         else
    2100                 :            :                         {
    2101                 :          0 :                             eKeyState = KS_InsTab;
    2102                 :            :                         }
    2103                 :            :                     }
    2104                 :          0 :                     break;
    2105                 :            : 
    2106                 :            :                     case KEY_TAB | KEY_MOD1 | KEY_SHIFT:
    2107 [ #  # ][ #  # ]:          0 :                         if( aTmpQHD.HasCntnt() && !rSh.HasSelection() &&
         [ #  # ][ #  # ]
                 [ #  # ]
    2108         [ #  # ]:          0 :                             !rSh.HasReadonlySel() )
    2109                 :            :                         {
    2110                 :            :                             // Previous auto-complete suggestion.
    2111                 :            :                             aTmpQHD.Previous( pACorr &&
    2112 [ #  # ][ #  # ]:          0 :                                               pACorr->GetSwFlags().bAutoCmpltEndless );
    2113                 :          0 :                             eKeyState = KS_NextPrevGlossary;
    2114                 :            :                         }
    2115         [ #  # ]:          0 :                         else if((rSh.GetSelectionType() & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM|
           [ #  #  #  # ]
                 [ #  # ]
    2116                 :            :                                         nsSelectionType::SEL_FRM|nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF)) &&
    2117         [ #  # ]:          0 :                                 rSh.GetDrawView()->AreObjectsMarked())
    2118                 :          0 :                             eKeyState = KS_EnterDrawHandleMode;
    2119                 :          0 :                     break;
    2120                 :            :                     case KEY_F2 :
    2121 [ #  # ][ #  # ]:          0 :                     if( !rSh.HasReadonlySel() )
    2122                 :            :                     {
    2123         [ #  # ]:          0 :                         const int nSelectionType = rSh.GetSelectionType();
    2124         [ #  # ]:          0 :                         if(nSelectionType & nsSelectionType::SEL_FRM)
    2125                 :          0 :                             eKeyState = KS_GoIntoFly;
    2126         [ #  # ]:          0 :                         else if((nSelectionType & nsSelectionType::SEL_DRW))
    2127                 :          0 :                             eKeyState = KS_GoIntoDrawing;
    2128                 :            :                     }
    2129                 :          0 :                     break;
    2130                 :            :                 }
    2131                 :            :             }
    2132                 :          0 :             break;
    2133                 :            :         case KS_CheckDocReadOnlyKeys:
    2134                 :            :             {
    2135                 :          0 :                 eKeyState = KS_KeyToView;
    2136      [ #  #  # ]:          0 :                 switch( rKeyCode.GetModifier() | rKeyCode.GetCode() )
    2137                 :            :                 {
    2138                 :            :                     case KEY_TAB:
    2139                 :            :                     case KEY_TAB | KEY_SHIFT:
    2140                 :          0 :                         bNormalChar = sal_False;
    2141                 :          0 :                         eKeyState = KS_Ende;
    2142 [ #  # ][ #  # ]:          0 :                         if ( rSh.GetSelectionType() &
    2143                 :            :                                 (nsSelectionType::SEL_GRF |
    2144                 :            :                                     nsSelectionType::SEL_FRM |
    2145                 :            :                                     nsSelectionType::SEL_OLE |
    2146                 :            :                                     nsSelectionType::SEL_DRW |
    2147                 :            :                                     nsSelectionType::SEL_DRW_FORM))
    2148                 :            : 
    2149                 :            :                         {
    2150                 :          0 :                             eKeyState = rKeyCode.GetModifier() & KEY_SHIFT ?
    2151         [ #  # ]:          0 :                                                 KS_PrevObject : KS_NextObject;
    2152                 :            :                         }
    2153                 :            :                         else
    2154                 :            :                             rSh.SelectNextPrevHyperlink(
    2155         [ #  # ]:          0 :                                             KEY_SHIFT != rKeyCode.GetModifier() );
    2156                 :          0 :                     break;
    2157                 :            :                     case KEY_RETURN:
    2158                 :            :                     {
    2159         [ #  # ]:          0 :                         const int nSelectionType = rSh.GetSelectionType();
    2160         [ #  # ]:          0 :                         if(nSelectionType & nsSelectionType::SEL_FRM)
    2161                 :          0 :                             eKeyState = KS_GoIntoFly;
    2162                 :            :                         else
    2163                 :            :                         {
    2164 [ #  # ][ #  # ]:          0 :                             SfxItemSet aSet(rSh.GetAttrPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
    2165         [ #  # ]:          0 :                             rSh.GetCurAttr(aSet);
    2166 [ #  # ][ #  # ]:          0 :                             if(SFX_ITEM_SET == aSet.GetItemState(RES_TXTATR_INETFMT, sal_False))
    2167                 :            :                             {
    2168         [ #  # ]:          0 :                                 const SfxPoolItem& rItem = aSet.Get(RES_TXTATR_INETFMT, sal_True);
    2169                 :          0 :                                 bNormalChar = sal_False;
    2170                 :          0 :                                 eKeyState = KS_Ende;
    2171         [ #  # ]:          0 :                                 rSh.ClickToINetAttr((const SwFmtINetFmt&)rItem, URLLOAD_NOFILTER);
    2172         [ #  # ]:          0 :                             }
    2173                 :            :                         }
    2174                 :            :                     }
    2175                 :          0 :                     break;
    2176                 :            :                 }
    2177                 :            :             }
    2178                 :          0 :             break;
    2179                 :            : 
    2180                 :            :         case KS_EnterCharCell:
    2181                 :            :             {
    2182                 :          0 :                 eKeyState = KS_KeyToView;
    2183      [ #  #  # ]:          0 :                 switch ( rKeyCode.GetModifier() | rKeyCode.GetCode() )
    2184                 :            :                 {
    2185                 :            :                     case KEY_RIGHT | KEY_MOD2:
    2186         [ #  # ]:          0 :                         rSh.Right( CRSR_SKIP_CHARS, sal_False, 1, sal_False );
    2187                 :          0 :                         eKeyState = KS_Ende;
    2188         [ #  # ]:          0 :                         FlushInBuffer();
    2189                 :          0 :                         break;
    2190                 :            :                     case KEY_LEFT | KEY_MOD2:
    2191         [ #  # ]:          0 :                         rSh.Left( CRSR_SKIP_CHARS, sal_False, 1, sal_False );
    2192                 :          0 :                         eKeyState = KS_Ende;
    2193         [ #  # ]:          0 :                         FlushInBuffer();
    2194                 :          0 :                         break;
    2195                 :            :                 }
    2196                 :            :             }
    2197                 :          0 :             break;
    2198                 :            : 
    2199                 :            :         case KS_KeyToView:
    2200                 :            :             {
    2201                 :          0 :                 eKeyState = KS_Ende;
    2202                 :            :                 bNormalChar =
    2203                 :          0 :                     !rKeyCode.IsMod2() &&
    2204                 :          0 :                     rKeyCode.GetModifier() != (KEY_MOD1) &&
    2205                 :          0 :                     rKeyCode.GetModifier() != (KEY_MOD1|KEY_SHIFT) &&
    2206 [ #  # ][ #  # ]:          0 :                                 SW_ISPRINTABLE( aCh );
           [ #  #  #  #  
                   #  # ]
    2207                 :            : 
    2208 [ #  # ][ #  # ]:          0 :                 if (bNormalChar && rSh.IsInFrontOfLabel())
         [ #  # ][ #  # ]
    2209                 :            :                 {
    2210         [ #  # ]:          0 :                     rSh.NumOrNoNum(sal_False);
    2211                 :            :                 }
    2212                 :            : 
    2213 [ #  # ][ #  # ]:          0 :                 if( aInBuffer.Len() && ( !bNormalChar || bIsDocReadOnly ))
         [ #  # ][ #  # ]
    2214         [ #  # ]:          0 :                     FlushInBuffer();
    2215                 :            : 
    2216 [ #  # ][ #  # ]:          0 :                 if( rView.KeyInput( aKeyEvent ) )
    2217                 :          0 :                     bFlushBuffer = sal_True, bNormalChar = sal_False;
    2218                 :            :                 else
    2219                 :            :                 {
    2220                 :            :                     // Because Sfx accelerators are only called when they were
    2221                 :            :                     // enabled at the last status update, copy has to called
    2222                 :            :                     // 'forcefully' by us if necessary.
    2223 [ #  # ][ #  # ]:          0 :                     if( rKeyCode.GetFunction() == KEYFUNC_COPY )
    2224         [ #  # ]:          0 :                         GetView().GetViewFrame()->GetBindings().Execute(SID_COPY);
    2225                 :            : 
    2226 [ #  # ][ #  # ]:          0 :                     if( !bIsDocReadOnly && bNormalChar )
    2227                 :            :                     {
    2228         [ #  # ]:          0 :                         const int nSelectionType = rSh.GetSelectionType();
    2229         [ #  # ]:          0 :                         if((nSelectionType & nsSelectionType::SEL_DRW) &&
           [ #  #  #  # ]
                 [ #  # ]
    2230                 :            :                             0 == (nSelectionType & nsSelectionType::SEL_DRW_TXT) &&
    2231         [ #  # ]:          0 :                             rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1)
    2232                 :            :                         {
    2233 [ #  # ][ #  # ]:          0 :                             SdrObject* pObj = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                 [ #  # ]
    2234         [ #  # ]:          0 :                             if(pObj)
    2235                 :            :                             {
    2236 [ #  # ][ #  # ]:          0 :                                 EnterDrawTextMode(pObj->GetLogicRect().Center());
                 [ #  # ]
    2237 [ #  # ][ #  # ]:          0 :                                 if ( rView.GetCurShell()->ISA(SwDrawTextShell) )
                 [ #  # ]
    2238         [ #  # ]:          0 :                                     ((SwDrawTextShell*)rView.GetCurShell())->Init();
    2239 [ #  # ][ #  # ]:          0 :                                 rSh.GetDrawView()->KeyInput( rKEvt, this );
    2240                 :            :                             }
    2241                 :            :                         }
    2242         [ #  # ]:          0 :                         else if(nSelectionType & nsSelectionType::SEL_FRM)
    2243                 :            :                         {
    2244         [ #  # ]:          0 :                             rSh.UnSelectFrm();
    2245         [ #  # ]:          0 :                             rSh.LeaveSelFrmMode();
    2246         [ #  # ]:          0 :                             rView.AttrChangedNotify(&rSh);
    2247         [ #  # ]:          0 :                             rSh.MoveSection( fnSectionCurr, fnSectionEnd );
    2248                 :            :                         }
    2249                 :          0 :                         eKeyState = KS_InsChar;
    2250                 :            :                     }
    2251                 :            :                     else
    2252                 :            :                     {
    2253                 :          0 :                         bNormalChar = sal_False;
    2254         [ #  # ]:          0 :                         Window::KeyInput( aKeyEvent );
    2255                 :            :                     }
    2256                 :            :                 }
    2257                 :            :             }
    2258                 :          0 :             break;
    2259                 :            :         case KS_LaunchOLEObject:
    2260         [ #  # ]:          0 :             rSh.LaunchOLEObj();
    2261                 :          0 :             eKeyState = KS_Ende;
    2262                 :          0 :         break;
    2263                 :            :         case KS_GoIntoFly :
    2264         [ #  # ]:          0 :             rSh.UnSelectFrm();
    2265         [ #  # ]:          0 :             rSh.LeaveSelFrmMode();
    2266         [ #  # ]:          0 :             rView.AttrChangedNotify(&rSh);
    2267         [ #  # ]:          0 :             rSh.MoveSection( fnSectionCurr, fnSectionEnd );
    2268                 :          0 :             eKeyState = KS_Ende;
    2269                 :          0 :         break;
    2270                 :            :         case KS_GoIntoDrawing :
    2271                 :            :         {
    2272 [ #  # ][ #  # ]:          0 :             SdrObject* pObj = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                 [ #  # ]
    2273         [ #  # ]:          0 :             if(pObj)
    2274                 :            :             {
    2275 [ #  # ][ #  # ]:          0 :                 EnterDrawTextMode(pObj->GetLogicRect().Center());
                 [ #  # ]
    2276 [ #  # ][ #  # ]:          0 :                 if ( rView.GetCurShell()->ISA(SwDrawTextShell) )
                 [ #  # ]
    2277         [ #  # ]:          0 :                     ((SwDrawTextShell*)rView.GetCurShell())->Init();
    2278                 :            :             }
    2279                 :          0 :             eKeyState = KS_Ende;
    2280                 :            :         }
    2281                 :          0 :         break;
    2282                 :            :         case KS_EnterDrawHandleMode:
    2283                 :            :         {
    2284         [ #  # ]:          0 :             const SdrHdlList& rHdlList = rSh.GetDrawView()->GetHdlList();
    2285                 :          0 :             sal_Bool bForward(!aKeyEvent.GetKeyCode().IsShift());
    2286                 :            : 
    2287         [ #  # ]:          0 :             ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
    2288                 :          0 :             eKeyState = KS_Ende;
    2289                 :            :         }
    2290                 :          0 :         break;
    2291                 :            :         case KS_InsTab:
    2292 [ #  # ][ #  # ]:          0 :             if( rView.ISA( SwWebView ))     // no Tab for WebView
                 [ #  # ]
    2293                 :            :             {
    2294                 :            :                 // then it should be passed along
    2295         [ #  # ]:          0 :                 Window::KeyInput( aKeyEvent );
    2296                 :          0 :                 eKeyState = KS_Ende;
    2297                 :          0 :                 break;
    2298                 :            :             }
    2299                 :          0 :             aCh = '\t';
    2300                 :            :             // no break!
    2301                 :            :         case KS_InsChar:
    2302 [ #  # ][ #  # ]:          0 :             if (rSh.GetChar(sal_False)==CH_TXT_ATR_FORMELEMENT)
    2303                 :            :             {
    2304                 :            :                 ::sw::mark::ICheckboxFieldmark* pFieldmark =
    2305                 :            :                     dynamic_cast< ::sw::mark::ICheckboxFieldmark* >
    2306 [ #  # ][ #  # ]:          0 :                         (rSh.GetCurrentFieldmark());
    2307                 :            :                 OSL_ENSURE(pFieldmark,
    2308                 :            :                     "Where is my FieldMark??");
    2309         [ #  # ]:          0 :                 if(pFieldmark)
    2310                 :            :                 {
    2311 [ #  # ][ #  # ]:          0 :                     pFieldmark->SetChecked(!pFieldmark->IsChecked());
    2312         [ #  # ]:          0 :                     SwDocShell* pDocSh = rView.GetDocShell();
    2313                 :          0 :                     SwDoc *pDoc=pDocSh->GetDoc();
    2314                 :            :                     OSL_ENSURE(pFieldmark->IsExpanded(),
    2315                 :            :                         "where is the otherpos?");
    2316 [ #  # ][ #  # ]:          0 :                     if (pFieldmark->IsExpanded())
    2317                 :            :                     {
    2318 [ #  # ][ #  # ]:          0 :                         SwPaM aPaM(pFieldmark->GetMarkPos(), pFieldmark->GetOtherMarkPos());
                 [ #  # ]
    2319                 :            :                         if(0)
    2320                 :            :                         {
    2321                 :            :                             rSh.StartAllAction();  //$flr TODO: understand why this not works
    2322                 :            :                             pDoc->SetModified(aPaM);
    2323                 :            :                             rSh.EndAllAction();
    2324                 :            :                         }
    2325                 :            :                         else
    2326                 :            :                         {
    2327         [ #  # ]:          0 :                             rSh.CalcLayout(); // workaround
    2328         [ #  # ]:          0 :                         }
    2329                 :            :                     }
    2330                 :            :                 }
    2331                 :          0 :                 eKeyState = KS_Ende;
    2332                 :            :             }
    2333 [ #  # ][ #  # ]:          0 :             else if(!rSh.HasReadonlySel())
    2334                 :            :             {
    2335         [ #  # ]:          0 :                 sal_Bool bIsNormalChar = GetAppCharClass().isLetterNumeric(
    2336 [ #  # ][ #  # ]:          0 :                                                             rtl::OUString( aCh ), 0 );
                 [ #  # ]
    2337   [ #  #  #  # ]:          0 :                 if( bAppendSpace && bIsNormalChar &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2338 [ #  # ][ #  # ]:          0 :                     (aInBuffer.Len() || !rSh.IsSttPara() || !rSh.IsEndPara() ))
    2339                 :            :                 {
    2340                 :            :                     // insert a blank ahead of the character. this ends up
    2341                 :            :                     // between the expanded text and the new "non-word-seperator".
    2342         [ #  # ]:          0 :                     aInBuffer.Expand( aInBuffer.Len() + 1, ' ' );
    2343                 :            :                 }
    2344                 :            : 
    2345         [ #  # ]:          0 :                 sal_Bool bIsAutoCorrectChar =  SvxAutoCorrect::IsAutoCorrectChar( aCh );
    2346 [ #  # ][ #  # ]:          0 :                 sal_Bool bRunNext = pACorr && pACorr->HasRunNext();
    2347 [ #  # ][ #  # ]:          0 :                 if( !aKeyEvent.GetRepeat() && pACorr && ( bIsAutoCorrectChar || bRunNext ) &&
         [ #  # ][ #  #  
             #  #  #  # ]
                 [ #  # ]
           [ #  #  #  # ]
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    2348                 :          0 :                         pACfg->IsAutoFmtByInput() &&
    2349                 :          0 :                     (( pACorr->IsAutoCorrFlag( ChgWeightUnderl ) &&
    2350                 :            :                         ( '*' == aCh || '_' == aCh ) ) ||
    2351                 :          0 :                      ( pACorr->IsAutoCorrFlag( ChgQuotes ) && ('\"' == aCh ))||
    2352                 :          0 :                      ( pACorr->IsAutoCorrFlag( ChgSglQuotes ) && ( '\'' == aCh))))
    2353                 :            :                 {
    2354         [ #  # ]:          0 :                     FlushInBuffer();
    2355         [ #  # ]:          0 :                     rSh.AutoCorrect( *pACorr, aCh );
    2356 [ #  # ][ #  # ]:          0 :                     if( '\"' != aCh && '\'' != aCh )        // only call when "*_"!
    2357                 :          0 :                         rSh.UpdateAttr();
    2358                 :            :                 }
    2359 [ #  # ][ #  # ]:          0 :                 else if( !aKeyEvent.GetRepeat() && pACorr && ( bIsAutoCorrectChar || bRunNext ) &&
         [ #  # ][ #  #  
             #  #  #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2360                 :          0 :                         pACfg->IsAutoFmtByInput() &&
    2361                 :            :                     pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
    2362                 :            :                                             ChgOrdinalNumber | AddNonBrkSpace |
    2363                 :            :                                             ChgToEnEmDash | SetINetAttr |
    2364                 :          0 :                                             Autocorrect ) &&
    2365                 :            :                     '\"' != aCh && '\'' != aCh && '*' != aCh && '_' != aCh
    2366                 :            :                     )
    2367                 :            :                 {
    2368         [ #  # ]:          0 :                     FlushInBuffer();
    2369         [ #  # ]:          0 :                     rSh.AutoCorrect( *pACorr, aCh );
    2370                 :            :                 }
    2371                 :            :                 else
    2372                 :            :                 {
    2373         [ #  # ]:          0 :                     aInBuffer.Expand( aInBuffer.Len() + aKeyEvent.GetRepeat() + 1,aCh );
    2374         [ #  # ]:          0 :                     bFlushCharBuffer = Application::AnyInput( VCL_INPUT_KEYBOARD );
    2375                 :          0 :                     bFlushBuffer = !bFlushCharBuffer;
    2376         [ #  # ]:          0 :                     if( bFlushCharBuffer )
    2377         [ #  # ]:          0 :                         aKeyInputFlushTimer.Start();
    2378                 :            :                 }
    2379                 :          0 :                 eKeyState = KS_Ende;
    2380                 :            :             }
    2381                 :            :             else
    2382                 :            :             {
    2383 [ #  # ][ #  # ]:          0 :                 InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
                 [ #  # ]
    2384                 :          0 :                 eKeyState = KS_Ende;
    2385                 :            :             }
    2386                 :          0 :         break;
    2387                 :            : 
    2388                 :            :         case KS_CheckAutoCorrect:
    2389                 :            :         {
    2390         [ #  # ]:          0 :             if( pACorr && pACfg->IsAutoFmtByInput() &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    2391                 :            :                 pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
    2392                 :            :                                         ChgOrdinalNumber |
    2393                 :            :                                         ChgToEnEmDash | SetINetAttr |
    2394                 :          0 :                                         Autocorrect ) &&
    2395         [ #  # ]:          0 :                 !rSh.HasReadonlySel() )
    2396                 :            :             {
    2397         [ #  # ]:          0 :                 FlushInBuffer();
    2398         [ #  # ]:          0 :                 rSh.AutoCorrect( *pACorr, static_cast< sal_Unicode >('\0') );
    2399                 :            :             }
    2400                 :          0 :             eKeyState = eNextKeyState;
    2401                 :            :         }
    2402                 :          0 :         break;
    2403                 :            : 
    2404                 :            :         default:
    2405                 :            :         {
    2406                 :          0 :             sal_uInt16 nSlotId = 0;
    2407         [ #  # ]:          0 :             FlushInBuffer();
    2408   [ #  #  #  #  :          0 :             switch( eKeyState )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
    2409                 :            :             {
    2410                 :            :             case KS_SpecialInsert:
    2411         [ #  # ]:          0 :                 rSh.DoSpecialInsert();
    2412                 :          0 :                 break;
    2413                 :            : 
    2414                 :            :             case KS_NoNum:
    2415         [ #  # ]:          0 :                 rSh.NoNum();
    2416                 :          0 :                 break;
    2417                 :            : 
    2418                 :            :             case KS_NumOff:
    2419                 :            :                 // shell change - so record in advance
    2420         [ #  # ]:          0 :                 rSh.DelNumRules();
    2421                 :          0 :                 eKeyState = eNextKeyState;
    2422                 :          0 :                 break;
    2423                 :            :             case KS_OutlineLvOff: // delete autofmt outlinelevel later
    2424                 :          0 :                 break;
    2425                 :            : 
    2426                 :            :             case KS_NumDown:
    2427         [ #  # ]:          0 :                 rSh.NumUpDown( sal_True );
    2428                 :          0 :                 nKS_NUMDOWN_Count = 2;
    2429                 :          0 :                 break;
    2430                 :            :             case KS_NumUp:
    2431         [ #  # ]:          0 :                 rSh.NumUpDown( sal_False );
    2432                 :          0 :                 break;
    2433                 :            : 
    2434                 :            :             case KS_NumIndentInc:
    2435         [ #  # ]:          0 :                 rSh.ChangeIndentOfAllListLevels(360);
    2436                 :          0 :                 nKS_NUMINDENTINC_Count = 2;
    2437                 :          0 :                 break;
    2438                 :            : 
    2439                 :            :             case KS_GotoNextFieldMark:
    2440                 :            :                 {
    2441         [ #  # ]:          0 :                     ::sw::mark::IFieldmark const * const pFieldmark = rSh.GetFieldmarkAfter();
    2442 [ #  # ][ #  # ]:          0 :                     if(pFieldmark) rSh.GotoFieldmark(pFieldmark);
    2443                 :            :                 }
    2444                 :          0 :                 break;
    2445                 :            : 
    2446                 :            :             case KS_GotoPrevFieldMark:
    2447                 :            :                 {
    2448         [ #  # ]:          0 :                     ::sw::mark::IFieldmark const * const pFieldmark = rSh.GetFieldmarkBefore();
    2449 [ #  # ][ #  # ]:          0 :                     if(pFieldmark) rSh.GotoFieldmark(pFieldmark);
    2450                 :            :                 }
    2451                 :          0 :                 break;
    2452                 :            : 
    2453                 :            :             case KS_NumIndentDec:
    2454         [ #  # ]:          0 :                 rSh.ChangeIndentOfAllListLevels(-360);
    2455                 :          0 :                 break;
    2456                 :            : 
    2457                 :            :             case KS_OutlineDown:
    2458         [ #  # ]:          0 :                 rSh.OutlineUpDown( 1 );
    2459                 :          0 :                 break;
    2460                 :            :             case KS_OutlineUp:
    2461         [ #  # ]:          0 :                 rSh.OutlineUpDown( -1 );
    2462                 :          0 :                 break;
    2463                 :            : 
    2464                 :            :             case KS_NextCell:
    2465                 :            :                 // always 'flush' in tables
    2466         [ #  # ]:          0 :                 rSh.GoNextCell();
    2467                 :          0 :                 nSlotId = FN_GOTO_NEXT_CELL;
    2468                 :          0 :                 break;
    2469                 :            :             case KS_PrevCell:
    2470         [ #  # ]:          0 :                 rSh.GoPrevCell();
    2471                 :          0 :                 nSlotId = FN_GOTO_PREV_CELL;
    2472                 :          0 :                 break;
    2473                 :            :             case KS_AutoFmtByInput:
    2474         [ #  # ]:          0 :                 rSh.SplitNode( sal_True );
    2475                 :          0 :                 break;
    2476                 :            : 
    2477                 :            :             case KS_NextObject:
    2478                 :            :             case KS_PrevObject:
    2479 [ #  # ][ #  # ]:          0 :                 if(rSh.GotoObj( KS_NextObject == eKeyState, GOTOOBJ_GOTO_ANY))
    2480                 :            :                 {
    2481         [ #  # ]:          0 :                     if( rSh.IsFrmSelected() &&
           [ #  #  #  # ]
                 [ #  # ]
    2482                 :          0 :                         rView.GetDrawFuncPtr() )
    2483                 :            :                     {
    2484         [ #  # ]:          0 :                         rView.GetDrawFuncPtr()->Deactivate();
    2485         [ #  # ]:          0 :                         rView.SetDrawFuncPtr(NULL);
    2486         [ #  # ]:          0 :                         rView.LeaveDrawCreate();
    2487         [ #  # ]:          0 :                         rView.AttrChangedNotify( &rSh );
    2488                 :            :                     }
    2489         [ #  # ]:          0 :                     rSh.HideCrsr();
    2490         [ #  # ]:          0 :                     rSh.EnterSelFrmMode();
    2491                 :            :                 }
    2492                 :          0 :             break;
    2493                 :            :             case KS_GlossaryExpand:
    2494                 :            :             {
    2495                 :            :                 // replace the word or abbreviation with the auto text
    2496         [ #  # ]:          0 :                 rSh.StartUndo( UNDO_START );
    2497                 :            : 
    2498 [ #  # ][ #  # ]:          0 :                 String sFnd( aTmpQHD.m_aHelpStrings[ aTmpQHD.nCurArrPos ] );
    2499         [ #  # ]:          0 :                 if( aTmpQHD.m_bIsAutoText )
    2500                 :            :                 {
    2501         [ #  # ]:          0 :                     SwGlossaryList* pList = ::GetGlossaryList();
    2502         [ #  # ]:          0 :                     String sShrtNm;
    2503         [ #  # ]:          0 :                     String sGroup;
    2504 [ #  # ][ #  # ]:          0 :                     if(pList->GetShortName( sFnd, sShrtNm, sGroup))
    2505                 :            :                     {
    2506         [ #  # ]:          0 :                         rSh.SttSelect();
    2507         [ #  # ]:          0 :                         rSh.ExtendSelection( sal_False, aTmpQHD.nLen );
    2508         [ #  # ]:          0 :                         SwGlossaryHdl* pGlosHdl = GetView().GetGlosHdl();
    2509         [ #  # ]:          0 :                         pGlosHdl->SetCurGroup(sGroup, sal_True);
    2510         [ #  # ]:          0 :                         pGlosHdl->InsertGlossary( sShrtNm);
    2511                 :          0 :                         pQuickHlpData->m_bAppendSpace = true;
    2512 [ #  # ][ #  # ]:          0 :                     }
    2513                 :            :                 }
    2514                 :            :                 else
    2515                 :            :                 {
    2516 [ #  # ][ #  # ]:          0 :                     rSh.Insert( sFnd.Erase( 0, aTmpQHD.nLen ));
    2517                 :            :                     pQuickHlpData->m_bAppendSpace = !pACorr ||
    2518 [ #  # ][ #  # ]:          0 :                             pACorr->GetSwFlags().bAutoCmpltAppendBlanc;
    2519                 :            :                 }
    2520 [ #  # ][ #  # ]:          0 :                 rSh.EndUndo( UNDO_END );
    2521                 :            :             }
    2522                 :          0 :             break;
    2523                 :            : 
    2524                 :            :             case KS_NextPrevGlossary:
    2525                 :          0 :                 pQuickHlpData->Move( aTmpQHD );
    2526         [ #  # ]:          0 :                 pQuickHlpData->Start( rSh, USHRT_MAX );
    2527                 :          0 :                 break;
    2528                 :            : 
    2529                 :            :             case KS_EditFormula:
    2530                 :            :             {
    2531         [ #  # ]:          0 :                 const sal_uInt16 nId = SwInputChild::GetChildWindowId();
    2532                 :            : 
    2533                 :          0 :                 SfxViewFrame* pVFrame = GetView().GetViewFrame();
    2534         [ #  # ]:          0 :                 pVFrame->ToggleChildWindow( nId );
    2535                 :            :                 SwInputChild* pChildWin = (SwInputChild*)pVFrame->
    2536         [ #  # ]:          0 :                                                     GetChildWindow( nId );
    2537         [ #  # ]:          0 :                 if( pChildWin )
    2538         [ #  # ]:          0 :                     pChildWin->SetFormula( sFmlEntry );
    2539                 :            :             }
    2540                 :          0 :             break;
    2541                 :            : 
    2542         [ #  # ]:          0 :             case KS_ColLeftBig:         rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() );   break;
    2543         [ #  # ]:          0 :             case KS_ColRightBig:        rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() );  break;
    2544         [ #  # ]:          0 :             case KS_ColLeftSmall:       rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_LEFT, pModOpt->GetTblHMove() );   break;
    2545         [ #  # ]:          0 :             case KS_ColRightSmall:      rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_RIGHT, pModOpt->GetTblHMove() );  break;
    2546         [ #  # ]:          0 :             case KS_ColBottomBig:       rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() ); break;
    2547         [ #  # ]:          0 :             case KS_ColBottomSmall:     rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_BOTTOM, pModOpt->GetTblVMove() ); break;
    2548         [ #  # ]:          0 :             case KS_CellLeftBig:        rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() );  break;
    2549         [ #  # ]:          0 :             case KS_CellRightBig:       rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break;
    2550         [ #  # ]:          0 :             case KS_CellLeftSmall:      rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_LEFT, pModOpt->GetTblHMove() );  break;
    2551         [ #  # ]:          0 :             case KS_CellRightSmall:     rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_RIGHT, pModOpt->GetTblHMove() ); break;
    2552         [ #  # ]:          0 :             case KS_CellTopBig:         rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() );   break;
    2553         [ #  # ]:          0 :             case KS_CellBottomBig:      rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() );    break;
    2554         [ #  # ]:          0 :             case KS_CellTopSmall:       rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_TOP, pModOpt->GetTblVMove() );   break;
    2555         [ #  # ]:          0 :             case KS_CellBottomSmall:    rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_BOTTOM, pModOpt->GetTblVMove() );    break;
    2556                 :            : 
    2557                 :            : //---------------
    2558         [ #  # ]:          0 :             case KS_InsDel_ColLeftBig:          rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() ); break;
    2559         [ #  # ]:          0 :             case KS_InsDel_ColRightBig:         rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() );    break;
    2560         [ #  # ]:          0 :             case KS_InsDel_ColLeftSmall:        rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_LEFT, pModOpt->GetTblHInsert() ); break;
    2561         [ #  # ]:          0 :             case KS_InsDel_ColRightSmall:       rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_RIGHT, pModOpt->GetTblHInsert() );    break;
    2562         [ #  # ]:          0 :             case KS_InsDel_ColTopBig:           rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() );  break;
    2563         [ #  # ]:          0 :             case KS_InsDel_ColBottomBig:        rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() );   break;
    2564         [ #  # ]:          0 :             case KS_InsDel_ColTopSmall:         rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_TOP, pModOpt->GetTblVInsert() );  break;
    2565         [ #  # ]:          0 :             case KS_InsDel_ColBottomSmall:      rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_BOTTOM, pModOpt->GetTblVInsert() );   break;
    2566         [ #  # ]:          0 :             case KS_InsDel_CellLeftBig:         rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() );    break;
    2567         [ #  # ]:          0 :             case KS_InsDel_CellRightBig:        rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() );   break;
    2568         [ #  # ]:          0 :             case KS_InsDel_CellLeftSmall:       rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_LEFT, pModOpt->GetTblHInsert() );    break;
    2569         [ #  # ]:          0 :             case KS_InsDel_CellRightSmall:      rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_RIGHT, pModOpt->GetTblHInsert() );   break;
    2570         [ #  # ]:          0 :             case KS_InsDel_CellTopBig:          rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() ); break;
    2571         [ #  # ]:          0 :             case KS_InsDel_CellBottomBig:       rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() );  break;
    2572         [ #  # ]:          0 :             case KS_InsDel_CellTopSmall:        rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_TOP, pModOpt->GetTblVInsert() ); break;
    2573         [ #  # ]:          0 :             case KS_InsDel_CellBottomSmall:     rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_BOTTOM, pModOpt->GetTblVInsert() );  break;
    2574                 :            : //---------------
    2575                 :            :             case KS_TblColCellInsDel:
    2576         [ #  # ]:          0 :                 rSh.SetColRowWidthHeight( eTblChgMode, nTblChgSize );
    2577                 :          0 :                 break;
    2578                 :            :             case KS_Fly_Change:
    2579                 :            :             {
    2580         [ #  # ]:          0 :                 SdrView *pSdrView = rSh.GetDrawView();
    2581                 :          0 :                 const SdrHdlList& rHdlList = pSdrView->GetHdlList();
    2582 [ #  # ][ #  # ]:          0 :                 if(rHdlList.GetFocusHdl())
    2583         [ #  # ]:          0 :                     ChangeDrawing( nDir );
    2584                 :            :                 else
    2585 [ #  # ][ #  # ]:          0 :                     ChangeFly( nDir, rView.ISA( SwWebView ) );
                 [ #  # ]
    2586                 :            :             }
    2587                 :          0 :             break;
    2588                 :            :             case KS_Draw_Change :
    2589         [ #  # ]:          0 :                 ChangeDrawing( nDir );
    2590                 :          0 :                 break;
    2591                 :            :             default:; //prevent warning
    2592                 :            :             }
    2593 [ #  # ][ #  # ]:          0 :             if( nSlotId && rView.GetViewFrame()->GetBindings().GetRecorder().is() )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    2594                 :            :             {
    2595         [ #  # ]:          0 :                 SfxRequest aReq(rView.GetViewFrame(), nSlotId );
    2596 [ #  # ][ #  # ]:          0 :                 aReq.Done();
    2597                 :            :             }
    2598                 :          0 :             eKeyState = KS_Ende;
    2599                 :            :         }
    2600                 :            :         }
    2601                 :            :     }
    2602                 :            : 
    2603         [ #  # ]:          0 :     if( bStopKeyInputTimer )
    2604                 :            :     {
    2605         [ #  # ]:          0 :         aKeyInputTimer.Stop();
    2606                 :          0 :         bTblInsDelMode = sal_False;
    2607                 :            :     }
    2608                 :            : 
    2609                 :            :     // in case the buffered characters are inserted
    2610 [ #  # ][ #  # ]:          0 :     if( bFlushBuffer && aInBuffer.Len() )
                 [ #  # ]
    2611                 :            :     {
    2612                 :            :         // bFlushCharBuffer was not resetted here
    2613                 :            :         // why not?
    2614                 :          0 :         sal_Bool bSave = bFlushCharBuffer;
    2615         [ #  # ]:          0 :         FlushInBuffer();
    2616                 :          0 :         bFlushCharBuffer = bSave;
    2617                 :            : 
    2618                 :            :         // maybe show Tip-Help
    2619         [ #  # ]:          0 :         String sWord;
    2620 [ #  # ][ #  # ]:          0 :         if( bNormalChar && pACfg && pACorr &&
           [ #  #  #  #  
           #  # ][ #  # ]
                 [ #  # ]
    2621                 :          0 :             ( pACfg->IsAutoTextTip() ||
    2622                 :          0 :               pACorr->GetSwFlags().bAutoCompleteWords ) &&
    2623         [ #  # ]:          0 :             rSh.GetPrevAutoCorrWord( *pACorr, sWord ) )
    2624                 :            :         {
    2625         [ #  # ]:          0 :             ShowAutoTextCorrectQuickHelp(sWord, pACfg, pACorr);
    2626         [ #  # ]:          0 :         }
    2627                 :            :     }
    2628                 :            : 
    2629                 :            :     // get the word count dialog to update itself
    2630 [ #  # ][ #  # ]:          0 :     SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)GetView().GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
    2631         [ #  # ]:          0 :     if (pWrdCnt)
    2632 [ #  # ][ #  # ]:          0 :         pWrdCnt->UpdateCounts();
                 [ #  # ]
    2633                 :            : 
    2634                 :            : }
    2635                 :            : 
    2636                 :            : /*--------------------------------------------------------------------
    2637                 :            :      Description:  MouseEvents
    2638                 :            :  --------------------------------------------------------------------*/
    2639                 :            : 
    2640                 :          0 : void SwEditWin::RstMBDownFlags()
    2641                 :            : {
    2642                 :            :     // Not on all systems a MouseButtonUp is used ahead
    2643                 :            :     // of the modal dialog (like on WINDOWS).
    2644                 :            :     // So reset the statuses here and release the mouse
    2645                 :            :     // for the dialog.
    2646                 :          0 :     bMBPressed = bNoInterrupt = sal_False;
    2647                 :          0 :     EnterArea();
    2648                 :          0 :     ReleaseMouse();
    2649                 :          0 : }
    2650                 :            : 
    2651                 :          0 : void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
    2652                 :            : {
    2653                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
    2654                 :            : 
    2655                 :            :     // We have to check if a context menu is shown and we have an UI
    2656                 :            :     // active inplace client. In that case we have to ignore the mouse
    2657                 :            :     // button down event. Otherwise we would crash (context menu has been
    2658                 :            :     // opened by inplace client and we would deactivate the inplace client,
    2659                 :            :     // the contex menu is closed by VCL asynchronously which in the end
    2660                 :            :     // would work on deleted objects or the context menu has no parent anymore)
    2661         [ #  # ]:          0 :     SfxInPlaceClient* pIPClient = rSh.GetSfxViewShell()->GetIPClient();
    2662 [ #  # ][ #  # ]:          0 :     sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
                 [ #  # ]
    2663                 :            : 
    2664 [ #  # ][ #  # ]:          0 :     if ( bIsOleActive && PopupMenu::IsInExecute() )
         [ #  # ][ #  # ]
    2665                 :            :         return;
    2666                 :            : 
    2667                 :          0 :     MouseEvent rMEvt(_rMEvt);
    2668                 :            : 
    2669 [ #  # ][ #  # ]:          0 :     if (rView.GetPostItMgr()->IsHit(rMEvt.GetPosPixel()))
    2670                 :            :         return;
    2671                 :            : 
    2672         [ #  # ]:          0 :     rView.GetPostItMgr()->SetActiveSidebarWin(0);
    2673                 :            : 
    2674         [ #  # ]:          0 :     GrabFocus();
    2675                 :            : 
    2676                 :            :     //ignore key modifiers for format paintbrush
    2677                 :            :     {
    2678                 :            :         sal_Bool bExecFormatPaintbrush = pApplyTempl && pApplyTempl->pFormatClipboard
    2679 [ #  # ][ #  # ]:          0 :                                 &&  pApplyTempl->pFormatClipboard->HasContent();
         [ #  # ][ #  # ]
    2680         [ #  # ]:          0 :         if( bExecFormatPaintbrush )
    2681                 :          0 :             rMEvt = MouseEvent( _rMEvt.GetPosPixel(), _rMEvt.GetClicks(),
    2682         [ #  # ]:          0 :                                     _rMEvt.GetMode(), _rMEvt.GetButtons() );
    2683                 :            :     }
    2684                 :            : 
    2685                 :          0 :     bWasShdwCrsr = 0 != pShadCrsr;
    2686 [ #  # ][ #  # ]:          0 :     delete pShadCrsr, pShadCrsr = 0;
    2687                 :            : 
    2688         [ #  # ]:          0 :     const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) );
    2689                 :            : 
    2690                 :            :     FrameControlType eControl;
    2691         [ #  # ]:          0 :     bool bIsInHF = IsInHeaderFooter( aDocPos, eControl );
    2692         [ #  # ]:          0 :     if ( !m_sTmpHFPageStyle.isEmpty( ) )
    2693                 :            :     {
    2694                 :            :         // Are we clicking outside the temporary header/footer? if so remove it
    2695 [ #  # ][ #  # ]:          0 :         rtl::OUString sStyleName = rSh.GetCurPageStyle( false );
                 [ #  # ]
    2696                 :          0 :         bool bMatchesTmpHF = sStyleName == m_sTmpHFPageStyle &&
    2697                 :            :                         ( ( m_bTmpHFIsHeader && eControl == Header ) ||
    2698 [ #  # ][ #  # ]:          0 :                           ( !m_bTmpHFIsHeader && eControl == Footer ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    2699                 :            : 
    2700 [ #  # ][ #  # ]:          0 :         if ( ( !bIsInHF && rSh.IsHeaderFooterEdit( ) ) || !bMatchesTmpHF )
         [ #  # ][ #  # ]
    2701 [ #  # ][ #  # ]:          0 :             rSh.ChangeHeaderOrFooter( m_sTmpHFPageStyle, m_bTmpHFIsHeader, false, false );
                 [ #  # ]
    2702                 :            : 
    2703                 :          0 :         m_sTmpHFPageStyle = rtl::OUString( );
    2704                 :            :     }
    2705                 :            : 
    2706                 :            :     // Are we clicking on a blank header/footer area?
    2707 [ #  # ][ #  # ]:          0 :     if ( bIsInHF && !rSh.IsHeaderFooterEdit( ) )
                 [ #  # ]
    2708                 :            :     {
    2709                 :            :         // Create empty header/footer under the cursor and switch to it
    2710 [ #  # ][ #  # ]:          0 :         const SwPageFrm* pPageFrm = rSh.GetLayout()->GetPageAtPos( aDocPos );
    2711                 :            : 
    2712                 :            :         // Is it active?
    2713                 :          0 :         bool bActive = true;
    2714                 :          0 :         const SwPageDesc* pDesc = pPageFrm->GetPageDesc();
    2715                 :            : 
    2716                 :          0 :         const SwFrmFmt* pFmt = pDesc->GetLeftFmt();
    2717 [ #  # ][ #  # ]:          0 :         if ( pPageFrm->OnRightPage() )
    2718                 :          0 :              pFmt = pDesc->GetRightFmt();
    2719                 :            : 
    2720         [ #  # ]:          0 :         if ( pFmt )
    2721                 :            :         {
    2722         [ #  # ]:          0 :             if ( eControl == Header )
    2723         [ #  # ]:          0 :                 bActive = pFmt->GetHeader().IsActive();
    2724                 :            :             else
    2725         [ #  # ]:          0 :                 bActive = pFmt->GetFooter().IsActive();
    2726                 :            :         }
    2727                 :            : 
    2728         [ #  # ]:          0 :         if ( !bActive )
    2729                 :            :         {
    2730                 :          0 :             const String& rStyleName = pPageFrm->GetPageDesc()->GetName();
    2731         [ #  # ]:          0 :             rSh.ChangeHeaderOrFooter( rStyleName, eControl == Header, true, false );
    2732         [ #  # ]:          0 :             m_sTmpHFPageStyle = rStyleName;
    2733                 :          0 :             m_bTmpHFIsHeader = eControl == Header;
    2734                 :            :         }
    2735                 :            :     }
    2736                 :            : 
    2737 [ #  # ][ #  # ]:          0 :     if ( lcl_CheckHeaderFooterClick( rSh, aDocPos, rMEvt.GetClicks() ) )
    2738                 :            :         return;
    2739                 :            : 
    2740                 :            : 
    2741         [ #  # ]:          0 :     if ( IsChainMode() )
    2742                 :            :     {
    2743         [ #  # ]:          0 :         SetChainMode( sal_False );
    2744                 :          0 :         SwRect aDummy;
    2745         [ #  # ]:          0 :         SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)rSh.GetFlyFrmFmt();
    2746 [ #  # ][ #  # ]:          0 :         if ( !rSh.Chainable( aDummy, *pFmt, aDocPos ) )
    2747         [ #  # ]:          0 :             rSh.Chain( *pFmt, aDocPos );
    2748         [ #  # ]:          0 :         UpdatePointer( aDocPos, rMEvt.GetModifier() );
    2749                 :            :         return;
    2750                 :            :     }
    2751                 :            : 
    2752                 :            :     // After GrabFocus a shell should be pushed. That should actually
    2753                 :            :     // work but in practice ...
    2754         [ #  # ]:          0 :     lcl_SelectShellForDrop( rView );
    2755                 :            : 
    2756 [ #  # ][ #  # ]:          0 :     sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly();
    2757                 :          0 :     sal_Bool bCallBase = sal_True;
    2758                 :            : 
    2759         [ #  # ]:          0 :     if( pQuickHlpData->m_bIsDisplayed )
    2760         [ #  # ]:          0 :         pQuickHlpData->Stop( rSh );
    2761                 :          0 :     pQuickHlpData->m_bAppendSpace = false;
    2762                 :            : 
    2763 [ #  # ][ #  # ]:          0 :     if( rSh.FinishOLEObj() )
    2764                 :            :         return; // end InPlace and the click doesn't count anymore
    2765                 :            : 
    2766         [ #  # ]:          0 :     SET_CURR_SHELL( &rSh );
    2767                 :            : 
    2768         [ #  # ]:          0 :     SdrView *pSdrView = rSh.GetDrawView();
    2769         [ #  # ]:          0 :     if ( pSdrView )
    2770                 :            :     {
    2771 [ #  # ][ #  # ]:          0 :         if (pSdrView->MouseButtonDown( rMEvt, this ) )
    2772                 :            :         {
    2773         [ #  # ]:          0 :             rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
    2774                 :            :             return; // SdrView's event evaluated
    2775                 :            :         }
    2776                 :            :     }
    2777                 :            : 
    2778                 :          0 :     bIsInMove = sal_False;
    2779                 :          0 :     aStartPos = rMEvt.GetPosPixel();
    2780                 :          0 :     aRszMvHdlPt.X() = 0, aRszMvHdlPt.Y() = 0;
    2781                 :            : 
    2782                 :          0 :     sal_uInt8 nMouseTabCol = 0;
    2783         [ #  # ]:          0 :     const sal_Bool bTmp = !rSh.IsDrawCreate() && !pApplyTempl && !rSh.IsInSelect() &&
    2784         [ #  # ]:          0 :          rMEvt.GetClicks() == 1 && MOUSE_LEFT == rMEvt.GetButtons();
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    2785 [ #  # ][ #  # ]:          0 :     if (  bTmp &&
         [ #  # ][ #  # ]
                 [ #  # ]
    2786                 :          0 :          0 != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPos ) ) &&
    2787         [ #  # ]:          0 :          !rSh.IsObjSelectable( aDocPos ) )
    2788                 :            :     {
    2789 [ #  # ][ #  # ]:          0 :         if ( SW_TABSEL_HORI <= nMouseTabCol && SW_TABCOLSEL_VERT >= nMouseTabCol )
    2790                 :            :         {
    2791         [ #  # ]:          0 :             rSh.EnterStdMode();
    2792         [ #  # ]:          0 :             rSh.SelectTableRowCol( aDocPos );
    2793 [ #  # ][ #  # ]:          0 :             if( SW_TABSEL_HORI  != nMouseTabCol && SW_TABSEL_HORI_RTL  != nMouseTabCol)
    2794                 :            :             {
    2795         [ #  # ]:          0 :                 pRowColumnSelectionStart = new Point( aDocPos );
    2796                 :            :                 bIsRowDrag = SW_TABROWSEL_HORI == nMouseTabCol||
    2797                 :            :                             SW_TABROWSEL_HORI_RTL == nMouseTabCol ||
    2798 [ #  # ][ #  # ]:          0 :                             SW_TABCOLSEL_VERT == nMouseTabCol;
                 [ #  # ]
    2799                 :          0 :                 bMBPressed = sal_True;
    2800         [ #  # ]:          0 :                 CaptureMouse();
    2801                 :            :             }
    2802                 :            :             return;
    2803                 :            :         }
    2804                 :            : 
    2805         [ #  # ]:          0 :         if ( !rSh.IsTableMode() )
    2806                 :            :         {
    2807                 :            :             // comes from table columns out of the document.
    2808 [ #  # ][ #  # ]:          0 :             if(SW_TABCOL_VERT == nMouseTabCol || SW_TABCOL_HORI == nMouseTabCol)
    2809                 :          0 :                 rView.SetTabColFromDoc( sal_True );
    2810                 :            :             else
    2811                 :          0 :                 rView.SetTabRowFromDoc( sal_True );
    2812                 :            : 
    2813                 :          0 :             rView.SetTabColFromDocPos( aDocPos );
    2814         [ #  # ]:          0 :             rView.InvalidateRulerPos();
    2815                 :          0 :             SfxBindings& rBind = rView.GetViewFrame()->GetBindings();
    2816         [ #  # ]:          0 :             rBind.Update();
    2817         [ #  # ]:          0 :             if ( RulerColumnDrag( rMEvt,
    2818 [ #  # ][ #  # ]:          0 :                     (SW_TABCOL_VERT == nMouseTabCol || SW_TABROW_HORI == nMouseTabCol)) )
                 [ #  # ]
    2819                 :            :             {
    2820                 :          0 :                 rView.SetTabColFromDoc( sal_False );
    2821                 :          0 :                 rView.SetTabRowFromDoc( sal_False );
    2822         [ #  # ]:          0 :                 rView.InvalidateRulerPos();
    2823         [ #  # ]:          0 :                 rBind.Update();
    2824                 :          0 :                 bCallBase = sal_False;
    2825                 :            :             }
    2826                 :            :             else
    2827                 :            :             {
    2828                 :            :                 return;
    2829                 :            :             }
    2830                 :            :         }
    2831                 :            :     }
    2832 [ #  # ][ #  # ]:          0 :     else if (bTmp &&
                 [ #  # ]
    2833         [ #  # ]:          0 :              rSh.IsNumLabel(aDocPos))
    2834                 :            :     {
    2835         [ #  # ]:          0 :         SwTxtNode* pNodeAtPos = rSh.GetNumRuleNodeAtPos( aDocPos );
    2836                 :          0 :         rView.SetNumRuleNodeFromDoc( pNodeAtPos );
    2837         [ #  # ]:          0 :         rView.InvalidateRulerPos();
    2838                 :          0 :         SfxBindings& rBind = rView.GetViewFrame()->GetBindings();
    2839         [ #  # ]:          0 :         rBind.Update();
    2840                 :            : 
    2841         [ #  # ]:          0 :         if ( RulerMarginDrag( rMEvt,
    2842 [ #  # ][ #  # ]:          0 :                         rSh.IsVerticalModeAtNdAndPos( *pNodeAtPos, aDocPos ) ) )
    2843                 :            :         {
    2844                 :          0 :             rView.SetNumRuleNodeFromDoc( NULL );
    2845         [ #  # ]:          0 :             rView.InvalidateRulerPos();
    2846         [ #  # ]:          0 :             rBind.Update();
    2847                 :          0 :             bCallBase = sal_False;
    2848                 :            :         }
    2849                 :            :         else
    2850                 :            :         {
    2851                 :            :             // Make sure the pointer is set to 0,
    2852                 :            :             // otherwise it may point to nowhere after deleting the corresponding
    2853                 :            :             // text node.
    2854                 :          0 :             rView.SetNumRuleNodeFromDoc( NULL );
    2855                 :            :             return;
    2856                 :            :         }
    2857                 :            :     }
    2858                 :            : 
    2859                 :            :     // One can be in a selection state when recently the keyboard was
    2860                 :            :     // used to select but no CURSOR_KEY was moved yet after that. In
    2861                 :            :     // that case the previous selction has to be finished first.
    2862                 :            :     // MA 07. Oct. 95: Not only with left mouse button but always.
    2863                 :            :     // also see Bug: 19263
    2864         [ #  # ]:          0 :     if ( rSh.IsInSelect() )
    2865         [ #  # ]:          0 :         rSh.EndSelect();
    2866                 :            : 
    2867                 :            :     // query against LEFT because otherwise for example also a right
    2868                 :            :     // click releases the selection.
    2869         [ #  # ]:          0 :     if ( MOUSE_LEFT == rMEvt.GetButtons() )
    2870                 :            :     {
    2871                 :          0 :         sal_Bool bOnlyText = sal_False;
    2872                 :          0 :         bMBPressed = bNoInterrupt = sal_True;
    2873                 :          0 :         nKS_NUMDOWN_Count = 0;
    2874                 :            : 
    2875         [ #  # ]:          0 :         CaptureMouse();
    2876                 :            : 
    2877                 :            :         // reset curor position if applicable
    2878         [ #  # ]:          0 :         rSh.ResetCursorStack();
    2879                 :            : 
    2880         [ #  # ]:          0 :         switch ( rMEvt.GetModifier() + rMEvt.GetButtons() )
    2881                 :            :         {
    2882                 :            :             case MOUSE_LEFT:
    2883                 :            :             case MOUSE_LEFT + KEY_SHIFT:
    2884                 :            :             case MOUSE_LEFT + KEY_MOD2:
    2885 [ #  # ][ #  # ]:          0 :                 if( rSh.IsObjSelected() )
    2886                 :            :                 {
    2887                 :            :                     SdrHdl* pHdl;
    2888 [ #  # ][ #  # ]:          0 :                     if( !bIsDocReadOnly &&
         [ #  # ][ #  #  
             #  #  #  # ]
                 [ #  # ]
    2889                 :          0 :                         !pAnchorMarker &&
    2890                 :          0 :                         0 != ( pHdl = pSdrView->PickHandle(aDocPos) ) &&
    2891                 :          0 :                             ( pHdl->GetKind() == HDL_ANCHOR ||
    2892                 :          0 :                               pHdl->GetKind() == HDL_ANCHOR_TR ) )
    2893                 :            :                     {
    2894         [ #  # ]:          0 :                         pAnchorMarker = new SwAnchorMarker( pHdl );
    2895         [ #  # ]:          0 :                         UpdatePointer( aDocPos, rMEvt.GetModifier() );
    2896                 :            :                         return;
    2897                 :            :                     }
    2898                 :            :                 }
    2899 [ #  # ][ #  # ]:          0 :                 if ( EnterDrawMode( rMEvt, aDocPos ) )
    2900                 :            :                 {
    2901                 :          0 :                     bNoInterrupt = sal_False;
    2902                 :            :                     return;
    2903                 :            :                 }
    2904 [ #  # ][ #  # ]:          0 :                 else  if ( rView.GetDrawFuncPtr() && bInsFrm )
                 [ #  # ]
    2905                 :            :                 {
    2906         [ #  # ]:          0 :                     StopInsFrm();
    2907         [ #  # ]:          0 :                     rSh.Edit();
    2908                 :            :                 }
    2909                 :            : 
    2910                 :            :                 // Without SHIFT because otherwise Toggle doesn't work at selection
    2911         [ #  # ]:          0 :                 if (rMEvt.GetClicks() == 1)
    2912                 :            :                 {
    2913         [ #  # ]:          0 :                     if ( rSh.IsSelFrmMode())
    2914                 :            :                     {
    2915 [ #  # ][ #  # ]:          0 :                         SdrHdl* pHdl = rSh.GetDrawView()->PickHandle(aDocPos);
    2916                 :          0 :                         sal_Bool bHitHandle = pHdl && pHdl->GetKind() != HDL_ANCHOR &&
    2917   [ #  #  #  # ]:          0 :                                                   pHdl->GetKind() != HDL_ANCHOR_TR;
                 [ #  # ]
    2918                 :            : 
    2919 [ #  # ][ #  # ]:          0 :                         if ((rSh.IsInsideSelectedObj(aDocPos) || bHitHandle) &&
           [ #  #  #  # ]
                 [ #  # ]
    2920         [ #  # ]:          0 :                             !(rMEvt.GetModifier() == KEY_SHIFT && !bHitHandle))
    2921                 :            :                         {
    2922         [ #  # ]:          0 :                             rSh.EnterSelFrmMode( &aDocPos );
    2923         [ #  # ]:          0 :                             if ( !pApplyTempl )
    2924                 :            :                             {
    2925                 :            :                                 // only if no position to size was hit.
    2926         [ #  # ]:          0 :                                 if (!bHitHandle)
    2927                 :            :                                 {
    2928         [ #  # ]:          0 :                                     StartDDTimer();
    2929                 :          0 :                                     SwEditWin::nDDStartPosY = aDocPos.Y();
    2930                 :          0 :                                     SwEditWin::nDDStartPosX = aDocPos.X();
    2931                 :            :                                 }
    2932                 :          0 :                                 bFrmDrag = sal_True;
    2933                 :            :                             }
    2934                 :          0 :                             bNoInterrupt = sal_False;
    2935                 :            :                             return;
    2936                 :            :                         }
    2937                 :            :                     }
    2938                 :            :                 }
    2939                 :            :         }
    2940                 :            : 
    2941 [ #  # ][ #  # ]:          0 :         sal_Bool bExecHyperlinks = rView.GetDocShell()->IsReadOnly();
    2942         [ #  # ]:          0 :         if ( !bExecHyperlinks )
    2943                 :            :         {
    2944         [ #  # ]:          0 :             SvtSecurityOptions aSecOpts;
    2945         [ #  # ]:          0 :             const sal_Bool bSecureOption = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
    2946 [ #  # ][ #  # ]:          0 :             if ( (  bSecureOption && rMEvt.GetModifier() == KEY_MOD1 ) ||
           [ #  #  #  # ]
                 [ #  # ]
    2947                 :          0 :                  ( !bSecureOption && rMEvt.GetModifier() != KEY_MOD1 ) )
    2948         [ #  # ]:          0 :                 bExecHyperlinks = sal_True;
    2949                 :            :         }
    2950                 :            : 
    2951                 :          0 :         sal_uInt8 nNumberOfClicks = static_cast< sal_uInt8 >(rMEvt.GetClicks() % 4);
    2952 [ #  # ][ #  # ]:          0 :         if ( 0 == nNumberOfClicks && 0 < rMEvt.GetClicks() )
                 [ #  # ]
    2953                 :          0 :             nNumberOfClicks = 4;
    2954                 :            : 
    2955                 :          0 :         sal_Bool bExecDrawTextLink = sal_False;
    2956                 :            : 
    2957      [ #  #  # ]:          0 :         switch ( rMEvt.GetModifier() + rMEvt.GetButtons() )
    2958                 :            :         {
    2959                 :            :             case MOUSE_LEFT:
    2960                 :            :             case MOUSE_LEFT + KEY_MOD1:
    2961                 :            :             case MOUSE_LEFT + KEY_MOD2:
    2962   [ #  #  #  # ]:          0 :                 switch ( nNumberOfClicks )
    2963                 :            :                 {
    2964                 :            :                     case 1:
    2965                 :            :                     {
    2966         [ #  # ]:          0 :                         UpdatePointer( aDocPos, rMEvt.GetModifier() );
    2967                 :          0 :                         SwEditWin::nDDStartPosY = aDocPos.Y();
    2968                 :          0 :                         SwEditWin::nDDStartPosX = aDocPos.X();
    2969                 :            : 
    2970                 :            :                         // hit an URL in DrawText object?
    2971 [ #  # ][ #  # ]:          0 :                         if (bExecHyperlinks && pSdrView)
    2972                 :            :                         {
    2973         [ #  # ]:          0 :                             SdrViewEvent aVEvt;
    2974         [ #  # ]:          0 :                             pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
    2975                 :            : 
    2976         [ #  # ]:          0 :                             if (aVEvt.eEvent == SDREVENT_EXECUTEURL)
    2977         [ #  # ]:          0 :                                 bExecDrawTextLink = sal_True;
    2978                 :            :                         }
    2979                 :            : 
    2980                 :            :                         // only try to select frame, if pointer already was
    2981                 :            :                         // switched accordingly
    2982 [ #  # ][ #  # ]:          0 :                         if ( aActHitType != SDRHIT_NONE && !rSh.IsSelFrmMode() &&
         [ #  # ][ #  # ]
                 [ #  # ]
    2983         [ #  # ]:          0 :                             !GetView().GetViewFrame()->GetDispatcher()->IsLocked() &&
    2984                 :            :                             !bExecDrawTextLink)
    2985                 :            :                         {
    2986                 :            :                             // Test if there is a draw object at that position and if it should be selected.
    2987         [ #  # ]:          0 :                             sal_Bool bShould = rSh.ShouldObjectBeSelected(aDocPos);
    2988                 :            : 
    2989         [ #  # ]:          0 :                             if(bShould)
    2990                 :            :                             {
    2991         [ #  # ]:          0 :                                 rView.NoRotate();
    2992         [ #  # ]:          0 :                                 rSh.HideCrsr();
    2993                 :            : 
    2994                 :          0 :                                 sal_Bool bUnLockView = !rSh.IsViewLocked();
    2995                 :          0 :                                 rSh.LockView( sal_True );
    2996                 :            :                                 sal_Bool bSelObj = rSh.SelectObj( aDocPos,
    2997 [ #  # ][ #  # ]:          0 :                                                rMEvt.IsMod1() ? SW_ENTER_GROUP : 0);
    2998         [ #  # ]:          0 :                                 if( bUnLockView )
    2999                 :          0 :                                     rSh.LockView( sal_False );
    3000                 :            : 
    3001         [ #  # ]:          0 :                                 if( bSelObj )
    3002                 :            :                                 {
    3003                 :            :                                     // if the frame was deselected in the macro
    3004                 :            :                                     // the cursor just has to be displayed again
    3005 [ #  # ][ #  # ]:          0 :                                     if( FRMTYPE_NONE == rSh.GetSelFrmType() )
    3006         [ #  # ]:          0 :                                         rSh.ShowCrsr();
    3007                 :            :                                     else
    3008                 :            :                                     {
    3009 [ #  # ][ #  # ]:          0 :                                         if (rSh.IsFrmSelected() && rView.GetDrawFuncPtr())
         [ #  # ][ #  # ]
    3010                 :            :                                         {
    3011         [ #  # ]:          0 :                                             rView.GetDrawFuncPtr()->Deactivate();
    3012         [ #  # ]:          0 :                                             rView.SetDrawFuncPtr(NULL);
    3013         [ #  # ]:          0 :                                             rView.LeaveDrawCreate();
    3014         [ #  # ]:          0 :                                             rView.AttrChangedNotify( &rSh );
    3015                 :            :                                         }
    3016                 :            : 
    3017         [ #  # ]:          0 :                                         rSh.EnterSelFrmMode( &aDocPos );
    3018                 :          0 :                                         bFrmDrag = sal_True;
    3019         [ #  # ]:          0 :                                         UpdatePointer( aDocPos, rMEvt.GetModifier() );
    3020                 :            :                                     }
    3021                 :            :                                     return;
    3022                 :            :                                 }
    3023                 :            :                                 else
    3024         [ #  # ]:          0 :                                     bOnlyText = static_cast< sal_Bool >(rSh.IsObjSelectable( aDocPos ));
    3025                 :            : 
    3026         [ #  # ]:          0 :                                 if (!rView.GetDrawFuncPtr())
    3027         [ #  # ]:          0 :                                     rSh.ShowCrsr();
    3028                 :            :                             }
    3029                 :            :                             else
    3030                 :          0 :                                 bOnlyText = KEY_MOD1 != rMEvt.GetModifier();
    3031                 :            :                         }
    3032 [ #  # ][ #  # ]:          0 :                         else if ( rSh.IsSelFrmMode() &&
         [ #  # ][ #  # ]
    3033                 :            :                                   (aActHitType == SDRHIT_NONE ||
    3034         [ #  # ]:          0 :                                    !rSh.IsInsideSelectedObj( aDocPos )))
    3035                 :            :                         {
    3036         [ #  # ]:          0 :                             rView.NoRotate();
    3037                 :            :                             SdrHdl *pHdl;
    3038 [ #  # ][ #  # ]:          0 :                             if( !bIsDocReadOnly && !pAnchorMarker && 0 !=
         [ #  # ][ #  #  
             #  #  #  # ]
                 [ #  # ]
    3039                 :          0 :                                 ( pHdl = pSdrView->PickHandle(aDocPos) ) &&
    3040                 :          0 :                                     ( pHdl->GetKind() == HDL_ANCHOR ||
    3041                 :          0 :                                       pHdl->GetKind() == HDL_ANCHOR_TR ) )
    3042                 :            :                             {
    3043         [ #  # ]:          0 :                                 pAnchorMarker = new SwAnchorMarker( pHdl );
    3044         [ #  # ]:          0 :                                 UpdatePointer( aDocPos, rMEvt.GetModifier() );
    3045                 :            :                                 return;
    3046                 :            :                             }
    3047                 :            :                             else
    3048                 :            :                             {
    3049                 :          0 :                                 sal_Bool bUnLockView = !rSh.IsViewLocked();
    3050                 :          0 :                                 rSh.LockView( sal_True );
    3051         [ #  # ]:          0 :                                 sal_uInt8 nFlag = rMEvt.IsShift() ? SW_ADD_SELECT :0;
    3052         [ #  # ]:          0 :                                 if( rMEvt.IsMod1() )
    3053                 :          0 :                                     nFlag = nFlag | SW_ENTER_GROUP;
    3054                 :            : 
    3055         [ #  # ]:          0 :                                 if ( rSh.IsSelFrmMode() )
    3056                 :            :                                 {
    3057         [ #  # ]:          0 :                                     rSh.UnSelectFrm();
    3058         [ #  # ]:          0 :                                     rSh.LeaveSelFrmMode();
    3059         [ #  # ]:          0 :                                     rView.AttrChangedNotify(&rSh);
    3060                 :            :                                 }
    3061                 :            : 
    3062         [ #  # ]:          0 :                                 sal_Bool bSelObj = rSh.SelectObj( aDocPos, nFlag );
    3063         [ #  # ]:          0 :                                 if( bUnLockView )
    3064                 :          0 :                                     rSh.LockView( sal_False );
    3065                 :            : 
    3066         [ #  # ]:          0 :                                 if( !bSelObj )
    3067                 :            :                                 {
    3068                 :            :                                     // move cursor here so that it is not drawn in the
    3069                 :            :                                     // frame first; ShowCrsr() happens in LeaveSelFrmMode()
    3070         [ #  # ]:          0 :                                     bValidCrsrPos = !(CRSR_POSCHG & rSh.SetCursor(&aDocPos, false));
    3071         [ #  # ]:          0 :                                     rSh.LeaveSelFrmMode();
    3072         [ #  # ]:          0 :                                     rView.AttrChangedNotify( &rSh );
    3073                 :          0 :                                     bCallBase = sal_False;
    3074                 :            :                                 }
    3075                 :            :                                 else
    3076                 :            :                                 {
    3077         [ #  # ]:          0 :                                     rSh.HideCrsr();
    3078         [ #  # ]:          0 :                                     rSh.EnterSelFrmMode( &aDocPos );
    3079         [ #  # ]:          0 :                                     rSh.SelFlyGrabCrsr();
    3080         [ #  # ]:          0 :                                     rSh.MakeSelVisible();
    3081                 :          0 :                                     bFrmDrag = sal_True;
    3082         [ #  # ]:          0 :                                     if( rSh.IsFrmSelected() &&
           [ #  #  #  # ]
                 [ #  # ]
    3083                 :          0 :                                         rView.GetDrawFuncPtr() )
    3084                 :            :                                     {
    3085         [ #  # ]:          0 :                                         rView.GetDrawFuncPtr()->Deactivate();
    3086         [ #  # ]:          0 :                                         rView.SetDrawFuncPtr(NULL);
    3087         [ #  # ]:          0 :                                         rView.LeaveDrawCreate();
    3088         [ #  # ]:          0 :                                         rView.AttrChangedNotify( &rSh );
    3089                 :            :                                     }
    3090         [ #  # ]:          0 :                                     UpdatePointer( aDocPos, rMEvt.GetModifier() );
    3091                 :            :                                     return;
    3092                 :            :                                 }
    3093                 :            :                             }
    3094                 :            :                         }
    3095                 :            : 
    3096                 :          0 :                         break;
    3097                 :            :                     }
    3098                 :            :                     case 2:
    3099                 :            :                     {
    3100                 :          0 :                         bFrmDrag = sal_False;
    3101 [ #  # ][ #  # ]:          0 :                         if ( !bIsDocReadOnly && rSh.IsInsideSelectedObj(aDocPos) &&
         [ #  # ][ #  # ]
                 [ #  # ]
    3102         [ #  # ]:          0 :                              0 == rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) )
    3103                 :            : 
    3104                 :            : /* this is no good, on the one hand GetSelectionType is used as flag field (take a look into the GetSelectionType method)
    3105                 :            :    on the other hand the return value is used in a switch without proper masking (very nice), this must lead to trouble
    3106                 :            : */
    3107 [ #  # ][ #  #  :          0 :                         switch ( rSh.GetSelectionType() &~ ( nsSelectionType::SEL_FONTWORK | nsSelectionType::SEL_EXTRUDED_CUSTOMSHAPE ) )
                #  #  # ]
    3108                 :            :                         {
    3109                 :            :                             case nsSelectionType::SEL_GRF:
    3110         [ #  # ]:          0 :                                 RstMBDownFlags();
    3111                 :          0 :                                 GetView().GetViewFrame()->GetBindings().Execute(
    3112                 :            :                                     FN_FORMAT_GRAFIC_DLG, 0, 0,
    3113         [ #  # ]:          0 :                                     SFX_CALLMODE_RECORD|SFX_CALLMODE_SLOT);
    3114                 :            :                                 return;
    3115                 :            : 
    3116                 :            :                                 // double click on OLE object --> OLE-InPlace
    3117                 :            :                             case nsSelectionType::SEL_OLE:
    3118 [ #  # ][ #  # ]:          0 :                                 if (!rSh.IsSelObjProtected(FLYPROTECT_CONTENT))
    3119                 :            :                                 {
    3120         [ #  # ]:          0 :                                     RstMBDownFlags();
    3121         [ #  # ]:          0 :                                     rSh.LaunchOLEObj();
    3122                 :            :                                 }
    3123                 :            :                                 return;
    3124                 :            : 
    3125                 :            :                             case nsSelectionType::SEL_FRM:
    3126         [ #  # ]:          0 :                                 RstMBDownFlags();
    3127                 :          0 :                                 GetView().GetViewFrame()->GetBindings().Execute(
    3128         [ #  # ]:          0 :                                     FN_FORMAT_FRAME_DLG, 0, 0, SFX_CALLMODE_RECORD|SFX_CALLMODE_SLOT);
    3129                 :            :                                 return;
    3130                 :            : 
    3131                 :            :                             case nsSelectionType::SEL_DRW:
    3132         [ #  # ]:          0 :                                 RstMBDownFlags();
    3133         [ #  # ]:          0 :                                 EnterDrawTextMode(aDocPos);
    3134 [ #  # ][ #  # ]:          0 :                                 if ( rView.GetCurShell()->ISA(SwDrawTextShell) )
                 [ #  # ]
    3135         [ #  # ]:          0 :                                     ((SwDrawTextShell*)rView.GetCurShell())->Init();
    3136                 :            :                                 return;
    3137                 :            :                         }
    3138                 :            : 
    3139                 :            :                         // if the cursor position was corrected or if a Fly
    3140                 :            :                         // was selected in ReadOnlyMode, no word selection.
    3141 [ #  # ][ #  # ]:          0 :                         if ( !bValidCrsrPos ||
         [ #  # ][ #  # ]
    3142 [ #  # ][ #  # ]:          0 :                             (rSh.IsFrmSelected() && rSh.IsFrmSelected() ))
    3143                 :            :                             return;
    3144                 :            : 
    3145                 :            :                         SwField *pFld;
    3146                 :          0 :                         sal_Bool bFtn = sal_False;
    3147                 :            : 
    3148 [ #  # ][ #  # ]:          0 :                         if( !bIsDocReadOnly &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    3149                 :          0 :                             ( 0 != ( pFld = rSh.GetCurFld() ) ||
    3150                 :          0 :                               0 != ( bFtn = rSh.GetCurFtn() )) )
    3151                 :            :                         {
    3152         [ #  # ]:          0 :                             RstMBDownFlags();
    3153         [ #  # ]:          0 :                             if( bFtn )
    3154         [ #  # ]:          0 :                                 GetView().GetViewFrame()->GetBindings().Execute( FN_EDIT_FOOTNOTE );
    3155                 :            :                             else
    3156                 :            :                             {
    3157         [ #  # ]:          0 :                                 sal_uInt16 nTypeId = pFld->GetTypeId();
    3158                 :          0 :                                 SfxViewFrame* pVFrame = GetView().GetViewFrame();
    3159      [ #  #  # ]:          0 :                                 switch( nTypeId )
    3160                 :            :                                 {
    3161                 :            :                                 case TYP_POSTITFLD:
    3162                 :            :                                 case TYP_SCRIPTFLD:
    3163                 :            :                                 {
    3164                 :            :                                     // if it's a Readonly region, status has to be enabled
    3165         [ #  # ]:          0 :                                     sal_uInt16 nSlot = TYP_POSTITFLD == nTypeId ? FN_POSTIT : FN_JAVAEDIT;
    3166         [ #  # ]:          0 :                                     SfxBoolItem aItem(nSlot, sal_True);
    3167         [ #  # ]:          0 :                                     pVFrame->GetBindings().SetState(aItem);
    3168         [ #  # ]:          0 :                                     pVFrame->GetBindings().Execute(nSlot);
    3169         [ #  # ]:          0 :                                     break;
    3170                 :            :                                 }
    3171                 :            :                                 case TYP_AUTHORITY :
    3172         [ #  # ]:          0 :                                     pVFrame->GetBindings().Execute(FN_EDIT_AUTH_ENTRY_DLG);
    3173                 :          0 :                                 break;
    3174                 :            :                                 default:
    3175         [ #  # ]:          0 :                                     pVFrame->GetBindings().Execute(FN_EDIT_FIELD);
    3176                 :            :                                 }
    3177                 :            :                             }
    3178                 :            :                             return;
    3179                 :            :                         }
    3180                 :            :                         // in extended mode double and triple
    3181                 :            :                         // click has no effect.
    3182 [ #  # ][ #  # ]:          0 :                         if ( rSh.IsExtMode() || rSh.IsBlockMode() )
                 [ #  # ]
    3183                 :            :                             return;
    3184                 :            : 
    3185                 :            :                         // select work, AdditionalMode if applicable
    3186 [ #  # ][ #  # ]:          0 :                         if ( KEY_MOD1 == rMEvt.GetModifier() && !rSh.IsAddMode() )
                 [ #  # ]
    3187                 :            :                         {
    3188         [ #  # ]:          0 :                             rSh.EnterAddMode();
    3189         [ #  # ]:          0 :                             rSh.SelWrd( &aDocPos );
    3190         [ #  # ]:          0 :                             rSh.LeaveAddMode();
    3191                 :            :                         }
    3192                 :            :                         else
    3193         [ #  # ]:          0 :                             rSh.SelWrd( &aDocPos );
    3194                 :          0 :                         bHoldSelection = sal_True;
    3195                 :            :                         return;
    3196                 :            :                     }
    3197                 :            :                     case 3:
    3198                 :            :                     case 4:
    3199                 :            :                     {
    3200                 :          0 :                         bFrmDrag = sal_False;
    3201                 :            :                         // in extended mode double and triple
    3202                 :            :                         // click has no effect.
    3203         [ #  # ]:          0 :                         if ( rSh.IsExtMode() )
    3204                 :            :                             return;
    3205                 :            : 
    3206                 :            :                         // if the cursor position was corrected or if a Fly
    3207                 :            :                         // was selected in ReadOnlyMode, no word selection.
    3208 [ #  # ][ #  # ]:          0 :                         if ( !bValidCrsrPos || rSh.IsFrmSelected() )
         [ #  # ][ #  # ]
    3209                 :            :                             return;
    3210                 :            : 
    3211                 :            :                         // select line, AdditionalMode if applicable
    3212                 :          0 :                         const bool bMod = KEY_MOD1 == rMEvt.GetModifier() &&
    3213 [ #  # ][ #  # ]:          0 :                                          !rSh.IsAddMode();
    3214                 :            : 
    3215         [ #  # ]:          0 :                         if ( bMod )
    3216         [ #  # ]:          0 :                             rSh.EnterAddMode();
    3217                 :            : 
    3218         [ #  # ]:          0 :                         if ( 3 == nNumberOfClicks )
    3219         [ #  # ]:          0 :                             rSh.SelSentence( &aDocPos );
    3220                 :            :                         else
    3221         [ #  # ]:          0 :                             rSh.SelPara( &aDocPos );
    3222                 :            : 
    3223         [ #  # ]:          0 :                         if ( bMod )
    3224         [ #  # ]:          0 :                             rSh.LeaveAddMode();
    3225                 :            : 
    3226                 :          0 :                         bHoldSelection = sal_True;
    3227                 :            :                         return;
    3228                 :            :                     }
    3229                 :            : 
    3230                 :            :                     default:
    3231                 :            :                         return;
    3232                 :            :                 }
    3233                 :            :                 /* no break */
    3234                 :            :             case MOUSE_LEFT + KEY_SHIFT:
    3235                 :            :             case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1:
    3236                 :            :             {
    3237                 :          0 :                 sal_Bool bLockView = bWasShdwCrsr;
    3238                 :            : 
    3239   [ #  #  #  #  :          0 :                 switch ( rMEvt.GetModifier() )
                      # ]
    3240                 :            :                 {
    3241                 :            :                     case KEY_MOD1 + KEY_SHIFT:
    3242                 :            :                     {
    3243 [ #  # ][ #  # ]:          0 :                         if ( !bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) )
         [ #  # ][ #  # ]
    3244                 :            :                         {
    3245         [ #  # ]:          0 :                             rView.NoRotate();
    3246         [ #  # ]:          0 :                             rSh.HideCrsr();
    3247         [ #  # ]:          0 :                             if ( rSh.IsSelFrmMode() )
    3248         [ #  # ]:          0 :                                 rSh.SelectObj(aDocPos, SW_ADD_SELECT | SW_ENTER_GROUP);
    3249                 :            :                             else
    3250 [ #  # ][ #  # ]:          0 :                             {   if ( rSh.SelectObj( aDocPos, SW_ADD_SELECT | SW_ENTER_GROUP ) )
    3251                 :            :                                 {
    3252         [ #  # ]:          0 :                                     rSh.EnterSelFrmMode( &aDocPos );
    3253                 :          0 :                                     SwEditWin::nDDStartPosY = aDocPos.Y();
    3254                 :          0 :                                     SwEditWin::nDDStartPosX = aDocPos.X();
    3255                 :          0 :                                     bFrmDrag = sal_True;
    3256                 :            :                                     return;
    3257                 :            :                                 }
    3258                 :            :                             }
    3259                 :            :                         }
    3260 [ #  # ][ #  # ]:          0 :                         else if( rSh.IsSelFrmMode() &&
                 [ #  # ]
    3261 [ #  # ][ #  # ]:          0 :                                  rSh.GetDrawView()->PickHandle( aDocPos ))
    3262                 :            :                         {
    3263                 :          0 :                             bFrmDrag = sal_True;
    3264                 :          0 :                             bNoInterrupt = sal_False;
    3265                 :            :                             return;
    3266                 :            :                         }
    3267                 :            :                     }
    3268                 :          0 :                     break;
    3269                 :            :                     case KEY_MOD1:
    3270         [ #  # ]:          0 :                     if ( !bExecDrawTextLink )
    3271                 :            :                     {
    3272 [ #  # ][ #  # ]:          0 :                         if ( !bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) )
         [ #  # ][ #  # ]
    3273                 :            :                         {
    3274         [ #  # ]:          0 :                             rView.NoRotate();
    3275         [ #  # ]:          0 :                             rSh.HideCrsr();
    3276         [ #  # ]:          0 :                             if ( rSh.IsSelFrmMode() )
    3277         [ #  # ]:          0 :                                 rSh.SelectObj(aDocPos, SW_ENTER_GROUP);
    3278                 :            :                             else
    3279 [ #  # ][ #  # ]:          0 :                             {   if ( rSh.SelectObj( aDocPos, SW_ENTER_GROUP ) )
    3280                 :            :                                 {
    3281         [ #  # ]:          0 :                                     rSh.EnterSelFrmMode( &aDocPos );
    3282                 :          0 :                                     SwEditWin::nDDStartPosY = aDocPos.Y();
    3283                 :          0 :                                     SwEditWin::nDDStartPosX = aDocPos.X();
    3284                 :          0 :                                     bFrmDrag = sal_True;
    3285                 :            :                                     return;
    3286                 :            :                                 }
    3287                 :            :                             }
    3288                 :            :                         }
    3289 [ #  # ][ #  # ]:          0 :                         else if( rSh.IsSelFrmMode() &&
                 [ #  # ]
    3290 [ #  # ][ #  # ]:          0 :                                  rSh.GetDrawView()->PickHandle( aDocPos ))
    3291                 :            :                         {
    3292                 :          0 :                             bFrmDrag = sal_True;
    3293                 :          0 :                             bNoInterrupt = sal_False;
    3294                 :            :                             return;
    3295                 :            :                         }
    3296                 :            :                         else
    3297                 :            :                         {
    3298 [ #  # ][ #  # ]:          0 :                             if ( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() )
         [ #  # ][ #  # ]
    3299                 :            :                             {
    3300         [ #  # ]:          0 :                                 rSh.PushMode();
    3301                 :          0 :                                 bModePushed = sal_True;
    3302                 :            : 
    3303                 :          0 :                                 sal_Bool bUnLockView = !rSh.IsViewLocked();
    3304                 :          0 :                                 rSh.LockView( sal_True );
    3305         [ #  # ]:          0 :                                 rSh.EnterAddMode();
    3306         [ #  # ]:          0 :                                 if( bUnLockView )
    3307                 :          0 :                                     rSh.LockView( sal_False );
    3308                 :            :                             }
    3309                 :          0 :                             bCallBase = sal_False;
    3310                 :            :                         }
    3311                 :            :                     }
    3312                 :          0 :                     break;
    3313                 :            :                     case KEY_MOD2:
    3314                 :            :                     {
    3315 [ #  # ][ #  # ]:          0 :                         if ( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() )
         [ #  # ][ #  # ]
    3316                 :            :                         {
    3317         [ #  # ]:          0 :                             rSh.PushMode();
    3318                 :          0 :                             bModePushed = sal_True;
    3319                 :          0 :                             sal_Bool bUnLockView = !rSh.IsViewLocked();
    3320                 :          0 :                             rSh.LockView( sal_True );
    3321         [ #  # ]:          0 :                             rSh.EnterBlockMode();
    3322         [ #  # ]:          0 :                             if( bUnLockView )
    3323                 :          0 :                                 rSh.LockView( sal_False );
    3324                 :            :                         }
    3325                 :          0 :                         bCallBase = sal_False;
    3326                 :            :                     }
    3327                 :          0 :                     break;
    3328                 :            :                     case KEY_SHIFT:
    3329                 :            :                     {
    3330 [ #  # ][ #  # ]:          0 :                         if ( !bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) )
         [ #  # ][ #  # ]
    3331                 :            :                         {
    3332         [ #  # ]:          0 :                             rView.NoRotate();
    3333         [ #  # ]:          0 :                             rSh.HideCrsr();
    3334         [ #  # ]:          0 :                             if ( rSh.IsSelFrmMode() )
    3335                 :            :                             {
    3336         [ #  # ]:          0 :                                 rSh.SelectObj(aDocPos, SW_ADD_SELECT);
    3337                 :            : 
    3338                 :          0 :                                 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
    3339 [ #  # ][ #  # ]:          0 :                                 if (rMarkList.GetMark(0) == NULL)
    3340                 :            :                                 {
    3341         [ #  # ]:          0 :                                     rSh.LeaveSelFrmMode();
    3342         [ #  # ]:          0 :                                     rView.AttrChangedNotify(&rSh);
    3343                 :          0 :                                     bFrmDrag = sal_False;
    3344                 :            :                                 }
    3345                 :            :                             }
    3346                 :            :                             else
    3347 [ #  # ][ #  # ]:          0 :                             {   if ( rSh.SelectObj( aDocPos ) )
    3348                 :            :                                 {
    3349         [ #  # ]:          0 :                                     rSh.EnterSelFrmMode( &aDocPos );
    3350                 :          0 :                                     SwEditWin::nDDStartPosY = aDocPos.Y();
    3351                 :          0 :                                     SwEditWin::nDDStartPosX = aDocPos.X();
    3352                 :          0 :                                     bFrmDrag = sal_True;
    3353                 :            :                                     return;
    3354                 :            :                                 }
    3355                 :            :                             }
    3356                 :            :                         }
    3357                 :            :                         else
    3358                 :            :                         {
    3359 [ #  # ][ #  # ]:          0 :                             if ( rSh.IsSelFrmMode() &&
                 [ #  # ]
    3360         [ #  # ]:          0 :                                  rSh.IsInsideSelectedObj( aDocPos ) )
    3361                 :            :                             {
    3362         [ #  # ]:          0 :                                 rSh.EnterSelFrmMode( &aDocPos );
    3363                 :          0 :                                 SwEditWin::nDDStartPosY = aDocPos.Y();
    3364                 :          0 :                                 SwEditWin::nDDStartPosX = aDocPos.X();
    3365                 :          0 :                                 bFrmDrag = sal_True;
    3366                 :            :                                 return;
    3367                 :            :                             }
    3368         [ #  # ]:          0 :                             if ( rSh.IsSelFrmMode() )
    3369                 :            :                             {
    3370         [ #  # ]:          0 :                                 rSh.UnSelectFrm();
    3371         [ #  # ]:          0 :                                 rSh.LeaveSelFrmMode();
    3372         [ #  # ]:          0 :                                 rView.AttrChangedNotify(&rSh);
    3373                 :          0 :                                 bFrmDrag = sal_False;
    3374                 :            :                             }
    3375         [ #  # ]:          0 :                             if ( !rSh.IsExtMode() )
    3376                 :            :                             {
    3377                 :            :                                 // don't start a selection when an
    3378                 :            :                                 // URL field or a graphic is clicked
    3379         [ #  # ]:          0 :                                 sal_Bool bSttSelect = rSh.HasSelection() ||
    3380 [ #  # ][ #  # ]:          0 :                                                 Pointer(POINTER_REFHAND) != GetPointer();
         [ #  # ][ #  # ]
                 [ #  # ]
    3381                 :            : 
    3382         [ #  # ]:          0 :                                 if( !bSttSelect )
    3383                 :            :                                 {
    3384                 :          0 :                                     bSttSelect = sal_True;
    3385         [ #  # ]:          0 :                                     if( bExecHyperlinks )
    3386                 :            :                                     {
    3387                 :            :                                         SwContentAtPos aCntntAtPos(
    3388                 :            :                                             SwContentAtPos::SW_FTN |
    3389         [ #  # ]:          0 :                                             SwContentAtPos::SW_INETATTR );
    3390                 :            : 
    3391 [ #  # ][ #  # ]:          0 :                                         if( rSh.GetContentAtPos( aDocPos, aCntntAtPos ) )
    3392                 :            :                                         {
    3393   [ #  #  #  # ]:          0 :                                             if( !rSh.IsViewLocked() &&
         [ #  # ][ #  # ]
    3394                 :          0 :                                                 !rSh.IsReadOnlyAvailable() &&
    3395         [ #  # ]:          0 :                                                 aCntntAtPos.IsInProtectSect() )
    3396                 :          0 :                                                     bLockView = sal_True;
    3397                 :            : 
    3398                 :          0 :                                             bSttSelect = sal_False;
    3399                 :            :                                         }
    3400 [ #  # ][ #  # ]:          0 :                                         else if( rSh.IsURLGrfAtPos( aDocPos ))
    3401         [ #  # ]:          0 :                                             bSttSelect = sal_False;
    3402                 :            :                                     }
    3403                 :            :                                 }
    3404                 :            : 
    3405         [ #  # ]:          0 :                                 if( bSttSelect )
    3406         [ #  # ]:          0 :                                     rSh.SttSelect();
    3407                 :            :                             }
    3408                 :            :                         }
    3409                 :          0 :                         bCallBase = sal_False;
    3410                 :          0 :                         break;
    3411                 :            :                     }
    3412                 :            :                     default:
    3413         [ #  # ]:          0 :                         if( !rSh.IsViewLocked() )
    3414                 :            :                         {
    3415                 :            :                             SwContentAtPos aCntntAtPos( SwContentAtPos::SW_CLICKFIELD |
    3416         [ #  # ]:          0 :                                                         SwContentAtPos::SW_INETATTR );
    3417         [ #  # ]:          0 :                             if( rSh.GetContentAtPos( aDocPos, aCntntAtPos, sal_False ) &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    3418                 :          0 :                                 !rSh.IsReadOnlyAvailable() &&
    3419         [ #  # ]:          0 :                                 aCntntAtPos.IsInProtectSect() )
    3420         [ #  # ]:          0 :                                 bLockView = sal_True;
    3421                 :            :                         }
    3422                 :            :                 }
    3423                 :            : 
    3424         [ #  # ]:          0 :                 if ( rSh.IsGCAttr() )
    3425                 :            :                 {
    3426         [ #  # ]:          0 :                     rSh.GCAttr();
    3427                 :          0 :                     rSh.ClearGCAttr();
    3428                 :            :                 }
    3429                 :            : 
    3430         [ #  # ]:          0 :                 sal_Bool bOverSelect = rSh.ChgCurrPam( aDocPos ), bOverURLGrf = sal_False;
    3431         [ #  # ]:          0 :                 if( !bOverSelect )
    3432         [ #  # ]:          0 :                     bOverURLGrf = bOverSelect = 0 != rSh.IsURLGrfAtPos( aDocPos );
    3433                 :            : 
    3434         [ #  # ]:          0 :                 if ( !bOverSelect )
    3435                 :            :                 {
    3436                 :          0 :                     const sal_Bool bTmpNoInterrupt = bNoInterrupt;
    3437                 :          0 :                     bNoInterrupt = sal_False;
    3438                 :            : 
    3439 [ #  # ][ #  # ]:          0 :                     if( !rSh.IsViewLocked() && bLockView )
                 [ #  # ]
    3440                 :          0 :                         rSh.LockView( sal_True );
    3441                 :            :                     else
    3442                 :          0 :                         bLockView = sal_False;
    3443                 :            : 
    3444                 :          0 :                     int nTmpSetCrsr = 0;
    3445                 :            : 
    3446                 :            :                     {   // only temporary generate Move-Kontext because otherwise
    3447                 :            :                         // the query to the content form doesn't work!!!
    3448         [ #  # ]:          0 :                         MV_KONTEXT( &rSh );
    3449         [ #  # ]:          0 :                         nTmpSetCrsr = rSh.SetCursor(&aDocPos, bOnlyText);
    3450                 :          0 :                         bValidCrsrPos = !(CRSR_POSCHG & nTmpSetCrsr);
    3451         [ #  # ]:          0 :                         bCallBase = sal_False;
    3452                 :            :                     }
    3453                 :            : 
    3454                 :            :                     // notify the edit window that from now on we do not use the input language
    3455         [ #  # ]:          0 :                     if ( !(CRSR_POSOLD & nTmpSetCrsr) )
    3456         [ #  # ]:          0 :                         SetUseInputLanguage( sal_False );
    3457                 :            : 
    3458         [ #  # ]:          0 :                     if( bLockView )
    3459                 :          0 :                         rSh.LockView( sal_False );
    3460                 :            : 
    3461                 :          0 :                     bNoInterrupt = bTmpNoInterrupt;
    3462                 :            :                 }
    3463 [ #  # ][ #  # ]:          0 :                 if ( !bOverURLGrf && !bOnlyText )
    3464                 :            :                 {
    3465         [ #  # ]:          0 :                     const int nSelType = rSh.GetSelectionType();
    3466                 :            :                     // Check in general, if an object is selectable at given position.
    3467                 :            :                     // Thus, also text fly frames in background become selectable via Ctrl-Click.
    3468 [ #  # ][ #  # ]:          0 :                     if ( nSelType & nsSelectionType::SEL_OLE ||
         [ #  # ][ #  # ]
    3469                 :            :                          nSelType & nsSelectionType::SEL_GRF ||
    3470         [ #  # ]:          0 :                          rSh.IsObjSelectable( aDocPos ) )
    3471                 :            :                     {
    3472         [ #  # ]:          0 :                         MV_KONTEXT( &rSh );
    3473 [ #  # ][ #  # ]:          0 :                         if( !rSh.IsFrmSelected() )
    3474         [ #  # ]:          0 :                             rSh.GotoNextFly();
    3475         [ #  # ]:          0 :                         rSh.EnterSelFrmMode();
    3476         [ #  # ]:          0 :                         bCallBase = sal_False;
    3477                 :            :                     }
    3478                 :            :                 }
    3479                 :            :                 // don't reset here any longer so that, in case through MouseMove
    3480                 :            :                 // with pressed Ctrl key a multiple-selection should happen,
    3481                 :            :                 // the previous selection is not released in Drag.
    3482                 :          0 :                 break;
    3483                 :            :             }
    3484                 :            :         }
    3485                 :            :     }
    3486         [ #  # ]:          0 :     if (bCallBase)
    3487 [ #  # ][ #  # ]:          0 :         Window::MouseButtonDown(rMEvt);
                 [ #  # ]
    3488                 :            : }
    3489                 :            : 
    3490                 :            : /*--------------------------------------------------------------------
    3491                 :            :     Description:   MouseMove
    3492                 :            :  --------------------------------------------------------------------*/
    3493                 :            : 
    3494                 :          0 : void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
    3495                 :            : {
    3496                 :          0 :     MouseEvent rMEvt(_rMEvt);
    3497                 :            : 
    3498                 :            :     //ignore key modifiers for format paintbrush
    3499                 :            :     {
    3500                 :            :         sal_Bool bExecFormatPaintbrush = pApplyTempl && pApplyTempl->pFormatClipboard
    3501 [ #  # ][ #  # ]:          0 :                                 &&  pApplyTempl->pFormatClipboard->HasContent();
         [ #  # ][ #  # ]
    3502         [ #  # ]:          0 :         if( bExecFormatPaintbrush )
    3503                 :          0 :             rMEvt = MouseEvent( _rMEvt.GetPosPixel(), _rMEvt.GetClicks(),
    3504         [ #  # ]:          0 :                                     _rMEvt.GetMode(), _rMEvt.GetButtons() );
    3505                 :            :     }
    3506                 :            : 
    3507                 :            :     // as long as an action is running the MouseMove should be disconnected
    3508                 :            :     // otherwise bug 40102 occurs
    3509                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
    3510         [ #  # ]:          0 :     if( rSh.ActionPend() )
    3511                 :            :         return ;
    3512                 :            : 
    3513 [ #  # ][ #  # ]:          0 :     if( pShadCrsr && 0 != (rMEvt.GetModifier() + rMEvt.GetButtons() ) )
                 [ #  # ]
    3514 [ #  # ][ #  # ]:          0 :         delete pShadCrsr, pShadCrsr = 0;
    3515                 :            : 
    3516 [ #  # ][ #  # ]:          0 :     sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly();
    3517                 :            : 
    3518         [ #  # ]:          0 :     SET_CURR_SHELL( &rSh );
    3519                 :            : 
    3520                 :            :     //aPixPt == Point in Pixel, relative to ChildWin
    3521                 :            :     //aDocPt == Point in Twips, document coordinates
    3522                 :          0 :     const Point aPixPt( rMEvt.GetPosPixel() );
    3523         [ #  # ]:          0 :     const Point aDocPt( PixelToLogic( aPixPt ) );
    3524                 :            : 
    3525         [ #  # ]:          0 :     if ( IsChainMode() )
    3526                 :            :     {
    3527         [ #  # ]:          0 :         UpdatePointer( aDocPt, rMEvt.GetModifier() );
    3528                 :            :         return;
    3529                 :            :     }
    3530                 :            : 
    3531         [ #  # ]:          0 :     SdrView *pSdrView = rSh.GetDrawView();
    3532                 :            : 
    3533                 :          0 :     const SwCallMouseEvent aLastCallEvent( aSaveCallEvent );
    3534                 :          0 :     aSaveCallEvent.Clear();
    3535                 :            : 
    3536 [ #  # ][ #  # ]:          0 :     if ( !bIsDocReadOnly && pSdrView && pSdrView->MouseMove(rMEvt,this) )
         [ #  # ][ #  # ]
                 [ #  # ]
    3537                 :            :     {
    3538         [ #  # ]:          0 :         SetPointer( POINTER_TEXT );
    3539                 :            :         return; // evaluate SdrView's event
    3540                 :            :     }
    3541                 :            : 
    3542                 :          0 :     const Point aOldPt( rSh.VisArea().Pos() );
    3543         [ #  # ]:          0 :     const sal_Bool bInsWin = rSh.VisArea().IsInside( aDocPt );
    3544                 :            : 
    3545 [ #  # ][ #  # ]:          0 :     if( pShadCrsr && !bInsWin )
    3546 [ #  # ][ #  # ]:          0 :         delete pShadCrsr, pShadCrsr = 0;
    3547                 :            : 
    3548 [ #  # ][ #  # ]:          0 :     if( bInsWin && pRowColumnSelectionStart )
    3549                 :            :     {
    3550         [ #  # ]:          0 :         EnterArea();
    3551                 :          0 :         Point aPos( aDocPt );
    3552 [ #  # ][ #  # ]:          0 :         if( rSh.SelectTableRowCol( *pRowColumnSelectionStart, &aPos, bIsRowDrag ))
    3553                 :            :             return;
    3554                 :            :     }
    3555                 :            : 
    3556                 :            :     // position is necessary for OS/2 because obviously after a MB-Down
    3557                 :            :     // a MB-Move is called immediately.
    3558         [ #  # ]:          0 :     if( bDDTimerStarted )
    3559                 :            :     {
    3560                 :          0 :         Point aDD( SwEditWin::nDDStartPosX, SwEditWin::nDDStartPosY );
    3561         [ #  # ]:          0 :         aDD = LogicToPixel( aDD );
    3562         [ #  # ]:          0 :         Rectangle aRect( aDD.X()-3, aDD.Y()-3, aDD.X()+3, aDD.Y()+3 );
    3563 [ #  # ][ #  # ]:          0 :         if ( !aRect.IsInside( aPixPt ) )
    3564         [ #  # ]:          0 :             StopDDTimer( &rSh, aDocPt );
    3565                 :            :     }
    3566                 :            : 
    3567         [ #  # ]:          0 :     if(rView.GetDrawFuncPtr())
    3568                 :            :     {
    3569         [ #  # ]:          0 :         if( bInsDraw  )
    3570                 :            :         {
    3571         [ #  # ]:          0 :             rView.GetDrawFuncPtr()->MouseMove( rMEvt );
    3572         [ #  # ]:          0 :             if ( !bInsWin )
    3573                 :            :             {
    3574                 :          0 :                 Point aTmp( aDocPt );
    3575                 :          0 :                 aTmp += rSh.VisArea().Pos() - aOldPt;
    3576         [ #  # ]:          0 :                 LeaveArea( aTmp );
    3577                 :            :             }
    3578                 :            :             else
    3579         [ #  # ]:          0 :                 EnterArea();
    3580                 :            :             return;
    3581                 :            :         }
    3582 [ #  # ][ #  # ]:          0 :         else if(!rSh.IsFrmSelected() && !rSh.IsObjSelected())
         [ #  # ][ #  # ]
                 [ #  # ]
    3583                 :            :         {
    3584                 :          0 :             SfxBindings &rBnd = rSh.GetView().GetViewFrame()->GetBindings();
    3585         [ #  # ]:          0 :             Point aRelPos = rSh.GetRelativePagePosition(aDocPt);
    3586         [ #  # ]:          0 :             if(aRelPos.X() >= 0)
    3587                 :            :             {
    3588 [ #  # ][ #  # ]:          0 :                 FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    3589 [ #  # ][ #  # ]:          0 :                 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
         [ #  # ][ #  # ]
    3590         [ #  # ]:          0 :                 const SfxPointItem aTmp1( SID_ATTR_POSITION, aRelPos );
    3591 [ #  # ][ #  # ]:          0 :                 rBnd.SetState( aTmp1 );
    3592                 :            :             }
    3593                 :            :             else
    3594                 :            :             {
    3595         [ #  # ]:          0 :                 rBnd.Invalidate(SID_ATTR_POSITION);
    3596                 :            :             }
    3597         [ #  # ]:          0 :             rBnd.Invalidate(SID_ATTR_SIZE);
    3598         [ #  # ]:          0 :             const SfxStringItem aCell( SID_TABLE_CELL, aEmptyStr );
    3599 [ #  # ][ #  # ]:          0 :             rBnd.SetState( aCell );
    3600                 :            :         }
    3601                 :            :     }
    3602                 :            : 
    3603                 :            :     sal_uInt8 nMouseTabCol;
    3604 [ #  # ][ #  # ]:          0 :     if( !bIsDocReadOnly && bInsWin && !pApplyTempl && !rSh.IsInSelect() )
         [ #  # ][ #  # ]
                 [ #  # ]
    3605                 :            :     {
    3606 [ #  # ][ #  # ]:          0 :         if ( SW_TABCOL_NONE != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPt ) ) &&
         [ #  # ][ #  # ]
    3607         [ #  # ]:          0 :              !rSh.IsObjSelectable( aDocPt ) )
    3608                 :            :         {
    3609                 :          0 :             sal_uInt16 nPointer = USHRT_MAX;
    3610                 :          0 :             bool bChkTblSel = false;
    3611                 :            : 
    3612   [ #  #  #  #  :          0 :             switch ( nMouseTabCol )
             #  #  #  # ]
    3613                 :            :             {
    3614                 :            :                 case SW_TABCOL_VERT :
    3615                 :            :                 case SW_TABROW_HORI :
    3616                 :          0 :                     nPointer = POINTER_VSIZEBAR;
    3617                 :          0 :                     bChkTblSel = true;
    3618                 :          0 :                     break;
    3619                 :            :                 case SW_TABROW_VERT :
    3620                 :            :                 case SW_TABCOL_HORI :
    3621                 :          0 :                     nPointer = POINTER_HSIZEBAR;
    3622                 :          0 :                     bChkTblSel = true;
    3623                 :          0 :                     break;
    3624                 :            :                 case SW_TABSEL_HORI :
    3625                 :          0 :                     nPointer = POINTER_TAB_SELECT_SE;
    3626                 :          0 :                     break;
    3627                 :            :                 case SW_TABSEL_HORI_RTL :
    3628                 :            :                 case SW_TABSEL_VERT :
    3629                 :          0 :                     nPointer = POINTER_TAB_SELECT_SW;
    3630                 :          0 :                     break;
    3631                 :            :                 case SW_TABCOLSEL_HORI :
    3632                 :            :                 case SW_TABROWSEL_VERT :
    3633                 :          0 :                     nPointer = POINTER_TAB_SELECT_S;
    3634                 :          0 :                     break;
    3635                 :            :                 case SW_TABROWSEL_HORI :
    3636                 :          0 :                     nPointer = POINTER_TAB_SELECT_E;
    3637                 :          0 :                     break;
    3638                 :            :                 case SW_TABROWSEL_HORI_RTL :
    3639                 :            :                 case SW_TABCOLSEL_VERT :
    3640                 :          0 :                     nPointer = POINTER_TAB_SELECT_W;
    3641                 :          0 :                     break;
    3642                 :            :             }
    3643                 :            : 
    3644         [ #  # ]:          0 :             if ( USHRT_MAX != nPointer &&
           [ #  #  #  # ]
                 [ #  # ]
    3645                 :            :                 // i#35543 - Enhanced table selection is explicitly allowed in table mode
    3646                 :          0 :                 ( !bChkTblSel || !rSh.IsTableMode() ) )
    3647                 :            :             {
    3648         [ #  # ]:          0 :                 SetPointer( nPointer );
    3649                 :            :             }
    3650                 :            : 
    3651                 :            :             return;
    3652                 :            :         }
    3653 [ #  # ][ #  # ]:          0 :         else if (rSh.IsNumLabel(aDocPt, RULER_MOUSE_MARGINWIDTH))
    3654                 :            :         {
    3655                 :            :             // i#42921 - consider vertical mode
    3656         [ #  # ]:          0 :             SwTxtNode* pNodeAtPos = rSh.GetNumRuleNodeAtPos( aDocPt );
    3657                 :            :             const sal_uInt16 nPointer =
    3658         [ #  # ]:          0 :                     rSh.IsVerticalModeAtNdAndPos( *pNodeAtPos, aDocPt )
    3659                 :            :                     ? POINTER_VSIZEBAR
    3660         [ #  # ]:          0 :                     : POINTER_HSIZEBAR;
    3661         [ #  # ]:          0 :             SetPointer( nPointer );
    3662                 :            : 
    3663                 :            :             return;
    3664                 :            :         }
    3665                 :            :     }
    3666                 :            : 
    3667                 :          0 :     sal_Bool bDelShadCrsr = sal_True;
    3668                 :            : 
    3669   [ #  #  #  #  :          0 :     switch ( rMEvt.GetModifier() + rMEvt.GetButtons() )
                #  #  # ]
    3670                 :            :     {
    3671                 :            :         case MOUSE_LEFT:
    3672         [ #  # ]:          0 :             if( pAnchorMarker )
    3673                 :            :             {
    3674                 :            :                 // Now we need to refresh the SdrHdl pointer of pAnchorMarker.
    3675                 :            :                 // This looks a little bit tricky, but it solves the following
    3676                 :            :                 // problem: the pAnchorMarker contains a pointer to an SdrHdl,
    3677                 :            :                 // if the FindAnchorPos-call cause a scrolling of the visible
    3678                 :            :                 // area, it's possible that the SdrHdl will be destroyed and a
    3679                 :            :                 // new one will initialized at the original position(GetHdlPos).
    3680                 :            :                 // So the pAnchorMarker has to find the right SdrHdl, if it's
    3681                 :            :                 // the old one, it will find it with position aOld, if this one
    3682                 :            :                 // is destroyed, it will find a new one at position GetHdlPos().
    3683                 :            : 
    3684         [ #  # ]:          0 :                 const Point aOld = pAnchorMarker->GetPosForHitTest( *(rSh.GetOut()) );
    3685         [ #  # ]:          0 :                 Point aNew = rSh.FindAnchorPos( aDocPt );
    3686                 :            :                 SdrHdl* pHdl;
    3687         [ #  # ]:          0 :                 if( (0!=( pHdl = pSdrView->PickHandle( aOld ) )||
           [ #  #  #  # ]
           [ #  #  #  #  
           #  # ][ #  # ]
    3688                 :          0 :                     0 !=(pHdl = pSdrView->PickHandle( pAnchorMarker->GetHdlPos()) ) ) &&
    3689                 :          0 :                         ( pHdl->GetKind() == HDL_ANCHOR ||
    3690                 :          0 :                           pHdl->GetKind() == HDL_ANCHOR_TR ) )
    3691                 :            :                 {
    3692                 :          0 :                     pAnchorMarker->ChgHdl( pHdl );
    3693 [ #  # ][ #  # ]:          0 :                     if( aNew.X() || aNew.Y() )
                 [ #  # ]
    3694                 :            :                     {
    3695         [ #  # ]:          0 :                         pAnchorMarker->SetPos( aNew );
    3696                 :          0 :                         pAnchorMarker->SetLastPos( aDocPt );
    3697                 :            :                     }
    3698                 :            :                 }
    3699                 :            :                 else
    3700                 :            :                 {
    3701                 :          0 :                     delete pAnchorMarker;
    3702                 :          0 :                     pAnchorMarker = NULL;
    3703                 :            :                 }
    3704                 :            :             }
    3705         [ #  # ]:          0 :             if ( bInsDraw )
    3706                 :            :             {
    3707         [ #  # ]:          0 :                 if ( !bMBPressed )
    3708                 :          0 :                     break;
    3709 [ #  # ][ #  # ]:          0 :                 if ( bIsInMove || IsMinMove( aStartPos, aPixPt ) )
         [ #  # ][ #  # ]
    3710                 :            :                 {
    3711         [ #  # ]:          0 :                     if ( !bInsWin )
    3712         [ #  # ]:          0 :                         LeaveArea( aDocPt );
    3713                 :            :                     else
    3714         [ #  # ]:          0 :                         EnterArea();
    3715         [ #  # ]:          0 :                     if ( rView.GetDrawFuncPtr() )
    3716                 :            :                     {
    3717                 :          0 :                         pSdrView->SetOrtho(sal_False);
    3718         [ #  # ]:          0 :                         rView.GetDrawFuncPtr()->MouseMove( rMEvt );
    3719                 :            :                     }
    3720                 :          0 :                     bIsInMove = sal_True;
    3721                 :            :                 }
    3722                 :            :                 return;
    3723                 :            :             }
    3724                 :            : 
    3725                 :            :             {
    3726 [ #  # ][ #  # ]:          0 :             SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)GetView().GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
    3727         [ #  # ]:          0 :             if (pWrdCnt)
    3728         [ #  # ]:          0 :                 pWrdCnt->UpdateCounts();
    3729                 :            :             }
    3730                 :            : 
    3731                 :            :         case MOUSE_LEFT + KEY_SHIFT:
    3732                 :            :         case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1:
    3733         [ #  # ]:          0 :             if ( !bMBPressed )
    3734                 :          0 :                 break;
    3735                 :            :         case MOUSE_LEFT + KEY_MOD1:
    3736 [ #  # ][ #  # ]:          0 :             if ( bFrmDrag && rSh.IsSelFrmMode() )
                 [ #  # ]
    3737                 :            :             {
    3738         [ #  # ]:          0 :                 if( !bMBPressed )
    3739                 :          0 :                     break;
    3740                 :            : 
    3741 [ #  # ][ #  # ]:          0 :                 if ( bIsInMove || IsMinMove( aStartPos, aPixPt ) )
         [ #  # ][ #  # ]
    3742                 :            :                 {
    3743                 :            :                     // event processing for resizing
    3744         [ #  # ]:          0 :                     if( pSdrView->AreObjectsMarked() )
    3745                 :            :                     {
    3746                 :            :                         const SwFrmFmt* pFlyFmt;
    3747                 :            :                         const SvxMacro* pMacro;
    3748                 :            : 
    3749         [ #  # ]:          0 :                         const Point aSttPt( PixelToLogic( aStartPos ) );
    3750                 :            : 
    3751                 :            :                         // can we start?
    3752         [ #  # ]:          0 :                         if( HDL_USER == eSdrMoveHdl )
    3753                 :            :                         {
    3754         [ #  # ]:          0 :                             SdrHdl* pHdl = pSdrView->PickHandle( aSttPt );
    3755         [ #  # ]:          0 :                             eSdrMoveHdl = pHdl ? pHdl->GetKind() : HDL_MOVE;
    3756                 :            :                         }
    3757                 :            : 
    3758                 :            :                         sal_uInt16 nEvent = HDL_MOVE == eSdrMoveHdl
    3759                 :            :                                             ? SW_EVENT_FRM_MOVE
    3760         [ #  # ]:          0 :                                             : SW_EVENT_FRM_RESIZE;
    3761                 :            : 
    3762         [ #  # ]:          0 :                         if( 0 != ( pFlyFmt = rSh.GetFlyFrmFmt() ) &&
           [ #  #  #  # ]
           [ #  #  #  # ]
                 [ #  # ]
    3763         [ #  # ]:          0 :                             0 != ( pMacro = pFlyFmt->GetMacro().GetMacroTable().
    3764                 :          0 :                             Get( nEvent )) &&
    3765                 :            : // or notify only e.g. every 20 Twip?
    3766                 :          0 :                             aRszMvHdlPt != aDocPt )
    3767                 :            :                         {
    3768                 :          0 :                             aRszMvHdlPt = aDocPt;
    3769                 :          0 :                             sal_uInt16 nPos = 0;
    3770         [ #  # ]:          0 :                             String sRet;
    3771 [ #  # ][ #  # ]:          0 :                             SbxArrayRef xArgs = new SbxArray;
    3772 [ #  # ][ #  # ]:          0 :                             SbxVariableRef xVar = new SbxVariable;
    3773 [ #  # ][ #  # ]:          0 :                             xVar->PutString( pFlyFmt->GetName() );
    3774         [ #  # ]:          0 :                             xArgs->Put( &xVar, ++nPos );
    3775                 :            : 
    3776         [ #  # ]:          0 :                             if( SW_EVENT_FRM_RESIZE == nEvent )
    3777                 :            :                             {
    3778 [ #  # ][ #  # ]:          0 :                                 xVar = new SbxVariable;
                 [ #  # ]
    3779         [ #  # ]:          0 :                                 xVar->PutUShort( static_cast< sal_uInt16 >(eSdrMoveHdl) );
    3780         [ #  # ]:          0 :                                 xArgs->Put( &xVar, ++nPos );
    3781                 :            :                             }
    3782                 :            : 
    3783 [ #  # ][ #  # ]:          0 :                             xVar = new SbxVariable;
                 [ #  # ]
    3784         [ #  # ]:          0 :                             xVar->PutLong( aDocPt.X() - aSttPt.X() );
    3785         [ #  # ]:          0 :                             xArgs->Put( &xVar, ++nPos );
    3786 [ #  # ][ #  # ]:          0 :                             xVar = new SbxVariable;
                 [ #  # ]
    3787         [ #  # ]:          0 :                             xVar->PutLong( aDocPt.Y() - aSttPt.Y() );
    3788         [ #  # ]:          0 :                             xArgs->Put( &xVar, ++nPos );
    3789                 :            : 
    3790         [ #  # ]:          0 :                             ReleaseMouse();
    3791                 :            : 
    3792         [ #  # ]:          0 :                             rSh.ExecMacro( *pMacro, &sRet, &xArgs );
    3793                 :            : 
    3794         [ #  # ]:          0 :                             CaptureMouse();
    3795                 :            : 
    3796 [ #  # ][ #  # ]:          0 :                             if( sRet.Len() && 0 != sRet.ToInt32() )
         [ #  # ][ #  # ]
    3797 [ #  # ][ #  # ]:          0 :                                 return ;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    3798                 :            :                         }
    3799                 :            :                     }
    3800                 :            :                     // event processing for resizing
    3801                 :            : 
    3802         [ #  # ]:          0 :                     if( bIsDocReadOnly )
    3803                 :          0 :                         break;
    3804                 :            : 
    3805         [ #  # ]:          0 :                     if ( rMEvt.IsShift() )
    3806                 :            :                     {
    3807                 :          0 :                         pSdrView->SetOrtho(sal_True);
    3808                 :          0 :                         pSdrView->SetAngleSnapEnabled(sal_True);
    3809                 :            :                     }
    3810                 :            :                     else
    3811                 :            :                     {
    3812                 :          0 :                         pSdrView->SetOrtho(sal_False);
    3813                 :          0 :                         pSdrView->SetAngleSnapEnabled(sal_False);
    3814                 :            :                     }
    3815                 :            : 
    3816         [ #  # ]:          0 :                     rSh.Drag( &aDocPt, rMEvt.IsShift() );
    3817                 :          0 :                     bIsInMove = sal_True;
    3818                 :            :                 }
    3819         [ #  # ]:          0 :                 else if( bIsDocReadOnly )
    3820                 :          0 :                     break;
    3821                 :            : 
    3822         [ #  # ]:          0 :                 if ( !bInsWin )
    3823                 :            :                 {
    3824                 :          0 :                     Point aTmp( aDocPt );
    3825                 :          0 :                     aTmp += rSh.VisArea().Pos() - aOldPt;
    3826         [ #  # ]:          0 :                     LeaveArea( aTmp );
    3827                 :            :                 }
    3828         [ #  # ]:          0 :                 else if(bIsInMove)
    3829         [ #  # ]:          0 :                     EnterArea();
    3830                 :            :                 return;
    3831                 :            :             }
    3832 [ #  # ][ #  # ]:          0 :             if ( !rSh.IsSelFrmMode() && !bDDINetAttr &&
                 [ #  # ]
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    3833         [ #  # ]:          0 :                 (IsMinMove( aStartPos,aPixPt ) || bIsInMove) &&
    3834         [ #  # ]:          0 :                 (rSh.IsInSelect() || !rSh.ChgCurrPam( aDocPt )) )
    3835                 :            :             {
    3836         [ #  # ]:          0 :                 if ( pSdrView )
    3837                 :            :                 {
    3838         [ #  # ]:          0 :                     if ( rMEvt.IsShift() )
    3839                 :          0 :                         pSdrView->SetOrtho(sal_True);
    3840                 :            :                     else
    3841                 :          0 :                         pSdrView->SetOrtho(sal_False);
    3842                 :            :                 }
    3843         [ #  # ]:          0 :                 if ( !bInsWin )
    3844                 :            :                 {
    3845                 :          0 :                     Point aTmp( aDocPt );
    3846                 :          0 :                     aTmp += rSh.VisArea().Pos() - aOldPt;
    3847         [ #  # ]:          0 :                     LeaveArea( aTmp );
    3848                 :            :                 }
    3849                 :            :                 else
    3850                 :            :                 {
    3851   [ #  #  #  # ]:          0 :                     if( !rMEvt.IsSynthetic() &&
                 [ #  # ]
    3852                 :            :                             !(( MOUSE_LEFT + KEY_MOD1 ==
    3853                 :          0 :                             rMEvt.GetModifier() + rMEvt.GetButtons() ) &&
    3854 [ #  # ][ #  # ]:          0 :                             rSh.Is_FnDragEQBeginDrag() && !rSh.IsAddMode() ))
    3855                 :            :                     {
    3856         [ #  # ]:          0 :                         rSh.Drag( &aDocPt, false );
    3857                 :            : 
    3858         [ #  # ]:          0 :                         bValidCrsrPos = !(CRSR_POSCHG & rSh.SetCursor(&aDocPt, false));
    3859         [ #  # ]:          0 :                         EnterArea();
    3860                 :            :                     }
    3861                 :            :                 }
    3862                 :            :             }
    3863                 :          0 :             bDDINetAttr = sal_False;
    3864                 :          0 :             break;
    3865                 :            :         case 0:
    3866                 :            :         {
    3867         [ #  # ]:          0 :             if ( pApplyTempl )
    3868                 :            :             {
    3869         [ #  # ]:          0 :                 UpdatePointer(aDocPt, 0); // maybe a frame has to be marked here
    3870                 :            :                 break;
    3871                 :            :             }
    3872                 :            :             // change ui if mouse is over SwPostItField
    3873                 :            :             // TODO: do the same thing for redlines SW_REDLINE
    3874                 :          0 :             SwRect aFldRect;
    3875         [ #  # ]:          0 :             SwContentAtPos aCntntAtPos( SwContentAtPos::SW_FIELD);
    3876 [ #  # ][ #  # ]:          0 :             if( rSh.GetContentAtPos( aDocPt, aCntntAtPos, sal_False, &aFldRect ) )
    3877                 :            :             {
    3878                 :          0 :                 const SwField* pFld = aCntntAtPos.aFnd.pFld;
    3879         [ #  # ]:          0 :                 if (pFld->Which()== RES_POSTITFLD)
    3880                 :            :                 {
    3881         [ #  # ]:          0 :                     rView.GetPostItMgr()->SetShadowState(reinterpret_cast<const SwPostItField*>(pFld),false);
    3882                 :            :                 }
    3883                 :            :                 else
    3884         [ #  # ]:          0 :                     rView.GetPostItMgr()->SetShadowState(0,false);
    3885                 :            :             }
    3886                 :            :             else
    3887 [ #  # ][ #  # ]:          0 :                 rView.GetPostItMgr()->SetShadowState(0,false);
    3888                 :            :         }
    3889                 :            :         // no break;
    3890                 :            :         case KEY_SHIFT:
    3891                 :            :         case KEY_MOD2:
    3892                 :            :         case KEY_MOD1:
    3893         [ #  # ]:          0 :             if ( !bInsDraw )
    3894                 :            :             {
    3895                 :          0 :                 sal_Bool bTstShdwCrsr = sal_True;
    3896                 :            : 
    3897         [ #  # ]:          0 :                 UpdatePointer( aDocPt, rMEvt.GetModifier() );
    3898                 :            : 
    3899                 :          0 :                 const SwFrmFmt* pFmt = 0;
    3900                 :          0 :                 const SwFmtINetFmt* pINet = 0;
    3901         [ #  # ]:          0 :                 SwContentAtPos aCntntAtPos( SwContentAtPos::SW_INETATTR );
    3902 [ #  # ][ #  # ]:          0 :                 if( rSh.GetContentAtPos( aDocPt, aCntntAtPos ) )
    3903                 :          0 :                     pINet = (SwFmtINetFmt*)aCntntAtPos.aFnd.pAttr;
    3904                 :            : 
    3905                 :          0 :                 const void* pTmp = pINet;
    3906                 :            : 
    3907 [ #  # ][ #  # ]:          0 :                 if( pINet ||
         [ #  # ][ #  # ]
    3908                 :          0 :                     0 != ( pTmp = pFmt = rSh.GetFmtFromAnyObj( aDocPt )))
    3909                 :            :                 {
    3910                 :          0 :                     bTstShdwCrsr = sal_False;
    3911         [ #  # ]:          0 :                     if( pTmp == pINet )
    3912                 :          0 :                         aSaveCallEvent.Set( pINet );
    3913                 :            :                     else
    3914                 :            :                     {
    3915         [ #  # ]:          0 :                         IMapObject* pIMapObj = pFmt->GetIMapObject( aDocPt );
    3916         [ #  # ]:          0 :                         if( pIMapObj )
    3917                 :          0 :                             aSaveCallEvent.Set( pFmt, pIMapObj );
    3918                 :            :                         else
    3919                 :          0 :                             aSaveCallEvent.Set( EVENT_OBJECT_URLITEM, pFmt );
    3920                 :            :                     }
    3921                 :            : 
    3922                 :            :                     // should be be over a InternetField with an
    3923                 :            :                     // embedded macro?
    3924         [ #  # ]:          0 :                     if( aSaveCallEvent != aLastCallEvent )
    3925                 :            :                     {
    3926         [ #  # ]:          0 :                         if( aLastCallEvent.HasEvent() )
    3927                 :            :                             rSh.CallEvent( SFX_EVENT_MOUSEOUT_OBJECT,
    3928         [ #  # ]:          0 :                                             aLastCallEvent, sal_True );
    3929                 :            :                         // 0 says that the object doesn't have any table
    3930         [ #  # ]:          0 :                         if( !rSh.CallEvent( SFX_EVENT_MOUSEOVER_OBJECT,
    3931         [ #  # ]:          0 :                                         aSaveCallEvent ))
    3932                 :          0 :                             aSaveCallEvent.Clear();
    3933                 :            :                     }
    3934                 :            :                 }
    3935         [ #  # ]:          0 :                 else if( aLastCallEvent.HasEvent() )
    3936                 :            :                 {
    3937                 :            :                     // cursor was on an object
    3938                 :            :                     rSh.CallEvent( SFX_EVENT_MOUSEOUT_OBJECT,
    3939         [ #  # ]:          0 :                                     aLastCallEvent, sal_True );
    3940                 :            :                 }
    3941                 :            : 
    3942 [ #  # ][ #  # ]:          0 :                 if( bTstShdwCrsr && bInsWin && !bIsDocReadOnly &&
         [ #  # ][ #  #  
          #  #  #  #  #  
                      # ]
           [ #  #  #  # ]
                 [ #  # ]
    3943                 :          0 :                     !bInsFrm &&
    3944                 :          0 :                     !rSh.GetViewOptions()->getBrowseMode() &&
    3945                 :          0 :                     rSh.GetViewOptions()->IsShadowCursor() &&
    3946                 :          0 :                     !(rMEvt.GetModifier() + rMEvt.GetButtons()) &&
    3947         [ #  # ]:          0 :                     !rSh.HasSelection() && !GetConnectMetaFile() )
    3948                 :            :                 {
    3949                 :          0 :                     SwRect aRect;
    3950                 :            :                     sal_Int16 eOrient;
    3951                 :          0 :                     SwFillMode eMode = (SwFillMode)rSh.GetViewOptions()->GetShdwCrsrFillMode();
    3952 [ #  # ][ #  # ]:          0 :                     if( rSh.GetShadowCrsrPos( aDocPt, eMode, aRect, eOrient ))
    3953                 :            :                     {
    3954         [ #  # ]:          0 :                         if( !pShadCrsr )
    3955                 :            :                             pShadCrsr = new SwShadowCursor( *this,
    3956 [ #  # ][ #  # ]:          0 :                                 SwViewOption::GetDirectCursorColor() );
    3957 [ #  # ][ #  # ]:          0 :                         if( text::HoriOrientation::RIGHT != eOrient && text::HoriOrientation::CENTER != eOrient )
    3958                 :          0 :                             eOrient = text::HoriOrientation::LEFT;
    3959         [ #  # ]:          0 :                         pShadCrsr->SetPos( aRect.Pos(), aRect.Height(), static_cast< sal_uInt16 >(eOrient) );
    3960                 :          0 :                         bDelShadCrsr = sal_False;
    3961                 :            :                     }
    3962         [ #  # ]:          0 :                 }
    3963                 :            :             }
    3964                 :          0 :             break;
    3965                 :            :         case MOUSE_LEFT + KEY_MOD2:
    3966 [ #  # ][ #  # ]:          0 :             if( rSh.IsBlockMode() && !rMEvt.IsSynthetic() )
                 [ #  # ]
    3967                 :            :             {
    3968         [ #  # ]:          0 :                 rSh.Drag( &aDocPt, false );
    3969         [ #  # ]:          0 :                 bValidCrsrPos = !(CRSR_POSCHG & rSh.SetCursor(&aDocPt, false));
    3970         [ #  # ]:          0 :                 EnterArea();
    3971                 :            :             }
    3972                 :          0 :         break;
    3973                 :            :     }
    3974                 :            : 
    3975 [ #  # ][ #  # ]:          0 :     if( bDelShadCrsr && pShadCrsr )
    3976 [ #  # ][ #  # ]:          0 :         delete pShadCrsr, pShadCrsr = 0;
    3977 [ #  # ][ #  # ]:          0 :     bWasShdwCrsr = sal_False;
    3978                 :            : }
    3979                 :            : 
    3980                 :            : /*--------------------------------------------------------------------
    3981                 :            :     Description:   Button Up
    3982                 :            :  --------------------------------------------------------------------*/
    3983                 :            : 
    3984                 :          0 : void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
    3985                 :            : {
    3986                 :          0 :     sal_Bool bCallBase = sal_True;
    3987                 :            : 
    3988                 :          0 :     sal_Bool bCallShadowCrsr = bWasShdwCrsr;
    3989                 :          0 :     bWasShdwCrsr = sal_False;
    3990         [ #  # ]:          0 :     if( pShadCrsr )
    3991 [ #  # ][ #  # ]:          0 :         delete pShadCrsr, pShadCrsr = 0;
    3992                 :            : 
    3993         [ #  # ]:          0 :     if( pRowColumnSelectionStart )
    3994                 :          0 :         DELETEZ( pRowColumnSelectionStart );
    3995                 :            : 
    3996                 :          0 :     SdrHdlKind eOldSdrMoveHdl = eSdrMoveHdl;
    3997                 :          0 :     eSdrMoveHdl = HDL_USER;     // for MoveEvents - reset again
    3998                 :            : 
    3999                 :            :     // preventively reset
    4000                 :          0 :     rView.SetTabColFromDoc( sal_False );
    4001                 :          0 :     rView.SetNumRuleNodeFromDoc(NULL);
    4002                 :            : 
    4003                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
    4004         [ #  # ]:          0 :     SET_CURR_SHELL( &rSh );
    4005         [ #  # ]:          0 :     SdrView *pSdrView = rSh.GetDrawView();
    4006         [ #  # ]:          0 :     if ( pSdrView )
    4007                 :            :     {
    4008                 :          0 :         pSdrView->SetOrtho(sal_False);
    4009                 :            : 
    4010 [ #  # ][ #  # ]:          0 :         if ( pSdrView->MouseButtonUp( rMEvt,this ) )
    4011                 :            :         {
    4012         [ #  # ]:          0 :             rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
    4013                 :            :             return; // SdrView's event evaluated
    4014                 :            :         }
    4015                 :            :     }
    4016                 :            :     // only process MouseButtonUp when the Down went to that windows as well.
    4017         [ #  # ]:          0 :     if ( !bMBPressed )
    4018                 :            :     {
    4019                 :            : // Undo for the watering can is already in CommandHdl
    4020                 :            : // that's the way it should be!
    4021                 :            : 
    4022                 :            :         return;
    4023                 :            :     }
    4024                 :            : 
    4025         [ #  # ]:          0 :     Point aDocPt( PixelToLogic( rMEvt.GetPosPixel() ) );
    4026                 :            : 
    4027         [ #  # ]:          0 :     if ( bDDTimerStarted )
    4028                 :            :     {
    4029         [ #  # ]:          0 :         StopDDTimer( &rSh, aDocPt );
    4030                 :          0 :         bMBPressed = sal_False;
    4031         [ #  # ]:          0 :         if ( rSh.IsSelFrmMode() )
    4032                 :            :         {
    4033         [ #  # ]:          0 :             rSh.EndDrag( &aDocPt, false );
    4034                 :          0 :             bFrmDrag = sal_False;
    4035                 :            :         }
    4036                 :          0 :         bNoInterrupt = sal_False;
    4037         [ #  # ]:          0 :         ReleaseMouse();
    4038                 :            :         return;
    4039                 :            :     }
    4040                 :            : 
    4041         [ #  # ]:          0 :     if( pAnchorMarker )
    4042                 :            :     {
    4043                 :          0 :         Point aPnt( pAnchorMarker->GetLastPos() );
    4044                 :          0 :         DELETEZ( pAnchorMarker );
    4045 [ #  # ][ #  # ]:          0 :         if( aPnt.X() || aPnt.Y() )
                 [ #  # ]
    4046         [ #  # ]:          0 :             rSh.FindAnchorPos( aPnt, sal_True );
    4047                 :            :     }
    4048 [ #  # ][ #  # ]:          0 :     if ( bInsDraw && rView.GetDrawFuncPtr() )
                 [ #  # ]
    4049                 :            :     {
    4050 [ #  # ][ #  # ]:          0 :         if ( rView.GetDrawFuncPtr()->MouseButtonUp( rMEvt ) )
    4051                 :            :         {
    4052         [ #  # ]:          0 :             if (rView.GetDrawFuncPtr()) // could have been destroyed in MouseButtonUp
    4053                 :            :             {
    4054         [ #  # ]:          0 :                 rView.GetDrawFuncPtr()->Deactivate();
    4055                 :            : 
    4056         [ #  # ]:          0 :                 if (!rView.IsDrawMode())
    4057                 :            :                 {
    4058         [ #  # ]:          0 :                     rView.SetDrawFuncPtr(NULL);
    4059                 :          0 :                     SfxBindings& rBind = rView.GetViewFrame()->GetBindings();
    4060         [ #  # ]:          0 :                     rBind.Invalidate( SID_ATTR_SIZE );
    4061         [ #  # ]:          0 :                     rBind.Invalidate( SID_TABLE_CELL );
    4062                 :            :                 }
    4063                 :            :             }
    4064                 :            : 
    4065 [ #  # ][ #  # ]:          0 :             if ( rSh.IsObjSelected() )
    4066                 :            :             {
    4067         [ #  # ]:          0 :                 rSh.EnterSelFrmMode();
    4068         [ #  # ]:          0 :                 if (!rView.GetDrawFuncPtr())
    4069         [ #  # ]:          0 :                     StdDrawMode( OBJ_NONE, sal_True );
    4070                 :            :             }
    4071 [ #  # ][ #  # ]:          0 :             else if ( rSh.IsFrmSelected() )
    4072                 :            :             {
    4073         [ #  # ]:          0 :                 rSh.EnterSelFrmMode();
    4074         [ #  # ]:          0 :                 StopInsFrm();
    4075                 :            :             }
    4076                 :            :             else
    4077                 :            :             {
    4078         [ #  # ]:          0 :                 const Point aDocPos( PixelToLogic( aStartPos ) );
    4079         [ #  # ]:          0 :                 bValidCrsrPos = !(CRSR_POSCHG & rSh.SetCursor(&aDocPos, false));
    4080         [ #  # ]:          0 :                 rSh.Edit();
    4081                 :            :             }
    4082                 :            : 
    4083         [ #  # ]:          0 :             rView.AttrChangedNotify( &rSh );
    4084                 :            :         }
    4085 [ #  # ][ #  # ]:          0 :         else if (rMEvt.GetButtons() == MOUSE_RIGHT && rSh.IsDrawCreate())
         [ #  # ][ #  # ]
    4086         [ #  # ]:          0 :             rView.GetDrawFuncPtr()->BreakCreate();   // abort drawing
    4087                 :            : 
    4088                 :          0 :         bNoInterrupt = sal_False;
    4089         [ #  # ]:          0 :         ReleaseMouse();
    4090                 :            :         return;
    4091                 :            :     }
    4092                 :          0 :     sal_Bool bPopMode = sal_False;
    4093   [ #  #  #  # ]:          0 :     switch ( rMEvt.GetModifier() + rMEvt.GetButtons() )
    4094                 :            :     {
    4095                 :            :         case MOUSE_LEFT:
    4096 [ #  # ][ #  # ]:          0 :             if ( bInsDraw && rSh.IsDrawCreate() )
         [ #  # ][ #  # ]
    4097                 :            :             {
    4098 [ #  # ][ #  # ]:          0 :                 if ( rView.GetDrawFuncPtr() && rView.GetDrawFuncPtr()->MouseButtonUp(rMEvt) == sal_True )
         [ #  # ][ #  # ]
    4099                 :            :                 {
    4100         [ #  # ]:          0 :                     rView.GetDrawFuncPtr()->Deactivate();
    4101         [ #  # ]:          0 :                     rView.AttrChangedNotify( &rSh );
    4102 [ #  # ][ #  # ]:          0 :                     if ( rSh.IsObjSelected() )
    4103         [ #  # ]:          0 :                         rSh.EnterSelFrmMode();
    4104 [ #  # ][ #  # ]:          0 :                     if ( rView.GetDrawFuncPtr() && bInsFrm )
                 [ #  # ]
    4105         [ #  # ]:          0 :                         StopInsFrm();
    4106                 :            :                 }
    4107                 :          0 :                 bCallBase = sal_False;
    4108                 :          0 :                 break;
    4109                 :            :             }
    4110                 :            :         case MOUSE_LEFT + KEY_MOD1:
    4111                 :            :         case MOUSE_LEFT + KEY_MOD2:
    4112                 :            :         case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1:
    4113 [ #  # ][ #  # ]:          0 :             if ( bFrmDrag && rSh.IsSelFrmMode() )
                 [ #  # ]
    4114                 :            :             {
    4115         [ #  # ]:          0 :                 if ( rMEvt.IsMod1() ) // copy and don't move.
    4116                 :            :                 {
    4117                 :            :                     // abort drag, use internal Copy instead
    4118         [ #  # ]:          0 :                     Rectangle aRect;
    4119 [ #  # ][ #  # ]:          0 :                     rSh.GetDrawView()->TakeActionRect( aRect );
    4120 [ #  # ][ #  # ]:          0 :                     if (!aRect.IsEmpty())
    4121                 :            :                     {
    4122         [ #  # ]:          0 :                         rSh.BreakDrag();
    4123                 :          0 :                         Point aEndPt, aSttPt;
    4124 [ #  # ][ #  # ]:          0 :                         if ( rSh.GetSelFrmType() & FRMTYPE_FLY_ATCNT )
    4125                 :            :                         {
    4126                 :          0 :                             aEndPt = aRect.TopLeft();
    4127 [ #  # ][ #  # ]:          0 :                             aSttPt = rSh.GetDrawView()->GetAllMarkedRect().TopLeft();
    4128                 :            :                         }
    4129                 :            :                         else
    4130                 :            :                         {
    4131         [ #  # ]:          0 :                             aEndPt = aRect.Center();
    4132 [ #  # ][ #  # ]:          0 :                             aSttPt = rSh.GetDrawView()->GetAllMarkedRect().Center();
                 [ #  # ]
    4133                 :            :                         }
    4134         [ #  # ]:          0 :                         if ( aSttPt != aEndPt )
    4135                 :            :                         {
    4136         [ #  # ]:          0 :                             rSh.StartUndo( UNDO_UI_DRAG_AND_COPY );
    4137         [ #  # ]:          0 :                             rSh.Copy(&rSh, aSttPt, aEndPt, sal_False);
    4138         [ #  # ]:          0 :                             rSh.EndUndo( UNDO_UI_DRAG_AND_COPY );
    4139                 :            :                         }
    4140                 :            :                     }
    4141                 :            :                     else
    4142         [ #  # ]:          0 :                         rSh.EndDrag( &aDocPt, false );
    4143                 :            :                 }
    4144                 :            :                 else
    4145                 :            :                 {
    4146                 :            :                     {
    4147                 :            :                         const SwFrmFmt* pFlyFmt;
    4148                 :            :                         const SvxMacro* pMacro;
    4149                 :            : 
    4150                 :            :                         sal_uInt16 nEvent = HDL_MOVE == eOldSdrMoveHdl
    4151                 :            :                                             ? SW_EVENT_FRM_MOVE
    4152         [ #  # ]:          0 :                                             : SW_EVENT_FRM_RESIZE;
    4153                 :            : 
    4154         [ #  # ]:          0 :                         if( 0 != ( pFlyFmt = rSh.GetFlyFrmFmt() ) &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    4155         [ #  # ]:          0 :                             0 != ( pMacro = pFlyFmt->GetMacro().GetMacroTable().
    4156                 :          0 :                             Get( nEvent )) )
    4157                 :            :                         {
    4158         [ #  # ]:          0 :                             const Point aSttPt( PixelToLogic( aStartPos ) );
    4159                 :          0 :                             aRszMvHdlPt = aDocPt;
    4160                 :          0 :                             sal_uInt16 nPos = 0;
    4161 [ #  # ][ #  # ]:          0 :                             SbxArrayRef xArgs = new SbxArray;
    4162 [ #  # ][ #  # ]:          0 :                             SbxVariableRef xVar = new SbxVariable;
    4163 [ #  # ][ #  # ]:          0 :                             xVar->PutString( pFlyFmt->GetName() );
    4164         [ #  # ]:          0 :                             xArgs->Put( &xVar, ++nPos );
    4165                 :            : 
    4166         [ #  # ]:          0 :                             if( SW_EVENT_FRM_RESIZE == nEvent )
    4167                 :            :                             {
    4168 [ #  # ][ #  # ]:          0 :                                 xVar = new SbxVariable;
                 [ #  # ]
    4169         [ #  # ]:          0 :                                 xVar->PutUShort( static_cast< sal_uInt16 >(eOldSdrMoveHdl) );
    4170         [ #  # ]:          0 :                                 xArgs->Put( &xVar, ++nPos );
    4171                 :            :                             }
    4172                 :            : 
    4173 [ #  # ][ #  # ]:          0 :                             xVar = new SbxVariable;
                 [ #  # ]
    4174         [ #  # ]:          0 :                             xVar->PutLong( aDocPt.X() - aSttPt.X() );
    4175         [ #  # ]:          0 :                             xArgs->Put( &xVar, ++nPos );
    4176 [ #  # ][ #  # ]:          0 :                             xVar = new SbxVariable;
                 [ #  # ]
    4177         [ #  # ]:          0 :                             xVar->PutLong( aDocPt.Y() - aSttPt.Y() );
    4178         [ #  # ]:          0 :                             xArgs->Put( &xVar, ++nPos );
    4179                 :            : 
    4180 [ #  # ][ #  # ]:          0 :                             xVar = new SbxVariable;
                 [ #  # ]
    4181         [ #  # ]:          0 :                             xVar->PutUShort( 1 );
    4182         [ #  # ]:          0 :                             xArgs->Put( &xVar, ++nPos );
    4183                 :            : 
    4184         [ #  # ]:          0 :                             ReleaseMouse();
    4185                 :            : 
    4186         [ #  # ]:          0 :                             rSh.ExecMacro( *pMacro, 0, &xArgs );
    4187                 :            : 
    4188 [ #  # ][ #  # ]:          0 :                             CaptureMouse();
                 [ #  # ]
    4189                 :            :                         }
    4190                 :            :                     }
    4191         [ #  # ]:          0 :                     rSh.EndDrag( &aDocPt, false );
    4192                 :            :                 }
    4193                 :          0 :                 bFrmDrag = sal_False;
    4194                 :          0 :                 bCallBase = sal_False;
    4195                 :          0 :                 break;
    4196                 :            :             }
    4197                 :          0 :             bPopMode = sal_True;
    4198                 :            :             // no break
    4199                 :            :         case MOUSE_LEFT + KEY_SHIFT:
    4200         [ #  # ]:          0 :             if (rSh.IsSelFrmMode())
    4201                 :            :             {
    4202                 :            : 
    4203         [ #  # ]:          0 :                 rSh.EndDrag( &aDocPt, false );
    4204                 :          0 :                 bFrmDrag = sal_False;
    4205                 :          0 :                 bCallBase = sal_False;
    4206                 :          0 :                 break;
    4207                 :            :             }
    4208                 :            : 
    4209         [ #  # ]:          0 :             if( bHoldSelection )
    4210                 :            :             {
    4211                 :            :                 // the EndDrag should be called in any case
    4212                 :          0 :                 bHoldSelection = sal_False;
    4213         [ #  # ]:          0 :                 rSh.EndDrag( &aDocPt, false );
    4214                 :            :             }
    4215                 :            :             else
    4216                 :            :             {
    4217 [ #  # ][ #  # ]:          0 :                 if ( !rSh.IsInSelect() && rSh.ChgCurrPam( aDocPt ) )
         [ #  # ][ #  # ]
    4218                 :            :                 {
    4219                 :          0 :                     const sal_Bool bTmpNoInterrupt = bNoInterrupt;
    4220                 :          0 :                     bNoInterrupt = sal_False;
    4221                 :            :                     {   // create only temporary move context because otherwise
    4222                 :            :                         // the query to the content form doesn't work!!!
    4223         [ #  # ]:          0 :                         MV_KONTEXT( &rSh );
    4224         [ #  # ]:          0 :                         const Point aDocPos( PixelToLogic( aStartPos ) );
    4225 [ #  # ][ #  # ]:          0 :                         bValidCrsrPos = !(CRSR_POSCHG & rSh.SetCursor(&aDocPos, false));
    4226                 :            :                     }
    4227                 :          0 :                     bNoInterrupt = bTmpNoInterrupt;
    4228                 :            : 
    4229                 :            :                 }
    4230                 :            :                 else
    4231                 :            :                 {
    4232                 :          0 :                     sal_Bool bInSel = rSh.IsInSelect();
    4233         [ #  # ]:          0 :                     rSh.EndDrag( &aDocPt, false );
    4234                 :            : 
    4235                 :            :                     // Internetfield? --> call link (load doc!!)
    4236         [ #  # ]:          0 :                     if( !bInSel )
    4237                 :            :                     {
    4238                 :          0 :                         sal_uInt16 nFilter = URLLOAD_NOFILTER;
    4239         [ #  # ]:          0 :                         if( KEY_MOD1 == rMEvt.GetModifier() )
    4240                 :          0 :                             nFilter |= URLLOAD_NEWVIEW;
    4241                 :            : 
    4242 [ #  # ][ #  # ]:          0 :                         sal_Bool bExecHyperlinks = rView.GetDocShell()->IsReadOnly();
    4243         [ #  # ]:          0 :                         if ( !bExecHyperlinks )
    4244                 :            :                         {
    4245         [ #  # ]:          0 :                             SvtSecurityOptions aSecOpts;
    4246         [ #  # ]:          0 :                             const sal_Bool bSecureOption = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
    4247 [ #  # ][ #  # ]:          0 :                             if ( (  bSecureOption && rMEvt.GetModifier() == KEY_MOD1 ) ||
           [ #  #  #  # ]
                 [ #  # ]
    4248                 :          0 :                                  ( !bSecureOption && rMEvt.GetModifier() != KEY_MOD1 ) )
    4249         [ #  # ]:          0 :                                 bExecHyperlinks = sal_True;
    4250                 :            :                         }
    4251                 :            : 
    4252                 :          0 :                         const sal_Bool bExecSmarttags = rMEvt.GetModifier() == KEY_MOD1;
    4253                 :            : 
    4254         [ #  # ]:          0 :                         if(pApplyTempl)
    4255                 :          0 :                             bExecHyperlinks = sal_False;
    4256                 :            : 
    4257                 :            :                         SwContentAtPos aCntntAtPos( SwContentAtPos::SW_CLICKFIELD |
    4258                 :            :                                                     SwContentAtPos::SW_INETATTR |
    4259         [ #  # ]:          0 :                                                     SwContentAtPos::SW_SMARTTAG  | SwContentAtPos::SW_FORMCTRL);
    4260                 :            : 
    4261 [ #  # ][ #  # ]:          0 :                         if( rSh.GetContentAtPos( aDocPt, aCntntAtPos, sal_True ) )
    4262                 :            :                         {
    4263                 :          0 :                             sal_Bool bViewLocked = rSh.IsViewLocked();
    4264 [ #  # ][ #  # ]:          0 :                             if( !bViewLocked && !rSh.IsReadOnlyAvailable() &&
         [ #  # ][ #  # ]
    4265         [ #  # ]:          0 :                                 aCntntAtPos.IsInProtectSect() )
    4266                 :          0 :                                 rSh.LockView( sal_True );
    4267                 :            : 
    4268         [ #  # ]:          0 :                             ReleaseMouse();
    4269                 :            : 
    4270         [ #  # ]:          0 :                             if( SwContentAtPos::SW_FIELD == aCntntAtPos.eCntntAtPos )
    4271                 :            :                             {
    4272         [ #  # ]:          0 :                                 rSh.ClickToField( *aCntntAtPos.aFnd.pFld );
    4273                 :            :                             }
    4274         [ #  # ]:          0 :                             else if ( SwContentAtPos::SW_SMARTTAG == aCntntAtPos.eCntntAtPos )
    4275                 :            :                             {
    4276                 :            :                                     // execute smarttag menu
    4277 [ #  # ][ #  # ]:          0 :                                     if ( bExecSmarttags && SwSmartTagMgr::Get().IsSmartTagsEnabled() )
         [ #  # ][ #  # ]
    4278         [ #  # ]:          0 :                                         rView.ExecSmartTagPopup( aDocPt );
    4279                 :            :                             }
    4280         [ #  # ]:          0 :                             else if ( SwContentAtPos::SW_FORMCTRL == aCntntAtPos.eCntntAtPos )
    4281                 :            :                             {
    4282                 :            :                                 OSL_ENSURE( aCntntAtPos.aFnd.pFldmark != NULL, "where is my field ptr???");
    4283         [ #  # ]:          0 :                                 if ( aCntntAtPos.aFnd.pFldmark != NULL)
    4284                 :            :                                 {
    4285                 :          0 :                                     IFieldmark *fieldBM = const_cast< IFieldmark* > ( aCntntAtPos.aFnd.pFldmark );
    4286 [ #  # ][ #  # ]:          0 :                                     if ( fieldBM->GetFieldname( ) == ODF_FORMCHECKBOX )
    4287                 :            :                                     {
    4288         [ #  # ]:          0 :                                         ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark*>(fieldBM);
    4289 [ #  # ][ #  # ]:          0 :                                         pCheckboxFm->SetChecked(!pCheckboxFm->IsChecked());
    4290         [ #  # ]:          0 :                                         pCheckboxFm->Invalidate();
    4291 [ #  # ][ #  # ]:          0 :                                         rSh.InvalidateWindows( rView.GetVisArea() );
    4292 [ #  # ][ #  # ]:          0 :                                     } else if ( fieldBM->GetFieldname() == ODF_FORMDROPDOWN ) {
    4293         [ #  # ]:          0 :                                         rView.ExecFieldPopup( aDocPt, fieldBM );
    4294         [ #  # ]:          0 :                                         fieldBM->Invalidate();
    4295 [ #  # ][ #  # ]:          0 :                                         rSh.InvalidateWindows( rView.GetVisArea() );
    4296                 :            :                                     } else {
    4297                 :            :                                         // unknown type..
    4298                 :            :                                     }
    4299                 :            :                                 }
    4300                 :            :                             }
    4301                 :            :                             else
    4302                 :            :                             {
    4303         [ #  # ]:          0 :                                 if ( bExecHyperlinks )
    4304         [ #  # ]:          0 :                                     rSh.ClickToINetAttr( *(SwFmtINetFmt*)aCntntAtPos.aFnd.pAttr, nFilter );
    4305                 :            :                             }
    4306                 :            : 
    4307                 :          0 :                             rSh.LockView( bViewLocked );
    4308                 :          0 :                             bCallShadowCrsr = sal_False;
    4309                 :            :                         }
    4310                 :            :                         else
    4311                 :            :                         {
    4312 [ #  # ][ #  # ]:          0 :                             aCntntAtPos = SwContentAtPos( SwContentAtPos::SW_FTN );
                 [ #  # ]
    4313 [ #  # ][ #  # ]:          0 :                             if( !rSh.GetContentAtPos( aDocPt, aCntntAtPos, sal_True ) && bExecHyperlinks )
         [ #  # ][ #  # ]
    4314                 :            :                             {
    4315         [ #  # ]:          0 :                                 SdrViewEvent aVEvt;
    4316                 :            : 
    4317         [ #  # ]:          0 :                                 if (pSdrView)
    4318         [ #  # ]:          0 :                                     pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
    4319                 :            : 
    4320 [ #  # ][ #  # ]:          0 :                                 if (pSdrView && aVEvt.eEvent == SDREVENT_EXECUTEURL)
    4321                 :            :                                 {
    4322                 :            :                                     // hit URL field
    4323                 :          0 :                                     const SvxURLField *pField = aVEvt.pURLField;
    4324         [ #  # ]:          0 :                                     if (pField)
    4325                 :            :                                     {
    4326         [ #  # ]:          0 :                                         String sURL(pField->GetURL());
    4327         [ #  # ]:          0 :                                         String sTarget(pField->GetTargetFrame());
    4328 [ #  # ][ #  # ]:          0 :                                         ::LoadURL(rSh, sURL, nFilter, sTarget);
         [ #  # ][ #  # ]
                 [ #  # ]
    4329                 :            :                                     }
    4330                 :          0 :                                     bCallShadowCrsr = sal_False;
    4331                 :            :                                 }
    4332                 :            :                                 else
    4333                 :            :                                 {
    4334                 :            :                                     // hit graphic
    4335         [ #  # ]:          0 :                                     ReleaseMouse();
    4336 [ #  # ][ #  # ]:          0 :                                     if( rSh.ClickToINetGrf( aDocPt, nFilter ))
    4337                 :          0 :                                         bCallShadowCrsr = sal_False;
    4338         [ #  # ]:          0 :                                 }
    4339                 :            :                             }
    4340                 :            :                         }
    4341                 :            : 
    4342   [ #  #  #  #  :          0 :                         if( bCallShadowCrsr &&
                   #  # ]
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    4343                 :          0 :                             rSh.GetViewOptions()->IsShadowCursor() &&
    4344                 :          0 :                             MOUSE_LEFT == (rMEvt.GetModifier() + rMEvt.GetButtons()) &&
    4345         [ #  # ]:          0 :                             !rSh.HasSelection() &&
    4346                 :          0 :                             !GetConnectMetaFile() &&
    4347         [ #  # ]:          0 :                             rSh.VisArea().IsInside( aDocPt ))
    4348                 :            :                         {
    4349                 :          0 :                             SwUndoId nLastUndoId(UNDO_EMPTY);
    4350 [ #  # ][ #  # ]:          0 :                             if (rSh.GetLastUndoInfo(0, & nLastUndoId))
    4351                 :            :                             {
    4352         [ #  # ]:          0 :                                 if (UNDO_INS_FROM_SHADOWCRSR == nLastUndoId)
    4353                 :            :                                 {
    4354         [ #  # ]:          0 :                                     rSh.Undo();
    4355                 :            :                                 }
    4356                 :            :                             }
    4357                 :          0 :                             SwFillMode eMode = (SwFillMode)rSh.GetViewOptions()->GetShdwCrsrFillMode();
    4358         [ #  # ]:          0 :                             rSh.SetShadowCrsrPos( aDocPt, eMode );
    4359         [ #  # ]:          0 :                         }
    4360                 :            :                     }
    4361                 :            :                 }
    4362                 :          0 :                 bCallBase = sal_False;
    4363                 :            : 
    4364                 :            :             }
    4365                 :            : 
    4366                 :            :             // reset pushed mode in Down again if applicable
    4367 [ #  # ][ #  # ]:          0 :             if ( bPopMode && bModePushed )
    4368                 :            :             {
    4369         [ #  # ]:          0 :                 rSh.PopMode();
    4370                 :          0 :                 bModePushed = sal_False;
    4371                 :          0 :                 bCallBase = sal_False;
    4372                 :            :             }
    4373                 :          0 :             break;
    4374                 :            : 
    4375                 :            :         default:
    4376         [ #  # ]:          0 :             ReleaseMouse();
    4377                 :            :             return;
    4378                 :            :     }
    4379                 :            : 
    4380         [ #  # ]:          0 :     if( pApplyTempl )
    4381                 :            :     {
    4382         [ #  # ]:          0 :         int eSelection = rSh.GetSelectionType();
    4383                 :          0 :         SwFormatClipboard* pFormatClipboard = pApplyTempl->pFormatClipboard;
    4384         [ #  # ]:          0 :         if( pFormatClipboard )//apply format paintbrush
    4385                 :            :         {
    4386                 :            :             //get some parameters
    4387                 :          0 :             SwWrtShell& rWrtShell = rView.GetWrtShell();
    4388                 :          0 :             SfxStyleSheetBasePool* pPool=0;
    4389                 :          0 :             bool bNoCharacterFormats = false;
    4390                 :          0 :             bool bNoParagraphFormats = true;
    4391                 :            :             {
    4392         [ #  # ]:          0 :                 SwDocShell* pDocSh = rView.GetDocShell();
    4393         [ #  # ]:          0 :                 if(pDocSh)
    4394         [ #  # ]:          0 :                     pPool = pDocSh->GetStyleSheetPool();
    4395 [ #  # ][ #  # ]:          0 :                 if( (rMEvt.GetModifier()&KEY_MOD1) && (rMEvt.GetModifier()&KEY_SHIFT) )
                 [ #  # ]
    4396                 :            :                 {
    4397                 :          0 :                     bNoCharacterFormats = true;
    4398                 :          0 :                     bNoParagraphFormats = false;
    4399                 :            :                 }
    4400         [ #  # ]:          0 :                 else if( rMEvt.GetModifier() & KEY_MOD1 )
    4401                 :          0 :                     bNoParagraphFormats = false;
    4402                 :            :             }
    4403                 :            :             //execute paste
    4404         [ #  # ]:          0 :             pFormatClipboard->Paste( rWrtShell, pPool, bNoCharacterFormats, bNoParagraphFormats );
    4405                 :            : 
    4406                 :            :             //if the clipboard is empty after paste remove the ApplyTemplate
    4407 [ #  # ][ #  # ]:          0 :             if(!pFormatClipboard->HasContent())
    4408         [ #  # ]:          0 :                 SetApplyTemplate(SwApplyTemplate());
    4409                 :            :         }
    4410         [ #  # ]:          0 :         else if( pApplyTempl->nColor )
    4411                 :            :         {
    4412                 :          0 :             sal_uInt16 nId = 0;
    4413      [ #  #  # ]:          0 :             switch( pApplyTempl->nColor )
    4414                 :            :             {
    4415                 :            :                 case SID_ATTR_CHAR_COLOR_EXT:
    4416                 :            :                 case SID_ATTR_CHAR_COLOR2:
    4417                 :          0 :                     nId = RES_CHRATR_COLOR;
    4418                 :          0 :                     break;
    4419                 :            :                 case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
    4420                 :            :                 case SID_ATTR_CHAR_COLOR_BACKGROUND:
    4421                 :          0 :                     nId = RES_CHRATR_BACKGROUND;
    4422                 :          0 :                     break;
    4423                 :            :             }
    4424 [ #  # ][ #  # ]:          0 :             if( nId && (nsSelectionType::SEL_TXT|nsSelectionType::SEL_TBL) & eSelection)
    4425                 :            :             {
    4426 [ #  # ][ #  # ]:          0 :                 if( rSh.IsSelection() && !rSh.HasReadonlySel() )
         [ #  # ][ #  # ]
    4427                 :            :                 {
    4428         [ #  # ]:          0 :                     if(nId == RES_CHRATR_BACKGROUND)
    4429                 :            :                     {
    4430                 :          0 :                         Color aColor( COL_TRANSPARENT  );
    4431         [ #  # ]:          0 :                         if( !SwEditWin::bTransparentBackColor )
    4432                 :          0 :                             aColor = SwEditWin::aTextBackColor;
    4433 [ #  # ][ #  # ]:          0 :                         rSh.SetAttr( SvxBrushItem( aColor, nId ) );
                 [ #  # ]
    4434                 :            :                     }
    4435                 :            :                     else
    4436 [ #  # ][ #  # ]:          0 :                         rSh.SetAttr( SvxColorItem(SwEditWin::aTextColor, nId) );
                 [ #  # ]
    4437         [ #  # ]:          0 :                     rSh.UnSetVisCrsr();
    4438         [ #  # ]:          0 :                     rSh.EnterStdMode();
    4439         [ #  # ]:          0 :                     rSh.SetVisCrsr(aDocPt);
    4440                 :            : 
    4441                 :          0 :                     pApplyTempl->bUndo = sal_True;
    4442                 :          0 :                     bCallBase = sal_False;
    4443         [ #  # ]:          0 :                     aTemplateTimer.Stop();
    4444                 :            :                 }
    4445         [ #  # ]:          0 :                 else if(rMEvt.GetClicks() == 1)
    4446                 :            :                 {
    4447                 :            :                     // no selection -> so turn off watering can
    4448         [ #  # ]:          0 :                     aTemplateTimer.Start();
    4449                 :            :                 }
    4450                 :            :             }
    4451                 :            :         }
    4452                 :            :         else
    4453                 :            :         {
    4454         [ #  # ]:          0 :             String aStyleName;
    4455   [ #  #  #  #  :          0 :             switch ( pApplyTempl->eType )
                   #  # ]
    4456                 :            :             {
    4457                 :            :                 case SFX_STYLE_FAMILY_PARA:
    4458 [ #  # ][ #  # ]:          0 :                     if( (( nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL )
                 [ #  # ]
    4459         [ #  # ]:          0 :                          & eSelection ) && !rSh.HasReadonlySel() )
    4460                 :            :                     {
    4461         [ #  # ]:          0 :                         rSh.SetTxtFmtColl( pApplyTempl->aColl.pTxtColl );
    4462                 :          0 :                         pApplyTempl->bUndo = sal_True;
    4463                 :          0 :                         bCallBase = sal_False;
    4464         [ #  # ]:          0 :                         if ( pApplyTempl->aColl.pTxtColl )
    4465         [ #  # ]:          0 :                             aStyleName = pApplyTempl->aColl.pTxtColl->GetName();
    4466                 :            :                     }
    4467                 :          0 :                     break;
    4468                 :            :                 case SFX_STYLE_FAMILY_CHAR:
    4469 [ #  # ][ #  # ]:          0 :                     if( (( nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL )
                 [ #  # ]
    4470         [ #  # ]:          0 :                          & eSelection ) && !rSh.HasReadonlySel() )
    4471                 :            :                     {
    4472 [ #  # ][ #  # ]:          0 :                         rSh.SetAttr( SwFmtCharFmt(pApplyTempl->aColl.pCharFmt) );
                 [ #  # ]
    4473         [ #  # ]:          0 :                         rSh.UnSetVisCrsr();
    4474         [ #  # ]:          0 :                         rSh.EnterStdMode();
    4475         [ #  # ]:          0 :                         rSh.SetVisCrsr(aDocPt);
    4476                 :          0 :                         pApplyTempl->bUndo = sal_True;
    4477                 :          0 :                         bCallBase = sal_False;
    4478         [ #  # ]:          0 :                         if ( pApplyTempl->aColl.pCharFmt )
    4479         [ #  # ]:          0 :                             aStyleName = pApplyTempl->aColl.pCharFmt->GetName();
    4480                 :            :                     }
    4481                 :          0 :                     break;
    4482                 :            :                 case SFX_STYLE_FAMILY_FRAME :
    4483                 :            :                 {
    4484         [ #  # ]:          0 :                     const SwFrmFmt* pFmt = rSh.GetFmtFromObj( aDocPt );
    4485 [ #  # ][ #  # ]:          0 :                     if(PTR_CAST(SwFlyFrmFmt, pFmt))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    4486                 :            :                     {
    4487         [ #  # ]:          0 :                         rSh.SetFrmFmt( pApplyTempl->aColl.pFrmFmt, sal_False, &aDocPt );
    4488                 :          0 :                         pApplyTempl->bUndo = sal_True;
    4489                 :          0 :                         bCallBase = sal_False;
    4490         [ #  # ]:          0 :                         if( pApplyTempl->aColl.pFrmFmt )
    4491         [ #  # ]:          0 :                             aStyleName = pApplyTempl->aColl.pFrmFmt->GetName();
    4492                 :            :                     }
    4493                 :          0 :                     break;
    4494                 :            :                 }
    4495                 :            :                 case SFX_STYLE_FAMILY_PAGE:
    4496                 :            :                             // no Undo with page templates
    4497         [ #  # ]:          0 :                     rSh.ChgCurPageDesc( *pApplyTempl->aColl.pPageDesc );
    4498         [ #  # ]:          0 :                     if ( pApplyTempl->aColl.pPageDesc )
    4499         [ #  # ]:          0 :                         aStyleName = pApplyTempl->aColl.pPageDesc->GetName();
    4500                 :          0 :                     bCallBase = sal_False;
    4501                 :          0 :                     break;
    4502                 :            :                 case SFX_STYLE_FAMILY_PSEUDO:
    4503 [ #  # ][ #  # ]:          0 :                     if( !rSh.HasReadonlySel() )
    4504                 :            :                     {
    4505                 :            :                         rSh.SetCurNumRule( *pApplyTempl->aColl.pNumRule,
    4506                 :            :                                            false,
    4507 [ #  # ][ #  # ]:          0 :                                            pApplyTempl->aColl.pNumRule->GetDefaultListId() );
                 [ #  # ]
    4508                 :          0 :                         bCallBase = sal_False;
    4509                 :          0 :                         pApplyTempl->bUndo = sal_True;
    4510         [ #  # ]:          0 :                         if( pApplyTempl->aColl.pNumRule )
    4511         [ #  # ]:          0 :                             aStyleName = pApplyTempl->aColl.pNumRule->GetName();
    4512                 :            :                     }
    4513                 :          0 :                     break;
    4514                 :            :             }
    4515                 :            : 
    4516                 :            :             uno::Reference< frame::XDispatchRecorder > xRecorder =
    4517         [ #  # ]:          0 :                     rView.GetViewFrame()->GetBindings().GetRecorder();
    4518 [ #  # ][ #  # ]:          0 :             if ( aStyleName.Len() && xRecorder.is() )
                 [ #  # ]
    4519                 :            :             {
    4520 [ #  # ][ #  # ]:          0 :                 SfxShell *pSfxShell = lcl_GetShellFromDispatcher( rView, TYPE(SwTextShell) );
    4521         [ #  # ]:          0 :                 if ( pSfxShell )
    4522                 :            :                 {
    4523         [ #  # ]:          0 :                     SfxRequest aReq( rView.GetViewFrame(), SID_STYLE_APPLY );
    4524 [ #  # ][ #  # ]:          0 :                     aReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aStyleName ) );
                 [ #  # ]
    4525 [ #  # ][ #  # ]:          0 :                     aReq.AppendItem( SfxUInt16Item( SID_STYLE_FAMILY, (sal_uInt16) pApplyTempl->eType ) );
                 [ #  # ]
    4526 [ #  # ][ #  # ]:          0 :                     aReq.Done();
    4527                 :            :                 }
    4528         [ #  # ]:          0 :             }
    4529                 :            :         }
    4530                 :            : 
    4531                 :            :     }
    4532         [ #  # ]:          0 :     ReleaseMouse();
    4533                 :            :     // Only processed MouseEvents arrive here; only at these the moduses can
    4534                 :            :     // be resetted.
    4535                 :          0 :     bMBPressed = sal_False;
    4536                 :            : 
    4537                 :            :     //sicherheitshalber aufrufen, da jetzt das Selektieren bestimmt zu Ende ist.
    4538                 :            :     //Andernfalls koennte der Timeout des Timers Kummer machen.
    4539         [ #  # ]:          0 :     EnterArea();
    4540                 :          0 :     bNoInterrupt = sal_False;
    4541                 :            : 
    4542         [ #  # ]:          0 :     if (bCallBase)
    4543 [ #  # ][ #  # ]:          0 :         Window::MouseButtonUp(rMEvt);
                 [ #  # ]
    4544                 :            : }
    4545                 :            : 
    4546                 :            : /*--------------------------------------------------------------------
    4547                 :            :     Description:   apply template
    4548                 :            :  --------------------------------------------------------------------*/
    4549                 :            : 
    4550                 :          0 : void SwEditWin::SetApplyTemplate(const SwApplyTemplate &rTempl)
    4551                 :            : {
    4552                 :            :     static sal_Bool bIdle = sal_False;
    4553                 :          0 :     DELETEZ(pApplyTempl);
    4554                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
    4555                 :            : 
    4556         [ #  # ]:          0 :     if(rTempl.pFormatClipboard)
    4557                 :            :     {
    4558                 :          0 :         pApplyTempl = new SwApplyTemplate( rTempl );
    4559         [ #  # ]:          0 :               SetPointer( POINTER_FILL );//@todo #i20119# maybe better a new brush pointer here in future
    4560                 :          0 :               rSh.NoEdit( sal_False );
    4561                 :          0 :               bIdle = rSh.GetViewOptions()->IsIdle();
    4562                 :          0 :               ((SwViewOption *)rSh.GetViewOptions())->SetIdle( sal_False );
    4563                 :            :     }
    4564         [ #  # ]:          0 :     else if(rTempl.nColor)
    4565                 :            :     {
    4566                 :          0 :         pApplyTempl = new SwApplyTemplate( rTempl );
    4567         [ #  # ]:          0 :         SetPointer( POINTER_FILL );
    4568                 :          0 :         rSh.NoEdit( sal_False );
    4569                 :          0 :         bIdle = rSh.GetViewOptions()->IsIdle();
    4570                 :          0 :         ((SwViewOption *)rSh.GetViewOptions())->SetIdle( sal_False );
    4571                 :            :     }
    4572         [ #  # ]:          0 :     else if( rTempl.eType )
    4573                 :            :     {
    4574                 :          0 :         pApplyTempl = new SwApplyTemplate( rTempl );
    4575         [ #  # ]:          0 :         SetPointer( POINTER_FILL  );
    4576                 :          0 :         rSh.NoEdit( sal_False );
    4577                 :          0 :         bIdle = rSh.GetViewOptions()->IsIdle();
    4578                 :          0 :         ((SwViewOption *)rSh.GetViewOptions())->SetIdle( sal_False );
    4579                 :            :     }
    4580                 :            :     else
    4581                 :            :     {
    4582         [ #  # ]:          0 :         SetPointer( POINTER_TEXT );
    4583                 :          0 :         rSh.UnSetVisCrsr();
    4584                 :            : 
    4585                 :          0 :         ((SwViewOption *)rSh.GetViewOptions())->SetIdle( bIdle );
    4586         [ #  # ]:          0 :         if ( !rSh.IsSelFrmMode() )
    4587                 :          0 :             rSh.Edit();
    4588                 :            :     }
    4589                 :            : 
    4590                 :            :     static sal_uInt16 aInva[] =
    4591                 :            :     {
    4592                 :            :         SID_STYLE_WATERCAN,
    4593                 :            :         SID_ATTR_CHAR_COLOR_EXT,
    4594                 :            :         SID_ATTR_CHAR_COLOR_BACKGROUND_EXT,
    4595                 :            :         0
    4596                 :            :     };
    4597                 :          0 :     rView.GetViewFrame()->GetBindings().Invalidate(aInva);
    4598                 :          0 : }
    4599                 :            : 
    4600                 :            : /*--------------------------------------------------------------------
    4601                 :            :     Description:   ctor
    4602                 :            :  --------------------------------------------------------------------*/
    4603                 :            : 
    4604                 :       1318 : SwEditWin::SwEditWin(Window *pParent, SwView &rMyView):
    4605                 :            :     Window(pParent, WinBits(WB_CLIPCHILDREN | WB_DIALOGCONTROL)),
    4606                 :            :     DropTargetHelper( this ),
    4607                 :            :     DragSourceHelper( this ),
    4608                 :            : 
    4609                 :            :     eBufferLanguage(LANGUAGE_DONTKNOW),
    4610                 :            :     pApplyTempl(0),
    4611                 :            :     pAnchorMarker( 0 ),
    4612                 :            :     pUserMarker( 0 ),
    4613                 :            :     pUserMarkerObj( 0 ),
    4614                 :            :     pShadCrsr( 0 ),
    4615                 :            :     pRowColumnSelectionStart( 0 ),
    4616                 :            : 
    4617                 :            :     rView( rMyView ),
    4618                 :            : 
    4619                 :            :     aActHitType(SDRHIT_NONE),
    4620                 :            :     m_nDropFormat( 0 ),
    4621                 :            :     m_nDropAction( 0 ),
    4622                 :            :     m_nDropDestination( 0 ),
    4623                 :            : 
    4624                 :            :     nInsFrmColCount( 1 ),
    4625                 :            :     eDrawMode(OBJ_NONE),
    4626                 :            : 
    4627                 :            :     bLockInput(sal_False),
    4628                 :            :     bObjectSelect( sal_False ),
    4629                 :            :     nKS_NUMDOWN_Count(0),
    4630                 :            :     nKS_NUMINDENTINC_Count(0),
    4631                 :            :     m_aFrameControlsManager( this ),
    4632                 :            :     m_sTmpHFPageStyle( ),
    4633 [ +  - ][ +  - ]:       1318 :     m_bTmpHFIsHeader( false )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    4634                 :            : {
    4635         [ +  - ]:       1318 :     SetHelpId(HID_EDIT_WIN);
    4636         [ +  - ]:       1318 :     EnableChildTransparentMode();
    4637         [ +  - ]:       1318 :     SetDialogControlFlags( WINDOW_DLGCTRL_RETURN | WINDOW_DLGCTRL_WANTFOCUS );
    4638                 :            : 
    4639                 :            :     bLinkRemoved = bMBPressed = bInsDraw = bInsFrm =
    4640                 :       1318 :     bIsInDrag = bOldIdle = bOldIdleSet = bChainMode = bWasShdwCrsr = sal_False;
    4641                 :            :     // initially use the input language
    4642                 :       1318 :     bUseInputLanguage = sal_True;
    4643                 :            : 
    4644 [ +  - ][ +  - ]:       1318 :     SetMapMode(MapMode(MAP_TWIP));
                 [ +  - ]
    4645                 :            : 
    4646         [ +  - ]:       1318 :     SetPointer( POINTER_TEXT );
    4647         [ +  - ]:       1318 :     aTimer.SetTimeoutHdl(LINK(this, SwEditWin, TimerHandler));
    4648                 :            : 
    4649                 :       1318 :     bTblInsDelMode = sal_False;
    4650         [ +  - ]:       1318 :     aKeyInputTimer.SetTimeout( 3000 );
    4651         [ +  - ]:       1318 :     aKeyInputTimer.SetTimeoutHdl(LINK(this, SwEditWin, KeyInputTimerHandler));
    4652                 :            : 
    4653         [ +  - ]:       1318 :     aKeyInputFlushTimer.SetTimeout( 200 );
    4654         [ +  - ]:       1318 :     aKeyInputFlushTimer.SetTimeoutHdl(LINK(this, SwEditWin, KeyInputFlushHandler));
    4655                 :            : 
    4656                 :            :     // TemplatePointer for colors should be resetted without
    4657                 :            :     // selection after single click
    4658         [ +  - ]:       1318 :     aTemplateTimer.SetTimeout(400);
    4659         [ +  - ]:       1318 :     aTemplateTimer.SetTimeoutHdl(LINK(this, SwEditWin, TemplateTimerHdl));
    4660                 :            : 
    4661                 :            :     // temporary solution!!! Should set the font of the current
    4662                 :            :     //          insert position at every curor movement!
    4663 [ +  - ][ +  + ]:       1318 :     if( !rMyView.GetDocShell()->IsReadOnly() )
                 [ +  - ]
    4664                 :            :     {
    4665         [ +  - ]:       1316 :         Font aFont;
    4666                 :            :         SetInputContext( InputContext( aFont, INPUTCONTEXT_TEXT |
    4667 [ +  - ][ +  - ]:       1316 :                                             INPUTCONTEXT_EXTTEXTINPUT ) );
         [ +  - ][ +  - ]
    4668                 :            :     }
    4669                 :       1318 : }
    4670                 :            : 
    4671 [ +  - ][ +  - ]:       1231 : SwEditWin::~SwEditWin()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    4672                 :            : {
    4673         [ +  - ]:       1231 :     aKeyInputTimer.Stop();
    4674 [ -  + ][ #  # ]:       1231 :     delete pShadCrsr;
    4675                 :       1231 :     delete pRowColumnSelectionStart;
    4676 [ #  # ][ -  + ]:       1231 :     if( pQuickHlpData->m_bIsDisplayed && rView.GetWrtShellPtr() )
                 [ -  + ]
    4677         [ #  # ]:          0 :         pQuickHlpData->Stop( rView.GetWrtShell() );
    4678                 :       1231 :     bExecuteDrag = sal_False;
    4679                 :       1231 :     delete pApplyTempl;
    4680         [ +  - ]:       1231 :     rView.SetDrawFuncPtr(NULL);
    4681                 :            : 
    4682 [ -  + ][ #  # ]:       1231 :     delete pUserMarker;
    4683                 :       1231 :     delete pAnchorMarker;
    4684         [ -  + ]:       2462 : }
    4685                 :            : 
    4686                 :            : /******************************************************************************
    4687                 :            :  *  Description: turn on DrawTextEditMode
    4688                 :            :  ******************************************************************************/
    4689                 :            : 
    4690                 :          0 : void SwEditWin::EnterDrawTextMode( const Point& aDocPos )
    4691                 :            : {
    4692         [ #  # ]:          0 :     if ( rView.EnterDrawTextMode(aDocPos) == sal_True )
    4693                 :            :     {
    4694         [ #  # ]:          0 :         if (rView.GetDrawFuncPtr())
    4695                 :            :         {
    4696                 :          0 :             rView.GetDrawFuncPtr()->Deactivate();
    4697                 :          0 :             rView.SetDrawFuncPtr(NULL);
    4698                 :          0 :             rView.LeaveDrawCreate();
    4699                 :            :         }
    4700                 :          0 :         rView.NoRotate();
    4701                 :          0 :         rView.AttrChangedNotify( &rView.GetWrtShell() );
    4702                 :            :     }
    4703                 :          0 : }
    4704                 :            : 
    4705                 :            : /******************************************************************************
    4706                 :            :  *  Description: turn on DrawMode
    4707                 :            :  ******************************************************************************/
    4708                 :            : 
    4709                 :          0 : sal_Bool SwEditWin::EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos)
    4710                 :            : {
    4711                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
    4712                 :          0 :     SdrView *pSdrView = rSh.GetDrawView();
    4713                 :            : 
    4714         [ #  # ]:          0 :     if ( rView.GetDrawFuncPtr() )
    4715                 :            :     {
    4716         [ #  # ]:          0 :         if (rSh.IsDrawCreate())
    4717                 :          0 :             return sal_True;
    4718                 :            : 
    4719                 :          0 :         sal_Bool bRet = rView.GetDrawFuncPtr()->MouseButtonDown( rMEvt );
    4720                 :          0 :         rView.AttrChangedNotify( &rSh );
    4721                 :          0 :         return bRet;
    4722                 :            :     }
    4723                 :            : 
    4724 [ #  # ][ #  # ]:          0 :     if ( pSdrView && pSdrView->IsTextEdit() )
                 [ #  # ]
    4725                 :            :     {
    4726                 :          0 :         sal_Bool bUnLockView = !rSh.IsViewLocked();
    4727                 :          0 :         rSh.LockView( sal_True );
    4728                 :            : 
    4729                 :          0 :         rSh.EndTextEdit(); // clicked aside, end Edit
    4730                 :          0 :         rSh.SelectObj( aDocPos );
    4731 [ #  # ][ #  # ]:          0 :         if ( !rSh.IsObjSelected() && !rSh.IsFrmSelected() )
                 [ #  # ]
    4732                 :          0 :             rSh.LeaveSelFrmMode();
    4733                 :            :         else
    4734                 :            :         {
    4735                 :          0 :             SwEditWin::nDDStartPosY = aDocPos.Y();
    4736                 :          0 :             SwEditWin::nDDStartPosX = aDocPos.X();
    4737                 :          0 :             bFrmDrag = sal_True;
    4738                 :            :         }
    4739         [ #  # ]:          0 :         if( bUnLockView )
    4740                 :          0 :             rSh.LockView( sal_False );
    4741                 :          0 :         rView.AttrChangedNotify( &rSh );
    4742                 :          0 :         return sal_True;
    4743                 :            :     }
    4744                 :          0 :     return sal_False;
    4745                 :            : }
    4746                 :            : 
    4747                 :          0 : sal_Bool SwEditWin::IsDrawSelMode()
    4748                 :            : {
    4749                 :          0 :     return IsObjectSelect();
    4750                 :            : }
    4751                 :            : 
    4752                 :       1139 : void SwEditWin::GetFocus()
    4753                 :            : {
    4754         [ -  + ]:       1139 :     if ( rView.GetPostItMgr()->HasActiveSidebarWin() )
    4755                 :            :     {
    4756                 :          0 :         rView.GetPostItMgr()->GrabFocusOnActiveSidebarWin();
    4757                 :            :     }
    4758                 :            :     else
    4759                 :            :     {
    4760                 :       1139 :         rView.GotFocus();
    4761                 :       1139 :         Window::GetFocus();
    4762                 :       1139 :         rView.GetWrtShell().InvalidateAccessibleFocus();
    4763                 :            :     }
    4764                 :       1139 : }
    4765                 :            : 
    4766                 :       1137 : void SwEditWin::LoseFocus()
    4767                 :            : {
    4768                 :       1137 :     rView.GetWrtShell().InvalidateAccessibleFocus();
    4769                 :       1137 :     Window::LoseFocus();
    4770         [ -  + ]:       1137 :     if( pQuickHlpData->m_bIsDisplayed )
    4771                 :          0 :         pQuickHlpData->Stop( rView.GetWrtShell() );
    4772                 :       1137 :     rView.LostFocus();
    4773                 :       1137 : }
    4774                 :            : 
    4775                 :          0 : void SwEditWin::Command( const CommandEvent& rCEvt )
    4776                 :            : {
    4777                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
    4778                 :            : 
    4779         [ #  # ]:          0 :     if ( !rView.GetViewFrame() )
    4780                 :            :     {
    4781                 :            :         // If ViewFrame dies shortly, no popup anymore!
    4782                 :          0 :         Window::Command(rCEvt);
    4783                 :          0 :         return;
    4784                 :            :     }
    4785                 :            : 
    4786                 :            :     // The command event is send to the window after a possible context
    4787                 :            :     // menu from an inplace client has been closed. Now we have the chance
    4788                 :            :     // to deactivate the inplace client without any problem regarding parent
    4789                 :            :     // windows and code on the stack.
    4790                 :          0 :     SfxInPlaceClient* pIPClient = rSh.GetSfxViewShell()->GetIPClient();
    4791 [ #  # ][ #  # ]:          0 :     sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
    4792 [ #  # ][ #  # ]:          0 :     if ( bIsOleActive && ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ))
                 [ #  # ]
    4793                 :            :     {
    4794                 :          0 :         rSh.FinishOLEObj();
    4795                 :          0 :         return;
    4796                 :            :     }
    4797                 :            : 
    4798                 :          0 :     sal_Bool bCallBase      = sal_True;
    4799                 :            : 
    4800   [ #  #  #  #  :          0 :     switch ( rCEvt.GetCommand() )
          #  #  #  #  #  
             #  #  #  #  
                      # ]
    4801                 :            :     {
    4802                 :            :         case COMMAND_CONTEXTMENU:
    4803                 :            :         {
    4804         [ #  # ]:          0 :             const sal_uInt16 nId = SwInputChild::GetChildWindowId();
    4805                 :          0 :             SwInputChild* pChildWin = (SwInputChild*)GetView().GetViewFrame()->
    4806         [ #  # ]:          0 :                                                 GetChildWindow( nId );
    4807                 :            : 
    4808 [ #  # ][ #  # ]:          0 :             if (rView.GetPostItMgr()->IsHit(rCEvt.GetMousePosPixel()))
    4809                 :            :                 return;
    4810                 :            : 
    4811         [ #  # ]:          0 :             Point aDocPos( PixelToLogic( rCEvt.GetMousePosPixel() ) );
    4812         [ #  # ]:          0 :             if ( !rCEvt.IsMouseEvent() )
    4813         [ #  # ]:          0 :                 aDocPos = rSh.GetCharRect().Center();
    4814                 :            : 
    4815                 :            :             // Triggering a command remove temporary header/footer status
    4816                 :            :             FrameControlType eControl;
    4817         [ #  # ]:          0 :             bool bIsInHF = IsInHeaderFooter( aDocPos, eControl );
    4818         [ #  # ]:          0 :             if ( !m_sTmpHFPageStyle.isEmpty( ) )
    4819                 :            :             {
    4820 [ #  # ][ #  # ]:          0 :                 const rtl::OUString sStyleName = rSh.GetCurPageStyle( false );
                 [ #  # ]
    4821                 :          0 :                 bool bMatchesTmpHF = sStyleName == m_sTmpHFPageStyle &&
    4822                 :            :                                 ( ( m_bTmpHFIsHeader && eControl == Header ) ||
    4823 [ #  # ][ #  # ]:          0 :                                   ( !m_bTmpHFIsHeader && eControl == Footer ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    4824                 :            : 
    4825                 :            :                 // Are we clicking outside the temporary header/footer? if so remove it
    4826 [ #  # ][ #  # ]:          0 :                 if ( ( !bIsInHF && rSh.IsHeaderFooterEdit( ) ) || !bMatchesTmpHF )
         [ #  # ][ #  # ]
    4827 [ #  # ][ #  # ]:          0 :                     rSh.ChangeHeaderOrFooter( m_sTmpHFPageStyle, m_bTmpHFIsHeader, false, false );
                 [ #  # ]
    4828                 :            : 
    4829                 :          0 :                 m_sTmpHFPageStyle = rtl::OUString( );
    4830                 :            :             }
    4831                 :            : 
    4832 [ #  # ][ #  # ]:          0 :             if (rCEvt.IsMouseEvent() && lcl_CheckHeaderFooterClick( rSh, aDocPos, 1 ) )
         [ #  # ][ #  # ]
    4833                 :            :                 return;
    4834                 :            : 
    4835                 :            : 
    4836 [ #  # ][ #  # ]:          0 :             if((!pChildWin || pChildWin->GetView() != &rView) &&
           [ #  #  #  # ]
                 [ #  # ]
    4837         [ #  # ]:          0 :                 !rSh.IsDrawCreate() && !IsDrawAction())
    4838                 :            :             {
    4839         [ #  # ]:          0 :                 SET_CURR_SHELL( &rSh );
    4840         [ #  # ]:          0 :                 if (!pApplyTempl)
    4841                 :            :                 {
    4842         [ #  # ]:          0 :                     if (bNoInterrupt == sal_True)
    4843                 :            :                     {
    4844         [ #  # ]:          0 :                         ReleaseMouse();
    4845                 :          0 :                         bNoInterrupt = sal_False;
    4846                 :          0 :                         bMBPressed = sal_False;
    4847                 :            :                     }
    4848         [ #  # ]:          0 :                     if ( rCEvt.IsMouseEvent() )
    4849                 :            :                     {
    4850         [ #  # ]:          0 :                         SelectMenuPosition(rSh, rCEvt.GetMousePosPixel());
    4851         [ #  # ]:          0 :                         rView.StopShellTimer();
    4852                 :            :                     }
    4853         [ #  # ]:          0 :                     const Point aPixPos = LogicToPixel( aDocPos );
    4854                 :            : 
    4855 [ #  # ][ #  # ]:          0 :                     if ( rView.GetDocShell()->IsReadOnly() )
                 [ #  # ]
    4856                 :            :                     {
    4857 [ #  # ][ #  # ]:          0 :                         SwReadOnlyPopup* pROPopup = new SwReadOnlyPopup( aDocPos, rView );
    4858                 :            : 
    4859         [ #  # ]:          0 :                         ui::ContextMenuExecuteEvent aEvent;
    4860 [ #  # ][ #  # ]:          0 :                         aEvent.SourceWindow = VCLUnoHelper::GetInterface( this );
    4861                 :          0 :                         aEvent.ExecutePosition.X = aPixPos.X();
    4862                 :          0 :                         aEvent.ExecutePosition.Y = aPixPos.Y();
    4863                 :          0 :                         Menu* pMenu = 0;
    4864         [ #  # ]:          0 :                         ::rtl::OUString sMenuName(RTL_CONSTASCII_USTRINGPARAM("private:resource/ReadonlyContextMenu"));
    4865 [ #  # ][ #  # ]:          0 :                         if( GetView().TryContextMenuInterception( *pROPopup, sMenuName, pMenu, aEvent ) )
         [ #  # ][ #  # ]
    4866                 :            :                         {
    4867         [ #  # ]:          0 :                             if ( pMenu )
    4868                 :            :                             {
    4869         [ #  # ]:          0 :                                 sal_uInt16 nExecId = ((PopupMenu*)pMenu)->Execute(this, aPixPos);
    4870 [ #  # ][ #  # ]:          0 :                                 if( !::ExecuteMenuCommand( *static_cast<PopupMenu*>(pMenu), *rView.GetViewFrame(), nExecId ))
    4871         [ #  # ]:          0 :                                     pROPopup->Execute(this, nExecId);
    4872                 :            :                             }
    4873                 :            :                             else
    4874         [ #  # ]:          0 :                                 pROPopup->Execute(this, aPixPos);
    4875                 :            :                         }
    4876 [ #  # ][ #  # ]:          0 :                         delete pROPopup;
                 [ #  # ]
    4877                 :            :                     }
    4878 [ #  # ][ #  # ]:          0 :                     else if ( !rView.ExecSpellPopup( aDocPos ) )
    4879         [ #  # ]:          0 :                         GetView().GetViewFrame()->GetDispatcher()->ExecutePopup( 0, this, &aPixPos);
    4880                 :            :                 }
    4881         [ #  # ]:          0 :                 else if (pApplyTempl->bUndo)
    4882         [ #  # ]:          0 :                     rSh.Do(SwWrtShell::UNDO);
    4883         [ #  # ]:          0 :                 bCallBase = sal_False;
    4884                 :            :             }
    4885                 :            :         }
    4886                 :          0 :         break;
    4887                 :            : 
    4888                 :            :         case COMMAND_WHEEL:
    4889                 :            :         case COMMAND_STARTAUTOSCROLL:
    4890                 :            :         case COMMAND_AUTOSCROLL:
    4891         [ #  # ]:          0 :             if( pShadCrsr )
    4892         [ #  # ]:          0 :                 delete pShadCrsr, pShadCrsr = 0;
    4893                 :          0 :             bCallBase = !rView.HandleWheelCommands( rCEvt );
    4894                 :          0 :             break;
    4895                 :            : 
    4896                 :            :         case COMMAND_VOICE:
    4897                 :            :             {
    4898                 :            :                 // forward to Outliner if applicable
    4899 [ #  # ][ #  # ]:          0 :                 if ( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
                 [ #  # ]
    4900                 :            :                 {
    4901                 :          0 :                     bCallBase = sal_False;
    4902                 :          0 :                     rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
    4903                 :          0 :                     break;
    4904                 :            :                 }
    4905                 :            : 
    4906                 :          0 :                 const CommandVoiceData *pCData = rCEvt.GetVoiceData();
    4907         [ #  # ]:          0 :                 if ( VOICECOMMANDTYPE_CONTROL == pCData->GetType() )
    4908                 :          0 :                     break;
    4909                 :            : 
    4910                 :          0 :                 sal_uInt16 nSlotId = 0;
    4911                 :          0 :                 SfxPoolItem *pItem = 0;
    4912                 :            : 
    4913   [ #  #  #  #  :          0 :                 switch ( pCData->GetCommand() )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                      # ]
    4914                 :            :                 {
    4915                 :          0 :                     case DICTATIONCOMMAND_NEWPARAGRAPH: nSlotId = FN_INSERT_BREAK; break;
    4916                 :          0 :                     case DICTATIONCOMMAND_NEWLINE:      nSlotId = FN_INSERT_LINEBREAK; break;
    4917                 :          0 :                     case DICTATIONCOMMAND_LEFT:         nSlotId = FN_PREV_WORD; break;
    4918                 :          0 :                     case DICTATIONCOMMAND_RIGHT:        nSlotId = FN_NEXT_WORD; break;
    4919                 :          0 :                     case DICTATIONCOMMAND_UP:           nSlotId = FN_LINE_UP; break;
    4920                 :          0 :                     case DICTATIONCOMMAND_DOWN:         nSlotId = FN_LINE_DOWN; break;
    4921                 :          0 :                     case DICTATIONCOMMAND_UNDO:         nSlotId = SID_UNDO; break;
    4922                 :          0 :                     case DICTATIONCOMMAND_REPEAT:       nSlotId = SID_REPEAT; break;
    4923                 :          0 :                     case DICTATIONCOMMAND_DEL:          nSlotId = FN_DELETE_BACK_WORD; break;
    4924                 :            : 
    4925                 :          0 :                     case DICTATIONCOMMAND_BOLD_ON:      nSlotId = SID_ATTR_CHAR_WEIGHT;
    4926         [ #  # ]:          0 :                                                         pItem = new SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT );
    4927                 :          0 :                                                         break;
    4928                 :          0 :                     case DICTATIONCOMMAND_BOLD_OFF:     nSlotId = SID_ATTR_CHAR_WEIGHT;
    4929         [ #  # ]:          0 :                                                         pItem = new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_WEIGHT );
    4930                 :          0 :                                                         break;
    4931                 :          0 :                     case DICTATIONCOMMAND_UNDERLINE_ON: nSlotId = SID_ATTR_CHAR_UNDERLINE;
    4932         [ #  # ]:          0 :                                                         pItem = new SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_WEIGHT );
    4933                 :          0 :                                                         break;
    4934                 :          0 :                     case DICTATIONCOMMAND_UNDERLINE_OFF:nSlotId = SID_ATTR_CHAR_UNDERLINE;
    4935         [ #  # ]:          0 :                                                         pItem = new SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE );
    4936                 :          0 :                                                         break;
    4937                 :          0 :                     case DICTATIONCOMMAND_ITALIC_ON:    nSlotId = SID_ATTR_CHAR_POSTURE;
    4938         [ #  # ]:          0 :                                                         pItem = new SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE );
    4939                 :          0 :                                                         break;
    4940                 :          0 :                     case DICTATIONCOMMAND_ITALIC_OFF:   nSlotId = SID_ATTR_CHAR_POSTURE;
    4941         [ #  # ]:          0 :                                                         pItem = new SvxPostureItem( ITALIC_NONE, RES_CHRATR_POSTURE );
    4942                 :          0 :                                                         break;
    4943                 :            :                     case DICTATIONCOMMAND_NUMBERING_ON:
    4944         [ #  # ]:          0 :                                     if ( !rSh.GetCurNumRule() )
    4945                 :          0 :                                         nSlotId = FN_NUM_NUMBERING_ON;
    4946                 :          0 :                                     break;
    4947                 :            :                     case DICTATIONCOMMAND_NUMBERING_OFF:
    4948         [ #  # ]:          0 :                                     if ( rSh.GetCurNumRule() )
    4949                 :          0 :                                        nSlotId = FN_NUM_NUMBERING_ON;
    4950                 :          0 :                                     break;
    4951                 :            :                     case DICTATIONCOMMAND_TAB:
    4952                 :            :                                     {
    4953                 :          0 :                                        rSh.Insert( '\t' );
    4954                 :            :                                     }
    4955                 :          0 :                                     break;
    4956                 :            :                     case DICTATIONCOMMAND_UNKNOWN:
    4957                 :            :                                     {
    4958                 :          0 :                                         rView.GetWrtShell().Insert( pCData->GetText() );
    4959                 :            :                                     }
    4960                 :          0 :                                     break;
    4961                 :            : 
    4962                 :            : #if OSL_DEBUG_LEVEL > 0
    4963                 :            :                     default:
    4964                 :            :                         OSL_ENSURE( !this, "unknown speech command." );
    4965                 :            : #endif
    4966                 :            :                 }
    4967         [ #  # ]:          0 :                 if ( nSlotId )
    4968                 :            :                 {
    4969                 :          0 :                     bCallBase = sal_False;
    4970         [ #  # ]:          0 :                     if ( pItem )
    4971                 :            :                     {
    4972                 :            :                         const SfxPoolItem* aArgs[2];
    4973                 :          0 :                         aArgs[0] = pItem;
    4974                 :          0 :                         aArgs[1] = 0;
    4975                 :          0 :                         GetView().GetViewFrame()->GetBindings().Execute(
    4976         [ #  # ]:          0 :                                     nSlotId, aArgs, 0, SFX_CALLMODE_STANDARD );
    4977 [ #  # ][ #  # ]:          0 :                         delete pItem;
    4978                 :            :                     }
    4979                 :            :                     else
    4980                 :          0 :                         GetView().GetViewFrame()->GetBindings().Execute( nSlotId );
    4981                 :            :                 }
    4982                 :            :             }
    4983                 :          0 :             break;
    4984                 :            : 
    4985                 :            :     case COMMAND_STARTEXTTEXTINPUT:
    4986                 :            :     {
    4987                 :          0 :         sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
    4988 [ #  # ][ #  # ]:          0 :                               rSh.IsCrsrReadonly();
    4989         [ #  # ]:          0 :         if(!bIsDocReadOnly)
    4990                 :            :         {
    4991 [ #  # ][ #  # ]:          0 :             if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
                 [ #  # ]
    4992                 :            :             {
    4993                 :          0 :                 bCallBase = sal_False;
    4994                 :          0 :                 rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
    4995                 :            :             }
    4996                 :            :             else
    4997                 :            :             {
    4998         [ #  # ]:          0 :                 if( rSh.HasSelection() )
    4999                 :          0 :                     rSh.DelRight();
    5000                 :            : 
    5001                 :          0 :                 bCallBase = sal_False;
    5002                 :          0 :                 LanguageType eInputLanguage = GetInputLanguage();
    5003                 :          0 :                 rSh.CreateExtTextInput(eInputLanguage);
    5004                 :            :             }
    5005                 :            :         }
    5006                 :          0 :         break;
    5007                 :            :     }
    5008                 :            :     case COMMAND_ENDEXTTEXTINPUT:
    5009                 :            :     {
    5010                 :          0 :         sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
    5011 [ #  # ][ #  # ]:          0 :                               rSh.IsCrsrReadonly();
    5012         [ #  # ]:          0 :         if(!bIsDocReadOnly)
    5013                 :            :         {
    5014 [ #  # ][ #  # ]:          0 :             if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
                 [ #  # ]
    5015                 :            :             {
    5016                 :          0 :                 bCallBase = sal_False;
    5017                 :          0 :                 rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
    5018                 :            :             }
    5019                 :            :             else
    5020                 :            :             {
    5021                 :          0 :                 bCallBase = sal_False;
    5022         [ #  # ]:          0 :                 String sRecord = rSh.DeleteExtTextInput();
    5023                 :            :                 uno::Reference< frame::XDispatchRecorder > xRecorder =
    5024         [ #  # ]:          0 :                         rView.GetViewFrame()->GetBindings().GetRecorder();
    5025                 :            : 
    5026         [ #  # ]:          0 :                 if ( sRecord.Len() )
    5027                 :            :                 {
    5028                 :            :                     // convert quotes in IME text
    5029                 :            :                     // works on the last input character, this is escpecially in Korean text often done
    5030                 :            :                     // quotes that are inside of the string are not replaced!
    5031                 :          0 :                     const sal_Unicode aCh = sRecord.GetChar(sRecord.Len() - 1);
    5032         [ #  # ]:          0 :                     SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
    5033                 :          0 :                     SvxAutoCorrect* pACorr = rACfg.GetAutoCorrect();
    5034   [ #  #  #  # ]:          0 :                     if(pACorr &&
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    5035                 :          0 :                         (( pACorr->IsAutoCorrFlag( ChgQuotes ) && ('\"' == aCh ))||
    5036                 :          0 :                         ( pACorr->IsAutoCorrFlag( ChgSglQuotes ) && ( '\'' == aCh))))
    5037                 :            :                     {
    5038         [ #  # ]:          0 :                         rSh.DelLeft();
    5039         [ #  # ]:          0 :                         rSh.AutoCorrect( *pACorr, aCh );
    5040                 :            :                     }
    5041                 :            : 
    5042         [ #  # ]:          0 :                     if ( xRecorder.is() )
    5043                 :            :                     {
    5044                 :            :                         // determine Shell
    5045 [ #  # ][ #  # ]:          0 :                         SfxShell *pSfxShell = lcl_GetShellFromDispatcher( rView, TYPE(SwTextShell) );
    5046                 :            :                         // generate request and record
    5047         [ #  # ]:          0 :                         if (pSfxShell)
    5048                 :            :                         {
    5049         [ #  # ]:          0 :                             SfxRequest aReq( rView.GetViewFrame(), FN_INSERT_STRING );
    5050 [ #  # ][ #  # ]:          0 :                             aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sRecord ) );
                 [ #  # ]
    5051 [ #  # ][ #  # ]:          0 :                             aReq.Done();
    5052                 :            :                         }
    5053                 :            :                     }
    5054         [ #  # ]:          0 :                 }
    5055                 :            :             }
    5056                 :            :         }
    5057                 :            :     }
    5058                 :          0 :     break;
    5059                 :            :     case COMMAND_EXTTEXTINPUT:
    5060                 :            :     {
    5061                 :          0 :         sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
    5062 [ #  # ][ #  # ]:          0 :                               rSh.IsCrsrReadonly();
    5063         [ #  # ]:          0 :         if(!bIsDocReadOnly)
    5064                 :            :         {
    5065         [ #  # ]:          0 :             if( pQuickHlpData->m_bIsDisplayed )
    5066         [ #  # ]:          0 :                 pQuickHlpData->Stop( rSh );
    5067                 :            : 
    5068         [ #  # ]:          0 :             String sWord;
    5069 [ #  # ][ #  # ]:          0 :             if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    5070                 :            :             {
    5071                 :          0 :                 bCallBase = sal_False;
    5072 [ #  # ][ #  # ]:          0 :                 rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
    5073                 :            :             }
    5074                 :            :             else
    5075                 :            :             {
    5076         [ #  # ]:          0 :                 const CommandExtTextInputData* pData = rCEvt.GetExtTextInputData();
    5077         [ #  # ]:          0 :                 if( pData )
    5078                 :            :                 {
    5079         [ #  # ]:          0 :                     sWord = pData->GetText();
    5080                 :          0 :                     bCallBase = sal_False;
    5081         [ #  # ]:          0 :                     rSh.SetExtTextInputData( *pData );
    5082                 :            :                 }
    5083                 :            :             }
    5084                 :            :                 uno::Reference< frame::XDispatchRecorder > xRecorder =
    5085         [ #  # ]:          0 :                         rView.GetViewFrame()->GetBindings().GetRecorder();
    5086         [ #  # ]:          0 :                 if(!xRecorder.is())
    5087                 :            :                 {
    5088         [ #  # ]:          0 :                     SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
    5089                 :          0 :                     SvxAutoCorrect* pACorr = rACfg.GetAutoCorrect();
    5090 [ #  # ][ #  # ]:          0 :                     if( pACorr &&
           [ #  #  #  #  
                   #  # ]
    5091                 :          0 :                         ( rACfg.IsAutoTextTip() ||
    5092                 :          0 :                           pACorr->GetSwFlags().bAutoCompleteWords ) &&
    5093         [ #  # ]:          0 :                         rSh.GetPrevAutoCorrWord( *pACorr, sWord ) )
    5094                 :            :                     {
    5095         [ #  # ]:          0 :                         ShowAutoTextCorrectQuickHelp(sWord, &rACfg, pACorr, sal_True);
    5096                 :            :                     }
    5097         [ #  # ]:          0 :                 }
    5098                 :            :         }
    5099                 :            :     }
    5100                 :          0 :     break;
    5101                 :            :     case COMMAND_CURSORPOS:
    5102                 :            :         // will be handled by the base class
    5103                 :          0 :         break;
    5104                 :            : 
    5105                 :            :     case COMMAND_PASTESELECTION:
    5106         [ #  # ]:          0 :         if( !rView.GetDocShell()->IsReadOnly() )
    5107                 :            :         {
    5108                 :            :             TransferableDataHelper aDataHelper(
    5109         [ #  # ]:          0 :                         TransferableDataHelper::CreateFromSelection( this ));
    5110 [ #  # ][ #  # ]:          0 :             if( !aDataHelper.GetXTransferable().is() )
    5111                 :            :                 break;
    5112                 :            : 
    5113                 :            :             sal_uLong nDropFormat;
    5114                 :            :             sal_uInt16 nEventAction, nDropAction, nDropDestination;
    5115         [ #  # ]:          0 :             nDropDestination = GetDropDestination( rCEvt.GetMousePosPixel() );
    5116         [ #  # ]:          0 :             if( !nDropDestination )
    5117                 :            :                 break;
    5118                 :            : 
    5119                 :            :             nDropAction = SotExchange::GetExchangeAction(
    5120                 :          0 :                                 aDataHelper.GetDataFlavorExVector(),
    5121                 :            :                                 nDropDestination, EXCHG_IN_ACTION_COPY,
    5122                 :            :                                 EXCHG_IN_ACTION_COPY, nDropFormat,
    5123         [ #  # ]:          0 :                                 nEventAction );
    5124         [ #  # ]:          0 :             if( EXCHG_INOUT_ACTION_NONE != nDropAction )
    5125                 :            :             {
    5126         [ #  # ]:          0 :                 const Point aDocPt( PixelToLogic( rCEvt.GetMousePosPixel() ) );
    5127                 :            :                 SwTransferable::PasteData( aDataHelper, rSh, nDropAction,
    5128                 :            :                                     nDropFormat, nDropDestination, sal_False,
    5129                 :            :                                     sal_False, &aDocPt, EXCHG_IN_ACTION_COPY,
    5130         [ #  # ]:          0 :                                     sal_True );
    5131 [ #  # ][ #  # ]:          0 :             }
    5132                 :            :         }
    5133                 :          0 :         break;
    5134                 :            :         case COMMAND_MODKEYCHANGE :
    5135                 :            :         {
    5136                 :          0 :             const CommandModKeyData* pCommandData = (const CommandModKeyData*)rCEvt.GetData();
    5137 [ #  # ][ #  # ]:          0 :             if(pCommandData->IsMod1() && !pCommandData->IsMod2())
                 [ #  # ]
    5138                 :            :             {
    5139                 :          0 :                 sal_uInt16 nSlot = 0;
    5140 [ #  # ][ #  # ]:          0 :                 if(pCommandData->IsLeftShift() && !pCommandData->IsRightShift())
                 [ #  # ]
    5141                 :          0 :                     nSlot = SID_ATTR_PARA_LEFT_TO_RIGHT;
    5142 [ #  # ][ #  # ]:          0 :                 else if(!pCommandData->IsLeftShift() && pCommandData->IsRightShift())
                 [ #  # ]
    5143                 :          0 :                     nSlot = SID_ATTR_PARA_RIGHT_TO_LEFT;
    5144 [ #  # ][ #  # ]:          0 :                 if(nSlot && SW_MOD()->GetCTLOptions().IsCTLFontEnabled())
                 [ #  # ]
    5145                 :          0 :                     GetView().GetViewFrame()->GetDispatcher()->Execute(nSlot);
    5146                 :            :             }
    5147                 :            :         }
    5148                 :          0 :         break;
    5149                 :            :         case COMMAND_HANGUL_HANJA_CONVERSION :
    5150                 :          0 :             GetView().GetViewFrame()->GetDispatcher()->Execute(SID_HANGUL_HANJA_CONVERSION);
    5151                 :          0 :         break;
    5152                 :            :         case COMMAND_INPUTLANGUAGECHANGE :
    5153                 :            :             // i#42732 - update state of fontname if input language changes
    5154                 :          0 :             bInputLanguageSwitched = true;
    5155                 :          0 :             SetUseInputLanguage( sal_True );
    5156                 :          0 :         break;
    5157                 :            :         case COMMAND_SELECTIONCHANGE:
    5158                 :            :         {
    5159                 :          0 :             const CommandSelectionChangeData *pData = rCEvt.GetSelectionChangeData();
    5160                 :          0 :             rSh.SttCrsrMove();
    5161                 :          0 :             rSh.GoStartSentence();
    5162                 :          0 :             rSh.GetCrsr()->GetPoint()->nContent += sal::static_int_cast<sal_uInt16, sal_uLong>(pData->GetStart());
    5163                 :          0 :             rSh.SetMark();
    5164                 :          0 :             rSh.GetCrsr()->GetMark()->nContent += sal::static_int_cast<sal_uInt16, sal_uLong>(pData->GetEnd() - pData->GetStart());
    5165                 :          0 :             rSh.EndCrsrMove( sal_True );
    5166                 :            :         }
    5167                 :          0 :         break;
    5168                 :            :         case COMMAND_PREPARERECONVERSION:
    5169         [ #  # ]:          0 :         if( rSh.HasSelection() )
    5170                 :            :         {
    5171                 :          0 :             SwPaM *pCrsr = (SwPaM*)rSh.GetCrsr();
    5172                 :            : 
    5173         [ #  # ]:          0 :             if( rSh.IsMultiSelection() )
    5174                 :            :             {
    5175         [ #  # ]:          0 :                 if( pCrsr && !pCrsr->HasMark() &&
           [ #  #  #  # ]
                 [ #  # ]
    5176                 :          0 :                 pCrsr->GetPoint() == pCrsr->GetMark() )
    5177                 :            :                 {
    5178                 :          0 :                 rSh.GoPrevCrsr();
    5179                 :          0 :                 pCrsr = (SwPaM*)rSh.GetCrsr();
    5180                 :            :                 }
    5181                 :            : 
    5182                 :            :                 // Cancel all selections other than the last selected one.
    5183         [ #  # ]:          0 :                 while( rSh.GetCrsr()->GetNext() != rSh.GetCrsr() )
    5184         [ #  # ]:          0 :                 delete rSh.GetCrsr()->GetNext();
    5185                 :            :             }
    5186                 :            : 
    5187         [ #  # ]:          0 :             if( pCrsr )
    5188                 :            :             {
    5189                 :          0 :                 sal_uLong nPosNodeIdx = pCrsr->GetPoint()->nNode.GetIndex();
    5190                 :          0 :                 xub_StrLen nPosIdx = pCrsr->GetPoint()->nContent.GetIndex();
    5191                 :          0 :                 sal_uLong nMarkNodeIdx = pCrsr->GetMark()->nNode.GetIndex();
    5192                 :          0 :                 xub_StrLen nMarkIdx = pCrsr->GetMark()->nContent.GetIndex();
    5193                 :            : 
    5194         [ #  # ]:          0 :                 if( !rSh.GetCrsr()->HasMark() )
    5195                 :          0 :                 rSh.GetCrsr()->SetMark();
    5196                 :            : 
    5197                 :          0 :                 rSh.SttCrsrMove();
    5198                 :            : 
    5199         [ #  # ]:          0 :                 if( nPosNodeIdx < nMarkNodeIdx )
    5200                 :            :                 {
    5201                 :          0 :                 rSh.GetCrsr()->GetPoint()->nNode = nPosNodeIdx;
    5202                 :          0 :                 rSh.GetCrsr()->GetPoint()->nContent = nPosIdx;
    5203                 :          0 :                 rSh.GetCrsr()->GetMark()->nNode = nPosNodeIdx;
    5204                 :          0 :                 rSh.GetCrsr()->GetMark()->nContent =
    5205                 :          0 :                     rSh.GetCrsr()->GetCntntNode( sal_True )->Len();
    5206                 :            :                 }
    5207         [ #  # ]:          0 :                 else if( nPosNodeIdx == nMarkNodeIdx )
    5208                 :            :                 {
    5209                 :          0 :                 rSh.GetCrsr()->GetPoint()->nNode = nPosNodeIdx;
    5210                 :          0 :                 rSh.GetCrsr()->GetPoint()->nContent = nPosIdx;
    5211                 :          0 :                 rSh.GetCrsr()->GetMark()->nNode = nMarkNodeIdx;
    5212                 :          0 :                 rSh.GetCrsr()->GetMark()->nContent = nMarkIdx;
    5213                 :            :                 }
    5214                 :            :                 else
    5215                 :            :                 {
    5216                 :          0 :                 rSh.GetCrsr()->GetMark()->nNode = nMarkNodeIdx;
    5217                 :          0 :                 rSh.GetCrsr()->GetMark()->nContent = nMarkIdx;
    5218                 :          0 :                 rSh.GetCrsr()->GetPoint()->nNode = nMarkNodeIdx;
    5219                 :          0 :                 rSh.GetCrsr()->GetPoint()->nContent =
    5220                 :          0 :                     rSh.GetCrsr()->GetCntntNode( sal_False )->Len();
    5221                 :            :                 }
    5222                 :            : 
    5223                 :          0 :                 rSh.EndCrsrMove( sal_True );
    5224                 :            :             }
    5225                 :            :         }
    5226                 :          0 :         break;
    5227                 :            : #if OSL_DEBUG_LEVEL > 0
    5228                 :            :         default:
    5229                 :            :             OSL_ENSURE( !this, "unknown command." );
    5230                 :            : #endif
    5231                 :            :     }
    5232         [ #  # ]:          0 :     if (bCallBase)
    5233                 :          0 :         Window::Command(rCEvt);
    5234                 :            : }
    5235                 :            : 
    5236                 :            : /*  i#18686 select the object/cursor at the mouse
    5237                 :            :     position of the context menu request */
    5238                 :          0 : sal_Bool SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos )
    5239                 :            : {
    5240                 :          0 :     sal_Bool bRet = sal_False;
    5241         [ #  # ]:          0 :     const Point aDocPos( PixelToLogic( rMousePos ) );
    5242         [ #  # ]:          0 :     const bool bIsInsideSelectedObj( rSh.IsInsideSelectedObj( aDocPos ) );
    5243                 :            :     //create a synthetic mouse event out of the coordinates
    5244         [ #  # ]:          0 :     MouseEvent aMEvt(rMousePos);
    5245         [ #  # ]:          0 :     SdrView *pSdrView = rSh.GetDrawView();
    5246         [ #  # ]:          0 :     if ( pSdrView )
    5247                 :            :     {
    5248                 :            :         // no close of insert_draw and reset of
    5249                 :            :         // draw mode, if context menu position is inside a selected object.
    5250 [ #  # ][ #  # ]:          0 :         if ( !bIsInsideSelectedObj && rView.GetDrawFuncPtr() )
                 [ #  # ]
    5251                 :            :         {
    5252                 :            : 
    5253         [ #  # ]:          0 :             rView.GetDrawFuncPtr()->Deactivate();
    5254         [ #  # ]:          0 :             rView.SetDrawFuncPtr(NULL);
    5255         [ #  # ]:          0 :             rView.LeaveDrawCreate();
    5256                 :          0 :             SfxBindings& rBind = rView.GetViewFrame()->GetBindings();
    5257         [ #  # ]:          0 :             rBind.Invalidate( SID_ATTR_SIZE );
    5258         [ #  # ]:          0 :             rBind.Invalidate( SID_TABLE_CELL );
    5259                 :            :         }
    5260                 :            : 
    5261                 :            :         // if draw text is active and there's a text selection
    5262                 :            :         // at the mouse position then do nothing
    5263 [ #  # ][ #  # ]:          0 :         if(rSh.GetSelectionType() & nsSelectionType::SEL_DRW_TXT)
    5264                 :            :         {
    5265                 :          0 :             OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
    5266         [ #  # ]:          0 :             ESelection aSelection = pOLV->GetSelection();
    5267         [ #  # ]:          0 :             if(!aSelection.IsZero())
    5268                 :            :             {
    5269                 :          0 :                 SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner();
    5270         [ #  # ]:          0 :                 sal_Bool bVertical = pOutliner->IsVertical();
    5271                 :          0 :                 const EditEngine& rEditEng = pOutliner->GetEditEngine();
    5272                 :          0 :                 Point aEEPos(aDocPos);
    5273         [ #  # ]:          0 :                 const Rectangle& rOutputArea = pOLV->GetOutputArea();
    5274                 :            :                 // regard vertical mode
    5275         [ #  # ]:          0 :                 if(bVertical)
    5276                 :            :                 {
    5277         [ #  # ]:          0 :                     aEEPos -= rOutputArea.TopRight();
    5278                 :            :                     //invert the horizontal direction and exchange X and Y
    5279                 :          0 :                     long nTemp = -aEEPos.X();
    5280                 :          0 :                     aEEPos.X() = aEEPos.Y();
    5281                 :          0 :                     aEEPos.Y() = nTemp;
    5282                 :            :                 }
    5283                 :            :                 else
    5284                 :          0 :                     aEEPos -= rOutputArea.TopLeft();
    5285                 :            : 
    5286         [ #  # ]:          0 :                 EPosition aDocPosition = rEditEng.FindDocPosition(aEEPos);
    5287                 :          0 :                 ESelection aCompare(aDocPosition.nPara, aDocPosition.nIndex);
    5288                 :            :                 // make it a forward selection - otherwise the IsLess/IsGreater do not work :-(
    5289                 :          0 :                 aSelection.Adjust();
    5290 [ #  # ][ #  # ]:          0 :                 if(!aCompare.IsLess(aSelection)  && !aCompare.IsGreater(aSelection))
                 [ #  # ]
    5291                 :            :                 {
    5292                 :          0 :                     return sal_False;
    5293                 :            :                 }
    5294                 :            :             }
    5295                 :            : 
    5296                 :            :         }
    5297                 :            : 
    5298 [ #  # ][ #  # ]:          0 :         if (pSdrView->MouseButtonDown( aMEvt, this ) )
    5299                 :            :         {
    5300         [ #  # ]:          0 :             pSdrView->MouseButtonUp( aMEvt, this );
    5301         [ #  # ]:          0 :             rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
    5302                 :          0 :             return sal_True;
    5303                 :            :         }
    5304                 :            :     }
    5305         [ #  # ]:          0 :     rSh.ResetCursorStack();
    5306                 :            : 
    5307 [ #  # ][ #  # ]:          0 :     if ( EnterDrawMode( aMEvt, aDocPos ) )
    5308                 :            :     {
    5309                 :          0 :         return sal_True;
    5310                 :            :     }
    5311 [ #  # ][ #  # ]:          0 :     if ( rView.GetDrawFuncPtr() && bInsFrm )
                 [ #  # ]
    5312                 :            :     {
    5313         [ #  # ]:          0 :         StopInsFrm();
    5314         [ #  # ]:          0 :         rSh.Edit();
    5315                 :            :     }
    5316                 :            : 
    5317         [ #  # ]:          0 :     UpdatePointer( aDocPos, 0 );
    5318                 :            : 
    5319 [ #  # ][ #  # ]:          0 :     if( !rSh.IsSelFrmMode() &&
                 [ #  # ]
    5320         [ #  # ]:          0 :         !GetView().GetViewFrame()->GetDispatcher()->IsLocked() )
    5321                 :            :     {
    5322                 :            :         // Test if there is a draw object at that position and if it should be selected.
    5323         [ #  # ]:          0 :         sal_Bool bShould = rSh.ShouldObjectBeSelected(aDocPos);
    5324                 :            : 
    5325         [ #  # ]:          0 :         if(bShould)
    5326                 :            :         {
    5327         [ #  # ]:          0 :             rView.NoRotate();
    5328         [ #  # ]:          0 :             rSh.HideCrsr();
    5329                 :            : 
    5330                 :          0 :             sal_Bool bUnLockView = !rSh.IsViewLocked();
    5331                 :          0 :             rSh.LockView( sal_True );
    5332         [ #  # ]:          0 :             sal_Bool bSelObj = rSh.SelectObj( aDocPos, 0);
    5333         [ #  # ]:          0 :             if( bUnLockView )
    5334                 :          0 :                 rSh.LockView( sal_False );
    5335                 :            : 
    5336         [ #  # ]:          0 :             if( bSelObj )
    5337                 :            :             {
    5338                 :          0 :                 bRet = sal_True;
    5339                 :            :                 // in case the frame was deselected in the macro
    5340                 :            :                 // just the cursor has to be displayed again.
    5341 [ #  # ][ #  # ]:          0 :                 if( FRMTYPE_NONE == rSh.GetSelFrmType() )
    5342         [ #  # ]:          0 :                     rSh.ShowCrsr();
    5343                 :            :                 else
    5344                 :            :                 {
    5345 [ #  # ][ #  # ]:          0 :                     if (rSh.IsFrmSelected() && rView.GetDrawFuncPtr())
         [ #  # ][ #  # ]
    5346                 :            :                     {
    5347         [ #  # ]:          0 :                         rView.GetDrawFuncPtr()->Deactivate();
    5348         [ #  # ]:          0 :                         rView.SetDrawFuncPtr(NULL);
    5349         [ #  # ]:          0 :                         rView.LeaveDrawCreate();
    5350         [ #  # ]:          0 :                         rView.AttrChangedNotify( &rSh );
    5351                 :            :                     }
    5352                 :            : 
    5353         [ #  # ]:          0 :                     rSh.EnterSelFrmMode( &aDocPos );
    5354                 :          0 :                     bFrmDrag = sal_True;
    5355         [ #  # ]:          0 :                     UpdatePointer( aDocPos, 0 );
    5356                 :          0 :                     return bRet;
    5357                 :            :                 }
    5358                 :            :             }
    5359                 :            : 
    5360         [ #  # ]:          0 :             if (!rView.GetDrawFuncPtr())
    5361         [ #  # ]:          0 :                 rSh.ShowCrsr();
    5362                 :            :         }
    5363                 :            :     }
    5364 [ #  # ][ #  # ]:          0 :     else if ( rSh.IsSelFrmMode() &&
         [ #  # ][ #  # ]
    5365                 :            :               (aActHitType == SDRHIT_NONE ||
    5366                 :          0 :                !bIsInsideSelectedObj))
    5367                 :            :     {
    5368         [ #  # ]:          0 :         rView.NoRotate();
    5369                 :          0 :         sal_Bool bUnLockView = !rSh.IsViewLocked();
    5370                 :          0 :         rSh.LockView( sal_True );
    5371                 :          0 :         sal_uInt8 nFlag = 0;
    5372                 :            : 
    5373         [ #  # ]:          0 :         if ( rSh.IsSelFrmMode() )
    5374                 :            :         {
    5375         [ #  # ]:          0 :             rSh.UnSelectFrm();
    5376         [ #  # ]:          0 :             rSh.LeaveSelFrmMode();
    5377         [ #  # ]:          0 :             rView.AttrChangedNotify(&rSh);
    5378                 :          0 :             bRet = sal_True;
    5379                 :            :         }
    5380                 :            : 
    5381         [ #  # ]:          0 :         sal_Bool bSelObj = rSh.SelectObj( aDocPos, nFlag );
    5382         [ #  # ]:          0 :         if( bUnLockView )
    5383                 :          0 :             rSh.LockView( sal_False );
    5384                 :            : 
    5385         [ #  # ]:          0 :         if( !bSelObj )
    5386                 :            :         {
    5387                 :            :             // move cursor here so that it is not drawn in the
    5388                 :            :             // frame at first; ShowCrsr() happens in LeaveSelFrmMode()
    5389         [ #  # ]:          0 :             bValidCrsrPos = !(CRSR_POSCHG & rSh.SetCursor(&aDocPos, false));
    5390         [ #  # ]:          0 :             rSh.LeaveSelFrmMode();
    5391         [ #  # ]:          0 :             rView.LeaveDrawCreate();
    5392         [ #  # ]:          0 :             rView.AttrChangedNotify( &rSh );
    5393                 :          0 :             bRet = sal_True;
    5394                 :            :         }
    5395                 :            :         else
    5396                 :            :         {
    5397         [ #  # ]:          0 :             rSh.HideCrsr();
    5398         [ #  # ]:          0 :             rSh.EnterSelFrmMode( &aDocPos );
    5399         [ #  # ]:          0 :             rSh.SelFlyGrabCrsr();
    5400         [ #  # ]:          0 :             rSh.MakeSelVisible();
    5401                 :          0 :             bFrmDrag = sal_True;
    5402         [ #  # ]:          0 :             if( rSh.IsFrmSelected() &&
           [ #  #  #  # ]
                 [ #  # ]
    5403                 :          0 :                 rView.GetDrawFuncPtr() )
    5404                 :            :             {
    5405         [ #  # ]:          0 :                 rView.GetDrawFuncPtr()->Deactivate();
    5406         [ #  # ]:          0 :                 rView.SetDrawFuncPtr(NULL);
    5407         [ #  # ]:          0 :                 rView.LeaveDrawCreate();
    5408         [ #  # ]:          0 :                 rView.AttrChangedNotify( &rSh );
    5409                 :            :             }
    5410         [ #  # ]:          0 :             UpdatePointer( aDocPos, 0 );
    5411                 :          0 :             bRet = sal_True;
    5412                 :            :         }
    5413                 :            :     }
    5414 [ #  # ][ #  # ]:          0 :     else if ( rSh.IsSelFrmMode() && bIsInsideSelectedObj )
                 [ #  # ]
    5415                 :            :     {
    5416                 :            :         // ## object at the mouse cursor is already selected - do nothing
    5417                 :          0 :         return sal_False;
    5418                 :            :     }
    5419                 :            : 
    5420         [ #  # ]:          0 :     if ( rSh.IsGCAttr() )
    5421                 :            :     {
    5422         [ #  # ]:          0 :         rSh.GCAttr();
    5423                 :          0 :         rSh.ClearGCAttr();
    5424                 :            :     }
    5425                 :            : 
    5426         [ #  # ]:          0 :     sal_Bool bOverSelect = rSh.ChgCurrPam( aDocPos ), bOverURLGrf = sal_False;
    5427         [ #  # ]:          0 :     if( !bOverSelect )
    5428         [ #  # ]:          0 :         bOverURLGrf = bOverSelect = 0 != rSh.IsURLGrfAtPos( aDocPos );
    5429                 :            : 
    5430         [ #  # ]:          0 :     if ( !bOverSelect )
    5431                 :            :     {
    5432                 :            :         {   // create only temporary move context because otherwise
    5433                 :            :             // the query against the content form doesn't work!!!
    5434         [ #  # ]:          0 :             MV_KONTEXT( &rSh );
    5435         [ #  # ]:          0 :             rSh.SetCursor(&aDocPos, false);
    5436         [ #  # ]:          0 :             bRet = sal_True;
    5437                 :            :         }
    5438                 :            :     }
    5439         [ #  # ]:          0 :     if( !bOverURLGrf )
    5440                 :            :     {
    5441         [ #  # ]:          0 :         const int nSelType = rSh.GetSelectionType();
    5442 [ #  # ][ #  # ]:          0 :         if( nSelType == nsSelectionType::SEL_OLE ||
    5443                 :            :             nSelType == nsSelectionType::SEL_GRF )
    5444                 :            :         {
    5445         [ #  # ]:          0 :             MV_KONTEXT( &rSh );
    5446 [ #  # ][ #  # ]:          0 :             if( !rSh.IsFrmSelected() )
    5447         [ #  # ]:          0 :                 rSh.GotoNextFly();
    5448         [ #  # ]:          0 :             rSh.EnterSelFrmMode();
    5449         [ #  # ]:          0 :             bRet = sal_True;
    5450                 :            :         }
    5451                 :            :     }
    5452                 :          0 :     return bRet;
    5453                 :            : }
    5454                 :            : 
    5455                 :          0 : SfxShell* lcl_GetShellFromDispatcher( SwView& rView, TypeId nType )
    5456                 :            : {
    5457                 :            :     // determine Shell
    5458                 :            :     SfxShell* pShell;
    5459                 :          0 :     SfxDispatcher* pDispatcher = rView.GetViewFrame()->GetDispatcher();
    5460                 :          0 :     for(sal_uInt16  i = 0; sal_True; ++i )
    5461                 :            :     {
    5462                 :          0 :         pShell = pDispatcher->GetShell( i );
    5463 [ #  # ][ #  # ]:          0 :         if( !pShell || pShell->IsA( nType ) )
                 [ #  # ]
    5464                 :          0 :             break;
    5465                 :            :     }
    5466                 :          0 :     return pShell;
    5467                 :            : }
    5468                 :            : 
    5469                 :          0 : IMPL_LINK_NOARG(SwEditWin, KeyInputFlushHandler)
    5470                 :            : {
    5471                 :          0 :     FlushInBuffer();
    5472                 :          0 :     return 0;
    5473                 :            : }
    5474                 :            : 
    5475                 :          0 : IMPL_LINK_NOARG(SwEditWin, KeyInputTimerHandler)
    5476                 :            : {
    5477                 :          0 :     bTblInsDelMode = sal_False;
    5478                 :          0 :     return 0;
    5479                 :            : }
    5480                 :            : 
    5481                 :         73 : void SwEditWin::_InitStaticData()
    5482                 :            : {
    5483         [ +  - ]:         73 :     pQuickHlpData = new QuickHelpData();
    5484                 :         73 : }
    5485                 :            : 
    5486                 :         73 : void SwEditWin::_FinitStaticData()
    5487                 :            : {
    5488         [ +  - ]:         73 :     delete pQuickHlpData;
    5489                 :         73 : }
    5490                 :            : /* i#3370 - remove quick help to prevent saving
    5491                 :            :  * of autocorrection suggestions */
    5492                 :         30 : void SwEditWin::StopQuickHelp()
    5493                 :            : {
    5494 [ +  + ][ +  - ]:         30 :     if( HasFocus() && pQuickHlpData && pQuickHlpData->m_bIsDisplayed  )
         [ -  + ][ -  + ]
    5495                 :          0 :         pQuickHlpData->Stop( rView.GetWrtShell() );
    5496                 :         30 : }
    5497                 :            : 
    5498                 :          0 : IMPL_LINK_NOARG(SwEditWin, TemplateTimerHdl)
    5499                 :            : {
    5500         [ #  # ]:          0 :     SetApplyTemplate(SwApplyTemplate());
    5501                 :          0 :     return 0;
    5502                 :            : }
    5503                 :            : 
    5504                 :          0 : void SwEditWin::SetChainMode( sal_Bool bOn )
    5505                 :            : {
    5506         [ #  # ]:          0 :     if ( !bChainMode )
    5507                 :          0 :         StopInsFrm();
    5508                 :            : 
    5509         [ #  # ]:          0 :     if ( pUserMarker )
    5510                 :            :     {
    5511         [ #  # ]:          0 :         delete pUserMarker;
    5512                 :          0 :         pUserMarker = 0L;
    5513                 :            :     }
    5514                 :            : 
    5515                 :          0 :     bChainMode = bOn;
    5516                 :            : 
    5517                 :            :     static sal_uInt16 aInva[] =
    5518                 :            :     {
    5519                 :            :         FN_FRAME_CHAIN, FN_FRAME_UNCHAIN, 0
    5520                 :            :     };
    5521                 :          0 :     rView.GetViewFrame()->GetBindings().Invalidate(aInva);
    5522                 :          0 : }
    5523                 :            : 
    5524                 :         24 : uno::Reference< ::com::sun::star::accessibility::XAccessible > SwEditWin::CreateAccessible()
    5525                 :            : {
    5526         [ +  - ]:         24 :     SolarMutexGuard aGuard;   // this should have happend already!!!
    5527                 :         24 :     SwWrtShell *pSh = rView.GetWrtShellPtr();
    5528                 :            :     OSL_ENSURE( pSh, "no writer shell, no accessible object" );
    5529                 :            :     uno::Reference<
    5530                 :         24 :         ::com::sun::star::accessibility::XAccessible > xAcc;
    5531         [ +  - ]:         24 :     if( pSh )
    5532 [ +  - ][ +  - ]:         24 :         xAcc = pSh->CreateAccessible();
    5533                 :            : 
    5534         [ +  - ]:         24 :     return xAcc;
    5535                 :            : }
    5536                 :            : 
    5537                 :            : //-------------------------------------------------------------
    5538                 :            : 
    5539                 :          0 : void QuickHelpData::Move( QuickHelpData& rCpy )
    5540                 :            : {
    5541                 :          0 :     m_aHelpStrings.clear();
    5542                 :          0 :     m_aHelpStrings.swap( rCpy.m_aHelpStrings );
    5543                 :            : 
    5544                 :          0 :     m_bIsDisplayed = rCpy.m_bIsDisplayed;
    5545                 :          0 :     nLen = rCpy.nLen;
    5546                 :          0 :     nCurArrPos = rCpy.nCurArrPos;
    5547                 :          0 :     m_bAppendSpace = rCpy.m_bAppendSpace;
    5548                 :          0 :     m_bIsTip = rCpy.m_bIsTip;
    5549                 :          0 :     m_bIsAutoText = rCpy.m_bIsAutoText;
    5550                 :          0 : }
    5551                 :            : 
    5552                 :         73 : void QuickHelpData::ClearCntnt()
    5553                 :            : {
    5554                 :         73 :     nLen = nCurArrPos = 0;
    5555                 :         73 :     m_bIsDisplayed = m_bAppendSpace = false;
    5556                 :         73 :     nTipId = 0;
    5557                 :         73 :     m_aHelpStrings.clear();
    5558                 :         73 :     m_bIsTip = true;
    5559                 :         73 :     m_bIsAutoText = true;
    5560                 :         73 : }
    5561                 :            : 
    5562                 :          0 : void QuickHelpData::Start( SwWrtShell& rSh, sal_uInt16 nWrdLen )
    5563                 :            : {
    5564         [ #  # ]:          0 :     if( USHRT_MAX != nWrdLen )
    5565                 :            :     {
    5566                 :          0 :         nLen = nWrdLen;
    5567                 :          0 :         nCurArrPos = 0;
    5568                 :            :     }
    5569                 :          0 :     m_bIsDisplayed = true;
    5570                 :            : 
    5571                 :          0 :     Window& rWin = rSh.GetView().GetEditWin();
    5572         [ #  # ]:          0 :     if( m_bIsTip )
    5573                 :            :     {
    5574                 :            :         Point aPt( rWin.OutputToScreenPixel( rWin.LogicToPixel(
    5575 [ #  # ][ #  # ]:          0 :                     rSh.GetCharRect().Pos() )));
    5576                 :          0 :         aPt.Y() -= 3;
    5577                 :            :         nTipId = Help::ShowTip( &rWin, Rectangle( aPt, Size( 1, 1 )),
    5578         [ #  # ]:          0 :                         m_aHelpStrings[ nCurArrPos ],
    5579 [ #  # ][ #  # ]:          0 :                         QUICKHELP_LEFT | QUICKHELP_BOTTOM );
    5580                 :            :     }
    5581                 :            :     else
    5582                 :            :     {
    5583 [ #  # ][ #  # ]:          0 :         String sStr( m_aHelpStrings[ nCurArrPos ] );
    5584         [ #  # ]:          0 :         sStr.Erase( 0, nLen );
    5585                 :          0 :         sal_uInt16 nL = sStr.Len();
    5586                 :            :         const sal_uInt16 nVal = EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE |
    5587                 :          0 :                                 EXTTEXTINPUT_ATTR_HIGHLIGHT;
    5588         [ #  # ]:          0 :         const std::vector<sal_uInt16> aAttrs( nL, nVal );
    5589         [ #  # ]:          0 :         CommandExtTextInputData aCETID( sStr, &aAttrs[0], nL,
    5590         [ #  # ]:          0 :                                         0, 0, 0, sal_False );
    5591                 :            : 
    5592                 :            :         //fdo#33092. If the current input language is the default
    5593                 :            :         //language that text would appear in if typed, then don't
    5594                 :            :         //force a language on for the ExtTextInput.
    5595         [ #  # ]:          0 :         LanguageType eInputLanguage = rWin.GetInputLanguage();
    5596         [ #  # ]:          0 :         if (lcl_isNonDefaultLanguage(eInputLanguage,
    5597         [ #  # ]:          0 :             rSh.GetView(), sStr) == INVALID_HINT)
    5598                 :            :         {
    5599                 :          0 :             eInputLanguage = LANGUAGE_DONTKNOW;
    5600                 :            :         }
    5601                 :            : 
    5602         [ #  # ]:          0 :         rSh.CreateExtTextInput(eInputLanguage);
    5603 [ #  # ][ #  # ]:          0 :         rSh.SetExtTextInputData( aCETID );
                 [ #  # ]
    5604                 :            :     }
    5605                 :          0 : }
    5606                 :            : 
    5607                 :          0 : void QuickHelpData::Stop( SwWrtShell& rSh )
    5608                 :            : {
    5609         [ #  # ]:          0 :     if( !m_bIsTip )
    5610                 :          0 :         rSh.DeleteExtTextInput( 0, sal_False );
    5611         [ #  # ]:          0 :     else if( nTipId )
    5612                 :          0 :         Help::HideTip( nTipId );
    5613                 :          0 :     ClearCntnt();
    5614                 :          0 : }
    5615                 :            : 
    5616                 :          0 : void QuickHelpData::FillStrArr( SwWrtShell& rSh, const String& rWord )
    5617                 :            : {
    5618                 :            :     enum Capitalization { CASE_LOWER, CASE_UPPER, CASE_SENTENCE, CASE_OTHER };
    5619                 :            : 
    5620                 :            :     // Determine word capitalization
    5621         [ #  # ]:          0 :     const CharClass& rCC = GetAppCharClass();
    5622 [ #  # ][ #  # ]:          0 :     const String sWordLower = rCC.lowercase( rWord );
                 [ #  # ]
    5623                 :          0 :     Capitalization aWordCase = CASE_OTHER;
    5624         [ #  # ]:          0 :     if ( rWord.Len() > 0 )
    5625                 :            :     {
    5626         [ #  # ]:          0 :         if ( rWord.GetChar(0) == sWordLower.GetChar(0) )
    5627                 :            :         {
    5628 [ #  # ][ #  # ]:          0 :             if ( rWord == sWordLower )
    5629                 :          0 :                 aWordCase = CASE_LOWER;
    5630                 :            :         }
    5631                 :            :         else
    5632                 :            :         {
    5633                 :            :             // First character is not lower case i.e. assume upper or title case
    5634         [ #  # ]:          0 :             String sWordSentence = sWordLower;
    5635         [ #  # ]:          0 :             sWordSentence.SetChar( 0, rWord.GetChar(0) );
    5636 [ #  # ][ #  # ]:          0 :             if ( rWord == sWordSentence )
    5637                 :          0 :                 aWordCase = CASE_SENTENCE;
    5638                 :            :             else
    5639                 :            :             {
    5640 [ #  # ][ #  # ]:          0 :                 if ( rWord == static_cast<String>( rCC.uppercase( rWord ) ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    5641                 :          0 :                     aWordCase = CASE_UPPER;
    5642         [ #  # ]:          0 :             }
    5643                 :            :         }
    5644                 :            :     }
    5645                 :            : 
    5646         [ #  # ]:          0 :     salhelper::SingletonRef<SwCalendarWrapper>* pCalendar = s_getCalendarWrapper();
    5647 [ #  # ][ #  # ]:          0 :     (*pCalendar)->LoadDefaultCalendar( rSh.GetCurLang() );
                 [ #  # ]
    5648                 :            : 
    5649                 :            :     // Add matching calendar month and day names
    5650 [ #  # ][ #  # ]:          0 :     uno::Sequence< i18n::CalendarItem2 > aNames( (*pCalendar)->getMonths() );
    5651         [ #  # ]:          0 :     for ( sal_uInt16 i = 0; i < 2; ++i )
    5652                 :            :     {
    5653         [ #  # ]:          0 :         for ( long n = 0; n < aNames.getLength(); ++n )
    5654                 :            :         {
    5655 [ #  # ][ #  # ]:          0 :             const String& rStr( aNames[n].FullName );
    5656                 :            :             // Check string longer than word and case insensitive match
    5657 [ #  # ][ #  # ]:          0 :             if( rStr.Len() > rWord.Len() &&
                 [ #  # ]
    5658                 :          0 :                 static_cast<String>( rCC.lowercase( rStr, 0, rWord.Len() ) )
    5659 [ #  # ][ #  # ]:          0 :                 == sWordLower )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
                 [ #  # ]
    5660                 :            :             {
    5661         [ #  # ]:          0 :                 if ( aWordCase == CASE_LOWER )
    5662 [ #  # ][ #  # ]:          0 :                     m_aHelpStrings.push_back( rCC.lowercase( rStr ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    5663         [ #  # ]:          0 :                 else if ( aWordCase == CASE_SENTENCE )
    5664                 :            :                 {
    5665 [ #  # ][ #  # ]:          0 :                     String sTmp = rCC.lowercase( rStr );
                 [ #  # ]
    5666         [ #  # ]:          0 :                     sTmp.SetChar( 0, rStr.GetChar(0) );
    5667 [ #  # ][ #  # ]:          0 :                     m_aHelpStrings.push_back( sTmp );
    5668                 :            :                 }
    5669         [ #  # ]:          0 :                 else if ( aWordCase == CASE_UPPER )
    5670 [ #  # ][ #  # ]:          0 :                     m_aHelpStrings.push_back( rCC.uppercase( rStr ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    5671                 :            :                 else // CASE_OTHER - use retrieved capitalization
    5672         [ #  # ]:          0 :                     m_aHelpStrings.push_back( rStr );
    5673                 :            :             }
    5674         [ #  # ]:          0 :         }
    5675                 :            :         // Data for second loop iteration
    5676         [ #  # ]:          0 :         if ( i == 0 )
    5677 [ #  # ][ #  # ]:          0 :             aNames = (*pCalendar)->getDays();
         [ #  # ][ #  # ]
    5678                 :            :     }
    5679                 :            : 
    5680                 :            :     // Add matching words from AutoCompleteWord list
    5681         [ #  # ]:          0 :     const SwAutoCompleteWord& rACList = rSh.GetAutoCompleteWords();
    5682         [ #  # ]:          0 :     std::vector<String> strings;
    5683 [ #  # ][ #  # ]:          0 :     if ( rACList.GetWordsMatching( rWord, strings ) )
         [ #  # ][ #  # ]
    5684                 :            :     {
    5685         [ #  # ]:          0 :         for (unsigned int i= 0; i<strings.size(); i++)
    5686                 :            :         {
    5687 [ #  # ][ #  # ]:          0 :             String aCompletedString = strings[i];
    5688         [ #  # ]:          0 :             if ( aWordCase == CASE_LOWER )
    5689 [ #  # ][ #  # ]:          0 :                 m_aHelpStrings.push_back( rCC.lowercase( aCompletedString ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    5690         [ #  # ]:          0 :             else if ( aWordCase == CASE_SENTENCE )
    5691                 :            :             {
    5692 [ #  # ][ #  # ]:          0 :                 String sTmp = rCC.lowercase( aCompletedString );
                 [ #  # ]
    5693         [ #  # ]:          0 :                 sTmp.SetChar( 0, aCompletedString.GetChar(0) );
    5694 [ #  # ][ #  # ]:          0 :                 m_aHelpStrings.push_back( sTmp );
    5695                 :            :             }
    5696         [ #  # ]:          0 :             else if ( aWordCase == CASE_UPPER )
    5697 [ #  # ][ #  # ]:          0 :                 m_aHelpStrings.push_back( rCC.uppercase( aCompletedString ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    5698                 :            :             else // CASE_OTHER - use retrieved capitalization
    5699         [ #  # ]:          0 :                 m_aHelpStrings.push_back( aCompletedString );
    5700         [ #  # ]:          0 :         }
    5701 [ #  # ][ #  # ]:          0 :     }
    5702                 :            : 
    5703                 :          0 : }
    5704                 :            : 
    5705                 :            : namespace {
    5706                 :            : 
    5707                 :            : struct CompareIgnoreCaseAscii
    5708                 :            : {
    5709                 :          0 :     bool operator()(const String& s1, const String& s2) const
    5710                 :            :     {
    5711                 :          0 :         return s1.CompareIgnoreCaseToAscii(s2) == COMPARE_LESS;
    5712                 :            :     }
    5713                 :            : };
    5714                 :            : 
    5715                 :            : struct EqualIgnoreCaseAscii
    5716                 :            : {
    5717                 :          0 :     bool operator()(const String& s1, const String& s2) const
    5718                 :            :     {
    5719                 :          0 :         return s1.CompareIgnoreCaseToAscii(s2) == COMPARE_EQUAL;
    5720                 :            :     }
    5721                 :            : };
    5722                 :            : 
    5723                 :            : } // anonymous namespace
    5724                 :            : 
    5725                 :            : // TODO - implement an i18n aware sort
    5726                 :          0 : void QuickHelpData::SortAndFilter()
    5727                 :            : {
    5728                 :            :     std::sort( m_aHelpStrings.begin(),
    5729                 :            :                m_aHelpStrings.end(),
    5730         [ #  # ]:          0 :                CompareIgnoreCaseAscii() );
    5731                 :            : 
    5732                 :            :     std::vector<String>::iterator it = std::unique( m_aHelpStrings.begin(),
    5733                 :            :                                                     m_aHelpStrings.end(),
    5734         [ #  # ]:          0 :                                                     EqualIgnoreCaseAscii() );
    5735         [ #  # ]:          0 :     m_aHelpStrings.erase( it, m_aHelpStrings.end() );
    5736                 :            : 
    5737                 :          0 :     nCurArrPos = 0;
    5738                 :          0 : }
    5739                 :            : 
    5740                 :          0 : void SwEditWin::ShowAutoTextCorrectQuickHelp(
    5741                 :            :         const String& rWord, SvxAutoCorrCfg* pACfg, SvxAutoCorrect* pACorr,
    5742                 :            :         sal_Bool bFromIME )
    5743                 :            : {
    5744                 :          0 :     SwWrtShell& rSh = rView.GetWrtShell();
    5745                 :          0 :     pQuickHlpData->ClearCntnt();
    5746         [ #  # ]:          0 :     if( pACfg->IsAutoTextTip() )
    5747                 :            :     {
    5748                 :          0 :         SwGlossaryList* pList = ::GetGlossaryList();
    5749                 :          0 :         pList->HasLongName( rWord, &pQuickHlpData->m_aHelpStrings );
    5750                 :            :     }
    5751                 :            : 
    5752   [ #  #  #  # ]:          0 :     if( pQuickHlpData->m_aHelpStrings.empty() &&
                 [ #  # ]
    5753                 :          0 :         pACorr->GetSwFlags().bAutoCompleteWords )
    5754                 :            :     {
    5755                 :          0 :         pQuickHlpData->m_bIsAutoText = false;
    5756                 :            :         pQuickHlpData->m_bIsTip = bFromIME ||
    5757                 :            :                     !pACorr ||
    5758 [ #  # ][ #  # ]:          0 :                     pACorr->GetSwFlags().bAutoCmpltShowAsTip;
                 [ #  # ]
    5759                 :            : 
    5760                 :          0 :         pQuickHlpData->FillStrArr( rSh, rWord );
    5761                 :            :     }
    5762                 :            : 
    5763                 :            : 
    5764         [ #  # ]:          0 :     if( !pQuickHlpData->m_aHelpStrings.empty() )
    5765                 :            :     {
    5766                 :          0 :         pQuickHlpData->SortAndFilter();
    5767                 :          0 :         pQuickHlpData->Start( rSh, rWord.Len() );
    5768                 :            :     }
    5769                 :          0 : }
    5770                 :            : 
    5771                 :          0 : void SwEditWin::ShowHeaderFooterSeparator( bool bShowHeader, bool bShowFooter )
    5772                 :            : {
    5773                 :          0 :     SwWrtShell& rSh = rView.GetWrtShell();
    5774                 :            : 
    5775         [ #  # ]:          0 :     if ( ( rSh.IsShowHeaderFooterSeparator( Header ) != bShowHeader ) ||
           [ #  #  #  # ]
    5776                 :          0 :          ( rSh.IsShowHeaderFooterSeparator( Footer ) != bShowFooter ) )
    5777                 :            :     {
    5778                 :          0 :         rSh.SetShowHeaderFooterSeparator( Header, bShowHeader );
    5779                 :          0 :         rSh.SetShowHeaderFooterSeparator( Footer, bShowFooter );
    5780                 :          0 :         Invalidate();
    5781                 :            :     }
    5782                 :          0 : }
    5783                 :            : 
    5784                 :          0 : bool SwEditWin::IsInHeaderFooter( const Point &rDocPt, FrameControlType &rControl ) const
    5785                 :            : {
    5786                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
    5787                 :          0 :     const SwPageFrm* pPageFrm = rSh.GetLayout()->GetPageAtPos( rDocPt );
    5788                 :            : 
    5789 [ #  # ][ #  # ]:          0 :     if ( pPageFrm && pPageFrm->IsOverHeaderFooterArea( rDocPt, rControl ) )
                 [ #  # ]
    5790                 :          0 :         return true;
    5791                 :            : 
    5792 [ #  # ][ #  # ]:          0 :     if ( rSh.IsShowHeaderFooterSeparator( Header ) || rSh.IsShowHeaderFooterSeparator( Footer ) )
                 [ #  # ]
    5793                 :            :     {
    5794                 :          0 :         SwFrameControlsManager &rMgr = rSh.GetView().GetEditWin().GetFrameControlsManager();
    5795         [ #  # ]:          0 :         Point aPoint( LogicToPixel( rDocPt ) );
    5796                 :            : 
    5797         [ #  # ]:          0 :         if ( rSh.IsShowHeaderFooterSeparator( Header ) )
    5798                 :            :         {
    5799         [ #  # ]:          0 :             SwFrameControlPtr pControl = rMgr.GetControl( Header, pPageFrm );
    5800 [ #  # ][ #  # ]:          0 :             if ( pControl.get() && pControl->Contains( aPoint ) )
         [ #  # ][ #  # ]
    5801                 :            :             {
    5802                 :          0 :                 rControl = Header;
    5803                 :          0 :                 return true;
    5804 [ #  # ][ #  # ]:          0 :             }
    5805                 :            :         }
    5806                 :            : 
    5807         [ #  # ]:          0 :         if ( rSh.IsShowHeaderFooterSeparator( Footer ) )
    5808                 :            :         {
    5809         [ #  # ]:          0 :             SwFrameControlPtr pControl = rMgr.GetControl( Footer, pPageFrm );
    5810 [ #  # ][ #  # ]:          0 :             if ( pControl.get() && pControl->Contains( aPoint ) )
         [ #  # ][ #  # ]
    5811                 :            :             {
    5812                 :          0 :                 rControl = Footer;
    5813                 :          0 :                 return true;
    5814 [ #  # ][ #  # ]:          0 :             }
    5815                 :            :         }
    5816                 :            :     }
    5817                 :            : 
    5818                 :          0 :     return false;
    5819                 :            : }
    5820                 :            : 
    5821                 :          0 : void SwEditWin::SetUseInputLanguage( sal_Bool bNew )
    5822                 :            : {
    5823 [ #  # ][ #  # ]:          0 :     if ( bNew || bUseInputLanguage )
    5824                 :            :     {
    5825                 :          0 :         SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
    5826                 :          0 :         rBind.Invalidate( SID_ATTR_CHAR_FONT );
    5827                 :          0 :         rBind.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
    5828                 :            :     }
    5829                 :          0 :     bUseInputLanguage = bNew;
    5830                 :          0 : }
    5831                 :            : 
    5832                 :          0 : rtl::OUString SwEditWin::GetSurroundingText() const
    5833                 :            : {
    5834         [ #  # ]:          0 :     String sReturn;
    5835                 :          0 :     SwWrtShell& rSh = rView.GetWrtShell();
    5836 [ #  # ][ #  # ]:          0 :     if( rSh.HasSelection() && !rSh.IsMultiSelection() && rSh.IsSelOnePara() )
         [ #  # ][ #  # ]
                 [ #  # ]
    5837         [ #  # ]:          0 :         rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR  );
    5838 [ #  # ][ #  # ]:          0 :     else if( !rSh.HasSelection() )
    5839                 :            :     {
    5840         [ #  # ]:          0 :         SwPosition *pPos = rSh.GetCrsr()->GetPoint();
    5841                 :          0 :         xub_StrLen nPos = pPos->nContent.GetIndex();
    5842                 :            : 
    5843                 :            :         // get the sentence around the cursor
    5844         [ #  # ]:          0 :         rSh.HideCrsr();
    5845         [ #  # ]:          0 :         rSh.GoStartSentence();
    5846         [ #  # ]:          0 :         rSh.SetMark();
    5847         [ #  # ]:          0 :         rSh.GoEndSentence();
    5848         [ #  # ]:          0 :         rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR  );
    5849                 :            : 
    5850         [ #  # ]:          0 :         pPos->nContent = nPos;
    5851         [ #  # ]:          0 :         rSh.ClearMark();
    5852         [ #  # ]:          0 :         rSh.HideCrsr();
    5853                 :            :     }
    5854                 :            : 
    5855 [ #  # ][ #  # ]:          0 :     return sReturn;
    5856                 :            : }
    5857                 :            : 
    5858                 :          0 : Selection SwEditWin::GetSurroundingTextSelection() const
    5859                 :            : {
    5860                 :          0 :     SwWrtShell& rSh = rView.GetWrtShell();
    5861         [ #  # ]:          0 :     if( rSh.HasSelection() )
    5862                 :            :     {
    5863         [ #  # ]:          0 :         String sReturn;
    5864         [ #  # ]:          0 :         rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR  );
    5865         [ #  # ]:          0 :         return Selection( 0, sReturn.Len() );
    5866                 :            :     }
    5867                 :            :     else
    5868                 :            :     {
    5869                 :            :         // Return the position of the visible cursor in the sentence
    5870                 :            :         // around the visible cursor.
    5871                 :          0 :         SwPosition *pPos = rSh.GetCrsr()->GetPoint();
    5872                 :          0 :         xub_StrLen nPos = pPos->nContent.GetIndex();
    5873                 :            : 
    5874                 :          0 :         rSh.HideCrsr();
    5875                 :          0 :         rSh.GoStartSentence();
    5876                 :          0 :         xub_StrLen nStartPos = rSh.GetCrsr()->GetPoint()->nContent.GetIndex();
    5877                 :            : 
    5878                 :          0 :         pPos->nContent = nPos;
    5879                 :          0 :         rSh.ClearMark();
    5880                 :          0 :         rSh.ShowCrsr();
    5881                 :            : 
    5882                 :          0 :         return Selection( nPos - nStartPos, nPos - nStartPos );
    5883                 :            :     }
    5884 [ +  - ][ +  - ]:        219 : }
    5885                 :            : 
    5886                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10