LCOV - code coverage report
Current view: top level - sd/source/ui/func - fuoltext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 84 0.0 %
Date: 2012-08-25 Functions: 0 17 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 96 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "fuoltext.hxx"
      30                 :            : 
      31                 :            : #include <sfx2/viewfrm.hxx>
      32                 :            : #include <editeng/outliner.hxx>
      33                 :            : #include <editeng/eeitem.hxx>
      34                 :            : #include <editeng/flditem.hxx>
      35                 :            : #include <sfx2/bindings.hxx>
      36                 :            : #include <sfx2/docfile.hxx>
      37                 :            : #include <sfx2/dispatch.hxx>
      38                 :            : 
      39                 :            : #include <svx/svxids.hrc>
      40                 :            : #include "app.hrc"
      41                 :            : #include "OutlineView.hxx"
      42                 :            : #include "Window.hxx"
      43                 :            : #include "DrawDocShell.hxx"
      44                 :            : #include "ViewShell.hxx"
      45                 :            : #include "OutlineViewShell.hxx"
      46                 :            : 
      47                 :            : #include <stdio.h>          // Fuer SlotFilter-Listing
      48                 :            : 
      49                 :            : namespace sd {
      50                 :            : 
      51                 :            : static sal_uInt16 SidArray[] = {
      52                 :            :                 SID_STYLE_FAMILY2,
      53                 :            :                 SID_STYLE_FAMILY3,
      54                 :            :                 SID_STYLE_FAMILY5,
      55                 :            :                 SID_STYLE_UPDATE_BY_EXAMPLE,
      56                 :            :                 SID_CUT,
      57                 :            :                 SID_COPY,
      58                 :            :                 SID_PASTE,
      59                 :            :                 SID_SELECTALL,
      60                 :            :                 SID_ATTR_CHAR_FONT,
      61                 :            :                 SID_ATTR_CHAR_POSTURE,
      62                 :            :                 SID_ATTR_CHAR_WEIGHT,
      63                 :            :                 SID_ATTR_CHAR_UNDERLINE,
      64                 :            :                 SID_ATTR_CHAR_FONTHEIGHT,
      65                 :            :                 SID_ATTR_CHAR_COLOR,
      66                 :            :                 SID_OUTLINE_UP,
      67                 :            :                 SID_OUTLINE_DOWN,
      68                 :            :                 SID_OUTLINE_LEFT,
      69                 :            :                 SID_OUTLINE_RIGHT,
      70                 :            :                 //SID_OUTLINE_FORMAT,
      71                 :            :                 SID_OUTLINE_COLLAPSE_ALL,
      72                 :            :                 //SID_OUTLINE_BULLET,
      73                 :            :                 SID_OUTLINE_COLLAPSE,
      74                 :            :                 SID_OUTLINE_EXPAND_ALL,
      75                 :            :                 SID_OUTLINE_EXPAND,
      76                 :            :                 SID_SET_SUPER_SCRIPT,
      77                 :            :                 SID_SET_SUB_SCRIPT,
      78                 :            :                 SID_HYPERLINK_GETLINK,
      79                 :            :                 SID_PRESENTATION_TEMPLATES,
      80                 :            :                 SID_STATUS_PAGE,
      81                 :            :                 SID_STATUS_LAYOUT,
      82                 :            :                 SID_EXPAND_PAGE,
      83                 :            :                 SID_SUMMARY_PAGE,
      84                 :            :                 SID_PARASPACE_INCREASE,
      85                 :            :                 SID_PARASPACE_DECREASE,
      86                 :            :                 0 };
      87                 :            : 
      88 [ #  # ][ #  # ]:          0 : TYPEINIT1( FuOutlineText, FuOutline );
      89                 :            : 
      90                 :            : /*************************************************************************
      91                 :            : |*
      92                 :            : |* Konstruktor
      93                 :            : |*
      94                 :            : \************************************************************************/
      95                 :            : 
      96                 :          0 : FuOutlineText::FuOutlineText(ViewShell* pViewShell, ::sd::Window* pWindow,
      97                 :            :                              ::sd::View* pView, SdDrawDocument* pDoc,
      98                 :            :                              SfxRequest& rReq)
      99                 :          0 :        : FuOutline(pViewShell, pWindow, pView, pDoc, rReq)
     100                 :            : {
     101                 :          0 : }
     102                 :            : 
     103                 :          0 : FunctionReference FuOutlineText::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
     104                 :            : {
     105 [ #  # ][ #  # ]:          0 :     FunctionReference xFunc( new FuOutlineText( pViewSh, pWin, pView, pDoc, rReq ) );
     106         [ #  # ]:          0 :     xFunc->DoExecute( rReq );
     107                 :          0 :     return xFunc;
     108                 :            : }
     109                 :            : 
     110                 :            : /*************************************************************************
     111                 :            : |*
     112                 :            : |* MouseButtonDown-event
     113                 :            : |*
     114                 :            : \************************************************************************/
     115                 :            : 
     116                 :          0 : sal_Bool FuOutlineText::MouseButtonDown(const MouseEvent& rMEvt)
     117                 :            : {
     118                 :          0 :     sal_Bool bReturn = sal_False;
     119                 :            : 
     120                 :          0 :     mpWindow->GrabFocus();
     121                 :            : 
     122                 :          0 :     bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseButtonDown(rMEvt);
     123                 :            : 
     124         [ #  # ]:          0 :     if (bReturn)
     125                 :            :     {
     126                 :            :         // Attributierung der akt. Textstelle kann jetzt anders sein
     127                 :          0 :         mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
     128                 :            :     }
     129                 :            :     else
     130                 :            :     {
     131                 :          0 :         bReturn = FuOutline::MouseButtonDown(rMEvt);
     132                 :            :     }
     133                 :            : 
     134                 :          0 :     return (bReturn);
     135                 :            : }
     136                 :            : 
     137                 :            : /*************************************************************************
     138                 :            : |*
     139                 :            : |* MouseMove-event
     140                 :            : |*
     141                 :            : \************************************************************************/
     142                 :            : 
     143                 :          0 : sal_Bool FuOutlineText::MouseMove(const MouseEvent& rMEvt)
     144                 :            : {
     145                 :          0 :     sal_Bool bReturn = sal_False;
     146                 :            : 
     147                 :          0 :     bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseMove(rMEvt);
     148                 :            : 
     149         [ #  # ]:          0 :     if (!bReturn)
     150                 :            :     {
     151                 :          0 :         bReturn = FuOutline::MouseMove(rMEvt);
     152                 :            :     }
     153                 :            : 
     154                 :          0 :     return (bReturn);
     155                 :            : }
     156                 :            : 
     157                 :            : /*************************************************************************
     158                 :            : |*
     159                 :            : |* MouseButtonUp-event
     160                 :            : |*
     161                 :            : \************************************************************************/
     162                 :            : 
     163                 :          0 : sal_Bool FuOutlineText::MouseButtonUp(const MouseEvent& rMEvt)
     164                 :            : {
     165                 :          0 :     sal_Bool bReturn = sal_False;
     166                 :            : 
     167                 :          0 :     bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseButtonUp(rMEvt);
     168                 :            : 
     169         [ #  # ]:          0 :     if (bReturn)
     170                 :            :     {
     171                 :            :         // Attributierung der akt. Textstelle kann jetzt anders sein
     172                 :          0 :         mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
     173                 :            :     }
     174                 :            :     else
     175                 :            :     {
     176                 :          0 :         const SvxFieldItem* pFieldItem = pOutlineView->GetViewByWindow( mpWindow )->GetFieldUnderMousePointer();
     177         [ #  # ]:          0 :         if( pFieldItem )
     178                 :            :         {
     179                 :          0 :             const SvxFieldData* pField = pFieldItem->GetField();
     180                 :            : 
     181 [ #  # ][ #  # ]:          0 :             if( pField && pField->ISA( SvxURLField ) )
                 [ #  # ]
     182                 :            :             {
     183                 :          0 :                 bReturn = sal_True;
     184         [ #  # ]:          0 :                 mpWindow->ReleaseMouse();
     185 [ #  # ][ #  # ]:          0 :                 SfxStringItem aStrItem( SID_FILE_NAME, ( (SvxURLField*) pField)->GetURL() );
                 [ #  # ]
     186 [ #  # ][ #  # ]:          0 :                 SfxStringItem aReferer( SID_REFERER, mpDocSh->GetMedium()->GetName() );
         [ #  # ][ #  # ]
     187         [ #  # ]:          0 :                 SfxBoolItem aBrowseItem( SID_BROWSE, sal_True );
     188         [ #  # ]:          0 :                 SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
     189                 :            : 
     190         [ #  # ]:          0 :                 if ( rMEvt.IsMod1() )
     191                 :            :                 {
     192                 :            :                     // Im neuen Frame oeffnen
     193                 :            :                     pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
     194         [ #  # ]:          0 :                                 &aStrItem, &aBrowseItem, &aReferer, 0L);
     195                 :            :                 }
     196                 :            :                 else
     197                 :            :                 {
     198                 :            :                     // Im aktuellen Frame oeffnen
     199         [ #  # ]:          0 :                     SfxFrameItem aFrameItem( SID_DOCFRAME, pFrame );
     200                 :            :                     pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
     201 [ #  # ][ #  # ]:          0 :                                 &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
     202 [ #  # ][ #  # ]:          0 :                 }
                 [ #  # ]
     203                 :            :             }
     204                 :            :         }
     205                 :            :     }
     206                 :            : 
     207         [ #  # ]:          0 :     if( !bReturn )
     208                 :          0 :         bReturn = FuOutline::MouseButtonUp(rMEvt);
     209                 :            : 
     210                 :          0 :     return (bReturn);
     211                 :            : }
     212                 :            : 
     213                 :            : /*************************************************************************
     214                 :            : |*
     215                 :            : |* Tastaturereignisse bearbeiten
     216                 :            : |*
     217                 :            : |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
     218                 :            : |* sal_False.
     219                 :            : |*
     220                 :            : \************************************************************************/
     221                 :            : 
     222                 :          0 : sal_Bool FuOutlineText::KeyInput(const KeyEvent& rKEvt)
     223                 :            : {
     224                 :          0 :     sal_Bool bReturn = sal_False;
     225                 :            : 
     226                 :          0 :     sal_uInt16 nKeyGroup = rKEvt.GetKeyCode().GetGroup();
     227 [ #  # ][ #  # ]:          0 :     if( !mpDocSh->IsReadOnly() || nKeyGroup == KEYGROUP_CURSOR )
                 [ #  # ]
     228                 :            :     {
     229         [ #  # ]:          0 :         mpWindow->GrabFocus();
     230                 :            : 
     231                 :          0 :         boost::scoped_ptr< OutlineViewModelChangeGuard > aGuard;
     232 [ #  # ][ #  # ]:          0 :         if( (nKeyGroup != KEYGROUP_CURSOR) && (nKeyGroup != KEYGROUP_FKEYS) )
     233 [ #  # ][ #  # ]:          0 :             aGuard.reset( new OutlineViewModelChangeGuard( *pOutlineView ) );
                 [ #  # ]
     234                 :            : 
     235 [ #  # ][ #  # ]:          0 :         bReturn = pOutlineView->GetViewByWindow(mpWindow)->PostKeyEvent(rKEvt);
     236                 :            : 
     237         [ #  # ]:          0 :         if (bReturn)
     238                 :            :         {
     239         [ #  # ]:          0 :             UpdateForKeyPress (rKEvt);
     240                 :            :         }
     241                 :            :         else
     242                 :            :         {
     243         [ #  # ]:          0 :             bReturn = FuOutline::KeyInput(rKEvt);
     244         [ #  # ]:          0 :         }
     245                 :            :     }
     246                 :            : 
     247                 :          0 :     return (bReturn);
     248                 :            : }
     249                 :            : 
     250                 :          0 : void FuOutlineText::UpdateForKeyPress (const KeyEvent& rEvent)
     251                 :            : {
     252                 :            :     // Attributes at the current text position may have changed.
     253                 :          0 :     mpViewShell->GetViewFrame()->GetBindings().Invalidate(SidArray);
     254                 :            : 
     255                 :          0 :     bool bUpdatePreview = true;
     256         [ #  # ]:          0 :     switch (rEvent.GetKeyCode().GetCode())
     257                 :            :     {
     258                 :            :         // When just the cursor has been moved the preview only changes when
     259                 :            :         // it moved to entries of another page.  To prevent unnecessary
     260                 :            :         // updates we check this here.  This is an early rejection test, so
     261                 :            :         // missing a key is not a problem.
     262                 :            :         case KEY_UP:
     263                 :            :         case KEY_DOWN:
     264                 :            :         case KEY_LEFT:
     265                 :            :         case KEY_RIGHT:
     266                 :            :         case KEY_HOME:
     267                 :            :         case KEY_END:
     268                 :            :         case KEY_PAGEUP:
     269                 :            :         case KEY_PAGEDOWN:
     270                 :            :         {
     271                 :          0 :             SdPage* pCurrentPage = pOutlineViewShell->GetActualPage();
     272                 :          0 :             bUpdatePreview = (pCurrentPage != pOutlineViewShell->GetActualPage());
     273                 :            :         }
     274                 :          0 :         break;
     275                 :            :     }
     276         [ #  # ]:          0 :     if (bUpdatePreview)
     277                 :          0 :         pOutlineViewShell->UpdatePreview (pOutlineViewShell->GetActualPage());
     278                 :          0 : }
     279                 :            : 
     280                 :            : 
     281                 :            : 
     282                 :            : 
     283                 :            : /*************************************************************************
     284                 :            : |*
     285                 :            : |* Function aktivieren
     286                 :            : |*
     287                 :            : \************************************************************************/
     288                 :            : 
     289                 :          0 : void FuOutlineText::Activate()
     290                 :            : {
     291                 :          0 :     FuOutline::Activate();
     292                 :          0 : }
     293                 :            : 
     294                 :            : /*************************************************************************
     295                 :            : |*
     296                 :            : |* Function deaktivieren
     297                 :            : |*
     298                 :            : \************************************************************************/
     299                 :            : 
     300                 :          0 : void FuOutlineText::Deactivate()
     301                 :            : {
     302                 :          0 :     FuOutline::Deactivate();
     303                 :          0 : }
     304                 :            : 
     305                 :            : /*************************************************************************
     306                 :            : |*
     307                 :            : |* Cut object to clipboard
     308                 :            : |*
     309                 :            : \************************************************************************/
     310                 :            : 
     311                 :          0 : void FuOutlineText::DoCut()
     312                 :            : {
     313                 :          0 :     pOutlineView->GetViewByWindow(mpWindow)->Cut();
     314                 :          0 : }
     315                 :            : 
     316                 :            : /*************************************************************************
     317                 :            : |*
     318                 :            : |* Copy object to clipboard
     319                 :            : |*
     320                 :            : \************************************************************************/
     321                 :            : 
     322                 :          0 : void FuOutlineText::DoCopy()
     323                 :            : {
     324                 :          0 :     pOutlineView->GetViewByWindow(mpWindow)->Copy();
     325                 :          0 : }
     326                 :            : 
     327                 :            : /*************************************************************************
     328                 :            : |*
     329                 :            : |* Paste object from clipboard
     330                 :            : |*
     331                 :            : \************************************************************************/
     332                 :            : 
     333                 :          0 : void FuOutlineText::DoPaste()
     334                 :            : {
     335                 :          0 :     pOutlineView->GetViewByWindow(mpWindow)->PasteSpecial();
     336                 :          0 : }
     337                 :            : 
     338                 :            : 
     339                 :            : } // end of namespace sd
     340                 :            : 
     341                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10