LCOV - code coverage report
Current view: top level - sd/source/ui/presenter - PresenterTextView.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 3 225 1.3 %
Date: 2014-11-03 Functions: 3 29 10.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 "PresenterTextView.hxx"
      21             : #include "facreg.hxx"
      22             : 
      23             : #include <i18nlangtag/mslangid.hxx>
      24             : #include <cppcanvas/vclfactory.hxx>
      25             : #include <svl/itempool.hxx>
      26             : #include <svl/itemset.hxx>
      27             : #include <unotools/linguprops.hxx>
      28             : #include <unotools/lingucfg.hxx>
      29             : #include <editeng/colritem.hxx>
      30             : #include <editeng/editeng.hxx>
      31             : #include <editeng/editstat.hxx>
      32             : #include <editeng/eeitem.hxx>
      33             : #include <editeng/fhgtitem.hxx>
      34             : #include <editeng/fontitem.hxx>
      35             : #include <svx/xflclit.hxx>
      36             : #include <vcl/bitmapex.hxx>
      37             : #include <vcl/svapp.hxx>
      38             : #include <vcl/virdev.hxx>
      39             : #include <com/sun/star/awt/FontDescriptor.hpp>
      40             : #include <com/sun/star/awt/Size.hpp>
      41             : #include <com/sun/star/rendering/XSpriteCanvas.hpp>
      42             : #include <com/sun/star/rendering/XBitmapCanvas.hpp>
      43             : #include <com/sun/star/uno/XComponentContext.hpp>
      44             : #include <com/sun/star/util/Color.hpp>
      45             : #include <com/sun/star/i18n/ScriptType.hpp>
      46             : 
      47             : using namespace ::com::sun::star;
      48             : using namespace ::com::sun::star::uno;
      49             : using namespace ::com::sun::star::lang;
      50             : 
      51             : namespace sd { namespace presenter {
      52             : 
      53             : // Service
      54           0 : Reference<XInterface> SAL_CALL PresenterTextViewService_createInstance (
      55             :     const Reference<XComponentContext>& rxContext) throw (css::uno::Exception)
      56             : {
      57           0 :     return Reference<XInterface>(static_cast<XWeak*>(new PresenterTextView(rxContext)));
      58             : }
      59             : 
      60          34 : OUString PresenterTextViewService_getImplementationName (void) throw(RuntimeException)
      61             : {
      62          34 :     return OUString("com.sun.star.comp.Draw.PresenterTextView");
      63             : }
      64             : 
      65           0 : Sequence<OUString> SAL_CALL PresenterTextViewService_getSupportedServiceNames (void)
      66             :     throw (RuntimeException)
      67             : {
      68           0 :     static const OUString sServiceName("com.sun.star.drawing.PresenterTextView");
      69           0 :     return Sequence<OUString>(&sServiceName, 1);
      70             : }
      71             : 
      72             : // PresenterTextView::Implementation
      73             : class PresenterTextView::Implementation
      74             : {
      75             : public:
      76             :     const OUString msTextPropertyName;
      77             :     const OUString msBitmapPropertyName;
      78             :     const OUString msSizePropertyName;
      79             :     const OUString msBackgroundColorPropertyName;
      80             :     const OUString msTextColorPropertyName;
      81             :     const OUString msFontDescriptorPropertyName;
      82             :     const OUString msTopPropertyName;
      83             :     const OUString msTopRelativePropertyName;
      84             :     const OUString msTotalHeightPropertyName;
      85             : 
      86             :     Implementation (void);
      87             :     ~Implementation (void);
      88             : 
      89             :     void SetCanvas (const cppcanvas::CanvasSharedPtr& rCanvas);
      90             :     void SetSize (const Size aSize);
      91             :     void SetBackgroundColor (const Color aColor);
      92             :     void SetTextColor (const Color aColor);
      93             :     void SetFontDescriptor (const awt::FontDescriptor& rFontDescriptor);
      94           0 :     sal_Int32 GetTop (void) const { return mnTop;}
      95             :     void SetTop (const sal_Int32 nTop);
      96             :     void SetText (const OUString& Text);
      97             :     sal_Int32 ParseDistance (const OUString& rsDistance) const;
      98             :     Reference<rendering::XBitmap> GetBitmap (void);
      99             :     sal_Int32 GetTotalHeight (void);
     100             : 
     101             : private:
     102             :     Reference<rendering::XBitmap> mxBitmap;
     103             :     cppcanvas::CanvasSharedPtr mpCanvas;
     104             :     VirtualDevice* mpOutputDevice;
     105             :     EditEngine* mpEditEngine;
     106             :     SfxItemPool* mpEditEngineItemPool;
     107             :     Size maSize;
     108             :     Color maBackgroundColor;
     109             :     Color maTextColor;
     110             :     OUString msText;
     111             :     sal_Int32 mnTop;
     112             :     sal_Int32 mnTotalHeight;
     113             : 
     114             :     EditEngine * GetEditEngine (void);
     115             :     EditEngine* CreateEditEngine (void);
     116             :     void CheckTop (void);
     117             : };
     118             : 
     119             : // PresenterTextView
     120           0 : PresenterTextView::PresenterTextView (const Reference<XComponentContext>& rxContext)
     121             :     : PresenterTextViewInterfaceBase(),
     122           0 :       mpImplementation(new Implementation())
     123             : {
     124             :     (void)rxContext;
     125           0 : }
     126             : 
     127           0 : PresenterTextView::~PresenterTextView (void)
     128             : {
     129           0 : }
     130             : 
     131           0 : void SAL_CALL PresenterTextView::disposing (void)
     132             : {
     133           0 :     mpImplementation.reset();
     134           0 : }
     135             : 
     136             : // XInitialization
     137           0 : void SAL_CALL PresenterTextView::initialize (const Sequence<Any>& rArguments)
     138             :     throw (Exception, RuntimeException, std::exception)
     139             : {
     140           0 :     ThrowIfDisposed();
     141             : 
     142           0 :     if (rArguments.getLength() == 1)
     143             :     {
     144             :         try
     145             :         {
     146           0 :             Reference<rendering::XCanvas> xCanvas (rArguments[0], UNO_QUERY_THROW);
     147           0 :             if (xCanvas.is())
     148             :             {
     149             :                 mpImplementation->SetCanvas(
     150           0 :                     cppcanvas::VCLFactory::getInstance().createCanvas(xCanvas));
     151           0 :             }
     152             :         }
     153           0 :         catch (RuntimeException&)
     154             :         {
     155           0 :             throw;
     156             :         }
     157             :     }
     158             :     else
     159             :     {
     160             :         throw RuntimeException("PresenterTextView: invalid number of arguments",
     161           0 :                 static_cast<XWeak*>(this));
     162             :     }
     163           0 : }
     164             : 
     165           0 : Any PresenterTextView::GetPropertyValue (const OUString& rsPropertyName)
     166             : {
     167           0 :     ThrowIfDisposed();
     168             : 
     169           0 :     if (rsPropertyName == mpImplementation->msBitmapPropertyName)
     170             :     {
     171           0 :         return Any(mpImplementation->GetBitmap());
     172             :     }
     173           0 :     else if (rsPropertyName == mpImplementation->msTopPropertyName)
     174             :     {
     175           0 :         return Any(mpImplementation->GetTop());
     176             :     }
     177           0 :     else if (rsPropertyName == mpImplementation->msTotalHeightPropertyName)
     178             :     {
     179           0 :         return Any(mpImplementation->GetTotalHeight());
     180             :     }
     181             : 
     182           0 :     return Any();
     183             : }
     184             : 
     185           0 : Any PresenterTextView::SetPropertyValue (
     186             :     const OUString& rsPropertyName,
     187             :     const css::uno::Any& rValue)
     188             : {
     189           0 :     ThrowIfDisposed();
     190             : 
     191           0 :     Any aOldValue;
     192           0 :     if (rsPropertyName == mpImplementation->msTextPropertyName)
     193             :     {
     194           0 :         OUString sText;
     195           0 :         if (rValue >>= sText)
     196           0 :             mpImplementation->SetText(sText);
     197             :     }
     198           0 :     else if (rsPropertyName == mpImplementation->msSizePropertyName)
     199             :     {
     200           0 :         awt::Size aSize;
     201           0 :         if (rValue >>= aSize)
     202           0 :             mpImplementation->SetSize(Size(aSize.Width,aSize.Height));
     203             :     }
     204           0 :     else if (rsPropertyName == mpImplementation->msBackgroundColorPropertyName)
     205             :     {
     206           0 :         util::Color aColor = util::Color();
     207           0 :         if (rValue >>= aColor)
     208           0 :             mpImplementation->SetBackgroundColor(Color(aColor));
     209             :     }
     210           0 :     else if (rsPropertyName == mpImplementation->msTextColorPropertyName)
     211             :     {
     212           0 :         util::Color aColor = util::Color();
     213           0 :         if (rValue >>= aColor)
     214           0 :             mpImplementation->SetTextColor(Color(aColor));
     215             :     }
     216           0 :     else if (rsPropertyName == mpImplementation->msFontDescriptorPropertyName)
     217             :     {
     218           0 :         awt::FontDescriptor aFontDescriptor;
     219           0 :         if (rValue >>= aFontDescriptor)
     220           0 :             mpImplementation->SetFontDescriptor(aFontDescriptor);
     221             :     }
     222           0 :     else if (rsPropertyName == mpImplementation->msTopPropertyName)
     223             :     {
     224           0 :         sal_Int32 nTop = 0;
     225           0 :         if (rValue >>= nTop)
     226           0 :             mpImplementation->SetTop(nTop);
     227             :     }
     228           0 :     else if (rsPropertyName == mpImplementation->msTopRelativePropertyName)
     229             :     {
     230           0 :         OUString sDistance;
     231           0 :         if (rValue >>= sDistance)
     232             :             mpImplementation->SetTop(
     233           0 :                 mpImplementation->GetTop()
     234           0 :                     + mpImplementation->ParseDistance(sDistance));
     235             :     }
     236           0 :     return aOldValue;
     237             : }
     238             : 
     239           0 : void PresenterTextView::ThrowIfDisposed (void)
     240             :     throw (::com::sun::star::lang::DisposedException)
     241             : {
     242           0 :     if (PresenterTextViewInterfaceBase::rBHelper.bDisposed
     243           0 :         || PresenterTextViewInterfaceBase::rBHelper.bInDispose
     244           0 :         || mpImplementation.get()==NULL)
     245             :     {
     246             :         throw lang::DisposedException ("PresenterTextView object has already been disposed",
     247           0 :             static_cast<uno::XWeak*>(this));
     248             :     }
     249           0 : }
     250             : 
     251             : // PresenterTextView::Implementation
     252           0 : PresenterTextView::Implementation::Implementation (void)
     253             :     : msTextPropertyName("Text"),
     254             :       msBitmapPropertyName("Bitmap"),
     255             :       msSizePropertyName("Size"),
     256             :       msBackgroundColorPropertyName("BackgroundColor"),
     257             :       msTextColorPropertyName("TextColor"),
     258             :       msFontDescriptorPropertyName("FontDescriptor"),
     259             :       msTopPropertyName("Top"),
     260             :       msTopRelativePropertyName("RelativeTop"),
     261             :       msTotalHeightPropertyName("TotalHeight"),
     262             :       mxBitmap(),
     263             :       mpCanvas(),
     264           0 :       mpOutputDevice(new VirtualDevice(*Application::GetDefaultDevice(), 0, 0)),
     265             :       mpEditEngine(NULL),
     266           0 :       mpEditEngineItemPool(EditEngine::CreatePool()),
     267             :       maSize(100,100),
     268             :       maBackgroundColor(0xffffffff),
     269             :       maTextColor(0x00000000),
     270             :       msText(),
     271             :       mnTop(0),
     272           0 :       mnTotalHeight(-1)
     273             : {
     274           0 :     mpOutputDevice->SetMapMode(MAP_PIXEL);
     275             : 
     276           0 :     GetEditEngine();
     277           0 : }
     278             : 
     279           0 : PresenterTextView::Implementation::~Implementation (void)
     280             : {
     281           0 :     delete mpEditEngine;
     282           0 :     SfxItemPool::Free(mpEditEngineItemPool);
     283           0 :     delete mpOutputDevice;
     284           0 : }
     285             : 
     286           0 : EditEngine * PresenterTextView::Implementation::GetEditEngine (void)
     287             : {
     288           0 :     if (mpEditEngine == NULL)
     289           0 :         mpEditEngine = CreateEditEngine ();
     290           0 :     return mpEditEngine;
     291             : }
     292             : 
     293           0 : EditEngine* PresenterTextView::Implementation::CreateEditEngine (void)
     294             : {
     295           0 :     EditEngine* pEditEngine = mpEditEngine;
     296           0 :     if (pEditEngine == NULL)
     297             :     {
     298             : 
     299             :         // set fonts to be used
     300             : 
     301           0 :         SvtLinguOptions aOpt;
     302           0 :         SvtLinguConfig().GetOptions( aOpt );
     303             : 
     304             :         struct FontDta {
     305             :             sal_Int16       nFallbackLang;
     306             :             sal_Int16       nLang;
     307             :             sal_uInt16      nFontType;
     308             :             sal_uInt16      nFontInfoId;
     309             :             } aTable[3] =
     310             :         {
     311             :             // info to get western font to be used
     312             :             {   LANGUAGE_ENGLISH_US,    LANGUAGE_NONE,
     313             :                 DEFAULTFONT_SERIF,      EE_CHAR_FONTINFO },
     314             :             // info to get CJK font to be used
     315             :             {   LANGUAGE_JAPANESE,      LANGUAGE_NONE,
     316             :                 DEFAULTFONT_CJK_TEXT,   EE_CHAR_FONTINFO_CJK },
     317             :             // info to get CTL font to be used
     318             :             {   LANGUAGE_ARABIC_SAUDI_ARABIA,  LANGUAGE_NONE,
     319             :                 DEFAULTFONT_CTL_TEXT,   EE_CHAR_FONTINFO_CTL }
     320           0 :         };
     321           0 :         aTable[0].nLang = MsLangId::resolveSystemLanguageByScriptType(aOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN);
     322           0 :         aTable[1].nLang = MsLangId::resolveSystemLanguageByScriptType(aOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN);
     323           0 :         aTable[2].nLang = MsLangId::resolveSystemLanguageByScriptType(aOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
     324             : 
     325           0 :         for (int i = 0;  i < 3;  ++i)
     326             :         {
     327           0 :             const FontDta &rFntDta = aTable[i];
     328           0 :             LanguageType nLang = (LANGUAGE_NONE == rFntDta.nLang) ?
     329           0 :                 rFntDta.nFallbackLang : rFntDta.nLang;
     330             :             vcl::Font aFont = OutputDevice::GetDefaultFont(
     331           0 :                 rFntDta.nFontType, nLang, DEFAULTFONT_FLAGS_ONLYONE);
     332             :             mpEditEngineItemPool->SetPoolDefaultItem(
     333             :                 SvxFontItem(
     334             :                     aFont.GetFamily(),
     335           0 :                     aFont.GetName(),
     336           0 :                     aFont.GetStyleName(),
     337             :                     aFont.GetPitch(),
     338           0 :                     aFont.GetCharSet(),
     339           0 :                     rFntDta.nFontInfoId));
     340           0 :         }
     341             : 
     342           0 :         pEditEngine = new EditEngine (mpEditEngineItemPool);
     343             : 
     344           0 :         pEditEngine->EnableUndo (true);
     345             :         pEditEngine->SetDefTab (sal_uInt16(
     346           0 :             Application::GetDefaultDevice()->GetTextWidth(OUString("XXXX"))));
     347             : 
     348             :         pEditEngine->SetControlWord(
     349           0 :                 (pEditEngine->GetControlWord()
     350             :                     | EE_CNTRL_AUTOINDENTING) &
     351             :                 (~EE_CNTRL_UNDOATTRIBS) &
     352           0 :                 (~EE_CNTRL_PASTESPECIAL));
     353             : 
     354           0 :         pEditEngine->SetWordDelimiters (" .=+-*/(){}[];\"");
     355           0 :         pEditEngine->SetRefMapMode (MAP_PIXEL);
     356           0 :         pEditEngine->SetPaperSize (Size(800, 0));
     357           0 :         pEditEngine->EraseVirtualDevice();
     358           0 :         pEditEngine->ClearModifyFlag();
     359             :     }
     360             : 
     361           0 :     return pEditEngine;
     362             : }
     363             : 
     364           0 : void PresenterTextView::Implementation::SetCanvas (const cppcanvas::CanvasSharedPtr& rpCanvas)
     365             : {
     366           0 :     mpCanvas = rpCanvas;
     367           0 :     mxBitmap = NULL;
     368           0 : }
     369             : 
     370           0 : void PresenterTextView::Implementation::SetSize (const Size aSize)
     371             : {
     372             :     DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
     373             : 
     374           0 :     maSize = aSize;
     375           0 :     mpEditEngine->SetPaperSize(maSize);
     376           0 :     mnTotalHeight = -1;
     377           0 :     mxBitmap = NULL;
     378           0 : }
     379             : 
     380           0 : void PresenterTextView::Implementation::SetBackgroundColor (const Color aColor)
     381             : {
     382           0 :     maBackgroundColor = aColor;
     383           0 :     mxBitmap = NULL;
     384             : 
     385             :     DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
     386             :     DBG_ASSERT(mpEditEngineItemPool!=NULL, "EditEngineItemPool missing");
     387           0 :     mpEditEngine->SetBackgroundColor(aColor);
     388           0 :     mpEditEngine->EnableAutoColor(false);
     389           0 :     mpEditEngine->ForceAutoColor(false);
     390           0 : }
     391             : 
     392           0 : void PresenterTextView::Implementation::SetTextColor (const Color aColor)
     393             : {
     394           0 :     maTextColor = aColor;
     395           0 :     mxBitmap = NULL;
     396             : 
     397             :     DBG_ASSERT(mpEditEngineItemPool!=NULL, "EditEngineItemPool missing");
     398           0 :     mpEditEngineItemPool->SetPoolDefaultItem(SvxColorItem(aColor, EE_CHAR_COLOR));
     399           0 : }
     400             : 
     401           0 : void PresenterTextView::Implementation::SetFontDescriptor (
     402             :     const awt::FontDescriptor& rFontDescriptor)
     403             : {
     404           0 :     mxBitmap = NULL;
     405             : 
     406             :     DBG_ASSERT(mpEditEngineItemPool!=NULL, "EditEngineItemPool missing");
     407             : 
     408           0 :     const sal_Int32 nFontHeight = rFontDescriptor.Height;
     409             : 
     410             :     SvxFontHeightItem aFontHeight(
     411             :         Application::GetDefaultDevice()->LogicToPixel(
     412           0 :             Size(0, nFontHeight), MapMode (MAP_POINT)).Height(),
     413             :         100,
     414           0 :         EE_CHAR_FONTHEIGHT);
     415           0 :     mpEditEngineItemPool->SetPoolDefaultItem( aFontHeight);
     416           0 :     aFontHeight.SetWhich (EE_CHAR_FONTHEIGHT_CJK);
     417           0 :     mpEditEngineItemPool->SetPoolDefaultItem( aFontHeight);
     418           0 :     aFontHeight.SetWhich (EE_CHAR_FONTHEIGHT_CTL);
     419           0 :     mpEditEngineItemPool->SetPoolDefaultItem( aFontHeight);
     420             : 
     421           0 :     SvxFontItem aSvxFontItem (EE_CHAR_FONTINFO);
     422           0 :     aSvxFontItem.SetFamilyName( rFontDescriptor.Name );
     423           0 :     mpEditEngineItemPool->SetPoolDefaultItem(aSvxFontItem);
     424             : 
     425           0 :     mnTotalHeight = -1;
     426           0 :     mxBitmap = NULL;
     427             : 
     428           0 :     CheckTop();
     429           0 :     mnTotalHeight = -1;
     430           0 : }
     431             : 
     432           0 : void PresenterTextView::Implementation::SetTop (const sal_Int32 nTop)
     433             : {
     434           0 :     if (nTop == mnTop)
     435           0 :         return;
     436             : 
     437           0 :     mnTop = nTop;
     438           0 :     mxBitmap = NULL;
     439           0 :     CheckTop();
     440             : }
     441             : 
     442           0 : void PresenterTextView::Implementation::SetText (const OUString& rText)
     443             : {
     444             :     DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
     445           0 :     msText = rText;
     446           0 :     mpEditEngine->SetPaperSize(maSize);
     447           0 :     mnTotalHeight = -1;
     448           0 :     mxBitmap = NULL;
     449           0 : }
     450             : 
     451           0 : sal_Int32 PresenterTextView::Implementation::ParseDistance (const OUString& rsDistance) const
     452             : {
     453             :     DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
     454           0 :     sal_Int32 nDistance (0);
     455           0 :     if (rsDistance.endsWithAsciiL("px", 2))
     456             :     {
     457           0 :         nDistance = rsDistance.copy(0,rsDistance.getLength()-2).toInt32();
     458             :     }
     459           0 :     else if (rsDistance.endsWithAsciiL("l", 1))
     460             :     {
     461           0 :         const sal_Int32 nLines (rsDistance.copy(0,rsDistance.getLength()-1).toInt32());
     462             :         // Take the height of the first line as the height of every line.
     463           0 :         const sal_uInt32 nFirstLineHeight (mpEditEngine->GetLineHeight(0,0));
     464           0 :         nDistance = nFirstLineHeight * nLines;
     465             :     }
     466             : 
     467           0 :     return nDistance;
     468             : }
     469             : 
     470           0 : Reference<rendering::XBitmap> PresenterTextView::Implementation::GetBitmap (void)
     471             : {
     472             :     DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
     473             : 
     474           0 :     if ( ! mxBitmap.is())
     475             :     {
     476           0 :         if (mpOutputDevice != NULL)
     477           0 :             delete mpOutputDevice;
     478           0 :         mpOutputDevice = new VirtualDevice(*Application::GetDefaultDevice(), 0, 0);
     479           0 :         mpOutputDevice->SetMapMode(MAP_PIXEL);
     480           0 :         mpOutputDevice->SetOutputSizePixel(maSize, true);
     481           0 :         mpOutputDevice->SetLineColor();
     482           0 :         mpOutputDevice->SetFillColor();
     483           0 :         mpOutputDevice->SetBackground(Wallpaper());
     484           0 :         mpOutputDevice->Erase();
     485             : 
     486           0 :         MapMode aMapMode (mpOutputDevice->GetMapMode());
     487           0 :         aMapMode.SetOrigin(Point(0,0));
     488           0 :         mpOutputDevice->SetMapMode(aMapMode);
     489           0 :         const Rectangle aWindowBox (Point(0,0), maSize);
     490           0 :         mpOutputDevice->DrawRect(aWindowBox);
     491             : 
     492           0 :         mpEditEngine->Clear();
     493           0 :         mpEditEngine->SetText(msText);
     494           0 :         mpEditEngine->SetPaperSize(maSize);
     495             : 
     496           0 :         mpEditEngine->Draw(mpOutputDevice, aWindowBox, Point(0,mnTop));
     497             : 
     498           0 :         const BitmapEx aBitmap (mpOutputDevice->GetBitmapEx(Point(0,0), maSize));
     499           0 :         mxBitmap = cppcanvas::VCLFactory::getInstance().createBitmap(
     500             :             mpCanvas,
     501             :             aBitmap
     502           0 :             )->getUNOBitmap();
     503             :     }
     504           0 :     return mxBitmap;
     505             : }
     506             : 
     507           0 : sal_Int32 PresenterTextView::Implementation::GetTotalHeight (void)
     508             : {
     509             :     DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
     510             : 
     511           0 :     if (mnTotalHeight < 0)
     512             :     {
     513           0 :         if ( ! mxBitmap.is())
     514           0 :             GetBitmap();
     515           0 :         mnTotalHeight = mpEditEngine->GetTextHeight();
     516             :     }
     517           0 :     return mnTotalHeight;
     518             : }
     519             : 
     520           0 : void PresenterTextView::Implementation::CheckTop (void)
     521             : {
     522             :     DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
     523             : 
     524           0 :     if (mnTotalHeight < 0)
     525           0 :         mnTotalHeight = mpEditEngine->GetTextHeight();
     526           0 :     if (mpEditEngine!=NULL && mnTop >= mnTotalHeight)
     527           0 :         mnTop = mnTotalHeight - mpEditEngine->GetLineHeight(0,0);
     528             : 
     529           0 :     if (mnTotalHeight < maSize.Height())
     530           0 :         mnTop = 0;
     531             : 
     532           0 :     if (mnTotalHeight - mnTop < maSize.Height())
     533           0 :         mnTop = mnTotalHeight - maSize.Height();
     534             : 
     535           0 :     if (mnTop < 0)
     536           0 :         mnTop = 0;
     537           0 : }
     538             : 
     539         114 : } } // end of namespace ::sd::presenter
     540             : 
     541             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10