LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/func - fuoltext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 81 0.0 %
Date: 2012-12-27 Functions: 0 17 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10