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

Generated by: LCOV version 1.10