LCOV - code coverage report
Current view: top level - include/sfx2 - thumbnailviewitem.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 6 16.7 %
Date: 2015-06-13 12:38:46 Functions: 2 7 28.6 %
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_SFX2_THUMBNAILVIEWITEM_HXX
      21             : #define INCLUDED_SFX2_THUMBNAILVIEWITEM_HXX
      22             : 
      23             : #include <basegfx/vector/b2dvector.hxx>
      24             : #include <drawinglayer/attribute/fontattribute.hxx>
      25             : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      26             : #include <osl/mutex.hxx>
      27             : #include <vcl/bitmapex.hxx>
      28             : #include <vcl/vclmedit.hxx>
      29             : #include <sfx2/dllapi.h>
      30             : 
      31             : #include <com/sun/star/accessibility/XAccessible.hpp>
      32             : 
      33             : #define THUMBNAILVIEW_ITEM_NONEITEM      0xFFFE
      34             : 
      35             : const int THUMBNAILVIEW_ITEM_CORNER = 5;
      36             : 
      37             : class CheckBox;
      38             : namespace vcl { class Font; }
      39             : namespace vcl { class Window; }
      40             : class ThumbnailView;
      41             : 
      42             : namespace basegfx {
      43             :     class B2DPolygon;
      44             : }
      45             : 
      46             : namespace drawinglayer {
      47             :     namespace processor2d {
      48             :         class BaseProcessor2D;
      49             :     }
      50             : 
      51             :     namespace primitive2d {
      52             :         class PolygonHairlinePrimitive2D;
      53             :     }
      54             : }
      55             : 
      56           8 : struct ThumbnailItemAttributes
      57             : {
      58             :     sal_uInt32 nMaxTextLength;
      59             :     basegfx::BColor aFillColor;
      60             :     basegfx::BColor aHighlightColor;
      61             :     basegfx::B2DVector aFontSize;
      62             :     drawinglayer::attribute::FontAttribute aFontAttr;
      63             : };
      64             : 
      65             : class SFX2_DLLPUBLIC ThumbnailViewItem
      66             : {
      67             : public:
      68             : 
      69             :     ThumbnailView &mrParent;
      70             :     sal_uInt16 mnId;
      71             :     bool mbVisible;
      72             :     bool mbSelected;
      73             :     bool mbHover;
      74             :     BitmapEx maPreview1;
      75             :     OUString maTitle;
      76             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >* mpxAcc;
      77             : 
      78             :     ThumbnailViewItem (ThumbnailView &rView, sal_uInt16 nId);
      79             : 
      80             :     virtual ~ThumbnailViewItem ();
      81             : 
      82           0 :     bool isVisible () const { return mbVisible; }
      83             : 
      84             :     void show (bool bVisible);
      85             : 
      86           0 :     bool isSelected () const { return mbSelected; }
      87             : 
      88             :     void setSelection (bool state);
      89             : 
      90           0 :     bool isHighlighted () const { return mbHover; }
      91             : 
      92             :     void setHighlight (bool state);
      93             : 
      94             :     /** Updates own highlight status based on the aPoint position.
      95             : 
      96             :         Returns rectangle that needs to be invalidated.
      97             :     */
      98             :     virtual Rectangle updateHighlight(bool bVisible, const Point& rPoint);
      99             : 
     100             :     /// Text to be used for the tooltip.
     101             :     virtual OUString getHelpText() const;
     102             : 
     103             :     virtual void setEditTitle (bool edit, bool bChangeFocus = true);
     104             :     void updateTitleEditSize ();
     105             :     void setTitle (const OUString& rTitle);
     106             : 
     107             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     108             :                         GetAccessible( bool bIsTransientChildrenDisabled );
     109             : 
     110             :     void setDrawArea (const Rectangle &area);
     111             : 
     112           0 :     const Rectangle& getDrawArea () const { return maDrawArea; }
     113             :     Rectangle getTextArea () const;
     114             : 
     115             :     virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight,
     116             :                                          const long nPadding, sal_uInt32 nMaxTextLength,
     117             :                                          const ThumbnailItemAttributes *pAttrs);
     118             : 
     119             :     const Point& getTextPos () const { return maTextPos; }
     120             : 
     121             :     const Point& getPrev1Pos () const { return maPrev1Pos; }
     122             : 
     123             :     void setSelectClickHdl (const Link<> &link);
     124             : 
     125             :     virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
     126             :                         const ThumbnailItemAttributes *pAttrs);
     127             :     void addTextPrimitives (const OUString& rText, const ThumbnailItemAttributes *pAttrs, Point aPos, drawinglayer::primitive2d::Primitive2DSequence& rSeq);
     128             : 
     129             :     static drawinglayer::primitive2d::PolygonHairlinePrimitive2D*
     130             :         createBorderLine (const basegfx::B2DPolygon &rPolygon);
     131             : 
     132           0 :     virtual void MouseButtonUp(const MouseEvent&) {}
     133             : 
     134             : protected:
     135             : 
     136             :     Point maTextPos;
     137             :     Point maPrev1Pos;
     138             :     Rectangle maDrawArea;
     139             :     Link<> maClickHdl;
     140             :     bool mbEditTitle;
     141             :     VclPtr<VclMultiLineEdit> mpTitleED;
     142             :     Rectangle maTextEditMaxArea;
     143             : };
     144             : 
     145             : #endif // INCLUDED_SFX2_THUMBNAILVIEWITEM_HXX
     146             : 
     147             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11