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

Generated by: LCOV version 1.10