LCOV - code coverage report
Current view: top level - sc/source/ui/view - hintwin.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 42 2.4 %
Date: 2015-06-13 12:38:46 Functions: 2 6 33.3 %
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             : #include "hintwin.hxx"
      21             : #include "global.hxx"
      22             : 
      23             : #define HINT_LINESPACE  2
      24             : #define HINT_INDENT     3
      25             : #define HINT_MARGIN     4
      26             : 
      27           0 : ScHintWindow::ScHintWindow( vcl::Window* pParent, const OUString& rTit, const OUString& rMsg ) :
      28             :     Window( pParent, WinBits( WB_BORDER ) ),
      29             :     aTitle( rTit ),
      30           0 :     aMessage( convertLineEnd(rMsg, LINEEND_CR) )
      31             : {
      32             :     //  Hellgelb, wie Notizen in detfunc.cxx
      33           0 :     Color aYellow( 255,255,192 );           // hellgelb
      34           0 :     SetBackground( aYellow );
      35             : 
      36           0 :     aTextFont = GetFont();
      37           0 :     aTextFont.SetTransparent( true );
      38           0 :     aTextFont.SetWeight( WEIGHT_NORMAL );
      39           0 :     aHeadFont = aTextFont;
      40           0 :     aHeadFont.SetWeight( WEIGHT_BOLD );
      41             : 
      42           0 :     SetFont( aHeadFont );
      43           0 :     Size aHeadSize( GetTextWidth( aTitle ), GetTextHeight() );
      44           0 :     SetFont( aTextFont );
      45             : 
      46           0 :     Size aTextSize;
      47           0 :     sal_Int32 nIndex = 0;
      48           0 :     while ( nIndex != -1 )
      49             :     {
      50           0 :         OUString aLine = aMessage.getToken( 0, CHAR_CR, nIndex );
      51           0 :         Size aLineSize( GetTextWidth( aLine ), GetTextHeight() );
      52           0 :         nTextHeight = aLineSize.Height();
      53           0 :         aTextSize.Height() += nTextHeight;
      54           0 :         if ( aLineSize.Width() > aTextSize.Width() )
      55           0 :             aTextSize.Width() = aLineSize.Width();
      56           0 :     }
      57           0 :     aTextSize.Width() += HINT_INDENT;
      58             : 
      59             :     aTextStart = Point( HINT_MARGIN + HINT_INDENT,
      60           0 :                         aHeadSize.Height() + HINT_MARGIN + HINT_LINESPACE );
      61             : 
      62           0 :     Size aWinSize( std::max( aHeadSize.Width(), aTextSize.Width() ) + 2 * HINT_MARGIN + 1,
      63           0 :                     aHeadSize.Height() + aTextSize.Height() + HINT_LINESPACE + 2 * HINT_MARGIN + 1 );
      64           0 :     SetOutputSizePixel( aWinSize );
      65           0 : }
      66             : 
      67           0 : ScHintWindow::~ScHintWindow()
      68             : {
      69           0 : }
      70             : 
      71           0 : void ScHintWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& /* rRect */ )
      72             : {
      73           0 :     SetFont( aHeadFont );
      74           0 :     DrawText( Point(HINT_MARGIN,HINT_MARGIN), aTitle );
      75             : 
      76           0 :     SetFont( aTextFont );
      77           0 :     sal_Int32 nIndex = 0;
      78           0 :     Point aLineStart = aTextStart;
      79           0 :     while ( nIndex != -1 )
      80             :     {
      81           0 :         OUString aLine = aMessage.getToken( 0, CHAR_CR, nIndex );
      82           0 :         DrawText( aLineStart, aLine );
      83           0 :         aLineStart.Y() += nTextHeight;
      84           0 :     }
      85         156 : }
      86             : 
      87             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11