diff options
Diffstat (limited to 'patches/vba/vba-support-export-palette.diff')
-rw-r--r-- | patches/vba/vba-support-export-palette.diff | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/patches/vba/vba-support-export-palette.diff b/patches/vba/vba-support-export-palette.diff deleted file mode 100644 index ff06b79a2..000000000 --- a/patches/vba/vba-support-export-palette.diff +++ /dev/null @@ -1,95 +0,0 @@ ---- sc/source/filter/inc/xistyle.hxx.old 2009-04-02 10:44:58.000000000 +0000 -+++ sc/source/filter/inc/xistyle.hxx 2009-04-06 16:41:58.000000000 +0000 -@@ -72,8 +72,10 @@ public: - void ReadPalette( XclImpStream& rStrm ); - - private: -+ void ExportPalette(); - typedef ::std::vector< ColorData > ColorDataVec; - ColorDataVec maColorTable; /// Colors read from file. -+ const XclImpRoot& mrRoot; - }; - - // FONT record - font information ============================================= ---- sc/source/filter/excel/xistyle.cxx.old 2009-04-02 10:44:55.000000000 +0000 -+++ sc/source/filter/excel/xistyle.cxx 2009-04-06 16:41:58.000000000 +0000 -@@ -68,10 +68,70 @@ - #include "root.hxx" - #include "colrowst.hxx" - -+#include <cppuhelper/implbase1.hxx> -+#include <com/sun/star/container/XIndexAccess.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+using namespace ::com::sun::star; -+ -+typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE; -+typedef ::std::vector< ColorData > ColorDataVec; -+ -+class PaletteIndex : public XIndexAccess_BASE -+{ -+public: -+ PaletteIndex( const ColorDataVec& rColorDataTable ) : maColorData( rColorDataTable ) {} -+ -+ // Methods XIndexAccess -+ virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) -+ { -+ return maColorData.size(); -+ } -+ -+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ //--Index; // apparently the palette is already 1 based -+ return uno::makeAny( sal_Int32( maColorData[ Index ] ) ); -+ } -+ -+ // Methods XElementAcess -+ virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException) -+ { -+ return ::getCppuType( (sal_Int32*)0 ); -+ } -+ virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException) -+ { -+ return (maColorData.size() > 0); -+ } -+ -+private: -+ ColorDataVec maColorData; -+}; -+ -+void -+XclImpPalette::ExportPalette() -+{ -+ if( SfxObjectShell* pDocShell = mrRoot.GetDocShell() ) -+ { -+ // copy values in color palette -+ sal_Int16 nColors = maColorTable.size(); -+ ColorDataVec aColors; -+ aColors.resize( nColors ); -+ for( sal_uInt16 nIndex = 0; nIndex < nColors; ++nIndex ) -+ aColors[ nIndex ] = GetColorData( nIndex ); -+ -+ uno::Reference< beans::XPropertySet > xProps( pDocShell->GetModel(), uno::UNO_QUERY ); -+ if ( xProps.is() ) -+ { -+ uno::Reference< container::XIndexAccess > xIndex( new PaletteIndex( aColors ) ); -+ xProps->setPropertyValue( CREATE_OUSTRING("ColorPalette"), uno::makeAny( xIndex ) ); -+ } -+ } -+ -+} - // PALETTE record - color information ========================================= - - XclImpPalette::XclImpPalette( const XclImpRoot& rRoot ) : -- XclDefaultPalette( rRoot ) -+ XclDefaultPalette( rRoot ), mrRoot( rRoot ) - { - } - -@@ -105,6 +165,7 @@ void XclImpPalette::ReadPalette( XclImpS - rStrm >> aColor; - maColorTable[ nIndex ] = aColor.GetColor(); - } -+ ExportPalette(); - } - - // FONT record - font information ============================================= |