LCOV - code coverage report
Current view: top level - reportdesign/source/ui/misc - UITools.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 510 0.0 %
Date: 2012-08-25 Functions: 0 32 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

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

Generated by: LCOV version 1.10