[Libreoffice-commits] core.git: 4 commits - extensions/source sax/source toolkit/source vcl/generic xmlscript/dtd xmlscript/source

Caolán McNamara caolanm at redhat.com
Tue Jan 27 02:52:39 PST 2015


 extensions/source/scanner/sane.cxx                 |    2 -
 sax/source/tools/fastattribs.cxx                   |    3 +
 toolkit/source/helper/property.cxx                 |    2 -
 vcl/generic/print/glyphset.cxx                     |    2 -
 xmlscript/dtd/dialog.dtd                           |    1 
 xmlscript/source/xmldlg_imexp/exp_share.hxx        |    2 +
 xmlscript/source/xmldlg_imexp/imp_share.hxx        |    3 +
 xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx |    1 
 xmlscript/source/xmldlg_imexp/xmldlg_export.cxx    |   31 +++++++++++++++++
 xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx |    3 -
 xmlscript/source/xmldlg_imexp/xmldlg_import.cxx    |   37 +++++++++++++++++++++
 11 files changed, 81 insertions(+), 6 deletions(-)

New commits:
commit 4add6c3f2a4a43de65b457223b61659c97e03149
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 27 10:44:35 2015 +0000

    add assert that first element is 0
    
    Change-Id: I75602b6941f291703c85c841837b432da455a7ef

diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 8552ad4..15b555e 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -72,7 +72,8 @@ void FastAttributeList::clear()
 {
     maAttributeTokens.clear();
     maAttributeValues.resize(1);
-    if (maUnknownAttributes.size() > 0)
+    assert(maAttributeValues[0] == 0);
+    if (!maUnknownAttributes.empty())
         maUnknownAttributes.clear();
 }
 
commit 81b5d8427e29849915d544e5c17c3ea3c3e26043
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 27 10:22:30 2015 +0000

    Resolves: tdf#88819 printing with ps hangs
    
    regression from
    
    commit bbf3aa7f92c194c9cc4546c95706e6b28e0c070c
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Fri Nov 14 11:06:44 2014 +0000
        coverity#705989 silence Insecure temporary file
        and
        coverity#705983 Insecure temporary file
    
    Change-Id: If580196322e68098adc38a9fdb775827843a9c30

diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx
index d1f27ff..1d42f03 100644
--- a/extensions/source/scanner/sane.cxx
+++ b/extensions/source/scanner/sane.cxx
@@ -699,7 +699,7 @@ bool Sane::Start( BitmapTransporter& rBitmap )
             }
             utl::TempFile aFrame;
             aFrame.EnableKillingFile();
