LCOV - code coverage report
Current view: top level - sw/inc - SidebarWin.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 11 25 44.0 %
Date: 2014-11-03 Functions: 10 22 45.5 %
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 vcl::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        1344 :         inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
      85             :         bool HasScrollbar() const;
      86             :         bool IsScrollbarVisible() const;
      87           0 :         inline ScrollBar* Scrollbar() { return mpVScrollbar; }
      88        1240 :         inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
      89          12 :         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 tools::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        7760 :         const Point     VirtualPos()    { return mPosSize.TopLeft(); }
     117        4432 :         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(bool bSet);
     127           0 :         bool        IsReadOnly()
     128             :         {
     129           0 :             return mbReadonly;
     130             :         }
     131         622 :         bool            IsPreview()
     132             :         {
     133         622 :             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        4756 :         bool            IsFollow() { return mbIsFollow; }
     145        1160 :         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             :         virtual void    Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) SAL_OVERRIDE;
     180             : 
     181             :     protected:
     182             :         virtual void    DataChanged( const DataChangedEvent& aEvent) SAL_OVERRIDE;
     183             :         virtual void    LoseFocus() SAL_OVERRIDE;
     184             :         virtual void    Paint( const Rectangle& rRect) SAL_OVERRIDE;
     185             :         virtual void    GetFocus() SAL_OVERRIDE;
     186             :         virtual MenuButton* CreateMenuButton() = 0;
     187             : 
     188             :         void        SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE;
     189             :         SfxItemSet  DefaultItem();
     190             : 
     191             :         DECL_LINK(ModifyHdl, void*);
     192             :         DECL_LINK(ScrollHdl, ScrollBar*);
     193             :         DECL_LINK(DeleteHdl, void*);
     194             : 
     195         974 :         inline SwView& DocView() { return mrView;}
     196           0 :         inline SwPostItMgr& Mgr() { return mrMgr; }
     197        2210 :         inline Outliner* Engine() { return mpOutliner;}
     198             : 
     199             :     private:
     200             :         SwSidebarWin*   GetTopReplyNote();
     201             : 
     202             :         virtual SvxLanguageItem GetLanguage(void);
     203             : 
     204             :         SwPostItMgr&    mrMgr;
     205             :         SwView&         mrView;
     206             :         const SwPostItBits nFlags;
     207             : 
     208             :         ImplSVEvent *   mnEventId;
     209             : 
     210             :         OutlinerView*   mpOutlinerView;
     211             :         Outliner*       mpOutliner;
     212             : 
     213             :         sw::sidebarwindows::SidebarTxtControl* mpSidebarTxtControl;
     214             :         ScrollBar*      mpVScrollbar;
     215             :         Edit*           mpMetadataAuthor;
     216             :         Edit*           mpMetadataDate;
     217             :         MenuButton*     mpMenuButton;
     218             : 
     219             :         sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
     220             :         sw::sidebarwindows::ShadowOverlayObject* mpShadow;
     221             :         sw::overlay::OverlayRanges* mpTextRangeOverlay;
     222             : 
     223             :         Color           mColorAnchor;
     224             :         Color           mColorDark;
     225             :         Color           mColorLight;
     226             :         Color           mChangeColor;
     227             : 
     228             :         sw::sidebarwindows::SidebarPosition meSidebarPosition;
     229             : 
     230             :         Rectangle       mPosSize;
     231             :         SwRect          mAnchorRect;
     232             :         long            mPageBorder;
     233             : 
     234             :         bool            mbMouseOver;
     235             :         SwPostItHelper::SwLayoutStatus mLayoutStatus;
     236             : 
     237             :         bool            mbReadonly;
     238             :         bool            mbIsFollow;
     239             : 
     240             :         SwSidebarItem& mrSidebarItem;
     241             :         const SwFrm* mpAnchorFrm;
     242             : };
     243             : 
     244             : } } // eof namespace sw::sidebarwindows
     245             : 
     246             : #endif
     247             : 
     248             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10