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