[Libreoffice-commits] .: 2 commits - sc/source

Muthu Subramanian sumuthu at kemper.freedesktop.org
Tue Nov 30 05:18:34 PST 2010


 sc/source/ui/unoobj/cellsuno.cxx |   48 ++++++++++++++++++++++++++++++---------
 sc/source/ui/unoobj/shapeuno.cxx |   10 +++++---
 2 files changed, 45 insertions(+), 13 deletions(-)

New commits:
commit d7e24e977588851bf3eea2c2f2a12c9763cba161
Author: Muthu Subramanian K <sumuthu at novell.com>
Date:   Tue Nov 30 18:38:49 2010 +0530

    Import of super/subscript properties of cells - n#655193

diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index cb5ae44..939fa4b 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -29,7 +29,6 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sc.hxx"
 
-
 #include "scitems.hxx"
 #include <editeng/eeitem.hxx>
 #include <svx/svdpool.hxx>
@@ -126,6 +125,7 @@
 #include "formula/errorcodes.hxx"
 #include "unoreflist.hxx"
 #include "formula/grammar.hxx"
+#include "editeng/escpitem.hxx"
 
 #include <list>
 
@@ -133,7 +133,6 @@ using namespace com::sun::star;
 
 //------------------------------------------------------------------------
 
-
 class ScNamedEntry
 {
     String	aName;
@@ -147,7 +146,6 @@ public:
     const ScRange&	GetRange() const	{ return aRange; }
 };
 
-
 //------------------------------------------------------------------------
 
 //	Die Namen in den Maps muessen (nach strcmp) sortiert sein!
@@ -456,6 +454,7 @@ const SfxItemPropertySet* lcl_GetCellPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((sal_Int32*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_WRITING),	ATTR_WRITINGDIR,	&getCppuType((sal_Int16*)0),			0, 0 },
+        {MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_ESCAPEMENT),	EE_CHAR_ESCAPEMENT, &getCppuType((sal_Int32*)0),			0, 0 },
         {0,0,0,0,0,0}
     };
     static SfxItemPropertySet aCellPropertySet( aCellPropertyMap_Impl );
@@ -813,7 +812,6 @@ const SvxItemPropertySet* lcl_GetEditPropertySet()
     return &aEditPropertySet;
 }
 
-
 //------------------------------------------------------------------------
 
 //!	diese Funktionen in einen allgemeinen Header verschieben
@@ -1812,7 +1810,7 @@ const SfxItemPropertyMap* ScCellRangesBase::GetItemPropertyMap()
     return pPropSet->getPropertyMap();
 }
 
-void lcl_GetPropertyWhich( const SfxItemPropertySimpleEntry* pEntry, 
+void lcl_GetPropertyWhich( const SfxItemPropertySimpleEntry* pEntry,
                                                 USHORT& rItemWhich )
 {
     //	Which-ID des betroffenen Items, auch wenn das Item die Property
@@ -2090,7 +2088,6 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangesBase::getPropertySe
     return aRef;
 }
 
-
 void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rValue,
                             ScPatternAttr& rPattern, ScDocument* pDoc,
                             USHORT& rFirstItemId, USHORT& rSecondItemId )
