[Libreoffice-commits] .: Branch 'libreoffice-3-4' - patches/dev300

René Engelhard rene at kemper.freedesktop.org
Tue Jun 14 15:24:53 PDT 2011


 patches/dev300/apply                                    |    2 
 patches/dev300/svx-hacky-htmlselect-control-import.diff |  200 ----------------
 2 files changed, 202 deletions(-)

New commits:
commit 2b9bd812b1f3a335194f2f1679e5a4d92725dd73
Author: Rene Engelhard <rene at debian.org>
Date:   Wed Jun 15 00:26:08 2011 +0200

    svx-hacky-htmlselect-control-import.diff seems to be integrated

diff --git a/patches/dev300/apply b/patches/dev300/apply
index dd51188..642fbd8 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1119,8 +1119,6 @@ always_default_iconset.diff
 # FIXME 2011-04-05: Does not apply, leaving it to cbosdonnat for now
 # fields-table-formula.diff, n#631912, cbosdo
 
-svx-hacky-htmlselect-control-import.diff, n#523191, noelpwer
-
 # controversial fix - closer to ppt97 behaviour than to 2k7 - need
 # version compat distinction?
 sd-custom-show-fix.diff, n#355638, i#90145, thorsten
diff --git a/patches/dev300/svx-hacky-htmlselect-control-import.diff b/patches/dev300/svx-hacky-htmlselect-control-import.diff
deleted file mode 100644
index 2d25427..0000000
--- a/patches/dev300/svx-hacky-htmlselect-control-import.diff
+++ /dev/null
@@ -1,200 +0,0 @@
---- filter/inc/filter/msfilter/msocximex.hxx
-+++ filter/inc/filter/msfilter/msocximex.hxx
-@@ -1417,6 +1417,41 @@ public:
-                                 const com::sun::star::awt::Size& rSize );
- };
- 
-+class HTML_Select : public OCX_ModernControl
-+{
-+public:
-+    HTML_Select() : OCX_ModernControl(rtl::OUString::createFromAscii("TextBox")) {
-+        msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
-+        msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
-+        mnBackColor = 0x80000005L;
-+        mnForeColor = 0x80000008L;
-+        nBorderColor = 0x80000006L;
-+        aFontData.SetHasAlign(true);
-+                fEnabled = true;
-+                nMultiState =false;
-+    }
-+
-+    using OCX_ModernControl::Import; // to not hide the other two import methods
-+    virtual sal_Bool Import(com::sun::star::uno::Reference<
-+        com::sun::star::beans::XPropertySet> &rPropSet);
-+  /*
-+    sal_Bool Export(SotStorageRef &rObj,
-+        const com::sun::star::uno::Reference<
-+        com::sun::star::beans::XPropertySet> &rPropSet,
-+        const com::sun::star::awt::Size& rSize);
-+    sal_Bool WriteContents(SotStorageStreamRef &rObj,
-+        const com::sun::star::uno::Reference<
-+        com::sun::star::beans::XPropertySet> &rPropSet,
-+        const com::sun::star::awt::Size& rSize);
-+  */
-+    static OCX_Control *Create() { return new HTML_Select;}
-+
-+        virtual sal_Bool Read(SotStorageStream *pS);
-+        virtual sal_Bool ReadFontData(SotStorageStream *pS);
-+        com::sun::star::uno::Sequence< rtl::OUString > msListData;
-+        com::sun::star::uno::Sequence< sal_Int16 > msIndices;
-+};
-+
- 
- class HTML_TextBox : public OCX_ModernControl
- {
---- filter/source/msfilter/msocximex.cxx
-+++ filter/source/msfilter/msocximex.cxx
-@@ -4446,6 +4446,8 @@ OCX_map aOCXTab[] =
-     {&OCX_ProgressBar::Create,"",
-         form::FormComponentType::CONTROL,""},
-     {&HTML_TextBox::Create,"5512D124-5CC6-11CF-8d67-00aa00bdce1d", form::FormComponentType::TEXTFIELD,"TextBox"},
-+    {&HTML_Select::Create,"5512D122-5CC6-11CF-8d67-00aa00bdce1d",
-+        form::FormComponentType::LISTBOX,"ListBox"},
- };
- 
- const int NO_OCX = sizeof( aOCXTab ) / sizeof( *aOCXTab );
-@@ -5239,6 +5241,144 @@ sal_Bool HTML_TextBox::ReadFontData(SotStorageStream *pS)
-   return sal_True;
- }
- 
-+// HTML_Select
-+sal_Bool HTML_Select::Import(com::sun::star::uno::Reference<
-+    com::sun::star::beans::XPropertySet> &rPropSet)
-+{
-+    uno::Any aTmp(&sName,getCppuType((OUString *)0));
-+    rPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
-+
-+    sal_Bool bTmp=fEnabled;
-+    aTmp = bool2any(bTmp);
-+    rPropSet->setPropertyValue( WW8_ASCII2STR("Enabled"), aTmp);
-+
-+    bTmp=fLocked;
-+    aTmp = bool2any(bTmp);
-+    rPropSet->setPropertyValue( WW8_ASCII2STR("ReadOnly"), aTmp);
-+
-+    aTmp <<= ImportColor(mnForeColor);
-+    rPropSet->setPropertyValue( WW8_ASCII2STR("TextColor"), aTmp);
-+
-+    sal_Bool bTemp = nMultiState;
-+    aTmp = bool2any(bTemp);
-+    rPropSet->setPropertyValue( WW8_ASCII2STR("MultiSelection"), aTmp);
-+
-+    aTmp <<= ImportColor(mnBackColor);
-+    rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
-+
-+    aTmp <<= ImportBorder(nSpecialEffect,nBorderStyle);
-+    rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
-+
-+    aTmp <<= ImportColor( nBorderColor );
-+    rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
-+
-+    if ( msListData.getLength() )
-+    {
-+        aTmp <<= msListData;
-+        rPropSet->setPropertyValue( WW8_ASCII2STR("StringItemList"), aTmp);
-+        if ( msIndices.getLength() )
-+        {
-+            aTmp <<= msIndices;
-+            rPropSet->setPropertyValue( WW8_ASCII2STR("SelectedItems"), aTmp);
-+        }
-+    }
-+    rPropSet->setPropertyValue( WW8_ASCII2STR("Dropdown"), uno::makeAny( sal_True ));
-+
-+    return sal_True;
-+}
-+
-+sal_Bool HTML_Select::Read(SotStorageStream *pS)
-+{
-+    static rtl::OUString sTerm( RTL_CONSTASCII_USTRINGPARAM("</SELECT") );
-+    static String sMultiple( RTL_CONSTASCII_USTRINGPARAM("<SELECT MULTIPLE") );
-+    static String sSelected( RTL_CONSTASCII_USTRINGPARAM("OPTION SELECTED") );
-+
-+    // we should be positioned at the html fragment ( really we should
-+    // reorganise the reading of controls from excel such that the position and
-+    // lenght of the associated record in the Ctls stream is available
-+    // But since we don't know about the lenght of the stream lets read the stream
-+    // until we reach the end of the fragment
-+    // I wish I know where there was a html parser in openoffice
-+    OUStringBuffer buf(40);
-+    bool bTerminate = false;
-+    do
-+    {
-+        sal_uInt16 ch = 0;
-+        *pS >> ch;
-+        sal_Unicode uni = static_cast< sal_Unicode >( ch );
-+        // if the buffer ends with </SELECT> we are done
-+        if ( uni == '>' )
-+        {
-+            rtl::OUString bufContents( buf.getStr() );
-+            if ( bufContents.indexOf( sTerm ) != -1 )
-+                bTerminate = true;
-+
-+        }
-+        buf.append( &uni, 1 );
-+
-+    } while ( !pS->IsEof() && !bTerminate );
-+    String data = buf.makeStringAndClear();
-+
-+    // replace crlf with lf
-+    data.SearchAndReplaceAll( String( RTL_CONSTASCII_USTRINGPARAM( "\x0D\x0A" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "\x0A" ) ) );
-+    std::vector< rtl::OUString > listValues;
-+    std::vector< sal_Int16 > selectedIndices;
-+
-+    // Ultra hacky parser for the info
-+    sal_Int32 nTokenCount = data.GetTokenCount( '\n' );
-+
-+    for ( sal_Int32 nToken = 0; nToken < nTokenCount; ++nToken )
-+    {
-+        String sLine( data.GetToken( nToken, '\n' ) );
-+        if ( !nToken ) // first line will tell us if multiselect is enabled
-+        {
-+            if ( sLine.CompareTo( sMultiple, sMultiple.Len() ) == COMPARE_EQUAL )
-+                nMultiState = true;
-+        }
-+        // skip first and last lines, no data there
-+        else if ( nToken < nTokenCount - 1)
-+        {
-+            if ( sLine.GetTokenCount( '>' ) )
-+            {
-+                String displayValue  = sLine.GetToken( 1, '>' );
-+                if ( displayValue.Len() )
-+                {
-+                    // Really we should be using a proper html parser
-+                    // escaping some common bits to be escaped
-+                    displayValue.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "&lt;" ) ), String( RTL_CONSTASCII_USTRINGPARAM("<") ) );
-+                    displayValue.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "&gt;" ) ), String( RTL_CONSTASCII_USTRINGPARAM(">") ) );
-+                    displayValue.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "&quot;" ) ), String( RTL_CONSTASCII_USTRINGPARAM("\"") ) );
-+                    displayValue.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "&amp;" ) ), String( RTL_CONSTASCII_USTRINGPARAM("&") ) );
-+                    listValues.push_back( displayValue );
-+                    if( sLine.Search( sSelected ) != STRING_NOTFOUND )
-+                        selectedIndices.push_back( static_cast< sal_Int16 >( listValues.size() ) - 1 );
-+                }
-+            }
-+        }
-+    }
-+    if ( listValues.size() )
-+    {
-+        msListData.realloc( listValues.size() );
-+        sal_Int32 index = 0;
-+        for( std::vector< rtl::OUString >::iterator it = listValues.begin(); it != listValues.end(); ++it, ++index )
-+             msListData[ index ] = *it;
-+    }
-+    if ( selectedIndices.size() )
-+    {
-+        msIndices.realloc( selectedIndices.size() );
-+        sal_Int32 index = 0;
-+        for( std::vector< sal_Int16 >::iterator it = selectedIndices.begin(); it != selectedIndices.end(); ++it, ++index )
-+             msIndices[ index ] = *it;
-+    }
-+    return sal_True;
-+}
-+
-+sal_Bool HTML_Select::ReadFontData(SotStorageStream *pS)
-+{
-+    return sal_True;
-+}
-+
-+
- // Doesn't really read anything but just skips the
- // record.
- sal_Bool OCX_TabStrip::Read(SotStorageStream *pS)


More information about the Libreoffice-commits mailing list