LCOV - code coverage report
Current view: top level - sw/inc - SidebarWin.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 10 25 40.0 %
Date: 2014-04-11 Functions: 9 22 40.9 %
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             : #ifndef INCLUDED_SW_INC_SIDEBARWIN_HXX
      21             : #define INCLUDED_SW_INC_SIDEBARWIN_HXX
      22             : 
      23             : #include <postithelper.hxx>
      24             : #include <SidebarWindowsTypes.hxx>
      25             : 
      26             : #include <vcl/window.hxx>
      27             : #include <swrect.hxx>
      28             : 
      29             : #include <tools/date.hxx>
      30             : 
      31             : #include <vcl/lineinfo.hxx>
      32             : #include <basegfx/polygon/b2dpolygon.hxx>
      33             : #include <editeng/editstat.hxx>
      34             : 
      35             : class SwPostItMgr;
      36             : class SwPostItField;
      37             : class OutlinerView;
      38             : class Outliner;
      39             : class ScrollBar;
      40             : class SwEditWin;
      41             : class SwView;
      42             : class Edit;
      43             : class MenuButton;
      44             : class SwFrm;
      45             : 
      46             : namespace sw { namespace overlay {
      47             :     class OverlayRanges;
      48             : }}
      49             : 
      50             : namespace sw { namespace sidebarwindows {
      51             : 
      52             : class SidebarTxtControl;
      53             : class AnchorOverlayObject;
      54             : class ShadowOverlayObject;
      55             : 
      56             : typedef sal_Int64 SwPostItBits;
      57             : 
      58             : #define PB_Preview ((SwPostItBits)0x00000001)
      59             : 
      60             : class SwSidebarWin : public Window
      61             : {
      62             :     public:
      63             :         SwSidebarWin( SwEditWin& rEditWin,
      64             :                       WinBits nBits,
      65             :                       SwPostItMgr& aMgr,
      66             :                       SwPostItBits aBits,
      67             :                       SwSidebarItem& rSidebarItem );
      68             :         virtual ~SwSidebarWin();
      69             : 
      70             :         void SetSize( const Size& rNewSize );
      71             :         void SetPosSizePixelRect( long nX,
      72             :                                   long nY,
      73             :                                   long nWidth,
      74             :                                   long nHeight,
      75             :                                   const SwRect& aAnchorRect,
      76             :                                   const long PageBorder);
      77             :         void SetPosAndSize();
      78             :         void TranslateTopPosition(const long aAmount);
      79             :         virtual void CheckMetaText();
      80             : 
      81           0 :         inline Point GetAnchorPos() { return mAnchorRect.Pos(); }
      82             :         SwEditWin* EditWin();
      83             : 
      84         482 :         inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
      85             :         bool HasScrollbar() const;
      86             :         bool IsScrollbarVisible() const;
      87           0 :         inline ScrollBar* Scrollbar() { return mpVScrollbar; }
      88         284 :         inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
      89           0 :         inline ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
      90           0 :         inline ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay;}
      91             : 
      92             :         long            GetPostItTextHeight();
      93             : 
      94             :         void            SwitchToPostIt(sal_uInt16 aDirection);
      95             :         virtual void    SwitchToFieldPos();
      96             : 
      97             :         virtual sal_uInt32 MoveCaret() = 0;
      98             : 
      99             :         virtual void    UpdateData() = 0;
     100             :         virtual void    SetPostItText() = 0;
     101             :         virtual void    Delete();
     102             :         virtual void    GotoPos() = 0;
     103             : 
     104             :         virtual OUString GetAuthor() = 0;
     105             :         virtual Date    GetDate() = 0;
     106             :         virtual Time    GetTime() = 0;
     107             : 
     108             :         void            ExecuteCommand(sal_uInt16 nSlot);
     109             :         void            InitControls();
     110             :         void            HidePostIt();
     111             :         void            DoResize();
     112             :         void            ResizeIfNecessary(long aOldHeight, long aNewHeight);
     113             :         void            SetScrollbar();
     114             : 
     115             :         void            SetVirtualPosSize( const Point& aPoint, const Size& aSize);
     116        2304 :         const Point     VirtualPos()    { return mPosSize.TopLeft(); }
     117        1334 :         const Size      VirtualSize()   { return mPosSize.GetSize(); }
     118             : 
     119             :         void            ShowAnchorOnly(const Point &aPoint);
     120             :         void            ShowNote();
     121             :         void            HideNote();
     122             : 
     123             :         void            ResetAttributes();
     124             : 
     125             :         void            SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
     126             :         void            SetReadonly(sal_Bool bSet);
     127           0 :         sal_Bool        IsReadOnly()
     128             :         {
     129           0 :             return mbReadonly;
     130             :         }
     131         231 :         bool            IsPreview()
     132             :         {
     133         231 :             return nFlags & PB_Preview;
     134             :         }
     135             : 
     136             :         void         SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
     137           0 :         const Color& ColorAnchor() { return mColorAnchor; }
     138           0 :         const Color& ColorDark() { return mColorDark; }
     139           0 :         const Color& ColorLight() { return mColorLight; }
     140             :         void         Rescale();
     141             : 
     142             :         void            SetViewState(::sw::sidebarwindows::ViewState bViewState);
     143             : 
     144        1389 :         bool            IsFollow() { return mbIsFollow; }
     145         322 :         void            SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
     146             :         virtual bool    CalcFollow() = 0;
     147             : 
     148             :         sal_Int32   GetMetaHeight();
     149             :         sal_Int32   GetMinimumSizeWithMeta();
     150             :         sal_Int32   GetMinimumSizeWithoutMeta();
     151             :         sal_Int32   GetMetaButtonAreaWidth();
     152             :         sal_Int32   GetScrollbarWidth();
     153             : 
     154             :         void    SetSpellChecking();
     155             : 
     156             :         void    ToggleInsMode();
     157             : 
     158             :         virtual void    ActivatePostIt();
     159             :         virtual void    DeactivatePostIt();
     160             : 
     161             :         void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
     162             :                                 const Color& aColor);
     163           0 :         SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
     164           0 :         Color GetChangeColor() { return mChangeColor; }
     165             : 
     166           0 :         virtual bool IsProtected()
     167             :         {
     168           0 :             return mbReadonly;
     169             :         }
     170             : 
     171             :         DECL_LINK( WindowEventListener, VclSimpleEvent* );
     172           0 :         inline bool IsMouseOverSidebarWin() const { return mbMouseOver; }
     173             : 
     174             :         void SetLanguage(const SvxLanguageItem aNewItem);
     175             : 
     176             :         void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
     177             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
     178             : 
     179             :     protected:
     180             :         virtual void    DataChanged( const DataChangedEvent& aEvent) SAL_OVERRIDE;
     181             :         virtual void    LoseFocus() SAL_OVERRIDE;
     182             :         virtual void    Paint( const Rectangle& rRect) SAL_OVERRIDE;
     183             :         virtual void    GetFocus() SAL_OVERRIDE;
     184             :         virtual MenuButton* CreateMenuButton() = 0;
     185             : 
     186             :         void        SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE;
     187             :         SfxItemSet  DefaultItem();
     188             : 
     189             :         DECL_LINK(ModifyHdl, void*);
     190             :         DECL_LINK(ScrollHdl, ScrollBar*);
     191             :         DECL_LINK(DeleteHdl, void*);
     192             : 
     193         299 :         inline SwView& DocView() { return mrView;}
     194           0 :         inline SwPostItMgr& Mgr() { return mrMgr; }
     195         816 :         inline Outliner* Engine() { return mpOutliner;}
     196             : 
     197             :     private:
     198             :         SwSidebarWin*   GetTopReplyNote();
     199             : 
     200             :         virtual SvxLanguageItem GetLanguage(void);
     201             : 
     202             :         SwPostItMgr&    mrMgr;
     203             :         SwView&         mrView;
     204             :         const SwPostItBits nFlags;
     205             : 
     206             :         sal_uLong           mnEventId;
     207             : 
     208             :         OutlinerView*   mpOutlinerView;
     209             :         Outliner*       mpOutliner;
     210             : 
     211             :         sw::sidebarwindows::SidebarTxtControl* mpSidebarTxtControl;
     212             :         ScrollBar*      mpVScrollbar;
     213             :         Edit*           mpMetadataAuthor;
     214             :         Edit*           mpMetadataDate;
     215             :         MenuButton*     mpMenuButton;
     216             : 
     217             :         sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
     218             :         sw::sidebarwindows::ShadowOverlayObject* mpShadow;
     219             :         sw::overlay::OverlayRanges* mpTextRangeOverlay;
     220             : 
     221             :         Color           mColorAnchor;
     222             :         Color           mColorDark;
     223             :         Color           mColorLight;
     224             :         Color           mChangeColor;
     225             : 
     226             :         sw::sidebarwindows::SidebarPosition meSidebarPosition;
     227             : 
     228             :         Rectangle       mPosSize;
     229             :         SwRect          mAnchorRect;
     230             :         long            mPageBorder;
     231             : 
     232             :         bool            mbMouseOver;
     233             :         SwPostItHelper::SwLayoutStatus mLayoutStatus;
     234             : 
     235             :         bool            mbReadonly;
     236             :         bool            mbIsFollow;
     237             : 
     238             :         SwSidebarItem& mrSidebarItem;
     239             :         const SwFrm* mpAnchorFrm;
     240             : };
     241             : 
     242             : } } // eof namespace sw::sidebarwindows
     243             : 
     244             : #endif
     245             : 
     246             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10