@@ -2256,6 +2253,40 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
         else		// implemented here
             switch ( pEntry->nWID )
             {
+                case EE_CHAR_ESCAPEMENT:    // Specifically for xlsx import
+                    {
+                        int nValue;
+                        aValue >>= nValue;
+                        if( nValue )
+                        {
+                            int n = aRanges.Count();
+                            for(int i=0; i<n; i++ )
+                            {
+                                ScRange aRange( *aRanges.GetObject(i) );
+                                /* TODO: Iterate through the range */
+                                ScAddress  aAddr = aRange.aStart;
+                                ScDocument *pDoc = pDocShell->GetDocument();
+                                ScBaseCell *pCell = pDoc->GetCell( aAddr );
+                                String aStr( pCell->GetStringData() );
+                                EditEngine aEngine( pDoc->GetEnginePool() );
+                                /* EE_CHAR_ESCAPEMENT seems to be set on the cell _only_ when
+                                 * there are no other attribs for the cell.
+                                 * So, it is safe to overwrite the complete attribute set.
+                                 * If there is a need - getting CellType and processing
+                                 * the attributes could be considered.
+                                 */
+                                SfxItemSet aAttr = aEngine.GetEmptyItemSet();
+                                aEngine.SetText( aStr );
+                                if( nValue < 0 )    // Subscript
+                                    aAttr.Put( SvxEscapementItem( SVX_ESCAPEMENT_SUBSCRIPT, EE_CHAR_ESCAPEMENT ) );
+                                else                // Superscript
+                                    aAttr.Put( SvxEscapementItem( SVX_ESCAPEMENT_SUPERSCRIPT, EE_CHAR_ESCAPEMENT ) );
+                                aEngine.QuickSetAttribs( aAttr, ESelection( 0, 0, 0, aStr.Len()));
+                                pDoc->PutCell( (aRanges.GetObject(0))->aStart, new ScEditCell( aEngine.CreateTextObject(), pDoc, NULL ) );
+                            }
+                        }
+                    }
+                    break;
                 case SC_WID_UNO_CHCOLHDR:
                     // chart header flags are set for this object, not stored with document
                     bChartColAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
@@ -4360,7 +4391,6 @@ void SAL_CALL ScCellRangesObj::removeRangeAddresses( const uno::Sequence<table::
     // with this implementation not needed
 //	SolarMutexGuard aGuard;
 
-
     // use sometimes a better/faster implementation
     sal_uInt32 nCount(rRangeSeq.getLength());
     if (nCount)
@@ -4930,7 +4960,6 @@ uno::Reference<table::XCellRange> SAL_CALL ScCellRangeObj::getCellRangeByPositio
 //    return NULL;
 }
 
-
 uno::Reference<table::XCellRange> SAL_CALL ScCellRangeObj::getCellRangeByName(
                         const rtl::OUString& aName ) throw(uno::RuntimeException)
 {
@@ -9850,5 +9879,4 @@ uno::Any SAL_CALL ScUniqueCellFormatsEnumeration::nextElement() throw(container:
     return uno::makeAny(uno::Reference<sheet::XSheetCellRangeContainer>(new ScCellRangesObj(pDocShell, aRangeLists[nCurrentPosition++])));
 }
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 2139a723e5d61f7bf458c1c5de52cdf936ff1b33
Author: Muthu Subramanian K <sumuthu at novell.com>
Date:   Tue Nov 30 18:10:46 2010 +0530

    Import hyperlinks of textboxes/shapes - n#655216

diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 845b64d..ef0598b 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -74,6 +74,8 @@ const SfxItemPropertyMapEntry* lcl_GetShapeMap()
         {MAP_CHAR_LEN(SC_UNONAME_MOVEPROTECT), 0, &getCppuType((sal_Bool*)0), 0, 0 },
         // #i66550 HLINK_FOR_SHAPES
         {MAP_CHAR_LEN(SC_UNONAME_HYPERLINK), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_URL), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
+
         {0,0,0,0,0,0}
     };
     return aShapeMap_Impl;
@@ -647,7 +649,8 @@ void SAL_CALL ScShapeObj::setPropertyValue(
             }
         }
     }
-    else if  ( aNameString.EqualsAscii( SC_UNONAME_HYPERLINK ) )
+    else if  ( aNameString.EqualsAscii( SC_UNONAME_HYPERLINK ) ||
+               aNameString.EqualsAscii( SC_UNONAME_URL) )
     {
         rtl::OUString sHlink;
         ScMacroInfo* pInfo = lcl_getShapeHyperMacroInfo(this, TRUE);
@@ -844,7 +847,8 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const rtl::OUString& aPropertyNa
             }
         }
     }
-    else if ( aNameString.EqualsAscii( SC_UNONAME_HYPERLINK ) )
+    else if ( aNameString.EqualsAscii( SC_UNONAME_HYPERLINK ) ||
+              aNameString.EqualsAscii( SC_UNONAME_URL ) )
     {
         rtl::OUString sHlink;
         if ( ScMacroInfo* pInfo = lcl_getShapeHyperMacroInfo(this) )


More information about the Libreoffice-commits mailing list