-            FILE* pFrame = fopen(OUStringToOString(aFrame.GetFileName(), osl_getThreadTextEncoding()).getStr(), "wb");
+            FILE* pFrame = fopen(OUStringToOString(aFrame.GetFileName(), osl_getThreadTextEncoding()).getStr(), "w+b");
             if( ! pFrame )
             {
                 bSuccess = false;
diff --git a/vcl/generic/print/glyphset.cxx b/vcl/generic/print/glyphset.cxx
index b3314ab..3ac8d8d 100644
--- a/vcl/generic/print/glyphset.cxx
+++ b/vcl/generic/print/glyphset.cxx
@@ -744,7 +744,7 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAllowType42
 
     utl::TempFile aTmpFile;
     aTmpFile.EnableKillingFile();
-    FILE* pTmpFile = fopen(OUStringToOString(aTmpFile.GetFileName(), osl_getThreadTextEncoding()).getStr(), "wb");
+    FILE* pTmpFile = fopen(OUStringToOString(aTmpFile.GetFileName(), osl_getThreadTextEncoding()).getStr(), "w+b");
     if (pTmpFile == NULL)
         return false;
 
commit 199cec3af070a59fd8e4bc550e9819e3949c2d08
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 27 09:28:14 2015 +0000

    remove spurious xDocStorage temp
    
    Change-Id: Ia47394bcd4d39fca5096413ca7e0fbffbc3d7ac6

diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
index 30ceb90..c1e8a39 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -911,8 +911,6 @@ void ImageControlElement::endElement()
     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
     ctx.importBooleanProperty( "ScaleImage", "scale-image", _xAttributes );
     ctx.importImageScaleModeProperty( "ScaleMode" , "scale-mode" , _xAttributes );
-    Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
-
     ctx.importImageURLProperty( "ImageURL" , "src" , _xAttributes );
     ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
     ctx.importEvents( _events );
commit 41146013ad088e6539335454edffc0a394a1d24f
Author: Tsutomu Uchino <hanya at apache.org>
Date:   Mon Jan 26 09:06:52 2015 +0000

    Resolves: #i98734# save/load ScaleMode property of image control on dialogs
    
    Suggested by: Frank Schönheit <frank.schoenheit at gmx.de>
    (cherry picked from commit 350c4f9a01b88d4fd1006465151348ac5d459f1a)
    
    Conflicts:
    	xmlscript/source/xmldlg_imexp/exp_share.hxx
    	xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
    	xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
    	xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
    	xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
    
    Change-Id: I2a11809112c0b1b53349f5b74dca20897d4a6acd

diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index 49df534..4b63b5c 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -203,7 +203,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
             DECL_PROP_2     ( "AutoRepeat",             AUTO_REPEAT,        sal_Bool,           BOUND, MAYBEDEFAULT ),
             DECL_PROP_2     ( "RepeatDelay",            REPEAT_DELAY,       sal_Int32,          BOUND, MAYBEDEFAULT ),
             DECL_PROP_2     ( "ScaleImage",             SCALEIMAGE,         bool,               BOUND, MAYBEDEFAULT ),
-            DECL_PROP_2     ( "ScaleMode",              IMAGE_SCALE_MODE,   sal_Int16,          BOUND, MAYBEDEFAULT ),
+            DECL_DEP_PROP_2 ( "ScaleMode",              IMAGE_SCALE_MODE,   sal_Int16,          BOUND, MAYBEDEFAULT ),
             DECL_DEP_PROP_3 ( "ScrollValue",            SCROLLVALUE,        sal_Int32,          BOUND, MAYBEDEFAULT, MAYBEVOID ),
             DECL_PROP_2     ( "ScrollValueMax",         SCROLLVALUE_MAX,    sal_Int32,          BOUND, MAYBEDEFAULT ),
             DECL_PROP_2     ( "ScrollValueMin",         SCROLLVALUE_MIN,    sal_Int32,          BOUND, MAYBEDEFAULT ),
diff --git a/xmlscript/dtd/dialog.dtd b/xmlscript/dtd/dialog.dtd
index 2360db0..1f8e83d 100644
--- a/xmlscript/dtd/dialog.dtd
+++ b/xmlscript/dtd/dialog.dtd
@@ -242,6 +242,7 @@
 <!ATTLIST dlg:img %default-attributes;
                   dlg:src CDATA #IMPLIED
                   dlg:scale-image %boolean; #IMPLIED
+                  dlg:scale-mode (none|isotropic|anisotropic); #IMPLIED
                   dlg:tabstop %boolean; #IMPLIED
                   >
 
diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx
index f3104b3..c67853c 100644
--- a/xmlscript/source/xmldlg_imexp/exp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx
@@ -161,6 +161,8 @@ public:
         OUString const & rPropName, OUString const & rAttrName );
     void readSelectionTypeAttr(
         OUString const & rPropName, OUString const & rAttrName );
+    void readImageScaleModeAttr(
+        OUString const & rPropName, OUString const & rAttrName );
     void readDataAwareAttr(
         OUString const & rAttrName );
     inline void addBoolAttr(
diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx
index 8db6fdc2..16ef33d 100644
--- a/xmlscript/source/xmldlg_imexp/imp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx
@@ -468,6 +468,9 @@ public:
     bool importDataAwareProperty(
         OUString const & rPropName,
         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
+    bool importImageScaleModeProperty(
+        ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
 };
 
 class ControlImportContext : public ImportContext
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index db43d54..066cfd3 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -589,6 +589,7 @@ void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
     // collect elements
     readDefaults();
     readBoolAttr( "ScaleImage", XMLNS_DIALOGS_PREFIX ":scale-image" );
+    readImageScaleModeAttr( "ScaleMode", XMLNS_DIALOGS_PREFIX ":scale-mode" );
     readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
     readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX ":src" );
     readEvents();
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index f66bbfc..e45ce96 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/awt/FontWeight.hpp>
 #include <com/sun/star/awt/FontWidth.hpp>
 #include <com/sun/star/awt/ImagePosition.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
 #include <com/sun/star/awt/LineEndFormat.hpp>
 #include <com/sun/star/awt/PushButtonType.hpp>
 #include <com/sun/star/awt/VisualEffect.hpp>
@@ -1010,6 +1011,36 @@ void ElementDescriptor::readScrollableSettings()
                   XMLNS_DIALOGS_PREFIX ":vscroll" );
 }
 
