LCOV - code coverage report
Current view: top level - sw/inc - SidebarWin.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 11 25 44.0 %
Date: 2015-06-13 12:38:46 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 SidebarTextControl;
      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             :         virtual void dispose() SAL_OVERRIDE;
      70             : 
      71             :         void SetSize( const Size& rNewSize );
      72             :         void SetPosSizePixelRect( long nX,
      73             :                                   long nY,
      74             :                                   long nWidth,
      75             :                                   long nHeight,
      76             :                                   const SwRect& aAnchorRect,
      77             :                                   const long PageBorder);
      78             :         void SetPosAndSize();
      79             :         void TranslateTopPosition(const long aAmount);
      80             :         void CheckMetaText();
      81             : 
      82           0 :         inline Point GetAnchorPos() { return mAnchorRect.Pos(); }
      83             :         SwEditWin* EditWin();
      84             : 
      85         866 :         inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
      86             :         bool HasScrollbar() const;
      87             :         bool IsScrollbarVisible() const;
      88           0 :         inline ScrollBar* Scrollbar() { return mpVScrollbar; }
      89         756 :         inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
      90           6 :         inline ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
      91           0 :         inline ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay;}
      92             : 
      93             :         long            GetPostItTextHeight();
      94             : 
      95             :         void            SwitchToPostIt(sal_uInt16 aDirection);
      96             :         void    SwitchToFieldPos();
      97             : 
      98             :         virtual sal_uInt32 MoveCaret() = 0;
      99             : 
     100             :         virtual void    UpdateData() = 0;
     101             :         virtual void    SetPostItText() = 0;
     102             :         virtual void    Delete();
     103             :         virtual void    GotoPos() = 0;
     104             : 
     105             :         virtual OUString GetAuthor() = 0;
     106             :         virtual Date    GetDate() = 0;
     107             :         virtual tools::Time GetTime() = 0;
     108             : 
     109             :         void            ExecuteCommand(sal_uInt16 nSlot);
     110             :         void            InitControls();
     111             :         void            HidePostIt();
     112             :         void            DoResize();
     113             :         void            ResizeIfNecessary(long aOldHeight, long aNewHeight);
     114             :         void            SetScrollbar();
     115             : 
     116             :         void            SetVirtualPosSize( const Point& aPoint, const Size& aSize);
     117        5084 :         const Point     VirtualPos()    { return mPosSize.TopLeft(); }
     118        2966 :         const Size      VirtualSize()   { return mPosSize.GetSize(); }
     119             : 
     120             :         void            ShowAnchorOnly(const Point &aPoint);
     121             :         void            ShowNote();
     122             :         void            HideNote();
     123             : 
     124             :         void            ResetAttributes();
     125             : 
     126             :         void            SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
     127             :         void            SetReadonly(bool bSet);
     128           0 :         bool        IsReadOnly()
     129             :         {
     130           0 :             return mbReadonly;
     131             :         }
     132         374 :         bool            IsPreview()
     133             :         {
     134         374 :             return nFlags & PB_Preview;
     135             :         }
     136             : 
     137             :         void         SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
     138           0 :         const Color& ColorAnchor() { return mColorAnchor; }
     139           0 :         const Color& ColorDark() { return mColorDark; }
     140           0 :         const Color& ColorLight() { return mColorLight; }
     141             :         void         Rescale();
     142             : 
     143             :         void            SetViewState(::sw::sidebarwindows::ViewState bViewState);
     144             : 
     145        3244 :         bool            IsFollow() { return mbIsFollow; }
     146         763 :         void            SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
     147             :         virtual bool    CalcFollow() = 0;
     148             : 
     149             :         sal_Int32   GetMetaHeight();
     150             :         sal_Int32   GetMinimumSizeWithMeta();
     151             :         sal_Int32   GetMinimumSizeWithoutMeta();
     152             :         sal_Int32   GetMetaButtonAreaWidth();
     153             :         sal_Int32   GetScrollbarWidth();
     154             : 
     155             :         void    SetSpellChecking();
     156             : 
     157             :         void    ToggleInsMode();
     158             : 
     159             :         void    ActivatePostIt();
     160             :         void    DeactivatePostIt();
     161             : 
     162             :         void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
     163             :                                 const Color& aColor);
     164           0 :         SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
     165           0 :         Color GetChangeColor() { return mChangeColor; }
     166             : 
     167           0 :         virtual bool IsProtected()
     168             :         {
     169           0 :             return mbReadonly;
     170             :         }
     171             : 
     172             :         DECL_LINK( WindowEventListener, VclSimpleEvent* );
     173           0 :         inline bool IsMouseOverSidebarWin() const { return mbMouseOver; }
     174             : 
     175             :         void SetLanguage(const SvxLanguageItem& rNewItem);
     176             : 
     177             :         void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
     178             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
     179             : 
     180             :         virtual void    Draw(OutputDevice* pDev, const Point&, const Size&, DrawFlags) SAL_OVERRIDE;
     181             : 
     182             :     protected:
     183             :         virtual void    DataChanged( const DataChangedEvent& aEvent) SAL_OVERRIDE;
     184             :         virtual void    LoseFocus() SAL_OVERRIDE;
     185             :         virtual void    Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
     186             :         virtual void    GetFocus() SAL_OVERRIDE;
     187             :         virtual VclPtr<MenuButton> CreateMenuButton() = 0;
     188             : 
     189             :         void        SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE;
     190             :         SfxItemSet  DefaultItem();
     191             : 
     192             :         DECL_LINK(ModifyHdl, void*);
     193             :         DECL_LINK(ScrollHdl, ScrollBar*);
     194             :         DECL_LINK(DeleteHdl, void*);
     195             : 
     196         662 :         inline SwView& DocView() { return mrView;}
     197           0 :         inline SwPostItMgr& Mgr() { return mrMgr; }
     198        1428 :         inline Outliner* Engine() { return mpOutliner;}
     199             : 
     200             :     private:
     201             :         SwSidebarWin*   GetTopReplyNote();
     202             : 
     203             :         virtual SvxLanguageItem GetLanguage();
     204             : 
     205             :         SwPostItMgr&    mrMgr;
     206             :         SwView&         mrView;
     207             :         const SwPostItBits nFlags;
     208             : 
     209             :         ImplSVEvent *   mnEventId;
     210             : 
     211             :         OutlinerView*   mpOutlinerView;
     212             :         Outliner*       mpOutliner;
     213             : 
     214             :         VclPtr<sw::sidebarwindows::SidebarTextControl> mpSidebarTextControl;
     215             :         VclPtr<ScrollBar>      mpVScrollbar;
     216             :         VclPtr<Edit>           mpMetadataAuthor;
     217             :         VclPtr<Edit>           mpMetadataDate;
     218             :         VclPtr<MenuButton>     mpMenuButton;
     219             : 
     220             :         sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
     221             :         sw::sidebarwindows::ShadowOverlayObject* mpShadow;
     222             :         sw::overlay::OverlayRanges* mpTextRangeOverlay;
     223             : 
     224             :         Color           mColorAnchor;
     225             :         Color           mColorDark;
     226             :         Color           mColorLight;
     227             :         Color           mChangeColor;
     228             : 
     229             :         sw::sidebarwindows::SidebarPosition meSidebarPosition;
     230             : 
     231             :         Rectangle       mPosSize;
     232             :         SwRect          mAnchorRect;
     233             :         long            mPageBorder;
     234             : 
     235             :         bool            mbMouseOver;
     236             :         SwPostItHelper::SwLayoutStatus mLayoutStatus;
     237             : 
     238             :         bool            mbReadonly;
     239             :         bool            mbIsFollow;
     240             : 
     241             :         SwSidebarItem& mrSidebarItem;
     242             :         const SwFrm* mpAnchorFrm;
     243             : };
     244             : 
     245             : } } // eof namespace sw::sidebarwindows
     246             : 
     247             : #endif
     248             : 
     249             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11