incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1386501 [4/10] - in /incubator/ooo/branches/writer001: ./ ext_libraries/ratscan/ ext_sources/ main/ main/autodoc/source/display/html/ main/basegfx/inc/basegfx/numeric/ main/basegfx/source/numeric/ main/basegfx/source/tools/ main/basic/sour...
Date Mon, 17 Sep 2012 08:06:23 GMT
Modified: incubator/ooo/branches/writer001/main/oox/source/drawingml/chart/titleconverter.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/oox/source/drawingml/chart/titleconverter.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/oox/source/drawingml/chart/titleconverter.cxx (original)
+++ incubator/ooo/branches/writer001/main/oox/source/drawingml/chart/titleconverter.cxx Mon Sep 17 08:06:09 2012
@@ -35,7 +35,10 @@
 #include "oox/drawingml/chart/datasourceconverter.hxx"
 #include "oox/drawingml/chart/titlemodel.hxx"
 #include "oox/helper/containerhelper.hxx"
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/drawing/Alignment.hpp>
 
+#include "oox/drawingml/chart/modelbase.hxx"
 namespace oox {
 namespace drawingml {
 namespace chart {
@@ -49,6 +52,7 @@ using namespace ::com::sun::star::uno;
 
 using ::oox::core::XmlFilterBase;
 using ::rtl::OUString;
+using namespace ::com::sun::star::drawing;
 
 // ============================================================================
 
@@ -209,6 +213,8 @@ void LegendConverter::convertFromModel( 
         // predefined legend position and expansion
         cssc2::LegendPosition eLegendPos = cssc2::LegendPosition_CUSTOM;
         cssc::ChartLegendExpansion eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
+        RelativePosition eRelPos;
+        bool bTopRight=0; 
         switch( mrModel.mnPosition )
         {
             case XML_l:
@@ -216,9 +222,16 @@ void LegendConverter::convertFromModel( 
                 eLegendExpand = cssc::ChartLegendExpansion_HIGH;
             break;
             case XML_r:
-            case XML_tr:    // top-right not supported
                 eLegendPos = cssc2::LegendPosition_LINE_END;
                 eLegendExpand = cssc::ChartLegendExpansion_HIGH;
+                break;
+            case XML_tr:    // top-right not supported
+                eLegendPos = LegendPosition_CUSTOM;
+                eRelPos.Primary = 1;
+                eRelPos.Secondary =0;
+                eRelPos.Anchor = Alignment_TOP_RIGHT;
+                bTopRight=1;
+
             break;
             case XML_t:
                 eLegendPos = cssc2::LegendPosition_PAGE_START;
@@ -229,19 +242,23 @@ void LegendConverter::convertFromModel( 
                 eLegendExpand = cssc::ChartLegendExpansion_WIDE;
             break;
         }
-
+        bool bManualLayout=false;
         // manual positioning and size
-        if( mrModel.mxLayout.get() )
+        if( mrModel.mxLayout.get() ) 
         {
             LayoutConverter aLayoutConv( *this, *mrModel.mxLayout );
             // manual size needs ChartLegendExpansion_CUSTOM
             if( aLayoutConv.convertFromModel( aPropSet ) )
                 eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
+            bManualLayout = !aLayoutConv.getAutoLayout();
         }
 
         // set position and expansion properties
         aPropSet.setProperty( PROP_AnchorPosition, eLegendPos );
         aPropSet.setProperty( PROP_Expansion, eLegendExpand );
+
+        if(eLegendPos == LegendPosition_CUSTOM && 1 == bTopRight && bManualLayout==false)
+            aPropSet.setProperty( PROP_RelativePosition , makeAny(eRelPos));
     }
     catch( Exception& )
     {

Modified: incubator/ooo/branches/writer001/main/oox/source/drawingml/customshapegeometry.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/oox/source/drawingml/customshapegeometry.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/oox/source/drawingml/customshapegeometry.cxx (original)
+++ incubator/ooo/branches/writer001/main/oox/source/drawingml/customshapegeometry.cxx Mon Sep 17 08:06:09 2012
@@ -1251,7 +1251,10 @@ OUString GetShapeType( sal_Int32 nType )
             static const OUString sPlaque = CREATE_OUSTRING( "mso-spt21" );
 			sType = sPlaque;
 			} break;
-		case XML_teardrop:					// TODO
+		case XML_teardrop:{                
+            static const OUString sTearDrop = CREATE_OUSTRING( "teardrop" );
+			sType = sTearDrop;
+			} break;
 		case XML_ellipse: {
             static const OUString sEllipse = CREATE_OUSTRING( "ellipse" );
 			sType = sEllipse;

Modified: incubator/ooo/branches/writer001/main/oox/source/drawingml/table/tableproperties.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/oox/source/drawingml/table/tableproperties.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/oox/source/drawingml/table/tableproperties.cxx (original)
+++ incubator/ooo/branches/writer001/main/oox/source/drawingml/table/tableproperties.cxx Mon Sep 17 08:06:09 2012
@@ -32,6 +32,7 @@
 #include "oox/core/xmlfilterbase.hxx"
 #include "oox/helper/propertyset.hxx"
 
+
 using rtl::OUString;
 using namespace ::oox::core;
 using namespace ::com::sun::star;
@@ -104,7 +105,133 @@ void MergeCells( const uno::Reference< X
 
 static TableStyle* pDefaultTableStyle = new TableStyle();
 
-const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase )
+//for pptx just has table style id
+static void SetTableStyleProperties(TableStyle* &pTableStyle , const sal_Int32& tblFillClr,const sal_Int32& tblTextClr, const sal_Int32& lineBdrClr)
+{	
+	//whole table fill style and color
+	oox::drawingml::FillPropertiesPtr pWholeTabFillProperties( new oox::drawingml::FillProperties );
+	pWholeTabFillProperties->moFillType.set(XML_solidFill);
+	pWholeTabFillProperties->maFillColor.setSchemeClr(tblFillClr);  
+	pWholeTabFillProperties->maFillColor.addTransformation(XML_tint,20000);
+	pTableStyle->getWholeTbl().getFillProperties() = pWholeTabFillProperties;
+	//whole table text color
+	::oox::drawingml::Color tableTextColor;
+	tableTextColor.setSchemeClr(tblTextClr);
+	pTableStyle->getWholeTbl().getTextColor() = tableTextColor;
+	//whole table line border
+	oox::drawingml::LinePropertiesPtr pLeftBorder( new oox::drawingml::LineProperties);
+	pLeftBorder->moLineWidth = 12700;
+	pLeftBorder->moPresetDash = XML_sng;
+	pLeftBorder->maLineFill.moFillType.set(XML_solidFill);
+	pLeftBorder->maLineFill.maFillColor.setSchemeClr(lineBdrClr);
+	pTableStyle->getWholeTbl().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_left,pLeftBorder));
+	pTableStyle->getWholeTbl().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_right,pLeftBorder));
+	pTableStyle->getWholeTbl().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_top,pLeftBorder));
+	pTableStyle->getWholeTbl().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_bottom,pLeftBorder));
+	pTableStyle->getWholeTbl().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_insideH,pLeftBorder));
+	pTableStyle->getWholeTbl().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_insideV,pLeftBorder));
+
+	//Band1H style
+	oox::drawingml::FillPropertiesPtr pBand1HFillProperties( new oox::drawingml::FillProperties );
+	pBand1HFillProperties->moFillType.set(XML_solidFill);
+	pBand1HFillProperties->maFillColor.setSchemeClr(tblFillClr);	
+	pBand1HFillProperties->maFillColor.addTransformation(XML_tint,40000);
+	pTableStyle->getBand1H().getFillProperties() = pBand1HFillProperties;
+	
+	//Band1V style
+	pTableStyle->getBand1V().getFillProperties() = pBand1HFillProperties;
+
+    //tet bold for 1st row/last row/column
+	::boost::optional< sal_Bool > textBoldStyle(sal_True);
+	pTableStyle->getFirstRow().getTextBoldStyle() = textBoldStyle;
+	pTableStyle->getLastRow().getTextBoldStyle() = textBoldStyle;
+	pTableStyle->getFirstCol().getTextBoldStyle() = textBoldStyle;
+	pTableStyle->getLastCol().getTextBoldStyle() = textBoldStyle;
+}
+
+ sal_Bool CreateTableStyle(TableStyle* &pTableStyle , const OUString& styleId)
+{	
+	sal_Bool createdTblStyle = sal_False;
+	if(!styleId.compareToAscii("{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}")){           //Medium Style 2 Accenat 1
+		pTableStyle = new TableStyle();
+		createdTblStyle = sal_True;
+        //first row style
+        //fill color and type
+		oox::drawingml::FillPropertiesPtr pFstRowFillProperties( new oox::drawingml::FillProperties );
+		pFstRowFillProperties->moFillType.set(XML_solidFill);
+		pFstRowFillProperties->maFillColor.setSchemeClr(XML_accent1);   
+		pTableStyle->getFirstRow().getFillProperties() = pFstRowFillProperties;
+		//text color
+		::oox::drawingml::Color fstRowTextColor;
+		fstRowTextColor.setSchemeClr(XML_lt1);
+		pTableStyle->getFirstRow().getTextColor() = fstRowTextColor;
+		//bottom line border
+		oox::drawingml::LinePropertiesPtr pFstBottomBorder( new oox::drawingml::LineProperties);
+		pFstBottomBorder->moLineWidth = 38100;
+		pFstBottomBorder->moPresetDash = XML_sng;
+		pFstBottomBorder->maLineFill.moFillType.set(XML_solidFill);
+		pFstBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
+		pTableStyle->getFirstRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_bottom,pFstBottomBorder));
+
+        //last row style
+		pTableStyle->getLastRow().getFillProperties() = pFstRowFillProperties;
+		pTableStyle->getLastRow().getTextColor() = fstRowTextColor;
+		pTableStyle->getLastRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_top,pFstBottomBorder));
+
+		//first column style
+		pTableStyle->getFirstRow().getFillProperties() = pFstRowFillProperties;
+		pTableStyle->getFirstRow().getTextColor() = fstRowTextColor;
+
+		//last column style
+		pTableStyle->getLastCol().getFillProperties() = pFstRowFillProperties;
+		pTableStyle->getLastCol().getTextColor() = fstRowTextColor;
+
+		SetTableStyleProperties(pTableStyle, XML_accent1, XML_dk1, XML_lt1);
+	}
+	else if (!styleId.compareToAscii("{21E4AEA4-8DFA-4A89-87EB-49C32662AFE0}"))         //Medium Style 2 Accent 2
+	{
+		pTableStyle = new TableStyle();
+		createdTblStyle = sal_True;
+		oox::drawingml::FillPropertiesPtr pFstRowFillProperties( new oox::drawingml::FillProperties );
+		pFstRowFillProperties->moFillType.set(XML_solidFill);
+		pFstRowFillProperties->maFillColor.setSchemeClr(XML_accent2);   
+		pTableStyle->getFirstRow().getFillProperties() = pFstRowFillProperties;
+
+		::oox::drawingml::Color fstRowTextColor;
+		fstRowTextColor.setSchemeClr(XML_lt1);
+		pTableStyle->getFirstRow().getTextColor() = fstRowTextColor;
+		
+		oox::drawingml::LinePropertiesPtr pFstBottomBorder( new oox::drawingml::LineProperties);
+		pFstBottomBorder->moLineWidth = 38100;
+		pFstBottomBorder->moPresetDash = XML_sng;
+		pFstBottomBorder->maLineFill.moFillType.set(XML_solidFill);
+		pFstBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
+		pTableStyle->getFirstRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_bottom,pFstBottomBorder));
+
+		pTableStyle->getLastRow().getFillProperties() = pFstRowFillProperties;
+		pTableStyle->getLastRow().getTextColor() = fstRowTextColor;
+		pTableStyle->getLastRow().getLineBorders().insert(std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(XML_top,pFstBottomBorder));
+
+		pTableStyle->getFirstCol().getFillProperties() = pFstRowFillProperties;
+		pTableStyle->getFirstCol().getTextColor() = fstRowTextColor;
+	
+		pTableStyle->getLastCol().getFillProperties() = pFstRowFillProperties;
+		pTableStyle->getLastCol().getTextColor() = fstRowTextColor;		
+
+		SetTableStyleProperties(pTableStyle, XML_accent2, XML_dk1, XML_lt1);
+	}
+	else if (!styleId.compareToAscii("{C4B1156A-380E-4F78-BDF5-A606A8083BF9}"))         //Medium Style 4 Accent 4
+	{
+		pTableStyle = new TableStyle();
+		createdTblStyle = sal_True;
+		SetTableStyleProperties(pTableStyle, XML_accent4, XML_dk1, XML_accent4);
+	}
+
+	return createdTblStyle;
+} 
+//end
+
+const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase, sal_Bool &isCreateTabStyle )
 {
 	::oox::core::XmlFilterBase& rBase( const_cast< ::oox::core::XmlFilterBase& >( rFilterBase ) );
 
@@ -125,6 +252,11 @@ const TableStyle& TableProperties::getUs
 			}
 			aIter++;
 		}