+void ElementDescriptor::readImageScaleModeAttr( OUString const & rPropName, OUString const & rAttrName )
+{
+    if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
+    {
+        Any aImageScaleMode( _xProps->getPropertyValue( rPropName ) );
+
+        if (aImageScaleMode.getValueTypeClass() == TypeClass_SHORT)
+        {
+            sal_Int16 nImageScaleMode;
+            aImageScaleMode >>= nImageScaleMode;
+
+            switch(nImageScaleMode)
+            {
+                case ::awt::ImageScaleMode::NONE:
+                    addAttribute( rAttrName, OUString( "none") );
+                    break;
+                case ::awt::ImageScaleMode::ISOTROPIC:
+                    addAttribute( rAttrName, OUString( "isotropic") );
+                    break;
+                case ::awt::ImageScaleMode::ANISOTROPIC:
+                    addAttribute( rAttrName, OUString( "anisotropic" ) );
+                    break;
+                default:
+                    OSL_ENSURE( 0, "### illegal image scale mode value.");
+                    break;
+            }
+        }
+    }
+}
+
 void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible )
 {
     Any a( _xProps->getPropertyValue( "Name" ) );
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
index 17b4026..30ceb90 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -910,6 +910,7 @@ void ImageControlElement::endElement()
 
     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
     ctx.importBooleanProperty( "ScaleImage", "scale-image", _xAttributes );
+    ctx.importImageScaleModeProperty( "ScaleMode" , "scale-mode" , _xAttributes );
     Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
 
     ctx.importImageURLProperty( "ImageURL" , "src" , _xAttributes );
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
index 9b1ccf4..df0b155 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/awt/FontWeight.hpp>
 #include <com/sun/star/awt/FontWidth.hpp>
 #include <com/sun/star/awt/ImagePosition.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
 #include <com/sun/star/awt/LineEndFormat.hpp>
 #include <com/sun/star/awt/PushButtonType.hpp>
 #include <com/sun/star/awt/VisualEffect.hpp>
@@ -1363,6 +1364,42 @@ bool ImportContext::importSelectionTypeProperty(
     return false;
 }
 
+bool ImportContext::importImageScaleModeProperty(
+    OUString const & rPropName, OUString const & rAttrName,
+    Reference< xml::input::XAttributes > const & xAttributes )
+{
+    OUString aImageScaleMode(
+        xAttributes->getValueByUidName(
+            _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
+    if (!aImageScaleMode.isEmpty())
+    {
+        sal_Int16 nImageScaleMode;
+
+        if (aImageScaleMode == "none")
+        {
+            nImageScaleMode = awt::ImageScaleMode::NONE;
+        }
+        else if (aImageScaleMode == "isotropic")
+        {
+            nImageScaleMode = awt::ImageScaleMode::ISOTROPIC;
+        }
+        else if (aImageScaleMode == "anisotropic")
+        {
+            nImageScaleMode = awt::ImageScaleMode::ANISOTROPIC;
+        }
+        else
+        {
+            throw xml::sax::SAXException(
+                OUString( "invalid scale image mode value!" ),
+                Reference< XInterface >(), Any() );
+        }
+
+        _xControlModel->setPropertyValue( rPropName, makeAny( nImageScaleMode ) );
+        return true;
+    }
+    return false;
+}
+
 struct StringTriple
 {
     char const * first;


More information about the Libreoffice-commits mailing list