[ooo-build-commit] .: patches/dev300
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Oct 5 13:07:24 PDT 2010
patches/dev300/apply | 3
patches/dev300/calc-dp-sort-fix.diff | 428 -----------------------------------
2 files changed, 431 deletions(-)
New commits:
commit d371e4e83cae3dfe253f8da9e8860612b4a4c174
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Oct 5 16:06:58 2010 -0400
Removed calc-dp-sort-fix.diff; moved to git.
diff --git a/patches/dev300/apply b/patches/dev300/apply
index f86518a..2b422a5 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -2659,9 +2659,6 @@ calc-formula-db-function-fix.diff, n#594332, n#595713, kohei
# Opening an xml file with xls extension
sc-xml-with-xls-ext.diff, n#527738, muthusuba
-# Properly display data field names in the data field options dialog.
-calc-dp-sort-fix.diff, n#629920, kohei
-
# Treat external reference tokens with ocPush & dump ocExternalRef opcode.
calc-extref-interpreter-rework-formula.diff, n#628876, kohei
calc-extref-interpreter-rework-sc.diff, n#628876, kohei
diff --git a/patches/dev300/calc-dp-sort-fix.diff b/patches/dev300/calc-dp-sort-fix.diff
deleted file mode 100644
index ab50c13..0000000
--- a/patches/dev300/calc-dp-sort-fix.diff
+++ /dev/null
@@ -1,428 +0,0 @@
-diff --git sc/inc/pivot.hxx sc/inc/pivot.hxx
-index 09a88b4..72f8e4e 100644
---- sc/inc/pivot.hxx
-+++ sc/inc/pivot.hxx
-@@ -133,6 +133,16 @@ typedef PivotField PivotPageFieldArr[PIVOT_MAXPAGEFIELD];
-
- //------------------------------------------------------------------------
-
-+struct ScDPName
-+{
-+ ::rtl::OUString maName; /// Original name of the dimension.
-+ ::rtl::OUString maLayoutName; /// Layout name (display name)
-+
-+ explicit ScDPName(const ::rtl::OUString& rName, const ::rtl::OUString& rLayoutName);
-+};
-+
-+// ============================================================================
-+
- struct ScDPLabelData
- {
- ::rtl::OUString maName; /// Original name of the dimension.
-@@ -190,7 +200,7 @@ struct ScDPFuncData
- // ============================================================================
-
- typedef std::vector< ScDPLabelData > ScDPLabelDataVec;
--typedef std::vector< String > ScDPNameVec;
-+typedef std::vector<ScDPName> ScDPNameVec;
-
- // ============================================================================
-
-diff --git sc/source/core/data/pivot2.cxx sc/source/core/data/pivot2.cxx
-index eea170b..e2bfbe8 100644
---- sc/source/core/data/pivot2.cxx
-+++ sc/source/core/data/pivot2.cxx
-@@ -63,6 +63,11 @@ using ::rtl::OUString;
- // STATIC DATA -----------------------------------------------------------
- // ============================================================================
-
-+ScDPName::ScDPName(const OUString& rName, const OUString& rLayoutName) :
-+ maName(rName), maLayoutName(rLayoutName) {}
-+
-+// ============================================================================
-+
- ScDPLabelData::Member::Member() :
- mbVisible(true),
- mbShowDetails(true)
-diff --git sc/source/ui/dbgui/pvfundlg.cxx sc/source/ui/dbgui/pvfundlg.cxx
-index bcaa5de..a5f32de 100644
---- sc/source/ui/dbgui/pvfundlg.cxx
-+++ sc/source/ui/dbgui/pvfundlg.cxx
-@@ -105,15 +105,6 @@ bool lclFillListBox( ListBoxType& rLBox, const vector<ScDPLabelData::Member>& rM
- return bEmpty;
- }
-
--/** Searches for a listbox entry, starts search at specified position. */
--USHORT lclFindListBoxEntry( const ListBox& rLBox, const String& rEntry, USHORT nStartPos )
--{
-- USHORT nPos = nStartPos;
-- while( (nPos < rLBox.GetEntryCount()) && (rLBox.GetEntry( nPos ) != rEntry) )
-- ++nPos;
-- return (nPos < rLBox.GetEntryCount()) ? nPos : LISTBOX_ENTRY_NOTFOUND;
--}
--
- /** This table represents the order of the strings in the resource string array. */
- static const USHORT spnFunctions[] =
- {
-@@ -243,7 +234,7 @@ DataPilotFieldReference ScDPFunctionDlg::GetFieldRef() const
- DataPilotFieldReference aRef;
-
- aRef.ReferenceType = maLbTypeWrp.GetControlValue();
-- aRef.ReferenceField = maLbBaseField.GetSelectEntry();
-+ aRef.ReferenceField = GetBaseFieldName(maLbBaseField.GetSelectEntry());
-
- USHORT nBaseItemPos = maLbBaseItem.GetSelectEntryPos();
- switch( nBaseItemPos )
-@@ -258,7 +249,7 @@ DataPilotFieldReference ScDPFunctionDlg::GetFieldRef() const
- {
- aRef.ReferenceItemType = DataPilotFieldReferenceItemType::NAMED;
- if( !mbEmptyItem || (nBaseItemPos > SC_BASEITEM_USER_POS) )
-- aRef.ReferenceItemName = maLbBaseItem.GetSelectEntry();
-+ aRef.ReferenceItemName = GetBaseItemName(maLbBaseItem.GetSelectEntry());
- }
- }
-
-@@ -289,8 +280,15 @@ void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScDPFuncData&
- maLbBaseField.SetSelectHdl( LINK( this, ScDPFunctionDlg, SelectHdl ) );
-
- // base field list box
-+ OUString aSelectedEntry;
- for( ScDPLabelDataVec::const_iterator aIt = mrLabelVec.begin(), aEnd = mrLabelVec.end(); aIt != aEnd; ++aIt )
-+ {
- maLbBaseField.InsertEntry(aIt->getDisplayName());
-+ maBaseFieldNameMap.insert(
-+ NameMapType::value_type(aIt->getDisplayName(), aIt->maName));
-+ if (aIt->maName == rFuncData.maFieldRef.ReferenceField)
-+ aSelectedEntry = aIt->getDisplayName();
-+ }
-
- // base item list box
- maLbBaseItem.SetSeparatorPos( SC_BASEITEM_USER_POS - 1 );
-@@ -300,7 +298,7 @@ void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScDPFuncData&
- SelectHdl( &maLbType ); // enables base field/item list boxes
-
- // select base field
-- maLbBaseField.SelectEntry( rFuncData.maFieldRef.ReferenceField );
-+ maLbBaseField.SelectEntry(aSelectedEntry);
- if( maLbBaseField.GetSelectEntryPos() >= maLbBaseField.GetEntryCount() )
- maLbBaseField.SelectEntryPos( 0 );
- SelectHdl( &maLbBaseField ); // fills base item list, selects base item
-@@ -324,7 +322,7 @@ void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScDPFuncData&
- else
- {
- USHORT nStartPos = mbEmptyItem ? (SC_BASEITEM_USER_POS + 1) : SC_BASEITEM_USER_POS;
-- USHORT nPos = lclFindListBoxEntry( maLbBaseItem, rFuncData.maFieldRef.ReferenceItemName, nStartPos );
-+ USHORT nPos = FindBaseItemPos( rFuncData.maFieldRef.ReferenceItemName, nStartPos );
- if( nPos >= maLbBaseItem.GetEntryCount() )
- nPos = (maLbBaseItem.GetEntryCount() > SC_BASEITEM_USER_POS) ? SC_BASEITEM_USER_POS : SC_BASEITEM_PREV_POS;
- maLbBaseItem.SelectEntryPos( nPos );
-@@ -333,6 +331,36 @@ void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScDPFuncData&
- }
- }
-
-+const OUString& ScDPFunctionDlg::GetBaseFieldName(const OUString& rLayoutName) const
-+{
-+ NameMapType::const_iterator itr = maBaseFieldNameMap.find(rLayoutName);
-+ return itr == maBaseFieldNameMap.end() ? rLayoutName : itr->second;
-+}
-+
-+const OUString& ScDPFunctionDlg::GetBaseItemName(const OUString& rLayoutName) const
-+{
-+ NameMapType::const_iterator itr = maBaseItemNameMap.find(rLayoutName);
-+ return itr == maBaseItemNameMap.end() ? rLayoutName : itr->second;
-+}
-+
-+sal_uInt16 ScDPFunctionDlg::FindBaseItemPos( const String& rEntry, USHORT nStartPos ) const
-+{
-+ sal_uInt16 nPos = nStartPos;
-+ bool bFound = false;
-+ while (nPos < maLbBaseItem.GetEntryCount())
-+ {
-+ // translate the displayed field name back to its original field name.
-+ const OUString& rName = GetBaseItemName(maLbBaseItem.GetEntry(nPos));
-+ if (rName.equals(rEntry))
-+ {
-+ bFound = true;
-+ break;
-+ }
-+ ++nPos;
-+ }
-+ return bFound ? nPos : LISTBOX_ENTRY_NOTFOUND;
-+}
-+
- IMPL_LINK( ScDPFunctionDlg, SelectHdl, ListBox*, pLBox )
- {
- if( pLBox == &maLbType )
-@@ -373,7 +401,16 @@ IMPL_LINK( ScDPFunctionDlg, SelectHdl, ListBox*, pLBox )
- mbEmptyItem = false;
- size_t nBasePos = maLbBaseField.GetSelectEntryPos();
- if( nBasePos < mrLabelVec.size() )
-- mbEmptyItem = lclFillListBox( maLbBaseItem, mrLabelVec[ nBasePos ].maMembers, SC_BASEITEM_USER_POS );
-+ {
-+ const vector<ScDPLabelData::Member>& rMembers = mrLabelVec[nBasePos].maMembers;
-+ mbEmptyItem = lclFillListBox( maLbBaseItem, rMembers, SC_BASEITEM_USER_POS );
-+ // build cache for base names.
-+ NameMapType aMap;
-+ vector<ScDPLabelData::Member>::const_iterator itr = rMembers.begin(), itrEnd = rMembers.end();
-+ for (; itr != itrEnd; ++itr)
-+ aMap.insert(NameMapType::value_type(itr->getDisplayName(), itr->maName));
-+ maBaseItemNameMap.swap(aMap);
-+ }
-
- // select base item
- USHORT nItemPos = (maLbBaseItem.GetEntryCount() > SC_BASEITEM_USER_POS) ? SC_BASEITEM_USER_POS : SC_BASEITEM_PREV_POS;
-@@ -545,7 +582,7 @@ void ScDPSubtotalOptDlg::FillLabelData( ScDPLabelData& rLabelData ) const
- else
- rLabelData.maSortInfo.Mode = DataPilotFieldSortMode::DATA;
-
-- rLabelData.maSortInfo.Field = maLbSortBy.GetSelectEntry();
-+ rLabelData.maSortInfo.Field = GetFieldName(maLbSortBy.GetSelectEntry());
- rLabelData.maSortInfo.IsAscending = maRbSortAsc.IsChecked();
-
- // *** LAYOUT MODE ***
-@@ -558,7 +595,7 @@ void ScDPSubtotalOptDlg::FillLabelData( ScDPLabelData& rLabelData ) const
- rLabelData.maShowInfo.IsEnabled = maCbShow.IsChecked();
- rLabelData.maShowInfo.ShowItemsMode = maLbShowFromWrp.GetControlValue();
- rLabelData.maShowInfo.ItemCount = sal::static_int_cast<sal_Int32>( maNfShow.GetValue() );
-- rLabelData.maShowInfo.DataField = maLbShowUsing.GetSelectEntry();
-+ rLabelData.maShowInfo.DataField = GetFieldName(maLbShowUsing.GetSelectEntry());
-
- // *** HIDDEN ITEMS ***
-
-@@ -583,16 +620,20 @@ void ScDPSubtotalOptDlg::Init( const ScDPNameVec& rDataFields, bool bEnableLayou
-
- for( ScDPNameVec::const_iterator aIt = rDataFields.begin(), aEnd = rDataFields.end(); aIt != aEnd; ++aIt )
- {
-- maLbSortBy.InsertEntry( *aIt );
-- maLbShowUsing.InsertEntry( *aIt ); // for AutoShow
-+ // Cache names for later lookup.
-+ maDataFieldNameMap.insert(NameMapType::value_type(aIt->maLayoutName, aIt->maName));
-+
-+ maLbSortBy.InsertEntry( aIt->maLayoutName );
-+ maLbShowUsing.InsertEntry( aIt->maLayoutName ); // for AutoShow
- }
-+
- if( maLbSortBy.GetEntryCount() > SC_SORTDATA_POS )
- maLbSortBy.SetSeparatorPos( SC_SORTDATA_POS - 1 );
-
- USHORT nSortPos = SC_SORTNAME_POS;
- if( nSortMode == DataPilotFieldSortMode::DATA )
- {
-- nSortPos = lclFindListBoxEntry( maLbSortBy, maLabelData.maSortInfo.Field, SC_SORTDATA_POS );
-+ nSortPos = FindListBoxEntry( maLbSortBy, maLabelData.maSortInfo.Field, SC_SORTDATA_POS );
- if( nSortPos >= maLbSortBy.GetEntryCount() )
- {
- nSortPos = SC_SORTNAME_POS;
-@@ -681,6 +722,31 @@ void ScDPSubtotalOptDlg::InitHideListBox()
- maLbHide.Enable( bEnable );
- }
-
-+const OUString& ScDPSubtotalOptDlg::GetFieldName(const OUString& rLayoutName) const
-+{
-+ NameMapType::const_iterator itr = maDataFieldNameMap.find(rLayoutName);
-+ return itr == maDataFieldNameMap.end() ? rLayoutName : itr->second;
-+}
-+
-+sal_uInt16 ScDPSubtotalOptDlg::FindListBoxEntry(
-+ const ListBox& rLBox, const String& rEntry, USHORT nStartPos ) const
-+{
-+ sal_uInt16 nPos = nStartPos;
-+ bool bFound = false;
-+ while (nPos < rLBox.GetEntryCount())
-+ {
-+ // translate the displayed field name back to its original field name.
-+ const OUString& rName = GetFieldName(rLBox.GetEntry(nPos));
-+ if (rName.equals(rEntry))
-+ {
-+ bFound = true;
-+ break;
-+ }
-+ ++nPos;
-+ }
-+ return bFound ? nPos : LISTBOX_ENTRY_NOTFOUND;
-+}
-+
- IMPL_LINK( ScDPSubtotalOptDlg, RadioClickHdl, RadioButton*, pBtn )
- {
- maLbSortBy.Enable( pBtn != &maRbSortMan );
-diff --git sc/source/ui/dbgui/pvlaydlg.cxx sc/source/ui/dbgui/pvlaydlg.cxx
-index 1b2c41e..81eac1b 100644
---- sc/source/ui/dbgui/pvlaydlg.cxx
-+++ sc/source/ui/dbgui/pvlaydlg.cxx
-@@ -469,10 +469,14 @@ void ScDPLayoutDlg::InitWnd( PivotField* pArr, long nCount, ScDPFieldType eType
- DBG_ASSERT( pData, "ScDPLabelData not found" );
- if (pData)
- {
-- String aStr( GetFuncString( (*pInitArr)[j]->mnFuncMask,
-- pData->mbIsValue ) );
-+ OUString aStr = pData->maLayoutName;
-+ if (!aStr.getLength())
-+ {
-+ USHORT nInitMask = (*pInitArr)[j]->mnFuncMask;
-+ aStr = GetFuncString(nInitMask, pData->mbIsValue);
-+ aStr += pData->maName;
-+ }
-
-- aStr += GetLabelString( nCol );
- pInitWnd->AddField( aStr, j );
-
- pData->mnFuncMask = nMask;
-@@ -615,10 +619,14 @@ void ScDPLayoutDlg::AddField( size_t nFromIndex, ScDPFieldType eToType, const Po
- }
- else
- {
-+ ScDPLabelData* p = GetLabelData(fData.mnCol);
-+ OUString aStr = p->maLayoutName;
- USHORT nMask = fData.mnFuncMask;
-- OUString aStr = GetFuncString( nMask, rData.mbIsValue );
--
-- aStr += rData.getDisplayName();
-+ if (!aStr.getLength())
-+ {
-+ aStr = GetFuncString(nMask);
-+ aStr += p->maName;
-+ }
-
- if ( toWnd->AddField( aStr,
- DlgPos2WndPos( rAtPos, *toWnd ),
-@@ -765,10 +773,14 @@ void ScDPLayoutDlg::MoveField( ScDPFieldType eFromType, size_t nFromIndex, ScDPF
- }
- else
- {
-- String aStr;
-+ ScDPLabelData* p = GetLabelData(fData.mnCol);
-+ OUString aStr = p->maLayoutName;
- USHORT nMask = fData.mnFuncMask;
-- aStr = GetFuncString( nMask );
-- aStr += GetLabelString( fData.mnCol );
-+ if (!aStr.getLength())
-+ {
-+ aStr = GetFuncString(nMask);
-+ aStr += p->maName;
-+ }
-
- if ( toWnd->AddField( aStr,
- DlgPos2WndPos( rAtPos, *toWnd ),
-@@ -846,10 +858,14 @@ void ScDPLayoutDlg::MoveField( ScDPFieldType eFromType, size_t nFromIndex, ScDPF
- }
- else
- {
-- String aStr;
-+ ScDPLabelData* p = GetLabelData(fData.mnCol);
-+ OUString aStr = p->maLayoutName;
- USHORT nMask = fData.mnFuncMask;
-- aStr = GetFuncString( nMask );
-- aStr += GetLabelString( fData.mnCol );
-+ if (!aStr.getLength())
-+ {
-+ aStr = GetFuncString(nMask);
-+ aStr += p->maName;
-+ }
-
- if ( theWnd->AddField( aStr,
- DlgPos2WndPos( rAtPos, *theWnd ),
-@@ -1017,13 +1033,26 @@ void ScDPLayoutDlg::NotifyDoubleClick( ScDPFieldType eType, size_t nFieldIndex )
- case TYPE_ROW:
- {
- // list of names of all data fields
-- std::vector< String > aDataFieldNames;
-+ vector<ScDPName> aDataFieldNames;
- for( ScDPFuncDataVec::const_iterator aIt = aDataArr.begin(), aEnd = aDataArr.end();
- (aIt != aEnd) && aIt->get(); ++aIt )
- {
-- String aName( GetLabelString( (*aIt)->mnCol ) );
-- if( aName.Len() )
-- aDataFieldNames.push_back( aName );
-+ ScDPLabelData* pDFData = GetLabelData((*aIt)->mnCol);
-+ if (!pDFData)
-+ continue;
-+
-+ if (!pDFData->maName.getLength())
-+ continue;
-+
-+ OUString aLayoutName = pDFData->maLayoutName;
-+ if (!aLayoutName.getLength())
-+ {
-+ // No layout name exists. Use the stock name.
-+ USHORT nMask = (*aIt)->mnFuncMask;
-+ OUString aFuncStr = GetFuncString(nMask);
-+ aLayoutName = aFuncStr + pDFData->maName;
-+ }
-+ aDataFieldNames.push_back(ScDPName(pDFData->maName, aLayoutName));
- }
-
- bool bLayout = (eType == TYPE_ROW) &&
-@@ -1053,8 +1082,14 @@ void ScDPLayoutDlg::NotifyDoubleClick( ScDPFieldType eType, size_t nFieldIndex )
- (*pArr)[nFieldIndex]->mnFuncMask = pData->mnFuncMask = pDlg->GetFuncMask();
- (*pArr)[nFieldIndex]->maFieldRef = pDlg->GetFieldRef();
-
-- String aStr( GetFuncString ( aDataArr[nFieldIndex]->mnFuncMask ) );
-- aStr += GetLabelString( aDataArr[nFieldIndex]->mnCol );
-+ ScDPLabelData* p = GetLabelData(aDataArr[nFieldIndex]->mnCol);
-+ OUString aStr = p->maLayoutName;
-+ if (!aStr.getLength())
-+ {
-+ // Layout name is not available. Use default name.
-+ aStr = GetFuncString (aDataArr[nFieldIndex]->mnFuncMask);
-+ aStr += p->maName;
-+ }
- aWndData.SetFieldText( aStr, nFieldIndex );
- }
- delete pDlg;
-diff --git sc/source/ui/inc/pvfundlg.hxx sc/source/ui/inc/pvfundlg.hxx
-index 4f219d8..ab61819 100644
---- sc/source/ui/inc/pvfundlg.hxx
-+++ sc/source/ui/inc/pvfundlg.hxx
-@@ -78,6 +78,7 @@ private:
-
- class ScDPFunctionDlg : public ModalDialog
- {
-+ typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > NameMapType;
- public:
- explicit ScDPFunctionDlg( Window* pParent, const ScDPLabelDataVec& rLabelVec,
- const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData );
-@@ -88,6 +89,12 @@ public:
- private:
- void Init( const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData );
-
-+ const ::rtl::OUString& GetBaseFieldName(const ::rtl::OUString& rLayoutName) const;
-+ const ::rtl::OUString& GetBaseItemName(const ::rtl::OUString& rLayoutName) const;
-+
-+ /** Searches for a listbox entry, starts search at specified position. */
-+ sal_uInt16 FindBaseItemPos( const String& rEntry, USHORT nStartPos ) const;
-+
- DECL_LINK( SelectHdl, ListBox* );
- DECL_LINK( DblClickHdl, MultiListBox* );
-
-@@ -108,6 +115,9 @@ private:
- HelpButton maBtnHelp;
- MoreButton maBtnMore;
-
-+ NameMapType maBaseFieldNameMap; // cache for base field display -> original name.
-+ NameMapType maBaseItemNameMap; // cache for base item display -> original name.
-+
- ScDPListBoxWrapper maLbTypeWrp; /// Wrapper for direct usage of API constants.
-
- const ScDPLabelDataVec& mrLabelVec; /// Data of all labels.
-@@ -170,6 +180,11 @@ private:
- void Init( const ScDPNameVec& rDataFields, bool bEnableLayout );
- void InitHideListBox();
-
-+ const ::rtl::OUString& GetFieldName(const ::rtl::OUString& rLayoutName) const;
-+
-+ /** Searches for a listbox entry, starts search at specified position. */
-+ sal_uInt16 FindListBoxEntry( const ListBox& rLBox, const String& rEntry, USHORT nStartPos ) const;
-+
- DECL_LINK( RadioClickHdl, RadioButton* );
- DECL_LINK( CheckHdl, CheckBox* );
- DECL_LINK( SelectHdl, ListBox* );
-@@ -205,6 +220,9 @@ private:
-
- ScDPObject& mrDPObj; /// The DataPilot object (for member names).
- ScDPLabelData maLabelData; /// Cache for members data.
-+
-+ typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > NameMapType;
-+ NameMapType maDataFieldNameMap; /// Cache for displayed name to field name mapping.
- };
-
- // ============================================================================
More information about the ooo-build-commit
mailing list