LCOV - code coverage report
Current view: top level - xmlscript/source/xmldlg_imexp - xmldlg_export.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 680 0.0 %
Date: 2012-08-25 Functions: 0 24 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1701 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include "exp_share.hxx"
      21                 :            : 
      22                 :            : #include <rtl/ustrbuf.hxx>
      23                 :            : #include <tools/diagnose_ex.h>
      24                 :            : 
      25                 :            : #include <com/sun/star/awt/CharSet.hpp>
      26                 :            : #include <com/sun/star/awt/FontFamily.hpp>
      27                 :            : #include <com/sun/star/awt/FontPitch.hpp>
      28                 :            : #include <com/sun/star/awt/FontSlant.hpp>
      29                 :            : #include <com/sun/star/awt/FontStrikeout.hpp>
      30                 :            : #include <com/sun/star/awt/FontType.hpp>
      31                 :            : #include <com/sun/star/awt/FontUnderline.hpp>
      32                 :            : #include <com/sun/star/awt/FontWeight.hpp>
      33                 :            : #include <com/sun/star/awt/FontWidth.hpp>
      34                 :            : #include <com/sun/star/awt/ImagePosition.hpp>
      35                 :            : #include <com/sun/star/awt/LineEndFormat.hpp>
      36                 :            : #include <com/sun/star/awt/PushButtonType.hpp>
      37                 :            : #include <com/sun/star/awt/VisualEffect.hpp>
      38                 :            : 
      39                 :            : #include <com/sun/star/io/XPersistObject.hpp>
      40                 :            : 
      41                 :            : #include <com/sun/star/script/XScriptEventsSupplier.hpp>
      42                 :            : #include <com/sun/star/script/ScriptEventDescriptor.hpp>
      43                 :            : 
      44                 :            : #include <com/sun/star/style/VerticalAlignment.hpp>
      45                 :            : 
      46                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      47                 :            : #include <com/sun/star/lang/Locale.hpp>
      48                 :            : #include <com/sun/star/util/NumberFormat.hpp>
      49                 :            : 
      50                 :            : #include <com/sun/star/view/SelectionType.hpp>
      51                 :            : 
      52                 :            : #include <com/sun/star/form/binding/XListEntrySink.hpp>
      53                 :            : #include <com/sun/star/form/binding/XBindableValue.hpp>
      54                 :            : #include <com/sun/star/form/binding/XValueBinding.hpp>
      55                 :            : #include <com/sun/star/table/CellAddress.hpp>
      56                 :            : #include <com/sun/star/table/CellRangeAddress.hpp>
      57                 :            : #include <com/sun/star/document/XStorageBasedDocument.hpp>
      58                 :            : #include <com/sun/star/document/XGraphicObjectResolver.hpp>
      59                 :            : 
      60                 :            : #include <comphelper/componentcontext.hxx>
      61                 :            : #include <comphelper/processfactory.hxx>
      62                 :            : 
      63                 :            : using namespace ::com::sun::star;
      64                 :            : using namespace ::com::sun::star::uno;
      65                 :            : using ::rtl::OUString;
      66                 :            : using ::rtl::OUStringBuffer;
      67                 :            : 
      68                 :            : namespace xmlscript
      69                 :            : {
      70                 :            : 
      71                 :            : //__________________________________________________________________________________________________
      72                 :          0 : Reference< xml::sax::XAttributeList > Style::createElement()
      73                 :            : {
      74                 :            :     ElementDescriptor * pStyle = new ElementDescriptor(
      75         [ #  # ]:          0 :         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style") ) );
      76                 :            : 
      77                 :            :     // style-id
      78         [ #  # ]:          0 :     pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), _id );
      79                 :            : 
      80                 :            :     // background-color
      81         [ #  # ]:          0 :     if (_set & 0x1)
      82                 :            :     {
      83                 :          0 :         OUStringBuffer buf( 16 );
      84         [ #  # ]:          0 :         buf.append( (sal_Unicode)'0' );
      85         [ #  # ]:          0 :         buf.append( (sal_Unicode)'x' );
      86         [ #  # ]:          0 :         buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_backgroundColor, 16 ) );
      87                 :            :         pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":background-color") ),
      88 [ #  # ][ #  # ]:          0 :                               buf.makeStringAndClear() );
                 [ #  # ]
      89                 :            :     }
      90                 :            : 
      91                 :            :     // text-color
      92         [ #  # ]:          0 :     if (_set & 0x2)
      93                 :            :     {
      94                 :          0 :         OUStringBuffer buf( 16 );
      95         [ #  # ]:          0 :         buf.append( (sal_Unicode)'0' );
      96         [ #  # ]:          0 :         buf.append( (sal_Unicode)'x' );
      97         [ #  # ]:          0 :         buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_textColor, 16 ) );
      98                 :            :         pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text-color") ),
      99 [ #  # ][ #  # ]:          0 :                               buf.makeStringAndClear() );
                 [ #  # ]
     100                 :            :     }
     101                 :            : 
     102                 :            :     // textline-color
     103         [ #  # ]:          0 :     if (_set & 0x20)
     104                 :            :     {
     105                 :          0 :         OUStringBuffer buf( 16 );
     106         [ #  # ]:          0 :         buf.append( (sal_Unicode)'0' );
     107         [ #  # ]:          0 :         buf.append( (sal_Unicode)'x' );
     108         [ #  # ]:          0 :         buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_textLineColor, 16 ) );
     109                 :            :         pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textline-color") ),
     110 [ #  # ][ #  # ]:          0 :                               buf.makeStringAndClear() );
                 [ #  # ]
     111                 :            :     }
     112                 :            : 
     113                 :            :     // fill-color
     114         [ #  # ]:          0 :     if (_set & 0x10)
     115                 :            :     {
     116                 :          0 :         OUStringBuffer buf( 16 );
     117         [ #  # ]:          0 :         buf.append( (sal_Unicode)'0' );
     118         [ #  # ]:          0 :         buf.append( (sal_Unicode)'x' );
     119         [ #  # ]:          0 :         buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_fillColor, 16 ) );
     120                 :            :         pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fill-color") ),
     121 [ #  # ][ #  # ]:          0 :                               buf.makeStringAndClear() );
                 [ #  # ]
     122                 :            :     }
     123                 :            : 
     124                 :            :     // border
     125         [ #  # ]:          0 :     if (_set & 0x4)
     126                 :            :     {
     127   [ #  #  #  #  :          0 :         switch (_border)
                      # ]
     128                 :            :         {
     129                 :            :         case BORDER_NONE:
     130                 :            :             pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
     131 [ #  # ][ #  # ]:          0 :                                   OUSTR("none") );
     132                 :          0 :             break;
     133                 :            :         case BORDER_3D:
     134                 :            :             pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
     135 [ #  # ][ #  # ]:          0 :                                   OUSTR("3d") );
     136                 :          0 :             break;
     137                 :            :         case BORDER_SIMPLE:
     138                 :            :             pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
     139 [ #  # ][ #  # ]:          0 :                                   OUSTR("simple") );
     140                 :          0 :             break;
     141                 :            :         case BORDER_SIMPLE_COLOR: {
     142                 :          0 :             OUStringBuffer buf;
     143         [ #  # ]:          0 :             buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
     144                 :            :             buf.append( OUString::valueOf(
     145         [ #  # ]:          0 :                             (sal_Int64)(sal_uInt64)_borderColor, 16 ) );
     146                 :            :             pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
     147 [ #  # ][ #  # ]:          0 :                                   buf.makeStringAndClear() );
                 [ #  # ]
     148                 :          0 :             break;
     149                 :            :         }
     150                 :            :         default:
     151                 :            :             OSL_FAIL( "### unexpected border value!" );
     152                 :          0 :             break;
     153                 :            :         }
     154                 :            :     }
     155                 :            : 
     156                 :            :     // visual effect (look)
     157         [ #  # ]:          0 :     if (_set & 0x40)
     158                 :            :     {
     159   [ #  #  #  # ]:          0 :         switch (_visualEffect)
     160                 :            :         {
     161                 :            :         case awt::VisualEffect::NONE:
     162                 :            :             pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":look"),
     163 [ #  # ][ #  # ]:          0 :                                   OUSTR("none") );
     164                 :          0 :             break;
     165                 :            :         case awt::VisualEffect::LOOK3D:
     166                 :            :             pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":look"),
     167 [ #  # ][ #  # ]:          0 :                                   OUSTR("3d") );
     168                 :          0 :             break;
     169                 :            :         case awt::VisualEffect::FLAT:
     170                 :            :             pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":look"),
     171 [ #  # ][ #  # ]:          0 :                                   OUSTR("simple") );
     172                 :          0 :             break;
     173                 :            :         default:
     174                 :            :             OSL_FAIL( "### unexpected visual effect value!" );
     175                 :          0 :             break;
     176                 :            :         }
     177                 :            :     }
     178                 :            : 
     179                 :            :     // font-
     180         [ #  # ]:          0 :     if (_set & 0x8)
     181                 :            :     {
     182                 :          0 :         awt::FontDescriptor def_descr;
     183                 :            : 
     184                 :            :         // dialog:font-name CDATA #IMPLIED
     185         [ #  # ]:          0 :         if (def_descr.Name != _descr.Name)
     186                 :            :         {
     187                 :            :             pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-name") ),
     188 [ #  # ][ #  # ]:          0 :                                   _descr.Name );
     189                 :            :         }
     190                 :            :         // dialog:font-height %numeric; #IMPLIED
     191         [ #  # ]:          0 :         if (def_descr.Height != _descr.Height)
     192                 :            :         {
     193                 :            :             pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-height") ),
     194 [ #  # ][ #  # ]:          0 :                                   OUString::valueOf( (sal_Int32)_descr.Height ) );
     195                 :            :         }
     196                 :            :         // dialog:font-width %numeric; #IMPLIED
     197         [ #  # ]:          0 :         if (def_descr.Width != _descr.Width)
     198                 :            :         {
     199                 :            :             pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-width") ),
     200 [ #  # ][ #  # ]:          0 :                                   OUString::valueOf( (sal_Int32)_descr.Width ) );
     201                 :            :         }
     202                 :            :         // dialog:font-stylename CDATA #IMPLIED
     203         [ #  # ]:          0 :         if (def_descr.StyleName != _descr.StyleName)
     204                 :            :         {
     205                 :            :             pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-stylename") ),
     206 [ #  # ][ #  # ]:          0 :                                   _descr.StyleName );
     207                 :            :         }
     208                 :            :         // dialog:font-family "(decorative|modern|roman|script|swiss|system)" #IMPLIED
     209         [ #  # ]:          0 :         if (def_descr.Family != _descr.Family)
     210                 :            :         {
     211   [ #  #  #  #  :          0 :             switch (_descr.Family)
                #  #  # ]
     212                 :            :             {
     213                 :            :             case awt::FontFamily::DECORATIVE:
     214                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
     215 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("decorative") ) );
                 [ #  # ]
     216                 :          0 :                 break;
     217                 :            :             case awt::FontFamily::MODERN:
     218                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
     219 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("modern") ) );
                 [ #  # ]
     220                 :          0 :                 break;
     221                 :            :             case awt::FontFamily::ROMAN:
     222                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
     223 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("roman") ) );
                 [ #  # ]
     224                 :          0 :                 break;
     225                 :            :             case awt::FontFamily::SCRIPT:
     226                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
     227 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("script") ) );
                 [ #  # ]
     228                 :          0 :                 break;
     229                 :            :             case awt::FontFamily::SWISS:
     230                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
     231 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("swiss") ) );
                 [ #  # ]
     232                 :          0 :                 break;
     233                 :            :             case awt::FontFamily::SYSTEM:
     234                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
     235 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("system") ) );
                 [ #  # ]
     236                 :          0 :                 break;
     237                 :            :             default:
     238                 :            :                 OSL_FAIL( "### unexpected font-family!" );
     239                 :          0 :                 break;
     240                 :            :             }
     241                 :            :         }
     242                 :            :         // dialog:font-charset "(ansi|mac|ibmpc_437|ibmpc_850|ibmpc_860|ibmpc_861|ibmpc_863|ibmpc_865|system|symbol)" #IMPLIED
     243         [ #  # ]:          0 :         if (def_descr.CharSet != _descr.CharSet)
     244                 :            :         {
     245   [ #  #  #  #  :          0 :             switch (_descr.CharSet)
          #  #  #  #  #  
                   #  # ]
     246                 :            :             {
     247                 :            :             case awt::CharSet::ANSI:
     248                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
     249 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("ansi") ) );
                 [ #  # ]
     250                 :          0 :                 break;
     251                 :            :             case awt::CharSet::MAC:
     252                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
     253 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("mac") ) );
                 [ #  # ]
     254                 :          0 :                 break;
     255                 :            :             case awt::CharSet::IBMPC_437:
     256                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
     257 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_437") ) );
                 [ #  # ]
     258                 :          0 :                 break;
     259                 :            :             case awt::CharSet::IBMPC_850:
     260                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
     261 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_850") ) );
                 [ #  # ]
     262                 :          0 :                 break;
     263                 :            :             case awt::CharSet::IBMPC_860:
     264                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
     265 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_860") ) );
                 [ #  # ]
     266                 :          0 :                 break;
     267                 :            :             case awt::CharSet::IBMPC_861:
     268                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
     269 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_861") ) );
                 [ #  # ]
     270                 :          0 :                 break;
     271                 :            :             case awt::CharSet::IBMPC_863:
     272                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
     273 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_863") ) );
                 [ #  # ]
     274                 :          0 :                 break;
     275                 :            :             case awt::CharSet::IBMPC_865:
     276                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
     277 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_865") ) );
                 [ #  # ]
     278                 :          0 :                 break;
     279                 :            :             case awt::CharSet::SYSTEM:
     280                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
     281 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("system") ) );
                 [ #  # ]
     282                 :          0 :                 break;
     283                 :            :             case awt::CharSet::SYMBOL:
     284                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
     285 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("symbol") ) );
                 [ #  # ]
     286                 :          0 :                 break;
     287                 :            :             default:
     288                 :            :                 OSL_FAIL( "### unexpected font-charset!" );
     289                 :          0 :                 break;
     290                 :            :             }
     291                 :            :         }
     292                 :            :         // dialog:font-pitch "(fixed|variable)" #IMPLIED
     293         [ #  # ]:          0 :         if (def_descr.Pitch != _descr.Pitch)
     294                 :            :         {
     295      [ #  #  # ]:          0 :             switch (_descr.Pitch)
     296                 :            :             {
     297                 :            :             case awt::FontPitch::FIXED:
     298                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-pitch") ),
     299 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("fixed") ) );
                 [ #  # ]
     300                 :          0 :                 break;
     301                 :            :             case awt::FontPitch::VARIABLE:
     302                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-pitch") ),
     303 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("variable") ) );
                 [ #  # ]
     304                 :          0 :                 break;
     305                 :            :             default:
     306                 :            :                 OSL_FAIL( "### unexpected font-pitch!" );
     307                 :          0 :                 break;
     308                 :            :             }
     309                 :            :         }
     310                 :            :         // dialog:font-charwidth CDATA #IMPLIED
     311         [ #  # ]:          0 :         if (def_descr.CharacterWidth != _descr.CharacterWidth)
     312                 :            :         {
     313                 :            :             pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charwidth") ),
     314 [ #  # ][ #  # ]:          0 :                                   OUString::valueOf( (float)_descr.CharacterWidth ) );
     315                 :            :         }
     316                 :            :         // dialog:font-weight CDATA #IMPLIED
     317         [ #  # ]:          0 :         if (def_descr.Weight != _descr.Weight)
     318                 :            :         {
     319                 :            :             pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-weight") ),
     320 [ #  # ][ #  # ]:          0 :                                   OUString::valueOf( (float)_descr.Weight ) );
     321                 :            :         }
     322                 :            :         // dialog:font-slant "(oblique|italic|reverse_oblique|reverse_italic)" #IMPLIED
     323         [ #  # ]:          0 :         if (def_descr.Slant != _descr.Slant)
     324                 :            :         {
     325   [ #  #  #  #  :          0 :             switch (_descr.Slant)
                      # ]
     326                 :            :             {
     327                 :            :             case awt::FontSlant_OBLIQUE:
     328                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
     329 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("oblique") ) );
                 [ #  # ]
     330                 :          0 :                 break;
     331                 :            :             case awt::FontSlant_ITALIC:
     332                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
     333 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("italic") ) );
                 [ #  # ]
     334                 :          0 :                 break;
     335                 :            :             case awt::FontSlant_REVERSE_OBLIQUE:
     336                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
     337 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("reverse_oblique") ) );
                 [ #  # ]
     338                 :          0 :                 break;
     339                 :            :             case awt::FontSlant_REVERSE_ITALIC:
     340                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
     341 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("reverse_italic") ) );
                 [ #  # ]
     342                 :          0 :                 break;
     343                 :            :             default:
     344                 :            :                 OSL_FAIL( "### unexpected font-slant!" );
     345                 :          0 :                 break;
     346                 :            :             }
     347                 :            :         }
     348                 :            :         // dialog:font-underline "(single|double|dotted|dash|longdash|dashdot|dashdotdot|smallwave|wave|doublewave|bold|bolddotted|bolddash|boldlongdash|bolddashdot|bolddashdotdot|boldwave)" #IMPLIED
     349         [ #  # ]:          0 :         if (def_descr.Underline != _descr.Underline)
     350                 :            :         {
     351   [ #  #  #  #  :          0 :             switch (_descr.Underline)
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     352                 :            :             {
     353                 :            :             case awt::FontUnderline::SINGLE:
     354                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     355 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
                 [ #  # ]
     356                 :          0 :                 break;
     357                 :            :             case awt::FontUnderline::DOUBLE:
     358                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     359 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("double") ) );
                 [ #  # ]
     360                 :          0 :                 break;
     361                 :            :             case awt::FontUnderline::DOTTED:
     362                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     363 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("dotted") ) );
                 [ #  # ]
     364                 :          0 :                 break;
     365                 :            :             case awt::FontUnderline::DASH:
     366                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     367 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("dash") ) );
                 [ #  # ]
     368                 :          0 :                 break;
     369                 :            :             case awt::FontUnderline::LONGDASH:
     370                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     371 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("longdash") ) );
                 [ #  # ]
     372                 :          0 :                 break;
     373                 :            :             case awt::FontUnderline::DASHDOT:
     374                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     375 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("dashdot") ) );
                 [ #  # ]
     376                 :          0 :                 break;
     377                 :            :             case awt::FontUnderline::DASHDOTDOT:
     378                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     379 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("dashdotdot") ) );
                 [ #  # ]
     380                 :          0 :                 break;
     381                 :            :             case awt::FontUnderline::SMALLWAVE:
     382                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     383 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("smallwave") ) );
                 [ #  # ]
     384                 :          0 :                 break;
     385                 :            :             case awt::FontUnderline::WAVE:
     386                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     387 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("wave") ) );
                 [ #  # ]
     388                 :          0 :                 break;
     389                 :            :             case awt::FontUnderline::DOUBLEWAVE:
     390                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     391 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("doublewave") ) );
                 [ #  # ]
     392                 :          0 :                 break;
     393                 :            :             case awt::FontUnderline::BOLD:
     394                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     395 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("bold") ) );
                 [ #  # ]
     396                 :          0 :                 break;
     397                 :            :             case awt::FontUnderline::BOLDDOTTED:
     398                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     399 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("bolddotted") ) );
                 [ #  # ]
     400                 :          0 :                 break;
     401                 :            :             case awt::FontUnderline::BOLDDASH:
     402                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     403 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("bolddash") ) );
                 [ #  # ]
     404                 :          0 :                 break;
     405                 :            :             case awt::FontUnderline::BOLDLONGDASH:
     406                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     407 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("boldlongdash") ) );
                 [ #  # ]
     408                 :          0 :                 break;
     409                 :            :             case awt::FontUnderline::BOLDDASHDOT:
     410                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     411 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("bolddashdot") ) );
                 [ #  # ]
     412                 :          0 :                 break;
     413                 :            :             case awt::FontUnderline::BOLDDASHDOTDOT:
     414                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     415 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("bolddashdotdot") ) );
                 [ #  # ]
     416                 :          0 :                 break;
     417                 :            :             case awt::FontUnderline::BOLDWAVE:
     418                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
     419 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("boldwave") ) );
                 [ #  # ]
     420                 :          0 :                 break;
     421                 :            :             default:
     422                 :            :                 OSL_FAIL( "### unexpected font-underline!" );
     423                 :          0 :                 break;
     424                 :            :             }
     425                 :            :         }
     426                 :            :         // dialog:font-strikeout "(single|double|bold|slash|x)" #IMPLIED
     427         [ #  # ]:          0 :         if (def_descr.Strikeout != _descr.Strikeout)
     428                 :            :         {
     429   [ #  #  #  #  :          0 :             switch (_descr.Strikeout)
                   #  # ]
     430                 :            :             {
     431                 :            :             case awt::FontStrikeout::SINGLE:
     432                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
     433 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
                 [ #  # ]
     434                 :          0 :                 break;
     435                 :            :             case awt::FontStrikeout::DOUBLE:
     436                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
     437 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("double") ) );
                 [ #  # ]
     438                 :          0 :                 break;
     439                 :            :             case awt::FontStrikeout::BOLD:
     440                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
     441 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("bold") ) );
                 [ #  # ]
     442                 :          0 :                 break;
     443                 :            :             case awt::FontStrikeout::SLASH:
     444                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
     445 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("slash") ) );
                 [ #  # ]
     446                 :          0 :                 break;
     447                 :            :             case awt::FontStrikeout::X:
     448                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
     449 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) );
                 [ #  # ]
     450                 :          0 :                 break;
     451                 :            :             default:
     452                 :            :                 OSL_FAIL( "### unexpected font-strikeout!" );
     453                 :          0 :                 break;
     454                 :            :             }
     455                 :            :         }
     456                 :            :         // dialog:font-orientation CDATA #IMPLIED
     457         [ #  # ]:          0 :         if (def_descr.Orientation != _descr.Orientation)
     458                 :            :         {
     459                 :            :             pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-orientation") ),
     460 [ #  # ][ #  # ]:          0 :                                   OUString::valueOf( (float)_descr.Orientation ) );
     461                 :            :         }
     462                 :            :         // dialog:font-kerning %boolean; #IMPLIED
     463         [ #  # ]:          0 :         if ((def_descr.Kerning != sal_False) != (_descr.Kerning != sal_False))
     464                 :            :         {
     465                 :            :             pStyle->addBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-kerning") ),
     466 [ #  # ][ #  # ]:          0 :                                     _descr.Kerning );
     467                 :            :         }
     468                 :            :         // dialog:font-wordlinemode %boolean; #IMPLIED
     469         [ #  # ]:          0 :         if ((def_descr.WordLineMode != sal_False) != (_descr.WordLineMode != sal_False))
     470                 :            :         {
     471                 :            :             pStyle->addBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-wordlinemode") ),
     472 [ #  # ][ #  # ]:          0 :                                  _descr.WordLineMode );
     473                 :            :         }
     474                 :            :         // dialog:font-type "(raster|device|scalable)" #IMPLIED
     475         [ #  # ]:          0 :         if (def_descr.Type != _descr.Type)
     476                 :            :         {
     477   [ #  #  #  # ]:          0 :             switch (_descr.Type)
     478                 :            :             {
     479                 :            :             case awt::FontType::RASTER:
     480                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-type") ),
     481 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("raster") ) );
                 [ #  # ]
     482                 :          0 :                 break;
     483                 :            :             case awt::FontType::DEVICE:
     484                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-type") ),
     485 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("device") ) );
                 [ #  # ]
     486                 :          0 :                 break;
     487                 :            :             case awt::FontType::SCALABLE:
     488                 :            :                 pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-type") ),
     489 [ #  # ][ #  # ]:          0 :                                       OUString( RTL_CONSTASCII_USTRINGPARAM("scalable") ) );
                 [ #  # ]
     490                 :          0 :                 break;
     491                 :            :             default:
     492                 :            :                 OSL_FAIL( "### unexpected font-type!" );
     493                 :          0 :                 break;
     494                 :            :             }
     495                 :            :         }
     496                 :            : 
     497                 :            :         // additional attributes not in FontDescriptor struct
     498                 :            :         // dialog:font-relief (none|embossed|engraved) #IMPLIED
     499   [ #  #  #  # ]:          0 :         switch (_fontRelief)
     500                 :            :         {
     501                 :            :         case awt::FontRelief::NONE: // dont export default
     502                 :          0 :             break;
     503                 :            :         case awt::FontRelief::EMBOSSED:
     504                 :            :             pStyle->addAttribute(
     505                 :            :                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-relief") ),
     506 [ #  # ][ #  # ]:          0 :                 OUString( RTL_CONSTASCII_USTRINGPARAM("embossed") ) );
                 [ #  # ]
     507                 :          0 :             break;
     508                 :            :         case awt::FontRelief::ENGRAVED:
     509                 :            :             pStyle->addAttribute(
     510                 :            :                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-relief") ),
     511 [ #  # ][ #  # ]:          0 :                 OUString( RTL_CONSTASCII_USTRINGPARAM("engraved") ) );
                 [ #  # ]
     512                 :          0 :             break;
     513                 :            :         default:
     514                 :            :             OSL_FAIL( "### unexpected font-relief!" );
     515                 :          0 :             break;
     516                 :            :         }
     517                 :            :         // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED
     518   [ #  #  #  #  :          0 :         switch (_fontEmphasisMark)
             #  #  #  # ]
     519                 :            :         {
     520                 :            :         case awt::FontEmphasisMark::NONE: // dont export default
     521                 :          0 :             break;
     522                 :            :         case awt::FontEmphasisMark::DOT:
     523                 :            :             pStyle->addAttribute(
     524                 :            :                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
     525 [ #  # ][ #  # ]:          0 :                 OUString( RTL_CONSTASCII_USTRINGPARAM("dot") ) );
                 [ #  # ]
     526                 :          0 :             break;
     527                 :            :         case awt::FontEmphasisMark::CIRCLE:
     528                 :            :             pStyle->addAttribute(
     529                 :            :                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
     530 [ #  # ][ #  # ]:          0 :                 OUString( RTL_CONSTASCII_USTRINGPARAM("circle") ) );
                 [ #  # ]
     531                 :          0 :             break;
     532                 :            :         case awt::FontEmphasisMark::DISC:
     533                 :            :             pStyle->addAttribute(
     534                 :            :                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
     535 [ #  # ][ #  # ]:          0 :                 OUString( RTL_CONSTASCII_USTRINGPARAM("disc") ) );
                 [ #  # ]
     536                 :          0 :             break;
     537                 :            :         case awt::FontEmphasisMark::ACCENT:
     538                 :            :             pStyle->addAttribute(
     539                 :            :                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
     540 [ #  # ][ #  # ]:          0 :                 OUString( RTL_CONSTASCII_USTRINGPARAM("accent") ) );
                 [ #  # ]
     541                 :          0 :             break;
     542                 :            :         case awt::FontEmphasisMark::ABOVE:
     543                 :            :             pStyle->addAttribute(
     544                 :            :                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
     545 [ #  # ][ #  # ]:          0 :                 OUString( RTL_CONSTASCII_USTRINGPARAM("above") ) );
                 [ #  # ]
     546                 :          0 :             break;
     547                 :            :         case awt::FontEmphasisMark::BELOW:
     548                 :            :             pStyle->addAttribute(
     549                 :            :                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
     550 [ #  # ][ #  # ]:          0 :                 OUString( RTL_CONSTASCII_USTRINGPARAM("below") ) );
                 [ #  # ]
     551                 :          0 :             break;
     552                 :            :         default:
     553                 :            :             OSL_FAIL( "### unexpected font-emphasismark!" );
     554                 :          0 :             break;
     555                 :          0 :         }
     556                 :            :     }
     557                 :            : 
     558         [ #  # ]:          0 :     return pStyle;
     559                 :            : }
     560                 :            : 
     561                 :            : //##################################################################################################
     562                 :            : 
     563                 :            : //__________________________________________________________________________________________________
     564                 :          0 : void ElementDescriptor::addNumberFormatAttr(
     565                 :            :     Reference< beans::XPropertySet > const & xFormatProperties )
     566                 :            : {
     567         [ #  # ]:          0 :     Reference< beans::XPropertyState > xState( xFormatProperties, UNO_QUERY );
     568                 :          0 :     OUString sFormat;
     569                 :          0 :     lang::Locale locale;
     570 [ #  # ][ #  # ]:          0 :     OSL_VERIFY( xFormatProperties->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatString") ) ) >>= sFormat );
                 [ #  # ]
     571 [ #  # ][ #  # ]:          0 :     OSL_VERIFY( xFormatProperties->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Locale") ) ) >>= locale );
         [ #  # ][ #  # ]
     572                 :            : 
     573                 :            :     addAttribute(
     574                 :            :         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":format-code") ),
     575 [ #  # ][ #  # ]:          0 :         sFormat );
     576                 :            : 
     577                 :            :     // format-locale
     578                 :          0 :     OUStringBuffer buf( 48 );
     579         [ #  # ]:          0 :     buf.append( locale.Language );
     580         [ #  # ]:          0 :     if (!locale.Country.isEmpty())
     581                 :            :     {
     582         [ #  # ]:          0 :         buf.append( (sal_Unicode)';' );
     583         [ #  # ]:          0 :         buf.append( locale.Country );
     584         [ #  # ]:          0 :         if (!locale.Variant.isEmpty())
     585                 :            :         {
     586         [ #  # ]:          0 :             buf.append( (sal_Unicode)';' );
     587         [ #  # ]:          0 :             buf.append( locale.Variant );
     588                 :            :         }
     589                 :            :     }
     590                 :            :     addAttribute(
     591                 :            :         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":format-locale") ),
     592 [ #  # ][ #  # ]:          0 :         buf.makeStringAndClear() );
                 [ #  # ]
     593                 :          0 : }
     594                 :            : //__________________________________________________________________________________________________
     595                 :          0 : Any ElementDescriptor::readProp( OUString const & rPropName )
     596                 :            : {
     597         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     598                 :            :     {
     599                 :          0 :         return _xProps->getPropertyValue( rPropName );
     600                 :            :     }
     601                 :          0 :     return Any();
     602                 :            : }
     603                 :            : 
     604                 :            : //______________________________________________________________________________
     605                 :          0 : void ElementDescriptor::readStringAttr(
     606                 :            :     OUString const & rPropName, OUString const & rAttrName )
     607                 :            : {
     608         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE !=
     609                 :          0 :         _xPropState->getPropertyState( rPropName ))
     610                 :            :     {
     611 [ #  # ][ #  # ]:          0 :         Any a( _xProps->getPropertyValue( rPropName ) );
     612                 :          0 :         OUString v;
     613         [ #  # ]:          0 :         if (a >>= v)
     614         [ #  # ]:          0 :             addAttribute( rAttrName, v );
     615                 :            :         else
     616                 :          0 :             OSL_FAIL( "### unexpected property type!" );
     617                 :            :     }
     618                 :          0 : }
     619                 :            : 
     620                 :            : //__________________________________________________________________________________________________
     621                 :          0 : void ElementDescriptor::readHexLongAttr( OUString const & rPropName, OUString const & rAttrName )
     622                 :            : {
     623         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     624                 :            :     {
     625 [ #  # ][ #  # ]:          0 :         Any a( _xProps->getPropertyValue( rPropName ) );
     626         [ #  # ]:          0 :         if (a.getValueTypeClass() == TypeClass_LONG)
     627                 :            :         {
     628                 :          0 :             OUStringBuffer buf( 16 );
     629         [ #  # ]:          0 :             buf.append( (sal_Unicode)'0' );
     630         [ #  # ]:          0 :             buf.append( (sal_Unicode)'x' );
     631         [ #  # ]:          0 :             buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)*(sal_uInt32 *)a.getValue(), 16 ) );
     632 [ #  # ][ #  # ]:          0 :             addAttribute( rAttrName, buf.makeStringAndClear() );
     633                 :          0 :         }
     634                 :            :     }
     635                 :          0 : }
     636                 :            : 
     637                 :            : //__________________________________________________________________________________________________
     638                 :          0 : void ElementDescriptor::readDateFormatAttr( OUString const & rPropName, OUString const & rAttrName )
     639                 :            : {
     640         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     641                 :            :     {
     642 [ #  # ][ #  # ]:          0 :         Any a( _xProps->getPropertyValue( rPropName ) );
     643         [ #  # ]:          0 :         if (a.getValueTypeClass() == TypeClass_SHORT)
     644                 :            :         {
     645   [ #  #  #  #  :          0 :             switch (*(sal_Int16 const *)a.getValue())
          #  #  #  #  #  
             #  #  #  # ]
     646                 :            :             {
     647                 :            :             case 0:
     648 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short") ) );
     649                 :          0 :                 break;
     650                 :            :             case 1:
     651 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short_YY") ) );
     652                 :          0 :                 break;
     653                 :            :             case 2:
     654 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short_YYYY") ) );
     655                 :          0 :                 break;
     656                 :            :             case 3:
     657 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_long") ) );
     658                 :          0 :                 break;
     659                 :            :             case 4:
     660 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_DDMMYY") ) );
     661                 :          0 :                 break;
     662                 :            :             case 5:
     663 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_MMDDYY") ) );
     664                 :          0 :                 break;
     665                 :            :             case 6:
     666 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYMMDD") ) );
     667                 :          0 :                 break;
     668                 :            :             case 7:
     669 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_DDMMYYYY") ) );
     670                 :          0 :                 break;
     671                 :            :             case 8:
     672 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_MMDDYYYY") ) );
     673                 :          0 :                 break;
     674                 :            :             case 9:
     675 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYYYMMDD") ) );
     676                 :          0 :                 break;
     677                 :            :             case 10:
     678 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYMMDD_DIN5008") ) );
     679                 :          0 :                 break;
     680                 :            :             case 11:
     681 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYYYMMDD_DIN5008") ) );
     682                 :          0 :                 break;
     683                 :            :             default:
     684                 :            :                 OSL_FAIL( "### unexpected date format!" );
     685                 :          0 :                 break;
     686                 :            :             }
     687                 :          0 :         }
     688                 :            :     }
     689                 :          0 : }
     690                 :            : //__________________________________________________________________________________________________
     691                 :          0 : void ElementDescriptor::readTimeFormatAttr( OUString const & rPropName, OUString const & rAttrName )
     692                 :            : {
     693         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     694                 :            :     {
     695 [ #  # ][ #  # ]:          0 :         Any a( _xProps->getPropertyValue( rPropName ) );
     696         [ #  # ]:          0 :         if (a.getValueTypeClass() == TypeClass_SHORT)
     697                 :            :         {
     698   [ #  #  #  #  :          0 :             switch (*(sal_Int16 const *)a.getValue())
                #  #  # ]
     699                 :            :             {
     700                 :            :             case 0:
     701 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("24h_short") ) );
     702                 :          0 :                 break;
     703                 :            :             case 1:
     704 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("24h_long") ) );
     705                 :          0 :                 break;
     706                 :            :             case 2:
     707 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("12h_short") ) );
     708                 :          0 :                 break;
     709                 :            :             case 3:
     710 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("12h_long") ) );
     711                 :          0 :                 break;
     712                 :            :             case 4:
     713 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration_short") ) );
     714                 :          0 :                 break;
     715                 :            :             case 5:
     716 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration_long") ) );
     717                 :          0 :                 break;
     718                 :            :             default:
     719                 :            :                 OSL_FAIL( "### unexpected time format!" );
     720                 :          0 :                 break;
     721                 :            :             }
     722                 :          0 :         }
     723                 :            :     }
     724                 :          0 : }
     725                 :            : //__________________________________________________________________________________________________
     726                 :          0 : void ElementDescriptor::readAlignAttr( OUString const & rPropName, OUString const & rAttrName )
     727                 :            : {
     728         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     729                 :            :     {
     730 [ #  # ][ #  # ]:          0 :         Any a( _xProps->getPropertyValue( rPropName ) );
     731         [ #  # ]:          0 :         if (a.getValueTypeClass() == TypeClass_SHORT)
     732                 :            :         {
     733   [ #  #  #  # ]:          0 :             switch (*(sal_Int16 const *)a.getValue())
     734                 :            :             {
     735                 :            :             case 0:
     736 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) );
     737                 :          0 :                 break;
     738                 :            :             case 1:
     739 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
     740                 :          0 :                 break;
     741                 :            :             case 2:
     742 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right") ) );
     743                 :          0 :                 break;
     744                 :            :             default:
     745                 :            :                 OSL_FAIL( "### illegal alignment value!" );
     746                 :          0 :                 break;
     747                 :            :             }
     748                 :          0 :         }
     749                 :            :     }
     750                 :          0 : }
     751                 :            : //__________________________________________________________________________________________________
     752                 :          0 : void ElementDescriptor::readVerticalAlignAttr( OUString const & rPropName, OUString const & rAttrName )
     753                 :            : {
     754         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     755                 :            :     {
     756 [ #  # ][ #  # ]:          0 :         Any a( _xProps->getPropertyValue( rPropName ) );
     757 [ #  # ][ #  # ]:          0 :         if (a.getValueTypeClass() == TypeClass_ENUM && a.getValueType() == ::getCppuType( (style::VerticalAlignment*)0 ))
         [ #  # ][ #  # ]
     758                 :            :         {
     759                 :            :             style::VerticalAlignment eAlign;
     760         [ #  # ]:          0 :             a >>= eAlign;
     761   [ #  #  #  # ]:          0 :             switch (eAlign)
     762                 :            :             {
     763                 :            :             case style::VerticalAlignment_TOP:
     764 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
     765                 :          0 :                 break;
     766                 :            :             case style::VerticalAlignment_MIDDLE:
     767 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
     768                 :          0 :                 break;
     769                 :            :             case style::VerticalAlignment_BOTTOM:
     770 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom") ) );
     771                 :          0 :                 break;
     772                 :            :             default:
     773                 :            :                 OSL_FAIL( "### illegal vertical alignment value!" );
     774                 :          0 :                 break;
     775                 :            :             }
     776                 :          0 :         }
     777                 :            :     }
     778                 :          0 : }
     779                 :            : //__________________________________________________________________________________________________
     780                 :          0 : void ElementDescriptor::readImageURLAttr( OUString const & rPropName, OUString const & rAttrName )
     781                 :            : {
     782         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     783                 :            :     {
     784                 :          0 :         rtl::OUString sURL;
     785 [ #  # ][ #  # ]:          0 :         _xProps->getPropertyValue( rPropName ) >>= sURL;
     786                 :            : 
     787 [ #  # ][ #  # ]:          0 :         if ( !sURL.isEmpty() && sURL.compareToAscii( XMLSCRIPT_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( XMLSCRIPT_GRAPHOBJ_URLPREFIX ) ) == 0 )
                 [ #  # ]
     788                 :            :         {
     789         [ #  # ]:          0 :             Reference< document::XStorageBasedDocument > xDocStorage( _xDocument, UNO_QUERY );
     790         [ #  # ]:          0 :             if ( xDocStorage.is() )
     791                 :            :             {
     792         [ #  # ]:          0 :                 uno::Sequence< Any > aArgs( 1 );
     793 [ #  # ][ #  # ]:          0 :                 aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
         [ #  # ][ #  # ]
     794                 :            : 
     795 [ #  # ][ #  # ]:          0 :                 ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
     796                 :          0 :                 uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
     797 [ #  # ][ #  # ]:          0 :                 aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
     798         [ #  # ]:          0 :                 if ( xGraphicResolver.is() )
     799 [ #  # ][ #  # ]:          0 :                     sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
         [ #  # ][ #  # ]
     800                 :          0 :             }
     801                 :            :         }
     802         [ #  # ]:          0 :         if ( !sURL.isEmpty() )
     803         [ #  # ]:          0 :                 addAttribute( rAttrName, sURL );
     804                 :            :     }
     805                 :          0 : }
     806                 :            : //__________________________________________________________________________________________________
     807                 :          0 : void ElementDescriptor::readImageAlignAttr( OUString const & rPropName, OUString const & rAttrName )
     808                 :            : {
     809         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     810                 :            :     {
     811 [ #  # ][ #  # ]:          0 :         Any a( _xProps->getPropertyValue( rPropName ) );
     812         [ #  # ]:          0 :         if (a.getValueTypeClass() == TypeClass_SHORT)
     813                 :            :         {
     814   [ #  #  #  #  :          0 :             switch (*(sal_Int16 const *)a.getValue())
                      # ]
     815                 :            :             {
     816                 :            :             case 0:
     817 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) );
     818                 :          0 :                 break;
     819                 :            :             case 1:
     820 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
     821                 :          0 :                 break;
     822                 :            :             case 2:
     823 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right") ) );
     824                 :          0 :                 break;
     825                 :            :             case 3:
     826 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom") ) );
     827                 :          0 :                 break;
     828                 :            :             default:
     829                 :            :                 OSL_FAIL( "### illegal image alignment value!" );
     830                 :          0 :                 break;
     831                 :            :             }
     832                 :          0 :         }
     833                 :            :     }
     834                 :          0 : }
     835                 :            : //__________________________________________________________________________________________________
     836                 :          0 : void ElementDescriptor::readImagePositionAttr( OUString const & rPropName, OUString const & rAttrName )
     837                 :            : {
     838         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     839                 :            :     {
     840 [ #  # ][ #  # ]:          0 :         Any a( _xProps->getPropertyValue( rPropName ) );
     841         [ #  # ]:          0 :         if (a.getValueTypeClass() == TypeClass_SHORT)
     842                 :            :         {
     843   [ #  #  #  #  :          0 :             switch (*(sal_Int16 const *)a.getValue())
          #  #  #  #  #  
             #  #  #  #  
                      # ]
     844                 :            :             {
     845                 :            :             case awt::ImagePosition::LeftTop:
     846 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left-top") ) );
     847                 :          0 :                 break;
     848                 :            :             case awt::ImagePosition::LeftCenter:
     849 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left-center") ) );
     850                 :          0 :                 break;
     851                 :            :             case awt::ImagePosition::LeftBottom:
     852 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left-bottom") ) );
     853                 :          0 :                 break;
     854                 :            :             case awt::ImagePosition::RightTop:
     855 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right-top") ) );
     856                 :          0 :                 break;
     857                 :            :             case awt::ImagePosition::RightCenter:
     858 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right-center") ) );
     859                 :          0 :                 break;
     860                 :            :             case awt::ImagePosition::RightBottom:
     861 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right-bottom") ) );
     862                 :          0 :                 break;
     863                 :            :             case awt::ImagePosition::AboveLeft:
     864 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top-left") ) );
     865                 :          0 :                 break;
     866                 :            :             case awt::ImagePosition::AboveCenter:
     867 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top-center") ) );
     868                 :          0 :                 break;
     869                 :            :             case awt::ImagePosition::AboveRight:
     870 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top-right") ) );
     871                 :          0 :                 break;
     872                 :            :             case awt::ImagePosition::BelowLeft:
     873 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-left") ) );
     874                 :          0 :                 break;
     875                 :            :             case awt::ImagePosition::BelowCenter:
     876 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-center") ) );
     877                 :          0 :                 break;
     878                 :            :             case awt::ImagePosition::BelowRight:
     879 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-right") ) );
     880                 :          0 :                 break;
     881                 :            :             case awt::ImagePosition::Centered:
     882 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
     883                 :          0 :                 break;
     884                 :            :             default:
     885                 :            :                 OSL_FAIL( "### illegal image position value!" );
     886                 :          0 :                 break;
     887                 :            :             }
     888                 :          0 :         }
     889                 :            :     }
     890                 :          0 : }
     891                 :            : //__________________________________________________________________________________________________
     892                 :          0 : void ElementDescriptor::readButtonTypeAttr( OUString const & rPropName, OUString const & rAttrName )
     893                 :            : {
     894         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     895                 :            :     {
     896 [ #  # ][ #  # ]:          0 :         Any a( _xProps->getPropertyValue( rPropName ) );
     897         [ #  # ]:          0 :         if (a.getValueTypeClass() == TypeClass_SHORT)
     898                 :            :         {
     899   [ #  #  #  #  :          0 :             switch (*(sal_Int16 const *)a.getValue())
                      # ]
     900                 :            :             {
     901                 :            :             case awt::PushButtonType_STANDARD:
     902 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("standard") ) );
     903                 :          0 :                 break;
     904                 :            :             case awt::PushButtonType_OK:
     905 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("ok") ) );
     906                 :          0 :                 break;
     907                 :            :             case awt::PushButtonType_CANCEL:
     908 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("cancel") ) );
     909                 :          0 :                 break;
     910                 :            :             case awt::PushButtonType_HELP:
     911 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("help") ) );
     912                 :          0 :                 break;
     913                 :            :             default:
     914                 :            :                 OSL_FAIL( "### illegal button-type value!" );
     915                 :          0 :                 break;
     916                 :            :             }
     917                 :          0 :         }
     918                 :            :     }
     919                 :          0 : }
     920                 :            : //__________________________________________________________________________________________________
     921                 :          0 : void ElementDescriptor::readOrientationAttr( OUString const & rPropName, OUString const & rAttrName )
     922                 :            : {
     923         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     924                 :            :     {
     925 [ #  # ][ #  # ]:          0 :         Any a( _xProps->getPropertyValue( rPropName ) );
     926         [ #  # ]:          0 :         if (a.getValueTypeClass() == TypeClass_LONG)
     927                 :            :         {
     928      [ #  #  # ]:          0 :             switch (*(sal_Int32 const *)a.getValue())
     929                 :            :             {
     930                 :            :             case 0:
     931 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("horizontal") ) );
     932                 :          0 :                 break;
     933                 :            :             case 1:
     934 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("vertical") ) );
     935                 :          0 :                 break;
     936                 :            :             default:
     937                 :            :                 OSL_FAIL( "### illegal orientation value!" );
     938                 :          0 :                 break;
     939                 :            :             }
     940                 :          0 :         }
     941                 :            :     }
     942                 :          0 : }
     943                 :            : //__________________________________________________________________________________________________
     944                 :          0 : void ElementDescriptor::readLineEndFormatAttr( OUString const & rPropName, OUString const & rAttrName )
     945                 :            : {
     946         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
     947                 :            :     {
     948 [ #  # ][ #  # ]:          0 :         Any a( _xProps->getPropertyValue( rPropName ) );
     949         [ #  # ]:          0 :         if (a.getValueTypeClass() == TypeClass_SHORT)
     950                 :            :         {
     951   [ #  #  #  # ]:          0 :             switch (*(sal_Int16 const *)a.getValue())
     952                 :            :             {
     953                 :            :             case awt::LineEndFormat::CARRIAGE_RETURN:
     954 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("carriage-return") ) );
     955                 :          0 :                 break;
     956                 :            :             case awt::LineEndFormat::LINE_FEED:
     957 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("line-feed") ) );
     958                 :          0 :                 break;
     959                 :            :             case awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED:
     960 [ #  # ][ #  # ]:          0 :                 addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("carriage-return-line-feed") ) );
     961                 :          0 :                 break;
     962                 :            :             default:
     963                 :            :                 OSL_FAIL( "### illegal line end format value!" );
     964                 :          0 :                 break;
     965                 :            :             }
     966                 :          0 :         }
     967                 :            :     }
     968                 :          0 : }
     969                 :            : //__________________________________________________________________________________________________
     970                 :          0 : void ElementDescriptor::readDataAwareAttr( OUString const & rAttrName )
     971                 :            : {
     972                 :          0 :     Reference< lang::XMultiServiceFactory > xFac;
     973         [ #  # ]:          0 :     if ( _xDocument.is() )
     974         [ #  # ]:          0 :         xFac.set( _xDocument, uno::UNO_QUERY );
     975                 :            : 
     976         [ #  # ]:          0 :     Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
     977                 :            : 
     978 [ #  # ][ #  # ]:          0 :     if ( xFac.is() && xBinding.is() && rAttrName.equals( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     979                 :            :     {
     980                 :            :         try
     981                 :            :         {
     982 [ #  # ][ #  # ]:          0 :             Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     983 [ #  # ][ #  # ]:          0 :         Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
                 [ #  # ]
     984         [ #  # ]:          0 :             if ( xBindable.is() )
     985                 :            :             {
     986                 :          0 :                 table::CellAddress aAddress;
     987 [ #  # ][ #  # ]:          0 :                 xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
         [ #  # ][ #  # ]
     988 [ #  # ][ #  # ]:          0 :                 xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
         [ #  # ][ #  # ]
     989                 :          0 :                 rtl::OUString sAddress;
     990 [ #  # ][ #  # ]:          0 :                 xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
                 [ #  # ]
     991         [ #  # ]:          0 :                 if ( !sAddress.isEmpty() )
     992         [ #  # ]:          0 :                     addAttribute( rAttrName, sAddress );
     993                 :            : 
     994                 :          0 :                 OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
     995                 :            : 
     996         [ #  # ]:          0 :             }
     997                 :            :         }
     998         [ #  # ]:          0 :         catch( uno::Exception& )
     999                 :            :         {
    1000                 :            :         }
    1001                 :            :     }
    1002         [ #  # ]:          0 :     Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
    1003 [ #  # ][ #  # ]:          0 :     if ( xEntrySink.is() && rAttrName.equals( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") ) )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1004                 :            :     {
    1005 [ #  # ][ #  # ]:          0 :         Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
                 [ #  # ]
    1006         [ #  # ]:          0 :         if ( xListSource.is() )
    1007                 :            :         {
    1008                 :            :             try
    1009                 :            :             {
    1010 [ #  # ][ #  # ]:          0 :                 Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
         [ #  # ][ #  # ]
    1011                 :            : 
    1012                 :          0 :                 table::CellRangeAddress aAddress;
    1013 [ #  # ][ #  # ]:          0 :                 xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
         [ #  # ][ #  # ]
    1014                 :            : 
    1015                 :          0 :                 rtl::OUString sAddress;
    1016 [ #  # ][ #  # ]:          0 :                 xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
         [ #  # ][ #  # ]
    1017 [ #  # ][ #  # ]:          0 :                 xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
                 [ #  # ]
    1018                 :            :                 OSL_TRACE("**** cell range source list %s",
    1019                 :            :                     rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
    1020         [ #  # ]:          0 :                 if ( !sAddress.isEmpty() )
    1021 [ #  # ][ #  # ]:          0 :                     addAttribute( rAttrName, sAddress );
    1022                 :            :             }
    1023         [ #  # ]:          0 :             catch( uno::Exception& )
    1024                 :            :             {
    1025                 :            :             }
    1026                 :          0 :         }
    1027                 :          0 :     }
    1028                 :          0 : }
    1029                 :            : //__________________________________________________________________________________________________
    1030                 :          0 : void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUString const & rAttrName )
    1031                 :            : {
    1032         [ #  # ]:          0 :     if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
    1033                 :            :     {
    1034 [ #  # ][ #  # ]:          0 :         Any aSelectionType ( _xProps->getPropertyValue( rPropName ) );
    1035                 :            : 
    1036 [ #  # ][ #  # ]:          0 :         if (aSelectionType.getValueTypeClass() == TypeClass_ENUM && aSelectionType.getValueType() == ::getCppuType( (::view::SelectionType*)0 ))
         [ #  # ][ #  # ]
    1037                 :            :         {
    1038                 :            :             ::view::SelectionType eSelectionType;
    1039         [ #  # ]:          0 :             aSelectionType >>= eSelectionType;
    1040                 :            : 
    1041   [ #  #  #  #  :          0 :             switch (eSelectionType)
                      # ]
    1042                 :            :             {
    1043                 :            :                 case ::view::SelectionType_NONE:
    1044 [ #  # ][ #  # ]:          0 :                     addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("none") ) );
    1045                 :          0 :                     break;
    1046                 :            :                 case ::view::SelectionType_SINGLE:
    1047 [ #  # ][ #  # ]:          0 :                     addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
    1048                 :          0 :                     break;
    1049                 :            :                 case ::view::SelectionType_MULTI:
    1050 [ #  # ][ #  # ]:          0 :                     addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("multi") ) );
    1051                 :          0 :                     break;
    1052                 :            :                 case ::view::SelectionType_RANGE:
    1053 [ #  # ][ #  # ]:          0 :                     addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("range") ) );
    1054                 :          0 :                     break;
    1055                 :            :                 default:
    1056                 :            :                     OSL_FAIL( "### illegal selection type value!" );
    1057                 :          0 :                     break;
    1058                 :            :             }
    1059                 :          0 :         }
    1060                 :            :     }
    1061                 :          0 : }
    1062                 :            : //__________________________________________________________________________________________________
    1063                 :          0 : void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible )
    1064                 :            : {
    1065 [ #  # ][ #  # ]:          0 :     Any a( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) );
                 [ #  # ]
    1066                 :            : 
    1067                 :            :     // The following is a hack to allow 'form' controls to override the default
    1068                 :            :     // control supported by dialogs. This should work well for both vba support and
    1069                 :            :     // normal openoffice ( when normal 'Dialogs' decide to support form control models )
    1070                 :            :     // In the future VBA support might require custom models ( and not the just the form
    1071                 :            :     // variant of a control that we currently use ) In this case the door is still open,
    1072                 :            :     // we just need to define a new way for the 'ServiceName' to be extracted from the
    1073                 :            :     // incomming model. E.g. the use of supporting service
    1074                 :            :     // "com.sun.star.form.FormComponent", 'ServiceName' and XPersistObject
    1075                 :            :     // is only an implementation detail here, in the future some other
    1076                 :            :     // method ( perhaps a custom prop ) could be used instead.
    1077         [ #  # ]:          0 :     Reference< lang::XServiceInfo > xSrvInfo( _xProps, UNO_QUERY );
    1078 [ #  # ][ #  # ]:          0 :     if ( xSrvInfo.is() && xSrvInfo->supportsService( OUSTR("com.sun.star.form.FormComponent" ) ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1079                 :            :     {
    1080         [ #  # ]:          0 :         Reference< io::XPersistObject > xPersist( _xProps, UNO_QUERY );
    1081         [ #  # ]:          0 :         if ( xPersist.is() )
    1082                 :            :         {
    1083 [ #  # ][ #  # ]:          0 :             OUString sCtrlName = xPersist->getServiceName();
    1084         [ #  # ]:          0 :             if ( !sCtrlName.isEmpty() )
    1085 [ #  # ][ #  # ]:          0 :                     addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":control-implementation") ), sCtrlName );
    1086                 :          0 :         }
    1087                 :            :     }
    1088                 :            :     addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ),
    1089 [ #  # ][ #  # ]:          0 :              * reinterpret_cast< const OUString * >( a.getValue() ) );
    1090                 :            :     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TabIndex") ),
    1091 [ #  # ][ #  # ]:          0 :                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tab-index") ) );
                 [ #  # ]
    1092                 :            : 
    1093                 :          0 :     sal_Bool bEnabled = sal_False;
    1094 [ #  # ][ #  # ]:          0 :     if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Enabled") ) ) >>= bEnabled)
         [ #  # ][ #  # ]
    1095                 :            :     {
    1096         [ #  # ]:          0 :         if (! bEnabled)
    1097                 :            :         {
    1098                 :            :             addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":disabled") ),
    1099 [ #  # ][ #  # ]:          0 :                           OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
                 [ #  # ]
    1100                 :            :         }
    1101                 :            :     }
    1102                 :            :     else
    1103                 :            :     {
    1104                 :            :         OSL_FAIL( "unexpected property type for \"Enabled\": not bool!" );
    1105                 :            :     }
    1106                 :            : 
    1107                 :          0 :     sal_Bool bVisible = sal_True;
    1108         [ #  # ]:          0 :     if (supportVisible) try
    1109                 :            :     {
    1110 [ #  # ][ #  # ]:          0 :         if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ) ) >>= bVisible)
         [ #  # ][ #  # ]
    1111                 :            :         {
    1112                 :            : 
    1113                 :            :             // only write out the non default case
    1114         [ #  # ]:          0 :             if (! bVisible)
    1115                 :            :             {
    1116                 :            :                 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":visible") ),
    1117 [ #  # ][ #  # ]:          0 :                               OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
         [ #  # ][ #  # ]
    1118                 :            :             }
    1119                 :            :         }
    1120                 :            :     }
    1121         [ #  # ]:          0 :     catch( Exception& )
    1122                 :            :     {
    1123                 :            :         DBG_UNHANDLED_EXCEPTION();
    1124                 :            :     }
    1125                 :            :     // force writing of pos/size
    1126 [ #  # ][ #  # ]:          0 :     a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ) );
                 [ #  # ]
    1127         [ #  # ]:          0 :     if (a.getValueTypeClass() == TypeClass_LONG)
    1128                 :            :     {
    1129                 :            :         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":left") ),
    1130 [ #  # ][ #  # ]:          0 :                       OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
    1131                 :            :     }
    1132 [ #  # ][ #  # ]:          0 :     a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ) );
                 [ #  # ]
    1133         [ #  # ]:          0 :     if (a.getValueTypeClass() == TypeClass_LONG)
    1134                 :            :     {
    1135                 :            :         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":top") ),
    1136 [ #  # ][ #  # ]:          0 :                       OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
    1137                 :            :     }
    1138 [ #  # ][ #  # ]:          0 :     a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) );
                 [ #  # ]
    1139         [ #  # ]:          0 :     if (a.getValueTypeClass() == TypeClass_LONG)
    1140                 :            :     {
    1141                 :            :         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":width") ),
    1142 [ #  # ][ #  # ]:          0 :                       OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
    1143                 :            :     }
    1144 [ #  # ][ #  # ]:          0 :     a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) );
                 [ #  # ]
    1145         [ #  # ]:          0 :     if (a.getValueTypeClass() == TypeClass_LONG)
    1146                 :            :     {
    1147                 :            :         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":height") ),
    1148 [ #  # ][ #  # ]:          0 :                       OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
    1149                 :            :     }
    1150                 :            : 
    1151         [ #  # ]:          0 :     if (supportPrintable)
    1152                 :            :     {
    1153                 :            :         readBoolAttr(
    1154                 :            :             OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ),
    1155 [ #  # ][ #  # ]:          0 :             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":printable") ) );
                 [ #  # ]
    1156                 :            :     }
    1157                 :            :     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ),
    1158 [ #  # ][ #  # ]:          0 :                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":page") ) );
                 [ #  # ]
    1159                 :            :     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ),
    1160 [ #  # ][ #  # ]:          0 :                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tag") ) );
                 [ #  # ]
    1161                 :            :     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ),
    1162 [ #  # ][ #  # ]:          0 :                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":help-text") ) );
                 [ #  # ]
    1163                 :            :     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") ),
    1164 [ #  # ][ #  # ]:          0 :                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":help-url") ) );
                 [ #  # ]
    1165                 :          0 : }
    1166                 :            : 
    1167                 :            : struct StringTriple
    1168                 :            : {
    1169                 :            :     char const * first;
    1170                 :            :     char const * second;
    1171                 :            :     char const * third;
    1172                 :            : };
    1173                 :            : extern StringTriple const * const g_pEventTranslations;
    1174                 :            : 
    1175                 :            : //__________________________________________________________________________________________________
    1176                 :          0 : void ElementDescriptor::readEvents()
    1177                 :            :     SAL_THROW( (Exception) )
    1178                 :            : {
    1179         [ #  # ]:          0 :     Reference< script::XScriptEventsSupplier > xSupplier( _xProps, UNO_QUERY );
    1180         [ #  # ]:          0 :     if (xSupplier.is())
    1181                 :            :     {
    1182 [ #  # ][ #  # ]:          0 :         Reference< container::XNameContainer > xEvents( xSupplier->getEvents() );
    1183         [ #  # ]:          0 :         if (xEvents.is())
    1184                 :            :         {
    1185 [ #  # ][ #  # ]:          0 :             Sequence< OUString > aNames( xEvents->getElementNames() );
    1186                 :          0 :             OUString const * pNames = aNames.getConstArray();
    1187         [ #  # ]:          0 :             for ( sal_Int32 nPos = 0; nPos < aNames.getLength(); ++nPos )
    1188                 :            :             {
    1189                 :          0 :                 script::ScriptEventDescriptor descr;
    1190 [ #  # ][ #  # ]:          0 :                 if (xEvents->getByName( pNames[ nPos ] ) >>= descr)
         [ #  # ][ #  # ]
    1191                 :            :                 {
    1192                 :            :                     OSL_ENSURE( !descr.ListenerType.isEmpty() &&
    1193                 :            :                                 !descr.EventMethod.isEmpty() &&
    1194                 :            :                                 !descr.ScriptCode.isEmpty() &&
    1195                 :            :                                 !descr.ScriptType.isEmpty() ,
    1196                 :            :                                 "### invalid event descr!" );
    1197                 :            : 
    1198                 :          0 :                     OUString aEventName;
    1199                 :            : 
    1200         [ #  # ]:          0 :                     if (descr.AddListenerParam.isEmpty())
    1201                 :            :                     {
    1202                 :            :                         // detection of event-name
    1203                 :            :                         ::rtl::OString listenerType(
    1204                 :            :                             ::rtl::OUStringToOString(
    1205                 :            :                                 descr.ListenerType,
    1206         [ #  # ]:          0 :                                 RTL_TEXTENCODING_ASCII_US ) );
    1207                 :            :                         ::rtl::OString eventMethod(
    1208                 :            :                             ::rtl::OUStringToOString(
    1209                 :            :                                 descr.EventMethod,
    1210         [ #  # ]:          0 :                                 RTL_TEXTENCODING_ASCII_US ) );
    1211                 :          0 :                         StringTriple const * p = g_pEventTranslations;
    1212         [ #  # ]:          0 :                         while (p->first)
    1213                 :            :                         {
    1214   [ #  #  #  # ]:          0 :                             if (0 == ::rtl_str_compare( p->second, eventMethod.getStr() ) &&
                 [ #  # ]
    1215                 :          0 :                                 0 == ::rtl_str_compare( p->first, listenerType.getStr() ))
    1216                 :            :                             {
    1217         [ #  # ]:          0 :                                 aEventName = OUString( p->third, ::rtl_str_getLength( p->third ), RTL_TEXTENCODING_ASCII_US );
    1218                 :          0 :                                 break;
    1219                 :            :                             }
    1220                 :          0 :                             ++p;
    1221                 :          0 :                         }
    1222                 :            :                     }
    1223                 :            : 
    1224                 :            :                     ElementDescriptor * pElem;
    1225                 :          0 :                     Reference< xml::sax::XAttributeList > xElem;
    1226                 :            : 
    1227         [ #  # ]:          0 :                     if (!aEventName.isEmpty()) // script:event
    1228                 :            :                     {
    1229                 :            :                         pElem = new ElementDescriptor(
    1230 [ #  # ][ #  # ]:          0 :                             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":event") ) );
    1231 [ #  # ][ #  # ]:          0 :                         xElem = pElem;
    1232                 :            : 
    1233                 :            :                         pElem->addAttribute(
    1234                 :            :                             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":event-name") ),
    1235 [ #  # ][ #  # ]:          0 :                             aEventName );
    1236                 :            :                     }
    1237                 :            :                     else // script:listener-event
    1238                 :            :                     {
    1239                 :            :                         pElem = new ElementDescriptor(
    1240 [ #  # ][ #  # ]:          0 :                             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-event") ) );
    1241 [ #  # ][ #  # ]:          0 :                         xElem = pElem;
    1242                 :            : 
    1243                 :            :                         pElem->addAttribute(
    1244                 :            :                             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-type") ),
    1245 [ #  # ][ #  # ]:          0 :                             descr.ListenerType );
    1246                 :            :                         pElem->addAttribute(
    1247                 :            :                             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-method") ),
    1248 [ #  # ][ #  # ]:          0 :                             descr.EventMethod );
    1249                 :            : 
    1250         [ #  # ]:          0 :                         if (!descr.AddListenerParam.isEmpty())
    1251                 :            :                         {
    1252                 :            :                             pElem->addAttribute(
    1253                 :            :                                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-param") ),
    1254 [ #  # ][ #  # ]:          0 :                                 descr.AddListenerParam );
    1255                 :            :                         }
    1256                 :            :                     }
    1257         [ #  # ]:          0 :                     if ( descr.ScriptType == "StarBasic" )
    1258                 :            :                     {
    1259                 :            :                         // separate optional location
    1260                 :          0 :                         sal_Int32 nIndex = descr.ScriptCode.indexOf( (sal_Unicode)':' );
    1261         [ #  # ]:          0 :                         if (nIndex >= 0)
    1262                 :            :                         {
    1263                 :            :                             pElem->addAttribute(
    1264                 :            :                                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":location") ),
    1265 [ #  # ][ #  # ]:          0 :                                 descr.ScriptCode.copy( 0, nIndex ) );
    1266                 :            :                             pElem->addAttribute(
    1267                 :            :                                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":macro-name") ),
    1268 [ #  # ][ #  # ]:          0 :                                 descr.ScriptCode.copy( nIndex +1 ) );
    1269                 :            :                         }
    1270                 :            :                         else
    1271                 :            :                         {
    1272                 :            :                             pElem->addAttribute(
    1273                 :            :                                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":macro-name") ),
    1274 [ #  # ][ #  # ]:          0 :                                 descr.ScriptCode );
    1275                 :            :                         }
    1276                 :            :                     }
    1277                 :            :                     else
    1278                 :            :                     {
    1279                 :            :                         pElem->addAttribute(
    1280                 :            :                             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":macro-name") ),
    1281 [ #  # ][ #  # ]:          0 :                             descr.ScriptCode );
    1282                 :            :                     }
    1283                 :            : 
    1284                 :            :                     // language
    1285                 :            :                     pElem->addAttribute(
    1286                 :            :                         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":language") ),
    1287 [ #  # ][ #  # ]:          0 :                         descr.ScriptType );
    1288                 :            : 
    1289         [ #  # ]:          0 :                     addSubElement( xElem );
    1290                 :            :                 }
    1291                 :            :                 else
    1292                 :            :                 {
    1293                 :            :                     OSL_FAIL( "### unexpected event type in container!" );
    1294                 :            :                 }
    1295         [ #  # ]:          0 :             }
    1296                 :          0 :         }
    1297                 :          0 :     }
    1298                 :          0 : }
    1299                 :            : 
    1300                 :            : //##################################################################################################
    1301                 :            : 
    1302                 :          0 : inline bool equalFont( Style const & style1, Style const & style2 )
    1303                 :            : {
    1304                 :          0 :     awt::FontDescriptor const & f1 = style1._descr;
    1305                 :          0 :     awt::FontDescriptor const & f2 = style2._descr;
    1306                 :            :     return (
    1307                 :          0 :         f1.Name == f2.Name &&
    1308                 :            :         f1.Height == f2.Height &&
    1309                 :            :         f1.Width == f2.Width &&
    1310                 :          0 :         f1.StyleName == f2.StyleName &&
    1311                 :            :         f1.Family == f2.Family &&
    1312                 :            :         f1.CharSet == f2.CharSet &&
    1313                 :            :         f1.Pitch == f2.CharSet &&
    1314                 :            :         f1.CharacterWidth == f2.CharacterWidth &&
    1315                 :            :         f1.Weight == f2.Weight &&
    1316                 :            :         f1.Slant == f2.Slant &&
    1317                 :            :         f1.Underline == f2.Underline &&
    1318                 :            :         f1.Strikeout == f2.Strikeout &&
    1319                 :            :         f1.Orientation == f2.Orientation &&
    1320                 :            :         (f1.Kerning != sal_False) == (f2.Kerning != sal_False) &&
    1321                 :            :         (f1.WordLineMode != sal_False) == (f2.WordLineMode != sal_False) &&
    1322                 :            :         f1.Type == f2.Type &&
    1323                 :            :         style1._fontRelief == style2._fontRelief &&
    1324                 :            :         style1._fontEmphasisMark == style2._fontEmphasisMark
    1325         [ #  # ]:          0 :         );
           [ #  #  #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1326                 :            : }
    1327                 :            : //__________________________________________________________________________________________________
    1328                 :          0 : OUString StyleBag::getStyleId( Style const & rStyle )
    1329                 :            :     SAL_THROW(())
    1330                 :            : {
    1331         [ #  # ]:          0 :     if (! rStyle._set) // nothin set
    1332                 :            :     {
    1333                 :          0 :         return OUString(); // everything default: no need to export a specific style
    1334                 :            :     }
    1335                 :            : 
    1336                 :            :     // lookup existing style
    1337         [ #  # ]:          0 :     for ( size_t nStylesPos = 0; nStylesPos < _styles.size(); ++nStylesPos )
    1338                 :            :     {
    1339                 :          0 :         Style * pStyle = _styles[ nStylesPos ];
    1340                 :            : 
    1341                 :          0 :         short demanded_defaults = ~rStyle._set & rStyle._all;
    1342                 :            :         // test, if defaults are not set
    1343 [ #  # ][ #  # ]:          0 :         if ((~pStyle->_set & demanded_defaults) == demanded_defaults &&
    1344                 :            :             (rStyle._set & (pStyle->_all & ~pStyle->_set)) == 0)
    1345                 :            :         {
    1346                 :          0 :             short bset = rStyle._set & pStyle->_set;
    1347 [ #  # ][ #  # ]:          0 :             if ((bset & 0x1) &&
    1348                 :            :                 rStyle._backgroundColor != pStyle->_backgroundColor)
    1349                 :          0 :                 continue;
    1350 [ #  # ][ #  # ]:          0 :             if ((bset & 0x2) &&
    1351                 :            :                 rStyle._textColor != pStyle->_textColor)
    1352                 :          0 :                 continue;
    1353 [ #  # ][ #  # ]:          0 :             if ((bset & 0x20) &&
    1354                 :            :                 rStyle._textLineColor != pStyle->_textLineColor)
    1355                 :          0 :                 continue;
    1356 [ #  # ][ #  # ]:          0 :             if ((bset & 0x10) &&
    1357                 :            :                 rStyle._fillColor != pStyle->_fillColor)
    1358                 :          0 :                 continue;
    1359 [ #  # ][ #  # ]:          0 :             if ((bset & 0x4) &&
         [ #  # ][ #  # ]
    1360                 :            :                 (rStyle._border != pStyle->_border ||
    1361                 :            :                  (rStyle._border == BORDER_SIMPLE_COLOR &&
    1362                 :            :                   rStyle._borderColor != pStyle->_borderColor)))
    1363                 :          0 :                 continue;
    1364   [ #  #  #  # ]:          0 :             if ((bset & 0x8) &&
                 [ #  # ]
    1365                 :          0 :                 !equalFont( rStyle, *pStyle ))
    1366                 :          0 :                 continue;
    1367 [ #  # ][ #  # ]:          0 :             if ((bset & 0x40) &&
    1368                 :            :                 rStyle._visualEffect != pStyle->_visualEffect)
    1369                 :          0 :                 continue;
    1370                 :            : 
    1371                 :            :             // merge in
    1372                 :          0 :             short bnset = rStyle._set & ~pStyle->_set;
    1373         [ #  # ]:          0 :             if (bnset & 0x1)
    1374                 :          0 :                 pStyle->_backgroundColor = rStyle._backgroundColor;
    1375         [ #  # ]:          0 :             if (bnset & 0x2)
    1376                 :          0 :                 pStyle->_textColor = rStyle._textColor;
    1377         [ #  # ]:          0 :             if (bnset & 0x20)
    1378                 :          0 :                 pStyle->_textLineColor = rStyle._textLineColor;
    1379         [ #  # ]:          0 :             if (bnset & 0x10)
    1380                 :          0 :                 pStyle->_fillColor = rStyle._fillColor;
    1381         [ #  # ]:          0 :             if (bnset & 0x4) {
    1382                 :          0 :                 pStyle->_border = rStyle._border;
    1383                 :          0 :                 pStyle->_borderColor = rStyle._borderColor;
    1384                 :            :             }
    1385         [ #  # ]:          0 :             if (bnset & 0x8) {
    1386                 :          0 :                 pStyle->_descr = rStyle._descr;
    1387                 :          0 :                 pStyle->_fontRelief = rStyle._fontRelief;
    1388                 :          0 :                 pStyle->_fontEmphasisMark = rStyle._fontEmphasisMark;
    1389                 :            :             }
    1390         [ #  # ]:          0 :             if (bnset & 0x40)
    1391                 :          0 :                 pStyle->_visualEffect = rStyle._visualEffect;
    1392                 :            : 
    1393                 :          0 :             pStyle->_all |= rStyle._all;
    1394                 :          0 :             pStyle->_set |= rStyle._set;
    1395                 :            : 
    1396                 :          0 :             return pStyle->_id;
    1397                 :            :         }
    1398                 :            :     }
    1399                 :            : 
    1400                 :            :     // no appr style found, append new
    1401         [ #  # ]:          0 :     Style * pStyle = new Style( rStyle );
    1402                 :          0 :     pStyle->_id = OUString::valueOf( (sal_Int32)_styles.size() );
    1403         [ #  # ]:          0 :     _styles.push_back( pStyle );
    1404                 :          0 :     return pStyle->_id;
    1405                 :            : }
    1406                 :            : //__________________________________________________________________________________________________
    1407                 :          0 : StyleBag::~StyleBag() SAL_THROW(())
    1408                 :            : {
    1409         [ #  # ]:          0 :     for ( size_t nPos = 0; nPos < _styles.size(); ++nPos )
    1410                 :            :     {
    1411         [ #  # ]:          0 :         delete _styles[ nPos ];
    1412                 :            :     }
    1413                 :          0 : }
    1414                 :            : //__________________________________________________________________________________________________
    1415                 :          0 : void StyleBag::dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOut )
    1416                 :            : {
    1417         [ #  # ]:          0 :     if (! _styles.empty())
    1418                 :            :     {
    1419         [ #  # ]:          0 :         OUString aStylesName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":styles") );
    1420 [ #  # ][ #  # ]:          0 :         xOut->ignorableWhitespace( OUString() );
    1421 [ #  # ][ #  # ]:          0 :         xOut->startElement( aStylesName, Reference< xml::sax::XAttributeList >() );
    1422                 :            :         // export styles
    1423         [ #  # ]:          0 :         for ( size_t nPos = 0; nPos < _styles.size(); ++nPos )
    1424                 :            :         {
    1425         [ #  # ]:          0 :             Reference< xml::sax::XAttributeList > xAttr( _styles[ nPos ]->createElement() );
    1426 [ #  # ][ #  # ]:          0 :             static_cast< ElementDescriptor * >( xAttr.get() )->dump( xOut.get() );
         [ #  # ][ #  # ]
                 [ #  # ]
    1427                 :          0 :         }
    1428 [ #  # ][ #  # ]:          0 :         xOut->ignorableWhitespace( OUString() );
    1429 [ #  # ][ #  # ]:          0 :         xOut->endElement( aStylesName );
    1430                 :            :     }
    1431                 :          0 : }
    1432                 :            : 
    1433                 :            : //##################################################################################################
    1434                 :            : 
    1435                 :            : //==================================================================================================
    1436                 :          0 : void SAL_CALL exportDialogModel(
    1437                 :            :     Reference< xml::sax::XExtendedDocumentHandler > const & xOut,
    1438                 :            :     Reference< container::XNameContainer > const & xDialogModel,
    1439                 :            :     Reference< frame::XModel > const & xDocument )
    1440                 :            :     SAL_THROW( (Exception) )
    1441                 :            : {
    1442         [ #  # ]:          0 :     StyleBag all_styles;
    1443                 :            :     // window
    1444         [ #  # ]:          0 :     Reference< beans::XPropertySet > xProps( xDialogModel, UNO_QUERY );
    1445                 :            :     OSL_ASSERT( xProps.is() );
    1446         [ #  # ]:          0 :     Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
    1447                 :            :     OSL_ASSERT( xPropState.is() );
    1448                 :            : 
    1449                 :            :     ElementDescriptor * pElem = new ElementDescriptor(
    1450                 :            :                     xProps, xPropState,
    1451 [ #  # ][ #  # ]:          0 :                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), xDocument );
    1452 [ #  # ][ #  # ]:          0 :     Reference< xml::sax::XAttributeList > xElem( pElem );
    1453         [ #  # ]:          0 :     pElem->readBullitinBoard( &all_styles );
    1454                 :            : 
    1455 [ #  # ][ #  # ]:          0 :     xOut->startDocument();
    1456                 :            : 
    1457                 :            :     OUString aDocTypeStr( RTL_CONSTASCII_USTRINGPARAM(
    1458                 :            :         "<!DOCTYPE dlg:window PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\""
    1459         [ #  # ]:          0 :         " \"dialog.dtd\">" ) );
    1460 [ #  # ][ #  # ]:          0 :     xOut->unknown( aDocTypeStr );
    1461 [ #  # ][ #  # ]:          0 :     xOut->ignorableWhitespace( OUString() );
    1462                 :            : 
    1463                 :            : 
    1464         [ #  # ]:          0 :     OUString aWindowName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":window") );
    1465         [ #  # ]:          0 :     ElementDescriptor * pWindow = new ElementDescriptor( xProps, xPropState, aWindowName, xDocument );
    1466 [ #  # ][ #  # ]:          0 :     Reference< xml::sax::XAttributeList > xWindow( pWindow );
    1467         [ #  # ]:          0 :     pWindow->readDialogModel( &all_styles );
    1468 [ #  # ][ #  # ]:          0 :     xOut->ignorableWhitespace( OUString() );
    1469 [ #  # ][ #  # ]:          0 :     xOut->startElement( aWindowName, xWindow );
    1470                 :            :      // dump out events
    1471 [ #  # ][ #  # ]:          0 :     pWindow->dumpSubElements( xOut.get() );
                 [ #  # ]
    1472                 :            :     // dump out stylebag
    1473         [ #  # ]:          0 :     all_styles.dump( xOut );
    1474                 :            : 
    1475 [ #  # ][ #  # ]:          0 :     if ( xDialogModel->getElementNames().getLength() )
         [ #  # ][ #  # ]
    1476                 :            :     {
    1477                 :            :         // open up bulletinboard
    1478         [ #  # ]:          0 :         OUString aBBoardName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") );
    1479 [ #  # ][ #  # ]:          0 :         xOut->ignorableWhitespace( OUString() );
    1480 [ #  # ][ #  # ]:          0 :         xOut->startElement( aBBoardName, xElem );
    1481                 :            : 
    1482 [ #  # ][ #  # ]:          0 :         pElem->dumpSubElements( xOut.get() );
                 [ #  # ]
    1483                 :            :         // end bulletinboard
    1484 [ #  # ][ #  # ]:          0 :         xOut->ignorableWhitespace( OUString() );
    1485 [ #  # ][ #  # ]:          0 :         xOut->endElement( aBBoardName );
    1486                 :            :     }
    1487                 :            : 
    1488                 :            :     // end window
    1489 [ #  # ][ #  # ]:          0 :     xOut->ignorableWhitespace( OUString() );
    1490 [ #  # ][ #  # ]:          0 :     xOut->endElement( aWindowName );
    1491                 :            : 
    1492 [ #  # ][ #  # ]:          0 :     xOut->endDocument();
                 [ #  # ]
    1493                 :          0 : }
    1494                 :            : 
    1495                 :            : }
    1496                 :            : 
    1497                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10