LCOV - code coverage report
Current view: top level - sd/source/ui/annotations - annotationwindow.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 394 0.0 %
Date: 2012-08-25 Functions: 0 43 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 787 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                 :            : 
      30                 :            : #include <editeng/fontitem.hxx>
      31                 :            : #include <editeng/eeitem.hxx>
      32                 :            : #include <editeng/fhgtitem.hxx>
      33                 :            : #include <editeng/bulitem.hxx>
      34                 :            : #include <editeng/udlnitem.hxx>
      35                 :            : #include <editeng/shdditem.hxx>
      36                 :            : #include <editeng/flditem.hxx>
      37                 :            : #include <editeng/frmdir.hxx>
      38                 :            : #include <editeng/frmdiritem.hxx>
      39                 :            : #include <editeng/langitem.hxx>
      40                 :            : #include <editeng/adjitem.hxx>
      41                 :            : #include <editeng/editview.hxx>
      42                 :            : #include <svx/svdview.hxx>
      43                 :            : #include <svx/sdrpaintwindow.hxx>
      44                 :            : #include <svx/sdr/overlay/overlaymanager.hxx>
      45                 :            : #include <editeng/editstat.hxx> //EditEngine flags
      46                 :            : #include <editeng/outliner.hxx>
      47                 :            : #include <editeng/editeng.hxx>
      48                 :            : #include <editeng/editobj.hxx>
      49                 :            : #include <editeng/unolingu.hxx>
      50                 :            : #include <editeng/outlobj.hxx>
      51                 :            : #include <editeng/postitem.hxx>
      52                 :            : #include <editeng/wghtitem.hxx>
      53                 :            : #include <editeng/crsditem.hxx>
      54                 :            : #include <svx/svxids.hrc>
      55                 :            : #include <svtools/langtab.hxx>
      56                 :            : #include <svl/slstitm.hxx>
      57                 :            : #include <unotools/securityoptions.hxx>
      58                 :            : #include <unotools/useroptions.hxx>
      59                 :            : #include <svl/languageoptions.hxx>
      60                 :            : #include <svl/zforlist.hxx>
      61                 :            : #include <svtools/svmedit.hxx>
      62                 :            : 
      63                 :            : #include <linguistic/lngprops.hxx>
      64                 :            : 
      65                 :            : #include <sfx2/request.hxx>
      66                 :            : #include <sfx2/viewfrm.hxx>
      67                 :            : #include <sfx2/bindings.hxx>
      68                 :            : #include <sfx2/dispatch.hxx>
      69                 :            : #include <sfx2/mnumgr.hxx>
      70                 :            : 
      71                 :            : #include <vcl/vclenum.hxx>
      72                 :            : #include <vcl/edit.hxx>
      73                 :            : #include <vcl/help.hxx>
      74                 :            : #include <vcl/scrbar.hxx>
      75                 :            : #include <vcl/button.hxx>
      76                 :            : #include <vcl/svapp.hxx>
      77                 :            : #include <vcl/gradient.hxx>
      78                 :            : #include <vcl/cursor.hxx>
      79                 :            : #include <tools/helpers.hxx>
      80                 :            : 
      81                 :            : #include <basegfx/matrix/b2dhommatrix.hxx>
      82                 :            : #include <basegfx/tuple/b2dtuple.hxx>
      83                 :            : #include <basegfx/polygon/b2dpolygontools.hxx>
      84                 :            : 
      85                 :            : #include "annotations.hrc"
      86                 :            : #include "annotationwindow.hxx"
      87                 :            : #include "annotationmanagerimpl.hxx"
      88                 :            : 
      89                 :            : #include "DrawDocShell.hxx"
      90                 :            : #include "ViewShell.hxx"
      91                 :            : #include "drawdoc.hxx"
      92                 :            : #include "View.hxx"
      93                 :            : #include "textapi.hxx"
      94                 :            : #include "sdresid.hxx"
      95                 :            : 
      96                 :            : using rtl::OUString;
      97                 :            : using namespace ::sd;
      98                 :            : using namespace ::com::sun::star;
      99                 :            : using namespace ::com::sun::star::uno;
     100                 :            : using namespace ::com::sun::star::office;
     101                 :            : using namespace ::com::sun::star::text;
     102                 :            : 
     103                 :            : #define METABUTTON_WIDTH        16
     104                 :            : #define METABUTTON_HEIGHT       18
     105                 :            : #define METABUTTON_AREA_WIDTH   30
     106                 :            : #define POSTIT_META_HEIGHT  (sal_Int32)     30
     107                 :            : 
     108                 :            : namespace sd {
     109                 :            : 
     110                 :            : extern OUString getAnnotationDateTimeString( const Reference< XAnnotation >& xAnnotation );
     111                 :            : extern SfxItemPool* GetAnnotationPool();
     112                 :            : extern com::sun::star::util::DateTime getCurrentDateTime();
     113                 :            : 
     114                 :          0 : Color ColorFromAlphaColor(sal_uInt8 aTransparency, Color &aFront, Color &aBack )
     115                 :            : {
     116                 :          0 :     return Color((sal_uInt8)(aFront.GetRed()    * aTransparency/(double)255 + aBack.GetRed()    * (1-aTransparency/(double)255)),
     117                 :          0 :                  (sal_uInt8)(aFront.GetGreen()  * aTransparency/(double)255 + aBack.GetGreen()  * (1-aTransparency/(double)255)),
     118                 :          0 :                  (sal_uInt8)(aFront.GetBlue()   * aTransparency/(double)255 + aBack.GetBlue()   * (1-aTransparency/(double)255)));
     119                 :            : }
     120                 :            : 
     121                 :            : /************ AnnotationTextWindow **********************************/
     122                 :            : 
     123                 :          0 : AnnotationTextWindow::AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits )
     124                 :            : : Control(pParent, nBits)
     125                 :            : , mpOutlinerView(0)
     126                 :          0 : , mpAnnotationWindow( pParent )
     127                 :            : {
     128                 :          0 : }
     129                 :            : 
     130                 :          0 : AnnotationTextWindow::~AnnotationTextWindow()
     131                 :            : {
     132         [ #  # ]:          0 : }
     133                 :            : 
     134                 :          0 : void AnnotationTextWindow::Paint( const Rectangle& rRect)
     135                 :            : {
     136                 :          0 :     const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
     137         [ #  # ]:          0 :     if ( !bHighContrast )
     138                 :            :     {
     139         [ #  # ]:          0 :         DrawGradient(Rectangle(Point(0,0),PixelToLogic(GetSizePixel())),
     140 [ #  # ][ #  # ]:          0 :             Gradient(GradientStyle_LINEAR,mpAnnotationWindow->maColorLight,mpAnnotationWindow->maColor));
                 [ #  # ]
     141                 :            :      }
     142                 :            : 
     143         [ #  # ]:          0 :     if( mpOutlinerView )
     144                 :            :     {
     145                 :          0 :         Color aBackgroundColor( mpAnnotationWindow->maColor );
     146         [ #  # ]:          0 :         if( bHighContrast )
     147                 :            :         {
     148                 :          0 :             aBackgroundColor = GetSettings().GetStyleSettings().GetWindowColor();
     149                 :            :         }
     150                 :            : 
     151         [ #  # ]:          0 :         mpOutlinerView->SetBackgroundColor( aBackgroundColor );
     152                 :            : 
     153         [ #  # ]:          0 :         mpOutlinerView->Paint( rRect );
     154                 :            :     }
     155                 :          0 : }
     156                 :            : 
     157                 :          0 : void AnnotationTextWindow::KeyInput( const KeyEvent& rKeyEvt )
     158                 :            : {
     159                 :          0 :     const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
     160                 :          0 :     sal_uInt16 nKey = rKeyCode.GetCode();
     161                 :            : 
     162 [ #  # ][ #  # ]:          0 :     if ((rKeyCode.IsMod1() && rKeyCode.IsMod2()) && ((nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN)))
         [ #  # ][ #  # ]
                 [ #  # ]
     163                 :            :     {
     164                 :          0 :         SfxDispatcher* pDispatcher = mpAnnotationWindow->DocShell()->GetViewShell()->GetViewFrame()->GetDispatcher();
     165         [ #  # ]:          0 :         if( pDispatcher )
     166         [ #  # ]:          0 :             pDispatcher->Execute( nKey == KEY_PAGEDOWN ? SID_NEXT_POSTIT : SID_PREVIOUS_POSTIT );
     167                 :            :     }
     168         [ #  # ]:          0 :     else if (nKey == KEY_INSERT)
     169                 :            :     {
     170 [ #  # ][ #  # ]:          0 :         if (!rKeyCode.IsMod1() && !rKeyCode.IsMod2())
                 [ #  # ]
     171                 :          0 :             mpAnnotationWindow->ToggleInsMode();
     172                 :            :     }
     173                 :            :     else
     174                 :            :     {
     175                 :          0 :         long aOldHeight = mpAnnotationWindow->GetPostItTextHeight();
     176                 :          0 :         bool bDone = false;
     177                 :            : 
     178                 :            :         /// HACK: need to switch off processing of Undo/Redo in Outliner
     179 [ #  # ][ #  # ]:          0 :         if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) )
         [ #  # ][ #  # ]
     180                 :            :         {
     181                 :          0 :             bool bIsProtected = mpAnnotationWindow->IsProtected();
     182 [ #  # ][ #  # ]:          0 :             if (!bIsProtected || (bIsProtected && !mpAnnotationWindow->Engine()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) )
         [ #  # ][ #  # ]
     183                 :            : 
     184                 :          0 :             bDone = mpOutlinerView->PostKeyEvent( rKeyEvt );
     185                 :            :         }
     186         [ #  # ]:          0 :         if (bDone)
     187                 :            :         {
     188                 :          0 :             mpAnnotationWindow->ResizeIfNeccessary(aOldHeight,mpAnnotationWindow->GetPostItTextHeight());
     189                 :            :         }
     190                 :            :         else
     191                 :            :         {
     192                 :          0 :             Control::KeyInput(rKeyEvt);
     193                 :            :         }
     194                 :            :     }
     195                 :          0 : }
     196                 :            : 
     197                 :          0 : void AnnotationTextWindow::MouseMove( const MouseEvent& rMEvt )
     198                 :            : {
     199         [ #  # ]:          0 :     if ( mpOutlinerView )
     200                 :            :     {
     201                 :          0 :         mpOutlinerView->MouseMove( rMEvt );
     202         [ #  # ]:          0 :         SetPointer( mpOutlinerView->GetPointer( rMEvt.GetPosPixel() ) );
     203                 :            :     }
     204                 :          0 : }
     205                 :            : 
     206                 :          0 : void AnnotationTextWindow::MouseButtonDown( const MouseEvent& rMEvt )
     207                 :            : {
     208                 :          0 :     GrabFocus();
     209         [ #  # ]:          0 :     if ( mpOutlinerView )
     210                 :          0 :         mpOutlinerView->MouseButtonDown( rMEvt );
     211                 :            :     // todo mpOutlinerView->DocView()->GetViewFrame()->GetBindings().InvalidateAll(sal_False);
     212                 :          0 : }
     213                 :            : 
     214                 :          0 : void AnnotationTextWindow::MouseButtonUp( const MouseEvent& rMEvt )
     215                 :            : {
     216         [ #  # ]:          0 :     if ( mpOutlinerView )
     217                 :          0 :         mpOutlinerView->MouseButtonUp( rMEvt );
     218                 :          0 : }
     219                 :            : 
     220                 :          0 : void AnnotationTextWindow::Command( const CommandEvent& rCEvt )
     221                 :            : {
     222         [ #  # ]:          0 :     if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
     223                 :            :     {
     224                 :          0 :            mpAnnotationWindow->Command(rCEvt);
     225                 :            :     }
     226                 :            :     else
     227                 :            :     {
     228         [ #  # ]:          0 :         if ( mpOutlinerView )
     229                 :          0 :             mpOutlinerView->Command( rCEvt );
     230                 :            :         else
     231                 :          0 :             Window::Command(rCEvt);
     232                 :            :     }
     233                 :          0 : }
     234                 :            : 
     235                 :          0 : void AnnotationTextWindow::GetFocus()
     236                 :            : {
     237                 :          0 :     Window::GetFocus();
     238                 :          0 : }
     239                 :            : 
     240                 :          0 : void AnnotationTextWindow::LoseFocus()
     241                 :            : {
     242                 :          0 :     Window::LoseFocus();
     243                 :          0 : }
     244                 :            : 
     245                 :          0 : rtl::OUString AnnotationTextWindow::GetSurroundingText() const
     246                 :            : {
     247         [ #  # ]:          0 :     if( mpOutlinerView )
     248                 :            :     {
     249                 :          0 :         EditEngine *aEditEngine = mpOutlinerView->GetEditView().GetEditEngine();
     250         [ #  # ]:          0 :         if( mpOutlinerView->HasSelection() )
     251         [ #  # ]:          0 :             return mpOutlinerView->GetSelected();
     252                 :            :         else
     253                 :            :         {
     254         [ #  # ]:          0 :             ESelection aSelection = mpOutlinerView->GetEditView().GetSelection();
     255 [ #  # ][ #  # ]:          0 :             return aEditEngine->GetText(aSelection.nStartPara);
                 [ #  # ]
     256                 :            :         }
     257                 :            :     }
     258                 :          0 :     return rtl::OUString();
     259                 :            : }
     260                 :            : 
     261                 :          0 : Selection AnnotationTextWindow::GetSurroundingTextSelection() const
     262                 :            : {
     263         [ #  # ]:          0 :     if( mpOutlinerView )
     264                 :            :     {
     265         [ #  # ]:          0 :         if( mpOutlinerView->HasSelection() )
     266                 :          0 :             return Selection( 0, mpOutlinerView->GetSelected().Len() );
     267                 :            :         else
     268                 :            :         {
     269         [ #  # ]:          0 :             ESelection aSelection = mpOutlinerView->GetEditView().GetSelection();
     270                 :          0 :             return Selection( aSelection.nStartPos, aSelection.nEndPos );
     271                 :            :         }
     272                 :            :     }
     273                 :            :     else
     274                 :          0 :         return Selection( 0, 0 );
     275                 :            : }
     276                 :            : 
     277                 :            : /************** AnnotationWindow***********************************++*/
     278                 :            : 
     279                 :          0 : AnnotationWindow::AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, Window* pParent )
     280                 :            : : FloatingWindow(pParent, WB_SYSTEMWINDOW|WB_BORDER|WB_NEEDSFOCUS)
     281                 :            : , mrManager( rManager )
     282                 :            : , mpDocShell( pDocShell )
     283                 :          0 : , mpView( pDocShell->GetViewShell()->GetView() )
     284         [ #  # ]:          0 : , mpDoc( pDocShell->GetDoc() )
     285                 :            : , mpOutlinerView(0)
     286                 :            : , mpOutliner(0)
     287                 :            : , mpVScrollbar(0)
     288         [ #  # ]:          0 : , mbReadonly(pDocShell->IsReadOnly())
     289                 :            : , mbProtected(false)
     290                 :            : , mbMouseOverButton(false)
     291                 :            : , mpTextWindow(0)
     292 [ #  # ][ #  # ]:          0 : , mpMeta(0)
     293                 :            : {
     294                 :          0 : }
     295                 :            : 
     296         [ #  # ]:          0 : AnnotationWindow::~AnnotationWindow()
     297                 :            : {
     298 [ #  # ][ #  # ]:          0 :     delete mpMeta;
     299 [ #  # ][ #  # ]:          0 :     delete mpOutlinerView;
     300 [ #  # ][ #  # ]:          0 :     delete mpOutliner;
     301 [ #  # ][ #  # ]:          0 :     delete mpVScrollbar;
     302 [ #  # ][ #  # ]:          0 :     delete mpTextWindow;
     303         [ #  # ]:          0 : }
     304                 :            : 
     305                 :          0 : void AnnotationWindow::InitControls()
     306                 :            : {
     307                 :            :     // actual window which holds the user text
     308 [ #  # ][ #  # ]:          0 :     mpTextWindow = new AnnotationTextWindow(this, WB_NODIALOGCONTROL);
     309         [ #  # ]:          0 :     mpTextWindow->SetPointer(Pointer(POINTER_TEXT));
     310                 :            : 
     311                 :            :     // window control for author and date
     312 [ #  # ][ #  # ]:          0 :     mpMeta = new MultiLineEdit(this,0);
     313         [ #  # ]:          0 :     mpMeta->SetReadOnly();
     314 [ #  # ][ #  # ]:          0 :     mpMeta->SetRightToLeft(Application::GetSettings().GetLayoutRTL());
                 [ #  # ]
     315         [ #  # ]:          0 :     mpMeta->AlwaysDisableInput(true);
     316         [ #  # ]:          0 :     mpMeta->SetCallHandlersOnInputDisabled(true);
     317                 :            : 
     318                 :            :     // we should leave this setting alone, but for this we need a better layout algo
     319                 :            :     // with variable meta size height
     320         [ #  # ]:          0 :     AllSettings aSettings = mpMeta->GetSettings();
     321         [ #  # ]:          0 :     StyleSettings aStyleSettings = aSettings.GetStyleSettings();
     322         [ #  # ]:          0 :     Font aFont = aStyleSettings.GetFieldFont();
     323         [ #  # ]:          0 :     aFont.SetHeight(8);
     324         [ #  # ]:          0 :     aStyleSettings.SetFieldFont(aFont);
     325         [ #  # ]:          0 :     aSettings.SetStyleSettings(aStyleSettings);
     326         [ #  # ]:          0 :     mpMeta->SetSettings(aSettings);
     327                 :            : 
     328 [ #  # ][ #  # ]:          0 :     mpOutliner = new ::Outliner(GetAnnotationPool(),OUTLINERMODE_TEXTOBJECT);
                 [ #  # ]
     329         [ #  # ]:          0 :     Doc()->SetCalcFieldValueHdl( mpOutliner );
     330         [ #  # ]:          0 :     mpOutliner->SetUpdateMode( sal_True );
     331         [ #  # ]:          0 :     Rescale();
     332                 :            : 
     333                 :          0 :     OutputDevice* pDev = Doc()->GetRefDevice();
     334         [ #  # ]:          0 :     if( pDev )
     335                 :            :     {
     336         [ #  # ]:          0 :         mpOutliner->SetRefDevice( pDev );
     337                 :            :     }
     338                 :            : 
     339 [ #  # ][ #  # ]:          0 :     mpOutlinerView = new OutlinerView ( mpOutliner, mpTextWindow );
     340         [ #  # ]:          0 :     mpOutliner->InsertView(mpOutlinerView );
     341                 :          0 :     mpTextWindow->SetOutlinerView(mpOutlinerView);
     342 [ #  # ][ #  # ]:          0 :     mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) );
                 [ #  # ]
     343                 :            : 
     344                 :            :     // TODO: ??
     345 [ #  # ][ #  # ]:          0 :     EEHorizontalTextDirection aDefHoriTextDir = Application::GetSettings().GetLayoutRTL() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
                 [ #  # ]
     346         [ #  # ]:          0 :     mpOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
     347                 :            : 
     348                 :            :     //create Scrollbars
     349 [ #  # ][ #  # ]:          0 :     mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
     350         [ #  # ]:          0 :     mpVScrollbar->EnableNativeWidget(false);
     351         [ #  # ]:          0 :     mpVScrollbar->EnableRTL( false );
     352         [ #  # ]:          0 :     mpVScrollbar->SetScrollHdl(LINK(this, AnnotationWindow, ScrollHdl));
     353                 :          0 :     mpVScrollbar->EnableDrag();
     354                 :            : 
     355         [ #  # ]:          0 :     sal_uLong nCntrl = mpOutliner->GetControlWord();
     356                 :          0 :     nCntrl |= EE_CNTRL_PASTESPECIAL | EE_CNTRL_AUTOCORRECT  | EV_CNTRL_AUTOSCROLL | EE_CNTRL_NOCOLORS;
     357         [ #  # ]:          0 :     mpOutliner->SetControlWord(nCntrl);
     358                 :            : 
     359 [ #  # ][ #  # ]:          0 :     Engine()->SetModifyHdl( Link() );
     360         [ #  # ]:          0 :     Engine()->EnableUndo( sal_False );
     361                 :            : 
     362         [ #  # ]:          0 :     Engine()->ClearModifyFlag();
     363 [ #  # ][ #  # ]:          0 :     Engine()->GetUndoManager().Clear();
     364         [ #  # ]:          0 :     Engine()->EnableUndo( sal_True );
     365 [ #  # ][ #  # ]:          0 :     Engine()->SetModifyHdl( LINK( this, AnnotationWindow, ModifyHdl ) );
     366                 :            : 
     367         [ #  # ]:          0 :     Invalidate();
     368                 :            : 
     369 [ #  # ][ #  # ]:          0 :     SetLanguage(GetLanguage());
                 [ #  # ]
     370                 :            : 
     371         [ #  # ]:          0 :     mpMeta->Show();
     372         [ #  # ]:          0 :     mpVScrollbar->Show();
     373 [ #  # ][ #  # ]:          0 :     mpTextWindow->Show();
         [ #  # ][ #  # ]
     374                 :          0 : }
     375                 :            : 
     376                 :          0 : void AnnotationWindow::StartEdit()
     377                 :            : {
     378         [ #  # ]:          0 :     getView()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
     379                 :          0 :     getView()->ShowCursor();
     380                 :          0 : }
     381                 :            : 
     382                 :          0 : void AnnotationWindow::Rescale()
     383                 :            : {
     384         [ #  # ]:          0 :     MapMode aMode(MAP_100TH_MM);
     385         [ #  # ]:          0 :     aMode.SetOrigin( Point() );
     386         [ #  # ]:          0 :     mpOutliner->SetRefMapMode( aMode );
     387         [ #  # ]:          0 :     SetMapMode( aMode );
     388         [ #  # ]:          0 :     mpTextWindow->SetMapMode( aMode );
     389         [ #  # ]:          0 :     if ( mpMeta )
     390                 :            :     {
     391         [ #  # ]:          0 :         Font aFont( mpMeta->GetSettings().GetStyleSettings().GetFieldFont() );
     392         [ #  # ]:          0 :         sal_Int32 nHeight = aFont.GetHeight();
     393                 :          0 :         nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
     394         [ #  # ]:          0 :         aFont.SetHeight( nHeight );
     395 [ #  # ][ #  # ]:          0 :         mpMeta->SetControlFont( aFont );
     396         [ #  # ]:          0 :     }
     397                 :          0 : }
     398                 :            : 
     399                 :          0 : void AnnotationWindow::DoResize()
     400                 :            : {
     401         [ #  # ]:          0 :     unsigned long aWidth    =   GetSizePixel().Width();
     402         [ #  # ]:          0 :     long aHeight            =   GetSizePixel().Height() - POSTIT_META_HEIGHT;
     403                 :            : 
     404 [ #  # ][ #  # ]:          0 :     mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
     405 [ #  # ][ #  # ]:          0 :     long aTextHeight        =   LogicToPixel( mpOutliner->CalcTextSize()).Height();
     406                 :            : 
     407         [ #  # ]:          0 :     if( aTextHeight > aHeight )
     408                 :            :     {   // we need vertical scrollbars and have to reduce the width
     409                 :          0 :         aWidth -= GetScrollbarWidth();
     410         [ #  # ]:          0 :         mpVScrollbar->Show();
     411                 :            :     }
     412                 :            :     else
     413                 :            :     {
     414         [ #  # ]:          0 :         mpVScrollbar->Hide();
     415                 :            :     }
     416                 :            : 
     417         [ #  # ]:          0 :     mpTextWindow->SetPosSizePixel(0,0,aWidth, aHeight);
     418                 :            : 
     419         [ #  # ]:          0 :     if( mbReadonly )
     420 [ #  # ][ #  # ]:          0 :         mpMeta->SetPosSizePixel(0,aHeight,GetSizePixel().Width(),POSTIT_META_HEIGHT);
     421                 :            :     else
     422 [ #  # ][ #  # ]:          0 :         mpMeta->SetPosSizePixel(0,aHeight,GetSizePixel().Width()-METABUTTON_AREA_WIDTH,POSTIT_META_HEIGHT);
     423                 :            : 
     424 [ #  # ][ #  # ]:          0 :     mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
     425 [ #  # ][ #  # ]:          0 :     mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
                 [ #  # ]
     426 [ #  # ][ #  # ]:          0 :     if (!mpVScrollbar->IsVisible())
     427                 :            :     {   // if we do not have a scrollbar anymore, we want to see the complete text
     428 [ #  # ][ #  # ]:          0 :         mpOutlinerView->SetVisArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
                 [ #  # ]
     429                 :            :     }
     430         [ #  # ]:          0 :     mpVScrollbar->SetPosSizePixel( 0 + aWidth, 0, GetScrollbarWidth(), aHeight );
     431 [ #  # ][ #  # ]:          0 :     mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() );
     432         [ #  # ]:          0 :     mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 );
     433         [ #  # ]:          0 :     mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 );
     434         [ #  # ]:          0 :     SetScrollbar();
     435 [ #  # ][ #  # ]:          0 :     mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight()));
     436                 :            : 
     437         [ #  # ]:          0 :     Point aPos( mpMeta->GetPosPixel());
     438         [ #  # ]:          0 :     Point aBase( aPos.X() + aPos.X() + GetSizePixel().Width(), aPos.Y() );
     439         [ #  # ]:          0 :     Point aLeft = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH+5), aBase.Y()+17 ) );
     440         [ #  # ]:          0 :     Point aRight = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH-1), aBase.Y()+17 ) );
     441         [ #  # ]:          0 :     Point aBottom = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH+2), aBase.Y()+20 ) );
     442                 :            : 
     443         [ #  # ]:          0 :     maPopupTriangle.clear();
     444         [ #  # ]:          0 :     maPopupTriangle.append(basegfx::B2DPoint(aLeft.X(),aLeft.Y()));
     445         [ #  # ]:          0 :     maPopupTriangle.append(basegfx::B2DPoint(aRight.X(),aRight.Y()));
     446         [ #  # ]:          0 :     maPopupTriangle.append(basegfx::B2DPoint(aBottom.X(),aBottom.Y()));
     447         [ #  # ]:          0 :     maPopupTriangle.setClosed(true);
     448                 :            :     maRectMetaButton = PixelToLogic( Rectangle( Point(
     449         [ #  # ]:          0 :             aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10),
     450                 :          0 :             aPos.Y()+5 ),
     451 [ #  # ][ #  # ]:          0 :             Size( METABUTTON_WIDTH, METABUTTON_HEIGHT ) ) );
     452                 :            : 
     453                 :          0 : }
     454                 :            : 
     455                 :          0 : void AnnotationWindow::SetSizePixel( const Size& rNewSize )
     456                 :            : {
     457                 :          0 :     Window::SetSizePixel(rNewSize);
     458                 :          0 : }
     459                 :            : 
     460                 :          0 : void AnnotationWindow::SetScrollbar()
     461                 :            : {
     462 [ #  # ][ #  # ]:          0 :     mpVScrollbar->SetThumbPos( mpOutlinerView->GetVisArea().Top()+ mpOutlinerView->GetEditView().GetCursor()->GetOffsetY());
     463                 :          0 : }
     464                 :            : 
     465                 :          0 : void AnnotationWindow::ResizeIfNeccessary(long aOldHeight, long aNewHeight)
     466                 :            : {
     467         [ #  # ]:          0 :     if (aOldHeight != aNewHeight)
     468                 :            :     {
     469                 :          0 :         DoResize();
     470                 :          0 :         Invalidate();
     471                 :            :     }
     472                 :            :     else
     473                 :            :     {
     474                 :          0 :         SetScrollbar();
     475                 :            :     }
     476                 :          0 : }
     477                 :            : 
     478                 :          0 : void AnnotationWindow::SetLanguage(const SvxLanguageItem &aNewItem)
     479                 :            : {
     480 [ #  # ][ #  # ]:          0 :     Engine()->SetModifyHdl( Link() );
     481         [ #  # ]:          0 :     ESelection aOld = getView()->GetSelection();
     482                 :            : 
     483         [ #  # ]:          0 :     ESelection aNewSelection( 0, 0, (sal_uInt16)Engine()->GetParagraphCount()-1, USHRT_MAX );
     484         [ #  # ]:          0 :     getView()->SetSelection( aNewSelection );
     485         [ #  # ]:          0 :     SfxItemSet aEditAttr(getView()->GetAttribs());
     486         [ #  # ]:          0 :     aEditAttr.Put(aNewItem);
     487         [ #  # ]:          0 :     getView()->SetAttribs( aEditAttr );
     488                 :            : 
     489         [ #  # ]:          0 :     getView()->SetSelection(aOld);
     490 [ #  # ][ #  # ]:          0 :     Engine()->SetModifyHdl( LINK( this, AnnotationWindow, ModifyHdl ) );
     491                 :            : 
     492 [ #  # ][ #  # ]:          0 :     Invalidate();
     493                 :          0 : }
     494                 :            : 
     495                 :          0 : void AnnotationWindow::ToggleInsMode()
     496                 :            : {
     497         [ #  # ]:          0 :     if( mpOutlinerView )
     498                 :            :     {
     499                 :          0 :         SfxBindings &rBnd = mpDocShell->GetViewShell()->GetViewFrame()->GetBindings();
     500                 :          0 :         rBnd.Invalidate(SID_ATTR_INSERT);
     501                 :          0 :         rBnd.Update(SID_ATTR_INSERT);
     502                 :            :     }
     503                 :          0 : }
     504                 :            : 
     505                 :          0 : long AnnotationWindow::GetPostItTextHeight()
     506                 :            : {
     507 [ #  # ][ #  # ]:          0 :     return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     508                 :            : }
     509                 :            : 
     510                 :          0 : IMPL_LINK(AnnotationWindow, ScrollHdl, ScrollBar*, pScroll)
     511                 :            : {
     512                 :          0 :     long nDiff = getView()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos();
     513                 :          0 :     getView()->Scroll( 0, nDiff );
     514                 :          0 :     return 0;
     515                 :            : }
     516                 :            : 
     517                 :          0 : IMPL_LINK_NOARG(AnnotationWindow, ModifyHdl)
     518                 :            : {
     519                 :          0 :     return 0;
     520                 :            : }
     521                 :            : 
     522                 :          0 : sal_Int32 AnnotationWindow::GetScrollbarWidth()
     523                 :            : {
     524                 :          0 :     return 16;
     525                 :            : }
     526                 :            : 
     527                 :          0 : SvxLanguageItem AnnotationWindow::GetLanguage(void)
     528                 :            : {
     529                 :          0 :     return SvxLanguageItem( Doc()->GetLanguage( EE_CHAR_LANGUAGE ), SID_ATTR_LANGUAGE );
     530                 :            : }
     531                 :            : 
     532                 :            : // --------------------------------------------------------------------
     533                 :            : 
     534                 :          0 : TextApiObject* getTextApiObject( const Reference< XAnnotation >& xAnnotation )
     535                 :            : {
     536         [ #  # ]:          0 :     if( xAnnotation.is() )
     537                 :            :     {
     538 [ #  # ][ #  # ]:          0 :         Reference< XText > xText( xAnnotation->getTextRange() );
     539         [ #  # ]:          0 :         return TextApiObject::getImplementation( xText );
     540                 :            :     }
     541                 :          0 :     return 0;
     542                 :            : }
     543                 :            : 
     544                 :            : // --------------------------------------------------------------------
     545                 :            : 
     546                 :          0 : void AnnotationWindow::setAnnotation( const Reference< XAnnotation >& xAnnotation, bool bGrabFocus )
     547                 :            : {
     548 [ #  # ][ #  # ]:          0 :     if( (xAnnotation != mxAnnotation) && xAnnotation.is() )
                 [ #  # ]
     549                 :            :     {
     550         [ #  # ]:          0 :         mxAnnotation = xAnnotation;
     551                 :            : 
     552         [ #  # ]:          0 :         SetColor();
     553                 :            : 
     554         [ #  # ]:          0 :         SvtUserOptions aUserOptions;
     555 [ #  # ][ #  # ]:          0 :         mbProtected = aUserOptions.GetFullName() != xAnnotation->getAuthor();
                 [ #  # ]
     556                 :            : 
     557         [ #  # ]:          0 :         Engine()->Clear();
     558         [ #  # ]:          0 :         TextApiObject* pTextApi = getTextApiObject( mxAnnotation );
     559                 :            : 
     560         [ #  # ]:          0 :         if( pTextApi )
     561                 :            :         {
     562         [ #  # ]:          0 :             std::auto_ptr< OutlinerParaObject > pOPO( pTextApi->CreateText() );
     563 [ #  # ][ #  # ]:          0 :             Engine()->SetText( *pOPO.get() );
     564                 :            :         }
     565                 :            : 
     566 [ #  # ][ #  # ]:          0 :         Engine()->SetModifyHdl( LINK( this, AnnotationWindow, ModifyHdl ) );
     567         [ #  # ]:          0 :         Engine()->ClearModifyFlag();
     568 [ #  # ][ #  # ]:          0 :         Engine()->GetUndoManager().Clear();
     569                 :            : 
     570         [ #  # ]:          0 :         Invalidate();
     571                 :            : 
     572 [ #  # ][ #  # ]:          0 :         OUString sMeta( xAnnotation->getAuthor() );
     573         [ #  # ]:          0 :         OUString sDateTime( getAnnotationDateTimeString(xAnnotation) );
     574                 :            : 
     575         [ #  # ]:          0 :         if( !sDateTime.isEmpty() )
     576                 :            :         {
     577         [ #  # ]:          0 :             if( !sMeta.isEmpty() )
     578                 :          0 :                 sMeta += "\n";
     579                 :            : 
     580                 :          0 :            sMeta += sDateTime;
     581                 :            :         }
     582 [ #  # ][ #  # ]:          0 :         mpMeta->SetText(sMeta);
                 [ #  # ]
     583                 :            : 
     584         [ #  # ]:          0 :         if( bGrabFocus )
     585 [ #  # ][ #  # ]:          0 :             GrabFocus();
     586                 :            :     }
     587                 :          0 : }
     588                 :            : 
     589                 :          0 : void AnnotationWindow::SetColor()
     590                 :            : {
     591 [ #  # ][ #  # ]:          0 :     sal_uInt16 nAuthorIdx = mpDoc->GetAnnotationAuthorIndex( mxAnnotation->getAuthor() );
                 [ #  # ]
     592                 :            : 
     593         [ #  # ]:          0 :     const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
     594         [ #  # ]:          0 :     if( bHighContrast )
     595                 :            :     {
     596         [ #  # ]:          0 :         StyleSettings aStyleSettings = GetSettings().GetStyleSettings();
     597                 :            : 
     598                 :          0 :         maColor = aStyleSettings.GetWindowColor();
     599                 :          0 :         maColorDark = maColor;
     600         [ #  # ]:          0 :         maColorLight = aStyleSettings.GetWindowTextColor();
     601                 :            :     }
     602                 :            :     else
     603                 :            :     {
     604         [ #  # ]:          0 :         maColor = mrManager.GetColor( nAuthorIdx );
     605         [ #  # ]:          0 :         maColorDark = mrManager.GetColorDark( nAuthorIdx );
     606         [ #  # ]:          0 :         maColorLight = mrManager.GetColorLight( nAuthorIdx );
     607                 :            :     }
     608                 :            : 
     609         [ #  # ]:          0 :     mpOutlinerView->SetBackgroundColor(maColor);
     610         [ #  # ]:          0 :     Engine()->SetBackgroundColor(maColor);
     611                 :            : 
     612                 :            :     {
     613         [ #  # ]:          0 :         SvtAccessibilityOptions aOptions;
     614 [ #  # ][ #  # ]:          0 :         Engine()->ForceAutoColor( bHighContrast || aOptions.GetIsAutomaticFontColor() );
         [ #  # ][ #  # ]
                 [ #  # ]
     615                 :            :     }
     616                 :            : 
     617         [ #  # ]:          0 :     mpMeta->SetControlBackground(maColor);
     618         [ #  # ]:          0 :     AllSettings aSettings = mpMeta->GetSettings();
     619         [ #  # ]:          0 :     StyleSettings aStyleSettings = aSettings.GetStyleSettings();
     620 [ #  # ][ #  # ]:          0 :     aStyleSettings.SetFieldTextColor( bHighContrast ? maColorLight : maColorDark);
     621         [ #  # ]:          0 :     aSettings.SetStyleSettings(aStyleSettings);
     622         [ #  # ]:          0 :     mpMeta->SetSettings(aSettings);
     623                 :            : 
     624         [ #  # ]:          0 :     AllSettings aSettings2 = mpVScrollbar->GetSettings();
     625         [ #  # ]:          0 :     StyleSettings aStyleSettings2 = aSettings2.GetStyleSettings();
     626         [ #  # ]:          0 :     aStyleSettings2.SetButtonTextColor(Color(0,0,0));
     627         [ #  # ]:          0 :     aStyleSettings2.SetCheckedColor(maColorLight); //hintergund
     628         [ #  # ]:          0 :     aStyleSettings2.SetShadowColor(maColorDark);
     629         [ #  # ]:          0 :     aStyleSettings2.SetFaceColor(maColor);
     630         [ #  # ]:          0 :     aSettings2.SetStyleSettings(aStyleSettings2);
     631 [ #  # ][ #  # ]:          0 :     mpVScrollbar->SetSettings(aSettings2);
         [ #  # ][ #  # ]
                 [ #  # ]
     632                 :          0 : }
     633                 :            : 
     634                 :          0 : void AnnotationWindow::Deactivate()
     635                 :            : {
     636                 :          0 :     Reference< XAnnotation > xAnnotation( mxAnnotation );
     637                 :            : 
     638                 :            :     // write changed text back to annotation
     639 [ #  # ][ #  # ]:          0 :     if ( Engine()->IsModified() )
     640                 :            :     {
     641         [ #  # ]:          0 :         TextApiObject* pTextApi = getTextApiObject( xAnnotation );
     642                 :            : 
     643         [ #  # ]:          0 :         if( pTextApi )
     644                 :            :         {
     645         [ #  # ]:          0 :             OutlinerParaObject* pOPO = Engine()->CreateParaObject();
     646         [ #  # ]:          0 :             if( pOPO )
     647                 :            :             {
     648 [ #  # ][ #  # ]:          0 :                 if( mpDoc->IsUndoEnabled() )
     649 [ #  # ][ #  # ]:          0 :                     mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_EDIT ) ) );
         [ #  # ][ #  # ]
     650                 :            : 
     651         [ #  # ]:          0 :                 pTextApi->SetText( *pOPO );
     652 [ #  # ][ #  # ]:          0 :                 delete pOPO;
     653                 :            : 
     654                 :            :                 // set current time to changed annotation
     655 [ #  # ][ #  # ]:          0 :                 xAnnotation->setDateTime( getCurrentDateTime() );
                 [ #  # ]
     656                 :            : 
     657 [ #  # ][ #  # ]:          0 :                 if( mpDoc->IsUndoEnabled() )
     658         [ #  # ]:          0 :                     mpDoc->EndUndo();
     659                 :            : 
     660         [ #  # ]:          0 :                 DocView()->GetDocSh()->SetModified(sal_True);
     661                 :            :             }
     662                 :            : 
     663                 :            :         }
     664                 :            :     }
     665         [ #  # ]:          0 :     Engine()->ClearModifyFlag();
     666                 :            : 
     667 [ #  # ][ #  # ]:          0 :     Engine()->GetUndoManager().Clear();
     668                 :          0 : }
     669                 :            : 
     670                 :          0 : void AnnotationWindow::Paint( const Rectangle& rRect)
     671                 :            : {
     672                 :          0 :     FloatingWindow::Paint( rRect );
     673                 :            : 
     674 [ #  # ][ #  # ]:          0 :     if(mpMeta->IsVisible() && !mbReadonly)
                 [ #  # ]
     675                 :            :     {
     676                 :          0 :         const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
     677                 :            :         //draw left over space
     678         [ #  # ]:          0 :         if ( bHighContrast )
     679         [ #  # ]:          0 :             SetFillColor(COL_BLACK);
     680                 :            :         else
     681                 :          0 :             SetFillColor(maColor);
     682                 :          0 :         SetLineColor();
     683 [ #  # ][ #  # ]:          0 :         DrawRect(PixelToLogic(Rectangle(Point(mpMeta->GetPosPixel().X()+mpMeta->GetSizePixel().Width(),mpMeta->GetPosPixel().Y()),Size(METABUTTON_AREA_WIDTH,mpMeta->GetSizePixel().Height()))));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     684                 :            : 
     685         [ #  # ]:          0 :         if ( bHighContrast )
     686                 :            :         {
     687                 :            :             //draw rect around button
     688         [ #  # ]:          0 :             SetFillColor(COL_BLACK);
     689         [ #  # ]:          0 :             SetLineColor(COL_WHITE);
     690                 :            :         }
     691                 :            :         else
     692                 :            :         {
     693                 :            :             //draw button
     694         [ #  # ]:          0 :             Gradient aGradient;
     695         [ #  # ]:          0 :             if (mbMouseOverButton)
     696 [ #  # ][ #  # ]:          0 :                 aGradient = Gradient(GradientStyle_LINEAR,ColorFromAlphaColor(80,maColorDark,maColor),ColorFromAlphaColor(15,maColorDark,maColor));
                 [ #  # ]
     697                 :            :             else
     698 [ #  # ][ #  # ]:          0 :                 aGradient = Gradient(GradientStyle_LINEAR,ColorFromAlphaColor(15,maColorDark,maColor),ColorFromAlphaColor(80,maColorDark,maColor));
                 [ #  # ]
     699         [ #  # ]:          0 :             DrawGradient(maRectMetaButton,aGradient);
     700                 :            :             //draw rect around button
     701         [ #  # ]:          0 :             SetFillColor();
     702 [ #  # ][ #  # ]:          0 :             SetLineColor(ColorFromAlphaColor(90,maColorDark,maColor));
     703                 :            :         }
     704                 :          0 :         DrawRect(maRectMetaButton);
     705                 :            : 
     706                 :            :         //draw arrow
     707         [ #  # ]:          0 :         if( bHighContrast )
     708         [ #  # ]:          0 :             SetFillColor(COL_WHITE);
     709                 :            :         else
     710         [ #  # ]:          0 :             SetFillColor(COL_BLACK);
     711                 :          0 :         SetLineColor();
     712         [ #  # ]:          0 :         DrawPolygon(Polygon(maPopupTriangle));
     713                 :            :     }
     714                 :          0 : }
     715                 :            : 
     716                 :          0 : void AnnotationWindow::MouseMove( const MouseEvent& rMEvt )
     717                 :            : {
     718         [ #  # ]:          0 :     if( !mbReadonly )
     719                 :            :     {
     720 [ #  # ][ #  # ]:          0 :         if (maRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())))
     721                 :            :         {
     722         [ #  # ]:          0 :             if (!mbMouseOverButton)
     723                 :            :             {
     724                 :          0 :                 Invalidate(maRectMetaButton);
     725                 :          0 :                 mbMouseOverButton = true;
     726                 :            :             }
     727                 :            :         }
     728                 :            :         else
     729                 :            :         {
     730         [ #  # ]:          0 :             if (mbMouseOverButton)
     731                 :            :             {
     732                 :          0 :                 Invalidate(maRectMetaButton);
     733                 :          0 :                 mbMouseOverButton = false;
     734                 :            :             }
     735                 :            :         }
     736                 :            :     }
     737                 :          0 : }
     738                 :            : 
     739                 :          0 : void AnnotationWindow::MouseButtonDown( const MouseEvent& rMEvt )
     740                 :            : {
     741 [ #  # ][ #  # ]:          0 :     if (!mbReadonly && maRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())) && rMEvt.IsLeft())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     742                 :            :     {
     743                 :            :         // context menu
     744 [ #  # ][ #  # ]:          0 :         Rectangle aRect(LogicToPixel(maRectMetaButton.BottomLeft()),LogicToPixel(maRectMetaButton.BottomLeft()));
         [ #  # ][ #  # ]
                 [ #  # ]
     745         [ #  # ]:          0 :         mrManager.ExecuteAnnotationContextMenu( mxAnnotation, (::Window*)this, aRect, true );
     746                 :            :     }
     747                 :          0 : }
     748                 :            : 
     749                 :          0 : void AnnotationWindow::Command( const CommandEvent& rCEvt )
     750                 :            : {
     751         [ #  # ]:          0 :     if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
     752                 :            :     {
     753 [ #  # ][ #  # ]:          0 :         if( mpMeta->IsVisible() &&(mpMeta->GetPosPixel().Y() < rCEvt.GetMousePosPixel().Y()) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     754                 :          0 :             return;
     755 [ #  # ][ #  # ]:          0 :         mrManager.ExecuteAnnotationContextMenu( mxAnnotation, this, Rectangle(rCEvt.GetMousePosPixel(),Size(1,1)) );
     756                 :            :     }
     757                 :            :     else
     758                 :            :     {
     759                 :          0 :         FloatingWindow::Command(rCEvt);
     760                 :            :     }
     761                 :            : }
     762                 :            : 
     763                 :          0 : void AnnotationWindow::GetFocus()
     764                 :            : {
     765         [ #  # ]:          0 :     if( mpTextWindow )
     766                 :          0 :         mpTextWindow->GrabFocus();
     767                 :            :     else
     768                 :          0 :         FloatingWindow::GetFocus();
     769                 :          0 : }
     770                 :            : 
     771                 :          0 : void AnnotationWindow::ExecuteSlot( sal_uInt16 nSID )
     772                 :            : {
     773         [ #  # ]:          0 :     if( nSID == SID_COPY )
     774                 :            :     {
     775                 :          0 :         getView()->Copy();
     776                 :            :     }
     777         [ #  # ]:          0 :     else if( nSID == SID_PASTE )
     778                 :            :     {
     779                 :          0 :         getView()->PasteSpecial();
     780                 :          0 :         DoResize();
     781                 :            :     }
     782                 :            :     else
     783                 :            :     {
     784         [ #  # ]:          0 :         SfxItemSet aEditAttr(getView()->GetAttribs());
     785 [ #  # ][ #  # ]:          0 :         SfxItemSet aNewAttr(mpOutliner->GetEmptyItemSet());
     786                 :            : 
     787   [ #  #  #  #  :          0 :         switch( nSID )
                      # ]
     788                 :            :         {
     789                 :            :         case SID_ATTR_CHAR_WEIGHT:
     790                 :            :         {
     791         [ #  # ]:          0 :             FontWeight eFW = ( (const SvxWeightItem&) aEditAttr.Get( EE_CHAR_WEIGHT ) ).GetWeight();
     792 [ #  # ][ #  # ]:          0 :             aNewAttr.Put( SvxWeightItem( eFW == WEIGHT_NORMAL ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
         [ #  # ][ #  # ]
     793                 :            :         }
     794                 :          0 :         break;
     795                 :            :         case SID_ATTR_CHAR_POSTURE:
     796                 :            :         {
     797         [ #  # ]:          0 :             FontItalic eFI = ( (const SvxPostureItem&) aEditAttr.Get( EE_CHAR_ITALIC ) ).GetPosture();
     798 [ #  # ][ #  # ]:          0 :             aNewAttr.Put( SvxPostureItem( eFI == ITALIC_NORMAL ? ITALIC_NONE : ITALIC_NORMAL, EE_CHAR_ITALIC ) );
         [ #  # ][ #  # ]
     799                 :            :         }
     800                 :          0 :         break;
     801                 :            :         case SID_ATTR_CHAR_UNDERLINE:
     802                 :            :         {
     803         [ #  # ]:          0 :             FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr. Get( EE_CHAR_UNDERLINE ) ).GetLineStyle();
     804 [ #  # ][ #  # ]:          0 :             aNewAttr.Put( SvxUnderlineItem( eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) );
                 [ #  # ]
     805                 :            :         }
     806                 :          0 :         break;
     807                 :            :         case SID_ATTR_CHAR_STRIKEOUT:
     808                 :            :         {
     809         [ #  # ]:          0 :             FontStrikeout eFSO = ( ( (const SvxCrossedOutItem&) aEditAttr.Get( EE_CHAR_STRIKEOUT ) ).GetStrikeout() );
     810 [ #  # ][ #  # ]:          0 :             aNewAttr.Put( SvxCrossedOutItem( eFSO == STRIKEOUT_SINGLE ? STRIKEOUT_NONE : STRIKEOUT_SINGLE, EE_CHAR_STRIKEOUT ) );
                 [ #  # ]
     811                 :            :         }
     812                 :          0 :         break;
     813                 :            :         }
     814 [ #  # ][ #  # ]:          0 :         getView()->SetAttribs( aNewAttr );
                 [ #  # ]
     815                 :            :     }
     816                 :          0 : }
     817                 :            : 
     818                 :            : }
     819                 :            : 
     820                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10