View | Details | Raw Unified | Return to issue 98734
Collapse All | Expand All

(-)xmlscript/dtd/dialog.dtd (+1 lines)
Lines 247-252 Link Here
247
<!ATTLIST dlg:img %default-attributes;
247
<!ATTLIST dlg:img %default-attributes;
248
                  dlg:src CDATA #IMPLIED
248
                  dlg:src CDATA #IMPLIED
249
                  dlg:scale-image %boolean; #IMPLIED
249
                  dlg:scale-image %boolean; #IMPLIED
250
                  dlg:scale-mode (none|isotropic|anisotropic); #IMPLIED
250
                  dlg:tabstop %boolean; #IMPLIED
251
                  dlg:tabstop %boolean; #IMPLIED
251
                  >
252
                  >
252
253
(-)xmlscript/source/xmldlg_imexp/exp_share.hxx (+2 lines)
Lines 153-158 Link Here
153
        ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
153
        ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
154
	void readSelectionTypeAttr(
154
	void readSelectionTypeAttr(
155
        ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
155
        ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
156
    void readImageScaleModeAttr(
157
        ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
156
	//
158
	//
157
    inline void addBoolAttr(
159
    inline void addBoolAttr(
158
        ::rtl::OUString const & rAttrName, sal_Bool bValue )
160
        ::rtl::OUString const & rAttrName, sal_Bool bValue )
(-)xmlscript/source/xmldlg_imexp/imp_share.hxx (+3 lines)
Lines 447-452 Link Here
447
	bool importSelectionTypeProperty(
447
	bool importSelectionTypeProperty(
448
        ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
448
        ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
449
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
449
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
450
    bool importImageScaleModeProperty(
451
        ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
452
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
450
};
453
};
451
454
452
//==============================================================================
455
//==============================================================================
(-)xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx (+2 lines)
Lines 591-596 Link Here
591
    readDefaults();
591
    readDefaults();
592
    readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
592
    readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
593
                  OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
593
                  OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
594
    readImageScaleModeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleMode") ),
595
                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-mode") ) );
594
    readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
596
    readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
595
                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
597
                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
596
    readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
598
    readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
(-)xmlscript/source/xmldlg_imexp/xmldlg_export.cxx (+31 lines)
Lines 38-43 Link Here
38
#include <com/sun/star/awt/FontWeight.hpp>
38
#include <com/sun/star/awt/FontWeight.hpp>
39
#include <com/sun/star/awt/FontWidth.hpp>
39
#include <com/sun/star/awt/FontWidth.hpp>
40
#include <com/sun/star/awt/ImagePosition.hpp>
40
#include <com/sun/star/awt/ImagePosition.hpp>
41
#include <com/sun/star/awt/ImageScaleMode.hpp>
41
#include <com/sun/star/awt/LineEndFormat.hpp>
42
#include <com/sun/star/awt/LineEndFormat.hpp>
42
#include <com/sun/star/awt/PushButtonType.hpp>
43
#include <com/sun/star/awt/PushButtonType.hpp>
43
#include <com/sun/star/awt/VisualEffect.hpp>
44
#include <com/sun/star/awt/VisualEffect.hpp>
Lines 968-973 Link Here
968
    }
969
    }
969
}
970
}
970
//__________________________________________________________________________________________________
971
//__________________________________________________________________________________________________
972
void ElementDescriptor::readImageScaleModeAttr( OUString const & rPropName, OUString const & rAttrName )
973
{
974
    if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
975
    {
976
        Any aImageScaleMode( _xProps->getPropertyValue( rPropName ) );
977
        
978
        if (aImageScaleMode.getValueTypeClass() == TypeClass_SHORT)
979
        {
980
            sal_Int16 nImageScaleMode;
981
            aImageScaleMode >>= nImageScaleMode;
982
            
983
            switch(nImageScaleMode)
984
            {
985
                case ::awt::ImageScaleMode::NONE:
986
                    addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("none") ) );
987
                    break;
988
                case ::awt::ImageScaleMode::ISOTROPIC:
989
                    addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("isotropic") ) );