+		//if the pptx just has table style id, but no table style content, we will create the table style ourselves
+		if ( !pTableStyle )
+		{
+			isCreateTabStyle = CreateTableStyle(pTableStyle , aStyleId);
+		}
 	}
 	if ( !pTableStyle )
 		pTableStyle = pDefaultTableStyle;
@@ -143,7 +275,8 @@ void TableProperties::pushToPropSet( con
 	CreateTableColumns( xColumnRowRange->getColumns(), mvTableGrid );
 	CreateTableRows( xColumnRowRange->getRows(), mvTableRows );
 
-	const TableStyle& rTableStyle( getUsedTableStyle( rFilterBase ) );
+	sal_Bool mbOwnTblStyle = sal_False;
+	const TableStyle& rTableStyle( getUsedTableStyle( rFilterBase, mbOwnTblStyle ) );
 	sal_Int32 nRow = 0;
 	std::vector< TableRow >::iterator aTableRowIter( mvTableRows.begin() );
 	while( aTableRowIter != mvTableRows.end() )
@@ -169,6 +302,17 @@ void TableProperties::pushToPropSet( con
 		nRow++;
 		aTableRowIter++;
 	}
+	
+	if(mbOwnTblStyle == sal_True)
+	{
+		TableStyle* pTableStyle = (TableStyle*)&rTableStyle;
+		if(pTableStyle != NULL)
+		{
+			delete pTableStyle;
+			pTableStyle = NULL;
+		}
+		mbOwnTblStyle = sal_False;
+	}
 }
 
 } } }

Modified: incubator/ooo/branches/writer001/main/oox/source/drawingml/textparagraphpropertiescontext.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/oox/source/drawingml/textparagraphpropertiescontext.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/oox/source/drawingml/textparagraphpropertiescontext.cxx (original)
+++ incubator/ooo/branches/writer001/main/oox/source/drawingml/textparagraphpropertiescontext.cxx Mon Sep 17 08:06:09 2012
@@ -23,7 +23,7 @@
 
 #include "oox/drawingml/textparagraphpropertiescontext.hxx"
 
-#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
 #include <com/sun/star/awt/FontDescriptor.hpp>
 
 #include "oox/drawingml/colorchoicecontext.hxx"
@@ -132,7 +132,7 @@ TextParagraphPropertiesContext::TextPara
 	if ( xAttribs->hasAttribute( XML_rtl ) )
 	{
 		bool bRtl = attribs.getBool( XML_rtl, false );
-        rPropertyMap[ PROP_TextWritingMode ] <<= ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB );
+		rPropertyMap[ PROP_WritingMode ] <<= ( bRtl ? WritingMode2::RL_TB : WritingMode2::LR_TB );
 	}
 }
 

Modified: incubator/ooo/branches/writer001/main/oox/source/token/properties.txt
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/oox/source/token/properties.txt?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/oox/source/token/properties.txt (original)
+++ incubator/ooo/branches/writer001/main/oox/source/token/properties.txt Mon Sep 17 08:06:09 2012
@@ -284,6 +284,7 @@ MultiPageValue
 MultiSelection
 Name
 NamedRanges
+NamedRanges2
 NegativeError
 NullDate
 NumberFormat

Modified: incubator/ooo/branches/writer001/main/oox/source/xls/defnamesbuffer.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/oox/source/xls/defnamesbuffer.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/oox/source/xls/defnamesbuffer.cxx (original)
+++ incubator/ooo/branches/writer001/main/oox/source/xls/defnamesbuffer.cxx Mon Sep 17 08:06:09 2012
@@ -502,7 +502,7 @@ void DefinedName::createNameObject()
     }
 
     // create the name and insert it into the document, maCalcName will be changed to the resulting name
-    mxNamedRange = createNamedRangeObject( maCalcName, nNameFlags );
+    mxNamedRange = createNamedRangeObject( maCalcName, maModel.mnSheet, nNameFlags );
     // index of this defined name used in formula token arrays
     PropertySet aPropSet( mxNamedRange );
     aPropSet.getProperty( mnTokenIndex, PROP_TokenIndex );

Modified: incubator/ooo/branches/writer001/main/oox/source/xls/formulabase.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/oox/source/xls/formulabase.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/oox/source/xls/formulabase.cxx (original)
+++ incubator/ooo/branches/writer001/main/oox/source/xls/formulabase.cxx Mon Sep 17 08:06:09 2012
@@ -724,10 +724,10 @@ static const FunctionData saFuncTableOox
     { 0,                        "CUBESET",              478,    NOID,   2,  5,  V, { VR, RX, VR }, 0 },
     { 0,                        "CUBESETCOUNT",         479,    NOID,   1,  1,  V, { VR }, 0 },
     { 0,                        "IFERROR",              480,    NOID,   2,  2,  V, { VO, RO }, 0 },
