LCOV - code coverage report
Current view: top level - svtools/source/config - optionsdrawinglayer.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 194 326 59.5 %
Date: 2014-11-03 Functions: 52 74 70.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             : #ifdef _MSC_VER
      21             : #pragma hdrstop
      22             : #endif
      23             : 
      24             : #include <svtools/optionsdrawinglayer.hxx>
      25             : #include <unotools/configmgr.hxx>
      26             : #include <unotools/configitem.hxx>
      27             : #include <tools/debug.hxx>
      28             : #include <com/sun/star/uno/Any.hxx>
      29             : #include <com/sun/star/uno/Sequence.hxx>
      30             : #include <vcl/svapp.hxx>
      31             : #include <vcl/outdev.hxx>
      32             : #include <vcl/settings.hxx>
      33             : #include <rtl/instance.hxx>
      34             : 
      35             : 
      36             : //  namespaces
      37             : 
      38             : 
      39             : using namespace ::utl                   ;
      40             : using namespace ::osl                   ;
      41             : using namespace ::com::sun::star::uno   ;
      42             : 
      43             : #define ROOTNODE_START                  OUString("Office.Common/Drawinglayer"   )
      44             : #define DEFAULT_OVERLAYBUFFER           true
      45             : #define DEFAULT_PAINTBUFFER             true
      46             : #define DEFAULT_STRIPE_COLOR_A          0
      47             : #define DEFAULT_STRIPE_COLOR_B          16581375
      48             : #define DEFAULT_STRIPE_LENGTH           4
      49             : 
      50             : // #i73602#
      51             : // #i74769#, #i75172# : Change default for Calc and Writer to True
      52             : #define DEFAULT_OVERLAYBUFFER_CALC          true
      53             : #define DEFAULT_OVERLAYBUFFER_WRITER        true
      54             : #define DEFAULT_OVERLAYBUFFER_DRAWIMPRESS   true
      55             : 
      56             : // #i74769#, #i75172#
      57             : #define DEFAULT_PAINTBUFFER_CALC            true
      58             : #define DEFAULT_PAINTBUFFER_WRITER          true
      59             : #define DEFAULT_PAINTBUFFER_DRAWIMPRESS     true
      60             : 
      61             : // #i4219#
      62             : #define DEFAULT_MAXIMUMPAPERWIDTH           300
      63             : #define DEFAULT_MAXIMUMPAPERHEIGHT          300
      64             : #define DEFAULT_MAXIMUMPAPERLEFTMARGIN      9999
      65             : #define DEFAULT_MAXIMUMPAPERRIGHTMARGIN     9999
      66             : #define DEFAULT_MAXIMUMPAPERTOPMARGIN       9999
      67             : #define DEFAULT_MAXIMUMPAPERBOTTOMMARGIN    9999
      68             : 
      69             : // primitives
      70             : #define DEFAULT_ANTIALIASING                        true
      71             : #define DEFAULT_SNAPHORVERLINESTODISCRETE           true
      72             : #define DEFAULT_SOLIDDRAGCREATE                     true
      73             : #define DEFAULT_RENDERDECORATEDTEXTDIRECT           true
      74             : #define DEFAULT_RENDERSIMPLETEXTDIRECT              true
      75             : #define DEFAULT_QUADRATIC3DRENDERLIMIT              1000000
      76             : #define DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT     45000
      77             : 
      78             : // #i97672# selection settings
      79             : #define DEFAULT_TRANSPARENTSELECTION                true
      80             : #define DEFAULT_TRANSPARENTSELECTIONPERCENT         75
      81             : #define DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT    70
      82             : 
      83             : #define PROPERTYNAME_OVERLAYBUFFER      OUString("OverlayBuffer"    )
      84             : #define PROPERTYNAME_PAINTBUFFER        OUString("PaintBuffer"      )
      85             : #define PROPERTYNAME_STRIPE_COLOR_A     OUString("StripeColorA"     )
      86             : #define PROPERTYNAME_STRIPE_COLOR_B     OUString("StripeColorB"     )
      87             : #define PROPERTYNAME_STRIPE_LENGTH      OUString("StripeLength"     )
      88             : 
      89             : // #i73602#
      90             : #define PROPERTYNAME_OVERLAYBUFFER_CALC         OUString("OverlayBuffer_Calc")
      91             : #define PROPERTYNAME_OVERLAYBUFFER_WRITER       OUString("OverlayBuffer_Writer")
      92             : #define PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS  OUString("OverlayBuffer_DrawImpress")
      93             : 
      94             : // #i74769#, #i75172#
      95             : #define PROPERTYNAME_PAINTBUFFER_CALC           OUString("PaintBuffer_Calc")
      96             : #define PROPERTYNAME_PAINTBUFFER_WRITER         OUString("PaintBuffer_Writer")
      97             : #define PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS    OUString("PaintBuffer_DrawImpress")
      98             : 
      99             : // #i4219#
     100             : #define PROPERTYNAME_MAXIMUMPAPERWIDTH OUString("MaximumPaperWidth")
     101             : #define PROPERTYNAME_MAXIMUMPAPERHEIGHT OUString("MaximumPaperHeight")
     102             : #define PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN OUString("MaximumPaperLeftMargin")
     103             : #define PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN OUString("MaximumPaperRightMargin")
     104             : #define PROPERTYNAME_MAXIMUMPAPERTOPMARGIN OUString("MaximumPaperTopMargin")
     105             : #define PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN OUString("MaximumPaperBottomMargin")
     106             : 
     107             : // primitives
     108             : #define PROPERTYNAME_ANTIALIASING OUString("AntiAliasing")
     109             : #define PROPERTYNAME_SNAPHORVERLINESTODISCRETE OUString("SnapHorVerLinesToDiscrete")
     110             : #define PROPERTYNAME_SOLIDDRAGCREATE OUString("SolidDragCreate")
     111             : #define PROPERTYNAME_RENDERDECORATEDTEXTDIRECT OUString("RenderDecoratedTextDirect")
     112             : #define PROPERTYNAME_RENDERSIMPLETEXTDIRECT OUString("RenderSimpleTextDirect")
     113             : #define PROPERTYNAME_QUADRATIC3DRENDERLIMIT OUString("Quadratic3DRenderLimit")
     114             : #define PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT OUString("QuadraticFormControlRenderLimit")
     115             : 
     116             : // #i97672# selection settings
     117             : #define PROPERTYNAME_TRANSPARENTSELECTION OUString("TransparentSelection")
     118             : #define PROPERTYNAME_TRANSPARENTSELECTIONPERCENT OUString("TransparentSelectionPercent")
     119             : #define PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT OUString("SelectionMaximumLuminancePercent")
     120             : 
     121             : #define PROPERTYHANDLE_OVERLAYBUFFER                0
     122             : #define PROPERTYHANDLE_PAINTBUFFER                  1
     123             : #define PROPERTYHANDLE_STRIPE_COLOR_A               2
     124             : #define PROPERTYHANDLE_STRIPE_COLOR_B               3
     125             : #define PROPERTYHANDLE_STRIPE_LENGTH                4
     126             : 
     127             : // #i73602#
     128             : #define PROPERTYHANDLE_OVERLAYBUFFER_CALC           5
     129             : #define PROPERTYHANDLE_OVERLAYBUFFER_WRITER         6
     130             : #define PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS    7
     131             : 
     132             : // #i74769#, #i75172#
     133             : #define PROPERTYHANDLE_PAINTBUFFER_CALC             8
     134             : #define PROPERTYHANDLE_PAINTBUFFER_WRITER           9
     135             : #define PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS      10
     136             : 
     137             : // #i4219#
     138             : #define PROPERTYHANDLE_MAXIMUMPAPERWIDTH            11
     139             : #define PROPERTYHANDLE_MAXIMUMPAPERHEIGHT           12
     140             : #define PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN       13
     141             : #define PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN      14
     142             : #define PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN        15
     143             : #define PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN     16
     144             : 
     145             : // primitives
     146             : #define PROPERTYHANDLE_ANTIALIASING                     17
     147             : #define PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE        18
     148             : #define PROPERTYHANDLE_SOLIDDRAGCREATE                  19
     149             : #define PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT        20
     150             : #define PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT           21
     151             : #define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT           22
     152             : #define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT  23
     153             : 
     154             : // #i97672# selection settings
     155             : #define PROPERTYHANDLE_TRANSPARENTSELECTION             24
     156             : #define PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT      25
     157             : #define PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT 26
     158             : 
     159             : #define PROPERTYCOUNT                               27
     160             : 
     161             : class SvtOptionsDrawinglayer_Impl : public ConfigItem
     162             : {
     163             : public:
     164             : 
     165             : 
     166             : //  constructor / destructor
     167             : 
     168             : 
     169             :      SvtOptionsDrawinglayer_Impl();
     170             :     virtual ~SvtOptionsDrawinglayer_Impl();
     171             : 
     172             : 
     173             : //  overloaded methods of baseclass
     174             : 
     175             : 
     176             :     virtual void Commit() SAL_OVERRIDE;
     177             :     virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames) SAL_OVERRIDE;
     178             : 
     179             : 
     180             : //  public interface
     181             : 
     182             : 
     183        7555 :     bool        IsOverlayBuffer() const { return m_bOverlayBuffer;}
     184       15324 :     bool        IsPaintBuffer() const { return m_bPaintBuffer;}
     185        2255 :     Color       GetStripeColorA() const { return m_bStripeColorA;}
     186        2255 :     Color       GetStripeColorB() const { return m_bStripeColorB;}
     187        2255 :     sal_uInt16  GetStripeLength() const { return m_nStripeLength;}
     188             : 
     189             :     // #i73602#
     190         546 :     bool        IsOverlayBuffer_Calc() const { return m_bOverlayBuffer_Calc;}
     191        5318 :     bool        IsOverlayBuffer_Writer() const { return m_bOverlayBuffer_Writer;}
     192         568 :     bool        IsOverlayBuffer_DrawImpress() const { return m_bOverlayBuffer_DrawImpress;}
     193             : 
     194             :     // #i74769#, #i75172#
     195         546 :     bool        IsPaintBuffer_Calc() const { return m_bPaintBuffer_Calc;}
     196        5318 :     bool        IsPaintBuffer_Writer() const { return m_bPaintBuffer_Writer;}
     197         568 :     bool        IsPaintBuffer_DrawImpress() const { return m_bPaintBuffer_DrawImpress;}
     198             : 
     199             :     // #i4219#
     200           0 :     sal_uInt32  GetMaximumPaperWidth() const { return m_nMaximumPaperWidth;}
     201           0 :     sal_uInt32  GetMaximumPaperHeight() const { return m_nMaximumPaperHeight;}
     202           0 :     sal_uInt32  GetMaximumPaperLeftMargin() const { return m_nMaximumPaperLeftMargin;}
     203           0 :     sal_uInt32  GetMaximumPaperRightMargin() const { return m_nMaximumPaperRightMargin;}
     204           0 :     sal_uInt32  GetMaximumPaperTopMargin() const { return m_nMaximumPaperTopMargin;}
     205           0 :     sal_uInt32  GetMaximumPaperBottomMargin() const { return m_nMaximumPaperBottomMargin;}
     206             : 
     207             :     // helper
     208             :     bool        IsAAPossibleOnThisSystem() const;
     209             : 
     210             :     // primitives
     211      263087 :     bool        IsAntiAliasing() const { return m_bAntiAliasing;}
     212           0 :     bool        IsSnapHorVerLinesToDiscrete() const { return m_bSnapHorVerLinesToDiscrete;}
     213       18858 :     bool        IsSolidDragCreate() const { return m_bSolidDragCreate;}
     214        1061 :     bool        IsRenderDecoratedTextDirect() const { return m_bRenderDecoratedTextDirect;}
     215        7756 :     bool        IsRenderSimpleTextDirect() const { return m_bRenderSimpleTextDirect;}
     216          21 :     sal_uInt32  GetQuadratic3DRenderLimit() const { return m_nQuadratic3DRenderLimit;}
     217           2 :     sal_uInt32  GetQuadraticFormControlRenderLimit() const { return m_nQuadraticFormControlRenderLimit;}
     218             : 
     219             :     void        SetAntiAliasing( bool bState );
     220             : 
     221             :     // #i97672# selection settings
     222       12902 :     bool        IsTransparentSelection() const { return m_bTransparentSelection;}
     223       13052 :     sal_uInt16  GetTransparentSelectionPercent() const { return m_nTransparentSelectionPercent;}
     224         578 :     sal_uInt16  GetSelectionMaximumLuminancePercent() const { return m_nSelectionMaximumLuminancePercent;}
     225             : 
     226             :     void        SetTransparentSelection( bool bState );
     227             :     void        SetTransparentSelectionPercent( sal_uInt16 nPercent );
     228             : 
     229             : 
     230             : //  private methods
     231             : 
     232             : 
     233             : private:
     234             : 
     235             :     static Sequence< OUString > impl_GetPropertyNames();
     236             : 
     237             : 
     238             : //  private member
     239             : 
     240             : 
     241             : private:
     242             : 
     243             :         bool        m_bOverlayBuffer;
     244             :         bool        m_bPaintBuffer;
     245             :         Color       m_bStripeColorA;
     246             :         Color       m_bStripeColorB;
     247             :         sal_uInt16  m_nStripeLength;
     248             : 
     249             :         // #i73602#
     250             :         bool        m_bOverlayBuffer_Calc;
     251             :         bool        m_bOverlayBuffer_Writer;
     252             :         bool        m_bOverlayBuffer_DrawImpress;
     253             : 
     254             :         // #i74769#, #i75172#
     255             :         bool        m_bPaintBuffer_Calc;
     256             :         bool        m_bPaintBuffer_Writer;
     257             :         bool        m_bPaintBuffer_DrawImpress;
     258             : 
     259             :         // #i4219#
     260             :         sal_uInt32  m_nMaximumPaperWidth;
     261             :         sal_uInt32  m_nMaximumPaperHeight;
     262             :         sal_uInt32  m_nMaximumPaperLeftMargin;
     263             :         sal_uInt32  m_nMaximumPaperRightMargin;
     264             :         sal_uInt32  m_nMaximumPaperTopMargin;
     265             :         sal_uInt32  m_nMaximumPaperBottomMargin;
     266             : 
     267             :         // primitives
     268             :         bool        m_bAntiAliasing;
     269             :         bool        m_bSnapHorVerLinesToDiscrete;
     270             :         bool        m_bSolidDragCreate;
     271             :         bool        m_bRenderDecoratedTextDirect;
     272             :         bool        m_bRenderSimpleTextDirect;
     273             :         sal_uInt32  m_nQuadratic3DRenderLimit;
     274             :         sal_uInt32  m_nQuadraticFormControlRenderLimit;
     275             : 
     276             :         // #i97672# selection settings
     277             :         sal_uInt16  m_nTransparentSelectionPercent;
     278             :         sal_uInt16  m_nSelectionMaximumLuminancePercent;
     279             :         bool        m_bTransparentSelection;
     280             : 
     281             :         // local values
     282             :         bool        m_bAllowAA : 1;
     283             :         bool        m_bAllowAAChecked : 1;
     284             : };
     285             : 
     286             : 
     287             : //  constructor
     288             : 
     289        5825 : SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() :
     290             :     ConfigItem( ROOTNODE_START  ),
     291             :     m_bOverlayBuffer( DEFAULT_OVERLAYBUFFER ),
     292             :     m_bPaintBuffer( DEFAULT_PAINTBUFFER ),
     293             :     m_bStripeColorA(Color(DEFAULT_STRIPE_COLOR_A)),
     294             :     m_bStripeColorB(Color(DEFAULT_STRIPE_COLOR_B)),
     295             :     m_nStripeLength(DEFAULT_STRIPE_LENGTH),
     296             : 
     297             :     // #i73602#
     298             :     m_bOverlayBuffer_Calc( DEFAULT_OVERLAYBUFFER_CALC ),
     299             :     m_bOverlayBuffer_Writer( DEFAULT_OVERLAYBUFFER_WRITER ),
     300             :     m_bOverlayBuffer_DrawImpress( DEFAULT_OVERLAYBUFFER_DRAWIMPRESS ),
     301             : 
     302             :     // #i74769#, #i75172#
     303             :     m_bPaintBuffer_Calc( DEFAULT_PAINTBUFFER_CALC ),
     304             :     m_bPaintBuffer_Writer( DEFAULT_PAINTBUFFER_WRITER ),
     305             :     m_bPaintBuffer_DrawImpress( DEFAULT_PAINTBUFFER_DRAWIMPRESS ),
     306             : 
     307             :     // #i4219#
     308             :     m_nMaximumPaperWidth(DEFAULT_MAXIMUMPAPERWIDTH),
     309             :     m_nMaximumPaperHeight(DEFAULT_MAXIMUMPAPERHEIGHT),
     310             :     m_nMaximumPaperLeftMargin(DEFAULT_MAXIMUMPAPERLEFTMARGIN),
     311             :     m_nMaximumPaperRightMargin(DEFAULT_MAXIMUMPAPERRIGHTMARGIN),
     312             :     m_nMaximumPaperTopMargin(DEFAULT_MAXIMUMPAPERTOPMARGIN),
     313             :     m_nMaximumPaperBottomMargin(DEFAULT_MAXIMUMPAPERBOTTOMMARGIN),
     314             : 
     315             :     // primitives
     316             :     m_bAntiAliasing(DEFAULT_ANTIALIASING),
     317             :     m_bSnapHorVerLinesToDiscrete(DEFAULT_SNAPHORVERLINESTODISCRETE),
     318             :     m_bSolidDragCreate(DEFAULT_SOLIDDRAGCREATE),
     319             :     m_bRenderDecoratedTextDirect(DEFAULT_RENDERDECORATEDTEXTDIRECT),
     320             :     m_bRenderSimpleTextDirect(DEFAULT_RENDERSIMPLETEXTDIRECT),
     321             :     m_nQuadratic3DRenderLimit(DEFAULT_QUADRATIC3DRENDERLIMIT),
     322             :     m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT),
     323             : 
     324             :     // #i97672# selection settings
     325             :     m_nTransparentSelectionPercent(DEFAULT_TRANSPARENTSELECTIONPERCENT),
     326             :     m_nSelectionMaximumLuminancePercent(DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT),
     327             :     m_bTransparentSelection(DEFAULT_TRANSPARENTSELECTION),
     328             : 
     329             :     // local values
     330             :     m_bAllowAA(true),
     331        5825 :     m_bAllowAAChecked(false)
     332             : {
     333        5825 :     Sequence< OUString >    seqNames( impl_GetPropertyNames() );
     334       11650 :     Sequence< Any >         seqValues   = GetProperties( seqNames ) ;
     335             : 
     336             :     DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" );
     337             : 
     338             :     // Copy values from list in right order to our internal member.
     339        5825 :     sal_Int32 nPropertyCount = seqValues.getLength();
     340      163100 :     for(sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
     341             :     {
     342      157275 :         if (!seqValues[nProperty].hasValue())
     343           0 :             continue;
     344             : 
     345      157275 :         switch( nProperty )
     346             :         {
     347             :             case PROPERTYHANDLE_OVERLAYBUFFER:
     348             :             {
     349             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer\"?" );
     350        5825 :                 seqValues[nProperty] >>= m_bOverlayBuffer;
     351             :             }
     352        5825 :             break;
     353             : 
     354             :             case PROPERTYHANDLE_PAINTBUFFER:
     355             :             {
     356             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer\"?" );
     357        5825 :                 seqValues[nProperty] >>= m_bPaintBuffer;
     358             :             }
     359        5825 :             break;
     360             : 
     361             :             case PROPERTYHANDLE_STRIPE_COLOR_A:
     362             :             {
     363             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorA\"?" );
     364        5825 :                 sal_Int32 nValue = 0;
     365        5825 :                 seqValues[nProperty] >>= nValue;
     366        5825 :                 m_bStripeColorA = nValue;
     367             :             }
     368        5825 :             break;
     369             : 
     370             :             case PROPERTYHANDLE_STRIPE_COLOR_B:
     371             :             {
     372             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorB\"?" );
     373        5825 :                 sal_Int32 nValue = 0;
     374        5825 :                 seqValues[nProperty] >>= nValue;
     375        5825 :                 m_bStripeColorB = nValue;
     376             :             }
     377        5825 :             break;
     378             : 
     379             :             case PROPERTYHANDLE_STRIPE_LENGTH:
     380             :             {
     381             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeLength\"?" );
     382        5825 :                 seqValues[nProperty] >>= m_nStripeLength;
     383             :             }
     384        5825 :             break;
     385             : 
     386             :             // #i73602#
     387             :             case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
     388             :             {
     389             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Calc\"?" );
     390        5825 :                 seqValues[nProperty] >>= m_bOverlayBuffer_Calc;
     391             :             }
     392        5825 :             break;
     393             : 
     394             :             case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
     395             :             {
     396             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Writer\"?" );
     397        5825 :                 seqValues[nProperty] >>= m_bOverlayBuffer_Writer;
     398             :             }
     399        5825 :             break;
     400             : 
     401             :             case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
     402             :             {
     403             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_DrawImpress\"?" );
     404        5825 :                 seqValues[nProperty] >>= m_bOverlayBuffer_DrawImpress;
     405             :             }
     406        5825 :             break;
     407             : 
     408             :             // #i74769#, #i75172#
     409             :             case PROPERTYHANDLE_PAINTBUFFER_CALC:
     410             :             {
     411             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Calc\"?" );
     412        5825 :                 seqValues[nProperty] >>= m_bPaintBuffer_Calc;
     413             :             }
     414        5825 :             break;
     415             : 
     416             :             case PROPERTYHANDLE_PAINTBUFFER_WRITER:
     417             :             {
     418             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Writer\"?" );
     419        5825 :                 seqValues[nProperty] >>= m_bPaintBuffer_Writer;
     420             :             }
     421        5825 :             break;
     422             : 
     423             :             case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
     424             :             {
     425             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_DrawImpress\"?" );
     426        5825 :                 seqValues[nProperty] >>= m_bPaintBuffer_DrawImpress;
     427             :             }
     428        5825 :             break;
     429             : 
     430             :             // #i4219#
     431             :             case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
     432             :             {
     433             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperWidth\"?" );
     434        5825 :                 seqValues[nProperty] >>= m_nMaximumPaperWidth;
     435             :             }
     436        5825 :             break;
     437             : 
     438             :             case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
     439             :             {
     440             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperHeight\"?" );
     441        5825 :                 seqValues[nProperty] >>= m_nMaximumPaperHeight;
     442             :             }
     443        5825 :             break;
     444             : 
     445             :             case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
     446             :             {
     447             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperLeftMargin\"?" );
     448        5825 :                 seqValues[nProperty] >>= m_nMaximumPaperLeftMargin;
     449             :             }
     450        5825 :             break;
     451             : 
     452             :             case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
     453             :             {
     454             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperRightMargin\"?" );
     455        5825 :                 seqValues[nProperty] >>= m_nMaximumPaperRightMargin;
     456             :             }
     457        5825 :             break;
     458             : 
     459             :             case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
     460             :             {
     461             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperTopMargin\"?" );
     462        5825 :                 seqValues[nProperty] >>= m_nMaximumPaperTopMargin;
     463             :             }
     464        5825 :             break;
     465             : 
     466             :             case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
     467             :             {
     468             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperBottomMargin\"?" );
     469        5825 :                 seqValues[nProperty] >>= m_nMaximumPaperBottomMargin;
     470             :             }
     471        5825 :             break;
     472             : 
     473             :             // primitives
     474             :             case PROPERTYHANDLE_ANTIALIASING:
     475             :             {
     476             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\AntiAliasing\"?" );
     477        5825 :                 seqValues[nProperty] >>= m_bAntiAliasing;
     478             :             }
     479        5825 :             break;
     480             : 
     481             :             // primitives
     482             :             case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
     483             :             {
     484             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SnapHorVerLinesToDiscrete\"?" );
     485        5825 :                 seqValues[nProperty] >>= m_bSnapHorVerLinesToDiscrete;
     486             :             }
     487        5825 :             break;
     488             : 
     489             :             case PROPERTYHANDLE_SOLIDDRAGCREATE:
     490             :             {
     491             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SolidDragCreate\"?" );
     492        5825 :                 seqValues[nProperty] >>= m_bSolidDragCreate;
     493             :             }
     494        5825 :             break;
     495             : 
     496             :             case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
     497             :             {
     498             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderDecoratedTextDirect\"?" );
     499        5825 :                 seqValues[nProperty] >>= m_bRenderDecoratedTextDirect;
     500             :             }
     501        5825 :             break;
     502             : 
     503             :             case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
     504             :             {
     505             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderSimpleTextDirect\"?" );
     506        5825 :                 seqValues[nProperty] >>= m_bRenderSimpleTextDirect;
     507             :             }
     508        5825 :             break;
     509             : 
     510             :             case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
     511             :             {
     512             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\Quadratic3DRenderLimit\"?" );
     513        5825 :                 seqValues[nProperty] >>= m_nQuadratic3DRenderLimit;
     514             :             }
     515        5825 :             break;
     516             : 
     517             :             case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
     518             :             {
     519             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\QuadraticFormControlRenderLimit\"?" );
     520        5825 :                 seqValues[nProperty] >>= m_nQuadraticFormControlRenderLimit;
     521             :             }
     522        5825 :             break;
     523             : 
     524             :             // #i97672# selection settings
     525             :             case PROPERTYHANDLE_TRANSPARENTSELECTION:
     526             :             {
     527             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelection\"?" );
     528        5825 :                 seqValues[nProperty] >>= m_bTransparentSelection;
     529             :             }
     530        5825 :             break;
     531             : 
     532             :             case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
     533             :             {
     534             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelectionPercent\"?" );
     535        5825 :                 seqValues[nProperty] >>= m_nTransparentSelectionPercent;
     536             :             }
     537        5825 :             break;
     538             : 
     539             :             case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
     540             :             {
     541             :                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SelectionMaximumLuminancePercent\"?" );
     542        5825 :                 seqValues[nProperty] >>= m_nSelectionMaximumLuminancePercent;
     543             :             }
     544        5825 :             break;
     545             :         }
     546        5825 :     }
     547        5825 : }
     548             : 
     549             : 
     550             : //  destructor
     551             : 
     552       17457 : SvtOptionsDrawinglayer_Impl::~SvtOptionsDrawinglayer_Impl()
     553             : {
     554        5819 :     if( IsModified() )
     555           0 :         Commit();
     556       11638 : }
     557             : 
     558             : 
     559             : //  Commit
     560             : 
     561           0 : void SvtOptionsDrawinglayer_Impl::Commit()
     562             : {
     563           0 :     Sequence< OUString >    aSeqNames( impl_GetPropertyNames() );
     564           0 :     Sequence< Any >         aSeqValues( aSeqNames.getLength() );
     565             : 
     566           0 :     for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty )
     567             :     {
     568           0 :         switch( nProperty )
     569             :         {
     570             :             case PROPERTYHANDLE_OVERLAYBUFFER:
     571           0 :                 aSeqValues[nProperty] <<= m_bOverlayBuffer;
     572           0 :             break;
     573             : 
     574             :             case PROPERTYHANDLE_PAINTBUFFER:
     575           0 :                 aSeqValues[nProperty] <<= m_bPaintBuffer;
     576           0 :             break;
     577             : 
     578             :             case PROPERTYHANDLE_STRIPE_COLOR_A:
     579           0 :                 aSeqValues[nProperty] <<= m_bStripeColorA.GetColor();
     580           0 :             break;
     581             : 
     582             :             case PROPERTYHANDLE_STRIPE_COLOR_B:
     583           0 :                 aSeqValues[nProperty] <<= m_bStripeColorB.GetColor();
     584           0 :             break;
     585             : 
     586             :             case PROPERTYHANDLE_STRIPE_LENGTH:
     587           0 :                 aSeqValues[nProperty] <<= m_nStripeLength;
     588           0 :             break;
     589             : 
     590             :             // #i73602#
     591             :             case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
     592           0 :                 aSeqValues[nProperty] <<= m_bOverlayBuffer_Calc;
     593           0 :             break;
     594             : 
     595             :             case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
     596           0 :                 aSeqValues[nProperty] <<= m_bOverlayBuffer_Writer;
     597           0 :             break;
     598             : 
     599             :             case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
     600           0 :                 aSeqValues[nProperty] <<= m_bOverlayBuffer_DrawImpress;
     601           0 :             break;
     602             : 
     603             :             // #i74769#, #i75172#
     604             :             case PROPERTYHANDLE_PAINTBUFFER_CALC:
     605           0 :                 aSeqValues[nProperty] <<= m_bPaintBuffer_Calc;
     606           0 :             break;
     607             : 
     608             :             case PROPERTYHANDLE_PAINTBUFFER_WRITER:
     609           0 :                 aSeqValues[nProperty] <<= m_bPaintBuffer_Writer;
     610           0 :             break;
     611             : 
     612             :             case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
     613           0 :                 aSeqValues[nProperty] <<= m_bPaintBuffer_DrawImpress;
     614           0 :             break;
     615             : 
     616             :             // #i4219#
     617             :             case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
     618           0 :                 aSeqValues[nProperty] <<= m_nMaximumPaperWidth;
     619           0 :             break;
     620             : 
     621             :             case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
     622           0 :                 aSeqValues[nProperty] <<= m_nMaximumPaperHeight;
     623           0 :             break;
     624             : 
     625             :             case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
     626           0 :                 aSeqValues[nProperty] <<= m_nMaximumPaperLeftMargin;
     627           0 :             break;
     628             : 
     629             :             case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
     630           0 :                 aSeqValues[nProperty] <<= m_nMaximumPaperRightMargin;
     631           0 :             break;
     632             : 
     633             :             case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
     634           0 :                 aSeqValues[nProperty] <<= m_nMaximumPaperTopMargin;
     635           0 :             break;
     636             : 
     637             :             case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
     638           0 :                 aSeqValues[nProperty] <<= m_nMaximumPaperBottomMargin;
     639           0 :             break;
     640             : 
     641             :             // primitives
     642             :             case PROPERTYHANDLE_ANTIALIASING:
     643           0 :                 aSeqValues[nProperty] <<= m_bAntiAliasing;
     644           0 :             break;
     645             : 
     646             :             case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
     647           0 :                 aSeqValues[nProperty] <<= m_bSnapHorVerLinesToDiscrete;
     648           0 :             break;
     649             : 
     650             :             case PROPERTYHANDLE_SOLIDDRAGCREATE:
     651           0 :                 aSeqValues[nProperty] <<= m_bSolidDragCreate;
     652           0 :             break;
     653             : 
     654             :             case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
     655           0 :                 aSeqValues[nProperty] <<= m_bRenderDecoratedTextDirect;
     656           0 :             break;
     657             : 
     658             :             case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
     659           0 :                 aSeqValues[nProperty] <<= m_bRenderSimpleTextDirect;
     660           0 :             break;
     661             : 
     662             :             case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
     663           0 :                 aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit;
     664           0 :             break;
     665             : 
     666             :             case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
     667           0 :                 aSeqValues[nProperty] <<= m_nQuadraticFormControlRenderLimit;
     668           0 :             break;
     669             : 
     670             :             // #i97672# selection settings
     671             :             case PROPERTYHANDLE_TRANSPARENTSELECTION:
     672           0 :                 aSeqValues[nProperty] <<= m_bTransparentSelection;
     673           0 :             break;
     674             : 
     675             :             case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
     676           0 :                 aSeqValues[nProperty] <<= m_nTransparentSelectionPercent;
     677           0 :             break;
     678             : 
     679             :             case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
     680           0 :                 aSeqValues[nProperty] <<= m_nSelectionMaximumLuminancePercent;
     681           0 :             break;
     682             :         }
     683             :     }
     684             : 
     685           0 :     PutProperties( aSeqNames, aSeqValues );
     686           0 : }
     687             : 
     688           0 : void SvtOptionsDrawinglayer_Impl::Notify( const com::sun::star::uno::Sequence<OUString>& )
     689             : {
     690           0 : }
     691             : 
     692             : 
     693             : //  public method
     694             : 
     695             : 
     696             : 
     697             : //  public method
     698             : 
     699             : 
     700             : 
     701             : //  public method
     702             : 
     703             : 
     704             : 
     705             : //  public method
     706             : 
     707             : 
     708             : 
     709             : //  public method
     710             : 
     711             : 
     712             : // #i73602#
     713             : 
     714             : 
     715             : 
     716             : // #i74769#, #i75172#
     717             : 
     718             : 
     719             : 
     720             : // #i4219#
     721             : 
     722             : 
     723             : 
     724             : 
     725             : 
     726             : 
     727             : // helper
     728      263087 : bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const
     729             : {
     730      263087 :     if(!m_bAllowAAChecked)
     731             :     {
     732        2309 :         SvtOptionsDrawinglayer_Impl* pThat = const_cast< SvtOptionsDrawinglayer_Impl* >(this);
     733        2309 :         pThat->m_bAllowAAChecked = true;
     734             : 
     735             : #ifdef WIN32
     736             :         // WIN32 uses GDIPlus with VCL forthe first incarnation; this will be enhanced
     737             :         // in the future to use canvases and the canvas renderer, thus a AA-abled
     738             :         // canvas needs to be checked here in the future.
     739             :         // Currently, just allow AA for WIN32
     740             : #endif
     741             : 
     742             :         // check XRenderExtension
     743        2309 :         if(m_bAllowAA && !Application::GetDefaultDevice()->SupportsOperation( OutDevSupport_TransparentRect ))
     744             :         {
     745        2309 :             pThat->m_bAllowAA = false;
     746             :         }
     747             :     }
     748             : 
     749      263087 :     return m_bAllowAA;
     750             : }
     751             : 
     752             : // primitives
     753             : 
     754             : 
     755             : 
     756             : 
     757             : 
     758             : 
     759             : 
     760           0 : void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( bool bState )
     761             : {
     762           0 :     if(m_bAntiAliasing != bState)
     763             :     {
     764           0 :         m_bAntiAliasing = bState;
     765           0 :         SetModified();
     766             :     }
     767           0 : }
     768             : 
     769             : // #i97672# selection settings
     770             : 
     771           0 : void SvtOptionsDrawinglayer_Impl::SetTransparentSelection( bool bState )
     772             : {
     773           0 :     if(m_bTransparentSelection != bState)
     774             :     {
     775           0 :         m_bTransparentSelection = bState;
     776           0 :         SetModified();
     777             :     }
     778           0 : }
     779             : 
     780           0 : void SvtOptionsDrawinglayer_Impl::SetTransparentSelectionPercent( sal_uInt16 nPercent )
     781             : {
     782           0 :     if(m_nTransparentSelectionPercent != nPercent)
     783             :     {
     784           0 :         m_nTransparentSelectionPercent = nPercent;
     785           0 :         SetModified();
     786             :     }
     787           0 : }
     788             : 
     789             : 
     790             : 
     791             : 
     792             : //  private method
     793             : 
     794        5825 : Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames()
     795             : {
     796             :     // Build list of configuration key names.
     797             :     const OUString pProperties[] =
     798             :     {
     799             :         PROPERTYNAME_OVERLAYBUFFER      ,
     800             :         PROPERTYNAME_PAINTBUFFER        ,
     801             :         PROPERTYNAME_STRIPE_COLOR_A     ,
     802             :         PROPERTYNAME_STRIPE_COLOR_B     ,
     803             :         PROPERTYNAME_STRIPE_LENGTH      ,
     804             : 
     805             :         // #i73602#
     806             :         PROPERTYNAME_OVERLAYBUFFER_CALC,
     807             :         PROPERTYNAME_OVERLAYBUFFER_WRITER,
     808             :         PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS,
     809             : 
     810             :         // #i74769#, #i75172#
     811             :         PROPERTYNAME_PAINTBUFFER_CALC,
     812             :         PROPERTYNAME_PAINTBUFFER_WRITER,
     813             :         PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS,
     814             : 
     815             :         // #i4219#
     816             :         PROPERTYNAME_MAXIMUMPAPERWIDTH,
     817             :         PROPERTYNAME_MAXIMUMPAPERHEIGHT,
     818             :         PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN,
     819             :         PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN,
     820             :         PROPERTYNAME_MAXIMUMPAPERTOPMARGIN,
     821             :         PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN,
     822             : 
     823             :         // primitives
     824             :         PROPERTYNAME_ANTIALIASING,
     825             :         PROPERTYNAME_SNAPHORVERLINESTODISCRETE,
     826             :         PROPERTYNAME_SOLIDDRAGCREATE,
     827             :         PROPERTYNAME_RENDERDECORATEDTEXTDIRECT,
     828             :         PROPERTYNAME_RENDERSIMPLETEXTDIRECT,
     829             :         PROPERTYNAME_QUADRATIC3DRENDERLIMIT,
     830             :         PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT,
     831             : 
     832             :         // #i97672# selection settings
     833             :         PROPERTYNAME_TRANSPARENTSELECTION,
     834             :         PROPERTYNAME_TRANSPARENTSELECTIONPERCENT,
     835             :         PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT
     836      163100 :     };
     837             : 
     838             :     // Initialize return sequence with these list ...
     839        5825 :     const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
     840             :     // ... and return it.
     841      163100 :     return seqPropertyNames;
     842             : }
     843             : 
     844             : 
     845             : //  initialize static member
     846             : //  DON'T DO IT IN YOUR HEADER!
     847             : //  see definition for further information
     848             : 
     849             : SvtOptionsDrawinglayer_Impl* SvtOptionsDrawinglayer::m_pDataContainer = NULL;
     850             : sal_Int32 SvtOptionsDrawinglayer::m_nRefCount = 0;
     851             : 
     852             : 
     853             : //  constructor
     854             : 
     855      119059 : SvtOptionsDrawinglayer::SvtOptionsDrawinglayer()
     856             : {
     857             :     // Global access, must be guarded (multithreading!).
     858      119059 :     MutexGuard aGuard( GetOwnStaticMutex() );
     859             :     // Increase our refcount ...
     860      119059 :     ++m_nRefCount;
     861             :     // ... and initialize our data container only if it not already!
     862      119059 :     if( m_pDataContainer == NULL )
     863             :     {
     864        5825 :         m_pDataContainer = new SvtOptionsDrawinglayer_Impl();
     865      119059 :     }
     866      119059 : }
     867             : 
     868             : 
     869             : //  destructor
     870             : 
     871      118962 : SvtOptionsDrawinglayer::~SvtOptionsDrawinglayer()
     872             : {
     873             :     // Global access, must be guarded (multithreading!)
     874      118962 :     MutexGuard aGuard( GetOwnStaticMutex() );
     875             :     // Decrease our refcount.
     876      118962 :     --m_nRefCount;
     877             :     // If last instance was deleted ...
     878             :     // we must destroy our static data container!
     879      118962 :     if( m_nRefCount <= 0 )
     880             :     {
     881        5819 :         delete m_pDataContainer;
     882        5819 :         m_pDataContainer = NULL;
     883      118962 :     }
     884      118962 : }
     885             : 
     886             : 
     887             : //  public method
     888             : 
     889        7555 : bool SvtOptionsDrawinglayer::IsOverlayBuffer() const
     890             : {
     891        7555 :     MutexGuard aGuard( GetOwnStaticMutex() );
     892        7555 :     return m_pDataContainer->IsOverlayBuffer();
     893             : }
     894             : 
     895             : 
     896             : //  public method
     897             : 
     898       15324 : bool SvtOptionsDrawinglayer::IsPaintBuffer() const
     899             : {
     900       15324 :     MutexGuard aGuard( GetOwnStaticMutex() );
     901       15324 :     return m_pDataContainer->IsPaintBuffer();
     902             : }
     903             : 
     904             : 
     905             : //  public method
     906             : 
     907        2255 : Color SvtOptionsDrawinglayer::GetStripeColorA() const
     908             : {
     909        2255 :     MutexGuard aGuard( GetOwnStaticMutex() );
     910        2255 :     return m_pDataContainer->GetStripeColorA();
     911             : }
     912             : 
     913             : 
     914             : //  public method
     915             : 
     916        2255 : Color SvtOptionsDrawinglayer::GetStripeColorB() const
     917             : {
     918        2255 :     MutexGuard aGuard( GetOwnStaticMutex() );
     919        2255 :     return m_pDataContainer->GetStripeColorB();
     920             : }
     921             : 
     922             : 
     923             : //  public method
     924             : 
     925        2255 : sal_uInt16 SvtOptionsDrawinglayer::GetStripeLength() const
     926             : {
     927        2255 :     MutexGuard aGuard( GetOwnStaticMutex() );
     928        2255 :     return m_pDataContainer->GetStripeLength();
     929             : }
     930             : 
     931             : // #i73602#
     932         546 : bool SvtOptionsDrawinglayer::IsOverlayBuffer_Calc() const
     933             : {
     934         546 :     MutexGuard aGuard( GetOwnStaticMutex() );
     935         546 :     return m_pDataContainer->IsOverlayBuffer_Calc();
     936             : }
     937             : 
     938        5318 : bool SvtOptionsDrawinglayer::IsOverlayBuffer_Writer() const
     939             : {
     940        5318 :     MutexGuard aGuard( GetOwnStaticMutex() );
     941        5318 :     return m_pDataContainer->IsOverlayBuffer_Writer();
     942             : }
     943             : 
     944         568 : bool SvtOptionsDrawinglayer::IsOverlayBuffer_DrawImpress() const
     945             : {
     946         568 :     MutexGuard aGuard( GetOwnStaticMutex() );
     947         568 :     return m_pDataContainer->IsOverlayBuffer_DrawImpress();
     948             : }
     949             : 
     950             : // #i74769#, #i75172#
     951         546 : bool SvtOptionsDrawinglayer::IsPaintBuffer_Calc() const
     952             : {
     953         546 :     MutexGuard aGuard( GetOwnStaticMutex() );
     954         546 :     return m_pDataContainer->IsPaintBuffer_Calc();
     955             : }
     956             : 
     957        5318 : bool SvtOptionsDrawinglayer::IsPaintBuffer_Writer() const
     958             : {
     959        5318 :     MutexGuard aGuard( GetOwnStaticMutex() );
     960        5318 :     return m_pDataContainer->IsPaintBuffer_Writer();
     961             : }
     962             : 
     963         568 : bool SvtOptionsDrawinglayer::IsPaintBuffer_DrawImpress() const
     964             : {
     965         568 :     MutexGuard aGuard( GetOwnStaticMutex() );
     966         568 :     return m_pDataContainer->IsPaintBuffer_DrawImpress();
     967             : }
     968             : 
     969             : // #i4219#
     970           0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperWidth() const
     971             : {
     972           0 :     MutexGuard aGuard( GetOwnStaticMutex() );
     973           0 :     return m_pDataContainer->GetMaximumPaperWidth();
     974             : }
     975             : 
     976           0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperHeight() const
     977             : {
     978           0 :     MutexGuard aGuard( GetOwnStaticMutex() );
     979           0 :     return m_pDataContainer->GetMaximumPaperHeight();
     980             : }
     981             : 
     982           0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperLeftMargin() const
     983             : {
     984           0 :     MutexGuard aGuard( GetOwnStaticMutex() );
     985           0 :     return m_pDataContainer->GetMaximumPaperLeftMargin();
     986             : }
     987             : 
     988           0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperRightMargin() const
     989             : {
     990           0 :     MutexGuard aGuard( GetOwnStaticMutex() );
     991           0 :     return m_pDataContainer->GetMaximumPaperRightMargin();
     992             : }
     993             : 
     994           0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperTopMargin() const
     995             : {
     996           0 :     MutexGuard aGuard( GetOwnStaticMutex() );
     997           0 :     return m_pDataContainer->GetMaximumPaperTopMargin();
     998             : }
     999             : 
    1000           0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperBottomMargin() const
    1001             : {
    1002           0 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1003           0 :     return m_pDataContainer->GetMaximumPaperBottomMargin();
    1004             : }
    1005             : 
    1006             : // helper
    1007      263087 : bool SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem() const
    1008             : {
    1009      263087 :     return m_pDataContainer->IsAAPossibleOnThisSystem();
    1010             : }
    1011             : 
    1012             : // primitives
    1013      263087 : bool SvtOptionsDrawinglayer::IsAntiAliasing() const
    1014             : {
    1015      263087 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1016      263087 :     return m_pDataContainer->IsAntiAliasing() && IsAAPossibleOnThisSystem();
    1017             : }
    1018             : 
    1019           0 : bool SvtOptionsDrawinglayer::IsSnapHorVerLinesToDiscrete() const
    1020             : {
    1021           0 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1022           0 :     return m_pDataContainer->IsAntiAliasing() && m_pDataContainer->IsSnapHorVerLinesToDiscrete();
    1023             : }
    1024             : 
    1025       18858 : bool SvtOptionsDrawinglayer::IsSolidDragCreate() const
    1026             : {
    1027       18858 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1028       18858 :     return m_pDataContainer->IsSolidDragCreate();
    1029             : }
    1030             : 
    1031        1061 : bool SvtOptionsDrawinglayer::IsRenderDecoratedTextDirect() const
    1032             : {
    1033        1061 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1034        1061 :     return m_pDataContainer->IsRenderDecoratedTextDirect();
    1035             : }
    1036             : 
    1037        7756 : bool SvtOptionsDrawinglayer::IsRenderSimpleTextDirect() const
    1038             : {
    1039        7756 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1040        7756 :     return m_pDataContainer->IsRenderSimpleTextDirect();
    1041             : }
    1042             : 
    1043          21 : sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const
    1044             : {
    1045          21 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1046          21 :     return m_pDataContainer->GetQuadratic3DRenderLimit();
    1047             : }
    1048             : 
    1049           2 : sal_uInt32 SvtOptionsDrawinglayer::GetQuadraticFormControlRenderLimit() const
    1050             : {
    1051           2 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1052           2 :     return m_pDataContainer->GetQuadraticFormControlRenderLimit();
    1053             : }
    1054             : 
    1055           0 : void SvtOptionsDrawinglayer::SetAntiAliasing( bool bState )
    1056             : {
    1057           0 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1058           0 :     m_pDataContainer->SetAntiAliasing( bState );
    1059           0 : }
    1060             : 
    1061             : // #i97672# selection settings
    1062       12902 : bool SvtOptionsDrawinglayer::IsTransparentSelection() const
    1063             : {
    1064       12902 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1065       12902 :     return m_pDataContainer->IsTransparentSelection();
    1066             : }
    1067             : 
    1068           0 : void SvtOptionsDrawinglayer::SetTransparentSelection( bool bState )
    1069             : {
    1070           0 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1071           0 :     m_pDataContainer->SetTransparentSelection( bState );
    1072           0 : }
    1073             : 
    1074       13052 : sal_uInt16 SvtOptionsDrawinglayer::GetTransparentSelectionPercent() const
    1075             : {
    1076       13052 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1077       13052 :     sal_uInt16 aRetval(m_pDataContainer->GetTransparentSelectionPercent());
    1078             : 
    1079             :     // crop to range [10% .. 90%]
    1080       13052 :     if(aRetval < 10)
    1081             :     {
    1082           0 :         aRetval = 10;
    1083             :     }
    1084             : 
    1085       13052 :     if(aRetval > 90)
    1086             :     {
    1087           0 :         aRetval = 90;
    1088             :     }
    1089             : 
    1090       13052 :     return aRetval;
    1091             : }
    1092             : 
    1093           0 : void SvtOptionsDrawinglayer::SetTransparentSelectionPercent( sal_uInt16 nPercent )
    1094             : {
    1095           0 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1096             : 
    1097             :     // crop to range [10% .. 90%]
    1098           0 :     if(nPercent < 10)
    1099             :     {
    1100           0 :         nPercent = 10;
    1101             :     }
    1102             : 
    1103           0 :     if(nPercent > 90)
    1104             :     {
    1105           0 :         nPercent = 90;
    1106             :     }
    1107             : 
    1108           0 :     m_pDataContainer->SetTransparentSelectionPercent( nPercent );
    1109           0 : }
    1110             : 
    1111         578 : sal_uInt16 SvtOptionsDrawinglayer::GetSelectionMaximumLuminancePercent() const
    1112             : {
    1113         578 :     MutexGuard aGuard( GetOwnStaticMutex() );
    1114         578 :     sal_uInt16 aRetval(m_pDataContainer->GetSelectionMaximumLuminancePercent());
    1115             : 
    1116             :     // crop to range [0% .. 100%]
    1117         578 :     if(aRetval > 90)
    1118             :     {
    1119           0 :         aRetval = 90;
    1120             :     }
    1121             : 
    1122         578 :     return aRetval;
    1123             : }
    1124             : 
    1125         578 : Color SvtOptionsDrawinglayer::getHilightColor() const
    1126             : {
    1127         578 :     Color aRetval(Application::GetSettings().GetStyleSettings().GetHighlightColor());
    1128         578 :     const basegfx::BColor aSelection(aRetval.getBColor());
    1129         578 :     const double fLuminance(aSelection.luminance());
    1130         578 :     const double fMaxLum(GetSelectionMaximumLuminancePercent() / 100.0);
    1131             : 
    1132         578 :     if(fLuminance > fMaxLum)
    1133             :     {
    1134           0 :         const double fFactor(fMaxLum / fLuminance);
    1135             :         const basegfx::BColor aNewSelection(
    1136           0 :             aSelection.getRed() * fFactor,
    1137           0 :             aSelection.getGreen() * fFactor,
    1138           0 :             aSelection.getBlue() * fFactor);
    1139             : 
    1140           0 :         aRetval = Color(aNewSelection);
    1141             :     }
    1142             : 
    1143         578 :     return aRetval;
    1144             : }
    1145             : 
    1146             : namespace
    1147             : {
    1148             :     class theOptionsDrawinglayerMutex : public rtl::Static<osl::Mutex, theOptionsDrawinglayerMutex>{};
    1149             : }
    1150             : 
    1151             : 
    1152             : //  private method
    1153             : 
    1154      597846 : Mutex& SvtOptionsDrawinglayer::GetOwnStaticMutex()
    1155             : {
    1156      597846 :     return theOptionsDrawinglayerMutex::get();
    1157        1227 : }
    1158             : 
    1159             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10