990
                    break;
991
                case ::awt::ImageScaleMode::ANISOTROPIC:
992
                    addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("anisotropic") ) );
993
                    break;
994
                default:
995
                    OSL_ENSURE( 0, "### illegal image scale mode value.");
996
                    break;
997
            }
998
        }
999
    }
1000
}
1001
//__________________________________________________________________________________________________
971
void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible )
1002
void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible )
972
{
1003
{
973
    Any a( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) );
1004
    Any a( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) );
(-)xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx (+3 lines)
Lines 999-1004 Link Here
999
	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
999
	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
1000
							   OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
1000
							   OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
1001
							   _xAttributes );
1001
							   _xAttributes );
1002
	ctx.importImageScaleModeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleMode") ), 
1003
									 OUString( RTL_CONSTASCII_USTRINGPARAM("scale-mode") ),
1004
									 _xAttributes );
1002
	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1005
	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1003
							  OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
1006
							  OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
1004
							  _xAttributes );
1007
							  _xAttributes );
(-)xmlscript/source/xmldlg_imexp/xmldlg_import.cxx (+38 lines)
Lines 44-49 Link Here
44
#include <com/sun/star/awt/FontWeight.hpp>
44
#include <com/sun/star/awt/FontWeight.hpp>
45
#include <com/sun/star/awt/FontWidth.hpp>
45
#include <com/sun/star/awt/FontWidth.hpp>
46
#include <com/sun/star/awt/ImagePosition.hpp>
46
#include <com/sun/star/awt/ImagePosition.hpp>
47
#include <com/sun/star/awt/ImageScaleMode.hpp>
47
#include <com/sun/star/awt/LineEndFormat.hpp>
48
#include <com/sun/star/awt/LineEndFormat.hpp>
48
#include <com/sun/star/awt/PushButtonType.hpp>
49
#include <com/sun/star/awt/PushButtonType.hpp>
49
#include <com/sun/star/awt/VisualEffect.hpp>
50
#include <com/sun/star/awt/VisualEffect.hpp>
Lines 1339-1344 Link Here
1339
    return false;
1340
    return false;
1340
}
1341
}
1341
1342
1343
//__________________________________________________________________________________________________
1344
bool ImportContext::importImageScaleModeProperty(
1345
    OUString const & rPropName, OUString const & rAttrName,
1346
    Reference< xml::input::XAttributes > const & xAttributes )
1347
{
1348
    OUString aImageScaleMode(
1349
        xAttributes->getValueByUidName(
1350
            _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1351
    if (!aImageScaleMode.isEmpty())
1352
    {
1353
        sal_Int16 nImageScaleMode;
1354
        
1355
        if (aImageScaleMode.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
1356
        {
1357
            nImageScaleMode = awt::ImageScaleMode::NONE;
1358
        }
1359
        else if (aImageScaleMode.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("isotropic") ))
1360
        {
1361
            nImageScaleMode = awt::ImageScaleMode::ISOTROPIC;
1362
        }
1363
        else if (aImageScaleMode.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("anisotropic") ))
1364
        {
1365
            nImageScaleMode = awt::ImageScaleMode::ANISOTROPIC;
1366
        }
1367
        else
1368
        {
1369
            throw xml::sax::SAXException(
1370
                OUString( RTL_CONSTASCII_USTRINGPARAM("invalid scale image mode value!") ),
1371
                Reference< XInterface >(), Any() );
1372
        }
1373
        
1374
        _xControlModel->setPropertyValue( rPropName, makeAny( nImageScaleMode ) );
1375
        return true;
1376
    }
1377
    return false;
1378
}
1379
1342
//==================================================================================================
1380
//==================================================================================================
1343
struct StringTriple
1381
struct StringTriple
1344
{
1382
{

Return to issue 98734