LCOV - code coverage report
Current view: top level - libreoffice/reportdesign/source/ui/misc - UITools.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 510 0.0 %
Date: 2012-12-27 Functions: 0 34 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <toolkit/helper/convert.hxx>
      22             : #include <toolkit/helper/vclunohelper.hxx>
      23             : #include "SectionView.hxx"
      24             : #include "UITools.hxx"
      25             : #include "Formula.hxx"
      26             : #include "FunctionHelper.hxx"
      27             : #include "reportformula.hxx"
      28             : 
      29             : #include <tools/diagnose_ex.h>
      30             : #include <tools/string.hxx>
      31             : 
      32             : #include <vcl/svapp.hxx>
      33             : #include <vcl/window.hxx>
      34             : #include <com/sun/star/lang/NullPointerException.hpp>
      35             : #include <com/sun/star/beans/NamedValue.hpp>
      36             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      37             : #include <svx/svdpool.hxx>
      38             : 
      39             : #include <editeng/charscaleitem.hxx>
      40             : #include <svx/algitem.hxx>
      41             : #include <svx/svdpagv.hxx>
      42             : #include <svx/xtable.hxx>       // XColorList
      43             : #include <editeng/brshitem.hxx>
      44             : #include <editeng/fontitem.hxx>
      45             : #include <editeng/emphitem.hxx>
      46             : #include <editeng/postitem.hxx>
      47             : #include <editeng/udlnitem.hxx>
      48             : #include <editeng/crsditem.hxx>
      49             : #include <editeng/cntritem.hxx>
      50             : #include <editeng/langitem.hxx>
      51             : #include <editeng/wghtitem.hxx>
      52             : #include <editeng/fhgtitem.hxx>
      53             : #include <editeng/shdditem.hxx>
      54             : #include <editeng/escpitem.hxx>
      55             : #include <editeng/prszitem.hxx>
      56             : #include <editeng/wrlmitem.hxx>
      57             : #include <editeng/cmapitem.hxx>
      58             : #include <editeng/kernitem.hxx>
      59             : #include <editeng/blnkitem.hxx>
      60             : #include <editeng/flstitem.hxx>
      61             : #include <editeng/akrnitem.hxx>
      62             : #include <editeng/colritem.hxx>
      63             : #include <editeng/justifyitem.hxx>
      64             : #include <svx/drawitem.hxx>
      65             : #include <editeng/twolinesitem.hxx>
      66             : #include <editeng/charreliefitem.hxx>
      67             : #include <editeng/charrotateitem.hxx>
      68             : #include <editeng/charhiddenitem.hxx>
      69             : #include <svx/xgrscit.hxx>
      70             : #include <svx/svditer.hxx>
      71             : #include <svx/xtable.hxx>
      72             : #include <svx/dialogs.hrc>
      73             : #include <svx/svdview.hxx>
      74             : #include <svx/svdpage.hxx>
      75             : #include <svx/svxdlg.hxx>
      76             : #include <svx/unoprov.hxx>
      77             : 
      78             : #include <unotools/pathoptions.hxx>
      79             : #include <svtools/ctrltool.hxx>
      80             : #include <svl/itempool.hxx>
      81             : #include <svl/itemset.hxx>
      82             : 
      83             : #include <comphelper/propmultiplex.hxx>
      84             : #include <comphelper/namedvaluecollection.hxx>
      85             : 
      86             : #include <connectivity/dbexception.hxx>
      87             : #include <connectivity/dbconversion.hxx>
      88             : #include <connectivity/dbtools.hxx>
      89             : 
      90             : #include <com/sun/star/report/XGroups.hpp>
      91             : #include <com/sun/star/awt/TextAlign.hpp>
      92             : #include <com/sun/star/style/VerticalAlignment.hpp>
      93             : #include <com/sun/star/report/XShape.hpp>
      94             : #include <com/sun/star/report/Function.hpp>
      95             : #include <com/sun/star/sdb/XParametersSupplier.hpp>
      96             : #include <com/sun/star/sdb/SQLContext.hpp>
      97             : #include <i18npool/languagetag.hxx>
      98             : #include "dlgpage.hxx"
      99             : #include <vcl/msgbox.hxx>
     100             : #include "rptui_slotid.hrc"
     101             : #include "uistrings.hrc"
     102             : #include "RptObject.hxx"
     103             : #include "ModuleHelper.hxx"
     104             : #include "RptDef.hxx"
     105             : #include "RptResId.hrc"
     106             : #include "ReportDefinition.hxx"
     107             : #include "RptModel.hxx"
     108             : 
     109             : #define ITEMID_FONT                     10
     110             : #define ITEMID_FONTHEIGHT               11
     111             : #define ITEMID_LANGUAGE                 12
     112             : 
     113             : #define ITEMID_POSTURE                  13
     114             : #define ITEMID_WEIGHT                   14
     115             : #define ITEMID_SHADOWED                 15
     116             : #define ITEMID_WORDLINEMODE             16
     117             : #define ITEMID_CONTOUR                  17
     118             : #define ITEMID_CROSSEDOUT               18
     119             : #define ITEMID_UNDERLINE                19
     120             : 
     121             : #define ITEMID_COLOR                    20
     122             : #define ITEMID_KERNING                  21
     123             : #define ITEMID_CASEMAP                  22
     124             : 
     125             : #define ITEMID_ESCAPEMENT               23
     126             : #define ITEMID_FONTLIST                 24
     127             : #define ITEMID_AUTOKERN                 25
     128             : #define ITEMID_COLOR_TABLE              26
     129             : #define ITEMID_BLINK                    27
     130             : #define ITEMID_EMPHASISMARK             28
     131             : #define ITEMID_TWOLINES                 29
     132             : #define ITEMID_CHARROTATE               30
     133             : #define ITEMID_CHARSCALE_W              31
     134             : #define ITEMID_CHARRELIEF               32
     135             : #define ITEMID_CHARHIDDEN               33
     136             : #define ITEMID_BRUSH                    34
     137             : #define ITEMID_HORJUSTIFY               35
     138             : #define ITEMID_VERJUSTIFY               36
     139             : #define ITEMID_FONT_ASIAN               37
     140             : #define ITEMID_FONTHEIGHT_ASIAN         38
     141             : #define ITEMID_LANGUAGE_ASIAN           39
     142             : #define ITEMID_POSTURE_ASIAN            40
     143             : #define ITEMID_WEIGHT_ASIAN             41
     144             : #define ITEMID_FONT_COMPLEX             42
     145             : #define ITEMID_FONTHEIGHT_COMPLEX       43
     146             : #define ITEMID_LANGUAGE_COMPLEX         44
     147             : #define ITEMID_POSTURE_COMPLEX          45
     148             : #define ITEMID_WEIGHT_COMPLEX           46
     149             : 
     150             : #define WESTERN 0
     151             : #define ASIAN   1
     152             : #define COMPLEX 2
     153             : 
     154             : namespace rptui
     155             : {
     156             : using namespace ::com::sun::star;
     157             : using namespace formula;
     158             : // -----------------------------------------------------------------------------
     159           0 : void adjustSectionName(const uno::Reference< report::XGroup >& _xGroup,sal_Int32 _nPos)
     160             : {
     161             :     OSL_ENSURE(_xGroup.is(),"Group is NULL -> GPF");
     162           0 :     if ( _xGroup->getHeaderOn() && _xGroup->getHeader()->getName().isEmpty() )
     163             :     {
     164           0 :         ::rtl::OUString sName = String(ModuleRes(RID_STR_GROUPHEADER));
     165           0 :         sName += ::rtl::OUString::valueOf(_nPos);
     166           0 :         _xGroup->getHeader()->setName(sName);
     167             :     }
     168             : 
     169           0 :     if ( _xGroup->getFooterOn() && _xGroup->getFooter()->getName().isEmpty() )
     170             :     {
     171           0 :         ::rtl::OUString sName = String(ModuleRes(RID_STR_GROUPFOOTER));
     172           0 :         sName += ::rtl::OUString::valueOf(_nPos);
     173           0 :         _xGroup->getFooter()->setName(sName);
     174             :     }
     175           0 : }
     176             : // -----------------------------------------------------------------------------
     177           0 : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> addStyleListener(const uno::Reference< report::XReportDefinition >& _xReportDefinition,::comphelper::OPropertyChangeListener* _pListener)
     178             : {
     179           0 :     ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> pRet = NULL;
     180           0 :     if ( _xReportDefinition.is() )
     181             :     {
     182           0 :         uno::Reference<beans::XPropertySet> xPageStyle(getUsedStyle(_xReportDefinition),uno::UNO_QUERY);
     183           0 :         if ( xPageStyle.is() )
     184             :         {
     185           0 :             pRet = new comphelper::OPropertyChangeMultiplexer(_pListener,xPageStyle);
     186           0 :             pRet->addProperty(PROPERTY_LEFTMARGIN);
     187           0 :             pRet->addProperty(PROPERTY_RIGHTMARGIN);
     188           0 :             pRet->addProperty(PROPERTY_PAPERSIZE);
     189           0 :             pRet->addProperty(PROPERTY_BACKCOLOR);
     190           0 :         }
     191             :     }
     192           0 :     return pRet;
     193             : }
     194             : 
     195             : // -----------------------------------------------------------------------------
     196             : namespace
     197             : {
     198             :     // -------------------------------------------------------------------------
     199           0 :     Font lcl_getReportControlFont( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat, awt::FontDescriptor& _out_rControlFont ,sal_uInt16 _nWichFont)
     200             :     {
     201           0 :         if ( !_rxReportControlFormat.is() )
     202           0 :             throw uno::RuntimeException();
     203             : 
     204           0 :         switch(_nWichFont)
     205             :         {
     206             :             case WESTERN:
     207           0 :                 _out_rControlFont = _rxReportControlFormat->getFontDescriptor();
     208           0 :                 break;
     209             :             case ASIAN:
     210           0 :                 _out_rControlFont = _rxReportControlFormat->getFontDescriptorAsian();
     211           0 :                 break;
     212             :             case COMPLEX:
     213           0 :                 _out_rControlFont = _rxReportControlFormat->getFontDescriptorComplex();
     214           0 :                 break;
     215             : 
     216             :         }
     217             : 
     218           0 :         Font aDefaultFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont();
     219           0 :         return VCLUnoHelper::CreateFont( _out_rControlFont, aDefaultFont );
     220             :     }
     221             : 
     222             :     // -------------------------------------------------------------------------
     223           0 :     Font lcl_getReportControlFont( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,sal_uInt16 _nWhich )
     224             :     {
     225           0 :         awt::FontDescriptor aAwtFont;
     226           0 :         return lcl_getReportControlFont( _rxReportControlFormat, aAwtFont, _nWhich );
     227             :     }
     228             :     // -------------------------------------------------------------------------
     229           0 :     const Font lcl_setFont(const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
     230             :         SfxItemSet& _rItemSet,sal_uInt16 _nWhich,sal_uInt16 _nFont, sal_uInt16 _nFontHeight,sal_uInt16 _nLanguage,sal_uInt16 _nPosture, sal_uInt16 _nWeight)
     231             :     {
     232             :         // fill it
     233           0 :         awt::FontDescriptor aControlFont;
     234           0 :         const Font aFont( lcl_getReportControlFont( _rxReportControlFormat, aControlFont,_nWhich ) );
     235             : 
     236           0 :         SvxFontItem aFontItem(_nFont);
     237           0 :         aFontItem.PutValue( uno::makeAny( aControlFont ) );
     238           0 :         _rItemSet.Put(aFontItem);
     239             : 
     240           0 :         _rItemSet.Put(SvxFontHeightItem(OutputDevice::LogicToLogic(Size(0, (sal_Int32)aFont.GetHeight()), MAP_POINT, MAP_TWIP).Height(),100,_nFontHeight));
     241           0 :         lang::Locale aLocale;
     242           0 :         switch(_nWhich)
     243             :         {
     244             :             default:
     245           0 :                 aLocale = _rxReportControlFormat->getCharLocale();
     246           0 :                 break;
     247             :             case ASIAN:
     248           0 :                 aLocale = _rxReportControlFormat->getCharLocaleAsian();
     249           0 :                 break;
     250             :             case COMPLEX:
     251           0 :                 aLocale = _rxReportControlFormat->getCharLocaleComplex();
     252           0 :                 break;
     253             :         }
     254             : 
     255           0 :         _rItemSet.Put(SvxLanguageItem(LanguageTag(aLocale).makeFallback().getLanguageType(),_nLanguage));
     256             : 
     257           0 :         _rItemSet.Put(SvxPostureItem(aFont.GetItalic(),_nPosture));
     258           0 :         _rItemSet.Put(SvxWeightItem(aFont.GetWeight(),_nWeight));
     259           0 :         return aFont;
     260             :     }
     261             : 
     262           0 :     void lcl_fillShapeToItems( const uno::Reference<report::XShape >& _xShape,SfxItemSet& _rItemSet )
     263             :     {
     264           0 :         uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo();
     265           0 :         SvxUnoPropertyMapProvider aMap;
     266           0 :         const SfxItemPropertyMap* pPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap();
     267           0 :         PropertyEntryVector_t aPropVector = pPropertyMap->getPropertyEntries();
     268           0 :         PropertyEntryVector_t::const_iterator aIt = aPropVector.begin();
     269           0 :         while( aIt != aPropVector.end() )
     270             :         {
     271           0 :             if ( xInfo->hasPropertyByName(aIt->sName) )
     272             :             {
     273           0 :                 const SfxPoolItem* pItem = _rItemSet.GetItem(aIt->nWID);
     274           0 :                 if ( pItem )
     275             :                 {
     276             :                     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     277           0 :                     ::std::auto_ptr<SfxPoolItem> pClone(pItem->Clone());
     278             :                     SAL_WNODEPRECATED_DECLARATIONS_POP
     279           0 :                     pClone->PutValue(_xShape->getPropertyValue(aIt->sName), aIt->nMemberId);
     280           0 :                     _rItemSet.Put(*pClone, aIt->nWID);
     281             :                 }
     282             :             }
     283           0 :             ++aIt;
     284           0 :         }
     285           0 :     }
     286             : 
     287           0 :     void lcl_fillItemsToShape( const uno::Reference<report::XShape >& _xShape,const SfxItemSet& _rItemSet )
     288             :     {
     289           0 :         const uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo();
     290           0 :         SvxUnoPropertyMapProvider aMap;
     291           0 :         const SfxItemPropertyMap* pPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap();
     292           0 :         PropertyEntryVector_t aPropVector = pPropertyMap->getPropertyEntries();
     293           0 :         PropertyEntryVector_t::const_iterator aIt = aPropVector.begin();
     294           0 :         while( aIt != aPropVector.end() )
     295             :         {
     296           0 :             if ( SFX_ITEM_SET == _rItemSet.GetItemState(aIt->nWID) && xInfo->hasPropertyByName(aIt->sName) )
     297             :             {
     298           0 :                 const beans::Property aProp = xInfo->getPropertyByName( aIt->sName );
     299           0 :                 if ( ( aIt->nFlags & beans::PropertyAttribute::READONLY ) != beans::PropertyAttribute::READONLY )
     300             :                 {
     301           0 :                     const SfxPoolItem* pItem = _rItemSet.GetItem(aIt->nWID);
     302           0 :                     if ( pItem )
     303             :                     {
     304           0 :                         uno::Any aValue;
     305           0 :                         pItem->QueryValue(aValue,aIt->nMemberId);
     306             :                         try
     307             :                         {
     308           0 :                             _xShape->setPropertyValue(aIt->sName, aValue);
     309             :                         }
     310           0 :                         catch(uno::Exception&)
     311             :                         { // shapes have a bug so we ignore this one.
     312           0 :                         }
     313             :                     }
     314           0 :                 }
     315             :             }
     316           0 :             ++aIt;
     317           0 :         }
     318           0 :     }
     319             :     // -------------------------------------------------------------------------
     320           0 :     void lcl_CharPropertiesToItems( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
     321             :         SfxItemSet& _rItemSet )
     322             :     {
     323           0 :         if ( !_rxReportControlFormat.is() )
     324           0 :             throw lang::NullPointerException();
     325             : 
     326           0 :         uno::Reference< beans::XPropertySet > xSet(_rxReportControlFormat,uno::UNO_QUERY_THROW);
     327             : 
     328             :         // fill it
     329           0 :         const Font aFont( lcl_setFont(_rxReportControlFormat, _rItemSet,WESTERN,ITEMID_FONT,ITEMID_FONTHEIGHT,ITEMID_LANGUAGE,ITEMID_POSTURE,ITEMID_WEIGHT ) );
     330             : 
     331           0 :         _rItemSet.Put(SvxShadowedItem(_rxReportControlFormat->getCharShadowed(),ITEMID_SHADOWED));
     332           0 :         _rItemSet.Put(SvxWordLineModeItem(aFont.IsWordLineMode(),ITEMID_WORDLINEMODE));
     333           0 :         _rItemSet.Put(SvxContourItem(_rxReportControlFormat->getCharContoured(),ITEMID_CONTOUR));
     334           0 :         _rItemSet.Put(SvxAutoKernItem(_rxReportControlFormat->getCharAutoKerning(),ITEMID_AUTOKERN));
     335           0 :         _rItemSet.Put(SvxCrossedOutItem(aFont.GetStrikeout(),ITEMID_CROSSEDOUT));
     336           0 :         _rItemSet.Put(SvxCaseMapItem(static_cast<SvxCaseMap>(_rxReportControlFormat->getCharCaseMap()),ITEMID_CASEMAP));
     337             : 
     338           0 :         _rItemSet.Put(SvxEscapementItem(_rxReportControlFormat->getCharEscapement(),_rxReportControlFormat->getCharEscapementHeight(),ITEMID_ESCAPEMENT));
     339           0 :         _rItemSet.Put(SvxBlinkItem(_rxReportControlFormat->getCharFlash(),ITEMID_BLINK));
     340           0 :         _rItemSet.Put(SvxCharHiddenItem(_rxReportControlFormat->getCharHidden(),ITEMID_CHARHIDDEN));
     341           0 :         _rItemSet.Put(SvxTwoLinesItem(_rxReportControlFormat->getCharCombineIsOn(),_rxReportControlFormat->getCharCombinePrefix().toChar(),_rxReportControlFormat->getCharCombineSuffix().toChar(),ITEMID_TWOLINES));
     342           0 :         SvxUnderlineItem aUnderLineItem(aFont.GetUnderline(),ITEMID_UNDERLINE);
     343           0 :         aUnderLineItem.SetColor(_rxReportControlFormat->getCharUnderlineColor());
     344           0 :         _rItemSet.Put(aUnderLineItem);
     345           0 :         _rItemSet.Put(SvxKerningItem(_rxReportControlFormat->getCharKerning(),ITEMID_KERNING));
     346           0 :         _rItemSet.Put(SvxEmphasisMarkItem(static_cast<FontEmphasisMark>(_rxReportControlFormat->getCharEmphasis()),ITEMID_EMPHASISMARK));
     347           0 :         _rItemSet.Put(SvxCharReliefItem(static_cast<FontRelief>(_rxReportControlFormat->getCharRelief()),ITEMID_CHARRELIEF));
     348           0 :         _rItemSet.Put(SvxColorItem(::Color(_rxReportControlFormat->getCharColor()),ITEMID_COLOR));
     349           0 :         _rItemSet.Put(SvxCharRotateItem(_rxReportControlFormat->getCharRotation(),sal_False,ITEMID_CHARROTATE));
     350           0 :         _rItemSet.Put(SvxCharScaleWidthItem(_rxReportControlFormat->getCharScaleWidth(),ITEMID_CHARSCALE_W));
     351             : 
     352           0 :         SvxHorJustifyItem aHorJustifyItem(ITEMID_HORJUSTIFY);
     353           0 :         aHorJustifyItem.PutValue(xSet->getPropertyValue(PROPERTY_PARAADJUST),MID_HORJUST_ADJUST);
     354           0 :         _rItemSet.Put(aHorJustifyItem);
     355           0 :         SvxVerJustifyItem aVerJustifyItem(ITEMID_VERJUSTIFY);
     356           0 :         aVerJustifyItem.PutValue(xSet->getPropertyValue(PROPERTY_VERTICALALIGN),MID_HORJUST_ADJUST);
     357           0 :         _rItemSet.Put(aVerJustifyItem);
     358             : 
     359           0 :         uno::Reference< report::XShape> xShape(_rxReportControlFormat,uno::UNO_QUERY);
     360           0 :         if ( !xShape.is() )
     361           0 :             _rItemSet.Put(SvxBrushItem(::Color(_rxReportControlFormat->getControlBackground()),ITEMID_BRUSH));
     362             : 
     363           0 :         lcl_setFont(_rxReportControlFormat, _rItemSet,ASIAN,ITEMID_FONT_ASIAN,ITEMID_FONTHEIGHT_ASIAN,ITEMID_LANGUAGE_ASIAN,ITEMID_POSTURE_ASIAN,ITEMID_WEIGHT_ASIAN );
     364           0 :         lcl_setFont(_rxReportControlFormat, _rItemSet,COMPLEX,ITEMID_FONT_COMPLEX,ITEMID_FONTHEIGHT_COMPLEX,ITEMID_LANGUAGE_COMPLEX,ITEMID_POSTURE_COMPLEX,ITEMID_WEIGHT_COMPLEX );
     365           0 :     }
     366             : 
     367             :     // -------------------------------------------------------------------------
     368           0 :     void lcl_pushBack( uno::Sequence< beans::NamedValue >& _out_rProperties, const ::rtl::OUString& _sName, const uno::Any& _rValue )
     369             :     {
     370           0 :         sal_Int32 nLen( _out_rProperties.getLength() );
     371           0 :         _out_rProperties.realloc( nLen + 1 );
     372           0 :         _out_rProperties[ nLen ] = beans::NamedValue( _sName, _rValue );
     373           0 :     }
     374             : 
     375             :     // -------------------------------------------------------------------------
     376           0 :     void lcl_initAwtFont( const Font& _rOriginalFont, const SfxItemSet& _rItemSet, awt::FontDescriptor& _out_rAwtFont,
     377             :         sal_uInt16 _nFont, sal_uInt16 _nFontHeight,sal_uInt16 _nPosture, sal_uInt16 _nWeight)
     378             :     {
     379           0 :         Font aNewFont( _rOriginalFont );
     380           0 :         const SfxPoolItem* pItem( NULL );
     381           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nFont,sal_True,&pItem) && pItem->ISA(SvxFontItem))
     382             :         {
     383           0 :             const SvxFontItem* pFontItem = static_cast<const SvxFontItem*>(pItem);
     384           0 :             aNewFont.SetName( pFontItem->GetFamilyName());
     385           0 :             aNewFont.SetStyleName(pFontItem->GetStyleName());
     386           0 :             aNewFont.SetFamily(pFontItem->GetFamily());
     387           0 :             aNewFont.SetPitch(pFontItem->GetPitch());
     388           0 :             aNewFont.SetCharSet(pFontItem->GetCharSet());
     389             :         }
     390           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nFontHeight,sal_True,&pItem) && pItem->ISA(SvxFontHeightItem))
     391             :         {
     392           0 :             const SvxFontHeightItem* pFontItem = static_cast<const SvxFontHeightItem*>(pItem);
     393           0 :             aNewFont.SetHeight(OutputDevice::LogicToLogic(Size(0, pFontItem->GetHeight()), MAP_TWIP, MAP_POINT).Height());
     394             :         }
     395           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nPosture,sal_True,&pItem) && pItem->ISA(SvxPostureItem))
     396             :         {
     397           0 :             const SvxPostureItem* pFontItem = static_cast<const SvxPostureItem*>(pItem);
     398           0 :             aNewFont.SetItalic(pFontItem->GetPosture());
     399             :         }
     400           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nWeight,sal_True,&pItem) && pItem->ISA(SvxWeightItem))
     401             :         {
     402           0 :             const SvxWeightItem* pFontItem = static_cast<const SvxWeightItem*>(pItem);
     403           0 :             aNewFont.SetWeight(pFontItem->GetWeight());
     404             :         }
     405           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_WORDLINEMODE,sal_True,&pItem) && pItem->ISA(SvxWordLineModeItem))
     406             :         {
     407           0 :             const SvxWordLineModeItem* pFontItem = static_cast<const SvxWordLineModeItem*>(pItem);
     408           0 :             aNewFont.SetWordLineMode(pFontItem->GetValue());
     409             :         }
     410           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CROSSEDOUT,sal_True,&pItem) && pItem->ISA(SvxCrossedOutItem))
     411             :         {
     412           0 :             const SvxCrossedOutItem* pFontItem = static_cast<const SvxCrossedOutItem*>(pItem);
     413           0 :             aNewFont.SetStrikeout(pFontItem->GetStrikeout());
     414             :         }
     415             : 
     416           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARROTATE,sal_True,&pItem) && pItem->ISA(SvxCharRotateItem))
     417             :         {
     418           0 :             const SvxCharRotateItem* pRotateItem = static_cast<const SvxCharRotateItem*>(pItem);
     419           0 :             aNewFont.SetOrientation(pRotateItem->GetValue());
     420             :         }
     421           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARSCALE_W,sal_True,&pItem) && pItem->ISA(SvxCharScaleWidthItem))
     422             :         {
     423           0 :             const SvxCharScaleWidthItem* pCharItem = static_cast<const SvxCharScaleWidthItem*>(pItem);
     424           0 :             aNewFont.SetWidthType(VCLUnoHelper::ConvertFontWidth(pCharItem->GetValue()));
     425             :         }
     426           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_UNDERLINE,sal_True,&pItem) && pItem->ISA(SvxUnderlineItem))
     427             :         {
     428           0 :             const SvxUnderlineItem* pFontItem = static_cast<const SvxUnderlineItem*>(pItem);
     429           0 :             aNewFont.SetUnderline(pFontItem->GetLineStyle());
     430             :         }
     431           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_COLOR,sal_True,&pItem) && pItem->ISA(SvxColorItem))
     432             :         {
     433           0 :             const SvxColorItem* pFontItem = static_cast<const SvxColorItem*>(pItem);
     434           0 :             aNewFont.SetColor(pFontItem->GetValue().GetColor());
     435             :         }
     436             : 
     437           0 :         _out_rAwtFont = VCLUnoHelper::CreateFontDescriptor( aNewFont );
     438           0 :     }
     439             : 
     440             :     // -------------------------------------------------------------------------
     441           0 :     void lcl_itemsToCharProperties( const Font& _rOriginalControlFont,const Font& _rOriginalControlFontAsian,const Font& _rOriginalControlFontComplex, const SfxItemSet& _rItemSet, uno::Sequence< beans::NamedValue >& _out_rProperties )
     442             :     {
     443           0 :         const SfxPoolItem* pItem( NULL );
     444             : 
     445             :         // create an AWT font
     446           0 :         awt::FontDescriptor aAwtFont;
     447           0 :         lcl_initAwtFont( _rOriginalControlFont, _rItemSet, aAwtFont,ITEMID_FONT,ITEMID_FONTHEIGHT,ITEMID_POSTURE, ITEMID_WEIGHT);
     448           0 :         lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Font")), uno::makeAny( aAwtFont ) );
     449           0 :         lcl_initAwtFont( _rOriginalControlFontAsian, _rItemSet, aAwtFont,ITEMID_FONT_ASIAN,ITEMID_FONTHEIGHT_ASIAN,ITEMID_POSTURE_ASIAN, ITEMID_WEIGHT_ASIAN);
     450           0 :         lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FontAsian")), uno::makeAny( aAwtFont ) );
     451           0 :         lcl_initAwtFont( _rOriginalControlFontComplex, _rItemSet, aAwtFont,ITEMID_FONT_COMPLEX,ITEMID_FONTHEIGHT_COMPLEX,ITEMID_POSTURE_COMPLEX, ITEMID_WEIGHT_COMPLEX);
     452           0 :         lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FontComplex")), uno::makeAny( aAwtFont ) );
     453             : 
     454             :         // properties which cannot be represented in an AWT font need to be preserved directly
     455           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_SHADOWED,sal_True,&pItem) && pItem->ISA(SvxShadowedItem))
     456             :         {
     457           0 :             const SvxShadowedItem* pFontItem = static_cast<const SvxShadowedItem*>(pItem);
     458           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARSHADOWED, uno::makeAny( pFontItem->GetValue() ) );
     459             :         }
     460           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CONTOUR,sal_True,&pItem) && pItem->ISA(SvxContourItem))
     461             :         {
     462           0 :             const SvxContourItem* pFontItem = static_cast<const SvxContourItem*>(pItem);
     463           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARCONTOURED, uno::makeAny( pFontItem->GetValue() ) );
     464             :         }
     465           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_UNDERLINE,sal_True,&pItem) && pItem->ISA(SvxUnderlineItem))
     466             :         {
     467           0 :             const SvxUnderlineItem* pFontItem = static_cast<const SvxUnderlineItem*>(pItem);
     468           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARUNDERLINECOLOR, uno::makeAny( pFontItem->GetColor().GetColor() ) );
     469             :         }
     470           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_HORJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxHorJustifyItem))
     471             :         {
     472           0 :             const SvxHorJustifyItem* pJustifyItem = static_cast<const SvxHorJustifyItem*>(pItem);
     473           0 :             uno::Any aValue;
     474           0 :             pJustifyItem->QueryValue(aValue,MID_HORJUST_ADJUST);
     475           0 :             lcl_pushBack( _out_rProperties, PROPERTY_PARAADJUST, aValue );
     476             :         }
     477           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_VERJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxVerJustifyItem))
     478             :         {
     479           0 :             const SvxVerJustifyItem* pJustifyItem = static_cast<const SvxVerJustifyItem*>(pItem);
     480           0 :             uno::Any aValue;
     481           0 :             pJustifyItem->QueryValue(aValue,MID_HORJUST_ADJUST);
     482           0 :             lcl_pushBack( _out_rProperties, PROPERTY_VERTICALALIGN, aValue );
     483             :         }
     484           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARRELIEF,sal_True,&pItem) && pItem->ISA(SvxCharReliefItem))
     485             :         {
     486           0 :             const SvxCharReliefItem* pFontItem = static_cast<const SvxCharReliefItem*>(pItem);
     487           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARRELIEF, uno::makeAny( static_cast< sal_Int16 >( pFontItem->GetEnumValue() ) ) );
     488             :         }
     489           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARHIDDEN,sal_True,&pItem) && pItem->ISA(SvxCharHiddenItem))
     490             :         {
     491           0 :             const SvxCharHiddenItem* pFontItem = static_cast<const SvxCharHiddenItem*>(pItem);
     492           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARHIDDEN, uno::makeAny( pFontItem->GetValue() ) );
     493             :         }
     494           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_AUTOKERN,sal_True,&pItem) && pItem->ISA(SvxAutoKernItem))
     495             :         {
     496           0 :             const SvxAutoKernItem* pFontItem = static_cast<const SvxAutoKernItem*>(pItem);
     497           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARAUTOKERNING, uno::makeAny( pFontItem->GetValue() ) );
     498             :         }
     499           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_BRUSH,sal_True,&pItem) && pItem->ISA(SvxBrushItem))
     500             :         {
     501           0 :             const SvxBrushItem* pFontItem = static_cast<const SvxBrushItem*>(pItem);
     502           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CONTROLBACKGROUND, uno::makeAny( pFontItem->GetColor().GetColor() ) );
     503             :         }
     504           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_BLINK,sal_True,&pItem) && pItem->ISA(SvxBlinkItem))
     505             :         {
     506           0 :             const SvxBlinkItem* pFontItem = static_cast<const SvxBlinkItem*>(pItem);
     507           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARFLASH, uno::makeAny( pFontItem->GetValue() ) );
     508             :         }
     509           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_EMPHASISMARK,sal_True,&pItem) && pItem->ISA(SvxEmphasisMarkItem))
     510             :         {
     511           0 :             const SvxEmphasisMarkItem* pFontItem = static_cast<const SvxEmphasisMarkItem*>(pItem);
     512           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHAREMPHASIS, uno::makeAny( static_cast< sal_Int16 >( pFontItem->GetEmphasisMark() ) ) );
     513             :         }
     514           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_TWOLINES,sal_True,&pItem) && pItem->ISA(SvxTwoLinesItem))
     515             :         {
     516           0 :             const SvxTwoLinesItem* pFontItem = static_cast<const SvxTwoLinesItem*>(pItem);
     517           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINEISON, uno::makeAny( pFontItem->GetValue() ) );
     518           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINEPREFIX, uno::makeAny( ::rtl::OUString( pFontItem->GetStartBracket() ) ) );
     519           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINESUFFIX, uno::makeAny( ::rtl::OUString( pFontItem->GetEndBracket() ) ) );
     520             :         }
     521           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_COLOR,sal_True,&pItem) && pItem->ISA(SvxColorItem))
     522             :         {
     523           0 :             const SvxColorItem* pFontItem = static_cast<const SvxColorItem*>(pItem);
     524           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARCOLOR, uno::makeAny( pFontItem->GetValue().GetColor() ) );
     525             :         }
     526           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_KERNING,sal_True,&pItem) && pItem->ISA(SvxKerningItem))
     527             :         {
     528           0 :             const SvxKerningItem* pFontItem = static_cast<const SvxKerningItem*>(pItem);
     529           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARKERNING, uno::makeAny( pFontItem->GetValue() ) );
     530             :         }
     531           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CASEMAP,sal_True,&pItem) && pItem->ISA(SvxCaseMapItem))
     532             :         {
     533           0 :             const SvxCaseMapItem* pFontItem = static_cast<const SvxCaseMapItem*>(pItem);
     534           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARCASEMAP, uno::makeAny( pFontItem->GetValue() ) );
     535             :         }
     536           0 :         struct Items {
     537             :                 sal_uInt16 nWhich;
     538             :                 ::rtl::OUString sPropertyName;
     539             :         };
     540             :         const Items pItems[] = { {ITEMID_LANGUAGE,PROPERTY_CHARLOCALE}
     541             :                                 ,{ITEMID_LANGUAGE_ASIAN,PROPERTY_CHARLOCALEASIAN}
     542             :                                 ,{ITEMID_LANGUAGE_COMPLEX,PROPERTY_CHARLOCALECOMPLEX}
     543           0 :         };
     544           0 :         for(size_t k = 0; k < sizeof(pItems)/sizeof(pItems[0]);++k)
     545             :         {
     546           0 :             if ( SFX_ITEM_SET == _rItemSet.GetItemState( pItems[k].nWhich,sal_True,&pItem) && pItem->ISA(SvxLanguageItem))
     547             :             {
     548           0 :                 const SvxLanguageItem* pFontItem = static_cast<const SvxLanguageItem*>(pItem);
     549           0 :                 lang::Locale aCharLocale( LanguageTag( pFontItem->GetLanguage()).getLocale());
     550           0 :                 lcl_pushBack( _out_rProperties, pItems[k].sPropertyName, uno::makeAny( aCharLocale ) );
     551             :             }
     552             :         }
     553           0 :         if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_ESCAPEMENT,sal_True,&pItem) && pItem->ISA(SvxEscapementItem))
     554             :         {
     555           0 :             const SvxEscapementItem* pFontItem = static_cast<const SvxEscapementItem*>(pItem);
     556           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARESCAPEMENT, uno::makeAny( pFontItem->GetEsc() ) );
     557           0 :             lcl_pushBack( _out_rProperties, PROPERTY_CHARESCAPEMENTHEIGHT, uno::makeAny( (sal_Int8)pFontItem->GetProp() ) );
     558           0 :         }
     559           0 :     }
     560             : 
     561             :     // -------------------------------------------------------------------------
     562             :     template< class ATTRIBUTE_TYPE >
     563           0 :     void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName,
     564             :         const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
     565             :         void (SAL_CALL report::XReportControlFormat::*pSetter)( ATTRIBUTE_TYPE ) )
     566             :     {
     567           0 :         ATTRIBUTE_TYPE aAttributeValue = ATTRIBUTE_TYPE();
     568           0 :         if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) )
     569           0 :             (_rxReportControlFormat.get()->*pSetter)( aAttributeValue );
     570           0 :     }
     571             : 
     572             :     // -------------------------------------------------------------------------
     573           0 :     void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName,
     574             :         const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
     575             :         void (SAL_CALL report::XReportControlFormat::*pSetter)( const ::rtl::OUString& ) )
     576             :     {
     577           0 :         ::rtl::OUString aAttributeValue;
     578           0 :         if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) )
     579           0 :             (_rxReportControlFormat.get()->*pSetter)( aAttributeValue );
     580           0 :     }
     581             : 
     582             :     // -------------------------------------------------------------------------
     583           0 :     void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName,
     584             :         const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
     585             :         void (SAL_CALL report::XReportControlFormat::*pSetter)( const lang::Locale& ) )
     586             :     {
     587           0 :         lang::Locale aAttributeValue;
     588           0 :         if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) )
     589           0 :             (_rxReportControlFormat.get()->*pSetter)( aAttributeValue );
     590           0 :     }
     591             : }
     592             : 
     593             : // -----------------------------------------------------------------------------
     594           0 : bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
     595             :         const uno::Reference< awt::XWindow>& _rxParentWindow, uno::Sequence< beans::NamedValue >& _out_rNewValues )
     596             : {
     597             :     OSL_PRECOND( _rxReportControlFormat.is() && _rxParentWindow.is(), "openCharDialog: invalid parameters!" );
     598           0 :     if ( !_rxReportControlFormat.is() || !_rxParentWindow.is() )
     599           0 :         return false;
     600             : 
     601           0 :     _out_rNewValues = uno::Sequence< beans::NamedValue >();
     602             : 
     603             :     // ------------
     604             :     // UNO->ItemSet
     605             :     static SfxItemInfo aItemInfos[] =
     606             :     {
     607             :         { SID_ATTR_CHAR_FONT, SFX_ITEM_POOLABLE },
     608             :         { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEM_POOLABLE },
     609             :         { SID_ATTR_CHAR_LANGUAGE, SFX_ITEM_POOLABLE },
     610             :         { SID_ATTR_CHAR_POSTURE, SFX_ITEM_POOLABLE },
     611             :         { SID_ATTR_CHAR_WEIGHT, SFX_ITEM_POOLABLE },
     612             :         { SID_ATTR_CHAR_SHADOWED, SFX_ITEM_POOLABLE },
     613             :         { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEM_POOLABLE },
     614             :         { SID_ATTR_CHAR_CONTOUR, SFX_ITEM_POOLABLE },
     615             :         { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEM_POOLABLE },
     616             :         { SID_ATTR_CHAR_UNDERLINE, SFX_ITEM_POOLABLE },
     617             :         { SID_ATTR_CHAR_COLOR, SFX_ITEM_POOLABLE },
     618             :         { SID_ATTR_CHAR_KERNING, SFX_ITEM_POOLABLE },
     619             :         { SID_ATTR_CHAR_CASEMAP, SFX_ITEM_POOLABLE },
     620             :         { SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEM_POOLABLE },
     621             :         { SID_ATTR_CHAR_FONTLIST, SFX_ITEM_POOLABLE },
     622             :         { SID_ATTR_CHAR_AUTOKERN, SFX_ITEM_POOLABLE },
     623             :         { SID_COLOR_TABLE, SFX_ITEM_POOLABLE },
     624             :         { SID_ATTR_FLASH, SFX_ITEM_POOLABLE },
     625             :         { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEM_POOLABLE },
     626             :         { SID_ATTR_CHAR_TWO_LINES, SFX_ITEM_POOLABLE },
     627             :         { SID_ATTR_CHAR_ROTATED, SFX_ITEM_POOLABLE },
     628             :         { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEM_POOLABLE },
     629             :         { SID_ATTR_CHAR_RELIEF, SFX_ITEM_POOLABLE },
     630             :         { SID_ATTR_CHAR_HIDDEN, SFX_ITEM_POOLABLE },
     631             :         { SID_ATTR_BRUSH, SFX_ITEM_POOLABLE },
     632             :         { SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEM_POOLABLE },
     633             :         { SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEM_POOLABLE },
     634             : 
     635             :         // Asian
     636             :         { SID_ATTR_CHAR_CJK_FONT, SFX_ITEM_POOLABLE },
     637             :         { SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEM_POOLABLE },
     638             :         { SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEM_POOLABLE },
     639             :         { SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEM_POOLABLE },
     640             :         { SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEM_POOLABLE },
     641             :         // Complex
     642             :         { SID_ATTR_CHAR_CTL_FONT, SFX_ITEM_POOLABLE },
     643             :         { SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEM_POOLABLE },
     644             :         { SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEM_POOLABLE },
     645             :         { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEM_POOLABLE },
     646             :         { SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEM_POOLABLE }
     647             :     };
     648           0 :     Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
     649             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     650           0 :     ::std::auto_ptr<FontList> pFontList(new FontList( pParent ));
     651           0 :     XColorListRef pColorList( XColorList::CreateStdColorList() );
     652             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     653             :     SfxPoolItem* pDefaults[] =
     654             :     {
     655           0 :         new SvxFontItem(ITEMID_FONT),
     656           0 :         new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT),
     657           0 :         new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE),
     658           0 :         new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE),
     659           0 :         new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT),
     660             : 
     661           0 :         new SvxShadowedItem(sal_False,ITEMID_SHADOWED),
     662           0 :         new SvxWordLineModeItem(sal_False,ITEMID_WORDLINEMODE),
     663           0 :         new SvxContourItem(sal_False,ITEMID_CONTOUR),
     664           0 :         new SvxCrossedOutItem(STRIKEOUT_NONE,ITEMID_CROSSEDOUT),
     665           0 :         new SvxUnderlineItem(UNDERLINE_NONE,ITEMID_UNDERLINE),
     666             : 
     667           0 :         new SvxColorItem(ITEMID_COLOR),
     668           0 :         new SvxKerningItem(0,ITEMID_KERNING),
     669           0 :         new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED,ITEMID_CASEMAP),
     670           0 :         new SvxEscapementItem(ITEMID_ESCAPEMENT),
     671           0 :         new SvxFontListItem(pFontList.get(),ITEMID_FONTLIST),
     672           0 :         new SvxAutoKernItem(sal_False,ITEMID_AUTOKERN),
     673           0 :         new SvxColorListItem(pColorList.get(),ITEMID_COLOR_TABLE),
     674           0 :         new SvxBlinkItem(sal_False,ITEMID_BLINK),
     675           0 :         new SvxEmphasisMarkItem(EMPHASISMARK_NONE,ITEMID_EMPHASISMARK),
     676           0 :         new SvxTwoLinesItem(sal_True,0,0,ITEMID_TWOLINES),
     677           0 :         new SvxCharRotateItem(0,sal_False,ITEMID_CHARROTATE),
     678           0 :         new SvxCharScaleWidthItem(100,ITEMID_CHARSCALE_W),
     679           0 :         new SvxCharReliefItem(RELIEF_NONE,ITEMID_CHARRELIEF),
     680           0 :         new SvxCharHiddenItem(sal_False,ITEMID_CHARHIDDEN),
     681           0 :         new SvxBrushItem(ITEMID_BRUSH),
     682           0 :         new SvxHorJustifyItem(ITEMID_HORJUSTIFY),
     683           0 :         new SvxVerJustifyItem(ITEMID_VERJUSTIFY),
     684             : // Asian
     685           0 :         new SvxFontItem(ITEMID_FONT_ASIAN),
     686           0 :         new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_ASIAN),
     687           0 :         new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_ASIAN),
     688           0 :         new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_ASIAN),
     689           0 :         new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_ASIAN),
     690             : // Complex
     691           0 :         new SvxFontItem(ITEMID_FONT_COMPLEX),
     692           0 :         new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_COMPLEX),
     693           0 :         new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_COMPLEX),
     694           0 :         new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_COMPLEX),
     695           0 :         new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_COMPLEX)
     696             : 
     697           0 :     };
     698             : 
     699             :     OSL_ASSERT((sizeof(pDefaults)/sizeof(pDefaults[0])) == (sizeof(aItemInfos)/sizeof(aItemInfos[0])));
     700             : 
     701             :     static sal_uInt16 pRanges[] =
     702             :     {
     703             :         ITEMID_FONT,ITEMID_WEIGHT_COMPLEX,
     704             :         0
     705             :     };
     706             : 
     707           0 :     SfxItemPool* pPool( new SfxItemPool(rtl::OUString("ReportCharProperties"), ITEMID_FONT,ITEMID_WEIGHT_COMPLEX, aItemInfos, pDefaults) );
     708             :     // not needed for font height pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM );  // ripped, don't understand why
     709           0 :     pPool->FreezeIdRanges();                        // the same
     710           0 :     bool bSuccess = false;
     711             :     try
     712             :     {
     713             :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     714           0 :         ::std::auto_ptr<SfxItemSet> pDescriptor( new SfxItemSet( *pPool, pRanges ) );
     715             :         SAL_WNODEPRECATED_DECLARATIONS_POP
     716           0 :         lcl_CharPropertiesToItems( _rxReportControlFormat, *pDescriptor );
     717             : 
     718             :         {   // want the dialog to be destroyed before our set
     719           0 :             ORptPageDialog aDlg(pParent, pDescriptor.get(),RID_PAGEDIALOG_CHAR);
     720           0 :             uno::Reference< report::XShape > xShape( _rxReportControlFormat, uno::UNO_QUERY );
     721           0 :             if ( xShape.is() )
     722           0 :                 aDlg.RemoveTabPage( RID_PAGE_BACKGROUND );
     723           0 :             bSuccess = ( RET_OK == aDlg.Execute() );
     724           0 :             if ( bSuccess )
     725             :             {
     726             :                 lcl_itemsToCharProperties( lcl_getReportControlFont( _rxReportControlFormat,WESTERN ),
     727             :                     lcl_getReportControlFont( _rxReportControlFormat,ASIAN ),
     728           0 :                     lcl_getReportControlFont( _rxReportControlFormat,COMPLEX ), *aDlg.GetOutputItemSet(), _out_rNewValues );
     729           0 :             }
     730           0 :         }
     731             :     }
     732           0 :     catch(uno::Exception&)
     733             :     {
     734             :         DBG_UNHANDLED_EXCEPTION();
     735             :     }
     736             : 
     737           0 :     SfxItemPool::Free(pPool);
     738           0 :     for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i)
     739           0 :         delete pDefaults[i];
     740             : 
     741           0 :     return bSuccess;
     742             : }
     743             : // -----------------------------------------------------------------------------
     744           0 : bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::Reference< awt::XWindow>& _rxParentWindow )
     745             : {
     746             :     OSL_PRECOND( _xShape.is() && _rxParentWindow.is(), "openAreaDialog: invalid parameters!" );
     747           0 :     if ( !_xShape.is() || !_rxParentWindow.is() )
     748           0 :         return false;
     749             : 
     750           0 :     ::boost::shared_ptr<rptui::OReportModel> pModel  = ::reportdesign::OReportDefinition::getSdrModel(_xShape->getSection()->getReportDefinition());
     751             : 
     752           0 :     Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
     753             : 
     754           0 :     bool bSuccess = false;
     755             :     try
     756             :     {
     757           0 :         SfxItemPool& rItemPool = pModel->GetItemPool();
     758             :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     759           0 :         ::std::auto_ptr<SfxItemSet> pDescriptor( new SfxItemSet( rItemPool, rItemPool.GetFirstWhich(),rItemPool.GetLastWhich() ) );
     760             :         SAL_WNODEPRECATED_DECLARATIONS_POP
     761           0 :         lcl_fillShapeToItems(_xShape,*pDescriptor);
     762             : 
     763             :         {   // want the dialog to be destroyed before our set
     764           0 :             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     765             :             SAL_WNODEPRECATED_DECLARATIONS_PUSH
     766           0 :             ::std::auto_ptr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog( pParent,pDescriptor.get(),pModel.get() ));
     767             :             SAL_WNODEPRECATED_DECLARATIONS_POP
     768           0 :             if ( ( bSuccess = ( RET_OK == pDialog->Execute() ) ) )
     769           0 :                 lcl_fillItemsToShape(_xShape,*pDialog->GetOutputItemSet());
     770           0 :         }
     771             :     }
     772           0 :     catch(uno::Exception&)
     773             :     {
     774             :         DBG_UNHANDLED_EXCEPTION();
     775             :     }
     776             : 
     777           0 :     return bSuccess;
     778             : }
     779             : 
     780             : // -----------------------------------------------------------------------------
     781           0 : void applyCharacterSettings( const uno::Reference< report::XReportControlFormat >& _rxReportControlFormat, const uno::Sequence< beans::NamedValue >& _rSettings )
     782             : {
     783           0 :     ::comphelper::NamedValueCollection aSettings( _rSettings );
     784             : 
     785             :     try
     786             :     {
     787           0 :         awt::FontDescriptor aAwtFont;
     788           0 :         if ( aSettings.get( "Font" ) >>= aAwtFont )
     789             :         {
     790           0 :             ::rtl::OUString sTemp = aAwtFont.Name;
     791           0 :             aAwtFont.Name = ::rtl::OUString(); // hack to
     792           0 :             _rxReportControlFormat->setFontDescriptor( aAwtFont );
     793           0 :             _rxReportControlFormat->setCharFontName( sTemp );
     794             :         }
     795           0 :         if ( aSettings.get( "FontAsian" ) >>= aAwtFont )
     796             :         {
     797           0 :             ::rtl::OUString sTemp = aAwtFont.Name;
     798           0 :             aAwtFont.Name = ::rtl::OUString(); // hack to
     799           0 :             _rxReportControlFormat->setFontDescriptorAsian( aAwtFont );
     800           0 :             _rxReportControlFormat->setCharFontNameAsian( sTemp );
     801             :         }
     802           0 :         if ( aSettings.get( "FontComplex" ) >>= aAwtFont )
     803             :         {
     804           0 :             ::rtl::OUString sTemp = aAwtFont.Name;
     805           0 :             aAwtFont.Name = ::rtl::OUString(); // hack to
     806           0 :             _rxReportControlFormat->setFontDescriptorComplex( aAwtFont );
     807           0 :             _rxReportControlFormat->setCharFontNameComplex( sTemp );
     808             :         }
     809             : 
     810           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARSHADOWED.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharShadowed );
     811           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARCONTOURED.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharContoured );
     812           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARUNDERLINECOLOR.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharUnderlineColor );
     813           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_PARAADJUST.ascii, _rxReportControlFormat, &report::XReportControlFormat::setParaAdjust );
     814           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_VERTICALALIGN.ascii, _rxReportControlFormat, &report::XReportControlFormat::setVerticalAlign );
     815           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARRELIEF.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharRelief );
     816           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARHIDDEN.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharHidden );
     817           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARAUTOKERNING.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharAutoKerning );
     818           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CONTROLBACKGROUND.ascii, _rxReportControlFormat, &report::XReportControlFormat::setControlBackground );
     819           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARFLASH.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharFlash );
     820           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHAREMPHASIS.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharEmphasis );
     821           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEISON.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineIsOn );
     822           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEPREFIX.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharCombinePrefix );
     823           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINESUFFIX.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineSuffix );
     824           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOLOR.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharColor );
     825           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARKERNING.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharKerning );
     826           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARCASEMAP.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharCaseMap );
     827           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALE.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharLocale );
     828           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENT.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapement );
     829           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENTHEIGHT.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapementHeight );
     830           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALEASIAN.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleAsian );
     831           0 :         lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALECOMPLEX.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleComplex );
     832             :     }
     833           0 :     catch( const uno::Exception& )
     834             :     {
     835             :         DBG_UNHANDLED_EXCEPTION();
     836           0 :     }
     837           0 : }
     838             : 
     839             : // -----------------------------------------------------------------------------
     840           0 : void notifySystemWindow(Window* _pWindow,Window* _pToRegister, ::comphelper::mem_fun1_t<TaskPaneList,Window*> _rMemFunc)
     841             : {
     842             :     OSL_ENSURE(_pWindow,"Window can not be null!");
     843           0 :     SystemWindow* pSystemWindow = _pWindow ? _pWindow->GetSystemWindow() : NULL;
     844           0 :     if ( pSystemWindow )
     845             :     {
     846           0 :         _rMemFunc( pSystemWindow->GetTaskPaneList(), _pToRegister );
     847             :     }
     848           0 : }
     849             : // -----------------------------------------------------------------------------
     850           0 : SdrObject* isOver(const Rectangle& _rRect, SdrPage& _rPage, SdrView& _rView, bool _bAllObjects, SdrObject* _pIgnore, sal_Int16 _nIgnoreType)
     851             : {
     852           0 :     SdrObject* pOverlappedObj = NULL;
     853           0 :     SdrObjListIter aIter(_rPage,IM_DEEPNOGROUPS);
     854           0 :     SdrObject* pObjIter = NULL;
     855             : 
     856           0 :     while( !pOverlappedObj && (pObjIter = aIter.Next()) != NULL )
     857             :     {
     858           0 :         if ( _pIgnore != pObjIter
     859           0 :             && (_bAllObjects || !_rView.IsObjMarked(pObjIter))
     860           0 :             && (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL))
     861             :         {
     862           0 :             if (_nIgnoreType == ISOVER_IGNORE_CUSTOMSHAPES && pObjIter->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
     863             :             {
     864           0 :                 continue;
     865             :             }
     866             : 
     867           0 :             if (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL)
     868             :             {
     869           0 :                 Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
     870           0 :                 if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
     871           0 :                     pOverlappedObj = pObjIter;
     872             :             }
     873             :         }
     874             :     }
     875           0 :     return pOverlappedObj;
     876             : }
     877             : // -----------------------------------------------------------------------------
     878           0 : bool checkArrayForOccurrence(SdrObject* _pObjToCheck, SdrUnoObj* _pIgnore[], int _nListLength)
     879             : {
     880           0 :     for(int i=0;i<_nListLength;i++)
     881             :     {
     882           0 :         SdrObject *pIgnore = _pIgnore[i];
     883           0 :         if (pIgnore == _pObjToCheck)
     884             :         {
     885           0 :             return true;
     886             :         }
     887             :     }
     888           0 :     return false;
     889             : }
     890             : 
     891           0 : SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects, SdrUnoObj * _pIgnoreList[], int _nIgnoreListLength)
     892             : {
     893           0 :     SdrObject* pOverlappedObj = NULL;
     894           0 :     SdrObjListIter aIter(_rPage,IM_DEEPNOGROUPS);
     895           0 :     SdrObject* pObjIter = NULL;
     896             : 
     897           0 :     while( !pOverlappedObj && (pObjIter = aIter.Next()) != NULL )
     898             :     {
     899           0 :         if (checkArrayForOccurrence(pObjIter, _pIgnoreList, _nIgnoreListLength))
     900             :         {
     901           0 :             continue;
     902             :         }
     903             : 
     904           0 :         if ( (_bAllObjects || !_rView.IsObjMarked(pObjIter))
     905           0 :              && (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL) )
     906             :         {
     907           0 :             Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
     908           0 :             if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
     909           0 :                 pOverlappedObj = pObjIter;
     910             :         }
     911             :     }
     912           0 :     return pOverlappedObj;
     913             : }
     914             : 
     915             : //----------------------------------------------------------------------------
     916           0 : SdrObject* isOver(SdrObject* _pObj,SdrPage& _rPage,SdrView& _rView,bool _bUnMarkedObjects)
     917             : {
     918           0 :     SdrObject* pOverlappedObj = NULL;
     919           0 :     if (dynamic_cast<OUnoObject*>(_pObj) != NULL || dynamic_cast<OOle2Obj*>(_pObj) != NULL) // this doesn't need to be done for shapes
     920             :     {
     921           0 :         Rectangle aRect = _pObj->GetCurrentBoundRect();
     922           0 :         pOverlappedObj = isOver(aRect,_rPage,_rView,_bUnMarkedObjects,_pObj);
     923             :     }
     924           0 :     return pOverlappedObj;
     925             : }
     926             : 
     927             : // -----------------------------------------------------------------------------
     928           0 : uno::Sequence< ::rtl::OUString > getParameterNames( const uno::Reference< sdbc::XRowSet >& _rxRowSet )
     929             : {
     930           0 :     uno::Sequence< ::rtl::OUString > aNames;
     931             : 
     932             :     try
     933             :     {
     934           0 :         uno::Reference< sdb::XParametersSupplier > xSuppParams( _rxRowSet, uno::UNO_QUERY_THROW );
     935           0 :         uno::Reference< container::XIndexAccess > xParams( xSuppParams->getParameters() );
     936           0 :         if ( xParams.is() )
     937             :         {
     938           0 :             sal_Int32 count( xParams->getCount() );
     939           0 :             aNames.realloc( count );
     940             : 
     941           0 :             uno::Reference< beans::XPropertySet > xParam;
     942           0 :             ::rtl::OUString sParamName;
     943           0 :             for ( sal_Int32 i=0; i<count; ++i )
     944             :             {
     945           0 :                 xParam.set( xParams->getByIndex(i), uno::UNO_QUERY_THROW );
     946           0 :                 OSL_VERIFY( xParam->getPropertyValue( PROPERTY_NAME ) >>= sParamName );
     947           0 :                 aNames[i] = sParamName;
     948           0 :             }
     949           0 :         }
     950             :     }
     951           0 :     catch( const uno::Exception& )
     952             :     {
     953             :         DBG_UNHANDLED_EXCEPTION();
     954             :     }
     955             : 
     956           0 :     return aNames;
     957             : }
     958             : // -----------------------------------------------------------------------------
     959           0 : Rectangle getRectangleFromControl(SdrObject* _pControl)
     960             : {
     961           0 :     if (_pControl)
     962             :     {
     963           0 :         uno::Reference< report::XReportComponent > xComponent( _pControl->getUnoShape(), uno::UNO_QUERY);
     964           0 :         if (xComponent.is())
     965             :         {
     966           0 :             Rectangle aRect(VCLPoint(xComponent->getPosition()),VCLSize(xComponent->getSize()));
     967           0 :             aRect.setHeight(aRect.getHeight() + 1);
     968           0 :             aRect.setWidth(aRect.getWidth() + 1);
     969           0 :             return aRect;
     970           0 :         }
     971             :     }
     972           0 :     return Rectangle();
     973             : }
     974             : // -----------------------------------------------------------------------------
     975             : // check overlapping
     976           0 : void correctOverlapping(SdrObject* _pControl,OReportSection& _aReportSection,bool _bInsert)
     977             : {
     978           0 :     OSectionView& rSectionView = _aReportSection.getSectionView();
     979           0 :     uno::Reference< report::XReportComponent> xComponent(_pControl->getUnoShape(),uno::UNO_QUERY);
     980           0 :     Rectangle aRect = getRectangleFromControl(_pControl);
     981             : 
     982           0 :     bool bOverlapping = true;
     983           0 :     while ( bOverlapping )
     984             :     {
     985           0 :         SdrObject* pOverlappedObj = isOver(aRect,*_aReportSection.getPage(),rSectionView,true, _pControl);
     986           0 :         bOverlapping = pOverlappedObj != NULL;
     987           0 :         if ( bOverlapping )
     988             :         {
     989           0 :             const Rectangle& aLogicRect = pOverlappedObj->GetLogicRect();
     990           0 :             aRect.Move(0,aLogicRect.Top() + aLogicRect.getHeight() - aRect.Top());
     991           0 :             xComponent->setPositionY(aRect.Top());
     992             :         }
     993             :     }
     994           0 :     if ( !bOverlapping && _bInsert ) // now insert objects
     995           0 :         rSectionView.InsertObjectAtView(_pControl,*rSectionView.GetSdrPageView(),SDRINSERT_ADDMARK);
     996           0 : }
     997             : // -----------------------------------------------------------------------------
     998           0 : void setZoomFactor(const Fraction& _aZoom,Window& _rWindow)
     999             : {
    1000           0 :     MapMode aMapMode( _rWindow.GetMapMode() );
    1001           0 :     aMapMode.SetScaleX(_aZoom);
    1002           0 :     aMapMode.SetScaleY(_aZoom);
    1003           0 :     _rWindow.SetMapMode(aMapMode);
    1004           0 : }
    1005             : // -----------------------------------------------------------------------------
    1006           0 : bool openDialogFormula_nothrow( ::rtl::OUString& _in_out_rFormula
    1007             :                                , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext
    1008             :                                , const uno::Reference< awt::XWindow>& _xInspectorWindow
    1009             :                                , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet
    1010             :                                )
    1011             : {
    1012             :     OSL_PRECOND( _xInspectorWindow.is(), "openDialogFormula_nothrow: invalid parameters!" );
    1013           0 :     if ( !_xInspectorWindow.is() )
    1014           0 :         return false;
    1015           0 :     bool bSuccess = false;
    1016           0 :     ::dbtools::SQLExceptionInfo aErrorInfo;
    1017           0 :     uno::Reference< awt::XWindow > xInspectorWindow;
    1018           0 :     uno::Reference< lang::XMultiComponentFactory > xFactory;
    1019           0 :     uno::Reference<lang::XMultiServiceFactory> xServiceFactory;
    1020             :     try
    1021             :     {
    1022           0 :         xFactory = _xContext->getServiceManager();
    1023           0 :         xServiceFactory.set(xFactory,uno::UNO_QUERY);
    1024           0 :         Window* pParent = VCLUnoHelper::GetWindow( _xInspectorWindow );
    1025             : 
    1026           0 :         uno::Reference< report::meta::XFunctionManager> xMgr(xFactory->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.pentaho.SOFunctionManager")),_xContext),uno::UNO_QUERY);
    1027           0 :         if ( xMgr.is() )
    1028             :         {
    1029           0 :             ::boost::shared_ptr< formula::IFunctionManager > pFormulaManager(new FunctionManager(xMgr) );
    1030           0 :             ReportFormula aFormula( _in_out_rFormula );
    1031           0 :             FormulaDialog aDlg(pParent,xServiceFactory,pFormulaManager,aFormula.getUndecoratedContent(),_xRowSet);
    1032           0 :             bSuccess = aDlg.Execute() == RET_OK;
    1033           0 :             if ( bSuccess )
    1034             :             {
    1035           0 :                 String sFormula = aDlg.getCurrentFormula();
    1036           0 :                 xub_StrLen nIndex = 0;
    1037           0 :                 if ( sFormula.GetChar(0) == '=' )
    1038           0 :                     nIndex = 1;
    1039           0 :                 _in_out_rFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:")) + sFormula.Copy(nIndex);
    1040           0 :             }
    1041           0 :         }
    1042             :     }
    1043           0 :     catch (const sdb::SQLContext& e) { aErrorInfo = e; }
    1044           0 :     catch (const sdbc::SQLWarning& e) { aErrorInfo = e; }
    1045           0 :     catch (const sdbc::SQLException& e) { aErrorInfo = e; }
    1046           0 :     catch( const uno::Exception& )
    1047             :     {
    1048             :         OSL_FAIL( "GeometryHandler::impl_dialogFilter_nothrow: caught an exception!" );
    1049             :     }
    1050             : 
    1051           0 :     if ( aErrorInfo.isValid() )
    1052           0 :         ::dbtools::showError( aErrorInfo, xInspectorWindow, _xContext );
    1053             : 
    1054           0 :     return bSuccess;
    1055             : }
    1056             : // -----------------------------------------------------------------------------
    1057           0 : } // namespace rptui
    1058             : // -----------------------------------------------------------------------------
    1059             : 
    1060             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10