-    { 0,                        "COUNTIFS",             481,    NOID,   2,  MX, V, { RO, VR }, FUNCFLAG_PARAMPAIRS },
-    { 0,                        "SUMIFS",               482,    NOID,   3,  MX, V, { RO, RO, VR }, FUNCFLAG_PARAMPAIRS },
-    { 0,                        "AVERAGEIF",            483,    NOID,   2,  3,  V, { RO, VR, RO }, 0 },
-    { 0,                        "AVERAGEIFS",           484,    NOID,   3,  MX, V, { RO, RO, VR }, 0 }
+    { "COUNTIFS",               "COUNTIFS",             481,    NOID,   2,  MX, V, { RO, VR }, FUNCFLAG_MACROCALL | FUNCFLAG_PARAMPAIRS },
+    { "SUMIFS",                 "SUMIFS",               482,    NOID,   3,  MX, V, { RO, RO, VR }, FUNCFLAG_MACROCALL | FUNCFLAG_PARAMPAIRS },
+    { "AVERAGEIF",              "AVERAGEIF",            483,    NOID,   2,  3,  V, { RO, VR, RO }, FUNCFLAG_MACROCALL },
+    { "AVERAGEIFS",             "AVERAGEIFS",           484,    NOID,   3,  MX, V, { RO, RO, VR }, FUNCFLAG_MACROCALL | FUNCFLAG_PARAMPAIRS }
 };
 
 /** Functions defined by OpenFormula, but not supported by Calc or by Excel. */
@@ -788,8 +788,6 @@ FunctionParamInfoIterator::FunctionParam
     mpParamInfoEnd( rFuncInfo.mpParamInfos + FUNCINFO_PARAMINFOCOUNT ),
     mbParamPairs( rFuncInfo.mbParamPairs )
 {
-    OSL_ENSURE( !mbParamPairs || (mpParamInfo + 1 < mpParamInfoEnd),
-        "FunctionParamInfoIterator::FunctionParamInfoIterator - expecting at least 2 infos for paired parameters" );
 }
 
 const FunctionParamInfo& FunctionParamInfoIterator::getParamInfo() const
@@ -815,12 +813,12 @@ FunctionParamInfoIterator& FunctionParam
         // move pointer to next entry, if something explicit follows
         if( (mpParamInfo + 1 < mpParamInfoEnd) && (mpParamInfo[ 1 ].meValid != FUNC_PARAM_NONE) )
             ++mpParamInfo;
-        // points to last info, but parameter pairs expected, move to previous info
-        else if( mbParamPairs )
-            --mpParamInfo;
         // if last parameter type is 'Excel-only' or 'Calc-only', do not repeat it
         else if( isExcelOnlyParam() || isCalcOnlyParam() )
             mpParamInfo = 0;
+        // points to last info, but parameter pairs expected, move to previous info
+        else if( mbParamPairs )
+            --mpParamInfo;
         // otherwise: repeat last parameter class
     }
     return *this;
@@ -886,8 +884,7 @@ FunctionProviderImpl::FunctionProviderIm
         initFuncs( saFuncTableBiff5, STATIC_ARRAY_END( saFuncTableBiff5 ), nMaxParam, bImportFilter );
     if( eBiff >= BIFF8 )
         initFuncs( saFuncTableBiff8, STATIC_ARRAY_END( saFuncTableBiff8 ), nMaxParam, bImportFilter );
-    if( eFilter == FILTER_OOXML )
-        initFuncs( saFuncTableOox, STATIC_ARRAY_END( saFuncTableOox ), nMaxParam, bImportFilter );
+    initFuncs( saFuncTableOox, STATIC_ARRAY_END( saFuncTableOox ), nMaxParam, bImportFilter );
     initFuncs( saFuncTableOdf, STATIC_ARRAY_END( saFuncTableOdf ), nMaxParam, bImportFilter );
 }
 

Modified: incubator/ooo/branches/writer001/main/oox/source/xls/pivottablebuffer.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/oox/source/xls/pivottablebuffer.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/oox/source/xls/pivottablebuffer.cxx (original)
+++ incubator/ooo/branches/writer001/main/oox/source/xls/pivottablebuffer.cxx Mon Sep 17 08:06:09 2012
@@ -646,8 +646,7 @@ void PivotTableField::convertPageField( 
                 if( const PivotCacheItem* pSharedItem = pCacheField->getCacheItem( nCacheItem ) )
                 {
                     OUString aSelectedPage = pSharedItem->getName();
-                    if( aSelectedPage.getLength() > 0 )
-                        aPropSet.setProperty( PROP_SelectedPage, aSelectedPage );
+                    aPropSet.setProperty( PROP_SelectedPage, aSelectedPage );
                 }
             }
         }

Modified: incubator/ooo/branches/writer001/main/oox/source/xls/sheetdatabuffer.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/oox/source/xls/sheetdatabuffer.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/oox/source/xls/sheetdatabuffer.cxx (original)
+++ incubator/ooo/branches/writer001/main/oox/source/xls/sheetdatabuffer.cxx Mon Sep 17 08:06:09 2012
@@ -28,6 +28,7 @@
 #include <com/sun/star/sheet/XCellRangeData.hpp>
 #include <com/sun/star/sheet/XFormulaTokens.hpp>
 #include <com/sun/star/sheet/XMultipleOperation.hpp>
+#include <com/sun/star/sheet/XNamedRange2.hpp>
 #include <com/sun/star/table/XCell.hpp>
 #include <com/sun/star/text/XText.hpp>
 #include <com/sun/star/util/DateTime.hpp>
@@ -671,7 +672,7 @@ void SheetDataBuffer::createSharedFormul
         append( static_cast< sal_Int32 >( getSheetIndex() + 1 ) ).
         append( sal_Unicode( '_' ) ).append( rMapKey.mnRow ).
         append( sal_Unicode( '_' ) ).append( rMapKey.mnCol ).makeStringAndClear();
-    Reference< XNamedRange > xNamedRange = createNamedRangeObject( aName );
+    Reference< XNamedRange2 > xNamedRange = createNamedRangeObject( aName );
     OSL_ENSURE( xNamedRange.is(), "SheetDataBuffer::createSharedFormula - cannot create shared formula" );
     PropertySet aNameProps( xNamedRange );
     aNameProps.setProperty( PROP_IsSharedFormula, true );

Modified: incubator/ooo/branches/writer001/main/oox/source/xls/workbookhelper.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/oox/source/xls/workbookhelper.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/oox/source/xls/workbookhelper.cxx (original)
+++ incubator/ooo/branches/writer001/main/oox/source/xls/workbookhelper.cxx Mon Sep 17 08:06:09 2012
@@ -28,8 +28,8 @@
 #include <com/sun/star/document/XActionLockable.hpp>
 #include <com/sun/star/sheet/XDatabaseRange.hpp>
 #include <com/sun/star/sheet/XDatabaseRanges.hpp>
-#include <com/sun/star/sheet/XNamedRange.hpp>
-#include <com/sun/star/sheet/XNamedRanges.hpp>
+#include <com/sun/star/sheet/XNamedRange2.hpp>
+#include <com/sun/star/sheet/XNamedRanges2.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/style/XStyle.hpp>
@@ -133,7 +133,7 @@ public:
     /** Returns the specified cell or page style from the Calc document. */
     Reference< XStyle > getStyleObject( const OUString& rStyleName, bool bPageStyle ) const;
     /** Creates and returns a defined name on-the-fly in the Calc document. */
-    Reference< XNamedRange > createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const;
+    Reference< XNamedRange2 > createNamedRangeObject( OUString& orScope, OUString& orName, sal_Int32 nNameFlags ) const;
     /** Creates and returns a database range on-the-fly in the Calc document. */
     Reference< XDatabaseRange > createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const;
     /** Creates and returns a com.sun.star.style.Style object for cells or pages. */
@@ -348,20 +348,20 @@ Reference< XStyle > WorkbookGlobals::get
     return xStyle;
 }
 
