LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/svx/source/sidebar/tools - ValueSetWithTextControl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 288 0.3 %
Date: 2013-07-09 Functions: 2 19 10.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * This file is part of the LibreOffice project.
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       7             :  *
       8             :  * This file incorporates work covered by the following license notice:
       9             :  *
      10             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      11             :  *   contributor license agreements. See the NOTICE file distributed
      12             :  *   with this work for additional information regarding copyright
      13             :  *   ownership. The ASF licenses this file to you under the Apache
      14             :  *   License, Version 2.0 (the "License"); you may not use this file
      15             :  *   except in compliance with the License. You may obtain a copy of
      16             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      17             :  */
      18             : #include "svx/sidebar/ValueSetWithTextControl.hxx"
      19             : #include <svx/dialogs.hrc>
      20             : #include <svx/dialmgr.hxx>
      21             : #include <sfx2/sidebar/Theme.hxx>
      22             : 
      23             : #include <limits.h>
      24             : #include <com/sun/star/uno/Reference.h>
      25             : #include <com/sun/star/uno/Sequence.h>
      26             : #include <com/sun/star/lang/Locale.hpp>
      27             : #include <com/sun/star/style/NumberingType.hpp>
      28             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      29             : #include <com/sun/star/container/XIndexAccess.hpp>
      30             : #include <com/sun/star/text/XDefaultNumberingProvider.hpp>
      31             : #include <com/sun/star/text/XNumberingFormatter.hpp>
      32             : #include <com/sun/star/beans/PropertyValue.hpp>
      33             : #include <comphelper/processfactory.hxx>
      34             : #include <com/sun/star/text/XNumberingTypeInfo.hpp>
      35             : #include <i18nlangtag/mslangid.hxx>
      36             : #include <svtools/valueset.hxx>
      37             : #include <editeng/brushitem.hxx>
      38             : #include <vcl/graph.hxx>
      39             : #include <svx/nbdtmg.hxx>
      40             : #include <svx/nbdtmgfact.hxx>
      41             : 
      42             : using namespace com::sun::star::uno;
      43             : using namespace com::sun::star::beans;
      44             : using namespace com::sun::star::lang;
      45             : using namespace com::sun::star::i18n;
      46             : using namespace com::sun::star::text;
      47             : using namespace com::sun::star::container;
      48             : using namespace com::sun::star::style;
      49             : using rtl::OUString;
      50             : 
      51             : namespace svx { namespace sidebar {
      52             : static const sal_Char cValue[] = "Value";
      53             : 
      54           0 : static Font& lcl_GetDefaultBulletFont()
      55             : {
      56             :     static sal_Bool bInit = 0;
      57             :     static Font aDefBulletFont( OUString( "StarSymbol" ),
      58           0 :                                 OUString(), Size( 0, 14 ) );
      59           0 :     if(!bInit)
      60             :     {
      61           0 :         aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
      62           0 :         aDefBulletFont.SetFamily( FAMILY_DONTKNOW );
      63           0 :         aDefBulletFont.SetPitch( PITCH_DONTKNOW );
      64           0 :         aDefBulletFont.SetWeight( WEIGHT_DONTKNOW );
      65           0 :         aDefBulletFont.SetTransparent( sal_True );
      66           0 :         bInit = sal_True;
      67             :     }
      68           0 :     return aDefBulletFont;
      69             : }
      70             : 
      71           0 : ValueSetWithTextControl::ValueSetWithTextControl(
      72             :     const tControlType eControlType,
      73             :     Window* pParent,
      74             :     const ResId& rResId)
      75             :     : ValueSet( pParent, rResId )
      76             :     , meControlType( eControlType )
      77           0 :     , maItems()
      78             : {
      79           0 :     SetColCount( 1 );
      80           0 : }
      81             : 
      82             : 
      83           0 : ValueSetWithTextControl::~ValueSetWithTextControl(void)
      84             : {
      85           0 : }
      86             : 
      87             : 
      88           0 : void ValueSetWithTextControl::AddItem(
      89             :     const Image& rItemImage,
      90             :     const Image* pSelectedItemImage,
      91             :     const XubString& rItemText,
      92             :     const XubString* pItemHelpText )
      93             : {
      94           0 :     if ( meControlType != IMAGE_TEXT )
      95             :     {
      96           0 :         return;
      97             :     }
      98             : 
      99           0 :     ValueSetWithTextItem aItem;
     100           0 :     aItem.maItemImage = rItemImage;
     101           0 :     aItem.maSelectedItemImage = (pSelectedItemImage != 0)
     102             :                                 ? *pSelectedItemImage
     103           0 :                                 : rItemImage;
     104           0 :     aItem.maItemText = rItemText;
     105             : 
     106           0 :     maItems.push_back( aItem );
     107             : 
     108           0 :     InsertItem( maItems.size() );
     109           0 :     SetItemText( maItems.size(),
     110           0 :                     (pItemHelpText != 0) ? *pItemHelpText : rItemText );
     111             : }
     112             : 
     113             : 
     114           0 : void ValueSetWithTextControl::AddItem(
     115             :     const XubString& rItemText,
     116             :     const XubString& rItemText2,
     117             :     const XubString* pItemHelpText )
     118             : {
     119           0 :     if ( meControlType != TEXT_TEXT )
     120             :     {
     121           0 :         return;
     122             :     }
     123             : 
     124           0 :     ValueSetWithTextItem aItem;
     125           0 :     aItem.maItemText = rItemText;
     126           0 :     aItem.maItemText2 = rItemText2;
     127             : 
     128           0 :     maItems.push_back( aItem );
     129             : 
     130           0 :     InsertItem( maItems.size() );
     131           0 :     SetItemText( maItems.size(),
     132           0 :                     (pItemHelpText != 0) ? *pItemHelpText : rItemText );
     133             : }
     134             : 
     135             : 
     136           0 : void ValueSetWithTextControl::ReplaceItemImages(
     137             :     const sal_uInt16 nItemId,
     138             :     const Image& rItemImage,
     139             :     const Image* pSelectedItemImage )
     140             : {
     141           0 :     if ( meControlType != IMAGE_TEXT )
     142             :     {
     143           0 :         return;
     144             :     }
     145             : 
     146           0 :     if ( nItemId == 0 ||
     147           0 :          nItemId > maItems.size() )
     148             :     {
     149           0 :         return;
     150             :     }
     151             : 
     152           0 :     maItems[nItemId-1].maItemImage = rItemImage;
     153           0 :     maItems[nItemId-1].maSelectedItemImage = (pSelectedItemImage != 0)
     154             :                                              ? *pSelectedItemImage
     155           0 :                                              : rItemImage;
     156             : }
     157             : 
     158             : 
     159           0 : void ValueSetWithTextControl::UserDraw( const UserDrawEvent& rUDEvt )
     160             : {
     161           0 :     const Rectangle aRect = rUDEvt.GetRect();
     162           0 :     OutputDevice* pDev = rUDEvt.GetDevice();
     163           0 :     pDev->Push( PUSH_ALL );
     164           0 :     const sal_uInt16 nItemId = rUDEvt.GetItemId();
     165             : 
     166           0 :     const long nRectHeight = aRect.GetHeight();
     167           0 :     const Point aBLPos = aRect.TopLeft();
     168             : 
     169           0 :     Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
     170             :     {
     171           0 :         Size aSize = aFont.GetSize();
     172           0 :         aSize.Height() = (nRectHeight*4)/9;
     173           0 :         aFont.SetSize( aSize );
     174             :     }
     175             : 
     176             :     {
     177             :         //draw backgroud
     178           0 :         if ( GetSelectItemId() == nItemId )
     179             :         {
     180           0 :             Rectangle aBackRect = aRect;
     181           0 :             aBackRect.Top() += 3;
     182           0 :             aBackRect.Bottom() -= 2;
     183           0 :             pDev->SetFillColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_Highlight ) );
     184           0 :             pDev->DrawRect(aBackRect);
     185             :         }
     186             :         else
     187             :         {
     188           0 :             pDev->SetFillColor( COL_TRANSPARENT );
     189           0 :             pDev->DrawRect(aRect);
     190             :         }
     191             : 
     192             :         //draw image + text resp. text + text
     193           0 :         Image* pImage = 0;
     194           0 :         if ( GetSelectItemId() == nItemId )
     195             :         {
     196           0 :             aFont.SetColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_HighlightText ) );
     197           0 :             pImage = &maItems[nItemId-1].maSelectedItemImage;
     198             :         }
     199             :         else
     200             :         {
     201           0 :             aFont.SetColor( GetSettings().GetStyleSettings().GetFieldTextColor() );
     202           0 :             pImage = &maItems[nItemId-1].maItemImage;
     203             :         }
     204             : 
     205           0 :         Rectangle aStrRect = aRect;
     206           0 :         aStrRect.Top() += nRectHeight/4;
     207           0 :         aStrRect.Bottom() -= nRectHeight/4;
     208             : 
     209           0 :         switch ( meControlType )
     210             :         {
     211             :         case IMAGE_TEXT:
     212             :             {
     213             :                 Point aImgStart(
     214           0 :                     aBLPos.X() + 4,
     215           0 :                     aBLPos.Y() + ( ( nRectHeight - pImage->GetSizePixel().Height() ) / 2 ) );
     216           0 :                 pDev->DrawImage( aImgStart, *pImage );
     217             : 
     218           0 :                 aStrRect.Left() += pImage->GetSizePixel().Width() + 12;
     219           0 :                 pDev->SetFont(aFont);
     220           0 :                 pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText, TEXT_DRAW_ENDELLIPSIS);
     221             :             }
     222           0 :             break;
     223             :         case TEXT_TEXT:
     224             :             {
     225           0 :                 const long nRectWidth = aRect.GetWidth();
     226           0 :                 aStrRect.Left() += 8;
     227           0 :                 aStrRect.Right() -= (nRectWidth*2)/3;
     228           0 :                 pDev->SetFont(aFont);
     229           0 :                 pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText, TEXT_DRAW_ENDELLIPSIS);
     230           0 :                 aStrRect.Left() += nRectWidth/3;
     231           0 :                 aStrRect.Right() += (nRectWidth*2)/3;
     232           0 :                 pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText2, TEXT_DRAW_ENDELLIPSIS);
     233             :             }
     234           0 :             break;
     235             :         }
     236             :     }
     237             : 
     238           0 :     Invalidate( aRect );
     239           0 :     pDev->Pop();
     240           0 : }
     241             : 
     242           0 : SvxNumValueSet2::SvxNumValueSet2( Window* pParent, const ResId& rResId) :
     243             :     ValueSet( pParent, rResId ),
     244             :     aLineColor  ( COL_LIGHTGRAY ),
     245           0 :     pVDev       ( NULL )
     246             : {
     247           0 :     SetColCount( 3 );
     248           0 :     SetLineCount( 3 );
     249           0 :     SetStyle( GetStyle() | WB_ITEMBORDER );
     250           0 : }
     251             : 
     252           0 :  SvxNumValueSet2::~SvxNumValueSet2()
     253             : {
     254           0 :     delete pVDev;
     255           0 : }
     256             : 
     257           0 : void SvxNumValueSet2::SetNumberingSettings(
     258             :     const Sequence<Sequence<PropertyValue> >& aNum,
     259             :     Reference<XNumberingFormatter>& xFormat,
     260             :     const Locale& rLocale   )
     261             : {
     262           0 :     aNumSettings = aNum;
     263           0 :     xFormatter = xFormat;
     264           0 :     aLocale = rLocale;
     265           0 :         if(aNum.getLength() > 9)
     266           0 :         SetStyle( GetStyle()|WB_VSCROLL);
     267           0 :     InsertItem( DEFAULT_NONE, DEFAULT_NONE - 1 );
     268           0 :     SetItemText( DEFAULT_NONE, SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE ));
     269             : 
     270           0 :     for ( sal_Int32 i = 0; i < aNum.getLength(); i++ )
     271             :     {
     272           0 :         InsertItem( i + 1);
     273           0 :         if( i < 8 )
     274             :         {
     275           0 :             NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
     276           0 :             if ( pNumbering )
     277             :             {
     278           0 :                 SetItemText( i + 1, pNumbering->GetDescription(i));
     279             :             }
     280             :         }
     281             :     }
     282           0 : }
     283             : 
     284           0 : void  SvxNumValueSet2::UserDraw( const UserDrawEvent& rUDEvt )
     285             : {
     286           0 :     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     287           0 :     const Color aBackColor = rStyleSettings.GetFieldColor();
     288           0 :     const Color aTextColor = rStyleSettings.GetFieldTextColor();
     289             : 
     290           0 :     OutputDevice*  pDev = rUDEvt.GetDevice();
     291           0 :     Rectangle aRect = rUDEvt.GetRect();
     292           0 :     sal_uInt32  nItemId = rUDEvt.GetItemId();
     293           0 :     long nRectWidth = aRect.GetWidth();
     294           0 :     long nRectHeight = aRect.GetHeight();
     295           0 :     Size aRectSize(nRectWidth, aRect.GetHeight());
     296           0 :     Point aBLPos = aRect.TopLeft();
     297           0 :     Font aOldFont = pDev->GetFont();
     298           0 :     Color aOldColor = pDev->GetLineColor();
     299           0 :     pDev->SetLineColor(aBackColor);
     300             :     Font aFont(OutputDevice::GetDefaultFont(
     301           0 :                 DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
     302             : 
     303           0 :     Size aSize = aFont.GetSize();
     304           0 :     aSize.Height() = nRectHeight/5;
     305           0 :     aFont.SetColor(aTextColor);
     306           0 :     aFont.SetFillColor(aBackColor);
     307           0 :     aFont.SetSize( aSize );
     308           0 :     pDev->SetFont(aFont);
     309           0 :     pDev->SetLineColor(aTextColor);
     310           0 :     if(!pVDev)
     311             :     {
     312             :         // Die Linien werden nur einmalig in das VirtualDevice gepainted
     313             :         // nur die Gliederungspage bekommt es aktuell
     314           0 :         pVDev = new VirtualDevice(*pDev);
     315           0 :         pVDev->SetMapMode(pDev->GetMapMode());
     316           0 :         pVDev->EnableRTL( IsRTLEnabled() );
     317           0 :         pVDev->SetOutputSize( aRectSize );
     318           0 :         aOrgRect = aRect;
     319             : 
     320           0 :         pVDev->SetLineColor( aBackColor );
     321           0 :         pVDev->SetFillColor( aBackColor );
     322           0 :         pVDev->DrawRect(aOrgRect);
     323             : 
     324           0 :         if(aBackColor == aLineColor)
     325           0 :             aLineColor.Invert();
     326           0 :         if(GetSettings().GetStyleSettings().GetHighContrastMode())
     327           0 :             pVDev->SetLineColor(aTextColor);
     328             :         else
     329           0 :             pVDev->SetLineColor(aLineColor);
     330             :         // Linien nur einmalig Zeichnen
     331           0 :         Point aStart(aBLPos.X() + nRectWidth *30 / 100,0);
     332           0 :         Point aEnd(aBLPos.X() + nRectWidth * 9 / 10,0);
     333           0 :         for( sal_uInt32 i = 11; i < 100; i += 33)
     334             :         {
     335           0 :             aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight  * i / 100;
     336           0 :             pVDev->DrawLine(aStart, aEnd);
     337           0 :             aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight  * (i + 11) / 100;
     338           0 :             pVDev->DrawLine(aStart, aEnd);
     339             :         }
     340             :     }
     341           0 :     if ( nItemId != DEFAULT_NONE)
     342             :         pDev->DrawOutDev(   aRect.TopLeft(), aRectSize,
     343           0 :                             aOrgRect.TopLeft(), aRectSize,
     344           0 :                             *pVDev );
     345             : 
     346           0 :     Point aStart(aBLPos.X() + nRectWidth / 9,0);
     347           0 :     if ( nItemId == DEFAULT_NONE)
     348             :     {
     349           0 :         String sText(SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE));
     350           0 :         Font aLclFont = pDev->GetFont();
     351           0 :         Size aLclSize = aLclFont.GetSize();
     352           0 :         aLclSize.Height() = nRectHeight/4;
     353           0 :         aLclFont.SetSize( aLclSize );
     354           0 :         pDev->SetFont(aLclFont);
     355           0 :         long nTextWidth = pDev->GetTextWidth(sText);
     356           0 :         long nTextHeight = pDev->GetTextHeight();
     357             :         //GVT refine
     358           0 :         while (nTextWidth>nRectWidth && aLclSize.Height()>4) {
     359           0 :             aLclSize.Height() = aLclSize.Height()*0.9;
     360           0 :             aLclFont.SetSize( aLclSize );
     361           0 :             pDev->SetFont(aLclFont);
     362           0 :             nTextWidth = pDev->GetTextWidth(sText);
     363             :         }
     364           0 :         Point aSStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2);
     365           0 :         pDev->DrawText(aSStart, sText);
     366           0 :         pDev->SetFont(aOldFont);
     367             :     }
     368             :     else
     369             :     {
     370           0 :         NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
     371           0 :         if ( pNumbering && nItemId <= DEFAULT_BULLET_TYPES )
     372             :         {
     373           0 :             for( sal_uInt32 i = 0; i < 3; i++ )
     374             :             {
     375           0 :                 sal_uInt32 nY = 11 + i * 33;
     376           0 :                 aStart.Y() = aBLPos.Y() + nRectHeight  * nY / 100;
     377           0 :                 String sText;
     378           0 :                 sal_uInt16 nLvl = 0;
     379           0 :                 SvxNumRule aTempRule( 0, 10, false );
     380           0 :                 pNumbering->ApplyNumRule(aTempRule,nItemId -1,1<<nLvl);
     381           0 :                 SvxNumberFormat aNumFmt(aTempRule.GetLevel(nLvl));
     382           0 :                 sText=aNumFmt.GetNumStr(i+1);
     383           0 :                 sText.Insert( aNumFmt.GetPrefix(), 0 );
     384           0 :                 sText += aNumFmt.GetSuffix();
     385           0 :                 aStart.X() = aBLPos.X() + 2;
     386           0 :                 aStart.Y() -= pDev->GetTextHeight()/2;
     387           0 :                 pDev->DrawText(aStart, sText);
     388           0 :             }
     389             :         }
     390           0 :         pDev->SetFont(aOldFont);
     391           0 :         pDev->SetLineColor(aOldColor);
     392           0 :     }
     393             :     //End
     394           0 : }
     395             : 
     396             : //===============================================================================================
     397             : 
     398           0 : SvxNumValueSet3::SvxNumValueSet3( Window* pParent, const ResId& rResId) :
     399           0 :     ValueSet( pParent, rResId )
     400             : {
     401           0 :     SetColCount( 3 );
     402           0 :     SetLineCount( 4 );
     403           0 :     SetStyle( GetStyle() | WB_ITEMBORDER );
     404           0 : }
     405             : 
     406           0 :  SvxNumValueSet3::~SvxNumValueSet3()
     407             : {
     408           0 : }
     409             : 
     410           0 : void  SvxNumValueSet3::UserDraw( const UserDrawEvent& rUDEvt )
     411             : {
     412           0 :     Rectangle aRect = rUDEvt.GetRect();
     413           0 :     OutputDevice*  pDev = rUDEvt.GetDevice();
     414           0 :     sal_uInt32  nItemId = rUDEvt.GetItemId();
     415             : 
     416           0 :     long nRectHeight = aRect.GetHeight();
     417           0 :     long nRectWidth = aRect.GetWidth();
     418           0 :     Point aBLPos = aRect.TopLeft();
     419           0 :     NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
     420           0 :     if ( pBullets )
     421             :     {
     422           0 :         if ( nItemId <= DEFAULT_BULLET_TYPES ) {
     423           0 :             sal_uInt16 nLvl = 0;
     424           0 :             SvxNumRule aTempRule( 0, 10, false );
     425           0 :             pBullets->ApplyNumRule(aTempRule,nItemId -1,1<<nLvl);
     426           0 :             SvxNumberFormat aFmt(aTempRule.GetLevel(nLvl));
     427           0 :             sal_Int16 eNumType = aFmt.GetNumberingType();
     428           0 :             if( eNumType == SVX_NUM_CHAR_SPECIAL)
     429             :             {
     430           0 :                 sal_Unicode cChar = aFmt.GetBulletChar();
     431             :             //End
     432           0 :                 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     433           0 :                 const Color aBackColor = rStyleSettings.GetFieldColor();
     434           0 :                 const Color aTextColor = rStyleSettings.GetFieldTextColor();
     435             : 
     436           0 :                 Font aOldFont = pDev->GetFont();
     437           0 :                 Font aFont( lcl_GetDefaultBulletFont() );
     438             : 
     439           0 :                 Size aSize = aFont.GetSize();
     440           0 :                 aSize.Height() = nRectHeight*3/6;
     441           0 :                 aFont.SetColor(aTextColor);
     442           0 :                 aFont.SetFillColor(aBackColor);
     443           0 :                 aFont.SetSize( aSize );
     444           0 :                 pDev->SetFont(aFont);
     445           0 :                 pDev->SetFillColor( aBackColor ); //wj
     446             : 
     447           0 :                 String sText;
     448           0 :                 sText = cChar;
     449           0 :                 Font aOldBulletFont = pDev->GetFont();
     450           0 :                 Font aBulletFnt(aFmt.GetBulletFont() ? *aFmt.GetBulletFont() : aOldBulletFont);
     451           0 :                 Size aBulSize = aOldBulletFont.GetSize();
     452           0 :                 aBulletFnt.SetSize(aBulSize);
     453           0 :                 pDev->SetFont(aBulletFnt);
     454           0 :                 long nTextWidth = pDev->GetTextWidth(sText);
     455           0 :                 long nTextHeight = pDev->GetTextHeight();
     456           0 :                 Point aStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2);
     457           0 :                 pDev->DrawText(aStart, sText);
     458           0 :                 pDev->SetFont(aOldFont);
     459           0 :             }else if ( eNumType == SVX_NUM_BITMAP )
     460             :             {
     461           0 :                 const SvxBrushItem* pBrushItem = aFmt.GetBrush();
     462           0 :                 if(pBrushItem)
     463             :                 {
     464           0 :                     const Graphic* pGrf = pBrushItem->GetGraphic();
     465           0 :                     if(pGrf)
     466             :                     {
     467           0 :                         Size aSize(nRectHeight*6/20, nRectHeight*6/20);
     468           0 :                         Point aStart(aBLPos.X() + nRectWidth*7/20, aBLPos.Y() + nRectHeight*7/20);
     469             : 
     470           0 :                         pGrf->Draw( pDev, aStart, aSize );
     471             :                     }
     472             :                 }
     473           0 :             }
     474           0 :         }else if ( nItemId == DEFAULT_NONE)
     475             :         {
     476           0 :             const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     477           0 :             const Color aBackColor = rStyleSettings.GetFieldColor();
     478           0 :             const Color aTextColor = rStyleSettings.GetFieldTextColor();
     479             : 
     480           0 :             Font aOldFont = pDev->GetFont();
     481           0 :             Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
     482           0 :             Size aSize = aFont.GetSize();
     483             :             //aSize.Height() = nRectHeight/5;
     484           0 :             aSize.Height() = nRectHeight/4;
     485           0 :             aFont.SetColor(aTextColor);
     486           0 :             aFont.SetFillColor(aBackColor);
     487           0 :             aFont.SetSize( aSize );
     488           0 :             pDev->SetFont(aFont);
     489           0 :             pDev->SetFillColor( aBackColor );
     490             : 
     491           0 :             String sText(SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE));
     492             : 
     493           0 :             long nTextWidth = pDev->GetTextWidth(sText);
     494           0 :             long nTextHeight = pDev->GetTextHeight();
     495             :             //GVT refine
     496           0 :             while (nTextWidth>nRectWidth && aSize.Height()>4) {
     497           0 :                 aSize.Height() = aSize.Height()*0.9;
     498           0 :                 aFont.SetSize( aSize );
     499           0 :                 pDev->SetFont(aFont);
     500           0 :                 nTextWidth = pDev->GetTextWidth(sText);
     501             :             }
     502           0 :             Point aStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2);
     503           0 :             pDev->DrawText(aStart, sText);
     504             : 
     505           0 :             pDev->SetFont(aOldFont);
     506             :         }
     507             :     }
     508             : 
     509           0 : }
     510             : 
     511         216 : } } // end of namespace svx::sidebar

Generated by: LCOV version 1.10