LCOV - code coverage report
Current view: top level - libreoffice/sfx2/source/control - templateview.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 38 0.0 %
Date: 2012-12-17 Functions: 0 7 0.0 %
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             :  * Copyright 2012 LibreOffice contributors.
       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             : 
      10             : #include <sfx2/templateview.hxx>
      11             : 
      12             : #include <basegfx/matrix/b2dhommatrixtools.hxx>
      13             : #include <basegfx/point/b2dpoint.hxx>
      14             : #include <basegfx/range/b2drange.hxx>
      15             : #include <basegfx/vector/b2dvector.hxx>
      16             : #include <drawinglayer/attribute/fillbitmapattribute.hxx>
      17             : #include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
      18             : #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
      19             : #include <drawinglayer/primitive2d/textprimitive2d.hxx>
      20             : #include <drawinglayer/processor2d/baseprocessor2d.hxx>
      21             : #include <sfx2/sfxresid.hxx>
      22             : #include <sfx2/templateviewitem.hxx>
      23             : #include <vcl/edit.hxx>
      24             : 
      25             : #include "templateview.hrc"
      26             : 
      27             : #define EDIT_HEIGHT 30
      28             : 
      29             : using namespace basegfx;
      30             : using namespace basegfx::tools;
      31             : using namespace drawinglayer::attribute;
      32             : using namespace drawinglayer::primitive2d;
      33             : 
      34           0 : TemplateView::TemplateView (Window *pParent)
      35             :     : ThumbnailView(pParent,WB_VSCROLL),
      36             :       maButtons(this, SfxResId(CONTROL_BUTTONS)),
      37             :       maAllButton(&maButtons, SfxResId(BTN_ALL_TEMPLATES)),
      38             :       maFTName(&maButtons, SfxResId(FT_NAME)),
      39           0 :       mnId(0)
      40             : {
      41           0 :     mnHeaderHeight = maButtons.GetSizePixel().getHeight();
      42           0 :     maAllButton.SetStyle(maAllButton.GetStyle() | WB_FLATBUTTON);
      43           0 : }
      44             : 
      45           0 : TemplateView::~TemplateView ()
      46             : {
      47           0 : }
      48             : 
      49           0 : void TemplateView::setName (const OUString &rName)
      50             : {
      51           0 :     maName = rName;
      52           0 :     maFTName.SetText(maName);
      53           0 : }
      54             : 
      55           0 : void TemplateView::InsertItems (const std::vector<TemplateItemProperties> &rTemplates)
      56             : {
      57           0 :     for (size_t i = 0, n = rTemplates.size(); i < n; ++i )
      58             :     {
      59           0 :         TemplateViewItem *pItem = new TemplateViewItem(*this);
      60           0 :         const TemplateItemProperties *pCur = &rTemplates[i];
      61             : 
      62           0 :         pItem->mnId = pCur->nId;
      63           0 :         pItem->maTitle = pCur->aName;
      64           0 :         pItem->setPath(pCur->aPath);
      65           0 :         pItem->maPreview1 = pCur->aThumbnail;
      66           0 :         pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected));
      67             : 
      68           0 :         mItemList.push_back(pItem);
      69             :     }
      70             : 
      71           0 :     CalculateItemPositions();
      72             : 
      73           0 :     Invalidate();
      74           0 : }
      75             : 
      76           0 : void TemplateView::Resize()
      77             : {
      78           0 :     Size aWinSize = GetOutputSize();
      79             : 
      80             :     // Set the buttons panel and buttons size
      81           0 :     Size aPanelSize = maButtons.GetSizePixel();
      82           0 :     int nDeltaW = aWinSize.getWidth() - aPanelSize.getWidth();
      83           0 :     aPanelSize.setWidth(aWinSize.getWidth());
      84           0 :     maButtons.SetSizePixel(aPanelSize);
      85             : 
      86           0 :     Size aNameSize = maFTName.GetSizePixel();
      87           0 :     aNameSize.setWidth(aNameSize.getWidth() + nDeltaW);
      88           0 :     maFTName.SetSizePixel(aNameSize);
      89             : 
      90           0 :     ThumbnailView::Resize();
      91           0 : }
      92             : 
      93           0 : void TemplateView::OnItemDblClicked(ThumbnailViewItem *pItem)
      94             : {
      95           0 :     maDblClickHdl.Call(pItem);
      96           0 : }
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
      99             : 
     100             : 

Generated by: LCOV version 1.10