-Reference< XNamedRange > WorkbookGlobals::createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const
+Reference< XNamedRange2 > WorkbookGlobals::createNamedRangeObject( OUString& orScope, OUString& orName, sal_Int32 nNameFlags ) const
 {
     // create the name and insert it into the Calc document
-    Reference< XNamedRange > xNamedRange;
+    Reference< XNamedRange2 > xNamedRange;
     if( orName.getLength() > 0 ) try
     {
         // find an unused name
         PropertySet aDocProps( mxDoc );
-        Reference< XNamedRanges > xNamedRanges( aDocProps.getAnyProperty( PROP_NamedRanges ), UNO_QUERY_THROW );
+        Reference< XNamedRanges2 > xNamedRanges( aDocProps.getAnyProperty( PROP_NamedRanges2 ), UNO_QUERY_THROW );
         Reference< XNameAccess > xNameAccess( xNamedRanges, UNO_QUERY_THROW );
         orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' );
         // create the named range
-        xNamedRanges->addNewByName( orName, OUString(), CellAddress( 0, 0, 0 ), nNameFlags );
-        xNamedRange.set( xNamedRanges->getByName( orName ), UNO_QUERY );
+        xNamedRanges->addNewByScopeName( orScope, orName, OUString(), CellAddress( 0, 0, 0 ), nNameFlags );
+        xNamedRange.set( xNamedRanges->getByScopeName( orScope, orName ), UNO_QUERY );
     }
     catch( Exception& )
     {
@@ -738,9 +738,10 @@ Reference< XStyle > WorkbookHelper::getS
     return mrBookGlob.getStyleObject( rStyleName, bPageStyle );
 }
 
-Reference< XNamedRange > WorkbookHelper::createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const
+Reference< XNamedRange2 > WorkbookHelper::createNamedRangeObject( OUString& orName, sal_Int32 nSheetId, sal_Int32 nNameFlags ) const
 {
-    return mrBookGlob.createNamedRangeObject( orName, nNameFlags );
+	OUString orScope = nSheetId >= 0? getWorksheets().getCalcSheetName(nSheetId) : OUString();
+    return mrBookGlob.createNamedRangeObject( orScope, orName, nNameFlags );
 }
 
 Reference< XDatabaseRange > WorkbookHelper::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const

Modified: incubator/ooo/branches/writer001/main/sc/inc/cell.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/cell.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/cell.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/cell.hxx Mon Sep 17 08:06:09 2012
@@ -38,6 +38,8 @@
 #include <unotools/fontcvt.hxx>
 #include "scdllapi.h"
 
+#include <cellform.hxx>
+
 #define USE_MEMPOOL
 #define TEXTWIDTH_DIRTY		0xffff
 
@@ -497,6 +499,38 @@ public:
 };
 
 // ============================================================================
+inline double GetValueFromCell( const ScBaseCell * pCell )
+{
+    switch (pCell->GetCellType())
+    {
+    case CELLTYPE_VALUE:
+        return ((ScValueCell*)pCell)->GetValue();
+    case CELLTYPE_FORMULA:
+        {
+            if (((ScFormulaCell*)pCell)->IsValue())
+                return ((ScFormulaCell*)pCell)->GetValue();
+            else
+                return 0.0;
+        }
+    default:
+        return 0.0;
+    }
+}
+// ============================================================================
+
+
+inline String GetStringFromCell( const ScBaseCell * pCell, sal_uLong nFormat, SvNumberFormatter* pFormatter )
+{
+    if (pCell->GetCellType() != CELLTYPE_NOTE)
+    {
+        String strResult;
+	Color* pColor = NULL;
+        ScCellFormat::GetString( const_cast<ScBaseCell*>(pCell), nFormat, strResult, &pColor, *(pFormatter) );
+        return strResult;
+    }
+    else
+        return String();
+}
 
 #endif
 

Modified: incubator/ooo/branches/writer001/main/sc/inc/column.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/column.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/column.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/column.hxx Mon Sep 17 08:06:09 2012
@@ -60,6 +60,7 @@ class ScPostIt;
 struct ScFunctionData;
 struct ScLineFlags;
 struct ScMergePatternState;
+class ScDPTableDataCache;
 class ScFlatBoolRowSegments;
 
 #define COLUMN_DELTA	4
@@ -360,6 +361,9 @@ public:
 									double nPPTX, double nPPTY,
 									const Fraction& rZoomX, const Fraction& rZoomY,
 									sal_Bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart );
+    template< typename TAddLebal, typename TAddData >
+    void        FillDPCacheT( long nDim, SCROW nStartRow, SCROW nEndRow, const TAddLebal & , const TAddData & );
+    void        FillDPCache( ScDPTableDataCache * pCache, long nDim, SCROW nStartRow, SCROW nEndRow );
 private:
 	long		GetSimpleTextNeededSize( SCSIZE nIndex, OutputDevice* pDev,
 									sal_Bool bWidth );

Modified: incubator/ooo/branches/writer001/main/sc/inc/compiler.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/compiler.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/compiler.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/compiler.hxx Mon Sep 17 08:06:09 2012
@@ -443,7 +443,8 @@ public:
 
     ScRangeData* UpdateInsertTab(SCTAB nTable, sal_Bool bIsName );
     ScRangeData* UpdateDeleteTab(SCTAB nTable, sal_Bool bIsMove, sal_Bool bIsName, sal_Bool& bCompile);
-    ScRangeData* UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, sal_Bool bIsName );
+    // the last parameter is true only when copying a sheet, to update the range name's address
+    ScRangeData* UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, bool bIsName, bool bOnlyUpdateOwnTab = false );
 
     sal_Bool HasModifiedRange();
 

Modified: incubator/ooo/branches/writer001/main/sc/inc/document.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/document.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/document.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/document.hxx Mon Sep 17 08:06:09 2012
@@ -611,8 +611,8 @@ public:
     void            SetStreamValid( SCTAB nTab, sal_Bool bSet, sal_Bool bIgnoreLock = sal_False );
     void            LockStreamValid( bool bLock );
     bool            IsStreamValidLocked() const                         { return mbStreamValidLocked; }
-    sal_Bool            IsPendingRowHeights( SCTAB nTab ) const;
-    void            SetPendingRowHeights( SCTAB nTab, sal_Bool bSet );
+    SC_DLLPUBLIC sal_Bool        IsPendingRowHeights( SCTAB nTab ) const;
+    SC_DLLPUBLIC void            SetPendingRowHeights( SCTAB nTab, sal_Bool bSet );
 	SC_DLLPUBLIC void			SetLayoutRTL( SCTAB nTab, sal_Bool bRTL );
 	SC_DLLPUBLIC sal_Bool			IsLayoutRTL( SCTAB nTab ) const;
 	sal_Bool			IsNegativePage( SCTAB nTab ) const;
@@ -1876,6 +1876,8 @@ private: // CLOOK-Impl-Methoden
 
 	std::map< SCTAB, ScSortParam > mSheetSortParams;
 
+public:
+    void    FillDPCache( ScDPTableDataCache * pCache, SCTAB nDocTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
 };
 inline void ScDocument::GetSortParam( ScSortParam& rParam, SCTAB nTab )
 {

Modified: incubator/ooo/branches/writer001/main/sc/inc/dpglobal.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/dpglobal.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/dpglobal.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/dpglobal.hxx Mon Sep 17 08:06:09 2012
@@ -196,4 +196,6 @@ namespace ScDPGlobal
    bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, sal_uInt16 nEndTab, sal_Bool bExcludeClip = sal_False );
 
 }
+#define isDateFormat( nNumType ) (!!((nNumType) & NUMBERFORMAT_DATE) )
+
 #endif 

Modified: incubator/ooo/branches/writer001/main/sc/inc/dptablecache.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/dptablecache.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/dptablecache.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/dptablecache.hxx Mon Sep 17 08:06:09 2012
@@ -107,8 +107,9 @@ public:
 
 protected:
 private:
+public:
 	void		AddLabel( ScDPItemData* pData);
-	sal_Bool	AddData( long nDim, ScDPItemData* itemData );
+    sal_Bool	AddData( long nDim, ScDPItemData* itemData, bool bCheckDate = true );
 };
 
 #endif //DPTABLECACHE_HXX

Modified: incubator/ooo/branches/writer001/main/sc/inc/helpids.h
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/helpids.h?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/helpids.h (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/helpids.h Mon Sep 17 08:06:09 2012
@@ -486,6 +486,7 @@
 #define HID_FUNC_WENN                                           "SC_HID_FUNC_WENN"
 #define HID_FUNC_ODER                                           "SC_HID_FUNC_ODER"
 #define HID_FUNC_UND                                            "SC_HID_FUNC_UND"
+#define HID_FUNC_XOR                                            "SC_HID_FUNC_XOR"
 
 #define HID_FUNC_ABS                                            "SC_HID_FUNC_ABS"
 #define HID_FUNC_POTENZ                                         "SC_HID_FUNC_POTENZ"
@@ -495,6 +496,10 @@
 #define HID_FUNC_QUADRATESUMME                                  "SC_HID_FUNC_QUADRATESUMME"
 #define HID_FUNC_PRODUKT                                        "SC_HID_FUNC_PRODUKT"
 #define HID_FUNC_SUMMEWENN                                      "SC_HID_FUNC_SUMMEWENN"
+#define HID_FUNC_AVERAGEIF                                      "SC_HID_FUNC_AVERAGEIF"
+#define HID_FUNC_SUMIFS                                         "SC_HID_FUNC_SUMIFS"
+#define HID_FUNC_AVERAGEIFS                                     "SC_HID_FUNC_AVERAGEIFS"
+#define HID_FUNC_COUNTIFS                                       "SC_HID_FUNC_COUNTIFS"
 #define HID_FUNC_ZAEHLENWENN                                    "SC_HID_FUNC_ZAEHLENWENN"
 #define HID_FUNC_WURZEL                                         "SC_HID_FUNC_WURZEL"
 #define HID_FUNC_ZUFALLSZAHL                                    "SC_HID_FUNC_ZUFALLSZAHL"

Modified: incubator/ooo/branches/writer001/main/sc/inc/nameuno.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/nameuno.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/nameuno.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/nameuno.hxx Mon Sep 17 08:06:09 2012
@@ -30,10 +30,11 @@
 #include <com/sun/star/sheet/XLabelRange.hpp>
 #include <com/sun/star/sheet/XLabelRanges.hpp>
 #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-#include <com/sun/star/sheet/XNamedRange.hpp>
+#include <com/sun/star/sheet/XNamedRange2.hpp>
 #include <com/sun/star/sheet/XFormulaTokens.hpp>
-#include <com/sun/star/sheet/XNamedRanges.hpp>
+#include <com/sun/star/sheet/XNamedRanges2.hpp>
 #include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/sheet/RangeScopeName.hpp>
 #include <com/sun/star/lang/XServiceName.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -44,13 +45,15 @@
 #include <cppuhelper/implbase5.hxx>
 #include <cppuhelper/implbase6.hxx>
 
+#include <global.hxx> //for EMPTY_STRING
+
 class ScDocShell;
 class ScRangeData;
 class ScTokenArray;
 
 
 class ScNamedRangeObj : public ::cppu::WeakImplHelper6<
-							::com::sun::star::sheet::XNamedRange,
+							::com::sun::star::sheet::XNamedRange2,
                             ::com::sun::star::sheet::XFormulaTokens,
 							::com::sun::star::sheet::XCellRangeReferrer,
 							::com::sun::star::beans::XPropertySet,
@@ -61,16 +64,17 @@ class ScNamedRangeObj : public ::cppu::W
 private:
 	ScDocShell*				pDocShell;
 	String					aName;
+	String					aScopeName;
 
 private:
 	ScRangeData*			GetRangeData_Impl();
 	void					Modify_Impl( const String* pNewName,
                                         const ScTokenArray* pNewTokens, const String* pNewContent,
 										const ScAddress* pNewPos, const sal_uInt16* pNewType,
-                                        const formula::FormulaGrammar::Grammar eGrammar );
+                                        const formula::FormulaGrammar::Grammar eGrammar, const String* pNewScopeName = NULL );
 
 public:
-							ScNamedRangeObj(ScDocShell* pDocSh, const String& rNm);
+							ScNamedRangeObj(ScDocShell* pDocSh, const String& rNm, const String& rScopeName = EMPTY_STRING);
 	virtual					~ScNamedRangeObj();
 
 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
@@ -86,6 +90,8 @@ public:
 									throw(::com::sun::star::uno::RuntimeException);
 	virtual sal_Int32		SAL_CALL getType() throw(::com::sun::star::uno::RuntimeException);
 	virtual void SAL_CALL	setType( sal_Int32 nType ) throw(::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getScopeName() throw(::com::sun::star::uno::RuntimeException);
+	virtual void SAL_CALL	setScopeAndRangeName( const ::rtl::OUString& aScopeName, const ::rtl::OUString& aRangeName ) throw(::com::sun::star::uno::RuntimeException);
 
                             // XFormulaTokens
     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL getTokens()
@@ -169,7 +175,7 @@ public:
 
 
 class ScNamedRangesObj : public ::cppu::WeakImplHelper5<
-							::com::sun::star::sheet::XNamedRanges,
+							::com::sun::star::sheet::XNamedRanges2,
 							::com::sun::star::container::XEnumerationAccess,
 							::com::sun::star::container::XIndexAccess,
                             ::com::sun::star::document::XActionLockable,
@@ -181,6 +187,14 @@ private:
 
 	ScNamedRangeObj*		GetObjectByIndex_Impl(sal_uInt16 nIndex);
 	ScNamedRangeObj*		GetObjectByName_Impl(const ::rtl::OUString& aName);
+	ScNamedRangeObj*		GetObjectByScopeName_Impl(const ::rtl::OUString& aScopeName, const ::rtl::OUString& aRangeName);
+
+	void ImplAddNewByScopeAndName(SCTAB aScope,const ::rtl::OUString& aRangeName, const ::rtl::OUString& aContent,
+								const ::com::sun::star::table::CellAddress& aPosition, sal_Int32 nType)
+								throw(::com::sun::star::uno::RuntimeException);
+
+	void ImplRemoveByScopeAndName(SCTAB aScope,const ::rtl::OUString& aRangeName)
+								throw(::com::sun::star::uno::RuntimeException);
 
 protected:
     /** called from the XActionLockable interface methods on initial locking */
@@ -199,13 +213,27 @@ public:
 	virtual void SAL_CALL	addNewByName( const ::rtl::OUString& aName, const ::rtl::OUString& aContent,
 								const ::com::sun::star::table::CellAddress& aPosition, sal_Int32 nType )
 									throw(::com::sun::star::uno::RuntimeException);
+
+	virtual void SAL_CALL	addNewByScopeName( const ::rtl::OUString& aScopeName,const ::rtl::OUString& aRangeName, const ::rtl::OUString& aContent,
+								const ::com::sun::star::table::CellAddress& aPosition, sal_Int32 nType )
+									throw(::com::sun::star::uno::RuntimeException);
 	virtual void SAL_CALL	addNewFromTitles( const ::com::sun::star::table::CellRangeAddress& aSource,
 								::com::sun::star::sheet::Border aBorder )
 									throw(::com::sun::star::uno::RuntimeException);
 	virtual void SAL_CALL	removeByName( const ::rtl::OUString& aName )
 								throw(::com::sun::star::uno::RuntimeException);
+	virtual void SAL_CALL	removeByScopeName( const ::rtl::OUString& aScopeName, const ::rtl::OUString& aRangeName )
+								throw(::com::sun::star::uno::RuntimeException);
 	virtual void SAL_CALL	outputList( const ::com::sun::star::table::CellAddress& aOutputPosition )
 								throw(::com::sun::star::uno::RuntimeException);
+	virtual sal_Bool SAL_CALL hasByScopeName( const ::rtl::OUString& aScopeName, const ::rtl::OUString& aRangeName )
+								throw(::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::RangeScopeName > SAL_CALL getElementScopeNames()
+								throw(::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Any SAL_CALL getByScopeName( const ::rtl::OUString& aScopeName, const ::rtl::OUString& aRangeName )
+								throw(::com::sun::star::container::NoSuchElementException,
+									::com::sun::star::lang::WrappedTargetException,
+									::com::sun::star::uno::RuntimeException);
 
 							// XNameAccess
 	virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )

Modified: incubator/ooo/branches/writer001/main/sc/inc/rangenam.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/rangenam.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/rangenam.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/rangenam.hxx Mon Sep 17 08:06:09 2012
@@ -77,6 +77,7 @@ private:
     // application's default.
     SCROW           mnMaxRow;
     SCCOL           mnMaxCol;
+	SCTAB		aRangeNameScope;		// table index reference as range name scope. 0 -  sheet1, 1- sheet2.  MAXTABCOUNT - Global
 
 	friend class ScRangeName;
 	ScRangeData( sal_uInt16 nIndex );
@@ -110,6 +111,9 @@ public:
 	void			GetName( String& rName ) const	{ rName = aName; }
 	const String&	GetName( void ) const			{ return aName; }
 	const String&   GetUpperName( void ) const      { return aUpperName; }
+	SC_DLLPUBLIC  bool			SetRangeScope( SCTAB Scope );	// 0 - sheet1, 1 - sheet2, MAXTABCOUNT - global
+	SCTAB			GetRangeScope() const { return aRangeNameScope; }
+        String	GetScopeSheetName( void ) const;
 	ScAddress 		GetPos() const					{ return aPos; }
 	// Der Index muss eindeutig sein. Ist er 0, wird ein neuer Index vergeben
 	void            SetIndex( sal_uInt16 nInd )         { nIndex = nInd; }
@@ -200,9 +204,14 @@ public:
 //UNUSED2009-05 ScRangeData*			GetRangeAtCursor( const ScAddress&, sal_Bool bStartOnly ) const;
 	SC_DLLPUBLIC ScRangeData*			GetRangeAtBlock( const ScRange& ) const;
 
-	SC_DLLPUBLIC sal_Bool					SearchName( const String& rName, sal_uInt16& rPos ) const;
+	SC_DLLPUBLIC bool					SearchName( const String& rName, sal_uInt16& rPos, SCTAB Scope=MAXTABCOUNT) const;
                             // SearchNameUpper must be called with an upper-case search string
-	sal_Bool					SearchNameUpper( const String& rUpperName, sal_uInt16& rPos ) const;
+	bool					SearchNameUpper( const String& rUpperName, sal_uInt16& rPos, SCTAB Scope=MAXTABCOUNT ) const;
+	/* added by  for scope support */
+	bool				HasRangeinSheetScope( SCTAB Scope );
+	bool				RemoveRangeinScope(SCTAB Scope);
+	bool				CopyRangeinScope(SCTAB oldScope, SCTAB newScope);
+	/* end add */
 	void					UpdateReference(UpdateRefMode eUpdateRefMode,
 								const ScRange& rRange,
 								SCsCOL nDx, SCsROW nDy, SCsTAB nDz );

Modified: incubator/ooo/branches/writer001/main/sc/inc/sc.hrc
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/sc.hrc?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/sc.hrc (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/sc.hrc Mon Sep 17 08:06:09 2012
@@ -37,6 +37,7 @@
 #include "helpids.h"
 
 #define VAR_ARGS				30 // variable Parameter in scfuncs.src
+#define PAIRED_VAR_ARGS			(VAR_ARGS + VAR_ARGS)
 
 #define RID_HANDLEBITMAP		10005
 

Modified: incubator/ooo/branches/writer001/main/sc/inc/scmatrix.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/scmatrix.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/scmatrix.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/scmatrix.hxx Mon Sep 17 08:06:09 2012
@@ -426,6 +426,7 @@ public:
 
     double And();       // logical AND of all matrix values, or NAN
     double Or();        // logical OR of all matrix values, or NAN
+    double Xor();       // logical XOR of all matrix values, or NAN
 
     // All other matrix functions  MatMult, MInv, ...  are in ScInterpreter
     // to be numerically safe.

Modified: incubator/ooo/branches/writer001/main/sc/inc/styleuno.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/styleuno.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/styleuno.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/styleuno.hxx Mon Sep 17 08:06:09 2012
@@ -230,6 +230,15 @@ private:
 											throw(::com::sun::star::lang::IllegalArgumentException,
 													::com::sun::star::uno::RuntimeException);
 
+    // enhance ODS load performance
+	bool StyleSheetChangedUpdate();
+	void SetOnePropertyValueWithoutUpdate(  const ::rtl::OUString& rPropertyName,
+													const SfxItemPropertySimpleEntry* pEntry,
+													const ::com::sun::star::uno::Any* pValue )
+											throw(::com::sun::star::lang::IllegalArgumentException,
+													::com::sun::star::uno::RuntimeException);
+	//end add 
+
 	ScStyleObj(); // disabled
 public:
 							ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, const String& rName);

Modified: incubator/ooo/branches/writer001/main/sc/inc/table.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/table.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/table.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/table.hxx Mon Sep 17 08:06:09 2012
@@ -313,6 +313,7 @@ public:
 	void 		SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
 
 	void		GetString( SCCOL nCol, SCROW nRow, String& rString );
+    void    FillDPCache( ScDPTableDataCache * pCache, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
 	void		GetInputString( SCCOL nCol, SCROW nRow, String& rString );
 	double		GetValue( const ScAddress& rPos ) const
 					{

Modified: incubator/ooo/branches/writer001/main/sc/inc/unonames.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/inc/unonames.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/inc/unonames.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/inc/unonames.hxx Mon Sep 17 08:06:09 2012
@@ -44,6 +44,7 @@
 #define SC_UNO_COLLABELRNG			"ColumnLabelRanges"
 #define SC_UNO_DATABASERNG			"DatabaseRanges"
 #define SC_UNO_NAMEDRANGES			"NamedRanges"
+#define SC_UNO_NAMEDRANGES2			"NamedRanges2"
 #define SC_UNO_ROWLABELRNG			"RowLabelRanges"
 #define SC_UNO_SHEETLINKS			"SheetLinks"
 #define SC_UNO_FORBIDDEN			"ForbiddenCharacters"

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/column3.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/column3.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/column3.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/column3.cxx Mon Sep 17 08:06:09 2012
@@ -31,6 +31,11 @@
 #include <svl/zforlist.hxx>
 #include <svl/zformat.hxx>
 
+#include "boost/tuple/tuple.hpp"
+#include <boost/function.hpp>
+#include "boost/lambda/bind.hpp"
+#include "boost/bind.hpp"
+#include "boost/lambda/lambda.hpp"
 #include "scitems.hxx"
 #include "column.hxx"
 #include "cell.hxx"
@@ -48,9 +53,9 @@
 #include "detfunc.hxx"			// fuer Notizen bei DeleteRange
 #include "postit.hxx"
 #include "stringutil.hxx"
-
+#include "dpglobal.hxx"
+#include <dptablecache.hxx>
 #include <com/sun/star/i18n/LocaleDataItem.hpp>
-
 using ::com::sun::star::i18n::LocaleDataItem;
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -1724,6 +1729,72 @@ void ScColumn::GetString( SCROW nRow, St
 		rString.Erase();
 }
 
+template<>
+void  ScColumn::FillDPCacheT( long nDim, SCROW nStartRow, SCROW nEndRow, const boost::function<void(ScDPItemData*)> & rAddLabel, const boost::function<sal_Bool(long,ScDPItemData*, bool)> & rAddData )
+{
+    SCROW nPattenRowStart = -1, nPatternRowEnd = -1;
+    SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
+    sal_uLong nNumberFormat = 0;
+    sal_uLong nNumberFormatType = NUMBERFORMAT_NUMBER;
+    SCROW nCurRow = nStartRow;
+    ScDPItemData * pDPItemData = NULL;
+
+    if ( pItems )
+    {
+        SCSIZE nIndex;
+        
+        for ( Search( nStartRow, nIndex ) ? void( ) : void(nIndex = nCount); nIndex < nCount && pItems[nIndex].nRow <= nEndRow; ++nIndex, ++nCurRow )
+        {
+            for( ; nCurRow < pItems[nIndex].nRow; nCurRow++ )
+                if( nCurRow == nStartRow )
+                    rAddLabel( new ScDPItemData() );
+                else
+                    rAddData( nDim, new ScDPItemData(), false); 
+
+            if( nCurRow > nPatternRowEnd )
+                if( const ScPatternAttr* pPattern = pAttrArray ? pAttrArray->GetPatternRange( nPattenRowStart, nPatternRowEnd, nCurRow ) : NULL )
+                    nNumberFormatType = pFormatter->GetType( nNumberFormat = pPattern->GetNumberFormat( pFormatter ) );
+                else
+                    nNumberFormatType = NUMBERFORMAT_NUMBER, nNumberFormat = 0;
+
+            if( ScBaseCell* pCell = pItems[nIndex].pCell )
+                if( pCell->GetCellType() == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell)->GetErrCode() )
+		{
+		    String str( GetStringFromCell( pCell, nNumberFormat, pFormatter ) );
+		    sal_uInt8 bFlag = ScDPItemData::MK_ERR;
+                    pDPItemData = new ScDPItemData( 0, str, 0.0, bFlag );
+		}
+                else if( pCell->HasValueData() )
+                {
+                    double fVal = GetValueFromCell( pCell );
+                    String str( GetStringFromCell( pCell, nNumberFormat, pFormatter ) );
+                    sal_uInt8 bFlag = ScDPItemData::MK_VAL|ScDPItemData::MK_DATA|(ScDPItemData::MK_DATE * isDateFormat( nNumberFormatType ));
+                    pDPItemData = new ScDPItemData( nNumberFormat, str, fVal, bFlag );
+                }
+                else if( !pCell->IsBlank() )
+                    pDPItemData = new ScDPItemData( GetStringFromCell( pCell, nNumberFormat, pFormatter ) );
+                else
+                    pDPItemData = new ScDPItemData();
+            else
+                pDPItemData = new ScDPItemData();
+
+            if( nCurRow == nStartRow )
+                rAddLabel( pDPItemData );
+            else
+                rAddData( nDim, pDPItemData, false );
+        }
+    }
+
+    for( ; nCurRow <= nEndRow; nCurRow++ )
+        if( nCurRow == nStartRow )
+            rAddLabel( new ScDPItemData() );
+        else
+            rAddData( nDim, new ScDPItemData(), false );
+}
+void  ScColumn::FillDPCache( ScDPTableDataCache * pCache, long nDim, SCROW nStartRow, SCROW nEndRow )
+{
+    FillDPCacheT<boost::function<void(ScDPItemData*)>, boost::function<sal_Bool(long,ScDPItemData*, bool)> >( nDim, nStartRow, nEndRow, boost::bind( &ScDPTableDataCache::AddLabel, pCache, _1 ), boost::bind( &ScDPTableDataCache::AddData, pCache, _1, _2, _3 ) );
+}
 
 void ScColumn::GetInputString( SCROW nRow, String& rString ) const
 {

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/documen2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/documen2.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/documen2.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/documen2.cxx Mon Sep 17 08:06:09 2012
@@ -834,6 +834,7 @@ sal_Bool ScDocument::CopyTab( SCTAB nOld
 		if (nNewPos == nMaxTableNumber)
 		{
 			pTab[nMaxTableNumber] = new ScTable(this, nMaxTableNumber, aName);
+			pRangeName->UpdateTabRef(nNewPos, 4, nOldPos);//. 4 - copy table 
 			++nMaxTableNumber;
 		}
 		else
@@ -845,7 +846,7 @@ sal_Bool ScDocument::CopyTab( SCTAB nOld
 				ScRange aRange( 0,0,nNewPos, MAXCOL,MAXROW,MAXTAB );
 				xColNameRanges->UpdateReference( URM_INSDEL, this, aRange, 0,0,1 );
 				xRowNameRanges->UpdateReference( URM_INSDEL, this, aRange, 0,0,1 );
-				pRangeName->UpdateTabRef(nNewPos, 1);
+				pRangeName->UpdateTabRef(nNewPos, 4, nOldPos);//  4 - copy table
 				pDBCollection->UpdateReference(
 									URM_INSDEL, 0,0,nNewPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 );
 				if (pDPCollection)

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/document.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/document.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/document.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/document.cxx Mon Sep 17 08:06:09 2012
@@ -2683,6 +2683,11 @@ void ScDocument::GetString( SCCOL nCol, 
 		rString.Erase();
 }
 
+void ScDocument::FillDPCache( ScDPTableDataCache * pCache, SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow )
+{
+    if ( VALIDTAB(nTab) && pTab[nTab] )
+        pTab[nTab]->FillDPCache( pCache, nStartCol, nEndCol, nStartRow, nEndRow );
+}
 
 void ScDocument::GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString )
 {

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/dptablecache.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/dptablecache.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/dptablecache.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/dptablecache.cxx Mon Sep 17 08:06:09 2012
@@ -49,6 +49,7 @@ using ::com::sun::star::uno::Exception;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::uno::UNO_QUERY_THROW;
+
 // -----------------------------------------------------------------------
 namespace 
 {
@@ -548,17 +549,7 @@ bool ScDPTableDataCache::InitFromDoc(  S
 	mpSourceData	  = new std::vector<SCROW>[ mnColumnCount ];
 	mpGlobalOrder	  = new	std::vector<SCROW>[ mnColumnCount ];
 	mpIndexOrder	  = new std::vector<SCROW>[ mnColumnCount ];
-	//check valid
-	for ( SCROW nRow = nStartRow; nRow <= nEndRow; nRow ++ )
-	{
-		for ( sal_uInt16 nCol = nStartCol; nCol <= nEndCol; nCol++ )
-		{
-			if ( nRow == nStartRow )
-				AddLabel( new ScDPItemData( pDoc, nRow, nCol, nDocTab  ) );
-			else
-				AddData( nCol - nStartCol, new ScDPItemData( pDoc, nRow, nCol, nDocTab  ) );
-		}
-	}
+    pDoc->FillDPCache( this, nDocTab, nStartCol, nEndCol, nStartRow, nEndRow );
 	return sal_True;
 }
 
@@ -872,16 +863,15 @@ bool ScDPTableDataCache::IsEmptyMember( 
 	return !GetItemDataById( nColumn, GetItemDataId( nColumn, nRow, sal_False ) )->IsHasData();
 }
 
-sal_Bool ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData)
+sal_Bool ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData, bool bCheckDate )
 {
 	DBG_ASSERT( IsValid(), "  IsValid() == false " );
 	DBG_ASSERT( nDim < mnColumnCount && nDim >=0 , "dimension out of bound" );
 	SCROW nIndex = 0; 
 
 	sal_Bool	bInserted = sal_False;
-	
+	if( true == bCheckDate)	
 	pitemData->SetDate( lcl_isDate( GetNumType( pitemData->nNumFormat ) ) );
-
 	if ( !lcl_Search( mpTableDataValues[nDim], mpGlobalOrder[nDim], *pitemData, nIndex ) )
 	{
 		mpTableDataValues[nDim].push_back( pitemData );
@@ -907,7 +897,6 @@ sal_Bool ScDPTableDataCache::AddData(lon
 	return sal_True;
 }
 
-
 String ScDPTableDataCache::GetDimensionName( sal_uInt16 nColumn ) const
 {
     DBG_ASSERT( /* nColumn>=0 && */ nColumn < mrLabelNames.size()-1 , "ScDPTableDataCache::GetDimensionName");
@@ -920,6 +909,7 @@ String ScDPTableDataCache::GetDimensionN
 		return String();
 }
 
+
 void ScDPTableDataCache::AddLabel(ScDPItemData *pData)
 {  
 	DBG_ASSERT( IsValid(), "  IsValid() == false " );
@@ -1135,4 +1125,3 @@ long	ScDPTableDataCache::GetId() const 
 {
 	return mnID; 
 }
- 

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/global.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/global.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/global.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/global.cxx Mon Sep 17 08:06:09 2012
@@ -1123,7 +1123,9 @@ ScFuncRes::ScFuncRes( ResId &aRes, ScFun
 	pDesc->sHelpId = ReadByteStringRes();		//! Hack, see scfuncs.src
 	pDesc->nArgCount = GetNum();
 	sal_uInt16 nArgs = pDesc->nArgCount;
-	if (nArgs >= VAR_ARGS)
+	if (nArgs >= PAIRED_VAR_ARGS)
+	    nArgs -= PAIRED_VAR_ARGS - 2;
+	else if (nArgs >= VAR_ARGS)
         nArgs -= VAR_ARGS - 1;
 	if (nArgs)
 	{
@@ -1149,7 +1151,12 @@ ScFuncRes::ScFuncRes( ResId &aRes, ScFun
             sal_uInt16 nParam = GetNum();
             if (nParam < nArgs)
             {
-                if (pDesc->nArgCount >= VAR_ARGS && nParam == nArgs-1)
+                if (pDesc->nArgCount >= PAIRED_VAR_ARGS && nParam >= nArgs-2)
+                {
+                    DBG_ERROR3( "ScFuncRes: PAIRED_VAR_ARGS parameters can't be suppressed, on OpCode %u: param %d >= arg %d-2",
+                            aRes.GetId(), (int)nParam, (int)nArgs);
+                }
+                else if (pDesc->nArgCount >= VAR_ARGS && nParam == nArgs-1)
                 {
                     DBG_ERROR3( "ScFuncRes: VAR_ARGS parameters can't be suppressed, on OpCode %u: param %d == arg %d-1",
                             aRes.GetId(), (int)nParam, (int)nArgs);
@@ -1426,7 +1433,8 @@ ScFuncDesc::~ScFuncDesc()
 void ScFuncDesc::Clear()
 {
     sal_uInt16 nArgs = nArgCount;
-    if (nArgs >= VAR_ARGS) nArgs -= VAR_ARGS-1;
+    if (nArgs >= PAIRED_VAR_ARGS) nArgs -= PAIRED_VAR_ARGS - 2;
+    else if (nArgs >= VAR_ARGS) nArgs -= VAR_ARGS - 1;
     if (nArgs)
     {
         for (sal_uInt16 i=0; i<nArgs; i++ )
@@ -1491,7 +1499,7 @@ String ScFuncDesc::GetParamList() const
                     aSig.Len() >= 2)
                 aSig.Erase( aSig.Len() - 2 );
         }
-        else
+        else if ( nArgCount < PAIRED_VAR_ARGS)
         {
             sal_uInt16 nFix = nArgCount - VAR_ARGS;
             for ( sal_uInt16 nArg = 0; nArg < nFix; nArg++ )
@@ -1516,6 +1524,34 @@ String ScFuncDesc::GetParamList() const
             aSig.Append(sep);
             aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ... " ));
         }
+        else
+        {
+            sal_uInt16 nFix = nArgCount - PAIRED_VAR_ARGS;
+            for ( sal_uInt16 nArg = 0; nArg < nFix; nArg++ )
+            {
+                if (!pDefArgFlags[nArg].bSuppress)
+                {
+                    aSig += *(ppDefArgNames[nArg]);
+                    aSig.Append(sep);
+                    aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " " ));
+                }
+            }
+
+            aSig += *(ppDefArgNames[nFix]);
+            aSig += '1';
+            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ", " ));
+            aSig += *(ppDefArgNames[nFix+1]);
+            aSig += '1';
+            aSig.Append(sep);
+            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " " ));
+            aSig += *(ppDefArgNames[nFix]);
+            aSig += '2';
+            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ", " ));
+            aSig += *(ppDefArgNames[nFix+1]);
+            aSig += '2';
+            aSig.Append(sep);
+            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ... " ));
+        }
     }
 
     return aSig;
@@ -1592,7 +1628,9 @@ sal_uInt16 ScFuncDesc::GetSuppressedArgC
         return nArgCount;
 
     sal_uInt16 nArgs = nArgCount;
-    if (nArgs >= VAR_ARGS)
+    if (nArgs >= PAIRED_VAR_ARGS)
+	    nArgs -= PAIRED_VAR_ARGS - 2;
+	else if (nArgs >= VAR_ARGS)
         nArgs -= VAR_ARGS - 1;
     sal_uInt16 nCount = nArgs;
     for (sal_uInt16 i=0; i < nArgs; ++i)
@@ -1600,7 +1638,9 @@ sal_uInt16 ScFuncDesc::GetSuppressedArgC
         if (pDefArgFlags[i].bSuppress)
             --nCount;
     }
-    if (nArgCount >= VAR_ARGS)
+    if (nArgCount >= PAIRED_VAR_ARGS)
+        nCount += PAIRED_VAR_ARGS - 2;
+    else if (nArgCount >= VAR_ARGS)
         nCount += VAR_ARGS - 1;
     return nCount;
 }
@@ -1645,7 +1685,9 @@ void ScFuncDesc::fillVisibleArgumentMapp
 
     _rArguments.reserve( nArgCount);
     sal_uInt16 nArgs = nArgCount;
-    if (nArgs >= VAR_ARGS)
+    if (nArgs >= PAIRED_VAR_ARGS)
+	    nArgs -= PAIRED_VAR_ARGS - 2;
+	else if (nArgs >= VAR_ARGS)
         nArgs -= VAR_ARGS - 1;
     for (sal_uInt16 i=0; i < nArgs; ++i)
     {

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/patattr.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/patattr.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/patattr.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/patattr.cxx Mon Sep 17 08:06:09 2012
@@ -135,27 +135,17 @@ inline int StrCmp( const String* pStr1, 
 	return ( pStr1 ? ( pStr2 ? ( *pStr1 == *pStr2 ) : sal_False ) : ( pStr2 ? sal_False : sal_True ) );
 }
 
-inline bool EqualPatternSets( const SfxItemSet& rSet1, const SfxItemSet& rSet2 )
-{
-    // #i62090# The SfxItemSet in the SfxSetItem base class always has the same ranges
-    // (single range from ATTR_PATTERN_START to ATTR_PATTERN_END), and the items are pooled,
-    // so it's enough to compare just the pointers (Count just because it's even faster).
-
-    if ( rSet1.Count() != rSet2.Count() )
-        return false;
 
-    SfxItemArray pItems1 = rSet1.GetItems_Impl();   // inline method of SfxItemSet
-    SfxItemArray pItems2 = rSet2.GetItems_Impl();
-
-    return ( 0 == memcmp( pItems1, pItems2, (ATTR_PATTERN_END - ATTR_PATTERN_START + 1) * sizeof(pItems1[0]) ) );
-}
 
 int __EXPORT ScPatternAttr::operator==( const SfxPoolItem& rCmp ) const
 {
     // #i62090# Use quick comparison between ScPatternAttr's ItemSets
 
-    return ( EqualPatternSets( GetItemSet(), static_cast<const ScPatternAttr&>(rCmp).GetItemSet() ) &&
-             StrCmp( GetStyleName(), static_cast<const ScPatternAttr&>(rCmp).GetStyleName() ) );
+   //optimize a comparing operation from 'memcmp' to 'hash compare' to improve xls loading performance, i120575
+   //More quickly comparing method using hashkey.
+   //the const_cast here will then only change the HashKey of that SfxItemSet, so it's safe.
+	return ((const_cast<ScPatternAttr&>(*this)).GetItemSet().QuickCompare( (const_cast<ScPatternAttr&>(static_cast<const ScPatternAttr&>(rCmp))).GetItemSet())&&
+		StrCmp( GetStyleName(), static_cast<const ScPatternAttr&>(rCmp).GetStyleName() ) );  
 }
 
 SfxPoolItem* __EXPORT ScPatternAttr::Create( SvStream& rStream, sal_uInt16 /* nVersion */ ) const

Modified: incubator/ooo/branches/writer001/main/sc/source/core/data/table2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/data/table2.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/data/table2.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/data/table2.cxx Mon Sep 17 08:06:09 2012
@@ -1054,6 +1054,13 @@ void ScTable::GetString( SCCOL nCol, SCR
 		rString.Erase();
 }
 
+void  ScTable::FillDPCache( ScDPTableDataCache * pCache, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow )
+{
+    for ( sal_uInt16 nCol = nStartCol; nCol <= nEndCol; nCol++ )
+        if( ValidCol( nCol ) )
+            aCol[nCol].FillDPCache( pCache, nCol - nStartCol, nStartRow, nEndRow );
+}
+
 
 void ScTable::GetInputString( SCCOL nCol, SCROW nRow, String& rString )
 {

Modified: incubator/ooo/branches/writer001/main/sc/source/core/inc/interpre.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/inc/interpre.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/inc/interpre.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/inc/interpre.hxx Mon Sep 17 08:06:09 2012
@@ -86,15 +86,29 @@ public:
     formula::FormulaToken* pPointer[ MAXSTACK ];
 };
 
-enum ScIterFunc {
-    ifSUM,                              // Aufsummieren
-    ifSUMSQ,                            // Quadratsummen
-    ifPRODUCT,                          // Multiplizieren
-    ifAVERAGE,                          // Durchschnitt
-    ifCOUNT,                            // Anzahl Werte
-    ifCOUNT2,                           // Anzahl Werte (nichtleer)
-    ifMIN,                              // Minimum
-    ifMAX                               // Maximum
+enum ScIterFunc
+{
+    ifSUM,     // Sum
+    ifSUMSQ,   // Sum squares
+    ifPRODUCT, // Product
+    ifAVERAGE, // Average
+    ifCOUNT,   // Count
+    ifCOUNT2,  // Count non-empty
+    ifMIN,     // Minimum
+    ifMAX      // Maximum
+};
+
+enum ScIterFuncIf
+{
+    ifSUMIF,    // Conditional sum
+    ifAVERAGEIF // Conditional average
+};
+
+enum ScIterFuncIfs
+{
+    ifSUMIFS,     // Multi-Conditional sum
+    ifAVERAGEIFS, // Multi-Conditional average
+    ifCOUNTIFS    // Multi-Conditional count
 };
 
 struct FormulaTokenRef_less
@@ -379,6 +393,7 @@ void ScLessEqual();
 void ScGreaterEqual();
 void ScAnd();
 void ScOr();
+void ScXor();
 void ScNot();
 void ScNeg();
 void ScPercentSign();
@@ -470,8 +485,14 @@ void ScColumn();
 void ScRow();
 void ScTable();
 void ScMatch();
+double IterateParametersIf( ScIterFuncIf );
 void ScCountIf();
 void ScSumIf();
+void ScAverageIf();
+double IterateParametersIfs( ScIterFuncIfs );
+void ScSumIfs();
+void ScAverageIfs();
+void ScCountIfs();
 void ScCountEmptyCells();
 void ScLookup();
 void ScHLookup();

Modified: incubator/ooo/branches/writer001/main/sc/source/core/inc/parclass.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/inc/parclass.hxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/inc/parclass.hxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/inc/parclass.hxx Mon Sep 17 08:06:09 2012
@@ -102,7 +102,7 @@ private:
         const static size_t nMaxParams = 7;
 
         Type        nParam[nMaxParams];
-        bool        bRepeatLast;
+        sal_uInt8   nRepeatLast;
     };
 
     // SUNWS7 needs a forward declared friend, otherwise members of the outer
@@ -163,11 +163,11 @@ private:
                                         return 0;
                                     }
 
-                                /** Whether last parameter type is repeated. */
+                                /** Whether last parameter types are repeated. */
     static  inline  bool        HasRepeatParameters( OpCode eOp)
                                     {
                                         return eOp <= SC_OPCODE_LAST_OPCODE_ID
-                                            && pData[eOp].aData.bRepeatLast;
+                                            && pData[eOp].aData.nRepeatLast > 0;
                                     }
 #endif // OSL_DEBUG_LEVEL
 };

Modified: incubator/ooo/branches/writer001/main/sc/source/core/tool/compiler.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sc/source/core/tool/compiler.cxx?rev=1386501&r1=1386500&r2=1386501&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sc/source/core/tool/compiler.cxx (original)
+++ incubator/ooo/branches/writer001/main/sc/source/core/tool/compiler.cxx Mon Sep 17 08:06:09 2012
@@ -2964,6 +2964,14 @@ sal_Bool ScCompiler::IsNamedRange( const
 
     sal_uInt16 n;
     ScRangeName* pRangeName = pDoc->GetRangeName();
+    if (pRangeName->SearchNameUpper( rUpperName, n, aPos.Tab() ) )
+    {
+        ScRangeData* pData = (*pRangeName)[n];
+        ScRawToken aToken;
+        aToken.SetName( pData->GetIndex() );
+        pRawToken = aToken.Clone();
+        return sal_True;
+    }
     if (pRangeName->SearchNameUpper( rUpperName, n ) )
     {
         ScRangeData* pData = (*pRangeName)[n];
@@ -4847,7 +4855,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab
 
 // aPos.Tab() must be already adjusted!
 ScRangeData* ScCompiler::UpdateMoveTab( SCTAB nOldTab, SCTAB nNewTab,
-        sal_Bool bIsName )
+       bool bIsName, bool bOnlyUpdateOwnTab /*= FALSE*/)
 {
     ScRangeData* pRangeData = NULL;
     SCsTAB nTab;
@@ -4904,7 +4912,7 @@ ScRangeData* ScCompiler::UpdateMoveTab( 
                     nTab = rRef1.nTab;
                 if ( nTab == nOldTab )
                     rRef1.nTab = nNewTab;
-                else if ( nStart <= nTab && nTab <= nEnd )
+                else if ( nStart <= nTab && nTab <= nEnd && !bOnlyUpdateOwnTab)
                     rRef1.nTab = nTab + nDir;
                 rRef1.nRelTab = rRef1.nTab - nPosTab;
             }
@@ -4921,7 +4929,7 @@ ScRangeData* ScCompiler::UpdateMoveTab( 
                         nTab = rRef2.nTab;
                     if ( nTab == nOldTab )
                         rRef2.nTab = nNewTab;
-                    else if ( nStart <= nTab && nTab <= nEnd )
+                    else if ( nStart <= nTab && nTab <= nEnd && !bOnlyUpdateOwnTab)
                         rRef2.nTab = nTab + nDir;
                     rRef2.nRelTab = rRef2.nTab - nPosTab;
                 }



Mime
View raw message